2000-02-10 17:53:36 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file LColor.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Asger Alstrup
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author Matthias Ettrich
|
|
|
|
|
* \author Jean-Marc Lasgouttes
|
|
|
|
|
* \author Angus Leeming
|
|
|
|
|
* \author John Levon
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
* \author Martin Vermeer
|
2000-02-10 17:53:36 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
2000-02-10 17:53:36 +00:00
|
|
|
|
|
|
|
|
|
#ifndef LCOLOR_H
|
|
|
|
|
#define LCOLOR_H
|
|
|
|
|
|
2003-08-17 11:28:23 +00:00
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
2003-10-06 19:57:16 +00:00
|
|
|
|
#include <string>
|
2000-02-10 17:53:36 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2004-10-05 10:11:42 +00:00
|
|
|
|
* This is a stateless class.
|
|
|
|
|
*
|
|
|
|
|
* It has one basic purposes:
|
|
|
|
|
* To serve as a color-namespace container (the Color enum).
|
|
|
|
|
*/
|
2001-05-23 13:12:58 +00:00
|
|
|
|
/**
|
|
|
|
|
* \class LColor
|
|
|
|
|
*
|
|
|
|
|
* A class holding color definitions and associated names for
|
|
|
|
|
* LaTeX, X11, the GUI, and LyX internally.
|
|
|
|
|
*
|
|
|
|
|
* A color can be one of the following kinds:
|
|
|
|
|
*
|
|
|
|
|
* - A real, predefined color, such as black, white, red or green.
|
|
|
|
|
* - A logical color, such as no color, inherit, math
|
|
|
|
|
*/
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-09-09 18:27:24 +00:00
|
|
|
|
class LColor
|
2000-11-15 18:02:45 +00:00
|
|
|
|
// made copyable for same reasons as LyXRC was made copyable. See there for
|
|
|
|
|
// explanation.
|
|
|
|
|
{
|
2000-02-10 17:53:36 +00:00
|
|
|
|
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,
|
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
// Needed interface colors
|
2000-02-10 17:53:36 +00:00
|
|
|
|
|
2000-11-21 15:46:13 +00:00
|
|
|
|
/// Cursor color
|
|
|
|
|
cursor,
|
2000-02-10 17:53:36 +00:00
|
|
|
|
/// Background color
|
|
|
|
|
background,
|
|
|
|
|
/// Foreground color
|
|
|
|
|
foreground,
|
|
|
|
|
/// Background color of selected text
|
|
|
|
|
selection,
|
|
|
|
|
/// Text color in LaTeX mode
|
|
|
|
|
latex,
|
2002-07-05 21:24:15 +00:00
|
|
|
|
/// The color used for previews
|
|
|
|
|
preview,
|
2000-02-10 17:53:36 +00:00
|
|
|
|
|
|
|
|
|
/// Text color for notes
|
|
|
|
|
note,
|
|
|
|
|
/// Background color of notes
|
|
|
|
|
notebg,
|
2003-07-30 21:47:18 +00:00
|
|
|
|
/// Text color for comments
|
|
|
|
|
comment,
|
|
|
|
|
/// Background color of comments
|
|
|
|
|
commentbg,
|
|
|
|
|
/// Text color for greyedout inset
|
|
|
|
|
greyedout,
|
|
|
|
|
/// Background color of greyedout inset
|
|
|
|
|
greyedoutbg,
|
2006-06-03 16:46:27 +00:00
|
|
|
|
/// Shaded box background
|
|
|
|
|
shadedbg,
|
2000-02-10 17:53:36 +00:00
|
|
|
|
|
2000-04-26 14:56:50 +00:00
|
|
|
|
/// Color for the depth bars in the margin
|
|
|
|
|
depthbar,
|
2000-05-30 19:31:11 +00:00
|
|
|
|
/// Color for marking foreign language words
|
|
|
|
|
language,
|
2000-04-26 14:56:50 +00:00
|
|
|
|
|
2000-02-10 17:53:36 +00:00
|
|
|
|
/// Text color for command insets
|
|
|
|
|
command,
|
|
|
|
|
/// Background color for command insets
|
|
|
|
|
commandbg,
|
|
|
|
|
/// Frame color for command insets
|
|
|
|
|
commandframe,
|
|
|
|
|
|
|
|
|
|
/// Special chars text color
|
|
|
|
|
special,
|
|
|
|
|
|
2001-09-20 13:16:17 +00:00
|
|
|
|
/// Graphics inset background color
|
|
|
|
|
graphicsbg,
|
2000-02-10 17:53:36 +00:00
|
|
|
|
/// Math inset text color
|
|
|
|
|
math,
|
|
|
|
|
/// Math inset background color
|
|
|
|
|
mathbg,
|
2001-06-27 14:10:35 +00:00
|
|
|
|
/// Macro math inset background color
|
|
|
|
|
mathmacrobg,
|
2000-02-10 17:53:36 +00:00
|
|
|
|
/// Math inset frame color
|
|
|
|
|
mathframe,
|
|
|
|
|
/// Math line color
|
|
|
|
|
mathline,
|
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
/// caption frame color
|
|
|
|
|
captionframe,
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
/// collapsable insets text
|
|
|
|
|
collapsable,
|
|
|
|
|
/// collapsable insets frame
|
|
|
|
|
collapsableframe,
|
|
|
|
|
|
2000-02-10 17:53:36 +00:00
|
|
|
|
/// Inset marker background color
|
|
|
|
|
insetbg,
|
|
|
|
|
/// Inset marker frame color
|
|
|
|
|
insetframe,
|
|
|
|
|
|
|
|
|
|
/// Error box text color
|
|
|
|
|
error,
|
|
|
|
|
/// EOL marker color
|
|
|
|
|
eolmarker,
|
2001-11-27 10:56:14 +00:00
|
|
|
|
/// Added space colour
|
|
|
|
|
added_space,
|
2003-03-13 19:55:39 +00:00
|
|
|
|
/// Appendix marker color
|
|
|
|
|
appendix,
|
2003-02-08 19:18:01 +00:00
|
|
|
|
/// changebar color
|
|
|
|
|
changebar,
|
|
|
|
|
/// strike-out color
|
|
|
|
|
strikeout,
|
|
|
|
|
/// added text color
|
|
|
|
|
newtext,
|
2000-02-10 17:53:36 +00:00
|
|
|
|
/// Top and bottom line color
|
|
|
|
|
topline,
|
|
|
|
|
/// Table line color
|
2000-04-21 15:16:22 +00:00
|
|
|
|
tabularline,
|
|
|
|
|
/// Table line color
|
|
|
|
|
tabularonoffline,
|
2000-02-10 17:53:36 +00:00
|
|
|
|
/// Bottom area color
|
|
|
|
|
bottomarea,
|
|
|
|
|
/// Page break color
|
|
|
|
|
pagebreak,
|
|
|
|
|
|
2001-05-23 13:12:58 +00:00
|
|
|
|
// FIXME: why are the next four separate ??
|
2000-02-10 17:53:36 +00:00
|
|
|
|
/// Color used for top of boxes
|
|
|
|
|
top,
|
|
|
|
|
/// Color used for bottom of boxes
|
|
|
|
|
bottom,
|
|
|
|
|
/// Color used for left side of boxes
|
|
|
|
|
left,
|
|
|
|
|
/// Color used for right side of boxes
|
|
|
|
|
right,
|
|
|
|
|
/// Color used for bottom background
|
|
|
|
|
buttonbg,
|
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
|
// Logical attributes
|
2000-02-10 17:53:36 +00:00
|
|
|
|
|
|
|
|
|
/// Color is inherited
|
|
|
|
|
inherit,
|
|
|
|
|
/// For ignoring updates of a color
|
|
|
|
|
ignore
|
|
|
|
|
};
|
|
|
|
|
|
2003-09-09 18:27:24 +00:00
|
|
|
|
|
2000-02-10 17:53:36 +00:00
|
|
|
|
///
|
|
|
|
|
LColor();
|
2003-05-09 09:43:39 +00:00
|
|
|
|
///
|
|
|
|
|
LColor(LColor const &);
|
|
|
|
|
///
|
|
|
|
|
~LColor();
|
|
|
|
|
///
|
2004-11-23 23:04:52 +00:00
|
|
|
|
LColor & operator=(LColor);
|
2003-08-17 11:28:23 +00:00
|
|
|
|
|
2003-12-14 16:33:56 +00:00
|
|
|
|
/** set the given LyX color to the color defined by the X11 name given
|
|
|
|
|
* \returns true if successful.
|
|
|
|
|
*/
|
|
|
|
|
bool setColor(LColor::color col, std::string const & x11name);
|
|
|
|
|
|
2004-03-25 15:51:21 +00:00
|
|
|
|
/** set the given LyX color to the color defined by the X11
|
|
|
|
|
* name given \returns true if successful. A new color entry
|
|
|
|
|
* is created if the color is unknown
|
|
|
|
|
*/
|
|
|
|
|
bool setColor(std::string const & lyxname, std::string const & x11name);
|
|
|
|
|
|
2003-12-14 16:33:56 +00:00
|
|
|
|
/// Get the GUI name of \c color.
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const getGUIName(LColor::color c) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-12-14 16:33:56 +00:00
|
|
|
|
/// Get the X11 name of \c color.
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const getX11Name(LColor::color c) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-12-14 16:33:56 +00:00
|
|
|
|
/// Get the LaTeX name of \c color.
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const getLaTeXName(LColor::color c) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-12-14 16:33:56 +00:00
|
|
|
|
/// Get the LyX name of \c color.
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const getLyXName(LColor::color c) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2003-12-14 16:33:56 +00:00
|
|
|
|
/// \returns the LColor::color associated with the GUI name.
|
2003-10-06 15:43:21 +00:00
|
|
|
|
LColor::color getFromGUIName(std::string const & guiname) const;
|
2003-12-14 16:33:56 +00:00
|
|
|
|
/// \returns the LColor::color associated with the LyX name.
|
2003-10-06 15:43:21 +00:00
|
|
|
|
LColor::color getFromLyXName(std::string const & lyxname) const;
|
2005-06-17 14:35:19 +00:00
|
|
|
|
/// \returns the LColor::color associated with the LaTeX name.
|
|
|
|
|
LColor::color getFromLaTeXName(std::string const & latexname) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
|
private:
|
2003-12-14 16:33:56 +00:00
|
|
|
|
///
|
|
|
|
|
void addColor(LColor::color c, std::string const & lyxname) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
|
///
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class Pimpl;
|
2000-02-10 17:53:36 +00:00
|
|
|
|
///
|
2003-08-17 11:28:23 +00:00
|
|
|
|
boost::scoped_ptr<Pimpl> pimpl_;
|
2000-02-10 17:53:36 +00:00
|
|
|
|
};
|
|
|
|
|
|
2003-09-15 15:20:22 +00:00
|
|
|
|
|
2003-09-18 11:48:11 +00:00
|
|
|
|
/** \c LColor_color is a wrapper for LColor::color. It can be forward-declared and
|
2003-09-15 15:20:22 +00:00
|
|
|
|
* passed as a function argument without having to expose LColor.h.
|
|
|
|
|
*/
|
2003-09-18 11:48:11 +00:00
|
|
|
|
class LColor_color {
|
2004-10-05 10:11:42 +00:00
|
|
|
|
LColor::color val_;
|
2003-09-15 15:20:22 +00:00
|
|
|
|
public:
|
2004-10-05 10:11:42 +00:00
|
|
|
|
/** The default constructor is nasty,
|
2003-09-18 11:48:11 +00:00
|
|
|
|
* but allows us to use LColor_color in STL containers.
|
2003-09-15 15:20:22 +00:00
|
|
|
|
*/
|
2003-09-18 11:48:11 +00:00
|
|
|
|
LColor_color() : val_(static_cast<LColor::color>(-1)) {}
|
2003-09-15 15:20:22 +00:00
|
|
|
|
|
2003-09-18 11:48:11 +00:00
|
|
|
|
LColor_color(LColor::color val) : val_(val) {}
|
2004-10-05 10:11:42 +00:00
|
|
|
|
operator LColor::color() const{ return val_; }
|
2003-09-15 15:20:22 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2001-05-23 13:12:58 +00:00
|
|
|
|
/// the current color definitions
|
2000-02-10 17:53:36 +00:00
|
|
|
|
extern LColor lcolor;
|
2001-05-23 13:12:58 +00:00
|
|
|
|
/// the system color definitions
|
2000-11-15 18:02:45 +00:00
|
|
|
|
extern LColor system_lcolor;
|
2000-02-10 17:53:36 +00:00
|
|
|
|
|
|
|
|
|
#endif
|