mp3splt-gtk 0.9.3.1519
Loading...
Searching...
No Matches
preferences_window.c
Go to the documentation of this file.
1/**********************************************************
2 *
3 * mp3splt-gtk -- utility based on mp3splt,
4 * for mp3/ogg splitting without decoding
5 *
6 * Copyright: (C) 2005-2014 Alexandru Munteanu
7 * Contact: m@ioalex.net
8 *
9 * http://mp3splt.sourceforge.net/
10 *
11 *********************************************************/
12
13/**********************************************************
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
28 * USA.
29 *
30 *********************************************************/
31
32/*!********************************************************
33 * \file
34 * The preferences tab
35 *
36 * this file contains the code for the preferences tab where
37 * the preferences can be chosen.
38 ********************************************************/
39
40#include "preferences_window.h"
41
42static GtkWidget *create_extract_tags_from_filename_options_box(ui_state *ui);
43static GtkWidget *create_test_regex_table(ui_state *ui);
44static void update_wave_preview_label_markup(gint index, gint interpolation_level, ui_state *ui);
45
51{
52 GSList *radio_button_list = gtk_radio_button_get_group(GTK_RADIO_BUTTON(ui->gui->radio_button));
53
54 //0 = german, 1 = french, 2 = english
55 GtkWidget *our_button = GTK_WIDGET(g_slist_nth_data(radio_button_list, 0));
56 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(our_button)))
57 {
58 return g_string_new("de_DE");
59 }
60
61 our_button = GTK_WIDGET(g_slist_nth_data(radio_button_list, 1));
62 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(our_button)))
63 {
64 return g_string_new("fr_FR");
65 }
66
67 return g_string_new("en");
68}
69
72{
73 GSList *radio_button_list = gtk_radio_button_get_group(GTK_RADIO_BUTTON(ui->gui->radio_output));
74 //O = default output mode
75 //1 = custom output mode
76 guint i;
77 for(i = 0; i<2;i++)
78 {
79 GtkToggleButton *test = (GtkToggleButton *)g_slist_nth_data(radio_button_list,i);
80 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(test)))
81 {
82 return i;
83 }
84 }
85
86 return 0;
87}
88
91{
92 GSList *radio_button_list = gtk_radio_button_get_group(GTK_RADIO_BUTTON(gui->tags_version_radio));
93
94 //O = The same version as the original file
95 //1 = ID3v1
96 //2 = ID3v2
97 //3 = ID3v1 & ID3v2
98 gint i = 0;
99 for(i = 0; i < 4;i++)
100 {
101 GtkToggleButton *button = GTK_TOGGLE_BUTTON(g_slist_nth_data(radio_button_list,i));
102 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
103 {
104 return i;
105 }
106 }
107
108 return 0;
109}
110
111static void set_output_directory(gchar *dirname, ui_state *ui)
112{
113 if (dirname == NULL)
114 {
115 return;
116 }
117
118 lock_mutex(&ui->variables_mutex);
119 if (ui->infos->outputdirname != NULL)
120 {
121 g_string_free(ui->infos->outputdirname, TRUE);
122 }
123 ui->infos->outputdirname = g_string_new(dirname);
124 unlock_mutex(&ui->variables_mutex);
125}
126
127static void change_output_dir_options(GtkToggleButton *button, gpointer data)
128{
129 ui_state *ui = (ui_state *)data;
130
131 GtkWidget *dir_file_chooser_button = ui->gui->custom_dir_file_chooser_button;
132 if (!dir_file_chooser_button || !ui->gui->example_output_dir_box)
133 {
134 return;
135 }
136
137 if (rh_get_active_value(ui->gui->output_dir_radio) == CUSTOM_DIRECTORY)
138 {
139 gchar *directory = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(dir_file_chooser_button));
140 set_output_directory(directory, ui);
141 gtk_widget_set_sensitive(dir_file_chooser_button, SPLT_TRUE);
142 gtk_widget_set_sensitive(ui->gui->example_output_dir_box, SPLT_FALSE);
143 }
144 else
145 {
146 set_output_directory("", ui);
147 gtk_widget_set_sensitive(dir_file_chooser_button, SPLT_FALSE);
148 gtk_widget_set_sensitive(ui->gui->example_output_dir_box, SPLT_TRUE);
149 }
150
151 ui_save_preferences(NULL, ui);
152}
153
154static void update_output_directory_in_gui(ui_state *ui, char *output_dir)
155{
156 GtkWidget *custom_dir_file_chooser_button = ui->gui->custom_dir_file_chooser_button;
157
158 if (output_dir == NULL || output_dir[0] == '\0')
159 {
160 rh_set_radio_value(ui->gui->output_dir_radio, FILE_DIRECTORY, TRUE);
161 }
162 else
163 {
164 rh_set_radio_value(ui->gui->output_dir_radio, CUSTOM_DIRECTORY, TRUE);
165 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(custom_dir_file_chooser_button), output_dir);
166 }
167
168 change_output_dir_options(GTK_TOGGLE_BUTTON(ui->gui->output_dir_radio), ui);
169}
170
171void set_output_directory_and_update_ui(gchar *dirname, ui_state *ui)
172{
173 if (dirname == NULL)
174 {
175 return;
176 }
177
178 set_output_directory(dirname, ui);
179
180 update_output_directory_in_gui(ui, dirname);
181}
182
190{
191 if (ui->infos->outputdirname != NULL)
192 {
193 return ui->infos->outputdirname->str;
194 }
195
196 return NULL;
197}
198
200static void output_radio_box_event(GtkToggleButton *radio_b, ui_state *ui)
201{
202 gint selected = get_checked_output_radio_box(ui);
203 if (selected == 0)
204 {
205 gtk_widget_set_sensitive(ui->gui->output_entry, TRUE);
206 gtk_widget_set_sensitive(ui->gui->output_label, TRUE);
207 gtk_widget_set_sensitive(ui->gui->output_default_label, FALSE);
208 }
209 else
210 {
211 gtk_widget_set_sensitive(ui->gui->output_entry, FALSE);
212 gtk_widget_set_sensitive(ui->gui->output_label, FALSE);
213 gtk_widget_set_sensitive(ui->gui->output_default_label, TRUE);
214 }
215
216 ui_save_preferences(NULL, ui);
217}
218
219#ifdef __WIN32__
220
222static GtkWidget *create_language_box(ui_state *ui)
223{
224 GtkWidget *radio_vbox = wh_vbox_new();
225
226 GtkWidget *radio_button = gtk_radio_button_new_with_label(NULL, "English");
227 ui->gui->radio_button = radio_button;
228 g_signal_connect(GTK_TOGGLE_BUTTON(radio_button), "toggled",
229 G_CALLBACK(ui_save_preferences), ui);
230 gtk_box_pack_start(GTK_BOX(radio_vbox), radio_button, TRUE, TRUE, 0);
231
232 radio_button = gtk_radio_button_new_with_label_from_widget
233 (GTK_RADIO_BUTTON(radio_button), "Français");
234 ui->gui->radio_button = radio_button;
235 g_signal_connect(GTK_TOGGLE_BUTTON(radio_button), "toggled",
236 G_CALLBACK(ui_save_preferences), ui);
237 gtk_box_pack_start(GTK_BOX(radio_vbox), radio_button, TRUE, TRUE, 0);
238
239 radio_button = gtk_radio_button_new_with_label_from_widget
240 (GTK_RADIO_BUTTON(radio_button), "Deutsch");
241 ui->gui->radio_button = radio_button;
242 g_signal_connect(GTK_TOGGLE_BUTTON (radio_button), "toggled",
243 G_CALLBACK(ui_save_preferences), ui);
244 gtk_box_pack_start(GTK_BOX(radio_vbox), radio_button, TRUE, TRUE, 0);
245
246 return wh_set_title_and_get_vbox(radio_vbox,
247 _("<b>Choose language (requires restart)</b>"));
248}
249
251static GtkWidget *create_pref_language_page(ui_state *ui)
252{
253 GtkWidget *language_hbox = wh_hbox_new();;
254 GtkWidget *language_inside_hbox = wh_hbox_new();;
255
256 GtkWidget *scrolled_window = wh_create_scrolled_window();
257 wh_add_box_to_scrolled_window(language_inside_hbox, scrolled_window);
258 gtk_box_pack_start(GTK_BOX(language_hbox), scrolled_window, TRUE, TRUE, 0);
259
260 GtkWidget *vbox = wh_vbox_new();;
261 gtk_box_pack_start(GTK_BOX(language_inside_hbox), vbox, TRUE, TRUE, 10);
262
263 GtkWidget *lang_box = create_language_box(ui);
264 gtk_box_pack_start(GTK_BOX(vbox), lang_box, FALSE, FALSE, 10);
265
266 return language_hbox;
267}
268#endif
269
271static void disable_adjust_parameters(gui_state *gui)
272{
273 gtk_widget_set_sensitive(gui->adjust_param_vbox, FALSE);
274}
275
277static void enable_adjust_parameters(gui_state *gui)
278{
279 gtk_widget_set_sensitive(gui->adjust_param_vbox, TRUE);
280}
281
283static void adjust_event(GtkToggleButton *adjust_mode, ui_state *ui)
284{
285 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(adjust_mode)))
286 {
287 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ui->gui->frame_mode),TRUE);
288 enable_adjust_parameters(ui->gui);
289 }
290 else
291 {
292 disable_adjust_parameters(ui->gui);
293 }
294
295 ui_save_preferences(NULL, ui);
296}
297
299static void frame_event(GtkToggleButton *frame_mode, ui_state *ui)
300{
301 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(frame_mode)))
302 {
303 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ui->gui->adjust_mode), FALSE);
304 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ui->gui->bit_reservoir_mode), FALSE);
305 }
306
307 ui_save_preferences(NULL, ui);
308}
309
310static void splitpoints_from_filename_event(GtkToggleButton *frame_mode, ui_state *ui)
311{
312 gint splitpoints_from_filename = gtk_toggle_button_get_active(ui->gui->names_from_filename);
313 if (splitpoints_from_filename == TRUE && ui->status->file_browsed == TRUE)
314 {
315 copy_filename_to_current_description(get_input_filename(ui->gui), ui);
316 }
317 else
318 {
319 clear_current_description(ui);
320 }
321
322 ui_save_preferences(NULL, ui);
323}
324
326static void set_default_prefs_event(GtkWidget *widget, ui_state *ui)
327{
328 gui_state *gui = ui->gui;
329
330 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gui->frame_mode), FALSE);
331 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gui->bit_reservoir_mode), FALSE);
332 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gui->adjust_mode), FALSE);
333 gtk_spin_button_set_value(GTK_SPIN_BUTTON(gui->spinner_adjust_threshold),
334 SPLT_DEFAULT_PARAM_THRESHOLD);
335 gtk_spin_button_set_value(GTK_SPIN_BUTTON(gui->spinner_adjust_offset),
336 SPLT_DEFAULT_PARAM_OFFSET);
337 gtk_spin_button_set_value(GTK_SPIN_BUTTON(gui->spinner_adjust_gap),
338 SPLT_DEFAULT_PARAM_GAP);
339 gtk_spin_button_set_value(GTK_SPIN_BUTTON(gui->spinner_adjust_min),
340 SPLT_DEFAULT_PARAM_MINIMUM_LENGTH);
341 gtk_toggle_button_set_active(gui->names_from_filename, FALSE);
342 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gui->create_dirs_from_output_files), TRUE);
343
344 ui_save_preferences(NULL, ui);
345}
346
347static void custom_directory_changed(GtkFileChooser *custom_dir_file_chooser, ui_state *ui)
348{
349 gchar *filename = gtk_file_chooser_get_filename(custom_dir_file_chooser);
350 set_output_directory(filename, ui);
351 ui_save_preferences(NULL, ui);
352}
353
354static GtkWidget *create_custom_directory_box(ui_state *ui)
355{
356 GtkWidget *custom_dir_file_chooser_button =
357 gtk_file_chooser_button_new(_("Browse directory ..."), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
358 wh_set_browser_directory_handler(ui, custom_dir_file_chooser_button);
359
360 g_signal_connect(G_OBJECT(custom_dir_file_chooser_button), "selection-changed",
361 G_CALLBACK(custom_directory_changed), ui);
362
363 ui->gui->custom_dir_file_chooser_button = custom_dir_file_chooser_button;
364
365 GtkWidget *hbox = wh_hbox_new();
366 gtk_box_pack_start(GTK_BOX(hbox), custom_dir_file_chooser_button, TRUE, TRUE, 20);
367
368 return hbox;
369}
370
371static GtkWidget *create_input_file_directory_example_box(ui_state *ui)
372{
373 GtkWidget *vbox = wh_vbox_new();
374
375 GtkWidget *example_output_dir_label = gtk_label_new(_("Example for the single file split:"));
376 GtkWidget *fake_hbox = wh_hbox_new();
377 gtk_box_pack_start(GTK_BOX(fake_hbox), example_output_dir_label, FALSE, FALSE, 0);
378
379 gtk_box_pack_start(GTK_BOX(vbox), fake_hbox, FALSE, FALSE, 0);
380
381 GtkWidget *example_output_dir_entry = gtk_entry_new();
382 gtk_editable_set_editable(GTK_EDITABLE(example_output_dir_entry), FALSE);
383 gtk_box_pack_start(GTK_BOX(vbox), example_output_dir_entry, TRUE, TRUE, 5);
384 ui->gui->example_output_dir_entry = example_output_dir_entry;
385
386 GtkWidget *hbox_for_margin = wh_hbox_new();
387 gtk_box_pack_start(GTK_BOX(hbox_for_margin), vbox, TRUE, TRUE, 20);
388
389 ui->gui->example_output_dir_box = hbox_for_margin;
390
391 return hbox_for_margin;
392}
393
394void update_example_output_dir_for_single_file_split(ui_state *ui)
395{
396 if (!ui->gui->example_output_dir_entry)
397 {
398 return;
399 }
400
401 gchar *dirname = g_path_get_dirname(get_input_filename(ui->gui));
402 gtk_entry_set_text(GTK_ENTRY(ui->gui->example_output_dir_entry), dirname);
403 g_free(dirname);
404}
405
407static GtkWidget *create_directory_box(ui_state *ui)
408{
409 gui_state *gui = ui->gui;
410
411 GtkWidget *vbox = wh_vbox_new();
412
413 GtkWidget *output_dir_radio = NULL;
414 output_dir_radio = rh_append_radio_to_vbox(output_dir_radio, _("Custom directory"),
415 CUSTOM_DIRECTORY, change_output_dir_options, ui, vbox);
416 gtk_widget_set_tooltip_text(output_dir_radio, _("Create split files in a custom directory"));
417
418 GtkWidget *custom_dir_box = create_custom_directory_box(ui);
419 gtk_box_pack_start(GTK_BOX(vbox), custom_dir_box, FALSE, FALSE, 0);
420
421 output_dir_radio = rh_append_radio_to_vbox(output_dir_radio, _("Input file directory"),
422 FILE_DIRECTORY, change_output_dir_options, ui, vbox);
423 gtk_widget_set_tooltip_text(output_dir_radio,
424 _("Create split files in the same directory as the file being split"));
425 gui->output_dir_radio = output_dir_radio;
426
427 GtkWidget *input_file_directory_example_box = create_input_file_directory_example_box(ui);
428 gtk_box_pack_start(GTK_BOX(vbox), input_file_directory_example_box, FALSE, FALSE, 0);
429
430 return wh_set_title_and_get_vbox(vbox, _("<b>Directory for split files</b>"));
431}
432
433static void bit_reservoir_event(GtkToggleButton *bit_reservoir, ui_state *ui)
434{
435 gint with_bit_reservoir =
436 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ui->gui->bit_reservoir_mode));
437 if (with_bit_reservoir == TRUE)
438 {
439 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ui->gui->frame_mode), TRUE);
440 }
441
442 ui_save_preferences(NULL, ui);
443}
444
446static GtkWidget *create_split_options_box(ui_state *ui)
447{
448 gui_state *gui = ui->gui;
449
450 GtkWidget *vbox = wh_vbox_new();
451
452 //names from filename
453 GtkToggleButton *names_from_filename =
454 GTK_TOGGLE_BUTTON(gtk_check_button_new_with_mnemonic(
455 _("_Splitpoint name from filename (manual single file split only)")));
456 gtk_widget_set_tooltip_text(GTK_WIDGET(names_from_filename),
457 _("Name newly added splitpoints as the input file"));
458 gui->names_from_filename = names_from_filename;
459
460 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(names_from_filename), FALSE, FALSE, 0);
461 g_signal_connect(G_OBJECT(names_from_filename), "toggled",
462 G_CALLBACK(splitpoints_from_filename_event), ui);
463
464 GtkWidget *create_dirs_from_output_files =
465 gtk_check_button_new_with_mnemonic(_("Create directories from _filenames "));
466
467 gtk_widget_set_tooltip_text(create_dirs_from_output_files,
468 _("If the splitpoint name is 'a/b/output', the directory chain 'a/b' is created in the"
469 " output\ndirectory and the file 'output.<extension>' is written in the"
470 " '<output_directory>/a/b' directory"));
471 gui->create_dirs_from_output_files = create_dirs_from_output_files;
472 gtk_box_pack_start(GTK_BOX(vbox), create_dirs_from_output_files, FALSE, FALSE, 0);
473 g_signal_connect(G_OBJECT(create_dirs_from_output_files), "toggled",
474 G_CALLBACK(ui_save_preferences), ui);
475
476 //frame mode option
477 GtkWidget *frame_mode =
478 gtk_check_button_new_with_mnemonic(_("F_rame mode (useful for mp3 VBR) (mp3 only)"));
479 gtk_widget_set_tooltip_text(frame_mode,
480 _("The split is slower with this option, but some mp3 files having\n"
481 "Variable Bit Rate need this mode to be enabled"));
482 gui->frame_mode = frame_mode;
483 gtk_box_pack_start(GTK_BOX(vbox), frame_mode, FALSE, FALSE, 0);
484 g_signal_connect(G_OBJECT(frame_mode), "toggled", G_CALLBACK(frame_event), ui);
485
486 //bit reservoir handling option
487 GtkWidget *bit_reservoir_mode =
488 gtk_check_button_new_with_mnemonic(_("_[Experimental] Bit reservoir handling for gapless playback (mp3 only)"));
489 gtk_widget_set_tooltip_text(bit_reservoir_mode,
490 _("Split files will play gapless only on players "
491 "supporting the LAME tag delay and padding values\n"
492 "Gapless players examples: cmus, mpg123, foobar2000"));
493 gui->bit_reservoir_mode = bit_reservoir_mode;
494 gtk_box_pack_start(GTK_BOX(vbox), bit_reservoir_mode, FALSE, FALSE, 0);
495 g_signal_connect(G_OBJECT(bit_reservoir_mode), "toggled", G_CALLBACK(bit_reservoir_event), ui);
496
497 //auto adjust option
498 GtkWidget *adjust_mode = gtk_check_button_new_with_mnemonic(_("_Auto-adjust mode (use"
499 " silence detection to auto-adjust splitpoints)"));
500 gtk_widget_set_tooltip_text(adjust_mode,
501 _("Splitpoints will be adjusted to match silences (if found)\n"
502 "This mode requires the frame mode"));
503 gui->adjust_mode = adjust_mode;
504 gtk_box_pack_start(GTK_BOX(vbox), adjust_mode, FALSE, FALSE, 0);
505 g_signal_connect(G_OBJECT(adjust_mode), "toggled", G_CALLBACK(adjust_event), ui);
506
507 //parameters for the adjust option
508 GtkWidget *horiz_fake = wh_hbox_new();
509 gtk_box_pack_start(GTK_BOX(vbox), horiz_fake, FALSE, FALSE, 0);
510
511 GtkWidget *param_vbox = wh_vbox_new();
512 gui->adjust_param_vbox = param_vbox;
513 gtk_box_pack_start(GTK_BOX(horiz_fake), param_vbox, FALSE, FALSE, 25);
514
515 //threshold level
516 horiz_fake = wh_hbox_new();
517 gtk_box_pack_start(GTK_BOX(param_vbox), horiz_fake, FALSE, FALSE, 0);
518
519 GtkWidget *threshold_label = gtk_label_new(_("Threshold level (dB):"));
520 gtk_box_pack_start(GTK_BOX(horiz_fake), threshold_label, FALSE, FALSE, 0);
521
522 GtkAdjustment *adj = gtk_adjustment_new(0.0, -96.0, 0.0, 0.5, 10.0, 0.0);
523 GtkWidget *spinner_adjust_threshold = gtk_spin_button_new (adj, 0.5, 2);
524 gui->spinner_adjust_threshold = spinner_adjust_threshold;
525 g_signal_connect(G_OBJECT(spinner_adjust_threshold), "value_changed",
526 G_CALLBACK(ui_save_preferences), ui);
527 gtk_box_pack_start(GTK_BOX(horiz_fake), spinner_adjust_threshold,
528 FALSE, FALSE, 6);
529
530 //min level
531 horiz_fake = wh_hbox_new();
532 gtk_box_pack_start(GTK_BOX(param_vbox), horiz_fake, FALSE, FALSE, 0);
533
534 GtkWidget *min_label = gtk_label_new(_("Minimum silence length (seconds):"));
535 gtk_box_pack_start(GTK_BOX(horiz_fake), min_label, FALSE, FALSE, 0);
536
537 adj = gtk_adjustment_new(0.0, 0, INT_MAX/6000, 0.5, 10.0, 0.0);
538 GtkWidget *spinner_adjust_min = gtk_spin_button_new(adj, 1, 2);
539 gui->spinner_adjust_min = spinner_adjust_min;
540 g_signal_connect(G_OBJECT(spinner_adjust_min), "value_changed",
541 G_CALLBACK(ui_save_preferences), ui);
542 gtk_box_pack_start(GTK_BOX(horiz_fake), spinner_adjust_min,
543 FALSE, FALSE, 6);
544
545 //offset level
546 horiz_fake = wh_hbox_new();
547 gtk_box_pack_start(GTK_BOX(param_vbox), horiz_fake, FALSE, FALSE, 0);
548
549 GtkWidget *offset_label = gtk_label_new(_("Cutpoint offset (0 is the begin of silence "
550 "and 1 the end):"));
551 gtk_box_pack_start(GTK_BOX(horiz_fake), offset_label, FALSE, FALSE, 0);
552
553 //adjustement for the offset spinner
554 adj = gtk_adjustment_new(0.0, -2, 2, 0.05, 10.0, 0.0);
555 GtkWidget *spinner_adjust_offset = gtk_spin_button_new (adj, 0.05, 2);
556 gui->spinner_adjust_offset = spinner_adjust_offset;
557 g_signal_connect(G_OBJECT(spinner_adjust_offset), "value_changed",
558 G_CALLBACK(ui_save_preferences), ui);
559 gtk_box_pack_start(GTK_BOX(horiz_fake), spinner_adjust_offset, FALSE, FALSE, 6);
560
561 //gap level (seconds)
562 horiz_fake = wh_hbox_new();
563 gtk_box_pack_start(GTK_BOX(param_vbox), horiz_fake, FALSE, FALSE, 0);
564
565 GtkWidget *gap_label =
566 gtk_label_new(_("Gap level (seconds around splitpoint to search for silence):"));
567 gtk_box_pack_start(GTK_BOX(horiz_fake), gap_label, FALSE, FALSE, 0);
568
569 adj = gtk_adjustment_new(0.0, 0, 2000, 1.0, 10.0, 0.0);
570 GtkWidget *spinner_adjust_gap = gtk_spin_button_new (adj, 1, 0);
571 gui->spinner_adjust_gap = spinner_adjust_gap;
572 g_signal_connect(G_OBJECT(spinner_adjust_gap), "value_changed",
573 G_CALLBACK(ui_save_preferences), ui);
574 gtk_box_pack_start(GTK_BOX(horiz_fake), spinner_adjust_gap, FALSE, FALSE, 6);
575
576 disable_adjust_parameters(ui->gui);
577
578 //set default preferences button
579 horiz_fake = wh_hbox_new();
580 gtk_box_pack_start(GTK_BOX(vbox), horiz_fake, FALSE, FALSE, 0);
581
582 GtkWidget *set_default_prefs_button =
583 wh_create_cool_button("document-properties", _("Set _default split options"),FALSE);
584 g_signal_connect(G_OBJECT(set_default_prefs_button), "clicked",
585 G_CALLBACK(set_default_prefs_event), ui);
586 gtk_box_pack_start (GTK_BOX (horiz_fake), set_default_prefs_button, FALSE, FALSE, 5);
587
588 return wh_set_title_and_get_vbox(vbox, _("<b>Split options</b>"));
589}
590
592static GtkWidget *create_pref_splitpoints_page(ui_state *ui)
593{
594 GtkWidget *general_hbox = wh_hbox_new();
595 GtkWidget *inside_hbox = wh_hbox_new();
596
597 GtkWidget *scrolled_window = wh_create_scrolled_window();
598 wh_add_box_to_scrolled_window(inside_hbox, scrolled_window);
599 gtk_box_pack_start(GTK_BOX(general_hbox), scrolled_window, TRUE, TRUE, 0);
600
601 GtkWidget *inside_vbox = wh_vbox_new();
602 gtk_box_pack_start(GTK_BOX(inside_hbox), inside_vbox, TRUE, TRUE, 5);
603
604 GtkWidget *dir_box = create_directory_box(ui);
605 gtk_box_pack_start(GTK_BOX(inside_vbox), dir_box, FALSE, FALSE, 2);
606
607 GtkWidget *split_options_box = create_split_options_box(ui);
608 gtk_box_pack_start(GTK_BOX(inside_vbox), split_options_box, FALSE, FALSE, 1);
609
610 return general_hbox;
611}
612
614static void player_combo_box_event(GtkComboBox *widget, ui_state *ui)
615{
616 disconnect_button_event(ui->gui->disconnect_button, ui);
617
618 ui->infos->selected_player = ch_get_active_value(widget);
619 if (ui->infos->selected_player == PLAYER_GSTREAMER)
620 {
621 hide_connect_button(ui->gui);
622 gtk_widget_show(ui->gui->playlist_box);
623 gtk_widget_set_sensitive(ui->gui->gstreamer_stop_before_end_box, TRUE);
624 }
625 else
626 {
627 show_connect_button(ui->gui);
628 gtk_widget_hide(ui->gui->playlist_box);
629 gtk_widget_set_sensitive(ui->gui->gstreamer_stop_before_end_box, FALSE);
630 }
631
632 gtk_widget_show(ui->gui->player_box);
633 gtk_widget_show(ui->gui->queue_files_button);
634
635 ui_save_preferences(NULL, ui);
636}
637
638static void update_timeout_value(GtkWidget *spinner, ui_state *ui)
639{
640 ui->infos->timeout_value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spinner));
641
642 restart_player_timer(ui);
643 ui_save_preferences(NULL, ui);
644}
645
646static void update_gstreamer_stop_before_end_value(GtkWidget *spinner, ui_state *ui)
647{
648 ui->infos->gstreamer_stop_before_end = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spinner));
649 ui_save_preferences(NULL, ui);
650}
651
652static void update_small_seek_jump_value(GtkWidget *spinner, ui_state *ui)
653{
654 ui->infos->small_seek_jump_value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spinner));
655 ui_save_preferences(NULL, ui);
656}
657
658static void update_seek_jump_value(GtkWidget *spinner, ui_state *ui)
659{
660 ui->infos->seek_jump_value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spinner));
661 ui_save_preferences(NULL, ui);
662}
663
664static void update_big_seek_jump_value(GtkWidget *spinner, ui_state *ui)
665{
666 ui->infos->big_seek_jump_value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spinner));
667 ui_save_preferences(NULL, ui);
668}
669
671static GtkWidget *create_player_options_box(ui_state *ui)
672{
673 GtkWidget *vbox = wh_vbox_new();
674 GtkWidget *horiz_fake = wh_hbox_new();
675
676 GtkWidget *label = gtk_label_new(_("Player:"));
677 gtk_box_pack_start(GTK_BOX(horiz_fake), label, FALSE, FALSE, 0);
678
679 GtkWidget *player_combo_box = GTK_WIDGET(ch_new_combo());
680 ui->gui->player_combo_box = player_combo_box;
681
682#ifndef NO_AUDACIOUS
683 ch_append_to_combo(GTK_COMBO_BOX(player_combo_box), "Audacious", PLAYER_AUDACIOUS);
684#endif
685 ch_append_to_combo(GTK_COMBO_BOX(player_combo_box), "SnackAmp", PLAYER_SNACKAMP);
686#ifndef NO_GSTREAMER
687 ch_append_to_combo(GTK_COMBO_BOX(player_combo_box), "GStreamer", PLAYER_GSTREAMER);
688#endif
689
690 g_signal_connect(G_OBJECT(player_combo_box), "changed", G_CALLBACK(player_combo_box_event), ui);
691
692 gtk_box_pack_start(GTK_BOX(horiz_fake), player_combo_box, FALSE, FALSE, 5);
693 gtk_box_pack_start(GTK_BOX(vbox), horiz_fake, FALSE, FALSE, 0);
694
695 GtkWidget *spinner = wh_create_int_spinner_in_box(_("Refresh player every "),
696 _("milliseconds."),
697 (gdouble)DEFAULT_TIMEOUT_VALUE, 20.0, 1000.0, 10.0, 100.0,
698 _("\t(higher refresh rate decreases CPU usage - default is 200)"),
699 update_timeout_value, ui, vbox);
700 ui_register_spinner_int_preference("player", "refresh_rate", DEFAULT_TIMEOUT_VALUE,
701 spinner, (void (*)(GtkWidget *, gpointer)) update_timeout_value,
702 ui, ui);
703
704 GtkWidget *gstreamer_vbox = wh_vbox_new();
705 ui->gui->gstreamer_stop_before_end_box = gstreamer_vbox;
706
707#ifndef NO_GSTREAMER
708 GtkWidget *gstreamer_stop_before_end =
709 wh_create_int_spinner_in_box(_("Stop GStreamer preview"), _("milliseconds before the end."),
710 (gdouble)DEFAULT_GSTREAMER_STOP_BEFORE_END_VALUE, 0.0, 1000.0, 50.0, 100.0,
711 NULL, update_gstreamer_stop_before_end_value, ui, gstreamer_vbox);
712 ui_register_spinner_int_preference("player", "gstreamer_stop_before_end",
713 DEFAULT_GSTREAMER_STOP_BEFORE_END_VALUE, gstreamer_stop_before_end,
714 (void (*)(GtkWidget *, gpointer)) update_gstreamer_stop_before_end_value, ui, ui);
715
716 gtk_box_pack_start(GTK_BOX(vbox), gstreamer_vbox, TRUE, TRUE, 0);
717#endif
718
719 //Seek times
720
721 GtkWidget *seek_vbox = wh_vbox_new();
722
723 GtkWidget *small_seek_jump = wh_create_int_spinner_in_box(_("Small seek jumps for "),
724 _("milliseconds."),
725 (gdouble)DEFAULT_SMALL_SEEK_JUMP_VALUE, 0.0, (gdouble)G_MAXINT, 100.0, 1000.0,
726 NULL,
727 update_small_seek_jump_value, ui, seek_vbox);
728 ui_register_spinner_int_preference("player", "small_seek_jump", DEFAULT_SMALL_SEEK_JUMP_VALUE,
729 small_seek_jump, (void (*)(GtkWidget *, gpointer)) update_small_seek_jump_value,
730 ui, ui);
731
732 GtkWidget *seek_jump = wh_create_int_spinner_in_box(_("Seek jumps for "),
733 _("milliseconds. (0=auto)"),
734 (gdouble)DEFAULT_SEEK_JUMP_VALUE, 0.0, (gdouble)G_MAXINT, 1000.0, 10000.0,
735 NULL,
736 update_seek_jump_value, ui, seek_vbox);
737 ui_register_spinner_int_preference("player", "seek_jump", DEFAULT_SEEK_JUMP_VALUE,
738 seek_jump, (void (*)(GtkWidget *, gpointer)) update_seek_jump_value,
739 ui, ui);
740
741 GtkWidget *big_seek_jump = wh_create_int_spinner_in_box(_("Big seek jumps for "),
742 _("milliseconds. (0=auto)"),
743 (gdouble)DEFAULT_BIG_SEEK_JUMP_VALUE, 0.0, (gdouble)G_MAXINT, 1000.0, 60000.0,
744 NULL,
745 update_big_seek_jump_value, ui, seek_vbox);
746 ui_register_spinner_int_preference("player", "big_seek_jump", DEFAULT_BIG_SEEK_JUMP_VALUE,
747 big_seek_jump, (void (*)(GtkWidget *, gpointer)) update_big_seek_jump_value,
748 ui, ui);
749
750 GtkWidget *hbox_for_margin = wh_put_in_new_hbox(seek_vbox, 3, FALSE, FALSE);
751
752 GtkWidget *seek_times_frame = gtk_frame_new(_("Seek times"));
753 gtk_container_add(GTK_CONTAINER(seek_times_frame), hbox_for_margin);
754
755 horiz_fake = wh_hbox_new();
756 gtk_box_pack_start(GTK_BOX(horiz_fake), seek_times_frame, FALSE, FALSE, 0);
757
758 gtk_box_pack_start(GTK_BOX(vbox), horiz_fake, FALSE, FALSE, 0);
759
760 return wh_set_title_and_get_vbox(vbox, _("<b>Player options</b>"));
761}
762
763static void wave_quality_changed_event(GtkAdjustment *wave_quality_adjustment, ui_state *ui)
764{
765 gint quality_level = (gint)gtk_adjustment_get_value(GTK_ADJUSTMENT(wave_quality_adjustment));
766
767 gint level = 0;
768 for (level = 0; level <= 5; level++)
769 {
770 gdouble default_value = ui->infos->douglas_peucker_thresholds_defaults[level];
771 gdouble final_value = default_value - quality_level;
772 if (final_value <= 0)
773 {
774 final_value = 0.1;
775 }
776
777 ui->infos->douglas_peucker_thresholds[level] = final_value;
778 }
779
780 gint default_number_of_points_th = DEFAULT_SILENCE_WAVE_NUMBER_OF_POINTS_THRESHOLD;
781 gint number_of_points_th = default_number_of_points_th + (quality_level * 1000);
782 if (number_of_points_th <= 0)
783 {
784 number_of_points_th = 0;
785 }
786
787 ui->infos->silence_wave_number_of_points_threshold = number_of_points_th;
788
789 compute_douglas_peucker_filters(ui);
790 refresh_preview_drawing_areas(ui->gui);
791
792 ui_save_preferences(NULL, ui);
793}
794
795void refresh_preview_drawing_areas(gui_state *gui)
796{
797 gint i = 0;
798 for (i = 0; i < gui->wave_quality_das->len; i++)
799 {
800 gtk_widget_queue_draw(g_ptr_array_index(gui->wave_quality_das, i));
801 }
802
803 gtk_widget_queue_draw(gui->player_scrolled_window);
804}
805
806static gint get_wave_preview_width_drawing_area(ui_state *ui)
807{
808 if (ui->infos->width_drawing_area < 50)
809 {
810 return 500;
811 }
812
813 return ui->infos->width_drawing_area;
814}
815
816static gboolean wave_quality_draw_event(GtkWidget *drawing_area, cairo_t *cairo_surface,
818{
819 ui_state *ui = data->data;
820 gint index = data->index;
821
822 gint width = get_wave_preview_width_drawing_area(ui);
823 gtk_widget_set_size_request(drawing_area, width, 70);
824
825 gint expected_drawing_time_int = g_array_index(ui->infos->preview_time_windows, gint, index);
826 gfloat expected_drawing_time = (gfloat)(expected_drawing_time_int);
827
828 dh_set_white_color(cairo_surface);
829
830 dh_draw_rectangle(cairo_surface, TRUE, 0, 0, width, 70);
831 gfloat current_time = (gfloat) ui->infos->total_time / 2.0f;
832
833 gfloat drawing_time = 0;
834 gfloat zoom_coeff = 0.2;
835
836 gfloat left_time = 0;
837 gfloat right_time = 0;
838 while ((((gint)drawing_time) == 0) || (drawing_time > expected_drawing_time))
839 {
840 left_time = get_left_drawing_time(current_time, ui->infos->total_time, zoom_coeff);
841 right_time = get_right_drawing_time(current_time, ui->infos->total_time, zoom_coeff);
842 drawing_time = right_time - left_time;
843 zoom_coeff += 0.01;
844
845 if (zoom_coeff > 100) { break; }
846 }
847
848 ui->infos->drawing_preferences_silence_wave = SPLT_TRUE;
849
850 gint interpolation_level = draw_silence_wave((gint)left_time, (gint)right_time, width / 2, 50,
851 drawing_time, width, 0,
852 current_time, ui->infos->total_time, zoom_coeff,
853 drawing_area, cairo_surface, ui);
854
855 ui->infos->drawing_preferences_silence_wave = SPLT_FALSE;
856
857 update_wave_preview_label_markup(index, interpolation_level, ui);
858
859 return TRUE;
860}
861
862static GtkWidget *create_wave_quality_preview_box(ui_state *ui)
863{
864 GtkWidget *vbox = wh_vbox_new();
865
866 GtkWidget *label_hbox = wh_hbox_new();
867 GtkWidget *wave_preview_label = gtk_label_new(NULL);
868
869 gchar wave_availability[256] = { '\0' };
870 g_snprintf(wave_availability, 256, "<span style='italic' color='#0000AA'>%s</span>",
871 _("Only available if the amplitude wave is shown in the player"));
872 gtk_label_set_markup(GTK_LABEL(wave_preview_label), wave_availability);
873 gtk_box_pack_start(GTK_BOX(label_hbox), wave_preview_label, FALSE, FALSE, 0);
874 gtk_box_pack_start(GTK_BOX(vbox), label_hbox, FALSE, FALSE, 4);
875
876 ui->gui->wave_quality_das = g_ptr_array_new();
877 ui->gui->wave_preview_labels = g_ptr_array_new();
878
879 gint i = 0;
880 for (i = 0; i < ui->infos->preview_time_windows->len; i++)
881 {
882 GtkWidget *wave_quality_da = gtk_drawing_area_new();
883 g_ptr_array_add(ui->gui->wave_quality_das, (gpointer)wave_quality_da);
884 ui->infos->preview_indexes[i].index = i;
885 ui->infos->preview_indexes[i].data = ui;
886
887 g_signal_connect(wave_quality_da, "draw", G_CALLBACK(wave_quality_draw_event),
888 &ui->infos->preview_indexes[i]);
889
890 wh_put_in_hbox_and_attach_to_vbox(wave_quality_da, vbox, 0);
891
892 GtkWidget *minutes_label = gtk_label_new(NULL);
893 g_ptr_array_add(ui->gui->wave_preview_labels, minutes_label);
894 update_wave_preview_label_markup(i, -1, ui);
895
896 wh_put_in_hbox_and_attach_to_vbox_with_bottom_margin(minutes_label, vbox, 0, 4);
897 }
898
899 GtkWidget *hbox_for_margin = wh_put_in_new_hbox(vbox, 6, FALSE, FALSE);
900
901 GtkWidget *wave_preview_frame = gtk_frame_new(_("Wave preview"));
902 gtk_container_add(GTK_CONTAINER(wave_preview_frame), hbox_for_margin);
903 return wh_put_in_new_hbox(wave_preview_frame, 0, FALSE, FALSE);
904}
905
906static void update_wave_preview_label_markup(gint index, gint interpolation_level, ui_state *ui)
907{
908 gint time_window = g_array_index(ui->infos->preview_time_windows, gint, index);
909
910 gchar minutes_text[128] = { '\0' };
911 g_snprintf(minutes_text, 128, _("%d minute(s) window"), time_window / 100 / 60);
912
913 gchar interpolation_text[256] = { '\0' };
914 if (interpolation_level >= 0)
915 {
916 g_snprintf(interpolation_text, 256, _("Wave interpolation level %d with threshold of %.1lf"),
917 interpolation_level + 1, ui->infos->douglas_peucker_thresholds[interpolation_level]);
918 }
919 else {
920 g_snprintf(interpolation_text, 256, _("No wave interpolation"));
921 }
922
923 gchar final_text_with_color[512] = { '\0' };
924 g_snprintf(final_text_with_color, 512,
925 "<span color='#DD0000'>%s</span> - <span>%s</span>",
926 minutes_text, interpolation_text);
927
928 GtkWidget *text_label = g_ptr_array_index(ui->gui->wave_preview_labels, index);
929 gtk_label_set_markup(GTK_LABEL(text_label), final_text_with_color);
930}
931
932static GtkWidget *create_wave_options_box(ui_state *ui)
933{
934 GtkWidget *vbox = wh_vbox_new();
935 GtkWidget *range_hbox = wh_hbox_new();
936
937 GtkWidget *wave_quality_label =
938 gtk_label_new(_("Wave quality (higher is better but consumes more CPU):"));
939 gtk_box_pack_start(GTK_BOX(range_hbox), wave_quality_label, FALSE, FALSE, 0);
940
941 GtkWidget *wave_quality_hscale = wh_hscale_new_with_range(-6.0, 6.0, 1.0);
942 gtk_scale_set_draw_value(GTK_SCALE(wave_quality_hscale), TRUE);
943 gtk_box_pack_start(GTK_BOX(range_hbox), wave_quality_hscale, FALSE, FALSE, 4);
944 gtk_widget_set_size_request(wave_quality_hscale, 160, 0);
945
946 gtk_range_set_increments(GTK_RANGE(wave_quality_hscale), 1.0, 1.0);
947
948 ui_register_range_preference("player", "wave_quality", 0,
949 wave_quality_hscale, (void (*)(GtkAdjustment *,gpointer))wave_quality_changed_event, ui, ui);
950
951 GtkAdjustment *wave_quality_adjustment = gtk_range_get_adjustment(GTK_RANGE(wave_quality_hscale));
952 g_signal_connect(G_OBJECT(wave_quality_adjustment), "value-changed",
953 G_CALLBACK(wave_quality_changed_event), ui);
954
955 gtk_box_pack_start(GTK_BOX(vbox), range_hbox, FALSE, FALSE, 0);
956
957 GtkWidget *wave_quality_box = create_wave_quality_preview_box(ui);
958 gtk_box_pack_start(GTK_BOX(vbox), wave_quality_box, FALSE, FALSE, 0);
959
960 return wh_set_title_and_get_vbox(vbox, _("<b>Amplitude wave options</b>"));
961}
962
964static GtkWidget *create_pref_player_page(ui_state *ui)
965{
966 GtkWidget *player_hbox = wh_hbox_new();;
967 GtkWidget *inside_hbox = wh_hbox_new();;
968
969 GtkWidget *inside_vbox = wh_vbox_new();;
970 gtk_box_pack_start(GTK_BOX(inside_hbox), inside_vbox, TRUE, TRUE, 5);
971
972 GtkWidget *player_scrolled_window = wh_create_scrolled_window();
973 ui->gui->player_scrolled_window = player_scrolled_window;
974 wh_add_box_to_scrolled_window(inside_hbox, player_scrolled_window);
975 gtk_box_pack_start(GTK_BOX(player_hbox), player_scrolled_window, TRUE, TRUE, 0);
976
977 GtkWidget *vbox = wh_vbox_new();;
978 gtk_box_pack_start(GTK_BOX(inside_vbox), vbox, TRUE, TRUE, 0);
979
980 GtkWidget *player_options_box = create_player_options_box(ui);
981 gtk_box_pack_start(GTK_BOX(vbox), player_options_box, FALSE, FALSE, 3);
982
983 GtkWidget *wave_options_box = create_wave_options_box(ui);
984 gtk_box_pack_start(GTK_BOX(vbox), wave_options_box, FALSE, FALSE, 3);
985
986 return player_hbox;
987}
988
989static gboolean check_output_format_end(ui_with_err *ui_err)
990{
991 ui_state *ui = ui_err->ui;
992
993 remove_status_message(ui->gui);
994 print_status_bar_confirmation_in_idle(ui_err->err, ui);
995
996 set_process_in_progress_and_wait_safe(FALSE, ui_err->ui);
997
998 g_free(ui_err);
999
1000 return FALSE;
1001}
1002
1003static gpointer check_output_format_thread(ui_with_fname *ui_fname)
1004{
1005 ui_state *ui = ui_fname->ui;
1006
1007 set_process_in_progress_and_wait_safe(TRUE, ui);
1008
1009 gint error = mp3splt_set_oformat(ui->mp3splt_state, ui_fname->fname);
1010
1011 ui_with_err *ui_err = g_malloc0(sizeof(ui_with_err));
1012 ui_err->err = error;
1013 ui_err->ui = ui;
1014
1015 add_idle(G_PRIORITY_HIGH_IDLE, (GSourceFunc)check_output_format_end, ui_err, NULL);
1016
1017 g_free(ui_fname->fname);
1018 g_free(ui_fname);
1019
1020 return NULL;
1021}
1022
1024static gboolean output_entry_event(GtkWidget *widget, GdkEventKey *event, ui_state *ui)
1025{
1026 const char *data = gtk_entry_get_text(GTK_ENTRY(ui->gui->output_entry));
1027 if (data)
1028 {
1029 ui_with_fname *ui_fname = g_malloc0(sizeof(ui_with_fname));
1030 ui_fname->ui = ui;
1031 ui_fname->fname = strdup(data);
1032
1033 create_thread_and_unref((GThreadFunc)check_output_format_thread,
1034 (gpointer) ui_fname, ui, "check_output_format");
1035 }
1036
1037 ui_save_preferences(NULL, ui);
1038
1039 return FALSE;
1040}
1041
1043static GtkWidget *create_output_filename_box(ui_state *ui)
1044{
1045 gui_state *gui = ui->gui;
1046
1047 GtkWidget *vbox = wh_vbox_new();
1048
1049 GtkWidget *horiz_fake = wh_hbox_new();
1050 gtk_box_pack_start(GTK_BOX(vbox), horiz_fake, FALSE, FALSE, 5);
1051
1052 //default/custom radio buttons
1053 GtkWidget *radio_output = gtk_radio_button_new_with_label(NULL, _("Default format"));
1054 gui->radio_output = radio_output;
1055 gtk_box_pack_start(GTK_BOX(vbox), radio_output, FALSE, FALSE, 0);
1056
1057 horiz_fake = wh_hbox_new();
1058 gtk_box_pack_start(GTK_BOX(vbox), horiz_fake, FALSE, FALSE, 5);
1059
1060 GString *outputs_str = g_string_new(_(" Default output: "));
1061 g_string_append(outputs_str, "<span color='#222288'>");
1062 g_string_append(outputs_str, SPLT_DEFAULT_OUTPUT);
1063 g_string_append(outputs_str, "</span>");
1064
1065 g_string_append(outputs_str, "\n");
1066 g_string_append(outputs_str, _(" CDDB, CUE and tracktype.org default: "));
1067 g_string_append(outputs_str, "<span color='#222288'>");
1068 g_string_append(outputs_str, SPLT_DEFAULT_CDDB_CUE_OUTPUT);
1069 g_string_append(outputs_str, "</span>");
1070
1071 g_string_append(outputs_str, "\n");
1072 g_string_append(outputs_str, _(" Split with silence detection default: "));
1073 g_string_append(outputs_str, "<span color='#222288'>");
1074 g_string_append(outputs_str, SPLT_DEFAULT_SILENCE_OUTPUT);
1075 g_string_append(outputs_str, "</span>");
1076
1077 g_string_append(outputs_str, "\n");
1078 g_string_append(outputs_str, _(" Trim using silence detection default: "));
1079 g_string_append(outputs_str, "<span color='#222288'>");
1080 g_string_append(outputs_str, SPLT_DEFAULT_TRIM_SILENCE_OUTPUT);
1081 g_string_append(outputs_str, "</span>");
1082
1083 g_string_append(outputs_str, "\n");
1084 g_string_append(outputs_str, _(" Error mode default: "));
1085 g_string_append(outputs_str, "<span color='#222288'>");
1086 g_string_append(outputs_str, SPLT_DEFAULT_SYNCERROR_OUTPUT);
1087 g_string_append(outputs_str, "</span>");
1088
1089 GtkWidget *default_label = gtk_label_new(NULL);
1090 gui->output_default_label = default_label;
1091 gtk_label_set_markup(GTK_LABEL(default_label), outputs_str->str);
1092 gtk_label_set_selectable(GTK_LABEL(default_label), TRUE);
1093 gtk_box_pack_start(GTK_BOX(horiz_fake), default_label, FALSE, FALSE, 0);
1094
1095 g_string_free(outputs_str, TRUE);
1096
1097 //second radio button
1098 radio_output = gtk_radio_button_new_with_label_from_widget
1099 (GTK_RADIO_BUTTON(radio_output), _("Custom format"));
1100 gui->radio_output = radio_output;
1101 gtk_box_pack_start(GTK_BOX(vbox), radio_output, FALSE, FALSE, 0);
1102
1103 //output entry
1104 horiz_fake = wh_hbox_new();
1105 gtk_box_pack_start(GTK_BOX(vbox), horiz_fake, FALSE, FALSE, 5);
1106
1107 GtkWidget *output_entry = gtk_entry_new();
1108 gui->output_entry = output_entry;
1109 gtk_editable_set_editable(GTK_EDITABLE(output_entry), TRUE);
1110 g_signal_connect(G_OBJECT(output_entry), "key_release_event", G_CALLBACK(output_entry_event), ui);
1111 gtk_entry_set_max_length(GTK_ENTRY(output_entry),244);
1112 gtk_box_pack_start(GTK_BOX(horiz_fake), output_entry, TRUE, TRUE, 0);
1113
1114 //output label
1115 horiz_fake = wh_hbox_new();
1116 gtk_box_pack_start(GTK_BOX(vbox), horiz_fake, FALSE, FALSE, 5);
1117 GtkWidget *output_label = gtk_label_new(_(
1118 " @A: performer if found, otherwise artist\n"
1119 " @a: artist name\n"
1120 " @p: performer of each song (only with .cue)\n"
1121 " @b: album title\n"
1122 " @g: genre\n"
1123 " @t: song title\n"
1124 " @n: track number identifier (not the real ID3 track number) **\n"
1125 " @N: track tag number **\n"
1126 " @l: track number identifier as lowercase letter (not the real ID3 track number) **\n"
1127 " @L: track tag number as lowercase letter **\n"
1128 " @u: track number identifier as uppercase letter (not the real ID3 track number) **\n"
1129 " @U: track tag number as uppercase letter **\n"
1130 " @f: input filename (without extension)\n"
1131 " @d: last directory of the input filename or the filename itself if no directory\n"
1132 " @m, @s or @h: the number of minutes, seconds or hundreths of seconds of the start splitpoint **\n"
1133 " @M, @S or @H: the number of minutes, seconds or hundreths of seconds of the end splitpoint **\n"
1134 "\n"
1135 " (**) a digit may follow for the number of digits to output\n"));
1136 gtk_label_set_selectable(GTK_LABEL(output_label), TRUE);
1137 gui->output_label = output_label;
1138 gtk_box_pack_start(GTK_BOX(horiz_fake), output_label, FALSE, FALSE, 0);
1139
1140 g_signal_connect(GTK_TOGGLE_BUTTON(gui->radio_output),
1141 "toggled", G_CALLBACK(output_radio_box_event), ui);
1142
1143 return wh_set_title_and_get_vbox(vbox,
1144 _("<b>Output format for batch split and when importing splitpoints</b>"));
1145}
1146
1148static GtkWidget *create_pref_output_page(ui_state *ui)
1149{
1150 GtkWidget *output_hbox = wh_hbox_new();;
1151 GtkWidget *output_inside_hbox = wh_hbox_new();;
1152
1153 GtkWidget *scrolled_window = wh_create_scrolled_window();
1154 wh_add_box_to_scrolled_window(output_inside_hbox, scrolled_window);
1155 gtk_box_pack_start(GTK_BOX(output_hbox), scrolled_window, TRUE, TRUE, 0);
1156
1157 GtkWidget *vbox = wh_vbox_new();;
1158 gtk_box_pack_start(GTK_BOX(output_inside_hbox), vbox, TRUE, TRUE, 5);
1159
1160 GtkWidget *output_fname_box = create_output_filename_box(ui);
1161 gtk_box_pack_start(GTK_BOX(vbox), output_fname_box, FALSE, FALSE, 2);
1162
1163 return output_hbox;
1164}
1165
1166static void change_tags_options(GtkToggleButton *button, gpointer data)
1167{
1168 ui_state *ui = (ui_state *)data;
1169
1170 if (ui->gui->extract_tags_box != NULL)
1171 {
1172 if (rh_get_active_value(ui->gui->tags_radio) == TAGS_FROM_FILENAME)
1173 {
1174 gtk_widget_set_sensitive(ui->gui->extract_tags_box, SPLT_TRUE);
1175 }
1176 else
1177 {
1178 gtk_widget_set_sensitive(ui->gui->extract_tags_box, SPLT_FALSE);
1179 }
1180 }
1181
1182 ui_save_preferences(NULL, ui);
1183}
1184
1186static GtkWidget *create_tags_options_box(ui_state *ui)
1187{
1188 gui_state *gui = ui->gui;
1189
1190 GtkWidget *vbox = wh_vbox_new();
1191
1192 GtkWidget *tags_radio = NULL;
1193 tags_radio = rh_append_radio_to_vbox(tags_radio, _("Original file tags"),
1194 ORIGINAL_FILE_TAGS, change_tags_options, ui, vbox);
1195 gui->tags_radio = tags_radio;
1196 tags_radio = rh_append_radio_to_vbox(tags_radio, _("Custom tags (from the splitpoints table)"),
1197 DEFAULT_TAGS, change_tags_options, ui, vbox);
1198 gui->tags_radio = tags_radio;
1199 tags_radio = rh_append_radio_to_vbox(tags_radio, _("No tags"),
1200 NO_TAGS, change_tags_options, ui, vbox);
1201 gui->tags_radio = tags_radio;
1202 tags_radio = rh_append_radio_to_vbox(tags_radio, _("Extract tags from filename"),
1203 TAGS_FROM_FILENAME, change_tags_options, ui, vbox);
1204 gui->tags_radio = tags_radio;
1205
1206 GtkWidget *extract_tags_box = create_extract_tags_from_filename_options_box(ui);
1207 gui->extract_tags_box = extract_tags_box;
1208 gtk_widget_set_sensitive(extract_tags_box, SPLT_FALSE);
1209 gtk_box_pack_start(GTK_BOX(vbox), extract_tags_box, FALSE, FALSE, 2);
1210
1211 return wh_set_title_and_get_vbox(vbox, _("<b>Split files tags</b>"));
1212}
1213
1214static GtkComboBox *create_genre_combo(ui_state *ui)
1215{
1216 GtkComboBox *combo = ch_new_combo();
1217
1218 int i = 0;
1219 for (i = 0;i < SPLT_ID3V1_NUMBER_OF_GENRES;i++)
1220 {
1221 ch_append_to_combo(combo, splt_id3v1_genres[i], 0);
1222 }
1223
1224 g_signal_connect(G_OBJECT(combo), "changed", G_CALLBACK(ui_save_preferences), ui);
1225
1226 return combo;
1227}
1228
1229static GtkComboBox *create_text_preferences_combo(ui_state *ui)
1230{
1231 GtkComboBox *combo = ch_new_combo();
1232
1233 ch_append_to_combo(combo, _("No change"), SPLT_NO_CONVERSION);
1234 ch_append_to_combo(combo, _("lowercase"), SPLT_TO_LOWERCASE);
1235 ch_append_to_combo(combo, _("UPPERCASE"), SPLT_TO_UPPERCASE);
1236 ch_append_to_combo(combo, _("First uppercase"), SPLT_TO_FIRST_UPPERCASE);
1237 ch_append_to_combo(combo, _("Word Uppercase"), SPLT_TO_WORD_FIRST_UPPERCASE);
1238
1239 g_signal_connect(G_OBJECT(combo), "changed", G_CALLBACK(ui_save_preferences), ui);
1240
1241 return combo;
1242}
1243
1244static gboolean test_regex_end(ui_with_fname *ui_fname)
1245{
1246 ui_state *ui = ui_fname->ui;
1247
1248 if (ui_fname->fname)
1249 {
1250 gtk_label_set_text(GTK_LABEL(ui->gui->sample_result_label), ui_fname->fname);
1251 g_free(ui_fname->fname);
1252 }
1253 else
1254 {
1255 gtk_label_set_text(GTK_LABEL(ui->gui->sample_result_label), "");
1256 }
1257
1258 g_free(ui_fname);
1259
1260 set_process_in_progress_and_wait_safe(FALSE, ui);
1261
1262 return FALSE;
1263}
1264
1265static gpointer test_regex_thread(ui_for_split *ui_fs)
1266{
1267 ui_state *ui = ui_fs->ui;
1268
1269 set_process_in_progress_and_wait_safe(TRUE, ui);
1270
1271 put_tags_from_filename_regex_options(ui_fs);
1272
1273 mp3splt_set_filename_to_split(ui->mp3splt_state, ui_fs->test_regex_filename);
1274
1275 splt_code error = SPLT_OK;
1276 splt_tags *tags = mp3splt_parse_filename_regex(ui->mp3splt_state, &error);
1277 print_status_bar_confirmation_in_idle(error, ui);
1278
1279 if (error < 0) { goto end; }
1280
1281 GString *regex_result = g_string_new(NULL);
1282
1283 g_string_append(regex_result, _("<artist>: "));
1284 char *artist = mp3splt_tags_get(tags, SPLT_TAGS_ARTIST);
1285 if (artist)
1286 {
1287 g_string_append(regex_result, artist);
1288 free(artist);
1289 }
1290 g_string_append(regex_result, "\n");
1291
1292 g_string_append(regex_result, _("<album>: "));
1293 char *album = mp3splt_tags_get(tags, SPLT_TAGS_ALBUM);
1294 if (album)
1295 {
1296 g_string_append(regex_result, album);
1297 free(album);
1298 }
1299 g_string_append(regex_result, "\n");
1300
1301
1302 g_string_append(regex_result, _("<title>: "));
1303 char *title = mp3splt_tags_get(tags, SPLT_TAGS_TITLE);
1304 if (title)
1305 {
1306 g_string_append(regex_result, title);
1307 free(title);
1308 }
1309 g_string_append(regex_result, "\n");
1310
1311 g_string_append(regex_result, _("<genre>: "));
1312 char *genre = mp3splt_tags_get(tags, SPLT_TAGS_GENRE);
1313 if (genre)
1314 {
1315 g_string_append(regex_result, genre);
1316 free(genre);
1317 }
1318 g_string_append(regex_result, "\n");
1319
1320 g_string_append(regex_result, _("<comment>: "));
1321 char *comment = mp3splt_tags_get(tags, SPLT_TAGS_COMMENT);
1322 if (comment)
1323 {
1324 g_string_append(regex_result, comment);
1325 free(comment);
1326 }
1327 g_string_append(regex_result, "\n");
1328
1329 g_string_append(regex_result, _("<year>: "));
1330 char *year = mp3splt_tags_get(tags, SPLT_TAGS_YEAR);
1331 if (year)
1332 {
1333 g_string_append(regex_result, year);
1334 free(year);
1335 }
1336 g_string_append(regex_result, "\n");
1337
1338 g_string_append(regex_result, _("<track>: "));
1339 gchar *track = mp3splt_tags_get(tags, SPLT_TAGS_TRACK);
1340 if (track)
1341 {
1342 g_string_append(regex_result, track);
1343 free(track);
1344 }
1345
1346end:
1347 mp3splt_free_one_tag(tags);
1348 free_ui_for_split(ui_fs);
1349
1350 ui_with_fname *ui_fname = g_malloc0(sizeof(ui_with_fname));
1351 ui_fname->ui = ui;
1352 ui_fname->fname = g_string_free(regex_result, FALSE);
1353
1354 add_idle(G_PRIORITY_HIGH_IDLE, (GSourceFunc)test_regex_end, ui_fname, NULL);
1355
1356 return NULL;
1357}
1358
1359static void test_regex_event(GtkWidget *widget, ui_state *ui)
1360{
1361 ui_for_split *ui_fs = build_ui_for_split(ui);
1362
1363 const gchar *test_regex_filename = gtk_entry_get_text(GTK_ENTRY(ui->gui->test_regex_fname_entry));
1364 if (test_regex_filename != NULL)
1365 {
1366 ui_fs->test_regex_filename = g_strdup(test_regex_filename);
1367 }
1368
1369 create_thread_and_unref((GThreadFunc)test_regex_thread, (gpointer) ui_fs, ui, "test_regex");
1370}
1371
1372static GtkWidget *create_extract_tags_from_filename_options_box(ui_state *ui)
1373{
1374 GtkWidget *table = wh_new_table();
1375
1376 GtkWidget *regex_entry = wh_new_entry(ui_save_preferences, ui);
1377 ui->gui->regex_entry = regex_entry;
1378 wh_add_in_table_with_label_expand(table, _("Regular expression:"), regex_entry);
1379
1380 GtkWidget *regex_label = gtk_label_new(_(
1381 "Above enter PERL-like regular expression using named subgroups.\nFollowing names are recognized:\n"
1382 " (?<artist>) - artist name\n"
1383 " (?<album>) - album title\n"
1384 " (?<title>) - track title\n"
1385 " (?<tracknum>) - current track number\n"
1386 //" (?<tracks>) - total number of tracks\n"
1387 " (?<year>) - year of emission\n"
1388 " (?<genre>) - genre\n"
1389 " (?<comment>) - comment"));
1390 gtk_label_set_selectable(GTK_LABEL(regex_label), TRUE);
1391 gtk_misc_set_alignment(GTK_MISC(regex_label), 0.0, 0.5);
1392 wh_add_in_table(table, wh_put_in_new_hbox_with_margin_level(regex_label, 2));
1393
1394 ui_infos *infos = ui->infos;
1395
1396 infos->text_options_list =
1397 g_list_append(infos->text_options_list, GINT_TO_POINTER(SPLT_NO_CONVERSION));
1398 infos->text_options_list =
1399 g_list_append(infos->text_options_list, GINT_TO_POINTER(SPLT_TO_LOWERCASE));
1400 infos->text_options_list =
1401 g_list_append(infos->text_options_list, GINT_TO_POINTER(SPLT_TO_UPPERCASE));
1402 infos->text_options_list =
1403 g_list_append(infos->text_options_list, GINT_TO_POINTER(SPLT_TO_FIRST_UPPERCASE));
1404 infos->text_options_list =
1405 g_list_append(infos->text_options_list, GINT_TO_POINTER(SPLT_TO_WORD_FIRST_UPPERCASE));
1406
1407 GtkWidget *replace_underscore_by_space_check_box =
1408 gtk_check_button_new_with_mnemonic(_("_Replace underscores by spaces"));
1409 ui->gui->replace_underscore_by_space_check_box = replace_underscore_by_space_check_box;
1410 g_signal_connect(G_OBJECT(replace_underscore_by_space_check_box), "toggled",
1411 G_CALLBACK(ui_save_preferences), ui);
1412
1413 wh_add_in_table(table, replace_underscore_by_space_check_box);
1414
1415 GtkComboBox *artist_text_properties_combo = create_text_preferences_combo(ui);
1416 ui->gui->artist_text_properties_combo = artist_text_properties_combo;
1417 wh_add_in_table_with_label(table,
1418 _("Artist text properties:"), GTK_WIDGET(artist_text_properties_combo));
1419
1420 GtkComboBox *album_text_properties_combo = create_text_preferences_combo(ui);
1421 ui->gui->album_text_properties_combo = album_text_properties_combo;
1422 wh_add_in_table_with_label(table,
1423 _("Album text properties:"), GTK_WIDGET(album_text_properties_combo));
1424
1425 GtkComboBox *title_text_properties_combo = create_text_preferences_combo(ui);
1426 ui->gui->title_text_properties_combo = title_text_properties_combo;
1427 wh_add_in_table_with_label(table,
1428 _("Title text properties:"), GTK_WIDGET(title_text_properties_combo));
1429
1430 GtkComboBox *comment_text_properties_combo = create_text_preferences_combo(ui);
1431 ui->gui->comment_text_properties_combo = comment_text_properties_combo;
1432 wh_add_in_table_with_label(table,
1433 _("Comment text properties:"), GTK_WIDGET(comment_text_properties_combo));
1434
1435 GtkComboBox *genre_combo = create_genre_combo(ui);
1436 ui->gui->genre_combo = genre_combo;
1437 wh_add_in_table_with_label(table, _("Genre tag:"), GTK_WIDGET(genre_combo));
1438
1439 GtkWidget *comment_tag_entry = wh_new_entry(ui_save_preferences, ui);
1440 ui->gui->comment_tag_entry = comment_tag_entry;
1441 wh_add_in_table_with_label_expand(table, _("Comment tag:"), comment_tag_entry);
1442
1443 GtkWidget *test_regex_expander = gtk_expander_new(_("Regular expression test"));
1444 gtk_container_add(GTK_CONTAINER(test_regex_expander), create_test_regex_table(ui));
1445 wh_add_in_table(table, test_regex_expander);
1446
1447 return wh_put_in_new_hbox_with_margin_level(GTK_WIDGET(table), 3);
1448}
1449
1450static GtkWidget *create_test_regex_table(ui_state *ui)
1451{
1452 GtkWidget *table = wh_new_table();
1453
1454 GtkWidget *sample_test_hbox = wh_hbox_new();
1455 GtkWidget *test_regex_fname_entry = wh_new_entry(ui_save_preferences, ui);
1456 ui->gui->test_regex_fname_entry = test_regex_fname_entry;
1457 gtk_box_pack_start(GTK_BOX(sample_test_hbox), test_regex_fname_entry, TRUE, TRUE, 0);
1458
1459 GtkWidget *test_regex_button = wh_new_button(_("_Test"));
1460 gtk_box_pack_start(GTK_BOX(sample_test_hbox), test_regex_button, FALSE, FALSE, 5);
1461 g_signal_connect(G_OBJECT(test_regex_button), "clicked", G_CALLBACK(test_regex_event), ui);
1462
1463 wh_add_in_table_with_label_expand(table, _("Sample filename:"), sample_test_hbox);
1464
1465 GtkWidget *sample_result_label = gtk_label_new("");
1466 ui->gui->sample_result_label = sample_result_label;
1467 gtk_misc_set_alignment(GTK_MISC(ui->gui->sample_result_label), 0.0, 0.5);
1468 wh_add_in_table_with_label_expand(table, _("Sample result:"), ui->gui->sample_result_label);
1469
1470 return wh_put_in_new_hbox_with_margin_level(GTK_WIDGET(table), 3);
1471}
1472
1474static GtkWidget *create_tags_version_box(ui_state *ui)
1475{
1476 gui_state *gui = ui->gui;
1477
1478 GtkWidget *vbox = wh_vbox_new();
1479
1480 GtkWidget *tags_version_radio = gtk_radio_button_new_with_label(NULL, _("ID3v1 & ID3v2 tags"));
1481 gui->tags_version_radio = tags_version_radio;
1482 gtk_box_pack_start(GTK_BOX(vbox), tags_version_radio, FALSE, FALSE, 0);
1483 g_signal_connect(GTK_TOGGLE_BUTTON(tags_version_radio), "toggled",
1484 G_CALLBACK(ui_save_preferences), ui);
1485
1486 tags_version_radio = gtk_radio_button_new_with_label_from_widget
1487 (GTK_RADIO_BUTTON(tags_version_radio), _("ID3v2 tags"));
1488 gui->tags_version_radio = tags_version_radio;
1489 gtk_box_pack_start(GTK_BOX(vbox), tags_version_radio, FALSE, FALSE, 0);
1490 g_signal_connect(GTK_TOGGLE_BUTTON(tags_version_radio), "toggled",
1491 G_CALLBACK(ui_save_preferences), ui);
1492
1493 tags_version_radio = gtk_radio_button_new_with_label_from_widget
1494 (GTK_RADIO_BUTTON(tags_version_radio), _("ID3v1 tags"));
1495 gui->tags_version_radio = tags_version_radio;
1496 g_signal_connect(GTK_TOGGLE_BUTTON(tags_version_radio), "toggled",
1497 G_CALLBACK(ui_save_preferences), ui);
1498 gtk_box_pack_start(GTK_BOX(vbox), tags_version_radio, FALSE, FALSE, 0);
1499
1500 tags_version_radio = gtk_radio_button_new_with_label_from_widget
1501 (GTK_RADIO_BUTTON (tags_version_radio),_("Same tags version as the input file"));
1502 gui->tags_version_radio = tags_version_radio;
1503 g_signal_connect(GTK_TOGGLE_BUTTON(tags_version_radio), "toggled",
1504 G_CALLBACK(ui_save_preferences), ui);
1505 gtk_box_pack_start(GTK_BOX(vbox), tags_version_radio, FALSE, FALSE, 0);
1506
1507 return wh_set_title_and_get_vbox(vbox, _("<b>Tags version (mp3 only)</b>"));
1508}
1509
1511static GtkWidget *create_pref_tags_page(ui_state *ui)
1512{
1513 GtkWidget *outside_vbox = wh_vbox_new();;
1514 GtkWidget *inside_hbox = wh_hbox_new();
1515
1516 GtkWidget *scrolled_window = wh_create_scrolled_window();
1517 wh_add_box_to_scrolled_window(inside_hbox, scrolled_window);
1518 gtk_box_pack_start(GTK_BOX(outside_vbox), scrolled_window, TRUE, TRUE, 0);
1519
1520 GtkWidget *vbox = wh_vbox_new();;
1521 gtk_box_pack_start(GTK_BOX(inside_hbox), vbox, TRUE, TRUE, 5);
1522
1523 GtkWidget *tags_version_box = create_tags_version_box(ui);
1524 gtk_box_pack_start(GTK_BOX(vbox), tags_version_box, FALSE, FALSE, 2);
1525
1526 GtkWidget *tags_opts_box = create_tags_options_box(ui);
1527 gtk_box_pack_start(GTK_BOX(vbox), tags_opts_box, FALSE, FALSE, 1);
1528
1529 return outside_vbox;
1530}
1531
1534{
1535 GtkWidget *pref_vbox = wh_vbox_new();
1536
1537 GtkWidget *notebook = gtk_notebook_new();
1538 gtk_box_pack_start(GTK_BOX(pref_vbox), notebook, TRUE, TRUE, 0);
1539
1540 gtk_notebook_popup_enable(GTK_NOTEBOOK(notebook));
1541 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), TRUE);
1542 gtk_notebook_set_show_border(GTK_NOTEBOOK(notebook), FALSE);
1543 gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), TRUE);
1544
1545 /* split preferences */
1546 GtkWidget *splitpoints_prefs = create_pref_splitpoints_page(ui);
1547 GtkWidget *notebook_label = gtk_label_new(_("Split"));
1548 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), splitpoints_prefs, notebook_label);
1549
1550 /* tags preferences */
1551 GtkWidget *tags_prefs = create_pref_tags_page(ui);
1552 notebook_label = gtk_label_new(_("Tags"));
1553 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tags_prefs, notebook_label);
1554
1555 /* player preferences */
1556 GtkWidget *player_prefs = create_pref_player_page(ui);
1557 notebook_label = gtk_label_new(_("Player"));
1558 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), player_prefs, notebook_label);
1559
1560 /* output preferences */
1561 GtkWidget *output_prefs = create_pref_output_page(ui);
1562 notebook_label = gtk_label_new(_("Output format"));
1563 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), output_prefs, notebook_label);
1564
1565 /* language preferences page */
1566#ifdef __WIN32__
1567 GtkWidget *language_prefs = create_pref_language_page(ui);
1568 notebook_label = gtk_label_new(_("Language"));
1569 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), language_prefs, notebook_label);
1570#endif
1571
1572 return pref_vbox;
1573}
1574
void remove_status_message(gui_state *gui)
Removes status bar message.
gchar * get_input_filename(gui_state *gui)
Get the name of the input file.
Definition main_window.c:73
gfloat get_left_drawing_time(gfloat current_time, gfloat total_time, gfloat zoom_coeff)
returns the value of the left drawing area
void show_connect_button(gui_state *gui)
Show the connect button.
gfloat get_right_drawing_time(gfloat current_time, gfloat total_time, gfloat zoom_coeff)
returns the value of the right drawing area
void disconnect_button_event(GtkWidget *widget, ui_state *ui)
disconnect button event
void hide_connect_button(gui_state *gui)
Hide the connect button.
gint draw_silence_wave(gint left_mark, gint right_mark, gint interpolation_text_x, gint interpolation_text_y, gfloat draw_time, gint width_drawing_area, gint y_margin, gfloat current_time, gfloat total_time, gfloat zoom_coeff, GtkWidget *da, cairo_t *gc, ui_state *ui)
Draws the silence wave.
gchar * get_output_directory(ui_state *ui)
Get the name of the output directory.
GString * get_checked_language(ui_state *ui)
Returns the selected language.
GtkWidget * create_choose_preferences(ui_state *ui)
creates the preferences tab
gboolean get_checked_output_radio_box(ui_state *ui)
returns the checked output radio box
gint get_checked_tags_version_radio_box(gui_state *gui)
returns the checked tags radio box
GtkWidget * wh_set_title_and_get_vbox(GtkWidget *widget, const gchar *title)
Generates a window portion containing a caption and a vbox.
GtkWidget * wh_create_scrolled_window()
creates a scrolled window