+2000-09-29 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * several files: type canges to reduce the number of warnings and
+ to unify type hangling a bit. Still much to do.
+
2000-09-29 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* lib/images/*: rename a bunch of icons to match Dekel converter
///
bool lockInset(UpdatableInset * inset);
///
- void showLockedInsetCursor(long x, long y, int asc, int desc);
+ void showLockedInsetCursor(int x, int y, int asc, int desc);
///
void hideLockedInsetCursor();
///
- void fitLockedInsetCursor(long x, long y, int asc, int desc);
+ void fitLockedInsetCursor(int x, int y, int asc, int desc);
///
int unlockInset(UpdatableInset * inset);
///
}
-void BufferView::showLockedInsetCursor(long x, long y, int asc, int desc)
+void BufferView::showLockedInsetCursor(int x, int y, int asc, int desc)
{
if (the_locking_inset && available()) {
LyXCursor cursor = text->cursor;
}
-void BufferView::fitLockedInsetCursor(long x, long y, int asc, int desc)
+void BufferView::fitLockedInsetCursor(int x, int y, int asc, int desc)
{
if (the_locking_inset && available()){
y += text->cursor.y() + the_locking_inset->InsetInInsetY();
{
if (!bv_->text->cursor.row()->previous()) return;
- long y = bv_->text->first;
+ int y = bv_->text->first;
Row * cursorrow = bv_->text->cursor.row();
bv_->text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y);
bv_->text->FinishUndo();
{
if (!bv_->text->cursor.row()->next()) return;
- long y = bv_->text->first;
+ int y = bv_->text->first;
bv_->text->GetRowNearY(y);
Row * cursorrow = bv_->text->cursor.row();
bv_->text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y
int actcell = 0;
int actpos = 0;
int currlinelen = 0;
- long fpos = 0;
+ int fpos = 0;
bool ref_printed = false;
ofstream ofs(fname.c_str());
unsigned int linelen) const
{
ostringstream buffer;
- LyXFont font1, font2;
+ LyXFont font1;
+ LyXFont font2;
Inset const * inset;
char c;
LyXParagraph::footnote_flag footnoteflag = LyXParagraph::NO_FOOTNOTE;
char depth = 0;
- string tmp;
- LyXParagraph::size_type i;
- unsigned int j;
int ltype = 0;
int ltype_depth = 0;
unsigned int currlinelen = 0;
if (footnoteflag != par->footnoteflag) {
footnoteflag = par->footnoteflag;
if (footnoteflag) {
- j = strlen(string_footnotekinds[par->footnotekind])+4;
+ size_t const j = strlen(string_footnotekinds[par->footnotekind]) + 4;
if ((linelen > 0) &&
((currlinelen + j) > linelen)) {
buffer << "\n";
currlinelen = 0;
}
- buffer <<
- "([" <<
- string_footnotekinds[par->footnotekind] <<
- "] ";
+ buffer << "(["
+ << string_footnotekinds[par->footnotekind]
+ << "] ";
currlinelen += j;
}
}
}
/* First write the layout */
- tmp = textclasslist.NameOfLayout(params.textclass, par->layout);
+ string const tmp = textclasslist.NameOfLayout(params.textclass, par->layout);
if (tmp == "Itemize") {
ltype = 1;
ltype_depth = depth+1;
}
font1 = LyXFont(LyXFont::ALL_INHERIT, params.language_info);
- for (i = 0; i < par->size(); ++i) {
+ for (LyXParagraph::size_type i = 0; i < par->size(); ++i) {
if (!i && !footnoteflag && !noparbreak){
buffer << "\n\n";
- for(j = 0; j < depth; ++j)
+ for(char j = 0; j < depth; ++j)
buffer << " ";
currlinelen = depth * 2;
switch(ltype) {
break;
}
if (ltype_depth > depth) {
- for(j = ltype_depth - 1; j > depth; --j)
+ for(char j = ltype_depth - 1; j > depth; --j)
buffer << " ";
currlinelen += (ltype_depth-depth)*2;
}
break;
case LyXParagraph::META_NEWLINE:
buffer << "\n";
- for(j = 0; j < depth; ++j)
+ for(char j = 0; j < depth; ++j)
buffer << " ";
currlinelen = depth * 2;
if (ltype_depth > depth) {
- for(j = ltype_depth;
+ for(char j = ltype_depth;
j > depth; --j)
buffer << " ";
currlinelen += (ltype_depth - depth) * 2;
(c == ' ') && ((i + 2) < par->size()))
{
buffer << "\n";
- for(j = 0; j < depth; ++j)
+ for(char j = 0; j < depth; ++j)
buffer << " ";
currlinelen = depth * 2;
if (ltype_depth > depth) {
- for(j = ltype_depth;
+ for(char j = ltype_depth;
j > depth; --j)
buffer << " ";
currlinelen += (ltype_depth-depth)*2;
#ifndef NEW_INSETS
///
void linuxDocHandleFootnote(std::ostream & os,
- LyXParagraph * & par, int const depth);
+ LyXParagraph * & par, int depth);
#endif
///
void DocBookHandleCaption(std::ostream & os, string & inner_tag,
- int const depth, int desc_on,
+ int depth, int desc_on,
LyXParagraph * & par);
#ifndef NEW_INSETS
///
void DocBookHandleFootnote(std::ostream & os,
- LyXParagraph * & par, int const depth);
+ LyXParagraph * & par, int depth);
#endif
///
void sgmlOpenTag(std::ostream & os, int depth,
string const & message);
///
void SimpleLinuxDocOnePar(std::ostream & os, LyXParagraph * par,
- int desc_on, int const depth);
+ int desc_on, int depth);
///
void SimpleDocBookOnePar(std::ostream &, string & extra,
LyXParagraph * par, int & desc_on,
- int const depth);
+ int depth);
/// LinuxDoc.
void push_tag(std::ostream & os, string const & tag,
if (type == FL_COMBOX_INPUT)
return fl_get_input(label);
else
- return (browser && sel > 0) ? fl_get_browser_line(browser, sel) : string();
+ return (browser && sel > 0) ?
+ fl_get_browser_line(browser, sel) : string();
}
#endif
}
-void FormBase::InputCB(FL_OBJECT * ob, long data )
+void FormBase::InputCB(FL_OBJECT * ob, long data)
{
FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
pre->input( data );
}
-void FormCitation::input( long data )
+void FormCitation::input(long data)
{
State cb = static_cast<FormCitation::State>( data );
/// Build the dialog
virtual void build();
/// Filter the inputs
- virtual void input( long );
+ virtual void input(long);
/// Update dialog before showing it
virtual void update();
/// Apply from dialog (modify or create inset)
/// Build the dialog
virtual void build();
/// Not used but must be instantiated
- virtual void input( long ) {}
+ virtual void input(long) {}
/// Update dialog before showing it
virtual void update();
/// Apply from dialog (modify or create inset)
}
-void FormRef::input( long data )
+void FormRef::input(long data)
{
switch( data ) {
// goto reference / go back
/// Build the dialog
virtual void build();
/// Filter the input
- virtual void input( long );
+ virtual void input(long);
/// Update dialog before showing it
virtual void update();
/// Not used but must be instantiated
/// Build the dialog
virtual void build();
/// Not used but must be instantiated
- virtual void input( long ) {}
+ virtual void input(long) {}
/// Update dialog before showing it
virtual void update();
/// Apply from dialog (modify or create inset)
/// Build the dialog
virtual void build();
/// Not used but must be instantiated
- virtual void input( long ) {}
+ virtual void input(long) {}
/// Update dialog before showing it
virtual void update();
/// Apply from dialog (modify or create inset)
if (num > 128) num = 128;
XColor xcol;
for (int i = 0; i < num; ++i) {
- xcol.red = xcol.green = xcol.blue = 65535 * i / (num - 1);
+ xcol.red = xcol.green = xcol.blue = short(65535 * i / (num - 1));
xcol.flags = DoRed | DoGreen | DoBlue;
if (!XAllocColor(fl_display,
fl_state[fl_get_vclass()].colormap, &xcol)) {
XInternAtom(tempdisp, "STRING", false),
8, PropModeAppend,
reinterpret_cast<unsigned char*>(const_cast<char*>(t1.str().c_str())),
- t1.str().size());
+ int(t1.str().size()));
XUngrabServer(tempdisp);
XFlush(tempdisp);
XInternAtom(tempdisp, "STRING", false),
8, PropModeReplace,
reinterpret_cast<unsigned char*>(const_cast<char*>(t3.str().c_str())),
- t3.str().size());
+ int(t3.str().size()));
XUngrabServer(tempdisp);
XFlush(tempdisp);
}
-int InsetCollapsable::InsetInInsetY()
+unsigned int InsetCollapsable::InsetInInsetY()
{
return inset->InsetInInsetY();
}
///
bool UpdateInsetInInset(BufferView *, Inset *);
///
- int InsetInInsetY();
+ unsigned int InsetInInsetY();
///
void InsetButtonRelease(BufferView *, int, int, int);
///
}
locked = true;
the_locking_inset = 0;
- inset_pos = inset_x = inset_y = 0;
+ inset_pos = 0;
+ inset_x = 0;
+ inset_y = 0;
setPos(bv, x, y);
sel_pos_start = sel_pos_end = cursor.pos();
sel_cell_start = sel_cell_end = actcell;
}
-int InsetTabular::InsetInInsetY()
+unsigned int InsetTabular::InsetInInsetY()
{
if (!the_locking_inset)
return 0;
void InsetTabular::GetCursorPos(BufferView *,
- unsigned long & x, unsigned long & y) const
+ int & x, int & y) const
{
x = cursor.x() - top_x;
y = cursor.y();
cursor.pos(0);
actcell = actrow = actcol = 0;
- int ly = tabular->GetDescentOfRow(actrow);
+ unsigned int ly = tabular->GetDescentOfRow(actrow);
// first search the right row
while((ly < y) && (actrow < tabular->rows())) {
cursor.y(cursor.y() + tabular->GetDescentOfRow(actrow) +
- tabular->GetAscentOfRow(actrow+1) +
+ tabular->GetAscentOfRow(actrow + 1) +
tabular->GetAdditionalHeight(tabular->GetCellNumber(actrow + 1,
actcol)));
++actrow;
actcell = tabular->GetCellNumber(actrow, actcol);
// now search the right column
- int lx = tabular->GetWidthOfColumn(actcell) -
+ unsigned int lx = tabular->GetWidthOfColumn(actcell) -
tabular->GetAdditionalWidth(actcell);
for(; !tabular->IsLastCellInRow(actcell) && (lx < x);
++actcell,lx += tabular->GetWidthOfColumn(actcell) +
///
bool UpdateInsetInInset(BufferView *, Inset *);
///
- int InsetInInsetY();
+ unsigned int InsetInInsetY();
///
UpdatableInset * GetLockingInset();
///
///
Inset::Code LyxCode() const { return Inset::TABULAR_CODE; }
///
- void GetCursorPos(BufferView *, unsigned long & x,
- unsigned long & y) const;
+ void GetCursorPos(BufferView *, int & x, int & y) const;
///
void ToggleInsetCursor(BufferView *);
///
///
mutable int inset_pos;
///
- mutable int inset_x;
+ mutable unsigned int inset_x;
///
- mutable unsigned long inset_y;
+ mutable unsigned int inset_y;
///
mutable int sel_pos_start;
///
void InsetText::init(InsetText const * ins)
{
- top_y = last_width = last_height = 0;
- insetAscent = insetDescent = insetWidth = 0;
+ top_y = 0;
+ last_width = 0;
+ last_height = 0;
+ insetAscent = 0;
+ insetDescent = 0;
+ insetWidth = 0;
the_locking_inset = 0;
cursor_visible = false;
interline_space = 1;
no_selection = false;
need_update = INIT;
- drawTextXOffset = drawTextYOffset = 0;
+ drawTextXOffset = 0;
+ drawTextYOffset = 0;
autoBreakRows = false;
drawFrame = NEVER;
xpos = 0.0;
int InsetText::ascent(BufferView * bv, LyXFont const &) const
{
- long int y_temp = 0;
+ int y_temp = 0;
Row * row = TEXT(bv)->GetRowNearY(y_temp);
insetAscent = row->ascent_of_text() + TEXT_TO_INSET_OFFSET;
return insetAscent;
int InsetText::descent(BufferView * bv, LyXFont const &) const
{
- long int y_temp = 0;
+ int y_temp = 0;
Row * row = TEXT(bv)->GetRowNearY(y_temp);
insetDescent = TEXT(bv)->height - row->ascent_of_text() +
TEXT_TO_INSET_OFFSET;
if (!cleared && ((need_update==FULL) || (top_x!=int(x)) ||
(top_baseline!=baseline))) {
int w = insetWidth;
- int h = insetAscent + insetDescent;
+ unsigned int h = insetAscent + insetDescent;
int ty = baseline - insetAscent;
if (ty < 0) {
return;
}
x += TEXT_TO_INSET_OFFSET;
- long int y = 0;
+ int y = 0;
Row * row = TEXT(bv)->GetRowNearY(y);
y += baseline - row->ascent_of_text();
if (cleared || !locked || (need_update == FULL)) {
if (TEXT(bv)->status == LyXText::NEED_MORE_REFRESH)
need_update = FULL;
- long int y_temp = 0;
+ int y_temp = 0;
Row * row = TEXT(bv)->GetRowNearY(y_temp);
insetAscent = row->ascent_of_text() + TEXT_TO_INSET_OFFSET;
insetDescent = TEXT(bv)->height - row->ascent_of_text() +
}
-void InsetText::GetCursorPos(BufferView * bv, int & x, int & y) const
+void InsetText::GetCursorPos(BufferView * bv,
+ int & x, int & y) const
{
x = cx(bv);
y = cy(bv);
}
-int InsetText::InsetInInsetY()
+unsigned int InsetText::InsetInInsetY()
{
if (!the_locking_inset)
return 0;
bool InsetText::checkAndActivateInset(BufferView * bv, bool behind)
{
if (cpar(bv)->GetChar(cpos(bv)) == LyXParagraph::META_INSET) {
- int x, y;
+ unsigned int x;
+ unsigned int y;
Inset * inset =
static_cast<UpdatableInset*>(cpar(bv)->GetInset(cpos(bv)));
if (!inset || inset->Editable() != Inset::HIGHLY_EDITABLE)
return false;
- LyXFont font = TEXT(bv)->GetFont(bv->buffer(), cpar(bv), cpos(bv));
+ LyXFont const font =
+ TEXT(bv)->GetFont(bv->buffer(), cpar(bv), cpos(bv));
if (behind) {
x = inset->width(bv, font);
y = inset->descent(bv, font);
}
inset_x = cx(bv) - top_x + drawTextXOffset;
inset_y = cy(bv) + drawTextYOffset;
- inset->Edit(bv, x-inset_x, y-inset_y, 0);
+ inset->Edit(bv, x - inset_x, y - inset_y, 0);
if (!the_locking_inset)
return false;
UpdateLocal(bv, CURSOR_PAR, false);
bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
int button)
{
- int tmp_x = x - drawTextXOffset;
- int tmp_y = y + insetAscent;
- Inset * inset = bv->checkInsetHit(TEXT(bv), tmp_x, tmp_y, button);
+ x = x - drawTextXOffset;
+ y = y + insetAscent;
+ Inset * inset = bv->checkInsetHit(TEXT(bv), x, y, button);
if (inset) {
if (x < 0)
#endif
-long InsetText::cx(BufferView * bv) const
+int InsetText::cx(BufferView * bv) const
{
return TEXT(bv)->cursor.x() + top_x + TEXT_TO_INSET_OFFSET;
}
-long InsetText::cy(BufferView * bv) const
+int InsetText::cy(BufferView * bv) const
{
LyXFont font;
return TEXT(bv)->cursor.y() - ascent(bv, font) + TEXT_TO_INSET_OFFSET;
///
void GetCursorPos(BufferView *, int & x, int & y) const;
///
- int InsetInInsetY();
+ unsigned int InsetInInsetY();
///
void ToggleInsetCursor(BufferView *);
///
void removeNewlines();
///
- long cx(BufferView *) const;
+ int cx(BufferView *) const;
///
- long cy(BufferView *) const;
+ int cy(BufferView *) const;
///
int cpos(BufferView *) const;
///
///
mutable int insetAscent;
///
- mutable long insetDescent;
+ mutable int insetDescent;
///
mutable int insetWidth;
///
virtual UpdatableInset * GetFirstLockingInsetOfType(Inset::Code c)
{ return (c == LyxCode()) ? this : 0; }
///
- virtual int InsetInInsetY() { return 0; }
+ virtual unsigned int InsetInInsetY() { return 0; }
///
virtual bool UpdateInsetInInset(BufferView *, Inset *)
{ return false; }
otherwise 0 */
// Now they work only for updatable insets. [Alejandro 080596]
//int LockInset(UpdatableInset * inset);
-void ToggleLockedInsetCursor(long x, long y, int asc, int desc);
+void ToggleLockedInsetCursor(int x, int y, int asc, int desc);
//void FitLockedInsetCursor(long x, long y, int asc, int desc);
//int UnlockInset(UpdatableInset * inset);
//void LockedInsetStoreUndo(Undo::undo_kind kind);
}
-void LyXCursor::y(unsigned long i)
+void LyXCursor::y(int i)
{
y_ = i;
}
-unsigned long LyXCursor::y() const
+int LyXCursor::y() const
{
return y_;
}
///
int x_fix() const;
///
- void y(unsigned long i);
+ void y(int i);
///
- unsigned long y() const;
+ int y() const;
///
void row(Row * r);
///
///
int x_fix_;
///
- unsigned long y_;
+ int y_;
///
Row * row_;
};
}
// Undo/Redo pre 0.13 is a bit tricky for insets.
if (action == LFUN_UNDO) {
- int slx, sly;
+ int slx;
+ int sly;
UpdatableInset * inset =
owner->view()->the_locking_inset;
inset->GetCursorPos(owner->view(), slx, sly);
inset->Edit(owner->view(),slx,sly,0);
return string();
} else if (action == LFUN_REDO) {
- int slx, sly;
+ int slx;
+ int sly;
UpdatableInset * inset = owner->view()->
the_locking_inset;
inset->GetCursorPos(owner->view(), slx, sly);
case LFUN_SETXY:
{
- int x;
- long y;
- ::sscanf(argument.c_str(), " %d %ld", &x, &y);
+ int x;
+ int y;
+ ::sscanf(argument.c_str(), " %d %d", &x, &y);
owner->view()->text->SetCursorFromCoordinates(owner->view(), x, y);
}
break;
/** Draws the screen form textposition y. Uses as much of
the already printed pixmap as possible */
- void Draw(LyXText *, unsigned long y);
+ void Draw(LyXText *, unsigned int y);
/// Redraws the screen, without using existing pixmap
void Redraw(LyXText *);
/// Returns a new top so that the cursor is visible
- unsigned long TopCursorVisible(LyXText const *);
+ unsigned int TopCursorVisible(LyXText const *);
/// Redraws the screen such that the cursor is visible
bool FitCursor(LyXText *);
///
///
void CursorToggle(LyXText const *);
///
- void ShowManualCursor(LyXText const *, long x, long y,
+ void ShowManualCursor(LyXText const *, int x, int y,
int asc, int desc,
Cursor_Shape shape);
/// returns 1 if first has changed, otherwise 0
- bool FitManualCursor(LyXText *, long, long, int, int);
+ bool FitManualCursor(LyXText *, int, int, int, int);
///
void ToggleSelection(LyXText *, bool = true, int y_offset = 0,
int x_offset = 0);
void expose(int x, int y, int exp_width, int exp_height);
/// y1 and y2 are coordinates of the screen
- void DrawFromTo(LyXText *, int y1, int y2, int y_offset=0, int x_offset=0);
+ void DrawFromTo(LyXText *, int y1, int y2,
+ int y_offset = 0, int x_offset = 0);
/// y is a coordinate of the text
- void DrawOneRow(LyXText *, Row * row, long y_text, int y_offset=0,
- int x_offset=0);
+ void DrawOneRow(LyXText *, Row * row, int y_text, int y_offset = 0,
+ int x_offset = 0);
///
WorkArea & owner;
///
mutable int number_of_rows;
///
- mutable long height;
+ mutable int height;
///
mutable unsigned int width;
/// the current font settings
/// the current font
mutable LyXFont real_current_font;
/// first visible pixel-row is set from LyXScreen!!!
- unsigned long first;
+ unsigned int first;
///
BufferView * bv_owner;
///
///
Row * need_break_row;
///
- mutable long refresh_y;
+ mutable int refresh_y;
///
int refresh_height;
///
(relative to the whole text). y is set to the real beginning
of this row
*/
- Row * GetRowNearY(long & y) const;
+ Row * GetRowNearY(int & y) const;
/** returns the column near the specified x-coordinate of the row
x is set to the real beginning of this column
of the row
*/
Row * GetRow(LyXParagraph * par,
- LyXParagraph::size_type pos, long & y) const;
+ LyXParagraph::size_type pos, int & y) const;
/** returns the height of a default row, needed for scrollbar
*/
LyXFont const & font) const;
///
- void SetCursorFromCoordinates(BufferView *, int x, long y) const;
+ void SetCursorFromCoordinates(BufferView *, int x, int y) const;
///
void SetCursorFromCoordinates(BufferView *, LyXCursor &,
- int x, long y) const;
+ int x, int y) const;
///
void CursorUp(BufferView *) const;
///
solution but faster.
*/
void GetVisibleRow(BufferView *, int y_offset, int x_offset,
- Row * row_ptr, long y, bool cleared=false);
+ Row * row_ptr, int y, bool cleared=false);
#ifndef NEW_INSETS
/* footnotes: */
static LyXFont::FONT_SIZE lfont_size = LyXFont::SIZE_NORMAL;
-// local global
-static int sel_x, sel_y;
+// local global
+static int sel_x;
+static int sel_y;
static bool sel_flag;
+
MathedCursor * InsetFormula::mathcursor = 0;
if (!mathcursor)
return;
- int x, y;
+ int x;
+ int y;
mathcursor->GetPos(x, y);
// x -= par->xo;
y -= par->yo;
{
if (!cursor_visible) {
if (mathcursor) {
- int x, y;
+ int x;
+ int y;
mathcursor->GetPos(x, y);
// x -= par->xo;
y -= par->yo;
mathcursor->SelStart();
ShowInsetCursor(bv);
mathcursor->GetPos(sel_x, sel_y);
- } else
- if (sel_flag) {
+ } else if (sel_flag) {
HideInsetCursor(bv);
x += par->xo;
y += par->yo;
// break;
case LFUN_SETXY:
{
- int x, y, x1, y1;
+ int x;
+ int y;
+ int x1;
+ int y1;
istringstream ist(arg.c_str());
ist >> x >> y;
par->GetXY(x1, y1);
lyxerr[Debug::MATHED] << "Mathed: Redrawing!" << endl;
par->Metrics();
int w = par->Width(), h = par->Height();
- int x, y;
+ int x;
+ int y;
par->GetXY(x, y);
//mathed_set_font(LM_TC_VAR, 1);
pain.fillRectangle(x, y - par->Ascent(),
} else // Navigate between arguments
if (p && p->GetType() == LM_OT_MACRO) {
if (p->getArgumentIdx() < p->getMaxArgumentIdx()) {
- p->setArgumentIdx(p->getArgumentIdx()+1);
+ p->setArgumentIdx(p->getArgumentIdx() + 1);
cursor->SetData(p);
return;
}
} else {
result = (p->getArgumentIdx() > 0);
if (result) {
- p->setArgumentIdx(p->getArgumentIdx()-1);
+ p->setArgumentIdx(p->getArgumentIdx() - 1);
cursor->SetData(p);
}
}
} else {
result = (p->getArgumentIdx() < p->getMaxArgumentIdx());
if (result) {
- p->setArgumentIdx(p->getArgumentIdx()+1);
+ p->setArgumentIdx(p->getArgumentIdx() + 1);
cursor->SetData(p);
}
}
}
// single row selection
- int i = 0, x, y, a, d, xo, yo, x1, y1, a1, d1;
+ int i = 0;
+ int a;
+ int d;
+ int a1;
+ int d1;
// Balance anchor and cursor
SelBalance();
+ int xo;
+ int yo;
cursor->p->GetXY(xo, yo);
int w = cursor->p->Width();
+ int x1;
+ int y1;
cursor->GetPos(x1, y1);
cursor->getAD(a1, d1);
+ int x;
+ int y;
anchor->GetPos(x, y);
anchor->getAD(a, d);
MATH_ALIGN_TOP = 8
};
///
-#define MATH_COLSEP 8
+static int const MATH_COLSEP = 8;
///
-#define MATH_ROWSEP 8
+static int const MATH_ROWSEP = 8;
/// Standard Math Sizes (Math mode styles)
///
virtual void SetAlign(char, string const &) {}
///
- virtual int GetColumns() { return 1; }
+ virtual int GetColumns() const { return 1; }
///
- virtual int GetRows() { return 1; }
+ virtual int GetRows() const { return 1; }
///
- virtual bool isMatrix() { return false; }
+ virtual bool isMatrix() const { return false; }
// Vertical switching
///
virtual bool setArgumentIdx(int i) { return (i == 0); }
///
virtual bool setNextArgIdx() { return false; }
///
- virtual int getArgumentIdx() { return 0; }
+ virtual int getArgumentIdx() const { return 0; }
///
- virtual int getMaxArgumentIdx() { return 0; }
+ virtual int getMaxArgumentIdx() const { return 0; }
///
virtual void SetStyle(short);
///
return h_align;
}
///
- int GetColumns() { return nc; }
+ int GetColumns() const { return nc; }
///
- int GetRows() { return nr; }
+ int GetRows() const { return nr; }
///
- virtual bool isMatrix() { return true; }
+ virtual bool isMatrix() const { return true; }
/// Use this to manage the extra information independently of paragraph
MathedRowSt * getRowSt() const { return row; }
int yy = y;
MathedInset * p = data.GetInset();
if (cx == LM_TC_UP) {
- if (limits) {
- x -= (xp>p->Width()) ? p->Width()+(xp-p->Width())/2: xp;
+ if (limits) { x -= (xp>p->Width()) ? p->Width()+(xp-p->Width())/2: xp;
yy -= (asc + p->Descent()+4);
} else
yy -= (p->Descent()>asc) ? p->Descent()+4: asc;
///
bool setArgumentIdx(int i); // was bool Up/down(void);
///
- int getArgumentIdx() { return int(idx); }
+ int getArgumentIdx() const { return idx; }
///
- int getMaxArgumentIdx() { return 1; }
+ int getMaxArgumentIdx() const { return 1; }
///
void SetStyle(short);
protected:
///
- short idx;
+ int idx;
///
MathParInset * den;
///
//----------- XIter
-MathedXIter::MathedXIter(MathParInset* pp): p(pp)
+MathedXIter::MathedXIter(MathParInset * pp)
+ : p(pp)
{
x = y = 0;
sx = sw = 0;
}
}
-void MathedXIter::SetData(MathParInset *pp)
+void MathedXIter::SetData(MathParInset * pp)
{
p = pp;
x = y = 0;
void MathedXIter::fitCoord(int /*xx*/, int yy)
{
- int xo = 0, yo = 0;
+ int xo = 0;
+ int yo = 0;
GoBegin();
if (p)
p->GetXY(xo, yo);
// first fit vertically
while (crow && OK()) {
- if (yy>= yo+y-crow->asc && yy<= yo+y+crow->desc)
+ if (yy >= yo + y - crow->asc && yy <= yo + y + crow->desc)
break;
goNextCode(LM_TC_CR);
Next();
// while (x<xx && Next());
}
+
void MathedXIter::setTab(int tx, int tab)
{
if (crow && tab<= ncols) {
// This function is not recursive, as MathPar::Metrics is
-void MathedXIter::IMetrics(int pos2, int& width, int& ascent, int& descent)
+void MathedXIter::IMetrics(int pos2, int & width, int & ascent, int & descent)
{
- byte cx, cxp= 0;// *s;
- int x1;// ls;
- int asc= 0, des= 0;
+ byte cx;
+ byte cxp = 0; // *s;
+ int x1; // ls;
+ int asc = 0;
+ int des = 0;
bool limit = false;
descent = ascent = width = 0;
MathedInset *pp = GetInset();
if (cx == LM_TC_UP) {
if (!asc && p) {
- int xx, yy;
+ int xx;
+ int yy;
p->GetXY(xx, yy);
static_cast<MathParInset*>(pp)->GetXY(xx, asc);
asc = yy - asc;
}
- asc += ((limits) ? pp->Height()+4: pp->Ascent());
+ asc += ((limits) ? pp->Height() + 4 : pp->Ascent());
} else
if (cx == LM_TC_DOWN) {
if (!des && p) {
- int xx, yy;
+ int xx;
+ int yy;
p->GetXY(xx, yy);
static_cast<MathParInset*>(pp)->GetXY(xx, des);
- if (des-pp->Height()<yy && !asc)
- asc = yy - (des-pp->Height());
+ if (des - pp->Height() < yy && !asc)
+ asc = yy - (des - pp->Height());
des -= yy;
}
des += (limit ? pp->Height()+4: pp->Height()-pp->Ascent()/2);
inline
int MathedXIter::GetX() const
{
- int xx, yy;
- GetPos(xx, yy);
+ int xx;
+ int dummy_y;
+ GetPos(xx, dummy_y);
return xx;
}
inline
int MathedXIter::GetY() const
{
- int xx, yy;
- GetPos(xx, yy);
+ int dummy_x;
+ int yy;
+ GetPos(dummy_x, yy);
return yy;
}
tmplate->update(this);
tmplate->SetStyle(size);
tmplate->draw(pain, x, y);
- for (int i = 0; i < nargs; ++i)
- tmplate->GetMacroXY(i, args[i].x, args[i].y);
+ for (int i = 0; i < nargs; ++i) {
+ tmplate->GetMacroXY(i, args[i].x, args[i].y);
+ }
}
-int MathMacro::GetColumns()
+int MathMacro::GetColumns() const
{
return tmplate->getMacroPar(idx)->GetColumns();
}
void MathMacroTemplate::Metrics()
{
- bool expnd = (nargs>0) ? args[0].getExpand(): false;
+ bool expnd = (nargs > 0) ? args[0].getExpand(): false;
if (flags & MMF_Edit) {
for (int i = 0; i < nargs; ++i) {
void MathMacroTemplate::update(MathMacro * macro)
{
- int idx = (macro) ? macro->getArgumentIdx(): 0;
+ int idx = (macro) ? macro->getArgumentIdx() : 0;
for (int i = 0; i < nargs; ++i) {
if (macro) {
macro->setArgumentIdx(i);
args[i].SetData(macro->GetData());
- MathedRowSt *row = macro->getRowSt();
+ MathedRowSt * row = macro->getRowSt();
args[i].setRowSt(row);
}
}
///
bool setArgumentIdx(int);
///
- int getArgumentIdx();
+ int getArgumentIdx() const;
///
- int getMaxArgumentIdx();
+ int getMaxArgumentIdx() const;
///
- int GetColumns();
+ int GetColumns() const;
///
void GetXY(int &, int &) const;
///
///
void SetData(LyxArrayBase *);
///
- MathedTextCodes getTCode() { return tcode; }
+ MathedTextCodes getTCode() const { return tcode; }
///
bool Permit(short);
/// Is expanded or not
void setExpand(bool e) { expnd_mode = e; }
/// Is expanded or not
- bool getExpand() { return expnd_mode; }
+ bool getExpand() const { return expnd_mode; }
private:
///
bool expnd_mode;
/// useful for special insets
void setTCode(MathedTextCodes t) { tcode = t; }
///
- MathedTextCodes getTCode() { return tcode; }
+ MathedTextCodes getTCode() const { return tcode; }
///
void setArgument(LyxArrayBase *, int i= 0);
/// Number of arguments
- int getNoArgs() { return nargs; }
+ int getNoArgs() const { return nargs; }
///
void GetMacroXY(int, int &, int &) const;
///
}
inline
-int MathMacro::getArgumentIdx()
+int MathMacro::getArgumentIdx() const
{
return idx;
}
inline
-int MathMacro::getMaxArgumentIdx()
+int MathMacro::getMaxArgumentIdx() const
{
return nargs - 1;
}
case '&': // Tab
{
- if ((flags & FLAG_END) && mt && data.getCol()<mt->GetColumns()-1) {
+ if ((flags & FLAG_END) && mt && data.getCol()<mt->GetColumns() - 1) {
data.setNumCols(mt->GetColumns());
data.Insert('T', LM_TC_TAB);
} else
if (mt && (flags & FLAG_END)) {
if (mt->Permit(LMPF_ALLOW_CR)) {
if (crow) {
- crow->setNext(new MathedRowSt(mt->GetColumns()+1)); // this leaks
+ crow->setNext(new MathedRowSt(mt->GetColumns() + 1)); // this leaks
crow = crow->getNext();
}
data.Insert('K', LM_TC_CR);
///
bool setArgumentIdx(int i);
///
- int getArgumentIdx() { return idx; }
+ int getArgumentIdx() const { return idx; }
///
- int getMaxArgumentIdx() { return 1; }
+ int getMaxArgumentIdx() const { return 1; }
///
- void SetStyle(short);
+ void SetStyle(short);
protected:
///
}
-void LyXScreen::DrawFromTo(LyXText * text, int y1, int y2, int y_offset, int x_offset)
+void LyXScreen::DrawFromTo(LyXText * text,
+ int y1, int y2, int y_offset, int x_offset)
{
- long y_text = text->first + y1;
+ int y_text = text->first + y1;
// get the first needed row
Row * row = text->GetRowNearY(y_text);
// y_text is now the real beginning of the row
- long y = y_text - text->first;
+ int y = y_text - text->first;
// y1 is now the real beginning of row on the screen
while (row != 0 && y < y2) {
}
-void LyXScreen::DrawOneRow(LyXText * text, Row * row, long y_text,
+void LyXScreen::DrawOneRow(LyXText * text, Row * row, int y_text,
int y_offset, int x_offset)
{
- long y = y_text - text->first + y_offset;
+ int y = y_text - text->first + y_offset;
if (y + row->height() > 0
- && y - row->height() <= long(owner.height())) {
+ && y - row->height() <= owner.height()) {
// ok there is something visible
LyXText::text_status st = text->status;
do {
/* draws the screen, starting with textposition y. uses as much already
* printed pixels as possible */
-void LyXScreen::Draw(LyXText * text, unsigned long y)
+void LyXScreen::Draw(LyXText * text, unsigned int y)
{
if (cursor_visible) HideCursor();
- unsigned long old_first = text->first;
+ unsigned int old_first = text->first;
text->first = y;
// is any optimiziation possible?
/* returns true if first has changed, otherwise false */
bool LyXScreen::FitManualCursor(LyXText * text,
- long /*x*/, long y, int asc, int desc)
+ int /*x*/, int y, int asc, int desc)
{
- long newtop = text->first;
+ int newtop = text->first;
if (y + desc - text->first >= owner.height())
newtop = y - 3 * owner.height() / 4; // the scroll region must be so big!!
- else if (y - asc < long(text->first)
+ else if (y - asc < text->first
&& text->first > 0) {
newtop = y - owner.height() / 4;
}
- newtop = max(newtop, 0L); // can newtop ever be < 0? (Lgb)
+ newtop = max(newtop, 0); // can newtop ever be < 0? (Lgb)
- if (newtop != long(text->first)) {
+ if (newtop != text->first) {
Draw(text, newtop);
text->first = newtop;
return true;
}
-void LyXScreen::ShowManualCursor(LyXText const * text, long x, long y,
+void LyXScreen::ShowManualCursor(LyXText const * text, int x, int y,
int asc, int desc, Cursor_Shape shape)
{
- unsigned long y1 = max(y - text->first - asc, 0UL);
- typedef unsigned long ulong;
+ unsigned int y1 = max(y - text->first - asc, 0U);
+ typedef unsigned int uint;
- unsigned long y2 = min(y - text->first + desc, ulong(owner.height()));
+ unsigned int y2 = min(y - text->first + desc, owner.height());
// Secure against very strange situations
y2 = max(y2, y1);
/* returns a new top so that the cursor is visible */
-unsigned long LyXScreen::TopCursorVisible(LyXText const * text)
+unsigned int LyXScreen::TopCursorVisible(LyXText const * text)
{
- long newtop = text->first;
+ int newtop = text->first;
if (text->cursor.y()
- text->cursor.row()->baseline()
newtop = text->cursor.y() - text->cursor.row()->baseline();
else {
newtop = text->cursor.y() - owner.height() / 4;
- newtop = min(newtop, long(text->first));
+ newtop = min(newtop, int(text->first));
}
}
- newtop = max(newtop, 0L);
+ newtop = max(newtop, 0);
return newtop;
}
bool LyXScreen::FitCursor(LyXText * text)
{
// Is a change necessary?
- unsigned long newtop = TopCursorVisible(text);
+ unsigned int newtop = TopCursorVisible(text);
bool result = (newtop != text->first);
if (result)
Draw(text, newtop);
switch(text->status) {
case LyXText::NEED_MORE_REFRESH:
{
- long y = max(text->refresh_y - long(text->first), 0L);
+ int y = max(int(text->refresh_y - text->first), 0);
int height;
if (text->inset_owner)
height = text->inset_owner->ascent(owner.owner(),
// only if there is a selection
if (!text->selection) return;
- long bottom = min(max(text->sel_end_cursor.y()
+ int bottom = min(max(text->sel_end_cursor.y()
- text->sel_end_cursor.row()->baseline()
+ text->sel_end_cursor.row()->height(), text->first),
text->first + owner.height());
- long top = min(max(text->sel_start_cursor.y()
+ int top = min(max(text->sel_start_cursor.y()
- text->sel_start_cursor.row()->baseline(), text->first),
text->first + owner.height());
&& text->toggle_cursor.pos() == text->toggle_end_cursor.pos())
return;
- long top = text->toggle_cursor.y()
+ int top = text->toggle_cursor.y()
- text->toggle_cursor.row()->baseline();
- long bottom = text->toggle_end_cursor.y()
+ int bottom = text->toggle_end_cursor.y()
- text->toggle_end_cursor.row()->baseline()
+ text->toggle_end_cursor.row()->height();
- typedef unsigned long ulong;
+ typedef unsigned int uint;
- bottom = min(max(ulong(bottom), text->first), text->first + owner.height());
- top = min(max(ulong(top), text->first), text->first + owner.height());
+ bottom = min(max(uint(bottom), text->first), text->first + owner.height());
+ top = min(max(uint(top), text->first), text->first + owner.height());
DrawFromTo(text, top - text->first, bottom - text->first, y_offset,
x_offset);
#ifdef CXX_WORKING_NAMESPACES
namespace lyx {
- int kill(long int pid, int sig)
+ int kill(int pid, int sig)
{
return ::kill(pid, sig);
}
#else
#include "lyxlib.h"
-int lyx::kill(long int pid, int sig)
+int lyx::kill(int pid, int sig)
{
return ::kill(pid, sig);
}
/// returns the name of the user (not used currently)
string const getUserName();
///
- int kill(long int pid, int sig);
+ int kill(int pid, int sig);
///
void abort();
///
/// returns the name of the user (not used currently)
static string const getUserName();
///
- static int kill(long int pid, int sig);
+ static int kill(int pid, int sig);
///
static void abort();
///
/* this must not happen before the currentrow for clear reasons.
so the trick is just to set the current row onto this row */
- long unused_y;
+ int unused_y;
GetRow(row_ptr->par(), row_ptr->pos(), unused_y);
/* ok , let us initialize the maxasc and maxdesc value.
// get the cursor row fist
Row * row = cursor.row();
- long y = cursor.y() - row->baseline();
+ int y = cursor.y() - row->baseline();
if (c != LyXParagraph::META_INSET) /* Here case LyXText::InsertInset
* already insertet the character */
cursor.par()->InsertChar(cursor.pos(), c);
}
Row * row = cursor.row();
- long y = cursor.y() - row->baseline();
+ int y = cursor.y() - row->baseline();
LyXParagraph::size_type z;
/* remember that a space at the end of a row doesnt count
* when calculating the fill */
void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
- Row * row_ptr, long y, bool cleared)
+ Row * row_ptr, int y, bool cleared)
{
/* returns a printed row */
Painter & pain = bview->painter();
sel_end_cursor.x(),
row_ptr->height(),
LColor::selection);
- } else if (y > long(sel_start_cursor.y())
- && y < long(sel_end_cursor.y())) {
+ } else if (y > sel_start_cursor.y()
+ && y < sel_end_cursor.y()) {
pain.fillRectangle(x_offset, y_offset, w,
row_ptr->height(),
LColor::selection);
}
} else if ( sel_start_cursor.row() != row_ptr &&
sel_end_cursor.row() != row_ptr &&
- y > long(sel_start_cursor.y())
- && y < long(sel_end_cursor.y())) {
+ y > sel_start_cursor.y()
+ && y < sel_end_cursor.y()) {
pain.fillRectangle(x_offset, y_offset, w,
row_ptr->height(),
LColor::selection);
// returns pointer to a specified row
Row * LyXText::GetRow(LyXParagraph * par,
- LyXParagraph::size_type pos, long & y) const
+ LyXParagraph::size_type pos, int & y) const
{
Row * tmprow = firstrow;
y = 0;
/* this must not happen before the currentrow for clear reasons.
so the trick is just to set the current row onto the previous
row of this row */
- long unused_y;
+ int unused_y;
GetRow(row->par(), row->pos(), unused_y);
if (row->next())
void LyXText::RedoHeightOfParagraph(BufferView * bview, LyXCursor const & cur)
{
Row * tmprow = cur.row();
- long y = cur.y() - tmprow->baseline();
+ int y = cur.y() - tmprow->baseline();
SetHeightOfRow(bview, tmprow);
#ifndef NEW_INSETS
{
Row * tmprow = cur.row();
- long y = cur.y() - tmprow->baseline();
+ int y = cur.y() - tmprow->baseline();
SetHeightOfRow(bview, tmprow);
#ifndef NEW_INSETS
LyXParagraph * first_phys_par = tmprow->par()->FirstPhysicalPar();
Row * tmprow = cur.row();
- long y = cur.y() - tmprow->baseline();
+ int y = cur.y() - tmprow->baseline();
if (!tmprow->previous()){
first_phys_par = FirstParagraph(); // a trick/hack for UNDO
/* returns a pointer to the row near the specified y-coordinate
* (relative to the whole text). y is set to the real beginning
* of this row */
-Row * LyXText::GetRowNearY(long & y) const
+Row * LyXText::GetRowNearY(int & y) const
{
Row * tmprow = firstrow;
- long tmpy = 0;
+ int tmpy = 0;
while (tmprow->next() && tmpy + tmprow->height() <= y) {
tmpy += tmprow->height();
{
LyXCursor tmpcursor;
- long y = 0;
+ int y = 0;
LyXParagraph::size_type z;
Row * row = GetRow(par, pos, y);
cur.boundary(boundary);
/* get the cursor y position in text */
- long y = 0;
+ int y = 0;
Row * row = GetRow(par, pos, y);
/* y is now the beginning of the cursor row */
y += row->baseline();
}
-void LyXText::SetCursorFromCoordinates(BufferView * bview, int x, long y) const
+void LyXText::SetCursorFromCoordinates(BufferView * bview, int x, int y) const
{
LyXCursor old_cursor = cursor;
void LyXText::SetCursorFromCoordinates(BufferView * bview, LyXCursor & cur,
- int x, long y) const
+ int x, int y) const
{
/* get the row first */