Mercurial > mplayer.hg
comparison Gui/skin/skin.c @ 4818:3473ca9ef158
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
author | pontscho |
---|---|
date | Sat, 23 Feb 2002 15:12:55 +0000 |
parents | a0009a534428 |
children | 3e7f39c4110c |
comparison
equal
deleted
inserted
replaced
4817:1e46f40dcd0e | 4818:3473ca9ef158 |
---|---|
1 | 1 |
2 #include <stdio.h> | 2 #include <stdio.h> |
3 #include <stdlib.h> | 3 #include <stdlib.h> |
4 #include <string.h> | 4 #include <string.h> |
5 | 5 |
6 #include "cut.h" | 6 #include "cut.h" |
7 #include "error.h" | |
8 #include "font.h" | 7 #include "font.h" |
9 #include "../app.h" | 8 #include "../app.h" |
10 | 9 |
11 #include "../../config.h" | 10 #include "../../config.h" |
12 #include "../../mp_msg.h" | 11 #include "../../mp_msg.h" |
29 va_list ap; | 28 va_list ap; |
30 va_start( ap,format ); | 29 va_start( ap,format ); |
31 vsnprintf( p,512,format,ap ); | 30 vsnprintf( p,512,format,ap ); |
32 va_end( ap ); | 31 va_end( ap ); |
33 // message( False,"[skin] error in skin config file on line %d: %s",linenumber,p ); | 32 // message( False,"[skin] error in skin config file on line %d: %s",linenumber,p ); |
34 message( False,MSGTR_SKIN_ERRORMESSAGE,linenumber,p ); | 33 // message( False,MSGTR_SKIN_ERRORMESSAGE,linenumber,p ); |
34 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_ERRORMESSAGE,linenumber,p ); | |
35 } | 35 } |
36 | 36 |
37 #define CHECKDEFLIST( str ) \ | 37 #define CHECKDEFLIST( str ) \ |
38 { \ | 38 { \ |
39 if ( defList == NULL ) \ | 39 if ( defList == NULL ) \ |
40 { \ | 40 { \ |
41 message( False,MSGTR_SKIN_WARNING1,linenumber,str ); \ | 41 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING1,linenumber,str ); \ |
42 return 1; \ | 42 return 1; \ |
43 } \ | 43 } \ |
44 } | 44 } |
45 | 45 |
46 #define CHECKWINLIST( str ) \ | 46 #define CHECKWINLIST( str ) \ |
47 { \ | 47 { \ |
48 if ( !strlen( winList ) ) \ | 48 if ( !strlen( winList ) ) \ |
49 { \ | 49 { \ |
50 message( False,MSGTR_SKIN_WARNING2,linenumber,str ); \ | 50 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING2,linenumber,str ); \ |
51 return 1; \ | 51 return 1; \ |
52 } \ | 52 } \ |
53 } | 53 } |
54 | 54 |
55 char * strlower( char * in ) | 55 char * strlower( char * in ) |
56 { | 56 { |
57 int i; | 57 int i; |
58 for( i=0;i<strlen( in );i++ ) in[i]=( in[i] >= 'A' ? ( in[i] <= 'Z' ? in[i]+='A' : in[i] ) : in[i] ); | 58 for( i=0;i<(int)strlen( in );i++ ) in[i]=( in[i] >= 'A' ? ( in[i] <= 'Z' ? in[i]+='A' : in[i] ) : in[i] ); |
59 return in; | 59 return in; |
60 } | 60 } |
61 | 61 |
62 int skinBPRead( char * fname, txSample * bf ) | 62 int skinBPRead( char * fname, txSample * bf ) |
63 { | 63 { |
79 int __section( char * in ) | 79 int __section( char * in ) |
80 { | 80 { |
81 strlower( in ); | 81 strlower( in ); |
82 defList=NULL; | 82 defList=NULL; |
83 if ( !strcmp( in,"movieplayer" ) ) defList=skinAppMPlayer; | 83 if ( !strcmp( in,"movieplayer" ) ) defList=skinAppMPlayer; |
84 #ifdef DEBUG | 84 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] sectionname: %s\n",in ); |
85 dbprintf( 3,"\n[skin] sectionname: %s\n",in ); | |
86 #endif | |
87 return 0; | 85 return 0; |
88 } | 86 } |
89 | 87 |
90 int __end( char * in ) | 88 int __end( char * in ) |
91 { | 89 { |
92 if ( strlen( winList ) ) winList[0]=0; | 90 if ( strlen( winList ) ) winList[0]=0; |
93 else defList=NULL; | 91 else defList=NULL; |
94 #ifdef DEBUG | 92 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] end section\n" ); |
95 dbprintf( 3,"\n[skin] end section\n" ); | |
96 #endif | |
97 return 0; | 93 return 0; |
98 } | 94 } |
99 | 95 |
100 int __window( char * in ) | 96 int __window( char * in ) |
101 { | 97 { |
102 CHECKDEFLIST( "window" ); | 98 CHECKDEFLIST( "window" ); |
103 | 99 |
104 strlower( in ); | 100 strlower( in ); |
105 strcpy( winList,in ); | 101 strcpy( winList,in ); |
106 #ifdef DEBUG | 102 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window: %s\n",winList ); |
107 dbprintf( 3,"\n[skin] window: %s\n",winList ); | |
108 #endif | |
109 return 0; | 103 return 0; |
110 } | 104 } |
111 | 105 |
112 int __base( char * in ) | 106 int __base( char * in ) |
113 { | 107 { |
114 unsigned char fname[512]; | 108 unsigned char fname[512]; |
115 unsigned char tmp[512]; | 109 unsigned char tmp[512]; |
116 int x,y; | 110 int x,y; |
117 int sx=0,sy=0; | 111 int sx=0,sy=0; |
118 | 112 |
119 CHECKDEFLIST( "base" ); | 113 CHECKDEFLIST( "base" ); |
120 CHECKWINLIST( "base" ); | 114 CHECKWINLIST( "base" ); |
121 | 115 |
122 cutItem( in,fname,',',0 ); | 116 cutItem( in,fname,',',0 ); |
123 x=cutItemToInt( in,',',1 ); | 117 x=cutItemToInt( in,',',1 ); |
124 y=cutItemToInt( in,',',2 ); | 118 y=cutItemToInt( in,',',2 ); |
125 sx=cutItemToInt( in,',',3 ); | 119 sx=cutItemToInt( in,',',3 ); |
126 sy=cutItemToInt( in,',',4 ); | 120 sy=cutItemToInt( in,',',4 ); |
127 #ifdef DEBUG | 121 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] base: %s x: %d y: %d ( %dx%d )\n",fname,x,y,sx,sy ); |
128 dbprintf( 3,"\n[skin] base: %s x: %d y: %d ( %dx%d )\n",fname,x,y,sx,sy ); | |
129 #endif | |
130 if ( !strcmp( winList,"main" ) ) | 122 if ( !strcmp( winList,"main" ) ) |
131 { | 123 { |
132 defList->main.x=x; | 124 defList->main.x=x; |
133 defList->main.y=y; | 125 defList->main.y=y; |
134 defList->main.type=itBase; | 126 defList->main.type=itBase; |
136 if ( skinBPRead( tmp,&defList->main.Bitmap ) ) return 1; | 128 if ( skinBPRead( tmp,&defList->main.Bitmap ) ) return 1; |
137 defList->main.width=defList->main.Bitmap.Width; | 129 defList->main.width=defList->main.Bitmap.Width; |
138 defList->main.height=defList->main.Bitmap.Height; | 130 defList->main.height=defList->main.Bitmap.Height; |
139 #ifdef HAVE_XSHAPE | 131 #ifdef HAVE_XSHAPE |
140 Convert32to1( &defList->main.Bitmap,&defList->main.Mask,0x00ff00ff ); | 132 Convert32to1( &defList->main.Bitmap,&defList->main.Mask,0x00ff00ff ); |
141 #if 0 | 133 #if 0 |
142 { | 134 { |
143 if ( defList->main.Mask.Image != NULL ) | 135 if ( defList->main.Mask.Image != NULL ) |
144 { | 136 { |
145 txSample d; | 137 txSample d; |
146 Convert1to32( &defList->main.Mask,&d ); | 138 Convert1to32( &defList->main.Mask,&d ); |
147 tgaWriteTexture( "debug.tga",&d ); | 139 tgaWriteTexture( "debug.tga",&d ); |
148 } | 140 } |
149 } | 141 } |
150 #endif | 142 #endif |
151 #ifdef DEBUG | 143 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->main.Mask.Width,defList->main.Mask.Height ); |
152 dbprintf( 3,"[skin] mask: %dx%d\n",defList->main.Mask.Width,defList->main.Mask.Height ); | |
153 #endif | |
154 #else | 144 #else |
155 defList->main.Mask.Image=NULL; | 145 defList->main.Mask.Image=NULL; |
156 #endif | 146 #endif |
157 #ifdef DEBUG | 147 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->main.width,defList->main.height ); |
158 dbprintf( 3,"[skin] width: %d height: %d\n",defList->main.width,defList->main.height ); | |
159 #endif | |
160 } | 148 } |
161 if ( !strcmp( winList,"sub" ) ) | 149 if ( !strcmp( winList,"sub" ) ) |
162 { | 150 { |
163 defList->sub.type=itBase; | 151 defList->sub.type=itBase; |
164 strcpy( tmp,path ); strcat( tmp,fname ); | 152 strcpy( tmp,path ); strcat( tmp,fname ); |
170 if ( sx && sy ) | 158 if ( sx && sy ) |
171 { | 159 { |
172 defList->sub.width=sx; | 160 defList->sub.width=sx; |
173 defList->sub.height=sy; | 161 defList->sub.height=sy; |
174 } | 162 } |
175 #ifdef DEBUG | 163 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] %d,%d %dx%d\n",defList->sub.x,defList->sub.y,defList->sub.width,defList->sub.height ); |
176 dbprintf( 3,"[skin] %d,%d %dx%d\n",defList->sub.x,defList->sub.y,defList->sub.width,defList->sub.height ); | |
177 #endif | |
178 } | 164 } |
179 /* | 165 /* |
180 if ( !strcmp( winList,"eq" ) ) | 166 if ( !strcmp( winList,"eq" ) ) |
181 { | 167 { |
182 defList->eq.x=x; | 168 defList->eq.x=x; |
184 defList->eq.type=itBase; | 170 defList->eq.type=itBase; |
185 strcpy( tmp,path ); strcat( tmp,fname ); | 171 strcpy( tmp,path ); strcat( tmp,fname ); |
186 if ( skinBPRead( tmp,&defList->eq.Bitmap ) ) return 1; | 172 if ( skinBPRead( tmp,&defList->eq.Bitmap ) ) return 1; |
187 defList->eq.width=defList->eq.Bitmap.Width; | 173 defList->eq.width=defList->eq.Bitmap.Width; |
188 defList->eq.height=defList->eq.Bitmap.Height; | 174 defList->eq.height=defList->eq.Bitmap.Height; |
189 #ifdef DEBUG | 175 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->eq.width,defList->eq.height ); |
190 dbprintf( 3,"[skin] width: %d height: %d\n",defList->eq.width,defList->eq.height ); | |
191 #endif | |
192 } | 176 } |
193 */ | 177 */ |
194 if ( !strcmp( winList,"menu" ) ) | 178 if ( !strcmp( winList,"menu" ) ) |
195 { | 179 { |
196 defList->menuBase.type=itBase; | 180 defList->menuBase.type=itBase; |
197 strcpy( tmp,path ); strcat( tmp,fname ); | 181 strcpy( tmp,path ); strcat( tmp,fname ); |
198 if ( skinBPRead( tmp,&defList->menuBase.Bitmap ) ) return 1; | 182 if ( skinBPRead( tmp,&defList->menuBase.Bitmap ) ) return 1; |
199 defList->menuBase.width=defList->menuBase.Bitmap.Width; | 183 defList->menuBase.width=defList->menuBase.Bitmap.Width; |
200 defList->menuBase.height=defList->menuBase.Bitmap.Height; | 184 defList->menuBase.height=defList->menuBase.Bitmap.Height; |
201 #ifdef DEBUG | 185 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->menuBase.width,defList->menuBase.height ); |
202 dbprintf( 3,"[skin] width: %d height: %d\n",defList->menuBase.width,defList->menuBase.height ); | |
203 #endif | |
204 } | 186 } |
205 return 0; | 187 return 0; |
206 } | 188 } |
207 | 189 |
208 int __background( char * in ) | 190 int __background( char * in ) |
210 CHECKDEFLIST( "background" ); | 192 CHECKDEFLIST( "background" ); |
211 CHECKWINLIST( "background" ); | 193 CHECKWINLIST( "background" ); |
212 | 194 |
213 if ( !strcmp( winList,"sub" ) ) | 195 if ( !strcmp( winList,"sub" ) ) |
214 { | 196 { |
215 defList->subR=cutItemToInt( in,',',0 ); | 197 defList->subR=cutItemToInt( in,',',0 ); |
216 defList->subG=cutItemToInt( in,',',1 ); | 198 defList->subG=cutItemToInt( in,',',1 ); |
217 defList->subB=cutItemToInt( in,',',2 ); | 199 defList->subB=cutItemToInt( in,',',2 ); |
218 #ifdef DEBUG | 200 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] subwindow background color is #%x%x%x.\n",defList->subR,defList->subG,defList->subB ); |
219 dbprintf( 3,"\n[skin] subwindow background color is #%x%x%x.\n",defList->subR,defList->subG,defList->subB ); | |
220 #endif | |
221 } | 201 } |
222 return 0; | 202 return 0; |
223 } | 203 } |
224 | 204 |
225 int __button( char * in ) | 205 int __button( char * in ) |
226 { | 206 { |
227 unsigned char fname[512]; | 207 unsigned char fname[512]; |
228 unsigned char tmp[512]; | 208 unsigned char tmp[512]; |
229 int x,y,sx,sy; | 209 int x,y,sx,sy; |
230 unsigned char msg[32]; | 210 char msg[32]; |
231 | 211 |
232 CHECKDEFLIST( "button" ); | 212 CHECKDEFLIST( "button" ); |
233 CHECKWINLIST( "button" ); | 213 CHECKWINLIST( "button" ); |
234 | 214 |
235 cutItem( in,fname,',',0 ); | 215 cutItem( in,fname,',',0 ); |
243 defList->Items[ defList->NumberOfItems ].type=itButton; | 223 defList->Items[ defList->NumberOfItems ].type=itButton; |
244 defList->Items[ defList->NumberOfItems ].x=x; | 224 defList->Items[ defList->NumberOfItems ].x=x; |
245 defList->Items[ defList->NumberOfItems ].y=y; | 225 defList->Items[ defList->NumberOfItems ].y=y; |
246 defList->Items[ defList->NumberOfItems ].width=sx; | 226 defList->Items[ defList->NumberOfItems ].width=sx; |
247 defList->Items[ defList->NumberOfItems ].height=sy; | 227 defList->Items[ defList->NumberOfItems ].height=sy; |
248 #ifdef DEBUG | 228 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] button: fname: %s\n",fname ); |
249 dbprintf( 3,"\n[skin] button: fname: %s\n",fname ); | 229 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy ); |
250 dbprintf( 3,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy ); | |
251 #endif | |
252 | 230 |
253 if ( ( defList->Items[ defList->NumberOfItems ].msg=appFindMessage( msg ) ) == -1 ) | 231 if ( ( defList->Items[ defList->NumberOfItems ].msg=appFindMessage( msg ) ) == -1 ) |
254 { ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 1; } | 232 { ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 1; } |
255 defList->Items[ defList->NumberOfItems ].pressed=btnReleased; | 233 defList->Items[ defList->NumberOfItems ].pressed=btnReleased; |
256 if ( defList->Items[ defList->NumberOfItems ].msg == evPauseSwitchToPlay ) defList->Items[ defList->NumberOfItems ].pressed=btnDisabled; | 234 if ( defList->Items[ defList->NumberOfItems ].msg == evPauseSwitchToPlay ) defList->Items[ defList->NumberOfItems ].pressed=btnDisabled; |
257 defList->Items[ defList->NumberOfItems ].tmp=1; | 235 defList->Items[ defList->NumberOfItems ].tmp=1; |
258 | 236 |
259 #ifdef DEBUG | 237 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",defList->Items[ defList->NumberOfItems ].msg ); |
260 dbprintf( 3,"[skin] message: %d\n", | |
261 defList->Items[ defList->NumberOfItems ].msg ); | |
262 #endif | |
263 | 238 |
264 defList->Items[ defList->NumberOfItems ].Bitmap.Image=NULL; | 239 defList->Items[ defList->NumberOfItems ].Bitmap.Image=NULL; |
265 if ( strcmp( fname,"NULL" ) ) | 240 if ( strcmp( fname,"NULL" ) ) |
266 { | 241 { |
267 strcpy( tmp,path ); strcat( tmp,fname ); | 242 strcpy( tmp,path ); strcat( tmp,fname ); |
279 CHECKWINLIST( "selected" ); | 254 CHECKWINLIST( "selected" ); |
280 | 255 |
281 cutItem( in,fname,',',0 ); | 256 cutItem( in,fname,',',0 ); |
282 defList->menuSelected.type=itBase; | 257 defList->menuSelected.type=itBase; |
283 strcpy( tmp,path ); strcat( tmp,fname ); | 258 strcpy( tmp,path ); strcat( tmp,fname ); |
284 #ifdef DEBUG | 259 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] selected: %s\n",fname ); |
285 dbprintf( 3,"\n[skin] selected: %s\n",fname ); | |
286 #endif | |
287 if ( skinBPRead( tmp,&defList->menuSelected.Bitmap ) ) return 1; | 260 if ( skinBPRead( tmp,&defList->menuSelected.Bitmap ) ) return 1; |
288 defList->menuSelected.width=defList->menuSelected.Bitmap.Width; | 261 defList->menuSelected.width=defList->menuSelected.Bitmap.Width; |
289 defList->menuSelected.height=defList->menuSelected.Bitmap.Height; | 262 defList->menuSelected.height=defList->menuSelected.Bitmap.Height; |
290 #ifdef DEBUG | 263 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->menuSelected.width,defList->menuSelected.height ); |
291 dbprintf( 3,"[skin] width: %d height: %d\n",defList->menuSelected.width,defList->menuSelected.height ); | |
292 #endif | |
293 return 0; | 264 return 0; |
294 } | 265 } |
295 | 266 |
296 int __menu( char * in ) | 267 int __menu( char * in ) |
297 { // menu = number,x,y,sx,sy,msg | 268 { // menu = number,x,y,sx,sy,msg |
311 defList->MenuItems[ defList->NumberOfMenuItems ].x=x; | 282 defList->MenuItems[ defList->NumberOfMenuItems ].x=x; |
312 defList->MenuItems[ defList->NumberOfMenuItems ].y=y; | 283 defList->MenuItems[ defList->NumberOfMenuItems ].y=y; |
313 defList->MenuItems[ defList->NumberOfMenuItems ].width=sx; | 284 defList->MenuItems[ defList->NumberOfMenuItems ].width=sx; |
314 defList->MenuItems[ defList->NumberOfMenuItems ].height=sy; | 285 defList->MenuItems[ defList->NumberOfMenuItems ].height=sy; |
315 | 286 |
316 #ifdef DEBUG | 287 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] menuitem: %d\n",defList->NumberOfMenuItems ); |
317 dbprintf( 3,"\n[skin] menuitem: %d\n",defList->NumberOfMenuItems ); | 288 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy ); |
318 dbprintf( 3,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy ); | |
319 #endif | |
320 | 289 |
321 if ( ( defList->MenuItems[ defList->NumberOfMenuItems ].msg=msg ) == -1 ) | 290 if ( ( defList->MenuItems[ defList->NumberOfMenuItems ].msg=msg ) == -1 ) |
322 ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,tmp ); | 291 ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,tmp ); |
323 | 292 |
324 #ifdef DEBUG | 293 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",defList->Items[ defList->NumberOfItems ].msg ); |
325 dbprintf( 3,"[skin] message: %d\n",defList->Items[ defList->NumberOfItems ].msg ); | |
326 #endif | |
327 | 294 |
328 defList->MenuItems[ defList->NumberOfMenuItems ].Bitmap.Image=NULL; | 295 defList->MenuItems[ defList->NumberOfMenuItems ].Bitmap.Image=NULL; |
329 return 0; | 296 return 0; |
330 } | 297 } |
331 | 298 |
350 y=cutItemToInt( in,',',7 ); | 317 y=cutItemToInt( in,',',7 ); |
351 sx=cutItemToInt( in,',',8 ); | 318 sx=cutItemToInt( in,',',8 ); |
352 sy=cutItemToInt( in,',',9 ); | 319 sy=cutItemToInt( in,',',9 ); |
353 cutItem( in,tmp,',',10 ); msg=appFindMessage( tmp ); | 320 cutItem( in,tmp,',',10 ); msg=appFindMessage( tmp ); |
354 | 321 |
355 #ifdef DEBUG | 322 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] hpotmeter: pointer filename: '%s'\n",pfname ); |
356 dbprintf( 3,"\n[skin] hpotmeter: pointer filename: '%s'\n",pfname ); | 323 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pointer size is %dx%d\n",psx,psy ); |
357 dbprintf( 3, "[skin] pointer size is %dx%d\n",psx,psy ); | 324 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] phasebitmaps filename: '%s'\n",phfname ); |
358 dbprintf( 3, "[skin] phasebitmaps filename: '%s'\n",phfname ); | 325 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] position: %d,%d %dx%d\n",x,y,sx,sy ); |
359 dbprintf( 3, "[skin] position: %d,%d %dx%d\n",x,y,sx,sy ); | 326 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] default value: %d\n",d ); |
360 dbprintf( 3, "[skin] default value: %d\n",d ); | 327 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",msg ); |
361 dbprintf( 3, "[skin] message: %d\n",msg ); | |
362 #endif | |
363 | 328 |
364 defList->NumberOfItems++; | 329 defList->NumberOfItems++; |
365 item=&defList->Items[ defList->NumberOfItems ]; | 330 item=&defList->Items[ defList->NumberOfItems ]; |
366 item->type=itHPotmeter; | 331 item->type=itHPotmeter; |
367 item->x=x; item->y=y; item->width=sx; item->height=sy; | 332 item->x=x; item->y=y; item->width=sx; item->height=sy; |
405 y=cutItemToInt( in,',',4 ); | 370 y=cutItemToInt( in,',',4 ); |
406 sx=cutItemToInt( in,',',5 ); | 371 sx=cutItemToInt( in,',',5 ); |
407 sy=cutItemToInt( in,',',6 ); | 372 sy=cutItemToInt( in,',',6 ); |
408 cutItem( in,tmp,',',7 ); msg=appFindMessage( tmp ); | 373 cutItem( in,tmp,',',7 ); msg=appFindMessage( tmp ); |
409 | 374 |
410 #ifdef DEBUG | 375 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] potmeter: phases filename: '%s'\n",phfname ); |
411 dbprintf( 3,"\n[skin] potmeter: phases filename: '%s'\n",phfname ); | 376 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] position: %d,%d %dx%d\n",x,y,sx,sy ); |
412 dbprintf( 3, "[skin] position: %d,%d %dx%d\n",x,y,sx,sy ); | 377 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] phases: %d\n",ph ); |
413 dbprintf( 3, "[skin] phases: %d\n",ph ); | 378 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] default value: %d\n",d ); |
414 dbprintf( 3, "[skin] default value: %d\n",d ); | 379 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",msg ); |
415 dbprintf( 3, "[skin] message: %d\n",msg ); | |
416 #endif | |
417 | 380 |
418 defList->NumberOfItems++; | 381 defList->NumberOfItems++; |
419 item=&defList->Items[ defList->NumberOfItems ]; | 382 item=&defList->Items[ defList->NumberOfItems ]; |
420 item->type=itPotmeter; | 383 item->type=itPotmeter; |
421 item->x=x; item->y=y; | 384 item->x=x; item->y=y; |
443 CHECKWINLIST( "font" ); | 406 CHECKWINLIST( "font" ); |
444 | 407 |
445 cutItem( in,name,',',0 ); | 408 cutItem( in,name,',',0 ); |
446 cutItem( in,id,',',1 ); | 409 cutItem( in,id,',',1 ); |
447 | 410 |
448 #ifdef DEBUG | 411 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] font\n" ); |
449 dbprintf( 3,"\n[skin] font\n" ); | 412 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] name: %s\n",name ); |
450 dbprintf( 3, "[skin] name: %s\n",name ); | |
451 #endif | |
452 | 413 |
453 defList->NumberOfItems++; | 414 defList->NumberOfItems++; |
454 item=&defList->Items[ defList->NumberOfItems ]; | 415 item=&defList->Items[ defList->NumberOfItems ]; |
455 item->type=itFont; | 416 item->type=itFont; |
456 item->fontid=fntAddNewFont( name ); | 417 item->fontid=fntAddNewFont( name ); |
458 { | 419 { |
459 case -1: ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1; | 420 case -1: ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1; |
460 case -2: ERRORMESSAGE( MSGTR_SKIN_FONT_TooManyFontsDeclared ); return 1; | 421 case -2: ERRORMESSAGE( MSGTR_SKIN_FONT_TooManyFontsDeclared ); return 1; |
461 } | 422 } |
462 | 423 |
463 #ifdef DEBUG | 424 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",id,item->fontid ); |
464 dbprintf( 3, "[skin] id: %s ( %d )\n",id,item->fontid ); | |
465 #endif | |
466 | 425 |
467 switch ( fntRead( path,name,item->fontid ) ) | 426 switch ( fntRead( path,name,item->fontid ) ) |
468 { | 427 { |
469 case -1: ERRORMESSAGE( MSGTR_SKIN_FONT_FontFileNotFound ); return 1; | 428 case -1: ERRORMESSAGE( MSGTR_SKIN_FONT_FontFileNotFound ); return 1; |
470 case -2: ERRORMESSAGE( MSGTR_SKIN_FONT_FontImageNotFound ); return 1; | 429 case -2: ERRORMESSAGE( MSGTR_SKIN_FONT_FontImageNotFound ); return 1; |
481 wItem * item; | 440 wItem * item; |
482 | 441 |
483 CHECKDEFLIST( "slabel" ); | 442 CHECKDEFLIST( "slabel" ); |
484 CHECKWINLIST( "slabel" ); | 443 CHECKWINLIST( "slabel" ); |
485 | 444 |
486 #ifdef DEBUG | 445 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] slabel\n" ); |
487 dbprintf( 3,"\n[skin] slabel\n" ); | |
488 #endif | |
489 | 446 |
490 x=cutItemToInt( in,',',0 ); | 447 x=cutItemToInt( in,',',0 ); |
491 y=cutItemToInt( in,',',1 ); | 448 y=cutItemToInt( in,',',1 ); |
492 cutItem( in,sid,',',2 ); id=fntFindID( sid ); | 449 cutItem( in,sid,',',2 ); id=fntFindID( sid ); |
493 if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; } | 450 if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; } |
494 cutItem( in,tmp,',',3 ); cutItem( tmp,tmp,'"',1 ); | 451 cutItem( in,tmp,',',3 ); cutItem( tmp,tmp,'"',1 ); |
495 | 452 |
496 #ifdef DEBUG | 453 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pos: %d,%d\n",x,y ); |
497 dbprintf( 3, "[skin] pos: %d,%d\n",x,y ); | 454 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",sid,id ); |
498 dbprintf( 3, "[skin] id: %s ( %d )\n",sid,id ); | 455 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp ); |
499 dbprintf( 3, "[skin] str: '%s'\n",tmp ); | |
500 #endif | |
501 | 456 |
502 defList->NumberOfItems++; | 457 defList->NumberOfItems++; |
503 item=&defList->Items[ defList->NumberOfItems ]; | 458 item=&defList->Items[ defList->NumberOfItems ]; |
504 item->type=itSLabel; | 459 item->type=itSLabel; |
505 item->fontid=id; | 460 item->fontid=id; |
519 wItem * item; | 474 wItem * item; |
520 | 475 |
521 CHECKDEFLIST( "dlabel" ); | 476 CHECKDEFLIST( "dlabel" ); |
522 CHECKWINLIST( "dlabel" ); | 477 CHECKWINLIST( "dlabel" ); |
523 | 478 |
524 #ifdef DEBUG | 479 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] dlabel\n" ); |
525 dbprintf( 3,"\n[skin] dlabel\n" ); | |
526 #endif | |
527 | 480 |
528 x=cutItemToInt( in,',',0 ); | 481 x=cutItemToInt( in,',',0 ); |
529 y=cutItemToInt( in,',',1 ); | 482 y=cutItemToInt( in,',',1 ); |
530 sx=cutItemToInt( in,',',2 ); | 483 sx=cutItemToInt( in,',',2 ); |
531 a=cutItemToInt( in,',',3 ); | 484 a=cutItemToInt( in,',',3 ); |
532 cutItem( in,sid,',',4 ); id=fntFindID( sid ); | 485 cutItem( in,sid,',',4 ); id=fntFindID( sid ); |
533 if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; } | 486 if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; } |
534 cutItem( in,tmp,',',5 ); cutItem( tmp,tmp,'"',1 ); | 487 cutItem( in,tmp,',',5 ); cutItem( tmp,tmp,'"',1 ); |
535 | 488 |
536 #ifdef DEBUG | 489 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pos: %d,%d width: %d align: %d\n",x,y,sx,a ); |
537 dbprintf( 3,"[skin] pos: %d,%d width: %d align: %d\n",x,y,sx,a ); | 490 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",sid,id ); |
538 dbprintf( 3,"[skin] id: %s ( %d )\n",sid,id ); | 491 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp ); |
539 dbprintf( 3,"[skin] str: '%s'\n",tmp ); | |
540 #endif | |
541 | 492 |
542 defList->NumberOfItems++; | 493 defList->NumberOfItems++; |
543 item=&defList->Items[ defList->NumberOfItems ]; | 494 item=&defList->Items[ defList->NumberOfItems ]; |
544 item->type=itDLabel; | 495 item->type=itDLabel; |
545 item->fontid=id; item->align=a; | 496 item->fontid=id; item->align=a; |
556 char tmp[512]; | 507 char tmp[512]; |
557 | 508 |
558 CHECKDEFLIST( "decoration" ); | 509 CHECKDEFLIST( "decoration" ); |
559 CHECKWINLIST( "decoration" ); | 510 CHECKWINLIST( "decoration" ); |
560 | 511 |
561 #ifdef DEBUG | 512 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",in ); |
562 dbprintf( 0,"\n[skin] window decoration is %s\n",in ); | |
563 #endif | |
564 cutItem( in,tmp,',',0 ); | 513 cutItem( in,tmp,',',0 ); |
565 if ( strcmp( tmp,"enable" )&&strcmp( tmp,"disable" ) ) { ERRORMESSAGE( MSGTR_SKIN_UnknownParameter,tmp ); return 1; } | 514 if ( strcmp( tmp,"enable" )&&strcmp( tmp,"disable" ) ) { ERRORMESSAGE( MSGTR_SKIN_UnknownParameter,tmp ); return 1; } |
566 if ( strcmp( tmp,"enable" ) ) defList->mainDecoration=0; | 515 if ( strcmp( tmp,"enable" ) ) defList->mainDecoration=0; |
567 else defList->mainDecoration=1; | 516 else defList->mainDecoration=1; |
568 | 517 |
569 #ifdef DEBUG | 518 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",(defList->mainDecoration?"enabled":"disabled") ); |
570 dbprintf( 3,"\n[skin] window decoration is %s\n",(defList->mainDecoration?"enabled":"disabled") ); | |
571 #endif | |
572 return 0; | 519 return 0; |
573 } | 520 } |
574 | 521 |
575 typedef struct | 522 typedef struct |
576 { | 523 { |
594 { "dlabel", __dlabel }, | 541 { "dlabel", __dlabel }, |
595 { "decoration", __decoration }, | 542 { "decoration", __decoration }, |
596 { "menu", __menu } | 543 { "menu", __menu } |
597 }; | 544 }; |
598 | 545 |
599 #define ITEMS ( sizeof( skinItem )/sizeof( _item ) ) | 546 #define ITEMS (int)( sizeof( skinItem )/sizeof( _item ) ) |
600 | 547 |
601 char * strdelspacesbeforecommand( char * in ) | 548 char * strdelspacesbeforecommand( char * in ) |
602 { | 549 { |
603 int c = 0; | 550 int c = 0; |
604 char * out; | 551 char * out; |
615 | 562 |
616 char * strswap( char * in,char what,char whereof ) | 563 char * strswap( char * in,char what,char whereof ) |
617 { | 564 { |
618 int i; | 565 int i; |
619 if ( strlen( in ) == 0 ) return NULL; | 566 if ( strlen( in ) == 0 ) return NULL; |
620 for ( i=0;i<strlen( in );i++ ) | 567 for ( i=0;i<(int)strlen( in );i++ ) |
621 if ( in[i] == what ) in[i]=whereof; | 568 if ( in[i] == what ) in[i]=whereof; |
622 return in; | 569 return in; |
623 } | 570 } |
624 | 571 |
625 char * strdelspaces( char * in ) | 572 char * strdelspaces( char * in ) |
626 { | 573 { |
627 int c = 0,i = 0,id = 0; | 574 int c = 0,i = 0,id = 0; |
628 if ( strlen( in ) == 0 ) return NULL; | 575 if ( strlen( in ) == 0 ) return NULL; |
629 while ( c != strlen( in ) ) | 576 while ( c != (int)strlen( in ) ) |
630 { | 577 { |
631 if ( in[c] == '"' ) id=!id; | 578 if ( in[c] == '"' ) id=!id; |
632 if ( ( in[c] == ' ' )&&( !id ) ) | 579 if ( ( in[c] == ' ' )&&( !id ) ) |
633 { | 580 { |
634 for ( i=0;i<strlen( in ) - c; i++ ) in[c+i]=in[c+i+1]; | 581 for ( i=0;i<(int)strlen( in ) - c; i++ ) in[c+i]=in[c+i+1]; |
635 continue; | 582 continue; |
636 } | 583 } |
637 c++; | 584 c++; |
638 } | 585 } |
639 return in; | 586 return in; |
656 if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) | 603 if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) |
657 { | 604 { |
658 setname( skinDirInHome,dname ); | 605 setname( skinDirInHome,dname ); |
659 if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) | 606 if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) |
660 { | 607 { |
661 dbprintf( 3,"[skin] file ( %s ) not found.\n",fn ); | 608 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[skin] file ( %s ) not found.\n",fn ); |
662 return -1; | 609 return -1; |
663 } | 610 } |
664 } | 611 } |
665 | 612 |
666 #ifdef DEBUG | 613 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] file: %s\n",fn ); |
667 dbprintf( 3,"[skin] file: %s\n",fn ); | |
668 #endif | |
669 | 614 |
670 appInitStruct( &appMPlayer ); | 615 appInitStruct( &appMPlayer ); |
671 | 616 |
672 linenumber=0; | 617 linenumber=0; |
673 while ( !feof( skinFile ) ) | 618 while ( !feof( skinFile ) ) |
674 { | 619 { |
675 fgets( tmp,255,skinFile ); linenumber++; | 620 fgets( tmp,255,skinFile ); linenumber++; |
676 | 621 |
677 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; | 622 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; |
678 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; | 623 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; |
679 for ( c=0;c<strlen( tmp );c++ ) | 624 for ( c=0;c<(int)strlen( tmp );c++ ) |
680 if ( tmp[c] == ';' ) | 625 if ( tmp[c] == ';' ) |
681 { | 626 { |
682 tmp[c]=0; | 627 tmp[c]=0; |
683 break; | 628 break; |
684 } | 629 } |