From 04c6f60d1f1fb94f6a9dca81439026db22ebb88e Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
Date: Sun, 11 Mar 2007 23:45:54 +0000
Subject: Auto-arranging in flowcanvas/machina.

git-svn-id: http://svn.drobilla.net/lad/machina@353 a436a847-0d15-0410-975c-d299462d15a1
---
 src/gui/MachinaCanvas.cpp |  1 +
 src/gui/MachinaGUI.cpp    |  4 +++-
 src/gui/MachinaGUI.hpp    |  1 +
 src/gui/Makefile.am       |  2 +-
 src/gui/machina.glade     | 19 +++++++++++++++++--
 5 files changed, 23 insertions(+), 4 deletions(-)

(limited to 'src')

diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp
index 878e790..2c22791 100644
--- a/src/gui/MachinaCanvas.cpp
+++ b/src/gui/MachinaCanvas.cpp
@@ -219,6 +219,7 @@ MachinaCanvas::build(SharedPtr<Machina::Machine> machine)
 		}
 	}
 
+	arrange();
 }
 
 
diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp
index 121e25a..1266147 100644
--- a/src/gui/MachinaGUI.cpp
+++ b/src/gui/MachinaGUI.cpp
@@ -131,8 +131,9 @@ MachinaGUI::MachinaGUI(SharedPtr<Machina::Engine> engine)
 	xml->get_widget("bpm_spinbutton", _bpm_spinbutton);
 	xml->get_widget("quantize_checkbutton", _quantize_checkbutton);
 	xml->get_widget("quantize_spinbutton", _quantize_spinbutton);
-	xml->get_widget("zoom_full_but", _zoom_full_button);
 	xml->get_widget("zoom_normal_but", _zoom_normal_button);
+	xml->get_widget("zoom_full_but", _zoom_full_button);
+	xml->get_widget("arrange_but", _arrange_button);
 	
 	_canvas_scrolledwindow->add(*_canvas);
 	//m_canvas_scrolledwindow->signal_event().connect(sigc::mem_fun(_canvas, &FlowCanvas::scroll_event_handler));
@@ -145,6 +146,7 @@ MachinaGUI::MachinaGUI(SharedPtr<Machina::Engine> engine)
 		sigc::mem_fun(this, &MachinaGUI::zoom), 1.0));
 	
 	_zoom_full_button->signal_clicked().connect(sigc::mem_fun(_canvas.get(), &MachinaCanvas::zoom_full));
+	_arrange_button->signal_clicked().connect(sigc::mem_fun(_canvas.get(), &MachinaCanvas::arrange));
 
 	_menu_file_open->signal_activate().connect(
 		sigc::mem_fun(this, &MachinaGUI::menu_file_open));
diff --git a/src/gui/MachinaGUI.hpp b/src/gui/MachinaGUI.hpp
index 0e507fc..7774ff6 100644
--- a/src/gui/MachinaGUI.hpp
+++ b/src/gui/MachinaGUI.hpp
@@ -118,6 +118,7 @@ protected:
 	Gtk::SpinButton*     _quantize_spinbutton;
 	Gtk::ToolButton*     _zoom_normal_button;
 	Gtk::ToolButton*     _zoom_full_button;
+	Gtk::ToolButton*     _arrange_button;
 };
 
 #endif // MACHINA_GUI_H
diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am
index 570cc8a..5c6cf47 100644
--- a/src/gui/Makefile.am
+++ b/src/gui/Makefile.am
@@ -1,5 +1,5 @@
 AM_CXXFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" @LIBGLADEMM_CFLAGS@ @GNOMECANVASMM_CFLAGS@ @JACK_CFLAGS@ @FLOWCANVAS_CFLAGS@ @RAUL_CFLAGS@  -I$(top_srcdir)/src/engine
-machina_gui_LDADD = @LIBGLADEMM_LIBS@ @GNOMECANVASMM_LIBS@ @JACK_LIBS@ @FLOWCANVAS_LIBS@ @RAUL_CFLAGS@ ../engine/libmachina.la
+machina_gui_LDADD = @FLOWCANVAS_LIBS@ @LIBGLADEMM_LIBS@ @GNOMECANVASMM_LIBS@ @JACK_LIBS@ @RAUL_CFLAGS@ ../engine/libmachina.la
 
 EXTRA_DIST = machina.gladep
 
diff --git a/src/gui/machina.glade b/src/gui/machina.glade
index c0d1b87..216dfeb 100644
--- a/src/gui/machina.glade
+++ b/src/gui/machina.glade
@@ -85,7 +85,7 @@
 		      <accelerator key="I" modifiers="GDK_CONTROL_MASK" signal="activate"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image8">
+			<widget class="GtkImage" id="image9">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-media-record</property>
 			  <property name="icon_size">1</property>
@@ -107,7 +107,7 @@
 		      <accelerator key="E" modifiers="GDK_CONTROL_MASK" signal="activate"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image9">
+			<widget class="GtkImage" id="image10">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-convert</property>
 			  <property name="icon_size">1</property>
@@ -405,6 +405,21 @@
 	      <property name="homogeneous">True</property>
 	    </packing>
 	  </child>
+
+	  <child>
+	    <widget class="GtkToolButton" id="arrange_but">
+	      <property name="visible">True</property>
+	      <property name="tooltip" translatable="yes">Automatically arrange nodes</property>
+	      <property name="stock_id">gtk-refresh</property>
+	      <property name="visible_horizontal">True</property>
+	      <property name="visible_vertical">True</property>
+	      <property name="is_important">False</property>
+	    </widget>
+	    <packing>
+	      <property name="expand">False</property>
+	      <property name="homogeneous">True</property>
+	    </packing>
+	  </child>
 	</widget>
 	<packing>
 	  <property name="padding">0</property>
-- 
cgit v1.2.1