Mercurial > mplayer.hg
annotate gui/app.c @ 32540:0143883f2e8b
Remove unused struct element.
author | reimar |
---|---|
date | Sun, 14 Nov 2010 15:34:27 +0000 |
parents | 8fa2f43cb760 |
children | 3ceeb62a1125 |
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; | |
32537
8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
cboesch
parents:
29263
diff
changeset
|
111 free(item->Bitmap.Image); |
23077 | 112 item->Bitmap.Image=NULL; |
113 // --- | |
114 item->fontid=0; | |
32537
8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
cboesch
parents:
29263
diff
changeset
|
115 free(item->label); |
8fa2f43cb760
Remove most of the NULL pointer check before free all over the code
cboesch
parents:
29263
diff
changeset
|
116 item->label=NULL; |
23077 | 117 item->event=0; |
118 } | |
119 | |
120 void appCopy( listItems * dest,listItems * source ) | |
121 { | |
122 dest->NumberOfItems=source->NumberOfItems; | |
123 memcpy( &dest->Items,&source->Items,128 * sizeof( wItem ) ); | |
124 | |
125 dest->NumberOfMenuItems=source->NumberOfMenuItems; | |
126 memcpy( &dest->MenuItems,&source->MenuItems,32 * sizeof( wItem ) ); | |
127 | |
128 memcpy( &dest->main,&source->main,sizeof( wItem ) ); | |
129 memcpy( &dest->sub,&source->sub,sizeof( wItem ) ); | |
130 memcpy( &dest->menuBase,&source->menuBase,sizeof( wItem ) ); | |
131 memcpy( &dest->menuSelected,&source->menuSelected,sizeof( wItem ) ); | |
132 } | |
133 | |
134 void appInitStruct( listItems * item ) | |
135 { | |
136 int i; | |
137 for ( i=0;i<item->NumberOfItems;i++ ) | |
138 appClearItem( &item->Items[i] ); | |
139 for ( i=0;i<item->NumberOfMenuItems;i++ ) | |
140 appClearItem( &item->MenuItems[i] ); | |
141 for ( i=0;i<item->NumberOfBarItems;i++ ) | |
142 appClearItem( &item->barItems[i] ); | |
143 | |
144 item->NumberOfItems=-1; | |
145 memset( item->Items,0,256 * sizeof( wItem ) ); | |
146 item->NumberOfMenuItems=-1; | |
147 memset( item->MenuItems,0,64 * sizeof( wItem ) ); | |
148 item->NumberOfBarItems=-1; | |
149 memset( item->barItems,0,256 * sizeof( wItem ) ); | |
150 | |
151 appClearItem( &item->main ); | |
152 item->mainDecoration=0; | |
153 appClearItem( &item->sub ); | |
154 item->sub.width=0; item->sub.height=0; | |
155 item->sub.x=-1; item->sub.y=-1; | |
156 appClearItem( &item->menuBase ); | |
157 appClearItem( &item->menuSelected ); | |
158 item->sub.R=item->sub.G=item->sub.B=0; | |
159 item->bar.R=item->bar.G=item->bar.B=0; | |
160 item->main.R=item->main.G=item->main.B=0; | |
161 item->barIsPresent=0; | |
162 item->menuIsPresent=0; | |
163 } | |
164 | |
165 int appFindKey( unsigned char * name ) | |
166 { | |
167 int i; | |
168 for ( i=0;i<wsKeyNumber;i++ ) | |
169 if ( !strcmp( wsKeyNames[i].name,name ) ) return wsKeyNames[i].code; | |
170 return -1; | |
171 } | |
172 | |
173 int appFindMessage( unsigned char * str ) | |
174 { | |
175 int i; | |
176 for ( i=0;i<evBoxs;i++ ) | |
177 if ( !strcmp( evNames[i].name,str ) ) return evNames[i].msg; | |
178 return -1; | |
179 } | |
180 | |
181 void btnModify( int event,float state ) | |
182 { | |
183 int j; | |
184 for ( j=0;j < appMPlayer.NumberOfItems + 1;j++ ) | |
185 if ( appMPlayer.Items[j].msg == event ) | |
186 { | |
187 switch ( appMPlayer.Items[j].type ) | |
188 { | |
189 case itButton: | |
190 appMPlayer.Items[j].pressed=(int)state; | |
191 appMPlayer.Items[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.Items[j].value=state; | |
199 break; | |
200 } | |
201 } | |
202 | |
203 for ( j=0;j < appMPlayer.NumberOfBarItems + 1;j++ ) | |
204 if ( appMPlayer.barItems[j].msg == event ) | |
205 { | |
206 switch ( appMPlayer.barItems[j].type ) | |
207 { | |
208 case itButton: | |
209 appMPlayer.barItems[j].pressed=(int)state; | |
210 appMPlayer.barItems[j].tmp=(int)state; | |
211 break; | |
212 case itPotmeter: | |
213 case itVPotmeter: | |
214 case itHPotmeter: | |
215 if ( state < 0.0f ) state=0.0f; | |
216 if ( state > 100.f ) state=100.0f; | |
217 appMPlayer.barItems[j].value=state; | |
218 break; | |
219 } | |
220 } | |
221 } | |
222 | |
223 float btnGetValue( int event ) | |
224 { | |
225 int j; | |
226 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) | |
227 if ( appMPlayer.Items[j].msg == event ) return appMPlayer.Items[j].value; | |
228 return 0; | |
229 } | |
230 | |
231 void btnSet( int event,int set ) | |
232 { | |
233 int j; | |
234 for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) | |
235 if ( appMPlayer.Items[j].msg == event ) | |
236 { appMPlayer.Items[j].pressed=set; appMPlayer.barItems[j].tmp=0; } | |
237 for ( j=0;j<appMPlayer.NumberOfBarItems + 1;j++ ) | |
238 if ( appMPlayer.barItems[j].msg == event ) | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26458
diff
changeset
|
239 { appMPlayer.barItems[j].pressed=set; appMPlayer.barItems[j].tmp=0; } |
23077 | 240 } |