40 #include <glib/gi18n.h>
48 #define usleep(x) Sleep(x/1000)
54 #include "player_tab.h"
56 #include "snackamp_control.h"
57 #include "utilities.h"
58 #include "split_files.h"
59 #include "mp3splt-gtk.h"
60 #include "ui_manager.h"
61 #include "widgets_helper.h"
63 #define DRAWING_AREA_WIDTH 400
64 #define DRAWING_AREA_HEIGHT 123
65 #define DRAWING_AREA_HEIGHT_WITH_SILENCE_WAVE 232
76 gint file_in_entry = FALSE;
79 GtkWidget *file_handle_box;
81 GtkWidget *player_buttons_hbox = NULL;
83 GtkWidget *drawing_area_expander;
86 gint incorrect_selected_file = FALSE;
88 gfloat total_draw_time = 0;
90 static const gint hundr_secs_th = 20;
91 static const gint tens_of_secs_th = 3 * 100;
92 static const gint secs_th = 40 * 100;
93 static const gint ten_secs_th = 3 * 6000;
94 static const gint minutes_th = 20 * 6000;
95 static const gint ten_minutes_th = 3 * 3600 * 100;
97 extern GtkWidget *names_from_filename;
102 extern GtkWidget *browse_cddb_button;
103 extern GtkWidget *browse_cue_button;
105 extern GtkWidget *window;
106 extern GtkWidget *percent_progress_bar;
108 extern gint we_are_splitting;
109 extern gchar *filename_to_split;
110 extern gchar *filename_path_of_split;
112 extern GtkWidget *cancel_button;
113 extern gint debug_is_active;
118 GtkWidget *progress_bar;
120 GtkWidget *progress_adj;
123 GtkWidget *volume_button;
126 GtkWidget *label_time;
128 gint player_seconds = 0,
129 player_minutes = 0, player_hundr_secs = 0;
132 gint player_seconds2 = 0,
133 player_minutes2 = 0, player_hundr_secs2 = 0;
135 gboolean change_volume = TRUE;
137 gboolean on_the_volume_button = FALSE;
139 gboolean playing = FALSE;
141 gboolean stream = FALSE;
143 GtkWidget *song_name_label;
146 GtkWidget *connect_button;
147 GtkWidget *disconnect_button;
150 GtkWidget *song_infos;
153 GtkWidget *play_button;
154 GtkWidget *stop_button;
155 GtkWidget *pause_button;
156 GtkWidget *player_add_button;
157 GtkWidget *go_beg_button;
158 GtkWidget *go_end_button;
161 GtkWidget *silence_wave_check_button = NULL;
163 gint number_of_silence_points = 0;
164 gint malloced_num_of_silence_points = 0;
165 gint show_silence_wave = FALSE;
166 gint we_scan_for_silence = FALSE;
169 gboolean timer_active = FALSE;
174 GtkWidget *player_handle;
177 GtkWidget *playlist_handle;
178 GtkWidget *playlist_handle_window;
181 extern gint selected_player;
186 gfloat total_time = 0;
188 gfloat current_time = 0;
191 gboolean mouse_on_progress_bar = FALSE;
197 gint width_drawing_area = 0;
200 GtkWidget *drawing_area = NULL;
203 gfloat zoom_coeff = 2.0;
204 gfloat zoom_coeff_old;
206 gboolean button1_pressed = FALSE;
207 gboolean button2_pressed = FALSE;
220 gint timeout_value = DEFAULT_TIMEOUT_VALUE;
222 gint splitpoint_to_move = -1;
224 gboolean move_splitpoints = FALSE;
225 gboolean remove_splitpoints = FALSE;
226 gboolean select_splitpoints = FALSE;
227 gboolean check_splitpoint = FALSE;
229 gint only_press_pause = FALSE;
232 GtkWidget *playlist_tree = NULL;
233 gint playlist_tree_number = 0;
237 gint real_erase_split_length;
238 gint real_progress_length;
239 gint real_move_split_length;
240 gint real_checkbox_length;
241 gint real_text_length;
242 gint real_wave_length;
244 gint erase_split_ylimit;
245 gint progress_ylimit;
246 gint splitpoint_ypos;
255 GtkWidget *Go_BegButton_active;
256 GtkWidget *Go_BegButton_inactive;
257 GtkWidget *Go_EndButton_active;
258 GtkWidget *Go_EndButton_inactive;
259 GtkWidget *PlayButton_active;
260 GtkWidget *PlayButton_inactive;
261 GtkWidget *StopButton_active;
262 GtkWidget *StopButton_inactive;
263 GtkWidget *PauseButton_active;
264 GtkWidget *PauseButton_inactive;
275 GtkWidget *playlist_remove_file_button;
277 GtkWidget *playlist_remove_all_files_button;
289 extern void copy_filename_to_current_description(
const gchar *fname);
305 gtk_entry_set_text(GTK_ENTRY(
entry), filename);
328 if (! silence_points)
331 malloced_num_of_silence_points = 3000;
333 else if (number_of_silence_points >= malloced_num_of_silence_points)
335 silence_points = g_realloc(silence_points,
336 sizeof(
silence_wave) * (number_of_silence_points + 3000));
337 malloced_num_of_silence_points = number_of_silence_points + 3000;
340 silence_points[number_of_silence_points].time = time;
341 silence_points[number_of_silence_points].level = abs(level);
343 number_of_silence_points++;
346 gpointer detect_silence(gpointer data)
353 g_free(silence_points);
354 silence_points = NULL;
355 number_of_silence_points = 0;
360 gtk_widget_set_sensitive(cancel_button, TRUE);
369 we_are_splitting = TRUE;
370 we_scan_for_silence = TRUE;
372 mp3splt_set_silence_points(the_state, &err);
374 we_scan_for_silence = FALSE;
375 we_are_splitting = FALSE;
376 mp3splt_set_silence_level_function(the_state, NULL, NULL);
381 gtk_widget_set_sensitive(cancel_button, FALSE);
382 refresh_drawing_area();
395 if (we_scan_for_silence)
402 create_thread(detect_silence, NULL, TRUE, NULL);
417 if (show_silence_wave)
421 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(names_from_filename)))
423 copy_filename_to_current_description(fname);
426 else if (strcmp(old_fname,fname) != 0)
429 if (show_silence_wave)
433 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(names_from_filename)))
435 copy_filename_to_current_description(fname);
443 gtk_widget_set_sensitive(GTK_WIDGET(progress_bar), FALSE);
444 gtk_adjustment_set_value(GTK_ADJUSTMENT(progress_adj), 0);
450 gtk_widget_set_sensitive(GTK_WIDGET(volume_button), FALSE);
451 gtk_scale_button_set_value(GTK_SCALE_BUTTON(volume_button), 0);
457 if (strcmp(gtk_label_get_text(GTK_LABEL(label_time)),
"") == 0)
459 gtk_label_set_text(GTK_LABEL(label_time),
"");
466 gtk_label_set_text(GTK_LABEL(song_infos),
"");
472 gtk_label_set_text(GTK_LABEL(song_name_label),
"");
491 gtk_widget_set_sensitive(stop_button, TRUE);
492 gtk_button_set_image(GTK_BUTTON(stop_button), g_object_ref(StopButton_active));
494 gtk_widget_set_sensitive(pause_button, TRUE);
495 gtk_button_set_image(GTK_BUTTON(pause_button), g_object_ref(PauseButton_active));
497 if (selected_player != PLAYER_GSTREAMER)
499 gtk_widget_set_sensitive(go_beg_button, TRUE);
500 gtk_button_set_image(GTK_BUTTON(go_beg_button), g_object_ref(Go_BegButton_active));
501 gtk_widget_set_sensitive(go_end_button, TRUE);
502 gtk_button_set_image(GTK_BUTTON(go_end_button), g_object_ref(Go_EndButton_active));
504 gtk_widget_set_sensitive(play_button, TRUE);
505 gtk_button_set_image(GTK_BUTTON(play_button), g_object_ref(PlayButton_active));
511 gtk_widget_set_sensitive(stop_button, FALSE);
512 gtk_button_set_image(GTK_BUTTON(stop_button), g_object_ref(StopButton_inactive));
513 gtk_widget_set_sensitive(pause_button, FALSE);
514 gtk_button_set_image(GTK_BUTTON(pause_button), g_object_ref(PauseButton_inactive));
515 gtk_widget_set_sensitive(go_beg_button, FALSE);
516 gtk_button_set_image(GTK_BUTTON(go_beg_button), g_object_ref(Go_BegButton_inactive));
517 gtk_widget_set_sensitive(go_end_button, FALSE);
518 gtk_button_set_image(GTK_BUTTON(go_end_button), g_object_ref(Go_EndButton_inactive));
519 gtk_widget_set_sensitive(play_button, FALSE);
520 gtk_button_set_image(GTK_BUTTON(play_button), g_object_ref(PlayButton_inactive));
521 gtk_widget_set_sensitive(player_add_button, FALSE);
522 gtk_widget_set_sensitive(silence_wave_check_button, FALSE);
528 if (selected_player != PLAYER_GSTREAMER)
538 if (selected_player != PLAYER_GSTREAMER)
555 GList *song_list = NULL;
559 song_list = g_list_append(song_list, strdup(fname));
562 if (start_playing == 0)
594 timeout_id = g_timeout_add(timeout_value,
mytimer, NULL);
606 g_list_free(song_list);
634 if (selected_player == PLAYER_SNACKAMP)
639 timeout_id = g_timeout_add(timeout_value,
mytimer, NULL);
648 if (selected_player != PLAYER_GSTREAMER)
657 change_volume = TRUE;
663 GtkWidget *dialog, *label;
664 dialog = gtk_dialog_new_with_buttons (_(
"Cannot connect to player"),
671 switch(selected_player)
673 case PLAYER_SNACKAMP:
674 label = gtk_label_new
675 (_(
"\n Cannot connect to snackAmp player.\n"
676 " Please download and install snackamp from\n"
677 "\thttp://snackamp.sourceforge.net\n\n"
678 " Verify that snackamp is running.\n"
679 " Verify that your snackamp version is >= 3.1.3\n\n"
680 " Verify that you have enabled socket interface in snackamp:\n"
681 " You have to go to\n"
682 "\tTools->Preferences->Miscellaneous\n"
683 " from the snackamp menu and check\n"
684 "\tEnable Socket Interface\n"
685 " Only default port is supported for now(8775)\n"
686 " After that, restart snackamp and mp3splt-gtk should work.\n"));
688 case PLAYER_AUDACIOUS:
689 label = gtk_label_new
690 (_(
"\n Cannot connect to Audacious player.\n"
691 " Verify that you have installed audacious.\n\n"
692 " Put in your PATH variable the directory where the audacious"
694 " If you don't know how to do that, start audacious manually"
695 " and then try to connect.\n"));
698 label = gtk_label_new(_(
"Cannot connect to player"));
702 g_signal_connect_swapped(dialog,
"response",
703 G_CALLBACK(gtk_widget_destroy), dialog);
704 gtk_container_add(GTK_CONTAINER(
705 gtk_dialog_get_content_area(GTK_DIALOG(dialog))), label);
706 gtk_widget_show_all(dialog);
722 if (total_time == -1)
739 if (selected_player == PLAYER_SNACKAMP)
744 g_source_remove(timeout_id);
745 timer_active = FALSE;
757 if (!we_are_splitting)
759 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(percent_progress_bar), 0);
760 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(percent_progress_bar),
"");
766 file_in_entry = TRUE;
767 gtk_widget_set_sensitive(play_button, TRUE);
768 gtk_button_set_image(GTK_BUTTON(play_button), g_object_ref(PlayButton_active));
774 void restart_player_timer()
778 g_source_remove(timeout_id);
779 timeout_id = g_timeout_add(timeout_value,
mytimer, NULL);
801 if (selected_player != PLAYER_GSTREAMER)
807 gtk_widget_set_sensitive(pause_button, TRUE);
808 gtk_button_set_image(GTK_BUTTON(pause_button), g_object_ref(PauseButton_active));
809 gtk_widget_set_sensitive(stop_button, TRUE);
810 gtk_button_set_image(GTK_BUTTON(stop_button), g_object_ref(StopButton_active));
818 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pause_button)))
820 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pause_button), FALSE);
830 gtk_widget_set_sensitive(pause_button, FALSE);
831 gtk_button_set_image(GTK_BUTTON(pause_button), g_object_ref(PauseButton_inactive));
832 gtk_widget_set_sensitive(stop_button, FALSE);
833 gtk_button_set_image(GTK_BUTTON(stop_button), g_object_ref(StopButton_inactive));
845 if (!only_press_pause)
877 position = (player_seconds2 +
878 player_minutes2*60)*1000
879 +player_hundr_secs2*10;
887 if (gtk_toggle_button_get_active(widget))
889 show_silence_wave = TRUE;
890 if (number_of_silence_points == 0)
897 show_silence_wave = FALSE;
898 if (we_scan_for_silence)
903 if (silence_points != NULL)
905 g_free(silence_points);
906 silence_points = NULL;
908 number_of_silence_points = 0;
910 refresh_drawing_area();
914 void build_path(GString *path,
const gchar *dir,
const gchar *filename)
917 g_string_assign(path,
".");
918 g_string_append(path, G_DIR_SEPARATOR_S);
919 g_string_append(path, filename);
921 if (strlen(dir) == 0)
923 g_string_assign(path, filename);
927 g_string_assign(path, dir);
928 g_string_append(path, G_DIR_SEPARATOR_S);
929 g_string_append(path, filename);
934 GtkWidget *create_volume_button()
936 volume_button = gtk_volume_button_new();
938 g_signal_connect(G_OBJECT(volume_button),
"button-press-event",
940 g_signal_connect(G_OBJECT(volume_button),
"button-release-event",
942 g_signal_connect(G_OBJECT(volume_button),
"enter-notify-event",
944 g_signal_connect(G_OBJECT(volume_button),
"leave-notify-event",
947 g_signal_connect(GTK_SCALE_BUTTON(volume_button),
"value_changed", G_CALLBACK(
change_volume_event), NULL);
949 gtk_widget_set_sensitive(GTK_WIDGET(volume_button), FALSE);
951 return volume_button;
957 player_buttons_hbox = gtk_hbox_new(FALSE, 0);
960 GString *Imagefile = g_string_new(
"");
962 build_path(Imagefile, IMAGEDIR,
"backward"ICON_EXT);
963 Go_BegButton_active= gtk_image_new_from_file(Imagefile->str);
965 build_path(Imagefile, IMAGEDIR,
"backward_inactive"ICON_EXT);
966 Go_BegButton_inactive= gtk_image_new_from_file(Imagefile->str);
967 go_beg_button = gtk_button_new();
968 gtk_button_set_image(GTK_BUTTON(go_beg_button), g_object_ref(Go_BegButton_inactive));
971 gtk_box_pack_start(GTK_BOX(player_buttons_hbox), go_beg_button, FALSE, FALSE, 0);
972 gtk_button_set_relief(GTK_BUTTON(go_beg_button), GTK_RELIEF_NONE);
973 g_signal_connect(G_OBJECT(go_beg_button),
"clicked",
976 gtk_widget_set_sensitive(go_beg_button, FALSE);
977 gtk_widget_set_tooltip_text(go_beg_button, _(
"Previous"));
980 build_path(Imagefile, IMAGEDIR,
"play"ICON_EXT);
981 PlayButton_active= gtk_image_new_from_file(Imagefile->str);
983 build_path(Imagefile, IMAGEDIR,
"play_inactive"ICON_EXT);
984 PlayButton_inactive= gtk_image_new_from_file(Imagefile->str);
985 play_button = gtk_button_new();
986 gtk_button_set_image(GTK_BUTTON(play_button), g_object_ref(PlayButton_inactive));
989 gtk_box_pack_start(GTK_BOX(player_buttons_hbox), play_button, FALSE, FALSE, 0);
990 gtk_button_set_relief(GTK_BUTTON(play_button), GTK_RELIEF_NONE);
991 g_signal_connect(G_OBJECT(play_button),
"clicked",
994 gtk_widget_set_sensitive(play_button, FALSE);
995 gtk_widget_set_tooltip_text(play_button,_(
"Play"));
998 build_path(Imagefile, IMAGEDIR,
"pause"ICON_EXT);
999 PauseButton_active= gtk_image_new_from_file(Imagefile->str);
1001 build_path(Imagefile, IMAGEDIR,
"pause_inactive"ICON_EXT);
1002 PauseButton_inactive= gtk_image_new_from_file(Imagefile->str);
1003 pause_button = gtk_toggle_button_new();
1004 gtk_button_set_image(GTK_BUTTON(pause_button), g_object_ref(PauseButton_inactive));
1006 gtk_box_pack_start(GTK_BOX(player_buttons_hbox), pause_button, FALSE, FALSE, 0);
1007 gtk_button_set_relief(GTK_BUTTON(pause_button), GTK_RELIEF_NONE);
1008 g_signal_connect(G_OBJECT(pause_button),
"clicked",
1010 gtk_widget_set_sensitive(pause_button, FALSE);
1011 gtk_widget_set_tooltip_text(pause_button,_(
"Pause"));
1014 build_path(Imagefile, IMAGEDIR,
"stop"ICON_EXT);
1015 StopButton_active= gtk_image_new_from_file(Imagefile->str);
1017 build_path(Imagefile, IMAGEDIR,
"stop_inactive"ICON_EXT);
1018 StopButton_inactive= gtk_image_new_from_file(Imagefile->str);
1019 stop_button = gtk_button_new();
1020 gtk_button_set_image(GTK_BUTTON(stop_button), g_object_ref(StopButton_inactive));
1022 gtk_box_pack_start(GTK_BOX(player_buttons_hbox), stop_button, FALSE, FALSE, 0);
1023 gtk_button_set_relief(GTK_BUTTON(stop_button), GTK_RELIEF_NONE);
1024 g_signal_connect(G_OBJECT(stop_button),
"clicked",
1027 gtk_widget_set_sensitive(stop_button, FALSE);
1028 gtk_widget_set_tooltip_text(stop_button,_(
"Stop"));
1031 build_path(Imagefile, IMAGEDIR,
"forward"ICON_EXT);
1032 Go_EndButton_active= gtk_image_new_from_file(Imagefile->str);
1034 build_path(Imagefile, IMAGEDIR,
"forward_inactive"ICON_EXT);
1035 Go_EndButton_inactive= gtk_image_new_from_file(Imagefile->str);
1036 go_end_button = gtk_button_new();
1037 gtk_button_set_image(GTK_BUTTON(go_end_button), g_object_ref(Go_EndButton_inactive));
1039 gtk_box_pack_start(GTK_BOX(player_buttons_hbox), go_end_button, FALSE, FALSE, 0);
1040 gtk_button_set_relief(GTK_BUTTON(go_end_button), GTK_RELIEF_NONE);
1041 g_signal_connect(G_OBJECT(go_end_button),
"clicked",
1044 gtk_widget_set_sensitive(go_end_button, FALSE);
1045 gtk_widget_set_tooltip_text(go_end_button,_(
"Next"));
1046 g_string_free(Imagefile,TRUE);
1048 GtkWidget *vol_button = (GtkWidget *)create_volume_button();
1049 gtk_box_pack_start(GTK_BOX(player_buttons_hbox), vol_button, FALSE, FALSE, 5);
1052 player_add_button = (GtkWidget *)
create_cool_button(GTK_STOCK_ADD, _(
"_Add"), FALSE);
1054 gtk_box_pack_start (GTK_BOX(player_buttons_hbox), player_add_button, FALSE, FALSE, 0);
1055 gtk_button_set_relief(GTK_BUTTON(player_add_button), GTK_RELIEF_NONE);
1056 g_signal_connect(G_OBJECT(player_add_button),
"clicked",
1057 G_CALLBACK(add_splitpoint_from_player),
1059 gtk_widget_set_sensitive(player_add_button, FALSE);
1060 gtk_widget_set_tooltip_text(player_add_button,_(
"Add splitpoint from player"));
1063 silence_wave_check_button = (GtkWidget *)
1064 gtk_check_button_new_with_mnemonic(_(
"Amplitude _wave"));
1065 gtk_box_pack_end(GTK_BOX(player_buttons_hbox), silence_wave_check_button,
1067 g_signal_connect(G_OBJECT(silence_wave_check_button),
"toggled",
1069 gtk_widget_set_sensitive(silence_wave_check_button, FALSE);
1070 gtk_widget_set_tooltip_text(silence_wave_check_button,
1071 _(
"Shows the amplitude level wave"));
1074 connect_button = (GtkWidget *)
1076 g_signal_connect(G_OBJECT(connect_button),
"clicked",
1078 gtk_widget_set_tooltip_text(connect_button,_(
"Connect to player"));
1081 disconnect_button = (GtkWidget *)
1083 g_signal_connect(G_OBJECT (disconnect_button),
"clicked",
1085 gtk_widget_set_tooltip_text(disconnect_button,_(
"Disconnect from player"));
1087 return player_buttons_hbox;
1093 GtkWidget *song_info_hbox;
1095 song_info_hbox = gtk_hbox_new (FALSE, 0);
1097 song_infos = gtk_label_new (
"");
1098 gtk_box_pack_start (GTK_BOX (song_info_hbox), song_infos, FALSE, FALSE, 40);
1101 label_time = gtk_label_new(
"");
1102 gtk_box_pack_start (GTK_BOX (song_info_hbox), label_time, FALSE, FALSE, 5);
1104 return song_info_hbox;
1109 GdkEventCrossing *event,
1114 player_minutes = player_minutes2;
1115 player_seconds = player_seconds2;
1116 player_hundr_secs = player_hundr_secs2;
1118 mouse_on_progress_bar = FALSE;
1125 GdkEventCrossing *event,
1128 mouse_on_progress_bar = TRUE;
1141 gfloat adj_position = gtk_adjustment_get_value(GTK_ADJUSTMENT(progress_adj));
1142 return (adj_position * total_time) / 100000;
1145 void refresh_drawing_area()
1147 gtk_widget_queue_draw(drawing_area);
1153 if (!we_are_splitting)
1157 gfloat total_interval = 0;
1158 gfloat progress_time = 0;
1159 gint splitpoint_time_left = -1;
1160 gint splitpoint_time_right = -1;
1161 gint splitpoint_left_index = -1;
1162 get_splitpoint_time_left_right(&splitpoint_time_left,
1163 &splitpoint_time_right, &splitpoint_left_index);
1165 if ((splitpoint_time_left != -1) &&
1166 (splitpoint_time_right != -1))
1169 total_interval = splitpoint_time_right - splitpoint_time_left;
1170 if (total_interval != 0)
1172 progress_time = (current_time-splitpoint_time_left)/
1178 if (splitpoint_time_right == -1)
1180 total_interval = total_time - splitpoint_time_left;
1181 if (total_interval != 0)
1183 progress_time = (current_time-splitpoint_time_left)/
1189 total_interval = splitpoint_time_right;
1190 if (total_interval != 0)
1192 progress_time = current_time/total_interval;
1198 if (progress_time < 0)
1202 if (progress_time > 1)
1206 if ((progress_time >= 0) && (progress_time <= 1))
1208 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(percent_progress_bar), progress_time);
1212 gchar description_shorted[512] = {
'\0' };
1215 if (splitpoint_time_right != -1)
1217 if (splitpoint_time_left == -1)
1219 if (progress_description != NULL)
1221 g_snprintf(description_shorted,60, _(
"before %s"), progress_description);
1226 if (progress_description != NULL)
1228 g_snprintf(description_shorted, 60,
"%s", progress_description);
1234 if (splitpoint_time_left != -1)
1236 if (progress_description != NULL)
1238 g_snprintf(description_shorted, 60,
"%s", progress_description);
1247 g_snprintf(description_shorted,60,
"%s",fname);
1250 if (strlen(fname) > 60)
1252 description_shorted[strlen(description_shorted)-1] =
'.';
1253 description_shorted[strlen(description_shorted)-2] =
'.';
1254 description_shorted[strlen(description_shorted)-3] =
'.';
1260 if (progress_description != NULL)
1262 if (strlen(progress_description) > 60)
1264 description_shorted[strlen(description_shorted)-1] =
'.';
1265 description_shorted[strlen(description_shorted)-2] =
'.';
1266 description_shorted[strlen(description_shorted)-3] =
'.';
1270 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(percent_progress_bar),
1271 description_shorted);
1272 g_free(progress_description);
1279 refresh_drawing_area();
1282 gfloat adj_position =
1283 (gint)gtk_adjustment_get_value(GTK_ADJUSTMENT(progress_adj));
1286 player_hundr_secs2 = (gint)current_time % 100;
1290 tt2 = total_time / 100;
1291 current_time = (adj_position * tt2) / 100000;
1293 player_seconds2 = (gint)current_time % 60;
1294 player_minutes2 = (gint)current_time / 60;
1303 GdkEventScroll *event,
1312 GdkEventCrossing *event,
1321 GdkEventCrossing *event,
1331 GtkWidget *song_bar_hbox;
1334 song_bar_hbox = gtk_hbox_new (FALSE, 0);
1335 progress_adj = (GtkWidget *)gtk_adjustment_new (0.0, 0.0, 100001.0, 0, 10000, 1000);
1336 progress_bar = gtk_hscale_new (GTK_ADJUSTMENT (progress_adj));
1337 g_object_set(progress_bar,
"draw-value", FALSE, NULL);
1339 g_signal_connect (G_OBJECT (progress_bar),
"button-press-event",
1342 g_signal_connect (G_OBJECT (progress_bar),
"button-release-event",
1345 g_signal_connect (G_OBJECT (progress_bar),
"enter-notify-event",
1348 g_signal_connect (G_OBJECT (progress_bar),
"leave-notify-event",
1351 g_signal_connect (G_OBJECT (progress_bar),
"value-changed",
1354 g_signal_connect (G_OBJECT (progress_bar),
"scroll-event",
1357 gtk_widget_set_sensitive(GTK_WIDGET(progress_bar), FALSE);
1359 gtk_box_pack_start (GTK_BOX (song_bar_hbox), progress_bar, TRUE, TRUE, 5);
1361 return song_bar_hbox;
1367 gchar total_infos[512];
1371 gtk_label_set_text(GTK_LABEL(song_infos), total_infos);
1379 if ((fname != NULL) &&
1380 (strcmp(fname,
"disconnect")))
1387 gchar new_title[90];
1388 g_snprintf(new_title,75,
"%s",title);
1391 if (strlen(title) > 75)
1393 new_title[strlen(new_title)-1] =
'.';
1394 new_title[strlen(new_title)-2] =
'.';
1395 new_title[strlen(new_title)-3] =
'.';
1398 gtk_label_set_text(GTK_LABEL(song_name_label),
1426 gchar seconds[16], minutes[16], seconds_minutes[64];
1431 player_hundr_secs = (time % 1000) / 10;
1433 temp = (time/1000)/60;
1436 player_minutes = temp;
1437 player_seconds = (time/1000) - (temp*60);
1439 g_snprintf(minutes, 16,
"%d", temp);
1440 g_snprintf(seconds, 16,
"%d", (time/1000) - (temp*60));
1443 gchar total_seconds[16], total_minutes[16];
1446 tt = total_time * 10;
1447 temp = (tt/1000)/60;
1450 g_snprintf(total_minutes, 16,
"%d", temp);
1451 g_snprintf(total_seconds, 16,
"%d", (tt/1000) - (temp*60));
1452 g_snprintf(seconds_minutes, 64,
"%s : %s / %s : %s",
1453 minutes, seconds, total_minutes, total_seconds);
1455 gtk_label_set_text(GTK_LABEL(label_time), seconds_minutes);
1472 gtk_scale_button_set_value(GTK_SCALE_BUTTON(volume_button), volume / 100.0);
1479 && (!mouse_on_progress_bar))
1482 gdouble adj_position;
1487 current_time = ((player_seconds + player_minutes*60)*100
1488 + player_hundr_secs);
1490 adj_position = (current_time *100000) / total_time;
1492 gtk_adjustment_set_value(GTK_ADJUSTMENT(progress_adj), (gdouble) adj_position);
1497 gint stop_splitpoint
1500 gint start_splitpoint
1503 if ((stop_splitpoint < (gint)(current_time-150))
1504 || (start_splitpoint > (gint)(current_time+150)))
1514 GtkWidget *filename_player_hbox;
1517 filename_player_hbox = gtk_hbox_new (FALSE, 0);
1518 song_name_label = gtk_label_new (
"");
1519 g_object_set(G_OBJECT(song_name_label),
"selectable", FALSE, NULL);
1520 gtk_box_pack_start (GTK_BOX (filename_player_hbox), song_name_label, FALSE, FALSE, 15);
1522 return filename_player_hbox;
1528 if (!gtk_widget_get_sensitive(GTK_WIDGET(volume_button)))
1539 change_volume = TRUE;
1546 change_volume = FALSE;
1553 on_the_volume_button = TRUE;
1560 on_the_volume_button = FALSE;
1568 GtkWidget *window_child;
1570 window_child = gtk_bin_get_child(GTK_BIN(window));
1572 gtk_widget_reparent(GTK_WIDGET(window_child), GTK_WIDGET(player_handle));
1574 gtk_widget_destroy(window);
1585 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1587 gtk_widget_reparent(GTK_WIDGET(widget), GTK_WIDGET(window));
1589 g_signal_connect(G_OBJECT(window),
"delete_event",
1593 gtk_widget_show(GTK_WIDGET(window));
1600 gfloat right = total_time / zoom_coeff;
1601 gfloat center = (right - left) / 2;
1602 gfloat offset = current_time - center;
1611 gfloat right = total_time / zoom_coeff;
1612 gfloat center = right/2;
1613 gfloat left = current_time - center;
1633 return (time / 100) % 60;
1652 gboolean hundr_or_not,
1653 gint *number_of_chars)
1662 g_snprintf(str,30,
"%d:%02d:%02d",
1668 g_snprintf(str,30,
"%d:%02d",
1678 return (width * time * zoom_coeff)/total_time;
1682 gfloat pixels_to_time(gfloat width, gint pixels)
1684 return (total_time * (gfloat)pixels)/(width * zoom_coeff);
1697 gfloat offset_time = time - current_time;
1699 position = width/2 + offset_pixel;
1704 static void set_color(cairo_t *cairo, GdkColor *color)
1706 gdk_cairo_set_source_color(cairo, color);
1709 static void draw_rectangle(cairo_t *cairo, gboolean filled, gint x, gint y,
1710 gint width, gint height)
1712 cairo_rectangle(cairo, x, y, width, height);
1719 cairo_stroke(cairo);
1722 static void draw_arc(cairo_t *cairo, gboolean filled, gint x, gint y,
1723 double radius,
double angle1,
double angle2)
1725 cairo_arc(cairo, x, y, radius, angle1, angle2);
1732 cairo_stroke(cairo);
1735 static void draw_text(cairo_t *cairo,
const gchar *text, gint x, gint y)
1737 cairo_select_font_face(cairo,
"Sans 11", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
1738 cairo_set_font_size(cairo, 11.0);
1740 cairo_move_to(cairo, x, y + 13);
1741 cairo_show_text(cairo, text);
1744 static void draw_line_with_width(cairo_t *cairo, gint x1, gint y1, gint x2, gint y2,
1745 gboolean line_is_dashed, gboolean stroke,
double line_width)
1747 double dashes[] = { 1.0, 3.0 };
1750 cairo_set_dash(cairo, dashes, 2, -50.0);
1754 cairo_set_dash(cairo, dashes, 0, 0.0);
1757 cairo_set_line_width(cairo, line_width);
1758 cairo_set_line_cap(cairo, CAIRO_LINE_CAP_ROUND);
1759 cairo_move_to(cairo, x1, y1);
1760 cairo_line_to(cairo, x2, y2);
1764 cairo_stroke(cairo);
1768 static void draw_line(cairo_t *cairo, gint x1, gint y1, gint x2, gint y2,
1769 gboolean line_is_dashed, gboolean stroke)
1771 draw_line_with_width(cairo, x1, y1, x2, y2, line_is_dashed, stroke, 1.2);
1774 static void draw_point(cairo_t *cairo, gint x, gint y)
1776 draw_line(cairo, x, y, x, y, FALSE, FALSE);
1779 void draw_motif(GtkWidget *da, cairo_t *gc, gint ylimit, gint x, gint model)
1785 color.red = 65000;color.green = 0;color.blue = 0;
1789 color.red = 0;color.green = 0;color.blue = 65000;
1793 color.red = 0;color.green = 65000;color.blue = 0;
1797 color.red = 65000;color.green = 0;color.blue = 40000;
1801 color.red = 1000;color.green = 10000;color.blue = 65000;
1805 color.red = 65000;color.green = 0;color.blue = 0;
1809 color.red = 0;color.green = 0;color.blue = 0;
1813 set_color (gc, &color);
1815 draw_point(gc,x,ylimit+6);
1816 draw_point(gc,x,ylimit+7);
1817 draw_point(gc,x,ylimit+8);
1818 draw_point(gc,x-1,ylimit+8);
1819 draw_point(gc,x+1,ylimit+8);
1820 draw_point(gc,x,ylimit+9);
1821 draw_point(gc,x-1,ylimit+9);
1822 draw_point(gc,x+1,ylimit+9);
1823 draw_point(gc,x-2,ylimit+9);
1824 draw_point(gc,x+2,ylimit+9);
1825 draw_point(gc,x-3,ylimit+9);
1826 draw_point(gc,x+3,ylimit+9);
1827 draw_point(gc,x,ylimit+10);
1828 draw_point(gc,x-1,ylimit+10);
1829 draw_point(gc,x+1,ylimit+10);
1830 draw_point(gc,x-2,ylimit+10);
1831 draw_point(gc,x+2,ylimit+10);
1832 draw_point(gc,x-3,ylimit+10);
1833 draw_point(gc,x+3,ylimit+10);
1837 color.red = 0;color.green = 0;color.blue = 0;
1838 set_color(gc, &color);
1843 gint right_mark, gint ylimit,
1844 GtkWidget *da, cairo_t *gc)
1846 gint left2 = (left_mark/time_interval) * time_interval;
1847 if (left2 < left_mark)
1848 left2 += time_interval;
1852 for (i=left2;i<=right_mark;i+=time_interval)
1856 switch(time_interval){
1858 draw_motif(da, gc, ylimit, i_pixel,0);
1861 draw_motif(da, gc, ylimit,i_pixel,1);
1864 draw_motif(da, gc, ylimit,i_pixel,2);
1867 draw_motif(da, gc, ylimit,i_pixel,3);
1870 draw_motif(da, gc, ylimit,i_pixel,4);
1873 draw_motif(da, gc, ylimit,i_pixel,5);
1876 draw_motif(da, gc, ylimit,i_pixel,6);
1906 gint current_point_hundr_secs,
1908 gint number_splitpoint)
1913 gboolean splitpoint_checked = point.checked;
1916 color.red = 255 * 212;
1917 color.green = 255 * 100;
1918 color.blue = 255 * 200;
1919 set_color (gc, &color);
1940 color.red = 255 * 220;
1941 color.green = 255 * 220;
1942 color.blue = 255 * 255;
1944 set_color (gc, &color);
1953 color.red = 255 * 212;
1954 color.green = 255 * 196;
1955 color.blue = 255 * 221;
1957 set_color (gc, &color);
1962 draw_point (gc,x+i,erase_split_ylimit + m + 3);
1963 draw_point (gc,x-i,erase_split_ylimit + m + 3);
1964 draw_point (gc,x+i,erase_split_ylimit + m + 4);
1965 draw_point (gc,x-i,erase_split_ylimit + m + 4);
1973 if (splitpoint_checked)
1975 color.red = 15000;color.green = 40000;color.blue = 25000;
1979 color.red = 25000;color.green = 25000;color.blue = 40000;
1981 set_color (gc, &color);
1983 draw_line(gc, x,erase_split_ylimit + m -8, x,progress_ylimit + m, TRUE, TRUE);
1986 color.red = 255 * 22;
1987 color.green = 255 * 35;
1988 color.blue = 255 * 91;
1990 set_color (gc, &color);
1993 for (i = -3;i <= 1;i++)
1995 draw_point (gc,x,erase_split_ylimit + m +i);
1997 for (i = 2;i <= 5;i++)
1999 draw_point (gc,x,erase_split_ylimit + m + i);
2001 for (i = 3;i <= 4;i++)
2003 draw_point (gc,x-1,erase_split_ylimit + m + i);
2004 draw_point (gc,x+1,erase_split_ylimit + m + i);
2006 for (i = 6;i <= 11;i++)
2008 draw_point (gc,x,erase_split_ylimit + m + i);
2012 for (i = 0;i < margin;i++)
2014 draw_point (gc,x,progress_ylimit + m - i);
2018 for (i = 0;i < margin;i++)
2020 draw_point (gc,x,splitpoint_ypos + m - i - 1);
2025 set_color (gc, &color);
2026 color.red = 25000;color.green = 25000;color.blue = 25000;
2029 FALSE, x-6,splitpoint_ypos + m, 12,12);
2032 if (splitpoint_checked)
2038 gint top = splitpoint_ypos + m;
2039 gint bottom = splitpoint_ypos + m + 12;
2040 draw_line(gc, left, top, right, bottom, FALSE, TRUE);
2041 draw_line(gc, left, bottom, right, top, FALSE, TRUE);
2046 if (splitpoint_checked)
2048 color.red = 15000;color.green = 40000;color.blue = 25000;
2052 color.red = 25000;color.green = 25000;color.blue = 40000;
2054 set_color(gc, &color);
2056 draw_arc(gc, FALSE, x, progress_ylimit + m+ 1 + 7, 14 / 2, 0, 2 * G_PI);
2061 draw_arc(gc, TRUE, x, progress_ylimit + m + 1 + 8, 16 / 2, 0, 2 * G_PI);
2066 gint number_of_chars = 0;
2067 gchar str[30] = {
'\0' };
2069 draw_text(gc, str, x - (number_of_chars * 3), checkbox_ypos + margin - 1);
2072 if (show_silence_wave)
2075 color.red = 0;color.green = 0;color.blue = 0;
2076 set_color(gc, &color);
2078 gboolean dashed = FALSE;
2079 if (move) { dashed = TRUE; }
2080 draw_line(gc, x,text_ypos + margin, x,wave_ypos, dashed, TRUE);
2089 gint current_point_hundr_secs;
2097 current_point_hundr_secs =
2098 current_point.hundr_secs +
2099 current_point.secs * 100 +
2100 current_point.mins * 6000;
2104 if ((current_point_hundr_secs <= right_mark)
2105 &&(current_point_hundr_secs >= left_mark))
2111 gboolean draw = TRUE;
2112 if (splitpoint_to_move == i)
2119 current_point_hundr_secs);
2121 current_point_hundr_secs,
2127 gint get_silence_wave_coeff()
2129 gint points_coeff = 1;
2132 gfloat num_of_points_coeff_f =
2133 ceil((number_of_silence_points / total_time) * 10);
2134 gint num_of_points_coeff = (gint) num_of_points_coeff_f;
2135 gint coeff_adjust = 4;
2136 if (num_of_points_coeff == 1)
2141 if (total_draw_time < secs_th)
2145 else if (total_draw_time < ten_secs_th)
2147 points_coeff = 2 * num_of_points_coeff;
2149 else if (total_draw_time < minutes_th)
2151 points_coeff = 4 * coeff_adjust * num_of_points_coeff;
2153 else if (total_draw_time < ten_minutes_th)
2155 points_coeff = 8 * coeff_adjust * num_of_points_coeff;
2159 points_coeff = 32 * coeff_adjust * num_of_points_coeff;
2162 return points_coeff;
2168 if (!silence_points || we_scan_for_silence)
2174 color.red = 0;color.green = 0;color.blue = 0;
2175 set_color(gc, &color);
2178 gint points_coeff = get_silence_wave_coeff();
2182 gint previous_x = 0;
2183 gint previous_y = 0;
2185 for (i = 0;i < number_of_silence_points;i++)
2187 long time = silence_points[i].time;
2188 float level = silence_points[i].level;
2190 if ((time <= right_mark) && (time >= left_mark))
2192 if (i % points_coeff == 0)
2196 gint y = text_ypos + margin + (gint)floorf(level);
2200 cairo_move_to(gc, x, y);
2204 draw_line_with_width(gc, previous_x, previous_y, x, y, FALSE, FALSE, 1.0);
2219 #if GTK_MAJOR_VERSION <= 2
2220 gboolean da_draw_event(GtkWidget *da, GdkEventExpose *event, gpointer data)
2222 cairo_t *gc = gdk_cairo_create(da->window);
2224 gboolean da_draw_event(GtkWidget *da, cairo_t *gc, gpointer data)
2228 if (drawing_area_expander != NULL &&
2229 !gtk_expander_get_expanded(GTK_EXPANDER(drawing_area_expander)))
2234 int width = 0, height = 0;
2235 wh_get_widget_size(da, &width, &height);
2236 if (show_silence_wave)
2238 if (height != DRAWING_AREA_HEIGHT_WITH_SILENCE_WAVE)
2240 gtk_widget_set_size_request(da,
2241 DRAWING_AREA_WIDTH, DRAWING_AREA_HEIGHT_WITH_SILENCE_WAVE);
2246 if (height != DRAWING_AREA_HEIGHT)
2248 gtk_widget_set_size_request(da, DRAWING_AREA_WIDTH, DRAWING_AREA_HEIGHT);
2256 real_erase_split_length = 12;
2257 real_progress_length = 26;
2258 real_move_split_length = 16;
2259 real_checkbox_length = 12;
2260 real_text_length = 12;
2261 real_wave_length = 96;
2263 gint erase_splitpoint_length = real_erase_split_length + (margin * 2);
2264 gint progress_length = real_progress_length + margin;
2265 gint move_split_length = real_move_split_length + margin;
2266 gint text_length = real_text_length + margin;
2267 gint checkbox_length = real_checkbox_length + margin;
2268 gint wave_length = real_wave_length + margin;
2271 erase_split_ylimit = erase_splitpoint_length;
2272 progress_ylimit = erase_split_ylimit + progress_length;
2273 splitpoint_ypos = progress_ylimit + move_split_length;
2274 checkbox_ypos = splitpoint_ypos + checkbox_length;
2275 text_ypos = checkbox_ypos + text_length + margin;
2276 wave_ypos = text_ypos + wave_length + margin;
2278 gint bottom_left_middle_right_text_ypos = text_ypos;
2279 if (show_silence_wave)
2281 bottom_left_middle_right_text_ypos = wave_ypos;
2287 wh_get_widget_size(da, &width_drawing_area, NULL);
2289 color.red = 255 * 235;color.green = 255 * 235;
2290 color.blue = 255 * 235;
2291 set_color (gc, &color);
2295 width_drawing_area, wave_ypos + text_length + 2);
2297 color.red = 255 * 255;color.green = 255 * 255;color.blue = 255 * 255;
2298 set_color (gc, &color);
2305 real_erase_split_length);
2308 0,erase_split_ylimit,
2313 0,progress_ylimit+margin,
2315 real_move_split_length);
2318 0,splitpoint_ypos+margin,
2320 real_checkbox_length);
2323 0,checkbox_ypos+margin,
2326 if (show_silence_wave)
2328 draw_rectangle (gc, TRUE, 0, text_ypos + margin,
2329 width_drawing_area, wave_length);
2334 if(playing && timer_active)
2341 center_time = current_time;
2344 gint left_mark = (gint)left_time;
2345 gint right_mark = (gint)right_time;
2350 if (right_mark > total_time)
2352 right_mark = (gint)total_time;
2356 total_draw_time = right_time - left_time;
2358 gchar str[30] = {
'\0' };
2361 gint splitpoint_time_left = -1;
2362 gint splitpoint_time_right = -1;
2363 gint splitpoint_pixels_left = -1;
2364 gint splitpoint_pixels_right = -1;
2365 gint splitpoint_pixels_length = -1;
2366 gint splitpoint_left_index = -1;
2367 get_splitpoint_time_left_right(&splitpoint_time_left,
2368 &splitpoint_time_right,
2369 &splitpoint_left_index);
2371 if ((splitpoint_time_left != -1) &&
2372 (splitpoint_time_right != -1))
2376 splitpoint_time_left);
2378 splitpoint_time_right);
2379 splitpoint_pixels_length =
2380 splitpoint_pixels_right - splitpoint_pixels_left;
2384 color.red = 255 * 255;color.green = 255 * 255;
2385 color.blue = 255 * 210;
2387 set_color (gc, &color);
2389 TRUE,splitpoint_pixels_left,
2391 splitpoint_pixels_length,
2393 erase_split_ylimit+1);
2397 color.red = 255 * 150;
2398 color.green = 255 * 150;
2399 color.blue = 255 * 255;
2401 set_color (gc, &color);
2413 gint preview_splitpoint_length =
2414 right_pixel - left_pixel + 1;
2420 preview_splitpoint_length,3);
2425 color.red = 255 * 255;color.green = 255 * 160;color.blue = 255 * 160;
2427 set_color (gc, &color);
2432 preview_splitpoint_length,
2449 width_drawing_area-left_pixel,
2454 color.red = 255 * 255;color.green = 255 * 160;color.blue = 255 * 160;
2456 set_color (gc, &color);
2461 width_drawing_area-left_pixel,
2468 if ( left_time <= 0 )
2470 color.red = 255 * 235;color.green = 255 * 235;
2471 color.blue = 255 * 235;
2473 set_color (gc, &color);
2482 color.red = 30000;color.green = 0;color.blue = 30000;
2484 set_color (gc, &color);
2487 draw_text(gc, str, 15, bottom_left_middle_right_text_ypos);
2493 if ( right_time >= total_time )
2495 color.red = 255 * 235;color.green = 255 * 235;
2496 color.blue = 255 * 235;
2498 set_color (gc, &color);
2503 bottom_left_middle_right_text_ypos);
2507 color.red = 30000;color.green = 0;color.blue = 30000;
2509 set_color (gc, &color);
2512 draw_text(gc, str, width_drawing_area - 52, bottom_left_middle_right_text_ypos);
2515 if (total_draw_time < hundr_secs_th)
2519 erase_split_ylimit+ progress_length/4,
2523 if (total_draw_time < tens_of_secs_th)
2527 erase_split_ylimit+ progress_length/4,
2531 if (total_draw_time < secs_th)
2535 erase_split_ylimit+ progress_length/4,
2539 if (total_draw_time < ten_secs_th)
2543 left_mark, right_mark,
2544 erase_split_ylimit+ progress_length/4,
2548 if (total_draw_time < minutes_th)
2552 left_mark, right_mark,
2553 erase_split_ylimit+ progress_length/4,
2557 if (total_draw_time < ten_minutes_th)
2561 left_mark, right_mark,
2562 erase_split_ylimit+ progress_length/4,
2568 left_mark, right_mark,
2569 erase_split_ylimit+progress_length/4,
2573 if (button1_pressed)
2575 gint move_time_bis = (gint)move_time;
2578 if (!move_splitpoints && !remove_splitpoints)
2582 if (selected_player == PLAYER_AUDACIOUS)
2583 move_time_bis = (move_time_bis / 100) * 100;
2591 if (move_splitpoints)
2594 TRUE, splitpoint_to_move);
2597 color.red = 0;color.green = 0;color.blue = 0;
2599 set_color (gc, &color);
2602 draw_text(gc, str, width_drawing_area/2-11, bottom_left_middle_right_text_ypos);
2608 color.red = 255 * 255;color.green = 0;color.blue = 0;
2609 set_color(gc, &color);
2611 draw_line(gc, move_pixel,erase_split_ylimit, move_pixel,progress_ylimit, TRUE, TRUE);
2613 if (show_silence_wave)
2615 draw_line(gc, move_pixel,text_ypos + margin, move_pixel,wave_ypos, TRUE, TRUE);
2619 color.red = 0;color.green = 0;color.blue = 0;
2621 set_color (gc, &color);
2624 draw_text(gc, str, width_drawing_area/2-11, bottom_left_middle_right_text_ypos);
2630 color.red = 0;color.green = 0;color.blue = 0;
2632 set_color (gc, &color);
2635 draw_text(gc, str, width_drawing_area/2-11, bottom_left_middle_right_text_ypos);
2639 color.red = 0;color.green = 0;color.blue = 0;
2641 set_color (gc, &color);
2644 color.red = 255 * 255;color.green = 0;color.blue = 0;
2645 set_color(gc, &color);
2648 draw_line(gc, width_drawing_area/2,erase_split_ylimit,
2649 width_drawing_area/2,progress_ylimit, FALSE, TRUE);
2652 if (show_silence_wave)
2657 color.red = 255 * 255;color.green = 0;color.blue = 0;
2658 set_color(gc, &color);
2661 draw_line(gc, width_drawing_area/2,text_ypos + margin, width_drawing_area/2, wave_ypos, FALSE, TRUE);
2669 color.red = 255 * 212; color.green = 255 * 100; color.blue = 255 * 200;
2670 set_color (gc, &color);
2671 draw_text(gc, _(
" left click on splitpoint selects it, right click erases it"),
2674 color.red = 0;color.green = 0;color.blue = 0;
2675 set_color (gc, &color);
2676 draw_text(gc, _(
" left click + move changes song position, right click + move changes zoom"),
2677 0, erase_split_ylimit + margin);
2679 color.red = 15000;color.green = 40000;color.blue = 25000;
2680 set_color (gc, &color);
2682 _(
" left click on point + move changes point position, right click play preview"),
2683 0, progress_ylimit + margin);
2685 color.red = 0; color.green = 0; color.blue = 0;
2686 set_color (gc, &color);
2687 draw_text(gc, _(
" left click on rectangle checks/unchecks 'keep splitpoint'"),
2688 0, splitpoint_ypos + 1);
2691 #if GTK_MAJOR_VERSION <= 2
2699 void get_splitpoint_time_left_right(gint *time_left,
2701 gint *splitpoint_left)
2705 gint current_point_hundr_secs;
2712 current_point_hundr_secs =
2713 current_point.hundr_secs +
2714 current_point.secs * 100 +
2715 current_point.mins * 6000;
2719 if (current_point_hundr_secs < current_time+DELTA)
2721 *time_left = current_point_hundr_secs;
2725 if (current_point_hundr_secs > current_time)
2727 *time_right = current_point_hundr_secs;
2728 *splitpoint_left = i;
2734 if (*splitpoint_left == -1)
2754 gint time_pos,time_right_pos,time_margin;
2760 if (type_clicked != 3)
2763 time_pos = left_time + pixels_to_time(width_drawing_area,button_x);
2768 time_pos = left_time + pixels_to_time(width_drawing_area,button_x2);
2773 gint pixels_to_look_for = real_erase_split_length / 2;
2776 pixels_to_look_for = real_move_split_length / 2;
2779 if (type_clicked != 3)
2781 time_right_pos = left_time+
2782 pixels_to_time(width_drawing_area,button_x + pixels_to_look_for);
2786 time_right_pos = left_time+
2787 pixels_to_time(width_drawing_area,button_x2 + pixels_to_look_for);
2792 time_margin = time_right_pos - time_pos;
2794 gint margin1, margin2;
2798 margin1 = progress_ylimit + margin;
2799 margin2 = progress_ylimit + margin + real_move_split_length;
2804 margin2 = margin + real_erase_split_length;
2808 margin1 = splitpoint_ypos + margin;
2809 margin2 = splitpoint_ypos + margin + real_checkbox_length;
2812 gint splitpoint_returned = -1;
2815 if ((but_y > margin1) && (but_y < margin2))
2820 gint current_point_hundr_secs;
2821 gint current_point_left,current_point_right;
2828 current_point_hundr_secs = current_point.hundr_secs +
2829 current_point.secs * 100 + current_point.mins * 6000;
2831 current_point_left = current_point_hundr_secs - time_margin;
2833 current_point_right = current_point_hundr_secs + time_margin;
2836 if ((time_pos >= current_point_left) && (time_pos <= current_point_right))
2838 splitpoint_returned = i;
2844 return splitpoint_returned;
2850 if (splitpoint_to_preview != -1)
2863 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pause_button), FALSE);
2866 if (splitpoint_to_preview < splitnumber-1)
2894 GdkEventButton *event,
2899 if (playing && timer_active)
2901 if (event->button == 1)
2903 button_x =
event->x;
2904 button_y =
event->y;
2905 button1_pressed = TRUE;
2907 if ((button_y > progress_ylimit + margin) &&
2908 (button_y < progress_ylimit + margin + real_move_split_length))
2912 if (splitpoint_to_move != -1)
2914 move_splitpoints = TRUE;
2920 if ((button_y > margin) && (button_y < margin + real_erase_split_length))
2922 gint splitpoint_selected;
2927 if (splitpoint_selected != -1)
2929 select_splitpoints = TRUE;
2933 refresh_drawing_area();
2938 if ((button_y > splitpoint_ypos + margin) &&
2939 (button_y < splitpoint_ypos + margin + real_checkbox_length))
2942 if (splitpoint_selected != -1)
2944 check_splitpoint = TRUE;
2947 refresh_drawing_area();
2952 if (!move_splitpoints)
2954 move_time = current_time;
2964 if (event->button == 3)
2966 button_x2 =
event->x;
2967 button_y2 =
event->y;
2968 button2_pressed = TRUE;
2969 zoom_coeff_old = zoom_coeff;
2971 if ((button_y2 > progress_ylimit + margin) &&
2972 (button_y2 < progress_ylimit + margin + real_move_split_length))
2974 gint splitpoint_to_preview = -1;
2984 if ((button_y2 > margin) && (button_y2 < margin + real_erase_split_length))
2986 gint splitpoint_to_erase = -1;
2992 if (splitpoint_to_erase != -1)
2994 remove_splitpoints = TRUE;
2998 refresh_drawing_area();
3010 GdkEventButton *event,
3015 if (playing && timer_active)
3017 if (event->button == 1)
3019 button1_pressed = FALSE;
3021 if (!move_splitpoints && !remove_splitpoints &&
3022 !select_splitpoints && !check_splitpoint)
3065 if (move_splitpoints)
3069 splitpoint_to_move = -1;
3072 move_splitpoints = FALSE;
3073 select_splitpoints = FALSE;
3074 check_splitpoint = FALSE;
3078 if (event->button == 3)
3080 button2_pressed = FALSE;
3081 remove_splitpoints = FALSE;
3086 refresh_drawing_area();
3093 GdkEventMotion *event,
3098 if ((playing && timer_active) &&
3099 (button1_pressed || button2_pressed))
3102 GdkModifierType state;
3103 gdk_window_get_pointer (event->window, &x, &y, &state);
3107 wh_get_widget_size(drawing_area, &width, NULL);
3108 gfloat width_drawing_area = (gfloat) width;
3113 if (button1_pressed)
3116 if (move_splitpoints)
3118 gdouble splitpoint_time =
3121 move_time = splitpoint_time +
3122 pixels_to_time(width_drawing_area,(x - button_x));
3127 if (remove_splitpoints || select_splitpoints || check_splitpoint)
3129 move_time = current_time;
3133 move_time = current_time +
3134 pixels_to_time(width_drawing_area,(x - button_x));
3142 if (move_time > total_time)
3144 move_time = total_time;
3146 refresh_drawing_area();
3150 if (button2_pressed)
3152 gint diff = -((
event->x - button_x2) * 1);
3154 if (diff < (-width_drawing_area + 1))
3156 diff = -width_drawing_area + 1;
3158 if (diff > (width_drawing_area - 1))
3160 diff = width_drawing_area - 1;
3163 zoom_coeff = diff / (width_drawing_area);
3167 zoom_coeff = 1/(zoom_coeff+1);
3171 zoom_coeff = 1 - zoom_coeff;
3174 zoom_coeff = zoom_coeff_old * zoom_coeff;
3176 if (zoom_coeff < 0.2)
3180 if (zoom_coeff > 10 * total_time / 6000)
3182 zoom_coeff = 10 * total_time / 6000;
3185 refresh_drawing_area();
3194 static void drawing_area_expander_event(GObject *
object, GParamSpec *param_spec, gpointer data)
3201 GtkExpander *expander = GTK_EXPANDER(
object);
3202 if (gtk_expander_get_expanded(expander))
3204 gtk_widget_show(silence_wave_check_button);
3208 gtk_widget_hide(silence_wave_check_button);
3215 GtkWidget *frame = gtk_frame_new(NULL);
3221 gtk_widget_modify_bg(frame, GTK_STATE_NORMAL, &color);
3223 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_NONE);
3225 drawing_area = gtk_drawing_area_new();
3227 gtk_widget_set_size_request(drawing_area, DRAWING_AREA_WIDTH, DRAWING_AREA_HEIGHT);
3229 #if GTK_MAJOR_VERSION <= 2
3230 g_signal_connect(drawing_area,
"expose_event", G_CALLBACK(da_draw_event), NULL);
3232 g_signal_connect(drawing_area,
"draw", G_CALLBACK(da_draw_event), NULL);
3235 g_signal_connect(drawing_area,
"button_press_event", G_CALLBACK(
da_press_event), NULL);
3236 g_signal_connect(drawing_area,
"button_release_event", G_CALLBACK(
da_unpress_event), NULL);
3237 g_signal_connect(drawing_area,
"motion_notify_event", G_CALLBACK(
da_notify_event), NULL);
3239 gtk_widget_set_events(drawing_area, gtk_widget_get_events(drawing_area)
3240 | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK
3241 | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK
3242 | GDK_POINTER_MOTION_HINT_MASK);
3244 gtk_container_add(GTK_CONTAINER(frame), drawing_area);
3246 drawing_area_expander = gtk_expander_new_with_mnemonic(_(
"Splitpoints _view"));
3247 gtk_expander_set_expanded(GTK_EXPANDER(drawing_area_expander), TRUE);
3248 g_signal_connect(drawing_area_expander,
"notify::expanded", G_CALLBACK(drawing_area_expander_event), NULL);
3249 gtk_container_add(GTK_CONTAINER(drawing_area_expander), frame);
3251 return drawing_area_expander;
3262 GtkWidget *really_big_hbox = gtk_hbox_new(FALSE, 0);
3265 GtkWidget *main_hbox = gtk_hbox_new (FALSE, 0);
3266 gtk_box_pack_start (GTK_BOX(really_big_hbox), main_hbox, TRUE, TRUE, 4);
3268 vbox = gtk_vbox_new (FALSE, 0);
3269 gtk_box_pack_start(GTK_BOX(main_hbox), vbox, TRUE, TRUE, 0);
3272 player_handle = gtk_handle_box_new();
3273 gtk_container_add(GTK_CONTAINER (player_handle), GTK_WIDGET(really_big_hbox));
3275 g_signal_connect(player_handle,
"child-detached",
3281 gtk_container_set_border_width (GTK_CONTAINER (hbox), 0);
3282 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 5);
3286 gtk_container_set_border_width (GTK_CONTAINER (hbox), 0);
3287 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 3);
3292 gtk_container_set_border_width (GTK_CONTAINER (hbox), 0);
3293 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
3297 gtk_container_set_border_width(GTK_CONTAINER(drawing_area), 0);
3298 gtk_box_pack_start(GTK_BOX(vbox), drawing_area, FALSE, FALSE, 0);
3302 gtk_container_set_border_width(GTK_CONTAINER(hbox), 0);
3303 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
3305 return player_handle;
3314 gboolean name_already_exists_in_playlist = FALSE;
3317 GtkTreeModel *model;
3318 GtkTreeView *
tree_view = (GtkTreeView *)playlist_tree;
3320 model = gtk_tree_view_get_model(GTK_TREE_VIEW(tree_view));
3322 gchar *filename = NULL;
3324 GtkTreePath *path = NULL;
3326 while (i < playlist_tree_number)
3328 path = gtk_tree_path_new_from_indices(i ,-1);
3329 gtk_tree_model_get_iter(model, &iter, path);
3330 gtk_tree_model_get(model, &iter, COL_FILENAME, &filename, -1);
3331 if (strcmp(filename,name) == 0)
3333 name_already_exists_in_playlist = TRUE;
3340 if (! name_already_exists_in_playlist)
3342 gtk_widget_set_sensitive(playlist_remove_all_files_button,TRUE);
3343 gtk_list_store_append (GTK_LIST_STORE(model), &iter);
3346 gtk_list_store_set (GTK_LIST_STORE(model),
3351 playlist_tree_number++;
3359 if (playlist_handle_window == NULL)
3364 GtkWidget *window_child = gtk_bin_get_child(GTK_BIN(playlist_handle_window));
3365 gtk_widget_reparent(GTK_WIDGET(window_child), GTK_WIDGET(playlist_handle));
3366 gtk_widget_destroy(playlist_handle_window);
3372 playlist_handle_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
3374 gtk_widget_reparent(GTK_WIDGET(widget), GTK_WIDGET(playlist_handle_window));
3376 g_signal_connect(G_OBJECT(playlist_handle_window),
"delete_event",
3379 gtk_widget_show(GTK_WIDGET(playlist_handle_window));
3385 GtkListStore *model;
3387 model = gtk_list_store_new(PLAYLIST_COLUMNS,
3391 return GTK_TREE_MODEL(model);
3398 GtkTreeView *
tree_view = (GtkTreeView *) gtk_tree_view_new_with_model(model);
3399 gtk_tree_view_set_headers_visible(tree_view, FALSE);
3406 GtkCellRendererText *renderer;
3407 GtkTreeViewColumn *name_column;
3411 renderer = GTK_CELL_RENDERER_TEXT(gtk_cell_renderer_text_new());
3412 g_object_set_data(G_OBJECT(renderer),
"col", GINT_TO_POINTER(COL_NAME));
3413 name_column = gtk_tree_view_column_new_with_attributes
3414 (_(
"History"), GTK_CELL_RENDERER(renderer),
3415 "text", COL_NAME, NULL);
3427 gtk_tree_view_insert_column(GTK_TREE_VIEW(tree_view),
3428 GTK_TREE_VIEW_COLUMN(name_column), COL_NAME);
3431 gtk_tree_view_column_set_alignment(GTK_TREE_VIEW_COLUMN(name_column), 0.5);
3432 gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(name_column),
3433 GTK_TREE_VIEW_COLUMN_AUTOSIZE);
3440 GtkTreeModel *model;
3441 GtkTreeSelection *selection;
3442 GList *selected_list = NULL;
3445 model = gtk_tree_view_get_model(GTK_TREE_VIEW(playlist_tree));
3447 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(playlist_tree));
3449 selected_list = gtk_tree_selection_get_selected_rows(selection, &model);
3451 if (g_list_length(selected_list) > 0)
3453 gtk_widget_set_sensitive(playlist_remove_file_button, TRUE);
3457 gtk_widget_set_sensitive(playlist_remove_file_button, FALSE);
3465 GtkTreeModel *model;
3467 GList *selected_list = NULL;
3468 GList *current_element = NULL;
3469 GtkTreeSelection *selection;
3472 model = gtk_tree_view_get_model(GTK_TREE_VIEW(playlist_tree));
3474 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(playlist_tree));
3476 selected_list = gtk_tree_selection_get_selected_rows(selection, &model);
3479 gchar *filename = NULL;
3483 while (g_list_length(selected_list) > 0)
3486 current_element = g_list_last(selected_list);
3487 path = current_element->data;
3489 gtk_tree_model_get_iter(model, &iter, path);
3490 gtk_tree_model_get(model, &iter,
3491 COL_FILENAME, &filename, -1);
3493 gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
3494 selected_list = g_list_remove(selected_list, path);
3496 playlist_tree_number--;
3499 gtk_tree_path_free(path);
3503 if (playlist_tree_number == 0)
3505 gtk_widget_set_sensitive(playlist_remove_all_files_button, FALSE);
3508 gtk_widget_set_sensitive(playlist_remove_file_button,FALSE);
3511 g_list_foreach(selected_list, (GFunc)gtk_tree_path_free, NULL);
3512 g_list_free(selected_list);
3519 GtkTreeModel *model;
3521 model = gtk_tree_view_get_model(GTK_TREE_VIEW(playlist_tree));
3524 gchar *filename = NULL;
3526 while (playlist_tree_number > 0)
3528 gtk_tree_model_get_iter_first(model, &iter);
3529 gtk_tree_model_get(model, &iter,
3530 COL_FILENAME, &filename, -1);
3531 gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
3532 playlist_tree_number--;
3536 gtk_widget_set_sensitive(playlist_remove_all_files_button,FALSE);
3537 gtk_widget_set_sensitive(playlist_remove_file_button,FALSE);
3544 GtkWidget *hbox = gtk_hbox_new(FALSE, 0);
3547 playlist_remove_file_button = (GtkWidget *)
3549 gtk_box_pack_start(GTK_BOX(hbox),
3550 playlist_remove_file_button, FALSE, FALSE, 5);
3551 gtk_widget_set_sensitive(playlist_remove_file_button,FALSE);
3552 g_signal_connect(G_OBJECT(playlist_remove_file_button),
"clicked",
3556 playlist_remove_all_files_button = (GtkWidget *)
3558 gtk_box_pack_start(GTK_BOX(hbox),
3559 playlist_remove_all_files_button, FALSE, FALSE, 5);
3560 gtk_widget_set_sensitive(playlist_remove_all_files_button,FALSE);
3561 g_signal_connect(G_OBJECT(playlist_remove_all_files_button),
"clicked",
3570 GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
3576 GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);
3577 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(scrolled_window), GTK_SHADOW_NONE);
3578 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
3579 GTK_POLICY_AUTOMATIC,
3580 GTK_POLICY_AUTOMATIC);
3581 gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0);
3585 gtk_container_add(GTK_CONTAINER(scrolled_window), GTK_WIDGET(playlist_tree));
3586 g_signal_connect(G_OBJECT(playlist_tree),
"row-activated",
3590 GtkWidget *playlist_tree_selection = (GtkWidget *)
3591 gtk_tree_view_get_selection(GTK_TREE_VIEW(playlist_tree));
3592 g_signal_connect(G_OBJECT(playlist_tree_selection),
"changed",
3594 gtk_tree_selection_set_mode(GTK_TREE_SELECTION(playlist_tree_selection),
3595 GTK_SELECTION_MULTIPLE);
3599 gtk_box_pack_start(GTK_BOX(vbox), delete_buttons_hbox, FALSE, FALSE, 2);
3601 GtkWidget *history_expander = gtk_expander_new_with_mnemonic(_(
"H_istory"));
3602 gtk_expander_set_expanded(GTK_EXPANDER(history_expander), FALSE);
3603 gtk_container_add(GTK_CONTAINER(history_expander), vbox);
3605 GtkWidget *main_hbox = gtk_hbox_new(FALSE, 0);
3606 gtk_box_pack_start(GTK_BOX(main_hbox), history_expander, TRUE, TRUE, 4);
3609 playlist_handle = gtk_handle_box_new();
3610 gtk_container_add(GTK_CONTAINER(playlist_handle), GTK_WIDGET(main_hbox));
3611 g_signal_connect(playlist_handle,
"child-detached",
3614 return playlist_handle;
3635 if(!gtk_widget_is_sensitive(progress_bar))
3636 gtk_widget_set_sensitive(GTK_WIDGET(progress_bar), TRUE);
3666 gint stop_splitpoint
3669 if ((stop_splitpoint < (gint)current_time)
3672 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pause_button), TRUE);
3679 if(!gtk_widget_is_sensitive(volume_button))
3680 gtk_widget_set_sensitive(GTK_WIDGET(volume_button), TRUE);
3690 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pause_button)))
3692 only_press_pause = TRUE;
3693 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pause_button), TRUE);
3694 only_press_pause = FALSE;
3699 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pause_button)))
3701 only_press_pause = TRUE;
3702 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pause_button), FALSE);
3703 only_press_pause = FALSE;
3710 if ((player_minutes != 0) || (player_seconds != 0))
3720 gtk_widget_set_sensitive(player_add_button, FALSE);
3721 gtk_widget_set_sensitive(silence_wave_check_button, FALSE);
3725 if ((change_volume)&& (!on_the_volume_button))
3734 if (!gtk_widget_get_sensitive(player_add_button))
3736 gtk_widget_set_sensitive(player_add_button, TRUE);
3738 if (!gtk_widget_get_sensitive(silence_wave_check_button))
3740 gtk_widget_set_sensitive(silence_wave_check_button, TRUE);
3743 if (!gtk_widget_get_sensitive(stop_button))
3745 gtk_widget_set_sensitive(stop_button, TRUE);
3746 gtk_button_set_image(GTK_BUTTON(stop_button), g_object_ref(StopButton_active));
3748 if (!gtk_widget_get_sensitive(pause_button))
3750 gtk_widget_set_sensitive(pause_button, TRUE);
3751 gtk_button_set_image(GTK_BUTTON(pause_button), g_object_ref(PauseButton_active));
3755 if (gtk_widget_get_sensitive(stop_button))
3757 gtk_widget_set_sensitive(stop_button, FALSE);
3758 gtk_button_set_image(GTK_BUTTON(stop_button), g_object_ref(StopButton_inactive));
3760 if (gtk_widget_get_sensitive(pause_button))
3762 gtk_widget_set_sensitive(pause_button, FALSE);
3763 gtk_button_set_image(GTK_BUTTON(pause_button), g_object_ref(PauseButton_inactive));
3792 void file_chooser_ok_event(gchar *fname)
3796 gtk_widget_set_sensitive(play_button, TRUE);
3797 gtk_button_set_image(GTK_BUTTON(play_button), g_object_ref(PlayButton_active));
3803 GList *song_list = NULL;
3804 song_list = g_list_append(song_list, fname);
3815 if (GTK_IS_WIDGET(widget))
3817 gtk_widget_set_sensitive(widget, FALSE);
3820 GtkWidget *file_chooser = gtk_file_chooser_dialog_new(_(
"Choose File"),
3822 GTK_FILE_CHOOSER_ACTION_OPEN,
3824 GTK_RESPONSE_CANCEL,
3826 GTK_RESPONSE_ACCEPT,
3829 wh_set_browser_directory_handler(ui, file_chooser);
3831 GtkWidget *our_filter = (GtkWidget *)gtk_file_filter_new();
3832 gtk_file_filter_set_name (GTK_FILE_FILTER(our_filter), _(
"mp3 and ogg files (*.mp3 *.ogg)"));
3833 gtk_file_filter_add_pattern(GTK_FILE_FILTER(our_filter),
"*.mp3");
3834 gtk_file_filter_add_pattern(GTK_FILE_FILTER(our_filter),
"*.ogg");
3835 gtk_file_filter_add_pattern(GTK_FILE_FILTER(our_filter),
"*.MP3");
3836 gtk_file_filter_add_pattern(GTK_FILE_FILTER(our_filter),
"*.OGG");
3837 gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(file_chooser), GTK_FILE_FILTER(our_filter));
3839 our_filter = (GtkWidget *)gtk_file_filter_new();
3840 gtk_file_filter_set_name (GTK_FILE_FILTER(our_filter), _(
"mp3 files (*.mp3)"));
3841 gtk_file_filter_add_pattern(GTK_FILE_FILTER(our_filter),
"*.mp3");
3842 gtk_file_filter_add_pattern(GTK_FILE_FILTER(our_filter),
"*.MP3");
3843 gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(file_chooser), GTK_FILE_FILTER(our_filter));
3845 our_filter = (GtkWidget *)gtk_file_filter_new();
3846 gtk_file_filter_set_name (GTK_FILE_FILTER(our_filter), _(
"ogg files (*.ogg)"));
3847 gtk_file_filter_add_pattern(GTK_FILE_FILTER(our_filter),
"*.ogg");
3848 gtk_file_filter_add_pattern(GTK_FILE_FILTER(our_filter),
"*.OGG");
3849 gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(file_chooser), GTK_FILE_FILTER(our_filter));
3851 if (gtk_dialog_run(GTK_DIALOG(file_chooser)) == GTK_RESPONSE_ACCEPT)
3854 gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(file_chooser));
3856 file_chooser_ok_event(filename);
3869 gtk_widget_destroy(file_chooser);
3874 void close_file_popup_window_event( GtkWidget *window,
3877 GtkWidget *window_child;
3879 window_child = gtk_bin_get_child(GTK_BIN(window));
3881 gtk_widget_reparent(GTK_WIDGET(window_child), GTK_WIDGET(file_handle_box));
3883 gtk_widget_destroy(window);
3894 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
3896 gtk_widget_reparent(GTK_WIDGET(widget), GTK_WIDGET(window));
3898 g_signal_connect (G_OBJECT (window),
"delete_event",
3899 G_CALLBACK (close_file_popup_window_event),
3902 gtk_widget_show(GTK_WIDGET(window));
3911 we_are_splitting = TRUE;
3939 gint confirmation = SPLT_OK;
3942 confirmation = mp3splt_split(the_state);
3951 we_are_splitting = FALSE;
3962 GtkWidget *create_choose_file_frame()
3965 GtkWidget *choose_file_hbox = gtk_hbox_new (FALSE, 0);
3969 file_handle_box = gtk_handle_box_new();
3970 gtk_container_add(GTK_CONTAINER(file_handle_box), GTK_WIDGET(choose_file_hbox));
3971 g_signal_connect(file_handle_box,
"child-detached",
3975 entry = gtk_entry_new();
3976 gtk_editable_set_editable(GTK_EDITABLE(
entry), FALSE);
3977 gtk_box_pack_start(GTK_BOX(choose_file_hbox),
entry , TRUE, TRUE, 4);
3990 gtk_box_pack_start(GTK_BOX(choose_file_hbox),
browse_button, FALSE, FALSE, 4);
3991 gtk_widget_set_tooltip_text(
browse_button,_(
"Select file"));
4006 return file_handle_box;
4012 gtk_widget_hide(connect_button);
4020 gtk_box_pack_start(GTK_BOX(player_buttons_hbox), connect_button, FALSE, FALSE, 7);
4022 gtk_widget_show_all(connect_button);
4028 gtk_widget_hide(disconnect_button);
4036 gtk_box_pack_start(GTK_BOX(player_buttons_hbox), disconnect_button, FALSE, FALSE, 7);
4038 gtk_widget_show_all(disconnect_button);