From e1db89e2d7d56afca5335550ee1c9ff87fd54ba4 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Mon, 14 Jan 2008 23:27:00 +0100 Subject: [PATCH 1/3] moved code a bit around, cleaned up some classes --- src/FbTk/FbPixmap.cc | 43 ++++++++++++++++++++++----------------- src/FbTk/FbPixmap.hh | 17 +++++----------- src/FbTk/ImageControl.cc | 23 +++++++++++++++------ src/FbTk/ImageControl.hh | 42 ++++++++++---------------------------- src/FbTk/Text.cc | 16 +++++++-------- src/FbTk/Text.hh | 10 ++++----- src/FbTk/TextButton.cc | 2 +- src/FbTk/TextureRender.cc | 1 + util/fbsetroot.cc | 1 + 9 files changed, 72 insertions(+), 83 deletions(-) diff --git a/src/FbTk/FbPixmap.cc b/src/FbTk/FbPixmap.cc index bfd3ead7..9d90c5ae 100644 --- a/src/FbTk/FbPixmap.cc +++ b/src/FbTk/FbPixmap.cc @@ -38,21 +38,34 @@ using std::cerr; namespace FbTk { -Pixmap *FbPixmap::m_root_pixmaps = 0; +namespace { -const char* FbPixmap::root_prop_ids[] = { +Pixmap *root_pixmaps = 0; + +const char* root_prop_ids[] = { "_XROOTPMAP_ID", "_XSETROOT_ID", 0 }; // same number as in root_prop_ids -Atom FbPixmap::root_prop_atoms[] = { +Atom root_prop_atoms[] = { None, None, None }; +void checkAtoms() { + + Display* display = FbTk::App::instance()->display(); + for (int i=0; root_prop_ids[i] != 0; ++i) { + if (root_prop_atoms[i] == None) { + root_prop_atoms[i] = XInternAtom(display, root_prop_ids[i], False); + } + } +} + +}; // end of anonymous namespace FbPixmap::FbPixmap():m_pm(0), m_width(0), m_height(0), @@ -389,14 +402,14 @@ bool FbPixmap::rootwinPropertyNotify(int screen_num, Atom atom) { // returns whether or not the background was changed bool FbPixmap::setRootPixmap(int screen_num, Pixmap pm) { - if (!m_root_pixmaps) { - m_root_pixmaps = new Pixmap[ScreenCount(display())]; + if (!root_pixmaps) { + root_pixmaps = new Pixmap[ScreenCount(display())]; for (int i=0; i < ScreenCount(display()); ++i) - m_root_pixmaps[i] = None; + root_pixmaps[i] = None; } - if (m_root_pixmaps[screen_num] != pm) { - m_root_pixmaps[screen_num] = pm; + if (root_pixmaps[screen_num] != pm) { + root_pixmaps[screen_num] = pm; FbWindow::updatedAlphaBackground(screen_num); return true; } @@ -410,8 +423,8 @@ Pixmap FbPixmap::getRootPixmap(int screen_num, bool force_update) { */ // check and see if if we have the pixmaps in cache - if (m_root_pixmaps && !force_update) - return m_root_pixmaps[screen_num]; + if (root_pixmaps && !force_update) + return root_pixmaps[screen_num]; // else setup pixmap cache int numscreens = ScreenCount(display()); @@ -460,15 +473,7 @@ Pixmap FbPixmap::getRootPixmap(int screen_num, bool force_update) { setRootPixmap(i, root_pm); } - return m_root_pixmaps[screen_num]; -} - -void FbPixmap::checkAtoms() { - for (int i=0; root_prop_ids[i] != 0; ++i) { - if (root_prop_atoms[i] == None) { - root_prop_atoms[i] = XInternAtom(display(), root_prop_ids[i], False); - } - } + return root_pixmaps[screen_num]; } void FbPixmap::free() { diff --git a/src/FbTk/FbPixmap.hh b/src/FbTk/FbPixmap.hh index 7b3c8deb..5c2e2b86 100644 --- a/src/FbTk/FbPixmap.hh +++ b/src/FbTk/FbPixmap.hh @@ -23,22 +23,22 @@ #define FBTK_FBPIXMAP_HH #include "FbDrawable.hh" -#include "Text.hh" +#include "Text.hh" // for Orientation namespace FbTk { /// a wrapper for X Pixmap class FbPixmap:public FbDrawable { -public: +public: FbPixmap(); - /// copy pixmap + /// copy pixmap FbPixmap(const FbPixmap ©); /// creates a FbPixmap from X pixmap explicit FbPixmap(Pixmap pm); - FbPixmap(const FbDrawable &src, + FbPixmap(const FbDrawable &src, unsigned int width, unsigned int height, unsigned int depth); - FbPixmap(Drawable src, + FbPixmap(Drawable src, unsigned int width, unsigned int height, unsigned int depth); @@ -86,13 +86,6 @@ private: // if pixmap not *owned* by this object (eg assigned from cache object) bool m_dont_free; - /// Functions relating to the maintenance of root window pixmap caching - static void checkAtoms(); - - // array of pixmaps: 1 per screen - static Pixmap *m_root_pixmaps; - static const char *root_prop_ids[]; - static Atom root_prop_atoms[]; }; } // end namespace FbTk diff --git a/src/FbTk/ImageControl.cc b/src/FbTk/ImageControl.cc index 1281b562..1fa2f65e 100644 --- a/src/FbTk/ImageControl.cc +++ b/src/FbTk/ImageControl.cc @@ -25,6 +25,7 @@ #include "ImageControl.hh" #include "TextureRender.hh" +#include "Texture.hh" #include "App.hh" #include "SimpleCommand.hh" #include "I18n.hh" @@ -67,15 +68,17 @@ using std::list; namespace FbTk { -// lookup table for texture -unsigned long *ImageControl::sqrt_table = 0; +namespace { // anonymous + +static unsigned long *sqrt_table = 0; /// lookup table + #ifdef TIMEDCACHE -bool ImageControl::s_timed_cache = true; +bool s_timed_cache = true; #else -bool ImageControl::s_timed_cache = false; +bool s_timed_cache = false; #endif // TIMEDCACHE -namespace { // anonymous + inline unsigned long bsqrt(unsigned long x) { if (x <= 0) return 0; @@ -93,6 +96,14 @@ inline unsigned long bsqrt(unsigned long x) { }; // end anonymous namespace +struct ImageControl::Cache { + Pixmap pixmap; + Pixmap texture_pixmap; + Orientation orient; + unsigned int count, width, height; + unsigned long pixel1, pixel2, texture; +}; + ImageControl::ImageControl(int screen_num, bool dither, int cpc, unsigned long cache_timeout, unsigned long cmax): m_dither(dither), @@ -148,7 +159,7 @@ ImageControl::~ImageControl() { delete [] m_colors; } - if (cache.size() > 0) { + if (!cache.empty()) { CacheList::iterator it = cache.begin(); CacheList::iterator it_end = cache.end(); for (; it != it_end; ++it) { diff --git a/src/FbTk/ImageControl.hh b/src/FbTk/ImageControl.hh index d754a078..3c3cbb13 100644 --- a/src/FbTk/ImageControl.hh +++ b/src/FbTk/ImageControl.hh @@ -25,16 +25,17 @@ #ifndef FBTK_IMAGECONTROL_HH #define FBTK_IMAGECONTROL_HH -// actually, Text is rather tool like, that's where orientation comes from -#include "Text.hh" -#include "Texture.hh" +#include "Text.hh" // actually, Text is rather tool like, that's where orientation comes from #include "Timer.hh" #include "NotCopyable.hh" +#include // for Visual* etc #include namespace FbTk { +class Texture; + /// Holds screen info, color tables and caches textures class ImageControl: private NotCopyable { public: @@ -47,7 +48,7 @@ public: int bitsPerPixel() const { return bits_per_pixel; } #endif int depth() const { return m_screen_depth; } - int colorsPerChannel() const { return m_colors_per_channel; } + int colorsPerChannel() const { return m_colors_per_channel; } int screenNumber() const { return m_screen_num; } Visual *visual() const { return m_visual; } unsigned long getSqrt(unsigned int val) const; @@ -103,39 +104,18 @@ private: int m_colors_per_channel; ///< number of colors per channel int m_screen_depth; ///< bit depth of screen int m_screen_num; ///< screen number - unsigned char red_color_table[256], green_color_table[256], - blue_color_table[256]; + unsigned char red_color_table[256]; + unsigned char green_color_table[256]; + unsigned char blue_color_table[256]; + unsigned int *grad_xbuffer, *grad_ybuffer, grad_buffer_width, grad_buffer_height; - static unsigned long *sqrt_table; /// sqrt lookup table - - typedef struct Cache { - Pixmap pixmap; - Pixmap texture_pixmap; - Orientation orient; - unsigned int count, width, height; - unsigned long pixel1, pixel2, texture; - } Cache; - - struct ltCacheEntry { - bool operator()(const Cache* s1, const Cache* s2) const { - return (s1->orient < s2->orient || s1->orient == s2->orient - && (s1->width < s2->width || s1->width == s2->width - && (s1->height < s2->height || s1->height == s2->height - && (s1->texture < s2->texture || s1->texture == s2->texture - && (s1->pixel1 < s2->pixel1 || s1->pixel1 == s2->pixel1 - && ((s1->texture & FbTk::Texture::GRADIENT) && s1->pixel2 < s2->pixel2) - ))))); - } - }; - - - unsigned long cache_max; + struct Cache; typedef std::list CacheList; mutable CacheList cache; - static bool s_timed_cache; + unsigned long cache_max; }; } // end namespace FbTk diff --git a/src/FbTk/Text.cc b/src/FbTk/Text.cc index 1e2851e4..710b48aa 100644 --- a/src/FbTk/Text.cc +++ b/src/FbTk/Text.cc @@ -28,15 +28,15 @@ namespace FbTk { -int doAlignment(int max_width, int bevel, FbTk::Justify justify, - const FbTk::Font &font, const char * const text, - size_t textlen, size_t &newlen) { +int doAlignment(int max_width, int bevel, FbTk::Justify justify, + const FbTk::Font &font, const char * const text, + unsigned int textlen, unsigned int &newlen) { if (text == 0 || textlen == 0) return 0; int l = font.textWidth(text, textlen) + bevel; - size_t dlen = textlen; + unsigned int dlen = textlen; int dx = bevel; if (l > max_width) { for (; dlen > 0; dlen--) { @@ -51,14 +51,14 @@ int doAlignment(int max_width, int bevel, FbTk::Justify justify, switch (justify) { case FbTk::RIGHT: dx = max_width - l - bevel; - break; + break; case FbTk::CENTER: dx = (max_width - l)/2; - break; + break; case FbTk::LEFT: - break; + break; } - + return dx; } diff --git a/src/FbTk/Text.hh b/src/FbTk/Text.hh index f2b41620..494d365b 100644 --- a/src/FbTk/Text.hh +++ b/src/FbTk/Text.hh @@ -22,8 +22,6 @@ #ifndef FBTK_TEXT_HH #define FBTK_TEXT_HH -#include - namespace FbTk { class Font; @@ -37,7 +35,7 @@ enum Orientation { ROT0=0, ROT90, ROT180, ROT270 }; */ int doAlignment(int max_width, int bevel, FbTk::Justify justify, const FbTk::Font &font, const char * const text, - size_t textlen, size_t &newlen); + unsigned int textlen, unsigned int &newlen); /** There are 3 interesting translations: @@ -76,7 +74,7 @@ inline void translateCoords(Orientation orient, int &x, int &y, unsigned int w, } // still require w and h in ROT0 coords -inline void untranslateCoords(Orientation orient, int &orig_x, int &orig_y, unsigned int w, unsigned int h) { +inline void untranslateCoords(Orientation orient, int orig_x, int orig_y, unsigned int w, unsigned int h) { int x = orig_x; int y = orig_y; @@ -102,7 +100,7 @@ inline void untranslateCoords(Orientation orient, int &orig_x, int &orig_y, unsi // When positioning an X11 box inside another area, we need to // relocate the x,y coordinates -inline void translatePosition(Orientation orient, int &x, int &y, unsigned int w, unsigned int h, unsigned int bw) { +inline void translatePosition(Orientation orient, int x, int y, unsigned int w, unsigned int h, unsigned int bw) { switch(orient) { case ROT0: @@ -121,7 +119,7 @@ inline void translatePosition(Orientation orient, int &x, int &y, unsigned int w } -inline void translateSize(Orientation orient, unsigned int &w, unsigned int &h) { +inline void translateSize(Orientation orient, unsigned int w, unsigned int h) { if (orient == ROT0 || orient == ROT180) return; diff --git a/src/FbTk/TextButton.cc b/src/FbTk/TextButton.cc index 922eb74c..85ac5c85 100644 --- a/src/FbTk/TextButton.cc +++ b/src/FbTk/TextButton.cc @@ -150,7 +150,7 @@ void TextButton::renderForeground(FbWindow &win, FbDrawable &drawable) { } void TextButton::drawText(int x_offset, int y_offset, FbDrawable *drawable) { - size_t textlen = text().size(); + unsigned int textlen = text().size(); // do text alignment unsigned int textw = width(), texth = height(); diff --git a/src/FbTk/TextureRender.cc b/src/FbTk/TextureRender.cc index 3f35951e..c7c29c1b 100644 --- a/src/FbTk/TextureRender.cc +++ b/src/FbTk/TextureRender.cc @@ -25,6 +25,7 @@ #include "TextureRender.hh" #include "ImageControl.hh" +#include "Texture.hh" #include "App.hh" #include "FbPixmap.hh" #include "GContext.hh" diff --git a/util/fbsetroot.cc b/util/fbsetroot.cc index a859480e..2312e374 100644 --- a/util/fbsetroot.cc +++ b/util/fbsetroot.cc @@ -22,6 +22,7 @@ #include "../src/FbTk/I18n.hh" #include "../src/FbTk/ImageControl.hh" +#include "../src/FbTk/Texture.hh" #include "../src/FbTk/GContext.hh" #include "../src/FbRootWindow.hh" From f6c292a406f183a12b2e327716aad5de4c0abcca Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Tue, 15 Jan 2008 08:45:57 +0100 Subject: [PATCH 2/3] split Text.hh into Orientation.hh and TextUtils.{cc,hh} --- src/ClockTool.cc | 1 + src/FbTk/Button.hh | 2 +- src/FbTk/Container.cc | 32 +--------------------------- src/FbTk/Container.hh | 5 +---- src/FbTk/FbPixmap.cc | 1 + src/FbTk/FbPixmap.hh | 2 +- src/FbTk/Font.hh | 2 +- src/FbTk/FontImp.hh | 2 +- src/FbTk/ImageControl.hh | 2 +- src/FbTk/Makefile.am | 2 +- src/FbTk/MenuTheme.hh | 1 - src/FbTk/Orientation.hh | 34 ++++++++++++++++++++++++++++++ src/FbTk/TextButton.cc | 1 + src/FbTk/TextButton.hh | 1 - src/FbTk/TextTheme.hh | 2 +- src/FbTk/{Text.cc => TextUtils.cc} | 2 +- src/FbTk/{Text.hh => TextUtils.hh} | 14 ++++++------ src/FbTk/TextureRender.cc | 1 + src/FbTk/TextureRender.hh | 2 +- src/FbTk/XmbFontImp.cc | 1 + src/FbWinFrame.cc | 1 + src/IconButton.cc | 1 + src/SystemTray.cc | 1 + src/Toolbar.cc | 1 + src/ToolbarItem.hh | 2 +- 25 files changed, 61 insertions(+), 55 deletions(-) create mode 100644 src/FbTk/Orientation.hh rename src/FbTk/{Text.cc => TextUtils.cc} (99%) rename src/FbTk/{Text.hh => TextUtils.hh} (94%) diff --git a/src/ClockTool.cc b/src/ClockTool.cc index ae782661..1dd07cd7 100644 --- a/src/ClockTool.cc +++ b/src/ClockTool.cc @@ -30,6 +30,7 @@ #include "FbTk/SimpleCommand.hh" #include "FbTk/ImageControl.hh" +#include "FbTk/TextUtils.hh" #include "FbTk/Menu.hh" #include "FbTk/MenuItem.hh" #include "FbTk/I18n.hh" diff --git a/src/FbTk/Button.hh b/src/FbTk/Button.hh index bcf909b6..99d8ee91 100644 --- a/src/FbTk/Button.hh +++ b/src/FbTk/Button.hh @@ -28,7 +28,7 @@ #include "FbWindow.hh" #include "Command.hh" #include "Color.hh" -#include "Text.hh" +#include "Orientation.hh" namespace FbTk { diff --git a/src/FbTk/Container.cc b/src/FbTk/Container.cc index 9da25c6e..0c9b6ac6 100644 --- a/src/FbTk/Container.cc +++ b/src/FbTk/Container.cc @@ -23,6 +23,7 @@ #include "Container.hh" #include "Button.hh" +#include "TextUtils.hh" #include "EventManager.hh" #include "CompareEqual.hh" @@ -62,37 +63,6 @@ void Container::moveResize(int x, int y, repositionItems(); } -#ifdef NOT_USED -void Container::insertItems(ItemList &item_list, int pos) { - - // make sure all items have parent == this - ItemList::iterator it = m_item_list.begin(); - ItemList::iterator it_end = m_item_list.end(); - for (; it != it_end; ++it) { - if ((*it)->parent() != this) - return; - } - - if (pos > size() || pos < 0) { - // insert last - m_item_list.splice(m_item_list.end(), item_list); - } else if (pos == 0) { - // insert first - m_item_list.splice(m_item_list.begin(), item_list); - } else { - // find insert point - for (it = m_item_list.begin(); pos != 0; ++it, --pos) - continue; - m_item_list.splice(it, item_list); - } - - m_item_list.unique(); - - // update position - repositionItems(); -} -#endif - void Container::insertItem(Item item, int pos) { if (find(item) != -1) return; diff --git a/src/FbTk/Container.hh b/src/FbTk/Container.hh index 954f929f..d2b826c0 100644 --- a/src/FbTk/Container.hh +++ b/src/FbTk/Container.hh @@ -26,7 +26,7 @@ #include "FbWindow.hh" #include "EventHandler.hh" #include "NotCopyable.hh" -#include "Text.hh" // for Orientation +#include "Orientation.hh" #include @@ -52,9 +52,6 @@ public: void moveResize(int x, int y, unsigned int width, unsigned int height); -#ifdef NOT_USED - void insertItems(ItemList &list, int position=-1); -#endif void insertItem(Item item, int pos = -1); bool removeItem(int item); // return true if something was removed bool removeItem(Item item); // return true if something was removed diff --git a/src/FbTk/FbPixmap.cc b/src/FbTk/FbPixmap.cc index 9d90c5ae..7c1d6741 100644 --- a/src/FbTk/FbPixmap.cc +++ b/src/FbTk/FbPixmap.cc @@ -24,6 +24,7 @@ #include "GContext.hh" #include "Transparent.hh" #include "FbWindow.hh" +#include "TextUtils.hh" #include #include diff --git a/src/FbTk/FbPixmap.hh b/src/FbTk/FbPixmap.hh index 5c2e2b86..256f6b62 100644 --- a/src/FbTk/FbPixmap.hh +++ b/src/FbTk/FbPixmap.hh @@ -23,7 +23,7 @@ #define FBTK_FBPIXMAP_HH #include "FbDrawable.hh" -#include "Text.hh" // for Orientation +#include "Orientation.hh" namespace FbTk { diff --git a/src/FbTk/Font.hh b/src/FbTk/Font.hh index 8fb493e9..28bbf225 100644 --- a/src/FbTk/Font.hh +++ b/src/FbTk/Font.hh @@ -30,7 +30,7 @@ #include "FbString.hh" #include "Color.hh" -#include "Text.hh" +#include "Orientation.hh" namespace FbTk { diff --git a/src/FbTk/FontImp.hh b/src/FbTk/FontImp.hh index bdbab484..d903a4e1 100644 --- a/src/FbTk/FontImp.hh +++ b/src/FbTk/FontImp.hh @@ -22,7 +22,7 @@ #ifndef FBTK_FONTIMP_HH #define FBTK_FONTIMP_HH -#include "Text.hh" +#include "Orientation.hh" #include "FbString.hh" #include diff --git a/src/FbTk/ImageControl.hh b/src/FbTk/ImageControl.hh index 3c3cbb13..a8e18b78 100644 --- a/src/FbTk/ImageControl.hh +++ b/src/FbTk/ImageControl.hh @@ -25,7 +25,7 @@ #ifndef FBTK_IMAGECONTROL_HH #define FBTK_IMAGECONTROL_HH -#include "Text.hh" // actually, Text is rather tool like, that's where orientation comes from +#include "Orientation.hh" #include "Timer.hh" #include "NotCopyable.hh" diff --git a/src/FbTk/Makefile.am b/src/FbTk/Makefile.am index 0fdb155f..6fa874a8 100644 --- a/src/FbTk/Makefile.am +++ b/src/FbTk/Makefile.am @@ -30,7 +30,7 @@ libFbTk_a_SOURCES = App.hh App.cc Color.cc Color.hh Command.hh \ MenuTheme.hh MenuTheme.cc NotCopyable.hh \ BorderTheme.hh BorderTheme.cc TextTheme.hh TextTheme.cc \ RefCount.hh SimpleCommand.hh SignalHandler.cc SignalHandler.hh \ - Text.hh Text.cc \ + TextUtils.hh TextUtils.cc Orientation.hh \ Texture.cc Texture.hh TextureRender.hh TextureRender.cc \ Shape.hh Shape.cc \ Theme.hh Theme.cc ThemeItems.cc Timer.hh Timer.cc \ diff --git a/src/FbTk/MenuTheme.hh b/src/FbTk/MenuTheme.hh index 273104cc..70fc9b8f 100644 --- a/src/FbTk/MenuTheme.hh +++ b/src/FbTk/MenuTheme.hh @@ -27,7 +27,6 @@ #include "Font.hh" #include "Shape.hh" #include "Texture.hh" -#include "Text.hh" #include "PixmapWithMask.hh" #include "GContext.hh" diff --git a/src/FbTk/Orientation.hh b/src/FbTk/Orientation.hh new file mode 100644 index 00000000..bf6bd69f --- /dev/null +++ b/src/FbTk/Orientation.hh @@ -0,0 +1,34 @@ +// Orientation.hh for FbTk +// Copyright (c) 2008 Henrik Kinnunen (fluxgen at fluxbox dot org) +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// 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. + +#ifndef FBTK_ORIENTATION_HH +#define FBTK_ORIENTATION_HH + +namespace FbTk { + +enum Justify {LEFT, RIGHT, CENTER}; + +// clockwise +enum Orientation { ROT0=0, ROT90, ROT180, ROT270 }; + +} // end namespace FbTk + +#endif // FBTK_ORIENTATION_HH diff --git a/src/FbTk/TextButton.cc b/src/FbTk/TextButton.cc index 85ac5c85..5a7afa6a 100644 --- a/src/FbTk/TextButton.cc +++ b/src/FbTk/TextButton.cc @@ -20,6 +20,7 @@ // DEALINGS IN THE SOFTWARE. #include "TextButton.hh" +#include "TextUtils.hh" #include "Font.hh" #include "GContext.hh" diff --git a/src/FbTk/TextButton.hh b/src/FbTk/TextButton.hh index 50d509b8..eb48e61b 100644 --- a/src/FbTk/TextButton.hh +++ b/src/FbTk/TextButton.hh @@ -23,7 +23,6 @@ #define FBTK_TEXTBUTTON_HH #include "Button.hh" -#include "Text.hh" #include diff --git a/src/FbTk/TextTheme.hh b/src/FbTk/TextTheme.hh index 9a837889..02adf92c 100644 --- a/src/FbTk/TextTheme.hh +++ b/src/FbTk/TextTheme.hh @@ -26,7 +26,7 @@ #include "Theme.hh" #include "Font.hh" #include "Color.hh" -#include "Text.hh" +#include "Orientation.hh" #include "GContext.hh" namespace FbTk { diff --git a/src/FbTk/Text.cc b/src/FbTk/TextUtils.cc similarity index 99% rename from src/FbTk/Text.cc rename to src/FbTk/TextUtils.cc index 710b48aa..2b47531c 100644 --- a/src/FbTk/Text.cc +++ b/src/FbTk/TextUtils.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -#include "Text.hh" +#include "TextUtils.hh" #include "Font.hh" #include "Theme.hh" diff --git a/src/FbTk/Text.hh b/src/FbTk/TextUtils.hh similarity index 94% rename from src/FbTk/Text.hh rename to src/FbTk/TextUtils.hh index 494d365b..efb60204 100644 --- a/src/FbTk/Text.hh +++ b/src/FbTk/TextUtils.hh @@ -1,4 +1,4 @@ -// Text.hh for FbTk - text utils +// TextUtils.hh for FbTk - text utils // Copyright (c) 2002 - 2003 Henrik Kinnunen (fluxgen at fluxbox dot org) // // Permission is hereby granted, free of charge, to any person obtaining a @@ -19,17 +19,15 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -#ifndef FBTK_TEXT_HH -#define FBTK_TEXT_HH +#ifndef FBTK_TEXTUTILS_HH +#define FBTK_TEXTUTILS_HH + +#include "Orientation.hh" namespace FbTk { class Font; -enum Justify {LEFT, RIGHT, CENTER}; -// clockwise -enum Orientation { ROT0=0, ROT90, ROT180, ROT270 }; - /** Aligns the text after max width and bevel */ @@ -132,4 +130,4 @@ inline void translateSize(Orientation orient, unsigned int w, unsigned int h) { } // end namespace FbTk -#endif // FBTK_TEXT_HH +#endif // FBTK_TEXTUTILS_HH diff --git a/src/FbTk/TextureRender.cc b/src/FbTk/TextureRender.cc index c7c29c1b..a4bb50ce 100644 --- a/src/FbTk/TextureRender.cc +++ b/src/FbTk/TextureRender.cc @@ -25,6 +25,7 @@ #include "TextureRender.hh" #include "ImageControl.hh" +#include "TextUtils.hh" #include "Texture.hh" #include "App.hh" #include "FbPixmap.hh" diff --git a/src/FbTk/TextureRender.hh b/src/FbTk/TextureRender.hh index ab032525..cfedba56 100644 --- a/src/FbTk/TextureRender.hh +++ b/src/FbTk/TextureRender.hh @@ -25,7 +25,7 @@ #ifndef FBTK_TEXTURRENDER_HH #define FBTK_TEXTURRENDER_HH -#include "Text.hh" +#include "Orientation.hh" #include diff --git a/src/FbTk/XmbFontImp.cc b/src/FbTk/XmbFontImp.cc index 8ef0fbc7..e05609c2 100644 --- a/src/FbTk/XmbFontImp.cc +++ b/src/FbTk/XmbFontImp.cc @@ -22,6 +22,7 @@ #include "XmbFontImp.hh" #include "App.hh" +#include "TextUtils.hh" #include "StringUtil.hh" #include "FbPixmap.hh" #include "GContext.hh" diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index ea1236ac..234364e7 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc @@ -28,6 +28,7 @@ #include "FbTk/Compose.hh" #include "FbTk/Transparent.hh" #include "FbTk/CompareEqual.hh" +#include "FbTk/TextUtils.hh" #include "FbWinFrameTheme.hh" #include "Screen.hh" diff --git a/src/IconButton.cc b/src/IconButton.cc index 2df741a3..09791c8c 100644 --- a/src/IconButton.cc +++ b/src/IconButton.cc @@ -30,6 +30,7 @@ #include "FbTk/Command.hh" #include "FbTk/EventManager.hh" #include "FbTk/ImageControl.hh" +#include "FbTk/TextUtils.hh" #include "FbTk/MacroCommand.hh" #include "FbTk/Menu.hh" #include "FbTk/RefCount.hh" diff --git a/src/SystemTray.cc b/src/SystemTray.cc index 5ba89c3a..5aa7323a 100644 --- a/src/SystemTray.cc +++ b/src/SystemTray.cc @@ -23,6 +23,7 @@ #include "FbTk/EventManager.hh" #include "FbTk/ImageControl.hh" +#include "FbTk/TextUtils.hh" #include "AtomHandler.hh" #include "fluxbox.hh" diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 18f07fca..89ec898b 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -45,6 +45,7 @@ #include "FbTk/I18n.hh" #include "FbTk/ImageControl.hh" +#include "FbTk/TextUtils.hh" #include "FbTk/MacroCommand.hh" #include "FbTk/EventManager.hh" #include "FbTk/SimpleCommand.hh" diff --git a/src/ToolbarItem.hh b/src/ToolbarItem.hh index c4327b29..4a92c977 100644 --- a/src/ToolbarItem.hh +++ b/src/ToolbarItem.hh @@ -24,7 +24,7 @@ #define TOOLBARITEM_HH #include "FbTk/Subject.hh" -#include "FbTk/Text.hh" // orientation +#include "FbTk/Orientation.hh" /// An item in the toolbar that has either fixed or relative size to the toolbar class ToolbarItem { From 8c2cee577a744870fd497f73a21c2d4e1c45c907 Mon Sep 17 00:00:00 2001 From: Henrik Kinnunen Date: Tue, 15 Jan 2008 10:56:25 +0100 Subject: [PATCH 3/3] must initialize toolbar before the windows --- src/Screen.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Screen.cc b/src/Screen.cc index 578b0c79..6af65a95 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -629,6 +629,12 @@ bool BScreen::isRestart() { } void BScreen::initWindows() { + +#ifdef USE_TOOLBAR + m_toolbar.reset(new Toolbar(*this, + *layerManager().getLayer(::Layer::NORMAL))); +#endif // USE_TOOLBAR + unsigned int nchild; Window r, p, *children; Display *disp = FbTk::App::instance()->display(); @@ -726,11 +732,6 @@ void BScreen::initWindows() { slit()->show(); #endif // SLIT -#ifdef USE_TOOLBAR - m_toolbar.reset(new Toolbar(*this, - *layerManager().getLayer(::Layer::NORMAL))); -#endif // USE_TOOLBAR - } unsigned int BScreen::currentWorkspaceID() const {