]> git.lyx.org Git - lyx.git/commitdiff
MathMacroTemplate::update cleanup
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 28 Feb 2001 17:51:28 +0000 (17:51 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 28 Feb 2001 17:51:28 +0000 (17:51 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1643 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/formulamacro.C
src/mathed/math_macrotemplate.C
src/mathed/math_macrotemplate.h

index 6f56fad288b838c68d21d665217c36065c6cf297..ab4b783cebfb1738f933ff5106b1ae21631faccf 100644 (file)
@@ -1,6 +1,14 @@
 2001-02-28  Lars Gullik Bjønnes  <larsbj@trylle.birdstep.com>
 
 2001-02-28  Lars Gullik Bjønnes  <larsbj@trylle.birdstep.com>
 
+       * math_macrotemplate.h: remove default arg on update
+
+       * math_macrotemplate.C (update): add assert and remove noop case.
+
        * formulamacro.C (Read): add comment.
        * formulamacro.C (Read): add comment.
+       (ascent): remove noop call to MathMacroTemplate
+       (descent): ditto
+       (width): ditto
+       (draw): ditto
 
        * math_parser.C (mathed_parse): fix another potential problem by
        passing a freestanding mathedarray.
 
        * math_parser.C (mathed_parse): fix another potential problem by
        passing a freestanding mathedarray.
index 54642dc8fb5f15b108e8a778aead146c1d778add..344457c48f84072d66c1203a50a8eaba25abd9d4 100644 (file)
@@ -128,7 +128,6 @@ void InsetFormulaMacro::Read(Buffer const *, LyXLex & lex)
 int InsetFormulaMacro::ascent(BufferView * pain, LyXFont const & f) const
 {
        if (opened_) {
 int InsetFormulaMacro::ascent(BufferView * pain, LyXFont const & f) const
 {
        if (opened_) {
-               tmacro_->update();
                return InsetFormula::ascent(pain, f);
        }
        return lyxfont::maxAscent(f) + 3;
                return InsetFormula::ascent(pain, f);
        }
        return lyxfont::maxAscent(f) + 3;
@@ -138,7 +137,6 @@ int InsetFormulaMacro::ascent(BufferView * pain, LyXFont const & f) const
 int InsetFormulaMacro::descent(BufferView * pain, LyXFont const & f) const
 {
        if (opened_) {
 int InsetFormulaMacro::descent(BufferView * pain, LyXFont const & f) const
 {
        if (opened_) {
-               tmacro_->update();
                return InsetFormula::descent(pain, f);
        }
        return lyxfont::maxDescent(f) + 1;
                return InsetFormula::descent(pain, f);
        }
        return lyxfont::maxDescent(f) + 1;
@@ -148,7 +146,6 @@ int InsetFormulaMacro::descent(BufferView * pain, LyXFont const & f) const
 int InsetFormulaMacro::width(BufferView * bv, LyXFont const & f) const
 {
        if (opened_) {
 int InsetFormulaMacro::width(BufferView * bv, LyXFont const & f) const
 {
        if (opened_) {
-               tmacro_->update();
                return InsetFormula::width(bv, f);
        }
        string ilabel(_("Macro: "));
                return InsetFormula::width(bv, f);
        }
        string ilabel(_("Macro: "));
@@ -162,7 +159,6 @@ void InsetFormulaMacro::draw(BufferView * bv, LyXFont const & f,
 {
        Painter & pain = bv->painter();
        LyXFont font(f);
 {
        Painter & pain = bv->painter();
        LyXFont font(f);
-       tmacro_->update();
        if (opened_) {
                tmacro_->setEditMode(true);
                InsetFormula::draw(bv, font, baseline, x, cleared);
        if (opened_) {
                tmacro_->setEditMode(true);
                InsetFormula::draw(bv, font, baseline, x, cleared);
index 1a640df8decaca8acc8775864b3aaea3371a2441..f2f2f7265f75e5f1971b2f589ece173245482329 100644 (file)
@@ -8,6 +8,7 @@
 #include "math_macro.h"
 #include "macro_support.h"
 #include "support/LOstream.h"
 #include "math_macro.h"
 #include "macro_support.h"
 #include "support/LOstream.h"
+#include "support/LAssert.h"
 
 using std::ostream;
 
 
 using std::ostream;
 
@@ -115,17 +116,15 @@ void MathMacroTemplate::Metrics()
 
 void MathMacroTemplate::update(MathMacro * macro)
 {
 
 void MathMacroTemplate::update(MathMacro * macro)
 {
-       int idx = (macro) ? macro->getArgumentIdx() : 0;
+       Assert(macro);
+       int idx = macro->getArgumentIdx();
        for (int i = 0; i < nargs_; ++i) {
        for (int i = 0; i < nargs_; ++i) {
-               if (macro) {
                        macro->setArgumentIdx(i);
                        args_[i].setData(macro->GetData());
                        MathedRowSt * row = macro->getRowSt();
                        args_[i].setRowSt(row);
                        macro->setArgumentIdx(i);
                        args_[i].setData(macro->GetData());
                        MathedRowSt * row = macro->getRowSt();
                        args_[i].setRowSt(row);
-               }
        }       
        }       
-       if (macro)
-               macro->setArgumentIdx(idx);
+       macro->setArgumentIdx(idx);
 }
 
 
 }
 
 
index 6552ac0b7e03e55446428c5d1bc60b5c3a061c4e..b351a4ff6e0b5df76a88b38e2d1fcffb85b06eed 100644 (file)
@@ -45,7 +45,7 @@ public:
        void setEditMode(bool);
        
        /// Replace the appropriate arguments with a specific macro's data
        void setEditMode(bool);
        
        /// Replace the appropriate arguments with a specific macro's data
-       void update(MathMacro * m = 0);
+       void update(MathMacro * m);
        ///
        short flags() const;
 private:
        ///
        short flags() const;
 private: