annotate Gui/skin/skin.c @ 3145:78e11396f431

runtime cpu detection
author michael
date Mon, 26 Nov 2001 21:55:22 +0000
parents 182163807172
children 2704448de713
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1713
diff changeset
1
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
2 #include <stdio.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
3 #include <stdlib.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
4 #include <string.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
5
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
6 #include "cut.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
7 #include "error.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
8 #include "font.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
9 #include "../app.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
10 #include "../../config.h"
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
11 #include "../../help_mp.h"
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
12
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
13 listItems * skinAppMPlayer = &appMPlayer;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
14
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
15 int linenumber;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
16
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
17 unsigned char path[512],fn[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
18
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
19 listItems * defList = NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
20 unsigned char winList[32] = "";
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
21
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
22 #include <stdarg.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
23
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
24 void ERRORMESSAGE( const char * format, ... )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
25 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
26 char p[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
27 va_list ap;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
28 va_start( ap,format );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
29 vsnprintf( p,512,format,ap );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
30 va_end( ap );
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
31 // message( False,"[skin] error in skin config file on line %d: %s",linenumber,p );
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
32 message( False,MSGTR_SKIN_ERRORMESSAGE,linenumber,p );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
33 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
34
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
35 #define CHECKDEFLIST( str ) \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
36 { \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
37 if ( defList == NULL ) \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
38 { \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
39 message( False,MSGTR_SKIN_WARNING1,linenumber,str ); \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
40 return 1; \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
41 } \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
42 }
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
43
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
44 #define CHECKWINLIST( str ) \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
45 { \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
46 if ( !strlen( winList ) ) \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
47 { \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
48 message( False,MSGTR_SKIN_WARNING2,linenumber,str ); \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
49 return 1; \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
50 } \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
51 }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
52
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
53 char * strlower( char * in )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
54 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
55 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
56 for( i=0;i<strlen( in );i++ ) in[i]=( in[i] >= 'A' ? ( in[i] <= 'Z' ? in[i]+='A' : in[i] ) : in[i] );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
57 return in;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
58 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
59
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
60 int skinBPRead( char * fname, txSample * bf )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
61 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
62 int i=bpRead( fname,bf );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
63 switch ( i )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
64 {
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
65 case -1: ERRORMESSAGE( MSGTR_SKIN_BITMAP_16bit,fname ); break;
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
66 case -2: ERRORMESSAGE( MSGTR_SKIN_BITMAP_FileNotFound,fname ); break;
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
67 case -3: ERRORMESSAGE( MSGTR_SKIN_BITMAP_BMPReadError,fname ); break;
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
68 case -4: ERRORMESSAGE( MSGTR_SKIN_BITMAP_TGAReadError,fname ); break;
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
69 case -5: ERRORMESSAGE( MSGTR_SKIN_BITMAP_PNGReadError,fname ); break;
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
70 case -6: ERRORMESSAGE( MSGTR_SKIN_BITMAP_RLENotSupported,fname ); break;
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
71 case -7: ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownFileType,fname ); break;
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
72 case -8: ERRORMESSAGE( MSGTR_SKIN_BITMAP_ConvertError,fname ); break;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
73 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
74 return i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
75 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
76
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
77 int __section( char * in )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
78 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
79 strlower( in );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
80 defList=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
81 if ( !strcmp( in,"movieplayer" ) ) defList=skinAppMPlayer;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
82 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
83 dbprintf( 3,"\n[skin] sectionname: %s\n",in );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
84 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
85 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
86 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
87
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
88 int __end( char * in )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
89 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
90 if ( strlen( winList ) ) winList[0]=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
91 else defList=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
92 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
93 dbprintf( 3,"\n[skin] end section\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
94 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
95 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
96 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
97
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
98 int __window( char * in )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
99 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
100 CHECKDEFLIST( "window" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
101
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
102 strlower( in );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
103 strcpy( winList,in );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
104 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
105 dbprintf( 3,"\n[skin] window: %s\n",winList );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
106 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
107 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
108 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
109
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
110 int __base( char * in )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
111 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
112 unsigned char fname[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
113 unsigned char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
114 int x,y;
3080
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
115 int sx=0,sy=0;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
116
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
117 CHECKDEFLIST( "base" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
118 CHECKWINLIST( "base" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
119
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
120 cutItem( in,fname,',',0 );
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
121 x=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
122 y=cutItemToInt( in,',',2 );
3080
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
123 sx=cutItemToInt( in,',',3 );
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
124 sy=cutItemToInt( in,',',4 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
125 #ifdef DEBUG
3080
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
126 dbprintf( 3,"\n[skin] base: %s x: %d y: %d ( %dx%d )\n",fname,x,y,sx,sy );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
127 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
128 if ( !strcmp( winList,"main" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
129 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
130 defList->main.x=x;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
131 defList->main.y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
132 defList->main.type=itBase;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
133 strcpy( tmp,path ); strcat( tmp,fname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
134 if ( skinBPRead( tmp,&defList->main.Bitmap ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
135 defList->main.width=defList->main.Bitmap.Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
136 defList->main.height=defList->main.Bitmap.Height;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
137 #ifdef HAVE_XSHAPE
2717
5fa8c079ee3c fix small xshape bug
pontscho
parents: 2025
diff changeset
138 Convert32to1( &defList->main.Bitmap,&defList->main.Mask,0x00ff00ff );
2781
bd851a5afcb3 uuupsz ... 1l cola ;)
pontscho
parents: 2717
diff changeset
139 #if 0
2717
5fa8c079ee3c fix small xshape bug
pontscho
parents: 2025
diff changeset
140 {
5fa8c079ee3c fix small xshape bug
pontscho
parents: 2025
diff changeset
141 if ( defList->main.Mask.Image != NULL )
5fa8c079ee3c fix small xshape bug
pontscho
parents: 2025
diff changeset
142 {
5fa8c079ee3c fix small xshape bug
pontscho
parents: 2025
diff changeset
143 txSample d;
5fa8c079ee3c fix small xshape bug
pontscho
parents: 2025
diff changeset
144 Convert1to32( &defList->main.Mask,&d );
5fa8c079ee3c fix small xshape bug
pontscho
parents: 2025
diff changeset
145 tgaWriteTexture( "debug.tga",&d );
5fa8c079ee3c fix small xshape bug
pontscho
parents: 2025
diff changeset
146 }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
147 }
2781
bd851a5afcb3 uuupsz ... 1l cola ;)
pontscho
parents: 2717
diff changeset
148 #endif
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
149 #ifdef DEBUG
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
150 dbprintf( 3,"[skin] mask: %dx%d\n",defList->main.Mask.Width,defList->main.Mask.Height );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
151 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
152 #else
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
153 defList->main.Mask.Image=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
154 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
155 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
156 dbprintf( 3,"[skin] width: %d height: %d\n",defList->main.width,defList->main.height );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
157 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
158 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
159 if ( !strcmp( winList,"sub" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
160 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
161 defList->sub.type=itBase;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
162 strcpy( tmp,path ); strcat( tmp,fname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
163 if ( skinBPRead( tmp,&defList->sub.Bitmap ) ) return 1;
2025
0653e90b3118 some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents: 1884
diff changeset
164 defList->sub.x=x;
0653e90b3118 some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents: 1884
diff changeset
165 defList->sub.y=y;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
166 defList->sub.width=defList->sub.Bitmap.Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
167 defList->sub.height=defList->sub.Bitmap.Height;
3080
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
168 if ( sx && sy )
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
169 {
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
170 defList->sub.width=sx;
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
171 defList->sub.height=sy;
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
172 }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
173 #ifdef DEBUG
2025
0653e90b3118 some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents: 1884
diff changeset
174 dbprintf( 3,"[skin] %d,%d %dx%d\n",defList->sub.x,defList->sub.y,defList->sub.width,defList->sub.height );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
175 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
176 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
177 /*
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
178 if ( !strcmp( winList,"eq" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
179 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
180 defList->eq.x=x;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
181 defList->eq.y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
182 defList->eq.type=itBase;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
183 strcpy( tmp,path ); strcat( tmp,fname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
184 if ( skinBPRead( tmp,&defList->eq.Bitmap ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
185 defList->eq.width=defList->eq.Bitmap.Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
186 defList->eq.height=defList->eq.Bitmap.Height;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
187 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
188 dbprintf( 3,"[skin] width: %d height: %d\n",defList->eq.width,defList->eq.height );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
189 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
190 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
191 */
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
192 if ( !strcmp( winList,"menu" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
193 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
194 defList->menuBase.type=itBase;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
195 strcpy( tmp,path ); strcat( tmp,fname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
196 if ( skinBPRead( tmp,&defList->menuBase.Bitmap ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
197 defList->menuBase.width=defList->menuBase.Bitmap.Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
198 defList->menuBase.height=defList->menuBase.Bitmap.Height;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
199 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
200 dbprintf( 3,"[skin] width: %d height: %d\n",defList->menuBase.width,defList->menuBase.height );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
201 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
202 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
203 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
204 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
205
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
206 int __background( char * in )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
207 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
208 CHECKDEFLIST( "background" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
209 CHECKWINLIST( "background" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
210
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
211 if ( !strcmp( winList,"sub" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
212 {
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
213 defList->subR=cutItemToInt( in,',',0 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
214 defList->subG=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
215 defList->subB=cutItemToInt( in,',',2 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
216 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
217 dbprintf( 3,"\n[skin] subwindow background color is #%x%x%x.\n",defList->subR,defList->subG,defList->subB );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
218 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
219 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
220 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
221 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
222
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
223 int __button( char * in )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
224 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
225 unsigned char fname[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
226 unsigned char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
227 int x,y,sx,sy;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
228 unsigned char msg[32];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
229
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
230 CHECKDEFLIST( "button" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
231 CHECKWINLIST( "button" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
232
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
233 cutItem( in,fname,',',0 );
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
234 x=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
235 y=cutItemToInt( in,',',2 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
236 sx=cutItemToInt( in,',',3 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
237 sy=cutItemToInt( in,',',4 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
238 cutItem( in,msg,',',5 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
239
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
240 defList->NumberOfItems++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
241 defList->Items[ defList->NumberOfItems ].type=itButton;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
242 defList->Items[ defList->NumberOfItems ].x=x;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
243 defList->Items[ defList->NumberOfItems ].y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
244 defList->Items[ defList->NumberOfItems ].width=sx;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
245 defList->Items[ defList->NumberOfItems ].height=sy;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
246 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
247 dbprintf( 3,"\n[skin] button: fname: %s\n",fname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
248 dbprintf( 3,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
249 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
250
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
251 if ( ( defList->Items[ defList->NumberOfItems ].msg=appFindMessage( msg ) ) == -1 )
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
252 { ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 1; }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
253 defList->Items[ defList->NumberOfItems ].pressed=btnReleased;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
254 if ( defList->Items[ defList->NumberOfItems ].msg == evPauseSwitchToPlay ) defList->Items[ defList->NumberOfItems ].pressed=btnDisabled;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
255 defList->Items[ defList->NumberOfItems ].tmp=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
256
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
257 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
258 dbprintf( 3,"[skin] message: %d\n",
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
259 defList->Items[ defList->NumberOfItems ].msg );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
260 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
261
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
262 defList->Items[ defList->NumberOfItems ].Bitmap.Image=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
263 if ( strcmp( fname,"NULL" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
264 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
265 strcpy( tmp,path ); strcat( tmp,fname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
266 if ( skinBPRead( tmp,&defList->Items[ defList->NumberOfItems ].Bitmap ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
267 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
268 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
269 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
270
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
271 int __selected( char * in )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
272 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
273 unsigned char fname[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
274 unsigned char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
275
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
276 CHECKDEFLIST( "selected" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
277 CHECKWINLIST( "selected" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
278
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
279 cutItem( in,fname,',',0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
280 defList->menuSelected.type=itBase;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
281 strcpy( tmp,path ); strcat( tmp,fname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
282 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
283 dbprintf( 3,"\n[skin] selected: %s\n",fname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
284 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
285 if ( skinBPRead( tmp,&defList->menuSelected.Bitmap ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
286 defList->menuSelected.width=defList->menuSelected.Bitmap.Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
287 defList->menuSelected.height=defList->menuSelected.Bitmap.Height;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
288 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
289 dbprintf( 3,"[skin] width: %d height: %d\n",defList->menuSelected.width,defList->menuSelected.height );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
290 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
291 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
292 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
293
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
294 int __menu( char * in )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
295 { // menu = number,x,y,sx,sy,msg
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
296 int x,y,sx,sy,msg;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
297 unsigned char tmp[64];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
298
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
299 CHECKDEFLIST( "menu" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
300 CHECKWINLIST( "menu" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
301
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
302 x=cutItemToInt( in,',',0 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
303 y=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
304 sx=cutItemToInt( in,',',2 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
305 sy=cutItemToInt( in,',',3 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
306 cutItem( in,tmp,',',4 ); msg=appFindMessage( tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
307
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
308 defList->NumberOfMenuItems++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
309 defList->MenuItems[ defList->NumberOfMenuItems ].x=x;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
310 defList->MenuItems[ defList->NumberOfMenuItems ].y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
311 defList->MenuItems[ defList->NumberOfMenuItems ].width=sx;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
312 defList->MenuItems[ defList->NumberOfMenuItems ].height=sy;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
313
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
314 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
315 dbprintf( 3,"\n[skin] menuitem: %d\n",defList->NumberOfMenuItems );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
316 dbprintf( 3,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
317 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
318
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
319 if ( ( defList->MenuItems[ defList->NumberOfMenuItems ].msg=msg ) == -1 )
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
320 ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,tmp );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
321
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
322 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
323 dbprintf( 3,"[skin] message: %d\n",defList->Items[ defList->NumberOfItems ].msg );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
324 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
325
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
326 defList->MenuItems[ defList->NumberOfMenuItems ].Bitmap.Image=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
327 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
328 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
329
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
330 int __hpotmeter( char * in )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
331 { // hpotmeter=buttonbitmaps,sx,sy,phasebitmaps,phases,default value,x,y,sx,sy,msg
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
332 int x,y,psx,psy,ph,sx,sy,msg,d;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
333 unsigned char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
334 unsigned char pfname[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
335 unsigned char phfname[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
336 wItem * item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
337
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
338 CHECKDEFLIST( "hpotmeter" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
339 CHECKWINLIST( "hpotmeter" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
340
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
341 cutItem( in,pfname,',',0 );
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
342 psx=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
343 psy=cutItemToInt( in,',',2 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
344 cutItem( in,phfname,',',3 );
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
345 ph=cutItemToInt( in,',',4 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
346 d=cutItemToInt( in,',',5 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
347 x=cutItemToInt( in,',',6 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
348 y=cutItemToInt( in,',',7 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
349 sx=cutItemToInt( in,',',8 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
350 sy=cutItemToInt( in,',',9 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
351 cutItem( in,tmp,',',10 ); msg=appFindMessage( tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
352
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
353 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
354 dbprintf( 3,"\n[skin] hpotmeter: pointer filename: '%s'\n",pfname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
355 dbprintf( 3, "[skin] pointer size is %dx%d\n",psx,psy );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
356 dbprintf( 3, "[skin] phasebitmaps filename: '%s'\n",phfname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
357 dbprintf( 3, "[skin] position: %d,%d %dx%d\n",x,y,sx,sy );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
358 dbprintf( 3, "[skin] default value: %d\n",d );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
359 dbprintf( 3, "[skin] message: %d\n",msg );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
360 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
361
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
362 defList->NumberOfItems++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
363 item=&defList->Items[ defList->NumberOfItems ];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
364 item->type=itHPotmeter;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
365 item->x=x; item->y=y; item->width=sx; item->height=sy;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
366 item->phases=ph;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
367 item->psx=psx; item->psy=psy;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
368 item->msg=msg;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
369 item->value=(float)d;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
370 item->pressed=btnReleased;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
371
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
372 item->Bitmap.Image=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
373 if ( strcmp( phfname,"NULL" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
374 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
375 strcpy( tmp,path ); strcat( tmp,phfname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
376 if ( skinBPRead( tmp,&item->Bitmap ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
377 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
378
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
379 item->Mask.Image=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
380 if ( strcmp( pfname,"NULL" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
381 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
382 strcpy( tmp,path ); strcat( tmp,pfname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
383 if ( skinBPRead( tmp,&item->Mask ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
384 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
385
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
386 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
387 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
388
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
389 int __potmeter( char * in )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
390 { // potmeter=phasebitmaps,phases,default value,x,y,sx,sy,msg
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
391 int x,y,ph,sx,sy,msg,d;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
392 unsigned char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
393 unsigned char phfname[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
394 wItem * item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
395
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
396 CHECKDEFLIST( "potmeter" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
397 CHECKWINLIST( "potmeter" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
398
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
399 cutItem( in,phfname,',',0 );
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
400 ph=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
401 d=cutItemToInt( in,',',2 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
402 x=cutItemToInt( in,',',3 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
403 y=cutItemToInt( in,',',4 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
404 sx=cutItemToInt( in,',',5 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
405 sy=cutItemToInt( in,',',6 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
406 cutItem( in,tmp,',',7 ); msg=appFindMessage( tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
407
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
408 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
409 dbprintf( 3,"\n[skin] potmeter: phases filename: '%s'\n",phfname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
410 dbprintf( 3, "[skin] position: %d,%d %dx%d\n",x,y,sx,sy );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
411 dbprintf( 3, "[skin] phases: %d\n",ph );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
412 dbprintf( 3, "[skin] default value: %d\n",d );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
413 dbprintf( 3, "[skin] message: %d\n",msg );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
414 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
415
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
416 defList->NumberOfItems++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
417 item=&defList->Items[ defList->NumberOfItems ];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
418 item->type=itPotmeter;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
419 item->x=x; item->y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
420 item->width=sx; item->height=sy;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
421 item->phases=ph;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
422 item->msg=msg;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
423 item->value=(float)d;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
424
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
425 item->Bitmap.Image=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
426 if ( strcmp( phfname,"NULL" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
427 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
428 strcpy( tmp,path ); strcat( tmp,phfname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
429 if ( skinBPRead( tmp,&item->Bitmap ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
430 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
431 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
432 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
433
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
434 int __font( char * in )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
435 { // font=fontname,fontid
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
436 char name[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
437 char id[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
438 wItem * item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
439
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
440 CHECKDEFLIST( "font" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
441 CHECKWINLIST( "font" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
442
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
443 cutItem( in,name,',',0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
444 cutItem( in,id,',',1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
445
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
446 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
447 dbprintf( 3,"\n[skin] font\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
448 dbprintf( 3, "[skin] name: %s\n",name );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
449 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
450
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
451 defList->NumberOfItems++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
452 item=&defList->Items[ defList->NumberOfItems ];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
453 item->type=itFont;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
454 item->fontid=fntAddNewFont( name );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
455 switch ( item->fontid )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
456 {
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
457 case -1: ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1;
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
458 case -2: ERRORMESSAGE( MSGTR_SKIN_FONT_TooManyFontsDeclared ); return 1;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
459 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
460
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
461 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
462 dbprintf( 3, "[skin] id: %s ( %d )\n",id,item->fontid );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
463 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
464
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
465 switch ( fntRead( path,name,item->fontid ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
466 {
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
467 case -1: ERRORMESSAGE( MSGTR_SKIN_FONT_FontFileNotFound ); return 1;
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
468 case -2: ERRORMESSAGE( MSGTR_SKIN_FONT_FontImageNotFound ); return 1;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
469 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
470
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
471 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
472 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
473
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
474 int __slabel( char * in )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
475 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
476 char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
477 char sid[63];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
478 int x,y,id;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
479 wItem * item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
480
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
481 CHECKDEFLIST( "slabel" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
482 CHECKWINLIST( "slabel" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
483
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
484 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
485 dbprintf( 3,"\n[skin] slabel\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
486 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
487
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
488 x=cutItemToInt( in,',',0 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
489 y=cutItemToInt( in,',',1 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
490 cutItem( in,sid,',',2 ); id=fntFindID( sid );
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
491 if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
492 cutItem( in,tmp,',',3 ); cutItem( tmp,tmp,'"',1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
493
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
494 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
495 dbprintf( 3, "[skin] pos: %d,%d\n",x,y );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
496 dbprintf( 3, "[skin] id: %s ( %d )\n",sid,id );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
497 dbprintf( 3, "[skin] str: '%s'\n",tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
498 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
499
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
500 defList->NumberOfItems++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
501 item=&defList->Items[ defList->NumberOfItems ];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
502 item->type=itSLabel;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
503 item->fontid=id;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
504 item->x=x; item->y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
505 item->width=-1; item->height=-1;
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
506 if ( ( item->label=malloc( strlen( tmp ) + 1 ) ) == NULL ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1; }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
507 strcpy( item->label,tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
508
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
509 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
510 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
511
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
512 int __dlabel( char * in )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
513 { // dlabel=x,y,sx,align,fontid,string ...
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
514 char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
515 char sid[63];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
516 int x,y,sx,id,a;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
517 wItem * item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
518
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
519 CHECKDEFLIST( "dlabel" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
520 CHECKWINLIST( "dlabel" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
521
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
522 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
523 dbprintf( 3,"\n[skin] dlabel\n" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
524 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
525
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
526 x=cutItemToInt( in,',',0 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
527 y=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
528 sx=cutItemToInt( in,',',2 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
529 a=cutItemToInt( in,',',3 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
530 cutItem( in,sid,',',4 ); id=fntFindID( sid );
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
531 if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
532 cutItem( in,tmp,',',5 ); cutItem( tmp,tmp,'"',1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
533
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
534 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
535 dbprintf( 3,"[skin] pos: %d,%d width: %d align: %d\n",x,y,sx,a );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
536 dbprintf( 3,"[skin] id: %s ( %d )\n",sid,id );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
537 dbprintf( 3,"[skin] str: '%s'\n",tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
538 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
539
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
540 defList->NumberOfItems++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
541 item=&defList->Items[ defList->NumberOfItems ];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
542 item->type=itDLabel;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
543 item->fontid=id; item->align=a;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
544 item->x=x; item->y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
545 item->width=sx; item->height=-1;
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
546 if ( ( item->label=malloc( strlen( tmp ) + 1 ) ) == NULL ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1; }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
547 strcpy( item->label,tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
548
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
549 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
550 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
551
1866
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
552 int __decoration( char * in )
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
553 {
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
554 char tmp[512];
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
555
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
556 CHECKDEFLIST( "decoration" );
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
557 CHECKWINLIST( "decoration" );
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
558
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
559 #ifdef DEBUG
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
560 dbprintf( 0,"\n[skin] window decoration is %s\n",in );
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
561 #endif
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
562 cutItem( in,tmp,',',0 );
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
563 if ( strcmp( tmp,"enable" )&&strcmp( tmp,"disable" ) ) { ERRORMESSAGE( MSGTR_SKIN_UnknownParameter,tmp ); return 1; }
1866
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
564 if ( strcmp( tmp,"enable" ) ) defList->mainDecoration=0;
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
565 else defList->mainDecoration=1;
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
566
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
567 #ifdef DEBUG
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
568 dbprintf( 3,"\n[skin] window decoration is %s\n",(defList->mainDecoration?"enabled":"disabled") );
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
569 #endif
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
570 return 0;
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
571 }
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
572
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
573 typedef struct
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
574 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
575 char * name;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
576 int (*func)( char * in );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
577 } _item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
578
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
579 _item skinItem[] =
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
580 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
581 { "section", __section },
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
582 { "end", __end },
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
583 { "window", __window },
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
584 { "base", __base },
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
585 { "button", __button },
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
586 { "selected", __selected },
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
587 { "background", __background },
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
588 { "hpotmeter", __hpotmeter },
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
589 { "potmeter", __potmeter },
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
590 { "font", __font },
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
591 { "slabel", __slabel },
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
592 { "dlabel", __dlabel },
1866
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
593 { "decoration", __decoration },
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
594 { "menu", __menu }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
595 };
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
596
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
597 #define ITEMS ( sizeof( skinItem )/sizeof( _item ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
598
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
599 char * strdelspacesbeforecommand( char * in )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
600 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
601 int c = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
602 char * out;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
603 if ( strlen( in ) == 0 ) return NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
604 while ( in[c] == ' ' ) c++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
605 if ( c != 0 )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
606 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
607 out=malloc( strlen( in ) - c + 1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
608 memcpy( out,&in[c],strlen( in ) - c + 1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
609 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
610 else out=in;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
611 return out;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
612 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
613
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
614 char * strswap( char * in,char what,char whereof )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
615 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
616 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
617 if ( strlen( in ) == 0 ) return NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
618 for ( i=0;i<strlen( in );i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
619 if ( in[i] == what ) in[i]=whereof;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
620 return in;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
621 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
622
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
623 char * strdelspaces( char * in )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
624 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
625 int c = 0,i = 0,id = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
626 if ( strlen( in ) == 0 ) return NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
627 while ( c != strlen( in ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
628 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
629 if ( in[c] == '"' ) id=!id;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
630 if ( ( in[c] == ' ' )&&( !id ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
631 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
632 for ( i=0;i<strlen( in ) - c; i++ ) in[c+i]=in[c+i+1];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
633 continue;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
634 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
635 c++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
636 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
637 return in;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
638 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
639
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
640 FILE * skinFile;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
641
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
642 void setname( char * item1, char * item2 )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
643 { strcpy( fn,item1 ); strcat( fn,"/" ); strcat( fn,item2 ); strcpy( path,fn ); strcat( path,"/" ); strcat( fn,"/skin" ); }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
644
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
645 int skinRead( char * dname )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
646 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
647 unsigned char tmp[255];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
648 unsigned char * ptmp;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
649 unsigned char command[32];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
650 unsigned char param[256];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
651 int c,i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
652
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
653 setname( skinMPlayerDir,dname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
654 if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
655 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
656 setname( skinDirInHome,dname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
657 if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
658 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
659 dbprintf( 3,"[skin] file ( %s ) not found.\n",fn );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
660 return -1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
661 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
662 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
663
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
664 #ifdef DEBUG
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
665 dbprintf( 3,"[skin] file: %s\n",fn );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
666 #endif
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
667
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
668 appInitStruct( &appMPlayer );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
669
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
670 linenumber=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
671 while ( !feof( skinFile ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
672 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
673 fgets( tmp,255,skinFile ); linenumber++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
674
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
675 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
676 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
677 for ( c=0;c<strlen( tmp );c++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
678 if ( tmp[c] == ';' )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
679 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
680 tmp[c]=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
681 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
682 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
683 if ( strlen( tmp ) == 0 ) continue;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
684 ptmp=strdelspacesbeforecommand( tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
685 if ( strlen( ptmp ) == 0 ) continue;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
686 ptmp=strswap( ptmp,'\t',' ' );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
687 ptmp=strdelspaces( ptmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
688
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
689 cutItem( ptmp,command,'=',0 ); cutItem( ptmp,param,'=',1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
690 strlower( command );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
691 for( i=0;i<ITEMS;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
692 if ( !strcmp( command,skinItem[i].name ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
693 if ( skinItem[i].func( param ) ) return -2;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
694 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
695 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
696 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
697
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
698 void btnModify( int event,float state )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
699 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
700 int j;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
701 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
702 if ( appMPlayer.Items[j].msg == event )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
703 {
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1713
diff changeset
704 if ( appMPlayer.Items[j].used ) continue;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
705 switch ( appMPlayer.Items[j].type )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
706 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
707 case itButton:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
708 appMPlayer.Items[j].pressed=(int)state;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
709 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
710 case itPotmeter:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
711 case itHPotmeter:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
712 if ( state < 0.0f ) state=0.0f;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
713 if ( state > 100.f ) state=100.0f;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
714 appMPlayer.Items[j].value=state;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
715 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
716 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
717 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
718 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
719
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1713
diff changeset
720 float btnGetValue( int event )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
721 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
722 int j;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
723 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
724 if ( appMPlayer.Items[j].msg == event ) return appMPlayer.Items[j].value;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
725 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
726 }