aboutsummaryrefslogtreecommitdiff
path: root/src/Theme.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-03-21 10:54:29 (GMT)
committerfluxgen <fluxgen>2002-03-21 10:54:29 (GMT)
commitf44b282b001d2479586215cdc722ce426ca1782a (patch)
tree98677366c70480f0d513b52add7580585e26cc92 /src/Theme.cc
parent3d3985609cd6dddff78558a9c1b3429ed4e891f4 (diff)
downloadfluxbox-f44b282b001d2479586215cdc722ce426ca1782a.zip
fluxbox-f44b282b001d2479586215cdc722ce426ca1782a.tar.bz2
added FbTk font to MenuStyle
Diffstat (limited to 'src/Theme.cc')
-rw-r--r--src/Theme.cc77
1 files changed, 39 insertions, 38 deletions
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),
77m_screennum(screennum), 77m_screennum(screennum),
78m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointer to std::string 78m_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//--------------------
212void Theme::freeMenuStyle() { 215void 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
306void Theme::loadMenuStyle() { 302void 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);