summaryrefslogtreecommitdiffstats
path: root/src/progs/ingenuity/PatchTreeWindow.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-09-11 11:10:35 +0000
committerDavid Robillard <d@drobilla.net>2006-09-11 11:10:35 +0000
commitb15864870d34a1188eda93ad215734275037278e (patch)
tree224a1669a29091ea4198425d4a002e448cde8b30 /src/progs/ingenuity/PatchTreeWindow.cpp
parent22bf43352ddfc48452d776f10ad4d12161255049 (diff)
downloadingen-b15864870d34a1188eda93ad215734275037278e.tar.gz
ingen-b15864870d34a1188eda93ad215734275037278e.tar.bz2
ingen-b15864870d34a1188eda93ad215734275037278e.zip
Switched homebrew CountedPtr to boost::shared_ptr.
Factories for patch windows, controller. Robustness updated in many places. Tons of cleanups, rewrites, bugfixes, etc. git-svn-id: http://svn.drobilla.net/lad/ingen@128 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs/ingenuity/PatchTreeWindow.cpp')
-rw-r--r--src/progs/ingenuity/PatchTreeWindow.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/progs/ingenuity/PatchTreeWindow.cpp b/src/progs/ingenuity/PatchTreeWindow.cpp
index 0f8c947a..090aba18 100644
--- a/src/progs/ingenuity/PatchTreeWindow.cpp
+++ b/src/progs/ingenuity/PatchTreeWindow.cpp
@@ -23,6 +23,7 @@
#include "Store.h"
#include "SubpatchModule.h"
#include "PatchModel.h"
+#include "WindowFactory.h"
#include "util/Path.h"
namespace Ingenuity {
@@ -74,14 +75,14 @@ PatchTreeWindow::init(Store& store)
void
PatchTreeWindow::new_object(CountedPtr<ObjectModel> object)
{
- CountedPtr<PatchModel> patch = object;
- if (patch && dynamic_cast<PatchController*>(patch->controller()))
- add_patch(dynamic_cast<PatchController*>(patch->controller()));
+ CountedPtr<PatchModel> patch = PtrCast<PatchModel>(object);
+ if (patch)
+ add_patch(PtrCast<PatchController>(patch->controller()));
}
void
-PatchTreeWindow::add_patch(PatchController* pc)
+PatchTreeWindow::add_patch(CountedPtr<PatchController> pc)
{
const CountedPtr<PatchModel> pm = pc->patch_model();
@@ -89,7 +90,7 @@ PatchTreeWindow::add_patch(PatchController* pc)
Gtk::TreeModel::iterator iter = m_patch_treestore->append();
Gtk::TreeModel::Row row = *iter;
if (pm->path() == "/") {
- CountedPtr<OSCEngineSender> osc_sender = App::instance().engine();
+ CountedPtr<OSCEngineSender> osc_sender = PtrCast<OSCEngineSender>(App::instance().engine());
string root_name = osc_sender ? osc_sender->engine_url() : "Internal";
// Hack off trailing '/' if it's there (ugly)
//if (root_name.substr(root_name.length()-1,1) == "/")
@@ -130,10 +131,8 @@ PatchTreeWindow::remove_patch(const Path& path)
Gtk::TreeModel::iterator
PatchTreeWindow::find_patch(Gtk::TreeModel::Children root, const Path& path)
{
- PatchController* pc = NULL;
-
for (Gtk::TreeModel::iterator c = root.begin(); c != root.end(); ++c) {
- pc = (*c)[m_patch_tree_columns.patch_controller_col];
+ CountedPtr<PatchController> pc = (*c)[m_patch_tree_columns.patch_controller_col];
if (pc->model()->path() == path) {
return c;
} else if ((*c)->children().size() > 0) {
@@ -152,7 +151,7 @@ PatchTreeWindow::event_patch_selected()
Gtk::TreeModel::iterator active = m_patch_tree_selection->get_selected();
if (active) {
Gtk::TreeModel::Row row = *active;
- PatchController* pc = row[m_patch_tree_columns.patch_controller_col];
+ CountedPtr<PatchController> pc = row[m_patch_tree_columns.patch_controller_col];
}
}
*/
@@ -166,8 +165,8 @@ PatchTreeWindow::show_patch_menu(GdkEventButton* ev)
Gtk::TreeModel::iterator active = m_patch_tree_selection->get_selected();
if (active) {
Gtk::TreeModel::Row row = *active;
- PatchController* pc = row[m_patch_tree_columns.patch_controller_col];
- if (pc != NULL)
+ CountedPtr<PatchController> pc = row[m_patch_tree_columns.patch_controller_col];
+ if (pc)
pc->show_menu(ev);
}
}
@@ -178,9 +177,9 @@ PatchTreeWindow::event_patch_activated(const Gtk::TreeModel::Path& path, Gtk::Tr
{
Gtk::TreeModel::iterator active = m_patch_treestore->get_iter(path);
Gtk::TreeModel::Row row = *active;
- PatchController* pc = row[m_patch_tree_columns.patch_controller_col];
+ CountedPtr<PatchController> pc = row[m_patch_tree_columns.patch_controller_col];
- pc->show_patch_window();
+ App::instance().window_factory()->present(pc);
}
@@ -191,10 +190,10 @@ PatchTreeWindow::event_patch_enabled_toggled(const Glib::ustring& path_str)
Gtk::TreeModel::iterator active = m_patch_treestore->get_iter(path);
Gtk::TreeModel::Row row = *active;
- PatchController* pc = row[m_patch_tree_columns.patch_controller_col];
+ CountedPtr<PatchController> pc = row[m_patch_tree_columns.patch_controller_col];
Glib::ustring patch_path = pc->model()->path();
- assert(pc != NULL);
+ assert(pc);
if ( ! pc->patch_model()->enabled()) {
if (m_enable_signal)