2000-02-10 17:53:36 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
2002-03-21 17:27:08 +00:00
|
|
|
*
|
2000-02-10 17:53:36 +00:00
|
|
|
* LyX, The Document Processor
|
2002-03-21 17:27:08 +00:00
|
|
|
*
|
2001-05-30 13:53:44 +00:00
|
|
|
* Copyright 1998-2001 The LyX Team
|
2000-02-10 17:53:36 +00:00
|
|
|
*
|
|
|
|
*======================================================*/
|
|
|
|
|
|
|
|
#ifndef LCOLOR_H
|
|
|
|
#define LCOLOR_H
|
|
|
|
|
|
|
|
#include "LString.h"
|
2003-08-17 11:28:23 +00:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
2000-02-10 17:53:36 +00:00
|
|
|
|
|
|
|
/**
|
2002-03-21 17:27:08 +00:00
|
|
|
This is a stateless class.
|
2000-02-10 17:53:36 +00:00
|
|
|
|
|
|
|
It has one basic purposes:
|
|
|
|
To serve as a color-namespace container (the Color enum).
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2000-02-10 17:53:36 +00:00
|
|
|
|
|
|
|
*/
|
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-05-09 09:43:39 +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,
|
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-08-17 11:28:23 +00:00
|
|
|
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
|
|
|
LColor();
|
2003-05-09 09:43:39 +00:00
|
|
|
///
|
|
|
|
LColor(LColor const &);
|
|
|
|
///
|
|
|
|
~LColor();
|
|
|
|
///
|
|
|
|
void operator=(LColor const &);
|
2003-08-17 11:28:23 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
void LColor::fill(LColor::color c,
|
|
|
|
string const & lyxname,
|
|
|
|
string const & x11name = string(),
|
|
|
|
string const & latexname = string(),
|
|
|
|
string const & guiname = string());
|
|
|
|
|
2001-05-23 13:12:58 +00:00
|
|
|
/// set the given LyX color to the color defined by the X11 name given
|
2000-02-10 17:53:36 +00:00
|
|
|
void setColor(LColor::color col, string const & x11name);
|
2001-05-23 13:12:58 +00:00
|
|
|
/// set the given LyX color to the color defined by the X11 name given
|
2000-06-26 15:33:13 +00:00
|
|
|
bool setColor(string const & lyxname, string const & x11name);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2000-02-10 17:53:36 +00:00
|
|
|
/// Get GUI name of color
|
2000-09-14 17:53:12 +00:00
|
|
|
string const getGUIName(LColor::color c) const;
|
2003-08-17 11:28:23 +00:00
|
|
|
///
|
|
|
|
string const getGUIName(string const & s) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2000-02-10 17:53:36 +00:00
|
|
|
/// Get X11 name of color
|
2000-09-14 17:53:12 +00:00
|
|
|
string const getX11Name(LColor::color c) const;
|
2003-08-17 11:28:23 +00:00
|
|
|
///
|
|
|
|
string const getX11Name(string const & s) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2000-02-10 17:53:36 +00:00
|
|
|
/// Get LaTeX name of color
|
2000-09-14 17:53:12 +00:00
|
|
|
string const getLaTeXName(LColor::color c) const;
|
2003-08-17 11:28:23 +00:00
|
|
|
///
|
|
|
|
string const getLaTeXName(string const & s) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2000-02-10 17:53:36 +00:00
|
|
|
/// Get LyX name of color
|
2000-09-14 17:53:12 +00:00
|
|
|
string const getLyXName(LColor::color c) const;
|
2003-08-17 11:28:23 +00:00
|
|
|
/// (string-to-string version not needed as it is identity)
|
|
|
|
|
|
|
|
///
|
|
|
|
size_t size() const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2001-05-23 13:12:58 +00:00
|
|
|
/// get the color from the GUI name
|
2000-02-10 17:53:36 +00:00
|
|
|
LColor::color getFromGUIName(string const & guiname) const;
|
2001-05-23 13:12:58 +00:00
|
|
|
/// get the color from the LyX name
|
2000-02-10 17:53:36 +00:00
|
|
|
LColor::color getFromLyXName(string const & lyxname) const;
|
|
|
|
private:
|
|
|
|
///
|
2003-05-09 09:43:39 +00:00
|
|
|
struct 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
|
|
|
};
|
|
|
|
|
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
|