Cleanup headers

This commit is contained in:
Yuriy Skalko 2020-12-02 17:13:32 +02:00
parent efaffb897d
commit 9cb98136ce
17 changed files with 63 additions and 51 deletions

View File

@ -69,7 +69,6 @@
#include "insets/InsetBranch.h"
#include "insets/InsetInclude.h"
#include "insets/InsetTabular.h"
#include "insets/InsetText.h"
#include "mathed/InsetMathHull.h"

View File

@ -50,7 +50,9 @@
#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"

View File

@ -27,7 +27,9 @@
#include "ParagraphList.h"
#include "Text.h"
#include "mathed/InsetMath.h"
#include "mathed/MathData.h"
#include "mathed/MathRow.h"
#include "insets/InsetText.h"

View File

@ -18,7 +18,6 @@
#include "BufferParams.h"
#include "BufferView.h"
#include "Cursor.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
#include "Lexer.h"
@ -28,18 +27,15 @@
#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"

View File

@ -45,7 +45,6 @@
#include "xml.h"
#include "output_xhtml.h"
#include "Paragraph.h"
#include "ParagraphParameters.h"
#include "ParIterator.h"
#include "TexRow.h"
#include "texstream.h"

View File

@ -94,9 +94,9 @@ MathData const & InsetMath::cell(idx_type) const
}
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;
}
@ -104,7 +104,7 @@ bool InsetMath::addToMathRow(MathRow & mrow, MetricsInfo & mi) const
{
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;
}

View File

@ -50,6 +50,15 @@ enum Limits {
};
/// 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
@ -123,8 +132,6 @@ public:
/// 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;

View File

@ -58,7 +58,7 @@ public:
///
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;
///
@ -118,7 +118,7 @@ public:
///
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;
///

View File

@ -28,7 +28,7 @@ public:
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;
///

View File

@ -25,7 +25,7 @@ public:
///
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;
///

View File

@ -94,7 +94,7 @@ public:
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;
///

View File

@ -19,6 +19,7 @@
#include "MathCompletionList.h"
#include "MathExtern.h"
#include "MathFactory.h"
#include "MathRow.h"
#include "MathStream.h"
#include "MathSupport.h"
@ -74,7 +75,7 @@ public:
///
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
@ -352,7 +353,7 @@ bool InsetMathMacro::addToMathRow(MathRow & mrow, MetricsInfo & mi) const
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();
@ -371,7 +372,7 @@ bool InsetMathMacro::addToMathRow(MathRow & mrow, MetricsInfo & mi) const
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;
@ -544,29 +545,29 @@ bool InsetMathMacro::editMetrics(BufferView const * bv) const
}
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;
}

View File

@ -216,13 +216,13 @@ Inset * InsetDisplayLabelBox::clone() const
}
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;
}

View File

@ -15,9 +15,10 @@
#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"

View File

@ -16,8 +16,9 @@
#define MATH_DATA_H
#include "MathAtom.h"
#include "MathRow.h"
#include "MathClass.h"
#include "Dimension.h"
#include "OutputEnums.h"
#include "support/strfwd.h"
@ -33,13 +34,14 @@ class BufferView;
class Cursor;
class Dimension;
class DocIterator;
class LaTeXFeatures;
class ReplaceData;
class MacroContext;
class InsetMathMacro;
class LaTeXFeatures;
class MacroContext;
class MathRow;
class MetricsInfo;
class PainterInfo;
class ParIterator;
class ReplaceData;
class TextMetricsInfo;
class TextPainter;

View File

@ -20,6 +20,8 @@
#include "CoordCache.h"
#include "MetricsInfo.h"
#include "mathed/InsetMath.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
@ -37,7 +39,7 @@ namespace lyx {
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)
{}
@ -49,11 +51,11 @@ namespace {
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
@ -66,16 +68,16 @@ void afterMetricsMarkers(MetricsInfo const & , MathRow::Element & e,
{
// 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;
@ -93,7 +95,7 @@ void afterMetricsMarkers(MetricsInfo const & , MathRow::Element & e,
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();
@ -104,7 +106,7 @@ void drawMarkers(PainterInfo const & pi, MathRow::Element const & e,
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);
@ -132,8 +134,8 @@ void drawMarkers(PainterInfo const & pi, MathRow::Element const & e,
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);
@ -198,7 +200,7 @@ MathRow::MathRow(MetricsInfo & mi, MathData const * ar)
// 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));
}

View File

@ -12,7 +12,6 @@
#ifndef MATH_ROW_H
#define MATH_ROW_H
#include "InsetMath.h"
#include "MathClass.h"
#include "ColorCode.h"
@ -25,10 +24,12 @@
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
@ -67,7 +68,7 @@ public:
/// 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)