From 317627ef40f7654c298aa1ac707851c852259e3a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 18 Aug 2012 23:05:06 +0000 Subject: Node => Block git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4720 a436a847-0d15-0410-975c-d299462d15a1 --- ingen/client/BlockModel.hpp | 112 +++++++++++++++++++++++++++++++++++++++++++ ingen/client/ClientStore.hpp | 2 +- ingen/client/NodeModel.hpp | 112 ------------------------------------------- ingen/client/ObjectModel.hpp | 2 +- ingen/client/PatchModel.hpp | 10 ++-- ingen/client/PluginModel.hpp | 8 ++-- ingen/client/PluginUI.hpp | 28 +++++------ 7 files changed, 137 insertions(+), 137 deletions(-) create mode 100644 ingen/client/BlockModel.hpp delete mode 100644 ingen/client/NodeModel.hpp (limited to 'ingen/client') diff --git a/ingen/client/BlockModel.hpp b/ingen/client/BlockModel.hpp new file mode 100644 index 00000000..dbb0faf3 --- /dev/null +++ b/ingen/client/BlockModel.hpp @@ -0,0 +1,112 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_CLIENT_BLOCKMODEL_HPP +#define INGEN_CLIENT_BLOCKMODEL_HPP + +#include +#include +#include + +#include "raul/SharedPtr.hpp" +#include "ingen/GraphObject.hpp" +#include "ingen/client/ObjectModel.hpp" +#include "ingen/client/PortModel.hpp" +#include "ingen/client/PluginModel.hpp" + +namespace Raul { class Path; } + +namespace Ingen { + +class URIs; + +namespace Client { + +class PluginModel; +class ClientStore; + +/** Block model class, used by the client to store engine's state. + * + * @ingroup IngenClient + */ +class BlockModel : public ObjectModel +{ +public: + BlockModel(const BlockModel& copy); + virtual ~BlockModel(); + + GraphType graph_type() const { return GraphObject::PATCH; } + + typedef std::vector< SharedPtr > Ports; + + SharedPtr get_port(const Raul::Symbol& symbol) const; + + GraphObject* port(uint32_t index) const; + + const Raul::URI& plugin_uri() const { return _plugin_uri; } + const Plugin* plugin() const { return _plugin.get(); } + Plugin* plugin() { return _plugin.get(); } + SharedPtr plugin_model() const { return _plugin; } + uint32_t num_ports() const { return _ports.size(); } + const Ports& ports() const { return _ports; } + + void default_port_value_range(SharedPtr port, + float& min, float& max, uint32_t srate=1) const; + + void port_value_range(SharedPtr port, + float& min, float& max, uint32_t srate=1) const; + + std::string label() const; + std::string port_label(SharedPtr port) const; + + // Signals + INGEN_SIGNAL(new_port, void, SharedPtr); + INGEN_SIGNAL(removed_port, void, SharedPtr); + +protected: + friend class ClientStore; + + BlockModel(URIs& uris, + const Raul::URI& plugin_uri, + const Raul::Path& path); + BlockModel(URIs& uris, + SharedPtr plugin, + const Raul::Path& path); + explicit BlockModel(const Raul::Path& path); + + void add_child(SharedPtr c); + bool remove_child(SharedPtr c); + void add_port(SharedPtr pm); + void remove_port(SharedPtr pm); + void remove_port(const Raul::Path& port_path); + void set(SharedPtr model); + + virtual void clear(); + + Ports _ports; ///< Vector of ports + Raul::URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown) + SharedPtr _plugin; ///< The plugin this block is an instance of + +private: + mutable uint32_t _num_values; ///< Size of _min_values and _max_values + mutable float* _min_values; ///< Port min values (cached for LV2) + mutable float* _max_values; ///< Port max values (cached for LV2) +}; + +} // namespace Client +} // namespace Ingen + +#endif // INGEN_CLIENT_BLOCKMODEL_HPP diff --git a/ingen/client/ClientStore.hpp b/ingen/client/ClientStore.hpp index 42519158..6da7310e 100644 --- a/ingen/client/ClientStore.hpp +++ b/ingen/client/ClientStore.hpp @@ -37,7 +37,7 @@ class URIs; namespace Client { -class NodeModel; +class BlockModel; class ObjectModel; class PatchModel; class PluginModel; diff --git a/ingen/client/NodeModel.hpp b/ingen/client/NodeModel.hpp deleted file mode 100644 index 9f2fab6e..00000000 --- a/ingen/client/NodeModel.hpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2012 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#ifndef INGEN_CLIENT_NODEMODEL_HPP -#define INGEN_CLIENT_NODEMODEL_HPP - -#include -#include -#include - -#include "raul/SharedPtr.hpp" -#include "ingen/GraphObject.hpp" -#include "ingen/client/ObjectModel.hpp" -#include "ingen/client/PortModel.hpp" -#include "ingen/client/PluginModel.hpp" - -namespace Raul { class Path; } - -namespace Ingen { - -class URIs; - -namespace Client { - -class PluginModel; -class ClientStore; - -/** Node model class, used by the client to store engine's state. - * - * @ingroup IngenClient - */ -class NodeModel : public ObjectModel -{ -public: - NodeModel(const NodeModel& copy); - virtual ~NodeModel(); - - GraphType graph_type() const { return GraphObject::PATCH; } - - typedef std::vector< SharedPtr > Ports; - - SharedPtr get_port(const Raul::Symbol& symbol) const; - - GraphObject* port(uint32_t index) const; - - const Raul::URI& plugin_uri() const { return _plugin_uri; } - const Plugin* plugin() const { return _plugin.get(); } - Plugin* plugin() { return _plugin.get(); } - SharedPtr plugin_model() const { return _plugin; } - uint32_t num_ports() const { return _ports.size(); } - const Ports& ports() const { return _ports; } - - void default_port_value_range(SharedPtr port, - float& min, float& max, uint32_t srate=1) const; - - void port_value_range(SharedPtr port, - float& min, float& max, uint32_t srate=1) const; - - std::string label() const; - std::string port_label(SharedPtr port) const; - - // Signals - INGEN_SIGNAL(new_port, void, SharedPtr); - INGEN_SIGNAL(removed_port, void, SharedPtr); - -protected: - friend class ClientStore; - - NodeModel(URIs& uris, - const Raul::URI& plugin_uri, - const Raul::Path& path); - NodeModel(URIs& uris, - SharedPtr plugin, - const Raul::Path& path); - explicit NodeModel(const Raul::Path& path); - - void add_child(SharedPtr c); - bool remove_child(SharedPtr c); - void add_port(SharedPtr pm); - void remove_port(SharedPtr pm); - void remove_port(const Raul::Path& port_path); - void set(SharedPtr model); - - virtual void clear(); - - Ports _ports; ///< Vector of ports - Raul::URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown) - SharedPtr _plugin; ///< The plugin this node is an instance of - -private: - mutable uint32_t _num_values; ///< Size of _min_values and _max_values - mutable float* _min_values; ///< Port min values (cached for LV2) - mutable float* _max_values; ///< Port max values (cached for LV2) -}; - -} // namespace Client -} // namespace Ingen - -#endif // INGEN_CLIENT_NODEMODEL_HPP diff --git a/ingen/client/ObjectModel.hpp b/ingen/client/ObjectModel.hpp index 69ad3e22..b51e82e6 100644 --- a/ingen/client/ObjectModel.hpp +++ b/ingen/client/ObjectModel.hpp @@ -41,7 +41,7 @@ namespace Client { class ClientStore; -/** Base class for all GraphObject models (NodeModel, PatchModel, PortModel). +/** Base class for all GraphObject models (BlockModel, PatchModel, PortModel). * * There are no non-const public methods intentionally, models are not allowed * to be manipulated directly by anything (but the Store) because of the diff --git a/ingen/client/PatchModel.hpp b/ingen/client/PatchModel.hpp index d4c8f511..b4f56799 100644 --- a/ingen/client/PatchModel.hpp +++ b/ingen/client/PatchModel.hpp @@ -17,7 +17,7 @@ #ifndef INGEN_CLIENT_PATCHMODEL_HPP #define INGEN_CLIENT_PATCHMODEL_HPP -#include "ingen/client/NodeModel.hpp" +#include "ingen/client/BlockModel.hpp" #include "raul/SharedPtr.hpp" namespace Ingen { @@ -30,7 +30,7 @@ class EdgeModel; * * @ingroup IngenClient */ -class PatchModel : public NodeModel +class PatchModel : public BlockModel { public: /* WARNING: Copy constructor creates a shallow copy WRT connections */ @@ -45,8 +45,8 @@ public: uint32_t internal_poly() const; // Signals - INGEN_SIGNAL(new_node, void, SharedPtr); - INGEN_SIGNAL(removed_node, void, SharedPtr); + INGEN_SIGNAL(new_block, void, SharedPtr); + INGEN_SIGNAL(removed_block, void, SharedPtr); INGEN_SIGNAL(new_edge, void, SharedPtr); INGEN_SIGNAL(removed_edge, void, SharedPtr); @@ -54,7 +54,7 @@ private: friend class ClientStore; PatchModel(URIs& uris, const Raul::Path& patch_path) - : NodeModel( + : BlockModel( uris, Raul::URI("http://drobilla.net/ns/ingen#Patch"), patch_path) { } diff --git a/ingen/client/PluginModel.hpp b/ingen/client/PluginModel.hpp index 13375c95..7475e57a 100644 --- a/ingen/client/PluginModel.hpp +++ b/ingen/client/PluginModel.hpp @@ -38,7 +38,7 @@ class URIs; namespace Client { class PatchModel; -class NodeModel; +class BlockModel; class PluginUI; /** Model for a plugin available for loading. @@ -57,7 +57,7 @@ public: virtual const Raul::Atom& get_property(const Raul::URI& key) const; - Raul::Symbol default_node_symbol() const; + Raul::Symbol default_block_symbol() const; std::string human_name() const; std::string port_human_name(uint32_t index) const; @@ -74,8 +74,8 @@ public: bool has_ui() const; - SharedPtr ui(Ingen::World* world, - SharedPtr node) const; + SharedPtr ui(Ingen::World* world, + SharedPtr block) const; const std::string& icon_path() const; static std::string get_lv2_icon_path(const LilvPlugin* plugin); diff --git a/ingen/client/PluginUI.hpp b/ingen/client/PluginUI.hpp index 1c45bd56..60403570 100644 --- a/ingen/client/PluginUI.hpp +++ b/ingen/client/PluginUI.hpp @@ -32,7 +32,7 @@ class World; namespace Client { -class NodeModel; +class BlockModel; /** Model for a plugin available for loading. * @@ -42,9 +42,9 @@ class PluginUI { public: ~PluginUI(); - static SharedPtr create(Ingen::World* world, - SharedPtr node, - const LilvPlugin* plugin); + static SharedPtr create(Ingen::World* world, + SharedPtr block, + const LilvPlugin* plugin); SuilWidget get_widget(); @@ -55,18 +55,18 @@ public: bool is_resizable() const; - Ingen::World* world() const { return _world; } - SharedPtr node() const { return _node; } + Ingen::World* world() const { return _world; } + SharedPtr block() const { return _block; } private: - PluginUI(Ingen::World* world, - SharedPtr node, - const LilvNode* ui_node); - - Ingen::World* _world; - SharedPtr _node; - SuilInstance* _instance; - LilvNode* _ui_node; + PluginUI(Ingen::World* world, + SharedPtr block, + const LilvNode* ui_node); + + Ingen::World* _world; + SharedPtr _block; + SuilInstance* _instance; + LilvNode* _ui_node; static SuilHost* ui_host; -- cgit v1.2.1