diff options
author | fluxgen <fluxgen> | 2002-12-02 20:54:30 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-12-02 20:54:30 (GMT) |
commit | fdb116cec505d9f48ac38a659756b473ae96813f (patch) | |
tree | 393503456955e5865c74b7555465cfc082d4a282 /src/Theme.cc | |
parent | ab1204e53a51d1517137e67c4a4e1126acc929db (diff) | |
download | fluxbox-fdb116cec505d9f48ac38a659756b473ae96813f.zip fluxbox-fdb116cec505d9f48ac38a659756b473ae96813f.tar.bz2 |
removed Toolbar theme
Diffstat (limited to 'src/Theme.cc')
-rw-r--r-- | src/Theme.cc | 140 |
1 files changed, 12 insertions, 128 deletions
diff --git a/src/Theme.cc b/src/Theme.cc index f98dace..b0dbf94 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.38 2002/12/01 13:42:00 rathnor Exp $ | 24 | // $Id: Theme.cc,v 1.39 2002/12/02 20:54:30 fluxgen Exp $ |
25 | 25 | ||
26 | 26 | ||
27 | #include "Theme.hh" | 27 | #include "Theme.hh" |
@@ -134,35 +134,12 @@ Theme::Theme(Display *display, Window rootwindow, Colormap colormap, | |||
134 | m_menustyle.hilite_gc = | 134 | m_menustyle.hilite_gc = |
135 | XCreateGC(m_display, rootwindow, | 135 | XCreateGC(m_display, rootwindow, |
136 | gc_value_mask, &gcv); | 136 | gc_value_mask, &gcv); |
137 | |||
138 | gcv.foreground = m_toolbarstyle.l_text.pixel(); | ||
139 | |||
140 | m_toolbarstyle.l_text_gc = | ||
141 | XCreateGC(m_display, rootwindow, | ||
142 | gc_value_mask, &gcv); | ||
143 | |||
144 | gcv.foreground = m_toolbarstyle.w_text.pixel(); | ||
145 | m_toolbarstyle.w_text_gc = | ||
146 | XCreateGC(m_display, rootwindow, | ||
147 | gc_value_mask, &gcv); | ||
148 | |||
149 | gcv.foreground = m_toolbarstyle.c_text.pixel(); | ||
150 | m_toolbarstyle.c_text_gc = | ||
151 | XCreateGC(m_display, rootwindow, | ||
152 | gc_value_mask, &gcv); | ||
153 | |||
154 | gcv.foreground = m_toolbarstyle.b_pic.pixel(); | ||
155 | m_toolbarstyle.b_pic_gc = | ||
156 | XCreateGC(m_display, rootwindow, | ||
157 | gc_value_mask, &gcv); | ||
158 | |||
159 | } | 137 | } |
160 | 138 | ||
161 | Theme::~Theme() { | 139 | Theme::~Theme() { |
162 | 140 | ||
163 | freeMenuStyle(); | 141 | freeMenuStyle(); |
164 | freeWindowStyle(); | 142 | freeWindowStyle(); |
165 | freeToolbarStyle(); | ||
166 | freeTabStyle(); | 143 | freeTabStyle(); |
167 | } | 144 | } |
168 | 145 | ||
@@ -197,19 +174,6 @@ void Theme::freeTabStyle() { | |||
197 | XFreeGC(m_display, m_windowstyle.tab.l_text_unfocus_gc); | 174 | XFreeGC(m_display, m_windowstyle.tab.l_text_unfocus_gc); |
198 | } | 175 | } |
199 | 176 | ||
200 | //----- freeToolbarStyle ----- | ||
201 | // free memory allocated for m_toolbarstyle | ||
202 | // should only be called from ~Theme | ||
203 | //-------------------- | ||
204 | void Theme::freeToolbarStyle() { | ||
205 | |||
206 | XFreeGC(m_display, m_toolbarstyle.l_text_gc); | ||
207 | XFreeGC(m_display, m_toolbarstyle.w_text_gc); | ||
208 | XFreeGC(m_display, m_toolbarstyle.c_text_gc); | ||
209 | XFreeGC(m_display, m_toolbarstyle.b_pic_gc); | ||
210 | |||
211 | } | ||
212 | |||
213 | //---------- load ------------ | 177 | //---------- load ------------ |
214 | // Loads a theme from a file | 178 | // Loads a theme from a file |
215 | //---------------------------- | 179 | //---------------------------- |
@@ -219,7 +183,6 @@ void Theme::load(const char *filename){ | |||
219 | m_database = XrmGetFileDatabase(DEFAULTSTYLE); | 183 | m_database = XrmGetFileDatabase(DEFAULTSTYLE); |
220 | 184 | ||
221 | loadMenuStyle(); | 185 | loadMenuStyle(); |
222 | loadToolbarStyle(); | ||
223 | loadWindowStyle(); | 186 | loadWindowStyle(); |
224 | loadTabStyle(); | 187 | loadTabStyle(); |
225 | loadRootCommand(); | 188 | loadRootCommand(); |
@@ -482,64 +445,6 @@ void Theme::loadTabStyle() { | |||
482 | 445 | ||
483 | } | 446 | } |
484 | 447 | ||
485 | void Theme::loadToolbarStyle() { | ||
486 | |||
487 | readDatabaseTexture("toolbar", "Toolbar", | ||
488 | &m_toolbarstyle.toolbar, | ||
489 | BlackPixel(m_display, m_screennum)); | ||
490 | readDatabaseTexture("toolbar.label", "Toolbar.Label", | ||
491 | &m_toolbarstyle.label, | ||
492 | BlackPixel(m_display, m_screennum)); | ||
493 | readDatabaseTexture("toolbar.windowLabel", "Toolbar.WindowLabel", | ||
494 | &m_toolbarstyle.window, | ||
495 | BlackPixel(m_display, m_screennum)); | ||
496 | readDatabaseTexture("toolbar.button", "Toolbar.Button", | ||
497 | &m_toolbarstyle.button, | ||
498 | WhitePixel(m_display, m_screennum)); | ||
499 | readDatabaseTexture("toolbar.button.pressed", "Toolbar.Button.Pressed", | ||
500 | &m_toolbarstyle.pressed, | ||
501 | BlackPixel(m_display, m_screennum)); | ||
502 | readDatabaseTexture("toolbar.clock", "Toolbar.Clock", | ||
503 | &m_toolbarstyle.clock, | ||
504 | BlackPixel(m_display, m_screennum)); | ||
505 | |||
506 | readDatabaseColor("toolbar.label.textColor", "Toolbar.Label.TextColor", | ||
507 | &m_toolbarstyle.l_text, | ||
508 | WhitePixel(m_display, m_screennum)); | ||
509 | |||
510 | readDatabaseColor("toolbar.windowLabel.textColor", | ||
511 | "Toolbar.WindowLabel.TextColor", | ||
512 | &m_toolbarstyle.w_text, | ||
513 | WhitePixel(m_display, m_screennum)); | ||
514 | |||
515 | readDatabaseColor("toolbar.clock.textColor", "Toolbar.Clock.TextColor", | ||
516 | &m_toolbarstyle.c_text, | ||
517 | WhitePixel(m_display, m_screennum)); | ||
518 | readDatabaseColor("toolbar.button.picColor", "Toolbar.Button.PicColor", | ||
519 | &m_toolbarstyle.b_pic, | ||
520 | BlackPixel(m_display, m_screennum)); | ||
521 | |||
522 | |||
523 | // ----------- load font | ||
524 | |||
525 | loadFontFromDatabase(m_toolbarstyle.font, "toolbar.font", "Toolbar.Font"); | ||
526 | |||
527 | XrmValue value; | ||
528 | char *value_type; | ||
529 | |||
530 | if (XrmGetResource(m_database, "toolbar.justify", | ||
531 | "Toolbar.Justify", &value_type, &value)) { | ||
532 | if (strstr(value.addr, "right") || strstr(value.addr, "Right")) | ||
533 | m_toolbarstyle.justify = DrawUtil::Font::RIGHT; | ||
534 | else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) | ||
535 | m_toolbarstyle.justify = DrawUtil::Font::CENTER; | ||
536 | else | ||
537 | m_toolbarstyle.justify = DrawUtil::Font::LEFT; | ||
538 | } else | ||
539 | m_toolbarstyle.justify = DrawUtil::Font::LEFT; | ||
540 | |||
541 | } | ||
542 | |||
543 | void Theme::loadRootCommand() { | 448 | void Theme::loadRootCommand() { |
544 | XrmValue value; | 449 | XrmValue value; |
545 | char *value_type; | 450 | char *value_type; |
@@ -627,7 +532,7 @@ void Theme::loadMisc() { | |||
627 | if (!readDatabaseTexture("slit", "Slit", | 532 | if (!readDatabaseTexture("slit", "Slit", |
628 | &m_slit_texture, | 533 | &m_slit_texture, |
629 | BlackPixel(m_display, m_screennum)) ) { | 534 | BlackPixel(m_display, m_screennum)) ) { |
630 | m_slit_texture = m_toolbarstyle.toolbar; | 535 | // m_slit_texture = m_toolbarstyle.toolbar; ///!!! TODO !!! |
631 | } | 536 | } |
632 | 537 | ||
633 | } | 538 | } |
@@ -779,12 +684,11 @@ void Theme::readDatabaseFontSet(char *rname, char *rclass, XFontSet *fontset) { | |||
779 | *fontset = createFontSet(defaultFont); | 684 | *fontset = createFontSet(defaultFont); |
780 | 685 | ||
781 | if (! *fontset) { | 686 | if (! *fontset) { |
782 | fprintf(stderr, | 687 | throw string( |
783 | I18n::instance()-> | 688 | I18n::instance()-> |
784 | getMessage( | 689 | getMessage( |
785 | FBNLS::ScreenSet, FBNLS::ScreenDefaultFontLoadFail, | 690 | FBNLS::ScreenSet, FBNLS::ScreenDefaultFontLoadFail, |
786 | "BScreen::LoadStyle(): couldn't load default font.\n")); | 691 | "BScreen::LoadStyle(): couldn't load default font.")); |
787 | throw 2; | ||
788 | } | 692 | } |
789 | } | 693 | } |
790 | } | 694 | } |
@@ -811,8 +715,8 @@ void Theme::readDatabaseFont(char *rname, char *rclass, XFontStruct **font) { | |||
811 | fprintf(stderr, | 715 | fprintf(stderr, |
812 | I18n::instance()-> | 716 | I18n::instance()-> |
813 | getMessage( | 717 | getMessage( |
814 | FBNLS::ScreenSet, FBNLS::ScreenFontLoadFail, | 718 | FBNLS::ScreenSet, FBNLS::ScreenFontLoadFail, |
815 | "BScreen::LoadStyle(): couldn't load font '%s'\n"), | 719 | "BScreen::LoadStyle(): couldn't load font '%s'\n"), |
816 | value.addr); | 720 | value.addr); |
817 | 721 | ||
818 | load_default = true; | 722 | load_default = true; |
@@ -822,12 +726,12 @@ void Theme::readDatabaseFont(char *rname, char *rclass, XFontStruct **font) { | |||
822 | 726 | ||
823 | if (load_default) { | 727 | if (load_default) { |
824 | if ((*font = XLoadQueryFont(m_display, defaultFont)) == 0) { | 728 | if ((*font = XLoadQueryFont(m_display, defaultFont)) == 0) { |
825 | fprintf(stderr, | 729 | throw string( |
826 | I18n::instance()-> | 730 | I18n::instance()-> |
827 | getMessage( | 731 | getMessage( |
828 | FBNLS::ScreenSet, FBNLS::ScreenDefaultFontLoadFail, | 732 | FBNLS::ScreenSet, FBNLS::ScreenDefaultFontLoadFail, |
829 | "BScreen::LoadStyle(): couldn't load default font.\n")); | 733 | "BScreen::LoadStyle(): couldn't load default font.")); |
830 | throw 2; //fatal! | 734 | |
831 | } | 735 | } |
832 | } | 736 | } |
833 | } | 737 | } |
@@ -904,26 +808,6 @@ void Theme::reconfigure(bool antialias) { | |||
904 | XChangeGC(m_display, m_menustyle.hilite_gc, | 808 | XChangeGC(m_display, m_menustyle.hilite_gc, |
905 | gc_value_mask, &gcv); | 809 | gc_value_mask, &gcv); |
906 | 810 | ||
907 | // set antialias ? | ||
908 | if (m_toolbarstyle.font.isAntialias() != antialias) | ||
909 | m_toolbarstyle.font.setAntialias(antialias); | ||
910 | |||
911 | gcv.foreground = m_toolbarstyle.l_text.pixel(); | ||
912 | XChangeGC(m_display, m_toolbarstyle.l_text_gc, | ||
913 | gc_value_mask, &gcv); | ||
914 | |||
915 | gcv.foreground = m_toolbarstyle.w_text.pixel(); | ||
916 | XChangeGC(m_display, m_toolbarstyle.w_text_gc, | ||
917 | gc_value_mask, &gcv); | ||
918 | |||
919 | gcv.foreground = m_toolbarstyle.c_text.pixel(); | ||
920 | XChangeGC(m_display, m_toolbarstyle.c_text_gc, | ||
921 | gc_value_mask, &gcv); | ||
922 | |||
923 | gcv.foreground = m_toolbarstyle.b_pic.pixel(); | ||
924 | XChangeGC(m_display, m_toolbarstyle.b_pic_gc, | ||
925 | gc_value_mask, &gcv); | ||
926 | |||
927 | } | 811 | } |
928 | 812 | ||
929 | XFontSet Theme::createFontSet(char *fontname) { | 813 | XFontSet Theme::createFontSet(char *fontname) { |