replace colorcache global variable with GuiApplication::colorCache().

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15151 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-09-26 09:57:47 +00:00
parent e1acd31e28
commit 10d5ea0d8a
9 changed files with 15 additions and 19 deletions

View File

@ -15,8 +15,6 @@
#include "LColor.h"
ColorCache lcolorcache;
const QColor grey40(0x66, 0x66, 0x66);
const QColor grey60(0x99, 0x99, 0x99);
const QColor grey80(0xcc, 0xcc, 0xcc);

View File

@ -44,9 +44,6 @@ private:
mutable lcolor_map colormap;
};
/// singleton instance
extern ColorCache lcolorcache;
///
QColor const rgb2qcolor(lyx::RGBColor const &);
#endif // COLORCACHE_H

View File

@ -13,6 +13,7 @@
#ifndef QT4_APPLICATION_H
#define QT4_APPLICATION_H
#include "ColorCache.h"
#include "FontLoader.h"
#include "GuiClipboard.h"
#include "GuiImplementation.h"
@ -59,6 +60,8 @@ public:
virtual void exit(int status);
//@}
///
ColorCache & colorCache() { return color_cache_; }
///
FontLoader & fontLoader() { return font_loader_; }
@ -75,6 +78,8 @@ private:
GuiSelection selection_;
///
FontLoader font_loader_;
///
ColorCache color_cache_;
#ifdef Q_WS_X11
public:

View File

@ -14,7 +14,6 @@
#include "GuiWorkArea.h"
#include "GuiApplication.h"
#include "ColorCache.h"
#include "QLPainter.h"
#include "QLyXKeySym.h"
#include "qt_helpers.h"
@ -493,7 +492,7 @@ void GuiWorkArea::showCursor(int x, int y, int h, CursorShape shape)
show_vcursor_ = true;
QColor const & required_color = lcolorcache.get(LColor::cursor);
QColor const & required_color = guiApp->colorCache().get(LColor::cursor);
if (x==cursor_x_ && y==cursor_y_ && h==cursor_h_
&& cursor_color_ == required_color

View File

@ -13,7 +13,7 @@
#include "QBranches.h"
#include "ColorCache.h"
#include "GuiApplication.h"
#include "validators.h"
#include "qt_helpers.h"

View File

@ -13,9 +13,9 @@
#include "QLPainter.h"
#include "GuiApplication.h"
#include "GuiWorkArea.h"
#include "QLImage.h"
#include "ColorCache.h"
#include "FontLoader.h"
#include "GuiApplication.h"
@ -93,7 +93,7 @@ void QLPainter::setQPainterPen(LColor_color col,
QPen pen = qp_.get()->pen();
pen.setColor(lcolorcache.get(col));
pen.setColor(guiApp->colorCache().get(col));
switch (ls) {
case line_solid: pen.setStyle(Qt::SolidLine); break;
@ -158,7 +158,7 @@ void QLPainter::rectangle(int x, int y, int w, int h,
void QLPainter::fillRectangle(int x, int y, int w, int h, LColor_color col)
{
qp_->fillRect(x, y, w, h, lcolorcache.get(col));
qp_->fillRect(x, y, w, h, guiApp->colorCache().get(col));
}

View File

@ -13,7 +13,6 @@
#include "QPrefs.h"
#include "QPrefsDialog.h"
#include "ColorCache.h"
#include "Qt2BC.h"
#include "qt_helpers.h"

View File

@ -13,7 +13,7 @@
#include "debug.h"
#include "qt_helpers.h"
#include "ColorCache.h"
#include "GuiApplication.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
@ -40,7 +40,6 @@
#include "gettext.h"
#include "LColor.h"
#include "ColorCache.h"
#include "controllers/ControlPrefs.h"
@ -519,7 +518,7 @@ PrefColors::PrefColors(QPrefs * form, QWidget * parent)
|| lc == LColor::ignore) continue;
lcolors_.push_back(lc);
QColor color = QColor(lcolorcache.get(lc));
QColor color = QColor(guiApp->colorCache().get(lc));
prefcolors_.push_back(color.name());
QPixmap coloritem(32, 32);
coloritem.fill(color);

View File

@ -30,7 +30,6 @@
#include "GuiView.h"
#include "ColorCache.h"
#include "FontLoader.h"
#include "QLImage.h"
#include "qt_helpers.h"
@ -167,7 +166,7 @@ FuncStatus getStatus(FuncRequest const & ev)
bool getRGBColor(LColor_color col, lyx::RGBColor & rgbcol)
{
QColor const & qcol = lcolorcache.get(col);
QColor const & qcol = guiApp->colorCache().get(col);
if (!qcol.isValid()) {
rgbcol.r = 0;
rgbcol.g = 0;
@ -183,14 +182,14 @@ bool getRGBColor(LColor_color col, lyx::RGBColor & rgbcol)
string const hexname(LColor_color col)
{
return ltrim(fromqstr(lcolorcache.get(col).name()), "#");
return ltrim(fromqstr(guiApp->colorCache().get(col).name()), "#");
}
void update_color(LColor_color)
{
// FIXME: Bleh, can't we just clear them all at once ?
lcolorcache.clear();
guiApp->colorCache().clear();
}