diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2005-11-17 21:31:37 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2005-11-17 21:31:37 +0000 |
commit | cdc2d055f1ede3d9565dbf2b2d1abbf87a1f622c (patch) | |
tree | 2523a3b351add1113224052612864327f526929e /gtk2_ardour | |
parent | 5d515004903f75d8c18328c0bdb84008ae5bfe23 (diff) |
more fixes on the long road to compiling
git-svn-id: svn://localhost/trunk/ardour2@103 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/actions.cc | 41 | ||||
-rw-r--r-- | gtk2_ardour/actions.h | 5 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_ed.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/default_keys.cc | 121 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_actions.cc | 7 | ||||
-rw-r--r-- | gtk2_ardour/editor_keys.cc | 139 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/mtest.cc | 124 | ||||
-rw-r--r-- | gtk2_ardour/mtest.menus | 1 | ||||
-rw-r--r-- | gtk2_ardour/mtest_other.menus | 3 | ||||
-rw-r--r-- | gtk2_ardour/public_editor.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/public_editor.h | 22 |
15 files changed, 214 insertions, 263 deletions
diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc index c455b30ed0..86ca2284f3 100644 --- a/gtk2_ardour/actions.cc +++ b/gtk2_ardour/actions.cc @@ -29,21 +29,21 @@ using namespace std; using namespace Gtk; using namespace Glib; using namespace sigc; +using namespace ActionManager; -vector<Glib::RefPtr<Gtk::Action> > ActionManager::session_sensitive_actions; -vector<Glib::RefPtr<Gtk::Action> > ActionManager::region_list_selection_sensitive_actions; -vector<Glib::RefPtr<Gtk::Action> > ActionManager::region_selection_sensitive_actions; -vector<Glib::RefPtr<Gtk::Action> > ActionManager::track_selection_sensitive_actions; -vector<Glib::RefPtr<Gtk::Action> > ActionManager::plugin_selection_sensitive_actions; -vector<Glib::RefPtr<Gtk::Action> > ActionManager::range_sensitive_actions; -vector<Glib::RefPtr<Gtk::Action> > ActionManager::jack_sensitive_actions; +vector<RefPtr<Gtk::Action> > ActionManager::session_sensitive_actions; +vector<RefPtr<Gtk::Action> > ActionManager::region_list_selection_sensitive_actions; +vector<RefPtr<Gtk::Action> > ActionManager::region_selection_sensitive_actions; +vector<RefPtr<Gtk::Action> > ActionManager::track_selection_sensitive_actions; +vector<RefPtr<Gtk::Action> > ActionManager::plugin_selection_sensitive_actions; +vector<RefPtr<Gtk::Action> > ActionManager::range_sensitive_actions; +vector<RefPtr<Gtk::Action> > ActionManager::jack_sensitive_actions; +string ActionManager::unbound_string = "--"; -namespace ActionManager { - -static vector<Glib::RefPtr<UIManager> > ui_managers; +static vector<RefPtr<UIManager> > ui_managers; void -register_ui_manager (Glib::RefPtr<UIManager> uim) +register_ui_manager (RefPtr<UIManager> uim) { ui_managers.push_back (uim); } @@ -119,7 +119,7 @@ register_toggle_action (RefPtr<ActionGroup> group, string name, string label, sl return act; } -bool lookup_entry (const Glib::ustring accel_path, Gtk::AccelKey& key) +bool lookup_entry (const ustring accel_path, Gtk::AccelKey& key) { GtkAccelKey gkey; bool known = gtk_accel_map_lookup_entry (accel_path.c_str(), &gkey); @@ -134,9 +134,20 @@ bool lookup_entry (const Glib::ustring accel_path, Gtk::AccelKey& key) } void +merge_actions (RefPtr<ActionGroup> dst, const RefPtr<ActionGroup> src) +{ + ListHandle<RefPtr<Action> > group_actions = src->get_actions(); + + for (ListHandle<RefPtr<Action> >::iterator a = group_actions.begin(); a != group_actions.end(); ++a) { + RefPtr<Action> act = Action::create ((*a)->get_name(), (*a)->property_label()); + dst->add (act); + } +} + +void get_all_actions (vector<string>& names, vector<string>& paths, vector<string>& keys, vector<AccelKey>& bindings) { - for (vector<Glib::RefPtr<UIManager> >::iterator u = ui_managers.begin(); u != ui_managers.end(); ++u) { + for (vector<RefPtr<UIManager> >::iterator u = ui_managers.begin(); u != ui_managers.end(); ++u) { ListHandle<RefPtr<ActionGroup> > uim_groups = (*u)->get_action_groups (); @@ -159,7 +170,7 @@ get_all_actions (vector<string>& names, vector<string>& paths, vector<string>& k if (known) { keys.push_back ((*u)->get_accel_group()->name (key.get_key(), Gdk::ModifierType (key.get_mod()))); } else { - keys.push_back ("--"); + keys.push_back (unbound_string); } bindings.push_back (AccelKey (key.get_key(), Gdk::ModifierType (key.get_mod()))); @@ -167,5 +178,3 @@ get_all_actions (vector<string>& names, vector<string>& paths, vector<string>& k } } } - -} diff --git a/gtk2_ardour/actions.h b/gtk2_ardour/actions.h index d36b8b07f4..e0d7fa020f 100644 --- a/gtk2_ardour/actions.h +++ b/gtk2_ardour/actions.h @@ -21,6 +21,8 @@ namespace ActionManager extern std::vector<Glib::RefPtr<Gtk::Action> > range_sensitive_actions; extern std::vector<Glib::RefPtr<Gtk::Action> > jack_sensitive_actions; + extern std::string unbound_string; /* the key string returned if an action is not bound */ + void register_ui_manager (Glib::RefPtr<Gtk::UIManager>); Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group, @@ -42,6 +44,9 @@ namespace ActionManager guint key, Gdk::ModifierType mods); Glib::RefPtr<Gtk::Action> register_toggle_action (Glib::RefPtr<Gtk::ActionGroup> group, std::string name, std::string label, sigc::slot<void> sl); + + void merge_actions (Glib::RefPtr<Gtk::ActionGroup> dst, const Glib::RefPtr<Gtk::ActionGroup> src); + }; #endif /* __ardour_gtk_actions_h__ */ diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index b5ed3b4e3a..49b1272d24 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -677,6 +677,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI /* Keymap handling */ void install_keybindings (); + Glib::RefPtr<Gtk::ActionGroup> get_common_actions(); void install_actions (); void test_binding_action (const char *); void start_keyboard_prefix(); @@ -732,6 +733,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI bool filter_ardour_session_dirs (const Gtk::FileFilter::Info&); Glib::RefPtr<Gtk::UIManager> ui_manager; + Glib::RefPtr<Gtk::ActionGroup> common_actions; }; #endif /* __ardour_gui_h__ */ diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 42bfadea93..d653df9942 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -139,7 +139,9 @@ ARDOUR_UI::install_actions () act = register_radio_action (jack_actions, jack_latency_group, X_("JACKLatency8192"), X_("8192"), bind (mem_fun(*this, &ARDOUR_UI::set_jack_buffer_size), (jack_nframes_t) 8192)); jack_sensitive_actions.push_back (act); - Glib::RefPtr<ActionGroup> common_actions = ActionGroup::create (X_("Common")); + /* these actions are intended to be shared across all windows */ + + common_actions = ActionGroup::create (X_("Common")); register_action (common_actions, X_("Start-Prefix"), _("start prefix"), mem_fun(*this, &ARDOUR_UI::start_keyboard_prefix)); register_action (common_actions, X_("Quit"), _("quit"), (mem_fun(*this, &ARDOUR_UI::finish))); diff --git a/gtk2_ardour/default_keys.cc b/gtk2_ardour/default_keys.cc index 95bc1f0642..a15e12cfae 100644 --- a/gtk2_ardour/default_keys.cc +++ b/gtk2_ardour/default_keys.cc @@ -32,74 +32,73 @@ using namespace sigc; void ARDOUR_UI::install_keybindings () { - KeyboardTarget::add_action ("start-prefix", mem_fun(*this, &ARDOUR_UI::start_keyboard_prefix)); + register_action (shared_actions, "start-prefix", _("start-prefix"), mem_fun(*this, &ARDOUR_UI::start_keyboard_prefix)); - KeyboardTarget::add_action ("toggle-editor-window", mem_fun(*this, &ARDOUR_UI::goto_editor_window)); - KeyboardTarget::add_action ("toggle-mixer-window", mem_fun(*this, &ARDOUR_UI::goto_mixer_window)); - KeyboardTarget::add_action ("toggle-locations-window", mem_fun(*this, &ARDOUR_UI::toggle_location_window)); - KeyboardTarget::add_action ("toggle-big-clock-window", mem_fun(*this, &ARDOUR_UI::toggle_big_clock_window)); - KeyboardTarget::add_action ("toggle-options-window", mem_fun(*this, &ARDOUR_UI::toggle_options_window)); - KeyboardTarget::add_action ("toggle-auto-loop", mem_fun(*this, &ARDOUR_UI::toggle_session_auto_loop)); - KeyboardTarget::add_action ("toggle-punch-in", mem_fun(*this, &ARDOUR_UI::toggle_session_punch_in)); + register_action (shared_actions, "toggle-editor-window", _("toggle-editor-window"), mem_fun(*this, &ARDOUR_UI::goto_editor_window)); + register_action (shared_actions, "toggle-mixer-window", _("toggle-mixer-window"), mem_fun(*this, &ARDOUR_UI::goto_mixer_window)); + register_action (shared_actions, "toggle-locations-window", _("toggle-locations-window"), mem_fun(*this, &ARDOUR_UI::toggle_location_window)); + register_action (shared_actions, "toggle-big-clock-window", _("toggle-big-clock-window"), mem_fun(*this, &ARDOUR_UI::toggle_big_clock_window)); + register_action (shared_actions, "toggle-options-window", _("toggle-options-window"), mem_fun(*this, &ARDOUR_UI::toggle_options_window)); + register_action (shared_actions, "toggle-auto-loop", _("toggle-auto-loop"), mem_fun(*this, &ARDOUR_UI::toggle_session_auto_loop)); + register_action (shared_actions, "toggle-punch-in", _("toggle-punch-in"), mem_fun(*this, &ARDOUR_UI::toggle_session_punch_in)); - KeyboardTarget::add_action ("new-session", bind (mem_fun(*this, &ARDOUR_UI::new_session), false, string())); - KeyboardTarget::add_action ("add-audio-track", bind (mem_fun(*this, &ARDOUR_UI::session_add_audio_track), 1, 1)); - KeyboardTarget::add_action ("add-audio-bus", bind (mem_fun(*this, &ARDOUR_UI::session_add_audio_bus), 1, 1)); + register_action (shared_actions, "new-session", _("new-session"), bind (mem_fun(*this, &ARDOUR_UI::new_session), false, string())); + register_action (shared_actions, "add-audio-track", _("add-audio-track"), bind (mem_fun(*this, &ARDOUR_UI::session_add_audio_track), 1, 1)); + register_action (shared_actions, "add-audio-bus", _("add-audio-bus"), bind (mem_fun(*this, &ARDOUR_UI::session_add_audio_bus), 1, 1)); - KeyboardTarget::add_action ("save-state", bind (mem_fun(*this, &ARDOUR_UI::save_state), string (""))); - KeyboardTarget::add_action ("quit", (mem_fun(*this, &ARDOUR_UI::finish))); + register_action (shared_actions, "save-state", _("save-state"), bind (mem_fun(*this, &ARDOUR_UI::save_state), string (""))); + register_action (shared_actions, "quit", _("quit"), (mem_fun(*this, &ARDOUR_UI::finish))); + register_action (shared_actions, "remove-last-capture", _("remove-last-capture"), mem_fun(*this, &ARDOUR_UI::remove_last_capture)); - KeyboardTarget::add_action ("remove-last-capture", mem_fun(*this, &ARDOUR_UI::remove_last_capture)); + register_action (shared_actions, "transport-stop", _("transport-stop"), mem_fun(*this, &ARDOUR_UI::transport_stop)); + register_action (shared_actions, "transport-stop-and-forget-capture", _("transport-stop-and-forget-capture"), mem_fun(*this, &ARDOUR_UI::transport_stop_and_forget_capture)); + register_action (shared_actions, "transport-roll", _("transport-roll"), mem_fun(*this, &ARDOUR_UI::transport_roll)); + register_action (shared_actions, "transport-loop", _("transport-loop"), mem_fun(*this, &ARDOUR_UI::transport_loop)); + register_action (shared_actions, "transport-record", _("transport-record"), mem_fun(*this, &ARDOUR_UI::transport_record)); + register_action (shared_actions, "transport-rewind", _("transport-rewind"), bind (mem_fun(*this, &ARDOUR_UI::transport_rewind), 0)); + register_action (shared_actions, "transport-rewind-slow", _("transport-rewind-slow"), bind (mem_fun(*this, &ARDOUR_UI::transport_rewind), -1)); + register_action (shared_actions, "transport-rewind-fast", _("transport-rewind-fast"), bind (mem_fun(*this, &ARDOUR_UI::transport_rewind), 1)); + register_action (shared_actions, "transport-forward", _("transport-forward"), bind (mem_fun(*this, &ARDOUR_UI::transport_forward), 0)); + register_action (shared_actions, "transport-forward-slow", _("transport-forward-slow"), bind (mem_fun(*this, &ARDOUR_UI::transport_forward), -1)); + register_action (shared_actions, "transport-forward-fast", _("transport-forward-fast"), bind (mem_fun(*this, &ARDOUR_UI::transport_forward), 1)); - KeyboardTarget::add_action ("transport-stop", mem_fun(*this, &ARDOUR_UI::transport_stop)); - KeyboardTarget::add_action ("transport-stop-and-forget-capture", mem_fun(*this, &ARDOUR_UI::transport_stop_and_forget_capture)); - KeyboardTarget::add_action ("transport-roll", mem_fun(*this, &ARDOUR_UI::transport_roll)); - KeyboardTarget::add_action ("transport-loop", mem_fun(*this, &ARDOUR_UI::transport_loop)); - KeyboardTarget::add_action ("transport-record", mem_fun(*this, &ARDOUR_UI::transport_record)); - KeyboardTarget::add_action ("transport-rewind", bind (mem_fun(*this, &ARDOUR_UI::transport_rewind), 0)); - KeyboardTarget::add_action ("transport-rewind-slow", bind (mem_fun(*this, &ARDOUR_UI::transport_rewind), -1)); - KeyboardTarget::add_action ("transport-rewind-fast", bind (mem_fun(*this, &ARDOUR_UI::transport_rewind), 1)); - KeyboardTarget::add_action ("transport-forward", bind (mem_fun(*this, &ARDOUR_UI::transport_forward), 0)); - KeyboardTarget::add_action ("transport-forward-slow", bind (mem_fun(*this, &ARDOUR_UI::transport_forward), -1)); - KeyboardTarget::add_action ("transport-forward-fast", bind (mem_fun(*this, &ARDOUR_UI::transport_forward), 1)); + register_action (shared_actions, "transport-goto-start", _("transport-goto-start"), mem_fun(*this, &ARDOUR_UI::transport_goto_start)); + register_action (shared_actions, "transport-goto-end", _("transport-goto-end"), mem_fun(*this, &ARDOUR_UI::transport_goto_end)); - KeyboardTarget::add_action ("transport-goto-start", mem_fun(*this, &ARDOUR_UI::transport_goto_start)); - KeyboardTarget::add_action ("transport-goto-end", mem_fun(*this, &ARDOUR_UI::transport_goto_end)); - - KeyboardTarget::add_action ("send-all-midi-feedback", mem_fun(*this, &ARDOUR_UI::send_all_midi_feedback)); + register_action (shared_actions, "send-all-midi-feedback", _("send-all-midi-feedback"), mem_fun(*this, &ARDOUR_UI::send_all_midi_feedback)); - KeyboardTarget::add_action ("toggle-record-enable-track1", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 0U)); - KeyboardTarget::add_action ("toggle-record-enable-track2", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 1U)); - KeyboardTarget::add_action ("toggle-record-enable-track3", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 2U)); - KeyboardTarget::add_action ("toggle-record-enable-track4", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 3U)); - KeyboardTarget::add_action ("toggle-record-enable-track5", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 4U)); - KeyboardTarget::add_action ("toggle-record-enable-track6", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 5U)); - KeyboardTarget::add_action ("toggle-record-enable-track7", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 6U)); - KeyboardTarget::add_action ("toggle-record-enable-track8", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 7U)); - KeyboardTarget::add_action ("toggle-record-enable-track9", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 8U)); - KeyboardTarget::add_action ("toggle-record-enable-track10", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 9U)); - KeyboardTarget::add_action ("toggle-record-enable-track11", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 10U)); - KeyboardTarget::add_action ("toggle-record-enable-track12", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 11U)); - KeyboardTarget::add_action ("toggle-record-enable-track13", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 12U)); - KeyboardTarget::add_action ("toggle-record-enable-track14", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 13U)); - KeyboardTarget::add_action ("toggle-record-enable-track15", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 14U)); - KeyboardTarget::add_action ("toggle-record-enable-track16", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 15U)); - KeyboardTarget::add_action ("toggle-record-enable-track17", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 16U)); - KeyboardTarget::add_action ("toggle-record-enable-track18", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 17U)); - KeyboardTarget::add_action ("toggle-record-enable-track19", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 18U)); - KeyboardTarget::add_action ("toggle-record-enable-track20", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 19U)); - KeyboardTarget::add_action ("toggle-record-enable-track21", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 20U)); - KeyboardTarget::add_action ("toggle-record-enable-track22", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 21U)); - KeyboardTarget::add_action ("toggle-record-enable-track23", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 22U)); - KeyboardTarget::add_action ("toggle-record-enable-track24", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 23U)); - KeyboardTarget::add_action ("toggle-record-enable-track25", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 24U)); - KeyboardTarget::add_action ("toggle-record-enable-track26", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 25U)); - KeyboardTarget::add_action ("toggle-record-enable-track27", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 26U)); - KeyboardTarget::add_action ("toggle-record-enable-track28", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 27U)); - KeyboardTarget::add_action ("toggle-record-enable-track29", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 28U)); - KeyboardTarget::add_action ("toggle-record-enable-track30", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 29U)); - KeyboardTarget::add_action ("toggle-record-enable-track31", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 30U)); - KeyboardTarget::add_action ("toggle-record-enable-track32", bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 31U)); + register_action (shared_actions, "toggle-record-enable-track1", _("toggle-record-enable-track1"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 0U)); + register_action (shared_actions, "toggle-record-enable-track2", _("toggle-record-enable-track2"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 1U)); + register_action (shared_actions, "toggle-record-enable-track3", _("toggle-record-enable-track3"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 2U)); + register_action (shared_actions, "toggle-record-enable-track4", _("toggle-record-enable-track4"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 3U)); + register_action (shared_actions, "toggle-record-enable-track5", _("toggle-record-enable-track5"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 4U)); + register_action (shared_actions, "toggle-record-enable-track6", _("toggle-record-enable-track6"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 5U)); + register_action (shared_actions, "toggle-record-enable-track7", _("toggle-record-enable-track7"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 6U)); + register_action (shared_actions, "toggle-record-enable-track8", _("toggle-record-enable-track8"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 7U)); + register_action (shared_actions, "toggle-record-enable-track9", _("toggle-record-enable-track9"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 8U)); + register_action (shared_actions, "toggle-record-enable-track10", _("toggle-record-enable-track10"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 9U)); + register_action (shared_actions, "toggle-record-enable-track11", _("toggle-record-enable-track11"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 10U)); + register_action (shared_actions, "toggle-record-enable-track12", _("toggle-record-enable-track12"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 11U)); + register_action (shared_actions, "toggle-record-enable-track13", _("toggle-record-enable-track13"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 12U)); + register_action (shared_actions, "toggle-record-enable-track14", _("toggle-record-enable-track14"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 13U)); + register_action (shared_actions, "toggle-record-enable-track15", _("toggle-record-enable-track15"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 14U)); + register_action (shared_actions, "toggle-record-enable-track16", _("toggle-record-enable-track16"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 15U)); + register_action (shared_actions, "toggle-record-enable-track17", _("toggle-record-enable-track17"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 16U)); + register_action (shared_actions, "toggle-record-enable-track18", _("toggle-record-enable-track18"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 17U)); + register_action (shared_actions, "toggle-record-enable-track19", _("toggle-record-enable-track19"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 18U)); + register_action (shared_actions, "toggle-record-enable-track20", _("toggle-record-enable-track20"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 19U)); + register_action (shared_actions, "toggle-record-enable-track21", _("toggle-record-enable-track21"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 20U)); + register_action (shared_actions, "toggle-record-enable-track22", _("toggle-record-enable-track22"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 21U)); + register_action (shared_actions, "toggle-record-enable-track23", _("toggle-record-enable-track23"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 22U)); + register_action (shared_actions, "toggle-record-enable-track24", _("toggle-record-enable-track24"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 23U)); + register_action (shared_actions, "toggle-record-enable-track25", _("toggle-record-enable-track25"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 24U)); + register_action (shared_actions, "toggle-record-enable-track26", _("toggle-record-enable-track26"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 25U)); + register_action (shared_actions, "toggle-record-enable-track27", _("toggle-record-enable-track27"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 26U)); + register_action (shared_actions, "toggle-record-enable-track28", _("toggle-record-enable-track28"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 27U)); + register_action (shared_actions, "toggle-record-enable-track29", _("toggle-record-enable-track29"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 28U)); + register_action (shared_actions, "toggle-record-enable-track30", _("toggle-record-enable-track30"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 29U)); + register_action (shared_actions, "toggle-record-enable-track31", _("toggle-record-enable-track31"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 30U)); + register_action (shared_actions, "toggle-record-enable-track32", _("toggle-record-enable-track32"), bind (mem_fun(*this, &ARDOUR_UI::toggle_record_enable), 31U)); #if 0 ADD ME TO ARDOUR RC SOMEDAY diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 0e568b43aa..52be03c464 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -47,7 +47,6 @@ #include <ardour/location.h> #include <ardour/region.h> -#include "keyboard_target.h" #include "audio_clock.h" #include "gtk-custom-ruler.h" #include "ardour_dialog.h" @@ -834,7 +833,6 @@ class Editor : public PublicEditor /* KEYMAP HANDLING */ void register_actions (); - void install_keybindings (); int ensure_cursor (jack_nframes_t* pos); diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 7ff4594743..13b4769111 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -17,10 +17,15 @@ using namespace ActionManager; void Editor::register_actions () { - /* add named actions for the editor */ Glib::RefPtr<ActionGroup> editor_actions = ActionGroup::create (X_("Editor")); + /* start with actions shared between all top level (major) windows */ + + merge_actions (editor_actions, ARDOUR_UI::instance()::get_common_actions()); + + /* add named actions for the editor */ + register_action (editor_actions, "toggle-xfades-active", _("toggle xfades active"), mem_fun(*this, &Editor::toggle_xfades_active)); register_action (editor_actions, "playhead-to-next-region-start", _("playhead to next region start"), bind (mem_fun(*this, &Editor::cursor_to_next_region_point), playhead_cursor, RegionPoint (Start))); diff --git a/gtk2_ardour/editor_keys.cc b/gtk2_ardour/editor_keys.cc index dca998b43b..226863b88b 100644 --- a/gtk2_ardour/editor_keys.cc +++ b/gtk2_ardour/editor_keys.cc @@ -39,145 +39,6 @@ using namespace ARDOUR; using namespace sigc; void -Editor::install_keybindings () -{ - /* add named actions for the editor */ - - add_action ("toggle-xfades-active", mem_fun(*this, &Editor::toggle_xfades_active)); - - add_action ("playhead-to-next-region-start", bind (mem_fun(*this, &Editor::cursor_to_next_region_point), playhead_cursor, RegionPoint (Start))); - add_action ("playhead-to-next-region-end", bind (mem_fun(*this, &Editor::cursor_to_next_region_point), playhead_cursor, RegionPoint (End))); - add_action ("playhead-to-next-region-sync", bind (mem_fun(*this, &Editor::cursor_to_next_region_point), playhead_cursor, RegionPoint (SyncPoint))); - - add_action ("playhead-to-previous-region-start", bind (mem_fun(*this, &Editor::cursor_to_previous_region_point), playhead_cursor, RegionPoint (Start))); - add_action ("playhead-to-previous-region-end", bind (mem_fun(*this, &Editor::cursor_to_previous_region_point), playhead_cursor, RegionPoint (End))); - add_action ("playhead-to-previous-region-sync", bind (mem_fun(*this, &Editor::cursor_to_previous_region_point), playhead_cursor, RegionPoint (SyncPoint))); - - add_action ("edit-cursor-to-next-region-start", bind (mem_fun(*this, &Editor::cursor_to_next_region_point), edit_cursor, RegionPoint (Start))); - add_action ("edit-cursor-to-next-region-end", bind (mem_fun(*this, &Editor::cursor_to_next_region_point), edit_cursor, RegionPoint (End))); - add_action ("edit-cursor-to-next-region-sync", bind (mem_fun(*this, &Editor::cursor_to_next_region_point), edit_cursor, RegionPoint (SyncPoint))); - - add_action ("edit-cursor-to-previous-region-start", bind (mem_fun(*this, &Editor::cursor_to_previous_region_point), edit_cursor, RegionPoint (Start))); - add_action ("edit-cursor-to-previous-region-end", bind (mem_fun(*this, &Editor::cursor_to_previous_region_point), edit_cursor, RegionPoint (End))); - add_action ("edit-cursor-to-previous-region-sync", bind (mem_fun(*this, &Editor::cursor_to_previous_region_point), edit_cursor, RegionPoint (SyncPoint))); - - add_action ("playhead-to-range-start", bind (mem_fun(*this, &Editor::cursor_to_selection_start), playhead_cursor)); - add_action ("playhead-to-range-end", bind (mem_fun(*this, &Editor::cursor_to_selection_end), playhead_cursor)); - - add_action ("edit-cursor-to-range-start", bind (mem_fun(*this, &Editor::cursor_to_selection_start), edit_cursor)); - add_action ("edit-cursor-to-range-end", bind (mem_fun(*this, &Editor::cursor_to_selection_end), edit_cursor)); - - add_action ("jump-forward-to-mark", mem_fun(*this, &Editor::jump_forward_to_mark)); - add_action ("jump-backward-to-mark", mem_fun(*this, &Editor::jump_backward_to_mark)); - add_action ("add-location-from-playhead", mem_fun(*this, &Editor::add_location_from_playhead_cursor)); - - add_action ("nudge-forward", bind (mem_fun(*this, &Editor::nudge_forward), false)); - add_action ("nudge-next-forward", bind (mem_fun(*this, &Editor::nudge_forward), true)); - add_action ("nudge-backward", bind (mem_fun(*this, &Editor::nudge_backward), false)); - add_action ("nudge-next-backward", bind (mem_fun(*this, &Editor::nudge_backward), true)); - - add_action ("toggle-playback", bind (mem_fun(*this, &Editor::toggle_playback), false)); - add_action ("toggle-playback-forget-capture", bind (mem_fun(*this, &Editor::toggle_playback), true)); - - add_action ("toggle-loop-playback", mem_fun(*this, &Editor::toggle_loop_playback)); - - add_action ("temporal-zoom-out", bind (mem_fun(*this, &Editor::temporal_zoom_step), true)); - add_action ("temporal-zoom-in", bind (mem_fun(*this, &Editor::temporal_zoom_step), false)); - add_action ("zoom-to-session", mem_fun(*this, &Editor::temporal_zoom_session)); - - add_action ("scroll-tracks-up", mem_fun(*this, &Editor::scroll_tracks_up)); - add_action ("scroll-tracks-down", mem_fun(*this, &Editor::scroll_tracks_down)); - add_action ("step-tracks-up", mem_fun(*this, &Editor::scroll_tracks_up_line)); - add_action ("step-tracks-down", mem_fun(*this, &Editor::scroll_tracks_down_line)); - - add_action ("scroll-backward", bind (mem_fun(*this, &Editor::scroll_backward), 0.8f)); - add_action ("scroll-forward", bind (mem_fun(*this, &Editor::scroll_forward), 0.8f)); - add_action ("goto", mem_fun(*this, &Editor::goto_frame)); - add_action ("center-playhead", mem_fun(*this, &Editor::center_playhead)); - add_action ("center-edit_cursor", mem_fun(*this, &Editor::center_edit_cursor)); - add_action ("playhead-forward", mem_fun(*this, &Editor::playhead_forward)); - add_action ("playhead-backward", mem_fun(*this, &Editor::playhead_backward)); - add_action ("playhead-to-edit", bind (mem_fun(*this, &Editor::cursor_align), true)); - add_action ("edit-to-playhead", bind (mem_fun(*this, &Editor::cursor_align), false)); - - add_action ("align-regions-start", bind (mem_fun(*this, &Editor::align), ARDOUR::Start)); - add_action ("align-regions-start-relative", bind (mem_fun(*this, &Editor::align_relative), ARDOUR::Start)); - add_action ("align-regions-end", bind (mem_fun(*this, &Editor::align), ARDOUR::End)); - add_action ("align-regions-end-relative", bind (mem_fun(*this, &Editor::align_relative), ARDOUR::End)); - add_action ("align-regions-sync", bind (mem_fun(*this, &Editor::align), ARDOUR::SyncPoint)); - add_action ("align-regions-sync-relative", bind (mem_fun(*this, &Editor::align_relative), ARDOUR::SyncPoint)); - - add_action ("set-playhead", mem_fun(*this, &Editor::kbd_set_playhead_cursor)); - add_action ("set-edit-cursor", mem_fun(*this, &Editor::kbd_set_edit_cursor)); - - add_action ("set-mouse-mode-object", bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseObject, false)); - add_action ("set-mouse-mode-range", bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseRange, false)); - add_action ("set-mouse-mode-gain", bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseGain, false)); - add_action ("set-mouse-mode-zoom", bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseZoom, false)); - add_action ("set-mouse-mode-timefx", bind (mem_fun(*this, &Editor::set_mouse_mode), Editing::MouseTimeFX, false)); - - add_action ("set-undo", bind (mem_fun(*this, &Editor::undo), 1U)); - add_action ("set-redo", bind (mem_fun(*this, &Editor::redo), 1U)); - - add_action ("export-session", mem_fun(*this, &Editor::export_session)); - add_action ("export-range", mem_fun(*this, &Editor::export_selection)); - - add_action ("editor-cut", mem_fun(*this, &Editor::cut)); - add_action ("editor-copy", mem_fun(*this, &Editor::copy)); - add_action ("editor-paste", mem_fun(*this, &Editor::keyboard_paste)); - add_action ("duplicate-region", mem_fun(*this, &Editor::keyboard_duplicate_region)); - add_action ("duplicate-range", mem_fun(*this, &Editor::keyboard_duplicate_selection)); - add_action ("insert-region", mem_fun(*this, &Editor::keyboard_insert_region_list_selection)); - add_action ("reverse-region", mem_fun(*this, &Editor::reverse_region)); - add_action ("normalize-region", mem_fun(*this, &Editor::normalize_region)); - add_action ("editor-crop", mem_fun(*this, &Editor::crop_region_to_selection)); - add_action ("insert-chunk", bind (mem_fun(*this, &Editor::paste_named_selection), 1.0f)); - - add_action ("split-at-edit-cursor", mem_fun(*this, &Editor::split_region)); - add_action ("split-at-mouse", mem_fun(*this, &Editor::kbd_split)); - - add_action ("brush-at-mouse", mem_fun(*this, &Editor::kbd_brush)); - add_action ("audition-at-mouse", mem_fun(*this, &Editor::kbd_audition)); - - add_action ("start-range", mem_fun(*this, &Editor::keyboard_selection_begin)); - add_action ("finish-range", bind (mem_fun(*this, &Editor::keyboard_selection_finish), false)); - add_action ("finish-add-range", bind (mem_fun(*this, &Editor::keyboard_selection_finish), true)); - - add_action ("extend-range-to-end-of-region", bind (mem_fun(*this, &Editor::extend_selection_to_end_of_region), false)); - add_action ("extend-range-to-start-of-region", bind (mem_fun(*this, &Editor::extend_selection_to_start_of_region), false)); - - add_action ("zoom-focus-left", bind (mem_fun(*this, &Editor::set_zoom_focus), Editing::ZoomFocusLeft)); - add_action ("zoom-focus-right", bind (mem_fun(*this, &Editor::set_zoom_focus), Editing::ZoomFocusRight)); - add_action ("zoom-focus-center", bind (mem_fun(*this, &Editor::set_zoom_focus), Editing::ZoomFocusCenter)); - add_action ("zoom-focus-playhead", bind (mem_fun(*this, &Editor::set_zoom_focus), Editing::ZoomFocusPlayhead)); - add_action ("zoom-focus-edit", bind (mem_fun(*this, &Editor::set_zoom_focus), Editing::ZoomFocusEdit)); - - add_action ("toggle-follow-playhead", (mem_fun(*this, &Editor::toggle_follow_playhead))); - add_action ("remove-last-capture", (mem_fun(*this, &Editor::remove_last_capture))); - - add_action ("snap-to-frame", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToFrame))); - add_action ("snap-to-cd-frame", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToCDFrame))); - add_action ("snap-to-smpte-frame", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToSMPTEFrame))); - add_action ("snap-to-smpte-seconds", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToSMPTESeconds))); - add_action ("snap-to-smpte-minutes", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToSMPTEMinutes))); - add_action ("snap-to-seconds", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToSeconds))); - add_action ("snap-to-minutes", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToMinutes))); - add_action ("snap-to-thirtyseconds", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToAThirtysecondBeat))); - add_action ("snap-to-asixteenthbeat", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToASixteenthBeat))); - add_action ("snap-to-eighths", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToAEighthBeat))); - add_action ("snap-to-quarters", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToAQuarterBeat))); - add_action ("snap-to-thirds", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToAThirdBeat))); - add_action ("snap-to-beat", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToBeat))); - add_action ("snap-to-bar", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToBar))); - add_action ("snap-to-mark", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToMark))); - add_action ("snap-to-edit-cursor", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToEditCursor))); - add_action ("snap-to-region-start", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToRegionStart))); - add_action ("snap-to-region-end", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToRegionEnd))); - add_action ("snap-to-region-sync", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToRegionSync))); - add_action ("snap-to-region-boundary", (bind (mem_fun(*this, &Editor::set_snap_to), Editing::SnapToRegionBoundary))); -} - -void Editor::keyboard_selection_finish (bool add) { if (session && have_pending_keyboard_selection) { diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 1c711a5e41..83aa261895 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -49,7 +49,6 @@ using namespace sigc; Mixer_UI::Mixer_UI (AudioEngine& eng) : Window (Gtk::WINDOW_TOPLEVEL), - KeyboardTarget (*this, "mixer"), engine (eng) { _strip_width = Wide; diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index c520e66282..f1f004351a 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -52,7 +52,7 @@ namespace ARDOUR { class MixerStrip; class PluginSelector; -class Mixer_UI : public Gtk::Window, public KeyboardTarget +class Mixer_UI : public Gtk::Window { public: Mixer_UI (ARDOUR::AudioEngine&); diff --git a/gtk2_ardour/mtest.cc b/gtk2_ardour/mtest.cc index 49311e65d1..adc36c18f4 100644 --- a/gtk2_ardour/mtest.cc +++ b/gtk2_ardour/mtest.cc @@ -1,10 +1,31 @@ +#include <vector> #include <iostream> #include <gtkmm.h> #include <gtkmm/accelmap.h> +#include <gdk/gdkkeysyms.h> +#include <gtk/gtkaccelmap.h> using namespace Gtk; using namespace std; using namespace sigc; +using namespace Glib; + +struct ActionBinding { + Glib::ustring name; + Glib::ustring label; + Gtk::Action::SlotActivate binding; + guint key; + Gdk::ModifierType mods; + + ActionBinding (Glib::ustring n, Glib::ustring l, Gtk::Action::SlotActivate b, + guint k = GDK_VoidSymbol, Gdk::ModifierType m = Gdk::ModifierType (0)) + : name (n), + label (l), + binding (b), + key (k), + mods (m) {} +}; + void printit (string txt) @@ -13,6 +34,21 @@ printit (string txt) } Glib::RefPtr<Action> +make_action (vector<Glib::RefPtr<ActionGroup> >& groups, string name, string label, slot<void> sl, guint key, Gdk::ModifierType mods) +{ + Glib::RefPtr<Action> last; + + for (vector<RefPtr<ActionGroup> >::iterator g = groups.begin(); g != groups.end(); ++g) { + Glib::RefPtr<Action> act = Action::create (name, label); + (*g)->add (act, sl); + AccelMap::add_entry (act->get_accel_path(), key, mods); + last = act; + } + + return last; +} + +Glib::RefPtr<Action> make_action (Glib::RefPtr<ActionGroup> group, Glib::RefPtr<AccelGroup> accel_group, string name, string label, slot<void> sl, guint key, Gdk::ModifierType mods) { Glib::RefPtr<Action> act; @@ -67,6 +103,46 @@ make_action (Glib::RefPtr<ActionGroup> group, string name, string label) return act; } +bool +lookup_entry (const ustring accel_path, Gtk::AccelKey& key) +{ + GtkAccelKey gkey; + bool known = gtk_accel_map_lookup_entry (accel_path.c_str(), &gkey); + + if (known) { + key = AccelKey (gkey.accel_key, Gdk::ModifierType (gkey.accel_mods)); + } else { + key = AccelKey (GDK_VoidSymbol, Gdk::ModifierType (0)); + } + + return known; +} + +RefPtr<ActionGroup> +make_shared_action_group (ustring name, vector<ActionBinding*>& actions) +{ + RefPtr<ActionGroup> grp = ActionGroup::create (name); + + for (vector<ActionBinding*>::iterator i = actions.begin(); i != actions.end(); ++i) { + RefPtr<Action> act = Action::create ((*i)->name, (*i)->label); + grp->add (act); + + if ((*i)->key != GDK_VoidSymbol) { + Gtk::AccelKey key; + + /* since this is a shared action, only add it once */ + + if (!lookup_entry (act->get_accel_path(), key)) { + AccelMap::add_entry (act->get_accel_path(), (*i)->key, (*i)->mods); + cerr << "added accel map entry for " << act->get_accel_path() << endl; + } + } + } + + return grp; +} + + int main (int argc, char* argv[]) { @@ -78,13 +154,12 @@ main (int argc, char* argv[]) VBox vpacker; VBox other_vpacker; - Glib::RefPtr<ActionGroup> shared_actions; Glib::RefPtr<ActionGroup> actions; Glib::RefPtr<ActionGroup> other_actions; + Glib::RefPtr<ActionGroup> shared_actions; Glib::RefPtr<UIManager> uimanager; Glib::RefPtr<UIManager> other_uimanager; Glib::RefPtr<UIManager> shared_uimanager; - Glib::RefPtr<AccelGroup> shared_accel_group; window.set_name ("Editor"); window.set_title ("Editor"); @@ -94,44 +169,42 @@ main (int argc, char* argv[]) uimanager = UIManager::create(); other_uimanager = UIManager::create(); - shared_uimanager = UIManager::create(); actions = ActionGroup::create("MyActions"); other_actions = ActionGroup::create("OtherActions"); - shared_actions = ActionGroup::create(); uimanager->add_ui_from_file ("mtest.menus"); other_uimanager->add_ui_from_file ("mtest_other.menus"); - AccelMap::load ("mtest.bindings"); + // AccelMap::load ("mtest.bindings"); - make_action (shared_actions, "SharedMenuBar", "shared"); - make_action (shared_actions, "SharedMenu", "sharedm"); - Glib::RefPtr<Action> act = make_action (shared_actions, "Baz", "baz", bind (sigc::ptr_fun (printit), "baz"), GDK_p, Gdk::MOD1_MASK); + vector<RefPtr<ActionGroup> > all_groups; + all_groups.push_back (actions); + all_groups.push_back (other_actions); - act->connect_proxy (button); - act->connect_proxy (other_button); - make_action (actions, "TopMenu", "top"); make_action (actions, "Foo", "foo", bind (sigc::ptr_fun (printit), "foo"), GDK_p, Gdk::ModifierType (0)); - make_action (actions, "Bar", "bar", bind (sigc::ptr_fun (printit), "bar"), GDK_p, Gdk::CONTROL_MASK); + make_action (other_actions, "OTopMenu", "otop"); make_action (other_actions, "OFoo", "foo", bind (sigc::ptr_fun (printit), "o-foo"), GDK_p, Gdk::ModifierType (0)); - make_action (other_actions, "OBar", "bar", bind (sigc::ptr_fun (printit), "o-bar"), GDK_p, Gdk::CONTROL_MASK); + + vector<ActionBinding*> shared_actions; + + shared_actions.push_back (new ActionBinding ("Bar", "bar", bind (sigc::ptr_fun (printit), "barshared"), GDK_p, Gdk::CONTROL_MASK)); + shared_actions.push_back (new ActionBinding ("Baz", "baz", bind (sigc::ptr_fun (printit), "baz-shared"), GDK_p, Gdk::SHIFT_MASK)); + + RefPtr<Action> act = Action::create (shared_actions.back()->name, shared_actions.back()->label); - other_uimanager->insert_action_group (other_actions); - other_uimanager->insert_action_group (shared_actions); + act->connect_proxy (button); + act->connect_proxy (other_button); uimanager->insert_action_group (actions); - uimanager->insert_action_group (shared_actions); - - shared_uimanager->insert_action_group (shared_actions); + uimanager->insert_action_group (make_shared_action_group ("shared", shared_actions)); + other_uimanager->insert_action_group (other_actions); + other_uimanager->insert_action_group (make_shared_action_group ("othershared", shared_actions)); other_window.add_accel_group (other_uimanager->get_accel_group()); - other_window.add_accel_group (shared_uimanager->get_accel_group()); - window.add_accel_group (uimanager->get_accel_group()); - window.add_accel_group (shared_uimanager->get_accel_group()); Gtk::MenuBar* m; @@ -148,19 +221,12 @@ main (int argc, char* argv[]) vpacker.pack_start (*m); vpacker.pack_start (button); - shared_uimanager->add_ui_from_file ("mtest_shared.menu"); - - MenuBar* item = dynamic_cast<MenuBar*> (shared_uimanager->get_widget ("/SharedMenuBar")); - window.add (vpacker); window.show_all (); Settings::get_default()->property_gtk_can_change_accels() = true; - cerr << " shared = " << shared_uimanager->get_accel_group() - << " first = " << uimanager->get_accel_group() - << " second = " << other_uimanager->get_accel_group () - << endl; + AccelMap::save ("mtest.bindings"); app.run (); diff --git a/gtk2_ardour/mtest.menus b/gtk2_ardour/mtest.menus index e24953651e..c6bc2afe9a 100644 --- a/gtk2_ardour/mtest.menus +++ b/gtk2_ardour/mtest.menus @@ -3,6 +3,7 @@ <menu action='TopMenu'> <menuitem action='Foo'/> <menuitem action='Bar'/> + <menuitem action='Baz'/> </menu> </menubar> </ui> diff --git a/gtk2_ardour/mtest_other.menus b/gtk2_ardour/mtest_other.menus index 96d1dcfee5..ff3416ae7e 100644 --- a/gtk2_ardour/mtest_other.menus +++ b/gtk2_ardour/mtest_other.menus @@ -2,7 +2,8 @@ <menubar name='OTop'> <menu action='OTopMenu'> <menuitem action='OFoo'/> - <menuitem action='OBar'/> + <menuitem action='Bar'/> + <menuitem action='Baz'/> </menu> </menubar> </ui> diff --git a/gtk2_ardour/public_editor.cc b/gtk2_ardour/public_editor.cc index b8b154d8bd..36d51d97a1 100644 --- a/gtk2_ardour/public_editor.cc +++ b/gtk2_ardour/public_editor.cc @@ -4,8 +4,7 @@ PublicEditor* PublicEditor::_instance = 0; PublicEditor::PublicEditor () - : Window (Gtk::WINDOW_TOPLEVEL), - KeyboardTarget (*this, "editor") + : Window (Gtk::WINDOW_TOPLEVEL) { } diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 7a7fa1925e..6ffbe098fa 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -44,8 +44,12 @@ class TempoMarker; class MeterMarker; class Marker; class AutomationTimeAxisView; +class MarkerTimeAxis; +class ImageFrameView; +class ImageFrameTimeAxis; +class MarkerView; -class PublicEditor : public Gtk::Window, public Stateful, public KeyboardTarget { +class PublicEditor : public Gtk::Window, public Stateful { public: PublicEditor(); virtual ~PublicEditor(); @@ -152,14 +156,14 @@ class PublicEditor : public Gtk::Window, public Stateful, public KeyboardTarget virtual bool canvas_range_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0; virtual bool canvas_transport_marker_bar_event (GdkEvent* event, ArdourCanvas::Item*) = 0; - virtual bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*) = 0; - virtual bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*) = 0; - virtual bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*) = 0; - virtual bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*) = 0; - virtual bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*) = 0; - virtual bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*) = 0; - virtual bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*) = 0; - virtual bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*) = 0; + virtual bool canvas_imageframe_item_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*) = 0; + virtual bool canvas_imageframe_view_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameTimeAxis*) = 0; + virtual bool canvas_imageframe_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*) = 0; + virtual bool canvas_imageframe_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,ImageFrameView*) = 0; + virtual bool canvas_marker_time_axis_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerTimeAxis*) = 0; + virtual bool canvas_markerview_item_view_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0; + virtual bool canvas_markerview_start_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0; + virtual bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0; static PublicEditor* _instance; }; |