summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-07-30 13:10:13 -0400
committerDavid Robillard <d@drobilla.net>2016-07-30 15:32:49 -0400
commitc8ae7295e911c62cf9dedf90187656937cc18cbb (patch)
tree0ba1207bf2c63278e9932eed2d04f961144a02db /src/gui
parente74c6a3b388ded66fcc4cfb1fa5bece881b63113 (diff)
downloadingen-c8ae7295e911c62cf9dedf90187656937cc18cbb.tar.gz
ingen-c8ae7295e911c62cf9dedf90187656937cc18cbb.tar.bz2
ingen-c8ae7295e911c62cf9dedf90187656937cc18cbb.zip
Add undo support
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/GraphBox.cpp22
-rw-r--r--src/gui/GraphBox.hpp6
-rw-r--r--src/gui/GraphCanvas.cpp4
-rw-r--r--src/gui/ingen_gui.ui26
4 files changed, 55 insertions, 3 deletions
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 <http://drobilla.net/>
+ Copyright 2007-2016 David Robillard <http://drobilla.net/>
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(
@@ -671,6 +677,18 @@ GraphBox::event_copy()
}
void
+GraphBox::event_redo()
+{
+ _app->interface()->redo();
+}
+
+void
+GraphBox::event_undo()
+{
+ _app->interface()->undo();
+}
+
+void
GraphBox::event_paste()
{
if (_view)
@@ -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 <http://drobilla.net/>
+ Copyright 2007-2016 David Robillard <http://drobilla.net/>
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 <http://drobilla.net/>
+ Copyright 2007-2016 David Robillard <http://drobilla.net/>
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
@@ -864,6 +864,32 @@ See COPYING file included with this distribution, or http://www.gnu.org/licenses
<object class="GtkMenu" id="edit2_menu">
<property name="can_focus">False</property>
<child>
+ <object class="GtkImageMenuItem" id="graph_undo_menuitem">
+ <property name="label">gtk-undo</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="sensitive">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ <accelerator key="Z" signal="activate" modifiers="GDK_CONTROL_MASK"/>
+ <signal name="activate" handler="on_graph_undo_menuitem_activate" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImageMenuItem" id="graph_redo_menuitem">
+ <property name="label">gtk-redo</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="sensitive">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ <accelerator key="Z" signal="activate" modifiers="GDK_CONTROL_MASK|GDK_SHIFT_MASK"/>
+ <signal name="activate" handler="on_graph_redo_menuitem_activate" swapped="no"/>
+ </object>
+ </child>
+ <child>
<object class="GtkSeparatorMenuItem" id="menuitem5">
<property name="visible">True</property>
<property name="can_focus">False</property>