annotate gui/skin/skin.c @ 36991:fa8b6892b0bf

Cosmetic: Rename cut functions. Rename cutItem() cutStr(), cutItemString() cutString() and cutItemToInt() cutInt().
author ib
date Thu, 27 Mar 2014 09:44:01 +0000
parents 0b80003f6542
children a17b55521dd2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26458
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
1 /*
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
2 * This file is part of MPlayer.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
3 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
5 * it under the terms of the GNU General Public License as published by
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
7 * (at your option) any later version.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
8 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
12 * GNU General Public License for more details.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
13 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
14 * You should have received a copy of the GNU General Public License along
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
17 */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
18
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
19 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
20 * @file
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
21 * @brief Skin parser
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
22 */
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
23
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
24 #include <stdio.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
25 #include <string.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
26
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
27 #include "skin.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
28 #include "font.h"
36032
c667e34fb941 Cosmetic: Rearrange #includes.
ib
parents: 35786
diff changeset
29 #include "gui/interface.h"
35525
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35493
diff changeset
30 #include "gui/app/app.h"
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35493
diff changeset
31 #include "gui/app/gui.h"
35529
8ad4d2fb46e8 Rebuild GUI directory structure.
ib
parents: 35525
diff changeset
32 #include "gui/dialog/dialog.h"
33048
c6d0adf896ea Move auxiliary string functions into separate file.
ib
parents: 33046
diff changeset
33 #include "gui/util/string.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
34
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
35 #include "help_mp.h"
36032
c667e34fb941 Cosmetic: Rearrange #includes.
ib
parents: 35786
diff changeset
36 #include "mp_msg.h"
23703
9fb716ab06a3 Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents: 23077
diff changeset
37 #include "libavutil/avstring.h"
32944
27a98940e3aa Use FF_ARRAY_ELEMS() rather than a separate constant.
ib
parents: 32937
diff changeset
38 #include "libavutil/common.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
39
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
40 typedef struct {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
41 const char *name;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
42 int (*func)(char *in);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
43 } _item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
44
33749
d8f49edf8f25 Remove skin related variables from interface.[ch].
ib
parents: 33556
diff changeset
45 char *skinDirInHome;
36043
40c13df3d953 Cosmetic: Rename variables (consistently).
ib
parents: 36032
diff changeset
46 char *skinDirInData;
33749
d8f49edf8f25 Remove skin related variables from interface.[ch].
ib
parents: 33556
diff changeset
47
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
48 static guiItems *skin;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
49
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
50 static int linenumber;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
51 static unsigned char path[512];
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
52
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
53 static unsigned char currWinName[32];
35688
6fd886ce32b9 Cosmetic: Rename wItem guiItem.
ib
parents: 35662
diff changeset
54 static guiItem *currWin;
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
55 static int *currWinItemIdx;
35688
6fd886ce32b9 Cosmetic: Rename wItem guiItem.
ib
parents: 35662
diff changeset
56 static guiItem *currWinItems;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
57
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
58 /**
36891
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
59 * @brief Print a legacy information on an entry.
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
60 *
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
61 * @param old identifier (and deprecated entry)
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
62 * @param data pointer to additional data necessary for checking and
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
63 * to print the information on @a old
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
64 */
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
65 static void skin_legacy(const char *old, const char *data)
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
66 {
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
67 const char *p;
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
68
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
69 if (strcmp(old, "fontid") == 0) {
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
70 p = strchr(data, ',');
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
71
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
72 if (p)
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
73 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: 36876
diff changeset
74 } else if (strcmp(old, "$l") == 0) {
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
75 p = strstr(old, data);
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
76
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
77 if (p && (p == data || p[-1] != '$'))
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
78 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: 36876
diff changeset
79 } else if (strcmp(old, "evSetURL") == 0 && strcmp(data, old) == 0)
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
80 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
81 else if (strcmp(old, "sub") == 0 || strcmp(old, "potmeter") == 0)
36891
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
82 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: 36876
diff changeset
83 }
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
84
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
85 /**
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
86 * @brief Display a skin error message.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
87 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
88 * @param format format string
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
89 * @param ... arguments
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
90 */
33022
9abc0dbd6314 Cosmetic: Rename ERRORMESSAGE() skin_error().
ib
parents: 32980
diff changeset
91 static void skin_error(const char *format, ...)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
92 {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
93 char p[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
94 va_list ap;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
95
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
96 va_start(ap, format);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
97 vsnprintf(p, sizeof(p), format, ap);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
98 va_end(ap);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
99
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
100 gmp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_GUI_MSG_SkinErrorMessage, linenumber, p);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
101 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
102
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
103 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
104 * @brief Check whether a @a section definition has started.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
105 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
106 * @param item name of the item to be put in a message in case of an error
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
107 *
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35450
diff changeset
108 * @return #True (ok) or #False (error)
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
109 */
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
110 static int section_item(char *item)
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
111 {
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
112 if (!skin) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
113 skin_error(MSGTR_GUI_MSG_SkinErrorSection, item);
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35450
diff changeset
114 return False;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
115 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
116
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35450
diff changeset
117 return True;
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
118 }
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
119
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
120 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
121 * @brief Check whether a @a window definition has started.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
122 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
123 * @param item name of the item to be put in a message in case of an error
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
124 *
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35450
diff changeset
125 * @return #True (ok) or #False (error)
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
126 */
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
127 static int window_item(char *item)
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
128 {
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
129 if (!currWinName[0]) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
130 skin_error(MSGTR_GUI_MSG_SkinErrorWindow, item);
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35450
diff changeset
131 return False;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
132 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
133
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35450
diff changeset
134 return True;
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
135 }
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
136
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
137 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
138 * @brief Check whether a specific @a window definition has started.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
139 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
140 * @param name name of the window to be checked
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
141 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
142 * @return 0 (ok) or 1 (error)
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
143 */
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
144 static int in_window(char *name)
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
145 {
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
146 if (strcmp(currWinName, name) == 0) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
147 skin_error(MSGTR_GUI_MSG_SkinErrorItem, name);
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
148 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
149 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
150
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
151 return 0;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
152 }
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
153
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
154 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
155 * @brief Get next free item in current @a window.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
156 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
157 * @return pointer to next free item (ok) or NULL (error)
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
158 */
35688
6fd886ce32b9 Cosmetic: Rename wItem guiItem.
ib
parents: 35662
diff changeset
159 static guiItem *next_item(void)
33098
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
160 {
35688
6fd886ce32b9 Cosmetic: Rename wItem guiItem.
ib
parents: 35662
diff changeset
161 guiItem *item = NULL;
33098
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
162
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
163 if (*currWinItemIdx < MAX_ITEMS - 1) {
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
164 (*currWinItemIdx)++;
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
165 item = &currWinItems[*currWinItemIdx];
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
166 } else
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
167 skin_error(MSGTR_GUI_MSG_SkinTooManyItems);
33098
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
168
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
169 return item;
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
170 }
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
171
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
172 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
173 * @brief Parse a @a section definition.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
174 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
175 * Syntax: section=movieplayer
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
176 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
177 * @param in definition to be analyzed
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
178 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
179 * @return 0 (ok) or 1 (error)
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
180 */
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
181 static int item_section(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
182 {
33064
33d307c4430c Add error check.
ib
parents: 33063
diff changeset
183 if (skin) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
184 skin_error(MSGTR_GUI_MSG_SkinErrorItem, "section");
33064
33d307c4430c Add error check.
ib
parents: 33063
diff changeset
185 return 1;
33d307c4430c Add error check.
ib
parents: 33063
diff changeset
186 }
33d307c4430c Add error check.
ib
parents: 33063
diff changeset
187
33055
2be86f1db767 Make use of return value of strlower().
ib
parents: 33054
diff changeset
188 if (!strcmp(strlower(in), "movieplayer"))
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33357
diff changeset
189 skin = &guiApp;
33067
2d0058f30a6b Issue error message in case of wrong section name.
ib
parents: 33066
diff changeset
190 else {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
191 skin_error(MSGTR_GUI_MSG_SkinUnknownName, in);
33067
2d0058f30a6b Issue error message in case of wrong section name.
ib
parents: 33066
diff changeset
192 return 1;
2d0058f30a6b Issue error message in case of wrong section name.
ib
parents: 33066
diff changeset
193 }
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
194
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
195 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] section: %s\n", in);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
196
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
197 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
198 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
199
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
200 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
201 * @brief Parse an @a end definition.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
202 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
203 * Syntax: end
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
204 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
205 * @param in definition to be analyzed
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
206 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
207 * @return 0 (ok) or 1 (error)
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
208 */
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
209 static int item_end(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
210 {
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
211 char *space, *name;
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
212
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
213 (void)in;
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
214
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
215 if (currWinName[0]) {
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
216 space = " ";
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
217 name = currWinName;
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
218 } else {
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
219 space = "";
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
220 name = "section";
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
221 }
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
222
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
223 if (!section_item("end"))
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
224 return 1;
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
225
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
226 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] %send (%s)\n", space, name);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
227
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
228 if (currWinName[0]) {
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
229 currWinName[0] = 0;
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
230 currWin = NULL;
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
231 currWinItemIdx = NULL;
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
232 currWinItems = NULL;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
233 } else
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
234 skin = NULL;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
235
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
236 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
237 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
238
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
239 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
240 * @brief Parse a @a window definition.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
241 *
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34578
diff changeset
242 * Syntax: window=main|video|playbar|menu
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
243 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
244 * @param in definition to be analyzed
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
245 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
246 * @return 0 (ok) or 1 (error)
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
247 */
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
248 static int item_window(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
249 {
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
250 if (!section_item("window"))
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
251 return 1;
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
252
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
253 if (currWinName[0]) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
254 skin_error(MSGTR_GUI_MSG_SkinErrorItem, "window");
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
255 return 1;
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
256 }
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
257
33083
8c96263e0f09 Clean up cmd_window().
ib
parents: 33081
diff changeset
258 strlower(in);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
259
36891
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
260 // legacy
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
261 if (strcmp(in, "sub") == 0) {
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
262 strcpy(in, "video");
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
263 skin_legacy("sub", in);
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
264 }
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34578
diff changeset
265
33083
8c96263e0f09 Clean up cmd_window().
ib
parents: 33081
diff changeset
266 if (strcmp(in, "main") == 0) {
33095
772af04413f3 Avoid using appMPlayer.
ib
parents: 33094
diff changeset
267 currWin = &skin->main;
772af04413f3 Avoid using appMPlayer.
ib
parents: 33094
diff changeset
268 currWinItemIdx = &skin->IndexOfMainItems;
772af04413f3 Avoid using appMPlayer.
ib
parents: 33094
diff changeset
269 currWinItems = skin->mainItems;
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34578
diff changeset
270 } else if (strcmp(in, "video") == 0) {
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34578
diff changeset
271 currWin = &skin->video;
33083
8c96263e0f09 Clean up cmd_window().
ib
parents: 33081
diff changeset
272 currWinItemIdx = NULL;
8c96263e0f09 Clean up cmd_window().
ib
parents: 33081
diff changeset
273 currWinItems = NULL;
8c96263e0f09 Clean up cmd_window().
ib
parents: 33081
diff changeset
274 } else if (strcmp(in, "playbar") == 0) {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33357
diff changeset
275 currWin = &skin->playbar;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33357
diff changeset
276 currWinItemIdx = &skin->IndexOfPlaybarItems;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33357
diff changeset
277 currWinItems = skin->playbarItems;
33083
8c96263e0f09 Clean up cmd_window().
ib
parents: 33081
diff changeset
278 } else if (strcmp(in, "menu") == 0) {
33095
772af04413f3 Avoid using appMPlayer.
ib
parents: 33094
diff changeset
279 currWin = &skin->menu;
772af04413f3 Avoid using appMPlayer.
ib
parents: 33094
diff changeset
280 currWinItemIdx = &skin->IndexOfMenuItems;
772af04413f3 Avoid using appMPlayer.
ib
parents: 33094
diff changeset
281 currWinItems = skin->menuItems;
33066
fd4d66a6add6 Don't start GUI in case of window name error.
ib
parents: 33065
diff changeset
282 } else {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
283 skin_error(MSGTR_GUI_MSG_SkinUnknownName, in);
33066
fd4d66a6add6 Don't start GUI in case of window name error.
ib
parents: 33065
diff changeset
284 return 1;
fd4d66a6add6 Don't start GUI in case of window name error.
ib
parents: 33065
diff changeset
285 }
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
286
33083
8c96263e0f09 Clean up cmd_window().
ib
parents: 33081
diff changeset
287 av_strlcpy(currWinName, in, sizeof(currWinName));
8c96263e0f09 Clean up cmd_window().
ib
parents: 33081
diff changeset
288
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
289 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] window: %s\n", currWinName);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
290
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
291 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
292 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
293
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
294 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
295 * @brief Parse a @a base definition.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
296 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
297 * Syntax: base=image,x,y[,width,height]
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
298 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
299 * @param in definition to be analyzed
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
300 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
301 * @return 0 (ok) or 1 (error)
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
302 */
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
303 static int item_base(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
304 {
33090
db699b367260 Reduce resp. increase arrays to reasonable size.
ib
parents: 33089
diff changeset
305 unsigned char fname[256];
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
306 unsigned char file[512];
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
307 int x, y;
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
308 int w = 0, h = 0;
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34578
diff changeset
309 int is_video, is_bar, is_menu;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
310
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
311 if (!window_item("base"))
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
312 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
313
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34578
diff changeset
314 is_video = (strcmp(currWinName, "video") == 0);
34698
456784c6c904 Cosmetic: Adjust indent.
ib
parents: 34697
diff changeset
315 is_bar = (strcmp(currWinName, "playbar") == 0);
456784c6c904 Cosmetic: Adjust indent.
ib
parents: 34697
diff changeset
316 is_menu = (strcmp(currWinName, "menu") == 0);
33104
65827197d1af Simplify cmd_base().
ib
parents: 33103
diff changeset
317
36991
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
318 cutStr(in, fname, ',', 0);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
319 x = cutInt(in, ',', 1);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
320 y = cutInt(in, ',', 2);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
321 w = cutInt(in, ',', 3);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
322 h = cutInt(in, ',', 4);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
323
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
324 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] image: %s", fname);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
325
33105
1cd1adf9ee6c Cosmetic: Adjust indent after simplifying cmd_base().
ib
parents: 33104
diff changeset
326 currWin->type = itBase;
33104
65827197d1af Simplify cmd_base().
ib
parents: 33103
diff changeset
327
33105
1cd1adf9ee6c Cosmetic: Adjust indent after simplifying cmd_base().
ib
parents: 33104
diff changeset
328 if (!is_menu) {
1cd1adf9ee6c Cosmetic: Adjust indent after simplifying cmd_base().
ib
parents: 33104
diff changeset
329 currWin->x = x;
1cd1adf9ee6c Cosmetic: Adjust indent after simplifying cmd_base().
ib
parents: 33104
diff changeset
330 currWin->y = y;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
331
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
332 mp_msg(MSGT_GPLAYER, MSGL_DBG2, " %d,%d", x, y);
33105
1cd1adf9ee6c Cosmetic: Adjust indent after simplifying cmd_base().
ib
parents: 33104
diff changeset
333 }
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
334
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
335 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "\n");
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
336
35785
24b744af09a7 Allow video window without image displayed in it.
ib
parents: 35784
diff changeset
337 if (is_video && (strcmp(fname, "NULL") == 0)) {
24b744af09a7 Allow video window without image displayed in it.
ib
parents: 35784
diff changeset
338 currWin->width = 0;
24b744af09a7 Allow video window without image displayed in it.
ib
parents: 35784
diff changeset
339 currWin->height = 0;
24b744af09a7 Allow video window without image displayed in it.
ib
parents: 35784
diff changeset
340 } else {
35786
21d852a58d32 Cosmetic: Adjust indent.
ib
parents: 35785
diff changeset
341 av_strlcpy(file, path, sizeof(file));
21d852a58d32 Cosmetic: Adjust indent.
ib
parents: 35785
diff changeset
342 av_strlcat(file, fname, sizeof(file));
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
343
35786
21d852a58d32 Cosmetic: Adjust indent.
ib
parents: 35785
diff changeset
344 if (skinImageRead(file, &currWin->Bitmap) != 0)
21d852a58d32 Cosmetic: Adjust indent.
ib
parents: 35785
diff changeset
345 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
346
35786
21d852a58d32 Cosmetic: Adjust indent.
ib
parents: 35785
diff changeset
347 currWin->width = currWin->Bitmap.Width;
21d852a58d32 Cosmetic: Adjust indent.
ib
parents: 35785
diff changeset
348 currWin->height = currWin->Bitmap.Height;
35785
24b744af09a7 Allow video window without image displayed in it.
ib
parents: 35784
diff changeset
349 }
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
350
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34578
diff changeset
351 if (is_video) {
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
352 if (w && h) {
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
353 currWin->width = w;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
354 currWin->height = h;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
355 }
33105
1cd1adf9ee6c Cosmetic: Adjust indent after simplifying cmd_base().
ib
parents: 33104
diff changeset
356 }
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
357
35785
24b744af09a7 Allow video window without image displayed in it.
ib
parents: 35784
diff changeset
358 if (currWin->width == 0 || currWin->height == 0)
24b744af09a7 Allow video window without image displayed in it.
ib
parents: 35784
diff changeset
359 return 1;
24b744af09a7 Allow video window without image displayed in it.
ib
parents: 35784
diff changeset
360
36975
91f11a849d4d Remove unnecessary, bothering parentheses.
ib
parents: 36920
diff changeset
361 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] %s: %dx%d\n", is_video && w && h ? "size" : " bitmap", currWin->width, currWin->height);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
362
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34578
diff changeset
363 if (!is_video) {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33357
diff changeset
364 if (!bpRenderMask(&currWin->Bitmap, &currWin->Mask)) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
365 skin_error(MSGTR_GUI_MSG_SkinMemoryError);
33114
5ad451a5ebec Remove useless warning message.
ib
parents: 33106
diff changeset
366 return 1;
5ad451a5ebec Remove useless warning message.
ib
parents: 33106
diff changeset
367 }
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
368 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] mask: %lux%lu\n", currWin->Mask.Width, currWin->Mask.Height);
33105
1cd1adf9ee6c Cosmetic: Adjust indent after simplifying cmd_base().
ib
parents: 33104
diff changeset
369 }
33101
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
370
33105
1cd1adf9ee6c Cosmetic: Adjust indent after simplifying cmd_base().
ib
parents: 33104
diff changeset
371 if (is_bar)
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35450
diff changeset
372 skin->playbarIsPresent = True;
33105
1cd1adf9ee6c Cosmetic: Adjust indent after simplifying cmd_base().
ib
parents: 33104
diff changeset
373 if (is_menu)
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35450
diff changeset
374 skin->menuIsPresent = True;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
375
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
376 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
377 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
378
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
379 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
380 * @brief Parse a @a background definition.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
381 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
382 * Syntax: background=R,G,B
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
383 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
384 * @param in definition to be analyzed
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
385 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
386 * @return 0 (ok) or 1 (error)
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
387 */
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
388 static int item_background(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
389 {
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
390 if (!window_item("background"))
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
391 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
392
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
393 if (in_window("main"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
394 return 1;
33088
babdacb1ceac Disable background definition for playbar.
ib
parents: 33087
diff changeset
395 if (in_window("playbar"))
babdacb1ceac Disable background definition for playbar.
ib
parents: 33087
diff changeset
396 return 1;
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
397 if (in_window("menu"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
398 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
399
36991
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
400 currWin->R = cutInt(in, ',', 0);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
401 currWin->G = cutInt(in, ',', 1);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
402 currWin->B = cutInt(in, ',', 2);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
403
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
404 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] background color: #%02x%02x%02x\n", currWin->R, currWin->G, currWin->B);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
405
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
406 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
407 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
408
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
409 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
410 * @brief Parse a @a button definition.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
411 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
412 * Syntax: button=image,x,y,width,height,message
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
413 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
414 * @param in definition to be analyzed
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
415 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
416 * @return 0 (ok) or 1 (error)
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
417 */
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
418 static int item_button(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
419 {
33090
db699b367260 Reduce resp. increase arrays to reasonable size.
ib
parents: 33089
diff changeset
420 unsigned char fname[256];
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
421 unsigned char file[512];
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
422 int x, y, w, h, message;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
423 char msg[32];
35688
6fd886ce32b9 Cosmetic: Rename wItem guiItem.
ib
parents: 35662
diff changeset
424 guiItem *item;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
425
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
426 if (!window_item("button"))
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
427 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
428
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34578
diff changeset
429 if (in_window("video"))
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
430 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
431 if (in_window("menu"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
432 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
433
36991
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
434 cutStr(in, fname, ',', 0);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
435 x = cutInt(in, ',', 1);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
436 y = cutInt(in, ',', 2);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
437 w = cutInt(in, ',', 3);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
438 h = cutInt(in, ',', 4);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
439 cutStr(in, msg, ',', 5);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
440
33071
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
441 message = appFindMessage(msg);
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
442
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
443 if (message == -1) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
444 skin_error(MSGTR_GUI_MSG_SkinUnknownMessage, msg);
33071
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
445 return 1;
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
446 }
36891
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
447 // legacy
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
448 else
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
449 skin_legacy("evSetURL", msg);
33071
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
450
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
451 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] button image: %s %d,%d\n", fname, x, y);
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
452 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %s (#%d)\n", msg, message);
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
453 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] size: %dx%d\n", w, h);
33102
de688a61e439 Move debug messages so that they will be processed earlier.
ib
parents: 33101
diff changeset
454
33098
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
455 item = next_item();
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
456
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
457 if (!item)
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
458 return 1;
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
459
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
460 item->type = itButton;
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
461 item->x = x;
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
462 item->y = y;
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
463 item->width = w;
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
464 item->height = h;
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
465 item->message = message;
33101
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
466 item->pressed = btnReleased;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
467
33098
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
468 if (item->message == evPauseSwitchToPlay)
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
469 item->pressed = btnDisabled;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
470
33098
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
471 item->Bitmap.Image = NULL;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
472
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
473 if (strcmp(fname, "NULL") != 0) {
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
474 av_strlcpy(file, path, sizeof(file));
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
475 av_strlcat(file, fname, sizeof(file));
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
476
33969
9184bc37d4d5 Cosmetic: Rename skinBPRead() skinImageRead().
ib
parents: 33968
diff changeset
477 if (skinImageRead(file, &item->Bitmap) != 0)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
478 return 1;
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
479
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
480 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] (bitmap: %lux%lu)\n", item->Bitmap.Width, item->Bitmap.Height);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
481 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
482
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
483 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
484 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
485
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
486 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
487 * @brief Parse a @a selected definition.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
488 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
489 * Syntax: selected=image
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
490 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
491 * @param in definition to be analyzed
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
492 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
493 * @return 0 (ok) or 1 (error)
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
494 */
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
495 static int item_selected(char *in)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
496 {
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
497 unsigned char file[512];
35688
6fd886ce32b9 Cosmetic: Rename wItem guiItem.
ib
parents: 35662
diff changeset
498 guiItem *currItem;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
499
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
500 if (!window_item("selected"))
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
501 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
502
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
503 if (in_window("main"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
504 return 1;
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34578
diff changeset
505 if (in_window("video"))
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
506 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
507 if (in_window("playbar"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
508 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
509
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
510 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] image selected: %s\n", in);
33102
de688a61e439 Move debug messages so that they will be processed earlier.
ib
parents: 33101
diff changeset
511
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
512 currItem = &skin->menuSelected;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
513 currItem->type = itBase;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
514
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
515 av_strlcpy(file, path, sizeof(file));
33091
6ce0b74d03b7 Remove needless variable.
ib
parents: 33090
diff changeset
516 av_strlcat(file, in, sizeof(file));
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
517
33969
9184bc37d4d5 Cosmetic: Rename skinBPRead() skinImageRead().
ib
parents: 33968
diff changeset
518 if (skinImageRead(file, &currItem->Bitmap) != 0)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
519 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
520
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
521 currItem->width = currItem->Bitmap.Width;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
522 currItem->height = currItem->Bitmap.Height;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
523
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
524 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] bitmap: %dx%d\n", currItem->width, currItem->height);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
525
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
526 return 0;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
527 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
528
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
529 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
530 * @brief Parse a @a menu definition.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
531 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
532 * Syntax: menu=x,y,width,height,message
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
533 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
534 * @param in definition to be analyzed
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
535 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
536 * @return 0 (ok) or 1 (error)
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
537 */
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
538 static int item_menu(char *in)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
539 {
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
540 int x, y, w, h, message;
33071
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
541 char msg[32];
35688
6fd886ce32b9 Cosmetic: Rename wItem guiItem.
ib
parents: 35662
diff changeset
542 guiItem *item;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
543
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
544 if (!window_item("menu"))
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
545 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
546
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
547 if (in_window("main"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
548 return 1;
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34578
diff changeset
549 if (in_window("video"))
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
550 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
551 if (in_window("playbar"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
552 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
553
36991
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
554 x = cutInt(in, ',', 0);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
555 y = cutInt(in, ',', 1);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
556 w = cutInt(in, ',', 2);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
557 h = cutInt(in, ',', 3);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
558 cutStr(in, msg, ',', 4);
33071
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
559
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
560 message = appFindMessage(msg);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
561
33071
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
562 if (message == -1) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
563 skin_error(MSGTR_GUI_MSG_SkinUnknownMessage, msg);
33071
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
564 return 1;
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
565 }
36891
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
566 // legacy
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
567 else
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
568 skin_legacy("evSetURL", msg);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
569
33098
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
570 item = next_item();
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
571
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
572 if (!item)
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
573 return 1;
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
574
33100
35efac3ece2c Add an itMenu item type.
ib
parents: 33099
diff changeset
575 item->type = itMenu;
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
576 item->x = x;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
577 item->y = y;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
578 item->width = w;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
579 item->height = h;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
580 item->message = message;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
581
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
582 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] item #%d: %d,%d %dx%d\n", *currWinItemIdx, x, y, w, h);
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
583 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %s (#%d)\n", msg, message);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
584
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
585 item->Bitmap.Image = NULL;
33053
f64d41dac10b Cosmetic: Separate return statement with newline.
ib
parents: 33052
diff changeset
586
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
587 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
588 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
589
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
590 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
591 * @brief Parse a @a hpotmeter definition.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
592 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
593 * Syntax: hpotmeter=button,bwidth,bheight,phases,numphases,default,x,y,width,height,message
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
594 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
595 * @param in definition to be analyzed
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
596 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
597 * @return 0 (ok) or 1 (error)
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
598 */
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
599 static int item_hpotmeter(char *in)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
600 {
33090
db699b367260 Reduce resp. increase arrays to reasonable size.
ib
parents: 33089
diff changeset
601 unsigned char pfname[256];
db699b367260 Reduce resp. increase arrays to reasonable size.
ib
parents: 33089
diff changeset
602 unsigned char phfname[256];
33093
3de646fca03b Cosmetic: Rearrange variable declarations to match parameters.
ib
parents: 33092
diff changeset
603 unsigned char buf[512];
3de646fca03b Cosmetic: Rearrange variable declarations to match parameters.
ib
parents: 33092
diff changeset
604 int pwidth, pheight, ph, d, x, y, w, h, message;
35688
6fd886ce32b9 Cosmetic: Rename wItem guiItem.
ib
parents: 35662
diff changeset
605 guiItem *item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
606
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
607 if (!window_item("h/v potmeter"))
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
608 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
609
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34578
diff changeset
610 if (in_window("video"))
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
611 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
612 if (in_window("menu"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
613 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
614
36991
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
615 cutStr(in, pfname, ',', 0);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
616 pwidth = cutInt(in, ',', 1);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
617 pheight = cutInt(in, ',', 2);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
618 cutStr(in, phfname, ',', 3);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
619 ph = cutInt(in, ',', 4);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
620 d = cutInt(in, ',', 5);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
621 x = cutInt(in, ',', 6);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
622 y = cutInt(in, ',', 7);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
623 w = cutInt(in, ',', 8);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
624 h = cutInt(in, ',', 9);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
625 cutStr(in, buf, ',', 10);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
626
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
627 message = appFindMessage(buf);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
628
33069
4b7d4905862c Rename error message and add missing checks.
ib
parents: 33067
diff changeset
629 if (message == -1) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
630 skin_error(MSGTR_GUI_MSG_SkinUnknownMessage, buf);
33069
4b7d4905862c Rename error message and add missing checks.
ib
parents: 33067
diff changeset
631 return 1;
4b7d4905862c Rename error message and add missing checks.
ib
parents: 33067
diff changeset
632 }
36891
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
633 // legacy
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
634 else
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
635 skin_legacy("evSetURL", buf);
33069
4b7d4905862c Rename error message and add missing checks.
ib
parents: 33067
diff changeset
636
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
637 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] h/v potmeter image: %s %d,%d %dx%d\n", phfname, x, y, w, h);
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
638 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] button image: %s %dx%d\n", pfname, pwidth, pheight);
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
639 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] numphases: %d, default: %d%%\n", ph, d);
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
640 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %s (#%d)\n", buf, message);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
641
33098
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
642 item = next_item();
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
643
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
644 if (!item)
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
645 return 1;
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
646
33101
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
647 item->type = itHPotmeter;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
648 item->x = x;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
649 item->y = y;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
650 item->width = w;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
651 item->height = h;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
652 item->pwidth = pwidth;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
653 item->pheight = pheight;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
654 item->numphases = ph;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
655 item->value = (float)d;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
656 item->message = message;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
657 item->pressed = btnReleased;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
658
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
659 item->Bitmap.Image = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
660
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
661 if (strcmp(phfname, "NULL") != 0) {
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
662 av_strlcpy(buf, path, sizeof(buf));
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
663 av_strlcat(buf, phfname, sizeof(buf));
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
664
33969
9184bc37d4d5 Cosmetic: Rename skinBPRead() skinImageRead().
ib
parents: 33968
diff changeset
665 if (skinImageRead(buf, &item->Bitmap) != 0)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
666 return 1;
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
667
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
668 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] (potmeter bitmap: %lux%lu)\n", item->Bitmap.Width, item->Bitmap.Height);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
669 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
670
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
671 item->Mask.Image = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
672
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
673 if (strcmp(pfname, "NULL") != 0) {
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
674 av_strlcpy(buf, path, sizeof(buf));
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
675 av_strlcat(buf, pfname, sizeof(buf));
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
676
33969
9184bc37d4d5 Cosmetic: Rename skinBPRead() skinImageRead().
ib
parents: 33968
diff changeset
677 if (skinImageRead(buf, &item->Mask) != 0)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
678 return 1;
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
679
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
680 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] (button bitmap: %lux%lu)\n", item->Mask.Width, item->Mask.Height);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
681 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
682
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
683 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
684 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
685
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
686 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
687 * @brief Parse a @a vpotmeter definition.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
688 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
689 * Syntax: vpotmeter=button,bwidth,bheight,phases,numphases,default,x,y,width,height,message
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
690 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
691 * @param in definition to be analyzed
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
692 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
693 * @return 0 (ok) or 1 (error)
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
694 */
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
695 static int item_vpotmeter(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
696 {
33056
1c2070f0abca Prevent a segmentation fault.
ib
parents: 33055
diff changeset
697 int r;
35688
6fd886ce32b9 Cosmetic: Rename wItem guiItem.
ib
parents: 35662
diff changeset
698 guiItem *item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
699
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
700 r = item_hpotmeter(in);
33056
1c2070f0abca Prevent a segmentation fault.
ib
parents: 33055
diff changeset
701
1c2070f0abca Prevent a segmentation fault.
ib
parents: 33055
diff changeset
702 if (r == 0) {
33057
0d6b33bc311e Cosmetic: Adjust indent.
ib
parents: 33056
diff changeset
703 item = &currWinItems[*currWinItemIdx];
0d6b33bc311e Cosmetic: Adjust indent.
ib
parents: 33056
diff changeset
704 item->type = itVPotmeter;
33056
1c2070f0abca Prevent a segmentation fault.
ib
parents: 33055
diff changeset
705 }
33053
f64d41dac10b Cosmetic: Separate return statement with newline.
ib
parents: 33052
diff changeset
706
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
707 return r;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
708 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
709
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
710 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
711 * @brief Parse a @a potmeter definition.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
712 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
713 * Syntax: potmeter=phases,numphases,default,x,y,width,height,message
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
714 *
36920
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
715 * @note THIS ITEM IS DEPRECATED.
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
716 *
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
717 * @param in definition to be analyzed
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
718 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
719 * @return 0 (ok) or 1 (error)
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
720 */
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
721 static int item_potmeter(char *in)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
722 {
36892
f50427ad9ff6 Internally map item 'potmeter' onto 'hpotmeter'.
ib
parents: 36891
diff changeset
723 char param[256];
f50427ad9ff6 Internally map item 'potmeter' onto 'hpotmeter'.
ib
parents: 36891
diff changeset
724
f50427ad9ff6 Internally map item 'potmeter' onto 'hpotmeter'.
ib
parents: 36891
diff changeset
725 // legacy
f50427ad9ff6 Internally map item 'potmeter' onto 'hpotmeter'.
ib
parents: 36891
diff changeset
726 skin_legacy("potmeter", "hpotmeter");
f50427ad9ff6 Internally map item 'potmeter' onto 'hpotmeter'.
ib
parents: 36891
diff changeset
727
f50427ad9ff6 Internally map item 'potmeter' onto 'hpotmeter'.
ib
parents: 36891
diff changeset
728 snprintf(param, sizeof(param), "NULL,0,0,%s", in);
f50427ad9ff6 Internally map item 'potmeter' onto 'hpotmeter'.
ib
parents: 36891
diff changeset
729
f50427ad9ff6 Internally map item 'potmeter' onto 'hpotmeter'.
ib
parents: 36891
diff changeset
730 return item_hpotmeter(param);
36920
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
731 }
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
732
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
733 /**
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
734 * @brief Parse a @a pimage definition.
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
735 *
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
736 * Syntax: pimage=phases,numphases,default,x,y,width,height,message
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
737 *
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
738 * @param in definition to be analyzed
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
739 *
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
740 * @return 0 (ok) or 1 (error)
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
741 */
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
742 static int item_pimage(char *in)
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
743 {
33093
3de646fca03b Cosmetic: Rearrange variable declarations to match parameters.
ib
parents: 33092
diff changeset
744 unsigned char phfname[256];
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
745 unsigned char buf[512];
33093
3de646fca03b Cosmetic: Rearrange variable declarations to match parameters.
ib
parents: 33092
diff changeset
746 int ph, d, x, y, w, h, message;
35688
6fd886ce32b9 Cosmetic: Rename wItem guiItem.
ib
parents: 35662
diff changeset
747 guiItem *item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
748
36920
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
749 if (!window_item("pimage"))
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
750 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
751
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34578
diff changeset
752 if (in_window("video"))
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
753 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
754 if (in_window("menu"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
755 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
756
36991
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
757 cutStr(in, phfname, ',', 0);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
758 ph = cutInt(in, ',', 1);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
759 d = cutInt(in, ',', 2);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
760 x = cutInt(in, ',', 3);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
761 y = cutInt(in, ',', 4);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
762 w = cutInt(in, ',', 5);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
763 h = cutInt(in, ',', 6);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
764 cutStr(in, buf, ',', 7);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
765
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
766 message = appFindMessage(buf);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
767
33069
4b7d4905862c Rename error message and add missing checks.
ib
parents: 33067
diff changeset
768 if (message == -1) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
769 skin_error(MSGTR_GUI_MSG_SkinUnknownMessage, buf);
33069
4b7d4905862c Rename error message and add missing checks.
ib
parents: 33067
diff changeset
770 return 1;
4b7d4905862c Rename error message and add missing checks.
ib
parents: 33067
diff changeset
771 }
36891
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
772 // legacy
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
773 else
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
774 skin_legacy("evSetURL", buf);
33069
4b7d4905862c Rename error message and add missing checks.
ib
parents: 33067
diff changeset
775
36920
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
776 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] pimage image: %s %d,%d %dx%d\n", phfname, x, y, w, h);
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
777 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] numphases: %d, default: %d%%\n", ph, d);
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
778 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %s (#%d)\n", buf, message);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
779
33098
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
780 item = next_item();
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
781
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
782 if (!item)
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
783 return 1;
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
784
36920
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
785 item->type = itPimage;
33101
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
786 item->x = x;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
787 item->y = y;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
788 item->width = w;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
789 item->height = h;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
790 item->numphases = ph;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
791 item->value = (float)d;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
792 item->message = message;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
793
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
794 item->Bitmap.Image = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
795
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
796 if (strcmp(phfname, "NULL") != 0) {
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
797 av_strlcpy(buf, path, sizeof(buf));
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
798 av_strlcat(buf, phfname, sizeof(buf));
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
799
33969
9184bc37d4d5 Cosmetic: Rename skinBPRead() skinImageRead().
ib
parents: 33968
diff changeset
800 if (skinImageRead(buf, &item->Bitmap) != 0)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
801 return 1;
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
802
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
803 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] (bitmap: %lux%lu)\n", item->Bitmap.Width, item->Bitmap.Height);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
804 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
805
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
806 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
807 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
808
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
809 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
810 * @brief Parse a @a font definition.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
811 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
812 * Syntax: font=fontfile
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
813 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
814 * @param in definition to be analyzed
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
815 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
816 * @return 0 (ok) or 1 (error)
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
817 */
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
818 static int item_font(char *in)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
819 {
33092
83052a4ac698 Use more appropriate name for variable and reduce it to reasonable size.
ib
parents: 33091
diff changeset
820 char fnt[256];
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
821
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
822 if (!window_item("font"))
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
823 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
824
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34578
diff changeset
825 if (in_window("video"))
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
826 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
827 if (in_window("menu"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
828 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
829
36991
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
830 cutStr(in, fnt, ',', 0); // Note: This seems needless but isn't for compatibility
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
831 // reasons with a meanwhile deprecated second parameter.
36891
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
832 // legacy
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
833 skin_legacy("fontid", in);
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
834
33099
0b17f6bed6fc Don't needlessly store font information in the wItems array
ib
parents: 33098
diff changeset
835 switch (fntRead(path, fnt)) {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
836 case -1:
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
837 skin_error(MSGTR_GUI_MSG_SkinMemoryError);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
838 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
839
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
840 case -2:
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
841 skin_error(MSGTR_GUI_MSG_SkinTooManyFonts);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
842 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
843
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
844 case -3:
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
845 skin_error(MSGTR_GUI_MSG_SkinFontFileNotFound);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
846 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
847
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
848 case -4:
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
849 skin_error(MSGTR_GUI_MSG_SkinFontImageNotFound);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
850 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
851 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
852
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
853 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] font: %s (#%d)\n", fnt, fntFindID(fnt));
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
854
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
855 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
856 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
857
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
858 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
859 * @brief Parse a @a slabel definition.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
860 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
861 * Syntax: slabel=x,y,fontfile,"text"
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
862 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
863 * @param in definition to be analyzed
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
864 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
865 * @return 0 (ok) or 1 (error)
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
866 */
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
867 static int item_slabel(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
868 {
33094
2faf1c3ded5d Cosmetic: Rearrange variable declarations to match parameters.
ib
parents: 33093
diff changeset
869 int x, y, id;
33090
db699b367260 Reduce resp. increase arrays to reasonable size.
ib
parents: 33089
diff changeset
870 char fnt[256];
33094
2faf1c3ded5d Cosmetic: Rearrange variable declarations to match parameters.
ib
parents: 33093
diff changeset
871 char txt[256];
35688
6fd886ce32b9 Cosmetic: Rename wItem guiItem.
ib
parents: 35662
diff changeset
872 guiItem *item;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
873
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
874 if (!window_item("slabel"))
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
875 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
876
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34578
diff changeset
877 if (in_window("video"))
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
878 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
879 if (in_window("menu"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
880 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
881
36991
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
882 x = cutInt(in, ',', 0);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
883 y = cutInt(in, ',', 1);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
884 cutStr(in, fnt, ',', 2);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
885 cutStr(in, txt, ',', 3);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
886 cutStr(txt, txt, '"', 1);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
887
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
888 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] slabel: \"%s\"\n", txt);
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
889 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] pos: %d,%d\n", x, y);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
890
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
891 id = fntFindID(fnt);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
892
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
893 if (id < 0) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
894 skin_error(MSGTR_GUI_MSG_SkinFontNotFound, fnt);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
895 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
896 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
897
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
898 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] font: %s (#%d)\n", fnt, id);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
899
33098
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
900 item = next_item();
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
901
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
902 if (!item)
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
903 return 1;
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
904
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
905 item->type = itSLabel;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
906 item->x = x;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
907 item->y = y;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
908 item->width = -1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
909 item->height = -1;
33101
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
910 item->fontid = id;
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
911 item->label = strdup(txt);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
912
32979
4905f5a87357 Replace some awkward and unnecessary usages of strlen().
ib
parents: 32958
diff changeset
913 if (!item->label) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
914 skin_error(MSGTR_GUI_MSG_SkinMemoryError);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
915 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
916 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
917
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
918 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
919 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
920
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
921 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
922 * @brief Parse a @a dlabel definition.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
923 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
924 * Syntax: dlabel=x,y,width,align,fontfile,"text"
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
925 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
926 * @param in definition to be analyzed
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
927 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
928 * @return 0 (ok) or 1 (error)
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
929 */
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
930 static int item_dlabel(char *in)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
931 {
33094
2faf1c3ded5d Cosmetic: Rearrange variable declarations to match parameters.
ib
parents: 33093
diff changeset
932 int x, y, w, a, id;
33090
db699b367260 Reduce resp. increase arrays to reasonable size.
ib
parents: 33089
diff changeset
933 char fnt[256];
33094
2faf1c3ded5d Cosmetic: Rearrange variable declarations to match parameters.
ib
parents: 33093
diff changeset
934 char txt[256];
35688
6fd886ce32b9 Cosmetic: Rename wItem guiItem.
ib
parents: 35662
diff changeset
935 guiItem *item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
936
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
937 if (!window_item("dlabel"))
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
938 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
939
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34578
diff changeset
940 if (in_window("video"))
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
941 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
942 if (in_window("menu"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
943 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
944
36991
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
945 x = cutInt(in, ',', 0);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
946 y = cutInt(in, ',', 1);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
947 w = cutInt(in, ',', 2);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
948 a = cutInt(in, ',', 3);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
949 cutStr(in, fnt, ',', 4);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
950 cutStr(in, txt, ',', 5);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
951 cutStr(txt, txt, '"', 1);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
952
36891
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
953 // legacy
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
954 skin_legacy("$l", txt);
c5ee0fc2ec75 Print an information on deprecated skin config file entries.
ib
parents: 36876
diff changeset
955
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
956 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] dlabel: \"%s\"\n", txt);
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
957 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] pos: %d,%d\n", x, y);
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
958 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] width: %d, align: %d\n", w, a);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
959
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
960 id = fntFindID(fnt);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
961
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
962 if (id < 0) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
963 skin_error(MSGTR_GUI_MSG_SkinFontNotFound, fnt);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
964 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
965 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
966
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
967 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] font: %s (#%d)\n", fnt, id);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
968
33098
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
969 item = next_item();
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
970
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
971 if (!item)
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
972 return 1;
b61dff4c9a35 Prevent an out-of-bounds array access.
ib
parents: 33097
diff changeset
973
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
974 item->type = itDLabel;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
975 item->x = x;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
976 item->y = y;
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
977 item->width = w;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
978 item->height = -1;
33101
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
979 item->fontid = id;
930338bde973 Order member assignments according to their definition in the structure.
ib
parents: 33100
diff changeset
980 item->align = a;
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
981 item->label = strdup(txt);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
982
32979
4905f5a87357 Replace some awkward and unnecessary usages of strlen().
ib
parents: 32958
diff changeset
983 if (!item->label) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
984 skin_error(MSGTR_GUI_MSG_SkinMemoryError);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
985 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
986 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
987
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
988 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
989 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
990
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
991 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
992 * @brief Parse a @a decoration definition.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
993 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
994 * Syntax: decoration=enable|disable
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
995 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
996 * @param in definition to be analyzed
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
997 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
998 * @return 0 (ok) or 1 (error)
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
999 */
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
1000 static int item_decoration(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1001 {
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
1002 if (!window_item("decoration"))
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
1003 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1004
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34578
diff changeset
1005 if (in_window("video"))
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
1006 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
1007 if (in_window("playbar"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
1008 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
1009 if (in_window("menu"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
1010 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1011
33086
1b9f989855f3 Remove needless variable.
ib
parents: 33084
diff changeset
1012 strlower(in);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1013
33086
1b9f989855f3 Remove needless variable.
ib
parents: 33084
diff changeset
1014 if (strcmp(in, "enable") != 0 && strcmp(in, "disable") != 0) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
1015 skin_error(MSGTR_GUI_MSG_SkinUnknownParameter, in);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1016 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1017 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1018
33087
ca17f301336d Simplify parameter analysis.
ib
parents: 33086
diff changeset
1019 skin->mainDecoration = (strcmp(in, "enable") == 0);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1020
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
1021 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] decoration: %s\n", in);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1022
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1023 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1024 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1025
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1026 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1027 * @brief Parsing functions responsible for skin item definitions.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1028 */
32878
afa6f80b0867 Limit scope of internally used skinItem array.
ib
parents: 32877
diff changeset
1029 static _item skinItem[] = {
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
1030 { "background", item_background },
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
1031 { "base", item_base },
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
1032 { "button", item_button },
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
1033 { "decoration", item_decoration },
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
1034 { "dlabel", item_dlabel },
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
1035 { "end", item_end },
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
1036 { "font", item_font },
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
1037 { "hpotmeter", item_hpotmeter },
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
1038 { "menu", item_menu },
36920
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36892
diff changeset
1039 { "pimage", item_pimage },
36892
f50427ad9ff6 Internally map item 'potmeter' onto 'hpotmeter'.
ib
parents: 36891
diff changeset
1040 { "potmeter", item_potmeter }, // legacy
33106
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
1041 { "section", item_section },
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
1042 { "selected", item_selected },
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
1043 { "slabel", item_slabel },
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
1044 { "vpotmeter", item_vpotmeter },
e9e5ee3a1a82 Cosmetic: Rename cmd functions item.
ib
parents: 33105
diff changeset
1045 { "window", item_window }
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1046 };
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1047
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1048 /**
35662
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1049 * @brief Read a skin @a image file.
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1050 *
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1051 * @param fname filename (with path)
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1052 * @param img pointer suitable to store the image data
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1053 *
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1054 * @return return code of #bpRead()
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1055 */
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1056 int skinImageRead(char *fname, guiImage *img)
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1057 {
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1058 int i = bpRead(fname, img);
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1059
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1060 switch (i) {
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1061 case -1:
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
1062 skin_error(MSGTR_GUI_MSG_SkinErrorBitmap16Bit, fname);
35662
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1063 break;
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1064
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1065 case -2:
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
1066 skin_error(MSGTR_GUI_MSG_SkinBitmapNotFound, fname);
35662
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1067 break;
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1068
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1069 case -5:
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
1070 skin_error(MSGTR_GUI_MSG_SkinBitmapPngReadError, fname);
35662
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1071 break;
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1072
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1073 case -8:
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
1074 skin_error(MSGTR_GUI_MSG_SkinBitmapConversionError, fname);
35662
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1075 break;
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1076 }
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1077
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1078 return i;
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1079 }
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1080
782461b26312 Relocate some functions.
ib
parents: 35529
diff changeset
1081 /**
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1082 * @brief Build the skin file path for a skin name.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1083 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1084 * @param dir skins directory
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1085 * @param sname name of the skin
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1086 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1087 * @return skin file path
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1088 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1089 * @note As a side effect, variable #path gets set to the skin path.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1090 */
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
1091 static char *setname(char *dir, char *sname)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1092 {
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
1093 static char skinfname[512];
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1094
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
1095 av_strlcpy(skinfname, dir, sizeof(skinfname));
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
1096 av_strlcat(skinfname, "/", sizeof(skinfname));
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
1097 av_strlcat(skinfname, sname, sizeof(skinfname));
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
1098 av_strlcat(skinfname, "/", sizeof(skinfname));
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
1099 av_strlcpy(path, skinfname, sizeof(path));
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
1100 av_strlcat(skinfname, "skin", sizeof(skinfname));
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1101
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
1102 return skinfname;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1103 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1104
33968
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1105 /**
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1106 * @brief Read and parse a skin.
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1107 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1108 * @param sname name of the skin
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1109 *
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1110 * @return 0 (ok), -1 (skin file not found or not readable) or -2 (parsing error)
253620911a2e Add doxygen comments to skin.c.
ib
parents: 33749
diff changeset
1111 */
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
1112 int skinRead(char *sname)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1113 {
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
1114 char *skinfname;
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34560
diff changeset
1115 FILE *skinfile;
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
1116 unsigned char line[256];
33075
c7cfa1a653c8 Cosmetic: Rename command item.
ib
parents: 33073
diff changeset
1117 unsigned char item[32];
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1118 unsigned char param[256];
32944
27a98940e3aa Use FF_ARRAY_ELEMS() rather than a separate constant.
ib
parents: 32937
diff changeset
1119 unsigned int i;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1120
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
1121 skinfname = setname(skinDirInHome, sname);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1122
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34560
diff changeset
1123 if ((skinfile = fopen(skinfname, "rt")) == NULL) {
36043
40c13df3d953 Cosmetic: Rename variables (consistently).
ib
parents: 36032
diff changeset
1124 skinfname = setname(skinDirInData, sname);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1125
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34560
diff changeset
1126 if ((skinfile = fopen(skinfname, "rt")) == NULL) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
1127 mp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_GUI_MSG_SkinFileNotFound, skinfname);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1128 return -1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1129 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1130 }
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1131
33985
d99f341d8442 Replace all mp_dbg() calls by mp_msg().
ib
parents: 33972
diff changeset
1132 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin] configuration file: %s\n", skinfname);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1133
32932
e95ec1b2feea Cosmetic: Rename appInitStruct() to appFreeStruct().
ib
parents: 32931
diff changeset
1134 appFreeStruct();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1135
33078
c84938655cf4 Reset skin pointer and window name.
ib
parents: 33077
diff changeset
1136 skin = NULL;
c84938655cf4 Reset skin pointer and window name.
ib
parents: 33077
diff changeset
1137 currWinName[0] = 0;
33079
25c467321c98 Cosmetic: Adjust indent.
ib
parents: 33078
diff changeset
1138 linenumber = 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1139
34578
948bec0f8df3 Cosmetic: Change some variable names.
ib
parents: 34560
diff changeset
1140 while (fgetstr(line, sizeof(line), skinfile)) {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1141 linenumber++;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1142
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
1143 strswap(line, '\t', ' ');
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
1144 trim(line);
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
1145 decomment(line);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1146
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
1147 if (!*line)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1148 continue;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1149
36991
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
1150 cutStr(line, item, '=', 0);
fa8b6892b0bf Cosmetic: Rename cut functions.
ib
parents: 36989
diff changeset
1151 cutStr(line, param, '=', 1);
33075
c7cfa1a653c8 Cosmetic: Rename command item.
ib
parents: 33073
diff changeset
1152 strlower(item);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1153
33076
27999e9c1b3f Leave loop after item function has been found and called.
ib
parents: 33075
diff changeset
1154 for (i = 0; i < FF_ARRAY_ELEMS(skinItem); i++) {
27999e9c1b3f Leave loop after item function has been found and called.
ib
parents: 33075
diff changeset
1155 if (!strcmp(item, skinItem[i].name)) {
35360
a3e8af09792d Close the skin file after reading.
ib
parents: 34698
diff changeset
1156 if (skinItem[i].func(param) != 0) {
a3e8af09792d Close the skin file after reading.
ib
parents: 34698
diff changeset
1157 fclose(skinfile);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1158 return -2;
35360
a3e8af09792d Close the skin file after reading.
ib
parents: 34698
diff changeset
1159 } else
33076
27999e9c1b3f Leave loop after item function has been found and called.
ib
parents: 33075
diff changeset
1160 break;
27999e9c1b3f Leave loop after item function has been found and called.
ib
parents: 33075
diff changeset
1161 }
27999e9c1b3f Leave loop after item function has been found and called.
ib
parents: 33075
diff changeset
1162 }
33077
706f36627399 Add a check for unknown items.
ib
parents: 33076
diff changeset
1163
706f36627399 Add a check for unknown items.
ib
parents: 33076
diff changeset
1164 if (i == FF_ARRAY_ELEMS(skinItem)) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
1165 skin_error(MSGTR_GUI_MSG_SkinUnknownItem, item);
35360
a3e8af09792d Close the skin file after reading.
ib
parents: 34698
diff changeset
1166 fclose(skinfile);
33077
706f36627399 Add a check for unknown items.
ib
parents: 33076
diff changeset
1167 return -2;
706f36627399 Add a check for unknown items.
ib
parents: 33076
diff changeset
1168 }
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1169 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1170
35360
a3e8af09792d Close the skin file after reading.
ib
parents: 34698
diff changeset
1171 fclose(skinfile);
a3e8af09792d Close the skin file after reading.
ib
parents: 34698
diff changeset
1172
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1173 if (linenumber == 0) {
36694
eed2fb870f43 Rename symbolic constants of GUI help message texts.
ib
parents: 36043
diff changeset
1174 mp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_GUI_MSG_SkinFileNotReadable, skinfname);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1175 return -1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1176 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1177
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
1178 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1179 }