diff --git a/gtk2_ardour/ardour-sae.menus b/gtk2_ardour/ardour-sae.menus
index 0c84bcc114..96033d8b76 100644
--- a/gtk2_ardour/ardour-sae.menus
+++ b/gtk2_ardour/ardour-sae.menus
@@ -56,7 +56,6 @@
-
@@ -115,9 +114,6 @@
-
-
+
@@ -324,6 +389,15 @@
+
+
+
+
+
+
+
+
+
@@ -419,31 +493,27 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h
index d8a4109923..605cb97700 100644
--- a/gtk2_ardour/ardour_ui.h
+++ b/gtk2_ardour/ardour_ui.h
@@ -726,6 +726,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
void toggle_ShowTrackMeters ();
void toggle_use_narrow_ms();
void toggle_rubberbanding_snaps_to_grid ();
+ void toggle_auto_analyse_audio ();
void toggle_TapeMachineMode();
void mtc_port_changed ();
diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc
index 8eec76956c..cfdabc5b3a 100644
--- a/gtk2_ardour/ardour_ui_ed.cc
+++ b/gtk2_ardour/ardour_ui_ed.cc
@@ -94,8 +94,8 @@ ARDOUR_UI::install_actions ()
ActionManager::register_action (main_actions, X_("Help"), _("Help"));
ActionManager::register_action (main_actions, X_("KeyMouseActions"), _("Misc. Shortcuts"));
ActionManager::register_action (main_actions, X_("AudioFileFormat"), _("Audio File Format"));
- ActionManager::register_action (main_actions, X_("AudioFileFormatHeader"), _("Header"));
- ActionManager::register_action (main_actions, X_("AudioFileFormatData"), _("Data"));
+ ActionManager::register_action (main_actions, X_("AudioFileFormatHeader"), _("File Type"));
+ ActionManager::register_action (main_actions, X_("AudioFileFormatData"), _("Sample Format"));
ActionManager::register_action (main_actions, X_("ControlSurfaces"), _("Control Surfaces"));
ActionManager::register_action (main_actions, X_("Metering"), _("Metering"));
ActionManager::register_action (main_actions, X_("MeteringFallOffRate"), _("Fall off rate"));
@@ -453,6 +453,7 @@ ARDOUR_UI::install_actions ()
ActionManager::register_toggle_action (option_actions, X_("ShowTrackMeters"), _("Enable Editor Meters"), mem_fun (*this, &ARDOUR_UI::toggle_ShowTrackMeters));
ActionManager::register_toggle_action (option_actions, X_("OnlyCopyImportedFiles"), _("Always copy imported files"), mem_fun (*this, &ARDOUR_UI::toggle_only_copy_imported_files));
ActionManager::register_toggle_action (option_actions, X_("RubberbandingSnapsToGrid"), _("Rubberbanding Snaps to Grid"), mem_fun (*this, &ARDOUR_UI::toggle_rubberbanding_snaps_to_grid));
+ ActionManager::register_toggle_action (option_actions, X_("AutoAnalyseAudio"), _("Auto-analyse new audio"), mem_fun (*this, &ARDOUR_UI::toggle_auto_analyse_audio));
ActionManager::register_toggle_action (option_actions, X_("DefaultNarrowMS"), _("Use narrow mixer strips"), mem_fun (*this, &ARDOUR_UI::toggle_use_narrow_ms));
@@ -533,8 +534,8 @@ ARDOUR_UI::install_actions ()
RadioAction::Group file_data_group;
act = ActionManager::register_radio_action (option_actions, file_data_group, X_("FileDataFormatFloat"), X_("32-bit floating point"), bind (mem_fun (*this, &ARDOUR_UI::set_native_file_data_format), ARDOUR::FormatFloat));
- act = ActionManager::register_radio_action (option_actions, file_data_group, X_("FileDataFormat24bit"), X_("24-bit signed integer"), bind (mem_fun (*this, &ARDOUR_UI::set_native_file_data_format), ARDOUR::FormatInt24));
- act = ActionManager::register_radio_action (option_actions, file_data_group, X_("FileDataFormat16bit"), X_("16-bit signed integer"), bind (mem_fun (*this, &ARDOUR_UI::set_native_file_data_format), ARDOUR::FormatInt16));
+ act = ActionManager::register_radio_action (option_actions, file_data_group, X_("FileDataFormat24bit"), X_("24-bit integer"), bind (mem_fun (*this, &ARDOUR_UI::set_native_file_data_format), ARDOUR::FormatInt24));
+ act = ActionManager::register_radio_action (option_actions, file_data_group, X_("FileDataFormat16bit"), X_("16-bit integer"), bind (mem_fun (*this, &ARDOUR_UI::set_native_file_data_format), ARDOUR::FormatInt16));
RadioAction::Group monitoring_group;
diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc
index 9223c8b459..7b91410e15 100644
--- a/gtk2_ardour/ardour_ui_options.cc
+++ b/gtk2_ardour/ardour_ui_options.cc
@@ -583,6 +583,12 @@ ARDOUR_UI::toggle_rubberbanding_snaps_to_grid ()
ActionManager::toggle_config_state ("options", "RubberbandingSnapsToGrid", &Configuration::set_rubberbanding_snaps_to_grid, &Configuration::get_rubberbanding_snaps_to_grid);
}
+void
+ARDOUR_UI::toggle_auto_analyse_audio ()
+{
+ ActionManager::toggle_config_state ("options", "AutoAnalyseAudio", &Configuration::set_auto_analyse_audio, &Configuration::get_auto_analyse_audio);
+}
+
void
ARDOUR_UI::mtc_port_changed ()
{
diff --git a/gtk2_ardour/draginfo.h b/gtk2_ardour/draginfo.h
index bd6313d970..4b91fa6c1b 100644
--- a/gtk2_ardour/draginfo.h
+++ b/gtk2_ardour/draginfo.h
@@ -44,6 +44,7 @@ struct DragInfo {
nframes64_t grab_frame;
nframes64_t last_pointer_frame;
nframes64_t current_pointer_frame;
+ double original_x, original_y;
double grab_x, grab_y;
double cumulative_x_drag;
double cumulative_y_drag;
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index ae97df9011..b971071acd 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -268,6 +268,8 @@ Editor::Editor ()
bbt_beat_subdivision = 4;
canvas_width = 0;
canvas_height = 0;
+ last_autoscroll_x = 0;
+ last_autoscroll_y = 0;
autoscroll_active = false;
autoscroll_timeout_tag = -1;
interthread_progress_window = 0;
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index ca5ab79bda..6122807fb6 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -1194,6 +1194,7 @@ class Editor : public PublicEditor
int scrubbing_direction;
int scrub_reversals;
int scrub_reverse_distance;
+ void scrub ();
void keyboard_selection_begin ();
void keyboard_selection_finish (bool add);
@@ -1218,6 +1219,8 @@ class Editor : public PublicEditor
void start_grab (GdkEvent*, Gdk::Cursor* cursor = 0);
bool end_grab (ArdourCanvas::Item*, GdkEvent*);
void swap_grab (ArdourCanvas::Item*, Gdk::Cursor* cursor, uint32_t time);
+ void break_drag ();
+ void finalize_drag ();
Gtk::Menu fade_context_menu;
void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
@@ -1727,15 +1730,19 @@ public:
bool autoscroll_active;
int autoscroll_timeout_tag;
- int autoscroll_direction;
+ int autoscroll_x;
+ int autoscroll_y;
+ int last_autoscroll_x;
+ int last_autoscroll_y;
uint32_t autoscroll_cnt;
- nframes_t autoscroll_distance;
+ nframes_t autoscroll_x_distance;
+ double autoscroll_y_distance;
static gint _autoscroll_canvas (void *);
bool autoscroll_canvas ();
- void start_canvas_autoscroll (int direction);
+ void start_canvas_autoscroll (int x, int y);
void stop_canvas_autoscroll ();
- void maybe_autoscroll (GdkEvent*);
+ void maybe_autoscroll (GdkEventMotion*);
/* trimming */
enum TrimOp {
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index fdcce41e68..e11f47a082 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -61,6 +61,7 @@ Editor::register_actions ()
ActionManager::register_action (editor_actions, X_("MarkerMenu"), _("Markers"));
ActionManager::register_action (editor_actions, X_("MeterFalloff"), _("Meter falloff"));
ActionManager::register_action (editor_actions, X_("MeterHold"), _("Meter hold"));
+ ActionManager::register_action (editor_actions, X_("MiscOptions"), _("Misc Options"));
ActionManager::register_action (editor_actions, X_("Monitoring"), _("Monitoring"));
ActionManager::register_action (editor_actions, X_("MoveActiveMarkMenu"), _("Active Mark"));
ActionManager::register_action (editor_actions, X_("MovePlayHeadMenu"), _("Playhead"));
@@ -94,9 +95,8 @@ Editor::register_actions ()
ActionManager::register_action (editor_actions, X_("ZoomMenu"), _("Zoom"));
ActionManager::register_action (editor_actions, X_("ZoomFocusMenu"), _("Zoom Focus"));
- /* add named actions for the editor */
-
ActionManager::register_toggle_action (editor_actions, "link-region-and-track-selection", _("Link Region/Track Selection"), mem_fun (*this, &Editor::toggle_link_region_and_track_selection));
+ ActionManager::register_action (editor_actions, "break-drag", _("Break drag"), mem_fun (*this, &Editor::break_drag));
act = ActionManager::register_toggle_action (editor_actions, "show-editor-mixer", _("Show Editor Mixer"), mem_fun (*this, &Editor::editor_mixer_button_toggled));
ActionManager::session_sensitive_actions.push_back (act);
@@ -174,16 +174,12 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "select-all-before-edit-cursor", _("Select All Before Edit Point"), bind (mem_fun(*this, &Editor::select_all_selectables_using_edit), false));
ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (editor_actions, "select-all-after-playhead", _("Select All After Playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, true));
+ act = ActionManager::register_action (editor_actions, "select-all-between-cursors", _("Select All Overlapping Edit Range"), bind (mem_fun(*this, &Editor::select_all_selectables_between), false));
ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (editor_actions, "select-all-before-playhead", _("Select All Before Playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, false));
- ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (editor_actions, "select-all-between-cursors", _("Select All Between Playhead & Edit Point"), bind (mem_fun(*this, &Editor::select_all_selectables_between), false));
- ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (editor_actions, "select-all-within-cursors", _("Select All Within Playhead & Edit Point"), bind (mem_fun(*this, &Editor::select_all_selectables_between), true));
+ act = ActionManager::register_action (editor_actions, "select-all-within-cursors", _("Select All Inside Edit Range"), bind (mem_fun(*this, &Editor::select_all_selectables_between), true));
ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (editor_actions, "select-range-between-cursors", _("Select Range Between Playhead & Edit Point"), mem_fun(*this, &Editor::select_range_between));
+ act = ActionManager::register_action (editor_actions, "select-range-between-cursors", _("Select Edit Range"), mem_fun(*this, &Editor::select_range_between));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "select-all-in-punch-range", _("Select All in Punch Range"), mem_fun(*this, &Editor::select_all_selectables_using_punch));
@@ -362,7 +358,7 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "set-playhead", _("Playhead to Mouse"), mem_fun(*this, &Editor::set_playhead_cursor));
ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_action (editor_actions, "set-edit-point", _("Edit Point to Mouse"), mem_fun(*this, &Editor::set_edit_point));
+ act = ActionManager::register_action (editor_actions, "set-edit-point", _("Active Marker to Mouse"), mem_fun(*this, &Editor::set_edit_point));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "duplicate-region", _("Duplicate Region"), bind (mem_fun(*this, &Editor::duplicate_dialog), false));
@@ -466,6 +462,7 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "set-tempo-from-region", _("Set Tempo from Region=Bar"), mem_fun(*this, &Editor::use_region_as_bar));
ActionManager::session_sensitive_actions.push_back (act);
+ ActionManager::region_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "set-tempo-from-edit-range", _("Set Tempo from Edit Range=Bar"), mem_fun(*this, &Editor::use_range_as_bar));
ActionManager::session_sensitive_actions.push_back (act);
@@ -683,9 +680,9 @@ Editor::register_actions ()
/* the next two are duplicate items with different names for use in two different contexts */
- ActionManager::register_action (editor_actions, X_("addExistingAudioFiles"), _("Add Existing Audio"), mem_fun (*this, &Editor::external_audio_dialog));
+ ActionManager::register_action (editor_actions, X_("addExistingAudioFiles"), _("Import"), mem_fun (*this, &Editor::external_audio_dialog));
- act = ActionManager::register_action (editor_actions, X_("addExternalAudioToRegionList"), _("Add External Audio"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportAsRegion));
+ act = ActionManager::register_action (editor_actions, X_("addExternalAudioToRegionList"), _("Import to Region List"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportAsRegion));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::register_toggle_action (editor_actions, X_("toggle-waveform-visible"), _("Show Waveforms"), mem_fun (*this, &Editor::toggle_waveform_visibility));
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index 1b0e7a1257..68faff59b8 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -552,47 +552,52 @@ Editor::drop_regions (const RefPtr& context,
}
void
-Editor::maybe_autoscroll (GdkEvent* event)
+Editor::maybe_autoscroll (GdkEventMotion* event)
{
nframes_t rightmost_frame = leftmost_frame + current_page_frames();
nframes_t frame = drag_info.current_pointer_frame;
bool startit = false;
+ double vertical_pos = vertical_adjustment.get_value();
- static int last_autoscroll_direction = 0;
+ autoscroll_y = 0;
+ autoscroll_x = 0;
+
+ if (event->y < vertical_pos) {
+ autoscroll_y = -1;
+ startit = true;
+ }
+
+ if (event->y > vertical_pos + canvas_height) {
+ autoscroll_y = 1;
+ startit = true;
+ }
if (frame > rightmost_frame) {
if (rightmost_frame < max_frames) {
- autoscroll_direction = 1;
+ autoscroll_x = 1;
startit = true;
}
} else if (frame < leftmost_frame) {
-
+
if (leftmost_frame > 0) {
- autoscroll_direction = -1;
+ autoscroll_x = -1;
startit = true;
}
- } else {
-
- if (drag_info.last_pointer_frame > drag_info.current_pointer_frame) {
- autoscroll_direction = -1;
- } else {
- autoscroll_direction = 1;
- }
}
-
- if ((autoscroll_direction != last_autoscroll_direction) || (leftmost_frame < frame < rightmost_frame)) {
+ if ((autoscroll_x != last_autoscroll_x) || (autoscroll_y != last_autoscroll_y) || (autoscroll_x == 0 && autoscroll_y == 0)) {
stop_canvas_autoscroll ();
}
if (startit && autoscroll_timeout_tag < 0) {
- start_canvas_autoscroll (autoscroll_direction);
+ start_canvas_autoscroll (autoscroll_x, autoscroll_y);
}
- last_autoscroll_direction = autoscroll_direction;
+ last_autoscroll_x = autoscroll_x;
+ last_autoscroll_y = autoscroll_y;
}
gint
@@ -608,21 +613,64 @@ Editor::autoscroll_canvas ()
nframes_t limit = max_frames - current_page_frames();
GdkEventMotion ev;
nframes_t target_frame;
+ double new_pixel;
+ double target_pixel;
- if (autoscroll_direction < 0) {
- if (leftmost_frame < autoscroll_distance) {
+ if (autoscroll_x < 0) {
+ if (leftmost_frame < autoscroll_x_distance) {
new_frame = 0;
} else {
- new_frame = leftmost_frame - autoscroll_distance;
+ new_frame = leftmost_frame - autoscroll_x_distance;
}
- target_frame = drag_info.current_pointer_frame - autoscroll_distance;
- } else {
- if (leftmost_frame > limit - autoscroll_distance) {
+ target_frame = drag_info.current_pointer_frame - autoscroll_x_distance;
+ } else if (autoscroll_x > 0) {
+ if (leftmost_frame > limit - autoscroll_x_distance) {
new_frame = limit;
} else {
- new_frame = leftmost_frame + autoscroll_distance;
+ new_frame = leftmost_frame + autoscroll_x_distance;
}
- target_frame = drag_info.current_pointer_frame + autoscroll_distance;
+ target_frame = drag_info.current_pointer_frame + autoscroll_x_distance;
+ } else {
+ target_frame = drag_info.current_pointer_frame;
+ new_frame = leftmost_frame;
+ }
+
+ double vertical_pos = vertical_adjustment.get_value();
+
+ if (autoscroll_y < 0) {
+
+ if (vertical_pos < autoscroll_y_distance) {
+ new_pixel = 0;
+ } else {
+ new_pixel = vertical_pos - autoscroll_y_distance;
+ }
+
+ target_pixel = drag_info.current_pointer_y - autoscroll_y_distance;
+ target_pixel = max (target_pixel, 0.0);
+
+ } else if (autoscroll_y > 0) {
+
+ double top_of_bottom_of_canvas = full_canvas_height - canvas_height;
+
+ if (vertical_pos > full_canvas_height - autoscroll_y_distance) {
+ new_pixel = full_canvas_height;
+ } else {
+ new_pixel = vertical_pos + autoscroll_y_distance;
+ }
+
+ new_pixel = min (top_of_bottom_of_canvas, new_pixel);
+
+ target_pixel = drag_info.current_pointer_y + autoscroll_y_distance;
+
+ /* don't move to the full canvas height because the item will be invisible
+ (its top edge will line up with the bottom of the visible canvas.
+ */
+
+ target_pixel = min (target_pixel, full_canvas_height - 10);
+
+ } else {
+ target_pixel = drag_info.current_pointer_y;
+ new_pixel = vertical_pos;
}
/* now fake a motion event to get the object that is being dragged to move too */
@@ -630,10 +678,10 @@ Editor::autoscroll_canvas ()
ev.type = GDK_MOTION_NOTIFY;
ev.state &= Gdk::BUTTON1_MASK;
ev.x = frame_to_unit (target_frame);
- ev.y = drag_info.current_pointer_y;
+ ev.y = target_pixel;
motion_handler (drag_info.item, (GdkEvent*) &ev, drag_info.item_type, true);
- if (new_frame == 0 || new_frame == limit) {
+ if ((new_frame == 0 || new_frame == limit) && (new_pixel == 0 || new_pixel == DBL_MAX)) {
/* we are done */
return false;
}
@@ -653,29 +701,54 @@ Editor::autoscroll_canvas ()
reset_x_origin (new_frame);
}
- if (autoscroll_cnt == 50) { /* 0.5 seconds */
-
- /* after about a while, speed up a bit by changing the timeout interval */
+ vertical_adjustment.set_value (new_pixel);
- autoscroll_distance = (nframes_t) floor (current_page_frames()/30.0f);
-
- } else if (autoscroll_cnt == 150) { /* 1.0 seconds */
+ if (autoscroll_x_distance != 0) {
- autoscroll_distance = (nframes_t) floor (current_page_frames()/20.0f);
+ if (autoscroll_cnt == 50) { /* 0.5 seconds */
+
+ /* after about a while, speed up a bit by changing the timeout interval */
+
+ autoscroll_x_distance = (nframes_t) floor (current_page_frames()/30.0f);
+
+ } else if (autoscroll_cnt == 150) { /* 1.0 seconds */
+
+ autoscroll_x_distance = (nframes_t) floor (current_page_frames()/20.0f);
+
+ } else if (autoscroll_cnt == 300) { /* 1.5 seconds */
+
+ /* after about another while, speed up by increasing the shift per callback */
+
+ autoscroll_x_distance = (nframes_t) floor (current_page_frames()/10.0f);
+
+ }
+ }
- } else if (autoscroll_cnt == 300) { /* 1.5 seconds */
+ if (autoscroll_y_distance != 0) {
- /* after about another while, speed up by increasing the shift per callback */
-
- autoscroll_distance = (nframes_t) floor (current_page_frames()/10.0f);
-
- }
+ if (autoscroll_cnt == 50) { /* 0.5 seconds */
+
+ /* after about a while, speed up a bit by changing the timeout interval */
+
+ autoscroll_y_distance = 10;
+
+ } else if (autoscroll_cnt == 150) { /* 1.0 seconds */
+
+ autoscroll_y_distance = 20;
+
+ } else if (autoscroll_cnt == 300) { /* 1.5 seconds */
+
+ /* after about another while, speed up by increasing the shift per callback */
+
+ autoscroll_y_distance = 40;
+ }
+ }
return true;
}
void
-Editor::start_canvas_autoscroll (int dir)
+Editor::start_canvas_autoscroll (int dx, int dy)
{
if (!session || autoscroll_active) {
return;
@@ -684,8 +757,10 @@ Editor::start_canvas_autoscroll (int dir)
stop_canvas_autoscroll ();
autoscroll_active = true;
- autoscroll_direction = dir;
- autoscroll_distance = (nframes_t) floor (current_page_frames()/50.0);
+ autoscroll_x = dx;
+ autoscroll_y = dy;
+ autoscroll_x_distance = (nframes_t) floor (current_page_frames()/50.0);
+ autoscroll_y_distance = fabs (dy * 5); /* pixels */
autoscroll_cnt = 0;
/* do it right now, which will start the repeated callbacks */
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index 3064bf31d4..b3343c42c3 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -1531,6 +1531,85 @@ Editor::left_automation_track ()
return false;
}
+void
+Editor::scrub ()
+{
+ double delta;
+
+ if (scrubbing_direction == 0) {
+ /* first move */
+ session->request_locate (drag_info.current_pointer_frame, false);
+ session->request_transport_speed (0.1);
+ scrubbing_direction = 1;
+
+ } else {
+
+ if (last_scrub_x > drag_info.current_pointer_x) {
+
+ /* pointer moved to the left */
+
+ if (scrubbing_direction > 0) {
+
+ /* we reversed direction to go backwards */
+
+ scrub_reversals++;
+ scrub_reverse_distance += (int) (last_scrub_x - drag_info.current_pointer_x);
+
+ } else {
+
+ /* still moving to the left (backwards) */
+
+ scrub_reversals = 0;
+ scrub_reverse_distance = 0;
+
+ delta = 0.01 * (last_scrub_x - drag_info.current_pointer_x);
+ session->request_transport_speed (session->transport_speed() - delta);
+ }
+
+ } else {
+ /* pointer moved to the right */
+
+ if (scrubbing_direction < 0) {
+ /* we reversed direction to go forward */
+
+ scrub_reversals++;
+ scrub_reverse_distance += (int) (drag_info.current_pointer_x - last_scrub_x);
+
+ } else {
+ /* still moving to the right */
+
+ scrub_reversals = 0;
+ scrub_reverse_distance = 0;
+
+ delta = 0.01 * (drag_info.current_pointer_x - last_scrub_x);
+ session->request_transport_speed (session->transport_speed() + delta);
+ }
+ }
+
+ /* if there have been more than 2 opposite motion moves detected, or one that moves
+ back more than 10 pixels, reverse direction
+ */
+
+ if (scrub_reversals >= 2 || scrub_reverse_distance > 10) {
+
+ if (scrubbing_direction > 0) {
+ /* was forwards, go backwards */
+ session->request_transport_speed (-0.1);
+ scrubbing_direction = -1;
+ } else {
+ /* was backwards, go forwards */
+ session->request_transport_speed (0.1);
+ scrubbing_direction = 1;
+ }
+
+ scrub_reverse_distance = 0;
+ scrub_reversals = 0;
+ }
+ }
+
+ last_scrub_x = drag_info.current_pointer_x;
+}
+
bool
Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type, bool from_autoscroll)
{
@@ -1547,7 +1626,7 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item
*/
track_canvas->get_pointer (x, y);
- }
+ }
if (current_stepping_trackview) {
/* don't keep the persistent stepped trackview if the mouse moves */
@@ -1566,85 +1645,13 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item
drag_info.current_pointer_frame = event_frame (event, &drag_info.current_pointer_x,
&drag_info.current_pointer_y);
+
switch (mouse_mode) {
case MouseAudition:
if (_scrubbing) {
-
- double delta;
-
- if (scrubbing_direction == 0) {
- /* first move */
- session->request_locate (drag_info.current_pointer_frame, false);
- session->request_transport_speed (0.1);
- scrubbing_direction = 1;
-
- } else {
-
- if (last_scrub_x > drag_info.current_pointer_x) {
-
- /* pointer moved to the left */
-
- if (scrubbing_direction > 0) {
-
- /* we reversed direction to go backwards */
-
- scrub_reversals++;
- scrub_reverse_distance += (int) (last_scrub_x - drag_info.current_pointer_x);
-
- } else {
-
- /* still moving to the left (backwards) */
-
- scrub_reversals = 0;
- scrub_reverse_distance = 0;
-
- delta = 0.01 * (last_scrub_x - drag_info.current_pointer_x);
- session->request_transport_speed (session->transport_speed() - delta);
- }
-
- } else {
- /* pointer moved to the right */
-
- if (scrubbing_direction < 0) {
- /* we reversed direction to go forward */
-
- scrub_reversals++;
- scrub_reverse_distance += (int) (drag_info.current_pointer_x - last_scrub_x);
-
- } else {
- /* still moving to the right */
-
- scrub_reversals = 0;
- scrub_reverse_distance = 0;
-
- delta = 0.01 * (drag_info.current_pointer_x - last_scrub_x);
- session->request_transport_speed (session->transport_speed() + delta);
- }
- }
-
- /* if there have been more than 2 opposite motion moves detected, or one that moves
- back more than 10 pixels, reverse direction
- */
-
- if (scrub_reversals >= 2 || scrub_reverse_distance > 10) {
-
- if (scrubbing_direction > 0) {
- /* was forwards, go backwards */
- session->request_transport_speed (-0.1);
- scrubbing_direction = -1;
- } else {
- /* was backwards, go forwards */
- session->request_transport_speed (0.1);
- scrubbing_direction = 1;
- }
-
- scrub_reverse_distance = 0;
- scrub_reversals = 0;
- }
- }
-
- last_scrub_x = drag_info.current_pointer_x;
+ scrub ();
}
+ break;
default:
break;
@@ -1700,7 +1707,7 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item
if (drag_info.item && (event->motion.state & Gdk::BUTTON1_MASK ||
(event->motion.state & Gdk::BUTTON2_MASK))) {
if (!from_autoscroll) {
- maybe_autoscroll (event);
+ maybe_autoscroll (&event->motion);
}
(this->*(drag_info.motion_callback)) (item, event);
goto handled;
@@ -1719,7 +1726,7 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item
if (drag_info.item && (event->motion.state & GDK_BUTTON1_MASK ||
(event->motion.state & GDK_BUTTON2_MASK))) {
if (!from_autoscroll) {
- maybe_autoscroll (event);
+ maybe_autoscroll (&event->motion);
}
(this->*(drag_info.motion_callback)) (item, event);
goto handled;
@@ -1740,6 +1747,48 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item
return false;
}
+void
+Editor::break_drag ()
+{
+ stop_canvas_autoscroll ();
+ hide_verbose_canvas_cursor ();
+
+ if (drag_info.item) {
+ drag_info.item->ungrab (0);
+
+ /* put it back where it came from */
+
+ double cxw, cyw;
+ cxw = 0;
+ cyw = 0;
+ drag_info.item->i2w (cxw, cyw);
+ drag_info.item->move (drag_info.original_x - cxw, drag_info.original_y - cyw);
+ }
+
+ finalize_drag ();
+}
+
+void
+Editor::finalize_drag ()
+{
+ drag_info.item = 0;
+ drag_info.copy = false;
+ drag_info.motion_callback = 0;
+ drag_info.finished_callback = 0;
+ drag_info.dest_trackview = 0;
+ drag_info.source_trackview = 0;
+ drag_info.last_frame_position = 0;
+ drag_info.grab_frame = 0;
+ drag_info.last_pointer_frame = 0;
+ drag_info.current_pointer_frame = 0;
+ drag_info.brushing = false;
+
+ if (drag_info.copied_location) {
+ delete drag_info.copied_location;
+ drag_info.copied_location = 0;
+ }
+}
+
void
Editor::start_grab (GdkEvent* event, Gdk::Cursor *cursor)
{
@@ -1784,6 +1833,10 @@ Editor::start_grab (GdkEvent* event, Gdk::Cursor *cursor)
drag_info.brushing = false;
drag_info.copied_location = 0;
+ drag_info.original_x = 0;
+ drag_info.original_y = 0;
+ drag_info.item->i2w (drag_info.original_x, drag_info.original_y);
+
drag_info.item->grab (Gdk::POINTER_MOTION_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK,
*cursor,
event->button.time);
@@ -1842,22 +1895,7 @@ Editor::end_grab (ArdourCanvas::Item* item, GdkEvent* event)
hide_verbose_canvas_cursor();
- drag_info.item = 0;
- drag_info.copy = false;
- drag_info.motion_callback = 0;
- drag_info.finished_callback = 0;
- drag_info.dest_trackview = 0;
- drag_info.source_trackview = 0;
- drag_info.last_frame_position = 0;
- drag_info.grab_frame = 0;
- drag_info.last_pointer_frame = 0;
- drag_info.current_pointer_frame = 0;
- drag_info.brushing = false;
-
- if (drag_info.copied_location) {
- delete drag_info.copied_location;
- drag_info.copied_location = 0;
- }
+ finalize_drag ();
return did_drag;
}
@@ -4275,7 +4313,7 @@ Editor::drag_selection (ArdourCanvas::Item* item, GdkEvent* event)
}
if (event->button.x >= horizontal_adjustment.get_value() + canvas_width) {
- start_canvas_autoscroll (1);
+ start_canvas_autoscroll (1, 0);
}
if (start != end) {
@@ -4850,7 +4888,7 @@ Editor::drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event)
}
if (event->button.x >= horizontal_adjustment.get_value() + canvas_width) {
- start_canvas_autoscroll (1);
+ start_canvas_autoscroll (1, 0);
}
if (start != end) {
diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc
index e9ae374a76..24e9d22f1c 100644
--- a/gtk2_ardour/editor_rulers.cc
+++ b/gtk2_ardour/editor_rulers.cc
@@ -287,11 +287,11 @@ Editor::ruler_mouse_motion (GdkEventMotion* ev)
if (autoscroll_timeout_tag < 0) {
if (where > rightmost_frame) {
if (rightmost_frame < max_frames) {
- start_canvas_autoscroll (1);
+ start_canvas_autoscroll (1, 0);
}
} else if (where <= leftmost_frame) {
if (leftmost_frame > 0) {
- start_canvas_autoscroll (-1);
+ start_canvas_autoscroll (-1, 0);
}
}
} else {
diff --git a/gtk2_ardour/mnemonic-us.bindings.in b/gtk2_ardour/mnemonic-us.bindings.in
index 0799f1b06c..fcd1cbb99b 100644
--- a/gtk2_ardour/mnemonic-us.bindings.in
+++ b/gtk2_ardour/mnemonic-us.bindings.in
@@ -168,6 +168,7 @@
;; F-N keys
+(gtk_accel_path "/Editor/break-drag" "Escape")
(gtk_accel_path "/Editor/edit-cursor-to-range-start" "F1")
(gtk_accel_path "/Editor/edit-cursor-to-range-end" "F2")
(gtk_accel_path "/Editor/crop" "F3")