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