reorder tempo dialog contents, provide non-presented var to control focus behavior

This commit is contained in:
Paul Davis 2023-06-12 18:00:21 -06:00
parent bb97ade440
commit 05c29e25f9
3 changed files with 19 additions and 9 deletions

View File

@ -243,7 +243,7 @@ TempoDialog::init (const Temporal::BBT_Time& when, double bpm, double end_bpm, d
get_vbox ()->set_border_width (12);
get_vbox ()->set_spacing (6);
get_vbox ()->pack_end (*table, false, false);
get_vbox ()->pack_start (*table, false, false);
table->show_all ();
table = manage (new Table (2, 2));
@ -298,13 +298,6 @@ TempoDialog::init (const Temporal::BBT_Time& when, double bpm, double end_bpm, d
/* init state */
tempo_type_change ();
tapped = false;
#if 0
bpm_spinner.select_region (0, -1);
bpm_spinner.grab_focus ();
#else
tap_tempo_button.set_can_focus ();
tap_tempo_button.grab_focus ();
#endif
}
TempoDialog::~TempoDialog ()
@ -313,6 +306,20 @@ TempoDialog::~TempoDialog ()
AudioEngine::instance ()->unregister_port (_midi_tap_port);
}
void
TempoDialog::on_show ()
{
ArdourDialog::on_show ();
if (!UIConfiguration::instance().get_prefer_tap_tempo()) {
bpm_spinner.select_region (0, -1);
bpm_spinner.grab_focus ();
} else {
tap_tempo_button.set_can_focus ();
tap_tempo_button.grab_focus ();
}
}
void
TempoDialog::midi_event (MIDI::byte* msg, size_t len, MIDI::samplecnt_t now)
{
@ -398,7 +405,7 @@ TempoDialog::port_changed ()
}
tap_tempo_button.set_sensitive (!rv);
bpm_spinner.set_sensitive (!rv);
if (!rv) {
if (!rv && UIConfiguration::instance().get_prefer_tap_tempo()) {
tap_tempo_button.grab_focus ();
}
}

View File

@ -65,6 +65,8 @@ public:
Temporal::Tempo::Type get_tempo_type ();
Temporal::TimeDomain get_lock_style ();
void on_show ();
private:
void init (const Temporal::BBT_Time& start, double bpm, double end_bpm, double note_type, Temporal::TempoPoint::Type type, bool movable, Temporal::TimeDomain style);
bool is_user_input_valid() const;

View File

@ -153,6 +153,7 @@ UI_CONFIG_VARIABLE (bool, ask_before_closing_last_window, "ask-before-closing-la
UI_CONFIG_VARIABLE (bool, ask_cut_copy_section_tempo_map, "ask-cut-copy-section-tempo-map", true)
UI_CONFIG_VARIABLE (std::string, freesound_dir, "freesound-dir", "")
UI_CONFIG_VARIABLE (int, max_note_height, "max-note-height", 20)
UI_CONFIG_VARIABLE (bool, prefer_tap_tempo, "prefer-tap-tempo", false)
#ifdef MIXBUS
UI_CONFIG_VARIABLE (Editing::TempoEditBehavior, tempo_edit_behavior, "tempo-edit-behavior", Editing::TempoMapping)
#else