diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 80bde8298e..d66690319d 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -1611,6 +1611,11 @@ NoteResizeDrag::aborted (bool) #ifdef WITH_VIDEOTIMELINE +#ifndef MAX +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#endif + + AVDraggingView::AVDraggingView (RegionView* v) : view (v) { @@ -1751,6 +1756,12 @@ VideoTimeLineDrag::finished (GdkEvent * /*event*/, bool movement_occurred) _editor->session()->add_command (new StatefulDiffCommand (i->view->region())); } + _editor->session()->maybe_update_session_range( + MAX(ARDOUR_UI::instance()->video_timeline->get_offset(), 0), + MAX(ARDOUR_UI::instance()->video_timeline->get_offset() + ARDOUR_UI::instance()->video_timeline->get_duration(), 0) + ); + + _editor->commit_reversible_command (); _editor->update_canvas_now (); } diff --git a/gtk2_ardour/video_timeline.cc b/gtk2_ardour/video_timeline.cc index 3bcb397b68..398859c1a1 100644 --- a/gtk2_ardour/video_timeline.cc +++ b/gtk2_ardour/video_timeline.cc @@ -46,6 +46,9 @@ using namespace ARDOUR; using namespace PBD; using namespace Timecode; +#ifndef MAX +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#endif VideoTimeLine::VideoTimeLine (PublicEditor *ed, ArdourCanvas::Group *vbg, int initial_height) : editor (ed) @@ -456,6 +459,7 @@ VideoTimeLine::translated_filename () bool VideoTimeLine::video_file_info (std::string filename, bool local) { + local_file = local; if (filename.at(0) == G_DIR_SEPARATOR || !local_file) { video_filename = filename; @@ -514,6 +518,11 @@ VideoTimeLine::video_file_info (std::string filename, bool local) } flush_local_cache (); + _session->maybe_update_session_range( + MAX(get_offset(), 0), + MAX(get_offset() + get_duration(), 0) + ); + if (found_xjadeo() && local_file) { GuiUpdate("set-xjadeo-sensitive-on"); if (vmonitor && vmonitor->is_started()) { diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 78c95acb33..cb7f0ee015 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -732,6 +732,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void request_play_range (std::list*, bool leave_rolling = false); bool get_play_range () const { return _play_range; } + void maybe_update_session_range (framepos_t, framepos_t); + /* buffers for gain and pan */ gain_t* gain_automation_buffer () const; @@ -900,8 +902,6 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi Slave* _slave; bool _silent; - void maybe_update_session_range (framepos_t, framepos_t); - // varispeed playback double _transport_speed; double _default_transport_speed;