From 23d74f838521320dc1682426341d1874061337a6 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 26 Jul 2007 22:18:33 +0000 Subject: Make canvas grab events. Remove silly ctrl+click zoom event grabs. Add concept of "edit mode", old behaviour = edit mode, edit mode off = no connections or module moving. git-svn-id: http://svn.drobilla.net/lad/ingen@641 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/NodeModel.cpp | 16 --------- src/libs/client/NodeModel.hpp | 3 -- src/libs/client/PatchModel.cpp | 78 ------------------------------------------ src/libs/client/PatchModel.hpp | 17 ++++++--- 4 files changed, 13 insertions(+), 101 deletions(-) (limited to 'src/libs/client') diff --git a/src/libs/client/NodeModel.cpp b/src/libs/client/NodeModel.cpp index 58ddb56b..4e3a0a11 100644 --- a/src/libs/client/NodeModel.cpp +++ b/src/libs/client/NodeModel.cpp @@ -73,22 +73,6 @@ NodeModel::clear() } -void -NodeModel::set_path(const Path& p) -{ - const string old_path = _path; - - ObjectModel::set_path(p); - - // FIXME: rename -// for (PortModelList::iterator i = _ports.begin(); i != _ports.end(); ++i) -// (*i)->set_path(_path + "/" + (*i)->path().name()); - - //if (_parent && old_path.length() > 0) - // parent_patch()->rename_node(old_path, p); -} - - void NodeModel::add_child(SharedPtr c) { diff --git a/src/libs/client/NodeModel.hpp b/src/libs/client/NodeModel.hpp index ccf2f1fb..fcaacd0e 100644 --- a/src/libs/client/NodeModel.hpp +++ b/src/libs/client/NodeModel.hpp @@ -79,9 +79,6 @@ protected: virtual void clear(); - friend class PatchModel; - void set_path(const Path& p); - bool _polyphonic; PortModelList _ports; ///< List of ports (not a Table to preserve order) string _plugin_uri; ///< Plugin URI (if PluginModel is unknown) diff --git a/src/libs/client/PatchModel.cpp b/src/libs/client/PatchModel.cpp index f67c7706..3702a41a 100644 --- a/src/libs/client/PatchModel.cpp +++ b/src/libs/client/PatchModel.cpp @@ -27,33 +27,6 @@ namespace Ingen { namespace Client { -void -PatchModel::set_path(const Path& new_path) -{ - ObjectModel::set_path(new_path); -#if 0 - // FIXME: haack - if (new_path == "") { - _path = ""; - return; - } - - NodeModel::set_path(new_path); - for (Children::iterator i = _children.begin(); i != _children.end(); ++i) - (*i).second->set_path(_path +"/"+ (*i).second->path().name()); - -#ifdef DEBUG - // Be sure connection paths are updated and sane - for (list >::iterator j = _connections.begin(); - j != _connections.end(); ++j) { - assert((*j)->src_port_path().parent().parent() == new_path); - assert((*j)->src_port_path().parent().parent() == new_path); - } -#endif -#endif -} - - void PatchModel::add_child(SharedPtr c) { @@ -120,23 +93,6 @@ PatchModel::remove_child(SharedPtr o) } } -#if 0 -void -PatchModel::remove_node(const string& name) -{ - assert(name.find("/") == string::npos); - NodeModelMap::iterator i = _children.find(name); - if (i != _children.end()) { - //delete i->second; - _children.erase(i); - removed_node_sig.emit(name); - i->second->parent().reset(); - return; - } - - cerr << "[PatchModel::remove_node] " << _path << ": failed to find node " << name << endl; -} -#endif void PatchModel::clear() @@ -160,40 +116,6 @@ PatchModel::clear() } -/** Updated the map key of the given node. - * - * The NodeModel must already have it's new path set to @a new_path, or this will - * abort with a fatal error. - */ -void -PatchModel::rename_node(const Path& old_path, const Path& new_path) -{ - cerr << "FIXME: node rename" << endl; -#if 0 - assert(old_path.parent() == path()); - assert(new_path.parent() == path()); - - NodeModelMap::iterator i = _children.find(old_path.name()); - - if (i != _children.end()) { - SharedPtr nm = (*i).second; - for (list >::iterator j = _connections.begin(); j != _connections.end(); ++j) { - if ((*j)->src_port_path().parent() == old_path) - (*j)->src_port_path(new_path.base() + (*j)->src_port_path().name()); - if ((*j)->dst_port_path().parent() == old_path) - (*j)->dst_port_path(new_path.base() + (*j)->dst_port_path().name()); - } - _children.erase(i); - assert(nm->path() == new_path); - _children[new_path.name()] = nm; - return; - } - - cerr << "[PatchModel::rename_node] " << _path << ": failed to find node " << old_path << endl; -#endif -} - - SharedPtr PatchModel::get_connection(const string& src_port_path, const string& dst_port_path) const { diff --git a/src/libs/client/PatchModel.hpp b/src/libs/client/PatchModel.hpp index af1ef101..16e145e9 100644 --- a/src/libs/client/PatchModel.hpp +++ b/src/libs/client/PatchModel.hpp @@ -52,6 +52,15 @@ public: const string& filename() const { return _filename; } bool enabled() const { return _enabled; } bool polyphonic() const; + + /** "editable" = arranging,connecting,adding,deleting,etc + * not editable (control mode) you can just change controllers (performing) + */ + bool get_editable() const { return _editable; } + void set_editable(bool e) { if (_editable != e) { + _editable = e; + editable_sig.emit(e); + } } // Signals sigc::signal > new_node_sig; @@ -60,6 +69,7 @@ public: sigc::signal > removed_connection_sig; sigc::signal enabled_sig; sigc::signal disabled_sig; + sigc::signal editable_sig; private: friend class Store; @@ -67,7 +77,8 @@ private: PatchModel(const Path& patch_path, size_t internal_poly) : NodeModel("ingen:patch", patch_path, false), // FIXME _enabled(false), - _poly(internal_poly) + _poly(internal_poly), + _editable(true) { } @@ -76,9 +87,6 @@ private: void enable(); void disable(); void clear(); - void set_path(const Path& path); - //void add_node(SharedPtr nm); - //void remove_node(SharedPtr nm); void add_child(SharedPtr c); bool remove_child(SharedPtr c); @@ -92,6 +100,7 @@ private: string _filename; bool _enabled; size_t _poly; + bool _editable; }; typedef Table > PatchModelMap; -- cgit v1.2.1