annotate gui/skin/skin.c @ 32979:4905f5a87357

Replace some awkward and unnecessary usages of strlen(). 1. A string length of zero or greater than zero can be determined by checking the first byte. 2. Leave it to strdup() to determine the length and to do allocation for a string that is to be copied. 3. If neither the string length nor the index variable is altered in a loop, string[index] (!= 0) is the condition to go with.
author ib
date Thu, 10 Mar 2011 14:20:36 +0000
parents 80087dd00035
children 2bfd000bb789
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 "cut.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
24 #include "font.h"
32893
c873777e957d Get rid of needless listItems variable and pointer.
ib
parents: 32880
diff changeset
25 #include "gui/app.h"
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
26 #include "gui/mplayer/widgets.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
27
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
28 #include "config.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
29 #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
30 #include "libavutil/avstring.h"
32944
27a98940e3aa Use FF_ARRAY_ELEMS() rather than a separate constant.
ib
parents: 32937
diff changeset
31 #include "libavutil/common.h"
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
32 #include "mp_msg.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
33
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
34 typedef struct {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
35 const char *name;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
36 int (*func)(char *in);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
37 } _item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
38
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
39 static guiItems *skin;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
40
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
41 static int linenumber;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
42 static unsigned char path[512];
32875
997208b63159 Remove needless explicit initialization.
ib
parents: 32874
diff changeset
43 static unsigned char window_name[32];
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
44
32875
997208b63159 Remove needless explicit initialization.
ib
parents: 32874
diff changeset
45 static wItem *currSection;
997208b63159 Remove needless explicit initialization.
ib
parents: 32874
diff changeset
46 static int *currSubItem;
997208b63159 Remove needless explicit initialization.
ib
parents: 32874
diff changeset
47 static wItem *currSubItems;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
48
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
49 static void ERRORMESSAGE(const char *format, ...)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
50 {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
51 char p[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
52 char tmp[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
53 va_list ap;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
54
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
55 va_start(ap, format);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
56 vsnprintf(p, sizeof(p), format, ap);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
57 va_end(ap);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
58
32877
a095a4ed8ad3 Change message levels to 'error'.
ib
parents: 32876
diff changeset
59 mp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_SKIN_ERRORMESSAGE, linenumber, p);
32879
9ee46c5e8667 Comply with the requested verbosity on GUI message boxes.
ib
parents: 32878
diff changeset
60
9ee46c5e8667 Comply with the requested verbosity on GUI message boxes.
ib
parents: 32878
diff changeset
61 if (mp_msg_test(MSGT_GPLAYER, MSGL_ERR)) {
32880
96cbdbf90c42 Cosmetic: Adjust indent.
ib
parents: 32879
diff changeset
62 snprintf(tmp, sizeof(tmp), MSGTR_SKIN_ERRORMESSAGE, linenumber, p);
96cbdbf90c42 Cosmetic: Adjust indent.
ib
parents: 32879
diff changeset
63 gtkMessageBox(GTK_MB_FATAL, tmp);
32879
9ee46c5e8667 Comply with the requested verbosity on GUI message boxes.
ib
parents: 32878
diff changeset
64 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
65 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
66
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
67 #define CHECKDEFLIST(str) \
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
68 { \
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
69 if (skin == NULL) \
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
70 { \
32877
a095a4ed8ad3 Change message levels to 'error'.
ib
parents: 32876
diff changeset
71 ERRORMESSAGE(MSGTR_SKIN_ERROR_SECTION, str); \
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
72 return 1; \
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
73 } \
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
74 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
75
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
76 #define CHECKWINLIST(str) \
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
77 { \
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
78 if (!window_name[0]) \
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
79 { \
32877
a095a4ed8ad3 Change message levels to 'error'.
ib
parents: 32876
diff changeset
80 ERRORMESSAGE(MSGTR_SKIN_ERROR_WINDOW, str); \
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
81 return 1; \
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
82 } \
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
83 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
84
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
85 #define CHECK(name) \
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
86 { \
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
87 if (!strcmp(window_name, name)) \
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
88 { \
32877
a095a4ed8ad3 Change message levels to 'error'.
ib
parents: 32876
diff changeset
89 ERRORMESSAGE(MSGTR_SKIN_ERROR_IN_WINDOW, name); \
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
90 return 1; \
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
91 } \
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
92 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
93
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
94 static char *strlower(char *in)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
95 {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
96 char *p = in;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
97
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
98 while (*p) {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
99 if (*p >= 'A' && *p <= 'Z')
32874
440e617c116b Clarify the lower case transformation.
ib
parents: 32873
diff changeset
100 *p += 'a' - 'A';
32873
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 p++;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
103 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
104
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
105 return in;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
106 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
107
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
108 int skinBPRead(char *fname, txSample *bf)
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 int i = bpRead(fname, bf);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
111
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
112 switch (i) {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
113 case -1:
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
114 ERRORMESSAGE(MSGTR_SKIN_BITMAP_16bit, fname);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
115 break;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
116
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
117 case -2:
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
118 ERRORMESSAGE(MSGTR_SKIN_BITMAP_FileNotFound, fname);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
119 break;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
120
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
121 case -3:
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
122 ERRORMESSAGE(MSGTR_SKIN_BITMAP_BMPReadError, fname);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
123 break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
124
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
125 case -4:
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
126 ERRORMESSAGE(MSGTR_SKIN_BITMAP_TGAReadError, fname);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
127 break;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
128
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
129 case -5:
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
130 ERRORMESSAGE(MSGTR_SKIN_BITMAP_PNGReadError, fname);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
131 break;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
132
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
133 case -6:
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
134 ERRORMESSAGE(MSGTR_SKIN_BITMAP_RLENotSupported, fname);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
135 break;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
136
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
137 case -7:
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
138 ERRORMESSAGE(MSGTR_SKIN_BITMAP_UnknownFileType, fname);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
139 break;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
140
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
141 case -8:
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
142 ERRORMESSAGE(MSGTR_SKIN_BITMAP_ConversionError, fname);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
143 break;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
144 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
145
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
146 return i;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
147 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
148
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
149 // section=movieplayer
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
150 static int cmd_section(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
151 {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
152 strlower(in);
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
153 skin = NULL;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
154
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
155 if (!strcmp(in, "movieplayer"))
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
156 skin = &appMPlayer;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
157
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
158 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] section: %s\n", in);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
159
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
160 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
161 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
162
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
163 // end
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
164 static int cmd_end(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
165 {
32958
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
166 #ifdef MP_DEBUG
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
167 char *space, *name;
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
168
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
169 if (window_name[0]) {
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
170 space = " ";
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
171 name = window_name;
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
172 } else {
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
173 space = "";
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
174 name = "section";
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
175 }
32958
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
176 #endif
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
177
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
178 (void)in;
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
179
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
180 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] %send (%s)\n", space, name);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
181
32979
4905f5a87357 Replace some awkward and unnecessary usages of strlen().
ib
parents: 32958
diff changeset
182 if (window_name[0]) {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
183 window_name[0] = 0;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
184 currSection = NULL;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
185 currSubItem = NULL;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
186 currSubItems = NULL;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
187 } else
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
188 skin = NULL;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
189
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
190 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
191 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
192
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
193 // window=main|sub|playbar|menu
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
194 static int cmd_window(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
195 {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
196 CHECKDEFLIST("window");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
197
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
198 av_strlcpy(window_name, strlower(in), sizeof(window_name));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
199
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
200 if (!strncmp(in, "main", 4)) {
32893
c873777e957d Get rid of needless listItems variable and pointer.
ib
parents: 32880
diff changeset
201 currSection = &appMPlayer.main;
32931
03b1051bed5c Rename the 'NumberOf' members of the listItems structure.
ib
parents: 32926
diff changeset
202 currSubItem = &appMPlayer.IndexOfMainItems;
32912
ca4d3fa55e43 Adjust the listItems structure.
ib
parents: 32911
diff changeset
203 currSubItems = appMPlayer.mainItems;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
204 } else if (!strncmp(in, "sub", 3))
32893
c873777e957d Get rid of needless listItems variable and pointer.
ib
parents: 32880
diff changeset
205 currSection = &appMPlayer.sub;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
206 else if (!strncmp(in, "playbar", 7)) {
32893
c873777e957d Get rid of needless listItems variable and pointer.
ib
parents: 32880
diff changeset
207 currSection = &appMPlayer.bar;
32931
03b1051bed5c Rename the 'NumberOf' members of the listItems structure.
ib
parents: 32926
diff changeset
208 currSubItem = &appMPlayer.IndexOfBarItems;
32893
c873777e957d Get rid of needless listItems variable and pointer.
ib
parents: 32880
diff changeset
209 currSubItems = appMPlayer.barItems;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
210 } else if (!strncmp(in, "menu", 4)) {
32893
c873777e957d Get rid of needless listItems variable and pointer.
ib
parents: 32880
diff changeset
211 currSection = &appMPlayer.menuBase;
32931
03b1051bed5c Rename the 'NumberOf' members of the listItems structure.
ib
parents: 32926
diff changeset
212 currSubItem = &appMPlayer.IndexOfMenuItems;
32912
ca4d3fa55e43 Adjust the listItems structure.
ib
parents: 32911
diff changeset
213 currSubItems = appMPlayer.menuItems;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
214 } else
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
215 ERRORMESSAGE(MSGTR_UNKNOWNWINDOWTYPE);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
216
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
217 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] window: %s\n", window_name);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
218
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
219 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
220 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
221
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
222 // base=image,x,y[,width,height]
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
223 static int cmd_base(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
224 {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
225 unsigned char fname[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
226 unsigned char tmp[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
227 int x, y;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
228 int sx = 0, sy = 0;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
229
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
230 CHECKDEFLIST("base");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
231 CHECKWINLIST("base");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
232
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
233 cutItem(in, fname, ',', 0);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
234 x = cutItemToInt(in, ',', 1);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
235 y = cutItemToInt(in, ',', 2);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
236 sx = cutItemToInt(in, ',', 3);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
237 sy = cutItemToInt(in, ',', 4);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
238
32958
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
239 if (!strcmp(window_name, "main")) {
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
240 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] image: %s %d,%d\n", fname, x, y);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
241
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
242 skin->main.x = x;
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
243 skin->main.y = y;
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
244 skin->main.type = itBase;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
245
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
246 av_strlcpy(tmp, path, sizeof(tmp));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
247 av_strlcat(tmp, fname, sizeof(tmp));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
248
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
249 if (skinBPRead(tmp, &skin->main.Bitmap) != 0)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
250 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
251
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
252 skin->main.width = skin->main.Bitmap.Width;
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
253 skin->main.height = skin->main.Bitmap.Height;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
254
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
255 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] bitmap: %dx%d\n", skin->main.width, skin->main.height);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
256
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26458
diff changeset
257 #ifdef CONFIG_XSHAPE
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
258 Convert32to1(&skin->main.Bitmap, &skin->main.Mask, 0x00ff00ff);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
259 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] mask: %lux%lu\n", skin->main.Mask.Width, skin->main.Mask.Height);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
260 #else
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
261 skin->main.Mask.Image = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
262 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
263 }
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
264
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
265 if (!strcmp(window_name, "sub")) {
32958
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
266 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
267
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
268 skin->sub.type = itBase;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
269
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
270 av_strlcpy(tmp, path, sizeof(tmp));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
271 av_strlcat(tmp, fname, sizeof(tmp));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
272
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
273 if (skinBPRead(tmp, &skin->sub.Bitmap) != 0)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
274 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
275
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
276 skin->sub.x = x;
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
277 skin->sub.y = y;
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
278 skin->sub.width = skin->sub.Bitmap.Width;
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
279 skin->sub.height = skin->sub.Bitmap.Height;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
280
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
281 if (sx && sy) {
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
282 skin->sub.width = sx;
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
283 skin->sub.height = sy;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
284 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
285
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
286 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] bitmap: %dx%d\n", skin->sub.width, skin->sub.height);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
287 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
288
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
289 if (!strcmp(window_name, "menu")) {
32958
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
290 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] image: %s\n", fname);
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
291
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
292 skin->menuIsPresent = 1;
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
293 skin->menuBase.type = itBase;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
294
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
295 av_strlcpy(tmp, path, sizeof(tmp));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
296 av_strlcat(tmp, fname, sizeof(tmp));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
297
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
298 if (skinBPRead(tmp, &skin->menuBase.Bitmap) != 0)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
299 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
300
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
301 skin->menuBase.width = skin->menuBase.Bitmap.Width;
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
302 skin->menuBase.height = skin->menuBase.Bitmap.Height;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
303
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
304 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] bitmap: %dx%d\n", skin->menuBase.width, skin->menuBase.height);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
305
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26458
diff changeset
306 #ifdef CONFIG_XSHAPE
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
307 Convert32to1(&skin->menuBase.Bitmap, &skin->menuBase.Mask, 0x00ff00ff);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
308 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] mask: %lux%lu\n", skin->menuBase.Mask.Width, skin->menuBase.Mask.Height);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
309 #else
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
310 skin->menuBase.Mask.Image = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
311 #endif
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
312 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
313
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
314 if (!strcmp(window_name, "playbar")) {
32958
80087dd00035 Fix some debug messages.
ib
parents: 32951
diff changeset
315 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
316
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
317 skin->barIsPresent = 1;
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
318 skin->bar.x = x;
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
319 skin->bar.y = y;
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
320 skin->bar.type = itBase;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
321
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
322 av_strlcpy(tmp, path, sizeof(tmp));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
323 av_strlcat(tmp, fname, sizeof(tmp));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
324
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
325 if (skinBPRead(tmp, &skin->bar.Bitmap) != 0)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
326 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
327
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
328 skin->bar.width = skin->bar.Bitmap.Width;
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
329 skin->bar.height = skin->bar.Bitmap.Height;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
330
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
331 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] bitmap: %dx%d\n", skin->bar.width, skin->bar.height);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
332
27377
d58d06eafe83 Change a bunch of X11-specific preprocessor directives.
diego
parents: 26458
diff changeset
333 #ifdef CONFIG_XSHAPE
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
334 Convert32to1(&skin->bar.Bitmap, &skin->bar.Mask, 0x00ff00ff);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
335 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] mask: %lux%lu\n", skin->bar.Mask.Width, skin->bar.Mask.Height);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
336 #else
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
337 skin->bar.Mask.Image = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
338 #endif
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
339 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27377
diff changeset
340
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
341 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
342 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
343
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
344 // background=R,G,B
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
345 static int cmd_background(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
346 {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
347 CHECKDEFLIST("background");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
348 CHECKWINLIST("background");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
349
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
350 CHECK("menu");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
351 CHECK("main");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
352
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
353 currSection->R = cutItemToInt(in, ',', 0);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
354 currSection->G = cutItemToInt(in, ',', 1);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
355 currSection->B = cutItemToInt(in, ',', 2);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
356
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
357 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] background color: #%02x%02x%02x\n", currSection->R, currSection->G, currSection->B);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
358
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
359 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
360 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
361
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
362 // button=image,x,y,width,height,message
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
363 static int cmd_button(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
364 {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
365 unsigned char fname[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
366 unsigned char tmp[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
367 int x, y, sx, sy;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
368 char msg[32];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
369
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
370 CHECKDEFLIST("button");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
371 CHECKWINLIST("button");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
372
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
373 CHECK("sub");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
374 CHECK("menu");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
375
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
376 cutItem(in, fname, ',', 0);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
377 x = cutItemToInt(in, ',', 1);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
378 y = cutItemToInt(in, ',', 2);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
379 sx = cutItemToInt(in, ',', 3);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
380 sy = cutItemToInt(in, ',', 4);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
381 cutItem(in, msg, ',', 5);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
382
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
383 (*currSubItem)++;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
384 currSubItems[*currSubItem].type = itButton;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
385 currSubItems[*currSubItem].x = x;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
386 currSubItems[*currSubItem].y = y;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
387 currSubItems[*currSubItem].width = sx;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
388 currSubItems[*currSubItem].height = sy;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
389
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
390 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] button image: %s %d,%d\n", fname, x, y);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
391
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
392 if ((currSubItems[*currSubItem].message = appFindMessage(msg)) == -1) {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
393 ERRORMESSAGE(MSGTR_SKIN_BITMAP_UnknownMessage, msg);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
394 return 0;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
395 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
396
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
397 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %s (#%d)\n", msg, currSubItems[*currSubItem].message);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
398 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] size: %dx%d\n", sx, sy);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
399
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
400 currSubItems[*currSubItem].pressed = btnReleased;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
401
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
402 if (currSubItems[*currSubItem].message == evPauseSwitchToPlay)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
403 currSubItems[*currSubItem].pressed = btnDisabled;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
404
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
405 currSubItems[*currSubItem].tmp = 1;
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 currSubItems[*currSubItem].Bitmap.Image = NULL;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
408
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
409 if (strcmp(fname, "NULL") != 0) {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
410 av_strlcpy(tmp, path, sizeof(tmp));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
411 av_strlcat(tmp, fname, sizeof(tmp));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
412
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
413 if (skinBPRead(tmp, &currSubItems[*currSubItem].Bitmap) != 0)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
414 return 1;
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
415
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
416 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] (bitmap: %lux%lu)\n", currSubItems[*currSubItem].Bitmap.Width, currSubItems[*currSubItem].Bitmap.Height);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
417 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
418
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
419 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
420 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
421
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
422 // selected=image
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
423 static int cmd_selected(char *in)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
424 {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
425 unsigned char fname[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
426 unsigned char tmp[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
427
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
428 CHECKDEFLIST("selected");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
429 CHECKWINLIST("selected");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
430
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
431 CHECK("main");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
432 CHECK("sub");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
433 CHECK("playbar");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
434
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
435 cutItem(in, fname, ',', 0);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
436
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
437 skin->menuSelected.type = itBase;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
438
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
439 av_strlcpy(tmp, path, sizeof(tmp));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
440 av_strlcat(tmp, fname, sizeof(tmp));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
441
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
442 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] image selected: %s\n", fname);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
443
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
444 if (skinBPRead(tmp, &skin->menuSelected.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
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
447 skin->menuSelected.width = skin->menuSelected.Bitmap.Width;
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
448 skin->menuSelected.height = skin->menuSelected.Bitmap.Height;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
449
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
450 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] bitmap: %dx%d\n", skin->menuSelected.width, skin->menuSelected.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 {
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
458 int x, y, sx, sy, message;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
459 unsigned char tmp[64];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
460
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
461 CHECKDEFLIST("menu");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
462 CHECKWINLIST("menu");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
463
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
464 CHECK("main");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
465 CHECK("sub");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
466 CHECK("playbar");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
467
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
468 x = cutItemToInt(in, ',', 0);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
469 y = cutItemToInt(in, ',', 1);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
470 sx = cutItemToInt(in, ',', 2);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
471 sy = cutItemToInt(in, ',', 3);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
472 cutItem(in, tmp, ',', 4);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
473
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
474 message = appFindMessage(tmp);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
475
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
476 skin->IndexOfMenuItems++;
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
477 skin->menuItems[skin->IndexOfMenuItems].x = x;
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
478 skin->menuItems[skin->IndexOfMenuItems].y = y;
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
479 skin->menuItems[skin->IndexOfMenuItems].width = sx;
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
480 skin->menuItems[skin->IndexOfMenuItems].height = sy;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
481
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
482 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] item #%d: %d,%d %dx%d\n", skin->IndexOfMenuItems, x, y, sx, sy);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
483
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
484 if ((skin->menuItems[skin->IndexOfMenuItems].message = message) == -1)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
485 ERRORMESSAGE(MSGTR_SKIN_BITMAP_UnknownMessage, tmp);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
486
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
487 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %s (#%d)\n", tmp, skin->menuItems[skin->IndexOfMenuItems].message);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
488
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
489 skin->menuItems[skin->IndexOfMenuItems].Bitmap.Image = NULL;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
490 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
491 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
492
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
493 // hpotmeter=button,bwidth,bheight,phases,numphases,default,x,y,width,height,message
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
494 static int cmd_hpotmeter(char *in)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
495 {
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
496 int x, y, pwidth, pheight, ph, sx, sy, message, d;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
497 unsigned char tmp[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
498 unsigned char pfname[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
499 unsigned char phfname[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
500 wItem *item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
501
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
502 CHECKDEFLIST("hpotmeter");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
503 CHECKWINLIST("hpotmeter");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
504
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
505 CHECK("sub");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
506 CHECK("menu");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
507
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
508 cutItem(in, pfname, ',', 0);
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
509 pwidth = cutItemToInt(in, ',', 1);
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
510 pheight = cutItemToInt(in, ',', 2);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
511 cutItem(in, phfname, ',', 3);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
512 ph = cutItemToInt(in, ',', 4);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
513 d = cutItemToInt(in, ',', 5);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
514 x = cutItemToInt(in, ',', 6);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
515 y = cutItemToInt(in, ',', 7);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
516 sx = cutItemToInt(in, ',', 8);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
517 sy = cutItemToInt(in, ',', 9);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
518 cutItem(in, tmp, ',', 10);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
519
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
520 message = appFindMessage(tmp);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
521
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
522 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] h/v potmeter image: %s %d,%d %dx%d\n", phfname, x, y, sx, sy);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
523 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
524 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] numphases: %d, default: %d%%\n", ph, d);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
525 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %s (#%d)\n", tmp, message);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
526
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
527 (*currSubItem)++;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
528 item = &currSubItems[*currSubItem];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
529 item->type = itHPotmeter;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
530 item->x = x;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
531 item->y = y;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
532 item->width = sx;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
533 item->height = sy;
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
534 item->numphases = ph;
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
535 item->pwidth = pwidth;
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
536 item->pheight = pheight;
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
537 item->message = message;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
538 item->value = (float)d;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
539 item->pressed = btnReleased;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
540 item->Bitmap.Image = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
541
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
542 if (strcmp(phfname, "NULL") != 0) {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
543 av_strlcpy(tmp, path, sizeof(tmp));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
544 av_strlcat(tmp, phfname, sizeof(tmp));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
545
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
546 if (skinBPRead(tmp, &item->Bitmap) != 0)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
547 return 1;
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
548
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
549 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
550 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
551
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
552 item->Mask.Image = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
553
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
554 if (strcmp(pfname, "NULL") != 0) {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
555 av_strlcpy(tmp, path, sizeof(tmp));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
556 av_strlcat(tmp, pfname, sizeof(tmp));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
557
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
558 if (skinBPRead(tmp, &item->Mask) != 0)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
559 return 1;
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
560
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
561 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
562 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
563
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
564 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
565 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
566
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
567 // vpotmeter=button,bwidth,bheight,phases,numphases,default,x,y,width,height,message
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
568 static int cmd_vpotmeter(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
569 {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
570 int r = cmd_hpotmeter(in);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
571 wItem *item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
572
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
573 item = &currSubItems[*currSubItem];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
574 item->type = itVPotmeter;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
575 return r;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
576 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
577
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
578 // potmeter=phases,numphases,default,x,y,width,height,message
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
579 static int cmd_potmeter(char *in)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
580 {
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
581 int x, y, ph, sx, sy, message, d;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
582 unsigned char tmp[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
583 unsigned char phfname[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
584 wItem *item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
585
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
586 CHECKDEFLIST("potmeter");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
587 CHECKWINLIST("potmeter");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
588
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
589 CHECK("sub");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
590 CHECK("menu");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
591
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
592 cutItem(in, phfname, ',', 0);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
593 ph = cutItemToInt(in, ',', 1);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
594 d = cutItemToInt(in, ',', 2);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
595 x = cutItemToInt(in, ',', 3);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
596 y = cutItemToInt(in, ',', 4);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
597 sx = cutItemToInt(in, ',', 5);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
598 sy = cutItemToInt(in, ',', 6);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
599 cutItem(in, tmp, ',', 7);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
600
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
601 message = appFindMessage(tmp);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
602
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
603 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] potmeter image: %s %d,%d %dx%d\n", phfname, x, y, sx, sy);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
604 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] numphases: %d, default: %d%%\n", ph, d);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
605 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] message: %s (#%d)\n", tmp, message);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
606
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
607 (*currSubItem)++;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
608 item = &currSubItems[*currSubItem];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
609 item->type = itPotmeter;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
610 item->x = x;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
611 item->y = y;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
612 item->width = sx;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
613 item->height = sy;
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
614 item->numphases = ph;
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32910
diff changeset
615 item->message = message;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
616 item->value = (float)d;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
617 item->Bitmap.Image = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
618
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
619 if (strcmp(phfname, "NULL") != 0) {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
620 av_strlcpy(tmp, path, sizeof(tmp));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
621 av_strlcat(tmp, phfname, sizeof(tmp));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
622
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
623 if (skinBPRead(tmp, &item->Bitmap) != 0)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
624 return 1;
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
625
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
626 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
627 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
628
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
629 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
630 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
631
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
632 // font=fontfile
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
633 static int cmd_font(char *in)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
634 {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
635 char name[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
636 wItem *item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
637
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
638 CHECKDEFLIST("font");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
639 CHECKWINLIST("font");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
640
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
641 CHECK("sub");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
642 CHECK("menu");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
643
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
644 cutItem(in, name, ',', 0);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
645
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
646 (*currSubItem)++;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
647 item = &currSubItems[*currSubItem];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
648 item->type = itFont;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
649 item->fontid = fntRead(path, name);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
650
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
651 switch (item->fontid) {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
652 case -1:
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
653 ERRORMESSAGE(MSGTR_SKIN_FONT_NotEnoughtMemory);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
654 return 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
655
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
656 case -2:
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
657 ERRORMESSAGE(MSGTR_SKIN_FONT_TooManyFontsDeclared);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
658 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
659
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
660 case -3:
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
661 ERRORMESSAGE(MSGTR_SKIN_FONT_FontFileNotFound);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
662 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
663
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
664 case -4:
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
665 ERRORMESSAGE(MSGTR_SKIN_FONT_FontImageNotFound);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
666 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
667 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
668
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
669 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] font: %s (#%d)\n", name, fntFindID(name));
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
670
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
671 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
672 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
673
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
674 // slabel=x,y,fontfile,"text"
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
675 static int cmd_slabel(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
676 {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
677 char tmp[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
678 char sid[64];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
679 int x, y, id;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
680 wItem *item;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
681
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
682 CHECKDEFLIST("slabel");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
683 CHECKWINLIST("slabel");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
684
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
685 CHECK("sub");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
686 CHECK("menu");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
687
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
688 x = cutItemToInt(in, ',', 0);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
689 y = cutItemToInt(in, ',', 1);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
690 cutItem(in, sid, ',', 2);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
691 cutItem(in, tmp, ',', 3);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
692 cutItem(tmp, tmp, '"', 1);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
693
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
694 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] slabel: \"%s\"\n", tmp);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
695 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] pos: %d,%d\n", x, y);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
696
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
697 id = fntFindID(sid);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
698
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
699 if (id < 0) {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
700 ERRORMESSAGE(MSGTR_SKIN_FONT_NonExistentFontID, sid);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
701 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
702 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
703
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
704 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] font: %s (#%d)\n", sid, id);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
705
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
706 (*currSubItem)++;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
707 item = &currSubItems[*currSubItem];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
708 item->type = itSLabel;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
709 item->fontid = id;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
710 item->x = x;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
711 item->y = y;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
712 item->width = -1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
713 item->height = -1;
32979
4905f5a87357 Replace some awkward and unnecessary usages of strlen().
ib
parents: 32958
diff changeset
714 item->label = strdup(tmp);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
715
32979
4905f5a87357 Replace some awkward and unnecessary usages of strlen().
ib
parents: 32958
diff changeset
716 if (!item->label) {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
717 ERRORMESSAGE(MSGTR_SKIN_FONT_NotEnoughtMemory);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
718 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
719 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
720
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
721 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
722 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
723
32910
f34e21c5dc2f Improve documentation on dlabel.
ib
parents: 32893
diff changeset
724 // dlabel=x,y,width,align,fontfile,"text"
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
725 static int cmd_dlabel(char *in)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
726 {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
727 char tmp[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
728 char sid[64];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
729 int x, y, sx, id, a;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
730 wItem *item;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
731
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
732 CHECKDEFLIST("dlabel");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
733 CHECKWINLIST("dlabel");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
734
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
735 CHECK("sub");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
736 CHECK("menu");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
737
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
738 x = cutItemToInt(in, ',', 0);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
739 y = cutItemToInt(in, ',', 1);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
740 sx = cutItemToInt(in, ',', 2);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
741 a = cutItemToInt(in, ',', 3);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
742 cutItem(in, sid, ',', 4);
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
743 cutItem(in, tmp, ',', 5);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
744 cutItem(tmp, tmp, '"', 1);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
745
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
746 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] dlabel: \"%s\"\n", tmp);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
747 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] pos: %d,%d\n", x, y);
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
748 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] width: %d, align: %d\n", sx, a);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
749
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
750 id = fntFindID(sid);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
751
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
752 if (id < 0) {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
753 ERRORMESSAGE(MSGTR_SKIN_FONT_NonExistentFontID, sid);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
754 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
755 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
756
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
757 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] font: %s (#%d)\n", sid, id);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
758
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
759 (*currSubItem)++;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
760 item = &currSubItems[*currSubItem];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
761 item->type = itDLabel;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
762 item->fontid = id;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
763 item->align = a;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
764 item->x = x;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
765 item->y = y;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
766 item->width = sx;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
767 item->height = -1;
32979
4905f5a87357 Replace some awkward and unnecessary usages of strlen().
ib
parents: 32958
diff changeset
768 item->label = strdup(tmp);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
769
32979
4905f5a87357 Replace some awkward and unnecessary usages of strlen().
ib
parents: 32958
diff changeset
770 if (!item->label) {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
771 ERRORMESSAGE(MSGTR_SKIN_FONT_NotEnoughtMemory);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
772 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
773 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
774
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
775 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
776 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
777
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
778 // decoration=enable|disable
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
779 static int cmd_decoration(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
780 {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
781 char tmp[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
782
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
783 CHECKDEFLIST("decoration");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
784 CHECKWINLIST("decoration");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
785
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
786 CHECK("sub");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
787 CHECK("menu");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
788 CHECK("playbar");
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
789
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
790 strlower(in);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
791 cutItem(in, tmp, ',', 0);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
792
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
793 if (strcmp(tmp, "enable") != 0 && strcmp(tmp, "disable") != 0) {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
794 ERRORMESSAGE(MSGTR_SKIN_UnknownParameter, tmp);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
795 return 1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
796 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
797
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
798 if (strcmp(tmp, "enable") != 0)
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
799 skin->mainDecoration = 0;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
800 else
32937
3c57056637cc Cosmetic: Rename listItems structure.
ib
parents: 32933
diff changeset
801 skin->mainDecoration = 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
802
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
803 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] decoration: %s\n", tmp);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
804
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
805 return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
806 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
807
32878
afa6f80b0867 Limit scope of internally used skinItem array.
ib
parents: 32877
diff changeset
808 static _item skinItem[] = {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
809 { "section", cmd_section },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
810 { "end", cmd_end },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
811 { "window", cmd_window },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
812 { "base", cmd_base },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
813 { "button", cmd_button },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
814 { "selected", cmd_selected },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
815 { "background", cmd_background },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
816 { "vpotmeter", cmd_vpotmeter },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
817 { "hpotmeter", cmd_hpotmeter },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
818 { "potmeter", cmd_potmeter },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
819 { "font", cmd_font },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
820 { "slabel", cmd_slabel },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
821 { "dlabel", cmd_dlabel },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
822 { "decoration", cmd_decoration },
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
823 { "menu", cmd_menu }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
824 };
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
825
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
826 char *strswap(char *in, char what, char whereof)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
827 {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
828 int i;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
829
32979
4905f5a87357 Replace some awkward and unnecessary usages of strlen().
ib
parents: 32958
diff changeset
830 if (!*in)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
831 return NULL;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
832
32979
4905f5a87357 Replace some awkward and unnecessary usages of strlen().
ib
parents: 32958
diff changeset
833 for (i = 0; in[i]; i++)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
834 if (in[i] == what)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
835 in[i] = whereof;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
836
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
837 return in;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
838 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
839
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
840 char *trim(char *in)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
841 {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
842 int c = 0, id = 0, i;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
843
32979
4905f5a87357 Replace some awkward and unnecessary usages of strlen().
ib
parents: 32958
diff changeset
844 if (!*in)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
845 return NULL;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
846
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
847 while (c != (int)strlen(in)) {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
848 if (in[c] == '"')
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
849 id = !id;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
850
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
851 if ((in[c] == ' ') && (!id)) {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
852 for (i = 0; i < (int)strlen(in) - c; i++)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
853 in[c + i] = in[c + i + 1];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
854 continue;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
855 }
32850
48583fc18d1a Make setname() directly return the string created instead of writing it
ib
parents: 32849
diff changeset
856
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
857 c++;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
858 }
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
859
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
860 return in;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
861 }
32850
48583fc18d1a Make setname() directly return the string created instead of writing it
ib
parents: 32849
diff changeset
862
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
863 static char *setname(char *item1, char *item2)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
864 {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
865 static char fn[512];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
866
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
867 av_strlcpy(fn, item1, sizeof(fn));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
868 av_strlcat(fn, "/", sizeof(fn));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
869 av_strlcat(fn, item2, sizeof(fn));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
870 av_strlcpy(path, fn, sizeof(path));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
871 av_strlcat(path, "/", sizeof(path));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
872 av_strlcat(fn, "/skin", sizeof(fn));
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
874 return fn;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
875 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
876
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
877 int skinRead(char *dname)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
878 {
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
879 char *fn;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
880 FILE *skinFile;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
881 unsigned char tmp[256];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
882 unsigned char *ptmp;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
883 unsigned char command[32];
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
884 unsigned char param[256];
32944
27a98940e3aa Use FF_ARRAY_ELEMS() rather than a separate constant.
ib
parents: 32937
diff changeset
885 unsigned int i;
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
886
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
887 fn = setname(skinDirInHome, dname);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
888
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
889 if ((skinFile = fopen(fn, "rt")) == NULL) {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
890 fn = setname(skinMPlayerDir, dname);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
891
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
892 if ((skinFile = fopen(fn, "rt")) == NULL) {
32877
a095a4ed8ad3 Change message levels to 'error'.
ib
parents: 32876
diff changeset
893 mp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_SKIN_SkinFileNotFound, fn);
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
894 return -1;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
895 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
896 }
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
897
32951
c11e65fcb818 Clean up debug messages.
ib
parents: 32950
diff changeset
898 mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] configuration file: %s\n", fn);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
899
32932
e95ec1b2feea Cosmetic: Rename appInitStruct() to appFreeStruct().
ib
parents: 32931
diff changeset
900 appFreeStruct();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
901
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
902 linenumber = 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
903
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
904 while (fgets(tmp, sizeof(tmp), skinFile)) {
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
905 linenumber++;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
906
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
907 tmp[strcspn(tmp, "\n\r")] = 0; // remove any kind of newline, if any
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
908 strswap(tmp, '\t', ' ');
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
909 trim(tmp);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
910 ptmp = strchr(tmp, ';');
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
911
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
912 if (ptmp)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
913 *ptmp = 0;
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
914
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
915 if (!*tmp)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
916 continue;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
917
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
918 cutItem(tmp, command, '=', 0);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
919 cutItem(tmp, param, '=', 1);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
920 strlower(command);
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
921
32944
27a98940e3aa Use FF_ARRAY_ELEMS() rather than a separate constant.
ib
parents: 32937
diff changeset
922 for (i = 0; i < FF_ARRAY_ELEMS(skinItem); i++)
32873
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
923 if (!strcmp(command, skinItem[i].name))
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
924 if (skinItem[i].func(param) != 0)
cf385b1901cb Cosmetic: Format to MPlayer coding style.
ib
parents: 32856
diff changeset
925 return -2;
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) {
32877
a095a4ed8ad3 Change message levels to 'error'.
ib
parents: 32876
diff changeset
929 mp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_SKIN_SkinFileNotReadable, fn);
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 }