annotate gui/ui/render.c @ 36995:efec4d517450

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