annotate gui/ui/render.c @ 37014:01b3cd8a1e76

Simplify string termination.
author ib
date Sat, 29 Mar 2014 14:21:45 +0000
parents 11d2d0444f42
children 68066d733c76
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"
37007
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
26 #include "gui/app/gui.h"
26365
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 25603
diff changeset
27 #include "gui/skin/font.h"
34175
a345e7162d0a Move TranslateFilename() to util/string.c.
ib
parents: 34077
diff changeset
28 #include "gui/util/string.h"
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
29
36984
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
30 #include "access_mpcontext.h"
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
31 #include "help_mp.h"
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
32 #include "libavutil/avstring.h"
32954
682b370ac832 Get prototype for GetTimerMS() from header file.
ib
parents: 32952
diff changeset
33 #include "osdep/timer.h"
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
34 #include "stream/stream.h"
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
35
33269
49ca38147d1f Remove private symbolic constants from header files.
ib
parents: 33129
diff changeset
36 #define DLABEL_DELAY 2500 // in milliseconds
49ca38147d1f Remove private symbolic constants from header files.
ib
parents: 33129
diff changeset
37
36980
7ed97bf8eef9 Add doxygen comment.
ib
parents: 36979
diff changeset
38 /**
36984
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
39 * @brief Convert #guiInfo member Filename.
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
40 *
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
41 * @param how 0 (cut file path and extension),
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
42 * 1 (additionally, convert lower case) or
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
43 * 2 (additionally, convert upper case)
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
44 * @param fname pointer to a buffer to receive the converted Filename
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
45 * @param maxlen size of @a fname buffer
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
46 *
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
47 * @return pointer to @a fname buffer
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
48 */
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
49 static char *TranslateFilename(int how, char *fname, size_t maxlen)
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
50 {
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
51 char *p;
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
52 size_t len;
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
53 stream_t *stream;
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
54
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
55 switch (guiInfo.StreamType) {
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
56 case STREAMTYPE_FILE:
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
57
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
58 if (guiInfo.Filename && *guiInfo.Filename) {
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
59 p = strrchr(guiInfo.Filename, '/');
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
60
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
61 if (p)
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
62 av_strlcpy(fname, p + 1, maxlen);
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
63 else
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
64 av_strlcpy(fname, guiInfo.Filename, maxlen);
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
65
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
66 len = strlen(fname);
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
67
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
68 if (len > 3 && fname[len - 3] == '.')
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
69 fname[len - 3] = 0;
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
70 else if (len > 4 && fname[len - 4] == '.')
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
71 fname[len - 4] = 0;
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
72 else if (len > 5 && fname[len - 5] == '.')
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
73 fname[len - 5] = 0;
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
74 } else
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
75 av_strlcpy(fname, MSGTR_GUI_MSG_NoFileLoaded, maxlen);
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
76
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
77 break;
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
78
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
79 case STREAMTYPE_STREAM:
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
80
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
81 av_strlcpy(fname, guiInfo.Filename, maxlen);
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
82 break;
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
83
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
84 case STREAMTYPE_CDDA:
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
85
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
86 snprintf(fname, maxlen, MSGTR_GUI_TitleN, guiInfo.Track);
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
87 break;
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
88
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
89 case STREAMTYPE_VCD:
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
90
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
91 snprintf(fname, maxlen, MSGTR_GUI_TitleN, guiInfo.Track - 1);
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
92 break;
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
93
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
94 case STREAMTYPE_DVD:
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
95
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
96 if (guiInfo.Chapter)
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
97 snprintf(fname, maxlen, MSGTR_GUI_ChapterN, guiInfo.Chapter);
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
98 else
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
99 av_strlcpy(fname, MSGTR_GUI_NoChapter, maxlen);
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
100
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
101 break;
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
102
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
103 case STREAMTYPE_TV:
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
104 case STREAMTYPE_DVB:
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
105
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
106 p = MSGTR_GUI_NoChannelName;
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
107 stream = mpctx_get_stream(guiInfo.mpcontext);
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
108
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
109 if (stream)
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
110 stream_control(stream, STREAM_CTRL_GET_CURRENT_CHANNEL, &p);
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
111
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
112 av_strlcpy(fname, p, maxlen);
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
113 break;
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
114
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
115 default:
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
116
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
117 av_strlcpy(fname, MSGTR_GUI_MSG_NoMediaOpened, maxlen);
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
118 break;
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
119 }
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
120
36988
c9ccf9b4a43b Use strlower() and strupper() in TranslateFilename().
ib
parents: 36984
diff changeset
121 if (how == 1)
c9ccf9b4a43b Use strlower() and strupper() in TranslateFilename().
ib
parents: 36984
diff changeset
122 strlower(fname);
c9ccf9b4a43b Use strlower() and strupper() in TranslateFilename().
ib
parents: 36984
diff changeset
123 if (how == 2)
c9ccf9b4a43b Use strlower() and strupper() in TranslateFilename().
ib
parents: 36984
diff changeset
124 strupper(fname);
36984
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
125
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
126 return fname;
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
127 }
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
128
3f3a415d605b Move most of TranslateFilename() back to the renderer files.
ib
parents: 36980
diff changeset
129 /**
36980
7ed97bf8eef9 Add doxygen comment.
ib
parents: 36979
diff changeset
130 * @brief Translate all variables in the @a text.
7ed97bf8eef9 Add doxygen comment.
ib
parents: 36979
diff changeset
131 *
7ed97bf8eef9 Add doxygen comment.
ib
parents: 36979
diff changeset
132 * @param text text containing variables
7ed97bf8eef9 Add doxygen comment.
ib
parents: 36979
diff changeset
133 *
7ed97bf8eef9 Add doxygen comment.
ib
parents: 36979
diff changeset
134 * @return new text with all variables translated
7ed97bf8eef9 Add doxygen comment.
ib
parents: 36979
diff changeset
135 */
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
136 static char *TranslateVariables(const char *text)
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
137 {
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
138 static char translation[512];
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
139 char trans[512];
32972
fbaae7fe1a13 Fix several issues with Translate().
ib
parents: 32970
diff changeset
140 unsigned int i, c;
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
141 int t;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
142
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
143 *translation = 0;
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
144
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
145 for (c = 0, i = 0; i < strlen(text); i++) {
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
146 if (text[i] != '$') {
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
147 if (c + 1 < sizeof(translation)) {
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
148 translation[c++] = text[i];
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
149 translation[c] = 0;
32972
fbaae7fe1a13 Fix several issues with Translate().
ib
parents: 32970
diff changeset
150 }
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
151 } else {
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
152 switch (text[++i]) {
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
153 case '1':
33897
e0d211c62cf7 Cosmetic: Rename some guiInfo members.
ib
parents: 33876
diff changeset
154 t = guiInfo.ElapsedTime;
36979
14fa9031f766 Cosmetic: Rename goto labels.
ib
parents: 36978
diff changeset
155 HH_MM_SS: snprintf(trans, sizeof(trans), "%02d:%02d:%02d", t / 3600, t / 60 % 60, t % 60);
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
156 av_strlcat(translation, trans, sizeof(translation));
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
157 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
158
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
159 case '2':
33897
e0d211c62cf7 Cosmetic: Rename some guiInfo members.
ib
parents: 33876
diff changeset
160 t = guiInfo.ElapsedTime;
36979
14fa9031f766 Cosmetic: Rename goto labels.
ib
parents: 36978
diff changeset
161 MMMM_SS: snprintf(trans, sizeof(trans), "%04d:%02d", t / 60, t % 60);
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
162 av_strlcat(translation, trans, sizeof(translation));
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
163 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
164
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
165 case '3':
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
166 snprintf(trans, sizeof(trans), "%02d", guiInfo.ElapsedTime / 3600);
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
167 av_strlcat(translation, trans, sizeof(translation));
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
168 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
169
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
170 case '4':
36978
3f306145b3da Remove unnecessary, bothering parentheses.
ib
parents: 36977
diff changeset
171 snprintf(trans, sizeof(trans), "%02d", guiInfo.ElapsedTime / 60 % 60);
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
172 av_strlcat(translation, trans, sizeof(translation));
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
173 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
174
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
175 case '5':
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
176 snprintf(trans, sizeof(trans), "%02d", guiInfo.ElapsedTime % 60);
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
177 av_strlcat(translation, trans, sizeof(translation));
32963
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
36977
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
180 case '6':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
181 t = guiInfo.RunningTime;
36979
14fa9031f766 Cosmetic: Rename goto labels.
ib
parents: 36978
diff changeset
182 goto HH_MM_SS;
36977
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
183
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
184 case '7':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
185 t = guiInfo.RunningTime;
36979
14fa9031f766 Cosmetic: Rename goto labels.
ib
parents: 36978
diff changeset
186 goto MMMM_SS;
36977
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
187
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
188 case '8':
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
189 snprintf(trans, sizeof(trans), "%01d:%02d:%02d", guiInfo.ElapsedTime / 3600, (guiInfo.ElapsedTime / 60) % 60, guiInfo.ElapsedTime % 60);
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
190 av_strlcat(translation, trans, sizeof(translation));
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
191 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
192
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
193 case 'a':
33646
f3300b0c38a9 Rename guiInterface_t member AudioType AudioChannels.
ib
parents: 33616
diff changeset
194 switch (guiInfo.AudioChannels) {
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
195 case 0:
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
196 av_strlcat(translation, "n", sizeof(translation));
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
197 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
198
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
199 case 1:
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
200 av_strlcat(translation, "m", sizeof(translation));
32963
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
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
203 case 2:
36978
3f306145b3da Remove unnecessary, bothering parentheses.
ib
parents: 36977
diff changeset
204 av_strlcat(translation, guiInfo.AudioPassthrough ? "r" : "t", sizeof(translation));
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
205 break;
36910
11932adad7a2 Add symbol character 'r' for dynamic label variable $a.
ib
parents: 36909
diff changeset
206
11932adad7a2 Add symbol character 'r' for dynamic label variable $a.
ib
parents: 36909
diff changeset
207 default:
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
208 av_strlcat(translation, "r", sizeof(translation));
36910
11932adad7a2 Add symbol character 'r' for dynamic label variable $a.
ib
parents: 36909
diff changeset
209 break;
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
210 }
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
211 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
212
36977
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
213 case 'b':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
214 snprintf(trans, sizeof(trans), "%3.2f%%", guiInfo.Balance);
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
215 av_strlcat(translation, trans, sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
216 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
217
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
218 case 'B':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
219 snprintf(trans, sizeof(trans), "%3.1f", guiInfo.Balance);
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
220 av_strlcat(translation, trans, sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
221 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
222
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
223 case 'C':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
224 snprintf(trans, sizeof(trans), "%s", guiInfo.CodecName ? guiInfo.CodecName : "");
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
225 av_strlcat(translation, trans, sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
226 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
227
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
228 case 'D':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
229 snprintf(trans, sizeof(trans), "%3.0f", guiInfo.Balance);
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
230 av_strlcat(translation, trans, sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
231 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
232
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
233 case 'e':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
234 if (guiInfo.Playing == GUI_PAUSE)
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
235 av_strlcat(translation, "e", sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
236 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
237
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
238 case 'f':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
239 TranslateFilename(1, trans, sizeof(trans));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
240 av_strlcat(translation, trans, sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
241 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
242
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
243 case 'F':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
244 TranslateFilename(2, trans, sizeof(trans));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
245 av_strlcat(translation, trans, sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
246 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
247
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
248 case 'o':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
249 TranslateFilename(0, trans, sizeof(trans));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
250 av_strlcat(translation, trans, sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
251 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
252
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
253 case 'l': // legacy
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
254 case 'p':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
255 if (guiInfo.Playing == GUI_PLAY)
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
256 av_strlcat(translation, "p", sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
257 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
258
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
259 case 'P':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
260 switch (guiInfo.Playing) {
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
261 case GUI_STOP:
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
262 av_strlcat(translation, "s", sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
263 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
264
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
265 case GUI_PLAY:
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
266 av_strlcat(translation, "p", sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
267 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
268
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
269 case GUI_PAUSE:
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
270 av_strlcat(translation, "e", sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
271 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
272 }
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
273 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
274
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
275 case 's':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
276 if (guiInfo.Playing == GUI_STOP)
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
277 av_strlcat(translation, "s", sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
278 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
279
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
280 case 't':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
281 snprintf(trans, sizeof(trans), "%02d", guiInfo.Track);
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
282 av_strlcat(translation, trans, sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
283 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
284
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
285 case 'T':
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
286 switch (guiInfo.StreamType) {
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
287 case STREAMTYPE_FILE:
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
288 av_strlcat(translation, "f", sizeof(translation));
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
289 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
290
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 33971
diff changeset
291 case STREAMTYPE_STREAM:
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
292 av_strlcat(translation, "u", sizeof(translation));
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 33971
diff changeset
293 break;
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 33971
diff changeset
294
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34175
diff changeset
295 case STREAMTYPE_CDDA:
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
296 av_strlcat(translation, "a", sizeof(translation));
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34175
diff changeset
297 break;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34175
diff changeset
298
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
299 case STREAMTYPE_VCD:
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
300 av_strlcat(translation, "v", sizeof(translation));
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
301 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
302
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
303 case STREAMTYPE_DVD:
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
304 av_strlcat(translation, "d", sizeof(translation));
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
305 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
306
36429
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
307 case STREAMTYPE_TV:
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
308 case STREAMTYPE_DVB:
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
309 av_strlcat(translation, "b", sizeof(translation));
36429
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
310 break;
28ea255e40ce Add support for TV/DVB to the GUI.
ib
parents: 36032
diff changeset
311
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
312 default:
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
313 av_strlcat(translation, " ", sizeof(translation));
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
314 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
315 }
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
316 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
317
36977
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
318 case 'U':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
319 snprintf(trans, sizeof(trans), "%3.0f", guiInfo.Volume);
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
320 av_strlcat(translation, trans, sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
321 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
322
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
323 case 'v':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
324 snprintf(trans, sizeof(trans), "%3.2f%%", guiInfo.Volume);
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
325 av_strlcat(translation, trans, sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
326 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
327
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
328 case 'V':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
329 snprintf(trans, sizeof(trans), "%3.1f", guiInfo.Volume);
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
330 av_strlcat(translation, trans, sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
331 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
332
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
333 case 'x':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
334 snprintf(trans, sizeof(trans), "%d", guiInfo.VideoWidth);
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
335 av_strlcat(translation, trans, sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
336 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
337
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
338 case 'y':
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
339 snprintf(trans, sizeof(trans), "%d", guiInfo.VideoHeight);
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
340 av_strlcat(translation, trans, sizeof(translation));
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
341 break;
dc70bee70223 Arrange variables to be translated alphabetically.
ib
parents: 36974
diff changeset
342
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
343 case '$':
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
344 av_strlcat(translation, "$", sizeof(translation));
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
345 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
346
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
347 default:
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
348 continue;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
349 }
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
350
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
351 c = strlen(translation);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
352 }
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
353 }
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
354
36974
6c3562d643a8 Cosmetic: Revise Translate().
ib
parents: 36970
diff changeset
355 return translation;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
356 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
357
37007
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
358 static void PutImage(int x, int y, uint32_t *drawbuf, int drawbuf_width, guiImage *img, int parts, int index, int below)
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
359 {
37009
393bd4f71bd6 Remove variable.
ib
parents: 37008
diff changeset
360 register int i, ic, yc;
37007
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
361 register uint32_t pixel;
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
362 int xlimit, ylimit, ix, iy;
37005
4330b0a2af69 Change the parameter list of PutImage().
ib
parents: 37003
diff changeset
363 uint32_t *pixels;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
364
37010
af84671a576f Simplify condition.
ib
parents: 37009
diff changeset
365 if (!img || !img->Image)
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
366 return;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
367
37007
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
368 if (below) {
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
369 i = img->Width * (img->Height / parts) * index;
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
370 xlimit = x + img->Width;
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
371 ylimit = y + img->Height / parts;
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
372 } else {
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
373 i = (img->Width / parts) * index;
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
374 xlimit = x + img->Width / parts;
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
375 ylimit = y + img->Height;
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
376 }
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
377
37006
5526b86aaa7c Cosmetic: Adjust indent.
ib
parents: 37005
diff changeset
378 pixels = (uint32_t *)img->Image;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
379
36993
764a6a754b89 Cosmetic: Rename variables in PutImage().
ib
parents: 36992
diff changeset
380 yc = y * drawbuf_width;
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
381
37007
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
382 for (iy = y; iy < ylimit; iy++) {
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
383 ic = i;
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
384
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
385 for (ix = x; ix < xlimit; ix++) {
36993
764a6a754b89 Cosmetic: Rename variables in PutImage().
ib
parents: 36992
diff changeset
386 pixel = pixels[i++];
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
387
36993
764a6a754b89 Cosmetic: Rename variables in PutImage().
ib
parents: 36992
diff changeset
388 if (!IS_TRANSPARENT(pixel))
764a6a754b89 Cosmetic: Rename variables in PutImage().
ib
parents: 36992
diff changeset
389 drawbuf[yc + ix] = pixel;
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
390 }
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
391
37007
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
392 if (!below)
37009
393bd4f71bd6 Remove variable.
ib
parents: 37008
diff changeset
393 i = ic + img->Width;
37007
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
394
36993
764a6a754b89 Cosmetic: Rename variables in PutImage().
ib
parents: 36992
diff changeset
395 yc += drawbuf_width;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
396 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
397 }
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
398
37011
322951bebfd6 Rename parameter.
ib
parents: 37010
diff changeset
399 void RenderAll(wsWindow *window, guiItem *items, int till, char *drawbuf)
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
400 {
37005
4330b0a2af69 Change the parameter list of PutImage().
ib
parents: 37003
diff changeset
401 uint32_t *db;
35688
6fd886ce32b9 Cosmetic: Rename wItem guiItem.
ib
parents: 35681
diff changeset
402 guiItem *item;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
403 guiImage *image = NULL;
37012
79c50282f8ab Remove braces.
ib
parents: 37011
diff changeset
404 int dw, i, index, x;
79c50282f8ab Remove braces.
ib
parents: 37011
diff changeset
405 char *t;
79c50282f8ab Remove braces.
ib
parents: 37011
diff changeset
406 unsigned int d;
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
407
37005
4330b0a2af69 Change the parameter list of PutImage().
ib
parents: 37003
diff changeset
408 db = (uint32_t *)drawbuf;
4330b0a2af69 Change the parameter list of PutImage().
ib
parents: 37003
diff changeset
409 dw = window->Width;
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
410
37011
322951bebfd6 Rename parameter.
ib
parents: 37010
diff changeset
411 for (i = 0; i <= till; i++) {
36994
167442bc79d0 Cosmetic: Rename same variables in RenderAll().
ib
parents: 36993
diff changeset
412 item = &items[i];
32966
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
413
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
414 switch (item->pressed) {
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
415 case btnPressed:
36994
167442bc79d0 Cosmetic: Rename same variables in RenderAll().
ib
parents: 36993
diff changeset
416 index = 0;
32966
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
417 break;
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
418
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
419 case btnReleased:
36994
167442bc79d0 Cosmetic: Rename same variables in RenderAll().
ib
parents: 36993
diff changeset
420 index = 1;
32966
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
421 break;
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
422
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
423 default:
36994
167442bc79d0 Cosmetic: Rename same variables in RenderAll().
ib
parents: 36993
diff changeset
424 index = 2;
32966
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
425 break;
1f51f39916e1 Replace ternary operator by more intelligible switch statement.
ib
parents: 32965
diff changeset
426 }
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
427
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
428 switch (item->type) {
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
429 case itButton:
35541
ded4a8c2aa70 Cosmetic: Add some blank lines.
ib
parents: 35538
diff changeset
430
37007
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
431 PutImage(item->x, item->y, db, dw, &item->Bitmap, 3, index, True);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
432 break;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
433
36920
40ad45360c8a Replace old item 'potmeter' by new item 'pimage'.
ib
parents: 36918
diff changeset
434 case itPimage:
35541
ded4a8c2aa70 Cosmetic: Add some blank lines.
ib
parents: 35538
diff changeset
435
37008
7b4cb946634a Remove unnecessary parentheses.
ib
parents: 37007
diff changeset
436 PutImage(item->x, item->y, db, dw, &item->Bitmap, item->numphases, (item->numphases - 1) * item->value / 100.0, True);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
437 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
438
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
439 case itHPotmeter:
35541
ded4a8c2aa70 Cosmetic: Add some blank lines.
ib
parents: 35538
diff changeset
440
37008
7b4cb946634a Remove unnecessary parentheses.
ib
parents: 37007
diff changeset
441 PutImage(item->x, item->y, db, dw, &item->Bitmap, item->numphases, (item->numphases - 1) * item->value / 100.0, True);
7b4cb946634a Remove unnecessary parentheses.
ib
parents: 37007
diff changeset
442 PutImage(item->x + (item->width - item->pwidth) * item->value / 100.0, item->y, db, dw, &item->Mask, 3, index, True);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
443 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
444
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
445 case itVPotmeter:
35541
ded4a8c2aa70 Cosmetic: Add some blank lines.
ib
parents: 35538
diff changeset
446
37008
7b4cb946634a Remove unnecessary parentheses.
ib
parents: 37007
diff changeset
447 PutImage(item->x, item->y, db, dw, &item->Bitmap, item->numphases, (item->numphases - 1) * item->value / 100.0, False);
37007
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
448 PutImage(item->x, item->y + (item->height - item->pheight) * (1.0 - item->value / 100.0), db, dw, &item->Mask, 3, index, True);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
449 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
450
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
451 case itSLabel:
35541
ded4a8c2aa70 Cosmetic: Add some blank lines.
ib
parents: 35538
diff changeset
452
32969
ad1a232df994 Make slabel work.
ib
parents: 32968
diff changeset
453 if (item->width == -1)
ad1a232df994 Make slabel work.
ib
parents: 32968
diff changeset
454 item->width = fntTextWidth(item->fontid, item->label);
35541
ded4a8c2aa70 Cosmetic: Add some blank lines.
ib
parents: 35538
diff changeset
455
33971
922771be85f6 Cosmetic: Rename fntRender() fntTextRender().
ib
parents: 33901
diff changeset
456 image = fntTextRender(item, 0, item->label);
35541
ded4a8c2aa70 Cosmetic: Add some blank lines.
ib
parents: 35538
diff changeset
457
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
458 if (image)
37007
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
459 PutImage(item->x, item->y, db, dw, image, 1, 0, True);
35541
ded4a8c2aa70 Cosmetic: Add some blank lines.
ib
parents: 35538
diff changeset
460
32969
ad1a232df994 Make slabel work.
ib
parents: 32968
diff changeset
461 break;
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
462
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
463 case itDLabel:
37013
11d2d0444f42 Cosmetic: Add blank line and adjust indent.
ib
parents: 37012
diff changeset
464
37012
79c50282f8ab Remove braces.
ib
parents: 37011
diff changeset
465 t = TranslateVariables(item->label);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
466
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
467 if (!item->text || (strcmp(item->text, t) != 0)) {
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
468 free(item->text);
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
469 item->text = strdup(t);
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
470 item->textwidth = fntTextWidth(item->fontid, t);
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
471 item->starttime = GetTimerMS();
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
472 item->last_x = 0;
32761
3ceeb62a1125 Improve the readability of dynamic labels which scroll.
ib
parents: 32759
diff changeset
473 }
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
474
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
475 d = GetTimerMS() - item->starttime;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
476
32964
cddc94d28830 Cosmetic: Rename macro controlling the dlabel delay.
ib
parents: 32963
diff changeset
477 if (d < DLABEL_DELAY)
37013
11d2d0444f42 Cosmetic: Add blank line and adjust indent.
ib
parents: 37012
diff changeset
478 x = item->last_x; // don't scroll yet
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
479 else {
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
480 int l;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
481 char c[2];
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
482
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
483 l = (item->textwidth ? item->textwidth : item->width);
35362
848ca0b6d5ca Prevent floating point exception.
ib
parents: 34454
diff changeset
484 x = (l ? l - ((d - DLABEL_DELAY) / 20) % l - 1 : 0);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
485 c[0] = *item->text;
37014
01b3cd8a1e76 Simplify string termination.
ib
parents: 37013
diff changeset
486 c[1] = 0;
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
487
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
488 if (x < (fntTextWidth(item->fontid, c) + 1) >> 1) {
37013
11d2d0444f42 Cosmetic: Add blank line and adjust indent.
ib
parents: 37012
diff changeset
489 item->starttime = GetTimerMS(); // stop again
11d2d0444f42 Cosmetic: Add blank line and adjust indent.
ib
parents: 37012
diff changeset
490 item->last_x = x; // at current x pos
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
491 }
32761
3ceeb62a1125 Improve the readability of dynamic labels which scroll.
ib
parents: 32759
diff changeset
492 }
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
493
33971
922771be85f6 Cosmetic: Rename fntRender() fntTextRender().
ib
parents: 33901
diff changeset
494 image = fntTextRender(item, x, t);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
495
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
496 if (image)
37007
55f911b7217a Fix PutImage() for item type itVPotmeter.
ib
parents: 37006
diff changeset
497 PutImage(item->x, item->y, db, dw, image, 1, 0, True);
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
498
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
499 break;
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
500 }
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
501 }
32963
ce00479b68ce Cosmetic: Format to MPlayer coding style.
ib
parents: 32962
diff changeset
502
36994
167442bc79d0 Cosmetic: Rename same variables in RenderAll().
ib
parents: 36993
diff changeset
503 wsImageRender(window, drawbuf);
25603
01754b23193e Rename common.[ch], there are too many files by that name.
diego
parents:
diff changeset
504 }