mp3splt-gtk

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

special_split.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-2012 Alexandru Munteanu
7 * Contact: io_fx@yahoo.fr
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
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 <gtk/gtk.h>
41 #include <glib/gi18n.h>
42 #include <libmp3splt/mp3splt.h>
43
44 #include "special_split.h"
45 #include "preferences_tab.h"
46 #include "main_win.h"
47 #include "multiple_files.h"
48
49 GtkWidget *time_label = NULL;
50 GtkWidget *spinner_time = NULL;
51
52 GtkWidget *equal_tracks_label = NULL;
53 GtkWidget *spinner_equal_tracks = NULL;
54
55 gint selected_split_mode = SELECTED_SPLIT_NORMAL;
56 gint split_file_mode = FILE_MODE_SINGLE;
57
58 GtkWidget *split_mode_radio_button = NULL;
59 GtkWidget *file_mode_radio_button = NULL;
60
61 GtkWidget *multiple_files_component = NULL;
62
63 GtkWidget *all_spinner_silence_number_tracks;
64 GtkWidget *all_spinner_silence_minimum;
65 GtkWidget *all_spinner_track_minimum;
66 GtkWidget *all_spinner_silence_offset;
67 GtkWidget *all_spinner_silence_threshold;
68 GtkWidget *all_spinner_trim_silence_threshold;
69 GtkWidget *all_silence_remove_silence;
70
71 GtkWidget *all_threshold_label;
72 GtkWidget *all_trim_threshold_label;
73 GtkWidget *all_offset_label;
74 GtkWidget *all_number_of_tracks_label;
75 GtkWidget *all_min_silence_label;
76 GtkWidget *all_min_track_label;
77
79 static gint get_selected_split_mode(GtkToggleButton *radio_b)
80 {
81 GSList *radio_button_list = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio_b));
82 gint selected = SELECTED_SPLIT_NORMAL;
83
84 gint i = 0;
85 for(i = 0; i < NUMBER_OF_SPLIT_MODES;i++)
86 {
87 GtkToggleButton *test = (GtkToggleButton *) g_slist_nth_data(radio_button_list,i);
88 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(test)))
89 {
90 selected = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(test), "split_type_id"));
91 }
92 }
93
94 return selected;
95 }
96
98 void select_split_mode(int split_mode)
99 {
100 GSList *split_mode_radio_button_list =
101 gtk_radio_button_get_group(GTK_RADIO_BUTTON(split_mode_radio_button));
102
103 gint i = 0;
104 for(i = 0; i < NUMBER_OF_SPLIT_MODES;i++)
105 {
106 GtkToggleButton *test = (GtkToggleButton *) g_slist_nth_data(split_mode_radio_button_list, i);
107 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(test), "split_type_id"));
108 if (split_mode == id)
109 {
110 gtk_toggle_button_set_active(test, TRUE);
111 return;
112 }
113 }
114 }
115
116 void deactivate_silence_parameters()
117 {
118 gtk_widget_set_sensitive(GTK_WIDGET(all_spinner_silence_number_tracks), FALSE);
119 gtk_widget_set_sensitive(GTK_WIDGET(all_spinner_silence_minimum), FALSE);
120 gtk_widget_set_sensitive(GTK_WIDGET(all_spinner_track_minimum), FALSE);
121 gtk_widget_set_sensitive(GTK_WIDGET(all_spinner_silence_offset), FALSE);
122 gtk_widget_set_sensitive(GTK_WIDGET(all_spinner_silence_threshold), FALSE);
123 gtk_widget_set_sensitive(GTK_WIDGET(all_silence_remove_silence), FALSE);
124 gtk_widget_set_sensitive(GTK_WIDGET(all_threshold_label), FALSE);
125 gtk_widget_set_sensitive(GTK_WIDGET(all_offset_label), FALSE);
126 gtk_widget_set_sensitive(GTK_WIDGET(all_number_of_tracks_label), FALSE);
127 gtk_widget_set_sensitive(GTK_WIDGET(all_min_silence_label), FALSE);
128 gtk_widget_set_sensitive(GTK_WIDGET(all_min_track_label), FALSE);
129 }
130
131 void activate_silence_parameters()
132 {
133 gtk_widget_set_sensitive(GTK_WIDGET(all_spinner_silence_number_tracks), TRUE);
134 gtk_widget_set_sensitive(GTK_WIDGET(all_spinner_silence_minimum), TRUE);
135 gtk_widget_set_sensitive(GTK_WIDGET(all_spinner_track_minimum), TRUE);
136 gtk_widget_set_sensitive(GTK_WIDGET(all_spinner_silence_offset), TRUE);
137 gtk_widget_set_sensitive(GTK_WIDGET(all_spinner_silence_threshold), TRUE);
138 gtk_widget_set_sensitive(GTK_WIDGET(all_silence_remove_silence), TRUE);
139 gtk_widget_set_sensitive(GTK_WIDGET(all_threshold_label), TRUE);
140 gtk_widget_set_sensitive(GTK_WIDGET(all_offset_label), TRUE);
141 gtk_widget_set_sensitive(GTK_WIDGET(all_number_of_tracks_label), TRUE);
142 gtk_widget_set_sensitive(GTK_WIDGET(all_min_silence_label), TRUE);
143 gtk_widget_set_sensitive(GTK_WIDGET(all_min_track_label), TRUE);
144 }
145
146 void deactivate_trim_parameters()
147 {
148 gtk_widget_set_sensitive(GTK_WIDGET(all_spinner_trim_silence_threshold), FALSE);
149 gtk_widget_set_sensitive(GTK_WIDGET(all_trim_threshold_label), FALSE);
150 }
151
152 void activate_trim_parameters()
153 {
154 gtk_widget_set_sensitive(GTK_WIDGET(all_spinner_trim_silence_threshold), TRUE);
155 gtk_widget_set_sensitive(GTK_WIDGET(all_trim_threshold_label), TRUE);
156 }
157
159 void split_mode_changed(GtkToggleButton *radio_b, gpointer data)
160 {
161 selected_split_mode = get_selected_split_mode(radio_b);
162
163 int enable_time = (selected_split_mode == SELECTED_SPLIT_TIME);
164 gtk_widget_set_sensitive(GTK_WIDGET(spinner_time), enable_time);
165 gtk_widget_set_sensitive(GTK_WIDGET(time_label), enable_time);
166
167 int enable_split_equal_time = (selected_split_mode == SELECTED_SPLIT_EQUAL_TIME_TRACKS);
168 gtk_widget_set_sensitive(GTK_WIDGET(spinner_equal_tracks), enable_split_equal_time);
169 gtk_widget_set_sensitive(GTK_WIDGET(equal_tracks_label), enable_split_equal_time);
170
171 if (selected_split_mode == SELECTED_SPLIT_SILENCE)
172 {
173 activate_silence_parameters();
174 }
175 else
176 {
177 deactivate_silence_parameters();
178 }
179
180 if (selected_split_mode == SELECTED_SPLIT_TRIM_SILENCE)
181 {
182 activate_trim_parameters();
183 }
184 else
185 {
186 deactivate_trim_parameters();
187 }
188
189 save_preferences(NULL, NULL);
190 }
191
193 static void spinner_time_changed(GtkSpinButton *spinner, gpointer data)
194 {
195 gint time = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spinner));
196 gchar time_text[1024] = { '\0' };
197 g_snprintf(time_text, 1024, _("Split every %2d seconds."), time);
198 gtk_label_set_text(GTK_LABEL(time_label), time_text);
199
200 save_preferences(NULL, NULL);
201 }
202
204 static void spinner_equal_tracks_changed(GtkSpinButton *spinner, gpointer data)
205 {
206 gint equal_tracks = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spinner));
207 gchar equal_tracks_text[1024] = { '\0' };
208 g_snprintf(equal_tracks_text, 1024, _("Split in %2d equal time tracks."), equal_tracks);
209 gtk_label_set_text(GTK_LABEL(equal_tracks_label), equal_tracks_text);
210
211 save_preferences(NULL, NULL);
212 }
213
215 static void split_file_mode_changed(GtkToggleButton *radio_b, gpointer data)
216 {
217 GSList *radio_button_list =
218 gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio_b));
219 GtkToggleButton *current_radio_button = (GtkToggleButton *)
220 g_slist_nth_data(radio_button_list,0);
221
222 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(current_radio_button)))
223 {
224 split_file_mode = FILE_MODE_MULTIPLE;
225 gtk_widget_set_sensitive(multiple_files_component, TRUE);
226 }
227 else
228 {
229 split_file_mode = FILE_MODE_SINGLE;
230 gtk_widget_set_sensitive(multiple_files_component, FALSE);
231 }
232
233 save_preferences(NULL, NULL);
234 }
235
237 static GtkWidget *create_split_mode()
238 {
239 GtkWidget *local_vbox = gtk_vbox_new(FALSE, 0);
240 gtk_container_set_border_width(GTK_CONTAINER(local_vbox), 3);
241
242 //normal split
243 split_mode_radio_button = gtk_radio_button_new_with_label(NULL, _("Normal"));
244 gtk_box_pack_start (GTK_BOX (local_vbox), split_mode_radio_button,
245 FALSE, FALSE, 2);
246 g_signal_connect(GTK_TOGGLE_BUTTON(split_mode_radio_button),
247 "toggled", G_CALLBACK (split_mode_changed), NULL);
248 g_object_set_data(G_OBJECT(split_mode_radio_button), "split_type_id",
249 GINT_TO_POINTER(SELECTED_SPLIT_NORMAL));
250
251 //time split
252 split_mode_radio_button = gtk_radio_button_new_with_label_from_widget
253 (GTK_RADIO_BUTTON(split_mode_radio_button), _("Time"));
254 gtk_box_pack_start(GTK_BOX(local_vbox), split_mode_radio_button,
255 FALSE, FALSE, 2);
256 g_signal_connect(GTK_TOGGLE_BUTTON(split_mode_radio_button), "toggled",
257 G_CALLBACK(split_mode_changed), NULL);
258 g_object_set_data(G_OBJECT(split_mode_radio_button), "split_type_id",
259 GINT_TO_POINTER(SELECTED_SPLIT_TIME));
260
261 //
262 GtkWidget *big_horiz_fake = gtk_hbox_new(FALSE, 0);
263 gtk_box_pack_start(GTK_BOX(local_vbox), big_horiz_fake, FALSE, FALSE, 0);
264
265 GtkWidget *horiz_fake = gtk_hbox_new(FALSE, 0);
266 gtk_box_pack_start(GTK_BOX(big_horiz_fake), horiz_fake, FALSE, FALSE, 25);
267
268 gint default_time = 60;
269
270 gchar time_text[1024] = { '\0' };
271 g_snprintf(time_text, 1024, _("Split every %2d seconds."), default_time);
272 time_label = gtk_label_new(time_text);
273 gtk_box_pack_start(GTK_BOX(horiz_fake), time_label, FALSE, FALSE, 0);
274
275 GtkAdjustment *adj =
276 (GtkAdjustment *)gtk_adjustment_new(0.0, 1, 2000, 1.0, 10.0, 0.0);
277 spinner_time = gtk_spin_button_new(adj, 1, 0);
278 gtk_box_pack_start(GTK_BOX(horiz_fake), spinner_time, FALSE, FALSE, 6);
279 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinner_time), default_time);
280 gtk_widget_set_sensitive(GTK_WIDGET(spinner_time), FALSE);
281 gtk_widget_set_sensitive(time_label, FALSE);
282 g_signal_connect(G_OBJECT(spinner_time), "value-changed",
283 G_CALLBACK(spinner_time_changed), NULL);
284
285 //split in equal length
286 split_mode_radio_button = gtk_radio_button_new_with_label_from_widget
287 (GTK_RADIO_BUTTON(split_mode_radio_button), _("Equal time tracks"));
288 gtk_box_pack_start(GTK_BOX(local_vbox), split_mode_radio_button,
289 FALSE, FALSE, 2);
290 g_signal_connect(GTK_TOGGLE_BUTTON(split_mode_radio_button), "toggled",
291 G_CALLBACK(split_mode_changed), NULL);
292 g_object_set_data(G_OBJECT(split_mode_radio_button), "split_type_id",
293 GINT_TO_POINTER(SELECTED_SPLIT_EQUAL_TIME_TRACKS));
294
295 //
296 big_horiz_fake = gtk_hbox_new(FALSE, 0);
297 gtk_box_pack_start(GTK_BOX(local_vbox), big_horiz_fake, FALSE, FALSE, 0);
298
299 horiz_fake = gtk_hbox_new(FALSE,0);
300 gtk_box_pack_start(GTK_BOX(big_horiz_fake), horiz_fake, FALSE, FALSE, 25);
301
302 gint default_tracks = 10;
303
304 gchar equal_length_text[1024] = { '\0' };
305 g_snprintf(equal_length_text, 1024, _("Split in %2d equal time tracks."), default_tracks);
306 equal_tracks_label = gtk_label_new(time_text);
307 gtk_box_pack_start(GTK_BOX(horiz_fake), equal_tracks_label, FALSE, FALSE, 0);
308
309 adj = (GtkAdjustment *)gtk_adjustment_new(0.0, 1, 2000, 1.0, 10.0, 0.0);
310 spinner_equal_tracks = gtk_spin_button_new(adj, 1, 0);
311 gtk_box_pack_start(GTK_BOX(horiz_fake), spinner_equal_tracks, FALSE, FALSE, 6);
312 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinner_equal_tracks), default_time);
313 gtk_widget_set_sensitive(GTK_WIDGET(spinner_equal_tracks), FALSE);
314 gtk_widget_set_sensitive(equal_tracks_label, FALSE);
315 g_signal_connect(G_OBJECT(spinner_equal_tracks), "value-changed",
316 G_CALLBACK(spinner_equal_tracks_changed), NULL);
317
318 //trim using silence detection
319 split_mode_radio_button = gtk_radio_button_new_with_label_from_widget
320 (GTK_RADIO_BUTTON(split_mode_radio_button), (gchar *)_("Trim using silence detection"));
321 gtk_box_pack_start(GTK_BOX(local_vbox), split_mode_radio_button, FALSE, FALSE, 2);
322 g_signal_connect(GTK_TOGGLE_BUTTON(split_mode_radio_button), "toggled",
323 G_CALLBACK(split_mode_changed), NULL);
324 g_object_set_data(G_OBJECT(split_mode_radio_button), "split_type_id",
325 GINT_TO_POINTER(SELECTED_SPLIT_TRIM_SILENCE));
326
327 horiz_fake = gtk_hbox_new(FALSE,0);
328 gtk_box_pack_start(GTK_BOX(local_vbox), horiz_fake, FALSE, FALSE, 0);
329
330 GtkWidget *param_vbox = gtk_vbox_new(FALSE,0);
331 gtk_box_pack_start(GTK_BOX(horiz_fake), param_vbox, FALSE, FALSE, 25);
332
333 horiz_fake = gtk_hbox_new(FALSE,0);
334 gtk_box_pack_start(GTK_BOX(param_vbox), horiz_fake, FALSE, FALSE, 0);
335
336 all_trim_threshold_label = gtk_label_new(_("Threshold level (dB) : "));
337 gtk_box_pack_start(GTK_BOX(horiz_fake), all_trim_threshold_label, FALSE, FALSE, 0);
338
339 adj = (GtkAdjustment *)gtk_adjustment_new(0.0, -96.0, 0.0, 0.5, 10.0, 0.0);
340 all_spinner_trim_silence_threshold = gtk_spin_button_new(adj, 0.5, 2);
341 gtk_box_pack_start(GTK_BOX(horiz_fake), all_spinner_trim_silence_threshold, FALSE, FALSE, 0);
342
343 //silence split
344 split_mode_radio_button = gtk_radio_button_new_with_label_from_widget
345 (GTK_RADIO_BUTTON(split_mode_radio_button), (gchar *)_("Silence - split with silence detection"));
346 gtk_box_pack_start(GTK_BOX(local_vbox), split_mode_radio_button, FALSE, FALSE, 2);
347 g_signal_connect(GTK_TOGGLE_BUTTON(split_mode_radio_button), "toggled",
348 G_CALLBACK(split_mode_changed), NULL);
349 g_object_set_data(G_OBJECT(split_mode_radio_button), "split_type_id",
350 GINT_TO_POINTER(SELECTED_SPLIT_SILENCE));
351
352 horiz_fake = gtk_hbox_new(FALSE,0);
353 gtk_box_pack_start(GTK_BOX(local_vbox), horiz_fake, FALSE, FALSE, 0);
354
355 param_vbox = gtk_vbox_new(FALSE,0);
356 gtk_box_pack_start(GTK_BOX(horiz_fake), param_vbox, FALSE, FALSE, 25);
357
358 horiz_fake = gtk_hbox_new(FALSE,0);
359 gtk_box_pack_start(GTK_BOX(param_vbox), horiz_fake, FALSE, FALSE, 0);
360
361 all_threshold_label = gtk_label_new(_("Threshold level (dB) : "));
362 gtk_box_pack_start(GTK_BOX(horiz_fake), all_threshold_label, FALSE, FALSE, 0);
363
364 adj = (GtkAdjustment *)gtk_adjustment_new(0.0, -96.0, 0.0, 0.5, 10.0, 0.0);
365 all_spinner_silence_threshold = gtk_spin_button_new(adj, 0.5, 2);
366 gtk_box_pack_start(GTK_BOX(horiz_fake), all_spinner_silence_threshold, FALSE, FALSE, 0);
367
368 horiz_fake = gtk_hbox_new(FALSE,0);
369 gtk_box_pack_start(GTK_BOX(param_vbox), horiz_fake, FALSE, FALSE, 0);
370
371 all_offset_label = gtk_label_new(_("Cutpoint offset (0 is the begin of silence,and 1 the end) : "));
372 gtk_box_pack_start(GTK_BOX(horiz_fake), all_offset_label, FALSE, FALSE, 0);
373
374 adj = (GtkAdjustment *)gtk_adjustment_new(0.0, -2, 2, 0.05, 10.0, 0.0);
375 all_spinner_silence_offset = gtk_spin_button_new(adj, 0.05, 2);
376 gtk_box_pack_start(GTK_BOX(horiz_fake), all_spinner_silence_offset, FALSE, FALSE, 0);
377
378 horiz_fake = gtk_hbox_new(FALSE,0);
379 gtk_box_pack_start(GTK_BOX(param_vbox), horiz_fake, FALSE, FALSE, 0);
380
381 all_number_of_tracks_label = gtk_label_new(_("Number of tracks (0 means all tracks) : "));
382 gtk_box_pack_start(GTK_BOX(horiz_fake), all_number_of_tracks_label, FALSE, FALSE, 0);
383
384 adj = (GtkAdjustment *)gtk_adjustment_new(0.0, 0, 2000, 1, 10.0, 0.0);
385 all_spinner_silence_number_tracks = gtk_spin_button_new(adj, 1, 0);
386 gtk_box_pack_start(GTK_BOX(horiz_fake), all_spinner_silence_number_tracks, FALSE, FALSE, 0);
387
388 horiz_fake = gtk_hbox_new(FALSE,0);
389 gtk_box_pack_start(GTK_BOX(param_vbox), horiz_fake, FALSE, FALSE, 0);
390
391 all_min_silence_label = gtk_label_new(_("Minimum silence length (seconds) : "));
392 gtk_box_pack_start(GTK_BOX(horiz_fake), all_min_silence_label, FALSE, FALSE, 0);
393
394 adj = (GtkAdjustment *)gtk_adjustment_new(0.0, 0, 2000, 0.5, 10.0, 0.0);
395 all_spinner_silence_minimum = gtk_spin_button_new(adj, 1, 2);
396 gtk_box_pack_start(GTK_BOX(horiz_fake), all_spinner_silence_minimum, FALSE, FALSE, 0);
397
398 horiz_fake = gtk_hbox_new(FALSE,0);
399 gtk_box_pack_start(GTK_BOX(param_vbox), horiz_fake, FALSE, FALSE, 0);
400
401 all_min_track_label = gtk_label_new(_("Minimum track length (seconds) : "));
402 gtk_box_pack_start(GTK_BOX(horiz_fake), all_min_track_label, FALSE, FALSE, 0);
403
404 adj = (GtkAdjustment *)gtk_adjustment_new(0.0, 0, 2000, 0.5, 10.0, 0.0);
405 all_spinner_track_minimum = gtk_spin_button_new(adj, 1, 2);
406 gtk_box_pack_start(GTK_BOX(horiz_fake), all_spinner_track_minimum, FALSE, FALSE, 0);
407
408 all_silence_remove_silence =
409 gtk_check_button_new_with_label(_("Remove silence between tracks"));
410 gtk_box_pack_start(GTK_BOX(param_vbox), all_silence_remove_silence, FALSE, FALSE, 0);
411
412 gtk_spin_button_set_value(GTK_SPIN_BUTTON(all_spinner_silence_number_tracks),
413 SPLT_DEFAULT_PARAM_TRACKS);
414 gtk_spin_button_set_value(GTK_SPIN_BUTTON(all_spinner_silence_minimum),
415 SPLT_DEFAULT_PARAM_MINIMUM_LENGTH);
416 gtk_spin_button_set_value(GTK_SPIN_BUTTON(all_spinner_silence_offset),
417 SPLT_DEFAULT_PARAM_OFFSET);
418 gtk_spin_button_set_value(GTK_SPIN_BUTTON(all_spinner_silence_threshold),
419 SPLT_DEFAULT_PARAM_THRESHOLD);
420
421 gtk_spin_button_set_value(GTK_SPIN_BUTTON(all_spinner_trim_silence_threshold),
422 SPLT_DEFAULT_PARAM_THRESHOLD);
423
424 deactivate_silence_parameters();
425 deactivate_trim_parameters();
426
427 //wrap split
428 split_mode_radio_button = gtk_radio_button_new_with_label_from_widget
429 (GTK_RADIO_BUTTON(split_mode_radio_button),
430 _("Wrap - split files created with mp3wrap or albumwrap (mp3 only)"));
431 gtk_box_pack_start(GTK_BOX(local_vbox), split_mode_radio_button,
432 FALSE, FALSE, 2);
433 g_signal_connect(GTK_TOGGLE_BUTTON(split_mode_radio_button), "toggled",
434 G_CALLBACK(split_mode_changed), NULL);
435 g_object_set_data(G_OBJECT(split_mode_radio_button), "split_type_id",
436 GINT_TO_POINTER(SELECTED_SPLIT_WRAP));
437
438 //error mode split
439 split_mode_radio_button = gtk_radio_button_new_with_label_from_widget
440 (GTK_RADIO_BUTTON(split_mode_radio_button), _("Error mode (mp3 only)"));
441 gtk_box_pack_start(GTK_BOX(local_vbox), split_mode_radio_button,
442 FALSE, FALSE, 2);
443 g_signal_connect(GTK_TOGGLE_BUTTON(split_mode_radio_button), "toggled",
444 G_CALLBACK(split_mode_changed), NULL);
445 g_object_set_data(G_OBJECT(split_mode_radio_button), "split_type_id",
446 GINT_TO_POINTER(SELECTED_SPLIT_ERROR));
447
448 select_split_mode(SELECTED_SPLIT_NORMAL);
449
450 GtkWidget *scrolled_window = create_scrolled_window();
451 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window),
452 GTK_WIDGET(local_vbox));
453
454 return scrolled_window;
455 }
456
458 static GtkWidget *create_single_multiple_split_modes()
459 {
460 GtkWidget *local_vbox = gtk_vbox_new(FALSE, 0);
461 gtk_container_set_border_width(GTK_CONTAINER(local_vbox), 3);
462
463 //single file
464 file_mode_radio_button =
465 gtk_radio_button_new_with_label(NULL, _("Single file"));
466 gtk_box_pack_start(GTK_BOX(local_vbox), file_mode_radio_button,
467 FALSE, FALSE, 2);
468 g_signal_connect(GTK_TOGGLE_BUTTON(file_mode_radio_button),
469 "toggled", G_CALLBACK(split_file_mode_changed), NULL);
470
471 //multiple files
472 file_mode_radio_button = gtk_radio_button_new_with_label_from_widget
473 (GTK_RADIO_BUTTON(file_mode_radio_button), _("Batch processing"));
474 gtk_box_pack_start(GTK_BOX(local_vbox), file_mode_radio_button,
475 FALSE, FALSE, 2);
476 g_signal_connect(GTK_TOGGLE_BUTTON(file_mode_radio_button),
477 "toggled", G_CALLBACK(split_file_mode_changed), NULL);
478
479 GtkWidget *multiple_files_hbox = gtk_hbox_new(FALSE, 0);
480 gtk_box_pack_start(GTK_BOX(local_vbox), multiple_files_hbox, TRUE, TRUE, 2);
481
482 multiple_files_component = create_multiple_files_component();
483 gtk_widget_set_sensitive(multiple_files_component, FALSE);
484 gtk_box_pack_start(GTK_BOX(multiple_files_hbox), multiple_files_component,
485 TRUE, TRUE, 5);
486
487 GtkWidget *scrolled_window = create_scrolled_window();
488 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window),
489 GTK_WIDGET(local_vbox));
490
491 return scrolled_window;
492 }
493
495 GtkWidget *create_special_split_page()
496 {
497 GtkWidget *vbox = gtk_vbox_new(FALSE, 0);;
498
499 /* tabbed notebook */
500 GtkWidget *notebook = gtk_notebook_new();
501 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
502 gtk_notebook_popup_enable(GTK_NOTEBOOK(notebook));
503 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), TRUE);
504 gtk_notebook_set_show_border(GTK_NOTEBOOK(notebook), FALSE);
505 gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), TRUE);
506
507 GtkWidget *notebook_label = gtk_label_new(_("Split mode"));
508 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), create_split_mode(),
509 (GtkWidget *)notebook_label);
510
511 notebook_label = gtk_label_new(_("File mode"));
512 gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
513 create_single_multiple_split_modes(), (GtkWidget *)notebook_label);
514
515 return vbox;
516 }
517