support scrubbing via new Drag abstraction (probably could be split off 100% from Editor)

git-svn-id: svn://localhost/ardour2/branches/3.0@5152 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2009-06-10 13:58:22 +00:00
parent 41eedb1f63
commit cc8598b071
5 changed files with 36 additions and 18 deletions

View file

@ -2241,6 +2241,7 @@ public:
friend class LineDrag;
friend class RubberbandSelectDrag;
friend class TimeFXDrag;
friend class ScrubDrag;
friend class SelectionDrag;
friend class RangeMarkerBarDrag;
friend class MouseZoomDrag;

View file

@ -2829,6 +2829,27 @@ TimeFXDrag::finished (GdkEvent* event, bool movement_occurred)
}
}
void
ScrubDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
{
Drag::start_grab (event);
}
void
ScrubDrag::motion (GdkEvent* event, bool)
{
_editor->scrub ();
}
void
ScrubDrag::finished (GdkEvent* event, bool movement_occurred)
{
if (movement_occurred && _editor->session) {
/* make sure we stop */
_editor->session->request_transport_speed (0.0);
}
}
SelectionDrag::SelectionDrag (Editor* e, ArdourCanvas::Item* i, Operation o)
: Drag (e, i),
_operation (o),

View file

@ -453,7 +453,18 @@ public:
void finished (GdkEvent *, bool);
};
/** Drag in range selection mode */
/** Scrub drag in audition mode */
class ScrubDrag : public Drag
{
public:
ScrubDrag (Editor *e, ArdourCanvas::Item *i) : Drag (e, i) {}
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
};
/** Drag in range select(gc_owner.get()) moAutomatable */
class SelectionDrag : public Drag
{
public:

View file

@ -987,13 +987,13 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
break;
case MouseAudition:
_scrubbing = true;
_drag = new ScrubDrag (this, item);
_drag->start_grab (event);
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 MouseNote:
@ -1878,17 +1878,6 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, bool from_aut
handled = _drag->motion_handler (event, from_autoscroll);
}
switch (mouse_mode) {
case MouseAudition:
if (_scrubbing) {
scrub ();
}
break;
default:
break;
}
if (!handled) {
return false;
}

View file

@ -25,7 +25,6 @@
#include <gtkmm2ext/barcontroller.h>
#include "midi++/manager.h"
#include "pbd/fastlog.h"
#include "pbd/stacktrace.h"
#include "ardour_ui.h"
#include "panner_ui.h"
@ -337,7 +336,6 @@ void
PannerUI::setup_pan ()
{
cerr << "Setup pan for " << _panner->name() << endl;
// PBD::stacktrace (cerr, 5);
if (!_panner) {
return;
@ -345,8 +343,6 @@ PannerUI::setup_pan ()
uint32_t nouts = _panner->nouts();
cerr << "\tnouts = " << nouts << endl;
if (nouts == 0 || nouts == 1) {
while (!pan_adjustments.empty()) {