all repos — fluxbox @ 90efb8d2cf3f8d5e15f99c4c0044126d14a24049

custom fork of the fluxbox windowmanager

updated to match new font system
fluxgen fluxgen
commit

90efb8d2cf3f8d5e15f99c4c0044126d14a24049

parent

25f7f0034524fea4fbd455b17fef8288ffd0aa54

2 files changed, 42 insertions(+), 104 deletions(-)

jump to
M src/Basemenu.ccsrc/Basemenu.cc

@@ -22,7 +22,7 @@ // 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. -// $Id: Basemenu.cc,v 1.30 2002/09/10 10:50:04 fluxgen Exp $ +// $Id: Basemenu.cc,v 1.31 2002/10/13 22:37:14 fluxgen Exp $ //use GNU extensions #ifndef _GNU_SOURCE

@@ -39,21 +39,17 @@ #include "Basemenu.hh"

#include "Screen.hh" #include "StringUtil.hh" -#ifdef HAVE_STDIO_H -# include <stdio.h> -#endif // HAVE_STDIO_H +#include <cstdio> +#include <cstdlib> +#include <cstring> -#ifdef STDC_HEADERS -# include <stdlib.h> -# include <string.h> -#endif // STDC_HEADERS #ifdef DEBUG #include <iostream> using namespace std; #endif //DEBUG -static Basemenu *shown = (Basemenu *) 0; +static Basemenu *shown = 0; Basemenu::Basemenu(BScreen *screen): m_fluxbox(Fluxbox::instance()),

@@ -91,31 +87,15 @@ menu.sel_pixmap = None;

menu.bevel_w = m_screen->getBevelWidth(); - I18n *i18n = I18n::instance(); - - if (i18n->multibyte()) { - menu.width = menu.title_h = menu.item_w = menu.frame_h = - m_screen->getMenuStyle()->titlefont.fontSetExtents()->max_ink_extent.height + - (menu.bevel_w * 2); - } else { - menu.width = menu.title_h = menu.item_w = menu.frame_h = - m_screen->getMenuStyle()->titlefont.fontStruct()->ascent + - m_screen->getMenuStyle()->titlefont.fontStruct()->descent + - (menu.bevel_w * 2); - } - + menu.width = menu.title_h = menu.item_w = menu.frame_h = + m_screen->getMenuStyle()->titlefont.height() + menu.bevel_w * 2; + menu.sublevels = menu.persub = menu.minsub = 0; - - if (i18n->multibyte()) { - menu.item_h = m_screen->getMenuStyle()->framefont.fontSetExtents()->max_ink_extent.height + - (menu.bevel_w); - } else { - menu.item_h = m_screen->getMenuStyle()->framefont.fontStruct()->ascent + - m_screen->getMenuStyle()->framefont.fontStruct()->descent + - (menu.bevel_w); - } + + menu.item_h = m_screen->getMenuStyle()->framefont.height() + menu.bevel_w; + menu.height = menu.title_h + m_screen->getBorderWidth() + menu.frame_h; //set attributes for menu window

@@ -265,20 +245,9 @@

