summaryrefslogtreecommitdiff
path: root/gtk2_ardour/axis_view.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-08-30 09:48:53 +0000
committerCarl Hetherington <carl@carlh.net>2011-08-30 09:48:53 +0000
commit7d32cf3813b7145b98c86b59867092e04aa2621a (patch)
treedbb2d319f55e2c287b51a7071a236dadd6d83ca3 /gtk2_ardour/axis_view.cc
parent9b7ae4cccc8507bc3e74e909b738a5b87a2b717b (diff)
Give route groups their own colour, settable from the route
group dialogue. Americanise spelling of color in a few places to avoid confusion. Fixes #4224. Addresses parts of #2650 and #4064. git-svn-id: svn://localhost/ardour2/branches/3.0@10030 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/axis_view.cc')
-rw-r--r--gtk2_ardour/axis_view.cc37
1 files changed, 2 insertions, 35 deletions
diff --git a/gtk2_ardour/axis_view.cc b/gtk2_ardour/axis_view.cc
index 6aec4c62eb..1144fb1e68 100644
--- a/gtk2_ardour/axis_view.cc
+++ b/gtk2_ardour/axis_view.cc
@@ -38,6 +38,7 @@
#include "ardour_ui.h"
#include "gui_object.h"
#include "axis_view.h"
+#include "utils.h"
#include "i18n.h"
using namespace std;
@@ -60,41 +61,7 @@ AxisView::~AxisView()
Gdk::Color
AxisView::unique_random_color()
{
- Gdk::Color newcolor;
-
- while (1) {
-
- /* avoid neon/glowing tones by limiting them to the
- "inner section" (paler) of a color wheel/circle.
- */
-
- const int32_t max_saturation = 48000; // 65535 would open up the whole color wheel
-
- newcolor.set_red (random() % max_saturation);
- newcolor.set_blue (random() % max_saturation);
- newcolor.set_green (random() % max_saturation);
-
- if (used_colors.size() == 0) {
- used_colors.push_back (newcolor);
- return newcolor;
- }
-
- for (list<Gdk::Color>::iterator i = used_colors.begin(); i != used_colors.end(); ++i) {
- Gdk::Color c = *i;
- float rdelta, bdelta, gdelta;
-
- rdelta = newcolor.get_red() - c.get_red();
- bdelta = newcolor.get_blue() - c.get_blue();
- gdelta = newcolor.get_green() - c.get_green();
-
- if (sqrt (rdelta*rdelta + bdelta*bdelta + gdelta*gdelta) > 25.0) {
- used_colors.push_back (newcolor);
- return newcolor;
- }
- }
-
- /* XXX need throttle here to make sure we don't spin for ever */
- }
+ return ::unique_random_color (used_colors);
}
string