Mercurial > mplayer.hg
annotate Gui/app.c @ 9549:e45da41573ef
Document translated to polish language.
author | mpt |
---|---|
date | Sun, 09 Mar 2003 14:15:17 +0000 |
parents | c2f31ca14a92 |
children | bc24dd70c6e2 |
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] ); | |
122 | |
123 item->NumberOfItems=-1; | |
124 memset( item->Items,0,128 * sizeof( wItem ) ); | |
125 item->NumberOfMenuItems=-1; | |
126 memset( item->MenuItems,0,32 * sizeof( wItem ) ); | |
127 | |
128 appClearItem( &item->main ); | |
1866
32b1bb50a0e8
some bug fix, and add decoration item to skin conffile. faszom(C)
pontscho
parents:
1823
diff
changeset
|
129 item->mainDecoration=0; |
1693 | 130 appClearItem( &item->sub ); |
1823 | 131 item->sub.Bitmap.Width=384; item->sub.Bitmap.Height=384; |
132 item->sub.width=384; item->sub.height=384; | |
133 item->sub.x=-1; item->sub.y=-1; | |
1693 | 134 appClearItem( &item->menuBase ); |
135 appClearItem( &item->menuSelected ); | |
8973 | 136 item->sub.R=item->sub.G=item->sub.B=0; |
137 item->bar.R=item->bar.G=item->bar.B=0; | |
138 item->main.R=item->main.G=item->main.B=0; | |
8949 | 139 item->barIsPresent=0; |
140 item->menuIsPresent=0; | |
1693 | 141 } |
142 | |
143 int appFindKey( unsigned char * name ) | |
144 { | |
145 int i; | |
146 for ( i=0;i<wsKeyNumber;i++ ) | |
147 if ( !strcmp( wsKeyNames[i].name,name ) ) return wsKeyNames[i].code; | |
148 return -1; | |
149 } | |
150 | |
151 int appFindMessage( unsigned char * str ) | |
152 { | |
153 int i; | |
154 for ( i=0;i<evBoxs;i++ ) | |
155 if ( !strcmp( evNames[i].name,str ) ) return evNames[i].msg; | |
156 return -1; | |
157 } | |
8280
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
158 |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
159 void btnModify( int event,float state ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
160 { |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
161 int j; |
8973 | 162 for ( j=0;j < appMPlayer.NumberOfItems + 1;j++ ) |
8280
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
163 if ( appMPlayer.Items[j].msg == event ) |
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 switch ( appMPlayer.Items[j].type ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
166 { |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
167 case itButton: |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
168 appMPlayer.Items[j].pressed=(int)state; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
169 appMPlayer.Items[j].tmp=(int)state; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
170 break; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
171 case itPotmeter: |
8973 | 172 case itVPotmeter: |
8280
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
173 case itHPotmeter: |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
174 if ( state < 0.0f ) state=0.0f; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
175 if ( state > 100.f ) state=100.0f; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
176 appMPlayer.Items[j].value=state; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
177 break; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
178 } |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
179 } |
8973 | 180 |
181 for ( j=0;j < appMPlayer.NumberOfBarItems + 1;j++ ) | |
182 if ( appMPlayer.barItems[j].msg == event ) | |
183 { | |
184 switch ( appMPlayer.barItems[j].type ) | |
185 { | |
186 case itButton: | |
187 appMPlayer.barItems[j].pressed=(int)state; | |
188 appMPlayer.barItems[j].tmp=(int)state; | |
189 break; | |
190 case itPotmeter: | |
191 case itVPotmeter: | |
192 case itHPotmeter: | |
193 if ( state < 0.0f ) state=0.0f; | |
194 if ( state > 100.f ) state=100.0f; | |
195 appMPlayer.barItems[j].value=state; | |
196 break; | |
197 } | |
198 } | |
8280
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
199 } |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
200 |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
201 float btnGetValue( int event ) |
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 int j; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
204 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
205 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
|
206 return 0; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
207 } |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
208 |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
209 void btnSet( int event,int set ) |
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 int j; |
72700fefd3dc
no seeking if stream is STREAMTYPE_STREAM (net/stdin)
pontscho
parents:
8043
diff
changeset
|
212 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) |
9202 | 213 if ( appMPlayer.Items[j].msg == event ) |
214 { appMPlayer.Items[j].pressed=set; appMPlayer.barItems[j].tmp=0; } | |
215 for ( j=0;j<appMPlayer.NumberOfBarItems + 1;j++ ) | |
216 if ( appMPlayer.barItems[j].msg == event ) | |
217 { 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
|
218 } |