using namespace ARDOUR;
using namespace PBD;
-TempoDialog::TempoDialog (TempoMap& map, framepos_t frame, const string&)
+TempoDialog::TempoDialog (TempoMap& map, samplepos_t sample, const string&)
: ArdourDialog (_("New Tempo"))
, _map (&map)
, _section (0)
, pulse_selector_label (_("Pulse:"), ALIGN_LEFT, ALIGN_CENTER)
, tap_tempo_button (_("Tap tempo"))
{
- Tempo tempo (map.tempo_at_frame (frame));
- Timecode::BBT_Time when (map.bbt_at_frame (frame));
+ Tempo tempo (map.tempo_at_sample (sample));
+ Timecode::BBT_Time when (map.bbt_at_sample (sample));
init (when, tempo.note_types_per_minute(), tempo.end_note_types_per_minute(), tempo.note_type(), TempoSection::Constant, true, MusicTime);
}
, pulse_selector_label (_("Pulse:"), ALIGN_LEFT, ALIGN_CENTER)
, tap_tempo_button (_("Tap tempo"))
{
- Timecode::BBT_Time when (map.bbt_at_frame (section.frame()));
+ Timecode::BBT_Time when (map.bbt_at_sample (section.sample()));
init (when, section.note_types_per_minute(), section.end_note_types_per_minute(), section.note_type(), section.type()
, section.initial() || section.locked_to_meter(), section.position_lock_style());
}
tap_tempo_button.show ();
get_vbox()->set_spacing (6);
get_vbox()->pack_end (tap_tempo_button);
- bpm_spinner.grab_focus ();
+ tap_tempo_button.can_focus ();
+ tap_tempo_button.grab_focus ();
set_name ("MetricDialog");
tempo_type.signal_changed().connect (sigc::mem_fun (*this, &TempoDialog::tempo_type_change));
lock_style.signal_changed().connect (sigc::mem_fun (*this, &TempoDialog::lock_style_change));
tap_tempo_button.signal_button_press_event().connect (sigc::mem_fun (*this, &TempoDialog::tap_tempo_button_press), false);
+ tap_tempo_button.signal_key_press_event().connect (sigc::mem_fun (*this, &TempoDialog::tap_tempo_key_press), false);
tap_tempo_button.signal_focus_out_event().connect (sigc::mem_fun (*this, &TempoDialog::tap_tempo_focus_out));
tempo_type_change();
}
bool
-TempoDialog::tap_tempo_button_press (GdkEventButton *ev)
+TempoDialog::tap_tempo_key_press (GdkEventKey*)
+{
+ tap_tempo ();
+ return false;
+}
+
+bool
+TempoDialog::tap_tempo_button_press (GdkEventButton* ev)
+{
+ if (ev->type == GDK_2BUTTON_PRESS || ev->type == GDK_3BUTTON_PRESS) {
+ return true;
+ }
+ if (ev->button != 1) {
+ return true;
+ }
+ tap_tempo ();
+ return false; // grab focus
+}
+
+void
+TempoDialog::tap_tempo ()
{
double t;
}
tap_count++;
last_t = t;
-
- return true;
}
bool
return false;
}
-MeterDialog::MeterDialog (TempoMap& map, framepos_t frame, const string&)
+MeterDialog::MeterDialog (TempoMap& map, samplepos_t sample, const string&)
: ArdourDialog (_("New Meter"))
{
- frame = map.round_to_bar(frame, RoundNearest).frame;
- Timecode::BBT_Time when (map.bbt_at_frame (frame));
- Meter meter (map.meter_at_frame (frame));
+ sample = map.round_to_bar(sample, RoundNearest).sample;
+ Timecode::BBT_Time when (map.bbt_at_sample (sample));
+ Meter meter (map.meter_at_sample (sample));
init (when, meter.divisions_per_bar(), meter.note_divisor(), false, MusicTime);
}
MeterDialog::MeterDialog (TempoMap& map, MeterSection& section, const string&)
: ArdourDialog (_("Edit Meter"))
{
- Timecode::BBT_Time when (map.bbt_at_frame (section.frame()));
+ Timecode::BBT_Time when (map.bbt_at_sample (section.sample()));
init (when, section.divisions_per_bar(), section.note_divisor(), section.initial(), section.position_lock_style());
}
void
MeterDialog::note_type_change ()
{
- set_response_sensitive (RESPONSE_ACCEPT, is_user_input_valid());
+ set_response_sensitive (RESPONSE_ACCEPT, is_user_input_valid());
}
void
MeterDialog::lock_style_change ()
{
- set_response_sensitive (RESPONSE_ACCEPT, is_user_input_valid());
+ set_response_sensitive (RESPONSE_ACCEPT, is_user_input_valid());
}
double