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 <QImage>
31 
32 #include <libaudcore/index.h>
33 #include <libaudcore/objects.h>
34 
35 typedef enum {
36     SKIN_MAIN = 0,
37     SKIN_CBUTTONS,
38     SKIN_TITLEBAR,
39     SKIN_SHUFREP,
40     SKIN_TEXT,
41     SKIN_VOLUME,
42     SKIN_BALANCE,
43     SKIN_MONOSTEREO,
44     SKIN_PLAYPAUSE,
45     SKIN_NUMBERS,
46     SKIN_POSBAR,
47     SKIN_PLEDIT,
48     SKIN_EQMAIN,
49     SKIN_EQ_EX,
50     SKIN_PIXMAP_COUNT
51 } SkinPixmapId;
52 
53 typedef enum {
54     SKIN_MASK_MAIN = 0,
55     SKIN_MASK_MAIN_SHADE,
56     SKIN_MASK_EQ,
57     SKIN_MASK_EQ_SHADE,
58     SKIN_MASK_COUNT
59 } SkinMaskId;
60 
61 typedef enum {
62     SKIN_PLEDIT_NORMAL = 0,
63     SKIN_PLEDIT_CURRENT,
64     SKIN_PLEDIT_NORMALBG,
65     SKIN_PLEDIT_SELECTEDBG,
66     SKIN_TEXTBG,
67     SKIN_TEXTFG,
68     SKIN_COLOR_COUNT
69 } SkinColorId;
70 
71 struct SkinHints {
72     /* Vis properties */
73     int mainwin_vis_x = 24;
74     int mainwin_vis_y = 43;
75     int mainwin_vis_visible = true;
76 
77     /* Text properties */
78     int mainwin_text_x = 112;
79     int mainwin_text_y = 27;
80     int mainwin_text_width = 153;
81     int mainwin_text_visible = true;
82 
83     /* Infobar properties */
84     int mainwin_infobar_x = 112;
85     int mainwin_infobar_y = 43;
86     int mainwin_othertext_visible = false;
87 
88     int mainwin_number_0_x = 36;
89     int mainwin_number_0_y = 26;
90 
91     int mainwin_number_1_x = 48;
92     int mainwin_number_1_y = 26;
93 
94     int mainwin_number_2_x = 60;
95     int mainwin_number_2_y = 26;
96 
97     int mainwin_number_3_x = 78;
98     int mainwin_number_3_y = 26;
99 
100     int mainwin_number_4_x = 90;
101     int mainwin_number_4_y = 26;
102 
103     int mainwin_playstatus_x = 24;
104     int mainwin_playstatus_y = 28;
105 
106     int mainwin_volume_x = 107;
107     int mainwin_volume_y = 57;
108 
109     int mainwin_balance_x = 177;
110     int mainwin_balance_y = 57;
111 
112     int mainwin_position_x = 16;
113     int mainwin_position_y = 72;
114 
115     int mainwin_previous_x = 16;
116     int mainwin_previous_y = 88;
117 
118     int mainwin_play_x = 39;
119     int mainwin_play_y = 88;
120 
121     int mainwin_pause_x = 62;
122     int mainwin_pause_y = 88;
123 
124     int mainwin_stop_x = 85;
125     int mainwin_stop_y = 88;
126 
127     int mainwin_next_x = 108;
128     int mainwin_next_y = 88;
129 
130     int mainwin_eject_x = 136;
131     int mainwin_eject_y = 89;
132 
133     int mainwin_eqbutton_x = 219;
134     int mainwin_eqbutton_y = 58;
135 
136     int mainwin_plbutton_x = 242;
137     int mainwin_plbutton_y = 58;
138 
139     int mainwin_shuffle_x = 164;
140     int mainwin_shuffle_y = 89;
141 
142     int mainwin_repeat_x = 210;
143     int mainwin_repeat_y = 89;
144 
145     int mainwin_about_x = 247;
146     int mainwin_about_y = 83;
147 
148     int mainwin_minimize_x = 244;
149     int mainwin_minimize_y = 3;
150 
151     int mainwin_shade_x = 254;
152     int mainwin_shade_y = 3;
153 
154     int mainwin_close_x = 264;
155     int mainwin_close_y = 3;
156 
157     int mainwin_width = 275;
158     int mainwin_height = 116;
159 
160     int mainwin_menurow_visible = true;
161     int mainwin_streaminfo_visible = true;
162     int mainwin_othertext_is_status = false;
163 
164     int textbox_bitmap_font_width = 5;
165     int textbox_bitmap_font_height = 6;
166 };
167 
168 struct Skin {
169     SkinHints hints;
170     uint32_t colors[SKIN_COLOR_COUNT] {};
171     uint32_t eq_spline_colors[19] {};
172     uint32_t vis_colors[24] {};
173 
174     QImage pixmaps[SKIN_PIXMAP_COUNT];
175     Index<QRect> masks[SKIN_MASK_COUNT];
176 };
177 
178 extern Skin skin;
179 
180 bool skin_load (const char * path);
181 
182 void skin_draw_pixbuf (QPainter & p, SkinPixmapId id, int xsrc, int ysrc,
183  int xdest, int ydest, int width, int height);
184 
185 void skin_install_skin (const char * path);
186 
187 void skin_draw_playlistwin_shaded (QPainter & cr, int width, bool focus);
188 void skin_draw_playlistwin_frame (QPainter & cr, int width, int height, bool focus);
189 void skin_draw_mainwin_titlebar (QPainter & cr, bool shaded, bool focus);
190 
191 /* ui_skin_load_ini.c */
192 void skin_load_hints (const char * path);
193 void skin_load_pl_colors (const char * path);
194 void skin_load_masks (const char * path);
195 
196 #endif
197