for (ARDOUR::DataType::iterator i = ARDOUR::DataType::begin(); i != ARDOUR::DataType::end(); ++i) {
_global_port_matrix[*i] = 0;
}
- allow_vertical_scroll = false;
no_save_visual = false;
resize_idle_id = -1;
void begin_reversible_command (std::string cmd_name);
void commit_reversible_command ();
+ DragManager* drags () const {
+ return _drags;
+ }
+
+ void maybe_autoscroll (bool, bool);
+
/* handy cursors for everyone to use */
static Gdk::Cursor* cross_hair_cursor;
int _scroll_callbacks;
double _canvas_width;
- double _canvas_height;
- double full_canvas_height;
+ double _canvas_height; ///< height of the visible area of the track canvas
+ double full_canvas_height; ///< full height of the canvas
bool track_canvas_map_handler (GdkEventAny*);
bool autoscroll_canvas ();
void start_canvas_autoscroll (int x, int y);
void stop_canvas_autoscroll ();
- void maybe_autoscroll (GdkEventMotion*, bool);
- bool allow_vertical_scroll;
/* trimming */
void point_trim (GdkEvent *, nframes64_t);
}
void
-Editor::maybe_autoscroll (GdkEventMotion* event, bool allow_vert)
+Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert)
{
nframes64_t rightmost_frame = leftmost_frame + current_page_frames();
bool startit = false;
+ double ty = _drags->current_pointer_y() - get_trackview_group_vertical_offset ();
+
autoscroll_y = 0;
autoscroll_x = 0;
- if (event->y < canvas_timebars_vsize && allow_vert) {
+ if (ty < canvas_timebars_vsize && allow_vert) {
autoscroll_y = -1;
startit = true;
- } else if (event->y > _canvas_height) {
+ } else if (ty > _canvas_height && allow_vert) {
autoscroll_y = 1;
startit = true;
}
- if (_drags->current_pointer_frame() > rightmost_frame) {
+ if (_drags->current_pointer_frame() > rightmost_frame && allow_horiz) {
if (rightmost_frame < max_frames) {
autoscroll_x = 1;
startit = true;
}
- } else if (_drags->current_pointer_frame() < leftmost_frame) {
+ } else if (_drags->current_pointer_frame() < leftmost_frame && allow_horiz) {
if (leftmost_frame > 0) {
autoscroll_x = -1;
startit = true;
}
}
- if (!allow_vertical_scroll) {
- autoscroll_y = 0;
- }
-
if ((autoscroll_x != last_autoscroll_x) || (autoscroll_y != last_autoscroll_y) || (autoscroll_x == 0 && autoscroll_y == 0)) {
stop_canvas_autoscroll ();
}
void
Editor::stop_canvas_autoscroll ()
{
-
if (autoscroll_timeout_tag >= 0) {
g_source_remove (autoscroll_timeout_tag);
autoscroll_timeout_tag = -1;
current_stepping_trackview->step_height (false);
return true;
} else {
+ cout << "down line\n";
scroll_tracks_down_line ();
return true;
}
if (event->motion.state & Gdk::BUTTON1_MASK || event->motion.state & Gdk::BUTTON2_MASK) {
if (!from_autoscroll) {
- _editor->maybe_autoscroll (&event->motion, allow_vertical_autoscroll ());
+ _editor->maybe_autoscroll (true, allow_vertical_autoscroll ());
}
motion (event, _move_threshold_passed != old_move_threshold_passed);
#include <gdk/gdk.h>
#include <stdint.h>
+#include <bitset>
#include "ardour/types.h"
if (pointer_window == track_canvas->get_bin_window()) {
track_canvas->window_to_world (x, y, wx, wy);
- allow_vertical_scroll = true;
- } else {
- allow_vertical_scroll = false;
}
}
class ImageFrameView;
class ImageFrameTimeAxis;
class MarkerView;
+class DragManager;
/// Representation of the interface of the Editor class
virtual Gtkmm2ext::TearOff* mouse_mode_tearoff () const = 0;
virtual Gtkmm2ext::TearOff* tools_tearoff () const = 0;
+ virtual DragManager* drags () const = 0;
+ virtual void maybe_autoscroll (bool, bool) = 0;
+ virtual void stop_canvas_autoscroll () = 0;
+
/// Singleton instance, set up by Editor::Editor()
static PublicEditor* _instance;
#include "rgb_macros.h"
#include "utils.h"
#include "streamview.h"
+#include "editor_drag.h"
#include "i18n.h"
bool
TimeAxisView::resizer_button_release (GdkEventButton*)
{
+ _editor.stop_canvas_autoscroll ();
_resize_drag_start = -1;
return true;
}
TimeAxisView::resizer_motion (GdkEventMotion* ev)
{
if (_resize_drag_start >= 0) {
+ /* (ab)use the DragManager to do autoscrolling; adjust the event coordinates
+ into the trackview space that DragManager::motion_handler is expecting,
+ and then fake a DragManager motion event so that when maybe_autoscroll
+ asks DragManager for the current pointer position it will get the correct
+ answers.
+ */
+ int tx, ty;
+ resizer.translate_coordinates (*control_parent, ev->x, ev->y, tx, ty);
+ ev->y = ty + _editor.get_canvas_timebars_vsize ();
+ _editor.drags()->motion_handler ((GdkEvent *) ev, false);
+ _editor.maybe_autoscroll (false, true);
+
+ /* now do the actual TAV resize */
int32_t const delta = (int32_t) floor (ev->y_root - _resize_drag_start);
_editor.add_to_idle_resize (this, delta);
_resize_drag_start = ev->y_root;