From 939df9ccddc7b2396b2164fb385e258cbda5b51b Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
Date: Sun, 17 Sep 2006 01:07:57 +0000
Subject: Patch tree window fixes.

git-svn-id: http://svn.drobilla.net/lad/ingen@140 a436a847-0d15-0410-975c-d299462d15a1
---
 src/progs/ingenuity/App.cpp               |  2 ++
 src/progs/ingenuity/NewSubpatchWindow.cpp |  1 +
 src/progs/ingenuity/PatchTreeWindow.cpp   | 12 ++++++------
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/progs/ingenuity/App.cpp b/src/progs/ingenuity/App.cpp
index 78d2e971..a4b820d1 100644
--- a/src/progs/ingenuity/App.cpp
+++ b/src/progs/ingenuity/App.cpp
@@ -101,6 +101,8 @@ App::attach(const CountedPtr<ModelEngineInterface>& engine, const CountedPtr<Sig
 	_client = client;
 	_store = new Store(client);
 	_loader = new Loader(engine);
+
+	_patch_tree_window->init(*_store);
 }
 
 
diff --git a/src/progs/ingenuity/NewSubpatchWindow.cpp b/src/progs/ingenuity/NewSubpatchWindow.cpp
index 44da3a4e..a74dc2b0 100644
--- a/src/progs/ingenuity/NewSubpatchWindow.cpp
+++ b/src/progs/ingenuity/NewSubpatchWindow.cpp
@@ -89,6 +89,7 @@ NewSubpatchWindow::ok_clicked()
 	const size_t poly = m_poly_spinbutton->get_value_as_int();
 
 	App::instance().engine()->create_patch_with_data(path, poly, m_initial_data);
+	App::instance().engine()->enable_patch(path);
 	
 	hide();
 }			
diff --git a/src/progs/ingenuity/PatchTreeWindow.cpp b/src/progs/ingenuity/PatchTreeWindow.cpp
index 40ce5baf..00aa324f 100644
--- a/src/progs/ingenuity/PatchTreeWindow.cpp
+++ b/src/progs/ingenuity/PatchTreeWindow.cpp
@@ -113,6 +113,9 @@ PatchTreeWindow::add_patch(CountedPtr<PatchModel> pm)
 			m_patches_treeview->expand_row(m_patch_treestore->get_path(iter), true);
 		}
 	}
+
+	pm->enabled_sig.connect(sigc::bind(sigc::mem_fun(this, &PatchTreeWindow::patch_enabled), pm->path()));
+	pm->disabled_sig.connect(sigc::bind(sigc::mem_fun(this, &PatchTreeWindow::patch_disabled), pm->path()));
 }
 
 
@@ -177,8 +180,7 @@ PatchTreeWindow::event_patch_activated(const Gtk::TreeModel::Path& path, Gtk::Tr
 	Gtk::TreeModel::Row row = *active;
 	CountedPtr<PatchModel> pm = row[m_patch_tree_columns.patch_model_col];
 	
-	cerr << "FIXME: tree win show\n";
-	//App::instance().window_factory()->present(pc);
+	App::instance().window_factory()->present_patch(pm);
 }
 
 
@@ -197,13 +199,11 @@ PatchTreeWindow::event_patch_enabled_toggled(const Glib::ustring& path_str)
 	if ( ! pm->enabled()) {
 		if (m_enable_signal)
 			App::instance().engine()->enable_patch(patch_path);
-		//pc->enable();
-		row[m_patch_tree_columns.enabled_col] = true;
+		//row[m_patch_tree_columns.enabled_col] = true;
 	} else {
 		if (m_enable_signal)
 			App::instance().engine()->disable_patch(patch_path);
-		//pc->disable();
-		row[m_patch_tree_columns.enabled_col] = false;
+		//row[m_patch_tree_columns.enabled_col] = false;
 	}
 }
 
-- 
cgit v1.2.1