trigger_ui: allow selecting an empty slot

This commit is contained in:
Ben Loftis 2021-12-21 15:20:05 -06:00
parent aa7b15a0b6
commit b89b452c8d
2 changed files with 8 additions and 10 deletions

View File

@ -205,11 +205,11 @@ TriggerUI::TriggerUI () :
Gtk::Table *prob_table = manage(new Gtk::Table());
prob_table->set_spacings(2);
prob_table->attach(_follow_probability_slider, 0, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK );
prob_table->attach(_follow_probability_slider, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK );
prob_table->attach(_left_probability_label, 0, 1, 1, 2, Gtk::FILL, Gtk::SHRINK );
prob_table->attach(_right_probability_label, 1, 2, 1, 2, Gtk::FILL, Gtk::SHRINK );
attach( *prob_table, 0, 2, row, row+1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK ); row++;
attach( *prob_table, 0, 2, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
attach(_follow_left, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK );
attach(_follow_right, 1, 2, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
}

View File

@ -604,14 +604,12 @@ TriggerBoxUI::name_button_event (GdkEvent* ev, uint64_t n)
}
break;
case GDK_BUTTON_PRESS:
if (_slots[n]->trigger ().region ()) {
PublicEditor::instance ().get_selection ().set (_slots[n]);
/* a side-effect of selection-change is that the slot's color is reset. retain the "entered-color" here: */
_slots[n]->name_text->set_color (UIConfiguration::instance ().color ("neutral:foregroundest"));
_slots[n]->name_button->set_fill_color (HSV (fill_color ()).lighter (0.15).color ());
_slots[n]->name_button->set_outline_color (UIConfiguration::instance ().color ("alert:red"));
_slots[n]->follow_button->set_fill_color (HSV (fill_color ()).lighter (0.15).color ());
}
PublicEditor::instance ().get_selection ().set (_slots[n]);
/* a side-effect of selection-change is that the slot's color is reset. retain the "entered-color" here: */
_slots[n]->name_text->set_color (UIConfiguration::instance ().color ("neutral:foregroundest"));
_slots[n]->name_button->set_fill_color (HSV (fill_color ()).lighter (0.15).color ());
_slots[n]->name_button->set_outline_color (UIConfiguration::instance ().color ("alert:red"));
_slots[n]->follow_button->set_fill_color (HSV (fill_color ()).lighter (0.15).color ());
break;
case GDK_2BUTTON_PRESS:
edit_trigger (n);