From 7aebbe6e10b3b4cf1f110b98c73a0a27059da6d8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Mon, 10 Dec 2001 20:06:59 +0000 Subject: [PATCH] include shuffling and a mathed compile fix git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3182 a592a061-630c-0410-9148-cb99ea01b6c8 --- po/POTFILES.in | 1 + src/BufferView2.C | 21 ++++++---- src/BufferView_pimpl.C | 39 +++++++++-------- src/ChangeLog | 2 +- src/Chktex.C | 11 ++--- src/LyXView.C | 16 +++---- src/Painter.C | 75 +++++++++++++-------------------- src/Thesaurus.C | 23 +++++++---- src/WorkArea.C | 13 +++--- src/buffer.C | 40 ++++++++++-------- src/bufferlist.C | 27 ++++++------ src/lyxfunc.C | 85 ++++++++++++++++++++------------------ src/mathed/math_iterator.C | 2 +- src/mathed/math_iterator.h | 1 + src/text2.C | 16 +++---- 15 files changed, 194 insertions(+), 178 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index 17e2f1d40c..43f1bf43df 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -9,6 +9,7 @@ src/converter.C src/CutAndPaste.C src/debug.C src/exporter.C +src/ext_l10n.h src/figure_form.C src/figureForm.C src/FontLoader.C diff --git a/src/BufferView2.C b/src/BufferView2.C index 05b40ef781..2fad793b7b 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -8,32 +8,35 @@ * * ====================================================== */ -#include -#include - #include #include "BufferView.h" #include "buffer.h" #include "lyxcursor.h" #include "lyxtext.h" -#include "insets/inseterror.h" #include "LyXView.h" #include "bufferlist.h" -#include "support/FileInfo.h" #include "lyxscreen.h" -#include "support/filetools.h" -#include "frontends/Alert.h" #include "LaTeX.h" #include "BufferView_pimpl.h" -#include "insets/insetcommand.h" //ChangeRefs -#include "support/lyxfunctional.h" //equal_1st_in_pair #include "language.h" #include "gettext.h" #include "undo_funcs.h" #include "debug.h" #include "iterators.h" +#include "frontends/Alert.h" + +#include "insets/insetcommand.h" //ChangeRefs +#include "insets/inseterror.h" + +#include "support/FileInfo.h" +#include "support/filetools.h" +#include "support/lyxfunctional.h" //equal_1st_in_pair + +#include +#include + extern BufferList bufferlist; using std::pair; diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 5c6b555f3a..49a805cf63 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -1,10 +1,5 @@ #include -#include -#include -#include -#include - #ifdef __GNUG__ #pragma implementation #endif @@ -26,19 +21,20 @@ #include "lyx_gui_misc.h" #include "lyxrc.h" #include "intl.h" -#include "support/LAssert.h" -#include "support/lstrings.h" +// added for Dispatch functions +#include "lyx_cb.h" +#include "lyx_main.h" +#include "FloatList.h" +#include "gettext.h" +#include "ParagraphParameters.h" +#include "undo_funcs.h" + #include "frontends/Dialogs.h" #include "frontends/Alert.h" +#include "frontends/FileDialog.h" + #include "insets/insetbib.h" #include "insets/insettext.h" -/// added for Dispatch functions -#include "lyx_cb.h" -#include "frontends/FileDialog.h" -#include "lyx_main.h" -#include "FloatList.h" -#include "support/filetools.h" -#include "support/lyxfunctional.h" #include "insets/inseturl.h" #include "insets/insetlatexaccent.h" #include "insets/insettoc.h" @@ -63,11 +59,20 @@ #include "insets/insetcaption.h" #include "insets/insetfloatlist.h" #include "insets/insetspecialchar.h" -#include "gettext.h" -#include "ParagraphParameters.h" -#include "undo_funcs.h" + #include "mathed/formulabase.h" +#include "support/LAssert.h" +#include "support/lstrings.h" +#include "support/filetools.h" +#include "support/lyxfunctional.h" + +#include +#include +#include +#include + + extern lyx::layout_type current_layout; using std::vector; diff --git a/src/ChangeLog b/src/ChangeLog index 723f071d5d..d55f2671dc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -28,7 +28,7 @@ 2001-12-08 Lars Gullik Bjønnes * buffer.C (insertErtContents): try to handle font and language - interaction a bit better. + interaction a bit better.g * ColorHandler.C (updateColor): change the hash to cover the whole LColor enum, ws cleanup diff --git a/src/Chktex.C b/src/Chktex.C index fbe1f047fc..1193c7590a 100644 --- a/src/Chktex.C +++ b/src/Chktex.C @@ -13,23 +13,24 @@ #include -#include - #ifdef __GNUG__ #pragma implementation #endif #include "Chktex.h" #include "LaTeX.h" // TeXErrors -#include "support/filetools.h" #include "lyxlex.h" -#include "support/FileInfo.h" #include "debug.h" +#include "gettext.h" + +#include "support/FileInfo.h" +#include "support/filetools.h" #include "support/syscall.h" #include "support/syscontr.h" #include "support/path.h" #include "support/lstrings.h" -#include "gettext.h" + +#include using std::ifstream; using std::getline; diff --git a/src/LyXView.C b/src/LyXView.C index df55886c3e..97ab981e68 100644 --- a/src/LyXView.C +++ b/src/LyXView.C @@ -15,20 +15,13 @@ #pragma implementation #endif -#include -#include - #include "LyXView.h" #include "minibuffer.h" #include "debug.h" #include "intl.h" #include "lyxrc.h" -#include "support/filetools.h" // OnlyFilename() #include "lyxtext.h" #include "buffer.h" -#include "frontends/Dialogs.h" -#include "frontends/Toolbar.h" -#include "frontends/Menubar.h" #include "MenuBackend.h" #include "lyx_gui_misc.h" // [update,Close,Redraw]AllBufferRelatedDialogs #include "bufferview_funcs.h" // CurrentState() @@ -36,6 +29,15 @@ #include "lyxfunc.h" #include "BufferView.h" +#include "frontends/Dialogs.h" +#include "frontends/Toolbar.h" +#include "frontends/Menubar.h" + +#include "support/filetools.h" // OnlyFilename() + +#include +#include + using std::endl; using lyx::layout_type; diff --git a/src/Painter.C b/src/Painter.C index eac9623c36..5015383c60 100644 --- a/src/Painter.C +++ b/src/Painter.C @@ -13,19 +13,10 @@ #pragma implementation #endif -#ifdef USE_STL_MEMORY -#include -#endif - -#include - #include "Painter.h" #include "LString.h" #include "debug.h" #include "lyxfont.h" -#include "frontends/GUIRunTime.h" -#include "support/LAssert.h" -#include "support/lstrings.h" #include "WorkArea.h" #include "font.h" #include "ColorHandler.h" @@ -33,8 +24,16 @@ #include "encoding.h" #include "language.h" +#include "frontends/GUIRunTime.h" #include "frontends/support/LyXImage.h" +#include "support/LAssert.h" +#include "support/lstrings.h" + +#include + +#include + using std::endl; using std::max; @@ -45,7 +44,7 @@ Painter::Painter(WorkArea & wa) } -/* Basic drawing routines */ +// Basic drawing routines PainterBase & Painter::point(int x, int y, LColor::color c) { @@ -72,11 +71,8 @@ PainterBase & Painter::lines(int const * xp, int const * yp, int np, enum line_style ls, enum line_width lw) { -#ifndef HAVE_AUTO_PTR - XPoint * points = new XPoint[np]; -#else - auto_ptr points(new Xpoint[np]); -#endif + boost::scoped_array points(new XPoint[np]); + for (int i = 0; i < np; ++i) { points[i].x = xp[i]; points[i].y = yp[i]; @@ -84,11 +80,8 @@ PainterBase & Painter::lines(int const * xp, int const * yp, int np, XDrawLines(display, owner.getPixmap(), lyxColorHandler->getGCLinepars(ls, lw, col), - points, np, CoordModeOrigin); + points.get(), np, CoordModeOrigin); -#ifndef HAVE_AUTO_PTR - delete[] points; -#endif return *this; } @@ -117,22 +110,17 @@ PainterBase & Painter::fillRectangle(int x, int y, int w, int h, PainterBase & Painter::fillPolygon(int const * xp, int const * yp, int np, LColor::color col) { -#ifndef HAVE_AUTO_PTR - XPoint * points = new XPoint[np]; -#else - auto_ptr points(new XPoint[np]); -#endif - for (int i=0; i < np; ++i) { + boost::scoped_array points(new XPoint[np]); + + for (int i = 0; i < np; ++i) { points[i].x = xp[i]; points[i].y = yp[i]; } XFillPolygon(display, owner.getPixmap(), - lyxColorHandler->getGCForeground(col), points, np, + lyxColorHandler->getGCForeground(col), points.get(), np, Nonconvex, CoordModeOrigin); -#ifndef HAVE_AUTO_PTR - delete[] points; -#endif + return *this; } @@ -154,26 +142,22 @@ PainterBase & Painter::segments(int const * x1, int const * y1, LColor::color col, enum line_style ls, enum line_width lw) { -#ifndef HAVE_AUTO_PTR - XSegment * s= new XSegment[ns]; -#else - auto_ptr s(new XSegment[ns]); -#endif - for (int i=0; i s(new XSegment[ns]); + + for (int i = 0; i < ns; ++i) { s[i].x1 = x1[i]; s[i].y1 = y1[i]; s[i].x2 = x2[i]; s[i].y2 = y2[i]; } XDrawSegments(display, owner.getPixmap(), - lyxColorHandler->getGCLinepars(ls, lw, col), s, ns); + lyxColorHandler->getGCLinepars(ls, lw, col), + s.get(), ns); -#ifndef HAVE_AUTO_PTR - delete [] s; -#endif return *this; } + PainterBase & Painter::pixmap(int x, int y, int w, int h, Pixmap bitmap) { XGCValues val; @@ -186,6 +170,7 @@ PainterBase & Painter::pixmap(int x, int y, int w, int h, Pixmap bitmap) return *this; } + PainterBase & Painter::image(int x, int y, int w, int h, LyXImage const * image) { Pixmap bitmap = image->getPixmap(); @@ -211,7 +196,7 @@ 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) { - XChar2b * xs = new XChar2b[ls]; + boost::scoped_array xs(new XChar2b[ls]); Encoding const * encoding = f.language()->encoding(); LyXFont font(f); if (f.isSymbolFont()) { @@ -226,8 +211,7 @@ PainterBase & Painter::text(int x, int y, char const * s, size_t ls, xs[i].byte1 = c >> 8; xs[i].byte2 = c & 0xff; } - text(x , y, xs, ls, font); - delete[] xs; + text(x , y, xs.get(), ls, font); return *this; } @@ -238,10 +222,9 @@ PainterBase & Painter::text(int x, int y, char const * s, size_t ls, } else { LyXFont smallfont(f); smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE); - char c; int tmpx = x; for (size_t i = 0; i < ls; ++i) { - c = s[i]; + char c = s[i]; if (islower(static_cast(c))) { c = toupper(c); lyxfont::XSetFont(display, gc, smallfont); @@ -303,8 +286,8 @@ PainterBase & Painter::text(int x, int y, XChar2b const * s, int ls, void Painter::underline(LyXFont const & f, int x, int y, int width) { - int below = max(lyxfont::maxDescent(f) / 2, 2); - int height = max((lyxfont::maxDescent(f) / 4) - 1, 1); + int const below = max(lyxfont::maxDescent(f) / 2, 2); + int const height = max((lyxfont::maxDescent(f) / 4) - 1, 1); if (height < 2) line(x, y + below, x + width, y + below, f.color()); else diff --git a/src/Thesaurus.C b/src/Thesaurus.C index d45b3d4fbb..a166de5ec5 100644 --- a/src/Thesaurus.C +++ b/src/Thesaurus.C @@ -15,18 +15,24 @@ Thesaurus thesaurus; Thesaurus::ThesaurusEntry::ThesaurusEntry(string const & ent, char part) : entry(ent), pos(Thesaurus::NONE) { - if (part & AikSaurus::Unknown) pos |= OTHER; - if (part & AikSaurus::Other) pos |= OTHER; - if (part & AikSaurus::Noun) pos |= NOUN; - if (part & AikSaurus::Verb) pos |= VERB; - if (part & AikSaurus::Adjective) pos |= ADJECTIVE; - if (part & AikSaurus::Adverb) pos |= ADVERB; + if (part & AikSaurus::Unknown) + pos |= OTHER; + if (part & AikSaurus::Other) + pos |= OTHER; + if (part & AikSaurus::Noun) + pos |= NOUN; + if (part & AikSaurus::Verb) + pos |= VERB; + if (part & AikSaurus::Adjective) + pos |= ADJECTIVE; + if (part & AikSaurus::Adverb) + pos |= ADVERB; } Thesaurus::Thesaurus() { - aik_ = new AikSaurus(); + aik_ = new AikSaurus; } @@ -44,9 +50,8 @@ std::vector Thesaurus::lookup(string const & text) return entries; char pos; - string ret; - ret = aik_->next(pos); + string ret = aik_->next(pos); while (!ret.empty()) { entries.push_back(ThesaurusEntry(ret, pos)); ret = aik_->next(pos); diff --git a/src/WorkArea.C b/src/WorkArea.C index c70a8c720c..c3b0d5f0ab 100644 --- a/src/WorkArea.C +++ b/src/WorkArea.C @@ -9,25 +9,28 @@ * ====================================================== */ #include -#include -#include + #ifdef __GNUG__ #pragma implementation #endif #include "WorkArea.h" #include "debug.h" -#include "support/lstrings.h" #include "LyXView.h" -#include "support/filetools.h" // LibFileSearch #include "lyxrc.h" // lyxrc.show_banner #include "version.h" // lyx_version -#include "support/LAssert.h" #if FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5) #include "lyxlookup.h" #endif +#include "support/filetools.h" // LibFileSearch +#include "support/lstrings.h" +#include "support/LAssert.h" + +#include +#include + using std::endl; FL_OBJECT * figinset_canvas; diff --git a/src/buffer.C b/src/buffer.C index b2c50a9d70..48b3a755c0 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -30,8 +30,25 @@ #include "bufferview_funcs.h" #include "lyxfont.h" #include "version.h" +#include "LaTeX.h" +#include "Chktex.h" +#include "LyXView.h" +#include "debug.h" +#include "LaTeXFeatures.h" +#include "lyxtext.h" +#include "gettext.h" +#include "language.h" +#include "encoding.h" +#include "exporter.h" +#include "Lsstream.h" +#include "converter.h" +#include "BufferView.h" +#include "ParagraphParameters.h" +#include "iterators.h" + #include "mathed/formulamacro.h" #include "mathed/formula.h" + #include "insets/inset.h" #include "insets/inseterror.h" #include "insets/insetlabel.h" @@ -63,37 +80,25 @@ #endif #include "insets/insetcaption.h" #include "insets/insetfloatlist.h" + +#include "frontends/Dialogs.h" +#include "frontends/Alert.h" + #include "support/textutils.h" #include "support/filetools.h" #include "support/path.h" #include "support/os.h" -#include "LaTeX.h" -#include "Chktex.h" -#include "LyXView.h" -#include "debug.h" -#include "LaTeXFeatures.h" #include "support/syscall.h" #include "support/lyxlib.h" #include "support/FileInfo.h" #include "support/lyxmanip.h" -#include "lyxtext.h" -#include "gettext.h" -#include "language.h" -#include "frontends/Dialogs.h" -#include "frontends/Alert.h" -#include "encoding.h" -#include "exporter.h" -#include "Lsstream.h" -#include "converter.h" -#include "BufferView.h" -#include "ParagraphParameters.h" -#include "iterators.h" #include #include #include #include #include +#include #include #include @@ -101,7 +106,6 @@ #include #include -#include #ifdef HAVE_LOCALE #include diff --git a/src/bufferlist.C b/src/bufferlist.C index 41327e41ec..8455604fe9 100644 --- a/src/bufferlist.C +++ b/src/bufferlist.C @@ -12,24 +12,14 @@ * ====================================================== */ +#include + #ifdef __GNUG__ #pragma implementation #endif -#include - -#include -#include -#include - -#include "frontends/Alert.h" #include "bufferlist.h" #include "lyx_main.h" -#include "support/FileInfo.h" -#include "support/filetools.h" -#include "support/lyxmanip.h" -#include "support/lyxfunctional.h" -#include "support/LAssert.h" #include "lyx_gui_misc.h" #include "lastfiles.h" #include "debug.h" @@ -43,6 +33,19 @@ #include "vc-backend.h" #include "TextCache.h" +#include "frontends/Alert.h" + +#include "support/FileInfo.h" +#include "support/filetools.h" +#include "support/lyxmanip.h" +#include "support/lyxfunctional.h" +#include "support/LAssert.h" + +#include +#include +#include + + using std::vector; using std::find; using std::endl; diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 72b5f6d95d..1c0fceb1fe 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -10,26 +10,13 @@ #include -#include "Lsstream.h" - -#include -#include - -#include -#include - -#include -#include - #ifdef __GNUG__ #pragma implementation #endif -#include "support/lyxalgo.h" -#include "support/LAssert.h" +#include "lyxfunc.h" #include "version.h" #include "kbmap.h" -#include "lyxfunc.h" #include "lyxrow.h" #include "bufferlist.h" #include "BufferView.h" @@ -39,6 +26,30 @@ #include "lyx_main.h" #include "lyx_cb.h" #include "LyXAction.h" +#include "debug.h" +#include "lyxrc.h" +#include "lyxtext.h" +#include "gettext.h" +#include "Lsstream.h" +#include "trans_mgr.h" +#include "layout.h" +#include "WorkArea.h" +#include "bufferview_funcs.h" +#include "minibuffer.h" +#include "vspace.h" +#include "LyXView.h" +#include "lyx_gui_misc.h" +#include "FloatList.h" +#include "converter.h" +#include "exporter.h" +#include "importer.h" +#include "FontLoader.h" +#include "TextCache.h" +#include "lyxfind.h" +#include "undo_funcs.h" +#include "ParagraphParameters.h" +#include "figureForm.h" + #include "insets/inseturl.h" #include "insets/insetlatexaccent.h" #include "insets/insettoc.h" @@ -62,42 +73,34 @@ #endif #include "insets/insettabular.h" #include "insets/insetcaption.h" + #include "mathed/formulamacro.h" #include "mathed/math_cursor.h" #include "mathed/math_inset.h" -#include "minibuffer.h" -#include "vspace.h" -#include "LyXView.h" -#include "lyx_gui_misc.h" + +#include "frontends/FileDialog.h" +#include "frontends/Dialogs.h" +#include "frontends/Toolbar.h" +#include "frontends/Menubar.h" +#include "frontends/Alert.h" + +#include "support/lyxalgo.h" +#include "support/LAssert.h" #include "support/filetools.h" #include "support/FileInfo.h" #include "support/syscall.h" #include "support/lstrings.h" #include "support/path.h" #include "support/lyxfunctional.h" -#include "debug.h" -#include "lyxrc.h" -#include "lyxtext.h" -#include "gettext.h" -#include "trans_mgr.h" -#include "layout.h" -#include "WorkArea.h" -#include "bufferview_funcs.h" -#include "frontends/FileDialog.h" -#include "frontends/Dialogs.h" -#include "frontends/Toolbar.h" -#include "frontends/Menubar.h" -#include "frontends/Alert.h" -#include "FloatList.h" -#include "converter.h" -#include "exporter.h" -#include "importer.h" -#include "FontLoader.h" -#include "TextCache.h" -#include "lyxfind.h" -#include "undo_funcs.h" -#include "ParagraphParameters.h" -#include "figureForm.h" + +#include +#include +#include +#include + +#include +#include + using std::pair; using std::make_pair; diff --git a/src/mathed/math_iterator.C b/src/mathed/math_iterator.C index c0841de2bd..ca65d4a340 100644 --- a/src/mathed/math_iterator.C +++ b/src/mathed/math_iterator.C @@ -63,7 +63,7 @@ MathAtom * MathIterator::nextInset() const { if (position().pos_ == xcell().data_.size()) return 0; - return const_cast(xcell().begin() + position().pos_); + return const_cast(&*(xcell().begin() + position().pos_)); } diff --git a/src/mathed/math_iterator.h b/src/mathed/math_iterator.h index e351080906..9f721b7f02 100644 --- a/src/mathed/math_iterator.h +++ b/src/mathed/math_iterator.h @@ -1,3 +1,4 @@ +// -*- C++ -*- #ifndef MATH_ITERATOR_H #define MATH_ITERATOR_H diff --git a/src/text2.C b/src/text2.C index 019f7b891c..4ddf68cae9 100644 --- a/src/text2.C +++ b/src/text2.C @@ -17,15 +17,8 @@ #include "lyxtext.h" #include "LString.h" #include "paragraph.h" -#include "insets/inseterror.h" -#include "insets/insetbib.h" -#include "insets/insetspecialchar.h" -#include "insets/insettext.h" -#include "insets/insetfloat.h" #include "layout.h" #include "LyXView.h" -#include "support/textutils.h" -#include "support/lstrings.h" #include "undo_funcs.h" #include "buffer.h" #include "bufferparams.h" @@ -42,7 +35,16 @@ #include "FloatList.h" #include "language.h" #include "ParagraphParameters.h" + +#include "insets/inseterror.h" +#include "insets/insetbib.h" +#include "insets/insetspecialchar.h" +#include "insets/insettext.h" +#include "insets/insetfloat.h" + #include "support/LAssert.h" +#include "support/textutils.h" +#include "support/lstrings.h" using std::copy; using std::find; -- 2.39.2