Next refactoring patches.
From 884c8270bc31208d150b444140b116374e78a479 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.ska...@gmail.com>
Date: Wed, 2 Dec 2020 00:16:55 +0200
Subject: [PATCH 1/4] Fix warnings and use range-based loop

---
 src/frontends/qt/Menus.cpp | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/frontends/qt/Menus.cpp b/src/frontends/qt/Menus.cpp
index 8437ace210..e567c64f36 100644
--- a/src/frontends/qt/Menus.cpp
+++ b/src/frontends/qt/Menus.cpp
@@ -1809,12 +1809,8 @@ void MenuDefinition::expandQuotes(BufferView const * bv)
        InsetQuotes const * qinset =
                static_cast<InsetQuotes const *>(inset);
 
-       map<string, docstring> styles = quoteparams.getTypes();
        string const qtype = qinset->getType();
 
-       map<string, docstring>::const_iterator qq = styles.begin();
-       map<string, docstring>::const_iterator end = styles.end();
-
        MenuDefinition aqs;
 
        BufferParams const & bp = bv->buffer().masterBuffer()->params();
@@ -1856,10 +1852,12 @@ void MenuDefinition::expandQuotes(BufferView const * bv)
                main_dynamic_qs = true;
        }
        // now traverse through the static styles ...
-       for (; qq != end; ++qq) {
-               docstring const style = from_ascii(qq->first);
-               bool langdef = (style[0] == langqs);
-               bool globaldef = (style[0] == globalqsc);
+       map<string, docstring> styles = quoteparams.getTypes();
+       for (auto const & s : styles) {
+               char style_char = (s.first)[0];
+               bool langdef = (style_char == langqs);
+               bool globaldef = (style_char == globalqsc);
+               docstring const style = from_ascii(s.first);
 
                if (prefixIs(style, qtype[0])) {
                        FuncRequest cmd = FuncRequest(LFUN_INSET_MODIFY, subcmd 
+ style);
-- 
2.28.0.windows.1

From 0e38e3acfc3a493a2de8c7a834b97906a9827293 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.ska...@gmail.com>
Date: Wed, 2 Dec 2020 14:23:01 +0200
Subject: [PATCH 2/4] Simplify FuncRequest constructors

---
 src/FuncRequest.cpp | 22 ++++++++--------------
 src/FuncRequest.h   | 16 ++++++++--------
 2 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/src/FuncRequest.cpp b/src/FuncRequest.cpp
index 0d6a487b8a..25ea41a82f 100644
--- a/src/FuncRequest.cpp
+++ b/src/FuncRequest.cpp
@@ -30,41 +30,35 @@ FuncRequest const FuncRequest::unknown(LFUN_UNKNOWN_ACTION);
 FuncRequest const FuncRequest::noaction(LFUN_NOACTION);
 
 FuncRequest::FuncRequest(Origin o)
-       : action_(LFUN_NOACTION), origin_(o), view_origin_(nullptr), x_(0), 
y_(0),
-         button_(mouse_button::none), modifier_(NoModifier), allow_async_(true)
+       : origin_(o)
 {}
 
 
 FuncRequest::FuncRequest(FuncCode act, Origin o)
-       : action_(act), origin_(o), view_origin_(nullptr), x_(0), y_(0),
-       button_(mouse_button::none), modifier_(NoModifier), allow_async_(true)
+       : action_(act), origin_(o)
 {}
 
 
 FuncRequest::FuncRequest(FuncCode act, docstring const & arg, Origin o)
-       : action_(act), argument_(arg), origin_(o), view_origin_(nullptr), 
x_(0), y_(0),
-         button_(mouse_button::none), modifier_(NoModifier), allow_async_(true)
+       : action_(act), argument_(arg), origin_(o)
 {}
 
 
 FuncRequest::FuncRequest(FuncCode act, string const & arg, Origin o)
-       : action_(act), argument_(from_utf8(arg)),
-         origin_(o), view_origin_(nullptr), x_(0), y_(0),
-         button_(mouse_button::none), modifier_(NoModifier), allow_async_(true)
+       : FuncRequest(act, from_utf8(arg), o)
 {}
 
 
 FuncRequest::FuncRequest(FuncCode act, int ax, int ay,
                         mouse_button::state button, KeyModifier modifier, 
Origin o)
-       : action_(act), origin_(o), view_origin_(nullptr), x_(ax), y_(ay),
-         button_(button), modifier_(modifier), allow_async_(true)
+       : action_(act), origin_(o),
+         x_(ax), y_(ay), button_(button), modifier_(modifier)
 {}
 
 
 FuncRequest::FuncRequest(FuncRequest const & cmd, docstring const & arg, 
Origin o)
-       : action_(cmd.action()), argument_(arg),
-         origin_(o), view_origin_(nullptr), x_(cmd.x_), y_(cmd.y_),
-         button_(cmd.button_), modifier_(NoModifier), allow_async_(true)
+       : action_(cmd.action()), argument_(arg), origin_(o),
+         x_(cmd.x_), y_(cmd.y_), button_(cmd.button_)
 {}
 
 
diff --git a/src/FuncRequest.h b/src/FuncRequest.h
index 19f571a091..52fb1434aa 100644
--- a/src/FuncRequest.h
+++ b/src/FuncRequest.h
@@ -105,25 +105,25 @@ public:
 
 private:
        /// the action
-       FuncCode action_;
+       FuncCode action_ = LFUN_NOACTION;
        /// the action's string argument
        docstring argument_;
        /// who initiated the action
-       Origin origin_;
+       Origin origin_ = INTERNAL;
        /// to which view should be this command sent (see bug #11004)
        /// NULL=current view
-       frontend::GuiView* view_origin_;
+       frontend::GuiView* view_origin_ = nullptr;
        /// the x coordinate of a mouse press
-       int x_;
+       int x_ = 0;
        /// the y coordinate of a mouse press
-       int y_;
+       int y_ = 0;
        /// some extra information (like button number)
-       mouse_button::state button_;
+       mouse_button::state button_ = mouse_button::none;
        ///
-       KeyModifier modifier_;
+       KeyModifier modifier_ = NoModifier;
        /// Commands should be run synchronously when they
        /// are launched via "command-sequence" or "repeat" or "buffer-forall"
-       bool allow_async_;
+       bool allow_async_ = true;
 };
 
 
-- 
2.28.0.windows.1

From 897b48828b0e61ec6809c8b3eef9bd62143eda05 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.ska...@gmail.com>
Date: Wed, 2 Dec 2020 14:45:14 +0200
Subject: [PATCH 3/4] Simplify InsetMathGrid structs

---
 src/mathed/InsetMathGrid.cpp | 26 -------------------------
 src/mathed/InsetMathGrid.h   | 37 ++++++++++++++----------------------
 2 files changed, 14 insertions(+), 49 deletions(-)

diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp
index 7158df2e43..260d61ef8b 100644
--- a/src/mathed/InsetMathGrid.cpp
+++ b/src/mathed/InsetMathGrid.cpp
@@ -78,41 +78,15 @@ static void resetGrid(InsetMathGrid & grid)
 }
 
 
-
-//////////////////////////////////////////////////////////////
-
-
-InsetMathGrid::CellInfo::CellInfo()
-       : multi(CELL_NORMAL)
-{}
-
-
-
 //////////////////////////////////////////////////////////////
 
 
-InsetMathGrid::RowInfo::RowInfo()
-       : descent(0), ascent(0), lines(0), skip(0),
-         allow_newpage(true)
-{}
-
-
-
 int InsetMathGrid::RowInfo::skipPixels(MetricsInfo const & mi) const
 {
        return mi.base.inPixels(crskip);
 }
 
 
-
-//////////////////////////////////////////////////////////////
-
-
-InsetMathGrid::ColInfo::ColInfo()
-       : align('c'), width(0), offset(0), lines(0), skip(0)
-{}
-
-
 //////////////////////////////////////////////////////////////
 
 
diff --git a/src/mathed/InsetMathGrid.h b/src/mathed/InsetMathGrid.h
index df83449191..cf24dcffd1 100644
--- a/src/mathed/InsetMathGrid.h
+++ b/src/mathed/InsetMathGrid.h
@@ -39,54 +39,45 @@ public:
        };
 
        /// additional per-cell information
