mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
in the case of a missing theme file, fall back to 'dark'
This commit is contained in:
parent
03971be30d
commit
2a5b5a8b0e
2 changed files with 32 additions and 23 deletions
|
|
@ -289,7 +289,7 @@ UIConfiguration::load_defaults ()
|
|||
}
|
||||
|
||||
std::string
|
||||
UIConfiguration::color_file_name (bool use_my, bool with_version) const
|
||||
UIConfiguration::color_file_name (bool use_my, bool with_version, bool fallback) const
|
||||
{
|
||||
string basename;
|
||||
|
||||
|
|
@ -298,6 +298,11 @@ UIConfiguration::color_file_name (bool use_my, bool with_version) const
|
|||
}
|
||||
|
||||
std::string color_name = color_file.get();
|
||||
|
||||
if (fallback) {
|
||||
color_name = "dark";
|
||||
}
|
||||
|
||||
size_t sep = color_name.find_first_of("-");
|
||||
if (sep != string::npos) {
|
||||
color_name = color_name.substr (0, sep);
|
||||
|
|
@ -349,27 +354,9 @@ UIConfiguration::load_color_theme (bool allow_own)
|
|||
*/
|
||||
PBD::Unwinder<uint32_t> uw (block_save, block_save + 1);
|
||||
|
||||
if (find_file (theme_search_path(), color_file_name (false, true), cfile)) {
|
||||
found = true;
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
if (find_file (theme_search_path(), color_file_name (false, false), cfile)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
warning << string_compose (_("Color file for %1 not found along %2"), color_file.get(), theme_search_path().to_string()) << endmsg;
|
||||
return -1;
|
||||
}
|
||||
|
||||
(void) load_color_file (cfile);
|
||||
|
||||
/* first search for the user's customized settings (for this major.minor version)*/
|
||||
if (allow_own) {
|
||||
|
||||
found = false;
|
||||
|
||||
PBD::Searchpath sp (user_config_directory());
|
||||
|
||||
/* user's own color files never have the program name in them */
|
||||
|
|
@ -383,11 +370,33 @@ UIConfiguration::load_color_theme (bool allow_own)
|
|||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
(void) load_color_file (cfile);
|
||||
/* now search for a versioned color file (for this major.minor version) CURRENTLY UNUSED */
|
||||
if (!found) {
|
||||
if (find_file (theme_search_path(), color_file_name (false, true), cfile)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* now search for the theme file that the user last selected */
|
||||
if (!found) {
|
||||
if (find_file (theme_search_path(), color_file_name (false, false), cfile)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* still not found? use the 'dark' theme */
|
||||
if (!found) {
|
||||
if (find_file (theme_search_path(), color_file_name (false, false, true), cfile)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
(void) load_color_file (cfile);
|
||||
} else {
|
||||
error << _("no theme file was found; colors will be odd") << endmsg;
|
||||
}
|
||||
|
||||
ColorsChanged ();
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public:
|
|||
XMLNode& get_variables (std::string const &) const;
|
||||
void set_variables (const XMLNode&);
|
||||
|
||||
std::string color_file_name (bool use_my, bool with_version) const;
|
||||
std::string color_file_name (bool use_my, bool with_version, bool fallback = false) const;
|
||||
|
||||
typedef std::map<std::string, Gtkmm2ext::Color> Colors;
|
||||
typedef std::map<std::string, std::string> ColorAliases;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue