9 #include "../help_mp.h"
12 #include "wm/wskeys.h"
13 #include "skin/skin.h"
14 #include "mplayer/mplayer.h"
15 #include "interface.h"
22 { evPause
, "evPause" },
26 { evEqualizer
, "evEqualizer" },
27 { evEqualizer
, "evEqualeaser" },
28 { evPlayList
, "evPlaylist" },
30 { evIconify
, "evIconify" },
31 { evIncBalance
, "evIncBalance" },
32 { evDecBalance
, "evDecBalance" },
33 { evFullScreen
, "evFullScreen" },
34 { evFName
, "evFName" },
35 { evMovieTime
, "evMovieTime" },
36 { evAbout
, "evAbout" },
37 { evLoadPlay
, "evLoadPlay" },
38 { evPreferences
, "evPreferences" },
39 { evSkinBrowser
, "evSkinBrowser" },
40 { evBackward10sec
, "evBackward10sec" },
41 { evForward10sec
, "evForward10sec" },
42 { evBackward1min
, "evBackward1min" },
43 { evForward1min
, "evForward1min" },
44 { evBackward10min
, "evBackward10min" },
45 { evForward10min
, "evForward10min" },
46 { evIncVolume
, "evIncVolume" },
47 { evDecVolume
, "evDecVolume" },
49 { evIncAudioBufDelay
, "evIncAudioBufDelay" },
50 { evDecAudioBufDelay
, "evDecAudioBufDelay" },
51 { evPlaySwitchToPause
, "evPlaySwitchToPause" },
52 { evPauseSwitchToPlay
, "evPauseSwitchToPlay" },
53 { evNormalSize
, "evHalfSize" },
54 { evNormalSize
, "evNormalSize" },
55 { evDoubleSize
, "evDoubleSize" },
56 { evSetMoviePosition
, "evSetMoviePosition" },
57 { evSetVolume
, "evSetVolume" },
58 { evSetBalance
, "evSetBalance" },
60 { evLoadSubtitle
, "evLoadSubtitle" },
61 { evPlayDVD
, "evPlayDVD" },
62 { evPlayVCD
, "evPlayVCD" },
63 { evSetURL
, "evSetURL" },
64 { evLoadAudioFile
, "evLoadAudioFile" },
65 { evDropSubtitle
, "evDropSubtitle" },
66 { evSetAspect
, "evSetAspect" }
69 int evBoxs
= sizeof( evNames
) / sizeof( evName
);
73 extern char *get_path(char *);
77 char * skinDirInHome
=NULL
;
78 char * skinMPlayerDir
=NULL
;
79 char * skinName
= NULL
;
81 void appClearItem( wItem
* item
)
85 item
->x
=0; item
->y
=0; item
->width
=0; item
->height
=0;
87 item
->px
=0; item
->py
=0; item
->psx
=0; item
->psy
=0;
89 item
->msg
=0; item
->msg2
=0;
90 item
->pressed
=btnReleased
;
92 item
->key
=0; item
->key2
=0;
93 item
->Bitmap
.Width
=0; item
->Bitmap
.Height
=0; item
->Bitmap
.BPP
=0; item
->Bitmap
.ImageSize
=0;
94 if ( item
->Bitmap
.Image
) free( item
->Bitmap
.Image
);
95 item
->Bitmap
.Image
=NULL
;
98 if ( item
->label
) free( item
->label
); item
->label
=NULL
;
102 void appCopy( listItems
* dest
,listItems
* source
)
104 dest
->NumberOfItems
=source
->NumberOfItems
;
105 memcpy( &dest
->Items
,&source
->Items
,128 * sizeof( wItem
) );
107 dest
->NumberOfMenuItems
=source
->NumberOfMenuItems
;
108 memcpy( &dest
->MenuItems
,&source
->MenuItems
,32 * sizeof( wItem
) );
110 memcpy( &dest
->main
,&source
->main
,sizeof( wItem
) );
111 memcpy( &dest
->sub
,&source
->sub
,sizeof( wItem
) );
112 memcpy( &dest
->menuBase
,&source
->menuBase
,sizeof( wItem
) );
113 memcpy( &dest
->menuSelected
,&source
->menuSelected
,sizeof( wItem
) );
116 void appInitStruct( listItems
* item
)
119 for ( i
=0;i
<item
->NumberOfItems
;i
++ )
120 appClearItem( &item
->Items
[i
] );
121 for ( i
=0;i
<item
->NumberOfMenuItems
;i
++ )
122 appClearItem( &item
->MenuItems
[i
] );
123 for ( i
=0;i
<item
->NumberOfBarItems
;i
++ )
124 appClearItem( &item
->barItems
[i
] );
126 item
->NumberOfItems
=-1;
127 memset( item
->Items
,0,256 * sizeof( wItem
) );
128 item
->NumberOfMenuItems
=-1;
129 memset( item
->MenuItems
,0,64 * sizeof( wItem
) );
130 item
->NumberOfBarItems
=-1;
131 memset( item
->barItems
,0,256 * sizeof( wItem
) );
133 appClearItem( &item
->main
);
134 item
->mainDecoration
=0;
135 appClearItem( &item
->sub
);
136 item
->sub
.width
=0; item
->sub
.height
=0;
137 item
->sub
.x
=-1; item
->sub
.y
=-1;
138 appClearItem( &item
->menuBase
);
139 appClearItem( &item
->menuSelected
);
140 item
->sub
.R
=item
->sub
.G
=item
->sub
.B
=0;
141 item
->bar
.R
=item
->bar
.G
=item
->bar
.B
=0;
142 item
->main
.R
=item
->main
.G
=item
->main
.B
=0;
143 item
->barIsPresent
=0;
144 item
->menuIsPresent
=0;
147 int appFindKey( unsigned char * name
)
150 for ( i
=0;i
<wsKeyNumber
;i
++ )
151 if ( !strcmp( wsKeyNames
[i
].name
,name
) ) return wsKeyNames
[i
].code
;
155 int appFindMessage( unsigned char * str
)
158 for ( i
=0;i
<evBoxs
;i
++ )
159 if ( !strcmp( evNames
[i
].name
,str
) ) return evNames
[i
].msg
;
163 void btnModify( int event
,float state
)
166 for ( j
=0;j
< appMPlayer
.NumberOfItems
+ 1;j
++ )
167 if ( appMPlayer
.Items
[j
].msg
== event
)
169 switch ( appMPlayer
.Items
[j
].type
)
172 appMPlayer
.Items
[j
].pressed
=(int)state
;
173 appMPlayer
.Items
[j
].tmp
=(int)state
;
178 if ( state
< 0.0f
) state
=0.0f
;
179 if ( state
> 100.f
) state
=100.0f
;
180 appMPlayer
.Items
[j
].value
=state
;
185 for ( j
=0;j
< appMPlayer
.NumberOfBarItems
+ 1;j
++ )
186 if ( appMPlayer
.barItems
[j
].msg
== event
)
188 switch ( appMPlayer
.barItems
[j
].type
)
191 appMPlayer
.barItems
[j
].pressed
=(int)state
;
192 appMPlayer
.barItems
[j
].tmp
=(int)state
;
197 if ( state
< 0.0f
) state
=0.0f
;
198 if ( state
> 100.f
) state
=100.0f
;
199 appMPlayer
.barItems
[j
].value
=state
;
205 float btnGetValue( int event
)
208 for ( j
=0;j
<appMPlayer
.NumberOfItems
+ 1;j
++ )
209 if ( appMPlayer
.Items
[j
].msg
== event
) return appMPlayer
.Items
[j
].value
;
213 void btnSet( int event
,int set
)
216 for ( j
=0;j
<appMPlayer
.NumberOfItems
+ 1;j
++ )
217 if ( appMPlayer
.Items
[j
].msg
== event
)
218 { appMPlayer
.Items
[j
].pressed
=set
; appMPlayer
.barItems
[j
].tmp
=0; }
219 for ( j
=0;j
<appMPlayer
.NumberOfBarItems
+ 1;j
++ )
220 if ( appMPlayer
.barItems
[j
].msg
== event
)
221 { appMPlayer
.barItems
[j
].pressed
=set
; appMPlayer
.barItems
[j
].tmp
=0; }