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