Mercurial > audlegacy-plugins
annotate src/wavpack/ui.cxx @ 1325:a33da9237bed
Several "i18n" improvements.
author | Stany HENRY <StrassBoy@gmail.com> |
---|---|
date | Sat, 21 Jul 2007 17:55:46 +0200 |
parents | b1128efde471 |
children | 0ff7d08693f6 |
rev | line source |
---|---|
109 | 1 #include <assert.h> |
2 #include <string.h> | |
3 #include <stdio.h> | |
4 #include <stdlib.h> | |
5 #include <pthread.h> | |
6 #include <unistd.h> | |
294 | 7 extern "C" { |
284
72f0de06bb56
[svn] - wavpack/wputils.h is deprecated, wavpack/wavpack.h should be used instead.
nenolod
parents:
246
diff
changeset
|
8 #include <wavpack/wavpack.h> |
109 | 9 #include <audacious/plugin.h> |
10 #include <audacious/configdb.h> | |
11 #include <audacious/titlestring.h> | |
12 #include <audacious/util.h> | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
13 #include <audacious/i18n.h> |
109 | 14 } |
15 #include <glib.h> | |
16 #include <gtk/gtk.h> | |
17 #include <iconv.h> | |
18 #include <math.h> | |
19 #include "tags.h" | |
434
7385182ae4b8
[svn] - add missing config.h inclusion for wavpack, null and metronom plugin
giacomo
parents:
294
diff
changeset
|
20 #include "../../config.h" |
109 | 21 #ifndef M_LN10 |
22 #define M_LN10 2.3025850929940456840179914546843642 | |
23 #endif | |
24 | |
25 #define DBG(format, args...) fprintf(stderr, format, ## args) | |
26 | |
27 void load_tag(ape_tag *tag, WavpackContext *ctx); | |
28 gboolean clipPreventionEnabled; | |
29 gboolean dynBitrateEnabled; | |
30 gboolean replaygainEnabled; | |
31 gboolean albumReplaygainEnabled; | |
32 gboolean openedAudio; | |
33 static GtkWidget *window = NULL; | |
34 static GtkWidget *title_entry; | |
35 static GtkWidget *album_entry; | |
36 static GtkWidget *performer_entry; | |
37 static GtkWidget *tracknumber_entry; | |
38 static GtkWidget *date_entry; | |
39 static GtkWidget *genre_entry; | |
40 static GtkWidget *user_comment_entry; | |
41 static char *filename; | |
42 | |
43 void | |
44 wv_about_box() | |
45 { | |
46 static GtkWidget *about_window; | |
47 | |
48 if (about_window) | |
49 gdk_window_raise(about_window->window); | |
50 | |
51 about_window = | |
52 xmms_show_message(g_strdup_printf | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
53 (_("Wavpack Decoder Plugin %s"), VERSION), |
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
54 (_("Copyright (c) 2006 William Pitcock <nenolod -at- nenolod.net>\n\n" |
246 | 55 "Some of the plugin code was by Miles Egan\n" |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
56 "Visit the Wavpack site at http://www.wavpack.com/\n")), |
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
57 (_("Ok")), FALSE, NULL, NULL); |
109 | 58 gtk_signal_connect(GTK_OBJECT(about_window), "destroy", |
59 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &about_window); | |
60 } | |
61 | |
62 static void | |
1044
b1128efde471
[svn] - get rid of all warnings gcc 4.2.0 emits with my build configuration.
yaz
parents:
458
diff
changeset
|
63 label_set_text(GtkWidget * label, const char *str, ...) |
109 | 64 { |
65 va_list args; | |
66 gchar *tempstr; | |
67 | |
68 va_start(args, str); | |
69 tempstr = g_strdup_vprintf(str, args); | |
70 va_end(args); | |
71 | |
72 gtk_label_set_text(GTK_LABEL(label), tempstr); | |
73 g_free(tempstr); | |
74 } | |
75 | |
76 static void | |
77 remove_cb(GtkWidget * w, gpointer data) | |
78 { | |
79 DeleteTag(filename); | |
80 g_free(filename); | |
81 gtk_widget_destroy(window); | |
82 } | |
83 | |
84 static void | |
85 save_cb(GtkWidget * w, gpointer data) | |
86 { | |
87 ape_tag Tag; | |
88 | |
458 | 89 strncpy(Tag.title, gtk_entry_get_text(GTK_ENTRY(title_entry)), MAX_LEN); |
90 strncpy(Tag.artist, gtk_entry_get_text(GTK_ENTRY(performer_entry)), MAX_LEN); | |
91 strncpy(Tag.album, gtk_entry_get_text(GTK_ENTRY(album_entry)), MAX_LEN); | |
92 strncpy(Tag.comment, gtk_entry_get_text(GTK_ENTRY(user_comment_entry)), MAX_LEN); | |
93 strncpy(Tag.track, gtk_entry_get_text(GTK_ENTRY(tracknumber_entry)), MAX_LEN2); | |
94 strncpy(Tag.year, gtk_entry_get_text(GTK_ENTRY(date_entry)), MAX_LEN2); | |
95 strncpy(Tag.genre, gtk_entry_get_text(GTK_ENTRY(genre_entry)), MAX_LEN); | |
109 | 96 WriteAPE2Tag(filename, &Tag); |
97 g_free(filename); | |
98 gtk_widget_destroy(window); | |
99 } | |
100 | |
101 static void | |
102 close_window(GtkWidget * w, gpointer data) | |
103 { | |
104 g_free(filename); | |
105 gtk_widget_destroy(window); | |
106 } | |
107 | |
108 void | |
109 wv_file_info_box(char *fn) | |
110 { | |
111 gchar *tmp; | |
112 gint time, minutes, seconds; | |
113 ape_tag tag; | |
114 | |
115 assert(fn != NULL); | |
116 char error_buff[4096]; // TODO: fixme! | |
117 WavpackContext *ctx = WavpackOpenFileInput(fn, error_buff, OPEN_TAGS | OPEN_WVC, 0); | |
118 if (ctx == NULL) { | |
119 printf("wavpack: Error opening file: \"%s: %s\"\n", fn, error_buff); | |
120 return; | |
121 } | |
122 int sample_rate = WavpackGetSampleRate(ctx); | |
123 int num_channels = WavpackGetNumChannels(ctx); | |
124 load_tag(&tag, ctx); | |
125 DBG("opened %s at %d rate with %d channels\n", fn, sample_rate, num_channels); | |
126 | |
127 filename = g_strdup(fn); | |
128 static GtkWidget *info_frame, *info_box, *bitrate_label, *rate_label; | |
129 static GtkWidget *version_label, *bits_per_sample_label; | |
130 static GtkWidget *channel_label, *length_label, *filesize_label; | |
131 static GtkWidget *peakTitle_label, *peakAlbum_label, *gainTitle_label; | |
132 static GtkWidget *gainAlbum_label, *filename_entry, *tag_frame; | |
133 | |
134 if (!window) { | |
135 GtkWidget *hbox, *label, *filename_hbox, *vbox, *left_vbox; | |
136 GtkWidget *table, *bbox, *cancel_button; | |
137 GtkWidget *save_button, *remove_button; | |
138 | |
111 | 139 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
109 | 140 gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); |
141 gtk_signal_connect(GTK_OBJECT(window), "destroy", | |
142 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &window); | |
143 gtk_container_set_border_width(GTK_CONTAINER(window), 10); | |
144 | |
145 vbox = gtk_vbox_new(FALSE, 10); | |
146 gtk_container_add(GTK_CONTAINER(window), vbox); | |
147 | |
148 filename_hbox = gtk_hbox_new(FALSE, 5); | |
149 gtk_box_pack_start(GTK_BOX(vbox), filename_hbox, FALSE, TRUE, 0); | |
150 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
151 label = gtk_label_new(_("Filename:")); |
109 | 152 gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0); |
153 filename_entry = gtk_entry_new(); | |
154 gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE); | |
155 gtk_box_pack_start(GTK_BOX(filename_hbox), filename_entry, | |
156 TRUE, TRUE, 0); | |
157 | |
158 hbox = gtk_hbox_new(FALSE, 10); | |
159 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); | |
160 | |
161 left_vbox = gtk_vbox_new(FALSE, 10); | |
162 gtk_box_pack_start(GTK_BOX(hbox), left_vbox, FALSE, FALSE, 0); | |
163 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
164 tag_frame = gtk_frame_new(_("Ape2 Tag")); |
109 | 165 gtk_box_pack_start(GTK_BOX(left_vbox), tag_frame, FALSE, FALSE, 0); |
166 | |
167 table = gtk_table_new(5, 5, FALSE); | |
168 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | |
169 gtk_container_add(GTK_CONTAINER(tag_frame), table); | |
170 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
171 label = gtk_label_new(_("Title:")); |
109 | 172 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
173 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, | |
174 GTK_FILL, GTK_FILL, 5, 5); | |
175 | |
176 title_entry = gtk_entry_new(); | |
177 gtk_table_attach(GTK_TABLE(table), title_entry, 1, 4, 0, 1, | |
178 (GtkAttachOptions) (GTK_FILL | GTK_EXPAND | | |
179 GTK_SHRINK), | |
180 (GtkAttachOptions) (GTK_FILL | GTK_EXPAND | | |
181 GTK_SHRINK), 0, 5); | |
182 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
183 label = gtk_label_new(_("Artist:")); |
109 | 184 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
185 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, | |
186 GTK_FILL, GTK_FILL, 5, 5); | |
187 | |
188 performer_entry = gtk_entry_new(); | |
189 gtk_table_attach(GTK_TABLE(table), performer_entry, 1, 4, 1, 2, | |
190 (GtkAttachOptions) (GTK_FILL | GTK_EXPAND | | |
191 GTK_SHRINK), | |
192 (GtkAttachOptions) (GTK_FILL | GTK_EXPAND | | |
193 GTK_SHRINK), 0, 5); | |
194 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
195 label = gtk_label_new(_("Album:")); |
109 | 196 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
197 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, | |
198 GTK_FILL, GTK_FILL, 5, 5); | |
199 | |
200 album_entry = gtk_entry_new(); | |
201 gtk_table_attach(GTK_TABLE(table), album_entry, 1, 4, 2, 3, | |
202 (GtkAttachOptions) (GTK_FILL | GTK_EXPAND | | |
203 GTK_SHRINK), | |
204 (GtkAttachOptions) (GTK_FILL | GTK_EXPAND | | |
205 GTK_SHRINK), 0, 5); | |
206 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
207 label = gtk_label_new(_("Comment:")); |
109 | 208 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
209 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, | |
210 GTK_FILL, GTK_FILL, 5, 5); | |
211 | |
212 user_comment_entry = gtk_entry_new(); | |
213 gtk_table_attach(GTK_TABLE(table), user_comment_entry, 1, 4, 3, | |
214 4, | |
215 (GtkAttachOptions) (GTK_FILL | GTK_EXPAND | | |
216 GTK_SHRINK), | |
217 (GtkAttachOptions) (GTK_FILL | GTK_EXPAND | | |
218 GTK_SHRINK), 0, 5); | |
219 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
220 label = gtk_label_new(_("Year:")); |
109 | 221 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
222 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, | |
223 GTK_FILL, GTK_FILL, 5, 5); | |
224 | |
225 date_entry = gtk_entry_new(); | |
226 gtk_widget_set_usize(date_entry, 60, -1); | |
227 gtk_table_attach(GTK_TABLE(table), date_entry, 1, 2, 4, 5, | |
228 (GtkAttachOptions) (GTK_FILL | GTK_EXPAND | | |
229 GTK_SHRINK), | |
230 (GtkAttachOptions) (GTK_FILL | GTK_EXPAND | | |
231 GTK_SHRINK), 0, 5); | |
232 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
233 label = gtk_label_new(_("Track number:")); |
109 | 234 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
235 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 4, 5, | |
236 GTK_FILL, GTK_FILL, 5, 5); | |
237 | |
238 tracknumber_entry = gtk_entry_new_with_max_length(4); | |
239 gtk_widget_set_usize(tracknumber_entry, 20, -1); | |
240 gtk_table_attach(GTK_TABLE(table), tracknumber_entry, 3, 4, 4, | |
241 5, | |
242 (GtkAttachOptions) (GTK_FILL | GTK_EXPAND | | |
243 GTK_SHRINK), | |
244 (GtkAttachOptions) (GTK_FILL | GTK_EXPAND | | |
245 GTK_SHRINK), 0, 5); | |
246 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
247 label = gtk_label_new(_("Genre:")); |
109 | 248 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
249 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, | |
250 GTK_FILL, GTK_FILL, 5, 5); | |
251 | |
252 genre_entry = gtk_entry_new(); | |
253 gtk_widget_set_usize(genre_entry, 20, -1); | |
254 gtk_table_attach(GTK_TABLE(table), genre_entry, 1, 4, 5, | |
255 6, | |
256 (GtkAttachOptions) (GTK_FILL | GTK_EXPAND | | |
257 GTK_SHRINK), | |
258 (GtkAttachOptions) (GTK_FILL | GTK_EXPAND | | |
259 GTK_SHRINK), 0, 5); | |
260 | |
261 bbox = gtk_hbutton_box_new(); | |
262 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
263 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); | |
264 gtk_box_pack_start(GTK_BOX(left_vbox), bbox, FALSE, FALSE, 0); | |
265 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
266 save_button = gtk_button_new_with_label(_("Save")); |
109 | 267 gtk_signal_connect(GTK_OBJECT(save_button), "clicked", |
268 GTK_SIGNAL_FUNC(save_cb), NULL); | |
269 GTK_WIDGET_SET_FLAGS(save_button, GTK_CAN_DEFAULT); | |
270 gtk_box_pack_start(GTK_BOX(bbox), save_button, TRUE, TRUE, 0); | |
271 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
272 remove_button = gtk_button_new_with_label(_("Remove Tag")); |
109 | 273 gtk_signal_connect_object(GTK_OBJECT(remove_button), |
274 "clicked", | |
275 GTK_SIGNAL_FUNC(remove_cb), NULL); | |
276 GTK_WIDGET_SET_FLAGS(remove_button, GTK_CAN_DEFAULT); | |
277 gtk_box_pack_start(GTK_BOX(bbox), remove_button, TRUE, TRUE, 0); | |
278 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
279 cancel_button = gtk_button_new_with_label(_("Cancel")); |
109 | 280 gtk_signal_connect_object(GTK_OBJECT(cancel_button), |
281 "clicked", | |
282 GTK_SIGNAL_FUNC(close_window), NULL); | |
283 GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT); | |
284 gtk_box_pack_start(GTK_BOX(bbox), cancel_button, TRUE, TRUE, 0); | |
285 gtk_widget_grab_default(cancel_button); | |
286 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
287 info_frame = gtk_frame_new(_("Wavpack Info:")); |
109 | 288 gtk_box_pack_start(GTK_BOX(hbox), info_frame, FALSE, FALSE, 0); |
289 | |
290 info_box = gtk_vbox_new(FALSE, 5); | |
291 gtk_container_add(GTK_CONTAINER(info_frame), info_box); | |
292 gtk_container_set_border_width(GTK_CONTAINER(info_box), 10); | |
293 gtk_box_set_spacing(GTK_BOX(info_box), 0); | |
294 | |
295 version_label = gtk_label_new(""); | |
296 gtk_misc_set_alignment(GTK_MISC(version_label), 0, 0); | |
297 gtk_label_set_justify(GTK_LABEL(version_label), | |
298 GTK_JUSTIFY_LEFT); | |
299 gtk_box_pack_start(GTK_BOX(info_box), version_label, FALSE, | |
300 FALSE, 0); | |
301 | |
302 bits_per_sample_label = gtk_label_new(""); | |
303 gtk_misc_set_alignment(GTK_MISC(bits_per_sample_label), 0, 0); | |
304 gtk_label_set_justify(GTK_LABEL(bits_per_sample_label), GTK_JUSTIFY_LEFT); | |
305 gtk_box_pack_start(GTK_BOX(info_box), bits_per_sample_label, FALSE, FALSE, 0); | |
306 | |
307 bitrate_label = gtk_label_new(""); | |
308 gtk_misc_set_alignment(GTK_MISC(bitrate_label), 0, 0); | |
309 gtk_label_set_justify(GTK_LABEL(bitrate_label), GTK_JUSTIFY_LEFT); | |
310 gtk_box_pack_start(GTK_BOX(info_box), bitrate_label, FALSE, FALSE, 0); | |
311 | |
312 rate_label = gtk_label_new(""); | |
313 gtk_misc_set_alignment(GTK_MISC(rate_label), 0, 0); | |
314 gtk_label_set_justify(GTK_LABEL(rate_label), GTK_JUSTIFY_LEFT); | |
315 gtk_box_pack_start(GTK_BOX(info_box), rate_label, FALSE, FALSE, 0); | |
316 | |
317 channel_label = gtk_label_new(""); | |
318 gtk_misc_set_alignment(GTK_MISC(channel_label), 0, 0); | |
319 gtk_label_set_justify(GTK_LABEL(channel_label), GTK_JUSTIFY_LEFT); | |
320 gtk_box_pack_start(GTK_BOX(info_box), channel_label, FALSE, FALSE, 0); | |
321 | |
322 length_label = gtk_label_new(""); | |
323 gtk_misc_set_alignment(GTK_MISC(length_label), 0, 0); | |
324 gtk_label_set_justify(GTK_LABEL(length_label), GTK_JUSTIFY_LEFT); | |
325 gtk_box_pack_start(GTK_BOX(info_box), length_label, FALSE, FALSE, 0); | |
326 | |
327 filesize_label = gtk_label_new(""); | |
328 gtk_misc_set_alignment(GTK_MISC(filesize_label), 0, 0); | |
329 gtk_label_set_justify(GTK_LABEL(filesize_label), GTK_JUSTIFY_LEFT); | |
330 gtk_box_pack_start(GTK_BOX(info_box), filesize_label, FALSE, | |
331 FALSE, 0); | |
332 | |
333 peakTitle_label = gtk_label_new(""); | |
334 gtk_misc_set_alignment(GTK_MISC(peakTitle_label), 0, 0); | |
335 gtk_label_set_justify(GTK_LABEL(peakTitle_label), GTK_JUSTIFY_LEFT); | |
336 gtk_box_pack_start(GTK_BOX(info_box), peakTitle_label, FALSE, | |
337 FALSE, 0); | |
338 | |
339 peakAlbum_label = gtk_label_new(""); | |
340 gtk_misc_set_alignment(GTK_MISC(peakAlbum_label), 0, 0); | |
341 gtk_label_set_justify(GTK_LABEL(peakAlbum_label), GTK_JUSTIFY_LEFT); | |
342 gtk_box_pack_start(GTK_BOX(info_box), peakAlbum_label, FALSE, | |
343 FALSE, 0); | |
344 | |
345 gainTitle_label = gtk_label_new(""); | |
346 gtk_misc_set_alignment(GTK_MISC(gainTitle_label), 0, 0); | |
347 gtk_label_set_justify(GTK_LABEL(gainTitle_label), GTK_JUSTIFY_LEFT); | |
348 gtk_box_pack_start(GTK_BOX(info_box), gainTitle_label, FALSE, | |
349 FALSE, 0); | |
350 | |
351 gainAlbum_label = gtk_label_new(""); | |
352 gtk_misc_set_alignment(GTK_MISC(gainAlbum_label), 0, 0); | |
353 gtk_label_set_justify(GTK_LABEL(gainAlbum_label), GTK_JUSTIFY_LEFT); | |
354 gtk_box_pack_start(GTK_BOX(info_box), gainAlbum_label, FALSE, | |
355 FALSE, 0); | |
356 | |
357 gtk_widget_show_all(window); | |
358 } | |
359 else | |
360 gdk_window_raise(window->window); | |
361 | |
362 gtk_widget_set_sensitive(tag_frame, TRUE); | |
363 | |
364 gtk_label_set_text(GTK_LABEL(version_label), ""); | |
365 gtk_label_set_text(GTK_LABEL(bits_per_sample_label), ""); | |
366 gtk_label_set_text(GTK_LABEL(bitrate_label), ""); | |
367 gtk_label_set_text(GTK_LABEL(rate_label), ""); | |
368 gtk_label_set_text(GTK_LABEL(channel_label), ""); | |
369 gtk_label_set_text(GTK_LABEL(length_label), ""); | |
370 gtk_label_set_text(GTK_LABEL(filesize_label), ""); | |
371 gtk_label_set_text(GTK_LABEL(peakTitle_label), ""); | |
372 gtk_label_set_text(GTK_LABEL(peakAlbum_label), ""); | |
373 gtk_label_set_text(GTK_LABEL(gainTitle_label), ""); | |
374 gtk_label_set_text(GTK_LABEL(gainAlbum_label), ""); | |
375 | |
376 time = WavpackGetNumSamples(ctx) / WavpackGetSampleRate(ctx); | |
377 minutes = time / 60; | |
378 seconds = time % 60; | |
379 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
380 label_set_text(version_label, _("version %d"), WavpackGetVersion(ctx)); |
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
381 label_set_text(bitrate_label, _("average bitrate: %6.1f kbps"), WavpackGetAverageBitrate(ctx, 0) / 1000); |
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
382 label_set_text(rate_label, _("samplerate: %d Hz"), WavpackGetSampleRate(ctx)); |
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
383 label_set_text(bits_per_sample_label, _("bits per sample: %d"), WavpackGetBitsPerSample(ctx)); |
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
384 label_set_text(channel_label, _("channels: %d"), WavpackGetNumChannels(ctx)); |
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
385 label_set_text(length_label, _("length: %d:%.2d"), minutes, seconds); |
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
386 label_set_text(filesize_label, _("file size: %d Bytes"), WavpackGetFileSize(ctx)); |
109 | 387 /* |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
388 label_set_text(peakTitle_label, _("Title Peak: %5u"), 100); |
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
389 label_set_text(peakAlbum_label, _("Album Peak: %5u"), 100); |
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
390 label_set_text(gainTitle_label, _("Title Gain: %-+5.2f dB"), 100.0); |
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
391 label_set_text(gainAlbum_label, _("Album Gain: %-+5.2f dB"), 100.0); |
109 | 392 */ |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
393 label_set_text(peakTitle_label, _("Title Peak: ?")); |
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
394 label_set_text(peakAlbum_label, _("Album Peak: ?")); |
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
395 label_set_text(gainTitle_label, _("Title Gain: ?")); |
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
396 label_set_text(gainAlbum_label, _("Album Gain: ?")); |
109 | 397 |
398 gtk_entry_set_text(GTK_ENTRY(title_entry), tag.title); | |
399 gtk_entry_set_text(GTK_ENTRY(performer_entry), tag.artist); | |
400 gtk_entry_set_text(GTK_ENTRY(album_entry), tag.album); | |
401 gtk_entry_set_text(GTK_ENTRY(user_comment_entry), tag.comment); | |
402 gtk_entry_set_text(GTK_ENTRY(genre_entry), tag.genre); | |
403 gtk_entry_set_text(GTK_ENTRY(tracknumber_entry), tag.track); | |
404 gtk_entry_set_text(GTK_ENTRY(date_entry), tag.year); | |
405 gtk_entry_set_text(GTK_ENTRY(filename_entry), fn); | |
406 gtk_editable_set_position(GTK_EDITABLE(filename_entry), -1); | |
407 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
408 tmp = g_strdup_printf(_("File Info - %s"), g_basename(fn)); |
109 | 409 gtk_window_set_title(GTK_WINDOW(window), tmp); |
410 g_free(tmp); | |
411 } | |
412 | |
413 static GtkWidget *wv_configurewin = NULL; | |
414 static GtkWidget *vbox, *notebook; | |
415 static GtkWidget *rg_switch, *rg_clip_switch, *rg_track_gain, *rg_dyn_bitrate; | |
416 | |
417 static void | |
418 wv_configurewin_ok(GtkWidget * widget, gpointer data) | |
419 { | |
420 ConfigDb *cfg; | |
421 GtkToggleButton *tb; | |
422 | |
423 tb = GTK_TOGGLE_BUTTON(rg_switch); | |
424 replaygainEnabled = gtk_toggle_button_get_active(tb); | |
425 tb = GTK_TOGGLE_BUTTON(rg_clip_switch); | |
426 clipPreventionEnabled = gtk_toggle_button_get_active(tb); | |
427 tb = GTK_TOGGLE_BUTTON(rg_dyn_bitrate); | |
428 dynBitrateEnabled = gtk_toggle_button_get_active(tb); | |
429 tb = GTK_TOGGLE_BUTTON(rg_track_gain); | |
430 albumReplaygainEnabled = !gtk_toggle_button_get_active(tb); | |
431 | |
432 cfg = bmp_cfg_db_open(); | |
433 | |
434 bmp_cfg_db_set_bool(cfg, "wavpack", "clip_prevention", | |
435 clipPreventionEnabled); | |
436 bmp_cfg_db_set_bool(cfg, "wavpack", "album_replaygain", | |
437 albumReplaygainEnabled); | |
438 bmp_cfg_db_set_bool(cfg, "wavpack", "dyn_bitrate", dynBitrateEnabled); | |
439 bmp_cfg_db_set_bool(cfg, "wavpack", "replaygain", replaygainEnabled); | |
440 bmp_cfg_db_close(cfg); | |
441 gtk_widget_destroy(wv_configurewin); | |
442 } | |
443 | |
444 static void | |
445 rg_switch_cb(GtkWidget * w, gpointer data) | |
446 { | |
447 gtk_widget_set_sensitive(GTK_WIDGET(data), | |
448 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON | |
449 (w))); | |
450 } | |
451 | |
452 void | |
453 wv_configure(void) | |
454 { | |
455 | |
456 GtkWidget *rg_frame, *rg_vbox; | |
457 GtkWidget *bbox, *ok, *cancel; | |
458 GtkWidget *rg_type_frame, *rg_type_vbox, *rg_album_gain; | |
459 | |
460 if (wv_configurewin != NULL) { | |
461 gdk_window_raise(wv_configurewin->window); | |
462 return; | |
463 } | |
464 | |
111 | 465 wv_configurewin = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
109 | 466 gtk_signal_connect(GTK_OBJECT(wv_configurewin), "destroy", |
467 GTK_SIGNAL_FUNC(gtk_widget_destroyed), | |
468 &wv_configurewin); | |
469 gtk_window_set_title(GTK_WINDOW(wv_configurewin), | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
470 _("Wavpack Configuration")); |
109 | 471 gtk_window_set_policy(GTK_WINDOW(wv_configurewin), FALSE, FALSE, FALSE); |
472 gtk_container_border_width(GTK_CONTAINER(wv_configurewin), 10); | |
473 | |
474 vbox = gtk_vbox_new(FALSE, 10); | |
475 gtk_container_add(GTK_CONTAINER(wv_configurewin), vbox); | |
476 | |
477 notebook = gtk_notebook_new(); | |
478 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); | |
479 | |
480 | |
481 /* Plugin Settings */ | |
482 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
483 rg_frame = gtk_frame_new(_("General Plugin Settings:")); |
109 | 484 gtk_container_border_width(GTK_CONTAINER(rg_frame), 5); |
485 | |
486 rg_vbox = gtk_vbox_new(FALSE, 10); | |
487 gtk_container_border_width(GTK_CONTAINER(rg_vbox), 5); | |
488 gtk_container_add(GTK_CONTAINER(rg_frame), rg_vbox); | |
489 | |
490 rg_dyn_bitrate = | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
491 gtk_check_button_new_with_label(_("Enable Dynamic Bitrate Display")); |
109 | 492 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rg_dyn_bitrate), |
493 dynBitrateEnabled); | |
494 gtk_box_pack_start(GTK_BOX(rg_vbox), rg_dyn_bitrate, FALSE, FALSE, 0); | |
495 | |
496 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), rg_frame, | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
497 gtk_label_new(_("Plugin"))); |
109 | 498 |
499 /* Replay Gain.. */ | |
500 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
501 rg_frame = gtk_frame_new(_("ReplayGain Settings:")); |
109 | 502 gtk_container_border_width(GTK_CONTAINER(rg_frame), 5); |
503 | |
504 rg_vbox = gtk_vbox_new(FALSE, 10); | |
505 gtk_container_border_width(GTK_CONTAINER(rg_vbox), 5); | |
506 gtk_container_add(GTK_CONTAINER(rg_frame), rg_vbox); | |
507 | |
508 rg_clip_switch = | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
509 gtk_check_button_new_with_label(_("Enable Clipping Prevention")); |
109 | 510 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rg_clip_switch), |
511 clipPreventionEnabled); | |
512 gtk_box_pack_start(GTK_BOX(rg_vbox), rg_clip_switch, FALSE, FALSE, 0); | |
513 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
514 rg_switch = gtk_check_button_new_with_label(_("Enable ReplayGain")); |
109 | 515 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rg_switch), |
516 replaygainEnabled); | |
517 gtk_box_pack_start(GTK_BOX(rg_vbox), rg_switch, FALSE, FALSE, 0); | |
518 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
519 rg_type_frame = gtk_frame_new(_("ReplayGain Type:")); |
109 | 520 gtk_box_pack_start(GTK_BOX(rg_vbox), rg_type_frame, FALSE, FALSE, 0); |
521 | |
522 gtk_signal_connect(GTK_OBJECT(rg_switch), "toggled", | |
523 GTK_SIGNAL_FUNC(rg_switch_cb), rg_type_frame); | |
524 | |
525 rg_type_vbox = gtk_vbox_new(FALSE, 5); | |
526 gtk_container_set_border_width(GTK_CONTAINER(rg_type_vbox), 5); | |
527 gtk_container_add(GTK_CONTAINER(rg_type_frame), rg_type_vbox); | |
528 | |
529 rg_track_gain = | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
530 gtk_radio_button_new_with_label(NULL, _("use Track Gain/Peak")); |
109 | 531 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rg_track_gain), |
532 !albumReplaygainEnabled); | |
533 gtk_box_pack_start(GTK_BOX(rg_type_vbox), rg_track_gain, FALSE, FALSE, 0); | |
534 | |
535 rg_album_gain = | |
536 gtk_radio_button_new_with_label(gtk_radio_button_group | |
537 (GTK_RADIO_BUTTON(rg_track_gain)), | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
538 _("use Album Gain/Peak")); |
109 | 539 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rg_album_gain), |
540 albumReplaygainEnabled); | |
541 gtk_box_pack_start(GTK_BOX(rg_type_vbox), rg_album_gain, FALSE, FALSE, 0); | |
542 | |
543 gtk_widget_set_sensitive(rg_type_frame, replaygainEnabled); | |
544 | |
545 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), rg_frame, | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
546 gtk_label_new(_("ReplayGain"))); |
109 | 547 |
548 /* Buttons */ | |
549 | |
550 bbox = gtk_hbutton_box_new(); | |
551 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
552 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); | |
553 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); | |
554 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
555 ok = gtk_button_new_with_label(_("Ok")); |
109 | 556 gtk_signal_connect(GTK_OBJECT(ok), "clicked", |
557 GTK_SIGNAL_FUNC(wv_configurewin_ok), NULL); | |
558 GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT); | |
559 gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0); | |
560 gtk_widget_grab_default(ok); | |
561 | |
1325
a33da9237bed
Several "i18n" improvements.
Stany HENRY <StrassBoy@gmail.com>
parents:
1044
diff
changeset
|
562 cancel = gtk_button_new_with_label(_("Cancel")); |
109 | 563 gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked", |
564 GTK_SIGNAL_FUNC(gtk_widget_destroy), | |
565 GTK_OBJECT(wv_configurewin)); | |
566 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); | |
567 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); | |
568 | |
569 gtk_widget_show_all(wv_configurewin); | |
570 } |