diff options
author | David Robillard <d@drobilla.net> | 2009-05-27 23:21:34 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-05-27 23:21:34 +0000 |
commit | 2f595631859574bfa7779ebb42f42b8590f5424c (patch) | |
tree | c91c0cddcd93af991161c6cde4eceaaf45c5c8d5 /src/gui | |
parent | 20ff9af76b21b751ac29b354cf557e86b69c52f7 (diff) | |
download | ingen-2f595631859574bfa7779ebb42f42b8590f5424c.tar.gz ingen-2f595631859574bfa7779ebb42f42b8590f5424c.tar.bz2 ingen-2f595631859574bfa7779ebb42f42b8590f5424c.zip |
Remove 'property' vs 'variable' dichotomy in favour of 'meta objects' (to match serialisation).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2016 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/Controls.cpp | 4 | ||||
-rw-r--r-- | src/gui/Controls.hpp | 2 | ||||
-rw-r--r-- | src/gui/LoadPluginWindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/NewSubpatchWindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/NodeModule.cpp | 15 | ||||
-rw-r--r-- | src/gui/ObjectMenu.cpp | 6 | ||||
-rw-r--r-- | src/gui/ObjectMenu.hpp | 3 | ||||
-rw-r--r-- | src/gui/PatchCanvas.cpp | 36 | ||||
-rw-r--r-- | src/gui/PatchPortModule.cpp | 3 | ||||
-rw-r--r-- | src/gui/PatchTreeWindow.cpp | 8 | ||||
-rw-r--r-- | src/gui/PatchTreeWindow.hpp | 2 | ||||
-rw-r--r-- | src/gui/PatchView.cpp | 5 | ||||
-rw-r--r-- | src/gui/PatchWindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/Port.cpp | 4 | ||||
-rw-r--r-- | src/gui/Port.hpp | 3 | ||||
-rw-r--r-- | src/gui/PortPropertiesWindow.cpp | 16 | ||||
-rw-r--r-- | src/gui/PortPropertiesWindow.hpp | 2 |
17 files changed, 44 insertions, 75 deletions
diff --git a/src/gui/Controls.cpp b/src/gui/Controls.cpp index 20f2f208..a6a2ead3 100644 --- a/src/gui/Controls.cpp +++ b/src/gui/Controls.cpp @@ -137,7 +137,7 @@ SliderControl::init(ControlPanel* panel, SharedPtr<PortModel> pm) _slider->set_increments(0, 0); } - pm->signal_variable.connect(sigc::mem_fun(this, &SliderControl::port_variable_change)); + pm->signal_property.connect(sigc::mem_fun(this, &SliderControl::port_property_change)); _slider->set_range(std::min(min, pm->value().get_float()), std::max(max, pm->value().get_float())); //_value_spinner->set_range(min, max); @@ -188,7 +188,7 @@ SliderControl::set_value(const Atom& atom) void -SliderControl::port_variable_change(const URI& key, const Atom& value) +SliderControl::port_property_change(const URI& key, const Atom& value) { _enable_signal = false; diff --git a/src/gui/Controls.hpp b/src/gui/Controls.hpp index 63bc4ceb..9a6a13f5 100644 --- a/src/gui/Controls.hpp +++ b/src/gui/Controls.hpp @@ -87,7 +87,7 @@ private: void set_value(const Raul::Atom& value); void set_range(float min, float max); - void port_variable_change(const Raul::URI& key, const Raul::Atom& value); + void port_property_change(const Raul::URI& key, const Raul::Atom& value); void update_range(); void update_value_from_slider(); diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index 2382cac0..03966964 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -347,10 +347,10 @@ LoadPluginWindow::add_clicked() props.insert(make_pair("rdf:type", Atom(Atom::URI, "ingen:Node"))); props.insert(make_pair("rdf:instanceOf", Atom(Atom::URI, plugin->uri().str()))); App::instance().engine()->put(path, props); - App::instance().engine()->set_variable(path, "ingen:polyphonic", bool(polyphonic)); + App::instance().engine()->set_property(path, "ingen:polyphonic", bool(polyphonic)); for (GraphObject::Properties::const_iterator i = _initial_data.begin(); i != _initial_data.end(); ++i) - App::instance().engine()->set_variable(path, i->first, i->second); + App::instance().engine()->set_property(path, i->first, i->second); _node_name_entry->set_text(generate_module_name(++_plugin_name_offset)); // Cascade diff --git a/src/gui/NewSubpatchWindow.cpp b/src/gui/NewSubpatchWindow.cpp index 46663f2c..0a0f11f5 100644 --- a/src/gui/NewSubpatchWindow.cpp +++ b/src/gui/NewSubpatchWindow.cpp @@ -100,9 +100,9 @@ NewSubpatchWindow::ok_clicked() App::instance().engine()->put(path, props); for (GraphObject::Properties::const_iterator i = _initial_data.begin(); i != _initial_data.end(); ++i) - App::instance().engine()->set_variable(path, i->first, i->second); + App::instance().engine()->set_property(path, i->first, i->second); - App::instance().engine()->set_variable(path, "ingen:enabled", (bool)true); + App::instance().engine()->set_property(path, "ingen:enabled", (bool)true); hide(); } diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 74f3bc9e..b507bba7 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -52,7 +52,6 @@ NodeModule::NodeModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeMode node->signal_new_port.connect(sigc::bind(sigc::mem_fun(this, &NodeModule::add_port), true)); node->signal_removed_port.connect(sigc::hide_return(sigc::mem_fun(this, &NodeModule::remove_port))); - node->signal_variable.connect(sigc::mem_fun(this, &NodeModule::set_property)); node->signal_property.connect(sigc::mem_fun(this, &NodeModule::set_property)); node->signal_moved.connect(sigc::mem_fun(this, &NodeModule::rename)); } @@ -201,7 +200,7 @@ NodeModule::embed_gui(bool embed) for (NodeModel::Ports::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p) if ((*p)->type().is_control() && (*p)->is_output()) - App::instance().engine()->set_variable((*p)->path(), "ingen:broadcast", true); + App::instance().engine()->set_property((*p)->path(), "ingen:broadcast", true); } } else { // un-embed @@ -211,7 +210,7 @@ NodeModule::embed_gui(bool embed) for (NodeModel::Ports::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p) if ((*p)->type().is_control() && (*p)->is_output()) - App::instance().engine()->set_variable((*p)->path(), "ingen:broadcast", false); + App::instance().engine()->set_property((*p)->path(), "ingen:broadcast", false); } if (embed && _embed_item) { @@ -362,13 +361,13 @@ NodeModule::store_location() const float x = static_cast<float>(property_x()); const float y = static_cast<float>(property_y()); - const Atom& existing_x = _node->get_variable("ingenuity:canvas-x"); - const Atom& existing_y = _node->get_variable("ingenuity:canvas-y"); + const Atom& existing_x = _node->get_property("ingenuity:canvas-x"); + const Atom& existing_y = _node->get_property("ingenuity:canvas-y"); if (existing_x.type() != Atom::FLOAT || existing_y.type() != Atom::FLOAT || existing_x.get_float() != x || existing_y.get_float() != y) { - App::instance().engine()->set_variable(_node->path(), "ingenuity:canvas-x", Atom(x)); - App::instance().engine()->set_variable(_node->path(), "ingenuity:canvas-y", Atom(y)); + App::instance().engine()->set_property(_node->path(), "ingenuity:canvas-x", Atom(x)); + App::instance().engine()->set_property(_node->path(), "ingenuity:canvas-y", Atom(y)); } } @@ -406,7 +405,7 @@ NodeModule::set_selected(bool b) if (b != selected()) { Module::set_selected(b); if (App::instance().signal()) - App::instance().engine()->set_variable(_node->path(), "ingen:selected", b); + App::instance().engine()->set_property(_node->path(), "ingen:selected", b); } } diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index 6096ec7c..261cbd44 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -70,7 +70,7 @@ ObjectMenu::init(SharedPtr<ObjectModel> object) _properties_menuitem->signal_activate().connect( sigc::mem_fun(this, &ObjectMenu::on_menu_properties)); - object->signal_variable.connect(sigc::mem_fun(this, &ObjectMenu::variable_changed)); + object->signal_property.connect(sigc::mem_fun(this, &ObjectMenu::property_changed)); _enable_signal = true; } @@ -80,13 +80,13 @@ void ObjectMenu::on_menu_polyphonic() { if (_enable_signal) - App::instance().engine()->set_variable( + App::instance().engine()->set_property( _object->path(), "ingen:polyphonic", bool(_polyphonic_menuitem->get_active())); } void -ObjectMenu::variable_changed(const URI& predicate, const Atom& value) +ObjectMenu::property_changed(const URI& predicate, const Atom& value) { _enable_signal = false; if (predicate.str() == "ingen:polyphonic" && value.type() == Atom::BOOL) diff --git a/src/gui/ObjectMenu.hpp b/src/gui/ObjectMenu.hpp index f39240d0..1a722581 100644 --- a/src/gui/ObjectMenu.hpp +++ b/src/gui/ObjectMenu.hpp @@ -44,13 +44,12 @@ public: void init(SharedPtr<ObjectModel> object); protected: - virtual void on_menu_disconnect() = 0; void on_menu_polyphonic(); void on_menu_destroy(); void on_menu_properties(); - void variable_changed(const Raul::URI& predicate, const Raul::Atom& value); + void property_changed(const Raul::URI& predicate, const Raul::Atom& value); bool _enable_signal; SharedPtr<ObjectModel> _object; diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index 6bc9cbad..827a181b 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -490,27 +490,7 @@ PatchCanvas::connect(boost::shared_ptr<FlowCanvas::Connectable> src_port, // Midi binding/learn shortcut if (src->model()->type().is_event() && dst->model()->type().is_control()) { - cerr << "[PatchCanvas] FIXME: MIDI binding shortcut" << endl; -#if 0 - SharedPtr<PluginModel> pm(new PluginModel(PluginModel::Internal, "", "midi_control_in", "")); - SharedPtr<NodeModel> nm(new NodeModel(pm, _patch->path().base() - + src->name() + "-" + dst->name(), false)); - nm->set_variable("canvas-x", Atom((float) - (dst->module()->property_x() - dst->module()->width() - 20))); - nm->set_variable("canvas-y", Atom((float) - (dst->module()->property_y()))); - App::instance().engine()->create_node_from_model(nm.get()); - App::instance().engine()->connect(src->model()->path(), nm->path() + "/MIDI_In"); - App::instance().engine()->connect(nm->path() + "/Out_(CR)", dst->model()->path()); - App::instance().engine()->midi_learn(nm->path()); - - // Set control node range to port's user range - - App::instance().engine()->set_port_value_queued(nm->path().base() + "Min", - dst->model()->get_variable("user-min").get_float()); - App::instance().engine()->set_port_value_queued(nm->path().base() + "Max", - dst->model()->get_variable("user-max").get_float()); -#endif + cerr << "[PatchCanvas] TODO: MIDI binding shortcut" << endl; } else { App::instance().engine()->connect(src->model()->path(), dst->model()->path()); } @@ -700,18 +680,18 @@ PatchCanvas::paste() //cout << "Skipping root" << endl; continue; } - GraphObject::Properties::iterator x = i->second->variables().find("ingenuity:canvas-x"); - if (x != i->second->variables().end()) + GraphObject::Properties::iterator x = i->second->properties().find("ingenuity:canvas-x"); + if (x != i->second->properties().end()) x->second = x->second.get_float() + (20.0f * _paste_count); - GraphObject::Properties::iterator y = i->second->variables().find("ingenuity:canvas-y"); - if (y != i->second->variables().end()) + GraphObject::Properties::iterator y = i->second->properties().find("ingenuity:canvas-y"); + if (y != i->second->properties().end()) y->second = y->second.get_float() + (20.0f * _paste_count); if (i->first.parent().is_root()) { - GraphObject::Properties::iterator s = i->second->variables().find("ingen:selected"); - if (s != i->second->variables().end()) + GraphObject::Properties::iterator s = i->second->properties().find("ingen:selected"); + if (s != i->second->properties().end()) s->second = true; else - i->second->variables().insert(make_pair("ingen:selected", true)); + i->second->properties().insert(make_pair("ingen:selected", true)); } builder.build(i->second); } diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp index 09b7dd4a..bdd93f63 100644 --- a/src/gui/PatchPortModule.cpp +++ b/src/gui/PatchPortModule.cpp @@ -48,7 +48,6 @@ PatchPortModule::PatchPortModule(boost::shared_ptr<PatchCanvas> canvas, SharedPt set_stacked_border(model->polyphonic()); - model->signal_variable.connect(sigc::mem_fun(this, &PatchPortModule::set_property)); model->signal_property.connect(sigc::mem_fun(this, &PatchPortModule::set_property)); } @@ -171,7 +170,7 @@ PatchPortModule::set_selected(bool b) if (b != selected()) { Module::set_selected(b); if (App::instance().signal()) - App::instance().engine()->set_variable(_model->path(), "ingen:selected", b); + App::instance().engine()->set_property(_model->path(), "ingen:selected", b); } } diff --git a/src/gui/PatchTreeWindow.cpp b/src/gui/PatchTreeWindow.cpp index efbbd78f..a7fb4495 100644 --- a/src/gui/PatchTreeWindow.cpp +++ b/src/gui/PatchTreeWindow.cpp @@ -111,8 +111,8 @@ PatchTreeWindow::add_patch(SharedPtr<PatchModel> pm) } } - pm->signal_variable.connect(sigc::bind( - sigc::mem_fun(this, &PatchTreeWindow::patch_variable_changed), + pm->signal_property.connect(sigc::bind( + sigc::mem_fun(this, &PatchTreeWindow::patch_property_changed), pm->path())); pm->signal_destroyed.connect(sigc::bind( @@ -197,12 +197,12 @@ PatchTreeWindow::event_patch_enabled_toggled(const Glib::ustring& path_str) assert(pm); if (_enable_signal) - App::instance().engine()->set_variable(pm->path(), "ingen:enabled", (bool)!pm->enabled()); + App::instance().engine()->set_property(pm->path(), "ingen:enabled", (bool)!pm->enabled()); } void -PatchTreeWindow::patch_variable_changed(const URI& key, const Atom& value, const Path& path) +PatchTreeWindow::patch_property_changed(const URI& key, const Atom& value, const Path& path) { _enable_signal = false; if (key.str() == "ingen:enabled" && value.type() == Atom::BOOL) { diff --git a/src/gui/PatchTreeWindow.hpp b/src/gui/PatchTreeWindow.hpp index 915b11d4..0a71309c 100644 --- a/src/gui/PatchTreeWindow.hpp +++ b/src/gui/PatchTreeWindow.hpp @@ -46,7 +46,7 @@ public: void new_object(SharedPtr<Client::ObjectModel> object); - void patch_variable_changed(const Raul::URI& key, const Raul::Atom& value, const Raul::Path& path); + void patch_property_changed(const Raul::URI& key, const Raul::Atom& value, const Raul::Path& path); void patch_moved(const Raul::Path& old_path, const Raul::Path& new_path); void add_patch(SharedPtr<Client::PatchModel> pm); diff --git a/src/gui/PatchView.cpp b/src/gui/PatchView.cpp index e0c97bcf..812c3115 100644 --- a/src/gui/PatchView.cpp +++ b/src/gui/PatchView.cpp @@ -90,7 +90,6 @@ PatchView::set_patch(SharedPtr<PatchModel> patch) property_changed(i->first, i->second); // Connect model signals to track state - patch->signal_variable.connect(sigc::mem_fun(this, &PatchView::property_changed)); patch->signal_property.connect(sigc::mem_fun(this, &PatchView::property_changed)); // Connect widget signals to do things @@ -201,7 +200,7 @@ PatchView::process_toggled() if (!_enable_signal) return; - App::instance().engine()->set_variable(_patch->path(), "ingen:enabled", + App::instance().engine()->set_property(_patch->path(), "ingen:enabled", (bool)_process_but->get_active()); } @@ -209,7 +208,7 @@ PatchView::process_toggled() void PatchView::poly_changed() { - App::instance().engine()->set_property(_patch->path(), "ingen:polyphony", + App::instance().engine()->set_property(_patch->meta().uri(), "ingen:polyphony", _poly_spin->get_value_as_int()); } diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp index d03f35ae..3984c9be 100644 --- a/src/gui/PatchWindow.cpp +++ b/src/gui/PatchWindow.cpp @@ -477,7 +477,7 @@ PatchWindow::event_save_as() if (confirm) { const Glib::ustring uri = Glib::filename_to_uri(filename); App::instance().loader()->save_patch(_patch, uri); - _patch->set_variable("ingen:document", Atom(uri.c_str())); + _patch->set_property("ingen:document", Atom(uri.c_str())); _status_bar->push( (boost::format("Wrote %1% to %2%") % _patch->path() % uri).str(), STATUS_CONTEXT_PATCH); diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index 6283df86..ddefd0e2 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -69,7 +69,7 @@ Port::Port( set_control_min(min); set_control_max(max); - pm->signal_variable.connect(sigc::mem_fun(this, &Port::variable_changed)); + pm->signal_property.connect(sigc::mem_fun(this, &Port::property_changed)); pm->signal_value_changed.connect(sigc::mem_fun(this, &Port::value_changed)); } @@ -138,7 +138,7 @@ Port::set_control(float value, bool signal) void -Port::variable_changed(const URI& key, const Atom& value) +Port::property_changed(const URI& key, const Atom& value) { if (value.type() == Atom::FLOAT) { if ((key.str() == "lv2:minimum")) diff --git a/src/gui/Port.hpp b/src/gui/Port.hpp index 763cfd7b..db511041 100644 --- a/src/gui/Port.hpp +++ b/src/gui/Port.hpp @@ -57,8 +57,7 @@ public: void activity(); private: - - void variable_changed(const Raul::URI& key, const Raul::Atom& value); + void property_changed(const Raul::URI& key, const Raul::Atom& value); void moved(); diff --git a/src/gui/PortPropertiesWindow.cpp b/src/gui/PortPropertiesWindow.cpp index 425c5c08..045e8840 100644 --- a/src/gui/PortPropertiesWindow.cpp +++ b/src/gui/PortPropertiesWindow.cpp @@ -82,8 +82,8 @@ PortPropertiesWindow::present(SharedPtr<PortModel> pm) _connections.push_back(_max_spinner->signal_value_changed().connect( sigc::mem_fun(*this, &PortPropertiesWindow::max_changed))); - _connections.push_back(pm->signal_variable.connect( - sigc::mem_fun(this, &PortPropertiesWindow::variable_change))); + _connections.push_back(pm->signal_property.connect( + sigc::mem_fun(this, &PortPropertiesWindow::property_change))); //_enable_signal = true; @@ -92,7 +92,7 @@ PortPropertiesWindow::present(SharedPtr<PortModel> pm) void -PortPropertiesWindow::variable_change(const URI& key, const Atom& value) +PortPropertiesWindow::property_change(const URI& key, const Atom& value) { //_enable_signal = false; @@ -123,9 +123,6 @@ PortPropertiesWindow::min_changed() max = min + 1.0; _max_spinner->set_value(max); } - - //if (_enable_signal) - // App::instance().engine()->set_variable(_port_model->path(), "lv2:minimum", min); } @@ -145,9 +142,6 @@ PortPropertiesWindow::max_changed() min = max - 1.0; _min_spinner->set_value(min); } - - //if (_enable_signal) - // App::instance().engine()->set_variable(_port_model->path(), "lv2:maximum", max); } @@ -164,8 +158,8 @@ PortPropertiesWindow::ok() const float min = _min_spinner->get_value(); const float max = _max_spinner->get_value(); - App::instance().engine()->set_variable(_port_model->path(), "lv2:minimum", min); - App::instance().engine()->set_variable(_port_model->path(), "lv2:maximum", max); + App::instance().engine()->set_property(_port_model->meta().uri(), "lv2:minimum", min); + App::instance().engine()->set_property(_port_model->meta().uri(), "lv2:maximum", max); hide(); } diff --git a/src/gui/PortPropertiesWindow.hpp b/src/gui/PortPropertiesWindow.hpp index e49e2f10..a9bfbc33 100644 --- a/src/gui/PortPropertiesWindow.hpp +++ b/src/gui/PortPropertiesWindow.hpp @@ -41,7 +41,7 @@ public: void present(SharedPtr<Client::PortModel> port_model); private: - void variable_change(const Raul::URI& key, const Raul::Atom& value); + void property_change(const Raul::URI& key, const Raul::Atom& value); void min_changed(); void max_changed(); |