summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/Configuration.cpp8
-rw-r--r--src/gui/Configuration.hpp8
-rw-r--r--src/gui/Connection.cpp43
-rw-r--r--src/gui/Connection.hpp13
-rw-r--r--src/gui/ControlPanel.cpp2
-rw-r--r--src/gui/Port.cpp33
-rw-r--r--src/gui/Port.hpp4
-rw-r--r--src/gui/wscript1
8 files changed, 97 insertions, 15 deletions
diff --git a/src/gui/Configuration.cpp b/src/gui/Configuration.cpp
index 2169093e..83de3321 100644
--- a/src/gui/Configuration.cpp
+++ b/src/gui/Configuration.cpp
@@ -24,7 +24,9 @@
#include "client/PortModel.hpp"
#include "client/PluginModel.hpp"
#include "serialisation/Parser.hpp"
+#include "flowcanvas/Port.hpp"
#include "App.hpp"
+#include "Port.hpp"
using namespace std;
@@ -41,7 +43,7 @@ Configuration::Configuration()
, _control_port_color(0x4A8A0EC0)
, _event_port_color( 0x960909C0)
// , _osc_port_color( 0x5C3566C0)
- , _object_port_color( 0x5C3566C0)
+ , _value_port_color( 0x4A4A4AC0)
{
}
@@ -95,7 +97,9 @@ Configuration::get_port_color(const PortModel* p)
/*} else if (p->type().is_osc()) {
return _osc_port_color;
*/} else if (p->type().is_value()) {
- return _object_port_color;
+ return _value_port_color;
+ } else if (p->type().is_message()) {
+ return _event_port_color;
}
cerr << "[Configuration] Unknown port type " << p->type().uri()
diff --git a/src/gui/Configuration.hpp b/src/gui/Configuration.hpp
index f66d9f67..fef86999 100644
--- a/src/gui/Configuration.hpp
+++ b/src/gui/Configuration.hpp
@@ -20,16 +20,16 @@
#include <stdint.h>
#include <string>
+#include "raul/SharedPtr.hpp"
namespace Ingen { namespace Client { class PortModel; } }
using Ingen::Client::PortModel;
using std::string;
-struct Coord { double x; double y; };
-
namespace Ingen {
namespace GUI {
+class Port;
/** Singleton state manager for the entire app.
*
@@ -52,7 +52,7 @@ public:
const string& patch_folder() { return _patch_folder; }
void set_patch_folder(const string& f) { _patch_folder = f; }
- uint32_t get_port_color(const PortModel* pi);
+ uint32_t get_port_color(const PortModel* p);
enum NameStyle { PATH, HUMAN, NONE };
@@ -68,7 +68,7 @@ private:
uint32_t _audio_port_color;
uint32_t _control_port_color;
uint32_t _event_port_color;
- uint32_t _object_port_color;
+ uint32_t _value_port_color;
};
diff --git a/src/gui/Connection.cpp b/src/gui/Connection.cpp
new file mode 100644
index 00000000..48cf7372
--- /dev/null
+++ b/src/gui/Connection.cpp
@@ -0,0 +1,43 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2007-2009 Dave Robillard <http://drobilla.net>
+ *
+ * Ingen is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) 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 General Public License for details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <iostream>
+#include "client/ConnectionModel.hpp"
+#include "Connection.hpp"
+#include "Port.hpp"
+
+using namespace std;
+
+namespace Ingen {
+namespace GUI {
+
+Connection::Connection(boost::shared_ptr<FlowCanvas::Canvas> canvas,
+ boost::shared_ptr<ConnectionModel> model,
+ boost::shared_ptr<FlowCanvas::Connectable> src,
+ boost::shared_ptr<FlowCanvas::Connectable> dst,
+ uint32_t color)
+ : FlowCanvas::Connection(canvas, src, dst, color)
+ , _connection_model(model)
+{
+ boost::shared_ptr<Port> src_port = boost::dynamic_pointer_cast<Port>(src);
+ if (src_port)
+ _bpath.property_dash() = src_port->dash();
+}
+
+
+} // namespace GUI
+} // namespace Ingen
diff --git a/src/gui/Connection.hpp b/src/gui/Connection.hpp
index 8abfa008..e9d5aa3c 100644
--- a/src/gui/Connection.hpp
+++ b/src/gui/Connection.hpp
@@ -22,10 +22,12 @@
#include <string>
#include "flowcanvas/Connection.hpp"
#include "raul/SharedPtr.hpp"
-#include "client/ConnectionModel.hpp"
-using Ingen::Client::ConnectionModel;
namespace Ingen {
+
+namespace Client { class ConnectionModel; }
+using Client::ConnectionModel;
+
namespace GUI {
@@ -40,12 +42,7 @@ public:
boost::shared_ptr<ConnectionModel> model,
boost::shared_ptr<FlowCanvas::Connectable> src,
boost::shared_ptr<FlowCanvas::Connectable> dst,
- uint32_t color)
- : FlowCanvas::Connection(canvas, src, dst, color)
- , _connection_model(model)
- {}
-
- virtual ~Connection() {}
+ uint32_t color);
SharedPtr<ConnectionModel> model() const { return _connection_model; }
diff --git a/src/gui/ControlPanel.cpp b/src/gui/ControlPanel.cpp
index fdfba8b7..4aea2f08 100644
--- a/src/gui/ControlPanel.cpp
+++ b/src/gui/ControlPanel.cpp
@@ -120,7 +120,7 @@ ControlPanel::add_port(SharedPtr<PortModel> pm)
Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference("toggle_control");
xml->get_widget_derived("toggle_control", tc);
control = tc;
- } else if (pm->type().is_value()) {
+ } else if (pm->type().is_value() || pm->type().is_message()) {
StringControl* sc;
Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference("string_control");
xml->get_widget_derived("string_control", sc);
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
diff --git a/src/gui/Port.hpp b/src/gui/Port.hpp
index db511041..ec361a9f 100644
--- a/src/gui/Port.hpp
+++ b/src/gui/Port.hpp
@@ -56,11 +56,15 @@ public:
void value_changed(const Raul::Atom& value);
void activity();
+ ArtVpathDash* dash();
+
private:
void property_changed(const Raul::URI& key, const Raul::Atom& value);
void moved();
+ static ArtVpathDash* _dash;
+
WeakPtr<PortModel> _port_model;
bool _flipped;
};
diff --git a/src/gui/wscript b/src/gui/wscript
index ddcba166..c3e618b6 100644
--- a/src/gui/wscript
+++ b/src/gui/wscript
@@ -8,6 +8,7 @@ def build(bld):
BreadCrumbs.cpp
Configuration.cpp
ConnectWindow.cpp
+ Connection.cpp
ControlPanel.cpp
Controls.cpp
GladeFactory.cpp