Give tempo dialog initial focus to BPM spinner.
[ardour.git] / gtk2_ardour / tempo_dialog.cc
index 24acfbb57f3430963e536b680cd2191c20246965..18b5e144cbc9a758834fbca92db2b09132e29d6c 100644 (file)
@@ -23,8 +23,7 @@
 
 #include "gtkmm2ext/utils.h"
 
-#include "ardour/rc_configuration.h"
-
+#include "ardour_ui.h"
 #include "tempo_dialog.h"
 
 #include "i18n.h"
@@ -108,7 +107,7 @@ TempoDialog::init (const Timecode::BBT_Time& when, double bpm, double note_type,
        
        Table* table;
 
-       if (Config->get_allow_non_quarter_pulse()) {
+       if (ARDOUR_UI::config()->get_allow_non_quarter_pulse()) {
                table = manage (new Table (5, 5));
        } else {
                table = manage (new Table (5, 4));
@@ -122,7 +121,7 @@ TempoDialog::init (const Timecode::BBT_Time& when, double bpm, double note_type,
        table->attach (*bpm_label, 0, 1, 0, 1);
        table->attach (bpm_spinner, 1, 5, 0, 1);
 
-       if (Config->get_allow_non_quarter_pulse()) {
+       if (ARDOUR_UI::config()->get_allow_non_quarter_pulse()) {
                table->attach (pulse_selector_label, 0, 1, 1, 2);
                table->attach (pulse_selector, 1, 5, 1, 2);
                row = 2;
@@ -130,14 +129,14 @@ TempoDialog::init (const Timecode::BBT_Time& when, double bpm, double note_type,
                row = 1;
        }
 
-       if (movable) {
-               char buf[64];
+       char buf[64];
 
-               snprintf (buf, sizeof (buf), "%" PRIu32, when.bars);
-               when_bar_entry.set_text (buf);
-               snprintf (buf, sizeof (buf), "%" PRIu32, when.beats);
-               when_beat_entry.set_text (buf);
+       snprintf (buf, sizeof (buf), "%" PRIu32, when.bars);
+       when_bar_entry.set_text (buf);
+       snprintf (buf, sizeof (buf), "%" PRIu32, when.beats);
+       when_beat_entry.set_text (buf);
 
+       if (movable) {
                when_bar_entry.set_width_chars(4);
                when_beat_entry.set_width_chars (4);
 
@@ -166,6 +165,7 @@ TempoDialog::init (const Timecode::BBT_Time& when, double bpm, double note_type,
        bpm_spinner.show ();
        tap_tempo_button.show ();
        get_vbox()->pack_end (tap_tempo_button);
+       bpm_spinner.grab_focus ();
 
        set_name ("MetricDialog");
 
@@ -359,18 +359,14 @@ MeterDialog::init (const Timecode::BBT_Time& when, double bpb, double divisor, b
        table->attach (*note_label, 0, 1, 1, 2, FILL|EXPAND, FILL|EXPAND);
        table->attach (note_type, 1, 2, 1, 2, FILL|EXPAND, SHRINK);
 
-       if (movable) {
-               char buf[64];
-
-               snprintf (buf, sizeof (buf), "%" PRIu32, when.bars);
-               when_bar_entry.set_text (buf);
+       snprintf (buf, sizeof (buf), "%" PRIu32, when.bars);
+       when_bar_entry.set_text (buf);
 
+       if (movable) {
                Label* when_label = manage (new Label(_("Meter begins at bar:"), ALIGN_LEFT, ALIGN_CENTER));
 
                table->attach (*when_label, 0, 1, 2, 3, FILL | EXPAND, FILL | EXPAND);
                table->attach (when_bar_entry, 1, 2, 2, 3, FILL | EXPAND, FILL | EXPAND);
-       } else {
-               when_bar_entry.set_text ("0");
        }
 
        get_vbox()->set_border_width (12);