Move Color::color enum to ColorCode.h

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21198 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-10-25 12:41:02 +00:00
parent 1f07a7f929
commit eea79637c7
90 changed files with 619 additions and 668 deletions

View File

@ -11,7 +11,6 @@
#include <config.h>
#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_);
}

View File

@ -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);

View File

@ -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);
}

View File

@ -19,6 +19,7 @@
#include "debug.h"
#include "gettext.h"
#include "Color.h"
#include "support/lstrings.h"
#include <map>
@ -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<Color::color, information> InfoTab;
typedef std::map<ColorCode, information> InfoTab;
/// the table of color information
InfoTab infotab;
typedef std::map<string, Color::color> Transform;
typedef std::map<string, ColorCode> 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<color>(pimpl_->infotab.size()), lcname);
addColor(static_cast<ColorCode>(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];

View File

@ -19,6 +19,8 @@
#ifndef LCOLOR_H
#define LCOLOR_H
#include "ColorCode.h"
#include "support/docstring.h"
#include <boost/scoped_ptr.hpp>
@ -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<Color::color>(-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

153
src/ColorCode.h Normal file
View File

@ -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

View File

@ -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");

View File

@ -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;

View File

@ -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";

View File

@ -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"

View File

@ -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(

View File

@ -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<Color::color>(i);
for (int i = 0; i < Color_ignore; ++i) {
ColorCode lc = static_cast<ColorCode>(i);
string const col(lcolor.getX11Name(lc));
if (ignore_system_lyxrc ||

View File

@ -102,6 +102,7 @@ liblyxcore_la_SOURCES = \
Chktex.h \
CmdDef.cpp \
CmdDef.h \
ColorCode.h \
Color.cpp \
Color.h \
config.h.in \

View File

@ -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;
}

View File

@ -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"

View File

@ -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"

View File

@ -28,7 +28,6 @@ class Font;
class FuncRequest;
class FuncStatus;
class Inset;
class Color_color;
class Cursor;
class Lexer;
class PainterInfo;

View File

@ -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"

View File

@ -15,13 +15,15 @@
#include <config.h>
#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;
}

View File

@ -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 <boost/shared_ptr.hpp>
#include <vector>
@ -43,7 +45,7 @@ public:
std::string latexparam;
Font font;
Font labelfont;
Color::color bgcolor;
ColorCode bgcolor;
std::string preamble;
bool multipar;
bool passthru;

View File

@ -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)

View File

@ -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<InsetCaption> inset(new InsetCaption(params));
inset->setAutoBreakRows(true);
inset->setDrawFrame(true);
inset->setFrameColor(Color::captionframe);
inset->setFrameColor(Color_captionframe);
return inset.release();
}

View File

@ -11,6 +11,8 @@
#ifndef LYX_APPLICATION_H
#define LYX_APPLICATION_H
#include "ColorCode.h"
#include <boost/function.hpp>
#include <string>
@ -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

View File

@ -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;
}

View File

@ -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,

View File

@ -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"

View File

@ -11,8 +11,8 @@
#include <config.h>
#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())

View File

@ -12,7 +12,7 @@
#ifndef COLORCACHE_H
#define COLORCACHE_H
#include "Color.h"
#include "ColorCode.h"
#include <QColor>
@ -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<Color_color, QColor> lcolor_map;
typedef std::map<ColorCode, QColor> lcolor_map;
mutable lcolor_map colormap;
};

View File

@ -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();

View File

@ -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);
//@}

View File

@ -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 <QCloseEvent>
@ -169,47 +167,47 @@ static vector<ColorPair> 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:

View File

@ -24,8 +24,6 @@
namespace lyx {
class Color_color;
namespace frontend {
enum FontState {
@ -46,7 +44,7 @@ typedef std::pair<QString, Font::FONT_SERIES> SeriesPair;
typedef std::pair<QString, Font::FONT_SHAPE> ShapePair;
typedef std::pair<QString, Font::FONT_SIZE> SizePair;
typedef std::pair<QString, FontState> BarPair;
typedef std::pair<QString, Color_color> ColorPair;
typedef std::pair<QString, ColorCode> 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;

View File

@ -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"

View File

@ -21,6 +21,8 @@
#include <QFont>
#include <boost/scoped_ptr.hpp>
namespace lyx {
namespace frontend {

View File

@ -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<graphics::GuiImage const &>(i);
fillRectangle(x, y, w, h, Color::graphicsbg);
fillRectangle(x, y, w, h, Color_graphicsbg);
if (!isDrawingEnabled())
return;

View File

@ -15,8 +15,6 @@
#include "frontends/Painter.h"
#include "Color.h"
#include <QPainter>
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_;
};

View File

@ -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<Color::color>(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<ColorCode>(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<Color_color>::const_iterator cit = lcolors_.begin();
vector<Color_color>::const_iterator const end = lcolors_.end();
vector<ColorCode>::const_iterator cit = lcolors_.begin();
vector<ColorCode>::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);
}

View File

@ -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<Color_color> lcolors_;
std::vector<ColorCode> 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();

View File

@ -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:

View File

@ -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());

View File

@ -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;
}

View File

@ -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,

View File

@ -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);
}

View File

@ -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

View File

@ -53,7 +53,7 @@ public:
///
void setButtonLabel();
///
virtual Color_color backgroundColor() const;
virtual ColorCode backgroundColor() const;
///
bool showInsetDialog(BufferView *) const;
///

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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"

View File

@ -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"

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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"));
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -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 <boost/scoped_ptr.hpp>
#include <sstream>
#include <iostream>
#include <limits>
@ -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)) {

View File

@ -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;
}

View File

@ -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_;

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -21,6 +21,7 @@
#include "support/textutils.h"
#include <boost/current_function.hpp>
#include <boost/assert.hpp>
using std::endl;

View File

@ -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);
}

View File

@ -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);

View File

@ -10,6 +10,7 @@
#include <config.h>
#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);

View File

@ -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);
///

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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();

View File

@ -11,14 +11,13 @@
#include <config.h>
#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_);
}

View File

@ -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;
}
}