mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
Slip Contents Drag: add ContentsDrag
This commit is contained in:
parent
cc6b58ef00
commit
fea3fb9e71
3 changed files with 54 additions and 1 deletions
|
|
@ -675,6 +675,44 @@ RegionDrag::setup_video_sample_offset ()
|
||||||
_preview_video = true;
|
_preview_video = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RegionContentsDrag::RegionContentsDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<RegionView*> const & v)
|
||||||
|
: RegionDrag (e, i, p, v)
|
||||||
|
{
|
||||||
|
DEBUG_TRACE (DEBUG::Drags, "New RegionContentsDrag\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RegionContentsDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
|
||||||
|
{
|
||||||
|
Drag::start_grab (event, _editor->cursors()->trimmer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RegionContentsDrag::motion (GdkEvent* event, bool first_move)
|
||||||
|
{
|
||||||
|
if (first_move) {
|
||||||
|
_editor->begin_reversible_command (_("Region content trim"));
|
||||||
|
} else {
|
||||||
|
for (list<DraggingView>::iterator i = _views.begin(); i != _views.end(); ++i) {
|
||||||
|
RegionView* rv = i->view;
|
||||||
|
samplecnt_t slippage = (last_pointer_sample() - adjusted_current_sample(event, false));
|
||||||
|
rv->move_contents (slippage);
|
||||||
|
}
|
||||||
|
show_verbose_cursor_time (_primary->region()->start ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RegionContentsDrag::finished (GdkEvent *, bool)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RegionContentsDrag::aborted (bool)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RegionMotionDrag::RegionMotionDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<RegionView*> const & v, bool b)
|
RegionMotionDrag::RegionMotionDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<RegionView*> const & v, bool b)
|
||||||
: RegionDrag (e, i, p, v)
|
: RegionDrag (e, i, p, v)
|
||||||
, _brushing (b)
|
, _brushing (b)
|
||||||
|
|
|
||||||
|
|
@ -371,6 +371,19 @@ private:
|
||||||
PBD::ScopedConnection death_connection;
|
PBD::ScopedConnection death_connection;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Drag the Contents rather than the bounds of a region (i.e. Slip) */
|
||||||
|
class RegionContentsDrag : public RegionDrag
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
RegionContentsDrag (Editor *, ArdourCanvas::Item *, RegionView *, std::list<RegionView*> const &);
|
||||||
|
virtual ~RegionContentsDrag () {}
|
||||||
|
|
||||||
|
virtual void start_grab (GdkEvent *, Gdk::Cursor *);
|
||||||
|
virtual void motion (GdkEvent *, bool);
|
||||||
|
virtual void finished (GdkEvent *, bool);
|
||||||
|
virtual void aborted (bool);
|
||||||
|
};
|
||||||
|
|
||||||
/** Drags involving region motion from somewhere */
|
/** Drags involving region motion from somewhere */
|
||||||
class RegionMotionDrag : public RegionDrag
|
class RegionMotionDrag : public RegionDrag
|
||||||
|
|
|
||||||
|
|
@ -1061,7 +1061,9 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
||||||
}
|
}
|
||||||
|
|
||||||
/* click on a normal region view */
|
/* click on a normal region view */
|
||||||
if (ArdourKeyboard::indicates_copy (event->button.state)) {
|
if (Keyboard::modifier_state_equals (event->button.state, ArdourKeyboard::trim_contents_modifier ())) {
|
||||||
|
_drags->add (new RegionContentsDrag (this, item, clicked_regionview, selection->regions.by_layer()));
|
||||||
|
} else if (ArdourKeyboard::indicates_copy (event->button.state)) {
|
||||||
add_region_copy_drag (item, event, clicked_regionview);
|
add_region_copy_drag (item, event, clicked_regionview);
|
||||||
} else if (Keyboard::the_keyboard().key_is_down (GDK_b)) {
|
} else if (Keyboard::the_keyboard().key_is_down (GDK_b)) {
|
||||||
add_region_brush_drag (item, event, clicked_regionview);
|
add_region_brush_drag (item, event, clicked_regionview);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue