Mercurial > mplayer.hg
annotate gui/win32/skinload.c @ 37081:e8559b9913ff
New GUI feature: Rotate a video.
It is accessible from the context menu.
Based on a complain by Linus about video players that don't easily allow
rotating a video. (Thanks to compn for pointing that out.)
Realize the feature by adding and/or removing appropriate video filters.
Additionally, add new GUI message evSetRotation and update documentation.
author | ib |
---|---|
date | Thu, 24 Apr 2014 14:41:04 +0000 |
parents | b28b632efeef |
children |
rev | line source |
---|---|
23077 | 1 /* |
23079 | 2 * MPlayer GUI for Win32 |
3 * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de> | |
4 * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com> | |
5 * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it> | |
6 * | |
7 * This file is part of MPlayer. | |
8 * | |
9 * MPlayer is free software; you can redistribute it and/or modify | |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * MPlayer is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
26457 | 19 * You should have received a copy of the GNU General Public License along |
20 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
23079 | 22 */ |
23077 | 23 |
33761 | 24 #include <string.h> |
23077 | 25 #include <stdlib.h> |
23796 | 26 #include <stdio.h> |
23077 | 27 #include <inttypes.h> |
37053 | 28 #include <math.h> |
23077 | 29 #include <windows.h> |
30 | |
23091
52488bb09d90
Consistently use quotes instead of angled brackets in #include
diego
parents:
23079
diff
changeset
|
31 #include "mp_msg.h" |
36891
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
32 #include "help_mp.h" |
23091
52488bb09d90
Consistently use quotes instead of angled brackets in #include
diego
parents:
23079
diff
changeset
|
33 #include "cpudetect.h" |
52488bb09d90
Consistently use quotes instead of angled brackets in #include
diego
parents:
23079
diff
changeset
|
34 #include "libswscale/swscale.h" |
37053 | 35 #include "libavutil/attributes.h" |
36 #include "libavutil/common.h" | |
32833
c4891d10ddbb
Adjust #include paths after the merge of libavcore into libavutil in FFmpeg.
diego
parents:
32537
diff
changeset
|
37 #include "libavutil/imgutils.h" |
23077 | 38 #include "gui.h" |
33770 | 39 #include "gui/util/mem.h" |
33046 | 40 #include "gui/util/bitmap.h" |
23077 | 41 |
42 #define MAX_LINESIZE 256 | |
43 | |
44 typedef struct | |
45 { | |
46 int msg; | |
47 char *name; | |
48 } evName; | |
49 | |
50 static const evName evNames[] = | |
51 { | |
52 { evNone, "evNone" }, | |
53 { evPlay, "evPlay" }, | |
54 { evStop, "evStop" }, | |
55 { evPause, "evPause" }, | |
56 { evPrev, "evPrev" }, | |
57 { evNext, "evNext" }, | |
58 { evLoad, "evLoad" }, | |
34317 | 59 { evLoadPlay, "evLoadPlay" }, |
60 { evLoadAudioFile, "evLoadAudioFile" }, | |
61 { evLoadSubtitle, "evLoadSubtitle" }, | |
62 { evDropSubtitle, "evDropSubtitle" }, | |
34321
daebf766dea6
Cosmetic: Synchronize evPlaylist event and message names.
ib
parents:
34320
diff
changeset
|
63 { evPlaylist, "evPlaylist" }, |
34387 | 64 { evPlayCD, "evPlayCD" }, |
34317 | 65 { evPlayVCD, "evPlayVCD" }, |
66 { evPlayDVD, "evPlayDVD" }, | |
34324 | 67 { evLoadURL, "evSetURL" }, // legacy |
68 { evLoadURL, "evLoadURL" }, | |
36429 | 69 { evPlayTV, "evPlayTV" }, |
34317 | 70 { evPlaySwitchToPause, "evPlaySwitchToPause" }, |
71 { evPauseSwitchToPlay, "evPauseSwitchToPlay" }, | |
23077 | 72 { evBackward10sec, "evBackward10sec" }, |
73 { evForward10sec, "evForward10sec" }, | |
74 { evBackward1min, "evBackward1min" }, | |
75 { evForward1min, "evForward1min" }, | |
76 { evBackward10min, "evBackward10min" }, | |
77 { evForward10min, "evForward10min" }, | |
34317 | 78 { evSetMoviePosition, "evSetMoviePosition" }, |
34320 | 79 { evHalfSize, "evHalfSize" }, |
34317 | 80 { evDoubleSize, "evDoubleSize" }, |
81 { evFullScreen, "evFullScreen" }, | |
82 { evNormalSize, "evNormalSize" }, | |
34322 | 83 { evSetAspect, "evSetAspect" }, |
37081 | 84 { evSetRotation, "evSetRotation" }, |
23077 | 85 { evIncVolume, "evIncVolume" }, |
86 { evDecVolume, "evDecVolume" }, | |
34317 | 87 { evSetVolume, "evSetVolume" }, |
23077 | 88 { evMute, "evMute" }, |
34317 | 89 { evSetBalance, "evSetBalance" }, |
90 { evEqualizer, "evEqualizer" }, | |
91 { evAbout, "evAbout" }, | |
92 { evPreferences, "evPreferences" }, | |
93 { evSkinBrowser, "evSkinBrowser" }, | |
34458 | 94 { evMenu, "evMenu" }, |
34317 | 95 { evIconify, "evIconify" }, |
34326 | 96 { evExit, "evExit" } |
23077 | 97 }; |
98 | |
99 static const int evBoxs = sizeof(evNames) / sizeof(evName); | |
100 | |
36890 | 101 static int linenumber; |
102 | |
36891
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
103 /** |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
104 * @brief Print a legacy information on an entry. |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
105 * |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
106 * @param old identifier (and deprecated entry) |
37065 | 107 * @param data string necessary for checking and to print the information on @a old |
36891
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
108 */ |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
109 static void skin_legacy (const char *old, const char *data) |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
110 { |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
111 const char *p; |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
112 |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
113 if (strcmp(old, "fontid") == 0) |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
114 { |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
115 p = strchr(data, ','); |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
116 |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
117 if (p) mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_SkinLegacy, linenumber, p, "font = fontfile"); |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
118 } |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
119 else if (strcmp(old, "$l") == 0) |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
120 { |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
121 p = strstr(old, data); |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
122 |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
123 if (p && (p == data || p[-1] != '$')) mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_SkinLegacy, linenumber, old, "$p"); |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
124 } |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
125 else if (strcmp(old, "evSetURL") == 0 && strcmp(data, old) == 0) |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
126 mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_SkinLegacy, linenumber, old, "evLoadURL"); |
36892 | 127 else if (strcmp(old, "sub") == 0 || strcmp(old, "potmeter") == 0) |
36891
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
128 mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_SkinLegacy, linenumber, old, data); |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
129 } |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
130 |
23077 | 131 static char *geteventname(int event) |
132 { | |
133 int i; | |
134 for(i=0; i<evBoxs; i++) | |
135 if(evNames[i].msg == event) | |
136 return evNames[i].name; | |
137 return NULL; | |
138 } | |
139 | |
140 /* reads a complete image as is into image buffer */ | |
33784 | 141 static image *pngRead(skin_t *skin, const char *fname) |
23077 | 142 { |
34996
ebcc17a3c165
Fix compiler warnings (comparison between signed and unsigned).
ib
parents:
34697
diff
changeset
|
143 unsigned int i; |
33555 | 144 guiImage bmp; |
23077 | 145 image *bf; |
23266
6cd7f1c23d90
Reuse linux code for reading png images for windows Gui,
reimar
parents:
23091
diff
changeset
|
146 char *filename = NULL; |
23077 | 147 FILE *fp; |
148 | |
149 if(!stricmp(fname, "NULL")) return 0; | |
150 | |
151 /* find filename in order file file.png */ | |
152 if(!(fp = fopen(fname, "rb"))) | |
153 { | |
154 filename = calloc(1, strlen(skin->skindir) + strlen(fname) + 6); | |
34092
dbf5042ab255
Don't use the Windows style path separator character in Win32 GUI.
ib
parents:
33784
diff
changeset
|
155 sprintf(filename, "%s/%s.png", skin->skindir, fname); |
23077 | 156 if(!(fp = fopen(filename, "rb"))) |
157 { | |
158 mp_msg(MSGT_GPLAYER, MSGL_ERR, "[png] cannot find image %s\n", filename); | |
159 free(filename); | |
160 return 0; | |
161 } | |
162 } | |
23266
6cd7f1c23d90
Reuse linux code for reading png images for windows Gui,
reimar
parents:
23091
diff
changeset
|
163 fclose(fp); |
23077 | 164 |
165 for (i=0; i < skin->imagecount; i++) | |
166 if(!strcmp(fname, skin->images[i]->name)) | |
167 { | |
34450 | 168 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[png] skinfile %s already exists\n", fname); |
23266
6cd7f1c23d90
Reuse linux code for reading png images for windows Gui,
reimar
parents:
23091
diff
changeset
|
169 free(filename); |
23077 | 170 return skin->images[i]; |
171 } | |
172 (skin->imagecount)++; | |
173 skin->images = realloc(skin->images, sizeof(image *) * skin->imagecount); | |
174 bf = skin->images[(skin->imagecount) - 1] = calloc(1, sizeof(image)); | |
175 bf->name = strdup(fname); | |
23266
6cd7f1c23d90
Reuse linux code for reading png images for windows Gui,
reimar
parents:
23091
diff
changeset
|
176 bpRead(filename ? filename : fname, &bmp); |
6cd7f1c23d90
Reuse linux code for reading png images for windows Gui,
reimar
parents:
23091
diff
changeset
|
177 free(filename); |
6cd7f1c23d90
Reuse linux code for reading png images for windows Gui,
reimar
parents:
23091
diff
changeset
|
178 bf->width = bmp.Width; bf->height = bmp.Height; |
23077 | 179 |
180 bf->size = bf->width * bf->height * skin->desktopbpp / 8; | |
23266
6cd7f1c23d90
Reuse linux code for reading png images for windows Gui,
reimar
parents:
23091
diff
changeset
|
181 if (skin->desktopbpp == 32) |
6cd7f1c23d90
Reuse linux code for reading png images for windows Gui,
reimar
parents:
23091
diff
changeset
|
182 bf->data = bmp.Image; |
6cd7f1c23d90
Reuse linux code for reading png images for windows Gui,
reimar
parents:
23091
diff
changeset
|
183 else { |
32028
9e6fdede8ece
gui: remove direct usage of rgb2rgb interface, use swscale instead
ramiro
parents:
26457
diff
changeset
|
184 const uint8_t *src[4] = { bmp.Image, NULL, NULL, NULL}; |
9e6fdede8ece
gui: remove direct usage of rgb2rgb interface, use swscale instead
ramiro
parents:
26457
diff
changeset
|
185 int src_stride[4] = { 4 * bmp.Width, 0, 0, 0 }; |
9e6fdede8ece
gui: remove direct usage of rgb2rgb interface, use swscale instead
ramiro
parents:
26457
diff
changeset
|
186 uint8_t *dst[4] = { NULL, NULL, NULL, NULL }; |
9e6fdede8ece
gui: remove direct usage of rgb2rgb interface, use swscale instead
ramiro
parents:
26457
diff
changeset
|
187 int dst_stride[4]; |
35707
4ba6b8d3197e
Replace PixelFormat and PIX_FMT_FOO by their AV_-prefixed counterparts.
diego
parents:
35501
diff
changeset
|
188 enum AVPixelFormat out_pix_fmt = PIX_FMT_NONE; |
32028
9e6fdede8ece
gui: remove direct usage of rgb2rgb interface, use swscale instead
ramiro
parents:
26457
diff
changeset
|
189 struct SwsContext *sws; |
9e6fdede8ece
gui: remove direct usage of rgb2rgb interface, use swscale instead
ramiro
parents:
26457
diff
changeset
|
190 if (skin->desktopbpp == 16) out_pix_fmt = PIX_FMT_RGB555; |
9e6fdede8ece
gui: remove direct usage of rgb2rgb interface, use swscale instead
ramiro
parents:
26457
diff
changeset
|
191 else if (skin->desktopbpp == 24) out_pix_fmt = PIX_FMT_RGB24; |
9e6fdede8ece
gui: remove direct usage of rgb2rgb interface, use swscale instead
ramiro
parents:
26457
diff
changeset
|
192 av_image_fill_linesizes(dst_stride, out_pix_fmt, bmp.Width); |
9e6fdede8ece
gui: remove direct usage of rgb2rgb interface, use swscale instead
ramiro
parents:
26457
diff
changeset
|
193 sws = sws_getContext(bmp.Width, bmp.Height, PIX_FMT_RGB32, |
9e6fdede8ece
gui: remove direct usage of rgb2rgb interface, use swscale instead
ramiro
parents:
26457
diff
changeset
|
194 bmp.Width, bmp.Height, out_pix_fmt, |
9e6fdede8ece
gui: remove direct usage of rgb2rgb interface, use swscale instead
ramiro
parents:
26457
diff
changeset
|
195 SWS_POINT, NULL, NULL, NULL); |
23266
6cd7f1c23d90
Reuse linux code for reading png images for windows Gui,
reimar
parents:
23091
diff
changeset
|
196 bf->data = malloc(bf->size); |
32028
9e6fdede8ece
gui: remove direct usage of rgb2rgb interface, use swscale instead
ramiro
parents:
26457
diff
changeset
|
197 dst[0] = bf->data; |
9e6fdede8ece
gui: remove direct usage of rgb2rgb interface, use swscale instead
ramiro
parents:
26457
diff
changeset
|
198 sws_scale(sws, src, src_stride, 0, bmp.Height, dst, dst_stride); |
9e6fdede8ece
gui: remove direct usage of rgb2rgb interface, use swscale instead
ramiro
parents:
26457
diff
changeset
|
199 sws_freeContext(sws); |
23266
6cd7f1c23d90
Reuse linux code for reading png images for windows Gui,
reimar
parents:
23091
diff
changeset
|
200 free(bmp.Image); |
6cd7f1c23d90
Reuse linux code for reading png images for windows Gui,
reimar
parents:
23091
diff
changeset
|
201 } |
23077 | 202 return bf; |
203 } | |
204 | |
205 /* frees all skin images */ | |
206 static void freeimages(skin_t *skin) | |
207 { | |
208 unsigned int i; | |
209 for (i=0; i<skin->imagecount; i++) | |
210 { | |
211 if(skin->images && skin->images[i]) | |
212 { | |
32537
8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
cboesch
parents:
32028
diff
changeset
|
213 free(skin->images[i]->data); |
8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
cboesch
parents:
32028
diff
changeset
|
214 free(skin->images[i]->name); |
23077 | 215 free(skin->images[i]); |
216 } | |
217 } | |
218 free(skin->images); | |
219 } | |
220 | |
33621
18b47d32b0d0
win32 gui: Mark debug function only used within the file as static.
diego
parents:
33620
diff
changeset
|
221 static void dumpwidgets(skin_t *skin) |
23077 | 222 { |
223 unsigned int i; | |
224 for (i=0; i<skin->widgetcount; i++) | |
34450 | 225 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "widget %p id %i\n", skin->widgets[i], skin->widgets[i]->id); |
23077 | 226 } |
227 | |
228 static int counttonextchar(const char *s1, char c) | |
229 { | |
230 unsigned int i; | |
231 for (i=0; i<strlen(s1); i++) | |
232 if(s1[i] == c) return i; | |
233 return 0; | |
234 } | |
235 | |
236 static char *findnextstring(char *temp, const char *desc, int *base) | |
237 { | |
238 int len = counttonextchar(*base + desc, ','); | |
239 memset(temp, 0, strlen(desc) + 1); | |
240 if(!len) len = strlen(desc); | |
241 memcpy(temp, *base + desc, len); | |
242 *base += (len+1); | |
243 return temp; | |
244 } | |
245 | |
246 static void freeskin(skin_t *skin) | |
247 { | |
248 unsigned int i; | |
32537
8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
cboesch
parents:
32028
diff
changeset
|
249 |
33770 | 250 nfree(skin->skindir); |
23077 | 251 |
252 for (i=1; i<=skin->lastusedid; i++) | |
253 skin->removewidget(skin, i); | |
254 | |
33770 | 255 nfree(skin->widgets); |
23077 | 256 |
257 freeimages(skin); | |
258 for(i=0; i<skin->windowcount; i++) | |
259 { | |
33770 | 260 nfree(skin->windows[i]->name); |
23077 | 261 free(skin->windows[i]); |
262 } | |
263 | |
33770 | 264 nfree(skin->windows); |
23077 | 265 |
266 for (i=0; i<skin->fontcount; i++) | |
267 { | |
268 unsigned int x; | |
269 | |
33770 | 270 nfree(skin->fonts[i]->name); |
23077 | 271 |
272 for (x=0; x<skin->fonts[i]->charcount; x++) | |
33770 | 273 nfree(skin->fonts[i]->chars[x]); |
274 | |
275 nfree(skin->fonts[i]->chars); | |
23077 | 276 |
33770 | 277 nfree(skin->fonts[i]); |
23077 | 278 } |
33770 | 279 nfree(skin->fonts); |
34450 | 280 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN FREE] skin freed\n"); |
33770 | 281 nfree(skin); |
23077 | 282 } |
283 | |
284 static void removewidget(skin_t *skin, int id) | |
285 { | |
286 unsigned int i; | |
287 unsigned int pos=0; | |
288 widget **temp = calloc(skin->widgetcount - 1, sizeof(widget *)); | |
289 | |
290 for (i=0; i<skin->widgetcount; i++) | |
291 { | |
292 if(skin->widgets[i]->id == id) | |
293 { | |
32537
8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
cboesch
parents:
32028
diff
changeset
|
294 free(skin->widgets[i]->label); |
33770 | 295 nfree(skin->widgets[i]); |
23077 | 296 } |
297 else | |
298 { | |
299 temp[pos] = skin->widgets[i]; | |
300 pos++; | |
301 } | |
302 } | |
303 if (pos != i) | |
304 { | |
305 (skin->widgetcount)--; | |
306 free(skin->widgets); | |
307 skin->widgets = temp; | |
34450 | 308 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "removed widget %i\n", id); |
23077 | 309 return; |
310 } | |
311 free(temp); | |
312 mp_msg(MSGT_GPLAYER, MSGL_ERR, "widget %i not found\n", id); | |
313 } | |
314 | |
315 static void addwidget(skin_t *skin, window *win, const char *desc) | |
316 { | |
317 widget *mywidget; | |
318 char *temp = calloc(1, strlen(desc) + 1); | |
319 (skin->widgetcount)++; | |
320 (skin->lastusedid)++; | |
321 skin->widgets = realloc(skin->widgets, sizeof(widget *) * skin->widgetcount); | |
322 mywidget = skin->widgets[(skin->widgetcount) - 1] = calloc(1, sizeof(widget)); | |
323 mywidget->id = skin->lastusedid; | |
324 mywidget->window = win->type; | |
325 /* parse and fill widget specific info */ | |
326 if(!strncmp(desc, "base", 4)) | |
327 { | |
328 int base = counttonextchar(desc, '=') + 1; | |
329 mywidget->type = tyBase; | |
330 mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base)); | |
331 mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base)); | |
332 mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base)); | |
333 mywidget->wwidth = mywidget->width = atoi(findnextstring(temp, desc, &base)); | |
334 mywidget->wheight = mywidget->height = atoi(findnextstring(temp, desc, &base)); | |
335 win->base = mywidget; | |
34450 | 336 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [BASE] %s %i %i %i %i\n", |
23077 | 337 (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL, |
338 mywidget->x, mywidget->y, mywidget->width, mywidget->height); | |
339 } | |
340 else if(!strncmp(desc, "button", 6)) | |
341 { | |
342 int base = counttonextchar(desc, '=') + 1; | |
343 int i; | |
344 mywidget->type = tyButton; | |
345 mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base)); | |
346 mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base)); | |
347 mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base)); | |
348 mywidget->wwidth = mywidget->width = atoi(findnextstring(temp, desc, &base)); | |
349 mywidget->wheight = mywidget->height = atoi(findnextstring(temp, desc, &base)); | |
350 findnextstring(temp, desc, &base); | |
351 | |
352 /* Assign corresponding event to the widget */ | |
353 mywidget->msg = evNone; | |
354 for (i=0; i<evBoxs; i++) | |
355 { | |
356 if(!strcmp(temp, evNames[i].name)) | |
357 { | |
36891
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
358 // legacy |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
359 skin_legacy("evSetURL", temp); |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
360 |
23077 | 361 mywidget->msg = evNames[i].msg; |
362 break; | |
363 } | |
364 } | |
365 | |
34450 | 366 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [BUTTON] %s %i %i %i %i msg %i\n", |
23077 | 367 (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL, |
368 mywidget->x, mywidget->y, mywidget->width, mywidget->height, mywidget->msg); | |
369 } | |
37053 | 370 else if(!strncmp(desc, "hpotmeter", 9) || !strncmp(desc, "vpotmeter", 9) || !strncmp(desc, "rpotmeter", 9) || /* legacy */ !strncmp(desc, "potmeter", 8)) |
23077 | 371 { |
372 int base = counttonextchar(desc, '=') + 1; | |
37053 | 373 int i, av_uninit(x0), av_uninit(y0), av_uninit(x1), av_uninit(y1); |
23077 | 374 /* hpotmeter = button, bwidth, bheight, phases, numphases, default, X, Y, width, height, message */ |
36892 | 375 if(!strncmp(desc, "vpotmeter", 9)) mywidget->type = tyVpotmeter; |
37053 | 376 else if(!strncmp(desc, "rpotmeter", 9)) mywidget->type = tyRpotmeter; |
36892 | 377 else mywidget->type = tyHpotmeter; |
36896
737e2a3b9a5d
Change mapping of the deprecated potmeter in the Win32 GUI.
ib
parents:
36895
diff
changeset
|
378 if (*desc == 'p') |
36892 | 379 { |
36896
737e2a3b9a5d
Change mapping of the deprecated potmeter in the Win32 GUI.
ib
parents:
36895
diff
changeset
|
380 mywidget->bitmap[0] = NULL; |
737e2a3b9a5d
Change mapping of the deprecated potmeter in the Win32 GUI.
ib
parents:
36895
diff
changeset
|
381 mywidget->width = 0; |
737e2a3b9a5d
Change mapping of the deprecated potmeter in the Win32 GUI.
ib
parents:
36895
diff
changeset
|
382 mywidget->height = 0; |
737e2a3b9a5d
Change mapping of the deprecated potmeter in the Win32 GUI.
ib
parents:
36895
diff
changeset
|
383 |
737e2a3b9a5d
Change mapping of the deprecated potmeter in the Win32 GUI.
ib
parents:
36895
diff
changeset
|
384 // legacy |
737e2a3b9a5d
Change mapping of the deprecated potmeter in the Win32 GUI.
ib
parents:
36895
diff
changeset
|
385 skin_legacy("potmeter", "hpotmeter"); |
737e2a3b9a5d
Change mapping of the deprecated potmeter in the Win32 GUI.
ib
parents:
36895
diff
changeset
|
386 } |
737e2a3b9a5d
Change mapping of the deprecated potmeter in the Win32 GUI.
ib
parents:
36895
diff
changeset
|
387 else |
737e2a3b9a5d
Change mapping of the deprecated potmeter in the Win32 GUI.
ib
parents:
36895
diff
changeset
|
388 { |
737e2a3b9a5d
Change mapping of the deprecated potmeter in the Win32 GUI.
ib
parents:
36895
diff
changeset
|
389 mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base)); |
36893 | 390 mywidget->width = atoi(findnextstring(temp, desc, &base)); |
391 mywidget->height = atoi(findnextstring(temp, desc, &base)); | |
36892 | 392 } |
36896
737e2a3b9a5d
Change mapping of the deprecated potmeter in the Win32 GUI.
ib
parents:
36895
diff
changeset
|
393 mywidget->bitmap[1] = pngRead(skin, findnextstring(temp, desc, &base)); |
23077 | 394 mywidget->phases = atoi(findnextstring(temp, desc, &base)); |
37053 | 395 |
396 if (*desc == 'r') | |
397 { | |
398 x0 = atoi(findnextstring(temp, desc, &base)); | |
399 y0 = atoi(findnextstring(temp, desc, &base)); | |
400 x1 = atoi(findnextstring(temp, desc, &base)); | |
401 y1 = atoi(findnextstring(temp, desc, &base)); | |
402 } | |
403 | |
23077 | 404 mywidget->value = atof(findnextstring(temp, desc, &base)); |
405 mywidget->x = mywidget->wx = atoi(findnextstring(temp, desc, &base)); | |
406 mywidget->y = mywidget->wy = atoi(findnextstring(temp, desc, &base)); | |
407 mywidget->wwidth = atoi(findnextstring(temp, desc, &base)); | |
408 mywidget->wheight = atoi(findnextstring(temp, desc, &base)); | |
409 findnextstring(temp, desc, &base); | |
410 mywidget->msg = evNone; | |
411 for (i=0; i<evBoxs; i++) | |
412 { | |
413 if(!strcmp(temp, evNames[i].name)) | |
414 { | |
36891
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
415 // legacy |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
416 skin_legacy("evSetURL", temp); |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
417 |
23077 | 418 mywidget->msg = evNames[i].msg; |
419 break; | |
420 } | |
421 } | |
37053 | 422 if (*desc == 'r') |
423 { | |
424 mywidget->zeropoint = appRadian(mywidget, x0, y0); | |
425 mywidget->arclength = appRadian(mywidget, x1, y1) - mywidget->zeropoint; | |
426 | |
427 if (mywidget->arclength < 0.0) mywidget->arclength += 2 * M_PI; | |
428 // else check if radians of (x0,y0) and (x1,y1) only differ below threshold | |
429 else if (mywidget->arclength < 0.05) mywidget->arclength = 2 * M_PI; | |
430 } | |
431 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] %s %s %i %i %s %i ", | |
432 (mywidget->type == tyHpotmeter) ? "[HPOTMETER]" : (mywidget->type == tyVpotmeter) ? "[VPOTMETER]" : "[RPOTMETER]", | |
23077 | 433 (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL, |
434 mywidget->width, mywidget->height, | |
435 (mywidget->bitmap[1]) ? mywidget->bitmap[1]->name : NULL, | |
37053 | 436 mywidget->phases); |
437 if (*desc == 'r') | |
438 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "%i,%i %i,%i ", x0, y0, x1, y1); | |
439 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "%f %i %i %i %i msg %i\n", mywidget->value, | |
23077 | 440 mywidget->wx, mywidget->wy, mywidget->wwidth, mywidget->wwidth, |
441 mywidget->msg); | |
37049 | 442 if (mywidget->bitmap[0] == NULL || mywidget->width == 0 || mywidget->height == 0) |
443 { | |
444 mywidget->bitmap[0] = mywidget->bitmap[1]; | |
445 mywidget->width = mywidget->wwidth; | |
446 mywidget->height = mywidget->wheight; | |
447 } | |
37053 | 448 if (*desc == 'r') |
449 { | |
450 mywidget->maxwh = FFMAX(mywidget->width, mywidget->height); | |
451 | |
452 // clickedinsidewidget() checks with width/height, so set it | |
453 mywidget->width = mywidget->wwidth; | |
454 mywidget->height = mywidget->wheight; | |
455 } | |
23077 | 456 } |
36920 | 457 else if(!strncmp(desc, "pimage", 6)) |
23077 | 458 { |
459 int base = counttonextchar(desc, '=') + 1; | |
460 int i; | |
36920 | 461 /* pimage = phases, numphases, default, X, Y, width, height, message */ |
462 mywidget->type = tyPimage; | |
23077 | 463 mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base)); |
464 mywidget->phases = atoi(findnextstring(temp, desc, &base)); | |
465 mywidget->value = atof(findnextstring(temp, desc, &base)); | |
466 mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base)); | |
467 mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base)); | |
468 mywidget->wwidth = mywidget->width = atoi(findnextstring(temp, desc, &base)); | |
469 mywidget->wheight = mywidget->height = atoi(findnextstring(temp, desc, &base)); | |
470 findnextstring(temp, desc, &base); | |
471 mywidget->msg = evNone; | |
472 for (i=0; i<evBoxs; i++) | |
473 { | |
474 if(!strcmp(temp, evNames[i].name)) | |
475 { | |
36891
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
476 // legacy |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
477 skin_legacy("evSetURL", temp); |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
478 |
23077 | 479 mywidget->msg=evNames[i].msg; |
480 break; | |
481 } | |
482 } | |
36920 | 483 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [PIMAGE] %s %i %i %i %f %i %i msg %i\n", |
23077 | 484 (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL, |
485 mywidget->width, mywidget->height, | |
486 mywidget->phases, mywidget->value, | |
487 mywidget->x, mywidget->y, | |
488 mywidget->msg); | |
489 } | |
490 else if(!strncmp(desc, "menu", 4)) | |
491 { | |
492 int base = counttonextchar(desc, '=') + 1; | |
493 int i; | |
494 mywidget->type = tyMenu; | |
495 mywidget->wx=atoi(findnextstring(temp, desc, &base)); | |
496 mywidget->x=0; | |
497 mywidget->wy=mywidget->y=atoi(findnextstring(temp, desc, &base)); | |
498 mywidget->wwidth=mywidget->width=atoi(findnextstring(temp, desc, &base)); | |
499 mywidget->wheight=mywidget->height=atoi(findnextstring(temp, desc, &base)); | |
500 findnextstring(temp, desc, &base); | |
501 mywidget->msg = evNone; | |
502 for (i=0; i<evBoxs; i++) | |
503 { | |
504 if(!strcmp(temp, evNames[i].name)) | |
505 { | |
36891
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
506 // legacy |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
507 skin_legacy("evSetURL", temp); |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
508 |
23077 | 509 mywidget->msg = evNames[i].msg; |
510 break; | |
511 } | |
512 } | |
34450 | 513 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [MENU] %i %i %i %i msg %i\n", |
23077 | 514 mywidget->x, mywidget->y, mywidget->width, mywidget->height, mywidget->msg); |
515 } | |
516 else if(!strncmp(desc, "selected", 8)) | |
517 { | |
36840 | 518 win->base->bitmap[1] = pngRead(skin, desc + 9); |
34450 | 519 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [BASE] added image %s\n", win->base->bitmap[1]->name); |
23077 | 520 } |
521 else if(!strncmp(desc, "slabel",6)) | |
522 { | |
523 int base = counttonextchar(desc, '=') + 1; | |
524 unsigned int i; | |
525 mywidget->type = tySlabel; | |
526 mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base)); | |
527 mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base)); | |
528 findnextstring(temp, desc, &base); | |
529 mywidget->font = NULL; | |
530 for (i=0; i<skin->fontcount; i++) | |
531 { | |
532 if(!strcmp(temp, skin->fonts[i]->name)) | |
533 { | |
534 mywidget->font = skin->fonts[i]; | |
535 break; | |
536 } | |
537 } | |
538 mywidget->label = strdup(findnextstring(temp, desc, &base)); | |
34450 | 539 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [SLABEL] %i %i %s %s\n", |
23077 | 540 mywidget->x, mywidget->y, mywidget->font->name, mywidget->label); |
541 } | |
542 else if(!strncmp(desc, "dlabel", 6)) | |
543 { | |
544 int base = counttonextchar(desc, '=') + 1; | |
545 unsigned int i; | |
546 mywidget->type = tyDlabel; | |
547 mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base)); | |
548 mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base)); | |
549 mywidget->length = atoi(findnextstring(temp, desc, &base)); | |
550 mywidget->align = atoi(findnextstring(temp, desc, &base)); | |
551 findnextstring(temp, desc, &base); | |
552 mywidget->font = NULL; | |
553 for (i=0; i<skin->fontcount; i++) | |
554 { | |
555 if(!strcmp(temp, skin->fonts[i]->name)) | |
556 { | |
557 mywidget->font=skin->fonts[i]; | |
558 break; | |
559 } | |
560 } | |
561 mywidget->label=strdup(findnextstring(temp, desc, &base)); | |
36891
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
562 |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
563 // legacy |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
564 skin_legacy("$l", mywidget->label); |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
565 |
34450 | 566 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [DLABEL] %i %i %i %i %s \"%s\"\n", |
23077 | 567 mywidget->x, mywidget->y, mywidget->length, mywidget->align, mywidget->font->name, mywidget->label); |
568 } | |
569 free(temp); | |
570 } | |
571 | |
572 static void loadfonts(skin_t* skin) | |
573 { | |
574 unsigned int x; | |
575 for (x=0; x<skin->fontcount; x++) | |
576 { | |
577 FILE *fp; | |
578 char *filename; | |
579 char *tmp = calloc(1, MAX_LINESIZE); | |
580 char *desc = calloc(1, MAX_LINESIZE); | |
581 filename = calloc(1, strlen(skin->skindir) + strlen(skin->fonts[x]->name) + 6); | |
34092
dbf5042ab255
Don't use the Windows style path separator character in Win32 GUI.
ib
parents:
33784
diff
changeset
|
582 sprintf(filename, "%s/%s.fnt", skin->skindir, skin->fonts[x]->name); |
23077 | 583 if(!(fp = fopen(filename,"rb"))) |
584 { | |
585 mp_msg(MSGT_GPLAYER, MSGL_ERR, "[FONT LOAD] Font not found \"%s\"\n", skin->fonts[x]->name); | |
33783 | 586 free(tmp); |
587 free(desc); | |
588 free(filename); | |
23077 | 589 return; |
590 } | |
591 while(!feof(fp)) | |
592 { | |
593 int pos = 0; | |
594 unsigned int i; | |
595 fgets(tmp, MAX_LINESIZE, fp); | |
596 memset(desc, 0, MAX_LINESIZE); | |
597 for (i=0; i<strlen(tmp); i++) | |
598 { | |
599 /* remove spaces and linebreaks */ | |
600 if((tmp[i] == ' ') || (tmp[i] == '\n') || (tmp[i] == '\r')) continue; | |
601 /* remove comments */ | |
602 if((tmp[i] == ';') && ((i < 1) || (tmp[i-1] != '\"'))) | |
603 { | |
34450 | 604 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[FONT LOAD] Comment: %s", tmp + i + 1); |
23077 | 605 break; |
606 } | |
607 desc[pos] = tmp[i]; | |
608 pos++; | |
609 } | |
610 if(!strlen(desc)) continue; | |
611 /* now we have "readable" output -> parse it */ | |
612 if(!strncmp(desc, "image", 5)) | |
613 { | |
614 skin->fonts[x]->image = pngRead(skin, desc + 6); | |
34450 | 615 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[FONT] [IMAGE] \"%s\"\n", desc + 6); |
23077 | 616 } |
617 else | |
618 { | |
619 int base = 4; | |
620 if(*desc != '"') break; | |
621 if(*(desc + 1) == 0) break; | |
622 (skin->fonts[x]->charcount)++; | |
623 skin->fonts[x]->chars = realloc(skin->fonts[x]->chars, sizeof(char_t *) *skin->fonts[x]->charcount); | |
624 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]=calloc(1, sizeof(char_t)); | |
625 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->c = ((*(desc + 1) == '"') && (*(desc + 2) != '"')) ? ' ': *(desc + 1); | |
626 if((*(desc + 1) == '"') && (*(desc + 2) != '"')) base = 3; | |
627 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->x = atoi(findnextstring(tmp, desc, &base)); | |
628 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->y = atoi(findnextstring(tmp, desc, &base)); | |
629 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->width = atoi(findnextstring(tmp, desc, &base)); | |
630 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->height = atoi(findnextstring(tmp, desc, &base)); | |
34450 | 631 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[FONT] [CHAR] %c %i %i %i %i\n", |
23077 | 632 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->c, |
633 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->x, | |
634 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->y, | |
635 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->width, | |
636 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->height); | |
637 } | |
638 } | |
639 free(desc); | |
640 free(filename); | |
641 free(tmp); | |
642 fclose(fp); | |
643 } | |
644 } | |
645 | |
646 skin_t* loadskin(char* skindir, int desktopbpp) | |
647 { | |
648 FILE *fp; | |
35501 | 649 int reachedendofwindow = FALSE; |
23077 | 650 skin_t *skin = calloc(1, sizeof(skin_t)); |
651 char *filename; | |
652 char *tmp = calloc(1, MAX_LINESIZE); | |
653 char *desc = calloc(1, MAX_LINESIZE); | |
654 window* mywindow = NULL; | |
655 | |
36890 | 656 linenumber = 0; |
657 | |
23077 | 658 /* setup funcs */ |
659 skin->freeskin = freeskin; | |
660 skin->pngRead = pngRead; | |
661 skin->addwidget = addwidget; | |
662 skin->removewidget = removewidget; | |
663 skin->geteventname = geteventname; | |
664 skin->desktopbpp = desktopbpp; | |
665 skin->skindir = strdup(skindir); | |
666 | |
667 filename = calloc(1, strlen(skin->skindir) + strlen("skin") + 2); | |
34092
dbf5042ab255
Don't use the Windows style path separator character in Win32 GUI.
ib
parents:
33784
diff
changeset
|
668 sprintf(filename, "%s/skin", skin->skindir); |
23077 | 669 if(!(fp = fopen(filename, "rb"))) |
670 { | |
671 mp_msg(MSGT_GPLAYER, MSGL_FATAL, "[SKIN LOAD] Skin \"%s\" not found\n", skindir); | |
672 skin->freeskin(skin); | |
33783 | 673 free(tmp); |
674 free(desc); | |
675 free(filename); | |
23077 | 676 return NULL; |
677 } | |
678 | |
679 while(!feof(fp)) | |
680 { | |
681 int pos = 0; | |
682 unsigned int i; | |
35501 | 683 int insidequote = FALSE; |
23077 | 684 fgets(tmp, MAX_LINESIZE, fp); |
685 linenumber++; | |
686 memset(desc, 0, MAX_LINESIZE); | |
687 for (i=0; i<strlen(tmp); i++) | |
688 { | |
35501 | 689 if((tmp[i] == '"') && !insidequote) { insidequote=TRUE; continue; } |
690 else if((tmp[i] == '"') && insidequote) { insidequote=FALSE ; continue; } | |
23077 | 691 /* remove spaces and linebreaks */ |
692 if((!insidequote && (tmp[i] == ' ')) || (tmp[i] == '\n') || (tmp[i] == '\r')) continue; | |
693 /* remove comments */ | |
694 else if(tmp[i] == ';') | |
695 { | |
34450 | 696 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN LOAD] Comment: %s", tmp + i + 1); |
23077 | 697 break; |
698 } | |
699 desc[pos] = tmp[i]; | |
700 pos++; | |
701 } | |
702 | |
703 if(!strlen(desc)) continue; | |
704 /* now we have "readable" output -> parse it */ | |
705 /* parse window specific info */ | |
706 if(!strncmp(desc, "section", 7)) | |
707 { | |
34450 | 708 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [SECTION] \"%s\"\n", desc + 8); |
23077 | 709 } |
710 else if(!strncmp(desc, "window", 6)) | |
711 { | |
34450 | 712 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [WINDOW] \"%s\"\n", desc + 7); |
35501 | 713 reachedendofwindow = FALSE; |
23077 | 714 (skin->windowcount)++; |
715 skin->windows = realloc(skin->windows, sizeof(window *) * skin->windowcount); | |
716 mywindow = skin->windows[(skin->windowcount) - 1] = calloc(1, sizeof(window)); | |
717 mywindow->name = strdup(desc + 7); | |
718 if(!strncmp(desc + 7, "main", 4)) mywindow->type = wiMain; | |
36885 | 719 else if(!strncmp(desc+7, "video", 5) || /* legacy */ !strncmp(desc+7, "sub", 3)) |
23077 | 720 { |
34697 | 721 mywindow->type = wiVideo; |
35501 | 722 mywindow->decoration = TRUE; |
36891
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
723 // legacy |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
724 if (desc[7] == 's') skin_legacy("sub", "video"); |
23077 | 725 } |
726 else if(!strncmp(desc + 7, "menu", 4)) mywindow->type = wiMenu; | |
727 else if(!strncmp(desc + 7, "playbar", 7)) mywindow->type = wiPlaybar; | |
728 else mp_msg(MSGT_GPLAYER, MSGL_V, "[SKIN] warning found unknown windowtype"); | |
729 } | |
730 else if(!strncmp(desc, "decoration", 10) && !strncmp(desc + 11, "enable", 6)) | |
731 { | |
35501 | 732 mywindow->decoration = TRUE; |
34450 | 733 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [DECORATION] enabled decoration for window \"%s\"\n", mywindow->name); |
23077 | 734 } |
735 else if(!strncmp(desc, "background", 10)) | |
736 { | |
737 int base = counttonextchar(desc, '=') + 1; | |
738 char temp[MAX_LINESIZE]; | |
739 mywindow->backgroundcolor[0] = atoi(findnextstring(temp, desc, &base)); | |
740 mywindow->backgroundcolor[1] = atoi(findnextstring(temp, desc, &base)); | |
741 mywindow->backgroundcolor[2] = atoi(findnextstring(temp, desc, &base)); | |
34450 | 742 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [BACKGROUND] window \"%s\" has backgroundcolor (%i,%i,%i)\n", mywindow->name, |
23077 | 743 mywindow->backgroundcolor[0], |
744 mywindow->backgroundcolor[1], | |
745 mywindow->backgroundcolor[2]); | |
746 } | |
747 else if(!strncmp(desc, "end", 3)) | |
748 { | |
749 if(reachedendofwindow) | |
750 { | |
34450 | 751 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [END] of section\n"); |
23077 | 752 } |
753 else | |
754 { | |
35501 | 755 reachedendofwindow = TRUE; |
34450 | 756 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [END] of window \"%s\"\n", mywindow->name); |
23077 | 757 } |
758 } | |
759 else if(!strncmp(desc, "font", 4)) | |
760 { | |
761 int id = 0; | |
762 char temp[MAX_LINESIZE]; | |
36888 | 763 int base = counttonextchar(desc, '=') + 1; |
764 findnextstring(temp, desc, &base); | |
765 id = skin->fontcount; | |
766 (skin->fontcount)++; | |
767 skin->fonts = realloc(skin->fonts, sizeof(font_t *) * skin->fontcount); | |
768 skin->fonts[id]=calloc(1, sizeof(font_t)); | |
769 skin->fonts[id]->name = strdup(temp); | |
36891
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
770 |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
771 // legacy |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
772 skin_legacy("fontid", desc); |
c5ee0fc2ec75
Print an information on deprecated skin config file entries.
ib
parents:
36890
diff
changeset
|
773 |
36887 | 774 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [FONT] name \"%s\"\n", skin->fonts[id]->name); |
23077 | 775 } |
776 else | |
777 skin->addwidget(skin, mywindow, desc); | |
778 } | |
779 | |
780 free(desc); | |
781 free(filename); | |
782 free(tmp); | |
783 fclose(fp); | |
784 loadfonts(skin); | |
785 mp_msg(MSGT_GPLAYER, MSGL_V, "[SKIN LOAD] loaded skin \"%s\"\n", skin->skindir); | |
34450 | 786 dumpwidgets(skin); |
23077 | 787 return skin; |
788 } |