2 terminatorX - realtime audio scratching software
3 Copyright (C) 1999-2016 Alexander König
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 #include "tX_ui_callbacks.h"
27 #include "tX_ui_interface.h"
28 #include "tX_ui_support.h"
29 #include "tX_dialog.h"
30 #include "tX_global.h"
31 #include "tX_mastergui.h"
32 #include "tX_sequencer.h"
35 on_pref_cancel_clicked (GtkButton *button,
38 gtk_widget_destroy(opt_dialog);
43 on_pref_apply_clicked (GtkButton *button,
46 apply_options(opt_dialog);
51 on_pref_ok_clicked (GtkButton *button,
54 apply_options(opt_dialog);
55 gtk_widget_destroy(opt_dialog);
60 on_tx_options_destroy (GObject *object,
68 on_alsa_buffer_time_value_changed (GtkRange *range,
71 GtkAdjustment *buffer_time=gtk_range_get_adjustment(GTK_RANGE(user_data));
72 GtkAdjustment *period_time=gtk_range_get_adjustment(GTK_RANGE(range));
75 gtk_adjustment_set_upper(period_time, gtk_adjustment_get_value(buffer_time));
79 on_pref_reset_clicked (GtkButton *button,
82 GtkWidget *dialog=gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_toplevel(opt_dialog)),
83 GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
84 "Loose all your settings and set default values?");
86 int res=gtk_dialog_run(GTK_DIALOG(dialog));
87 gtk_widget_destroy(dialog);
89 if (res!=GTK_RESPONSE_YES) {
93 set_global_defaults();
94 init_tx_options(opt_dialog);
98 on_del_mode_cancel_clicked (GtkButton *button,
101 gtk_widget_destroy(del_dialog);
107 on_del_mode_ok_clicked (GtkButton *button,
110 tX_sequencer::del_mode mode;
112 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(del_dialog, "all_events")))) {
113 mode=tX_sequencer::DELETE_ALL;
114 } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(del_dialog, "upto_current")))) {
115 mode=tX_sequencer::DELETE_UPTO_CURRENT;
116 } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(del_dialog, "from_current")))) {
117 mode=tX_sequencer::DELETE_FROM_CURRENT;
119 tX_error("Invalid tX_sequencer::del_mode selected.");
123 switch(menu_del_mode) {
124 case ALL_EVENTS_ALL_TURNTABLES:
125 sequencer.delete_all_events(mode);
127 case ALL_EVENTS_FOR_TURNTABLE:
128 sequencer.delete_all_events_for_vtt(del_vtt, mode);
130 case ALL_EVENTS_FOR_SP:
131 sequencer.delete_all_events_for_sp(del_sp, mode);
134 tX_error("Invalid del_mode");
137 gtk_widget_destroy(del_dialog);
142 color_clicked (GtkButton *button,
146 GtkWidget *dialog=create_tX_color_chooser(gtk_widget_get_toplevel(GTK_WIDGET(button)));
147 GtkWidget *sel=lookup_widget(dialog, "tX_color_chooser");
148 g_object_set_data(G_OBJECT(dialog), "Button", button);
150 gdk_rgba_parse(&p, (const char *) g_object_get_data(G_OBJECT(button), "Color"));
151 gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(sel), &p);
152 gtk_widget_show(dialog);
156 color_response (GtkDialog *dialog, gint response_id, gpointer user_data)
158 if (response_id == GTK_RESPONSE_OK) {
163 GtkWidget *c_but=(GtkWidget *) g_object_get_data(G_OBJECT(dialog), "Button");
164 gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (dialog), &p);
165 sprintf(col, "#%02X%02X%02X", (int) (p.red * 256.0), (int) (p.green * 256.0), (int) (p.blue * 256.0));
167 sprintf(tmp, "<span foreground=\"%s\"><b>%s</b></span>", col, col);
168 gtk_label_set_markup(GTK_LABEL(gtk_container_get_children(GTK_CONTAINER(c_but))->data), tmp);
171 gtk_widget_hide (GTK_WIDGET (dialog));
172 gtk_widget_destroy (GTK_WIDGET (dialog));