annotate Gui/skin/skin.c @ 2469:03abc2743ed6

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