summaryrefslogtreecommitdiffstats
path: root/src/progs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-06-12 04:48:20 +0000
committerDavid Robillard <d@drobilla.net>2006-06-12 04:48:20 +0000
commitefee2b08f575e2c216cffa6f08a928223ab2cedb (patch)
tree089fdf9bc89aa04793b03cbfccb438a7a9c9f387 /src/progs
parent5818a04533e472820f6c6748b2f07d7d1ca5789a (diff)
downloadingen-efee2b08f575e2c216cffa6f08a928223ab2cedb.tar.gz
ingen-efee2b08f575e2c216cffa6f08a928223ab2cedb.tar.bz2
ingen-efee2b08f575e2c216cffa6f08a928223ab2cedb.zip
Store memory bug fixes (multiple ref ptr's to the same object, bad),
control panel fixes git-svn-id: http://svn.drobilla.net/lad/grauph@32 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs')
-rw-r--r--src/progs/gtk/ControlInterface.cpp2
-rw-r--r--src/progs/gtk/ControlPanel.cpp13
-rw-r--r--src/progs/gtk/Controller.cpp2
-rw-r--r--src/progs/gtk/Makefile.am2
-rw-r--r--src/progs/gtk/NewSubpatchWindow.cpp3
-rw-r--r--src/progs/gtk/NodeController.cpp15
-rw-r--r--src/progs/gtk/PatchController.cpp9
-rw-r--r--src/progs/gtk/PatchTreeWindow.cpp2
-rw-r--r--src/progs/gtk/PortController.cpp4
-rw-r--r--src/progs/gtk/SubpatchModule.cpp2
10 files changed, 30 insertions, 24 deletions
diff --git a/src/progs/gtk/ControlInterface.cpp b/src/progs/gtk/ControlInterface.cpp
index eb5eee1b..2b22eee1 100644
--- a/src/progs/gtk/ControlInterface.cpp
+++ b/src/progs/gtk/ControlInterface.cpp
@@ -73,7 +73,7 @@ ControlInterface::new_patch_model(PatchModel* const pm)
pm->plugin(plugin);
}*/
- assert(pm->parent() == NULL);
+ assert(!pm->parent());
PatchController* patch = new PatchController(pm);
//Store::instance().add_object(patch);
//_app->patch_tree()->add_patch(patch);
diff --git a/src/progs/gtk/ControlPanel.cpp b/src/progs/gtk/ControlPanel.cpp
index 73520596..9f3279ee 100644
--- a/src/progs/gtk/ControlPanel.cpp
+++ b/src/progs/gtk/ControlPanel.cpp
@@ -56,7 +56,7 @@ ControlPanel::init(NodeController* node, size_t poly)
assert(node != NULL);
assert(poly > 0);
- const CountedPtr<NodeModel> node_model = node->node_model();
+ const CountedPtr<NodeModel> node_model(node->node_model());
if (poly > 1) {
m_voice_spinbutton->set_range(0, poly - 1);
@@ -66,9 +66,14 @@ ControlPanel::init(NodeController* node, size_t poly)
for (PortModelList::const_iterator i = node_model->ports().begin();
i != node_model->ports().end(); ++i) {
- PortController* pc = (PortController*)(*i)->controller();
- assert(pc != NULL);
- add_port(pc);
+ // FIXME:
+ if (*i) {
+ PortController* pc = (PortController*)((*i)->controller());
+ assert(pc != NULL);
+ add_port(pc);
+ } else {
+ cerr << "WTF?\n";
+ }
}
m_callback_enabled = true;
diff --git a/src/progs/gtk/Controller.cpp b/src/progs/gtk/Controller.cpp
index 05ebe84a..9a85914b 100644
--- a/src/progs/gtk/Controller.cpp
+++ b/src/progs/gtk/Controller.cpp
@@ -91,7 +91,7 @@ Controller::create_patch_from_model(const PatchModel* pm)
//int id = get_next_request_id();
//set_wait_response_id(id);
create_patch_from_model(pm);
- if (pm->parent() != NULL) {
+ if (pm->parent()) {
// wait_for_response();
char temp_buf[16];
snprintf(temp_buf, 16, "%f", pm->x());
diff --git a/src/progs/gtk/Makefile.am b/src/progs/gtk/Makefile.am
index 71b5c477..c9320bcc 100644
--- a/src/progs/gtk/Makefile.am
+++ b/src/progs/gtk/Makefile.am
@@ -6,7 +6,7 @@ MAINTAINERCLEANFILES = Makefile.in
sharefilesdir = $(pkgdatadir)
dist_sharefiles_DATA = om_gtk.glade om-icon.png
-AM_CXXFLAGS = -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -I$(top_srcdir)/src/common -I$(top_srcdir)/src/libs/client -DPKGDATADIR=\"$(pkgdatadir)\" @GTKMM_CFLAGS@ @LIBGLADEMM_CFLAGS@ @GNOMECANVASMM_CFLAGS@ @LOSC_CFLAGS@ @LASH_CFLAGS@ @FLOWCANVAS_CFLAGS@
+AM_CXXFLAGS = -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -I$(top_srcdir)/src/common -I$(top_srcdir)/src/libs/client -DPKGDATADIR=\"$(pkgdatadir)\" @GTKMM_CFLAGS@ @LIBGLADEMM_CFLAGS@ @GNOMECANVASMM_CFLAGS@ @LOSC_CFLAGS@ @LASH_CFLAGS@ @FLOWCANVAS_CFLAGS@ -DWITH_RTTI
om_gtk_LDADD = @GTKMM_LIBS@ @LIBGLADEMM_LIBS@ @GNOMECANVASMM_LIBS@ @LOSC_LIBS@ @LASH_LIBS@ @FLOWCANVAS_LIBS@ ../../libs/client/libomclient.la
om_gtk_DEPENDENCIES = ../../libs/client/libomclient.la
diff --git a/src/progs/gtk/NewSubpatchWindow.cpp b/src/progs/gtk/NewSubpatchWindow.cpp
index 742f6d63..dc4e47b4 100644
--- a/src/progs/gtk/NewSubpatchWindow.cpp
+++ b/src/progs/gtk/NewSubpatchWindow.cpp
@@ -79,8 +79,6 @@ NewSubpatchWindow::name_changed()
void
NewSubpatchWindow::ok_clicked()
{
- cerr << "FIXME new subpatch\n";
- /*
PatchModel* pm = new PatchModel(
m_patch_controller->model()->base_path() + m_name_entry->get_text(),
m_poly_spinbutton->get_value_as_int());
@@ -100,7 +98,6 @@ NewSubpatchWindow::ok_clicked()
pm->set_metadata("module-y", temp_buf);
Controller::instance().create_patch_from_model(pm);
hide();
- */
}
diff --git a/src/progs/gtk/NodeController.cpp b/src/progs/gtk/NodeController.cpp
index cc43015d..6cc0b94e 100644
--- a/src/progs/gtk/NodeController.cpp
+++ b/src/progs/gtk/NodeController.cpp
@@ -53,7 +53,8 @@ NodeController::NodeController(CountedPtr<NodeModel> model)
for (PortModelList::const_iterator i = node_model()->ports().begin();
i != node_model()->ports().end(); ++i) {
assert(!(*i)->controller());
- assert((*i)->parent() == model.get());
+ assert((*i)->parent());
+ assert((*i)->parent().get() == node_model().get());
// FIXME: leak
PortController* const pc = new PortController(*i);
assert((*i)->controller() == pc); // PortController() does this
@@ -193,7 +194,8 @@ NodeController::metadata_update(const string& key, const string& value)
void
NodeController::add_port(CountedPtr<PortModel> pm)
{
- assert(pm->parent() == node_model().get());
+ assert(pm->parent().get() == node_model().get());
+ assert(pm->parent() == node_model());
assert(node_model()->get_port(pm->name()) == pm);
cout << "[NodeController] Adding port " << pm->path() << endl;
@@ -225,9 +227,9 @@ NodeController::show_control_window()
{
size_t poly = 1;
if (node_model()->polyphonic())
- poly = node_model()->parent_patch()->poly();
+ poly = ((PatchModel*)node_model()->parent().get())->poly();
- if (m_control_window == NULL)
+ if (!m_control_window)
m_control_window = new NodeControlWindow(this, poly);
if (m_control_window->control_panel()->num_controls() > 0)
@@ -245,7 +247,7 @@ NodeController::on_menu_destroy()
void
NodeController::show_rename_window()
{
- assert(node_model()->parent() != NULL);
+ assert(node_model()->parent());
// FIXME: will this be magically cleaned up?
RenameWindow* win = NULL;
@@ -265,6 +267,8 @@ NodeController::show_rename_window()
void
NodeController::on_menu_clone()
{
+ cerr << "FIXME: clone broken\n";
+ /*
assert(node_model());
//assert(m_parent != NULL);
//assert(m_parent->model() != NULL);
@@ -295,6 +299,7 @@ NodeController::on_menu_clone()
nm->x(node_model()->x() + 20);
nm->y(node_model()->y() + 20);
Controller::instance().create_node_from_model(nm);
+ */
}
diff --git a/src/progs/gtk/PatchController.cpp b/src/progs/gtk/PatchController.cpp
index ada6b003..4f639340 100644
--- a/src/progs/gtk/PatchController.cpp
+++ b/src/progs/gtk/PatchController.cpp
@@ -60,7 +60,6 @@ PatchController::PatchController(CountedPtr<PatchModel> model)
m_module_y(0)
{
assert(model->path().length() > 0);
- assert(model->parent() == NULL);
assert(model->controller() == this); // NodeController() does this
/* FIXME if (model->path() != "/") {
@@ -168,13 +167,13 @@ PatchController::destroy()
//Store::instance().remove_object(this);
// Delete self from parent (this will delete model)
- if (patch_model()->parent() != NULL) {
+ /*if (patch_model()->parent() != NULL) {
PatchController* const parent = (PatchController*)patch_model()->parent()->controller();
assert(parent != NULL);
parent->remove_node(name());
} else {
//delete m_model;
- }
+ }*/
}
@@ -419,7 +418,7 @@ PatchController::add_node(CountedPtr<NodeModel> nm)
cerr << "ADD NODE\n";
assert(nm);
- assert(nm->parent() == m_patch_model.get());
+ assert(nm->parent() == m_patch_model);
assert(nm->path().parent() == m_patch_model->path());
/*if (patch_model()->get_node(nm->name()) != NULL) {
@@ -506,7 +505,7 @@ void
PatchController::add_port(CountedPtr<PortModel> pm)
{
assert(pm);
- assert(pm->parent() == NULL);
+ assert(!pm->parent());
//cerr << "[PatchController] Adding port " << pm->path() << endl;
diff --git a/src/progs/gtk/PatchTreeWindow.cpp b/src/progs/gtk/PatchTreeWindow.cpp
index 78ee9428..390187b8 100644
--- a/src/progs/gtk/PatchTreeWindow.cpp
+++ b/src/progs/gtk/PatchTreeWindow.cpp
@@ -68,7 +68,7 @@ PatchTreeWindow::add_patch(PatchController* pc)
{
const CountedPtr<PatchModel> pm = pc->patch_model();
- if (pm->parent() == NULL) {
+ if (!pm->parent()) {
Gtk::TreeModel::iterator iter = m_patch_treestore->append();
Gtk::TreeModel::Row row = *iter;
if (pm->path() == "/") {
diff --git a/src/progs/gtk/PortController.cpp b/src/progs/gtk/PortController.cpp
index eaad6efe..fcb93b30 100644
--- a/src/progs/gtk/PortController.cpp
+++ b/src/progs/gtk/PortController.cpp
@@ -30,7 +30,7 @@ PortController::PortController(CountedPtr<PortModel> model)
m_control_panel(NULL)
{
assert(model);
- assert(model->parent() != NULL);
+ assert(model->parent());
assert(model->controller() == NULL);
model->set_controller(this);
@@ -54,7 +54,7 @@ PortController::remove_from_store()
void
PortController::destroy()
{
- assert(m_model->parent() != NULL);
+ assert(m_model->parent());
NodeController* parent = (NodeController*)m_model->parent()->controller();
assert(parent != NULL);
diff --git a/src/progs/gtk/SubpatchModule.cpp b/src/progs/gtk/SubpatchModule.cpp
index 9c0e78e4..8c79aed5 100644
--- a/src/progs/gtk/SubpatchModule.cpp
+++ b/src/progs/gtk/SubpatchModule.cpp
@@ -75,7 +75,7 @@ SubpatchModule::on_double_click(GdkEventButton* event)
void
SubpatchModule::browse_to_patch()
{
- assert(m_patch->model()->parent() != NULL);
+ assert(m_patch->model()->parent());
PatchController* pc = (PatchController*)m_patch->model()->parent()->controller();
assert(pc != NULL);
assert(pc->window() != NULL);