Gdk::Cursor* Editor::speaker_cursor = 0;
Gdk::Cursor* Editor::wait_cursor = 0;
Gdk::Cursor* Editor::timebar_cursor = 0;
+Gdk::Cursor* Editor::transparent_cursor = 0;
void
show_me_the_size (Requisition* r, const char* what)
speaker_cursor = new Gdk::Cursor (source, mask, ffg, fbg, speaker_cursor_x_hot, speaker_cursor_y_hot);
}
+ {
+ RefPtr<Bitmap> bits;
+ char pix[4] = { 0, 0, 0, 0 };
+ bits = Bitmap::create (pix, 2, 2);
+ Gdk::Color c;
+ transparent_cursor = new Gdk::Cursor (bits, bits, c, c, 0, 0);
+ }
+
grabber_cursor = new Gdk::Cursor (HAND2);
cross_hair_cursor = new Gdk::Cursor (CROSSHAIR);
trimmer_cursor = new Gdk::Cursor (SB_H_DOUBLE_ARROW);
case MouseAudition:
_scrubbing = true;
+ scrub_reversals = 0;
+ scrub_reverse_distance = 0;
last_scrub_x = event->button.x;
scrubbing_direction = 0;
+ track_canvas.get_window()->set_cursor (*transparent_cursor);
/* rest handled in motion & release */
break;
case MouseAudition:
_scrubbing = false;
+ track_canvas.get_window()->set_cursor (*current_canvas_cursor);
if (scrubbing_direction == 0) {
/* no drag, just a click */
switch (item_type) {
scrubbing_direction = 1;
} else {
-
if (last_scrub_x > drag_info.current_pointer_x) {
- /* move to the left */
+
+ /* pointer moved to the left */
if (scrubbing_direction > 0) {
+
/* we reversed direction to go backwards */
-
- session->request_transport_speed (-0.1);
-
+
+ scrub_reversals++;
+ scrub_reverse_distance += (int) (last_scrub_x - drag_info.current_pointer_x);
+
} else {
+
/* still moving to the left (backwards) */
- delta = 0.005 * (last_scrub_x - drag_info.current_pointer_x);
+ 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);
}
- scrubbing_direction = -1;
-
} else {
- /* move to the right */
+ /* pointer moved to the right */
+
if (scrubbing_direction < 0) {
/* we reversed direction to go forward */
-
- session->request_transport_speed (0.1);
+
+ 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.005 * (drag_info.current_pointer_x - last_scrub_x);
+ 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;
+ }
- scrubbing_direction = 1;
+ scrub_reverse_distance = 0;
+ scrub_reversals = 0;
}
}