using namespace Gtk;
using namespace Gtkmm2ext;
using namespace ARDOUR;
+using namespace PBD;
-TempoDialog::TempoDialog (TempoMap& map, jack_nframes_t frame, const string & action)
+TempoDialog::TempoDialog (TempoMap& map, nframes_t frame, const string & action)
: ArdourDialog ("tempo dialog"),
bpm_frame (_("Beats per minute")),
ok_button (action),
set_name ("MetricDialog");
bpm_entry.signal_activate().connect (bind (mem_fun (*this, &TempoDialog::response), RESPONSE_ACCEPT));
bpm_entry.signal_key_release_event().connect (mem_fun (*this, &TempoDialog::bpm_key_release));
+ bpm_entry.signal_key_press_event().connect (mem_fun (*this, &TempoDialog::bpm_key_press), false);
+}
+
+bool
+TempoDialog::bpm_key_press (GdkEventKey* ev)
+{
+
+switch (ev->keyval) {
+
+ case GDK_0:
+ case GDK_1:
+ case GDK_2:
+ case GDK_3:
+ case GDK_4:
+ case GDK_5:
+ case GDK_6:
+ case GDK_7:
+ case GDK_8:
+ case GDK_9:
+ case GDK_KP_0:
+ case GDK_KP_1:
+ case GDK_KP_2:
+ case GDK_KP_3:
+ case GDK_KP_4:
+ case GDK_KP_5:
+ case GDK_KP_6:
+ case GDK_KP_7:
+ case GDK_KP_8:
+ case GDK_KP_9:
+ case GDK_period:
+ case GDK_comma:
+ case GDK_KP_Delete:
+ case GDK_KP_Enter:
+ case GDK_Delete:
+ case GDK_BackSpace:
+ case GDK_Escape:
+ case GDK_Return:
+ case GDK_Home:
+ case GDK_End:
+ case GDK_Left:
+ case GDK_Right:
+ case GDK_Num_Lock:
+ case GDK_Tab:
+ return FALSE;
+ default:
+ break;
+ }
+
+ return TRUE;
}
bool
}
-MeterDialog::MeterDialog (TempoMap& map, jack_nframes_t frame, const string & action)
+MeterDialog::MeterDialog (TempoMap& map, nframes_t frame, const string & action)
: ArdourDialog ("meter dialog"),
note_frame (_("Meter denominator")),
bpb_frame (_("Beats per bar")),
else
note_types.set_active_text (_("quarter (4)"));
- /* strings.back() just happens to be the longest one to display */
- // GTK2FIX
- //Gtkmm2ext::set_size_request_to_display_given_text (note_types, "thirty-second (32)", 7, 7);
+ /* the string here needs to be the longest one to display */
+ const guint32 FUDGE = 20; // Combo's are stupid - they steal space from the entry for the button
+ Gtkmm2ext::set_size_request_to_display_given_text (note_types, "thirty-second (32)", 7+FUDGE, 7);
hspacer1.set_border_width (5);
hspacer1.pack_start (note_types, false, false);
set_name ("MetricDialog");
bpb_entry.signal_activate().connect (bind (mem_fun (*this, &MeterDialog::response), RESPONSE_ACCEPT));
+ bpb_entry.signal_key_press_event().connect (mem_fun (*this, &MeterDialog::bpb_key_press), false);
bpb_entry.signal_key_release_event().connect (mem_fun (*this, &MeterDialog::bpb_key_release));
note_types.signal_changed().connect (mem_fun (*this, &MeterDialog::note_types_change));
}
+bool
+MeterDialog::bpb_key_press (GdkEventKey* ev)
+{
+
+switch (ev->keyval) {
+
+ case GDK_0:
+ case GDK_1:
+ case GDK_2:
+ case GDK_3:
+ case GDK_4:
+ case GDK_5:
+ case GDK_6:
+ case GDK_7:
+ case GDK_8:
+ case GDK_9:
+ case GDK_KP_0:
+ case GDK_KP_1:
+ case GDK_KP_2:
+ case GDK_KP_3:
+ case GDK_KP_4:
+ case GDK_KP_5:
+ case GDK_KP_6:
+ case GDK_KP_7:
+ case GDK_KP_8:
+ case GDK_KP_9:
+ case GDK_period:
+ case GDK_comma:
+ case GDK_KP_Delete:
+ case GDK_KP_Enter:
+ case GDK_Delete:
+ case GDK_BackSpace:
+ case GDK_Escape:
+ case GDK_Return:
+ case GDK_Home:
+ case GDK_End:
+ case GDK_Left:
+ case GDK_Right:
+ case GDK_Num_Lock:
+ case GDK_Tab:
+ return FALSE;
+ default:
+ break;
+ }
+
+ return TRUE;
+}
+
bool
MeterDialog::bpb_key_release (GdkEventKey* ev)
{