annotate gui/skin/skin.c @ 33096:ca1a01b56c90

Avoid using skin pointer. During the further processing of the skin use currWin pointer instead.
author ib
date Fri, 01 Apr 2011 13:59:50 +0000
parents 772af04413f3
children 533c658a18da
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
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
19 #include <stdio.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
20 #include <string.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
21
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
22 #include "skin.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
23 #include "font.h"
32893
c873777e957d Get rid of needless listItems variable and pointer.
ib
parents: 32880
diff changeset
24 #include "gui/app.h"
33023
ba432e34dc7e Add message showing function.
ib
parents: 33022
diff changeset
25 #include "gui/interface.h"
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
26 #include "gui/mplayer/widgets.h"
33046
9684ad0e1291 Move files with auxiliary functions to own directory.
ib
parents: 33023
diff changeset
27 #include "gui/util/cut.h"
33048
c6d0adf896ea Move auxiliary string functions into separate file.
ib
parents: 33046
diff changeset
28 #include "gui/util/string.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
29
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
30 #include "config.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
31 #include "help_mp.h"
23703
9fb716ab06a3 Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents: 23077
diff changeset
32 #include "libavutil/avstring.h"
32944
27a98940e3aa Use FF_ARRAY_ELEMS() rather than a separate constant.
ib
parents: 32937
diff changeset
33 #include "libavutil/common.h"
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
34 #include "mp_msg.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
35
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
36 typedef struct {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
37 const char *name;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
38 int (*func)(char *in);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
39 } _item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
40
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
41 static guiItems *skin;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
42
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
43 static int linenumber;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
44 static unsigned char path[512];
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
45
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
46 static unsigned char currWinName[32];
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
47 static wItem *currWin;
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
48 static int *currWinItemIdx;
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
49 static wItem *currWinItems;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
50
33022
9abc0dbd6314 Cosmetic: Rename ERRORMESSAGE() skin_error().
ib
parents: 32980
diff changeset
51 static void skin_error(const char *format, ...)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
52 {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
53 char p[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
54 va_list ap;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
55
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
56 va_start(ap, format);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
57 vsnprintf(p, sizeof(p), format, ap);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
58 va_end(ap);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
59
33023
ba432e34dc7e Add message showing function.
ib
parents: 33022
diff changeset
60 gmp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_SKIN_ERRORMESSAGE, linenumber, p);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
61 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
62
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
63 static int section_cmd(char *cmd)
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
64 {
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
65 if (!skin) {
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
66 skin_error(MSGTR_SKIN_ERROR_SECTION, cmd);
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
67 return 0;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
68 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
69
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
70 return 1;
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
71 }
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
72
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
73 static int window_cmd(char *cmd)
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
74 {
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
75 if (!currWinName[0]) {
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
76 skin_error(MSGTR_SKIN_ERROR_WINDOW, cmd);
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
77 return 0;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
78 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
79
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
80 return 1;
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
81 }
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
82
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
83 static int in_window(char *name)
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
84 {
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
85 if (strcmp(currWinName, name) == 0) {
33062
be0848508395 Cosmetic: Rename error message.
ib
parents: 33059
diff changeset
86 skin_error(MSGTR_SKIN_ERROR_ITEM, name);
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
87 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
88 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
89
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
90 return 0;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
91 }
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
92
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
93 int skinBPRead(char *fname, txSample *bf)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
94 {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
95 int i = bpRead(fname, bf);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
96
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
97 switch (i) {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
98 case -1:
33022
9abc0dbd6314 Cosmetic: Rename ERRORMESSAGE() skin_error().
ib
parents: 32980
diff changeset
99 skin_error(MSGTR_SKIN_BITMAP_16bit, fname);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
100 break;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
101
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
102 case -2:
33022
9abc0dbd6314 Cosmetic: Rename ERRORMESSAGE() skin_error().
ib
parents: 32980
diff changeset
103 skin_error(MSGTR_SKIN_BITMAP_FileNotFound, fname);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
104 break;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
105
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
106 case -5:
33022
9abc0dbd6314 Cosmetic: Rename ERRORMESSAGE() skin_error().
ib
parents: 32980
diff changeset
107 skin_error(MSGTR_SKIN_BITMAP_PNGReadError, fname);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
108 break;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
109
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
110 case -8:
33022
9abc0dbd6314 Cosmetic: Rename ERRORMESSAGE() skin_error().
ib
parents: 32980
diff changeset
111 skin_error(MSGTR_SKIN_BITMAP_ConversionError, fname);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
112 break;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
113 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
114
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
115 return i;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
116 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
117
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
118 // section=movieplayer
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
119 static int cmd_section(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
120 {
33064
33d307c4430c Add error check.
ib
parents: 33063
diff changeset
121 if (skin) {
33d307c4430c Add error check.
ib
parents: 33063
diff changeset
122 skin_error(MSGTR_SKIN_ERROR_ITEM, "section");
33d307c4430c Add error check.
ib
parents: 33063
diff changeset
123 return 1;
33d307c4430c Add error check.
ib
parents: 33063
diff changeset
124 }
33d307c4430c Add error check.
ib
parents: 33063
diff changeset
125
33055
2be86f1db767 Make use of return value of strlower().
ib
parents: 33054
diff changeset
126 if (!strcmp(strlower(in), "movieplayer"))
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
127 skin = &appMPlayer;
33067
2d0058f30a6b Issue error message in case of wrong section name.
ib
parents: 33066
diff changeset
128 else {
2d0058f30a6b Issue error message in case of wrong section name.
ib
parents: 33066
diff changeset
129 skin_error(MSGTR_SKIN_UNKNOWN_NAME, in);
2d0058f30a6b Issue error message in case of wrong section name.
ib
parents: 33066
diff changeset
130 return 1;
2d0058f30a6b Issue error message in case of wrong section name.
ib
parents: 33066
diff changeset
131 }
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
132
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
133 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] section: %s\n", in);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
134
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
135 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
136 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
137
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
138 // end
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
139 static int cmd_end(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
140 {
32958
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
141 #ifdef MP_DEBUG
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
142 char *space, *name;
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
143
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
144 if (currWinName[0]) {
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
145 space = " ";
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
146 name = currWinName;
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
147 } else {
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
148 space = "";
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
149 name = "section";
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
150 }
32958
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
151 #endif
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
152
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
153 (void)in;
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
154
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
155 if (!section_cmd("end"))
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
156 return 1;
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
157
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
158 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] %send (%s)\n", space, name);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
159
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
160 if (currWinName[0]) {
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
161 currWinName[0] = 0;
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
162 currWin = NULL;
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
163 currWinItemIdx = NULL;
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
164 currWinItems = NULL;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
165 } else
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
166 skin = NULL;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
167
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
168 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
169 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
170
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
171 // window=main|sub|playbar|menu
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
172 static int cmd_window(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
173 {
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
174 if (!section_cmd("window"))
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
175 return 1;
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
176
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
177 if (currWinName[0]) {
33062
be0848508395 Cosmetic: Rename error message.
ib
parents: 33059
diff changeset
178 skin_error(MSGTR_SKIN_ERROR_ITEM, "window");
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
179 return 1;
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
180 }
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
181
33083
8c96263e0f09 Clean up cmd_window().
ib
parents: 33081
diff changeset
182 strlower(in);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
183
33083
8c96263e0f09 Clean up cmd_window().
ib
parents: 33081
diff changeset
184 if (strcmp(in, "main") == 0) {
33095
772af04413f3 Avoid using appMPlayer.
ib
parents: 33094
diff changeset
185 currWin = &skin->main;
772af04413f3 Avoid using appMPlayer.
ib
parents: 33094
diff changeset
186 currWinItemIdx = &skin->IndexOfMainItems;
772af04413f3 Avoid using appMPlayer.
ib
parents: 33094
diff changeset
187 currWinItems = skin->mainItems;
33083
8c96263e0f09 Clean up cmd_window().
ib
parents: 33081
diff changeset
188 } else if (strcmp(in, "sub") == 0) {
33095
772af04413f3 Avoid using appMPlayer.
ib
parents: 33094
diff changeset
189 currWin = &skin->sub;
33083
8c96263e0f09 Clean up cmd_window().
ib
parents: 33081
diff changeset
190 currWinItemIdx = NULL;
8c96263e0f09 Clean up cmd_window().
ib
parents: 33081
diff changeset
191 currWinItems = NULL;
8c96263e0f09 Clean up cmd_window().
ib
parents: 33081
diff changeset
192 } else if (strcmp(in, "playbar") == 0) {
33095
772af04413f3 Avoid using appMPlayer.
ib
parents: 33094
diff changeset
193 currWin = &skin->bar;
772af04413f3 Avoid using appMPlayer.
ib
parents: 33094
diff changeset
194 currWinItemIdx = &skin->IndexOfBarItems;
772af04413f3 Avoid using appMPlayer.
ib
parents: 33094
diff changeset
195 currWinItems = skin->barItems;
33083
8c96263e0f09 Clean up cmd_window().
ib
parents: 33081
diff changeset
196 } else if (strcmp(in, "menu") == 0) {
33095
772af04413f3 Avoid using appMPlayer.
ib
parents: 33094
diff changeset
197 currWin = &skin->menu;
772af04413f3 Avoid using appMPlayer.
ib
parents: 33094
diff changeset
198 currWinItemIdx = &skin->IndexOfMenuItems;
772af04413f3 Avoid using appMPlayer.
ib
parents: 33094
diff changeset
199 currWinItems = skin->menuItems;
33066
fd4d66a6add6 Don't start GUI in case of window name error.
ib
parents: 33065
diff changeset
200 } else {
33065
83c226105086 Rename and revise error message.
ib
parents: 33064
diff changeset
201 skin_error(MSGTR_SKIN_UNKNOWN_NAME, in);
33066
fd4d66a6add6 Don't start GUI in case of window name error.
ib
parents: 33065
diff changeset
202 return 1;
fd4d66a6add6 Don't start GUI in case of window name error.
ib
parents: 33065
diff changeset
203 }
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
204
33083
8c96263e0f09 Clean up cmd_window().
ib
parents: 33081
diff changeset
205 av_strlcpy(currWinName, in, sizeof(currWinName));
8c96263e0f09 Clean up cmd_window().
ib
parents: 33081
diff changeset
206
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
207 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] window: %s\n", currWinName);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
208
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
209 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
210 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
211
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
212 // base=image,x,y[,width,height]
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
213 static int cmd_base(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
214 {
33090
db699b367260 Reduce resp. increase arrays to reasonable size.
ib
parents: 33089
diff changeset
215 unsigned char fname[256];
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
216 unsigned char file[512];
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
217 int x, y;
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
218 int w = 0, h = 0;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
219
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
220 if (!window_cmd("base"))
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
221 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
222
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
223 cutItem(in, fname, ',', 0);
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
224 x = cutItemToInt(in, ',', 1);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
225 y = cutItemToInt(in, ',', 2);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
226 w = cutItemToInt(in, ',', 3);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
227 h = cutItemToInt(in, ',', 4);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
228
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
229 if (!strcmp(currWinName, "main")) {
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
230 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] image: %s %d,%d\n", fname, x, y);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
231
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
232 currWin->x = x;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
233 currWin->y = y;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
234 currWin->type = itBase;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
235
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
236 av_strlcpy(file, path, sizeof(file));
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
237 av_strlcat(file, fname, sizeof(file));
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
238
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
239 if (skinBPRead(file, &currWin->Bitmap) != 0)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
240 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
241
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
242 currWin->width = currWin->Bitmap.Width;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
243 currWin->height = currWin->Bitmap.Height;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
244
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
245 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] bitmap: %dx%d\n", currWin->width, currWin->height);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
246
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26458
diff changeset
247 #ifdef CONFIG_XSHAPE
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
248 Convert32to1(&currWin->Bitmap, &currWin->Mask, 0x00ff00ff);
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
249 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] mask: %lux%lu\n", currWin->Mask.Width, currWin->Mask.Height);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
250 #else
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
251 currWin->Mask.Image = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
252 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
253 }
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
254
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
255 if (!strcmp(currWinName, "sub")) {
32958
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
256 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] image: %s %d,%d\n", fname, x, y);
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
257
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
258 currWin->type = itBase;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
259
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
260 av_strlcpy(file, path, sizeof(file));
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
261 av_strlcat(file, fname, sizeof(file));
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
262
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
263 if (skinBPRead(file, &currWin->Bitmap) != 0)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
264 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
265
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
266 currWin->x = x;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
267 currWin->y = y;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
268 currWin->width = currWin->Bitmap.Width;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
269 currWin->height = currWin->Bitmap.Height;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
270
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
271 if (w && h) {
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
272 currWin->width = w;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
273 currWin->height = h;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
274 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
275
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
276 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] bitmap: %dx%d\n", currWin->width, currWin->height);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
277 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
278
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
279 if (!strcmp(currWinName, "menu")) {
32958
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
280 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] image: %s\n", fname);
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
281
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
282 skin->menuIsPresent = 1;
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
283 currWin->type = itBase;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
284
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
285 av_strlcpy(file, path, sizeof(file));
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
286 av_strlcat(file, fname, sizeof(file));
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
287
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
288 if (skinBPRead(file, &currWin->Bitmap) != 0)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
289 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
290
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
291 currWin->width = currWin->Bitmap.Width;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
292 currWin->height = currWin->Bitmap.Height;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
293
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
294 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] bitmap: %dx%d\n", currWin->width, currWin->height);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
295
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26458
diff changeset
296 #ifdef CONFIG_XSHAPE
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
297 Convert32to1(&currWin->Bitmap, &currWin->Mask, 0x00ff00ff);
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
298 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] mask: %lux%lu\n", currWin->Mask.Width, currWin->Mask.Height);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
299 #else
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
300 currWin->Mask.Image = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
301 #endif
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
302 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
303
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
304 if (!strcmp(currWinName, "playbar")) {
32958
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
305 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] image: %s %d,%d\n", fname, x, y);
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
306
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
307 skin->barIsPresent = 1;
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
308 currWin->x = x;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
309 currWin->y = y;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
310 currWin->type = itBase;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
311
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
312 av_strlcpy(file, path, sizeof(file));
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
313 av_strlcat(file, fname, sizeof(file));
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
314
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
315 if (skinBPRead(file, &currWin->Bitmap) != 0)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
316 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
317
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
318 currWin->width = currWin->Bitmap.Width;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
319 currWin->height = currWin->Bitmap.Height;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
320
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
321 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] bitmap: %dx%d\n", currWin->width, currWin->height);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
322
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26458
diff changeset
323 #ifdef CONFIG_XSHAPE
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
324 Convert32to1(&currWin->Bitmap, &currWin->Mask, 0x00ff00ff);
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
325 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] mask: %lux%lu\n", currWin->Mask.Width, currWin->Mask.Height);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
326 #else
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
327 currWin->Mask.Image = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
328 #endif
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
329 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
330
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
331 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
332 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
333
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
334 // background=R,G,B
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
335 static int cmd_background(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
336 {
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
337 if (!window_cmd("background"))
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
338 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
339
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
340 if (in_window("main"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
341 return 1;
33088
babdacb1ceac Disable background definition for playbar.
ib
parents: 33087
diff changeset
342 if (in_window("playbar"))
babdacb1ceac Disable background definition for playbar.
ib
parents: 33087
diff changeset
343 return 1;
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
344 if (in_window("menu"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
345 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
346
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
347 currWin->R = cutItemToInt(in, ',', 0);
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
348 currWin->G = cutItemToInt(in, ',', 1);
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
349 currWin->B = cutItemToInt(in, ',', 2);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
350
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
351 mp_dbg(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
352
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
353 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
354 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
355
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
356 // button=image,x,y,width,height,message
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
357 static int cmd_button(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
358 {
33090
db699b367260 Reduce resp. increase arrays to reasonable size.
ib
parents: 33089
diff changeset
359 unsigned char fname[256];
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
360 unsigned char file[512];
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
361 int x, y, w, h, message;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
362 char msg[32];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
363
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
364 if (!window_cmd("button"))
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
365 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
366
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
367 if (in_window("sub"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
368 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
369 if (in_window("menu"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
370 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
371
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
372 cutItem(in, fname, ',', 0);
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
373 x = cutItemToInt(in, ',', 1);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
374 y = cutItemToInt(in, ',', 2);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
375 w = cutItemToInt(in, ',', 3);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
376 h = cutItemToInt(in, ',', 4);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
377 cutItem(in, msg, ',', 5);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
378
33071
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
379 message = appFindMessage(msg);
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
380
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
381 if (message == -1) {
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
382 skin_error(MSGTR_SKIN_UnknownMessage, msg);
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
383 return 1;
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
384 }
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
385
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
386 (*currWinItemIdx)++;
33072
036e8492be61 Cosmetic: Adjust indent.
ib
parents: 33071
diff changeset
387 currWinItems[*currWinItemIdx].type = itButton;
036e8492be61 Cosmetic: Adjust indent.
ib
parents: 33071
diff changeset
388 currWinItems[*currWinItemIdx].x = x;
036e8492be61 Cosmetic: Adjust indent.
ib
parents: 33071
diff changeset
389 currWinItems[*currWinItemIdx].y = y;
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
390 currWinItems[*currWinItemIdx].width = w;
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
391 currWinItems[*currWinItemIdx].height = h;
33071
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
392 currWinItems[*currWinItemIdx].message = message;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
393
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
394 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] button image: %s %d,%d\n", fname, x, y);
33071
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
395 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %s (#%d)\n", msg, message);
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
396 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] size: %dx%d\n", w, h);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
397
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
398 currWinItems[*currWinItemIdx].pressed = btnReleased;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
399
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
400 if (currWinItems[*currWinItemIdx].message == evPauseSwitchToPlay)
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
401 currWinItems[*currWinItemIdx].pressed = btnDisabled;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
402
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
403 currWinItems[*currWinItemIdx].tmp = 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
404
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
405 currWinItems[*currWinItemIdx].Bitmap.Image = NULL;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
406
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
407 if (strcmp(fname, "NULL") != 0) {
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
408 av_strlcpy(file, path, sizeof(file));
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
409 av_strlcat(file, fname, sizeof(file));
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
410
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
411 if (skinBPRead(file, &currWinItems[*currWinItemIdx].Bitmap) != 0)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
412 return 1;
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
413
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
414 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] (bitmap: %lux%lu)\n", currWinItems[*currWinItemIdx].Bitmap.Width, currWinItems[*currWinItemIdx].Bitmap.Height);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
415 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
416
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
417 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
418 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
419
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
420 // selected=image
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
421 static int cmd_selected(char *in)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
422 {
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
423 unsigned char file[512];
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
424 wItem *currItem;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
425
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
426 if (!window_cmd("selected"))
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
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
429 if (in_window("main"))
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("sub"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
432 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
433 if (in_window("playbar"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
434 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
435
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
436 currItem = &skin->menuSelected;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
437 currItem->type = itBase;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
438
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
439 av_strlcpy(file, path, sizeof(file));
33091
6ce0b74d03b7 Remove needless variable.
ib
parents: 33090
diff changeset
440 av_strlcat(file, in, sizeof(file));
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
441
33091
6ce0b74d03b7 Remove needless variable.
ib
parents: 33090
diff changeset
442 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] image selected: %s\n", in);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
443
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
444 if (skinBPRead(file, &currItem->Bitmap) != 0)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
445 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
446
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
447 currItem->width = currItem->Bitmap.Width;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
448 currItem->height = currItem->Bitmap.Height;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
449
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
450 mp_dbg(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
451
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
452 return 0;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
453 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
454
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
455 // menu=x,y,width,height,message
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
456 static int cmd_menu(char *in)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
457 {
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
458 int x, y, w, h, message;
33071
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
459 char msg[32];
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
460 wItem *item;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
461
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
462 if (!window_cmd("menu"))
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
463 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
464
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
465 if (in_window("main"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
466 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
467 if (in_window("sub"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
468 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
469 if (in_window("playbar"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
470 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
471
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
472 x = cutItemToInt(in, ',', 0);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
473 y = cutItemToInt(in, ',', 1);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
474 w = cutItemToInt(in, ',', 2);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
475 h = cutItemToInt(in, ',', 3);
33071
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
476 cutItem(in, msg, ',', 4);
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
477
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
478 message = appFindMessage(msg);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
479
33071
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
480 if (message == -1) {
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
481 skin_error(MSGTR_SKIN_UnknownMessage, msg);
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
482 return 1;
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
483 }
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
484
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
485 (*currWinItemIdx)++;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
486 item = &currWinItems[*currWinItemIdx];
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
487 item->x = x;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
488 item->y = y;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
489 item->width = w;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
490 item->height = h;
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
491 item->message = message;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
492
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
493 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] item #%d: %d,%d %dx%d\n", *currWinItemIdx, x, y, w, h);
33071
f4895241bdd5 Conform message determination
ib
parents: 33069
diff changeset
494 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %s (#%d)\n", msg, message);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
495
33096
ca1a01b56c90 Avoid using skin pointer.
ib
parents: 33095
diff changeset
496 item->Bitmap.Image = NULL;
33053
f64d41dac10b Cosmetic: Separate return statement with newline.
ib
parents: 33052
diff changeset
497
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
498 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
499 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
500
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
501 // hpotmeter=button,bwidth,bheight,phases,numphases,default,x,y,width,height,message
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
502 static int cmd_hpotmeter(char *in)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
503 {
33090
db699b367260 Reduce resp. increase arrays to reasonable size.
ib
parents: 33089
diff changeset
504 unsigned char pfname[256];
db699b367260 Reduce resp. increase arrays to reasonable size.
ib
parents: 33089
diff changeset
505 unsigned char phfname[256];
33093
3de646fca03b Cosmetic: Rearrange variable declarations to match parameters.
ib
parents: 33092
diff changeset
506 unsigned char buf[512];
3de646fca03b Cosmetic: Rearrange variable declarations to match parameters.
ib
parents: 33092
diff changeset
507 int pwidth, pheight, ph, d, x, y, w, h, message;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
508 wItem *item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
509
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
510 if (!window_cmd("h/v potmeter"))
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
511 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
512
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
513 if (in_window("sub"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
514 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
515 if (in_window("menu"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
516 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
517
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
518 cutItem(in, pfname, ',', 0);
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
519 pwidth = cutItemToInt(in, ',', 1);
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
520 pheight = cutItemToInt(in, ',', 2);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
521 cutItem(in, phfname, ',', 3);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
522 ph = cutItemToInt(in, ',', 4);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
523 d = cutItemToInt(in, ',', 5);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
524 x = cutItemToInt(in, ',', 6);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
525 y = cutItemToInt(in, ',', 7);
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
526 w = cutItemToInt(in, ',', 8);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
527 h = cutItemToInt(in, ',', 9);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
528 cutItem(in, buf, ',', 10);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
529
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
530 message = appFindMessage(buf);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
531
33069
4b7d4905862c Rename error message and add missing checks.
ib
parents: 33067
diff changeset
532 if (message == -1) {
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
533 skin_error(MSGTR_SKIN_UnknownMessage, buf);
33069
4b7d4905862c Rename error message and add missing checks.
ib
parents: 33067
diff changeset
534 return 1;
4b7d4905862c Rename error message and add missing checks.
ib
parents: 33067
diff changeset
535 }
4b7d4905862c Rename error message and add missing checks.
ib
parents: 33067
diff changeset
536
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
537 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] h/v potmeter image: %s %d,%d %dx%d\n", phfname, x, y, w, h);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
538 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] button image: %s %dx%d\n", pfname, pwidth, pheight);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
539 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] numphases: %d, default: %d%%\n", ph, d);
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
540 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %s (#%d)\n", buf, message);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
541
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
542 (*currWinItemIdx)++;
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
543 item = &currWinItems[*currWinItemIdx];
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
544 item->type = itHPotmeter;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
545 item->x = x;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
546 item->y = y;
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
547 item->width = w;
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
548 item->height = h;
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
549 item->numphases = ph;
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
550 item->pwidth = pwidth;
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
551 item->pheight = pheight;
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
552 item->message = message;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
553 item->value = (float)d;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
554 item->pressed = btnReleased;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
555 item->Bitmap.Image = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
556
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
557 if (strcmp(phfname, "NULL") != 0) {
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
558 av_strlcpy(buf, path, sizeof(buf));
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
559 av_strlcat(buf, phfname, sizeof(buf));
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
560
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
561 if (skinBPRead(buf, &item->Bitmap) != 0)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
562 return 1;
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
563
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
564 mp_dbg(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
565 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
566
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
567 item->Mask.Image = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
568
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
569 if (strcmp(pfname, "NULL") != 0) {
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
570 av_strlcpy(buf, path, sizeof(buf));
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
571 av_strlcat(buf, pfname, sizeof(buf));
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
572
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
573 if (skinBPRead(buf, &item->Mask) != 0)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
574 return 1;
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
575
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
576 mp_dbg(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
577 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
578
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
579 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
580 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
581
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
582 // vpotmeter=button,bwidth,bheight,phases,numphases,default,x,y,width,height,message
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
583 static int cmd_vpotmeter(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
584 {
33056
1c2070f0abca Prevent a segmentation fault.
ib
parents: 33055
diff changeset
585 int r;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
586 wItem *item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
587
33056
1c2070f0abca Prevent a segmentation fault.
ib
parents: 33055
diff changeset
588 r = cmd_hpotmeter(in);
1c2070f0abca Prevent a segmentation fault.
ib
parents: 33055
diff changeset
589
1c2070f0abca Prevent a segmentation fault.
ib
parents: 33055
diff changeset
590 if (r == 0) {
33057
0d6b33bc311e Cosmetic: Adjust indent.
ib
parents: 33056
diff changeset
591 item = &currWinItems[*currWinItemIdx];
0d6b33bc311e Cosmetic: Adjust indent.
ib
parents: 33056
diff changeset
592 item->type = itVPotmeter;
33056
1c2070f0abca Prevent a segmentation fault.
ib
parents: 33055
diff changeset
593 }
33053
f64d41dac10b Cosmetic: Separate return statement with newline.
ib
parents: 33052
diff changeset
594
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
595 return r;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
596 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
597
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
598 // potmeter=phases,numphases,default,x,y,width,height,message
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
599 static int cmd_potmeter(char *in)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
600 {
33093
3de646fca03b Cosmetic: Rearrange variable declarations to match parameters.
ib
parents: 33092
diff changeset
601 unsigned char phfname[256];
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
602 unsigned char buf[512];
33093
3de646fca03b Cosmetic: Rearrange variable declarations to match parameters.
ib
parents: 33092
diff changeset
603 int ph, d, x, y, w, h, message;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
604 wItem *item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
605
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
606 if (!window_cmd("potmeter"))
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
607 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
608
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
609 if (in_window("sub"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
610 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
611 if (in_window("menu"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
612 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
613
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
614 cutItem(in, phfname, ',', 0);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
615 ph = cutItemToInt(in, ',', 1);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
616 d = cutItemToInt(in, ',', 2);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
617 x = cutItemToInt(in, ',', 3);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
618 y = cutItemToInt(in, ',', 4);
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
619 w = cutItemToInt(in, ',', 5);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
620 h = cutItemToInt(in, ',', 6);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
621 cutItem(in, buf, ',', 7);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
622
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
623 message = appFindMessage(buf);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
624
33069
4b7d4905862c Rename error message and add missing checks.
ib
parents: 33067
diff changeset
625 if (message == -1) {
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
626 skin_error(MSGTR_SKIN_UnknownMessage, buf);
33069
4b7d4905862c Rename error message and add missing checks.
ib
parents: 33067
diff changeset
627 return 1;
4b7d4905862c Rename error message and add missing checks.
ib
parents: 33067
diff changeset
628 }
4b7d4905862c Rename error message and add missing checks.
ib
parents: 33067
diff changeset
629
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
630 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] potmeter image: %s %d,%d %dx%d\n", phfname, x, y, w, h);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
631 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] numphases: %d, default: %d%%\n", ph, d);
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
632 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %s (#%d)\n", buf, message);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
633
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
634 (*currWinItemIdx)++;
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
635 item = &currWinItems[*currWinItemIdx];
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
636 item->type = itPotmeter;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
637 item->x = x;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
638 item->y = y;
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
639 item->width = w;
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
640 item->height = h;
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
641 item->numphases = ph;
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
642 item->message = message;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
643 item->value = (float)d;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
644 item->Bitmap.Image = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
645
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
646 if (strcmp(phfname, "NULL") != 0) {
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
647 av_strlcpy(buf, path, sizeof(buf));
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
648 av_strlcat(buf, phfname, sizeof(buf));
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
649
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
650 if (skinBPRead(buf, &item->Bitmap) != 0)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
651 return 1;
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
652
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
653 mp_dbg(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
654 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
655
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
656 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
657 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
658
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
659 // font=fontfile
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
660 static int cmd_font(char *in)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
661 {
33092
83052a4ac698 Use more appropriate name for variable and reduce it to reasonable size.
ib
parents: 33091
diff changeset
662 char fnt[256];
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
663 wItem *item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
664
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
665 if (!window_cmd("font"))
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
666 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
667
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
668 if (in_window("sub"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
669 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
670 if (in_window("menu"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
671 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
672
33092
83052a4ac698 Use more appropriate name for variable and reduce it to reasonable size.
ib
parents: 33091
diff changeset
673 cutItem(in, fnt, ',', 0); // Note: This seems needless but isn't for compatibility
83052a4ac698 Use more appropriate name for variable and reduce it to reasonable size.
ib
parents: 33091
diff changeset
674 // reasons with a meanwhile depreciated second parameter.
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
675 (*currWinItemIdx)++;
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
676 item = &currWinItems[*currWinItemIdx];
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
677 item->type = itFont;
33092
83052a4ac698 Use more appropriate name for variable and reduce it to reasonable size.
ib
parents: 33091
diff changeset
678 item->fontid = fntRead(path, fnt);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
679
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
680 switch (item->fontid) {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
681 case -1:
33022
9abc0dbd6314 Cosmetic: Rename ERRORMESSAGE() skin_error().
ib
parents: 32980
diff changeset
682 skin_error(MSGTR_SKIN_FONT_NotEnoughtMemory);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
683 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
684
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
685 case -2:
33022
9abc0dbd6314 Cosmetic: Rename ERRORMESSAGE() skin_error().
ib
parents: 32980
diff changeset
686 skin_error(MSGTR_SKIN_FONT_TooManyFontsDeclared);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
687 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
688
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
689 case -3:
33022
9abc0dbd6314 Cosmetic: Rename ERRORMESSAGE() skin_error().
ib
parents: 32980
diff changeset
690 skin_error(MSGTR_SKIN_FONT_FontFileNotFound);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
691 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
692
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
693 case -4:
33022
9abc0dbd6314 Cosmetic: Rename ERRORMESSAGE() skin_error().
ib
parents: 32980
diff changeset
694 skin_error(MSGTR_SKIN_FONT_FontImageNotFound);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
695 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
696 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
697
33092
83052a4ac698 Use more appropriate name for variable and reduce it to reasonable size.
ib
parents: 33091
diff changeset
698 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] font: %s (#%d)\n", fnt, fntFindID(fnt));
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
699
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
700 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
701 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
702
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
703 // slabel=x,y,fontfile,"text"
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
704 static int cmd_slabel(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
705 {
33094
2faf1c3ded5d Cosmetic: Rearrange variable declarations to match parameters.
ib
parents: 33093
diff changeset
706 int x, y, id;
33090
db699b367260 Reduce resp. increase arrays to reasonable size.
ib
parents: 33089
diff changeset
707 char fnt[256];
33094
2faf1c3ded5d Cosmetic: Rearrange variable declarations to match parameters.
ib
parents: 33093
diff changeset
708 char txt[256];
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
709 wItem *item;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
710
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
711 if (!window_cmd("slabel"))
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
712 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
713
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
714 if (in_window("sub"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
715 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
716 if (in_window("menu"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
717 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
718
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
719 x = cutItemToInt(in, ',', 0);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
720 y = cutItemToInt(in, ',', 1);
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
721 cutItem(in, fnt, ',', 2);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
722 cutItem(in, txt, ',', 3);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
723 cutItem(txt, txt, '"', 1);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
724
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
725 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] slabel: \"%s\"\n", txt);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
726 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] pos: %d,%d\n", x, y);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
727
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
728 id = fntFindID(fnt);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
729
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
730 if (id < 0) {
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
731 skin_error(MSGTR_SKIN_FONT_NonExistentFontID, fnt);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
732 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
733 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
734
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
735 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] font: %s (#%d)\n", fnt, id);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
736
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
737 (*currWinItemIdx)++;
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
738 item = &currWinItems[*currWinItemIdx];
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
739 item->type = itSLabel;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
740 item->fontid = id;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
741 item->x = x;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
742 item->y = y;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
743 item->width = -1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
744 item->height = -1;
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
745 item->label = strdup(txt);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
746
32979
4905f5a87357 Replace some awkward and unnecessary usages of strlen().
ib
parents: 32958
diff changeset
747 if (!item->label) {
33022
9abc0dbd6314 Cosmetic: Rename ERRORMESSAGE() skin_error().
ib
parents: 32980
diff changeset
748 skin_error(MSGTR_SKIN_FONT_NotEnoughtMemory);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
749 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
750 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
751
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
752 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
753 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
754
32910
f34e21c5dc2f Improve documentation on dlabel.
ib
parents: 32893
diff changeset
755 // dlabel=x,y,width,align,fontfile,"text"
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
756 static int cmd_dlabel(char *in)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
757 {
33094
2faf1c3ded5d Cosmetic: Rearrange variable declarations to match parameters.
ib
parents: 33093
diff changeset
758 int x, y, w, a, id;
33090
db699b367260 Reduce resp. increase arrays to reasonable size.
ib
parents: 33089
diff changeset
759 char fnt[256];
33094
2faf1c3ded5d Cosmetic: Rearrange variable declarations to match parameters.
ib
parents: 33093
diff changeset
760 char txt[256];
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
761 wItem *item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
762
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
763 if (!window_cmd("dlabel"))
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
764 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
765
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
766 if (in_window("sub"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
767 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
768 if (in_window("menu"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
769 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
770
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
771 x = cutItemToInt(in, ',', 0);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
772 y = cutItemToInt(in, ',', 1);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
773 w = cutItemToInt(in, ',', 2);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
774 a = cutItemToInt(in, ',', 3);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
775 cutItem(in, fnt, ',', 4);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
776 cutItem(in, txt, ',', 5);
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
777 cutItem(txt, txt, '"', 1);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
778
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
779 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] dlabel: \"%s\"\n", txt);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
780 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] pos: %d,%d\n", x, y);
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
781 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] width: %d, align: %d\n", w, a);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
782
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
783 id = fntFindID(fnt);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
784
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
785 if (id < 0) {
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
786 skin_error(MSGTR_SKIN_FONT_NonExistentFontID, fnt);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
787 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
788 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
789
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
790 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] font: %s (#%d)\n", fnt, id);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
791
32980
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
792 (*currWinItemIdx)++;
2bfd000bb789 Cosmetic: Rename pointers handling current window and items.
ib
parents: 32979
diff changeset
793 item = &currWinItems[*currWinItemIdx];
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
794 item->type = itDLabel;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
795 item->fontid = id;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
796 item->align = a;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
797 item->x = x;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
798 item->y = y;
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
799 item->width = w;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
800 item->height = -1;
33089
d22b498bb573 Cosmetic: Use more appropriate variable names.
ib
parents: 33088
diff changeset
801 item->label = strdup(txt);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
802
32979
4905f5a87357 Replace some awkward and unnecessary usages of strlen().
ib
parents: 32958
diff changeset
803 if (!item->label) {
33022
9abc0dbd6314 Cosmetic: Rename ERRORMESSAGE() skin_error().
ib
parents: 32980
diff changeset
804 skin_error(MSGTR_SKIN_FONT_NotEnoughtMemory);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
805 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
806 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
807
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
808 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
809 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
810
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
811 // decoration=enable|disable
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
812 static int cmd_decoration(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
813 {
33054
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
814 if (!window_cmd("decoration"))
ed66afc0b06c Replace macros to check whether a command is allowed by functions.
ib
parents: 33053
diff changeset
815 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
816
33058
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
817 if (in_window("sub"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
818 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
819 if (in_window("playbar"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
820 return 1;
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
821 if (in_window("menu"))
b8374f9dc87b Replace macro by function.
ib
parents: 33057
diff changeset
822 return 1;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
823
33086
1b9f989855f3 Remove needless variable.
ib
parents: 33084
diff changeset
824 strlower(in);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
825
33086
1b9f989855f3 Remove needless variable.
ib
parents: 33084
diff changeset
826 if (strcmp(in, "enable") != 0 && strcmp(in, "disable") != 0) {
1b9f989855f3 Remove needless variable.
ib
parents: 33084
diff changeset
827 skin_error(MSGTR_SKIN_UnknownParameter, in);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
828 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
829 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
830
33087
ca17f301336d Simplify parameter analysis.
ib
parents: 33086
diff changeset
831 skin->mainDecoration = (strcmp(in, "enable") == 0);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
832
33086
1b9f989855f3 Remove needless variable.
ib
parents: 33084
diff changeset
833 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] decoration: %s\n", in);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
834
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
835 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
836 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
837
32878
afa6f80b0867 Limit scope of internally used skinItem array.
ib
parents: 32877
diff changeset
838 static _item skinItem[] = {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
839 { "section", cmd_section },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
840 { "end", cmd_end },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
841 { "window", cmd_window },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
842 { "base", cmd_base },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
843 { "button", cmd_button },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
844 { "selected", cmd_selected },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
845 { "background", cmd_background },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
846 { "vpotmeter", cmd_vpotmeter },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
847 { "hpotmeter", cmd_hpotmeter },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
848 { "potmeter", cmd_potmeter },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
849 { "font", cmd_font },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
850 { "slabel", cmd_slabel },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
851 { "dlabel", cmd_dlabel },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
852 { "decoration", cmd_decoration },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
853 { "menu", cmd_menu }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
854 };
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
855
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
856 static char *setname(char *dir, char *sname)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
857 {
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
858 static char skinfname[512];
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
859
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
860 av_strlcpy(skinfname, dir, sizeof(skinfname));
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
861 av_strlcat(skinfname, "/", sizeof(skinfname));
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
862 av_strlcat(skinfname, sname, sizeof(skinfname));
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
863 av_strlcat(skinfname, "/", sizeof(skinfname));
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
864 av_strlcpy(path, skinfname, sizeof(path));
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
865 av_strlcat(skinfname, "skin", sizeof(skinfname));
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
866
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
867 return skinfname;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
868 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
869
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
870 int skinRead(char *sname)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
871 {
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
872 char *skinfname;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
873 FILE *skinFile;
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
874 unsigned char line[256];
33075
c7cfa1a653c8 Cosmetic: Rename command item.
ib
parents: 33073
diff changeset
875 unsigned char item[32];
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
876 unsigned char param[256];
32944
27a98940e3aa Use FF_ARRAY_ELEMS() rather than a separate constant.
ib
parents: 32937
diff changeset
877 unsigned int i;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
878
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
879 skinfname = setname(skinDirInHome, sname);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
880
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
881 if ((skinFile = fopen(skinfname, "rt")) == NULL) {
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
882 skinfname = setname(skinMPlayerDir, sname);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
883
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
884 if ((skinFile = fopen(skinfname, "rt")) == NULL) {
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
885 mp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_SKIN_SkinFileNotFound, skinfname);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
886 return -1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
887 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
888 }
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
889
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
890 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] configuration file: %s\n", skinfname);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
891
32932
e95ec1b2feea Cosmetic: Rename appInitStruct() to appFreeStruct().
ib
parents: 32931
diff changeset
892 appFreeStruct();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
893
33078
c84938655cf4 Reset skin pointer and window name.
ib
parents: 33077
diff changeset
894 skin = NULL;
c84938655cf4 Reset skin pointer and window name.
ib
parents: 33077
diff changeset
895 currWinName[0] = 0;
33079
25c467321c98 Cosmetic: Adjust indent.
ib
parents: 33078
diff changeset
896 linenumber = 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
897
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
898 while (fgets(line, sizeof(line), skinFile)) {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
899 linenumber++;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
900
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
901 line[strcspn(line, "\n\r")] = 0; // remove any kind of newline, if any
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
902 strswap(line, '\t', ' ');
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
903 trim(line);
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
904 decomment(line);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
905
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
906 if (!*line)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
907 continue;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
908
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
909 cutItem(line, item, '=', 0);
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
910 cutItem(line, param, '=', 1);
33075
c7cfa1a653c8 Cosmetic: Rename command item.
ib
parents: 33073
diff changeset
911 strlower(item);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
912
33076
27999e9c1b3f Leave loop after item function has been found and called.
ib
parents: 33075
diff changeset
913 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
914 if (!strcmp(item, skinItem[i].name)) {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
915 if (skinItem[i].func(param) != 0)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
916 return -2;
33076
27999e9c1b3f Leave loop after item function has been found and called.
ib
parents: 33075
diff changeset
917 else
27999e9c1b3f Leave loop after item function has been found and called.
ib
parents: 33075
diff changeset
918 break;
27999e9c1b3f Leave loop after item function has been found and called.
ib
parents: 33075
diff changeset
919 }
27999e9c1b3f Leave loop after item function has been found and called.
ib
parents: 33075
diff changeset
920 }
33077
706f36627399 Add a check for unknown items.
ib
parents: 33076
diff changeset
921
706f36627399 Add a check for unknown items.
ib
parents: 33076
diff changeset
922 if (i == FF_ARRAY_ELEMS(skinItem)) {
706f36627399 Add a check for unknown items.
ib
parents: 33076
diff changeset
923 skin_error(MSGTR_SKIN_UNKNOWN_ITEM, item);
706f36627399 Add a check for unknown items.
ib
parents: 33076
diff changeset
924 return -2;
706f36627399 Add a check for unknown items.
ib
parents: 33076
diff changeset
925 }
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
926 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
927
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
928 if (linenumber == 0) {
33081
d217fdc83e63 (Almost entirely) cosmetic: Use more appropriate variable names.
ib
parents: 33079
diff changeset
929 mp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_SKIN_SkinFileNotReadable, skinfname);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
930 return -1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
931 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
932
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
933 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
934 }