new keyboard bindings for moving playhead to region starts+ends ; use spin button for tempo, as per #1449

git-svn-id: svn://localhost/ardour2/trunk@1409 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2007-02-02 20:55:16 +00:00
parent 182bc69eac
commit dfc75e0561
5 changed files with 39 additions and 81 deletions

View File

@ -9,7 +9,7 @@
; (gtk_accel_path "<Actions>/JACK/JACKReconnect" "")
; (gtk_accel_path "<Actions>/Editor/Autoconnect" "")
; (gtk_accel_path "<Actions>/Editor/Edit" "")
(gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-end" "<Control>grave")
(gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-end" "<Control>comma")
; (gtk_accel_path "<Actions>/redirectmenu/copy" "")
; (gtk_accel_path "<Actions>/options/MeterFalloffFaster" "")
(gtk_accel_path "<Actions>/Transport/ToggleRollForgetCapture" "<Control>space")
@ -23,7 +23,7 @@
; (gtk_accel_path "<Actions>/options/MeterFalloffSlow" "")
; (gtk_accel_path "<Actions>/RegionList/rlHide" "")
; (gtk_accel_path "<Actions>/Main/Metering" "")
(gtk_accel_path "<Actions>/Editor/playhead-to-next-region-end" "<Control>Tab")
(gtk_accel_path "<Actions>/Editor/playhead-to-next-region-end" "<Control>period")
; (gtk_accel_path "<Actions>/Zoom/zoom-focus-playhead" "")
; (gtk_accel_path "<Actions>/Editor/center-edit-cursor" "")
; (gtk_accel_path "<Actions>/Editor/Monitoring" "")
@ -61,7 +61,7 @@
(gtk_accel_path "<Actions>/Editor/jump-backward-to-mark" "<Control>KP_Left")
; (gtk_accel_path "<Actions>/Main/AudioFileFormatData" "")
; (gtk_accel_path "<Actions>/options/MeterFalloffFastest" "")
(gtk_accel_path "<Actions>/Editor/audition-at-mouse" "period")
; (gtk_accel_path "<Actions>/Editor/audition-at-mouse" "")
(gtk_accel_path "<Actions>/Transport/Forward" "<Control>rightarrow")
; (gtk_accel_path "<Actions>/Snap/snap-to-smpte-seconds" "")
; (gtk_accel_path "<Actions>/Snap/snap-to-smpte-frame" "")
@ -93,7 +93,7 @@
(gtk_accel_path "<Actions>/Editor/set-edit-cursor" "e")
; (gtk_accel_path "<Actions>/Editor/Smpte30drop" "")
; (gtk_accel_path "<Actions>/Zoom/zoom-focus-edit" "")
(gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-start" "grave")
(gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-start" "comma")
; (gtk_accel_path "<Actions>/Editor/EditCursorMovementOptions" "")
; (gtk_accel_path "<Actions>/redirectmenu/activate_all" "")
; (gtk_accel_path "<Actions>/Editor/addExternalAudioAsTapeTrack" "")
@ -112,6 +112,7 @@
(gtk_accel_path "<Actions>/Editor/extend-range-to-end-of-region" "rightanglebracket")
(gtk_accel_path "<Actions>/Editor/scroll-backward" "leftarrow")
(gtk_accel_path "<Actions>/Editor/start-range" "<Control>KP_Down")
; (gtk_accel_path "<Actions>/Editor/ToggleTranzportSurface" "")
; (gtk_accel_path "<Actions>/ShuttleActions/SetShuttleUnitsSemitones" "")
; (gtk_accel_path "<Actions>/JACK/JACKLatency128" "")
; (gtk_accel_path "<Actions>/Snap/snap-to-beat" "")
@ -272,7 +273,7 @@
; (gtk_accel_path "<Actions>/options/VerifyRemoveLastCapture" "")
; (gtk_accel_path "<Actions>/options/OutputAutoConnectPhysical" "")
(gtk_accel_path "<Actions>/Editor/step-tracks-up" "uparrow")
(gtk_accel_path "<Actions>/Editor/playhead-to-next-region-start" "Tab")
(gtk_accel_path "<Actions>/Editor/playhead-to-next-region-start" "period")
; (gtk_accel_path "<Actions>/options/SendMMC" "")
; (gtk_accel_path "<Actions>/Editor/toggle-auto-xfades" "")
; (gtk_accel_path "<Actions>/Main/AudioFileFormatHeader" "")

View File

@ -126,7 +126,7 @@ Editor::register_actions ()
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "jump-backward-to-mark", _("Jump Backward to Mark"), mem_fun(*this, &Editor::jump_backward_to_mark));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "add-location-from-playhead", _("Add Location from Playhead"), mem_fun(*this, &Editor::add_location_from_playhead_cursor));
act = ActionManager::register_action (editor_actions, "add-location-from-playhead", _("Add Mark from Playhead"), mem_fun(*this, &Editor::add_location_from_playhead_cursor));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "nudge-forward", _("Nudge Forward"), bind (mem_fun(*this, &Editor::nudge_forward), false));

View File

@ -14,7 +14,9 @@ using namespace ARDOUR;
using namespace PBD;
TempoDialog::TempoDialog (TempoMap& map, nframes_t frame, const string & action)
: ArdourDialog ("tempo dialog"),
: ArdourDialog (_("edit tempo")),
bpm_adjustment (60.0, 1.0, 999.9, 0.1, 1.0, 1.0),
bpm_spinner (bpm_adjustment),
bpm_frame (_("Beats per minute")),
ok_button (action),
cancel_button (_("Cancel")),
@ -32,6 +34,8 @@ TempoDialog::TempoDialog (TempoMap& map, nframes_t frame, const string & action)
TempoDialog::TempoDialog (TempoSection& section, const string & action)
: ArdourDialog ("tempo dialog"),
bpm_adjustment (60.0, 1.0, 999.9, 0.1, 1.0, 1.0),
bpm_spinner (bpm_adjustment),
bpm_frame (_("Beats per minute")),
ok_button (action),
cancel_button (_("Cancel")),
@ -46,12 +50,13 @@ TempoDialog::TempoDialog (TempoSection& section, const string & action)
void
TempoDialog::init (const BBT_Time& when, double bpm, bool movable)
{
snprintf (buf, sizeof (buf), "%.2f", bpm);
bpm_entry.set_text (buf);
bpm_entry.select_region (0, -1);
bpm_spinner.set_numeric (true);
bpm_spinner.set_digits (1);
bpm_spinner.set_wrap (true);
bpm_spinner.set_value (bpm);
hspacer1.set_border_width (5);
hspacer1.pack_start (bpm_entry, false, false);
hspacer1.pack_start (bpm_spinner, false, false);
vspacer1.set_border_width (5);
vspacer1.pack_start (hspacer1, false, false);
@ -90,7 +95,7 @@ TempoDialog::init (const BBT_Time& when, double bpm, bool movable)
}
bpm_frame.set_name ("MetricDialogFrame");
bpm_entry.set_name ("MetricEntry");
bpm_spinner.set_name ("MetricEntry");
get_vbox()->pack_start (bpm_frame, false, false);
@ -100,83 +105,34 @@ TempoDialog::init (const BBT_Time& when, double bpm, bool movable)
set_default_response (RESPONSE_ACCEPT);
get_vbox()->show_all();
bpm_entry.show();
bpm_spinner.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));
bpm_entry.signal_key_press_event().connect (mem_fun (*this, &TempoDialog::bpm_key_press), false);
bpm_spinner.signal_activate().connect (bind (mem_fun (*this, &TempoDialog::response), RESPONSE_ACCEPT));
bpm_spinner.signal_button_press_event().connect (mem_fun (*this, &TempoDialog::bpm_button_press), false);
bpm_spinner.signal_button_release_event().connect (mem_fun (*this, &TempoDialog::bpm_button_release), false);
}
bool
TempoDialog::bpm_key_press (GdkEventKey* ev)
TempoDialog::bpm_button_press (GdkEventButton* 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;
return false;
}
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);
}
TempoDialog::bpm_button_release (GdkEventButton* ev)
{
/* the value has been modified, accept should work now */
set_response_sensitive (Gtk::RESPONSE_ACCEPT, true);
return false;
}
double
TempoDialog::get_bpm ()
{
double bpm;
if (sscanf (bpm_entry.get_text().c_str(), "%lf", &bpm) != 1) {
return 0;
}
return bpm;
return bpm_spinner.get_value ();
}
bool

