]> git.sesse.net Git - kdenlive/blobdiff - src/geometrywidget.cpp
Fix script rendering not working in some cases (resizing)
[kdenlive] / src / geometrywidget.cpp
index 9cc3a27325a28806720808015b563d45e936b19d..e9be10488c17a3c92a9e1cde9c1efd33c669bc2f 100644 (file)
@@ -56,9 +56,8 @@ GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos,
     MonitorEditWidget *edit = monitor->getEffectEdit();
     edit->removeCustomControls();
     edit->addCustomButton(KIcon("transform-crop"), i18n("Show previous keyframe"), this, SLOT(slotShowPreviousKeyFrame(bool)), true, KdenliveSettings::onmonitoreffects_geometryshowprevious());
-    edit->showVisibilityButton(true);
     m_scene = edit->getScene();
-
+    m_scene->cleanup();
 
     /*
         Setup of timeline and keyframe controls
@@ -100,16 +99,18 @@ GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos,
     connect(m_ui.buttonSync,      SIGNAL(toggled(bool)), this, SLOT(slotSetSynchronize(bool)));
 
     m_spinX = new DragValue(i18nc("x axis position", "X"), 0, 0, -99000, 99000, -1, QString(), false, this);
-    m_ui.horizontalLayout->addWidget(m_spinX);
+    m_ui.horizontalLayout->addWidget(m_spinX, 0, 0);
     
     m_spinY = new DragValue(i18nc("y axis position", "Y"), 0, 0, -99000, 99000, -1, QString(), false, this);
-    m_ui.horizontalLayout->addWidget(m_spinY);
+    m_ui.horizontalLayout->addWidget(m_spinY, 0, 1);
     
     m_spinWidth = new DragValue(i18nc("Frame width", "W"), m_monitor->render->frameRenderWidth(), 0, 1, 99000, -1, QString(), false, this);
-    m_ui.horizontalLayout->addWidget(m_spinWidth);
+    m_ui.horizontalLayout->addWidget(m_spinWidth, 0, 2);
     
     m_spinHeight = new DragValue(i18nc("Frame height", "H"), m_monitor->render->renderHeight(), 0, 1, 99000, -1, QString(), false, this);
-    m_ui.horizontalLayout->addWidget(m_spinHeight);
+    m_ui.horizontalLayout->addWidget(m_spinHeight, 0, 3);
+
+    m_ui.horizontalLayout->setColumnStretch(4, 10);
 
     QMenu *menu = new QMenu(this);
     QAction *adjustSize = new QAction(i18n("Adjust to original size"), this);
@@ -174,9 +175,10 @@ GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos,
     alignButton->setDefaultAction(alignbottom);
     alignButton->setAutoRaise(true);
     alignLayout->addWidget(alignButton);
+    alignLayout->addStretch(10);
 
-    m_ui.horizontalLayout->addLayout(alignLayout);
-    m_ui.horizontalLayout->addStretch(10);
+    m_ui.horizontalLayout->addLayout(alignLayout, 1, 0, 1, 4);
+    //m_ui.horizontalLayout->addStretch(10);
     
     m_spinSize = new DragValue(i18n("Size"), 100, 2, 1, 99000, -1, i18n("%"), false, this);
     m_ui.horizontalLayout2->addWidget(m_spinSize);
@@ -209,7 +211,7 @@ GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos,
     connect(m_spinWidth,        SIGNAL(valueChanged(double)), this, SLOT(slotSetWidth(double)));
     connect(m_spinHeight,       SIGNAL(valueChanged(double)), this, SLOT(slotSetHeight(double)));
 
-    connect(m_spinSize,         SIGNAL(valueChanged(double)), this, SLOT(slotResize(double)));
+    connect(m_spinSize, SIGNAL(valueChanged(double)), this, SLOT(slotResize(double)));
 
     connect(m_opacity, SIGNAL(valueChanged(double)), this, SLOT(slotSetOpacity(double)));
     
@@ -225,10 +227,7 @@ GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos,
         Setup of configuration controls
     */
 
-    connect(edit, SIGNAL(showEdit(bool)), this, SLOT(slotShowScene(bool)));
-
     connect(m_scene, SIGNAL(addKeyframe()),    this, SLOT(slotAddKeyframe()));
-    connect(m_monitor, SIGNAL(renderPosition(int)), this, SLOT(slotCheckMonitorPosition(int)));
     connect(this, SIGNAL(parameterChanged()), this, SLOT(slotUpdateProperties()));
 }
 
@@ -252,10 +251,6 @@ GeometryWidget::~GeometryWidget()
         Mlt::Geometry *g = m_extraGeometries.takeFirst();
         delete g;
     }
-    if (m_monitor) {
-        m_monitor->getEffectEdit()->showVisibilityButton(false);
-        m_monitor->slotEffectScene(false);
-    }
 }
 
 void GeometryWidget::slotShowPreviousKeyFrame(bool show)
@@ -325,9 +320,8 @@ void GeometryWidget::setupParam(const QDomElement elem, int minframe, int maxfra
     m_rect->setZValue(0);
     m_scene->addItem(m_rect);
     connect(m_rect, SIGNAL(changed()), this, SLOT(slotUpdateGeometry()));
-
+    m_scene->centerView();
     slotPositionChanged(0, false);
-    slotCheckMonitorPosition(m_monitor->render->seekFramePosition());
 }
 
 void GeometryWidget::addParameter(const QDomElement elem)
@@ -525,26 +519,6 @@ void GeometryWidget::slotAddDeleteKeyframe()
 }
 
 
-void GeometryWidget::slotCheckMonitorPosition(int renderPos)
-{
-    if (m_showScene) {
-        /*
-            We do only get the position in timeline if this geometry belongs to a transition,
-            therefore we need two ways here.
-        */
-        if (m_isEffect) {
-            emit checkMonitorPosition(renderPos);
-        } else {
-            if (renderPos >= m_clipPos && renderPos <= m_clipPos + m_outPoint - m_inPoint) {
-                if (!m_scene->views().at(0)->isVisible())
-                    m_monitor->slotEffectScene(true);
-            } else {
-                m_monitor->slotEffectScene(false);
-            }
-        }
-    }
-}
-
 
 void GeometryWidget::slotUpdateGeometry()
 {
@@ -573,7 +547,6 @@ void GeometryWidget::slotUpdateGeometry()
             geom->insert(item2);
         }
     }
-    
     emit parameterChanged();
 }
 
@@ -703,15 +676,6 @@ void GeometryWidget::slotSetSynchronize(bool sync)
         emit seekToPos(m_clipPos + m_timePos->getValue());
 }
 
-void GeometryWidget::slotShowScene(bool show)
-{
-    m_showScene = show;
-    if (!m_showScene)
-        m_monitor->slotEffectScene(false);
-    else
-        slotCheckMonitorPosition(m_monitor->render->seekFramePosition());
-}
-
 void GeometryWidget::setFrameSize(QPoint size)
 {
     m_frameSize = size;