mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
when use stripable palette colors, use them sequentially
Also break this code out into a separate method
This commit is contained in:
parent
cd4b6e85a8
commit
74f95ff0dd
3 changed files with 28 additions and 19 deletions
|
|
@ -65,7 +65,7 @@ AxisView::~AxisView()
|
||||||
Gdk::Color
|
Gdk::Color
|
||||||
AxisView::unique_random_color()
|
AxisView::unique_random_color()
|
||||||
{
|
{
|
||||||
return ::unique_random_color (used_colors, true);
|
return ARDOUR_UI_UTILS::unique_palette_color (used_colors);
|
||||||
}
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
|
|
|
||||||
|
|
@ -680,17 +680,20 @@ ARDOUR_UI_UTILS::escape_underscores (string const & s)
|
||||||
}
|
}
|
||||||
|
|
||||||
Gdk::Color
|
Gdk::Color
|
||||||
ARDOUR_UI_UTILS::unique_random_color (list<Gdk::Color>& used_colors, bool from_palette)
|
ARDOUR_UI_UTILS::unique_palette_color (list<Gdk::Color>& used_colors)
|
||||||
{
|
{
|
||||||
Gdk::Color newcolor;
|
Gdk::Color newcolor;
|
||||||
|
|
||||||
if (from_palette) {
|
|
||||||
|
|
||||||
string cp = UIConfiguration::instance().get_stripable_color_palette ();
|
string cp = UIConfiguration::instance().get_stripable_color_palette ();
|
||||||
Gdk::ArrayHandle_Color gc = ColorSelection::palette_from_string (cp);
|
Gdk::ArrayHandle_Color gc = ColorSelection::palette_from_string (cp);
|
||||||
std::vector<Gdk::Color> c (gc);
|
std::vector<Gdk::Color> c (gc);
|
||||||
int n = random () % c.size();
|
static std::vector<Gdk::Color>::size_type index = 0;
|
||||||
Gtkmm2ext::HSV hsv (Gtkmm2ext::gdk_color_to_rgba (c[n]));
|
|
||||||
|
if (index >= c.size()) {
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Gtkmm2ext::HSV hsv (Gtkmm2ext::gdk_color_to_rgba (c[index]));
|
||||||
|
index++;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
newcolor.set_hsv (hsv.h, hsv.s, hsv.v);
|
newcolor.set_hsv (hsv.h, hsv.s, hsv.v);
|
||||||
|
|
@ -700,7 +703,12 @@ ARDOUR_UI_UTILS::unique_random_color (list<Gdk::Color>& used_colors, bool from_p
|
||||||
used_colors.push_back (newcolor);
|
used_colors.push_back (newcolor);
|
||||||
|
|
||||||
return newcolor;
|
return newcolor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Gdk::Color
|
||||||
|
ARDOUR_UI_UTILS::unique_random_color (list<Gdk::Color>& used_colors)
|
||||||
|
{
|
||||||
|
Gdk::Color newcolor;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,8 @@ void resize_window_to_proportion_of_monitor (Gtk::Window*, int, int);
|
||||||
|
|
||||||
std::string escape_underscores (std::string const &);
|
std::string escape_underscores (std::string const &);
|
||||||
|
|
||||||
Gdk::Color unique_random_color (std::list<Gdk::Color> &, bool from_palette = false);
|
Gdk::Color unique_palette_color (std::list<Gdk::Color> &);
|
||||||
|
Gdk::Color unique_random_color (std::list<Gdk::Color> &);
|
||||||
|
|
||||||
std::string rate_as_string (float r);
|
std::string rate_as_string (float r);
|
||||||
std::string samples_as_time_string (ARDOUR::samplecnt_t s, float r, bool show_samples = false);
|
std::string samples_as_time_string (ARDOUR::samplecnt_t s, float r, bool show_samples = false);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue