diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/Connection.cpp | 14 | ||||
-rw-r--r-- | src/gui/Connection.hpp | 16 | ||||
-rw-r--r-- | src/gui/PatchCanvas.cpp | 46 | ||||
-rw-r--r-- | src/gui/PatchCanvas.hpp | 6 |
4 files changed, 38 insertions, 44 deletions
diff --git a/src/gui/Connection.cpp b/src/gui/Connection.cpp index 6b29c1d5..0e0093de 100644 --- a/src/gui/Connection.cpp +++ b/src/gui/Connection.cpp @@ -17,20 +17,20 @@ #include "Connection.hpp" #include "Port.hpp" -#include "ingen/client/ConnectionModel.hpp" +#include "ingen/client/EdgeModel.hpp" using namespace std; namespace Ingen { namespace GUI { -Connection::Connection(Ganv::Canvas& canvas, - boost::shared_ptr<const Client::ConnectionModel> model, - Ganv::Node* src, - Ganv::Node* dst, - uint32_t color) +Connection::Connection(Ganv::Canvas& canvas, + boost::shared_ptr<const Client::EdgeModel> model, + Ganv::Node* src, + Ganv::Node* dst, + uint32_t color) : Ganv::Edge(canvas, src, dst, color) - , _connection_model(model) + , _edge_model(model) { } diff --git a/src/gui/Connection.hpp b/src/gui/Connection.hpp index 3f2b04a9..17d80bc0 100644 --- a/src/gui/Connection.hpp +++ b/src/gui/Connection.hpp @@ -24,7 +24,7 @@ namespace Ingen { -namespace Client { class ConnectionModel; } +namespace Client { class EdgeModel; } namespace GUI { @@ -35,16 +35,16 @@ namespace GUI { class Connection : public Ganv::Edge { public: - Connection(Ganv::Canvas& canvas, - boost::shared_ptr<const Client::ConnectionModel> model, - Ganv::Node* src, - Ganv::Node* dst, - uint32_t color); + Connection(Ganv::Canvas& canvas, + boost::shared_ptr<const Client::EdgeModel> model, + Ganv::Node* src, + Ganv::Node* dst, + uint32_t color); - SharedPtr<const Client::ConnectionModel> model() const { return _connection_model; } + SharedPtr<const Client::EdgeModel> model() const { return _edge_model; } private: - SharedPtr<const Client::ConnectionModel> _connection_model; + SharedPtr<const Client::EdgeModel> _edge_model; }; } // namespace GUI diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index b322f29f..783896fd 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -305,7 +305,7 @@ PatchCanvas::build() // Create connections for (PatchModel::Connections::const_iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) { - connection(PtrCast<ConnectionModel>(i->second)); + connection(PtrCast<EdgeModel>(i->second)); } } @@ -473,43 +473,41 @@ PatchCanvas::get_port_view(SharedPtr<PortModel> port) } void -PatchCanvas::connection(SharedPtr<const ConnectionModel> cm) +PatchCanvas::connection(SharedPtr<const EdgeModel> cm) { - assert(cm); + Ganv::Port* const tail = get_port_view(cm->tail()); + Ganv::Port* const head = get_port_view(cm->head()); - Ganv::Port* const src = get_port_view(cm->src_port()); - Ganv::Port* const dst = get_port_view(cm->dst_port()); - - if (src && dst) { - new GUI::Connection(*this, cm, src, dst, src->get_fill_color()); + if (tail && head) { + new GUI::Connection(*this, cm, tail, head, tail->get_fill_color()); } else { LOG(error) << "Unable to find ports to connect " - << cm->src_port_path() << " -> " << cm->dst_port_path() << endl; + << cm->tail_path() << " -> " << cm->head_path() << endl; } } void -PatchCanvas::disconnection(SharedPtr<const ConnectionModel> cm) +PatchCanvas::disconnection(SharedPtr<const EdgeModel> cm) { - Ganv::Port* const src = get_port_view(cm->src_port()); - Ganv::Port* const dst = get_port_view(cm->dst_port()); + Ganv::Port* const src = get_port_view(cm->tail()); + Ganv::Port* const dst = get_port_view(cm->head()); if (src && dst) remove_edge(src, dst); else LOG(error) << "Unable to find ports to disconnect " - << cm->src_port_path() << " -> " << cm->dst_port_path() << endl; + << cm->tail_path() << " -> " << cm->head_path() << endl; } void -PatchCanvas::connect(Ganv::Node* src_port, - Ganv::Node* dst_port) +PatchCanvas::connect(Ganv::Node* tail, + Ganv::Node* head) { const Ingen::GUI::Port* const src - = dynamic_cast<Ingen::GUI::Port*>(src_port); + = dynamic_cast<Ingen::GUI::Port*>(tail); const Ingen::GUI::Port* const dst - = dynamic_cast<Ingen::GUI::Port*>(dst_port); + = dynamic_cast<Ingen::GUI::Port*>(head); if (!src || !dst) return; @@ -518,17 +516,13 @@ PatchCanvas::connect(Ganv::Node* src_port, } void -PatchCanvas::disconnect(Ganv::Node* src_port, - Ganv::Node* dst_port) +PatchCanvas::disconnect(Ganv::Node* tail, + Ganv::Node* head) { - const Ingen::GUI::Port* const src - = dynamic_cast<Ingen::GUI::Port*>(src_port); - - const Ingen::GUI::Port* const dst - = dynamic_cast<Ingen::GUI::Port*>(dst_port); + const Ingen::GUI::Port* const t = dynamic_cast<Ingen::GUI::Port*>(tail); + const Ingen::GUI::Port* const h = dynamic_cast<Ingen::GUI::Port*>(head); - _app.engine()->disconnect(src->model()->path(), - dst->model()->path()); + _app.engine()->disconnect(t->model()->path(), h->model()->path()); } void diff --git a/src/gui/PatchCanvas.hpp b/src/gui/PatchCanvas.hpp index 82827b68..98276d30 100644 --- a/src/gui/PatchCanvas.hpp +++ b/src/gui/PatchCanvas.hpp @@ -30,7 +30,7 @@ #include "raul/SharedPtr.hpp" #include "raul/Path.hpp" -#include "ingen/client/ConnectionModel.hpp" +#include "ingen/client/EdgeModel.hpp" #include "ingen/GraphObject.hpp" #include "NodeModule.hpp" @@ -68,8 +68,8 @@ public: void remove_node(SharedPtr<const Client::NodeModel> nm); void add_port(SharedPtr<const Client::PortModel> pm); void remove_port(SharedPtr<const Client::PortModel> pm); - void connection(SharedPtr<const Client::ConnectionModel> cm); - void disconnection(SharedPtr<const Client::ConnectionModel> cm); + void connection(SharedPtr<const Client::EdgeModel> cm); + void disconnection(SharedPtr<const Client::EdgeModel> cm); void get_new_module_location(double& x, double& y); |