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 <string.h>
|
|
21
|
|
22 #include "app.h"
|
32897
|
23
|
|
24 listItems appMPlayer;
|
|
25
|
|
26 static const evName evNames[] = {
|
|
27 { evNone, "evNone" },
|
|
28 { evPlay, "evPlay" },
|
|
29 { evStop, "evStop" },
|
|
30 { evPause, "evPause" },
|
|
31 { evPrev, "evPrev" },
|
|
32 { evNext, "evNext" },
|
|
33 { evLoad, "evLoad" },
|
|
34 { evEqualizer, "evEqualizer" },
|
|
35 { evEqualizer, "evEqualeaser" }, // NOTE TO MYSELF: any skin using this?
|
|
36 { evPlayList, "evPlaylist" },
|
|
37 { evExit, "evExit" },
|
|
38 { evIconify, "evIconify" },
|
|
39 { evIncBalance, "evIncBalance" }, // NOTE TO MYSELF: not all of these events
|
|
40 { evDecBalance, "evDecBalance" }, // are actually implemented, and update doc
|
|
41 { evFullScreen, "evFullScreen" },
|
|
42 { evFName, "evFName" },
|
|
43 { evMovieTime, "evMovieTime" },
|
|
44 { evAbout, "evAbout" },
|
|
45 { evLoadPlay, "evLoadPlay" },
|
|
46 { evPreferences, "evPreferences" },
|
|
47 { evSkinBrowser, "evSkinBrowser" },
|
|
48 { evBackward10sec, "evBackward10sec" },
|
|
49 { evForward10sec, "evForward10sec" },
|
|
50 { evBackward1min, "evBackward1min" },
|
|
51 { evForward1min, "evForward1min" },
|
|
52 { evBackward10min, "evBackward10min" },
|
|
53 { evForward10min, "evForward10min" },
|
|
54 { evIncVolume, "evIncVolume" },
|
|
55 { evDecVolume, "evDecVolume" },
|
|
56 { evMute, "evMute" },
|
|
57 { evIncAudioBufDelay, "evIncAudioBufDelay" },
|
|
58 { evDecAudioBufDelay, "evDecAudioBufDelay" },
|
|
59 { evPlaySwitchToPause, "evPlaySwitchToPause" },
|
|
60 { evPauseSwitchToPlay, "evPauseSwitchToPlay" },
|
|
61 { evNormalSize, "evHalfSize" },
|
|
62 { evNormalSize, "evNormalSize" },
|
|
63 { evDoubleSize, "evDoubleSize" },
|
|
64 { evSetMoviePosition, "evSetMoviePosition" },
|
|
65 { evSetVolume, "evSetVolume" },
|
|
66 { evSetBalance, "evSetBalance" },
|
|
67 { evHelp, "evHelp" },
|
|
68 { evLoadSubtitle, "evLoadSubtitle" },
|
|
69 { evPlayDVD, "evPlayDVD" },
|
|
70 { evPlayVCD, "evPlayVCD" },
|
|
71 { evSetURL, "evSetURL" },
|
|
72 { evLoadAudioFile, "evLoadAudioFile" },
|
|
73 { evDropSubtitle, "evDropSubtitle" },
|
|
74 { evSetAspect, "evSetAspect" }
|
|
75 };
|
23077
|
76
|
32897
|
77 static const int evBoxs = sizeof(evNames) / sizeof(evName);
|
23077
|
78
|
32898
|
79 static void appClearItem(wItem *item)
|
23077
|
80 {
|
32897
|
81 item->type = 0;
|
|
82 item->x = 0;
|
|
83 item->y = 0;
|
|
84 item->width = 0;
|
|
85 item->height = 0;
|
|
86 item->px = 0;
|
|
87 item->py = 0;
|
|
88 item->psx = 0;
|
|
89 item->psy = 0;
|
|
90 item->msg = 0;
|
|
91 item->msg2 = 0;
|
|
92 item->pressed = btnReleased;
|
|
93 item->tmp = 0;
|
|
94 item->key = 0;
|
|
95 item->key2 = 0;
|
|
96 item->Bitmap.Width = 0;
|
|
97 item->Bitmap.Height = 0;
|
|
98 item->Bitmap.BPP = 0;
|
|
99 item->Bitmap.ImageSize = 0;
|
|
100 free(item->Bitmap.Image);
|
|
101 item->Bitmap.Image = NULL;
|
|
102 item->fontid = 0;
|
|
103 free(item->label);
|
|
104 item->label = NULL;
|
|
105 free(item->text);
|
|
106 item->text = NULL;
|
|
107 item->textwidth = 0;
|
|
108 item->starttime = 0;
|
|
109 item->last_x = 0;
|
|
110 item->event = 0;
|
23077
|
111 }
|
|
112
|
32897
|
113 void appInitStruct(listItems *item)
|
23077
|
114 {
|
32897
|
115 int i;
|
|
116
|
|
117 for (i = 0; i < item->NumberOfItems; i++)
|
|
118 appClearItem(&item->Items[i]);
|
|
119 for (i = 0; i < item->NumberOfMenuItems; i++)
|
|
120 appClearItem(&item->MenuItems[i]);
|
|
121 for (i = 0; i < item->NumberOfBarItems; i++)
|
|
122 appClearItem(&item->barItems[i]);
|
|
123
|
|
124 item->NumberOfItems = -1;
|
|
125 memset(item->Items, 0, 256 * sizeof(wItem));
|
|
126
|
|
127 item->NumberOfMenuItems = -1;
|
|
128 memset(item->MenuItems, 0, 64 * sizeof(wItem));
|
23077
|
129
|
32897
|
130 item->NumberOfBarItems = -1;
|
|
131 memset(item->barItems, 0, 256 * sizeof(wItem));
|
|
132
|
|
133 appClearItem(&item->main);
|
|
134 item->mainDecoration = 0;
|
23077
|
135
|
32897
|
136 appClearItem(&item->sub);
|
|
137 item->sub.width = 0;
|
|
138 item->sub.height = 0;
|
|
139 item->sub.x = -1;
|
|
140 item->sub.y = -1;
|
|
141
|
|
142 appClearItem(&item->menuBase);
|
|
143 appClearItem(&item->menuSelected);
|
|
144
|
|
145 item->sub.R = item->sub.G = item->sub.B = 0;
|
|
146 item->bar.R = item->bar.G = item->bar.B = 0;
|
|
147 item->main.R = item->main.G = item->main.B = 0;
|
|
148 item->barIsPresent = 0;
|
|
149 item->menuIsPresent = 0;
|
23077
|
150 }
|
|
151
|
32897
|
152 int appFindMessage(unsigned char *str)
|
23077
|
153 {
|
32897
|
154 int i;
|
|
155
|
|
156 for (i = 0; i < evBoxs; i++)
|
|
157 if (!strcmp(evNames[i].name, str))
|
|
158 return evNames[i].msg;
|
|
159
|
|
160 return -1;
|
23077
|
161 }
|
|
162
|
32897
|
163 void btnModify(int event, float state)
|
23077
|
164 {
|
32897
|
165 int i;
|
|
166
|
|
167 for (i = 0; i < appMPlayer.NumberOfItems + 1; i++) {
|
|
168 if (appMPlayer.Items[i].msg == event) {
|
|
169 switch (appMPlayer.Items[i].type) {
|
|
170 case itButton:
|
|
171 appMPlayer.Items[i].pressed = (int)state;
|
|
172 appMPlayer.Items[i].tmp = (int)state;
|
|
173 break;
|
23077
|
174
|
32897
|
175 case itPotmeter:
|
|
176 case itVPotmeter:
|
|
177 case itHPotmeter:
|
|
178 if (state < 0.0)
|
|
179 state = 0.0;
|
|
180 if (state > 100.0)
|
|
181 state = 100.0;
|
|
182 appMPlayer.Items[i].value = state;
|
|
183 break;
|
|
184 }
|
|
185 }
|
|
186 }
|
|
187
|
|
188 for (i = 0; i < appMPlayer.NumberOfBarItems + 1; i++) {
|
|
189 if (appMPlayer.barItems[i].msg == event) {
|
|
190 switch (appMPlayer.barItems[i].type) {
|
|
191 case itButton:
|
|
192 appMPlayer.barItems[i].pressed = (int)state;
|
|
193 appMPlayer.barItems[i].tmp = (int)state;
|
|
194 break;
|
|
195
|
|
196 case itPotmeter:
|
|
197 case itVPotmeter:
|
|
198 case itHPotmeter:
|
|
199 if (state < 0.0)
|
|
200 state = 0.0;
|
|
201 if (state > 100.0)
|
|
202 state = 100.0;
|
|
203 appMPlayer.barItems[i].value = state;
|
|
204 break;
|
|
205 }
|
|
206 }
|
|
207 }
|
23077
|
208 }
|
|
209
|
32897
|
210 void btnSet(int event, int set)
|
23077
|
211 {
|
32897
|
212 int i;
|
|
213
|
|
214 for (i = 0; i < appMPlayer.NumberOfItems + 1; i++) {
|
|
215 if (appMPlayer.Items[i].msg == event) {
|
|
216 appMPlayer.Items[i].pressed = set;
|
|
217 appMPlayer.barItems[i].tmp = 0;
|
|
218 }
|
|
219 }
|
|
220
|
|
221 for (i = 0; i < appMPlayer.NumberOfBarItems + 1; i++) {
|
|
222 if (appMPlayer.barItems[i].msg == event) {
|
|
223 appMPlayer.barItems[i].pressed = set;
|
|
224 appMPlayer.barItems[i].tmp = 0;
|
|
225 }
|
|
226 }
|
23077
|
227 }
|