add editor to Theme Manager for modifiers
This commit is contained in:
parent
9831006c8e
commit
8b23001441
@ -157,9 +157,12 @@ ThemeManager::ThemeManager()
|
||||
palette_viewport.signal_size_allocate().connect (sigc::bind (sigc::mem_fun (*this, &ThemeManager::palette_canvas_allocated), palette_group, palette_viewport.canvas(),
|
||||
sigc::mem_fun (*this, &ThemeManager::palette_event)));
|
||||
palette_scroller.add (palette_viewport);
|
||||
|
||||
modifier_scroller.add (modifier_vbox);
|
||||
|
||||
notebook.append_page (alias_scroller, _("Items"));
|
||||
notebook.append_page (palette_scroller, _("Palette"));
|
||||
notebook.append_page (modifier_scroller, _("Modifiers"));
|
||||
|
||||
vbox->pack_start (notebook);
|
||||
|
||||
@ -200,7 +203,8 @@ ThemeManager::ThemeManager()
|
||||
set_size_request (-1, 400);
|
||||
/* no need to call setup_palette() here, it will be done when its size is allocated */
|
||||
setup_aliases ();
|
||||
|
||||
setup_modifiers ();
|
||||
|
||||
/* Trigger setting up the color scheme and loading the GTK RC file */
|
||||
|
||||
ARDOUR_UI::config()->load_rc_file (false);
|
||||
@ -212,11 +216,54 @@ ThemeManager::~ThemeManager()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ThemeManager::setup_modifiers ()
|
||||
{
|
||||
UIConfiguration* uic (ARDOUR_UI::config());
|
||||
UIConfiguration::Modifiers& modifiers (uic->modifiers);
|
||||
Gtk::HBox* mod_hbox;
|
||||
Gtk::Label* mod_label;
|
||||
Gtk::HScale* mod_scale;
|
||||
|
||||
Gtkmm2ext::container_clear (modifier_vbox);
|
||||
|
||||
for (UIConfiguration::Modifiers::const_iterator m = modifiers.begin(); m != modifiers.end(); ++m) {
|
||||
mod_hbox = manage (new HBox);
|
||||
|
||||
mod_scale = manage (new HScale (0.0, 1.0, 0.01));
|
||||
mod_scale->set_draw_value (false);
|
||||
mod_scale->set_value (m->second.a());
|
||||
mod_scale->set_update_policy (Gtk::UPDATE_DISCONTINUOUS);
|
||||
mod_scale->signal_value_changed().connect (sigc::bind (sigc::mem_fun (*this, &ThemeManager::modifier_edited), mod_scale, m->first));
|
||||
|
||||
mod_label = manage (new Label (m->first));
|
||||
|
||||
mod_hbox->pack_start (*mod_label, false, true, 6);
|
||||
mod_hbox->pack_start (*mod_scale, true, true);
|
||||
|
||||
modifier_vbox.pack_start (*mod_hbox, false, false);
|
||||
}
|
||||
|
||||
modifier_vbox.show_all ();
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
ThemeManager::modifier_edited (Gtk::Range* range, string name)
|
||||
{
|
||||
using namespace ArdourCanvas;
|
||||
|
||||
double alpha = range->get_value();
|
||||
SVAModifier svam (SVAModifier::Assign, -1.0, -1.0, alpha);
|
||||
ARDOUR_UI::config()->set_modifier (name, svam);
|
||||
}
|
||||
|
||||
void
|
||||
ThemeManager::colors_changed ()
|
||||
{
|
||||
setup_palette ();
|
||||
setup_aliases ();
|
||||
setup_modifiers ();
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -161,6 +161,12 @@ class ThemeManager : public ArdourWindow
|
||||
void setup_aliases ();
|
||||
void setup_palette ();
|
||||
|
||||
Gtk::ScrolledWindow modifier_scroller;
|
||||
Gtk::VBox modifier_vbox;
|
||||
|
||||
void setup_modifiers ();
|
||||
void modifier_edited (Gtk::Range*, std::string);
|
||||
|
||||
void colors_changed ();
|
||||
};
|
||||
|
||||
|
@ -68,6 +68,7 @@ UIConfiguration::UIConfiguration ()
|
||||
_dirty (false),
|
||||
aliases_modified (false),
|
||||
colors_modified (false),
|
||||
modifiers_modified (false),
|
||||
block_save (0)
|
||||
{
|
||||
_instance = this;
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -628,6 +630,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)
|
||||
{
|
||||
|
@ -64,6 +64,7 @@ class UIConfiguration : public PBD::Stateful
|
||||
|
||||
void set_alias (std::string const & name, std::string const & alias);
|
||||
void set_color (const std::string& name, ArdourCanvas::Color);
|
||||
void set_modifier (std::string const &, ArdourCanvas::SVAModifier svam);
|
||||
|
||||
std::string color_as_alias (ArdourCanvas::Color c);
|
||||
ArdourCanvas::Color quantized (ArdourCanvas::Color) const;
|
||||
@ -106,6 +107,7 @@ class UIConfiguration : public PBD::Stateful
|
||||
bool _dirty;
|
||||
bool aliases_modified;
|
||||
bool colors_modified;
|
||||
bool modifiers_modified;
|
||||
|
||||
static UIConfiguration* _instance;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user