annotate gui/skin/skin.c @ 29321:e98825540790

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