From 39f32134debeb64b1f1cea7f9d00e7074b4f71fa Mon Sep 17 00:00:00 2001 From: Nick Mainsbridge Date: Tue, 25 Apr 2006 00:51:30 +0000 Subject: [PATCH] Small tempo/meter dialog useability changes git-svn-id: svn://localhost/trunk/ardour2@469 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour_ui.cc | 3 +++ gtk2_ardour/tempo_dialog.cc | 44 +++++++++++++++++++++++++++++++++---- gtk2_ardour/tempo_dialog.h | 3 +++ 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index fbd83e9057..1b05d746b4 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -468,6 +468,9 @@ ARDOUR_UI::ask_about_saving_session (const string & what) prompt_label.set_text (prompt); prompt_label.set_name (X_("PrompterLabel")); prompt_label.set_alignment(ALIGN_LEFT, ALIGN_TOP); + + dimage->set_alignment(ALIGN_CENTER, ALIGN_TOP) +; dhbox.set_homogeneous (false); dhbox.pack_start (*dimage, false, false, 5); dhbox.pack_start (prompt_label, true, false, 5); diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc index 1bd0e244be..43c9ece5ba 100644 --- a/gtk2_ardour/tempo_dialog.cc +++ b/gtk2_ardour/tempo_dialog.cc @@ -93,13 +93,28 @@ TempoDialog::init (const BBT_Time& when, double bpm, bool movable) get_vbox()->pack_start (bpm_frame, false, false); - add_button (Stock::OK, RESPONSE_ACCEPT); add_button (Stock::CANCEL, RESPONSE_CANCEL); + add_button (Stock::APPLY, RESPONSE_ACCEPT); + set_response_sensitive (Gtk::RESPONSE_ACCEPT, false); + set_default_response (RESPONSE_ACCEPT); get_vbox()->show_all(); bpm_entry.show(); 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)); +} + +bool +TempoDialog::bpm_key_release (GdkEventKey* ev) +{ + if (bpm_entry.get_text() != "") { + set_response_sensitive (Gtk::RESPONSE_ACCEPT, true); + } else { + set_response_sensitive (Gtk::RESPONSE_ACCEPT, false); + } + return false; } double @@ -197,7 +212,7 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova /* strings.back() just happens to be the longest one to display */ // GTK2FIX - // Gtkmm2ext::set_size_request_to_display_given_text (*(note_types.get_entry()), strings.back(), 7, 7); + //Gtkmm2ext::set_size_request_to_display_given_text (note_types, "thirty-second (32)", 7, 7); hspacer1.set_border_width (5); hspacer1.pack_start (note_types, false, false); @@ -243,7 +258,6 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova get_vbox()->pack_start (when_frame, false, false); } - get_vbox()->pack_start (bpb_frame, false, false); get_vbox()->pack_start (note_frame, false, false); @@ -251,13 +265,35 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova note_frame.set_name ("MetricDialogFrame"); bpb_entry.set_name ("MetricEntry"); - add_button (Stock::OK, RESPONSE_ACCEPT); add_button (Stock::CANCEL, RESPONSE_CANCEL); + add_button (Stock::APPLY, RESPONSE_ACCEPT); + set_response_sensitive (RESPONSE_ACCEPT, false); + set_default_response (RESPONSE_ACCEPT); get_vbox()->show_all (); bpb_entry.show (); set_name ("MetricDialog"); + bpb_entry.signal_activate().connect (bind (mem_fun (*this, &MeterDialog::response), RESPONSE_ACCEPT)); + 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_release (GdkEventKey* ev) +{ + if (bpb_entry.get_text() != "") { + set_response_sensitive (RESPONSE_ACCEPT, true); + } else { + set_response_sensitive (RESPONSE_ACCEPT, false); + } + return false; +} + +void +MeterDialog::note_types_change () +{ + set_response_sensitive (Gtk::RESPONSE_ACCEPT, true); } double diff --git a/gtk2_ardour/tempo_dialog.h b/gtk2_ardour/tempo_dialog.h index 6f9b51dbca..4d41e2250c 100644 --- a/gtk2_ardour/tempo_dialog.h +++ b/gtk2_ardour/tempo_dialog.h @@ -41,6 +41,7 @@ struct TempoDialog : public ArdourDialog private: void init (const ARDOUR::BBT_Time& start, double, bool); + bool bpm_key_release (GdkEventKey* ); }; struct MeterDialog : public ArdourDialog @@ -73,6 +74,8 @@ struct MeterDialog : public ArdourDialog private: void init (const ARDOUR::BBT_Time&, double, double, bool); + bool bpb_key_release (GdkEventKey* ); + void note_types_change (); }; #endif /* __ardour_gtk_tempo_dialog_h__ */