aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Theme.cc102
1 files changed, 50 insertions, 52 deletions
diff --git a/src/Theme.cc b/src/Theme.cc
index d0674f5..cff14d8 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.21 2002/05/15 09:35:49 fluxgen Exp $ 44// $Id: Theme.cc,v 1.22 2002/07/19 21:45:00 fluxgen Exp $
45 45
46#ifndef _GNU_SOURCE 46#ifndef _GNU_SOURCE
47#define _GNU_SOURCE 47#define _GNU_SOURCE
@@ -104,7 +104,7 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe
104 m_opgc = XCreateGC(m_display, rootwindow, 104 m_opgc = XCreateGC(m_display, rootwindow,
105 GCForeground | GCFunction | GCSubwindowMode, &gcv); 105 GCForeground | GCFunction | GCSubwindowMode, &gcv);
106 106
107 gcv.foreground = m_windowstyle.l_text_focus.getPixel(); 107 gcv.foreground = m_windowstyle.l_text_focus.pixel();
108 if (m_windowstyle.font.fontstruct) 108 if (m_windowstyle.font.fontstruct)
109 gcv.font = m_windowstyle.font.fontstruct->fid; 109 gcv.font = m_windowstyle.font.fontstruct->fid;
110 110
@@ -112,7 +112,7 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe
112 XCreateGC(m_display, rootwindow, 112 XCreateGC(m_display, rootwindow,
113 gc_value_mask, &gcv); 113 gc_value_mask, &gcv);
114 114
115 gcv.foreground = m_windowstyle.l_text_unfocus.getPixel(); 115 gcv.foreground = m_windowstyle.l_text_unfocus.pixel();
116 if (m_windowstyle.font.fontstruct) 116 if (m_windowstyle.font.fontstruct)
117 gcv.font = m_windowstyle.font.fontstruct->fid; 117 gcv.font = m_windowstyle.font.fontstruct->fid;
118 m_windowstyle.l_text_unfocus_gc = 118 m_windowstyle.l_text_unfocus_gc =
@@ -120,7 +120,7 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe
120 gc_value_mask, &gcv); 120 gc_value_mask, &gcv);
121 121
122 //---- Tab 122 //---- Tab
123 gcv.foreground = m_windowstyle.tab.l_text_focus.getPixel(); 123 gcv.foreground = m_windowstyle.tab.l_text_focus.pixel();
124 if (m_windowstyle.tab.font.fontstruct) 124 if (m_windowstyle.tab.font.fontstruct)
125 gcv.font = m_windowstyle.tab.font.fontstruct->fid; 125 gcv.font = m_windowstyle.tab.font.fontstruct->fid;
126 126
@@ -128,7 +128,7 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe
128 XCreateGC(m_display, rootwindow, 128 XCreateGC(m_display, rootwindow,
129 gc_value_mask, &gcv); 129 gc_value_mask, &gcv);
130 130
131 gcv.foreground = m_windowstyle.tab.l_text_unfocus.getPixel(); 131 gcv.foreground = m_windowstyle.tab.l_text_unfocus.pixel();
132 m_windowstyle.tab.l_text_unfocus_gc = 132 m_windowstyle.tab.l_text_unfocus_gc =
133 XCreateGC(m_display, rootwindow, 133 XCreateGC(m_display, rootwindow,
134 gc_value_mask, &gcv); 134 gc_value_mask, &gcv);
@@ -136,24 +136,24 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe
136 //---end Tab 136 //---end Tab
137 137
138 138
139 gcv.foreground = m_windowstyle.b_pic_focus.getPixel(); 139 gcv.foreground = m_windowstyle.b_pic_focus.pixel();
140 m_windowstyle.b_pic_focus_gc = 140 m_windowstyle.b_pic_focus_gc =
141 XCreateGC(m_display, rootwindow, 141 XCreateGC(m_display, rootwindow,
142 GCForeground, &gcv); 142 GCForeground, &gcv);
143 143
144 gcv.foreground = m_windowstyle.b_pic_unfocus.getPixel(); 144 gcv.foreground = m_windowstyle.b_pic_unfocus.pixel();
145 m_windowstyle.b_pic_unfocus_gc = 145 m_windowstyle.b_pic_unfocus_gc =
146 XCreateGC(m_display, rootwindow, 146 XCreateGC(m_display, rootwindow,
147 GCForeground, &gcv); 147 GCForeground, &gcv);
148 148
149 gcv.foreground = m_menustyle.t_text.getPixel(); 149 gcv.foreground = m_menustyle.t_text.pixel();
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.pixel();
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
@@ -161,39 +161,39 @@ m_rootcommand(rootcommand==0 ? "" : rootcommand) //we dont want to send 0-pointe
161 XCreateGC(m_display, rootwindow, 161 XCreateGC(m_display, rootwindow,
162 gc_value_mask, &gcv); 162 gc_value_mask, &gcv);
163 163
164 gcv.foreground = m_menustyle.h_text.getPixel(); 164 gcv.foreground = m_menustyle.h_text.pixel();
165 m_menustyle.h_text_gc = 165 m_menustyle.h_text_gc =
166 XCreateGC(m_display, rootwindow, 166 XCreateGC(m_display, rootwindow,
167 gc_value_mask, &gcv); 167 gc_value_mask, &gcv);
168 168
169 gcv.foreground = m_menustyle.d_text.getPixel(); 169 gcv.foreground = m_menustyle.d_text.pixel();
170 m_menustyle.d_text_gc = 170 m_menustyle.d_text_gc =
171 XCreateGC(m_display, rootwindow, 171 XCreateGC(m_display, rootwindow,
172 gc_value_mask, &gcv); 172 gc_value_mask, &gcv);
173 173
174 gcv.foreground = m_menustyle.hilite.getColor()->getPixel(); 174 gcv.foreground = m_menustyle.hilite.color().pixel();
175 m_menustyle.hilite_gc = 175 m_menustyle.hilite_gc =
176 XCreateGC(m_display, rootwindow, 176 XCreateGC(m_display, rootwindow,
177 gc_value_mask, &gcv); 177 gc_value_mask, &gcv);
178 178
179 gcv.foreground = m_toolbarstyle.l_text.getPixel(); 179 gcv.foreground = m_toolbarstyle.l_text.pixel();
180 if (m_toolbarstyle.font.fontstruct) 180 if (m_toolbarstyle.font.fontstruct)
181 gcv.font = m_toolbarstyle.font.fontstruct->fid; 181 gcv.font = m_toolbarstyle.font.fontstruct->fid;
182 m_toolbarstyle.l_text_gc = 182 m_toolbarstyle.l_text_gc =
183 XCreateGC(m_display, rootwindow, 183 XCreateGC(m_display, rootwindow,
184 gc_value_mask, &gcv); 184 gc_value_mask, &gcv);
185 185
186 gcv.foreground = m_toolbarstyle.w_text.getPixel(); 186 gcv.foreground = m_toolbarstyle.w_text.pixel();
187 m_toolbarstyle.w_text_gc = 187 m_toolbarstyle.w_text_gc =
188 XCreateGC(m_display, rootwindow, 188 XCreateGC(m_display, rootwindow,
189 gc_value_mask, &gcv); 189 gc_value_mask, &gcv);
190 190
191 gcv.foreground = m_toolbarstyle.c_text.getPixel(); 191 gcv.foreground = m_toolbarstyle.c_text.pixel();
192 m_toolbarstyle.c_text_gc = 192 m_toolbarstyle.c_text_gc =
193 XCreateGC(m_display, rootwindow, 193 XCreateGC(m_display, rootwindow,
194 gc_value_mask, &gcv); 194 gc_value_mask, &gcv);
195 195
196 gcv.foreground = m_toolbarstyle.b_pic.getPixel(); 196 gcv.foreground = m_toolbarstyle.b_pic.pixel();
197 m_toolbarstyle.b_pic_gc = 197 m_toolbarstyle.b_pic_gc =
198 XCreateGC(m_display, rootwindow, 198 XCreateGC(m_display, rootwindow,
199 gc_value_mask, &gcv); 199 gc_value_mask, &gcv);
@@ -729,7 +729,7 @@ bool Theme::readDatabaseTexture(char *rname, char *rclass,
729 sprintf(colorclass, "%s.Color", rclass); 729 sprintf(colorclass, "%s.Color", rclass);
730 sprintf(colorname, "%s.color", rname); 730 sprintf(colorname, "%s.color", rname);
731 731
732 if (!readDatabaseColor(colorname, colorclass, texture->getColor(), 732 if (!readDatabaseColor(colorname, colorclass, &texture->color(),
733 default_pixel)) 733 default_pixel))
734 retval = false; 734 retval = false;
735 735
@@ -737,51 +737,50 @@ bool Theme::readDatabaseTexture(char *rname, char *rclass,
737 sprintf(colorclass, "%s.ColorTo", rclass); 737 sprintf(colorclass, "%s.ColorTo", rclass);
738 sprintf(colorname, "%s.colorTo", rname); 738 sprintf(colorname, "%s.colorTo", rname);
739 739
740 readDatabaseColor(colorname, colorclass, texture->getColorTo(), 740 readDatabaseColor(colorname, colorclass, &texture->colorTo(), default_pixel);
741 default_pixel);
742#endif // INTERLACE 741#endif // INTERLACE
743 742
744 delete [] colorclass; 743 delete [] colorclass;
745 delete [] colorname; 744 delete [] colorname;
746 745
747 if ((! texture->getColor()->isAllocated()) || 746 if ((! texture->color().isAllocated()) ||
748 (texture->getTexture() & BImage::FLAT)) 747 (texture->getTexture() & BImage::FLAT))
749 return retval; 748 return retval;
750 749
751 XColor xcol; 750 XColor xcol;
752 751
753 xcol.red = (unsigned int) (texture->getColor()->getRed() + 752 xcol.red = (unsigned int) (texture->color().red() +
754 (texture->getColor()->getRed() >> 1)); 753 (texture->color().red() >> 1));
755 if (xcol.red >= 0xff) xcol.red = 0xffff; 754 if (xcol.red >= 0xff) xcol.red = 0xffff;
756 else xcol.red *= 0xff; 755 else xcol.red *= 0xff;
757 xcol.green = (unsigned int) (texture->getColor()->getGreen() + 756 xcol.green = (unsigned int) (texture->color().green() +
758 (texture->getColor()->getGreen() >> 1)); 757 (texture->color().green() >> 1));
759 if (xcol.green >= 0xff) xcol.green = 0xffff; 758 if (xcol.green >= 0xff) xcol.green = 0xffff;
760 else xcol.green *= 0xff; 759 else xcol.green *= 0xff;
761 xcol.blue = (unsigned int) (texture->getColor()->getBlue() + 760 xcol.blue = (unsigned int) (texture->color().blue() +
762 (texture->getColor()->getBlue() >> 1)); 761 (texture->color().blue() >> 1));
763 if (xcol.blue >= 0xff) xcol.blue = 0xffff; 762 if (xcol.blue >= 0xff) xcol.blue = 0xffff;
764 else xcol.blue *= 0xff; 763 else xcol.blue *= 0xff;
765 764
766 if (! XAllocColor(m_display, m_colormap, &xcol)) 765 if (! XAllocColor(m_display, m_colormap, &xcol))
767 xcol.pixel = 0; 766 xcol.pixel = 0;
768 767
769 texture->getHiColor()->setPixel(xcol.pixel); 768 texture->hiColor().setPixel(xcol.pixel);
770 769
771 xcol.red = 770 xcol.red =
772 (unsigned int) ((texture->getColor()->getRed() >> 2) + 771 (unsigned int) ((texture->color().red() >> 2) +
773 (texture->getColor()->getRed() >> 1)) * 0xff; 772 (texture->color().red() >> 1)) * 0xff;
774 xcol.green = 773 xcol.green =
775 (unsigned int) ((texture->getColor()->getGreen() >> 2) + 774 (unsigned int) ((texture->color().green() >> 2) +
776 (texture->getColor()->getGreen() >> 1)) * 0xff; 775 (texture->color().green() >> 1)) * 0xff;
777 xcol.blue = 776 xcol.blue =
778 (unsigned int) ((texture->getColor()->getBlue() >> 2) + 777 (unsigned int) ((texture->color().blue() >> 2) +
779 (texture->getColor()->getBlue() >> 1)) * 0xff; 778 (texture->color().blue() >> 1)) * 0xff;
780 779
781 if (! XAllocColor(m_display, m_colormap, &xcol)) 780 if (! XAllocColor(m_display, m_colormap, &xcol))
782 xcol.pixel = 0; 781 xcol.pixel = 0;
783 782
784 texture->getLoColor()->setPixel(xcol.pixel); 783 texture->loColor().setPixel(xcol.pixel);
785 } else if (texture->getTexture() & BImage::GRADIENT) { 784 } else if (texture->getTexture() & BImage::GRADIENT) {
786 int clen = strlen(rclass) + 10, nlen = strlen(rname) + 10; 785 int clen = strlen(rclass) + 10, nlen = strlen(rname) + 10;
787 786
@@ -794,12 +793,11 @@ bool Theme::readDatabaseTexture(char *rname, char *rclass,
794 sprintf(colortoclass, "%s.ColorTo", rclass); 793 sprintf(colortoclass, "%s.ColorTo", rclass);
795 sprintf(colortoname, "%s.colorTo", rname); 794 sprintf(colortoname, "%s.colorTo", rname);
796 795
797 if (!readDatabaseColor(colorname, colorclass, texture->getColor(), 796 if (!readDatabaseColor(colorname, colorclass, &texture->color(),
798 default_pixel)) 797 default_pixel))
799 retval = false; //report failure in loading 798 retval = false; //report failure in loading
800 799
801 readDatabaseColor(colortoname, colortoclass, texture->getColorTo(), 800 readDatabaseColor(colortoname, colortoclass, &texture->colorTo(), default_pixel);
802 default_pixel);
803 801
804 delete [] colorclass; 802 delete [] colorclass;
805 delete [] colorname; 803 delete [] colorname;
@@ -928,80 +926,80 @@ void Theme::reconfigure() {
928 XChangeGC(m_display, m_opgc, 926 XChangeGC(m_display, m_opgc,
929 GCForeground | GCFunction | GCSubwindowMode, &gcv); 927 GCForeground | GCFunction | GCSubwindowMode, &gcv);
930 928
931 gcv.foreground = m_windowstyle.l_text_focus.getPixel(); 929 gcv.foreground = m_windowstyle.l_text_focus.pixel();
932 if (m_windowstyle.font.fontstruct) 930 if (m_windowstyle.font.fontstruct)
933 gcv.font = m_windowstyle.font.fontstruct->fid; 931 gcv.font = m_windowstyle.font.fontstruct->fid;
934 932
935 XChangeGC(m_display, m_windowstyle.l_text_focus_gc, 933 XChangeGC(m_display, m_windowstyle.l_text_focus_gc,
936 gc_value_mask, &gcv); 934 gc_value_mask, &gcv);
937 935
938 gcv.foreground = m_windowstyle.l_text_unfocus.getPixel(); 936 gcv.foreground = m_windowstyle.l_text_unfocus.pixel();
939 XChangeGC(m_display, m_windowstyle.l_text_unfocus_gc, 937 XChangeGC(m_display, m_windowstyle.l_text_unfocus_gc,
940 gc_value_mask, &gcv); 938 gc_value_mask, &gcv);
941 939
942 //---- Tab 940 //---- Tab
943 gcv.foreground = m_windowstyle.tab.l_text_focus.getPixel(); 941 gcv.foreground = m_windowstyle.tab.l_text_focus.pixel();
944 if (m_windowstyle.tab.font.fontstruct) 942 if (m_windowstyle.tab.font.fontstruct)
945 gcv.font = m_windowstyle.tab.font.fontstruct->fid; 943 gcv.font = m_windowstyle.tab.font.fontstruct->fid;
946 944
947 XChangeGC(m_display, m_windowstyle.tab.l_text_focus_gc, 945 XChangeGC(m_display, m_windowstyle.tab.l_text_focus_gc,
948 gc_value_mask, &gcv); 946 gc_value_mask, &gcv);
949 947
950 gcv.foreground = m_windowstyle.tab.l_text_unfocus.getPixel(); 948 gcv.foreground = m_windowstyle.tab.l_text_unfocus.pixel();
951 XChangeGC(m_display, m_windowstyle.tab.l_text_unfocus_gc, 949 XChangeGC(m_display, m_windowstyle.tab.l_text_unfocus_gc,
952 gc_value_mask, &gcv); 950 gc_value_mask, &gcv);
953 951
954 //--- end tab 952 //--- end tab
955 953
956 gcv.foreground = m_windowstyle.b_pic_focus.getPixel(); 954 gcv.foreground = m_windowstyle.b_pic_focus.pixel();
957 XChangeGC(m_display, m_windowstyle.b_pic_focus_gc, 955 XChangeGC(m_display, m_windowstyle.b_pic_focus_gc,
958 GCForeground, &gcv); 956 GCForeground, &gcv);
959 957
960 gcv.foreground = m_windowstyle.b_pic_unfocus.getPixel(); 958 gcv.foreground = m_windowstyle.b_pic_unfocus.pixel();
961 XChangeGC(m_display, m_windowstyle.b_pic_unfocus_gc, 959 XChangeGC(m_display, m_windowstyle.b_pic_unfocus_gc,
962 GCForeground, &gcv); 960 GCForeground, &gcv);
963 961
964 gcv.foreground = m_menustyle.t_text.getPixel(); 962 gcv.foreground = m_menustyle.t_text.pixel();
965 if (m_menustyle.titlefont.getFontStruct()) 963 if (m_menustyle.titlefont.getFontStruct())
966 gcv.font = m_menustyle.titlefont.getFontStruct()->fid; 964 gcv.font = m_menustyle.titlefont.getFontStruct()->fid;
967 XChangeGC(m_display, m_menustyle.t_text_gc, 965 XChangeGC(m_display, m_menustyle.t_text_gc,
968 gc_value_mask, &gcv); 966 gc_value_mask, &gcv);
969 967
970 gcv.foreground = m_menustyle.f_text.getPixel(); 968 gcv.foreground = m_menustyle.f_text.pixel();
971 if (m_menustyle.framefont.getFontStruct()) 969 if (m_menustyle.framefont.getFontStruct())
972 gcv.font = m_menustyle.framefont.getFontStruct()->fid; 970 gcv.font = m_menustyle.framefont.getFontStruct()->fid;
973 971
974 XChangeGC(m_display, m_menustyle.f_text_gc, 972 XChangeGC(m_display, m_menustyle.f_text_gc,
975 gc_value_mask, &gcv); 973 gc_value_mask, &gcv);
976 974
977 gcv.foreground = m_menustyle.h_text.getPixel(); 975 gcv.foreground = m_menustyle.h_text.pixel();
978 XChangeGC(m_display, m_menustyle.h_text_gc, 976 XChangeGC(m_display, m_menustyle.h_text_gc,
979 gc_value_mask, &gcv); 977 gc_value_mask, &gcv);
980 978
981 gcv.foreground = m_menustyle.d_text.getPixel(); 979 gcv.foreground = m_menustyle.d_text.pixel();
982 XChangeGC(m_display, m_menustyle.d_text_gc, 980 XChangeGC(m_display, m_menustyle.d_text_gc,
983 gc_value_mask, &gcv); 981 gc_value_mask, &gcv);
984 982
985 gcv.foreground = m_menustyle.hilite.getColor()->getPixel(); 983 gcv.foreground = m_menustyle.hilite.color().pixel();
986 XChangeGC(m_display, m_menustyle.hilite_gc, 984 XChangeGC(m_display, m_menustyle.hilite_gc,
987 gc_value_mask, &gcv); 985 gc_value_mask, &gcv);
988 986
989 gcv.foreground = m_toolbarstyle.l_text.getPixel(); 987 gcv.foreground = m_toolbarstyle.l_text.pixel();
990 if (m_toolbarstyle.font.fontstruct) 988 if (m_toolbarstyle.font.fontstruct)
991 gcv.font = m_toolbarstyle.font.fontstruct->fid; 989 gcv.font = m_toolbarstyle.font.fontstruct->fid;
992 990
993 XChangeGC(m_display, m_toolbarstyle.l_text_gc, 991 XChangeGC(m_display, m_toolbarstyle.l_text_gc,
994 gc_value_mask, &gcv); 992 gc_value_mask, &gcv);
995 993
996 gcv.foreground = m_toolbarstyle.w_text.getPixel(); 994 gcv.foreground = m_toolbarstyle.w_text.pixel();
997 XChangeGC(m_display, m_toolbarstyle.w_text_gc, 995 XChangeGC(m_display, m_toolbarstyle.w_text_gc,
998 gc_value_mask, &gcv); 996 gc_value_mask, &gcv);
999 997
1000 gcv.foreground = m_toolbarstyle.c_text.getPixel(); 998 gcv.foreground = m_toolbarstyle.c_text.pixel();
1001 XChangeGC(m_display, m_toolbarstyle.c_text_gc, 999 XChangeGC(m_display, m_toolbarstyle.c_text_gc,
1002 gc_value_mask, &gcv); 1000 gc_value_mask, &gcv);
1003 1001
1004 gcv.foreground = m_toolbarstyle.b_pic.getPixel(); 1002 gcv.foreground = m_toolbarstyle.b_pic.pixel();
1005 XChangeGC(m_display, m_toolbarstyle.b_pic_gc, 1003 XChangeGC(m_display, m_toolbarstyle.b_pic_gc,
1006 gc_value_mask, &gcv); 1004 gc_value_mask, &gcv);
1007 1005