#include "insets/InsetBranch.h"
#include "insets/InsetInclude.h"
-#include "insets/InsetTabular.h"
#include "insets/InsetText.h"
#include "mathed/InsetMathHull.h"
#include "insets/InsetRef.h"
#include "insets/InsetText.h"
+#include "mathed/InsetMath.h"
#include "mathed/MathData.h"
+#include "mathed/MathRow.h"
#include "frontends/alert.h"
#include "frontends/CaretGeometry.h"
#include "ParagraphList.h"
#include "Text.h"
+#include "mathed/InsetMath.h"
#include "mathed/MathData.h"
+#include "mathed/MathRow.h"
#include "insets/InsetText.h"
#include "BufferParams.h"
#include "BufferView.h"
#include "Cursor.h"
-#include "DispatchResult.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
#include "Lexer.h"
#include "insets/InsetBox.h"
#include "insets/InsetBranch.h"
-#include "insets/InsetCommand.h"
#include "insets/InsetERT.h"
#include "insets/InsetExternal.h"
#include "insets/InsetFloat.h"
#include "insets/InsetGraphics.h"
#include "insets/InsetIndex.h"
-#include "insets/InsetLine.h"
#include "insets/InsetListings.h"
#include "insets/InsetNote.h"
#include "insets/InsetPhantom.h"
#include "insets/InsetSpace.h"
-#include "insets/InsetTabular.h"
#include "insets/InsetVSpace.h"
#include "insets/InsetWrap.h"
#include "xml.h"
#include "output_xhtml.h"
#include "Paragraph.h"
-#include "ParagraphParameters.h"
#include "ParIterator.h"
#include "TexRow.h"
#include "texstream.h"
}
-InsetMath::marker_type InsetMath::marker(BufferView const *) const
+marker_type InsetMath::marker(BufferView const *) const
{
- return nargs() > 0 ? MARKER : NO_MARKER;
+ return nargs() > 0 ? marker_type::MARKER : marker_type::NO_MARKER;
}
{
MathRow::Element e(mi, MathRow::INSET, mathClass());
e.inset = this;
- e.marker = mi.base.macro_nesting ? NO_MARKER : marker(mi.base.bv);
+ e.marker = mi.base.macro_nesting ? marker_type::NO_MARKER : marker(mi.base.bv);
mrow.push_back(e);
return true;
}
};
+/// The possible marker types for math insets
+enum class marker_type : int {
+ NO_MARKER,
+ MARKER2,
+ MARKER,
+ BOX_MARKER
+};
+
+
/**
Abstract base class for all math objects. A math insets is for use of the
/// this is overridden by specific insets
mode_type currentMode() const override { return MATH_MODE; }
- // The possible marker types for math insets
- enum marker_type { NO_MARKER, MARKER2, MARKER, BOX_MARKER };
/// this is overridden by insets with specific edit marker type
virtual marker_type marker(BufferView const *) const;
///
mode_type currentMode() const override { return TEXT_MODE; }
///
- marker_type marker(BufferView const *) const override { return NO_MARKER; }
+ marker_type marker(BufferView const *) const override { return marker_type::NO_MARKER; }
///
void metrics(MetricsInfo & mi, Dimension & dim) const override;
///
///
explicit InsetMathBoxed(Buffer * buf);
///
- marker_type marker(BufferView const *) const override { return NO_MARKER; }
+ marker_type marker(BufferView const *) const override { return marker_type::NO_MARKER; }
///
void validate(LaTeXFeatures & features) const override;
///
explicit InsetMathCommand(Buffer * buf, docstring const & name,
bool needs_math_mode = true);
///
- marker_type marker(BufferView const *) const override { return NO_MARKER; }
+ marker_type marker(BufferView const *) const override { return marker_type::NO_MARKER; }
///
void metrics(MetricsInfo & mi, Dimension & dim) const override;
///
///
InsetMathFracBase(Buffer * buf, idx_type ncells = 2);
///
- marker_type marker(BufferView const *) const override { return MARKER2; }
+ marker_type marker(BufferView const *) const override { return marker_type::MARKER2; }
///
bool idxUpDown(Cursor &, bool up) const override;
///
InsetMathGrid(Buffer * buf, col_type m, row_type n, char valign,
docstring const & halign);
///
- marker_type marker(BufferView const *) const override { return MARKER2; };
+ marker_type marker(BufferView const *) const override { return marker_type::MARKER2; };
///
void metrics(MetricsInfo & mi, Dimension &) const override;
///
#include "MathCompletionList.h"
#include "MathExtern.h"
#include "MathFactory.h"
+#include "MathRow.h"
#include "MathStream.h"
#include "MathSupport.h"
///
InsetMathMacro const * owner() { return mathMacro_; }
///
- marker_type marker(BufferView const *) const override { return NO_MARKER; }
+ marker_type marker(BufferView const *) const override { return marker_type::NO_MARKER; }
///
InsetCode lyxCode() const override { return ARGUMENT_PROXY_CODE; }
/// The math data to use for display
MathRow::Element e_beg(mi, MathRow::BEGIN);
e_beg.inset = this;
- e_beg.marker = (d->nesting_ == 1) ? marker(mi.base.bv) : NO_MARKER;
+ e_beg.marker = (d->nesting_ == 1) ? marker(mi.base.bv) : marker_type::NO_MARKER;
mrow.push_back(e_beg);
d->macro_->lock();
MathRow::Element e_end(mi, MathRow::END);
e_end.inset = this;
- e_end.marker = (d->nesting_ == 1) ? marker(mi.base.bv) : NO_MARKER;
+ e_end.marker = (d->nesting_ == 1) ? marker(mi.base.bv) : marker_type::NO_MARKER;
mrow.push_back(e_end);
return has_contents;
}
-InsetMath::marker_type InsetMathMacro::marker(BufferView const * bv) const
+marker_type InsetMathMacro::marker(BufferView const * bv) const
{
if (nargs() == 0)
- return NO_MARKER;
+ return marker_type::NO_MARKER;
switch (d->displayMode_) {
case DISPLAY_INIT:
case DISPLAY_INTERACTIVE_INIT:
- return NO_MARKER;
+ return marker_type::NO_MARKER;
case DISPLAY_UNFOLDED:
- return MARKER;
+ return marker_type::MARKER;
case DISPLAY_NORMAL:
switch (lyxrc.macro_edit_style) {
case LyXRC::MACRO_EDIT_INLINE:
- return MARKER2;
+ return marker_type::MARKER2;
case LyXRC::MACRO_EDIT_INLINE_BOX:
- return d->editing_[bv] ? BOX_MARKER : MARKER2;
+ return d->editing_[bv] ? marker_type::BOX_MARKER : marker_type::MARKER2;
case LyXRC::MACRO_EDIT_LIST:
- return MARKER2;
+ return marker_type::MARKER2;
}
}
// please gcc 4.6
- return NO_MARKER;
+ return marker_type::NO_MARKER;
}
}
-InsetMath::marker_type InsetDisplayLabelBox::marker(BufferView const * bv) const
+marker_type InsetDisplayLabelBox::marker(BufferView const * bv) const
{
if (parent_.editing(bv)
|| !parent_.cell(parent_.displayIdx()).empty())
- return MARKER;
+ return marker_type::MARKER;
else
- return NO_MARKER;
+ return marker_type::NO_MARKER;
}
#include "InsetMathBrace.h"
#include "InsetMathFont.h"
+#include "InsetMathMacro.h"
#include "InsetMathScript.h"
#include "MacroTable.h"
-#include "InsetMathMacro.h"
+#include "MathRow.h"
#include "MathStream.h"
#include "MathSupport.h"
#include "MetricsInfo.h"
#define MATH_DATA_H
#include "MathAtom.h"
-#include "MathRow.h"
+#include "MathClass.h"
+#include "Dimension.h"
#include "OutputEnums.h"
#include "support/strfwd.h"
class Cursor;
class Dimension;
class DocIterator;
+class InsetMathMacro;
class LaTeXFeatures;
-class ReplaceData;
class MacroContext;
-class InsetMathMacro;
+class MathRow;
class MetricsInfo;
class PainterInfo;
class ParIterator;
+class ReplaceData;
class TextMetricsInfo;
class TextPainter;
#include "CoordCache.h"
#include "MetricsInfo.h"
+#include "mathed/InsetMath.h"
+
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
MathRow::Element::Element(MetricsInfo const & mi, Type t, MathClass mc)
: type(t), mclass(mc), before(0), after(0), macro_nesting(mi.base.macro_nesting),
- marker(InsetMath::NO_MARKER), inset(nullptr), compl_unique_to(0), ar(nullptr),
+ marker(marker_type::NO_MARKER), inset(nullptr), compl_unique_to(0), ar(nullptr),
color(Color_red)
{}
int markerMargin(MathRow::Element const & e)
{
switch(e.marker) {
- case InsetMath::MARKER:
- case InsetMath::MARKER2:
- case InsetMath::BOX_MARKER:
+ case marker_type::MARKER:
+ case marker_type::MARKER2:
+ case marker_type::BOX_MARKER:
return 2;
- case InsetMath::NO_MARKER:
+ case marker_type::NO_MARKER:
return 0;
}
// should not happen
{
// handle vertical space for markers
switch(e.marker) {
- case InsetMath::NO_MARKER:
+ case marker_type::NO_MARKER:
break;
- case InsetMath::MARKER:
+ case marker_type::MARKER:
++dim.des;
break;
- case InsetMath::MARKER2:
+ case marker_type::MARKER2:
++dim.asc;
++dim.des;
break;
- case InsetMath::BOX_MARKER:
+ case marker_type::BOX_MARKER:
FontInfo font;
font.setSize(TINY_SIZE);
Dimension namedim;
void drawMarkers(PainterInfo const & pi, MathRow::Element const & e,
int const x, int const y)
{
- if (e.marker == InsetMath::NO_MARKER)
+ if (e.marker == marker_type::NO_MARKER)
return;
CoordCache const & coords = pi.base.bv->coordCache();
int const r = x + dim.width() - e.after;
// Grey lower box
- if (e.marker == InsetMath::BOX_MARKER) {
+ if (e.marker == marker_type::BOX_MARKER) {
// draw header and rectangle around
FontInfo font;
font.setSize(TINY_SIZE);
pi.pain.line(r - 3, d, r, d, pen_color);
// Upper corners
- if (e.marker == InsetMath::BOX_MARKER
- || e.marker == InsetMath::MARKER2) {
+ if (e.marker == marker_type::BOX_MARKER
+ || e.marker == marker_type::MARKER2) {
int const a = y - dim.ascent();
pi.pain.line(l, a + 3, l, a, pen_color);
pi.pain.line(r, a + 3, r, a, pen_color);
// for linearized insets (macros...) too
if (e.type == BEGIN)
bef.after = max(bef.after, markerMargin(e));
- if (e.type == END && e.marker != InsetMath::NO_MARKER) {
+ if (e.type == END && e.marker != marker_type::NO_MARKER) {
Element & aft = elements_[after(i)];
aft.before = max(aft.before, markerMargin(e));
}
#ifndef MATH_ROW_H
#define MATH_ROW_H
-#include "InsetMath.h"
#include "MathClass.h"
#include "ColorCode.h"
namespace lyx {
class BufferView;
+class InsetMath;
class MathData;
class MetricsInfo;
class PainterInfo;
+enum class marker_type : int;
/*
* While for editing purpose it is important that macros are counted
/// count whether the current mathdata is nested in macro(s)
int macro_nesting;
/// Marker type
- InsetMath::marker_type marker;
+ marker_type marker;
/// When type is INSET
/// the math inset (also for BEGIN and END)