1 // -----------------------------------------------------------------------------
2 //
3 // Copyright (C) 2006-2018 Fons Adriaensen <fons@linuxaudio.org>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 //
18 // -----------------------------------------------------------------------------
19
20
21 #include "styles.h"
22
23
24 XftColor *XftColors [NXFTCOLORS];
25 XftFont *XftFonts [NXFTFONTS];
26 X_button_style Bst0, Bst2;
27 X_textln_style Tst0, Tst1, Tst2, Tst3;
28 X_slider_style Fst1;
29 X_textmat_style Mst1;
30 X_mclist_style Lst0;
31 X_scale_style sca_hpfr, sca_azim, sca_elev, sca_angle, sca_direc, sca_volume;
32
33
34
styles_init(X_display * disp,X_resman * xrm)35 void styles_init (X_display *disp, X_resman *xrm)
36 {
37 XftColors [C_MAIN_BG] = disp->alloc_xftcolor (xrm->get (".color.main.bg", "gray30"), 0);
38 XftColors [C_MAIN_FG] = disp->alloc_xftcolor (xrm->get (".color.main.fg", "white" ), 0);
39 XftColors [C_MAIN_LS] = disp->alloc_xftcolor (xrm->get (".color.main.ls", "gray50" ), 0);
40 XftColors [C_MAIN_DS] = disp->alloc_xftcolor (xrm->get (".color.main.ds", "black" ), 0);
41 XftColors [C_TEXT_BG] = disp->alloc_xftcolor (xrm->get (".color.text.bg", "white" ), 0);
42 XftColors [C_TEXT_FG] = disp->alloc_xftcolor (xrm->get (".color.text.fg", "black" ), 0);
43 XftColors [C_TEXT_HL] = disp->alloc_xftcolor (xrm->get (".color.text.hl", "#c0ffa0"), 0);
44 XftColors [C_TEXT_CA] = disp->alloc_xftcolor (xrm->get (".color.text.ca", "red" ), 0);
45 XftColors [C_TEXT_GR] = disp->alloc_xftcolor (xrm->get (".color.text.gr", "gray80" ), 0);
46 XftColors [C_TEXT_MO] = disp->alloc_xftcolor (xrm->get (".color.text.mo", "#e0e0c0"), 0);
47 XftColors [C_TEXT_ER] = disp->alloc_xftcolor (xrm->get (".color.text.er", "orange" ), 0);
48 XftColors [C_BUTT_BG0] = disp->alloc_xftcolor (xrm->get (".color.butt.bg0", "#707060"), 0);
49 XftColors [C_BUTT_BG1] = disp->alloc_xftcolor (xrm->get (".color.butt.bg1", "blue" ), 0);
50 XftColors [C_BUTT_BG2] = disp->alloc_xftcolor (xrm->get (".color.butt.bg2", "red" ), 0);
51 XftColors [C_BUTT_BG3] = disp->alloc_xftcolor (xrm->get (".color.butt.bg3", "orange" ), 0);
52 XftColors [C_BUTT_FG0] = disp->alloc_xftcolor (xrm->get (".color.butt.fg0", "white" ), 0);
53 XftColors [C_BUTT_FG1] = disp->alloc_xftcolor (xrm->get (".color.butt.fg1", "white" ), 0);
54 XftColors [C_BUTT_FG2] = disp->alloc_xftcolor (xrm->get (".color.butt.fg2", "white" ), 0);
55 XftColors [C_BUTT_FG3] = disp->alloc_xftcolor (xrm->get (".color.butt.fg3", "black" ), 0);
56 XftColors [C_SLID_KN] = disp->alloc_xftcolor (xrm->get (".color.slid.kn", "blue" ), 0);
57 XftColors [C_SLID_MK] = disp->alloc_xftcolor (xrm->get (".color.slid.mk", "gray90" ), 0);
58 XftColors [C_DISP_BG] = disp->alloc_xftcolor (xrm->get (".color.disp.bg", "black" ), 0);
59 XftColors [C_DISP_FG1] = disp->alloc_xftcolor (xrm->get (".color.disp.fg1", "#a0a0ff"), 0);
60 XftColors [C_DISP_FG2] = disp->alloc_xftcolor (xrm->get (".color.disp.fg2", "yellow" ), 0);
61
62 XftFonts [F_MAIN] = disp->alloc_xftfont (xrm->get (".font.main", "luxi:bold:pixelsize=11"));
63 XftFonts [F_BUTT] = disp->alloc_xftfont (xrm->get (".font.butt", "luxi:bold:pixelsize=11"));
64 XftFonts [F_TEXT] = disp->alloc_xftfont (xrm->get (".font.text", "luxi:pixelsize=11"));
65 XftFonts [F_SCAL] = disp->alloc_xftfont (xrm->get (".font.scale","luxi:bold:pixelsize=9"));
66 XftFonts [F_FILE] = disp->alloc_xftfont (xrm->get (".font.file", "luxi:pixelsize=12"));
67 XftFonts [F_MATR] = disp->alloc_xftfont (xrm->get (".font.matr", "luxi:pixelsize=11"));
68
69 Bst0.font = XftFonts [F_BUTT];
70 Bst0.type = X_button_style::RAISED;
71 Bst0.color.bg[0] = XftColors [C_BUTT_BG0]->pixel;
72 Bst0.color.fg[0] = XftColors [C_BUTT_FG0];
73 Bst0.color.bg[1] = XftColors [C_BUTT_BG1]->pixel;
74 Bst0.color.fg[1] = XftColors [C_BUTT_FG1];
75 Bst0.color.bg[2] = XftColors [C_BUTT_BG2]->pixel;
76 Bst0.color.fg[2] = XftColors [C_BUTT_FG2];
77 Bst0.color.bg[3] = XftColors [C_BUTT_BG3]->pixel;
78 Bst0.color.fg[3] = XftColors [C_BUTT_FG3];
79 Bst0.color.shadow.bgnd = XftColors [C_MAIN_BG]->pixel;
80 Bst0.color.shadow.lite = XftColors [C_MAIN_LS]->pixel;
81 Bst0.color.shadow.dark = XftColors [C_MAIN_DS]->pixel;
82
83 Bst2.font = 0;
84 Bst2.type = X_button_style::BORDER;
85 Bst2.color.bg [0] = XftColors [C_MAIN_BG]->pixel;
86 Bst2.color.fg [0] = XftColors [C_MAIN_FG];
87 Bst2.color.bg [1] = XftColors [C_MAIN_BG]->pixel;
88 Bst2.color.fg [1] = XftColors [C_MAIN_FG];
89 Bst2.color.shadow.bgnd = XftColors [C_MAIN_BG]->pixel;
90 Bst2.color.shadow.lite = XftColors [C_MAIN_LS]->pixel;
91 Bst2.color.shadow.dark = XftColors [C_MAIN_DS]->pixel;
92
93 Tst0.font = XftFonts [F_TEXT];
94 Tst0.color.normal.bgnd = XftColors [C_TEXT_BG]->pixel;
95 Tst0.color.normal.text = XftColors [C_TEXT_FG];
96 Tst0.color.focus.bgnd = XftColors [C_TEXT_HL]->pixel;
97 Tst0.color.focus.text = XftColors [C_TEXT_FG];
98 Tst0.color.focus.line = XftColors [C_TEXT_CA]->pixel;
99 Tst0.color.shadow.lite = XftColors [C_MAIN_LS]->pixel;
100 Tst0.color.shadow.dark = XftColors [C_MAIN_DS]->pixel;
101 Tst0.color.shadow.bgnd = XftColors [C_MAIN_BG]->pixel;
102
103 Tst1.font = XftFonts [F_MAIN];
104 Tst1.color.normal.bgnd = XftColors [C_MAIN_BG]->pixel;
105 Tst1.color.normal.text = XftColors [C_MAIN_FG];
106 Tst1.color.shadow.lite = XftColors [C_MAIN_LS]->pixel;
107 Tst1.color.shadow.dark = XftColors [C_MAIN_DS]->pixel;
108 Tst1.color.shadow.bgnd = XftColors [C_MAIN_BG]->pixel;
109
110 Tst2.font = XftFonts [F_MAIN];
111 Tst2.color.normal.bgnd = XftColors [C_DISP_BG]->pixel;
112 Tst2.color.normal.text = XftColors [C_DISP_FG1];
113
114 Mst1.font = XftFonts [F_MATR];
115 Mst1.color.normal.bg = XftColors [C_TEXT_BG]->pixel;
116 Mst1.color.normal.fg = XftColors [C_TEXT_FG];
117 Mst1.color.focus.bg = XftColors [C_TEXT_HL]->pixel;
118 Mst1.color.focus.fg = XftColors [C_TEXT_FG];
119 Mst1.color.modif.bg = XftColors [C_TEXT_MO]->pixel;
120 Mst1.color.modif.fg = XftColors [C_TEXT_FG];
121 Mst1.color.error.bg = XftColors [C_TEXT_ER]->pixel;
122 Mst1.color.error.fg = XftColors [C_TEXT_FG];
123 Mst1.color.line = XftColors [C_TEXT_CA]->pixel;
124 Mst1.color.grid = XftColors [C_TEXT_GR]->pixel;
125
126 Fst1.bg = XftColors [C_MAIN_BG]->pixel;
127 Fst1.lite = XftColors [C_MAIN_LS]->pixel;
128 Fst1.dark = XftColors [C_MAIN_DS]->pixel;
129 Fst1.knob = XftColors [C_SLID_KN]->pixel;
130 Fst1.mark = XftColors [C_SLID_MK]->pixel;
131 Fst1.h = 13;
132 Fst1.w = 7;
133
134 Lst0.bg = XftColors [C_TEXT_BG]->pixel;
135 Lst0.fg [0] = disp->alloc_xftcolor (xrm->get (".color.flist.fg0", "blue") , 0);
136 Lst0.fg [1] = disp->alloc_xftcolor (xrm->get (".color.flist.fg1", "black"), 0);
137 Lst0.fg [2] = disp->alloc_xftcolor (xrm->get (".color.flist.fg2", "red"), 0);
138 Lst0.fg [3] = disp->alloc_xftcolor (xrm->get (".color.flist.fg3", "purple"), 0);
139 Lst0.font = XftFonts [F_FILE];
140 Lst0.dy = Lst0.font->ascent + Lst0.font->descent + 3;
141
142 sca_hpfr.bg = XftColors [C_MAIN_BG]->pixel;
143 sca_hpfr.fg = XftColors [C_MAIN_FG];
144 sca_hpfr.marg = 0;
145 sca_hpfr.font = XftFonts [F_SCAL];
146 sca_hpfr.nseg = 8;
147 sca_hpfr.set_tick ( 0, 10, 10.0f, "10" );
148 sca_hpfr.set_tick ( 1, 32, 14.1f, 0 );
149 sca_hpfr.set_tick ( 2, 54, 20.0f, "20" );
150 sca_hpfr.set_tick ( 3, 76, 28.3f, 0 );
151 sca_hpfr.set_tick ( 4, 98, 40.0f, "40" );
152 sca_hpfr.set_tick ( 5, 120, 56.5f, 0 );
153 sca_hpfr.set_tick ( 6, 142, 80.0f, "80" );
154 sca_hpfr.set_tick ( 7, 164, 112.0f, 0 );
155 sca_hpfr.set_tick ( 8, 186, 160.0f, "160" );
156
157 sca_azim.bg = XftColors [C_MAIN_BG]->pixel;
158 sca_azim.fg = XftColors [C_MAIN_FG];
159 sca_azim.marg = 0;
160 sca_azim.font = XftFonts [F_SCAL];
161 sca_azim.nseg = 8;
162 sca_azim.set_tick ( 0, 15, -0.500f, "B" );
163 sca_azim.set_tick ( 1, 33, -0.375f, 0 );
164 sca_azim.set_tick ( 2, 51, -0.250f, "L" );
165 sca_azim.set_tick ( 3, 69, -0.125f, 0 );
166 sca_azim.set_tick ( 4, 87, 0.000f, "Azim" );
167 sca_azim.set_tick ( 5, 105, 0.125f, 0 );
168 sca_azim.set_tick ( 6, 123, 0.250f, "R" );
169 sca_azim.set_tick ( 7, 141, 0.375f, 0 );
170 sca_azim.set_tick ( 8, 159, 0.500f, "B" );
171
172 sca_elev.bg = XftColors [C_MAIN_BG]->pixel;
173 sca_elev.fg = XftColors [C_MAIN_FG];
174 sca_elev.marg = 0;
175 sca_elev.font = XftFonts [F_SCAL];
176 sca_elev.nseg = 6;
177 sca_elev.set_tick ( 0, 15, -0.250f, "-90" );
178 sca_elev.set_tick ( 1, 39, -0.167f, 0 );
179 sca_elev.set_tick ( 2, 63, -0.083f, 0 );
180 sca_elev.set_tick ( 3, 87, 0, "Elev" );
181 sca_elev.set_tick ( 4, 111, 0.083f, 0 );
182 sca_elev.set_tick ( 5, 135, 0.167f, 0 );
183 sca_elev.set_tick ( 6, 159, 0.250f, "90" );
184
185 sca_angle.bg = XftColors [C_MAIN_BG]->pixel;
186 sca_angle.fg = XftColors [C_MAIN_FG];
187 sca_angle.marg = 0;
188 sca_angle.font = XftFonts [F_SCAL];
189 sca_angle.nseg = 6;
190 sca_angle.set_tick ( 0, 15, 0.000f, "0" );
191 sca_angle.set_tick ( 1, 39, 0.083f, 0 );
192 sca_angle.set_tick ( 2, 63, 0.167f, 0 );
193 sca_angle.set_tick ( 3, 87, 0.250f, "Angle" );
194 sca_angle.set_tick ( 4, 111, 0.333f, 0 );
195 sca_angle.set_tick ( 5, 135, 0.417f, 0 );
196 sca_angle.set_tick ( 6, 159, 0.500f, "180" );
197
198 sca_direc.bg = XftColors [C_MAIN_BG]->pixel;
199 sca_direc.fg = XftColors [C_MAIN_FG];
200 sca_direc.marg = 0;
201 sca_direc.font = XftFonts [F_SCAL];
202 sca_direc.nseg = 6;
203 sca_direc.set_tick ( 0, 15, 0.000f, "0mni" );
204 sca_direc.set_tick ( 1, 39, 0.167f, 0 );
205 sca_direc.set_tick ( 2, 63, 0.333f, 0 );
206 sca_direc.set_tick ( 3, 87, 0.500f, "Card" );
207 sca_direc.set_tick ( 4, 111, 0.667f, 0 );
208 sca_direc.set_tick ( 5, 135, 0.833f, 0 );
209 sca_direc.set_tick ( 6, 159, 1.000f, "Fig-8" );
210
211 sca_volume.bg = XftColors [C_MAIN_BG]->pixel;
212 sca_volume.fg = XftColors [C_MAIN_FG];
213 sca_volume.marg = 2;
214 sca_volume.font = XftFonts [F_SCAL];
215 sca_volume.nseg = 7;
216 sca_volume.set_tick ( 0, 15, -100.0f, 0 );
217 sca_volume.set_tick ( 1, 25, -50.0f, "-50" );
218 sca_volume.set_tick ( 2, 55, -40.0f, "-40" );
219 sca_volume.set_tick ( 3, 95, -30.0f, "-30" );
220 sca_volume.set_tick ( 4, 135, -20.0f, "-20" );
221 sca_volume.set_tick ( 5, 175, -10.0f, "-10" );
222 sca_volume.set_tick ( 6, 215, 0.0f, "0" );
223 sca_volume.set_tick ( 7, 255, 10.0f, "10" );
224
225 }
226
227
styles_fini(X_display * disp)228 void styles_fini (X_display *disp)
229 {
230 }
231