Move functions out-of-line. The .C file should have the headers needed for

their successful compilation.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7764 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-09-16 07:53:02 +00:00
parent 4b3c377335
commit b34f16995a
5 changed files with 142 additions and 37 deletions

View File

@ -1,3 +1,11 @@
2003-09-16 Angus Leeming <leeming@lyx.org>
* GScreen.[Ch] (workarea):
* GWorkArea.[Ch] (~ColorCache, getColor, getXftColor, cacheColor,
cacheXftColor, getPainter, workWidth, workHeight, xpos, ypos, getWindow,
getDisplay, getPixmap, getGC, getColormap, getXftDraw, getColorHandler):
move out-of-line.
2003-09-15 Angus Leeming <leeming@lyx.org> 2003-09-15 Angus Leeming <leeming@lyx.org>
* GPainter.C: add #include "LColor.h". * GPainter.C: add #include "LColor.h".

View File

@ -49,6 +49,12 @@ GScreen::~GScreen()
} }
WorkArea & GScreen::workarea() const
{
return owner_;
}
void GScreen::setCursorColor(Glib::RefPtr<Gdk::GC> gc) void GScreen::setCursorColor(Glib::RefPtr<Gdk::GC> gc)
{ {
Gdk::Color * clr = owner_.getColorHandler(). Gdk::Color * clr = owner_.getColorHandler().

View File

@ -39,7 +39,7 @@ public:
protected: protected:
/// get the work area /// get the work area
virtual WorkArea & workarea() const { return owner_; } virtual WorkArea & workarea() const;
/// Copies specified area of pixmap to screen /// Copies specified area of pixmap to screen
virtual void expose(int x, int y, int w, int h); virtual void expose(int x, int y, int w, int h);

View File

@ -24,6 +24,38 @@
ColorCache colorCache; ColorCache colorCache;
ColorCache::~ColorCache()
{
clear();
}
Gdk::Color * ColorCache::getColor(EnumLColor clr)
{
MapIt it = cache_.find(clr);
return it == cache_.end() ? 0 : it->second;
}
XftColor * ColorCache::getXftColor(EnumLColor clr)
{
MapIt2 it = cache2_.find(clr);
return it == cache2_.end() ? 0 : it->second;
}
void ColorCache::cacheColor(EnumLColor clr, Gdk::Color * gclr)
{
cache_[clr] = gclr;
}
void ColorCache::cacheXftColor(EnumLColor clr, XftColor * xclr)
{
cache2_[clr] = xclr;
}
void ColorCache::clear() void ColorCache::clear()
{ {
MapIt it = cache_.begin(); MapIt it = cache_.begin();
@ -159,6 +191,79 @@ GWorkArea::~GWorkArea()
} }
Painter & GWorkArea::getPainter()
{
return painter_;
}
int GWorkArea::workWidth() const
{
return workArea_.get_width();
}
int GWorkArea::workHeight() const
{
return workArea_.get_height();
}
int GWorkArea::xpos() const
{
return 0;
}
int GWorkArea::ypos() const
{
return 0;
}
Glib::RefPtr<Gdk::Window> GWorkArea::getWindow()
{
return workArea_.get_window();
}
Display * GWorkArea::getDisplay() const
{
return GDK_WINDOW_XDISPLAY(
const_cast<GdkWindow*>(workArea_.get_window()->gobj()));
}
Glib::RefPtr<Gdk::Pixmap> GWorkArea::getPixmap()
{
return workAreaPixmap_;
}
Glib::RefPtr<Gdk::GC> GWorkArea::getGC()
{
return workAreaGC_;
}
Glib::RefPtr<Gdk::Colormap> GWorkArea::getColormap()
{
return workArea_.get_colormap();
}
XftDraw * GWorkArea::getXftDraw()
{
return draw_;
}
ColorHandler & GWorkArea::getColorHandler()
{
return colorHandler_;
}
bool GWorkArea::onExpose(GdkEventExpose * event) bool GWorkArea::onExpose(GdkEventExpose * event)
{ {
workArea_.get_window()->draw_drawable( workArea_.get_window()->draw_drawable(

View File

@ -12,10 +12,12 @@
#ifndef GWORKAREA_H #ifndef GWORKAREA_H
#define GWORKAREA_H #define GWORKAREA_H
#include <gdk/gdkx.h>
#include "frontends/WorkArea.h"
#include "GPainter.h" #include "GPainter.h"
#include <gdk/gdkx.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "frontends/WorkArea.h"
#include <X11/Xft/Xft.h> #include <X11/Xft/Xft.h>
class EnumLColor; class EnumLColor;
@ -27,25 +29,11 @@ class ColorCache
typedef std::map<EnumLColor, XftColor *> Map2; typedef std::map<EnumLColor, XftColor *> Map2;
typedef Map2::iterator MapIt2; typedef Map2::iterator MapIt2;
public: public:
~ColorCache() { clear(); } ~ColorCache();
Gdk::Color * getColor(EnumLColor clr) Gdk::Color * getColor(EnumLColor);
{ XftColor * getXftColor(EnumLColor);
MapIt it = cache_.find(clr); void cacheColor(EnumLColor, Gdk::Color *);
return it == cache_.end() ? 0 : it->second; void cacheXftColor(EnumLColor, XftColor *);
}
XftColor * getXftColor(EnumLColor clr)
{
MapIt2 it = cache2_.find(clr);
return it == cache2_.end() ? 0 : it->second;
}
void cacheColor(EnumLColor clr, Gdk::Color * gclr)
{
cache_[clr] = gclr;
}
void cacheXftColor(EnumLColor clr, XftColor * xclr)
{
cache2_[clr] = xclr;
}
void clear(); void clear();
private: private:
Map cache_; Map cache_;
@ -64,32 +52,30 @@ private:
GWorkArea & owner_; GWorkArea & owner_;
}; };
class GWorkArea : public WorkArea, public SigC::Object class GWorkArea : public WorkArea, public SigC::Object
{ {
public: public:
GWorkArea(int width, int height); GWorkArea(int width, int height);
~GWorkArea(); ~GWorkArea();
virtual Painter & getPainter() { return painter_; } virtual Painter & getPainter();
/// ///
virtual int workWidth() const { return workArea_.get_width(); } virtual int workWidth() const;
/// ///
virtual int workHeight() const { return workArea_.get_height(); } virtual int workHeight() const;
/// return x position of window /// return x position of window
int xpos() const { return 0; } int xpos() const;
/// return y position of window /// return y position of window
int ypos() const { return 0; } int ypos() const;
/// ///
Glib::RefPtr<Gdk::Window> getWindow() { return workArea_.get_window(); } Glib::RefPtr<Gdk::Window> getWindow();
Display * getDisplay() const Display * getDisplay() const;
{ return GDK_WINDOW_XDISPLAY( Glib::RefPtr<Gdk::Pixmap> getPixmap();
const_cast<GdkWindow*>(workArea_.get_window()->gobj())); } Glib::RefPtr<Gdk::GC> getGC();
Glib::RefPtr<Gdk::Pixmap> getPixmap() { return workAreaPixmap_; } Glib::RefPtr<Gdk::Colormap> getColormap();
Glib::RefPtr<Gdk::GC> getGC() { return workAreaGC_; } XftDraw * getXftDraw();
Glib::RefPtr<Gdk::Colormap> getColormap() ColorHandler & getColorHandler();
{ return workArea_.get_colormap(); }
XftDraw * getXftDraw() { return draw_; }
ColorHandler & getColorHandler() { return colorHandler_; }
virtual void setScrollbarParams(int height, int pos, int line_height); virtual void setScrollbarParams(int height, int pos, int line_height);
/// a selection exists /// a selection exists