annotate gui/ui/render.c @ 37006:5526b86aaa7c

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