2000-02-10 17:53:36 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
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
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
#include "LString.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
|
|
|
|
class LColor // : public boost::noncopyable {
|
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,
|
|
|
|
|
|
|
|
/// Text color for notes
|
|
|
|
note,
|
|
|
|
/// Background color of notes
|
|
|
|
notebg,
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
|
|
|
/// 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 cursor color
|
|
|
|
mathcursor,
|
|
|
|
/// Math line color
|
|
|
|
mathline,
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
/// caption frame color
|
|
|
|
captionframe,
|
|
|
|
|
|
|
|
/// 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,
|
|
|
|
/// Appendix line color
|
|
|
|
appendixline,
|
|
|
|
/// VFill line color
|
|
|
|
vfillline,
|
|
|
|
/// 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,
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
// Logical attributes
|
2000-02-10 17:53:36 +00:00
|
|
|
|
|
|
|
/// Color is inherited
|
|
|
|
inherit,
|
|
|
|
/// For ignoring updates of a color
|
|
|
|
ignore
|
|
|
|
};
|
|
|
|
|
|
|
|
///
|
|
|
|
LColor();
|
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);
|
2001-05-23 13:12:58 +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;
|
2001-05-23 13:12:58 +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;
|
2001-05-23 13:12:58 +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;
|
2001-05-23 13:12:58 +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;
|
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:
|
|
|
|
///
|
|
|
|
struct information {
|
2001-05-23 13:12:58 +00:00
|
|
|
/// the name as it appears in the GUI
|
2000-02-10 17:53:36 +00:00
|
|
|
string guiname;
|
2001-05-23 13:12:58 +00:00
|
|
|
/// the name used in LaTeX
|
2000-02-10 17:53:36 +00:00
|
|
|
string latexname;
|
2001-05-23 13:12:58 +00:00
|
|
|
/// the name for X11
|
2000-02-10 17:53:36 +00:00
|
|
|
string x11name;
|
2001-05-23 13:12:58 +00:00
|
|
|
/// the name for LyX
|
2000-02-10 17:53:36 +00:00
|
|
|
string lyxname;
|
|
|
|
};
|
|
|
|
|
2001-05-23 13:12:58 +00:00
|
|
|
/// initialise a color entry
|
2000-02-10 17:53:36 +00:00
|
|
|
void fill(LColor::color col, string const & gui,
|
|
|
|
string const & latex, string const & x11,
|
|
|
|
string const & lyx);
|
|
|
|
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
typedef std::map<LColor::color, information> InfoTab;
|
2001-05-23 13:12:58 +00:00
|
|
|
/// the table of color information
|
2000-02-10 17:53:36 +00:00
|
|
|
InfoTab infotab;
|
|
|
|
};
|
|
|
|
|
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
|