summaryrefslogtreecommitdiffstats
path: root/src/libs/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/gui')
-rw-r--r--src/libs/gui/NewSubpatchWindow.cpp2
-rw-r--r--src/libs/gui/PatchCanvas.cpp3
-rw-r--r--src/libs/gui/PatchTreeWindow.cpp61
-rw-r--r--src/libs/gui/PatchTreeWindow.hpp3
-rw-r--r--src/libs/gui/PatchView.cpp31
-rw-r--r--src/libs/gui/PatchView.hpp3
-rw-r--r--src/libs/gui/ThreadedLoader.cpp3
7 files changed, 33 insertions, 73 deletions
diff --git a/src/libs/gui/NewSubpatchWindow.cpp b/src/libs/gui/NewSubpatchWindow.cpp
index 90e6c911..580ebb51 100644
--- a/src/libs/gui/NewSubpatchWindow.cpp
+++ b/src/libs/gui/NewSubpatchWindow.cpp
@@ -96,7 +96,7 @@ NewSubpatchWindow::ok_clicked()
for (GraphObject::Variables::const_iterator i = _initial_data.begin(); i != _initial_data.end(); ++i)
App::instance().engine()->set_variable(path, i->first, i->second);
- App::instance().engine()->enable_patch(path);
+ App::instance().engine()->set_property(_patch->path(), "ingen:enabled", (bool)true);
hide();
}
diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp
index 77078831..77aa64e6 100644
--- a/src/libs/gui/PatchCanvas.cpp
+++ b/src/libs/gui/PatchCanvas.cpp
@@ -606,7 +606,8 @@ PatchCanvas::menu_add_port(const string& name, const string& type, bool is_outpu
{
// FIXME: bundleify
const Path& path = _patch->path().base() + generate_port_name(name);
- App::instance().engine()->new_port(path, type, is_output);
+ // FIXME: index
+ App::instance().engine()->new_port(path, 0, type, is_output);
GraphObject::Variables data = get_initial_data();
for (GraphObject::Variables::const_iterator i = data.begin(); i != data.end(); ++i)
App::instance().engine()->set_variable(path, i->first, i->second);
diff --git a/src/libs/gui/PatchTreeWindow.cpp b/src/libs/gui/PatchTreeWindow.cpp
index 336d3aaf..ee831cb3 100644
--- a/src/libs/gui/PatchTreeWindow.cpp
+++ b/src/libs/gui/PatchTreeWindow.cpp
@@ -29,10 +29,10 @@ namespace Ingen {
namespace GUI {
-PatchTreeWindow::PatchTreeWindow(BaseObjectType* cobject,
- const Glib::RefPtr<Gnome::Glade::Xml>& xml)
-: Gtk::Window(cobject),
- _enable_signal(true)
+PatchTreeWindow::PatchTreeWindow(BaseObjectType* cobject,
+ const Glib::RefPtr<Gnome::Glade::Xml>& xml)
+ : Gtk::Window(cobject)
+ , _enable_signal(true)
{
xml->get_widget_derived("patches_treeview", _patches_treeview);
@@ -115,8 +115,7 @@ PatchTreeWindow::add_patch(SharedPtr<PatchModel> pm)
}
}
- pm->signal_enabled.connect(sigc::bind(sigc::mem_fun(this, &PatchTreeWindow::patch_enabled), pm->path()));
- pm->signal_disabled.connect(sigc::bind(sigc::mem_fun(this, &PatchTreeWindow::patch_disabled), pm->path()));
+ pm->signal_property.connect(sigc::bind(sigc::mem_fun(this, &PatchTreeWindow::patch_property_changed), pm->path()));
}
@@ -197,52 +196,24 @@ PatchTreeWindow::event_patch_enabled_toggled(const Glib::ustring& path_str)
assert(pm);
- if ( ! pm->enabled()) {
- if (_enable_signal)
- App::instance().engine()->enable_patch(patch_path);
- //row[_patch_tree_columns.enabled_col] = true;
- } else {
- if (_enable_signal)
- App::instance().engine()->disable_patch(patch_path);
- //row[_patch_tree_columns.enabled_col] = false;
- }
+ if (_enable_signal)
+ App::instance().engine()->set_property(patch_path, "ingen:enabled", (bool)!pm->enabled());
}
void
-PatchTreeWindow::patch_enabled(const Path& path)
+PatchTreeWindow::patch_property_changed(const string& key, const Raul::Atom& value, const Path& path)
{
_enable_signal = false;
-
- Gtk::TreeModel::iterator i
- = find_patch(_patch_treestore->children(), path);
-
- if (i != _patch_treestore->children().end()) {
- Gtk::TreeModel::Row row = *i;
- row[_patch_tree_columns.enabled_col] = true;
- } else {
- cerr << "[PatchTreeWindow] Unable to find patch " << path << endl;
- }
-
- _enable_signal = true;
-}
-
-
-void
-PatchTreeWindow::patch_disabled(const Path& path)
-{
- _enable_signal = false;
-
- Gtk::TreeModel::iterator i
- = find_patch(_patch_treestore->children(), path);
-
- if (i != _patch_treestore->children().end()) {
- Gtk::TreeModel::Row row = *i;
- row[_patch_tree_columns.enabled_col] = false;
- } else {
- cerr << "[PatchTreeWindow] Unable to find patch " << path << endl;
+ if (key == "ingen:enabled" && value.type() == Atom::BOOL) {
+ Gtk::TreeModel::iterator i = find_patch(_patch_treestore->children(), path);
+ if (i != _patch_treestore->children().end()) {
+ Gtk::TreeModel::Row row = *i;
+ row[_patch_tree_columns.enabled_col] = value.get_bool();
+ } else {
+ cerr << "[PatchTreeWindow] Unable to find patch " << path << endl;
+ }
}
-
_enable_signal = true;
}
diff --git a/src/libs/gui/PatchTreeWindow.hpp b/src/libs/gui/PatchTreeWindow.hpp
index 85d803cd..5cd078a5 100644
--- a/src/libs/gui/PatchTreeWindow.hpp
+++ b/src/libs/gui/PatchTreeWindow.hpp
@@ -47,8 +47,7 @@ public:
void new_object(SharedPtr<ObjectModel> object);
- void patch_enabled(const Path& path);
- void patch_disabled(const Path& path);
+ void patch_property_changed(const string& key, const Raul::Atom& value, const Path& path);
void patch_renamed(const Path& old_path, const Path& new_path);
void add_patch(SharedPtr<PatchModel> pm);
diff --git a/src/libs/gui/PatchView.cpp b/src/libs/gui/PatchView.cpp
index 2ba05070..8b720db4 100644
--- a/src/libs/gui/PatchView.cpp
+++ b/src/libs/gui/PatchView.cpp
@@ -79,11 +79,13 @@ PatchView::set_patch(SharedPtr<PatchModel> patch)
_poly_spin->set_value(patch->poly());
_destroy_but->set_sensitive(patch->path() != "/");
- patch->enabled() ? enable() : disable();
+
+ for (GraphObject::Variables::const_iterator i = patch->properties().begin();
+ i != patch->properties().end(); ++i)
+ property_changed(i->first, i->second);
// Connect model signals to track state
- patch->signal_enabled.connect(sigc::mem_fun(this, &PatchView::enable));
- patch->signal_disabled.connect(sigc::mem_fun(this, &PatchView::disable));
+ patch->signal_property.connect(sigc::mem_fun(this, &PatchView::property_changed));
// Connect widget signals to do things
_process_but->signal_toggled().connect(sigc::mem_fun(this, &PatchView::process_toggled));
@@ -151,13 +153,8 @@ PatchView::process_toggled()
if (!_enable_signal)
return;
- if (_process_but->get_active()) {
- App::instance().engine()->enable_patch(_patch->path());
- App::instance().patch_tree()->patch_enabled(_patch->path());
- } else {
- App::instance().engine()->disable_patch(_patch->path());
- App::instance().patch_tree()->patch_disabled(_patch->path());
- }
+ App::instance().engine()->set_property(_patch->path(), "ingen:enabled",
+ (bool)_process_but->get_active());
}
@@ -183,19 +180,11 @@ PatchView::refresh_clicked()
void
-PatchView::enable()
-{
- _enable_signal = false;
- _process_but->set_active(true);
- _enable_signal = true;
-}
-
-
-void
-PatchView::disable()
+PatchView::property_changed(const std::string& predicate, const Raul::Atom& value)
{
_enable_signal = false;
- _process_but->set_active(false);
+ if (predicate == "ingen:enabled" && value.type() == Atom::BOOL)
+ _process_but->set_active(value.get_bool());
_enable_signal = true;
}
diff --git a/src/libs/gui/PatchView.hpp b/src/libs/gui/PatchView.hpp
index 7cc72f5a..2c0570bd 100644
--- a/src/libs/gui/PatchView.hpp
+++ b/src/libs/gui/PatchView.hpp
@@ -74,8 +74,7 @@ private:
void on_editable_sig(bool locked);
void editable_toggled();
- void enable();
- void disable();
+ void property_changed(const std::string& predicate, const Raul::Atom& value);
void zoom_full();
diff --git a/src/libs/gui/ThreadedLoader.cpp b/src/libs/gui/ThreadedLoader.cpp
index c2ba9307..0247529d 100644
--- a/src/libs/gui/ThreadedLoader.cpp
+++ b/src/libs/gui/ThreadedLoader.cpp
@@ -101,11 +101,12 @@ ThreadedLoader::load_patch(bool merge,
_events.push_back(sigc::hide_return(sigc::bind(
sigc::mem_fun(_loader.get(), &Ingen::Serialisation::Loader::load),
App::instance().world(),
+ App::instance().world()->engine.get(),
data_base_uri,
engine_parent,
(engine_name) ? engine_name.get() : "",
"",
- engine_data )));
+ engine_data)));
}
whip();