commit e292dd70bf615d5dcc6b20a581ba1b71db0ee4a8
Author: Yuriy Skalko <yuriy.ska...@gmail.com>
Date:   Wed Dec 2 22:34:28 2020 +0200

    More enums & includes refactoring
---
 src/Changes.cpp                     |    1 +
 src/Changes.h                       |    3 +-
 src/Cursor.cpp                      |    1 +
 src/Layout.cpp                      |    3 --
 src/ParagraphMetrics.cpp            |    1 -
 src/Text.cpp                        |    4 +--
 src/Text3.cpp                       |    6 ++--
 src/frontends/qt/FindAndReplace.cpp |    4 --
 src/frontends/qt/GuiParagraph.cpp   |    1 +
 src/frontends/qt/GuiToolbar.cpp     |    6 ++--
 src/frontends/qt/Menus.cpp          |   10 +++---
 src/frontends/qt/qt_helpers.cpp     |   13 +-------
 src/insets/Inset.cpp                |    7 ++++
 src/insets/Inset.h                  |    4 +-
 src/insets/InsetArgument.cpp        |    9 +++--
 src/insets/InsetArgument.h          |    4 +-
 src/insets/InsetBranch.cpp          |    2 +-
 src/insets/InsetCollapsible.cpp     |   50 +++++++++++++++++++++++--------
 src/insets/InsetCollapsible.h       |   15 +++++----
 src/insets/InsetERT.cpp             |    7 ++--
 src/insets/InsetFlex.cpp            |   14 ++++----
 src/insets/InsetFlex.h              |    3 +-
 src/insets/InsetIPAMacro.cpp        |    3 +-
 src/insets/InsetLayout.cpp          |   38 ++++++++++++------------
 src/insets/InsetLayout.h            |   56 ++++++++++++++++++-----------------
 src/insets/InsetListings.cpp        |    8 ++---
 src/insets/InsetNomencl.cpp         |    1 +
 src/insets/InsetNote.cpp            |    5 +--
 src/insets/InsetQuotes.h            |    2 +-
 src/insets/InsetScript.h            |    1 +
 src/insets/InsetText.cpp            |   43 +++++++++++++++++++++++----
 src/insets/InsetText.h              |   14 ++++-----
 src/mathed/InsetMathSize.h          |    1 +
 src/mathed/MathFactory.cpp          |    1 +
 src/output_latex.h                  |    1 -
 src/tex2lyx/tex2lyx.cpp             |    1 -
 36 files changed, 196 insertions(+), 147 deletions(-)

diff --git a/src/Changes.cpp b/src/Changes.cpp
index e1c7515..33209af 100644
--- a/src/Changes.cpp
+++ b/src/Changes.cpp
@@ -17,6 +17,7 @@
 #include "Author.h"
 #include "Buffer.h"
 #include "BufferParams.h"
+#include "Color.h"
 #include "Encoding.h"
 #include "LyXRC.h"
 #include "MetricsInfo.h"
diff --git a/src/Changes.h b/src/Changes.h
index da9fef2..d538875 100644
--- a/src/Changes.h
+++ b/src/Changes.h
@@ -15,8 +15,6 @@
 #ifndef CHANGES_H
 #define CHANGES_H
 
-#include "Color.h"
-
 #include "support/strfwd.h"
 #include "support/types.h"
 #include "support/lyxtime.h"
