From 61315c314d714dc1fa04c142b5032473e4844896 Mon Sep 17 00:00:00 2001 From: nick_m Date: Tue, 23 Dec 2014 04:52:29 +1100 Subject: [PATCH] Make editor undo/redo actions sensitive at appropriate times. --- gtk2_ardour/editor.cc | 4 ++++ gtk2_ardour/editor.h | 2 ++ gtk2_ardour/editor_actions.cc | 4 ++-- gtk2_ardour/editor_ops.cc | 5 ++++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 3598642dfd..2bbfef0d10 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -5018,6 +5018,10 @@ Editor::first_idle () delete dialog; + if (_session->undo_depth() == 0) { + undo_action->set_sensitive(false); + } + redo_action->set_sensitive(false); begin_selection_op_history (); _have_idled = true; diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 4740fbf2c5..b5c4fa404c 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -2075,6 +2075,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD Glib::RefPtr undo_action; Glib::RefPtr redo_action; + Glib::RefPtr alternate_redo_action; + Glib::RefPtr alternate_alternate_redo_action; Glib::RefPtr selection_undo_action; Glib::RefPtr selection_redo_action; diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index c7bda7c25e..214eebac6e 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -314,8 +314,8 @@ Editor::register_actions () undo_action = reg_sens (editor_actions, "undo", S_("Command|Undo"), sigc::bind (sigc::mem_fun(*this, &Editor::undo), 1U)); redo_action = reg_sens (editor_actions, "redo", _("Redo"), sigc::bind (sigc::mem_fun(*this, &Editor::redo), 1U)); - redo_action = reg_sens (editor_actions, "alternate-redo", _("Redo"), sigc::bind (sigc::mem_fun(*this, &Editor::redo), 1U)); - redo_action = reg_sens (editor_actions, "alternate-alternate-redo", _("Redo"), sigc::bind (sigc::mem_fun(*this, &Editor::redo), 1U)); + alternate_redo_action = reg_sens (editor_actions, "alternate-redo", _("Redo"), sigc::bind (sigc::mem_fun(*this, &Editor::redo), 1U)); + alternate_alternate_redo_action = reg_sens (editor_actions, "alternate-alternate-redo", _("Redo"), sigc::bind (sigc::mem_fun(*this, &Editor::redo), 1U)); selection_undo_action = reg_sens (editor_actions, "undo-last-selection-op", _("Undo Last Selection Op"), sigc::mem_fun(*this, &Editor::undo_reversible_selection_op)); selection_redo_action = reg_sens (editor_actions, "redo-last-selection-op", _("Redo Last Selection Op"), sigc::mem_fun(*this, &Editor::redo_reversible_selection_op)); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index a99da327db..7c8d3efb73 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -122,6 +122,9 @@ Editor::undo (uint32_t n) if (_session) { _session->undo (n); + if (_session->undo_depth() == 0) { + undo_action->set_sensitive(false); + } redo_action->set_sensitive(true); begin_selection_op_history (); } @@ -136,10 +139,10 @@ Editor::redo (uint32_t n) if (_session) { _session->redo (n); - cerr << "redo depth is : " << _session->redo_depth() << endl; if (_session->redo_depth() == 0) { redo_action->set_sensitive(false); } + undo_action->set_sensitive(true); begin_selection_op_history (); } }