-       class CellInfo {
-       public:
-               ///
-               CellInfo();
+       struct CellInfo {
                /// multicolumn flag
-               Multicolumn multi;
+               Multicolumn multi = CELL_NORMAL;
                /// special multi columns alignment
                docstring align;
        };
 
        /// additional per-row information
-       class RowInfo {
-       public:
-               ///
-               RowInfo();
+       struct RowInfo {
                ///
                int skipPixels(MetricsInfo const & mi) const;
                /// cached descent
-               mutable int descent;
+               mutable int descent = 0;
                /// cached ascent
-               mutable int ascent;
+               mutable int ascent = 0;
                /// cached offset for each bufferview
                mutable std::map<BufferView const *, int> offset;
                /// how many hlines above this row?
-               unsigned int lines;
+               unsigned int lines = 0;
                /// parameter to the line break
                Length crskip;
                /// extra distance between lines
-               int skip;
+               int skip = 0;
                /// Is a page break allowed after this row?
-               bool allow_newpage;
+               bool allow_newpage = true;
        };
 
        // additional per-row information
-       class ColInfo {
-       public:
-               ///
-               ColInfo();
+       struct ColInfo {
                /// currently possible: 'l', 'c', 'r'
-               char align;
+               char align = 'c';
                /// cached width
-               mutable int width;
+               mutable int width = 0;
                /// cached offset
-               mutable int offset;
+               mutable int offset = 0;
                /// how many lines to the left of this column?
-               unsigned int lines;
+               unsigned int lines = 0;
                /// additional amount to the right to be skipped when drawing
-               int skip;
+               int skip = 0;
                /// Special alignment.
                /// This does also contain align_ and lines_ if it is nonempty.
                /// It needs to be in sync with align_ and lines_ because some
-- 
2.28.0.windows.1

From 94e702b75f595dec08dd02eafa3592de4b90f7b1 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.ska...@gmail.com>
Date: Wed, 2 Dec 2020 17:13:32 +0200
Subject: [PATCH 4/4] 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 0d5de8c78c..4f397efc5e 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 ea841a0554..feff1a58b0 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 c6b7eaa331..ebe2350b79 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 8d9d174e16..67ff5fc6b6 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 53d9ac1ae5..181e68cb7c 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 40cb906606..d12474f249 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 9a970c5839..220795695d 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 0a8bf74cd2..93d8954a2e 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 47ed450a58..0c96a25d7f 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 0ced11473a..c8c65da9bd 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 cf24dcffd1..dd61efd71a 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 1e29fa54a6..c35226fd6c 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 7f43586513..7b24784ae9 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 610a3e20eb..b4cbfe4ddd 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 c27b9f58d6..0afaf182c3 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 16b64c6b7f..b8a9a9518b 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 6d929ca947..9efab92e85 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)
-- 
2.28.0.windows.1

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to