From eea79637c78bb9916031924eca7b305cfb8e83df Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Thu, 25 Oct 2007 12:41:02 +0000 Subject: [PATCH] Move Color::color enum to ColorCode.h git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21198 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BranchList.cpp | 5 +- src/BufferParams.cpp | 3 +- src/BufferView.cpp | 4 +- src/Color.cpp | 158 ++++++++++++------------ src/Color.h | 174 ++------------------------- src/ColorCode.h | 153 +++++++++++++++++++++++ src/Font.cpp | 48 ++++---- src/Font.h | 15 ++- src/LaTeXFeatures.cpp | 8 +- src/LyX.cpp | 2 +- src/LyXFunc.cpp | 5 +- src/LyXRC.cpp | 14 +-- src/Makefile.am | 1 + src/MetricsInfo.cpp | 2 +- src/Paragraph.cpp | 1 - src/Text.cpp | 1 - src/Text.h | 1 - src/Text2.cpp | 1 - src/TextClass.cpp | 12 +- src/TextClass.h | 6 +- src/TextMetrics.cpp | 15 ++- src/factory.cpp | 3 +- src/frontends/Application.h | 13 +- src/frontends/Painter.cpp | 29 +++-- src/frontends/Painter.h | 19 +-- src/frontends/WorkArea.cpp | 1 - src/frontends/qt4/ColorCache.cpp | 4 +- src/frontends/qt4/ColorCache.h | 6 +- src/frontends/qt4/GuiApplication.cpp | 6 +- src/frontends/qt4/GuiApplication.h | 6 +- src/frontends/qt4/GuiCharacter.cpp | 52 ++++---- src/frontends/qt4/GuiCharacter.h | 8 +- src/frontends/qt4/GuiDocument.cpp | 1 - src/frontends/qt4/GuiFontLoader.h | 2 + src/frontends/qt4/GuiPainter.cpp | 19 ++- src/frontends/qt4/GuiPainter.h | 18 ++- src/frontends/qt4/GuiPrefs.cpp | 34 +++--- src/frontends/qt4/GuiPrefs.h | 7 +- src/frontends/qt4/GuiWorkArea.cpp | 3 +- src/graphics/PreviewLoader.cpp | 5 +- src/insets/Inset.cpp | 13 +- src/insets/Inset.h | 4 +- src/insets/InsetBox.cpp | 3 +- src/insets/InsetBranch.cpp | 13 +- src/insets/InsetBranch.h | 2 +- src/insets/InsetCaption.cpp | 5 +- src/insets/InsetCollapsable.cpp | 7 +- src/insets/InsetCollapsable.h | 2 +- src/insets/InsetERT.cpp | 1 - src/insets/InsetFlex.cpp | 1 - src/insets/InsetFloat.cpp | 2 +- src/insets/InsetLine.cpp | 3 +- src/insets/InsetListings.cpp | 6 +- src/insets/InsetNewline.cpp | 4 +- src/insets/InsetOptArg.cpp | 4 +- src/insets/InsetPagebreak.cpp | 9 +- src/insets/InsetSpace.cpp | 5 +- src/insets/InsetSpecialChar.cpp | 11 +- src/insets/InsetTabular.cpp | 13 +- src/insets/InsetText.cpp | 9 +- src/insets/InsetText.h | 7 +- src/insets/InsetTheorem.cpp | 2 +- src/insets/InsetVSpace.cpp | 15 ++- src/insets/InsetWrap.cpp | 3 +- src/insets/RenderButton.cpp | 5 +- src/insets/RenderGraphic.cpp | 3 +- src/insets/RenderPreview.cpp | 3 +- src/mathed/InsetFormulaMacro.cpp | 9 +- src/mathed/InsetMath.cpp | 1 + src/mathed/InsetMathBoxed.cpp | 3 +- src/mathed/InsetMathBrace.cpp | 3 +- src/mathed/InsetMathColor.cpp | 5 +- src/mathed/InsetMathColor.h | 4 +- src/mathed/InsetMathDFrac.cpp | 3 +- src/mathed/InsetMathFBox.cpp | 3 +- src/mathed/InsetMathFrac.cpp | 5 +- src/mathed/InsetMathFrameBox.cpp | 3 +- src/mathed/InsetMathGrid.cpp | 5 +- src/mathed/InsetMathHull.cpp | 5 +- src/mathed/InsetMathNest.cpp | 9 +- src/mathed/InsetMathPhantom.cpp | 25 ++-- src/mathed/InsetMathRoot.cpp | 5 +- src/mathed/InsetMathSpace.cpp | 3 +- src/mathed/InsetMathSqrt.cpp | 5 +- src/mathed/InsetMathTFrac.cpp | 3 +- src/mathed/InsetMathXYArrow.cpp | 2 +- src/mathed/MathData.cpp | 3 +- src/mathed/MathMacroTemplate.cpp | 13 +- src/mathed/MathSupport.cpp | 97 ++++++++------- src/rowpainter.cpp | 53 ++++---- 90 files changed, 619 insertions(+), 668 deletions(-) create mode 100644 src/ColorCode.h diff --git a/src/BranchList.cpp b/src/BranchList.cpp index 86cb6021d1..89884e60a2 100644 --- a/src/BranchList.cpp +++ b/src/BranchList.cpp @@ -11,7 +11,6 @@ #include #include "BranchList.h" -#include "Color.h" #include "frontends/Application.h" @@ -26,7 +25,7 @@ Branch::Branch() : selected_(false) { // no theApp() with command line export if (theApp()) - theApp()->getRgbColor(Color::background, color_); + theApp()->getRgbColor(Color_background, color_); } @@ -75,7 +74,7 @@ void Branch::setColor(string const & c) color_ = RGBColor(c); else // no color set or invalid color - use normal background - theApp()->getRgbColor(Color::background, color_); + theApp()->getRgbColor(Color_background, color_); } diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 8d6c4d770b..80724d6cbc 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -28,7 +28,6 @@ #include "LaTeXFeatures.h" #include "Messages.h" #include "ModuleList.h" -#include "Color.h" #include "Font.h" #include "Lexer.h" #include "LyXRC.h" @@ -584,7 +583,7 @@ string const BufferParams::readToken(Lexer & lex, string const & token) branch_ptr->setColor(color); // Update also the Color table: if (color == "none") - color = lcolor.getX11Name(Color::background); + color = lcolor.getX11Name(Color_background); // FIXME UNICODE lcolor.setColor(to_utf8(branch), color); diff --git a/src/BufferView.cpp b/src/BufferView.cpp index f3ec599b2a..066789a69b 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -2128,14 +2128,14 @@ void BufferView::draw(frontend::Painter & pain) // lyxerr << "par ascent: " << text.getPar(d->metrics_info_.p1).ascent() << endl; if (d->metrics_info_.y1 > 0 && d->metrics_info_.update_strategy == FullScreenUpdate) - pain.fillRectangle(0, 0, width_, d->metrics_info_.y1, Color::bottomarea); + pain.fillRectangle(0, 0, width_, d->metrics_info_.y1, Color_bottomarea); // and possibly grey out below // lyxerr << "par descent: " << text.getPar(d->metrics_info_.p1).ascent() << endl; if (d->metrics_info_.y2 < height_ && d->metrics_info_.update_strategy == FullScreenUpdate) pain.fillRectangle(0, d->metrics_info_.y2, width_, - height_ - d->metrics_info_.y2, Color::bottomarea); + height_ - d->metrics_info_.y2, Color_bottomarea); } diff --git a/src/Color.cpp b/src/Color.cpp index daaa0aacd6..03f4f6c97a 100644 --- a/src/Color.cpp +++ b/src/Color.cpp @@ -19,6 +19,7 @@ #include "debug.h" #include "gettext.h" #include "Color.h" + #include "support/lstrings.h" #include @@ -40,14 +41,15 @@ using std::ostringstream; using std::string; using std::endl; -using lyx::support::compare_ascii_no_case; -using lyx::support::ascii_lowercase; +namespace lyx { +using support::compare_ascii_no_case; +using support::ascii_lowercase; namespace { struct ColorEntry { - lyx::Color::color lcolor; + ColorCode lcolor; char const * guiname; char const * latexname; char const * x11name; @@ -67,10 +69,6 @@ int hexstrToInt(string const & str) } // namespace anon - -namespace lyx { - - ///////////////////////////////////////////////////////////////////// // // RGBColor @@ -136,11 +134,11 @@ public: } /// - typedef std::map InfoTab; + typedef std::map InfoTab; /// the table of color information InfoTab infotab; - typedef std::map Transform; + typedef std::map Transform; /// the transform between LyX color name string and integer code. Transform lyxcolors; /// the transform between LaTeX color name string and integer code. @@ -152,67 +150,67 @@ public: Color::Color() : pimpl_(new Pimpl) { - // Color::color, gui, latex, x11, lyx + // ColorCode, gui, latex, x11, lyx static ColorEntry const items[] = { - { none, N_("none"), "none", "black", "none" }, - { black, N_("black"), "black", "black", "black" }, - { white, N_("white"), "white", "white", "white" }, - { red, N_("red"), "red", "red", "red" }, - { green, N_("green"), "green", "green", "green" }, - { blue, N_("blue"), "blue", "blue", "blue" }, - { cyan, N_("cyan"), "cyan", "cyan", "cyan" }, - { magenta, N_("magenta"), "magenta", "magenta", "magenta" }, - { yellow, N_("yellow"), "yellow", "yellow", "yellow" }, - { cursor, N_("cursor"), "cursor", "black", "cursor" }, - { background, N_("background"), "background", "linen", "background" }, - { foreground, N_("text"), "foreground", "black", "foreground" }, - { selection, N_("selection"), "selection", "LightBlue", "selection" }, - { latex, N_("LaTeX text"), "latex", "DarkRed", "latex" }, - { preview, N_("previewed snippet"), "preview", "black", "preview" }, - { note, N_("note"), "note", "blue", "note" }, - { notebg, N_("note background"), "notebg", "yellow", "notebg" }, - { comment, N_("comment"), "comment", "magenta", "comment" }, - { commentbg, N_("comment background"), "commentbg", "linen", "commentbg" }, - { greyedout, N_("greyedout inset"), "greyedout", "red", "greyedout" }, - { greyedoutbg, N_("greyedout inset background"), "greyedoutbg", "linen", "greyedoutbg" }, - { shadedbg, N_("shaded box"), "shaded", "#ff0000", "shaded" }, - { depthbar, N_("depth bar"), "depthbar", "IndianRed", "depthbar" }, - { language, N_("language"), "language", "Blue", "language" }, - { command, N_("command inset"), "command", "black", "command" }, - { commandbg, N_("command inset background"), "commandbg", "azure", "commandbg" }, - { commandframe, N_("command inset frame"), "commandframe", "black", "commandframe" }, - { special, N_("special character"), "special", "RoyalBlue", "special" }, - { math, N_("math"), "math", "DarkBlue", "math" }, - { mathbg, N_("math background"), "mathbg", "linen", "mathbg" }, - { graphicsbg, N_("graphics background"), "graphicsbg", "linen", "graphicsbg" }, - { mathmacrobg, N_("Math macro background"), "mathmacrobg", "linen", "mathmacrobg" }, - { mathframe, N_("math frame"), "mathframe", "Magenta", "mathframe" }, - { mathcorners, N_("math corners"), "mathcorners", "linen", "mathcorners" }, - { mathline, N_("math line"), "mathline", "Blue", "mathline" }, - { captionframe, N_("caption frame"), "captionframe", "DarkRed", "captionframe" }, - { collapsable, N_("collapsable inset text"), "collapsable", "DarkRed", "collapsable" }, - { collapsableframe, N_("collapsable inset frame"), "collapsableframe", "IndianRed", "collapsableframe" }, - { insetbg, N_("inset background"), "insetbg", "grey80", "insetbg" }, - { insetframe, N_("inset frame"), "insetframe", "IndianRed", "insetframe" }, - { error, N_("LaTeX error"), "error", "Red", "error" }, - { eolmarker, N_("end-of-line marker"), "eolmarker", "Brown", "eolmarker" }, - { appendix, N_("appendix marker"), "appendix", "Brown", "appendix" }, - { changebar, N_("change bar"), "changebar", "Blue", "changebar" }, - { deletedtext, N_("Deleted text"), "deletedtext", "#ff0000", "deletedtext" }, - { addedtext, N_("Added text"), "addedtext", "#0000ff", "addedtext" }, - { added_space, N_("added space markers"), "added_space", "Brown", "added_space" }, - { topline, N_("top/bottom line"), "topline", "Brown", "topline" }, - { tabularline, N_("table line"), "tabularline", "black", "tabularline" }, - { tabularonoffline, N_("table on/off line"), "tabularonoffline", + { Color_none, N_("none"), "none", "black", "none" }, + { Color_black, N_("black"), "black", "black", "black" }, + { Color_white, N_("white"), "white", "white", "white" }, + { Color_red, N_("red"), "red", "red", "red" }, + { Color_green, N_("green"), "green", "green", "green" }, + { Color_blue, N_("blue"), "blue", "blue", "blue" }, + { Color_cyan, N_("cyan"), "cyan", "cyan", "cyan" }, + { Color_magenta, N_("magenta"), "magenta", "magenta", "magenta" }, + { Color_yellow, N_("yellow"), "yellow", "yellow", "yellow" }, + { Color_cursor, N_("cursor"), "cursor", "black", "cursor" }, + { Color_background, N_("background"), "background", "linen", "background" }, + { Color_foreground, N_("text"), "foreground", "black", "foreground" }, + { Color_selection, N_("selection"), "selection", "LightBlue", "selection" }, + { Color_latex, N_("LaTeX text"), "latex", "DarkRed", "latex" }, + { Color_preview, N_("previewed snippet"), "preview", "black", "preview" }, + { Color_note, N_("note"), "note", "blue", "note" }, + { Color_notebg, N_("note background"), "notebg", "yellow", "notebg" }, + { Color_comment, N_("comment"), "comment", "magenta", "comment" }, + { Color_commentbg, N_("comment background"), "commentbg", "linen", "commentbg" }, + { Color_greyedout, N_("greyedout inset"), "greyedout", "red", "greyedout" }, + { Color_greyedoutbg, N_("greyedout inset background"), "greyedoutbg", "linen", "greyedoutbg" }, + { Color_shadedbg, N_("shaded box"), "shaded", "#ff0000", "shaded" }, + { Color_depthbar, N_("depth bar"), "depthbar", "IndianRed", "depthbar" }, + { Color_language, N_("language"), "language", "Blue", "language" }, + { Color_command, N_("command inset"), "command", "black", "command" }, + { Color_commandbg, N_("command inset background"), "commandbg", "azure", "commandbg" }, + { Color_commandframe, N_("command inset frame"), "commandframe", "black", "commandframe" }, + { Color_special, N_("special character"), "special", "RoyalBlue", "special" }, + { Color_math, N_("math"), "math", "DarkBlue", "math" }, + { Color_mathbg, N_("math background"), "mathbg", "linen", "mathbg" }, + { Color_graphicsbg, N_("graphics background"), "graphicsbg", "linen", "graphicsbg" }, + { Color_mathmacrobg, N_("Math macro background"), "mathmacrobg", "linen", "mathmacrobg" }, + { Color_mathframe, N_("math frame"), "mathframe", "Magenta", "mathframe" }, + { Color_mathcorners, N_("math corners"), "mathcorners", "linen", "mathcorners" }, + { Color_mathline, N_("math line"), "mathline", "Blue", "mathline" }, + { Color_captionframe, N_("caption frame"), "captionframe", "DarkRed", "captionframe" }, + { Color_collapsable, N_("collapsable inset text"), "collapsable", "DarkRed", "collapsable" }, + { Color_collapsableframe, N_("collapsable inset frame"), "collapsableframe", "IndianRed", "collapsableframe" }, + { Color_insetbg, N_("inset background"), "insetbg", "grey80", "insetbg" }, + { Color_insetframe, N_("inset frame"), "insetframe", "IndianRed", "insetframe" }, + { Color_error, N_("LaTeX error"), "error", "Red", "error" }, + { Color_eolmarker, N_("end-of-line marker"), "eolmarker", "Brown", "eolmarker" }, + { Color_appendix, N_("appendix marker"), "appendix", "Brown", "appendix" }, + { Color_changebar, N_("change bar"), "changebar", "Blue", "changebar" }, + { Color_deletedtext, N_("Deleted text"), "deletedtext", "#ff0000", "deletedtext" }, + { Color_addedtext, N_("Added text"), "addedtext", "#0000ff", "addedtext" }, + { Color_added_space, N_("added space markers"), "added_space", "Brown", "added_space" }, + { Color_topline, N_("top/bottom line"), "topline", "Brown", "topline" }, + { Color_tabularline, N_("table line"), "tabularline", "black", "tabularline" }, + { Color_tabularonoffline, N_("table on/off line"), "tabularonoffline", "LightSteelBlue", "tabularonoffline" }, - { bottomarea, N_("bottom area"), "bottomarea", "grey40", "bottomarea" }, - { pagebreak, N_("page break"), "pagebreak", "RoyalBlue", "pagebreak" }, - { buttonframe, N_("frame of button"), "buttonframe", "#dcd2c8", "buttonframe" }, - { buttonbg, N_("button background"), "buttonbg", "#dcd2c8", "buttonbg" }, - { buttonhoverbg, N_("button background under focus"), "buttonhoverbg", "#C7C7CA", "buttonhoverbg" }, - { inherit, N_("inherit"), "inherit", "black", "inherit" }, - { ignore, N_("ignore"), "ignore", "black", "ignore" }, - { ignore, 0, 0, 0, 0 } + { Color_bottomarea, N_("bottom area"), "bottomarea", "grey40", "bottomarea" }, + { Color_pagebreak, N_("page break"), "pagebreak", "RoyalBlue", "pagebreak" }, + { Color_buttonframe, N_("frame of button"), "buttonframe", "#dcd2c8", "buttonframe" }, + { Color_buttonbg, N_("button background"), "buttonbg", "#dcd2c8", "buttonbg" }, + { Color_buttonhoverbg, N_("button background under focus"), "buttonhoverbg", "#C7C7CA", "buttonhoverbg" }, + { Color_inherit, N_("inherit"), "inherit", "black", "inherit" }, + { Color_ignore, N_("ignore"), "ignore", "black", "ignore" }, + { Color_ignore, 0, 0, 0, 0 } }; for (int i = 0; items[i].guiname; ++i) @@ -236,7 +234,7 @@ Color & Color::operator=(Color tmp) } -docstring const Color::getGUIName(Color::color c) const +docstring const Color::getGUIName(ColorCode c) const { Pimpl::InfoTab::const_iterator it = pimpl_->infotab.find(c); if (it != pimpl_->infotab.end()) @@ -245,7 +243,7 @@ docstring const Color::getGUIName(Color::color c) const } -string const Color::getX11Name(Color::color c) const +string const Color::getX11Name(ColorCode c) const { Pimpl::InfoTab::const_iterator it = pimpl_->infotab.find(c); if (it != pimpl_->infotab.end()) @@ -258,7 +256,7 @@ string const Color::getX11Name(Color::color c) const } -string const Color::getLaTeXName(Color::color c) const +string const Color::getLaTeXName(ColorCode c) const { Pimpl::InfoTab::const_iterator it = pimpl_->infotab.find(c); if (it != pimpl_->infotab.end()) @@ -267,7 +265,7 @@ string const Color::getLaTeXName(Color::color c) const } -string const Color::getLyXName(Color::color c) const +string const Color::getLyXName(ColorCode c) const { Pimpl::InfoTab::const_iterator it = pimpl_->infotab.find(c); if (it != pimpl_->infotab.end()) @@ -276,7 +274,7 @@ string const Color::getLyXName(Color::color c) const } -bool Color::setColor(Color::color col, string const & x11name) +bool Color::setColor(ColorCode col, string const & x11name) { Pimpl::InfoTab::iterator it = pimpl_->infotab.find(col); if (it == pimpl_->infotab.end()) { @@ -287,7 +285,7 @@ bool Color::setColor(Color::color col, string const & x11name) // "inherit" is returned for colors not in the database // (and anyway should not be redefined) - if (col == none || col == inherit || col == ignore) { + if (col == Color_none || col == Color_inherit || col == Color_ignore) { lyxerr << "Color " << getLyXName(col) << " may not be redefined" << endl; return false; @@ -305,39 +303,39 @@ bool Color::setColor(string const & lyxname, string const &x11name) LYXERR(Debug::GUI) << "Color::setColor: Unknown color \"" << lyxname << '"' << endl; - addColor(static_cast(pimpl_->infotab.size()), lcname); + addColor(static_cast(pimpl_->infotab.size()), lcname); } return setColor(pimpl_->lyxcolors[lcname], x11name); } -void Color::addColor(Color::color c, string const & lyxname) const +void Color::addColor(ColorCode c, string const & lyxname) const { ColorEntry ce = { c, "", "", "", lyxname.c_str() }; pimpl_->fill(ce); } -Color::color Color::getFromLyXName(string const & lyxname) const +ColorCode Color::getFromLyXName(string const & lyxname) const { string const lcname = ascii_lowercase(lyxname); if (pimpl_->lyxcolors.find(lcname) == pimpl_->lyxcolors.end()) { lyxerr << "Color::getFromLyXName: Unknown color \"" << lyxname << '"' << endl; - return none; + return Color_none; } return pimpl_->lyxcolors[lcname]; } -Color::color Color::getFromLaTeXName(string const & latexname) const +ColorCode Color::getFromLaTeXName(string const & latexname) const { if (pimpl_->latexcolors.find(latexname) == pimpl_->latexcolors.end()) { lyxerr << "Color::getFromLaTeXName: Unknown color \"" << latexname << '"' << endl; - return none; + return Color_none; } return pimpl_->latexcolors[latexname]; diff --git a/src/Color.h b/src/Color.h index d9be348ac8..05e670806e 100644 --- a/src/Color.h +++ b/src/Color.h @@ -19,6 +19,8 @@ #ifndef LCOLOR_H #define LCOLOR_H +#include "ColorCode.h" + #include "support/docstring.h" #include @@ -49,142 +51,6 @@ class Color // explanation. { public: - /// Names of colors, including all logical colors - enum color { - /// No particular color---clear or default - none, - /// The different text colors - black, - /// - white, - /// - red, - /// - green, - /// - blue, - /// - cyan, - /// - magenta, - /// - yellow, - - // Needed interface colors - - /// Cursor color - cursor, - /// Background color - background, - /// Foreground color - foreground, - /// Background color of selected text - selection, - /// Text color in LaTeX mode - latex, - /// The color used for previews - preview, - - /// Text color for notes - note, - /// Background color of notes - notebg, - /// Text color for comments - comment, - /// Background color of comments - commentbg, - /// Text color for greyedout inset - greyedout, - /// Background color of greyedout inset - greyedoutbg, - /// Shaded box background - shadedbg, - - /// Color for the depth bars in the margin - depthbar, - /// Color for marking foreign language words - language, - - /// Text color for command insets - command, - /// Background color for command insets - commandbg, - /// Frame color for command insets - commandframe, - - /// Special chars text color - special, - - /// Graphics inset background color - graphicsbg, - /// Math inset text color - math, - /// Math inset background color - mathbg, - /// Macro math inset background color - mathmacrobg, - /// Math inset frame color under focus - mathframe, - /// Math inset frame color not under focus - mathcorners, - /// Math line color - mathline, - - /// caption frame color - captionframe, - - /// collapsable insets text - collapsable, - /// collapsable insets frame - collapsableframe, - - /// Inset marker background color - insetbg, - /// Inset marker frame color - insetframe, - - /// Error box text color - error, - /// EOL marker color - eolmarker, - /// Added space colour - added_space, - /// Appendix marker color - appendix, - /// changebar color - changebar, - /// deleted text color - deletedtext, - /// added text color - addedtext, - /// Top and bottom line color - topline, - /// Table line color - tabularline, - /// Table line color - tabularonoffline, - /// Bottom area color - bottomarea, - /// Page break color - pagebreak, - - // FIXME: why are the next four separate ?? - /// Color used for button frame - buttonframe, - /// Color used for bottom background - buttonbg, - /// Color used for buttom under focus - buttonhoverbg, - - // Logical attributes - - /// Color is inherited - inherit, - /// For ignoring updates of a color - ignore - }; - - /// Color(); /// @@ -197,7 +63,7 @@ public: /** set the given LyX color to the color defined by the X11 name given * \returns true if successful. */ - bool setColor(Color::color col, std::string const & x11name); + bool setColor(ColorCode col, std::string const & x11name); /** set the given LyX color to the color defined by the X11 * name given \returns true if successful. A new color entry @@ -206,24 +72,24 @@ public: bool setColor(std::string const & lyxname, std::string const & x11name); /// Get the GUI name of \c color. - docstring const getGUIName(Color::color c) const; + docstring const getGUIName(ColorCode c) const; /// Get the X11 name of \c color. - std::string const getX11Name(Color::color c) const; + std::string const getX11Name(ColorCode c) const; /// Get the LaTeX name of \c color. - std::string const getLaTeXName(Color::color c) const; + std::string const getLaTeXName(ColorCode c) const; /// Get the LyX name of \c color. - std::string const getLyXName(Color::color c) const; + std::string const getLyXName(ColorCode c) const; - /// \returns the Color::color associated with the LyX name. - Color::color getFromLyXName(std::string const & lyxname) const; - /// \returns the Color::color associated with the LaTeX name. - Color::color getFromLaTeXName(std::string const & latexname) const; + /// \returns the ColorCode associated with the LyX name. + ColorCode getFromLyXName(std::string const & lyxname) const; + /// \returns the ColorCode associated with the LaTeX name. + ColorCode getFromLaTeXName(std::string const & latexname) const; private: /// - void addColor(Color::color c, std::string const & lyxname) const; + void addColor(ColorCode c, std::string const & lyxname) const; /// class Pimpl; /// @@ -231,22 +97,6 @@ private: }; -/** \c Color_color is a wrapper for Color::color. It can be forward-declared and - * passed as a function argument without having to expose Color.h. - */ -class Color_color { - Color::color val_; -public: - /** The default constructor is nasty, - * but allows us to use Color_color in STL containers. - */ - Color_color() : val_(static_cast(-1)) {} - - Color_color(Color::color val) : val_(val) {} - operator Color::color() const{ return val_; } -}; - - /// the current color definitions extern Color lcolor; /// the system color definitions diff --git a/src/ColorCode.h b/src/ColorCode.h new file mode 100644 index 0000000000..8df8ff4c8f --- /dev/null +++ b/src/ColorCode.h @@ -0,0 +1,153 @@ +// -*- C++ -*- +/** + * \file ColorCode.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * Full author contact details are available in file CREDITS. + */ + +#ifndef COLOR_CODE_H +#define COLOR_CODE_H + +namespace lyx { + +/// Names of colors, including all logical colors +enum ColorCode +{ + /// No particular color---clear or default + Color_none, + /// The different text colors + Color_black, + /// + Color_white, + /// + Color_red, + /// + Color_green, + /// + Color_blue, + /// + Color_cyan, + /// + Color_magenta, + /// + Color_yellow, + + // Needed interface colors + + /// Cursor color + Color_cursor, + /// Background color + Color_background, + /// Foreground color + Color_foreground, + /// Background color of selected text + Color_selection, + /// Text color in LaTeX mode + Color_latex, + /// The color used for previews + Color_preview, + + /// Text color for notes + Color_note, + /// Background color of notes + Color_notebg, + /// Text color for comments + Color_comment, + /// Background color of comments + Color_commentbg, + /// Text color for greyedout inset + Color_greyedout, + /// Background color of greyedout inset + Color_greyedoutbg, + /// Shaded box background + Color_shadedbg, + + /// Color for the depth bars in the margin + Color_depthbar, + /// Color for marking foreign language words + Color_language, + + /// Text color for command insets + Color_command, + /// Background color for command insets + Color_commandbg, + /// Frame color for command insets + Color_commandframe, + + /// Special chars text color + Color_special, + + /// Graphics inset background color + Color_graphicsbg, + /// Math inset text color + Color_math, + /// Math inset background color + Color_mathbg, + /// Macro math inset background color + Color_mathmacrobg, + /// Math inset frame color under focus + Color_mathframe, + /// Math inset frame color not under focus + Color_mathcorners, + /// Math line color + Color_mathline, + + /// caption frame color + Color_captionframe, + + /// collapsable insets text + Color_collapsable, + /// collapsable insets frame + Color_collapsableframe, + + /// Inset marker background color + Color_insetbg, + /// Inset marker frame color + Color_insetframe, + + /// Error box text color + Color_error, + /// EOL marker color + Color_eolmarker, + /// Added space colour + Color_added_space, + /// Appendix marker color + Color_appendix, + /// changebar color + Color_changebar, + /// deleted text color + Color_deletedtext, + /// added text color + Color_addedtext, + /// Top and bottom line color + Color_topline, + /// Table line color + Color_tabularline, + /// Table line color + Color_tabularonoffline, + /// Bottom area color + Color_bottomarea, + /// Page break color + Color_pagebreak, + + // FIXME: why are the next four separate ?? + /// Color used for button frame + Color_buttonframe, + /// Color used for bottom background + Color_buttonbg, + /// Color used for buttom under focus + Color_buttonhoverbg, + + // Logical attributes + + /// Color is inherited + Color_inherit, + /// For ignoring updates of a color + Color_ignore +}; + +} // namespace lyx + +#endif diff --git a/src/Font.cpp b/src/Font.cpp index 5826b34fb1..6dbe00c634 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -124,7 +124,7 @@ Font::FontBits Font::sane = { MEDIUM_SERIES, UP_SHAPE, SIZE_NORMAL, - Color::none, + Color_none, OFF, OFF, OFF, @@ -136,7 +136,7 @@ Font::FontBits Font::inherit = { INHERIT_SERIES, INHERIT_SHAPE, INHERIT_SIZE, - Color::inherit, + Color_inherit, INHERIT, INHERIT, INHERIT, @@ -148,7 +148,7 @@ Font::FontBits Font::ignore = { IGNORE_SERIES, IGNORE_SHAPE, IGNORE_SIZE, - Color::ignore, + Color_ignore, IGNORE, IGNORE, IGNORE, @@ -206,9 +206,9 @@ Font::Font(Font::FONT_INIT3, Language const * l) -Color_color Font::color() const +ColorCode Font::color() const { - return Color::color(bits.color); + return ColorCode(bits.color); } @@ -267,9 +267,9 @@ void Font::setNoun(Font::FONT_MISC_STATE n) } -void Font::setColor(Color_color c) +void Font::setColor(ColorCode c) { - bits.color = int(c); + bits.color = c; } @@ -425,8 +425,8 @@ void Font::update(Font const & newfont, setLanguage(newfont.language()); if (newfont.color() == color() && toggleall) - setColor(Color::inherit); // toggle 'back' - else if (newfont.color() != Color::ignore) + setColor(Color_inherit); // toggle 'back' + else if (newfont.color() != Color_ignore) setColor(newfont.color()); } @@ -449,7 +449,7 @@ void Font::reduce(Font const & tmplt) if (noun() == tmplt.noun()) setNoun(INHERIT); if (color() == tmplt.color()) - setColor(Color::inherit); + setColor(Color_inherit); } @@ -482,7 +482,7 @@ Font & Font::realize(Font const & tmplt) if (bits.noun == INHERIT) bits.noun = tmplt.bits.noun; - if (bits.color == Color::inherit) + if (bits.color == Color_inherit) bits.color = tmplt.bits.color; return *this; @@ -496,7 +496,7 @@ bool Font::resolved() const shape() != INHERIT_SHAPE && size() != INHERIT_SIZE && emph() != INHERIT && underbar() != INHERIT && noun() != INHERIT && - color() != Color::inherit); + color() != Color_inherit); } @@ -511,7 +511,7 @@ docstring const Font::stateText(BufferParams * params) const os << _(GUIShapeNames[shape()]) << ", "; if (size() != INHERIT_SIZE) os << _(GUISizeNames[size()]) << ", "; - if (color() != Color::inherit) + if (color() != Color_inherit) os << lcolor.getGUIName(color()) << ", "; if (emph() != INHERIT) os << bformat(_("Emphasis %1$s, "), @@ -836,7 +836,7 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams, count += strlen(LaTeXShapeNames[f.shape()]) + 2; env = true; //We have opened a new environment } - if (f.color() != Color::inherit && f.color() != Color::ignore) { + if (f.color() != Color_inherit && f.color() != Color_ignore) { os << "\\textcolor{" << from_ascii(lcolor.getLaTeXName(f.color())) << "}{"; @@ -907,7 +907,7 @@ int Font::latexWriteEndChanges(odocstream & os, BufferParams const & bparams, ++count; env = true; // Size change need not bother about closing env. } - if (f.color() != Color::inherit && f.color() != Color::ignore) { + if (f.color() != Color_inherit && f.color() != Color_ignore) { os << '}'; ++count; env = true; // Size change need not bother about closing env. @@ -970,10 +970,10 @@ int Font::latexWriteEndChanges(odocstream & os, BufferParams const & bparams, } -Color_color Font::realColor() const +ColorCode Font::realColor() const { - if (color() == Color::none) - return Color::foreground; + if (color() == Color_none) + return Color_foreground; return color(); } @@ -1048,7 +1048,7 @@ bool Font::fromString(string const & data, bool & toggle) } else if (token == "color") { int const next = lex.getInteger(); - setColor(Color::color(next)); + setColor(ColorCode(next)); } else if (token == "language") { string const next = lex.getString(); @@ -1086,13 +1086,13 @@ void Font::validate(LaTeXFeatures & features) const << endl; } switch (color()) { - case Color::none: - case Color::inherit: - case Color::ignore: + case Color_none: + case Color_inherit: + case Color_ignore: // probably we should put here all interface colors used for // font displaying! For now I just add this ones I know of (Jug) - case Color::latex: - case Color::note: + case Color_latex: + case Color_note: break; default: features.require("color"); diff --git a/src/Font.h b/src/Font.h index 6cd84e53b9..c2b9f405de 100644 --- a/src/Font.h +++ b/src/Font.h @@ -19,7 +19,8 @@ #include "tex2lyx/Font.h" #else -#include "Color.h" +#include "ColorCode.h" + #include "support/docstream.h" @@ -174,10 +175,8 @@ public: FONT_SHAPE shape; /// FONT_SIZE size; - /** We store the Color::color value as an int to get Color.h out - * of the header file. - */ - int color; + /// + ColorCode color; /// FONT_MISC_STATE emph; /// @@ -224,7 +223,7 @@ public: /// FONT_MISC_STATE number() const { return bits.number; } /// - Color_color color() const; + ColorCode color() const; /// Language const * language() const { return lang; } /// @@ -243,7 +242,7 @@ public: void setUnderbar(Font::FONT_MISC_STATE u); void setNoun(Font::FONT_MISC_STATE n); void setNumber(Font::FONT_MISC_STATE n); - void setColor(Color_color c); + void setColor(ColorCode c); void setLanguage(Language const * l); /// Set family after LyX text format @@ -320,7 +319,7 @@ public: docstring const stateText(BufferParams * params) const; /// - Color_color realColor() const; + ColorCode realColor() const; /// void validate(LaTeXFeatures & features) const; diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index 25be2c1866..245267c9b2 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -16,8 +16,8 @@ #include "LaTeXFeatures.h" -#include "BufferParams.h" #include "Color.h" +#include "BufferParams.h" #include "debug.h" #include "Encoding.h" #include "Floating.h" @@ -512,7 +512,7 @@ string const LaTeXFeatures::getPackages() const } // shadecolor for shaded if (mustProvide("framed") && mustProvide("color")) { - RGBColor c = RGBColor(lcolor.getX11Name(Color::shadedbg)); + RGBColor c = RGBColor(lcolor.getX11Name(Color_shadedbg)); //255.0 to force conversion to double //NOTE As Jürgen Spitzmüller pointed out, an alternative would be //to use the xcolor package instead, and then we can do @@ -687,11 +687,11 @@ string const LaTeXFeatures::getMacros() const if (mustProvide("ct-xcolor-soul")) { int const prec = macros.precision(2); - RGBColor cadd = RGBColor(lcolor.getX11Name(Color::addedtext)); + RGBColor cadd = RGBColor(lcolor.getX11Name(Color_addedtext)); macros << "\\providecolor{lyxadded}{rgb}{" << cadd.r / 255.0 << ',' << cadd.g / 255.0 << ',' << cadd.b / 255.0 << "}\n"; - RGBColor cdel = RGBColor(lcolor.getX11Name(Color::deletedtext)); + RGBColor cdel = RGBColor(lcolor.getX11Name(Color_deletedtext)); macros << "\\providecolor{lyxdeleted}{rgb}{" << cdel.r / 255.0 << ',' << cdel.g / 255.0 << ',' << cdel.b / 255.0 << "}\n"; diff --git a/src/LyX.cpp b/src/LyX.cpp index f6d513da3f..4bdf4434ca 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -17,6 +17,7 @@ #include "LyX.h" +#include "Color.h" #include "ConverterCache.h" #include "Buffer.h" #include "buffer_funcs.h" @@ -32,7 +33,6 @@ #include "CmdDef.h" #include "Language.h" #include "Session.h" -#include "Color.h" #include "LyXAction.h" #include "LyXFunc.h" #include "Lexer.h" diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index 87e6b031e4..1324199bcb 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -29,7 +29,6 @@ #include "BufferParams.h" #include "BufferView.h" #include "CmdDef.h" -#include "Color.h" #include "Converter.h" #include "Cursor.h" #include "CutAndPaste.h" @@ -1769,8 +1768,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd) } bool const graphicsbg_changed = - (lyx_name == lcolor.getLyXName(Color::graphicsbg) && - x11_name != lcolor.getX11Name(Color::graphicsbg)); + (lyx_name == lcolor.getLyXName(Color_graphicsbg) && + x11_name != lcolor.getX11Name(Color_graphicsbg)); if (!lcolor.setColor(lyx_name, x11_name)) { setErrorMessage( diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index 698a8f294b..f415aecce6 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -22,11 +22,11 @@ #include "LyXRC.h" #include "debug.h" +#include "Color.h" #include "Converter.h" #include "Format.h" #include "gettext.h" #include "Session.h" -#include "Color.h" #include "Lexer.h" #include "Font.h" #include "Mover.h" @@ -820,11 +820,11 @@ int LyXRC::read(Lexer & lexrc) break; } - Color::color const col = + ColorCode const col = lcolor.getFromLyXName(lyx_name); - if (col == Color::none || - col == Color::inherit || - col == Color::ignore) + if (col == Color_none || + col == Color_inherit || + col == Color_ignore) break; if (!lcolor.setColor(col, x11_name)) { @@ -1696,8 +1696,8 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c << "#\n\n"; case RC_SET_COLOR: - for (int i = 0; i < Color::ignore; ++i) { - Color::color lc = static_cast(i); + for (int i = 0; i < Color_ignore; ++i) { + ColorCode lc = static_cast(i); string const col(lcolor.getX11Name(lc)); if (ignore_system_lyxrc || diff --git a/src/Makefile.am b/src/Makefile.am index ec58f7268a..3bd2e29e8a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -102,6 +102,7 @@ liblyxcore_la_SOURCES = \ Chktex.h \ CmdDef.cpp \ CmdDef.h \ + ColorCode.h \ Color.cpp \ Color.h \ config.h.in \ diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp index 0ddf21ca17..514693e4a6 100644 --- a/src/MetricsInfo.cpp +++ b/src/MetricsInfo.cpp @@ -51,7 +51,7 @@ MetricsInfo::MetricsInfo(BufferView * bv, Font const & font, int textwidth) PainterInfo::PainterInfo(BufferView * bv, lyx::frontend::Painter & painter) : pain(painter), ltr_pos(false), erased_(false), full_repaint(true), - background_color(Color::background) + background_color(Color_background) { base.bv = bv; } diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 779c60f989..c6844e2260 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -29,7 +29,6 @@ #include "InsetList.h" #include "Language.h" #include "LaTeXFeatures.h" -#include "Color.h" #include "Layout.h" #include "Length.h" #include "Font.h" diff --git a/src/Text.cpp b/src/Text.cpp index 3950d6ebc5..44f14e185d 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -38,7 +38,6 @@ #include "FontIterator.h" #include "gettext.h" #include "Language.h" -#include "Color.h" #include "Length.h" #include "Lexer.h" #include "LyXRC.h" diff --git a/src/Text.h b/src/Text.h index 6c7c6946ad..27434c955d 100644 --- a/src/Text.h +++ b/src/Text.h @@ -28,7 +28,6 @@ class Font; class FuncRequest; class FuncStatus; class Inset; -class Color_color; class Cursor; class Lexer; class PainterInfo; diff --git a/src/Text2.cpp b/src/Text2.cpp index b21999fe51..05dc7f18fd 100644 --- a/src/Text2.cpp +++ b/src/Text2.cpp @@ -29,7 +29,6 @@ #include "BufferView.h" #include "Bullet.h" #include "Changes.h" -#include "Color.h" #include "Cursor.h" #include "CutAndPaste.h" #include "debug.h" diff --git a/src/TextClass.cpp b/src/TextClass.cpp index e2e63d5697..1066c081e4 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -15,13 +15,15 @@ #include #include "TextClass.h" -#include "debug.h" -#include "Layout.h" -#include "Lexer.h" + +#include "Color.h" #include "Counters.h" +#include "debug.h" #include "gettext.h" #include "Floating.h" #include "FloatList.h" +#include "Layout.h" +#include "Lexer.h" #include "frontends/alert.h" @@ -657,7 +659,7 @@ void TextClass::readInsetLayout(Lexer & lexrc, docstring const & name) string latexparam; Font font(defaultfont()); Font labelfont(defaultfont()); - Color::color bgcolor(Color::background); + ColorCode bgcolor(Color_background); string preamble; bool multipar(false); bool passthru(false); @@ -1096,7 +1098,7 @@ InsetLayout const & TextClass::insetlayout(docstring const & name) const } static InsetLayout empty; empty.labelstring = from_utf8("UNDEFINED"); - empty.bgcolor = Color::error; + empty.bgcolor = Color_error; return empty; } diff --git a/src/TextClass.h b/src/TextClass.h index d8aa0f17ef..4fcc1e8ea6 100644 --- a/src/TextClass.h +++ b/src/TextClass.h @@ -10,11 +10,13 @@ #ifndef LYXTEXTCLASS_H #define LYXTEXTCLASS_H -#include "Color.h" +#include "ColorCode.h" #include "Font.h" #include "LayoutEnums.h" #include "LayoutPtr.h" +#include "support/docstring.h" + #include #include @@ -43,7 +45,7 @@ public: std::string latexparam; Font font; Font labelfont; - Color::color bgcolor; + ColorCode bgcolor; std::string preamble; bool multipar; bool passthru; diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 39fddf7502..3b871f7dfb 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -24,7 +24,6 @@ #include "buffer_funcs.h" #include "BufferParams.h" #include "BufferView.h" -#include "Color.h" #include "CutAndPaste.h" #include "debug.h" #include "FontIterator.h" @@ -1935,7 +1934,7 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type pit, int x, int y) co if (row_selection || (!pi.full_repaint && row_has_changed)) { pi.pain.fillRectangle(x, y - rit->ascent(), width(), rit->height(), - Color_color(Color::color(pi.background_color))); + ColorCode(ColorCode(pi.background_color))); } if (row_selection) { DocIterator beg = bv_->cursor().selectionBegin(); @@ -2028,7 +2027,7 @@ void TextMetrics::drawSelection(PainterInfo & pi, if (middleTop < middleBottom) { // draw middle rectangle pi.pain.fillRectangle(x, middleTop, width(), middleBottom - middleTop, - Color::selection); + Color_selection); } if (!clipBelow) { @@ -2058,16 +2057,16 @@ void TextMetrics::drawRowSelection(PainterInfo & pi, int x, Row const & row, // draw the margins if (drawOnBegMargin) { if (text_->isRTL(buffer, beg.paragraph())) - pi.pain.fillRectangle(x + x1, y1, width() - x1, y2 - y1, Color::selection); + pi.pain.fillRectangle(x + x1, y1, width() - x1, y2 - y1, Color_selection); else - pi.pain.fillRectangle(x, y1, x1, y2 - y1, Color::selection); + pi.pain.fillRectangle(x, y1, x1, y2 - y1, Color_selection); } if (drawOnEndMargin) { if (text_->isRTL(buffer, beg.paragraph())) - pi.pain.fillRectangle(x, y1, x2, y2 - y1, Color::selection); + pi.pain.fillRectangle(x, y1, x2, y2 - y1, Color_selection); else - pi.pain.fillRectangle(x + x2, y1, width() - x2, y2 - y1, Color::selection); + pi.pain.fillRectangle(x + x2, y1, width() - x2, y2 - y1, Color_selection); } // if we are on a boundary from the beginning, it's probably @@ -2111,7 +2110,7 @@ void TextMetrics::drawRowSelection(PainterInfo & pi, int x, Row const & row, if (!(cur < end) || drawNow) { x2 = cursorX(cur.top(), cur.boundary()); pi.pain.fillRectangle(x + min(x1,x2), y1, abs(x2 - x1), y2 - y1, - Color::selection); + Color_selection); // reset x1, so it is set again next round (which will be on the // right side of a boundary or at the selection end) diff --git a/src/factory.cpp b/src/factory.cpp index 347493a750..6ad657d3f3 100644 --- a/src/factory.cpp +++ b/src/factory.cpp @@ -18,7 +18,6 @@ #include "debug.h" #include "FloatList.h" #include "FuncRequest.h" -#include "Color.h" #include "Lexer.h" #include "LyX.h" @@ -206,7 +205,7 @@ Inset * createInset(BufferView * bv, FuncRequest const & cmd) auto_ptr inset(new InsetCaption(params)); inset->setAutoBreakRows(true); inset->setDrawFrame(true); - inset->setFrameColor(Color::captionframe); + inset->setFrameColor(Color_captionframe); return inset.release(); } diff --git a/src/frontends/Application.h b/src/frontends/Application.h index a682207c05..6c11007bbb 100644 --- a/src/frontends/Application.h +++ b/src/frontends/Application.h @@ -11,6 +11,8 @@ #ifndef LYX_APPLICATION_H #define LYX_APPLICATION_H +#include "ColorCode.h" + #include #include @@ -18,7 +20,6 @@ namespace lyx { class BufferView; -class Color_color; struct RGBColor; namespace frontend { @@ -187,17 +188,17 @@ public: * The function returns true if successful. * It returns false on failure and sets r, g, b to 0. */ - virtual bool getRgbColor(Color_color col, RGBColor & rgbcol) = 0; + virtual bool getRgbColor(ColorCode col, RGBColor & rgbcol) = 0; - /** Eg, passing Color::black returns "000000", - * passing Color::white returns "ffffff". + /** Eg, passing Color_black returns "000000", + * passing Color_white returns "ffffff". */ - virtual std::string const hexName(Color_color col) = 0; + virtual std::string const hexName(ColorCode col) = 0; /** * update an altered GUI color */ - virtual void updateColor(Color_color col) = 0; + virtual void updateColor(ColorCode col) = 0; /** * add a callback for socket read notification diff --git a/src/frontends/Painter.cpp b/src/frontends/Painter.cpp index b5a6b48f04..40930134c1 100644 --- a/src/frontends/Painter.cpp +++ b/src/frontends/Painter.cpp @@ -15,7 +15,6 @@ #include "frontends/FontMetrics.h" -#include "Color.h" #include "Font.h" using lyx::docstring; @@ -29,27 +28,27 @@ namespace frontend { void Painter::button(int x, int y, int w, int h, bool mouseHover) { if (mouseHover) - fillRectangle(x, y, w, h, Color::buttonhoverbg); + fillRectangle(x, y, w, h, Color_buttonhoverbg); else - fillRectangle(x, y, w, h, Color::buttonbg); + fillRectangle(x, y, w, h, Color_buttonbg); buttonFrame(x, y, w, h); } void Painter::buttonFrame(int x, int y, int w, int h) { - line(x, y, x, y + h - 1, Color::buttonframe); - line(x - 1 + w, y, x - 1 + w, y + h - 1, Color::buttonframe); - line(x, y - 1, x - 1 + w, y - 1, Color::buttonframe); - line(x, y + h - 1, x - 1 + w, y + h - 1, Color::buttonframe); + line(x, y, x, y + h - 1, Color_buttonframe); + line(x - 1 + w, y, x - 1 + w, y + h - 1, Color_buttonframe); + line(x, y - 1, x - 1 + w, y - 1, Color_buttonframe); + line(x, y + h - 1, x - 1 + w, y + h - 1, Color_buttonframe); } void Painter::rectText(int x, int y, docstring const & str, Font const & font, - Color_color back, - Color_color frame) + ColorCode back, + ColorCode frame) { int width; int ascent; @@ -58,11 +57,11 @@ void Painter::rectText(int x, int y, FontMetrics const & fm = theFontMetrics(font); fm.rectText(str, width, ascent, descent); - if (back != Color::none) + if (back != Color_none) fillRectangle(x + 1, y - ascent + 1, width - 1, ascent + descent - 1, back); - if (frame != Color::none) + if (frame != Color_none) rectangle(x, y - ascent, width, ascent + descent, frame); text(x + 3, y, str, font); @@ -97,17 +96,17 @@ int Painter::preeditText(int x, int y, char_type c, switch (style) { case preedit_default: // default unselecting mode. - fillRectangle(x, y - height + 1, width, height, Color::background); + fillRectangle(x, y - height + 1, width, height, Color_background); dashedUnderline(font, x, y - descent + 1, width); break; case preedit_selecting: // We are in selecting mode: white text on black background. - fillRectangle(x, y - height + 1, width, height, Color::black); - temp_font.setColor(Color::white); + fillRectangle(x, y - height + 1, width, height, Color_black); + temp_font.setColor(Color_white); break; case preedit_cursor: // The character comes with a cursor. - fillRectangle(x, y - height + 1, width, height, Color::background); + fillRectangle(x, y - height + 1, width, height, Color_background); underline(font, x, y - descent + 1, width); break; } diff --git a/src/frontends/Painter.h b/src/frontends/Painter.h index ef6c9818ea..9fc31a57e7 100644 --- a/src/frontends/Painter.h +++ b/src/frontends/Painter.h @@ -13,11 +13,12 @@ #ifndef PAINTER_H #define PAINTER_H +#include "ColorCode.h" + #include "support/docstring.h" namespace lyx { -class Color_color; class Font; namespace graphics { class Image; } @@ -80,7 +81,7 @@ public: virtual void line( int x1, int y1, int x2, int y2, - Color_color, + ColorCode, line_style = line_solid, line_width = line_thin) = 0; @@ -94,7 +95,7 @@ public: int const * xp, int const * yp, int np, - Color_color, + ColorCode, line_style = line_solid, line_width = line_thin) = 0; @@ -102,7 +103,7 @@ public: virtual void rectangle( int x, int y, int w, int h, - Color_color, + ColorCode, line_style = line_solid, line_width = line_thin) = 0; @@ -110,19 +111,19 @@ public: virtual void fillRectangle( int x, int y, int w, int h, - Color_color) = 0; + ColorCode) = 0; /// draw an arc virtual void arc( int x, int y, unsigned int w, unsigned int h, int a1, int a2, - Color_color) = 0; + ColorCode) = 0; /// draw a pixel virtual void point( int x, int y, - Color_color) = 0; + ColorCode) = 0; /// draw a filled rectangle with the shape of a 3D button virtual void button(int x, int y, @@ -158,8 +159,8 @@ public: void rectText(int x, int baseline, docstring const & str, Font const & font, - Color_color back, - Color_color frame); + ColorCode back, + ColorCode frame); /// draw a string and enclose it inside a button frame void buttonText(int x, int baseline, docstring const & s, diff --git a/src/frontends/WorkArea.cpp b/src/frontends/WorkArea.cpp index bcc14932bf..c3abe443b2 100644 --- a/src/frontends/WorkArea.cpp +++ b/src/frontends/WorkArea.cpp @@ -23,7 +23,6 @@ #include "BufferView.h" #include "Buffer.h" #include "BufferParams.h" -#include "Color.h" #include "CoordCache.h" #include "Cursor.h" #include "debug.h" diff --git a/src/frontends/qt4/ColorCache.cpp b/src/frontends/qt4/ColorCache.cpp index 4a77f0ff63..514246a18f 100644 --- a/src/frontends/qt4/ColorCache.cpp +++ b/src/frontends/qt4/ColorCache.cpp @@ -11,8 +11,8 @@ #include #include "ColorCache.h" -#include "Color.h" +#include "Color.h" namespace lyx { @@ -22,7 +22,7 @@ const QColor grey80(0xcc, 0xcc, 0xcc); const QColor grey90(0xe5, 0xe5, 0xe5); const QColor none = Qt::black; -QColor const & ColorCache::get(Color_color col) const +QColor const & ColorCache::get(ColorCode col) const { lcolor_map::const_iterator cit = colormap.find(col); if (cit != colormap.end()) diff --git a/src/frontends/qt4/ColorCache.h b/src/frontends/qt4/ColorCache.h index 05dabea4b0..4ac4905011 100644 --- a/src/frontends/qt4/ColorCache.h +++ b/src/frontends/qt4/ColorCache.h @@ -12,7 +12,7 @@ #ifndef COLORCACHE_H #define COLORCACHE_H -#include "Color.h" +#include "ColorCode.h" #include @@ -33,13 +33,13 @@ public: ColorCache() {} /// get the given color - QColor const & get(Color_color color) const; + QColor const & get(ColorCode color) const; /// clear all colors void clear(); private: - typedef std::map lcolor_map; + typedef std::map lcolor_map; mutable lcolor_map colormap; }; diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index d764c574af..c604af671b 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -330,7 +330,7 @@ void GuiApplication::syncEvents() } -bool GuiApplication::getRgbColor(Color_color col, +bool GuiApplication::getRgbColor(ColorCode col, RGBColor & rgbcol) { QColor const & qcol = color_cache_.get(col); @@ -347,13 +347,13 @@ bool GuiApplication::getRgbColor(Color_color col, } -string const GuiApplication::hexName(Color_color col) +string const GuiApplication::hexName(ColorCode col) { return support::ltrim(fromqstr(color_cache_.get(col).name()), "#"); } -void GuiApplication::updateColor(Color_color) +void GuiApplication::updateColor(ColorCode) { // FIXME: Bleh, can't we just clear them all at once ? color_cache_.clear(); diff --git a/src/frontends/qt4/GuiApplication.h b/src/frontends/qt4/GuiApplication.h index c2f2551bbe..3ba4800f88 100644 --- a/src/frontends/qt4/GuiApplication.h +++ b/src/frontends/qt4/GuiApplication.h @@ -65,9 +65,9 @@ public: virtual std::string const romanFontName(); virtual std::string const sansFontName(); virtual std::string const typewriterFontName(); - virtual bool getRgbColor(Color_color col, RGBColor & rgbcol); - virtual std::string const hexName(Color_color col); - virtual void updateColor(Color_color col); + virtual bool getRgbColor(ColorCode col, RGBColor & rgbcol); + virtual std::string const hexName(ColorCode col); + virtual void updateColor(ColorCode col); virtual void registerSocketCallback(int fd, SocketCallback func); void unregisterSocketCallback(int fd); //@} diff --git a/src/frontends/qt4/GuiCharacter.cpp b/src/frontends/qt4/GuiCharacter.cpp index 266880592e..d8ee45ca44 100644 --- a/src/frontends/qt4/GuiCharacter.cpp +++ b/src/frontends/qt4/GuiCharacter.cpp @@ -15,13 +15,11 @@ #include "GuiCharacter.h" #include "qt_helpers.h" -#include "Color.h" #include "Font.h" #include "Buffer.h" #include "BufferParams.h" #include "FuncRequest.h" #include "Language.h" -#include "Color.h" #include @@ -169,47 +167,47 @@ static vector const getColorData() ColorPair pr; pr.first = qt_("No change"); - pr.second = Color::ignore; + pr.second = Color_ignore; color[0] = pr; pr.first = qt_("No color"); - pr.second = Color::none; + pr.second = Color_none; color[1] = pr; pr.first = qt_("Black"); - pr.second = Color::black; + pr.second = Color_black; color[2] = pr; pr.first = qt_("White"); - pr.second = Color::white; + pr.second = Color_white; color[3] = pr; pr.first = qt_("Red"); - pr.second = Color::red; + pr.second = Color_red; color[4] = pr; pr.first = qt_("Green"); - pr.second = Color::green; + pr.second = Color_green; color[5] = pr; pr.first = qt_("Blue"); - pr.second = Color::blue; + pr.second = Color_blue; color[6] = pr; pr.first = qt_("Cyan"); - pr.second = Color::cyan; + pr.second = Color_cyan; color[7] = pr; pr.first = qt_("Magenta"); - pr.second = Color::magenta; + pr.second = Color_magenta; color[8] = pr; pr.first = qt_("Yellow"); - pr.second = Color::yellow; + pr.second = Color_yellow; color[9] = pr; pr.first = qt_("Reset"); - pr.second = Color::inherit; + pr.second = Color_inherit; color[10] = pr; return color; @@ -432,7 +430,7 @@ bool GuiCharacter::initialiseParams(string const &) || getShape() != Font::IGNORE_SHAPE || getSize() != Font::IGNORE_SIZE || getBar() != IGNORE - || getColor() != Color::ignore + || getColor() != Color_ignore || font_.language() != ignore_language) setButtonsValid(true); @@ -544,26 +542,26 @@ void GuiCharacter::setBar(FontState val) } -Color_color GuiCharacter::getColor() const +ColorCode GuiCharacter::getColor() const { return font_.color(); } -void GuiCharacter::setColor(Color_color val) +void GuiCharacter::setColor(ColorCode val) { switch (val) { - case Color::ignore: - case Color::none: - case Color::black: - case Color::white: - case Color::red: - case Color::green: - case Color::blue: - case Color::cyan: - case Color::magenta: - case Color::yellow: - case Color::inherit: + case Color_ignore: + case Color_none: + case Color_black: + case Color_white: + case Color_red: + case Color_green: + case Color_blue: + case Color_cyan: + case Color_magenta: + case Color_yellow: + case Color_inherit: font_.setColor(val); break; default: diff --git a/src/frontends/qt4/GuiCharacter.h b/src/frontends/qt4/GuiCharacter.h index 18473d0fef..e2d87b96e9 100644 --- a/src/frontends/qt4/GuiCharacter.h +++ b/src/frontends/qt4/GuiCharacter.h @@ -24,8 +24,6 @@ namespace lyx { -class Color_color; - namespace frontend { enum FontState { @@ -46,7 +44,7 @@ typedef std::pair SeriesPair; typedef std::pair ShapePair; typedef std::pair SizePair; typedef std::pair BarPair; -typedef std::pair ColorPair; +typedef std::pair ColorPair; class GuiCharacter : public GuiDialog, public Ui::CharacterUi { @@ -95,7 +93,7 @@ private: /// void setBar(FontState); /// - void setColor(Color_color); + void setColor(ColorCode); /// void setLanguage(std::string const &); @@ -110,7 +108,7 @@ private: /// FontState getBar() const; /// - Color_color getColor() const; + ColorCode getColor() const; /// std::string getLanguage() const; diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index d551c22bd8..48629ccc6f 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -18,7 +18,6 @@ #include "Buffer.h" #include "BufferParams.h" #include "BufferView.h" -#include "Color.h" #include "Encoding.h" #include "FloatPlacement.h" #include "frontend_helpers.h" diff --git a/src/frontends/qt4/GuiFontLoader.h b/src/frontends/qt4/GuiFontLoader.h index c85e8c6f80..b3128361a3 100644 --- a/src/frontends/qt4/GuiFontLoader.h +++ b/src/frontends/qt4/GuiFontLoader.h @@ -21,6 +21,8 @@ #include +#include + namespace lyx { namespace frontend { diff --git a/src/frontends/qt4/GuiPainter.cpp b/src/frontends/qt4/GuiPainter.cpp index c59edddb02..a3c2b6ccac 100644 --- a/src/frontends/qt4/GuiPainter.cpp +++ b/src/frontends/qt4/GuiPainter.cpp @@ -22,7 +22,6 @@ #include "debug.h" #include "Language.h" -#include "Color.h" #include "support/unicode.h" @@ -64,7 +63,7 @@ GuiPainter::GuiPainter(QPaintDevice * device) : QPainter(device), Painter() { // new QPainter has default QPen: - current_color_ = Color::black; + current_color_ = Color_black; current_ls_ = line_solid; current_lw_ = line_thin; } @@ -77,7 +76,7 @@ GuiPainter::~GuiPainter() } -void GuiPainter::setQPainterPen(Color_color col, +void GuiPainter::setQPainterPen(ColorCode col, Painter::line_style ls, Painter::line_width lw) { if (col == current_color_ && ls == current_ls_ && lw == current_lw_) @@ -105,7 +104,7 @@ void GuiPainter::setQPainterPen(Color_color col, } -void GuiPainter::point(int x, int y, Color_color col) +void GuiPainter::point(int x, int y, ColorCode col) { if (!isDrawingEnabled()) return; @@ -116,7 +115,7 @@ void GuiPainter::point(int x, int y, Color_color col) void GuiPainter::line(int x1, int y1, int x2, int y2, - Color_color col, + ColorCode col, line_style ls, line_width lw) { @@ -133,7 +132,7 @@ void GuiPainter::line(int x1, int y1, int x2, int y2, void GuiPainter::lines(int const * xp, int const * yp, int np, - Color_color col, + ColorCode col, line_style ls, line_width lw) { @@ -161,7 +160,7 @@ void GuiPainter::lines(int const * xp, int const * yp, int np, void GuiPainter::rectangle(int x, int y, int w, int h, - Color_color col, + ColorCode col, line_style ls, line_width lw) { @@ -173,14 +172,14 @@ void GuiPainter::rectangle(int x, int y, int w, int h, } -void GuiPainter::fillRectangle(int x, int y, int w, int h, Color_color col) +void GuiPainter::fillRectangle(int x, int y, int w, int h, ColorCode col) { fillRect(x, y, w, h, guiApp->colorCache().get(col)); } void GuiPainter::arc(int x, int y, unsigned int w, unsigned int h, - int a1, int a2, Color_color col) + int a1, int a2, ColorCode col) { if (!isDrawingEnabled()) return; @@ -199,7 +198,7 @@ void GuiPainter::image(int x, int y, int w, int h, graphics::Image const & i) graphics::GuiImage const & qlimage = static_cast(i); - fillRectangle(x, y, w, h, Color::graphicsbg); + fillRectangle(x, y, w, h, Color_graphicsbg); if (!isDrawingEnabled()) return; diff --git a/src/frontends/qt4/GuiPainter.h b/src/frontends/qt4/GuiPainter.h index 2f47d616af..942a65dc94 100644 --- a/src/frontends/qt4/GuiPainter.h +++ b/src/frontends/qt4/GuiPainter.h @@ -15,8 +15,6 @@ #include "frontends/Painter.h" -#include "Color.h" - #include class QString; @@ -39,7 +37,7 @@ public: virtual void line( int x1, int y1, int x2, int y2, - Color_color, + ColorCode, line_style = line_solid, line_width = line_thin); @@ -53,7 +51,7 @@ public: int const * xp, int const * yp, int np, - Color_color, + ColorCode, line_style = line_solid, line_width = line_thin); @@ -61,7 +59,7 @@ public: virtual void rectangle( int x, int y, int w, int h, - Color_color, + ColorCode, line_style = line_solid, line_width = line_thin); @@ -69,19 +67,19 @@ public: virtual void fillRectangle( int x, int y, int w, int h, - Color_color); + ColorCode); /// draw an arc virtual void arc( int x, int y, unsigned int w, unsigned int h, int a1, int a2, - Color_color); + ColorCode); /// draw a pixel virtual void point( int x, int y, - Color_color); + ColorCode); /// draw an image from the image cache virtual void image(int x, int y, @@ -104,11 +102,11 @@ private: QString const & str, Font const & f); /// set pen parameters - void setQPainterPen(Color_color col, + void setQPainterPen(ColorCode col, line_style ls = line_solid, line_width lw = line_thin); - Color::color current_color_; + ColorCode current_color_; Painter::line_style current_ls_; Painter::line_width current_lw_; }; diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 51d52dd5f8..a8242ad656 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -553,7 +553,7 @@ namespace { struct ColorSorter { - bool operator()(Color::color const & lhs, Color::color const & rhs) const { + bool operator()(ColorCode lhs, ColorCode rhs) const { return lcolor.getGUIName(lhs) < lcolor.getGUIName(rhs); } }; @@ -569,25 +569,25 @@ PrefColors::PrefColors(GuiPreferences * form, QWidget * parent) // See http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg113301.html // for some discussion of why that is not trivial. QPixmap icon(32, 32); - for (int i = 0; i < Color::ignore; ++i) { - Color::color lc = static_cast(i); - if (lc == Color::none - || lc == Color::black - || lc == Color::white - || lc == Color::red - || lc == Color::green - || lc == Color::blue - || lc == Color::cyan - || lc == Color::magenta - || lc == Color::yellow - || lc == Color::inherit - || lc == Color::ignore) continue; + for (int i = 0; i < Color_ignore; ++i) { + ColorCode lc = static_cast(i); + if (lc == Color_none + || lc == Color_black + || lc == Color_white + || lc == Color_red + || lc == Color_green + || lc == Color_blue + || lc == Color_cyan + || lc == Color_magenta + || lc == Color_yellow + || lc == Color_inherit + || lc == Color_ignore) continue; lcolors_.push_back(lc); } std::sort(lcolors_.begin(), lcolors_.end(), ColorSorter()); - vector::const_iterator cit = lcolors_.begin(); - vector::const_iterator const end = lcolors_.end(); + vector::const_iterator cit = lcolors_.begin(); + vector::const_iterator const end = lcolors_.end(); for (; cit != end; ++cit) { (void) new QListWidgetItem(QIcon(icon), toqstr(lcolor.getGUIName(*cit)), lyxObjectsLW); @@ -2279,7 +2279,7 @@ void GuiPreferences::dispatchParams() } -void GuiPreferences::setColor(Color_color col, string const & hex) +void GuiPreferences::setColor(ColorCode col, string const & hex) { colors_.push_back(lcolor.getLyXName(col) + ' ' + hex); } diff --git a/src/frontends/qt4/GuiPrefs.h b/src/frontends/qt4/GuiPrefs.h index d80af4d8ad..9a8520e447 100644 --- a/src/frontends/qt4/GuiPrefs.h +++ b/src/frontends/qt4/GuiPrefs.h @@ -16,7 +16,7 @@ #include "GuiDialog.h" -#include "Color.h" +#include "ColorCode.h" #include "Converter.h" #include "Format.h" #include "KeyMap.h" @@ -53,7 +53,6 @@ namespace lyx { -class Color_color; class Converters; class Formats; class Movers; @@ -167,7 +166,7 @@ private Q_SLOTS: void change_lyxObjects_selection(); private: - std::vector lcolors_; + std::vector lcolors_; // FIXME the use of mutable here is required due to the // fact that initialization is not done in the controller // but in the constructor. @@ -473,7 +472,7 @@ public: docstring const & title) const; /// set a color - void setColor(Color_color col, std::string const & hex); + void setColor(ColorCode col, std::string const & hex); /// update the screen fonts after change void updateScreenFonts(); diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 9c99508c6d..3bd5484f64 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -22,7 +22,6 @@ #include "Buffer.h" #include "BufferView.h" -#include "Color.h" #include "Cursor.h" #include "debug.h" #include "FuncRequest.h" @@ -135,7 +134,7 @@ public: void update(int x, int y, int h, CursorShape shape) { - color_ = guiApp->colorCache().get(Color::cursor); + color_ = guiApp->colorCache().get(Color_cursor); shape_ = shape; switch (shape) { case L_SHAPE: diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp index 610a241962..0c66048806 100644 --- a/src/graphics/PreviewLoader.cpp +++ b/src/graphics/PreviewLoader.cpp @@ -21,7 +21,6 @@ #include "Encoding.h" #include "Format.h" #include "InsetIterator.h" -#include "Color.h" #include "LaTeXFeatures.h" #include "LyXRC.h" #include "output.h" @@ -610,8 +609,8 @@ void PreviewLoader::Impl::startLoading() cs << pconverter_->command << ' ' << pconverter_->to << ' ' << support::quoteName(latexfile.toFilesystemEncoding()) << ' ' << int(font_scaling_factor_) << ' ' - << theApp()->hexName(Color::preview) << ' ' - << theApp()->hexName(Color::background); + << theApp()->hexName(Color_preview) << ' ' + << theApp()->hexName(Color_background); string const command = support::libScriptSearch(cs.str()); diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index a3f93bd88e..cc2f6d6e18 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -19,7 +19,6 @@ #include "Buffer.h" #include "BufferParams.h" #include "BufferView.h" -#include "Color.h" #include "CoordCache.h" #include "Cursor.h" #include "debug.h" @@ -297,8 +296,8 @@ void Inset::metricsMarkers2(Dimension & dim, int framesize) const void Inset::drawMarkers(PainterInfo & pi, int x, int y) const { - Color::color pen_color = mouseHovered() || editing(pi.base.bv)? - Color::mathframe : Color::mathcorners; + ColorCode pen_color = mouseHovered() || editing(pi.base.bv)? + Color_mathframe : Color_mathcorners; Dimension const dim = dimension(*pi.base.bv); @@ -314,8 +313,8 @@ void Inset::drawMarkers(PainterInfo & pi, int x, int y) const void Inset::drawMarkers2(PainterInfo & pi, int x, int y) const { - Color::color pen_color = mouseHovered() || editing(pi.base.bv)? - Color::mathframe : Color::mathcorners; + ColorCode pen_color = mouseHovered() || editing(pi.base.bv)? + Color_mathframe : Color_mathcorners; drawMarkers(pi, x, y); Dimension const dim = dimension(*pi.base.bv); @@ -366,9 +365,9 @@ void Inset::dump() const } -Color_color Inset::backgroundColor() const +ColorCode Inset::backgroundColor() const { - return Color::background; + return Color_background; } diff --git a/src/insets/Inset.h b/src/insets/Inset.h index e8e0f9ef0e..2486d09115 100644 --- a/src/insets/Inset.h +++ b/src/insets/Inset.h @@ -15,6 +15,7 @@ #ifndef INSETBASE_H #define INSETBASE_H +#include "ColorCode.h" #include "InsetCode.h" #include "Dimension.h" @@ -31,7 +32,6 @@ class Buffer; class BufferParams; class BufferView; class Change; -class Color_color; class Cursor; class CursorSlice; class FuncRequest; @@ -381,7 +381,7 @@ public: /// int scroll() const { return 0; } /// - virtual Color_color backgroundColor() const; + virtual ColorCode backgroundColor() const; /// enum CollapseStatus { Collapsed, diff --git a/src/insets/InsetBox.cpp b/src/insets/InsetBox.cpp index 8939f0eacd..ec4dd6a075 100644 --- a/src/insets/InsetBox.cpp +++ b/src/insets/InsetBox.cpp @@ -23,7 +23,6 @@ #include "FuncRequest.h" #include "gettext.h" #include "LaTeXFeatures.h" -#include "Color.h" #include "Lexer.h" #include "MetricsInfo.h" @@ -163,7 +162,7 @@ void InsetBox::setButtonLabel() setLabel(label); - font.setColor(Color::foreground); + font.setColor(Color_foreground); setLabelFont(font); } diff --git a/src/insets/InsetBranch.cpp b/src/insets/InsetBranch.cpp index 4931c184bb..126c8e5a16 100644 --- a/src/insets/InsetBranch.cpp +++ b/src/insets/InsetBranch.cpp @@ -21,7 +21,6 @@ #include "FuncRequest.h" #include "FuncStatus.h" #include "gettext.h" -#include "Color.h" #include "Lexer.h" #include "OutputParams.h" @@ -97,8 +96,8 @@ void InsetBranch::setButtonLabel() docstring s = _("Branch: ") + params_.branch; if (!params_.branch.empty()) { // FIXME UNICODE - Color_color c = lcolor.getFromLyXName(to_utf8(params_.branch)); - if (c == Color::none) { + ColorCode c = lcolor.getFromLyXName(to_utf8(params_.branch)); + if (c == Color_none) { s = _("Undef: ") + s; } } @@ -109,13 +108,13 @@ void InsetBranch::setButtonLabel() } -Color_color InsetBranch::backgroundColor() const +ColorCode InsetBranch::backgroundColor() const { if (!params_.branch.empty()) { // FIXME UNICODE - Color_color c = lcolor.getFromLyXName(to_utf8(params_.branch)); - if (c == Color::none) { - c = Color::error; + ColorCode c = lcolor.getFromLyXName(to_utf8(params_.branch)); + if (c == Color_none) { + c = Color_error; } return c; } else diff --git a/src/insets/InsetBranch.h b/src/insets/InsetBranch.h index 2dcb87da5f..206bd64b66 100644 --- a/src/insets/InsetBranch.h +++ b/src/insets/InsetBranch.h @@ -53,7 +53,7 @@ public: /// void setButtonLabel(); /// - virtual Color_color backgroundColor() const; + virtual ColorCode backgroundColor() const; /// bool showInsetDialog(BufferView *) const; /// diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp index 9447583ccf..5fd181a834 100644 --- a/src/insets/InsetCaption.cpp +++ b/src/insets/InsetCaption.cpp @@ -16,7 +16,6 @@ #include "Buffer.h" #include "BufferParams.h" -#include "Color.h" #include "Counters.h" #include "Cursor.h" #include "BufferView.h" @@ -54,7 +53,7 @@ InsetCaption::InsetCaption(InsetCaption const & ic) { setAutoBreakRows(true); setDrawFrame(true); - setFrameColor(Color::captionframe); + setFrameColor(Color_captionframe); } InsetCaption::InsetCaption(BufferParams const & bp) @@ -62,7 +61,7 @@ InsetCaption::InsetCaption(BufferParams const & bp) { setAutoBreakRows(true); setDrawFrame(true); - setFrameColor(Color::captionframe); + setFrameColor(Color_captionframe); } diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index 17a0fbe8c6..248dc155de 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -23,7 +23,6 @@ #include "FloatList.h" #include "FuncStatus.h" #include "gettext.h" -#include "Color.h" #include "LaTeXFeatures.h" #include "Lexer.h" #include "FuncRequest.h" @@ -79,10 +78,10 @@ InsetCollapsable::InsetCollapsable { setAutoBreakRows(true); setDrawFrame(true); - setFrameColor(Color::collapsableframe); + setFrameColor(Color_collapsableframe); setButtonLabel(); // Fallback for lacking inset layout item - layout_.bgcolor = Color::background; + layout_.bgcolor = Color_background; } @@ -321,7 +320,7 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int y) const theFontMetrics(font).rectText(s, w, a, d); int const ww = max(textdim.wid, w); pi.pain.rectText(x + (ww - w) / 2, y + desc + a, - s, font, Color::none, Color::none); + s, font, Color_none, Color_none); desc += d; } diff --git a/src/insets/InsetCollapsable.h b/src/insets/InsetCollapsable.h index 2aaa609e2b..9949469f79 100644 --- a/src/insets/InsetCollapsable.h +++ b/src/insets/InsetCollapsable.h @@ -130,7 +130,7 @@ public: /// bool setMouseHover(bool mouse_hover); /// - virtual Color_color backgroundColor() const {return layout_.bgcolor; } + virtual ColorCode backgroundColor() const {return layout_.bgcolor; } int latex(Buffer const &, odocstream &, OutputParams const &) const; diff --git a/src/insets/InsetERT.cpp b/src/insets/InsetERT.cpp index a30d609d7c..43efcb22d4 100644 --- a/src/insets/InsetERT.cpp +++ b/src/insets/InsetERT.cpp @@ -24,7 +24,6 @@ #include "gettext.h" #include "Language.h" #include "Layout.h" -#include "Color.h" #include "LyXAction.h" #include "Lexer.h" #include "TextClass.h" diff --git a/src/insets/InsetFlex.cpp b/src/insets/InsetFlex.cpp index 4a4b3856a3..b8a9ec0949 100644 --- a/src/insets/InsetFlex.cpp +++ b/src/insets/InsetFlex.cpp @@ -22,7 +22,6 @@ #include "FuncStatus.h" #include "Cursor.h" #include "gettext.h" -#include "Color.h" #include "Lexer.h" #include "Text.h" #include "MetricsInfo.h" diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp index 3733340660..cdaa590c38 100644 --- a/src/insets/InsetFloat.cpp +++ b/src/insets/InsetFloat.cpp @@ -117,7 +117,7 @@ InsetFloat::InsetFloat(BufferParams const & bp, string const & type) Font font(Font::ALL_SANE); font.decSize(); font.decSize(); - font.setColor(Color::collapsable); + font.setColor(Color_collapsable); setLabelFont(font); params_.type = type; } diff --git a/src/insets/InsetLine.cpp b/src/insets/InsetLine.cpp index 316c9e5d8d..cada18c22d 100644 --- a/src/insets/InsetLine.cpp +++ b/src/insets/InsetLine.cpp @@ -13,7 +13,6 @@ #include "InsetLine.h" #include "debug.h" -#include "Color.h" #include "Text.h" #include "MetricsInfo.h" #include "LaTeXFeatures.h" @@ -54,7 +53,7 @@ void InsetLine::metrics(MetricsInfo & mi, Dimension & dim) const void InsetLine::draw(PainterInfo & pi, int x, int y) const { Dimension const dim = dimension(*pi.base.bv); - pi.pain.line(x, y, x + dim.wid, y, Color::topline, + pi.pain.line(x, y, x + dim.wid, y, Color_topline, Painter::line_solid, Painter::line_thick); } diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp index e9007fa14d..02f5556fd8 100644 --- a/src/insets/InsetListings.cpp +++ b/src/insets/InsetListings.cpp @@ -50,7 +50,7 @@ void InsetListings::init() Font font(Font::ALL_SANE); font.decSize(); font.decSize(); - font.setColor(Color::none); + font.setColor(Color_none); setLabelFont(font); // FIXME: what to do with those? //text_.current_font.setLanguage(latex_language); @@ -315,8 +315,8 @@ void InsetListings::getDrawFont(Font & font) const { font = Font(Font::ALL_INHERIT, latex_language); font.setFamily(Font::TYPEWRITER_FAMILY); - // FIXME: define Color::listing? - font.setColor(Color::foreground); + // FIXME: define Color_listing? + font.setColor(Color_foreground); } diff --git a/src/insets/InsetNewline.cpp b/src/insets/InsetNewline.cpp index b016ed3447..77978bcf96 100644 --- a/src/insets/InsetNewline.cpp +++ b/src/insets/InsetNewline.cpp @@ -94,7 +94,7 @@ void InsetNewline::draw(PainterInfo & pi, int x, int y) const xp[2] = int(x + wid * 0.625); } - pi.pain.lines(xp, yp, 3, Color::eolmarker); + pi.pain.lines(xp, yp, 3, Color_eolmarker); yp[0] = int(y - 0.500 * asc * 0.75); yp[1] = int(y - 0.500 * asc * 0.75); @@ -110,7 +110,7 @@ void InsetNewline::draw(PainterInfo & pi, int x, int y) const xp[2] = int(x); } - pi.pain.lines(xp, yp, 3, Color::eolmarker); + pi.pain.lines(xp, yp, 3, Color_eolmarker); } diff --git a/src/insets/InsetOptArg.cpp b/src/insets/InsetOptArg.cpp index 6150bc8bdb..37eaaa5af0 100644 --- a/src/insets/InsetOptArg.cpp +++ b/src/insets/InsetOptArg.cpp @@ -23,7 +23,7 @@ InsetOptArg::InsetOptArg(BufferParams const & ins) : InsetCollapsable(ins) { Font font(Font::ALL_SANE); - font.setColor(Color::collapsable); + font.setColor(Color_collapsable); setLabelFont(font); setLabel(_("opt")); } @@ -33,7 +33,7 @@ InsetOptArg::InsetOptArg(InsetOptArg const & in) : InsetCollapsable(in) { Font font(Font::ALL_SANE); - font.setColor(Color::collapsable); + font.setColor(Color_collapsable); setLabelFont(font); setLabel(_("opt")); } diff --git a/src/insets/InsetPagebreak.cpp b/src/insets/InsetPagebreak.cpp index 0ee79aa6c2..764358688d 100644 --- a/src/insets/InsetPagebreak.cpp +++ b/src/insets/InsetPagebreak.cpp @@ -14,7 +14,6 @@ #include "debug.h" #include "gettext.h" -#include "Color.h" #include "Text.h" #include "MetricsInfo.h" #include "OutputParams.h" @@ -54,7 +53,7 @@ void InsetPagebreak::metrics(MetricsInfo & mi, Dimension & dim) const void InsetPagebreak::draw(PainterInfo & pi, int x, int y) const { Font font; - font.setColor(Color::pagebreak); + font.setColor(Color_pagebreak); font.decSize(); Dimension const dim = dimension(*pi.base.bv); @@ -68,12 +67,12 @@ void InsetPagebreak::draw(PainterInfo & pi, int x, int y) const int const text_end = text_start + w; pi.pain.rectText(text_start, y + d, insetLabel(), font, - Color::none, Color::none); + Color_none, Color_none); pi.pain.line(x, y, text_start, y, - Color::pagebreak, Painter::line_onoffdash); + Color_pagebreak, Painter::line_onoffdash); pi.pain.line(text_end, y, int(x + dim.wid), y, - Color::pagebreak, Painter::line_onoffdash); + Color_pagebreak, Painter::line_onoffdash); } diff --git a/src/insets/InsetSpace.cpp b/src/insets/InsetSpace.cpp index bbab7f278e..55aa3fd3fa 100644 --- a/src/insets/InsetSpace.cpp +++ b/src/insets/InsetSpace.cpp @@ -16,7 +16,6 @@ #include "InsetSpace.h" #include "debug.h" -#include "Color.h" #include "Lexer.h" #include "MetricsInfo.h" #include "OutputParams.h" @@ -100,9 +99,9 @@ void InsetSpace::draw(PainterInfo & pi, int x, int y) const yp[3] = y - max(h / 4, 1); if (kind_ == PROTECTED || kind_ == ENSPACE || kind_ == NEGTHIN) - pi.pain.lines(xp, yp, 4, Color::latex); + pi.pain.lines(xp, yp, 4, Color_latex); else - pi.pain.lines(xp, yp, 4, Color::special); + pi.pain.lines(xp, yp, 4, Color_special); } diff --git a/src/insets/InsetSpecialChar.cpp b/src/insets/InsetSpecialChar.cpp index e1d176638f..db365de0ff 100644 --- a/src/insets/InsetSpecialChar.cpp +++ b/src/insets/InsetSpecialChar.cpp @@ -16,7 +16,6 @@ #include "debug.h" #include "LaTeXFeatures.h" -#include "Color.h" #include "Lexer.h" #include "MetricsInfo.h" @@ -72,25 +71,25 @@ void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) const switch (kind_) { case HYPHENATION: { - font.setColor(Color::special); + font.setColor(Color_special); pi.pain.text(x, y, char_type('-'), font); break; } case LIGATURE_BREAK: { - font.setColor(Color::special); + font.setColor(Color_special); pi.pain.text(x, y, char_type('|'), font); break; } case END_OF_SENTENCE: { - font.setColor(Color::special); + font.setColor(Color_special); pi.pain.text(x, y, char_type('.'), font); break; } case LDOTS: { - font.setColor(Color::special); + font.setColor(Color_special); string ell = ". . . "; docstring dell(ell.begin(), ell.end()); pi.pain.text(x, y, dell, font); @@ -112,7 +111,7 @@ void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) const xp[2] = ox + w; yp[2] = y - h/2; xp[3] = ox; yp[3] = y; - pi.pain.lines(xp, yp, 4, Color::special); + pi.pain.lines(xp, yp, 4, Color_special); break; } } diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 559ba7201d..25e6a0f8ed 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -24,7 +24,6 @@ #include "Buffer.h" #include "BufferParams.h" #include "BufferView.h" -#include "Color.h" #include "CoordCache.h" #include "Counters.h" #include "Cursor.h" @@ -54,6 +53,8 @@ #include "frontends/Painter.h" #include "frontends/Selection.h" +#include + #include #include #include @@ -3089,7 +3090,7 @@ void InsetTabular::drawSelection(PainterInfo & pi, int x, int y) const int const w = tabular.columnWidth(cell); if (i >= cs && i <= ce && j >= rs && j <= re) pi.pain.fillRectangle(xx, y, w, h, - Color::selection); + Color_selection); xx += w; } y += h; @@ -3108,12 +3109,12 @@ void InsetTabular::drawCellLines(Painter & pain, int x, int y, { int x2 = x + tabular.columnWidth(cell); bool on_off = false; - Color::color col = Color::tabularline; - Color::color onoffcol = Color::tabularonoffline; + ColorCode col = Color_tabularline; + ColorCode onoffcol = Color_tabularonoffline; if (erased) { - col = Color::deletedtext; - onoffcol = Color::deletedtext; + col = Color_deletedtext; + onoffcol = Color_deletedtext; } if (!tabular.topAlreadyDrawn(cell)) { diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index 52e9e4970d..981eea01a9 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -27,7 +27,6 @@ #include "gettext.h" #include "InsetList.h" #include "Intl.h" -#include "Color.h" #include "lyxfind.h" #include "Lexer.h" #include "LyXRC.h" @@ -76,7 +75,7 @@ using std::vector; InsetText::InsetText(BufferParams const & bp) - : drawFrame_(false), frame_color_(Color::insetframe) + : drawFrame_(false), frame_color_(Color_insetframe) { paragraphs().push_back(Paragraph()); paragraphs().back().layout(bp.getTextClass().defaultLayout()); @@ -366,13 +365,13 @@ void InsetText::setDrawFrame(bool flag) } -Color_color InsetText::frameColor() const +ColorCode InsetText::frameColor() const { - return Color::color(frame_color_); + return ColorCode(frame_color_); } -void InsetText::setFrameColor(Color_color col) +void InsetText::setFrameColor(ColorCode col) { frame_color_ = col; } diff --git a/src/insets/InsetText.h b/src/insets/InsetText.h index 2e0aa579fe..0c70080fce 100644 --- a/src/insets/InsetText.h +++ b/src/insets/InsetText.h @@ -25,7 +25,6 @@ class BufferParams; class BufferView; class CursorSlice; class Dimension; -class Color_color; class ParagraphList; class InsetTabular; @@ -87,9 +86,9 @@ public: /// void setDrawFrame(bool); /// - Color_color frameColor() const; + ColorCode frameColor() const; /// - void setFrameColor(Color_color); + void setFrameColor(ColorCode); /// bool showInsetDialog(BufferView *) const; /// @@ -149,7 +148,7 @@ private: /// bool drawFrame_; - /** We store the Color::color value as an int to get Color.h out + /** We store the ColorCode value as an int to get Color.h out * of the header file. */ int frame_color_; diff --git a/src/insets/InsetTheorem.cpp b/src/insets/InsetTheorem.cpp index 312f60b0ec..9c9536d8bf 100644 --- a/src/insets/InsetTheorem.cpp +++ b/src/insets/InsetTheorem.cpp @@ -43,7 +43,7 @@ Inset.heorem::InsetTheorem() Font font(Font::ALL_SANE); font.decSize(); font.decSize(); - font.setColor(Color::collapsable); + font.setColor(Color_collapsable); setLabelFont(font); #if 0 setAutoCollapse(false); diff --git a/src/insets/InsetVSpace.cpp b/src/insets/InsetVSpace.cpp index 0d630b5cdb..b35a46cfc0 100644 --- a/src/insets/InsetVSpace.cpp +++ b/src/insets/InsetVSpace.cpp @@ -18,7 +18,6 @@ #include "DispatchResult.h" #include "FuncRequest.h" #include "gettext.h" -#include "Color.h" #include "Lexer.h" #include "Text.h" #include "MetricsInfo.h" @@ -177,7 +176,7 @@ void InsetVSpace::draw(PainterInfo & pi, int x, int y) const int d = 0; Font font; - font.setColor(Color::added_space); + font.setColor(Color_added_space); font.decSize(); font.decSize(); docstring const lab = label(); @@ -185,18 +184,18 @@ void InsetVSpace::draw(PainterInfo & pi, int x, int y) const pi.pain.rectText(x + 2 * arrow_size + 5, start + (end - start) / 2 + (a - d) / 2, - lab, font, Color::none, Color::none); + lab, font, Color_none, Color_none); // top arrow - pi.pain.line(x, ty1, midx, ty2, Color::added_space); - pi.pain.line(midx, ty2, rightx, ty1, Color::added_space); + pi.pain.line(x, ty1, midx, ty2, Color_added_space); + pi.pain.line(midx, ty2, rightx, ty1, Color_added_space); // bottom arrow - pi.pain.line(x, by1, midx, by2, Color::added_space); - pi.pain.line(midx, by2, rightx, by1, Color::added_space); + pi.pain.line(x, by1, midx, by2, Color_added_space); + pi.pain.line(midx, by2, rightx, by1, Color_added_space); // joining line - pi.pain.line(midx, ty2, midx, by2, Color::added_space); + pi.pain.line(midx, ty2, midx, by2, Color_added_space); } diff --git a/src/insets/InsetWrap.cpp b/src/insets/InsetWrap.cpp index ac8319a65f..adfec340bb 100644 --- a/src/insets/InsetWrap.cpp +++ b/src/insets/InsetWrap.cpp @@ -26,7 +26,6 @@ #include "FuncStatus.h" #include "gettext.h" #include "LaTeXFeatures.h" -#include "Color.h" #include "Lexer.h" #include "OutputParams.h" #include "TocBackend.h" @@ -50,7 +49,7 @@ InsetWrap::InsetWrap(BufferParams const & bp, string const & type) Font font(Font::ALL_SANE); font.decSize(); font.decSize(); - font.setColor(Color::collapsable); + font.setColor(Color_collapsable); setLabelFont(font); params_.type = type; params_.lines = 0; diff --git a/src/insets/RenderButton.cpp b/src/insets/RenderButton.cpp index 2656bd453d..434f44e108 100644 --- a/src/insets/RenderButton.cpp +++ b/src/insets/RenderButton.cpp @@ -12,7 +12,6 @@ #include "RenderButton.h" -#include "Color.h" #include "MetricsInfo.h" #include "frontends/FontMetrics.h" @@ -61,14 +60,14 @@ void RenderButton::draw(PainterInfo & pi, int x, int y) const { // Draw it as a box with the LaTeX text Font font(Font::ALL_SANE); - font.setColor(Color::command); + font.setColor(Color_command); font.decSize(); if (editable_) { pi.pain.buttonText(x + 2, y, text_, font, renderState()); } else { pi.pain.rectText(x + 2, y, text_, font, - Color::commandbg, Color::commandframe); + Color_commandbg, Color_commandframe); } } diff --git a/src/insets/RenderGraphic.cpp b/src/insets/RenderGraphic.cpp index 42d2d776a4..b5c44ff265 100644 --- a/src/insets/RenderGraphic.cpp +++ b/src/insets/RenderGraphic.cpp @@ -15,7 +15,6 @@ #include "insets/Inset.h" #include "gettext.h" -#include "Color.h" #include "LyX.h" #include "LyXRC.h" #include "MetricsInfo.h" @@ -202,7 +201,7 @@ void RenderGraphic::draw(PainterInfo & pi, int x, int y) const y - dim_.asc, dim_.wid - 2 * Inset::TEXT_TO_INSET_OFFSET, dim_.asc + dim_.des, - Color::foreground); + Color_foreground); // Print the file name. Font msgFont = pi.base.font; diff --git a/src/insets/RenderPreview.cpp b/src/insets/RenderPreview.cpp index 763ab7c972..b272f9e8fa 100644 --- a/src/insets/RenderPreview.cpp +++ b/src/insets/RenderPreview.cpp @@ -14,7 +14,6 @@ #include "insets/Inset.h" #include "BufferView.h" -#include "Color.h" #include "Dimension.h" #include "gettext.h" #include "LyX.h" @@ -164,7 +163,7 @@ void RenderPreview::draw(PainterInfo & pi, int x, int y) const y - dim_.asc, dim_.wid - 2 * offset, dim_.asc + dim_.des, - Color::foreground); + Color_foreground); Font font(pi.base.font); font.setFamily(Font::SANS_FAMILY); diff --git a/src/mathed/InsetFormulaMacro.cpp b/src/mathed/InsetFormulaMacro.cpp index 93f7e94bad..d3c4183ce6 100644 --- a/src/mathed/InsetFormulaMacro.cpp +++ b/src/mathed/InsetFormulaMacro.cpp @@ -19,7 +19,6 @@ #include "Cursor.h" #include "debug.h" #include "gettext.h" -#include "Color.h" #include "Lexer.h" #include "OutputParams.h" @@ -139,7 +138,7 @@ void InsetFormulaMacro::draw(PainterInfo & p, int x, int y) const { // label Font font = p.base.font; - font.setColor(Color::math); + font.setColor(Color_math); PainterInfo pi(p.base.bv, p.pain); pi.base.style = LM_ST_TEXT; @@ -149,9 +148,9 @@ void InsetFormulaMacro::draw(PainterInfo & p, int x, int y) const int const w = dim_.wid - 2; int const h = dim_.height() - 2; - // Color::mathbg used to be "AntiqueWhite" but is "linen" now, too - pi.pain.fillRectangle(x, a, w, h, Color::mathmacrobg); - pi.pain.rectangle(x, a, w, h, Color::mathframe); + // Color_mathbg used to be "AntiqueWhite" but is "linen" now, too + pi.pain.fillRectangle(x, a, w, h, Color_mathmacrobg); + pi.pain.rectangle(x, a, w, h, Color_mathframe); // FIXME #if 0 diff --git a/src/mathed/InsetMath.cpp b/src/mathed/InsetMath.cpp index 855b4902e9..5147dd1e8c 100644 --- a/src/mathed/InsetMath.cpp +++ b/src/mathed/InsetMath.cpp @@ -21,6 +21,7 @@ #include "support/textutils.h" #include +#include using std::endl; diff --git a/src/mathed/InsetMathBoxed.cpp b/src/mathed/InsetMathBoxed.cpp index d9e52c3e1f..b2394a737c 100644 --- a/src/mathed/InsetMathBoxed.cpp +++ b/src/mathed/InsetMathBoxed.cpp @@ -14,7 +14,6 @@ #include "MathData.h" #include "MathStream.h" #include "LaTeXFeatures.h" -#include "Color.h" #include "support/std_ostream.h" #include "frontends/Painter.h" @@ -46,7 +45,7 @@ void InsetMathBoxed::draw(PainterInfo & pi, int x, int y) const { Dimension const dim = dimension(*pi.base.bv); pi.pain.rectangle(x + 1, y - dim.ascent() + 1, - dim.width() - 2, dim.height() - 2, Color::foreground); + dim.width() - 2, dim.height() - 2, Color_foreground); cell(0).draw(pi, x + 3, y); setPosCache(pi, x, y); } diff --git a/src/mathed/InsetMathBrace.cpp b/src/mathed/InsetMathBrace.cpp index 1acc85517d..f100e383d0 100644 --- a/src/mathed/InsetMathBrace.cpp +++ b/src/mathed/InsetMathBrace.cpp @@ -14,7 +14,6 @@ #include "MathData.h" #include "MathStream.h" #include "MathSupport.h" -#include "Color.h" #include "frontends/FontMetrics.h" #include "frontends/Painter.h" @@ -58,7 +57,7 @@ void InsetMathBrace::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathBrace::draw(PainterInfo & pi, int x, int y) const { Font font = pi.base.font; - font.setColor(Color::latex); + font.setColor(Color_latex); Dimension t = theFontMetrics(font).dimension('{'); pi.pain.text(x, y, '{', font); cell(0).draw(pi, x + t.wid, y); diff --git a/src/mathed/InsetMathColor.cpp b/src/mathed/InsetMathColor.cpp index 6f75c5b86a..e69b690db8 100644 --- a/src/mathed/InsetMathColor.cpp +++ b/src/mathed/InsetMathColor.cpp @@ -10,6 +10,7 @@ #include +#include "Color.h" #include "InsetMathColor.h" #include "MathData.h" #include "MathStream.h" @@ -21,7 +22,7 @@ namespace lyx { -InsetMathColor::InsetMathColor(bool oldstyle, Color_color const & color) +InsetMathColor::InsetMathColor(bool oldstyle, ColorCode color) : InsetMathNest(1), oldstyle_(oldstyle), color_(from_utf8(lcolor.getLaTeXName(color))) {} @@ -49,7 +50,7 @@ void InsetMathColor::metrics(MetricsInfo & mi, Dimension & dim) const void InsetMathColor::draw(PainterInfo & pi, int x, int y) const { - Color_color origcol = pi.base.font.color(); + ColorCode origcol = pi.base.font.color(); pi.base.font.setColor(lcolor.getFromLaTeXName(to_utf8(color_))); cell(0).draw(pi, x + 1, y); pi.base.font.setColor(origcol); diff --git a/src/mathed/InsetMathColor.h b/src/mathed/InsetMathColor.h index 7bda1581f0..9f8419b633 100644 --- a/src/mathed/InsetMathColor.h +++ b/src/mathed/InsetMathColor.h @@ -12,8 +12,6 @@ #ifndef MATH_COLORINSET_H #define MATH_COLORINSET_H -#include "Color.h" - #include "InsetMathNest.h" @@ -25,7 +23,7 @@ class InsetMathColor : public InsetMathNest { public: /// Create a color inset from LyX color number explicit InsetMathColor(bool oldstyle, - Color_color const & color = Color::none); + ColorCode color = Color_none); /// Create a color inset from LaTeX color name explicit InsetMathColor(bool oldstyle, docstring const & color); /// diff --git a/src/mathed/InsetMathDFrac.cpp b/src/mathed/InsetMathDFrac.cpp index 280a6dfef2..e1f7ce727f 100644 --- a/src/mathed/InsetMathDFrac.cpp +++ b/src/mathed/InsetMathDFrac.cpp @@ -14,7 +14,6 @@ #include "MathData.h" #include "MathStream.h" #include "LaTeXFeatures.h" -#include "Color.h" #include "frontends/Painter.h" @@ -52,7 +51,7 @@ void InsetMathDFrac::draw(PainterInfo & pi, int x, int y) const int m = x + dim.wid / 2; cell(0).draw(pi, m - dim0.wid / 2, y - dim0.des - 2 - 5); cell(1).draw(pi, m - dim1.wid / 2, y + dim1.asc + 2 - 5); - pi.pain.line(x + 1, y - 5, x + dim.wid - 2, y - 5, Color::math); + pi.pain.line(x + 1, y - 5, x + dim.wid - 2, y - 5, Color_math); setPosCache(pi, x, y); } diff --git a/src/mathed/InsetMathFBox.cpp b/src/mathed/InsetMathFBox.cpp index 7533778f95..c8d939d5ec 100644 --- a/src/mathed/InsetMathFBox.cpp +++ b/src/mathed/InsetMathFBox.cpp @@ -13,7 +13,6 @@ #include "InsetMathFBox.h" #include "MathData.h" #include "MathStream.h" -#include "Color.h" #include "support/std_ostream.h" #include "frontends/Painter.h" @@ -52,7 +51,7 @@ void InsetMathFBox::draw(PainterInfo & pi, int x, int y) const { Dimension const dim = dimension(*pi.base.bv); pi.pain.rectangle(x + 1, y - dim.ascent() + 1, - dim.width() - 2, dim.height() - 2, Color::foreground); + dim.width() - 2, dim.height() - 2, Color_foreground); FontSetChanger dummy(pi.base, "textnormal"); cell(0).draw(pi, x + 3, y); setPosCache(pi, x, y); diff --git a/src/mathed/InsetMathFrac.cpp b/src/mathed/InsetMathFrac.cpp index 5ae8189fac..b2f55f56a2 100644 --- a/src/mathed/InsetMathFrac.cpp +++ b/src/mathed/InsetMathFrac.cpp @@ -16,7 +16,6 @@ #include "MathStream.h" #include "TextPainter.h" #include "LaTeXFeatures.h" -#include "Color.h" #include "Cursor.h" #include "frontends/Painter.h" @@ -195,11 +194,11 @@ void InsetMathFrac::draw(PainterInfo & pi, int x, int y) const pi.pain.line(xx + dim0.wid, y + dim.des - 2, xx + dim0.wid + 5, - y - dim.asc + 2, Color::math); + y - dim.asc + 2, Color_math); } if (kind_ == FRAC || kind_ == OVER) pi.pain.line(x + 1, y - 5, - x + dim.wid - 2, y - 5, Color::math); + x + dim.wid - 2, y - 5, Color_math); drawMarkers(pi, x, y); } diff --git a/src/mathed/InsetMathFrameBox.cpp b/src/mathed/InsetMathFrameBox.cpp index 90bcacdc5e..f05da83d87 100644 --- a/src/mathed/InsetMathFrameBox.cpp +++ b/src/mathed/InsetMathFrameBox.cpp @@ -14,7 +14,6 @@ #include "MathData.h" #include "MathStream.h" #include "MathSupport.h" -#include "Color.h" #include "frontends/Painter.h" @@ -50,7 +49,7 @@ void InsetMathFrameBox::draw(PainterInfo & pi, int x, int y) const FontSetChanger dummy(pi.base, "textnormal"); Dimension const dim = dimension(*pi.base.bv); pi.pain.rectangle(x + 1, y - dim.ascent() + 1, - dim.width() - 2, dim.height() - 2, Color::foreground); + dim.width() - 2, dim.height() - 2, Color_foreground); x += 5; BufferView const & bv = *pi.base.bv; diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp index bd4e655c37..f95fdf40b6 100644 --- a/src/mathed/InsetMathGrid.cpp +++ b/src/mathed/InsetMathGrid.cpp @@ -18,7 +18,6 @@ #include "BufferView.h" #include "CutAndPaste.h" #include "FuncStatus.h" -#include "Color.h" #include "Cursor.h" #include "debug.h" #include "FuncRequest.h" @@ -530,7 +529,7 @@ void InsetMathGrid::drawWithMargin(PainterInfo & pi, int x, int y, - i * hlinesep() - hlinesep()/2 - rowsep()/2; pi.pain.line(x + lmargin + 1, yy, x + dim.width() - rmargin - 1, yy, - Color::foreground); + Color_foreground); } for (col_type col = 0; col <= ncols(); ++col) @@ -539,7 +538,7 @@ void InsetMathGrid::drawWithMargin(PainterInfo & pi, int x, int y, - i * vlinesep() - vlinesep()/2 - colsep()/2; pi.pain.line(xx, y - dim.ascent() + 1, xx, y + dim.descent() - 1, - Color::foreground); + Color_foreground); } drawMarkers2(pi, x, y); } diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index e6e4f31b0a..bc74c6ebed 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -30,7 +30,6 @@ #include "BufferView.h" #include "CutAndPaste.h" #include "FuncStatus.h" -#include "Color.h" #include "LaTeXFeatures.h" #include "Cursor.h" #include "debug.h" @@ -334,7 +333,7 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const // selection at the top level of nested inset is difficult to handle. if (!editing(pi.base.bv)) pi.pain.fillRectangle(x + 1, y - dim.asc + 1, dim.wid - 2, - dim.asc + dim.des - 1, Color::mathbg); + dim.asc + dim.des - 1, Color_mathbg); if (use_preview_) { // one pixel gap in front @@ -1302,7 +1301,7 @@ void InsetMathHull::handleFont2(Cursor & cur, docstring const & arg) Font font; bool b; font.fromString(to_utf8(arg), b); - if (font.color() != Color::inherit) { + if (font.color() != Color_inherit) { MathAtom at = MathAtom(new InsetMathColor(true, font.color())); cur.handleNest(at, 0); } diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 2c2c8a6720..9b30e4ed6a 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -35,7 +35,6 @@ #include "Bidi.h" #include "BufferView.h" -#include "Color.h" #include "CoordCache.h" #include "Cursor.h" #include "CutAndPaste.h" @@ -229,7 +228,7 @@ void InsetMathNest::draw(PainterInfo & pi, int x, int y) const #if 0 if (lock_) pi.pain.fillRectangle(x, y - ascent(), width(), height(), - Color::mathlockbg); + Color_mathlockbg); #endif setPosCache(pi, x, y); } @@ -262,7 +261,7 @@ void InsetMathNest::drawSelection(PainterInfo & pi, int x, int y) const int y1 = g.pos.y_ - g.dim.ascent(); int x2 = g.pos.x_ + c.pos2x(s2.pos()); int y2 = g.pos.y_ + g.dim.descent(); - pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, Color::selection); + pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, Color_selection); //lyxerr << "InsetMathNest::drawing selection 3: " // << " x1: " << x1 << " x2: " << x2 // << " y1: " << y1 << " y2: " << y2 << endl; @@ -275,7 +274,7 @@ void InsetMathNest::drawSelection(PainterInfo & pi, int x, int y) const int y1 = g.pos.y_ - g.dim.ascent(); int x2 = g.pos.x_ + g.dim.width(); int y2 = g.pos.y_ + g.dim.descent(); - pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, Color::selection); + pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, Color_selection); } } } @@ -432,7 +431,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg) Font font; bool b; font.fromString(to_utf8(arg), b); - if (font.color() != Color::inherit) { + if (font.color() != Color_inherit) { MathAtom at = MathAtom(new InsetMathColor(true, font.color())); cur.handleNest(at, 0); } diff --git a/src/mathed/InsetMathPhantom.cpp b/src/mathed/InsetMathPhantom.cpp index 8448ff7246..e0ed1a6dd0 100644 --- a/src/mathed/InsetMathPhantom.cpp +++ b/src/mathed/InsetMathPhantom.cpp @@ -14,7 +14,6 @@ #include "MathStream.h" #include "MathStream.h" -#include "Color.h" #include "frontends/Painter.h" @@ -49,8 +48,8 @@ void InsetMathPhantom::draw(PainterInfo & pi, int x, int y) const static int const arrow_size = 4; // We first draw the text and then an arrow - Color_color const origcol = pi.base.font.color(); - pi.base.font.setColor(Color::special); + ColorCode const origcol = pi.base.font.color(); + pi.base.font.setColor(Color_special); cell(0).draw(pi, x + 1, y); pi.base.font.setColor(origcol); Dimension const dim = dimension(*pi.base.bv); @@ -78,15 +77,15 @@ void InsetMathPhantom::draw(PainterInfo & pi, int x, int y) const int const y3 = y4 - arrow_size; // top arrow - pi.pain.line(x2, y1, x1, y2, Color::added_space); - pi.pain.line(x2, y1, x3, y2, Color::added_space); + pi.pain.line(x2, y1, x1, y2, Color_added_space); + pi.pain.line(x2, y1, x3, y2, Color_added_space); // bottom arrow - pi.pain.line(x2, y4, x1, y3, Color::added_space); - pi.pain.line(x2, y4, x3, y3, Color::added_space); + pi.pain.line(x2, y4, x1, y3, Color_added_space); + pi.pain.line(x2, y4, x3, y3, Color_added_space); // joining line - pi.pain.line(x2, y1, x2, y4, Color::added_space); + pi.pain.line(x2, y1, x2, y4, Color_added_space); } if (kind_ == phantom || kind_ == hphantom) { @@ -108,15 +107,15 @@ void InsetMathPhantom::draw(PainterInfo & pi, int x, int y) const int const y3 = y2 + arrow_size; // left arrow - pi.pain.line(x1, y2, x2, y3, Color::added_space); - pi.pain.line(x1, y2, x2, y1, Color::added_space); + pi.pain.line(x1, y2, x2, y3, Color_added_space); + pi.pain.line(x1, y2, x2, y1, Color_added_space); // right arrow - pi.pain.line(x4, y2, x3, y3, Color::added_space); - pi.pain.line(x4, y2, x3, y1, Color::added_space); + pi.pain.line(x4, y2, x3, y3, Color_added_space); + pi.pain.line(x4, y2, x3, y1, Color_added_space); // joining line - pi.pain.line(x1, y2, x4, y2, Color::added_space); + pi.pain.line(x1, y2, x4, y2, Color_added_space); } drawMarkers(pi, x, y); diff --git a/src/mathed/InsetMathRoot.cpp b/src/mathed/InsetMathRoot.cpp index d48eeece0e..2c453bafa1 100644 --- a/src/mathed/InsetMathRoot.cpp +++ b/src/mathed/InsetMathRoot.cpp @@ -15,7 +15,6 @@ #include "MathData.h" #include "MathStream.h" #include "Cursor.h" -#include "Color.h" #include "frontends/Painter.h" @@ -63,12 +62,12 @@ void InsetMathRoot::draw(PainterInfo & pi, int x, int y) const int xp[4]; int yp[4]; pi.pain.line(x + dim.width(), y - a + 1, - x + w + 4, y - a + 1, Color::math); + x + w + 4, y - a + 1, Color_math); xp[0] = x + w + 4; yp[0] = y - a + 1; xp[1] = x + w; yp[1] = y + d; xp[2] = x + w - 2; yp[2] = y + (d - a)/2 + 2; xp[3] = x + w - 5; yp[3] = y + (d - a)/2 + 4; - pi.pain.lines(xp, yp, 4, Color::math); + pi.pain.lines(xp, yp, 4, Color_math); drawMarkers(pi, x, y); } diff --git a/src/mathed/InsetMathSpace.cpp b/src/mathed/InsetMathSpace.cpp index af8b77ea3e..88701f2f56 100644 --- a/src/mathed/InsetMathSpace.cpp +++ b/src/mathed/InsetMathSpace.cpp @@ -15,7 +15,6 @@ #include "MathStream.h" #include "LaTeXFeatures.h" -#include "Color.h" #include "frontends/Painter.h" @@ -101,7 +100,7 @@ void InsetMathSpace::draw(PainterInfo & pi, int x, int y) const xp[2] = x + w - 2; yp[2] = y; xp[3] = x + w - 2; yp[3] = y - 3; - pi.pain.lines(xp, yp, 4, (space_ < 3) ? Color::latex : Color::math); + pi.pain.lines(xp, yp, 4, (space_ < 3) ? Color_latex : Color_math); } diff --git a/src/mathed/InsetMathSqrt.cpp b/src/mathed/InsetMathSqrt.cpp index 81d88cee1d..23ded20156 100644 --- a/src/mathed/InsetMathSqrt.cpp +++ b/src/mathed/InsetMathSqrt.cpp @@ -14,7 +14,6 @@ #include "MathData.h" #include "MathStream.h" #include "TextPainter.h" -#include "Color.h" #include "frontends/Painter.h" @@ -52,11 +51,11 @@ void InsetMathSqrt::draw(PainterInfo & pi, int x, int y) const int xp[3]; int yp[3]; pi.pain.line(x + dim.width(), y - a + 1, - x + 8, y - a + 1, Color::math); + x + 8, y - a + 1, Color_math); xp[0] = x + 8; yp[0] = y - a + 1; xp[1] = x + 5; yp[1] = y + d - 1; xp[2] = x; yp[2] = y + (d - a)/2; - pi.pain.lines(xp, yp, 3, Color::math); + pi.pain.lines(xp, yp, 3, Color_math); drawMarkers(pi, x, y); } diff --git a/src/mathed/InsetMathTFrac.cpp b/src/mathed/InsetMathTFrac.cpp index ee6085434c..2a08b20766 100644 --- a/src/mathed/InsetMathTFrac.cpp +++ b/src/mathed/InsetMathTFrac.cpp @@ -16,7 +16,6 @@ #include "MathStream.h" #include "LaTeXFeatures.h" -#include "Color.h" #include "frontends/Painter.h" @@ -58,7 +57,7 @@ void InsetMathTFrac::draw(PainterInfo & pi, int x, int y) const int m = x + dim.wid / 2; cell(0).draw(pi, m - dim0.width() / 2, y - dim0.descent() - 2 - 5); cell(1).draw(pi, m - dim1.width() / 2, y + dim1.ascent() + 2 - 5); - pi.pain.line(x + 1, y - 5, x + dim.wid - 2, y - 5, Color::math); + pi.pain.line(x + 1, y - 5, x + dim.wid - 2, y - 5, Color_math); setPosCache(pi, x, y); } diff --git a/src/mathed/InsetMathXYArrow.cpp b/src/mathed/InsetMathXYArrow.cpp index 38841b9577..cddc17fa90 100644 --- a/src/mathed/InsetMathXYArrow.cpp +++ b/src/mathed/InsetMathXYArrow.cpp @@ -133,7 +133,7 @@ void InsetMathXYArrow::draw(PainterInfo & pi, int x, int y) const pi.pain.text(x, y, "X"); MathData const & s = sourceCell(); MathData const & t = targetCell(); - pi.pain.line(s.xm(), s.ym(), t.xm(), t.ym(), Color::math); + pi.pain.line(s.xm(), s.ym(), t.xm(), t.ym(), Color_math); cell(1).draw(pi, (s.xm() + t.xm())/2, (s.ym() + t.ym())/2); } diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp index a7013b0529..e30fb3c465 100644 --- a/src/mathed/MathData.cpp +++ b/src/mathed/MathData.cpp @@ -22,7 +22,6 @@ #include "Buffer.h" #include "BufferView.h" #include "CoordCache.h" -#include "Color.h" #include "Cursor.h" #include "debug.h" @@ -297,7 +296,7 @@ void MathData::draw(PainterInfo & pi, int x, int y) const Dimension const & dim = bv.coordCache().getArrays().dim(this); if (empty()) { - pi.pain.rectangle(x, y - dim.ascent(), dim.width(), dim.height(), Color::mathline); + pi.pain.rectangle(x, y - dim.ascent(), dim.width(), dim.height(), Color_mathline); return; } diff --git a/src/mathed/MathMacroTemplate.cpp b/src/mathed/MathMacroTemplate.cpp index 490333bf2a..14dae62192 100644 --- a/src/mathed/MathMacroTemplate.cpp +++ b/src/mathed/MathMacroTemplate.cpp @@ -20,7 +20,6 @@ #include "debug.h" #include "gettext.h" #include "Lexer.h" -#include "Color.h" #include "frontends/FontMetrics.h" #include "frontends/Painter.h" @@ -145,7 +144,7 @@ void MathMacroTemplate::draw(PainterInfo & p, int x, int y) const // label Font font = p.base.font; - font.setColor(Color::math); + font.setColor(Color_math); PainterInfo pi(p.base.bv, p.pain); pi.base.style = LM_ST_TEXT; @@ -155,10 +154,10 @@ void MathMacroTemplate::draw(PainterInfo & p, int x, int y) const int const w = dim.wid - 2; int const h = dim.height() - 2; - // Color::mathbg used to be "AntiqueWhite" but is "linen" now, too + // Color_mathbg used to be "AntiqueWhite" but is "linen" now, too // the next line would overwrite the selection! - //pi.pain.fillRectangle(x, a, w, h, Color::mathmacrobg); - pi.pain.rectangle(x, a, w, h, Color::mathframe); + //pi.pain.fillRectangle(x, a, w, h, Color_mathmacrobg); + pi.pain.rectangle(x, a, w, h, Color_mathframe); // FIXME: #if 0 @@ -175,10 +174,10 @@ void MathMacroTemplate::draw(PainterInfo & p, int x, int y) const int const w1 = cell(1).dimension(*pi.base.bv).width(); cell(0).draw(pi, x + 2, y + 1); pi.pain.rectangle(x, y - dim.ascent() + 3, - w0 + 4, dim.height() - 6, Color::mathline); + w0 + 4, dim.height() - 6, Color_mathline); cell(1).draw(pi, x + 8 + w0, y + 1); pi.pain.rectangle(x + w0 + 6, y - dim.ascent() + 3, - w1 + 4, dim.height() - 6, Color::mathline); + w1 + 4, dim.height() - 6, Color_mathline); if (lockMacro) MacroTable::globalMacros().get(name_).unlock(); diff --git a/src/mathed/MathSupport.cpp b/src/mathed/MathSupport.cpp index 905d38b35a..8b9de76404 100644 --- a/src/mathed/MathSupport.cpp +++ b/src/mathed/MathSupport.cpp @@ -11,14 +11,13 @@ #include -#include "MathSupport.h" -#include "MathData.h" #include "InsetMath.h" -#include "MathStream.h" +#include "MathData.h" #include "MathParser.h" +#include "MathStream.h" +#include "MathSupport.h" #include "debug.h" -#include "Color.h" #include "frontends/FontLoader.h" #include "frontends/FontMetrics.h" @@ -410,7 +409,7 @@ void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h, { if (name == ".") { pi.pain.line(x + w/2, y, x + w/2, y + h, - Color::cursor, Painter::line_onoffdash); + Color_cursor, Painter::line_onoffdash); return; } @@ -452,7 +451,7 @@ void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h, pi.pain.line( int(x + xx + 0.5), int(y + yy + 0.5), int(x + x2 + 0.5), int(y + y2 + 0.5), - Color::math); + Color_math); } else { int xp[32]; int yp[32]; @@ -469,7 +468,7 @@ void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h, yp[j] = int(y + yy + 0.5); // lyxerr << "P[" << j ' ' << xx << ' ' << yy << ' ' << x << ' ' << y << ']'; } - pi.pain.lines(xp, yp, n, Color::math); + pi.pain.lines(xp, yp, n, Color_math); } } } @@ -478,7 +477,7 @@ void mathed_draw_deco(PainterInfo & pi, int x, int y, int w, int h, void drawStrRed(PainterInfo & pi, int x, int y, docstring const & str) { Font f = pi.base.font; - f.setColor(Color::latex); + f.setColor(Color_latex); pi.pain.text(x, y, str, f); } @@ -486,7 +485,7 @@ void drawStrRed(PainterInfo & pi, int x, int y, docstring const & str) void drawStrBlack(PainterInfo & pi, int x, int y, docstring const & str) { Font f = pi.base.font; - f.setColor(Color::foreground); + f.setColor(Color_foreground); pi.pain.text(x, y, str, f); } @@ -504,7 +503,7 @@ struct fontinfo { Font::FONT_FAMILY family_; Font::FONT_SERIES series_; Font::FONT_SHAPE shape_; - Color::color color_; + ColorCode color_; }; @@ -518,87 +517,87 @@ Font::FONT_SHAPE const inh_shape = Font::INHERIT_SHAPE; fontinfo fontinfos[] = { // math fonts {"mathnormal", Font::ROMAN_FAMILY, Font::MEDIUM_SERIES, - Font::ITALIC_SHAPE, Color::math}, + Font::ITALIC_SHAPE, Color_math}, {"mathbf", inh_family, Font::BOLD_SERIES, - inh_shape, Color::math}, + inh_shape, Color_math}, {"mathcal", Font::CMSY_FAMILY, inh_series, - inh_shape, Color::math}, + inh_shape, Color_math}, {"mathfrak", Font::EUFRAK_FAMILY, inh_series, - inh_shape, Color::math}, + inh_shape, Color_math}, {"mathrm", Font::ROMAN_FAMILY, inh_series, - Font::UP_SHAPE, Color::math}, + Font::UP_SHAPE, Color_math}, {"mathsf", Font::SANS_FAMILY, inh_series, - inh_shape, Color::math}, + inh_shape, Color_math}, {"mathbb", Font::MSB_FAMILY, inh_series, - inh_shape, Color::math}, + inh_shape, Color_math}, {"mathtt", Font::TYPEWRITER_FAMILY, inh_series, - inh_shape, Color::math}, + inh_shape, Color_math}, {"mathit", inh_family, inh_series, - Font::ITALIC_SHAPE, Color::math}, + Font::ITALIC_SHAPE, Color_math}, {"cmex", Font::CMEX_FAMILY, inh_series, - inh_shape, Color::math}, + inh_shape, Color_math}, {"cmm", Font::CMM_FAMILY, inh_series, - inh_shape, Color::math}, + inh_shape, Color_math}, {"cmr", Font::CMR_FAMILY, inh_series, - inh_shape, Color::math}, + inh_shape, Color_math}, {"cmsy", Font::CMSY_FAMILY, inh_series, - inh_shape, Color::math}, + inh_shape, Color_math}, {"eufrak", Font::EUFRAK_FAMILY, inh_series, - inh_shape, Color::math}, + inh_shape, Color_math}, {"msa", Font::MSA_FAMILY, inh_series, - inh_shape, Color::math}, + inh_shape, Color_math}, {"msb", Font::MSB_FAMILY, inh_series, - inh_shape, Color::math}, + inh_shape, Color_math}, {"wasy", Font::WASY_FAMILY, inh_series, - inh_shape, Color::math}, + inh_shape, Color_math}, {"esint", Font::ESINT_FAMILY, inh_series, - inh_shape, Color::math}, + inh_shape, Color_math}, // Text fonts {"text", inh_family, inh_series, - inh_shape, Color::foreground}, + inh_shape, Color_foreground}, {"textbf", inh_family, Font::BOLD_SERIES, - inh_shape, Color::foreground}, + inh_shape, Color_foreground}, {"textit", inh_family, inh_series, - Font::ITALIC_SHAPE, Color::foreground}, + Font::ITALIC_SHAPE, Color_foreground}, {"textmd", inh_family, Font::MEDIUM_SERIES, - inh_shape, Color::foreground}, + inh_shape, Color_foreground}, {"textnormal", inh_family, inh_series, - Font::UP_SHAPE, Color::foreground}, + Font::UP_SHAPE, Color_foreground}, {"textrm", Font::ROMAN_FAMILY, - inh_series, Font::UP_SHAPE,Color::foreground}, + inh_series, Font::UP_SHAPE,Color_foreground}, {"textsc", inh_family, inh_series, - Font::SMALLCAPS_SHAPE, Color::foreground}, + Font::SMALLCAPS_SHAPE, Color_foreground}, {"textsf", Font::SANS_FAMILY, inh_series, - inh_shape, Color::foreground}, + inh_shape, Color_foreground}, {"textsl", inh_family, inh_series, - Font::SLANTED_SHAPE, Color::foreground}, + Font::SLANTED_SHAPE, Color_foreground}, {"texttt", Font::TYPEWRITER_FAMILY, inh_series, - inh_shape, Color::foreground}, + inh_shape, Color_foreground}, {"textup", inh_family, inh_series, - Font::UP_SHAPE, Color::foreground}, + Font::UP_SHAPE, Color_foreground}, // TIPA support {"textipa", inh_family, inh_series, - inh_shape, Color::foreground}, + inh_shape, Color_foreground}, // LyX internal usage {"lyxtex", inh_family, inh_series, - Font::UP_SHAPE, Color::latex}, + Font::UP_SHAPE, Color_latex}, {"lyxsymbol", Font::SYMBOL_FAMILY, inh_series, - inh_shape, Color::math}, + inh_shape, Color_math}, {"lyxboldsymbol", Font::SYMBOL_FAMILY, Font::BOLD_SERIES, - inh_shape, Color::math}, + inh_shape, Color_math}, {"lyxblacktext", Font::ROMAN_FAMILY, Font::MEDIUM_SERIES, - Font::UP_SHAPE, Color::foreground}, + Font::UP_SHAPE, Color_foreground}, {"lyxnochange", inh_family, inh_series, - inh_shape, Color::foreground}, + inh_shape, Color_foreground}, {"lyxfakebb", Font::TYPEWRITER_FAMILY, Font::BOLD_SERIES, - Font::UP_SHAPE, Color::math}, + Font::UP_SHAPE, Color_math}, {"lyxfakecal", Font::SANS_FAMILY, Font::MEDIUM_SERIES, - Font::ITALIC_SHAPE, Color::math}, + Font::ITALIC_SHAPE, Color_math}, {"lyxfakefrak", Font::ROMAN_FAMILY, Font::BOLD_SERIES, - Font::ITALIC_SHAPE, Color::math} + Font::ITALIC_SHAPE, Color_math} }; @@ -673,7 +672,7 @@ void augmentFont(Font & font, docstring const & name) font.setSeries(info->series_); if (info->shape_ != inh_shape) font.setShape(info->shape_); - if (info->color_ != Color::none) + if (info->color_ != Color_none) font.setColor(info->color_); } diff --git a/src/rowpainter.cpp b/src/rowpainter.cpp index ee25609259..37787e7998 100644 --- a/src/rowpainter.cpp +++ b/src/rowpainter.cpp @@ -16,7 +16,6 @@ #include "Bidi.h" #include "Buffer.h" #include "CoordCache.h" -#include "Color.h" #include "Cursor.h" #include "debug.h" #include "BufferParams.h" @@ -96,23 +95,23 @@ void RowPainter::paintHfill(pos_type const pos, pos_type const body_pos) int const y0 = yo_; int const y1 = y0 - defaultRowHeight() / 2; - pi_.pain.line(int(x_), y1, int(x_), y0, Color::added_space); + pi_.pain.line(int(x_), y1, int(x_), y0, Color_added_space); if (pm_.hfillExpansion(row_, pos)) { int const y2 = (y0 + y1) / 2; if (pos >= body_pos) { pi_.pain.line(int(x_), y2, int(x_ + row_.hfill), y2, - Color::added_space, + Color_added_space, Painter::line_onoffdash); x_ += row_.hfill; } else { pi_.pain.line(int(x_), y2, int(x_ + row_.label_hfill), y2, - Color::added_space, + Color_added_space, Painter::line_onoffdash); x_ += row_.label_hfill; } - pi_.pain.line(int(x_), y1, int(x_), y0, Color::added_space); + pi_.pain.line(int(x_), y1, int(x_), y0, Color_added_space); } x_ += 2; } @@ -172,10 +171,10 @@ void RowPainter::paintInset(Inset const * inset, pos_type const pos) int const x2 = x1 + dim.wid; int const y1 = yo_ + dim.des; int const y2 = yo_ - dim.asc; - pi_.pain.line(x1, y1, x1, y2, Color::green); - pi_.pain.line(x1, y1, x2, y1, Color::green); - pi_.pain.line(x2, y1, x2, y2, Color::green); - pi_.pain.line(x1, y2, x2, y2, Color::green); + pi_.pain.line(x1, y1, x1, y2, Color_green); + pi_.pain.line(x1, y1, x2, y1, Color_green); + pi_.pain.line(x2, y1, x2, y2, Color_green); + pi_.pain.line(x1, y2, x2, y2, Color_green); #endif } @@ -325,9 +324,9 @@ void RowPainter::paintChars(pos_type & vpos, Font const & font, if (prev_change != Change::UNCHANGED) { Font copy(font); if (prev_change == Change::DELETED) { - copy.setColor(Color::deletedtext); + copy.setColor(Color_deletedtext); } else if (prev_change == Change::INSERTED) { - copy.setColor(Color::addedtext); + copy.setColor(Color_addedtext); } x_ += pi_.pain.text(int(x_), yo_, s, copy); } else { @@ -346,7 +345,7 @@ void RowPainter::paintForeignMark(double orig_x, Font const & font, int desc) return; int const y = yo_ + 1 + desc; - pi_.pain.line(int(orig_x), y, int(x_), y, Color::language); + pi_.pain.line(int(orig_x), y, int(x_), y, Color_language); } @@ -398,7 +397,7 @@ void RowPainter::paintChangeBar() ? row_.ascent() : row_.height(); - pi_.pain.fillRectangle(5, yo_ - row_.ascent(), 3, height, Color::changebar); + pi_.pain.fillRectangle(5, yo_ - row_.ascent(), 3, height, Color_changebar); } @@ -413,8 +412,8 @@ void RowPainter::paintAppendix() if (par_.params().startOfAppendix()) y += 2 * defaultRowHeight(); - pi_.pain.line(1, y, 1, yo_ + row_.height(), Color::appendix); - pi_.pain.line(width_ - 2, y, width_ - 2, yo_ + row_.height(), Color::appendix); + pi_.pain.line(1, y, 1, yo_ + row_.height(), Color_appendix); + pi_.pain.line(width_ - 2, y, width_ - 2, yo_ + row_.height(), Color_appendix); } @@ -451,12 +450,12 @@ void RowPainter::paintDepthBar() int const starty = yo_ - row_.ascent(); int const h = row_.height() - 1 - (i - next_depth - 1) * 3; - pi_.pain.line(x, starty, x, starty + h, Color::depthbar); + pi_.pain.line(x, starty, x, starty + h, Color_depthbar); if (i > prev_depth) - pi_.pain.fillRectangle(x, starty, w, 2, Color::depthbar); + pi_.pain.fillRectangle(x, starty, w, 2, Color_depthbar); if (i > next_depth) - pi_.pain.fillRectangle(x, starty + h, w, 2, Color::depthbar); + pi_.pain.fillRectangle(x, starty + h, w, 2, Color_depthbar); } } @@ -464,7 +463,7 @@ void RowPainter::paintDepthBar() int RowPainter::paintAppendixStart(int y) { Font pb_font; - pb_font.setColor(Color::appendix); + pb_font.setColor(Color_appendix); pb_font.decSize(); int w = 0; @@ -477,10 +476,10 @@ int RowPainter::paintAppendixStart(int y) int const text_start = int(xo_ + (width_ - w) / 2); int const text_end = text_start + w; - pi_.pain.rectText(text_start, y + d, label, pb_font, Color::none, Color::none); + pi_.pain.rectText(text_start, y + d, label, pb_font, Color_none, Color_none); - pi_.pain.line(int(xo_ + 1), y, text_start, y, Color::appendix); - pi_.pain.line(text_end, y, int(xo_ + width_ - 2), y, Color::appendix); + pi_.pain.line(int(xo_ + 1), y, text_start, y, Color_appendix); + pi_.pain.line(text_end, y, int(xo_ + width_ - 2), y, Color_appendix); return 3 * defaultRowHeight(); } @@ -617,7 +616,7 @@ void RowPainter::paintLast() if (par_.isInserted(par_.size()) || par_.isDeleted(par_.size())) { FontMetrics const & fm = theFontMetrics(pi_.base.bv->buffer().params().getFont()); int const length = fm.maxAscent() / 2; - Color::color col = par_.isInserted(par_.size()) ? Color::addedtext : Color::deletedtext; + ColorCode col = par_.isInserted(par_.size()) ? Color_addedtext : Color_deletedtext; pi_.pain.line(int(x_) + 1, yo_ + 2, int(x_) + 1, yo_ + 2 - length, col, Painter::line_solid, Painter::line_thick); @@ -640,9 +639,9 @@ void RowPainter::paintLast() x += (size - width_ + row_.width() + 1) * (is_rtl ? -1 : 1); if (endlabel == END_LABEL_BOX) - pi_.pain.rectangle(x, y, size, size, Color::eolmarker); + pi_.pain.rectangle(x, y, size, size, Color_eolmarker); else - pi_.pain.fillRectangle(x, y, size, size, Color::eolmarker); + pi_.pain.fillRectangle(x, y, size, size, Color_eolmarker); break; } @@ -761,7 +760,7 @@ void RowPainter::paintText() = theFontMetrics(pi_.base.bv->buffer().params().getFont()); int const middle = yo_ - fm.maxAscent() / 3; pi_.pain.line(last_strikeout_x, middle, int(x_), middle, - Color::deletedtext, Painter::line_solid, Painter::line_thin); + Color_deletedtext, Painter::line_solid, Painter::line_thin); running_strikeout = false; } @@ -805,7 +804,7 @@ void RowPainter::paintText() = theFontMetrics(pi_.base.bv->buffer().params().getFont()); int const middle = yo_ - fm.maxAscent() / 3; pi_.pain.line(last_strikeout_x, middle, int(x_), middle, - Color::deletedtext, Painter::line_solid, Painter::line_thin); + Color_deletedtext, Painter::line_solid, Painter::line_thin); running_strikeout = false; } }