Mercurial > mplayer.hg
annotate Gui/app.c @ 11278:ff78d7ceecaa
Dead links updated or removed, Joe Barr section rewritten taking into
account his latest article.
author | diego |
---|---|
date | Sun, 26 Oct 2003 23:08:16 +0000 |
parents | bc24dd70c6e2 |
children | 9635dcba8f29 |
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" }, | |
53 { evNormalSize, "evNormalSize" }, | |
54 { evDoubleSize, "evDoubleSize" }, | |
55 { evSetMoviePosition, "evSetMoviePosition" }, | |
56 { evSetVolume, "evSetVolume" }, | |
57 { evSetBalance, "evSetBalance" }, | |
58 { evHelp, "evHelp" }, | |
59 { evLoadSubtitle, "evLoadSubtitle" }, | |
60 { evPlayDVD, "evPlayDVD" }, | |
61 { evPlayVCD, "evPlayVCD" }, | |
62 { evSetURL, "evSetURL" }, | |
63 { evLoadAudioFile, "evLoadAudioFile" }, | |
64 { evDropSubtitle, "evDropSubtitle" }, | |
9040
2a0619fd84f0
- add new entry's to hungarian skin howto (please Gabu translate)
pontscho
parents:
8973
diff
changeset
|
65 { evSetAspect, "evSetAspect" } |
8043 | 66 }; |
67 | |
68 int evBoxs = sizeof( evNames ) / sizeof( evName ); | |
69 | |
70 // --- | |
71 | |
7092
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
6218
diff
changeset
|
72 extern char *get_path(char *); |
8e9607c5897e
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
pontscho
parents:
6218
diff
changeset
|
73 |
1693 | 74 listItems appMPlayer; |
75 | |
76 char * skinDirInHome=NULL; | |
77 char * skinMPlayerDir=NULL; | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1823
diff
changeset
|
78 char * skinName = NULL; |
1693 | 79 |
80 void appClearItem( wItem * item ) | |
81 { | |
82 item->type=0; | |
83 // --- | |
84 item->x=0; item->y=0; item->width=0; item->height=0; | |
85 // --- | |
86 item->px=0; item->py=0; item->psx=0; item->psy=0; | |
87 // --- | |
88 item->msg=0; item->msg2=0; | |
4979 | 89 item->pressed=btnReleased; |
1693 | 90 item->tmp=0; |
91 item->key=0; item->key2=0; | |
92 item->Bitmap.Width=0; item->Bitmap.Height=0; item->Bitmap.BPP=0; item->Bitmap.ImageSize=0; | |
4979 | 93 if ( item->Bitmap.Image ) free( item->Bitmap.Image ); |
94 item->Bitmap.Image=NULL; | |
1693 | 95 // --- |
96 item->fontid=0; | |
97 if ( item->label ) free( item->label ); item->label=NULL; | |
98 item->event=0; | |
99 } | |
100 | |
101 void appCopy( listItems * dest,listItems * source ) | |
102 { | |
103 dest->NumberOfItems=source->NumberOfItems; | |
104 memcpy( &dest->Items,&source->Items,128 * sizeof( wItem ) ); | |
105 | |
106 dest->NumberOfMenuItems=source->NumberOfMenuItems; | |
107 memcpy( &dest->MenuItems,&source->MenuItems,32 * sizeof( wItem ) ); | |
108 | |
109 memcpy( &dest->main,&source->main,sizeof( wItem ) ); | |
110 memcpy( &dest->sub,&source->sub,sizeof( wItem ) ); | |
111 memcpy( &dest->menuBase,&source->menuBase,sizeof( wItem ) ); | |
112 memcpy( &dest->menuSelected,&source->menuSelected,sizeof( wItem ) ); | |
113 } | |
114 | |
115 void appInitStruct( listItems * item ) | |
116 { | |
117 int i; | |
118 for ( i=0;i<item->NumberOfItems;i++ ) | |
119 appClearItem( &item->Items[i] ); | |
120 for ( i=0;i<item->NumberOfMenuItems;i++ ) | |
121 appClearItem( &item->MenuItems[i] ); | |
9625 | 122 for ( i=0;i<item->NumberOfBarItems;i++ ) |
123 appClearItem( &item->barItems[i] ); | |
1693 | 124 |
125 item->NumberOfItems=-1; | |
9625 | 126 memset( item->Items,0,256 * sizeof( wItem ) ); |
1693 | 127 item->NumberOfMenuItems=-1; |
9625 | 128 memset( item->MenuItems,0,64 * sizeof( wItem ) ); |
129 item->NumberOfBarItems=-1; | |
130 memset( item->barItems,0,256 * sizeof( wItem ) ); | |
1693 | 131 |
132 appClearItem( &item->main ); | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1823
diff
changeset
|
133 item->mainDecoration=0; |
1693 | 134 appClearItem( &item->sub ); |
9625 | 135 item->sub.width=0; item->sub.height=0; |
1823 | 136 item->sub.x=-1; item->sub.y=-1; |
1693 | 137 appClearItem( &item->menuBase ); |
138 appClearItem( &item->menuSelected ); | |
8973 | 139 item->sub.R=item->sub.G=item->sub.B=0; |
140 item->bar.R=item->bar.G=item->bar.B=0; | |
141 item->main.R=item->main.G=item->main.B=0; | |
8949 | 142 item->barIsPresent=0; |
143 item->menuIsPresent=0; | |
1693 | 144 } |
145 | |
146 int appFindKey( unsigned char * name ) | |
147 { | |
148 int i; | |
149 for ( i=0;i<wsKeyNumber;i++ ) | |
150 if ( !strcmp( wsKeyNames[i].name,name ) ) return wsKeyNames[i].code; | |
151 return -1; | |
152 } | |
153 | |
154 int appFindMessage( unsigned char * str ) | |
155 { | |
156 int i; | |
157 for ( i=0;i<evBoxs;i++ ) | |
158 if ( !strcmp( evNames[i].name,str ) ) return evNames[i].msg; | |
159 return -1; | |
160 } | |
8280
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
161 |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
162 void btnModify( int event,float state ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
163 { |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
164 int j; |
8973 | 165 for ( j=0;j < appMPlayer.NumberOfItems + 1;j++ ) |
8280
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
166 if ( appMPlayer.Items[j].msg == event ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
167 { |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
168 switch ( appMPlayer.Items[j].type ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
169 { |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
170 case itButton: |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
171 appMPlayer.Items[j].pressed=(int)state; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
172 appMPlayer.Items[j].tmp=(int)state; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
173 break; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
174 case itPotmeter: |
8973 | 175 case itVPotmeter: |
8280
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
176 case itHPotmeter: |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
177 if ( state < 0.0f ) state=0.0f; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
178 if ( state > 100.f ) state=100.0f; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
179 appMPlayer.Items[j].value=state; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
180 break; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
181 } |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
182 } |
8973 | 183 |
184 for ( j=0;j < appMPlayer.NumberOfBarItems + 1;j++ ) | |
185 if ( appMPlayer.barItems[j].msg == event ) | |
186 { | |
187 switch ( appMPlayer.barItems[j].type ) | |
188 { | |
189 case itButton: | |
190 appMPlayer.barItems[j].pressed=(int)state; | |
191 appMPlayer.barItems[j].tmp=(int)state; | |
192 break; | |
193 case itPotmeter: | |
194 case itVPotmeter: | |
195 case itHPotmeter: | |
196 if ( state < 0.0f ) state=0.0f; | |
197 if ( state > 100.f ) state=100.0f; | |
198 appMPlayer.barItems[j].value=state; | |
199 break; | |
200 } | |
201 } | |
8280
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
202 } |
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 float btnGetValue( int event ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
205 { |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
206 int j; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
207 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
208 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
|
209 return 0; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
210 } |
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 void btnSet( int event,int set ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
213 { |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
214 int j; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
215 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) |
9202 | 216 if ( appMPlayer.Items[j].msg == event ) |
217 { appMPlayer.Items[j].pressed=set; appMPlayer.barItems[j].tmp=0; } | |
218 for ( j=0;j<appMPlayer.NumberOfBarItems + 1;j++ ) | |
219 if ( appMPlayer.barItems[j].msg == event ) | |
220 { 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
|
221 } |