annotate gui/ui/render.c @ 36789:82a86ba65249

configure (cosmetic): Adjust indent and add blank lines.
author ib
date Wed, 19 Feb 2014 15:30:22 +0000
parents 28ea255e40ce
children 1548470f45f8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26458
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
1 /*
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
2 * This file is part of MPlayer.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
3 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
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: 26382
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
7 * (at your option) any later version.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
8 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
12 * GNU General Public License for more details.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
13 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
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: 26382
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
17 */
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
18
33123
9566100d88a1 Replace inttypes.h by stdint.h and remove inttypes.h where unneeded.
ib
parents: 32982
diff changeset
19 #include <stdint.h>
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
20 #include <stdio.h>
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
21 #include <stdlib.h>
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
22 #include <string.h>
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
23
33556
520fb0f7544c Rename GUI directory 'mplayer' and some files in it.
ib
parents: 33555
diff changeset
24 #include "render.h"
32952
1aeeba137de9 Remove needless includes.
ib
parents: 32920
diff changeset
25 #include "gui/interface.h"
26365
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 25603
diff changeset
26 #include "gui/skin/font.h"
34175
a345e7162d0a Move TranslateFilename() to util/string.c.
ib
parents: 34077
diff changeset
27 #include "gui/util/string.h"
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
28
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
29 #include "access_mpcontext.h"
36032
c667e34fb941 Cosmetic: Rearrange #includes.
ib
parents: 35744
diff changeset
30 #include "mixer.h"
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
31 #include "libavutil/avstring.h"
32954
682b370ac832 Get prototype for GetTimerMS() from header file.
ib
parents: 32952
diff changeset
32 #include "osdep/timer.h"
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
33 #include "stream/stream.h"
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
34
33269
49ca38147d1f Remove private symbolic constants from header files.
ib
parents: 33129
diff changeset
35 #define DLABEL_DELAY 2500 // in milliseconds
49ca38147d1f Remove private symbolic constants from header files.
ib
parents: 33129
diff changeset
36
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
37 static char *image_buffer;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
38 static int image_width;
32956
cde5d1cbb4bc Move global variables to top of file.
ib
parents: 32955
diff changeset
39
32975
0dc9d64cd64e Make functions static that are only used inside the file.
ib
parents: 32973
diff changeset
40 static char *Translate(char *str)
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
41 {
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
42 static char trbuf[512];
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
43 char tmp[512];
32972
fbaae7fe1a13 Fix several issues with Translate().
ib
parents: 32970
diff changeset
44 unsigned int i, c;
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
45 int t;
35536
1c2cb32a4af9 Check availability of mixer before rendering.
ib
parents: 35462
diff changeset
46 mixer_t *mixer = NULL;
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
47
32972
fbaae7fe1a13 Fix several issues with Translate().
ib
parents: 32970
diff changeset
48 *trbuf = 0;
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
49
32972
fbaae7fe1a13 Fix several issues with Translate().
ib
parents: 32970
diff changeset
50 for (c = 0, i = 0; i < strlen(str); i++) {
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
51 if (str[i] != '$') {
32972
fbaae7fe1a13 Fix several issues with Translate().
ib
parents: 32970
diff changeset
52 if (c + 1 < sizeof(trbuf)) {
32973
9346b986c721 Cosmetic: Adjust indent.
ib
parents: 32972
diff changeset
53 trbuf[c++] = str[i];
9346b986c721 Cosmetic: Adjust indent.
ib
parents: 32972
diff changeset
54 trbuf[c] = 0;
32972
fbaae7fe1a13 Fix several issues with Translate().
ib
parents: 32970
diff changeset
55 }
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
56 } else {
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
57 switch (str[++i]) {
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
58 case 't':
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
59 snprintf(tmp, sizeof(tmp), "%02d", guiInfo.Track);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
60 av_strlcat(trbuf, tmp, sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
61 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
62
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
63 case 'o':
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
64 TranslateFilename(0, tmp, sizeof(tmp));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
65 av_strlcat(trbuf, tmp, sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
66 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
67
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
68 case 'f':
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
69 TranslateFilename(1, tmp, sizeof(tmp));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
70 av_strlcat(trbuf, tmp, sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
71 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
72
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
73 case 'F':
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
74 TranslateFilename(2, tmp, sizeof(tmp));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
75 av_strlcat(trbuf, tmp, sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
76 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
77
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
78 case '6':
33897
e0d211c62cf7 Cosmetic: Rename some guiInfo members.
ib
parents: 33876
diff changeset
79 t = guiInfo.RunningTime;
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
80 goto calclengthhhmmss;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
81
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
82 case '1':
33897
e0d211c62cf7 Cosmetic: Rename some guiInfo members.
ib
parents: 33876
diff changeset
83 t = guiInfo.ElapsedTime;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
84 calclengthhhmmss:
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
85 snprintf(tmp, sizeof(tmp), "%02d:%02d:%02d", t / 3600, t / 60 % 60, t % 60);
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
86 av_strlcat(trbuf, tmp, sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
87 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
88
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
89 case '7':
33897
e0d211c62cf7 Cosmetic: Rename some guiInfo members.
ib
parents: 33876
diff changeset
90 t = guiInfo.RunningTime;
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
91 goto calclengthmmmmss;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
92
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
93 case '2':
33897
e0d211c62cf7 Cosmetic: Rename some guiInfo members.
ib
parents: 33876
diff changeset
94 t = guiInfo.ElapsedTime;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
95 calclengthmmmmss:
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
96 snprintf(tmp, sizeof(tmp), "%04d:%02d", t / 60, t % 60);
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
97 av_strlcat(trbuf, tmp, sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
98 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
99
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
100 case '3':
33897
e0d211c62cf7 Cosmetic: Rename some guiInfo members.
ib
parents: 33876
diff changeset
101 snprintf(tmp, sizeof(tmp), "%02d", guiInfo.ElapsedTime / 3600);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
102 av_strlcat(trbuf, tmp, sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
103 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
104
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
105 case '4':
33897
e0d211c62cf7 Cosmetic: Rename some guiInfo members.
ib
parents: 33876
diff changeset
106 snprintf(tmp, sizeof(tmp), "%02d", (guiInfo.ElapsedTime / 60) % 60);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
107 av_strlcat(trbuf, tmp, sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
108 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
109
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
110 case '5':
33897
e0d211c62cf7 Cosmetic: Rename some guiInfo members.
ib
parents: 33876
diff changeset
111 snprintf(tmp, sizeof(tmp), "%02d", guiInfo.ElapsedTime % 60);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
112 av_strlcat(trbuf, tmp, sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
113 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
114
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
115 case '8':
33897
e0d211c62cf7 Cosmetic: Rename some guiInfo members.
ib
parents: 33876
diff changeset
116 snprintf(tmp, sizeof(tmp), "%01d:%02d:%02d", guiInfo.ElapsedTime / 3600, (guiInfo.ElapsedTime / 60) % 60, guiInfo.ElapsedTime % 60);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
117 av_strlcat(trbuf, tmp, sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
118 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
119
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
120 case 'v':
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
121 snprintf(tmp, sizeof(tmp), "%3.2f%%", guiInfo.Volume);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
122 av_strlcat(trbuf, tmp, sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
123 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
124
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
125 case 'V':
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
126 snprintf(tmp, sizeof(tmp), "%3.1f", guiInfo.Volume);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
127 av_strlcat(trbuf, tmp, sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
128 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
129
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
130 case 'b':
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
131 snprintf(tmp, sizeof(tmp), "%3.2f%%", guiInfo.Balance);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
132 av_strlcat(trbuf, tmp, sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
133 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
134
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
135 case 'B':
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
136 snprintf(tmp, sizeof(tmp), "%3.1f", guiInfo.Balance);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
137 av_strlcat(trbuf, tmp, sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
138 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
139
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
140 case 'x':
33901
d4f80f889106 Cosmetic: Rename guiInfo members.
ib
parents: 33897
diff changeset
141 snprintf(tmp, sizeof(tmp), "%d", guiInfo.VideoWidth);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
142 av_strlcat(trbuf, tmp, sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
143 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
144
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
145 case 'y':
33901
d4f80f889106 Cosmetic: Rename guiInfo members.
ib
parents: 33897
diff changeset
146 snprintf(tmp, sizeof(tmp), "%d", guiInfo.VideoHeight);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
147 av_strlcat(trbuf, tmp, sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
148 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
149
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
150 case 'C':
35462
e671bb33230f Add video codec name to guiInfo structure.
ib
parents: 35450
diff changeset
151 snprintf(tmp, sizeof(tmp), "%s", guiInfo.CodecName ? guiInfo.CodecName : "");
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
152 av_strlcat(trbuf, tmp, sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
153 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
154
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
155 case 's':
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33556
diff changeset
156 if (guiInfo.Playing == GUI_STOP)
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
157 av_strlcat(trbuf, "s", sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
158 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
159
33616
4221981ad74c Prefer playing variable $p to $l.
ib
parents: 33615
diff changeset
160 case 'l': // legacy
4221981ad74c Prefer playing variable $p to $l.
ib
parents: 33615
diff changeset
161 case 'p':
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33556
diff changeset
162 if (guiInfo.Playing == GUI_PLAY)
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
163 av_strlcat(trbuf, "p", sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
164 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
165
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
166 case 'e':
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33556
diff changeset
167 if (guiInfo.Playing == GUI_PAUSE)
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
168 av_strlcat(trbuf, "e", sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
169 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
170
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
171 case 'a':
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
172
35536
1c2cb32a4af9 Check availability of mixer before rendering.
ib
parents: 35462
diff changeset
173 if (guiInfo.mpcontext)
35538
68a63175f140 Cosmetic: Adjust indent.
ib
parents: 35536
diff changeset
174 mixer = mpctx_get_mixer(guiInfo.mpcontext);
32967
d9363dbd3f83 Avoid mixing declaration and code.
ib
parents: 32966
diff changeset
175
35536
1c2cb32a4af9 Check availability of mixer before rendering.
ib
parents: 35462
diff changeset
176 if (mixer && mixer->muted) {
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
177 av_strlcat(trbuf, "n", sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
178 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
179 }
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
180
33646
f3300b0c38a9 Rename guiInterface_t member AudioType AudioChannels.
ib
parents: 33616
diff changeset
181 switch (guiInfo.AudioChannels) {
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
182 case 0:
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
183 av_strlcat(trbuf, "n", sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
184 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
185
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
186 case 1:
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
187 av_strlcat(trbuf, "m", sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
188 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
189
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
190 case 2:
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
191 av_strlcat(trbuf, "t", sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
192 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
193 }
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
194
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
195 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
196
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
197 case 'T':
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
198 switch (guiInfo.StreamType) {
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
199 case STREAMTYPE_FILE:
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
200 av_strlcat(trbuf, "f", sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
201 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
202
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 33971
diff changeset
203 case STREAMTYPE_STREAM:
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 33971
diff changeset
204 av_strlcat(trbuf, "u", sizeof(trbuf));
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 33971
diff changeset
205 break;
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 33971
diff changeset
206
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34175
diff changeset
207 case STREAMTYPE_CDDA:
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34175
diff changeset
208 av_strlcat(trbuf, "a", sizeof(trbuf));
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34175
diff changeset
209 break;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34175
diff changeset
210
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
211 case STREAMTYPE_VCD:
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
212 av_strlcat(trbuf, "v", sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
213 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
214
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
215 case STREAMTYPE_DVD:
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
216 av_strlcat(trbuf, "d", sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
217 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
218
36429
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
219 case STREAMTYPE_TV:
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
220 case STREAMTYPE_DVB:
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
221 av_strlcat(trbuf, "b", sizeof(trbuf));
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
222 break;
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
223
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
224 default:
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
225 av_strlcat(trbuf, " ", sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
226 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
227 }
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
228 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
229
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
230 case '$':
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
231 av_strlcat(trbuf, "$", sizeof(trbuf));
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
232 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
233
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
234 default:
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
235 continue;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
236 }
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
237
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
238 c = strlen(trbuf);
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
239 }
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
240 }
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
241
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
242 return trbuf;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
243 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
244
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
245 static void PutImage(guiImage *bf, int x, int y, int max, int ofs)
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
246 {
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
247 int i = 0, ix, iy;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
248 uint32_t *buf = NULL;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
249 uint32_t *drw = NULL;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
250 register uint32_t tmp;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
251
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
252 /* register uint32_t yc; */
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
253
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
254 if (!bf || (bf->Image == NULL))
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
255 return;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
256
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
257 i = bf->Width * (bf->Height / max) * ofs;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
258 buf = (uint32_t *)image_buffer;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
259 drw = (uint32_t *)bf->Image;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
260
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
261 #if 1
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
262 for (iy = y; iy < (int)(y + bf->Height / max); iy++)
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
263 for (ix = x; ix < (int)(x + bf->Width); ix++) {
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
264 tmp = drw[i++];
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
265
33534
22c3241467b3 Remove function Normalize().
ib
parents: 33405
diff changeset
266 if (!IS_TRANSPARENT(tmp))
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
267 buf[iy * image_width + ix] = tmp;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
268 }
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
269 #else
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
270 yc = y * image_width;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
271
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
272 for (iy = y; iy < (int)(y + bf->Height / max); iy++) {
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
273 for (ix = x; ix < (int)(x + bf->Width); ix++) {
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
274 tmp = drw[i++];
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
275
33534
22c3241467b3 Remove function Normalize().
ib
parents: 33405
diff changeset
276 if (!IS_TRANSPARENT(tmp))
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
277 buf[yc + ix] = tmp;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
278 }
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
279
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
280 yc += image_width;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
281 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
282 #endif
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
283 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
284
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
285 static void SimplePotmeterPutImage(guiImage *bf, int x, int y, float frac)
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
286 {
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
287 int i = 0, w, r, ix, iy;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
288 uint32_t *buf = NULL;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
289 uint32_t *drw = NULL;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
290 register uint32_t tmp;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
291
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
292 if (!bf || (bf->Image == NULL))
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
293 return;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
294
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
295 buf = (uint32_t *)image_buffer;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
296 drw = (uint32_t *)bf->Image;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
297 w = bf->Width * frac;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
298 r = bf->Width - w;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
299
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
300 for (iy = y; iy < (int)(y + bf->Height); iy++) {
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
301 for (ix = x; ix < (int)(x + w); ix++) {
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
302 tmp = drw[i++];
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
303
33534
22c3241467b3 Remove function Normalize().
ib
parents: 33405
diff changeset
304 if (!IS_TRANSPARENT(tmp))
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
305 buf[iy * image_width + ix] = tmp;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
306 }
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
307
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
308 i += r;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
309 }
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
310 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
311
35688
6fd886ce32b9 Cosmetic: Rename wItem guiItem.
ib
parents: 35681
diff changeset
312 void RenderAll(wsWindow *window, guiItem *Items, int nrItems, char *db)
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
313 {
35688
6fd886ce32b9 Cosmetic: Rename wItem guiItem.
ib
parents: 35681
diff changeset
314 guiItem *item;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
315 guiImage *image = NULL;
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
316 int i, ofs;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
317
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
318 image_buffer = db;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
319 image_width = window->Width;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
320
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
321 for (i = 0; i < nrItems + 1; i++) {
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
322 item = &Items[i];
32966
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
323
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
324 switch (item->pressed) {
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
325 case btnPressed:
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
326 ofs = 0;
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
327 break;
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
328
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
329 case btnReleased:
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
330 ofs = 1;
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
331 break;
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
332
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
333 default:
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
334 ofs = 2;
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
335 break;
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
336 }
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
337
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
338 switch (item->type) {
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
339 case itButton:
35541
ded4a8c2aa70 Cosmetic: Add some blank lines.
ib
parents: 35538
diff changeset
340
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
341 PutImage(&item->Bitmap, item->x, item->y, 3, ofs);
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
342 break;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
343
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
344 case itPotmeter:
35541
ded4a8c2aa70 Cosmetic: Add some blank lines.
ib
parents: 35538
diff changeset
345
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
346 if (item->numphases == 1)
32970
3673c28ce811 Use double constants for higher precision calculations.
ib
parents: 32969
diff changeset
347 SimplePotmeterPutImage(&item->Bitmap, item->x, item->y, item->value / 100.0);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
348 else
32970
3673c28ce811 Use double constants for higher precision calculations.
ib
parents: 32969
diff changeset
349 PutImage(&item->Bitmap, item->x, item->y, item->numphases, (item->numphases - 1) * (item->value / 100.0));
35541
ded4a8c2aa70 Cosmetic: Add some blank lines.
ib
parents: 35538
diff changeset
350
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
351 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
352
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
353 case itHPotmeter:
35541
ded4a8c2aa70 Cosmetic: Add some blank lines.
ib
parents: 35538
diff changeset
354
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
355 if (item->numphases == 1)
32970
3673c28ce811 Use double constants for higher precision calculations.
ib
parents: 32969
diff changeset
356 SimplePotmeterPutImage(&item->Bitmap, item->x, item->y, item->value / 100.0);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
357 else
32970
3673c28ce811 Use double constants for higher precision calculations.
ib
parents: 32969
diff changeset
358 PutImage(&item->Bitmap, item->x, item->y, item->numphases, (item->numphases - 1) * (item->value / 100.0));
35541
ded4a8c2aa70 Cosmetic: Add some blank lines.
ib
parents: 35538
diff changeset
359
32970
3673c28ce811 Use double constants for higher precision calculations.
ib
parents: 32969
diff changeset
360 PutImage(&item->Mask, item->x + (item->width - item->pwidth) * (item->value / 100.0), item->y, 3, ofs);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
361 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
362
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
363 case itVPotmeter:
35541
ded4a8c2aa70 Cosmetic: Add some blank lines.
ib
parents: 35538
diff changeset
364
32970
3673c28ce811 Use double constants for higher precision calculations.
ib
parents: 32969
diff changeset
365 PutImage(&item->Bitmap, item->x, item->y, item->numphases, item->numphases * (1.0 - item->value / 100.0));
3673c28ce811 Use double constants for higher precision calculations.
ib
parents: 32969
diff changeset
366 PutImage(&item->Mask, item->x, item->y + (item->height - item->pheight) * (1.0 - item->value / 100.0), 3, ofs);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
367 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
368
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
369 case itSLabel:
35541
ded4a8c2aa70 Cosmetic: Add some blank lines.
ib
parents: 35538
diff changeset
370
32969
ad1a232df994 Make slabel work.
ib
parents: 32968
diff changeset
371 if (item->width == -1)
ad1a232df994 Make slabel work.
ib
parents: 32968
diff changeset
372 item->width = fntTextWidth(item->fontid, item->label);
35541
ded4a8c2aa70 Cosmetic: Add some blank lines.
ib
parents: 35538
diff changeset
373
33971
922771be85f6 Cosmetic: Rename fntRender() fntTextRender().
ib
parents: 33901
diff changeset
374 image = fntTextRender(item, 0, item->label);
35541
ded4a8c2aa70 Cosmetic: Add some blank lines.
ib
parents: 35538
diff changeset
375
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
376 if (image)
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
377 PutImage(image, item->x, item->y, 1, 0);
35541
ded4a8c2aa70 Cosmetic: Add some blank lines.
ib
parents: 35538
diff changeset
378
32969
ad1a232df994 Make slabel work.
ib
parents: 32968
diff changeset
379 break;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
380
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
381 case itDLabel:
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
382 {
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
383 int x;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
384 unsigned int d;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
385 char *t = Translate(item->label);
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
386
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
387 if (!item->text || (strcmp(item->text, t) != 0)) {
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
388 free(item->text);
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
389 item->text = strdup(t);
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
390 item->textwidth = fntTextWidth(item->fontid, t);
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
391 item->starttime = GetTimerMS();
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
392 item->last_x = 0;
32761
3ceeb62a1125 Improve the readability of dynamic labels which scroll.
ib
parents: 32759
diff changeset
393 }
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
394
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
395 d = GetTimerMS() - item->starttime;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
396
32964
cddc94d28830 Cosmetic: Rename macro controlling the dlabel delay.
ib
parents: 32963
diff changeset
397 if (d < DLABEL_DELAY)
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
398 x = item->last_x; // don't scroll yet
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
399 else {
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
400 int l;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
401 char c[2];
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
402
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
403 l = (item->textwidth ? item->textwidth : item->width);
35362
848ca0b6d5ca Prevent floating point exception.
ib
parents: 34454
diff changeset
404 x = (l ? l - ((d - DLABEL_DELAY) / 20) % l - 1 : 0);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
405 c[0] = *item->text;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
406 c[1] = '\0';
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
407
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
408 if (x < (fntTextWidth(item->fontid, c) + 1) >> 1) {
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
409 item->starttime = GetTimerMS(); // stop again
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
410 item->last_x = x; // at current x pos
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
411 }
32761
3ceeb62a1125 Improve the readability of dynamic labels which scroll.
ib
parents: 32759
diff changeset
412 }
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
413
33971
922771be85f6 Cosmetic: Rename fntRender() fntTextRender().
ib
parents: 33901
diff changeset
414 image = fntTextRender(item, x, t);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
415 }
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
416
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
417 if (image)
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
418 PutImage(image, item->x, item->y, 1, 0);
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
419
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
420 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
421 }
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
422 }
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
423
35744
bfe51acc36fb Cosmetic: Rename wsImageConvert() wsImageRender().
ib
parents: 35688
diff changeset
424 wsImageRender(window, db);
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
425 }