aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-08-04 15:19:34 (GMT)
committerfluxgen <fluxgen>2002-08-04 15:19:34 (GMT)
commitcd9424a8c2f843fffcf112ac68c2b75b9fb13491 (patch)
tree2f6c34791684294c65f3adf7cd45fd39a6660db5
parentf98ec3e4a766310ca6b3bab0268b1e9038c015c2 (diff)
downloadfluxbox-cd9424a8c2f843fffcf112ac68c2b75b9fb13491.zip
fluxbox-cd9424a8c2f843fffcf112ac68c2b75b9fb13491.tar.bz2
updated to match new functions names in FbTk Font
-rw-r--r--src/Basemenu.cc64
1 files changed, 24 insertions, 40 deletions
diff --git a/src/Basemenu.cc b/src/Basemenu.cc
index a603dee..87c4bf6 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.27 2002/07/23 17:11:58 fluxgen Exp $ 25// $Id: Basemenu.cc,v 1.28 2002/08/04 15:19:34 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.fontSetExtents()->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.fontStruct()->ascent +
103 m_screen->getMenuStyle()->titlefont.getFontStruct()->descent + 103 m_screen->getMenuStyle()->titlefont.fontStruct()->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.fontSetExtents()->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.fontStruct()->ascent +
116 m_screen->getMenuStyle()->framefont.getFontStruct()->descent + 116 m_screen->getMenuStyle()->framefont.fontStruct()->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.fontSetExtents()->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.fontSetExtents()->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.fontStruct()->ascent +
269 m_screen->getMenuStyle()->framefont.getFontStruct()->descent + 269 m_screen->getMenuStyle()->framefont.fontStruct()->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.fontStruct()->ascent +
272 m_screen->getMenuStyle()->titlefont.getFontStruct()->descent + 272 m_screen->getMenuStyle()->titlefont.fontStruct()->descent +
273 (menu.bevel_w * 2); 273 (menu.bevel_w * 2);
274 } 274 }
275 275
@@ -280,14 +280,7 @@ void Basemenu::update(void) {
280 "fluxbox Menu"); 280 "fluxbox Menu");
281 int l = strlen(s); 281 int l = strlen(s);
282 282
283 /* 283 menu.item_w = m_screen->getMenuStyle()->titlefont.textWidth(s, l);
284 if (i18n->multibyte()) {
285 XRectangle ink, logical;
286 XmbTextExtents(m_screen->getMenuStyle()->titlefont.getFontSet(), s, l, &ink, &logical);
287 menu.item_w = logical.width;
288 } else*/
289 menu.item_w = m_screen->getMenuStyle()->titlefont.getTextWidth(s, l);
290 //XTextWidth(m_screen->getMenuStyle()->titlefont.getFontStruct(), s, l);
291 284
292 menu.item_w += (menu.bevel_w * 2); 285 menu.item_w += (menu.bevel_w * 2);
293 } else 286 } else
@@ -302,14 +295,7 @@ void Basemenu::update(void) {
302 const char *s = itmp->label().c_str(); 295 const char *s = itmp->label().c_str();
303 int l = itmp->label().size(); 296 int l = itmp->label().size();
304 297
305 /*if (i18n->multibyte()) { 298 ii = screen()->getMenuStyle()->framefont.textWidth(s, l);
306 XRectangle ink, logical;
307 XmbTextExtents(m_screen->getMenuStyle()->framefont.getFontSet(), s, l, &ink, &logical);
308 ii = logical.width;
309 } else
310 ii = XTextWidth(m_screen->getMenuStyle()->framefont.getFontStruct(), s, l);
311 */
312 ii = screen()->getMenuStyle()->framefont.getTextWidth(s, l);
313 299
314 300
315 ii += (menu.bevel_w * 2) + (menu.item_h * 2); 301 ii += (menu.bevel_w * 2) + (menu.item_h * 2);
@@ -489,11 +475,10 @@ void Basemenu::redrawTitle(void) {
489 int dx = menu.bevel_w, len = strlen(text); 475 int dx = menu.bevel_w, len = strlen(text);
490 unsigned int l; 476 unsigned int l;
491 477
492 l = m_screen->getMenuStyle()->titlefont.getTextWidth(text, len); 478 l = m_screen->getMenuStyle()->titlefont.textWidth(text, len);
493 479
494 l += (menu.bevel_w * 2); 480 l += (menu.bevel_w * 2);
495 481
496 //titlefont.justify
497 switch (m_screen->getMenuStyle()->titlefont_justify) { 482 switch (m_screen->getMenuStyle()->titlefont_justify) {
498 case DrawUtil::Font::RIGHT: 483 case DrawUtil::Font::RIGHT:
499 dx += menu.width - l; 484 dx += menu.width - l;
@@ -507,13 +492,13 @@ void Basemenu::redrawTitle(void) {
507 } 492 }
508 493
509 if (i18n->multibyte()) 494 if (i18n->multibyte())
510 XmbDrawString(m_display, menu.title, m_screen->getMenuStyle()->titlefont.getFontSet(), 495 XmbDrawString(m_display, menu.title, m_screen->getMenuStyle()->titlefont.fontSet(),
511 m_screen->getMenuStyle()->t_text_gc, dx, menu.bevel_w - 496 m_screen->getMenuStyle()->t_text_gc, dx, menu.bevel_w -
512 m_screen->getMenuStyle()->titlefont.getFontSetExtents()->max_ink_extent.y, 497 m_screen->getMenuStyle()->titlefont.fontSetExtents()->max_ink_extent.y,
513 text, len); 498 text, len);
514 else 499 else
515 XDrawString(m_display, menu.title, m_screen->getMenuStyle()->t_text_gc, dx, 500 XDrawString(m_display, menu.title, m_screen->getMenuStyle()->t_text_gc, dx,
516 m_screen->getMenuStyle()->titlefont.getFontStruct()->ascent + menu.bevel_w, 501 m_screen->getMenuStyle()->titlefont.fontStruct()->ascent + menu.bevel_w,
517 text, len); 502 text, len);
518} 503}
519 504
@@ -658,18 +643,17 @@ void Basemenu::drawItem(unsigned int index, bool highlight, bool clear,
658 I18n *i18n = I18n::instance(); 643 I18n *i18n = I18n::instance();
659 644
660 if (text) { 645 if (text) {
661 text_w = m_screen->getMenuStyle()->framefont.getTextWidth(text, len); 646 text_w = m_screen->getMenuStyle()->framefont.textWidth(text, len);
662 647
663 if (m_screen->getMenuStyle()->framefont.multibyte()) { 648 if (FbTk::Font::multibyte()) {
664 text_y = item_y + (menu.bevel_w / 2) - 649 text_y = item_y + (menu.bevel_w / 2) -
665 m_screen->getMenuStyle()->framefont.getFontSetExtents()->max_ink_extent.y; 650 m_screen->getMenuStyle()->framefont.fontSetExtents()->max_ink_extent.y;
666 } else { 651 } else {
667 text_y = item_y + 652 text_y = item_y +
668 m_screen->getMenuStyle()->framefont.getFontStruct()->ascent + 653 m_screen->getMenuStyle()->framefont.fontStruct()->ascent +
669 (menu.bevel_w / 2); 654 (menu.bevel_w / 2);
670 } 655 }
671 656
672 // framfont.justify
673 switch(m_screen->getMenuStyle()->framefont_justify) { 657 switch(m_screen->getMenuStyle()->framefont_justify) {
674 case DrawUtil::Font::LEFT: 658 case DrawUtil::Font::LEFT:
675 text_x = item_x + menu.bevel_w + menu.item_h + 1; 659 text_x = item_x + menu.bevel_w + menu.item_h + 1;
@@ -759,7 +743,7 @@ void Basemenu::drawItem(unsigned int index, bool highlight, bool clear,
759 743
760 if (dotext && text) { 744 if (dotext && text) {
761 if (i18n->multibyte()) { 745 if (i18n->multibyte()) {
762 XmbDrawString(m_display, menu.frame, m_screen->getMenuStyle()->framefont.getFontSet(), 746 XmbDrawString(m_display, menu.frame, m_screen->getMenuStyle()->framefont.fontSet(),
763 tgc, text_x, text_y, text, len); 747 tgc, text_x, text_y, text, len);
764 } else 748 } else
765 XDrawString(m_display, menu.frame, tgc, text_x, text_y, text, len); 749 XDrawString(m_display, menu.frame, tgc, text_x, text_y, text, len);