mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
More enums & includes refactoring
This commit is contained in:
parent
8ab38c920c
commit
e292dd70bf
@ -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"
|
||||
|
@ -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;
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "support/gettext.h"
|
||||
#include "support/lassert.h"
|
||||
|
||||
#include "insets/InsetLayout.h"
|
||||
#include "insets/InsetTabular.h"
|
||||
|
||||
#include "mathed/InsetMath.h"
|
||||
|
@ -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"
|
||||
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "Layout.h"
|
||||
#include "LayoutEnums.h"
|
||||
#include "Paragraph.h"
|
||||
#include "Row.h"
|
||||
#include "TextClass.h"
|
||||
|
||||
#include "frontends/FontMetrics.h"
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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);
|
||||
|
@ -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:
|
||||
|
@ -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"
|
||||
|
@ -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();
|
||||
|
@ -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?
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
///
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
{
|
||||
InsetLayout::InsetDecoration const dec = getLayout().decoration();
|
||||
return dec == InsetLayout::DEFAULT ? InsetLayout::CLASSIC : dec;
|
||||
InsetDecoration const dec = getLayout().decoration();
|
||||
return dec == InsetDecoration::DEFAULT ? InsetDecoration::CLASSIC : dec;
|
||||
}
|
||||
|
||||
|
||||
FontInfo InsetCollapsible::getFont() const
|
||||
{
|
||||
return getLayout().font();
|
||||
}
|
||||
|
||||
|
||||
FontInfo InsetCollapsible::getLabelfont() const
|
||||
{
|
||||
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";
|
||||
|
@ -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; }
|
||||
|
||||
|
@ -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"));
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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?
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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"));
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "Inset.h"
|
||||
|
||||
#include "support/docstring.h"
|
||||
#include <map>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
@ -12,6 +12,7 @@
|
||||
#ifndef INSET_SCRIPT_H
|
||||
#define INSET_SCRIPT_H
|
||||
|
||||
#include "FontInfo.h"
|
||||
#include "InsetText.h"
|
||||
|
||||
|
||||
|
@ -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),
|
||||
|
@ -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;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#ifndef MATHSIZEINSET_H
|
||||
#define MATHSIZEINSET_H
|
||||
|
||||
#include "FontEnums.h"
|
||||
#include "InsetMathNest.h"
|
||||
|
||||
|
||||
|
@ -71,6 +71,7 @@
|
||||
#include "Buffer.h"
|
||||
#include "BufferParams.h"
|
||||
#include "Encoding.h"
|
||||
#include "FontInfo.h"
|
||||
#include "LyX.h" // use_gui
|
||||
|
||||
#include <iomanip>
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "Layout.h"
|
||||
#include "ParagraphList.h"
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "LayoutModuleList.h"
|
||||
#include "ModuleList.h"
|
||||
#include "Preamble.h"
|
||||
#include "TextClass.h"
|
||||
|
||||
#include "support/ConsoleApplication.h"
|
||||
#include "support/convert.h"
|
||||
|
Loading…
Reference in New Issue
Block a user