View File

@ -8,6 +8,7 @@
#include <gtkmm/label.h>
#include <gtkmm/table.h>
#include <gtkmm/entry.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/comboboxtext.h>
#include <ardour/types.h>
@ -17,8 +18,9 @@
struct TempoDialog : public ArdourDialog
{
Gtk::Entry bpm_entry;
Gtk::Frame bpm_frame;
Gtk::Adjustment bpm_adjustment;
Gtk::SpinButton bpm_spinner;
Gtk::Frame bpm_frame;
Gtk::VBox vpacker;
Gtk::Button ok_button;
Gtk::Button cancel_button;
@ -41,8 +43,9 @@ struct TempoDialog : public ArdourDialog
private:
void init (const ARDOUR::BBT_Time& start, double, bool);
bool bpm_key_press (GdkEventKey* );
bool bpm_key_release (GdkEventKey* );
void bpm_changed ();
bool bpm_button_press (GdkEventButton* );
bool bpm_button_release (GdkEventButton* );
};
struct MeterDialog : public ArdourDialog

View File

@ -656,8 +656,6 @@ Session::locate (nframes_t target_frame, bool with_roll, bool with_flush, bool w
} else {
cerr << "butler not requested\n";
/* this is functionally what clear_clicks() does but with a tentative lock */
Glib::RWLock::WriterLock clickm (click_lock, Glib::TRY_LOCK);