mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-15 23:49:37 +00:00
89662a6852
The goal of this patch is to be able to properly remove the space
needed for markers in the case of insets that are inside macros and do
not need these markers. This was attempted at 9a9a6a8
, but did not
work reliably.
To this end, the following simplifications are made:
* instead of drawing its own markers, each inset has a virtual method
marker() which prescribes either NO_MARKER, MARKER (normal bottom
marker) or MARKER2 (top and bottom marker). All explicit calls to
(draw|metrics)Markers(|2) are removed.
* the space necessary for the markers is now counted in the
before/above margins in the row structure. Therefore painting will
not happen at (x + 1, y), but just (x,y).
* the methods drawDecoration are removed.
* the helper methods InsetMath::(draw|metrics)Markers(|2) are removed
and replaced by a new function drawMarkers in MathRow.cpp.
Now the marker type is kept in the MathRow::Element object (and set to
NO_MARKER in not editable context) and the marker is accounted for in
MathRow::(metrics|draw).
Moreover, the extra pixel for the marker is taken on the before/After
space if possible. The marker will only require extra space when
before/after is 0.
See comment 168 of #8883 to understand what issues are fixed.
56 lines
902 B
C++
56 lines
902 B
C++
/**
|
|
* \file InsetMathClass.cpp
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author André Pönitz
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#include "InsetMathClass.h"
|
|
|
|
#include "support/docstream.h"
|
|
|
|
|
|
namespace lyx {
|
|
|
|
InsetMathClass::InsetMathClass(Buffer * buf, MathClass mc)
|
|
: InsetMathNest(buf, 1), math_class_(mc)
|
|
{}
|
|
|
|
|
|
Inset * InsetMathClass::clone() const
|
|
{
|
|
return new InsetMathClass(*this);
|
|
}
|
|
|
|
|
|
void InsetMathClass::metrics(MetricsInfo & mi, Dimension & dim) const
|
|
{
|
|
cell(0).metrics(mi, dim);
|
|
}
|
|
|
|
|
|
void InsetMathClass::draw(PainterInfo & pi, int x, int y) const
|
|
{
|
|
cell(0).draw(pi, x, y);
|
|
}
|
|
|
|
|
|
docstring InsetMathClass::name() const
|
|
{
|
|
return class_to_string(math_class_);
|
|
}
|
|
|
|
|
|
void InsetMathClass::infoize(odocstream & os) const
|
|
{
|
|
os << name() << " ";
|
|
}
|
|
|
|
|
|
} // namespace lyx
|