2000-04-16 22:27:30 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
2001-05-30 13:53:44 +00:00
|
|
|
* Copyright 1995-2001 The LyX Team
|
2000-04-16 22:27:30 +00:00
|
|
|
*
|
|
|
|
* ======================================================*/
|
|
|
|
|
|
|
|
#ifndef COLOR_HANDLER_H
|
|
|
|
#define COLOR_HANDLER_H
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2001-03-07 16:18:05 +00:00
|
|
|
#include <boost/smart_ptr.hpp>
|
|
|
|
|
2000-04-16 22:27:30 +00:00
|
|
|
// This is only included to provide stuff for the non-public sections
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
|
|
|
|
#include "PainterBase.h"
|
|
|
|
|
|
|
|
class LyXFont;
|
|
|
|
class WorkArea;
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
/**
|
|
|
|
* This is a factory class that can produce GCs with a specific
|
|
|
|
* color. It will cache GCs for performance.
|
|
|
|
*/
|
2000-04-16 22:27:30 +00:00
|
|
|
class LyXColorHandler {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
LyXColorHandler();
|
|
|
|
///
|
|
|
|
~LyXColorHandler();
|
|
|
|
///
|
|
|
|
unsigned long colorPixel(LColor::color c);
|
|
|
|
///
|
|
|
|
GC getGCForeground(LColor::color c);
|
|
|
|
///
|
|
|
|
GC getGCLinepars(PainterBase::line_style,
|
|
|
|
PainterBase::line_width, LColor::color c);
|
2000-06-26 15:33:13 +00:00
|
|
|
/// update the cache after a color definition change
|
|
|
|
void updateColor(LColor::color c);
|
|
|
|
|
2000-04-16 22:27:30 +00:00
|
|
|
private:
|
|
|
|
///
|
|
|
|
Display * display;
|
|
|
|
///
|
|
|
|
Colormap colormap;
|
|
|
|
///
|
|
|
|
GC colorGCcache[LColor::ignore + 1];
|
|
|
|
///
|
|
|
|
typedef std::map<int, GC> LineGCCache;
|
|
|
|
///
|
|
|
|
LineGCCache lineGCcache;
|
|
|
|
///
|
|
|
|
Pixmap drawable;
|
|
|
|
};
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
///
|
2001-03-07 16:18:05 +00:00
|
|
|
extern boost::scoped_ptr<LyXColorHandler> lyxColorHandler;
|
2000-04-16 22:27:30 +00:00
|
|
|
|
|
|
|
#endif
|