Mercurial > mplayer.hg
annotate gui/app.c @ 33673:38c765585fe5
Cosmetic: Adjust indent.
author | ib |
---|---|
date | Tue, 28 Jun 2011 18:18:32 +0000 |
parents | c5a19bbeac2b |
children | dac15337cfb6 |
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 | |
33555 | 26 guiItems guiApp = { |
27 .IndexOfMainItems = -1, | |
28 .IndexOfPlaybarItems = -1, | |
29 .IndexOfMenuItems = -1 | |
33266 | 30 }; |
32897 | 31 |
32 static const evName evNames[] = { | |
33 { evNone, "evNone" }, | |
34 { evPlay, "evPlay" }, | |
35 { evStop, "evStop" }, | |
36 { evPause, "evPause" }, | |
37 { evPrev, "evPrev" }, | |
38 { evNext, "evNext" }, | |
39 { evLoad, "evLoad" }, | |
40 { evEqualizer, "evEqualizer" }, | |
41 { evPlayList, "evPlaylist" }, | |
42 { evExit, "evExit" }, | |
43 { evIconify, "evIconify" }, | |
44 { evIncBalance, "evIncBalance" }, // NOTE TO MYSELF: not all of these events | |
45 { evDecBalance, "evDecBalance" }, // are actually implemented, and update doc | |
46 { evFullScreen, "evFullScreen" }, | |
47 { evFName, "evFName" }, | |
48 { evMovieTime, "evMovieTime" }, | |
49 { evAbout, "evAbout" }, | |
50 { evLoadPlay, "evLoadPlay" }, | |
51 { evPreferences, "evPreferences" }, | |
52 { evSkinBrowser, "evSkinBrowser" }, | |
53 { evBackward10sec, "evBackward10sec" }, | |
54 { evForward10sec, "evForward10sec" }, | |
55 { evBackward1min, "evBackward1min" }, | |
56 { evForward1min, "evForward1min" }, | |
57 { evBackward10min, "evBackward10min" }, | |
58 { evForward10min, "evForward10min" }, | |
59 { evIncVolume, "evIncVolume" }, | |
60 { evDecVolume, "evDecVolume" }, | |
61 { evMute, "evMute" }, | |
62 { evIncAudioBufDelay, "evIncAudioBufDelay" }, | |
63 { evDecAudioBufDelay, "evDecAudioBufDelay" }, | |
64 { evPlaySwitchToPause, "evPlaySwitchToPause" }, | |
65 { evPauseSwitchToPlay, "evPauseSwitchToPlay" }, | |
66 { evNormalSize, "evHalfSize" }, | |
67 { evNormalSize, "evNormalSize" }, | |
68 { evDoubleSize, "evDoubleSize" }, | |
69 { evSetMoviePosition, "evSetMoviePosition" }, | |
70 { evSetVolume, "evSetVolume" }, | |
71 { evSetBalance, "evSetBalance" }, | |
72 { evHelp, "evHelp" }, | |
73 { evLoadSubtitle, "evLoadSubtitle" }, | |
74 { evPlayDVD, "evPlayDVD" }, | |
75 { evPlayVCD, "evPlayVCD" }, | |
76 { evSetURL, "evSetURL" }, | |
77 { evLoadAudioFile, "evLoadAudioFile" }, | |
78 { evDropSubtitle, "evDropSubtitle" }, | |
79 { evSetAspect, "evSetAspect" } | |
80 }; | |
23077 | 81 |
32898 | 82 static void appClearItem(wItem *item) |
23077 | 83 { |
32917
9949f3a123cf
Add new function bpFree() to free txSamples (bitmaps).
ib
parents:
32912
diff
changeset
|
84 bpFree(&item->Bitmap); |
32921 | 85 bpFree(&item->Mask); |
32947 | 86 free(item->label); |
87 free(item->text); | |
32946 | 88 memset(item, 0, sizeof(*item)); |
23077 | 89 } |
90 | |
32932 | 91 void appFreeStruct(void) |
23077 | 92 { |
32897 | 93 int i; |
94 | |
33555 | 95 appClearItem(&guiApp.main); |
96 guiApp.mainDecoration = 0; | |
32929 | 97 |
33555 | 98 appClearItem(&guiApp.sub); |
32929 | 99 |
33555 | 100 appClearItem(&guiApp.playbar); |
101 guiApp.playbarIsPresent = 0; | |
32929 | 102 |
33555 | 103 appClearItem(&guiApp.menu); |
104 appClearItem(&guiApp.menuSelected); | |
105 guiApp.menuIsPresent = 0; | |
32929 | 106 |
33555 | 107 for (i = 0; i <= guiApp.IndexOfMainItems; i++) |
108 appClearItem(&guiApp.mainItems[i]); | |
109 for (i = 0; i <= guiApp.IndexOfPlaybarItems; i++) | |
110 appClearItem(&guiApp.playbarItems[i]); | |
111 for (i = 0; i <= guiApp.IndexOfMenuItems; i++) | |
112 appClearItem(&guiApp.menuItems[i]); | |
32897 | 113 |
33555 | 114 guiApp.IndexOfMainItems = -1; |
115 guiApp.IndexOfPlaybarItems = -1; | |
116 guiApp.IndexOfMenuItems = -1; | |
33266 | 117 |
32933 | 118 fntFreeFont(); |
23077 | 119 } |
120 | |
32897 | 121 int appFindMessage(unsigned char *str) |
23077 | 122 { |
32944 | 123 unsigned int i; |
32897 | 124 |
32944 | 125 for (i = 0; i < FF_ARRAY_ELEMS(evNames); i++) |
32897 | 126 if (!strcmp(evNames[i].name, str)) |
32911 | 127 return evNames[i].message; |
32897 | 128 |
129 return -1; | |
23077 | 130 } |
131 | |
32897 | 132 void btnModify(int event, float state) |
23077 | 133 { |
32897 | 134 int i; |
135 | |
33555 | 136 for (i = 0; i <= guiApp.IndexOfMainItems; i++) { |
137 if (guiApp.mainItems[i].message == event) { | |
138 switch (guiApp.mainItems[i].type) { | |
32897 | 139 case itButton: |
33555 | 140 guiApp.mainItems[i].pressed = (int)state; |
32897 | 141 break; |
23077 | 142 |
32897 | 143 case itPotmeter: |
144 case itVPotmeter: | |
145 case itHPotmeter: | |
32960 | 146 if (state < 0.0f) |
147 state = 0.0f; | |
148 if (state > 100.0f) | |
149 state = 100.0f; | |
33555 | 150 guiApp.mainItems[i].value = state; |
32897 | 151 break; |
152 } | |
153 } | |
154 } | |
155 | |
33555 | 156 for (i = 0; i <= guiApp.IndexOfPlaybarItems; i++) { |
157 if (guiApp.playbarItems[i].message == event) { | |
158 switch (guiApp.playbarItems[i].type) { | |
32897 | 159 case itButton: |
33555 | 160 guiApp.playbarItems[i].pressed = (int)state; |
32897 | 161 break; |
162 | |
163 case itPotmeter: | |
164 case itVPotmeter: | |
165 case itHPotmeter: | |
32960 | 166 if (state < 0.0f) |
167 state = 0.0f; | |
168 if (state > 100.0f) | |
169 state = 100.0f; | |
33555 | 170 guiApp.playbarItems[i].value = state; |
32897 | 171 break; |
172 } | |
173 } | |
174 } | |
23077 | 175 } |
176 | |
32897 | 177 void btnSet(int event, int set) |
23077 | 178 { |
32897 | 179 int i; |
180 | |
33555 | 181 for (i = 0; i <= guiApp.IndexOfMainItems; i++) |
182 if (guiApp.mainItems[i].message == event) | |
183 guiApp.mainItems[i].pressed = set; | |
32897 | 184 |
33555 | 185 for (i = 0; i <= guiApp.IndexOfPlaybarItems; i++) |
186 if (guiApp.playbarItems[i].message == event) | |
187 guiApp.playbarItems[i].pressed = set; | |
23077 | 188 } |