Merge branch 'master' of fluxbox@gitfbox:fluxbox
This commit is contained in:
commit
1d4bea8a2d
28 changed files with 136 additions and 140 deletions
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#include "FbTk/SimpleCommand.hh"
|
#include "FbTk/SimpleCommand.hh"
|
||||||
#include "FbTk/ImageControl.hh"
|
#include "FbTk/ImageControl.hh"
|
||||||
|
#include "FbTk/TextUtils.hh"
|
||||||
#include "FbTk/Menu.hh"
|
#include "FbTk/Menu.hh"
|
||||||
#include "FbTk/MenuItem.hh"
|
#include "FbTk/MenuItem.hh"
|
||||||
#include "FbTk/I18n.hh"
|
#include "FbTk/I18n.hh"
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "FbWindow.hh"
|
#include "FbWindow.hh"
|
||||||
#include "Command.hh"
|
#include "Command.hh"
|
||||||
#include "Color.hh"
|
#include "Color.hh"
|
||||||
#include "Text.hh"
|
#include "Orientation.hh"
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "Container.hh"
|
#include "Container.hh"
|
||||||
|
|
||||||
#include "Button.hh"
|
#include "Button.hh"
|
||||||
|
#include "TextUtils.hh"
|
||||||
#include "EventManager.hh"
|
#include "EventManager.hh"
|
||||||
#include "CompareEqual.hh"
|
#include "CompareEqual.hh"
|
||||||
|
|
||||||
|
@ -62,37 +63,6 @@ void Container::moveResize(int x, int y,
|
||||||
repositionItems();
|
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) {
|
void Container::insertItem(Item item, int pos) {
|
||||||
if (find(item) != -1)
|
if (find(item) != -1)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "FbWindow.hh"
|
#include "FbWindow.hh"
|
||||||
#include "EventHandler.hh"
|
#include "EventHandler.hh"
|
||||||
#include "NotCopyable.hh"
|
#include "NotCopyable.hh"
|
||||||
#include "Text.hh" // for Orientation
|
#include "Orientation.hh"
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
|
@ -52,9 +52,6 @@ public:
|
||||||
void moveResize(int x, int y,
|
void moveResize(int x, int y,
|
||||||
unsigned int width, unsigned int height);
|
unsigned int width, unsigned int height);
|
||||||
|
|
||||||
#ifdef NOT_USED
|
|
||||||
void insertItems(ItemList &list, int position=-1);
|
|
||||||
#endif
|
|
||||||
void insertItem(Item item, int pos = -1);
|
void insertItem(Item item, int pos = -1);
|
||||||
bool removeItem(int item); // return true if something was removed
|
bool removeItem(int item); // return true if something was removed
|
||||||
bool removeItem(Item item); // return true if something was removed
|
bool removeItem(Item item); // return true if something was removed
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "GContext.hh"
|
#include "GContext.hh"
|
||||||
#include "Transparent.hh"
|
#include "Transparent.hh"
|
||||||
#include "FbWindow.hh"
|
#include "FbWindow.hh"
|
||||||
|
#include "TextUtils.hh"
|
||||||
|
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
@ -38,21 +39,34 @@ using std::cerr;
|
||||||
|
|
||||||
namespace FbTk {
|
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",
|
"_XROOTPMAP_ID",
|
||||||
"_XSETROOT_ID",
|
"_XSETROOT_ID",
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
// same number as in root_prop_ids
|
// same number as in root_prop_ids
|
||||||
Atom FbPixmap::root_prop_atoms[] = {
|
Atom root_prop_atoms[] = {
|
||||||
None,
|
None,
|
||||||
None,
|
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),
|
FbPixmap::FbPixmap():m_pm(0),
|
||||||
m_width(0), m_height(0),
|
m_width(0), m_height(0),
|
||||||
|
@ -389,14 +403,14 @@ bool FbPixmap::rootwinPropertyNotify(int screen_num, Atom atom) {
|
||||||
|
|
||||||
// returns whether or not the background was changed
|
// returns whether or not the background was changed
|
||||||
bool FbPixmap::setRootPixmap(int screen_num, Pixmap pm) {
|
bool FbPixmap::setRootPixmap(int screen_num, Pixmap pm) {
|
||||||
if (!m_root_pixmaps) {
|
if (!root_pixmaps) {
|
||||||
m_root_pixmaps = new Pixmap[ScreenCount(display())];
|
root_pixmaps = new Pixmap[ScreenCount(display())];
|
||||||
for (int i=0; i < ScreenCount(display()); ++i)
|
for (int i=0; i < ScreenCount(display()); ++i)
|
||||||
m_root_pixmaps[i] = None;
|
root_pixmaps[i] = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_root_pixmaps[screen_num] != pm) {
|
if (root_pixmaps[screen_num] != pm) {
|
||||||
m_root_pixmaps[screen_num] = pm;
|
root_pixmaps[screen_num] = pm;
|
||||||
FbWindow::updatedAlphaBackground(screen_num);
|
FbWindow::updatedAlphaBackground(screen_num);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -410,8 +424,8 @@ Pixmap FbPixmap::getRootPixmap(int screen_num, bool force_update) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// check and see if if we have the pixmaps in cache
|
// check and see if if we have the pixmaps in cache
|
||||||
if (m_root_pixmaps && !force_update)
|
if (root_pixmaps && !force_update)
|
||||||
return m_root_pixmaps[screen_num];
|
return root_pixmaps[screen_num];
|
||||||
|
|
||||||
// else setup pixmap cache
|
// else setup pixmap cache
|
||||||
int numscreens = ScreenCount(display());
|
int numscreens = ScreenCount(display());
|
||||||
|
@ -460,15 +474,7 @@ Pixmap FbPixmap::getRootPixmap(int screen_num, bool force_update) {
|
||||||
setRootPixmap(i, root_pm);
|
setRootPixmap(i, root_pm);
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_root_pixmaps[screen_num];
|
return 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FbPixmap::free() {
|
void FbPixmap::free() {
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#define FBTK_FBPIXMAP_HH
|
#define FBTK_FBPIXMAP_HH
|
||||||
|
|
||||||
#include "FbDrawable.hh"
|
#include "FbDrawable.hh"
|
||||||
#include "Text.hh"
|
#include "Orientation.hh"
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
|
|
||||||
|
@ -86,13 +86,6 @@ private:
|
||||||
// if pixmap not *owned* by this object (eg assigned from cache object)
|
// if pixmap not *owned* by this object (eg assigned from cache object)
|
||||||
bool m_dont_free;
|
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
|
} // end namespace FbTk
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
#include "FbString.hh"
|
#include "FbString.hh"
|
||||||
#include "Color.hh"
|
#include "Color.hh"
|
||||||
#include "Text.hh"
|
#include "Orientation.hh"
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#ifndef FBTK_FONTIMP_HH
|
#ifndef FBTK_FONTIMP_HH
|
||||||
#define FBTK_FONTIMP_HH
|
#define FBTK_FONTIMP_HH
|
||||||
|
|
||||||
#include "Text.hh"
|
#include "Orientation.hh"
|
||||||
#include "FbString.hh"
|
#include "FbString.hh"
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "ImageControl.hh"
|
#include "ImageControl.hh"
|
||||||
|
|
||||||
#include "TextureRender.hh"
|
#include "TextureRender.hh"
|
||||||
|
#include "Texture.hh"
|
||||||
#include "App.hh"
|
#include "App.hh"
|
||||||
#include "SimpleCommand.hh"
|
#include "SimpleCommand.hh"
|
||||||
#include "I18n.hh"
|
#include "I18n.hh"
|
||||||
|
@ -67,15 +68,17 @@ using std::list;
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
|
|
||||||
// lookup table for texture
|
namespace { // anonymous
|
||||||
unsigned long *ImageControl::sqrt_table = 0;
|
|
||||||
|
static unsigned long *sqrt_table = 0; /// lookup table
|
||||||
|
|
||||||
#ifdef TIMEDCACHE
|
#ifdef TIMEDCACHE
|
||||||
bool ImageControl::s_timed_cache = true;
|
bool s_timed_cache = true;
|
||||||
#else
|
#else
|
||||||
bool ImageControl::s_timed_cache = false;
|
bool s_timed_cache = false;
|
||||||
#endif // TIMEDCACHE
|
#endif // TIMEDCACHE
|
||||||
|
|
||||||
namespace { // anonymous
|
|
||||||
|
|
||||||
inline unsigned long bsqrt(unsigned long x) {
|
inline unsigned long bsqrt(unsigned long x) {
|
||||||
if (x <= 0) return 0;
|
if (x <= 0) return 0;
|
||||||
|
@ -93,6 +96,14 @@ inline unsigned long bsqrt(unsigned long x) {
|
||||||
|
|
||||||
}; // end anonymous namespace
|
}; // 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,
|
ImageControl::ImageControl(int screen_num, bool dither,
|
||||||
int cpc, unsigned long cache_timeout, unsigned long cmax):
|
int cpc, unsigned long cache_timeout, unsigned long cmax):
|
||||||
m_dither(dither),
|
m_dither(dither),
|
||||||
|
@ -148,7 +159,7 @@ ImageControl::~ImageControl() {
|
||||||
delete [] m_colors;
|
delete [] m_colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cache.size() > 0) {
|
if (!cache.empty()) {
|
||||||
CacheList::iterator it = cache.begin();
|
CacheList::iterator it = cache.begin();
|
||||||
CacheList::iterator it_end = cache.end();
|
CacheList::iterator it_end = cache.end();
|
||||||
for (; it != it_end; ++it) {
|
for (; it != it_end; ++it) {
|
||||||
|
|
|
@ -25,16 +25,17 @@
|
||||||
#ifndef FBTK_IMAGECONTROL_HH
|
#ifndef FBTK_IMAGECONTROL_HH
|
||||||
#define FBTK_IMAGECONTROL_HH
|
#define FBTK_IMAGECONTROL_HH
|
||||||
|
|
||||||
// actually, Text is rather tool like, that's where orientation comes from
|
#include "Orientation.hh"
|
||||||
#include "Text.hh"
|
|
||||||
#include "Texture.hh"
|
|
||||||
#include "Timer.hh"
|
#include "Timer.hh"
|
||||||
#include "NotCopyable.hh"
|
#include "NotCopyable.hh"
|
||||||
|
|
||||||
|
#include <X11/Xlib.h> // for Visual* etc
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
|
|
||||||
|
class Texture;
|
||||||
|
|
||||||
/// Holds screen info, color tables and caches textures
|
/// Holds screen info, color tables and caches textures
|
||||||
class ImageControl: private NotCopyable {
|
class ImageControl: private NotCopyable {
|
||||||
public:
|
public:
|
||||||
|
@ -103,39 +104,18 @@ private:
|
||||||
int m_colors_per_channel; ///< number of colors per channel
|
int m_colors_per_channel; ///< number of colors per channel
|
||||||
int m_screen_depth; ///< bit depth of screen
|
int m_screen_depth; ///< bit depth of screen
|
||||||
int m_screen_num; ///< screen number
|
int m_screen_num; ///< screen number
|
||||||
unsigned char red_color_table[256], green_color_table[256],
|
unsigned char red_color_table[256];
|
||||||
blue_color_table[256];
|
unsigned char green_color_table[256];
|
||||||
|
unsigned char blue_color_table[256];
|
||||||
|
|
||||||
unsigned int *grad_xbuffer, *grad_ybuffer, grad_buffer_width,
|
unsigned int *grad_xbuffer, *grad_ybuffer, grad_buffer_width,
|
||||||
grad_buffer_height;
|
grad_buffer_height;
|
||||||
|
|
||||||
static unsigned long *sqrt_table; /// sqrt lookup table
|
struct Cache;
|
||||||
|
|
||||||
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;
|
|
||||||
typedef std::list<Cache *> CacheList;
|
typedef std::list<Cache *> CacheList;
|
||||||
|
|
||||||
mutable CacheList cache;
|
mutable CacheList cache;
|
||||||
static bool s_timed_cache;
|
unsigned long cache_max;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace FbTk
|
} // end namespace FbTk
|
||||||
|
|
|
@ -30,7 +30,7 @@ libFbTk_a_SOURCES = App.hh App.cc Color.cc Color.hh Command.hh \
|
||||||
MenuTheme.hh MenuTheme.cc NotCopyable.hh \
|
MenuTheme.hh MenuTheme.cc NotCopyable.hh \
|
||||||
BorderTheme.hh BorderTheme.cc TextTheme.hh TextTheme.cc \
|
BorderTheme.hh BorderTheme.cc TextTheme.hh TextTheme.cc \
|
||||||
RefCount.hh SimpleCommand.hh SignalHandler.cc SignalHandler.hh \
|
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 \
|
Texture.cc Texture.hh TextureRender.hh TextureRender.cc \
|
||||||
Shape.hh Shape.cc \
|
Shape.hh Shape.cc \
|
||||||
Theme.hh Theme.cc ThemeItems.cc Timer.hh Timer.cc \
|
Theme.hh Theme.cc ThemeItems.cc Timer.hh Timer.cc \
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include "Font.hh"
|
#include "Font.hh"
|
||||||
#include "Shape.hh"
|
#include "Shape.hh"
|
||||||
#include "Texture.hh"
|
#include "Texture.hh"
|
||||||
#include "Text.hh"
|
|
||||||
#include "PixmapWithMask.hh"
|
#include "PixmapWithMask.hh"
|
||||||
#include "GContext.hh"
|
#include "GContext.hh"
|
||||||
|
|
||||||
|
|
34
src/FbTk/Orientation.hh
Normal file
34
src/FbTk/Orientation.hh
Normal file
|
@ -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
|
|
@ -20,6 +20,7 @@
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include "TextButton.hh"
|
#include "TextButton.hh"
|
||||||
|
#include "TextUtils.hh"
|
||||||
#include "Font.hh"
|
#include "Font.hh"
|
||||||
#include "GContext.hh"
|
#include "GContext.hh"
|
||||||
|
|
||||||
|
@ -150,7 +151,7 @@ void TextButton::renderForeground(FbWindow &win, FbDrawable &drawable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextButton::drawText(int x_offset, int y_offset, 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
|
// do text alignment
|
||||||
|
|
||||||
unsigned int textw = width(), texth = height();
|
unsigned int textw = width(), texth = height();
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#define FBTK_TEXTBUTTON_HH
|
#define FBTK_TEXTBUTTON_HH
|
||||||
|
|
||||||
#include "Button.hh"
|
#include "Button.hh"
|
||||||
#include "Text.hh"
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "Theme.hh"
|
#include "Theme.hh"
|
||||||
#include "Font.hh"
|
#include "Font.hh"
|
||||||
#include "Color.hh"
|
#include "Color.hh"
|
||||||
#include "Text.hh"
|
#include "Orientation.hh"
|
||||||
#include "GContext.hh"
|
#include "GContext.hh"
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include "Text.hh"
|
#include "TextUtils.hh"
|
||||||
|
|
||||||
#include "Font.hh"
|
#include "Font.hh"
|
||||||
#include "Theme.hh"
|
#include "Theme.hh"
|
||||||
|
@ -30,13 +30,13 @@ namespace FbTk {
|
||||||
|
|
||||||
int doAlignment(int max_width, int bevel, FbTk::Justify justify,
|
int doAlignment(int max_width, int bevel, FbTk::Justify justify,
|
||||||
const FbTk::Font &font, const char * const text,
|
const FbTk::Font &font, const char * const text,
|
||||||
size_t textlen, size_t &newlen) {
|
unsigned int textlen, unsigned int &newlen) {
|
||||||
|
|
||||||
if (text == 0 || textlen == 0)
|
if (text == 0 || textlen == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int l = font.textWidth(text, textlen) + bevel;
|
int l = font.textWidth(text, textlen) + bevel;
|
||||||
size_t dlen = textlen;
|
unsigned int dlen = textlen;
|
||||||
int dx = bevel;
|
int dx = bevel;
|
||||||
if (l > max_width) {
|
if (l > max_width) {
|
||||||
for (; dlen > 0; dlen--) {
|
for (; dlen > 0; dlen--) {
|
|
@ -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)
|
// Copyright (c) 2002 - 2003 Henrik Kinnunen (fluxgen at fluxbox dot org)
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
@ -19,25 +19,21 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#ifndef FBTK_TEXT_HH
|
#ifndef FBTK_TEXTUTILS_HH
|
||||||
#define FBTK_TEXT_HH
|
#define FBTK_TEXTUTILS_HH
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include "Orientation.hh"
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
|
|
||||||
class Font;
|
class Font;
|
||||||
|
|
||||||
enum Justify {LEFT, RIGHT, CENTER};
|
|
||||||
// clockwise
|
|
||||||
enum Orientation { ROT0=0, ROT90, ROT180, ROT270 };
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Aligns the text after max width and bevel
|
Aligns the text after max width and bevel
|
||||||
*/
|
*/
|
||||||
int doAlignment(int max_width, int bevel, FbTk::Justify justify,
|
int doAlignment(int max_width, int bevel, FbTk::Justify justify,
|
||||||
const FbTk::Font &font, const char * const text,
|
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:
|
There are 3 interesting translations:
|
||||||
|
@ -76,7 +72,7 @@ inline void translateCoords(Orientation orient, int &x, int &y, unsigned int w,
|
||||||
}
|
}
|
||||||
|
|
||||||
// still require w and h in ROT0 coords
|
// 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 x = orig_x;
|
||||||
int y = orig_y;
|
int y = orig_y;
|
||||||
|
@ -102,7 +98,7 @@ inline void untranslateCoords(Orientation orient, int &orig_x, int &orig_y, unsi
|
||||||
|
|
||||||
// When positioning an X11 box inside another area, we need to
|
// When positioning an X11 box inside another area, we need to
|
||||||
// relocate the x,y coordinates
|
// 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) {
|
switch(orient) {
|
||||||
case ROT0:
|
case ROT0:
|
||||||
|
@ -121,7 +117,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)
|
if (orient == ROT0 || orient == ROT180)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -134,4 +130,4 @@ inline void translateSize(Orientation orient, unsigned int &w, unsigned int &h)
|
||||||
|
|
||||||
} // end namespace FbTk
|
} // end namespace FbTk
|
||||||
|
|
||||||
#endif // FBTK_TEXT_HH
|
#endif // FBTK_TEXTUTILS_HH
|
|
@ -25,6 +25,8 @@
|
||||||
#include "TextureRender.hh"
|
#include "TextureRender.hh"
|
||||||
|
|
||||||
#include "ImageControl.hh"
|
#include "ImageControl.hh"
|
||||||
|
#include "TextUtils.hh"
|
||||||
|
#include "Texture.hh"
|
||||||
#include "App.hh"
|
#include "App.hh"
|
||||||
#include "FbPixmap.hh"
|
#include "FbPixmap.hh"
|
||||||
#include "GContext.hh"
|
#include "GContext.hh"
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#ifndef FBTK_TEXTURRENDER_HH
|
#ifndef FBTK_TEXTURRENDER_HH
|
||||||
#define FBTK_TEXTURRENDER_HH
|
#define FBTK_TEXTURRENDER_HH
|
||||||
|
|
||||||
#include "Text.hh"
|
#include "Orientation.hh"
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "XmbFontImp.hh"
|
#include "XmbFontImp.hh"
|
||||||
|
|
||||||
#include "App.hh"
|
#include "App.hh"
|
||||||
|
#include "TextUtils.hh"
|
||||||
#include "StringUtil.hh"
|
#include "StringUtil.hh"
|
||||||
#include "FbPixmap.hh"
|
#include "FbPixmap.hh"
|
||||||
#include "GContext.hh"
|
#include "GContext.hh"
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "FbTk/Compose.hh"
|
#include "FbTk/Compose.hh"
|
||||||
#include "FbTk/Transparent.hh"
|
#include "FbTk/Transparent.hh"
|
||||||
#include "FbTk/CompareEqual.hh"
|
#include "FbTk/CompareEqual.hh"
|
||||||
|
#include "FbTk/TextUtils.hh"
|
||||||
|
|
||||||
#include "FbWinFrameTheme.hh"
|
#include "FbWinFrameTheme.hh"
|
||||||
#include "Screen.hh"
|
#include "Screen.hh"
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "FbTk/Command.hh"
|
#include "FbTk/Command.hh"
|
||||||
#include "FbTk/EventManager.hh"
|
#include "FbTk/EventManager.hh"
|
||||||
#include "FbTk/ImageControl.hh"
|
#include "FbTk/ImageControl.hh"
|
||||||
|
#include "FbTk/TextUtils.hh"
|
||||||
#include "FbTk/MacroCommand.hh"
|
#include "FbTk/MacroCommand.hh"
|
||||||
#include "FbTk/Menu.hh"
|
#include "FbTk/Menu.hh"
|
||||||
#include "FbTk/RefCount.hh"
|
#include "FbTk/RefCount.hh"
|
||||||
|
|
|
@ -629,6 +629,12 @@ bool BScreen::isRestart() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BScreen::initWindows() {
|
void BScreen::initWindows() {
|
||||||
|
|
||||||
|
#ifdef USE_TOOLBAR
|
||||||
|
m_toolbar.reset(new Toolbar(*this,
|
||||||
|
*layerManager().getLayer(::Layer::NORMAL)));
|
||||||
|
#endif // USE_TOOLBAR
|
||||||
|
|
||||||
unsigned int nchild;
|
unsigned int nchild;
|
||||||
Window r, p, *children;
|
Window r, p, *children;
|
||||||
Display *disp = FbTk::App::instance()->display();
|
Display *disp = FbTk::App::instance()->display();
|
||||||
|
@ -726,11 +732,6 @@ void BScreen::initWindows() {
|
||||||
slit()->show();
|
slit()->show();
|
||||||
#endif // SLIT
|
#endif // SLIT
|
||||||
|
|
||||||
#ifdef USE_TOOLBAR
|
|
||||||
m_toolbar.reset(new Toolbar(*this,
|
|
||||||
*layerManager().getLayer(::Layer::NORMAL)));
|
|
||||||
#endif // USE_TOOLBAR
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int BScreen::currentWorkspaceID() const {
|
unsigned int BScreen::currentWorkspaceID() const {
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include "FbTk/EventManager.hh"
|
#include "FbTk/EventManager.hh"
|
||||||
#include "FbTk/ImageControl.hh"
|
#include "FbTk/ImageControl.hh"
|
||||||
|
#include "FbTk/TextUtils.hh"
|
||||||
|
|
||||||
#include "AtomHandler.hh"
|
#include "AtomHandler.hh"
|
||||||
#include "fluxbox.hh"
|
#include "fluxbox.hh"
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
|
|
||||||
#include "FbTk/I18n.hh"
|
#include "FbTk/I18n.hh"
|
||||||
#include "FbTk/ImageControl.hh"
|
#include "FbTk/ImageControl.hh"
|
||||||
|
#include "FbTk/TextUtils.hh"
|
||||||
#include "FbTk/MacroCommand.hh"
|
#include "FbTk/MacroCommand.hh"
|
||||||
#include "FbTk/EventManager.hh"
|
#include "FbTk/EventManager.hh"
|
||||||
#include "FbTk/SimpleCommand.hh"
|
#include "FbTk/SimpleCommand.hh"
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#define TOOLBARITEM_HH
|
#define TOOLBARITEM_HH
|
||||||
|
|
||||||
#include "FbTk/Subject.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
|
/// An item in the toolbar that has either fixed or relative size to the toolbar
|
||||||
class ToolbarItem {
|
class ToolbarItem {
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "../src/FbTk/I18n.hh"
|
#include "../src/FbTk/I18n.hh"
|
||||||
#include "../src/FbTk/ImageControl.hh"
|
#include "../src/FbTk/ImageControl.hh"
|
||||||
|
#include "../src/FbTk/Texture.hh"
|
||||||
#include "../src/FbTk/GContext.hh"
|
#include "../src/FbTk/GContext.hh"
|
||||||
#include "../src/FbRootWindow.hh"
|
#include "../src/FbRootWindow.hh"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue