]> git.lyx.org Git - features.git/commitdiff
make the new code from Juergen compile and some small fixes to the same code.
authorLars Gullik Bjønnes <larsbj@gullik.org>
Fri, 25 Feb 2000 13:35:38 +0000 (13:35 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Fri, 25 Feb 2000 13:35:38 +0000 (13:35 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@572 a592a061-630c-0410-9148-cb99ea01b6c8

12 files changed:
ChangeLog
src/insets/inset.C
src/insets/insetert.C
src/insets/insetert.h
src/insets/insettext.C
src/insets/insettext.h
src/insets/lyxinset.h
src/lyxfunc.C
src/mathed/formula.C
src/mathed/formula.h
src/mathed/formulamacro.C
src/mathed/formulamacro.h

index 290bdde8e70b605c96b8a754ce8fdd42daaf2358..66454e4b977b74390263d8dab53368e300ca102c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2000-02-25  Lars Gullik Bjønnes <larsbj@lyx.org>
+
+       * src/insets/insettext.h: small change to get the new files from
+       Juergen to compile (use "string", not "class string").
+
+       * src/insets/insettext.[Ch], src/insets/insertert.[Ch]: use string
+       const & as parameter to LocalDispatch, use LyXFont const & as
+       paramter to some other func. This also had impacto on lyxinsets.h
+       and the two mathed insets.
+
 2000-02-24  Juergen Vigna  <jug@sad.it>
 
        * src/buffer.C:
index 628f853aae602fd8c454ce512e4988c2f6f6ed66..12a904a78f78d3d1a57ce558c780d8c8aa9c8c74 100644 (file)
@@ -133,10 +133,12 @@ void UpdatableInset::SetFont(LyXFont const &, bool )
 
 ///  An updatable inset could handle lyx editing commands
 #ifdef SCROLL_INSET
-UpdatableInset::RESULT UpdatableInset::LocalDispatch(BufferView *, 
-                                                    int action, string arg) 
+UpdatableInset::RESULT
+UpdatableInset::LocalDispatch(BufferView *, 
+                             int action, string const & arg) 
 #else
-UpdatableInset::RESULT UpdatableInset::LocalDispatch(BufferView *, int, string)
+UpdatableInset::RESULT
+UpdatableInset::LocalDispatch(BufferView *, int, string const &)
 #endif
 {
 #ifdef SCROLL_INSET
index 83a9a81e836daf56642c6cba4500c7d015004832..6a7fd1a1587a0a5bd7d7a885d5ab9ee081c1505c 100644 (file)
@@ -3,7 +3,7 @@
  * 
  *           LyX, The Document Processor
  *      
- *          Copyright (C) 1998 The LyX Team.
+ *          Copyright 1998 The LyX Team.
  *
  *======================================================*/
 
@@ -20,7 +20,8 @@
 #include "lyx_gui_misc.h"
 
 
-InsetERT::InsetERT(Buffer * bf): InsetText(bf)
+InsetERT::InsetERT(Buffer * bf)
+       : InsetText(bf)
 {
        closed = true;
        nomotion = false;
@@ -121,7 +122,8 @@ void InsetERT::draw_closed(Painter & pain, LyXFont const & f,
 }
 
 
-void InsetERT::draw(Painter & pain, LyXFont const & f, int baseline, float & x) const
+void InsetERT::draw(Painter & pain, LyXFont const & f,
+                   int baseline, float & x) const
 {
     if (closed) {
        top_x = int(x);
index 76bf3179290043ab6f3fed9ca23d4ca6a12aa131..99e5294647c622db48b6d249e1789dbd1eb0ff58 100644 (file)
@@ -4,7 +4,7 @@
  * 
  *           LyX, The Document Processor
  *
- *           Copyright (C) 1998 The LyX Team.
+ *           Copyright 1998 The LyX Team.
  *
  *======================================================
  */
@@ -74,13 +74,13 @@ protected:
     ///
     int width_closed(Painter &, LyXFont const & f) const;
     ///
-    void draw_closed(Painter & pain, const LyXFont &, int , float &) const;
+    void draw_closed(Painter & pain, LyXFont const &, int , float &) const;
 
 private:
-    ///
-    bool
-        closed,
-       nomotion;
+       ///
+       bool closed;
+       ///
+       bool nomotion;
 };
 
 #endif
index c0da234c2cabf2f9d650c4473cd7d4e23e1df8ca..b6764c2ea273b1cf0cee8aee3acf992e0117697a 100644 (file)
@@ -4,7 +4,7 @@
  * 
  *           LyX, The Document Processor
  *
- *           Copyright (C) 1998 The LyX Team.
+ *           Copyright 1998 The LyX Team.
  *
  * ======================================================
  */
@@ -100,7 +100,7 @@ void InsetText::Write(ostream & os) const
 }
 
 
-void InsetText::WriteParagraphData(ostream &os) const
+void InsetText::WriteParagraphData(ostream & os) const
 {
     LyXFont font1 = LyXFont(LyXFont::ALL_INHERIT);
     LyXFont font2;
@@ -127,7 +127,7 @@ void InsetText::WriteParagraphData(ostream &os) const
        
         switch (c) {
           case LyXParagraph::META_INSET: {
-              Inset *inset = par->GetInset(i);
+              Inset * inset = par->GetInset(i);
               if (inset) {
                  os << "\n\\begin_inset ";
                  inset->Write(os);
@@ -187,7 +187,7 @@ void InsetText::Read(LyXLex & lex)
             continue;
         else if (token[0] != '\\') {
             int n = token.length();
-            for (int i=0; i < n; ++i) {
+            for (int i = 0; i < n; ++i) {
                 par->InsertChar(pos, token[i]);
                 par->SetFont(pos, font);
                 ++pos;
@@ -313,7 +313,9 @@ void InsetText::Read(LyXLex & lex)
                } else if (inscmd.getCmdName() == "ref" ||
                           inscmd.getCmdName() == "pageref") {
                    inset = new InsetRef(inscmd, buffer);
-               } else
+               }
+#if 0  // Is this compatibility code needed (Lgb)
+              else
                    // The following three are only for compatibility
                    if (inscmd.getCmdName()=="-") {
                        inset = new InsetSpecialChar(InsetSpecialChar::HYPHENATION);
@@ -323,6 +325,7 @@ void InsetText::Read(LyXLex & lex)
                        inset = new InsetSpecialChar(InsetSpecialChar::LDOTS);
                    } else
                        inset = inscmd.Clone();
+#endif
            }
            if (inset) {
                par->InsertChar(pos, LyXParagraph::META_INSET);
@@ -410,19 +413,16 @@ int InsetText::getMaxWidth(UpdatableInset * inset) const
 }
 
 
-void InsetText::draw(Painter & pain,const LyXFont & f,int baseline,float & x) const
+void InsetText::draw(Painter & pain, LyXFont const & f,
+                    int baseline, float & x) const
 {
-    unsigned int
-        r;
-    bool
-       do_reset_pos;
-
     UpdatableInset::draw(pain, f, baseline, x);
-    do_reset_pos = (x != top_x) || (baseline != top_baseline);
+    
+    bool do_reset_pos = (x != top_x) || (baseline != top_baseline);
     top_x = int(x);
     top_baseline = baseline;
     computeBaselines(baseline);
-    for(r=0; r<rows.size()-1; ++r) {
+    for(unsigned int r = 0; r < rows.size() - 1; ++r) {
         drawRowSelection(pain, rows[r].pos, rows[r+1].pos, r, 
                          rows[r].baseline, x);
         drawRowText(pain, rows[r].pos, rows[r+1].pos, rows[r].baseline, x);
@@ -441,15 +441,8 @@ void InsetText::drawRowSelection(Painter & pain, int startpos, int endpos,
 {
     if (!hasSelection())
        return;
-    int
-       p,
-       ssel_x, esel_x,
-       s_start, s_end;
-    LyXFont
-       font;
-    char
-       ch;
 
+    int s_start, s_end;
     if (selection_start > selection_end) {
        s_start = selection_end;
        s_end = selection_start;
@@ -459,13 +452,17 @@ void InsetText::drawRowSelection(Painter & pain, int startpos, int endpos,
     }
     if ((s_start > endpos) || (s_end < startpos))
        return;
-    ssel_x = esel_x = int(x);
-    for(p=startpos; p < endpos; ++p) {
+    
+    int esel_x;
+    int ssel_x = esel_x = int(x);
+    LyXFont font;
+    int p = startpos;
+    for(; p < endpos; ++p) {
        if (p == s_start)
            ssel_x = int(x);
        if ((p >= s_start) && (p <= s_end))
            esel_x = int(x);
-       ch = par->GetChar(p);
+       char ch = par->GetChar(p);
        font = GetFont(par,p);
        if (IsFloatChar(ch)) {
            // skip for now
@@ -493,15 +490,10 @@ void InsetText::drawRowText(Painter & pain, int startpos, int endpos,
                            int baseline, float x) const
 {
     Assert(endpos <= par->Last());
-    int
-       p;
-    char
-       ch;
-    LyXFont
-       font;
-    for(p=startpos; p < endpos; ++p) {
-       ch = par->GetChar(p);
-       font = GetFont(par,p);
+
+    for(int p = startpos; p < endpos; ++p) {
+       char ch = par->GetChar(p);
+       LyXFont font = GetFont(par,p);
        if (IsFloatChar(ch)) {
            // skip for now
        } else if (ch == LyXParagraph::META_INSET) {
@@ -516,7 +508,7 @@ void InsetText::drawRowText(Painter & pain, int startpos, int endpos,
 }
 
 
-const char * InsetText::EditMessage() const
+char const * InsetText::EditMessage() const
 {
     return _("Opened Text Inset");
 }
@@ -536,7 +528,7 @@ void InsetText::Edit(BufferView * bv, int x, int y, unsigned int button)
 }
 
 
-void InsetText::InsetUnlock(BufferView *bv)
+void InsetText::InsetUnlock(BufferView * bv)
 {
     if (the_locking_inset)
        the_locking_inset->InsetUnlock(bv);
@@ -564,6 +556,7 @@ bool InsetText::UnlockInsetInInset(BufferView * bv, Inset * inset, bool lr)
     return the_locking_inset->UnlockInsetInInset(bv, inset,lr);
 }
 
+
 bool InsetText::UpdateInsetInInset(BufferView * bv, Inset * inset)
 {
     if (!the_locking_inset)
@@ -628,12 +621,12 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
 void InsetText::InsetMotionNotify(BufferView * bv, int x, int y, int button)
 {
     if (the_locking_inset) {
-        the_locking_inset->InsetMotionNotify(bv, x-inset_x, y-inset_y,button);
+        the_locking_inset->InsetMotionNotify(bv, x - inset_x,
+                                            y - inset_y,button);
         return;
     }
     if (!no_selection) {
-       int
-           old = selection_end;
+       int old = selection_end;
        setPos(bv, x, y, false);
        selection_end = actpos;
        if (old != selection_end)
@@ -653,7 +646,7 @@ void InsetText::InsetKeyPress(XKeyEvent * xke)
 
 
 UpdatableInset::RESULT InsetText::LocalDispatch(BufferView * bv,
-                                               int action, string arg)
+                                               int action, string const & arg)
 {
     no_selection = false;
     if (UpdatableInset::LocalDispatch(bv, action, arg)) {
@@ -775,7 +768,7 @@ UpdatableInset::RESULT InsetText::LocalDispatch(BufferView * bv,
          }
           break;
       case LFUN_HOME:
-          for(;actpos > rows[actrow].pos;--actpos)
+          for(; actpos > rows[actrow].pos; --actpos)
               cx -= SingleWidth(bv, par, actpos);
          cx -= SingleWidth(bv, par, actpos);
          if (hasSelection()) {
@@ -786,7 +779,7 @@ UpdatableInset::RESULT InsetText::LocalDispatch(BufferView * bv,
          }
           break;
       case LFUN_END:
-          for(;actpos < rows[actrow+1].pos;++actpos)
+          for(; actpos < rows[actrow + 1].pos; ++actpos)
               cx += SingleWidth(bv, par, actpos);
          if (hasSelection()) {
              selection_start = selection_end = actpos;
@@ -820,21 +813,17 @@ UpdatableInset::RESULT InsetText::LocalDispatch(BufferView * bv,
 
 int InsetText::Latex(ostream &os, signed char fragile) const
 {
-    string
-        fstr;
-    int
-        i;
+    string fstr;
 
-    i = Latex(fstr, fragile);
-    os << fstr.c_str();
+    int i = Latex(fstr, fragile);
+    os << fstr;
     return i;
 }
 
 
 int InsetText::Latex(string & file, signed char /* fragile */) const
 {
-    TexRow
-        texrow;
+    TexRow texrow;
 
     return par->SimpleTeXOnePar(file, texrow);
 }
@@ -847,12 +836,10 @@ void InsetText::Validate(LaTeXFeatures & features) const
 
 
 // Returns the width of a character at a certain spot
-int InsetText::SingleWidth(BufferView *bv, LyXParagraph * par, int pos)
+int InsetText::SingleWidth(BufferView * bv, LyXParagraph * par, int pos)
 {
-    LyXFont
-        font = GetFont(par, pos);
-    char
-        c = par->GetChar(pos);
+    LyXFont font = GetFont(par, pos);
+    char c = par->GetChar(pos);
 
     // The most common case is handled first (Asger)
     if (IsPrintable(c)) {
@@ -875,10 +862,8 @@ int InsetText::SingleWidth(BufferView *bv, LyXParagraph * par, int pos)
 void InsetText::SingleHeight(BufferView * bv, LyXParagraph * par,int pos,
                             int & asc, int & desc)
 {
-    LyXFont
-        font = GetFont(par, pos);
-    char
-        c = par->GetChar(pos);
+    LyXFont font = GetFont(par, pos);
+    char c = par->GetChar(pos);
 
     asc = desc = 0;
     // The most common case is handled first (Asger)
@@ -1003,13 +988,11 @@ void InsetText::ToggleInsetCursor(BufferView * bv)
         the_locking_inset->ToggleInsetCursor(bv);
         return;
     }
-    int
-        asc,desc;
-    LyXFont
-        font = GetFont(par, actpos);
 
-    asc = font.maxAscent();
-    desc = font.maxDescent();
+    LyXFont font = GetFont(par, actpos);
+
+    int asc = font.maxAscent();
+    int desc = font.maxDescent();
   
     if (cursor_visible)
         bv->hideLockedInsetCursor();
@@ -1022,13 +1005,10 @@ void InsetText::ToggleInsetCursor(BufferView * bv)
 void InsetText::ShowInsetCursor(BufferView * bv)
 {
     if (!cursor_visible) {
-       int
-           asc,desc;
-       LyXFont
-           font = GetFont(par, actpos);
+       LyXFont font = GetFont(par, actpos);
        
-       asc = font.maxAscent();
-       desc = font.maxDescent();
+       int asc = font.maxAscent();
+       int desc = font.maxDescent();
        bv->fitLockedInsetCursor(cx, cy, asc, desc);
        bv->showLockedInsetCursor(cx, cy, asc, desc);
        cursor_visible = true;
@@ -1045,15 +1025,14 @@ void InsetText::HideInsetCursor(BufferView * bv)
 
 void InsetText::setPos(BufferView * bv, int x, int y, bool activate_inset)
 {
-    int
-       ox = x,
+    int ox = x,
        oy = y;
     // search right X-pos x==0 -> top_x
     actpos = actrow = 0;
     cy = top_baseline;
     y += cy;
-    for(unsigned int i=1;
-       ((cy+rows[i-1].desc) < y) && (i < rows.size()-1); ++i) {
+    for(unsigned int i = 1;
+       ((cy + rows[i - 1].desc) < y) && (i < rows.size() - 1); ++i) {
        cy = rows[i].baseline;
        actpos = rows[i].pos;
        actrow = i;
@@ -1061,13 +1040,12 @@ void InsetText::setPos(BufferView * bv, int x, int y, bool activate_inset)
     cy -= top_baseline;
     cx = top_x;
     x += top_x;
-    int
-       sw, swh;
 
-    sw = swh = SingleWidth(bv, par,actpos);
+    int swh;
+    int sw = swh = SingleWidth(bv, par,actpos);
     if (par->GetChar(actpos)!=LyXParagraph::META_INSET)
        swh /= 2;
-    while ((actpos < (rows[actrow+1].pos-1)) && ((cx+swh) < x)) {
+    while ((actpos < (rows[actrow + 1].pos - 1)) && ((cx + swh) < x)) {
        cx += sw;
        ++actpos;
        sw = swh = SingleWidth(bv, par,actpos);
@@ -1075,8 +1053,9 @@ void InsetText::setPos(BufferView * bv, int x, int y, bool activate_inset)
            swh /= 2;
     }
     if (activate_inset && par->GetChar(actpos)==LyXParagraph::META_INSET) {
-        the_locking_inset=(UpdatableInset*)par->GetInset(actpos);
-       inset_x = cx-top_x;
+        the_locking_inset =
+               static_cast<UpdatableInset*>(par->GetInset(actpos));
+       inset_x = cx - top_x;
        inset_y = cy;
        inset_pos = actpos;
         the_locking_inset->Edit(bv, ox - inset_x, oy - inset_y, 0);
@@ -1089,8 +1068,9 @@ bool InsetText::moveRight(BufferView * bv, bool activate_inset)
     if (actpos >= par->Last())
        return false;
     if (activate_inset && par->GetChar(actpos)==LyXParagraph::META_INSET) {
-       the_locking_inset=(UpdatableInset*)par->GetInset(actpos);
-       inset_x = cx-top_x;
+       the_locking_inset =
+               static_cast<UpdatableInset*>(par->GetInset(actpos));
+       inset_x = cx - top_x;
        inset_y = cy;
        inset_pos = actpos;
        the_locking_inset->Edit(bv, 0, 0, 0);
@@ -1108,13 +1088,14 @@ bool InsetText::moveLeft(BufferView * bv, bool activate_inset)
        return false;
     --actpos;
     if (activate_inset && par->GetChar(actpos)==LyXParagraph::META_INSET) {
-       the_locking_inset=(UpdatableInset*)par->GetInset(actpos);
+       the_locking_inset =
+               static_cast<UpdatableInset*>(par->GetInset(actpos));
        resetPos(bv);
-       inset_x = cx-top_x;
+       inset_x = cx - top_x;
        inset_y = cy;
        inset_pos = actpos;
        the_locking_inset->Edit(bv, the_locking_inset->
-                               width(bv->getPainter(),GetFont(par,actpos)),
+                               width(bv->getPainter(), GetFont(par,actpos)),
                                0, 0);
     } else {
        resetPos(bv);
@@ -1127,31 +1108,29 @@ bool InsetText::moveUp(BufferView * bv, bool activate_inset)
 {
     if (!actrow)
        return false;
-    cy = rows[actrow-1].baseline - top_baseline;
-    setPos(bv, cx-top_x, cy, activate_inset);
+    cy = rows[actrow - 1].baseline - top_baseline;
+    setPos(bv, cx - top_x, cy, activate_inset);
     return true;
 }
 
 
 bool InsetText::moveDown(BufferView * bv, bool activate_inset)
 {
-    if (actrow >= int(rows.size()-2))
+    if (actrow >= int(rows.size() - 2))
        return false;
-    cy = rows[actrow+1].baseline - top_baseline;
-    setPos(bv, cx-top_x, cy, activate_inset);
+    cy = rows[actrow + 1].baseline - top_baseline;
+    setPos(bv, cx - top_x, cy, activate_inset);
     return true;
 }
 
 
 void InsetText::resetPos(BufferView * bv)
 {
-    int
-       i,
-        old_pos = actpos;
+    int old_pos = actpos;
 
     cy = top_baseline;
     actrow = 0;
-    for(i=0; rows[i].pos <= actpos; ++i) {
+    for(int i = 0; rows[i].pos <= actpos; ++i) {
        cy = rows[i].baseline;
        actrow = i;
     }
@@ -1189,8 +1168,8 @@ bool InsetText::InsertInset(BufferView * bv, Inset * inset)
     par->InsertInset(actpos, inset);
     computeTextRows(bv);
     bv->updateInset(this, true);
-    the_locking_inset = (UpdatableInset*)inset;
-    inset_x = cx-top_x;
+    the_locking_inset = static_cast<UpdatableInset*>(inset);
+    inset_x = cx - top_x;
     inset_y = cy;
     inset_pos = actpos;
     inset->Edit(bv, 0, 0, 0);
@@ -1204,7 +1183,7 @@ UpdatableInset * InsetText::GetLockingInset()
 }
 
 
-void  InsetText::SetFont(BufferView * bv, LyXFont const & font,bool toggleall)
+void InsetText::SetFont(BufferView * bv, LyXFont const & font, bool toggleall)
 {
     // if there is no selection just set the current_font
     if (!hasSelection()) {
@@ -1225,9 +1204,8 @@ void  InsetText::SetFont(BufferView * bv, LyXFont const & font,bool toggleall)
        real_current_font.realize(layoutfont);
        return;
     }
-    int
-       s_start, s_end;
-
+    
+    int s_start, s_end;
     if (selection_start > selection_end) {
        s_start = selection_end;
        s_end = selection_start;
@@ -1235,8 +1213,7 @@ void  InsetText::SetFont(BufferView * bv, LyXFont const & font,bool toggleall)
        s_start = selection_start;
        s_end = selection_end;
     }
-    LyXFont
-       newfont;
+    LyXFont newfont;
     while(s_start < s_end) {
        newfont = GetFont(par,s_start);
        newfont.update(font, toggleall);
@@ -1248,9 +1225,11 @@ void  InsetText::SetFont(BufferView * bv, LyXFont const & font,bool toggleall)
 }
 
 
-void InsetText::SetCharFont(int pos, LyXFont font)
+void InsetText::SetCharFont(int pos, LyXFont const & f)
 {
-    /* let the insets convert their font */ 
+    /* let the insets convert their font */
+       LyXFont font(f);
+       
     if (par->GetChar(pos) == LyXParagraph::META_INSET) {
        if (par->GetInset(pos))
            font = par->GetInset(pos)->ConvertFont(font);
@@ -1279,23 +1258,20 @@ void InsetText::SetCharFont(int pos, LyXFont font)
 
 void InsetText::computeTextRows(BufferView * bv)
 {
-    int
-       p,
+    int p,
        nwp = 0,
        asc = 0,
        desc = 0,
        oasc = 0,
        odesc = 0,
        owidth = 0,
-       width,
        wordAscent,
        wordDescent;
-    row_struct
-       row;
+    row_struct row;
 
     if (rows.size())
        rows.erase(rows.begin(),rows.end());
-    width = wordAscent = wordDescent = 0;
+    int width = wordAscent = wordDescent = 0;
     insetWidth = maxAscent = maxDescent = 0;
     row.asc      = 0;
     row.desc     = 0;
@@ -1318,11 +1294,9 @@ void InsetText::computeTextRows(BufferView * bv)
        rows.push_back(row);
        return;
     }
-    bool
-       is_first_word_in_row = true;
+    bool is_first_word_in_row = true;
 
-    int
-       cw,
+    int cw,
        lastWordWidth=0;
 
     for(p = 0; p < par->Last(); ++p) {
@@ -1447,6 +1421,7 @@ void InsetText::computeTextRows(BufferView * bv)
     }
 }
 
+
 void InsetText::computeBaselines(int baseline) const
 {
     rows[0].baseline = baseline;
@@ -1456,6 +1431,7 @@ void InsetText::computeBaselines(int baseline) const
     }
 }
 
+
 void InsetText::init(BufferView * bv)
 {
 //    if (init_inset)
index b7adc791d270a905767b4fca5549e211f7239f49..fdc0aba99d2c4ae38ebb1d0f56c5b6dd44a5a28f 100644 (file)
@@ -4,7 +4,7 @@
  * 
  *           LyX, The Document Processor
  *
- *           Copyright (C) 1998 The LyX Team.
+ *           Copyright 1998 The LyX Team.
  *
  *======================================================
  */
@@ -56,15 +56,15 @@ public:
     ///
     int getMaxWidth(UpdatableInset *) const;
     ///
-    void draw(Painter & pain, const LyXFont &, int , float &) const;
+    void draw(Painter & pain, LyXFont const &, int , float &) const;
     ///
-    const char * EditMessage() const;
+    char const * EditMessage() const;
     ///
     void Edit(BufferView *, int, int, unsigned int);
     ///
     void InsetUnlock(BufferView *);
     ///
-    bool UnlockInsetInInset(BufferView *, Inset *, bool lr=false);
+    bool UnlockInsetInInset(BufferView *, Inset *, bool lr = false);
     ///
     //void UpdateLocal(bool flag=true);
     ///
@@ -78,15 +78,15 @@ public:
     ///
     void InsetKeyPress(XKeyEvent *);
     ///
-    UpdatableInset::RESULT LocalDispatch(BufferView *, int, string);
+    UpdatableInset::RESULT LocalDispatch(BufferView *, int, string const &);
     ///
     int Latex(ostream &, signed char) const;
     ///
     int Latex(string &, signed char) const;
     ///
-    int Linuxdoc(class string &) const { return true; }
+    int Linuxdoc(string &) const { return 0; }
     ///
-    int DocBook(class string &) const { return true; }
+    int DocBook(string &) const { return 0; }
     ///
     void Validate(LaTeXFeatures & features) const;
     ///
@@ -155,7 +155,7 @@ private:
     ///
     void HideInsetCursor(BufferView *);
     ///
-    void setPos(BufferView *, int x, int y, bool activate_inset=true);
+    void setPos(BufferView *, int x, int y, bool activate_inset = true);
     ///
     bool moveRight(BufferView *, bool activate_inset = true);
     bool moveLeft(BufferView *, bool activate_inset = true);
@@ -163,9 +163,9 @@ private:
     bool moveDown(BufferView *, bool activate_inset = true);
     bool Delete();
     ///
-    bool hasSelection() const {return (selection_start != selection_end);}
+    bool hasSelection() const { return selection_start != selection_end; }
     ///
-    void SetCharFont(int pos, LyXFont font);
+    void SetCharFont(int pos, LyXFont const & font);
     ///
     string getText(int);
        
index b34fa39dfbda5e7715a5ccad033b279257fed011..2a007b8d027d78bb62093224dd37c699db920410 100644 (file)
@@ -190,7 +190,7 @@ public:
                           dispatched by lower level insets
        */ 
        enum RESULT {
-           UNDISPATCHED=0,
+           UNDISPATCHED = 0,
            DISPATCHED,
            FINISHED
        };
@@ -234,17 +234,18 @@ public:
        ///
        virtual int InsetInInsetY() { return 0; }
        ///
-       virtual bool UpdateInsetInInset(BufferView *, Inset *) {return false;}
+       virtual bool UpdateInsetInInset(BufferView *, Inset *)
+               { return false; }
        ///
-       virtual bool UnlockInsetInInset(BufferView *,Inset *,bool /*lr*/=false)
-               {return false;}
+       virtual bool UnlockInsetInInset(BufferView *, Inset *,
+                                       bool /*lr*/=false)
+               { return false; }
        ///  An updatable inset could handle lyx editing commands
-       virtual RESULT LocalDispatch(BufferView *, int, string);
+       virtual RESULT LocalDispatch(BufferView *, int, string const &);
        ///
        virtual bool isCursorVisible() const { return cursor_visible; }
        ///
        virtual int getMaxWidth(UpdatableInset *) const { return -1; }
-
 protected:
        ///
        // virtual void UpdateLocal(bool flag=true);
index 2f84e8359376d1c68a576ccfebb906b13cd457cd..31411e05936dd0862b6ad16e8e19678ef4d49c47 100644 (file)
@@ -548,7 +548,7 @@ string LyXFunc::Dispatch(int ac,
                                        inset->Edit(owner->view(),slx,sly,0); 
                                return string();
                        } else if (owner->view()->the_locking_inset->
-                                  LocalDispatch(owner->view(),action,
+                                  LocalDispatch(owner->view(), action,
                                                 argument) ==
                                   UpdatableInset::DISPATCHED)
                                return string();
@@ -2128,10 +2128,11 @@ string LyXFunc::Dispatch(int ac,
                if (owner->view()->available()) { 
                        owner->view()->
                                open_new_inset(new InsetFormula(false));
-                       owner->view()->
-                               the_locking_inset->LocalDispatch(owner->view(),
-                                                                action,
-                                                                argument.c_str());
+                       owner->view()
+                               ->the_locking_inset
+                               ->LocalDispatch(owner->view(),
+                                               action,
+                                               argument);
                }
        }          
        break;
index 0700701c6a7b45cf04ff591050b78f08decfaada..e2e957533a9a98fa98708e3ddd49fcf0ac7a018b 100644 (file)
@@ -712,8 +712,9 @@ bool InsetFormula::SetNumber(bool numbf)
 }
 
 
-UpdatableInset::RESULT InsetFormula::LocalDispatch(BufferView * bv,
-                                                  int action, string arg)
+UpdatableInset::RESULT
+InsetFormula::LocalDispatch(BufferView * bv,
+                           int action, string const & arg)
 {
 //   extern char *dispatch_result;
     MathedTextCodes varcode = LM_TC_MIN;       
index 06a5052751d343c7849b0e7bb49f0f12483ed3d3..551ab6b2c45d0bb991c26d45c9150e7671cb3a89 100644 (file)
@@ -99,7 +99,7 @@ public:
        void InsetUnlock(BufferView *);
    
        ///  To allow transparent use of math editing functions
-       virtual RESULT LocalDispatch(BufferView *, int, string);
+       virtual RESULT LocalDispatch(BufferView *, int, string const &);
     
        ///
        void InsertSymbol(BufferView *, char const *);
index d887fea0cbbb8e08aca601becb523f8dd9c51162..6bf138bf394e221c285ef8f5817234fbb6145c52 100644 (file)
@@ -193,8 +193,9 @@ void InsetFormulaMacro::InsetUnlock(BufferView * bv)
 }
 
 
-UpdatableInset::RESULT InsetFormulaMacro::LocalDispatch(BufferView * bv,
-                                                       int action, string arg)
+UpdatableInset::RESULT
+InsetFormulaMacro::LocalDispatch(BufferView * bv,
+                                int action, string const & arg)
 {
     if (action == LFUN_MATH_MACROARG) {
        int i = atoi(arg.c_str()) - 1;
index 988c7481e121c962d439453057165793b88ce744..9dd5f96fb4277f05cffe818ca88fb2e8a9dd5d60 100644 (file)
@@ -65,7 +65,7 @@ public:
        ///
        void InsetUnlock(BufferView *);
        ///
-       RESULT LocalDispatch(BufferView *, int, string);
+       RESULT LocalDispatch(BufferView *, int, string const &);
 
 protected:
        ///