13
0

triggerui: work on colors, fonts and legato button

This commit is contained in:
Paul Davis 2021-10-02 18:36:14 -06:00
parent 808bfe0916
commit 6ba8feed15
2 changed files with 33 additions and 6 deletions

View File

@ -103,7 +103,8 @@ TriggerUI::TriggerUI (Item* parent, Trigger& t)
_follow_action_button = new ArdourButton ();
_follow_action_button->set_text (_("Follow Action"));
_follow_action_button->set_active_color (UIConfiguration::instance().color ("alert:greenish"));
follow_action_button = new ArdourCanvas::Widget (canvas(), *_follow_action_button);
follow_action_button->name = "FollowAction";
_follow_action_button->signal_event().connect (sigc::mem_fun (*this, (&TriggerUI::follow_action_button_event)));
@ -131,7 +132,8 @@ TriggerUI::TriggerUI (Item* parent, Trigger& t)
launch_text = new Text (canvas());
launch_text->set (_("Launch"));
launch_text->name = "LaunchText";
launch_text->set_outline_color (UIConfiguration::instance().color (X_("normal:foreground")));
launch_text->set_color (Gtkmm2ext::contrasting_text_color (UIConfiguration::instance().color (X_("theme:bg"))));
launch_text->set_font_description (UIConfiguration::instance ().get_NormalBoldFont ());
_launch_style_button = new ArdourDropdown();
_launch_style_button->set_sizing_text (longest_launch);
@ -146,13 +148,17 @@ TriggerUI::TriggerUI (Item* parent, Trigger& t)
_legato_button = new ArdourButton();
_legato_button->set_text (_("Legato"));
_legato_button->set_active_color (UIConfiguration::instance().color ("alert:greenish"));
_legato_button->signal_event().connect (sigc::mem_fun (*this, (&TriggerUI::legato_button_event)));
legato_button = new ArdourCanvas::Widget (canvas(), *_legato_button);
legato_button->name = "Legato";
quantize_text = new Text (canvas());
quantize_text->set (_("Quantize"));
quantize_text->name = "QuantizeText";
quantize_text->set_outline_color (Gtkmm2ext::contrasting_text_color (UIConfiguration::instance().color (X_("theme:bg"))));
quantize_text->set_color (launch_text->color());
quantize_text->set_font_description (UIConfiguration::instance ().get_NormalBoldFont ());
_quantize_button = new ArdourDropdown;
@ -182,18 +188,19 @@ TriggerUI::TriggerUI (Item* parent, Trigger& t)
velocity = new Rectangle (canvas());
velocity->name = "VelocityRect";
velocity->set_fill_color (UIConfiguration::instance().color (X_("theme:bg")));
velocity->set_outline_color (UIConfiguration::instance().color (X_("normal:foreground")));
velocity->set_outline_color (UIConfiguration::instance().color (X_("neutral:foreground")));
velocity_text = new Text (velocity);
velocity_text->set (_("100 %"));
velocity_text->name = "VelocityText";
velocity_text->set_outline_color (velocity->fill_color());
velocity_text->set_color (quantize_text->color());
velocity_text->set_font_description (UIConfiguration::instance ().get_NormalFont ());
velocity_label = new Text (canvas());
velocity_label->set (_("Velocity"));
velocity_label->name = "VelocityLabel";
velocity_label->set_outline_color (Gtkmm2ext::contrasting_text_color (UIConfiguration::instance().color (X_("theme:bg"))));
velocity_label->set_color (quantize_text->color());
velocity_label->set_font_description (UIConfiguration::instance ().get_NormalBoldFont ());
const double scale = UIConfiguration::instance().get_ui_scale();
const Distance spacing = 12. * scale;
@ -270,6 +277,21 @@ TriggerUI::follow_action_button_event (GdkEvent* ev)
return false;
}
bool
TriggerUI::legato_button_event (GdkEvent* ev)
{
switch (ev->type) {
case GDK_BUTTON_PRESS:
trigger.set_legato (!trigger.legato());
return true;
default:
break;
}
return false;
}
void
TriggerUI::set_launch_style (Trigger::LaunchStyle ls)
{
@ -355,6 +377,10 @@ TriggerUI::trigger_changed (PropertyChange pc)
_follow_action_button->set_active_state (trigger.use_follow() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
}
if (pc.contains (Properties::legato)) {
_legato_button->set_active_state (trigger.legato() ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off);
}
if (pc.contains (Properties::launch_style)) {
_launch_style_button->set_active (launch_style_to_string (trigger.launch_style()));
}

View File

@ -85,6 +85,7 @@ class TriggerUI : public ArdourCanvas::Table, public sigc::trackable
void trigger_changed (PBD::PropertyChange);
bool follow_action_button_event (GdkEvent*);
bool legato_button_event (GdkEvent*);
PBD::ScopedConnectionList trigger_connections;