* Added the kerning method to a macro to inherit the kerning from the expanded form.

* Moreover the marker metrics calls are removed as they are not drawn anyway.
(fixes #3705)


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18792 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Stefan Schimanski 2007-06-15 18:26:35 +00:00
parent 954be90e11
commit 370d7890a3
2 changed files with 8 additions and 3 deletions

View File

@ -44,6 +44,8 @@ public:
bool metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo &, int x, int y) const;
///
int kerning() const { return mathMacro_.cell(idx_).kerning(); }
private:
std::auto_ptr<Inset> doClone() const;
@ -65,7 +67,6 @@ bool MathMacroArgumentValue::metrics(MetricsInfo & mi, Dimension & dim) const
macro.unlock();
mathMacro_.cell(idx_).metrics(mi, dim);
macro.lock();
metricsMarkers2(dim);
if (dim_ == dim)
return false;
dim_ = dim;
@ -114,6 +115,7 @@ void MathMacro::cursorPos(BufferView const & bv,
bool MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
{
kerning_ = 0;
if (!MacroTable::globalMacros().has(name())) {
mathed_string_dim(mi.base.font, "Unknown: " + name(), dim);
} else {
@ -143,10 +145,10 @@ bool MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
macro.lock();
expanded_.metrics(mi, dim);
macro.unlock();
kerning_ = expanded_.kerning();
editing_ = false;
}
}
metricsMarkers2(dim);
if (dim_ == dim)
return false;
dim_ = dim;
@ -199,7 +201,6 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const
if (editing_ != editing(pi.base.bv) || macroBackup_ != macro)
pi.base.bv->cursor().updateFlags(Update::Force);
}
drawMarkers2(pi, x, y);
}

View File

@ -54,6 +54,8 @@ public:
///
docstring name() const;
///
int kerning() const { return kerning_; }
///
void setExpansion(MathData const & exp, MathData const & args) const;
///
@ -85,6 +87,8 @@ private:
mutable MacroData macroBackup_;
///
mutable bool editing_;
///
mutable int kerning_;
};