]> git.lyx.org Git - lyx.git/commitdiff
use the new sstream return non-pods as const, use string instead of char * in a lot...
authorLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 14 Sep 2000 17:53:12 +0000 (17:53 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 14 Sep 2000 17:53:12 +0000 (17:53 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1019 a592a061-630c-0410-9148-cb99ea01b6c8

195 files changed:
ChangeLog
Makefile.am
configure.in
po/POTFILES.in
src/BackStack.h
src/BufferView.h
src/BufferView2.C
src/BufferView_pimpl.C
src/BufferView_pimpl.h
src/Bullet.C
src/Bullet.h
src/FloatList.C
src/FloatList.h
src/FontInfo.C
src/FontInfo.h
src/ImportNoweb.C
src/ImportNoweb.h
src/LColor.C
src/LColor.h
src/LaTeX.h
src/LaTeXFeatures.C
src/LaTeXFeatures.h
src/Lsstream.h [new file with mode: 0644]
src/LyXAction.C
src/LyXAction.h
src/LyXView.C
src/LyXView.h
src/Makefile.am
src/MenuBackend.h
src/PainterBase.h
src/Spacing.C
src/Spacing.h
src/Variables.C
src/Variables.h
src/WorkArea.C
src/WorkArea.h
src/buffer.C
src/buffer.h
src/bufferlist.C
src/bufferlist.h
src/bufferparams.C
src/bufferview_funcs.C
src/bufferview_funcs.h
src/bullet_forms_cb.C
src/chset.C
src/chset.h
src/combox.C
src/combox.h
src/converter.C
src/converter.h
src/filedlg.C
src/filedlg.h
src/font.C
src/font.h
src/frontends/xforms/FormDocument.C
src/frontends/xforms/Toolbar_pimpl.C
src/graphics/EPS_Renderer.C
src/graphics/EPS_Renderer.h
src/graphics/GraphicsCache.C
src/graphics/GraphicsCache.h
src/graphics/GraphicsCacheItem.C
src/graphics/GraphicsCacheItem.h
src/graphics/GraphicsCacheItem_pimpl.C
src/graphics/GraphicsCacheItem_pimpl.h
src/graphics/Renderer.C
src/graphics/XPM_Renderer.C
src/insets/figinset.C
src/insets/figinset.h
src/insets/inset.C
src/insets/insetbib.C
src/insets/insetbib.h
src/insets/insetbutton.h
src/insets/insetcite.C
src/insets/insetcite.h
src/insets/insetcommand.C
src/insets/insetcommand.h
src/insets/inseterror.C
src/insets/inseterror.h
src/insets/insetert.C
src/insets/insetert.h
src/insets/insetexternal.C
src/insets/insetexternal.h
src/insets/insetfloat.C
src/insets/insetfloat.h
src/insets/insetfoot.C
src/insets/insetfoot.h
src/insets/insetgraphics.C
src/insets/insetgraphics.h
src/insets/insetgraphicsParams.C
src/insets/insetgraphicsParams.h
src/insets/insetinclude.C
src/insets/insetinclude.h
src/insets/insetindex.C
src/insets/insetindex.h
src/insets/insetinfo.C
src/insets/insetinfo.h
src/insets/insetlabel.C
src/insets/insetlabel.h
src/insets/insetlist.C
src/insets/insetlist.h
src/insets/insetmarginal.C
src/insets/insetmarginal.h
src/insets/insetminipage.C
src/insets/insetminipage.h
src/insets/insetparent.C
src/insets/insetparent.h
src/insets/insetquotes.C
src/insets/insetquotes.h
src/insets/insetref.C
src/insets/insetref.h
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/insets/insettext.h
src/insets/insettheorem.C
src/insets/insettheorem.h
src/insets/insettoc.C
src/insets/insettoc.h
src/insets/inseturl.C
src/insets/inseturl.h
src/insets/lyxinset.h
src/kbmap.C
src/kbmap.h
src/kbsequence.C
src/kbsequence.h
src/lastfiles.h
src/layout.C
src/layout.h
src/lyx_cb.C
src/lyx_cb.h
src/lyx_main.C
src/lyxfont.C
src/lyxfont.h
src/lyxfr0.C
src/lyxfr0.h
src/lyxfunc.C
src/lyxfunc.h
src/lyxlex.C
src/lyxlex.h
src/lyxparagraph.h
src/lyxtext.h
src/mathed/array.h
src/mathed/formula.C
src/mathed/formula.h
src/mathed/formulamacro.C
src/mathed/formulamacro.h
src/mathed/math_cursor.C
src/mathed/math_cursor.h
src/mathed/math_defs.h
src/mathed/math_draw.C
src/mathed/math_hash.C
src/mathed/math_inset.C
src/mathed/math_inset.h
src/mathed/math_iter.C
src/mathed/math_iter.h
src/mathed/math_macro.C
src/mathed/math_macro.h
src/mathed/math_panel.C
src/mathed/math_parser.C
src/mathed/math_parser.h
src/mathed/math_symbols.C
src/mathed/math_write.C
src/minibuffer.h
src/paragraph.C
src/spellchecker.C
src/support/Makefile.am
src/support/copy.C
src/support/filetools.C
src/support/filetools.h
src/support/getUserName.C
src/support/lstrings.h
src/support/lyxlib.h
src/support/lyxstring.C
src/support/lyxsum.C
src/support/sstream.h [new file with mode: 0644]
src/support/syscall.h
src/support/syscontr.h
src/support/textutils.h
src/support/translator.h
src/table.C
src/table.h
src/tabular.C
src/tabular.h
src/tex-accent.h
src/tex-strings.h
src/text.C
src/text2.C
src/trans.C
src/trans.h
src/trans_mgr.C
src/trans_mgr.h
src/vc-backend.C
src/vc-backend.h
src/vspace.C
src/vspace.h

index 4a4aa1ffe3063db5ba0d8975d2352442a4eeb0c4..e9be3ff21493d2e09eec94cee6037bb9fb285340 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2000-09-14  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * src/buffer.C (writeFile): try to fix the locale modified format
+       number to always be as we want it.
+
+       * src/WorkArea.C (work_area_handler): try to workaround the bugs
+       in XForms 0.89. C-space is now working again.
+
+       * src/Lsstream.h src/support/sstream.h: new files.
+
+       * also commented out all cases where strstream were used.
+       
+       * src/Bullet.h (c_str): remove method.
+       
+       * remove all stuff that is irrelevant when NEW_MENUBAR is defined
+       
+       * a lot of files: get rid of "char const *" and "char *" is as
+       many places as possible. We only want to use them in interaction
+       with system of other libraries, not inside lyx.
+       
+       * a lot of files: return const object is not of pod type. This
+       helps ensure that temporary objects is not modified. And fits well
+       with "programming by contract".
+
+       * configure.in: check for the locale header too 
+
+       * Makefile.am (sourcedoc): new tag for generation of doc++
+       documentation 
+
 2000-09-14  Juergen Vigna  <jug@sad.it>
 
        * src/frontends/xforms/FormDocument.C (ComboInputCB): fixed the
index 75ade4d09fb3ed018793883ae8c12d029712d90f..41372745b4ffdf1502257135bb7a6c0275aa8f25 100644 (file)
@@ -49,3 +49,8 @@ bindist:
        @echo "*** distribution and refer to *you* in case of problem."
        @echo "*** $(bindistfile) has been created."
 
+
+sourcedoc:
+       mkdir sourcedoc
+       cd sourcedoc
+       doc++ -p $(srcdir)/src/*.h
index 6a7c25ec51fe345493fefd0160356ef9a46d4e87..e46c4475436d10a56137adf058431ee39c2e9ec2 100644 (file)
@@ -94,7 +94,7 @@ LYX_CXX_CHEADERS
 LYX_STD_COUNT
 dnl we disable rtti for now
 dnl LYX_CXX_RTTI
-AC_CHECK_HEADERS(ostream istream sstream)
+AC_CHECK_HEADERS(ostream istream sstream locale)
 LYX_CXX_STL_MODERN_STREAMS
 
 ### We need a regex implementation, so we provide our own if none is found.
index a70f1b39b2df2e1025e53d75b8a5cfecd45a685d..70efb80a26b9d5b8cfd57f7e54f15ac9d1215a54 100644 (file)
@@ -119,7 +119,6 @@ src/mathed/formulamacro.C
 src/mathed/math_forms.C
 src/mathed/math_panel.C
 src/MenuBackend.C
-src/menus.C
 src/minibuffer.C
 src/PaperLayout.C
 src/paragraph.C
index ca5a1b5264ced59ecb0a6aef5fd0e02d2495adda..4974ce22d5aa60c968822663fad58a668d7e0221 100644 (file)
@@ -43,7 +43,7 @@ public:
                stakk.push(bit);
        }
        ///
-       string pop(int * x, int * y) {
+       string const pop(int * x, int * y) {
                BackStackItem bit = stakk.top();
                *x = bit.x;
                *y = bit.y;
index e1b3bc621812798597dc185814dfec066d444b7d..444fcaed49f2cecaa15c1465f16040e318ac4cc0 100644 (file)
@@ -124,7 +124,7 @@ public:
        ///
        void selectLastWord();
        ///
-       char * nextWord(float & value);
+       string const nextWord(float & value);
        ///
        void insertCorrectQuote();
        ///
index e58b0e4ef7665cdebe8851e7895d1aa701576b1e..d51763dcf865d69604140152f7b59120d4a21d2f 100644 (file)
@@ -678,16 +678,14 @@ void BufferView::insertCorrectQuote()
 
 
 /* these functions are for the spellchecker */ 
-char * BufferView::nextWord(float & value)
+string const BufferView::nextWord(float & value)
 {
        if (!available()) {
                value = 1;
                return 0;
        }
 
-       char * string = text->SelectNextWord(this, value);
-
-       return string;
+       return text->SelectNextWord(this, value);
 }
 
   
index affdf76346e0311d6d494785627f33ef9a6fa62d..17039740e0c6104dfd4f7840ff7f84b0876b957a 100644 (file)
@@ -26,9 +26,6 @@
 #include "intl.h"
 #include "support/LAssert.h"
 #include "frontends/Dialogs.h"
-#ifndef NEW_MENUBAR
-# include "menus.h"
-#endif
 
 #ifdef SIGC_CXX_NAMESPACES
 using SigC::slot;
@@ -162,22 +159,14 @@ void BufferView::Pimpl::buffer(Buffer * b)
                        updateScrollbar();
                }
                bv_->text->first = screen_->TopCursorVisible(bv_->text);
-#ifdef NEW_MENUBAR
                owner_->updateMenubar();
-#else
-               owner_->getMenus()->showMenus();
-#endif
                owner_->updateToolbar();
                redraw();
                owner_->getDialogs()->updateBufferDependent();
                bv_->insetWakeup();
        } else {
                lyxerr[Debug::INFO] << "  No Buffer!" << endl;
-#ifdef NEW_MENUBAR
                owner_->updateMenubar();
-#else
-               owner_->getMenus()->hideMenus();
-#endif
                owner_->updateToolbar();
                updateScrollbar();
                workarea_->redraw();
index e0a33d4aa415f5c2acb2b324fd53f0894dd3803f..46e9e3df182b8b70692e039ecc7b5e4a91d8ba25 100644 (file)
@@ -137,7 +137,9 @@ struct BufferView::Pimpl : public Object {
         ///
         BackStack backstack;
        ///
-       int last_click_x, last_click_y;
+       int last_click_x;
+       ///
+       int last_click_y;
        ///
        WorkArea * workarea_;
        ///
index 70b842608a1b000b34117629e59475a8bb5daf22..b14aea8e91566529ca34c0d3c441e314c01e5c12 100644 (file)
@@ -62,7 +62,7 @@ string const & Bullet::getText() const
 }
 
 
-bool operator == (const Bullet & b1, const Bullet & b2)
+bool operator==(const Bullet & b1, const Bullet & b2)
 {
        bool result = false;
 
@@ -109,7 +109,7 @@ void Bullet::generateText() const
 }
 
 
-string Bullet::bulletSize(short int s)
+string const Bullet::bulletSize(short int s)
 {
        // use a parameter rather than hard code `size' in here
        // in case some future function may want to retrieve
@@ -125,7 +125,7 @@ string Bullet::bulletSize(short int s)
 }
 
 
-string Bullet::bulletEntry(short int f, short int c)
+string const Bullet::bulletEntry(short int f, short int c)
 {
        // Despite how this may at first appear the static local variables
        // are only initialized once..
index f761dd8cf235bec2cd329800c6eaf22e37bb5cd2..b1eb94d5163b9cdb17db104343d56ddd67109f0c 100644 (file)
@@ -49,15 +49,9 @@ public:
        ///
        string const & getText() const;
        ///
-       char const * c_str() const;
-       ///
-       Bullet & operator = (Bullet const &);
+       Bullet & operator=(Bullet const &);
        ///
        friend bool operator==(Bullet const &, Bullet const &);
-       ///
-       friend bool operator!=(Bullet const & b1, Bullet const & b2) {
-               return !(b1 == b2);
-       }
 protected:
 #ifdef ENABLE_ASSERTIONS
        ///
@@ -107,9 +101,9 @@ private:
        ///
        void generateText() const;
        ///
-       static string bulletSize(short int);
+       static string const bulletSize(short int);
        ///
-       static string bulletEntry(short int, short int);
+       static string const bulletEntry(short int, short int);
        
        ///
        short font;
@@ -245,16 +239,14 @@ Bullet & Bullet::operator=(Bullet const & b)
        return *this;
 }
 
+/*-----------------End Bullet Member Functions-----------------*/
 
 inline
-char const * Bullet::c_str() const
+bool operator!=(Bullet const & b1, Bullet const & b2)
 {
-       return getText().c_str();
+       return !(b1 == b2);
 }
 
-
-/*-----------------End Bullet Member Functions-----------------*/
-
 ///
 extern
 Bullet const ITEMIZE_DEFAULTS[];
index fbbfa370a0caf7a0db3223272e3cfa40a3033da6..0bfabdfb6f1594dc75c6f6ebf9009b75e1ace12c 100644 (file)
@@ -47,7 +47,7 @@ void FloatList::newFloat(Floating const & fl)
 }
 
 
-string FloatList::defaultPlacement(string const & t) const
+string const FloatList::defaultPlacement(string const & t) const
 {
        List::const_iterator cit = list.find(t);
        if (cit != list.end())
index aed0dfa79b7f92f7766a1e5136a494c5cc6614e0..a1bab70dcf63ad9de28569e7b67b695d62b882d3 100644 (file)
@@ -31,7 +31,7 @@ public:
        ///
        void newFloat(Floating const & fl);
        ///
-       string defaultPlacement(string const & t) const;
+       string const defaultPlacement(string const & t) const;
        ///
        bool typeExist(string const & t) const;
        ///
index c61d6662bb8ff680209ea98e5ecfb94ac6104245..1ccb10816fa43395193a6edd6ea7d85bff603117 100644 (file)
@@ -27,7 +27,7 @@
 using std::endl;
 
 /// Load font close to this size
-string FontInfo::getFontname(int size)
+string const FontInfo::getFontname(int size)
 {
        if (!exist())
                return string();
@@ -71,7 +71,7 @@ string FontInfo::getFontname(int size)
 
 
 /// Build newly sized font string 
-string FontInfo::resize(string const & font, int size) const
+string const FontInfo::resize(string const & font, int size) const
 {
        string ret(font);
        // Find the position of the size spec
index d3d2e8b0a08a5b6216c0a7fad11f196be0f87f65..3bc79d913599721eb1a2b16d3060c0e832ad5338 100644 (file)
@@ -51,14 +51,14 @@ public:
        }
 
        /// Get existing pattern
-       string getPattern() const { return pattern; }
+       string const getPattern() const { return pattern; }
 
        /// Set new pattern
        void setPattern(string const & pat);
 
        /** Return full name of font close to this size.
          If impossible, result is the empty string */
-       string getFontname(int size);
+       string const getFontname(int size);
 private:
        /// Font pattern (with wildcard for size)
        string pattern;
@@ -91,6 +91,6 @@ private:
        void query();
 
        /// Build newly sized font string 
-       string resize(string const &, int size) const;
+       string const resize(string const &, int size) const;
 };
 #endif
index 31c30bdd7890cb299200e6a7aeea0f71f604c13e..28e6f425cc0dc0e347cabe28a3356d7762ea55b7 100644 (file)
@@ -52,7 +52,7 @@ Buffer * ImportNoweb::run()
 
 
 // Provide the literate documentclass by parsing the file.
-string ImportNoweb::documentclass()
+string const ImportNoweb::documentclass()
 {
        string result = "literate-article"; // Default
 
index c83d148341e60b13fb3594ed00b08830b8584c0b..5bb967b9f26c3da537cef8b7da88a9fe96bffd19 100644 (file)
@@ -39,7 +39,7 @@ private:
        ///
        string file;
        ///
-       string documentclass();
+       string const documentclass();
        ///
        enum {
                ///
index 8ba1e503d757a136bda1e8faec9bb3d817144019..adf5c73e42c325294656e3c103b8811bbb41223f 100644 (file)
@@ -119,7 +119,7 @@ LColor::LColor()
 }
 
 
-string LColor::getGUIName(LColor::color c) const
+string const LColor::getGUIName(LColor::color c) const
 {
        InfoTab::const_iterator ici = infotab.find(c);
        if (ici != infotab.end())
@@ -129,7 +129,7 @@ string LColor::getGUIName(LColor::color c) const
 }
 
 
-string LColor::getX11Name(LColor::color c) const
+string const LColor::getX11Name(LColor::color c) const
 {
        InfoTab::const_iterator ici = infotab.find(c);
        if (ici != infotab.end()) 
@@ -142,7 +142,7 @@ string LColor::getX11Name(LColor::color c) const
 }
 
 
-string LColor::getLaTeXName(LColor::color c) const
+string const LColor::getLaTeXName(LColor::color c) const
 {
        InfoTab::const_iterator ici = infotab.find(c);
        if (ici != infotab.end())
@@ -151,7 +151,7 @@ string LColor::getLaTeXName(LColor::color c) const
 }
 
 
-string LColor::getLyXName(LColor::color c) const
+string const LColor::getLyXName(LColor::color c) const
 {
        InfoTab::const_iterator ici = infotab.find(c);
        if (ici != infotab.end())
@@ -196,7 +196,7 @@ LColor::color LColor::getFromGUIName(string const & guiname) const
                if (!compare_no_case((*ici).second.guiname, guiname))
                        return (*ici).first;
        }
-       return LColor::ignore;
+       return LColor::inherit;
 }
 
 
index e282761c1b2d8abb24982c78efddc7be0ee038ad..6f8af995b508354f25cdfb80ddbac7b3b9bd0b45 100644 (file)
@@ -176,16 +176,16 @@ public:
        ///
        bool setColor(string const & lyxname, string const & x11name);
        /// Get GUI name of color
-       string getGUIName(LColor::color c) const;
+       string const getGUIName(LColor::color c) const;
 
        /// Get X11 name of color
-       string getX11Name(LColor::color c) const;
+       string const getX11Name(LColor::color c) const;
 
        /// Get LaTeX name of color
-       string getLaTeXName(LColor::color c) const;
+       string const getLaTeXName(LColor::color c) const;
 
        /// Get LyX name of color
-       string getLyXName(LColor::color c) const;
+       string const getLyXName(LColor::color c) const;
        ///
        LColor::color getFromGUIName(string const & guiname) const;
        ///
index 89325b2a2639c06de7530299cac5028e75f38700..e49069544228b1d79eaa9c3ff0aaa68fa16ac8d4 100644 (file)
@@ -23,6 +23,8 @@
 #include "DepTable.h"
 #include <vector>
 
+#include "support/utility.hpp"
+
 class MiniBuffer;
 
 ///
@@ -61,7 +63,7 @@ private:
 
 
 ///
-class LaTeX {
+class LaTeX : public noncopyable {
 public:
        /** Return values from scanLogFile() and run() (to come)
            
@@ -122,11 +124,6 @@ protected:
        /// The dependency file.
        string depfile;
 
-       /// unavail
-       LaTeX(LaTeX const &);
-       /// unavail
-       LaTeX & operator= (LaTeX const &);
-       
        ///
        void deplog(DepTable & head);
 
index eeecf32930c83c07c6e0243ca32caa95df498f06..6fa3da722bb7d1b59c5184d34711e521e6609fb0 100644 (file)
@@ -32,7 +32,7 @@ LaTeXFeatures::LaTeXFeatures(BufferParams const & p, int n)
        array = false;
        color = false;
        graphics = false; // INSET_GRAPHICS: remove this when InsetFig is thrown.
-    graphicx = false;
+       graphicx = false;
        setspace = false;
        makeidx = false;
        verbatim = false;
@@ -74,7 +74,9 @@ LaTeXFeatures::LaTeXFeatures(BufferParams const & p, int n)
        NeedLyXMinipageIndent = false;
 }
 
-void LaTeXFeatures::require(string const & name) {
+
+void LaTeXFeatures::require(string const & name)
+{
        if (name == "array") {
                array = true;
        } else if (name == "color") {
@@ -121,7 +123,8 @@ void LaTeXFeatures::require(string const & name) {
        }
 }
 
-string LaTeXFeatures::getPackages()
+
+string const LaTeXFeatures::getPackages()
 {
        string packages;
        LyXTextClass const & tclass =
@@ -158,7 +161,7 @@ string LaTeXFeatures::getPackages()
                                + params.graphicsDriver + "]{graphicx}\n";
        }
 
-    // INSET_GRAPHICS: remove this when InsetFig is thrown.
+       // INSET_GRAPHICS: remove this when InsetFig is thrown.
        // graphics.sty
        if (graphics && params.graphicsDriver != "none") {
                if (params.graphicsDriver == "default")
@@ -200,22 +203,22 @@ string LaTeXFeatures::getPackages()
                packages += "\\doublespacing\n";
                break;
        case Spacing::Other:
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                std::ostringstream value;
-#else
-               char val[30];
-               ostrstream value(val, 30);
-               
-#endif
+//#else
+//             char val[30];
+//             ostrstream value(val, 30);
+//             
+//#endif
                value << params.spacing.getValue(); // setw?
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                packages += string("\\setstretch{") 
                          + value.str().c_str() + "}\n";
-#else
-               value << '\0';
-               packages += string("\\setstretch{") 
-                         + value.str() + "}\n";
-#endif
+//#else
+//             value << '\0';
+//             packages += string("\\setstretch{") 
+//                       + value.str() + "}\n";
+//#endif
                break;
        }
 
@@ -273,7 +276,7 @@ string LaTeXFeatures::getPackages()
 }
 
 
-string LaTeXFeatures::getMacros()
+string const LaTeXFeatures::getMacros()
 {
        string macros;
 
@@ -330,7 +333,7 @@ string LaTeXFeatures::getMacros()
 }
 
 
-string LaTeXFeatures::getTClassPreamble()
+string const LaTeXFeatures::getTClassPreamble()
 {
        // the text class specific preamble 
        LyXTextClass const & tclass =
@@ -347,7 +350,7 @@ string LaTeXFeatures::getTClassPreamble()
 }      
 
 
-string LaTeXFeatures::getIncludedFiles()
+string const LaTeXFeatures::getIncludedFiles()
 {
        string sgmlpreamble;
        FileMap::const_iterator end = IncludedFiles.end();
index f8cc2e63aec019b3ac1f1e7473d1e1e6557de43c..5e6ff72c565b86a48e8ad858d4cbd22b4d16b195 100644 (file)
@@ -36,13 +36,13 @@ struct LaTeXFeatures {
        ///
        LaTeXFeatures(BufferParams const &, int n) ;
        /// The packaes needed by the document
-       string getPackages();
+       string const getPackages();
        /// The macros definitions needed by the document
-       string getMacros();
+       string const getMacros();
        /// The definitions needed by the document's textclass
-       string getTClassPreamble();
+       string const getTClassPreamble();
        ///
-       string getIncludedFiles();
+       string const getIncludedFiles();
 
        ///
        void showStruct();
diff --git a/src/Lsstream.h b/src/Lsstream.h
new file mode 100644 (file)
index 0000000..8d171d2
--- /dev/null
@@ -0,0 +1,21 @@
+// -*- C++ -*-
+/* This file is part of
+ * ======================================================
+ * 
+ *           LyX, The Document Processor
+ *      
+ *         Copyright 1995 Matthias Ettrich
+ *          Copyright 1995-2000 The LyX Team.
+ *
+ * ====================================================== */
+
+#ifndef LSSTREAM_H
+#define LSSTREAM_H 
+
+#ifdef HAVE_SSTREAM
+#include <sstream>
+#else
+#include "support/sstream.h"
+#endif
+
+#endif
index 670230d9a4c8ab12cf7fd5eefd5a35e59f26aa36..6df70fef843223881a8943b59308dd64fc5689a4 100644 (file)
@@ -609,7 +609,7 @@ int LyXAction::getApproxFunc(string const & func) const
 }
 
 
-string LyXAction::getApproxFuncName(string const & func) const
+string const LyXAction::getApproxFuncName(string const & func) const
 {
        int f = getApproxFunc(func);
        // This will return empty string if f isn't an action.
@@ -617,7 +617,7 @@ string LyXAction::getApproxFuncName(string const & func) const
 }
 
 
-string LyXAction::getActionName(int action) const
+string const LyXAction::getActionName(int action) const
 {
        kb_action ac;
        string arg;
@@ -639,7 +639,7 @@ string LyXAction::getActionName(int action) const
 
 // Returns one line help associated with a (pseudo)action, i.e. appends
 // the argument of the action if necessary
-string LyXAction::helpText(int pseudoaction) const
+string const LyXAction::helpText(int pseudoaction) const
 {
        string help, arg;
        kb_action action;
index 19790c32e5f9bcb473bfeca5393067012d779d68..cf611e3c35283903d8687031497598d3ee77424e 100644 (file)
@@ -74,7 +74,7 @@ public:
 
         /** Returns an action name the most similar to a string.
            Don't include arguments, they would be ignored. */
-        string getApproxFuncName(string const & func) const;
+        string const getApproxFuncName(string const & func) const;
 
        /// Returns a pseudo-action given an action and its argument.
        int getPseudoAction(kb_action action, string const & arg) const;
@@ -89,10 +89,10 @@ public:
        bool isPseudoAction(int) const;
     
        /// Return the name associated with command
-       string getActionName(int action) const;
+       string const getActionName(int action) const;
 
        /// Return one line help text associated with (pseudo)action
-       string helpText(int action) const;
+       string const helpText(int action) const;
 
        /// True if the command has `flag' set
        bool funcHasFlag(kb_action action, func_attrib flag) const;
index 2e28a73a6828f054b3b38877de24b9ccbbaf4914..5f0deb8c66cf1ece1d9af17e0d4fb6260c83da40 100644 (file)
 #include "buffer.h"
 #include "frontends/Dialogs.h"
 #include "frontends/Toolbar.h"
-#ifdef NEW_MENUBAR
-# include "frontends/Menubar.h"
-# include "MenuBackend.h"
-#else
-# include "menus.h"
-#endif
+#include "frontends/Menubar.h"
+#include "MenuBackend.h"
 #include "ToolbarDefaults.h"
 #include "lyx_gui_misc.h"      // [update,Close]AllBufferRelatedDialogs
 #include "bufferview_funcs.h" // CurrentState()
@@ -83,11 +79,7 @@ LyXView::LyXView(int width, int height)
 
 LyXView::~LyXView()
 {
-#ifdef NEW_MENUBAR
        delete menubar;
-#else
-       delete menus;
-#endif
        delete toolbar;
        delete bufferview;
        delete minibuffer;
@@ -155,7 +147,6 @@ MiniBuffer * LyXView::getMiniBuffer() const
 }
 
 
-#ifdef NEW_MENUBAR
 Menubar * LyXView::getMenubar() const
 {
        return menubar;
@@ -171,13 +162,6 @@ void LyXView::updateMenubar()
                menubar->set("main");
 }
 
-#else
-Menus * LyXView::getMenus() const
-{
-       return menus;
-}
-#endif
-
 
 Intl * LyXView::getIntl() const
 {
@@ -224,9 +208,9 @@ void LyXView::setPosition(int x, int y)
 }
 
 
-void LyXView::show(int place, int border, char const * title)
+void LyXView::show(int place, int border, string const & title)
 {
-       fl_show_form(form_, place, border, title);
+       fl_show_form(form_, place, border, title.c_str());
        minibuffer->Init();
        InitLyXLookup(fl_display, form_->window);
 }
@@ -254,11 +238,7 @@ void LyXView::create_form_form_main(int width, int height)
        //
        // THE MENUBAR
        //
-#ifdef NEW_MENUBAR
        menubar = new Menubar(this, menubackend);
-#else  
-       menus = new Menus(this, air);
-#endif
 
        //
        // TOOLBAR
@@ -332,9 +312,7 @@ void LyXView::init()
        invalidateLayoutChoice();
        updateLayoutChoice();
        UpdateDocumentClassChoice();
-#ifdef NEW_MENUBAR
        updateMenubar();
-#endif
        
        // Start autosave timer
        if (lyxrc.autosave) {
index 85f56b7fd73f02171ca5371cb8d099fe2415d811..af420cad927c5c77d31d2bbc5d977d0b610f3bb3 100644 (file)
 
 #include FORMS_H_LOCATION
 
+#include "LString.h"
 #include "Timeout.h"
 #include "support/utility.hpp"
 
-// uncomment this line to try out the new menus
-#define NEW_MENUBAR 1
 
 class LyXFunc;
 class Toolbar;
 class MiniBuffer;
 class Intl;
 class Buffer;
-#ifdef NEW_MENUBAR
 class Menubar;
-#else
-class Menus;
-#endif
 
 class BufferView;
 class Dialogs;
@@ -60,7 +55,7 @@ public:
        void setPosition(int, int);
 
        /// Show the main form.
-       void show(int, int, char const * t = "LyX");
+       void show(int, int, string const & t = string("LyX"));
 
        /// init (should probably be removed later) (Lgb)
        void init();
@@ -92,16 +87,12 @@ public:
        /// return a pointer to the minibuffer
        MiniBuffer * getMiniBuffer() const;
 
-#ifdef NEW_MENUBAR
        ///
        Menubar * getMenubar() const;
 
        ///
        void updateMenubar();
-#else
-       ///
-       Menus * getMenus() const;
-#endif
+
        ///
        Intl * getIntl() const;
 
@@ -127,13 +118,8 @@ private:
        Toolbar * toolbar;
        /// 
        MiniBuffer * minibuffer;
-#ifdef NEW_MENUBAR
        ///
        Menubar * menubar;
-#else
-       ///
-       Menus * menus;
-#endif
        ///
        Intl * intl;
        ///
index 0623dc00f9c9a756b18458529ef6beed510448ab..83ef229a09e7e47d7e8edd9ce7de5a77f5344124 100644 (file)
@@ -56,6 +56,7 @@ lyx_SOURCES = \
        LaTeXLog.C \
        Literate.C \
        Literate.h \
+       Lsstream.h \
        LyXAction.C \
        LyXAction.h \
        LyXSendto.C \
@@ -192,8 +193,6 @@ lyx_SOURCES = \
        lyxvc.C \
        lyxvc.h \
        main.C \
-       menus.C \
-       menus.h \
        minibuffer.C \
        minibuffer.h \
        nt_defines.h \
@@ -208,8 +207,6 @@ lyx_SOURCES = \
        spellchecker.C \
        spellchecker.h \
        stl_string_fwd.h \
-       table.C \
-       table.h \
        tabular.C \
        tabular.h \
        tex-accent.C \
index d0a3e1e8dd5ce80f37aab63afc24e11ce1bbe710..7ceb6c6ec5cefd5ac41918415fb7c31ca362c5d7 100644 (file)
@@ -61,9 +61,9 @@ public:
                 string const & command = string(), 
                 bool optional = false);
        /// The label of a given menuitem
-       string label() const { return token(label_, '|', 0); }
+       string const label() const { return token(label_, '|', 0); }
        ///
-       string shortcut() const { return token(label_, '|', 1); }
+       string const shortcut() const { return token(label_, '|', 1); }
        /// The kind of entry
        Kind kind() const { return kind_; } 
        /// the action (if relevant)
index 11624821e7a614b82ba3b3d52305255d487b66f0..771baec8b980c6fcd9a059fcc43c79ba48de8bd5 100644 (file)
@@ -153,7 +153,7 @@ public:
        
        /// Draw a string at position x, y (y is the baseline)
        virtual PainterBase & text(int x, int y,
-                                  string const &str, LyXFont const & f) = 0;
+                                  string const & str, LyXFont const & f) = 0;
 
        /** Draw a string at position x, y (y is the baseline)
            This is just for fast drawing */
index f3ad1f66727ce77e460994540611342552045d3f..635ef1416975c462fbe82206bbf4655777d72a22 100644 (file)
@@ -14,6 +14,7 @@
 #pragma implementation
 #endif
 
+#if 0
 #ifdef HAVE_SSTREAM
 #include <sstream>
 using std::istringstream;
@@ -21,6 +22,9 @@ using std::ostringstream;
 #else
 #include <strstream>
 #endif
+#else
+#include "Lsstream.h"
+#endif
 
 #include "Spacing.h"
 #include "LString.h"
@@ -60,14 +64,14 @@ void Spacing::set(Spacing::Space sp, float val)
 }
 
 
-void Spacing::set(Spacing::Space sp, char const * val)
+void Spacing::set(Spacing::Space sp, string const & val)
 {
        float fval;
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
        istringstream istr(val);
-#else
-       istrstream istr(val);
-#endif
+//#else
+//     istrstream istr(val.c_str());
+//#endif
        istr >> fval;
        set(sp, fval);
 }
@@ -90,7 +94,7 @@ void Spacing::writeFile(ostream & os, bool para) const
 }
 
 
-string Spacing::writeEnvirBegin() const
+string const Spacing::writeEnvirBegin() const
 {
        switch(space) {
        case Default: break; // do nothing
@@ -101,26 +105,28 @@ string Spacing::writeEnvirBegin() const
        case Double:
                return "\\begin{doublespace}";
        case Other:
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
+       {
                ostringstream ost;
                ost << "\\begin{spacing}{"
                    << getValue() << "}";
                return ost.str().c_str();
-#else
-               {
-                       char tmp[512];
-                       ostrstream ost(tmp, 512);
-                       ost << "\\begin{spacing}{"
-                           << getValue() << "}" << '\0';
-                       return ost.str();
-               }
-#endif
+       }
+//#else
+//     {
+//             char tmp[512];
+//             ostrstream ost(tmp, 512);
+//             ost << "\\begin{spacing}{"
+//                 << getValue() << "}\0";
+//             return ost.str();
+//     }
+//#endif
        }
        return string();
 }
 
 
-string Spacing::writeEnvirEnd() const
+string const Spacing::writeEnvirEnd() const
 {
        switch(space) {
        case Default: break; // do nothing
index 120b14b97a875a06850acd39ee566ab6178e190a..98f9463250fe4979d03906f0b7ac221aea6bb09e 100644 (file)
@@ -49,25 +49,33 @@ public:
        ///
        void set(Spacing::Space sp, float val = 1.0);
        ///
-       void set(Spacing::Space sp, char const * val) ;
+       void set(Spacing::Space sp, string const & val) ;
        ///
        void writeFile(std::ostream &, bool para = false) const;
        ///
-       string writeEnvirBegin() const;
+       string const writeEnvirBegin() const;
        ///
-       string writeEnvirEnd() const;
-       ///
-       friend bool operator==(Spacing const & a, Spacing const & b) {
-               return a.space == b.space && a.getValue() == b.getValue();
-       }
-       ///
-       friend bool operator!=(Spacing const & a, Spacing const & b) {
-               return !(a == b);
-       }
+       string const writeEnvirEnd() const;
 private:
        ///
        Space space;
        ///
        float value;
 };
+
+
+///
+inline
+bool operator==(Spacing const & a, Spacing const & b)
+{
+       return a.getSpace() == b.getSpace()
+               && a.getValue() == b.getValue();
+}
+
+///
+inline
+bool operator!=(Spacing const & a, Spacing const & b)
+{
+       return !(a == b);
+}
 #endif
index 9f4a516e3829a372d77bd8fbb833849281c8030c..c20ed86bdbae361590da1ec9f741c0f22e5f36ef 100644 (file)
@@ -27,7 +27,7 @@ void Variables::set(string const & var, string const & val)
 }
 
 
-string Variables::get(string const & var) const
+string const Variables::get(string const & var) const
 {
   Vars::const_iterator cit = vars_.find(var);
   if (cit != vars_.end()) 
@@ -44,7 +44,7 @@ bool Variables::isset(string const & var) const
 }
 
 
-string Variables::expand(string const & s) const
+string const Variables::expand(string const & s) const
 {
   string str(s);
   LRegex reg("\\$\\{\\(.*\\)\\}");
index 45747927c158f9040bf4219664f44c4926b27d40..1b71983911299a84ad2d349a8a1fa6e481594ae7 100644 (file)
@@ -26,11 +26,11 @@ public:
   /// 
   void set(string const &, string const &);
   /// 
-  string get(string const &) const;
+  string const get(string const &) const;
   ///
   bool isset(string const & var) const;
   /// 
-  string expand(string const &) const;
+  string const expand(string const &) const;
 private:
   ///
   typedef std::map<string, string> Vars;
index 02f5e97e70016520ac1910dc2229a797363e1e48..0bb29e960b8cf675b860683ae3e3601dd31054e1 100644 (file)
@@ -40,6 +40,7 @@ void waitForX()
        XSync(fl_get_display(), 0);
 }
 
+
 extern "C" {
 // Just a bunch of C wrappers around static members of WorkArea
        void C_WorkArea_scroll_cb(FL_OBJECT * ob, long buf)
@@ -125,10 +126,9 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
                                      width - 15 - 2 * bw, // scrollbarwidth
                                      height - 2 * bw, "",
                                      C_WorkArea_work_area_handler);
-       //obj->wantkey = FL_KEY_TAB;
        obj->wantkey = FL_KEY_ALL;
        obj->u_vdata = this; /* This is how we pass the WorkArea
-                                      to the work_area_handler. */
+                               to the work_area_handler. */
        fl_set_object_boxtype(obj,FL_DOWN_BOX);
        fl_set_object_resize(obj, FL_RESIZE_ALL);
        fl_set_object_gravity(obj, NorthWestGravity, SouthEastGravity);
@@ -265,6 +265,7 @@ void WorkArea::scroll_cb(FL_OBJECT * ob, long)
        waitForX();
 }
 
+
 bool Lgb_bug_find_hack = false;
 
 int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
@@ -355,19 +356,35 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
                }
                KeySym ret_key = keysym;
 #else
-               // Ok, this is a bit simplistic...seems that the rules
-               // need to be a bit more...
-               if (!key) break;
-               KeySym ret_key = (keysym ? keysym : key);
+               // Note that we need this handling because of a bug
+               // in XForms 0.89, if this bug is resolved in the way I hope
+               // we can just use the keysym directly with out looking
+               // at key at all. (Lgb)
+               KeySym ret_key = 0;
+               if (!key) {
+                       // We migth have to add more keysyms here also,
+                       // we will do that as the issues arise. (Lgb)
+                       if (keysym == XK_space)
+                               ret_key = keysym;
+                       else
+                               break;
+               } else {
+                       ret_key = (keysym ? keysym : key);
+               }
+               
 #endif 
                unsigned int ret_state = xke->state;
-               
+
+               // If you have a better way to handle "wild-output" of
+               // characters after the key has been released than the one
+               // below, please contact me. (Lgb)
                static Time last_time_pressed = 0;
                static unsigned int last_key_pressed = 0;
                static unsigned int last_state_pressed = 0;
-               //lyxerr << "Workarea Diff: " << xke->time - last_time_pressed
-               //       << endl;
-               if (xke->time - last_time_pressed < 40 // should perhaps be tunable
+               lyxerr[Debug::KEY] << "Workarea Diff: "
+                                  << xke->time - last_time_pressed
+                                  << endl;
+               if (xke->time - last_time_pressed < 35 // should perhaps be tunable
                    && xke->state == last_state_pressed
                    && xke->keycode == last_key_pressed) {
                        lyxerr[Debug::KEY]
@@ -449,9 +466,10 @@ int request_clipboard_cb(FL_OBJECT * /*ob*/, long /*type*/,
        clipboard_read = true;
        return 0;
 }
-}
+} // extern "C"
+
 
-string WorkArea::getClipboard() const 
+string const WorkArea::getClipboard() const 
 {
        clipboard_read = false;
        
index 18b10611c796ce68e1040099a1ff1c84da88df22..503feb5b7b47e1245813668eaf02b4d189db16bf 100644 (file)
@@ -86,7 +86,7 @@ public:
                return fl_get_scrollbar_value(scrollbar);
        }
        ///
-       std::pair<float, float> getScrollbarBounds() const {
+       std::pair<float, float> const getScrollbarBounds() const {
                std::pair<float, float> p;
                fl_get_scrollbar_bounds(scrollbar, &p.first, &p.second);
                return p;
@@ -100,7 +100,7 @@ public:
        /// xforms callback
        static void scroll_cb(FL_OBJECT *, long);
        ///
-       string getClipboard() const;
+       string const getClipboard() const;
        ///
        void putClipboard(string const &) const;
        ///
index 82d8255cf675beb996882ae77a1decab3281231e..a363f8e4ce483b1dbcfdaaeca9335ddac35984e9 100644 (file)
 
 #include <algorithm>
 
+#ifdef HAVE_LOCALE
+#include <locale>
+#endif
+
 #ifdef __GNUG__
 #pragma implementation "buffer.h"
 #endif
@@ -100,9 +104,9 @@ using std::pair;
 using std::vector;
 using std::max;
 using std::set;
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
 using std::istringstream;
-#endif
+//#endif
 
 // all these externs should eventually be removed.
 extern BufferList bufferlist;
@@ -163,7 +167,7 @@ Buffer::~Buffer()
 }
 
 
-string Buffer::getLatexName(bool no_path) const
+string const Buffer::getLatexName(bool no_path) const
 {
        if (no_path)
                return OnlyFilename(ChangeExtension(MakeLatexName(filename), 
@@ -461,11 +465,11 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
                old_float += "\n\\end_inset\n";
                //lyxerr << "float body: " << old_float << endl;
 
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                istringstream istr(old_float);
-#else
-               istrstream istr(old_float.c_str());
-#endif
+//#else
+//             istrstream istr(old_float.c_str());
+//#endif
                
                LyXLex nylex(0, 0);
                nylex.setStream(istr);
@@ -1261,6 +1265,12 @@ bool Buffer::writeFile(string const & fname, bool flag) const
                                     fname);
                return false;
        }
+
+#ifdef HAVE_LOCALE
+       // Use the standard "C" locale for file output.
+       ofs.imbue(locale::classic());
+#endif
+
        // The top of the file should not be written by params.
 
        // write out a comment in the top of the file
@@ -1268,8 +1278,13 @@ bool Buffer::writeFile(string const & fname, bool flag) const
            << " created this file. For more info see http://www.lyx.org/\n";
        ofs.setf(ios::showpoint|ios::fixed);
        ofs.precision(2);
+#ifndef HAVE_LOCALE
+       char dummy_format[512];
+       sprintf(dummy_format, "%.2f", LYX_FORMAT);
+       ofs << "\\lyxformat " <<  dummy_format << "\n";
+#else
        ofs << "\\lyxformat " << setw(4) <<  LYX_FORMAT << "\n";
-
+#endif
        // now write out the buffer paramters.
        params.writeFile(ofs);
 
@@ -1428,19 +1443,19 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
                                c = par->GetChar(i);
                                if (c == LyXParagraph::META_INSET) {
                                        if ((inset = par->GetInset(i))) {
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                                                std::ostringstream ost;
                                                inset->Ascii(this, ost);
                                                h += ost.str().length();
-#else
-                                               ostrstream ost;
-                                               inset->Ascii(this, ost);
-                                               ost << '\0';
-                                               char * tmp = ost.str();
-                                               string tstr(tmp);
-                                               h += tstr.length();
-                                               delete [] tmp;
-#endif
+//#else
+//                                             ostrstream ost;
+//                                             inset->Ascii(this, ost);
+//                                             ost << '\0';
+//                                             char * tmp = ost.str();
+//                                             string tstr(tmp);
+//                                             h += tstr.length();
+//                                             delete [] tmp;
+//#endif
                                        }
                                } else if (c == LyXParagraph::META_NEWLINE) {
                                        if (clen[j] < h)
@@ -2135,24 +2150,24 @@ void Buffer::latexParagraphs(ostream & ofs, LyXParagraph * par,
 {
        bool was_title = false;
        bool already_title = false;
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
        std::ostringstream ftnote;
-#else
-       char * tmpholder = 0;
-#endif
+//#else
+//     char * tmpholder = 0;
+//#endif
        TexRow ft_texrow;
        int ftcount = 0;
 
        // if only_body
        while (par != endpar) {
-#ifndef HAVE_SSTREAM
-               ostrstream ftnote;
-               if (tmpholder) {
-                       ftnote << tmpholder;
-                       delete [] tmpholder;
-                       tmpholder = 0;
-               }
-#endif
+//#ifndef HAVE_SSTREAM
+//             ostrstream ftnote;
+//             if (tmpholder) {
+//                     ftnote << tmpholder;
+//                     delete [] tmpholder;
+//                     tmpholder = 0;
+//             }
+//#endif
 #ifndef NEW_INSETS
                if (par->IsDummy())
                        lyxerr[Debug::LATEX] << "Error in latexParagraphs."
@@ -2204,26 +2219,26 @@ void Buffer::latexParagraphs(ostream & ofs, LyXParagraph * par,
                        }
                        ofs << ftnote.str();
                        texrow += ft_texrow;
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                        // The extra .c_str() is needed when we use
                        // lyxstring instead of the STL string class. 
                        ftnote.str(string().c_str());
-#else
-                       delete [] ftnote.str();
-#endif
+//#else
+//                     delete [] ftnote.str();
+//#endif
                        ft_texrow.reset();
                        ftcount = 0;
                }
-#ifndef HAVE_SSTREAM
-               else {
-                       // I hate strstreams
-                       tmpholder = ftnote.str();
-               }
-#endif
+//#ifndef HAVE_SSTREAM
+//             else {
+//                     // I hate strstreams
+//                     tmpholder = ftnote.str();
+//             }
+//#endif
        }
-#ifndef HAVE_SSTREAM
-       delete [] tmpholder;
-#endif
+//#ifndef HAVE_SSTREAM
+//     delete [] tmpholder;
+//#endif
        // It might be that we only have a title in this document
        if (was_title && !already_title) {
                ofs << "\\maketitle\n";
@@ -2597,21 +2612,21 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
                if (par->layout != textclasslist
                    .NumberOfLayout(params.textclass,
                                    "Caption").second) {
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                        std::ostringstream ost;
-#else
-                       ostrstream ost;
-#endif
+//#else
+//                     ostrstream ost;
+//#endif
                        SimpleDocBookOnePar(ost, extra_par, par,
                                            desc_on, depth + 2);
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                        tmp_par += ost.str().c_str();
-#else
-                       ost << '\0';
-                       char * ctmp = ost.str();
-                       tmp_par += ctmp;
-                       delete [] ctmp;
-#endif
+//#else
+//                     ost << '\0';
+//                     char * ctmp = ost.str();
+//                     tmp_par += ctmp;
+//                     delete [] ctmp;
+//#endif
                }
                tmp_par = frontStrip(strip(tmp_par));
 
@@ -2627,15 +2642,16 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
 
 
 // push a tag in a style stack
-void Buffer::push_tag(ostream & os, char const * tag,
+void Buffer::push_tag(ostream & os, string const & tag,
                      int & pos, char stack[5][3])
 {
+#warning Use a real stack! (Lgb)
        // pop all previous tags
        for (int j = pos; j >= 0; --j)
                os << "</" << stack[j] << ">";
 
        // add new tag
-       sprintf(stack[++pos], "%s", tag);
+       sprintf(stack[++pos], "%s", tag.c_str());
 
        // push all tags
        for (int i = 0; i <= pos; ++i)
@@ -2643,20 +2659,19 @@ void Buffer::push_tag(ostream & os, char const * tag,
 }
 
 
-void Buffer::pop_tag(ostream & os, char const * tag,
+void Buffer::pop_tag(ostream & os, string const & tag,
                      int & pos, char stack[5][3])
 {
-        int j;
-
+#warning Use a real stack! (Lgb)
         // pop all tags till specified one
-        for (j = pos; (j >= 0) && (strcmp(stack[j], tag)); --j)
+        for (int j = pos; (j >= 0) && (strcmp(stack[j], tag.c_str())); --j)
                 os << "</" << stack[j] << ">";
 
         // closes the tag
         os << "</" << tag << ">";
 
         // push all tags, but the specified one
-        for (j = j + 1; j <= pos; ++j) {
+        for (int j = j + 1; j <= pos; ++j) {
                 os << "<" << stack[j] << ">";
                 strcpy(stack[j-1], stack[j]);
         }
@@ -2879,7 +2894,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
 
 // Print an error message.
 void Buffer::LinuxDocError(LyXParagraph * par, int pos,
-                          char const * message) 
+                          string const & message) 
 {
        // insert an error marker in text
        InsetError * new_inset = new InsetError(message);
@@ -3242,18 +3257,18 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
 
                if (c == LyXParagraph::META_INSET) {
                        Inset * inset = par->GetInset(i);
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                        std::ostringstream ost;
                        inset->DocBook(this, ost);
                        string tmp_out = ost.str().c_str();
-#else
-                       ostrstream ost;
-                       inset->DocBook(this, ost);
-                       ost << '\0';
-                       char * ctmp = ost.str();
-                       string tmp_out(ctmp);
-                       delete [] ctmp;
-#endif
+//#else
+//                     ostrstream ost;
+//                     inset->DocBook(this, ost);
+//                     ost << '\0';
+//                     char * ctmp = ost.str();
+//                     string tmp_out(ctmp);
+//                     delete [] ctmp;
+//#endif
                        //
                        // This code needs some explanation:
                        // Two insets are treated specially
@@ -3661,7 +3676,7 @@ void Buffer::setPaperStuff()
 
 
 // This function should be in Buffer because it's a buffer's property (ale)
-string Buffer::getIncludeonlyList(char delim)
+string const Buffer::getIncludeonlyList(char delim)
 {
        string lst;
        for (inset_iterator it = inset_iterator_begin();
@@ -3682,7 +3697,7 @@ string Buffer::getIncludeonlyList(char delim)
 }
 
 
-vector<string> Buffer::getLabelList()
+vector<string> const Buffer::getLabelList()
 {
        /// if this is a child document and the parent is already loaded
        /// Use the parent's list instead  [ale990407]
@@ -3703,7 +3718,7 @@ vector<string> Buffer::getLabelList()
 }
 
 
-vector<vector<Buffer::TocItem> > Buffer::getTocList()
+vector<vector<Buffer::TocItem> > const Buffer::getTocList()
 {
        vector<vector<TocItem> > l(4);
        LyXParagraph * par = paragraph;
@@ -3758,8 +3773,9 @@ vector<vector<Buffer::TocItem> > Buffer::getTocList()
        return l;
 }
 
+
 // This is also a buffer property (ale)
-vector<pair<string,string> > Buffer::getBibkeyList()
+vector<pair<string,string> > const Buffer::getBibkeyList()
 {
        /// if this is a child document and the parent is already loaded
        /// Use the parent's list instead  [ale990412]
index 1404bfc90b204e3366ad5d01b32a1e7383dc672d..9991e5beccc590be72a30e63478796f314ad91d9 100644 (file)
@@ -181,7 +181,7 @@ public:
                             bool nice, bool only_body = false);
 
        /// returns the main language for the buffer (document)
-       string GetLanguage() const {
+       string const GetLanguage() const {
                return params.language;
        }
        
@@ -247,7 +247,7 @@ public:
        /** A transformed version of the file name, adequate for LaTeX  
            The path is stripped if no_path is true (default)
        */
-       string getLatexName(bool no_path = true) const;
+       string const getLatexName(bool no_path = true) const;
 
        /// Change name of buffer. Updates "read-only" flag.
        void fileName(string const & newfile);
@@ -288,9 +288,9 @@ public:
        void validate(LaTeXFeatures &) const;
 
        ///
-       string getIncludeonlyList(char delim = ',');
+       string const getIncludeonlyList(char delim = ',');
        ///
-       std::vector<std::pair<string,string> > getBibkeyList();
+       std::vector<std::pair<string,string> > const getBibkeyList();
        ///
        struct TocItem {
                ///
@@ -312,9 +312,9 @@ public:
                TOC_LOA
        };
        ///
-       std::vector<std::vector<TocItem> > getTocList();
+       std::vector<std::vector<TocItem> > const getTocList();
        ///
-       std::vector<string> getLabelList();
+       std::vector<string> const getLabelList();
 
        /** This will clearly have to change later. Later we can have more
            than one user per buffer. */
@@ -375,7 +375,8 @@ private:
         void sgmlCloseTag(std::ostream & os, int depth,
                          string const & latexname) const;
        ///
-       void LinuxDocError(LyXParagraph * par, int pos, char const * message);
+       void LinuxDocError(LyXParagraph * par, int pos,
+                          string const & message);
         ///
        void SimpleLinuxDocOnePar(std::ostream & os, LyXParagraph * par,
                                  int desc_on, int const depth);
@@ -385,11 +386,11 @@ private:
                                 int const depth);
 
        /// LinuxDoc.
-       void push_tag(std::ostream & os, char const * tag,
+       void push_tag(std::ostream & os, string const & tag,
                      int & pos, char stack[5][3]);
        
        /// LinuxDoc.
-       void pop_tag(std::ostream & os, char const * tag,
+       void pop_tag(std::ostream & os, string const & tag,
                     int & pos, char stack[5][3]);
 
        /// is save needed
@@ -459,10 +460,10 @@ public:
                friend
                bool operator==(inset_iterator const & iter1,
                                inset_iterator const & iter2);
-               ///
-               friend
-               bool operator!=(inset_iterator const & iter1,
-                               inset_iterator const & iter2);
+               //
+               //friend
+               //bool operator!=(inset_iterator const & iter1,
+               //              inset_iterator const & iter2);
        private:
                ///
                void SetParagraph();
index d05d1deda19ce35dd1b97a80d1602cef24c44909..232297862f20b5d36e1b38ac942ec23af82551e3 100644 (file)
@@ -219,7 +219,7 @@ bool BufferList::close(Buffer * buf)
 }
 
 
-vector<string> BufferList::getFileNames() const
+vector<string> const BufferList::getFileNames() const
 {
        vector<string> nvec;
        for(BufferStorage::const_iterator cit = bstore.begin();
@@ -456,14 +456,11 @@ Buffer * BufferList::newFile(string const & name, string tname, bool isNamed)
                        // no template, start with empty buffer
                        b->paragraph = new LyXParagraph;
                }
-       }
-       else {  // start with empty buffer
+       } else {  // start with empty buffer
                b->paragraph = new LyXParagraph;
        }
 
-#warning Why mark a new document dirty? I deactivate this (Jug)
        if (!lyxrc.new_ask_filename) {
-//             b->markDirty();
                if (!isNamed)
                        b->setUnnamed();
        }
index da970e6fe8774ebfc0c420399fe4278edb1a28bb..57c59faffb786d84838355dcb36197f17194a2b0 100644 (file)
@@ -108,7 +108,7 @@ public:
        /// Make a new file (buffer) using a template
        Buffer * newFile(string const &, string, bool isNamed=false);
        /// returns a vector with all the buffers filenames
-       std::vector<string> getFileNames() const;
+       std::vector<string> const getFileNames() const;
 
        ///
        int unlockInset(UpdatableInset *);
index 158463fe90253f3d9007d8c041dd04aa8ffc0103..1a8fb3cac034d05215cfbab8c4e85923d1e19782 100644 (file)
@@ -165,7 +165,7 @@ void BufferParams::writeFile(ostream & os) const
                        else {
                                os << "\\bulletLaTeX " << i
                                   << "\n\t"
-                                  << user_defined_bullets[i].c_str()
+                                  << user_defined_bullets[i].getText().c_str()
                                   << "\n\\end_bullet\n";
                        }
                }
index 8d68fc7456fe4aa18b9b89c606707880f52fb7b7..66fc4c0a24cff883d815a59548bd26f2350c8f68 100644 (file)
@@ -247,7 +247,7 @@ void FontSize(BufferView * bv, string const & size)
 
 
 // Returns the current font and depth as a message. 
-string CurrentState(BufferView * bv)
+string const CurrentState(BufferView * bv)
 {
        string state;
        if (bv->available()) { 
index e2f689249b0c4cb55a9cfd33fda6c9d20b5b2c93..4837f19e46549042a578631187c453c8ec033bcd 100644 (file)
@@ -68,7 +68,7 @@ extern void Underline(BufferView *);
 ///
 extern void FontSize(BufferView *, string const &);
 /// Returns the current font and depth as a message. 
-extern string CurrentState(BufferView *);
+extern string const CurrentState(BufferView *);
 ///
 extern void ToggleAndShow(BufferView *, LyXFont const &);
 #endif
index a8b37a5bed96c0caa37755c1628c6bc9befa4811..0531db3c7d57a5a2b7a19357db1335d907951faa 100644 (file)
@@ -84,7 +84,7 @@ bool updateBulletForm()
                fl_set_button(fd_form_bullet->radio_bullet_depth_1, 1);
                fl_set_input(fd_form_bullet->input_bullet_latex,
                             current_view->buffer()
-                            ->params.user_defined_bullets[0].c_str());
+                            ->params.user_defined_bullets[0].getText().c_str());
                fl_set_choice(fd_form_bullet->choice_bullet_size,
                              current_view->buffer()
                              ->params.user_defined_bullets[0].getSize() + 2);
@@ -149,7 +149,7 @@ void ChoiceBulletSizeCB(FL_OBJECT * ob, long /*data*/ )
        // convert from 1-6 range to -1-4 
        param.temp_bullets[current_bullet_depth].setSize(fl_get_choice(ob) - 2);
        fl_set_input(fd_form_bullet->input_bullet_latex,
-                                param.temp_bullets[current_bullet_depth].c_str());
+                                param.temp_bullets[current_bullet_depth].getText().c_str());
 }
 
 
@@ -172,7 +172,7 @@ void BulletDepthCB(FL_OBJECT * ob, long data)
        default:
                current_bullet_depth = data;
                fl_set_input(fd_form_bullet->input_bullet_latex,
-                            param.temp_bullets[data].c_str());
+                            param.temp_bullets[data].getText().c_str());
                fl_set_choice(fd_form_bullet->choice_bullet_size,
                              param.temp_bullets[data].getSize() + 2);
        }
@@ -242,5 +242,5 @@ void BulletBMTableCB(FL_OBJECT *ob, long /*data*/ )
        param.temp_bullets[current_bullet_depth].setFont(current_bullet_panel);
        param.temp_bullets[current_bullet_depth].setCharacter(bmtable_button);
        fl_set_input(fd_form_bullet->input_bullet_latex,
-                    param.temp_bullets[current_bullet_depth].c_str());
+                    param.temp_bullets[current_bullet_depth].getText().c_str());
 }
index cf3a3b1c4434174569c263b7e1f941039201a100..b08adfed4dcd47a0c843e0306771774eda026e8e 100644 (file)
@@ -62,7 +62,7 @@ bool CharacterSet::loadFile(string const & fname)
 }
 
 
-pair<bool, int> CharacterSet::encodeString(string const & str) const
+pair<bool, int> const CharacterSet::encodeString(string const & str) const
 {
        lyxerr[Debug::KBMAP] << "Checking if we know [" << str << "]" << endl;
        bool ret = false;
index 73d49c84494ad3eb602805afdac6e0612d4b11ca..90d9affad48156848b3a92da9195fa17f87d0373 100644 (file)
@@ -19,7 +19,7 @@ public:
        ///
        string const & getName() const;
        ///
-       std::pair<bool, int> encodeString(string const &) const;
+       std::pair<bool, int> const encodeString(string const &) const;
 private:
        ///
        string name_;
index 260d781eedf6e2666cfbb49e9f01ce2e3eaa8d39..d44545c4f5fcd369f215c0369d640b3946514741 100644 (file)
@@ -109,28 +109,30 @@ void Combox::remove()
 }
 
 
-void Combox::addline(char const* text)
+void Combox::addline(string const & text)
 {
        if (!browser) return;
-       fl_add_browser_line(browser, text);
+       fl_add_browser_line(browser, text.c_str());
        
        // By default the first item is selected
        if (!sel) {
                sel = 1;
                if (type == FL_COMBOX_INPUT)
-                       fl_set_input(label, text);
+                       fl_set_input(label, text.c_str());
                else
-                       fl_set_object_label(label, text); 
+                       fl_set_object_label(label, text.c_str()); 
        }
        is_empty = false;
 }
 
 
-bool Combox::select_text(char const* t)
+bool Combox::select_text(string const & t)
 {
-       if (!browser || !t) return false;
-       for (int i = 1; i <= fl_get_browser_maxline(browser); ++i) {
-               if (!strcmp(t, fl_get_browser_line(browser, i))) {
+       if (!browser || t.empty()) return false;
+       int const maxline = fl_get_browser_maxline(browser);
+       
+       for (int i = 1; i <= maxline; ++i) {
+               if (t == fl_get_browser_line(browser, i)) {
                        select(i);
                        return true;
                }
@@ -142,7 +144,7 @@ bool Combox::select_text(char const* t)
 void Combox::select(int i)
 {
        if (!browser || !button) return;
-       if (i>0 && i<= fl_get_browser_maxline(browser)) sel = i; 
+       if (i > 0 && i <= fl_get_browser_maxline(browser)) sel = i; 
        fl_deactivate_object(button);
        
        if (type == FL_COMBOX_INPUT)
@@ -155,7 +157,7 @@ void Combox::select(int i)
 
 void Combox::add(int x, int y, int w, int hmin, int hmax)
 {  
-       FL_OBJECT *obj;
+       FL_OBJECT * obj;
        
        switch(type) {
        case FL_COMBOX_DROPLIST:
@@ -311,7 +313,7 @@ void Combox::deactivate()
        if (label) fl_deactivate_object(label);
 }
 
-void Combox::input_cb(FL_OBJECT *ob, long)
+void Combox::input_cb(FL_OBJECT * ob, long)
 {
        Combox * combo = static_cast<Combox*>(ob->u_vdata);
 
index 8dee29f1fcdf0807ae6511c445620f66c21e9c07..16c6cd056ad2ab6c6ba50033c0eae2965e34821f 100644 (file)
@@ -30,6 +30,7 @@
 
 #include FORMS_H_LOCATION
 #include <cstdlib>
+#include "LString.h"
 
 ///
 enum combox_type {
@@ -63,20 +64,20 @@ public:
        void add(int x, int y, int w, int hmin, int hmax);
        
        /// Add lines. Same as for fl_browser object
-       void addline(char const *);
+       void addline(string const &);
        /// Add lines. Same as for fl_browser object
-       void addto(char const *);
+       void addto(string const &);
        
        /// Returns the selected item
        int get();
    
        /// Returns a pointer to the selected line of text
-       char const * getline();
+       string const getline();
    
        ///  Select an arbitrary item
        void select(int);
        ///
-        bool select_text(char const *);
+        bool select_text(string const &);
    
        ///  Clear all the list
        void clear();
@@ -106,7 +107,7 @@ public:
        ///
        void deactivate();
        ///
-        void shortcut(char const *, int);
+        void shortcut(string const &, int);
        ///
        void Redraw();
        ///
@@ -152,10 +153,10 @@ public:
 //-----------------  Inline methods  --------------------------- 
 
 inline
-void Combox::addto(char const * text)
+void Combox::addto(string const & text)
 {
        if (browser) {
-               fl_addto_browser(browser, text);
+               fl_addto_browser(browser, text.c_str());
                is_empty = false;
        }
 }
@@ -178,10 +179,10 @@ void Combox::gravity(unsigned g1, unsigned g2)
 
 
 inline
-void Combox::shortcut(char const * s, int i)
+void Combox::shortcut(string const & s, int i)
 {
    if (button)
-      fl_set_object_shortcut(button, s, i);
+      fl_set_object_shortcut(button, s.c_str(), i);
 }
 
 
@@ -215,7 +216,7 @@ int Combox::get()
 
 
 inline
-char const * Combox::getline()
+string const Combox::getline()
 {
     if (type == FL_COMBOX_INPUT) 
       return fl_get_input(label);
index 860d6c2ae657526d8c2421f39ce3f0e45ff5ab15..c16f8a083bc2b0c62ac67eecc3bc2106aa94db75 100644 (file)
@@ -43,7 +43,7 @@ vector<Command> Converter::commands;
 string Converter::latex_command;
 
 inline
-string add_options(string const & command, string const & options)
+string const add_options(string const & command, string const & options)
 {
        string head;
        string tail = split(command, head, ' ');
@@ -492,7 +492,7 @@ bool Converter::runLaTeX(Buffer * buffer, string const & command)
 }
 
 
-string Converter::dvi_papersize(Buffer * buffer)
+string const Converter::dvi_papersize(Buffer const * buffer)
 {
        char real_papersize = buffer->params.papersize;
        if (real_papersize == BufferParams::PAPER_DEFAULT)
@@ -518,7 +518,7 @@ string Converter::dvi_papersize(Buffer * buffer)
 }
 
 
-string Converter::dvips_options(Buffer * buffer)
+string const Converter::dvips_options(Buffer const * buffer)
 {
        string result;
        if (buffer->params.use_geometry
index 8556952a6c736449d6a8e0c52cd8af28de882f9c..3b6f01270c8d79b64141db8f9e7d224a0e4c6b2a 100644 (file)
@@ -108,14 +108,15 @@ public:
        bool Convert(Buffer * buffer, string const & from_file,
                     string const & to_file, string const & using_format,
                     string * view_file = 0);
+       ///
        static
        string const SplitFormat(string const & str, string & format);
        ///
        static
-       string dvi_papersize(Buffer * buffer);
+       string const dvi_papersize(Buffer const * buffer);
        ///
        static
-       string dvips_options(Buffer * buffer);
+       string const dvips_options(Buffer const * buffer);
 private:
        ///
        static
index 1413a9fffaabee899f14994f64aef726604f96c8..ff6b37e1bfe864c99c951e7afdeda97f2356c795 100644 (file)
@@ -18,6 +18,7 @@
 #include <cstring>
 #include <map>
 #include <algorithm>
+
 using std::map;
 using std::sort;
 
@@ -427,7 +428,7 @@ void LyXFileDlg::SetButton(int iIndex, string const & pszName,
 
 
 // GetDirectory: gets last dialog directory
-string LyXFileDlg::GetDirectory() const
+string const LyXFileDlg::GetDirectory() const
 {
        if (!pszDirectory.empty())
                return pszDirectory;
@@ -666,7 +667,7 @@ void LyXFileDlg::Force(bool cancel)
 
 
 // Select: launches dialog and returns selected file
-string LyXFileDlg::Select(string const & title, string const & path, 
+string const LyXFileDlg::Select(string const & title, string const & path, 
                          string const & mask, string const & suggested)
 {
        // handles new mask and path
index 75ff15f698f622c53114167e11d77d3f27bbf907..e51547fb65d1985f2219465186fa2270947596e2 100644 (file)
@@ -45,9 +45,9 @@ public:
        void SetButton(int iIndex, string const & pszName = string(), 
                       string const & pszPath = string());
        /// gets last dialog directory
-       string GetDirectory() const;
+       string const GetDirectory() const;
        /// launches dialog and returns selected file
-       string Select(string const & pszTitle = string(),
+       string const Select(string const & pszTitle = string(),
                       string const & pszPath = string(),
                       string const & pszMask = string(), 
                       string const & pszSuggested = string());
index 462241db9675eb7b1cb70853e239be2986f36f19..96cb595f00ba7e7077737dd1762988584fad77c2 100644 (file)
@@ -162,6 +162,7 @@ int lyxfont::signedWidth(string const & s, LyXFont const & f)
 }
 
 
+//int lyxfont::width(wstring const & s, int n, LyXFont const & f)
 int lyxfont::width(XChar2b const * s, int n, LyXFont const & f)
 {
        if (!lyxrc.use_gui)
@@ -187,13 +188,13 @@ int lyxfont::width(XChar2b const * s, int n, LyXFont const & f)
        }
 }
 
-int lyxfont::XTextWidth(LyXFont const & f, char * str, int count)
+int lyxfont::XTextWidth(LyXFont const & f, char const * str, int count)
 {
        return ::XTextWidth(getXFontstruct(f), str, count);
 }
 
 
-int lyxfont::XTextWidth16(LyXFont const & f, XChar2b * str, int count)
+int lyxfont::XTextWidth16(LyXFont const & f, XChar2b const * str, int count)
 {
        return ::XTextWidth16(getXFontstruct(f), str, count);
 }
index 98f0013f52498f0ae6822c0e69ef69e4f0aad2da..d078ea8ba2c5c19d9f0084be9e6b339dc65c5f1f 100644 (file)
@@ -68,13 +68,13 @@ struct lyxfont {
        int signedWidth(string const & s, LyXFont const & f);
        ///
        static
-       int XTextWidth(LyXFont const & f, char * str, int count);
+       int XTextWidth(LyXFont const & f, char const * str, int count);
        ///
        static
        int width(XChar2b const * s, int n, LyXFont const & f);
        ///
        static
-       int XTextWidth16(LyXFont const & f, XChar2b * str, int count);
+       int XTextWidth16(LyXFont const & f, XChar2b const * str, int count);
        ///
        static
        void XSetFont(Display * display, GC gc, LyXFont const & f);
index 52d7d02afb65ff01d775297a814f947d91b1a433..5511d850b2fa243c8e5561a8edab2dd6c9d81567 100644 (file)
@@ -3,7 +3,7 @@
  * 
  *           LyX, The Document Processor
  *      
- *           Copyright (C) 2000 The LyX Team.
+ *           Copyright 2000 The LyX Team.
  *
  *           @author Jürgen Vigna
  *
@@ -63,6 +63,7 @@ C_GENERICCB(FormDocument, BulletDepthCB)
 C_GENERICCB(FormDocument, InputBulletLaTeXCB)
 C_GENERICCB(FormDocument, ChoiceBulletSizeCB)
 
+       
 FormDocument::FormDocument(LyXView * lv, Dialogs * d)
        : dialog_(0), paper_(0), class_(0), language_(0), options_(0),
          bullets_(0), lv_(lv), d_(d), u_(0), h_(0),
@@ -78,12 +79,14 @@ FormDocument::FormDocument(LyXView * lv, Dialogs * d)
     current_bullet_panel = 0;
 }
 
+
 FormDocument::~FormDocument()
 {
     free();
     delete bc_;
 }
 
+
 void FormDocument::build()
 {
     int n;
@@ -267,6 +270,7 @@ void FormDocument::build()
     }
 }
 
+
 void FormDocument::show()
 {
     if (!dialog_)
@@ -286,6 +290,7 @@ void FormDocument::show()
     }
 }
 
+
 void FormDocument::hide()
 {
     if (dialog_->form->visible) {
@@ -295,15 +300,13 @@ void FormDocument::hide()
     }
 }
 
+
 void FormDocument::apply()
 {
     if (!lv_->view()->available() || !dialog_)
        return;
 
-    bool
-       redo;
-
-    redo = class_apply();
+    bool redo = class_apply();
     paper_apply();
     redo = language_apply() || redo;
     redo = options_apply() || redo;
@@ -441,10 +444,10 @@ bool FormDocument::class_apply()
        return redo;
 }
 
+
 void FormDocument::paper_apply()
 {
-    BufferParams
-       &params = lv_->buffer()->params;
+    BufferParams & params = lv_->buffer()->params;
     
     params.papersize2 = fl_get_choice(paper_->choice_papersize2)-1;
     params.paperpackage = fl_get_choice(paper_->choice_paperpackage)-1;
@@ -465,12 +468,11 @@ void FormDocument::paper_apply()
     lv_->buffer()->setPaperStuff();
 }
 
+
 bool FormDocument::language_apply()
 {
-    BufferParams
-       &params = lv_->buffer()->params;
-    InsetQuotes::quote_language
-       lga = InsetQuotes::EnglishQ;
+    BufferParams & params = lv_->buffer()->params;
+    InsetQuotes::quote_language lga = InsetQuotes::EnglishQ;
     bool redo = false;
 
     switch(fl_get_choice(language_->choice_quotes_language) - 1) {
@@ -522,12 +524,11 @@ bool FormDocument::language_apply()
     return redo;
 }
 
+
 bool FormDocument::options_apply()
 {
-    BufferParams
-       &params = lv_->buffer()->params;
-    bool
-       redo = false;
+    BufferParams & params = lv_->buffer()->params;
+    bool redo = false;
 
     params.graphicsDriver =
        fl_get_choice_text(options_->choice_postscript_driver);
@@ -546,6 +547,7 @@ bool FormDocument::options_apply()
     return redo;
 }
 
+
 void FormDocument::bullets_apply()
 {
     /* update the bullet settings */
@@ -558,6 +560,7 @@ void FormDocument::bullets_apply()
     param.user_defined_bullets[3] = param.temp_bullets[3];
 }
 
+
 void FormDocument::cancel()
 {
     // this avoids confusion when reopening
@@ -568,6 +571,7 @@ void FormDocument::cancel()
     param.temp_bullets[3] = param.user_defined_bullets[3];
 }
 
+
 void FormDocument::update()
 {
     if (!dialog_)
@@ -575,8 +579,7 @@ void FormDocument::update()
 
     checkReadOnly();
 
-    BufferParams
-       const & params = lv_->buffer()->params;
+    BufferParams const & params = lv_->buffer()->params;
 
     class_update(params);
     paper_update(params);
@@ -585,12 +588,13 @@ void FormDocument::update()
     bullets_update(params);
 }
 
+
 void FormDocument::class_update(BufferParams const & params)
 {
     if (!class_)
         return;
-    LyXTextClass
-       const & tclass = textclasslist.TextClass(params.textclass);
+
+    LyXTextClass const & tclass = textclasslist.TextClass(params.textclass);
 
 #ifdef USE_CLASS_COMBO
     combo_doc_class->select_text(
@@ -679,6 +683,7 @@ void FormDocument::class_update(BufferParams const & params)
        fl_set_input(class_->input_doc_extra, "");
 }
 
+
 void FormDocument::language_update(BufferParams const & params)
 {
     if (!language_)
@@ -695,6 +700,7 @@ void FormDocument::language_update(BufferParams const & params)
        fl_set_button(language_->radio_double, 1);
 }
 
+
 void FormDocument::options_update(BufferParams const & params)
 {
     if (!options_)
@@ -712,6 +718,7 @@ void FormDocument::options_update(BufferParams const & params)
        fl_set_input(options_->input_float_placement, "");
 }
 
+
 void FormDocument::paper_update(BufferParams const & params)
 {
     if (!paper_)
@@ -738,6 +745,7 @@ void FormDocument::paper_update(BufferParams const & params)
     fl_set_focus_object(paper_->form, paper_->choice_papersize2);
 }
 
+
 void FormDocument::bullets_update(BufferParams const & params)
 {
     if (!bullets_ || ((XpmVersion<4) || (XpmVersion==4 && XpmRevision<7)))
@@ -763,11 +771,12 @@ void FormDocument::bullets_update(BufferParams const & params)
 
     fl_set_button(bullets_->radio_bullet_depth_1, 1);
     fl_set_input(bullets_->input_bullet_latex,
-                params.user_defined_bullets[0].c_str());
+                params.user_defined_bullets[0].getText().c_str());
     fl_set_choice(bullets_->choice_bullet_size,
                  params.user_defined_bullets[0].getSize() + 2);
 }
 
+
 void FormDocument::free()
 {
     if (dialog_) {
@@ -807,39 +816,44 @@ void FormDocument::free()
     }
 }
 
+
 int FormDocument::WMHideCB(FL_FORM * form, void *)
 {
     // Ensure that the signals (u and h) are disconnected even if the
     // window manager is used to close the popup.
-    FormDocument * pre = (FormDocument*)form->u_vdata;
+    FormDocument * pre = static_cast<FormDocument*>(form->u_vdata);
     pre->hide();
     pre->bc_->hide();
     return FL_CANCEL;
 }
 
+
 void FormDocument::OKCB(FL_OBJECT * ob, long)
 {
-    FormDocument * pre = (FormDocument*)ob->form->u_vdata;
+    FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
     pre->apply();
     pre->hide();
     pre->bc_->ok();
 }
 
+
 void FormDocument::ApplyCB(FL_OBJECT * ob, long)
 {
-    FormDocument * pre = (FormDocument*)ob->form->u_vdata;
+    FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
     pre->apply();
     pre->bc_->apply();
 }
 
+
 void FormDocument::CancelCB(FL_OBJECT * ob, long)
 {
-    FormDocument * pre = (FormDocument*)ob->form->u_vdata;
+    FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
     pre->cancel();
     pre->hide();
     pre->bc_->cancel();
 }
 
+
 void FormDocument::RestoreCB(FL_OBJECT * ob, long)
 {
     FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
@@ -847,12 +861,14 @@ void FormDocument::RestoreCB(FL_OBJECT * ob, long)
     pre->bc_->undoAll();
 }
 
+
 void FormDocument::InputCB(FL_OBJECT * ob, long)
 {
-    FormDocument * pre = (FormDocument*)ob->form->u_vdata;
+    FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
     pre->bc_->valid(pre->CheckDocumentInput(ob,0));
 }
 
+
 void FormDocument::ComboInputCB(int, void * v, Combox * combox)
 {
     FormDocument * pre = static_cast<FormDocument*>(v);
@@ -861,13 +877,15 @@ void FormDocument::ComboInputCB(int, void * v, Combox * combox)
     pre->bc_->valid(pre->CheckDocumentInput(0,0));
 }
 
+
 void FormDocument::ChoiceClassCB(FL_OBJECT * ob, long)
 {
-    FormDocument * pre = (FormDocument*)ob->form->u_vdata;
+    FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
     pre->CheckChoiceClass(ob,0);
     pre->bc_->valid(pre->CheckDocumentInput(ob,0));
 }
 
+
 void FormDocument::checkReadOnly()
 {
     if (bc_->readOnly(lv_->buffer()->isReadonly())) {
@@ -884,11 +902,10 @@ void FormDocument::checkReadOnly()
     }  
 }
 
+
 void FormDocument::checkMarginValues()
 {
-    int allEmpty;
-    
-    allEmpty = (!strlen(fl_get_input(paper_->input_top_margin)) &&
+    int const allEmpty = (!strlen(fl_get_input(paper_->input_top_margin)) &&
                !strlen(fl_get_input(paper_->input_bottom_margin)) &&
                !strlen(fl_get_input(paper_->input_left_margin)) &&
                !strlen(fl_get_input(paper_->input_right_margin)) &&
@@ -990,13 +1007,15 @@ bool FormDocument::CheckDocumentInput(FL_OBJECT * ob, long)
     return ok;
 }
 
+
 void FormDocument::ChoiceBulletSizeCB(FL_OBJECT * ob, long)
 {
-    FormDocument * pre = (FormDocument*)ob->form->u_vdata;
+    FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
     pre->ChoiceBulletSize(ob,0);
     pre->bc_->valid(pre->CheckDocumentInput(ob,0));
 }
 
+
 void FormDocument::ChoiceBulletSize(FL_OBJECT * ob, long /*data*/ )
 {
     BufferParams & param = lv_->buffer()->params;
@@ -1004,16 +1023,18 @@ void FormDocument::ChoiceBulletSize(FL_OBJECT * ob, long /*data*/ )
     // convert from 1-6 range to -1-4 
     param.temp_bullets[current_bullet_depth].setSize(fl_get_choice(ob) - 2);
     fl_set_input(bullets_->input_bullet_latex,
-                param.temp_bullets[current_bullet_depth].c_str());
+                param.temp_bullets[current_bullet_depth].getText().c_str());
 }
 
+
 void FormDocument::InputBulletLaTeXCB(FL_OBJECT * ob, long)
 {
-    FormDocument * pre = (FormDocument*)ob->form->u_vdata;
+    FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
     pre->InputBulletLaTeX(ob,0);
     pre->bc_->valid(pre->CheckDocumentInput(ob,0));
 }
 
+
 void FormDocument::InputBulletLaTeX(FL_OBJECT *, long)
 {
     BufferParams & param = lv_->buffer()->params;
@@ -1022,12 +1043,14 @@ void FormDocument::InputBulletLaTeX(FL_OBJECT *, long)
        setText(fl_get_input(bullets_->input_bullet_latex));
 }
 
+
 void FormDocument::BulletDepthCB(FL_OBJECT * ob, long)
 {
-    FormDocument * pre = (FormDocument*)ob->form->u_vdata;
+    FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
     pre->BulletDepth(ob,0);
 }
 
+
 void FormDocument::BulletDepth(FL_OBJECT * ob, long data)
 {
     /* Should I do the following:                                 */
@@ -1047,18 +1070,20 @@ void FormDocument::BulletDepth(FL_OBJECT * ob, long data)
     default:
        current_bullet_depth = data;
        fl_set_input(bullets_->input_bullet_latex,
-                    param.temp_bullets[data].c_str());
+                    param.temp_bullets[data].getText().c_str());
        fl_set_choice(bullets_->choice_bullet_size,
                      param.temp_bullets[data].getSize() + 2);
     }
 }
 
+
 void FormDocument::BulletPanelCB(FL_OBJECT * ob, long data)
 {
-    FormDocument * pre = (FormDocument*)ob->form->u_vdata;
+    FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
     pre->BulletPanel(ob,data);
 }
 
+
 void FormDocument::BulletPanel(FL_OBJECT * /*ob*/, long data)
 {
     /* Here we have to change the background pixmap to that selected */
@@ -1106,13 +1131,15 @@ void FormDocument::BulletPanel(FL_OBJECT * /*ob*/, long data)
     }
 }
 
+
 void FormDocument::BulletBMTableCB(FL_OBJECT * ob, long)
 {
-    FormDocument * pre = (FormDocument*)ob->form->u_vdata;
+    FormDocument * pre = static_cast<FormDocument*>(ob->form->u_vdata);
     pre->BulletBMTable(ob,0);
     pre->bc_->valid(pre->CheckDocumentInput(ob,0));
 }
 
+
 void FormDocument::BulletBMTable(FL_OBJECT * ob, long /*data*/ )
 {
     /* handle the user input by setting the current bullet depth's pixmap */
@@ -1127,9 +1154,10 @@ void FormDocument::BulletBMTable(FL_OBJECT * ob, long /*data*/ )
     param.temp_bullets[current_bullet_depth].setFont(current_bullet_panel);
     param.temp_bullets[current_bullet_depth].setCharacter(bmtable_button);
     fl_set_input(bullets_->input_bullet_latex,
-                param.temp_bullets[current_bullet_depth].c_str());
+                param.temp_bullets[current_bullet_depth].getText().c_str());
 }
 
+
 void FormDocument::CheckChoiceClass(FL_OBJECT * ob, long)
 {
     if (!ob)
@@ -1137,7 +1165,7 @@ void FormDocument::CheckChoiceClass(FL_OBJECT * ob, long)
 
     ProhibitInput(lv_->view());
     int tc;
-    const char * tct;
+    string tct;
 
 #ifdef USE_CLASS_COMBO
     tc = combo_doc_class->get();
@@ -1170,6 +1198,7 @@ void FormDocument::CheckChoiceClass(FL_OBJECT * ob, long)
     AllowInput(lv_->view());
 }
 
+
 void FormDocument::UpdateLayoutDocument(BufferParams const & params)
 {
     if (!dialog_)
index 62c362d948cab3af0fa2bdf0564bc0ca9431259b..788135c251730508820bd62c3b2f844348b28462 100644 (file)
@@ -63,7 +63,7 @@ void Toolbar::Pimpl::toolbarItem::clean() {
 
 
 Toolbar::Pimpl::toolbarItem & 
-Toolbar::Pimpl::toolbarItem::operator=(const toolbarItem & ti) {
+Toolbar::Pimpl::toolbarItem::operator=(toolbarItem const & ti) {
        // Are we assigning the object onto itself?
        if (this == &ti)
                return *this;
index ee0d1bd061f91140171475fca193b6e4a2964974..82a2b12fc515d78489003ad8a79df593426ff9a0 100644 (file)
 using std::endl;
 using std::ios;
 
+
 EPS_Renderer::EPS_Renderer()
        : Renderer()
 {}
 
-EPS_Renderer::~EPS_Renderer()
-{}
 
 bool EPS_Renderer::renderImage()
 {
        return false;
 }
 
+
 bool EPS_Renderer::isImageFormatOK(string const & filename) const
 {
-       std::ifstream is(filename.c_str(), ios::in);
+       std::ifstream is(filename.c_str());
 
        // The signature of the file without the spaces.
        static const char str[] = "%!PS";
index ed7051c78b3a8d1be55e9b15cb9dc0d6cbb20bf7..7e36806743c223aba775b1504d2d582625e8387a 100644 (file)
@@ -23,12 +23,9 @@ class EPS_Renderer : public Renderer {
 public:
        /// c-tor.
        EPS_Renderer();
-       /// d-tor.
-       virtual ~EPS_Renderer();
 
        /// Load the EPS image and create a pixmap out of it.
        virtual bool renderImage();
-
 private:
        /// Verify that filename is really an EPS file.
        virtual bool isImageFormatOK(string const & filename) const;
index b83a78f97a1c39c9530d9b71a18808752239850e..adb20613d6a49b7ebfbb0465e3dfeac5cb90d5a8 100644 (file)
@@ -25,12 +25,12 @@ GraphicsCache * GraphicsCache::singleton = 0;
 GraphicsCache * 
 GraphicsCache::getInstance()
 {
-    if (! singleton) {
-        singleton = new GraphicsCache;
+       if (!singleton) {
+               singleton = new GraphicsCache;
                Assert(singleton != 0);
-    }
+       }
 
-    return singleton;
+       return singleton;
 }
 
 
@@ -38,34 +38,37 @@ GraphicsCache::~GraphicsCache()
 {
        // Free the map.
        //std::foreach(map.begin(), map.end(), ...);
+#warning This is a bogus reason to not clean up after your self. (Lgb)
+       // Clean up and be done with it. (Lgb)
+       
        // This is not really needed, it will only happen on program close and in
        // any case the OS will release those resources (not doing it may have 
        // a good effect on closing time).
-
-    delete singleton;
+       
+       delete singleton;
 }
 
 
 GraphicsCacheItem *
 GraphicsCache::addFile(string const & filename)
 {
-    CacheType::const_iterator it = cache.find(filename);
-    
-    if (it != cache.end()) {
-        return new GraphicsCacheItem( *((*it).second) );
-    }
+       CacheType::const_iterator it = cache.find(filename);
+       
+       if (it != cache.end()) {
+               return new GraphicsCacheItem( *((*it).second) );
+       }
        
        GraphicsCacheItem * cacheItem = new GraphicsCacheItem();
        if (cacheItem == 0)
                return 0;
-
+       
        cacheItem->setFilename(filename);
-
+       
        cache[filename] = cacheItem;
-
+       
        // We do not want to return the main cache object, otherwise when the
        // will destroy their copy they will destroy the main copy.
-    return new GraphicsCacheItem( *cacheItem );
+       return new GraphicsCacheItem( *cacheItem );
 }
 
 
index 847eedc7893265dde8ba4d78f9e2f988c54d31a9..e9a8c6f88c88649e00fa6cb422fb6a0276efc1f5 100644 (file)
 */
 class GraphicsCache : public noncopyable {
 public:
-    /// Get the instance of the class.
-    static GraphicsCache * getInstance();
+       /// Get the instance of the class.
+       static GraphicsCache * getInstance();
 
-    /// Add a file to the cache.
-    GraphicsCacheItem * addFile(string const & filename);
+       /// Add a file to the cache.
+       GraphicsCacheItem * addFile(string const & filename);
 
 private:
-    /// Remove a cache item if it's count has gone to zero.
-    void removeFile(string const & filename);
-    
-    /// Private c-tor so we can control how many objects are instantiated.
-    GraphicsCache() {}
-
-    /// Private d-tor so that no-one will destroy us.
-    ~GraphicsCache();
-
-    /// Holder of the single instance of the class.
-    static GraphicsCache * singleton;
-    ///
-    typedef std::map<string, GraphicsCacheItem *> CacheType;
-    ///
-    CacheType cache;
-
-       // We need this so that an Item can tell the cache that it should be
-       // deleted. (to call removeFile).
-       // It also helps removing a warning gcc emits.
+       /// Remove a cache item if it's count has gone to zero.
+       void removeFile(string const & filename);
+       
+       /// Private c-tor so we can control how many objects are instantiated.
+       GraphicsCache() {}
+       
+       /// Private d-tor so that no-one will destroy us.
+       ~GraphicsCache();
+       
+       /// Holder of the single instance of the class.
+       static GraphicsCache * singleton;
+       ///
+       typedef std::map<string, GraphicsCacheItem *> CacheType;
+       ///
+       CacheType cache;
+       
+       /** We need this so that an Item can tell the cache that it should be
+           deleted. (to call removeFile).
+           It also helps removing a warning gcc emits. */
        friend class GraphicsCacheItem;
 };
 #endif
index 2cea9589ad0e6f2cde7e0942de65e0caf492e6ed..a92f0812b25f8e77422216ccad16d920f56a3464 100644 (file)
 #include "graphics/GraphicsCacheItem.h"
 #include "graphics/GraphicsCacheItem_pimpl.h"
 
+
 GraphicsCacheItem::GraphicsCacheItem()
        : pimpl(new GraphicsCacheItem_pimpl)
 {
        pimpl->refCount = 1;
 }
 
+
 GraphicsCacheItem::~GraphicsCacheItem()
 {
        destroy();
 }
 
+
 bool
 GraphicsCacheItem::setFilename(string const & filename)
 {
@@ -37,20 +40,21 @@ GraphicsCacheItem::setFilename(string const & filename)
        return pimpl->setFilename(filename);
 }
 
+
 GraphicsCacheItem::GraphicsCacheItem(GraphicsCacheItem const & gci)
 {
        pimpl = 0;
        copy(gci);
 }
 
-GraphicsCacheItem const &
+GraphicsCacheItem &
 GraphicsCacheItem::operator=(GraphicsCacheItem const & gci)
 {
        // Are we trying to copy the object onto itself.
        if (this == &gci)
                return *this;
 
-       // Destory old copy 
+       // Destroy old copy 
        destroy();
 
        // And then copy new object.
@@ -59,6 +63,7 @@ GraphicsCacheItem::operator=(GraphicsCacheItem const & gci)
        return *this;
 }
 
+
 void
 GraphicsCacheItem::copy(GraphicsCacheItem const & gci)
 {
@@ -66,6 +71,7 @@ GraphicsCacheItem::copy(GraphicsCacheItem const & gci)
        ++(pimpl->refCount);
 }
 
+
 void
 GraphicsCacheItem::destroy()
 {
@@ -79,14 +85,18 @@ GraphicsCacheItem::destroy()
        }
 }
 
+
 GraphicsCacheItem::ImageStatus 
 GraphicsCacheItem::getImageStatus() const { return pimpl->imageStatus_; }
 
+
 int 
 GraphicsCacheItem::getHeight() const { return pimpl->height_; }        
-       
+
+
 int 
 GraphicsCacheItem::getWidth() const { return pimpl->width_; }
 
+
 Pixmap 
 GraphicsCacheItem::getImage() const { return pimpl->pixmap_; }
index 53dca53c9c2183d9c2cb1559dea77e69cd23c312..01843f46ceeb8fd90f4602dd42304d4de3af8fd2 100644 (file)
@@ -47,7 +47,7 @@ public:
        /// copy c-tor.
        GraphicsCacheItem(GraphicsCacheItem const &);
        /// Assignment operator.
-       GraphicsCacheItem const & operator=(GraphicsCacheItem const &);
+       GraphicsCacheItem & operator=(GraphicsCacheItem const &);
        
        /// Get the height of the image. Returns -1 on error.
        int getHeight() const; 
index 3fab0167b0d7f005287c5b4ed56d22c71b480ea0..d13c7d37b568575abce04a673d860d0ea42cec87 100644 (file)
 
 #include <config.h>
 
+#include <map>
+
+#include <unistd.h> // unlink
+
+#include FORMS_H_LOCATION
+
 #ifdef __GNUG__
 #pragma implementation
 #endif
 #include "support/filetools.h"
 #include "debug.h"
 #include "support/LAssert.h"
-#include <unistd.h> // unlink
-
-#include <map>
-
-#include FORMS_H_LOCATION
 
 using std::endl;
 using std::map;
@@ -38,6 +39,7 @@ GraphicsCacheItem_pimpl::GraphicsCacheItem_pimpl()
          pixmap_(0), renderer(0), refCount(0)
 {}
 
+
 GraphicsCacheItem_pimpl::~GraphicsCacheItem_pimpl()
 {
        if (imageStatus_ == GraphicsCacheItem::Loaded) {
@@ -47,6 +49,7 @@ GraphicsCacheItem_pimpl::~GraphicsCacheItem_pimpl()
        delete renderer;
 }
 
+
 bool
 GraphicsCacheItem_pimpl::setFilename(string const & filename)
 {
@@ -59,15 +62,17 @@ GraphicsCacheItem_pimpl::setFilename(string const & filename)
        return false;
 }
 
+
 /*** Callback method ***/
 
 typedef map<string, GraphicsCacheItem_pimpl*> CallbackMap;
 static CallbackMap callbackMap;
 
+
 void
 callback(string cmd, int retval)
 {
-       lyxerr << "callback, cmd="<<cmd<<", retval="<<retval<<endl;
+       lyxerr << "callback, cmd=" << cmd << ", retval=" << retval << endl;
 
        GraphicsCacheItem_pimpl * item = callbackMap[cmd];
        callbackMap.erase(cmd);
@@ -75,10 +80,11 @@ callback(string cmd, int retval)
        item->imageConverted(retval);
 }
 
+
 void
 GraphicsCacheItem_pimpl::imageConverted(int retval)
 {
-       lyxerr << "imageConverted, retval="<<retval<<endl;
+       lyxerr << "imageConverted, retval=" << retval << endl;
 
        if (retval) {
                imageStatus_ = GraphicsCacheItem::ErrorConverting;
@@ -102,7 +108,7 @@ GraphicsCacheItem_pimpl::renderXPM(string const & filename)
 
        // Take only the filename part of the file, without path or extension.
        string temp = OnlyFilename(filename);
-       temp = ChangeExtension(filename , string());
+       temp = ChangeExtension(filename, string());
        
        // Add some stuff to have it a unique temp file.
        xpmfile = TmpFileName(string(), temp);
@@ -117,19 +123,20 @@ GraphicsCacheItem_pimpl::renderXPM(string const & filename)
        // There is a problem with running it asyncronously, it doesn't return
        // to call the callback, so until the Systemcalls mechanism is fixed
        // I use the syncronous method.
-       lyxerr << "Launching convert to xpm, command="<<command<<endl;
+       lyxerr << "Launching convert to xpm, command=" << command << endl;
 //     syscall.startscript(Systemcalls::DontWait, command, &callback);
        syscall.startscript(Systemcalls::Wait, command, &callback);
 
        return true;
 }
 
+
 // This function gets called from the callback after the image has been
 // converted successfully.
 void
 GraphicsCacheItem_pimpl::loadXPMImage()
 {
-       if (! renderer->setFilename(xpmfile)) {
+       if (!renderer->setFilename(xpmfile)) {
                return;
        }
 
index 80b6a18966b16ef80aeab4d602bdbdf990d3e169..ae819a75b24d9c17dd2b22b3347889e39ea933bf 100644 (file)
@@ -59,13 +59,13 @@ public:
        /// Is the pixmap ready for display?
        ImageStatus getImageStatus() const; 
 
-       /// Get a notification when the image conversion is done.
-       /// used by an internal callback mechanism.
+       /** Get a notification when the image conversion is done.
+           used by an internal callback mechanism. */
        void imageConverted(int retval);
 
 private:
-    /// Private c-tor so that only GraphicsCache can create an instance.
-    GraphicsCacheItem_pimpl();
+       /// Private c-tor so that only GraphicsCache can create an instance.
+       GraphicsCacheItem_pimpl();
 
        /// Set the filename this item will be pointing too.
        bool setFilename(string const & filename);
@@ -76,8 +76,8 @@ private:
        /// Load the image from XPM to memory Pixmap
        void loadXPMImage();
        
-    ///
-    friend class GraphicsCacheItem;
+       ///
+       friend class GraphicsCacheItem;
 
        /// The file name of the XPM file.
        string xpmfile;
index 405f5a1d158fec3b264bad42565fecf38bb92503..bd56495a2c242f5134b50a883d26aeb461d4b465 100644 (file)
 Renderer::Renderer()
        : width_(0), height_(0), pixmapLoaded_(false)
 {}
-       
+
+
 Renderer::~Renderer()
 {
        freePixmap();
 }
 
+
 bool Renderer::setFilename(string const & filename)
 {
        // Make sure file exists and is readable.
@@ -45,17 +47,21 @@ bool Renderer::setFilename(string const & filename)
        return true;
 }
 
+
 bool Renderer::renderImage()
 {
        return false;
 }
 
+
 bool Renderer::isImageFormatOK(string const & /*filename*/) const
 {
        return false;
 }
 
-void Renderer::setPixmap(Pixmap pixmap, unsigned int width, unsigned int height)
+
+void Renderer::setPixmap(Pixmap pixmap,
+                        unsigned int width, unsigned int height)
 {
        freePixmap();
 
@@ -65,17 +71,30 @@ void Renderer::setPixmap(Pixmap pixmap, unsigned int width, unsigned int height)
        pixmapLoaded_ = true;
 }
 
+
 Pixmap Renderer::getPixmap() const
-{ return pixmap_; }
+{
+       return pixmap_;
+}
+
 
 unsigned int Renderer::getWidth() const
-{ return width_; }
+{
+       return width_;
+}
+
 
 unsigned int Renderer::getHeight() const
-{ return height_; }
+{
+       return height_;
+}
+
 
 string const & Renderer::getFilename() const
-{ return filename_; }
+{
+       return filename_;
+}
+
 
 void Renderer::freePixmap()
 {
index 2d9e41b4900cef49777e6a4282a7368187cce5f5..93284b6644bd68608b07a61ae55128f5e23122b5 100644 (file)
@@ -72,7 +72,7 @@ bool XPM_Renderer::renderImage()
 
 bool XPM_Renderer::isImageFormatOK(string const & filename) const
 {
-       std::ifstream is(filename.c_str(), ios::in);
+       std::ifstream is(filename.c_str());
 
        // The signature of the file without the spaces.
        static const char str[] = "/*XPM*/";
index f42b9a235a1bf246d38e3edc560e86f00c4fb979..45f4eb5460da1705367782af4f65e190e6a511e7 100644 (file)
@@ -72,9 +72,9 @@ using std::vector;
 using std::find;
 using std::flush;
 using std::endl;
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
 using std::ostringstream;
-#endif
+//#endif
 
 extern BufferView * current_view;
 extern FL_OBJECT * figinset_canvas;
@@ -538,31 +538,31 @@ void runqueue()
                        ofs.close(); // Don't remove this.
 
                        // gs process - set ghostview environment first
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                        ostringstream t2;
-#else
-                       char tbuf2[80];
-                       ostrstream t2(tbuf2, sizeof(tbuf2));
-#endif
+//#else
+//                     char tbuf2[80];
+//                     ostrstream t2(tbuf2, sizeof(tbuf2));
+//#endif
                        t2 << "GHOSTVIEW=" << fl_get_canvas_id(figinset_canvas)
                           << ' ' << p->data->bitmap;
-#ifndef HAVE_SSTREAM
-                       t2 << '\0';
-#endif
+//#ifndef HAVE_SSTREAM
+//                     t2 << '\0';
+//#endif
                        // now set up ghostview property on a window
                        // #warning BUG seems that the only bug here
                        // might be the hardcoded dpi.. Bummer!
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                        ostringstream t1;
-#else
-                       char tbuf[384];
-                       ostrstream t1(tbuf, sizeof(tbuf));
-#endif
+//#else
+//                     char tbuf[384];
+//                     ostrstream t1(tbuf, sizeof(tbuf));
+//#endif
                        t1 << "0 0 0 0 " << p->data->wid << ' '
                           << p->data->hgh << " 72 72 0 0 0 0";
-#ifndef HAVE_SSTREAM
-                       t1 << '\0';
-#endif
+//#ifndef HAVE_SSTREAM
+//                     t1 << '\0';
+//#endif
                        
                        if (lyxerr.debugging()) {
                                lyxerr << "Will set GHOSTVIEW property to ["
@@ -613,7 +613,7 @@ void runqueue()
                                ::sleep(1);
                                XGrabServer(tempdisp);
                        }
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                        XChangeProperty(tempdisp, 
                                        fl_get_canvas_id(figinset_canvas),
                                        XInternAtom(tempdisp, "GHOSTVIEW", false),
@@ -621,25 +621,25 @@ void runqueue()
                                        8, PropModeAppend, 
                                        reinterpret_cast<unsigned char*>(const_cast<char*>(t1.str().c_str())),
                                        t1.str().size());
-#else
-                       
-                       XChangeProperty(tempdisp, 
-                                       fl_get_canvas_id(figinset_canvas),
-                                       XInternAtom(tempdisp, "GHOSTVIEW", false),
-                                       XInternAtom(tempdisp, "STRING", false),
-                                       8, PropModeAppend, 
-                                       reinterpret_cast<unsigned char*>(const_cast<char*>(t1.str())),
-                                       ::strlen(t1.str()));
-#endif
+//#else
+//                     
+//                     XChangeProperty(tempdisp, 
+//                                     fl_get_canvas_id(figinset_canvas),
+//                                     XInternAtom(tempdisp, "GHOSTVIEW", false),
+//                                     XInternAtom(tempdisp, "STRING", false),
+//                                     8, PropModeAppend, 
+//                                     reinterpret_cast<unsigned char*>(const_cast<char*>(t1.str())),
+//                                     ::strlen(t1.str()));
+//#endif
                        XUngrabServer(tempdisp);
                        XFlush(tempdisp);
 
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                        ostringstream t3;
-#else
-                       //char tbuf[384];
-                       ostrstream t3(tbuf, sizeof(tbuf));
-#endif
+//#else
+//                     //char tbuf[384];
+//                     ostrstream t3(tbuf, sizeof(tbuf));
+//#endif
                        switch (p->data->flags & 3) {
                        case 0: t3 << 'H'; break; // Hidden
                        case 1: t3 << 'M'; break; // Mono
@@ -654,12 +654,12 @@ void runqueue()
        
                        t3 << ' ' << BlackPixelOfScreen(DefaultScreenOfDisplay(tempdisp))
                           << ' ' << background_pixel;
-#ifndef HAVE_SSTREAM
-                       t3 << '\0';
-#endif
+//#ifndef HAVE_SSTREAM
+//                     t3 << '\0';
+//#endif
 
                        XGrabServer(tempdisp);
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                        XChangeProperty(tempdisp, 
                                        fl_get_canvas_id(figinset_canvas),
                                        XInternAtom(tempdisp,
@@ -668,16 +668,16 @@ void runqueue()
                                        8, PropModeReplace, 
                                        reinterpret_cast<unsigned char*>(const_cast<char*>(t3.str().c_str())),
                                        t3.str().size());
-#else
-                       XChangeProperty(tempdisp, 
-                                       fl_get_canvas_id(figinset_canvas),
-                                       XInternAtom(tempdisp,
-                                                   "GHOSTVIEW_COLORS", false),
-                                       XInternAtom(tempdisp, "STRING", false),
-                                       8, PropModeReplace, 
-                                       reinterpret_cast<unsigned char*>(const_cast<char*>(t3.str())),
-                                       ::strlen(t3.str()));
-#endif
+//#else
+//                     XChangeProperty(tempdisp, 
+//                                     fl_get_canvas_id(figinset_canvas),
+//                                     XInternAtom(tempdisp,
+//                                                 "GHOSTVIEW_COLORS", false),
+//                                     XInternAtom(tempdisp, "STRING", false),
+//                                     8, PropModeReplace, 
+//                                     reinterpret_cast<unsigned char*>(const_cast<char*>(t3.str())),
+//                                     ::strlen(t3.str()));
+//#endif
                        XUngrabServer(tempdisp);
                        XFlush(tempdisp);
                        
@@ -691,14 +691,14 @@ void runqueue()
                                ++ne;
                        typedef char * char_p;
                        env = new char_p[ne + 2];
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                        string tmp = t2.str().c_str();
                        env[0] = new char[tmp.size() + 1];
                        std::copy(tmp.begin(), tmp.end(), env[0]);
                        env[0][tmp.size()] = '\0';
-#else
-                       env[0] = tbuf2;
-#endif
+//#else
+//                     env[0] = tbuf2;
+//#endif
                        ::memcpy(&env[1], environ, sizeof(char*) * (ne + 1));
                        environ = env;
 
@@ -1250,7 +1250,7 @@ bool InsetFig::Deletable() const
 }
 
 
-char const * InsetFig::EditMessage() const 
+string const InsetFig::EditMessage() const 
 {
        return _("Opened figure");
 }
@@ -1957,7 +1957,7 @@ void InsetFig::RestoreForm()
 }
 
 
-void InsetFig::Preview(char const * p)
+void InsetFig::Preview(string const & p)
 {
        int pid = fork();
 
index b48d9235d2df810bf41085f73239aff84a06ebbd..8c0799cca051404425a859733d69b0baa6a8e8ca 100644 (file)
@@ -47,7 +47,7 @@ public:
        void Validate(LaTeXFeatures & features) const;
 
        /// what appears in the minibuffer when opening
-       char const * EditMessage() const;
+       string const EditMessage() const;
        
        ///
        void Edit(BufferView *, int, int, unsigned int);
@@ -62,7 +62,7 @@ public:
        ///
        void CallbackFig(long arg);
        ///
-       void Preview(char const * p);
+       void Preview(string const & p);
        /// browse for file
        void BrowseFile();
 
index e948979a6b9360e6004db2c7637c2b4ef14a1733..77b969764d7402cf177c2c52a42953764b2e7816 100644 (file)
@@ -64,13 +64,13 @@ void Inset::Edit(BufferView *, int, int, unsigned int)
 }
 
 
-LyXFont Inset::ConvertFont(LyXFont const & font) const
+LyXFont const Inset::ConvertFont(LyXFont const & font) const
 {
     return LyXFont(font);
 }
 
 
-char const * Inset::EditMessage() const 
+string const Inset::EditMessage() const 
 {
     return _("Opened inset");
 }
index 1f1dcfbf9a3141a55fe0003bd7d51edb37a47557..2cf364350df7247742d6859062de21df138a5e0e 100644 (file)
@@ -153,7 +153,7 @@ void InsetBibKey::Read(Buffer const *, LyXLex & lex)
 }
 
 
-string InsetBibKey::getScreenLabel() const
+string const InsetBibKey::getScreenLabel() const
 {
        if (! getOptions().empty())
                return getOptions();
@@ -214,7 +214,7 @@ InsetBibtex::~InsetBibtex()
 }
 
 
-string InsetBibtex::getScreenLabel() const
+string const InsetBibtex::getScreenLabel() const
 {
        return _("BibTeX Generated References");
 }
@@ -262,7 +262,7 @@ int InsetBibtex::Latex(Buffer const *, ostream & os,
 
 
 // This method returns a comma separated list of Bibtex entries
-vector<pair<string,string> > InsetBibtex::getKeys() const
+vector<pair<string, string> > const InsetBibtex::getKeys() const
 {
        // This hack is copied from InsetBibtex::Latex.
        // Is it still needed? Probably yes.
@@ -397,7 +397,7 @@ int bibitemMaxWidth(BufferView * bv, LyXFont const & font)
 
 
 // ale070405
-string bibitemWidest(BufferView * bv)
+string const bibitemWidest(BufferView * bv)
 {
        int w = 0;
        // Does look like a hack? It is! (but will change at 0.13)
index 58266516ab109aa586f678bee68c561fc4fc01e5..a717f52d301f9101e2f05d58ed39656f04b8ea36 100644 (file)
@@ -42,7 +42,7 @@ public:
        ///
        void Read(Buffer const *, LyXLex & lex);
        ///
-       virtual string getScreenLabel() const;
+       virtual string const getScreenLabel() const;
         ///
        void Edit(BufferView *, int x, int y, unsigned int button);
        ///
@@ -84,7 +84,7 @@ public:
        ///
        Inset * Clone() const { return new InsetBibtex(params(), owner); }
        ///
-       string getScreenLabel() const;
+       string const getScreenLabel() const;
        ///
        EDITABLE Editable() const { return IS_EDITABLE; }
        ///
@@ -95,7 +95,7 @@ public:
        int Latex(Buffer const *, std::ostream &,
                  bool fragile, bool freespace) const;
        ///
-       std::vector<std::pair<string,string> > getKeys() const;
+       std::vector<std::pair<string,string> > const getKeys() const;
         ///
         bool addDatabase(string const &);
         ///
index 7176769d71bdda243aa11d7603b06d190d0a2fdd..c6a6a12ffc990b19befb5b43635076cb9fa60fdf 100644 (file)
@@ -34,7 +34,7 @@ public:
 
 protected:
        /// This should provide the text for the button
-       virtual string getScreenLabel() const = 0;
+       virtual string const getScreenLabel() const = 0;
 };
 
 #endif
index f0d33a8021993fc8b89d06ee59856638ee4670f6..640c53695b3c82323f6c4dcd2f931227c4be589f 100644 (file)
@@ -24,7 +24,7 @@ InsetCitation::InsetCitation(InsetCommandParams const & p)
        : InsetCommand(p)
 {}
 
-string InsetCitation::getScreenLabel() const
+string const InsetCitation::getScreenLabel() const
 {
        string keys(getContents());
 
@@ -56,6 +56,7 @@ string InsetCitation::getScreenLabel() const
        return '[' + label + ']';
 }
 
+
 void InsetCitation::Edit(BufferView * bv, int, int, unsigned int)
 {
        bv->owner()->getDialogs()->showCitation( this );
index fc2487c41ccea920da49703559add13f5a5204b6..43d3c21a273b9d62262613024a78e7b8e6b8edf9 100644 (file)
@@ -26,7 +26,7 @@ public:
        ///
        Inset * Clone() const { return new InsetCitation(params()); }
        ///
-       string getScreenLabel() const;
+       string const getScreenLabel() const;
        ///
        EDITABLE Editable() const { return IS_EDITABLE; }
         ///
index 5c1e972ed639f918bf3ae73b66a883a49d4e3c74..0530cc516e5bfa33d92ec795b996bc65fc2b70dc 100644 (file)
@@ -33,7 +33,7 @@ InsetCommandParams::InsetCommandParams( string const & n,
 {}
 
 
-string InsetCommandParams::getAsString() const
+string const InsetCommandParams::getAsString() const
 {
        string b(cmdname);
        b += "|++|" + options + "|++|" + contents;
@@ -66,19 +66,14 @@ void InsetCommandParams::setFromString( string const & b )
 
 bool InsetCommandParams::operator==(InsetCommandParams const & o) const
 {
-       if( cmdname  != o.cmdname )  return false;
-       if( contents != o.contents ) return false;
-       if( options  != o.options )  return false;
-       return true;
+       if (cmdname == o.cmdname && contents == o.contents && options == o.options) return true;
+       return false;
 }
 
 
 bool InsetCommandParams::operator!=(InsetCommandParams const & o) const
 {
-       if( cmdname  != o.cmdname )  return true;
-       if( contents != o.contents ) return true;
-       if( options  != o.options )  return true;
-       return false;
+       return !(*this == o);
 }
 
 
@@ -173,7 +168,7 @@ void InsetCommandParams::Write(ostream & os) const
 }
 
 
-string InsetCommandParams::getCommand() const
+string const InsetCommandParams::getCommand() const
 {      
        string s;
        if (!getCmdName().empty()) s += "\\"+getCmdName();
index bc040acd22daa6bd4ef6c0738782dfff38ec49c3..8a4fdcfcaabac74233fa4270a86e5519b83643d6 100644 (file)
@@ -50,7 +50,7 @@ public:
        ///
        void Write(std::ostream &) const;
        /// Build the complete LaTeX command
-       string getCommand() const;
+       string const getCommand() const;
        ///
        string const & getCmdName() const { return cmdname; }
        ///
@@ -64,7 +64,7 @@ public:
        ///
        void setContents(string const & c) { contents = c; }
        ///
-       string getAsString() const;
+       string const getAsString() const;
        ///
        void setFromString( string const & );
 private:
@@ -111,9 +111,9 @@ public:
          confusion with lyxinset::getLabel(int), but I've seen that
          it wasn't. I hope you never confuse again both methods.  (ale)
         */
-       virtual string getScreenLabel() const = 0;
+       virtual string const getScreenLabel() const = 0;
        ///
-       string getCommand() const { return p_.getCommand(); }
+       string const getCommand() const { return p_.getCommand(); }
        ///
        string const & getCmdName() const { return p_.getCmdName(); }
        ///
index 7cfdd4b25028f750b9703d83997b30e616d2c021..efabf8bf2a4ef572ddb25f99eacb56fcdbf9d7ca 100644 (file)
@@ -162,7 +162,7 @@ void C_InsetError_CloseErrorCB(FL_OBJECT * ob, long data)
 }
 
 
-char const * InsetError::EditMessage() const 
+string const InsetError::EditMessage() const 
 {
        return _("Opened error");
 }
index d1a19f8491f6002a7f5d98fb606a1f587c7ae565..6f2770bf50a2b38be3457d7f639c5c72191cd22b 100644 (file)
@@ -61,7 +61,7 @@ public:
        ///
        bool AutoDelete() const;
        /// what appears in the minibuffer when opening
-       char const * EditMessage() const;
+       string const EditMessage() const;
        ///
        void Edit(BufferView *, int x, int y, unsigned int button);
        ///
index 2abd91b8e4958cd55566101a9db3b4ef2cc6013a..f90eaba32fcc1d717ae963113328b8cee079c3dd 100644 (file)
@@ -54,7 +54,7 @@ Inset * InsetERT::Clone() const
 }
 
 
-char const * InsetERT::EditMessage() const 
+string const InsetERT::EditMessage() const 
 {
     return _("Opened ERT Inset");
 }
index 77c63df10a9b80c739617633fc4187cd85cddb22..0ba3405cb3f30b3ff538a7e4d699a7911e0edda9 100644 (file)
@@ -34,7 +34,7 @@ public:
        ///
        Inset * Clone() const;
        ///
-       char const * EditMessage() const;
+       string const EditMessage() const;
        ///
        bool InsertInset(BufferView *, Inset *) { return false; }
        ///
index caaad36f993af5db92b3e2f6b129cc73d6a104ba..6da89c981298f633a16bec0b369fbcd5f9129c4e 100644 (file)
@@ -245,10 +245,10 @@ void InsetExternal::cancelCB(FL_OBJECT * ob, long)
 }
 
 
-char const * InsetExternal::EditMessage() const
+string const InsetExternal::EditMessage() const
 {
        ExternalTemplate const & et = getTemplate(templatename);
-       return doSubstitution(0, et.guiName).c_str();
+       return doSubstitution(0, et.guiName);
 }
 
 
@@ -402,7 +402,7 @@ Inset * InsetExternal::Clone() const
 }
 
 
-string InsetExternal::getScreenLabel() const
+string const InsetExternal::getScreenLabel() const
 {
        if (templatename.empty()) {
                return _("External");
@@ -469,7 +469,7 @@ void InsetExternal::automaticUpdate(BufferView const * bv) const
 }
 
 
-string InsetExternal::doSubstitution(Buffer const * buffer,
+string const InsetExternal::doSubstitution(Buffer const * buffer,
                                     string const & s) const
 {
        string result;
@@ -506,13 +506,13 @@ string InsetExternal::doSubstitution(Buffer const * buffer,
 }
 
 
-string InsetExternal::getCurrentTemplate() const
+string const InsetExternal::getCurrentTemplate() const
 {
        return getTemplateName(fl_get_choice(form_external->templatechoice));
 }
 
 
-ExternalTemplate InsetExternal::getTemplate(string const & name) const
+ExternalTemplate const InsetExternal::getTemplate(string const & name) const
 {
        ExternalTemplateManager::Templates::const_iterator i = 
                ExternalTemplateManager::get().getTemplates().find(name);
@@ -543,7 +543,7 @@ int InsetExternal::getTemplateNumber(string const & name) const
 }
 
 
-string InsetExternal::getTemplateName(int i) const
+string const InsetExternal::getTemplateName(int i) const
 {
        ExternalTemplateManager::Templates::const_iterator i1;
        i1 = ExternalTemplateManager::get().getTemplates().begin();
@@ -554,7 +554,7 @@ string InsetExternal::getTemplateName(int i) const
 }
 
 
-string InsetExternal::getTemplateString() const
+string const InsetExternal::getTemplateString() const
 {
        string result;
        bool first = true;
index 58f1b6763cb46fc4eaf070096c3b555dad3688b6..2c02c285d1942d47b421a3772fe0bb9490537658 100644 (file)
@@ -29,7 +29,7 @@ public:
        ///
        virtual ~InsetExternal();
        /// what appears in the minibuffer when opening
-       virtual char const * EditMessage() const;
+       virtual string const EditMessage() const;
        ///
        virtual void Edit(BufferView *, int x, int y, unsigned int button);
        ///
@@ -62,7 +62,7 @@ public:
        virtual Inset * Clone() const;
 
        /// returns the text of the button
-       virtual string getScreenLabel() const;
+       virtual string const getScreenLabel() const;
 
        /// Callback function for the template drop-down
        static void templateCB(FL_OBJECT *, long);
@@ -106,27 +106,27 @@ private:
        void doView(BufferView const *) const;
 
        /// Substitute meta-variables in this string
-       string doSubstitution(Buffer const *, string const & s) const;
+       string const doSubstitution(Buffer const *, string const & s) const;
 
        /** Get the LyX name of the currently selected
            template in the choice list
        */
-       string getCurrentTemplate() const;
+       string const getCurrentTemplate() const;
 
        /// Get a certain template from a LyX name
-       ExternalTemplate getTemplate(string const & lyxname) const;
+       ExternalTemplate const getTemplate(string const & lyxname) const;
 
        /**
-        * Get the number starting from 1 of a template with a 
-        * specific LyX name for the choice list
+         Get the number starting from 1 of a template with a 
+         specific LyX name for the choice list
         */
        int getTemplateNumber(string const & guiname) const;
 
        /// Get the LyX name of a template with a given number starting from 1
-       string getTemplateName(int n) const;
+       string const getTemplateName(int n) const;
 
        /// Get a string with all the GUI template names separated by |
-       string getTemplateString() const;
+       string const getTemplateString() const;
 
        ///
        struct Holder {
index dd482beefd9112440382899cf2f61edc37721577..0a104ae345bbafc5ea7de853f329094e0dabed47 100644 (file)
@@ -146,7 +146,7 @@ Inset * InsetFloat::Clone() const
 }
 
 
-char const * InsetFloat::EditMessage() const
+string const InsetFloat::EditMessage() const
 {
        return _("Opened Float Inset");
 }
index 3fca507bb127cd284da788a7816ad327cc75c313..821fd7409fd2eb96b29c26ae8c3a6768ff9cfee2 100644 (file)
@@ -40,7 +40,7 @@ public:
        ///
        int Latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
        ///
-       const char * EditMessage() const;
+       string const EditMessage() const;
        ///
        bool InsertInsetAllowed(Inset * inset) const;
        ///
index 732c0441b470d9db31759dd40ba62d153aaf24f6..c806568c2eefbeb1679ae891151818aff10f2ba7 100644 (file)
@@ -45,7 +45,7 @@ Inset * InsetFoot::Clone() const
 }
 
 
-char const * InsetFoot::EditMessage() const
+string const InsetFoot::EditMessage() const
 {
     return _("Opened Footnote Inset");
 }
index d84e1327c2ae61504561f0b68009771bab43b819..8c83d5a65c9468a899fddae4eb141884c3899510 100644 (file)
@@ -34,7 +34,7 @@ public:
        ///
        int Latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
        ///
-       const char * EditMessage() const;
+       string const EditMessage() const;
        ///
        bool InsertInsetAllowed(Inset * inset) const;
 };
index 806ffebbf6e872d50b35b03caced373977791e98..f260fb1a6304982ddc7ebf5ad1917e68812e8db6 100644 (file)
@@ -368,8 +368,9 @@ void InsetGraphics::Read(Buffer const * buf, LyXLex & lex)
        updateInset();
 }
 
-static void formatResize(ostream & os, char const *key,
-                         InsetGraphicsParams::Resize resizeType, double size)
+static
+void formatResize(ostream & os, string const & key,
+                 InsetGraphicsParams::Resize resizeType, double size)
 {
        switch (resizeType) {
        case InsetGraphicsParams::DEFAULT_SIZE:
@@ -423,11 +424,11 @@ int InsetGraphics::Latex(Buffer const *buf, ostream & os,
        // Calculate the options part of the command, we must do it to a string
        // stream since we might have a trailing comma that we would like to remove
        // before writing it to the output stream.
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
        std::ostringstream options;
-#else
-       ostrstream options;
-#endif 
+//#else
+//     ostrstream options;
+//#endif 
 
        formatResize(options, "width", params.widthResize, params.widthSize);
        formatResize(options, "height", params.heightResize, params.heightSize);
@@ -543,14 +544,14 @@ int InsetGraphics::Latex(Buffer const *buf, ostream & os,
        }
 #endif 
 
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
        string opts(options.str().c_str());
-#else
-       options << '\0';
-       char * tmp = options.str();
-       string opts(tmp);
-       delete [] tmp;
-#endif 
+//#else
+//     options << '\0';
+//     char * tmp = options.str();
+//     string opts(tmp);
+//     delete [] tmp;
+//#endif 
        opts = strip(opts, ',');
 
 
index a285b7929a2a7ac79102dfc3b32084d0e2b893d8..ec1c1bae114f77386bcdadd3a4a6380879711adc 100644 (file)
@@ -36,11 +36,10 @@ class Dialogs;
 ///
 #ifdef SIGC_CXX_NAMESPACES
 class InsetGraphics : public Inset, public SigC::Object
-{
 #else
 class InsetGraphics : public Inset, public Object
+#endif
 {
-#endif 
 public:
        ///
        InsetGraphics();
@@ -66,8 +65,8 @@ public:
        void Read(Buffer const *, LyXLex & lex);
 
        /** returns the number of rows (\n's) of generated tex code.
-        fragile == true means, that the inset should take care about
-        fragile commands by adding a \protect before.
+        #fragile == true# means, that the inset should take care about
+        fragile commands by adding a #\protect# before.
         */
        int Latex(Buffer const *, std::ostream &,
                  bool fragile, bool free_spc) const;
@@ -79,8 +78,8 @@ public:
        int DocBook(Buffer const *, std::ostream &) const;
 
        /** Tell LyX what the latex features you need i.e. what latex packages
-           you need to be included.
-           */
+           you need to be included.
+        */
        void Validate(LaTeXFeatures & features) const;
 
        /// returns LyX code associated with the inset. Used for TOC, ...)
@@ -89,16 +88,18 @@ public:
        ///
        Inset * Clone() const;
 
-       /// Set the inset parameters, used by the GUIndependent dialog.
-       /// Return true of new params are different from what was so far.
+       /** Set the inset parameters, used by the GUIndependent dialog.
+           Return true of new params are different from what was so far.
+       */
        bool setParams(InsetGraphicsParams const & params);
 
        /// Get the inset parameters, used by the GUIndependent dialog.
        InsetGraphicsParams getParams() const;
 
-       /// This signal is connected by our dialog and called when the inset
-       /// is deleted.
-       Signal0 < void > hide;
+       /** This signal is connected by our dialog and called when the inset
+           is deleted.
+       */
+       Signal0 <void> hide;
 private:
        /// Update the inset after parameter change.
        void updateInset();
index 7c3b0e89b9f25a93c458a234ab43180c2116e1c2..8ac312521afeb2d3c5b36480955f44a27b7c78e7 100644 (file)
@@ -94,8 +94,8 @@ InsetGraphicsParams::InsetGraphicsParams(InsetGraphicsParams const & igp)
        copy(igp);
 }
 
-InsetGraphicsParams const &
-InsetGraphicsParams::operator=(InsetGraphicsParams const &params)
+InsetGraphicsParams &
+InsetGraphicsParams::operator=(InsetGraphicsParams const & params)
 {
        // Are we assigning the object into itself?
        if (this == &params)
@@ -197,7 +197,9 @@ bool operator==(InsetGraphicsParams const & left,
        return false;
 }
 
-static void writeResize(ostream & os, char const * key,
+
+static
+void writeResize(ostream & os, string const & key,
                         InsetGraphicsParams::Resize resize, double size)
 {
        os << ' ' << key << "Resize ";
index f6bce4aeef8e9c9efa366289923c1e3ad3916522..605ddd43f36cb407131df8c8a1be9373e07f82a7 100644 (file)
@@ -71,8 +71,8 @@ struct InsetGraphicsParams
            REFERENCE_POINT = LEFTBASELINE
        };
 
-       /// The resize of the image, is it the default size, in cm, inch or
-       /// percentage of the page/column width/height
+       /** The resize of the image, is it the default size, in cm, inch or
+           percentage of the page/column width/height */
        enum Resize {
            DEFAULT_SIZE,
            CM,
@@ -85,24 +85,25 @@ struct InsetGraphicsParams
        /// Keep the ratio between height and width when resizing.
        bool keepAspectRatio;
 
-       // What width resize to do?
+       /// What width resize to do?
        Resize widthResize;
-       // Value of width resize
+       /// Value of width resize
        float widthSize;
-       // What height resize to do?
+       /// What height resize to do?
        Resize heightResize;
-       // Value of height resize
+       /// Value of height resize
        float heightSize;
 
-       // Origin point of rotation
+       /// Origin point of rotation
        Origin rotateOrigin;
-       // Rotation angle.
+       /// Rotation angle.
        int rotateAngle;
-
+       ///
        InsetGraphicsParams();
-
+       ///
        InsetGraphicsParams(InsetGraphicsParams const &);
-       InsetGraphicsParams const & operator=(InsetGraphicsParams const &);
+       ///
+       InsetGraphicsParams & operator=(InsetGraphicsParams const &);
 
        /// Save the parameters in the LyX format stream.
        void Write(Buffer const * buf, ostream & os) const;
@@ -121,6 +122,7 @@ private:
        void copy(InsetGraphicsParams const & params);
 };
 
-bool operator==(InsetGraphicsParams const&, InsetGraphicsParams const &);
+///
+bool operator==(InsetGraphicsParams const &, InsetGraphicsParams const &);
 
 #endif 
index bb2c28c85472e3334a438e1d331df8efeed7d2fc..835e1fac42b72858796fcd4a9133ffaa9db4cb5d 100644 (file)
@@ -190,23 +190,24 @@ void include_cb(FL_OBJECT *, long arg)
 }
 
 
-static string unique_id() {
+static inline
+string unique_id() {
        static unsigned int seed=1000;
 
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
        std::ostringstream ost;
        ost << "file" << ++seed;
 
        // Needed if we use lyxstring.
        return ost.str().c_str();
-#else
-       char ctmp[16];
-       ostrstream ost(ctmp,16);
-       ost << "file" << ++seed << '\0';
-
-       // Needed if we use lyxstring.
-       return ost.str();
-#endif
+//#else
+//     char ctmp[16];
+//     ostrstream ost(ctmp,16);
+//     ost << "file" << ++seed << '\0';
+//
+//     // Needed if we use lyxstring.
+//     return ost.str();
+//#endif
 }
 
 
@@ -313,7 +314,7 @@ bool InsetInclude::display() const
 }
 
 
-string InsetInclude::getScreenLabel() const
+string const InsetInclude::getScreenLabel() const
 {
        string temp;
        if (isInput())
@@ -333,14 +334,14 @@ string InsetInclude::getScreenLabel() const
 }
 
 
-string InsetInclude::getFileName() const
+string const InsetInclude::getFileName() const
 {
        return MakeAbsPath(getContents(), 
                           OnlyPath(getMasterFilename()));
 }
 
 
-string InsetInclude::getMasterFilename() const
+string const InsetInclude::getMasterFilename() const
 {
        return master->fileName();
 }
@@ -535,7 +536,7 @@ void InsetInclude::Validate(LaTeXFeatures & features) const
 }
 
 
-vector<string> InsetInclude::getLabelList() const
+vector<string> const InsetInclude::getLabelList() const
 {
     vector<string> l;
     string parentname;
@@ -551,7 +552,7 @@ vector<string> InsetInclude::getLabelList() const
 }
 
 
-vector<pair<string,string> > InsetInclude::getKeys() const
+vector<pair<string,string> > const InsetInclude::getKeys() const
 {
        vector<pair<string,string> > keys;
        
index ff6477c0692b20527c5c3a11f5220483cdd4ad09..954342cd5eba11fd8adb047aa772d6490da426c7 100644 (file)
@@ -35,9 +35,9 @@ public:
        ///
        Inset::Code LyxCode() const { return Inset::INCLUDE_CODE; }
        /// This returns the list of labels on the child buffer
-       std::vector<string> getLabelList() const;
+       std::vector<string> const getLabelList() const;
        /// This returns the list of bibkeys on the child buffer
-       std::vector< std::pair<string,string> > getKeys() const;
+       std::vector< std::pair<string,string> > const getKeys() const;
        ///
        void Edit(BufferView *, int x, int y, unsigned int button);
        ///
@@ -63,11 +63,11 @@ public:
        */
        bool display() const;
        ///
-       string getScreenLabel() const;
+       string const getScreenLabel() const;
         ///
-        string getMasterFilename() const;
+        string const getMasterFilename() const;
         ///
-        string getFileName() const;
+        string const getFileName() const;
 
         ///  In "input" mode uses \input instead of \include.
        bool isInput() const { return flag == InsetInclude::INPUT; }
index c5ebb9b92f61cb75cace221a59ce3822490a4346..7f8cbe6f00690123055e3b7a1acfe3bd26bd39ab 100644 (file)
@@ -15,7 +15,7 @@ InsetIndex::InsetIndex(InsetCommandParams const & p)
 {}
 
 
-string InsetIndex::getScreenLabel() const
+string const InsetIndex::getScreenLabel() const
 {
        return _("Idx");
 }
@@ -31,7 +31,7 @@ InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
        : InsetCommand(p)
 {}
 
-string InsetPrintIndex::getScreenLabel() const
+string const InsetPrintIndex::getScreenLabel() const
 {
        return _("Index");
 }
index 92b6f57542445cf85b6a44b6104301eeb3ac9000..7d0120ab4f6408f595084715a08ede1070f046d1 100644 (file)
@@ -29,7 +29,7 @@ public:
        ///
        Inset * Clone() const { return new InsetIndex(params());}
        ///
-       string getScreenLabel() const;
+       string const getScreenLabel() const;
        ///
        EDITABLE Editable() const { return IS_EDITABLE; }
        ///
@@ -54,7 +54,7 @@ public:
        ///
        Inset::Code LyxCode() const;
        ///
-       string getScreenLabel() const;
+       string const getScreenLabel() const;
 };
 
 #endif
index 445bb65c0f8d18307399bd8186a6c190fcebace3..55d6cf911193f9d45f20904afffebd8de59a0530 100644 (file)
@@ -193,7 +193,7 @@ void C_InsetInfo_CloseInfoCB(FL_OBJECT * ob, long data)
 }
 
 
-char const * InsetInfo::EditMessage() const 
+string const InsetInfo::EditMessage() const 
 {
        return _("Opened note");
 }
index 01894676d6aca67ae8e670419a8c530fb7372d82..9e9b342e582915cf336878308153eceb85c3ea08 100644 (file)
@@ -59,7 +59,7 @@ public:
        ///
        int DocBook(Buffer const *, std::ostream &) const;
        /// what appears in the minibuffer when opening
-       char const * EditMessage() const;
+       string const EditMessage() const;
        ///
        void Edit(BufferView *, int, int, unsigned int);
        ///
index 2aa37e0efd93af30483e363bef8fd790a429d5cf..666c41a3be0b6e41b9a71452e852189f142f3ced 100644 (file)
@@ -33,7 +33,7 @@ InsetLabel::InsetLabel(InsetCommandParams const & p)
 {}
 
 
-vector<string> InsetLabel::getLabelList() const
+vector<string> const InsetLabel::getLabelList() const
 {
        return vector<string>(1,getContents());
 }
@@ -96,7 +96,7 @@ int InsetLabel::DocBook(Buffer const *, ostream & os) const
 
 // This function escapes 8-bit characters and other problematic characters
 // It's exactly the same code as in insetref.C.
-string InsetLabel::escape(string const & lab) const {
+string const InsetLabel::escape(string const & lab) const {
        char hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
                              '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
        string enc;
index 39cc24e8e0e55840981446076b0a845a59195160..ccaa4c084b8eda0c08cf117e8d033227cd2a079c 100644 (file)
@@ -25,7 +25,7 @@ public:
        ///
        Inset * Clone() const { return new InsetLabel(params()); }
        ///
-       string getScreenLabel() const { return getContents(); }
+       string const getScreenLabel() const { return getContents(); }
        ///
        EDITABLE Editable() const { return IS_EDITABLE; }
        ///
@@ -33,7 +33,7 @@ public:
        ///
        void Edit(BufferView *, int, int, unsigned int);
        ///
-       std::vector<string> getLabelList() const;
+       std::vector<string> const getLabelList() const;
        ///
        int Latex(Buffer const *, std::ostream &,
                  bool fragile, bool free_spc) const;
@@ -45,7 +45,7 @@ public:
        int DocBook(Buffer const *, std::ostream &) const;
 private:
        /// This function escapes 8-bit characters
-       string escape(string const &) const;
+       string const escape(string const &) const;
 };
 
 #endif
index 0b33ce08f77ab89e263f3b191d02b0323ce909f9..a71be8a62914c2e1d4bb849bd1d24489830f8fcb 100644 (file)
@@ -67,7 +67,7 @@ Inset * InsetList::Clone() const
 }
 
 
-char const * InsetList::EditMessage() const
+string const InsetList::EditMessage() const
 {
        return _("Opened List Inset");
 }
index b8a0e1c3f52167564651214f907dcf800a2d54bc..bb8c02eb112070eb257cdac53765c56477feb343 100644 (file)
@@ -34,7 +34,7 @@ public:
        ///
        int Latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
        ///
-       const char * EditMessage() const;
+       string const EditMessage() const;
        ///
        bool InsertInsetAllowed(Inset * inset) const;
 };
index 017a0e642d4aa3d23f67f5bf4cb1c7054e95b40f..9d078780a9a08d4a876ac80c14bf73ef34487716 100644 (file)
@@ -45,7 +45,7 @@ Inset * InsetMarginal::Clone() const
 }
 
 
-char const * InsetMarginal::EditMessage() const
+string const InsetMarginal::EditMessage() const
 {
        return _("Opened Marginal Note Inset");
 }
index cf68c7631ff4a92e134fd676046f123521589209..d8253c6343cdaa2048e7c4a38421ecc048ee6565 100644 (file)
@@ -32,7 +32,7 @@ public:
        ///
        int Latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
        ///
-       const char * EditMessage() const;
+       string const EditMessage() const;
        ///
        bool InsertInsetAllowed(Inset * inset) const;
 };
index 80083833d417dd3138754863c842d8ca2da4510f..7d34868024834ff7880f12c7b6bc771e7fc8729d 100644 (file)
@@ -85,7 +85,7 @@ Inset * InsetMinipage::Clone() const
 }
 
 
-char const * InsetMinipage::EditMessage() const
+string const InsetMinipage::EditMessage() const
 {
        return _("Opened Minipage Inset");
 }
index a9800d08fd2117bb0d15e1dd0b9f0dd246d63e86..a85ab503ee8467e281673cd80ca8d03dbcbcdb0e 100644 (file)
@@ -34,7 +34,7 @@ public:
        ///
        int Latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
        ///
-       const char * EditMessage() const;
+       string const EditMessage() const;
        ///
        bool InsertInsetAllowed(Inset * inset) const;
 };
index 36721161105f8f7bd15eafa4a99eff937136a679..05b14f1626a60e58133882e99f0dbdd2b428dea8 100644 (file)
@@ -28,6 +28,7 @@
 
 using std::ostream;
 
+
 InsetParent::InsetParent(InsetCommandParams const & p, Buffer * bf)
        : InsetCommand(p)
 {
@@ -39,7 +40,7 @@ InsetParent::InsetParent(InsetCommandParams const & p, Buffer * bf)
 }
 
 
-string InsetParent::getScreenLabel() const 
+string const InsetParent::getScreenLabel() const 
 {
        return string(_("Parent:")) + getContents();
 }
index 0a1e9827023cf19f5ee41dec0a6a73ebabfc1b75..548acbaea466d0ce8ec89c6f01933da493e72a57 100644 (file)
@@ -31,7 +31,7 @@ public:
        ///
        Inset * Clone() const { return new InsetParent(params()); }
        ///
-       string getScreenLabel() const;
+       string const getScreenLabel() const;
         ///
        EDITABLE Editable() const { return IS_EDITABLE; }
         ///
index 8c9bd55521a4d10a6af68ee02784e801c3e1819a..b03780babeb3c91a14be7b618eb3f2a89824a9aa 100644 (file)
@@ -141,7 +141,7 @@ void InsetQuotes::ParseString(string const & s)
 }
 
 
-string InsetQuotes::DispString() const
+string const InsetQuotes::DispString() const
 {
        string disp;
        disp += quote_char[quote_index[side][language]];
@@ -188,9 +188,7 @@ int InsetQuotes::width(BufferView *, LyXFont const & font) const
 }
 
 
-//LyXFont InsetQuotes::ConvertFont(LyXFont font)
-// I really belive this should be
-LyXFont InsetQuotes::ConvertFont(LyXFont const & f) const
+LyXFont const InsetQuotes::ConvertFont(LyXFont const & f) const
 {
        LyXFont font(f);
        // quotes-insets cannot be latex of any kind
index f19a7b77927afe228f7593121185959118c5bd62..eb4ce51012575e488ad99da1d2138684223c820b 100644 (file)
@@ -80,8 +80,7 @@ public:
        ///
        void draw(BufferView *, LyXFont const &, int, float &, bool) const;
        ///
-       LyXFont ConvertFont(LyXFont const & font) const;
-       //LyXFont ConvertFont(LyXFont font);
+       LyXFont const ConvertFont(LyXFont const & font) const;
        ///
        void Write(Buffer const *, std::ostream &) const;
        ///
@@ -116,7 +115,7 @@ private:
        ///
        void ParseString(string const &);
        ///
-       string DispString() const;
+       string const DispString() const;
 };
 #endif
 
index 0f50539eff3171e227fe67e0226fe4dddb6c1803..d40fe4c2c66aa397bafbeba7c5eebd36c733e291 100644 (file)
@@ -34,7 +34,7 @@ void InsetRef::Edit(BufferView * bv, int, int, unsigned int button)
 }
 
 
-string InsetRef::getScreenLabel() const
+string const InsetRef::getScreenLabel() const
 {
        string temp;
        if (getCmdName() == "ref")
@@ -97,7 +97,7 @@ int InsetRef::DocBook(Buffer const *, ostream & os) const
 
 // This function escapes 8-bit characters and other problematic characters
 // It's exactly the same code as in insetlabel.C.
-string InsetRef::escape(string const & lab) const
+string const InsetRef::escape(string const & lab) const
 {
        char hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
                              '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
@@ -115,6 +115,7 @@ string InsetRef::escape(string const & lab) const
        return enc;
 }
 
+
 void InsetRef::Validate(LaTeXFeatures & features) const
 {
        if (getCmdName() == "vref" || getCmdName() == "vpageref")
index 3b889dda851c6cc644011d6c3f9168c50fa65ad5..655602350d45b5d3713363d85c5a6bfeba53b8e1 100644 (file)
@@ -28,7 +28,7 @@ public:
        ///
        Inset * Clone() const { return new InsetRef(params()); }
        ///
-       string getScreenLabel() const;
+       string const getScreenLabel() const;
        ///
        EDITABLE Editable() const { return IS_EDITABLE; }
        ///
@@ -50,6 +50,6 @@ public:
        void Validate(LaTeXFeatures & features) const;
 private:
        /// This function escapes 8-bit characters
-       string escape(string const &) const;
+       string const escape(string const &) const;
 };
 #endif
index 2cbcc3503ea9cecc6b60ab0bf08f2f609ad84f96..b0906a250958d7906981534b94ccc35c0b685875 100644 (file)
@@ -102,7 +102,7 @@ static tabular_features tabularFeatures[] =
     { LyXTabular::LAST_ACTION, "" }
 };
 
-//#define cellstart(p) ((p % 2) == 0)
+
 static inline
 bool cellstart(LyXParagraph::size_type p) 
 {
@@ -398,7 +398,7 @@ void InsetTabular::update(BufferView * bv, LyXFont const & font, bool reinit)
 }
 
 
-char const * InsetTabular::EditMessage() const
+string const InsetTabular::EditMessage() const
 {
     return _("Opened Tabular Inset");
 }
@@ -1209,8 +1209,7 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, string value)
         setLines = 0,
         setAlign = LYX_ALIGN_LEFT,
         lineSet;
-    bool
-        what;
+    bool what;
 
     switch (feature) {
       case LyXTabular::M_ALIGN_LEFT:
index 9c3357f80ac8a486cfb300d869abd17f1b0a9749..46e0ed4b19188c9ece5eb0b3ca4eb1cba335c9f6 100644 (file)
@@ -4,7 +4,7 @@
  * 
  *           LyX, The Document Processor
  *
- *           Copyright (C) 1995-2000 The LyX Team.
+ *           Copyright 1995-2000 The LyX Team.
  *
  *======================================================
  */
@@ -95,7 +95,7 @@ public:
     ///
     void update(BufferView *, LyXFont const &, bool = false);
     ///
-    const char * EditMessage() const;
+    string const EditMessage() const;
     ///
     void Edit(BufferView *, int x, int y, unsigned int);
     ///
@@ -166,13 +166,13 @@ public:
     void OpenLayoutDialog(BufferView *) const;
     LyXFunc::func_status getStatus(string argument) const;
 
-    ///
-    /// Public structures and variables
+    //
+    // Public structures and variables
     ///
     LyXTabular * tabular;
 
 private:
-       
+    ///
     bool calculate_dimensions_of_cells(BufferView *, LyXFont const &,
                                       bool =false) const;
     ///
@@ -189,14 +189,21 @@ private:
     void setPos(BufferView *, int x, int y) const;
     ///
     UpdatableInset::RESULT moveRight(BufferView *, bool lock = true);
+    ///
     UpdatableInset::RESULT moveLeft(BufferView *, bool lock = true);
+    ///
     UpdatableInset::RESULT moveUp(BufferView *);
+    ///
     UpdatableInset::RESULT moveDown(BufferView *);
+    ///
     bool moveNextCell(BufferView *);
+    ///
     bool movePrevCell(BufferView *);
+    ///
     bool Delete();
     ///
     int getCellXPos(int cell) const;
+    ///
     void resetPos(BufferView *) const;
     ///
     void RemoveTabularRow();
@@ -214,32 +221,52 @@ private:
     bool hasPasteBuffer() const { return (paste_tabular != 0); }
     ///
     bool copySelection();
+    ///
     bool pasteSelection(BufferView *);
+    ///
     bool cutSelection();
 
-    ///
-    /// Private structures and variables
+    //
+    // Private structures and variables
     ///
     InsetText * the_locking_inset;
+    ///
     Buffer * buffer;
-    mutable LyXCursor
-        cursor,
-       old_cursor;
-    mutable int
-        inset_pos,
-        inset_x, inset_y,
-        sel_pos_start,
-       sel_pos_end,
-       sel_cell_start,
-       sel_cell_end,
-        actcell,
-       oldcell,
-        actcol,
-        actrow;
+    ///
+    mutable LyXCursor cursor;
+    ///
+    mutable LyXCursor old_cursor;
+    ///
+    mutable int inset_pos;
+    ///
+    mutable int inset_x;
+    ///
+    mutable int inset_y;
+    ///
+    mutable int sel_pos_start;
+    ///
+    mutable int sel_pos_end;
+    ///
+    mutable int sel_cell_start;
+    ///
+    mutable int sel_cell_end;
+    ///
+    mutable int actcell;
+    ///
+    mutable int oldcell;
+    ///
+    mutable int actcol;
+    ///
+    mutable int actrow;
+    ///
     bool no_selection;
+    ///
     mutable bool locked;
+    ///
     mutable UpdateCodes need_update;
+    ///
     mutable Dialogs * dialogs_;
+    ///
     LyXTabular * paste_tabular;
 };
 #endif
index cf3c5805e35016a8d640323aa6ed523c77708038..7cc117d7b6e9afd2671a923c8e564fd06320dad8 100644 (file)
@@ -6,8 +6,6 @@
  *
  *           Copyright 1998-2000 The LyX Team.
  *
- *           @author: Jürgen Vigna
- *
  * ======================================================
  */
 
@@ -80,6 +78,7 @@ InsetText & InsetText::operator=(InsetText const & it)
     return * this;
 }
 
+
 void InsetText::init(InsetText const * ins)
 {
     top_y = last_width = last_height = 0;
@@ -434,7 +433,7 @@ void InsetText::UpdateLocal(BufferView * bv, UpdateCodes what, bool mark_dirty)
 }
 
 
-char const * InsetText::EditMessage() const
+string const InsetText::EditMessage() const
 {
     return _("Opened Text Inset");
 }
@@ -926,11 +925,11 @@ InsetText::LocalDispatch(BufferView * bv,
                    cur_value = par->spacing.getValue();
            }
                        
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
            std::istringstream istr(arg.c_str());
-#else
-           istrstream istr(arg.c_str());
-#endif
+//#else
+//         istrstream istr(arg.c_str());
+//#endif
            string tmp;
            istr >> tmp;
            Spacing::Space new_spacing = cur_spacing;
@@ -1354,6 +1353,7 @@ void InsetText::deleteLyXText(BufferView * bv, bool recursive) const
     }
 }
 
+
 void InsetText::resizeLyXText(BufferView * bv) const
 {
     if (!par->next && !par->size()) // resize not neccessary!
@@ -1408,8 +1408,7 @@ void InsetText::resizeLyXText(BufferView * bv) const
        /// then resize all LyXText in text-insets
        inset_x = cx(bv) - top_x + drawTextXOffset;
        inset_y = cy(bv) + drawTextYOffset;
-       LyXParagraph * p = par;
-       for(;p;p = p->next) {
+       for(LyXParagraph * p = par; p; p = p->next) {
            p->resizeInsetsLyXText(bv);
        }
     }
@@ -1419,9 +1418,7 @@ void InsetText::resizeLyXText(BufferView * bv) const
 
 void InsetText::removeNewlines()
 {
-    LyXParagraph * p = par;
-
-    for(;p; p = p->next) {
+    for(LyXParagraph * p = par; p; p = p->next) {
        for(int i = 0; i < p->Last(); ++i) {
            if (p->GetChar(i) == LyXParagraph::META_NEWLINE)
                p->Erase(i);
index 0bceade43cb9490afa6afc4f0321926db6602a2d..eb92980d4cedcdf6feb958974aec95e7736bcd86 100644 (file)
@@ -6,7 +6,6 @@
  *
  *           Copyright 1998 The LyX Team.
  *
- *           @author: Jürgen Vigna
  *
  *======================================================
  */
@@ -34,26 +33,38 @@ class LyXText;
 class LyXScreen;
 
 /**
- * A text inset is like a TeX box to write full text
- * (including styles and other insets) in a given space. 
+ A text inset is like a TeX box to write full text
+ (including styles and other insets) in a given space. 
+ @author: Jürgen Vigna
  */
 class InsetText : public UpdatableInset {
 public:
     ///
     enum UpdateCodes {
+       ///
        NONE = 0,
+       ///
        INIT,
+       ///
        FULL,
+       ///
        CURSOR_PAR,
+       ///
        CURSOR,
+       ///
        SELECTION,
+       ///
        DRAW_FRAME,
+       ///
        CLEAR_FRAME
     };
     ///
     enum DrawFrame {
+       ///
        NEVER = 0,
+       ///
        LOCKED,
+       ///
        ALWAYS
     };
     ///
@@ -66,7 +77,7 @@ public:
     ///
     Inset * Clone() const;
     ///
-    InsetText & operator= (InsetText const & it);
+    InsetText & operator=(InsetText const & it);
     ///
     void clear();
     ///
@@ -86,7 +97,7 @@ public:
     ///
     void update(BufferView *, LyXFont const &, bool =false);
     ///
-    char const * EditMessage() const;
+    string const EditMessage() const;
     ///
     void Edit(BufferView *, int, int, unsigned int);
     ///
@@ -153,8 +164,6 @@ public:
     ///
     void SetFrameColor(BufferView *, LColor::color);
     ///
-//    LyXFont GetDrawFont(BufferView *, LyXParagraph *, int pos) const;
-    ///
     LyXText * getLyXText(BufferView *) const;
     ///
     void deleteLyXText(BufferView *, bool recursive=true) const;
@@ -201,7 +210,7 @@ private:
     ///
     void SetCharFont(Buffer const *, int pos, LyXFont const & font);
     ///
-    string getText(int);
+    string const getText(int);
     ///
     bool checkAndActivateInset(BufferView * bv, bool behind);
     ///
index 4394b3ac234fcac7cbef3e4cfd827180feda6cf3..11ef790d8b1a09a101e261cccfebd41c6c46185f 100644 (file)
@@ -63,7 +63,7 @@ Inset * InsetTheorem::Clone() const
 }
 
 
-char const * InsetTheorem::EditMessage() const
+string const InsetTheorem::EditMessage() const
 {
        return _("Opened Theorem Inset");
 }
index 46485caa0658de58cc04e596bd8cc419101664b7..e2a6a8a3808884b3a9abb4dac5e2ac7045f0960c 100644 (file)
@@ -36,7 +36,7 @@ public:
        ///
        int Latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
        ///
-       const char * EditMessage() const;
+       string const EditMessage() const;
        ///
        bool InsertInsetAllowed(Inset * inset) const;
 };
index f74b85ff8e869d6c5d5e258b6139e13080db4149..6657beb0f6ab3843b6171c078acf23499d77d93d 100644 (file)
@@ -14,7 +14,7 @@
 using std::ostream;
 
 
-string InsetTOC::getScreenLabel() const 
+string const InsetTOC::getScreenLabel() const 
 {
        string cmdname( getCmdName() );
        if( cmdname == "tableofcontents" )
index cf0de54519bb71dc09fe13124324d3edfd981a29..9acd77bde8d5d0424f9ea8ed24a43f16c2769082 100644 (file)
@@ -27,7 +27,7 @@ public:
        ///
         Inset * Clone() const { return new InsetTOC(params()); }
        ///
-       string getScreenLabel() const;
+       string const getScreenLabel() const;
        ///
        void Edit(BufferView * bv, int, int, unsigned int);
         ///
index a63a7ef4124146fef3f0c4d98d1bc52198498313..161fe59fa9ca3ef5bec001c92026a10ad77d808b 100644 (file)
@@ -25,7 +25,7 @@ void InsetUrl::Edit(BufferView * bv, int, int, unsigned int)
 }
 
 
-string InsetUrl::getScreenLabel() const
+string const InsetUrl::getScreenLabel() const
 {
        string temp;
        if( getCmdName() == "url" )
index 30a7b2c49bbd5342569f9b47817fb4b0672a7aec..1f66ada0534d44832c63fada1d26f1d896fcb4f6 100644 (file)
@@ -33,7 +33,7 @@ public:
        ///
        void Validate(LaTeXFeatures &) const;
        ///
-       string getScreenLabel() const;
+       string const getScreenLabel() const;
        ///
        EDITABLE Editable() const { return IS_EDITABLE; }
        ///
index 05dde1c36f407b787ba743c4123be8cce20e5200..140e7f3778bdc6021e80804ccffa1ea1b842ac94 100644 (file)
@@ -132,9 +132,9 @@ public:
        virtual void update(BufferView *, LyXFont const &, bool = false)
                {}
        ///
-       virtual LyXFont ConvertFont(LyXFont const & font) const;
+       virtual LyXFont const ConvertFont(LyXFont const & font) const;
        /// what appears in the minibuffer when opening
-       virtual const char * EditMessage() const;
+       virtual string const EditMessage() const;
        ///
        virtual void Edit(BufferView *, int x, int y, unsigned int button);
        ///
@@ -177,7 +177,7 @@ public:
        /// returns LyX code associated with the inset. Used for TOC, ...)
        virtual Inset::Code LyxCode() const { return NO_CODE; }
   
-       virtual std::vector<string> getLabelList() const {
+       virtual std::vector<string> const getLabelList() const {
                return std::vector<string>();
        }
 
index 68cde51c6a779bf80b28a777c55d711deedb35d0..1d76704a9169994fde54fed9d4ca4ea785694e63 100644 (file)
@@ -71,7 +71,7 @@ void kb_keymap::printKey(kb_key const & key, string & buf)
 
 
 // This binds a key to an action
-int kb_keymap::bind(char const * seq, int action)
+int kb_keymap::bind(string const & seq, int action)
 {
        kb_sequence k;
 
@@ -238,7 +238,7 @@ kb_keymap::~kb_keymap()
 }
 
 
-string kb_keymap::keyname(kb_key const & k)
+string const kb_keymap::keyname(kb_key const & k)
 {
        string buf;
        printKeysym(k.code, k.mod, buf);
@@ -247,7 +247,7 @@ string kb_keymap::keyname(kb_key const & k)
 
 
 // Finds a key for a keyaction, if possible
-string kb_keymap::findbinding(int act) const
+string const kb_keymap::findbinding(int act) const
 {
        string res;
        if (table.empty()) return res;
index e3805b79c5a65a1479d74324c6f40337b7b9055f..015bce9c3713953403cf45c60c103e6f1a1ab806 100644 (file)
@@ -28,7 +28,7 @@ public:
        /** Bind a key-sequence to an action.
            Returns 0 on success. Otherwise, position in string where
            error occured. */
-       int bind(char const * seq, int action);
+       int bind(string const & seq, int action);
 
        ///
        void print(string & buf) const;
@@ -38,7 +38,7 @@ public:
                   unsigned int mod, kb_sequence * seq) const;
 
        /// Given an action, find all keybindings.
-       string findbinding(int action) const;
+       string const findbinding(int action) const;
 private:
        ///
        struct kb_key {
@@ -59,7 +59,7 @@ private:
        /// Define a new key sequence
        int defkey(kb_sequence * seq, int action, int idx = 0);
        ///
-       static string keyname(kb_key const & k);
+       static string const keyname(kb_key const & k);
        
        ///
        static
index 2be7a9b792eabac6719322cd59c2194fdd67de3f..567ff5944e40113233214c37bc553c4c89bd18d7 100644 (file)
@@ -96,15 +96,15 @@ int kb_sequence::addkey(unsigned int key,
                 Prefixes are S-, C-, M- for shift, control, meta
 \* ---F------------------------------------------------------------------- */
 
-int kb_sequence::parse(char const * s)
+int kb_sequence::parse(string const & s)
 {
-       if(!s[0]) return 1;
+       if(s.empty()) return 1;
 
        int i = 0;
        unsigned int mod = 0, nmod = 0;
-       while(s[i]) {
+       while (i < s.length()) {
                if(s[i] && (s[i]) <= ' ') ++i;
-               if(!s[i]) break;
+               if(i >= s.length()) break;
                
                if(s[i + 1] == '-')     { // is implicit that s[i] == true
                        switch(s[i]) {
@@ -143,7 +143,7 @@ int kb_sequence::parse(char const * s)
                } else {
                        string tbuf;
                        int j = i;
-                       for(; s[j] && s[j] > ' '; ++j)
+                       for(; j < s.length() && s[j] > ' '; ++j)
                                tbuf += s[j];    // (!!!check bounds :-)
                        
                        KeySym key = XStringToKeysym(tbuf.c_str());
index 9315d43b11f22eed1cecaa5309f8add1c578d860..87265b74f94b0fc118cb9d0e5deaffcc744d1ddb 100644 (file)
@@ -62,7 +62,7 @@ public:
        void reset();
        
        ///
-       int parse(char const * s);
+       int parse(string const & s);
        
        /// Keymap to use if a new sequence is starting
        kb_keymap * stdmap;
index 6e9bd81fab5d701a1d3810957ac25089c63774eb..dee8c5e0f89efc384102dff7ae8e52cf4c962041 100644 (file)
@@ -36,31 +36,36 @@ public:
        typedef Files::const_iterator const_iterator;
        
        /** Read the lastfiles file.
-          @param file The file to read the lastfiles form.
-          @param dostat Whether to check for file existance.
-          @param num number of files to remember.
+           @param file The file to read the lastfiles form.
+           @param dostat Whether to check for file existance.
+           @param num number of files to remember.
        */
        explicit
        LastFiles(string const & file,
                  bool dostat = true, unsigned int num = 4);
        
-       /**
-          This funtion inserts #file# into the last files list. If the file
-          already exist it is moved to the top of the list, else exist it
-          is placed on the top of the list. If the list is full the last
-          file in the list is popped from the end.
+       /** Insert #file# into the list.
+           This funtion inserts #file# into the last files list. If the file
+           already exist it is moved to the top of the list, else exist it
+           is placed on the top of the list. If the list is full the last
+           file in the list is popped from the end.
+           @param file the file to insert in the list.
        */
        void newFile(string const & file);
-       /**  Writes the lastfiles table to disk. One file on each line, this
-            way we can at least have some special chars (e.g. space), but
-            newline in filenames are thus not allowed.
+       /** Writes the lastfiles table to disk.
+           Writes one file on each line, this way we can at least have
+           some special chars (e.g. space), but newline in filenames
+           are thus not allowed.
+           @param file the file we write the lastfiles list to.
        */
-       void writeFile(string const &) const;
-       ///
-       string const operator[](unsigned int) const;
-       ///
+       void writeFile(string const & file) const;
+       /** Return file #n# in the lastfiles list.
+           @param n number in the list to get
+       */
+       string const operator[](unsigned int n) const;
+       /// Iterator to the beginning of the list.
        Files::const_iterator begin() const { return files.begin(); }
-       ///
+       /// Iterator to the end of the list.
        Files::const_iterator end() const { return files.end(); }
 private:
        /** Local constants.
@@ -88,13 +93,16 @@ private:
        bool dostat;
        
        /** Read the lastfiles file.
-           Reads the .lyx_lastfiles at the beginning of the LyX session.
-           This will read the lastfiles file (usually .lyx_lastfiles). It
+           Reads the #.lyx_lastfiles# at the beginning of the LyX session.
+           This will read the lastfiles file (usually #.lyx_lastfiles#). It
            will normally discard files that don't exist anymore, unless
-           LastFiles has been initialized with dostat = false. 
+           LastFiles has been initialized with #dostat = false#.
+           @param file the file containing the lastfiles.
+       */
+       void readFile(string const & file);
+       /** Used by the constructor to set the number of stored last files.
+           @param num the number of lastfiles to set.
        */
-       void readFile(string const &);
-       /// used by the constructor to set the number of stored last files.
         void setNumberOfFiles(unsigned int num);
 };
 #endif
index 797f2855b1fa6aad79398705c2e38b448553a457..1cbb0501c209d766cc4f640f48ed986ce4b9f12f 100644 (file)
@@ -1210,7 +1210,7 @@ void LyXTextClass::load()
 //////////////////////////////////////////
 
 // Gets textclass number from name
-pair<bool, LyXTextClassList::size_type>
+pair<bool, LyXTextClassList::size_type> const
 LyXTextClassList::NumberOfClass(string const & textclass) const
 {
        for (ClassList::const_iterator cit = classlist.begin();
@@ -1236,7 +1236,7 @@ LyXTextClassList::Style(LyXTextClassList::size_type textclass,
 
 
 // Gets layout number from name and textclass number
-pair<bool, LyXTextClass::size_type>
+pair<bool, LyXTextClass::size_type> const
 LyXTextClassList::NumberOfLayout(LyXTextClassList::size_type textclass,
                                 string const & name) const
 {
@@ -1450,3 +1450,4 @@ std::ostream & operator<<(std::ostream & os, LyXTextClass::PageSides p)
        }
        return os;
 }
+
index 2eb47cef59451c2a9d71c161199504fc47df2180..789f9ca098d14a43040bb1db9ee60008b0a61315 100644 (file)
@@ -565,7 +565,7 @@ public:
                                LyXTextClass::size_type layout) const;
 
        /// Gets layout number from textclass number and layout name
-       std::pair<bool, LyXTextClass::size_type>
+       std::pair<bool, LyXTextClass::size_type> const
        NumberOfLayout(size_type textclass,
                       string const & name) const;
 
@@ -577,7 +577,7 @@ public:
        /** Gets textclass number from name.
            Returns -1 if textclass name does not exist
        */
-       std::pair<bool, size_type>
+       std::pair<bool, size_type> const
        NumberOfClass(string const & textclass) const;
 
        ///
index e6cd7c02a5423b96d00aded282c6b567060d178f..ad8921b954605d612ded8be5b568f8aba96f341e 100644 (file)
@@ -14,7 +14,6 @@
 #include <algorithm>
 #include <iostream>
 
-//#include "LString.h"
 #include FORMS_H_LOCATION
 #include "lyx.h"
 #include "layout_forms.h"
@@ -1153,9 +1152,9 @@ void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
 }
 
 
-void MenuInsertLabel(char const * arg)
+void MenuInsertLabel(string const & arg)
 {
-       string label = arg;
+       string label(arg);
        ProhibitInput(current_view);
        if (label.empty()) {
                pair<bool, string>
@@ -1321,7 +1320,7 @@ void MenuLayoutCharacter()
 }
 
 
-inline
+static inline
 void DeactivateParagraphButtons ()
 {
        fl_deactivate_object (fd_form_paragraph->button_ok);
@@ -1331,7 +1330,7 @@ void DeactivateParagraphButtons ()
 }
 
 
-inline
+static inline
 void ActivateParagraphButtons ()
 {
        fl_activate_object (fd_form_paragraph->button_ok);
@@ -1341,7 +1340,7 @@ void ActivateParagraphButtons ()
 }
 
 
-inline
+static inline
 void DisableParagraphLayout ()
 {
         DeactivateParagraphButtons();
@@ -1365,7 +1364,7 @@ void DisableParagraphLayout ()
 }
 
 
-inline
+static inline
 void EnableParagraphLayout ()
 {
         ActivateParagraphButtons();
@@ -1576,7 +1575,7 @@ void MenuLayoutParagraph()
 }
 
 #ifdef USE_OLD_DOCUMENT_LAYOUT
-inline
+static inline
 void DeactivateDocumentButtons ()
 {
        fl_deactivate_object (fd_form_document->button_ok);
@@ -1586,7 +1585,7 @@ void DeactivateDocumentButtons ()
 }
 
 
-inline
+static inline
 void ActivateDocumentButtons ()
 {
        fl_activate_object (fd_form_document->button_ok);
@@ -1596,7 +1595,7 @@ void ActivateDocumentButtons ()
 }
 
 
-inline
+static inline
 void DisableDocumentLayout ()
 {
         DeactivateDocumentButtons ();
@@ -1629,7 +1628,7 @@ void DisableDocumentLayout ()
 }
 
 
-inline
+static inline
 void EnableDocumentLayout ()
 {
         ActivateDocumentButtons ();
@@ -1779,17 +1778,17 @@ bool UpdateLayoutDocument(BufferParams * params)
                fl_set_choice(fd_form_document->choice_spacing, 4);
                //char sval[20];
                //sprintf(sval, "%g", params->spacing.getValue()); 
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                std::ostringstream sval;
                sval << params->spacing.getValue(); // setw?
                fl_set_input(fd_form_document->input_spacing,
                             sval.str().c_str());
-#else
-               char tval[20];
-               ostrstream sval(tval, 20);
-               sval << params->spacing.getValue() << '\0'; // setw?
-               fl_set_input(fd_form_document->input_spacing, sval.str());
-#endif
+//#else
+//             char tval[20];
+//             ostrstream sval(tval, 20);
+//             sval << params->spacing.getValue() << '\0'; // setw?
+//             fl_set_input(fd_form_document->input_spacing, sval.str());
+//#endif
                break;
        }
        }
@@ -1953,7 +1952,7 @@ void MenuLayoutSave()
 
 // This is both GUI and LyXFont dependent. Don't know where to put it. (Asger)
 // Well, it's mostly GUI dependent, so I guess it will stay here. (Asger)
-LyXFont UserFreeFont(BufferParams const & params)
+LyXFont const UserFreeFont(BufferParams const & params)
 {
        LyXFont font(LyXFont::ALL_IGNORE);
 
index cc9bb3f42b3da48b91f52decda6a54888383c338..ce23fb9dbc0b8645f425d85c1cf0fff915ca002d 100644 (file)
@@ -16,7 +16,7 @@ extern bool toggleall;
 ///
 extern bool BindFileSet;
 ///
-extern LyXFont UserFreeFont(BufferParams const & params);
+extern LyXFont const UserFreeFont(BufferParams const & params);
 ///
 void ShowMessage(Buffer * buf,
                 string const & msg1,
index de72dc36782d90d97e0952f5c8de0e8eb25bb730..6051cc406ce8ce1d6dbb0f0e515242237be84387 100644 (file)
@@ -35,9 +35,7 @@
 #include "layout.h"
 #include "gettext.h"
 #include "kbmap.h"
-#ifdef NEW_MENUBAR
-# include "MenuBackend.h"
-#endif
+#include "MenuBackend.h"
 #include "ToolbarDefaults.h"
 #include "lyxlex.h"
 #if 1
@@ -635,18 +633,8 @@ void LyX::ReadUIFile(string const & name)
        while (lex.IsOK()) {
                switch(lex.lex()) {
                case ui_menuset: 
-#ifdef NEW_MENUBAR
                        menubackend.read(lex);
                        break;
-#else
-                       // Skip any menu definition and fall over to toolbar.
-                       // This is a hack, but it is supposed to go away...
-                       do {
-                               lex.next();
-                               if (!lex.IsOK()) return;
-                       }
-                       while (lex.lex() != ui_toolbar);
-#endif
 
                case ui_toolbar:
                        toolbardefaults.read(lex);
index dd4706d37fbf32102fb73a091c86077eff351781..8e6f3ba84e44c2a146f7cb801b75391c3d4fc173 100644 (file)
@@ -381,14 +381,14 @@ bool LyXFont::resolved() const
 
 
 /// Build GUI description of font state
-string LyXFont::stateText(BufferParams * params) const
+string const LyXFont::stateText(BufferParams * params) const
 {
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
        std::ostringstream ost;
-#else
-       char str[1024];
-       ostrstream ost(str, 1024);
-#endif
+//#else
+//     char str[1024];
+//     ostrstream ost(str, 1024);
+//#endif
        if (family() != INHERIT_FAMILY)
                ost << _(GUIFamilyNames[family()]) << ", ";
        if (series() != INHERIT_SERIES)
@@ -414,12 +414,12 @@ string LyXFont::stateText(BufferParams * params) const
        if (!params || (language() != params->language_info &&
                        language()->lang() != "default"))
                ost << _("Language: ") << _(language()->display().c_str());
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
        string buf(ost.str().c_str());
-#else
-       ost << '\0';
-       string buf(ost.str());
-#endif
+//#else
+//     ost << '\0';
+//     string buf(ost.str());
+//#endif
        buf = strip(buf, ' ');
        buf = strip(buf, ',');
        return buf;
@@ -524,7 +524,7 @@ LyXFont & LyXFont::setGUISize(string const & siz)
 
 
 // Returns size in latex format
-string LyXFont::latexSize() const
+string const LyXFont::latexSize() const
 {
        return LaTeXSizeNames[size()];
 }
@@ -729,7 +729,7 @@ int LyXFont::latexWriteStartChanges(ostream & os, LyXFont const & base,
                count += strlen(LaTeXShapeNames[f.shape()]) + 2;
                env = true; //We have opened a new environment
        }
-       if (f.color() != LColor::inherit) {
+       if (f.color() != LColor::inherit && f.color() != LColor::ignore) {
                os << "\\textcolor{"
                   << lcolor.getLaTeXName(f.color())
                   << "}{";
@@ -804,7 +804,7 @@ int LyXFont::latexWriteEndChanges(ostream & os, LyXFont const & base,
                ++count;
                env = true; // Size change need not bother about closing env.
        }
-       if (f.color() != LColor::inherit) {
+       if (f.color() != LColor::inherit && f.color() != LColor::ignore) {
                os << '}';
                ++count;
                env = true; // Size change need not bother about closing env.
index 4123fa35134fd464350c8a7b17ef41ffefdda06c..910782dcebdd74efaacd88a20c7d15e9e60a8d25 100644 (file)
@@ -262,7 +262,7 @@ public:
        LyXFont & setGUISize(string const &);
  
        /// Returns size of font in LaTeX text notation
-       string latexSize() const;
+       string const latexSize() const;
  
        /** Updates font settings according to request.
            If an attribute is IGNORE, the attribute is left as it is.
@@ -309,7 +309,7 @@ public:
                                 LyXFont const & next) const;
 
        /// Build GUI description of font state
-       string stateText(BufferParams * params) const;
+       string const stateText(BufferParams * params) const;
 
        ///
        LColor::color realColor() const;
index 24a22dad9642a2a6bc791489db2c783eb72de82e..0b14d4c6ba259f887dc1dd6a2dcc468333ced96f 100644 (file)
@@ -102,7 +102,7 @@ void SearchForm::StartSearch(LyXFindReplace * lfr)
 
 
 // Returns the value of the replace string in the form
-string SearchForm::ReplaceString() const
+string const SearchForm::ReplaceString() const
 {
        return fl_get_input(search_form->input_replace);
 }
index bf549062dbec6bd5fccd81c058e1ec637e89056d..09949f2ed10a86a840499d2617ab5e61b326b269 100644 (file)
@@ -51,7 +51,7 @@ public:
        }
 
        ///
-       string SearchString() const {
+       string const SearchString() const {
                return fl_get_input(search_form->input_search);
        }
 
@@ -71,7 +71,7 @@ public:
        ///
        void SetSearchString(string const & ls);
        ///
-       string ReplaceString() const;
+       string const ReplaceString() const;
 
        ///
        bool ValidSearchData() const { return !(SearchString().empty()); }
index 0d9c79a790cac6bfcfaf3d0a23d836edaba50668..0fddfde2764151b0afd6cfa9384c69631f620a09 100644 (file)
 
 #include <config.h>
 
+#if 0
 #ifdef HAVE_SSTREAM
 #include <sstream>
 using std::istringstream;
 #else
 #include <strstream>
 #endif
+#else
+#include "Lsstream.h"
+#endif
 
 #include <time.h>
 #include <locale.h>
@@ -86,11 +90,7 @@ using std::istringstream;
 #include "bufferview_funcs.h"
 #include "frontends/Dialogs.h"
 #include "frontends/Toolbar.h"
-#ifdef NEW_MENUBAR
 #include "frontends/Menubar.h"
-#else
-#include "menus.h"
-#endif
 #include "FloatList.h"
 #include "exporter.h"
 #include "FontLoader.h"
@@ -102,7 +102,7 @@ using std::endl;
 extern bool cursor_follows_scrollbar;
 
 extern void InsertAsciiFile(BufferView *, string const &, bool);
-extern void math_insert_symbol(char const *);
+extern void math_insert_symbol(string const &);
 extern bool math_insert_greek(char);
 extern BufferList bufferlist;
 extern LyXServer * lyxserver;
@@ -113,9 +113,7 @@ extern kb_keymap * toplevel_keymap;
 
 extern bool MenuWrite(Buffer *);
 extern bool MenuWriteAs(Buffer *);
-#ifdef NEW_MENUBAR
 extern int  MenuRunLaTeX(Buffer *);
-#endif
 extern int  MenuBuildProg(Buffer *);
 extern int  MenuRunChktex(Buffer *);
 #ifndef NEW_EXPORT
@@ -139,7 +137,7 @@ extern void AutoSave(BufferView *);
 extern bool PreviewDVI(Buffer *);
 extern bool PreviewPostscript(Buffer *);
 #endif
-extern void MenuInsertLabel(char const *);
+extern void MenuInsertLabel(string const &);
 extern void MenuLayoutCharacter();
 extern void MenuLayoutParagraph();
 extern void MenuLayoutDocument();
@@ -658,7 +656,7 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
 }
 
 
-string LyXFunc::Dispatch(string const & s) 
+string const LyXFunc::Dispatch(string const & s) 
 {
        // Split command string into command and argument
        string cmd, line = frontStrip(s);
@@ -668,8 +666,8 @@ string LyXFunc::Dispatch(string const & s)
 }
 
 
-string LyXFunc::Dispatch(int ac,
-                        char const * do_not_use_this_arg)
+string const LyXFunc::Dispatch(int ac,
+                        string const & do_not_use_this_arg)
 {
        string argument;
        kb_action action;
@@ -687,7 +685,7 @@ string LyXFunc::Dispatch(int ac,
                        argument = tmparg;
        } else {
                action = static_cast<kb_action>(ac);
-               if (do_not_use_this_arg)
+               if (!do_not_use_this_arg.empty())
                        argument = do_not_use_this_arg; // except here
        }
     
@@ -1630,11 +1628,7 @@ string LyXFunc::Dispatch(int ac,
        break;
                
        case LFUN_MENU_OPEN_BY_NAME:
-#ifdef NEW_MENUBAR
                owner->getMenubar()->openByName(argument);
-#else
-               owner->getMenus()->openByName(argument);
-#endif
                break; // RVDK_PATCH_5
                
        case LFUN_SPELLCHECK:
@@ -2232,11 +2226,11 @@ string LyXFunc::Dispatch(int ac,
                        cur_value = par->spacing.getValue();
                }
                
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                istringstream istr(argument);
-#else
-               istrstream istr(argument.c_str());
-#endif
+//#else
+//             istrstream istr(argument.c_str());
+//#endif
                string tmp;
                istr >> tmp;
                Spacing::Space new_spacing = cur_spacing;
@@ -2534,11 +2528,11 @@ string LyXFunc::Dispatch(int ac,
 
        case LFUN_GOTO_PARAGRAPH:
        {
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                 istringstream istr(argument);
-#else
-                istrstream istr(argument.c_str());
-#endif
+//#else
+//                istrstream istr(argument.c_str());
+//#endif
 
                int id;
                istr >> id;
index 4aa874c6701ea4c74c212ff336c251e2b92fdd25..31c4c7494bc85271cd5cb22380d7c92a83145da2 100644 (file)
@@ -41,10 +41,10 @@ public:
        LyXFunc(LyXView *);
     
        /// LyX dispatcher, executes lyx actions.
-       string Dispatch(int action, char const * arg = 0);
+       string const Dispatch(int action, string const & arg = string());
                         
        /// The same but uses the name of a lyx command.
-       string Dispatch(string const & cmd);
+       string const Dispatch(string const & cmd);
 
        /// Same again but for xtl buffers.  Still looking for better idea.
        bool Dispatch(int action, auto_mem_buffer &);
@@ -65,13 +65,13 @@ public:
        // These can't be global because are part of the
        // internal state (ale970227)
        /// Get the current keyseq string
-       string keyseqStr() const;
+       string const keyseqStr() const;
 
        /// Is the key sequence uncomplete?
        bool keyseqUncomplete() const;
 
        /// get options for the current keyseq
-       string keyseqOptions() const;
+       string const keyseqOptions() const;
 
         /// True if lyxfunc reports an error
         bool errorStat() const { return errorstat; }
@@ -80,7 +80,7 @@ public:
         /// Buffer to store result messages
         void setErrorMessage(string const &) const; 
         /// Buffer to store result messages
-        string getMessage() const { return dispatch_buffer; }
+        string const getMessage() const { return dispatch_buffer; }
         /// Get next inset of this class from current cursor position  
         Inset * getInsetByCode(Inset::Code);
        
@@ -151,7 +151,7 @@ bool LyXFunc::wasMetaKey() const
      
 
 inline
-string LyXFunc::keyseqStr() const
+string const LyXFunc::keyseqStr() const
 {
        // Why not just remove this function
        string text;
@@ -161,7 +161,7 @@ string LyXFunc::keyseqStr() const
 
 
 inline
-string LyXFunc::keyseqOptions() const
+string const LyXFunc::keyseqOptions() const
 {
        // Why not just remove this function
        string text;
index 8fe4b94be4dbf6dd5459a35f1d32e643f6c3054d..7bb8ea59c2d6bd2b941dbde4374305a871c767c9 100644 (file)
@@ -55,7 +55,7 @@ int LyXLex::GetLineNo() const
 }
 
 
-char const * const LyXLex::text() const
+string const LyXLex::text() const
 {
        return &pimpl_->buff[0];
 }
index 9825fc962ed05e7b574e2327d2e91c27f78ff756..420396be1325e9023ea8eed8a2daccf8c7b6172c 100644 (file)
@@ -104,7 +104,7 @@ public:
        int CheckToken(char const * str[], int print_error);
 
        ///
-       char const * const text() const;
+       string const text() const;
 
        /** Pushes a token list on a stack and replaces it with a new one.
         */
@@ -132,19 +132,22 @@ private:
 };
 
 
-/** Use to enable multipe exit points.
+/** Use to enable multiple exit points.
     This is needed to ensure that the pop is done upon exit from methods
     with more than one exit point or that can return as a response to
     exceptions.
     @autor Lgb
 */
 struct pushpophelper {
+       ///
        pushpophelper(LyXLex & lexrc, keyword_item * i, int s) : lex(lexrc) {
                lex.pushTable(i, s);
        }
+       ///
        ~pushpophelper() {
                lex.popTable();
        }
+       ///
        LyXLex & lex;
 };
 /** Avoid wrong usage of pushpophelper.
index b868eb88111f44d6a7134006abda2de819201c3d..abae1e2cf6d89be2bc628a81c1c0267503eebc7a 100644 (file)
@@ -150,9 +150,9 @@ public:
        bool isMultiLingual(BufferParams const &);
        ///
 
-       string String(Buffer const *, bool label);
+       string const String(Buffer const *, bool label);
        ///
-       string String(Buffer const *, size_type beg, size_type end);
+       string const String(Buffer const *, size_type beg, size_type end);
        
        ///
        void writeFile(Buffer const *, std::ostream &, BufferParams const &,
@@ -388,7 +388,7 @@ public:
        string const & GetLabelstring() const;
        
        /// the next two functions are for the manual labels
-       string GetLabelWidthString() const;
+       string const GetLabelWidthString() const;
        ///
        void SetLabelWidthString(string const & s);
        ///
@@ -418,9 +418,10 @@ public:
          between the characters font and the layoutfont.
          This is what is stored in the fonttable
         */
-       LyXFont GetFontSettings(BufferParams const &, size_type pos) const;
+       LyXFont const
+       GetFontSettings(BufferParams const &, size_type pos) const;
        ///
-       LyXFont GetFirstFontSettings() const;
+       LyXFont const GetFirstFontSettings() const;
 
        /** Get fully instantiated font. If pos == -1, use the layout
            font attached to this paragraph.
@@ -429,7 +430,7 @@ public:
            attributes with values LyXFont::INHERIT, LyXFont::IGNORE or 
            LyXFont::TOGGLE.
        */
-       LyXFont getFont(BufferParams const &, size_type pos) const;
+       LyXFont const getFont(BufferParams const &, size_type pos) const;
        ///
        value_type GetChar(size_type pos) const;
        /// The position must already exist.
@@ -440,7 +441,7 @@ public:
        ///
        void SetFont(size_type pos, LyXFont const & font);
        ///
-        string GetWord(size_type &) const;
+        string const GetWord(size_type &) const;
        /// Returns the height of the highest font in range
        LyXFont::FONT_SIZE HighestFontInRange(size_type startpos,
                                              size_type endpos) const;
@@ -533,8 +534,8 @@ public:
         /* 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 */
        ///
-        void SetPExtraType(BufferParams const &,
-                          int type, char const * width, char const * widthp);
+        void SetPExtraType(BufferParams const &, int type,
+                          string const & width, string const & widthp);
        ///
         void UnsetPExtraType(BufferParams const &);
        ///
index 1afc30597cf4b93a6d44d8735042bc105cd0ea29..05ffe20fd19ea34f308ee423f6c3fc0a5e8b7295 100644 (file)
@@ -73,7 +73,7 @@ public:
        InsetText * inset_owner;
 
        ///
-       LyXFont GetFont(Buffer const *, LyXParagraph * par,
+       LyXFont const GetFont(Buffer const *, LyXParagraph * par,
                        LyXParagraph::size_type pos) const;
        ///
        void SetCharFont(Buffer const *, LyXParagraph * par,
@@ -232,7 +232,7 @@ public:
        ///
        void ClearSelection() const;
        ///
-       string selectionAsString(Buffer const *) const;
+       string const selectionAsString(Buffer const *) const;
        
        /// just selects the word the cursor is in
        void SelectWord(BufferView *);
@@ -242,7 +242,7 @@ public:
         to the beginning of this word. 
         With SelectSelectedWord can this be highlighted really
         */ 
-       char * SelectNextWord(BufferView *, float & value);
+       string const SelectNextWord(BufferView *, float & value) const;
        ///
        void SelectSelectedWord(BufferView *);
        ///
@@ -394,8 +394,8 @@ public:
                          bool noindent);
        ///
        void SetParagraphExtraOpt(BufferView *, int type,
-                                 char const * width,
-                                 char const * widthp,
+                                 string const & width,
+                                 string const & widthp,
                                  int alignment, bool hfill,
                                  bool start_minipage);
 
@@ -406,22 +406,22 @@ public:
          */
        bool IsStringInText(LyXParagraph * par,
                            LyXParagraph::size_type pos,
-                           char const * str) const;
+                           string const & str) const;
        /** sets the selection over the number of characters of string,
          no check!!
          */
-       void SetSelectionOverString(BufferView *, char const * str);
+       void SetSelectionOverString(BufferView *, string const & str);
 
        /** simple replacing. The font of the first selected character
          is used
          */
-       void ReplaceSelectionWithString(BufferView *, char const * str);
+       void ReplaceSelectionWithString(BufferView *, string const & str);
 
        /** if the string can be found: return true and set the cursor to
          the new position */
-       bool SearchForward(BufferView *, char const * str) const;
+       bool SearchForward(BufferView *, string const & str) const;
        ///
-       bool SearchBackward(BufferView *, char const * str) const;
+       bool SearchBackward(BufferView *, string const & str) const;
 
        /// needed to insert the selection
        void InsertStringA(BufferView *, string const & str);
index 4683fc13acd5f3ccbb7117757e3318983b0d735a..1a33d6438c5c83fb7809d006dd13614069340bc8 100644 (file)
@@ -46,7 +46,7 @@ public:
        ~LyxArrayBase();
    
        /// Constructs a new array with dx elements starting at pos 
-       LyxArrayBase & operator= (LyxArrayBase const &); 
+       LyxArrayBase & operator=(LyxArrayBase const &); 
 
        ///
        int empty() const { return (last == 0); }
@@ -142,7 +142,7 @@ LyxArrayBase::~LyxArrayBase()
 }
 
 inline
-LyxArrayBase::LyxArrayBase(const LyxArrayBase& a) 
+LyxArrayBase::LyxArrayBase(LyxArrayBase const & a) 
 {
        maxsize = a.maxsize;
        bf = new byte[maxsize];
@@ -151,7 +151,7 @@ LyxArrayBase::LyxArrayBase(const LyxArrayBase& a)
 }
 
 inline
-LyxArrayBase& LyxArrayBase::operator= (const LyxArrayBase& a)
+LyxArrayBase & LyxArrayBase::operator=(LyxArrayBase const & a)
 {
        if (this != &a) {
                Resize(a.maxsize);
@@ -164,11 +164,11 @@ inline
 bool LyxArrayBase::Move(int p, int shift) 
 {
        bool result = false;
-       if (p<= last) {
-               if (last+shift>= maxsize) { 
+       if (p <= last) {
+               if (last + shift >= maxsize) { 
                    Resize(last + shift);
                }
-               memmove(&bf[p+shift], &bf[p], last-p);
+               memmove(&bf[p + shift], &bf[p], last - p);
                last += shift;
                bf[last] = 0;
                result = true;
@@ -185,32 +185,32 @@ void LyxArrayBase::Fit()
 inline
 void LyxArrayBase::Remove(int pos, int dx)
 {
-       Move(pos+dx, -dx);
+       Move(pos + dx, -dx);
 }    
 
 inline
-void LyxArrayBase::Merge(LyxArrayBase *a, int p, int dx)
+void LyxArrayBase::Merge(LyxArrayBase * a, int p, int dx)
 {
        Move(p, dx);
        memcpy(&bf[p], &a->bf[0], dx);
 }
  
 inline
-void LyxArrayBase::MergeF(LyxArrayBase *a, int p, int dx)
+void LyxArrayBase::MergeF(LyxArrayBase * a, int p, int dx)
 {
        memcpy(&bf[p], &a->bf[0], dx);
 }
  
 inline
-void LyxArrayBase::Copy(void *a, int p, int dx)
+void LyxArrayBase::Copy(void * a, int p, int dx)
 {
        memcpy(&bf[p], a, dx);
 }
 
 inline
-LyxArrayBase *LyxArrayBase::Extract(int, int dx)
+LyxArrayBase * LyxArrayBase::Extract(int, int dx)
 {
-       LyxArrayBase *a = new LyxArrayBase(dx);
+       LyxArrayBase * a = new LyxArrayBase(dx);
        a->Merge(this, 0, dx);
        return a;
 }
@@ -225,10 +225,10 @@ byte LyxArrayBase::operator[](const int i)
 inline
 void LyxArrayBase::Insert(int pos, byte c)
 {
-       if (pos<0) pos = last;
-       if (pos>= maxsize) 
-               Resize(maxsize+ARRAY_STEP);
+       if (pos < 0) pos = last;
+       if (pos >= maxsize) 
+               Resize(maxsize + ARRAY_STEP);
        bf[pos] = c;
-       if (pos>= last)
-               last = pos+1;
+       if (pos >= last)
+               last = pos + 1;
 }
index a90d0db7ab62f2f554b7046b959916cfe6d9b278..dc4c80c15f22a34c5ee211ccbe10458b64dc3019 100644 (file)
 
 #include <config.h>
 
+#if 0
 #ifdef HAVE_SSTREAM
 #include <sstream>
 using std::istringstream;
 #else
 #include <strstream>
 #endif
+#else
+#include "Lsstream.h"
+#endif
 
 #ifdef __GNUG__
 #pragma implementation "formula.h"
@@ -216,6 +220,11 @@ int mathed_string_width(short type, int size, byte const * s, int ls)
     return lyxfont::width(reinterpret_cast<char const *>(s), ls, f);
 }
 
+int mathed_string_width(short type, int size, string const & str)
+{
+       return mathed_string_width(type, size, reinterpret_cast<unsigned char const *>(str.c_str()), str.length());
+}
+
 
 int mathed_char_width(short type, int size, byte c)
 {
@@ -240,10 +249,18 @@ int mathed_string_height(short type, int size, byte const * s,
 }
 
 
+int mathed_string_height(short type, int size, string const & str,
+                        int & asc, int & des)
+{
+       return mathed_string_height(type, size,
+                                   reinterpret_cast<unsigned char const *>(str.c_str()), str.length(),
+                                   asc, des);
+}
+
+
 int mathed_char_height(short type, int size, byte c, int & asc, int & des)
 {
    LyXFont font = WhichFont(type, size);
-   asc = des = 0;
    des = lyxfont::descent(c, font);
    asc = lyxfont::ascent(c, font);
    return asc + des;
@@ -262,7 +279,7 @@ void MathedInset::drawStr(Painter & pain, short type, int siz,
        } else {
                st = string(reinterpret_cast<char const *>(s), ls);
        }
-       LyXFont mf = mathed_get_font(type, siz);
+       LyXFont const mf = mathed_get_font(type, siz);
        pain.text(x, y, st, mf);
 }
 
@@ -453,7 +470,7 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & f,
                                y = baseline + crow->getBaseline();
                                if (crow->isNumbered()) {
                                        string str;
-                                       if (crow->getLabel())
+                                       if (!crow->getLabel().empty())
                                                str = string("(") + crow->getLabel() + ")";
                                        else
                                                str = "(#)";
@@ -467,7 +484,7 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & f,
 }
 
 
-char const * InsetFormula::EditMessage() const 
+string const InsetFormula::EditMessage() const 
 {
        return _("Math editor mode");
 }
@@ -503,21 +520,22 @@ void InsetFormula::InsetUnlock(BufferView * bv)
 
 
 // Now a symbol can be inserted only if the inset is locked
-void InsetFormula::InsertSymbol(BufferView * bv, char const * s)
+void InsetFormula::InsertSymbol(BufferView * bv, string const & s)
 { 
-   if (!s || !mathcursor) return;   
+   if (s.empty() || !mathcursor) return;   
    mathcursor->Interpret(s);
    UpdateLocal(bv);
 }
 
    
-void InsetFormula::GetCursorPos(BufferView *, int& x, int& y) const
+void InsetFormula::GetCursorPos(BufferView *, int & x, int & y) const
 {
     mathcursor->GetPos(x, y);
     x -= par->xo; 
     y -= par->yo;
 }
 
+
 void InsetFormula::ToggleInsetCursor(BufferView * bv)
 {
   if (!mathcursor)
@@ -607,7 +625,7 @@ void InsetFormula::display(bool dspf)
 }
 
 
-vector<string> InsetFormula::getLabelList() const
+vector<string> const InsetFormula::getLabelList() const
 {
 //#warning This is dirty, I know. Ill clean it at 0.11
 // Correction, the only way to clean this is with a new kernel: 0.13.
@@ -618,7 +636,7 @@ vector<string> InsetFormula::getLabelList() const
                MathMatrixInset * mt = static_cast<MathMatrixInset*>(par);
                MathedRowSt const * crow = mt->getRowSt();
                while (crow) {
-                       if (crow->getLabel())
+                       if (!crow->getLabel().empty())
                                label_list.push_back(crow->getLabel());
                        crow = crow->getNext();
                }
@@ -815,11 +833,11 @@ InsetFormula::LocalDispatch(BufferView * bv,
     case LFUN_SETXY:
       {
         int x, y, x1, y1;
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
         istringstream ist(arg.c_str());
-#else
-        istrstream ist(arg.c_str());
-#endif
+//#else
+//      istrstream ist(arg.c_str());
+//#endif
         ist >> x >> y;
         par->GetXY(x1, y1);
         mathcursor->SetPos(x1 + x, y1 + y);
@@ -1229,7 +1247,7 @@ InsetFormula::LocalDispatch(BufferView * bv,
 void
 MathFuncInset::draw(Painter & pain, int x, int y)
 { 
-       if (name && name[0] > ' ') {
+       if (!name.empty() && name[0] > ' ') {
                LyXFont font = WhichFont(LM_TC_TEXTRM, size);
                font.setLatex(LyXFont::ON);
                x += (lyxfont::width('I', font) + 3) / 4;
@@ -1240,14 +1258,12 @@ MathFuncInset::draw(Painter & pain, int x, int y)
 
 void MathFuncInset::Metrics() 
 {
-       ln = (name) ? strlen(name): 0;
+       //ln = (name) ? strlen(name): 0;
        LyXFont  font = WhichFont(LM_TC_TEXTRM, size);
        font.setLatex(LyXFont::ON);
-       width = lyxfont::width(name, ln, font)
+       width = lyxfont::width(name, font)
                + lyxfont::width('I', font) / 2;
-       mathed_string_height(LM_TC_TEXTRM, size,
-                            reinterpret_cast<unsigned char const *>(name),
-                            strlen(name), ascent, descent);
+       mathed_string_height(LM_TC_TEXTRM, size, name, ascent, descent);
 }
 
 
@@ -1261,7 +1277,7 @@ void mathedValidate(LaTeXFeatures & features, MathParInset * par)
            if(it.IsActive()) {
                MathParInset * p = it.GetActiveInset();
                if (!features.binom && p->GetType() == LM_OT_MACRO && 
-                   strcmp(p->GetName(), "binom") == 0) {
+                   p->GetName() == "binom") {
                    features.binom = true;
                } else {
                    for (int i = 0; i <= p->getMaxArgumentIdx(); ++i) {
@@ -1271,8 +1287,8 @@ void mathedValidate(LaTeXFeatures & features, MathParInset * par)
                }
            } else {
                MathedInset* p = it.GetInset();
-               if (!features.boldsymbol && p->GetName() &&
-                   strcmp(p->GetName(), "boldsymbol") == 0) {
+               if (!features.boldsymbol &&
+                   p->GetName() == "boldsymbol") {
                    features.boldsymbol = true;
                }
            }       
index d8ac350492873304162efe21df0d166382f82d59..926a029f70fa1f54b0110999ab9a3efd10c3c1cc 100644 (file)
@@ -68,7 +68,7 @@ public:
        ///
        Inset::Code LyxCode() const { return Inset::MATH_CODE; }
        ///
-       LyXFont ConvertFont(LyXFont const & f) const {
+       LyXFont const ConvertFont(LyXFont const & f) const {
                // We have already discussed what was here
                LyXFont font(f);
                font.setLatex(LyXFont::OFF);
@@ -76,7 +76,7 @@ public:
        }
 
        /// what appears in the minibuffer when opening
-       char const * EditMessage() const;
+       string const EditMessage() const;
        ///
        void Edit(BufferView *, int x, int y, unsigned int button);
        ///
@@ -108,11 +108,11 @@ public:
        virtual RESULT LocalDispatch(BufferView *, int, string const &);
     
        ///
-       void InsertSymbol(BufferView *, char const *);
+       void InsertSymbol(BufferView *, string const &);
        ///
        bool SetNumber(bool);
        ///
-       std::vector<string> getLabelList() const;
+       std::vector<string> const getLabelList() const;
    
 protected:
        ///
index f23c3d24299ecb9de922a341a86ac902cc3604da..53b9b01505451e0007e2fa47caa0739367c9531d 100644 (file)
@@ -175,7 +175,7 @@ void InsetFormulaMacro::draw(BufferView * bv, LyXFont const & f,
 }
 
 
-char const * InsetFormulaMacro::EditMessage() const 
+string const InsetFormulaMacro::EditMessage() const 
 {
        return _("Math macro editor mode");
 }
index f77aca9ca8ce66f8ad2b68cc9f2018d990d7a7c8..3a66cfddc9fc16278a477e196b38120966e268ed 100644 (file)
@@ -59,7 +59,7 @@ public:
        Inset * Clone() const;
 
        /// what appears in the minibuffer when opening
-       char const * EditMessage() const;
+       string const EditMessage() const;
        ///
        void Edit(BufferView *, int x, int y, unsigned int button);
        ///
@@ -67,10 +67,6 @@ public:
        ///
        RESULT LocalDispatch(BufferView *, int, string const &);
 
-protected:
-       ///
-       //void UpdateLocal();
-
 private:
        ///
         bool opened;
index fe467c34458ed8e50291035bdf8079a923c18d43..1442d98cc85ab82a78bd752b58b14d237f21f4d1 100644 (file)
@@ -35,14 +35,14 @@ static LyxArrayBase * selarray = 0;
 
 using std::endl;
 
-inline
+static inline
 bool IsAlpha(char c)
 {
    return ('A' <= c  && c <= 'Z' || 'a' <= c  && c <= 'z');
 }
 
 // This was very smaller, I'll change it later 
-inline
+static inline
 bool IsMacro(short tok, int id)
 {
    return (tok != LM_TK_STACK && tok != LM_TK_FRAC && tok != LM_TK_SQRT
@@ -55,7 +55,7 @@ bool IsMacro(short tok, int id)
 
 
 // Yes, mathed isn't using string yet.
-inline
+static inline
 char * strnew(char const * s)
 {
     char * s1 = new char[strlen(s)+1];
@@ -65,7 +65,8 @@ char * strnew(char const * s)
 
 
 
-#define MAX_STACK_ITEMS 32
+static int const MAX_STACK_ITEMS = 32;
+
 
 struct MathStackXIter {
     
@@ -596,9 +597,9 @@ void MathedCursor::SetSize(short size)
 }
 
 
-void MathedCursor::setLabel(char const * label)
+void MathedCursor::setLabel(string const & label)
 {  // ugly hack and possible bug
-    if (!cursor->setLabel(strnew(label)))
+    if (!cursor->setLabel(label))
            lyxerr << "MathErr: Bad place to set labels." << endl;
 }
 
@@ -611,10 +612,10 @@ void MathedCursor::setNumbered()
 }
 
 
-void MathedCursor::Interpret(char const * s)
+void MathedCursor::Interpret(string const & s)
 {
     MathedInset * p = 0;
-    latexkeys * l = 0;   
+    latexkeys * l = 0;
     MathedTextCodes tcode = LM_TC_INSET;
     
     if (s[0] == '^' || s[0] == '_') {
@@ -643,13 +644,13 @@ void MathedCursor::Interpret(char const * s)
          Insert(p);
          return;
       } else  
-      l = in_word_set (s, strlen(s));
+      l = in_word_set(s);
     
     if (!l) {       
        p = MathMacroTable::mathMTable.getMacro(s);
        if (!p) {
            lyxerr[Debug::MATHED] << "Macro2 " << s << ' ' << tcode << endl;
-           if (strcmp("root", s) == 0) {
+           if (s == "root") {
                p = new MathRootInset();
                tcode = LM_TC_ACTIVE_INSET;
            } else
index 24d9a767a34d18eec41260506c4a156bb62963e4..8ccd85936c6da15b8c5d5c9c14141f6452a17167 100644 (file)
@@ -76,12 +76,13 @@ class MathedCursor {
     ///
     void SetPar(MathParInset *);
     ///
-    void Interpret(char const *);
+    void Interpret(string const &);
     ///
     void SetSize(short);
     ///
     void setNumbered();
-    void setLabel(char const *);
+    ///
+    void setLabel(string const &);
     ///
     bool Limits();
     /// Set accent: if argument = 0 it's considered consumed 
index bebf604dafddadf50199ebf0953b803004ef3767..99dbf57038cac4f2817ca5a93274669cadafb78b 100644 (file)
@@ -221,7 +221,7 @@ class MathParInset;
 class MathedInset  {
  public: 
     /// A math inset has a name (usually its LaTeX name), type and font-size
-    MathedInset(char const * nm, short ot, short st);
+    MathedInset(string const & nm, short ot, short st);
     ///
     explicit
     MathedInset(MathedInset *);
@@ -254,7 +254,7 @@ class MathedInset  {
     virtual void SetLimits(bool) {}   
    
     ///
-    char const * GetName() const { return name; }
+    string const & GetName() const { return name; }
     ///
     short GetType() const { return objtype; }
     ///
@@ -266,10 +266,10 @@ class MathedInset  {
     ///
     virtual void  SetStyle(short st) { size = st; } // Metrics();
     ///
-    virtual void  SetName(char const * n) { name = n; }
+    virtual void  SetName(string const & n) { name = n; }
  protected:
     ///
-    char const * name;
+    string name;
     ///
     short objtype;
     ///
@@ -319,7 +319,7 @@ enum MathedParFlag {
 class MathParInset: public MathedInset  {
  public: 
     ///
-    MathParInset(short st = LM_ST_TEXT, char const * nm = 0,
+    MathParInset(short st = LM_ST_TEXT, string const & nm = string(),
                 short ot = LM_OT_MIN);
     ///
     explicit
@@ -356,21 +356,13 @@ class MathParInset: public MathedInset  {
    
     // Tab stuff used by Matrix.
     ///
-    virtual void SetAlign(char, char const *) {}
-//    ///
-//    virtual int GetTabPos() { return 0; }
-//    ///
-//    virtual int GetTab(int) { return 0; }
+    virtual void SetAlign(char, string const &) {}
     ///
     virtual int GetColumns() { return 1; }
     ///
     virtual int GetRows() { return 1; }
     ///
     virtual bool isMatrix() { return false; }
-//    /// These functions should report an error
-//    virtual char const* GetLabel() { return 0; }
-//    virtual char const* GetLabel(int) { return 0; }
-
     // Vertical switching
     ///
     virtual bool setArgumentIdx(int i) { return (i == 0); }
@@ -380,8 +372,6 @@ class MathParInset: public MathedInset  {
     virtual int  getArgumentIdx() { return 0; }
     ///
     virtual int  getMaxArgumentIdx() { return 0; }
-//    ///
-//    virtual void SetLabel(char const *) {}
     ///
     virtual void SetStyle(short);
     ///
@@ -430,20 +420,20 @@ struct MathedRowSt {
            for (int i = 0 ; i < n + 1 ; ++i)
              w[i] = 0;
            next = 0;
-           label = 0;
+           //label = 0;
            numbered = true;
     }
     ///
     ~MathedRowSt() {
            delete[] w;
-           delete[] label;
+           //delete[] label;
     }
     /// Should be const but...
     MathedRowSt * getNext() const  { return next; }
     /// ...we couldn't use this.
     void setNext(MathedRowSt * n) { next = n; }
     ///
-    char const * getLabel() const { return label; }
+    string const & getLabel() const { return label; }
     ///
     bool isNumbered() const { return numbered; }
     ///
@@ -451,7 +441,7 @@ struct MathedRowSt {
     ///
     int  getTab(int i) { return w[i]; }
     /// 
-    void setLabel(char * l) { label = l; }
+    void setLabel(string const & l) { label = l; }
     ///
     void setNumbered(bool nf) { numbered = nf; }
     ///
@@ -463,7 +453,7 @@ struct MathedRowSt {
     /// widths 
     int * w;
     /// 
-    char * label;
+    string label;
     ///
     bool numbered;
     ///
@@ -506,8 +496,6 @@ class MathMatrixInset: public MathParInset {
        *vv = v_align;
        return h_align;
     }
-//    ///
-//    int GetTab(int);
     ///
     int GetColumns() { return nc; }
     ///
@@ -528,7 +516,7 @@ class MathMatrixInset: public MathParInset {
     /// tab sizes
     int * ws;   
     /// 
-    char v_align; // add approp. signedness
+    char v_align; // add approp. type
     ///
     char * h_align;
     /// Vertical structure
@@ -544,7 +532,7 @@ LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * data,
                            MathParInset ** mt);
 ///
 void mathed_write(MathParInset *, std::ostream &, int *, bool fragile,
-                 char const * label = 0);
+                 string const & label = string());
 
 ///
 void mathed_parser_file(std::istream &, int);
@@ -626,7 +614,7 @@ bool MathIsSymbol(short x) {
      
 
 inline
-MathedInset::MathedInset(char const * nm, short ot, short st):
+MathedInset::MathedInset(string const & nm, short ot, short st):
   name(nm), objtype(ot), size(st) 
 {
    width = ascent = descent = 0;
index c3c01b20250553456407cbd9ef56ec0595a1db6a..8373db25dc65c64066ab3049e61b7f1cf0474a6d 100644 (file)
 
 using std::endl;
 
-extern LyXFont mathed_get_font(short type, int size);
+extern LyXFont const mathed_get_font(short type, int size);
 extern int mathed_char_width(short type, int style, byte c);
-extern int mathed_string_width(short type, int style, byte const* s, int ls);
-extern int mathed_string_height(short, int, byte const*, int, int&, int&);
-extern int mathed_char_height(short, int, byte, int&, int&);
+extern int mathed_string_width(short type, int style, string const &);
+extern int mathed_string_height(short, int, string const &, int &, int &);
+extern int mathed_char_height(short, int, byte, int &, int &);
 
 void
 MathSpaceInset::draw(Painter & pain, int x, int y)
@@ -141,10 +141,14 @@ MathParInset::draw(Painter & pain, int x, int y)
 void 
 MathParInset::Metrics()
 {
-    byte cx, cxp= 0, *s;
+    byte cx;
+    byte cxp = 0;
+    string s;
     int ls;
-    int asc= df_asc, des= 0;
-    int tb = 0, tab= 0;
+    int asc = df_asc;
+    int des = 0;
+    int tb = 0;
+    int tab = 0;
 
     bool limits = false;
     
@@ -160,23 +164,23 @@ MathParInset::Metrics()
     while (data.OK()) {
        cx = data.GetChar();      
        if (cx >= ' ') {
-           s = data.GetString(ls);
-           mathed_string_height(data.FCode(), size, s, ls, asc, des);
+           s = reinterpret_cast<char *>(data.GetString(ls));
+           mathed_string_height(data.FCode(), size, s, asc, des);
            if (asc > ascent) ascent = asc;
            if (des > descent) descent = des;
            limits = false;
            mathed_char_height(LM_TC_CONST, size, 'y', asc, des);
        } else
          if (MathIsInset(cx)) {
-             MathedInset *p = data.GetInset();
+             MathedInset * p = data.GetInset();
              p->SetStyle(size);   
              p->Metrics();
              if (cx == LM_TC_UP) {
-                 asc += (limits) ? p->Height()+4: p->Ascent() + 
-                   ((p->Descent()>asc) ? p->Descent()-asc+4: 0);
+                 asc += (limits) ? p->Height() + 4: p->Ascent() + 
+                   ((p->Descent()>asc) ? p->Descent() - asc + 4: 0);
              } else
                if (cx == LM_TC_DOWN) {
-                   des += ((limits) ? p->Height()+4: p->Height()-p->Ascent()/2);
+                   des += ((limits) ? p->Height() + 4: p->Height() - p->Ascent() / 2);
                } else {
                    asc = p->Ascent();
                    des = p->Descent();
@@ -201,14 +205,14 @@ MathParInset::Metrics()
              data.Next();
          } else
          if (cx == LM_TC_CR) {
-             if (tb>0) {
+             if (tb > 0) {
                  int x, y;
                  data.GetIncPos(x, y);
                  if (data.IsFirst() || cxp == LM_TC_TAB || cxp == LM_TC_CR) {
                      if (ascent<df_asc) ascent = df_asc;
                      tb = x;
                  } 
-                 data.setTab(x-tb, tab);
+                 data.setTab(x - tb, tab);
              } else //if (GetColumns() == 1) 
                    {
                  int x, y;
@@ -216,13 +220,12 @@ MathParInset::Metrics()
                  data.setTab(x, tab);
                  if (ascent<df_asc) ascent = df_asc;
              } 
-             tb= tab= 0;
+             tb = tab = 0;
              data.subMetrics(ascent, descent);
              ascent = df_asc;   
              descent = 0;
              data.Next();
-         }      
-       else {
+         } else {
                lyxerr << "Mathed Error: Unrecognized code[" << cx
                       << "]" << endl;
            break;
@@ -237,7 +240,7 @@ MathParInset::Metrics()
            if (ascent<df_asc) ascent = df_asc;
            data.setTab(0, tab);
        } else {
-         data.setTab(width-tb, tab);
+         data.setTab(width - tb, tab);
        }
     }
          
@@ -321,19 +324,14 @@ MathFracInset::Metrics()
 void
 MathBigopInset::draw(Painter & pain, int x, int y)
 {
-   int ls;
-   char c;
-   char const *s;
+   string s;
    short t;
    
    if (sym < 256 || sym == LM_oint) {
-      ls = 1;
-      c = (sym == LM_oint) ? LM_int : sym;
-      s = &c;
+      s += (sym == LM_oint) ? LM_int : sym;
       t = LM_TC_BSYM;
    } else {
       s = name;
-      ls = strlen(name);
       t = LM_TC_TEXTRM;
    }
    if (sym == LM_oint) {
@@ -341,33 +339,26 @@ MathBigopInset::draw(Painter & pain, int x, int y)
                    LColor::mathline);
           ++x;
    }
-   pain.text(x, y, s, ls, mathed_get_font(t, size));
+   pain.text(x, y, s, mathed_get_font(t, size));
 }
 
 
 void
 MathBigopInset::Metrics()
 {   
-       int ls;
        char c;
-       char const *s;
+       string s;
        short t;
        
        if (sym < 256 || sym == LM_oint) {
-               ls = 1;
                c = (sym == LM_oint) ? LM_int: sym;
-               s = &c;
+               s += c;
                t = LM_TC_BSYM;
        } else {
                s = name;
-               ls = strlen(name);
                t = LM_TC_TEXTRM;
        }
-       mathed_string_height(t, size,
-                            reinterpret_cast<const unsigned char*>(s),
-                            ls, ascent, descent);
-       width = mathed_string_width(t, size,
-                                   reinterpret_cast<const unsigned char*>(s),
-                                   ls);
+       mathed_string_height(t, size, s, ascent, descent);
+       width = mathed_string_width(t, size, s);
        if (sym == LM_oint) width += 2;
 }
index ba5fb5cdccbed8f16d05a12ccbefec7cda996c55..66af12bcdb0dc3ca1995c2b707c3f923ca90bc08 100644 (file)
@@ -354,45 +354,48 @@ static short lookup[] =
        276,
 };
 
-struct latexkeys *
+
+latexkeys *
 in_word_set (register char const *str, register int len)
 {
-  if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
-    {
-      register int key = math_hash (str, len);
-
-      if (key <= MAX_HASH_VALUE && key >= 0)
-        {
-          register int idx = lookup[key];
-
-          if (idx >= 0 && idx < MAX_HASH_VALUE)
-            {
-              register char const * s = wordlist[idx].name;
+       if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) {
+               int key = math_hash (str, len);
+               
+               if (key <= MAX_HASH_VALUE && key >= 0) {
+                       int idx = lookup[key];
+                       
+                       if (idx >= 0 && idx < MAX_HASH_VALUE) {
+                               char const * s = wordlist[idx].name;
+                               
+                               if (*s == *str && !strcmp (str + 1, s + 1))
+                                       return &wordlist[idx];
+                       } else if (idx < 0 && idx >= -MAX_HASH_VALUE) {
+                               return 0;
+                       } else {
+                               int offset = key + idx + (idx > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE);
+                               latexkeys * base = &wordlist[-lookup[offset]];
+                               latexkeys * ptr = base + -lookup[offset + 1];
+                               
+                               while (--ptr >= base)
+                                       if (*str == *ptr->name && !strcmp (str + 1, ptr->name + 1))
+                                               return ptr;
+                       }
+               }
+       }
+       return 0;
+}
 
-              if (*s == *str && !strcmp (str + 1, s + 1))
-                return &wordlist[idx];
-            }
-          else if (idx < 0 && idx >= -MAX_HASH_VALUE)
-            return 0;
-          else
-            {
-              register int offset = key + idx + (idx > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE);
-              register struct latexkeys *base = &wordlist[-lookup[offset]];
-              register struct latexkeys *ptr = base + -lookup[offset + 1];
 
-              while (--ptr >= base)
-                if (*str == *ptr->name && !strcmp (str + 1, ptr->name + 1))
-                  return ptr;
-            }
-        }
-    }
-  return 0;
+latexkeys * in_word_set(string const & str) 
+{
+       return in_word_set(str.c_str(), str.length());
 }
 
+
 latexkeys *lm_get_key_by_id(int t, short tk)
 {
-   latexkeys* l = &wordlist[MIN_HASH_VALUE+TOTAL_KEYWORDS];
-   latexkeys* base = &wordlist[MIN_HASH_VALUE];
+   latexkeys * l = &wordlist[MIN_HASH_VALUE+TOTAL_KEYWORDS];
+   latexkeys * base = &wordlist[MIN_HASH_VALUE];
    while (--l >= base) {
      if (t == l->id && tk == l->token)
        return l;
@@ -400,9 +403,10 @@ latexkeys *lm_get_key_by_id(int t, short tk)
    return 0;
 }
 
+
 latexkeys *lm_get_key_by_index(int i)
 {
-   if (i>0 && i<TOTAL_KEYWORDS+2)
+   if (i > 0 && i < TOTAL_KEYWORDS + 2)
      return &wordlist[i];
    else
      return 0;
index 8b872a0af05790d6a29ad015c919b440eac90523..dfcce43cd83360797b01f5bc4644c91eb1454747 100644 (file)
@@ -26,7 +26,7 @@
 #include "symbol_def.h"
 
 
-inline
+static inline
 char * strnew(char const * s)
 {
    char * s1 = new char[strlen(s)+1];
@@ -47,21 +47,21 @@ MathedInset::MathedInset(MathedInset * inset)
       objtype = LM_OT_UNDEF;
       size = LM_ST_TEXT;
       width = ascent = descent = 0;
-      name = 0;
+      //name = 0;
    }
 }
 
 
-MathFuncInset::MathFuncInset(char const * nm, short ot, short st)
+MathFuncInset::MathFuncInset(string const & nm, short ot, short st)
        : MathedInset("", ot, st)
 {
    ln = 0;
    lims = (GetType() == LM_OT_FUNCLIM);
     if (GetType() == LM_OT_UNDEF) {
-       fname = strnew(nm);
+       fname = nm;
        SetName(fname);
     } else {
-       fname = 0;
+       //fname = 0;
        SetName(nm);
     }
 }
@@ -84,7 +84,7 @@ MathedInset * MathSpaceInset::Clone()
 }
 
 
-MathParInset::MathParInset(short st, char const * nm, short ot)
+MathParInset::MathParInset(short st, string const & nm, short ot)
        : MathedInset(nm, ot, st)
 {
     array = 0;
@@ -338,8 +338,8 @@ MathMatrixInset::MathMatrixInset(MathMatrixInset * mt)
        while (mrow) {
            r = new MathedRowSt(nc + 1);
            r->numbered = mrow->numbered;
-           if (mrow->label) 
-             r->label = strnew(mrow->label);
+           //if (mrow->label) 
+             r->label = mrow->label;
            if (!ro) 
              row = r;
            else
@@ -534,7 +534,7 @@ MathedInset * MathAccentInset::Clone()
 }
 
 
-MathBigopInset::MathBigopInset(char const* nam, int id, short st)
+MathBigopInset::MathBigopInset(string const & nam, int id, short st)
        : MathedInset(nam, LM_OT_BIGOP, st), sym(id)
 {
    lims = -1;
@@ -547,7 +547,7 @@ MathedInset * MathBigopInset::Clone()
 }
 
 
-MathDotsInset::MathDotsInset(char const * nam, int id, short st)
+MathDotsInset::MathDotsInset(string const & nam, int id, short st)
        : MathedInset(nam, LM_OT_DOTS, st), code(id) {}
 
 
index 23522840082098d7d2520e865070024f6fb6ce98..1b374a866d7b25c2c94939a5936d0d52ec2065d8 100644 (file)
@@ -37,7 +37,7 @@ class MathFuncInset: public MathedInset  {
 public:
        ///
        explicit
-       MathFuncInset(char const * nm,
+       MathFuncInset(string const & nm,
                      short ot = LM_OT_FUNC, short st = LM_ST_TEXT);
        ///
        ~MathFuncInset();
@@ -57,7 +57,7 @@ protected:
        ///
        bool lims;
        ///
-       char * fname;
+       string fname;
 };
 
 
@@ -99,7 +99,7 @@ protected:
 class MathDotsInset: public MathedInset {
 public:
        ///
-       MathDotsInset(char const *, int, short st = LM_ST_TEXT);
+       MathDotsInset(string const &, int, short st = LM_ST_TEXT);
        ///
        MathedInset * Clone();
        ///
@@ -141,7 +141,7 @@ protected:
 class MathBigopInset: public MathedInset {
 public:
        ///
-       MathBigopInset(char const *, int, short st = LM_ST_TEXT);
+       MathBigopInset(string const &, int, short st = LM_ST_TEXT);
        ///
        MathedInset * Clone();
        ///
@@ -284,9 +284,7 @@ protected:
  
 inline
 MathFuncInset::~MathFuncInset()
-{
-    if (fname && GetType() == LM_OT_UNDEF) delete[] fname;
-}
+{}
 
 
 inline
index 9e077461c463f1860027ea8c39ed19ddcdd96162..f1e98866401be8d70c9559d99d69e14169c975ac 100644 (file)
@@ -38,7 +38,7 @@ extern int mathed_char_height(short, int, byte, int&, int&);
 
 // the builtin memcpy() is broken in egcs and gcc 2.95.x on alpha
 // stations. We provide a hand-made version instead. 
-inline
+static inline
 void my_memcpy( void * ps_in, const void * pt_in, size_t n )
 {
     char * ps = static_cast<char *>(ps_in);
@@ -64,7 +64,7 @@ void MathedIter::Reset()
 }
 
 
-byte MathedIter::GetChar()
+byte MathedIter::GetChar() const
 {
     if (IsFont()) { 
        fcode = array->bf[pos];
@@ -74,25 +74,33 @@ byte MathedIter::GetChar()
 }
 
 
-byte* MathedIter::GetString(int& len)
+byte * MathedIter::GetString(int& len) const
 {
     if (IsFont()) { 
        fcode = array->bf[++pos];
-       pos++;
+       ++pos;
     }
-    byte *s = &array->bf[pos];
+    byte * s = &array->bf[pos];
     len = pos;
-    while (array->bf[pos]>= ' ' && pos<array->last) pos++;
-    len = pos-len;   
+    while (array->bf[pos] >= ' ' && pos < array->last) ++pos;
+    len = pos - len;
    
    return s;
 }
 
-MathedInset* MathedIter::GetInset()
+string const MathedIter::GetString() const
+{
+       int ls = 0;
+       byte * s = GetString(ls);
+       return string(reinterpret_cast<char *>(s), ls);
+}
+
+       
+MathedInset * MathedIter::GetInset() const
 {
    if (IsInset()) {
-      MathedInset* p;
-      my_memcpy(&p, &array->bf[pos+1], sizeof(p));
+      MathedInset * p;
+      my_memcpy(&p, &array->bf[pos + 1], sizeof(p));
       return p;
    } else {
           lyxerr << "Math Error: This is not an inset["
@@ -103,7 +111,7 @@ MathedInset* MathedIter::GetInset()
 
 // An active math inset MUST be derived from MathParInset because it 
 // must have at least one paragraph to edit
-MathParInset * MathedIter::GetActiveInset()
+MathParInset * MathedIter::GetActiveInset() const
 {
     if (IsActive()) {
        return static_cast<MathParInset*>(GetInset());
@@ -576,12 +584,14 @@ void MathedXIter::SetData(MathParInset *pp)
     Reset();
 }
 
-byte* MathedXIter::GetString(int& ls)
+
+byte * MathedXIter::GetString(int & ls) const
 {  
    static byte s[255];
-   byte const *sxs =  MathedIter::GetString(ls);
-   if (ls>0) {
-       strncpy(reinterpret_cast<char*>(s), reinterpret_cast<const char*>(sxs), ls);
+   byte const * sxs =  MathedIter::GetString(ls);
+   if (ls > 0) {
+       strncpy(reinterpret_cast<char*>(s),
+              reinterpret_cast<const char*>(sxs), ls);
        x += mathed_string_width(fcode, size, s, ls);
        return &s[0];
    }       
@@ -589,6 +599,14 @@ byte* MathedXIter::GetString(int& ls)
 }
 
 
+string const MathedXIter::GetString() const
+{
+       int ls;
+       byte * s = GetString(ls);
+       return string(reinterpret_cast<char*>(s), ls);
+}
+
+
 bool MathedXIter::Next()
 {  
 //    lyxerr << "Ne[" << pos << "]";
@@ -940,9 +958,9 @@ bool MathedXIter::setNumbered(bool numb)
 }
 
 
-bool MathedXIter::setLabel(char* label)
+bool MathedXIter::setLabel(string const & label)
 {  
-    if (label && crow) {
+    if (!label.empty() && crow) {
        crow->setLabel(label);
        return true;
     }
@@ -951,19 +969,19 @@ bool MathedXIter::setLabel(char* label)
 }
 
 
-MathedRowSt *MathedXIter::adjustVerticalSt()
+MathedRowSt * MathedXIter::adjustVerticalSt()
 {
     GoBegin();
     if (!crow) {
 //     lyxerr << " CRW" << ncols << " ";
-           crow = new MathedRowSt(ncols+1); // this leaks
+           crow = new MathedRowSt(ncols + 1); // this leaks
     }
 //    lyxerr<< " CRW[" << crow << "] ";
-    MathedRowSt *mrow = crow;
+    MathedRowSt * mrow = crow;
     while (OK()) {
        if (IsCR()) {
-           if (col>= ncols) ncols = col+1; 
-           MathedRowSt *r = new MathedRowSt(ncols+1); // this leaks
+           if (col >= ncols) ncols = col + 1; 
+           MathedRowSt * r = new MathedRowSt(ncols + 1); // this leaks
 //         r->next = crow->next;
            crow->next = r;
            crow = r;
index dd4b1cb98286f7a0b9b242f9a203796b97a10c3c..84f0d76e820580d14d18bc1e414d8796a9e4db5d 100644 (file)
@@ -60,31 +60,33 @@ class MathedIter {
     ///
     void goPosAbs(int);
     ///
-    int Empty() { return array->Last()<= 1; }
+    int Empty() const { return array->Last()<= 1; }
     ///
-    int OK() { return array && (pos < array->Last()); }
+    int OK() const { return array && (pos < array->Last()); }
     ///
-    int IsFirst() { return (pos == 0); }
+    int IsFirst() const { return (pos == 0); }
     ///
-    byte GetChar();
+    byte GetChar() const;
     ///
-    byte * GetString(int& len);
+    byte * GetString(int & len) const;
     ///
-    MathedInset * GetInset();
+    string const GetString() const;
     ///
-    MathParInset * GetActiveInset();
+    MathedInset * GetInset() const;
     ///
-    bool IsInset();
+    MathParInset * GetActiveInset() const;
     ///
-    bool IsActive();
+    bool IsInset() const;
     ///
-    bool IsFont();
+    bool IsActive() const;
     ///
-    bool IsScript();
+    bool IsFont() const;
     ///
-    bool IsTab();
+    bool IsScript() const;
     ///
-    bool IsCR();
+    bool IsTab() const;
+    ///
+    bool IsCR() const;
     ///
     virtual void Reset();
     ///
@@ -112,10 +114,10 @@ class MathedIter {
     ///
     void SetData(LyxArrayBase * a) { array = a; Reset(); }
     ///
-    LyxArrayBase * GetData() { return array; }
+    LyxArrayBase * GetData() const { return array; }
     
     /// Copy every object from position p1 to p2
-    LyxArrayBase * Copy(int p1= 0, int p2= 10000);
+    LyxArrayBase * Copy(int p1 = 0, int p2 = 10000);
    
     /// Delete every object from position p1 to p2
     void Clear();
@@ -128,13 +130,13 @@ class MathedIter {
     ///
     int flags;
     ///
-    short fcode;
+    mutable short fcode;
     ///
-    int pos;
+    mutable int pos;
     ///
     int row, col, ncols;
     ///
-    LyxArrayBase *array;
+    LyxArrayBase * array;
     // one element stack
     struct MIState {
        ///
@@ -174,7 +176,7 @@ class MathedXIter: public MathedIter {
     ///
     void SetData(MathParInset *);
     ///
-    MathParInset * getPar() { return p; }
+    MathParInset * getPar() const { return p; }
     ///
     bool Next();
     ///
@@ -193,22 +195,24 @@ class MathedXIter: public MathedIter {
     void Adjust();
     ///
     inline
-    void GetPos(int &, int &);
+    void GetPos(int &, int &) const;
     ///
     inline
-    void GetIncPos(int &, int &);
+    void GetIncPos(int &, int &) const;
+    ///
+    byte * GetString(int &) const ;
     ///
-    byte * GetString(int &);
+    string const GetString() const;
     ///
-    int GetX();
+    int GetX() const;
     ///
-    int GetY();
+    int GetY() const;
     ///
     void subMetrics(int, int);
     ///
     void fitCoord(int, int);
     /// 
-    void getAD(int & a, int & d);
+    void getAD(int & a, int & d) const;
     
     /// Create a new row and insert #ncols# tabs.
     void addRow();
@@ -216,29 +220,30 @@ class MathedXIter: public MathedIter {
     void delRow();
     
     ///
-    bool setLabel(char* label);
+    bool setLabel(string const & label);
     ///
     bool setNumbered(bool);
        
     ///
     void setTab(int, int);
     /// Merge the array at current position
-    void Merge(LyxArrayBase*);
+    void Merge(LyxArrayBase *);
     /// Delete every object from current position to pos2
     void Clean(int pos2);
-    MathedRowSt *adjustVerticalSt();
+    ///
+    MathedRowSt * adjustVerticalSt();
     
 private:
     /// This function is not recursive, as MathPar::Metrics is
-    void IMetrics(int, int&, int&, int&);
+    void IMetrics(int, int &, int &, int &);
     /// Font size (display, text, script, script2) 
     int size;
     /// current position
-    int x, y;
-//    /// max ascent and descent
-//    int asc, des;
-       ///
-    MathParInset *p;
+    mutable int x;
+    ///
+    int y;
+    ///
+    MathParInset * p;
     
     // Limits auxiliary variables
     /// Position and max width of a script
@@ -254,7 +259,7 @@ private:
 
 protected:
     /// 
-    MathedRowSt *crow;
+    MathedRowSt * crow;
     
 private:
     ///
@@ -266,46 +271,47 @@ private:
 
 
 inline
-bool MathedIter::IsInset()
+bool MathedIter::IsInset() const
 {
     return MathIsInset((*array)[pos]);
 }
  
 inline
-bool MathedIter::IsActive()
+bool MathedIter::IsActive() const
 {
     return MathIsActive((*array)[pos]);
 }
 
 inline
-bool MathedIter::IsFont()
+bool MathedIter::IsFont() const
 {
     return MathIsFont((*array)[pos]);
 }
 
 
 inline
-bool MathedIter::IsScript()
+bool MathedIter::IsScript() const
 {
     return MathIsScript((*array)[pos]);
 }   
 
 inline
-bool MathedIter::IsTab()
+bool MathedIter::IsTab() const
 {
     return ((*array)[pos] == LM_TC_TAB);
 }  
 
 
 inline
-bool MathedIter::IsCR()
+bool MathedIter::IsCR() const
 {
     return ((*array)[pos] == LM_TC_CR);
 }  
 
 
 inline
-MathedIter::MathedIter(LyxArrayBase * d): array(d)
+MathedIter::MathedIter(LyxArrayBase * d)
+       : array(d)
 {
     pos = 0;
     row = col = 0;
@@ -334,7 +340,7 @@ void MathedIter::ipop()
 
 
 inline
-void MathedXIter::GetPos(int&xx, int& yy)
+void MathedXIter::GetPos(int & xx, int & yy) const
 { 
     if (p) 
       p->GetXY(xx, yy);
@@ -344,7 +350,7 @@ void MathedXIter::GetPos(int&xx, int& yy)
 }
 
 inline 
-int MathedXIter::GetX() 
+int MathedXIter::GetX() const
 { 
     int xx, yy;
     GetPos(xx, yy);
@@ -352,7 +358,7 @@ int MathedXIter::GetX()
 }
 
 inline 
-int MathedXIter::GetY() 
+int MathedXIter::GetY() const
 { 
     int xx, yy;
     GetPos(xx, yy);
@@ -361,14 +367,14 @@ int MathedXIter::GetY()
 
 
 inline
-void MathedXIter::GetIncPos(int& xx, int& yy) 
+void MathedXIter::GetIncPos(int & xx, int & yy) const
 { 
     xx = x;  yy = y; 
 }
 
 
 inline
-void MathedXIter::getAD(int& a, int& d) 
+void MathedXIter::getAD(int & a, int & d) const
 { 
     if (crow) {
        a = crow->asc;
index 9f1a3a36eef9d29343daaba73459e926f8ece2fe..5f2a77cad686d2735ca910270f1e8c84cbb53fa7 100644 (file)
@@ -218,18 +218,18 @@ void MathMacroArgument::draw(Painter & pain, int x, int baseline)
     if (expnd_mode) {
        MathParInset::draw(pain, x, baseline);
     } else {
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
            std::ostringstream ost;
            ost << '#' << number;
            drawStr(pain, LM_TC_TEX, size, x, baseline, 
                    reinterpret_cast<byte const *>(ost.str().c_str()), 2);
-#else
-           char s[3];
-           ostrstream ost(s, 3);
-           ost << '#' << number << '\0';
-           drawStr(pain, LM_TC_TEX, size, x, baseline,
-                   reinterpret_cast<byte *>(ost.str()), 2);
-#endif
+//#else
+//         char s[3];
+//         ostrstream ost(s, 3);
+//         ost << '#' << number << '\0';
+//         drawStr(pain, LM_TC_TEX, size, x, baseline,
+//                 reinterpret_cast<byte *>(ost.str()), 2);
+//#endif
     }
 }
 
@@ -239,7 +239,7 @@ void MathMacroArgument::Metrics()
     if (expnd_mode) {
        MathParInset::Metrics();
     } else {
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
            std::ostringstream ost;
            ost << '#' << number;
            width = mathed_string_width(LM_TC_TEX, size, 
@@ -247,17 +247,17 @@ void MathMacroArgument::Metrics()
            mathed_string_height(LM_TC_TEX, size,
                                 reinterpret_cast<byte const *>(ost.str().c_str()), 
                                 2, ascent, descent);
-#else
-       char s[3];
-       ostrstream ost(s, 3);
-       ost << '#' << number << '\0';
-       width = mathed_string_width(LM_TC_TEX, size,
-                                   reinterpret_cast<byte *>
-                                   (ost.str()), 2);
-       mathed_string_height(LM_TC_TEX, size,
-                            reinterpret_cast<byte *>(ost.str()),
-                            2, ascent, descent);
-#endif
+//#else
+//     char s[3];
+//     ostrstream ost(s, 3);
+//     ost << '#' << number << '\0';
+//     width = mathed_string_width(LM_TC_TEX, size,
+//                                 reinterpret_cast<byte *>
+//                                 (ost.str()), 2);
+//     mathed_string_height(LM_TC_TEX, size,
+//                          reinterpret_cast<byte *>(ost.str()),
+//                          2, ascent, descent);
+//#endif
     }
 }
 
@@ -438,10 +438,10 @@ MathMacroTable::~MathMacroTable()
 
 
 // The search is currently linear but will be binary or hash, later.
-MathMacroTemplate * MathMacroTable::getTemplate(char const * name) const
+MathMacroTemplate * MathMacroTable::getTemplate(string const & name) const
 {
     for (int i = 0; i < num_macros; ++i) {
-      if (strcmp(name, macro_table[i]->GetName()) == 0
+      if (name == macro_table[i]->GetName()
        return macro_table[i];
     }
     
index bd87b701af471c7b5a4284f474fa6e57dd39fc9c..f57f09098ec8a67195d3512c59803713ce08d987 100644 (file)
@@ -201,9 +201,9 @@ public:
     ///
     void addTemplate(MathMacroTemplate *);
     ///
-    MathMacro * getMacro(char const *) const;
+    MathMacro * getMacro(string const &) const;
     ///
-    MathMacroTemplate * getTemplate(char const *) const;
+    MathMacroTemplate * getTemplate(string const &) const;
     ///
     void builtinMacros();
     ///
@@ -262,7 +262,7 @@ void MathMacro::SetData(LyxArrayBase * a)
 
 
 inline 
-MathMacro * MathMacroTable::getMacro(char const * name) const
+MathMacro * MathMacroTable::getMacro(string const & name) const
 {
        MathMacroTemplate * mt = getTemplate(name);
        return (mt) ? new MathMacro(mt): 0;
index 8ad14ff12c1d431daf5159f6cb1a6b5695123e81..3a7bb081224fc08a2bbfe87f766d2547f332e683 100644 (file)
 
 #include <config.h>
 
+#if 0
 #ifdef HAVE_SSTREAM
 #include <sstream>
 #else
 #include <strstream>
 #endif
+#else
+#include "Lsstream.h"
+#endif
 
 #include FORMS_H_LOCATION
 
@@ -152,16 +156,16 @@ void delim_cb(FL_OBJECT *, long data)
     case MM_APPLY:
     case MM_OK:
       {
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
              std::ostringstream ost;
              ost << delim_code[left] << ' ' << delim_code[right];
              lyxfunc->Dispatch(LFUN_MATH_DELIM, ost.str().c_str());
-#else
-             char s[80];
-             ostrstream ost(s, 80);
-             ost << delim_code[left] << ' ' << delim_code[right] << '\0';
-             lyxfunc->Dispatch(LFUN_MATH_DELIM, ost.str());
-#endif
+//#else
+//           char s[80];
+//           ostrstream ost(s, 80);
+//           ost << delim_code[left] << ' ' << delim_code[right] << '\0';
+//           lyxfunc->Dispatch(LFUN_MATH_DELIM, ost.str());
+//#endif
              if (data == MM_APPLY) break;
       }
     case MM_CLOSE: fl_hide_form(fd_delim->delim); break;
@@ -211,16 +215,16 @@ void matrix_cb(FL_OBJECT *, long data)
         int nx = int(fl_get_slider_value(fd_matrix->columns)+0.5);
         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
+//#ifdef HAVE_SSTREAM
         std::ostringstream ost;
         ost << nx << ' ' << ny << ' ' << c << sh;
         lyxfunc->Dispatch(LFUN_INSERT_MATRIX, ost.str().c_str());
-#else
-        char s[80];
-        ostrstream ost(s, 80);
-        ost << nx << ' ' << ny << ' ' << c << sh << '\0';
-        lyxfunc->Dispatch(LFUN_INSERT_MATRIX, ost.str());
-#endif
+//#else
+//      char s[80];
+//      ostrstream ost(s, 80);
+//      ost << nx << ' ' << ny << ' ' << c << sh << '\0';
+//      lyxfunc->Dispatch(LFUN_INSERT_MATRIX, ost.str());
+//#endif
         break;
       }
     case MM_CLOSE: fl_hide_form(fd_matrix->matrix); break;
index 2c8c7053cfaec4d5abacf8e7662dac005ab000bb..9d08906c89ec1a01df44f2d66ad7604acea4c1ae 100644 (file)
@@ -92,7 +92,7 @@ static int yylineno;
 static istream * yyis;
 static bool yy_mtextmode= false;
            
-inline
+static inline
 char * strnew(char const * s)
 {
        char * s1 = new char[strlen(s) + 1]; // this leaks when not delete[]'ed
@@ -102,7 +102,7 @@ char * strnew(char const * s)
 
 
 static
-void mathPrintError(char const * msg) 
+void mathPrintError(string const & msg) 
 {
        lyxerr << "Line ~" << yylineno << ": Math parse error: "
               << msg << endl;
index 3a283b48e7c720ce6bd1eab5b49a6bb286e7e300..a99966423097732a5e257aa281c85de3919ab080 100644 (file)
@@ -23,6 +23,8 @@
 #pragma interface
 #endif
 
+#include "LString.h"
+
 #include "symbol_def.h"
 
 ///
@@ -113,6 +115,9 @@ struct latexkeys {
 latexkeys *
 in_word_set (register char const * str, register int len);
 
+///
+latexkeys * in_word_set(string const & str);
+
 ///
 latexkeys * lm_get_key(int index);
 
index 8eaf226a796a820d63aecb0e0a38b83afebe6a3c..34447a4f9da21ac7694411e1644d028fe7842463 100644 (file)
@@ -176,7 +176,8 @@ void BitmapMenu::Show()
 }
 
 FL_OBJECT *
-BitmapMenu::AddBitmap(int id, int nx, int ny, int bw, int bh, unsigned char const * data, Bool vert)
+BitmapMenu::AddBitmap(int id, int nx, int ny, int bw, int bh,
+                     unsigned char const * data, Bool vert)
 {
    if (i >= nb)
      return 0;
@@ -359,7 +360,7 @@ bool math_insert_greek(char c)
 }
 
 
-void math_insert_symbol(char const * s)
+void math_insert_symbol(string const & s)
 {
    if (current_view->available())   {
       if (!current_view->the_locking_inset) {
index 425f01529944450a8292060bbd05c6d1910aa7ec..f70873edbb1bc56c64f1a55abe300a80bc1ecba7 100644 (file)
@@ -252,7 +252,7 @@ void MathParInset::Write(ostream & os, bool fragile)
                                                if (!crow->isNumbered()) {  
                                                        os << "\\nonumber ";
                                                }
-                                               if (crow->getLabel()) {
+                                               if (!crow->getLabel().empty()) {
                                                        os << "\\label{"
                                                           << crow->getLabel()
                                                           << "} ";
@@ -276,7 +276,7 @@ void MathParInset::Write(ostream & os, bool fragile)
                if (!crow->isNumbered()) {
                        os << "\\nonumber ";
                }
-               if (crow->getLabel()) {
+               if (!crow->getLabel().empty()) {
                        os << "\\label{"
                           << crow->getLabel()
                           << "} ";
@@ -320,7 +320,7 @@ void MathMatrixInset::Write(ostream & os, bool fragile)
 
 
 void mathed_write(MathParInset * p, ostream & os, int * newlines,
-                 bool fragile, char const * label)
+                 bool fragile, string const & label)
 {
    number_of_newlines = 0;
    short mathed_env = p->GetType();
@@ -340,7 +340,7 @@ void mathed_write(MathParInset * p, ostream & os, int * newlines,
      ++number_of_newlines;
    }
    
-   if (label && label[0] > ' ' && mathed_env == LM_EN_EQUATION){
+   if (!label.empty() && label[0] > ' ' && mathed_env == LM_EN_EQUATION){
           os << "\\label{"
              << label
              << "}\n";
index 80cfc15ccb54089a12835484716cc428aa9e5531..d040e08f6a580993cbd97ca1df57ba69f9bec39a 100644 (file)
@@ -31,7 +31,7 @@ public:
                 string const & = string(),
                 int delay_secs= 6);
        /// 
-       string GetText() const { return text; }
+       string const GetText() const { return text; }
        ///
        void Init();
        ///
@@ -71,11 +71,13 @@ private:
         ///
         enum{ MAX_HISTORY = 10 };
         ///
-        string history[MAX_HISTORY];
+        mutable string history[MAX_HISTORY];
         ///
-        int history_idx, history_cnt;
+        mutable int history_idx;
+       ///
+       mutable int history_cnt;
         ///
-        void addHistory(string const &cmd) { 
+        void addHistory(string const &cmd) const 
                if (history_cnt == 0
                    || (history_cnt > 0
                        && cmd != history[(history_cnt - 1) % MAX_HISTORY])) {
@@ -85,6 +87,6 @@ private:
                history_idx = history_cnt;
        }
         ///
-        string getHistory() { return history[history_idx % MAX_HISTORY]; }
+        string const getHistory() const { return history[history_idx % MAX_HISTORY]; }
 };
 #endif
index d4116332d854f2fd8760ebaeec6bb35273b53bfc..fd5b1866063b3210bebea85e55a73da752ef1f0d 100644 (file)
@@ -818,7 +818,7 @@ Inset const * LyXParagraph::GetInset(LyXParagraph::size_type pos) const
 
 // Gets uninstantiated font setting at position.
 // Optimized after profiling. (Asger)
-LyXFont LyXParagraph::GetFontSettings(BufferParams const & bparams,
+LyXFont const LyXParagraph::GetFontSettings(BufferParams const & bparams,
                                      LyXParagraph::size_type pos) const
 {
 #ifdef NEW_INSETS
@@ -871,7 +871,7 @@ LyXFont LyXParagraph::GetFontSettings(BufferParams const & bparams,
 }
 
 // Gets uninstantiated font setting at position 0
-LyXFont LyXParagraph::GetFirstFontSettings() const
+LyXFont const LyXParagraph::GetFirstFontSettings() const
 {
        if (size() > 0) {
                if (!fontlist.empty())
@@ -893,7 +893,7 @@ LyXFont LyXParagraph::GetFirstFontSettings() const
 // the true picture of the buffer. (Asger)
 // If position is -1, we get the layout font of the paragraph.
 // If position is -2, we get the font of the manual label of the paragraph.
-LyXFont LyXParagraph::getFont(BufferParams const & bparams,
+LyXFont const LyXParagraph::getFont(BufferParams const & bparams,
                              LyXParagraph::size_type pos) const
 {
        LyXFont tmpfont;
@@ -1034,7 +1034,7 @@ LyXParagraph::GetChar(LyXParagraph::size_type pos) const
 
 
 // return an string of the current word, and the end of the word in lastpos.
-string LyXParagraph::GetWord(LyXParagraph::size_type & lastpos) const
+string const LyXParagraph::GetWord(LyXParagraph::size_type & lastpos) const
 {
        Assert(lastpos >= 0);
 
@@ -1926,7 +1926,7 @@ int LyXParagraph::GetFirstCounter(int i) const
 
 
 // the next two functions are for the manual labels
-string LyXParagraph::GetLabelWidthString() const
+string const LyXParagraph::GetLabelWidthString() const
 {
 #ifndef NEW_INSETS
        if (!FirstPhysicalPar()->labelwidthstring.empty())
@@ -3219,18 +3219,18 @@ void LyXParagraph::SimpleDocBookOneTablePar(Buffer const * buffer,
                                column = 0;
                } else if (c == LyXParagraph::META_INSET) {
                        inset = GetInset(i);
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                        std::ostringstream ost;
                        inset->DocBook(buffer, ost);
                        string tmp_out = ost.str().c_str();
-#else
-                       ostrstream ost;
-                       inset->DocBook(buffer, ost);
-                       ost << '\0';
-                       char * ctmp = ost.str();
-                       string tmp_out(ctmp);
-                       delete [] ctmp;
-#endif
+//#else
+//                     ostrstream ost;
+//                     inset->DocBook(buffer, ost);
+//                     ost << '\0';
+//                     char * ctmp = ost.str();
+//                     string tmp_out(ctmp);
+//                     delete [] ctmp;
+//#endif
                        //
                        // This code needs some explanation:
                        // Two insets are treated specially
@@ -3392,18 +3392,18 @@ void LyXParagraph::DocBookContTableRows(Buffer const * buffer,
                        }
                        if (c == LyXParagraph::META_INSET) {
                                inset = GetInset(i);
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                                std::ostringstream ost;
                                inset->DocBook(buffer, ost);
                                string tmp_out = ost.str().c_str();
-#else
-                               ostrstream ost;
-                               inset->DocBook(buffer, ost);
-                               ost << '\0';
-                               char * ctmp = ost.str();
-                               string tmp_out(ctmp);
-                               delete [] ctmp;
-#endif
+//#else
+//                             ostrstream ost;
+//                             inset->DocBook(buffer, ost);
+//                             ost << '\0';
+//                             char * ctmp = ost.str();
+//                             string tmp_out(ctmp);
+//                             delete [] ctmp;
+//#endif
                                //
                                // This code needs some explanation:
                                // Two insets are treated specially
@@ -4297,11 +4297,11 @@ LyXParagraph * LyXParagraph::TeXFootnote(Buffer const * buf,
                // process footnotes > depth 0 or in environments separately
                // NOTE: Currently don't support footnotes within footnotes
                //       even though that is possible using the \footnotemark
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                std::ostringstream dummy;
-#else
-               ostrstream dummy;
-#endif
+//#else
+//             ostrstream dummy;
+//#endif
                TexRow dummy_texrow;
                int dummy_count = 0;
                do {
@@ -4342,9 +4342,9 @@ LyXParagraph * LyXParagraph::TeXFootnote(Buffer const * buf,
                                "Footnote in a Footnote -- not supported"
                               << endl;
                }
-#ifndef HAVE_OSTREAM
-               delete [] dummy.str();
-#endif
+//#ifndef HAVE_OSTREAM
+//             delete [] dummy.str();
+//#endif
        }
 
        switch (footnotekind) {
@@ -4408,8 +4408,8 @@ bool LyXParagraph::IsDummy() const
 #endif
 
 void LyXParagraph::SetPExtraType(BufferParams const & bparams,
-                                int type, char const * width,
-                                char const * widthp)
+                                int type, string const & width,
+                                string const & widthp)
 {
        pextra_type = type;
        pextra_width = width;
@@ -4655,7 +4655,7 @@ bool LyXParagraph::isMultiLingual(BufferParams const & bparams)
 
 // Convert the paragraph to a string.
 // Used for building the table of contents
-string LyXParagraph::String(Buffer const * buffer, bool label)
+string const LyXParagraph::String(Buffer const * buffer, bool label)
 {
        BufferParams const & bparams = buffer->params;
        string s;
@@ -4673,14 +4673,14 @@ string LyXParagraph::String(Buffer const * buffer, bool label)
                        s += c;
                else if (c == META_INSET &&
                         GetInset(i)->LyxCode() == Inset::MATH_CODE) {
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                        std::ostringstream ost;
                        GetInset(i)->Ascii(buffer, ost);
-#else
-                       ostrstream ost;
-                       GetInset(i)->Ascii(buffer, ost);
-                       ost << '\0';
-#endif
+//#else
+//                     ostrstream ost;
+//                     GetInset(i)->Ascii(buffer, ost);
+//                     ost << '\0';
+//#endif
                        s += subst(ost.str(),'\n',' ');
                }
        }
@@ -4701,7 +4701,7 @@ string LyXParagraph::String(Buffer const * buffer, bool label)
 }
 
 
-string LyXParagraph::String(Buffer const * buffer, 
+string const LyXParagraph::String(Buffer const * buffer, 
                            LyXParagraph::size_type beg,
                            LyXParagraph::size_type end)
 {
@@ -4732,14 +4732,14 @@ string LyXParagraph::String(Buffer const * buffer,
                if (IsPrintable(c))
                        s += c;
                else if (c == META_INSET) {
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                        std::ostringstream ost;
                        GetInset(i)->Ascii(buffer, ost);
-#else
-                       ostrstream ost;
-                       GetInset(i)->Ascii(buffer, ost);
-                       ost << '\0';
-#endif
+//#else
+//                     ostrstream ost;
+//                     GetInset(i)->Ascii(buffer, ost);
+//                     ost << '\0';
+//#endif
                        s += ost.str();
                }
 #ifndef NEW_TABULAR
index 3a36462599f9be0e5f4dd915470833dcaa56f594..6783f2989ea4950c15c53468b69f8965233baf0c 100644 (file)
@@ -491,22 +491,21 @@ void sc_clean_up_after_error()
 
 // Send word to ispell and get reply
 static
-isp_result * sc_check_word(char *word)
+isp_result * sc_check_word(string const & word)
 {
        //Please rewrite to use string.
-       isp_result *result;
-       char buf[1024];
 
-       fputs(word, out); 
+       fputs(word.c_str(), out);
        fputc('\n', out);
   
+       char buf[1024];
        fgets(buf, 1024, in); 
   
        /* I think we have to check if ispell is still alive here because
           the signal-handler could have disabled blocking on the fd */
-       if (isp_pid == -1) return 0;
+       if (!sc_still_alive()) return 0;
 
-       result = new isp_result;
+       isp_result * result = new isp_result;
   
        switch (*buf) {
        case '*': // Word found
@@ -562,27 +561,27 @@ void close_spell_checker()
 
 
 static inline 
-void sc_insert_word(char const *word)
+void sc_insert_word(string const & word)
 {
        fputc('*', out); // Insert word in personal dictionary
-       fputs(word, out);
+       fputs(word.c_str(), out);
        fputc('\n', out);
 }
 
 
 static inline 
-void sc_accept_word(char const *word) 
+void sc_accept_word(string const & word) 
 {
        fputc('@', out); // Accept in this session
-       fputs(word, out);
+       fputs(word.c_str(), out);
        fputc('\n', out);
 }
 
 static inline
-void sc_store_replacement(char const *mis, string const & cor) {
+void sc_store_replacement(string const & mis, string const & cor) {
         if(actual_spell_checker == ASC_ASPELL) {
                 fputs("$$ra ", out);
-                fputs(mis, out);
+                fputs(mis.c_str(), out);
                 fputc(',', out);
                 fputs(cor.c_str(), out);
                 fputc('\n', out);
@@ -622,26 +621,23 @@ void sc_clean_up_after_error()
 
 // Send word to ispell and get reply
 static
-isp_result * sc_check_word(char *word)
+isp_result * sc_check_word(string const & word)
 {
        isp_result * result = new isp_result;
        int word_ok = pspell_manager_check(sc, word);
-       assert(word_ok != -1);
+       Assert(word_ok != -1);
 
        if (word_ok) {
-
                result->flag = ISP_OK;
-
        } else {
 
-               const PspellWordList * sugs = pspell_manager_suggest(sc, word);
-               assert(sugs != 0);
+               PspellWordList const * sugs = pspell_manager_suggest(sc, word);
+               Assert(sugs != 0);
                result->els = pspell_word_list_elements(sugs);
                if (pspell_word_list_empty(sugs)) 
                        result->flag = ISP_UNKNOWN;
                else 
                        result->flag = ISP_MISSED;
-               
        }
        return result;
 }
@@ -653,22 +649,25 @@ void close_spell_checker()
        pspell_manager_save_all_word_lists(sc);
 }
 
+
 static inline 
-void sc_insert_word(char const *word)
+void sc_insert_word(string const & word)
 {
        pspell_manager_add_to_personal(sc, word);
 }
 
 
 static inline 
-void sc_accept_word(char const *word) 
+void sc_accept_word(string const & word) 
 {
        pspell_manager_add_to_session(sc, word);
 }
 
+
 static inline 
-void sc_store_replacement(char const *mis, string const & cor) {
-       pspell_manager_store_replacement(sc, mis, cor.c_str());
+void sc_store_replacement(string const & mis, string const & cor)
+{
+       pspell_manager_store_replacement(sc, mis.c_str(), cor.c_str());
 }
 
 #endif
@@ -814,8 +813,8 @@ bool RunSpellChecker(BufferView * bv)
        unsigned int word_count = 0;
 
        while (true) {
-               char * word = bv->nextWord(newval);
-               if (word == 0) break;
+               string const word = bv->nextWord(newval);
+               if (word.empty()) break;
                ++word_count;
                
                // Update slider if and only if value has changed
@@ -828,12 +827,10 @@ bool RunSpellChecker(BufferView * bv)
                if (word_count%1000 == 0) {
                        obj =  fl_check_forms();
                        if (obj == fd_form_spell_check->stop) {
-                               delete[] word;
                                close_spell_checker();
                                return true;
                        }
                        if (obj == fd_form_spell_check->done) {
-                               delete[] word;
                                close_spell_checker();
                                return false;
                        }
@@ -842,7 +839,6 @@ bool RunSpellChecker(BufferView * bv)
                result = sc_check_word(word);
                if (!sc_still_alive()) {
                        delete result;
-                       delete[] word;
                        break;
                }
 
@@ -856,8 +852,8 @@ bool RunSpellChecker(BufferView * bv)
                                reverse(tmp.begin(),tmp.end());
                                fl_set_object_label(fd_form_spell_check->text, tmp.c_str());
                        } else
-                               fl_set_object_label(fd_form_spell_check->text, word);
-                       fl_set_input(fd_form_spell_check->input, word);
+                               fl_set_object_label(fd_form_spell_check->text, word.c_str());
+                       fl_set_input(fd_form_spell_check->input, word.c_str());
                        fl_clear_browser(fd_form_spell_check->browser);
                        const char * w;
                        while ((w = result->next_miss()) != 0) {
@@ -913,14 +909,12 @@ bool RunSpellChecker(BufferView * bv)
                                }
                                if (obj == fd_form_spell_check->stop) {
                                        delete result;
-                                       delete[] word;
                                        close_spell_checker();
                                        return true;
                                }
            
                                if (obj == fd_form_spell_check->done) {
                                        delete result;
-                                       delete[] word;
                                        close_spell_checker();
                                        return false;
                                }
@@ -928,7 +922,6 @@ bool RunSpellChecker(BufferView * bv)
                }
                default:
                        delete result;
-                       delete[] word;
                }
        }
    
index cf52922815279bab8c1de68d04bfdac20a8e8ae0..5fe7a45640f2d0a5ac42f6e3b76f539a2fb15670 100644 (file)
@@ -52,6 +52,7 @@ libsupport_la_SOURCES = \
        path.h \
        putenv.C \
        rename.C \
+       sstream.h \
        $(REGEX) syscall.C \
        syscall.h \
        syscontr.C \
index ed1fa9ea456a45afad3829646294add8f18e751d..29eb28394bc3c7030852e57a3ddfad82cfcdc9dc 100644 (file)
@@ -1,15 +1,27 @@
 #include <config.h>
 
-#include <stdio.h>
+#include <fstream>
+
+//#include <stdio.h>
 
 #include "support/lyxlib.h"
 #include "LString.h"
-#include "support/syscall.h"
+//#include "support/syscall.h"
 #include "support/filetools.h"
 
-bool lyx::copy(char const * from, char const * to)
+bool lyx::copy(string const & from, string const & to)
 {
+#if 0
        string command = "cp " + QuoteName(from) + " " + QuoteName(to);
        return Systemcalls().startscript(Systemcalls::System,
                                         command) == 0;
+#else
+       ifstream ifs(from.c_str());
+       if (!ifs) return false;
+       ofstream ofs(to.c_str(), ios::out|ios::trunc);
+       if (!ofs) return false;
+       ofs << ifs.rdbuf();
+       if (ofs.good()) return true;
+       return false;
+#endif
 }
index e4c2ee6096f221f08874d4f244a81612ec5cde65..0fb5be8df319c427ef4588d3314b1170816cf0fb 100644 (file)
 #include <utility>
 #include <fstream>
 
+#if 0
 #ifdef HAVE_SSTREAM
 #include <sstream>
 #else
 #include <strstream>
 #endif
+#else
+#include "Lsstream.h"
+#endif
 
 #ifdef __GNUG__
 #pragma implementation "filetools.h"
@@ -739,24 +743,24 @@ string const GetFileContents(string const & fname)
        FileInfo finfo(fname);
        if (finfo.exist()) {
                ifstream ifs(fname.c_str());
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                std::ostringstream ofs;
-#else
-#warning The rumour goes that this might leak, but who really cares?
-               ostrstream ofs;
-#endif
+//#else
+//#warning The rumour goes that this might leak, but who really cares?
+//             ostrstream ofs;
+//#endif
                if (ifs && ofs) {
                        ofs << ifs.rdbuf();
                        ifs.close();
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                        return ofs.str().c_str();
-#else
-                       ofs << '\0';
-                       char const * tmp = ofs.str();
-                       string ret(tmp);
-                       delete[] tmp;
-                       return ret;
-#endif
+//#else
+//                     ofs << '\0';
+//                     char const * tmp = ofs.str();
+//                     string ret(tmp);
+//                     delete[] tmp;
+//                     return ret;
+//#endif
                }
        }
        lyxerr << "LyX was not able to read file '" << fname << "'" << endl;
@@ -964,8 +968,9 @@ ChangeExtension(string const & oldname, string const & extension)
        return CleanupPath(oldname.substr(0, last_dot) + ext);
 }
 
+
 /// Return the extension of the file (not including the .)
-string GetExtension(string const & name)
+string const GetExtension(string const & name)
 {
        string::size_type last_slash = name.rfind('/');
        string::size_type last_dot = name.rfind('.');
@@ -977,6 +982,7 @@ string GetExtension(string const & name)
                return string();
 }
 
+
 // Creates a nice compact path for displaying
 string const
 MakeDisplayPath (string const & path, unsigned int threshold)
@@ -1109,6 +1115,7 @@ findtexfile(string const & fil, string const & /*format*/)
         return c.first != -1 ? strip(c.second, '\n') : string();
 }
 
+
 void removeAutosaveFile(string const & filename)
 {
        string a = OnlyPath(filename);
index 24dc32bab97dd02ecbd7c07377a3232300f563cc..d1329d89e69a73bd4cc3b79db222e63fa5a0591d 100644 (file)
@@ -140,7 +140,7 @@ string const
 ChangeExtension(string const & oldname, string const & extension);
 
 /// Return the extension of the file (not including the .)
-string GetExtension(string const & name);
+string const GetExtension(string const & name);
 
 /// Create absolute path. If impossible, don't do anything
 string const ExpandPath(string const & path);
index 03ed40d5fecdcb9ba14dd2eabf52a81515aab407..3fe433f1cbfcb2589637d5d413d23122a6a66a29 100644 (file)
@@ -4,7 +4,7 @@
 #include "support/filetools.h"
 #include "gettext.h"
 
-string lyx::getUserName()
+string const lyx::getUserName()
 {
        string userName(GetEnv("LOGNAME"));
        if (userName.empty())
index 1c90c07598a7fcab7d55af0299044376cf6be1d9..020a1abf2db852e3c044168c15c790bafcb890f0 100644 (file)
 #include <cstring>
 #include <cctype>
 
+#if 0
 #ifdef HAVE_SSTREAM
 #include <sstream>
 #else
 #include <strstream>
 #endif
+#else
+#include "Lsstream.h"
+#endif
 
 #include "LString.h"
 
@@ -74,25 +78,26 @@ template<typename T>
 inline
 string const tostr(T const & t) 
 {
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
        std::ostringstream ostr;
        ostr << t;
        return ostr.str().c_str();
        // We need to use the .c_str since we sometimes are using
        // our own string class and that is not compatible with
        // basic_string<char>. (of course we don't want this later)
-#else
+//#else
        // The buf is probably a bit large, but if we want to be safer
        // we should leave it this big. As compiler/libs gets updated
        // this part of the code will cease to be used and we loose
        // nothing.
-       char buf[2048]; // a bit too large perhaps?
-       ostrstream ostr(buf, sizeof(buf));
-       ostr << t << '\0';
-       return buf;
-#endif
+//     char buf[2048]; // a bit too large perhaps?
+//     ostrstream ostr(buf, sizeof(buf));
+//     ostr << t << '\0';
+//     return buf;
+//#endif
 }
 
+
 ///
 inline
 string const tostr(bool b)
index b14fe84dd547a2e312d39ef3c861edd9eaeed0be..e7fd1c55a77dc43c59b065e94f72ceb99da8d02b 100644 (file)
@@ -29,13 +29,13 @@ namespace lyx {
        /// Returns false it it fails
        bool rename(char const * from, char const * to);
        /// Returns false it it fails
-       bool copy(char const * from, char const * to);
+       bool copy(string const & from, string const & to);
        /// generates a checksum
        unsigned long sum(char const * file);
        /// returns a date string (not used currently)
        char * date(); 
        /// returns the name of the user (not used currently)
-       string getUserName();
+       string const getUserName();
        ///
        int kill(long int pid, int sig);
        ///
@@ -55,13 +55,13 @@ struct lyx {
        /// Returns false it it fails
        static bool rename(char const * from, char const * to);
        /// Returns false it it fails
-       static bool copy(char const * from, char const * to);
+       static bool copy(string const & from, string const & to);
        /// generates a checksum
        static unsigned long sum(char const * file);
        /// returns a date string (not used currently)
        static char * date(); 
        /// returns the name of the user (not used currently)
-       static string getUserName();
+       static string const getUserName();
        ///
        static int kill(long int pid, int sig);
        ///
index d247be4b7fbec7b5882055602625cfe2cca53631..1e3b542a6d7c58e9734eaeb7720a12d03dba48d8 100644 (file)
@@ -1317,7 +1317,7 @@ lyxstring & lyxstring::replace(size_type i, size_type n, value_type const * p)
 lyxstring & lyxstring::replace(size_type i, size_type n,
                               size_type n2, value_type c)
 {
-       Assert(i < rep->sz);  // OURS!
+       Assert(i <= rep->sz);  // OURS!
        TestlyxstringInvariant(this);
 
        rep = rep->get_own_copy();
index fbf532d34daadae856b2ad3995102649b28f36cd..a0efb5d1b755847b1092c7260d5beeef90b33401 100644 (file)
 
 #include <fstream>
 
+#if 0
 #ifdef HAVE_SSTREAM
 #include <sstream>
 using std::ostringstream;
 #else
 #include <strstream>
 #endif
+#else
+#include "Lsstream.h"
+#endif
 
 #include "support/lyxlib.h"
 
@@ -116,22 +120,22 @@ unsigned long lyx::sum(char const * file)
        ifstream ifs(file);
        if (!ifs) return 0;
        ifs.unsetf(ios::skipws);
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
        ostringstream ostr;
        ostr << ifs.rdbuf();
        // The .c_str() is here in case we use our lyxstring class
        // instead of standard string. 
        string w = ostr.str().c_str();
        return do_crc(w.begin(), w.end());
-#else
-       ostrstream ostr;
-       ostr << ifs.rdbuf();
-       ostr << '\0';
-       char * tmp = ostr.str();
-       if (!tmp) return 0; // empty file
-       string w(tmp, ostr.tellp());
-       unsigned long crc = do_crc(w.begin(), w.end());
-       delete tmp;
-       return crc;
-#endif
+//#else
+//     ostrstream ostr;
+//     ostr << ifs.rdbuf();
+//     ostr << '\0';
+//     char * tmp = ostr.str();
+//     if (!tmp) return 0; // empty file
+//     string w(tmp, ostr.tellp());
+//     unsigned long crc = do_crc(w.begin(), w.end());
+//     delete tmp;
+//     return crc;
+//#endif
 }
diff --git a/src/support/sstream.h b/src/support/sstream.h
new file mode 100644 (file)
index 0000000..2d11caa
--- /dev/null
@@ -0,0 +1,236 @@
+/* This is part of libio/iostream, providing -*- C++ -*- input/output.
+Copyright (C) 2000 Free Software Foundation
+
+This file is part of the GNU IO Library.  This library is free
+software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this library; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+As a special exception, if you link this library with files
+compiled with a GNU compiler to produce an executable, this does not cause
+the resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why
+the executable file might be covered by the GNU General Public License. */
+
+/* Written by Magnus Fromreide (magfr@lysator.liu.se). */
+
+/* Sligtly modified for use in The LyX Project.
+   Made to be usable with both std::string (as supplied with Gcc 2.95.2),
+   and with lyxstring. Dynamic casts have been replaced by static_casts.
+   One fix to avoid unsigned/signed warnings.
+
+   Some further changes might be needed to avoid use of namespaces.
+
+   Lars Gullik Bjønnes (larsbj@lyx.org)
+*/
+
+#ifndef SSTREAM_H
+#define SSTREAM_H
+
+#include "LString.h"
+#include <iostream>
+#include <streambuf.h>
+
+namespace std
+{
+  class stringbuf : public streambuf
+  {
+  public:
+    typedef char       char_type;
+    typedef int                int_type;
+    typedef streampos  pos_type;
+    typedef streamoff  off_type;
+
+    explicit stringbuf(int which=ios::in|ios::out) :
+      streambuf(which), buf(), mode(static_cast<ios::open_mode>(which)),
+      rpos(0), bufsize(1)
+    { }
+       
+    explicit stringbuf(const string &s, int which=ios::in|ios::out) :
+      streambuf(which), buf(s), mode(static_cast<ios::open_mode>(which)),
+      bufsize(1)
+    {
+      if(mode & ios::in)
+       {
+         setg(&defbuf, &defbuf + bufsize, &defbuf + bufsize);
+       }
+      if(mode & ios::out)
+       {
+         setp(&defbuf, &defbuf + bufsize);
+       }
+      rpos = (mode & ios::ate ? s.size() : 0);
+    }
+       
+    string str() const
+    {
+      const_cast<stringbuf*>(this)->sync();  // Sigh, really ugly hack
+      return buf;
+    };
+
+    void str(const string& s)
+    {
+      buf = s;
+      if(mode & ios::in)
+       {
+         gbump(egptr() - gptr());
+       }
+      if(mode & ios::out)
+       {
+         pbump(pbase() - pptr());
+       }
+      rpos = (mode & ios::ate ? s.size() : 0);
+    }
+
+  protected:
+    inline virtual int sync();
+    inline virtual int overflow(int = EOF);
+    inline virtual int underflow();
+  private:
+    string                     buf;
+    ios::open_mode             mode;
+    string::size_type  rpos;
+    streamsize                 bufsize;
+    char                       defbuf;
+  };
+
+  class stringstreambase : virtual public ios {
+  protected:
+    stringbuf __my_sb;
+  public:
+    string str() const
+    {
+      return static_cast<stringbuf*>(_strbuf)->str();
+    }
+    void str(const string& s)
+    {
+      clear();
+      static_cast<stringbuf*>(_strbuf)->str(s);
+    }
+       
+    stringbuf* rdbuf()
+    {
+      return &__my_sb;
+    }
+  protected:
+    stringstreambase(int which) :
+      __my_sb(which)
+    {
+      init (&__my_sb);
+    }
+       
+    stringstreambase(const string& s, int which) :
+      __my_sb(s, which)
+    {
+      init (&__my_sb);
+    }
+  };
+    
+  class istringstream : public stringstreambase, public istream {
+  public:
+    istringstream(int which=ios::in) :
+      stringstreambase(which)
+    { }
+       
+    istringstream(const string& s, int which=ios::in) :
+      stringstreambase(s, which)
+    { }
+  };
+    
+  class ostringstream : public stringstreambase, public ostream {
+  public:
+    ostringstream(int which=ios::out) :
+      stringstreambase(which)
+    { }
+       
+    ostringstream(const string& s, int which=ios::out) :
+      stringstreambase(s, which)
+    { }
+  };
+    
+  class stringstream : public stringstreambase, public iostream {
+  public:
+    stringstream(int which=ios::in|ios::out) :
+      stringstreambase(which)
+    { }
+    
+    stringstream(const string &s, int which=ios::in|ios::out) :
+      stringstreambase(s, which)
+    { }
+  };
+}
+
+inline int stringbuf::sync()
+{
+  if((mode & ios::out) == 0)
+    return EOF;
+
+  streamsize n = pptr() - pbase();
+  if(n)
+    {
+      buf.replace(rpos, string::npos, pbase(), n);
+      //if(buf.size() - rpos != n)
+      if (buf.size() != n + rpos)
+       return EOF;
+      rpos += n;
+      pbump(-n);
+      gbump(egptr() - gptr());
+    }
+  return 0;
+}
+
+inline int stringbuf::overflow(int ch)
+{
+  if((mode & ios::out) == 0)
+    return EOF;
+
+  streamsize n = pptr() - pbase();
+
+  if(n && sync())
+    return EOF;
+
+  if(ch != EOF)
+    {
+      string::size_type oldSize = buf.size();
+      
+      buf.replace(rpos, string::npos, 1, ch);
+      if(buf.size() - oldSize != 1)
+       return EOF;
+      ++rpos;
+    }
+  return 0;
+}
+
+inline int stringbuf::underflow()
+{
+  sync();
+  if((mode & ios::in) == 0)
+    {
+      return EOF;
+    }
+  if(rpos >= buf.size())
+    {
+      return EOF;
+    }
+  
+  string::size_type n = egptr() - eback();
+  string::size_type s;
+
+  s = buf.copy(eback(), n, rpos);
+  pbump(pbase() - pptr());
+  gbump(eback() - gptr());
+  int res = (0377 & buf[rpos]);
+  rpos += s;
+  return res;
+}
+
+#endif /* not __STRSTREAM__ */
index 0668dd5351326de7e9c225dcf3be7b5d5f17247a..4aa51cece7da1f84fdfb4d93aa5f767e63e7450a 100644 (file)
@@ -31,10 +31,14 @@ class Systemcalls {
 public:
        ///
        enum Starttype {
-               System, // Uses system() which uses /bin/sh
-               SystemDontWait, // Uses system() which uses /bin/sh
-               Wait, // Uses fork() and execvp()
-               DontWait // Uses fork() and execvp()
+               /// Uses system() which uses /bin/sh
+               System,
+               /// Uses system() which uses /bin/sh
+               SystemDontWait,
+               /// Uses fork() and execvp()
+               Wait,
+               /// Uses fork() and execvp()
+               DontWait
        };
        
        /// Callback function gets commandline and return value from child
@@ -44,27 +48,29 @@ public:
        Systemcalls();
        
        /** Generate instance and start child process.
-         The string "what" contains a commandline with arguments separated 
-         by spaces.
-         When the requested program finishes, the callback-function is 
-         called with the commandline and the return value from the program.
-         The instance is automatically added to a timer check if starttype 
-         is DontWait (i.e. background execution). When a background child
-         finishes, the timer check will automatically call the callback
-         function.
-         */
+           The string "what" contains a commandline with arguments separated 
+           by spaces.
+           When the requested program finishes, the callback-function is 
+           called with the commandline and the return value from the program.
+           The instance is automatically added to a timer check if starttype 
+           is DontWait (i.e. background execution). When a background child
+           finishes, the timer check will automatically call the callback
+           function.
+       */
        Systemcalls(Starttype how, string const & what, Callbackfct call = 0);
        
        ///
        ~Systemcalls();
        
        /** Start childprocess. "what" contains a command at system level.
-        * This is for reuse of the Systemcalls instance.
-        */
+           This is for reuse of the Systemcalls instance.
+       */
        int startscript(Starttype how, string const & what, 
                        Callbackfct call = 0);
        
-       /** gets PID of childprocess. Used by timer */
+       /** gets PID of childprocess.
+           Used by timer
+       */
        pid_t getpid() { return pid; }
        
        /// Start callback
@@ -74,10 +80,10 @@ public:
        void setRetValue(int r) { retval = r; }
 
        /** Kill child prematurely.
-       First, a SIGHUP is sent to the child.
-       If that does not end the child process within "tolerance"
-       seconds, the SIGKILL signal is sent to the child.
-       When the child is dead, the callback is called.
+           First, a SIGHUP is sent to the child.
+           If that does not end the child process within "tolerance"
+           seconds, the SIGKILL signal is sent to the child.
+           When the child is dead, the callback is called.
        */
        void kill(int tolerance = 5);
 private:
index 5de04c8e65b9e1069810400fbc9fef2c3cb4e9ba..07437636c3a6187a2d786718bf2736861fb18104 100644 (file)
@@ -9,27 +9,42 @@
 
 class Systemcalls;
 
+///
 class SystemcallsSingletoncontroller {
 public:
+       ///
        class Startcontroller {
        public:
+               ///
                Startcontroller();
+               ///
                 ~Startcontroller();
+               ///
                static SystemcallsSingletoncontroller * getController();
+               ///
                 void reduceRefcount() { --refcount; }
        private:
+               ///
                static SystemcallsSingletoncontroller * contr;
+               ///
                 static int refcount;
         };
+       ///
        ~SystemcallsSingletoncontroller();
+       ///
        void addCall(Systemcalls const & newcall);
+       ///
        void timer();
-       // private: // DEC cxx does not like that (JMarc)
+       /// private: // DEC cxx does not like that (JMarc)
        SystemcallsSingletoncontroller();
 private:
+       ///
        struct ControlledCalls {
-               Systemcalls *call;
-               ControlledCalls *next; 
+               ///
+               Systemcalls * call;
+               ///
+               ControlledCalls * next; 
        };
+       ///
        ControlledCalls * sysCalls;
 };
index e54a6aedb1a932b1e2cffc80f9e851882efa4bb5..20dd4d7751857990ae615e9882fba02b03ea6ddf 100644 (file)
 
 #include <cctype>
 
-//
+///
 inline
 bool IsNewlineChar(char c) {
        return (c == LyXParagraph::META_NEWLINE);
 }
 
 
-//
+///
 inline
 bool IsSeparatorChar(char c) {
        return (c == ' ');
 }
 
 
-//
+///
 inline
 bool IsHfillChar(char c) {
        return (c == LyXParagraph::META_HFILL);
 }
 
 
-//
+///
 inline
 bool IsInsetChar(char c) {
        return (c == LyXParagraph::META_INSET);
@@ -43,7 +43,7 @@ bool IsInsetChar(char c) {
 
 
 #ifndef NEW_INSETS
-//
+///
 inline
 bool IsFloatChar(char c) {
        return (c == LyXParagraph::META_FOOTNOTE
@@ -57,14 +57,14 @@ bool IsFloatChar(char c) {
 #endif
 
 
-//
+///
 inline
 bool IsLineSeparatorChar(char c) {
        return (c == ' ');
 }
 
 
-//
+///
 inline
 bool IsKommaChar(char c) {
        return (c == ',' 
@@ -95,7 +95,7 @@ bool IsKommaChar(char c) {
 }
 
 
-//
+///
 inline
 bool IsLetterChar(unsigned char c) {
        return ((c >= 'A' && c <= 'Z')
@@ -104,21 +104,21 @@ bool IsLetterChar(unsigned char c) {
 }
 
 
-//
+///
 inline
 bool IsPrintable(unsigned char c) {
        return (c >= ' ');
 }
 
 
-//
+///
 inline
 bool IsPrintableNonspace(unsigned char c) {
        return (c > ' ');
 }
 
 
-// Word is not IsSeparator or IsKomma or IsHfill or IsFloat or IsInset. 
+/// Word is not IsSeparator or IsKomma or IsHfill or IsFloat or IsInset. 
 inline
 bool IsWordChar(unsigned char c) {
        return !( IsSeparatorChar( c )
@@ -131,7 +131,7 @@ bool IsWordChar(unsigned char c) {
 }
 
 
-//
+///
 inline
 bool IsLetterCharOrDigit(char ch)
 {
index 9e9fb154493d7f5943765596bb832a5559b62634..c138391658121721d8a7033c73439c50e3a25ed4 100644 (file)
 #include "support/LAssert.h"
 
 // Functors used in the template.
+
+///
 template<typename T1, typename T2>
 class equal_1st_in_pair {
 public:
-    equal_1st_in_pair(T1 const & value) : value_(value) {}
-
-    typedef std::pair<T1, T2> pair_type;
-    bool operator() (pair_type const & p) const {
-        return p.first == value_;
-    }
+       ///
+       equal_1st_in_pair(T1 const & value) : value_(value) {}
+       ///
+       typedef std::pair<T1, T2> pair_type;
+       ///
+       bool operator() (pair_type const & p) const {
+               return p.first == value_;
+       }
 private:
-    T1 const & value_;
+       ///
+       T1 const & value_;
 };
 
+
+///
 template<typename T1, typename T2>
 class equal_2nd_in_pair {
 public:
-    equal_2nd_in_pair(T2 const & value) : value_(value) {}
-
-    typedef std::pair<T1, T2> pair_type;
-    bool operator() (pair_type const & p) const {
-        return p.second == value_;
-    }
+       ///
+       equal_2nd_in_pair(T2 const & value) : value_(value) {}
+       ///
+       typedef std::pair<T1, T2> pair_type;
+       ///
+       bool operator() (pair_type const & p) const {
+               return p.second == value_;
+       }
 private:
-    T2 const & value_;
+       ///
+       T2 const & value_;
 };
 
-/** This class template is used to translate between two elements, specifically
- * it was worked out to translate between an enum and strings when reading
- * the lyx file.
- *
- * The two template arguments should be of different types.
- */
 
+/** This class template is used to translate between two elements, specifically
+    it was worked out to translate between an enum and strings when reading
+    the lyx file.
+    
+    The two template arguments should be of different types.
+*/
 template<typename T1, typename T2>
 class Translator {
 public:
-    typedef T1 first_argument_type;
-    typedef T2 second_argument_type;
-    typedef std::pair<T1, T2> MapPair;
-    typedef std::vector<MapPair> Map;
-
-    /// c-tor.
-    Translator(T1 const & t1, T2 const & t2) 
-        : default_t1(t1), default_t2(t2) 
-        {}
-
-    /// Add a mapping to the translator.
-    void addPair(T1 const & first, T2 const & second) {
-        map.push_back(MapPair(first, second));
-    }
-
-    /// Find the mapping for the first argument
-    T2 const & find(T1 const & first) const {
-        Assert( ! map.empty());
-
-        // For explanation see the next find() function.
-        Map::const_iterator it =
-            std::find_if(map.begin(), map.end(),
-                    equal_1st_in_pair<T1, T2>(first)
-                        );
-
-        if (it != map.end())
-            return (*it).second;
-        else {
-            return default_t2;
-        }
-    }
-
-    /// Find the mapping for the second argument
-    T1 const & find(T2 const & second) const {
-        Assert( ! map.empty());
-
-        // The idea is as follows:
-        // find_if() will try to compare the data in the vector with the value.
-        // The vector is made of pairs and the value has the type of the
-        // second part of the pair. 
-        // We thus give find_if() an equal_to functor and assign to its second
-        // post the value we want to compare. We now compose the equal_to 
-        // functor with the select2nd functor to take only the second value
-        // of the pair to be compared.
-        //
-        // We can depict it as follows:
-        // equal_to( select2nd(pair) , second)
-        Map::const_iterator it =
-            std::find_if(map.begin(), map.end(),
-                    equal_2nd_in_pair<T1, T2>(second)
-                        );
-
-        if (it != map.end())
-            return (*it).first;
-        else {
-            return default_t1;
-        }
-    }
-
+       ///
+       typedef T1 first_argument_type;
+       ///
+       typedef T2 second_argument_type;
+       ///
+       typedef std::pair<T1, T2> MapPair;
+       ///
+       typedef std::vector<MapPair> Map;
+       
+       ///
+       Translator(T1 const & t1, T2 const & t2) 
+               : default_t1(t1), default_t2(t2) 
+               {}
+       
+       /// Add a mapping to the translator.
+       void addPair(T1 const & first, T2 const & second) {
+               map.push_back(MapPair(first, second));
+       }
+       
+       /// Find the mapping for the first argument
+       T2 const & find(T1 const & first) const {
+               Assert(!map.empty());
+               
+               // For explanation see the next find() function.
+               Map::const_iterator it =
+                       std::find_if(map.begin(), map.end(),
+                                    equal_1st_in_pair<T1, T2>(first)
+                               );
+               
+               if (it != map.end()) {
+                       return (*it).second;
+               } else {
+                       return default_t2;
+               }
+       }
+       
+       /// Find the mapping for the second argument
+       T1 const & find(T2 const & second) const {
+               Assert(!map.empty());
+               
+               // The idea is as follows:
+               // find_if() will try to compare the data in the vector with
+               // the value. The vector is made of pairs and the value has
+               // the type of the second part of the pair. 
+               // We thus give find_if() an equal_to functor and assign to
+               // its second post the value we want to compare. We now
+               // compose the equal_to functor with the select2nd functor
+               // to take only the second value of the pair to be compared.
+               //
+               // We can depict it as follows:
+               // equal_to( select2nd(pair) , second)
+               Map::const_iterator it =
+                       std::find_if(map.begin(), map.end(),
+                                    equal_2nd_in_pair<T1, T2>(second)
+                               );
+               
+               if (it != map.end())
+                       return (*it).first;
+               else {
+                       return default_t1;
+               }
+       }
 private:
-    Map map;
-
-    T1 const default_t1;
-    T2 const default_t2;
+       ///
+       Map map;
+       ///
+       T1 const default_t1;
+       ///
+       T2 const default_t2;
 };
 
 #endif
index e9972a7e7bbc56f5053f885508dcf54246c3b549..2ed70275471e1b484358a818cdb2fff016585208 100644 (file)
@@ -85,7 +85,7 @@ LyXTable::rowstruct::~rowstruct()
 }
 
 LyXTable::rowstruct & 
-  LyXTable::rowstruct::operator=(rowstruct const & rs)
+LyXTable::rowstruct::operator=(rowstruct const & rs)
 {
        top_line = rs.top_line;
        bottom_line = rs.bottom_line;
@@ -109,7 +109,7 @@ LyXTable::columnstruct::~columnstruct()
 }
 
 LyXTable::columnstruct & 
-  LyXTable::columnstruct::operator=(columnstruct const & cs)
+LyXTable::columnstruct::operator=(columnstruct const & cs)
 {
         left_line = cs.left_line;
         right_line = cs.right_line;
index 68b93307c2e3ff88695c641823653ca9ad44c623..27c9b7c9a33cca503639145be04640217f08c084 100644 (file)
@@ -170,9 +170,9 @@ public:
     ///
     char GetAlignment(int cell); // add approp. signedness
     ///
-    string GetPWidth(int cell);
+    string const GetPWidth(int cell);
     ///
-    string GetAlignSpecial(int cell, int what);
+    string const GetAlignSpecial(int cell, int what);
     
     ///
     int GetWidthOfCell(int cell);
index 8077204d1c032c1e264fd4391beaec55d1bb4449..e29f37b40ba78a99812a30f482d2abd305f852f2 100644 (file)
@@ -94,7 +94,7 @@ LyXTabular::LyXTabular(InsetTabular * inset, LyXTabular const & lt)
 {
     owner_ = inset;
     Init(lt.rows_, lt.columns_);
-    
+#warning Jürgen, can you make it the other way round. So that copy assignment depends on the copy constructor and not the other way. (Lgb)
     operator=(lt);
 }
 
@@ -142,13 +142,10 @@ LyXTabular & LyXTabular::operator=(LyXTabular const & lt)
 LyXTabular * LyXTabular::Clone(InsetTabular * inset)
 {
     LyXTabular * result = new LyXTabular(inset, *this);
-    ///
     // don't know if this is good but I need to Clone also
     // the text-insets here, this is for the Undo-facility!
-    ///
-    int i,j;
-    for(i=0; i < rows_; ++i) {
-       for(j=0; j < columns_; ++j) {
+    for(int i = 0; i < rows_; ++i) {
+       for(int j = 0; j < columns_; ++j) {
            result->cell_info[i][j].inset = cell_info[i][j].inset;
            result->cell_info[i][j].inset.setOwner(inset);
        }
@@ -160,8 +157,6 @@ LyXTabular * LyXTabular::Clone(InsetTabular * inset)
 /* activates all lines and sets all widths to 0 */ 
 void LyXTabular::Init(int rows_arg, int columns_arg)
 {
-    int i, j;
-    int cellno = 0;
 
     rows_ = rows_arg;
     columns_ = columns_arg;
@@ -171,20 +166,22 @@ void LyXTabular::Init(int rows_arg, int columns_arg)
            (rows_, vector<cellstruct>(columns_, cellstruct()));
 
     // Jürgen, use iterators.
-    for (i = 0; i < rows_; ++i) {
-        for (j = 0; j < columns_; ++j) {
+    int cellno = 0;
+    int i = 0;
+    for (; i < rows_; ++i) {
+        for (int j = 0; j < columns_; ++j) {
            cell_info[i][j].inset.setOwner(owner_);
            cell_info[i][j].inset.SetDrawFrame(0, InsetText::LOCKED);
             cell_info[i][j].cellno = cellno++;
         }
     }
-    row_info[i-1].bottom_line = true;
+    row_info[i - 1].bottom_line = true;
     row_info[0].bottom_line = true;
 
     for (i = 0; i < columns_; ++i) {
         calculate_width_of_column(i);
     }
-    column_info[columns_-1].right_line = true;
+    column_info[columns_ - 1].right_line = true;
    
     calculate_width_of_tabular();
 
@@ -221,7 +218,7 @@ void LyXTabular::AppendRow(int cell )
            c_info[i][j] = cell_info[i][j];
        }
     }
-    for(int i = row+1; i < rows_; ++i) {
+    for(int i = row + 1; i < rows_; ++i) {
        for(int j = 0; j < columns_; ++j) {
            c_info[i][j] = cell_info[i-1][j];
        }
@@ -254,29 +251,28 @@ void LyXTabular::AppendColumn(int cell)
     cell_vvector c_info = cell_vvector(rows_, cell_vector(columns_,
                                                          cellstruct()));
     int column = column_of_cell(cell);
-    int i, j;
     column_vector::iterator cit = column_info.begin() + column + 1;
     column_info.insert(cit, columnstruct());
 
-    for (i = 0; i < rows_; ++i) {
-        for (j = 0; j <= column; ++j) {
+    for (int i = 0; i < rows_; ++i) {
+        for (int j = 0; j <= column; ++j) {
             c_info[i][j] = cell_info[i][j];
         }
-        for (j = column+1; j < columns_; ++j) {
-            c_info[i][j] = cell_info[i][j-1];
+        for (int j = column + 1; j < columns_; ++j) {
+            c_info[i][j] = cell_info[i][j - 1];
         }
         // care about multicolumns
-        if (cell_info[i][column+1].multicolumn == CELL_BEGIN_OF_MULTICOLUMN) {
-            cell_info[i][column+1].multicolumn = CELL_PART_OF_MULTICOLUMN;
+        if (cell_info[i][column + 1].multicolumn == CELL_BEGIN_OF_MULTICOLUMN) {
+            cell_info[i][column + 1].multicolumn = CELL_PART_OF_MULTICOLUMN;
         }
-        if (((column+1) == columns_) ||
-            (cell_info[i][column+2].multicolumn != CELL_PART_OF_MULTICOLUMN)) {
-            cell_info[i][column+1].multicolumn = LyXTabular::CELL_NORMAL;
+        if ((column + 1) == columns_ ||
+            cell_info[i][column + 2].multicolumn != CELL_PART_OF_MULTICOLUMN) {
+            cell_info[i][column + 1].multicolumn = LyXTabular::CELL_NORMAL;
         }
     }
     cell_info = c_info;
     ++column;
-    for (i = 0; i < rows_; ++i) {
+    for (int i = 0; i < rows_; ++i) {
        cell_info[i][column].inset.clear();
     }
     Reinit();
@@ -298,19 +294,15 @@ void LyXTabular::DeleteColumn(int column)
 
 void LyXTabular::Reinit()
 {   
-    int j;
-
-    int i = 0;
-
     // Jürgen, use iterators.
-    for (; i < rows_; ++i) {
-       for (j = 0; j < columns_; ++j) {
+    for (int i = 0; i < rows_; ++i) {
+       for (int j = 0; j < columns_; ++j) {
            cell_info[i][j].width_of_cell = 0;
            cell_info[i][j].inset.setOwner(owner_);
        }
     }
   
-    for (i = 0; i < columns_; ++i) {
+    for (int i = 0; i < columns_; ++i) {
        calculate_width_of_column(i);
     }
     calculate_width_of_tabular();
@@ -474,9 +466,8 @@ int LyXTabular::GetAdditionalHeight(int cell) const
        
     int top = 1; // bool top = true; ??
     int bottom = 1; // bool bottom = true; ??
-    int column;
 
-    for (column = 0; column < columns_ - 1 && bottom; ++column) {
+    for (int column = 0; column < columns_ - 1 && bottom; ++column) {
        switch (cell_info[row - 1][column].multicolumn) {
        case LyXTabular::CELL_BEGIN_OF_MULTICOLUMN:
            bottom = cell_info[row - 1][column].bottom_line;
@@ -485,7 +476,7 @@ int LyXTabular::GetAdditionalHeight(int cell) const
            bottom = row_info[row - 1].bottom_line;
        }
     }
-    for (column = 0; column < columns_ - 1 && top; ++column) {
+    for (int column = 0; column < columns_ - 1 && top; ++column) {
        switch (cell_info[row][column].multicolumn){
        case LyXTabular::CELL_BEGIN_OF_MULTICOLUMN:
            top = cell_info[row][column].top_line;
@@ -516,8 +507,8 @@ int LyXTabular::GetAdditionalWidth(int cell) const
 // returns the maximum over all rows 
 int LyXTabular::GetWidthOfColumn(int cell) const
 {
-    int column1 = column_of_cell(cell);
-    int column2 = right_column_of_cell(cell);
+    int const column1 = column_of_cell(cell);
+    int const column2 = right_column_of_cell(cell);
     int result = 0;
     int i = column1;
     for (; i <= column2; ++i) {
@@ -539,9 +530,9 @@ bool LyXTabular::SetWidthOfMulticolCell(int cell, int new_width)
     if (!IsMultiColumn(cell))
         return false;
     
-    int row = row_of_cell(cell);
-    int column1 = column_of_cell(cell);
-    int column2 = right_column_of_cell(cell);
+    int const row = row_of_cell(cell);
+    int const column1 = column_of_cell(cell);
+    int const column2 = right_column_of_cell(cell);
 
     // first set columns to 0 so we can calculate the right width
     int i = column1;
@@ -565,9 +556,9 @@ bool LyXTabular::SetWidthOfMulticolCell(int cell, int new_width)
 
 void LyXTabular::recalculateMulticolCells(int cell, int new_width)
 {
-    int row = row_of_cell(cell);
-    int column1 = column_of_cell(cell);
-    int column2 = right_column_of_cell(cell);
+    int const row = row_of_cell(cell);
+    int const column1 = column_of_cell(cell);
+    int const column2 = right_column_of_cell(cell);
 
     // first set columns to 0 so we can calculate the right width
     int i = column1;
@@ -584,8 +575,8 @@ void LyXTabular::recalculateMulticolCells(int cell, int new_width)
 /* returns 1 if a complete update is necessary, otherwise 0 */ 
 bool LyXTabular::SetWidthOfCell(int cell, int new_width)
 {
-    int row = row_of_cell(cell);
-    int column1 = column_of_cell(cell);
+    int const row = row_of_cell(cell);
+    int const column1 = column_of_cell(cell);
     bool tmp = false;
     int width = 0;
 
@@ -602,14 +593,14 @@ bool LyXTabular::SetWidthOfCell(int cell, int new_width)
         tmp = calculate_width_of_column_NMC(column1);
     }
     if (tmp) {
-        int i;
-        for(i = 0; i<columns_;++i)
+        int i = 0;
+        for(; i<columns_; ++i)
             calculate_width_of_column_NMC(i);
-        for(i = 0; (i<numberofcells) && !IsMultiColumn(i); ++i)
+        for(i = 0; (i < numberofcells) && !IsMultiColumn(i); ++i)
             ;
-        if (i<numberofcells)
+        if (i < numberofcells)
             recalculateMulticolCells(i, GetWidthOfCell(i)-(2*WIDTH_OF_LINE));
-        for(i = 0; i<columns_;++i)
+        for(i = 0; i < columns_; ++i)
             calculate_width_of_column(i);
         calculate_width_of_tabular();
         return true;
@@ -641,14 +632,13 @@ bool LyXTabular::SetVAlignment(int cell, char align, bool onlycolumn)
 bool LyXTabular::SetColumnPWidth(int cell, string const & width)
 {
     bool flag = !width.empty();
+    int const j = column_of_cell(cell);
 
-    int j = column_of_cell(cell);
-    int c;
     column_info[j].p_width = width;
     if (flag) // do this only if there is a width
        SetAlignment(cell, LYX_ALIGN_LEFT);
-    for(int i=0; i < rows_; ++i) {
-       c = GetCellNumber(i, j);
+    for(int i = 0; i < rows_; ++i) {
+       int c = GetCellNumber(i, j);
        flag = !GetPWidth(c).empty(); // because of multicolumns!
        GetCellInset(c)->SetAutoBreakRows(flag);
     }
@@ -658,7 +648,7 @@ bool LyXTabular::SetColumnPWidth(int cell, string const & width)
 
 bool LyXTabular::SetMColumnPWidth(int cell, string const & width)
 {
-    bool flag = !width.empty();
+    bool const flag = !width.empty();
 
     cellinfo_of_cell(cell)->p_width = width;
     if (IsMultiColumn(cell)) {
@@ -691,7 +681,7 @@ bool LyXTabular::SetAllLines(int cell, bool line)
 
 bool LyXTabular::SetTopLine(int cell, bool line, bool onlycolumn)
 {
-    int row = row_of_cell(cell);
+    int const row = row_of_cell(cell);
 
     if (onlycolumn || !IsMultiColumn(cell))
         row_info[row].top_line = line;
@@ -749,7 +739,7 @@ char LyXTabular::GetVAlignment(int cell, bool onlycolumn) const
 }
 
 
-string LyXTabular::GetPWidth(int cell) const
+string const LyXTabular::GetPWidth(int cell) const
 {
     if (IsMultiColumn(cell))
        return cellinfo_of_cell(cell)->p_width;
@@ -757,13 +747,13 @@ string LyXTabular::GetPWidth(int cell) const
 }
 
 
-string LyXTabular::GetColumnPWidth(int cell) const
+string const LyXTabular::GetColumnPWidth(int cell) const
 {
     return column_info[column_of_cell(cell)].p_width;
 }
 
 
-string LyXTabular::GetMColumnPWidth(int cell) const
+string const LyXTabular::GetMColumnPWidth(int cell) const
 {
     if (IsMultiColumn(cell))
        return cellinfo_of_cell(cell)->p_width;
@@ -771,7 +761,7 @@ string LyXTabular::GetMColumnPWidth(int cell) const
 }
 
 
-string LyXTabular::GetAlignSpecial(int cell, int what) const
+string const LyXTabular::GetAlignSpecial(int cell, int what) const
 {
     if (what == SET_SPECIAL_MULTI)
         return cellinfo_of_cell(cell)->align_special;
@@ -781,12 +771,11 @@ string LyXTabular::GetAlignSpecial(int cell, int what) const
 
 int LyXTabular::GetWidthOfCell(int cell) const
 {
-    int row = row_of_cell(cell);
-    int column1 = column_of_cell(cell);
-    int column2 = right_column_of_cell(cell);
+    int const row = row_of_cell(cell);
+    int const column1 = column_of_cell(cell);
+    int const column2 = right_column_of_cell(cell);
     int result = 0;
-    int i = column1;
-    for (; i <= column2; ++i) {
+    for (int i = column1; i <= column2; ++i) {
        result += cell_info[row][i].width_of_cell;
     }
     return result;
@@ -843,7 +832,7 @@ int LyXTabular::GetLastCellInRow(int row) const
 
 bool LyXTabular::calculate_width_of_column(int column)
 {
-    int old_column_width = column_info[column].width_of_column;
+    int const old_column_width = column_info[column].width_of_column;
     int maximum = 0;
     
     for (int i = 0; i < rows_; ++i) {
@@ -854,13 +843,13 @@ bool LyXTabular::calculate_width_of_column(int column)
 }
 
 
-///
-/// calculate the with of the column without regarding REAL MultiColumn
-/// cells. This means MultiColumn-cells spanning more than 1 column.
-///
+//
+// calculate the with of the column without regarding REAL MultiColumn
+// cells. This means MultiColumn-cells spanning more than 1 column.
+//
 bool LyXTabular::calculate_width_of_column_NMC(int column)
 {
-    int old_column_width = column_info[column].width_of_column;
+    int const old_column_width = column_info[column].width_of_column;
     int max = 0;
     for (int i = 0; i < rows_; ++i) {
         if (!IsMultiColumn(GetCellNumber(i, column), true) &&
@@ -904,7 +893,7 @@ int LyXTabular::column_of_cell(int cell) const
 
 int LyXTabular::right_column_of_cell(int cell) const
 {
-    int row = row_of_cell(cell);
+    int const row = row_of_cell(cell);
     int column = column_of_cell(cell);
     while (column < (columns_ - 1) &&
           cell_info[row][column+1].multicolumn == LyXTabular::CELL_PART_OF_MULTICOLUMN)
@@ -915,8 +904,6 @@ int LyXTabular::right_column_of_cell(int cell) const
 
 void LyXTabular::Write(Buffer const * buf, ostream & os) const
 {
-    int i, j;
-
     // header line
     os << "<LyXTabular version=1 rows=" << rows_ << " columns=" << columns_ <<
        ">" << endl;
@@ -926,12 +913,12 @@ void LyXTabular::Write(Buffer const * buf, ostream & os) const
        " endhead=" << endhead << " endfirsthead=" << endfirsthead <<
        " endfoot=" << endfoot << " endlastfoot=" << endlastfoot <<
        ">" << endl << endl;
-    for (i = 0; i < rows_; ++i) {
+    for (int i = 0; i < rows_; ++i) {
        os << "<Row topline=" << row_info[i].top_line <<
            " bottomline=" << row_info[i].bottom_line <<
            " newpage=" << row_info[i].newpage <<
            ">" << endl;
-       for (j = 0; j < columns_; ++j) {
+       for (int j = 0; j < columns_; ++j) {
            if (!i) {
                os << "<Column alignment=" << column_info[j].alignment <<
                    " valignment=" << column_info[j].valignment <<
@@ -1041,6 +1028,7 @@ bool getTokenValue(string const str, const char * token, bool & flag)
 }
 
 
+static inline
 void l_getline(istream & is, string & str)
 {
     getline(is, str);
@@ -1076,11 +1064,11 @@ void LyXTabular::Read(Buffer const * buf, LyXLex & lex)
            line << ")" << endl;
        return;
     }
-    (void)getTokenValue(line, "islongtable", is_long_tabular);
-    (void)getTokenValue(line, "endhead", endhead);
-    (void)getTokenValue(line, "endfirsthead", endfirsthead);
-    (void)getTokenValue(line, "endfoot", endfoot);
-    (void)getTokenValue(line, "endlastfoot", endlastfoot);
+    getTokenValue(line, "islongtable", is_long_tabular);
+    getTokenValue(line, "endhead", endhead);
+    getTokenValue(line, "endfirsthead", endfirsthead);
+    getTokenValue(line, "endfoot", endfoot);
+    getTokenValue(line, "endlastfoot", endlastfoot);
     int i, j;
     for(i = 0; i < rows_; ++i) {
        l_getline(is, line);
@@ -1089,9 +1077,9 @@ void LyXTabular::Read(Buffer const * buf, LyXLex & lex)
                line << ")" << endl;
            return;
        }
-       (void)getTokenValue(line, "topline", row_info[i].top_line);
-       (void)getTokenValue(line, "bottomline", row_info[i].bottom_line);
-       (void)getTokenValue(line, "newpage", row_info[i].newpage);
+       getTokenValue(line, "topline", row_info[i].top_line);
+       getTokenValue(line, "bottomline", row_info[i].bottom_line);
+       getTokenValue(line, "newpage", row_info[i].newpage);
        for (j = 0; j < columns_; ++j) {
            l_getline(is,line);
            if (!prefixIs(line,"<Column")) {
@@ -1100,12 +1088,12 @@ void LyXTabular::Read(Buffer const * buf, LyXLex & lex)
                return;
            }
            if (!i) {
-               (void)getTokenValue(line, "alignment", column_info[j].alignment);
-               (void)getTokenValue(line, "valignment", column_info[j].valignment);
-               (void)getTokenValue(line, "leftline", column_info[j].left_line);
-               (void)getTokenValue(line, "rightline", column_info[j].right_line);
-               (void)getTokenValue(line, "width", column_info[j].p_width);
-               (void)getTokenValue(line, "special", column_info[j].align_special);
+               getTokenValue(line, "alignment", column_info[j].alignment);
+               getTokenValue(line, "valignment", column_info[j].valignment);
+               getTokenValue(line, "leftline", column_info[j].left_line);
+               getTokenValue(line, "rightline", column_info[j].right_line);
+               getTokenValue(line, "width", column_info[j].p_width);
+               getTokenValue(line, "special", column_info[j].align_special);
            }
            l_getline(is, line);
            if (!prefixIs(line, "<Cell")) {
@@ -1113,17 +1101,17 @@ void LyXTabular::Read(Buffer const * buf, LyXLex & lex)
                    line << ")" << endl;
                return;
            }
-           (void)getTokenValue(line, "multicolumn", cell_info[i][j].multicolumn);
-           (void)getTokenValue(line, "alignment", cell_info[i][j].alignment);
-           (void)getTokenValue(line, "valignment", cell_info[i][j].valignment);
-           (void)getTokenValue(line, "topline", cell_info[i][j].top_line);
-           (void)getTokenValue(line, "bottomline", cell_info[i][j].bottom_line);
-           (void)getTokenValue(line, "leftline", cell_info[i][j].left_line);
-           (void)getTokenValue(line, "rightline", cell_info[i][j].right_line);
-           (void)getTokenValue(line, "rotate", cell_info[i][j].rotate);
-           (void)getTokenValue(line, "usebox", cell_info[i][j].usebox);
-           (void)getTokenValue(line, "width", cell_info[i][j].p_width);
-           (void)getTokenValue(line, "special", cell_info[i][j].align_special);
+           getTokenValue(line, "multicolumn", cell_info[i][j].multicolumn);
+           getTokenValue(line, "alignment", cell_info[i][j].alignment);
+           getTokenValue(line, "valignment", cell_info[i][j].valignment);
+           getTokenValue(line, "topline", cell_info[i][j].top_line);
+           getTokenValue(line, "bottomline", cell_info[i][j].bottom_line);
+           getTokenValue(line, "leftline", cell_info[i][j].left_line);
+           getTokenValue(line, "rightline", cell_info[i][j].right_line);
+           getTokenValue(line, "rotate", cell_info[i][j].rotate);
+           getTokenValue(line, "usebox", cell_info[i][j].usebox);
+           getTokenValue(line, "width", cell_info[i][j].p_width);
+           getTokenValue(line, "special", cell_info[i][j].align_special);
            l_getline(is, line);
            if (prefixIs(line, "\\begin_inset")) {
                cell_info[i][j].inset.Read(buf, lex);
@@ -1351,7 +1339,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
 }
 
 
-char const * LyXTabular::GetDocBookAlign(int cell, bool isColumn) const
+string const LyXTabular::GetDocBookAlign(int cell, bool isColumn) const
 {
        int i = isColumn ? cell : column_of_cell(cell);
        
@@ -1361,7 +1349,7 @@ char const * LyXTabular::GetDocBookAlign(int cell, bool isColumn) const
        //i = column_of_cell(cell);
     if (!isColumn && IsMultiColumn(cell)) {
        if (!cellinfo_of_cell(cell)->align_special.empty()) {
-           return cellinfo_of_cell(cell)->align_special.c_str();
+           return cellinfo_of_cell(cell)->align_special;
        } else {
            switch (GetAlignment(cell)) {
            case LYX_ALIGN_LEFT:
@@ -1374,7 +1362,7 @@ char const * LyXTabular::GetDocBookAlign(int cell, bool isColumn) const
        }
     } else {
        if (!column_info[i].align_special.empty()) {
-           return column_info[i].align_special.c_str();
+           return column_info[i].align_special;
        }
 #ifdef IGNORE_THIS_FOR_NOW
        else if (!column_info[i].p_width.empty()) {
@@ -1715,8 +1703,8 @@ int LyXTabular::GetUsebox(int cell) const
 
 void LyXTabular::SetLTHead(int cell, bool first)
 {
-    int row = row_of_cell(cell);
-    int val = (row+1) * (column_of_cell(cell)? 1:-1);
+    int const row = row_of_cell(cell);
+    int const val = (row+1) * (column_of_cell(cell)? 1:-1);
 
     if (first) {
         if (endfirsthead == val)
@@ -1752,8 +1740,8 @@ bool LyXTabular::GetRowOfLTFirstHead(int cell, int & row) const
 
 void LyXTabular::SetLTFoot(int cell, bool last)
 {
-    int row = row_of_cell(cell);
-    int val = (row + 1) * (column_of_cell(cell)? 1:-1);
+    int const row = row_of_cell(cell);
+    int const val = (row + 1) * (column_of_cell(cell)? 1:-1);
 
     if (last) {
         if (endlastfoot == val)
@@ -1777,6 +1765,7 @@ bool LyXTabular::GetRowOfLTFoot(int cell, int & row) const
     return (row_of_cell(cell) == (abs(endfoot)-1));
 }
 
+
 bool LyXTabular::GetRowOfLTLastFoot(int cell, int & row) const
 {
     row = endlastfoot;
@@ -1885,19 +1874,18 @@ int LyXTabular::TeXTopHLine(ostream & os, int row) const
 
 int LyXTabular::TeXBottomHLine(ostream & os, int row) const
 {
-    int fcell = GetFirstCellInRow(row);
-    int n = NumberOfCellsInRow(fcell) + fcell;
+    int const fcell = GetFirstCellInRow(row);
+    int const n = NumberOfCellsInRow(fcell) + fcell;
     int tmp = 0;
-    int i;
 
-    for (i = fcell; i < n; ++i) {
+    for (int i = fcell; i < n; ++i) {
        if (BottomLine(i))
            ++tmp;
     }
     if (tmp == (n-fcell)){
        os << "\\hline";
     } else {
-       for (i = fcell; i < n; ++i) {
+       for (int i = fcell; i < n; ++i) {
            if (BottomLine(i)) {
                os << "\\cline{"
                   << column_of_cell(i) + 1
@@ -2020,8 +2008,10 @@ int LyXTabular::TeXCellPostamble(ostream & os, int cell) const
 }
 
 
-int LyXTabular::Latex(Buffer const * buf, ostream & os, bool fragile, bool fp) const
+int LyXTabular::Latex(Buffer const * buf,
+                     ostream & os, bool fragile, bool fp) const
 {
+#warning Jürgen, this func should be split into more funcs (Lgb)
     int ret = 0;
     int i,j;
     int cell = 0;
@@ -2171,6 +2161,7 @@ InsetText * LyXTabular::GetCellInset(int cell) const
     return & cell_info[row_of_cell(cell)][column_of_cell(cell)].inset;
 }
 
+
 void LyXTabular::Validate(LaTeXFeatures & features) const
 {
     if (IsLongTabular())
index fb7a56f98e0b37251ad18e935e7a919ce7d5cbb6..3035110f6243cb4608c49cc7442e429f6667b373 100644 (file)
@@ -232,13 +232,13 @@ public:
     ///
     char GetVAlignment(int cell, bool onlycolumn = false) const;
     ///
-    string GetPWidth(int cell) const;
+    string const GetPWidth(int cell) const;
     ///
-    string GetColumnPWidth(int cell) const;
+    string const GetColumnPWidth(int cell) const;
     ///
-    string GetMColumnPWidth(int cell) const;
+    string const GetMColumnPWidth(int cell) const;
     ///
-    string GetAlignSpecial(int cell, int what) const;
+    string const GetAlignSpecial(int cell, int what) const;
     ///
     int GetWidthOfCell(int cell) const;
     ///
@@ -288,7 +288,7 @@ public:
     int RoffEndOfCell(std::ostream &, int cell);
 #endif
     ///
-    char const * GetDocBookAlign(int cell, bool isColumn = false) const;
+    string const  GetDocBookAlign(int cell, bool isColumn = false) const;
 
     ///
     bool IsMultiColumn(int cell, bool real = false) const;
@@ -485,6 +485,7 @@ private: //////////////////////////////////////////////////////////////////
     void set_row_column_number_info();
     /// Returns true if a complete update is necessary, otherwise false
     bool SetWidthOfMulticolCell(int cell, int new_width);
+    ///
     void recalculateMulticolCells(int cell, int new_width);
     /// Returns true if change
     bool calculate_width_of_column(int column);
index 841829b056e3807c5e69b1a74e06b43325946851..daf431477379fa61f7aa36ab63ebd0c38d2739d2 100644 (file)
@@ -97,11 +97,11 @@ struct tex_accent_struct {
        ///
        tex_accent accent;
        ///
-       char const *cmd;
+       char const * cmd;
        ///
-       char const *native;
+       char const * native;
        ///
-       char const *name;
+       char const * name;
        ///
        kb_action action;
 };
index 486f372eab7b0a0d4e2025f05543a826206ab5da..8d06300fdf233f385a1e1469596b6777d0e80e89 100644 (file)
@@ -37,9 +37,6 @@ extern char const * string_align[];
 // used all over. As it happens, that meant that these strings were included 
 // 27 times in the object file. (Asger)
 
-//
-// extern char const * tex_babel[];
-
 ///
 extern char const * tex_graphics[];
 
index d9bc6e6c983aedb8ae28e431dd7de721f5a221cb..b20ec72f7a5ce7009b8579fb13dbd2b1ab56462d 100644 (file)
@@ -3266,7 +3266,8 @@ bool LyXText::SelectWordWhenUnderCursor(BufferView * bview)
 
 // This function is only used by the spellchecker for NextWord().
 // It doesn't handle LYX_ACCENTs and probably never will.
-char * LyXText::SelectNextWord(BufferView * bview, float & value)
+string const LyXText::SelectNextWord(BufferView * bview,
+                                    float & value) const
 {
        LyXParagraph * tmppar = cursor.par();
        
@@ -3301,11 +3302,11 @@ char * LyXText::SelectNextWord(BufferView * bview, float & value)
        // Start the selection from here
        sel_cursor = cursor;
 
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
        std::ostringstream latex;
-#else
-       ostrstream latex;
-#endif
+//#else
+//     ostrstream latex;
+//#endif
        // and find the end of the word 
        // (optional hyphens are part of a word)
        while (cursor.pos() < cursor.par()->Last()
@@ -3313,29 +3314,26 @@ char * LyXText::SelectNextWord(BufferView * bview, float & value)
                   || (cursor.par()->GetChar(cursor.pos()) == LyXParagraph::META_INSET
                       && cursor.par()->GetInset(cursor.pos()) != 0
                       && cursor.par()->GetInset(cursor.pos())->Latex(bview->buffer(), latex, false, false) == 0
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                       && latex.str() == "\\-"
-#else
-                      && latex.str() // protect against null pointers         
-                      && string(latex.str(), 3) == "\\-" // this is not nice at all
-#endif
+//#else
+//                    && latex.str() // protect against null pointers         
+//                    && string(latex.str(), 3) == "\\-" // this is not nice at all
+//#endif
                           ))
                cursor.pos(cursor.pos() + 1);
 
-#ifndef HAVE_SSTREAM
-       delete [] latex.str();
-#endif
+//#ifndef HAVE_SSTREAM
+//     delete [] latex.str();
+//#endif
        // Finally, we copy the word to a string and return it
-       char * str = 0;
-
+       string str;
        if (sel_cursor.pos() < cursor.pos()) {
-               str = new char [cursor.pos() - sel_cursor.pos() + 2];
-               LyXParagraph::size_type i, j;
-               for (i = sel_cursor.pos(), j = 0; i < cursor.pos(); ++i) {
+               LyXParagraph::size_type i;
+               for (i = sel_cursor.pos(); i < cursor.pos(); ++i) {
                        if (cursor.par()->GetChar(i) != LyXParagraph::META_INSET)
-                               str[j++] = cursor.par()->GetChar(i);
+                               str += cursor.par()->GetChar(i);
                }
-               str[j] = '\0';
        }
        return str;
 }
@@ -3350,11 +3348,11 @@ void LyXText::SelectSelectedWord(BufferView * bview)
        // set the sel cursor
        sel_cursor = cursor;
 
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
        std::ostringstream latex;
-#else
-       ostrstream latex;
-#endif
+//#else
+//     ostrstream latex;
+//#endif
        
        // now find the end of the word
        while (cursor.pos() < cursor.par()->Last()
@@ -3362,17 +3360,17 @@ void LyXText::SelectSelectedWord(BufferView * bview)
                   || (cursor.par()->GetChar(cursor.pos()) == LyXParagraph::META_INSET
                       && cursor.par()->GetInset(cursor.pos()) != 0
                       && cursor.par()->GetInset(cursor.pos())->Latex(bview->buffer(), latex, false, false) == 0
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                       && latex.str() == "\\-"
-#else
-                      && string(latex.str(), 3) == "\\-"
-#endif
+//#else
+//                    && string(latex.str(), 3) == "\\-"
+//#endif
                           )))
                cursor.pos(cursor.pos() + 1);
        
-#ifndef HAVE_SSTREAM
-       delete [] latex.str();
-#endif
+//#ifndef HAVE_SSTREAM
+//     delete [] latex.str();
+//#endif
        SetCursor(bview, cursor.par(), cursor.pos());
        
        // finally set the selection
index f2d5876271b9c893568cc9d97e6e3dc1ed909ef5..a1ca4733e3251a62e5bc7e97add93f9b2267aab4 100644 (file)
@@ -172,7 +172,7 @@ LyXText::~LyXText()
 // smaller. (Asger)
 // If position is -1, we get the layout font of the paragraph.
 // If position is -2, we get the font of the manual label of the paragraph.
-LyXFont LyXText::GetFont(Buffer const * buf, LyXParagraph * par,
+LyXFont const LyXText::GetFont(Buffer const * buf, LyXParagraph * par,
                         LyXParagraph::size_type pos) const
 {
        LyXLayout const & layout = 
@@ -190,11 +190,14 @@ LyXFont LyXText::GetFont(Buffer const * buf, LyXParagraph * par,
                        if (layout.labeltype == LABEL_MANUAL
                            && pos < BeginningOfMainBody(buf, par)) {
                                // 1% goes here
-                               return par->GetFontSettings(buf->params, pos).
-                                       realize(layout.reslabelfont);
-                       } else
-                               return par->GetFontSettings(buf->params, pos).
-                                       realize(layout.resfont);
+                               LyXFont f = par->GetFontSettings(buf->params,
+                                                                pos);
+                               return f.realize(layout.reslabelfont);
+                       } else {
+                               LyXFont f = par->GetFontSettings(buf->params, pos);
+                               return f.realize(layout.resfont);
+                       }
+                       
                } else {
                        // 5% goes here.
                        // process layoutfont for pos == -1 and labelfont for pos < -1
@@ -1161,7 +1164,7 @@ void LyXText::SetSelection()
 }
 
 
-string LyXText::selectionAsString(Buffer const * buffer) const
+string const LyXText::selectionAsString(Buffer const * buffer) const
 {
        if (!selection) return string();
        string result;
@@ -1542,8 +1545,8 @@ void LyXText::SetParagraph(BufferView * bview,
 
 
 void LyXText::SetParagraphExtraOpt(BufferView * bview, int type,
-                                   char const * width,
-                                   char const * widthp,
+                                   string const & width,
+                                   string const & widthp,
                                    int alignment, bool hfill,
                                    bool start_minipage)
 {
@@ -1661,8 +1664,8 @@ char hebrewCounter(int n)
 }
 
 
-static
-char const * romanCounter(int n)
+static inline
+string const romanCounter(int n)
 {
        static char const * roman[20] = {
                "i",   "ii",  "iii", "iv", "v",
@@ -1829,11 +1832,11 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
                                        par->labelstring.erase();
                        }
 
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                        std::ostringstream s;
-#else
-                       ostrstream s;
-#endif
+//#else
+//                     ostrstream s;
+//#endif
                        if (!par->appendix) {
                                switch (2 * LABEL_COUNTER_CHAPTER -
                                        textclass.maxcounter() + i) {
@@ -1956,16 +1959,16 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
                                        break;
                                }
                        }
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                        par->labelstring += s.str().c_str();
                        // We really want to remove the c_str as soon as
                        // possible...
-#else
-                       s << '\0';
-                       char * tmps = s.str();
-                       par->labelstring += tmps;
-                       delete [] tmps;
-#endif
+//#else
+//                     s << '\0';
+//                     char * tmps = s.str();
+//                     par->labelstring += tmps;
+//                     delete [] tmps;
+//#endif
                        
                        for (i++; i < 10; ++i) {
                                // reset the following counters
@@ -1980,11 +1983,11 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
                        par->incCounter(i + par->enumdepth);
                        int number = par->getCounter(i + par->enumdepth);
 
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                        std::ostringstream s;
-#else
-                       ostrstream s;
-#endif
+//#else
+//                     ostrstream s;
+//#endif
                        switch (par->enumdepth) {
                        case 1:
                                if (par->isRightToLeftPar(buf->params))
@@ -2017,15 +2020,15 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
                                        s << number << '.';
                                break;
                        }
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
                        par->labelstring = s.str().c_str();
                        // we really want to get rid of that c_str()
-#else
-                       s << '\0';
-                       char * tmps = s.str();
-                       par->labelstring = tmps;
-                       delete [] tmps;
-#endif
+//#else
+//                     s << '\0';
+//                     char * tmps = s.str();
+//                     par->labelstring = tmps;
+//                     delete [] tmps;
+//#endif
 
                        for (i += par->enumdepth + 1; i < 10; ++i)
                                par->setCounter(i, 0);  /* reset the following counters  */
@@ -2428,15 +2431,15 @@ LyXParagraph * LyXText::FirstParagraph() const
 // returns true if the specified string is at the specified position
 bool LyXText::IsStringInText(LyXParagraph * par,
                             LyXParagraph::size_type pos,
-                            char const * str) const
+                            string const & str) const
 {
        if (par) {
-               int i = 0;
-               while (pos + i < par->Last() && str[i] && 
+               unsigned int i = 0;
+               while (pos + i < par->Last() && i < str.length()&& 
                       str[i] == par->GetChar(pos + i)) {
                        ++i;
                }
-               if (!str[i])
+               if (str.length() == i)
                        return true;
        }
        return false;
@@ -2444,17 +2447,18 @@ bool LyXText::IsStringInText(LyXParagraph * par,
 
 
 // sets the selection over the number of characters of string, no check!!
-void LyXText::SetSelectionOverString(BufferView * bview, char const * string)
+void LyXText::SetSelectionOverString(BufferView * bview, string const & str)
 {
        sel_cursor = cursor;
-       for (int i = 0; string[i]; ++i)
+       for (int i = 0; str[i]; ++i)
                CursorRight(bview);
        SetSelection();
 }
 
 
 // simple replacing. The font of the first selected character is used
-void LyXText::ReplaceSelectionWithString(BufferView * bview, char const * str)
+void LyXText::ReplaceSelectionWithString(BufferView * bview,
+                                        string const & str)
 {
        SetCursorParUndo(bview->buffer());
        FreezeUndo();
@@ -2466,15 +2470,16 @@ void LyXText::ReplaceSelectionWithString(BufferView * bview, char const * str)
 
        // Get font setting before we cut
        LyXParagraph::size_type pos = sel_end_cursor.pos();
-       LyXFont font = sel_start_cursor.par()->GetFontSettings(bview->buffer()->params,
-                                                            sel_start_cursor.pos());
+       LyXFont const font = sel_start_cursor.par()
+               ->GetFontSettings(bview->buffer()->params,
+                                 sel_start_cursor.pos());
 
        // Insert the new string
-       for (int i = 0; str[i]; ++i) {
-               sel_end_cursor.par()->InsertChar(pos, str[i], font);
+       for (string::const_iterator cit = str.begin(); cit != str.end(); ++cit) {
+               sel_end_cursor.par()->InsertChar(pos, (*cit), font);
                ++pos;
        }
-
+       
        // Cut the selection
        CutSelection(bview);
 
@@ -2484,7 +2489,7 @@ void LyXText::ReplaceSelectionWithString(BufferView * bview, char const * str)
 
 // if the string can be found: return true and set the cursor to
 // the new position
-bool LyXText::SearchForward(BufferView * bview, char const * str) const
+bool LyXText::SearchForward(BufferView * bview, string const & str) const
 {
        LyXParagraph * par = cursor.par();
        LyXParagraph::size_type pos = cursor.pos();
@@ -2505,7 +2510,7 @@ bool LyXText::SearchForward(BufferView * bview, char const * str) const
 }
 
 
-bool LyXText::SearchBackward(BufferView * bview, char const * string) const
+bool LyXText::SearchBackward(BufferView * bview, string const & str) const
 {
        LyXParagraph * par = cursor.par();
        int pos = cursor.pos();
@@ -2521,7 +2526,7 @@ bool LyXText::SearchBackward(BufferView * bview, char const * string) const
                                        pos = par->Last() - 1;
                        } while (par && pos < 0);
                }
-       } while (par && !IsStringInText(par, pos, string));
+       } while (par && !IsStringInText(par, pos, str));
   
        if (par) {
                SetCursor(bview, par, pos);
index 066694fc2b1c7a676b8988bf1752bd7a085a3819..52d7a26cd4c3ee456d7712eceae252f4238d6130 100644 (file)
@@ -35,7 +35,7 @@ DefaultTrans::DefaultTrans()
 }
 
 
-string DefaultTrans::process(char c, TransManager & k)
+string const DefaultTrans::process(char c, TransManager & k)
 {
        char dummy[2] = "?";
        dummy[0] = c;
@@ -49,9 +49,6 @@ string DefaultTrans::process(char c, TransManager & k)
 Trans::Trans()
 {
        int i = 0;
-       for(; i < 256; ++i)
-               keymap_[i] = 0;
-
        for(i = 0; i < TEX_MAX_ACCENT + 1; ++i)
                kmod_list_[i] = 0;
 }
@@ -91,13 +88,12 @@ void Trans::FreeException(Trans::keyexc & exclist)
 
 void Trans::FreeKeymap()
 {
-       int i = 0;
-       for(; i < 256; ++i)
-               if (keymap_[i]) {
-                       delete keymap_[i];
-                       keymap_[i] = 0;
+       for(int i = 0; i < 256; ++i)
+               if (!keymap_[i].empty()) {
+                       //delete keymap_[i];
+                       keymap_[i].erase();
                }
-       for(i = 0; i < TEX_MAX_ACCENT + 1; ++i)
+       for(int i = 0; i < TEX_MAX_ACCENT + 1; ++i)
                if (kmod_list_[i]) {
                        FreeException(kmod_list_[i]->exception_list);
                        delete kmod_list_[i];
@@ -106,13 +102,13 @@ void Trans::FreeKeymap()
 }
 
 
-bool Trans::IsDefined()
+bool Trans::IsDefined() const
 {
        return !name_.empty();
 }
 
 
-string const & Trans::GetName()
+string const & Trans::GetName() const
 {
        return name_;
 }
@@ -157,10 +153,9 @@ void Trans::AddDeadkey(tex_accent accent, string const & keys,
        }
        
        for(string::size_type i = 0; i < keys.length(); ++i) {
-               char * temp =
-                       keymap_[static_cast<unsigned char>(keys[i])] =
-                       new char[2];
-               temp[0] = 0; temp[1] = accent;
+               string * temp =
+                       &keymap_[static_cast<unsigned char>(keys[i])];
+               (*temp)[0] = 0; (*temp)[1] = accent;
        }
        kmod_list_[accent]->exception_list = 0;
 }
@@ -210,7 +205,7 @@ int Trans::Load(LyXLex & lex)
                        break;
                }       
                case KCOMB: {
-                       char const * str;
+                       string str;
 
                        lyxerr[Debug::KBMAP] << "KCOMB:" << endl;
                        if (lex.next(true)) {
@@ -239,7 +234,8 @@ int Trans::Load(LyXLex & lex)
                        // check about accent_1 also
                        int key = 0;
                        for(; key < 256; ++key) {
-                               if (keymap_[key] && keymap_[key][0] == 0
+                               if (!keymap_[key].empty()
+                                   && keymap_[key][0] == 0
                                    && keymap_[key][1] == accent_2)
                                        break;
                        }
@@ -271,9 +267,9 @@ int Trans::Load(LyXLex & lex)
                                return -1;
 
                        if (lex.next(true)) {
-                               char const * t = lex.text();
-                               char * string_to =
-                                       strcpy(new char[strlen(t)+1], t);
+                               string string_to = lex.text();
+                               //char * string_to =
+                               //      strcpy(new char[strlen(t)+1], t);
                                keymap_[key_from] = string_to;
                                if (lyxerr.debugging(Debug::KBMAP))
                                        lyxerr << "\t`" << string_to << "'"
@@ -286,7 +282,7 @@ int Trans::Load(LyXLex & lex)
                case KXMOD: {
                        tex_accent accent;
                        char key;
-                       char const * str;
+                       string str;
 
                        if (lyxerr.debugging(Debug::KBMAP))
                                lyxerr << "KXMOD:\t" << lex.text() << endl;
@@ -331,9 +327,9 @@ int Trans::Load(LyXLex & lex)
 }
 
 
-bool Trans::isAccentDefined(tex_accent accent, KmodInfo & i)
+bool Trans::isAccentDefined(tex_accent accent, KmodInfo & i) const
 {
-       if (kmod_list_[accent]!= 0) {
+       if (kmod_list_[accent] != 0) {
                i = *kmod_list_[accent];
                return true;
        }
@@ -341,13 +337,17 @@ bool Trans::isAccentDefined(tex_accent accent, KmodInfo & i)
 }
 
 
-string Trans::process(char c, TransManager & k)
+string const Trans::process(char c, TransManager & k)
 {
-       char dummy[2] = "?";
-       char * dt = dummy;
-       char * t = Match(static_cast<unsigned char>(c));
-    
-       if ((t == 0 && (*dt = c)) || (t[0] != 0 && (dt = t)) ){
+       string dummy("?");
+       string dt = dummy;
+       string const t = Match(static_cast<unsigned char>(c));
+
+       if (t.empty() && c != 0) {
+               dt[0] = c;
+               return k.normalkey(c, dt);
+       } else if (!t.empty()) {
+               dt = t;
                return k.normalkey(c, dt);
        } else {
                return k.deadkey(c,
index 9c9f4e273115f63a212485cfe8ea16e008a53d67..720a6b425dbbc97527acbf94d6228c89689da3a7 100644 (file)
@@ -22,9 +22,9 @@ class TransManager;
 class TransInterface {
 public:
        ///
-       virtual string process(char, TransManager &) = 0;
+       virtual string const process(char, TransManager &) = 0;
        ///
-       virtual bool isAccentDefined(tex_accent, KmodInfo &) = 0;
+       virtual bool isAccentDefined(tex_accent, KmodInfo &) const = 0;
 };
 
 /**
@@ -36,7 +36,7 @@ public:
        ///
        DefaultTrans();
        ///
-       virtual string process(char, TransManager &);
+       virtual string const process(char, TransManager &);
 private:
        ///
        static bool init_;
@@ -56,13 +56,13 @@ public:
        ///
        int Load(string const & language);
        ///
-       bool IsDefined();
+       bool IsDefined() const;
        ///
-       string const & GetName();
+       string const & GetName() const;
        ///
-       string process(char, TransManager &);
+       string const process(char, TransManager &);
        ///
-       bool isAccentDefined(tex_accent, KmodInfo &);
+       bool isAccentDefined(tex_accent, KmodInfo &) const;
     
 private:
        ///
@@ -77,7 +77,7 @@ private:
        ///
        int Load(LyXLex &);
        ///
-       inline char * Match(unsigned char c);
+       inline string const & Match(unsigned char c);
        ///
        void InsertException(keyexc & exclist, char c,
                             string const & data, bool = false,
@@ -88,7 +88,7 @@ private:
        ///
        string name_;
        ///
-       char * keymap_[256];
+       string keymap_[256];
        ///
        kmod_list_decl * kmod_list_[TEX_MAX_ACCENT+1];
 
@@ -96,7 +96,7 @@ private:
 
 
 ///
-char * Trans::Match(unsigned char c)
+string const & Trans::Match(unsigned char c)
 {
        return keymap_[c];
 }
index eea9e01464da853a18bb675671ccee5a0d6d7121..e6fea7a4f340696d49aa0759b0edee915fc3e159 100644 (file)
@@ -19,8 +19,8 @@
 using std::endl;
 using std::pair;
 
-extern string DoAccent(string const &, tex_accent);
-extern string DoAccent(char, tex_accent);
+extern string const DoAccent(string const &, tex_accent);
+extern string const DoAccent(char, tex_accent);
 extern BufferView * current_view;
 
 
@@ -44,17 +44,17 @@ TransInitState::TransInitState()
 }
 
 
-string TransInitState::normalkey(char c, char * t)
+string const TransInitState::normalkey(char c, string const & t)
 {
        string res;
-       if (t)  res = t;
+       if (!t.empty()) res = t;
        else res = c;
        
        return res;
 }
 
 
-string TransInitState::deadkey(char c, KmodInfo d)
+string const TransInitState::deadkey(char c, KmodInfo d)
 {
        deadkey_ = c;
        deadkey_info_ = d;
@@ -70,7 +70,7 @@ TransDeadkeyState::TransDeadkeyState()
 }
 
 
-string TransDeadkeyState::normalkey(char c, char * trans)
+string const TransDeadkeyState::normalkey(char c, string const & trans)
 {
        string res;
        
@@ -100,7 +100,7 @@ string TransDeadkeyState::normalkey(char c, char * trans)
 }
 
 
-string TransDeadkeyState::deadkey(char c, KmodInfo d)
+string const TransDeadkeyState::deadkey(char c, KmodInfo d)
 {
        string res;
        
@@ -153,7 +153,7 @@ TransCombinedState::TransCombinedState()
 }
 
 
-string TransCombinedState::normalkey(char c, char * trans)
+string const TransCombinedState::normalkey(char c, string const & trans)
 {
        string res;
        
@@ -177,7 +177,7 @@ string TransCombinedState::normalkey(char c, char * trans)
 }
 
 
-string TransCombinedState::deadkey(char c, KmodInfo d)
+string const TransCombinedState::deadkey(char c, KmodInfo d)
 {
        // Third key in a row. Output the first one and
        // reenter with shifted deadkeys
@@ -238,9 +238,9 @@ int TransManager::SetSecondary(string const & language)
 }
 
 
-bool TransManager::setCharset(char const * set)
+bool TransManager::setCharset(string const & str)
 {
-       return chset_.loadFile(set);
+       return chset_.loadFile(str);
 }
 
 
index f3abf31c13d8c45063450fc3035f9a4ff2e6d78e..e45bf55adaa56a99202751ab2c7a02eb2bc550e1 100644 (file)
@@ -20,11 +20,11 @@ public:
        ///
        virtual ~TransState() {}
        ///
-       virtual string normalkey(char, char *) = 0;
+       virtual string const normalkey(char, string const &) = 0;
        ///
        virtual bool backspace() = 0;
        ///
-       virtual string deadkey(char, KmodInfo) = 0;
+       virtual string const deadkey(char, KmodInfo) = 0;
        ///
        static char const TOKEN_SEP;
 };
@@ -66,11 +66,11 @@ public:
        ///
        TransInitState();
        ///
-       virtual string normalkey(char, char *);
+       virtual string const normalkey(char, string const &);
        ///
        virtual bool backspace() { return true; }
        ///
-       virtual string deadkey(char, KmodInfo);
+       virtual string const deadkey(char, KmodInfo);
 };
 
 
@@ -80,14 +80,14 @@ public:
        ///
        TransDeadkeyState();
        ///
-       virtual string normalkey(char, char *);
+       virtual string const normalkey(char, string const &);
        ///
        virtual bool backspace() {
                currentState = init_state_;
                return false;
        }
        ///
-       virtual string deadkey(char, KmodInfo);
+       virtual string const deadkey(char, KmodInfo);
 };
 
 
@@ -97,7 +97,7 @@ public:
        ///
        TransCombinedState();
        ///
-       virtual string normalkey(char, char *);
+       virtual string const normalkey(char, string const &);
        ///
        virtual bool backspace() {
                // cancel the second deadkey
@@ -108,7 +108,7 @@ public:
                return false;
        }
        ///
-       virtual string deadkey(char, KmodInfo);
+       virtual string const deadkey(char, KmodInfo);
 };
 
 
@@ -158,7 +158,7 @@ public:
        ///
        void DisableKeymap();
        ///
-       bool setCharset(const char *);
+       bool setCharset(string const &);
        ///
        bool backspace() {
                return trans_fsm_.currentState->backspace();
@@ -166,21 +166,21 @@ public:
        ///
        void TranslateAndInsert(char, LyXText *);
        ///
-       inline string deadkey(char, KmodInfo);
+       inline string const deadkey(char, KmodInfo);
        ///
-       inline string normalkey(char, char *);
+       inline string const normalkey(char, string const &);
        ///
        void deadkey(char, tex_accent, LyXText *);
 };
 
 
-string TransManager::normalkey(char c, char * t)
+string const TransManager::normalkey(char c, string const & t)
 {
        return trans_fsm_.currentState->normalkey(c, t);
 }
 
 
-string TransManager::deadkey(char c, KmodInfo t)
+string const TransManager::deadkey(char c, KmodInfo t)
 {
        return trans_fsm_.currentState->deadkey(c, t);
 }
index 3b4ef26a23132ff2248c66059c5156f3567e7f04..48f0d341b946c5977236ae2879120bb1b28ace2a 100644 (file)
@@ -37,7 +37,7 @@ RCS::RCS(string const & m)
 }
 
 
-string RCS::find_file(string const & file)
+string const RCS::find_file(string const & file)
 {
        string tmp(file);
        // Check if *,v exists.
@@ -200,7 +200,7 @@ CVS::CVS(string const & m, string const & f)
 }
 
 
-string CVS::find_file(string const & file)
+string const CVS::find_file(string const & file)
 {
        // First we look for the CVS/Entries in the same dir
        // where we have file.
index 0e8652763ba36a5ff661c53d78b574a70ff0396c..bd54e8948468710a831a8a1d9b2634d42bb634ef 100644 (file)
@@ -79,7 +79,7 @@ public:
        explicit
        RCS(string const & m);
        ///
-       static string find_file(string const & file);
+       static string const find_file(string const & file);
        ///
        static void retrive(string const & file);
        ///
@@ -106,7 +106,7 @@ public:
        explicit
        CVS(string const & m, string const & f);
        ///
-       static string find_file(string const & file);
+       static string const find_file(string const & file);
        ///
        virtual void scanMaster();
        ///
index 312753288bf73ca47aaf28d23e8d74ff60a5635f..e82588473e458eafa5a77b9805c8345530004134 100644 (file)
@@ -55,52 +55,48 @@ int number_index, unit_index;
 
 
 static inline
-void lyx_advance (string & data, unsigned int n)
+void lyx_advance(string & data, unsigned int n)
 {
        data.erase(0, n);
 }
 
 
 static inline
-bool isEndOfData (string const & data)
+bool isEndOfData(string const & data)
 {
-       return frontStrip (data).empty();
+       return frontStrip(data).empty();
 }
 
 
 static
-char nextToken (string & data)
+char nextToken(string & data)
 {
        data = frontStrip(data);
        if (data.empty())
                return '\0';
        else if (data[0] == '+') {
-               lyx_advance (data, 1);
+               lyx_advance(data, 1);
                return '+';
-       }
-       else if (prefixIs(data, "plus")) {
-               lyx_advance (data, 4);
+       } else if (prefixIs(data, "plus")) {
+               lyx_advance(data, 4);
                return '+';
-       }
-       else if (data[0] == '-') {
-               lyx_advance (data, 1);
+       } else if (data[0] == '-') {
+               lyx_advance(data, 1);
                return '-';
-       }
-        else if (prefixIs(data, "minus")) {
-               lyx_advance (data, 5);
+       } else if (prefixIs(data, "minus")) {
+               lyx_advance(data, 5);
                return '-';
-       }
-       else {
+       } else {
                string::size_type i;
 
                // I really mean assignment ("=") below, not equality!
                if ((i = data.find_last_of("0123456789.")) != string::npos) {
                        if (number_index > 3) return 'E';  // Error
-                        string buffer = data.substr(0, i + 1).c_str();
+                        string buffer = data.substr(0, i + 1);
                        double x = strToDbl(buffer);
                        if (x || (buffer[0] == '0')) {
                                number[number_index] = x;
-                               lyx_advance (data, i + 1);
+                               lyx_advance(data, i + 1);
                                ++number_index;
                                return 'n';
                        } else 
@@ -109,9 +105,9 @@ char nextToken (string & data)
                           != string::npos) {
                        if (unit_index > 3) return 'E';  // Error
                        string buffer = data.substr(0, i + 1);
-                       unit[unit_index] = unitFromString (buffer);
+                       unit[unit_index] = unitFromString(buffer);
                        if (unit[unit_index] != LyXLength::UNIT_NONE) {
-                               lyx_advance (data, i + 1);
+                               lyx_advance(data, i + 1);
                                ++unit_index;
                                return 'u';
                        } else
@@ -230,7 +226,7 @@ bool isValidLength(string const & data, LyXLength * result)
        /// glue, but since we already have it, using it is
        /// easier than writing something from scratch.
 
-        string   buffer = data;
+        string   buffer(data);
        int       pattern_index = 0;
        char      pattern[3];
 
@@ -290,18 +286,18 @@ LyXLength::LyXLength(string const & data)
 }
 
 
-string LyXLength::asString() const
+string const LyXLength::asString() const
 {
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
        std::ostringstream buffer;
        buffer << val << unit_name[uni]; // setw?
        return buffer.str().c_str();
-#else
-       char tbuf[20];
-       ostrstream buffer(tbuf, 20);
-       buffer << val << unit_name[uni] << '\0'; // setw?
-       return buffer.str();
-#endif
+//#else
+//     char tbuf[20];
+//     ostrstream buffer(tbuf, 20);
+//     buffer << val << unit_name[uni] << '\0'; // setw?
+//     return buffer.str();
+//#endif
 }
 
 
@@ -325,14 +321,14 @@ LyXGlueLength::LyXGlueLength (string const & data)
 }
 
 
-string LyXGlueLength::asString() const
+string const LyXGlueLength::asString() const
 {
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
        std::ostringstream buffer;
-#else
-       char tbuf[20];
-       ostrstream buffer(tbuf, 20);
-#endif
+//#else
+//     char tbuf[20];
+//     ostrstream buffer(tbuf, 20);
+//#endif
        if (plus_val != 0.0)
                if (minus_val != 0.0)
                        if ((uni == plus_uni) && (uni == minus_uni))
@@ -378,23 +374,23 @@ string LyXGlueLength::asString() const
                                       << unit_name[minus_uni];
                else
                        buffer << val << unit_name[uni];
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
        return buffer.str().c_str();
-#else
-       buffer << '\0';
-       return buffer.str();
-#endif
+//#else
+//     buffer << '\0';
+//     return buffer.str();
+//#endif
 }
 
 
-string LyXGlueLength::asLatexString() const
+string const LyXGlueLength::asLatexString() const
 {
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
        std::ostringstream buffer;
-#else
-       char tbuf[40];
-       ostrstream buffer(tbuf, 40);
-#endif
+//#else
+//     char tbuf[40];
+//     ostrstream buffer(tbuf, 40);
+//#endif
 
        if (plus_val != 0.0)
                if (minus_val != 0.0)
@@ -414,12 +410,12 @@ string LyXGlueLength::asLatexString() const
                               << minus_val << unit_name[minus_uni];
                else
                        buffer << val << unit_name[uni];
-#ifdef HAVE_SSTREAM
+//#ifdef HAVE_SSTREAM
        return buffer.str().c_str();
-#else
-       buffer << '\0';
-       return buffer.str();
-#endif
+//#else
+//     buffer << '\0';
+//     return buffer.str();
+//#endif
 }
 
 
@@ -474,7 +470,7 @@ bool VSpace::operator==(VSpace const & other) const
 }
 
 
-string VSpace::asLyXCommand() const
+string const VSpace::asLyXCommand() const
 {
         string result;
 
@@ -494,7 +490,7 @@ string VSpace::asLyXCommand() const
 }
 
 
-string VSpace::asLatexCommand(BufferParams const & params) const
+string const VSpace::asLatexCommand(BufferParams const & params) const
 {
        switch (kin) {
        case NONE:      return string();
index fce31b09fdfe4361aa9943cffd3b74af34edac2d..11fe28079d14a3f7030448053c3c8a36727d2114 100644 (file)
@@ -64,20 +64,21 @@ public:
         LyXLength(string const & data);
        
        ///
-       float value() const         { return val; };
+       float value() const         { return val; }
        ///
-       LyXLength::UNIT unit() const { return uni; };
+       LyXLength::UNIT unit() const { return uni; }
 
        /// conversion
-       virtual string asString() const;
+       virtual string const asString() const;
        ///
-       virtual string asLatexString() const { return this->asString(); };
-
+       virtual string const asLatexString() const {
+               return this->asString();
+       }
 
        /** If "data" is valid, the length represented by it is
          stored into "result", if that is not 0. */
        friend bool isValidLength(string const & data, 
-                                 LyXLength * result= 0);
+                                 LyXLength * result = 0);
 
 protected:
        ///
@@ -123,30 +124,34 @@ public:
         LyXGlueLength(string const & data);
        
        ///
-       float plusValue() const         { return plus_val; };
+       float plusValue() const         { return plus_val; }
        ///
-       LyXLength::UNIT plusUnit() const { return plus_uni; };
+       LyXLength::UNIT plusUnit() const { return plus_uni; }
        ///
-       float minusValue() const         { return minus_val; };
+       float minusValue() const         { return minus_val; }
        ///
-       LyXLength::UNIT minusUnit() const { return minus_uni; };
+       LyXLength::UNIT minusUnit() const { return minus_uni; }
 
        /// conversion
-       virtual string asString() const;
+       virtual string const asString() const;
        ///
-       virtual string asLatexString() const;
+       virtual string const asLatexString() const;
 
 
        /** If "data" is valid, the length represented by it is
          stored into "result", if that is not 0. */
        friend bool isValidGlueLength(string const & data, 
-                                     LyXGlueLength* result= 0);
+                                     LyXGlueLength* result = 0);
 
 protected:
        ///
-       float           plus_val, minus_val;
+       float plus_val;
+       ///
+       float minus_val;
+       ///
+       LyXLength::UNIT plus_uni;
        ///
-       LyXLength::UNIT plus_uni, minus_uni;
+       LyXLength::UNIT minus_uni;
 };
 
 ///
@@ -224,22 +229,22 @@ public:
        ///
        void setKeep(bool val) { kp = val; } 
        ///
-        bool operator == (VSpace const &) const;
+        bool operator==(VSpace const &) const;
 
        // conversion
        ///
-       string asLyXCommand() const;  // how it goes into the LyX file
+       string const asLyXCommand() const;  // how it goes into the LyX file
        ///
-       string asLatexCommand(BufferParams const & params) const;
+       string const asLatexCommand(BufferParams const & params) const;
        ///
        int inPixels(BufferView * bv) const;
        ///
        int inPixels(int default_height, int default_skip) const;
 private:
        ///
-       vspace_kind  kin;
+       vspace_kind kin;
        ///
-       LyXGlueLength    len;
+       LyXGlueLength len;
        ///
        bool kp;
 };