From ae95888e13787b40b343d2a77d1c6ab0cbd8a1cb Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Sat, 19 Feb 2011 12:55:16 +0000 Subject: [PATCH 1/1] Fix "fit to width / height" option not correctly updating in composite transition svn path=/trunk/kdenlive/; revision=5427 --- src/geometrywidget.cpp | 21 +++++++++++++++++++++ src/geometrywidget.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/src/geometrywidget.cpp b/src/geometrywidget.cpp index 0de02ec0..f0d566ce 100644 --- a/src/geometrywidget.cpp +++ b/src/geometrywidget.cpp @@ -504,6 +504,12 @@ void GeometryWidget::slotSetHeight(int value) slotUpdateGeometry(); } +void GeometryWidget::updateMonitorGeometry() +{ + m_rect->setRect(0, 0, m_spinWidth->value(), m_spinHeight->value()); + slotUpdateGeometry(); +} + void GeometryWidget::slotResize(double value) { @@ -587,24 +593,39 @@ void GeometryWidget::setFrameSize(QPoint size) void GeometryWidget::slotAdjustToFrameSize() { if (m_frameSize == QPoint()) m_frameSize = QPoint(m_monitor->render->frameRenderWidth(), m_monitor->render->renderHeight()); + m_spinWidth->blockSignals(true); + m_spinHeight->blockSignals(true); m_spinWidth->setValue((int) (m_frameSize.x() / m_monitor->render->sar() + 0.5)); m_spinHeight->setValue(m_frameSize.y()); + m_spinWidth->blockSignals(false); + m_spinHeight->blockSignals(false); + updateMonitorGeometry(); } void GeometryWidget::slotFitToWidth() { if (m_frameSize == QPoint()) m_frameSize = QPoint(m_monitor->render->frameRenderWidth(), m_monitor->render->renderHeight()); double factor = (double) m_monitor->render->frameRenderWidth() / m_frameSize.x() * m_monitor->render->sar(); + m_spinWidth->blockSignals(true); + m_spinHeight->blockSignals(true); m_spinHeight->setValue((int) (m_frameSize.y() * factor + 0.5)); m_spinWidth->setValue(m_monitor->render->frameRenderWidth()); + m_spinWidth->blockSignals(false); + m_spinHeight->blockSignals(false); + updateMonitorGeometry(); } void GeometryWidget::slotFitToHeight() { if (m_frameSize == QPoint()) m_frameSize = QPoint(m_monitor->render->frameRenderWidth(), m_monitor->render->renderHeight()); double factor = (double) m_monitor->render->renderHeight() / m_frameSize.y(); + m_spinWidth->blockSignals(true); + m_spinHeight->blockSignals(true); m_spinHeight->setValue(m_monitor->render->renderHeight()); m_spinWidth->setValue((int) (m_frameSize.x() / m_monitor->render->sar() * factor + 0.5)); + m_spinWidth->blockSignals(false); + m_spinHeight->blockSignals(false); + updateMonitorGeometry(); } #include "geometrywidget.moc" diff --git a/src/geometrywidget.h b/src/geometrywidget.h index 29598280..ca9b995c 100644 --- a/src/geometrywidget.h +++ b/src/geometrywidget.h @@ -91,6 +91,8 @@ private: DragValue *m_spinSize; DragValue *m_opacity; QPoint m_frameSize; + /** @brief Update monitor rect with current width / height values. */ + void updateMonitorGeometry(); private slots: /** @brief Updates controls according to position. -- 2.39.2