allow UIConfiguration::color() to tell caller that it could not find the named color
This commit is contained in:
parent
9278ae23c4
commit
bd430c2080
|
@ -634,10 +634,14 @@ UIConfiguration::base_color_by_name (const std::string& name) const
|
|||
}
|
||||
|
||||
ArdourCanvas::Color
|
||||
UIConfiguration::color (const std::string& name) const
|
||||
UIConfiguration::color (const std::string& name, bool* failed) const
|
||||
{
|
||||
map<string,string>::const_iterator e = color_aliases.find (name);
|
||||
|
||||
if (failed) {
|
||||
*failed = false;
|
||||
}
|
||||
|
||||
if (e != color_aliases.end ()) {
|
||||
map<string,RelativeHSV>::const_iterator rc = relative_colors.find (e->second);
|
||||
if (rc != relative_colors.end()) {
|
||||
|
@ -652,6 +656,10 @@ UIConfiguration::color (const std::string& name) const
|
|||
}
|
||||
|
||||
cerr << string_compose (_("Color %1 not found"), name) << endl;
|
||||
|
||||
if (failed) {
|
||||
*failed = true;
|
||||
}
|
||||
|
||||
return rgba_to_color ((g_random_int()%256)/255.0,
|
||||
(g_random_int()%256)/255.0,
|
||||
|
|
|
@ -83,7 +83,7 @@ class UIConfiguration : public PBD::Stateful
|
|||
ArdourCanvas::Color quantized (ArdourCanvas::Color) const;
|
||||
|
||||
ArdourCanvas::Color base_color_by_name (const std::string&) const;
|
||||
ArdourCanvas::Color color (const std::string&) const;
|
||||
ArdourCanvas::Color color (const std::string&, bool* failed = 0) const;
|
||||
ArdourCanvas::HSV color_hsv (const std::string&) const;
|
||||
|
||||
sigc::signal<void,std::string> ParameterChanged;
|
||||
|
|
Loading…
Reference in New Issue