diff options
-rw-r--r-- | src/Theme.cc | 57 | ||||
-rw-r--r-- | src/Theme.hh | 7 |
2 files changed, 19 insertions, 45 deletions
diff --git a/src/Theme.cc b/src/Theme.cc index a6ea86c..ada4daa 100644 --- a/src/Theme.cc +++ b/src/Theme.cc | |||
@@ -21,7 +21,7 @@ | |||
21 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 21 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
22 | // DEALINGS IN THE SOFTWARE. | 22 | // DEALINGS IN THE SOFTWARE. |
23 | 23 | ||
24 | // $Id: Theme.cc,v 1.31 2002/10/15 17:08:45 fluxgen Exp $ | 24 | // $Id: Theme.cc,v 1.32 2002/10/29 16:07:27 fluxgen Exp $ |
25 | 25 | ||
26 | #ifndef _GNU_SOURCE | 26 | #ifndef _GNU_SOURCE |
27 | #define _GNU_SOURCE | 27 | #define _GNU_SOURCE |
@@ -62,9 +62,6 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe | |||
62 | #endif //DEBUG | 62 | #endif //DEBUG |
63 | //default settings | 63 | //default settings |
64 | 64 | ||
65 | m_toolbarstyle.font.set = 0; | ||
66 | m_toolbarstyle.font.fontstruct = 0; | ||
67 | |||
68 | load(filename); | 65 | load(filename); |
69 | //-------- create gc for the styles ------------ | 66 | //-------- create gc for the styles ------------ |
70 | 67 | ||
@@ -114,15 +111,12 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe | |||
114 | GCForeground, &gcv); | 111 | GCForeground, &gcv); |
115 | 112 | ||
116 | gcv.foreground = m_menustyle.t_text.pixel(); | 113 | gcv.foreground = m_menustyle.t_text.pixel(); |
117 | //if (m_menustyle.titlefont.fontStruct()) | 114 | |
118 | // gcv.font = m_menustyle.titlefont.fontStruct()->fid; | ||
119 | m_menustyle.t_text_gc = | 115 | m_menustyle.t_text_gc = |
120 | XCreateGC(m_display, rootwindow, | 116 | XCreateGC(m_display, rootwindow, |
121 | gc_value_mask, &gcv); | 117 | gc_value_mask, &gcv); |
122 | 118 | ||
123 | gcv.foreground = m_menustyle.f_text.pixel(); | 119 | gcv.foreground = m_menustyle.f_text.pixel(); |
124 | //if (m_menustyle.framefont.fontStruct()) | ||
125 | // gcv.font = m_menustyle.framefont.fontStruct()->fid; | ||
126 | 120 | ||
127 | m_menustyle.f_text_gc = | 121 | m_menustyle.f_text_gc = |
128 | XCreateGC(m_display, rootwindow, | 122 | XCreateGC(m_display, rootwindow, |
@@ -144,8 +138,7 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe | |||
144 | gc_value_mask, &gcv); | 138 | gc_value_mask, &gcv); |
145 | 139 | ||
146 | gcv.foreground = m_toolbarstyle.l_text.pixel(); | 140 | gcv.foreground = m_toolbarstyle.l_text.pixel(); |
147 | if (m_toolbarstyle.font.fontstruct) | 141 | |
148 | gcv.font = m_toolbarstyle.font.fontstruct->fid; | ||
149 | m_toolbarstyle.l_text_gc = | 142 | m_toolbarstyle.l_text_gc = |
150 | XCreateGC(m_display, rootwindow, | 143 | XCreateGC(m_display, rootwindow, |
151 | gc_value_mask, &gcv); | 144 | gc_value_mask, &gcv); |
@@ -212,12 +205,6 @@ void Theme::freeTabStyle() { | |||
212 | //-------------------- | 205 | //-------------------- |
213 | void Theme::freeToolbarStyle() { | 206 | void Theme::freeToolbarStyle() { |
214 | 207 | ||
215 | if (m_toolbarstyle.font.set) | ||
216 | XFreeFontSet(m_display, m_toolbarstyle.font.set); | ||
217 | |||
218 | if (m_toolbarstyle.font.fontstruct) | ||
219 | XFreeFont(m_display, m_toolbarstyle.font.fontstruct); | ||
220 | |||
221 | XFreeGC(m_display, m_toolbarstyle.l_text_gc); | 208 | XFreeGC(m_display, m_toolbarstyle.l_text_gc); |
222 | XFreeGC(m_display, m_toolbarstyle.w_text_gc); | 209 | XFreeGC(m_display, m_toolbarstyle.w_text_gc); |
223 | XFreeGC(m_display, m_toolbarstyle.c_text_gc); | 210 | XFreeGC(m_display, m_toolbarstyle.c_text_gc); |
@@ -546,29 +533,21 @@ void Theme::loadToolbarStyle() { | |||
546 | 533 | ||
547 | // ----------- load font | 534 | // ----------- load font |
548 | 535 | ||
549 | if (I18n::instance()->multibyte()) { | 536 | loadFontFromDatabase(m_toolbarstyle.font, "toolbar.font", "Toolbar.Font"); |
550 | readDatabaseFontSet("toolbar.font", "Toolbar.Font", | 537 | |
551 | &m_toolbarstyle.font.set); | ||
552 | |||
553 | m_toolbarstyle.font.set_extents = | ||
554 | XExtentsOfFontSet(m_toolbarstyle.font.set); | ||
555 | } else { | ||
556 | readDatabaseFont("toolbar.font", "Toolbar.Font", | ||
557 | &m_toolbarstyle.font.fontstruct); | ||
558 | } | ||
559 | XrmValue value; | 538 | XrmValue value; |
560 | char *value_type; | 539 | char *value_type; |
561 | 540 | ||
562 | if (XrmGetResource(m_database, "toolbar.justify", | 541 | if (XrmGetResource(m_database, "toolbar.justify", |
563 | "Toolbar.Justify", &value_type, &value)) { | 542 | "Toolbar.Justify", &value_type, &value)) { |
564 | if (strstr(value.addr, "right") || strstr(value.addr, "Right")) | 543 | if (strstr(value.addr, "right") || strstr(value.addr, "Right")) |
565 | m_toolbarstyle.font.justify = DrawUtil::Font::RIGHT; | 544 | m_toolbarstyle.justify = DrawUtil::Font::RIGHT; |
566 | else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) | 545 | else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) |
567 | m_toolbarstyle.font.justify = DrawUtil::Font::CENTER; | 546 | m_toolbarstyle.justify = DrawUtil::Font::CENTER; |
568 | else | 547 | else |
569 | m_toolbarstyle.font.justify = DrawUtil::Font::LEFT; | 548 | m_toolbarstyle.justify = DrawUtil::Font::LEFT; |
570 | } else | 549 | } else |
571 | m_toolbarstyle.font.justify = DrawUtil::Font::LEFT; | 550 | m_toolbarstyle.justify = DrawUtil::Font::LEFT; |
572 | 551 | ||
573 | } | 552 | } |
574 | 553 | ||
@@ -577,7 +556,7 @@ void Theme::loadRootCommand() { | |||
577 | char *value_type; | 556 | char *value_type; |
578 | 557 | ||
579 | if (m_rootcommand.size()) { | 558 | if (m_rootcommand.size()) { |
580 | #ifndef __EMX__ | 559 | #ifndef __EMX__ |
581 | char tmpstring[256]; //to hold m_screennum | 560 | char tmpstring[256]; //to hold m_screennum |
582 | tmpstring[0]=0; | 561 | tmpstring[0]=0; |
583 | sprintf(tmpstring, "%d", m_screennum); | 562 | sprintf(tmpstring, "%d", m_screennum); |
@@ -587,13 +566,13 @@ void Theme::loadRootCommand() { | |||
587 | 566 | ||
588 | bexec(m_rootcommand.c_str(), const_cast<char *>(displaystring.c_str())); | 567 | bexec(m_rootcommand.c_str(), const_cast<char *>(displaystring.c_str())); |
589 | 568 | ||
590 | #else // __EMX__ | 569 | #else // __EMX__ |
591 | spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", m_rootcommand.c_str(), 0); | 570 | spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", m_rootcommand.c_str(), 0); |
592 | #endif // !__EMX__ | 571 | #endif // !__EMX__ |
593 | 572 | ||
594 | } else if (XrmGetResource(m_database, "rootCommand", "RootCommand", | 573 | } else if (XrmGetResource(m_database, "rootCommand", "RootCommand", |
595 | &value_type, &value)) { | 574 | &value_type, &value)) { |
596 | #ifndef __EMX__ | 575 | #ifndef __EMX__ |
597 | char tmpstring[256]; //to hold m_screennum | 576 | char tmpstring[256]; //to hold m_screennum |
598 | tmpstring[0]=0; | 577 | tmpstring[0]=0; |
599 | sprintf(tmpstring, "%d", m_screennum); | 578 | sprintf(tmpstring, "%d", m_screennum); |
@@ -602,11 +581,9 @@ void Theme::loadRootCommand() { | |||
602 | displaystring.append(tmpstring); // append m_screennum | 581 | displaystring.append(tmpstring); // append m_screennum |
603 | 582 | ||
604 | bexec(value.addr, const_cast<char *>(displaystring.c_str())); | 583 | bexec(value.addr, const_cast<char *>(displaystring.c_str())); |
605 | #else // __EMX__ | 584 | #else // __EMX__ |
606 | |||
607 | spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", value.addr, 0); | 585 | spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", value.addr, 0); |
608 | 586 | #endif // !__EMX__ | |
609 | #endif // !__EMX__ | ||
610 | 587 | ||
611 | } | 588 | } |
612 | #ifdef DEBUG | 589 | #ifdef DEBUG |
@@ -938,10 +915,6 @@ void Theme::reconfigure(bool antialias) { | |||
938 | XChangeGC(m_display, m_menustyle.hilite_gc, | 915 | XChangeGC(m_display, m_menustyle.hilite_gc, |
939 | gc_value_mask, &gcv); | 916 | gc_value_mask, &gcv); |
940 | 917 | ||
941 | gcv.foreground = m_toolbarstyle.l_text.pixel(); | ||
942 | if (m_toolbarstyle.font.fontstruct) | ||
943 | gcv.font = m_toolbarstyle.font.fontstruct->fid; | ||
944 | |||
945 | gc_value_mask |= GCFont; | 918 | gc_value_mask |= GCFont; |
946 | XChangeGC(m_display, m_toolbarstyle.l_text_gc, | 919 | XChangeGC(m_display, m_toolbarstyle.l_text_gc, |
947 | gc_value_mask, &gcv); | 920 | gc_value_mask, &gcv); |
diff --git a/src/Theme.hh b/src/Theme.hh index 3ab4f27..adabc39 100644 --- a/src/Theme.hh +++ b/src/Theme.hh | |||
@@ -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: Theme.hh,v 1.16 2002/10/15 17:07:32 fluxgen Exp $ | 25 | // $Id: Theme.hh,v 1.17 2002/10/29 16:06:23 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef THEME_HH | 27 | #ifndef THEME_HH |
28 | #define THEME_HH | 28 | #define THEME_HH |
@@ -89,11 +89,12 @@ public: | |||
89 | 89 | ||
90 | 90 | ||
91 | typedef struct ToolbarStyle { | 91 | typedef struct ToolbarStyle { |
92 | ToolbarStyle():font("fixed") { } // default font 'fixed' | ||
92 | FbTk::Color l_text, w_text, c_text, b_pic; | 93 | FbTk::Color l_text, w_text, c_text, b_pic; |
93 | FbTk::Texture toolbar, label, window, button, pressed, clock; | 94 | FbTk::Texture toolbar, label, window, button, pressed, clock; |
94 | GC l_text_gc, w_text_gc, c_text_gc, b_pic_gc; | 95 | GC l_text_gc, w_text_gc, c_text_gc, b_pic_gc; |
95 | DrawUtil::Font font; | 96 | FbTk::Font font; |
96 | 97 | DrawUtil::Font::FontJustify justify; | |
97 | } ToolbarStyle; | 98 | } ToolbarStyle; |
98 | 99 | ||
99 | inline WindowStyle &getWindowStyle() { return m_windowstyle; } | 100 | inline WindowStyle &getWindowStyle() { return m_windowstyle; } |