diff options
author | David Robillard <d@drobilla.net> | 2009-05-13 04:05:32 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-05-13 04:05:32 +0000 |
commit | 19928bb583e72802746b89e322f71ecc0fcb7427 (patch) | |
tree | 95912dc84d8c9dcf57939398514feaf148c1cd63 /src/gui | |
parent | 96f839e64de70a23210847e322d24690299287fe (diff) | |
download | ingen-19928bb583e72802746b89e322f71ecc0fcb7427.tar.gz ingen-19928bb583e72802746b89e322f71ecc0fcb7427.tar.bz2 ingen-19928bb583e72802746b89e322f71ecc0fcb7427.zip |
The great ID refactoring of 2009.
Path is now actually URI (scheme path: for now).
Therefore ingen nodes and such live in the same namespace as ... well, everything.
Including plugins.
Thar be profit, laddies.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1992 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
35 files changed, 190 insertions, 150 deletions
diff --git a/src/gui/BreadCrumb.hpp b/src/gui/BreadCrumb.hpp index 5de175c0..846064d2 100644 --- a/src/gui/BreadCrumb.hpp +++ b/src/gui/BreadCrumb.hpp @@ -61,7 +61,7 @@ public: void set_path(const Raul::Path& path) { remove(); - const string text = (path == "/") ? "/" : path.name().c_str(); + const std::string text = (path.is_root()) ? "/" : path.name().c_str(); Gtk::Label* lab = manage(new Gtk::Label(text)); lab->set_padding(0, 0); lab->show(); diff --git a/src/gui/BreadCrumbBox.cpp b/src/gui/BreadCrumbBox.cpp index 7edaed9f..6a131806 100644 --- a/src/gui/BreadCrumbBox.cpp +++ b/src/gui/BreadCrumbBox.cpp @@ -19,9 +19,12 @@ #include "BreadCrumb.hpp" #include "App.hpp" #include "client/SigClientInterface.hpp" + namespace Ingen { namespace GUI { +using namespace std; +using namespace Raul; BreadCrumbBox::BreadCrumbBox() : Gtk::HBox() @@ -120,7 +123,7 @@ BreadCrumbBox::build(Path path, SharedPtr<PatchView> view) root_but->set_active(root_but->path() == _active_path); Path working_path = "/"; - string suffix = path.substr(1); + string suffix = path.chop_scheme().substr(1); while (suffix.length() > 0) { if (suffix[0] == '/') suffix = suffix.substr(1); diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index 028ce1df..f255ebdc 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -167,14 +167,19 @@ ConnectWindow::connect(bool existing) #ifdef HAVE_LIBLO if (_mode == CONNECT_REMOTE) { if (!existing) { - const string url = (_widgets_loaded ? (string)_url_entry->get_text() : world->engine->uri()); - world->engine = SharedPtr<EngineInterface>(new OSCEngineSender(url)); + Raul::URI engine_url("http://localhost:16180"); + if (_widgets_loaded) { + const std::string& url_str = _url_entry->get_text(); + if (Raul::URI::is_valid(url_str)) + engine_url = url_str; + } + world->engine = SharedPtr<EngineInterface>(new OSCEngineSender(engine_url)); } SharedPtr<ThreadedSigClientInterface> tsci(new ThreadedSigClientInterface(1024)); SharedPtr<Raul::Deletable> client; - const string& uri = world->engine->uri(); + const string& uri = world->engine->uri().str(); const string& scheme = uri.substr(0, uri.find(":")); if (scheme == "osc.udp" || scheme == "osc.tcp") client = SharedPtr<OSCClientReceiver>(new OSCClientReceiver(16181, tsci)); // FIXME: port diff --git a/src/gui/ControlPanel.cpp b/src/gui/ControlPanel.cpp index 0d7feafd..ccfb54d2 100644 --- a/src/gui/ControlPanel.cpp +++ b/src/gui/ControlPanel.cpp @@ -25,6 +25,7 @@ #include "GladeFactory.hpp" using namespace std; +using namespace Raul; namespace Ingen { namespace GUI { @@ -251,17 +252,17 @@ ControlPanel::specific_voice_selected() void -ControlPanel::parent_property_changed(const std::string& predicate, const Raul::Atom& value) +ControlPanel::parent_property_changed(const Raul::URI& predicate, const Raul::Atom& value) { - if (predicate == "ingen:polyphony" && value.type() == Atom::INT) + if (predicate.str() == "ingen:polyphony" && value.type() == Atom::INT) _voice_spinbutton->set_range(0, value.get_int32() - 1); } void -ControlPanel::variable_changed(const std::string& predicate, const Raul::Atom& value) +ControlPanel::variable_changed(const Raul::URI& predicate, const Raul::Atom& value) { - if (predicate == "ingen:polyphonic" && value.type() == Atom::BOOL) { + if (predicate.str() == "ingen:polyphonic" && value.type() == Atom::BOOL) { if (value.get_bool()) _voice_control_box->show(); else diff --git a/src/gui/ControlPanel.hpp b/src/gui/ControlPanel.hpp index ef73ea16..4e2204ef 100644 --- a/src/gui/ControlPanel.hpp +++ b/src/gui/ControlPanel.hpp @@ -54,13 +54,13 @@ public: void init(SharedPtr<NodeModel> node, uint32_t poly); - Control* find_port(const Path& path) const; + Control* find_port(const Raul::Path& path) const; void add_port(SharedPtr<PortModel> port); - void remove_port(const Path& path); + void remove_port(const Raul::Path& path); - void enable_port(const Path& path); - void disable_port(const Path& path); + void enable_port(const Raul::Path& path); + void disable_port(const Raul::Path& path); size_t num_controls() const { return _controls.size(); } std::pair<int,int> ideal_size() const { return _ideal_size; } @@ -72,8 +72,8 @@ private: void all_voices_selected(); void specific_voice_selected(); - void variable_changed(const std::string& predicate, const Raul::Atom& value); - void parent_property_changed(const std::string& predicate, const Raul::Atom& value); + void variable_changed(const Raul::URI& predicate, const Raul::Atom& value); + void parent_property_changed(const Raul::URI& predicate, const Raul::Atom& value); bool _callback_enabled; diff --git a/src/gui/Controls.cpp b/src/gui/Controls.cpp index 99335503..f163befe 100644 --- a/src/gui/Controls.cpp +++ b/src/gui/Controls.cpp @@ -29,9 +29,10 @@ #include "App.hpp" using namespace std; -using namespace Ingen::Client; +using namespace Raul; namespace Ingen { +using namespace Client; namespace GUI { @@ -187,13 +188,13 @@ SliderControl::set_value(const Atom& atom) void -SliderControl::port_variable_change(const string& key, const Atom& value) +SliderControl::port_variable_change(const URI& key, const Atom& value) { _enable_signal = false; - if (key == "lv2:minimum" && value.type() == Atom::FLOAT) + if (key.str() == "lv2:minimum" && value.type() == Atom::FLOAT) set_range(value.get_float(), _slider->get_adjustment()->get_upper()); - else if (key == "lv2:maximum" && value.type() == Atom::FLOAT) + else if (key.str() == "lv2:maximum" && value.type() == Atom::FLOAT) set_range(_slider->get_adjustment()->get_lower(), value.get_float()); _enable_signal = true; diff --git a/src/gui/Controls.hpp b/src/gui/Controls.hpp index db480dc2..d83a0bff 100644 --- a/src/gui/Controls.hpp +++ b/src/gui/Controls.hpp @@ -26,7 +26,6 @@ #include "raul/SharedPtr.hpp" namespace Ingen { namespace Client { class PortModel; } } -using namespace Ingen::Client; namespace Ingen { namespace GUI { @@ -44,23 +43,23 @@ public: Control(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml); virtual ~Control(); - virtual void init(ControlPanel* panel, SharedPtr<PortModel> pm); + virtual void init(ControlPanel* panel, SharedPtr<Client::PortModel> pm); virtual void enable() = 0; virtual void disable() = 0; - inline const SharedPtr<PortModel> port_model() const { return _port_model; } + inline const SharedPtr<Client::PortModel> port_model() const { return _port_model; } protected: - virtual void set_value(const Atom& value) = 0; + virtual void set_value(const Raul::Atom& value) = 0; virtual void set_range(float min, float max) {} void menu_properties(); - ControlPanel* _control_panel; - SharedPtr<PortModel> _port_model; - sigc::connection _control_connection; - bool _enable_signal; + ControlPanel* _control_panel; + SharedPtr<Client::PortModel> _port_model; + sigc::connection _control_connection; + bool _enable_signal; Gtk::Menu* _menu; Gtk::MenuItem* _menu_properties; @@ -75,7 +74,7 @@ class SliderControl : public Control { public: SliderControl(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml); - void init(ControlPanel* panel, SharedPtr<PortModel> pm); + void init(ControlPanel* panel, SharedPtr<Client::PortModel> pm); void enable(); void disable(); @@ -84,11 +83,11 @@ public: void set_max(float val); private: - void set_name(const string& name); - void set_value(const Atom& value); + void set_name(const std::string& name); + void set_value(const Raul::Atom& value); void set_range(float min, float max); - void port_variable_change(const string& key, const Raul::Atom& value); + void port_variable_change(const Raul::URI& key, const Raul::Atom& value); void update_range(); void update_value_from_slider(); @@ -142,14 +141,14 @@ class ToggleControl : public Control public: ToggleControl(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml); - void init(ControlPanel* panel, SharedPtr<PortModel> pm); + void init(ControlPanel* panel, SharedPtr<Client::PortModel> pm); void enable(); void disable(); private: - void set_name(const string& name); - void set_value(const Atom& value); + void set_name(const std::string& name); + void set_value(const Raul::Atom& value); void toggled(); diff --git a/src/gui/LoadPatchWindow.cpp b/src/gui/LoadPatchWindow.cpp index 573c6311..7ae755ad 100644 --- a/src/gui/LoadPatchWindow.cpp +++ b/src/gui/LoadPatchWindow.cpp @@ -137,7 +137,7 @@ LoadPatchWindow::ok_clicked() if (_replace) App::instance().engine()->clear_patch(_patch->path()); - if (_patch->path() != "/") { + if (!_patch->path().is_root()) { parent = _patch->path().parent(); symbol = _patch->symbol(); } diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index c0188ba5..1cc48b27 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -29,7 +29,7 @@ #include "PatchCanvas.hpp" using namespace std; - +using namespace Raul; namespace Ingen { namespace GUI { @@ -222,7 +222,7 @@ LoadPluginWindow::set_plugins(SharedPtr<const ClientStore::Plugins> m) row[_plugins_columns._col_type] = "LADSPA"; else row[_plugins_columns._col_type] = plugin->type_uri(); - row[_plugins_columns._col_uri] = plugin->uri(); + row[_plugins_columns._col_uri] = plugin->uri().str(); row[_plugins_columns._col_label] = plugin->name(); row[_plugins_columns._col_plugin_model] = plugin; } @@ -251,7 +251,7 @@ LoadPluginWindow::add_plugin(SharedPtr<PluginModel> plugin) row[_plugins_columns._col_name] = plugin->name(); row[_plugins_columns._col_type] = plugin->type_uri(); - row[_plugins_columns._col_uri] = plugin->uri(); + row[_plugins_columns._col_uri] = plugin->uri().str(); row[_plugins_columns._col_label] = plugin->name(); row[_plugins_columns._col_plugin_model] = plugin; } @@ -396,11 +396,7 @@ LoadPluginWindow::filter_changed() case CriteriaColumns::TYPE: field = plugin->type_uri(); break; case CriteriaColumns::URI: - field = plugin->uri(); break; - /*case CriteriaColumns::LIBRARY: - field = plugin->lib_name(); break; - case CriteriaColumns::LABEL: - field = plugin->plug_label(); break;*/ + field = plugin->uri().str(); break; default: throw; } @@ -413,7 +409,7 @@ LoadPluginWindow::filter_changed() model_row[_plugins_columns._col_name] = plugin->name(); model_row[_plugins_columns._col_type] = plugin->type_uri(); - model_row[_plugins_columns._col_uri] = plugin->uri(); + model_row[_plugins_columns._col_uri] = plugin->uri().str(); model_row[_plugins_columns._col_plugin_model] = plugin; ++num_visible; diff --git a/src/gui/LoadPluginWindow.hpp b/src/gui/LoadPluginWindow.hpp index 6ed76ded..7abeea41 100644 --- a/src/gui/LoadPluginWindow.hpp +++ b/src/gui/LoadPluginWindow.hpp @@ -119,7 +119,7 @@ private: void plugin_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col); void plugin_selection_changed(); - string generate_module_name(int offset = 0); + std::string generate_module_name(int offset = 0); GraphObject::Properties _initial_data; diff --git a/src/gui/LoadRemotePatchWindow.cpp b/src/gui/LoadRemotePatchWindow.cpp index e70c6d3b..ecfe5240 100644 --- a/src/gui/LoadRemotePatchWindow.cpp +++ b/src/gui/LoadRemotePatchWindow.cpp @@ -141,7 +141,7 @@ LoadRemotePatchWindow::open_clicked() if (_replace) App::instance().engine()->clear_patch(_patch->path()); - if (_patch->path() != "/") + if (!_patch->path().is_root()) parent = _patch->path().parent(); App::instance().loader()->load_patch(true, uri, Path("/"), diff --git a/src/gui/NewSubpatchWindow.cpp b/src/gui/NewSubpatchWindow.cpp index 6fa2a430..c6be5230 100644 --- a/src/gui/NewSubpatchWindow.cpp +++ b/src/gui/NewSubpatchWindow.cpp @@ -22,6 +22,9 @@ #include "NewSubpatchWindow.hpp" #include "PatchView.hpp" +using namespace std; +using namespace Raul; + namespace Ingen { namespace GUI { diff --git a/src/gui/NodeControlWindow.cpp b/src/gui/NodeControlWindow.cpp index 293d28f5..2ea2a55c 100644 --- a/src/gui/NodeControlWindow.cpp +++ b/src/gui/NodeControlWindow.cpp @@ -45,7 +45,7 @@ NodeControlWindow::NodeControlWindow(SharedPtr<NodeModel> node, uint32_t poly) property_resizable() = true; set_border_width(5); - set_title(_node->path() + " Controls"); + set_title(_node->path().str() + " Controls"); Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference("warehouse_win"); xml->get_widget_derived("control_panel_vbox", _control_panel); @@ -73,7 +73,7 @@ NodeControlWindow::NodeControlWindow(SharedPtr<NodeModel> node, ControlPanel* pa property_resizable() = true; set_border_width(5); - set_title(_node->path() + " Controls"); + set_title(_node->path().str() + " Controls"); _control_panel->reparent(*this); diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp index defce091..5917b400 100644 --- a/src/gui/NodeMenu.cpp +++ b/src/gui/NodeMenu.cpp @@ -118,8 +118,8 @@ NodeMenu::init(SharedPtr<NodeModel> node) else _randomize_menuitem->hide(); - if (plugin && (plugin->uri() == "http://drobilla.net/ns/ingen-internals#Controller" - || plugin->uri() == "http://drobilla.net/ns/ingen-internals#Trigger")) + if (plugin && (plugin->uri().str() == "http://drobilla.net/ns/ingen-internals#Controller" + || plugin->uri().str() == "http://drobilla.net/ns/ingen-internals#Trigger")) _learn_menuitem->show(); else _learn_menuitem->hide(); diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index b137ebc1..efc2febd 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -36,6 +36,7 @@ #include "NodeMenu.hpp" using namespace std; +using namespace Raul; namespace Ingen { namespace GUI { @@ -370,21 +371,28 @@ NodeModule::store_location() void -NodeModule::set_variable(const string& key, const Atom& value) +NodeModule::set_variable(const URI& key, const Atom& value) { - if (key == "ingenuity:canvas-x" && value.type() == Atom::FLOAT) { - move_to(value.get_float(), property_y()); - } else if (key == "ingenuity:canvas-y" && value.type() == Atom::FLOAT) { - move_to(property_x(), value.get_float()); - } else if (key == "ingen:polyphonic" && value.type() == Atom::BOOL) { - set_stacked_border(value.get_bool()); - } else if (key == "ingen:selected" && value.type() == Atom::BOOL) { - if (value.get_bool() != selected()) { - if (value.get_bool()) - _canvas.lock()->select_item(shared_from_this()); - else - _canvas.lock()->unselect_item(shared_from_this()); + switch (value.type()) { + case Atom::FLOAT: + if (key.str() == "ingenuity:canvas-x") { + move_to(value.get_float(), property_y()); + } else if (key.str() == "ingenuity:canvas-y") { + move_to(property_x(), value.get_float()); + } + break; + 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/NodeModule.hpp b/src/gui/NodeModule.hpp index 35691dcc..47dfa374 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 std::string& predicate, const Raul::Atom& value); + void set_variable(const Raul::URI& predicate, const Raul::Atom& value); void add_port(SharedPtr<PortModel> port, bool resize=true); diff --git a/src/gui/NodePropertiesWindow.cpp b/src/gui/NodePropertiesWindow.cpp index 7885b906..3739cd5e 100644 --- a/src/gui/NodePropertiesWindow.cpp +++ b/src/gui/NodePropertiesWindow.cpp @@ -21,9 +21,11 @@ #include "client/PluginModel.hpp" #include "NodePropertiesWindow.hpp" +using namespace std; +using namespace Raul; + namespace Ingen { namespace GUI { -using std::string; NodePropertiesWindow::NodePropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml) @@ -47,15 +49,15 @@ NodePropertiesWindow::set_node(SharedPtr<NodeModel> node_model) _node_model = node_model; - set_title(node_model->path() + " Properties"); + set_title(node_model->path().str() + " Properties"); - _node_path_label->set_text(node_model->path()); + _node_path_label->set_text(node_model->path().str()); _node_polyphonic_toggle->set_active(node_model->polyphonic()); const PluginModel* pm = dynamic_cast<const PluginModel*>(node_model->plugin()); if (pm) { _plugin_type_label->set_text(pm->type_uri()); - _plugin_uri_label->set_text(pm->uri()); + _plugin_uri_label->set_text(pm->uri().str()); const Atom& name = pm->get_property("doap:name"); if (name.is_valid()) _plugin_name_label->set_text(pm->get_property("doap:name").get_string()); diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index 801561e3..904ada74 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -22,6 +22,8 @@ #include "ObjectMenu.hpp" #include "WindowFactory.hpp" +using namespace Raul; + namespace Ingen { namespace GUI { @@ -84,10 +86,10 @@ ObjectMenu::on_menu_polyphonic() void -ObjectMenu::variable_changed(const std::string& predicate, const Raul::Atom& value) +ObjectMenu::variable_changed(const URI& predicate, const Atom& value) { _enable_signal = false; - if (predicate == "ingen:polyphonic" && value.type() == Atom::BOOL) + if (predicate.str() == "ingen:polyphonic" && value.type() == Atom::BOOL) _polyphonic_menuitem->set_active(value.get_bool()); _enable_signal = true; } diff --git a/src/gui/ObjectMenu.hpp b/src/gui/ObjectMenu.hpp index edd25353..3c59580c 100644 --- a/src/gui/ObjectMenu.hpp +++ b/src/gui/ObjectMenu.hpp @@ -50,7 +50,7 @@ protected: void on_menu_destroy(); void on_menu_properties(); - void variable_changed(const std::string& predicate, const Raul::Atom& value); + void variable_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 9b9c466b..57df4a61 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -667,7 +667,7 @@ PatchCanvas::paste() clipboard.set_plugins(App::instance().store()->plugins()); // mkdir -p - string to_create = _patch->path().substr(1); + string to_create = _patch->path().chop_scheme().substr(1); string created = "/"; clipboard.new_patch("/", _patch->poly()); size_t first_slash; @@ -679,14 +679,14 @@ PatchCanvas::paste() to_create = to_create.substr(first_slash + 1); } - if (_patch->path() != "/") + if (!_patch->path().is_root()) clipboard.new_patch(_patch->path(), _patch->poly()); boost::optional<Raul::Path> data_path; boost::optional<Raul::Path> parent; boost::optional<Raul::Symbol> symbol; - if (_patch->path() != "/") { + if (!_patch->path().is_root()) { parent = _patch->path(); } @@ -695,7 +695,7 @@ PatchCanvas::paste() parent, symbol); for (Store::iterator i = clipboard.begin(); i != clipboard.end(); ++i) { - if (_patch->path() == "/" && i->first == "/") { + if (_patch->path().is_root() && i->first.is_root()) { //cout << "Skipping root" << endl; continue; } @@ -705,7 +705,7 @@ PatchCanvas::paste() GraphObject::Properties::iterator y = i->second->variables().find("ingenuity:canvas-y"); if (y != i->second->variables().end()) y->second = y->second.get_float() + (20.0f * _paste_count); - if (i->first.parent() == "/") { + if (i->first.parent().is_root()) { GraphObject::Properties::iterator s = i->second->variables().find("ingen:selected"); if (s != i->second->variables().end()) s->second = true; @@ -724,11 +724,11 @@ PatchCanvas::paste() } // Orphan connections (just in case...) - for (ClientStore::ConnectionRecords::const_iterator i = clipboard.connection_records().begin(); + /*for (ClientStore::ConnectionRecords::const_iterator i = clipboard.connection_records().begin(); i != clipboard.connection_records().end(); ++i) { cout << "WARNING: Orphan connection paste: " << i->first << " -> " << i->second << endl; App::instance().engine()->connect(i->first, i->second); - } + }*/ } diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp index 200ce12f..ffb05e8d 100644 --- a/src/gui/PatchPortModule.cpp +++ b/src/gui/PatchPortModule.cpp @@ -30,6 +30,8 @@ #include "WindowFactory.hpp" #include "PortMenu.hpp" +using namespace Raul; + namespace Ingen { namespace GUI { @@ -130,32 +132,41 @@ PatchPortModule::set_name(const std::string& n) void -PatchPortModule::set_variable(const string& key, const Atom& value) +PatchPortModule::set_variable(const URI& key, const Atom& value) { - if (key == "ingen:polyphonic" && value.type() == Atom::BOOL) { - set_stacked_border(value.get_bool()); - } else if (key == "ingen:selected" && value.type() == Atom::BOOL) { - if (value.get_bool() != selected()) { - if (value.get_bool()) - _canvas.lock()->select_item(shared_from_this()); - else - _canvas.lock()->unselect_item(shared_from_this()); + 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 string& key, const Atom& value) +PatchPortModule::set_property(const URI& key, const Atom& value) { - if (key == "ingenuity:canvas-x" && value.type() == Atom::FLOAT) { - move_to(value.get_float(), property_y()); - } else if (key == "ingenuity:canvas-y" && value.type() == Atom::FLOAT) { - move_to(property_x(), value.get_float()); - } else if (key == "lv2:name" && value.type() == Atom::STRING && _human_name_visible) { - set_name(value.get_string()); - } else if (key == "lv2:symbol" && value.type() == Atom::STRING && !_human_name_visible) { - set_name(value.get_string()); + switch (value.type()) { + case Atom::FLOAT: + if (key.str() == "ingenuity:canvas-x") { + move_to(value.get_float(), property_y()); + } else if (key.str() == "ingenuity:canvas-y") { + move_to(property_x(), value.get_float()); + } + break; + case Atom::STRING: + if (key.str() == "lv2:name" && _human_name_visible) { + set_name(value.get_string()); + } else if (key.str() == "lv2:symbol" && !_human_name_visible) { + set_name(value.get_string()); + } + default: break; } } diff --git a/src/gui/PatchPortModule.hpp b/src/gui/PatchPortModule.hpp index 62c968ef..2a1cf704 100644 --- a/src/gui/PatchPortModule.hpp +++ b/src/gui/PatchPortModule.hpp @@ -22,6 +22,7 @@ #include <boost/enable_shared_from_this.hpp> #include <libgnomecanvasmm.h> #include "flowcanvas/Module.hpp" +#include "raul/URI.hpp" #include "Port.hpp" namespace Raul { class Atom; } @@ -68,8 +69,8 @@ protected: void set_port(SharedPtr<Port> port) { _port = port; } - void set_variable(const std::string& predicate, const Raul::Atom& value); - void set_property(const std::string& predicate, const Raul::Atom& value); + 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; SharedPtr<Port> _port; diff --git a/src/gui/PatchPropertiesWindow.cpp b/src/gui/PatchPropertiesWindow.cpp index 055c8386..0fc080e0 100644 --- a/src/gui/PatchPropertiesWindow.cpp +++ b/src/gui/PatchPropertiesWindow.cpp @@ -22,6 +22,7 @@ #include "App.hpp" using namespace std; +using namespace Raul; namespace Ingen { namespace GUI { @@ -49,7 +50,7 @@ PatchPropertiesWindow::PatchPropertiesWindow(BaseObjectType* cobject, const Glib void PatchPropertiesWindow::set_patch(SharedPtr<PatchModel> patch_model) { - property_title() = patch_model->path() + " Properties"; + property_title() = patch_model->path().str() + " Properties"; _patch_model = patch_model; const Atom& name_atom = _patch_model->get_property("doap:name"); diff --git a/src/gui/PatchTreeWindow.cpp b/src/gui/PatchTreeWindow.cpp index f3a24920..0b699f64 100644 --- a/src/gui/PatchTreeWindow.cpp +++ b/src/gui/PatchTreeWindow.cpp @@ -25,6 +25,7 @@ #include "WindowFactory.hpp" using namespace std; +using namespace Raul; namespace Ingen { namespace GUI { @@ -88,8 +89,8 @@ PatchTreeWindow::add_patch(SharedPtr<PatchModel> pm) if (!pm->parent()) { Gtk::TreeModel::iterator iter = _patch_treestore->append(); Gtk::TreeModel::Row row = *iter; - if (pm->path() == "/") { - row[_patch_tree_columns.name_col] = App::instance().engine()->uri(); + if (pm->path().is_root()) { + row[_patch_tree_columns.name_col] = App::instance().engine()->uri().str(); } else { row[_patch_tree_columns.name_col] = pm->path().name(); } @@ -193,20 +194,18 @@ PatchTreeWindow::event_patch_enabled_toggled(const Glib::ustring& path_str) Gtk::TreeModel::Row row = *active; SharedPtr<PatchModel> pm = row[_patch_tree_columns.patch_model_col]; - Glib::ustring patch_path = pm->path(); - assert(pm); if (_enable_signal) - App::instance().engine()->set_variable(patch_path, "ingen:enabled", (bool)!pm->enabled()); + App::instance().engine()->set_variable(pm->path(), "ingen:enabled", (bool)!pm->enabled()); } void -PatchTreeWindow::patch_variable_changed(const string& key, const Raul::Atom& value, const Path& path) +PatchTreeWindow::patch_variable_changed(const URI& key, const Atom& value, const Path& path) { _enable_signal = false; - if (key == "ingen:enabled" && value.type() == Atom::BOOL) { + if (key.str() == "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; diff --git a/src/gui/PatchTreeWindow.hpp b/src/gui/PatchTreeWindow.hpp index 64e20b7c..3998891c 100644 --- a/src/gui/PatchTreeWindow.hpp +++ b/src/gui/PatchTreeWindow.hpp @@ -25,10 +25,7 @@ namespace Raul { class Path; } namespace Ingen { -namespace Client { - class ClientStore; -} -using Ingen::Client::ClientStore; +namespace Client { class ClientStore; } namespace GUI { @@ -45,15 +42,15 @@ class PatchTreeWindow : public Gtk::Window public: PatchTreeWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade); - void init(ClientStore& store); + void init(Client::ClientStore& store); void new_object(SharedPtr<Client::ObjectModel> object); - void patch_variable_changed(const string& key, const Raul::Atom& value, const Path& path); - void patch_renamed(const Path& old_path, const Path& new_path); + void patch_variable_changed(const Raul::URI& key, const Raul::Atom& value, const Raul::Path& path); + void patch_renamed(const Raul::Path& old_path, const Raul::Path& new_path); void add_patch(SharedPtr<Client::PatchModel> pm); - void remove_patch(const Path& path); + void remove_patch(const Raul::Path& path); void show_patch_menu(GdkEventButton* ev); protected: @@ -61,7 +58,7 @@ protected: void event_patch_activated(const Gtk::TreeModel::Path& path, Gtk::TreeView::Column* col); void event_patch_enabled_toggled(const Glib::ustring& path_str); - Gtk::TreeModel::iterator find_patch(Gtk::TreeModel::Children root, const Path& path); + Gtk::TreeModel::iterator find_patch(Gtk::TreeModel::Children root, const Raul::Path& path); PatchTreeView* _patches_treeview; diff --git a/src/gui/PatchView.cpp b/src/gui/PatchView.cpp index 911c7c73..9b4f291a 100644 --- a/src/gui/PatchView.cpp +++ b/src/gui/PatchView.cpp @@ -31,6 +31,9 @@ #include "PatchTreeWindow.hpp" #include "GladeFactory.hpp" +using namespace std; +using namespace Raul; + namespace Ingen { namespace GUI { @@ -226,16 +229,16 @@ PatchView::refresh_clicked() void -PatchView::property_changed(const std::string& predicate, const Raul::Atom& value) +PatchView::property_changed(const Raul::URI& predicate, const Raul::Atom& value) { } void -PatchView::variable_changed(const std::string& predicate, const Raul::Atom& value) +PatchView::variable_changed(const Raul::URI& predicate, const Raul::Atom& value) { _enable_signal = false; - if (predicate == "ingen:enabled") { + if (predicate.str() == "ingen:enabled") { if (value.type() == Atom::BOOL) _process_but->set_active(value.get_bool()); else diff --git a/src/gui/PatchView.hpp b/src/gui/PatchView.hpp index 488674e5..705af7b8 100644 --- a/src/gui/PatchView.hpp +++ b/src/gui/PatchView.hpp @@ -84,8 +84,8 @@ private: void canvas_item_entered(Gnome::Canvas::Item* item); void canvas_item_left(Gnome::Canvas::Item* item); - void property_changed(const std::string& predicate, const Raul::Atom& value); - void variable_changed(const std::string& predicate, const Raul::Atom& value); + 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/PatchWindow.cpp b/src/gui/PatchWindow.cpp index e8e2d7e0..d1248920 100644 --- a/src/gui/PatchWindow.cpp +++ b/src/gui/PatchWindow.cpp @@ -92,7 +92,7 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glad xml->get_widget("patch_help_about_menuitem", _menu_help_about); _menu_view_control_window->property_sensitive() = false; - string engine_name = App::instance().engine()->uri(); + string engine_name = App::instance().engine()->uri().str(); if (engine_name == "ingen:internal") engine_name = "internal engine"; _status_bar->push(string("Connected to ") + engine_name, STATUS_CONTEXT_ENGINE); @@ -251,7 +251,7 @@ PatchWindow::set_patch(SharedPtr<PatchModel> patch, SharedPtr<PatchView> view) ((int)_view->canvas()->width() - width)/2, ((int)_view->canvas()->height() - height)/2); - set_title(_patch->path() + " - Ingen"); + set_title(_patch->path().str() + " - Ingen"); new_port_connection = patch->signal_new_port.connect( sigc::mem_fun(this, &PatchWindow::patch_port_added)); @@ -300,7 +300,7 @@ PatchWindow::patch_port_removed(SharedPtr<PortModel> port) void PatchWindow::object_entered(ObjectModel* model) { - string msg = model->path(); + string msg = model->path().str(); NodeModel* node = dynamic_cast<NodeModel*>(model); if (node) { PluginModel* plugin = (PluginModel*)node->plugin(); diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index c819a957..922dea77 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -29,6 +29,7 @@ using namespace Ingen::Client; using namespace std; +using namespace Raul; namespace Ingen { namespace GUI { @@ -136,14 +137,17 @@ Port::set_control(float value, bool signal) void -Port::variable_changed(const string& key, const Atom& value) +Port::variable_changed(const URI& key, const Atom& value) { - if ( (key == "lv2:minimum") && value.type() == Atom::FLOAT) - set_control_min(value.get_float()); - else if ( (key == "lv2:maximum") && value.type() == Atom::FLOAT) - set_control_max(value.get_float()); - else if ( (key == "lv2:toggled") && value.type() == Atom::BOOL) - set_toggled(value.get_bool()); + if (value.type() == Atom::FLOAT) { + if ((key.str() == "lv2:minimum")) + set_control_min(value.get_float()); + else if ((key.str() == "lv2:maximum")) + set_control_max(value.get_float()); + } else if (value.type() == Atom::BOOL) { + if ((key.str() == "lv2:toggled")) + set_toggled(value.get_bool()); + } } diff --git a/src/gui/Port.hpp b/src/gui/Port.hpp index e3801424..10e00a88 100644 --- a/src/gui/Port.hpp +++ b/src/gui/Port.hpp @@ -58,7 +58,7 @@ public: private: - void variable_changed(const std::string& key, const Raul::Atom& value); + void variable_changed(const Raul::URI& key, const Raul::Atom& value); void renamed(); diff --git a/src/gui/PortPropertiesWindow.cpp b/src/gui/PortPropertiesWindow.cpp index 89d17154..3333ae70 100644 --- a/src/gui/PortPropertiesWindow.cpp +++ b/src/gui/PortPropertiesWindow.cpp @@ -25,8 +25,10 @@ #include "PortPropertiesWindow.hpp" using namespace std; +using namespace Raul; namespace Ingen { +using namespace Client; namespace GUI { @@ -62,7 +64,7 @@ PortPropertiesWindow::present(SharedPtr<PortModel> pm) _port_model = pm; - set_title(pm->path() + " Properties"); + set_title(pm->path().str() + " Properties"); float min = 0.0f, max = 1.0f; boost::shared_ptr<NodeModel> parent = PtrCast<NodeModel>(_port_model->parent()); @@ -90,14 +92,16 @@ PortPropertiesWindow::present(SharedPtr<PortModel> pm) void -PortPropertiesWindow::variable_change(const string& key, const Atom& value) +PortPropertiesWindow::variable_change(const URI& key, const Atom& value) { //_enable_signal = false; - if (key == "lv2:minimum" && value.type() == Atom::FLOAT) - _min_spinner->set_value(value.get_float()); - else if (key == "lv2:maximum" && value.type() == Atom::FLOAT) - _max_spinner->set_value(value.get_float()); + if (value.type() == Atom::FLOAT) { + if (key.str() == "lv2:minimum") + _min_spinner->set_value(value.get_float()); + else if (key.str() == "lv2:maximum") + _max_spinner->set_value(value.get_float()); + } //_enable_signal = true; } diff --git a/src/gui/PortPropertiesWindow.hpp b/src/gui/PortPropertiesWindow.hpp index 63b27192..2cf160bc 100644 --- a/src/gui/PortPropertiesWindow.hpp +++ b/src/gui/PortPropertiesWindow.hpp @@ -22,7 +22,6 @@ #include <libglademm.h> #include "raul/SharedPtr.hpp" #include "client/PortModel.hpp" -using namespace Ingen::Client; namespace Ingen { namespace GUI { @@ -39,10 +38,10 @@ class PortPropertiesWindow : public Gtk::Window public: PortPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade); - void present(SharedPtr<PortModel> port_model); + void present(SharedPtr<Client::PortModel> port_model); private: - void variable_change(const string& key, const Atom& value); + void variable_change(const Raul::URI& key, const Raul::Atom& value); void min_changed(); void max_changed(); @@ -54,12 +53,12 @@ private: float _initial_min; float _initial_max; - SharedPtr<PortModel> _port_model; - Gtk::SpinButton* _min_spinner; - Gtk::SpinButton* _max_spinner; - Gtk::Button* _cancel_button; - Gtk::Button* _ok_button; - std::list<sigc::connection> _connections; + SharedPtr<Client::PortModel> _port_model; + Gtk::SpinButton* _min_spinner; + Gtk::SpinButton* _max_spinner; + Gtk::Button* _cancel_button; + Gtk::Button* _ok_button; + std::list<sigc::connection> _connections; }; } // namespace GUI diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp index 92adb322..8770a89e 100644 --- a/src/gui/RenameWindow.cpp +++ b/src/gui/RenameWindow.cpp @@ -23,7 +23,8 @@ #include "App.hpp" #include "RenameWindow.hpp" -using std::string; +using namespace std; +using namespace Raul; namespace Ingen { namespace GUI { diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp index 64a77d0a..2b185257 100644 --- a/src/gui/ThreadedLoader.cpp +++ b/src/gui/ThreadedLoader.cpp @@ -93,7 +93,7 @@ ThreadedLoader::load_patch(bool merge, Glib::ustring engine_base = ""; if (engine_parent) { if (merge) - engine_base = engine_parent.get(); + engine_base = engine_parent.get().str(); else engine_base = engine_parent.get().base(); } diff --git a/src/gui/UploadPatchWindow.hpp b/src/gui/UploadPatchWindow.hpp index c81a278e..7bc08bfb 100644 --- a/src/gui/UploadPatchWindow.hpp +++ b/src/gui/UploadPatchWindow.hpp @@ -40,8 +40,8 @@ class UploadPatchWindow; class UploadThread : public Raul::Thread { public: UploadThread(UploadPatchWindow* win, - const string& str, - const string& url); + const std::string& str, + const std::string& url); private: static size_t curl_read_cb(void* ptr, size_t size, size_t nmemb, void *stream); |