1 /* Audacious
2 * Copyright (C) 2005-2011 Audacious development team.
3 *
4 * BMP - Cross-platform multimedia player
5 * Copyright (C) 2003-2004 BMP development team.
6 *
7 * Based on XMMS:
8 * Copyright (C) 1998-2003 XMMS development team.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; under version 3 of the License.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses>.
21 *
22 * The Audacious team does not consider modular code linking to
23 * Audacious or using our public API to be a derived work.
24 */
25
26 #ifndef SKIN_H
27 #define SKIN_H
28
29 #include <stdint.h>
30 #include <gtk/gtk.h>
31
32 #include <libaudcore/index.h>
33 #include <libaudcore/objects.h>
34
35 typedef SmartPtr<cairo_surface_t, cairo_surface_destroy> CairoSurfacePtr;
36 typedef SmartPtr<PangoFontDescription, pango_font_description_free> PangoFontDescPtr;
37
38 #define COLOR(r,g,b) (((uint32_t) (r) << 16) | ((uint32_t) (g) << 8) | (uint32_t) (b))
39 #define COLOR_R(c) ((int) (((c) & 0xff0000) >> 16))
40 #define COLOR_G(c) ((int) (((c) & 0xff00) >> 8))
41 #define COLOR_B(c) ((int) ((c) & 0xff))
42
43 typedef enum {
44 SKIN_MAIN = 0,
45 SKIN_CBUTTONS,
46 SKIN_TITLEBAR,
47 SKIN_SHUFREP,
48 SKIN_TEXT,
49 SKIN_VOLUME,
50 SKIN_BALANCE,
51 SKIN_MONOSTEREO,
52 SKIN_PLAYPAUSE,
53 SKIN_NUMBERS,
54 SKIN_POSBAR,
55 SKIN_PLEDIT,
56 SKIN_EQMAIN,
57 SKIN_EQ_EX,
58 SKIN_PIXMAP_COUNT
59 } SkinPixmapId;
60
61 typedef enum {
62 SKIN_MASK_MAIN = 0,
63 SKIN_MASK_MAIN_SHADE,
64 SKIN_MASK_EQ,
65 SKIN_MASK_EQ_SHADE,
66 SKIN_MASK_COUNT
67 } SkinMaskId;
68
69 typedef enum {
70 SKIN_PLEDIT_NORMAL = 0,
71 SKIN_PLEDIT_CURRENT,
72 SKIN_PLEDIT_NORMALBG,
73 SKIN_PLEDIT_SELECTEDBG,
74 SKIN_TEXTBG,
75 SKIN_TEXTFG,
76 SKIN_COLOR_COUNT
77 } SkinColorId;
78
79 struct SkinHints {
80 /* Vis properties */
81 int mainwin_vis_x = 24;
82 int mainwin_vis_y = 43;
83 int mainwin_vis_visible = true;
84
85 /* Text properties */
86 int mainwin_text_x = 112;
87 int mainwin_text_y = 27;
88 int mainwin_text_width = 153;
89 int mainwin_text_visible = true;
90
91 /* Infobar properties */
92 int mainwin_infobar_x = 112;
93 int mainwin_infobar_y = 43;
94 int mainwin_othertext_visible = false;
95
96 int mainwin_number_0_x = 36;
97 int mainwin_number_0_y = 26;
98
99 int mainwin_number_1_x = 48;
100 int mainwin_number_1_y = 26;
101
102 int mainwin_number_2_x = 60;
103 int mainwin_number_2_y = 26;
104
105 int mainwin_number_3_x = 78;
106 int mainwin_number_3_y = 26;
107
108 int mainwin_number_4_x = 90;
109 int mainwin_number_4_y = 26;
110
111 int mainwin_playstatus_x = 24;
112 int mainwin_playstatus_y = 28;
113
114 int mainwin_volume_x = 107;
115 int mainwin_volume_y = 57;
116
117 int mainwin_balance_x = 177;
118 int mainwin_balance_y = 57;
119
120 int mainwin_position_x = 16;
121 int mainwin_position_y = 72;
122
123 int mainwin_previous_x = 16;
124 int mainwin_previous_y = 88;
125
126 int mainwin_play_x = 39;
127 int mainwin_play_y = 88;
128
129 int mainwin_pause_x = 62;
130 int mainwin_pause_y = 88;
131
132 int mainwin_stop_x = 85;
133 int mainwin_stop_y = 88;
134
135 int mainwin_next_x = 108;
136 int mainwin_next_y = 88;
137
138 int mainwin_eject_x = 136;
139 int mainwin_eject_y = 89;
140
141 int mainwin_eqbutton_x = 219;
142 int mainwin_eqbutton_y = 58;
143
144 int mainwin_plbutton_x = 242;
145 int mainwin_plbutton_y = 58;
146
147 int mainwin_shuffle_x = 164;
148 int mainwin_shuffle_y = 89;
149
150 int mainwin_repeat_x = 210;
151 int mainwin_repeat_y = 89;
152
153 int mainwin_about_x = 247;
154 int mainwin_about_y = 83;
155
156 int mainwin_minimize_x = 244;
157 int mainwin_minimize_y = 3;
158
159 int mainwin_shade_x = 254;
160 int mainwin_shade_y = 3;
161
162 int mainwin_close_x = 264;
163 int mainwin_close_y = 3;
164
165 int mainwin_width = 275;
166 int mainwin_height = 116;
167
168 int mainwin_menurow_visible = true;
169 int mainwin_streaminfo_visible = true;
170 int mainwin_othertext_is_status = false;
171
172 int textbox_bitmap_font_width = 5;
173 int textbox_bitmap_font_height = 6;
174 };
175
176 struct Skin {
177 SkinHints hints;
178 uint32_t colors[SKIN_COLOR_COUNT] {};
179 uint32_t eq_spline_colors[19] {};
180 uint32_t vis_colors[24] {};
181
182 CairoSurfacePtr pixmaps[SKIN_PIXMAP_COUNT];
183 Index<GdkRectangle> masks[SKIN_MASK_COUNT];
184 };
185
186 extern Skin skin;
187
188 bool skin_load (const char * path);
189
190 void skin_draw_pixbuf (cairo_t * cr, SkinPixmapId id, int xsrc, int ysrc,
191 int xdest, int ydest, int width, int height);
192
193 void skin_install_skin (const char * path);
194
195 void skin_draw_playlistwin_shaded (cairo_t * cr, int width, bool focus);
196 void skin_draw_playlistwin_frame (cairo_t * cr, int width, int height, bool focus);
197 void skin_draw_mainwin_titlebar (cairo_t * cr, bool shaded, bool focus);
198
199 /* ui_skin_load_ini.c */
200 void skin_load_hints (const char * path);
201 void skin_load_pl_colors (const char * path);
202 void skin_load_masks (const char * path);
203
set_cairo_color(cairo_t * cr,uint32_t c)204 static inline void set_cairo_color (cairo_t * cr, uint32_t c)
205 {
206 cairo_set_source_rgb (cr, COLOR_R(c) / 255.0, COLOR_G(c) / 255.0, COLOR_B(c)
207 / 255.0);
208 }
209
210 #endif
211