[Digikam-devel] [Bug 145170] Always allow zooming in/out in imageeditor
Gilles Caulier
caulier.gilles at gmail.com
Mon May 21 08:58:08 BST 2007
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=145170
caulier.gilles gmail com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From caulier.gilles gmail com 2007-05-21 09:58 -------
SVN commit 666890 by cgilles:
digikam from trunk : Image Editor : to be able to use the zoom +/- functions if "Fit To Window" option is enabled.
BUG: 145170
M +1 -1 canvas/canvas.cpp
M +36 -24 editor/editorwindow.cpp
M +2 -0 editor/editorwindow.h
--- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/canvas.cpp #666889:666890
@ -928,7 +928,7 @
void Canvas::setZoomFactor(double zoom)
{
if (d->autoZoom)
- return;
+ d->autoZoom = false;
// Zoom using center of canvas and given zoom factor.
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editorwindow.cpp #666889:666890
@ -321,11 +321,10 @
// -- Standard 'View' menu actions ---------------------------------------------
- d->zoomPlusAction = KStdAction::zoomIn(m_canvas, SLOT(slotIncreaseZoom()),
+ d->zoomPlusAction = KStdAction::zoomIn(this, SLOT(slotIncreaseZoom()),
actionCollection(), "editorwindow_zoomplus");
-
- d->zoomMinusAction = KStdAction::zoomOut(m_canvas, SLOT(slotDecreaseZoom()),
+ d->zoomMinusAction = KStdAction::zoomOut(this, SLOT(slotDecreaseZoom()),
actionCollection(), "editorwindow_zoomminus");
d->zoomTo100percents = new KAction(i18n("Zoom to 1:1"), "viewmag1",
@ -494,12 +493,12 @
d->accelerators->insert("Zoom Plus Key_Plus", i18n("Zoom In"),
i18n("Zoom in on Image"),
- Key_Plus, m_canvas, SLOT(slotIncreaseZoom()),
+ Key_Plus, this, SLOT(slotIncreaseZoom()),
false, true);
d->accelerators->insert("Zoom Plus Key_Minus", i18n("Zoom Out"),
i18n("Zoom out of Image"),
- Key_Minus, m_canvas, SLOT(slotDecreaseZoom()),
+ Key_Minus, this, SLOT(slotDecreaseZoom()),
false, true);
}
@ -661,14 +660,27 @
applyMainWindowSettings(KGlobal::config(), "ImageViewer Settings");
}
-void EditorWindow::slotToggleFitToWindow()
+void EditorWindow::slotIncreaseZoom()
{
- bool checked = d->zoomFitToWindowAction->isChecked();
+ d->zoomFitToWindowAction->blockSignals(true);
+ d->zoomFitToWindowAction->setChecked(false);
+ d->zoomFitToWindowAction->blockSignals(false);
+ m_canvas->slotIncreaseZoom();
+}
- d->zoomPlusAction->setEnabled(!checked);
- d->zoomComboAction->setEnabled(!checked);
- d->zoomMinusAction->setEnabled(!checked);
+void EditorWindow::slotDecreaseZoom()
+{
+ d->zoomFitToWindowAction->blockSignals(true);
+ d->zoomFitToWindowAction->setChecked(false);
+ d->zoomFitToWindowAction->blockSignals(false);
+ m_canvas->slotDecreaseZoom();
+}
+void EditorWindow::slotToggleFitToWindow()
+{
+ d->zoomPlusAction->setEnabled(true);
+ d->zoomComboAction->setEnabled(true);
+ d->zoomMinusAction->setEnabled(true);
m_canvas->toggleFitToWindow();
}
@ -694,25 +706,30 @
m_canvas->setZoomFactor(1.0);
}
+void EditorWindow::slotZoomSelected()
+{
+ QString txt = d->zoomCombo->currentText();
+ txt = txt.left(txt.find('%'));
+ slotZoomTextChanged(txt);
+}
+
void EditorWindow::slotZoomTextChanged(const QString &txt)
{
bool r = false;
double zoom = KGlobal::locale()->readNumber(txt, &r) / 100.0;
if (r && zoom > 0.0)
+ {
+ d->zoomFitToWindowAction->blockSignals(true);
+ d->zoomFitToWindowAction->setChecked(false);
+ d->zoomFitToWindowAction->blockSignals(false);
m_canvas->setZoomFactor(zoom);
+ }
}
-void EditorWindow::slotZoomSelected()
-{
- QString txt = d->zoomCombo->currentText();
- txt = txt.left(txt.find('%'));
- slotZoomTextChanged(txt);
-}
-
void EditorWindow::slotZoomChanged(double zoom)
{
- d->zoomPlusAction->setEnabled(!m_canvas->maxZoom() && !m_canvas->fitToWindow());
- d->zoomMinusAction->setEnabled(!m_canvas->minZoom() && !m_canvas->fitToWindow());
+ d->zoomPlusAction->setEnabled(!m_canvas->maxZoom());
+ d->zoomMinusAction->setEnabled(!m_canvas->minZoom());
d->zoomCombo->blockSignals(true);
d->zoomCombo->setCurrentText(QString::number(lround(zoom*100.0)) + QString("%"));
@ -792,13 +809,8 @
// Restore Auto zoom action ?
bool autoZoom = config->readBoolEntry("AutoZoom", true);
-
if (autoZoom)
- {
d->zoomFitToWindowAction->activate();
- d->zoomPlusAction->setEnabled(false);
- d->zoomMinusAction->setEnabled(false);
- }
}
void EditorWindow::applyStandardSettings()
--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editorwindow.h #666889:666890
@ -213,6 +213,8 @
void slotSelectionChanged(const QRect& sel);
void slotToggleFitToWindow();
void slotFitToSelect();
+ void slotIncreaseZoom();
+ void slotDecreaseZoom();
private:
More information about the Digikam-devel
mailing list