mp3splt-gtk: src/split_mode_window.c Source File

mp3splt-gtk 0.9.3.1519

Loading...
Searching...
No Matches
split_mode_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 batch processing tab
35 *
36 * this file is for the special split tab, where automatic
37 * split modes can be selected
38 *..*******************************************************/
39
40#include "split_mode_window.h"
41#include "ui_types.h"
42
44static gint get_selected_split_mode_(GtkToggleButton *radio_b)
45{
46 GSList *radio_button_list = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio_b));
47
48 guint i = 0;
49 for(i = 0; i < NUMBER_OF_SPLIT_MODES;i++)
50 {
51 GtkToggleButton *test = (GtkToggleButton *) g_slist_nth_data(radio_button_list,i);
52 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(test)))
53 {
54 return GPOINTER_TO_INT(g_object_get_data(G_OBJECT(test), "split_type_id"));
55 }
56 }
57
58 return SELECTED_SPLIT_NORMAL;
59}
60
62 void select_split_mode(int split_mode, ui_state *ui)
63{
64 GSList *split_mode_radio_button_list =
65 gtk_radio_button_get_group(GTK_RADIO_BUTTON(ui->gui->split_mode_radio_button));
66
67 guint i = 0;
68 for(i = 0; i < NUMBER_OF_SPLIT_MODES;i++)
69 {
70 GtkToggleButton *test = (GtkToggleButton *) g_slist_nth_data(split_mode_radio_button_list, i);
71 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(test), "split_type_id"));
72 if (split_mode == id)
73 {
74 gtk_toggle_button_set_active(test, TRUE);
75 return;
76 }
77 }
78}
79
80gint get_selected_split_mode(ui_state *ui)
81{
82 return ui->status->selected_split_mode;
83}
84
85void set_selected_split_mode(gint value, ui_state *ui)
86{
87 ui->status->selected_split_mode = value;
88}
89
90static void deactivate_silence_parameters(gui_state *gui)
91{
92 gtk_widget_set_sensitive(gui->all_spinner_silence_number_tracks, FALSE);
93 gtk_widget_set_sensitive(gui->all_spinner_silence_minimum, FALSE);
94 gtk_widget_set_sensitive(gui->all_spinner_track_minimum, FALSE);
95 gtk_widget_set_sensitive(gui->all_spinner_silence_offset, FALSE);
96 gtk_widget_set_sensitive(gui->all_spinner_silence_threshold, FALSE);
97 gtk_widget_set_sensitive(gui->all_spinner_silence_shots, FALSE);
98 gtk_widget_set_sensitive(gui->all_silence_remove_silence, FALSE);
99 gtk_widget_set_sensitive(gui->all_threshold_label, FALSE);
100 gtk_widget_set_sensitive(gui->all_shots_label, FALSE);
101 gtk_widget_set_sensitive(gui->all_offset_label, FALSE);
102 gtk_widget_set_sensitive(gui->all_number_of_tracks_label, FALSE);
103 gtk_widget_set_sensitive(gui->all_min_silence_label, FALSE);
104 gtk_widget_set_sensitive(gui->all_min_track_label, FALSE);
105}
106
107static void activate_silence_parameters(gui_state *gui)
108{
109 gtk_widget_set_sensitive(gui->all_spinner_silence_number_tracks, TRUE);
110 gtk_widget_set_sensitive(gui->all_spinner_silence_minimum, TRUE);
111 gtk_widget_set_sensitive(gui->all_spinner_track_minimum, TRUE);
112 gtk_widget_set_sensitive(gui->all_spinner_silence_offset, TRUE);
113 gtk_widget_set_sensitive(gui->all_spinner_silence_threshold, TRUE);
114 gtk_widget_set_sensitive(gui->all_spinner_silence_shots, TRUE);
115 gtk_widget_set_sensitive(gui->all_silence_remove_silence, TRUE);
116 gtk_widget_set_sensitive(gui->all_threshold_label, TRUE);
117 gtk_widget_set_sensitive(gui->all_shots_label, TRUE);
118 gtk_widget_set_sensitive(gui->all_offset_label, TRUE);
119 gtk_widget_set_sensitive(gui->all_number_of_tracks_label, TRUE);
120 gtk_widget_set_sensitive(gui->all_min_silence_label, TRUE);
121 gtk_widget_set_sensitive(gui->all_min_track_label, TRUE);
122}
123
124static void deactivate_trim_parameters(gui_state *gui)
125{
126 gtk_widget_set_sensitive(gui->all_spinner_trim_silence_threshold, FALSE);
127 gtk_widget_set_sensitive(gui->all_trim_threshold_label, FALSE);
128}
129
130static void activate_trim_parameters(gui_state *gui)
131{
132 gtk_widget_set_sensitive(gui->all_spinner_trim_silence_threshold, TRUE);
133 gtk_widget_set_sensitive(gui->all_trim_threshold_label, TRUE);
134}
135
137static void split_mode_changed(GtkToggleButton *radio_b, ui_state *ui)
138{
139 gint selected_split_mode = get_selected_split_mode_(radio_b);
140 set_selected_split_mode(selected_split_mode, ui);
141
142 int enable_time = (selected_split_mode == SELECTED_SPLIT_TIME);
143 gtk_widget_set_sensitive(ui->gui->spinner_time, enable_time);
144 gtk_widget_set_sensitive(ui->gui->time_label, enable_time);
145 gtk_widget_set_sensitive(ui->gui->time_label_after, enable_time);
146
147 int enable_split_equal_time = (selected_split_mode == SELECTED_SPLIT_EQUAL_TIME_TRACKS);
148 gtk_widget_set_sensitive(ui->gui->spinner_equal_tracks, enable_split_equal_time);
149 gtk_widget_set_sensitive(ui->gui->equal_tracks_label, enable_split_equal_time);
150 gtk_widget_set_sensitive(ui->gui->equal_tracks_label_after, enable_split_equal_time);
151
152 if (selected_split_mode == SELECTED_SPLIT_SILENCE)
153 {
154 activate_silence_parameters(ui->gui);
155 }
156 else
157 {
158 deactivate_silence_parameters(ui->gui);
159 }
160
161 if (selected_split_mode == SELECTED_SPLIT_TRIM_SILENCE)
162 {
163 activate_trim_parameters(ui->gui);
164 }
165 else
166 {
167 deactivate_trim_parameters(ui->gui);
168 }
169
170 ui_save_preferences(NULL, ui);
171}
172
174static void spinner_time_changed(GtkSpinButton *spinner, ui_state *ui)
175{
176 ui_save_preferences(NULL, ui);
177}
178
180static void spinner_equal_tracks_changed(GtkSpinButton *spinner, ui_state *ui)
181{
182 ui_save_preferences(NULL, ui);
183}
184
186static GtkWidget *create_split_mode(ui_state *ui)
187{
188 GtkWidget *local_vbox = wh_vbox_new();
189 gtk_container_set_border_width(GTK_CONTAINER(local_vbox), 3);
190
191 //normal split
192 GtkWidget *split_mode_radio_button =
193 gtk_radio_button_new_with_label(NULL, _("Use manual single file splitpoints"));
194 gtk_widget_set_tooltip_text(split_mode_radio_button,
195 _("Split files using the manually defined splitpoints"));
196 ui->gui->split_mode_radio_button = split_mode_radio_button;
197 gtk_box_pack_start(GTK_BOX(local_vbox), split_mode_radio_button, FALSE, FALSE, 2);
198 g_signal_connect(GTK_TOGGLE_BUTTON(split_mode_radio_button),
199 "toggled", G_CALLBACK(split_mode_changed), ui);
200 g_object_set_data(G_OBJECT(split_mode_radio_button), "split_type_id",
201 GINT_TO_POINTER(SELECTED_SPLIT_NORMAL));
202
203 //time split
204 split_mode_radio_button = gtk_radio_button_new_with_label_from_widget
205 (GTK_RADIO_BUTTON(split_mode_radio_button), _("Time"));
206 gtk_widget_set_tooltip_text(split_mode_radio_button,
207 _("Split every fixed time length; last track will most likely be smaller"));
208 ui->gui->split_mode_radio_button = split_mode_radio_button;
209 gtk_box_pack_start(GTK_BOX(local_vbox), split_mode_radio_button, FALSE, FALSE, 2);
210 g_signal_connect(GTK_TOGGLE_BUTTON(split_mode_radio_button), "toggled",
211 G_CALLBACK(split_mode_changed), ui);
212 g_object_set_data(G_OBJECT(split_mode_radio_button), "split_type_id",
213 GINT_TO_POINTER(SELECTED_SPLIT_TIME));
214
215 //
216 GtkWidget *big_horiz_fake = wh_hbox_new();
217 gtk_box_pack_start(GTK_BOX(local_vbox), big_horiz_fake, FALSE, FALSE, 0);
218
219 GtkWidget *horiz_fake = wh_hbox_new();
220 gtk_box_pack_start(GTK_BOX(big_horiz_fake), horiz_fake, FALSE, FALSE, 25);
221
222 gint default_time = 60;
223
224 GtkWidget *time_label = gtk_label_new(_("Split every"));
225 ui->gui->time_label = time_label;
226 gtk_box_pack_start(GTK_BOX(horiz_fake), time_label, FALSE, FALSE, 0);
227
228 GtkAdjustment *adj = gtk_adjustment_new(0.0, 1, INT_MAX/6000, 1.0, 10.0, 0.0);
229 GtkWidget *spinner_time = gtk_spin_button_new(adj, 1, 0);
230 ui->gui->spinner_time = spinner_time;
231 gtk_box_pack_start(GTK_BOX(horiz_fake), spinner_time, FALSE, FALSE, 6);
232 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinner_time), default_time);
233 gtk_widget_set_sensitive(GTK_WIDGET(spinner_time), FALSE);
234 gtk_widget_set_sensitive(time_label, FALSE);
235 g_signal_connect(G_OBJECT(spinner_time), "value-changed", G_CALLBACK(spinner_time_changed), ui);
236
237 GtkWidget *time_label_after = gtk_label_new(_("seconds."));
238 ui->gui->time_label_after = time_label_after;
239 gtk_box_pack_start(GTK_BOX(horiz_fake), time_label_after, FALSE, FALSE, 0);
240 gtk_widget_set_sensitive(time_label_after, FALSE);
241
242 //split in equal length
243 split_mode_radio_button = gtk_radio_button_new_with_label_from_widget
244 (GTK_RADIO_BUTTON(split_mode_radio_button), _("Equal time tracks"));
245 gtk_widget_set_tooltip_text(split_mode_radio_button,
246 _("Create smaller tracks having exactly the same time length"));
247 ui->gui->split_mode_radio_button = split_mode_radio_button;
248 gtk_box_pack_start(GTK_BOX(local_vbox), split_mode_radio_button, FALSE, FALSE, 2);
249 g_signal_connect(GTK_TOGGLE_BUTTON(split_mode_radio_button), "toggled",
250 G_CALLBACK(split_mode_changed), ui);
251 g_object_set_data(G_OBJECT(split_mode_radio_button), "split_type_id",
252 GINT_TO_POINTER(SELECTED_SPLIT_EQUAL_TIME_TRACKS));
253
254 //
255 big_horiz_fake = wh_hbox_new();
256 gtk_box_pack_start(GTK_BOX(local_vbox), big_horiz_fake, FALSE, FALSE, 0);
257
258 horiz_fake = wh_hbox_new();
259 gtk_box_pack_start(GTK_BOX(big_horiz_fake), horiz_fake, FALSE, FALSE, 25);
260
261 GtkWidget *equal_tracks_label = gtk_label_new(_("Split in"));
262 ui->gui->equal_tracks_label = equal_tracks_label;
263 gtk_box_pack_start(GTK_BOX(horiz_fake), equal_tracks_label, FALSE, FALSE, 0);
264
265 adj = gtk_adjustment_new(0.0, 1, INT_MAX/6000, 1.0, 10.0, 0.0);
266 GtkWidget *spinner_equal_tracks = gtk_spin_button_new(adj, 1, 0);
267 ui->gui->spinner_equal_tracks = spinner_equal_tracks;
268 gtk_box_pack_start(GTK_BOX(horiz_fake), spinner_equal_tracks, FALSE, FALSE, 6);
269 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinner_equal_tracks), default_time);
270 gtk_widget_set_sensitive(GTK_WIDGET(spinner_equal_tracks), FALSE);
271 gtk_widget_set_sensitive(equal_tracks_label, FALSE);
272 g_signal_connect(G_OBJECT(spinner_equal_tracks), "value-changed",
273 G_CALLBACK(spinner_equal_tracks_changed), ui);
274
275 GtkWidget *equal_tracks_label_after = gtk_label_new(_("equal tracks."));
276 ui->gui->equal_tracks_label_after = equal_tracks_label_after;
277 gtk_box_pack_start(GTK_BOX(horiz_fake), equal_tracks_label_after, FALSE, FALSE, 0);
278 gtk_widget_set_sensitive(equal_tracks_label_after, FALSE);
279
280 //trim using silence detection
281 split_mode_radio_button = gtk_radio_button_new_with_label_from_widget
282 (GTK_RADIO_BUTTON(split_mode_radio_button), _("Trim using silence detection"));
283 gtk_widget_set_tooltip_text(split_mode_radio_button,
284 _("Split by discarding silence from the begin and from the end\n"
285 "If no silence is found, the output file is still created"));
286 ui->gui->split_mode_radio_button = split_mode_radio_button;
287 gtk_box_pack_start(GTK_BOX(local_vbox), split_mode_radio_button, FALSE, FALSE, 2);
288 g_signal_connect(GTK_TOGGLE_BUTTON(split_mode_radio_button), "toggled",
289 G_CALLBACK(split_mode_changed), ui);
290 g_object_set_data(G_OBJECT(split_mode_radio_button), "split_type_id",
291 GINT_TO_POINTER(SELECTED_SPLIT_TRIM_SILENCE));
292
293 horiz_fake = wh_hbox_new();
294 gtk_box_pack_start(GTK_BOX(local_vbox), horiz_fake, FALSE, FALSE, 0);
295
296 GtkWidget *param_vbox = wh_vbox_new();
297 gtk_box_pack_start(GTK_BOX(horiz_fake), param_vbox, FALSE, FALSE, 25);
298
299 horiz_fake = wh_hbox_new();
300 gtk_box_pack_start(GTK_BOX(param_vbox), horiz_fake, FALSE, FALSE, 0);
301
302 GtkWidget *all_trim_threshold_label = gtk_label_new(_("Threshold level (dB) : "));
303 ui->gui->all_trim_threshold_label = all_trim_threshold_label;
304 gtk_box_pack_start(GTK_BOX(horiz_fake), all_trim_threshold_label, FALSE, FALSE, 0);
305
306 adj = gtk_adjustment_new(0.0, -96.0, 0.0, 0.5, 10.0, 0.0);
307 GtkWidget *all_spinner_trim_silence_threshold = gtk_spin_button_new(adj, 0.5, 2);
308 ui->gui->all_spinner_trim_silence_threshold = all_spinner_trim_silence_threshold;
309 gtk_box_pack_start(GTK_BOX(horiz_fake), all_spinner_trim_silence_threshold, FALSE, FALSE, 0);
310
311 //silence split
312 split_mode_radio_button = gtk_radio_button_new_with_label_from_widget
313 (GTK_RADIO_BUTTON(split_mode_radio_button), _("Silence - split with silence detection"));
314 gtk_widget_set_tooltip_text(split_mode_radio_button, _("Split where silence is found"));
315 ui->gui->split_mode_radio_button = split_mode_radio_button;
316 gtk_box_pack_start(GTK_BOX(local_vbox), split_mode_radio_button, FALSE, FALSE, 2);
317 g_signal_connect(GTK_TOGGLE_BUTTON(split_mode_radio_button), "toggled",
318 G_CALLBACK(split_mode_changed), ui);
319 g_object_set_data(G_OBJECT(split_mode_radio_button), "split_type_id",
320 GINT_TO_POINTER(SELECTED_SPLIT_SILENCE));
321
322 horiz_fake = wh_hbox_new();
323 gtk_box_pack_start(GTK_BOX(local_vbox), horiz_fake, FALSE, FALSE, 0);
324
325 param_vbox = wh_vbox_new();
326 gtk_box_pack_start(GTK_BOX(horiz_fake), param_vbox, FALSE, FALSE, 25);
327
328 horiz_fake = wh_hbox_new();
329 gtk_box_pack_start(GTK_BOX(param_vbox), horiz_fake, FALSE, FALSE, 0);
330
331 GtkWidget *all_threshold_label = gtk_label_new(_("Threshold level (dB) : "));
332 ui->gui->all_threshold_label = all_threshold_label;
333 gtk_box_pack_start(GTK_BOX(horiz_fake), all_threshold_label, FALSE, FALSE, 0);
334
335 adj = gtk_adjustment_new(0.0, -96.0, 0.0, 0.5, 10.0, 0.0);
336 GtkWidget *all_spinner_silence_threshold = gtk_spin_button_new(adj, 0.5, 2);
337 ui->gui->all_spinner_silence_threshold = all_spinner_silence_threshold;
338 gtk_box_pack_start(GTK_BOX(horiz_fake), all_spinner_silence_threshold, FALSE, FALSE, 0);
339
340 //shots
341 horiz_fake = wh_hbox_new();
342 gtk_box_pack_start(GTK_BOX(param_vbox), horiz_fake, FALSE, FALSE, 0);
343
344 GtkWidget *all_shots_label = gtk_label_new(_("Shots as non silence after silence: "));
345 ui->gui->all_shots_label = all_shots_label;
346 gtk_box_pack_start(GTK_BOX(horiz_fake), all_shots_label, FALSE, FALSE, 0);
347
348 adj = gtk_adjustment_new(25.0, 0.0, 500.0, 1.0, 10.0, 0.0);
349 GtkWidget *all_spinner_silence_shots = gtk_spin_button_new(adj, 1.0, 0);
350 ui->gui->all_spinner_silence_shots = all_spinner_silence_shots;
351 gtk_box_pack_start(GTK_BOX(horiz_fake), all_spinner_silence_shots, FALSE, FALSE, 0);
352
353 //cutpoint offset
354 horiz_fake = wh_hbox_new();
355 gtk_box_pack_start(GTK_BOX(param_vbox), horiz_fake, FALSE, FALSE, 0);
356
357 GtkWidget *all_offset_label = gtk_label_new(_("Cutpoint offset (0 is the begin of silence,and 1 the end) : "));
358 ui->gui->all_offset_label = all_offset_label;
359 gtk_box_pack_start(GTK_BOX(horiz_fake), all_offset_label, FALSE, FALSE, 0);
360
361 adj = gtk_adjustment_new(0.0, -2, 2, 0.05, 10.0, 0.0);
362 GtkWidget *all_spinner_silence_offset = gtk_spin_button_new(adj, 0.05, 2);
363 ui->gui->all_spinner_silence_offset = all_spinner_silence_offset;
364 gtk_box_pack_start(GTK_BOX(horiz_fake), all_spinner_silence_offset, FALSE, FALSE, 0);
365
366 horiz_fake = wh_hbox_new();
367 gtk_box_pack_start(GTK_BOX(param_vbox), horiz_fake, FALSE, FALSE, 0);
368
369 GtkWidget *all_number_of_tracks_label = gtk_label_new(_("Number of tracks (0 means all tracks) : "));
370 ui->gui->all_number_of_tracks_label = all_number_of_tracks_label;
371 gtk_box_pack_start(GTK_BOX(horiz_fake), all_number_of_tracks_label, FALSE, FALSE, 0);
372
373 adj = gtk_adjustment_new(0.0, 0, INT_MAX/6000, 1, 10.0, 0.0);
374 GtkWidget *all_spinner_silence_number_tracks = gtk_spin_button_new(adj, 1, 0);
375 ui->gui->all_spinner_silence_number_tracks = all_spinner_silence_number_tracks;
376 gtk_box_pack_start(GTK_BOX(horiz_fake), all_spinner_silence_number_tracks, FALSE, FALSE, 0);
377
378 horiz_fake = wh_hbox_new();
379 gtk_box_pack_start(GTK_BOX(param_vbox), horiz_fake, FALSE, FALSE, 0);
380
381 GtkWidget *all_min_silence_label = gtk_label_new(_("Minimum silence length (seconds) : "));
382 ui->gui->all_min_silence_label = all_min_silence_label;
383 gtk_box_pack_start(GTK_BOX(horiz_fake), all_min_silence_label, FALSE, FALSE, 0);
384
385 adj = gtk_adjustment_new(0.0, 0, INT_MAX/6000, 0.5, 10.0, 0.0);
386 GtkWidget *all_spinner_silence_minimum = gtk_spin_button_new(adj, 1, 2);
387 ui->gui->all_spinner_silence_minimum = all_spinner_silence_minimum;
388 gtk_box_pack_start(GTK_BOX(horiz_fake), all_spinner_silence_minimum, FALSE, FALSE, 0);
389
390 horiz_fake = wh_hbox_new();
391 gtk_box_pack_start(GTK_BOX(param_vbox), horiz_fake, FALSE, FALSE, 0);
392
393 GtkWidget *all_min_track_label = gtk_label_new(_("Minimum track length (seconds) : "));
394 ui->gui->all_min_track_label = all_min_track_label;
395 gtk_box_pack_start(GTK_BOX(horiz_fake), all_min_track_label, FALSE, FALSE, 0);
396
397 adj = gtk_adjustment_new(0.0, 0, INT_MAX/6000, 0.5, 10.0, 0.0);
398 GtkWidget *all_spinner_track_minimum = gtk_spin_button_new(adj, 1, 2);
399 ui->gui->all_spinner_track_minimum = all_spinner_track_minimum;
400 gtk_box_pack_start(GTK_BOX(horiz_fake), all_spinner_track_minimum, FALSE, FALSE, 0);
401
402 GtkWidget *all_silence_remove_silence =
403 gtk_check_button_new_with_label(_("Remove silence between tracks"));
404 ui->gui->all_silence_remove_silence = all_silence_remove_silence;
405 gtk_box_pack_start(GTK_BOX(param_vbox), all_silence_remove_silence, FALSE, FALSE, 0);
406
407 gtk_spin_button_set_value(GTK_SPIN_BUTTON(all_spinner_silence_number_tracks),
408 SPLT_DEFAULT_PARAM_TRACKS);
409 gtk_spin_button_set_value(GTK_SPIN_BUTTON(all_spinner_silence_minimum),
410 SPLT_DEFAULT_PARAM_MINIMUM_LENGTH);
411 gtk_spin_button_set_value(GTK_SPIN_BUTTON(all_spinner_silence_offset),
412 SPLT_DEFAULT_PARAM_OFFSET);
413 gtk_spin_button_set_value(GTK_SPIN_BUTTON(all_spinner_silence_threshold),
414 SPLT_DEFAULT_PARAM_THRESHOLD);
415 gtk_spin_button_set_value(GTK_SPIN_BUTTON(all_spinner_trim_silence_threshold),
416 SPLT_DEFAULT_PARAM_THRESHOLD);
417
418 deactivate_silence_parameters(ui->gui);
419 deactivate_trim_parameters(ui->gui);
420
421 //wrap split
422 split_mode_radio_button = gtk_radio_button_new_with_label_from_widget
423 (GTK_RADIO_BUTTON(split_mode_radio_button),
424 _("Wrap - split files created with mp3wrap or albumwrap (mp3 only)"));
425 ui->gui->split_mode_radio_button = split_mode_radio_button;
426 gtk_box_pack_start(GTK_BOX(local_vbox), split_mode_radio_button, FALSE, FALSE, 2);
427 g_signal_connect(GTK_TOGGLE_BUTTON(split_mode_radio_button), "toggled",
428 G_CALLBACK(split_mode_changed), ui);
429 g_object_set_data(G_OBJECT(split_mode_radio_button), "split_type_id",
430 GINT_TO_POINTER(SELECTED_SPLIT_WRAP));
431
432 //error mode split
433 split_mode_radio_button = gtk_radio_button_new_with_label_from_widget
434 (GTK_RADIO_BUTTON(split_mode_radio_button), _("Synchronisation error mode (mp3 only)"));
435 gtk_widget_set_tooltip_text(split_mode_radio_button,
436 _("Split where synchronisation errors are found\n"
437 "Useful for splitting concatenated files"));
438 ui->gui->split_mode_radio_button = split_mode_radio_button;
439 gtk_box_pack_start(GTK_BOX(local_vbox), split_mode_radio_button, FALSE, FALSE, 2);
440 g_signal_connect(GTK_TOGGLE_BUTTON(split_mode_radio_button), "toggled",
441 G_CALLBACK(split_mode_changed), ui);
442 g_object_set_data(G_OBJECT(split_mode_radio_button), "split_type_id",
443 GINT_TO_POINTER(SELECTED_SPLIT_ERROR));
444
445 //internal sheet mode split
446 split_mode_radio_button = gtk_radio_button_new_with_label_from_widget
447 (GTK_RADIO_BUTTON(split_mode_radio_button), _("Internal sheet mode (CUE sheet for FLAC and ID3v2 chapters for MP3)"));
448 gtk_widget_set_tooltip_text(split_mode_radio_button, _("Split using internal sheet"));
449 ui->gui->split_mode_radio_button = split_mode_radio_button;
450 gtk_box_pack_start(GTK_BOX(local_vbox), split_mode_radio_button, FALSE, FALSE, 2);
451 g_signal_connect(GTK_TOGGLE_BUTTON(split_mode_radio_button), "toggled",
452 G_CALLBACK(split_mode_changed), ui);
453 g_object_set_data(G_OBJECT(split_mode_radio_button), "split_type_id",
454 GINT_TO_POINTER(SELECTED_SPLIT_INTERNAL_SHEET));
455
456 //CUE file with the same name as the input file
457 split_mode_radio_button = gtk_radio_button_new_with_label_from_widget
458 (GTK_RADIO_BUTTON(split_mode_radio_button), _("Use CUE file with similar name as the input file"));
459 gtk_widget_set_tooltip_text(split_mode_radio_button,
460 _("Split using CUE file having similar name as the input file\n"
461 "Example: test.cue will be considered when splitting test.mp3"));
462 ui->gui->split_mode_radio_button = split_mode_radio_button;
463 gtk_box_pack_start(GTK_BOX(local_vbox), split_mode_radio_button, FALSE, FALSE, 2);
464 g_signal_connect(GTK_TOGGLE_BUTTON(split_mode_radio_button), "toggled",
465 G_CALLBACK(split_mode_changed), ui);
466 g_object_set_data(G_OBJECT(split_mode_radio_button), "split_type_id",
467 GINT_TO_POINTER(SELECTED_SPLIT_CUE_FILE));
468
469 //CDDB file with the same name as the input file
470 split_mode_radio_button = gtk_radio_button_new_with_label_from_widget
471 (GTK_RADIO_BUTTON(split_mode_radio_button), _("Use CDDB file with similar name as the input file"));
472 gtk_widget_set_tooltip_text(split_mode_radio_button,
473 _("Split using CDDB file having similar name as the input file\n"
474 "Example: test.cddb will be considered when splitting test.mp3"));
475 ui->gui->split_mode_radio_button = split_mode_radio_button;
476 gtk_box_pack_start(GTK_BOX(local_vbox), split_mode_radio_button, FALSE, FALSE, 2);
477 g_signal_connect(GTK_TOGGLE_BUTTON(split_mode_radio_button), "toggled",
478 G_CALLBACK(split_mode_changed), ui);
479 g_object_set_data(G_OBJECT(split_mode_radio_button), "split_type_id",
480 GINT_TO_POINTER(SELECTED_SPLIT_CDDB_FILE));
481
482 select_split_mode(SELECTED_SPLIT_NORMAL, ui);
483
484 GtkWidget *scrolled_window = wh_create_scrolled_window();
485 wh_add_box_to_scrolled_window(local_vbox, scrolled_window);
486 return scrolled_window;
487}
488
490static GtkWidget *create_single_multiple_split_modes(ui_state *ui)
491{
492 GtkWidget *local_vbox = wh_vbox_new();
493 gtk_container_set_border_width(GTK_CONTAINER(local_vbox), 0);
494
495 GtkWidget *multiple_files_hbox = wh_hbox_new();
496 gtk_box_pack_start(GTK_BOX(local_vbox), multiple_files_hbox, TRUE, TRUE, 0);
497
498 GtkWidget *multiple_files_component = create_multiple_files_component(ui);
499 gtk_box_pack_start(GTK_BOX(multiple_files_hbox), multiple_files_component, TRUE, TRUE, 0);
500 ui->gui->multiple_files_component = multiple_files_component;
501
502 return local_vbox;
503}
504
506GtkWidget *create_special_split_page(ui_state *ui)
507{
508 GtkWidget *vbox = wh_vbox_new();;
509
510 GtkWidget *paned_widget = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
511
512 gtk_box_pack_start(GTK_BOX(vbox), paned_widget, TRUE, TRUE, 0);
513
514 gtk_paned_add1(GTK_PANED(paned_widget), create_single_multiple_split_modes(ui));
515 gtk_paned_add2(GTK_PANED(paned_widget), create_split_mode(ui));
516
517 gtk_paned_set_position(GTK_PANED(paned_widget), 150);
518
519 return vbox;
520}
521
select_split_mode
void select_split_mode(int split_mode, ui_state *ui)
Set the split mode.
Definition split_mode_window.c:62
create_special_split_page
GtkWidget * create_special_split_page(ui_state *ui)
creates the special split page
Definition split_mode_window.c:506
gui_state
Definition ui_types.h:227
ui_state
Definition ui_types.h:509
wh_create_scrolled_window
GtkWidget * wh_create_scrolled_window()
creates a scrolled window
Definition widgets_helper.c:250