annotate gui/skin/skin.c @ 32619:34c4e6ff7b17

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