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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1 /*
23079
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
2 * MPlayer GUI for Win32
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
3 * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de>
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
4 * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com>
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
5 * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
6 *
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
7 * This file is part of MPlayer.
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
8 *
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
9 * MPlayer is free software; you can redistribute it and/or modify
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
10 * it under the terms of the GNU General Public License as published by
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
12 * (at your option) any later version.
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
13 *
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
14 * MPlayer is distributed in the hope that it will be useful,
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
17 * GNU General Public License for more details.
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
18 *
26457
9ba6d4487292 Use standard GPL header.
diego
parents: 26372
diff changeset
19 * You should have received a copy of the GNU General Public License along
9ba6d4487292 Use standard GPL header.
diego
parents: 26372
diff changeset
20 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
9ba6d4487292 Use standard GPL header.
diego
parents: 26372
diff changeset
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23079
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
22 */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
23
33761
16286ee1fc71 Fix Win32 GUI compilation problems.
ib
parents: 33621
diff changeset
24 #include <string.h>
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
25 #include <stdlib.h>
23796
298fedea557d fopen is in stdio.h, so add this include.
reimar
parents: 23266
diff changeset
26 #include <stdio.h>
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
27 #include <inttypes.h>
37053
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
28 #include <math.h>
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
29 #include <windows.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
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
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
35 #include "libavutil/attributes.h"
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
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
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
38 #include "gui.h"
33770
6134493605c6 Use macro nfree() in Win32 GUI code.
ib
parents: 33761
diff changeset
39 #include "gui/util/mem.h"
33046
9684ad0e1291 Move files with auxiliary functions to own directory.
ib
parents: 32833
diff changeset
40 #include "gui/util/bitmap.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
41
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
42 #define MAX_LINESIZE 256
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
43
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
44 typedef struct
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
45 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
46 int msg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
47 char *name;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
48 } evName;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
49
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
50 static const evName evNames[] =
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
51 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
52 { evNone, "evNone" },
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
53 { evPlay, "evPlay" },
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
54 { evStop, "evStop" },
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
55 { evPause, "evPause" },
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
56 { evPrev, "evPrev" },
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
57 { evNext, "evNext" },
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
58 { evLoad, "evLoad" },
34317
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
59 { evLoadPlay, "evLoadPlay" },
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
60 { evLoadAudioFile, "evLoadAudioFile" },
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
61 { evLoadSubtitle, "evLoadSubtitle" },
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
62 { evDropSubtitle, "evDropSubtitle" },
34321
daebf766dea6 Cosmetic: Synchronize evPlaylist event and message names.
ib
parents: 34320
diff changeset
63 { evPlaylist, "evPlaylist" },
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34326
diff changeset
64 { evPlayCD, "evPlayCD" },
34317
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
65 { evPlayVCD, "evPlayVCD" },
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
66 { evPlayDVD, "evPlayDVD" },
34324
58aaa0d8cc82 Replace evSetURL by evLoadURL for consistency.
ib
parents: 34322
diff changeset
67 { evLoadURL, "evSetURL" }, // legacy
58aaa0d8cc82 Replace evSetURL by evLoadURL for consistency.
ib
parents: 34322
diff changeset
68 { evLoadURL, "evLoadURL" },
36429
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 35707
diff changeset
69 { evPlayTV, "evPlayTV" },
34317
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
70 { evPlaySwitchToPause, "evPlaySwitchToPause" },
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
71 { evPauseSwitchToPlay, "evPauseSwitchToPlay" },
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
72 { evBackward10sec, "evBackward10sec" },
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
73 { evForward10sec, "evForward10sec" },
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
74 { evBackward1min, "evBackward1min" },
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
75 { evForward1min, "evForward1min" },
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
76 { evBackward10min, "evBackward10min" },
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
77 { evForward10min, "evForward10min" },
34317
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
78 { evSetMoviePosition, "evSetMoviePosition" },
34320
e3e77ce76c13 Add evHalfSize event to the Win32 GUI.
ib
parents: 34317
diff changeset
79 { evHalfSize, "evHalfSize" },
34317
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
80 { evDoubleSize, "evDoubleSize" },
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
81 { evFullScreen, "evFullScreen" },
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
82 { evNormalSize, "evNormalSize" },
34322
6075b19ad3ad Cosmetic: Add evSetAspect event to video events.
ib
parents: 34321
diff changeset
83 { evSetAspect, "evSetAspect" },
37081
e8559b9913ff New GUI feature: Rotate a video.
ib
parents: 37065
diff changeset
84 { evSetRotation, "evSetRotation" },
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
85 { evIncVolume, "evIncVolume" },
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
86 { evDecVolume, "evDecVolume" },
34317
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
87 { evSetVolume, "evSetVolume" },
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
88 { evMute, "evMute" },
34317
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
89 { evSetBalance, "evSetBalance" },
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
90 { evEqualizer, "evEqualizer" },
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
91 { evAbout, "evAbout" },
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
92 { evPreferences, "evPreferences" },
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
93 { evSkinBrowser, "evSkinBrowser" },
34458
1e84148527ab Add user event evMenu.
ib
parents: 34450
diff changeset
94 { evMenu, "evMenu" },
34317
e905a896243d Cosmetic: Rearrange and group GUI user events.
ib
parents: 34315
diff changeset
95 { evIconify, "evIconify" },
34326
d188b59d3fa4 Remove non-existing GUI user events.
ib
parents: 34324
diff changeset
96 { evExit, "evExit" }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
97 };
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
98
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
99 static const int evBoxs = sizeof(evNames) / sizeof(evName);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
100
36890
8f38fea0b91b Make linenumber global.
ib
parents: 36889
diff changeset
101 static int linenumber;
8f38fea0b91b Make linenumber global.
ib
parents: 36889
diff changeset
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
b28b632efeef Cosmetic: Revise a few comments.
ib
parents: 37053
diff changeset
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
f50427ad9ff6 Internally map item 'potmeter' onto 'hpotmeter'.
ib
parents: 36891
diff changeset
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
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
131 static char *geteventname(int event)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
132 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
133 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
134 for(i=0; i<evBoxs; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
135 if(evNames[i].msg == event)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
136 return evNames[i].name;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
137 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
138 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
139
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
140 /* reads a complete image as is into image buffer */
33784
72adb79f5a16 Change fname parameter to const in pngRead().
ib
parents: 33783
diff changeset
141 static image *pngRead(skin_t *skin, const char *fname)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
142 {
34996
ebcc17a3c165 Fix compiler warnings (comparison between signed and unsigned).
ib
parents: 34697
diff changeset
143 unsigned int i;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33047
diff changeset
144 guiImage bmp;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
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
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
147 FILE *fp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
148
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
149 if(!stricmp(fname, "NULL")) return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
150
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
151 /* find filename in order file file.png */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
152 if(!(fp = fopen(fname, "rb")))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
153 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
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
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
156 if(!(fp = fopen(filename, "rb")))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
157 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
158 mp_msg(MSGT_GPLAYER, MSGL_ERR, "[png] cannot find image %s\n", filename);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
159 free(filename);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
160 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
161 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
162 }
23266
6cd7f1c23d90 Reuse linux code for reading png images for windows Gui,
reimar
parents: 23091
diff changeset
163 fclose(fp);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
164
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
165 for (i=0; i < skin->imagecount; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
166 if(!strcmp(fname, skin->images[i]->name))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
167 {
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
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
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
170 return skin->images[i];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
171 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
172 (skin->imagecount)++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
173 skin->images = realloc(skin->images, sizeof(image *) * skin->imagecount);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
174 bf = skin->images[(skin->imagecount) - 1] = calloc(1, sizeof(image));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
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
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
179
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
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
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
202 return bf;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
203 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
204
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
205 /* frees all skin images */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
206 static void freeimages(skin_t *skin)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
207 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
208 unsigned int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
209 for (i=0; i<skin->imagecount; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
210 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
211 if(skin->images && skin->images[i])
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
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
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
215 free(skin->images[i]);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
216 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
217 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
218 free(skin->images);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
219 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
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
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
222 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
223 unsigned int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
224 for (i=0; i<skin->widgetcount; i++)
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
225 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "widget %p id %i\n", skin->widgets[i], skin->widgets[i]->id);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
226 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
227
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
228 static int counttonextchar(const char *s1, char c)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
229 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
230 unsigned int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
231 for (i=0; i<strlen(s1); i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
232 if(s1[i] == c) return i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
233 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
234 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
235
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
236 static char *findnextstring(char *temp, const char *desc, int *base)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
237 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
238 int len = counttonextchar(*base + desc, ',');
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
239 memset(temp, 0, strlen(desc) + 1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
240 if(!len) len = strlen(desc);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
241 memcpy(temp, *base + desc, len);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
242 *base += (len+1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
243 return temp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
244 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
245
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
246 static void freeskin(skin_t *skin)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
247 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
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
6134493605c6 Use macro nfree() in Win32 GUI code.
ib
parents: 33761
diff changeset
250 nfree(skin->skindir);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
251
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
252 for (i=1; i<=skin->lastusedid; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
253 skin->removewidget(skin, i);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
254
33770
6134493605c6 Use macro nfree() in Win32 GUI code.
ib
parents: 33761
diff changeset
255 nfree(skin->widgets);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
256
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
257 freeimages(skin);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
258 for(i=0; i<skin->windowcount; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
259 {
33770
6134493605c6 Use macro nfree() in Win32 GUI code.
ib
parents: 33761
diff changeset
260 nfree(skin->windows[i]->name);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
261 free(skin->windows[i]);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
262 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
263
33770
6134493605c6 Use macro nfree() in Win32 GUI code.
ib
parents: 33761
diff changeset
264 nfree(skin->windows);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
265
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
266 for (i=0; i<skin->fontcount; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
267 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
268 unsigned int x;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
269
33770
6134493605c6 Use macro nfree() in Win32 GUI code.
ib
parents: 33761
diff changeset
270 nfree(skin->fonts[i]->name);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
271
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
272 for (x=0; x<skin->fonts[i]->charcount; x++)
33770
6134493605c6 Use macro nfree() in Win32 GUI code.
ib
parents: 33761
diff changeset
273 nfree(skin->fonts[i]->chars[x]);
6134493605c6 Use macro nfree() in Win32 GUI code.
ib
parents: 33761
diff changeset
274
6134493605c6 Use macro nfree() in Win32 GUI code.
ib
parents: 33761
diff changeset
275 nfree(skin->fonts[i]->chars);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
276
33770
6134493605c6 Use macro nfree() in Win32 GUI code.
ib
parents: 33761
diff changeset
277 nfree(skin->fonts[i]);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
278 }
33770
6134493605c6 Use macro nfree() in Win32 GUI code.
ib
parents: 33761
diff changeset
279 nfree(skin->fonts);
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
280 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN FREE] skin freed\n");
33770
6134493605c6 Use macro nfree() in Win32 GUI code.
ib
parents: 33761
diff changeset
281 nfree(skin);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
282 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
283
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
284 static void removewidget(skin_t *skin, int id)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
285 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
286 unsigned int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
287 unsigned int pos=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
288 widget **temp = calloc(skin->widgetcount - 1, sizeof(widget *));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
289
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
290 for (i=0; i<skin->widgetcount; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
291 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
292 if(skin->widgets[i]->id == id)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
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
6134493605c6 Use macro nfree() in Win32 GUI code.
ib
parents: 33761
diff changeset
295 nfree(skin->widgets[i]);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
296 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
297 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
298 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
299 temp[pos] = skin->widgets[i];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
300 pos++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
301 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
302 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
303 if (pos != i)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
304 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
305 (skin->widgetcount)--;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
306 free(skin->widgets);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
307 skin->widgets = temp;
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
308 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "removed widget %i\n", id);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
309 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
310 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
311 free(temp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
312 mp_msg(MSGT_GPLAYER, MSGL_ERR, "widget %i not found\n", id);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
313 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
314
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
315 static void addwidget(skin_t *skin, window *win, const char *desc)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
316 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
317 widget *mywidget;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
318 char *temp = calloc(1, strlen(desc) + 1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
319 (skin->widgetcount)++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
320 (skin->lastusedid)++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
321 skin->widgets = realloc(skin->widgets, sizeof(widget *) * skin->widgetcount);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
322 mywidget = skin->widgets[(skin->widgetcount) - 1] = calloc(1, sizeof(widget));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
323 mywidget->id = skin->lastusedid;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
324 mywidget->window = win->type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
325 /* parse and fill widget specific info */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
326 if(!strncmp(desc, "base", 4))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
327 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
328 int base = counttonextchar(desc, '=') + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
329 mywidget->type = tyBase;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
330 mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
331 mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
332 mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
333 mywidget->wwidth = mywidget->width = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
334 mywidget->wheight = mywidget->height = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
335 win->base = mywidget;
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
336 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [BASE] %s %i %i %i %i\n",
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
337 (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
338 mywidget->x, mywidget->y, mywidget->width, mywidget->height);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
339 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
340 else if(!strncmp(desc, "button", 6))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
341 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
342 int base = counttonextchar(desc, '=') + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
343 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
344 mywidget->type = tyButton;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
345 mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
346 mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
347 mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
348 mywidget->wwidth = mywidget->width = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
349 mywidget->wheight = mywidget->height = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
350 findnextstring(temp, desc, &base);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
351
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
352 /* Assign corresponding event to the widget */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
353 mywidget->msg = evNone;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
354 for (i=0; i<evBoxs; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
355 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
356 if(!strcmp(temp, evNames[i].name))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
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
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
361 mywidget->msg = evNames[i].msg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
362 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
363 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
364 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
365
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
366 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [BUTTON] %s %i %i %i %i msg %i\n",
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
367 (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
368 mywidget->x, mywidget->y, mywidget->width, mywidget->height, mywidget->msg);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
369 }
37053
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
370 else if(!strncmp(desc, "hpotmeter", 9) || !strncmp(desc, "vpotmeter", 9) || !strncmp(desc, "rpotmeter", 9) || /* legacy */ !strncmp(desc, "potmeter", 8))
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
371 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
372 int base = counttonextchar(desc, '=') + 1;
37053
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
373 int i, av_uninit(x0), av_uninit(y0), av_uninit(x1), av_uninit(y1);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
374 /* hpotmeter = button, bwidth, bheight, phases, numphases, default, X, Y, width, height, message */
36892
f50427ad9ff6 Internally map item 'potmeter' onto 'hpotmeter'.
ib
parents: 36891
diff changeset
375 if(!strncmp(desc, "vpotmeter", 9)) mywidget->type = tyVpotmeter;
37053
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
376 else if(!strncmp(desc, "rpotmeter", 9)) mywidget->type = tyRpotmeter;
36892
f50427ad9ff6 Internally map item 'potmeter' onto 'hpotmeter'.
ib
parents: 36891
diff changeset
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
f50427ad9ff6 Internally map item 'potmeter' onto 'hpotmeter'.
ib
parents: 36891
diff changeset
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
87e6a09a07a7 Cosmetic: Adjust indent.
ib
parents: 36892
diff changeset
390 mywidget->width = atoi(findnextstring(temp, desc, &base));
87e6a09a07a7 Cosmetic: Adjust indent.
ib
parents: 36892
diff changeset
391 mywidget->height = atoi(findnextstring(temp, desc, &base));
36892
f50427ad9ff6 Internally map item 'potmeter' onto 'hpotmeter'.
ib
parents: 36891
diff changeset
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
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
394 mywidget->phases = atoi(findnextstring(temp, desc, &base));
37053
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
395
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
396 if (*desc == 'r')
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
397 {
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
398 x0 = atoi(findnextstring(temp, desc, &base));
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
399 y0 = atoi(findnextstring(temp, desc, &base));
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
400 x1 = atoi(findnextstring(temp, desc, &base));
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
401 y1 = atoi(findnextstring(temp, desc, &base));
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
402 }
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
403
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
404 mywidget->value = atof(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
405 mywidget->x = mywidget->wx = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
406 mywidget->y = mywidget->wy = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
407 mywidget->wwidth = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
408 mywidget->wheight = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
409 findnextstring(temp, desc, &base);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
410 mywidget->msg = evNone;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
411 for (i=0; i<evBoxs; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
412 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
413 if(!strcmp(temp, evNames[i].name))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
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
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
418 mywidget->msg = evNames[i].msg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
419 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
420 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
421 }
37053
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
422 if (*desc == 'r')
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
423 {
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
424 mywidget->zeropoint = appRadian(mywidget, x0, y0);
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
425 mywidget->arclength = appRadian(mywidget, x1, y1) - mywidget->zeropoint;
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
426
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
427 if (mywidget->arclength < 0.0) mywidget->arclength += 2 * M_PI;
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
428 // else check if radians of (x0,y0) and (x1,y1) only differ below threshold
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
429 else if (mywidget->arclength < 0.05) mywidget->arclength = 2 * M_PI;
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
430 }
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
431 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] %s %s %i %i %s %i ",
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
432 (mywidget->type == tyHpotmeter) ? "[HPOTMETER]" : (mywidget->type == tyVpotmeter) ? "[VPOTMETER]" : "[RPOTMETER]",
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
433 (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
434 mywidget->width, mywidget->height,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
435 (mywidget->bitmap[1]) ? mywidget->bitmap[1]->name : NULL,
37053
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
436 mywidget->phases);
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
437 if (*desc == 'r')
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
438 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "%i,%i %i,%i ", x0, y0, x1, y1);
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
439 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "%f %i %i %i %i msg %i\n", mywidget->value,
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
440 mywidget->wx, mywidget->wy, mywidget->wwidth, mywidget->wwidth,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
441 mywidget->msg);
37049
e2c10942873b Relocate code added in r36991.
ib
parents: 36920
diff changeset
442 if (mywidget->bitmap[0] == NULL || mywidget->width == 0 || mywidget->height == 0)
e2c10942873b Relocate code added in r36991.
ib
parents: 36920
diff changeset
443 {
e2c10942873b Relocate code added in r36991.
ib
parents: 36920
diff changeset
444 mywidget->bitmap[0] = mywidget->bitmap[1];
e2c10942873b Relocate code added in r36991.
ib
parents: 36920
diff changeset
445 mywidget->width = mywidget->wwidth;
e2c10942873b Relocate code added in r36991.
ib
parents: 36920
diff changeset
446 mywidget->height = mywidget->wheight;
e2c10942873b Relocate code added in r36991.
ib
parents: 36920
diff changeset
447 }
37053
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
448 if (*desc == 'r')
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
449 {
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
450 mywidget->maxwh = FFMAX(mywidget->width, mywidget->height);
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
451
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
452 // clickedinsidewidget() checks with width/height, so set it
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
453 mywidget->width = mywidget->wwidth;
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
454 mywidget->height = mywidget->wheight;
84c93a60ead3 Add new item 'rpotmeter'.
ib
parents: 37049
diff changeset
455 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
456 }
36920
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36896
diff changeset
457 else if(!strncmp(desc, "pimage", 6))
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
458 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
459 int base = counttonextchar(desc, '=') + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
460 int i;
36920
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36896
diff changeset
461 /* pimage = phases, numphases, default, X, Y, width, height, message */
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36896
diff changeset
462 mywidget->type = tyPimage;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
463 mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
464 mywidget->phases = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
465 mywidget->value = atof(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
466 mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
467 mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
468 mywidget->wwidth = mywidget->width = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
469 mywidget->wheight = mywidget->height = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
470 findnextstring(temp, desc, &base);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
471 mywidget->msg = evNone;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
472 for (i=0; i<evBoxs; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
473 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
474 if(!strcmp(temp, evNames[i].name))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
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
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
479 mywidget->msg=evNames[i].msg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
480 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
481 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
482 }
36920
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36896
diff changeset
483 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [PIMAGE] %s %i %i %i %f %i %i msg %i\n",
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
484 (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
485 mywidget->width, mywidget->height,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
486 mywidget->phases, mywidget->value,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
487 mywidget->x, mywidget->y,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
488 mywidget->msg);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
489 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
490 else if(!strncmp(desc, "menu", 4))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
491 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
492 int base = counttonextchar(desc, '=') + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
493 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
494 mywidget->type = tyMenu;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
495 mywidget->wx=atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
496 mywidget->x=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
497 mywidget->wy=mywidget->y=atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
498 mywidget->wwidth=mywidget->width=atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
499 mywidget->wheight=mywidget->height=atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
500 findnextstring(temp, desc, &base);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
501 mywidget->msg = evNone;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
502 for (i=0; i<evBoxs; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
503 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
504 if(!strcmp(temp, evNames[i].name))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
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
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
509 mywidget->msg = evNames[i].msg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
510 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
511 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
512 }
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
513 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [MENU] %i %i %i %i msg %i\n",
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
514 mywidget->x, mywidget->y, mywidget->width, mywidget->height, mywidget->msg);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
515 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
516 else if(!strncmp(desc, "selected", 8))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
517 {
36840
511047e8e0a2 Remove unnecessary casts.
ib
parents: 36429
diff changeset
518 win->base->bitmap[1] = pngRead(skin, desc + 9);
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
519 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [BASE] added image %s\n", win->base->bitmap[1]->name);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
520 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
521 else if(!strncmp(desc, "slabel",6))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
522 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
523 int base = counttonextchar(desc, '=') + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
524 unsigned int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
525 mywidget->type = tySlabel;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
526 mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
527 mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
528 findnextstring(temp, desc, &base);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
529 mywidget->font = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
530 for (i=0; i<skin->fontcount; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
531 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
532 if(!strcmp(temp, skin->fonts[i]->name))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
533 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
534 mywidget->font = skin->fonts[i];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
535 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
536 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
537 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
538 mywidget->label = strdup(findnextstring(temp, desc, &base));
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
539 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [SLABEL] %i %i %s %s\n",
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
540 mywidget->x, mywidget->y, mywidget->font->name, mywidget->label);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
541 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
542 else if(!strncmp(desc, "dlabel", 6))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
543 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
544 int base = counttonextchar(desc, '=') + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
545 unsigned int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
546 mywidget->type = tyDlabel;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
547 mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
548 mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
549 mywidget->length = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
550 mywidget->align = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
551 findnextstring(temp, desc, &base);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
552 mywidget->font = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
553 for (i=0; i<skin->fontcount; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
554 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
555 if(!strcmp(temp, skin->fonts[i]->name))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
556 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
557 mywidget->font=skin->fonts[i];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
558 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
559 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
560 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
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
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
566 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [DLABEL] %i %i %i %i %s \"%s\"\n",
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
567 mywidget->x, mywidget->y, mywidget->length, mywidget->align, mywidget->font->name, mywidget->label);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
568 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
569 free(temp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
570 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
571
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
572 static void loadfonts(skin_t* skin)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
573 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
574 unsigned int x;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
575 for (x=0; x<skin->fontcount; x++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
576 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
577 FILE *fp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
578 char *filename;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
579 char *tmp = calloc(1, MAX_LINESIZE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
580 char *desc = calloc(1, MAX_LINESIZE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
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
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
583 if(!(fp = fopen(filename,"rb")))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
584 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
585 mp_msg(MSGT_GPLAYER, MSGL_ERR, "[FONT LOAD] Font not found \"%s\"\n", skin->fonts[x]->name);
33783
a450fade6a83 Fix memory leaks in the Win32 GUI.
ib
parents: 33770
diff changeset
586 free(tmp);
a450fade6a83 Fix memory leaks in the Win32 GUI.
ib
parents: 33770
diff changeset
587 free(desc);
a450fade6a83 Fix memory leaks in the Win32 GUI.
ib
parents: 33770
diff changeset
588 free(filename);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
589 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
590 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
591 while(!feof(fp))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
592 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
593 int pos = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
594 unsigned int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
595 fgets(tmp, MAX_LINESIZE, fp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
596 memset(desc, 0, MAX_LINESIZE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
597 for (i=0; i<strlen(tmp); i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
598 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
599 /* remove spaces and linebreaks */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
600 if((tmp[i] == ' ') || (tmp[i] == '\n') || (tmp[i] == '\r')) continue;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
601 /* remove comments */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
602 if((tmp[i] == ';') && ((i < 1) || (tmp[i-1] != '\"')))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
603 {
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
604 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[FONT LOAD] Comment: %s", tmp + i + 1);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
605 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
606 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
607 desc[pos] = tmp[i];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
608 pos++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
609 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
610 if(!strlen(desc)) continue;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
611 /* now we have "readable" output -> parse it */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
612 if(!strncmp(desc, "image", 5))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
613 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
614 skin->fonts[x]->image = pngRead(skin, desc + 6);
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
615 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[FONT] [IMAGE] \"%s\"\n", desc + 6);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
616 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
617 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
618 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
619 int base = 4;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
620 if(*desc != '"') break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
621 if(*(desc + 1) == 0) break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
622 (skin->fonts[x]->charcount)++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
623 skin->fonts[x]->chars = realloc(skin->fonts[x]->chars, sizeof(char_t *) *skin->fonts[x]->charcount);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
624 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]=calloc(1, sizeof(char_t));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
625 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->c = ((*(desc + 1) == '"') && (*(desc + 2) != '"')) ? ' ': *(desc + 1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
626 if((*(desc + 1) == '"') && (*(desc + 2) != '"')) base = 3;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
627 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->x = atoi(findnextstring(tmp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
628 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->y = atoi(findnextstring(tmp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
629 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->width = atoi(findnextstring(tmp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
630 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->height = atoi(findnextstring(tmp, desc, &base));
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
631 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[FONT] [CHAR] %c %i %i %i %i\n",
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
632 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->c,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
633 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->x,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
634 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->y,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
635 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->width,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
636 skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->height);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
637 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
638 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
639 free(desc);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
640 free(filename);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
641 free(tmp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
642 fclose(fp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
643 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
644 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
645
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
646 skin_t* loadskin(char* skindir, int desktopbpp)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
647 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
648 FILE *fp;
35501
7bb176fac55c Use boolean symbolic constants in Win32 GUI.
ib
parents: 34998
diff changeset
649 int reachedendofwindow = FALSE;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
650 skin_t *skin = calloc(1, sizeof(skin_t));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
651 char *filename;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
652 char *tmp = calloc(1, MAX_LINESIZE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
653 char *desc = calloc(1, MAX_LINESIZE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
654 window* mywindow = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
655
36890
8f38fea0b91b Make linenumber global.
ib
parents: 36889
diff changeset
656 linenumber = 0;
8f38fea0b91b Make linenumber global.
ib
parents: 36889
diff changeset
657
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
658 /* setup funcs */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
659 skin->freeskin = freeskin;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
660 skin->pngRead = pngRead;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
661 skin->addwidget = addwidget;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
662 skin->removewidget = removewidget;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
663 skin->geteventname = geteventname;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
664 skin->desktopbpp = desktopbpp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
665 skin->skindir = strdup(skindir);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
666
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
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
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
669 if(!(fp = fopen(filename, "rb")))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
670 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
671 mp_msg(MSGT_GPLAYER, MSGL_FATAL, "[SKIN LOAD] Skin \"%s\" not found\n", skindir);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
672 skin->freeskin(skin);
33783
a450fade6a83 Fix memory leaks in the Win32 GUI.
ib
parents: 33770
diff changeset
673 free(tmp);
a450fade6a83 Fix memory leaks in the Win32 GUI.
ib
parents: 33770
diff changeset
674 free(desc);
a450fade6a83 Fix memory leaks in the Win32 GUI.
ib
parents: 33770
diff changeset
675 free(filename);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
676 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
677 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
678
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
679 while(!feof(fp))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
680 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
681 int pos = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
682 unsigned int i;
35501
7bb176fac55c Use boolean symbolic constants in Win32 GUI.
ib
parents: 34998
diff changeset
683 int insidequote = FALSE;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
684 fgets(tmp, MAX_LINESIZE, fp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
685 linenumber++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
686 memset(desc, 0, MAX_LINESIZE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
687 for (i=0; i<strlen(tmp); i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
688 {
35501
7bb176fac55c Use boolean symbolic constants in Win32 GUI.
ib
parents: 34998
diff changeset
689 if((tmp[i] == '"') && !insidequote) { insidequote=TRUE; continue; }
7bb176fac55c Use boolean symbolic constants in Win32 GUI.
ib
parents: 34998
diff changeset
690 else if((tmp[i] == '"') && insidequote) { insidequote=FALSE ; continue; }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
691 /* remove spaces and linebreaks */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
692 if((!insidequote && (tmp[i] == ' ')) || (tmp[i] == '\n') || (tmp[i] == '\r')) continue;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
693 /* remove comments */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
694 else if(tmp[i] == ';')
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
695 {
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
696 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN LOAD] Comment: %s", tmp + i + 1);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
697 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
698 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
699 desc[pos] = tmp[i];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
700 pos++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
701 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
702
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
703 if(!strlen(desc)) continue;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
704 /* now we have "readable" output -> parse it */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
705 /* parse window specific info */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
706 if(!strncmp(desc, "section", 7))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
707 {
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
708 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [SECTION] \"%s\"\n", desc + 8);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
709 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
710 else if(!strncmp(desc, "window", 6))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
711 {
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
712 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [WINDOW] \"%s\"\n", desc + 7);
35501
7bb176fac55c Use boolean symbolic constants in Win32 GUI.
ib
parents: 34998
diff changeset
713 reachedendofwindow = FALSE;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
714 (skin->windowcount)++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
715 skin->windows = realloc(skin->windows, sizeof(window *) * skin->windowcount);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
716 mywindow = skin->windows[(skin->windowcount) - 1] = calloc(1, sizeof(window));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
717 mywindow->name = strdup(desc + 7);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
718 if(!strncmp(desc + 7, "main", 4)) mywindow->type = wiMain;
36885
1f4661a5495e Cosmetic: Relocate comment.
ib
parents: 36840
diff changeset
719 else if(!strncmp(desc+7, "video", 5) || /* legacy */ !strncmp(desc+7, "sub", 3))
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
720 {
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34458
diff changeset
721 mywindow->type = wiVideo;
35501
7bb176fac55c Use boolean symbolic constants in Win32 GUI.
ib
parents: 34998
diff changeset
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
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
725 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
726 else if(!strncmp(desc + 7, "menu", 4)) mywindow->type = wiMenu;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
727 else if(!strncmp(desc + 7, "playbar", 7)) mywindow->type = wiPlaybar;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
728 else mp_msg(MSGT_GPLAYER, MSGL_V, "[SKIN] warning found unknown windowtype");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
729 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
730 else if(!strncmp(desc, "decoration", 10) && !strncmp(desc + 11, "enable", 6))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
731 {
35501
7bb176fac55c Use boolean symbolic constants in Win32 GUI.
ib
parents: 34998
diff changeset
732 mywindow->decoration = TRUE;
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
733 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [DECORATION] enabled decoration for window \"%s\"\n", mywindow->name);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
734 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
735 else if(!strncmp(desc, "background", 10))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
736 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
737 int base = counttonextchar(desc, '=') + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
738 char temp[MAX_LINESIZE];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
739 mywindow->backgroundcolor[0] = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
740 mywindow->backgroundcolor[1] = atoi(findnextstring(temp, desc, &base));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
741 mywindow->backgroundcolor[2] = atoi(findnextstring(temp, desc, &base));
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
742 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [BACKGROUND] window \"%s\" has backgroundcolor (%i,%i,%i)\n", mywindow->name,
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
743 mywindow->backgroundcolor[0],
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
744 mywindow->backgroundcolor[1],
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
745 mywindow->backgroundcolor[2]);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
746 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
747 else if(!strncmp(desc, "end", 3))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
748 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
749 if(reachedendofwindow)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
750 {
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
751 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [END] of section\n");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
752 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
753 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
754 {
35501
7bb176fac55c Use boolean symbolic constants in Win32 GUI.
ib
parents: 34998
diff changeset
755 reachedendofwindow = TRUE;
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
756 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [END] of window \"%s\"\n", mywindow->name);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
757 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
758 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
759 else if(!strncmp(desc, "font", 4))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
760 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
761 int id = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
762 char temp[MAX_LINESIZE];
36888
47c6c14f386b Cosmetic: Adjust indent.
ib
parents: 36887
diff changeset
763 int base = counttonextchar(desc, '=') + 1;
47c6c14f386b Cosmetic: Adjust indent.
ib
parents: 36887
diff changeset
764 findnextstring(temp, desc, &base);
47c6c14f386b Cosmetic: Adjust indent.
ib
parents: 36887
diff changeset
765 id = skin->fontcount;
47c6c14f386b Cosmetic: Adjust indent.
ib
parents: 36887
diff changeset
766 (skin->fontcount)++;
47c6c14f386b Cosmetic: Adjust indent.
ib
parents: 36887
diff changeset
767 skin->fonts = realloc(skin->fonts, sizeof(font_t *) * skin->fontcount);
47c6c14f386b Cosmetic: Adjust indent.
ib
parents: 36887
diff changeset
768 skin->fonts[id]=calloc(1, sizeof(font_t));
47c6c14f386b Cosmetic: Adjust indent.
ib
parents: 36887
diff changeset
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
2b3ede5f8424 Remove needless fontid from Win32 GUI.
ib
parents: 36885
diff changeset
774 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [FONT] name \"%s\"\n", skin->fonts[id]->name);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
775 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
776 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
777 skin->addwidget(skin, mywindow, desc);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
778 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
779
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
780 free(desc);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
781 free(filename);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
782 free(tmp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
783 fclose(fp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
784 loadfonts(skin);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
785 mp_msg(MSGT_GPLAYER, MSGL_V, "[SKIN LOAD] loaded skin \"%s\"\n", skin->skindir);
34450
74622554a386 Remove all #ifdef MP_DEBUG from Win32 GUI code.
ib
parents: 34387
diff changeset
786 dumpwidgets(skin);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
787 return skin;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
788 }