annotate audacious/skin.c @ 680:8282b365f6cb trunk

[svn] - Add some sanity checking to make sure we can't do X11 stuff when running headless.
author nenolod
date Fri, 24 Feb 2006 23:56:24 -0800
parents 97113126c7f9
children c8cf439179b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1 /* BMP - Cross-platform multimedia player
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
2 * Copyright (C) 2003-2004 BMP development team.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
3 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
4 * Based on XMMS:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
5 * Copyright (C) 1998-2003 XMMS development team.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
6 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10 * (at your option) any later version.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15 * GNU General Public License for more details.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 #ifdef HAVE_CONFIG_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23 # include "config.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26 /* TODO: enforce default sizes! */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28 #include <glib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29 #include <stdio.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30 #include <stdlib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31 #include <string.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32 #include <ctype.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34 #include "equalizer.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35 #include "main.h"
383
5c457dac866a [svn] - Rename playlistwin stuff to ui_playlist.*
nenolod
parents: 0
diff changeset
36 #include "ui_playlist.h"
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37 #include "skin.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
38 #include "skinwin.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39 #include "util.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
41 #include "debug.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
42
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
43 #include <gdk/gdkx.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
44 #include <X11/Xlib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
45
442
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
46 #define EXTENSION_TARGETS 7
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
47
653
97113126c7f9 [svn] - Fix mp3 detection properly.
nenolod
parents: 639
diff changeset
48 static gchar *ext_targets[EXTENSION_TARGETS] = { "bmp", "xpm", "png", "svg",
442
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
49 "gif", "jpg", "jpeg" };
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51 struct _SkinPixmapIdMapping {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52 SkinPixmapId id;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53 const gchar *name;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 const gchar *alt_name;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
55 gint width, height;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56 };
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58 struct _SkinMaskInfo {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59 gint width, height;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60 gchar *inistr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61 };
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63 typedef struct _SkinPixmapIdMapping SkinPixmapIdMapping;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 typedef struct _SkinMaskInfo SkinMaskInfo;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67 Skin *bmp_active_skin = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69 static gint skin_current_num;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 static SkinMaskInfo skin_mask_info[] = {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72 {275, 116, "Normal"},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
73 {275, 16, "WindowShade"},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
74 {275, 116, "Equalizer"},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
75 {275, 16, "EqualizerWS"}
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76 };
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78 static SkinPixmapIdMapping skin_pixmap_id_map[] = {
625
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
79 {SKIN_MAIN, "main", NULL, 0, 0},
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
80 {SKIN_CBUTTONS, "cbuttons", NULL, 0, 0},
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
81 {SKIN_SHUFREP, "shufrep", NULL, 0, 0},
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
82 {SKIN_TEXT, "text", NULL, 0, 0},
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
83 {SKIN_TITLEBAR, "titlebar", NULL, 0, 0},
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
84 {SKIN_VOLUME, "volume", NULL, 0, 0},
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
85 {SKIN_BALANCE, "balance", "volume", 0, 0},
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
86 {SKIN_MONOSTEREO, "monoster", NULL, 0, 0},
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
87 {SKIN_PLAYPAUSE, "playpaus", NULL, 0, 0},
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
88 {SKIN_NUMBERS, "nums_ex", "numbers", 0, 0},
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
89 {SKIN_POSBAR, "posbar", NULL, 0, 0},
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
90 {SKIN_EQMAIN, "eqmain", NULL, 0, 0},
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
91 {SKIN_PLEDIT, "pledit", NULL, 0, 0},
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
92 {SKIN_EQ_EX, "eq_ex", NULL, 0, 0}
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93 };
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
94
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95 static guint skin_pixmap_id_map_size = G_N_ELEMENTS(skin_pixmap_id_map);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97 static const guchar skin_default_viscolor[24][3] = {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
98 {9, 34, 53},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
99 {10, 18, 26},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100 {0, 54, 108},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 {0, 58, 116},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102 {0, 62, 124},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
103 {0, 66, 132},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
104 {0, 70, 140},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
105 {0, 74, 148},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
106 {0, 78, 156},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
107 {0, 82, 164},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
108 {0, 86, 172},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
109 {0, 92, 184},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
110 {0, 98, 196},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
111 {0, 104, 208},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
112 {0, 110, 220},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
113 {0, 116, 232},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
114 {0, 122, 244},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
115 {0, 128, 255},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
116 {0, 128, 255},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117 {0, 104, 208},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
118 {0, 80, 160},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
119 {0, 56, 112},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
120 {0, 32, 64},
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121 {200, 200, 200}
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
122 };
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
123
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
124 static GdkBitmap *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
125 skin_create_transparent_mask(const gchar *,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
126 const gchar *,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
127 const gchar *,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
128 GdkWindow *,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
129 gint, gint);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
130
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
131 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
132 skin_setup_masks(Skin * skin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
133
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
134 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
135 skin_set_default_vis_color(Skin * skin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
136
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
137
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
138 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
139 skin_lock(Skin * skin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
140 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
141 g_mutex_lock(skin->lock);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
142 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
143
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
144 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
145 skin_unlock(Skin * skin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
146 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
147 g_mutex_unlock(skin->lock);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
148 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
149
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
150 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
151 bmp_active_skin_reload(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
152 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
153 return bmp_active_skin_load(bmp_active_skin->path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
154 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
155
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
156 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
157 bmp_active_skin_load(const gchar * path)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
158 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
159 g_return_val_if_fail(bmp_active_skin != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
160
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
161 if (!skin_load(bmp_active_skin, path))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
162 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
163
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
164 skin_setup_masks(bmp_active_skin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
165 draw_main_window(TRUE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
166 draw_playlist_window(TRUE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
167 draw_equalizer_window(TRUE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
168
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
169 vis_set_window(mainwin_vis, mainwin->window);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
170 playlistwin_update_list();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
171
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
172 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
173 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
174
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
175 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
176 skin_pixmap_free(SkinPixmap * p)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
177 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
178 g_return_if_fail(p != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
179 g_return_if_fail(p->pixmap != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
180
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
181 g_object_unref(p->pixmap);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
182 p->pixmap = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
183 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
184
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
185 Skin *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
186 skin_new(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
187 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
188 Skin *skin;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
189 skin = g_new0(Skin, 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
190 skin->lock = g_mutex_new();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
191 return skin;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
192 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
193
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
194 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
195 skin_free(Skin * skin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
196 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
197 gint i;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
198
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
199 g_return_if_fail(skin != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
200
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
201 skin_lock(skin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
202
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
203 for (i = 0; i < SKIN_PIXMAP_COUNT; i++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
204 skin_pixmap_free(&skin->pixmaps[i]);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
205
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
206 for (i = 0; i < SKIN_PIXMAP_COUNT; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
207 if (skin->masks[i])
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
208 g_object_unref(skin->masks[i]);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
209
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
210 skin->masks[i] = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
211 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
212
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
213 skin_set_default_vis_color(skin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
214 skin_unlock(skin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
215 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
216
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
217 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
218 skin_destroy(Skin * skin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
219 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
220 g_return_if_fail(skin != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
221 skin_free(skin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
222 g_mutex_free(skin->lock);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
223 g_free(skin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
224 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
225
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
226 const SkinPixmapIdMapping *
625
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
227 skin_pixmap_id_lookup(guint id)
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
228 {
625
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
229 guint i;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
230
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
231 for (i = 0; i < skin_pixmap_id_map_size; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
232 if (id == skin_pixmap_id_map[i].id) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
233 return &skin_pixmap_id_map[i];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
234 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
235 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
236
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
237 return NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
238 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
239
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
240 const gchar *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
241 skin_pixmap_id_to_name(SkinPixmapId id)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
242 {
625
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
243 guint i;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
244
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
245 for (i = 0; i < skin_pixmap_id_map_size; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
246 if (id == skin_pixmap_id_map[i].id)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
247 return skin_pixmap_id_map[i].name;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
248 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
249 return NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
250 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
251
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
252 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
253 skin_set_default_vis_color(Skin * skin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
254 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
255 memcpy(skin->vis_color, skin_default_viscolor,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
256 sizeof(skin_default_viscolor));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
257 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
258
442
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
259 /*
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
260 * I have rewritten this to take an array of possible targets,
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
261 * once we find a matching target we now return, instead of loop
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
262 * recursively. This allows for us to support many possible format
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
263 * targets for our skinning engine than just the original winamp
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
264 * formats.
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
265 *
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
266 * -- nenolod, 16 January 2006
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
267 */
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
268 gchar *
442
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
269 skin_pixmap_locate(const gchar * dirname, gchar ** basenames)
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
270 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
271 gchar *filename;
442
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
272 gint i;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
273
442
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
274 for (i = 0; basenames[i]; i++)
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
275 if (!(filename = find_file_recursively(dirname, basenames[i])))
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
276 g_free(filename);
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
277 else
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
278 return filename;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
279
442
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
280 /* can't find any targets -- sorry */
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
281 return NULL;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
282 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
283
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
284 /* FIXME: this function is temporary. It will be removed when the skinning system
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
285 uses GdkPixbuf in place of GdkPixmap */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
286
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
287 static GdkPixmap *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
288 pixmap_new_from_file(const gchar * filename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
289 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
290 GdkPixbuf *pixbuf;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
291 GdkPixmap *pixmap;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
292 gint width, height;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
293
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
294 if (!(pixbuf = gdk_pixbuf_new_from_file(filename, NULL)))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
295 return NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
296
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
297 width = gdk_pixbuf_get_width(pixbuf);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
298 height = gdk_pixbuf_get_height(pixbuf);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
299
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
300 if (!(pixmap = gdk_pixmap_new(mainwin->window, width, height,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
301 gdk_rgb_get_visual()->depth))) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
302 g_object_unref(pixbuf);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
303 return NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
304 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
305
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
306 gdk_pixbuf_render_to_drawable(pixbuf, pixmap, mainwin_gc, 0, 0, 0, 0,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
307 width, height, GDK_RGB_DITHER_MAX, 0, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
308 g_object_unref(pixbuf);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
309
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
310 return pixmap;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
311 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
312
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
313 static gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
314 skin_load_pixmap_id(Skin * skin, SkinPixmapId id, const gchar * path_p)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
315 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
316 const gchar *path;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
317 gchar *filename;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
318 gint width, height;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
319 const SkinPixmapIdMapping *pixmap_id_mapping;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
320 GdkPixmap *gpm;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
321 SkinPixmap *pm = NULL;
442
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
322 gchar *basenames[EXTENSION_TARGETS * 2 + 1]; /* alternate basenames */
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
323 gint i, y;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
324
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
325 g_return_val_if_fail(skin != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
326 g_return_val_if_fail(id < SKIN_PIXMAP_COUNT, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
327
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
328 pixmap_id_mapping = skin_pixmap_id_lookup(id);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
329 g_return_val_if_fail(pixmap_id_mapping != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
330
442
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
331 memset(&basenames, 0, sizeof(basenames));
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
332
639
9d2c175e458e [svn] More skin-related fixups. One segfault fix by Michael Hanselmann and a fix by Daniel Drake to also display skins that lack a thumbnail.
chainsaw
parents: 638
diff changeset
333 for (i = 0, y = 0; i < EXTENSION_TARGETS; i++, y++)
442
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
334 {
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
335 basenames[y] = g_strdup_printf("%s.%s", pixmap_id_mapping->name,
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
336 ext_targets[i]);
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
337
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
338 if (pixmap_id_mapping->alt_name)
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
339 basenames[++y] = g_strdup_printf("%s.%s",
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
340 pixmap_id_mapping->alt_name, ext_targets[i]);
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
341 }
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
342
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
343 path = path_p ? path_p : skin->path;
442
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
344 filename = skin_pixmap_locate(path, basenames);
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
345
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
346 for (i = 0; basenames[i] != NULL; i++)
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
347 {
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
348 g_free(basenames[i]);
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
349 basenames[i] = NULL;
10535124cc8a [svn] This commit allows for the use of alternate formats to bmp in skin
nenolod
parents: 383
diff changeset
350 }
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
351
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
352 if (!(gpm = pixmap_new_from_file(filename))) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
353 g_warning("loading of %s failed", filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
354 g_free(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
355 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
356 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
357
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
358 g_free(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
359
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
360 gdk_window_get_size(gpm, &width, &height);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
361 pm = &skin->pixmaps[id];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
362 pm->pixmap = gpm;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
363 pm->width = width;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
364 pm->height = height;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
365 pm->current_width = width;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
366 pm->current_height = height;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
367
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
368 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
369 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
370
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
371 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
372 skin_mask_create(Skin * skin,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
373 const gchar * path,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
374 gint id,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
375 GdkWindow * window)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
376 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
377 skin->masks[id] =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
378 skin_create_transparent_mask(path, "region.txt",
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
379 skin_mask_info[id].inistr, window,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
380 skin_mask_info[id].width,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
381 skin_mask_info[id].height);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
382 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
383
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
384 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
385 skin_setup_masks(Skin * skin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
386 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
387 GdkBitmap *mask;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
388
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
389 if (cfg.show_wm_decorations)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
390 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
391
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
392 if (cfg.player_visible) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
393 mask = skin_get_mask(skin, SKIN_MASK_MAIN + cfg.player_shaded);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
394 gtk_widget_shape_combine_mask(mainwin, mask, 0, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
395 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
396
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
397 mask = skin_get_mask(skin, SKIN_MASK_EQ + cfg.equalizer_shaded);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
398 gtk_widget_shape_combine_mask(equalizerwin, mask, 0, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
399 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
400
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
401 static GdkBitmap *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
402 create_default_mask(GdkWindow * parent, gint w, gint h)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
403 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
404 GdkBitmap *ret;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
405 GdkGC *gc;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
406 GdkColor pattern;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
407
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
408 ret = gdk_pixmap_new(parent, w, h, 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
409 gc = gdk_gc_new(ret);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
410 pattern.pixel = 1;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
411 gdk_gc_set_foreground(gc, &pattern);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
412 gdk_draw_rectangle(ret, gc, TRUE, 0, 0, w, h);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
413 gdk_gc_destroy(gc);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
414
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
415 return ret;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
416 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
417
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
418 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
419 skin_query_color(GdkColormap * cm, GdkColor * c)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
420 {
625
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
421 XColor xc = { 0,0,0,0,0,0 };
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
422
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
423 xc.pixel = c->pixel;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
424 XQueryColor(GDK_COLORMAP_XDISPLAY(cm), GDK_COLORMAP_XCOLORMAP(cm), &xc);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
425 c->red = xc.red;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
426 c->green = xc.green;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
427 c->blue = xc.blue;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
428 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
429
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
430 static glong
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
431 skin_calc_luminance(GdkColor * c)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
432 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
433 return (0.212671 * c->red + 0.715160 * c->green + 0.072169 * c->blue);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
434 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
435
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
436 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
437 skin_get_textcolors(GdkPixmap * text, GdkColor * bgc, GdkColor * fgc)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
438 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
439 /*
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
440 * Try to extract reasonable background and foreground colors
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
441 * from the font pixmap
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
442 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
443
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
444 GdkImage *gi;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
445 GdkColormap *cm;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
446 gint i;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
447
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
448 g_return_if_fail(text != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
449
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
450 /* Get the first line of text */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
451 gi = gdk_drawable_get_image(text, 0, 0, 152, 6);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
452 cm = gdk_window_get_colormap(playlistwin->window);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
453 g_return_if_fail(GDK_IS_WINDOW(playlistwin->window));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
454
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
455 for (i = 0; i < 6; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
456 GdkColor c;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
457 gint x;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
458 glong d, max_d;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
459
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
460 /* Get a pixel from the middle of the space character */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
461 bgc[i].pixel = gdk_image_get_pixel(gi, 151, i);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
462 skin_query_color(cm, &bgc[i]);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
463
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
464 max_d = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
465 for (x = 1; x < 150; x++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
466 c.pixel = gdk_image_get_pixel(gi, x, i);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
467 skin_query_color(cm, &c);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
468
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
469 d = labs(skin_calc_luminance(&c) - skin_calc_luminance(&bgc[i]));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
470 if (d > max_d) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
471 memcpy(&fgc[i], &c, sizeof(GdkColor));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
472 max_d = d;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
473 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
474 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
475 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
476 gdk_image_destroy(gi);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
477 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
478
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
479 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
480 init_skins(const gchar * path)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
481 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
482 bmp_active_skin = skin_new();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
483
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
484 if (!bmp_active_skin_load(path)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
485 /* FIXME: Oddly, g_message() causes a crash if path is NULL on
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
486 * Solaris (see bug #165) */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
487 if (path)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
488 g_message("Unable to load skin (%s), trying default...", path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
489
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
490 /* can't load configured skin, retry with default */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
491 if (!bmp_active_skin_load(BMP_DEFAULT_SKIN_PATH)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
492 g_message("Unable to load default skin (%s)! Giving up.",
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
493 BMP_DEFAULT_SKIN_PATH);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
494 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
495 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
496 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
497
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
498 if (cfg.random_skin_on_play)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
499 skinlist_update();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
500
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
501 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
502 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
503
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
504 static guint
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
505 hex_chars_to_int(gchar hi, gchar lo)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
506 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
507 /*
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
508 * Converts a value in the range 0x00-0xFF
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
509 * to a integer in the range 0-65535
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
510 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
511 gchar str[3];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
512
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
513 str[0] = hi;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
514 str[1] = lo;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
515 str[2] = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
516
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
517 return (CLAMP(strtol(str, NULL, 16), 0, 0xFF) << 8);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
518 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
519
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
520 GdkColor *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
521 skin_load_color(const gchar * path, const gchar * file,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
522 const gchar * section, const gchar * key)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
523 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
524 gchar *filename, *value;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
525 GdkColor *color = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
526
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
527 filename = find_file_recursively(path, file);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
528 if (filename) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
529 value = read_ini_string(filename, section, key);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
530 if (value) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
531 gchar *ptr = value;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
532 gint len;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
533
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
534 color = g_new0(GdkColor, 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
535 g_strstrip(value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
536
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
537 if (value[0] == '#')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
538 ptr++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
539 len = strlen(ptr);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
540
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
541 /*
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
542 * The handling of incomplete values is done this way
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
543 * to maximize winamp compatibility
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
544 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
545 if (len >= 6) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
546 color->red = hex_chars_to_int(*ptr, *(ptr + 1));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
547 ptr += 2;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
548 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
549 if (len >= 4) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
550 color->green = hex_chars_to_int(*ptr, *(ptr + 1));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
551 ptr += 2;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
552 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
553 if (len >= 2)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
554 color->blue = hex_chars_to_int(*ptr, *(ptr + 1));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
555
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
556
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
557 gdk_color_alloc(gdk_window_get_colormap(playlistwin->window),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
558 color);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
559 g_free(value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
560 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
561 g_free(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
562 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
563 return color;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
564 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
565
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
566
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
567
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
568 GdkBitmap *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
569 skin_create_transparent_mask(const gchar * path,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
570 const gchar * file,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
571 const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
572 GdkWindow * window,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
573 gint width,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
574 gint height)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
575 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
576 GdkBitmap *mask = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
577 GdkGC *gc = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
578 GdkColor pattern;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
579 GdkPoint *gpoints;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
580
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
581 gchar *filename = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
582 gboolean created_mask = FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
583 GArray *num, *point;
625
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
584 guint i, j;
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
585 gint k;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
586
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
587 if (path)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
588 filename = find_file_recursively(path, file);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
589
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
590 /* filename will be null if path wasn't set */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
591 if (!filename) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
592 return create_default_mask(window, width, height);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
593 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
594
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
595 if ((num = read_ini_array(filename, section, "NumPoints")) == NULL) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
596 g_free(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
597 return NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
598 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
599
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
600 if ((point = read_ini_array(filename, section, "PointList")) == NULL) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
601 g_array_free(num, TRUE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
602 g_free(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
603 return NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
604 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
605
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
606 mask = gdk_pixmap_new(window, width, height, 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
607 gc = gdk_gc_new(mask);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
608
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
609 pattern.pixel = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
610 gdk_gc_set_foreground(gc, &pattern);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
611 gdk_draw_rectangle(mask, gc, TRUE, 0, 0, width, height);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
612 pattern.pixel = 1;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
613 gdk_gc_set_foreground(gc, &pattern);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
614
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
615 j = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
616 for (i = 0; i < num->len; i++) {
625
0a73d1faeb4e [svn] GCC 4.1 warning fixes by Diego 'Flameeyes' Petteno from Gentoo.
chainsaw
parents: 443
diff changeset
617 if ((int)(point->len - j) >= (g_array_index(num, gint, i) * 2)) {
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
618 created_mask = TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
619 gpoints = g_new(GdkPoint, g_array_index(num, gint, i));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
620 for (k = 0; k < g_array_index(num, gint, i); k++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
621 gpoints[k].x = g_array_index(point, gint, j + k * 2);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
622 gpoints[k].y = g_array_index(point, gint, j + k * 2 + 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
623 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
624 j += k * 2;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
625 gdk_draw_polygon(mask, gc, TRUE, gpoints,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
626 g_array_index(num, gint, i));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
627 g_free(gpoints);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
628 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
629 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
630 g_array_free(num, TRUE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
631 g_array_free(point, TRUE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
632 g_free(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
633
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
634 if (!created_mask)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
635 gdk_draw_rectangle(mask, gc, TRUE, 0, 0, width, height);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
636
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
637 gdk_gc_destroy(gc);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
638
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
639 return mask;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
640 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
641
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
642 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
643 skin_load_viscolor(Skin * skin, const gchar * path, const gchar * basename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
644 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
645 FILE *file;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
646 gint i, c;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
647 gchar line[256], *filename;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
648 GArray *a;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
649
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
650 g_return_if_fail(skin != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
651 g_return_if_fail(path != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
652 g_return_if_fail(basename != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
653
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
654 skin_set_default_vis_color(skin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
655
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
656 filename = find_file_recursively(path, basename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
657 if (!filename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
658 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
659
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
660 if (!(file = fopen(filename, "r"))) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
661 g_free(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
662 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
663 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
664
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
665 g_free(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
666
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
667 for (i = 0; i < 24; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
668 if (fgets(line, 255, file)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
669 a = string_to_garray(line);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
670 if (a->len > 2) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
671 for (c = 0; c < 3; c++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
672 skin->vis_color[i][c] = g_array_index(a, gint, c);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
673 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
674 g_array_free(a, TRUE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
675 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
676 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
677 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
678 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
679
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
680 fclose(file);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
681 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
682
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
683 #if 0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
684 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
685 skin_numbers_generate_dash(Skin * skin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
686 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
687 GdkGC *gc;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
688 GdkPixmap *pixmap;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
689 SkinPixmap *numbers;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
690
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
691 g_return_if_fail(skin != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
692
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
693 numbers = &skin->pixmaps[SKIN_NUMBERS];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
694 if (!numbers->pixmap || numbers->current_width < 99)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
695 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
696
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
697 gc = gdk_gc_new(numbers->pixmap);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
698 pixmap = gdk_pixmap_new(mainwin->window, 108,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
699 numbers->current_height,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
700 -1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
701
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
702 skin_draw_pixmap(skin, pixmap, gc, SKIN_NUMBERS, 0, 0, 0, 0, 99, 13);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
703 skin_draw_pixmap(skin, pixmap, gc, SKIN_NUMBERS, 90, 0, 99, 0, 9, 13);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
704 skin_draw_pixmap(skin, pixmap, gc, SKIN_NUMBERS, 20, 6, 101, 6, 5, 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
705
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
706 g_object_unref(numbers->pixmap);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
707 g_object_unref(gc);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
708
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
709 numbers->pixmap = pixmap;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
710 numbers->current_width = 108;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
711 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
712 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
713
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
714 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
715 skin_load_cursor(Skin * skin, const gchar * dirname)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
716 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
717 const gchar * basename = "normal.cur";
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
718 gchar * filename = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
719 GdkPixbuf * cursor_pixbuf = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
720 GdkPixbufAnimation * cursor_animated = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
721 GdkCursor * cursor_gdk = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
722 GError * error = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
723
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
724 filename = find_file_recursively(dirname, basename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
725
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
726 if (filename && cfg.custom_cursors) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
727 cursor_animated = gdk_pixbuf_animation_new_from_file(filename, &error);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
728 cursor_pixbuf = gdk_pixbuf_animation_get_static_image(cursor_animated);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
729 cursor_gdk = gdk_cursor_new_from_pixbuf(gdk_display_get_default(),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
730 cursor_pixbuf, 0, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
731 } else {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
732 cursor_gdk = gdk_cursor_new(GDK_LEFT_PTR);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
733 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
734
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
735 gdk_window_set_cursor(mainwin->window, cursor_gdk);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
736 gdk_window_set_cursor(playlistwin->window, cursor_gdk);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
737 gdk_window_set_cursor(equalizerwin->window, cursor_gdk);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
738 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
739
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
740 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
741 skin_load_pixmaps(Skin * skin, const gchar * path)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
742 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
743 GdkPixmap *text_pm;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
744 guint i;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
745
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
746 for (i = 0; i < SKIN_PIXMAP_COUNT; i++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
747 skin_load_pixmap_id(skin, i, path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
748
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
749 text_pm = skin->pixmaps[SKIN_TEXT].pixmap;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
750
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
751 if (text_pm)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
752 skin_get_textcolors(text_pm, skin->textbg, skin->textfg);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
753
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
754 #if 0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
755 if (skin->pixmaps[SKIN_NUMBERS].pixmap)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
756 skin_numbers_generate_dash(skin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
757 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
758
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
759 skin->colors[SKIN_PLEDIT_NORMAL] =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
760 skin_load_color(path, "pledit.txt", "text", "normal");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
761 skin->colors[SKIN_PLEDIT_CURRENT] =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
762 skin_load_color(path, "pledit.txt", "text", "current");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
763 skin->colors[SKIN_PLEDIT_NORMALBG] =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
764 skin_load_color(path, "pledit.txt", "text", "normalbg");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
765 skin->colors[SKIN_PLEDIT_SELECTEDBG] =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
766 skin_load_color(path, "pledit.txt", "text", "selectedbg");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
767
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
768 skin_mask_create(skin, path, SKIN_MASK_MAIN, mainwin->window);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
769 skin_mask_create(skin, path, SKIN_MASK_MAIN_SHADE, mainwin->window);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
770
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
771 skin_mask_create(skin, path, SKIN_MASK_EQ, equalizerwin->window);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
772 skin_mask_create(skin, path, SKIN_MASK_EQ_SHADE, equalizerwin->window);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
773
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
774 skin_load_viscolor(skin, path, "viscolor.txt");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
775 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
776
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
777 static gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
778 skin_load_nolock(Skin * skin, const gchar * path, gboolean force)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
779 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
780 gchar *cpath;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
781
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
782 g_return_val_if_fail(skin != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
783 g_return_val_if_fail(path != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
784 REQUIRE_LOCK(skin->lock);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
785
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
786 if (!g_file_test(path, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_DIR))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
787 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
788
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
789 if (!force) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
790 if (skin->path)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
791 if (!strcmp(skin->path, path))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
792 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
793 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
794
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
795 skin_current_num++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
796
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
797 skin->path = g_strdup(path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
798
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
799
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
800 if (!file_is_archive(path)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
801 skin_load_pixmaps(skin, path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
802 skin_load_cursor(skin, path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
803 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
804 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
805
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
806 if (!(cpath = archive_decompress(path))) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
807 g_message("Unable to extract skin archive (%s)", path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
808 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
809 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
810
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
811 skin_load_pixmaps(skin, cpath);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
812 skin_load_cursor(skin, cpath);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
813 del_directory(cpath);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
814 g_free(cpath);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
815
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
816 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
817 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
818
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
819 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
820 skin_install_skin(const gchar * path)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
821 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
822 gchar *command;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
823
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
824 g_return_if_fail(path != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
825
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
826 command = g_strdup_printf("cp %s %s", path, bmp_paths[BMP_PATH_USER_SKIN_DIR]);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
827 if (system(command)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
828 g_message("Unable to install skin (%s) into user directory (%s)",
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
829 path, bmp_paths[BMP_PATH_USER_SKIN_DIR]);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
830 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
831 g_free(command);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
832 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
833
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
834
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
835 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
836 skin_load(Skin * skin, const gchar * path)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
837 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
838 gboolean error;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
839
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
840 g_return_val_if_fail(skin != NULL, FALSE);
638
72ec4db929ed [svn] Do not throw SIGABRT when path == NULL, g_return_val_if_fail logs a critical message and will abort. Patch courtesy of Daniel Drake from Gentoo.
chainsaw
parents: 625
diff changeset
841
72ec4db929ed [svn] Do not throw SIGABRT when path == NULL, g_return_val_if_fail logs a critical message and will abort. Patch courtesy of Daniel Drake from Gentoo.
chainsaw
parents: 625
diff changeset
842 if (!path)
72ec4db929ed [svn] Do not throw SIGABRT when path == NULL, g_return_val_if_fail logs a critical message and will abort. Patch courtesy of Daniel Drake from Gentoo.
chainsaw
parents: 625
diff changeset
843 return FALSE;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
844
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
845 skin_lock(skin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
846 error = skin_load_nolock(skin, path, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
847 skin_unlock(skin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
848
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
849 return error;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
850 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
851
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
852 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
853 skin_reload_forced(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
854 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
855 gboolean error;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
856
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
857 skin_lock(bmp_active_skin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
858 error = skin_load_nolock(bmp_active_skin, bmp_active_skin->path, TRUE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
859 skin_unlock(bmp_active_skin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
860
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
861 return error;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
862 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
863
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
864 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
865 skin_reload(Skin * skin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
866 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
867 g_return_if_fail(skin != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
868 skin_load_nolock(skin, skin->path, TRUE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
869 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
870
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
871
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
872 static SkinPixmap *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
873 skin_get_pixmap(Skin * skin, SkinPixmapId map_id)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
874 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
875 g_return_val_if_fail(skin != NULL, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
876 g_return_val_if_fail(map_id < SKIN_PIXMAP_COUNT, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
877
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
878 return &skin->pixmaps[map_id];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
879 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
880
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
881 GdkBitmap *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
882 skin_get_mask(Skin * skin, SkinMaskId mi)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
883 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
884 g_return_val_if_fail(skin != NULL, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
885 g_return_val_if_fail(mi < SKIN_PIXMAP_COUNT, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
886
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
887 return skin->masks[mi];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
888 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
889
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
890 GdkColor *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
891 skin_get_color(Skin * skin, SkinColorId color_id)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
892 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
893 GdkColor *ret = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
894
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
895 g_return_val_if_fail(skin != NULL, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
896
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
897 switch (color_id) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
898 case SKIN_TEXTBG:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
899 if (skin->pixmaps[SKIN_TEXT].pixmap)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
900 ret = skin->textbg;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
901 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
902 ret = skin->def_textbg;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
903 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
904 case SKIN_TEXTFG:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
905 if (skin->pixmaps[SKIN_TEXT].pixmap)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
906 ret = skin->textfg;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
907 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
908 ret = skin->def_textfg;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
909 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
910 default:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
911 if (color_id < SKIN_COLOR_COUNT)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
912 ret = skin->colors[color_id];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
913 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
914 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
915 return ret;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
916 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
917
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
918 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
919 skin_get_viscolor(Skin * skin, guchar vis_color[24][3])
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
920 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
921 gint i;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
922
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
923 g_return_if_fail(skin != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
924
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
925 for (i = 0; i < 24; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
926 vis_color[i][0] = skin->vis_color[i][0];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
927 vis_color[i][1] = skin->vis_color[i][1];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
928 vis_color[i][2] = skin->vis_color[i][2];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
929 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
930 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
931
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
932 gint
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
933 skin_get_id(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
934 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
935 return skin_current_num;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
936 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
937
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
938 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
939 skin_draw_pixmap(Skin * skin, GdkDrawable * drawable, GdkGC * gc,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
940 SkinPixmapId pixmap_id,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
941 gint xsrc, gint ysrc, gint xdest, gint ydest,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
942 gint width, gint height)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
943 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
944 SkinPixmap *pixmap;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
945
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
946 g_return_if_fail(skin != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
947
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
948 pixmap = skin_get_pixmap(skin, pixmap_id);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
949 g_return_if_fail(pixmap != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
950 g_return_if_fail(pixmap->pixmap != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
951
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
952 if (xsrc > pixmap->width || ysrc > pixmap->height)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
953 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
954
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
955 width = MIN(width, pixmap->width - xsrc);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
956 height = MIN(height, pixmap->height - ysrc);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
957 gdk_draw_pixmap(drawable, gc, pixmap->pixmap, xsrc, ysrc,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
958 xdest, ydest, width, height);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
959 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
960
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
961 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
962 skin_get_eq_spline_colors(Skin * skin, guint32 colors[19])
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
963 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
964 gint i;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
965 GdkPixmap *pixmap;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
966 GdkImage *img;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
967 SkinPixmap *eqmainpm;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
968
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
969 g_return_if_fail(skin != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
970
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
971 eqmainpm = &skin->pixmaps[SKIN_EQMAIN];
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
972 if (eqmainpm->pixmap &&
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
973 eqmainpm->current_width >= 116 && eqmainpm->current_height >= 313)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
974 pixmap = eqmainpm->pixmap;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
975 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
976 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
977
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
978 if (!GDK_IS_DRAWABLE(pixmap))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
979 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
980
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
981 if (!(img = gdk_drawable_get_image(pixmap, 115, 294, 1, 19)))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
982 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
983
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
984 for (i = 0; i < 19; i++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
985 colors[i] = gdk_image_get_pixel(img, 0, i);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
986
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
987 gdk_image_destroy(img);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
988 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
989
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
990
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
991 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
992 skin_draw_playlistwin_frame_top(Skin * skin,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
993 GdkDrawable * drawable,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
994 GdkGC * gc,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
995 gint width, gint height, gboolean focus)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
996 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
997 /* The title bar skin consists of 2 sets of 4 images, 1 set
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
998 * for focused state and the other for unfocused. The 4 images
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
999 * are:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1000 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1001 * a. right corner (25,20)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1002 * b. left corner (25,20)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1003 * c. tiler (25,20)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1004 * d. title (100,20)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1005 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1006 * min allowed width = 100+25+25 = 150
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1007 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1008
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1009 gint i, y, c;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1010
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1011 /* get y offset of the pixmap set to use */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1012 if (focus)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1013 y = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1014 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1015 y = 21;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1016
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1017 /* left corner */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1018 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 0, y, 0, 0, 25, 20);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1019
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1020 /* titlebar title */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1021 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 26, y,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1022 (width - 100) / 2, 0, 100, 20);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1023
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1024 /* titlebar right corner */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1025 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 153, y,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1026 width - 25, 0, 25, 20);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1027
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1028 /* tile draw the remaining frame */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1029
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1030 /* compute tile count */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1031 c = (width - (100 + 25 + 25)) / 25;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1032
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1033 for (i = 0; i < c / 2; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1034 /* left of title */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1035 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 127, y,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1036 25 + i * 25, 0, 25, 20);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1037
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1038 /* right of title */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1039 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 127, y,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1040 (width + 100) / 2 + i * 25, 0, 25, 20);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1041 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1042
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1043 if (c & 1) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1044 /* Odd tile count, so one remaining to draw. Here we split
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1045 * it into two and draw half on either side of the title */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1046 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 127, y,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1047 ((c / 2) * 25) + 25, 0, 12, 20);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1048 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 127, y,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1049 (width / 2) + ((c / 2) * 25) + 50, 0, 13, 20);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1050 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1051 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1052
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1053 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1054 skin_draw_playlistwin_frame_bottom(Skin * skin,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1055 GdkDrawable * drawable,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1056 GdkGC * gc,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1057 gint width, gint height, gboolean focus)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1058 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1059 /* The bottom frame skin consists of 1 set of 4 images. The 4
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1060 * images are:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1061 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1062 * a. left corner with menu buttons (125,38)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1063 * b. visualization window (75,38)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1064 * c. right corner with play buttons (150,38)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1065 * d. frame tile (25,38)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1066 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1067 * (min allowed width = 125+150+25=300
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1068 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1069
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1070 gint i, c;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1071
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1072 /* bottom left corner (menu buttons) */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1073 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 0, 72,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1074 0, height - 38, 125, 38);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1075
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1076 c = (width - 275) / 25;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1077
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1078 /* draw visualization window, if width allows */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1079 if (c >= 3) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1080 c -= 3;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1081 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 205, 0,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1082 width - (150 + 75), height - 38, 75, 38);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1083 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1084
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1085 /* Bottom right corner (playbuttons etc) */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1086 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1087 126, 72, width - 150, height - 38, 150, 38);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1088
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1089 /* Tile draw the remaining undrawn portions */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1090 for (i = 0; i < c; i++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1091 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 179, 0,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1092 125 + i * 25, height - 38, 25, 38);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1093 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1094
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1095 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1096 skin_draw_playlistwin_frame_sides(Skin * skin,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1097 GdkDrawable * drawable,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1098 GdkGC * gc,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1099 gint width, gint height, gboolean focus)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1100 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1101 /* The side frames consist of 2 tile images. 1 for the left, 1 for
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1102 * the right.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1103 * a. left (12,29)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1104 * b. right (19,29)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1105 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1106
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1107 gint i;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1108
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1109 /* frame sides */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1110 for (i = 0; i < (height - (20 + 38)) / 29; i++) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1111 /* left */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1112 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 0, 42,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1113 0, 20 + i * 29, 12, 29);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1114
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1115 /* right */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1116 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 32, 42,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1117 width - 19, 20 + i * 29, 19, 29);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1118 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1119 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1120
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1121
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1122 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1123 skin_draw_playlistwin_frame(Skin * skin,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1124 GdkDrawable * drawable, GdkGC * gc,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1125 gint width, gint height, gboolean focus)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1126 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1127 skin_draw_playlistwin_frame_top(skin, drawable, gc, width, height, focus);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1128 skin_draw_playlistwin_frame_bottom(skin, drawable, gc, width, height,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1129 focus);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1130 skin_draw_playlistwin_frame_sides(skin, drawable, gc, width, height,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1131 focus);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1132 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1133
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1134
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1135 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1136 skin_draw_playlistwin_shaded(Skin * skin,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1137 GdkDrawable * drawable, GdkGC * gc,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1138 gint width, gboolean focus)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1139 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1140 /* The shade mode titlebar skin consists of 4 images:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1141 * a) left corner offset (72,42) size (25,14)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1142 * b) right corner, focused offset (99,57) size (50,14)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1143 * c) right corner, unfocused offset (99,42) size (50,14)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1144 * d) bar tile offset (72,57) size (25,14)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1145 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1146
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1147 gint i;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1148
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1149 /* left corner */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1150 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 72, 42, 0, 0, 25, 14);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1151
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1152 /* bar tile */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1153 for (i = 0; i < (width - 75) / 25; i++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1154 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 72, 57,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1155 (i * 25) + 25, 0, 25, 14);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1156
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1157 /* right corner */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1158 skin_draw_pixmap(skin, drawable, gc, SKIN_PLEDIT, 99, focus ? 57 : 42,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1159 width - 50, 0, 50, 14);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1160 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1161
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1162
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1163 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1164 skin_draw_mainwin_titlebar(Skin * skin,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1165 GdkDrawable * drawable, GdkGC * gc,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1166 gboolean shaded, gboolean focus)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1167 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1168 /* The titlebar skin consists of 2 sets of 2 images, one for for
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1169 * shaded and the other for unshaded mode, giving a total of 4.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1170 * The images are exactly 275x14 pixels, aligned and arranged
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1171 * vertically on each other in the pixmap in the following order:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1172 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1173 * a) unshaded, focused offset (27, 0)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1174 * b) unshaded, unfocused offset (27, 15)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1175 * c) shaded, focused offset (27, 29)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1176 * d) shaded, unfocused offset (27, 42)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1177 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1178
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1179 gint y_offset;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1180
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1181 if (shaded) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1182 if (focus)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1183 y_offset = 29;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1184 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1185 y_offset = 42;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1186 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1187 else {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1188 if (focus)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1189 y_offset = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1190 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1191 y_offset = 15;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1192 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1193
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1194 skin_draw_pixmap(skin, drawable, gc, SKIN_TITLEBAR, 27, y_offset,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1195 0, 0, MAINWIN_WIDTH, MAINWIN_TITLEBAR_HEIGHT);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1196 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1197
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1198 #if 0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1199 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1200 skin_draw_mainwin(Skin * skin,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1201 GdkDrawable * drawable, GdkGC gc,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1202 gboolean doublesize, gboolean shaded, gboolean focus)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1203 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1204
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1205 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1206 #endif