void Basemenu::update() { I18n *i18n = I18n::instance(); - if (i18n->multibyte()) { - menu.item_h = m_screen->getMenuStyle()->framefont.fontSetExtents()->max_ink_extent.height + - menu.bevel_w; - menu.title_h = m_screen->getMenuStyle()->titlefont.fontSetExtents()->max_ink_extent.height + - (menu.bevel_w * 2); - } else { - menu.item_h = m_screen->getMenuStyle()->framefont.fontStruct()->ascent + - m_screen->getMenuStyle()->framefont.fontStruct()->descent + - menu.bevel_w; - menu.title_h = m_screen->getMenuStyle()->titlefont.fontStruct()->ascent + - m_screen->getMenuStyle()->titlefont.fontStruct()->descent + - (menu.bevel_w * 2); - } - + menu.item_h = m_screen->getMenuStyle()->framefont.height() + menu.bevel_w; + menu.title_h = m_screen->getMenuStyle()->framefont.height() + menu.bevel_w*2; + if (title_vis) { const char *s = (menu.label!="") ? menu.label.c_str() : i18n->getMessage(

@@ -472,18 +441,14 @@ drawSubmenu(which_sub);

} -void Basemenu::redrawTitle(void) { +void Basemenu::redrawTitle() { I18n *i18n = I18n::instance(); const char *text = menu.label.size() ? menu.label.c_str() : i18n->getMessage( FBNLS::BasemenuSet, FBNLS::BasemenuBlackboxMenu, "fluxbox Menu"); int dx = menu.bevel_w, len = strlen(text); - unsigned int l; - - l = m_screen->getMenuStyle()->titlefont.textWidth(text, len); - - l += (menu.bevel_w * 2); + unsigned int l = m_screen->getMenuStyle()->titlefont.textWidth(text, len) + menu.bevel_w*2; switch (m_screen->getMenuStyle()->titlefont_justify) { case DrawUtil::Font::RIGHT:

@@ -497,15 +462,14 @@ default:

break; } - if (i18n->multibyte()) - XmbDrawString(m_display, menu.title, m_screen->getMenuStyle()->titlefont.fontSet(), - m_screen->getMenuStyle()->t_text_gc, dx, menu.bevel_w - - m_screen->getMenuStyle()->titlefont.fontSetExtents()->max_ink_extent.y, - text, len); - else - XDrawString(m_display, menu.title, m_screen->getMenuStyle()->t_text_gc, dx, - m_screen->getMenuStyle()->titlefont.fontStruct()->ascent + menu.bevel_w, - text, len); + m_screen->getMenuStyle()->titlefont.drawText( + menu.title, // drawable + m_screen->getScreenNumber(), + m_screen->getMenuStyle()->t_text_gc, // graphic context + text, len, // text string with lenght + dx, m_screen->getMenuStyle()->titlefont.height() + menu.bevel_w/2); // position + + }

@@ -646,19 +610,10 @@ int text_x = 0, text_y = 0, len = strlen(text), sel_x = 0, sel_y = 0;

unsigned int hilite_w = menu.item_w, hilite_h = menu.item_h, text_w = 0, text_h = 0; unsigned int half_w = menu.item_h / 2, quarter_w = menu.item_h / 4; - I18n *i18n = I18n::instance(); - if (text) { text_w = m_screen->getMenuStyle()->framefont.textWidth(text, len); - - if (FbTk::Font::multibyte()) { - text_y = item_y + (menu.bevel_w / 2) - - m_screen->getMenuStyle()->framefont.fontSetExtents()->max_ink_extent.y; - } else { - text_y = item_y + - m_screen->getMenuStyle()->framefont.fontStruct()->ascent + - (menu.bevel_w / 2); - } + + text_y = item_y + menu.bevel_w/4 + m_screen->getMenuStyle()->framefont.height(); switch(m_screen->getMenuStyle()->framefont_justify) { case DrawUtil::Font::LEFT:

@@ -748,11 +703,13 @@ }

} if (dotext && text) { - if (i18n->multibyte()) { - XmbDrawString(m_display, menu.frame, m_screen->getMenuStyle()->framefont.fontSet(), - tgc, text_x, text_y, text, len); - } else - XDrawString(m_display, menu.frame, tgc, text_x, text_y, text, len); + m_screen->getMenuStyle()->framefont.drawText( + menu.frame, // drawable + m_screen->getScreenNumber(), + tgc, + text, len, // text string and lenght + text_x, text_y); // position + } if (dosel && item->submenu()) {
M src/Theme.hhsrc/Theme.hh

@@ -1,6 +1,9 @@

// Theme.hh for fluxbox // Copyright (c) 2001-2002 Henrik Kinnunen (fluxgen@linuxmail.org) // +// A lot of the base code is taken from Screen.hh in Blackbox 0.61.1 +// Screen.cc - Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) +// // 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

@@ -13,34 +16,13 @@ // 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 +// 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. -// -// A lot of the base code is taken from Screen.hh in Blackbox 0.61.1 -// Screen.cc - Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) -// -// 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. -// $Id: Theme.hh,v 1.13 2002/08/04 15:55:13 fluxgen Exp $ +// $Id: Theme.hh,v 1.14 2002/10/13 22:34:03 fluxgen Exp $ #ifndef THEME_HH #define THEME_HH

@@ -57,8 +39,7 @@ /**

Main theme class, holds themes for Window, toolbar, slit, menu and the rootCommand, for a specific screen. */ -class Theme -{ +class Theme { public: Theme(Display *display, Window rootwindow, Colormap colormap,

@@ -67,8 +48,8 @@ ~Theme();

typedef struct MenuStyle { - MenuStyle(Display *display):titlefont(display, "fixed"), - framefont(display, "fixed") { } + MenuStyle():titlefont("fixed"), + framefont("fixed") { } FbTk::Color t_text, f_text, h_text, d_text; FbTk::Texture title, frame, hilite; GC t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc;

@@ -142,7 +123,7 @@ void freeMenuStyle();

void freeWindowStyle(); void freeTabStyle(); void freeToolbarStyle(); - + void loadFontFromDatabase(FbTk::Font &dest, const char *name, const char *altname); bool readDatabaseTexture(char *, char *, FbTk::Texture *, unsigned long); bool readDatabaseColor(char *, char *, FbTk::Color *, unsigned long);