aboutsummaryrefslogtreecommitdiff
path: root/src/Theme.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Theme.cc')
-rw-r--r--src/Theme.cc54
1 files changed, 13 insertions, 41 deletions
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);