annotate Gui/skin/skin.c @ 7624:b1a3b979c630

This patch hopefully fixes colorkeying and a segfault in exclusive mode Sascha Sommer <saschasommer@freenet.de>
author arpi
date Sun, 06 Oct 2002 16:56:42 +0000
parents 54cfbaaf161b
children 72700fefd3dc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
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 "font.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
8 #include "../app.h"
3586
a0009a534428 itt a skin nem van hibauzenet igy.
pontscho
parents: 3479
diff changeset
9
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
10 #include "../../config.h"
3586
a0009a534428 itt a skin nem van hibauzenet igy.
pontscho
parents: 3479
diff changeset
11 #include "../../mp_msg.h"
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
12 #include "../../help_mp.h"
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
13
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
14 listItems * skinAppMPlayer = &appMPlayer;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
15
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
16 int linenumber;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
17
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
18 unsigned char path[512],fn[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
19
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
20 listItems * defList = NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
21 unsigned char winList[32] = "";
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
22
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
23 #include <stdarg.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
24
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
25 void ERRORMESSAGE( const char * format, ... )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
26 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
27 char p[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
28 va_list ap;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
29 va_start( ap,format );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
30 vsnprintf( p,512,format,ap );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
31 va_end( ap );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
32 mp_msg( MSGT_GPLAYER,MSGL_STATUS,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 { \
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
39 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING1,linenumber,str ); \
1884
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 { \
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
48 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING2,linenumber,str ); \
1884
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;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
56 for( i=0;i<(int)strlen( in );i++ ) in[i]=( in[i] >= 'A' ? ( in[i] <= 'Z' ? in[i]+='A' : in[i] ) : in[i] );
1693
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
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
77 int cmd_section( char * in )
1693
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;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
82 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] sectionname: %s\n",in );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
83 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
84 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
85
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
86 int cmd_end( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
87 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
88 if ( strlen( winList ) ) winList[0]=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
89 else defList=NULL;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
90 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] end section\n" );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
91 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
92 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
93
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
94 int cmd_window( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
95 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
96 CHECKDEFLIST( "window" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
97
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
98 strlower( in );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
99 strcpy( winList,in );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
100 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window: %s\n",winList );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
101 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
102 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
103
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
104 int cmd_base( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
105 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
106 unsigned char fname[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
107 unsigned char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
108 int x,y;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
109 int sx=0,sy=0;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
110
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
111 CHECKDEFLIST( "base" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
112 CHECKWINLIST( "base" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
113
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
114 cutItem( in,fname,',',0 );
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
115 x=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
116 y=cutItemToInt( in,',',2 );
3080
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
117 sx=cutItemToInt( in,',',3 );
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
118 sy=cutItemToInt( in,',',4 );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
119 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\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
120 if ( !strcmp( winList,"main" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
121 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
122 defList->main.x=x;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
123 defList->main.y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
124 defList->main.type=itBase;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
125 strcpy( tmp,path ); strcat( tmp,fname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
126 if ( skinBPRead( tmp,&defList->main.Bitmap ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
127 defList->main.width=defList->main.Bitmap.Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
128 defList->main.height=defList->main.Bitmap.Height;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
129 #ifdef HAVE_XSHAPE
2717
5fa8c079ee3c fix small xshape bug
pontscho
parents: 2025
diff changeset
130 Convert32to1( &defList->main.Bitmap,&defList->main.Mask,0x00ff00ff );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
131 #if 0
2717
5fa8c079ee3c fix small xshape bug
pontscho
parents: 2025
diff changeset
132 {
5fa8c079ee3c fix small xshape bug
pontscho
parents: 2025
diff changeset
133 if ( defList->main.Mask.Image != NULL )
5fa8c079ee3c fix small xshape bug
pontscho
parents: 2025
diff changeset
134 {
5fa8c079ee3c fix small xshape bug
pontscho
parents: 2025
diff changeset
135 txSample d;
5fa8c079ee3c fix small xshape bug
pontscho
parents: 2025
diff changeset
136 Convert1to32( &defList->main.Mask,&d );
5fa8c079ee3c fix small xshape bug
pontscho
parents: 2025
diff changeset
137 tgaWriteTexture( "debug.tga",&d );
5fa8c079ee3c fix small xshape bug
pontscho
parents: 2025
diff changeset
138 }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
139 }
2781
bd851a5afcb3 uuupsz ... 1l cola ;)
pontscho
parents: 2717
diff changeset
140 #endif
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
141 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->main.Mask.Width,defList->main.Mask.Height );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
142 #else
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
143 defList->main.Mask.Image=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
144 #endif
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
145 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->main.width,defList->main.height );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
146 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
147 if ( !strcmp( winList,"sub" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
148 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
149 defList->sub.type=itBase;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
150 strcpy( tmp,path ); strcat( tmp,fname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
151 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
152 defList->sub.x=x;
0653e90b3118 some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents: 1884
diff changeset
153 defList->sub.y=y;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
154 defList->sub.width=defList->sub.Bitmap.Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
155 defList->sub.height=defList->sub.Bitmap.Height;
3080
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
156 if ( sx && sy )
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
157 {
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
158 defList->sub.width=sx;
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
159 defList->sub.height=sy;
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
160 }
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
161 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[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
162 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
163 if ( !strcmp( winList,"menu" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
164 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
165 defList->menuBase.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->menuBase.Bitmap ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
168 defList->menuBase.width=defList->menuBase.Bitmap.Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
169 defList->menuBase.height=defList->menuBase.Bitmap.Height;
6221
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6218
diff changeset
170 #ifdef HAVE_XSHAPE
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6218
diff changeset
171 Convert32to1( &defList->menuBase.Bitmap,&defList->menuBase.Mask,0x00ff00ff );
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6218
diff changeset
172 #if 0
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6218
diff changeset
173 {
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6218
diff changeset
174 if ( defList->menuBase.Mask.Image != NULL )
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6218
diff changeset
175 {
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6218
diff changeset
176 txSample d;
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6218
diff changeset
177 Convert1to32( &defList->menuBase.Mask,&d );
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6218
diff changeset
178 tgaWriteTexture( "debug.tga",&d );
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6218
diff changeset
179 }
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6218
diff changeset
180 }
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6218
diff changeset
181 #endif
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6218
diff changeset
182 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->menuBase.Mask.Width,defList->menuBase.Mask.Height );
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6218
diff changeset
183 #else
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6218
diff changeset
184 defList->menuBase.Mask.Image=NULL;
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6218
diff changeset
185 #endif
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
186 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->menuBase.width,defList->menuBase.height );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
187 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
188 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
189 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
190
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
191 int cmd_background( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
192 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
193 CHECKDEFLIST( "background" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
194 CHECKWINLIST( "background" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
195
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
196 if ( !strcmp( winList,"sub" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
197 {
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
198 defList->subR=cutItemToInt( in,',',0 );
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
199 defList->subG=cutItemToInt( in,',',1 );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
200 defList->subB=cutItemToInt( in,',',2 );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
201 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] subwindow background color is #%x%x%x.\n",defList->subR,defList->subG,defList->subB );
1693
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
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
206 int cmd_button( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
207 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
208 unsigned char fname[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
209 unsigned char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
210 int x,y,sx,sy;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
211 char msg[32];
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
212
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
213 CHECKDEFLIST( "button" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
214 CHECKWINLIST( "button" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
215
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
216 cutItem( in,fname,',',0 );
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
217 x=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
218 y=cutItemToInt( in,',',2 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
219 sx=cutItemToInt( in,',',3 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
220 sy=cutItemToInt( in,',',4 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
221 cutItem( in,msg,',',5 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
222
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
223 defList->NumberOfItems++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
224 defList->Items[ defList->NumberOfItems ].type=itButton;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
225 defList->Items[ defList->NumberOfItems ].x=x;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
226 defList->Items[ defList->NumberOfItems ].y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
227 defList->Items[ defList->NumberOfItems ].width=sx;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
228 defList->Items[ defList->NumberOfItems ].height=sy;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
229 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] button: fname: %s\n",fname );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
230 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
231
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
232 if ( ( defList->Items[ defList->NumberOfItems ].msg=appFindMessage( msg ) ) == -1 )
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
233 { ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 1; }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
234 defList->Items[ defList->NumberOfItems ].pressed=btnReleased;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
235 if ( defList->Items[ defList->NumberOfItems ].msg == evPauseSwitchToPlay ) defList->Items[ defList->NumberOfItems ].pressed=btnDisabled;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
236 defList->Items[ defList->NumberOfItems ].tmp=1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
237
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
238 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",defList->Items[ defList->NumberOfItems ].msg );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
239
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
240 defList->Items[ defList->NumberOfItems ].Bitmap.Image=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
241 if ( strcmp( fname,"NULL" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
242 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
243 strcpy( tmp,path ); strcat( tmp,fname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
244 if ( skinBPRead( tmp,&defList->Items[ defList->NumberOfItems ].Bitmap ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
245 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
246 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
247 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
248
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
249 int cmd_selected( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
250 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
251 unsigned char fname[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
252 unsigned char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
253
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
254 CHECKDEFLIST( "selected" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
255 CHECKWINLIST( "selected" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
256
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
257 cutItem( in,fname,',',0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
258 defList->menuSelected.type=itBase;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
259 strcpy( tmp,path ); strcat( tmp,fname );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
260 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] selected: %s\n",fname );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
261 if ( skinBPRead( tmp,&defList->menuSelected.Bitmap ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
262 defList->menuSelected.width=defList->menuSelected.Bitmap.Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
263 defList->menuSelected.height=defList->menuSelected.Bitmap.Height;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
264 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->menuSelected.width,defList->menuSelected.height );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
265 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
266 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
267
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
268 int cmd_menu( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
269 { // menu = number,x,y,sx,sy,msg
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
270 int x,y,sx,sy,msg;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
271 unsigned char tmp[64];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
272
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
273 CHECKDEFLIST( "menu" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
274 CHECKWINLIST( "menu" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
275
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
276 x=cutItemToInt( in,',',0 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
277 y=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
278 sx=cutItemToInt( in,',',2 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
279 sy=cutItemToInt( in,',',3 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
280 cutItem( in,tmp,',',4 ); msg=appFindMessage( tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
281
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
282 defList->NumberOfMenuItems++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
283 defList->MenuItems[ defList->NumberOfMenuItems ].x=x;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
284 defList->MenuItems[ defList->NumberOfMenuItems ].y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
285 defList->MenuItems[ defList->NumberOfMenuItems ].width=sx;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
286 defList->MenuItems[ defList->NumberOfMenuItems ].height=sy;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
287
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
288 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] menuitem: %d\n",defList->NumberOfMenuItems );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
289 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
290
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
291 if ( ( defList->MenuItems[ defList->NumberOfMenuItems ].msg=msg ) == -1 )
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
292 ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,tmp );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
293
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
294 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",defList->Items[ defList->NumberOfItems ].msg );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
295
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
296 defList->MenuItems[ defList->NumberOfMenuItems ].Bitmap.Image=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
297 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
298 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
299
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
300 int cmd_hpotmeter( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
301 { // hpotmeter=buttonbitmaps,sx,sy,phasebitmaps,phases,default value,x,y,sx,sy,msg
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
302 int x,y,psx,psy,ph,sx,sy,msg,d;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
303 unsigned char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
304 unsigned char pfname[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
305 unsigned char phfname[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
306 wItem * item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
307
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
308 CHECKDEFLIST( "hpotmeter" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
309 CHECKWINLIST( "hpotmeter" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
310
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
311 cutItem( in,pfname,',',0 );
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
312 psx=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
313 psy=cutItemToInt( in,',',2 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
314 cutItem( in,phfname,',',3 );
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
315 ph=cutItemToInt( in,',',4 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
316 d=cutItemToInt( in,',',5 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
317 x=cutItemToInt( in,',',6 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
318 y=cutItemToInt( in,',',7 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
319 sx=cutItemToInt( in,',',8 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
320 sy=cutItemToInt( in,',',9 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
321 cutItem( in,tmp,',',10 ); msg=appFindMessage( tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
322
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
323 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] hpotmeter: pointer filename: '%s'\n",pfname );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
324 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pointer size is %dx%d\n",psx,psy );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
325 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] phasebitmaps filename: '%s'\n",phfname );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
326 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] position: %d,%d %dx%d\n",x,y,sx,sy );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
327 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] default value: %d\n",d );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
328 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",msg );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
329
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
330 defList->NumberOfItems++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
331 item=&defList->Items[ defList->NumberOfItems ];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
332 item->type=itHPotmeter;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
333 item->x=x; item->y=y; item->width=sx; item->height=sy;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
334 item->phases=ph;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
335 item->psx=psx; item->psy=psy;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
336 item->msg=msg;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
337 item->value=(float)d;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
338 item->pressed=btnReleased;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
339
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
340 item->Bitmap.Image=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
341 if ( strcmp( phfname,"NULL" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
342 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
343 strcpy( tmp,path ); strcat( tmp,phfname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
344 if ( skinBPRead( tmp,&item->Bitmap ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
345 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
346
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
347 item->Mask.Image=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
348 if ( strcmp( pfname,"NULL" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
349 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
350 strcpy( tmp,path ); strcat( tmp,pfname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
351 if ( skinBPRead( tmp,&item->Mask ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
352 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
353
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
354 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
355 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
356
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
357 int cmd_potmeter( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
358 { // potmeter=phasebitmaps,phases,default value,x,y,sx,sy,msg
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
359 int x,y,ph,sx,sy,msg,d;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
360 unsigned char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
361 unsigned char phfname[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
362 wItem * item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
363
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
364 CHECKDEFLIST( "potmeter" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
365 CHECKWINLIST( "potmeter" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
366
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
367 cutItem( in,phfname,',',0 );
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
368 ph=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
369 d=cutItemToInt( in,',',2 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
370 x=cutItemToInt( in,',',3 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
371 y=cutItemToInt( in,',',4 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
372 sx=cutItemToInt( in,',',5 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
373 sy=cutItemToInt( in,',',6 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
374 cutItem( in,tmp,',',7 ); msg=appFindMessage( tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
375
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
376 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] potmeter: phases filename: '%s'\n",phfname );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
377 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] position: %d,%d %dx%d\n",x,y,sx,sy );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
378 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] phases: %d\n",ph );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
379 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] default value: %d\n",d );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
380 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",msg );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
381
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
382 defList->NumberOfItems++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
383 item=&defList->Items[ defList->NumberOfItems ];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
384 item->type=itPotmeter;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
385 item->x=x; item->y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
386 item->width=sx; item->height=sy;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
387 item->phases=ph;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
388 item->msg=msg;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
389 item->value=(float)d;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
390
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
391 item->Bitmap.Image=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
392 if ( strcmp( phfname,"NULL" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
393 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
394 strcpy( tmp,path ); strcat( tmp,phfname );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
395 if ( skinBPRead( tmp,&item->Bitmap ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
396 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
397 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
398 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
399
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
400 int cmd_font( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
401 { // font=fontname,fontid
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
402 char name[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
403 char id[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
404 wItem * item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
405
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
406 CHECKDEFLIST( "font" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
407 CHECKWINLIST( "font" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
408
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
409 cutItem( in,name,',',0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
410 cutItem( in,id,',',1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
411
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
412 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] font\n" );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
413 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] name: %s\n",name );
1693
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=itFont;
6218
8cfddba867b4 fix text render chrash ...
pontscho
parents: 5690
diff changeset
418 item->fontid=fntRead( path,name );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
419 switch ( item->fontid )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
420 {
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
421 case -1: ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1;
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
422 case -2: ERRORMESSAGE( MSGTR_SKIN_FONT_TooManyFontsDeclared ); return 1;
6218
8cfddba867b4 fix text render chrash ...
pontscho
parents: 5690
diff changeset
423 case -3: ERRORMESSAGE( MSGTR_SKIN_FONT_FontFileNotFound ); return 1;
8cfddba867b4 fix text render chrash ...
pontscho
parents: 5690
diff changeset
424 case -4: ERRORMESSAGE( MSGTR_SKIN_FONT_FontImageNotFound ); return 1;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
425 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
426 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
427 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
428
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
429 int cmd_slabel( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
430 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
431 char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
432 char sid[63];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
433 int x,y,id;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
434 wItem * item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
435
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
436 CHECKDEFLIST( "slabel" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
437 CHECKWINLIST( "slabel" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
438
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
439 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] slabel\n" );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
440
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
441 x=cutItemToInt( in,',',0 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
442 y=cutItemToInt( in,',',1 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
443 cutItem( in,sid,',',2 ); id=fntFindID( sid );
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
444 if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
445 cutItem( in,tmp,',',3 ); cutItem( tmp,tmp,'"',1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
446
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
447 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pos: %d,%d\n",x,y );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
448 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",sid,id );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
449 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp );
1693
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=itSLabel;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
454 item->fontid=id;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
455 item->x=x; item->y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
456 item->width=-1; item->height=-1;
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
457 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
458 strcpy( item->label,tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
459
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
460 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
461 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
462
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
463 int cmd_dlabel( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
464 { // dlabel=x,y,sx,align,fontid,string ...
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
465 char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
466 char sid[63];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
467 int x,y,sx,id,a;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
468 wItem * item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
469
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
470 CHECKDEFLIST( "dlabel" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
471 CHECKWINLIST( "dlabel" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
472
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
473 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] dlabel\n" );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
474
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
475 x=cutItemToInt( in,',',0 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
476 y=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
477 sx=cutItemToInt( in,',',2 );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
478 a=cutItemToInt( in,',',3 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
479 cutItem( in,sid,',',4 ); id=fntFindID( sid );
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
480 if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
481 cutItem( in,tmp,',',5 ); cutItem( tmp,tmp,'"',1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
482
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
483 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pos: %d,%d width: %d align: %d\n",x,y,sx,a );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
484 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",sid,id );
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
485 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
486
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
487 defList->NumberOfItems++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
488 item=&defList->Items[ defList->NumberOfItems ];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
489 item->type=itDLabel;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
490 item->fontid=id; item->align=a;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
491 item->x=x; item->y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
492 item->width=sx; item->height=-1;
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
493 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
494 strcpy( item->label,tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
495
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
496 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
497 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
498
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
499 int cmd_decoration( char * in )
1866
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
500 {
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
501 char tmp[512];
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
502
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
503 CHECKDEFLIST( "decoration" );
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
504 CHECKWINLIST( "decoration" );
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
505
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
506 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",in );
1866
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
507 cutItem( in,tmp,',',0 );
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
508 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
509 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
510 else defList->mainDecoration=1;
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
511
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
512 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",(defList->mainDecoration?"enabled":"disabled") );
1866
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
513 return 0;
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
514 }
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
515
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
516 typedef struct
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
517 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
518 char * name;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
519 int (*func)( char * in );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
520 } _item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
521
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
522 _item skinItem[] =
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
523 {
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
524 { "section", cmd_section },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
525 { "end", cmd_end },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
526 { "window", cmd_window },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
527 { "base", cmd_base },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
528 { "button", cmd_button },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
529 { "selected", cmd_selected },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
530 { "background", cmd_background },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
531 { "hpotmeter", cmd_hpotmeter },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
532 { "potmeter", cmd_potmeter },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
533 { "font", cmd_font },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
534 { "slabel", cmd_slabel },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
535 { "dlabel", cmd_dlabel },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
536 { "decoration", cmd_decoration },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
537 { "menu", cmd_menu }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
538 };
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
539
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
540 #define ITEMS (int)( sizeof( skinItem )/sizeof( _item ) )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
541
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
542 char * strdelspacesbeforecommand( char * in )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
543 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
544 int c = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
545 char * out;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
546 if ( strlen( in ) == 0 ) return NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
547 while ( in[c] == ' ' ) c++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
548 if ( c != 0 )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
549 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
550 out=malloc( strlen( in ) - c + 1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
551 memcpy( out,&in[c],strlen( in ) - c + 1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
552 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
553 else out=in;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
554 return out;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
555 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
556
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
557 char * strswap( char * in,char what,char whereof )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
558 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
559 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
560 if ( strlen( in ) == 0 ) return NULL;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
561 for ( i=0;i<(int)strlen( in );i++ )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
562 if ( in[i] == what ) in[i]=whereof;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
563 return in;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
564 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
565
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
566 char * strdelspaces( char * in )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
567 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
568 int c = 0,i = 0,id = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
569 if ( strlen( in ) == 0 ) return NULL;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
570 while ( c != (int)strlen( in ) )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
571 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
572 if ( in[c] == '"' ) id=!id;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
573 if ( ( in[c] == ' ' )&&( !id ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
574 {
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
575 for ( i=0;i<(int)strlen( in ) - c; i++ ) in[c+i]=in[c+i+1];
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
576 continue;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
577 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
578 c++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
579 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
580 return in;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
581 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
582
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
583 FILE * skinFile;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
584
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
585 void setname( char * item1, char * item2 )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
586 { 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
587
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
588 int skinRead( char * dname )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
589 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
590 unsigned char tmp[255];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
591 unsigned char * ptmp;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
592 unsigned char command[32];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
593 unsigned char param[256];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
594 int c,i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
595
6568
297d43688572 Check for skin in user's .mplayer first so he can override systemwide skin.
atmos4
parents: 6221
diff changeset
596 setname( skinDirInHome,dname );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
597 if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
598 {
6568
297d43688572 Check for skin in user's .mplayer first so he can override systemwide skin.
atmos4
parents: 6221
diff changeset
599 setname( skinMPlayerDir,dname );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
600 if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
601 {
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
602 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[skin] file ( %s ) not found.\n",fn );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
603 return -1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
604 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
605 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
606
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
607 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] file: %s\n",fn );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
608
5690
436cf6ef67fd fix skin loading bug
pontscho
parents: 5665
diff changeset
609 appInitStruct( skinAppMPlayer );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
610
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
611 linenumber=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
612 while ( !feof( skinFile ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
613 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
614 fgets( tmp,255,skinFile ); linenumber++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
615
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
616 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
617 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
618 for ( c=0;c<(int)strlen( tmp );c++ )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
619 if ( tmp[c] == ';' )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
620 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
621 tmp[c]=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
622 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
623 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
624 if ( strlen( tmp ) == 0 ) continue;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
625 ptmp=strdelspacesbeforecommand( tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
626 if ( strlen( ptmp ) == 0 ) continue;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
627 ptmp=strswap( ptmp,'\t',' ' );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
628 ptmp=strdelspaces( ptmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
629
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
630 cutItem( ptmp,command,'=',0 ); cutItem( ptmp,param,'=',1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
631 strlower( command );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
632 for( i=0;i<ITEMS;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
633 if ( !strcmp( command,skinItem[i].name ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
634 if ( skinItem[i].func( param ) ) return -2;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
635 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
636 return 0;
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 void btnModify( int event,float state )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
640 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
641 int j;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
642 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
643 if ( appMPlayer.Items[j].msg == event )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
644 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
645 switch ( appMPlayer.Items[j].type )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
646 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
647 case itButton:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
648 appMPlayer.Items[j].pressed=(int)state;
3479
2704448de713 fs button bug fix
pontscho
parents: 3080
diff changeset
649 appMPlayer.Items[j].tmp=(int)state;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
650 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
651 case itPotmeter:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
652 case itHPotmeter:
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
653 if ( state < 0.0f ) state=0.0f;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
654 if ( state > 100.f ) state=100.0f;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
655 appMPlayer.Items[j].value=state;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
656 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
657 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
658 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
659 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
660
1729
d6c99f70449e fix hprogressbar
pontscho
parents: 1713
diff changeset
661 float btnGetValue( int event )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
662 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
663 int j;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
664 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
665 if ( appMPlayer.Items[j].msg == event ) return appMPlayer.Items[j].value;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
666 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
667 }