moved Texture and Color into new files, fixed some const and pointers
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: IconBar.cc,v 1.13 2002/07/20 00:06:45 fluxgen Exp $ +// $Id: IconBar.cc,v 1.14 2002/07/23 17:11:58 fluxgen Exp $ #include "IconBar.hh" #include "i18n.hh"@@ -97,22 +97,23 @@ //--------------------------------------
void IconBar::loadTheme(unsigned int width, unsigned int height) { BImageControl *image_ctrl = m_screen->getImageControl(); Pixmap tmp = m_focus_pm; - BTexture *texture = &(m_screen->getWindowStyle()->tab.l_focus); + FbTk::Texture *texture = &(m_screen->getWindowStyle()->tab.l_focus); //If we are working on a PARENTRELATIVE, change to right focus value - if (texture->getTexture() & BImage::PARENTRELATIVE ) { + if (texture->type() & FbTk::Texture::PARENTRELATIVE ) { texture = &(m_screen->getWindowStyle()->tab.t_focus); } - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { - m_focus_pm = None; - m_focus_pixel = texture->color().pixel(); - } else { + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { + m_focus_pm = None; + m_focus_pixel = texture->color().pixel(); + } else { m_focus_pm = - image_ctrl->renderImage(width, height, texture); + image_ctrl->renderImage(width, height, texture); } - if (tmp) image_ctrl->removeImage(tmp); + if (tmp) + image_ctrl->removeImage(tmp); } //------------ decorate ------------------
@@ -22,10 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// stupid macros needed to access some functions in version 2 of the GNU C -// library - -// $Id: Image.cc,v 1.11 2002/07/22 22:33:45 fluxgen Exp $ +// $Id: Image.cc,v 1.12 2002/07/23 17:11:58 fluxgen Exp $ //use GNU extensions #ifndef _GNU_SOURCE@@ -69,9 +66,16 @@ #ifdef HAVE_CTYPE_H
# include <ctype.h> #endif // HAVE_CTYPE_H +#include <iostream> + +using namespace std; + +// lookup table for texture unsigned long *BImageControl::sqrt_table = 0; -static unsigned long bsqrt(unsigned long x) { +namespace { // anonymous + +unsigned long bsqrt(unsigned long x) { if (x <= 0) return 0; if (x == 1) return 1;@@ -85,6 +89,7 @@ r = (r + q) >> 1;
} } +}; BImage::BImage(BImageControl *c, unsigned int w, unsigned int h) { control = c;@@ -117,19 +122,20 @@ if (blue) delete [] blue;
} -Pixmap BImage::render(BTexture *texture) { - if (texture->getTexture() & BImage::PARENTRELATIVE) +Pixmap BImage::render(const FbTk::Texture *texture) { + using namespace FbTk; + if (texture->type() & Texture::PARENTRELATIVE) return ParentRelative; - else if (texture->getTexture() & BImage::SOLID) - return render_solid(texture); - else if (texture->getTexture() & BImage::GRADIENT) - return render_gradient(texture); + else if (texture->type() & Texture::SOLID) + return renderSolid(texture); + else if (texture->type() & Texture::GRADIENT) + return renderGradient(texture); return None; } -Pixmap BImage::render_solid(BTexture *texture) { +Pixmap BImage::renderSolid(const FbTk::Texture *texture) { Pixmap pixmap = XCreatePixmap(control->baseDisplay()->getXDisplay(), control->drawable(), width, height, control->depth());@@ -160,8 +166,9 @@
XFillRectangle(control->baseDisplay()->getXDisplay(), pixmap, gc, 0, 0, width, height); -#ifdef INTERLACE - if (texture->getTexture() & BImage::INTERLACED) { + using namespace FbTk; +#ifdef INTERLACE + if (texture->type() & Texture::INTERLACED) { gcv.foreground = texture->colorTo().pixel(); GC igc = XCreateGC(control->baseDisplay()->getXDisplay(), pixmap, GCForeground, &gcv);@@ -176,8 +183,8 @@ }
#endif // INTERLACE - if (texture->getTexture() & BImage::BEVEL1) { - if (texture->getTexture() & BImage::RAISED) { + if (texture->type() & Texture::BEVEL1) { + if (texture->type() & Texture::RAISED) { XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, lgc, 0, height - 1, width - 1, height - 1); XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, lgc,@@ -187,7 +194,7 @@ XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, hgc,
0, 0, width - 1, 0); XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, hgc, 0, height - 1, 0, 0); - } else if (texture->getTexture() & BImage::SUNKEN) { + } else if (texture->type() & Texture::SUNKEN) { XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, hgc, 0, height - 1, width - 1, height - 1); XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, hgc,@@ -198,8 +205,8 @@ 0, 0, width - 1, 0);
XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, lgc, 0, height - 1, 0, 0); } - } else if (texture->getTexture() & BImage::BEVEL2) { - if (texture->getTexture() & BImage::RAISED) { + } else if (texture->type() & Texture::BEVEL2) { + if (texture->type() & Texture::RAISED) { XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, lgc, 1, height - 3, width - 3, height - 3); XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, lgc,@@ -209,7 +216,7 @@ XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, hgc,
1, 1, width - 3, 1); XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, hgc, 1, height - 3, 1, 1); - } else if (texture->getTexture() & BImage::SUNKEN) { + } else if (texture->type() & Texture::SUNKEN) { XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, hgc, 1, height - 3, width - 3, height - 3); XDrawLine(control->baseDisplay()->getXDisplay(), pixmap, hgc,@@ -230,38 +237,53 @@ return pixmap;
} -Pixmap BImage::render_gradient(BTexture *texture) { - int inverted = 0; +Pixmap BImage::renderGradient(const FbTk::Texture *texture) { -#ifdef INTERLACE - interlaced = texture->getTexture() & BImage::INTERLACED; + bool inverted = false; + + using namespace FbTk; + +#ifdef INTERLACE + interlaced = texture->type() & Texture::INTERLACED; #endif // INTERLACE - if (texture->getTexture() & BImage::SUNKEN) { + if (texture->type() & Texture::SUNKEN) { from = &(texture->colorTo()); to = &(texture->color()); - if (! (texture->getTexture() & BImage::INVERT)) inverted = 1; + if (! (texture->type() & Texture::INVERT)) + inverted = true; } else { from = &(texture->color()); to = &(texture->colorTo()); - if (texture->getTexture() & BImage::INVERT) inverted = 1; + if (texture->type() & Texture::INVERT) + inverted = true; } control->getGradientBuffers(width, height, &xtable, &ytable); - if (texture->getTexture() & BImage::DIAGONAL) dgradient(); - else if (texture->getTexture() & BImage::ELLIPTIC) egradient(); - else if (texture->getTexture() & BImage::HORIZONTAL) hgradient(); - else if (texture->getTexture() & BImage::PYRAMID) pgradient(); - else if (texture->getTexture() & BImage::RECTANGLE) rgradient(); - else if (texture->getTexture() & BImage::VERTICAL) vgradient(); - else if (texture->getTexture() & BImage::CROSSDIAGONAL) cdgradient(); - else if (texture->getTexture() & BImage::PIPECROSS) pcgradient(); + if (texture->type() & Texture::DIAGONAL) + dgradient(); + else if (texture->type() & Texture::ELLIPTIC) + egradient(); + else if (texture->type() & Texture::HORIZONTAL) + hgradient(); + else if (texture->type() & Texture::PYRAMID) + pgradient(); + else if (texture->type() & Texture::RECTANGLE) + rgradient(); + else if (texture->type() & Texture::VERTICAL) + vgradient(); + else if (texture->type() & Texture::CROSSDIAGONAL) + cdgradient(); + else if (texture->type() & Texture::PIPECROSS) + pcgradient(); - if (texture->getTexture() & BImage::BEVEL1) bevel1(); - else if (texture->getTexture() & BImage::BEVEL2) bevel2(); + if (texture->type() & Texture::BEVEL1) + bevel1(); + else if (texture->type() & Texture::BEVEL2) + bevel2(); if (inverted) invert();@@ -2163,9 +2185,8 @@
if (colors) { unsigned long *pixels = new unsigned long [ncolors]; - int i; - for (i = 0; i < ncolors; i++) - *(pixels + i) = (*(colors + i)).pixel; + for (int color = 0; color < ncolors; color++) + *(pixels + color) = (*(colors + color)).pixel; XFreeColors(basedisplay->getXDisplay(), colormap(), pixels, ncolors, 0);@@ -2192,17 +2213,17 @@ }
Pixmap BImageControl::searchCache(unsigned int width, unsigned int height, - unsigned long texture, - BColor *c1, BColor *c2) { + unsigned long texture_type, + const FbTk::Color &color, const FbTk::Color &color_to) { CacheList::iterator it = cache.begin(); CacheList::iterator it_end = cache.end(); for (; it != it_end; ++it) { if (((*it)->width == width) && ((*it)->height == height) && - ((*it)->texture == texture) && - ((*it)->pixel1 == c1->pixel())) { - if (texture & BImage::GRADIENT) { - if ((*it)->pixel2 == c2->pixel()) { + ((*it)->texture == texture_type) && + ((*it)->pixel1 == color.pixel())) { + if (texture_type & FbTk::Texture::GRADIENT) { + if ((*it)->pixel2 == color_to.pixel()) { (*it)->count++; return (*it)->pixmap; }@@ -2218,11 +2239,12 @@ }
Pixmap BImageControl::renderImage(unsigned int width, unsigned int height, - BTexture *texture) { - if (texture->getTexture() & BImage::PARENTRELATIVE) return ParentRelative; + const FbTk::Texture *texture) { + if (texture->type() & FbTk::Texture::PARENTRELATIVE) + return ParentRelative; - Pixmap pixmap = searchCache(width, height, texture->getTexture(), - &texture->color(), &texture->colorTo()); + Pixmap pixmap = searchCache(width, height, texture->type(), + texture->color(), texture->colorTo()); if (pixmap) return pixmap; BImage image(this, width, height);@@ -2235,10 +2257,10 @@ tmp->pixmap = pixmap;
tmp->width = width; tmp->height = height; tmp->count = 1; - tmp->texture = texture->getTexture(); + tmp->texture = texture->type(); tmp->pixel1 = texture->color().pixel(); - if (texture->getTexture() & BImage::GRADIENT) + if (texture->type() & FbTk::Texture::GRADIENT) tmp->pixel2 = texture->colorTo().pixel(); else tmp->pixel2 = 0l;@@ -2431,65 +2453,71 @@ return (*(sqrt_table + x));
} -void BImageControl::parseTexture(BTexture *texture, char *t) { - if ((! texture) || (! t)) return; +void BImageControl::parseTexture(FbTk::Texture *texture, const char *texture_string) { + if ((! texture) || (! texture_string)) + return; - int t_len = strlen(t) + 1, i; + int t_len = strlen(texture_string) + 1; char *ts = new char[t_len]; if (! ts) return; // convert to lower case - for (i = 0; i < t_len; i++) - *(ts + i) = tolower(*(t + i)); + for (int byte_pos = 0; byte_pos < t_len; byte_pos++) + *(ts + byte_pos) = tolower(*(texture_string + byte_pos)); + + using namespace FbTk; +#ifdef DEBUG + cerr<<__FILE__<<"("<<__LINE__<<"): texture_string = "<<texture_string<<endl; +#endif // DEBUG if (strstr(ts, "parentrelative")) { - texture->setTexture(BImage::PARENTRELATIVE); + texture->setType(Texture::PARENTRELATIVE); } else { - texture->setTexture(0); + texture->setType(Texture::NONE); if (strstr(ts, "solid")) - texture->addTexture(BImage::SOLID); + texture->addType(Texture::SOLID); else if (strstr(ts, "gradient")) { - texture->addTexture(BImage::GRADIENT); + texture->addType(Texture::GRADIENT); if (strstr(ts, "crossdiagonal")) - texture->addTexture(BImage::CROSSDIAGONAL); + texture->addType(Texture::CROSSDIAGONAL); else if (strstr(ts, "rectangle")) - texture->addTexture(BImage::RECTANGLE); + texture->addType(Texture::RECTANGLE); else if (strstr(ts, "pyramid")) - texture->addTexture(BImage::PYRAMID); + texture->addType(Texture::PYRAMID); else if (strstr(ts, "pipecross")) - texture->addTexture(BImage::PIPECROSS); + texture->addType(Texture::PIPECROSS); else if (strstr(ts, "elliptic")) - texture->addTexture(BImage::ELLIPTIC); + texture->addType(Texture::ELLIPTIC); else if (strstr(ts, "diagonal")) - texture->addTexture(BImage::DIAGONAL); + texture->addType(Texture::DIAGONAL); else if (strstr(ts, "horizontal")) - texture->addTexture(BImage::HORIZONTAL); + texture->addType(Texture::HORIZONTAL); else if (strstr(ts, "vertical")) - texture->addTexture(BImage::VERTICAL); + texture->addType(Texture::VERTICAL); else - texture->addTexture(BImage::DIAGONAL); + texture->addType(Texture::DIAGONAL); } else - texture->addTexture(BImage::SOLID); + texture->addType(Texture::SOLID); if (strstr(ts, "raised")) - texture->addTexture(BImage::RAISED); + texture->addType(Texture::RAISED); else if (strstr(ts, "sunken")) - texture->addTexture(BImage::SUNKEN); + texture->addType(Texture::SUNKEN); else if (strstr(ts, "flat")) - texture->addTexture(BImage::FLAT); + texture->addType(Texture::FLAT); else - texture->addTexture(BImage::RAISED); + texture->addType(Texture::RAISED); - if (! (texture->getTexture() & BImage::FLAT)) + if (! (texture->type() & Texture::FLAT)) if (strstr(ts, "bevel2")) - texture->addTexture(BImage::BEVEL2); + texture->addType(Texture::BEVEL2); else - texture->addTexture(BImage::BEVEL1); + texture->addType(Texture::BEVEL1); -#ifdef INTERLACE +#ifdef INTERLACE if (strstr(ts, "interlaced")) - texture->addTexture(BImage::INTERLACED); + texture->addType(Texture::INTERLACED); #endif // INTERLACE }@@ -2497,7 +2525,7 @@ delete [] ts;
} -void BImageControl::parseColor(BColor *col, char *c) { +void BImageControl::parseColor(FbTk::Color *col, const char *color_string) { if (!col) return; if (col->isAllocated()) {@@ -2507,13 +2535,13 @@ XFreeColors(basedisplay->getXDisplay(), colormap(), &pixel, 1, 0);
col->setPixel(0l); col->setRGB(0, 0, 0); - col->setAllocated(False); + col->setAllocated(false); } - if (c) { + if (color_string != 0) { unsigned char r, g, b; - col->setPixel(color(c, &r, &g, &b)); + col->setPixel(color(color_string, &r, &g, &b)); col->setRGB(r, g, b); col->setAllocated(true); }
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Image.hh,v 1.9 2002/07/22 22:33:45 fluxgen Exp $ +// $Id: Image.hh,v 1.10 2002/07/23 17:11:59 fluxgen Exp $ #ifndef IMAGE_HH #define IMAGE_HH@@ -33,124 +33,62 @@
#include "Timer.hh" #include "BaseDisplay.hh" +#include "Color.hh" +#include "Texture.hh" + #include <list> -class BImage; class BImageControl; - -class BColor { +class BImage { public: - BColor(unsigned char red = 0, unsigned char green = 0, unsigned char blue = 0): - m_red(red), m_green(green), m_blue(blue), m_pixel(0), m_allocated(false) { } + BImage(BImageControl *ic, unsigned int, unsigned int); + ~BImage(); + /// render to pixmap + Pixmap render(const FbTk::Texture *src_texture); + /// render solid texture to pixmap + Pixmap renderSolid(const FbTk::Texture *src_texture); + /// render gradient texture to pixmap + Pixmap renderGradient(const FbTk::Texture *src_texture); - inline int isAllocated() const { return m_allocated; } +protected: + /** + Render to pixmap + @return rendered pixmap + */ + Pixmap renderPixmap(); + /** + Render to XImage + @returns allocated and rendered XImage, user is responsible to deallocate + */ + XImage *renderXImage(); - inline unsigned char red() const { return m_red; } - inline unsigned char green() const { return m_green; } - inline unsigned char blue() const { return m_blue; } + void invert(); + void bevel1(); + void bevel2(); + void dgradient(); + void egradient(); + void hgradient(); + void pgradient(); + void rgradient(); + void vgradient(); + void cdgradient(); + void pcgradient(); - inline unsigned long pixel() const { return m_pixel; } - - inline void setAllocated(bool a) { m_allocated = a; } - inline void setRGB(char red, char green, char blue) { m_red = red; m_green = green; m_blue = blue; } - inline void setPixel(unsigned long pixel) { m_pixel = pixel; } - -private: - unsigned char m_red, m_green, m_blue; - unsigned long m_pixel; - bool m_allocated; -}; - - -class BTexture { -public: - BTexture():m_texture(0) { } - - inline const BColor &color() const { return m_color; } - inline const BColor &colorTo() const { return m_color_to; } - inline const BColor &hiColor() const { return m_hicolor; } - inline const BColor &loColor() const { return m_locolor; } - - inline BColor &color() { return m_color; } - inline BColor &colorTo() { return m_color_to; } - inline BColor &hiColor() { return m_hicolor; } - inline BColor &loColor() { return m_locolor; } - - inline unsigned long getTexture() const { return m_texture; } - - inline void setTexture(unsigned long t) { m_texture = t; } - inline void addTexture(unsigned long t) { m_texture |= t; } - -private: - BColor m_color, m_color_to, m_hicolor, m_locolor; - unsigned long m_texture; -}; - - - -class BImage { private: BImageControl *control; #ifdef INTERLACE - Bool interlaced; + bool interlaced; #endif // INTERLACE - XColor *colors; + XColor *colors; // color table - BColor *from, *to; + const FbTk::Color *from, *to; int red_offset, green_offset, blue_offset, red_bits, green_bits, blue_bits, ncolors, cpc, cpccpc; unsigned char *red, *green, *blue, *red_table, *green_table, *blue_table; unsigned int width, height, *xtable, *ytable; - - -protected: - Pixmap renderPixmap(void); - - XImage *renderXImage(void); - - void invert(void); - void bevel1(void); - void bevel2(void); - void dgradient(void); - void egradient(void); - void hgradient(void); - void pgradient(void); - void rgradient(void); - void vgradient(void); - void cdgradient(void); - void pcgradient(void); - - -public: - enum Bevel{FLAT=0x00002, SUNKEN=0x00004, RAISED=0x00008}; - enum Textures{SOLID=0x00010, GRADIENT=0x00020}; - enum Gradients{ - HORIZONTAL=0x00040, - VERTICAL=0x00080, - DIAGONAL=0x00100, - CROSSDIAGONAL=0x00200, - RECTANGLE=0x00400, - PYRAMID=0x00800, - PIPECROSS=0x01000, - ELLIPTIC=0x02000 - }; - - enum { - BEVEL1=0x04000, BEVEL2=0x08000, // bevel types - INVERT=0x010000, //inverted image - PARENTRELATIVE=0x20000, - INTERLACED=0x40000 - }; - - BImage(BImageControl *, unsigned int, unsigned int); - ~BImage(void); - - Pixmap render(BTexture *); - Pixmap render_solid(BTexture *); - Pixmap render_gradient(BTexture *); };@@ -166,20 +104,21 @@ inline bool doDither() { return dither; }
inline const Colormap &colormap() const { return m_colormap; } inline ScreenInfo *getScreenInfo() { return screeninfo; } - inline const Window &drawable() const { return window; } + inline Window drawable() const { return window; } inline Visual *visual() { return screeninfo->getVisual(); } inline int bitsPerPixel() const { return bits_per_pixel; } inline int depth() const { return screen_depth; } - inline int colorsPerChannel(void) const { return colors_per_channel; } + inline int colorsPerChannel() const { return colors_per_channel; } unsigned long color(const char *colorname); unsigned long color(const char *, unsigned char *, unsigned char *, unsigned char *); unsigned long getSqrt(unsigned int val); - Pixmap renderImage(unsigned int, unsigned int, BTexture *); + Pixmap renderImage(unsigned int width, unsigned int height, + const FbTk::Texture *src_texture); void installRootColormap(); void removeImage(Pixmap thepix);@@ -190,11 +129,19 @@ void getGradientBuffers(unsigned int, unsigned int,
unsigned int **, unsigned int **); void setDither(bool d) { dither = d; } void setColorsPerChannel(int cpc); - void parseTexture(BTexture *ret_texture, char *sval); - void parseColor(BColor *ret_color, char *sval = 0); + void parseTexture(FbTk::Texture *ret_texture, const char *sval); + void parseColor(FbTk::Color *ret_color, const char *sval = 0); virtual void timeout(); +protected: + /** + Search cache for a specific pixmap + @return None if no cache was found + */ + Pixmap searchCache(unsigned int width, unsigned int height, unsigned long texture_type, + const FbTk::Color &color, const FbTk::Color &color_to); + private: bool dither; BaseDisplay *basedisplay;@@ -206,16 +153,17 @@
Colormap m_colormap; Window window; - XColor *colors; + XColor *colors; // color table int colors_per_channel, ncolors, screen_number, screen_depth, bits_per_pixel, red_offset, green_offset, blue_offset, red_bits, green_bits, blue_bits; + unsigned char red_color_table[256], green_color_table[256], blue_color_table[256]; unsigned int *grad_xbuffer, *grad_ybuffer, grad_buffer_width, grad_buffer_height; - static unsigned long *sqrt_table; - unsigned long cache_max; + + static unsigned long *sqrt_table; /// sqrt lookup table typedef struct Cache { Pixmap pixmap;@@ -223,13 +171,11 @@
unsigned int count, width, height; unsigned long pixel1, pixel2, texture; } Cache; - + + unsigned long cache_max; typedef std::list<Cache *> CacheList; CacheList cache; - -protected: - Pixmap searchCache(unsigned int, unsigned int, unsigned long, BColor *, BColor *); };
@@ -49,6 +49,6 @@ i18n.cc i18n.hh main.cc Tab.hh Tab.cc Keys.cc Keys.hh\
IconBar.cc IconBar.hh Theme.hh Theme.cc \ StringUtil.cc StringUtil.hh DrawUtil.cc DrawUtil.hh nl_types_cygnus.h \ XrmDatabaseHelper.hh NotCopyable.hh Resource.hh Resource.cc Font.hh Font.cc \ - FbAtoms.hh FbAtoms.cc + FbAtoms.hh FbAtoms.cc Color.hh Texture.hh MAINTAINERCLEANFILES= Makefile.in
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.57 2002/07/23 13:47:05 fluxgen Exp $ +// $Id: Screen.cc,v 1.58 2002/07/23 17:11:59 fluxgen Exp $ //use GNU extensions #ifndef _GNU_SOURCE@@ -330,9 +330,9 @@ 0, 0, geom_w, geom_h, theme->getBorderWidth(), getDepth(),
InputOutput, getVisual(), mask, &attrib); geom_visible = false; - if (theme->getWindowStyle().l_focus.getTexture() & BImage::PARENTRELATIVE) { - if (theme->getWindowStyle().t_focus.getTexture() == - (BImage::FLAT | BImage::SOLID)) { + if (theme->getWindowStyle().l_focus.type() & FbTk::Texture::PARENTRELATIVE) { + if (theme->getWindowStyle().t_focus.type() == + (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { geom_pixmap = None; XSetWindowBackground(getBaseDisplay()->getXDisplay(), geom_window, theme->getWindowStyle().t_focus.color().pixel());@@ -343,8 +343,8 @@ XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(),
geom_window, geom_pixmap); } } else { - if (theme->getWindowStyle().l_focus.getTexture() == - (BImage::FLAT | BImage::SOLID)) { + if (theme->getWindowStyle().l_focus.type() == + (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { geom_pixmap = None; XSetWindowBackground(getBaseDisplay()->getXDisplay(), geom_window, theme->getWindowStyle().l_focus.color().pixel());@@ -581,9 +581,9 @@ geom_w += getBevelWidth()*2;
geom_h += getBevelWidth()*2; Pixmap tmp = geom_pixmap; - if (theme->getWindowStyle().l_focus.getTexture() & BImage::PARENTRELATIVE) { - if (theme->getWindowStyle().t_focus.getTexture() == - (BImage::FLAT | BImage::SOLID)) { + if (theme->getWindowStyle().l_focus.type() & FbTk::Texture::PARENTRELATIVE) { + if (theme->getWindowStyle().t_focus.type() == + (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { geom_pixmap = None; XSetWindowBackground(getBaseDisplay()->getXDisplay(), geom_window, theme->getWindowStyle().t_focus.color().pixel());@@ -594,8 +594,8 @@ XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(),
geom_window, geom_pixmap); } } else { - if (theme->getWindowStyle().l_focus.getTexture() == - (BImage::FLAT | BImage::SOLID)) { + if (theme->getWindowStyle().l_focus.type() == + (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { geom_pixmap = None; XSetWindowBackground(getBaseDisplay()->getXDisplay(), geom_window, theme->getWindowStyle().l_focus.color().pixel());@@ -1076,9 +1076,8 @@ }
#endif // HAVE_STRFTIME -void BScreen::addWorkspaceName(char *name) { +void BScreen::addWorkspaceName(const char *name) { workspaceNames.push_back(name); - }
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Slit.cc,v 1.17 2002/07/20 09:35:01 fluxgen Exp $ +// $Id: Slit.cc,v 1.18 2002/07/23 17:11:59 fluxgen Exp $ //use GNU extensions #ifndef _GNU_SOURCE@@ -408,8 +408,8 @@ XMapWindow(display, frame.window);
Pixmap tmp = frame.pixmap; BImageControl *image_ctrl = screen->getImageControl(); - BTexture *texture = &(screen->getToolbarStyle()->toolbar); - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + FbTk::Texture *texture = &(screen->getToolbarStyle()->toolbar); + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { frame.pixmap = None; XSetWindowBackground(display, frame.window, texture->color().pixel());
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Tab.cc,v 1.28 2002/07/20 09:49:21 fluxgen Exp $ +// $Id: Tab.cc,v 1.29 2002/07/23 17:11:59 fluxgen Exp $ #include "Tab.hh"@@ -189,11 +189,11 @@ //------------------------------------------
void Tab::loadTheme() { BImageControl *image_ctrl = m_win->getScreen()->getImageControl(); Pixmap tmp = m_focus_pm; - BTexture *texture = &(m_win->getScreen()->getWindowStyle()->tab.l_focus); + FbTk::Texture *texture = &(m_win->getScreen()->getWindowStyle()->tab.l_focus); - if (texture->getTexture() & BImage::PARENTRELATIVE ) { - BTexture *pt = &(m_win->getScreen()->getWindowStyle()->tab.t_focus); - if (pt->getTexture() == (BImage::FLAT | BImage::SOLID)) { + if (texture->type() & FbTk::Texture::PARENTRELATIVE ) { + FbTk::Texture *pt = &(m_win->getScreen()->getWindowStyle()->tab.t_focus); + if (pt->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { m_focus_pm = None; m_focus_pixel = pt->color().pixel(); } else@@ -203,7 +203,7 @@
if (tmp) image_ctrl->removeImage(tmp); } else { - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { m_focus_pm = None; m_focus_pixel = texture->color().pixel(); } else@@ -215,16 +215,16 @@
tmp = m_unfocus_pm; texture = &(m_win->getScreen()->getWindowStyle()->tab.l_unfocus); - if (texture->getTexture() & BImage::PARENTRELATIVE ) { - BTexture *pt = &(m_win->getScreen()->getWindowStyle()->tab.t_unfocus); - if (pt->getTexture() == (BImage::FLAT | BImage::SOLID)) { + if (texture->type() & FbTk::Texture::PARENTRELATIVE ) { + FbTk::Texture *pt = &(m_win->getScreen()->getWindowStyle()->tab.t_unfocus); + if (pt->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { m_unfocus_pm = None; m_unfocus_pixel = pt->color().pixel(); } else m_unfocus_pm = image_ctrl->renderImage(m_size_w, m_size_h, pt); } else { - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { m_unfocus_pm = None; m_unfocus_pixel = texture->color().pixel(); } else
@@ -41,7 +41,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Theme.cc,v 1.22 2002/07/19 21:45:00 fluxgen Exp $ +// $Id: Theme.cc,v 1.23 2002/07/23 17:11:59 fluxgen Exp $ #ifndef _GNU_SOURCE #define _GNU_SOURCE@@ -577,6 +577,7 @@ BlackPixel(m_display, m_screennum));
readDatabaseTexture("toolbar.clock", "Toolbar.Clock", &m_toolbarstyle.clock, BlackPixel(m_display, m_screennum)); + readDatabaseColor("toolbar.label.textColor", "Toolbar.Label.TextColor", &m_toolbarstyle.l_text, WhitePixel(m_display, m_screennum));@@ -625,7 +626,7 @@ XrmValue value;
char *value_type; if (m_rootcommand.size()) { - #ifndef __EMX__ + #ifndef __EMX__ char tmpstring[256]; //to hold m_screennum tmpstring[0]=0; sprintf(tmpstring, "%d", m_screennum);@@ -708,7 +709,7 @@ }
bool Theme::readDatabaseTexture(char *rname, char *rclass, - BTexture *texture, + FbTk::Texture *texture, unsigned long default_pixel) { XrmValue value;@@ -719,9 +720,9 @@ if (XrmGetResource(m_database, rname, rclass, &value_type,
&value)) m_imagecontrol->parseTexture(texture, value.addr); else - texture->setTexture(BImage::SOLID | BImage::FLAT); + texture->setType(FbTk::Texture::SOLID | FbTk::Texture::FLAT); - if (texture->getTexture() & BImage::SOLID) { + if (texture->type() & FbTk::Texture::SOLID) { int clen = strlen(rclass) + 32, nlen = strlen(rname) + 32; char *colorclass = new char[clen], *colorname = new char[nlen];@@ -744,7 +745,7 @@ delete [] colorclass;
delete [] colorname; if ((! texture->color().isAllocated()) || - (texture->getTexture() & BImage::FLAT)) + (texture->type() & FbTk::Texture::FLAT)) return retval; XColor xcol;@@ -781,7 +782,7 @@ if (! XAllocColor(m_display, m_colormap, &xcol))
xcol.pixel = 0; texture->loColor().setPixel(xcol.pixel); - } else if (texture->getTexture() & BImage::GRADIENT) { + } else if (texture->type() & FbTk::Texture::GRADIENT) { int clen = strlen(rclass) + 10, nlen = strlen(rname) + 10; char *colorclass = new char[clen], *colorname = new char[nlen],@@ -812,7 +813,7 @@ return retval;
} -bool Theme::readDatabaseColor(char *rname, char *rclass, BColor *color, +bool Theme::readDatabaseColor(char *rname, char *rclass, FbTk::Color *color, unsigned long default_pixel) { XrmValue value;
@@ -42,7 +42,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Theme.hh,v 1.10 2002/07/19 21:44:06 fluxgen Exp $ +// $Id: Theme.hh,v 1.11 2002/07/23 17:11:59 fluxgen Exp $ #ifndef THEME_HH #define THEME_HH@@ -68,8 +68,8 @@
typedef struct MenuStyle { MenuStyle(Display *display):titlefont(display, "fixed"), framefont(display, "fixed") { } - BColor t_text, f_text, h_text, d_text; - BTexture title, frame, hilite; + FbTk::Color t_text, f_text, h_text, d_text; + FbTk::Texture title, frame, hilite; GC t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc; FbTk::Font titlefont, framefont; DrawUtil::Font::FontJustify framefont_justify;@@ -79,23 +79,23 @@ } MenuStyle;
typedef struct LabelStyle { - BTexture l_focus, l_unfocus, + FbTk::Texture l_focus, l_unfocus, t_focus, t_unfocus; GC l_text_focus_gc, l_text_unfocus_gc; DrawUtil::Font font; - BColor l_text_focus, l_text_unfocus; + FbTk::Color l_text_focus, l_text_unfocus; } LabelStyle; typedef struct WindowStyle:public LabelStyle { - BColor f_focus, f_unfocus, b_pic_focus, + FbTk::Color f_focus, f_unfocus, b_pic_focus, b_pic_unfocus; - BTexture h_focus, h_unfocus, + FbTk::Texture h_focus, h_unfocus, b_focus, b_unfocus, b_pressed, g_focus, g_unfocus; GC b_pic_focus_gc, b_pic_unfocus_gc; struct t_tab:public LabelStyle { - BColor border_color; + FbTk::Color border_color; unsigned int border_width; unsigned int border_width_2x; DrawUtil::XRotFontStruct *rot_font;@@ -105,8 +105,8 @@ } WindowStyle;
typedef struct ToolbarStyle { - BColor l_text, w_text, c_text, b_pic; - BTexture toolbar, label, window, button, pressed, clock; + FbTk::Color l_text, w_text, c_text, b_pic; + FbTk::Texture toolbar, label, window, button, pressed, clock; GC l_text_gc, w_text_gc, c_text_gc, b_pic_gc; DrawUtil::Font font;@@ -120,7 +120,7 @@ inline unsigned int getBorderWidth(void) const { return m_border_width; }
inline unsigned int getHandleWidth(void) const { return m_handle_width; } inline unsigned int getFrameWidth(void) const { return m_frame_width; } inline const GC &getOpGC(void) const { return m_opgc; } - inline const BColor &getBorderColor(void) const { return m_border_color; } + inline const FbTk::Color &getBorderColor(void) const { return m_border_color; } void load(const char *filename); void reconfigure();@@ -141,8 +141,8 @@ void freeWindowStyle();
void freeTabStyle(); void freeToolbarStyle(); - bool readDatabaseTexture(char *, char *, BTexture *, unsigned long); - bool readDatabaseColor(char *, char *, BColor *, unsigned long); + bool readDatabaseTexture(char *, char *, FbTk::Texture *, unsigned long); + bool readDatabaseColor(char *, char *, FbTk::Color *, unsigned long); void readDatabaseFontSet(char *, char *, XFontSet *); XFontSet createFontSet(char *);@@ -156,7 +156,7 @@ WindowStyle m_windowstyle;
MenuStyle m_menustyle; ToolbarStyle m_toolbarstyle; unsigned int m_bevel_width, m_border_width, m_handle_width, m_frame_width; - BColor m_border_color; + FbTk::Color m_border_color; GC m_opgc; BImageControl *m_imagecontrol; Display *m_display;
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Toolbar.cc,v 1.24 2002/07/20 09:49:57 fluxgen Exp $ +// $Id: Toolbar.cc,v 1.25 2002/07/23 17:11:59 fluxgen Exp $ // stupid macros needed to access some functions in version 2 of the GNU C // library@@ -430,8 +430,8 @@ frame.bevel_w, frame.bevel_w, frame.clock_w,
frame.label_h); Pixmap tmp = frame.base; - BTexture *texture = &(screen->getToolbarStyle()->toolbar); - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + FbTk::Texture *texture = &(screen->getToolbarStyle()->toolbar); + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { frame.base = None; XSetWindowBackground(display, frame.window, texture->color().pixel());@@ -444,7 +444,7 @@ if (tmp) image_ctrl->removeImage(tmp);
tmp = frame.label; texture = &(screen->getToolbarStyle()->window); - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { frame.label = None; XSetWindowBackground(display, frame.window_label, texture->color().pixel());@@ -457,7 +457,7 @@ if (tmp) image_ctrl->removeImage(tmp);
tmp = frame.wlabel; texture = &(screen->getToolbarStyle()->label); - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { frame.wlabel = None; XSetWindowBackground(display, frame.workspace_label, texture->color().pixel());@@ -470,7 +470,7 @@ if (tmp) image_ctrl->removeImage(tmp);
tmp = frame.clk; texture = &(screen->getToolbarStyle()->clock); - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { frame.clk = None; XSetWindowBackground(display, frame.clock, texture->color().pixel());@@ -483,7 +483,7 @@ if (tmp) image_ctrl->removeImage(tmp);
tmp = frame.button; texture = &(screen->getToolbarStyle()->button); - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { frame.button = None; frame.button_pixel = texture->color().pixel();@@ -504,7 +504,7 @@ if (tmp) image_ctrl->removeImage(tmp);
tmp = frame.pbutton; texture = &(screen->getToolbarStyle()->pressed); - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { frame.pbutton = None; frame.pbutton_pixel = texture->color().pixel(); } else
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.62 2002/07/19 21:35:37 fluxgen Exp $ +// $Id: Window.cc,v 1.63 2002/07/23 17:11:59 fluxgen Exp $ #include "Window.hh"@@ -609,8 +609,8 @@ if (tab)
tab->decorate(); Pixmap tmp = frame.fbutton; - BTexture *texture = &(screen->getWindowStyle()->b_focus); - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + FbTk::Texture *texture = &(screen->getWindowStyle()->b_focus); + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { frame.fbutton = None; frame.fbutton_pixel = texture->color().pixel(); } else@@ -620,7 +620,7 @@ if (tmp) image_ctrl->removeImage(tmp);
tmp = frame.ubutton; texture = &(screen->getWindowStyle()->b_unfocus); - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { frame.ubutton = None; frame.ubutton_pixel = texture->color().pixel(); } else@@ -630,7 +630,7 @@ if (tmp) image_ctrl->removeImage(tmp);
tmp = frame.pbutton; texture = &(screen->getWindowStyle()->b_pressed); - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { frame.pbutton = None; frame.pbutton_pixel = texture->color().pixel(); } else@@ -641,7 +641,7 @@
if (decorations.titlebar) { tmp = frame.ftitle; texture = &(screen->getWindowStyle()->t_focus); - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { frame.ftitle = None; frame.ftitle_pixel = texture->color().pixel(); } else@@ -653,7 +653,7 @@ image_ctrl->removeImage(tmp);
tmp = frame.utitle; texture = &(screen->getWindowStyle()->t_unfocus); - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { frame.utitle = None; frame.utitle_pixel = texture->color().pixel(); } else@@ -676,7 +676,7 @@
if (decorations.handle) { tmp = frame.fhandle; texture = &(screen->getWindowStyle()->h_focus); - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { frame.fhandle = None; frame.fhandle_pixel = texture->color().pixel(); } else@@ -686,7 +686,7 @@ if (tmp) image_ctrl->removeImage(tmp);
tmp = frame.uhandle; texture = &(screen->getWindowStyle()->h_unfocus); - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { frame.uhandle = None; frame.uhandle_pixel = texture->color().pixel(); } else@@ -697,7 +697,7 @@ image_ctrl->removeImage(tmp);
tmp = frame.fgrip; texture = &(screen->getWindowStyle()->g_focus); - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { frame.fgrip = None; frame.fgrip_pixel = texture->color().pixel(); } else@@ -708,7 +708,7 @@ image_ctrl->removeImage(tmp);
tmp = frame.ugrip; texture = &(screen->getWindowStyle()->g_unfocus); - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { frame.ugrip = None; frame.ugrip_pixel = texture->color().pixel(); } else@@ -731,8 +731,8 @@
void FluxboxWindow::decorateLabel() { Pixmap tmp = frame.flabel; - BTexture *texture = &(screen->getWindowStyle()->l_focus); - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + FbTk::Texture *texture = &(screen->getWindowStyle()->l_focus); + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { frame.flabel = None; frame.flabel_pixel = texture->color().pixel(); } else@@ -742,7 +742,7 @@ if (tmp) image_ctrl->removeImage(tmp);
tmp = frame.ulabel; texture = &(screen->getWindowStyle()->l_unfocus); - if (texture->getTexture() == (BImage::FLAT | BImage::SOLID)) { + if (texture->type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { frame.ulabel = None; frame.ulabel_pixel = texture->color().pixel(); } else