Mercurial > mplayer.hg
annotate gui/app.c @ 30042:70b37e4475b6
Remove pointless return statements from functions that return nothing.
author | diego |
---|---|
date | Sun, 20 Dec 2009 17:09:20 +0000 |
parents | 0f1b5b68af32 |
children | 8fa2f43cb760 |
rev | line source |
---|---|
26458 | 1 /* |
2 * This file is part of MPlayer. | |
3 * | |
4 * MPlayer is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
6 * the Free Software Foundation; either version 2 of the License, or | |
7 * (at your option) any later version. | |
8 * | |
9 * MPlayer is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License along | |
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 */ | |
23077 | 18 |
19 #include <stdlib.h> | |
20 #include <stdio.h> | |
21 #include <string.h> | |
22 | |
23 #include "config.h" | |
24 #include "mp_msg.h" | |
25 #include "help_mp.h" | |
26 | |
27 #include "app.h" | |
28 #include "wm/wskeys.h" | |
29 #include "skin/skin.h" | |
30 #include "mplayer/gmplayer.h" | |
31 #include "interface.h" | |
32 | |
25243 | 33 static const evName evNames[] = |
23077 | 34 { |
35 { evNone, "evNone" }, | |
36 { evPlay, "evPlay" }, | |
37 { evStop, "evStop" }, | |
38 { evPause, "evPause" }, | |
39 { evPrev, "evPrev" }, | |
40 { evNext, "evNext" }, | |
41 { evLoad, "evLoad" }, | |
42 { evEqualizer, "evEqualizer" }, | |
43 { evEqualizer, "evEqualeaser" }, | |
44 { evPlayList, "evPlaylist" }, | |
45 { evExit, "evExit" }, | |
46 { evIconify, "evIconify" }, | |
47 { evIncBalance, "evIncBalance" }, | |
48 { evDecBalance, "evDecBalance" }, | |
49 { evFullScreen, "evFullScreen" }, | |
50 { evFName, "evFName" }, | |
51 { evMovieTime, "evMovieTime" }, | |
52 { evAbout, "evAbout" }, | |
53 { evLoadPlay, "evLoadPlay" }, | |
54 { evPreferences, "evPreferences" }, | |
55 { evSkinBrowser, "evSkinBrowser" }, | |
56 { evBackward10sec, "evBackward10sec" }, | |
57 { evForward10sec, "evForward10sec" }, | |
58 { evBackward1min, "evBackward1min" }, | |
59 { evForward1min, "evForward1min" }, | |
60 { evBackward10min, "evBackward10min" }, | |
61 { evForward10min, "evForward10min" }, | |
62 { evIncVolume, "evIncVolume" }, | |
63 { evDecVolume, "evDecVolume" }, | |
64 { evMute, "evMute" }, | |
65 { evIncAudioBufDelay, "evIncAudioBufDelay" }, | |
66 { evDecAudioBufDelay, "evDecAudioBufDelay" }, | |
67 { evPlaySwitchToPause, "evPlaySwitchToPause" }, | |
68 { evPauseSwitchToPlay, "evPauseSwitchToPlay" }, | |
69 { evNormalSize, "evHalfSize" }, | |
70 { evNormalSize, "evNormalSize" }, | |
71 { evDoubleSize, "evDoubleSize" }, | |
72 { evSetMoviePosition, "evSetMoviePosition" }, | |
73 { evSetVolume, "evSetVolume" }, | |
74 { evSetBalance, "evSetBalance" }, | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26458
diff
changeset
|
75 { evHelp, "evHelp" }, |
23077 | 76 { evLoadSubtitle, "evLoadSubtitle" }, |
77 { evPlayDVD, "evPlayDVD" }, | |
78 { evPlayVCD, "evPlayVCD" }, | |
79 { evSetURL, "evSetURL" }, | |
80 { evLoadAudioFile, "evLoadAudioFile" }, | |
81 { evDropSubtitle, "evDropSubtitle" }, | |
82 { evSetAspect, "evSetAspect" } | |
83 }; | |
84 | |
25243 | 85 static const int evBoxs = sizeof( evNames ) / sizeof( evName ); |
23077 | 86 |
87 // --- | |
88 | |
89 listItems appMPlayer; | |
90 | |
91 /* FIXME: Eventually remove the obsolete directory names. */ | |
92 char * skinDirInHome=NULL; | |
93 char * skinDirInHome_obsolete=NULL; | |
94 char * skinMPlayerDir=NULL; | |
95 char * skinMPlayerDir_obsolete=NULL; | |
96 char * skinName = NULL; | |
97 | |
98 void appClearItem( wItem * item ) | |
99 { | |
100 item->type=0; | |
101 // --- | |
102 item->x=0; item->y=0; item->width=0; item->height=0; | |
103 // --- | |
104 item->px=0; item->py=0; item->psx=0; item->psy=0; | |
105 // --- | |
106 item->msg=0; item->msg2=0; | |
107 item->pressed=btnReleased; | |
108 item->tmp=0; | |
109 item->key=0; item->key2=0; | |
110 item->Bitmap.Width=0; item->Bitmap.Height=0; item->Bitmap.BPP=0; item->Bitmap.ImageSize=0; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26458
diff
changeset
|
111 if ( item->Bitmap.Image ) free( item->Bitmap.Image ); |
23077 | 112 item->Bitmap.Image=NULL; |
113 // --- | |
114 item->fontid=0; | |
115 if ( item->label ) free( item->label ); item->label=NULL; | |
116 item->event=0; | |
117 } | |
118 | |
119 void appCopy( listItems * dest,listItems * source ) | |
120 { | |
121 dest->NumberOfItems=source->NumberOfItems; | |
122 memcpy( &dest->Items,&source->Items,128 * sizeof( wItem ) ); | |
123 | |
124 dest->NumberOfMenuItems=source->NumberOfMenuItems; | |
125 memcpy( &dest->MenuItems,&source->MenuItems,32 * sizeof( wItem ) ); | |
126 | |
127 memcpy( &dest->main,&source->main,sizeof( wItem ) ); | |
128 memcpy( &dest->sub,&source->sub,sizeof( wItem ) ); | |
129 memcpy( &dest->menuBase,&source->menuBase,sizeof( wItem ) ); | |
130 memcpy( &dest->menuSelected,&source->menuSelected,sizeof( wItem ) ); | |
131 } | |
132 | |
133 void appInitStruct( listItems * item ) | |
134 { | |
135 int i; | |
136 for ( i=0;i<item->NumberOfItems;i++ ) | |
137 appClearItem( &item->Items[i] ); | |
138 for ( i=0;i<item->NumberOfMenuItems;i++ ) | |
139 appClearItem( &item->MenuItems[i] ); | |
140 for ( i=0;i<item->NumberOfBarItems;i++ ) | |
141 appClearItem( &item->barItems[i] ); | |
142 | |
143 item->NumberOfItems=-1; | |
144 memset( item->Items,0,256 * sizeof( wItem ) ); | |
145 item->NumberOfMenuItems=-1; | |
146 memset( item->MenuItems,0,64 * sizeof( wItem ) ); | |
147 item->NumberOfBarItems=-1; | |
148 memset( item->barItems,0,256 * sizeof( wItem ) ); | |
149 | |
150 appClearItem( &item->main ); | |
151 item->mainDecoration=0; | |
152 appClearItem( &item->sub ); | |
153 item->sub.width=0; item->sub.height=0; | |
154 item->sub.x=-1; item->sub.y=-1; | |
155 appClearItem( &item->menuBase ); | |
156 appClearItem( &item->menuSelected ); | |
157 item->sub.R=item->sub.G=item->sub.B=0; | |
158 item->bar.R=item->bar.G=item->bar.B=0; | |
159 item->main.R=item->main.G=item->main.B=0; | |
160 item->barIsPresent=0; | |
161 item->menuIsPresent=0; | |
162 } | |
163 | |
164 int appFindKey( unsigned char * name ) | |
165 { | |
166 int i; | |
167 for ( i=0;i<wsKeyNumber;i++ ) | |
168 if ( !strcmp( wsKeyNames[i].name,name ) ) return wsKeyNames[i].code; | |
169 return -1; | |
170 } | |
171 | |
172 int appFindMessage( unsigned char * str ) | |
173 { | |
174 int i; | |
175 for ( i=0;i<evBoxs;i++ ) | |
176 if ( !strcmp( evNames[i].name,str ) ) return evNames[i].msg; | |
177 return -1; | |
178 } | |
179 | |
180 void btnModify( int event,float state ) | |
181 { | |
182 int j; | |
183 for ( j=0;j < appMPlayer.NumberOfItems + 1;j++ ) | |
184 if ( appMPlayer.Items[j].msg == event ) | |
185 { | |
186 switch ( appMPlayer.Items[j].type ) | |
187 { | |
188 case itButton: | |
189 appMPlayer.Items[j].pressed=(int)state; | |
190 appMPlayer.Items[j].tmp=(int)state; | |
191 break; | |
192 case itPotmeter: | |
193 case itVPotmeter: | |
194 case itHPotmeter: | |
195 if ( state < 0.0f ) state=0.0f; | |
196 if ( state > 100.f ) state=100.0f; | |
197 appMPlayer.Items[j].value=state; | |
198 break; | |
199 } | |
200 } | |
201 | |
202 for ( j=0;j < appMPlayer.NumberOfBarItems + 1;j++ ) | |
203 if ( appMPlayer.barItems[j].msg == event ) | |
204 { | |
205 switch ( appMPlayer.barItems[j].type ) | |
206 { | |
207 case itButton: | |
208 appMPlayer.barItems[j].pressed=(int)state; | |
209 appMPlayer.barItems[j].tmp=(int)state; | |
210 break; | |
211 case itPotmeter: | |
212 case itVPotmeter: | |
213 case itHPotmeter: | |
214 if ( state < 0.0f ) state=0.0f; | |
215 if ( state > 100.f ) state=100.0f; | |
216 appMPlayer.barItems[j].value=state; | |
217 break; | |
218 } | |
219 } | |
220 } | |
221 | |
222 float btnGetValue( int event ) | |
223 { | |
224 int j; | |
225 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) | |
226 if ( appMPlayer.Items[j].msg == event ) return appMPlayer.Items[j].value; | |
227 return 0; | |
228 } | |
229 | |
230 void btnSet( int event,int set ) | |
231 { | |
232 int j; | |
233 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) | |
234 if ( appMPlayer.Items[j].msg == event ) | |
235 { appMPlayer.Items[j].pressed=set; appMPlayer.barItems[j].tmp=0; } | |
236 for ( j=0;j<appMPlayer.NumberOfBarItems + 1;j++ ) | |
237 if ( appMPlayer.barItems[j].msg == event ) | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26458
diff
changeset
|
238 { appMPlayer.barItems[j].pressed=set; appMPlayer.barItems[j].tmp=0; } |
23077 | 239 } |