trigger_ui: reorganize some tempo and FA controls

This commit is contained in:
Ben Loftis 2022-01-14 12:55:51 -06:00
parent d04743c813
commit cce260b67a
4 changed files with 45 additions and 61 deletions

View File

@ -58,22 +58,23 @@ AudioTriggerPropertiesBox::AudioTriggerPropertiesBox ()
, _stretch_toggle (ArdourButton::led_default_elements)
, _abpm_label (ArdourButton::Text)
{
_header_label.set_text (_("AUDIO Trigger Properties:"));
Gtk::Label* label;
int row = 0;
_header_label.set_alignment (0.0, 0.5);
pack_start (_header_label, false, false, 6);
/* ------- Stretching and Tempo stuff ----------------------------- */
Gtk::Table* bpm_table = manage (new Gtk::Table ());
bpm_table->set_homogeneous (false);
bpm_table->set_spacings (4);
bpm_table->set_border_width (2);
bpm_table->set_border_width (8);
_stretch_toggle.set_text (_("Stretch"));
bpm_table->attach (_stretch_toggle, 0, 1, row, row + 1, Gtk::SHRINK, Gtk::SHRINK);
bpm_table->attach (_stretch_selector, 1, 2, row, row + 1, Gtk::SHRINK, Gtk::SHRINK); row++;
label = manage (new Gtk::Label (_("BPM:")));
label->set_alignment (1.0, 0.5);
bpm_table->attach (*label, 0, 1, row, row + 1, Gtk::SHRINK, Gtk::SHRINK);
bpm_table->attach (_abpm_label, 1, 2, row, row + 1, Gtk::SHRINK, Gtk::SHRINK);
bpm_table->attach (*label, 0, 1, row, row + 1, Gtk::FILL, Gtk::SHRINK);
bpm_table->attach (_abpm_label, 1, 2, row, row + 1, Gtk::FILL, Gtk::SHRINK);
ArdourButton *half = manage (new ArdourButton (_("/2")));
half->signal_clicked.connect(sigc::bind (sigc::mem_fun(*this, &AudioTriggerPropertiesBox::MultiplyTempo), 0.5));
@ -84,27 +85,18 @@ AudioTriggerPropertiesBox::AudioTriggerPropertiesBox ()
row++;
pack_start (*bpm_table, false, false);
Gtk::Table* metrum_table = manage (new Gtk::Table ());
metrum_table->set_homogeneous (false);
metrum_table->set_spacings (4);
metrum_table->set_border_width (2);
label = manage (new Gtk::Label (_("Time Sig:")));
label->set_alignment (1.0, 0.5);
bpm_table->attach (*label, 0, 1, row, row + 1, Gtk::SHRINK, Gtk::SHRINK);
bpm_table->attach (_metrum_button, 1, 2, row, row + 1, Gtk::SHRINK, Gtk::SHRINK);
row++;
bpm_table->attach (*label, 0, 1, row, row + 1, Gtk::FILL, Gtk::SHRINK);
bpm_table->attach (_metrum_button, 1, 2, row, row + 1, Gtk::FILL, Gtk::SHRINK);
pack_start (*metrum_table, false, false);
Gtk::EventBox* eTempoBox = manage (new Gtk::EventBox); // a themeable box
eTempoBox->set_name("EditorDark");
eTempoBox->add (*bpm_table);
/* -------------- Clip start&length (redundant with the trimmer gui handles?) ----------*/
row = 0;
_stretch_toggle.set_text (_("Stretch"));
_table.attach (_stretch_toggle, 0, 1, row, row + 1, Gtk::SHRINK, Gtk::SHRINK);
_table.attach (_stretch_selector, 1, 2, row, row + 1, Gtk::SHRINK, Gtk::SHRINK);
row++;
label = manage (new Gtk::Label (_("Start:")));
label->set_alignment (1.0, 0.5);
_table.attach (*label, 0, 1, row, row + 1, Gtk::SHRINK, Gtk::SHRINK);
@ -120,7 +112,6 @@ AudioTriggerPropertiesBox::AudioTriggerPropertiesBox ()
_table.set_homogeneous (false);
_table.set_spacings (4);
_table.set_border_width (2);
pack_start (_table, false, false);
Gtk::Table* audio_t = manage (new Gtk::Table ());
audio_t->set_homogeneous (true);
@ -138,7 +129,9 @@ AudioTriggerPropertiesBox::AudioTriggerPropertiesBox ()
row++;
pack_start (*audio_t);
attach (*eTempoBox, 0,1, 0,1, Gtk::FILL, Gtk::SHRINK);
attach (_table, 0,1, 1,2, Gtk::FILL, Gtk::SHRINK);
attach (*audio_t, 0,1, 2,3, Gtk::FILL, Gtk::SHRINK);
using namespace Menu_Helpers;

View File

@ -34,7 +34,7 @@
#include "audio_clock.h"
#include "trigger_ui.h"
class TriggerPropertiesBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr, public TriggerUI
class TriggerPropertiesBox : public Gtk::Table, public ARDOUR::SessionHandlePtr, public TriggerUI
{
public:
TriggerPropertiesBox () {}

View File

@ -48,11 +48,6 @@ using std::min;
MidiTriggerPropertiesBox::MidiTriggerPropertiesBox ()
{
_header_label.set_text (_("MIDI Trigger Properties:"));
_header_label.set_alignment (0.0, 0.5);
pack_start (_header_label, false, false, 6);
Gtk::Table* midi_t = manage (new Gtk::Table ());
midi_t->set_homogeneous (true);
midi_t->set_spacings (4);
@ -71,7 +66,7 @@ MidiTriggerPropertiesBox::MidiTriggerPropertiesBox ()
midi_t->attach (_cc_enable_button, 0, 1, row, row + 1, Gtk::SHRINK, Gtk::SHRINK);
row++;
pack_start (*midi_t);
attach (*midi_t, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
}
MidiTriggerPropertiesBox::~MidiTriggerPropertiesBox ()

View File

@ -267,7 +267,21 @@ SlotPropertyTable::SlotPropertyTable ()
_follow_table.set_homogeneous (false);
row=0;
_follow_table.attach(_follow_action_button, 0, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
Gtkmm2ext::set_size_request_to_display_given_text (_left_probability_label, "100% Left ", 12, 0);
_left_probability_label.set_alignment(0.0, 0.5);
Gtkmm2ext::set_size_request_to_display_given_text (_right_probability_label, "100% Right", 12, 0);
_right_probability_label.set_alignment(1.0, 0.5);
Gtk::Table *prob_table = manage(new Gtk::Table());
prob_table->set_spacings(2);
prob_table->set_border_width(4);
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 );
_follow_table.attach(_follow_left, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK );
_follow_table.attach(_follow_right, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
_follow_table.attach( *prob_table, 0, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
label = manage(new Gtk::Label(_("Follow Count:"))); label->set_alignment(1.0, 0.5);
_follow_table.attach(*label, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK );
@ -284,21 +298,6 @@ SlotPropertyTable::SlotPropertyTable ()
_follow_table.attach(*fl_align, 1, 2, row, row+1, Gtk::FILL, Gtk::SHRINK, 0, 0 );
_follow_table.attach(*beat_label, 2, 3, row, row+1, Gtk::SHRINK, Gtk::SHRINK); row++;
Gtkmm2ext::set_size_request_to_display_given_text (_left_probability_label, "100% Left ", 12, 0);
_left_probability_label.set_alignment(0.0, 0.5);
Gtkmm2ext::set_size_request_to_display_given_text (_right_probability_label, "100% Right", 12, 0);
_right_probability_label.set_alignment(1.0, 0.5);
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::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 );
_follow_table.attach( *prob_table, 0, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
_follow_table.attach(_follow_left, 0, 1, row, row+1, Gtk::FILL, Gtk::SHRINK );
_follow_table.attach(_follow_right, 1, 3, row, row+1, Gtk::FILL, Gtk::SHRINK ); row++;
Gtk::EventBox* eFollowBox = manage (new Gtk::EventBox); // a themeable box
eFollowBox->set_name("EditorDark");
eFollowBox->add (_follow_table);
@ -405,6 +404,8 @@ SlotPropertyTable::set_follow_action (Trigger::FollowAction fa, uint64_t idx)
void
SlotPropertyTable::on_trigger_changed (PropertyChange const& pc)
{
int probability = trigger()->follow_action_probability();
if (pc.contains (Properties::name)) {
_name_label.set_text (trigger()->name());
}
@ -452,26 +453,22 @@ SlotPropertyTable::on_trigger_changed (PropertyChange const& pc)
}
if (pc.contains (Properties::follow_action_probability)) {
int pval = trigger()->follow_action_probability();
_follow_probability_adjustment.set_value (pval);
_left_probability_label.set_text (string_compose(_("%1%% Left"), 100-pval));
_right_probability_label.set_text (string_compose(_("%1%% Right"), pval));
_follow_probability_adjustment.set_value (probability);
_left_probability_label.set_text (string_compose(_("%1%% Left"), 100-probability));
_right_probability_label.set_text (string_compose(_("%1%% Right"), probability));
}
if (trigger()->use_follow()) {
_follow_left.set_sensitive(true);
_follow_right.set_sensitive(true);
bool follow_widgets_sensitive = trigger()->follow_action (0) != Trigger::None;
if (follow_widgets_sensitive) {
_follow_count_spinner.set_sensitive(true);
_follow_length_spinner.set_sensitive(true);
_follow_probability_slider.set_sensitive(true);
_left_probability_label.set_sensitive(true);
_right_probability_label.set_sensitive(true);
} else {
_follow_left.set_sensitive(false);
_follow_right.set_sensitive(false);
_follow_count_spinner.set_sensitive(false);
_follow_length_spinner.set_sensitive(false);
_follow_probability_slider.set_sensitive(false);
_left_probability_label.set_sensitive(false);
_right_probability_label.set_sensitive(false);
}
}
@ -482,7 +479,6 @@ SlotPropertyWidget::SlotPropertyWidget ()
ui = new SlotPropertyTable ();
pack_start(*ui);
ui->show();
// set_background_color (UIConfiguration::instance().color (X_("theme:bg")));
}
/* ------------ */