From 81309a17bd7381dcfcac5b81160d8ac5054b3120 Mon Sep 17 00:00:00 2001 From: dooglus Date: Mon, 18 Feb 2008 19:01:54 +0000 Subject: [PATCH] Added a new icon to the History panel to clear out all the undo and redo history at once. git-svn-id: http://svn.voria.com/code@1751 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-studio/trunk/src/gtkmm/dock_history.cpp | 30 ++++++++++++++++++++++---- synfig-studio/trunk/src/gtkmm/dock_history.h | 1 + 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/synfig-studio/trunk/src/gtkmm/dock_history.cpp b/synfig-studio/trunk/src/gtkmm/dock_history.cpp index 4887895..c8fc3da 100644 --- a/synfig-studio/trunk/src/gtkmm/dock_history.cpp +++ b/synfig-studio/trunk/src/gtkmm/dock_history.cpp @@ -95,6 +95,17 @@ Dock_History::Dock_History(): ) ); action_group->add(Gtk::Action::create( + "clear-undo-and-redo", + Gtk::Stock::CLEAR, + _("Clear Undo and Redo Stacks"), + _("Clear the undo and redo stacks") + ), + sigc::mem_fun( + *this, + &Dock_History::clear_undo_and_redo + ) + ); + action_group->add(Gtk::Action::create( "undo", Gtk::StockID("gtk-undo"), _("Undo"), @@ -121,6 +132,7 @@ Dock_History::Dock_History(): " " " " " " + " " " " "" ; @@ -260,17 +272,26 @@ Dock_History::create_action_tree() void Dock_History::clear_undo() { - if(selected_instance && App::dialog_yes_no(_("Clear History"), _("You will not be able to undo any changes that you have made!\nAre you sure you want to clear the undo stack?"))) - { + if(selected_instance && App::dialog_yes_no(_("Clear History"), + _("You will not be able to undo any changes that you have made!\nAre you sure you want to clear the undo stack?"))) selected_instance->clear_undo_stack(); - } } void Dock_History::clear_redo() { - if(selected_instance && App::dialog_yes_no(_("Clear History"), _("You will not be able to redo any changes that you have made!\nAre you sure you want to clear the redo stack?"))) + if(selected_instance && App::dialog_yes_no(_("Clear History"), + _("You will not be able to redo any changes that you have made!\nAre you sure you want to clear the redo stack?"))) + selected_instance->clear_redo_stack(); +} + +void +Dock_History::clear_undo_and_redo() +{ + if(selected_instance && App::dialog_yes_no(_("Clear History"), + _("You will not be able to undo or redo any changes that you have made!\nAre you sure you want to clear the undo and redo stacks?"))) { + selected_instance->clear_undo_stack(); selected_instance->clear_redo_stack(); } } @@ -285,6 +306,7 @@ Dock_History::update_undo_redo() action_group->get_action("clear-undo")->set_sensitive(instance->get_undo_status()); action_group->get_action("redo")->set_sensitive(instance->get_redo_status()); action_group->get_action("clear-redo")->set_sensitive(instance->get_redo_status()); + action_group->get_action("clear-undo-and-redo")->set_sensitive(instance->get_undo_status() || instance->get_redo_status()); } } diff --git a/synfig-studio/trunk/src/gtkmm/dock_history.h b/synfig-studio/trunk/src/gtkmm/dock_history.h index 6973aa1..00154b2 100644 --- a/synfig-studio/trunk/src/gtkmm/dock_history.h +++ b/synfig-studio/trunk/src/gtkmm/dock_history.h @@ -69,6 +69,7 @@ public: void clear_undo(); void clear_redo(); + void clear_undo_and_redo(); bool on_action_event(GdkEvent *event); void on_action_toggle(const Glib::ustring& path); -- 2.7.4