X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Futils.cc;h=c0fc619f6878b453914d710f12135df31b083e5b;hb=6618c9e4060da66964bd5707be442ba3f0f156ef;hp=582ad018c4bef3c3453fb7b520cc0b69e0c761bb;hpb=f00b3b7f111e36537d773daef0ae77b03d11f82f;p=ardour.git diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index 582ad018c4..c0fc619f68 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -328,7 +328,7 @@ emulate_key_event (Gtk::Widget* w, unsigned int keyval) ev.state = 0; ev.keyval = keyval; ev.length = 0; - ev.string = (gchar*) ""; + ev.string = const_cast (""); ev.hardware_keycode = keymapkey[0].keycode; ev.group = keymapkey[0].group; g_free(keymapkey); @@ -755,6 +755,13 @@ unique_random_color (list& used_colors) while (1) { + double h, s, v; + + h = fmod (random(), 360.0); + s = (random() % 65535) / 65535.0; + v = (random() % 65535) / 65535.0; + +#if 0 /* avoid neon/glowing tones by limiting them to the "inner section" (paler) of a color wheel/circle. */ @@ -764,7 +771,11 @@ unique_random_color (list& used_colors) newcolor.set_red (random() % max_saturation); newcolor.set_blue (random() % max_saturation); newcolor.set_green (random() % max_saturation); - +#else + s = min (0.5, s); /* not too saturated */ + v = max (0.9, v); /* not too bright */ + newcolor.set_hsv (h, s, v); +#endif if (used_colors.size() == 0) { used_colors.push_back (newcolor); return newcolor;