diff options
Diffstat (limited to 'src')
63 files changed, 545 insertions, 440 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 52d05622..24d7728f 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -85,7 +85,7 @@ ClientStore::add_object(SharedPtr<ObjectModel> object) PtrCast<ObjectModel>(existing->second)->set(object); } else { if (!object->path().is_root()) { - SharedPtr<ObjectModel> parent = this->object(object->path().parent()); + SharedPtr<ObjectModel> parent = _object(object->path().parent()); if (parent) { assert(object->path().is_child_of(parent->path())); object->set_parent(parent); @@ -137,7 +137,7 @@ ClientStore::remove_object(const Path& path) if (!result->path().is_root()) { assert(result->parent()); - SharedPtr<ObjectModel> parent = this->object(result->path().parent()); + SharedPtr<ObjectModel> parent = _object(result->path().parent()); if (parent) { parent->remove_child(result); } @@ -164,7 +164,7 @@ ClientStore::plugin(const URI& uri) } SharedPtr<ObjectModel> -ClientStore::object(const Path& path) +ClientStore::_object(const Path& path) { assert(path.length() > 0); iterator i = find(path); @@ -178,11 +178,17 @@ ClientStore::object(const Path& path) } } +SharedPtr<const ObjectModel> +ClientStore::object(const Path& path) const +{ + return const_cast<ClientStore*>(this)->_object(path); +} + SharedPtr<Resource> ClientStore::resource(const URI& uri) { if (Path::is_path(uri)) - return object(uri.str()); + return _object(uri.str()); else return plugin(uri); } @@ -291,7 +297,7 @@ ClientStore::put(const URI& uri, const Path path(uri.str()); - SharedPtr<ObjectModel> obj = PtrCast<ObjectModel>(object(path)); + SharedPtr<ObjectModel> obj = PtrCast<ObjectModel>(_object(path)); if (obj) { obj->set_properties(properties); return; @@ -371,7 +377,7 @@ ClientStore::delta(const URI& uri, const Path path(uri.str()); - SharedPtr<ObjectModel> obj = object(path); + SharedPtr<ObjectModel> obj = _object(path); if (obj) { obj->remove_properties(remove); obj->add_properties(add); @@ -399,7 +405,7 @@ ClientStore::set_property(const URI& subject_uri, const URI& predicate, const At void ClientStore::activity(const Path& path) { - SharedPtr<PortModel> port = PtrCast<PortModel>(object(path)); + SharedPtr<PortModel> port = PtrCast<PortModel>(_object(path)); if (port) port->signal_activity().emit(); else @@ -412,16 +418,16 @@ ClientStore::connection_patch(const Path& src_port_path, const Path& dst_port_pa SharedPtr<PatchModel> patch; if (src_port_path.parent() == dst_port_path.parent()) - patch = PtrCast<PatchModel>(this->object(src_port_path.parent())); + patch = PtrCast<PatchModel>(_object(src_port_path.parent())); if (!patch && src_port_path.parent() == dst_port_path.parent().parent()) - patch = PtrCast<PatchModel>(this->object(src_port_path.parent())); + patch = PtrCast<PatchModel>(_object(src_port_path.parent())); if (!patch && src_port_path.parent().parent() == dst_port_path.parent()) - patch = PtrCast<PatchModel>(this->object(dst_port_path.parent())); + patch = PtrCast<PatchModel>(_object(dst_port_path.parent())); if (!patch) - patch = PtrCast<PatchModel>(this->object(src_port_path.parent().parent())); + patch = PtrCast<PatchModel>(_object(src_port_path.parent().parent())); if (!patch) LOG(error) << "Unable to find connection patch " << src_port_path @@ -434,8 +440,8 @@ bool ClientStore::attempt_connection(const Path& src_port_path, const Path& dst_port_path) { - SharedPtr<PortModel> src_port = PtrCast<PortModel>(object(src_port_path)); - SharedPtr<PortModel> dst_port = PtrCast<PortModel>(object(dst_port_path)); + SharedPtr<PortModel> src_port = PtrCast<PortModel>(_object(src_port_path)); + SharedPtr<PortModel> dst_port = PtrCast<PortModel>(_object(dst_port_path)); if (src_port && dst_port) { SharedPtr<PatchModel> patch = connection_patch(src_port_path, dst_port_path); @@ -470,8 +476,8 @@ ClientStore::disconnect(const URI& src, const Path src_path(src.str()); const Path dst_path(dst.str()); - SharedPtr<PortModel> src_port = PtrCast<PortModel>(object(src_path)); - SharedPtr<PortModel> dst_port = PtrCast<PortModel>(object(dst_path)); + SharedPtr<PortModel> src_port = PtrCast<PortModel>(_object(src_path)); + SharedPtr<PortModel> dst_port = PtrCast<PortModel>(_object(dst_path)); if (src_port) src_port->disconnected_from(dst_port); @@ -488,8 +494,8 @@ void ClientStore::disconnect_all(const Raul::Path& parent_patch_path, const Raul::Path& path) { - SharedPtr<PatchModel> patch = PtrCast<PatchModel>(object(parent_patch_path)); - SharedPtr<ObjectModel> object = this->object(path); + SharedPtr<PatchModel> patch = PtrCast<PatchModel>(_object(parent_patch_path)); + SharedPtr<ObjectModel> object = _object(path); if (!patch || !object) return; diff --git a/src/client/ClientStore.hpp b/src/client/ClientStore.hpp index 59b112ed..32b66484 100644 --- a/src/client/ClientStore.hpp +++ b/src/client/ClientStore.hpp @@ -61,9 +61,10 @@ public: SharedPtr<ServerInterface> engine=SharedPtr<ServerInterface>(), SharedPtr<SigClientInterface> emitter=SharedPtr<SigClientInterface>()); - SharedPtr<PluginModel> plugin(const Raul::URI& uri); - SharedPtr<ObjectModel> object(const Raul::Path& path); - SharedPtr<Resource> resource(const Raul::URI& uri); + SharedPtr<PluginModel> plugin(const Raul::URI& uri); + SharedPtr<Resource> resource(const Raul::URI& uri); + + SharedPtr<const ObjectModel> object(const Raul::Path& path) const; void clear(); @@ -109,6 +110,8 @@ public: private: void add(GraphObject* o) { throw; } + SharedPtr<ObjectModel> _object(const Raul::Path& path); + void add_object(SharedPtr<ObjectModel> object); SharedPtr<ObjectModel> remove_object(const Raul::Path& path); diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp index 7847afb40..39ce7c8d 100644 --- a/src/client/NodeModel.cpp +++ b/src/client/NodeModel.cpp @@ -29,7 +29,9 @@ using namespace Raul; namespace Ingen { namespace Client { -NodeModel::NodeModel(Shared::LV2URIMap& uris, SharedPtr<PluginModel> plugin, const Path& path) +NodeModel::NodeModel(Shared::LV2URIMap& uris, + SharedPtr<PluginModel> plugin, + const Path& path) : Node() , ObjectModel(uris, path) , _plugin_uri(plugin->uri()) @@ -40,7 +42,9 @@ NodeModel::NodeModel(Shared::LV2URIMap& uris, SharedPtr<PluginModel> plugin, con { } -NodeModel::NodeModel(Shared::LV2URIMap& uris, const URI& plugin_uri, const Path& path) +NodeModel::NodeModel(Shared::LV2URIMap& uris, + const URI& plugin_uri, + const Path& path) : Node() , ObjectModel(uris, path) , _plugin_uri(plugin_uri) @@ -145,7 +149,7 @@ NodeModel::add_port(SharedPtr<PortModel> pm) _signal_new_port.emit(pm); } -SharedPtr<PortModel> +SharedPtr<const PortModel> NodeModel::get_port(const Raul::Symbol& symbol) const { for (Ports::const_iterator i = _ports.begin(); i != _ports.end(); ++i) @@ -158,11 +162,12 @@ Ingen::Port* NodeModel::port(uint32_t index) const { assert(index < num_ports()); - return dynamic_cast<Ingen::Port*>(_ports[index].get()); + return const_cast<Ingen::Port*>(dynamic_cast<const Ingen::Port*>(_ports[index].get())); } void -NodeModel::default_port_value_range(SharedPtr<PortModel> port, float& min, float& max) const +NodeModel::default_port_value_range(SharedPtr<const PortModel> port, + float& min, float& max) const { // Default control values min = 0.0; @@ -189,7 +194,7 @@ NodeModel::default_port_value_range(SharedPtr<PortModel> port, float& min, float } void -NodeModel::port_value_range(SharedPtr<PortModel> port, float& min, float& max) const +NodeModel::port_value_range(SharedPtr<const PortModel> port, float& min, float& max) const { assert(port->parent().get() == this); @@ -208,7 +213,7 @@ NodeModel::port_value_range(SharedPtr<PortModel> port, float& min, float& max) c } std::string -NodeModel::port_label(SharedPtr<PortModel> port) const +NodeModel::port_label(SharedPtr<const PortModel> port) const { const Raul::Atom& name = port->get_property("http://lv2plug.in/ns/lv2core#name"); if (name.is_valid()) { diff --git a/src/client/NodeModel.hpp b/src/client/NodeModel.hpp index 314ed1b4..e57d02d6 100644 --- a/src/client/NodeModel.hpp +++ b/src/client/NodeModel.hpp @@ -50,9 +50,9 @@ public: NodeModel(const NodeModel& copy); virtual ~NodeModel(); - typedef std::vector< SharedPtr<PortModel> > Ports; + typedef std::vector< SharedPtr<const PortModel> > Ports; - SharedPtr<PortModel> get_port(const Raul::Symbol& symbol) const; + SharedPtr<const PortModel> get_port(const Raul::Symbol& symbol) const; Port* port(uint32_t index) const; @@ -63,22 +63,28 @@ public: uint32_t num_ports() const { return _ports.size(); } const Ports& ports() const { return _ports; } - void default_port_value_range(SharedPtr<PortModel> port, float& min, float& max) const; - void port_value_range(SharedPtr<PortModel> port, float& min, float& max) const; + void default_port_value_range(SharedPtr<const PortModel> port, + float& min, float& max) const; + void port_value_range(SharedPtr<const PortModel> port, + float& min, float& max) const; - std::string port_label(SharedPtr<PortModel> port) const; + std::string port_label(SharedPtr<const PortModel> port) const; // Signals - INGEN_SIGNAL(new_port, void, SharedPtr<PortModel>); - INGEN_SIGNAL(removed_port, void, SharedPtr<PortModel>); + INGEN_SIGNAL(new_port, void, SharedPtr<const PortModel>); + INGEN_SIGNAL(removed_port, void, SharedPtr<const PortModel>); protected: friend class ClientStore; - NodeModel(Shared::LV2URIMap& uris, const Raul::URI& plugin_uri, const Raul::Path& path); - NodeModel(Shared::LV2URIMap& uris, SharedPtr<PluginModel> plugin, const Raul::Path& path); - + NodeModel(Shared::LV2URIMap& uris, + const Raul::URI& plugin_uri, + const Raul::Path& path); + NodeModel(Shared::LV2URIMap& uris, + SharedPtr<PluginModel> plugin, + const Raul::Path& path); NodeModel(const Raul::Path& path); + void add_child(SharedPtr<ObjectModel> c); bool remove_child(SharedPtr<ObjectModel> c); void add_port(SharedPtr<PortModel> pm); @@ -90,9 +96,9 @@ protected: virtual void clear(); - Ports _ports; ///< Vector of ports (not a Table to preserve order) - Raul::URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown) - SharedPtr<PluginModel> _plugin; ///< The plugin this node is an instance of + Ports _ports; ///< Vector of ports (not a Table to preserve order) + Raul::URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown) + SharedPtr<PluginModel> _plugin; ///< The plugin this node is an instance of private: mutable uint32_t _num_values; ///< Size of _min_values and _max_values diff --git a/src/client/PatchModel.hpp b/src/client/PatchModel.hpp index 73930189..dbd54c03 100644 --- a/src/client/PatchModel.hpp +++ b/src/client/PatchModel.hpp @@ -57,10 +57,10 @@ public: * not editable (control mode) you can just change controllers (performing) */ bool get_editable() const { return _editable; } - void set_editable(bool e) { + void set_editable(bool e) const { if (_editable != e) { _editable = e; - _signal_editable.emit(e); + const_cast<PatchModel*>(this)->signal_editable().emit(e); } } @@ -90,7 +90,7 @@ private: const Ingen::Port* dst_port); SharedPtr<Connections> _connections; - bool _editable; + mutable bool _editable; }; } // namespace Client diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 8a644edc..3f0bf735 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -149,7 +149,7 @@ PluginModel::set(SharedPtr<PluginModel> p) } Symbol -PluginModel::default_node_symbol() +PluginModel::default_node_symbol() const { const Atom& name_atom = get_property("http://lv2plug.in/ns/lv2core#symbol"); if (name_atom.is_valid() && name_atom.type() == Atom::STRING) @@ -159,7 +159,7 @@ PluginModel::default_node_symbol() } string -PluginModel::human_name() +PluginModel::human_name() const { const Atom& name_atom = get_property("http://usefulinc.com/ns/doap#name"); if (name_atom.type() == Atom::STRING) @@ -194,7 +194,8 @@ PluginModel::has_ui() const } SharedPtr<PluginUI> -PluginModel::ui(Ingen::Shared::World* world, SharedPtr<NodeModel> node) const +PluginModel::ui(Ingen::Shared::World* world, + SharedPtr<const NodeModel> node) const { if (_type != LV2) return SharedPtr<PluginUI>(); diff --git a/src/client/PluginModel.hpp b/src/client/PluginModel.hpp index e301c615..852a554d 100644 --- a/src/client/PluginModel.hpp +++ b/src/client/PluginModel.hpp @@ -62,8 +62,8 @@ public: virtual const Raul::Atom& get_property(const Raul::URI& key) const; - Raul::Symbol default_node_symbol(); - std::string human_name(); + Raul::Symbol default_node_symbol() const; + std::string human_name() const; std::string port_human_name(uint32_t index) const; #ifdef HAVE_LILV @@ -81,8 +81,8 @@ public: bool has_ui() const; - SharedPtr<PluginUI> ui(Ingen::Shared::World* world, - SharedPtr<NodeModel> node) const; + SharedPtr<PluginUI> ui(Ingen::Shared::World* world, + SharedPtr<const NodeModel> node) const; const std::string& icon_path() const; static std::string get_lv2_icon_path(const LilvPlugin* plugin); diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index 53f1d5ab..466ee320 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -52,7 +52,7 @@ lv2_ui_write(SuilController controller, return; } - SharedPtr<PortModel> port = ports[port_index]; + SharedPtr<const PortModel> port = ports[port_index]; const Shared::LV2URIMap& uris = *ui->world()->uris().get(); @@ -101,8 +101,8 @@ lv2_ui_write(SuilController controller, } } -PluginUI::PluginUI(Ingen::Shared::World* world, - SharedPtr<NodeModel> node) +PluginUI::PluginUI(Ingen::Shared::World* world, + SharedPtr<const NodeModel> node) : _world(world) , _node(node) , _instance(NULL) @@ -115,9 +115,9 @@ PluginUI::~PluginUI() } SharedPtr<PluginUI> -PluginUI::create(Ingen::Shared::World* world, - SharedPtr<NodeModel> node, - const LilvPlugin* plugin) +PluginUI::create(Ingen::Shared::World* world, + SharedPtr<const NodeModel> node, + const LilvPlugin* plugin) { if (!PluginUI::ui_host) { PluginUI::ui_host = suil_host_new(lv2_ui_write, NULL, NULL, NULL); @@ -148,7 +148,8 @@ PluginUI::create(Ingen::Shared::World* world, } SharedPtr<PluginUI> ret(new PluginUI(world, node)); - ret->_features = world->lv2_features()->lv2_features(world, node.get()); + ret->_features = world->lv2_features()->lv2_features( + world, const_cast<NodeModel*>(node.get())); SuilInstance* instance = suil_instance_new( PluginUI::ui_host, diff --git a/src/client/PluginUI.hpp b/src/client/PluginUI.hpp index cedc4fe2..9f5b0e52 100644 --- a/src/client/PluginUI.hpp +++ b/src/client/PluginUI.hpp @@ -44,9 +44,9 @@ class PluginUI { public: ~PluginUI(); - static SharedPtr<PluginUI> create(Ingen::Shared::World* world, - SharedPtr<NodeModel> node, - const LilvPlugin* plugin); + static SharedPtr<PluginUI> create(Ingen::Shared::World* world, + SharedPtr<const NodeModel> node, + const LilvPlugin* plugin); SuilWidget get_widget(); @@ -55,16 +55,16 @@ public: uint32_t format, const void* buffer); - Ingen::Shared::World* world() const { return _world; } - SharedPtr<NodeModel> node() const { return _node; } + Ingen::Shared::World* world() const { return _world; } + SharedPtr<const NodeModel> node() const { return _node; } private: - PluginUI(Ingen::Shared::World* world, - SharedPtr<NodeModel> node); + PluginUI(Ingen::Shared::World* world, + SharedPtr<const NodeModel> node); - Ingen::Shared::World* _world; - SharedPtr<NodeModel> _node; - SuilInstance* _instance; + Ingen::Shared::World* _world; + SharedPtr<const NodeModel> _node; + SuilInstance* _instance; static SuilHost* ui_host; diff --git a/src/client/PortModel.cpp b/src/client/PortModel.cpp index 9ca7fe19..f6edba20 100644 --- a/src/client/PortModel.cpp +++ b/src/client/PortModel.cpp @@ -61,7 +61,7 @@ PortModel::set(SharedPtr<ObjectModel> model) } bool -PortModel::has_context(const Raul::URI& uri) +PortModel::has_context(const Raul::URI& uri) const { const Raul::Atom& context = get_property(_uris.ctx_context); if (uri == _uris.ctx_AudioContext && !context.is_valid()) diff --git a/src/client/PortModel.hpp b/src/client/PortModel.hpp index 133a2794..fd4a679e 100644 --- a/src/client/PortModel.hpp +++ b/src/client/PortModel.hpp @@ -56,7 +56,8 @@ public: bool is_integer() const { return port_property("http://lv2plug.in/ns/lv2core#integer"); } bool is_toggle() const { return port_property("http://lv2plug.in/ns/lv2core#toggled"); } - bool has_context(const Raul::URI& context); + bool has_context(const Raul::URI& context) const; + inline bool operator==(const PortModel& pm) const { return (path() == pm.path()); } diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index 7741be10..84d67797 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -54,7 +54,8 @@ namespace Raul { class Deletable; } namespace Ingen { namespace GUI { -ConnectWindow::ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml) +ConnectWindow::ConnectWindow(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& xml) : Dialog(cobject) , _xml(xml) , _mode(CONNECT_REMOTE) @@ -444,7 +445,8 @@ ConnectWindow::gtk_callback() ++_connect_stage; } else if (_connect_stage == 3) { if (App::instance().store()->size() > 0) { - SharedPtr<PatchModel> root = PtrCast<PatchModel>(App::instance().store()->object("/")); + SharedPtr<const PatchModel> root = PtrCast<const PatchModel>( + App::instance().store()->object("/")); if (root) { set_connected_to(App::instance().engine()); App::instance().window_factory()->present_patch(root); diff --git a/src/gui/Connection.cpp b/src/gui/Connection.cpp index 27110227..f9e079c0 100644 --- a/src/gui/Connection.cpp +++ b/src/gui/Connection.cpp @@ -25,7 +25,7 @@ namespace Ingen { namespace GUI { Connection::Connection(boost::shared_ptr<FlowCanvas::Canvas> canvas, - boost::shared_ptr<ConnectionModel> model, + boost::shared_ptr<const ConnectionModel> model, boost::shared_ptr<FlowCanvas::Connectable> src, boost::shared_ptr<FlowCanvas::Connectable> dst, uint32_t color) diff --git a/src/gui/Connection.hpp b/src/gui/Connection.hpp index 6ff6365f..fb30a7c0 100644 --- a/src/gui/Connection.hpp +++ b/src/gui/Connection.hpp @@ -38,15 +38,15 @@ class Connection : public FlowCanvas::Connection { public: Connection(boost::shared_ptr<FlowCanvas::Canvas> canvas, - boost::shared_ptr<ConnectionModel> model, + boost::shared_ptr<const ConnectionModel> model, boost::shared_ptr<FlowCanvas::Connectable> src, boost::shared_ptr<FlowCanvas::Connectable> dst, uint32_t color); - SharedPtr<ConnectionModel> model() const { return _connection_model; } + SharedPtr<const ConnectionModel> model() const { return _connection_model; } private: - SharedPtr<ConnectionModel> _connection_model; + SharedPtr<const ConnectionModel> _connection_model; }; } // namespace GUI diff --git a/src/gui/ControlPanel.cpp b/src/gui/ControlPanel.cpp index 03e044cc..59309ab4 100644 --- a/src/gui/ControlPanel.cpp +++ b/src/gui/ControlPanel.cpp @@ -32,7 +32,8 @@ using namespace Raul; namespace Ingen { namespace GUI { -ControlPanel::ControlPanel(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml) +ControlPanel::ControlPanel(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& xml) : Gtk::HBox(cobject) , _callback_enabled(true) { @@ -48,12 +49,13 @@ ControlPanel::~ControlPanel() } void -ControlPanel::init(SharedPtr<NodeModel> node, uint32_t poly) +ControlPanel::init(SharedPtr<const NodeModel> node, uint32_t poly) { assert(node != NULL); assert(poly > 0); - for (NodeModel::Ports::const_iterator i = node->ports().begin(); i != node->ports().end(); ++i) { + for (NodeModel::Ports::const_iterator i = node->ports().begin(); + i != node->ports().end(); ++i) { add_port(*i); } @@ -73,7 +75,7 @@ ControlPanel::find_port(const Path& path) const /** Add a control to the panel for the given port. */ void -ControlPanel::add_port(SharedPtr<PortModel> pm) +ControlPanel::add_port(SharedPtr<const PortModel> pm) { assert(pm); @@ -146,13 +148,13 @@ ControlPanel::remove_port(const Path& path) /** Callback for Controls to notify this of a change. */ void -ControlPanel::value_changed_atom(SharedPtr<PortModel> port, const Raul::Atom& val) +ControlPanel::value_changed_atom(SharedPtr<const PortModel> port, + const Raul::Atom& val) { if (_callback_enabled) { App::instance().engine()->set_property(port->path(), App::instance().uris().ingen_value, val); - port->value(val); } } diff --git a/src/gui/ControlPanel.hpp b/src/gui/ControlPanel.hpp index 57e3bec6..cff7e946 100644 --- a/src/gui/ControlPanel.hpp +++ b/src/gui/ControlPanel.hpp @@ -47,14 +47,15 @@ namespace GUI { */ class ControlPanel : public Gtk::HBox { public: - ControlPanel(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml); + ControlPanel(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml); virtual ~ControlPanel(); - void init(SharedPtr<NodeModel> node, uint32_t poly); + void init(SharedPtr<const NodeModel> node, uint32_t poly); Control* find_port(const Raul::Path& path) const; - void add_port(SharedPtr<PortModel> port); + void add_port(SharedPtr<const PortModel> port); void remove_port(const Raul::Path& path); void enable_port(const Raul::Path& path); @@ -64,10 +65,10 @@ public: std::pair<int,int> ideal_size() const { return _ideal_size; } // Callback for Control - void value_changed_atom(SharedPtr<PortModel> port, const Raul::Atom& val); + void value_changed_atom(SharedPtr<const PortModel> port, const Raul::Atom& val); template <typename T> - void value_changed(SharedPtr<PortModel> port, T val) { + void value_changed(SharedPtr<const PortModel> port, T val) { this->value_changed_atom(port, Raul::Atom(val)); } diff --git a/src/gui/Controls.cpp b/src/gui/Controls.cpp index 153f1c26..b9362ed7 100644 --- a/src/gui/Controls.cpp +++ b/src/gui/Controls.cpp @@ -60,7 +60,7 @@ Control::~Control() } void -Control::init(ControlPanel* panel, SharedPtr<PortModel> pm) +Control::init(ControlPanel* panel, SharedPtr<const PortModel> pm) { _control_panel = panel; _port_model = pm, @@ -124,7 +124,7 @@ SliderControl::SliderControl(BaseObjectType* cobject, const Glib::RefPtr<Gnome:: } void -SliderControl::init(ControlPanel* panel, SharedPtr<PortModel> pm) +SliderControl::init(ControlPanel* panel, SharedPtr<const PortModel> pm) { _enable_signal = false; _enabled = true; @@ -297,7 +297,7 @@ ToggleControl::ToggleControl(BaseObjectType* cobject, const Glib::RefPtr<Gnome:: } void -ToggleControl::init(ControlPanel* panel, SharedPtr<PortModel> pm) +ToggleControl::init(ControlPanel* panel, SharedPtr<const PortModel> pm) { _enable_signal = false; @@ -355,7 +355,7 @@ StringControl::StringControl(BaseObjectType* cobject, const Glib::RefPtr<Gnome:: } void -StringControl::init(ControlPanel* panel, SharedPtr<PortModel> pm) +StringControl::init(ControlPanel* panel, SharedPtr<const PortModel> pm) { _enable_signal = false; diff --git a/src/gui/Controls.hpp b/src/gui/Controls.hpp index 95b89c73..c64f7062 100644 --- a/src/gui/Controls.hpp +++ b/src/gui/Controls.hpp @@ -42,12 +42,12 @@ public: Control(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml); virtual ~Control(); - virtual void init(ControlPanel* panel, SharedPtr<Client::PortModel> pm); + virtual void init(ControlPanel* panel, SharedPtr<const Client::PortModel> pm); void enable(); void disable(); - inline const SharedPtr<Client::PortModel> port_model() const { return _port_model; } + inline const SharedPtr<const Client::PortModel> port_model() const { return _port_model; } protected: virtual void set_value(const Raul::Atom& value) = 0; @@ -56,10 +56,10 @@ protected: void set_label(const std::string& name); void menu_properties(); - ControlPanel* _control_panel; - SharedPtr<Client::PortModel> _port_model; - sigc::connection _control_connection; - bool _enable_signal; + ControlPanel* _control_panel; + SharedPtr<const Client::PortModel> _port_model; + sigc::connection _control_connection; + bool _enable_signal; Gtk::Menu* _menu; Gtk::MenuItem* _menu_properties; @@ -74,7 +74,7 @@ class SliderControl : public Control { public: SliderControl(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml); - void init(ControlPanel* panel, SharedPtr<Client::PortModel> pm); + void init(ControlPanel* panel, SharedPtr<const Client::PortModel> pm); void set_min(float val); void set_max(float val); @@ -107,7 +107,7 @@ class ToggleControl : public Control public: ToggleControl(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml); - void init(ControlPanel* panel, SharedPtr<Client::PortModel> pm); + void init(ControlPanel* panel, SharedPtr<const Client::PortModel> pm); private: void set_value(const Raul::Atom& value); @@ -125,7 +125,7 @@ class StringControl : public Control public: StringControl(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml); - void init(ControlPanel* panel, SharedPtr<Client::PortModel> pm); + void init(ControlPanel* panel, SharedPtr<const Client::PortModel> pm); private: void set_value(const Raul::Atom& value); diff --git a/src/gui/LoadPatchWindow.cpp b/src/gui/LoadPatchWindow.cpp index 99c1c127..f002e36e 100644 --- a/src/gui/LoadPatchWindow.cpp +++ b/src/gui/LoadPatchWindow.cpp @@ -40,7 +40,8 @@ using namespace Raul; namespace Ingen { namespace GUI { -LoadPatchWindow::LoadPatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml) +LoadPatchWindow::LoadPatchWindow(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& xml) : Gtk::FileChooserDialog(cobject) , _merge_ports(false) { @@ -95,7 +96,9 @@ LoadPatchWindow::LoadPatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gno } void -LoadPatchWindow::present(SharedPtr<PatchModel> patch, bool import, GraphObject::Properties data) +LoadPatchWindow::present(SharedPtr<const PatchModel> patch, + bool import, + GraphObject::Properties data) { _import = import; set_patch(patch); @@ -113,7 +116,7 @@ LoadPatchWindow::present(SharedPtr<PatchModel> patch, bool import, GraphObject:: * This function MUST be called before using the window in any way! */ void -LoadPatchWindow::set_patch(SharedPtr<PatchModel> patch) +LoadPatchWindow::set_patch(SharedPtr<const PatchModel> patch) { _patch = patch; _symbol_entry->set_text(""); diff --git a/src/gui/LoadPatchWindow.hpp b/src/gui/LoadPatchWindow.hpp index 66aebece..cc60ef80 100644 --- a/src/gui/LoadPatchWindow.hpp +++ b/src/gui/LoadPatchWindow.hpp @@ -42,9 +42,11 @@ class LoadPatchWindow : public Gtk::FileChooserDialog public: LoadPatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml); - void set_patch(SharedPtr<PatchModel> patch); + void set_patch(SharedPtr<const PatchModel> patch); - void present(SharedPtr<PatchModel> patch, bool import, GraphObject::Properties data); + void present(SharedPtr<const PatchModel> patch, + bool import, + GraphObject::Properties data); protected: void on_show(); @@ -62,7 +64,7 @@ private: GraphObject::Properties _initial_data; - SharedPtr<PatchModel> _patch; + SharedPtr<const PatchModel> _patch; Gtk::Label* _symbol_label; Gtk::Entry* _symbol_entry; diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index 66868f18..b763c0ae 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -35,7 +35,8 @@ using namespace Raul; namespace Ingen { namespace GUI { -LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml) +LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& xml) : Window(cobject) , _name_offset(0) , _has_shown(false) @@ -107,7 +108,8 @@ LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<G } void -LoadPluginWindow::present(SharedPtr<PatchModel> patch, GraphObject::Properties data) +LoadPluginWindow::present(SharedPtr<const PatchModel> patch, + GraphObject::Properties data) { set_patch(patch); _initial_data = data; @@ -148,7 +150,7 @@ LoadPluginWindow::name_cleared(Gtk::EntryIconPosition pos, const GdkEventButton* * This function MUST be called before using the window in any way! */ void -LoadPluginWindow::set_patch(SharedPtr<PatchModel> patch) +LoadPluginWindow::set_patch(SharedPtr<const PatchModel> patch) { if (_patch) { _patch = patch; @@ -205,7 +207,7 @@ LoadPluginWindow::set_plugins(SharedPtr<const ClientStore::Plugins> m) } void -LoadPluginWindow::new_plugin(SharedPtr<PluginModel> pm) +LoadPluginWindow::new_plugin(SharedPtr<const PluginModel> pm) { if (is_visible()) add_plugin(pm); @@ -214,7 +216,8 @@ LoadPluginWindow::new_plugin(SharedPtr<PluginModel> pm) } void -LoadPluginWindow::set_row(Gtk::TreeModel::Row& row, SharedPtr<PluginModel> plugin) +LoadPluginWindow::set_row(Gtk::TreeModel::Row& row, + SharedPtr<const PluginModel> plugin) { const LV2URIMap& uris = App::instance().uris(); const Atom& name = plugin->get_property(uris.doap_name); @@ -241,14 +244,14 @@ LoadPluginWindow::set_row(Gtk::TreeModel::Row& row, SharedPtr<PluginModel> plugi } void -LoadPluginWindow::add_plugin(SharedPtr<PluginModel> plugin) +LoadPluginWindow::add_plugin(SharedPtr<const PluginModel> plugin) { if (plugin->lilv_plugin() && lilv_plugin_is_replaced(plugin->lilv_plugin())) { return; } Gtk::TreeModel::iterator iter = _plugins_liststore->append(); - Gtk::TreeModel::Row row = *iter; + Gtk::TreeModel::Row row = *iter; _rows.insert(make_pair(plugin->uri(), iter)); set_row(row, plugin); @@ -261,7 +264,8 @@ LoadPluginWindow::add_plugin(SharedPtr<PluginModel> plugin) ///// Event Handlers ////// void -LoadPluginWindow::plugin_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col) +LoadPluginWindow::plugin_activated(const Gtk::TreeModel::Path& path, + Gtk::TreeViewColumn* col) { add_clicked(); } @@ -279,7 +283,8 @@ LoadPluginWindow::plugin_selection_changed() *_selection->get_selected_rows().begin()); if (iter) { Gtk::TreeModel::Row row = *iter; - boost::shared_ptr<PluginModel> p = row.get_value(_plugins_columns._col_plugin); + boost::shared_ptr<const PluginModel> p = row.get_value( + _plugins_columns._col_plugin); _name_offset = App::instance().store()->child_name_offset( _patch->path(), p->default_node_symbol()); _node_name_entry->set_text(generate_module_name(p, _name_offset)); @@ -302,7 +307,8 @@ LoadPluginWindow::plugin_selection_changed() * sends the notification back. */ string -LoadPluginWindow::generate_module_name(SharedPtr<PluginModel> plugin, int offset) +LoadPluginWindow::generate_module_name(SharedPtr<const PluginModel> plugin, + int offset) { std::stringstream ss; ss << plugin->default_node_symbol(); @@ -314,11 +320,11 @@ LoadPluginWindow::generate_module_name(SharedPtr<PluginModel> plugin, int offset void LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter) { - const LV2URIMap& uris = App::instance().uris(); - Gtk::TreeModel::Row row = *iter; - SharedPtr<PluginModel> plugin = row.get_value(_plugins_columns._col_plugin); - bool polyphonic = _polyphonic_checkbutton->get_active(); - string name = _node_name_entry->get_text(); + const LV2URIMap& uris = App::instance().uris(); + Gtk::TreeModel::Row row = *iter; + SharedPtr<const PluginModel> plugin = row.get_value(_plugins_columns._col_plugin); + bool polyphonic = _polyphonic_checkbutton->get_active(); + string name = _node_name_entry->get_text(); if (name.empty()) name = generate_module_name(plugin, _name_offset); diff --git a/src/gui/LoadPluginWindow.hpp b/src/gui/LoadPluginWindow.hpp index 63ba5eb0..3ba9a590 100644 --- a/src/gui/LoadPluginWindow.hpp +++ b/src/gui/LoadPluginWindow.hpp @@ -50,12 +50,12 @@ class LoadPluginWindow : public Window public: LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml); - void set_patch(SharedPtr<PatchModel> patch); + void set_patch(SharedPtr<const PatchModel> patch); void set_plugins(SharedPtr<const Client::ClientStore::Plugins> plugins); - void add_plugin(SharedPtr<PluginModel> plugin); + void add_plugin(SharedPtr<const PluginModel> plugin); - void present(SharedPtr<PatchModel> patch, GraphObject::Properties data); + void present(SharedPtr<const PatchModel> patch, GraphObject::Properties data); protected: void on_show(); @@ -79,7 +79,7 @@ private: Gtk::TreeModelColumn<Glib::ustring> _col_uri; // Not displayed: - Gtk::TreeModelColumn<SharedPtr<PluginModel> > _col_plugin; + Gtk::TreeModelColumn< SharedPtr<const PluginModel> > _col_plugin; }; /** Column for the filter criteria combo box. */ @@ -101,8 +101,8 @@ private: void name_cleared(Gtk::EntryIconPosition pos, const GdkEventButton* event); #endif - void set_row(Gtk::TreeModel::Row& row, SharedPtr<PluginModel> plugin); - void new_plugin(SharedPtr<PluginModel> plugin); + void set_row(Gtk::TreeModel::Row& row, SharedPtr<const PluginModel> plugin); + void new_plugin(SharedPtr<const PluginModel> plugin); void plugin_property_changed(const Raul::URI& plugin, const Raul::URI& predicate, @@ -111,13 +111,14 @@ private: void plugin_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col); void plugin_selection_changed(); - std::string generate_module_name(SharedPtr<PluginModel> plugin, int offset = 0); + std::string generate_module_name(SharedPtr<const PluginModel> plugin, + int offset=0); void load_plugin(const Gtk::TreeModel::iterator& iter); GraphObject::Properties _initial_data; - SharedPtr<PatchModel> _patch; + SharedPtr<const PatchModel> _patch; typedef std::map<Raul::URI, Gtk::TreeModel::iterator> Rows; Rows _rows; diff --git a/src/gui/LoadRemotePatchWindow.cpp b/src/gui/LoadRemotePatchWindow.cpp index 0318dba7..84b304da 100644 --- a/src/gui/LoadRemotePatchWindow.cpp +++ b/src/gui/LoadRemotePatchWindow.cpp @@ -33,7 +33,8 @@ using namespace std; namespace Ingen { namespace GUI { -LoadRemotePatchWindow::LoadRemotePatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml) +LoadRemotePatchWindow::LoadRemotePatchWindow(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& xml) : Dialog(cobject) { xml->get_widget("load_remote_patch_treeview", _treeview); @@ -56,7 +57,8 @@ LoadRemotePatchWindow::LoadRemotePatchWindow(BaseObjectType* cobject, const Glib } void -LoadRemotePatchWindow::present(SharedPtr<PatchModel> patch, GraphObject::Properties data) +LoadRemotePatchWindow::present(SharedPtr<const PatchModel> patch, + GraphObject::Properties data) { _liststore->clear(); @@ -93,7 +95,7 @@ LoadRemotePatchWindow::present(SharedPtr<PatchModel> patch, GraphObject::Propert * This function MUST be called before using the window in any way! */ void -LoadRemotePatchWindow::set_patch(SharedPtr<PatchModel> patch) +LoadRemotePatchWindow::set_patch(SharedPtr<const PatchModel> patch) { _patch = patch; } diff --git a/src/gui/LoadRemotePatchWindow.hpp b/src/gui/LoadRemotePatchWindow.hpp index 07be9a30..dd0bb116 100644 --- a/src/gui/LoadRemotePatchWindow.hpp +++ b/src/gui/LoadRemotePatchWindow.hpp @@ -55,11 +55,13 @@ public: class LoadRemotePatchWindow : public Dialog { public: - LoadRemotePatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml); + LoadRemotePatchWindow(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& xml); - void set_patch(SharedPtr<PatchModel> patch); + void set_patch(SharedPtr<const PatchModel> patch); - void present(SharedPtr<PatchModel> patch, GraphObject::Properties data); + void present(SharedPtr<const PatchModel> patch, + GraphObject::Properties data); private: void patch_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col); @@ -70,7 +72,7 @@ private: GraphObject::Properties _initial_data; - SharedPtr<PatchModel> _patch; + SharedPtr<const PatchModel> _patch; Glib::RefPtr<Gtk::TreeSelection> _selection; Glib::RefPtr<Gtk::ListStore> _liststore; diff --git a/src/gui/NewSubpatchWindow.cpp b/src/gui/NewSubpatchWindow.cpp index 26664693..f2e2227a 100644 --- a/src/gui/NewSubpatchWindow.cpp +++ b/src/gui/NewSubpatchWindow.cpp @@ -29,7 +29,8 @@ using namespace Raul; namespace Ingen { namespace GUI { -NewSubpatchWindow::NewSubpatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml) +NewSubpatchWindow::NewSubpatchWindow(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& xml) : Window(cobject) { xml->get_widget("new_subpatch_name_entry", _name_entry); @@ -46,7 +47,8 @@ NewSubpatchWindow::NewSubpatchWindow(BaseObjectType* cobject, const Glib::RefPtr } void -NewSubpatchWindow::present(SharedPtr<PatchModel> patch, GraphObject::Properties data) +NewSubpatchWindow::present(SharedPtr<const PatchModel> patch, + GraphObject::Properties data) { set_patch(patch); _initial_data = data; @@ -58,7 +60,7 @@ NewSubpatchWindow::present(SharedPtr<PatchModel> patch, GraphObject::Properties * This function MUST be called before using the window in any way! */ void -NewSubpatchWindow::set_patch(SharedPtr<PatchModel> patch) +NewSubpatchWindow::set_patch(SharedPtr<const PatchModel> patch) { _patch = patch; } diff --git a/src/gui/NewSubpatchWindow.hpp b/src/gui/NewSubpatchWindow.hpp index cf05b31d..5da4c314 100644 --- a/src/gui/NewSubpatchWindow.hpp +++ b/src/gui/NewSubpatchWindow.hpp @@ -42,19 +42,21 @@ namespace GUI { class NewSubpatchWindow : public Window { public: - NewSubpatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml); + NewSubpatchWindow(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& xml); - void set_patch(SharedPtr<PatchModel> patch); + void set_patch(SharedPtr<const PatchModel> patch); - void present(SharedPtr<PatchModel> patch, GraphObject::Properties data); + void present(SharedPtr<const PatchModel> patch, + GraphObject::Properties data); private: void name_changed(); void ok_clicked(); void cancel_clicked(); - GraphObject::Properties _initial_data; - SharedPtr<PatchModel> _patch; + GraphObject::Properties _initial_data; + SharedPtr<const PatchModel> _patch; Gtk::Entry* _name_entry; Gtk::Label* _message_label; diff --git a/src/gui/NodeControlWindow.cpp b/src/gui/NodeControlWindow.cpp index ef09a68d..ebee1ad3 100644 --- a/src/gui/NodeControlWindow.cpp +++ b/src/gui/NodeControlWindow.cpp @@ -33,7 +33,8 @@ namespace GUI { /** Create a node control window and load a new ControlPanel for it. */ -NodeControlWindow::NodeControlWindow(SharedPtr<NodeModel> node, uint32_t poly) +NodeControlWindow::NodeControlWindow(SharedPtr<const NodeModel> node, + uint32_t poly) : _node(node) , _position_stored(false) , _x(0) @@ -62,7 +63,8 @@ NodeControlWindow::NodeControlWindow(SharedPtr<NodeModel> node, uint32_t poly) /** Create a node control window and with an existing ControlPanel. */ -NodeControlWindow::NodeControlWindow(SharedPtr<NodeModel> node, ControlPanel* panel) +NodeControlWindow::NodeControlWindow(SharedPtr<const NodeModel> node, + ControlPanel* panel) : _node(node) , _control_panel(panel) { diff --git a/src/gui/NodeControlWindow.hpp b/src/gui/NodeControlWindow.hpp index 4a340826..97ec7ba3 100644 --- a/src/gui/NodeControlWindow.hpp +++ b/src/gui/NodeControlWindow.hpp @@ -42,11 +42,11 @@ class ControlPanel; class NodeControlWindow : public Window { public: - NodeControlWindow(SharedPtr<NodeModel> node, uint32_t poly); - NodeControlWindow(SharedPtr<NodeModel> node, ControlPanel* panel); + NodeControlWindow(SharedPtr<const NodeModel> node, uint32_t poly); + NodeControlWindow(SharedPtr<const NodeModel> node, ControlPanel* panel); virtual ~NodeControlWindow(); - SharedPtr<NodeModel> node() { return _node; } + SharedPtr<const NodeModel> node() const { return _node; } ControlPanel* control_panel() const { return _control_panel; } @@ -57,9 +57,9 @@ protected: void on_hide(); private: - SharedPtr<NodeModel> _node; - ControlPanel* _control_panel; - bool _callback_enabled; + SharedPtr<const NodeModel> _node; + ControlPanel* _control_panel; + bool _callback_enabled; bool _position_stored; int _x; diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp index 793f1b39..7da1c374 100644 --- a/src/gui/NodeMenu.cpp +++ b/src/gui/NodeMenu.cpp @@ -59,21 +59,22 @@ NodeMenu::NodeMenu(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml } void -NodeMenu::init(SharedPtr<NodeModel> node) +NodeMenu::init(SharedPtr<const NodeModel> node) { ObjectMenu::init(node); _learn_menuitem->signal_activate().connect(sigc::mem_fun(this, &NodeMenu::on_menu_learn)); - _controls_menuitem->signal_activate().connect(sigc::bind( - sigc::mem_fun(App::instance().window_factory(), &WindowFactory::present_controls), - node)); - _popup_gui_menuitem->signal_activate().connect(sigc::mem_fun(signal_popup_gui, - &sigc::signal<void>::emit)); - _embed_gui_menuitem->signal_toggled().connect(sigc::mem_fun(this, - &NodeMenu::on_menu_embed_gui)); - _randomize_menuitem->signal_activate().connect(sigc::mem_fun(this, - &NodeMenu::on_menu_randomize)); + _controls_menuitem->signal_activate().connect( + sigc::bind(sigc::mem_fun(App::instance().window_factory(), + &WindowFactory::present_controls), + node)); + _popup_gui_menuitem->signal_activate().connect( + sigc::mem_fun(signal_popup_gui, &sigc::signal<void>::emit)); + _embed_gui_menuitem->signal_toggled().connect( + sigc::mem_fun(this, &NodeMenu::on_menu_embed_gui)); + _randomize_menuitem->signal_activate().connect( + sigc::mem_fun(this, &NodeMenu::on_menu_randomize)); const PluginModel* plugin = dynamic_cast<const PluginModel*>(node->plugin()); if (plugin && plugin->type() == PluginModel::LV2 && plugin->has_ui()) { diff --git a/src/gui/NodeMenu.hpp b/src/gui/NodeMenu.hpp index 60aee20f..5a10e021 100644 --- a/src/gui/NodeMenu.hpp +++ b/src/gui/NodeMenu.hpp @@ -38,7 +38,7 @@ class NodeMenu : public ObjectMenu public: NodeMenu(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml); - void init(SharedPtr<NodeModel> node); + void init(SharedPtr<const NodeModel> node); bool has_control_inputs(); diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 5a6e8b44..e385c8ec 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -44,7 +44,8 @@ using namespace Raul; namespace Ingen { namespace GUI { -NodeModule::NodeModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeModel> node) +NodeModule::NodeModule(boost::shared_ptr<PatchCanvas> canvas, + SharedPtr<const NodeModel> node) : FlowCanvas::Module(canvas, node->path().symbol(), 0, 0, true, canvas->show_port_names()) , _node(node) , _gui_widget(NULL) @@ -61,7 +62,7 @@ NodeModule::NodeModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeMode node->signal_moved().connect( sigc::mem_fun(this, &NodeModule::rename)); - PluginModel* plugin = dynamic_cast<PluginModel*>(node->plugin()); + const PluginModel* plugin = dynamic_cast<const PluginModel*>(node->plugin()); if (plugin) { plugin->signal_changed().connect( sigc::mem_fun(this, &NodeModule::plugin_changed)); @@ -89,12 +90,12 @@ NodeModule::create_menu() boost::shared_ptr<NodeModule> NodeModule::create(boost::shared_ptr<PatchCanvas> canvas, - SharedPtr<NodeModel> node, + SharedPtr<const NodeModel> node, bool human) { boost::shared_ptr<NodeModule> ret; - SharedPtr<PatchModel> patch = PtrCast<PatchModel>(node); + SharedPtr<const PatchModel> patch = PtrCast<const PatchModel>(node); if (patch) ret = boost::shared_ptr<NodeModule>(new SubpatchModule(canvas, patch)); else @@ -252,7 +253,7 @@ NodeModule::rename() } void -NodeModule::add_port(SharedPtr<PortModel> port, bool resize_to_fit) +NodeModule::add_port(SharedPtr<const PortModel> port, bool resize_to_fit) { Module::add_port(Port::create(PtrCast<NodeModule>(shared_from_this()), port, App::instance().configuration()->name_style() == Configuration::HUMAN)); @@ -266,7 +267,7 @@ NodeModule::add_port(SharedPtr<PortModel> port, bool resize_to_fit) } boost::shared_ptr<Port> -NodeModule::port(boost::shared_ptr<PortModel> model) +NodeModule::port(boost::shared_ptr<const PortModel> model) { for (PortVector::const_iterator p = ports().begin(); p != ports().end(); ++p) { SharedPtr<Port> port = PtrCast<Port>(*p); @@ -277,7 +278,7 @@ NodeModule::port(boost::shared_ptr<PortModel> model) } void -NodeModule::remove_port(SharedPtr<PortModel> model) +NodeModule::remove_port(SharedPtr<const PortModel> model) { SharedPtr<Port> p = port(model); if (p) { diff --git a/src/gui/NodeModule.hpp b/src/gui/NodeModule.hpp index 95ded490..78a301c5 100644 --- a/src/gui/NodeModule.hpp +++ b/src/gui/NodeModule.hpp @@ -50,22 +50,22 @@ class NodeModule : public FlowCanvas::Module public: static boost::shared_ptr<NodeModule> create ( boost::shared_ptr<PatchCanvas> canvas, - SharedPtr<NodeModel> node, - bool human_names); + SharedPtr<const NodeModel> node, + bool human_names); virtual ~NodeModule(); - boost::shared_ptr<Port> port(boost::shared_ptr<PortModel> model); + boost::shared_ptr<Port> port(boost::shared_ptr<const PortModel> model); - void remove_port(SharedPtr<PortModel> port); + void remove_port(SharedPtr<const PortModel> port); virtual void store_location(); void show_human_names(bool b); - SharedPtr<NodeModel> node() const { return _node; } + SharedPtr<const NodeModel> node() const { return _node; } protected: - NodeModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeModel> node); + NodeModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<const NodeModel> node); void on_double_click(GdkEventButton* ev); @@ -78,7 +78,7 @@ protected: void rename(); void property_changed(const Raul::URI& predicate, const Raul::Atom& value); - void add_port(SharedPtr<PortModel> port, bool resize=true); + void add_port(SharedPtr<const PortModel> port, bool resize=true); void value_changed(uint32_t index, const Raul::Atom& value); void plugin_changed(); @@ -86,11 +86,11 @@ protected: void create_menu(); - SharedPtr<NodeModel> _node; - NodeMenu* _menu; - SharedPtr<PluginUI> _plugin_ui; - Gtk::Widget* _gui_widget; - Gtk::Window* _gui_window; ///< iff popped up + SharedPtr<const NodeModel> _node; + NodeMenu* _menu; + SharedPtr<PluginUI> _plugin_ui; + Gtk::Widget* _gui_widget; + Gtk::Window* _gui_window; ///< iff popped up }; } // namespace GUI diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index 82822d57..ac0dda5c 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -31,12 +31,12 @@ namespace GUI { ObjectMenu::ObjectMenu(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml) : Gtk::Menu(cobject) - , _enable_signal(false) , _polyphonic_menuitem(NULL) , _disconnect_menuitem(NULL) , _rename_menuitem(NULL) , _destroy_menuitem(NULL) , _properties_menuitem(NULL) + , _enable_signal(false) { xml->get_widget("object_learn_menuitem", _learn_menuitem); xml->get_widget("object_unlearn_menuitem", _unlearn_menuitem); @@ -48,7 +48,7 @@ ObjectMenu::ObjectMenu(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade: } void -ObjectMenu::init(SharedPtr<ObjectModel> object) +ObjectMenu::init(SharedPtr<const ObjectModel> object) { _object = object; diff --git a/src/gui/ObjectMenu.hpp b/src/gui/ObjectMenu.hpp index 77f90e53..ffac870d 100644 --- a/src/gui/ObjectMenu.hpp +++ b/src/gui/ObjectMenu.hpp @@ -41,7 +41,7 @@ class ObjectMenu : public Gtk::Menu public: ObjectMenu(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml); - void init(SharedPtr<ObjectModel> object); + void init(SharedPtr<const ObjectModel> object); protected: void on_menu_learn(); @@ -53,15 +53,16 @@ protected: void property_changed(const Raul::URI& predicate, const Raul::Atom& value); - bool _enable_signal; - SharedPtr<ObjectModel> _object; - Gtk::MenuItem* _learn_menuitem; - Gtk::MenuItem* _unlearn_menuitem; - Gtk::CheckMenuItem* _polyphonic_menuitem; - Gtk::MenuItem* _disconnect_menuitem; - Gtk::MenuItem* _rename_menuitem; - Gtk::MenuItem* _destroy_menuitem; - Gtk::MenuItem* _properties_menuitem; + SharedPtr<const ObjectModel> _object; + Gtk::MenuItem* _learn_menuitem; + Gtk::MenuItem* _unlearn_menuitem; + Gtk::CheckMenuItem* _polyphonic_menuitem; + Gtk::MenuItem* _disconnect_menuitem; + Gtk::MenuItem* _rename_menuitem; + Gtk::MenuItem* _destroy_menuitem; + Gtk::MenuItem* _properties_menuitem; + + bool _enable_signal; }; } // namespace GUI diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index 1215b957..99110eb6 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -58,19 +58,19 @@ using namespace Raul; namespace Ingen { namespace GUI { -PatchCanvas::PatchCanvas(SharedPtr<PatchModel> patch, int width, int height) +PatchCanvas::PatchCanvas(SharedPtr<const PatchModel> patch, int width, int height) : Canvas(width, height) , _patch(patch) , _auto_position_count(0) , _last_click_x(0) , _last_click_y(0) , _paste_count(0) - , _human_names(true) - , _show_port_names(true) , _menu(NULL) , _internal_menu(NULL) , _classless_menu(NULL) , _plugin_menu(NULL) + , _human_names(true) + , _show_port_names(true) { Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference(); xml->get_widget("canvas_menu", _menu); @@ -392,13 +392,13 @@ PatchCanvas::add_plugin(SharedPtr<PluginModel> p) } void -PatchCanvas::add_node(SharedPtr<NodeModel> nm) +PatchCanvas::add_node(SharedPtr<const NodeModel> nm) { boost::shared_ptr<PatchCanvas> shared_this = boost::dynamic_pointer_cast<PatchCanvas>(shared_from_this()); - SharedPtr<PatchModel> pm = PtrCast<PatchModel>(nm); - SharedPtr<NodeModule> module; + SharedPtr<const PatchModel> pm = PtrCast<const PatchModel>(nm); + SharedPtr<NodeModule> module; if (pm) { module = SubpatchModule::create(shared_this, pm, _human_names); } else { @@ -414,7 +414,7 @@ PatchCanvas::add_node(SharedPtr<NodeModel> nm) } void -PatchCanvas::remove_node(SharedPtr<NodeModel> nm) +PatchCanvas::remove_node(SharedPtr<const NodeModel> nm) { Views::iterator i = _views.find(nm); @@ -425,7 +425,7 @@ PatchCanvas::remove_node(SharedPtr<NodeModel> nm) } void -PatchCanvas::add_port(SharedPtr<PortModel> pm) +PatchCanvas::add_port(SharedPtr<const PortModel> pm) { boost::shared_ptr<PatchCanvas> shared_this = boost::dynamic_pointer_cast<PatchCanvas>(shared_from_this()); @@ -437,7 +437,7 @@ PatchCanvas::add_port(SharedPtr<PortModel> pm) } void -PatchCanvas::remove_port(SharedPtr<PortModel> pm) +PatchCanvas::remove_port(SharedPtr<const PortModel> pm) { Views::iterator i = _views.find(pm); @@ -483,7 +483,7 @@ PatchCanvas::get_port_view(SharedPtr<PortModel> port) } void -PatchCanvas::connection(SharedPtr<ConnectionModel> cm) +PatchCanvas::connection(SharedPtr<const ConnectionModel> cm) { assert(cm); @@ -491,8 +491,10 @@ PatchCanvas::connection(SharedPtr<ConnectionModel> cm) const SharedPtr<FlowCanvas::Port> dst = get_port_view(cm->dst_port()); if (src && dst) { - add_connection(boost::shared_ptr<GUI::Connection>(new GUI::Connection(shared_from_this(), - cm, src, dst, src->color() + 0x22222200))); + add_connection( + boost::shared_ptr<GUI::Connection>( + new GUI::Connection(shared_from_this(), cm, src, dst, + src->color() + 0x22222200))); } else { LOG(error) << "Unable to find ports to connect " << cm->src_port_path() << " -> " << cm->dst_port_path() << endl; @@ -500,7 +502,7 @@ PatchCanvas::connection(SharedPtr<ConnectionModel> cm) } void -PatchCanvas::disconnection(SharedPtr<ConnectionModel> cm) +PatchCanvas::disconnection(SharedPtr<const ConnectionModel> cm) { const SharedPtr<FlowCanvas::Port> src = get_port_view(cm->src_port()); const SharedPtr<FlowCanvas::Port> dst = get_port_view(cm->dst_port()); @@ -761,7 +763,8 @@ PatchCanvas::paste() } // Successful connections - SharedPtr<PatchModel> root = PtrCast<PatchModel>(clipboard.object(_patch->path())); + SharedPtr<const PatchModel> root = PtrCast<const PatchModel>( + clipboard.object(_patch->path())); assert(root); for (Patch::Connections::const_iterator i = root->connections().begin(); i != root->connections().end(); ++i) { diff --git a/src/gui/PatchCanvas.hpp b/src/gui/PatchCanvas.hpp index 1263b8ac..d5f30b49 100644 --- a/src/gui/PatchCanvas.hpp +++ b/src/gui/PatchCanvas.hpp @@ -56,7 +56,7 @@ class NodeModule; class PatchCanvas : public FlowCanvas::Canvas { public: - PatchCanvas(SharedPtr<PatchModel> patch, int width, int height); + PatchCanvas(SharedPtr<const PatchModel> patch, int width, int height); virtual ~PatchCanvas() {} @@ -67,12 +67,12 @@ public: bool show_port_names() const { return _show_port_names; } void add_plugin(SharedPtr<PluginModel> pm); - void add_node(SharedPtr<NodeModel> nm); - void remove_node(SharedPtr<NodeModel> nm); - void add_port(SharedPtr<PortModel> pm); - void remove_port(SharedPtr<PortModel> pm); - void connection(SharedPtr<ConnectionModel> cm); - void disconnection(SharedPtr<ConnectionModel> cm); + void add_node(SharedPtr<const NodeModel> nm); + void remove_node(SharedPtr<const NodeModel> nm); + void add_port(SharedPtr<const PortModel> pm); + void remove_port(SharedPtr<const PortModel> pm); + void connection(SharedPtr<const ConnectionModel> cm); + void disconnection(SharedPtr<const ConnectionModel> cm); void get_new_module_location(double& x, double& y); @@ -131,9 +131,11 @@ private: void disconnect(boost::shared_ptr<FlowCanvas::Connectable> src, boost::shared_ptr<FlowCanvas::Connectable> dst); - SharedPtr<PatchModel> _patch; + SharedPtr<const PatchModel> _patch; - typedef std::map<SharedPtr<ObjectModel>, SharedPtr<FlowCanvas::Module> > Views; + typedef std::map<SharedPtr<const ObjectModel>, + SharedPtr<FlowCanvas::Module> + > Views; Views _views; int _auto_position_count; @@ -153,8 +155,6 @@ private: ClassMenus _class_menus; - bool _human_names; - bool _show_port_names; Gtk::Menu* _menu; Gtk::Menu* _internal_menu; Gtk::Menu* _classless_menu; @@ -169,6 +169,9 @@ private: Gtk::MenuItem* _menu_load_patch; Gtk::MenuItem* _menu_new_patch; Gtk::CheckMenuItem* _menu_edit; + + bool _human_names; + bool _show_port_names; }; } // namespace GUI diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp index 998e8a97..b491e249 100644 --- a/src/gui/PatchPortModule.cpp +++ b/src/gui/PatchPortModule.cpp @@ -38,14 +38,15 @@ using namespace Raul; namespace Ingen { namespace GUI { -PatchPortModule::PatchPortModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<PortModel> model) +PatchPortModule::PatchPortModule(boost::shared_ptr<PatchCanvas> canvas, + SharedPtr<const PortModel> model) : FlowCanvas::Module(canvas, "", 0, 0, false) // FIXME: coords? , _model(model) { assert(canvas); assert(model); - assert(PtrCast<PatchModel>(model->parent())); + assert(PtrCast<const PatchModel>(model->parent())); set_stacked_border(model->polyphonic()); @@ -54,7 +55,9 @@ PatchPortModule::PatchPortModule(boost::shared_ptr<PatchCanvas> canvas, SharedPt } boost::shared_ptr<PatchPortModule> -PatchPortModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<PortModel> model, bool human) +PatchPortModule::create(boost::shared_ptr<PatchCanvas> canvas, + SharedPtr<const PortModel> model, + bool human) { boost::shared_ptr<PatchPortModule> ret(new PatchPortModule(canvas, model)); boost::shared_ptr<Port> port(Port::create(ret, model, human, true)); diff --git a/src/gui/PatchPortModule.hpp b/src/gui/PatchPortModule.hpp index 68bf4505..7cdc3653 100644 --- a/src/gui/PatchPortModule.hpp +++ b/src/gui/PatchPortModule.hpp @@ -49,19 +49,21 @@ class PortMenu; class PatchPortModule : public FlowCanvas::Module { public: - static boost::shared_ptr<PatchPortModule> create(boost::shared_ptr<PatchCanvas> canvas, - SharedPtr<PortModel> model, - bool human); + static boost::shared_ptr<PatchPortModule> create( + boost::shared_ptr<PatchCanvas> canvas, + SharedPtr<const PortModel> model, + bool human); virtual void store_location(); void show_human_names(bool b); void set_name(const std::string& n); - SharedPtr<PortModel> port() const { return _model; } + SharedPtr<const PortModel> port() const { return _model; } protected: - PatchPortModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<PortModel> model); + PatchPortModule(boost::shared_ptr<PatchCanvas> canvas, + SharedPtr<const PortModel> model); void create_menu(); void set_selected(bool b); @@ -70,9 +72,9 @@ protected: void property_changed(const Raul::URI& predicate, const Raul::Atom& value); - SharedPtr<PortModel> _model; - SharedPtr<Port> _port; - PortMenu* _menu; + SharedPtr<const PortModel> _model; + SharedPtr<Port> _port; + PortMenu* _menu; }; } // namespace GUI diff --git a/src/gui/PatchView.cpp b/src/gui/PatchView.cpp index 65c3566a..4df3d4b7 100644 --- a/src/gui/PatchView.cpp +++ b/src/gui/PatchView.cpp @@ -36,7 +36,8 @@ using namespace Raul; namespace Ingen { namespace GUI { -PatchView::PatchView(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml) +PatchView::PatchView(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& xml) : Gtk::Box(cobject) , _breadcrumb_container(NULL) , _enable_signal(true) @@ -61,7 +62,7 @@ PatchView::PatchView(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::X } void -PatchView::set_patch(SharedPtr<PatchModel> patch) +PatchView::set_patch(SharedPtr<const PatchModel> patch) { assert(!_canvas); // FIXME: remove @@ -114,7 +115,7 @@ PatchView::set_patch(SharedPtr<PatchModel> patch) } SharedPtr<PatchView> -PatchView::create(SharedPtr<PatchModel> patch) +PatchView::create(SharedPtr<const PatchModel> patch) { const Glib::RefPtr<Gnome::Glade::Xml>& xml = GladeFactory::new_glade_reference("patch_view_box"); PatchView* result = NULL; @@ -152,7 +153,7 @@ PatchView::canvas_item_entered(Gnome::Canvas::Item* item) if (m) signal_object_entered.emit(m->node().get()); - Port* p = dynamic_cast<Port*>(item); + const Port* p = dynamic_cast<const Port*>(item); if (p) signal_object_entered.emit(p->model().get()); } @@ -166,7 +167,7 @@ PatchView::canvas_item_left(Gnome::Canvas::Item* item) return; } - Port* p = dynamic_cast<Port*>(item); + const Port* p = dynamic_cast<const Port*>(item); if (p) signal_object_left.emit(p->model().get()); } diff --git a/src/gui/PatchView.hpp b/src/gui/PatchView.hpp index 5995cd42..f637ce5d 100644 --- a/src/gui/PatchView.hpp +++ b/src/gui/PatchView.hpp @@ -54,21 +54,22 @@ class SubpatchModule; class PatchView : public Gtk::Box { public: - PatchView(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml); + PatchView(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml); - SharedPtr<PatchCanvas> canvas() const { return _canvas; } - SharedPtr<PatchModel> patch() const { return _patch; } - Gtk::ToolItem* breadcrumb_container() const { return _breadcrumb_container; } + SharedPtr<PatchCanvas> canvas() const { return _canvas; } + SharedPtr<const PatchModel> patch() const { return _patch; } + Gtk::ToolItem* breadcrumb_container() const { return _breadcrumb_container; } void set_editable(bool editable); - static SharedPtr<PatchView> create(SharedPtr<PatchModel> patch); + static SharedPtr<PatchView> create(SharedPtr<const PatchModel> patch); - sigc::signal<void, ObjectModel*> signal_object_entered; - sigc::signal<void, ObjectModel*> signal_object_left; + sigc::signal<void, const ObjectModel*> signal_object_entered; + sigc::signal<void, const ObjectModel*> signal_object_left; private: - void set_patch(SharedPtr<PatchModel> patch); + void set_patch(SharedPtr<const PatchModel> patch); void process_toggled(); void poly_changed(); @@ -84,8 +85,8 @@ private: void zoom_full(); - SharedPtr<PatchModel> _patch; - SharedPtr<PatchCanvas> _canvas; + SharedPtr<const PatchModel> _patch; + SharedPtr<PatchCanvas> _canvas; Gtk::ScrolledWindow* _canvas_scrolledwindow; diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp index ab8fcfd9..844cac81 100644 --- a/src/gui/PatchWindow.cpp +++ b/src/gui/PatchWindow.cpp @@ -189,7 +189,8 @@ PatchWindow::set_patch_from_path(const Path& path, SharedPtr<PatchView> view) assert(view->patch()->path() == path); App::instance().window_factory()->present_patch(view->patch(), this, view); } else { - SharedPtr<PatchModel> model = PtrCast<PatchModel>(App::instance().store()->object(path)); + SharedPtr<const PatchModel> model = PtrCast<const PatchModel>( + App::instance().store()->object(path)); if (model) App::instance().window_factory()->present_patch(model, this); } @@ -200,7 +201,8 @@ PatchWindow::set_patch_from_path(const Path& path, SharedPtr<PatchView> view) * If @a view is NULL, a new view will be created. */ void -PatchWindow::set_patch(SharedPtr<PatchModel> patch, SharedPtr<PatchView> view) +PatchWindow::set_patch(SharedPtr<const PatchModel> patch, + SharedPtr<PatchView> view) { if (!patch || patch == _patch) return; @@ -271,7 +273,7 @@ PatchWindow::set_patch(SharedPtr<PatchModel> patch, SharedPtr<PatchView> view) } void -PatchWindow::patch_port_added(SharedPtr<PortModel> port) +PatchWindow::patch_port_added(SharedPtr<const PortModel> port) { if (port->is_input() && App::instance().can_control(port.get())) { _menu_view_control_window->property_sensitive() = true; @@ -279,7 +281,7 @@ PatchWindow::patch_port_added(SharedPtr<PortModel> port) } void -PatchWindow::patch_port_removed(SharedPtr<PortModel> port) +PatchWindow::patch_port_removed(SharedPtr<const PortModel> port) { if (!(port->is_input() && App::instance().can_control(port.get()))) return; @@ -296,19 +298,19 @@ PatchWindow::patch_port_removed(SharedPtr<PortModel> port) } void -PatchWindow::show_status(ObjectModel* model) +PatchWindow::show_status(const ObjectModel* model) { std::stringstream msg; msg << model->path().chop_scheme(); - PortModel* port = 0; - NodeModel* node = 0; + const PortModel* port = 0; + const NodeModel* node = 0; - if ((port = dynamic_cast<PortModel*>(model))) { + if ((port = dynamic_cast<const PortModel*>(model))) { show_port_status(port, port->value()); - } else if ((node = dynamic_cast<NodeModel*>(model))) { - PluginModel* plugin = dynamic_cast<PluginModel*>(node->plugin()); + } else if ((node = dynamic_cast<const NodeModel*>(model))) { + const PluginModel* plugin = dynamic_cast<const PluginModel*>(node->plugin()); if (plugin) msg << ((boost::format(" (%1%)") % plugin->human_name()).str()); _status_bar->push(msg.str(), STATUS_CONTEXT_HOVER); @@ -316,12 +318,12 @@ PatchWindow::show_status(ObjectModel* model) } void -PatchWindow::show_port_status(PortModel* port, const Raul::Atom& value) +PatchWindow::show_port_status(const PortModel* port, const Raul::Atom& value) { std::stringstream msg; msg << port->path().chop_scheme(); - NodeModel* parent = dynamic_cast<NodeModel*>(port->parent().get()); + const NodeModel* parent = dynamic_cast<const NodeModel*>(port->parent().get()); if (parent) { const PluginModel* plugin = dynamic_cast<const PluginModel*>(parent->plugin()); if (plugin) { @@ -340,13 +342,13 @@ PatchWindow::show_port_status(PortModel* port, const Raul::Atom& value) } void -PatchWindow::object_entered(ObjectModel* model) +PatchWindow::object_entered(const ObjectModel* model) { show_status(model); } void -PatchWindow::object_left(ObjectModel* model) +PatchWindow::object_left(const ObjectModel* model) { _status_bar->pop(STATUS_CONTEXT_HOVER); } @@ -462,7 +464,7 @@ PatchWindow::event_save_as() continue; } - _patch->set_property(uris.lv2_symbol, Atom(symbol.c_str())); + //_patch->set_property(uris.lv2_symbol, Atom(symbol.c_str())); bool confirm = true; if (Glib::file_test(filename, Glib::FILE_TEST_IS_DIR)) { @@ -495,7 +497,7 @@ more files and/or directories, recursively. Existing files will be overwritten. if (confirm) { const Glib::ustring uri = Glib::filename_to_uri(filename); App::instance().loader()->save_patch(_patch, uri); - _patch->set_property(uris.ingen_document, Atom(Atom::URI, uri.c_str())); + //_patch->set_property(uris.ingen_document, Atom(Atom::URI, uri.c_str())); _status_bar->push( (boost::format("Saved %1% to %2%") % _patch->path().chop_scheme() % filename).str(), diff --git a/src/gui/PatchWindow.hpp b/src/gui/PatchWindow.hpp index aef759d4..420359a0 100644 --- a/src/gui/PatchWindow.hpp +++ b/src/gui/PatchWindow.hpp @@ -59,13 +59,13 @@ public: Gtk::TextView* doc_textview() { return _doc_textview; } void set_patch_from_path(const Raul::Path& path, SharedPtr<PatchView> view); - void set_patch(SharedPtr<PatchModel> pc, SharedPtr<PatchView> view); + void set_patch(SharedPtr<const PatchModel> pc, SharedPtr<PatchView> view); - SharedPtr<PatchModel> patch() const { return _patch; } + SharedPtr<const PatchModel> patch() const { return _patch; } Gtk::MenuItem* menu_view_control_window() { return _menu_view_control_window; } - void show_port_status(PortModel* model, const Raul::Atom& value); + void show_port_status(const PortModel* model, const Raul::Atom& value); protected: void on_show(); @@ -73,11 +73,11 @@ protected: bool on_event(GdkEvent* event); private: - void patch_port_added(SharedPtr<PortModel> port); - void patch_port_removed(SharedPtr<PortModel> port); - void show_status(ObjectModel* model); - void object_entered(ObjectModel* model); - void object_left(ObjectModel* model); + void patch_port_added(SharedPtr<const PortModel> port); + void patch_port_removed(SharedPtr<const PortModel> port); + void show_status(const ObjectModel* model); + void object_entered(const ObjectModel* model); + void object_left(const ObjectModel* model); void editable_changed(bool editable); void event_import(); @@ -106,8 +106,8 @@ private: void event_show_engine(); void event_clipboard_changed(GdkEventOwnerChange* ev); - SharedPtr<PatchModel> _patch; - SharedPtr<PatchView> _view; + SharedPtr<const PatchModel> _patch; + SharedPtr<PatchView> _view; sigc::connection new_port_connection; sigc::connection removed_port_connection; diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index afb46f4d..0ebc3418 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -41,11 +41,10 @@ namespace GUI { ArtVpathDash* Port::_dash; SharedPtr<Port> -Port::create( - boost::shared_ptr<FlowCanvas::Module> module, - SharedPtr<PortModel> pm, - bool human_name, - bool flip) +Port::create(boost::shared_ptr<FlowCanvas::Module> module, + SharedPtr<const PortModel> pm, + bool human_name, + bool flip) { Glib::ustring label(human_name ? "" : pm->path().symbol()); if (human_name) { @@ -63,11 +62,10 @@ Port::create( /** @a flip Make an input port appear as an output port, and vice versa. */ -Port::Port( - boost::shared_ptr<FlowCanvas::Module> module, - SharedPtr<PortModel> pm, - const string& name, - bool flip) +Port::Port(boost::shared_ptr<FlowCanvas::Module> module, + SharedPtr<const PortModel> pm, + const string& name, + bool flip) : FlowCanvas::Port(module, name, flip ? (!pm->is_input()) : pm->is_input(), App::instance().configuration()->get_port_color(pm.get())) @@ -111,9 +109,9 @@ Port::~Port() void Port::update_metadata() { - SharedPtr<PortModel> pm = _port_model.lock(); + SharedPtr<const PortModel> pm = _port_model.lock(); if (App::instance().can_control(pm.get()) && pm->is_numeric()) { - boost::shared_ptr<NodeModel> parent = PtrCast<NodeModel>(pm->parent()); + boost::shared_ptr<const NodeModel> parent = PtrCast<const NodeModel>(pm->parent()); if (parent) { float min = 0.0f; float max = 1.0f; @@ -184,10 +182,10 @@ Port::set_control(float value, bool signal) app.engine()->set_property(model()->path(), world->uris()->ingen_value, Atom(value)); PatchWindow* pw = app.window_factory()->patch_window( - PtrCast<PatchModel>(model()->parent())); + PtrCast<const PatchModel>(model()->parent())); if (!pw) pw = app.window_factory()->patch_window( - PtrCast<PatchModel>(model()->parent()->parent())); + PtrCast<const PatchModel>(model()->parent()->parent())); if (pw) pw->show_port_status(model().get(), value); } @@ -225,7 +223,7 @@ ArtVpathDash* Port::dash() { const LV2URIMap& uris = App::instance().uris(); - SharedPtr<PortModel> pm = _port_model.lock(); + SharedPtr<const PortModel> pm = _port_model.lock(); if (!pm) return NULL; @@ -248,11 +246,11 @@ Port::set_selected(bool b) { if (b != selected()) { FlowCanvas::Port::set_selected(b); - SharedPtr<PortModel> pm = _port_model.lock(); + SharedPtr<const PortModel> pm = _port_model.lock(); if (pm && b) { - const App& app = App::instance(); - SharedPtr<NodeModel> node = PtrCast<NodeModel>(pm->parent()); - PatchWindow* win = app.window_factory()->parent_patch_window(node); + const App& app = App::instance(); + SharedPtr<const NodeModel> node = PtrCast<NodeModel>(pm->parent()); + PatchWindow* win = app.window_factory()->parent_patch_window(node); if (win) { const std::string& doc = node->plugin_model()->port_documentation( pm->index()); diff --git a/src/gui/Port.hpp b/src/gui/Port.hpp index 116f31d4..a84f9e69 100644 --- a/src/gui/Port.hpp +++ b/src/gui/Port.hpp @@ -42,13 +42,13 @@ class Port : public FlowCanvas::Port public: static SharedPtr<Port> create( boost::shared_ptr<FlowCanvas::Module> module, - SharedPtr<PortModel> pm, + SharedPtr<const PortModel> pm, bool human_name, bool flip=false); ~Port(); - SharedPtr<PortModel> model() const { return _port_model.lock(); } + SharedPtr<const PortModel> model() const { return _port_model.lock(); } void create_menu(); void update_metadata(); @@ -63,9 +63,9 @@ public: private: Port(boost::shared_ptr<FlowCanvas::Module> module, - SharedPtr<PortModel> pm, + SharedPtr<const PortModel> pm, const std::string& name, - bool flip=false); + bool flip = false); void property_changed(const Raul::URI& key, const Raul::Atom& value); @@ -74,9 +74,9 @@ private: static ArtVpathDash* _dash; - WeakPtr<PortModel> _port_model; - bool _pressed; - bool _flipped; + WeakPtr<const PortModel> _port_model; + bool _pressed; + bool _flipped; }; } // namespace GUI diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index 079e3c3e..7d1e765b 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -29,7 +29,8 @@ namespace Ingen { namespace GUI { -PortMenu::PortMenu(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml) +PortMenu::PortMenu(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& xml) : ObjectMenu(cobject, xml) , _patch_port(NULL) { @@ -40,7 +41,7 @@ PortMenu::PortMenu(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml } void -PortMenu::init(SharedPtr<PortModel> port, bool patch_port) +PortMenu::init(SharedPtr<const PortModel> port, bool patch_port) { ObjectMenu::init(port); _patch_port = patch_port; @@ -97,9 +98,9 @@ PortMenu::on_menu_disconnect() void PortMenu::on_menu_set_min() { - const LV2URIMap& uris = App::instance().uris(); - SharedPtr<PortModel> model = PtrCast<PortModel>(_object); - const Raul::Atom& value = model->get_property(uris.ingen_value); + const LV2URIMap& uris = App::instance().uris(); + SharedPtr<const PortModel> model = PtrCast<const PortModel>(_object); + const Raul::Atom& value = model->get_property(uris.ingen_value); if (value.is_valid()) App::instance().engine()->set_property(_object->path(), uris.lv2_minimum, value); } @@ -107,9 +108,9 @@ PortMenu::on_menu_set_min() void PortMenu::on_menu_set_max() { - const LV2URIMap& uris = App::instance().uris(); - SharedPtr<PortModel> model = PtrCast<PortModel>(_object); - const Raul::Atom& value = model->get_property(uris.ingen_value); + const LV2URIMap& uris = App::instance().uris(); + SharedPtr<const PortModel> model = PtrCast<const PortModel>(_object); + const Raul::Atom& value = model->get_property(uris.ingen_value); if (value.is_valid()) App::instance().engine()->set_property(_object->path(), uris.lv2_maximum, value); } @@ -117,9 +118,9 @@ PortMenu::on_menu_set_max() void PortMenu::on_menu_reset_range() { - const LV2URIMap& uris = App::instance().uris(); - SharedPtr<PortModel> model = PtrCast<PortModel>(_object); - SharedPtr<NodeModel> parent = PtrCast<NodeModel>(_object->parent()); + const LV2URIMap& uris = App::instance().uris(); + SharedPtr<const PortModel> model = PtrCast<const PortModel>(_object); + SharedPtr<const NodeModel> parent = PtrCast<const NodeModel>(_object->parent()); float min, max; parent->default_port_value_range(model, min, max); diff --git a/src/gui/PortMenu.hpp b/src/gui/PortMenu.hpp index 21c18560..2eec5e02 100644 --- a/src/gui/PortMenu.hpp +++ b/src/gui/PortMenu.hpp @@ -36,9 +36,10 @@ namespace GUI { class PortMenu : public ObjectMenu { public: - PortMenu(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml); + PortMenu(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& xml); - void init(SharedPtr<PortModel> port, bool patch_port = false); + void init(SharedPtr<const PortModel> port, bool patch_port=false); private: void on_menu_disconnect(); diff --git a/src/gui/PortPropertiesWindow.cpp b/src/gui/PortPropertiesWindow.cpp index 3258c480..2d317456 100644 --- a/src/gui/PortPropertiesWindow.cpp +++ b/src/gui/PortPropertiesWindow.cpp @@ -32,7 +32,8 @@ namespace Ingen { using namespace Client; namespace GUI { -PortPropertiesWindow::PortPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml) +PortPropertiesWindow::PortPropertiesWindow(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& xml) : Window(cobject) , _initial_min(0.0f) , _initial_max(1.0f) @@ -53,7 +54,7 @@ PortPropertiesWindow::PortPropertiesWindow(BaseObjectType* cobject, const Glib:: * This function MUST be called before using this object in any way. */ void -PortPropertiesWindow::present(SharedPtr<PortModel> pm) +PortPropertiesWindow::present(SharedPtr<const PortModel> pm) { assert(pm); diff --git a/src/gui/PortPropertiesWindow.hpp b/src/gui/PortPropertiesWindow.hpp index 05276434..3358e1fb 100644 --- a/src/gui/PortPropertiesWindow.hpp +++ b/src/gui/PortPropertiesWindow.hpp @@ -36,9 +36,10 @@ namespace GUI { class PortPropertiesWindow : public Window { public: - PortPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade); + PortPropertiesWindow(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& refGlade); - void present(SharedPtr<Client::PortModel> port_model); + void present(SharedPtr<const Client::PortModel> port_model); private: void property_changed(const Raul::URI& key, const Raul::Atom& value); @@ -51,12 +52,12 @@ private: float _initial_min; float _initial_max; - 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; + SharedPtr<const 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/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index 491a255e..26436022 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -32,7 +32,8 @@ using namespace Raul; namespace Ingen { namespace GUI { -PropertiesWindow::PropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml) +PropertiesWindow::PropertiesWindow(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml) : Window(cobject) { glade_xml->get_widget("properties_vbox", _vbox); @@ -74,11 +75,18 @@ PropertiesWindow::reset() _model.reset(); } +void +PropertiesWindow::present(SharedPtr<const ObjectModel> model) +{ + set_object(model); + Gtk::Window::present(); +} + /** Set the node this window is associated with. * This function MUST be called before using this object in any way. */ void -PropertiesWindow::set_object(SharedPtr<ObjectModel> model) +PropertiesWindow::set_object(SharedPtr<const ObjectModel> model) { reset(); _model = model; diff --git a/src/gui/PropertiesWindow.hpp b/src/gui/PropertiesWindow.hpp index 17968c89..cdde7495 100644 --- a/src/gui/PropertiesWindow.hpp +++ b/src/gui/PropertiesWindow.hpp @@ -38,10 +38,11 @@ namespace GUI { class PropertiesWindow : public Window { public: - PropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade); + PropertiesWindow(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& refGlade); - void present(SharedPtr<ObjectModel> model) { set_object(model); Gtk::Window::present(); } - void set_object(SharedPtr<ObjectModel> model); + void present(SharedPtr<const ObjectModel> model); + void set_object(SharedPtr<const ObjectModel> model); private: /** Record of a property (row in the table) */ @@ -83,14 +84,14 @@ private: TypeColumns _type_cols; Glib::RefPtr<Gtk::ListStore> _type_choices; - SharedPtr<ObjectModel> _model; - sigc::connection _property_connection; - Gtk::VBox* _vbox; - Gtk::ScrolledWindow* _scrolledwindow; - Gtk::Table* _table; - Gtk::Button* _cancel_button; - Gtk::Button* _apply_button; - Gtk::Button* _ok_button; + SharedPtr<const ObjectModel> _model; + sigc::connection _property_connection; + Gtk::VBox* _vbox; + Gtk::ScrolledWindow* _scrolledwindow; + Gtk::Table* _table; + Gtk::Button* _cancel_button; + Gtk::Button* _apply_button; + Gtk::Button* _ok_button; }; } // namespace GUI diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp index 7b8844f1..0ca8b7d0 100644 --- a/src/gui/RenameWindow.cpp +++ b/src/gui/RenameWindow.cpp @@ -30,7 +30,8 @@ using namespace Raul; namespace Ingen { namespace GUI { -RenameWindow::RenameWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml) +RenameWindow::RenameWindow(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml) : Window(cobject) { glade_xml->get_widget("rename_symbol_entry", _symbol_entry); @@ -39,10 +40,14 @@ RenameWindow::RenameWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Gl glade_xml->get_widget("rename_cancel_button", _cancel_button); glade_xml->get_widget("rename_ok_button", _ok_button); - _symbol_entry->signal_changed().connect(sigc::mem_fun(this, &RenameWindow::values_changed)); - _label_entry->signal_changed().connect(sigc::mem_fun(this, &RenameWindow::values_changed)); - _cancel_button->signal_clicked().connect(sigc::mem_fun(this, &RenameWindow::cancel_clicked)); - _ok_button->signal_clicked().connect(sigc::mem_fun(this, &RenameWindow::ok_clicked)); + _symbol_entry->signal_changed().connect( + sigc::mem_fun(this, &RenameWindow::values_changed)); + _label_entry->signal_changed().connect( + sigc::mem_fun(this, &RenameWindow::values_changed)); + _cancel_button->signal_clicked().connect( + sigc::mem_fun(this, &RenameWindow::cancel_clicked)); + _ok_button->signal_clicked().connect( + sigc::mem_fun(this, &RenameWindow::ok_clicked)); _ok_button->property_sensitive() = false; } @@ -51,7 +56,7 @@ RenameWindow::RenameWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Gl * This function MUST be called before using this object in any way. */ void -RenameWindow::set_object(SharedPtr<ObjectModel> object) +RenameWindow::set_object(SharedPtr<const ObjectModel> object) { _object = object; _symbol_entry->set_text(object->path().symbol()); @@ -61,7 +66,7 @@ RenameWindow::set_object(SharedPtr<ObjectModel> object) } void -RenameWindow::present(SharedPtr<ObjectModel> object) +RenameWindow::present(SharedPtr<const ObjectModel> object) { set_object(object); _symbol_entry->grab_focus(); @@ -79,7 +84,7 @@ RenameWindow::values_changed() } else if (!Path::is_valid_name(symbol)) { _message_label->set_text("Symbol contains invalid characters"); _ok_button->property_sensitive() = false; - } else if (App::instance().store()->object(_object->parent()->path().base() + symbol)) { + } else if (App::instance().store()->object(_object->parent()->path().child(symbol))) { _message_label->set_text("An object already exists with that path"); _ok_button->property_sensitive() = false; } else if (label.empty()) { diff --git a/src/gui/RenameWindow.hpp b/src/gui/RenameWindow.hpp index 756af189..ede09f4b 100644 --- a/src/gui/RenameWindow.hpp +++ b/src/gui/RenameWindow.hpp @@ -36,24 +36,25 @@ namespace GUI { class RenameWindow : public Window { public: - RenameWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade); + RenameWindow(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& refGlade); - void present(SharedPtr<ObjectModel> object); + void present(SharedPtr<const ObjectModel> object); private: - void set_object(SharedPtr<ObjectModel> object); + void set_object(SharedPtr<const ObjectModel> object); void values_changed(); void cancel_clicked(); void ok_clicked(); - SharedPtr<ObjectModel> _object; + SharedPtr<const ObjectModel> _object; - Gtk::Entry* _symbol_entry; - Gtk::Entry* _label_entry; - Gtk::Label* _message_label; - Gtk::Button* _cancel_button; - Gtk::Button* _ok_button; + Gtk::Entry* _symbol_entry; + Gtk::Entry* _label_entry; + Gtk::Label* _message_label; + Gtk::Button* _cancel_button; + Gtk::Button* _ok_button; }; } // namespace GUI diff --git a/src/gui/SubpatchModule.cpp b/src/gui/SubpatchModule.cpp index e2347bdd..b0f43fa7 100644 --- a/src/gui/SubpatchModule.cpp +++ b/src/gui/SubpatchModule.cpp @@ -30,7 +30,8 @@ namespace Ingen { namespace GUI { -SubpatchModule::SubpatchModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<PatchModel> patch) +SubpatchModule::SubpatchModule(boost::shared_ptr<PatchCanvas> canvas, + SharedPtr<const PatchModel> patch) : NodeModule(canvas, patch) , _patch(patch) { diff --git a/src/gui/SubpatchModule.hpp b/src/gui/SubpatchModule.hpp index e5fb87c9..7eba97a2 100644 --- a/src/gui/SubpatchModule.hpp +++ b/src/gui/SubpatchModule.hpp @@ -46,7 +46,8 @@ class NodeControlWindow; class SubpatchModule : public NodeModule { public: - SubpatchModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<PatchModel> controller); + SubpatchModule(boost::shared_ptr<PatchCanvas> canvas, + SharedPtr<const PatchModel> controller); virtual ~SubpatchModule() {} void on_double_click(GdkEventButton* ev); @@ -54,10 +55,10 @@ public: void browse_to_patch(); void menu_remove(); - SharedPtr<PatchModel> patch() { return _patch; } + SharedPtr<const PatchModel> patch() const { return _patch; } protected: - SharedPtr<PatchModel> _patch; + SharedPtr<const PatchModel> _patch; }; } // namespace GUI diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp index 7a7a3ede..31f77893 100644 --- a/src/gui/ThreadedLoader.cpp +++ b/src/gui/ThreadedLoader.cpp @@ -101,7 +101,8 @@ ThreadedLoader::load_patch(bool merge, } void -ThreadedLoader::save_patch(SharedPtr<PatchModel> model, const string& filename) +ThreadedLoader::save_patch(SharedPtr<const PatchModel> model, + const string& filename) { _mutex.lock(); @@ -115,7 +116,8 @@ ThreadedLoader::save_patch(SharedPtr<PatchModel> model, const string& filename) } void -ThreadedLoader::save_patch_event(SharedPtr<PatchModel> model, const string& filename) +ThreadedLoader::save_patch_event(SharedPtr<const PatchModel> model, + const string& filename) { if (App::instance().serialiser()) { if (filename.find(INGEN_BUNDLE_EXT) != string::npos) diff --git a/src/gui/ThreadedLoader.hpp b/src/gui/ThreadedLoader.hpp index c35da81f..41f56340 100644 --- a/src/gui/ThreadedLoader.hpp +++ b/src/gui/ThreadedLoader.hpp @@ -62,13 +62,12 @@ public: optional<Raul::Symbol> engine_symbol, optional<GraphObject::Properties> engine_data); - void save_patch(SharedPtr<PatchModel> model, const string& filename); + void save_patch(SharedPtr<const PatchModel> model, const string& filename); SharedPtr<Parser> parser(); private: - - void save_patch_event(SharedPtr<PatchModel> model, const string& filename); + void save_patch_event(SharedPtr<const PatchModel> model, const string& filename); /** Returns nothing and takes no parameters (because they have all been bound) */ typedef sigc::slot<void> Closure; diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp index c0f53ee7..56f4dd74 100644 --- a/src/gui/WindowFactory.cpp +++ b/src/gui/WindowFactory.cpp @@ -63,10 +63,12 @@ WindowFactory::WindowFactory() WindowFactory::~WindowFactory() { - for (PatchWindowMap::iterator i = _patch_windows.begin(); i != _patch_windows.end(); ++i) + for (PatchWindowMap::iterator i = _patch_windows.begin(); + i != _patch_windows.end(); ++i) delete i->second; - for (ControlWindowMap::iterator i = _control_windows.begin(); i != _control_windows.end(); ++i) + for (ControlWindowMap::iterator i = _control_windows.begin(); + i != _control_windows.end(); ++i) delete i->second; } @@ -74,12 +76,14 @@ WindowFactory::~WindowFactory() void WindowFactory::clear() { - for (PatchWindowMap::iterator i = _patch_windows.begin(); i != _patch_windows.end(); ++i) + for (PatchWindowMap::iterator i = _patch_windows.begin(); + i != _patch_windows.end(); ++i) delete i->second; _patch_windows.clear(); - for (ControlWindowMap::iterator i = _control_windows.begin(); i != _control_windows.end(); ++i) + for (ControlWindowMap::iterator i = _control_windows.begin(); + i != _control_windows.end(); ++i) delete i->second; _control_windows.clear(); @@ -91,7 +95,8 @@ size_t WindowFactory::num_open_patch_windows() { size_t ret = 0; - for (PatchWindowMap::iterator i = _patch_windows.begin(); i != _patch_windows.end(); ++i) + for (PatchWindowMap::iterator i = _patch_windows.begin(); + i != _patch_windows.end(); ++i) if (i->second->is_visible()) ++ret; @@ -99,7 +104,7 @@ WindowFactory::num_open_patch_windows() } PatchWindow* -WindowFactory::patch_window(SharedPtr<PatchModel> patch) +WindowFactory::patch_window(SharedPtr<const PatchModel> patch) { if (!patch) return NULL; @@ -110,7 +115,7 @@ WindowFactory::patch_window(SharedPtr<PatchModel> patch) } PatchWindow* -WindowFactory::parent_patch_window(SharedPtr<NodeModel> node) +WindowFactory::parent_patch_window(SharedPtr<const NodeModel> node) { if (!node) return NULL; @@ -119,7 +124,7 @@ WindowFactory::parent_patch_window(SharedPtr<NodeModel> node) } NodeControlWindow* -WindowFactory::control_window(SharedPtr<NodeModel> node) +WindowFactory::control_window(SharedPtr<const NodeModel> node) { ControlWindowMap::iterator w = _control_windows.find(node->path()); @@ -129,11 +134,13 @@ WindowFactory::control_window(SharedPtr<NodeModel> node) /** Present a PatchWindow for a Patch. * * If @a preferred is not NULL, it will be set to display @a patch if the patch - * does not already have a visible window, otherwise that window will be presented and - * @a preferred left unmodified. + * does not already have a visible window, otherwise that window will be + * presented and @a preferred left unmodified. */ void -WindowFactory::present_patch(SharedPtr<PatchModel> patch, PatchWindow* preferred, SharedPtr<PatchView> view) +WindowFactory::present_patch(SharedPtr<const PatchModel> patch, + PatchWindow* preferred, + SharedPtr<PatchView> view) { assert( !view || view->patch() == patch); @@ -157,7 +164,8 @@ WindowFactory::present_patch(SharedPtr<PatchModel> patch, PatchWindow* preferred } PatchWindow* -WindowFactory::new_patch_window(SharedPtr<PatchModel> patch, SharedPtr<PatchView> view) +WindowFactory::new_patch_window(SharedPtr<const PatchModel> patch, + SharedPtr<PatchView> view) { assert( !view || view->patch() == patch); @@ -193,7 +201,7 @@ WindowFactory::remove_patch_window(PatchWindow* win, GdkEventAny* ignored) } void -WindowFactory::present_controls(SharedPtr<NodeModel> node) +WindowFactory::present_controls(SharedPtr<const NodeModel> node) { NodeControlWindow* win = control_window(node); @@ -206,7 +214,7 @@ WindowFactory::present_controls(SharedPtr<NodeModel> node) } NodeControlWindow* -WindowFactory::new_control_window(SharedPtr<NodeModel> node) +WindowFactory::new_control_window(SharedPtr<const NodeModel> node) { uint32_t poly = 1; if (node->polyphonic() && node->parent()) @@ -236,7 +244,8 @@ WindowFactory::remove_control_window(NodeControlWindow* win, GdkEventAny* ignore } void -WindowFactory::present_load_plugin(SharedPtr<PatchModel> patch, GraphObject::Properties data) +WindowFactory::present_load_plugin(SharedPtr<const PatchModel> patch, + GraphObject::Properties data) { PatchWindowMap::iterator w = _patch_windows.find(patch->path()); @@ -248,12 +257,14 @@ WindowFactory::present_load_plugin(SharedPtr<PatchModel> patch, GraphObject::Pro int width, height; w->second->get_size(width, height); _load_plugin_win->set_default_size(width - width / 8, height / 2); - _load_plugin_win->set_title(string("Load Plugin - ") + patch->path().chop_scheme() + " - Ingen"); + _load_plugin_win->set_title( + string("Load Plugin - ") + patch->path().chop_scheme() + " - Ingen"); _load_plugin_win->present(patch, data); } void -WindowFactory::present_load_patch(SharedPtr<PatchModel> patch, GraphObject::Properties data) +WindowFactory::present_load_patch(SharedPtr<const PatchModel> patch, + GraphObject::Properties data) { PatchWindowMap::iterator w = _patch_windows.find(patch->path()); @@ -264,7 +275,8 @@ WindowFactory::present_load_patch(SharedPtr<PatchModel> patch, GraphObject::Prop } void -WindowFactory::present_load_subpatch(SharedPtr<PatchModel> patch, GraphObject::Properties data) +WindowFactory::present_load_subpatch(SharedPtr<const PatchModel> patch, + GraphObject::Properties data) { PatchWindowMap::iterator w = _patch_windows.find(patch->path()); @@ -275,7 +287,8 @@ WindowFactory::present_load_subpatch(SharedPtr<PatchModel> patch, GraphObject::P } void -WindowFactory::present_load_remote_patch(SharedPtr<PatchModel> patch, GraphObject::Properties data) +WindowFactory::present_load_remote_patch(SharedPtr<const PatchModel> patch, + GraphObject::Properties data) { PatchWindowMap::iterator w = _patch_windows.find(patch->path()); @@ -286,7 +299,7 @@ WindowFactory::present_load_remote_patch(SharedPtr<PatchModel> patch, GraphObjec } void -WindowFactory::present_upload_patch(SharedPtr<PatchModel> patch) +WindowFactory::present_upload_patch(SharedPtr<const PatchModel> patch) { #ifdef HAVE_CURL PatchWindowMap::iterator w = _patch_windows.find(patch->path()); @@ -299,7 +312,8 @@ WindowFactory::present_upload_patch(SharedPtr<PatchModel> patch) } void -WindowFactory::present_new_subpatch(SharedPtr<PatchModel> patch, GraphObject::Properties data) +WindowFactory::present_new_subpatch(SharedPtr<const PatchModel> patch, + GraphObject::Properties data) { PatchWindowMap::iterator w = _patch_windows.find(patch->path()); @@ -310,7 +324,7 @@ WindowFactory::present_new_subpatch(SharedPtr<PatchModel> patch, GraphObject::Pr } void -WindowFactory::present_rename(SharedPtr<ObjectModel> object) +WindowFactory::present_rename(SharedPtr<const ObjectModel> object) { PatchWindowMap::iterator w = _patch_windows.find(object->path()); if (w == _patch_windows.end()) @@ -323,7 +337,7 @@ WindowFactory::present_rename(SharedPtr<ObjectModel> object) } void -WindowFactory::present_properties(SharedPtr<ObjectModel> object) +WindowFactory::present_properties(SharedPtr<const ObjectModel> object) { PatchWindowMap::iterator w = _patch_windows.find(object->path()); if (w == _patch_windows.end()) diff --git a/src/gui/WindowFactory.hpp b/src/gui/WindowFactory.hpp index d07c7dba..46445ffb 100644 --- a/src/gui/WindowFactory.hpp +++ b/src/gui/WindowFactory.hpp @@ -60,26 +60,26 @@ public: size_t num_open_patch_windows(); - PatchWindow* patch_window(SharedPtr<PatchModel> patch); - PatchWindow* parent_patch_window(SharedPtr<NodeModel> node); - NodeControlWindow* control_window(SharedPtr<NodeModel> node); + PatchWindow* patch_window(SharedPtr<const PatchModel> patch); + PatchWindow* parent_patch_window(SharedPtr<const NodeModel> node); + NodeControlWindow* control_window(SharedPtr<const NodeModel> node); - void present_patch(SharedPtr<PatchModel> model, + void present_patch(SharedPtr<const PatchModel> model, PatchWindow* preferred = NULL, SharedPtr<PatchView> view = SharedPtr<PatchView>()); - void present_controls(SharedPtr<NodeModel> node); + void present_controls(SharedPtr<const NodeModel> node); typedef GraphObject::Properties Properties; - void present_load_plugin(SharedPtr<PatchModel> patch, Properties data=Properties()); - void present_load_patch(SharedPtr<PatchModel> patch, Properties data=Properties()); - void present_load_subpatch(SharedPtr<PatchModel> patch, Properties data=Properties()); - void present_load_remote_patch(SharedPtr<PatchModel> patch, Properties data=Properties()); - void present_upload_patch(SharedPtr<PatchModel> patch); - void present_new_subpatch(SharedPtr<PatchModel> patch, Properties data=Properties()); - void present_rename(SharedPtr<ObjectModel> object); - void present_properties(SharedPtr<ObjectModel> object); + void present_load_plugin(SharedPtr<const PatchModel> patch, Properties data=Properties()); + void present_load_patch(SharedPtr<const PatchModel> patch, Properties data=Properties()); + void present_load_subpatch(SharedPtr<const PatchModel> patch, Properties data=Properties()); + void present_load_remote_patch(SharedPtr<const PatchModel> patch, Properties data=Properties()); + void present_upload_patch(SharedPtr<const PatchModel> patch); + void present_new_subpatch(SharedPtr<const PatchModel> patch, Properties data=Properties()); + void present_rename(SharedPtr<const ObjectModel> object); + void present_properties(SharedPtr<const ObjectModel> object); bool remove_patch_window(PatchWindow* win, GdkEventAny* ignored = NULL); @@ -89,10 +89,12 @@ private: typedef std::map<Raul::Path, PatchWindow*> PatchWindowMap; typedef std::map<Raul::Path, NodeControlWindow*> ControlWindowMap; - PatchWindow* new_patch_window(SharedPtr<PatchModel> patch, SharedPtr<PatchView> view); + PatchWindow* new_patch_window(SharedPtr<const PatchModel> patch, + SharedPtr<PatchView> view); - NodeControlWindow* new_control_window(SharedPtr<NodeModel> node); - bool remove_control_window(NodeControlWindow* win, GdkEventAny* ignored); + NodeControlWindow* new_control_window(SharedPtr<const NodeModel> node); + bool remove_control_window(NodeControlWindow* win, + GdkEventAny* ignored); PatchWindowMap _patch_windows; ControlWindowMap _control_windows; diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index 04b4c692..b7a16d4b 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -76,8 +76,8 @@ Serialiser::Serialiser(Shared::World& world, SharedPtr<Shared::Store> store) } void -Serialiser::to_file(SharedPtr<GraphObject> object, - const std::string& filename) +Serialiser::to_file(SharedPtr<const GraphObject> object, + const std::string& filename) { _root_path = object->path(); start_to_filename(filename); @@ -95,9 +95,9 @@ uri_to_symbol(const std::string& uri) } void -Serialiser::write_manifest(const std::string& bundle_path, - SharedPtr<Patch> patch, - const std::string& patch_symbol) +Serialiser::write_manifest(const std::string& bundle_path, + SharedPtr<const Patch> patch, + const std::string& patch_symbol) { const string manifest_path(Glib::build_filename(bundle_path, "manifest.ttl")); const string binary_path(Glib::Module::build_path("", "ingen_lv2")); @@ -146,8 +146,8 @@ normal_bundle_uri(const std::string& uri) } void -Serialiser::write_bundle(SharedPtr<Patch> patch, - const std::string& uri) +Serialiser::write_bundle(SharedPtr<const Patch> patch, + const std::string& uri) { Glib::ustring path = ""; try { @@ -181,7 +181,7 @@ Serialiser::write_bundle(SharedPtr<Patch> patch, } string -Serialiser::to_string(SharedPtr<GraphObject> object, +Serialiser::to_string(SharedPtr<const GraphObject> object, const string& base_uri, const GraphObject::Properties& extra_rdf) { @@ -272,26 +272,26 @@ Serialiser::path_rdf_node(const Path& path) } void -Serialiser::serialise(SharedPtr<GraphObject> object) throw (std::logic_error) +Serialiser::serialise(SharedPtr<const GraphObject> object) throw (std::logic_error) { if (!_model) throw std::logic_error("serialise called without serialization in progress"); - SharedPtr<Patch> patch = PtrCast<Patch>(object); + SharedPtr<const Patch> patch = PtrCast<const Patch>(object); if (patch) { const Sord::URI patch_id(_model->world(), ""); serialise_patch(patch, patch_id); return; } - SharedPtr<Node> node = PtrCast<Node>(object); + SharedPtr<const Node> node = PtrCast<const Node>(object); if (node) { const Sord::URI plugin_id(_model->world(), node->plugin()->uri().str()); serialise_node(node, plugin_id, path_rdf_node(node->path())); return; } - SharedPtr<Port> port = PtrCast<Port>(object); + SharedPtr<const Port> port = PtrCast<const Port>(object); if (port) { serialise_port(port.get(), Resource::DEFAULT, path_rdf_node(port->path())); return; @@ -302,7 +302,7 @@ Serialiser::serialise(SharedPtr<GraphObject> object) throw (std::logic_error) } void -Serialiser::serialise_patch(SharedPtr<Patch> patch, const Sord::Node& patch_id) +Serialiser::serialise_patch(SharedPtr<const Patch> patch, const Sord::Node& patch_id) { assert(_model); Sord::World& world = _model->world(); @@ -412,9 +412,9 @@ Serialiser::serialise_patch(SharedPtr<Patch> patch, const Sord::Node& patch_id) } void -Serialiser::serialise_node(SharedPtr<Node> node, - const Sord::Node& class_id, - const Sord::Node& node_id) +Serialiser::serialise_node(SharedPtr<const Node> node, + const Sord::Node& class_id, + const Sord::Node& node_id) { _model->add_statement(node_id, Sord::Curie(_model->world(), "rdf:type"), @@ -491,7 +491,7 @@ Serialiser::serialise_port(const Port* port, void Serialiser::serialise_connection(const Sord::Node& parent, - SharedPtr<Connection> connection) throw (std::logic_error) + SharedPtr<const Connection> connection) throw (std::logic_error) { Sord::World& world = _model->world(); diff --git a/src/serialisation/Serialiser.hpp b/src/serialisation/Serialiser.hpp index fc26c387..fdc7b423 100644 --- a/src/serialisation/Serialiser.hpp +++ b/src/serialisation/Serialiser.hpp @@ -56,23 +56,23 @@ public: typedef GraphObject::Properties Properties; - void to_file(SharedPtr<GraphObject> object, - const std::string& filename); + void to_file(SharedPtr<const GraphObject> object, + const std::string& filename); - void write_bundle(SharedPtr<Patch> patch, - const std::string& uri); + void write_bundle(SharedPtr<const Patch> patch, + const std::string& uri); - std::string to_string(SharedPtr<GraphObject> object, - const std::string& base_uri, - const Properties& extra_rdf); + std::string to_string(SharedPtr<const GraphObject> object, + const std::string& base_uri, + const Properties& extra_rdf); void start_to_string(const Raul::Path& root, const std::string& base_uri); - void serialise(SharedPtr<GraphObject> object) throw (std::logic_error); + void serialise(SharedPtr<const GraphObject> object) throw (std::logic_error); - void serialise_connection(const Sord::Node& parent, - SharedPtr<Connection> c) throw (std::logic_error); + void serialise_connection(const Sord::Node& parent, + SharedPtr<const Connection> c) throw (std::logic_error); std::string finish(); @@ -81,12 +81,12 @@ private: void start_to_filename(const std::string& filename); - void serialise_patch(SharedPtr<Patch> p, - const Sord::Node& id); + void serialise_patch(SharedPtr<const Patch> p, + const Sord::Node& id); - void serialise_node(SharedPtr<Node> n, - const Sord::Node& class_id, - const Sord::Node& id); + void serialise_node(SharedPtr<const Node> n, + const Sord::Node& class_id, + const Sord::Node& id); void serialise_port(const Port* p, Resource::Graph context, @@ -98,9 +98,9 @@ private: Sord::Node path_rdf_node(const Raul::Path& path); - void write_manifest(const std::string& bundle_path, - SharedPtr<Patch> patch, - const std::string& patch_symbol); + void write_manifest(const std::string& bundle_path, + SharedPtr<const Patch> patch, + const std::string& patch_symbol); Raul::Path _root_path; SharedPtr<Shared::Store> _store; diff --git a/src/server/LV2RequestRunFeature.hpp b/src/server/LV2RequestRunFeature.hpp index 88010bb9..e1af0aca 100644 --- a/src/server/LV2RequestRunFeature.hpp +++ b/src/server/LV2RequestRunFeature.hpp @@ -61,7 +61,7 @@ struct RequestRunFeature : public Ingen::Shared::LV2Features::Feature { } SharedPtr<LV2_Feature> feature(Shared::World* world, Node* n) { - NodeImpl* node = dynamic_cast<NodeImpl*>(n); + const NodeImpl* node = dynamic_cast<const NodeImpl*>(n); if (!node) return SharedPtr<LV2_Feature>(); diff --git a/src/shared/Store.cpp b/src/shared/Store.cpp index 9d5639b1..62c7f824 100644 --- a/src/shared/Store.cpp +++ b/src/shared/Store.cpp @@ -48,7 +48,7 @@ Store::add(GraphObject* o) } Store::const_iterator -Store::children_begin(SharedPtr<GraphObject> o) const +Store::children_begin(SharedPtr<const GraphObject> o) const { const_iterator parent = find(o->path()); assert(parent != end()); @@ -57,7 +57,7 @@ Store::children_begin(SharedPtr<GraphObject> o) const } Store::const_iterator -Store::children_end(SharedPtr<GraphObject> o) const +Store::children_end(SharedPtr<const GraphObject> o) const { const_iterator parent = find(o->path()); assert(parent != end()); @@ -65,7 +65,8 @@ Store::children_end(SharedPtr<GraphObject> o) const } SharedPtr<GraphObject> -Store::find_child(SharedPtr<GraphObject> parent, const string& child_name) const +Store::find_child(SharedPtr<const GraphObject> parent, + const string& child_name) const { const_iterator pi = find(parent->path()); assert(pi != end()); diff --git a/src/shared/Store.hpp b/src/shared/Store.hpp index 53f4ecf2..997305a1 100644 --- a/src/shared/Store.hpp +++ b/src/shared/Store.hpp @@ -34,11 +34,11 @@ public: typedef Raul::Table< Raul::Path, SharedPtr<GraphObject> > Objects; - const_iterator children_begin(SharedPtr<GraphObject> o) const; - const_iterator children_end(SharedPtr<GraphObject> o) const; + const_iterator children_begin(SharedPtr<const GraphObject> o) const; + const_iterator children_end(SharedPtr<const GraphObject> o) const; - SharedPtr<GraphObject> find_child(SharedPtr<GraphObject> parent, - const std::string& child_name) const; + SharedPtr<GraphObject> find_child(SharedPtr<const GraphObject> parent, + const std::string& child_name) const; unsigned child_name_offset(const Raul::Path& parent, const Raul::Symbol& symbol, |