@@ -28,6 +26,7 @@ namespace lyx {
 
 class AuthorList;
 class Buffer;
+class Color;
 class DocIterator;
 class FontInfo;
 class OutputParams;
diff --git a/src/Cursor.cpp b/src/Cursor.cpp
index ee54ace..b250b7b 100644
--- a/src/Cursor.cpp
+++ b/src/Cursor.cpp
@@ -38,6 +38,7 @@
 #include "support/gettext.h"
 #include "support/lassert.h"
 
+#include "insets/InsetLayout.h"
 #include "insets/InsetTabular.h"
 
 #include "mathed/InsetMath.h"
diff --git a/src/Layout.cpp b/src/Layout.cpp
index 63a5dc4..79a2e7b 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -13,8 +13,6 @@
 #include <config.h>
 
 #include "Layout.h"
-#include "FontInfo.h"
-#include "Language.h"
 #include "Lexer.h"
 #include "output_xhtml.h"
 #include "TextClass.h"
@@ -23,7 +21,6 @@
 #include "support/docstream.h"
 #include "support/lassert.h"
 #include "support/lstrings.h"
-#include "support/Messages.h"
 #include "support/textutils.h"
 
 
diff --git a/src/ParagraphMetrics.cpp b/src/ParagraphMetrics.cpp
index 86a3144..46f2edc 100644
--- a/src/ParagraphMetrics.cpp
+++ b/src/ParagraphMetrics.cpp
@@ -26,7 +26,6 @@
 #include "Layout.h"
 #include "LayoutEnums.h"
 #include "Paragraph.h"
-#include "Row.h"
 #include "TextClass.h"
 
 #include "frontends/FontMetrics.h"
diff --git a/src/Text.cpp b/src/Text.cpp
index 0bb66f6..d1e0d9a 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -29,7 +29,6 @@
 #include "Cursor.h"
 #include "CursorSlice.h"
 #include "CutAndPaste.h"
-#include "DispatchResult.h"
 #include "Encoding.h"
 #include "ErrorList.h"
 #include "factory.h"
@@ -43,7 +42,6 @@
 #include "ParagraphParameters.h"
 #include "TextClass.h"
 #include "TextMetrics.h"
-#include "Undo.h"
 #include "WordList.h"
 
 #include "insets/Inset.h"
@@ -2044,7 +2042,7 @@ docstring Text::currentState(CursorData const & cur, bool 
devel_mode) const
 
        // Custom text style
        InsetLayout const & layout = cur.inset().getLayout();
-       if (layout.lyxtype() == InsetLayout::CHARSTYLE)
+       if (layout.lyxtype() == InsetLyXType::CHARSTYLE)
                os << _(", Style: ") << 
translateIfPossible(layout.labelstring());
 
        if (devel_mode) {
diff --git a/src/Text3.cpp b/src/Text3.cpp
index 1d2f561..07d7e80 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -3069,9 +3069,9 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & 
cmd,
                string s = cmd.getArg(0);
                InsetLayout il =
                        
cur.buffer()->params().documentClass().insetLayout(from_utf8(s));
-               if (il.lyxtype() != InsetLayout::CHARSTYLE &&
-                   il.lyxtype() != InsetLayout::CUSTOM &&
-                   il.lyxtype ()!= InsetLayout::STANDARD)
+               if (il.lyxtype() != InsetLyXType::CHARSTYLE &&
+                   il.lyxtype() != InsetLyXType::CUSTOM &&
+                   il.lyxtype ()!= InsetLyXType::STANDARD)
                        enable = false;
                break;
                }
diff --git a/src/frontends/qt/FindAndReplace.cpp 
b/src/frontends/qt/FindAndReplace.cpp
index 942bbf1..fcfa6bd 100644
--- a/src/frontends/qt/FindAndReplace.cpp
+++ b/src/frontends/qt/FindAndReplace.cpp
@@ -14,8 +14,6 @@
 
 #include "GuiApplication.h"
 #include "GuiView.h"
-#include "GuiWorkArea.h"
-#include "qt_helpers.h"
 
 #include "Buffer.h"
 #include "BufferList.h"
@@ -24,11 +22,9 @@
 #include "Cursor.h"
 #include "FuncRequest.h"
 #include "Language.h"
-#include "Lexer.h"
 #include "LyX.h"
 #include "lyxfind.h"
 #include "Text.h"
-#include "TextClass.h"
 
 #include "frontends/alert.h"
 
diff --git a/src/frontends/qt/GuiParagraph.cpp 
b/src/frontends/qt/GuiParagraph.cpp
index 9990dda..432ce28 100644
--- a/src/frontends/qt/GuiParagraph.cpp
+++ b/src/frontends/qt/GuiParagraph.cpp
@@ -23,6 +23,7 @@
 #include "Cursor.h"
 #include "FuncRequest.h"
 #include "GuiView.h"
+#include "Layout.h"
 #include "Lexer.h"
 #include "Paragraph.h"
 #include "ParagraphParameters.h"
diff --git a/src/frontends/qt/GuiToolbar.cpp b/src/frontends/qt/GuiToolbar.cpp
index fbfa967..4e906e5 100644
--- a/src/frontends/qt/GuiToolbar.cpp
+++ b/src/frontends/qt/GuiToolbar.cpp
@@ -448,11 +448,11 @@ void DynamicMenuButton::loadFlexInsets()
        QMenu * m = menu();
        m->clear();
        string const & menutype = tbitem_.name;
-       InsetLayout::InsetLyXType ftype;
+       InsetLyXType ftype;
        if (menutype == "dynamic-custom-insets")
-               ftype = InsetLayout::CUSTOM;
+               ftype = InsetLyXType::CUSTOM;
        else if (menutype == "dynamic-char-styles")
-               ftype = InsetLayout::CHARSTYLE;
+               ftype = InsetLyXType::CHARSTYLE;
        else {
                // this should have been taken care of earlier
                LASSERT(false, return);
diff --git a/src/frontends/qt/Menus.cpp b/src/frontends/qt/Menus.cpp
index e567c64..c30b738 100644
--- a/src/frontends/qt/Menus.cpp
+++ b/src/frontends/qt/Menus.cpp
@@ -356,7 +356,7 @@ public:
        void expandFormats(MenuItem::Kind const kind, Buffer const * buf);
        void expandFloatListInsert(Buffer const * buf);
        void expandFloatInsert(Buffer const * buf);
-       void expandFlexInsert(Buffer const * buf, InsetLayout::InsetLyXType 
type);
+       void expandFlexInsert(Buffer const * buf, InsetLyXType type);
        void expandTocSubmenu(std::string const & type, Toc const & toc_list);
        void expandToc2(Toc const & toc_list, size_t from, size_t to, int 
depth, const string & toc_type);
        void expandToc(Buffer const * buf);
@@ -1216,7 +1216,7 @@ void MenuDefinition::expandFloatInsert(Buffer const * buf)
 
 
 void MenuDefinition::expandFlexInsert(
-               Buffer const * buf, InsetLayout::InsetLyXType type)
+               Buffer const * buf, InsetLyXType type)
 {
        if (!buf)
                return;
@@ -1242,7 +1242,7 @@ void MenuDefinition::expandFlexInsert(
                }
        }
        // FIXME This is a little clunky.
-       if (items_.empty() && type == InsetLayout::CUSTOM && 
!buf->hasReadonlyFlag())
+       if (items_.empty() && type == InsetLyXType::CUSTOM && 
!buf->hasReadonlyFlag())
                add(MenuItem(MenuItem::Help, qt_("(No Custom Insets 
Defined)")));
 }
 
@@ -2312,11 +2312,11 @@ void Menus::Impl::expand(MenuDefinition const & 
frommenu,
                }
 
                case MenuItem::CharStyles:
-                       tomenu.expandFlexInsert(buf, InsetLayout::CHARSTYLE);
+                       tomenu.expandFlexInsert(buf, InsetLyXType::CHARSTYLE);
                        break;
 
                case MenuItem::Custom:
-                       tomenu.expandFlexInsert(buf, InsetLayout::CUSTOM);
+                       tomenu.expandFlexInsert(buf, InsetLyXType::CUSTOM);
                        break;
 
                case MenuItem::FloatListInsert:
diff --git a/src/frontends/qt/qt_helpers.cpp b/src/frontends/qt/qt_helpers.cpp
index 27fe094..211d286 100644
--- a/src/frontends/qt/qt_helpers.cpp
+++ b/src/frontends/qt/qt_helpers.cpp
@@ -14,26 +14,15 @@
 
 #include "qt_helpers.h"
 
-#include "FileDialog.h"
 #include "LengthCombo.h"
+#include "LyXRC.h"
 
 #include "frontends/alert.h"
 
-#include "BufferParams.h"
-#include "FloatList.h"
-#include "FuncRequest.h"
-#include "Language.h"
-#include "LyX.h"
-#include "LyXRC.h"
-#include "LyXAction.h"
-#include "TextClass.h"
-
 #include "support/convert.h"
 #include "support/debug.h"
 #include "support/gettext.h"
-#include "support/Length.h"
 #include "support/lstrings.h"
-#include "support/os.h"
 #include "support/Package.h"
 #include "support/PathChanger.h"
 #include "support/Systemcall.h"
diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp
index a5077ed..45eae99 100644
--- a/src/insets/Inset.cpp
+++ b/src/insets/Inset.cpp
@@ -27,6 +27,7 @@
 #include "DispatchResult.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
+#include "InsetLayout.h"
 #include "MetricsInfo.h"
 #include "output_xhtml.h"
 #include "xml.h"
@@ -587,6 +588,12 @@ InsetLayout const & Inset::getLayout() const
 }
 
 
+bool Inset::isPassThru() const
+{
+       return getLayout().isPassThru();
+}
+
+
 bool Inset::undefined() const
 {
        docstring const & n = getLayout().name();
diff --git a/src/insets/Inset.h b/src/insets/Inset.h
index 8b47a05..ab2c535 100644
--- a/src/insets/Inset.h
+++ b/src/insets/Inset.h
@@ -17,11 +17,11 @@
 
 #include "ColorCode.h"
 #include "InsetCode.h"
-#include "InsetLayout.h"
 #include "LayoutEnums.h"
 #include "OutputEnums.h"
 #include "OutputParams.h"
 
+#include "support/docstring.h"
 #include "support/strfwd.h"
 #include "support/types.h"
 
@@ -452,7 +452,7 @@ public:
        ///
        virtual InsetLayout const & getLayout() const;
        ///
-       virtual bool isPassThru() const { return getLayout().isPassThru(); }
+       virtual bool isPassThru() const;
        /// Is this inset embedded in a title?
        virtual bool isInTitle() const { return false; }
        /// Is this inset's layout defined in the document's textclass?
diff --git a/src/insets/InsetArgument.cpp b/src/insets/InsetArgument.cpp
index 8382d95..3f26f85 100644
--- a/src/insets/InsetArgument.cpp
+++ b/src/insets/InsetArgument.cpp
@@ -18,6 +18,7 @@
 #include "Cursor.h"
 #include "FuncStatus.h"
 #include "FuncRequest.h"
+#include "InsetLayout.h"
 #include "InsetList.h"
 #include "Language.h"
 #include "Layout.h"
@@ -272,7 +273,7 @@ bool InsetArgument::getStatus(Cursor & cur, FuncRequest 
const & cmd,
 
 string InsetArgument::contextMenuName() const
 {
-       if (decoration() == InsetLayout::CONGLOMERATE)
+       if (decoration() == InsetDecoration::CONGLOMERATE)
                return "context-argument-conglomerate";
        else
                return "context-argument";
@@ -302,12 +303,12 @@ ColorCode InsetArgument::labelColor() const {
 }
 
 
-InsetLayout::InsetDecoration InsetArgument::decoration() const
+InsetDecoration InsetArgument::decoration() const
 {
-       InsetLayout::InsetDecoration dec = getLayout().decoration();
+       InsetDecoration dec = getLayout().decoration();
        if (!decoration_.empty())
                dec = translateDecoration(decoration_);
-       return dec == InsetLayout::DEFAULT ? InsetLayout::CLASSIC : dec;
+       return dec == InsetDecoration::DEFAULT ? InsetDecoration::CLASSIC : dec;
 }
 
 
diff --git a/src/insets/InsetArgument.h b/src/insets/InsetArgument.h
index 1c63e5c..2249f2f 100644
--- a/src/insets/InsetArgument.h
+++ b/src/insets/InsetArgument.h
@@ -12,7 +12,7 @@
 #ifndef INSETARGUMENT_H
 #define INSETARGUMENT_H
 
-
+#include "FontInfo.h"
 #include "InsetCollapsible.h"
 
 
@@ -80,7 +80,7 @@ public:
        /// \name Public functions inherited from InsetCollapsible class
        //@{
        ///
-       InsetLayout::InsetDecoration decoration() const override;
+       InsetDecoration decoration() const override;
        ///
        FontInfo getFont() const override;
        ///
diff --git a/src/insets/InsetBranch.cpp b/src/insets/InsetBranch.cpp
index bb1a090..c0d6bd3 100644
--- a/src/insets/InsetBranch.cpp
+++ b/src/insets/InsetBranch.cpp
@@ -111,7 +111,7 @@ docstring const InsetBranch::buttonLabel(BufferView const 
&) const
        if (inchild && master_selected != child_selected)
                symb += (child_selected ? tick : cross);
 
-       if (decoration() == InsetLayout::MINIMALISTIC)
+       if (decoration() == InsetDecoration::MINIMALISTIC)
                return symb + params_.branch;
 
        docstring s;
diff --git a/src/insets/InsetCollapsible.cpp b/src/insets/InsetCollapsible.cpp
index 1653386..da2269d 100644
--- a/src/insets/InsetCollapsible.cpp
+++ b/src/insets/InsetCollapsible.cpp
@@ -86,7 +86,7 @@ InsetCollapsible::~InsetCollapsible()
 
 InsetCollapsible::CollapseStatus InsetCollapsible::status(BufferView const & 
bv) const
 {
-       if (decoration() == InsetLayout::CONGLOMERATE)
+       if (decoration() == InsetDecoration::CONGLOMERATE)
                return status_;
        return view_[&bv].auto_open_ ? Open : status_;
 }
@@ -95,21 +95,21 @@ InsetCollapsible::CollapseStatus 
InsetCollapsible::status(BufferView const & bv)
 InsetCollapsible::Geometry InsetCollapsible::geometry(BufferView const & bv) 
const
 {
        switch (decoration()) {
-       case InsetLayout::CLASSIC:
+       case InsetDecoration::CLASSIC:
                if (status(bv) == Open)
                        return view_[&bv].openinlined_ ? LeftButton : TopButton;
                return ButtonOnly;
 
-       case InsetLayout::MINIMALISTIC: {
+       case InsetDecoration::MINIMALISTIC: {
                return status(bv) == Open ?
                        (tempfile_ ? LeftButton : NoButton)
                        : ButtonOnly;
        }
 
-       case InsetLayout::CONGLOMERATE:
+       case InsetDecoration::CONGLOMERATE:
                return status(bv) == Open ? SubLabel : Corners ;
 
-       case InsetLayout::DEFAULT:
+       case InsetDecoration::DEFAULT:
                break; // this shouldn't happen
        }
 
@@ -263,6 +263,18 @@ bool InsetCollapsible::setMouseHover(BufferView const * 
bv, bool mouse_hover)
 }
 
 
+ColorCode InsetCollapsible::backgroundColor(PainterInfo const &) const
+{
+       return getLayout().bgcolor();
+}
+
+
+ColorCode InsetCollapsible::labelColor() const
+{
+       return getLayout().labelfont().color();
+}
+
+
 void InsetCollapsible::draw(PainterInfo & pi, int x, int y) const
 {
        BufferView const & bv = *pi.base.bv;
@@ -434,8 +446,8 @@ bool InsetCollapsible::editable() const
                return false;
        
        switch (decoration()) {
-       case InsetLayout::CLASSIC:
-       case InsetLayout::MINIMALISTIC:
+       case InsetDecoration::CLASSIC:
+       case InsetDecoration::MINIMALISTIC:
                return status_ == Open;
        default:
                return true;
@@ -684,7 +696,7 @@ docstring const InsetCollapsible::buttonLabel(BufferView 
const & bv) const
 {
        // U+1F512 LOCK
        docstring const locked = tempfile_ ? docstring(1, 0x1F512) : 
docstring();
-       if (decoration() == InsetLayout::MINIMALISTIC)
+       if (decoration() == InsetDecoration::MINIMALISTIC)
                return locked;
        // indicate changed content in label (#8645)
        // ✎ U+270E LOWER RIGHT PENCIL
@@ -707,10 +719,22 @@ void InsetCollapsible::setStatus(Cursor & cur, 
CollapseStatus status)
 }
 
 
-InsetLayout::InsetDecoration InsetCollapsible::decoration() const
+InsetDecoration InsetCollapsible::decoration() const
+{
+       InsetDecoration const dec = getLayout().decoration();
+       return dec == InsetDecoration::DEFAULT ? InsetDecoration::CLASSIC : dec;
+}
+
+
+FontInfo InsetCollapsible::getFont() const
+{
+       return getLayout().font();
+}
+
+
+FontInfo InsetCollapsible::getLabelfont() const
 {
-       InsetLayout::InsetDecoration const dec = getLayout().decoration();
-       return dec == InsetLayout::DEFAULT ? InsetLayout::CLASSIC : dec;
+       return getLayout().labelfont();
 }
 
 
@@ -719,7 +743,7 @@ string InsetCollapsible::contextMenu(BufferView const & bv, 
int x,
 {
        string context_menu = contextMenuName();
        string const it_context_menu = InsetText::contextMenuName();
-       if (decoration() == InsetLayout::CONGLOMERATE)
+       if (decoration() == InsetDecoration::CONGLOMERATE)
                return context_menu + ";" + it_context_menu;
 
        string const ic_context_menu = InsetCollapsible::contextMenuName();
@@ -739,7 +763,7 @@ string InsetCollapsible::contextMenu(BufferView const & bv, 
int x,
 
 string InsetCollapsible::contextMenuName() const
 {
-       if (decoration() == InsetLayout::CONGLOMERATE)
+       if (decoration() == InsetDecoration::CONGLOMERATE)
                return "context-conglomerate";
        else
                return "context-collapsible";
diff --git a/src/insets/InsetCollapsible.h b/src/insets/InsetCollapsible.h
index 55044b4..e1405ac 100644
--- a/src/insets/InsetCollapsible.h
+++ b/src/insets/InsetCollapsible.h
@@ -18,6 +18,8 @@
 
 #include "Box.h"
 
+#include "support/unique_ptr.h"
+
 #include <map>
 
 namespace lyx {
@@ -25,6 +27,8 @@ namespace lyx {
 class CursorSlice;
 class InsetLayout;
 
+enum class InsetDecoration : int;
+
 namespace support { class TempFile; }
 
 /** A collapsible text inset
@@ -120,11 +124,11 @@ public:
         */
 
        /// Default looks
-       virtual InsetLayout::InsetDecoration decoration() const;
+       virtual InsetDecoration decoration() const;
        /// Inset font
-       virtual FontInfo getFont() const { return getLayout().font(); }
+       virtual FontInfo getFont() const;
        /// Label font
-       virtual FontInfo getLabelfont() const { return getLayout().labelfont(); 
}
+       virtual FontInfo getLabelfont() const;
        ///
        enum Geometry {
                TopButton,
@@ -145,10 +149,9 @@ public:
        ///
        bool setMouseHover(BufferView const * bv, bool mouse_hover) const 
override;
        ///
-       ColorCode backgroundColor(PainterInfo const &) const override
-               { return getLayout().bgcolor(); }
+       ColorCode backgroundColor(PainterInfo const &) const override;
        ///
-       ColorCode labelColor() const override { return 
getLayout().labelfont().color(); }
+       ColorCode labelColor() const override;
        ///
        InsetCode lyxCode() const override { return COLLAPSIBLE_CODE; }
 
diff --git a/src/insets/InsetERT.cpp b/src/insets/InsetERT.cpp
index d7e6f8a..f0c1f17 100644
--- a/src/insets/InsetERT.cpp
+++ b/src/insets/InsetERT.cpp
@@ -16,12 +16,13 @@
 #include "Cursor.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
+#include "InsetLayout.h"
 #include "Language.h"
 #include "Lexer.h"
 #include "xml.h"
 #include "ParagraphParameters.h"
 #include "Paragraph.h"
-#include <output_docbook.h>
+#include "output_docbook.h"
 
 #include "support/docstream.h"
 #include "support/gettext.h"
@@ -170,9 +171,9 @@ docstring const InsetERT::buttonLabel(BufferView const & 
bv) const
 {
        // U+1F512 LOCK
        docstring const locked = tempfile_ ? docstring(1, 0x1F512) : 
docstring();
-       if (decoration() == InsetLayout::MINIMALISTIC)
+       if (decoration() == InsetDecoration::MINIMALISTIC)
                return locked;
-       if (decoration() == InsetLayout::CLASSIC)
+       if (decoration() == InsetDecoration::CLASSIC)
                return locked + (isOpen(bv) ? _("ERT") : getNewLabel(_("ERT")));
        return locked + getNewLabel(_("ERT"));
 }
diff --git a/src/insets/InsetFlex.cpp b/src/insets/InsetFlex.cpp
index c91d65e..4da349f 100644
--- a/src/insets/InsetFlex.cpp
+++ b/src/insets/InsetFlex.cpp
@@ -58,10 +58,10 @@ InsetLayout const & InsetFlex::getLayout() const
 }
 
 
-InsetLayout::InsetDecoration InsetFlex::decoration() const
+InsetDecoration InsetFlex::decoration() const
 {
-       InsetLayout::InsetDecoration const dec = getLayout().decoration();
-       return dec == InsetLayout::DEFAULT ? InsetLayout::CONGLOMERATE : dec;
+       InsetDecoration const dec = getLayout().decoration();
+       return dec == InsetDecoration::DEFAULT ? InsetDecoration::CONGLOMERATE 
: dec;
 }
 
 
@@ -97,11 +97,11 @@ bool InsetFlex::getStatus(Cursor & cur, FuncRequest const & 
cmd,
        case LFUN_INSET_DISSOLVE:
                if (!cmd.argument().empty()) {
                        InsetLayout const & il = getLayout();
-                       InsetLayout::InsetLyXType const type =
+                       InsetLyXType const type =
                                translateLyXType(to_utf8(cmd.argument()));
                        if (il.lyxtype() == type
                            || (il.name() == 
DocumentClass::plainInsetLayout().name()
-                                   && type == InsetLayout::CHARSTYLE)) {
+                                   && type == InsetLyXType::CHARSTYLE)) {
                                FuncRequest temp_cmd(LFUN_INSET_DISSOLVE);
                                return InsetCollapsible::getStatus(cur, 
temp_cmd, flag);
                        } else
@@ -120,12 +120,12 @@ void InsetFlex::doDispatch(Cursor & cur, FuncRequest & 
cmd)
        case LFUN_INSET_DISSOLVE:
                if (!cmd.argument().empty()) {
                        InsetLayout const & il = getLayout();
-                       InsetLayout::InsetLyXType const type =
+                       InsetLyXType const type =
                                translateLyXType(to_utf8(cmd.argument()));
 
                        if (il.lyxtype() == type
                            || (il.name() == 
DocumentClass::plainInsetLayout().name()
-                                   && type == InsetLayout::CHARSTYLE)) {
+                                   && type == InsetLyXType::CHARSTYLE)) {
                                FuncRequest temp_cmd(LFUN_INSET_DISSOLVE);
                                InsetCollapsible::doDispatch(cur, temp_cmd);
                        } else
diff --git a/src/insets/InsetFlex.h b/src/insets/InsetFlex.h
index a781fb8..527974a 100644
--- a/src/insets/InsetFlex.h
+++ b/src/insets/InsetFlex.h
@@ -15,6 +15,7 @@
 
 #include "InsetCollapsible.h"
 
+
 namespace lyx {
 
 /** The Flex inset, e.g., CharStyle, Custom inset or XML short element
@@ -31,7 +32,7 @@ public:
        ///
        InsetCode lyxCode() const override { return FLEX_CODE; }
        /// Default looks
-       InsetLayout::InsetDecoration decoration() const override;
+       InsetDecoration decoration() const override;
        ///
        void write(std::ostream &) const override;
        /// should paragraph indentation be omitted in any case?
diff --git a/src/insets/InsetIPAMacro.cpp b/src/insets/InsetIPAMacro.cpp
index 82f6c48..5d2035b 100644
--- a/src/insets/InsetIPAMacro.cpp
+++ b/src/insets/InsetIPAMacro.cpp
@@ -16,9 +16,10 @@
 #include "BufferParams.h"
 #include "Dimension.h"
 #include "Encoding.h"
-#include "Font.h"
+#include "FontInfo.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
+#include "InsetLayout.h"
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "MetricsInfo.h"
diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp
index c5ed2da..0ff5c50 100644
--- a/src/insets/InsetLayout.cpp
+++ b/src/insets/InsetLayout.cpp
@@ -32,28 +32,28 @@ using namespace lyx::support;
 
 namespace lyx {
 
-InsetLayout::InsetDecoration translateDecoration(std::string const & str)
+InsetDecoration translateDecoration(std::string const & str)
 {
        if (compare_ascii_no_case(str, "classic") == 0)
-               return InsetLayout::CLASSIC;
+               return InsetDecoration::CLASSIC;
        if (compare_ascii_no_case(str, "minimalistic") == 0)
-               return InsetLayout::MINIMALISTIC;
+               return InsetDecoration::MINIMALISTIC;
        if (compare_ascii_no_case(str, "conglomerate") == 0)
-               return InsetLayout::CONGLOMERATE;
-       return InsetLayout::DEFAULT;
+               return InsetDecoration::CONGLOMERATE;
+       return InsetDecoration::DEFAULT;
 }
 
 namespace {
 
-InsetLayout::InsetLaTeXType translateLaTeXType(std::string const & str)
+InsetLaTeXType translateLaTeXType(std::string const & str)
 {
        if (compare_ascii_no_case(str, "command") == 0)
-               return InsetLayout::COMMAND;
+               return InsetLaTeXType::COMMAND;
        if (compare_ascii_no_case(str, "environment") == 0)
-               return InsetLayout::ENVIRONMENT;
+               return InsetLaTeXType::ENVIRONMENT;
        if (compare_ascii_no_case(str, "none") == 0)
-               return InsetLayout::NOLATEXTYPE;
-       return InsetLayout::ILT_ERROR;
+               return InsetLaTeXType::NOLATEXTYPE;
+       return InsetLaTeXType::ILT_ERROR;
 }
 
 } // namespace
@@ -256,13 +256,13 @@ bool InsetLayout::read(Lexer & lex, TextClass const & 
tclass,
                        string lt;
                        lex >> lt;
                        lyxtype_ = translateLyXType(lt);
-                       if (lyxtype_  == NOLYXTYPE) {
+                       if (lyxtype_  == InsetLyXType::NOLYXTYPE) {
                                LYXERR0("Unknown LyXType `" << lt << "'.");
                                // this is not really a reason to abort
                                if (validating)
                                        return false;
                        }
-                       if (lyxtype_ == CHARSTYLE) {
+                       if (lyxtype_ == InsetLyXType::CHARSTYLE) {
                                // by default, charstyles force the plain layout
                                multipar_ = false;
                                forceplain_ = true;
@@ -273,7 +273,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & 
tclass,
                        string lt;
                        lex >> lt;
                        latextype_ = translateLaTeXType(lt);
-                       if (latextype_  == ILT_ERROR) {
+                       if (latextype_  == InsetLaTeXType::ILT_ERROR) {
                                LYXERR0("Unknown LaTeXType `" << lt << "'.");
                                // this is not really a reason to abort
                                if (validating)
@@ -599,17 +599,17 @@ bool InsetLayout::read(Lexer & lex, TextClass const & 
tclass,
 }
 
 
-InsetLayout::InsetLyXType translateLyXType(std::string const & str)
+InsetLyXType translateLyXType(std::string const & str)
 {
        if (compare_ascii_no_case(str, "charstyle") == 0)
-               return InsetLayout::CHARSTYLE;
+               return InsetLyXType::CHARSTYLE;
        if (compare_ascii_no_case(str, "custom") == 0)
-               return InsetLayout::CUSTOM;
+               return InsetLyXType::CUSTOM;
        if (compare_ascii_no_case(str, "end") == 0)
-               return InsetLayout::END;
+               return InsetLyXType::END;
        if (compare_ascii_no_case(str, "standard") == 0)
-               return InsetLayout::STANDARD;
-       return InsetLayout::NOLYXTYPE;
+               return InsetLyXType::STANDARD;
+       return InsetLyXType::NOLYXTYPE;
 }
 
 
diff --git a/src/insets/InsetLayout.h b/src/insets/InsetLayout.h
index 2b9fc02..4958d36 100644
--- a/src/insets/InsetLayout.h
+++ b/src/insets/InsetLayout.h
@@ -27,34 +27,36 @@ namespace lyx {
 class Lexer;
 class TextClass;
 
+
+enum class InsetDecoration : int {
+       CLASSIC,
+       MINIMALISTIC,
+       CONGLOMERATE,
+       DEFAULT
+};
+
+enum class InsetLyXType : int {
+       NOLYXTYPE,
+       CHARSTYLE,
+       CUSTOM,
+       END,
+       STANDARD
+};
+
+enum class InsetLaTeXType : int {
+       NOLATEXTYPE,
+       COMMAND,
+       ENVIRONMENT,
+       ILT_ERROR
+};
+
+
 ///
 class InsetLayout {
 public:
        ///
        InsetLayout() { labelfont_.setColor(Color_error); }
        ///
-       enum InsetDecoration {
-               CLASSIC,
-               MINIMALISTIC,
-               CONGLOMERATE,
-               DEFAULT
-       };
-       ///
-       enum InsetLyXType {
-               NOLYXTYPE,
-               CHARSTYLE,
-               CUSTOM,
-               END,
-               STANDARD
-       };
-       ///
-       enum InsetLaTeXType {
-               NOLATEXTYPE,
-               COMMAND,
-               ENVIRONMENT,
-               ILT_ERROR
-       };
-       ///
        bool read(Lexer & lexrc, TextClass const & tclass,
                        bool validating = false);
        ///
@@ -246,7 +248,7 @@ private:
                * Values are 'charstyle', 'custom' (things that by default look 
like a
                * footnote), 'standard'.
                */
-       InsetLyXType lyxtype_ = STANDARD;
+       InsetLyXType lyxtype_ = InsetLyXType::STANDARD;
        ///
        docstring labelstring_ = from_ascii("UNDEFINED");
        ///
@@ -254,9 +256,9 @@ private:
        ///
        bool contentaslabel_ = false;
        ///
-       InsetDecoration decoration_ = DEFAULT;
+       InsetDecoration decoration_ = InsetDecoration::DEFAULT;
        ///
-       InsetLaTeXType latextype_ = NOLATEXTYPE;
+       InsetLaTeXType latextype_ = InsetLaTeXType::NOLATEXTYPE;
        ///
        std::string latexname_;
        ///
@@ -400,8 +402,8 @@ private:
 };
 
 ///
-InsetLayout::InsetLyXType translateLyXType(std::string const & str);
-InsetLayout::InsetDecoration translateDecoration(std::string const & str);
+InsetLyXType translateLyXType(std::string const & str);
+InsetDecoration translateDecoration(std::string const & str);
 
 } // namespace lyx
 
diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp
index 96b035e..e11de52 100644
--- a/src/insets/InsetListings.cpp
+++ b/src/insets/InsetListings.cpp
@@ -16,21 +16,19 @@
 #include "Buffer.h"
 #include "BufferView.h"
 #include "BufferParams.h"
-#include "Counters.h"
 #include "Cursor.h"
-#include "DispatchResult.h"
 #include "Encoding.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
 #include "InsetCaption.h"
 #include "InsetLabel.h"
+#include "InsetLayout.h"
 #include "Language.h"
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "output_latex.h"
 #include "output_docbook.h"
 #include "output_xhtml.h"
-#include "TextClass.h"
 #include "TexRow.h"
 #include "texstream.h"
 
@@ -607,9 +605,9 @@ docstring const InsetListings::buttonLabel(BufferView const 
& bv) const
 {
        // FIXME UNICODE
        docstring const locked = tempfile_ ? docstring(1, 0x1F512) : 
docstring();
-       if (decoration() == InsetLayout::MINIMALISTIC)
+       if (decoration() == InsetDecoration::MINIMALISTIC)
                return locked;
-       if (decoration() == InsetLayout::CLASSIC)
+       if (decoration() == InsetDecoration::CLASSIC)
                return locked + (isOpen(bv) ? _("Listing") : 
getNewLabel(_("Listing")));
        return locked + getNewLabel(_("Listing"));
 }
diff --git a/src/insets/InsetNomencl.cpp b/src/insets/InsetNomencl.cpp
index e30131c..b0d678d 100644
--- a/src/insets/InsetNomencl.cpp
+++ b/src/insets/InsetNomencl.cpp
@@ -22,6 +22,7 @@
 #include "Encoding.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
+#include "InsetLayout.h"
 #include "InsetList.h"
 #include "Language.h"
 #include "LaTeXFeatures.h"
diff --git a/src/insets/InsetNote.cpp b/src/insets/InsetNote.cpp
index 6108b83..28d8db1 100644
--- a/src/insets/InsetNote.cpp
+++ b/src/insets/InsetNote.cpp
@@ -19,16 +19,15 @@
 #include "BufferView.h"
 #include "ColorSet.h"
 #include "Cursor.h"
-#include "DispatchResult.h"
 #include "Exporter.h"
+#include "FontInfo.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
+#include "InsetLayout.h"
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "LyXRC.h"
 #include "output_docbook.h"
-#include "TextClass.h"
-#include "TocBackend.h"
 
 #include "support/debug.h"
 #include "support/docstream.h"
diff --git a/src/insets/InsetQuotes.h b/src/insets/InsetQuotes.h
index 4035e13..d1f23e4 100644
--- a/src/insets/InsetQuotes.h
+++ b/src/insets/InsetQuotes.h
@@ -15,7 +15,7 @@
 
 #include "Inset.h"
 
-#include "support/docstring.h"
+#include <map>
 
 
 namespace lyx {
diff --git a/src/insets/InsetScript.h b/src/insets/InsetScript.h
index 424772c..9eb80db 100644
--- a/src/insets/InsetScript.h
+++ b/src/insets/InsetScript.h
@@ -12,6 +12,7 @@
 #ifndef INSET_SCRIPT_H
 #define INSET_SCRIPT_H
 
+#include "FontInfo.h"
 #include "InsetText.h"
 
 
diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index 8be7989..5c4d32c 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -10,6 +10,7 @@
 
 #include <config.h>
 
+#include "InsetLayout.h"
 #include "InsetText.h"
 
 #include "insets/InsetArgument.h"
@@ -469,7 +470,7 @@ void InsetText::latex(otexstream & os, OutputParams const & 
runparams) const
                os << breakln;
        bool needendgroup = false;
        if (!il.latexname().empty()) {
-               if (il.latextype() == InsetLayout::COMMAND) {
+               if (il.latextype() == InsetLaTeXType::COMMAND) {
                        // FIXME UNICODE
                        // FIXME \protect should only be used for fragile
                        //    commands, but we do not provide this information 
yet.
@@ -488,7 +489,7 @@ void InsetText::latex(otexstream & os, OutputParams const & 
runparams) const
                        if (!il.latexparam().empty())
                                os << from_utf8(il.latexparam());
                        os << '{';
-               } else if (il.latextype() == InsetLayout::ENVIRONMENT) {
+               } else if (il.latextype() == InsetLaTeXType::ENVIRONMENT) {
                        if (il.isDisplay())
                                os << breakln;
                        else
@@ -540,13 +541,13 @@ void InsetText::latex(otexstream & os, OutputParams const 
& runparams) const
                os << il.rightdelim();
 
        if (!il.latexname().empty()) {
-               if (il.latextype() == InsetLayout::COMMAND) {
+               if (il.latextype() == InsetLaTeXType::COMMAND) {
                        os << "}";
                        if (!il.postcommandargs().empty())
                                getArgs(os, runparams, true);
                        if (needendgroup)
                                os << "\\endgroup";
-               } else if (il.latextype() == InsetLayout::ENVIRONMENT) {
+               } else if (il.latextype() == InsetLaTeXType::ENVIRONMENT) {
                        // A comment environment doesn't need a % before \n\end
                        if (il.isDisplay() || runparams.inComment)
                                os << breakln;
@@ -924,6 +925,36 @@ bool InsetText::insetAllowed(InsetCode code) const
 }
 
 
+bool InsetText::allowSpellCheck() const
+{
+       return getLayout().spellcheck() && !getLayout().isPassThru();
+}
+
+
+bool InsetText::allowMultiPar() const
+{
+       return getLayout().isMultiPar();
+}
+
+
+bool InsetText::forcePlainLayout(idx_type) const
+{
+       return getLayout().forcePlainLayout();
+}
+
+
+bool InsetText::allowParagraphCustomization(idx_type) const
+{
+       return getLayout().allowParagraphCustomization();
+}
+
+
+bool InsetText::forceLocalFontSwitch() const
+{
+       return getLayout().forceLocalFontSwitch();
+}
+
+
 void InsetText::updateBuffer(ParIterator const & it, UpdateType utype, bool 
const deleted)
 {
        ParIterator it2 = it;
@@ -1245,7 +1276,7 @@ bool InsetText::needsCProtection(bool const maintext, 
bool const fragile) const
                return true;
 
        // Environments generally need cprotection in fragile context
-       if (fragile && getLayout().latextype() == InsetLayout::ENVIRONMENT)
+       if (fragile && getLayout().latextype() == InsetLaTeXType::ENVIRONMENT)
                return true;
 
        if (!getLayout().needsCProtect())
@@ -1253,7 +1284,7 @@ bool InsetText::needsCProtection(bool const maintext, 
bool const fragile) const
 
        // Environments and "no latex" types (e.g., knitr chunks)
        // need cprotection regardless the content
-       if (!maintext && getLayout().latextype() != InsetLayout::COMMAND)
+       if (!maintext && getLayout().latextype() != InsetLaTeXType::COMMAND)
                return true;
 
        // If the inset does not produce output (e.g. Note or Branch),
diff --git a/src/insets/InsetText.h b/src/insets/InsetText.h
index d571806..455f19d 100644
--- a/src/insets/InsetText.h
+++ b/src/insets/InsetText.h
@@ -17,6 +17,7 @@
 #include "ColorCode.h"
 #include "Text.h"
 
+
 namespace lyx {
 
 class CompletionList;
@@ -154,23 +155,20 @@ public:
        ///
        bool insetAllowed(InsetCode) const override;
        ///
-       bool allowSpellCheck() const override { return getLayout().spellcheck() 
&& !getLayout().isPassThru(); }
+       bool allowSpellCheck() const override;
        ///
        virtual bool isMacroScope() const { return false; }
        ///
-       bool allowMultiPar() const override { return getLayout().isMultiPar(); }
+       bool allowMultiPar() const override;
        ///
        bool isInTitle() const override { return intitle_context_; }
        ///
        /// should paragraphs be forced to use the empty layout?
-       bool forcePlainLayout(idx_type = 0) const override
-               { return getLayout().forcePlainLayout(); }
+       bool forcePlainLayout(idx_type = 0) const override;
        /// should the user be allowed to customize alignment, etc.?
-       bool allowParagraphCustomization(idx_type = 0) const override
-               { return getLayout().allowParagraphCustomization(); }
+       bool allowParagraphCustomization(idx_type = 0) const override;
        /// should paragraphs be forced to use a local font language switch?
-       bool forceLocalFontSwitch() const override
-               { return getLayout().forceLocalFontSwitch(); }
+       bool forceLocalFontSwitch() const override;
 
        /// Update the counters of this inset and of its contents
        void updateBuffer(ParIterator const &, UpdateType, bool const deleted = 
false) override;
diff --git a/src/mathed/InsetMathSize.h b/src/mathed/InsetMathSize.h
index 37fa003..783e826 100644
--- a/src/mathed/InsetMathSize.h
+++ b/src/mathed/InsetMathSize.h
@@ -12,6 +12,7 @@
 #ifndef MATHSIZEINSET_H
 #define MATHSIZEINSET_H
 
+#include "FontEnums.h"
 #include "InsetMathNest.h"
 
 
diff --git a/src/mathed/MathFactory.cpp b/src/mathed/MathFactory.cpp
index 28ed3df..9a8ab05 100644
--- a/src/mathed/MathFactory.cpp
+++ b/src/mathed/MathFactory.cpp
@@ -71,6 +71,7 @@
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "Encoding.h"
+#include "FontInfo.h"
 #include "LyX.h" // use_gui
 
 #include <iomanip>
diff --git a/src/output_latex.h b/src/output_latex.h
index 65a4151..af40a86 100644
--- a/src/output_latex.h
+++ b/src/output_latex.h
@@ -14,7 +14,6 @@
 
 #include <utility>
 
-#include "support/docstream.h"
 #include "Layout.h"
 #include "ParagraphList.h"
 
diff --git a/src/tex2lyx/tex2lyx.cpp b/src/tex2lyx/tex2lyx.cpp
index 810567c..c996f5b 100644
--- a/src/tex2lyx/tex2lyx.cpp
+++ b/src/tex2lyx/tex2lyx.cpp
@@ -22,7 +22,6 @@
 #include "LayoutModuleList.h"
 #include "ModuleList.h"
 #include "Preamble.h"
-#include "TextClass.h"
 
 #include "support/ConsoleApplication.h"
 #include "support/convert.h"
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to