diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/LoadPluginWindow.cpp | 15 | ||||
-rw-r--r-- | src/gui/LoadSubpatchWindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/NewSubpatchWindow.cpp | 8 | ||||
-rw-r--r-- | src/gui/NodeModule.cpp | 13 | ||||
-rw-r--r-- | src/gui/NodeModule.hpp | 2 | ||||
-rw-r--r-- | src/gui/PatchCanvas.cpp | 58 | ||||
-rw-r--r-- | src/gui/PatchCanvas.hpp | 2 | ||||
-rw-r--r-- | src/gui/PatchPortModule.cpp | 34 | ||||
-rw-r--r-- | src/gui/PatchPortModule.hpp | 1 | ||||
-rw-r--r-- | src/gui/PatchView.cpp | 10 | ||||
-rw-r--r-- | src/gui/PatchView.hpp | 1 | ||||
-rw-r--r-- | src/gui/UploadPatchWindow.cpp | 4 |
12 files changed, 64 insertions, 88 deletions
diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index b9f0cc03..2382cac0 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -343,7 +343,10 @@ LoadPluginWindow::add_clicked() dialog.run(); } else { Path path = _patch->path().base() + Path::nameify(name); - App::instance().engine()->new_node(path, plugin->uri()); + Resource::Properties props; + 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)); for (GraphObject::Properties::const_iterator i = _initial_data.begin(); i != _initial_data.end(); ++i) @@ -351,9 +354,9 @@ LoadPluginWindow::add_clicked() _node_name_entry->set_text(generate_module_name(++_plugin_name_offset)); // Cascade - Atom& x = _initial_data["ingenuity:canvas-x"]; + Atom& x = _initial_data.find("ingenuity:canvas-x")->second; x = Atom(x.get_float() + 20.0f); - Atom& y = _initial_data["ingenuity:canvas-y"]; + Atom& y = _initial_data.find("ingenuity:canvas-y")->second; y = Atom(y.get_float() + 20.0f); } } @@ -453,9 +456,9 @@ LoadPluginWindow::on_key_press_event(GdkEventKey* event) } void -LoadPluginWindow::plugin_property_changed(const Raul::URI& plugin, - const Raul::URI& predicate, - const Raul::Atom& value) +LoadPluginWindow::plugin_property_changed(const URI& plugin, + const URI& predicate, + const Atom& value) { Rows::const_iterator i = _rows.find(plugin); if (i != _rows.end() && value.type() == Atom::STRING) diff --git a/src/gui/LoadSubpatchWindow.cpp b/src/gui/LoadSubpatchWindow.cpp index 17544cbd..848e7643 100644 --- a/src/gui/LoadSubpatchWindow.cpp +++ b/src/gui/LoadSubpatchWindow.cpp @@ -166,9 +166,9 @@ LoadSubpatchWindow::ok_clicked() std::list<Glib::ustring> uris = get_uris(); for (std::list<Glib::ustring>::iterator i = uris.begin(); i != uris.end(); ++i) { // Cascade - Atom& x = _initial_data["ingenuity:canvas-x"]; + Atom& x = _initial_data.find("ingenuity:canvas-x")->second; x = Atom(x.get_float() + 20.0f); - Atom& y = _initial_data["ingenuity:canvas-y"]; + Atom& y = _initial_data.find("ingenuity:canvas-y")->second; y = Atom(y.get_float() + 20.0f); App::instance().loader()->load_patch(false, *i, Path("/"), diff --git a/src/gui/NewSubpatchWindow.cpp b/src/gui/NewSubpatchWindow.cpp index 82b80a05..46663f2c 100644 --- a/src/gui/NewSubpatchWindow.cpp +++ b/src/gui/NewSubpatchWindow.cpp @@ -91,10 +91,14 @@ NewSubpatchWindow::name_changed() void NewSubpatchWindow::ok_clicked() { - const Path path = _patch->path().base() + Path::nameify(_name_entry->get_text()); + const Path path = _patch->path().base() + Path::nameify(_name_entry->get_text()); const uint32_t poly = _poly_spinbutton->get_value_as_int(); - App::instance().engine()->new_patch(path, poly); + Resource::Properties props; + props.insert(make_pair("rdf:type", Atom(Atom::URI, "ingen:Patch"))); + props.insert(make_pair("ingen:polyphony", Atom(int32_t(poly)))); + 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); diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 97932814..74276301 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -52,7 +52,8 @@ 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_variable)); + node->signal_variable.connect(sigc::mem_fun(this, &NodeModule::set_property)); + node->signal_property.connect(sigc::mem_fun(this, &NodeModule::set_property)); node->signal_renamed.connect(sigc::mem_fun(this, &NodeModule::rename)); } @@ -93,11 +94,13 @@ NodeModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeModel> n ret = boost::shared_ptr<NodeModule>(new NodeModule(canvas, node)); for (GraphObject::Properties::const_iterator m = node->variables().begin(); m != node->variables().end(); ++m) - ret->set_variable(m->first, m->second); + ret->set_property(m->first, m->second); - for (NodeModel::Ports::const_iterator p = node->ports().begin(); p != node->ports().end(); ++p) { + for (GraphObject::Properties::const_iterator m = node->properties().begin(); m != node->properties().end(); ++m) + ret->set_property(m->first, m->second); + + for (NodeModel::Ports::const_iterator p = node->ports().begin(); p != node->ports().end(); ++p) ret->add_port(*p, false); - } ret->set_stacked_border(node->polyphonic()); @@ -371,7 +374,7 @@ NodeModule::store_location() void -NodeModule::set_variable(const URI& key, const Atom& value) +NodeModule::set_property(const URI& key, const Atom& value) { switch (value.type()) { case Atom::FLOAT: diff --git a/src/gui/NodeModule.hpp b/src/gui/NodeModule.hpp index 171f1142..a1a76e71 100644 --- a/src/gui/NodeModule.hpp +++ b/src/gui/NodeModule.hpp @@ -77,7 +77,7 @@ protected: void set_selected(bool b); void rename(); - void set_variable(const Raul::URI& predicate, const Raul::Atom& value); + void set_property(const Raul::URI& predicate, const Raul::Atom& value); void add_port(SharedPtr<PortModel> port, bool resize=true); diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index e6f4e65c..9f676303 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -105,12 +105,6 @@ PatchCanvas::PatchCanvas(SharedPtr<PatchModel> patch, int width, int height) sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), "event_out", "Event Out", "lv2ev:EventPort", true)); - // Add control menu items - /*_menu_add_number_control->signal_activate().connect( - sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_control), NUMBER)); - _menu_add_button_control->signal_activate().connect( - sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_control), BUTTON));*/ - // Connect to model signals to track state _patch->signal_new_node.connect(sigc::mem_fun(this, &PatchCanvas::add_node)); _patch->signal_removed_node.connect(sigc::mem_fun(this, &PatchCanvas::remove_node)); @@ -673,18 +667,21 @@ PatchCanvas::paste() // mkdir -p string to_create = _patch->path().chop_scheme().substr(1); string created = "/"; - clipboard.new_patch("/", _patch->poly()); + Resource::Properties props; + props.insert(make_pair("rdf:type", Raul::Atom(Raul::Atom::URI, "ingen:Patch"))); + props.insert(make_pair("ingen:polyphony", Raul::Atom(int32_t(_patch->poly())))); + clipboard.put("/", props); size_t first_slash; while (to_create != "/" && to_create != "" && (first_slash = to_create.find("/")) != string::npos) { created += to_create.substr(0, first_slash); assert(Path::is_valid(created)); - clipboard.new_patch(created, _patch->poly()); + clipboard.put(created, props); to_create = to_create.substr(first_slash + 1); } if (!_patch->path().is_root()) - clipboard.new_patch(_patch->path(), _patch->poly()); + clipboard.put(_patch->path(), props); boost::optional<Raul::Path> data_path; boost::optional<Raul::Path> parent; @@ -759,20 +756,6 @@ PatchCanvas::generate_port_name( name.append(" ").append(num_buf); } -void -PatchCanvas::menu_add_control(ControlType type) -{ - // FIXME: bundleify - - GraphObject::Properties data = get_initial_data(); - float x = data["ingenuity:canvas-x"].get_float(); - float y = data["ingenuity:canvas-y"].get_float(); - - cerr << "ADD CONTROL: " << (unsigned)type << " @ " << x << ", " << y << endl; - - add_item(boost::shared_ptr<FlowCanvas::Item>( - new FlowCanvas::Ellipse(shared_from_this(), "control", x, y, 20, 20, true))); -} void PatchCanvas::menu_add_port(const string& sym_base, const string& name_base, @@ -781,13 +764,14 @@ PatchCanvas::menu_add_port(const string& sym_base, const string& name_base, string sym, name; generate_port_name(sym_base, sym, name_base, name); const Path& path = _patch->path().base() + sym; - App::instance().engine()->bundle_begin(); - App::instance().engine()->new_port(path, type, _patch->num_ports(), is_output); - GraphObject::Properties data = get_initial_data(); - App::instance().engine()->set_property(path, "lv2:name", Atom(name.c_str())); - for (GraphObject::Properties::const_iterator i = data.begin(); i != data.end(); ++i) - App::instance().engine()->set_property(path, i->first, i->second); - App::instance().engine()->bundle_end(); + + Resource::Properties props = get_initial_data(); + props.insert(make_pair("rdf:type", Atom(Atom::URI, type))); + props.insert(make_pair("rdf:type", + Atom(Atom::URI, is_output ? "lv2:OutputPort" : "lv2:InputPort"))); + props.insert(make_pair("lv2:index", Atom(int32_t(_patch->num_ports())))); + props.insert(make_pair("lv2:name", Atom(name.c_str()))); + App::instance().engine()->put(path, props); } @@ -808,10 +792,10 @@ PatchCanvas::load_plugin(WeakPtr<PluginModel> weak_plugin) const Path path = _patch->path().base() + name; // FIXME: polyphony? - App::instance().engine()->new_node(path, plugin->uri()); - GraphObject::Properties data = get_initial_data(); - for (GraphObject::Properties::const_iterator i = data.begin(); i != data.end(); ++i) - App::instance().engine()->set_variable(path, i->first, i->second); + GraphObject::Properties props = get_initial_data(); + props.insert(make_pair("rdf:type", Raul::Atom(Raul::Atom::URI, "ingen:Node"))); + props.insert(make_pair("rdf:instanceOf", Raul::Atom(Raul::Atom::URI, plugin->uri().str()))); + App::instance().engine()->put(path, props); } @@ -832,10 +816,8 @@ GraphObject::Properties PatchCanvas::get_initial_data() { GraphObject::Properties result; - - result["ingenuity:canvas-x"] = Atom((float)_last_click_x); - result["ingenuity:canvas-y"] = Atom((float)_last_click_y); - + result.insert(make_pair("ingenuity:canvas-x", Atom((float)_last_click_x))); + result.insert(make_pair("ingenuity:canvas-y", Atom((float)_last_click_y))); return result; } diff --git a/src/gui/PatchCanvas.hpp b/src/gui/PatchCanvas.hpp index ca08a281..66db49fd 100644 --- a/src/gui/PatchCanvas.hpp +++ b/src/gui/PatchCanvas.hpp @@ -87,8 +87,6 @@ public: private: enum ControlType { NUMBER, BUTTON }; - void menu_add_control(ControlType type); - void generate_port_name( const string& sym_base, string& sym, const string& name_base, string& name); diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp index 0b88746c..09b7dd4a 100644 --- a/src/gui/PatchPortModule.cpp +++ b/src/gui/PatchPortModule.cpp @@ -48,7 +48,7 @@ PatchPortModule::PatchPortModule(boost::shared_ptr<PatchCanvas> canvas, SharedPt set_stacked_border(model->polyphonic()); - model->signal_variable.connect(sigc::mem_fun(this, &PatchPortModule::set_variable)); + model->signal_variable.connect(sigc::mem_fun(this, &PatchPortModule::set_property)); model->signal_property.connect(sigc::mem_fun(this, &PatchPortModule::set_property)); } @@ -65,7 +65,7 @@ PatchPortModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<PortMod for (GraphObject::Properties::const_iterator m = model->variables().begin(); m != model->variables().end(); ++m) - ret->set_variable(m->first, m->second); + ret->set_property(m->first, m->second); for (GraphObject::Properties::const_iterator m = model->properties().begin(); m != model->properties().end(); ++m) @@ -132,24 +132,6 @@ PatchPortModule::set_name(const std::string& n) void -PatchPortModule::set_variable(const URI& key, const Atom& value) -{ - if (value.type() == Atom::BOOL) { - if (key.str() == "ingen:polyphonic") { - set_stacked_border(value.get_bool()); - } else if (key.str() == "ingen:selected") { - if (value.get_bool() != selected()) { - if (value.get_bool()) - _canvas.lock()->select_item(shared_from_this()); - else - _canvas.lock()->unselect_item(shared_from_this()); - } - } - } -} - - -void PatchPortModule::set_property(const URI& key, const Atom& value) { switch (value.type()) { @@ -166,6 +148,18 @@ PatchPortModule::set_property(const URI& key, const Atom& value) } else if (key.str() == "lv2:symbol" && !_human_name_visible) { set_name(value.get_string()); } + case Atom::BOOL: + if (key.str() == "ingen:polyphonic") { + set_stacked_border(value.get_bool()); + } else if (key.str() == "ingen:selected") { + if (value.get_bool() != selected()) { + if (value.get_bool()) { + _canvas.lock()->select_item(shared_from_this()); + } else { + _canvas.lock()->unselect_item(shared_from_this()); + } + } + } default: break; } } diff --git a/src/gui/PatchPortModule.hpp b/src/gui/PatchPortModule.hpp index 4275df44..060c3950 100644 --- a/src/gui/PatchPortModule.hpp +++ b/src/gui/PatchPortModule.hpp @@ -69,7 +69,6 @@ protected: void set_port(SharedPtr<Port> port) { _port = port; } - void set_variable(const Raul::URI& predicate, const Raul::Atom& value); void set_property(const Raul::URI& predicate, const Raul::Atom& value); SharedPtr<PortModel> _model; diff --git a/src/gui/PatchView.cpp b/src/gui/PatchView.cpp index 09bf94fa..e0c97bcf 100644 --- a/src/gui/PatchView.cpp +++ b/src/gui/PatchView.cpp @@ -87,10 +87,10 @@ PatchView::set_patch(SharedPtr<PatchModel> patch) for (GraphObject::Properties::const_iterator i = patch->variables().begin(); i != patch->variables().end(); ++i) - variable_changed(i->first, i->second); + property_changed(i->first, i->second); // Connect model signals to track state - patch->signal_variable.connect(sigc::mem_fun(this, &PatchView::variable_changed)); + 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 @@ -231,12 +231,6 @@ PatchView::refresh_clicked() void PatchView::property_changed(const Raul::URI& predicate, const Raul::Atom& value) { -} - - -void -PatchView::variable_changed(const Raul::URI& predicate, const Raul::Atom& value) -{ _enable_signal = false; if (predicate.str() == "ingen:enabled") { if (value.type() == Atom::BOOL) diff --git a/src/gui/PatchView.hpp b/src/gui/PatchView.hpp index 26954298..15fcc0e4 100644 --- a/src/gui/PatchView.hpp +++ b/src/gui/PatchView.hpp @@ -85,7 +85,6 @@ private: void canvas_item_left(Gnome::Canvas::Item* item); void property_changed(const Raul::URI& predicate, const Raul::Atom& value); - void variable_changed(const Raul::URI& predicate, const Raul::Atom& value); void zoom_full(); diff --git a/src/gui/UploadPatchWindow.cpp b/src/gui/UploadPatchWindow.cpp index 96b1e2c1..0057ec18 100644 --- a/src/gui/UploadPatchWindow.cpp +++ b/src/gui/UploadPatchWindow.cpp @@ -239,8 +239,8 @@ UploadPatchWindow::upload_clicked() Glib::ustring short_name = _short_name_entry->get_text(); GraphObject::Properties extra_rdf; - extra_rdf["lv2:symbol"] = Atom(Atom::STRING, symbol); - extra_rdf["doap:name"] = Atom(Atom::STRING, short_name); + extra_rdf.insert(make_pair("lv2:symbol", Atom(Atom::STRING, symbol))); + extra_rdf.insert(make_pair("doap:name", Atom(Atom::STRING, short_name))); _response = 0; _progress_pct = 0; |