diff options
-rw-r--r-- | gtk2_ardour/add_route_dialog.cc | 39 | ||||
-rw-r--r-- | gtk2_ardour/add_route_dialog.h | 8 | ||||
-rw-r--r-- | gtk2_ardour/ardour_dialog.cc | 68 | ||||
-rw-r--r-- | gtk2_ardour/ardour_dialog.h | 19 | ||||
-rw-r--r-- | gtk2_ardour/ardour_message.cc | 27 | ||||
-rw-r--r-- | gtk2_ardour/ardour_message.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 155 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_dialogs.cc | 19 | ||||
-rw-r--r-- | gtk2_ardour/connection_editor.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/crossfade_edit.cc | 10 | ||||
-rw-r--r-- | gtk2_ardour/editor.cc | 109 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 18 | ||||
-rw-r--r-- | gtk2_ardour/editor_tempodisplay.cc | 155 | ||||
-rw-r--r-- | gtk2_ardour/editor_timefx.cc | 22 | ||||
-rw-r--r-- | gtk2_ardour/redirect_box.cc | 62 | ||||
-rw-r--r-- | gtk2_ardour/tempo_dialog.cc | 26 |
16 files changed, 224 insertions, 523 deletions
diff --git a/gtk2_ardour/add_route_dialog.cc b/gtk2_ardour/add_route_dialog.cc index b70c76b3ca..1126bbe53a 100644 --- a/gtk2_ardour/add_route_dialog.cc +++ b/gtk2_ardour/add_route_dialog.cc @@ -32,29 +32,24 @@ using namespace Gtk; using namespace Gtkmm2ext; using namespace sigc; +using namespace std; extern std::vector<string> channel_combo_strings; AddRouteDialog::AddRouteDialog () - : ArdourDialog ("add route dialog"), - ok_button (_("OK")), - cancel_button (_("Cancel")), + : Dialog (_("ardour: add track/bus")), track_button (_("Tracks")), bus_button (_("Busses")), routes_adjustment (1, 1, 32, 1, 4), routes_spinner (routes_adjustment) { set_name ("AddRouteDialog"); - set_title (_("ardour: add track/bus")); set_wmclass (X_("ardour_add_track_bus"), "Ardour"); set_position (Gtk::WIN_POS_MOUSE); - set_keyboard_input (true); name_template_entry.set_name ("AddRouteDialogNameTemplateEntry"); track_button.set_name ("AddRouteDialogRadioButton"); bus_button.set_name ("AddRouteDialogRadioButton"); - ok_button.set_name ("AddRouteDialogButton"); - cancel_button.set_name ("AddRouteDialogButton"); routes_spinner.set_name ("AddRouteDialogSpinner"); RadioButton::Group g = track_button.get_group(); @@ -85,20 +80,6 @@ AddRouteDialog::AddRouteDialog () hbnt->pack_start (name_template_entry, true, true); #endif - HBox* hbbut = manage (new HBox); - - set_size_request_to_display_given_text (ok_button, _("Cancel"), 20, 15); // this is cancel on purpose - set_size_request_to_display_given_text (cancel_button, _("Cancel"), 20, 15); - - hbbut->set_homogeneous (true); - hbbut->set_spacing (6); - hbbut->pack_end (cancel_button, false, false); - hbbut->pack_end (ok_button, false, false); - - HBox* hbbutouter = manage (new HBox); - hbbutouter->set_border_width (12); - hbbutouter->pack_end (*hbbut, false, false); - VBox* vb2 = manage (new VBox); vb2->set_border_width (12); @@ -108,13 +89,15 @@ AddRouteDialog::AddRouteDialog () #if NOT_USEFUL_YET vb2->pack_start (*hbnt, false, false); #endif - vb2->pack_start (*hbbutouter, false, false); - - add (*vb2); - - // signal_delete_event().connect (mem_fun(*this, &ArdourDialog::wm_close_event)); - ok_button.signal_clicked().connect (bind (mem_fun(*this, &ArdourDialog::stop), 0)); - cancel_button.signal_clicked().connect (bind (mem_fun(*this, &ArdourDialog::stop), 1)); + + get_vbox()->pack_start (*hbrb, false, false); + get_vbox()->pack_start (*vbcc, false, false); +#if NOT_USEFUL_YET + get_vbox()->pack_start (*hbnt, false, false); +#endif + + add_button (Stock::OK, RESPONSE_ACCEPT); + add_button (Stock::CANCEL, RESPONSE_CANCEL); } AddRouteDialog::~AddRouteDialog () diff --git a/gtk2_ardour/add_route_dialog.h b/gtk2_ardour/add_route_dialog.h index 6a2aea7871..76481fe025 100644 --- a/gtk2_ardour/add_route_dialog.h +++ b/gtk2_ardour/add_route_dialog.h @@ -4,6 +4,7 @@ #include <string> #include <gtkmm/entry.h> +#include <gtkmm/dialog.h> #include <gtkmm/radiobutton.h> #include <gtkmm/adjustment.h> #include <gtkmm/spinbutton.h> @@ -12,9 +13,7 @@ #include <gtkmm2ext/click_box.h> -#include "ardour_dialog.h" - -class AddRouteDialog : public ArdourDialog +class AddRouteDialog : public Gtk::Dialog { public: AddRouteDialog (); @@ -25,9 +24,6 @@ class AddRouteDialog : public ArdourDialog int channels (); int count (); - Gtk::Button ok_button; - Gtk::Button cancel_button; - private: Gtk::Entry name_template_entry; Gtk::RadioButton track_button; diff --git a/gtk2_ardour/ardour_dialog.cc b/gtk2_ardour/ardour_dialog.cc index 030be0486e..22f3f26048 100644 --- a/gtk2_ardour/ardour_dialog.cc +++ b/gtk2_ardour/ardour_dialog.cc @@ -26,15 +26,10 @@ #include "ardour_ui.h" -ArdourDialog::ArdourDialog (string name) - : Dialog (name) +ArdourDialog::ArdourDialog (string title, bool modal) + : Dialog (title, modal) { session = 0; - kbd_input = false; - running = false; - _run_status = 0; - _within_hiding = false; - hide_on_stop = true; } ArdourDialog::~ArdourDialog () @@ -64,64 +59,5 @@ ArdourDialog::on_leave_notify_event (GdkEventCrossing *ev) void ArdourDialog::on_unmap () { - _within_hiding = true; - _within_hiding = false; Dialog::on_unmap (); } - -void -ArdourDialog::set_hide_on_stop (bool yn) -{ - hide_on_stop = yn; -} - -void -ArdourDialog::stop (int rr) -{ - if (hide_on_stop) { - hide_all (); - } - - if (running) { - if (rr == 0) { - response (GTK_RESPONSE_ACCEPT); - } else { - response (GTK_RESPONSE_CANCEL); - } - running = false; - } -} - -void -ArdourDialog::run () -{ - show_all (); - - running = true; - switch (Dialog::run ()) { - case GTK_RESPONSE_ACCEPT: - _run_status = 0; - break; - - case GTK_RESPONSE_DELETE_EVENT: - _run_status = -1; - break; - - default: - _run_status = -1; - } - - hide_all (); -} - -void -ArdourDialog::set_keyboard_input (bool yn) -{ - kbd_input = yn; -} - -int -ArdourDialog::run_status () -{ - return _run_status; -} diff --git a/gtk2_ardour/ardour_dialog.h b/gtk2_ardour/ardour_dialog.h index 9af434993a..0b93dfb37b 100644 --- a/gtk2_ardour/ardour_dialog.h +++ b/gtk2_ardour/ardour_dialog.h @@ -36,17 +36,9 @@ namespace ARDOUR { class ArdourDialog : public Gtk::Dialog { public: - ArdourDialog (string name); + ArdourDialog (std::string title, bool modal = false); ~ArdourDialog(); - bool within_hiding() const { return _within_hiding; } - - void run (); - void stop (int); - void set_keyboard_input (bool yn); - void set_hide_on_stop (bool yn); - int run_status(); - bool on_enter_notify_event (GdkEventCrossing*); bool on_leave_notify_event (GdkEventCrossing*); void on_unmap (); @@ -60,15 +52,6 @@ class ArdourDialog : public Gtk::Dialog virtual void session_gone () { set_session (0); } - - void quit (); - - private: - int _run_status; - bool _within_hiding; - bool kbd_input; - bool running; - bool hide_on_stop; }; #endif // __ardour_dialog_h__ diff --git a/gtk2_ardour/ardour_message.cc b/gtk2_ardour/ardour_message.cc index f79defdf8a..48cfa80caf 100644 --- a/gtk2_ardour/ardour_message.cc +++ b/gtk2_ardour/ardour_message.cc @@ -19,7 +19,7 @@ */ -#include <gtkmm2ext/utils.h> +#include <gtkmm/stock.h> #include "ardour_message.h" #include "i18n.h" @@ -27,37 +27,26 @@ using namespace std; using namespace Gtk; - ArdourMessage::ArdourMessage (Gtk::Window* parent, string name, string msg, bool grab_focus, bool auto_run) - : ArdourDialog (name), - ok_button (_("OK")) + : ArdourDialog (name) { - set_keyboard_input (true); - label.set_text (msg); label.set_alignment (0.5, 0.5); label.set_name (X_("PrompterLabel")); - - ok_button.set_name ("EditorGTKButton"); - ok_button.signal_clicked().connect (bind (mem_fun(*this, &ArdourDialog::stop), 1)); - - packer.set_spacing (10); - packer.set_border_width (10); - packer.pack_start (label); - packer.pack_start (ok_button); + + get_vbox()->pack_start (label); + + Button* ok_button = add_button (Stock::OK, RESPONSE_ACCEPT); set_name (X_("Prompter")); set_position (Gtk::WIN_POS_MOUSE); set_modal (true); - add (packer); - show_all (); - - signal_realize().connect (bind (sigc::ptr_fun (Gtkmm2ext::set_decoration), this, Gdk::WMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH))); + set_type_hint (Gdk::WINDOW_TYPE_HINT_MENU); if (grab_focus) { - ok_button.grab_focus (); + ok_button->grab_focus (); } if (parent) { diff --git a/gtk2_ardour/ardour_message.h b/gtk2_ardour/ardour_message.h index f50ddc232d..a9ac02a5bc 100644 --- a/gtk2_ardour/ardour_message.h +++ b/gtk2_ardour/ardour_message.h @@ -40,8 +40,6 @@ class ArdourMessage : public ArdourDialog ~ArdourMessage(); private: - Gtk::VBox packer; - Gtk::Button ok_button; Gtk::Label label; }; diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index cae22667e8..ae45db10c6 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -1098,24 +1098,16 @@ If you still wish to quit, please use the\n\n\ int ARDOUR_UI::ask_about_saving_session (string what) { - ArdourDialog window ("saving dialog"); - Gtk::VBox packer; + ArdourDialog window (_("ardour: save session?")); Gtk::Label prompt_label; - Gtk::HBox button_packer; - string msg; msg = string_compose(_("Save and %1"), what); - - Gtk::Button save_button (msg); - save_button.set_name ("EditorGTKButton"); - + window.add_button (msg, RESPONSE_ACCEPT); msg = string_compose(_("Just %1"), what); - - Gtk::Button nosave_button (msg); - nosave_button.set_name ("EditorGTKButton"); - + window.add_button (msg, RESPONSE_REJECT); msg = string_compose(_("Don't %1"), what); + window.add_button (msg, RESPONSE_REJECT); Gtk::Button noquit_button (msg); noquit_button.set_name ("EditorGTKButton"); @@ -1134,36 +1126,30 @@ ARDOUR_UI::ask_about_saving_session (string what) prompt_label.set_text (prompt); prompt_label.set_alignment (0.5, 0.5); prompt_label.set_name (X_("PrompterLabel")); - - save_button.signal_clicked().connect (bind(mem_fun(window,&ArdourDialog::stop), 1)); - nosave_button.signal_clicked().connect (bind(mem_fun(window,&ArdourDialog::stop), 0)); - noquit_button.signal_clicked().connect (bind(mem_fun(window,&ArdourDialog::stop), -1)); - - button_packer.set_spacing (10); - button_packer.pack_start (save_button); - button_packer.pack_start (nosave_button); - button_packer.pack_start (noquit_button); - packer.set_spacing (10); - packer.set_border_width (10); - packer.pack_start (prompt_label); - packer.pack_start (button_packer); + window.get_vbox()->pack_start (prompt_label); window.set_name (_("Prompter")); - window.set_title (_("ardour: save session?")); window.set_position (Gtk::WIN_POS_MOUSE); window.set_modal (true); - window.add (packer); window.show_all (); - window.set_keyboard_input (true); save_the_session = 0; editor->ensure_float (window); - window.run (); + ResponseType r = (ResponseType) window.run(); + + window.hide (); - return window.run_status(); + switch (r) { + case RESPONSE_ACCEPT: + return 0; + default: + break; + } + + return -1; } gint @@ -1719,17 +1705,10 @@ ARDOUR_UI::build_session_selector () { session_selector_window = new ArdourDialog ("session selector"); - Gtk::VBox *vpacker = manage (new Gtk::VBox); Gtk::ScrolledWindow *scroller = manage (new Gtk::ScrolledWindow); - Gtk::HBox *button_packer = manage (new Gtk::HBox); - Gtk::Button *cancel_button = manage (new Gtk::Button (_("cancel"))); - Gtk::Button *rescan_button = manage (new Gtk::Button (_("rescan"))); - button_packer->pack_start (*rescan_button); - button_packer->pack_start (*cancel_button); - - vpacker->pack_start (*scroller); - vpacker->pack_start (*button_packer, false, false); + session_selector_window->add_button (Stock::OK, RESPONSE_ACCEPT); + session_selector_window->add_button (Stock::CANCEL, RESPONSE_CANCEL); recent_session_model = TreeStore::create (recent_session_columns); recent_session_display.set_model (recent_session_model); @@ -1739,9 +1718,9 @@ ARDOUR_UI::build_session_selector () scroller->add (recent_session_display); scroller->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); - session_selector_window->add (*vpacker); session_selector_window->set_name ("SessionSelectorWindow"); session_selector_window->set_size_request (200, 400); + session_selector_window->get_vbox()->pack_start (*scroller); } void @@ -1755,13 +1734,13 @@ ARDOUR_UI::open_recent_session () redisplay_recent_sessions (); - session_selector_window->run (); + ResponseType r = (ResponseType) session_selector_window->run (); + session_selector_window->hide(); - switch (session_selector_window->run_status()) { - case 0: + switch (r) { + case RESPONSE_ACCEPT: break; - default: return; } @@ -1775,11 +1754,9 @@ ARDOUR_UI::open_recent_session () Glib::ustring path = (*i)[recent_session_columns.fullpath]; Glib::ustring state = (*i)[recent_session_columns.visible_name]; - session_selector_window->response (RESPONSE_ACCEPT); _session_is_new = false; load_session (path, state); - } bool @@ -2886,7 +2863,7 @@ require some unused files to continue to exist.")); return; } - ArdourDialog results ("cleanup results"); + ArdourDialog results (_("ardour: cleanup"), true); struct CleanupResultsModelColumns : public Gtk::TreeModel::ColumnRecord { CleanupResultsModelColumns() { @@ -2909,11 +2886,6 @@ require some unused files to continue to exist.")); Gtk::ScrolledWindow list_scroller; Gtk::Label txt; - Gtk::Button ok_button (_("OK")); - Gtk::VBox vpacker; - - vpacker.set_border_width (10); - vpacker.set_spacing (10); if (rep.space < 1048576.0f) { if (removed > 1) { @@ -2929,7 +2901,7 @@ require some unused files to continue to exist.")); } } - vpacker.pack_start (txt, false, false); + results.get_vbox()->pack_start (txt, false, false); for (vector<string>::iterator i = rep.paths.begin(); i != rep.paths.end(); ++i) { TreeModel::Row row = *(results_model->append()); @@ -2941,14 +2913,9 @@ require some unused files to continue to exist.")); list_scroller.set_size_request (-1, 250); list_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); - vpacker.pack_start (list_scroller, true, true); - vpacker.pack_start (ok_button, false, false); - - results.add (vpacker); - + results.get_vbox()->pack_start (list_scroller, true, true); + results.add_button (Stock::OK, RESPONSE_ACCEPT); results.set_position (Gtk::WIN_POS_MOUSE); - results.set_title (_("ardour: cleanup")); - results.set_modal (true); results.run (); } @@ -2961,40 +2928,22 @@ ARDOUR_UI::cleanup () return; } - ArdourDialog checker (X_("cleanup confirm dialog")); + ArdourDialog checker (_("ardour cleanup")); Gtk::Label label (_("\ Cleanup is a destructive operation.\n\ ALL undo/redo information will be lost if you cleanup.\n\ Unused audio files will be moved to a \"dead sounds\" location.")); - - Gtk::Button ok_button (_("Proceed with cleanup")); - Gtk::Button cancel_button (_("Cancel")); - Gtk::HBox bbox; - Gtk::VBox vbox; - - bbox.set_border_width (6); - bbox.set_spacing (12); - bbox.pack_start (ok_button, true, false); - bbox.pack_start (cancel_button, true, false); - vbox.set_border_width (6); - vbox.set_spacing (12); - vbox.pack_start (label, false, false); - vbox.pack_start (bbox, false, false); - - checker.add (vbox); + checker.get_vbox()->pack_start (label, false, false); + checker.add_button (Stock::OK, RESPONSE_ACCEPT); + checker.add_button (Stock::CANCEL, RESPONSE_CANCEL); + checker.set_name (_("CleanupDialog")); - checker.set_title (_("ardour cleanup")); checker.set_wmclass (_("ardour_cleanup"), "Ardour"); checker.set_position (Gtk::WIN_POS_MOUSE); - ok_button.signal_clicked().connect (bind (mem_fun (checker, &ArdourDialog::stop), 1)); - cancel_button.signal_clicked().connect (bind (mem_fun (checker, &ArdourDialog::stop), 0)); - - checker.run (); - - switch (checker.run_status()) { - case 0: + switch (checker.run()) { + case RESPONSE_ACCEPT: break; default: return; @@ -3056,10 +3005,16 @@ ARDOUR_UI::add_route () return; } - add_route_dialog->run (); + ResponseType r = (ResponseType) add_route_dialog->run (); + + add_route_dialog->hide(); - if (add_route_dialog->run_status()) { + switch (r) { + case RESPONSE_ACCEPT: + break; + default: return; + break; } if ((count = add_route_dialog->count()) <= 0) { @@ -3214,8 +3169,6 @@ int ARDOUR_UI::pending_state_dialog () { ArdourDialog dialog ("pending state dialog"); - Button use_button (_("Recover from crash")); - Button cancel_button (_("Ignore crash data")); Label message (_("\ This session appears to have been in\n\ middle of recording when ardour or\n\ @@ -3224,28 +3177,18 @@ the computer was shutdown.\n\ Ardour can recover any captured audio for\n\ you, or it can ignore it. Please decide\n\ what you would like to do.\n")); - HBox hpacker; - VBox vpacker; - - vpacker.set_border_width (12); - vpacker.set_spacing (7); - vpacker.pack_start (message); - vpacker.pack_start (hpacker); - hpacker.set_spacing (7); - hpacker.pack_start (use_button); - hpacker.pack_start (cancel_button); - - use_button.signal_clicked().connect (bind (mem_fun (dialog, &ArdourDialog::stop), 0)); - cancel_button.signal_clicked().connect (bind (mem_fun (dialog, &ArdourDialog::stop), 1)); + dialog.get_vbox()->pack_start (message); + dialog.add_button (_("Recover from crash"), RESPONSE_ACCEPT); + dialog.add_button (_("Ignore crash data"), RESPONSE_REJECT); - dialog.add (vpacker); dialog.set_position (WIN_POS_CENTER); dialog.show_all (); - dialog.run (); - - if (dialog.run_status () != 0) { + switch (dialog.run ()) { + case RESPONSE_ACCEPT: + break; + default: return 1; } diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index c524e15526..93efa57110 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -248,13 +248,8 @@ ARDOUR_UI::toggle_connection_editor () //GTK2FIX #if 0 - if (connection_editor->within_hiding()) { - return; - } - - if (connection_editor_check->get_active()){ - connection_editor->show_all(); + connection_editor->present(); } else { connection_editor->hide_all(); } @@ -291,9 +286,7 @@ ARDOUR_UI::toggle_options_window () option_editor = new OptionEditor (*this, *editor, *mixer); option_editor->signal_unmap().connect(mem_fun(*this, &ARDOUR_UI::option_hiding)); option_editor->set_session (session); - } else if (option_editor->within_hiding()) { - return; - } + } if (option_editor->is_visible()) { option_editor->hide (); @@ -335,10 +328,6 @@ ARDOUR_UI::toggle_location_window () return; } - if (location_ui->within_hiding()) { - return; - } - if (location_ui->is_visible()) { location_ui->hide(); } else { @@ -370,10 +359,6 @@ ARDOUR_UI::toggle_route_params_window () return; } - if (route_params->within_hiding()) { - return; - } - if (route_params->is_visible ()) { route_params->hide (); } else { diff --git a/gtk2_ardour/connection_editor.cc b/gtk2_ardour/connection_editor.cc index 0b67ac8477..f1ee07149f 100644 --- a/gtk2_ardour/connection_editor.cc +++ b/gtk2_ardour/connection_editor.cc @@ -47,7 +47,7 @@ using namespace Gtk; using namespace sigc; ConnectionEditor::ConnectionEditor () - : ArdourDialog ("connection editor"), + : ArdourDialog (_("ardour: connections")), input_frame (_("Input Connections")), output_frame (_("Output Connections")), new_input_connection_button (_("New Input")), @@ -193,11 +193,7 @@ ConnectionEditor::ConnectionEditor () main_vbox.pack_start (main_hbox); main_vbox.pack_start (button_frame, false, false); - set_title (_("ardour: connections")); - add (main_vbox); - - // GTK2FIX - // signal_delete_event.connect (bind (ptr_fun (just_hide_it), reinterpret_cast<Window *> (this))); + get_vbox()->pack_start (main_vbox); clear_button.signal_clicked().connect (mem_fun(*this, &ConnectionEditor::clear)); add_port_button.signal_clicked().connect (mem_fun(*this, &ConnectionEditor::add_port)); diff --git a/gtk2_ardour/crossfade_edit.cc b/gtk2_ardour/crossfade_edit.cc index ffef903d9a..b5242d5cf5 100644 --- a/gtk2_ardour/crossfade_edit.cc +++ b/gtk2_ardour/crossfade_edit.cc @@ -71,7 +71,7 @@ CrossfadeEditor::Half::Half () } CrossfadeEditor::CrossfadeEditor (Session& s, Crossfade& xf, double my, double mxy) - : ArdourDialog (_("crossfade editor")), + : ArdourDialog (_("ardour: x-fade edit")), cancel_button (_("Cancel")), ok_button (_("OK")), xfade (xf), @@ -98,10 +98,8 @@ CrossfadeEditor::CrossfadeEditor (Session& s, Crossfade& xf, double my, double m { set_wmclass ("ardour_automationedit", "Ardour"); set_name ("CrossfadeEditWindow"); - set_title (_("ardour: x-fade edit")); set_position (Gtk::WIN_POS_MOUSE); - add (vpacker); add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::POINTER_MOTION_MASK); RadioButtonGroup sel_but_group = select_in_button.get_group(); @@ -281,10 +279,8 @@ CrossfadeEditor::CrossfadeEditor (Session& s, Crossfade& xf, double my, double m curve_button_box.pack_start (*vpacker2, false, false, 12); curve_button_box.pack_start (fade_in_table, false, false, 12); - vpacker.set_border_width (12); - vpacker.set_spacing (5); - vpacker.pack_start (*canvas_frame, true, true); - vpacker.pack_start (curve_button_box, false, false); + get_vbox()->pack_start (*canvas_frame, true, true); + get_vbox()->pack_start (curve_button_box, false, false); /* button to allow hackers to check the actual curve values */ diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index f98c340298..057639897e 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -3759,49 +3759,27 @@ Editor::duplicate_dialog (bool dup_region) ArdourDialog win ("duplicate dialog"); Entry entry; Label label (_("Duplicate how many times?")); - HBox hbox; - HBox button_box; - Button ok_button (_("OK")); - Button cancel_button (_("Cancel")); - VBox vbox; - - button_box.set_spacing (7); - set_size_request_to_display_given_text (ok_button, _("Cancel"), 20, 15); // this is cancel on purpose - set_size_request_to_display_given_text (cancel_button, _("Cancel"), 20, 15); - button_box.pack_end (ok_button, false, false); - button_box.pack_end (cancel_button, false, false); - - hbox.set_spacing (5); - hbox.pack_start (label); - hbox.pack_start (entry, true, true); - - vbox.set_spacing (5); - vbox.set_border_width (5); - vbox.pack_start (hbox); - vbox.pack_start (button_box); - win.add (vbox); - win.set_position (Gtk::WIN_POS_MOUSE); - win.show_all (); + win.get_vbox()->pack_start (label); + win.add_action_widget (entry, RESPONSE_ACCEPT); + win.add_button (Stock::OK, RESPONSE_ACCEPT); + win.add_button (Stock::CANCEL, RESPONSE_CANCEL); - ok_button.signal_clicked().connect (bind (mem_fun (win, &ArdourDialog::stop), 0)); - entry.signal_activate().connect (bind (mem_fun (win, &ArdourDialog::stop), 0)); - cancel_button.signal_clicked().connect (bind (mem_fun (win, &ArdourDialog::stop), 1)); + win.set_position (Gtk::WIN_POS_MOUSE); entry.set_text ("1"); set_size_request_to_display_given_text (entry, X_("12345678"), 20, 15); entry.select_region (0, entry.get_text_length()); + entry.grab_focus (); - win.set_position (Gtk::WIN_POS_MOUSE); - // GTK2FIX - // win.realize (); + // GTK2FIX // win.get_window()->set_decorations (Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH)); - entry.grab_focus (); - win.run (); - - if (win.run_status() != 0) { + switch (win.run ()) { + case RESPONSE_ACCEPT: + break; + default: return; } @@ -4286,17 +4264,18 @@ Editor::edit_xfade (Crossfade* xfade) ensure_float (cew); - cew.ok_button.signal_clicked().connect (bind (mem_fun (cew, &ArdourDialog::stop), 1)); - cew.cancel_button.signal_clicked().connect (bind (mem_fun (cew, &ArdourDialog::stop), 0)); // GTK2FIX // cew.signal_delete_event().connect (mem_fun (cew, &ArdourDialog::wm_doi_event_stop)); - cew.run (); - - if (cew.run_status() == 1) { - cew.apply (); - xfade->StateChanged (Change (~0)); + switch (cew.run ()) { + case RESPONSE_ACCEPT: + break; + default: + return; } + + cew.apply (); + xfade->StateChanged (Change (~0)); } PlaylistSelector& @@ -4331,56 +4310,30 @@ Editor::playlist_deletion_dialog (Playlist* pl) "If left alone, no audio files used by it will be cleaned.\n" "If deleted, audio files used by it alone by will cleaned."), pl->name())); - HBox button_box; - Button del_button (_("Delete playlist")); - Button keep_button (_("Keep playlist")); - Button abort_button (_("Cancel cleanup")); - VBox vbox; - - button_box.set_spacing (7); - button_box.set_homogeneous (true); - button_box.pack_end (del_button, false, false); - button_box.pack_end (keep_button, false, false); - button_box.pack_end (abort_button, false, false); - - vbox.set_spacing (5); - vbox.set_border_width (5); - vbox.pack_start (label); - vbox.pack_start (button_box); - dialog.add (vbox); dialog.set_position (Gtk::WIN_POS_CENTER); - dialog.show_all (); + dialog.get_vbox()->pack_start (label); - del_button.signal_clicked().connect (bind (mem_fun (dialog, &ArdourDialog::stop), 0)); - keep_button.signal_clicked().connect (bind (mem_fun (dialog, &ArdourDialog::stop), 1)); - abort_button.signal_clicked().connect (bind (mem_fun (dialog, &ArdourDialog::stop), 2)); - - // GTK2FIX - // dialog.realize (); - // dialog.get_window()->set_decorations (Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH)); + dialog.add_button (_("Delete playlist"), RESPONSE_ACCEPT); + dialog.add_button (_("Keep playlist"), RESPONSE_CANCEL); + dialog.add_button (_("Cancel"), RESPONSE_CANCEL); - dialog.run (); - - switch (dialog.run_status()) { - case 1: - /* keep the playlist */ - return 1; - break; - case 0: + switch (dialog.run ()) { + case RESPONSE_ACCEPT: /* delete the playlist */ return 0; break; - case 2: - /* abort cleanup */ - return -1; + + case RESPONSE_REJECT: + /* keep the playlist */ + return 1; break; + default: break; } - /* keep the playlist */ - return 1; + return -1; } bool diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index a594587e6e..260d2ce387 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1818,23 +1818,21 @@ Editor::audition_playlist_region_standalone (AudioRegion& region) void Editor::build_interthread_progress_window () { - interthread_progress_window = new ArdourDialog (X_("interthread progress")); + interthread_progress_window = new ArdourDialog (X_("interthread progress"), true); interthread_progress_bar.set_orientation (Gtk::PROGRESS_LEFT_TO_RIGHT); - interthread_progress_vbox.set_border_width (10); - interthread_progress_vbox.set_spacing (5); - interthread_progress_vbox.pack_start (interthread_progress_label, false, false); - interthread_progress_vbox.pack_start (interthread_progress_bar,false, false); - interthread_progress_vbox.pack_start (interthread_cancel_button,false, false); + interthread_progress_window->get_vbox()->pack_start (interthread_progress_label, false, false); + interthread_progress_window->get_vbox()->pack_start (interthread_progress_bar,false, false); + + // GTK2FIX: this button needs a modifiable label + + Button* b = interthread_progress_window->add_button (Stock::CANCEL, RESPONSE_CANCEL); + b->signal_clicked().connect (mem_fun(*this, &Editor::interthread_cancel_clicked)); interthread_cancel_button.add (interthread_cancel_label); - interthread_cancel_button.signal_clicked().connect (mem_fun(*this, &Editor::interthread_cancel_clicked)); - - interthread_progress_window->set_modal (true); interthread_progress_window->set_default_size (200, 100); - interthread_progress_window->add (interthread_progress_vbox); } void diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 715adf7284..c343611967 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -243,14 +243,9 @@ Editor::mouse_add_new_tempo_event (jack_nframes_t frame) return; } - TempoMap& map(session->tempo_map()); TempoDialog tempo_dialog (map, frame, _("add")); - tempo_dialog.bpm_entry.signal_activate().connect (bind (mem_fun (tempo_dialog, &ArdourDialog::stop), 0)); - tempo_dialog.ok_button.signal_clicked().connect (bind (mem_fun (tempo_dialog, &ArdourDialog::stop), 0)); - tempo_dialog.cancel_button.signal_clicked().connect (bind (mem_fun (tempo_dialog, &ArdourDialog::stop), -1)); - tempo_dialog.set_position (Gtk::WIN_POS_MOUSE); // GTK2FIX // tempo_dialog.realize (); @@ -258,26 +253,28 @@ Editor::mouse_add_new_tempo_event (jack_nframes_t frame) ensure_float (tempo_dialog); - tempo_dialog.run(); - - if (tempo_dialog.run_status() == 0) { - - double bpm = 0; - BBT_Time requested; - - bpm = tempo_dialog.get_bpm (); - bpm = max (0.01, bpm); - - tempo_dialog.get_bbt_time (requested); - - begin_reversible_command (_("add tempo mark")); - session->add_undo (map.get_memento()); - map.add_tempo (Tempo (bpm), requested); - session->add_redo_no_execute (map.get_memento()); - commit_reversible_command (); - - map.dump (cerr); + switch (tempo_dialog.run()) { + case RESPONSE_ACCEPT: + break; + default: + return; } + + double bpm = 0; + BBT_Time requested; + + bpm = tempo_dialog.get_bpm (); + bpm = max (0.01, bpm); + + tempo_dialog.get_bbt_time (requested); + + begin_reversible_command (_("add tempo mark")); + session->add_undo (map.get_memento()); + map.add_tempo (Tempo (bpm), requested); + session->add_redo_no_execute (map.get_memento()); + commit_reversible_command (); + + map.dump (cerr); } void @@ -291,9 +288,6 @@ Editor::mouse_add_new_meter_event (jack_nframes_t frame) TempoMap& map(session->tempo_map()); MeterDialog meter_dialog (map, frame, _("add")); - meter_dialog.ok_button.signal_clicked().connect (bind (mem_fun (meter_dialog, &ArdourDialog::stop), 0)); - meter_dialog.cancel_button.signal_clicked().connect (bind (mem_fun (meter_dialog, &ArdourDialog::stop), -1)); - meter_dialog.set_position (Gtk::WIN_POS_MOUSE); // GTK2FIX // meter_dialog.realize (); @@ -301,26 +295,28 @@ Editor::mouse_add_new_meter_event (jack_nframes_t frame) ensure_float (meter_dialog); - meter_dialog.run (); - - if (meter_dialog.run_status() == 0) { - - double bpb = meter_dialog.get_bpb (); - bpb = max (1.0, bpb); // XXX is this a reasonable limit? - - double note_type = meter_dialog.get_note_type (); - BBT_Time requested; - - meter_dialog.get_bbt_time (requested); - - begin_reversible_command (_("add meter mark")); - session->add_undo (map.get_memento()); - map.add_meter (Meter (bpb, note_type), requested); - session->add_redo_no_execute (map.get_memento()); - commit_reversible_command (); - - map.dump (cerr); + switch (meter_dialog.run ()) { + case RESPONSE_ACCEPT: + break; + default: + return; } + + double bpb = meter_dialog.get_bpb (); + bpb = max (1.0, bpb); // XXX is this a reasonable limit? + + double note_type = meter_dialog.get_note_type (); + BBT_Time requested; + + meter_dialog.get_bbt_time (requested); + + begin_reversible_command (_("add meter mark")); + session->add_undo (map.get_memento()); + map.add_meter (Meter (bpb, note_type), requested); + session->add_redo_no_execute (map.get_memento()); + commit_reversible_command (); + + map.dump (cerr); } void @@ -349,9 +345,6 @@ Editor::edit_meter_section (MeterSection* section) { MeterDialog meter_dialog (*section, _("done")); - meter_dialog.ok_button.signal_clicked().connect (bind (mem_fun (meter_dialog, &ArdourDialog::stop), 0)); - meter_dialog.cancel_button.signal_clicked().connect (bind (mem_fun (meter_dialog, &ArdourDialog::stop), -1)); - meter_dialog.set_position (Gtk::WIN_POS_MOUSE); // GTK2FIX // meter_dialog.realize (); @@ -359,21 +352,23 @@ Editor::edit_meter_section (MeterSection* section) ensure_float (meter_dialog); - meter_dialog.run (); - - if (meter_dialog.run_status() == 0) { - - double bpb = meter_dialog.get_bpb (); - bpb = max (1.0, bpb); // XXX is this a reasonable limit? + switch (meter_dialog.run()) { + case RESPONSE_ACCEPT: + break; + default: + return; + } - double note_type = meter_dialog.get_note_type (); + double bpb = meter_dialog.get_bpb (); + bpb = max (1.0, bpb); // XXX is this a reasonable limit? + + double note_type = meter_dialog.get_note_type (); - begin_reversible_command (_("replace tempo mark")); - session->add_undo (session->tempo_map().get_memento()); - session->tempo_map().replace_meter (*section, Meter (bpb, note_type)); - session->add_redo_no_execute (session->tempo_map().get_memento()); - commit_reversible_command (); - } + begin_reversible_command (_("replace tempo mark")); + session->add_undo (session->tempo_map().get_memento()); + session->tempo_map().replace_meter (*section, Meter (bpb, note_type)); + session->add_redo_no_execute (session->tempo_map().get_memento()); + commit_reversible_command (); } void @@ -381,10 +376,6 @@ Editor::edit_tempo_section (TempoSection* section) { TempoDialog tempo_dialog (*section, _("done")); - tempo_dialog.bpm_entry.signal_activate().connect (bind (mem_fun (tempo_dialog, &ArdourDialog::stop), 0)); - tempo_dialog.ok_button.signal_clicked().connect (bind (mem_fun (tempo_dialog, &ArdourDialog::stop), 0)); - tempo_dialog.cancel_button.signal_clicked().connect (bind (mem_fun (tempo_dialog, &ArdourDialog::stop), -1)); - tempo_dialog.set_position (Gtk::WIN_POS_MOUSE); // GTK2FIX // tempo_dialog.realize (); @@ -392,22 +383,24 @@ Editor::edit_tempo_section (TempoSection* section) ensure_float (tempo_dialog); - tempo_dialog.run (); - - if (tempo_dialog.run_status() == 0) { - - double bpm = tempo_dialog.get_bpm (); - BBT_Time when; - tempo_dialog.get_bbt_time(when); - bpm = max (0.01, bpm); - - begin_reversible_command (_("replace tempo mark")); - session->add_undo (session->tempo_map().get_memento()); - session->tempo_map().replace_tempo (*section, Tempo (bpm)); - session->tempo_map().move_tempo (*section, when); - session->add_redo_no_execute (session->tempo_map().get_memento()); - commit_reversible_command (); + switch (tempo_dialog.run ()) { + case RESPONSE_ACCEPT: + break; + default: + return; } + + double bpm = tempo_dialog.get_bpm (); + BBT_Time when; + tempo_dialog.get_bbt_time(when); + bpm = max (0.01, bpm); + + begin_reversible_command (_("replace tempo mark")); + session->add_undo (session->tempo_map().get_memento()); + session->tempo_map().replace_tempo (*section, Tempo (bpm)); + session->tempo_map().move_tempo (*section, when); + session->add_redo_no_execute (session->tempo_map().get_memento()); + commit_reversible_command (); } void diff --git a/gtk2_ardour/editor_timefx.cc b/gtk2_ardour/editor_timefx.cc index 805c4e0b1d..aba6a13011 100644 --- a/gtk2_ardour/editor_timefx.cc +++ b/gtk2_ardour/editor_timefx.cc @@ -57,8 +57,6 @@ Editor::TimeStretchDialog::TimeStretchDialog (Editor& e) set_title (_("ardour: timestretch")); set_name (N_("TimeStretchDialog")); - set_hide_on_stop (false); - add (packer); packer.set_spacing (5); @@ -85,7 +83,8 @@ Editor::TimeStretchDialog::TimeStretchDialog (Editor& e) antialias_button.set_name (N_("TimeStretchButton")); progress_bar.set_name (N_("TimeStretchProgress")); - action_button.signal_clicked().connect (bind (mem_fun(*this, &ArdourDialog::stop), 1)); + // GTK2FIX + // action_button.signal_clicked().connect (bind (mem_fun(*this, &ArdourDialog::stop), 1)); } gint @@ -120,16 +119,16 @@ Editor::run_timestretch (AudioRegionSelection& regions, float fraction) } current_timestretch->progress_bar.set_fraction (0.0f); - current_timestretch->first_cancel = current_timestretch->cancel_button.signal_clicked().connect (bind (mem_fun (*current_timestretch, &ArdourDialog::stop), -1)); // GTK2FIX + // current_timestretch->first_cancel = current_timestretch->cancel_button.signal_clicked().connect (bind (mem_fun (*current_timestretch, &ArdourDialog::stop), -1)); // current_timestretch->first_delete = current_timestretch->signal_delete_event().connect (mem_fun (*current_timestretch, &ArdourDialog::wm_close_event)); - current_timestretch->run (); - - if (current_timestretch->run_status() != 1) { - // GTK2FIX - // current_timestretch->close (); - return 1; /* no error, but we did nothing */ + switch (current_timestretch->run ()) { + case RESPONSE_ACCEPT: + break; + default: + current_timestretch->hide (); + return 1; } current_timestretch->status = 0; @@ -165,8 +164,7 @@ Editor::run_timestretch (AudioRegionSelection& regions, float fraction) c.disconnect (); - // GTK2FIX - // current_timestretch->close (); + current_timestretch->hide (); return current_timestretch->status; } diff --git a/gtk2_ardour/redirect_box.cc b/gtk2_ardour/redirect_box.cc index 041f73e5a9..4c827de7dc 100644 --- a/gtk2_ardour/redirect_box.cc +++ b/gtk2_ardour/redirect_box.cc @@ -429,9 +429,6 @@ RedirectBox::wierd_plugin_dialog (Plugin& p, uint32_t streams, IO& io) { ArdourDialog dialog ("wierd plugin dialog"); Label label; - Button button (_("OK")); - VBox vpacker; - HBox button_box; /* i hate this kind of code */ @@ -479,16 +476,9 @@ RedirectBox::wierd_plugin_dialog (Plugin& p, uint32_t streams, IO& io) streams)); } - button_box.pack_start (button, false, true); + dialog.get_vbox()->pack_start (label); + dialog.add_button (Stock::OK, RESPONSE_ACCEPT); - vpacker.set_spacing (12); - vpacker.set_border_width (12); - vpacker.pack_start (label); - vpacker.pack_start (button_box); - - button.signal_clicked().connect (bind (mem_fun (dialog, &ArdourDialog::stop), 0)); - - dialog.add (vpacker); dialog.set_name (X_("PluginIODialog")); dialog.set_position (Gtk::WIN_POS_MOUSE); dialog.set_modal (true); @@ -705,25 +695,16 @@ RedirectBox::compute_redirect_sort_keys () ArdourDialog dialog ("wierd plugin dialog"); Label label; - Button button (_("OK")); - VBox vpacker; - HBox button_box; label.set_text (_("\ You cannot reorder this set of redirects\n\ in that way because the inputs and\n\ outputs do not work correctly.")); - button_box.pack_start (button, false, true); - - vpacker.set_spacing (12); - vpacker.set_border_width (12); - vpacker.pack_start (label); - vpacker.pack_start (button_box); - - button.signal_clicked().connect (bind (mem_fun (dialog, &ArdourDialog::stop), 0)); - dialog.add (vpacker); + dialog.get_vbox()->pack_start (label); + dialog.add_button (Stock::OK, RESPONSE_ACCEPT); + dialog.set_name (X_("PluginIODialog")); dialog.set_position (Gtk::WIN_POS_MOUSE); dialog.set_modal (true); @@ -825,47 +806,32 @@ RedirectBox::idle_delete_redirect (Redirect *redirect) void RedirectBox::rename_redirect (Redirect* redirect) { - ArdourDialog dialog ("rename redirect dialog"); + ArdourDialog dialog (_("ardour: rename redirect"), true); Entry entry; VBox vbox; HBox hbox; Button ok_button (_("OK")); Button cancel_button (_("Cancel")); - dialog.set_title (_("ardour: rename redirect")); dialog.set_name ("RedirectRenameWindow"); dialog.set_size_request (300, -1); dialog.set_position (Gtk::WIN_POS_MOUSE); - dialog.set_modal (true); - vbox.set_border_width (12); - vbox.set_spacing (12); - vbox.pack_start (entry, false, false); - vbox.pack_start (hbox, false, false); - hbox.pack_start (ok_button); - hbox.pack_start (cancel_button); + dialog.add_action_widget (entry, RESPONSE_ACCEPT); + dialog.add_button (Stock::OK, RESPONSE_ACCEPT); + dialog.add_button (Stock::CANCEL, RESPONSE_CANCEL); - dialog.add (vbox); - entry.set_name ("RedirectNameDisplay"); entry.set_text (redirect->name()); entry.select_region (0, -1); entry.grab_focus (); - ok_button.set_name ("EditorGTKButton"); - cancel_button.set_name ("EditorGTKButton"); - - entry.signal_activate().connect (bind (mem_fun (dialog, &ArdourDialog::stop), 1)); - cancel_button.signal_clicked().connect (bind (mem_fun (dialog, &ArdourDialog::stop), -1)); - ok_button.signal_clicked().connect (bind (mem_fun (dialog, &ArdourDialog::stop), 1)); - - /* recurse */ - - dialog.set_keyboard_input (true); - dialog.run (); - - if (dialog.run_status() == 1) { + switch (dialog.run ()) { + case RESPONSE_ACCEPT: redirect->set_name (entry.get_text(), this); + break; + default: + break; } } diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc index 060cb9217f..5b4a7de073 100644 --- a/gtk2_ardour/tempo_dialog.cc +++ b/gtk2_ardour/tempo_dialog.cc @@ -1,5 +1,6 @@ #include <cstdio> // for snprintf, grrr +#include <gtkmm/stock.h> #include <gtkmm2ext/utils.h> #include "tempo_dialog.h" @@ -106,8 +107,6 @@ TempoDialog::init (const BBT_Time& when, double bpm, bool movable) add (vpacker); set_name ("MetricDialog"); - - set_keyboard_input(true); } double @@ -222,15 +221,6 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova note_frame.add (vspacer1); bpb_frame.add (vspacer2); - button_box.set_border_width (10); - button_box.set_spacing (5); - button_box.set_homogeneous (true); - button_box.pack_start (ok_button); - button_box.pack_start (cancel_button); - - vpacker.set_border_width (10); - vpacker.set_spacing (5); - if (movable) { snprintf (buf, sizeof (buf), "%" PRIu32, when.bars); when_bar_entry.set_text (buf); @@ -263,20 +253,18 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova vpacker.pack_start (when_frame, false, false); } - vpacker.pack_start (bpb_frame, false, false); - vpacker.pack_start (note_frame, false, false); - vpacker.pack_start (button_box, false, false); + get_vbox()->pack_start (bpb_frame, false, false); + get_vbox()->pack_start (note_frame, false, false); bpb_frame.set_name ("MetricDialogFrame"); note_frame.set_name ("MetricDialogFrame"); bpb_entry.set_name ("MetricEntry"); - ok_button.set_name ("MetricButton"); - cancel_button.set_name ("MetricButton"); - add (vpacker); - set_name ("MetricDialog"); + add_action_widget (bpb_entry, RESPONSE_ACCEPT); + add_button (Stock::OK, RESPONSE_ACCEPT); + add_button (Stock::CANCEL, RESPONSE_CANCEL); - set_keyboard_input(true); + set_name ("MetricDialog"); } double |