CVS commit by cgilles:
Aspect ratio crop digiKam tool :
-fix minimum selection area to a visible size (50x50).
-auto-correction of selection area width/height when mouse resize event
CCMAIL: digikam-devel@...
M +2 -2 imageplugins/imageeffect_ratiocrop.cpp 1.25
M +35 -9 libs/widgets/imageselectionwidget.cpp 1.14
--- kdeextragear-3/digikam/imageplugins/imageeffect_ratiocrop.cpp #1.24:1.25
@@ -137,5 +137,5 @@ ImageEffect_RatioCrop::ImageEffect_Ratio
m_widthInput->setLabel(i18n("Width:"), AlignLeft|AlignVCenter);
QWhatsThis::add( m_widthInput, i18n("<p>Set here the width selection for cropping."));
- m_widthInput->setRange(100, m_imageSelectionWidget->getOriginalImageWidth(), 1, true);
+ m_widthInput->setRange(50, m_imageSelectionWidget->getOriginalImageWidth(), 1, true);
topLayout->addMultiCellWidget(m_xInput, 3, 3, 0, 1);
topLayout->addMultiCellWidget(m_widthInput, 3, 3, 3, 4);
@@ -148,5 +148,5 @@ ImageEffect_RatioCrop::ImageEffect_Ratio
m_heightInput->setLabel(i18n("Height:"), AlignLeft|AlignVCenter);
QWhatsThis::add( m_heightInput, i18n("<p>Set here the height selection for cropping."));
- m_heightInput->setRange(100, m_imageSelectionWidget->getOriginalImageHeight(), 1, true);
+ m_heightInput->setRange(50, m_imageSelectionWidget->getOriginalImageHeight(), 1, true);
topLayout->addMultiCellWidget(m_yInput, 4, 4, 0, 1);
topLayout->addMultiCellWidget(m_heightInput, 4, 4, 3, 4);
--- kdeextragear-3/digikam/libs/widgets/imageselectionwidget.cpp #1.13:1.14
@@ -374,4 +374,28 @@ void ImageSelectionWidget::regionSelecti
void ImageSelectionWidget::regionSelectionChanged(bool targetDone)
{
+ if (targetDone)
+ {
+ if (m_localRegionSelection.left() < 0)
+ {
+ m_localRegionSelection.setLeft(0);
+ applyAspectRatio(false);
+ }
+ if (m_localRegionSelection.top() < 0)
+ {
+ m_localRegionSelection.setTop(0);
+ applyAspectRatio(true);
+ }
+ if (m_localRegionSelection.right() > m_rect.width())
+ {
+ m_localRegionSelection.setRight(m_rect.width());
+ applyAspectRatio(false);
+ }
+ if (m_localRegionSelection.bottom() > m_rect.height())
+ {
+ m_localRegionSelection.setBottom(m_rect.height());
+ applyAspectRatio(true);
+ }
+ }
+
localToRealRegion();
@@ -541,22 +565,24 @@ void ImageSelectionWidget::mouseMoveEven
if ( m_currentResizing == ResizingTopLeft &&
- pm.x() < m_localRegionSelection.right() - 8 &&
- pm.y() < m_localRegionSelection.bottom() - 8 )
+ pm.x() < m_localRegionSelection.right() - 50 &&
+ pm.y() < m_localRegionSelection.bottom() - 50 )
m_localRegionSelection.setTopLeft(pm);
else if ( m_currentResizing == ResizingTopRight &&
- pm.x() > m_localRegionSelection.left() + 8 &&
- pm.y() < m_localRegionSelection.bottom() - 8 )
+ pm.x() > m_localRegionSelection.left() + 50 &&
+ pm.y() < m_localRegionSelection.bottom() - 50 )
m_localRegionSelection.setTopRight(pm);
else if ( m_currentResizing == ResizingBottomLeft &&
- pm.x() < m_localRegionSelection.right() - 8 &&
- pm.y() > m_localRegionSelection.top() + 8 )
+ pm.x() < m_localRegionSelection.right() - 50 &&
+ pm.y() > m_localRegionSelection.top() + 50 )
m_localRegionSelection.setBottomLeft(pm);
else if ( m_currentResizing == ResizingBottomRight &&
- pm.x() > m_localRegionSelection.left() + 8 &&
- pm.y() > m_localRegionSelection.top() + 8 )
+ pm.x() > m_localRegionSelection.left() + 50 &&
+ pm.y() > m_localRegionSelection.top() + 50 )
m_localRegionSelection.setBottomRight(pm);
+ else
+ return;
applyAspectRatio(false, false);
|