X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fui_config.cc;h=1040c546ed89095495c15997295b791cbd26fc00;hb=b8e9e17fac0c2ef930dd80dc6e63c5213d00018c;hp=027d119c30deea4671b77e067f232b15d0340319;hpb=ef26a862e94e4b633b498073c80987e0c0f129b5;p=ardour.git diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc index 027d119c30..1040c546ed 100644 --- a/gtk2_ardour/ui_config.cc +++ b/gtk2_ardour/ui_config.cc @@ -68,6 +68,7 @@ UIConfiguration::UIConfiguration () _dirty (false), aliases_modified (false), colors_modified (false), + modifiers_modified (false), block_save (0) { _instance = this; @@ -239,7 +240,7 @@ int UIConfiguration::store_color_theme () { XMLNode* root; - LocaleGuard lg (X_("POSIX")); + LocaleGuard lg (X_("C")); root = new XMLNode("Ardour"); @@ -354,7 +355,7 @@ UIConfiguration::save_state() _dirty = false; } - if (aliases_modified || colors_modified) { + if (aliases_modified || colors_modified || modifiers_modified) { if (store_color_theme ()) { error << string_compose (_("Color file %1 not saved"), color_file.get()) << endmsg; @@ -363,6 +364,7 @@ UIConfiguration::save_state() aliases_modified = false; colors_modified = false; + modifiers_modified = false; } @@ -373,7 +375,7 @@ XMLNode& UIConfiguration::get_state () { XMLNode* root; - LocaleGuard lg (X_("POSIX")); + LocaleGuard lg (X_("C")); root = new XMLNode("Ardour"); @@ -391,7 +393,7 @@ XMLNode& UIConfiguration::get_variables (std::string which_node) { XMLNode* node; - LocaleGuard lg (X_("POSIX")); + LocaleGuard lg (X_("C")); node = new XMLNode (which_node); @@ -495,7 +497,7 @@ UIConfiguration::load_colors (XMLNode const & node) if (name && color) { ArdourCanvas::Color c; - c = strtol (color->value().c_str(), 0, 16); + c = strtoul (color->value().c_str(), 0, 16); colors.insert (make_pair (name->value(), c)); } } @@ -504,17 +506,19 @@ UIConfiguration::load_colors (XMLNode const & node) void UIConfiguration::load_modifiers (XMLNode const & node) { + PBD::LocaleGuard lg ("C"); XMLNodeList const nlist = node.children(); XMLNodeConstIterator niter; XMLProperty const *name; XMLProperty const *mod; modifiers.clear (); - + for (niter = nlist.begin(); niter != nlist.end(); ++niter) { if ((*niter)->name() != X_("Modifier")) { continue; } + name = (*niter)->property (X_("name")); mod = (*niter)->property (X_("modifier")); @@ -547,6 +551,18 @@ UIConfiguration::modifier (string const & name) const return SVAModifier (); } +ArdourCanvas::Color +UIConfiguration::color_mod (std::string const & colorname, std::string const & modifiername) const +{ + return HSV (color (colorname)).mod (modifier (modifiername)).color (); +} + +ArdourCanvas::Color +UIConfiguration::color_mod (const ArdourCanvas::Color& color, std::string const & modifiername) const +{ + return HSV (color).mod (modifier (modifiername)).color (); +} + ArdourCanvas::Color UIConfiguration::color (const std::string& name, bool* failed) const { @@ -621,6 +637,21 @@ UIConfiguration::set_alias (string const & name, string const & alias) ARDOUR_UI_UTILS::ColorsChanged (); /* EMIT SIGNAL */ } +void +UIConfiguration::set_modifier (string const & name, SVAModifier svam) +{ + Modifiers::iterator m = modifiers.find (name); + + if (m == modifiers.end()) { + return; + } + + m->second = svam; + modifiers_modified = true; + + ARDOUR_UI_UTILS::ColorsChanged (); /* EMIT SIGNAL */ +} + void UIConfiguration::load_rc_file (bool themechange, bool allow_own) {