From d705c75da9d67b3a99c09f1c935958cbed06be59 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Wed, 27 Sep 2000 18:13:30 +0000 Subject: [PATCH] no time to finish compile, fixes to cxx warnings git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1050 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/LyXView.C | 2 +- src/LyXView.h | 2 +- src/Painter.C | 2 +- src/Painter.h | 2 +- src/PainterBase.h | 2 +- src/font.C | 2 +- src/font.h | 2 +- src/insets/figinset.C | 16 +++------------- src/insets/insetcite.C | 16 ++++++++-------- src/insets/insetexternal.C | 12 ++++++------ src/insets/insettabular.C | 33 +++++++++++++++++---------------- src/insets/insettabular.h | 5 +++-- src/insets/insettext.C | 13 +++++++------ src/insets/insettext.h | 6 +++--- src/tabular.C | 2 +- 15 files changed, 55 insertions(+), 62 deletions(-) diff --git a/src/LyXView.C b/src/LyXView.C index 92655d1430..1691e71457 100644 --- a/src/LyXView.C +++ b/src/LyXView.C @@ -120,7 +120,7 @@ Toolbar * LyXView::getToolbar() const } -void LyXView::setLayout(int layout) +void LyXView::setLayout(LyXTextClass::size_type layout) { toolbar->setLayout(layout); } diff --git a/src/LyXView.h b/src/LyXView.h index 7e994aeb43..9aa11c0205 100644 --- a/src/LyXView.h +++ b/src/LyXView.h @@ -76,7 +76,7 @@ public: Toolbar * getToolbar() const; /// sets the layout in the toolbar layout combox - void setLayout(int layout); + void setLayout(LyXTextClass::size_type layout); /// update the toolbar void updateToolbar(); diff --git a/src/Painter.C b/src/Painter.C index d3216b9ef9..8ab7f4fb73 100644 --- a/src/Painter.C +++ b/src/Painter.C @@ -269,7 +269,7 @@ PainterBase & Painter::text(int x, int y, char c, LyXFont const & f) } -PainterBase & Painter::text(int x, int y, char const * s, int ls, +PainterBase & Painter::text(int x, int y, char const * s, size_t ls, LyXFont const & f) { if (lyxrc.font_norm_type == LyXRC::ISO_10646_1) { diff --git a/src/Painter.h b/src/Painter.h index 1becb41462..7225500072 100644 --- a/src/Painter.h +++ b/src/Painter.h @@ -86,7 +86,7 @@ public: /** Draw a string at position x, y (y is the baseline) This is just for fast drawing */ - PainterBase & text(int x, int y, char const * str, int l, + PainterBase & text(int x, int y, char const * str, size_t l, LyXFont const & f); /// Draw a char at position x, y (y is the baseline) diff --git a/src/PainterBase.h b/src/PainterBase.h index 771baec8b9..47fa8c8993 100644 --- a/src/PainterBase.h +++ b/src/PainterBase.h @@ -157,7 +157,7 @@ public: /** Draw a string at position x, y (y is the baseline) This is just for fast drawing */ - virtual PainterBase & text(int x, int y, char const * str, int l, + virtual PainterBase & text(int x, int y, char const * str, size_t l, LyXFont const & f) = 0; /// Draw a char at position x, y (y is the baseline) diff --git a/src/font.C b/src/font.C index 076f16d7b2..ab56101240 100644 --- a/src/font.C +++ b/src/font.C @@ -101,7 +101,7 @@ int lyxfont::rbearing(char c, LyXFont const & f) } -int lyxfont::width(char const * s, int n, LyXFont const & f) +int lyxfont::width(char const * s, size_t n, LyXFont const & f) { if (!lyxrc.use_gui) return n; diff --git a/src/font.h b/src/font.h index d078ea8ba2..95a5595151 100644 --- a/src/font.h +++ b/src/font.h @@ -51,7 +51,7 @@ struct lyxfont { } /// static - int width(char const * s, int n, LyXFont const & f); + int width(char const * s, size_t n, LyXFont const & f); /// static int width(string const & s, LyXFont const & f) { diff --git a/src/insets/figinset.C b/src/insets/figinset.C index 4b71d58a55..6436b6e5eb 100644 --- a/src/insets/figinset.C +++ b/src/insets/figinset.C @@ -98,15 +98,12 @@ static queue gsqueue; // queue for ghostscripting static int gsrunning = 0; /* currently so many gs's are running */ static bool bitmap_waiting = false; /* bitmaps are waiting finished */ -static char bittable[256]; /* bit reversion table */ static bool gs_color; // do we allocate colors for gs? static bool color_visual; // is the visual color? static bool gs_xcolor = false; // allocated extended colors static unsigned long gs_pixels[128]; // allocated pixels -static int gs_num_pixels; // number of pixels allocated static int gs_spc; // shades per color -static bool gs_gray; // is grayscale? static int gs_allcolors; // number of all colors static list pidwaitlist; // pid wait list @@ -195,7 +192,6 @@ int GhostscriptMsg(FL_OBJECT *, Window, int, int, register XImage * im; int i; int y; - int wid1; int spc1 = gs_spc - 1; int spc2 = gs_spc * gs_spc; int wid = p->wid; @@ -256,7 +252,6 @@ int GhostscriptMsg(FL_OBJECT *, Window, int, int, .colormap, cmap, gs_allcolors); XFlush(tmpdisp); - wid1 = p->wid - 1; // now we process all the image for (y = 0; y < p->hgh; ++y) { for (int x = 0; x < wid; ++x) { @@ -318,9 +313,9 @@ void AllocColors(int num) if (num > 5) num = 5; XColor xcol; for (int i = 0; i < num * num * num; ++i) { - xcol.red = 65535 * (i / (num * num)) / (num - 1); - xcol.green = 65535 * ((i / num) % num) / (num - 1); - xcol.blue = 65535 * (i % num) / (num - 1); + xcol.red = short(65535 * (i / (num * num)) / (num - 1)); + xcol.green = short(65535 * ((i / num) % num) / (num - 1)); + xcol.blue = short(65535 * (i % num) / (num - 1)); xcol.flags = DoRed | DoGreen | DoBlue; if (!XAllocColor(fl_display, fl_state[fl_get_vclass()].colormap, &xcol)) { @@ -337,9 +332,7 @@ void AllocColors(int num) gs_pixels[i] = xcol.pixel; } gs_color = true; - gs_gray = false; gs_spc = num; - gs_num_pixels = num * num * num; } @@ -377,8 +370,6 @@ void AllocGrays(int num) gs_pixels[i] = xcol.pixel; } gs_color = true; - gs_gray = false; - gs_num_pixels = num; } @@ -394,7 +385,6 @@ void InitFigures() k = 0; for (unsigned int j = 0; j < 8; ++j) if (i & (1 << (7-j))) k |= 1 << j; - bittable[i] = char(~k); } // allocate color cube on pseudo-color display diff --git a/src/insets/insetcite.C b/src/insets/insetcite.C index 640c53695b..fa2777fa97 100644 --- a/src/insets/insetcite.C +++ b/src/insets/insetcite.C @@ -30,16 +30,16 @@ string const InsetCitation::getScreenLabel() const // If keys is "too long" then only print out the first few tokens string label; - if( contains( keys, "," ) ) { + if (contains(keys, ",")) { // Final comma allows while loop to cover all keys - keys = frontStrip( split( keys, label, ',' ) ) + ","; + keys = frontStrip(split(keys, label, ',')) + ","; - const int maxSize( 40 ); - while( contains( keys, "," ) ) { + size_t const maxSize = 40; + while (contains( keys, "," )) { string key; - keys = frontStrip( split( keys, key, ',' ) ); + keys = frontStrip(split(keys, key, ',')); - int size = label.size() + 2 + key.size(); + size_t size = label.size() + 2 + key.size(); if( size >= maxSize ) { label += ", ..."; break; @@ -50,7 +50,7 @@ string const InsetCitation::getScreenLabel() const label = keys; } - if( !getOptions().empty() ) + if (!getOptions().empty()) label += ", " + getOptions(); return '[' + label + ']'; @@ -59,6 +59,6 @@ string const InsetCitation::getScreenLabel() const void InsetCitation::Edit(BufferView * bv, int, int, unsigned int) { - bv->owner()->getDialogs()->showCitation( this ); + bv->owner()->getDialogs()->showCitation(this); } diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index cd42207704..a60d7facac 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -314,10 +314,10 @@ void InsetExternal::Write(Buffer const *, std::ostream & os) const void InsetExternal::Read(Buffer const *, LyXLex & lex) { lex.EatLine(); - string format = lex.GetString(); - int pos1 = format.find(","); + string const format = lex.GetString(); + string::size_type const pos1 = format.find(","); templatename = format.substr(0, pos1); - int pos2 = format.find("\",\"", pos1); + string::size_type const pos2 = format.find("\",\"", pos1); filename = format.substr(pos1 + 2, pos2 - (pos1 + 2)); parameters = format.substr(pos2 + 3, format.length() - (pos2 + 4)); @@ -473,7 +473,7 @@ string const InsetExternal::doSubstitution(Buffer const * buffer, string const & s) const { string result; - string basename = ChangeExtension(filename, string()); + string const basename = ChangeExtension(filename, string()); result = subst(s, "$$FName", filename); result = subst(result, "$$Basename", basename); result = subst(result, "$$Parameters", parameters); @@ -484,8 +484,8 @@ string const InsetExternal::doSubstitution(Buffer const * buffer, // Handle the $$Contents(filename) syntax if (contains(result, "$$Contents(\"")) { - int const pos = result.find("$$Contents(\""); - int const end = result.find("\")", pos); + string::size_type const pos = result.find("$$Contents(\""); + string::size_type const end = result.find("\")", pos); string const file = result.substr(pos + 12, end - (pos + 12)); string contents; if (buffer) { diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index ada68fc0ad..edb29a69d4 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -950,7 +950,8 @@ bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv, } -void InsetTabular::GetCursorPos(BufferView *, int & x, int & y) const +void InsetTabular::GetCursorPos(BufferView *, + unsigned long & x, unsigned long & y) const { x = cursor.x() - top_x; y = cursor.y(); @@ -1222,15 +1223,15 @@ bool InsetTabular::TabularFeatures(BufferView * bv, string const & what) void InsetTabular::TabularFeatures(BufferView * bv, int feature, string const & value) { - int - i, j, - sel_col_start, - sel_col_end, - sel_row_start, - sel_row_end, - setLines = 0, - setAlign = LYX_ALIGN_LEFT, - lineSet; + int i; + int j; + int sel_col_start; + int sel_col_end; + int sel_row_start; + int sel_row_end; + int setLines = 0; + LyXAlignment setAlign = LYX_ALIGN_LEFT; + int lineSet; bool what; switch (feature) { @@ -1403,9 +1404,9 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, case LyXTabular::ALIGN_LEFT: case LyXTabular::ALIGN_RIGHT: case LyXTabular::ALIGN_CENTER: - for(i=sel_row_start; i<=sel_row_end; ++i) - for(j=sel_col_start; j<=sel_col_end; ++j) - tabular->SetAlignment(tabular->GetCellNumber(i,j),setAlign, + for(i = sel_row_start; i <= sel_row_end; ++i) + for(j = sel_col_start; j <= sel_col_end; ++j) + tabular->SetAlignment(tabular->GetCellNumber(i, j), setAlign, flag); if (hasSelection()) UpdateLocal(bv, INIT, true); @@ -1419,9 +1420,9 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, case LyXTabular::VALIGN_TOP: case LyXTabular::VALIGN_BOTTOM: case LyXTabular::VALIGN_CENTER: - for(i=sel_row_start; i<=sel_row_end; ++i) - for(j=sel_col_start; j<=sel_col_end; ++j) - tabular->SetVAlignment(tabular->GetCellNumber(i,j), setAlign, + for(i = sel_row_start; i <= sel_row_end; ++i) + for(j = sel_col_start; j <= sel_col_end; ++j) + tabular->SetVAlignment(tabular->GetCellNumber(i, j), setAlign, flag); if (hasSelection()) UpdateLocal(bv, INIT, true); diff --git a/src/insets/insettabular.h b/src/insets/insettabular.h index df4d05a0c1..6b4701e3cd 100644 --- a/src/insets/insettabular.h +++ b/src/insets/insettabular.h @@ -145,7 +145,8 @@ public: /// Inset::Code LyxCode() const { return Inset::TABULAR_CODE; } /// - void GetCursorPos(BufferView *, int & x, int & y) const; + void GetCursorPos(BufferView *, unsigned long & x, + unsigned long & y) const; /// void ToggleInsetCursor(BufferView *); /// @@ -245,7 +246,7 @@ private: /// mutable int inset_x; /// - mutable int inset_y; + mutable unsigned long inset_y; /// mutable int sel_pos_start; /// diff --git a/src/insets/insettext.C b/src/insets/insettext.C index ec9e2ed665..298f11edd3 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -313,20 +313,20 @@ void InsetText::draw(BufferView * bv, LyXFont const & f, y += baseline - row->ascent_of_text(); if (cleared || !locked || (need_update == FULL)) { while (row != 0) { - TEXT(bv)->GetVisibleRow(bv, y, int(x), row, y, cleared); + TEXT(bv)->GetVisibleRow(bv, int(y), int(x), row, y, cleared); y += row->height(); row = row->next(); } } else if (need_update == SELECTION) { - bv->screen()->ToggleToggle(TEXT(bv), y, int(x)); + bv->screen()->ToggleToggle(TEXT(bv), int(y), int(x)); } else { locked = false; if (need_update == CURSOR) { - bv->screen()->ToggleSelection(TEXT(bv), true, y, int(x)); + bv->screen()->ToggleSelection(TEXT(bv), true, int(y), int(x)); TEXT(bv)->ClearSelection(); TEXT(bv)->sel_cursor = TEXT(bv)->cursor; } - bv->screen()->Update(TEXT(bv), y, int(x)); + bv->screen()->Update(TEXT(bv), int(y), int(x)); locked = true; } TEXT(bv)->refresh_y = 0; @@ -1351,13 +1351,14 @@ LyXFont InsetText::GetDrawFont(BufferView * bv, LyXParagraph * p, int pos) const } #endif -int InsetText::cx(BufferView * bv) const + +long InsetText::cx(BufferView * bv) const { return TEXT(bv)->cursor.x() + top_x + TEXT_TO_INSET_OFFSET; } -int InsetText::cy(BufferView * bv) const +long 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 d1be15fc08..23dfb2ae00 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -221,9 +221,9 @@ private: void removeNewlines(); /// - int cx(BufferView *) const; + long cx(BufferView *) const; /// - int cy(BufferView *) const; + long cy(BufferView *) const; /// int cpos(BufferView *) const; /// @@ -242,7 +242,7 @@ private: /// mutable int insetAscent; /// - mutable int insetDescent; + mutable long insetDescent; /// mutable int insetWidth; /// diff --git a/src/tabular.C b/src/tabular.C index 2f4abff801..25697c118f 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -619,7 +619,7 @@ bool LyXTabular::SetWidthOfCell(int cell, int new_width) } -bool LyXTabular::SetAlignment(int cell, char align, bool onlycolumn) +bool LyXTabular::SetAlignment(int cell, LyXAlignment align, bool onlycolumn) { #warning Please fix align type. (Lgb) if (!IsMultiColumn(cell) || onlycolumn) -- 2.39.2