+2003-09-15 Angus Leeming <leeming@lyx.org>
+
+ * LColor.h: add an EnumLColor wrapper for LColor::color.
+
+ * lyxfont.[Ch] (color, setColor, realColor):
+ * lyxtext.h, text.C (backgroundColor):
+ pass EnumLColor args to/from the functions, rather than LColor::color ones.
+
+ * lyxfont.h:
+ * lyxtext.h: forward declare EnumLColor.
+
+ * lyx_main.C: add #include "LColor.h".
+
2003-09-15 Angus Leeming <leeming@lyx.org>
* .cvsignore: add lyx-gtk.
boost::scoped_ptr<Pimpl> pimpl_;
};
+
+/** \c EnumLColor is a wrapper for LColor::color. It can be forward-declared and
+ * passed as a function argument without having to expose LColor.h.
+ */
+class EnumLColor {
+ LColor::color val_;
+public:
+ /** The default constructor is nasty,
+ * but allows us to use EnumLColor in STL containers.
+ */
+ EnumLColor() : val_(static_cast<LColor::color>(-1)) {}
+
+ EnumLColor(LColor::color val) : val_(val) {}
+ operator LColor::color() const{ return val_; }
+};
+
+
/// the current color definitions
extern LColor lcolor;
/// the system color definitions
+2003-09-15 Angus Leeming <leeming@lyx.org>
+
+ * Painter.C: add #include "LColor.h".
+ (rectText): pass EnumLColor args, rather than LColor::color ones.
+
+ * Painter.h:
+ * lyx_gui.h: remove #include "LColor.h". Forward declare EnumLColor.
+
+ * Painter.h (line, lines, rectangle, fillRectangle, fillPolygon, arc,
+ point, rectText):
+ * lyx_gui.h (hexname, update_color):
+ pass EnumLColor args, rather than LColor::color ones.
+
2003-09-09 Lars Gullik Bjønnes <larsbj@lyx.org>
* Timeout.C: change Assert to BOOST_ASSERT
#include "Painter.h"
#include "font_metrics.h"
-#include "lyxfont.h"
#include "WorkArea.h"
+#include "LColor.h"
+#include "lyxfont.h"
+
using std::max;
Painter & Painter::rectText(int x, int baseline,
string const & str,
LyXFont const & font,
- LColor::color back,
- LColor::color frame)
+ EnumLColor back,
+ EnumLColor frame)
{
int width;
int ascent;
#include "support/std_string.h"
-#include "LColor.h"
+
+class EnumLColor;
class LyXFont;
namespace lyx {
virtual Painter & line(
int x1, int y1,
int x2, int y2,
- LColor::color = LColor::foreground,
+ EnumLColor,
line_style = line_solid,
line_width = line_thin) = 0;
int const * xp,
int const * yp,
int np,
- LColor::color = LColor::foreground,
+ EnumLColor,
line_style = line_solid,
line_width = line_thin) = 0;
virtual Painter & rectangle(
int x, int y,
int w, int h,
- LColor::color = LColor::foreground,
+ EnumLColor,
line_style = line_solid,
line_width = line_thin) = 0;
virtual Painter & fillRectangle(
int x, int y,
int w, int h,
- LColor::color) = 0;
+ EnumLColor) = 0;
/// draw a filled (irregular) polygon
virtual Painter & fillPolygon(
int const * xp,
int const * yp,
int np,
- LColor::color = LColor::foreground) = 0;
+ EnumLColor) = 0;
/// draw an arc
virtual Painter & arc(
int x, int y,
unsigned int w, unsigned int h,
int a1, int a2,
- LColor::color = LColor::foreground) = 0;
+ EnumLColor) = 0;
/// draw a pixel
virtual Painter & point(
int x, int y,
- LColor::color = LColor::foreground) = 0;
+ EnumLColor) = 0;
/// draw a filled rectangle with the shape of a 3D button
virtual Painter & button(int x, int y,
Painter & rectText(int x, int baseline,
string const & string,
LyXFont const & font,
- LColor::color back = LColor::none,
- LColor::color frame = LColor::none);
+ EnumLColor back,
+ EnumLColor frame);
/// draw a string and enclose it inside a button frame
Painter & buttonText(int x,
+2003-09-15 Angus Leeming <leeming@lyx.org>
+
+ * ControlCharacter.C (setColor, getColor):
+ pass EnumLColor args, rather than LColor::color ones.
+
+ * ControlPrefs.C: add #include "LColor.h".
+ * ControlPrefs.h:remove #include "LColor.h".
+
+ * ControlPrefs.[Ch] (setColor): pass EnumLColor arg, not than LColor::color one.
+
+ * character.h:remove #include "LColor.h".
+ typedef ColorPair as a std::pair<string, EnumLColor>.
+
2003-09-15 Lars Gullik Bjønnes <larsbj@gullik.net>
* ControlAboutlyx.C
}
-LColor::color ControlCharacter::getColor() const
+EnumLColor ControlCharacter::getColor() const
{
if (!font_.get())
return LColor::ignore;
}
-void ControlCharacter::setColor(LColor::color val)
+void ControlCharacter::setColor(EnumLColor val)
{
switch (val) {
case LColor::ignore:
#include "character.h"
+class EnumLColor;
+
+
class ControlCharacter : public Dialog::Controller {
public:
///
///
void setBar(frnt::FONT_STATE);
///
- void setColor(LColor::color);
+ void setColor(EnumLColor);
///
void setLanguage(string const &);
///
///
frnt::FONT_STATE getBar() const;
///
- LColor::color getColor() const;
+ EnumLColor getColor() const;
///
string getLanguage() const;
///
#include "format.h"
#include "gettext.h"
#include "funcrequest.h"
+#include "LColor.h"
#include "lfuns.h"
#include "frontends/Dialogs.h"
}
-void ControlPrefs::setColor(LColor::color col, string const & hex)
+void ControlPrefs::setColor(EnumLColor col, string const & hex)
{
string const s = lcolor.getLyXName(col) + ' ' + hex;
lv_.dispatch(FuncRequest(LFUN_SET_COLOR, s));
#include "ControlDialog_impl.h"
#include "support/std_string.h"
#include "lyxrc.h"
-#include "LColor.h"
class Converters;
+class EnumLColor;
class Formats;
class ControlPrefs : public ControlDialogBI {
void redrawGUI();
/// set a color
- void setColor(LColor::color col, string const & hex);
+ void setColor(EnumLColor col, string const & hex);
/// update the screen fonts after change
void updateScreenFonts();
#include "lyxfont.h"
-#include "LColor.h"
#include <utility>
#include <vector>
+
+class EnumLColor;
+
+
/** Functions of use to the character GUI controller and view */
namespace frnt {
///
typedef std::pair<string, FONT_STATE> BarPair;
///
-typedef std::pair<string, LColor::color> ColorPair;
+typedef std::pair<string, EnumLColor> ColorPair;
///
std::vector<FamilyPair> const getFamilyData();
+2003-09-15 Angus Leeming <leeming@lyx.org>
+
+ * GPainter.C: add #include "LColor.h".
+ * GPainter.[Ch] (setForeground, point, line, lines, rectangle, fillRectangle,
+ fillPolygon, arc): pass EnumLColor args, rather than LColor::color ones.
+
+ * GScreen.C:
+ * GWorkArea.C: add #include "LColor.h".
+
+ * GWorkArea.h: remove #include "LColor.h".
+ change typedefs to take an EnumLColor arg rather than an LColor::color one.
+
+ * GWorkArea.h (getColor, getXftColor, cacheColor, cacheXftColor):
+ * GWorkArea.[Ch] (getXftColor, getGdkColor): pass EnumLColor args, rather
+ than LColor::color ones.
+
+ * lyx_gui.C (hexname, update_color): pass EnumLColor args, rather
+ than LColor::color ones.
+
2003-09-10 Angus Leeming <leeming@lyx.org>
* GToolbar.C (onLayoutSelected): missed a change from a call to the
#include "lyxrc.h"
#include "encoding.h"
#include "language.h"
+#include "LColor.h"
#include "xftFontLoader.h"
#include "xformsImage.h"
#include "frontends/font_metrics.h"
}
-void GPainter::setForeground(Glib::RefPtr<Gdk::GC> gc, LColor::color clr)
+void GPainter::setForeground(Glib::RefPtr<Gdk::GC> gc, EnumLColor clr)
{
Gdk::Color * gclr = owner_.getColorHandler().getGdkColor(clr);
gc->set_foreground(*gclr);
}
-Painter & GPainter::point(int x, int y, LColor::color c)
+Painter & GPainter::point(int x, int y, EnumLColor c)
{
setForeground(owner_.getGC(), c);
owner_.getPixmap()->draw_point(owner_.getGC(), x, y);
Painter & GPainter::line(int x1, int y1,
int x2, int y2,
- LColor::color col,
+ EnumLColor col,
line_style ls,
line_width lw)
{
Painter & GPainter::lines(int const * xp, int const * yp,
int np,
- LColor::color col,
+ EnumLColor col,
line_style ls,
line_width lw)
{
Painter & GPainter::rectangle(int x, int y,
int w, int h,
- LColor::color col,
+ EnumLColor col,
line_style ls,
line_width lw)
{
Painter & GPainter::fillRectangle(int x, int y,
int w, int h,
- LColor::color col)
+ EnumLColor col)
{
setForeground(owner_.getGC(), col);
owner_.getPixmap()->draw_rectangle(owner_.getGC(), true, x, y, w, h);
Painter & GPainter::fillPolygon(int const * xp, int const * yp,
- int np, LColor::color col)
+ int np, EnumLColor col)
{
setForeground(owner_.getGC(), col);
std::vector<Gdk::Point> points(np);
Painter & GPainter::arc(int x, int y,
unsigned int w, unsigned int h,
- int a1, int a2, LColor::color col)
+ int a1, int a2, EnumLColor col)
{
setForeground(owner_.getGC(), col);
owner_.getPixmap()->draw_arc(owner_.getGC(),
/// return the height of the work area in pixels
virtual int paperHeight() const;
- void setForeground(Glib::RefPtr<Gdk::GC> gc, LColor::color clr);
+ void setForeground(Glib::RefPtr<Gdk::GC> gc, EnumLColor clr);
void setLineParam(Glib::RefPtr<Gdk::GC> gc,
line_style ls, line_width lw);
- XftColor * getXftColor(LColor::color clr);
+ XftColor * getXftColor(EnumLColor clr);
/// draw a line from point to point
virtual Painter & line(
int x1, int y1,
int x2, int y2,
- LColor::color = LColor::foreground,
+ EnumLColor,
line_style = line_solid,
line_width = line_thin);
int const * xp,
int const * yp,
int np,
- LColor::color = LColor::foreground,
+ EnumLColor,
line_style = line_solid,
line_width = line_thin);
virtual Painter & rectangle(
int x, int y,
int w, int h,
- LColor::color = LColor::foreground,
+ EnumLColor,
line_style = line_solid,
line_width = line_thin);
virtual Painter & fillRectangle(
int x, int y,
int w, int h,
- LColor::color);
+ EnumLColor);
/// draw a filled (irregular) polygon
virtual Painter & fillPolygon(
int const * xp,
int const * yp,
int np,
- LColor::color = LColor::foreground);
+ EnumLColor);
/// draw an arc
virtual Painter & arc(
int x, int y,
unsigned int w, unsigned int h,
int a1, int a2,
- LColor::color = LColor::foreground);
+ EnumLColor);
/// draw a pixel
virtual Painter & point(
int x, int y,
- LColor::color = LColor::foreground);
+ EnumLColor);
/// draw an image from the image cache
virtual Painter & image(int x, int y,
#include <config.h>
#include <gtkmm.h>
-#include <algorithm>
+#include "GScreen.h"
-#include "frontends/screen.h"
-#include "frontends/font_metrics.h"
#include "GWorkArea.h"
-#include "GScreen.h"
-#include "lyxtext.h"
-#include "lyxrow.h"
-#include "Painter.h"
-#include "WorkArea.h"
+
#include "buffer.h"
#include "BufferView.h"
-#include "insets/insettext.h"
-#include "language.h"
#include "debug.h"
+#include "language.h"
+#include "LColor.h"
+#include "lyxtext.h"
+#include "lyxrow.h"
+
+#include "frontends/screen.h"
+#include "frontends/font_metrics.h"
+#include "frontends/Painter.h"
+#include "frontends/WorkArea.h"
+
+#include "insets/insettext.h"
+
+#include <algorithm>
GScreen::GScreen(GWorkArea & o)
#include <X11/Xft/Xft.h>
#include "GWorkArea.h"
-#include "debug.h"
-#include "funcrequest.h"
#include "GView.h"
#include "GtkmmX.h"
#include "GLyXKeySym.h"
+#include "debug.h"
+#include "funcrequest.h"
+#include "LColor.h"
+
ColorCache colorCache;
}
-XftColor * ColorHandler::getXftColor(LColor::color clr)
+XftColor * ColorHandler::getXftColor(EnumLColor clr)
{
XftColor * xclr = colorCache.getXftColor(clr);
if (!xclr) {
}
-Gdk::Color * ColorHandler::getGdkColor(LColor::color clr)
+Gdk::Color * ColorHandler::getGdkColor(EnumLColor clr)
{
Gdk::Color * gclr = colorCache.getColor(clr);
if (!gclr) {
#include <gdk/gdkx.h>
#include "frontends/WorkArea.h"
#include "GPainter.h"
-#include "LColor.h"
#include <gtk/gtk.h>
#include <X11/Xft/Xft.h>
+class EnumLColor;
+
class ColorCache
{
- typedef std::map<LColor::color, Gdk::Color *> Map;
+ typedef std::map<EnumLColor, Gdk::Color *> Map;
typedef Map::iterator MapIt;
- typedef std::map<LColor::color, XftColor *> Map2;
+ typedef std::map<EnumLColor, XftColor *> Map2;
typedef Map2::iterator MapIt2;
public:
~ColorCache() { clear(); }
- Gdk::Color * getColor(LColor::color clr)
+ Gdk::Color * getColor(EnumLColor clr)
{
MapIt it = cache_.find(clr);
return it == cache_.end() ? 0 : it->second;
}
- XftColor * getXftColor(LColor::color clr)
+ XftColor * getXftColor(EnumLColor clr)
{
MapIt2 it = cache2_.find(clr);
return it == cache2_.end() ? 0 : it->second;
}
- void cacheColor(LColor::color clr, Gdk::Color * gclr)
+ void cacheColor(EnumLColor clr, Gdk::Color * gclr)
{
cache_[clr] = gclr;
}
- void cacheXftColor(LColor::color clr, XftColor * xclr)
+ void cacheXftColor(EnumLColor clr, XftColor * xclr)
{
cache2_[clr] = xclr;
}
{
public:
ColorHandler(GWorkArea& owner) : owner_(owner) {}
- XftColor * getXftColor(LColor::color clr);
- Gdk::Color * getGdkColor(LColor::color clr);
+ XftColor * getXftColor(EnumLColor clr);
+ Gdk::Color * getGdkColor(EnumLColor clr);
private:
GWorkArea & owner_;
};
}
-string const lyx_gui::hexname(LColor::color col)
+string const lyx_gui::hexname(EnumLColor col)
{
Gdk::Color gdkColor;
Gdk::Color * gclr = colorCache.getColor(col);
}
-void lyx_gui::update_color(LColor::color /*col*/)
+void lyx_gui::update_color(EnumLColor /*col*/)
{
colorCache.clear();
}
#ifndef LYX_GUI_H
#define LYX_GUI_H
-#include "LColor.h"
#include "support/std_string.h"
#include "FuncStatus.h"
#include <vector>
class Dialogs;
+class EnumLColor;
class LyXFont;
class LyXComm;
class FuncRequest;
/** Eg, passing LColor::black returns "000000",
* passing LColor::white returns "ffffff".
*/
-string const hexname(LColor::color col);
+string const hexname(EnumLColor col);
/**
* update an altered GUI color
*/
-void update_color(LColor::color col);
+void update_color(EnumLColor col);
/**
* update the font cache
+2003-09-15 Angus Leeming <leeming@lyx.org>
+
+ * QLPainter.C: add #include "LColor.h".
+ * QLPainter.[Ch] (setPen, point, line, lines, rectangle, fillPolygon, arc):
+ pass EnumLColor args, rather than LColor::color ones.
+
+ * QPrefsDialog.C: add #include "LColor.h".
+ * QPrefsDialog.h: remove #include "LColor.h". Store a vector<EnumLColor> colors_;
+
+ * QWorkArea.C: add #include "LColor.h".
+
+ * lcolorcache.C: add #include "LColor.h".
+ * lcolorcache.h: store a map<EnumLColor, QColor>.
+ * lcolorcache.[Ch] (get):pass EnumLColor args, rather than LColor::color ones.
+
+ * qscreen.C: add #include "LColor.h".
+
+ * lyx_gui.C (hexname, update_color): pass EnumLColor args, rather
+ than LColor::color ones.
+
2003-09-15 Angus Leeming <leeming@lyx.org>
* QAbout.C (build_dialog):
#include "font_metrics.h"
#include "debug.h"
#include "language.h"
+#include "LColor.h"
#include "QWorkArea.h"
#include "qfont_loader.h"
}
-QPainter & QLPainter::setPen(LColor::color c,
+QPainter & QLPainter::setPen(EnumLColor c,
Painter::line_style ls, Painter::line_width lw)
{
QPen pen = qp_->pen();
}
-Painter & QLPainter::point(int x, int y, LColor::color c)
+Painter & QLPainter::point(int x, int y, EnumLColor c)
{
setPen(c).drawPoint(x, y);
return *this;
Painter & QLPainter::line(int x1, int y1,
int x2, int y2,
- LColor::color col,
+ EnumLColor col,
line_style ls,
line_width lw)
{
Painter & QLPainter::lines(int const * xp, int const * yp,
int np,
- LColor::color col,
+ EnumLColor col,
line_style ls,
line_width lw)
{
Painter & QLPainter::rectangle(int x, int y,
int w, int h,
- LColor::color col,
+ EnumLColor col,
line_style ls,
line_width lw)
{
Painter & QLPainter::fillRectangle(int x, int y,
int w, int h,
- LColor::color col)
+ EnumLColor col)
{
qp_->fillRect(x, y, w, h, lcolorcache.get(col));
return *this;
Painter & QLPainter::fillPolygon(int const * xp, int const * yp,
- int np, LColor::color col)
+ int np, EnumLColor col)
{
// Must use new as np is not known at compile time.
boost::scoped_array<QCOORD> points(new QCOORD[np * 2]);
Painter & QLPainter::arc(int x, int y,
unsigned int w, unsigned int h,
- int a1, int a2, LColor::color col)
+ int a1, int a2, EnumLColor col)
{
// LyX usings 1/64ths degree, Qt usings 1/16th
setPen(col).drawArc(x, y, w, h, a1 / 4, a2 / 4);
#include "Painter.h"
#include "support/std_string.h"
-#include "LColor.h"
#include <boost/scoped_ptr.hpp>
virtual Painter & line(
int x1, int y1,
int x2, int y2,
- LColor::color = LColor::foreground,
+ EnumLColor,
line_style = line_solid,
line_width = line_thin);
int const * xp,
int const * yp,
int np,
- LColor::color = LColor::foreground,
+ EnumLColor,
line_style = line_solid,
line_width = line_thin);
virtual Painter & rectangle(
int x, int y,
int w, int h,
- LColor::color = LColor::foreground,
+ EnumLColor,
line_style = line_solid,
line_width = line_thin);
virtual Painter & fillRectangle(
int x, int y,
int w, int h,
- LColor::color);
+ EnumLColor);
/// draw a filled (irregular) polygon
virtual Painter & fillPolygon(
int const * xp,
int const * yp,
int np,
- LColor::color = LColor::foreground);
+ EnumLColor);
/// draw an arc
virtual Painter & arc(
int x, int y,
unsigned int w, unsigned int h,
int a1, int a2,
- LColor::color = LColor::foreground);
+ EnumLColor);
/// draw a pixel
virtual Painter & point(
int x, int y,
- LColor::color = LColor::foreground);
+ EnumLColor);
/// draw an image from the image cache
virtual Painter & image(int x, int y,
QString const & str, LyXFont const & f);
/// set pen parameters
- QPainter & setPen(LColor::color c,
+ QPainter & setPen(EnumLColor c,
line_style ls = line_solid,
line_width lw = line_thin);
#include "ui/QPrefIdentityModule.h"
#include "gettext.h"
+#include "LColor.h"
#include "panelstack.h"
#include <qpushbutton.h>
#define QPREFSDIALOG_H
-#include "LColor.h"
-
#include "ui/QPrefsDialogBase.h"
#include <vector>
+class EnumLColor;
class QPrefs;
class QPrefAsciiModule;
class QPrefDateModule;
private:
- std::vector<LColor::color> colors_;
+ std::vector<EnumLColor> colors_;
QPrefAsciiModule * asciiModule;
QPrefDateModule * dateModule;
#include "QWorkArea.h"
#include "debug.h"
+#include "LColor.h"
#include "qt_helpers.h"
#include "lcolorcache.h"
#include "funcrequest.h"
#include "lcolorcache.h"
+#include "LColor.h"
+
LColorCache lcolorcache;
}
-QColor const & LColorCache::get(LColor::color col) const
+QColor const & LColorCache::get(EnumLColor col) const
{
lcolor_map::const_iterator cit = colormap.find(col);
if (cit != colormap.end())
#include <map>
-#include "LColor.h"
-
#include <qcolor.h>
+
+class EnumLColor;
+
+
// FIXME: use a fixed-size array not a map ?
/**
LColorCache();
/// get the given color
- QColor const & get(LColor::color color) const;
+ QColor const & get(EnumLColor color) const;
/// clear all colors
void clear();
private:
- typedef std::map<LColor::color, QColor> lcolor_map;
+ typedef std::map<EnumLColor, QColor> lcolor_map;
mutable lcolor_map colormap;
};
}
-string const hexname(LColor::color col)
+string const hexname(EnumLColor col)
{
return ltrim(fromqstr(lcolorcache.get(col).name()), "#");
}
-void update_color(LColor::color)
+void update_color(EnumLColor)
{
// FIXME: Bleh, can't we just clear them all at once ?
lcolorcache.clear();
#include "QWorkArea.h"
#include "qscreen.h"
#include "debug.h"
+#include "LColor.h"
#include <qapplication.h>
+2003-09-15 Angus Leeming <leeming@lyx.org>
+
+ * Color.C:
+ * ColorHandler.C:
+ * XPainter.C:
+ * xformsImage.C
+ * xscreen.C: add #include "LColor.h".
+
+ * Color.h: remove #include "LColor.h".
+
+ * Color.[Ch] (getRGBColor):
+ * ColorHandler.[Ch] (colorPixel, getGCForeground, getGCLinepars, updateColor):
+ pass EnumLColor args, rather than LColor::color ones.
+
+ * FormCharacter.h: store vector<EnumLColor> color_.
+
+ * XPainter.[Ch] (point, line, lines, rectangle, fillPolygon):
+
+ * lyx_gui.C (hexname, update_color): pass EnumLColor args, rather
+ than LColor::color ones.
+
+ * xformsImage.C:
+
2003-09-15 Lars Gullik Bjønnes <larsbj@gullik.net>
* Color.C
#include "lyx_forms.h"
+#include "LColor.h"
+
#include "support/std_sstream.h"
#include <cmath>
-bool getRGBColor(LColor::color col,
+bool getRGBColor(EnumLColor col,
unsigned int & r, unsigned int & g, unsigned int & b)
{
string const name = lcolor.getX11Name(col);
#include "support/std_string.h"
-#include "LColor.h"
+
+
+class EnumLColor;
+
/** Given col, fills r, g, b in the range 0-255.
The function returns true if successful.
It returns false on failure and sets r, g, b to 0. */
-bool getRGBColor(LColor::color col,
+bool getRGBColor(EnumLColor col,
unsigned int & r, unsigned int & g, unsigned int & b);
struct RGBColor;
#include "debug.h"
#include "gettext.h"
+#include "LColor.h"
#include "support/lstrings.h"
#include "support/tostr.h"
}
-unsigned long LyXColorHandler::colorPixel(LColor::color c)
+unsigned long LyXColorHandler::colorPixel(EnumLColor c)
{
XGCValues val;
XGetGCValues(display, getGCForeground(c), GCForeground, &val);
// Gets GC according to color
// Uses caching
-GC LyXColorHandler::getGCForeground(LColor::color c)
+GC LyXColorHandler::getGCForeground(EnumLColor c)
{
if (static_cast<unsigned>(c) >= colorGCcache.size()) {
colorGCcache.resize(c + 1, 0);
// Gets GC for line
GC LyXColorHandler::getGCLinepars(Painter::line_style ls,
- Painter::line_width lw, LColor::color c)
+ Painter::line_width lw, EnumLColor c)
{
//if (lyxerr.debugging()) {
// lyxerr << "Painter drawable: " << drawable() << endl;
// update GC cache after color redefinition
-void LyXColorHandler::updateColor (LColor::color c)
+void LyXColorHandler::updateColor (EnumLColor c)
{
// color GC cache
GC gc = colorGCcache[c];
// This is only included to provide stuff for the non-public sections
#include <X11/Xlib.h>
+class EnumLColor;
class LyXFont;
/**
///
~LyXColorHandler();
///
- unsigned long colorPixel(LColor::color c);
+ unsigned long colorPixel(EnumLColor c);
///
- GC getGCForeground(LColor::color c);
+ GC getGCForeground(EnumLColor c);
///
GC getGCLinepars(Painter::line_style,
- Painter::line_width, LColor::color c);
+ Painter::line_width, EnumLColor c);
/// update the cache after a color definition change
- void updateColor(LColor::color c);
+ void updateColor(EnumLColor c);
private:
///
#include "FormDialogView.h"
#include "ControlCharacter.h" // for ControlCharacter enum
+struct EnumLColor;
struct FD_character;
/**
///
std::vector<frnt::FONT_STATE> bar_;
///
- std::vector<LColor::color> color_;
+ std::vector<EnumLColor> color_;
///
std::vector<string> lang_;
};
#include "encoding.h"
#include "language.h"
+#include "LColor.h"
#include "lyxfont.h"
#include "lyxrc.h"
}
-Painter & XPainter::point(int x, int y, LColor::color c)
+Painter & XPainter::point(int x, int y, EnumLColor c)
{
XDrawPoint(fl_get_display(), owner_.getPixmap(),
lyxColorHandler->getGCForeground(c), x, y);
Painter & XPainter::line(int x1, int y1,
int x2, int y2,
- LColor::color col,
+ EnumLColor col,
line_style ls,
line_width lw)
{
Painter & XPainter::lines(int const * xp, int const * yp,
int np,
- LColor::color col,
+ EnumLColor col,
line_style ls,
line_width lw)
{
Painter & XPainter::rectangle(int x, int y,
int w, int h,
- LColor::color col,
+ EnumLColor col,
line_style ls,
line_width lw)
{
Painter & XPainter::fillRectangle(int x, int y,
int w, int h,
- LColor::color col)
+ EnumLColor col)
{
XFillRectangle(fl_get_display(), owner_.getPixmap(),
lyxColorHandler->getGCForeground(col), x, y, w, h);
Painter & XPainter::fillPolygon(int const * xp, int const * yp,
- int np, LColor::color col)
+ int np, EnumLColor col)
{
boost::scoped_array<XPoint> points(new XPoint[np]);
Painter & XPainter::arc(int x, int y,
unsigned int w, unsigned int h,
- int a1, int a2, LColor::color col)
+ int a1, int a2, EnumLColor col)
{
XDrawArc(fl_get_display(), owner_.getPixmap(),
lyxColorHandler->getGCForeground(col),
virtual Painter & line(
int x1, int y1,
int x2, int y2,
- LColor::color = LColor::foreground,
+ EnumLColor,
line_style = line_solid,
line_width = line_thin);
int const * xp,
int const * yp,
int np,
- LColor::color = LColor::foreground,
+ EnumLColor,
line_style = line_solid,
line_width = line_thin);
virtual Painter & rectangle(
int x, int y,
int w, int h,
- LColor::color = LColor::foreground,
+ EnumLColor,
line_style = line_solid,
line_width = line_thin);
virtual Painter & fillRectangle(
int x, int y,
int w, int h,
- LColor::color);
+ EnumLColor);
/// draw a filled (irregular) polygon
virtual Painter & fillPolygon(
int const * xp,
int const * yp,
int np,
- LColor::color = LColor::foreground);
+ EnumLColor);
/// draw an arc
virtual Painter & arc(
int x, int y,
unsigned int w, unsigned int h,
int a1, int a2,
- LColor::color = LColor::foreground);
+ EnumLColor);
/// draw a pixel
virtual Painter & point(
int x, int y,
- LColor::color = LColor::foreground);
+ EnumLColor);
/// draw an image from the image cache
virtual Painter & image(int x, int y,
return FuncStatus();
}
-string const hexname(LColor::color col)
+string const hexname(EnumLColor col)
{
unsigned int r, g, b;
bool const success = getRGBColor(col, r, g, b);
}
-void update_color(LColor::color col)
+void update_color(EnumLColor col)
{
lyxColorHandler->updateColor(col);
}
#include <config.h>
#include "xformsImage.h"
-#include "graphics/GraphicsParams.h"
#include "Color.h"
-#include "format.h"
+
#include "debug.h"
+#include "format.h"
+#include "LColor.h"
+
+#include "graphics/GraphicsParams.h"
+
#include "support/lstrings.h"
#include "support/lyxfunctional.h" // compare_memfun
#include "support/lyxlib.h"
#include "XWorkArea.h"
#include "debug.h"
+#include "LColor.h"
using std::endl;
+2003-09-15 Angus Leeming <leeming@lyx.org>
+
+ * inset.[Ch] (setBackgroundColor, backgroundColor):
+ * insettext.[Ch] (setFrameColor):
+ pass EnumLColor args, rather than LColor::color ones.
+
2003-09-15 Lars Gullik Bjønnes <larsbj@gullik.net>
* insetcommand.C
}
-void InsetOld::setBackgroundColor(LColor::color color)
+void InsetOld::setBackgroundColor(EnumLColor color)
{
background_color_ = color;
}
-LColor::color InsetOld::backgroundColor() const
+EnumLColor InsetOld::backgroundColor() const
{
if (background_color_ == LColor::inherit) {
if (owner())
#include "ParagraphList_fwd.h"
class Buffer;
+class EnumLColor;
class FuncRequest;
class LatexRunParams;
class LyXCursor;
///
UpdatableInset * owner() const { return owner_; }
///
- void setBackgroundColor(LColor::color);
+ void setBackgroundColor(EnumLColor);
///
- LColor::color backgroundColor() const;
+ EnumLColor backgroundColor() const;
///
int x() const { return top_x; }
///
}
-void InsetText::setFrameColor(LColor::color col)
+void InsetText::setFrameColor(EnumLColor col)
{
frame_color = col;
}
class BufferParams;
class BufferView;
class Dimension;
+class EnumLColor;
class LyXCursor;
class Painter;
class Paragraph;
///
void setDrawFrame(DrawFrame);
///
- void setFrameColor(LColor::color);
+ void setFrameColor(EnumLColor);
///
LyXText * getLyXText(BufferView const *,
bool const recursive = false) const;
#include "kbmap.h"
#include "language.h"
#include "lastfiles.h"
+#include "LColor.h"
#include "lyxfunc.h"
#include "lyxlex.h"
#include "lyxrc.h"
}
-LColor::color LyXFont::color() const
+EnumLColor LyXFont::color() const
{
return bits.color;
}
}
-LyXFont & LyXFont::setColor(LColor::color c)
+LyXFont & LyXFont::setColor(EnumLColor c)
{
bits.color = c;
return *this;
}
-LColor::color LyXFont::realColor() const
+EnumLColor LyXFont::realColor() const
{
if (color() == LColor::none)
return LColor::foreground;
#include "support/std_string.h"
#include <iosfwd>
+class EnumLColor;
class LyXLex;
class BufferParams;
class Language;
FONT_MISC_STATE number() const;
///
- LColor::color color() const;
+ EnumLColor color() const;
///
Language const * language() const;
///
LyXFont & setNumber(LyXFont::FONT_MISC_STATE n);
///
- LyXFont & setColor(LColor::color c);
+ LyXFont & setColor(EnumLColor c);
///
LyXFont & setLanguage(Language const * l);
string const stateText(BufferParams * params) const;
///
- LColor::color realColor() const;
+ EnumLColor realColor() const;
///
friend
class BufferParams;
class BufferView;
class Dimension;
+class EnumLColor;
class InsetText;
class LyXCursor;
class MetricsInfo;
lyx::pos_type pos, char c, LyXFont const & Font) const;
/// return the color of the canvas
- LColor::color backgroundColor() const;
+ EnumLColor backgroundColor() const;
///
mutable bool bidi_same_direction;
}
-LColor::color LyXText::backgroundColor() const
+EnumLColor LyXText::backgroundColor() const
{
if (inset_owner)
return inset_owner->backgroundColor();