annotate Gui/skin/skin.c @ 16885:22b27bd37eeb

synced with 1.98, patch by Johan Bos.
author gpoirier
date Tue, 01 Nov 2005 17:09:26 +0000
parents 7490b7904417
children 0e1471d9da74
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"
8305
4c23944315d6 - add R¸«ädiger Kuhlmann's <mplayer-list-UGa6JdjLujS2@ruediger-kuhlmann.de> patch
pontscho
parents: 8280
diff changeset
13 #include "../mplayer/widgets.h"
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
14
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
15 //#define MSGL_DBG2 MSGL_STATUS
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
16
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
17 listItems * skinAppMPlayer = &appMPlayer;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
18
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
19 // ---
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
20
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
21 static int linenumber;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
22
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
23 static unsigned char path[512],fn[512];
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
24
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
25 static listItems * defList = NULL;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
26 static unsigned char window_name[32] = "";
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
27
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
28 static wItem * currSection = NULL;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
29 static int * currSubItem = NULL;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
30 static wItem * currSubItems = NULL;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
31
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
32 #include <stdarg.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
33
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
34 void ERRORMESSAGE( const char * format, ... )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
35 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
36 char p[512];
8305
4c23944315d6 - add R¸«ädiger Kuhlmann's <mplayer-list-UGa6JdjLujS2@ruediger-kuhlmann.de> patch
pontscho
parents: 8280
diff changeset
37 char tmp[512];
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
38 va_list ap;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
39 va_start( ap,format );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
40 vsnprintf( p,512,format,ap );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
41 va_end( ap );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
42 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_ERRORMESSAGE,linenumber,p );
8305
4c23944315d6 - add R¸«ädiger Kuhlmann's <mplayer-list-UGa6JdjLujS2@ruediger-kuhlmann.de> patch
pontscho
parents: 8280
diff changeset
43 snprintf( tmp,512,MSGTR_SKIN_ERRORMESSAGE,linenumber,p );
4c23944315d6 - add R¸«ädiger Kuhlmann's <mplayer-list-UGa6JdjLujS2@ruediger-kuhlmann.de> patch
pontscho
parents: 8280
diff changeset
44 gtkMessageBox( GTK_MB_FATAL,tmp );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
45 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
46
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
47 #define CHECKDEFLIST( str ) \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
48 { \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
49 if ( defList == NULL ) \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
50 { \
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
51 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING1,linenumber,str ); \
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
52 return 1; \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
53 } \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
54 }
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
55
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
56 #define CHECKWINLIST( str ) \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
57 { \
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
58 if ( !window_name[0] ) \
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
59 { \
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
60 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING2,linenumber,str ); \
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
61 return 1; \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
62 } \
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
63 }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
64
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
65 #define CHECK( name ) \
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
66 { \
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
67 if ( !strcmp( window_name,name ) ) \
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
68 { \
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
69 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING3,linenumber,name ); \
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
70 return 1; \
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
71 } \
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
72 }
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
73
10241
31564f53c400 fix name clash fix libsmbclient, patch by Raindel Shachar <raindel@techunix.technion.ac.il>
alex
parents: 8973
diff changeset
74 static char * strlower( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
75 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
76 int i;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
77 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
78 return in;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
79 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
80
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
81 int skinBPRead( char * fname, txSample * bf )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
82 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
83 int i=bpRead( fname,bf );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
84 switch ( i )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
85 {
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
86 case -1: ERRORMESSAGE( MSGTR_SKIN_BITMAP_16bit,fname ); break;
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
87 case -2: ERRORMESSAGE( MSGTR_SKIN_BITMAP_FileNotFound,fname ); break;
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
88 case -3: ERRORMESSAGE( MSGTR_SKIN_BITMAP_BMPReadError,fname ); break;
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
89 case -4: ERRORMESSAGE( MSGTR_SKIN_BITMAP_TGAReadError,fname ); break;
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
90 case -5: ERRORMESSAGE( MSGTR_SKIN_BITMAP_PNGReadError,fname ); break;
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
91 case -6: ERRORMESSAGE( MSGTR_SKIN_BITMAP_RLENotSupported,fname ); break;
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
92 case -7: ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownFileType,fname ); break;
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
93 case -8: ERRORMESSAGE( MSGTR_SKIN_BITMAP_ConvertError,fname ); break;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
94 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
95 return i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
96 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
97
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
98 int cmd_section( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
99 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
100 strlower( in );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
101 defList=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
102 if ( !strcmp( in,"movieplayer" ) ) defList=skinAppMPlayer;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
103 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] sectionname: %s\n",in );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
104 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
105 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
106
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
107 int cmd_end( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
108 {
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
109 if ( strlen( window_name ) ) { window_name[0]=0; currSection=NULL; currSubItem=NULL; currSubItems=NULL; }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
110 else defList=NULL;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
111 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] end section\n" );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
112 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
113 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
114
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
115 int cmd_window( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
116 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
117 CHECKDEFLIST( "window" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
118
12646
9a495bdc3a1e string handling security fixes
diego
parents: 10241
diff changeset
119 strlcpy( window_name,strlower( in ),sizeof( window_name ) );
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
120 if ( !strncmp( in,"main",4 ) ) { currSection=&skinAppMPlayer->main; currSubItem=&skinAppMPlayer->NumberOfItems; currSubItems=skinAppMPlayer->Items; }
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
121 else if ( !strncmp( in,"sub",3 ) ) currSection=&skinAppMPlayer->sub;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
122 else if ( !strncmp( in,"playbar",7 ) ) { currSection=&skinAppMPlayer->bar; currSubItem=&skinAppMPlayer->NumberOfBarItems; currSubItems=skinAppMPlayer->barItems; }
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
123 else if ( !strncmp( in,"menu",4 ) ) { currSection=&skinAppMPlayer->menuBase; currSubItem=&skinAppMPlayer->NumberOfMenuItems; currSubItems=skinAppMPlayer->MenuItems; }
14156
c30e193ac112 printf --> mp_msg conversion, less verbosity
diego
parents: 12646
diff changeset
124 else ERRORMESSAGE( MSGTR_UNKNOWNWINDOWTYPE );
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
125 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window: %s\n",window_name );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
126 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
127 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
128
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
129 int cmd_base( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
130 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
131 unsigned char fname[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
132 unsigned char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
133 int x,y;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
134 int sx=0,sy=0;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
135
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
136 CHECKDEFLIST( "base" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
137 CHECKWINLIST( "base" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
138
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
139 cutItem( in,fname,',',0 );
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
140 x=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
141 y=cutItemToInt( in,',',2 );
3080
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
142 sx=cutItemToInt( in,',',3 );
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
143 sy=cutItemToInt( in,',',4 );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
144 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] base: %s x: %d y: %d ( %dx%d )\n",fname,x,y,sx,sy );
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
145 if ( !strcmp( window_name,"main" ) )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
146 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
147 defList->main.x=x;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
148 defList->main.y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
149 defList->main.type=itBase;
12646
9a495bdc3a1e string handling security fixes
diego
parents: 10241
diff changeset
150 strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, fname, sizeof( tmp ));
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
151 if ( skinBPRead( tmp,&defList->main.Bitmap ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
152 defList->main.width=defList->main.Bitmap.Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
153 defList->main.height=defList->main.Bitmap.Height;
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
154 #ifdef HAVE_XSHAPE
2717
5fa8c079ee3c fix small xshape bug
pontscho
parents: 2025
diff changeset
155 Convert32to1( &defList->main.Bitmap,&defList->main.Mask,0x00ff00ff );
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
156 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->main.Mask.Width,defList->main.Mask.Height );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
157 #else
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
158 defList->main.Mask.Image=NULL;
2781
bd851a5afcb3 uuupsz ... 1l cola ;)
pontscho
parents: 2717
diff changeset
159 #endif
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
160 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
161 }
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
162 if ( !strcmp( window_name,"sub" ) )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
163 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
164 defList->sub.type=itBase;
12646
9a495bdc3a1e string handling security fixes
diego
parents: 10241
diff changeset
165 strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, fname, sizeof( tmp ));
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
166 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
167 defList->sub.x=x;
0653e90b3118 some bug fix, and sub window render speed up.. 10l kola ? :)
pontscho
parents: 1884
diff changeset
168 defList->sub.y=y;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
169 defList->sub.width=defList->sub.Bitmap.Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
170 defList->sub.height=defList->sub.Bitmap.Height;
3080
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
171 if ( sx && sy )
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
172 {
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
173 defList->sub.width=sx;
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
174 defList->sub.height=sy;
182163807172 bug fixs
pontscho
parents: 2781
diff changeset
175 }
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
176 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
177 }
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
178 if ( !strcmp( window_name,"menu" ) )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
179 {
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
180 defList->menuIsPresent=1;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
181 defList->menuBase.type=itBase;
12646
9a495bdc3a1e string handling security fixes
diego
parents: 10241
diff changeset
182 strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, fname, sizeof( tmp ));
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
183 if ( skinBPRead( tmp,&defList->menuBase.Bitmap ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
184 defList->menuBase.width=defList->menuBase.Bitmap.Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
185 defList->menuBase.height=defList->menuBase.Bitmap.Height;
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
186 #ifdef HAVE_XSHAPE
6221
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6218
diff changeset
187 Convert32to1( &defList->menuBase.Bitmap,&defList->menuBase.Mask,0x00ff00ff );
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
188 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->menuBase.Mask.Width,defList->menuBase.Mask.Height );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
189 #else
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
190 defList->menuBase.Mask.Image=NULL;
6221
4b2459557340 add XShape support for gui's submenu
pontscho
parents: 6218
diff changeset
191 #endif
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
192 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
193 }
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
194 if ( !strcmp( window_name,"playbar" ) )
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
195 {
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
196 defList->barIsPresent=1;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
197 defList->bar.x=x;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
198 defList->bar.y=y;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
199 defList->bar.type=itBase;
12646
9a495bdc3a1e string handling security fixes
diego
parents: 10241
diff changeset
200 strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, fname, sizeof( tmp ));
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
201 if ( skinBPRead( tmp,&defList->bar.Bitmap ) ) return 1;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
202 defList->bar.width=defList->bar.Bitmap.Width;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
203 defList->bar.height=defList->bar.Bitmap.Height;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
204 #ifdef HAVE_XSHAPE
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
205 Convert32to1( &defList->bar.Bitmap,&defList->bar.Mask,0x00ff00ff );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
206 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->bar.Mask.Width,defList->bar.Mask.Height );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
207 #else
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
208 defList->bar.Mask.Image=NULL;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
209 #endif
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
210 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->bar.width,defList->bar.height );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
211 }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
212 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
213 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
214
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
215 int cmd_background( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
216 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
217 CHECKDEFLIST( "background" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
218 CHECKWINLIST( "background" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
219
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
220 CHECK( "menu" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
221 CHECK( "main" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
222
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
223 currSection->R=cutItemToInt( in,',',0 );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
224 currSection->G=cutItemToInt( in,',',1 );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
225 currSection->B=cutItemToInt( in,',',2 );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
226 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] background color is #%x%x%x.\n",currSection->R,currSection->G,currSection->B );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
227
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
228 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
229 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
230
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
231 int cmd_button( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
232 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
233 unsigned char fname[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
234 unsigned char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
235 int x,y,sx,sy;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
236 char msg[32];
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
237
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
238 CHECKDEFLIST( "button" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
239 CHECKWINLIST( "button" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
240
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
241 CHECK( "sub" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
242 CHECK( "menu" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
243
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
244 cutItem( in,fname,',',0 );
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
245 x=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
246 y=cutItemToInt( in,',',2 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
247 sx=cutItemToInt( in,',',3 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
248 sy=cutItemToInt( in,',',4 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
249 cutItem( in,msg,',',5 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
250
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
251 (*currSubItem)++;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
252 currSubItems[ *currSubItem ].type=itButton;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
253 currSubItems[ *currSubItem ].x=x;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
254 currSubItems[ *currSubItem ].y=y;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
255 currSubItems[ *currSubItem ].width=sx;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
256 currSubItems[ *currSubItem ].height=sy;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
257 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
258 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
259
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
260 if ( ( currSubItems[ *currSubItem ].msg=appFindMessage( msg ) ) == -1 )
8423
c6a1a5b6ba25 - fix three submenu bug
pontscho
parents: 8305
diff changeset
261 { ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 0; }
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
262 currSubItems[ *currSubItem ].pressed=btnReleased;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
263 if ( currSubItems[ *currSubItem ].msg == evPauseSwitchToPlay ) currSubItems[ *currSubItem ].pressed=btnDisabled;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
264 currSubItems[ *currSubItem ].tmp=1;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
265
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
266 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",currSubItems[ *currSubItem ].msg );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
267
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
268 currSubItems[ *currSubItem ].Bitmap.Image=NULL;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
269 if ( strcmp( fname,"NULL" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
270 {
12646
9a495bdc3a1e string handling security fixes
diego
parents: 10241
diff changeset
271 strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, fname, sizeof( tmp ));
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
272 if ( skinBPRead( tmp,&currSubItems[ *currSubItem ].Bitmap ) ) return 1;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
273 }
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
274
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
275 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
276 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
277
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
278 int cmd_selected( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
279 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
280 unsigned char fname[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
281 unsigned char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
282
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
283 CHECKDEFLIST( "selected" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
284 CHECKWINLIST( "selected" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
285
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
286 CHECK( "main" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
287 CHECK( "sub" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
288 CHECK( "playbar" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
289
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
290 cutItem( in,fname,',',0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
291 defList->menuSelected.type=itBase;
12646
9a495bdc3a1e string handling security fixes
diego
parents: 10241
diff changeset
292 strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, fname, sizeof( tmp ));
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
293 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] selected: %s\n",fname );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
294 if ( skinBPRead( tmp,&defList->menuSelected.Bitmap ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
295 defList->menuSelected.width=defList->menuSelected.Bitmap.Width;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
296 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
297 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
298 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
299 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
300
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
301 int cmd_menu( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
302 { // menu = number,x,y,sx,sy,msg
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
303 int x,y,sx,sy,msg;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
304 unsigned char tmp[64];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
305
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
306 CHECKDEFLIST( "menu" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
307 CHECKWINLIST( "menu" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
308
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
309 CHECK( "main" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
310 CHECK( "sub" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
311 CHECK( "playbar" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
312
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
313 x=cutItemToInt( in,',',0 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
314 y=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
315 sx=cutItemToInt( in,',',2 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
316 sy=cutItemToInt( in,',',3 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
317 cutItem( in,tmp,',',4 ); msg=appFindMessage( tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
318
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
319 defList->NumberOfMenuItems++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
320 defList->MenuItems[ defList->NumberOfMenuItems ].x=x;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
321 defList->MenuItems[ defList->NumberOfMenuItems ].y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
322 defList->MenuItems[ defList->NumberOfMenuItems ].width=sx;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
323 defList->MenuItems[ defList->NumberOfMenuItems ].height=sy;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
324
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
325 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
326 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
327
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
328 if ( ( defList->MenuItems[ defList->NumberOfMenuItems ].msg=msg ) == -1 )
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
329 ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,tmp );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
330
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
331 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
332
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
333 defList->MenuItems[ defList->NumberOfMenuItems ].Bitmap.Image=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
334 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
335 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
336
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
337 int cmd_hpotmeter( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
338 { // hpotmeter=buttonbitmaps,sx,sy,phasebitmaps,phases,default value,x,y,sx,sy,msg
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
339 int x,y,psx,psy,ph,sx,sy,msg,d;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
340 unsigned char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
341 unsigned char pfname[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
342 unsigned char phfname[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
343 wItem * item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
344
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
345 CHECKDEFLIST( "hpotmeter" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
346 CHECKWINLIST( "hpotmeter" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
347
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
348 CHECK( "sub" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
349 CHECK( "menu" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
350
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
351 cutItem( in,pfname,',',0 );
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
352 psx=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
353 psy=cutItemToInt( in,',',2 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
354 cutItem( in,phfname,',',3 );
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
355 ph=cutItemToInt( in,',',4 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
356 d=cutItemToInt( in,',',5 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
357 x=cutItemToInt( in,',',6 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
358 y=cutItemToInt( in,',',7 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
359 sx=cutItemToInt( in,',',8 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
360 sy=cutItemToInt( in,',',9 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
361 cutItem( in,tmp,',',10 ); msg=appFindMessage( tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
362
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
363 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] h/v potmeter: pointer filename: '%s'\n",pfname );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
364 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
365 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
366 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
367 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
368 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",msg );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
369
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
370 (*currSubItem)++;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
371 item=&currSubItems[ *currSubItem ];
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
372
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
373 item->type=itHPotmeter;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
374 item->x=x; item->y=y; item->width=sx; item->height=sy;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
375 item->phases=ph;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
376 item->psx=psx; item->psy=psy;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
377 item->msg=msg;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
378 item->value=(float)d;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
379 item->pressed=btnReleased;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
380
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
381 item->Bitmap.Image=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
382 if ( strcmp( phfname,"NULL" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
383 {
12646
9a495bdc3a1e string handling security fixes
diego
parents: 10241
diff changeset
384 strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, phfname, sizeof( tmp ));
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
385 if ( skinBPRead( tmp,&item->Bitmap ) ) return 1;
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 item->Mask.Image=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
389 if ( strcmp( pfname,"NULL" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
390 {
12646
9a495bdc3a1e string handling security fixes
diego
parents: 10241
diff changeset
391 strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, pfname, sizeof( tmp ));
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
392 if ( skinBPRead( tmp,&item->Mask ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
393 }
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
394 return 0;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
395 }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
396
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
397 int cmd_vpotmeter( char * in )
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
398 {
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
399 int r = cmd_hpotmeter( in );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
400 wItem * item;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
401
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
402 item=&currSubItems[ *currSubItem ];
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
403 item->type=itVPotmeter;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
404 return r;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
405 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
406
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
407 int cmd_potmeter( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
408 { // potmeter=phasebitmaps,phases,default value,x,y,sx,sy,msg
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
409 int x,y,ph,sx,sy,msg,d;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
410 unsigned char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
411 unsigned char phfname[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
412 wItem * item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
413
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
414 CHECKDEFLIST( "potmeter" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
415 CHECKWINLIST( "potmeter" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
416
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
417 CHECK( "sub" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
418 CHECK( "menu" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
419
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
420 cutItem( in,phfname,',',0 );
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
421 ph=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
422 d=cutItemToInt( in,',',2 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
423 x=cutItemToInt( in,',',3 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
424 y=cutItemToInt( in,',',4 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
425 sx=cutItemToInt( in,',',5 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
426 sy=cutItemToInt( in,',',6 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
427 cutItem( in,tmp,',',7 ); msg=appFindMessage( tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
428
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
429 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
430 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
431 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
432 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
433 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",msg );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
434
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
435 (*currSubItem)++;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
436 item=&currSubItems[ *currSubItem ];
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
437
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
438 item->type=itPotmeter;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
439 item->x=x; item->y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
440 item->width=sx; item->height=sy;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
441 item->phases=ph;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
442 item->msg=msg;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
443 item->value=(float)d;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
444
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
445 item->Bitmap.Image=NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
446 if ( strcmp( phfname,"NULL" ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
447 {
12646
9a495bdc3a1e string handling security fixes
diego
parents: 10241
diff changeset
448 strlcpy(tmp, path, sizeof( tmp )); strlcat(tmp, phfname, sizeof( tmp ));
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
449 if ( skinBPRead( tmp,&item->Bitmap ) ) return 1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
450 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
451 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
452 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
453
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
454 int cmd_font( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
455 { // font=fontname,fontid
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
456 char name[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
457 char id[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
458 wItem * item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
459
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
460 CHECKDEFLIST( "font" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
461 CHECKWINLIST( "font" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
462
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
463 CHECK( "sub" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
464 CHECK( "menu" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
465
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
466 cutItem( in,name,',',0 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
467 cutItem( in,id,',',1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
468
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
469 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
470 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] name: %s\n",name );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
471
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
472 (*currSubItem)++;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
473 item=&currSubItems[ *currSubItem ];
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
474
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
475 item->type=itFont;
6218
8cfddba867b4 fix text render chrash ...
pontscho
parents: 5690
diff changeset
476 item->fontid=fntRead( path,name );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
477 switch ( item->fontid )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
478 {
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
479 case -1: ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1;
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
480 case -2: ERRORMESSAGE( MSGTR_SKIN_FONT_TooManyFontsDeclared ); return 1;
6218
8cfddba867b4 fix text render chrash ...
pontscho
parents: 5690
diff changeset
481 case -3: ERRORMESSAGE( MSGTR_SKIN_FONT_FontFileNotFound ); return 1;
8cfddba867b4 fix text render chrash ...
pontscho
parents: 5690
diff changeset
482 case -4: ERRORMESSAGE( MSGTR_SKIN_FONT_FontImageNotFound ); return 1;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
483 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
484 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
485 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
486
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
487 int cmd_slabel( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
488 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
489 char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
490 char sid[63];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
491 int x,y,id;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
492 wItem * item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
493
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
494 CHECKDEFLIST( "slabel" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
495 CHECKWINLIST( "slabel" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
496
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
497 CHECK( "sub" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
498 CHECK( "menu" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
499
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
500 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] slabel\n" );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
501
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
502 x=cutItemToInt( in,',',0 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
503 y=cutItemToInt( in,',',1 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
504 cutItem( in,sid,',',2 ); id=fntFindID( sid );
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
505 if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
506 cutItem( in,tmp,',',3 ); cutItem( tmp,tmp,'"',1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
507
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
508 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
509 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
510 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
511
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
512 (*currSubItem)++;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
513 item=&currSubItems[ *currSubItem ];
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
514
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
515 item->type=itSLabel;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
516 item->fontid=id;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
517 item->x=x; item->y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
518 item->width=-1; item->height=-1;
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
519 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
520 strcpy( item->label,tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
521
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
522 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
523 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
524
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
525 int cmd_dlabel( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
526 { // dlabel=x,y,sx,align,fontid,string ...
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
527 char tmp[512];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
528 char sid[63];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
529 int x,y,sx,id,a;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
530 wItem * item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
531
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
532 CHECKDEFLIST( "dlabel" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
533 CHECKWINLIST( "dlabel" );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
534
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
535 CHECK( "sub" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
536 CHECK( "menu" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
537
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
538 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] dlabel\n" );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
539
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
540 x=cutItemToInt( in,',',0 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
541 y=cutItemToInt( in,',',1 );
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1729
diff changeset
542 sx=cutItemToInt( in,',',2 );
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
543 a=cutItemToInt( in,',',3 );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
544 cutItem( in,sid,',',4 ); id=fntFindID( sid );
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
545 if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
546 cutItem( in,tmp,',',5 ); cutItem( tmp,tmp,'"',1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
547
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
548 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
549 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
550 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
551
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
552 (*currSubItem)++;
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
553 item=&currSubItems[ *currSubItem ];
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
554
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
555 item->type=itDLabel;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
556 item->fontid=id; item->align=a;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
557 item->x=x; item->y=y;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
558 item->width=sx; item->height=-1;
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
559 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
560 strcpy( item->label,tmp );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
561
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
562 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
563 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
564
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
565 int cmd_decoration( char * in )
1866
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
566 {
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
567 char tmp[512];
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
568
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
569 CHECKDEFLIST( "decoration" );
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
570 CHECKWINLIST( "decoration" );
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
571
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
572 CHECK( "sub" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
573 CHECK( "menu" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
574 CHECK( "playbar" );
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
575
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
576 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",in );
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
577 strlower( in );
1866
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
578 cutItem( in,tmp,',',0 );
1884
d21f8afc7680 add to multi lang support
pontscho
parents: 1866
diff changeset
579 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
580 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
581 else defList->mainDecoration=1;
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
582
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
583 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
584 return 0;
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
585 }
32b1bb50a0e8 some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents: 1852
diff changeset
586
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
587 typedef struct
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
588 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
589 char * name;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
590 int (*func)( char * in );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
591 } _item;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
592
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
593 _item skinItem[] =
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
594 {
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
595 { "section", cmd_section },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
596 { "end", cmd_end },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
597 { "window", cmd_window },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
598 { "base", cmd_base },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
599 { "button", cmd_button },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
600 { "selected", cmd_selected },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
601 { "background", cmd_background },
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
602 { "vpotmeter", cmd_vpotmeter },
6625
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
603 { "hpotmeter", cmd_hpotmeter },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
604 { "potmeter", cmd_potmeter },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
605 { "font", cmd_font },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
606 { "slabel", cmd_slabel },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
607 { "dlabel", cmd_dlabel },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
608 { "decoration", cmd_decoration },
54cfbaaf161b remove unneded config files
pontscho
parents: 6568
diff changeset
609 { "menu", cmd_menu }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
610 };
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
611
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
612 #define ITEMS (int)( sizeof( skinItem )/sizeof( _item ) )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
613
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
614 char * trimleft( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
615 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
616 int c = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
617 char * out;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
618 if ( strlen( in ) == 0 ) return NULL;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
619 while ( in[c] == ' ' ) c++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
620 if ( c != 0 )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
621 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
622 out=malloc( strlen( in ) - c + 1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
623 memcpy( out,&in[c],strlen( in ) - c + 1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
624 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
625 else out=in;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
626 return out;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
627 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
628
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
629 char * strswap( char * in,char what,char whereof )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
630 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
631 int i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
632 if ( strlen( in ) == 0 ) return NULL;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
633 for ( i=0;i<(int)strlen( in );i++ )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
634 if ( in[i] == what ) in[i]=whereof;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
635 return in;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
636 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
637
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
638 char * trim( char * in )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
639 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
640 int c = 0,i = 0,id = 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
641 if ( strlen( in ) == 0 ) return NULL;
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
642 while ( c != (int)strlen( in ) )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
643 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
644 if ( in[c] == '"' ) id=!id;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
645 if ( ( in[c] == ' ' )&&( !id ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
646 {
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
647 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
648 continue;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
649 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
650 c++;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
651 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
652 return in;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
653 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
654
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
655 FILE * skinFile;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
656
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
657 void setname( char * item1, char * item2 )
12646
9a495bdc3a1e string handling security fixes
diego
parents: 10241
diff changeset
658 {
9a495bdc3a1e string handling security fixes
diego
parents: 10241
diff changeset
659 strlcpy(fn, item1, sizeof( fn ));
9a495bdc3a1e string handling security fixes
diego
parents: 10241
diff changeset
660 strlcat(fn, "/", sizeof( fn )); strlcat(fn, item2, sizeof( fn ));
9a495bdc3a1e string handling security fixes
diego
parents: 10241
diff changeset
661 strlcpy(path, fn, sizeof( path )); strlcat(path, "/", sizeof( path ));
9a495bdc3a1e string handling security fixes
diego
parents: 10241
diff changeset
662 strlcat(fn, "/skin", sizeof( fn ));
9a495bdc3a1e string handling security fixes
diego
parents: 10241
diff changeset
663 }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
664
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
665 int skinRead( char * dname )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
666 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
667 unsigned char tmp[255];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
668 unsigned char * ptmp;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
669 unsigned char command[32];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
670 unsigned char param[256];
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
671 int c,i;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
672
6568
297d43688572 Check for skin in user's .mplayer first so he can override systemwide skin.
atmos4
parents: 6221
diff changeset
673 setname( skinDirInHome,dname );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
674 if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
675 {
6568
297d43688572 Check for skin in user's .mplayer first so he can override systemwide skin.
atmos4
parents: 6221
diff changeset
676 setname( skinMPlayerDir,dname );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
677 if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
678 {
14156
c30e193ac112 printf --> mp_msg conversion, less verbosity
diego
parents: 12646
diff changeset
679 mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_SkinFileNotFound,fn );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
680 return -1;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
681 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
682 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
683
4818
3473ca9ef158 new gui interface, and gtk moved into mplayer process. fork ... bleh :)
pontscho
parents: 3586
diff changeset
684 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] file: %s\n",fn );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
685
5690
436cf6ef67fd fix skin loading bug
pontscho
parents: 5665
diff changeset
686 appInitStruct( skinAppMPlayer );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
687
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
688 linenumber=0;
15583
7490b7904417 last patch broke skin reading completely, becasue last line of skin
reimar
parents: 15554
diff changeset
689 while (fgets(tmp, 255, skinFile))
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
690 {
15554
e93d0faac02b Print error when skin file is not readable (e.g. a directory) instead of hanging
reimar
parents: 14156
diff changeset
691 linenumber++;
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
692
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
693 c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
694 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
695 for ( c=0;c<(int)strlen( tmp );c++ )
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
696 if ( tmp[c] == ';' )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
697 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
698 tmp[c]=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
699 break;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
700 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
701 if ( strlen( tmp ) == 0 ) continue;
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
702 ptmp=trimleft( tmp );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
703 if ( strlen( ptmp ) == 0 ) continue;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
704 ptmp=strswap( ptmp,'\t',' ' );
8973
0a665389cf2b - add playbar
pontscho
parents: 8423
diff changeset
705 ptmp=trim( ptmp );
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
706
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
707 cutItem( ptmp,command,'=',0 ); cutItem( ptmp,param,'=',1 );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
708 strlower( command );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
709 for( i=0;i<ITEMS;i++ )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
710 if ( !strcmp( command,skinItem[i].name ) )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
711 if ( skinItem[i].func( param ) ) return -2;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
712 }
15583
7490b7904417 last patch broke skin reading completely, becasue last line of skin
reimar
parents: 15554
diff changeset
713 if (linenumber == 0) {
7490b7904417 last patch broke skin reading completely, becasue last line of skin
reimar
parents: 15554
diff changeset
714 mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SkinFileNotReadable, fn);
7490b7904417 last patch broke skin reading completely, becasue last line of skin
reimar
parents: 15554
diff changeset
715 return -1;
7490b7904417 last patch broke skin reading completely, becasue last line of skin
reimar
parents: 15554
diff changeset
716 }
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
717 return 0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
718 }