diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/GraphCanvas.cpp | 46 | ||||
-rw-r--r-- | src/gui/Port.cpp | 10 | ||||
-rw-r--r-- | src/gui/Port.hpp | 1 |
3 files changed, 26 insertions, 31 deletions
diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 7053b495..565f607e 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -405,6 +405,7 @@ GraphCanvas::get_port_view(SPtr<PortModel> port) return NULL; } +/** Called when a connection is added to the model. */ void GraphCanvas::connection(SPtr<const ArcModel> arc) { @@ -419,44 +420,49 @@ GraphCanvas::connection(SPtr<const ArcModel> arc) } } +/** Called when a connection is removed from the model. */ void GraphCanvas::disconnection(SPtr<const ArcModel> arc) { - Ganv::Port* const src = get_port_view(arc->tail()); - Ganv::Port* const dst = get_port_view(arc->head()); + Ganv::Port* const tail = get_port_view(arc->tail()); + Ganv::Port* const head = get_port_view(arc->head()); - if (src && dst) { - remove_edge_between(src, dst); + if (tail && head) { + remove_edge_between(tail, head); + if (arc->head()->is_a(_app.uris().lv2_AudioPort)) { + GUI::Port* const h = dynamic_cast<GUI::Port*>(head); + if (h) { + h->activity(_app.forge().make(0.0f)); // Reset peaks + } + } } else { _app.log().error(fmt("Unable to find ports to disconnect %1% => %2%\n") % arc->tail_path() % arc->head_path()); } } +/** Called when the user connects ports on the canvas. */ void -GraphCanvas::connect(Ganv::Node* tail, - Ganv::Node* head) +GraphCanvas::connect(Ganv::Node* tail, Ganv::Node* head) { - const Ingen::GUI::Port* const src - = dynamic_cast<Ingen::GUI::Port*>(tail); + const GUI::Port* const t = dynamic_cast<GUI::Port*>(tail); + const GUI::Port* const h = dynamic_cast<GUI::Port*>(head); - const Ingen::GUI::Port* const dst - = dynamic_cast<Ingen::GUI::Port*>(head); - - if (!src || !dst) - return; - - _app.interface()->connect(src->model()->path(), dst->model()->path()); + if (t && h) { + _app.interface()->connect(t->model()->path(), h->model()->path()); + } } +/** Called when the user disconnects ports on the canvas. */ void -GraphCanvas::disconnect(Ganv::Node* tail, - Ganv::Node* head) +GraphCanvas::disconnect(Ganv::Node* tail, Ganv::Node* head) { - const Ingen::GUI::Port* const t = dynamic_cast<Ingen::GUI::Port*>(tail); - const Ingen::GUI::Port* const h = dynamic_cast<Ingen::GUI::Port*>(head); + const GUI::Port* const t = dynamic_cast<GUI::Port*>(tail); + const GUI::Port* const h = dynamic_cast<GUI::Port*>(head); - _app.interface()->disconnect(t->model()->path(), h->model()->path()); + if (t && h) { + _app.interface()->disconnect(t->model()->path(), h->model()->path()); + } } void diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index 9a20a8b8..c1947fea 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -81,8 +81,6 @@ Port::Port(App& app, sigc::mem_fun(this, &Port::property_removed)); pm->signal_activity().connect( sigc::mem_fun(this, &Port::activity)); - pm->signal_disconnection().connect( - sigc::mem_fun(this, &Port::disconnected_from)); pm->signal_moved().connect( sigc::mem_fun(this, &Port::moved)); @@ -371,14 +369,6 @@ Port::activity(const Atom& value) } } -void -Port::disconnected_from(SPtr<PortModel> port) -{ - if (!model()->connected() && model()->is_a(_app.uris().lv2_AudioPort)) { - set_fill_color(peak_color(0.0f)); - } -} - GraphBox* Port::get_graph_box() const { diff --git a/src/gui/Port.hpp b/src/gui/Port.hpp index a9549160..5f683412 100644 --- a/src/gui/Port.hpp +++ b/src/gui/Port.hpp @@ -62,7 +62,6 @@ public: void value_changed(const Atom& value); void activity(const Atom& value); - void disconnected_from(SPtr<Client::PortModel> port); bool on_selected(gboolean b); |