[LyX/master] Cleanup headers

Yuriy Skalko yuriy.skalko at gmail.com
Wed Dec 2 22:09:57 UTC 2020


commit 9cb98136ceeb3fbda70aa5beea4cf3f5ea26a36c
Author: Yuriy Skalko <yuriy.skalko at gmail.com>
Date:   Wed Dec 2 17:13:32 2020 +0200

    Cleanup headers
---
 src/Buffer.cpp                        |    1 -
 src/BufferView.cpp                    |    2 ++
 src/Undo.cpp                          |    2 ++
 src/insets/InsetCommand.cpp           |    4 ----
 src/insets/InsetTabular.cpp           |    1 -
 src/mathed/InsetMath.cpp              |    6 +++---
 src/mathed/InsetMath.h                |   11 +++++++++--
 src/mathed/InsetMathBox.h             |    4 ++--
 src/mathed/InsetMathCommand.h         |    2 +-
 src/mathed/InsetMathFrac.h            |    2 +-
 src/mathed/InsetMathGrid.h            |    2 +-
 src/mathed/InsetMathMacro.cpp         |   23 ++++++++++++-----------
 src/mathed/InsetMathMacroTemplate.cpp |    6 +++---
 src/mathed/MathData.cpp               |    3 ++-
 src/mathed/MathData.h                 |    8 +++++---
 src/mathed/MathRow.cpp                |   30 ++++++++++++++++--------------
 src/mathed/MathRow.h                  |    5 +++--
 17 files changed, 62 insertions(+), 50 deletions(-)

diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 0d5de8c..4f397ef 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -69,7 +69,6 @@
 
 #include "insets/InsetBranch.h"
 #include "insets/InsetInclude.h"
-#include "insets/InsetTabular.h"
 #include "insets/InsetText.h"
 
 #include "mathed/InsetMathHull.h"
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index f7567bd..758a992 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -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"
diff --git a/src/Undo.cpp b/src/Undo.cpp
index c6b7eaa..ebe2350 100644
--- a/src/Undo.cpp
+++ b/src/Undo.cpp
@@ -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"
 
diff --git a/src/insets/InsetCommand.cpp b/src/insets/InsetCommand.cpp
index 8d9d174..67ff5fc 100644
--- a/src/insets/InsetCommand.cpp
+++ b/src/insets/InsetCommand.cpp
@@ -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"
 
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 53d9ac1..181e68c 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -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"
diff --git a/src/mathed/InsetMath.cpp b/src/mathed/InsetMath.cpp
index 40cb906..d12474f 100644
--- a/src/mathed/InsetMath.cpp
+++ b/src/mathed/InsetMath.cpp
@@ -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;
 }
diff --git a/src/mathed/InsetMath.h b/src/mathed/InsetMath.h
index 9a970c5..2207956 100644
--- a/src/mathed/InsetMath.h
+++ b/src/mathed/InsetMath.h
@@ -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;
 
diff --git a/src/mathed/InsetMathBox.h b/src/mathed/InsetMathBox.h
index 0a8bf74..93d8954 100644
--- a/src/mathed/InsetMathBox.h
+++ b/src/mathed/InsetMathBox.h
@@ -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;
 	///
diff --git a/src/mathed/InsetMathCommand.h b/src/mathed/InsetMathCommand.h
index 47ed450..0c96a25 100644
--- a/src/mathed/InsetMathCommand.h
+++ b/src/mathed/InsetMathCommand.h
@@ -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;
 	///
diff --git a/src/mathed/InsetMathFrac.h b/src/mathed/InsetMathFrac.h
index 0ced114..c8c65da 100644
--- a/src/mathed/InsetMathFrac.h
+++ b/src/mathed/InsetMathFrac.h
@@ -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;
 	///
diff --git a/src/mathed/InsetMathGrid.h b/src/mathed/InsetMathGrid.h
index cf24dcf..dd61efd 100644
--- a/src/mathed/InsetMathGrid.h
+++ b/src/mathed/InsetMathGrid.h
@@ -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;
 	///
diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp
index 1e29fa5..c35226f 100644
--- a/src/mathed/InsetMathMacro.cpp
+++ b/src/mathed/InsetMathMacro.cpp
@@ -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;
 }
 
 
diff --git a/src/mathed/InsetMathMacroTemplate.cpp b/src/mathed/InsetMathMacroTemplate.cpp
index 7f43586..7b24784 100644
--- a/src/mathed/InsetMathMacroTemplate.cpp
+++ b/src/mathed/InsetMathMacroTemplate.cpp
@@ -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;
 }
 
 
diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp
index 610a3e2..b4cbfe4 100644
--- a/src/mathed/MathData.cpp
+++ b/src/mathed/MathData.cpp
@@ -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"
diff --git a/src/mathed/MathData.h b/src/mathed/MathData.h
index c27b9f5..0afaf18 100644
--- a/src/mathed/MathData.h
+++ b/src/mathed/MathData.h
@@ -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 InsetMathMacro;
 class LaTeXFeatures;
-class ReplaceData;
 class MacroContext;
-class InsetMathMacro;
+class MathRow;
 class MetricsInfo;
 class PainterInfo;
 class ParIterator;
+class ReplaceData;
 class TextMetricsInfo;
 class TextPainter;
 
diff --git a/src/mathed/MathRow.cpp b/src/mathed/MathRow.cpp
index 16b64c6..b8a9a95 100644
--- a/src/mathed/MathRow.cpp
+++ b/src/mathed/MathRow.cpp
@@ -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));
 		}
diff --git a/src/mathed/MathRow.h b/src/mathed/MathRow.h
index 6d929ca..9efab92 100644
--- a/src/mathed/MathRow.h
+++ b/src/mathed/MathRow.h
@@ -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)


More information about the lyx-cvs mailing list