aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Basemenu.cc64
-rw-r--r--src/Theme.cc54
-rw-r--r--src/Theme.hh6
3 files changed, 51 insertions, 73 deletions
diff --git a/src/Basemenu.cc b/src/Basemenu.cc
index 354f4e6..46a5735 100644
--- a/src/Basemenu.cc
+++ b/src/Basemenu.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Basemenu.cc,v 1.22 2002/04/28 15:54:59 fluxgen Exp $ 25// $Id: Basemenu.cc,v 1.23 2002/05/15 09:35:49 fluxgen Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -95,12 +95,12 @@ m_alignment(ALIGNDONTCARE) {
95 95
96 if (i18n->multibyte()) { 96 if (i18n->multibyte()) {
97 menu.width = menu.title_h = menu.item_w = menu.frame_h = 97 menu.width = menu.title_h = menu.item_w = menu.frame_h =
98 m_screen->getMenuStyle()->titlefont->getFontSetExtents()->max_ink_extent.height + 98 m_screen->getMenuStyle()->titlefont.getFontSetExtents()->max_ink_extent.height +
99 (menu.bevel_w * 2); 99 (menu.bevel_w * 2);
100 } else { 100 } else {
101 menu.width = menu.title_h = menu.item_w = menu.frame_h = 101 menu.width = menu.title_h = menu.item_w = menu.frame_h =
102 m_screen->getMenuStyle()->titlefont->getFontStruct()->ascent + 102 m_screen->getMenuStyle()->titlefont.getFontStruct()->ascent +
103 m_screen->getMenuStyle()->titlefont->getFontStruct()->descent + 103 m_screen->getMenuStyle()->titlefont.getFontStruct()->descent +
104 (menu.bevel_w * 2); 104 (menu.bevel_w * 2);
105 } 105 }
106 106
@@ -109,11 +109,11 @@ m_alignment(ALIGNDONTCARE) {
109 menu.minsub = 0; 109 menu.minsub = 0;
110 110
111 if (i18n->multibyte()) { 111 if (i18n->multibyte()) {
112 menu.item_h = m_screen->getMenuStyle()->framefont->getFontSetExtents()->max_ink_extent.height + 112 menu.item_h = m_screen->getMenuStyle()->framefont.getFontSetExtents()->max_ink_extent.height +
113 (menu.bevel_w); 113 (menu.bevel_w);
114 } else { 114 } else {
115 menu.item_h = m_screen->getMenuStyle()->framefont->getFontStruct()->ascent + 115 menu.item_h = m_screen->getMenuStyle()->framefont.getFontStruct()->ascent +
116 m_screen->getMenuStyle()->framefont->getFontStruct()->descent + 116 m_screen->getMenuStyle()->framefont.getFontStruct()->descent +
117 (menu.bevel_w); 117 (menu.bevel_w);
118 } 118 }
119 menu.height = menu.title_h + m_screen->getBorderWidth() + menu.frame_h; 119 menu.height = menu.title_h + m_screen->getBorderWidth() + menu.frame_h;
@@ -260,16 +260,16 @@ void Basemenu::update(void) {
260 I18n *i18n = I18n::instance(); 260 I18n *i18n = I18n::instance();
261 261
262 if (i18n->multibyte()) { 262 if (i18n->multibyte()) {
263 menu.item_h = m_screen->getMenuStyle()->framefont->getFontSetExtents()->max_ink_extent.height + 263 menu.item_h = m_screen->getMenuStyle()->framefont.getFontSetExtents()->max_ink_extent.height +
264 menu.bevel_w; 264 menu.bevel_w;
265 menu.title_h = m_screen->getMenuStyle()->titlefont->getFontSetExtents()->max_ink_extent.height + 265 menu.title_h = m_screen->getMenuStyle()->titlefont.getFontSetExtents()->max_ink_extent.height +
266 (menu.bevel_w * 2); 266 (menu.bevel_w * 2);
267 } else { 267 } else {
268 menu.item_h = m_screen->getMenuStyle()->framefont->getFontStruct()->ascent + 268 menu.item_h = m_screen->getMenuStyle()->framefont.getFontStruct()->ascent +
269 m_screen->getMenuStyle()->framefont->getFontStruct()->descent + 269 m_screen->getMenuStyle()->framefont.getFontStruct()->descent +
270 menu.bevel_w; 270 menu.bevel_w;
271 menu.title_h = m_screen->getMenuStyle()->titlefont->getFontStruct()->ascent + 271 menu.title_h = m_screen->getMenuStyle()->titlefont.getFontStruct()->ascent +
272 m_screen->getMenuStyle()->titlefont->getFontStruct()->descent + 272 m_screen->getMenuStyle()->titlefont.getFontStruct()->descent +
273 (menu.bevel_w * 2); 273 (menu.bevel_w * 2);
274 } 274 }
275 275
@@ -279,14 +279,15 @@ void Basemenu::update(void) {
279 FBNLS::BasemenuSet, FBNLS::BasemenuBlackboxMenu, 279 FBNLS::BasemenuSet, FBNLS::BasemenuBlackboxMenu,
280 "fluxbox Menu"); 280 "fluxbox Menu");
281 int l = strlen(s); 281 int l = strlen(s);
282 282
283 283 /*
284 if (i18n->multibyte()) { 284 if (i18n->multibyte()) {
285 XRectangle ink, logical; 285 XRectangle ink, logical;
286 XmbTextExtents(m_screen->getMenuStyle()->titlefont->getFontSet(), s, l, &ink, &logical); 286 XmbTextExtents(m_screen->getMenuStyle()->titlefont.getFontSet(), s, l, &ink, &logical);
287 menu.item_w = logical.width; 287 menu.item_w = logical.width;
288 } else 288 } else*/
289 menu.item_w = XTextWidth(m_screen->getMenuStyle()->titlefont->getFontStruct(), s, l); 289 menu.item_w = m_screen->getMenuStyle()->titlefont.getTextWidth(s, l);
290 //XTextWidth(m_screen->getMenuStyle()->titlefont.getFontStruct(), s, l);
290 291
291 menu.item_w += (menu.bevel_w * 2); 292 menu.item_w += (menu.bevel_w * 2);
292 } else 293 } else
@@ -301,12 +302,15 @@ void Basemenu::update(void) {
301 const char *s = itmp->label().c_str(); 302 const char *s = itmp->label().c_str();
302 int l = itmp->label().size(); 303 int l = itmp->label().size();
303 304
304 if (i18n->multibyte()) { 305 /*if (i18n->multibyte()) {
305 XRectangle ink, logical; 306 XRectangle ink, logical;
306 XmbTextExtents(m_screen->getMenuStyle()->framefont->getFontSet(), s, l, &ink, &logical); 307 XmbTextExtents(m_screen->getMenuStyle()->framefont.getFontSet(), s, l, &ink, &logical);
307 ii = logical.width; 308 ii = logical.width;
308 } else 309 } else
309 ii = XTextWidth(m_screen->getMenuStyle()->framefont->getFontStruct(), s, l); 310 ii = XTextWidth(m_screen->getMenuStyle()->framefont.getFontStruct(), s, l);
311 */
312 ii = screen()->getMenuStyle()->framefont.getTextWidth(s, l);
313
310 314
311 ii += (menu.bevel_w * 2) + (menu.item_h * 2); 315 ii += (menu.bevel_w * 2) + (menu.item_h * 2);
312 316
@@ -485,7 +489,7 @@ void Basemenu::redrawTitle(void) {
485 int dx = menu.bevel_w, len = strlen(text); 489 int dx = menu.bevel_w, len = strlen(text);
486 unsigned int l; 490 unsigned int l;
487 491
488 l = m_screen->getMenuStyle()->titlefont->getTextWidth(text, len); 492 l = m_screen->getMenuStyle()->titlefont.getTextWidth(text, len);
489 493
490 l += (menu.bevel_w * 2); 494 l += (menu.bevel_w * 2);
491 495
@@ -503,13 +507,13 @@ void Basemenu::redrawTitle(void) {
503 } 507 }
504 508
505 if (i18n->multibyte()) 509 if (i18n->multibyte())
506 XmbDrawString(m_display, menu.title, m_screen->getMenuStyle()->titlefont->getFontSet(), 510 XmbDrawString(m_display, menu.title, m_screen->getMenuStyle()->titlefont.getFontSet(),
507 m_screen->getMenuStyle()->t_text_gc, dx, menu.bevel_w - 511 m_screen->getMenuStyle()->t_text_gc, dx, menu.bevel_w -
508 m_screen->getMenuStyle()->titlefont->getFontSetExtents()->max_ink_extent.y, 512 m_screen->getMenuStyle()->titlefont.getFontSetExtents()->max_ink_extent.y,
509 text, len); 513 text, len);
510 else 514 else
511 XDrawString(m_display, menu.title, m_screen->getMenuStyle()->t_text_gc, dx, 515 XDrawString(m_display, menu.title, m_screen->getMenuStyle()->t_text_gc, dx,
512 m_screen->getMenuStyle()->titlefont->getFontStruct()->ascent + menu.bevel_w, 516 m_screen->getMenuStyle()->titlefont.getFontStruct()->ascent + menu.bevel_w,
513 text, len); 517 text, len);
514} 518}
515 519
@@ -654,14 +658,14 @@ void Basemenu::drawItem(unsigned int index, bool highlight, bool clear,
654 I18n *i18n = I18n::instance(); 658 I18n *i18n = I18n::instance();
655 659
656 if (text) { 660 if (text) {
657 text_w = m_screen->getMenuStyle()->framefont->getTextWidth(text, len); 661 text_w = m_screen->getMenuStyle()->framefont.getTextWidth(text, len);
658 662
659 if (m_screen->getMenuStyle()->framefont->multibyte()) { 663 if (m_screen->getMenuStyle()->framefont.multibyte()) {
660 text_y = item_y + (menu.bevel_w / 2) - 664 text_y = item_y + (menu.bevel_w / 2) -
661 m_screen->getMenuStyle()->framefont->getFontSetExtents()->max_ink_extent.y; 665 m_screen->getMenuStyle()->framefont.getFontSetExtents()->max_ink_extent.y;
662 } else { 666 } else {
663 text_y = item_y + 667 text_y = item_y +
664 m_screen->getMenuStyle()->framefont->getFontStruct()->ascent + 668 m_screen->getMenuStyle()->framefont.getFontStruct()->ascent +
665 (menu.bevel_w / 2); 669 (menu.bevel_w / 2);
666 } 670 }
667 671
@@ -753,7 +757,7 @@ void Basemenu::drawItem(unsigned int index, bool highlight, bool clear,
753 757
754 if (dotext && text) { 758 if (dotext && text) {
755 if (i18n->multibyte()) { 759 if (i18n->multibyte()) {
756 XmbDrawString(m_display, menu.frame, m_screen->getMenuStyle()->framefont->getFontSet(), 760 XmbDrawString(m_display, menu.frame, m_screen->getMenuStyle()->framefont.getFontSet(),
757 tgc, text_x, text_y, text, len); 761 tgc, text_x, text_y, text, len);
758 } else 762 } else
759 XDrawString(m_display, menu.frame, tgc, text_x, text_y, text, len); 763 XDrawString(m_display, menu.frame, tgc, text_x, text_y, text, len);
diff --git a/src/Theme.cc b/src/Theme.cc
index 71a1b68..d0674f5 100644
--- a/src/Theme.cc
+++ b/src/Theme.cc
@@ -41,7 +41,7 @@
41// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 41// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
42// DEALINGS IN THE SOFTWARE. 42// DEALINGS IN THE SOFTWARE.
43 43
44// $Id: Theme.cc,v 1.20 2002/04/20 10:33:10 fluxgen Exp $ 44// $Id: Theme.cc,v 1.21 2002/05/15 09:35:49 fluxgen Exp $
45 45
46#ifndef _GNU_SOURCE 46#ifndef _GNU_SOURCE
47#define _GNU_SOURCE 47#define _GNU_SOURCE
@@ -71,6 +71,7 @@ using namespace std;
71 71
72Theme::Theme(Display *display, Window rootwindow, Colormap colormap, 72Theme::Theme(Display *display, Window rootwindow, Colormap colormap,
73 int screennum, BImageControl *ic, const char *filename, const char *rootcommand): 73 int screennum, BImageControl *ic, const char *filename, const char *rootcommand):
74m_menustyle(display),
74m_imagecontrol(ic), 75m_imagecontrol(ic),
75m_display(display), 76m_display(display),
76m_colormap(colormap), 77m_colormap(colormap),
@@ -81,8 +82,7 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe
81 cerr<<__FILE__<<"("<<__LINE__<<"): Creating."<<endl; 82 cerr<<__FILE__<<"("<<__LINE__<<"): Creating."<<endl;
82 #endif //DEBUG 83 #endif //DEBUG
83 //default settings 84 //default settings
84 m_menustyle.titlefont = new FbTk::Font(m_display, "fixed"); //create with default font 85
85 m_menustyle.framefont = new FbTk::Font(m_display, "fixed");
86 m_windowstyle.font.set = m_toolbarstyle.font.set = m_windowstyle.tab.font.set = 0; 86 m_windowstyle.font.set = m_toolbarstyle.font.set = m_windowstyle.tab.font.set = 0;
87 87
88 m_toolbarstyle.font.fontstruct = m_windowstyle.font.fontstruct = m_windowstyle.tab.font.fontstruct = 0; 88 m_toolbarstyle.font.fontstruct = m_windowstyle.font.fontstruct = m_windowstyle.tab.font.fontstruct = 0;
@@ -147,15 +147,15 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe
147 GCForeground, &gcv); 147 GCForeground, &gcv);
148 148
149 gcv.foreground = m_menustyle.t_text.getPixel(); 149 gcv.foreground = m_menustyle.t_text.getPixel();
150 if (m_menustyle.titlefont->getFontStruct()) 150 if (m_menustyle.titlefont.getFontStruct())
151 gcv.font = m_menustyle.titlefont->getFontStruct()->fid; 151 gcv.font = m_menustyle.titlefont.getFontStruct()->fid;
152 m_menustyle.t_text_gc = 152 m_menustyle.t_text_gc =
153 XCreateGC(m_display, rootwindow, 153 XCreateGC(m_display, rootwindow,
154 gc_value_mask, &gcv); 154 gc_value_mask, &gcv);
155 155
156 gcv.foreground = m_menustyle.f_text.getPixel(); 156 gcv.foreground = m_menustyle.f_text.getPixel();
157 if (m_menustyle.framefont->getFontStruct()) 157 if (m_menustyle.framefont.getFontStruct())
158 gcv.font = m_menustyle.framefont->getFontStruct()->fid; 158 gcv.font = m_menustyle.framefont.getFontStruct()->fid;
159 159
160 m_menustyle.f_text_gc = 160 m_menustyle.f_text_gc =
161 XCreateGC(m_display, rootwindow, 161 XCreateGC(m_display, rootwindow,
@@ -213,10 +213,6 @@ Theme::~Theme() {
213// should only be called from ~Theme 213// should only be called from ~Theme
214//-------------------- 214//--------------------
215void Theme::freeMenuStyle() { 215void Theme::freeMenuStyle() {
216 delete m_menustyle.framefont;
217 m_menustyle.framefont = 0;
218 delete m_menustyle.titlefont;
219 m_menustyle.titlefont = 0;
220 216
221 XFreeGC(m_display, m_menustyle.t_text_gc); 217 XFreeGC(m_display, m_menustyle.t_text_gc);
222 XFreeGC(m_display, m_menustyle.f_text_gc); 218 XFreeGC(m_display, m_menustyle.f_text_gc);
@@ -300,8 +296,6 @@ void Theme::load(const char *filename){
300} 296}
301 297
302void Theme::loadMenuStyle() { 298void Theme::loadMenuStyle() {
303 if (m_menustyle.titlefont==0)
304 m_menustyle.titlefont = new FbTk::Font(m_display);
305 299
306 readDatabaseTexture("menu.title", "Menu.Title", 300 readDatabaseTexture("menu.title", "Menu.Title",
307 &m_menustyle.title, 301 &m_menustyle.title,
@@ -381,30 +375,8 @@ void Theme::loadMenuStyle() {
381 m_menustyle.bullet_pos = Basemenu::LEFT; 375 m_menustyle.bullet_pos = Basemenu::LEFT;
382 376
383 //---------- font 377 //---------- font
384 m_menustyle.framefont->loadFromDatabase(m_database, "menu.frame.font", "Menu.Frame.Font"); 378 m_menustyle.framefont.loadFromDatabase(m_database, "menu.frame.font", "Menu.Frame.Font");
385 m_menustyle.titlefont->loadFromDatabase(m_database, "menu.title.font", "Menu.Title.Font"); 379 m_menustyle.titlefont.loadFromDatabase(m_database, "menu.title.font", "Menu.Title.Font");
386 /*
387 if (I18n::instance()->multibyte()) {
388
389 readDatabaseFontSet("menu.title.font", "Menu.Title.Font",
390 &m_menustyle.titlefont.set);
391 readDatabaseFontSet("menu.frame.font", "Menu.Frame.Font",
392 &m_menustyle.framefont.set);
393
394 m_menustyle.titlefont.set_extents =
395 XExtentsOfFontSet(m_menustyle.titlefont.set);
396 m_menustyle.framefont.set_extents =
397 XExtentsOfFontSet(m_menustyle.framefont.set);
398
399
400 } else {
401
402 readDatabaseFont("menu.title.font", "Menu.Title.Font",
403 &m_menustyle.titlefont.fontstruct);
404
405 readDatabaseFont("menu.frame.font", "Menu.Frame.Font",
406 &m_menustyle.framefont.fontstruct);
407 }*/
408 380
409} 381}
410 382
@@ -990,14 +962,14 @@ void Theme::reconfigure() {
990 GCForeground, &gcv); 962 GCForeground, &gcv);
991 963
992 gcv.foreground = m_menustyle.t_text.getPixel(); 964 gcv.foreground = m_menustyle.t_text.getPixel();
993 if (m_menustyle.titlefont->getFontStruct()) 965 if (m_menustyle.titlefont.getFontStruct())
994 gcv.font = m_menustyle.titlefont->getFontStruct()->fid; 966 gcv.font = m_menustyle.titlefont.getFontStruct()->fid;
995 XChangeGC(m_display, m_menustyle.t_text_gc, 967 XChangeGC(m_display, m_menustyle.t_text_gc,
996 gc_value_mask, &gcv); 968 gc_value_mask, &gcv);
997 969
998 gcv.foreground = m_menustyle.f_text.getPixel(); 970 gcv.foreground = m_menustyle.f_text.getPixel();
999 if (m_menustyle.framefont->getFontStruct()) 971 if (m_menustyle.framefont.getFontStruct())
1000 gcv.font = m_menustyle.framefont->getFontStruct()->fid; 972 gcv.font = m_menustyle.framefont.getFontStruct()->fid;
1001 973
1002 XChangeGC(m_display, m_menustyle.f_text_gc, 974 XChangeGC(m_display, m_menustyle.f_text_gc,
1003 gc_value_mask, &gcv); 975 gc_value_mask, &gcv);
diff --git a/src/Theme.hh b/src/Theme.hh
index c197469..1401716 100644
--- a/src/Theme.hh
+++ b/src/Theme.hh
@@ -42,7 +42,7 @@
42// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 42// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
43// DEALINGS IN THE SOFTWARE. 43// DEALINGS IN THE SOFTWARE.
44 44
45// $Id: Theme.hh,v 1.8 2002/05/07 15:22:07 fluxgen Exp $ 45// $Id: Theme.hh,v 1.9 2002/05/15 09:35:49 fluxgen Exp $
46 46
47#ifndef THEME_HH 47#ifndef THEME_HH
48#define THEME_HH 48#define THEME_HH
@@ -66,10 +66,12 @@ public:
66 66
67 67
68 typedef struct MenuStyle { 68 typedef struct MenuStyle {
69 MenuStyle(Display *display):titlefont(display, "fixed"),
70 framefont(display, "fixed") { }
69 BColor t_text, f_text, h_text, d_text; 71 BColor t_text, f_text, h_text, d_text;
70 BTexture title, frame, hilite; 72 BTexture title, frame, hilite;
71 GC t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc; 73 GC t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc;
72 FbTk::Font *titlefont, *framefont; 74 FbTk::Font titlefont, framefont;
73 DrawUtil::Font::FontJustify framefont_justify; 75 DrawUtil::Font::FontJustify framefont_justify;
74 DrawUtil::Font::FontJustify titlefont_justify; 76 DrawUtil::Font::FontJustify titlefont_justify;
75 int bullet, bullet_pos; 77 int bullet, bullet_pos;