From c8ae7295e911c62cf9dedf90187656937cc18cbb Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 30 Jul 2016 13:10:13 -0400 Subject: Add undo support --- src/gui/GraphBox.cpp | 22 +++++++++++++++++++++- src/gui/GraphBox.hpp | 6 +++++- src/gui/GraphCanvas.cpp | 4 +++- src/gui/ingen_gui.ui | 26 ++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index 52ec9672..10f063cc 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2015 David Robillard + Copyright 2007-2016 David Robillard Ingen is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free @@ -77,6 +77,8 @@ GraphBox::GraphBox(BaseObjectType* cobject, xml->get_widget("graph_save_menuitem", _menu_save); xml->get_widget("graph_save_as_menuitem", _menu_save_as); xml->get_widget("graph_export_image_menuitem", _menu_export_image); + xml->get_widget("graph_redo_menuitem", _menu_redo); + xml->get_widget("graph_undo_menuitem", _menu_undo); xml->get_widget("graph_cut_menuitem", _menu_cut); xml->get_widget("graph_copy_menuitem", _menu_copy); xml->get_widget("graph_paste_menuitem", _menu_paste); @@ -119,6 +121,10 @@ GraphBox::GraphBox(BaseObjectType* cobject, sigc::mem_fun(this, &GraphBox::event_save_as)); _menu_export_image->signal_activate().connect( sigc::mem_fun(this, &GraphBox::event_export_image)); + _menu_redo->signal_activate().connect( + sigc::mem_fun(this, &GraphBox::event_redo)); + _menu_undo->signal_activate().connect( + sigc::mem_fun(this, &GraphBox::event_undo)); _menu_copy->signal_activate().connect( sigc::mem_fun(this, &GraphBox::event_copy)); _menu_paste->signal_activate().connect( @@ -670,6 +676,18 @@ GraphBox::event_copy() _view->canvas()->copy_selection(); } +void +GraphBox::event_redo() +{ + _app->interface()->redo(); +} + +void +GraphBox::event_undo() +{ + _app->interface()->undo(); +} + void GraphBox::event_paste() { @@ -748,7 +766,9 @@ GraphBox::event_normal_font_size() void GraphBox::event_arrange() { + _app->interface()->bundle_begin(); _view->canvas()->arrange(); + _app->interface()->bundle_end(); } void diff --git a/src/gui/GraphBox.hpp b/src/gui/GraphBox.hpp index ab3ee5ff..0a55227e 100644 --- a/src/gui/GraphBox.hpp +++ b/src/gui/GraphBox.hpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2015 David Robillard + Copyright 2007-2016 David Robillard Ingen is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free @@ -108,6 +108,8 @@ private: void event_save(); void event_save_as(); void event_export_image(); + void event_redo(); + void event_undo(); void event_copy(); void event_paste(); void event_delete(); @@ -148,6 +150,8 @@ private: Gtk::MenuItem* _menu_save; Gtk::MenuItem* _menu_save_as; Gtk::MenuItem* _menu_export_image; + Gtk::MenuItem* _menu_redo; + Gtk::MenuItem* _menu_undo; Gtk::MenuItem* _menu_cut; Gtk::MenuItem* _menu_copy; Gtk::MenuItem* _menu_paste; diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 7e237a1c..df950eb7 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2015 David Robillard + Copyright 2007-2016 David Robillard Ingen is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free @@ -586,8 +586,10 @@ destroy_arc(GanvEdge* arc, void* data) void GraphCanvas::destroy_selection() { + _app.interface()->bundle_begin(); for_each_selected_edge(destroy_arc, &_app); for_each_selected_node(destroy_node, &_app); + _app.interface()->bundle_end(); } static void diff --git a/src/gui/ingen_gui.ui b/src/gui/ingen_gui.ui index 69fed01a..646cd34d 100644 --- a/src/gui/ingen_gui.ui +++ b/src/gui/ingen_gui.ui @@ -863,6 +863,32 @@ See COPYING file included with this distribution, or http://www.gnu.org/licenses False + + + gtk-undo + False + True + True + False + True + True + + + + + + + gtk-redo + False + True + True + False + True + True + + + + True -- cgit v1.2.1