MathMacroTemplate::update cleanup

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1643 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-02-28 17:51:28 +00:00
parent 4203d759ad
commit bb2aa47875
4 changed files with 13 additions and 10 deletions

View File

@ -1,6 +1,14 @@
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.
(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.

View File

@ -128,7 +128,6 @@ void InsetFormulaMacro::Read(Buffer const *, LyXLex & lex)
int InsetFormulaMacro::ascent(BufferView * pain, LyXFont const & f) const
{
if (opened_) {
tmacro_->update();
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_) {
tmacro_->update();
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_) {
tmacro_->update();
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);
tmacro_->update();
if (opened_) {
tmacro_->setEditMode(true);
InsetFormula::draw(bv, font, baseline, x, cleared);

View File

@ -8,6 +8,7 @@
#include "math_macro.h"
#include "macro_support.h"
#include "support/LOstream.h"
#include "support/LAssert.h"
using std::ostream;
@ -115,16 +116,14 @@ void MathMacroTemplate::Metrics()
void MathMacroTemplate::update(MathMacro * macro)
{
int idx = (macro) ? macro->getArgumentIdx() : 0;
Assert(macro);
int idx = macro->getArgumentIdx();
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);
}
}
if (macro)
macro->setArgumentIdx(idx);
}

View File

@ -45,7 +45,7 @@ public:
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: