From d6a27c9537926e4ec7bd3371da97a2d1f85b6e86 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 28 Nov 2005 15:29:49 +0000 Subject: [PATCH] come up and stay up git-svn-id: svn://localhost/trunk/ardour2@138 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/actions.cc | 9 + gtk2_ardour/actions.h | 3 + gtk2_ardour/ardour-menus.xml | 67 +++++++- gtk2_ardour/ardour_ui.cc | 30 +--- gtk2_ardour/ardour_ui.h | 26 --- gtk2_ardour/ardour_ui2.cc | 7 + gtk2_ardour/ardour_ui_dependents.cc | 3 +- gtk2_ardour/ardour_ui_dialogs.cc | 79 +++------ gtk2_ardour/ardour_ui_ed.cc | 13 +- gtk2_ardour/editor.cc | 19 +-- gtk2_ardour/editor_markers.cc | 6 +- gtk2_ardour/editor_mixer.cc | 8 - gtk2_ardour/redirect_box.cc | 253 ++++++++++++++++++++++++---- gtk2_ardour/redirect_box.h | 23 ++- 14 files changed, 375 insertions(+), 171 deletions(-) diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc index 8a5928c3f8..1d90134830 100644 --- a/gtk2_ardour/actions.cc +++ b/gtk2_ardour/actions.cc @@ -41,6 +41,7 @@ vector > ActionManager::track_selection_sensitive_actions; vector > ActionManager::plugin_selection_sensitive_actions; vector > ActionManager::range_sensitive_actions; vector > ActionManager::jack_sensitive_actions; +vector > ActionManager::jack_opposite_sensitive_actions; RefPtr ActionManager::ui_manager; string ActionManager::unbound_string = "--"; @@ -194,3 +195,11 @@ ActionManager::get_action (ustring name) { return ui_manager->get_action (name); } + +void +ActionManager::set_sensitive (vector >& actions, bool state) +{ + for (vector >::iterator i = actions.begin(); i != actions.end(); ++i) { + (*i)->set_sensitive (state); + } +} diff --git a/gtk2_ardour/actions.h b/gtk2_ardour/actions.h index 2ea2794ab3..bcf8d935a6 100644 --- a/gtk2_ardour/actions.h +++ b/gtk2_ardour/actions.h @@ -27,6 +27,9 @@ class ActionManager static std::vector > plugin_selection_sensitive_actions; static std::vector > range_sensitive_actions; static std::vector > jack_sensitive_actions; + static std::vector > jack_opposite_sensitive_actions; + + static void set_sensitive (std::vector >& actions, bool); static std::string unbound_string; /* the key string returned if an action is not bound */ static Glib::RefPtr ui_manager; diff --git a/gtk2_ardour/ardour-menus.xml b/gtk2_ardour/ardour-menus.xml index 28d1667988..2d01aaaf1d 100644 --- a/gtk2_ardour/ardour-menus.xml +++ b/gtk2_ardour/ardour-menus.xml @@ -1,6 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index d010c90219..794833b353 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -866,18 +866,9 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile) set_shuttle_units (Percentage); set_shuttle_behaviour (Sprung); - Glib::RefPtr shuttle_actions = ActionGroup::create ("ShuttleActions"); - - shuttle_actions->add (Action::create (X_("SetShuttleUnitsPercentage"), _("Percentage")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_units), Percentage)); - shuttle_actions->add (Action::create (X_("SetShuttleUnitsSemitones"), _("Semitones")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_units), Semitones)); - shuttle_actions->add (Action::create (X_("SetShuttleActionSprung"), _("Sprung")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_behaviour), Sprung)); - shuttle_actions->add (Action::create (X_("SetShuttleActionWheel"), _("Wheel")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_behaviour), Wheel)); - - ActionManager::add_action_group (shuttle_actions); + shuttle_style_menu = 0; + shuttle_unit_menu = 0; - shuttle_style_menu = dynamic_cast (ActionManager::get_widget ("ShuttleStylePopup")); - shuttle_unit_menu = dynamic_cast (ActionManager::get_widget ("ShuttleUnitPopup")); - gettimeofday (&last_peak_grab, 0); gettimeofday (&last_shuttle_request, 0); @@ -2209,10 +2200,8 @@ void ARDOUR_UI::engine_stopped () { ENSURE_GUI_THREAD (mem_fun(*this, &ARDOUR_UI::engine_stopped)); - - jack_disconnect_item->set_sensitive (false); - jack_reconnect_item->set_sensitive (true); - jack_bufsize_menu->set_sensitive (false); + ActionManager::set_sensitive (ActionManager::jack_sensitive_actions, false); + ActionManager::set_sensitive (ActionManager::jack_opposite_sensitive_actions, true); } @@ -2220,10 +2209,8 @@ void ARDOUR_UI::engine_running () { ENSURE_GUI_THREAD (mem_fun(*this, &ARDOUR_UI::engine_running)); - - jack_disconnect_item->set_sensitive (true); - jack_reconnect_item->set_sensitive (false); - jack_bufsize_menu->set_sensitive (true); + ActionManager::set_sensitive (ActionManager::jack_sensitive_actions, true); + ActionManager::set_sensitive (ActionManager::jack_opposite_sensitive_actions, false); } void @@ -2231,9 +2218,8 @@ ARDOUR_UI::engine_halted () { ENSURE_GUI_THREAD (mem_fun(*this, &ARDOUR_UI::engine_halted)); - jack_disconnect_item->set_sensitive (false); - jack_reconnect_item->set_sensitive (true); - jack_bufsize_menu->set_sensitive (false); + ActionManager::set_sensitive (ActionManager::jack_sensitive_actions, false); + ActionManager::set_sensitive (ActionManager::jack_opposite_sensitive_actions, true); update_sample_rate (0); diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 5b261a9ef3..d9ba85bb70 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -480,32 +480,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI void build_menu_bar (); void pack_toplevel_controls(); - /* handles on the menu bar items that need to - be sensitive to whether or not we have - a session loaded. - */ - - Gtk::MenuItem *add_track_item; - Gtk::MenuItem *save_item; - Gtk::MenuItem *snapshot_item; - Gtk::MenuItem *save_as_item; - Gtk::MenuItem *save_template_item; - Gtk::MenuItem *export_item; - Gtk::MenuItem *close_item; - - Gtk::CheckMenuItem *connection_editor_check; - Gtk::CheckMenuItem *route_params_check; - Gtk::CheckMenuItem *locations_dialog_check; - Gtk::CheckMenuItem *big_clock_check; - Gtk::CheckMenuItem *tempo_editor_check; - Gtk::CheckMenuItem *sfdb_check; - Gtk::CheckMenuItem *options_window_check; - - /* */ - Gtk::MenuItem *image_compositor_item ; - /* */ - - Gtk::Label wall_clock_label; Gtk::EventBox wall_clock_box; gint update_wall_clock (); diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 90eee48557..5196d13b61 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -41,6 +41,7 @@ #include "ardour_ui.h" #include "public_editor.h" #include "audio_clock.h" +#include "actions.h" #include "utils.h" #include "i18n.h" @@ -692,12 +693,18 @@ ARDOUR_UI::shuttle_box_expose (GdkEventExpose* event) void ARDOUR_UI::shuttle_style_clicked () { + if (shuttle_style_menu == 0) { + shuttle_style_menu = dynamic_cast (ActionManager::get_widget ("ShuttleStylePopup")); + } shuttle_style_menu->popup (1, 0); } void ARDOUR_UI::shuttle_unit_clicked () { + if (shuttle_unit_menu == 0) { + shuttle_unit_menu = dynamic_cast (ActionManager::get_widget ("ShuttleUnitPopup")); + } shuttle_unit_menu->popup (1, 0); } diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc index cd6a5c5a1e..a2661e71d6 100644 --- a/gtk2_ardour/ardour_ui_dependents.cc +++ b/gtk2_ardour/ardour_ui_dependents.cc @@ -58,8 +58,9 @@ ARDOUR_UI::we_have_dependents () void ARDOUR_UI::setup_keybindings () { - // GTK2FIX + install_actions (); editor->register_actions (); + RedirectBox::register_actions (); } void diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index 93efa57110..aa06e25ad5 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -33,6 +33,7 @@ #include "public_editor.h" #include "route_params_ui.h" #include "sfdb_ui.h" +#include "actions.h" #include "i18n.h" @@ -49,37 +50,11 @@ ARDOUR_UI::connect_to_session (Session *s) /* sensitize menu bar options that are now valid */ -// save_as_item->set_sensitive (true); - save_template_item->set_sensitive (true); - snapshot_item->set_sensitive (true); - save_item->set_sensitive (true); - add_track_item->set_sensitive (true); - export_item->set_sensitive (true); - close_item->set_sensitive (true); - locations_dialog_check->set_sensitive (true); - route_params_check->set_sensitive (true); - connection_editor_check->set_sensitive (true); + ActionManager::set_sensitive (ActionManager::session_sensitive_actions, true); - cleanup_item->set_sensitive (true); - - /* sensitize transport bar */ - - goto_start_button.set_sensitive (true); - goto_end_button.set_sensitive (true); - roll_button.set_sensitive (true); - stop_button.set_sensitive (true); - play_selection_button.set_sensitive (true); rec_button.set_sensitive (true); - auto_loop_button.set_sensitive (true); shuttle_box.set_sensitive (true); - /* */ - if (image_compositor_item) { - image_compositor_item->set_sensitive(true) ; - } - /* */ - - if (session->n_diskstreams() == 0) { session->DiskStreamAdded.connect (mem_fun(*this, &ARDOUR_UI::diskstream_added)); } @@ -166,30 +141,9 @@ ARDOUR_UI::unload_session () point_one_second_connection.disconnect (); point_zero_one_second_connection.disconnect(); - /* desensitize menu bar options that are now invalid */ - -// save_as_item->set_sensitive (false); - save_template_item->set_sensitive (false); - snapshot_item->set_sensitive (false); - save_item->set_sensitive (false); - add_track_item->set_sensitive (false); - export_item->set_sensitive (false); - close_item->set_sensitive (false); - connection_editor_check->set_sensitive (false); - locations_dialog_check->set_sensitive (false); - connection_editor_check->set_active(false); - locations_dialog_check->set_active(false); - route_params_check->set_sensitive (false); - - /* desensitize transport bar */ - - goto_start_button.set_sensitive (false); - goto_end_button.set_sensitive (false); - roll_button.set_sensitive (false); - stop_button.set_sensitive (false); - play_selection_button.set_sensitive (false); + ActionManager::set_sensitive (ActionManager::session_sensitive_actions, false); + rec_button.set_sensitive (false); - auto_loop_button.set_sensitive (false); shuttle_box.set_sensitive (false); stop_blinking (); @@ -266,7 +220,8 @@ ARDOUR_UI::connection_editor_hiding() void ARDOUR_UI::big_clock_hiding() { - big_clock_check->set_active(false); + // GTK2FIX + // big_clock_check->set_active(false); } void @@ -298,7 +253,8 @@ ARDOUR_UI::toggle_options_window () void ARDOUR_UI::option_hiding () { - options_window_check->set_active(false); + // GTK2FIX + // options_window_check->set_active(false); } void @@ -338,7 +294,8 @@ ARDOUR_UI::toggle_location_window () void ARDOUR_UI::location_ui_hiding() { - locations_dialog_check->set_active(false); + // GTK2FIX + // locations_dialog_check->set_active(false); } int @@ -369,18 +326,20 @@ ARDOUR_UI::toggle_route_params_window () void ARDOUR_UI::route_params_hiding () { - route_params_check->set_active (false); + // GTK2FIX + // route_params_check->set_active (false); } void ARDOUR_UI::toggle_sound_file_browser () { - if (sfdb_check->get_active()) { - SoundFileBrowser sfdb(_("Sound File Browser")); + // GTK2FIX + // if (sfdb_check->get_active()) { + // SoundFileBrowser sfdb(_("Sound File Browser")); - sfdb_check->signal_toggled().connect (bind (mem_fun (sfdb, &Gtk::Dialog::response), Gtk::RESPONSE_CANCEL)); - sfdb.run(); - sfdb_check->set_active(false); - } + // sfdb_check->signal_toggled().connect (bind (mem_fun (sfdb, &Gtk::Dialog::response), Gtk::RESPONSE_CANCEL)); + // sfdb.run(); + // sfdb_check->set_active(false); + // } } diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 967dbaa175..b7e9d89f03 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -112,9 +112,10 @@ ARDOUR_UI::install_actions () Glib::RefPtr jack_actions = ActionGroup::create (X_("JACK")); - act = ActionManager::register_action (jack_actions, X_("JACKDisconnect"), _("Disconnect"), mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::disconnect_from_jack)); - ActionManager::jack_sensitive_actions.push_back (act); act = ActionManager::register_action (jack_actions, X_("JACKReconnect"), _("Reconnect"), mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::reconnect_to_jack)); + ActionManager::jack_opposite_sensitive_actions.push_back (act); + + act = ActionManager::register_action (jack_actions, X_("JACKDisconnect"), _("Disconnect"), mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::disconnect_from_jack)); ActionManager::jack_sensitive_actions.push_back (act); RadioAction::Group jack_latency_group; @@ -268,7 +269,15 @@ ARDOUR_UI::install_actions () ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (common_actions, X_("ToggleRecordEnableTrack32"), _("toggle record enable track32"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 31U)); ActionManager::session_sensitive_actions.push_back (act); + + Glib::RefPtr shuttle_actions = ActionGroup::create ("ShuttleActions"); + shuttle_actions->add (Action::create (X_("SetShuttleUnitsPercentage"), _("Percentage")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_units), Percentage)); + shuttle_actions->add (Action::create (X_("SetShuttleUnitsSemitones"), _("Semitones")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_units), Semitones)); + shuttle_actions->add (Action::create (X_("SetShuttleActionSprung"), _("Sprung")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_behaviour), Sprung)); + shuttle_actions->add (Action::create (X_("SetShuttleActionWheel"), _("Wheel")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_behaviour), Wheel)); + + ActionManager::add_action_group (shuttle_actions); ActionManager::add_action_group (jack_actions); ActionManager::add_action_group (main_actions); ActionManager::add_action_group (common_actions); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 7e223b05ef..1be409f4a1 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -1634,13 +1634,6 @@ Editor::connect_to_session (Session *t) route_list_reordered (); //route_list.thaw (); - if (embed_audio_item) { - embed_audio_item->set_sensitive (true); - } - if (import_audio_item) { - import_audio_item->set_sensitive (true); - } - for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { (static_cast(*i))->set_samples_per_unit (frames_per_unit); } @@ -1858,16 +1851,20 @@ Editor::popup_track_context_menu (int button, int32_t time, ItemType item_type, if (!with_selection) { if (region_edit_menu_split_item) { if (clicked_regionview && clicked_regionview->region.covers (edit_cursor->current_frame)) { - region_edit_menu_split_item->set_sensitive (true); + // GTK2FIX find the action, change its sensitivity + // region_edit_menu_split_item->set_sensitive (true); } else { - region_edit_menu_split_item->set_sensitive (false); + // GTK2FIX see above + // region_edit_menu_split_item->set_sensitive (false); } } if (region_edit_menu_split_multichannel_item) { if (clicked_regionview && clicked_regionview->region.n_channels() > 1) { - region_edit_menu_split_multichannel_item->set_sensitive (true); + // GTK2FIX find the action, change its sensitivity + // region_edit_menu_split_multichannel_item->set_sensitive (true); } else { - region_edit_menu_split_multichannel_item->set_sensitive (false); + // GTK2FIX see above + // region_edit_menu_split_multichannel_item->set_sensitive (false); } } } diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 2d4bebf8b6..4979cfd4de 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -392,8 +392,8 @@ Editor::marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item) build_marker_menu (); } - Menu_Helpers::MenuList & children = marker_menu->items(); - // XXX: should really find this some other way + // GTK2FIX use action group sensitivity +#ifdef GTK2FIX if (children.size() >= 3) { MenuItem * loopitem = &children[2]; if (loopitem) { @@ -405,7 +405,7 @@ Editor::marker_context_menu (GdkEventButton* ev, ArdourCanvas::Item* item) } } } - +#endif marker_menu_item = item; marker_menu->popup (1, ev->time); } diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc index 77d73de588..732340f24c 100644 --- a/gtk2_ardour/editor_mixer.cc +++ b/gtk2_ardour/editor_mixer.cc @@ -288,14 +288,6 @@ Editor::session_going_away () current_bbt_points = 0; } - if (embed_audio_item) { - embed_audio_item->set_sensitive (false); - } - - if (import_audio_item) { - import_audio_item->set_sensitive (false); - } - /* mixer strip will be deleted all by itself when its route is deleted. */ diff --git a/gtk2_ardour/redirect_box.cc b/gtk2_ardour/redirect_box.cc index 4c827de7dc..95296f0817 100644 --- a/gtk2_ardour/redirect_box.cc +++ b/gtk2_ardour/redirect_box.cc @@ -67,6 +67,8 @@ using namespace Gtk; using namespace Glib; using namespace Gtkmm2ext; +RedirectBox* RedirectBox::_current_redirect_box = 0; + RedirectBox::RedirectBox (Placement pcmnt, Session& sess, Route& rt, PluginSelector &plugsel, RouteRedirectSelection & rsel, bool owner_is_mixer) @@ -113,6 +115,9 @@ RedirectBox::RedirectBox (Placement pcmnt, Session& sess, Route& rt, PluginSelec _route.redirects_changed.connect (mem_fun(*this, &RedirectBox::redirects_changed)); + redirect_eventbox.signal_enter_notify_event().connect (bind (sigc::ptr_fun (RedirectBox::enter_box), this)); + redirect_eventbox.signal_leave_notify_event().connect (bind (sigc::ptr_fun (RedirectBox::leave_box), this)); + redirect_display.signal_button_press_event().connect (mem_fun(*this, &RedirectBox::redirect_button)); redirect_display.signal_button_release_event().connect (mem_fun(*this, &RedirectBox::redirect_button)); @@ -326,40 +331,6 @@ RedirectBox::redirect_button (GdkEventButton *ev) Menu * RedirectBox::build_redirect_menu () { - popup_act_grp = Gtk::ActionGroup::create(X_("redirectmenu")); - Glib::RefPtr act; - - /* new stuff */ - ActionManager::register_action (popup_act_grp, X_("newplugin"), _("New Plugin ..."), mem_fun(*this, &RedirectBox::choose_plugin)); - ActionManager::register_action (popup_act_grp, X_("newinsert"), _("New Insert"), mem_fun(*this, &RedirectBox::choose_insert)); - ActionManager::register_action (popup_act_grp, X_("newsend"), _("New Send ..."), mem_fun(*this, &RedirectBox::choose_send)); - ActionManager::register_action (popup_act_grp, X_("clear"), _("Clear"), mem_fun(*this, &RedirectBox::clear_redirects)); - - /* standard editing stuff */ - act = ActionManager::register_action (popup_act_grp, X_("cut"), _("Cut"), mem_fun(*this, &RedirectBox::cut_redirects)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); - act = ActionManager::register_action (popup_act_grp, X_("copy"), _("Copy"), mem_fun(*this, &RedirectBox::copy_redirects)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); - ActionManager::ActionManager::register_action (popup_act_grp, X_("paste"), _("Paste"), mem_fun(*this, &RedirectBox::paste_redirects)); - act = ActionManager::register_action (popup_act_grp, X_("rename"), _("Rename"), mem_fun(*this, &RedirectBox::rename_redirects)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); - ActionManager::register_action (popup_act_grp, X_("selectall"), _("Select All"), mem_fun(*this, &RedirectBox::select_all_redirects)); - ActionManager::register_action (popup_act_grp, X_("deselectall"), _("Deselect All"), mem_fun(*this, &RedirectBox::deselect_all_redirects)); - - /* activation */ - act = ActionManager::register_action (popup_act_grp, X_("activate"), _("Activate"), bind (mem_fun(*this, &RedirectBox::for_selected_redirects), &RedirectBox::activate_redirect)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); - act = ActionManager::register_action (popup_act_grp, X_("deactivate"), _("Deactivate"), bind (mem_fun(*this, &RedirectBox::for_selected_redirects), &RedirectBox::deactivate_redirect)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); - ActionManager::register_action (popup_act_grp, X_("activate"), _("Activate"), bind (mem_fun(*this, &RedirectBox::all_redirects_active),true)); - ActionManager::register_action (popup_act_grp, X_("activate"), _("Activate"), bind (mem_fun(*this, &RedirectBox::all_redirects_active), false)); - - /* show editors */ - act = ActionManager::register_action (popup_act_grp, X_("edit"), _("Edit"), bind (mem_fun(*this, &RedirectBox::for_selected_redirects), &RedirectBox::edit_redirect)); - ActionManager::plugin_selection_sensitive_actions.push_back(act); - - ActionManager::add_action_group (popup_act_grp); - redirect_menu = dynamic_cast(ActionManager::get_widget("/redirectmenu") ); redirect_menu->signal_map_event().connect (mem_fun(*this, &RedirectBox::redirect_menu_map_handler)); redirect_menu->set_name ("ArdourContextMenu"); @@ -382,7 +353,8 @@ RedirectBox::selection_changed () gint RedirectBox::redirect_menu_map_handler (GdkEventAny *ev) { - popup_act_grp->get_action("paste")->set_sensitive (!_rr_selection.redirects.empty()); + // GTK2FIX + // popup_act_grp->get_action("paste")->set_sensitive (!_rr_selection.redirects.empty()); return FALSE; } @@ -1094,4 +1066,215 @@ RedirectBox::edit_redirect (Redirect* redirect) } } +bool +RedirectBox::enter_box (GdkEventCrossing *ev, RedirectBox* rb) +{ + switch (ev->detail) { + case GDK_NOTIFY_INFERIOR: + break; + + case GDK_NOTIFY_VIRTUAL: + /* fallthru */ + + default: + _current_redirect_box = rb; + } + + return false; +} + +bool +RedirectBox::leave_box (GdkEventCrossing *ev, RedirectBox* rb) +{ + switch (ev->detail) { + case GDK_NOTIFY_INFERIOR: + break; + + case GDK_NOTIFY_VIRTUAL: + /* fallthru */ + default: + _current_redirect_box = 0; + } + + return false; +} + +void +RedirectBox::register_actions () +{ + Glib::RefPtr popup_act_grp = Gtk::ActionGroup::create(X_("redirectmenu")); + Glib::RefPtr act; + + /* new stuff */ + ActionManager::register_action (popup_act_grp, X_("newplugin"), _("New Plugin ..."), sigc::ptr_fun (RedirectBox::rb_choose_plugin)); + ActionManager::register_action (popup_act_grp, X_("newinsert"), _("New Insert"), sigc::ptr_fun (RedirectBox::rb_choose_insert)); + ActionManager::register_action (popup_act_grp, X_("newsend"), _("New Send ..."), sigc::ptr_fun (RedirectBox::rb_choose_send)); + ActionManager::register_action (popup_act_grp, X_("clear"), _("Clear"), sigc::ptr_fun (RedirectBox::rb_clear)); + + /* standard editing stuff */ + act = ActionManager::register_action (popup_act_grp, X_("cut"), _("Cut"), sigc::ptr_fun (RedirectBox::rb_cut)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); + act = ActionManager::register_action (popup_act_grp, X_("copy"), _("Copy"), sigc::ptr_fun (RedirectBox::rb_copy)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); + ActionManager::ActionManager::register_action (popup_act_grp, X_("paste"), _("Paste"), sigc::ptr_fun (RedirectBox::rb_paste)); + act = ActionManager::register_action (popup_act_grp, X_("rename"), _("Rename"), sigc::ptr_fun (RedirectBox::rb_rename)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); + ActionManager::register_action (popup_act_grp, X_("selectall"), _("Select All"), sigc::ptr_fun (RedirectBox::rb_select_all)); + ActionManager::register_action (popup_act_grp, X_("deselectall"), _("Deselect All"), sigc::ptr_fun (RedirectBox::rb_deselect_all)); + + /* activation */ + act = ActionManager::register_action (popup_act_grp, X_("activate"), _("Activate"), sigc::ptr_fun (RedirectBox::rb_activate)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); + act = ActionManager::register_action (popup_act_grp, X_("deactivate"), _("Deactivate"), sigc::ptr_fun (RedirectBox::rb_deactivate)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); + ActionManager::register_action (popup_act_grp, X_("activate_all"), _("Activate all"), sigc::ptr_fun (RedirectBox::rb_activate_all)); + ActionManager::register_action (popup_act_grp, X_("deactivate_all"), _("Deactivate all"), sigc::ptr_fun (RedirectBox::rb_deactivate_all)); + + /* show editors */ + act = ActionManager::register_action (popup_act_grp, X_("edit"), _("Edit"), sigc::ptr_fun (RedirectBox::rb_edit)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); + + ActionManager::add_action_group (popup_act_grp); +} + +void +RedirectBox::rb_choose_plugin () +{ + if (_current_redirect_box == 0) { + return; + } + _current_redirect_box->choose_plugin (); +} + +void +RedirectBox::rb_choose_insert () +{ + if (_current_redirect_box == 0) { + return; + } + _current_redirect_box->choose_insert (); +} + +void +RedirectBox::rb_choose_send () +{ + if (_current_redirect_box == 0) { + return; + } + _current_redirect_box->choose_send (); +} + +void +RedirectBox::rb_clear () +{ + if (_current_redirect_box == 0) { + return; + } + + _current_redirect_box->clear_redirects (); +} + +void +RedirectBox::rb_cut () +{ + if (_current_redirect_box == 0) { + return; + } + + _current_redirect_box->cut_redirects (); +} + +void +RedirectBox::rb_copy () +{ + if (_current_redirect_box == 0) { + return; + } + _current_redirect_box->copy_redirects (); +} + +void +RedirectBox::rb_paste () +{ + if (_current_redirect_box == 0) { + return; + } +} + +void +RedirectBox::rb_rename () +{ + if (_current_redirect_box == 0) { + return; + } + _current_redirect_box->rename_redirects (); +} + +void +RedirectBox::rb_select_all () +{ + if (_current_redirect_box == 0) { + return; + } + + _current_redirect_box->select_all_redirects (); +} + +void +RedirectBox::rb_deselect_all () +{ + if (_current_redirect_box == 0) { + return; + } + + _current_redirect_box->deselect_all_redirects (); +} + +void +RedirectBox::rb_activate () +{ + if (_current_redirect_box == 0) { + return; + } + + _current_redirect_box->for_selected_redirects (&RedirectBox::activate_redirect); +} + +void +RedirectBox::rb_deactivate () +{ + if (_current_redirect_box == 0) { + return; + } + _current_redirect_box->for_selected_redirects (&RedirectBox::deactivate_redirect); +} + +void +RedirectBox::rb_activate_all () +{ + if (_current_redirect_box == 0) { + return; + } + + _current_redirect_box->all_redirects_active (true); +} + +void +RedirectBox::rb_deactivate_all () +{ + if (_current_redirect_box == 0) { + return; + } + _current_redirect_box->all_redirects_active (false); +} + +void +RedirectBox::rb_edit () +{ + if (_current_redirect_box == 0) { + return; + } + + _current_redirect_box->for_selected_redirects (&RedirectBox::edit_redirect); +} diff --git a/gtk2_ardour/redirect_box.h b/gtk2_ardour/redirect_box.h index c5e274b017..d94ad20487 100644 --- a/gtk2_ardour/redirect_box.h +++ b/gtk2_ardour/redirect_box.h @@ -83,6 +83,8 @@ class RedirectBox : public Gtk::HBox sigc::signal RedirectSelected; sigc::signal RedirectUnselected; + static void register_actions(); + protected: void set_stuff_from_route (); @@ -125,8 +127,6 @@ class RedirectBox : public Gtk::HBox void new_send (); void show_send_controls (); - Glib::RefPtr popup_ui_mgr; - Glib::RefPtr popup_act_grp; Gtk::Menu *redirect_menu; gint redirect_menu_map_handler (GdkEventAny *ev); Gtk::Menu * build_redirect_menu (); @@ -182,6 +182,25 @@ class RedirectBox : public Gtk::HBox void wierd_plugin_dialog (ARDOUR::Plugin& p, uint32_t streams, ARDOUR::IO& io); + static RedirectBox* _current_redirect_box; + static bool enter_box (GdkEventCrossing*, RedirectBox*); + static bool leave_box (GdkEventCrossing*, RedirectBox*); + + static void rb_choose_plugin (); + static void rb_choose_insert (); + static void rb_choose_send (); + static void rb_clear (); + static void rb_cut (); + static void rb_copy (); + static void rb_paste (); + static void rb_rename (); + static void rb_select_all (); + static void rb_deselect_all (); + static void rb_activate (); + static void rb_deactivate (); + static void rb_activate_all (); + static void rb_deactivate_all (); + static void rb_edit (); }; #endif /* __ardour_gtk_redirect_box__ */