diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index a2fc9bc712..25ca1c9302 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -313,6 +313,7 @@ Editor::Editor () last_update_frame = 0; pre_press_cursor = 0; _drags = new DragManager (this); + lock_dialog = 0; current_mixer_strip = 0; tempo_lines = 0; diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 6539ea0b26..2de680ae40 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1359,6 +1359,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD DragManager* _drags; void escape (); + void lock (); + void unlock (); + ArdourDialog *lock_dialog; Gtk::Menu fade_context_menu; void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index c4b5309333..c8d08722f6 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -7060,3 +7060,44 @@ Editor::toggle_midi_input_active (bool flip_others) _session->set_exclusive_input_active (rl, onoff, flip_others); } + + +void +Editor::lock () +{ + if (!lock_dialog) { + lock_dialog = new ArdourDialog (string_compose (_("%1: Locked"), PROGRAM_NAME), true); + + Gtk::Image* padlock = manage (new Gtk::Image (::get_icon ("padlock_closed"))); + lock_dialog->get_vbox()->pack_start (*padlock); + + ArdourButton* b = manage (new ArdourButton); + b->set_name ("lock button"); + b->set_markup (string_compose ("%1", _("Click to unlock"))); + b->signal_clicked.connect (sigc::mem_fun (*this, &Editor::unlock)); + lock_dialog->get_vbox()->pack_start (*b); + + lock_dialog->get_vbox()->show_all (); + lock_dialog->set_size_request (200, 200); + } + +#ifdef __APPLE__ + /* The global menu bar continues to be accessible to applications + with modal dialogs, which means that we need to desensitize + all items in the menu bar. Since those items are really just + proxies for actions, that means disabling all actions. + */ + ActionManager::disable_all_actions (); +#endif + lock_dialog->present (); +} + +void +Editor::unlock () +{ + lock_dialog->hide (); + +#ifdef __APPLE__ + ActionManager::pop_action_state (); +#endif +}