diff --git a/ChangeLog b/ChangeLog index 0fb75d29f5..b9191f1437 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,36 @@ +2000-04-03 Lars Gullik Bjønnes + + * src/font.[Ch]: new files. Contains the metric functions for + fonts, takes a LyXFont as parameter. Better separation of concepts. + + * src/lyxfont.[Ch]: move the metric functions to font.[Ch] several + changes because of this. + + * src/PainterBase.[Ch] (width): remove, use the ones in font.C instead + + * src/*: compile with -Winline and move functions that don't + inline out of line. + + * src/lyx_cb.C (stringOnlyContains): use string::find_first_not_of + instead of strspn. + +2000-04-02 Lars Gullik Bjønnes + + * src/paragraph.C (GetLabelstring): renamed from GetLabestring. + (various files changed because of this) + + * src/Painter.C (text): fixed the drawing of smallcaps. + + * src/lyxfont.[Ch] (drawText): removed unused member func. + (drawString): ditto + + * src/*.C: added needed "using" statements and "std::" qualifiers. + +2000-03-31 Lars Gullik Bjønnes + + * src/*.h: removed all use of "using" from header files use + qualifier std:: instead. + 2000-04-03 Jean-Marc Lasgouttes * src/text.C (Backspace): some additional cleanups (we already diff --git a/acinclude.m4 b/acinclude.m4 index e7d8f22520..8035768cc9 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -194,7 +194,7 @@ dnl Check the version of g++ fi if test x$with_warnings = xyes ; then case $gxx_version in - 2.95.*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion";; + 2.95.*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion -Winline";; 2.96*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion";; *) CXXFLAGS="$CXXFLAGS -ansi -W -Wall -Wno-return-type";; esac diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4 index a430a0933a..59046710a1 100644 --- a/config/lyxinclude.m4 +++ b/config/lyxinclude.m4 @@ -194,7 +194,7 @@ dnl Check the version of g++ fi if test x$with_warnings = xyes ; then case $gxx_version in - 2.95.*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion";; + 2.95.*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion -Winline";; 2.96*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion";; *) CXXFLAGS="$CXXFLAGS -ansi -W -Wall -Wno-return-type";; esac diff --git a/po/POTFILES.in b/po/POTFILES.in index d33b423a19..38e34d5dc7 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -24,30 +24,26 @@ src/FontLoader.C src/form1.C src/gettext.h src/insets/figinset.C -src/insets/figinset.h src/insets/form_graphics.C src/insets/form_url.C src/insets/insetbib.C +src/insets/inset.C +src/insets/inseteditor.C src/insets/inseterror.C -src/insets/inseterror.h src/insets/insetert.C -src/insets/insetert.h src/insets/insetfoot.C src/insets/insetgraphics.C src/insets/insetinclude.C src/insets/insetindex.C src/insets/insetinfo.C -src/insets/insetinfo.h -src/insets/insetloa.h -src/insets/insetlof.h -src/insets/insetlot.h -src/insets/insetparent.h +src/insets/insetloa.C +src/insets/insetlof.C +src/insets/insetlot.C +src/insets/insetparent.C src/insets/insetref.C src/insets/insettext.C -src/insets/insettoc.h +src/insets/insettoc.C src/insets/inseturl.C -src/insets/inseturl.h -src/insets/lyxinset.h src/intl.C src/kbsequence.C src/language.C @@ -74,14 +70,11 @@ src/LyXSendto.C src/lyxvc.C src/LyXView.C src/mathed/formula.C -src/mathed/formula.h src/mathed/formulamacro.C -src/mathed/formulamacro.h src/mathed/math_forms.C src/mathed/math_panel.C src/menus.C src/minibuffer.C -src/minibuffer.h src/Painter.C src/PaperLayout.C src/paragraph.C diff --git a/src/BackStack.h b/src/BackStack.h index 69b2169562..152ca7355a 100644 --- a/src/BackStack.h +++ b/src/BackStack.h @@ -15,8 +15,6 @@ #include "LString.h" -using std::stack; - // Created by Alejandro Aguilar Sierra, 970806 /** Utility to get back from a reference or from a child document. @@ -55,7 +53,7 @@ public: } private: /// - stack stakk; + std::stack stakk; }; #endif diff --git a/src/BufferView.C b/src/BufferView.C index 2360a59a49..2641fca95a 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -47,7 +47,9 @@ #include "lyxrc.h" #include "lyxrow.h" #include "WorkArea.h" +#include "font.h" +using std::pair; using std::for_each; using std::find_if; using std::endl; @@ -935,7 +937,7 @@ void BufferView::workAreaButtonRelease(int x, int y, unsigned int button) font.setSize(LyXFont::SIZE_FOOTNOTE); int box_x = 20; // LYX_PAPER_MARGIN; - box_x += font.textWidth(" wide-tab ", 10); + box_x += lyxfont::width(" wide-tab ", font); int screen_first = screen->first; @@ -944,7 +946,7 @@ void BufferView::workAreaButtonRelease(int x, int y, unsigned int button) text->cursor.row->baseline && y + screen_first < text->cursor.y - text->cursor.row->baseline - + font.maxAscent() * 1.2 + font.maxDescent() * 1.2) { + + lyxfont::maxAscent(font) * 1.2 + lyxfont::maxDescent(font) * 1.2) { toggleFloat(); selection_possible = false; return; diff --git a/src/BufferView2.C b/src/BufferView2.C index 6aa4869c32..69ea4c6527 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -26,6 +26,7 @@ extern BufferList bufferlist; +using std::pair; using std::endl; using std::ifstream; diff --git a/src/DepTable.h b/src/DepTable.h index 9f2bdf24bb..675191b08d 100644 --- a/src/DepTable.h +++ b/src/DepTable.h @@ -22,9 +22,6 @@ #pragma interface #endif -using std::map; -using std::pair; - /// class DepTable { public: @@ -54,8 +51,8 @@ public: void remove_files_with_extension(string const &); private: /// - typedef map > DepList; + typedef std::map > DepList; /// DepList deplist; }; diff --git a/src/FontInfo.C b/src/FontInfo.C index eed9a4018f..c61d6662bb 100644 --- a/src/FontInfo.C +++ b/src/FontInfo.C @@ -13,6 +13,8 @@ #include // fabs() #include // atoi() +#include FORMS_H_LOCATION + #ifdef __GNUG__ #pragma implementation "FontInfo.h" #endif @@ -144,6 +146,17 @@ void FontInfo::query() } +void FontInfo::init() +{ + sizes = 0; + strings = 0; + matches = 0; + queried = false; + scalable = false; + scaleindex = -1; +} + + /// Release allocated stuff void FontInfo::release() { diff --git a/src/FontInfo.h b/src/FontInfo.h index 450c76c44a..1e3d7d22fe 100644 --- a/src/FontInfo.h +++ b/src/FontInfo.h @@ -80,14 +80,7 @@ private: int scaleindex; /// Initialize empty record - void init() { - sizes = 0; - strings = 0; - matches = 0; - queried = false; - scalable = false; - scaleindex = -1; - } + void init(); /// Release allocated stuff void release(); diff --git a/src/FontLoader.C b/src/FontLoader.C index 9d56de1068..77007f7461 100644 --- a/src/FontLoader.C +++ b/src/FontLoader.C @@ -30,6 +30,11 @@ using std::endl; extern BufferView * current_view; + +// The global fontloader +FontLoader fontloader; + + // Initialize font loader FontLoader::FontLoader() { diff --git a/src/FontLoader.h b/src/FontLoader.h index 9cc21f74cd..189a0b986b 100644 --- a/src/FontLoader.h +++ b/src/FontLoader.h @@ -73,4 +73,7 @@ private: LyXFont::FONT_SHAPE shape, LyXFont::FONT_SIZE size); }; + +extern FontLoader fontloader; + #endif diff --git a/src/LColor.h b/src/LColor.h index 685d0ac518..5242f418fe 100644 --- a/src/LColor.h +++ b/src/LColor.h @@ -19,8 +19,6 @@ #include "LString.h" -using std::map; - /** This is a stateless class. @@ -196,8 +194,7 @@ private: string const & lyx); /// - //typedef map > InfoTab; - typedef map InfoTab; + typedef std::map InfoTab; InfoTab infotab; }; diff --git a/src/LString.h b/src/LString.h index 0f2eccc8cd..3d42a39fac 100644 --- a/src/LString.h +++ b/src/LString.h @@ -17,6 +17,7 @@ using std::string; #else #include "support/lyxstring.h" +// using lyx::string; typedef lyxstring string; #endif #endif diff --git a/src/LaTeX.h b/src/LaTeX.h index ebeb4b6649..c9f5c9f1ce 100644 --- a/src/LaTeX.h +++ b/src/LaTeX.h @@ -23,8 +23,6 @@ #include "DepTable.h" #include -using std::vector; - class MiniBuffer; /// @@ -48,7 +46,7 @@ private: }; public: /// - typedef vector Errors; + typedef std::vector Errors; /// Errors::const_iterator begin() const { return errors.begin(); } /// diff --git a/src/LaTeXFeatures.C b/src/LaTeXFeatures.C index e0a1e9ce60..fb141546b7 100644 --- a/src/LaTeXFeatures.C +++ b/src/LaTeXFeatures.C @@ -130,7 +130,7 @@ string LaTeXFeatures::getPackages(BufferParams const & params) //char value[30]; //sprintf(value, "%.2f", params.spacing.getValue()); #ifdef HAVE_SSTREAM - ostringstream value; + std::ostringstream value; #else char val[30]; ostrstream value(val, 30); diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h index feed7812d6..d5d6424e08 100644 --- a/src/LaTeXFeatures.h +++ b/src/LaTeXFeatures.h @@ -22,9 +22,6 @@ #include "LString.h" -using std::vector; -using std::set; - class BufferParams; class LyXTextClass; struct Language; @@ -125,7 +122,7 @@ struct LaTeXFeatures { //@Man: Layouts //@{ - vector layout; + std::vector layout; //@} //@Man: Special features @@ -136,7 +133,7 @@ struct LaTeXFeatures { /// bool NeedLyXMinipageIndent; /// - typedef set LanguageList; + typedef std::set LanguageList; /// LanguageList UsedLanguages; //@} diff --git a/src/LyXAction.C b/src/LyXAction.C index 656e0d8f56..5f5e664c2c 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -19,6 +19,7 @@ #include "gettext.h" #include "support/lstrings.h" +using std::ostream; using std::endl; /* diff --git a/src/LyXAction.h b/src/LyXAction.h index a1e4f834e0..4fadb5c048 100644 --- a/src/LyXAction.h +++ b/src/LyXAction.h @@ -11,8 +11,6 @@ #include "commandtags.h" #include "LString.h" -using std::map; - /** This class encapsulates LyX action and user command operations. */ class LyXAction { @@ -31,20 +29,15 @@ private: }; public: /// - typedef map func_map; - //typedef map > func_map; + typedef std::map func_map; /// - typedef map info_map; - //typedef map > info_map; + typedef std::map info_map; /// - typedef map pseudo_map; - //typedef map > pseudo_map; + typedef std::map pseudo_map; /// - typedef map arg_item; - //typedef map > arg_item; + typedef std::map arg_item; /// - typedef map arg_map; - //typedef map > arg_map; + typedef std::map arg_map; /// enum func_attrib { diff --git a/src/Makefile.am b/src/Makefile.am index 8375f7eb53..b04ce5912b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -90,6 +90,8 @@ lyx_SOURCES = \ figure.h \ filedlg.C \ filedlg.h \ + font.C \ + font.h \ form1.C \ form1.h \ gettext.h \ diff --git a/src/Painter.C b/src/Painter.C index a7891e577a..fa8db6ea0c 100644 --- a/src/Painter.C +++ b/src/Painter.C @@ -14,12 +14,12 @@ #pragma implementation #endif -#include - #ifdef USE_STL_MEMORY #include #endif +#include + #include FORMS_H_LOCATION #include "Painter.h" #include "LString.h" @@ -28,8 +28,10 @@ #include "support/LAssert.h" #include "support/lstrings.h" #include "WorkArea.h" +#include "font.h" using std::endl; +using std::max; Painter::Painter(WorkArea & wa) : PainterBase(wa) @@ -100,9 +102,9 @@ PainterBase & Painter::line(int x1, int y1, int x2, int y2, PainterBase & Painter::lines(int const * xp, int const * yp, int np, - LColor::color col, - enum line_style ls, - enum line_width lw) + LColor::color col, + enum line_style ls, + enum line_width lw) { if (lyxerr.debugging()) { if (!Lgb_bug_find_hack) @@ -116,7 +118,7 @@ PainterBase & Painter::lines(int const * xp, int const * yp, int np, #else auto_ptr points(new Xpoint[np]); #endif - for (int i=0; i points(new XPoint[np]); #endif - for (int i=0; iwidth(s, ls, f)); + if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) { + lyxfont::XSetFont(display, gc, f); + XDrawString(display, drawable(), gc, x, y, s, ls); + } else { + LyXFont smallfont(f); + smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE); + char c; + int tmpx = x; + for(int i = 0; i < ls; ++i) { + c = s[i]; + if (islower(static_cast(c))) { + c = toupper(c); + lyxfont::XSetFont(display, gc, smallfont); + XDrawString(display, drawable(), + gc, tmpx, y, &c, 1); + tmpx += lyxfont::XTextWidth(smallfont, &c, 1); + //tmpx += lyxfont::width(c, f); + } else { + lyxfont::XSetFont(display, gc, f); + XDrawString(display, drawable(), + gc, tmpx, y, &c, 1); + tmpx += lyxfont::XTextWidth(f, &c, 1); + //tmpx += lyxfont::width(c, f); + } + } + } + underline(f, x, y, lyxfont::width(s, ls, f)); return *this; } @@ -298,10 +323,8 @@ void Painter::underline(LyXFont const & f, int x, int y, int width) { // What about underbars? if (f.underbar() == LyXFont::ON && f.latex() != LyXFont::ON) { - int below = f.maxDescent() / 2; - if (below < 2) below = 2; - int height = (f.maxDescent() / 4) - 1; - if (height < 0) height = 0; + int below = max(lyxfont::maxDescent(f) / 2, 2); + int height = max((lyxfont::maxDescent(f) / 4) - 1, 0); fillRectangle(x, y + below, width, below + height, f.color()); } } diff --git a/src/Painter.h b/src/Painter.h index d27624ad2f..80b03660fd 100644 --- a/src/Painter.h +++ b/src/Painter.h @@ -25,8 +25,6 @@ #include "PainterBase.h" #include "LColor.h" -using std::map; - class LyXFont; class WorkArea; @@ -131,8 +129,7 @@ protected: /// Caching of ordinary color GCs GC colorGCcache[LColor::ignore + 1]; /// Caching of GCs used for lines - //typedef map > LineGCCache; - typedef map LineGCCache; + typedef std::map LineGCCache; /// LineGCCache lineGCcache; }; diff --git a/src/PainterBase.C b/src/PainterBase.C index f499e0be4d..6d703cff8f 100644 --- a/src/PainterBase.C +++ b/src/PainterBase.C @@ -16,7 +16,7 @@ #include "PainterBase.h" #include "lyxfont.h" #include "WorkArea.h" - +#include "font.h" int PainterBase::dummy1 = 0; int PainterBase::dummy2 = 0; @@ -34,24 +34,6 @@ int PainterBase::paperWidth() const } -int PainterBase::width(string const & s, LyXFont const & f) const -{ - return f.stringWidth(s); -} - - -int PainterBase::width(char const * s, int l, LyXFont const & f) const -{ - return f.textWidth(s, l); -} - - -int PainterBase::width(char c, LyXFont const & f) const -{ - return f.width(c); -} - - PainterBase & PainterBase::circle(int x, int y, unsigned int d, LColor::color col) { @@ -110,9 +92,9 @@ PainterBase & PainterBase::rectText(int x, int baseline, int & width, int & ascent, int & descent) { static int const d = 2; - width = this->width(str, font) + d * 2 + 2; - ascent = font.maxAscent() + d; - descent = font.maxDescent() + d; + width = lyxfont::width(str, font) + d * 2 + 2; + ascent = lyxfont::maxAscent(font) + d; + descent = lyxfont::maxDescent(font) + d; if (!draw) return *this; @@ -129,9 +111,9 @@ PainterBase & PainterBase::buttonText(int x, int baseline, LyXFont const & font, bool draw, int & width, int & ascent, int & descent) { - width = this->width(str, font) + 8; - ascent = font.maxAscent() + 3; - descent = font.maxDescent() + 3; + width = lyxfont::width(str, font) + 8; + ascent = lyxfont::maxAscent(font) + 3; + descent = lyxfont::maxDescent(font) + 3; if (!draw) return *this; diff --git a/src/PainterBase.h b/src/PainterBase.h index 9657322df1..7178f93564 100644 --- a/src/PainterBase.h +++ b/src/PainterBase.h @@ -20,7 +20,6 @@ class WorkArea; class LyXFont; -//class LyXScreen; /** A painter class to encapsulate all graphics parameters and operations @@ -162,16 +161,6 @@ public: /// Draw a char at position x, y (y is the baseline) virtual PainterBase & text(int x, int y, char c, LyXFont const & f)=0; - /// Get the width of text - int width(string const & s, LyXFont const & f) const; - - /** Get the width of text - This is just for fast width */ - int width(char const * s, int l, LyXFont const & f) const; - - /// Get the width of text - int width(char c, LyXFont const & f) const; - /** Draws a string and encloses it inside a rectangle. Returns the size of the rectangle. If draw is false, we only calculate the size. */ diff --git a/src/Spacing.C b/src/Spacing.C index bd0f8818a7..f76154d361 100644 --- a/src/Spacing.C +++ b/src/Spacing.C @@ -11,6 +11,7 @@ using std::istringstream; #include "Spacing.h" using std::ios; +using std::ostream; /// how can I put this inside of Spacing (class) static diff --git a/src/Spacing.h b/src/Spacing.h index 4cfb02c5d0..7a5db054f1 100644 --- a/src/Spacing.h +++ b/src/Spacing.h @@ -14,8 +14,6 @@ #include -using std::ostream; - /// class Spacing { public: @@ -44,7 +42,7 @@ public: /// void set(Spacing::Space sp, char const * val) ; /// - void writeFile(ostream &) const; + void writeFile(std::ostream &) const; /// friend bool operator!=(Spacing const & a, Spacing const & b) { if (a.space == b.space && a.getValue() == b.getValue()) diff --git a/src/TextCache.C b/src/TextCache.C index b2f6c1b75c..0b5be6340e 100644 --- a/src/TextCache.C +++ b/src/TextCache.C @@ -22,6 +22,7 @@ #include "buffer.h" #include "bufferlist.h" +using std::ostream; using std::for_each; using std::remove_if; using std::find_if; diff --git a/src/TextCache.h b/src/TextCache.h index f2fa9ffc31..68af6be328 100644 --- a/src/TextCache.h +++ b/src/TextCache.h @@ -23,9 +23,6 @@ #include "LString.h" #include "lyxtext.h" -using std::ostream; -using std::vector; - class Buffer; // This is only the very first implemetation and use of the TextCache, @@ -115,7 +112,7 @@ class Buffer; class TextCache { public: /// - typedef vector Cache; + typedef std::vector Cache; /// typedef LyXText * value_type; @@ -124,9 +121,9 @@ public: LyXText * findFit(Buffer * b, unsigned short p); /** Lists all the LyXText's currently in the cache. Uses msg as header for the list. */ - void show(ostream & o, string const & msg); + void show(std::ostream & o, string const & msg); /// Gives info on a single LyXText (buffer and width) - static void show(ostream & o, LyXText *); + static void show(std::ostream & o, LyXText *); /** Adds a LyXText to the cache iff its buffer is present in bufferlist. */ void add(LyXText *); diff --git a/src/ToolbarDefaults.h b/src/ToolbarDefaults.h index 3781f0c715..91fe0cc4c8 100644 --- a/src/ToolbarDefaults.h +++ b/src/ToolbarDefaults.h @@ -7,16 +7,13 @@ #include "LString.h" -using std::vector; - class LyXLex; - /// class ToolbarDefaults { public: /// - typedef vector Defaults; + typedef std::vector Defaults; /// typedef Defaults::iterator iterator; /// diff --git a/src/UpdateInset.h b/src/UpdateInset.h index d969884263..154e2dbcdf 100644 --- a/src/UpdateInset.h +++ b/src/UpdateInset.h @@ -10,8 +10,6 @@ #include #include "support/LAssert.h" -using std::queue; - class Inset; class BufferView; @@ -27,7 +25,7 @@ public: void update(BufferView *); private: /// - typedef queue InsetQueue; + typedef std::queue InsetQueue; /// InsetQueue insetqueue; }; diff --git a/src/WorkArea.h b/src/WorkArea.h index 537d4c4fd7..85aaee9a07 100644 --- a/src/WorkArea.h +++ b/src/WorkArea.h @@ -21,8 +21,6 @@ #include FORMS_H_LOCATION #include "Painter.h" -using std::pair; - class BufferView; class WorkArea { @@ -79,8 +77,8 @@ public: return fl_get_slider_value(scrollbar); } /// - pair getScrollbarBounds() const { - pair p; + std::pair getScrollbarBounds() const { + std::pair p; fl_get_slider_bounds(scrollbar, &p.first, &p.second); return p; } diff --git a/src/buffer.C b/src/buffer.C index 9d6b55b0ff..afe88a46d0 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -25,12 +25,6 @@ #include #include -using std::ofstream; -using std::ifstream; -using std::fstream; -using std::ios; -using std::setw; - #include #include @@ -74,7 +68,7 @@ using std::setw; #include "insets/insetspecialchar.h" #include "insets/figinset.h" #include "insets/insettext.h" -#include "insets/insetnumber.h" +//#include "insets/insetnumber.h" #include "insets/insetert.h" #include "insets/insetgraphics.h" #include "insets/insetfoot.h" @@ -93,7 +87,14 @@ using std::setw; #include "gettext.h" #include "language.h" +using std::ostream; +using std::ofstream; +using std::ifstream; +using std::fstream; +using std::ios; +using std::setw; using std::endl; +using std::pair; // Uncomment this line to enable a workaround for the weird behaviour // of the cursor between a displayed inset and last character @@ -813,6 +814,7 @@ bool Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, par->InsertInset(pos, inset); par->SetFont(pos, font); ++pos; +#if 0 } else if (tmptok == "Number") { inset = new InsetNumber(this); inset->Read(lex); @@ -820,6 +822,7 @@ bool Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, par->InsertInset(pos, inset); par->SetFont(pos, font); ++pos; +#endif } else if (tmptok == "Foot") { inset = new InsetFoot(this); inset->Read(lex); @@ -857,7 +860,7 @@ bool Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, if (!inscmd.getOptions().empty() || !inscmd.getContents().empty()) { inset = new InsetRef(inscmd, this); } -#warning Verify that this else clause is still needed. (Lgb) +#warning Check if this else clause is still needed. (Lgb) #if 0 // This condition comes from a // temporary solution to the latexdel @@ -1389,7 +1392,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen) if ((inset = par->GetInset(i))) { #if 1 #ifdef HAVE_SSTREAM - ostringstream ost; + std::ostringstream ost; inset->Latex(ost, -1, free_spc); h += ost.str().length(); #else @@ -2038,7 +2041,7 @@ void Buffer::makeLaTeXFile(string const & fname, bool was_title = false; bool already_title = false; #ifdef HAVE_SSTREAM - ostringstream ftnote; + std::ostringstream ftnote; #else char * tmpholder = 0; #endif @@ -2495,7 +2498,7 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par, .NumberOfLayout(params.textclass, "Caption").second) { #ifdef HAVE_SSTREAM - ostringstream ost; + std::ostringstream ost; #else ostrstream ost; #endif @@ -3127,7 +3130,7 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra, if (c == LyXParagraph::META_INSET) { Inset * inset = par->GetInset(i); #ifdef HAVE_SSTREAM - ostringstream ost; + std::ostringstream ost; inset->DocBook(ost); string tmp_out = ost.str().c_str(); #else diff --git a/src/buffer.h b/src/buffer.h index faf39dec24..e8ae62e00c 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -35,8 +35,6 @@ #include "support/filetools.h" #include "lyx_gui_misc.h" -using std::ostream; - class LyXRC; class TeXErrors; class LaTeXFeatures; @@ -338,42 +336,42 @@ public: TexRow texrow; private: /// - void linuxDocHandleFootnote(ostream & os, + void linuxDocHandleFootnote(std::ostream & os, LyXParagraph * & par, int const depth); /// - void DocBookHandleCaption(ostream & os, string & inner_tag, + void DocBookHandleCaption(std::ostream & os, string & inner_tag, int const depth, int desc_on, LyXParagraph * & par); /// - void DocBookHandleFootnote(ostream & os, + void DocBookHandleFootnote(std::ostream & os, LyXParagraph * & par, int const depth); /// - void sgmlOpenTag(ostream & os, int depth, + void sgmlOpenTag(std::ostream & os, int depth, string const & latexname) const; /// - void sgmlCloseTag(ostream & os, int depth, + void sgmlCloseTag(std::ostream & os, int depth, string const & latexname) const; /// void LinuxDocError(LyXParagraph * par, int pos, char const * message); /// - void SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par, + void SimpleLinuxDocOnePar(std::ostream & os, LyXParagraph * par, int desc_on, int const depth); /// - void SimpleDocBookOnePar(ostream &, string & extra, + void SimpleDocBookOnePar(std::ostream &, string & extra, LyXParagraph * par, int & desc_on, int const depth); /// LinuxDoc. - void push_tag(ostream & os, char const * tag, + void push_tag(std::ostream & os, char const * tag, int & pos, char stack[5][3]); /// LinuxDoc. - void pop_tag(ostream & os, char const * tag, + void pop_tag(std::ostream & os, char const * tag, int & pos, char stack[5][3]); #if 0 /// - void RoffAsciiTable(ostream &, LyXParagraph * par); + void RoffAsciiTable(std::ostream &, LyXParagraph * par); #endif /// is save needed diff --git a/src/bufferlist.C b/src/bufferlist.C index 6490d0d016..ac861bf55b 100644 --- a/src/bufferlist.C +++ b/src/bufferlist.C @@ -38,6 +38,7 @@ extern BufferView * current_view; // called too many times in this file... +using std::vector; using std::find; using std::endl; diff --git a/src/bufferlist.h b/src/bufferlist.h index fec67696c0..f5155b370e 100644 --- a/src/bufferlist.h +++ b/src/bufferlist.h @@ -21,8 +21,6 @@ #include "buffer.h" #include "debug.h" -using std::vector; - /** A class to hold all the buffers in a structure The point of this class is to hide from bufferlist what kind of structure the buffers are stored in. Should be no concern for @@ -34,7 +32,7 @@ using std::vector; class BufferStorage { public: /// - typedef vector Container; + typedef std::vector Container; /// typedef Container::iterator iterator; /// @@ -112,7 +110,7 @@ public: /// Make a new file (buffer) using a template Buffer * newFile(string const &, string); /// returns a vector with all the buffers filenames - vector getFileNames() const; + std::vector getFileNames() const; /// int unlockInset(UpdatableInset *); diff --git a/src/bufferparams.C b/src/bufferparams.C index c802fd24cf..f45a5b2ca1 100644 --- a/src/bufferparams.C +++ b/src/bufferparams.C @@ -25,6 +25,7 @@ #include "lyxrc.h" #include "language.h" +using std::ostream; using std::endl; BufferParams::BufferParams() diff --git a/src/bufferparams.h b/src/bufferparams.h index 002b9b2d18..3612af04fc 100644 --- a/src/bufferparams.h +++ b/src/bufferparams.h @@ -25,8 +25,6 @@ #include "layout.h" #include "support/block.h" -using std::ostream; - /** This class contains all the parameters for this a buffer uses. Some work needs to be done on this class to make it nice. Now everything @@ -113,7 +111,7 @@ public: //@} /// - void writeFile(ostream &) const; + void writeFile(std::ostream &) const; /// void useClassDefaults(); diff --git a/src/chset.C b/src/chset.C index 399f941a69..b2b6a5ebe0 100644 --- a/src/chset.C +++ b/src/chset.C @@ -13,6 +13,7 @@ #include "debug.h" using std::ifstream; +using std::pair; using std::make_pair; using std::endl; diff --git a/src/chset.h b/src/chset.h index 9fcef19ab6..5a553c0996 100644 --- a/src/chset.h +++ b/src/chset.h @@ -11,9 +11,6 @@ #include "LString.h" -using std::map; -using std::pair; - /// class CharacterSet { public: @@ -22,12 +19,12 @@ public: /// string const & getName() const; /// - pair encodeString(string &) const; + std::pair encodeString(string &) const; private: /// string name_; /// - typedef map Cdef; + typedef std::map Cdef; /// Cdef map_; }; diff --git a/src/commandtags.h b/src/commandtags.h index bbda36c114..eff8853931 100644 --- a/src/commandtags.h +++ b/src/commandtags.h @@ -12,8 +12,6 @@ #include "debug.h" -using std::ostream; - /** These are all the lyxfunctions (as enums). */ enum kb_action { @@ -250,5 +248,5 @@ enum kb_action { LFUN_LASTACTION /* this marks the end of the table */ }; -ostream & operator<<(ostream &, kb_action); +std::ostream & operator<<(std::ostream &, kb_action); #endif diff --git a/src/debug.C b/src/debug.C index b9847d3a77..6928f52a86 100644 --- a/src/debug.C +++ b/src/debug.C @@ -16,6 +16,7 @@ #include +using std::ostream; using std::setw; using std::endl; diff --git a/src/debug.h b/src/debug.h index 9047e64577..b854283af0 100644 --- a/src/debug.h +++ b/src/debug.h @@ -8,8 +8,6 @@ #include "LString.h" #include "support/lstrings.h" -using std::ostream; - /** Ideally this should have been a namespace, but since we try to be compilable on older C++ compilators too, we use a struct instead. This is all the different debug levels that we have. @@ -71,10 +69,10 @@ struct Debug { /** Display the tags and descriptions of the current debug level of ds */ - static void showLevel(ostream & o, type level); + static void showLevel(std::ostream & o, type level); /** show all the possible tags that can be used for debugging */ - static void showTags(ostream & o); + static void showTags(std::ostream & o); }; @@ -91,7 +89,7 @@ void operator|= (Debug::type & d1, Debug::type d2) /// -ostream & operator<<(ostream & o, Debug::type t); +std::ostream & operator<<(std::ostream & o, Debug::type t); extern DebugStream lyxerr; diff --git a/src/filedlg.C b/src/filedlg.C index 043e17ca97..7c2650bf71 100644 --- a/src/filedlg.C +++ b/src/filedlg.C @@ -88,26 +88,29 @@ public: } private: /// - void add(uid_t ID) const { - string pszNewName; - struct passwd * pEntry; - - // gets user name - if ((pEntry = getpwuid(ID))) - pszNewName = pEntry->pw_name; - else { - pszNewName = tostr(ID); - } - - // adds new node - users[ID] = pszNewName; - } + void add(uid_t ID) const; /// typedef map Users; /// mutable Users users; }; +void UserCache::add(uid_t ID) const +{ + string pszNewName; + struct passwd * pEntry; + + // gets user name + if ((pEntry = getpwuid(ID))) + pszNewName = pEntry->pw_name; + else { + pszNewName = tostr(ID); + } + + // adds new node + users[ID] = pszNewName; +} + /// Group cache class definition class GroupCache { @@ -123,24 +126,27 @@ public: } private: /// - void add(gid_t ID) const { - string pszNewName; - struct group * pEntry; - - // gets user name - if ((pEntry = getgrgid(ID))) pszNewName = pEntry->gr_name; - else { - pszNewName = tostr(ID); - } - // adds new node - groups[ID] = pszNewName; - } + void add(gid_t ID) const; /// typedef map Groups; /// mutable Groups groups; }; +void GroupCache::add(gid_t ID) const +{ + string pszNewName; + struct group * pEntry; + + // gets user name + if ((pEntry = getgrgid(ID))) pszNewName = pEntry->gr_name; + else { + pszNewName = tostr(ID); + } + // adds new node + groups[ID] = pszNewName; +} + // static instances static UserCache lyxUserCache; static GroupCache lyxGroupCache; diff --git a/src/filedlg.h b/src/filedlg.h index 40415c7185..43b8660f82 100644 --- a/src/filedlg.h +++ b/src/filedlg.h @@ -22,8 +22,6 @@ #include FORMS_H_LOCATION #include "form1.h" -using std::vector; - /// LyXDirEntry internal structure definition class LyXDirEntry { @@ -81,7 +79,7 @@ private: /// string pszInfoLine; /// - typedef vector DirEntries; + typedef std::vector DirEntries; /// DirEntries direntries; /// diff --git a/src/font.C b/src/font.C new file mode 100644 index 0000000000..f8cd5c4eb7 --- /dev/null +++ b/src/font.C @@ -0,0 +1,157 @@ +#include + +#include "font.h" +#include "FontLoader.h" +#include "lyxrc.h" + +extern LyXRC lyxrc; + +// namespace { +static inline +XFontStruct * getXFontstruct(LyXFont const & f) +{ + return fontloader.load(f.family(), f.series(), + f.realShape(), f.size()); +} + + +static inline +XID getFontID(LyXFont const & f) +{ + return getXFontstruct(f)->fid; +} +// } // end of anon namespace + +int lyxfont::maxAscent(LyXFont const & f) +{ + return getXFontstruct(f)->ascent; +} + + +int lyxfont::maxDescent(LyXFont const & f) +{ + return getXFontstruct(f)->descent; +} + + +int lyxfont::ascent(char c, LyXFont const & f) +{ + XFontStruct * finfo = getXFontstruct(f); + unsigned int uc = static_cast(c); + if (finfo->per_char + && uc >= finfo->min_char_or_byte2 + && uc <= finfo->max_char_or_byte2) + return finfo->per_char[uc - finfo->min_char_or_byte2].ascent; + else + return finfo->ascent; +} + + +int lyxfont::descent(char c, LyXFont const & f) +{ + XFontStruct * finfo = getXFontstruct(f); + unsigned int uc = static_cast(c); + if (finfo->per_char + && uc >= finfo->min_char_or_byte2 + && uc <= finfo->max_char_or_byte2) + return finfo->per_char[uc - finfo->min_char_or_byte2].descent; + else + return finfo->descent; +} + + +int lyxfont::lbearing(char c, LyXFont const & f) +{ + XFontStruct * finfo = getXFontstruct(f); + unsigned int uc = static_cast(c); + if (finfo->per_char + && uc >= finfo->min_char_or_byte2 + && uc <= finfo->max_char_or_byte2) + return finfo->per_char[uc - finfo->min_char_or_byte2].lbearing; + else + return 0; +} + + +int lyxfont::rbearing(char c, LyXFont const & f) +{ + XFontStruct * finfo = getXFontstruct(f); + unsigned int uc = static_cast(c); + if (finfo->per_char + && uc >= finfo->min_char_or_byte2 + && uc <= finfo->max_char_or_byte2) + return finfo->per_char[uc - finfo->min_char_or_byte2].rbearing; + else + return width(c, f); +} + + +int lyxfont::width(char c, LyXFont const & f) +{ + if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) { + return lyxrc.use_gui ? ::XTextWidth(getXFontstruct(f), &c, 1) + : 1; + } else { + LyXFont smallfont(f); + smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE); + if (islower(static_cast(c))) { + c = toupper(c); + return ::XTextWidth(getXFontstruct(smallfont), &c, 1); + } else { + return ::XTextWidth(getXFontstruct(f), &c, 1); + } + } +} + + +int lyxfont::width(char const * s, int n, LyXFont const & f) +{ + if (!lyxrc.use_gui) + return n; + + if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) { + return ::XTextWidth(getXFontstruct(f), s, n); + } else { + // emulate smallcaps since X doesn't support this + unsigned int result = 0; + char c; + LyXFont smallfont(f); + smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE); + for (int i = 0; i < n; ++i) { + c = s[i]; + // when islower is a macro, the cast is needed (JMarc) + if (islower(static_cast(c))) { + c = toupper(c); + result += ::XTextWidth(getXFontstruct(smallfont), &c, 1); + } else { + result += ::XTextWidth(getXFontstruct(f), &c, 1); + } + } + return result; + } +} + + +int lyxfont::signedWidth(string const & s, LyXFont const & f) +{ + if (s.empty()) return 0; + if (s.c_str()[0] == '-') + return -width(s.c_str() + 1, s.length() - 1, f); + else + return width(s.c_str(), s.length(), f); +} + + +int lyxfont::XTextWidth(LyXFont const & f, char * str, int count) +{ + return ::XTextWidth(getXFontstruct(f), str, count); +} + + +void lyxfont::XSetFont(Display * display, GC gc, LyXFont const & f) +{ + ::XSetFont(display, gc, getFontID(f)); +} + +//} // end of namespace font +//} // end of namespace lyx diff --git a/src/font.h b/src/font.h new file mode 100644 index 0000000000..0a7fb27164 --- /dev/null +++ b/src/font.h @@ -0,0 +1,77 @@ +// -*- C++ -*- +#ifndef FONT_H +#define FONT_H + +#include + +#include "LString.h" + +class LyXFont; + +//namespace lyx { +//namespace font { + +struct lyxfont { + + static + int maxAscent(LyXFont const & f); + + static + int maxDescent(LyXFont const & f); + + static + int ascent(char c, LyXFont const & f); + + static + int descent(char c, LyXFont const & f); + + static + int lbearing(char c, LyXFont const & f); + + static + int rbearing(char c, LyXFont const & f); + + static + int width(char c, LyXFont const & f); + + static + int width(char const * s, int n, LyXFont const & f); + + static + int width(string const & s, LyXFont const & f) { + if (s.empty()) return 0; + return width(s.c_str(), s.length(), f); + } + + static + int width(char const * s, LyXFont const & f) { + return width(s, strlen(s), f); + } + + static + int signedWidth(string const & s, LyXFont const & f); + + static + int XTextWidth(LyXFont const & f, char * str, int count); + + static + void XSetFont(Display * display, GC gc, LyXFont const & f); +}; + +//} // end of namespace font + +// import into namespace lyx +//using font::maxAscent; +//using font::maxDescent; +//using font::ascent; +//using font::descent; +//using font::lbearing; +//using font::rbearing; +//using font::width; +//using font::signedWidth; +//using font::XTextWidth; +//using font::XSetFont; + +//} // end of namespace lyx + +#endif diff --git a/src/form1.h b/src/form1.h index 511aa55ebb..027d7cf32c 100644 --- a/src/form1.h +++ b/src/form1.h @@ -3,6 +3,8 @@ #ifndef FD_KeyMap_h_ #define FD_KeyMap_h_ +#include FORMS_H_LOCATION + /** Callbacks, globals and object handlers **/ extern "C" void GraphicsCB(FL_OBJECT *, long); diff --git a/src/insets/Makefile.am b/src/insets/Makefile.am index 8ae305968d..1480e4d383 100644 --- a/src/insets/Makefile.am +++ b/src/insets/Makefile.am @@ -44,8 +44,6 @@ libinsets_la_SOURCES = \ insetlof.h \ insetlot.C \ insetlot.h \ - insetnumber.C \ - insetnumber.h \ insetparent.C \ insetparent.h \ insetquotes.C \ diff --git a/src/insets/figinset.C b/src/insets/figinset.C index 664b08f9cf..979f144273 100644 --- a/src/insets/figinset.C +++ b/src/insets/figinset.C @@ -42,15 +42,6 @@ #include #include -using std::ofstream; -using std::ifstream; -using std::queue; -using std::list; -using std::vector; -using std::find; -using std::flush; -using std::endl; - #include "figinset.h" #include "lyx.h" #include "lyx_main.h" @@ -66,6 +57,18 @@ using std::endl; #include "support/FileInfo.h" #include "support/lyxlib.h" #include "Painter.h" +#include "font.h" + +using std::ostream; +using std::istream; +using std::ofstream; +using std::ifstream; +using std::queue; +using std::list; +using std::vector; +using std::find; +using std::flush; +using std::endl; extern BufferView * current_view; extern FL_OBJECT * figinset_canvas; @@ -1029,7 +1032,7 @@ void InsetFig::draw(Painter & pain, LyXFont const & f, font.setFamily(LyXFont::SANS_FAMILY); font.setSize(LyXFont::SIZE_FOOTNOTE); string justname = OnlyFilename (fname); - pain.text(int(x + 8), baseline - font.maxAscent() - 4, + pain.text(int(x + 8), baseline - lyxfont::maxAscent(font) - 4, justname, font); font.setSize(LyXFont::SIZE_TINY); @@ -1188,6 +1191,12 @@ bool InsetFig::Deletable() const } +char const * InsetFig::EditMessage() const +{ + return _("Opened figure"); +} + + void InsetFig::Edit(BufferView * bv, int, int, unsigned int) { lyxerr.debug() << "Editing InsetFig." << endl; diff --git a/src/insets/figinset.h b/src/insets/figinset.h index 24ab285be1..f8ee925ab6 100644 --- a/src/insets/figinset.h +++ b/src/insets/figinset.h @@ -14,8 +14,6 @@ #include "insets/lyxinset.h" /* the rest is figure stuff */ -using std::ostream; - struct Figref; /// @@ -35,20 +33,21 @@ public: void draw(Painter &, LyXFont const & font, int baseline, float & x) const; /// - void Write(ostream &) const; + void Write(std::ostream &) const; /// void Read(LyXLex & lex); /// - int Latex(ostream &, signed char fragile, bool free_space) const; + int Latex(std::ostream &, signed char fragile, bool free_space) const; /// - int Linuxdoc(ostream &) const; + int Linuxdoc(std::ostream &) const; /// - int DocBook(ostream &) const; + int DocBook(std::ostream &) const; /// Updates needed features for this inset. void Validate(LaTeXFeatures & features) const; /// what appears in the minibuffer when opening - const char * EditMessage() const { return _("Opened figure"); } + char const * EditMessage() const; + /// void Edit(BufferView *, int, int, unsigned int); /// diff --git a/src/insets/form_graphics.h b/src/insets/form_graphics.h index 808fe5098e..41438f7de9 100644 --- a/src/insets/form_graphics.h +++ b/src/insets/form_graphics.h @@ -3,6 +3,8 @@ #ifndef FORM_GRAPHICS_H #define FORM_GRAPHICS_H +#include FORMS_H_LOCATION + /** Callbacks, globals and object handlers **/ extern "C" void GraphicsCB(FL_OBJECT *, long); diff --git a/src/insets/inset.C b/src/insets/inset.C index bf30dfd85d..f2515bbbc0 100644 --- a/src/insets/inset.C +++ b/src/insets/inset.C @@ -71,6 +71,11 @@ LyXFont Inset::ConvertFont(LyXFont font) } +char const * Inset::EditMessage() const +{ + return _("Opened inset"); +} + /* some stuff for inset locking */ void UpdatableInset::InsetButtonPress(BufferView *, int x, int y, int button) diff --git a/src/insets/insetbib.C b/src/insets/insetbib.C index 6d30d257fb..fcc6924715 100644 --- a/src/insets/insetbib.C +++ b/src/insets/insetbib.C @@ -21,6 +21,7 @@ using std::ifstream; #include "lyxtext.h" #include "support/filetools.h" +using std::ostream; using std::endl; extern BufferView * current_view; diff --git a/src/insets/insetbib.h b/src/insets/insetbib.h index 69eed53afa..231ed5f546 100644 --- a/src/insets/insetbib.h +++ b/src/insets/insetbib.h @@ -18,8 +18,6 @@ #include "insetcommand.h" -using std::ostream; - class Buffer; /** Used to insert citations @@ -74,7 +72,7 @@ public: /// Inset * Clone() const { return new InsetBibKey(this); } /// Currently \bibitem is used as a LyX2.x command, so we need this method. - void Write(ostream &) const; + void Write(std::ostream &) const; /// virtual string getScreenLabel() const; /// @@ -132,7 +130,7 @@ public: /// void Edit(BufferView *, int x, int y, unsigned int button); /// - int Latex(ostream &, signed char, bool) const; + int Latex(std::ostream &, signed char, bool) const; /// string getKeys(char delim); /// diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C index 3fada648cf..7d9e7964cb 100644 --- a/src/insets/insetcommand.C +++ b/src/insets/insetcommand.C @@ -18,6 +18,7 @@ #include "debug.h" #include "Painter.h" +using std::ostream; using std::endl; diff --git a/src/insets/insetcommand.h b/src/insets/insetcommand.h index 9bb25a235e..e82b6c1129 100644 --- a/src/insets/insetcommand.h +++ b/src/insets/insetcommand.h @@ -19,8 +19,6 @@ #include "lyxinset.h" #include "LString.h" -using std::ostream; - // Created by Alejandro 970222 /** Used to insert a LaTeX command automatically * @@ -43,17 +41,18 @@ public: /// void draw(Painter &, LyXFont const &, int baseline, float & x) const; /// - void Write(ostream &) const; + void Write(std::ostream &) const; /// Parse the command. void scanCommand(string const & cmd); /// Will not be used when lyxf3 void Read(LyXLex & lex); /// - virtual int Latex(ostream &, signed char fragile, bool free_spc) const; + virtual int Latex(std::ostream &, + signed char fragile, bool free_spc) const; /// - virtual int Linuxdoc(ostream &) const; + virtual int Linuxdoc(std::ostream &) const; /// - virtual int DocBook(ostream &) const; + virtual int DocBook(std::ostream &) const; /// Inset * Clone() const; /// diff --git a/src/insets/inseterror.C b/src/insets/inseterror.C index ff1a09a306..029e7408d3 100644 --- a/src/insets/inseterror.C +++ b/src/insets/inseterror.C @@ -18,6 +18,9 @@ #include "gettext.h" #include "lyx_gui_misc.h" // CancelCloseBoxCB #include "Painter.h" +#include "font.h" + +using std::ostream; /* Error, used for the LaTeX-Error Messages */ @@ -48,7 +51,7 @@ int InsetError::ascent(Painter &, LyXFont const & font) const { LyXFont efont; efont.setSize(font.size()).decSize(); - return efont.maxAscent() + 1; + return lyxfont::maxAscent(efont) + 1; } @@ -56,7 +59,7 @@ int InsetError::descent(Painter &, LyXFont const & font) const { LyXFont efont; efont.setSize(font.size()).decSize(); - return efont.maxDescent() + 1; + return lyxfont::maxDescent(efont) + 1; } @@ -64,7 +67,7 @@ int InsetError::width(Painter &, LyXFont const & font) const { LyXFont efont; efont.setSize(font.size()).decSize(); - return 6 + efont.textWidth(_("Error"), strlen(_("Error"))); + return 6 + lyxfont::width(_("Error"), efont); } @@ -150,6 +153,12 @@ extern "C" void C_InsetError_CloseErrorCB(FL_OBJECT * ob, long data) } +char const * InsetError::EditMessage() const +{ + return _("Opened error"); +} + + void InsetError::Edit(BufferView *, int, int, unsigned int) { static int ow = 400, oh = 240; diff --git a/src/insets/inseterror.h b/src/insets/inseterror.h index 9719d6859f..f0aff0b455 100644 --- a/src/insets/inseterror.h +++ b/src/insets/inseterror.h @@ -21,8 +21,6 @@ #include "LString.h" #include "gettext.h" -using std::ostream; - /** Used for error messages from LaTeX runs. The edit-operation opens a @@ -45,19 +43,19 @@ public: /// void draw(Painter &, LyXFont const & font, int baseline, float & x) const; /// - void Write(ostream &) const; + void Write(std::ostream &) const; /// void Read(LyXLex & lex); /// - int Latex(ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, signed char fragile, bool free_spc) const; /// - int Linuxdoc(ostream &) const; + int Linuxdoc(std::ostream &) const; /// - int DocBook(ostream &) const; + int DocBook(std::ostream &) const; /// bool AutoDelete() const; /// what appears in the minibuffer when opening - const char * EditMessage() const {return _("Opened error");} + char const * EditMessage() const; /// void Edit(BufferView *, int x, int y, unsigned int button); /// diff --git a/src/insets/insetert.C b/src/insets/insetert.C index ad7cb29f46..4b95d37706 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -20,6 +20,7 @@ #include "buffer.h" //#include "lyx_gui_misc.h" +using std::ostream; InsetERT::InsetERT(Buffer * bf) : InsetCollapsable(bf) @@ -50,6 +51,13 @@ void InsetERT::Write(ostream & os) const WriteParagraphData(os); } + +char const * InsetERT::EditMessage() const +{ + return _("Opened ERT Inset"); +} + + bool InsetERT::InsertInset(BufferView *, Inset *) { return false; diff --git a/src/insets/insetert.h b/src/insets/insetert.h index 7da1ef6319..91917b24be 100644 --- a/src/insets/insetert.h +++ b/src/insets/insetert.h @@ -20,8 +20,6 @@ #include "insetcollapsable.h" -using std::ostream; - class Painter; /** A colapsable text inset @@ -38,9 +36,9 @@ public: /// Inset * Clone() const; /// - void Write(ostream &) const; + void Write(std::ostream &) const; /// - const char * EditMessage() const { return _("Opened ERT Inset");} + char const * EditMessage() const; /// bool InsertInset(BufferView *, Inset *); /// diff --git a/src/insets/insetfoot.C b/src/insets/insetfoot.C index 37a294aef8..170dc4ffd4 100644 --- a/src/insets/insetfoot.C +++ b/src/insets/insetfoot.C @@ -20,6 +20,7 @@ #include "lyxscreen.h" #include "Painter.h" +using std::ostream; InsetFoot::InsetFoot(Buffer * bf) : InsetCollapsable(bf) diff --git a/src/insets/insetfoot.h b/src/insets/insetfoot.h index fa8b653334..c3a8a7a721 100644 --- a/src/insets/insetfoot.h +++ b/src/insets/insetfoot.h @@ -20,8 +20,6 @@ #include "insetcollapsable.h" -using std::ostream; - class Painter; /** The footnote inset @@ -38,9 +36,9 @@ public: /// Inset::Code LyxCode() const { return Inset::FOOT_CODE; } /// - int Latex(ostream &, signed char, bool fp) const; + int Latex(std::ostream &, signed char, bool fp) const; /// - void Write(ostream &) const; + void Write(std::ostream &) const; /// void Read(LyXLex &); /// diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 035142babc..4196586801 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -22,6 +22,7 @@ #include "support/FileInfo.h" #include "support/filetools.h" +using std::ostream; using std::endl; extern string system_lyxdir; @@ -204,7 +205,7 @@ int InsetGraphics::Latex(ostream & os, string command("\\insetgraphics"); #ifdef HAVE_SSTREAM - ostringstream options; + std::ostringstream options; #else ostrstream options; #endif diff --git a/src/insets/insetgraphics.h b/src/insets/insetgraphics.h index 31d4ee6103..daf926c079 100644 --- a/src/insets/insetgraphics.h +++ b/src/insets/insetgraphics.h @@ -21,8 +21,6 @@ #include "vspace.h" #include "insets/BoundingBox.h" -using std::ostream; - struct FD_Graphics; /// @@ -44,18 +42,18 @@ public: /// EDITABLE Editable() const; /// - void Write(ostream &) const; + void Write(std::ostream &) const; /// void Read(LyXLex & lex); /** returns the number of rows (\n's) of generated tex code. fragile != 0 means, that the inset should take care about fragile commands by adding a \protect before. */ - int Latex(ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, signed char fragile, bool free_spc) const; /// - int Linuxdoc(ostream &) const; + int Linuxdoc(std::ostream &) const; /// - int DocBook(ostream &) const; + int DocBook(std::ostream &) const; /// Updates needed features for this inset. void Validate(LaTeXFeatures & features) const; diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index eed1888a8f..28e04889dc 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -23,6 +23,7 @@ #include "layout.h" #include "lyxfunc.h" +using std::ostream; using std::endl; extern BufferView * current_view; @@ -283,6 +284,12 @@ void InsetInclude::Read(LyXLex & lex) } +bool InsetInclude::display() const +{ + return !isInput(); +} + + string InsetInclude::getScreenLabel() const { string temp; @@ -303,6 +310,14 @@ string InsetInclude::getScreenLabel() const } +void InsetInclude::setContents(string const & c) +{ + InsetCommand::setContents(c); + filename = MakeAbsPath(contents, + OnlyPath(getMasterFilename())); +} + + bool InsetInclude::loadIfNeeded() const { if (isNoLoad() || isVerb()) return false; diff --git a/src/insets/insetinclude.h b/src/insets/insetinclude.h index ec01892a4c..dbe65f6f7d 100644 --- a/src/insets/insetinclude.h +++ b/src/insets/insetinclude.h @@ -19,8 +19,6 @@ #include "buffer.h" #include "support/filetools.h" -using std::ostream; - struct LaTeXFeatures; // Created by AAS 970521 @@ -56,24 +54,20 @@ public: return IS_EDITABLE; } /// With lyx3 we won't overload these 3 methods - void Write(ostream &) const; + void Write(std::ostream &) const; /// void Read(LyXLex &); /// - int Latex(ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, signed char fragile, bool free_spc) const; /// void Validate(LaTeXFeatures &) const; /// Input inserts anything inside a paragraph, Display can give some visual feedback - bool display() const { return !(isInput()); } + bool display() const; /// string getScreenLabel() const; /// - void setContents(string const & c) { - InsetCommand::setContents(c); - filename = MakeAbsPath(contents, - OnlyPath(getMasterFilename())); - } + void setContents(string const & c); /// void setFilename(string const & n) { setContents(n); } /// diff --git a/src/insets/insetinfo.C b/src/insets/insetinfo.C index 6d9c9ea9b1..2a03b97462 100644 --- a/src/insets/insetinfo.C +++ b/src/insets/insetinfo.C @@ -24,7 +24,9 @@ #include "buffer.h" #include "support/lstrings.h" #include "Painter.h" +#include "font.h" +using std::ostream; using std::endl; /* Info, used for the Info boxes */ @@ -57,19 +59,19 @@ InsetInfo::~InsetInfo() int InsetInfo::ascent(Painter &, LyXFont const & font) const { - return font.maxAscent() + 1; + return lyxfont::maxAscent(font) + 1; } int InsetInfo::descent(Painter &, LyXFont const & font) const { - return font.maxDescent() + 1; + return lyxfont::maxDescent(font) + 1; } int InsetInfo::width(Painter &, LyXFont const & font) const { - return 6 + font.textWidth(_("Note"), strlen(_("Note"))); + return 6 + lyxfont::width(_("Note"), font); } @@ -177,6 +179,12 @@ extern "C" void C_InsetInfo_CloseInfoCB(FL_OBJECT * ob, long data) } +char const * InsetInfo::EditMessage() const +{ + return _("Opened note"); +} + + void InsetInfo::Edit(BufferView *bv, int, int, unsigned int) { static int ow = -1, oh; diff --git a/src/insets/insetinfo.h b/src/insets/insetinfo.h index 2aefc000f7..5e7dfd1de6 100644 --- a/src/insets/insetinfo.h +++ b/src/insets/insetinfo.h @@ -20,8 +20,6 @@ #include FORMS_H_LOCATION #include "LString.h" -using std::ostream; - /** Info. Handles the note insets. This class handles the note insets. The edit operation bringes up @@ -47,17 +45,17 @@ public: /// void draw(Painter &, LyXFont const &, int baseline, float & x) const; /// - void Write(ostream &) const; + void Write(std::ostream &) const; /// void Read(LyXLex & lex); /// - int Latex(ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, signed char fragile, bool free_spc) const; /// - int Linuxdoc(ostream &) const; + int Linuxdoc(std::ostream &) const; /// - int DocBook(ostream &) const; + int DocBook(std::ostream &) const; /// what appears in the minibuffer when opening - const char * EditMessage() const {return _("Opened note");} + char const * EditMessage() const; /// void Edit(BufferView *, int, int, unsigned int); /// diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C index b056de2acc..4415de2a08 100644 --- a/src/insets/insetlabel.C +++ b/src/insets/insetlabel.C @@ -16,6 +16,8 @@ #include "insetlabel.h" +using std::ostream; + /* Label. Used to insert a label automatically */ diff --git a/src/insets/insetlabel.h b/src/insets/insetlabel.h index 92c8b43003..64db3ee664 100644 --- a/src/insets/insetlabel.h +++ b/src/insets/insetlabel.h @@ -19,8 +19,6 @@ #include "insetcommand.h" #include "LString.h" -using std::ostream; - /// class InsetLabel : public InsetCommand { public: @@ -41,11 +39,11 @@ public: /// EDITABLE Editable() const { return NOT_EDITABLE; } /// - int Latex(ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, signed char fragile, bool free_spc) const; /// - int Linuxdoc(ostream &) const; + int Linuxdoc(std::ostream &) const; /// - int DocBook(ostream &) const; + int DocBook(std::ostream &) const; private: /// This function escapes 8-bit characters string escape(string const &) const; diff --git a/src/insets/insetlatexaccent.C b/src/insets/insetlatexaccent.C index 1db7eb8ce4..cf0ef61651 100644 --- a/src/insets/insetlatexaccent.C +++ b/src/insets/insetlatexaccent.C @@ -19,7 +19,9 @@ #include "lyxrc.h" #include "support/lstrings.h" #include "Painter.h" +#include "font.h" +using std::ostream; using std::endl; /* LatexAccent. Proper handling of accented characters */ @@ -261,13 +263,13 @@ int InsetLatexAccent::ascent(Painter &, LyXFont const & font) const int max; if (candisp) { if (ic == ' ') - max = font.ascent('a'); + max = lyxfont::ascent('a', font); else - max = font.ascent(ic); + max = lyxfont::ascent(ic, font); if (plusasc) - max += (font.maxAscent() + 3) / 3; + max += (lyxfont::maxAscent(font) + 3) / 3; } else - max = font.maxAscent() + 4; + max = lyxfont::maxAscent(font) + 4; return max; } @@ -277,13 +279,13 @@ int InsetLatexAccent::descent(Painter &, LyXFont const & font) const int max; if (candisp) { if (ic == ' ') - max = font.descent('a'); + max = lyxfont::descent('a', font); else - max = font.descent(ic); + max = lyxfont::descent(ic, font); if (plusdesc) max += 3; } else - max = font.maxDescent() + 4; + max = lyxfont::maxDescent(font) + 4; return max; } @@ -291,21 +293,21 @@ int InsetLatexAccent::descent(Painter &, LyXFont const & font) const int InsetLatexAccent::width(Painter &, LyXFont const & font) const { if (candisp) - return font.textWidth(&ic, 1); + return lyxfont::width(ic, font); else - return font.stringWidth(contents) + 4; + return lyxfont::width(contents, font) + 4; } int InsetLatexAccent::Lbearing(LyXFont const & font) const { - return font.lbearing(ic); + return lyxfont::lbearing(ic, font); } int InsetLatexAccent::Rbearing(LyXFont const & font) const { - return font.rbearing(ic); + return lyxfont::rbearing(ic, font); } @@ -373,7 +375,7 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font, int y; if (plusasc) { // mark at the top - hg = font.maxDescent(); + hg = lyxfont::maxDescent(font); y = baseline - asc; if (font.shape() == LyXFont::ITALIC_SHAPE) @@ -391,15 +393,15 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font, pain.text(int(x), baseline, ic, font); if (remdot) { - int tmpvar = baseline - font.ascent('i'); + int tmpvar = baseline - lyxfont::ascent('i', font); float tmpx = 0; if (font.shape() == LyXFont::ITALIC_SHAPE) tmpx += (8.0 * hg) / 10.0; // italic lyxerr[Debug::KEY] << "Removing dot." << endl; // remove the dot first pain.fillRectangle(int(x + tmpx), tmpvar, wid, - font.ascent('i') - - font.ascent('x') - 1, + lyxfont::ascent('i', font) - + lyxfont::ascent('x', font) - 1, LColor::background); // the five lines below is a simple hack to // make the display of accent 'i' and 'j' @@ -419,8 +421,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font, pain.line(int(x2), int(y + hg), int(x2 + hg35), y + hg35); #else - pain.text(x2 - (font.rbearing(0xB4) - font.lbearing(0xB4)) / 2, - baseline - font.ascent(ic) - font.descent(0xB4) - (font.ascent(0xB4) + font.descent(0xB4)) / 2, + pain.text(x2 - (lyxfont::rbearing(0xB4, font) - lyxfont::lbearing(0xB4, font)) / 2, + baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0xB4, font) - (lyxfont::ascent(0xB4, font) + lyxfont::descent(0xB4, font)) / 2, char(0xB4), font); #endif break; @@ -431,8 +433,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font, pain.line(int(x2), int(y + hg), int(x2 - hg35), y + hg35); #else - pain.text(x2 - (font.rbearing(0x60) - font.lbearing(0x60)) / 2, - baseline - font.ascent(ic) - font.descent(0x60) - (font.ascent(0x60) + font.descent(0x60)) / 2.0, + pain.text(x2 - (lyxfont::rbearing(0x60, font) - lyxfont::lbearing(0x60, font)) / 2, + baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0x60, font) - (lyxfont::ascent(0x60, font) + lyxfont::descent(0x60, font)) / 2.0, char(0x60), font); #endif break; @@ -445,8 +447,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font, int(x2 + wid * 0.4), int(y + hg)); #else - pain.text(x2 - (font.rbearing(0xAF) - font.lbearing(0xAF)) / 2, - baseline - font.ascent(ic) - font.descent(0xAF) - (font.ascent(0xAF) + font.descent(0xAF)), + pain.text(x2 - (lyxfont::rbearing(0xAF, font) - lyxfont::lbearing(0xAF, font)) / 2, + baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0xAF, font) - (lyxfont::ascent(0xAF, font) + lyxfont::descent(0xAF, font)), char(0xAF), font); #endif break; @@ -472,8 +474,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font, pain.lines(xp, yp, 4); #else - pain.text(x2 - (font.rbearing('~') - font.lbearing('~')) / 2, - baseline - font.ascent(ic) - font.descent('~') - (font.ascent('~') + font.descent('~')) / 2, + pain.text(x2 - (lyxfont::rbearing('~', font) - lyxfont::lbearing('~', font)) / 2, + baseline - lyxfont::ascent(ic, font) - lyxfont::descent('~', font) - (lyxfont::ascent('~', font) + lyxfont::descent('~', font)) / 2, '~', font); #endif break; @@ -486,7 +488,7 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font, int(x2 + wid * 0.4), y + hg / 2.0); #else - pain.text(x2 - (font.rbearing(0x5F) - font.lbearing(0x5F)) / 2, baseline, + pain.text(x2 - (lyxfont::rbearing(0x5F, font) - lyxfont::lbearing(0x5F, font)) / 2, baseline, char(0x5F), font); #endif break; @@ -510,7 +512,7 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font, pain.lines(xp, yp, 4); #else - pain.text(x2 - (font.rbearing(0xB8) - font.lbearing(0xB8)) / 2, baseline, + pain.text(x2 - (lyxfont::rbearing(0xB8, font) - lyxfont::lbearing(0xB8, font)) / 2, baseline, char(0xB8), font); #endif @@ -522,8 +524,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font, pain.arc(int(x2), y + hg35, 3, 3, 0, 360 * 64); #else - pain.text(x2 - (font.rbearing('.') - font.lbearing('.')) / 2.0, - baseline + 3.0 / 2.0 * (font.ascent('.') + font.descent('.')), + pain.text(x2 - (lyxfont::rbearing('.', font) - lyxfont::lbearing('.', font)) / 2.0, + baseline + 3.0 / 2.0 * (lyxfont::ascent('.', font) + lyxfont::descent('.', font)), '.', font); #endif break; @@ -537,8 +539,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font, (hg + 3.0)/5.0, 0, 360 * 64); #else - pain.text(x2 - (font.rbearing('.') - font.lbearing('.')) / 2.0, - baseline - font.ascent(ic) - font.descent('.') - (font.ascent('.') + font.descent('.')) / 2, + pain.text(x2 - (lyxfont::rbearing('.', font) - lyxfont::lbearing('.', font)) / 2.0, + baseline - lyxfont::ascent(ic, font) - lyxfont::descent('.', font) - (lyxfont::ascent('.', font) + lyxfont::descent('.', font)) / 2, '.', font); #endif break; @@ -553,8 +555,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font, #else LyXFont tmpf(font); tmpf.decSize().decSize(); - pain.text(x2 - (tmpf.rbearing(0xB0) - tmpf.lbearing(0xB0)) / 2.0, - baseline - font.ascent(ic) - tmpf.descent(0xB0) - (tmpf.ascent(0xB0) + tmpf.descent(0xB0)) / 3.0, + pain.text(x2 - (lyxfont::rbearing(0xB0, tmpf) - lyxfont::lbearing(0xB0, tmpf)) / 2.0, + baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0xB0, tmpf) - (lyxfont::ascent(0xB0, tmpf) + lyxfont::descent(0xB0, tmpf)) / 3.0, char(0xB0), tmpf); #endif break; @@ -619,11 +621,11 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font, pain.segments(xs1, ys1, xs2, ys2, 2); #else - pain.text(x2 - (font.rbearing('´') - font.lbearing('´')), - baseline - font.ascent(ic) - font.descent('´') - (font.ascent('´') + font.descent('´')) / 2, + pain.text(x2 - (lyxfont::rbearing('´', font) - lyxfont::lbearing('´', font)), + baseline - lyxfont::ascent(ic, font) - lyxfont::descent('´', font) - (lyxfont::ascent('´', font) + lyxfont::descent('´', font)) / 2, '´', font); pain.text(x2, - baseline - font.ascent(ic) - font.descent('´') - (font.ascent('´') + font.descent('´')) / 2, + baseline - lyxfont::ascent(ic, font) - lyxfont::descent('´', font) - (lyxfont::ascent('´', font) + lyxfont::descent('´', font)) / 2, '´', font); #endif break; @@ -650,8 +652,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font, rad, rad, 0, 360*64); } #else - pain.text(x2 - (font.rbearing('¨') - font.lbearing('¨')) / 2, - baseline - font.ascent(ic) - font.descent('¨') - ( font.ascent('¨') + font.descent('¨')) / 2, + pain.text(x2 - (lyxfont::rbearing('¨', font) - lyxfont::lbearing('¨', font)) / 2, + baseline - lyxfont::ascent(ic, font) - lyxfont::descent('¨', font) - ( lyxfont::ascent('¨', font) + lyxfont::descent('¨', font)) / 2, '¨', font); #endif break; @@ -668,8 +670,8 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font, #else LyXFont tmpf(font); tmpf.decSize().decSize().decSize(); - pain.text(x2 - (tmpf.rbearing(0x5E) - tmpf.lbearing(0x5E)) / 2, - baseline - font.ascent(ic) - tmpf.descent(0x5E) - (tmpf.ascent(0x5E) + tmpf.descent(0x5E)) / 3.0, + pain.text(x2 - (lyxfont::rbearing(0x5E, tmpf) - lyxfont::lbearing(0x5E, tmpf)) / 2, + baseline - lyxfont::ascent(ic, font) - lyxfont::descent(0x5E, tmpf) - (lyxfont::ascent(0x5E, tmpf) + lyxfont::descent(0x5E, tmpf)) / 3.0, char(0x5E), tmpf); #endif break; diff --git a/src/insets/insetlatexaccent.h b/src/insets/insetlatexaccent.h index 3a80b51f5e..edfc2e95bb 100644 --- a/src/insets/insetlatexaccent.h +++ b/src/insets/insetlatexaccent.h @@ -19,8 +19,6 @@ #include "LString.h" #include "lyxlex.h" -using std::ostream; - /** Insertion of accents Proper handling of accented characters. @@ -51,15 +49,15 @@ public: bool DisplayISO8859_9(Painter &, LyXFont const & font, int baseline, float & x) const; /// - void Write(ostream &) const; + void Write(std::ostream &) const; /// void Read(LyXLex & lex); /// - int Latex(ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, signed char fragile, bool free_spc) const; /// - int Linuxdoc(ostream &) const; + int Linuxdoc(std::ostream &) const; /// - int DocBook(ostream &) const; + int DocBook(std::ostream &) const; /// bool Deletable() const; /// @@ -116,7 +114,7 @@ public: LSLASH }; private: - friend ostream & operator<<(ostream &, ACCENT_TYPES); + friend std::ostream & operator<<(std::ostream &, ACCENT_TYPES); /// Check if we know the modifier and can display it ok on screen. void checkContents(); /// diff --git a/src/insets/insetloa.C b/src/insets/insetloa.C index 86c7c501a5..d11997c873 100644 --- a/src/insets/insetloa.C +++ b/src/insets/insetloa.C @@ -14,17 +14,19 @@ #include #ifdef __GNUG__ -#pragma implementation "insetloa.h" -#pragma implementation "insetlof.h" -#pragma implementation "insetlot.h" +#pragma implementation #endif #include "insetloa.h" -#include "insetlof.h" -#include "insetlot.h" #include "LaTeXFeatures.h" void InsetLOA::Validate(LaTeXFeatures & features) const { features.algorithm = true; } + + +string InsetLOA::getScreenLabel() const +{ + return _("List of Algorithms"); +} diff --git a/src/insets/insetloa.h b/src/insets/insetloa.h index 1341d0b860..fe1313da98 100644 --- a/src/insets/insetloa.h +++ b/src/insets/insetloa.h @@ -34,7 +34,7 @@ public: /// Inset * Clone() const { return new InsetLOA(owner); } /// - string getScreenLabel() const { return _("List of Algorithms"); } + string getScreenLabel() const; /// EDITABLE Editable() const { diff --git a/src/insets/insetlof.C b/src/insets/insetlof.C index 40945efb3d..36b488d339 100644 --- a/src/insets/insetlof.C +++ b/src/insets/insetlof.C @@ -1,16 +1,13 @@ -//#include +#include -//#ifdef __GNUG__ -//#pragma implementation -//#endif +#ifdef __GNUG__ +#pragma implementation +#endif -//#include "insettof.h" - -// InsetLOF::InsetLOF(): -// InsetCommand("listoffigures") -// { - -// } - +#include "insetlof.h" +string InsetLOF::getScreenLabel() const +{ + return _("List of Figures"); +} diff --git a/src/insets/insetlof.h b/src/insets/insetlof.h index 3259c16d85..a9ff6136bb 100644 --- a/src/insets/insetlof.h +++ b/src/insets/insetlof.h @@ -12,15 +12,15 @@ #ifndef INSET_LOF_H #define INSET_LOF_H -#ifdef __GNUG__ -#pragma interface -#endif - #include "insetcommand.h" #include "gettext.h" // Created by Lgb 970527 +#ifdef __GNUG__ +#pragma interface +#endif + /** Used to insert table of contents */ class InsetLOF : public InsetCommand { @@ -32,7 +32,7 @@ public: /// Inset * Clone() const { return new InsetLOF(owner); } /// - string getScreenLabel() const { return _("List of Figures"); } + string getScreenLabel() const; /// EDITABLE Editable() const { diff --git a/src/insets/insetlot.C b/src/insets/insetlot.C index de5846a3f2..61d179311a 100644 --- a/src/insets/insetlot.C +++ b/src/insets/insetlot.C @@ -1,16 +1,14 @@ -//#include +#include -//#ifdef __GNUG__ -//#pragma implementation -//#endif +#ifdef __GNUG__ +#pragma implementation +#endif -//#include "insetlot.h" - -// InsetLOT::InsetLOT() -// : InsetCommand("listoftables") -// { - -// } +#include "insetlot.h" +string InsetLOT::getScreenLabel() const +{ + return _("List of Tables"); +} diff --git a/src/insets/insetlot.h b/src/insets/insetlot.h index 4fffb7ba4d..1d6e3d96fa 100644 --- a/src/insets/insetlot.h +++ b/src/insets/insetlot.h @@ -32,7 +32,7 @@ public: /// Inset * Clone() const { return new InsetLOT(owner); } /// - string getScreenLabel() const { return _("List of Tables"); } + string getScreenLabel() const; /// EDITABLE Editable() const { diff --git a/src/insets/insetparent.C b/src/insets/insetparent.C index 6b114e2d90..8d9a274c3e 100644 --- a/src/insets/insetparent.C +++ b/src/insets/insetparent.C @@ -24,6 +24,7 @@ #include "lyxfunc.h" #include "commandtags.h" +using std::ostream; InsetParent::InsetParent(string const & fn, Buffer * owner) : InsetCommand("lyxparent") @@ -35,6 +36,12 @@ InsetParent::InsetParent(string const & fn, Buffer * owner) } +string InsetParent::getScreenLabel() const +{ + return string(_("Parent:")) + getContents(); +} + + void InsetParent::Edit(BufferView * bv, int, int, unsigned int) { bv->owner()->getLyXFunc()-> diff --git a/src/insets/insetparent.h b/src/insets/insetparent.h index 15e389e3e4..23e15669e9 100644 --- a/src/insets/insetparent.h +++ b/src/insets/insetparent.h @@ -18,8 +18,6 @@ #include "insetcommand.h" #include "gettext.h" -using std::ostream; - class Buffer; /** Reference to the parent document. @@ -34,13 +32,11 @@ public: /// InsetParent(string const & fn, Buffer * owner = 0); /// - int Latex(ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, signed char fragile, bool free_spc) const; /// Inset * Clone() const { return new InsetParent(getContents()); } /// - string getScreenLabel() const { - return string(_("Parent:")) + getContents(); - } + string getScreenLabel() const; /// void Edit(BufferView *, int, int, unsigned int); /// diff --git a/src/insets/insetquotes.C b/src/insets/insetquotes.C index 364524f655..940333d9b7 100644 --- a/src/insets/insetquotes.C +++ b/src/insets/insetquotes.C @@ -23,7 +23,9 @@ #include "LaTeXFeatures.h" #include "support/lstrings.h" #include "Painter.h" +#include "font.h" +using std::ostream; using std::endl; // Quotes. Used for the various quotes. German, English, French, @@ -163,13 +165,13 @@ string InsetQuotes::DispString() const int InsetQuotes::ascent(Painter &, LyXFont const & font) const { - return font.maxAscent(); + return lyxfont::maxAscent(font); } int InsetQuotes::descent(Painter &, LyXFont const & font) const { - return font.maxDescent(); + return lyxfont::maxDescent(font); } @@ -180,11 +182,11 @@ int InsetQuotes::width(Painter &, LyXFont const & font) const for (string::size_type i = 0; i < text.length(); ++i) { if (text[i] == ' ') - w += font.width('i'); + w += lyxfont::width('i', font); else if (i == 0 || text[i] != text[i-1]) - w += font.width(text[i]); + w += lyxfont::width(text[i], font); else - w += font.width(','); + w += lyxfont::width(',', font); } return w; diff --git a/src/insets/insetquotes.h b/src/insets/insetquotes.h index 0d01c22baa..c3c27159aa 100644 --- a/src/insets/insetquotes.h +++ b/src/insets/insetquotes.h @@ -18,8 +18,6 @@ #include "lyxinset.h" -using std::ostream; - class BufferParams; struct LaTeXFeatures; @@ -83,15 +81,15 @@ public: /// LyXFont ConvertFont(LyXFont font); /// - void Write(ostream &) const; + void Write(std::ostream &) const; /// void Read(LyXLex & lex); /// - int Latex(ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, signed char fragile, bool free_spc) const; /// - int Linuxdoc(ostream &) const; + int Linuxdoc(std::ostream &) const; /// - int DocBook(ostream &) const; + int DocBook(std::ostream &) const; /// void Validate(LaTeXFeatures &) const; /// diff --git a/src/insets/insetref.C b/src/insets/insetref.C index 3e5256adc6..a45c6f7431 100644 --- a/src/insets/insetref.C +++ b/src/insets/insetref.C @@ -16,6 +16,8 @@ #include "commandtags.h" #include "gettext.h" +using std::ostream; + extern BufferView * current_view; diff --git a/src/insets/insetref.h b/src/insets/insetref.h index e7353bc121..aa0f3dda8d 100644 --- a/src/insets/insetref.h +++ b/src/insets/insetref.h @@ -18,8 +18,6 @@ #include "insetcommand.h" #include "buffer.h" -using std::ostream; - struct LaTeXFeatures; /** The reference inset @@ -63,11 +61,11 @@ public: /// void gotoLabel(); /// - int Latex(ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, signed char fragile, bool free_spc) const; /// - int Linuxdoc(ostream &) const; + int Linuxdoc(std::ostream &) const; /// - int DocBook(ostream &) const; + int DocBook(std::ostream &) const; private: /// This function escapes 8-bit characters string escape(string const &) const; diff --git a/src/insets/insetspecialchar.C b/src/insets/insetspecialchar.C index 2b3d4bd728..d0fd3296e9 100644 --- a/src/insets/insetspecialchar.C +++ b/src/insets/insetspecialchar.C @@ -17,7 +17,9 @@ #include "debug.h" #include "LaTeXFeatures.h" #include "Painter.h" +#include "font.h" +using std::ostream; using std::max; InsetSpecialChar::InsetSpecialChar(Kind k) @@ -27,13 +29,13 @@ InsetSpecialChar::InsetSpecialChar(Kind k) int InsetSpecialChar::ascent(Painter &, LyXFont const & font) const { - return font.maxAscent(); + return lyxfont::maxAscent(font); } int InsetSpecialChar::descent(Painter &, LyXFont const & font) const { - return font.maxDescent(); + return lyxfont::maxDescent(font); } @@ -42,22 +44,22 @@ int InsetSpecialChar::width(Painter &, LyXFont const & font) const switch (kind) { case HYPHENATION: { - int w = font.textWidth("-", 1); + int w = lyxfont::width('-', font); if (w > 5) w -= 2; // to make it look shorter return w; } case END_OF_SENTENCE: { - return font.textWidth(".", 1); + return lyxfont::width('.', font); } case LDOTS: { - return font.textWidth(". . .", 5); + return lyxfont::width(". . .", font); } case MENU_SEPARATOR: { - return font.textWidth(" x ", 3); + return lyxfont::width(" x ", font); } #if 0 case NEWLINE: @@ -66,7 +68,7 @@ int InsetSpecialChar::width(Painter &, LyXFont const & font) const #endif case PROTECTED_SEPARATOR: { - return font.textWidth("x", 1); + return lyxfont::width('x', font); } } @@ -103,9 +105,9 @@ void InsetSpecialChar::draw(Painter & pain, LyXFont const & f, case MENU_SEPARATOR: { // A triangle the width and height of an 'x' - int w = font.textWidth("x", 1); - int ox = font.textWidth(" ", 1) + int(x); - int h = font.ascent('x'); + int w = lyxfont::width('x', font); + int ox = lyxfont::width(' ', font) + int(x); + int h = lyxfont::ascent('x', font); int xp[4], yp[4]; xp[0] = ox; yp[0] = baseline; @@ -125,7 +127,7 @@ void InsetSpecialChar::draw(Painter & pain, LyXFont const & f, case PROTECTED_SEPARATOR: { float w = width(pain, font); - int h = font.ascent('x'); + int h = lyxfont::ascent('x', font); int xp[4], yp[4]; xp[0] = int(x); diff --git a/src/insets/insetspecialchar.h b/src/insets/insetspecialchar.h index f728f25fb2..e75fcd7107 100644 --- a/src/insets/insetspecialchar.h +++ b/src/insets/insetspecialchar.h @@ -18,8 +18,6 @@ #include "lyxinset.h" #include "LString.h" -using std::ostream; - struct LaTeXFeatures; /// Used to insert special chars @@ -57,15 +55,15 @@ public: /// void draw(Painter &, LyXFont const &, int baseline, float & x) const; /// - void Write(ostream &) const; + void Write(std::ostream &) const; /// Will not be used when lyxf3 void Read(LyXLex & lex); /// - int Latex(ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, signed char fragile, bool free_spc) const; /// - int Linuxdoc(ostream &) const; + int Linuxdoc(std::ostream &) const; /// - int DocBook(ostream &) const; + int DocBook(std::ostream &) const; /// Inset * Clone() const; /// diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 73048d08a8..70f180d387 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -13,9 +13,6 @@ #include #include -using std::ifstream; -using std::min; -using std::max; #include @@ -54,6 +51,12 @@ using std::max; #include "support/LAssert.h" #include "lyxtext.h" #include "lyxcursor.h" +#include "font.h" + +using std::ostream; +using std::ifstream; +using std::min; +using std::max; extern unsigned char getCurrentTextClass(Buffer *); @@ -164,7 +167,7 @@ int InsetText::ascent(Painter & pain, LyXFont const & font) const } if (maxAscent) return maxAscent; - return font.maxAscent(); + return lyxfont::maxAscent(font); } @@ -176,7 +179,7 @@ int InsetText::descent(Painter & pain, LyXFont const & font) const } if (maxDescent) return maxDescent; - return font.maxDescent(); + return lyxfont::maxDescent(font); } @@ -243,7 +246,7 @@ void InsetText::drawRowSelection(Painter & pain, int startpos, int endpos, Inset const * tmpinset = par->GetInset(p); x += tmpinset->width(pain, font); } else { - x += pain.width(ch,font); + x += lyxfont::width(ch, font); } } if (p == s_start) @@ -271,8 +274,8 @@ void InsetText::drawRowText(Painter & pain, int startpos, int endpos, // skip for now } else if (par->IsNewline(p)) { // Draw end-of-line marker - int wid = font.width('n'); - int asc = font.maxAscent(); + int wid = lyxfont::width('n', font); + int asc = lyxfont::maxAscent(font); int y = baseline; int xp[3], yp[3]; @@ -304,7 +307,7 @@ void InsetText::drawRowText(Painter & pain, int startpos, int endpos, tmpinset->draw(pain, font, baseline, x); } else { pain.text(int(x), baseline, ch, font); - x += pain.width(ch,font); + x += lyxfont::width(ch, font); } } } @@ -705,7 +708,7 @@ int InsetText::SingleWidth(Painter & pain, LyXParagraph * par, int pos) const char c = par->GetChar(pos); if (IsPrintable(c)) { - return font.width(c); + return lyxfont::width(c, font); } else if (c == LyXParagraph::META_INSET) { Inset const * tmpinset = par->GetInset(pos); if (tmpinset) @@ -716,7 +719,7 @@ int InsetText::SingleWidth(Painter & pain, LyXParagraph * par, int pos) const c = ' '; else if (IsNewlineChar(c)) c = 'n'; - return font.width(c); + return lyxfont::width(c, font); } @@ -735,8 +738,8 @@ void InsetText::SingleHeight(Painter & pain, LyXParagraph * par,int pos, desc = tmpinset->descent(pain, font); } } else { - asc = font.maxAscent(); - desc = font.maxDescent(); + asc = lyxfont::maxAscent(font); + desc = lyxfont::maxDescent(font); } return; } @@ -851,8 +854,8 @@ void InsetText::ToggleInsetCursor(BufferView * bv) LyXFont font = GetFont(par, actpos); - int asc = font.maxAscent(); - int desc = font.maxDescent(); + int asc = lyxfont::maxAscent(font); + int desc = lyxfont::maxDescent(font); if (cursor_visible) bv->hideLockedInsetCursor(); @@ -867,8 +870,8 @@ void InsetText::ShowInsetCursor(BufferView * bv) if (!cursor_visible) { LyXFont font = GetFont(par, actpos); - int asc = font.maxAscent(); - int desc = font.maxDescent(); + int asc = lyxfont::maxAscent(font); + int desc = lyxfont::maxDescent(font); bv->fitLockedInsetCursor(cx, cy, asc, desc); bv->showLockedInsetCursor(cx, cy, asc, desc); cursor_visible = true; diff --git a/src/insets/insettext.h b/src/insets/insettext.h index 85067aab78..0dd6361172 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -23,9 +23,6 @@ #include "LString.h" //#include "buffer.h" -using std::ostream; -using std::vector; - class Painter; class BufferView; class Buffer; @@ -50,7 +47,7 @@ public: /// void Read(LyXLex &); /// - void Write(ostream &) const; + void Write(std::ostream &) const; /// int ascent(Painter &, LyXFont const &) const; /// @@ -80,11 +77,11 @@ public: /// UpdatableInset::RESULT LocalDispatch(BufferView *, int, string const &); /// - int Latex(ostream &, signed char, bool free_spc) const; + int Latex(std::ostream &, signed char, bool free_spc) const; /// - int Linuxdoc(ostream &) const { return 0; } + int Linuxdoc(std::ostream &) const { return 0; } /// - int DocBook(ostream &) const { return 0; } + int DocBook(std::ostream &) const { return 0; } /// void Validate(LaTeXFeatures & features) const; /// @@ -110,7 +107,7 @@ protected: /// void UpdateLocal(BufferView *, bool); /// - void WriteParagraphData(ostream &) const; + void WriteParagraphData(std::ostream &) const; /// void resetPos(BufferView *); /// @@ -219,7 +216,7 @@ private: int baseline; }; /// - typedef vector RowList; + typedef std::vector RowList; /// mutable RowList rows; InsetText & operator = (InsetText const & it) { diff --git a/src/insets/insettoc.C b/src/insets/insettoc.C index 2a04a0c03b..88a46f1ea5 100644 --- a/src/insets/insettoc.C +++ b/src/insets/insettoc.C @@ -12,6 +12,15 @@ #include "LyXView.h" #include "BufferView.h" +using std::ostream; + + +string InsetTOC::getScreenLabel() const +{ + return _("Table of Contents"); +} + + void InsetTOC::Edit(BufferView * bv, int, int, unsigned int) { bv->owner()->getLyXFunc()->Dispatch(LFUN_TOCVIEW); diff --git a/src/insets/insettoc.h b/src/insets/insettoc.h index 0c850e0064..fb370c2350 100644 --- a/src/insets/insettoc.h +++ b/src/insets/insettoc.h @@ -19,8 +19,6 @@ #include "insetcommand.h" #include "gettext.h" -using std::ostream; - class Buffer; /** Used to insert table of contents @@ -34,7 +32,7 @@ public: /// Inset * Clone() const { return new InsetTOC(owner); } /// - string getScreenLabel() const { return _("Table of Contents"); } + string getScreenLabel() const; /// On edit, we open the TOC pop-up void Edit(BufferView * bv, int, int, unsigned int); /// @@ -46,9 +44,9 @@ public: /// Inset::Code LyxCode() const { return Inset::TOC_CODE; } /// - int Linuxdoc(ostream &) const; + int Linuxdoc(std::ostream &) const; /// - int DocBook(ostream &) const; + int DocBook(std::ostream &) const; private: /// Buffer * owner; diff --git a/src/insets/inseturl.C b/src/insets/inseturl.C index ec571cce0f..8a99bce763 100644 --- a/src/insets/inseturl.C +++ b/src/insets/inseturl.C @@ -14,6 +14,7 @@ #include "LaTeXFeatures.h" #include "lyx_gui_misc.h" // CancelCloseBoxCB +using std::ostream; InsetUrl::InsetUrl(string const & cmd) : fd_form_url(0) @@ -109,6 +110,12 @@ extern "C" void C_InsetUrl_CloseUrlCB(FL_OBJECT * ob, long data) } +char const * InsetUrl::EditMessage() const +{ + return _("Opened Url"); +} + + void InsetUrl::Edit(BufferView * bv, int, int, unsigned int) { static int ow = -1, oh; diff --git a/src/insets/inseturl.h b/src/insets/inseturl.h index be6eb4c0eb..85faa5468a 100644 --- a/src/insets/inseturl.h +++ b/src/insets/inseturl.h @@ -19,8 +19,6 @@ #include "buffer.h" #include "form_url.h" -using std::ostream; - struct LaTeXFeatures; /** The url inset @@ -60,7 +58,7 @@ public: return IS_EDITABLE; } /// - const char * EditMessage() const {return _("Opened Url");} + char const * EditMessage() const; /// bool display() const { return false; } /// @@ -72,11 +70,11 @@ public: /// void gotoLabel(); /// - int Latex(ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, signed char fragile, bool free_spc) const; /// - int Linuxdoc(ostream &) const; + int Linuxdoc(std::ostream &) const; /// - int DocBook(ostream &) const; + int DocBook(std::ostream &) const; /// static void CloseUrlCB(FL_OBJECT *, long data); private: diff --git a/src/insets/lyxinset.h b/src/insets/lyxinset.h index 48d3a1540b..79d7904b09 100644 --- a/src/insets/lyxinset.h +++ b/src/insets/lyxinset.h @@ -16,12 +16,12 @@ #pragma interface #endif +#include + #include "gettext.h" #include "lyxfont.h" #include "lyxlex.h" -using std::ostream; - class Painter; class Buffer; class BufferView; @@ -29,6 +29,7 @@ class BufferView; struct LaTeXFeatures; + /// Insets class Inset { public: @@ -114,7 +115,7 @@ public: /// virtual LyXFont ConvertFont(LyXFont font); /// what appears in the minibuffer when opening - virtual const char * EditMessage() const {return _("Opened inset");} + virtual const char * EditMessage() const; /// virtual void Edit(BufferView *, int x, int y, unsigned int button); /// @@ -124,7 +125,7 @@ public: /// virtual bool AutoDelete() const; /// - virtual void Write(ostream &) const = 0; + virtual void Write(std::ostream &) const = 0; /// virtual void Read(LyXLex & lex) = 0; /** returns the number of rows (\n's) of generated tex code. @@ -133,13 +134,13 @@ public: If the freee_spc (freespacing) variable is set, then this inset is in a free-spacing paragraph. */ - virtual int Latex(ostream &, signed char fragile, + virtual int Latex(std::ostream &, signed char fragile, bool free_spc) const = 0; /// - virtual int Linuxdoc(ostream &) const = 0; + virtual int Linuxdoc(std::ostream &) const = 0; /// - virtual int DocBook(ostream &) const = 0; + virtual int DocBook(std::ostream &) const = 0; /// Updates needed features for this inset. virtual void Validate(LaTeXFeatures & features) const; /// diff --git a/src/intl.h b/src/intl.h index 919966dcad..57382a5a16 100644 --- a/src/intl.h +++ b/src/intl.h @@ -6,6 +6,8 @@ #ifndef INTL_H #define INTL_H +#include FORMS_H_LOCATION + #ifdef __GNUG__ #pragma interface #endif diff --git a/src/kbmap.h b/src/kbmap.h index cfb4584ac7..e3805b79c5 100644 --- a/src/kbmap.h +++ b/src/kbmap.h @@ -17,8 +17,6 @@ #include "LString.h" -using std::list; - class kb_sequence; /// Defines key maps and actions for key sequences @@ -71,7 +69,7 @@ private: return table.empty(); } /// - typedef list Table; + typedef std::list Table; /// Table table; }; diff --git a/src/language.C b/src/language.C index 51f5c20eef..8b210dd119 100644 --- a/src/language.C +++ b/src/language.C @@ -9,13 +9,16 @@ Language const * default_language; Language ignore_lang = {"ignore", "Ignore", false}; Language const * ignore_language = &ignore_lang; +/// class LangInit { public: + /// LangInit() { if (!init) initL(); init = true; } private: + /// void newLang(string const & l, string const & d, bool rtl) { Language lang; lang.lang = l; @@ -23,52 +26,60 @@ private: lang.RightToLeft = rtl; languages[l] = lang; } - void initL() { - newLang("afrikaans", N_("Afrikaans"), false); - newLang("american", N_("American"), false); - newLang("arabic", N_("Arabic"), true); - newLang("austrian", N_("Austrian"), false); - newLang("bahasa", N_("Bahasa"), false); - newLang("brazil", N_("Brazil"), false); - newLang("breton", N_("Breton"), false); - newLang("catalan", N_("Catalan"), false); - newLang("croatian", N_("Croatian"), false); - newLang("czech", N_("Czech"), false); - newLang("danish", N_("Danish"), false); - newLang("dutch", N_("Dutch"), false); - newLang("english", N_("English"), false); - newLang("esperanto", N_("Esperanto"), false); - newLang("estonian", N_("Estonian"), false); - newLang("finnish", N_("Finnish"), false); - newLang("francais", N_("Francais"), false); - newLang("french", N_("French"), false); - newLang("frenchb", N_("Frenchb"), false); - newLang("galician", N_("Galician"), false); - newLang("german", N_("German"), false); - newLang("greek", N_("Greek"), false); - newLang("hebrew", N_("Hebrew"), true); - newLang("hungarian", N_("Hungarian"), false); - newLang("irish", N_("Irish"), false); - newLang("italian", N_("Italian"), false); - newLang("lsorbian", N_("Lsorbian"), false); - newLang("magyar", N_("Magyar"), false); - newLang("norsk", N_("Norsk"), false); - newLang("polish", N_("Polish"), false); - newLang("portuges", N_("Portuges"), false); - newLang("romanian", N_("Romanian"), false); - newLang("russian", N_("Russian"), false); - newLang("scottish", N_("Scottish"), false); - newLang("spanish", N_("Spanish"), false); - newLang("slovak", N_("Slovak"), false); - newLang("slovene", N_("Slovene"), false); - newLang("swedish", N_("Swedish"), false); - newLang("turkish", N_("Turkish"), false); - newLang("usorbian", N_("Usorbian"), false); - newLang("welsh", N_("Welsh"), false); - default_language = &languages["american"]; - } + /// + void initL(); + /// static bool init; }; + + +void LangInit::initL() +{ + newLang("afrikaans", N_("Afrikaans"), false); + newLang("american", N_("American"), false); + newLang("arabic", N_("Arabic"), true); + newLang("austrian", N_("Austrian"), false); + newLang("bahasa", N_("Bahasa"), false); + newLang("brazil", N_("Brazil"), false); + newLang("breton", N_("Breton"), false); + newLang("catalan", N_("Catalan"), false); + newLang("croatian", N_("Croatian"), false); + newLang("czech", N_("Czech"), false); + newLang("danish", N_("Danish"), false); + newLang("dutch", N_("Dutch"), false); + newLang("english", N_("English"), false); + newLang("esperanto", N_("Esperanto"), false); + newLang("estonian", N_("Estonian"), false); + newLang("finnish", N_("Finnish"), false); + newLang("francais", N_("Francais"), false); + newLang("french", N_("French"), false); + newLang("frenchb", N_("Frenchb"), false); + newLang("galician", N_("Galician"), false); + newLang("german", N_("German"), false); + newLang("greek", N_("Greek"), false); + newLang("hebrew", N_("Hebrew"), true); + newLang("hungarian", N_("Hungarian"), false); + newLang("irish", N_("Irish"), false); + newLang("italian", N_("Italian"), false); + newLang("lsorbian", N_("Lsorbian"), false); + newLang("magyar", N_("Magyar"), false); + newLang("norsk", N_("Norsk"), false); + newLang("polish", N_("Polish"), false); + newLang("portuges", N_("Portuges"), false); + newLang("romanian", N_("Romanian"), false); + newLang("russian", N_("Russian"), false); + newLang("scottish", N_("Scottish"), false); + newLang("spanish", N_("Spanish"), false); + newLang("slovak", N_("Slovak"), false); + newLang("slovene", N_("Slovene"), false); + newLang("swedish", N_("Swedish"), false); + newLang("turkish", N_("Turkish"), false); + newLang("usorbian", N_("Usorbian"), false); + newLang("welsh", N_("Welsh"), false); + default_language = &languages["american"]; +} + + static LangInit langinit; diff --git a/src/language.h b/src/language.h index 6e2dcc71e4..2d65ae11b2 100644 --- a/src/language.h +++ b/src/language.h @@ -5,15 +5,13 @@ #include #include "LString.h" -using std::map; - struct Language { string lang; string display; bool RightToLeft; }; -typedef map Languages; +typedef std::map Languages; extern Languages languages; extern Language const * default_language; extern Language const * ignore_language; diff --git a/src/lastfiles.h b/src/lastfiles.h index e359c67f62..a7ea4410e6 100644 --- a/src/lastfiles.h +++ b/src/lastfiles.h @@ -20,8 +20,6 @@ #include "LString.h" -using std::deque; - /** The latest documents loaded This class takes care of the last .lyx files used by the LyX user. It both reads and writes this information to a file. The number of files @@ -31,7 +29,7 @@ class LastFiles { public: /// - typedef deque Files; + typedef std::deque Files; /**@name Constructors and Deconstructors */ //@{ diff --git a/src/layout.C b/src/layout.C index a1bdcc2908..b11230df02 100644 --- a/src/layout.C +++ b/src/layout.C @@ -24,6 +24,7 @@ #include "gettext.h" #include "support/LAssert.h" +using std::pair; using std::make_pair; using std::sort; using std::endl; diff --git a/src/layout.h b/src/layout.h index 57f78a30f5..999d55cb26 100644 --- a/src/layout.h +++ b/src/layout.h @@ -22,10 +22,6 @@ #include -using std::ostream; -using std::vector; -using std::pair; - /// Reads the style files extern void LyXSetStyle(); @@ -357,7 +353,7 @@ private: class LyXTextClass { public: /// - typedef vector LayoutList; + typedef std::vector LayoutList; /// typedef LayoutList::const_iterator const_iterator; /// @@ -513,7 +509,7 @@ void operator|=(LyXTextClass::Provides & p1, LyXTextClass::Provides p2) /// inline -ostream & operator<<(ostream & os, LyXTextClass::PageSides p) +std::ostream & operator<<(std::ostream & os, LyXTextClass::PageSides p) { switch (p) { case LyXTextClass::OneSide: @@ -531,7 +527,7 @@ ostream & operator<<(ostream & os, LyXTextClass::PageSides p) class LyXTextClassList { public: /// - typedef vector ClassList; + typedef std::vector ClassList; /// typedef ClassList::const_iterator const_iterator; /// @@ -546,7 +542,7 @@ public: LyXTextClass::size_type layout) const; /// Gets layout number from textclass number and layout name - pair + std::pair NumberOfLayout(size_type textclass, string const & name) const; @@ -558,7 +554,7 @@ public: /** Gets textclass number from name. Returns -1 if textclass name does not exist */ - pair + std::pair NumberOfClass(string const & textclass) const; /// diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 9fc8848f04..dc5692ab57 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -61,6 +61,7 @@ using std::endl; using std::cout; using std::ios; using std::istream_iterator; +using std::pair; extern Combox * combo_language; extern BufferList bufferlist; @@ -88,7 +89,6 @@ extern bool send_fax(string const & fname, string const & sendcmd); extern void MenuSendto(); extern LyXServer * lyxserver; -extern FontLoader fontloader; // this should be static, but I need it in buffer.C bool quitting; // flag, that we are quitting the program @@ -1898,7 +1898,7 @@ bool UpdateLayoutDocument(BufferParams * params) //char sval[20]; //sprintf(sval, "%g", params->spacing.getValue()); #ifdef HAVE_SSTREAM - ostringstream sval; + std::ostringstream sval; sval << params->spacing.getValue(); // setw? fl_set_input(fd_form_document->input_spacing, sval.str().c_str()); @@ -3032,9 +3032,13 @@ extern "C" void PrintCancelCB(FL_OBJECT *, long) static bool stringOnlyContains (string const & LStr, char const * cset) { - char const * cstr = LStr.c_str() ; +#if 0 + char const * cstr = LStr.c_str(); - return strspn(cstr, cset) == strlen(cstr) ; + return strspn(cstr, cset) == strlen(cstr); +#else + return LStr.find_first_not_of(cset) == string::npos; +#endif } diff --git a/src/lyx_gui_misc.C b/src/lyx_gui_misc.C index beee7bc0f0..96959eb131 100644 --- a/src/lyx_gui_misc.C +++ b/src/lyx_gui_misc.C @@ -32,6 +32,7 @@ #include "insets/insetindex.h" #include "LyXView.h" +using std::pair; using std::make_pair; extern BufferView * current_view; diff --git a/src/lyx_gui_misc.h b/src/lyx_gui_misc.h index e2052595f0..485c30f341 100644 --- a/src/lyx_gui_misc.h +++ b/src/lyx_gui_misc.h @@ -18,8 +18,6 @@ #include "LString.h" #include /* needed for pair<> definition */ -using std::pair; - /// Prevents LyX from being killed when the close box is pressed in a popup. extern "C" int CancelCloseBoxCB(FL_FORM *, void *); /// Prevents LyX from being killed when the close box is pressed in a popup. @@ -57,8 +55,8 @@ int AskConfirmation(string const & s1, string const & s2 = string(), string const & s3 = string()); /// returns a bool: false=cancelled, true=okay. string contains returned text -pair askForText(string const & msg, - string const & dflt = string()); +std::pair askForText(string const & msg, + string const & dflt = string()); /// Informs the user that changes in the coming form will be ignored void WarnReadonly(string const & file); diff --git a/src/lyx_main.C b/src/lyx_main.C index bbb8f3fc49..93342fcc67 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -502,7 +502,6 @@ bool LyX::easyParse(int * argc, char * argv[]) Debug::showTags(lyxerr); exit(0); } - } // Check for "-sysdir" else if (arg == "-sysdir") { @@ -523,10 +522,11 @@ bool LyX::easyParse(int * argc, char * argv[]) commandLineHelp(); exit(0); } - // Check for "-nw": No window - else if (arg == "-nw") { - gui = false; - } + // Check for "-nw": No XWindows as for emacs this should + // give a LyX that could be used in a terminal window. + //else if (arg == "-nw") { + // gui = false; + //} // Check for "-x": Execute commands else if (arg == "-x" || arg == "--execute") { @@ -571,8 +571,7 @@ bool LyX::easyParse(int * argc, char * argv[]) lyxerr << _("Unknown file type '") << type << _("' after ") << arg << _(" switch!") << endl; - } - else + } else lyxerr << _("Missing file type [eg latex, " "ps...] after ") << arg << _(" switch!") << endl; diff --git a/src/lyxfont.C b/src/lyxfont.C index 0be8d2e473..563e3bb8c5 100644 --- a/src/lyxfont.C +++ b/src/lyxfont.C @@ -25,11 +25,9 @@ #include "FontLoader.h" #include "support/lstrings.h" +using std::ostream; using std::endl; -// The global fontloader -FontLoader fontloader; - // // Names for the GUI // @@ -54,10 +52,6 @@ char const * GUISizeNames[14] = N_("Larger"), N_("Largest"), N_("Huge"), N_("Huger"), N_("Increase"), N_("Decrease"), N_("Inherit"), N_("Ignore") }; -//char const * lGUISizeNames[15] = -//{ N_("tiny"), N_("smallest"), N_("smaller"), N_("small"), N_("normal"), N_("large"), -// N_("larger"), N_("largest"), N_("huge"), N_("huger"), N_("increase"), N_("decrease"), -// N_("inherit"), N_("ignore"), string() }; static char const * GUIMiscNames[5] = { N_("Off"), N_("On"), N_("Toggle"), N_("Inherit"), N_("Ignore") }; @@ -143,6 +137,26 @@ LyXFont::FontBits LyXFont::ignore = { IGNORE }; +bool LyXFont::FontBits::operator==(LyXFont::FontBits const & fb1) const +{ + return fb1.family == family && + fb1.series == series && + fb1.shape == shape && + fb1.size == size && + fb1.color == color && + fb1.emph == emph && + fb1.underbar == underbar && + fb1.noun == noun && + fb1.latex == latex; +} + + +bool LyXFont::FontBits::operator!=(LyXFont::FontBits const & fb1) const +{ + return !(fb1 == *this); +} + + /// Decreases font size by one LyXFont & LyXFont::decSize() { @@ -370,7 +384,7 @@ bool LyXFont::resolved() const string LyXFont::stateText() const { #ifdef HAVE_SSTREAM - ostringstream ost; + std::ostringstream ost; #else char str[1024]; ostrstream ost(str, 1024); @@ -476,11 +490,12 @@ LyXFont & LyXFont::setLyXSize(string const & siz) return *this; } + // Set size according to lyx format string LyXFont::FONT_MISC_STATE LyXFont::setLyXMisc(string const & siz) { string s = lowercase(siz); - int i= 0; + int i = 0; while (s != LyXMiscNames[i] && LyXMiscNames[i] != "error") ++i; if (s == LyXMiscNames[i]) return FONT_MISC_STATE(i); @@ -489,6 +504,7 @@ LyXFont::FONT_MISC_STATE LyXFont::setLyXMisc(string const & siz) return OFF; } + /// Sets color after LyX text format LyXFont & LyXFont::setLyXColor(string const & col) { @@ -841,168 +857,6 @@ LyXFont::FONT_SHAPE LyXFont::realShape() const } -XFontStruct * LyXFont::getXFontstruct() const -{ - return fontloader.load(family(), series(), realShape(), size()); -} - - -int LyXFont::maxAscent() const -{ - return getXFontstruct()->ascent; -} - - -int LyXFont::maxDescent() const -{ - return getXFontstruct()->descent; -} - - -int LyXFont::ascent(char c) const -{ - XFontStruct * finfo = getXFontstruct(); - unsigned int uc = static_cast(c); - if (finfo->per_char - && uc >= finfo->min_char_or_byte2 - && uc <= finfo->max_char_or_byte2) - return finfo->per_char[uc - finfo->min_char_or_byte2].ascent; - else - return finfo->ascent; -} - - -int LyXFont::descent(char c) const -{ - XFontStruct * finfo = getXFontstruct(); - unsigned int uc = static_cast(c); - if (finfo->per_char - && uc >= finfo->min_char_or_byte2 - && uc <= finfo->max_char_or_byte2) - return finfo->per_char[uc - finfo->min_char_or_byte2].descent; - else - return finfo->descent; -} - - -int LyXFont::lbearing(char c) const -{ - XFontStruct * finfo = getXFontstruct(); - unsigned int uc = static_cast(c); - if (finfo->per_char - && uc >= finfo->min_char_or_byte2 - && uc <= finfo->max_char_or_byte2) - return finfo->per_char[uc - finfo->min_char_or_byte2].lbearing; - else - return 0; -} - - -int LyXFont::rbearing(char c) const -{ - XFontStruct * finfo = getXFontstruct(); - unsigned int uc = static_cast(c); - if (finfo->per_char - && uc >= finfo->min_char_or_byte2 - && uc <= finfo->max_char_or_byte2) - return finfo->per_char[uc - finfo->min_char_or_byte2].rbearing; - else - return width(c); -} - - -// Specialized after profiling. (Asger) -int LyXFont::width(char c) const -{ - if (realShape() != LyXFont::SMALLCAPS_SHAPE){ - return lyxrc.use_gui ? XTextWidth(getXFontstruct(), &c, 1) : 1; - } else { - return textWidth(&c, 1); - } -} - - -int LyXFont::textWidth(char const * s, int n) const -{ - if (!lyxrc.use_gui) - return n; - - if (realShape() != LyXFont::SMALLCAPS_SHAPE){ - return XTextWidth(getXFontstruct(), s, n); - } else { - // emulate smallcaps since X doesn't support this - unsigned int result = 0; - char c; - LyXFont smallfont = *this; - smallfont.decSize(); - smallfont.decSize(); - smallfont.setShape(LyXFont::UP_SHAPE); - for (int i = 0; i < n; ++i) { - c = s[i]; - // when islower is a macro, the cast is needed (JMarc) - if (islower(static_cast(c))){ - c = toupper(c); - result += XTextWidth(smallfont.getXFontstruct(), &c, 1); - } else { - result += XTextWidth(getXFontstruct(), &c, 1); - } - } - return result; - } -} - - -int LyXFont::stringWidth(string const & s) const -{ - if (s.empty()) return 0; - return textWidth(s.c_str(), s.length()); -} - - -int LyXFont::signedStringWidth(string const & s) const -{ - if (s.empty()) return 0; - if (s.c_str()[0] == '-') - return -textWidth(s.c_str()+1, s.length()-1); - else - return textWidth(s.c_str(), s.length()); -} - - -int LyXFont::drawText(char const * s, int n, Pixmap, - int, int x) const -{ - if (realShape() != LyXFont::SMALLCAPS_SHAPE) { - return XTextWidth(getXFontstruct(), s, n); - } else { - // emulate smallcaps since X doesn't support this - char c; - int sx = x; - LyXFont smallfont = *this; - smallfont.decSize(); - smallfont.decSize(); - smallfont.setShape(LyXFont::UP_SHAPE); - for (int i = 0; i < n; ++i) { - c = s[i]; - if (islower(static_cast(c))){ - c = toupper(c); - x += XTextWidth(smallfont.getXFontstruct(), - &c, 1); - } else { - x += XTextWidth(getXFontstruct(), &c, 1); - } - } - return x - sx; - } -} - - -int LyXFont::drawString(string const & s, Pixmap pm, int baseline, int x) const -{ - return drawText(s.c_str(), s.length(), pm, baseline, x); -} - - bool LyXFont::equalExceptLatex(LyXFont const & f) const { LyXFont f1 = *this; diff --git a/src/lyxfont.h b/src/lyxfont.h index fdc011588a..7bdd509f7c 100644 --- a/src/lyxfont.h +++ b/src/lyxfont.h @@ -18,9 +18,7 @@ #include -#include FORMS_H_LOCATION #include "LString.h" -#include "debug.h" #include "language.h" #include "LColor.h" @@ -37,8 +35,6 @@ #undef OFF #endif -using std::ostream; - class LyXLex; /// @@ -292,79 +288,38 @@ public: LyXFont & lyxRead(LyXLex &); /// Writes the changes from this font to orgfont in .lyx format in file - void lyxWriteChanges(LyXFont const & orgfont, ostream &) const; + void lyxWriteChanges(LyXFont const & orgfont, std::ostream &) const; /** Writes the head of the LaTeX needed to change to this font. Writes to string, the head of the LaTeX needed to change to this font. Returns number of chars written. Base is the font state active now. */ - int latexWriteStartChanges(ostream &, LyXFont const & base, + int latexWriteStartChanges(std::ostream &, LyXFont const & base, LyXFont const & prev) const; /** Writes tha tail of the LaTeX needed to chagne to this font. Returns number of chars written. Base is the font state we want to achieve. */ - int latexWriteEndChanges(ostream &, LyXFont const & base, + int latexWriteEndChanges(std::ostream &, LyXFont const & base, LyXFont const & next) const; /// Build GUI description of font state string stateText() const; - /// - int maxAscent() const; - - /// - int maxDescent() const; - - /// - int ascent(char c) const; - - /// - int descent(char c) const; - - /// - int width(char c) const; - - /// - int lbearing(char c) const; - - /// - int rbearing(char c) const; - - /// - int textWidth(char const *s, int n) const; - - /// - int stringWidth(string const & s) const; - - /// - int signedStringWidth(string const & s) const; - - /// Draws text and returns width of text - int drawText(char const *, int n, Pixmap, int baseline, int x) const; - - /// - int drawString(string const &, Pixmap pm, int baseline, int x) const; - /// LColor::color realColor() const; /// - XID getFontID() const { - return getXFontstruct()->fid; - } - - /// - friend inline + friend bool operator==(LyXFont const & font1, LyXFont const & font2) { return font1.bits == font2.bits && font1.lang == font2.lang; } /// - friend inline + friend bool operator!=(LyXFont const & font1, LyXFont const & font2) { return font1.bits != font2.bits || font1.lang != font2.lang; @@ -373,36 +328,37 @@ public: /// compares two fonts, ignoring the setting of the Latex part. bool equalExceptLatex(LyXFont const &) const; + /// Converts logical attributes to concrete shape attribute + LyXFont::FONT_SHAPE realShape() const; private: /// struct FontBits { - bool operator==(FontBits const & fb1) const { - return fb1.family == family && - fb1.series == series && - fb1.shape == shape && - fb1.size == size && - fb1.color == color && - fb1.emph == emph && - fb1.underbar == underbar && - fb1.noun == noun && - fb1.latex == latex; - } - bool operator!=(FontBits const & fb1) const { - return !(fb1 == *this); - } - + /// + bool operator==(FontBits const & fb1) const; + /// + bool operator!=(FontBits const & fb1) const; + /// FONT_FAMILY family; + /// FONT_SERIES series; + /// FONT_SHAPE shape; + /// FONT_SIZE size; + /// LColor::color color; + /// FONT_MISC_STATE emph; + /// FONT_MISC_STATE underbar; + /// FONT_MISC_STATE noun; + /// FONT_MISC_STATE latex; }; - + /// FontBits bits; + /// Language const * lang; /// Sane font @@ -417,15 +373,11 @@ private: /// Updates a misc setting according to request LyXFont::FONT_MISC_STATE setMisc(LyXFont::FONT_MISC_STATE newfont, LyXFont::FONT_MISC_STATE org); - - /// Converts logical attributes to concrete shape attribute - LyXFont::FONT_SHAPE realShape() const; - - /// - XFontStruct * getXFontstruct() const; }; -ostream & operator<<(ostream &, LyXFont::FONT_MISC_STATE); + +std::ostream & operator<<(std::ostream &, LyXFont::FONT_MISC_STATE); + inline LyXFont::LyXFont() diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 762864d731..9bef0081c7 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -42,7 +42,7 @@ #include "insets/insetinclude.h" #include "insets/insetbib.h" #include "insets/insettext.h" -#include "insets/insetnumber.h" +//#include "insets/insetnumber.h" #include "insets/insetert.h" #include "insets/insetgraphics.h" #include "insets/insetfoot.h" @@ -70,6 +70,7 @@ #include "WorkArea.h" #include "lyxfr1.h" +using std::pair; using std::endl; extern bool cursor_follows_scrollbar; @@ -1960,6 +1961,7 @@ string LyXFunc::Dispatch(int ac, new_inset->Edit(owner->view(), 0, 0, 0); } break; +#if 0 case LFUN_INSET_NUMBER: { InsetNumber * new_inset = new InsetNumber(owner->buffer()); @@ -1967,6 +1969,7 @@ string LyXFunc::Dispatch(int ac, new_inset->Edit(owner->view(), 0, 0, 0); } break; +#endif case LFUN_INSET_ERT: { InsetERT * new_inset = new InsetERT(owner->buffer()); @@ -2563,7 +2566,8 @@ string LyXFunc::Dispatch(int ac, } owner->view()->beforeChange(); - + +#if 0 if (isdigit(argument[0]) && (lyxrc.number_inset == "true" || (lyxrc.number_inset == "rtl" && @@ -2575,7 +2579,8 @@ string LyXFunc::Dispatch(int ac, argument); return string(); } - +#endif + for (string::size_type i = 0; i < argument.length(); ++i) { if (greek_kb_flag) { diff --git a/src/lyxlex.C b/src/lyxlex.C index a61479728f..145b2cc9f5 100644 --- a/src/lyxlex.C +++ b/src/lyxlex.C @@ -19,6 +19,8 @@ #include "support/lyxalgo.h" using std::ios; +using std::ostream; +using std::istream; using std::lower_bound; using std::sort; using std::endl; diff --git a/src/lyxlex.h b/src/lyxlex.h index 9b2616a1d1..332f711c5f 100644 --- a/src/lyxlex.h +++ b/src/lyxlex.h @@ -16,10 +16,6 @@ #include "LString.h" -using std::ostream; -using std::istream; -using std::filebuf; - /// struct keyword_item { /// @@ -56,9 +52,9 @@ public: /// return true if able to open file, else false bool setFile(string const & filename); /// - void setStream(istream & i); + void setStream(std::istream & i); /// - istream & getStream() { return is; } + std::istream & getStream() { return is; } /// Danger! Don't use it unless you know what you are doing. void setLineNo(int l) { lineno = l; } /// returns a lex code @@ -116,7 +112,7 @@ public: /** Prints the current token table on the supplied ostream. */ - void printTable(ostream &); + void printTable(std::ostream &); protected: /// enum { @@ -140,9 +136,9 @@ protected: }; /// fb__ is only used to open files, the stream is accessed through is - filebuf fb__; + std::filebuf fb__; /// the stream that we use. - istream is; + std::istream is; /// string name; /// diff --git a/src/lyxparagraph.h b/src/lyxparagraph.h index 6f546222be..5517081fbf 100644 --- a/src/lyxparagraph.h +++ b/src/lyxparagraph.h @@ -27,10 +27,6 @@ #include "direction.h" #include "language.h" -using std::ostream; -using std::list; -using std::vector; - class BufferParams; class LyXBuffer; class TexRow; @@ -117,7 +113,7 @@ public: /// typedef char value_type; /// - typedef vector TextContainer; + typedef std::vector TextContainer; /// typedef int size_type; @@ -139,7 +135,7 @@ public: LyXDirection getLetterDirection(size_type pos) const; /// - void writeFile(ostream &, BufferParams const &, char, char) const; + void writeFile(std::ostream &, BufferParams const &, char, char) const; /// void validate(LaTeXFeatures &) const; @@ -156,15 +152,15 @@ public: void read(); /// - LyXParagraph * TeXOnePar(ostream &, TexRow & texrow, - ostream & foot, TexRow & foot_texrow, + LyXParagraph * TeXOnePar(std::ostream &, TexRow & texrow, + std::ostream & foot, TexRow & foot_texrow, int & foot_count); /// - bool SimpleTeXOnePar(ostream &, TexRow & texrow); + bool SimpleTeXOnePar(std::ostream &, TexRow & texrow); /// - LyXParagraph * TeXEnvironment(ostream &, TexRow & texrow, - ostream & foot, TexRow & foot_texrow, + LyXParagraph * TeXEnvironment(std::ostream &, TexRow & texrow, + std::ostream & foot, TexRow & foot_texrow, int & foot_count); /// LyXParagraph * Clone() const; @@ -340,7 +336,7 @@ public: /// int BeginningOfMainBody() const; /// - string GetLabestring() const; + string GetLabelstring() const; /// the next two functions are for the manual labels string GetLabelWidthString() const; @@ -484,10 +480,7 @@ public: one (or more) paragraphs with the footnote, and finally the a paragraph with the text after the footnote. Only the first paragraph keeps information about layoutparameters, */ - bool IsDummy() const { - return (footnoteflag == LyXParagraph::NO_FOOTNOTE && previous - && previous->footnoteflag != LyXParagraph::NO_FOOTNOTE); - } + bool IsDummy() const; /* If I set a PExtra Indent on one paragraph of a ENV_LIST-TYPE I have to set it on each of it's elements */ @@ -497,16 +490,16 @@ public: void UnsetPExtraType(); #if 0 /// - bool RoffContTableRows(ostream &, size_type i, int actcell); + bool RoffContTableRows(std::ostream &, size_type i, int actcell); #endif /// bool linuxDocConvertChar(char c, string & sgml_string); /// - void DocBookContTableRows(ostream &, string & extra, + void DocBookContTableRows(std::ostream &, string & extra, int & desc_on, size_type i, int current_cell_number, int & column); /// - void SimpleDocBookOneTablePar(ostream &, string & extra, + void SimpleDocBookOneTablePar(std::ostream &, string & extra, int & desc_on, int depth); private: /** A font entry covers a range of positions. Notice that the @@ -541,35 +534,35 @@ private: InsetTable(size_type p, Inset * i) { pos = p; inset = i;} }; /// - typedef list FontList; + typedef std::list FontList; /// FontList fontlist; /// - typedef vector InsetList; + typedef std::vector InsetList; /// InsetList insetlist; /// - LyXParagraph * TeXDeeper(ostream &, TexRow & texrow, - ostream & foot, TexRow & foot_texrow, + LyXParagraph * TeXDeeper(std::ostream &, TexRow & texrow, + std::ostream & foot, TexRow & foot_texrow, int & foot_count); /// - LyXParagraph * TeXFootnote(ostream &, TexRow & texrow, - ostream & foot, TexRow & foot_texrow, + LyXParagraph * TeXFootnote(std::ostream &, TexRow & texrow, + std::ostream & foot, TexRow & foot_texrow, int & foot_count, LyXDirection par_direction); /// - bool SimpleTeXOneTablePar(ostream &, TexRow & texrow); + bool SimpleTeXOneTablePar(std::ostream &, TexRow & texrow); /// - bool TeXContTableRows(ostream &, size_type i, + bool TeXContTableRows(std::ostream &, size_type i, int current_cell_number, int & column, TexRow & texrow); /// - void SimpleTeXBlanks(ostream &, TexRow & texrow, + void SimpleTeXBlanks(std::ostream &, TexRow & texrow, size_type const i, int & column, LyXFont const & font, LyXLayout const & style); /// - void SimpleTeXSpecialChars(ostream &, TexRow & texrow, + void SimpleTeXSpecialChars(std::ostream &, TexRow & texrow, LyXFont & font, LyXFont & running_font, LyXFont & basefont, bool & open_font, LyXLayout const & style, diff --git a/src/lyxrc.C b/src/lyxrc.C index 88ab514572..ccb0d42fb7 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -31,6 +31,7 @@ #include "support/filetools.h" #include "lyxtext.h" +using std::ostream; using std::ofstream; using std::cout; using std::ios; diff --git a/src/lyxrc.h b/src/lyxrc.h index 521dbea0a4..bc724a465a 100644 --- a/src/lyxrc.h +++ b/src/lyxrc.h @@ -21,9 +21,6 @@ #include "ToolbarDefaults.h" #include "bufferparams.h" -using std::ostream; -using std::map; - /// This contains the runtime configuration of LyX class LyXRC { public: @@ -37,7 +34,7 @@ public: /// void print() const; /// - void output(ostream & os) const; + void output(std::ostream & os) const; /// Is a bind file already (or currently) read? bool hasBindFile; /// @@ -240,7 +237,7 @@ public: /// string docbook_to_pdf_command; /// - typedef map Bindings; + typedef std::map Bindings; /// Bindings bindings; private: diff --git a/src/lyxtext.h b/src/lyxtext.h index 1fd782a254..200fd75049 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -22,8 +22,6 @@ #include "lyxparagraph.h" #include "layout.h" -using std::vector; - class Buffer; class BufferParams; class Row; @@ -606,10 +604,10 @@ private: LyXParagraph::size_type pos) const; /// - mutable vector log2vis_list; + mutable std::vector log2vis_list; /// - mutable vector vis2log_list; + mutable std::vector vis2log_list; /// mutable LyXParagraph::size_type bidi_start; diff --git a/src/lyxvc.C b/src/lyxvc.C index 0a5c1e6173..4b7305055b 100644 --- a/src/lyxvc.C +++ b/src/lyxvc.C @@ -18,6 +18,7 @@ #include "LyXView.h" using std::endl; +using std::pair; LyXVC::LyXVC() { diff --git a/src/mathed/formula.C b/src/mathed/formula.C index a57d45c606..8c03d3fd86 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -41,7 +41,10 @@ using std::istringstream; #include "support/LOstream.h" #include "LyXView.h" #include "Painter.h" +#include "font.h" +using std::ostream; +using std::istream; using std::pair; using std::endl; @@ -177,9 +180,9 @@ void mathed_init_fonts() //removed 'static' because DEC cxx does not Math_Fonts[7].setFamily(LyXFont::SANS_FAMILY); LyXFont f = WhichFont(LM_TC_VAR, LM_ST_TEXT); - MathedInset::df_asc = f.maxAscent(); - MathedInset::df_des = f.maxDescent(); - MathedInset::df_width = f.width('I'); + MathedInset::df_asc = lyxfont::maxAscent(f); + MathedInset::df_des = lyxfont::maxDescent(f); + MathedInset::df_width = lyxfont::width('I', f); } @@ -209,14 +212,14 @@ int mathed_string_width(short type, int size, byte const * s, int ls) ls *= 3; s = &sx[0]; } - return f.textWidth(reinterpret_cast(s), ls); + return lyxfont::width(reinterpret_cast(s), ls, f); } int mathed_char_width(short type, int size, byte c) { - int t = (MathIsBinary(type)) ? mathed_string_width(type, size, &c, 1): - WhichFont(type, size).width(c); + int t = (MathIsBinary(type)) ? mathed_string_width(type, size, &c, 1) : + lyxfont::width(c, WhichFont(type, size)); return t; } @@ -227,10 +230,10 @@ int mathed_string_height(short type, int size, byte const * s, LyXFont font = WhichFont(type, size); asc = des = 0; for (int i = 0; i < ls; ++i) { - if (font.descent(s[i]) > des) - des = font.descent(s[i]); - if (font.ascent(s[i]) > asc) - asc = font.ascent(s[i]); + if (lyxfont::descent(s[i], font) > des) + des = lyxfont::descent(s[i], font); + if (lyxfont::ascent(s[i], font) > asc) + asc = lyxfont::ascent(s[i], font); } return asc + des; } @@ -240,8 +243,8 @@ int mathed_char_height(short type, int size, byte c, int & asc, int & des) { LyXFont font = WhichFont(type, size); asc = des = 0; - des = font.descent(c); - asc = font.ascent(c); + des = lyxfont::descent(c, font); + asc = lyxfont::ascent(c, font); return asc + des; } @@ -449,6 +452,12 @@ void InsetFormula::draw(Painter & pain, LyXFont const & f, } +char const * InsetFormula::EditMessage() const +{ + return _("Math editor mode"); +} + + void InsetFormula::Edit(BufferView * bv, int x, int y, unsigned int) { mathcursor = new MathedCursor(par); @@ -503,8 +512,8 @@ void InsetFormula::ToggleInsetCursor(BufferView * bv) // x -= par->xo; y -= par->yo; LyXFont font = WhichFont(LM_TC_TEXTRM, LM_ST_TEXT); - int asc = font.maxAscent(); - int desc = font.maxDescent(); + int asc = lyxfont::maxAscent(font); + int desc = lyxfont::maxDescent(font); if (cursor_visible) bv->hideLockedInsetCursor(); @@ -523,8 +532,8 @@ void InsetFormula::ShowInsetCursor(BufferView * bv) // x -= par->xo; y -= par->yo; LyXFont font = WhichFont(LM_TC_TEXTRM, LM_ST_TEXT); - int asc = font.maxAscent(); - int desc = font.maxDescent(); + int asc = lyxfont::maxAscent(font); + int desc = lyxfont::maxDescent(font); bv->fitLockedInsetCursor(x, y, asc, desc); } ToggleInsetCursor(bv); @@ -1206,7 +1215,7 @@ MathFuncInset::draw(Painter & pain, int x, int y) if (name && name[0] > ' ') { LyXFont font = WhichFont(LM_TC_TEXTRM, size); font.setLatex(LyXFont::ON); - x += (font.textWidth("I", 1) + 3) / 4; + x += (lyxfont::width('I', font) + 3) / 4; pain.text(x, y, name, font); } } @@ -1217,7 +1226,8 @@ void MathFuncInset::Metrics() ln = (name) ? strlen(name): 0; LyXFont font = WhichFont(LM_TC_TEXTRM, size); font.setLatex(LyXFont::ON); - width = font.textWidth(name, ln) + font.textWidth("I", 1)/2; + width = lyxfont::width(name, ln, font) + + lyxfont::width('I', font) / 2; mathed_string_height(LM_TC_TEXTRM, size, reinterpret_cast(name), strlen(name), ascent, descent); diff --git a/src/mathed/formula.h b/src/mathed/formula.h index 149a808610..b891c0d297 100644 --- a/src/mathed/formula.h +++ b/src/mathed/formula.h @@ -25,8 +25,6 @@ #include "insets/lyxinset.h" -using std::ostream; - class MathParInset; class MathedCursor; @@ -48,15 +46,15 @@ public: /// void draw(Painter &, LyXFont const &, int baseline, float & x) const; /// - void Write(ostream &) const; + void Write(std::ostream &) const; /// void Read(LyXLex & lex); /// - int Latex(ostream &, signed char fragile, bool free_spc) const; + int Latex(std::ostream &, signed char fragile, bool free_spc) const; /// - int Linuxdoc(ostream &) const; + int Linuxdoc(std::ostream &) const; /// - int DocBook(ostream &) const; + int DocBook(std::ostream &) const; /// void Validate(LaTeXFeatures &) const; /// @@ -71,7 +69,7 @@ public: } /// what appears in the minibuffer when opening - const char * EditMessage() const {return _("Math editor mode");} + char const * EditMessage() const; /// void Edit(BufferView *, int x, int y, unsigned int button); /// diff --git a/src/mathed/formulamacro.C b/src/mathed/formulamacro.C index 6cc758e793..b320b1cf1d 100644 --- a/src/mathed/formulamacro.C +++ b/src/mathed/formulamacro.C @@ -29,7 +29,10 @@ #include "BufferView.h" #include "gettext.h" #include "Painter.h" +#include "font.h" +using std::ostream; +using std::istream; InsetFormulaMacro::InsetFormulaMacro() : InsetFormula(true) @@ -112,7 +115,7 @@ int InsetFormulaMacro::ascent(Painter & pain, LyXFont const & f) const tmacro->update(); return InsetFormula::ascent(pain, f); } - return f.maxAscent()+3; + return lyxfont::maxAscent(f) + 3; } @@ -122,7 +125,7 @@ int InsetFormulaMacro::descent(Painter & pain, LyXFont const & f) const tmacro->update(); return InsetFormula::descent(pain, f); } - return f.maxDescent()+1; + return lyxfont::maxDescent(f) + 1; } @@ -134,7 +137,7 @@ int InsetFormulaMacro::width(Painter & pain, LyXFont const & f) const } string ilabel(_("Macro: ")); ilabel += name; - return 6 + f.stringWidth(ilabel); + return 6 + lyxfont::width(ilabel, f); } @@ -166,6 +169,12 @@ void InsetFormulaMacro::draw(Painter & pain, LyXFont const & f, } +char const * InsetFormulaMacro::EditMessage() const +{ + return _("Math macro editor mode"); +} + + void InsetFormulaMacro::Edit(BufferView * bv, int x, int y,unsigned int button) { opened = true; diff --git a/src/mathed/formulamacro.h b/src/mathed/formulamacro.h index 05c78b2377..dd1652ebe2 100644 --- a/src/mathed/formulamacro.h +++ b/src/mathed/formulamacro.h @@ -23,8 +23,6 @@ #include "formula.h" -using std::ostream; - class MathMacroTemplate; @@ -48,18 +46,18 @@ public: /// void Read(LyXLex & lex); /// - void Write(ostream & os) const; + void Write(std::ostream & os) const; /// - int Latex(ostream & os, signed char fragile, bool free_spc) const; + int Latex(std::ostream & os, signed char fragile, bool free_spc) const; /// - int Linuxdoc(ostream &) const; + int Linuxdoc(std::ostream &) const; /// - int DocBook(ostream &) const; + int DocBook(std::ostream &) const; /// Inset * Clone() const; /// what appears in the minibuffer when opening - const char * EditMessage() const {return _("Math macro editor mode");} + char const * EditMessage() const; /// void Edit(BufferView *, int x, int y, unsigned int button); /// diff --git a/src/mathed/math_defs.h b/src/mathed/math_defs.h index 992723f1aa..46adf8a26f 100644 --- a/src/mathed/math_defs.h +++ b/src/mathed/math_defs.h @@ -31,9 +31,6 @@ #include "array.h" -using std::ostream; -using std::istream; - class Painter; /// @@ -145,7 +142,7 @@ enum MathedTextCodes { LM_TC_MAX }; -ostream & operator<<(ostream &, MathedTextCodes mtc); +std::ostream & operator<<(std::ostream &, MathedTextCodes mtc); /// #define LM_TC_NORMAL LM_TC_VAR @@ -233,7 +230,7 @@ class MathedInset { virtual void draw(Painter &, int x, int baseline) = 0; /// Write LaTeX and Lyx code - virtual void Write(ostream &) = 0; + virtual void Write(std::ostream &) = 0; /// Reproduces itself virtual MathedInset * Clone() = 0; @@ -330,7 +327,7 @@ class MathParInset: public MathedInset { virtual void draw(Painter &, int x, int baseline); /// Write LaTeX code - virtual void Write(ostream &); + virtual void Write(std::ostream &); /// virtual void Metrics(); @@ -486,7 +483,7 @@ class MathMatrixInset: public MathParInset { /// void draw(Painter &, int, int); /// - void Write(ostream &); + void Write(std::ostream &); /// void Metrics(); /// @@ -533,11 +530,11 @@ class MathMatrixInset: public MathParInset { LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * data, MathParInset ** mt); /// -void mathed_write(MathParInset *, ostream &, int *, char fragile, +void mathed_write(MathParInset *, std::ostream &, int *, char fragile, char const * label = 0); /// -void mathed_parser_file(istream &, int); +void mathed_parser_file(std::istream &, int); /// int mathed_parser_lineno(); /// diff --git a/src/mathed/math_inset.h b/src/mathed/math_inset.h index 8f55132d16..fa80cf4eef 100644 --- a/src/mathed/math_inset.h +++ b/src/mathed/math_inset.h @@ -30,8 +30,6 @@ #include "symbol_def.h" #include "LString.h" -using std::ostream; - /** Functions or LaTeX names for objects that I don't know how to draw. */ @@ -47,7 +45,7 @@ public: /// void draw(Painter &, int, int); /// - void Write(ostream &); + void Write(std::ostream &); /// void Metrics(); /// @@ -76,7 +74,7 @@ public: /// void draw(Painter &, int, int); /// - void Write(ostream &); + void Write(std::ostream &); /// void Metrics(); /// @@ -106,7 +104,7 @@ public: /// void draw(Painter &, int, int); /// - void Write(ostream &); + void Write(std::ostream &); /// void Metrics(); protected: @@ -125,7 +123,7 @@ public: /// void draw(Painter &, int, int); /// - void Write(ostream &); + void Write(std::ostream &); /// inline void Metrics(); /// @@ -148,7 +146,7 @@ public: /// void draw(Painter &, int, int); /// - void Write(ostream &); + void Write(std::ostream &); /// void Metrics(); /// @@ -175,7 +173,7 @@ public: /// void draw(Painter &, int x, int baseline); /// - void Write(ostream &); + void Write(std::ostream &); /// void Metrics(); /// @@ -198,7 +196,7 @@ public: /// void draw(Painter &, int x, int baseline); /// - void Write(ostream &); + void Write(std::ostream &); /// void Metrics(); @@ -244,7 +242,7 @@ public: /// void draw(Painter &, int, int); /// - void Write(ostream &); + void Write(std::ostream &); /// void Metrics(); protected: @@ -265,7 +263,7 @@ public: /// void draw(Painter &, int, int); /// - void Write(ostream &); + void Write(std::ostream &); /// void Metrics(); /// @@ -298,7 +296,7 @@ bool MathFuncInset::GetLimits() const inline -void MathFuncInset::Write(ostream & os) +void MathFuncInset::Write(std::ostream & os) { os << "\\" << name << ' '; } diff --git a/src/mathed/math_macro.C b/src/mathed/math_macro.C index 4552b12323..dece8c9e0b 100644 --- a/src/mathed/math_macro.C +++ b/src/mathed/math_macro.C @@ -30,6 +30,7 @@ #include "support/lstrings.h" #include "debug.h" +using std::ostream; using std::endl; ostream & operator<<(ostream & o, MathedTextCodes mtc) @@ -217,7 +218,7 @@ void MathMacroArgument::draw(Painter & pain, int x, int baseline) MathParInset::draw(pain, x, baseline); } else { #ifdef HAVE_SSTREAM - ostringstream ost; + std::ostringstream ost; ost << '#' << number; drawStr(pain, LM_TC_TEX, size, x, baseline, reinterpret_cast(ost.str().c_str()), 2); @@ -238,7 +239,7 @@ void MathMacroArgument::Metrics() MathParInset::Metrics(); } else { #ifdef HAVE_SSTREAM - ostringstream ost; + std::ostringstream ost; ost << '#' << number; width = mathed_string_width(LM_TC_TEX, size, reinterpret_cast(ost.str().c_str()), 2); diff --git a/src/mathed/math_macro.h b/src/mathed/math_macro.h index 16e4416919..f58d78041f 100644 --- a/src/mathed/math_macro.h +++ b/src/mathed/math_macro.h @@ -24,9 +24,6 @@ #include "math_defs.h" #include "debug.h" -using std::ostream; -using std::endl; - /// typedef MathParInset * MathParInsetP; /// @@ -52,7 +49,7 @@ public: /// MathedInset * Clone(); /// - void Write(ostream &); + void Write(std::ostream &); /// bool setArgumentIdx(int); /// @@ -110,7 +107,7 @@ public: /// MathMacroArgument(int); /// - ~MathMacroArgument() { lyxerr << "help, destroyme!" << endl; } + ~MathMacroArgument() { lyxerr << "help, destroyme!" << std::endl; } /// MathedInset * Clone() { return this; } /// @@ -118,7 +115,7 @@ public: /// void draw(Painter &, int x, int baseline); /// - void Write(ostream &); + void Write(std::ostream &); /// void setNumber(int n) { number = n; } /// Is expanded or not @@ -145,7 +142,7 @@ public: /// void Metrics(); /// - void WriteDef(ostream &); + void WriteDef(std::ostream &); /// useful for special insets void setTCode(MathedTextCodes t) { tcode = t; } /// diff --git a/src/mathed/math_panel.C b/src/mathed/math_panel.C index a97cb9f3ce..6c10630a86 100644 --- a/src/mathed/math_panel.C +++ b/src/mathed/math_panel.C @@ -147,7 +147,7 @@ void delim_cb(FL_OBJECT *, long data) case MM_OK: { #ifdef HAVE_SSTREAM - ostringstream ost; + std::ostringstream ost; ost << delim_code[left] << ' ' << delim_code[right]; lyxfunc->Dispatch(LFUN_MATH_DELIM, ost.str().c_str()); #else @@ -206,7 +206,7 @@ void matrix_cb(FL_OBJECT *, long data) int ny = int(fl_get_slider_value(fd_matrix->rows)+0.5); if (data == MM_OK) fl_hide_form(fd_matrix->matrix); #ifdef HAVE_SSTREAM - ostringstream ost; + std::ostringstream ost; ost << nx << ' ' << ny << ' ' << c << sh; lyxfunc->Dispatch(LFUN_INSERT_MATRIX, ost.str().c_str()); #else diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 1225725c40..2c8c7053cf 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -30,6 +30,7 @@ #include "math_root.h" #include "debug.h" +using std::istream; using std::endl; enum { diff --git a/src/mathed/math_root.C b/src/mathed/math_root.C index c817dc07ca..971f4fdc8f 100644 --- a/src/mathed/math_root.C +++ b/src/mathed/math_root.C @@ -22,7 +22,10 @@ #include "math_iter.h" #include "math_root.h" -MathRootInset::MathRootInset(short st): MathSqrtInset(st) +using std::ostream; + +MathRootInset::MathRootInset(short st) + : MathSqrtInset(st) { idx = 1; uroot = new MathParInset(LM_ST_TEXT); diff --git a/src/mathed/math_root.h b/src/mathed/math_root.h index 93d2ae7e17..c91f96d903 100644 --- a/src/mathed/math_root.h +++ b/src/mathed/math_root.h @@ -24,8 +24,6 @@ #include "symbol_def.h" #include "LString.h" -using std::ostream; - /// class MathRootInset: public MathSqrtInset { public: @@ -40,7 +38,7 @@ class MathRootInset: public MathSqrtInset { /// void draw(Painter &, int x, int baseline); /// - void Write(ostream &); + void Write(std::ostream &); /// void Metrics(); /// @@ -50,7 +48,7 @@ class MathRootInset: public MathSqrtInset { /// void SetData(LyxArrayBase *); /// - void GetXY(int& x, int& y) const; + void GetXY(int & x, int & y) const; /// LyxArrayBase * GetData(); /// diff --git a/src/mathed/math_write.C b/src/mathed/math_write.C index d240bd03da..39d7cc55ec 100644 --- a/src/mathed/math_write.C +++ b/src/mathed/math_write.C @@ -24,6 +24,7 @@ #include "support/lstrings.h" #include "debug.h" +using std::ostream; using std::endl; extern char const * latex_mathenv[]; diff --git a/src/menus.C b/src/menus.C index 12c26e03c0..a42aae2481 100644 --- a/src/menus.C +++ b/src/menus.C @@ -45,6 +45,7 @@ #include "gettext.h" #include "layout.h" +using std::vector; using std::endl; extern FD_form_screen * fd_form_screen; diff --git a/src/minibuffer.C b/src/minibuffer.C index d60aa91835..a1187d010f 100644 --- a/src/minibuffer.C +++ b/src/minibuffer.C @@ -33,6 +33,16 @@ extern string keyseqOptions(int l= 190); extern string keyseqStr(int l= 190); extern LyXAction lyxaction; +MiniBuffer::MiniBuffer(LyXView * o, FL_Coord x, FL_Coord y, + FL_Coord h, FL_Coord w) + : owner(o) +{ + text = _("Welcome to LyX!"); + shows_no_match = true; + history_idx = history_cnt = 0; + add(FL_NORMAL_INPUT, x, y, h, w); +} + void MiniBuffer::TimerCB(FL_OBJECT * ob, long) { MiniBuffer * obj = static_cast(ob->u_vdata); diff --git a/src/minibuffer.h b/src/minibuffer.h index 186c3e2110..07d26fa0ee 100644 --- a/src/minibuffer.h +++ b/src/minibuffer.h @@ -16,14 +16,8 @@ class LyXView; class MiniBuffer { public: /// - MiniBuffer(LyXView *o, FL_Coord x, FL_Coord y, FL_Coord h, FL_Coord w) - : owner(o) - { - text = _("Welcome to LyX!"); - shows_no_match = true; - history_idx = history_cnt = 0; - add(FL_NORMAL_INPUT, x, y, h, w); - } + MiniBuffer(LyXView *o, FL_Coord x, FL_Coord y, FL_Coord h, FL_Coord w); + /// bool shows_no_match; /// diff --git a/src/paragraph.C b/src/paragraph.C index 20afdcb602..0841a945e5 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -34,6 +34,7 @@ #include "texrow.h" #include "support/lyxmanip.h" +using std::ostream; using std::endl; using std::fstream; using std::ios; @@ -1663,7 +1664,7 @@ char LyXParagraph::GetAlign() const } -string LyXParagraph::GetLabestring() const +string LyXParagraph::GetLabelstring() const { return FirstPhysicalPar()->labelstring; } @@ -1895,7 +1896,7 @@ Inset * LyXParagraph::ReturnNextInsetPointer(LyXParagraph::size_type & pos) { InsetList::iterator it = lower_bound(insetlist.begin(), insetlist.end(), - InsetTable(pos,0)); + InsetTable(pos, 0)); if (it != insetlist.end()) { pos = (*it).pos; return (*it).inset; @@ -2773,7 +2774,7 @@ void LyXParagraph::SimpleDocBookOneTablePar(ostream & os, string & extra, } else if (c == LyXParagraph::META_INSET) { inset = GetInset(i); #ifdef HAVE_SSTREAM - ostringstream ost; + std::ostringstream ost; inset->DocBook(ost); string tmp_out = ost.str().c_str(); #else @@ -2939,7 +2940,7 @@ void LyXParagraph::DocBookContTableRows(ostream & os, string & extra, if (c == LyXParagraph::META_INSET) { inset = GetInset(i); #ifdef HAVE_SSTREAM - ostringstream ost; + std::ostringstream ost; inset->DocBook(ost); string tmp_out = ost.str().c_str(); #else @@ -3915,7 +3916,7 @@ LyXParagraph * LyXParagraph::TeXFootnote(ostream & os, TexRow & texrow, // NOTE: Currently don't support footnotes within footnotes // even though that is possible using the \footnotemark #ifdef HAVE_SSTREAM - ostringstream dummy; + std::ostringstream dummy; #else ostrstream dummy; #endif @@ -4015,6 +4016,13 @@ LyXParagraph * LyXParagraph::TeXFootnote(ostream & os, TexRow & texrow, } +bool LyXParagraph::IsDummy() const +{ + return (footnoteflag == LyXParagraph::NO_FOOTNOTE && previous + && previous->footnoteflag != LyXParagraph::NO_FOOTNOTE); +} + + void LyXParagraph::SetPExtraType(int type, char const * width, char const * widthp) { diff --git a/src/screen.C b/src/screen.C index 5428a215f6..e6aef59c5d 100644 --- a/src/screen.C +++ b/src/screen.C @@ -22,6 +22,7 @@ #include "Painter.h" #include "WorkArea.h" #include "bufferparams.h" +#include "font.h" using std::max; using std::min; @@ -195,8 +196,8 @@ void LyXScreen::ShowCursor() shape = (text->real_current_font.isVisibleRightToLeft()) ? REVERSED_L_SHAPE : L_SHAPE; ShowManualCursor(text->cursor.x, text->cursor.y, - text->real_current_font.maxAscent(), - text->real_current_font.maxDescent(), + lyxfont::maxAscent(text->real_current_font), + lyxfont::maxDescent(text->real_current_font), shape); } } diff --git a/src/support/DebugStream.C b/src/support/DebugStream.C index e61056509e..2903f62448 100644 --- a/src/support/DebugStream.C +++ b/src/support/DebugStream.C @@ -20,6 +20,7 @@ #include #endif +using std::ostream; using std::streambuf; using std::streamsize; using std::filebuf; diff --git a/src/support/DebugStream.h b/src/support/DebugStream.h index f20067da2b..323b9edc73 100644 --- a/src/support/DebugStream.h +++ b/src/support/DebugStream.h @@ -14,8 +14,6 @@ #include -using std::ostream; - #ifdef TEST_DEBUGSTREAM #include struct Debug { @@ -84,7 +82,7 @@ struct Debug { debug[Debug::type(Debug::INFO | Debug::CRIT)] << "...info/crit...\n"; */ -class DebugStream : public ostream { +class DebugStream : public std::ostream { public: /// Constructor, sets the debug level to t. explicit DebugStream(Debug::type t = Debug::NONE); @@ -130,7 +128,7 @@ public: current debug level otherwise the real debug stream is used. */ - ostream & debug(Debug::type t = Debug::ANY) { + std::ostream & debug(Debug::type t = Debug::ANY) { if (dt & t) return *this; return nullstream; } @@ -139,14 +137,14 @@ public: /** This is an operator to give a more convenient use: dbgstream[Debug::INFO] << "Info!\n"; */ - ostream & operator[](Debug::type t) { + std::ostream & operator[](Debug::type t) { return debug(t); } private: /// The current debug level Debug::type dt; /// The no-op stream. - ostream nullstream; + std::ostream nullstream; struct debugstream_internal; debugstream_internal * internal; }; diff --git a/src/support/LRegex.h b/src/support/LRegex.h index de0ce61f68..5b33f72d8b 100644 --- a/src/support/LRegex.h +++ b/src/support/LRegex.h @@ -15,9 +15,6 @@ #include -using std::vector; -using std::pair; - /// class LRegex { public: @@ -28,10 +25,10 @@ public: ~LRegex(); /// - typedef pair MatchPair; + typedef std::pair MatchPair; /// - typedef vector SubMatches; + typedef std::vector SubMatches; /// Returns all the matches in a vector SubMatches const & exec(string const & str) const; diff --git a/src/support/Makefile.am b/src/support/Makefile.am index 570077fbf1..8d83462371 100644 --- a/src/support/Makefile.am +++ b/src/support/Makefile.am @@ -41,6 +41,7 @@ libsupport_la_SOURCES = \ lyxmanip.h \ $(LYXSTRING) lyxsum.C \ mkdir.C \ + path.C \ path.h \ putenv.C \ $(REGEX) syscall.C \ diff --git a/src/support/lstrings.h b/src/support/lstrings.h index 1ddf0b71a4..d3ae42ec80 100644 --- a/src/support/lstrings.h +++ b/src/support/lstrings.h @@ -13,7 +13,6 @@ #ifdef HAVE_SSTREAM #include -using std::ostringstream; #else #include #endif @@ -61,7 +60,7 @@ inline string tostr(T const & t) { #ifdef HAVE_SSTREAM - ostringstream ostr; + std::ostringstream ostr; ostr << t; return ostr.str().c_str(); // We need to use the .c_str since we sometimes are using diff --git a/src/support/lyxmanip.h b/src/support/lyxmanip.h index a03a0c7e05..bc106bed79 100644 --- a/src/support/lyxmanip.h +++ b/src/support/lyxmanip.h @@ -4,8 +4,6 @@ #include "support/LOstream.h" -using std::ostream; - /// struct NewLineAndDepth_ { int depth_; @@ -22,7 +20,7 @@ NewLineAndDepth_ newlineAndDepth(int n) /// inline -ostream & operator<<(ostream & os, NewLineAndDepth_ const & nlad_) +std::ostream & operator<<(std::ostream & os, NewLineAndDepth_ const & nlad_) { os << string(nlad_.depth_, ' '); return os; diff --git a/src/support/path.C b/src/support/path.C new file mode 100644 index 0000000000..7752dccb11 --- /dev/null +++ b/src/support/path.C @@ -0,0 +1,32 @@ +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "path.h" + +int Path::pop() +{ + if (popped_) { + // should throw an exception + // throw logical_error(); + // The use of WriteFSAlerrt makes this impossible + // to inline. + //WriteFSAlert(_("Error: Dir already popped: "), + // pushedDir_); + return 0; + } + if (lyx::chdir(pushedDir_.c_str())) { + // should throw an exception + // throw DirChangeError(); + // The use of WriteFSAlert makes this impossible + // to inline. + //WriteFSAlert( + // _("Error: Could not change to directory: "), + // pushedDir_); + } + popped_ = true; + return 0; +} + diff --git a/src/support/path.h b/src/support/path.h index 122e86fa20..e2e9908543 100644 --- a/src/support/path.h +++ b/src/support/path.h @@ -2,13 +2,15 @@ #ifndef PATH_H #define PATH_H -#include #include "LString.h" -#include "gettext.h" #include "support/filetools.h" -#include "lyx_gui_misc.h" #include "lyxlib.h" +#ifdef __GNUG__ +#pragma interface +#endif + +/// class Path { public: /// @@ -18,8 +20,12 @@ public: if (!path.empty()) { pushedDir_ = GetCWD(); if (pushedDir_.empty() || lyx::chdir(path.c_str())) { - WriteFSAlert(_("Error: Could not change to directory: "), - path); + // should throw an exception + // throw DirChangeError(); + // The use of WriteFSAlert makes this + // impossible to inline. + //WriteFSAlert(_("Error: Could not change to directory: "), + // path); } } else { popped_ = true; @@ -31,21 +37,7 @@ public: if (!popped_) pop(); } /// - int pop() - { - if (popped_) { - WriteFSAlert(_("Error: Dir already popped: "), - pushedDir_); - return 0; - } - if (lyx::chdir(pushedDir_.c_str())) { - WriteFSAlert( - _("Error: Could not change to directory: "), - pushedDir_); - } - popped_ = true; - return 0; - } + int pop(); private: /// bool popped_; diff --git a/src/table.C b/src/table.C index 95d8d6153a..2bf349786e 100644 --- a/src/table.C +++ b/src/table.C @@ -19,11 +19,14 @@ #endif #include "table.h" +#include "debug.h" #include "vspace.h" #include "layout.h" #include "support/lstrings.h" #include "support/lyxmanip.h" +using std::ostream; +using std::istream; using std::max; using std::endl; diff --git a/src/table.h b/src/table.h index 952440596c..56f8e91e7c 100644 --- a/src/table.h +++ b/src/table.h @@ -20,9 +20,6 @@ #include "lyxlex.h" #include "LString.h" -using std::ostream; -using std::istream; - /* The features the text class offers for tables */ /// @@ -163,19 +160,19 @@ public: void Init(int columns_arg, int rows_arg); /// - void Write(ostream &); + void Write(std::ostream &); /// - void Read(istream &); + void Read(std::istream &); // cell <0 will tex the preamble // returns the number of printed newlines /// - int TexEndOfCell(ostream &, int cell); + int TexEndOfCell(std::ostream &, int cell); /// - int DocBookEndOfCell(ostream &, int cell, int & depth); + int DocBookEndOfCell(std::ostream &, int cell, int & depth); #if 0 /// - int RoffEndOfCell(ostream &, int cell); + int RoffEndOfCell(std::ostream &, int cell); #endif /// char const * getDocBookAlign(int cell, bool isColumn = false); diff --git a/src/texrow.h b/src/texrow.h index c14fd23d09..674d3c58dc 100644 --- a/src/texrow.h +++ b/src/texrow.h @@ -18,8 +18,6 @@ #include -using std::list; - class LyXParagraph; // Controls correspondance between paragraphs and the generated LaTeX file @@ -67,7 +65,7 @@ private: /// unsigned int count; /// - typedef list RowList; + typedef std::list RowList; /// RowList rowlist; /// Last paragraph diff --git a/src/text.C b/src/text.C index e05567f44d..73e47c30ff 100644 --- a/src/text.C +++ b/src/text.C @@ -32,10 +32,12 @@ #include "lyxrow.h" #include "Painter.h" #include "tracer.h" +#include "font.h" using std::max; using std::min; using std::endl; +using std::pair; static const int LYX_PAPER_MARGIN = 20; @@ -175,7 +177,7 @@ int LyXText::SingleWidth(LyXParagraph * par, if (IsPrintable(c)) { if (lyxrc.rtl_support && lyxrc.font_norm == "iso8859-6.8x") c = TransformChar(c, par, pos); - return font.width(c); + return lyxfont::width(c, font); } else if (IsHfillChar(c)) { return 3; /* Because of the representation @@ -213,7 +215,7 @@ int LyXText::SingleWidth(LyXParagraph * par, } font.decSize(); font.decSize(); - return font.stringWidth(fs); + return lyxfont::width(fs, font); } else if (c == LyXParagraph::META_INSET) { Inset * tmpinset= par->GetInset(pos); if (tmpinset) @@ -226,7 +228,7 @@ int LyXText::SingleWidth(LyXParagraph * par, c = ' '; else if (IsNewlineChar(c)) c = 'n'; - return font.width(c); + return lyxfont::width(c, font); } @@ -371,8 +373,8 @@ void LyXText::draw(Row const * row, ++vpos; // Draw end-of-line marker LyXFont font = GetFont(row->par, pos); - int wid = font.width('n'); - int asc = font.maxAscent(); + int wid = lyxfont::width('n', font); + int asc = lyxfont::maxAscent(font); int y = offset + row->baseline; int xp[3], yp[3]; @@ -441,7 +443,7 @@ void LyXText::draw(Row const * row, fs = "margin"; // Draw a sign at the left margin! owner_->painter() - .text((LYX_PAPER_MARGIN - font.width('!'))/2, + .text((LYX_PAPER_MARGIN - lyxfont::width('!', font))/2, offset + row->baseline, "!", 1, font); break; case LyXParagraph::META_FIG: @@ -467,8 +469,8 @@ void LyXText::draw(Row const * row, font.decSize(); // calculate the position of the footnotemark - int y = (row->baseline - font2.maxAscent() - + font.maxAscent()); + int y = (row->baseline - lyxfont::maxAscent(font2) + + lyxfont::maxAscent(font)); font.setColor(LColor::footnote); @@ -477,7 +479,7 @@ void LyXText::draw(Row const * row, // draw it and set new x position pain.text(int(x), offset + y, fs, font); - x += pain.width(fs, font); + x += lyxfont::width(fs, font); pain.line(int(tmpx), offset + row->baseline, int(x), offset + row->baseline, LColor::footnote); @@ -529,7 +531,7 @@ void LyXText::draw(Row const * row, // Draw text and set the new x position pain.text(int(x), offset + row->baseline, textstring, font); - x += pain.width(textstring, font); + x += lyxfont::width(textstring, font); // what about underbars? if (font.underbar() == LyXFont::ON && font.latex() != LyXFont::ON) { @@ -562,16 +564,18 @@ int LyXText::LeftMargin(Row const * row) const int x = LYX_PAPER_MARGIN; - x += textclasslist.TextClass(parameters->textclass) - .defaultfont() - .signedStringWidth(textclasslist - .TextClass(parameters->textclass) - .leftmargin()); + x += lyxfont::signedWidth(textclasslist + .TextClass(parameters->textclass) + .leftmargin(), + textclasslist + .TextClass(parameters->textclass) + .defaultfont()); if (row->par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) { LyXFont font(LyXFont::ALL_SANE); font.setSize(LyXFont::SIZE_SMALL); - x += font.textWidth("Mwide-figM", 10) + LYX_PAPER_MARGIN/2; + x += lyxfont::width("Mwide-figM", font) + + LYX_PAPER_MARGIN/2; } // this is the way, LyX handles the LaTeX-Environments. @@ -629,41 +633,39 @@ int LyXText::LeftMargin(Row const * row) const switch (layout.margintype) { case MARGIN_DYNAMIC: if (!layout.leftmargin.empty()) { - x += textclasslist - .TextClass(parameters->textclass) - .defaultfont() - .signedStringWidth(layout.leftmargin); + x += lyxfont::signedWidth(layout.leftmargin, + textclasslist + .TextClass(parameters-> + textclass) + .defaultfont()); } - if (!row->par->GetLabestring().empty()) { - x += labelfont.signedStringWidth(layout.labelindent); - x += labelfont.stringWidth(row->par->GetLabestring()); - x += labelfont.stringWidth(layout.labelsep); + if (!row->par->GetLabelstring().empty()) { + x += lyxfont::signedWidth(layout.labelindent, + labelfont); + x += lyxfont::width(row->par->GetLabelstring(), labelfont); + x += lyxfont::width(layout.labelsep, labelfont); } break; case MARGIN_MANUAL: - x += labelfont.signedStringWidth(layout.labelindent); + x += lyxfont::signedWidth(layout.labelindent, labelfont); if (row->pos >= BeginningOfMainBody(row->par)) { if (!row->par->GetLabelWidthString().empty()) { - x += labelfont - .stringWidth(row->par - ->GetLabelWidthString()); - x += labelfont.stringWidth(layout.labelsep); + x += lyxfont::width(row->par->GetLabelWidthString(), + labelfont); + x += lyxfont::width(layout.labelsep, labelfont); } } break; case MARGIN_STATIC: - x += textclasslist.TextClass(parameters->textclass) - .defaultfont().signedStringWidth(layout.leftmargin) * 4 + x += lyxfont::signedWidth(layout.leftmargin, textclasslist.TextClass(parameters->textclass).defaultfont()) * 4 / (row->par->GetDepth() + 4); break; case MARGIN_FIRST_DYNAMIC: if (layout.labeltype == LABEL_MANUAL) { if (row->pos >= BeginningOfMainBody(row->par)) { - x += labelfont - .signedStringWidth(layout.leftmargin); + x += lyxfont::signedWidth(layout.leftmargin, labelfont); } else { - x += labelfont - .signedStringWidth(layout.labelindent); + x += lyxfont::signedWidth(layout.labelindent, labelfont); } } else if (row->pos // Special case to fix problems with @@ -671,14 +673,15 @@ int LyXText::LeftMargin(Row const * row) const || (layout.labeltype == LABEL_STATIC && layout.latextype == LATEX_ENVIRONMENT && ! row->par->IsFirstInSequence())) { - x += labelfont.signedStringWidth(layout.leftmargin); + x += lyxfont::signedWidth(layout.leftmargin, labelfont); } else if (layout.labeltype != LABEL_TOP_ENVIRONMENT && layout.labeltype != LABEL_BIBLIO && layout.labeltype != LABEL_CENTERED_TOP_ENVIRONMENT) { - x += labelfont.signedStringWidth(layout.labelindent); - x += labelfont.stringWidth(layout.labelsep); - x += labelfont.stringWidth(row->par->GetLabestring()); + x += lyxfont::signedWidth(layout.labelindent, + labelfont); + x += lyxfont::width(layout.labelsep, labelfont); + x += lyxfont::width(row->par->GetLabelstring(), labelfont); } break; @@ -700,8 +703,10 @@ int LyXText::LeftMargin(Row const * row) const minfill = tmprow->fill; } - x += textclasslist.TextClass(parameters->textclass) - .defaultfont().signedStringWidth(layout.leftmargin); + x += lyxfont::signedWidth(layout.leftmargin, + textclasslist + .TextClass(parameters->textclass) + .defaultfont()); x += minfill; } break; @@ -718,7 +723,7 @@ int LyXText::LeftMargin(Row const * row) const x += xx; } else { // should not happen LyXFont font(LyXFont::ALL_SANE); - x += font.stringWidth("XXXXXX"); + x += lyxfont::width("XXXXXX", font); } } @@ -742,8 +747,11 @@ int LyXText::LeftMargin(Row const * row) const && (row->par->layout || parameters->paragraph_separation == BufferParams::PARSEP_INDENT)) - x += textclasslist.TextClass(parameters->textclass) - .defaultfont().signedStringWidth(parindent); + x += lyxfont::signedWidth(parindent, + textclasslist + .TextClass(parameters + ->textclass) + .defaultfont()); else if (layout.labeltype == LABEL_BIBLIO) { // ale970405 Right width for bibitems x += bibitemMaxWidth(owner_->painter(), @@ -764,12 +772,12 @@ int LyXText::RightMargin(Row const * row) const row->par->GetLayout()); int x = LYX_PAPER_MARGIN - + textclasslist - .TextClass(parameters->textclass) - .defaultfont() - .signedStringWidth(textclasslist - .TextClass(parameters->textclass) - .rightmargin()); + + lyxfont::signedWidth(textclasslist + .TextClass(parameters->textclass) + .rightmargin(), + textclasslist + .TextClass(parameters->textclass) + .defaultfont()); if (row->par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) { x += LYX_PAPER_MARGIN / 2; @@ -811,9 +819,7 @@ int LyXText::RightMargin(Row const * row) const } //lyxerr << "rightmargin: " << layout->rightmargin << endl; - x += textclasslist.TextClass(parameters->textclass) - .defaultfont() - .signedStringWidth(layout.rightmargin) * 4 + x += lyxfont::signedWidth(layout.rightmargin, textclasslist.TextClass(parameters->textclass).defaultfont()) * 4 / (row->par->GetDepth() + 4); return x; } @@ -974,7 +980,8 @@ LyXText::NextBreakPoint(Row const * row, int width) const } ++i; if (i == main_body) { - x += GetFont(par, -2).stringWidth(layout.labelsep); + x += lyxfont::width(layout.labelsep, + GetFont(par, -2)); if (par->IsLineSeparator(i - 1)) x-= SingleWidth(par, i - 1); int left_margin = LabelEnd(row); @@ -1059,8 +1066,7 @@ int LyXText::Fill(Row const * row, int paper_width) const while (i <= last) { if (main_body > 0 && i == main_body) { - w += GetFont(row->par, -2). - stringWidth(layout.labelsep); + w += lyxfont::width(layout.labelsep, GetFont(row->par, -2)); if (row->par->IsLineSeparator(i - 1)) w -= SingleWidth(row->par, i - 1); int left_margin = LabelEnd(row); @@ -1071,7 +1077,7 @@ int LyXText::Fill(Row const * row, int paper_width) const ++i; } if (main_body > 0 && main_body > last) { - w += GetFont(row->par, -2).stringWidth(layout.labelsep); + w += lyxfont::width(layout.labelsep, GetFont(row->par, -2)); if (last >= 0 && row->par->IsLineSeparator(last)) w -= SingleWidth(row->par, last); int left_margin = LabelEnd(row); @@ -1111,13 +1117,11 @@ int LyXText::LabelFill(Row const * row) const int fill = 0; if (!row->par->labelwidthstring.empty()) { - fill = GetFont(row->par, -2) - .stringWidth(row->par->labelwidthstring) - w; + fill = max(lyxfont::width(row->par->labelwidthstring, + GetFont(row->par, -2)) - w, + 0); } - if (fill < 0) - fill = 0; - return fill; } @@ -1258,10 +1262,10 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const LyXFont labelfont = GetFont(par, -2); - int maxasc = int(font.maxAscent() * + int maxasc = int(lyxfont::maxAscent(font) * layout.spacing.getValue() * parameters->spacing.getValue()); - int maxdesc = int(font.maxDescent() * + int maxdesc = int(lyxfont::maxDescent(font) * layout.spacing.getValue() * parameters->spacing.getValue()); @@ -1293,8 +1297,8 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const if (maxsize > font.size()) { font.setSize(maxsize); - asc = font.maxAscent(); - desc = font.maxDescent(); + asc = lyxfont::maxAscent(font); + desc = lyxfont::maxDescent(font); if (asc > maxasc) maxasc = asc; if (desc > maxdesc) @@ -1344,7 +1348,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const /* do not forget the DTP-lines! * there height depends on the font of the nearest character */ if (firstpar->line_top) - maxasc += 2 * GetFont(firstpar, 0).ascent('x'); + maxasc += 2 * lyxfont::ascent('x', GetFont(firstpar, 0)); /* and now the pagebreaks */ if (firstpar->pagebreak_top) @@ -1354,10 +1358,10 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const * layout is printed in an extra row */ if (layout.labeltype == LABEL_COUNTER_CHAPTER && parameters->secnumdepth>= 0) { - labeladdon = int(labelfont.maxDescent() * + labeladdon = int(lyxfont::maxDescent(labelfont) * layout.spacing.getValue() * parameters->spacing.getValue()) - + int(labelfont.maxAscent() * + + int(lyxfont::maxAscent(labelfont) * layout.spacing.getValue() * parameters->spacing.getValue()); } @@ -1367,12 +1371,12 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const || layout.labeltype == LABEL_BIBLIO || layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) && row_ptr->par->IsFirstInSequence() - && !row_ptr->par->GetLabestring().empty()) { + && !row_ptr->par->GetLabelstring().empty()) { labeladdon = int( - (labelfont.maxAscent() * + (lyxfont::maxAscent(labelfont) * layout.spacing.getValue() * parameters->spacing.getValue()) - +(labelfont.maxDescent() * + +(lyxfont::maxDescent(labelfont) * layout.spacing.getValue() * parameters->spacing.getValue()) + layout.topsep * DefaultHeight() @@ -1441,7 +1445,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const /* do not forget the DTP-lines! * there height depends on the font of the nearest character */ if (firstpar->line_bottom) - maxdesc += 2 * (GetFont(par, par->Last()-1).ascent('x')); + maxdesc += 2 * lyxfont::ascent('x', GetFont(par, par->Last() - 1)); /* and now the pagebreaks */ if (firstpar->pagebreak_bottom) @@ -1676,7 +1680,7 @@ void LyXText::BreakParagraph(char keep_layout) /* table stuff -- end */ // well this is the caption hack since one caption is really enough - if (layout.labeltype == LABEL_SENSITIVE){ + if (layout.labeltype == LABEL_SENSITIVE) { if (!cursor.pos) cursor.par->SetLayout(0); // set to standard-layout else @@ -2775,7 +2779,7 @@ void LyXText::PrepareToPrint(Row * row, float & x, if (row->par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) { LyXFont font(LyXFont::ALL_SANE); font.setSize(LyXFont::SIZE_SMALL); - x += font.textWidth("Mwide-figM", 10); + x += lyxfont::width("Mwide-figM", font); } } else @@ -2866,7 +2870,8 @@ void LyXText::PrepareToPrint(Row * row, float & x, !row->par->IsLineSeparator(main_body-1))) { LyXLayout const & layout = textclasslist.Style(parameters->textclass, row->par->GetLayout()); - x += GetFont(row->par, -2).stringWidth(layout.labelsep); + x += lyxfont::width(layout.labelsep, + GetFont(row->par, -2)); if (main_body-1 <= last) x += fill_label_hfill; } @@ -3080,7 +3085,7 @@ char * LyXText::SelectNextWord(float & value) sel_cursor = cursor; #ifdef HAVE_SSTREAM - ostringstream latex; + std::ostringstream latex; #else ostrstream latex; #endif @@ -3128,7 +3133,7 @@ void LyXText::SelectSelectedWord() sel_cursor = cursor; #ifdef HAVE_SSTREAM - ostringstream latex; + std::ostringstream latex; #else ostrstream latex; #endif @@ -3315,8 +3320,6 @@ void LyXText::Delete() void LyXText::Backspace() { - DebugTracer trc1("LyXText::Backspace"); - /* table stuff -- begin */ if (cursor.par->table) { BackspaceInTable(); @@ -3332,8 +3335,6 @@ void LyXText::Backspace() LyXFont rawparfont = cursor.par->GetFontSettings(lastpos - 1); if (cursor.pos == 0) { - DebugTracer trc("LyXText::Backspace cursor.pos == 0"); - // The cursor is at the beginning of a paragraph, so the the backspace // will collapse two paragraphs into one. @@ -3446,8 +3447,6 @@ void LyXText::Backspace() SetCursor(cursor.par, cursor.pos); } } else { - DebugTracer trc("LyXText::Backspace normal backspace"); - /* this is the code for a normal backspace, not pasting * any paragraphs */ SetUndo(Undo::DELETE, @@ -3636,8 +3635,6 @@ void LyXText::Backspace() SetCursor(cursor.par, cursor.pos, false); } } - DebugTracer trc2("LyXText::Backspace wrap up"); - // restore the current font // That is what a user expects! current_font = rawtmpfont; @@ -3777,8 +3774,9 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) float old_tmpx = tmpx; if (main_body > 0 && pos == main_body-1) { tmpx += fill_label_hfill + - GetFont(row_ptr->par, -2).stringWidth( - textclasslist.Style(parameters->textclass, row_ptr->par->GetLayout()).labelsep); + lyxfont::width(textclasslist.Style(parameters->textclass, + row_ptr->par->GetLayout()).labelsep, + GetFont(row_ptr->par, -2)); if (row_ptr->par->IsLineSeparator(main_body-1)) tmpx -= SingleWidth(row_ptr->par, main_body-1); } @@ -3833,8 +3831,8 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) if (row_ptr->par->pextra_type == LyXParagraph::PEXTRA_MINIPAGE) { /* draw a marker at the left margin! */ LyXFont font = GetFont(row_ptr->par, 0); - int asc = font.maxAscent(); - int x = (LYX_PAPER_MARGIN - font.width('|')) / 2; + int asc = lyxfont::maxAscent(font); + int x = (LYX_PAPER_MARGIN - lyxfont::width('|', font)) / 2; int y1 = (offset + row_ptr->baseline); int y2 = (offset + row_ptr->baseline) - asc; pain.line(x, y1, x, y2, LColor::minipageline); @@ -3845,7 +3843,7 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) font.setColor(LColor::footnote); int box_x = LYX_PAPER_MARGIN; - box_x += font.textWidth(" wide-tab ", 10); + box_x += lyxfont::width(" wide-tab ", font); if (row_ptr->previous && row_ptr->previous->par->footnoteflag != LyXParagraph::OPEN_FOOTNOTE){ string fs; @@ -3876,8 +3874,8 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) pain.fillRectangle(LYX_PAPER_MARGIN, offset + 1, box_x - LYX_PAPER_MARGIN, - int(font.maxAscent() - + font.maxDescent()), + int(lyxfont::maxAscent(font) + + lyxfont::maxDescent(font)), LColor::footnotebg); pain.line(LYX_PAPER_MARGIN, offset, @@ -3885,21 +3883,21 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) LColor::footnoteframe); pain.text(LYX_PAPER_MARGIN, - offset + int(font.maxAscent()) + 1, + offset + int(lyxfont::maxAscent(font)) + 1, fs, font); pain.line(LYX_PAPER_MARGIN, offset, LYX_PAPER_MARGIN, - offset + int(font.maxAscent() - + font.maxDescent()), + offset + int(lyxfont::maxAscent(font) + + lyxfont::maxDescent(font)), LColor::footnoteframe); pain.line(LYX_PAPER_MARGIN, - offset + int(font.maxAscent() - + font.maxDescent()) + 1, + offset + int(lyxfont::maxAscent(font) + + lyxfont::maxDescent(font)) + 1, box_x, - offset + int(font.maxAscent() - + font.maxDescent()) + 1, + offset + int(lyxfont::maxAscent(font) + + lyxfont::maxDescent(font)) + 1, LColor::footnoteframe); } @@ -3921,7 +3919,7 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) font.setSize(LyXFont::SIZE_FOOTNOTE); int box_x = LYX_PAPER_MARGIN; - box_x += font.textWidth(" wide-tab ", 10); + box_x += lyxfont::width(" wide-tab ", font); pain.line(box_x, offset, paperwidth - LYX_PAPER_MARGIN, @@ -4020,7 +4018,7 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) } if (row_ptr->par->line_top) { /* draw a top line */ - y_top += GetFont(row_ptr->par, 0).ascent('x'); + y_top += lyxfont::ascent('x', GetFont(row_ptr->par, 0)); pain.line(0, offset + y_top, paperwidth, offset + y_top, @@ -4028,7 +4026,7 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) Painter::line_solid, Painter::line_thick); - y_top += GetFont(row_ptr->par, 0).ascent('x'); + y_top += lyxfont::ascent('x', GetFont(row_ptr->par, 0)); } /* should we print a label? */ @@ -4037,34 +4035,34 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) || layout.latextype != LATEX_ENVIRONMENT || row_ptr->par->IsFirstInSequence())) { font = GetFont(row_ptr->par, -2); - if (!row_ptr->par->GetLabestring().empty()) { + if (!row_ptr->par->GetLabelstring().empty()) { tmpx = x; - string tmpstring = row_ptr->par->GetLabestring(); + string tmpstring = row_ptr->par->GetLabelstring(); if (layout.labeltype == LABEL_COUNTER_CHAPTER) { if (parameters->secnumdepth >= 0){ /* this is special code for the chapter layout. This is printed in * an extra row and has a pagebreak at the top. */ - maxdesc = int(font.maxDescent() * layout.spacing.getValue() * parameters->spacing.getValue()) + maxdesc = int(lyxfont::maxDescent(font) * layout.spacing.getValue() * parameters->spacing.getValue()) + int(layout.parsep) * DefaultHeight(); if (direction == LYX_DIR_RIGHT_TO_LEFT) tmpx = paperwidth - LeftMargin(row_ptr) - - font.stringWidth(tmpstring); + lyxfont::width(tmpstring, font); pain.text(int(tmpx), offset + row_ptr->baseline - row_ptr->ascent_of_text - maxdesc, tmpstring, font); } } else { if (direction == LYX_DIR_LEFT_TO_RIGHT) - tmpx = x - font.stringWidth(layout.labelsep) - - font.stringWidth(tmpstring); + tmpx = x - lyxfont::width(layout.labelsep, font) + - lyxfont::width(tmpstring, font); else { tmpx = paperwidth - LeftMargin(row_ptr) - + font.stringWidth(layout.labelsep); + + lyxfont::width(layout.labelsep, font); if (row_ptr->par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) { LyXFont font(LyXFont::ALL_SANE); font.setSize(LyXFont::SIZE_SMALL); - tmpx += font.textWidth("Mwide-figM", 10); + tmpx += lyxfont::width("Mwide-fixM", font); } } /* draw it! */ @@ -4079,10 +4077,10 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) { if (row_ptr->par->IsFirstInSequence()) { font = GetFont(row_ptr->par, -2); - if (!row_ptr->par->GetLabestring().empty()) { - string tmpstring = row_ptr->par->GetLabestring(); + if (!row_ptr->par->GetLabelstring().empty()) { + string tmpstring = row_ptr->par->GetLabelstring(); - maxdesc = int(font.maxDescent() * layout.spacing.getValue() * parameters->spacing.getValue() + maxdesc = int(lyxfont::maxDescent(font) * layout.spacing.getValue() * parameters->spacing.getValue() + (layout.labelbottomsep * DefaultHeight())); tmpx = x; @@ -4090,10 +4088,10 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) tmpx = ( ((direction == LYX_DIR_LEFT_TO_RIGHT) ? x : LeftMargin(row_ptr) ) + paperwidth - RightMargin(row_ptr) ) / 2; - tmpx -= (font.stringWidth(tmpstring)/2); + tmpx -= lyxfont::width(tmpstring, font) / 2; } else if (direction == LYX_DIR_RIGHT_TO_LEFT) tmpx = paperwidth - LeftMargin(row_ptr) - - font.stringWidth(tmpstring); + lyxfont::width(tmpstring, font); pain.text(int(tmpx), offset + row_ptr->baseline - row_ptr->ascent_of_text @@ -4105,12 +4103,12 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) if (layout.labeltype == LABEL_BIBLIO && row_ptr->par->bibkey) { font = GetFont(row_ptr->par, -1); if (direction == LYX_DIR_LEFT_TO_RIGHT) - tmpx = x - font.stringWidth(layout.labelsep) + tmpx = x - lyxfont::width(layout.labelsep, font) - row_ptr->par->bibkey->width(owner_->painter(), font); else tmpx = paperwidth - LeftMargin(row_ptr) - + font.stringWidth(layout.labelsep); - row_ptr->par->bibkey->draw(owner_->painter(), + + lyxfont::width(layout.labelsep, font); + row_ptr->par->bibkey->draw(pain, font, offset + row_ptr->baseline, tmpx); @@ -4182,12 +4180,12 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) if (firstpar->line_bottom) { /* draw a bottom line */ - y_bottom -= GetFont(par, par->Last() - 1).ascent('x'); + y_bottom -= lyxfont::ascent('x', GetFont(par, par->Last() - 1)); pain.line(0, offset + y_bottom, paperwidth, offset + y_bottom, LColor::topline, Painter::line_solid, Painter::line_thick); - y_bottom -= GetFont(par, par->Last() - 1).ascent('x'); + y_bottom -= lyxfont::ascent('x', GetFont(par, par->Last() - 1)); } // draw an endlabel @@ -4195,7 +4193,7 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) if (endlabel == END_LABEL_BOX || endlabel == END_LABEL_FILLED_BOX) { LyXFont font = GetFont(row_ptr->par, last); - int size = int(0.75*font.maxAscent()); + int size = int(0.75 * lyxfont::maxAscent(font)); int y = (offset + row_ptr->baseline) - size; int x = (direction == LYX_DIR_LEFT_TO_RIGHT) ? paperwidth - LYX_PAPER_MARGIN - size @@ -4206,7 +4204,7 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) else { LyXFont font(LyXFont::ALL_SANE); font.setSize(LyXFont::SIZE_SMALL); - x += font.textWidth("Mwide-figM", 10); + x += lyxfont::width("Mwide-figM", font); } if (row_ptr->fill <= size) x += (size - row_ptr->fill + 1) * direction; @@ -4398,7 +4396,7 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) pos = vis2log(vpos); if (main_body > 0 && pos == main_body-1) { x += fill_label_hfill - + GetFont(row_ptr->par, -2).stringWidth(layout.labelsep) + + lyxfont::width(layout.labelsep, GetFont(row_ptr->par, -2)) - SingleWidth(row_ptr->par, main_body-1); } @@ -4494,7 +4492,7 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y) int LyXText::DefaultHeight() const { LyXFont font(LyXFont::ALL_SANE); - return int(font.maxAscent() + font.maxDescent() * 1.5); + return int(lyxfont::maxAscent(font) + lyxfont::maxDescent(font) * 1.5); } @@ -4557,7 +4555,8 @@ int LyXText::GetColumnNearX(Row * row, int & x) const last_tmpx = tmpx; if (main_body > 0 && c == main_body-1) { tmpx += fill_label_hfill + - GetFont(row->par, -2).stringWidth(layout.labelsep); + lyxfont::width(layout.labelsep, + GetFont(row->par, -2)); if (row->par->IsLineSeparator(main_body-1)) tmpx -= SingleWidth(row->par, main_body-1); } diff --git a/src/text2.C b/src/text2.C index 427f4d02d6..e091fb375b 100644 --- a/src/text2.C +++ b/src/text2.C @@ -35,12 +35,14 @@ #include "BufferView.h" #include "LyXView.h" #include "lyxrow.h" -#include "tracer.h" +#include "Painter.h" +#include "font.h" #define FIX_DOUBLE_SPACE 1 using std::copy; using std::endl; +using std::pair; LyXText::LyXText(BufferView * bv, int pw, Buffer * p) { @@ -1528,7 +1530,7 @@ void LyXText::SetCounter(LyXParagraph * par) const } #ifdef HAVE_SSTREAM - ostringstream s; + std::ostringstream s; #else ostrstream s; #endif @@ -1676,7 +1678,7 @@ void LyXText::SetCounter(LyXParagraph * par) const int number = par->getCounter(i + par->enumdepth); #ifdef HAVE_SSTREAM - ostringstream s; + std::ostringstream s; #else ostrstream s; #endif @@ -3101,12 +3103,14 @@ void LyXText::SetCursorIntern(LyXParagraph * par, pos = vis2log(vpos); if (main_body > 0 && pos == main_body-1) { x += fill_label_hfill + - GetFont(row->par, -2).stringWidth( - textclasslist.Style(parameters->textclass, row->par->GetLayout()).labelsep); + lyxfont::width(textclasslist + .Style(parameters->textclass, + row->par->GetLayout()) + .labelsep, + GetFont(row->par, -2)); if (row->par->IsLineSeparator(main_body-1)) x -= SingleWidth(row->par, main_body-1); } - if (HfillExpansion(row, pos)) { x += SingleWidth(row->par, pos); if (pos >= main_body) @@ -3190,7 +3194,7 @@ void LyXText::CursorLeft() const if (cursor.par->table) { int cell = NumberOfCell(cursor.par, cursor.pos); if (cursor.par->table->IsContRow(cell) && - cursor.par->table->CellHasContRow(cursor.par->table->GetCellAbove(cell))<0) { + cursor.par->table->CellHasContRow(cursor.par->table->GetCellAbove(cell)) < 0) { CursorUp(); } } @@ -3297,8 +3301,6 @@ void LyXText::CursorDownParagraph() const void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const { - DebugTracer trc1("1"); - // Would be wrong to delete anything if we have a selection. if (selection) return; @@ -3335,28 +3337,19 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const // If the pos around the old_cursor were spaces, delete one of them. if (old_cursor.par != cursor.par || old_cursor.pos != cursor.pos) { // Only if the cursor has really moved - DebugTracer trc2("2"); if (old_cursor.pos > 0 && old_cursor.pos < old_cursor.par->Last() && old_cursor.par->IsLineSeparator(old_cursor.pos) && old_cursor.par->IsLineSeparator(old_cursor.pos - 1)) { - DebugTracer trc3("3"); - - lyxerr << "Old cursor pos: " << old_cursor.pos << endl; old_cursor.par->Erase(old_cursor.pos - 1); status = LyXText::NEED_MORE_REFRESH; // correct cursor if (old_cursor.par == cursor.par && cursor.pos > old_cursor.pos) { - DebugTracer trc4("4"); - - //SetCursor(cursor.par, cursor.pos - 1); cursor.pos--; - } - - //else + } //else // SetCursor(cursor.par, cursor.pos); return; } @@ -3371,16 +3364,11 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const LyXCursor tmpcursor; if (old_cursor.par != cursor.par) { - DebugTracer trc5("5"); - if ( (old_cursor.par->Last() == 0 || (old_cursor.par->Last() == 1 && old_cursor.par->IsLineSeparator(0))) && old_cursor.par->FirstPhysicalPar() == old_cursor.par->LastPhysicalPar()) { - DebugTracer trc6("6"); - - // ok, we will delete anything // make sure that you do not delete any environments @@ -3395,22 +3383,16 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const || (old_cursor.row->next && old_cursor.row->next->par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE)) )) { - DebugTracer trc7("7"); - status = LyXText::NEED_MORE_REFRESH; deleted = true; if (old_cursor.row->previous) { - DebugTracer trc8("8"); - refresh_row = old_cursor.row->previous; refresh_y = old_cursor.y - old_cursor.row->baseline - refresh_row->height; tmpcursor = cursor; cursor = old_cursor; // that undo can restore the right cursor position LyXParagraph * endpar = old_cursor.par->next; if (endpar && endpar->GetDepth()) { - DebugTracer trc9("9"); - while (endpar && endpar->GetDepth()) { endpar = endpar->LastPhysicalPar()->Next(); } @@ -3423,9 +3405,6 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const // delete old row RemoveRow(old_cursor.row); if (params->paragraph == old_cursor.par) { - DebugTracer trc10("10"); - - params->paragraph = params->paragraph->next; } // delete old par @@ -3437,15 +3416,11 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const * next row can change its height, * if there is another layout before */ if (refresh_row->next) { - DebugTracer trc11("11"); - BreakAgain(refresh_row->next); UpdateCounters(refresh_row); } SetHeightOfRow(refresh_row); } else { - DebugTracer trc12("12"); - refresh_row = old_cursor.row->next; refresh_y = old_cursor.y - old_cursor.row->baseline; @@ -3453,8 +3428,6 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const cursor = old_cursor; // that undo can restore the right cursor position LyXParagraph *endpar = old_cursor.par->next; if (endpar && endpar->GetDepth()) { - DebugTracer trc13("13"); - while (endpar && endpar->GetDepth()) { endpar = endpar->LastPhysicalPar()->Next(); } @@ -3468,8 +3441,6 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const RemoveRow(old_cursor.row); // delete old par if (params->paragraph == old_cursor.par) { - DebugTracer trc14("14"); - params->paragraph = params->paragraph->next; } delete old_cursor.par; @@ -3481,8 +3452,6 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const if there is another layout before */ if (refresh_row) { - DebugTracer trc15("15"); - BreakAgain(refresh_row); UpdateCounters(refresh_row->previous); } @@ -3496,19 +3465,13 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const if (sel_cursor.par == old_cursor.par && sel_cursor.pos == sel_cursor.pos) { - DebugTracer trc16("16"); - // correct selection sel_cursor = cursor; } } } if (!deleted) { - DebugTracer trc17("17"); - - if (old_cursor.par->ClearParagraph()){ - DebugTracer trc18("18"); - + if (old_cursor.par->ClearParagraph()) { RedoParagraphs(old_cursor, old_cursor.par->Next()); // correct cursor y SetCursor(cursor.par, cursor.pos); diff --git a/src/toolbar.C b/src/toolbar.C index 66d45f4647..db68e6c949 100644 --- a/src/toolbar.C +++ b/src/toolbar.C @@ -533,3 +533,21 @@ void Toolbar::add(string const & func, bool doclean) add(tf, doclean); } } + + +void Toolbar::reset() +{ + toollist = 0; + cleaned = false; + lightReset(); +} + +// void Toolbar::lightReset() +// { +// standardspacing = 2; // the usual space between items +// sepspace = 6; // extra space +// xpos = sxpos - standardspacing; +// ypos = sypos; +// buttonwidth = 30; // the standard button width +// height = 30; // the height of all items in the toolbar +// } diff --git a/src/toolbar.h b/src/toolbar.h index febd7f9c13..c91d338ce4 100644 --- a/src/toolbar.h +++ b/src/toolbar.h @@ -106,8 +106,8 @@ private: IsBitmap = false; } /// - ~toolbarItem(){ - if (icon){ + ~toolbarItem() { + if (icon) { fl_delete_object(icon); fl_free_object(icon); } @@ -147,16 +147,16 @@ private: /** more... */ - void reset(){ - toollist = 0; - cleaned = false; - - lightReset(); - } + void reset();// { +// toollist = 0; +// cleaned = false; +// +// lightReset(); +// } /** more... */ - void lightReset(){ + void lightReset() { standardspacing = 2; // the usual space between items sepspace = 6; // extra space xpos = sxpos - standardspacing; diff --git a/src/tracer.h b/src/tracer.h index bcde291ee0..365cfa53dd 100644 --- a/src/tracer.h +++ b/src/tracer.h @@ -5,20 +5,18 @@ #include "debug.h" #include "LString.h" -using std::endl; - class DebugTracer { public: DebugTracer(string const & s) : str(s) { lyxerr << string(depth, ' ') << "Trace begin : " - << str << endl; + << str << std::endl; ++depth; } ~DebugTracer() { --depth; lyxerr << string(depth, ' ') << "Trace end : " - << str << endl; + << str << std::endl; } private: string str; diff --git a/src/trans_mgr.C b/src/trans_mgr.C index ed240cb591..327f771feb 100644 --- a/src/trans_mgr.C +++ b/src/trans_mgr.C @@ -17,6 +17,7 @@ #include "support/lstrings.h" using std::endl; +using std::pair; extern string DoAccent(string const &, tex_accent); extern string DoAccent(char, tex_accent); diff --git a/src/undo.h b/src/undo.h index ca904037d1..d378dc7a73 100644 --- a/src/undo.h +++ b/src/undo.h @@ -20,8 +20,6 @@ #include -using std::list; - /// class Undo { public: @@ -62,7 +60,7 @@ public: class UndoStack{ private: /// - typedef list Stakk; + typedef std::list Stakk; /// Stakk stakk; /// the maximum number of undo steps stored. diff --git a/src/vspace.C b/src/vspace.C index 565a9e4ca5..5128d52d1e 100644 --- a/src/vspace.C +++ b/src/vspace.C @@ -299,7 +299,7 @@ bool LyXLength::operator== (LyXLength const & other) const string LyXLength::asString() const { #ifdef HAVE_SSTREAM - ostringstream buffer; + std::ostringstream buffer; buffer << val << unit_name[uni]; // setw? return buffer.str().c_str(); #else @@ -345,7 +345,7 @@ bool LyXGlueLength::operator== (LyXGlueLength const & other) const string LyXGlueLength::asString() const { #ifdef HAVE_SSTREAM - ostringstream buffer; + std::ostringstream buffer; #else char tbuf[20]; ostrstream buffer(tbuf, 20); @@ -407,7 +407,7 @@ string LyXGlueLength::asString() const string LyXGlueLength::asLatexString() const { #ifdef HAVE_SSTREAM - ostringstream buffer; + std::ostringstream buffer; #else char tbuf[40]; ostrstream buffer(tbuf, 40); @@ -555,10 +555,10 @@ int VSpace::inPixels(BufferView * bv) const // This is how the skips are normally defined by // LateX. But there should be some way to change // this per document. - case SMALLSKIP: return height/4; - case MEDSKIP: return height/2; + case SMALLSKIP: return height / 4; + case MEDSKIP: return height / 2; case BIGSKIP: return height; - case VFILL: return 3*height; + case VFILL: return 3 * height; // leave space for the vfill symbol case LENGTH: // Pixel values are scaled so that the ratio