Make editor undo/redo actions sensitive at appropriate times.
authornick_m <mainsbridge@gmail.com>
Mon, 22 Dec 2014 17:52:29 +0000 (04:52 +1100)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 2 Jan 2015 13:01:12 +0000 (08:01 -0500)
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_actions.cc
gtk2_ardour/editor_ops.cc

index 3598642dfd0651424bc89e2531c8867f9888c3ac..2bbfef0d103e2dacfd478f9609561f40ed149768 100644 (file)
@@ -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;
index 4740fbf2c5bb54de154b91c816bd25f90801dc91..b5c4fa404cc59a920e6564f04873df90fff4d942 100644 (file)
@@ -2075,6 +2075,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 
        Glib::RefPtr<Gtk::Action>              undo_action;
        Glib::RefPtr<Gtk::Action>              redo_action;
+       Glib::RefPtr<Gtk::Action>              alternate_redo_action;
+       Glib::RefPtr<Gtk::Action>              alternate_alternate_redo_action;
        Glib::RefPtr<Gtk::Action>              selection_undo_action;
        Glib::RefPtr<Gtk::Action>              selection_redo_action;
 
index c7bda7c25e6e108cccdc168c3ff7931572b06379..214eebac6ed740f22c19bc0adffcd756f21ff0d3 100644 (file)
@@ -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));
index a99da327db93b90b050bff2a9649283e437d1d5c..7c8d3efb73cca1282e20fca1b51547d1a1a96615 100644 (file)
@@ -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 ();
        }
 }