1616#include < coreplugin/ProjectWindowInterface.h>
1717#include < coreplugin/ProjectTimeline.h>
1818
19+ #include < visualeditor/AutoPageScrollingManipulator.h>
1920#include < visualeditor/PositionAlignmentManipulator.h>
2021#include < visualeditor/ProjectViewModelContext.h>
2122#include < visualeditor/internal/EditorPreference.h>
@@ -88,6 +89,22 @@ namespace VisualEditor {
8889 });
8990 }
9091
92+ void ArrangementPanelInterfacePrivate::bindPositionAlignmentManipulator () const {
93+ Q_Q (const ArrangementPanelInterface);
94+ positionAlignmentManipulator->setAutoDurationPositionAlignment (Internal::EditorPreference::autoDurationPositionAlignment ());
95+ QObject::connect (Internal::EditorPreference::instance (), &Internal::EditorPreference::autoDurationPositionAlignmentChanged, positionAlignmentManipulator, [=, this ] {
96+ positionAlignmentManipulator->setAutoDurationPositionAlignment (Internal::EditorPreference::autoDurationPositionAlignment ());
97+ });
98+ QObject::connect (q, &ArrangementPanelInterface::snapTemporarilyDisabledChanged, positionAlignmentManipulator, [=, this ] {
99+ if (isSnapTemporarilyDisabled) {
100+ previousDuration = positionAlignmentManipulator->duration ();
101+ positionAlignmentManipulator->setDuration (PositionAlignmentManipulator::Unset);
102+ } else {
103+ positionAlignmentManipulator->setDuration (previousDuration);
104+ }
105+ });
106+ }
107+
91108 ArrangementPanelInterface::ArrangementPanelInterface (Core::ProjectWindowInterface *windowHandle) : QObject(windowHandle), d_ptr(new ArrangementPanelInterfacePrivate) {
92109 Q_D (ArrangementPanelInterface);
93110 Q_ASSERT (windowHandle->getObjects (staticMetaObject.className ()).isEmpty ());
@@ -102,6 +119,11 @@ namespace VisualEditor {
102119
103120 d->positionAlignmentManipulator = new PositionAlignmentManipulator (this );
104121 d->positionAlignmentManipulator ->setTimeLayoutViewModel (d->timeLayoutViewModel );
122+ d->autoPageScrollingManipulator = new AutoPageScrollingManipulator (this );
123+ d->autoPageScrollingManipulator ->setEnabled (true );
124+ d->autoPageScrollingManipulator ->setTimeViewModel (d->timeViewModel );
125+ d->autoPageScrollingManipulator ->setTimeLayoutViewModel (d->timeLayoutViewModel );
126+ d->autoPageScrollingManipulator ->setPlaybackViewModel (ProjectViewModelContext::of (d->windowHandle )->playbackViewModel ());
105127
106128 QQmlComponent component (Core::RuntimeInterface::qmlEngine (), " DiffScope.VisualEditor" , " ArrangementView" );
107129 if (component.isError ()) {
@@ -118,10 +140,13 @@ namespace VisualEditor {
118140 d->arrangementView = qobject_cast<QQuickItem *>(o);
119141 Q_ASSERT (d->arrangementView );
120142
143+ d->autoPageScrollingManipulator ->setTarget (d->arrangementView ->property (" timeline" ).value <QQuickItem *>());
144+
121145 d->bindTimeViewModel ();
122146 d->bindTimeLayoutViewModel ();
123147 d->bindTimelineInteractionController ();
124148 d->bindScrollBehaviorViewModel ();
149+ d->bindPositionAlignmentManipulator ();
125150 }
126151
127152 ArrangementPanelInterface::~ArrangementPanelInterface () = default ;
@@ -157,6 +182,11 @@ namespace VisualEditor {
157182 return d->positionAlignmentManipulator ;
158183 }
159184
185+ AutoPageScrollingManipulator *ArrangementPanelInterface::autoPageScrollingManipulator () const {
186+ Q_D (const ArrangementPanelInterface);
187+ return d->autoPageScrollingManipulator ;
188+ }
189+
160190 QQuickItem *ArrangementPanelInterface::arrangementView () const {
161191 Q_D (const ArrangementPanelInterface);
162192 return d->arrangementView ;
@@ -175,6 +205,19 @@ namespace VisualEditor {
175205 }
176206 }
177207
208+ bool ArrangementPanelInterface::isSnapTemporarilyDisabled () const {
209+ Q_D (const ArrangementPanelInterface);
210+ return d->isSnapTemporarilyDisabled ;
211+ }
212+
213+ void ArrangementPanelInterface::setSnapTemporarilyDisabled (bool disabled) {
214+ Q_D (ArrangementPanelInterface);
215+ if (d->isSnapTemporarilyDisabled != disabled) {
216+ d->isSnapTemporarilyDisabled = disabled;
217+ Q_EMIT snapTemporarilyDisabledChanged ();
218+ }
219+ }
220+
178221}
179222
180- #include " moc_ArrangementPanelInterface.cpp"
223+ #include " moc_ArrangementPanelInterface.cpp"
0 commit comments