basic code to use SVModifier plus one definition in dark.colors
This commit is contained in:
@@ -482,4 +482,6 @@
|
||||
<ColorAlias name="zoom button: fill active" alias="color 48"/>
|
||||
<ColorAlias name="zoom button: led active" alias="color 8"/>
|
||||
</ColorAliases>
|
||||
<Modifiers>
|
||||
<Modifer name="region note edit" modifier="= alpha:0"/>
|
||||
</Ardour>
|
||||
|
||||
@@ -262,7 +262,16 @@ UIConfiguration::store_color_theme ()
|
||||
parent->add_child_nocopy (*node);
|
||||
}
|
||||
root->add_child_nocopy (*parent);
|
||||
|
||||
|
||||
parent = new XMLNode (X_("Modifiers"));
|
||||
for (Modifiers::const_iterator i = modifiers.begin(); i != modifiers.end(); ++i) {
|
||||
XMLNode* node = new XMLNode (X_("Modifier"));
|
||||
node->add_property (X_("name"), i->first);
|
||||
node->add_property (X_("modifier"), i->second.to_string());
|
||||
parent->add_child_nocopy (*node);
|
||||
}
|
||||
root->add_child_nocopy (*parent);
|
||||
|
||||
XMLTree tree;
|
||||
std::string colorfile = Glib::build_filename (user_config_directory(), (string ("my-") + color_file.get() + ".colors"));
|
||||
|
||||
@@ -435,6 +444,12 @@ UIConfiguration::set_state (const XMLNode& root, int /*version*/)
|
||||
load_color_aliases (*aliases);
|
||||
}
|
||||
|
||||
XMLNode* modifiers = find_named_node (root, X_("Modifiers"));
|
||||
|
||||
if (modifiers) {
|
||||
load_modifiers (*modifiers);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -486,6 +501,30 @@ UIConfiguration::load_colors (XMLNode const & node)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
UIConfiguration::load_modifiers (XMLNode const & node)
|
||||
{
|
||||
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"));
|
||||
|
||||
if (name && mod) {
|
||||
SVAModifier svam (mod->value());
|
||||
modifiers.insert (make_pair (name->value(), svam));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
UIConfiguration::set_variables (const XMLNode& node)
|
||||
{
|
||||
|
||||
@@ -56,9 +56,11 @@ class UIConfiguration : public PBD::Stateful
|
||||
|
||||
typedef std::map<std::string,ArdourCanvas::Color> Colors;
|
||||
typedef std::map<std::string,std::string> ColorAliases;
|
||||
typedef std::map<std::string,ArdourCanvas::SVAModifier> Modifiers;
|
||||
|
||||
Colors colors;
|
||||
ColorAliases color_aliases;
|
||||
Modifiers modifiers;
|
||||
|
||||
void set_alias (std::string const & name, std::string const & alias);
|
||||
void set_color (const std::string& name, ArdourCanvas::Color);
|
||||
@@ -68,7 +70,8 @@ class UIConfiguration : public PBD::Stateful
|
||||
|
||||
ArdourCanvas::Color color (const std::string&, bool* failed = 0) const;
|
||||
ArdourCanvas::HSV color_hsv (const std::string&) const;
|
||||
|
||||
ArdourCanvas::SVAModifier modifier (const std::string&);
|
||||
|
||||
sigc::signal<void,std::string> ParameterChanged;
|
||||
void map_parameters (boost::function<void (std::string)>&);
|
||||
|
||||
@@ -108,6 +111,7 @@ class UIConfiguration : public PBD::Stateful
|
||||
int store_color_theme ();
|
||||
void load_color_aliases (XMLNode const &);
|
||||
void load_colors (XMLNode const &);
|
||||
void load_modifiers (XMLNode const &);
|
||||
void reset_gtk_theme ();
|
||||
void colors_changed ();
|
||||
int load_color_theme (bool allow_own=true);
|
||||
|
||||
Reference in New Issue
Block a user