diff options
author | fluxgen <fluxgen> | 2002-03-21 10:54:29 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-03-21 10:54:29 (GMT) |
commit | f44b282b001d2479586215cdc722ce426ca1782a (patch) | |
tree | 98677366c70480f0d513b52add7580585e26cc92 | |
parent | 3d3985609cd6dddff78558a9c1b3429ed4e891f4 (diff) | |
download | fluxbox-f44b282b001d2479586215cdc722ce426ca1782a.zip fluxbox-f44b282b001d2479586215cdc722ce426ca1782a.tar.bz2 |
added FbTk font to MenuStyle
-rw-r--r-- | src/Basemenu.cc | 88 | ||||
-rw-r--r-- | src/Theme.cc | 77 | ||||
-rw-r--r-- | src/Theme.hh | 13 |
3 files changed, 85 insertions, 93 deletions
diff --git a/src/Basemenu.cc b/src/Basemenu.cc index 559bb97..f78b47e 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.13 2002/03/20 14:10:03 fluxgen Exp $ | 25 | // $Id: Basemenu.cc,v 1.14 2002/03/21 10:54:29 fluxgen Exp $ |
26 | 26 | ||
27 | // stupid macros needed to access some functions in version 2 of the GNU C | 27 | // stupid macros needed to access some functions in version 2 of the GNU C |
28 | // library | 28 | // library |
@@ -49,7 +49,10 @@ | |||
49 | # include <string.h> | 49 | # include <string.h> |
50 | #endif // STDC_HEADERS | 50 | #endif // STDC_HEADERS |
51 | 51 | ||
52 | #ifdef DEBUG | ||
52 | #include <iostream> | 53 | #include <iostream> |
54 | using namespace std; | ||
55 | #endif //DEBUG | ||
53 | 56 | ||
54 | static Basemenu *shown = (Basemenu *) 0; | 57 | static Basemenu *shown = (Basemenu *) 0; |
55 | 58 | ||
@@ -93,12 +96,12 @@ Basemenu::Basemenu(BScreen *scrn) { | |||
93 | 96 | ||
94 | if (i18n->multibyte()) { | 97 | if (i18n->multibyte()) { |
95 | menu.width = menu.title_h = menu.item_w = menu.frame_h = | 98 | menu.width = menu.title_h = menu.item_w = menu.frame_h = |
96 | screen->getMenuStyle()->titlefont.set_extents->max_ink_extent.height + | 99 | screen->getMenuStyle()->titlefont->getFontSetExtents()->max_ink_extent.height + |
97 | (menu.bevel_w * 2); | 100 | (menu.bevel_w * 2); |
98 | } else { | 101 | } else { |
99 | menu.width = menu.title_h = menu.item_w = menu.frame_h = | 102 | menu.width = menu.title_h = menu.item_w = menu.frame_h = |
100 | screen->getMenuStyle()->titlefont.fontstruct->ascent + | 103 | screen->getMenuStyle()->titlefont->getFontStruct()->ascent + |
101 | screen->getMenuStyle()->titlefont.fontstruct->descent + | 104 | screen->getMenuStyle()->titlefont->getFontStruct()->descent + |
102 | (menu.bevel_w * 2); | 105 | (menu.bevel_w * 2); |
103 | } | 106 | } |
104 | menu.label = 0; | 107 | menu.label = 0; |
@@ -108,11 +111,11 @@ Basemenu::Basemenu(BScreen *scrn) { | |||
108 | menu.minsub = 0; | 111 | menu.minsub = 0; |
109 | 112 | ||
110 | if (i18n->multibyte()) { | 113 | if (i18n->multibyte()) { |
111 | menu.item_h = screen->getMenuStyle()->framefont.set_extents->max_ink_extent.height + | 114 | menu.item_h = screen->getMenuStyle()->framefont->getFontSetExtents()->max_ink_extent.height + |
112 | (menu.bevel_w); | 115 | (menu.bevel_w); |
113 | } else { | 116 | } else { |
114 | menu.item_h = screen->getMenuStyle()->framefont.fontstruct->ascent + | 117 | menu.item_h = screen->getMenuStyle()->framefont->getFontStruct()->ascent + |
115 | screen->getMenuStyle()->framefont.fontstruct->descent + | 118 | screen->getMenuStyle()->framefont->getFontStruct()->descent + |
116 | (menu.bevel_w); | 119 | (menu.bevel_w); |
117 | } | 120 | } |
118 | menu.height = menu.title_h + screen->getBorderWidth() + menu.frame_h; | 121 | menu.height = menu.title_h + screen->getBorderWidth() + menu.frame_h; |
@@ -277,37 +280,33 @@ void Basemenu::update(void) { | |||
277 | I18n *i18n = I18n::instance(); | 280 | I18n *i18n = I18n::instance(); |
278 | 281 | ||
279 | if (i18n->multibyte()) { | 282 | if (i18n->multibyte()) { |
280 | menu.item_h = screen->getMenuStyle()->framefont.set_extents->max_ink_extent.height + | 283 | menu.item_h = screen->getMenuStyle()->framefont->getFontSetExtents()->max_ink_extent.height + |
281 | menu.bevel_w; | 284 | menu.bevel_w; |
282 | menu.title_h = screen->getMenuStyle()->titlefont.set_extents->max_ink_extent.height + | 285 | menu.title_h = screen->getMenuStyle()->titlefont->getFontSetExtents()->max_ink_extent.height + |
283 | (menu.bevel_w * 2); | 286 | (menu.bevel_w * 2); |
284 | } else { | 287 | } else { |
285 | menu.item_h = screen->getMenuStyle()->framefont.fontstruct->ascent + | 288 | menu.item_h = screen->getMenuStyle()->framefont->getFontStruct()->ascent + |
286 | screen->getMenuStyle()->framefont.fontstruct->descent + | 289 | screen->getMenuStyle()->framefont->getFontStruct()->descent + |
287 | menu.bevel_w; | 290 | menu.bevel_w; |
288 | menu.title_h = screen->getMenuStyle()->titlefont.fontstruct->ascent + | 291 | menu.title_h = screen->getMenuStyle()->titlefont->getFontStruct()->ascent + |
289 | screen->getMenuStyle()->titlefont.fontstruct->descent + | 292 | screen->getMenuStyle()->titlefont->getFontStruct()->descent + |
290 | (menu.bevel_w * 2); | 293 | (menu.bevel_w * 2); |
291 | } | 294 | } |
292 | 295 | ||
293 | if (title_vis) { | 296 | if (title_vis) { |
294 | const char *s = (menu.label) ? menu.label : | 297 | const char *s = (menu.label) ? menu.label : |
295 | i18n->getMessage( | 298 | i18n->getMessage( |
296 | #ifdef NLS | 299 | BasemenuSet, BasemenuBlackboxMenu, |
297 | BasemenuSet, BasemenuBlackboxMenu, | 300 | "fluxbox Menu"); |
298 | #else // !NLS | ||
299 | 0, 0, | ||
300 | #endif // NLS | ||
301 | "fluxbox Menu"); | ||
302 | int l = strlen(s); | 301 | int l = strlen(s); |
303 | 302 | ||
304 | 303 | ||
305 | if (i18n->multibyte()) { | 304 | if (i18n->multibyte()) { |
306 | XRectangle ink, logical; | 305 | XRectangle ink, logical; |
307 | XmbTextExtents(screen->getMenuStyle()->titlefont.set, s, l, &ink, &logical); | 306 | XmbTextExtents(screen->getMenuStyle()->titlefont->getFontSet(), s, l, &ink, &logical); |
308 | menu.item_w = logical.width; | 307 | menu.item_w = logical.width; |
309 | } else | 308 | } else |
310 | menu.item_w = XTextWidth(screen->getMenuStyle()->titlefont.fontstruct, s, l); | 309 | menu.item_w = XTextWidth(screen->getMenuStyle()->titlefont->getFontStruct(), s, l); |
311 | 310 | ||
312 | menu.item_w += (menu.bevel_w * 2); | 311 | menu.item_w += (menu.bevel_w * 2); |
313 | } else | 312 | } else |
@@ -324,10 +323,10 @@ void Basemenu::update(void) { | |||
324 | 323 | ||
325 | if (i18n->multibyte()) { | 324 | if (i18n->multibyte()) { |
326 | XRectangle ink, logical; | 325 | XRectangle ink, logical; |
327 | XmbTextExtents(screen->getMenuStyle()->framefont.set, s, l, &ink, &logical); | 326 | XmbTextExtents(screen->getMenuStyle()->framefont->getFontSet(), s, l, &ink, &logical); |
328 | ii = logical.width; | 327 | ii = logical.width; |
329 | } else | 328 | } else |
330 | ii = XTextWidth(screen->getMenuStyle()->framefont.fontstruct, s, l); | 329 | ii = XTextWidth(screen->getMenuStyle()->framefont->getFontStruct(), s, l); |
331 | 330 | ||
332 | ii += (menu.bevel_w * 2) + (menu.item_h * 2); | 331 | ii += (menu.bevel_w * 2) + (menu.item_h * 2); |
333 | 332 | ||
@@ -509,16 +508,12 @@ void Basemenu::redrawTitle(void) { | |||
509 | int dx = menu.bevel_w, len = strlen(text); | 508 | int dx = menu.bevel_w, len = strlen(text); |
510 | unsigned int l; | 509 | unsigned int l; |
511 | 510 | ||
512 | if (i18n->multibyte()) { | 511 | l = screen->getMenuStyle()->titlefont->getTextWidth(text, len); |
513 | XRectangle ink, logical; | ||
514 | XmbTextExtents(screen->getMenuStyle()->titlefont.set, text, len, &ink, &logical); | ||
515 | l = logical.width; | ||
516 | } else | ||
517 | l = XTextWidth(screen->getMenuStyle()->titlefont.fontstruct, text, len); | ||
518 | 512 | ||
519 | l += (menu.bevel_w * 2); | 513 | l += (menu.bevel_w * 2); |
520 | 514 | ||
521 | switch (screen->getMenuStyle()->titlefont.justify) { | 515 | //titlefont.justify |
516 | switch (screen->getMenuStyle()->titlefont_justify) { | ||
522 | case DrawUtil::Font::RIGHT: | 517 | case DrawUtil::Font::RIGHT: |
523 | dx += menu.width - l; | 518 | dx += menu.width - l; |
524 | break; | 519 | break; |
@@ -531,13 +526,13 @@ void Basemenu::redrawTitle(void) { | |||
531 | } | 526 | } |
532 | 527 | ||
533 | if (i18n->multibyte()) | 528 | if (i18n->multibyte()) |
534 | XmbDrawString(display, menu.title, screen->getMenuStyle()->titlefont.set, | 529 | XmbDrawString(display, menu.title, screen->getMenuStyle()->titlefont->getFontSet(), |
535 | screen->getMenuStyle()->t_text_gc, dx, menu.bevel_w - | 530 | screen->getMenuStyle()->t_text_gc, dx, menu.bevel_w - |
536 | screen->getMenuStyle()->titlefont.set_extents->max_ink_extent.y, | 531 | screen->getMenuStyle()->titlefont->getFontSetExtents()->max_ink_extent.y, |
537 | text, len); | 532 | text, len); |
538 | else | 533 | else |
539 | XDrawString(display, menu.title, screen->getMenuStyle()->t_text_gc, dx, | 534 | XDrawString(display, menu.title, screen->getMenuStyle()->t_text_gc, dx, |
540 | screen->getMenuStyle()->titlefont.fontstruct->ascent + menu.bevel_w, | 535 | screen->getMenuStyle()->titlefont->getFontStruct()->ascent + menu.bevel_w, |
541 | text, len); | 536 | text, len); |
542 | } | 537 | } |
543 | 538 | ||
@@ -681,20 +676,19 @@ void Basemenu::drawItem(unsigned int index, bool highlight, bool clear, | |||
681 | I18n *i18n = I18n::instance(); | 676 | I18n *i18n = I18n::instance(); |
682 | 677 | ||
683 | if (text) { | 678 | if (text) { |
684 | if (i18n->multibyte()) { | 679 | text_w = screen->getMenuStyle()->framefont->getTextWidth(text, len); |
685 | XRectangle ink, logical; | 680 | |
686 | XmbTextExtents(screen->getMenuStyle()->framefont.set, text, len, &ink, &logical); | 681 | if (screen->getMenuStyle()->framefont->multibyte()) { |
687 | text_w = logical.width; | ||
688 | text_y = item_y + (menu.bevel_w / 2) - | 682 | text_y = item_y + (menu.bevel_w / 2) - |
689 | screen->getMenuStyle()->framefont.set_extents->max_ink_extent.y; | 683 | screen->getMenuStyle()->framefont->getFontSetExtents()->max_ink_extent.y; |
690 | } else { | 684 | } else { |
691 | text_w = XTextWidth(screen->getMenuStyle()->framefont.fontstruct, text, len); | 685 | text_y = item_y + |
692 | text_y = item_y + | 686 | screen->getMenuStyle()->framefont->getFontStruct()->ascent + |
693 | screen->getMenuStyle()->framefont.fontstruct->ascent + | ||
694 | (menu.bevel_w / 2); | 687 | (menu.bevel_w / 2); |
695 | } | 688 | } |
696 | 689 | ||
697 | switch(screen->getMenuStyle()->framefont.justify) { | 690 | // framfont.justify |
691 | switch(screen->getMenuStyle()->framefont_justify) { | ||
698 | case DrawUtil::Font::LEFT: | 692 | case DrawUtil::Font::LEFT: |
699 | text_x = item_x + menu.bevel_w + menu.item_h + 1; | 693 | text_x = item_x + menu.bevel_w + menu.item_h + 1; |
700 | break; | 694 | break; |
@@ -706,7 +700,7 @@ void Basemenu::drawItem(unsigned int index, bool highlight, bool clear, | |||
706 | text_x = item_x + ((menu.item_w + 1 - text_w) / 2); | 700 | text_x = item_x + ((menu.item_w + 1 - text_w) / 2); |
707 | break; | 701 | break; |
708 | } | 702 | } |
709 | 703 | ||
710 | text_h = menu.item_h - menu.bevel_w; | 704 | text_h = menu.item_h - menu.bevel_w; |
711 | } | 705 | } |
712 | 706 | ||
@@ -781,7 +775,7 @@ void Basemenu::drawItem(unsigned int index, bool highlight, bool clear, | |||
781 | 775 | ||
782 | if (dotext && text) { | 776 | if (dotext && text) { |
783 | if (i18n->multibyte()) { | 777 | if (i18n->multibyte()) { |
784 | XmbDrawString(display, menu.frame, screen->getMenuStyle()->framefont.set, | 778 | XmbDrawString(display, menu.frame, screen->getMenuStyle()->framefont->getFontSet(), |
785 | tgc, text_x, text_y, text, len); | 779 | tgc, text_x, text_y, text, len); |
786 | } else | 780 | } else |
787 | XDrawString(display, menu.frame, tgc, text_x, text_y, text, len); | 781 | XDrawString(display, menu.frame, tgc, text_x, text_y, text, len); |
diff --git a/src/Theme.cc b/src/Theme.cc index 9045b67..d712f86 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.17 2002/01/27 13:16:07 fluxgen Exp $ | 44 | // $Id: Theme.cc,v 1.18 2002/03/21 10:54:29 fluxgen Exp $ |
45 | 45 | ||
46 | #ifndef _GNU_SOURCE | 46 | #ifndef _GNU_SOURCE |
47 | #define _GNU_SOURCE | 47 | #define _GNU_SOURCE |
@@ -77,12 +77,15 @@ m_colormap(colormap), | |||
77 | m_screennum(screennum), | 77 | m_screennum(screennum), |
78 | m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointer to std::string | 78 | m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointer to std::string |
79 | { | 79 | { |
80 | #ifdef DEBUG | ||
81 | cerr<<__FILE__<<"("<<__LINE__<<"): Creating."<<endl; | ||
82 | #endif //DEBUG | ||
80 | //default settings | 83 | //default settings |
81 | m_menustyle.titlefont.set = m_menustyle.framefont.set = m_toolbarstyle.font.set = | 84 | m_menustyle.titlefont = new FbTk::Font(m_display, "fixed"); //create with default font |
82 | m_windowstyle.font.set = m_windowstyle.tab.font.set = 0; | 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; | ||
83 | 87 | ||
84 | m_menustyle.titlefont.fontstruct = m_menustyle.framefont.fontstruct = m_toolbarstyle.font.fontstruct = | 88 | m_toolbarstyle.font.fontstruct = m_windowstyle.font.fontstruct = m_windowstyle.tab.font.fontstruct = 0; |
85 | m_windowstyle.font.fontstruct = m_windowstyle.tab.font.fontstruct = 0; | ||
86 | m_windowstyle.tab.rot_font = 0; | 89 | m_windowstyle.tab.rot_font = 0; |
87 | 90 | ||
88 | load(filename); | 91 | load(filename); |
@@ -144,15 +147,15 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe | |||
144 | GCForeground, &gcv); | 147 | GCForeground, &gcv); |
145 | 148 | ||
146 | gcv.foreground = m_menustyle.t_text.getPixel(); | 149 | gcv.foreground = m_menustyle.t_text.getPixel(); |
147 | if (m_menustyle.titlefont.fontstruct) | 150 | if (m_menustyle.titlefont->getFontStruct()) |
148 | gcv.font = m_menustyle.titlefont.fontstruct->fid; | 151 | gcv.font = m_menustyle.titlefont->getFontStruct()->fid; |
149 | m_menustyle.t_text_gc = | 152 | m_menustyle.t_text_gc = |
150 | XCreateGC(m_display, rootwindow, | 153 | XCreateGC(m_display, rootwindow, |
151 | gc_value_mask, &gcv); | 154 | gc_value_mask, &gcv); |
152 | 155 | ||
153 | gcv.foreground = m_menustyle.f_text.getPixel(); | 156 | gcv.foreground = m_menustyle.f_text.getPixel(); |
154 | if (m_menustyle.framefont.fontstruct) | 157 | if (m_menustyle.framefont->getFontStruct()) |
155 | gcv.font = m_menustyle.framefont.fontstruct->fid; | 158 | gcv.font = m_menustyle.framefont->getFontStruct()->fid; |
156 | 159 | ||
157 | m_menustyle.f_text_gc = | 160 | m_menustyle.f_text_gc = |
158 | XCreateGC(m_display, rootwindow, | 161 | XCreateGC(m_display, rootwindow, |
@@ -210,17 +213,10 @@ Theme::~Theme() { | |||
210 | // should only be called from ~Theme | 213 | // should only be called from ~Theme |
211 | //-------------------- | 214 | //-------------------- |
212 | void Theme::freeMenuStyle() { | 215 | void Theme::freeMenuStyle() { |
213 | if (m_menustyle.titlefont.set) | 216 | delete m_menustyle.framefont; |
214 | XFreeFontSet(m_display, m_menustyle.titlefont.set); | 217 | m_menustyle.framefont = 0; |
215 | 218 | delete m_menustyle.titlefont; | |
216 | if (m_menustyle.titlefont.fontstruct) | 219 | m_menustyle.titlefont = 0; |
217 | XFreeFont(m_display, m_menustyle.titlefont.fontstruct); | ||
218 | |||
219 | if (m_menustyle.framefont.set) | ||
220 | XFreeFontSet(m_display, m_menustyle.framefont.set); | ||
221 | |||
222 | if (m_menustyle.framefont.fontstruct) | ||
223 | XFreeFont(m_display, m_menustyle.framefont.fontstruct); | ||
224 | 220 | ||
225 | XFreeGC(m_display, m_menustyle.t_text_gc); | 221 | XFreeGC(m_display, m_menustyle.t_text_gc); |
226 | XFreeGC(m_display, m_menustyle.f_text_gc); | 222 | XFreeGC(m_display, m_menustyle.f_text_gc); |
@@ -304,7 +300,9 @@ void Theme::load(const char *filename){ | |||
304 | } | 300 | } |
305 | 301 | ||
306 | void Theme::loadMenuStyle() { | 302 | void Theme::loadMenuStyle() { |
307 | 303 | if (m_menustyle.titlefont==0) | |
304 | m_menustyle.titlefont = new FbTk::Font(m_display); | ||
305 | |||
308 | readDatabaseTexture("menu.title", "Menu.Title", | 306 | readDatabaseTexture("menu.title", "Menu.Title", |
309 | &m_menustyle.title, | 307 | &m_menustyle.title, |
310 | WhitePixel(m_display, m_screennum)); | 308 | WhitePixel(m_display, m_screennum)); |
@@ -334,27 +332,27 @@ void Theme::loadMenuStyle() { | |||
334 | "Menu.Title.Justify", &value_type, &value)) { | 332 | "Menu.Title.Justify", &value_type, &value)) { |
335 | 333 | ||
336 | if (strstr(value.addr, "right") || strstr(value.addr, "Right")) | 334 | if (strstr(value.addr, "right") || strstr(value.addr, "Right")) |
337 | m_menustyle.titlefont.justify = DrawUtil::Font::RIGHT; | 335 | m_menustyle.titlefont_justify = DrawUtil::Font::RIGHT; |
338 | else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) | 336 | else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) |
339 | m_menustyle.titlefont.justify = DrawUtil::Font::CENTER; | 337 | m_menustyle.titlefont_justify = DrawUtil::Font::CENTER; |
340 | else | 338 | else |
341 | m_menustyle.titlefont.justify = DrawUtil::Font::LEFT; | 339 | m_menustyle.titlefont_justify = DrawUtil::Font::LEFT; |
342 | 340 | ||
343 | } else | 341 | } else |
344 | m_menustyle.titlefont.justify = DrawUtil::Font::LEFT; | 342 | m_menustyle.titlefont_justify = DrawUtil::Font::LEFT; |
345 | 343 | ||
346 | if (XrmGetResource(m_database, "menu.frame.justify", | 344 | if (XrmGetResource(m_database, "menu.frame.justify", |
347 | "Menu.Frame.Justify", &value_type, &value)) { | 345 | "Menu.Frame.Justify", &value_type, &value)) { |
348 | 346 | ||
349 | if (strstr(value.addr, "right") || strstr(value.addr, "Right")) | 347 | if (strstr(value.addr, "right") || strstr(value.addr, "Right")) |
350 | m_menustyle.framefont.justify = DrawUtil::Font::RIGHT; | 348 | m_menustyle.framefont_justify = DrawUtil::Font::RIGHT; |
351 | else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) | 349 | else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) |
352 | m_menustyle.framefont.justify = DrawUtil::Font::CENTER; | 350 | m_menustyle.framefont_justify = DrawUtil::Font::CENTER; |
353 | else | 351 | else |
354 | m_menustyle.framefont.justify = DrawUtil::Font::LEFT; | 352 | m_menustyle.framefont_justify = DrawUtil::Font::LEFT; |
355 | 353 | ||
356 | } else | 354 | } else |
357 | m_menustyle.framefont.justify = DrawUtil::Font::LEFT; | 355 | m_menustyle.framefont_justify = DrawUtil::Font::LEFT; |
358 | 356 | ||
359 | if (XrmGetResource(m_database, "menu.bullet", "Menu.Bullet", | 357 | if (XrmGetResource(m_database, "menu.bullet", "Menu.Bullet", |
360 | &value_type, &value)) { | 358 | &value_type, &value)) { |
@@ -383,19 +381,22 @@ void Theme::loadMenuStyle() { | |||
383 | m_menustyle.bullet_pos = Basemenu::LEFT; | 381 | m_menustyle.bullet_pos = Basemenu::LEFT; |
384 | 382 | ||
385 | //---------- font | 383 | //---------- font |
386 | 384 | 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"); | ||
386 | /* | ||
387 | if (I18n::instance()->multibyte()) { | 387 | if (I18n::instance()->multibyte()) { |
388 | 388 | ||
389 | readDatabaseFontSet("menu.title.font", "Menu.Title.Font", | 389 | readDatabaseFontSet("menu.title.font", "Menu.Title.Font", |
390 | &m_menustyle.titlefont.set); | 390 | &m_menustyle.titlefont.set); |
391 | readDatabaseFontSet("menu.frame.font", "Menu.Frame.Font", | 391 | readDatabaseFontSet("menu.frame.font", "Menu.Frame.Font", |
392 | &m_menustyle.framefont.set); | 392 | &m_menustyle.framefont.set); |
393 | 393 | ||
394 | m_menustyle.titlefont.set_extents = | 394 | m_menustyle.titlefont.set_extents = |
395 | XExtentsOfFontSet(m_menustyle.titlefont.set); | 395 | XExtentsOfFontSet(m_menustyle.titlefont.set); |
396 | m_menustyle.framefont.set_extents = | 396 | m_menustyle.framefont.set_extents = |
397 | XExtentsOfFontSet(m_menustyle.framefont.set); | 397 | XExtentsOfFontSet(m_menustyle.framefont.set); |
398 | 398 | ||
399 | |||
399 | } else { | 400 | } else { |
400 | 401 | ||
401 | readDatabaseFont("menu.title.font", "Menu.Title.Font", | 402 | readDatabaseFont("menu.title.font", "Menu.Title.Font", |
@@ -403,7 +404,7 @@ void Theme::loadMenuStyle() { | |||
403 | 404 | ||
404 | readDatabaseFont("menu.frame.font", "Menu.Frame.Font", | 405 | readDatabaseFont("menu.frame.font", "Menu.Frame.Font", |
405 | &m_menustyle.framefont.fontstruct); | 406 | &m_menustyle.framefont.fontstruct); |
406 | } | 407 | }*/ |
407 | 408 | ||
408 | } | 409 | } |
409 | 410 | ||
@@ -1001,14 +1002,14 @@ void Theme::reconfigure() { | |||
1001 | GCForeground, &gcv); | 1002 | GCForeground, &gcv); |
1002 | 1003 | ||
1003 | gcv.foreground = m_menustyle.t_text.getPixel(); | 1004 | gcv.foreground = m_menustyle.t_text.getPixel(); |
1004 | if (m_menustyle.titlefont.fontstruct) | 1005 | if (m_menustyle.titlefont->getFontStruct()) |
1005 | gcv.font = m_menustyle.titlefont.fontstruct->fid; | 1006 | gcv.font = m_menustyle.titlefont->getFontStruct()->fid; |
1006 | XChangeGC(m_display, m_menustyle.t_text_gc, | 1007 | XChangeGC(m_display, m_menustyle.t_text_gc, |
1007 | gc_value_mask, &gcv); | 1008 | gc_value_mask, &gcv); |
1008 | 1009 | ||
1009 | gcv.foreground = m_menustyle.f_text.getPixel(); | 1010 | gcv.foreground = m_menustyle.f_text.getPixel(); |
1010 | if (m_menustyle.framefont.fontstruct) | 1011 | if (m_menustyle.framefont->getFontStruct()) |
1011 | gcv.font = m_menustyle.framefont.fontstruct->fid; | 1012 | gcv.font = m_menustyle.framefont->getFontStruct()->fid; |
1012 | 1013 | ||
1013 | XChangeGC(m_display, m_menustyle.f_text_gc, | 1014 | XChangeGC(m_display, m_menustyle.f_text_gc, |
1014 | gc_value_mask, &gcv); | 1015 | gc_value_mask, &gcv); |
diff --git a/src/Theme.hh b/src/Theme.hh index 5cafbf6..7e2e6f0 100644 --- a/src/Theme.hh +++ b/src/Theme.hh | |||
@@ -42,19 +42,14 @@ | |||
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.6 2002/02/17 18:49:50 fluxgen Exp $ | 45 | // $Id: Theme.hh,v 1.7 2002/03/21 10:54:29 fluxgen Exp $ |
46 | 46 | ||
47 | #ifndef THEME_HH | 47 | #ifndef THEME_HH |
48 | #define THEME_HH | 48 | #define THEME_HH |
49 | 49 | ||
50 | |||
51 | #ifndef _IMAGE_HH_ | ||
52 | #include "Image.hh" | 50 | #include "Image.hh" |
53 | #endif //!_IMAGE_HH_ | ||
54 | |||
55 | #ifndef _DRAWUTIL_HH_ | ||
56 | #include "DrawUtil.hh" | 51 | #include "DrawUtil.hh" |
57 | #endif //!_MISC_HH_ | 52 | #include "Font.hh" |
58 | 53 | ||
59 | #include <X11/Xlib.h> | 54 | #include <X11/Xlib.h> |
60 | #include <X11/Xresource.h> | 55 | #include <X11/Xresource.h> |
@@ -74,7 +69,9 @@ public: | |||
74 | BColor t_text, f_text, h_text, d_text; | 69 | BColor t_text, f_text, h_text, d_text; |
75 | BTexture title, frame, hilite; | 70 | BTexture title, frame, hilite; |
76 | GC t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc; | 71 | GC t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc; |
77 | DrawUtil::Font titlefont, framefont; | 72 | FbTk::Font *titlefont, *framefont; |
73 | DrawUtil::Font::FontJustify framefont_justify; | ||
74 | DrawUtil::Font::FontJustify titlefont_justify; | ||
78 | int bullet, bullet_pos; | 75 | int bullet, bullet_pos; |
79 | } MenuStyle; | 76 | } MenuStyle; |
80 | 77 | ||