diff options
Diffstat (limited to 'src/gui/Port.cpp')
-rw-r--r-- | src/gui/Port.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index 012e8fcd..ba4e0482 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -35,6 +35,7 @@ namespace Ingen { using namespace Shared; namespace GUI { +ArtVpathDash* Port::_dash; /** @a flip Make an input port appear as an output port, and vice versa. */ @@ -55,6 +56,10 @@ Port::Port( delete _menu; _menu = NULL; + ArtVpathDash* dash = this->dash(); + _rect->property_dash() = dash; + set_border_width(dash ? 2.0 : 0.0); + pm->signal_moved.connect(sigc::mem_fun(this, &Port::moved)); if (pm->type().is_control()) { @@ -148,9 +153,37 @@ Port::property_changed(const URI& key, const Atom& value) } else if (value.type() == Atom::BOOL) { if ((key.str() == "lv2:toggled")) set_toggled(value.get_bool()); + } else if (value.type() == Atom::URI) { + ArtVpathDash* dash = this->dash(); + _rect->property_dash() = dash; + set_border_width(dash ? 2.0 : 0.0); } } +ArtVpathDash* +Port::dash() +{ + SharedPtr<PortModel> pm = _port_model.lock(); + if (!pm) + return NULL; + + const Raul::Atom& context = pm->get_property("ctx:context"); + if (!context.is_valid() || context.type() != Atom::URI + || !strcmp(context.get_uri(), "ctx:AudioContext")) + return NULL; + + if (!_dash) { + _dash = new ArtVpathDash(); + _dash->n_dash = 2; + _dash->dash = art_new(double, 2); + _dash->dash[0] = 4; + _dash->dash[1] = 4; + } + + return _dash; +} + + } // namespace GUI } // namespace Ingen |