mp3splt-gtk: src/ui_types.h Source File

mp3splt-gtk 0.9.3.1519

Loading...
Searching...
No Matches
ui_types.h
1/**********************************************************
2 * mp3splt-gtk -- utility based on mp3splt,
3 *
4 *
5 * Contact: m@ioalex.net
6 * Copyright: (C) 2005-2014 Alexandru Munteanu
7 *
8 * http://mp3splt.sourceforge.net/
9 *
10 *********************************************************/
11
12/**********************************************************
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
27 * USA.
28 *
29 *********************************************************/
30
31#ifndef UI_TYPES_H
32
33#define UI_TYPES_H
34
35#include <libmp3splt/mp3splt.h>
36
37#ifndef NO_GSTREAMER
38 #include <gst/gst.h>
39#endif
40
41#ifndef NO_AUDACIOUS
42 #include <audacious/audctrl.h>
43 #include <audacious/dbus.h>
44#endif
45
46#ifdef __WIN32__
47 #include <windows.h>
48 #include <winsock2.h>
49#endif
50
51 typedef struct {
52 gchar* main_key;
53 gchar* second_key;
54 gint default_value;
55 GtkWidget *spinner;
56 void (*update_spinner_value_cb)(GtkWidget *spinner, gpointer data);
57 gpointer user_data_for_cb;
58} spinner_int_preference;
59
60 typedef struct {
61 gchar* main_key;
62 gchar* second_key;
63 gint default_value;
64 GtkWidget *range;
65 void (*update_adjustment_value)(GtkAdjustment *adjustment, gpointer data);
66 gpointer user_data_for_cb;
67} range_preference;
68
69 typedef struct {
70 GArray *spinner_int_preferences;
71 GArray *range_preferences;
72} preferences_state;
73
74 typedef struct
75{
76 gboolean checked;
77 gint mins;
78 gint secs;
79 gint hundr_secs;
80} Split_point;
81
82 typedef struct {
83 gint root_x_pos;
84 gint root_y_pos;
85 gint width;
86 gint height;
87} ui_main_window;
88
89 typedef struct {
90 long time;
91 float level;
92} silence_wave;
93
94 typedef struct {
95 gint index;
96 gpointer data;
97} preview_index_and_data;
98
99 typedef struct points_and_tags {
100 GPtrArray *splitpoints;
101 GPtrArray *tags;
102} points_and_tags;
103
104 typedef struct {
105 gchar *browser_directory;
106 ui_main_window *main_win;
107 GList *text_options_list;
108
109 silence_wave *silence_points;
110 gint number_of_silence_points;
111 gint malloced_num_of_silence_points;
112
113 gint player_seconds;
114 gint player_minutes;
115 gint player_hundr_secs;
116 //only for internal use when we change manually we have the real
117 //time which is player_seconds and the imaginary time player_seconds2
118 gint player_seconds2;
119 gint player_minutes2;
120 gint player_hundr_secs2;
121
122 gfloat total_time;
123 gfloat current_time;
124
125 gint splitnumber;
126 gint width_drawing_area;
127 gfloat zoom_coeff;
128 gfloat zoom_coeff_old;
129
130 gint hundr_secs_th;
131 gint tens_of_secs_th;
132 gint secs_th;
133 gint ten_secs_th;
134 gint minutes_th;
135 gint ten_minutes_th;
136
137 gint one_minute_time;
138 gint three_minutes_time;
139 gint six_minutes_time;
140 gint ten_minutes_time;
141 gint twenty_minutes_time;
142 gint fourty_minutes_time;
143
144 GArray *preview_time_windows;
145
146 GPtrArray *filtered_points_presence;
147 gint silence_wave_number_of_points_threshold;
148
149 gint selected_player;
150
151 gdouble douglas_peucker_thresholds[6];
152 gdouble douglas_peucker_thresholds_defaults[6];
153
154 gint debug_is_active;
155
156 gfloat silence_threshold_value;
157 gint silence_shots_value;
158 gfloat silence_offset_value;
159 gint silence_number_of_tracks;
160 gfloat silence_minimum_length;
161 gfloat silence_minimum_track_length;
162 gboolean silence_remove_silence_between_tracks;
163
164 gint freedb_table_number;
165 gint playlist_tree_number;
166 gint multiple_files_tree_number;
167
168 gint freedb_selected_id;
169
170 splt_freedb_results *freedb_search_results;
171
172 gint split_file_mode;
173
174 GString *outputdirname;
175
176 preview_index_and_data preview_indexes[6];
177
178 gint timeout_value;
179
180 gint gstreamer_stop_before_end;
181
182 gint small_seek_jump_value;
183 gint seek_jump_value;
184 gint big_seek_jump_value;
185
186 //make export threads to execute in order
187 GThread *previous_export_thread;
188
189 //previous right mark time/pixels
190 gint previous_mark_time;
191 gfloat previous_mark_pixel;
192 gfloat accumulated_diff;
193 gint pixels_diff_regarding_previous;
194 GHashTable *previous_pixel_by_time;
195 GHashTable *pixel_moved_by_time;
196
197 gint drawing_preferences_silence_wave;
198} ui_infos;
199
200 typedef struct {
201#ifndef NO_GSTREAMER
202 const gchar *song_artist;
203 const gchar *song_title;
204 gint rate;
205 GstElement *play;
206 GstBus *bus;
207 gint _gstreamer_is_running;
208#endif
209
210#ifndef NO_AUDACIOUS
211 DBusGProxy *dbus_proxy;
212 DBusGConnection *dbus_connection;
213#endif
214
215 //snackamp
216 FILE *in;
217 FILE *out;
218 gboolean connected;
219#ifdef __WIN32__
220 SOCKET socket_id;
221#else
222 gint socket_id;
223#endif
224
225} player_infos;
226
227 typedef struct {
228 GtkApplication *application;
229 GtkWidget *window;
230
231 GtkWidget *open_file_chooser_button;
232 GString *input_filename;
233
234 GtkWidget *player_box;
235 GtkWidget *playlist_box;
236
237 GtkWidget *song_name_label;
238 GtkWidget *song_infos;
239 GtkWidget *label_time;
240
241 GtkAdjustment *progress_adj;
242 GtkWidget *progress_bar;
243
244 GtkTreeView *tree_view;
245
246 GtkWidget *drawing_area;
247 GtkProgressBar *percent_progress_bar;
248 GtkWidget *drawing_area_expander;
249
250 //drawing area variables
251 gint margin;
252 gint real_erase_split_length;
253 gint real_move_split_length;
254 gint real_checkbox_length;
255 gint real_wave_length;
256
257 gint erase_split_ylimit;
258 gint progress_ylimit;
259 gint splitpoint_ypos;
260 gint checkbox_ypos;
261 gint text_ypos;
262 gint wave_ypos;
263
264 GPtrArray *wave_quality_das;
265 GtkWidget *player_scrolled_window;
266
267 GtkStatusbar *status_bar;
268
269 GtkWidget *add_button;
270 GtkWidget *remove_row_button;
271 GtkWidget *remove_all_button;
272
273 GtkTextTagTable *mess_hist_tag_table;
274 GtkTextBuffer *mess_hist_buffer;
275
276 GtkToggleButton *names_from_filename;
277
278 GtkWidget *pause_button;
279
280 GtkBox *player_buttons_hbox;
281
282 //player button images
283 GtkWidget *Go_BegButton_active;
284 GtkWidget *Go_BegButton_inactive;
285 GtkWidget *Go_EndButton_active;
286 GtkWidget *Go_EndButton_inactive;
287 GtkWidget *PlayButton_active;
288 GtkWidget *PlayButton_inactive;
289 GtkWidget *StopButton_active;
290 GtkWidget *StopButton_inactive;
291 GtkWidget *PauseButton_active;
292 GtkWidget *PauseButton_inactive;
293
294 //player buttons
295 GtkWidget *play_button;
296 GtkWidget *stop_button;
297 GtkWidget *player_add_button;
298 GtkWidget *go_beg_button;
299 GtkWidget *go_end_button;
300
301 GtkWidget *connect_button;
302 GtkWidget *disconnect_button;
303
304 GtkWidget *silence_wave_check_button;
305
306 GtkWidget *cancel_button;
307
308 GtkWidget *volume_button;
309
310 GtkTreeView *playlist_tree;
311
312 GtkWidget *playlist_remove_file_button;
313 GtkWidget *playlist_remove_all_files_button;
314
315 GtkWidget *frame_mode;
316 GtkWidget *bit_reservoir_mode;
317 GtkWidget *adjust_mode;
318
319 GtkWidget *spinner_adjust_offset;
320 GtkWidget *spinner_adjust_gap;
321 GtkWidget *spinner_adjust_min;
322 GtkWidget *spinner_adjust_threshold;
323
324 GtkWidget *adjust_param_vbox;
325
326 GtkWidget *spinner_time;
327 GtkWidget *spinner_equal_tracks;
328
329 GtkWidget *all_spinner_silence_number_tracks;
330 GtkWidget *all_spinner_silence_minimum;
331 GtkWidget *all_spinner_track_minimum;
332 GtkWidget *all_spinner_silence_offset;
333 GtkWidget *all_spinner_trim_silence_threshold;
334 GtkWidget *all_spinner_silence_threshold;
335 GtkWidget *all_silence_remove_silence;
336 GtkWidget *all_spinner_silence_shots;
337
338 GtkWidget *all_threshold_label;
339 GtkWidget *all_shots_label;
340 GtkWidget *all_trim_threshold_label;
341 GtkWidget *all_offset_label;
342 GtkWidget *all_number_of_tracks_label;
343 GtkWidget *all_min_silence_label;
344 GtkWidget *all_min_track_label;
345
346 GtkWidget *tags_radio;
347 GtkWidget *tags_version_radio;
348
349 GtkWidget *output_dir_radio;
350 GtkWidget *custom_dir_file_chooser_button;
351 GtkWidget *example_output_dir_entry;
352 GtkWidget *example_output_dir_box;
353
354 GtkWidget *replace_underscore_by_space_check_box;
355 GtkComboBox *artist_text_properties_combo;
356 GtkComboBox *album_text_properties_combo;
357 GtkComboBox *title_text_properties_combo;
358 GtkComboBox *comment_text_properties_combo;
359 GtkComboBox *genre_combo;
360 GtkWidget *comment_tag_entry;
361 GtkWidget *regex_entry;
362 GtkWidget *test_regex_fname_entry;
363 GtkWidget *sample_result_label;
364 GtkWidget *extract_tags_box;
365
366 GtkWidget *create_dirs_from_output_files;
367
368 GtkWidget *output_entry;
369 GtkWidget *output_label;
370 GtkWidget *output_default_label;
371
372 GtkTreeView *split_tree;
373
374 GtkWidget *spinner_minutes;
375 GtkWidget *spinner_seconds;
376 GtkWidget *spinner_hundr_secs;
377
378 GtkWidget *scan_trim_silence_button;
379 GtkWidget *scan_trim_silence_button_player;
380 GtkWidget *scan_silence_button;
381 GtkWidget *scan_silence_button_player;
382
383 GtkWidget *spinner_silence_number_tracks;
384 GtkWidget *spinner_silence_minimum;
385 GtkWidget *spinner_silence_minimum_track;
386 GtkWidget *spinner_silence_offset;
387 GtkWidget *spinner_silence_threshold;
388 GtkWidget *spinner_silence_shots;
389 GtkWidget *silence_remove_silence;
390
391 GtkWidget *queue_files_button;
392 GtkWidget *remove_file_button;
393 GtkWidget *remove_all_files_button;
394
395 GtkWidget *freedb_entry;
396 GtkWidget *freedb_search_button;
397 GtkWidget *freedb_spinner;
398 GtkTreeView *freedb_tree;
399 GtkWidget *freedb_add_button;
400
401 GtkWidget *radio_output;
402
403 GtkWidget *split_mode_radio_button;
404
405 GtkWidget *time_label;
406 GtkWidget *time_label_after;
407 GtkWidget *equal_tracks_label;
408 GtkWidget *equal_tracks_label_after;
409
410 GtkWidget *multiple_files_component;
411
412 GtkWidget *player_combo_box;
413 GtkWidget *radio_button;
414 GtkWidget *gstreamer_stop_before_end_box;
415
416 GPtrArray *wave_preview_labels;
417
418 GtkWidget *mess_history_window;
419 GtkWidget *mess_hist_view;
420
421 GtkTreeView *multiple_files_tree;
422
423 GtkWidget *multiple_files_remove_file_button;
424 GtkWidget *multiple_files_remove_all_files_button;
425
426 GtkWidget *preferences_widget;
427 GtkWidget *preferences_window;
428
429 GtkWidget *split_files_widget;
430 GtkWidget *split_files_window;
431
432 GtkWidget *freedb_widget;
433 GtkWidget *freedb_window;
434
435 GtkWidget *splitpoints_widget;
436 GtkWidget *splitpoints_window;
437} gui_state;
438
439 typedef struct {
440 gint splitting;
441 gint process_in_progress;
442 gint mouse_on_progress_bar;
443 gint currently_compute_douglas_peucker_filters;
444 gint show_silence_wave;
445 gboolean playing;
446 gboolean timer_active;
447
448 gint quick_preview_end_splitpoint;
449 gint preview_start_splitpoint;
450 gboolean stop_preview_right_after_start;
451
452 gfloat move_time;
453
454 gboolean button1_pressed;
455 gboolean button2_pressed;
456 gboolean quick_preview;
457
458 gint button_x;
459 gint button_y;
460 gint button_x2;
461 gint button_y2;
462
463 gboolean move_splitpoints;
464 gint splitpoint_to_move;
465 gboolean remove_splitpoints;
466 gboolean select_splitpoints;
467 gboolean check_splitpoint;
468
469 gint first_splitpoint_selected;
470
471 gint spin_mins;
472 gint spin_secs;
473 gint spin_hundr_secs;
474
475 gchar current_description[255];
476
477 gint preview_start_position;
478
479 gint timeout_id;
480
481 gint currently_scanning_for_silence;
482
483 gchar *filename_to_split;
484
485 gint douglas_callback_counter;
486
487 gboolean stream;
488
489 gint only_press_pause;
490
491 gboolean change_volume;
492 gboolean on_the_volume_button;
493 gint file_browsed;
494 gint preview_row;
495 gint selected_split_mode;
496
497 gint file_selection_changed;
498
499 gint stop_split;
500
501 gfloat previous_zoom_coeff;
502 gint previous_interpolation_level;
503
504 gint lock_cue_export;
505} gui_status;
506
507#define SPLT_MUTEX GMutex
508
509 typedef struct {
510 gint return_code;
511
512 ui_infos *infos;
513 preferences_state *preferences;
514 splt_state *mp3splt_state;
515
516 GArray *splitpoints;
517 gui_state *gui;
518 gui_status *status;
519 player_infos *pi;
520
521 GPtrArray *files_to_split;
522
523 SPLT_MUTEX variables_mutex;
524
525 int importing_cue_from_configuration_directory;
526
527 gint argc;
528 gchar **argv;
529} ui_state;
530
531 typedef struct {
532 gint err;
533 ui_state *ui;
534 gboolean show_errors;
535} ui_with_err;
536
537 typedef struct {
538 ui_state *ui;
539 gpointer data;
540 GThreadFunc thread;
541 gint is_checked_output_radio_box;
542 gchar *filename_to_split;
543} ui_with_data;
544
545 typedef struct {
546 ui_state *ui;
547 char *fname;
548 gboolean is_checked_output_radio_box;
549 gchar *output_format;
550 gboolean show_errors;
551} ui_with_fname;
552
553 typedef struct {
554 ui_state *ui;
555 points_and_tags *pat;
556 GThread *previous_thread;
557 gchar *export_filename;
558} ui_with_pat;
559
560 typedef struct {
561 ui_state *ui;
562 GSList *list;
563} ui_with_list;
564
565 typedef struct {
566 ui_state *ui;
567 char **filenames;
568 int num_of_filenames;
569} ui_with_fnames;
570
571 typedef struct {
572 ui_state *ui;
573
574 int frame_mode;
575 int bit_reservoir_mode;
576
577 //adjust options
578 int adjust_mode;
579 float adjust_offset;
580 int adjust_gap;
581 float adjust_threshold;
582 float adjust_min;
583
584 //single or batch
585 int split_file_mode;
586
587 //type of split
588 int selected_split_mode;
589
590 long time_split_value;
591 int equal_tracks_value;
592
593 //batch split by silence options
594 float silence_threshold;
595 float silence_offset;
596 int silence_number;
597 float silence_minimum_length;
598 float silence_minimum_track_length;
599 int silence_remove;
600 int silence_shots;
601
602 float trim_silence_threshold;
603
604 //single split by silence options
605 float single_silence_threshold;
606 int single_silence_shots;
607 float single_silence_offset;
608 int single_silence_number;
609 float single_silence_minimum_length;
610 float single_silence_minimum_track_length;
611 int single_silence_remove;
612
613 //no_tags, default_tags, ...
614 int selected_tags_value;
615 //version of tags
616 int tags_version;
617
618 int create_dirs_from_filenames;
619
620 //tags from filename regex
621 int regex_replace_underscores;
622 int regex_artist_tag_format;
623 int regex_album_tag_format;
624 int regex_title_tag_format;
625 int regex_comment_tag_format;
626 gchar *regex;
627 gchar *regex_default_comment;
628 gchar *regex_default_genre;
629
630 points_and_tags *pat;
631 gchar *output_format;
632 gboolean is_checked_output_radio_box;
633 gchar *output_directory;
634
635 gchar *test_regex_filename;
636 gboolean should_trim;
637 gint freedb_selected_id;
638} ui_for_split;
639
640#endif
641
Split_point
Definition ui_types.h:75
gui_state
Definition ui_types.h:227
gui_status
Definition ui_types.h:439
player_infos
Definition ui_types.h:200
points_and_tags
Definition ui_types.h:99
preferences_state
Definition ui_types.h:69
preview_index_and_data
Definition ui_types.h:94
range_preference
Definition ui_types.h:60
silence_wave
Definition ui_types.h:89
spinner_int_preference
Definition ui_types.h:51
ui_for_split
Definition ui_types.h:571
ui_infos
Definition ui_types.h:104
ui_main_window
Definition ui_types.h:82
ui_state
Definition ui_types.h:509
ui_with_data
Definition ui_types.h:537
ui_with_err
Definition ui_types.h:531
ui_with_fname
Definition ui_types.h:545
ui_with_fnames
Definition ui_types.h:565
ui_with_list
Definition ui_types.h:560
ui_with_pat
Definition ui_types.h:553