12 #include "wm/wskeys.h"
13 #include "skin/skin.h"
14 #include "mplayer/gmplayer.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
);
75 /* FIXME: Eventually remove the obsolete directory names. */
76 char * skinDirInHome
=NULL
;
77 char * skinDirInHome_obsolete
=NULL
;
78 char * skinMPlayerDir
=NULL
;
79 char * skinMPlayerDir_obsolete
=NULL
;
80 char * skinName
= NULL
;
82 void appClearItem( wItem
* item
)
86 item
->x
=0; item
->y
=0; item
->width
=0; item
->height
=0;
88 item
->px
=0; item
->py
=0; item
->psx
=0; item
->psy
=0;
90 item
->msg
=0; item
->msg2
=0;
91 item
->pressed
=btnReleased
;
93 item
->key
=0; item
->key2
=0;
94 item
->Bitmap
.Width
=0; item
->Bitmap
.Height
=0; item
->Bitmap
.BPP
=0; item
->Bitmap
.ImageSize
=0;
95 if ( item
->Bitmap
.Image
) free( item
->Bitmap
.Image
);
96 item
->Bitmap
.Image
=NULL
;
99 if ( item
->label
) free( item
->label
); item
->label
=NULL
;
103 void appCopy( listItems
* dest
,listItems
* source
)
105 dest
->NumberOfItems
=source
->NumberOfItems
;
106 memcpy( &dest
->Items
,&source
->Items
,128 * sizeof( wItem
) );
108 dest
->NumberOfMenuItems
=source
->NumberOfMenuItems
;
109 memcpy( &dest
->MenuItems
,&source
->MenuItems
,32 * sizeof( wItem
) );
111 memcpy( &dest
->main
,&source
->main
,sizeof( wItem
) );
112 memcpy( &dest
->sub
,&source
->sub
,sizeof( wItem
) );
113 memcpy( &dest
->menuBase
,&source
->menuBase
,sizeof( wItem
) );
114 memcpy( &dest
->menuSelected
,&source
->menuSelected
,sizeof( wItem
) );
117 void appInitStruct( listItems
* item
)
120 for ( i
=0;i
<item
->NumberOfItems
;i
++ )
121 appClearItem( &item
->Items
[i
] );
122 for ( i
=0;i
<item
->NumberOfMenuItems
;i
++ )
123 appClearItem( &item
->MenuItems
[i
] );
124 for ( i
=0;i
<item
->NumberOfBarItems
;i
++ )
125 appClearItem( &item
->barItems
[i
] );
127 item
->NumberOfItems
=-1;
128 memset( item
->Items
,0,256 * sizeof( wItem
) );
129 item
->NumberOfMenuItems
=-1;
130 memset( item
->MenuItems
,0,64 * sizeof( wItem
) );
131 item
->NumberOfBarItems
=-1;
132 memset( item
->barItems
,0,256 * sizeof( wItem
) );
134 appClearItem( &item
->main
);
135 item
->mainDecoration
=0;
136 appClearItem( &item
->sub
);
137 item
->sub
.width
=0; item
->sub
.height
=0;
138 item
->sub
.x
=-1; item
->sub
.y
=-1;
139 appClearItem( &item
->menuBase
);
140 appClearItem( &item
->menuSelected
);
141 item
->sub
.R
=item
->sub
.G
=item
->sub
.B
=0;
142 item
->bar
.R
=item
->bar
.G
=item
->bar
.B
=0;
143 item
->main
.R
=item
->main
.G
=item
->main
.B
=0;
144 item
->barIsPresent
=0;
145 item
->menuIsPresent
=0;
148 int appFindKey( unsigned char * name
)
151 for ( i
=0;i
<wsKeyNumber
;i
++ )
152 if ( !strcmp( wsKeyNames
[i
].name
,name
) ) return wsKeyNames
[i
].code
;
156 int appFindMessage( unsigned char * str
)
159 for ( i
=0;i
<evBoxs
;i
++ )
160 if ( !strcmp( evNames
[i
].name
,str
) ) return evNames
[i
].msg
;
164 void btnModify( int event
,float state
)
167 for ( j
=0;j
< appMPlayer
.NumberOfItems
+ 1;j
++ )
168 if ( appMPlayer
.Items
[j
].msg
== event
)
170 switch ( appMPlayer
.Items
[j
].type
)
173 appMPlayer
.Items
[j
].pressed
=(int)state
;
174 appMPlayer
.Items
[j
].tmp
=(int)state
;
179 if ( state
< 0.0f
) state
=0.0f
;
180 if ( state
> 100.f
) state
=100.0f
;
181 appMPlayer
.Items
[j
].value
=state
;
186 for ( j
=0;j
< appMPlayer
.NumberOfBarItems
+ 1;j
++ )
187 if ( appMPlayer
.barItems
[j
].msg
== event
)
189 switch ( appMPlayer
.barItems
[j
].type
)
192 appMPlayer
.barItems
[j
].pressed
=(int)state
;
193 appMPlayer
.barItems
[j
].tmp
=(int)state
;
198 if ( state
< 0.0f
) state
=0.0f
;
199 if ( state
> 100.f
) state
=100.0f
;
200 appMPlayer
.barItems
[j
].value
=state
;
206 float btnGetValue( int event
)
209 for ( j
=0;j
<appMPlayer
.NumberOfItems
+ 1;j
++ )
210 if ( appMPlayer
.Items
[j
].msg
== event
) return appMPlayer
.Items
[j
].value
;
214 void btnSet( int event
,int set
)
217 for ( j
=0;j
<appMPlayer
.NumberOfItems
+ 1;j
++ )
218 if ( appMPlayer
.Items
[j
].msg
== event
)
219 { appMPlayer
.Items
[j
].pressed
=set
; appMPlayer
.barItems
[j
].tmp
=0; }
220 for ( j
=0;j
<appMPlayer
.NumberOfBarItems
+ 1;j
++ )
221 if ( appMPlayer
.barItems
[j
].msg
== event
)
222 { appMPlayer
.barItems
[j
].pressed
=set
; appMPlayer
.barItems
[j
].tmp
=0; }