23077
|
1
|
|
2
|
|
3 #include <stdlib.h>
|
|
4 #include <stdio.h>
|
|
5 #include <string.h>
|
|
6
|
|
7 #include "config.h"
|
|
8 #include "mp_msg.h"
|
|
9 #include "help_mp.h"
|
|
10
|
|
11 #include "app.h"
|
|
12 #include "wm/wskeys.h"
|
|
13 #include "skin/skin.h"
|
|
14 #include "mplayer/gmplayer.h"
|
|
15 #include "interface.h"
|
|
16
|
|
17 evName evNames[] =
|
|
18 {
|
|
19 { evNone, "evNone" },
|
|
20 { evPlay, "evPlay" },
|
|
21 { evStop, "evStop" },
|
|
22 { evPause, "evPause" },
|
|
23 { evPrev, "evPrev" },
|
|
24 { evNext, "evNext" },
|
|
25 { evLoad, "evLoad" },
|
|
26 { evEqualizer, "evEqualizer" },
|
|
27 { evEqualizer, "evEqualeaser" },
|
|
28 { evPlayList, "evPlaylist" },
|
|
29 { evExit, "evExit" },
|
|
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" },
|
|
48 { evMute, "evMute" },
|
|
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" },
|
|
59 { evHelp, "evHelp" },
|
|
60 { evLoadSubtitle, "evLoadSubtitle" },
|
|
61 { evPlayDVD, "evPlayDVD" },
|
|
62 { evPlayVCD, "evPlayVCD" },
|
|
63 { evSetURL, "evSetURL" },
|
|
64 { evLoadAudioFile, "evLoadAudioFile" },
|
|
65 { evDropSubtitle, "evDropSubtitle" },
|
|
66 { evSetAspect, "evSetAspect" }
|
|
67 };
|
|
68
|
|
69 int evBoxs = sizeof( evNames ) / sizeof( evName );
|
|
70
|
|
71 // ---
|
|
72
|
|
73 extern char *get_path(const char *);
|
|
74
|
|
75 listItems appMPlayer;
|
|
76
|
|
77 /* FIXME: Eventually remove the obsolete directory names. */
|
|
78 char * skinDirInHome=NULL;
|
|
79 char * skinDirInHome_obsolete=NULL;
|
|
80 char * skinMPlayerDir=NULL;
|
|
81 char * skinMPlayerDir_obsolete=NULL;
|
|
82 char * skinName = NULL;
|
|
83
|
|
84 void appClearItem( wItem * item )
|
|
85 {
|
|
86 item->type=0;
|
|
87 // ---
|
|
88 item->x=0; item->y=0; item->width=0; item->height=0;
|
|
89 // ---
|
|
90 item->px=0; item->py=0; item->psx=0; item->psy=0;
|
|
91 // ---
|
|
92 item->msg=0; item->msg2=0;
|
|
93 item->pressed=btnReleased;
|
|
94 item->tmp=0;
|
|
95 item->key=0; item->key2=0;
|
|
96 item->Bitmap.Width=0; item->Bitmap.Height=0; item->Bitmap.BPP=0; item->Bitmap.ImageSize=0;
|
|
97 if ( item->Bitmap.Image ) free( item->Bitmap.Image );
|
|
98 item->Bitmap.Image=NULL;
|
|
99 // ---
|
|
100 item->fontid=0;
|
|
101 if ( item->label ) free( item->label ); item->label=NULL;
|
|
102 item->event=0;
|
|
103 }
|
|
104
|
|
105 void appCopy( listItems * dest,listItems * source )
|
|
106 {
|
|
107 dest->NumberOfItems=source->NumberOfItems;
|
|
108 memcpy( &dest->Items,&source->Items,128 * sizeof( wItem ) );
|
|
109
|
|
110 dest->NumberOfMenuItems=source->NumberOfMenuItems;
|
|
111 memcpy( &dest->MenuItems,&source->MenuItems,32 * sizeof( wItem ) );
|
|
112
|
|
113 memcpy( &dest->main,&source->main,sizeof( wItem ) );
|
|
114 memcpy( &dest->sub,&source->sub,sizeof( wItem ) );
|
|
115 memcpy( &dest->menuBase,&source->menuBase,sizeof( wItem ) );
|
|
116 memcpy( &dest->menuSelected,&source->menuSelected,sizeof( wItem ) );
|
|
117 }
|
|
118
|
|
119 void appInitStruct( listItems * item )
|
|
120 {
|
|
121 int i;
|
|
122 for ( i=0;i<item->NumberOfItems;i++ )
|
|
123 appClearItem( &item->Items[i] );
|
|
124 for ( i=0;i<item->NumberOfMenuItems;i++ )
|
|
125 appClearItem( &item->MenuItems[i] );
|
|
126 for ( i=0;i<item->NumberOfBarItems;i++ )
|
|
127 appClearItem( &item->barItems[i] );
|
|
128
|
|
129 item->NumberOfItems=-1;
|
|
130 memset( item->Items,0,256 * sizeof( wItem ) );
|
|
131 item->NumberOfMenuItems=-1;
|
|
132 memset( item->MenuItems,0,64 * sizeof( wItem ) );
|
|
133 item->NumberOfBarItems=-1;
|
|
134 memset( item->barItems,0,256 * sizeof( wItem ) );
|
|
135
|
|
136 appClearItem( &item->main );
|
|
137 item->mainDecoration=0;
|
|
138 appClearItem( &item->sub );
|
|
139 item->sub.width=0; item->sub.height=0;
|
|
140 item->sub.x=-1; item->sub.y=-1;
|
|
141 appClearItem( &item->menuBase );
|
|
142 appClearItem( &item->menuSelected );
|
|
143 item->sub.R=item->sub.G=item->sub.B=0;
|
|
144 item->bar.R=item->bar.G=item->bar.B=0;
|
|
145 item->main.R=item->main.G=item->main.B=0;
|
|
146 item->barIsPresent=0;
|
|
147 item->menuIsPresent=0;
|
|
148 }
|
|
149
|
|
150 int appFindKey( unsigned char * name )
|
|
151 {
|
|
152 int i;
|
|
153 for ( i=0;i<wsKeyNumber;i++ )
|
|
154 if ( !strcmp( wsKeyNames[i].name,name ) ) return wsKeyNames[i].code;
|
|
155 return -1;
|
|
156 }
|
|
157
|
|
158 int appFindMessage( unsigned char * str )
|
|
159 {
|
|
160 int i;
|
|
161 for ( i=0;i<evBoxs;i++ )
|
|
162 if ( !strcmp( evNames[i].name,str ) ) return evNames[i].msg;
|
|
163 return -1;
|
|
164 }
|
|
165
|
|
166 void btnModify( int event,float state )
|
|
167 {
|
|
168 int j;
|
|
169 for ( j=0;j < appMPlayer.NumberOfItems + 1;j++ )
|
|
170 if ( appMPlayer.Items[j].msg == event )
|
|
171 {
|
|
172 switch ( appMPlayer.Items[j].type )
|
|
173 {
|
|
174 case itButton:
|
|
175 appMPlayer.Items[j].pressed=(int)state;
|
|
176 appMPlayer.Items[j].tmp=(int)state;
|
|
177 break;
|
|
178 case itPotmeter:
|
|
179 case itVPotmeter:
|
|
180 case itHPotmeter:
|
|
181 if ( state < 0.0f ) state=0.0f;
|
|
182 if ( state > 100.f ) state=100.0f;
|
|
183 appMPlayer.Items[j].value=state;
|
|
184 break;
|
|
185 }
|
|
186 }
|
|
187
|
|
188 for ( j=0;j < appMPlayer.NumberOfBarItems + 1;j++ )
|
|
189 if ( appMPlayer.barItems[j].msg == event )
|
|
190 {
|
|
191 switch ( appMPlayer.barItems[j].type )
|
|
192 {
|
|
193 case itButton:
|
|
194 appMPlayer.barItems[j].pressed=(int)state;
|
|
195 appMPlayer.barItems[j].tmp=(int)state;
|
|
196 break;
|
|
197 case itPotmeter:
|
|
198 case itVPotmeter:
|
|
199 case itHPotmeter:
|
|
200 if ( state < 0.0f ) state=0.0f;
|
|
201 if ( state > 100.f ) state=100.0f;
|
|
202 appMPlayer.barItems[j].value=state;
|
|
203 break;
|
|
204 }
|
|
205 }
|
|
206 }
|
|
207
|
|
208 float btnGetValue( int event )
|
|
209 {
|
|
210 int j;
|
|
211 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ )
|
|
212 if ( appMPlayer.Items[j].msg == event ) return appMPlayer.Items[j].value;
|
|
213 return 0;
|
|
214 }
|
|
215
|
|
216 void btnSet( int event,int set )
|
|
217 {
|
|
218 int j;
|
|
219 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ )
|
|
220 if ( appMPlayer.Items[j].msg == event )
|
|
221 { appMPlayer.Items[j].pressed=set; appMPlayer.barItems[j].tmp=0; }
|
|
222 for ( j=0;j<appMPlayer.NumberOfBarItems + 1;j++ )
|
|
223 if ( appMPlayer.barItems[j].msg == event )
|
|
224 { appMPlayer.barItems[j].pressed=set; appMPlayer.barItems[j].tmp=0; }
|
|
225 }
|