annotate gui/app.c @ 34064:54becc464788

Set MPlayer filename in uiSetFileName(). This ensures that filename always points to guiInfo.Filename (the GUI filename). If guiInit() is called without filename being set, leave it that way. (This applies if the GUI should not start playing immediately.)
author ib
date Thu, 29 Sep 2011 13:26:32 +0000
parents 1c4a2554d46b
children e905a896243d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26458
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25243
diff changeset
1 /*
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25243
diff changeset
2 * This file is part of MPlayer.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25243
diff changeset
3 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25243
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25243
diff changeset
5 * it under the terms of the GNU General Public License as published by
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25243
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25243
diff changeset
7 * (at your option) any later version.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25243
diff changeset
8 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25243
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25243
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25243
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25243
diff changeset
12 * GNU General Public License for more details.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25243
diff changeset
13 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25243
diff changeset
14 * You should have received a copy of the GNU General Public License along
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25243
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25243
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 25243
diff changeset
17 */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
18
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
19 #include "app.h"
32983
8de2eee48196 Cosmetic: Prefer path relative to current directory.
ib
parents: 32960
diff changeset
20 #include "skin/font.h"
32921
448517f556a5 Fix memory leak in appClearItem().
ib
parents: 32918
diff changeset
21
32944
27a98940e3aa Use FF_ARRAY_ELEMS() rather than a separate constant.
ib
parents: 32937
diff changeset
22 #include "libavutil/common.h"
27a98940e3aa Use FF_ARRAY_ELEMS() rather than a separate constant.
ib
parents: 32937
diff changeset
23
33979
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
24 /**
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
25 * @brief Initialize item counters.
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
26 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
27 guiItems guiApp = {
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
28 .IndexOfMainItems = -1,
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
29 .IndexOfPlaybarItems = -1,
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
30 .IndexOfMenuItems = -1
33266
de4f5f183ddb Initialize appMPlayer differently.
ib
parents: 33218
diff changeset
31 };
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
32
33979
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
33 /**
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
34 * @brief Events belonging to event names.
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
35 */
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
36 static const evName evNames[] = {
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
37 { evNone, "evNone" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
38 { evPlay, "evPlay" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
39 { evStop, "evStop" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
40 { evPause, "evPause" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
41 { evPrev, "evPrev" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
42 { evNext, "evNext" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
43 { evLoad, "evLoad" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
44 { evEqualizer, "evEqualizer" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
45 { evPlayList, "evPlaylist" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
46 { evExit, "evExit" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
47 { evIconify, "evIconify" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
48 { evIncBalance, "evIncBalance" }, // NOTE TO MYSELF: not all of these events
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
49 { evDecBalance, "evDecBalance" }, // are actually implemented, and update doc
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
50 { evFullScreen, "evFullScreen" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
51 { evFName, "evFName" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
52 { evMovieTime, "evMovieTime" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
53 { evAbout, "evAbout" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
54 { evLoadPlay, "evLoadPlay" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
55 { evPreferences, "evPreferences" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
56 { evSkinBrowser, "evSkinBrowser" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
57 { evBackward10sec, "evBackward10sec" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
58 { evForward10sec, "evForward10sec" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
59 { evBackward1min, "evBackward1min" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
60 { evForward1min, "evForward1min" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
61 { evBackward10min, "evBackward10min" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
62 { evForward10min, "evForward10min" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
63 { evIncVolume, "evIncVolume" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
64 { evDecVolume, "evDecVolume" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
65 { evMute, "evMute" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
66 { evIncAudioBufDelay, "evIncAudioBufDelay" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
67 { evDecAudioBufDelay, "evDecAudioBufDelay" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
68 { evPlaySwitchToPause, "evPlaySwitchToPause" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
69 { evPauseSwitchToPlay, "evPauseSwitchToPlay" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
70 { evNormalSize, "evHalfSize" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
71 { evNormalSize, "evNormalSize" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
72 { evDoubleSize, "evDoubleSize" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
73 { evSetMoviePosition, "evSetMoviePosition" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
74 { evSetVolume, "evSetVolume" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
75 { evSetBalance, "evSetBalance" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
76 { evHelp, "evHelp" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
77 { evLoadSubtitle, "evLoadSubtitle" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
78 { evPlayDVD, "evPlayDVD" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
79 { evPlayVCD, "evPlayVCD" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
80 { evSetURL, "evSetURL" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
81 { evLoadAudioFile, "evLoadAudioFile" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
82 { evDropSubtitle, "evDropSubtitle" },
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
83 { evSetAspect, "evSetAspect" }
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
84 };
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
85
33979
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
86 /**
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
87 * @brief Free all memory allocated to an item and set all its pointers to NULL.
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
88 *
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
89 * @param item item to be freed
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
90 */
32898
eeb36d798219 Limit scope of internally used appClearItem().
ib
parents: 32897
diff changeset
91 static void appClearItem(wItem *item)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
92 {
32917
9949f3a123cf Add new function bpFree() to free txSamples (bitmaps).
ib
parents: 32912
diff changeset
93 bpFree(&item->Bitmap);
32921
448517f556a5 Fix memory leak in appClearItem().
ib
parents: 32918
diff changeset
94 bpFree(&item->Mask);
32947
0e4fd1834f76 Prefer free() to gfree().
ib
parents: 32946
diff changeset
95 free(item->label);
0e4fd1834f76 Prefer free() to gfree().
ib
parents: 32946
diff changeset
96 free(item->text);
32946
d551faf8d07e Simplify appClearItem() by using memset().
ib
parents: 32945
diff changeset
97 memset(item, 0, sizeof(*item));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
98 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
99
33979
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
100 /**
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
101 * @brief Free all memory allocated to all GUI items and reset all item counters.
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
102 */
32932
e95ec1b2feea Cosmetic: Rename appInitStruct() to appFreeStruct().
ib
parents: 32931
diff changeset
103 void appFreeStruct(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
104 {
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
105 int i;
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
106
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
107 appClearItem(&guiApp.main);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
108 guiApp.mainDecoration = 0;
32929
6ea9e024f05e Clean up appInitStruct().
ib
parents: 32928
diff changeset
109
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
110 appClearItem(&guiApp.sub);
32929
6ea9e024f05e Clean up appInitStruct().
ib
parents: 32928
diff changeset
111
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
112 appClearItem(&guiApp.playbar);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
113 guiApp.playbarIsPresent = 0;
32929
6ea9e024f05e Clean up appInitStruct().
ib
parents: 32928
diff changeset
114
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
115 appClearItem(&guiApp.menu);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
116 appClearItem(&guiApp.menuSelected);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
117 guiApp.menuIsPresent = 0;
32929
6ea9e024f05e Clean up appInitStruct().
ib
parents: 32928
diff changeset
118
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
119 for (i = 0; i <= guiApp.IndexOfMainItems; i++)
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
120 appClearItem(&guiApp.mainItems[i]);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
121 for (i = 0; i <= guiApp.IndexOfPlaybarItems; i++)
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
122 appClearItem(&guiApp.playbarItems[i]);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
123 for (i = 0; i <= guiApp.IndexOfMenuItems; i++)
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
124 appClearItem(&guiApp.menuItems[i]);
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
125
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
126 guiApp.IndexOfMainItems = -1;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
127 guiApp.IndexOfPlaybarItems = -1;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
128 guiApp.IndexOfMenuItems = -1;
33266
de4f5f183ddb Initialize appMPlayer differently.
ib
parents: 33218
diff changeset
129
32933
258baf2bfeca Move fntFreeFont() into appFreeStruct().
ib
parents: 32932
diff changeset
130 fntFreeFont();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
131 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
132
33979
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
133 /**
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
134 * @brief Find the event belonging to an event name.
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
135 *
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
136 * @param str event name
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
137 *
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
138 * @return event >= 0 (ok) or -1 (not found)
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
139 */
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
140 int appFindMessage(unsigned char *str)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
141 {
32944
27a98940e3aa Use FF_ARRAY_ELEMS() rather than a separate constant.
ib
parents: 32937
diff changeset
142 unsigned int i;
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
143
32944
27a98940e3aa Use FF_ARRAY_ELEMS() rather than a separate constant.
ib
parents: 32937
diff changeset
144 for (i = 0; i < FF_ARRAY_ELEMS(evNames); i++)
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
145 if (!strcmp(evNames[i].name, str))
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32900
diff changeset
146 return evNames[i].message;
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
147
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
148 return -1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
149 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
150
33979
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
151 /**
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
152 * @brief Modify the state (i.e. set a new value) to the item belonging to an event.
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
153 *
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
154 * @param event event
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
155 * @param state new value
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
156 */
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
157 void btnModify(int event, float state)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
158 {
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
159 int i;
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
160
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
161 for (i = 0; i <= guiApp.IndexOfMainItems; i++) {
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
162 if (guiApp.mainItems[i].message == event) {
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
163 switch (guiApp.mainItems[i].type) {
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
164 case itButton:
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
165 guiApp.mainItems[i].pressed = (int)state;
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
166 break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
167
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
168 case itPotmeter:
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
169 case itVPotmeter:
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
170 case itHPotmeter:
32960
06d7501e046f Make constants explicitly type float.
ib
parents: 32947
diff changeset
171 if (state < 0.0f)
06d7501e046f Make constants explicitly type float.
ib
parents: 32947
diff changeset
172 state = 0.0f;
06d7501e046f Make constants explicitly type float.
ib
parents: 32947
diff changeset
173 if (state > 100.0f)
06d7501e046f Make constants explicitly type float.
ib
parents: 32947
diff changeset
174 state = 100.0f;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
175 guiApp.mainItems[i].value = state;
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
176 break;
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
177 }
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
178 }
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
179 }
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
180
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
181 for (i = 0; i <= guiApp.IndexOfPlaybarItems; i++) {
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
182 if (guiApp.playbarItems[i].message == event) {
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
183 switch (guiApp.playbarItems[i].type) {
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
184 case itButton:
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
185 guiApp.playbarItems[i].pressed = (int)state;
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
186 break;
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
187
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
188 case itPotmeter:
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
189 case itVPotmeter:
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
190 case itHPotmeter:
32960
06d7501e046f Make constants explicitly type float.
ib
parents: 32947
diff changeset
191 if (state < 0.0f)
06d7501e046f Make constants explicitly type float.
ib
parents: 32947
diff changeset
192 state = 0.0f;
06d7501e046f Make constants explicitly type float.
ib
parents: 32947
diff changeset
193 if (state > 100.0f)
06d7501e046f Make constants explicitly type float.
ib
parents: 32947
diff changeset
194 state = 100.0f;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
195 guiApp.playbarItems[i].value = state;
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
196 break;
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
197 }
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
198 }
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
199 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
200 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
201
33979
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
202 /**
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
203 * @brief Set the @a pressed state (i.e. a new value) to the item belonging to an event.
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
204 *
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
205 * @param event event
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
206 * @param set new value
1c4a2554d46b Add doxygen comments to app.c.
ib
parents: 33753
diff changeset
207 */
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
208 void btnSet(int event, int set)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
209 {
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
210 int i;
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
211
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
212 for (i = 0; i <= guiApp.IndexOfMainItems; i++)
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
213 if (guiApp.mainItems[i].message == event)
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
214 guiApp.mainItems[i].pressed = set;
32897
14af78beac02 Cosmetic: Format to MPlayer coding style.
ib
parents: 32847
diff changeset
215
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
216 for (i = 0; i <= guiApp.IndexOfPlaybarItems; i++)
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
217 if (guiApp.playbarItems[i].message == event)
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33270
diff changeset
218 guiApp.playbarItems[i].pressed = set;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
219 }