Mercurial > mplayer.hg
annotate Gui/app.c @ 17050:cd540846d052
Add support to get the list of files from a file containing one filename
per line. Patch from devik (devik .at. cdi .dot. cz).
author | albeu |
---|---|
date | Sat, 26 Nov 2005 17:10:17 +0000 |
parents | 9635dcba8f29 |
children | 0e1471d9da74 |
rev | line source |
---|---|
8043 | 1 |
1693 | 2 |
3 #include <stdlib.h> | |
4 #include <stdio.h> | |
5 #include <string.h> | |
6 | |
3586 | 7 #include "../config.h" |
8 #include "../mp_msg.h" | |
9 #include "../help_mp.h" | |
10 | |
1693 | 11 #include "app.h" |
12 #include "wm/wskeys.h" | |
13 #include "skin/skin.h" | |
14 #include "mplayer/mplayer.h" | |
4979 | 15 #include "interface.h" |
1693 | 16 |
8043 | 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" }, | |
14589 | 53 { evNormalSize, "evHalfSize" }, |
8043 | 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" }, | |
9040
2a0619fd84f0
- add new entry's to hungarian skin howto (please Gabu translate)
pontscho
parents:
8973
diff
changeset
|
66 { evSetAspect, "evSetAspect" } |
8043 | 67 }; |
68 | |
69 int evBoxs = sizeof( evNames ) / sizeof( evName ); | |
70 | |
71 // --- | |
72 | |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
6218
diff
changeset
|
73 extern char *get_path(char *); |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
6218
diff
changeset
|
74 |
1693 | 75 listItems appMPlayer; |
76 | |
77 char * skinDirInHome=NULL; | |
78 char * skinMPlayerDir=NULL; | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1823
diff
changeset
|
79 char * skinName = NULL; |
1693 | 80 |
81 void appClearItem( wItem * item ) | |
82 { | |
83 item->type=0; | |
84 // --- | |
85 item->x=0; item->y=0; item->width=0; item->height=0; | |
86 // --- | |
87 item->px=0; item->py=0; item->psx=0; item->psy=0; | |
88 // --- | |
89 item->msg=0; item->msg2=0; | |
4979 | 90 item->pressed=btnReleased; |
1693 | 91 item->tmp=0; |
92 item->key=0; item->key2=0; | |
93 item->Bitmap.Width=0; item->Bitmap.Height=0; item->Bitmap.BPP=0; item->Bitmap.ImageSize=0; | |
4979 | 94 if ( item->Bitmap.Image ) free( item->Bitmap.Image ); |
95 item->Bitmap.Image=NULL; | |
1693 | 96 // --- |
97 item->fontid=0; | |
98 if ( item->label ) free( item->label ); item->label=NULL; | |
99 item->event=0; | |
100 } | |
101 | |
102 void appCopy( listItems * dest,listItems * source ) | |
103 { | |
104 dest->NumberOfItems=source->NumberOfItems; | |
105 memcpy( &dest->Items,&source->Items,128 * sizeof( wItem ) ); | |
106 | |
107 dest->NumberOfMenuItems=source->NumberOfMenuItems; | |
108 memcpy( &dest->MenuItems,&source->MenuItems,32 * sizeof( wItem ) ); | |
109 | |
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 ) ); | |
114 } | |
115 | |
116 void appInitStruct( listItems * item ) | |
117 { | |
118 int i; | |
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] ); | |
9625 | 123 for ( i=0;i<item->NumberOfBarItems;i++ ) |
124 appClearItem( &item->barItems[i] ); | |
1693 | 125 |
126 item->NumberOfItems=-1; | |
9625 | 127 memset( item->Items,0,256 * sizeof( wItem ) ); |
1693 | 128 item->NumberOfMenuItems=-1; |
9625 | 129 memset( item->MenuItems,0,64 * sizeof( wItem ) ); |
130 item->NumberOfBarItems=-1; | |
131 memset( item->barItems,0,256 * sizeof( wItem ) ); | |
1693 | 132 |
133 appClearItem( &item->main ); | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1823
diff
changeset
|
134 item->mainDecoration=0; |
1693 | 135 appClearItem( &item->sub ); |
9625 | 136 item->sub.width=0; item->sub.height=0; |
1823 | 137 item->sub.x=-1; item->sub.y=-1; |
1693 | 138 appClearItem( &item->menuBase ); |
139 appClearItem( &item->menuSelected ); | |
8973 | 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; | |
8949 | 143 item->barIsPresent=0; |
144 item->menuIsPresent=0; | |
1693 | 145 } |
146 | |
147 int appFindKey( unsigned char * name ) | |
148 { | |
149 int i; | |
150 for ( i=0;i<wsKeyNumber;i++ ) | |
151 if ( !strcmp( wsKeyNames[i].name,name ) ) return wsKeyNames[i].code; | |
152 return -1; | |
153 } | |
154 | |
155 int appFindMessage( unsigned char * str ) | |
156 { | |
157 int i; | |
158 for ( i=0;i<evBoxs;i++ ) | |
159 if ( !strcmp( evNames[i].name,str ) ) return evNames[i].msg; | |
160 return -1; | |
161 } | |
8280
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
162 |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
163 void btnModify( int event,float state ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
164 { |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
165 int j; |
8973 | 166 for ( j=0;j < appMPlayer.NumberOfItems + 1;j++ ) |
8280
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
167 if ( appMPlayer.Items[j].msg == event ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
168 { |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
169 switch ( appMPlayer.Items[j].type ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
170 { |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
171 case itButton: |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
172 appMPlayer.Items[j].pressed=(int)state; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
173 appMPlayer.Items[j].tmp=(int)state; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
174 break; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
175 case itPotmeter: |
8973 | 176 case itVPotmeter: |
8280
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
177 case itHPotmeter: |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
178 if ( state < 0.0f ) state=0.0f; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
179 if ( state > 100.f ) state=100.0f; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
180 appMPlayer.Items[j].value=state; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
181 break; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
182 } |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
183 } |
8973 | 184 |
185 for ( j=0;j < appMPlayer.NumberOfBarItems + 1;j++ ) | |
186 if ( appMPlayer.barItems[j].msg == event ) | |
187 { | |
188 switch ( appMPlayer.barItems[j].type ) | |
189 { | |
190 case itButton: | |
191 appMPlayer.barItems[j].pressed=(int)state; | |
192 appMPlayer.barItems[j].tmp=(int)state; | |
193 break; | |
194 case itPotmeter: | |
195 case itVPotmeter: | |
196 case itHPotmeter: | |
197 if ( state < 0.0f ) state=0.0f; | |
198 if ( state > 100.f ) state=100.0f; | |
199 appMPlayer.barItems[j].value=state; | |
200 break; | |
201 } | |
202 } | |
8280
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
203 } |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
204 |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
205 float btnGetValue( int event ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
206 { |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
207 int j; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
208 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
209 if ( appMPlayer.Items[j].msg == event ) return appMPlayer.Items[j].value; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
210 return 0; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
211 } |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
212 |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
213 void btnSet( int event,int set ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
214 { |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
215 int j; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
216 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) |
9202 | 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; } | |
8280
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
222 } |