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.
int InsetFormulaMacro::ascent(BufferView * pain, LyXFont const & f) const
{
if (opened_) {
int InsetFormulaMacro::ascent(BufferView * pain, LyXFont const & f) const
{
if (opened_) {
return InsetFormula::ascent(pain, f);
}
return lyxfont::maxAscent(f) + 3;
return InsetFormula::ascent(pain, f);
}
return lyxfont::maxAscent(f) + 3;
int InsetFormulaMacro::descent(BufferView * pain, LyXFont const & f) const
{
if (opened_) {
int InsetFormulaMacro::descent(BufferView * pain, LyXFont const & f) const
{
if (opened_) {
return InsetFormula::descent(pain, f);
}
return lyxfont::maxDescent(f) + 1;
return InsetFormula::descent(pain, f);
}
return lyxfont::maxDescent(f) + 1;
int InsetFormulaMacro::width(BufferView * bv, LyXFont const & f) const
{
if (opened_) {
int InsetFormulaMacro::width(BufferView * bv, LyXFont const & f) const
{
if (opened_) {
return InsetFormula::width(bv, f);
}
string ilabel(_("Macro: "));
return InsetFormula::width(bv, f);
}
string ilabel(_("Macro: "));
{
Painter & pain = bv->painter();
LyXFont font(f);
{
Painter & pain = bv->painter();
LyXFont font(f);
if (opened_) {
tmacro_->setEditMode(true);
InsetFormula::draw(bv, font, baseline, x, cleared);
if (opened_) {
tmacro_->setEditMode(true);
InsetFormula::draw(bv, font, baseline, x, cleared);
#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"
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) {
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);
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: