mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 13:04:58 +00:00
* 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:
parent
954be90e11
commit
370d7890a3
@ -44,6 +44,8 @@ public:
|
|||||||
bool metrics(MetricsInfo & mi, Dimension & dim) const;
|
bool metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo &, int x, int y) const;
|
void draw(PainterInfo &, int x, int y) const;
|
||||||
|
///
|
||||||
|
int kerning() const { return mathMacro_.cell(idx_).kerning(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::auto_ptr<Inset> doClone() const;
|
std::auto_ptr<Inset> doClone() const;
|
||||||
@ -65,7 +67,6 @@ bool MathMacroArgumentValue::metrics(MetricsInfo & mi, Dimension & dim) const
|
|||||||
macro.unlock();
|
macro.unlock();
|
||||||
mathMacro_.cell(idx_).metrics(mi, dim);
|
mathMacro_.cell(idx_).metrics(mi, dim);
|
||||||
macro.lock();
|
macro.lock();
|
||||||
metricsMarkers2(dim);
|
|
||||||
if (dim_ == dim)
|
if (dim_ == dim)
|
||||||
return false;
|
return false;
|
||||||
dim_ = dim;
|
dim_ = dim;
|
||||||
@ -114,6 +115,7 @@ void MathMacro::cursorPos(BufferView const & bv,
|
|||||||
|
|
||||||
bool MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
|
bool MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
|
kerning_ = 0;
|
||||||
if (!MacroTable::globalMacros().has(name())) {
|
if (!MacroTable::globalMacros().has(name())) {
|
||||||
mathed_string_dim(mi.base.font, "Unknown: " + name(), dim);
|
mathed_string_dim(mi.base.font, "Unknown: " + name(), dim);
|
||||||
} else {
|
} else {
|
||||||
@ -143,10 +145,10 @@ bool MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
|
|||||||
macro.lock();
|
macro.lock();
|
||||||
expanded_.metrics(mi, dim);
|
expanded_.metrics(mi, dim);
|
||||||
macro.unlock();
|
macro.unlock();
|
||||||
|
kerning_ = expanded_.kerning();
|
||||||
editing_ = false;
|
editing_ = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
metricsMarkers2(dim);
|
|
||||||
if (dim_ == dim)
|
if (dim_ == dim)
|
||||||
return false;
|
return false;
|
||||||
dim_ = dim;
|
dim_ = dim;
|
||||||
@ -199,7 +201,6 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const
|
|||||||
if (editing_ != editing(pi.base.bv) || macroBackup_ != macro)
|
if (editing_ != editing(pi.base.bv) || macroBackup_ != macro)
|
||||||
pi.base.bv->cursor().updateFlags(Update::Force);
|
pi.base.bv->cursor().updateFlags(Update::Force);
|
||||||
}
|
}
|
||||||
drawMarkers2(pi, x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,6 +54,8 @@ public:
|
|||||||
///
|
///
|
||||||
docstring name() const;
|
docstring name() const;
|
||||||
///
|
///
|
||||||
|
int kerning() const { return kerning_; }
|
||||||
|
///
|
||||||
void setExpansion(MathData const & exp, MathData const & args) const;
|
void setExpansion(MathData const & exp, MathData const & args) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -85,6 +87,8 @@ private:
|
|||||||
mutable MacroData macroBackup_;
|
mutable MacroData macroBackup_;
|
||||||
///
|
///
|
||||||
mutable bool editing_;
|
mutable bool editing_;
|
||||||
|
///
|
||||||
|
mutable int kerning_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user