Mercurial > mplayer.hg
annotate Gui/skin/skin.c @ 20347:c1f610e507ed
fix "typo"
author | kraymer |
---|---|
date | Sun, 22 Oct 2006 12:21:29 +0000 |
parents | 40527c0a1387 |
children |
rev | line source |
---|---|
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
1 |
1693 | 2 #include <stdio.h> |
3 #include <stdlib.h> | |
4 #include <string.h> | |
5 | |
6 #include "cut.h" | |
7 #include "font.h" | |
17144 | 8 #include "app.h" |
3586 | 9 |
17144 | 10 #include "../config.h" |
11 #include "../mp_msg.h" | |
12 #include "../help_mp.h" | |
13 #include "mplayer/widgets.h" | |
1693 | 14 |
8973 | 15 //#define MSGL_DBG2 MSGL_STATUS |
16 | |
1693 | 17 listItems * skinAppMPlayer = &appMPlayer; |
18 | |
8973 | 19 // --- |
20 | |
21 static int linenumber; | |
22 | |
23 static unsigned char path[512],fn[512]; | |
1693 | 24 |
8973 | 25 static listItems * defList = NULL; |
26 static unsigned char window_name[32] = ""; | |
1693 | 27 |
8973 | 28 static wItem * currSection = NULL; |
29 static int * currSubItem = NULL; | |
30 static wItem * currSubItems = NULL; | |
1693 | 31 |
32 #include <stdarg.h> | |
33 | |
34 void ERRORMESSAGE( const char * format, ... ) | |
35 { | |
36 char p[512]; | |
8305
4c23944315d6
- add R¸«ädiger Kuhlmann's <mplayer-list-UGa6JdjLujS2@ruediger-kuhlmann.de> patch
pontscho
parents:
8280
diff
changeset
|
37 char tmp[512]; |
1693 | 38 va_list ap; |
39 va_start( ap,format ); | |
40 vsnprintf( p,512,format,ap ); | |
41 va_end( ap ); | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
42 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_ERRORMESSAGE,linenumber,p ); |
8305
4c23944315d6
- add R¸«ädiger Kuhlmann's <mplayer-list-UGa6JdjLujS2@ruediger-kuhlmann.de> patch
pontscho
parents:
8280
diff
changeset
|
43 snprintf( tmp,512,MSGTR_SKIN_ERRORMESSAGE,linenumber,p ); |
4c23944315d6
- add R¸«ädiger Kuhlmann's <mplayer-list-UGa6JdjLujS2@ruediger-kuhlmann.de> patch
pontscho
parents:
8280
diff
changeset
|
44 gtkMessageBox( GTK_MB_FATAL,tmp ); |
1693 | 45 } |
46 | |
1884 | 47 #define CHECKDEFLIST( str ) \ |
48 { \ | |
49 if ( defList == NULL ) \ | |
50 { \ | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
51 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING1,linenumber,str ); \ |
1884 | 52 return 1; \ |
53 } \ | |
54 } | |
55 | |
56 #define CHECKWINLIST( str ) \ | |
57 { \ | |
8973 | 58 if ( !window_name[0] ) \ |
1884 | 59 { \ |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
60 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING2,linenumber,str ); \ |
1884 | 61 return 1; \ |
62 } \ | |
63 } | |
1693 | 64 |
8973 | 65 #define CHECK( name ) \ |
66 { \ | |
67 if ( !strcmp( window_name,name ) ) \ | |
68 { \ | |
69 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING3,linenumber,name ); \ | |
70 return 1; \ | |
71 } \ | |
72 } | |
73 | |
10241
31564f53c400
fix name clash fix libsmbclient, patch by Raindel Shachar <raindel@techunix.technion.ac.il>
alex
parents:
8973
diff
changeset
|
74 static char * strlower( char * in ) |
1693 | 75 { |
76 int i; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
77 for( i=0;i<(int)strlen( in );i++ ) in[i]=( in[i] >= 'A' ? ( in[i] <= 'Z' ? in[i]+='A' : in[i] ) : in[i] ); |
1693 | 78 return in; |
79 } | |
80 | |
81 int skinBPRead( char * fname, txSample * bf ) | |
82 { | |
83 int i=bpRead( fname,bf ); | |
84 switch ( i ) | |
85 { | |
1884 | 86 case -1: ERRORMESSAGE( MSGTR_SKIN_BITMAP_16bit,fname ); break; |
87 case -2: ERRORMESSAGE( MSGTR_SKIN_BITMAP_FileNotFound,fname ); break; | |
88 case -3: ERRORMESSAGE( MSGTR_SKIN_BITMAP_BMPReadError,fname ); break; | |
89 case -4: ERRORMESSAGE( MSGTR_SKIN_BITMAP_TGAReadError,fname ); break; | |
90 case -5: ERRORMESSAGE( MSGTR_SKIN_BITMAP_PNGReadError,fname ); break; | |
91 case -6: ERRORMESSAGE( MSGTR_SKIN_BITMAP_RLENotSupported,fname ); break; | |
92 case -7: ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownFileType,fname ); break; | |
18335 | 93 case -8: ERRORMESSAGE( MSGTR_SKIN_BITMAP_ConversionError,fname ); break; |
1693 | 94 } |
95 return i; | |
96 } | |
97 | |
6625 | 98 int cmd_section( char * in ) |
1693 | 99 { |
100 strlower( in ); | |
101 defList=NULL; | |
102 if ( !strcmp( in,"movieplayer" ) ) defList=skinAppMPlayer; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
103 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] sectionname: %s\n",in ); |
1693 | 104 return 0; |
105 } | |
106 | |
6625 | 107 int cmd_end( char * in ) |
1693 | 108 { |
8973 | 109 if ( strlen( window_name ) ) { window_name[0]=0; currSection=NULL; currSubItem=NULL; currSubItems=NULL; } |
1693 | 110 else defList=NULL; |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
111 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] end section\n" ); |
1693 | 112 return 0; |
113 } | |
114 | |
6625 | 115 int cmd_window( char * in ) |
1693 | 116 { |
117 CHECKDEFLIST( "window" ); | |
118 | |
12646 | 119 strlcpy( window_name,strlower( in ),sizeof( window_name ) ); |
8973 | 120 if ( !strncmp( in,"main",4 ) ) { currSection=&skinAppMPlayer->main; currSubItem=&skinAppMPlayer->NumberOfItems; currSubItems=skinAppMPlayer->Items; } |
121 else if ( !strncmp( in,"sub",3 ) ) currSection=&skinAppMPlayer->sub; | |
122 else if ( !strncmp( in,"playbar",7 ) ) { currSection=&skinAppMPlayer->bar; currSubItem=&skinAppMPlayer->NumberOfBarItems; currSubItems=skinAppMPlayer->barItems; } | |
123 else if ( !strncmp( in,"menu",4 ) ) { currSection=&skinAppMPlayer->menuBase; currSubItem=&skinAppMPlayer->NumberOfMenuItems; currSubItems=skinAppMPlayer->MenuItems; } | |
14156 | 124 else ERRORMESSAGE( MSGTR_UNKNOWNWINDOWTYPE ); |
8973 | 125 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window: %s\n",window_name ); |
1693 | 126 return 0; |
127 } | |
128 | |
6625 | 129 int cmd_base( char * in ) |
1693 | 130 { |
131 unsigned char fname[512]; | |
132 unsigned char tmp[512]; | |
133 int x,y; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
134 int sx=0,sy=0; |
1693 | 135 |
136 CHECKDEFLIST( "base" ); | |
137 CHECKWINLIST( "base" ); | |
138 | |
139 cutItem( in,fname,',',0 ); | |
1852 | 140 x=cutItemToInt( in,',',1 ); |
141 y=cutItemToInt( in,',',2 ); | |
3080 | 142 sx=cutItemToInt( in,',',3 ); |
143 sy=cutItemToInt( in,',',4 ); | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
144 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] base: %s x: %d y: %d ( %dx%d )\n",fname,x,y,sx,sy ); |
8973 | 145 if ( !strcmp( window_name,"main" ) ) |
1693 | 146 { |
147 defList->main.x=x; | |
148 defList->main.y=y; | |
149 defList->main.type=itBase; | |
12646 | 150 strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, fname, sizeof( tmp )); |
1693 | 151 if ( skinBPRead( tmp,&defList->main.Bitmap ) ) return 1; |
152 defList->main.width=defList->main.Bitmap.Width; | |
153 defList->main.height=defList->main.Bitmap.Height; | |
8973 | 154 #ifdef HAVE_XSHAPE |
2717 | 155 Convert32to1( &defList->main.Bitmap,&defList->main.Mask,0x00ff00ff ); |
8973 | 156 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->main.Mask.Width,defList->main.Mask.Height ); |
157 #else | |
158 defList->main.Mask.Image=NULL; | |
2781 | 159 #endif |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
160 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->main.width,defList->main.height ); |
1693 | 161 } |
8973 | 162 if ( !strcmp( window_name,"sub" ) ) |
1693 | 163 { |
164 defList->sub.type=itBase; | |
12646 | 165 strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, fname, sizeof( tmp )); |
1693 | 166 if ( skinBPRead( tmp,&defList->sub.Bitmap ) ) return 1; |
2025
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1884
diff
changeset
|
167 defList->sub.x=x; |
0653e90b3118
some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents:
1884
diff
changeset
|
168 defList->sub.y=y; |
1693 | 169 defList->sub.width=defList->sub.Bitmap.Width; |
170 defList->sub.height=defList->sub.Bitmap.Height; | |
3080 | 171 if ( sx && sy ) |
172 { | |
173 defList->sub.width=sx; | |
174 defList->sub.height=sy; | |
175 } | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
176 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] %d,%d %dx%d\n",defList->sub.x,defList->sub.y,defList->sub.width,defList->sub.height ); |
1693 | 177 } |
8973 | 178 if ( !strcmp( window_name,"menu" ) ) |
1693 | 179 { |
8973 | 180 defList->menuIsPresent=1; |
1693 | 181 defList->menuBase.type=itBase; |
12646 | 182 strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, fname, sizeof( tmp )); |
1693 | 183 if ( skinBPRead( tmp,&defList->menuBase.Bitmap ) ) return 1; |
184 defList->menuBase.width=defList->menuBase.Bitmap.Width; | |
185 defList->menuBase.height=defList->menuBase.Bitmap.Height; | |
8973 | 186 #ifdef HAVE_XSHAPE |
6221 | 187 Convert32to1( &defList->menuBase.Bitmap,&defList->menuBase.Mask,0x00ff00ff ); |
8973 | 188 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->menuBase.Mask.Width,defList->menuBase.Mask.Height ); |
189 #else | |
190 defList->menuBase.Mask.Image=NULL; | |
6221 | 191 #endif |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
192 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->menuBase.width,defList->menuBase.height ); |
1693 | 193 } |
8973 | 194 if ( !strcmp( window_name,"playbar" ) ) |
195 { | |
196 defList->barIsPresent=1; | |
197 defList->bar.x=x; | |
198 defList->bar.y=y; | |
199 defList->bar.type=itBase; | |
12646 | 200 strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, fname, sizeof( tmp )); |
8973 | 201 if ( skinBPRead( tmp,&defList->bar.Bitmap ) ) return 1; |
202 defList->bar.width=defList->bar.Bitmap.Width; | |
203 defList->bar.height=defList->bar.Bitmap.Height; | |
204 #ifdef HAVE_XSHAPE | |
205 Convert32to1( &defList->bar.Bitmap,&defList->bar.Mask,0x00ff00ff ); | |
206 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->bar.Mask.Width,defList->bar.Mask.Height ); | |
207 #else | |
208 defList->bar.Mask.Image=NULL; | |
209 #endif | |
210 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->bar.width,defList->bar.height ); | |
211 } | |
1693 | 212 return 0; |
213 } | |
214 | |
6625 | 215 int cmd_background( char * in ) |
1693 | 216 { |
217 CHECKDEFLIST( "background" ); | |
218 CHECKWINLIST( "background" ); | |
219 | |
8973 | 220 CHECK( "menu" ); |
221 CHECK( "main" ); | |
222 | |
223 currSection->R=cutItemToInt( in,',',0 ); | |
224 currSection->G=cutItemToInt( in,',',1 ); | |
225 currSection->B=cutItemToInt( in,',',2 ); | |
226 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] background color is #%x%x%x.\n",currSection->R,currSection->G,currSection->B ); | |
227 | |
1693 | 228 return 0; |
229 } | |
230 | |
6625 | 231 int cmd_button( char * in ) |
1693 | 232 { |
233 unsigned char fname[512]; | |
234 unsigned char tmp[512]; | |
235 int x,y,sx,sy; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
236 char msg[32]; |
1693 | 237 |
238 CHECKDEFLIST( "button" ); | |
239 CHECKWINLIST( "button" ); | |
240 | |
8973 | 241 CHECK( "sub" ); |
242 CHECK( "menu" ); | |
243 | |
1693 | 244 cutItem( in,fname,',',0 ); |
1852 | 245 x=cutItemToInt( in,',',1 ); |
246 y=cutItemToInt( in,',',2 ); | |
247 sx=cutItemToInt( in,',',3 ); | |
248 sy=cutItemToInt( in,',',4 ); | |
1693 | 249 cutItem( in,msg,',',5 ); |
250 | |
8973 | 251 (*currSubItem)++; |
252 currSubItems[ *currSubItem ].type=itButton; | |
253 currSubItems[ *currSubItem ].x=x; | |
254 currSubItems[ *currSubItem ].y=y; | |
255 currSubItems[ *currSubItem ].width=sx; | |
256 currSubItems[ *currSubItem ].height=sy; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
257 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] button: fname: %s\n",fname ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
258 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy ); |
1693 | 259 |
8973 | 260 if ( ( currSubItems[ *currSubItem ].msg=appFindMessage( msg ) ) == -1 ) |
8423 | 261 { ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 0; } |
8973 | 262 currSubItems[ *currSubItem ].pressed=btnReleased; |
263 if ( currSubItems[ *currSubItem ].msg == evPauseSwitchToPlay ) currSubItems[ *currSubItem ].pressed=btnDisabled; | |
264 currSubItems[ *currSubItem ].tmp=1; | |
1693 | 265 |
8973 | 266 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",currSubItems[ *currSubItem ].msg ); |
1693 | 267 |
8973 | 268 currSubItems[ *currSubItem ].Bitmap.Image=NULL; |
1693 | 269 if ( strcmp( fname,"NULL" ) ) |
270 { | |
12646 | 271 strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, fname, sizeof( tmp )); |
8973 | 272 if ( skinBPRead( tmp,&currSubItems[ *currSubItem ].Bitmap ) ) return 1; |
1693 | 273 } |
8973 | 274 |
1693 | 275 return 0; |
276 } | |
277 | |
6625 | 278 int cmd_selected( char * in ) |
1693 | 279 { |
280 unsigned char fname[512]; | |
281 unsigned char tmp[512]; | |
282 | |
283 CHECKDEFLIST( "selected" ); | |
284 CHECKWINLIST( "selected" ); | |
285 | |
8973 | 286 CHECK( "main" ); |
287 CHECK( "sub" ); | |
288 CHECK( "playbar" ); | |
289 | |
1693 | 290 cutItem( in,fname,',',0 ); |
291 defList->menuSelected.type=itBase; | |
12646 | 292 strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, fname, sizeof( tmp )); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
293 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] selected: %s\n",fname ); |
1693 | 294 if ( skinBPRead( tmp,&defList->menuSelected.Bitmap ) ) return 1; |
295 defList->menuSelected.width=defList->menuSelected.Bitmap.Width; | |
296 defList->menuSelected.height=defList->menuSelected.Bitmap.Height; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
297 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->menuSelected.width,defList->menuSelected.height ); |
1693 | 298 return 0; |
299 } | |
300 | |
6625 | 301 int cmd_menu( char * in ) |
1693 | 302 { // menu = number,x,y,sx,sy,msg |
303 int x,y,sx,sy,msg; | |
304 unsigned char tmp[64]; | |
305 | |
306 CHECKDEFLIST( "menu" ); | |
307 CHECKWINLIST( "menu" ); | |
308 | |
8973 | 309 CHECK( "main" ); |
310 CHECK( "sub" ); | |
311 CHECK( "playbar" ); | |
312 | |
1852 | 313 x=cutItemToInt( in,',',0 ); |
314 y=cutItemToInt( in,',',1 ); | |
315 sx=cutItemToInt( in,',',2 ); | |
316 sy=cutItemToInt( in,',',3 ); | |
1693 | 317 cutItem( in,tmp,',',4 ); msg=appFindMessage( tmp ); |
318 | |
319 defList->NumberOfMenuItems++; | |
320 defList->MenuItems[ defList->NumberOfMenuItems ].x=x; | |
321 defList->MenuItems[ defList->NumberOfMenuItems ].y=y; | |
322 defList->MenuItems[ defList->NumberOfMenuItems ].width=sx; | |
323 defList->MenuItems[ defList->NumberOfMenuItems ].height=sy; | |
324 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
325 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] menuitem: %d\n",defList->NumberOfMenuItems ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
326 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy ); |
1693 | 327 |
328 if ( ( defList->MenuItems[ defList->NumberOfMenuItems ].msg=msg ) == -1 ) | |
1884 | 329 ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,tmp ); |
1693 | 330 |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
331 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",defList->Items[ defList->NumberOfItems ].msg ); |
1693 | 332 |
333 defList->MenuItems[ defList->NumberOfMenuItems ].Bitmap.Image=NULL; | |
334 return 0; | |
335 } | |
336 | |
6625 | 337 int cmd_hpotmeter( char * in ) |
1693 | 338 { // hpotmeter=buttonbitmaps,sx,sy,phasebitmaps,phases,default value,x,y,sx,sy,msg |
339 int x,y,psx,psy,ph,sx,sy,msg,d; | |
340 unsigned char tmp[512]; | |
341 unsigned char pfname[512]; | |
342 unsigned char phfname[512]; | |
343 wItem * item; | |
344 | |
345 CHECKDEFLIST( "hpotmeter" ); | |
346 CHECKWINLIST( "hpotmeter" ); | |
347 | |
8973 | 348 CHECK( "sub" ); |
349 CHECK( "menu" ); | |
350 | |
1693 | 351 cutItem( in,pfname,',',0 ); |
1852 | 352 psx=cutItemToInt( in,',',1 ); |
353 psy=cutItemToInt( in,',',2 ); | |
1693 | 354 cutItem( in,phfname,',',3 ); |
1852 | 355 ph=cutItemToInt( in,',',4 ); |
356 d=cutItemToInt( in,',',5 ); | |
357 x=cutItemToInt( in,',',6 ); | |
358 y=cutItemToInt( in,',',7 ); | |
359 sx=cutItemToInt( in,',',8 ); | |
360 sy=cutItemToInt( in,',',9 ); | |
1693 | 361 cutItem( in,tmp,',',10 ); msg=appFindMessage( tmp ); |
362 | |
8973 | 363 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] h/v potmeter: pointer filename: '%s'\n",pfname ); |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
364 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pointer size is %dx%d\n",psx,psy ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
365 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] phasebitmaps filename: '%s'\n",phfname ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
366 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] position: %d,%d %dx%d\n",x,y,sx,sy ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
367 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] default value: %d\n",d ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
368 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",msg ); |
1693 | 369 |
8973 | 370 (*currSubItem)++; |
371 item=&currSubItems[ *currSubItem ]; | |
372 | |
1693 | 373 item->type=itHPotmeter; |
374 item->x=x; item->y=y; item->width=sx; item->height=sy; | |
375 item->phases=ph; | |
376 item->psx=psx; item->psy=psy; | |
377 item->msg=msg; | |
378 item->value=(float)d; | |
379 item->pressed=btnReleased; | |
380 | |
381 item->Bitmap.Image=NULL; | |
382 if ( strcmp( phfname,"NULL" ) ) | |
383 { | |
12646 | 384 strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, phfname, sizeof( tmp )); |
1693 | 385 if ( skinBPRead( tmp,&item->Bitmap ) ) return 1; |
386 } | |
387 | |
388 item->Mask.Image=NULL; | |
389 if ( strcmp( pfname,"NULL" ) ) | |
390 { | |
12646 | 391 strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, pfname, sizeof( tmp )); |
1693 | 392 if ( skinBPRead( tmp,&item->Mask ) ) return 1; |
393 } | |
8973 | 394 return 0; |
395 } | |
1693 | 396 |
8973 | 397 int cmd_vpotmeter( char * in ) |
398 { | |
399 int r = cmd_hpotmeter( in ); | |
400 wItem * item; | |
401 | |
402 item=&currSubItems[ *currSubItem ]; | |
403 item->type=itVPotmeter; | |
404 return r; | |
1693 | 405 } |
406 | |
6625 | 407 int cmd_potmeter( char * in ) |
1693 | 408 { // potmeter=phasebitmaps,phases,default value,x,y,sx,sy,msg |
409 int x,y,ph,sx,sy,msg,d; | |
410 unsigned char tmp[512]; | |
411 unsigned char phfname[512]; | |
412 wItem * item; | |
413 | |
414 CHECKDEFLIST( "potmeter" ); | |
415 CHECKWINLIST( "potmeter" ); | |
416 | |
8973 | 417 CHECK( "sub" ); |
418 CHECK( "menu" ); | |
419 | |
1693 | 420 cutItem( in,phfname,',',0 ); |
1852 | 421 ph=cutItemToInt( in,',',1 ); |
422 d=cutItemToInt( in,',',2 ); | |
423 x=cutItemToInt( in,',',3 ); | |
424 y=cutItemToInt( in,',',4 ); | |
425 sx=cutItemToInt( in,',',5 ); | |
426 sy=cutItemToInt( in,',',6 ); | |
1693 | 427 cutItem( in,tmp,',',7 ); msg=appFindMessage( tmp ); |
428 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
429 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] potmeter: phases filename: '%s'\n",phfname ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
430 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] position: %d,%d %dx%d\n",x,y,sx,sy ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
431 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] phases: %d\n",ph ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
432 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] default value: %d\n",d ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
433 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",msg ); |
1693 | 434 |
8973 | 435 (*currSubItem)++; |
436 item=&currSubItems[ *currSubItem ]; | |
437 | |
1693 | 438 item->type=itPotmeter; |
439 item->x=x; item->y=y; | |
440 item->width=sx; item->height=sy; | |
441 item->phases=ph; | |
442 item->msg=msg; | |
443 item->value=(float)d; | |
444 | |
445 item->Bitmap.Image=NULL; | |
446 if ( strcmp( phfname,"NULL" ) ) | |
447 { | |
12646 | 448 strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, phfname, sizeof( tmp )); |
1693 | 449 if ( skinBPRead( tmp,&item->Bitmap ) ) return 1; |
450 } | |
451 return 0; | |
452 } | |
453 | |
6625 | 454 int cmd_font( char * in ) |
1693 | 455 { // font=fontname,fontid |
456 char name[512]; | |
457 char id[512]; | |
458 wItem * item; | |
459 | |
460 CHECKDEFLIST( "font" ); | |
461 CHECKWINLIST( "font" ); | |
462 | |
8973 | 463 CHECK( "sub" ); |
464 CHECK( "menu" ); | |
465 | |
1693 | 466 cutItem( in,name,',',0 ); |
467 cutItem( in,id,',',1 ); | |
468 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
469 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] font\n" ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
470 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] name: %s\n",name ); |
1693 | 471 |
8973 | 472 (*currSubItem)++; |
473 item=&currSubItems[ *currSubItem ]; | |
474 | |
1693 | 475 item->type=itFont; |
6218 | 476 item->fontid=fntRead( path,name ); |
1693 | 477 switch ( item->fontid ) |
478 { | |
1884 | 479 case -1: ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1; |
480 case -2: ERRORMESSAGE( MSGTR_SKIN_FONT_TooManyFontsDeclared ); return 1; | |
6218 | 481 case -3: ERRORMESSAGE( MSGTR_SKIN_FONT_FontFileNotFound ); return 1; |
482 case -4: ERRORMESSAGE( MSGTR_SKIN_FONT_FontImageNotFound ); return 1; | |
1693 | 483 } |
484 return 0; | |
485 } | |
486 | |
6625 | 487 int cmd_slabel( char * in ) |
1693 | 488 { |
489 char tmp[512]; | |
490 char sid[63]; | |
491 int x,y,id; | |
492 wItem * item; | |
493 | |
494 CHECKDEFLIST( "slabel" ); | |
495 CHECKWINLIST( "slabel" ); | |
496 | |
8973 | 497 CHECK( "sub" ); |
498 CHECK( "menu" ); | |
499 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
500 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] slabel\n" ); |
1693 | 501 |
1852 | 502 x=cutItemToInt( in,',',0 ); |
503 y=cutItemToInt( in,',',1 ); | |
1693 | 504 cutItem( in,sid,',',2 ); id=fntFindID( sid ); |
1884 | 505 if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; } |
1693 | 506 cutItem( in,tmp,',',3 ); cutItem( tmp,tmp,'"',1 ); |
507 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
508 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pos: %d,%d\n",x,y ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
509 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",sid,id ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
510 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp ); |
1693 | 511 |
8973 | 512 (*currSubItem)++; |
513 item=&currSubItems[ *currSubItem ]; | |
514 | |
1693 | 515 item->type=itSLabel; |
516 item->fontid=id; | |
517 item->x=x; item->y=y; | |
518 item->width=-1; item->height=-1; | |
1884 | 519 if ( ( item->label=malloc( strlen( tmp ) + 1 ) ) == NULL ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1; } |
1693 | 520 strcpy( item->label,tmp ); |
521 | |
522 return 0; | |
523 } | |
524 | |
6625 | 525 int cmd_dlabel( char * in ) |
1693 | 526 { // dlabel=x,y,sx,align,fontid,string ... |
527 char tmp[512]; | |
528 char sid[63]; | |
529 int x,y,sx,id,a; | |
530 wItem * item; | |
531 | |
532 CHECKDEFLIST( "dlabel" ); | |
533 CHECKWINLIST( "dlabel" ); | |
534 | |
8973 | 535 CHECK( "sub" ); |
536 CHECK( "menu" ); | |
537 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
538 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] dlabel\n" ); |
1693 | 539 |
1852 | 540 x=cutItemToInt( in,',',0 ); |
541 y=cutItemToInt( in,',',1 ); | |
542 sx=cutItemToInt( in,',',2 ); | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
543 a=cutItemToInt( in,',',3 ); |
1693 | 544 cutItem( in,sid,',',4 ); id=fntFindID( sid ); |
1884 | 545 if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; } |
1693 | 546 cutItem( in,tmp,',',5 ); cutItem( tmp,tmp,'"',1 ); |
547 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
548 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pos: %d,%d width: %d align: %d\n",x,y,sx,a ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
549 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",sid,id ); |
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
550 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp ); |
1693 | 551 |
8973 | 552 (*currSubItem)++; |
553 item=&currSubItems[ *currSubItem ]; | |
554 | |
1693 | 555 item->type=itDLabel; |
556 item->fontid=id; item->align=a; | |
557 item->x=x; item->y=y; | |
558 item->width=sx; item->height=-1; | |
1884 | 559 if ( ( item->label=malloc( strlen( tmp ) + 1 ) ) == NULL ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1; } |
1693 | 560 strcpy( item->label,tmp ); |
561 | |
562 return 0; | |
563 } | |
564 | |
6625 | 565 int cmd_decoration( char * in ) |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1852
diff
changeset
|
566 { |
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1852
diff
changeset
|
567 char tmp[512]; |
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1852
diff
changeset
|
568 |
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1852
diff
changeset
|
569 CHECKDEFLIST( "decoration" ); |
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1852
diff
changeset
|
570 CHECKWINLIST( "decoration" ); |
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1852
diff
changeset
|
571 |
8973 | 572 CHECK( "sub" ); |
573 CHECK( "menu" ); | |
574 CHECK( "playbar" ); | |
575 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
576 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",in ); |
8973 | 577 strlower( in ); |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1852
diff
changeset
|
578 cutItem( in,tmp,',',0 ); |
1884 | 579 if ( strcmp( tmp,"enable" )&&strcmp( tmp,"disable" ) ) { ERRORMESSAGE( MSGTR_SKIN_UnknownParameter,tmp ); return 1; } |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1852
diff
changeset
|
580 if ( strcmp( tmp,"enable" ) ) defList->mainDecoration=0; |
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1852
diff
changeset
|
581 else defList->mainDecoration=1; |
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1852
diff
changeset
|
582 |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
583 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",(defList->mainDecoration?"enabled":"disabled") ); |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1852
diff
changeset
|
584 return 0; |
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1852
diff
changeset
|
585 } |
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1852
diff
changeset
|
586 |
1693 | 587 typedef struct |
588 { | |
19110
08888397444e
marks several strings inside structs as const when they hold just
reynaldo
parents:
18335
diff
changeset
|
589 const char * name; |
1693 | 590 int (*func)( char * in ); |
591 } _item; | |
592 | |
593 _item skinItem[] = | |
594 { | |
6625 | 595 { "section", cmd_section }, |
596 { "end", cmd_end }, | |
597 { "window", cmd_window }, | |
598 { "base", cmd_base }, | |
599 { "button", cmd_button }, | |
600 { "selected", cmd_selected }, | |
601 { "background", cmd_background }, | |
8973 | 602 { "vpotmeter", cmd_vpotmeter }, |
6625 | 603 { "hpotmeter", cmd_hpotmeter }, |
604 { "potmeter", cmd_potmeter }, | |
605 { "font", cmd_font }, | |
606 { "slabel", cmd_slabel }, | |
607 { "dlabel", cmd_dlabel }, | |
608 { "decoration", cmd_decoration }, | |
609 { "menu", cmd_menu } | |
1693 | 610 }; |
611 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
612 #define ITEMS (int)( sizeof( skinItem )/sizeof( _item ) ) |
1693 | 613 |
8973 | 614 char * trimleft( char * in ) |
1693 | 615 { |
616 int c = 0; | |
617 char * out; | |
618 if ( strlen( in ) == 0 ) return NULL; | |
619 while ( in[c] == ' ' ) c++; | |
620 if ( c != 0 ) | |
621 { | |
622 out=malloc( strlen( in ) - c + 1 ); | |
623 memcpy( out,&in[c],strlen( in ) - c + 1 ); | |
624 } | |
625 else out=in; | |
626 return out; | |
627 } | |
628 | |
629 char * strswap( char * in,char what,char whereof ) | |
630 { | |
631 int i; | |
632 if ( strlen( in ) == 0 ) return NULL; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
633 for ( i=0;i<(int)strlen( in );i++ ) |
1693 | 634 if ( in[i] == what ) in[i]=whereof; |
635 return in; | |
636 } | |
637 | |
8973 | 638 char * trim( char * in ) |
1693 | 639 { |
640 int c = 0,i = 0,id = 0; | |
641 if ( strlen( in ) == 0 ) return NULL; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
642 while ( c != (int)strlen( in ) ) |
1693 | 643 { |
644 if ( in[c] == '"' ) id=!id; | |
645 if ( ( in[c] == ' ' )&&( !id ) ) | |
646 { | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
647 for ( i=0;i<(int)strlen( in ) - c; i++ ) in[c+i]=in[c+i+1]; |
1693 | 648 continue; |
649 } | |
650 c++; | |
651 } | |
652 return in; | |
653 } | |
654 | |
655 FILE * skinFile; | |
656 | |
657 void setname( char * item1, char * item2 ) | |
12646 | 658 { |
659 strlcpy(fn, item1, sizeof( fn )); | |
660 strlcat(fn, "/", sizeof( fn )); strlcat(fn, item2, sizeof( fn )); | |
661 strlcpy(path, fn, sizeof( path )); strlcat(path, "/", sizeof( path )); | |
662 strlcat(fn, "/skin", sizeof( fn )); | |
663 } | |
1693 | 664 |
665 int skinRead( char * dname ) | |
666 { | |
667 unsigned char tmp[255]; | |
668 unsigned char * ptmp; | |
669 unsigned char command[32]; | |
670 unsigned char param[256]; | |
671 int c,i; | |
672 | |
6568
297d43688572
Check for skin in user's .mplayer first so he can override systemwide skin.
atmos4
parents:
6221
diff
changeset
|
673 setname( skinDirInHome,dname ); |
1693 | 674 if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) |
675 { | |
6568
297d43688572
Check for skin in user's .mplayer first so he can override systemwide skin.
atmos4
parents:
6221
diff
changeset
|
676 setname( skinMPlayerDir,dname ); |
1693 | 677 if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) |
678 { | |
17974
9a5a62f480e6
Rename the default GUI skins directory from 'Skin' to 'skins', keeping
diego
parents:
17144
diff
changeset
|
679 setname( skinDirInHome_obsolete,dname ); |
9a5a62f480e6
Rename the default GUI skins directory from 'Skin' to 'skins', keeping
diego
parents:
17144
diff
changeset
|
680 if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) |
9a5a62f480e6
Rename the default GUI skins directory from 'Skin' to 'skins', keeping
diego
parents:
17144
diff
changeset
|
681 { |
9a5a62f480e6
Rename the default GUI skins directory from 'Skin' to 'skins', keeping
diego
parents:
17144
diff
changeset
|
682 setname( skinMPlayerDir_obsolete,dname ); |
9a5a62f480e6
Rename the default GUI skins directory from 'Skin' to 'skins', keeping
diego
parents:
17144
diff
changeset
|
683 if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) |
9a5a62f480e6
Rename the default GUI skins directory from 'Skin' to 'skins', keeping
diego
parents:
17144
diff
changeset
|
684 { |
19350
40527c0a1387
Make sure we do not print the obsolete skin path when we did not find any skin.
reimar
parents:
19110
diff
changeset
|
685 setname( skinMPlayerDir,dname ); |
17974
9a5a62f480e6
Rename the default GUI skins directory from 'Skin' to 'skins', keeping
diego
parents:
17144
diff
changeset
|
686 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_SkinFileNotFound,fn ); |
9a5a62f480e6
Rename the default GUI skins directory from 'Skin' to 'skins', keeping
diego
parents:
17144
diff
changeset
|
687 return -1; |
9a5a62f480e6
Rename the default GUI skins directory from 'Skin' to 'skins', keeping
diego
parents:
17144
diff
changeset
|
688 } |
9a5a62f480e6
Rename the default GUI skins directory from 'Skin' to 'skins', keeping
diego
parents:
17144
diff
changeset
|
689 } |
1693 | 690 } |
691 } | |
692 | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
693 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] file: %s\n",fn ); |
1693 | 694 |
5690 | 695 appInitStruct( skinAppMPlayer ); |
1693 | 696 |
697 linenumber=0; | |
15583
7490b7904417
last patch broke skin reading completely, becasue last line of skin
reimar
parents:
15554
diff
changeset
|
698 while (fgets(tmp, 255, skinFile)) |
1693 | 699 { |
15554
e93d0faac02b
Print error when skin file is not readable (e.g. a directory) instead of hanging
reimar
parents:
14156
diff
changeset
|
700 linenumber++; |
1693 | 701 |
702 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; | |
703 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; | |
4818
3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents:
3586
diff
changeset
|
704 for ( c=0;c<(int)strlen( tmp );c++ ) |
1693 | 705 if ( tmp[c] == ';' ) |
706 { | |
707 tmp[c]=0; | |
708 break; | |
709 } | |
710 if ( strlen( tmp ) == 0 ) continue; | |
8973 | 711 ptmp=trimleft( tmp ); |
1693 | 712 if ( strlen( ptmp ) == 0 ) continue; |
713 ptmp=strswap( ptmp,'\t',' ' ); | |
8973 | 714 ptmp=trim( ptmp ); |
1693 | 715 |
716 cutItem( ptmp,command,'=',0 ); cutItem( ptmp,param,'=',1 ); | |
717 strlower( command ); | |
718 for( i=0;i<ITEMS;i++ ) | |
719 if ( !strcmp( command,skinItem[i].name ) ) | |
720 if ( skinItem[i].func( param ) ) return -2; | |
721 } | |
15583
7490b7904417
last patch broke skin reading completely, becasue last line of skin
reimar
parents:
15554
diff
changeset
|
722 if (linenumber == 0) { |
7490b7904417
last patch broke skin reading completely, becasue last line of skin
reimar
parents:
15554
diff
changeset
|
723 mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SkinFileNotReadable, fn); |
7490b7904417
last patch broke skin reading completely, becasue last line of skin
reimar
parents:
15554
diff
changeset
|
724 return -1; |
7490b7904417
last patch broke skin reading completely, becasue last line of skin
reimar
parents:
15554
diff
changeset
|
725 } |
1693 | 726 return 0; |
727 } |