Mercurial > mplayer.hg
annotate gui/app.c @ 33037:67db78ffdb22
sync with en/mplayer.1 rev. 33107
author | jrash |
---|---|
date | Sun, 27 Mar 2011 02:15:38 +0000 |
parents | 8de2eee48196 |
children | 901dc2c4130f |
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 "app.h" | |
32897 | 20 |
32921 | 21 #include "interface.h" |
32983 | 22 #include "skin/font.h" |
32921 | 23 |
32944 | 24 #include "libavutil/common.h" |
25 | |
32937 | 26 guiItems appMPlayer; |
32897 | 27 |
28 static const evName evNames[] = { | |
29 { evNone, "evNone" }, | |
30 { evPlay, "evPlay" }, | |
31 { evStop, "evStop" }, | |
32 { evPause, "evPause" }, | |
33 { evPrev, "evPrev" }, | |
34 { evNext, "evNext" }, | |
35 { evLoad, "evLoad" }, | |
36 { evEqualizer, "evEqualizer" }, | |
37 { evEqualizer, "evEqualeaser" }, // NOTE TO MYSELF: any skin using this? | |
38 { evPlayList, "evPlaylist" }, | |
39 { evExit, "evExit" }, | |
40 { evIconify, "evIconify" }, | |
41 { evIncBalance, "evIncBalance" }, // NOTE TO MYSELF: not all of these events | |
42 { evDecBalance, "evDecBalance" }, // are actually implemented, and update doc | |
43 { evFullScreen, "evFullScreen" }, | |
44 { evFName, "evFName" }, | |
45 { evMovieTime, "evMovieTime" }, | |
46 { evAbout, "evAbout" }, | |
47 { evLoadPlay, "evLoadPlay" }, | |
48 { evPreferences, "evPreferences" }, | |
49 { evSkinBrowser, "evSkinBrowser" }, | |
50 { evBackward10sec, "evBackward10sec" }, | |
51 { evForward10sec, "evForward10sec" }, | |
52 { evBackward1min, "evBackward1min" }, | |
53 { evForward1min, "evForward1min" }, | |
54 { evBackward10min, "evBackward10min" }, | |
55 { evForward10min, "evForward10min" }, | |
56 { evIncVolume, "evIncVolume" }, | |
57 { evDecVolume, "evDecVolume" }, | |
58 { evMute, "evMute" }, | |
59 { evIncAudioBufDelay, "evIncAudioBufDelay" }, | |
60 { evDecAudioBufDelay, "evDecAudioBufDelay" }, | |
61 { evPlaySwitchToPause, "evPlaySwitchToPause" }, | |
62 { evPauseSwitchToPlay, "evPauseSwitchToPlay" }, | |
63 { evNormalSize, "evHalfSize" }, | |
64 { evNormalSize, "evNormalSize" }, | |
65 { evDoubleSize, "evDoubleSize" }, | |
66 { evSetMoviePosition, "evSetMoviePosition" }, | |
67 { evSetVolume, "evSetVolume" }, | |
68 { evSetBalance, "evSetBalance" }, | |
69 { evHelp, "evHelp" }, | |
70 { evLoadSubtitle, "evLoadSubtitle" }, | |
71 { evPlayDVD, "evPlayDVD" }, | |
72 { evPlayVCD, "evPlayVCD" }, | |
73 { evSetURL, "evSetURL" }, | |
74 { evLoadAudioFile, "evLoadAudioFile" }, | |
75 { evDropSubtitle, "evDropSubtitle" }, | |
76 { evSetAspect, "evSetAspect" } | |
77 }; | |
23077 | 78 |
32898 | 79 static void appClearItem(wItem *item) |
23077 | 80 { |
32917
9949f3a123cf
Add new function bpFree() to free txSamples (bitmaps).
ib
parents:
32912
diff
changeset
|
81 bpFree(&item->Bitmap); |
32921 | 82 bpFree(&item->Mask); |
32947 | 83 free(item->label); |
84 free(item->text); | |
32946 | 85 memset(item, 0, sizeof(*item)); |
23077 | 86 } |
87 | |
32945 | 88 void appInitStruct(void) |
32927 | 89 { |
32931
03b1051bed5c
Rename the 'NumberOf' members of the listItems structure.
ib
parents:
32930
diff
changeset
|
90 appMPlayer.IndexOfMainItems = -1; |
03b1051bed5c
Rename the 'NumberOf' members of the listItems structure.
ib
parents:
32930
diff
changeset
|
91 appMPlayer.IndexOfBarItems = -1; |
03b1051bed5c
Rename the 'NumberOf' members of the listItems structure.
ib
parents:
32930
diff
changeset
|
92 appMPlayer.IndexOfMenuItems = -1; |
32927 | 93 |
94 appMPlayer.sub.x = -1; // NOTE TO MYSELF: is this really necessary? | |
95 appMPlayer.sub.y = -1; // NOTE TO MYSELF: is this really necessary? | |
96 } | |
97 | |
32932 | 98 void appFreeStruct(void) |
23077 | 99 { |
32897 | 100 int i; |
101 | |
32929 | 102 appClearItem(&appMPlayer.main); |
103 appMPlayer.mainDecoration = 0; | |
104 | |
105 appClearItem(&appMPlayer.sub); | |
106 | |
107 appClearItem(&appMPlayer.bar); | |
108 appMPlayer.barIsPresent = 0; | |
109 | |
110 appClearItem(&appMPlayer.menuBase); | |
111 appClearItem(&appMPlayer.menuSelected); | |
112 appMPlayer.menuIsPresent = 0; | |
113 | |
32931
03b1051bed5c
Rename the 'NumberOf' members of the listItems structure.
ib
parents:
32930
diff
changeset
|
114 for (i = 0; i <= appMPlayer.IndexOfMainItems; i++) |
32926 | 115 appClearItem(&appMPlayer.mainItems[i]); |
32931
03b1051bed5c
Rename the 'NumberOf' members of the listItems structure.
ib
parents:
32930
diff
changeset
|
116 for (i = 0; i <= appMPlayer.IndexOfBarItems; i++) |
32926 | 117 appClearItem(&appMPlayer.barItems[i]); |
32931
03b1051bed5c
Rename the 'NumberOf' members of the listItems structure.
ib
parents:
32930
diff
changeset
|
118 for (i = 0; i <= appMPlayer.IndexOfMenuItems; i++) |
32926 | 119 appClearItem(&appMPlayer.menuItems[i]); |
32897 | 120 |
32945 | 121 appInitStruct(); |
32933 | 122 fntFreeFont(); |
23077 | 123 } |
124 | |
32897 | 125 int appFindMessage(unsigned char *str) |
23077 | 126 { |
32944 | 127 unsigned int i; |
32897 | 128 |
32944 | 129 for (i = 0; i < FF_ARRAY_ELEMS(evNames); i++) |
32897 | 130 if (!strcmp(evNames[i].name, str)) |
32911 | 131 return evNames[i].message; |
32897 | 132 |
133 return -1; | |
23077 | 134 } |
135 | |
32897 | 136 void btnModify(int event, float state) |
23077 | 137 { |
32897 | 138 int i; |
139 | |
32931
03b1051bed5c
Rename the 'NumberOf' members of the listItems structure.
ib
parents:
32930
diff
changeset
|
140 for (i = 0; i <= appMPlayer.IndexOfMainItems; i++) { |
32912 | 141 if (appMPlayer.mainItems[i].message == event) { |
142 switch (appMPlayer.mainItems[i].type) { | |
32897 | 143 case itButton: |
32912 | 144 appMPlayer.mainItems[i].pressed = (int)state; |
145 appMPlayer.mainItems[i].tmp = (int)state; | |
32897 | 146 break; |
23077 | 147 |
32897 | 148 case itPotmeter: |
149 case itVPotmeter: | |
150 case itHPotmeter: | |
32960 | 151 if (state < 0.0f) |
152 state = 0.0f; | |
153 if (state > 100.0f) | |
154 state = 100.0f; | |
32912 | 155 appMPlayer.mainItems[i].value = state; |
32897 | 156 break; |
157 } | |
158 } | |
159 } | |
160 | |
32931
03b1051bed5c
Rename the 'NumberOf' members of the listItems structure.
ib
parents:
32930
diff
changeset
|
161 for (i = 0; i <= appMPlayer.IndexOfBarItems; i++) { |
32911 | 162 if (appMPlayer.barItems[i].message == event) { |
32897 | 163 switch (appMPlayer.barItems[i].type) { |
164 case itButton: | |
165 appMPlayer.barItems[i].pressed = (int)state; | |
166 appMPlayer.barItems[i].tmp = (int)state; | |
167 break; | |
168 | |
169 case itPotmeter: | |
170 case itVPotmeter: | |
171 case itHPotmeter: | |
32960 | 172 if (state < 0.0f) |
173 state = 0.0f; | |
174 if (state > 100.0f) | |
175 state = 100.0f; | |
32897 | 176 appMPlayer.barItems[i].value = state; |
177 break; | |
178 } | |
179 } | |
180 } | |
23077 | 181 } |
182 | |
32897 | 183 void btnSet(int event, int set) |
23077 | 184 { |
32897 | 185 int i; |
186 | |
32931
03b1051bed5c
Rename the 'NumberOf' members of the listItems structure.
ib
parents:
32930
diff
changeset
|
187 for (i = 0; i <= appMPlayer.IndexOfMainItems; i++) { |
32912 | 188 if (appMPlayer.mainItems[i].message == event) { |
189 appMPlayer.mainItems[i].pressed = set; | |
190 appMPlayer.barItems[i].tmp = 0; | |
32897 | 191 } |
192 } | |
193 | |
32931
03b1051bed5c
Rename the 'NumberOf' members of the listItems structure.
ib
parents:
32930
diff
changeset
|
194 for (i = 0; i <= appMPlayer.IndexOfBarItems; i++) { |
32911 | 195 if (appMPlayer.barItems[i].message == event) { |
32897 | 196 appMPlayer.barItems[i].pressed = set; |
197 appMPlayer.barItems[i].tmp = 0; | |
198 } | |
199 } | |
23077 | 200 } |