#include <gdk/gdk.h>
#include <stdint.h>
-#include <bitset>
#include "ardour/types.h"
namespace Gnome {
namespace Canvas {
class CanvasNoteEvent;
- class CanvasProgramChange;
+ class CanvasPatchChange;
}
}
double _current_pointer_x; ///< trackview x of the current pointer
double _current_pointer_y; ///< trackview y of the current pointer
ARDOUR::framepos_t _current_pointer_frame; ///< frame that the pointer is now at
+ bool _old_follow_playhead; ///< state of Editor::follow_playhead() before the drags started
};
/** Abstract base class for dragging of things within the editor */
ARDOUR::framepos_t adjusted_frame (ARDOUR::framepos_t, GdkEvent const *, bool snap = true) const;
ARDOUR::framepos_t adjusted_current_frame (GdkEvent const *, bool snap = true) const;
-
+
/** Called to start a grab of an item.
* @param e Event that caused the grab to start.
* @param c Cursor to use, or 0.
/** Called to abort a drag and return things to how
* they were before it started.
+ * @param m true if some movement occurred, otherwise false.
*/
- virtual void aborted () = 0;
+ virtual void aborted (bool m) = 0;
/** @param m Mouse mode.
* @return true if this drag should happen in this mouse mode.
return _last_pointer_frame;
}
+ void show_verbose_cursor_time (framepos_t);
+ void show_verbose_cursor_duration (framepos_t, framepos_t, double xoffset = 0);
+ void show_verbose_cursor_text (std::string const &);
+
Editor* _editor; ///< our editor
DragManager* _drags;
ArdourCanvas::Item* _item; ///< our item
DraggingView (RegionView *, RegionDrag *);
RegionView* view; ///< the view
- /** index into RegionDrag::_time_axis_views of the view that this region is currently beind displayed on */
+ /** index into RegionDrag::_time_axis_views of the view that this region is currently being displayed on,
+ * or -1 if it is not visible.
+ */
int time_axis_view;
/** layer that this region is currently being displayed on */
ARDOUR::layer_t layer;
int _visible_y_high;
friend class DraggingView;
-
+
private:
-
+
void region_going_away (RegionView *);
PBD::ScopedConnection death_connection;
};
virtual void start_grab (GdkEvent *, Gdk::Cursor *);
virtual void motion (GdkEvent *, bool);
virtual void finished (GdkEvent *, bool) = 0;
- virtual void aborted ();
+ virtual void aborted (bool);
/** @return true if the regions being `moved' came from somewhere on the canvas;
* false if they came from outside (e.g. from the region list).
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
bool regions_came_from_canvas () const {
return true;
void add_stateful_diff_commands_for_playlists (PlaylistSet const &);
void collect_new_region_view (RegionView *);
-
+
bool _copy;
RegionView* _new_region_view;
};
RegionInsertDrag (Editor *, boost::shared_ptr<ARDOUR::Region>, RouteTimeAxisView*, ARDOUR::framepos_t);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
bool regions_came_from_canvas () const {
return false;
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
};
/** Drags to create regions */
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
private:
MidiTimeAxisView* _view;
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
private:
MidiRegionView* region;
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
private:
ARDOUR::frameoffset_t total_dx () const;
int8_t total_dy () const;
-
+
MidiRegionView* _region;
Gnome::Canvas::CanvasNoteEvent* _primary;
double _cumulative_dx;
double _note_height;
};
-/** Drag to move MIDI program changes */
-class ProgramChangeDrag : public Drag
+/** Drag to move MIDI patch changes */
+class PatchChangeDrag : public Drag
{
public:
- ProgramChangeDrag (Editor *, ArdourCanvas::CanvasProgramChange *, MidiRegionView *);
+ PatchChangeDrag (Editor *, ArdourCanvas::CanvasPatchChange *, MidiRegionView *);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
bool y_movement_matters () const {
return false;
private:
MidiRegionView* _region_view;
- ArdourCanvas::CanvasProgramChange* _program_change;
+ ArdourCanvas::CanvasPatchChange* _patch_change;
double _cumulative_dx;
};
return (m == Editing::MouseGain);
}
- void aborted ();
+ void aborted (bool);
};
/** Drag to trim region(s) */
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
bool y_movement_matters () const {
return false;
}
void setup_pointer_frame_offset ();
-
+
private:
Operation _operation;
- bool _have_transaction; ///< true if a transaction has been started, false otherwise. Must be set true by derived class.
};
/** Meter marker drag */
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
bool allow_vertical_autoscroll () const {
return false;
}
void setup_pointer_frame_offset ();
-
+
private:
MeterMarker* _marker;
bool _copy;
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
bool allow_vertical_autoscroll () const {
return false;
}
void setup_pointer_frame_offset ();
-
+
private:
TempoMarker* _marker;
bool _copy;
};
-/** Drag of a cursor */
+/** Drag of the playhead cursor */
class CursorDrag : public Drag
{
public:
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
bool active (Editing::MouseMode) {
return true;
}
bool y_movement_matters () const {
- return false;
+ return true;
}
- void setup_pointer_frame_offset ();
-
private:
- EditorCursor* _cursor; ///< cursor being dragged
- bool _stop; ///< true to stop the transport on starting the drag, otherwise false
+ void fake_locate (framepos_t);
+ bool _stop; ///< true to stop the transport on starting the drag, otherwise false
+ double _grab_zoom; ///< editor frames per unit when our grab started
};
/** Region fade-in drag */
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
bool y_movement_matters () const {
return false;
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
bool y_movement_matters () const {
return false;
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
bool allow_vertical_autoscroll () const {
return false;
}
void setup_pointer_frame_offset ();
-
+
private:
void update_item (ARDOUR::Location *);
Marker* _marker; ///< marker being dragged
std::list<ARDOUR::Location*> _copied_locations;
- ArdourCanvas::Line* _line;
ArdourCanvas::Points _points;
};
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
bool active (Editing::MouseMode m);
double _fixed_grab_y;
double _cumulative_x_drag;
double _cumulative_y_drag;
- static double const _zero_gain_fraction;
+ static double _zero_gain_fraction;
};
/** Gain or automation line drag */
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
bool active (Editing::MouseMode) {
return true;
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
bool active (Editing::MouseMode) {
return true;
private:
- ArdourCanvas::SimpleLine* _line;
+ ArdourCanvas::Line* _line;
AudioRegionView* _arv;
-
+
double _region_view_grab_x;
double _cumulative_x_drag;
-
- uint32_t _before;
+
+ float _before;
uint32_t _max_x;
};
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
return std::make_pair (8, 1);
}
+
+ void do_select_things (GdkEvent *, bool);
+
+ /** Select some things within a rectangle.
+ * @param button_state The button state from the GdkEvent.
+ * @param x1 The left-hand side of the rectangle in session frames.
+ * @param x2 The right-hand side of the rectangle in session frames.
+ * @param y1 The top of the rectangle in trackview coordinates.
+ * @param y2 The bottom of the rectangle in trackview coordinates.
+ * @param drag_in_progress true if the drag is currently happening.
+ */
+ virtual void select_things (int button_state, framepos_t x1, framepos_t x2, double y1, double y2, bool drag_in_progress) = 0;
+
+ virtual void deselect_things () = 0;
+};
+
+/** A general editor RubberbandSelectDrag (for regions, automation points etc.) */
+class EditorRubberbandSelectDrag : public RubberbandSelectDrag
+{
+public:
+ EditorRubberbandSelectDrag (Editor *, ArdourCanvas::Item *);
+
+ void select_things (int, framepos_t, framepos_t, double, double, bool);
+ void deselect_things ();
+};
+
+/** A RubberbandSelectDrag for selecting MIDI notes */
+class MidiRubberbandSelectDrag : public RubberbandSelectDrag
+{
+public:
+ MidiRubberbandSelectDrag (Editor *, MidiRegionView *);
+
+ void select_things (int, framepos_t, framepos_t, double, double, bool);
+ void deselect_things ();
+
+private:
+ MidiRegionView* _region_view;
};
/** Region drag in time-FX mode */
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
};
/** Scrub drag in audition mode */
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
};
/** Drag in range select mode */
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
void setup_pointer_frame_offset ();
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
bool allow_vertical_autoscroll () const {
return false;
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
std::pair<ARDOUR::framecnt_t, int> move_threshold () const {
return std::make_pair (4, 4);
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
- void aborted ();
+ void aborted (bool);
bool x_movement_matters () const {
return false;
std::pair<ARDOUR::framepos_t, ARDOUR::framepos_t> range; ///< the range of all points on the line, in session frames
XMLNode* state; ///< the XML state node before the drag
};
-
+
std::list<Line> _lines;
-
+
bool _nothing_to_drag;
};