add Editor::lock() and Editor::unlock() and the to-be-replaced Lock dialog from Ardour

This commit is contained in:
Paul Davis 2014-06-25 08:00:11 -04:00
parent d6a11fec84
commit c7e7940364
3 changed files with 45 additions and 0 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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 ("<span size=\"large\" weight=\"bold\">%1</span>", _("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
}