Summary: | Zoom-slider has no steps | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Fri13 <friiduh> |
Component: | ImageEditor-Canvas | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | 0.9.3 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 0.9.4 | |
Sentry Crash Report: | |||
Attachments: |
make zoom values snap to specific values, v0
make zoom values snap to specific values, v1 |
Description
Fri13
2008-02-07 04:31:36 UTC
Created attachment 24391 [details]
make zoom values snap to specific values, v0
The patch works for the + and - buttons at the slider,
CTRL+mousewheel and changes of the slider itself.
For dealing with changes of the slider itself,
modifying PreviewWidget::setZoomFactor a la
//If we are near 100% zoom, then we force 100% zoom
if (fabs(zoom-1.0)<0.05)
{
zoom = 1.0;
}
(as done in the previous patch on the ML) is not a good idea.
Reason: this routine is used at various places throughout the code.
In particular, when a fit-to-window would be 96% then this should not
be set to 100% automatically, just because of 100% snapping .... ;-)
Also, if the user changed the ZoomText
(e.g.: EditorWindow::slotZoomTextChanged)
this must not be changed afterwards ;-)
To deal with the slider, the places to be adapted are:
#void DigikamView::setThumbSize(int size)
void ImagePannelWidget::slotZoomSliderChanged(int size)
void LightTableView::slotLeftZoomSliderChanged(int size)
void LightTableView::slotRightZoomSliderChanged(int size)
All these call setZoomFactor(z) in the end.
Therefore, instead a setZoomFactorSnapped(z) is
introduced, which does the proper handling of "snapping"
to 50%, 100% and fit-to-window.
Of course, this needs testing - feedback welcome!
(Once everything is considered fine, I will clean up the few DWarning()
statements left in for debugging)
Best, Arnd
Thanks. Now buttons works :) Dnia Saturday 19 of April 2008, napisa 1.) > Doesn't work with Mouse-wheel hovering over slider. Both when moving the slider and when using the mouse wheel, void DigikamView::slotZoomFactorChanged(double zoom) is called, which in turn calls void DigikamView::setThumbSize(int size). Thus the problem is the following: when moving the slider directly, usually small steps are are used such that a maximum 5% difference condition to the snap values (50%, 100%, fit) is fulfilled to make it snap. When using the mouse-wheel, larger steps are used, so that it may happen, that no snapping occurs. This maybe considered as a bug, or as a feature ;-). However, I currently don't see any way to overcome this ... So may I declare this as a feature? About the other two points: could you please file separate wishes? Created attachment 24404 [details]
make zoom values snap to specific values, v1
cleaned up patch.
Gilles, could you have a brief look at the code?
Arnd, Patch is fine for me. Just remove the #include <stdlib.h> from top of imagepreview.cpp... C Ansi header must be limited if possible to improve portability. Another tip : if you really need to use C Ansi header, i recommend to always use C++ header instead, we it's possible (it not always the case). For ex.: #include <math.h> ==> #include <cmath> C++ header don't use .h extension and generally add 'c' char on front of file name. Note than not all C Ansi header file have been converter to C++ like (for Ex. #include <stdint.h>). In this case the C Ansi header need to be wrapped around "extern "C" {...}"... Gilles SVN commit 800239 by abaecker: Make the zoom values of the slider snap to specific values (fit-to-window, 50% view, and 100% view). CCBUGS: 157314 TODO:KDE4PORT M +2 -1 NEWS M +5 -0 digikam/albumwidgetstack.cpp M +1 -0 digikam/albumwidgetstack.h M +1 -1 digikam/digikamview.cpp M +62 -2 libs/widgets/common/previewwidget.cpp M +3 -0 libs/widgets/common/previewwidget.h M +1 -1 libs/widgets/imageplugins/imagepannelwidget.cpp M +2 -2 utilities/lighttable/lighttableview.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=800239 Gilles, thanks for the review - the #include <stdlib.h> was indeed a left-over from testing ... I think that the main point of the wish is fulfilled. The same will have to be done for the image editor, see http://bugs.kde.org/show_bug.cgi?id=161085 Arnd, I will take a look into 161085. Note look here about C Ansi header and C++: http://www.cs.sunysb.edu/facilities/FAQ/gccfaq/standard_header_files.html Gilles Arnd, Qt3 => Qt4 port feedback : QValueList<double> ==> QList<double> qHeapSort(QValueList<double>) ==> qSort(QList<double>) Gilles SVN commit 800397 by cgilles: backport commit #800239 from KDE3 branch BUG: 157314 M +5 -0 digikam/albumwidgetstack.cpp M +1 -0 digikam/albumwidgetstack.h M +7 -7 digikam/digikamview.cpp M +63 -3 libs/widgets/common/previewwidget.cpp M +4 -1 libs/widgets/common/previewwidget.h M +1 -1 libs/widgets/imageplugins/imagepannelwidget.cpp M +3 -3 utilities/lighttable/lighttableview.cpp M +1 -1 utilities/lighttable/lighttableview.h WebSVN link: http://websvn.kde.org/?view=rev&revision=800397 |