From 5f1427b648d5f283e6f8e07f931899ee02461fc5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Fri, 29 Sep 2000 18:44:07 +0000 Subject: [PATCH] more type changes, some consts added git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1061 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 5 +++ src/BufferView.h | 4 +- src/BufferView2.C | 4 +- src/BufferView_pimpl.C | 4 +- src/buffer.C | 33 +++++++--------- src/buffer.h | 10 ++--- src/combox.h | 3 +- src/frontends/xforms/FormBase.C | 2 +- src/frontends/xforms/FormCitation.C | 2 +- src/frontends/xforms/FormCitation.h | 2 +- src/frontends/xforms/FormIndex.h | 2 +- src/frontends/xforms/FormRef.C | 2 +- src/frontends/xforms/FormRef.h | 2 +- src/frontends/xforms/FormToc.h | 2 +- src/frontends/xforms/FormUrl.h | 2 +- src/insets/figinset.C | 6 +-- src/insets/insetcollapsable.C | 2 +- src/insets/insetcollapsable.h | 2 +- src/insets/insettabular.C | 14 ++++--- src/insets/insettabular.h | 9 ++--- src/insets/insettext.C | 44 ++++++++++++--------- src/insets/insettext.h | 8 ++-- src/insets/lyxinset.h | 2 +- src/lyx_cb.C | 2 +- src/lyxcursor.C | 4 +- src/lyxcursor.h | 6 +-- src/lyxfunc.C | 12 +++--- src/lyxscreen.h | 15 +++---- src/lyxtext.h | 16 ++++---- src/mathed/formula.C | 20 ++++++---- src/mathed/math_cursor.C | 21 +++++++--- src/mathed/math_defs.h | 20 +++++----- src/mathed/math_draw.C | 3 +- src/mathed/math_inset.h | 6 +-- src/mathed/math_iter.C | 33 ++++++++++------ src/mathed/math_iter.h | 10 +++-- src/mathed/math_macro.C | 13 +++--- src/mathed/math_macro.h | 18 ++++----- src/mathed/math_parser.C | 4 +- src/mathed/math_root.h | 6 +-- src/screen.C | 61 +++++++++++++++-------------- src/support/kill.C | 4 +- src/support/lyxlib.h | 4 +- src/text.C | 18 ++++----- src/text2.C | 20 +++++----- 45 files changed, 262 insertions(+), 220 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5683610423..daf4846950 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-09-29 Lars Gullik Bjønnes + + * 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 * lib/images/*: rename a bunch of icons to match Dekel converter diff --git a/src/BufferView.h b/src/BufferView.h index d811704302..00cfc04917 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -192,11 +192,11 @@ public: /// 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); /// diff --git a/src/BufferView2.C b/src/BufferView2.C index ab4e5ca3fc..524a4f1001 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -726,7 +726,7 @@ bool BufferView::lockInset(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; @@ -752,7 +752,7 @@ void BufferView::hideLockedInsetCursor() } -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(); diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index bc6b571348..36dbfa07c3 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -1136,7 +1136,7 @@ void BufferView::Pimpl::cursorPrevious() { 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(); @@ -1158,7 +1158,7 @@ void BufferView::Pimpl::cursorNext() { 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 diff --git a/src/buffer.C b/src/buffer.C index a8f510ba1a..034b7e787f 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -1257,7 +1257,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen) int actcell = 0; int actpos = 0; int currlinelen = 0; - long fpos = 0; + int fpos = 0; bool ref_printed = false; ofstream ofs(fname.c_str()); @@ -1465,14 +1465,12 @@ string const Buffer::asciiParagraph(LyXParagraph const * par, 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; @@ -1494,16 +1492,15 @@ string const Buffer::asciiParagraph(LyXParagraph const * par, 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; } } @@ -1523,7 +1520,7 @@ string const Buffer::asciiParagraph(LyXParagraph const * par, } /* 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; @@ -1573,10 +1570,10 @@ string const Buffer::asciiParagraph(LyXParagraph const * par, } 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) { @@ -1598,7 +1595,7 @@ string const Buffer::asciiParagraph(LyXParagraph const * par, 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; } @@ -1631,11 +1628,11 @@ string const Buffer::asciiParagraph(LyXParagraph const * par, 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; @@ -1652,11 +1649,11 @@ string const Buffer::asciiParagraph(LyXParagraph const * par, (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; diff --git a/src/buffer.h b/src/buffer.h index 39d57306bd..d3c2054dca 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -358,16 +358,16 @@ private: #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, @@ -380,11 +380,11 @@ private: 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, diff --git a/src/combox.h b/src/combox.h index 96a01be42a..32a0aa334a 100644 --- a/src/combox.h +++ b/src/combox.h @@ -221,7 +221,8 @@ string const Combox::getline() 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 diff --git a/src/frontends/xforms/FormBase.C b/src/frontends/xforms/FormBase.C index 5239d69125..51eaa3b2aa 100644 --- a/src/frontends/xforms/FormBase.C +++ b/src/frontends/xforms/FormBase.C @@ -130,7 +130,7 @@ void FormBase::HideCB(FL_OBJECT * ob, long) } -void FormBase::InputCB(FL_OBJECT * ob, long data ) +void FormBase::InputCB(FL_OBJECT * ob, long data) { FormBase * pre = static_cast(ob->form->u_vdata); pre->input( data ); diff --git a/src/frontends/xforms/FormCitation.C b/src/frontends/xforms/FormCitation.C index 5d8fd82cec..6e66de9d35 100644 --- a/src/frontends/xforms/FormCitation.C +++ b/src/frontends/xforms/FormCitation.C @@ -290,7 +290,7 @@ void FormCitation::setSize( int hbrsr, bool bibPresent ) const } -void FormCitation::input( long data ) +void FormCitation::input(long data) { State cb = static_cast( data ); diff --git a/src/frontends/xforms/FormCitation.h b/src/frontends/xforms/FormCitation.h index c0c002ef33..de5de60008 100644 --- a/src/frontends/xforms/FormCitation.h +++ b/src/frontends/xforms/FormCitation.h @@ -50,7 +50,7 @@ private: /// 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) diff --git a/src/frontends/xforms/FormIndex.h b/src/frontends/xforms/FormIndex.h index 5b8958542d..bcd94511cd 100644 --- a/src/frontends/xforms/FormIndex.h +++ b/src/frontends/xforms/FormIndex.h @@ -31,7 +31,7 @@ private: /// 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) diff --git a/src/frontends/xforms/FormRef.C b/src/frontends/xforms/FormRef.C index a60ca91957..bfe09ee2d7 100644 --- a/src/frontends/xforms/FormRef.C +++ b/src/frontends/xforms/FormRef.C @@ -252,7 +252,7 @@ void FormRef::apply() } -void FormRef::input( long data ) +void FormRef::input(long data) { switch( data ) { // goto reference / go back diff --git a/src/frontends/xforms/FormRef.h b/src/frontends/xforms/FormRef.h index f0548cfb66..f71931fa31 100644 --- a/src/frontends/xforms/FormRef.h +++ b/src/frontends/xforms/FormRef.h @@ -54,7 +54,7 @@ private: /// 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 diff --git a/src/frontends/xforms/FormToc.h b/src/frontends/xforms/FormToc.h index 78cbaa5263..c3e20a3218 100644 --- a/src/frontends/xforms/FormToc.h +++ b/src/frontends/xforms/FormToc.h @@ -32,7 +32,7 @@ private: /// 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) diff --git a/src/frontends/xforms/FormUrl.h b/src/frontends/xforms/FormUrl.h index 1c7703ea29..981ab6b671 100644 --- a/src/frontends/xforms/FormUrl.h +++ b/src/frontends/xforms/FormUrl.h @@ -31,7 +31,7 @@ private: /// 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) diff --git a/src/insets/figinset.C b/src/insets/figinset.C index f4cecabc63..61cefa102e 100644 --- a/src/insets/figinset.C +++ b/src/insets/figinset.C @@ -353,7 +353,7 @@ void AllocGrays(int num) 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)) { @@ -591,7 +591,7 @@ void runqueue() XInternAtom(tempdisp, "STRING", false), 8, PropModeAppend, reinterpret_cast(const_cast(t1.str().c_str())), - t1.str().size()); + int(t1.str().size())); XUngrabServer(tempdisp); XFlush(tempdisp); @@ -620,7 +620,7 @@ void runqueue() XInternAtom(tempdisp, "STRING", false), 8, PropModeReplace, reinterpret_cast(const_cast(t3.str().c_str())), - t3.str().size()); + int(t3.str().size())); XUngrabServer(tempdisp); XFlush(tempdisp); diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index e73bdd0cd2..345cd2b42d 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -379,7 +379,7 @@ bool InsetCollapsable::UpdateInsetInInset(BufferView * bv, Inset *in) } -int InsetCollapsable::InsetInInsetY() +unsigned int InsetCollapsable::InsetInInsetY() { return inset->InsetInInsetY(); } diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index 52b317f5ca..907d7b0ea7 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -79,7 +79,7 @@ public: /// bool UpdateInsetInInset(BufferView *, Inset *); /// - int InsetInInsetY(); + unsigned int InsetInInsetY(); /// void InsetButtonRelease(BufferView *, int, int, int); /// diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 11211b1b1b..8fe7d70f65 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -434,7 +434,9 @@ void InsetTabular::Edit(BufferView * bv, int x, int y, unsigned int button) } 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; @@ -550,7 +552,7 @@ bool InsetTabular::UpdateInsetInInset(BufferView * bv, Inset * inset) } -int InsetTabular::InsetInInsetY() +unsigned int InsetTabular::InsetInInsetY() { if (!the_locking_inset) return 0; @@ -959,7 +961,7 @@ bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv, void InsetTabular::GetCursorPos(BufferView *, - unsigned long & x, unsigned long & y) const + int & x, int & y) const { x = cursor.x() - top_x; y = cursor.y(); @@ -1017,12 +1019,12 @@ void InsetTabular::setPos(BufferView * bv, int x, int y) const 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; @@ -1031,7 +1033,7 @@ void InsetTabular::setPos(BufferView * bv, int x, int y) const 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) + diff --git a/src/insets/insettabular.h b/src/insets/insettabular.h index 6b2513efc5..9d54ffcdd1 100644 --- a/src/insets/insettabular.h +++ b/src/insets/insettabular.h @@ -111,7 +111,7 @@ public: /// bool UpdateInsetInInset(BufferView *, Inset *); /// - int InsetInInsetY(); + unsigned int InsetInInsetY(); /// UpdatableInset * GetLockingInset(); /// @@ -145,8 +145,7 @@ public: /// 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 *); /// @@ -244,9 +243,9 @@ private: /// 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; /// diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 89ce5d7e38..9040338c60 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -82,14 +82,19 @@ InsetText & InsetText::operator=(InsetText const & it) 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; @@ -211,7 +216,7 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex) 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; @@ -220,7 +225,7 @@ int InsetText::ascent(BufferView * bv, LyXFont const &) const 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; @@ -268,7 +273,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f, 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) { @@ -308,7 +313,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f, 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)) { @@ -409,7 +414,7 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit) 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() + @@ -1060,14 +1065,15 @@ int InsetText::BeginningOfMainBody(Buffer const * buf, LyXParagraph * p) const } -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; @@ -1226,12 +1232,14 @@ void InsetText::SetFont(BufferView * bv, LyXFont const & font, bool toggleall) 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(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); @@ -1240,7 +1248,7 @@ bool InsetText::checkAndActivateInset(BufferView * bv, bool behind) } 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); @@ -1253,9 +1261,9 @@ bool InsetText::checkAndActivateInset(BufferView * bv, bool behind) 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) @@ -1355,13 +1363,13 @@ LyXFont InsetText::GetDrawFont(BufferView * bv, LyXParagraph * p, int pos) const #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; diff --git a/src/insets/insettext.h b/src/insets/insettext.h index 23dfb2ae00..0080b9894e 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -138,7 +138,7 @@ public: /// void GetCursorPos(BufferView *, int & x, int & y) const; /// - int InsetInInsetY(); + unsigned int InsetInInsetY(); /// void ToggleInsetCursor(BufferView *); /// @@ -221,9 +221,9 @@ private: void removeNewlines(); /// - long cx(BufferView *) const; + int cx(BufferView *) const; /// - long cy(BufferView *) const; + int cy(BufferView *) const; /// int cpos(BufferView *) const; /// @@ -242,7 +242,7 @@ private: /// mutable int insetAscent; /// - mutable long insetDescent; + mutable int insetDescent; /// mutable int insetWidth; /// diff --git a/src/insets/lyxinset.h b/src/insets/lyxinset.h index 49ba016fa0..5a33df2bc7 100644 --- a/src/insets/lyxinset.h +++ b/src/insets/lyxinset.h @@ -338,7 +338,7 @@ public: 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; } diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 84550020d5..fbd206e801 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -127,7 +127,7 @@ bool toggleall = true; 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); diff --git a/src/lyxcursor.C b/src/lyxcursor.C index e30bd08eb3..37d65db951 100644 --- a/src/lyxcursor.C +++ b/src/lyxcursor.C @@ -82,13 +82,13 @@ int LyXCursor::x_fix() const } -void LyXCursor::y(unsigned long i) +void LyXCursor::y(int i) { y_ = i; } -unsigned long LyXCursor::y() const +int LyXCursor::y() const { return y_; } diff --git a/src/lyxcursor.h b/src/lyxcursor.h index 60ad1e0bfb..8a9ac616e0 100644 --- a/src/lyxcursor.h +++ b/src/lyxcursor.h @@ -47,9 +47,9 @@ public: /// int x_fix() const; /// - void y(unsigned long i); + void y(int i); /// - unsigned long y() const; + int y() const; /// void row(Row * r); /// @@ -68,7 +68,7 @@ private: /// int x_fix_; /// - unsigned long y_; + int y_; /// Row * row_; }; diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 00195488d4..cad787a855 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -698,7 +698,8 @@ string const LyXFunc::Dispatch(int ac, } // 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); @@ -717,7 +718,8 @@ string const LyXFunc::Dispatch(int ac, 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); @@ -2345,9 +2347,9 @@ string const LyXFunc::Dispatch(int ac, 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; diff --git a/src/lyxscreen.h b/src/lyxscreen.h index 5a4dc7f2ba..6dc1f038f9 100644 --- a/src/lyxscreen.h +++ b/src/lyxscreen.h @@ -51,13 +51,13 @@ public: /** 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 *); /// @@ -67,11 +67,11 @@ public: /// 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); @@ -94,11 +94,12 @@ private: 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; diff --git a/src/lyxtext.h b/src/lyxtext.h index 55dbb9e0f9..d80ecd259a 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -58,7 +58,7 @@ public: /// mutable int number_of_rows; /// - mutable long height; + mutable int height; /// mutable unsigned int width; /// the current font settings @@ -66,7 +66,7 @@ public: /// 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; /// @@ -158,7 +158,7 @@ public: /// Row * need_break_row; /// - mutable long refresh_y; + mutable int refresh_y; /// int refresh_height; /// @@ -179,7 +179,7 @@ public: (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 @@ -191,7 +191,7 @@ public: 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 */ @@ -271,10 +271,10 @@ public: 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; /// @@ -330,7 +330,7 @@ public: 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: */ diff --git a/src/mathed/formula.C b/src/mathed/formula.C index 7cae85ba81..6d7f75a588 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -56,9 +56,11 @@ LyXFont * Math_Fonts = 0; // this is only used by Whichfont and mathed_init_font 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; @@ -536,7 +538,8 @@ void InsetFormula::ToggleInsetCursor(BufferView * bv) if (!mathcursor) return; - int x, y; + int x; + int y; mathcursor->GetPos(x, y); // x -= par->xo; y -= par->yo; @@ -556,7 +559,8 @@ void InsetFormula::ShowInsetCursor(BufferView * bv) { if (!cursor_visible) { if (mathcursor) { - int x, y; + int x; + int y; mathcursor->GetPos(x, y); // x -= par->xo; y -= par->yo; @@ -690,8 +694,7 @@ void InsetFormula::InsetMotionNotify(BufferView * bv, 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; @@ -827,7 +830,10 @@ InsetFormula::LocalDispatch(BufferView * bv, // 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); diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index b9068ca739..7bdd91bdd6 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -162,7 +162,8 @@ void MathedCursor::Redraw(Painter & pain) 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(), @@ -376,7 +377,7 @@ void MathedCursor::Insert(byte c, MathedTextCodes t) } 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; } @@ -499,7 +500,7 @@ bool MathedCursor::Up(bool sel) } else { result = (p->getArgumentIdx() > 0); if (result) { - p->setArgumentIdx(p->getArgumentIdx()-1); + p->setArgumentIdx(p->getArgumentIdx() - 1); cursor->SetData(p); } } @@ -551,7 +552,7 @@ bool MathedCursor::Down(bool sel) } else { result = (p->getArgumentIdx() < p->getMaxArgumentIdx()); if (result) { - p->setArgumentIdx(p->getArgumentIdx()+1); + p->setArgumentIdx(p->getArgumentIdx() + 1); cursor->SetData(p); } } @@ -923,15 +924,25 @@ void MathedCursor::SelGetArea(int ** xp, int ** yp, int & np) } // 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); diff --git a/src/mathed/math_defs.h b/src/mathed/math_defs.h index 8ade1d3a5a..609ad44e1c 100644 --- a/src/mathed/math_defs.h +++ b/src/mathed/math_defs.h @@ -45,9 +45,9 @@ enum math_align { 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) @@ -358,20 +358,20 @@ class MathParInset: public MathedInset { /// 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); /// @@ -497,11 +497,11 @@ class MathMatrixInset: public MathParInset { 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; } diff --git a/src/mathed/math_draw.C b/src/mathed/math_draw.C index 8373db25dc..d677e1d1ca 100644 --- a/src/mathed/math_draw.C +++ b/src/mathed/math_draw.C @@ -84,8 +84,7 @@ MathParInset::draw(Painter & pain, int x, int y) 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; diff --git a/src/mathed/math_inset.h b/src/mathed/math_inset.h index 1b374a866d..0c1b0e2293 100644 --- a/src/mathed/math_inset.h +++ b/src/mathed/math_inset.h @@ -218,14 +218,14 @@ public: /// 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; /// diff --git a/src/mathed/math_iter.C b/src/mathed/math_iter.C index f1e9886640..86d2ef9454 100644 --- a/src/mathed/math_iter.C +++ b/src/mathed/math_iter.C @@ -546,7 +546,8 @@ void MathedXIter::Merge(LyxArrayBase *a0) //----------- XIter -MathedXIter::MathedXIter(MathParInset* pp): p(pp) +MathedXIter::MathedXIter(MathParInset * pp) + : p(pp) { x = y = 0; sx = sw = 0; @@ -560,7 +561,7 @@ MathedXIter::MathedXIter(MathParInset* pp): p(pp) } } -void MathedXIter::SetData(MathParInset *pp) +void MathedXIter::SetData(MathParInset * pp) { p = pp; x = y = 0; @@ -843,14 +844,15 @@ void MathedXIter::ipop() 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(); @@ -859,6 +861,7 @@ void MathedXIter::fitCoord(int /*xx*/, int yy) // while (xGetXY(xx, yy); static_cast(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(pp)->GetXY(xx, des); - if (des-pp->Height()Height()); + if (des - pp->Height() < yy && !asc) + asc = yy - (des - pp->Height()); des -= yy; } des += (limit ? pp->Height()+4: pp->Height()-pp->Ascent()/2); diff --git a/src/mathed/math_iter.h b/src/mathed/math_iter.h index 84f0d76e82..9261ab3d2f 100644 --- a/src/mathed/math_iter.h +++ b/src/mathed/math_iter.h @@ -352,16 +352,18 @@ void MathedXIter::GetPos(int & xx, int & yy) const 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; } diff --git a/src/mathed/math_macro.C b/src/mathed/math_macro.C index 6b7313341e..3f88d47907 100644 --- a/src/mathed/math_macro.C +++ b/src/mathed/math_macro.C @@ -128,12 +128,13 @@ void MathMacro::draw(Painter & pain, int x, int y) 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(); } @@ -321,7 +322,7 @@ void MathMacroTemplate::draw(Painter & pain, int x, int y) 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) { @@ -342,12 +343,12 @@ void MathMacroTemplate::Metrics() 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); } } diff --git a/src/mathed/math_macro.h b/src/mathed/math_macro.h index 800cf83c55..a4d14bc49f 100644 --- a/src/mathed/math_macro.h +++ b/src/mathed/math_macro.h @@ -55,11 +55,11 @@ public: /// bool setArgumentIdx(int); /// - int getArgumentIdx(); + int getArgumentIdx() const; /// - int getMaxArgumentIdx(); + int getMaxArgumentIdx() const; /// - int GetColumns(); + int GetColumns() const; /// void GetXY(int &, int &) const; /// @@ -71,7 +71,7 @@ public: /// void SetData(LyxArrayBase *); /// - MathedTextCodes getTCode() { return tcode; } + MathedTextCodes getTCode() const { return tcode; } /// bool Permit(short); @@ -128,7 +128,7 @@ public: /// 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; @@ -154,11 +154,11 @@ public: /// 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; /// @@ -235,13 +235,13 @@ bool MathMacro::setArgumentIdx(int i) } inline -int MathMacro::getArgumentIdx() +int MathMacro::getArgumentIdx() const { return idx; } inline -int MathMacro::getMaxArgumentIdx() +int MathMacro::getMaxArgumentIdx() const { return nargs - 1; } diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 26a88be831..ae85eaa062 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -542,7 +542,7 @@ LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * array, case '&': // Tab { - if ((flags & FLAG_END) && mt && data.getCol()GetColumns()-1) { + if ((flags & FLAG_END) && mt && data.getCol()GetColumns() - 1) { data.setNumCols(mt->GetColumns()); data.Insert('T', LM_TC_TAB); } else @@ -557,7 +557,7 @@ LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * array, 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); diff --git a/src/mathed/math_root.h b/src/mathed/math_root.h index 5a8aa95bc4..cdeae57233 100644 --- a/src/mathed/math_root.h +++ b/src/mathed/math_root.h @@ -53,11 +53,11 @@ public: /// 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: /// diff --git a/src/screen.C b/src/screen.C index 38effb1e19..477dba0279 100644 --- a/src/screen.C +++ b/src/screen.C @@ -86,15 +86,16 @@ void LyXScreen::expose(int x, int y, int exp_width, int exp_height) } -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) { @@ -120,13 +121,13 @@ void LyXScreen::DrawFromTo(LyXText * text, int y1, int y2, int y_offset, int x_o } -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 { @@ -142,11 +143,11 @@ void LyXScreen::DrawOneRow(LyXText * text, Row * row, long y_text, /* 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? @@ -215,20 +216,20 @@ void LyXScreen::ShowCursor(LyXText const * text) /* 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; @@ -237,13 +238,13 @@ bool LyXScreen::FitManualCursor(LyXText * text, } -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); @@ -342,9 +343,9 @@ void LyXScreen::CursorToggle(LyXText const * text) /* 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() @@ -365,11 +366,11 @@ unsigned long LyXScreen::TopCursorVisible(LyXText const * text) 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; } @@ -380,7 +381,7 @@ unsigned long LyXScreen::TopCursorVisible(LyXText const * text) 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); @@ -393,7 +394,7 @@ void LyXScreen::Update(LyXText * text, int y_offset, int x_offset) 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(), @@ -433,11 +434,11 @@ void LyXScreen::ToggleSelection(LyXText * text, bool kill_selection, // 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()); @@ -457,16 +458,16 @@ void LyXScreen::ToggleToggle(LyXText * text, int y_offset, int x_offset) && 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); diff --git a/src/support/kill.C b/src/support/kill.C index f9f462d916..241dc31524 100644 --- a/src/support/kill.C +++ b/src/support/kill.C @@ -5,7 +5,7 @@ #ifdef CXX_WORKING_NAMESPACES namespace lyx { - int kill(long int pid, int sig) + int kill(int pid, int sig) { return ::kill(pid, sig); } @@ -13,7 +13,7 @@ namespace lyx { #else #include "lyxlib.h" -int lyx::kill(long int pid, int sig) +int lyx::kill(int pid, int sig) { return ::kill(pid, sig); } diff --git a/src/support/lyxlib.h b/src/support/lyxlib.h index 4d8deccf39..acaa2b0e4e 100644 --- a/src/support/lyxlib.h +++ b/src/support/lyxlib.h @@ -43,7 +43,7 @@ namespace lyx { /// 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(); /// @@ -81,7 +81,7 @@ struct lyx { /// 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(); /// diff --git a/src/text.C b/src/text.C index aa793d5d10..9457af664d 100644 --- a/src/text.C +++ b/src/text.C @@ -1281,7 +1281,7 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const /* 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. @@ -1962,7 +1962,7 @@ void LyXText::InsertChar(BufferView * bview, char c) // 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); @@ -2780,7 +2780,7 @@ void LyXText::Backspace(BufferView * bview) } 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 */ @@ -2945,7 +2945,7 @@ void LyXText::Backspace(BufferView * bview) 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(); @@ -3056,16 +3056,16 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset, 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); @@ -3973,7 +3973,7 @@ void LyXText::InsertFootnoteEnvironment(BufferView * bview, // 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; diff --git a/src/text2.C b/src/text2.C index 24f1f000dc..8836bccca5 100644 --- a/src/text2.C +++ b/src/text2.C @@ -345,7 +345,7 @@ void LyXText::RemoveRow(Row * row) const /* 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()) @@ -941,7 +941,7 @@ void LyXText::SetFont(BufferView * bview, LyXFont const & font, bool toggleall) 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 @@ -975,7 +975,7 @@ void LyXText::RedoDrawingOfParagraph(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 LyXParagraph * first_phys_par = tmprow->par()->FirstPhysicalPar(); @@ -1014,7 +1014,7 @@ void LyXText::RedoParagraphs(BufferView * bview, LyXCursor const & cur, 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 @@ -1247,10 +1247,10 @@ void LyXText::CursorBottom(BufferView * bview) const /* 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(); @@ -2651,7 +2651,7 @@ void LyXText::CheckParagraph(BufferView * bview, LyXParagraph * par, { LyXCursor tmpcursor; - long y = 0; + int y = 0; LyXParagraph::size_type z; Row * row = GetRow(par, pos, y); @@ -2799,7 +2799,7 @@ void LyXText::SetCursor(BufferView *bview, LyXCursor & cur, LyXParagraph * par, 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(); @@ -2918,7 +2918,7 @@ void LyXText::SetCurrentFont(BufferView * bview) const } -void LyXText::SetCursorFromCoordinates(BufferView * bview, int x, long y) const +void LyXText::SetCursorFromCoordinates(BufferView * bview, int x, int y) const { LyXCursor old_cursor = cursor; @@ -2940,7 +2940,7 @@ void LyXText::SetCursorFromCoordinates(BufferView * bview, int x, long y) const void LyXText::SetCursorFromCoordinates(BufferView * bview, LyXCursor & cur, - int x, long y) const + int x, int y) const { /* get the row first */ -- 2.39.2