summaryrefslogtreecommitdiffstats
path: root/src/gui/Port.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/Port.cpp')
-rw-r--r--src/gui/Port.cpp38
1 files changed, 3 insertions, 35 deletions
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp
index fd5e5a14..c643b379 100644
--- a/src/gui/Port.cpp
+++ b/src/gui/Port.cpp
@@ -1,6 +1,6 @@
/*
This file is part of Ingen.
- Copyright 2007-2015 David Robillard <http://drobilla.net/>
+ Copyright 2007-2016 David Robillard <http://drobilla.net/>
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
@@ -33,6 +33,7 @@
#include "WidgetFactory.hpp"
#include "WindowFactory.hpp"
#include "ingen_config.h"
+#include "rgba.hpp"
using namespace Ingen::Client;
using namespace std;
@@ -339,38 +340,6 @@ Port::on_event(GdkEvent* ev)
return false;
}
-/* Peak colour stuff */
-
-static inline uint32_t
-rgba_to_uint(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
-{
- return ((((uint32_t)(r)) << 24) |
- (((uint32_t)(g)) << 16) |
- (((uint32_t)(b)) << 8) |
- (((uint32_t)(a))));
-}
-
-static inline uint8_t
-mono_interpolate(uint8_t v1, uint8_t v2, float f)
-{
- return ((int)rint((v2) * (f) + (v1) * (1 - (f))));
-}
-
-#define RGBA_R(x) (((uint32_t)(x)) >> 24)
-#define RGBA_G(x) ((((uint32_t)(x)) >> 16) & 0xFF)
-#define RGBA_B(x) ((((uint32_t)(x)) >> 8) & 0xFF)
-#define RGBA_A(x) (((uint32_t)(x)) & 0xFF)
-
-static inline uint32_t
-rgba_interpolate(uint32_t c1, uint32_t c2, float f)
-{
- return rgba_to_uint(
- mono_interpolate(RGBA_R(c1), RGBA_R(c2), f),
- mono_interpolate(RGBA_G(c1), RGBA_G(c2), f),
- mono_interpolate(RGBA_B(c1), RGBA_B(c2), f),
- mono_interpolate(RGBA_A(c1), RGBA_A(c2), f));
-}
-
inline static uint32_t
peak_color(float peak)
{
@@ -386,8 +355,6 @@ peak_color(float peak)
}
}
-/* End peak colour stuff */
-
void
Port::activity(const Atom& value)
{
@@ -525,6 +492,7 @@ Port::property_changed(const Raul::URI& key, const Atom& value)
set_label(value.ptr<char>());
}
} else if (key == uris.rdf_type || key == uris.atom_bufferType) {
+ set_fill_color(_app.style()->get_port_color(model().get()));
Ganv::Port::set_beveled(model()->is_a(uris.lv2_ControlPort) ||
model()->has_property(uris.atom_bufferType,
uris.atom_Sequence));