Remember zoom % and pan offset when opening another image, issue 2435

This commit is contained in:
DrSlony
2015-03-21 13:51:56 +01:00
parent f86fd06b11
commit 1ec6ff068b
10 changed files with 80 additions and 32 deletions

View File

@@ -26,7 +26,7 @@
#include "../rtengine/refreshmap.h"
#include "options.h"
ImageArea::ImageArea (ImageAreaPanel* p) : parent(p) {
ImageArea::ImageArea (ImageAreaPanel* p) : parent(p), firstOpen(true) {
infotext = "";
cropgl = NULL;
@@ -520,8 +520,25 @@ void ImageArea::setZoom (double zoom) {
void ImageArea::initialImageArrived (CropWindow* cw) {
if (mainCropWindow)
mainCropWindow->zoomFit ();
if (mainCropWindow) {
if(firstOpen || options.prevdemo!=PD_Sidecar || (!options.rememberZoomAndPan) ) {
mainCropWindow->zoomFit (false);
firstOpen = false;
mainCropWindow->cropHandler.getFullImageSize(fullImageWidth,fullImageHeight);
} else {
int w,h;
mainCropWindow->cropHandler.getFullImageSize(w,h);
if(w == fullImageWidth && h == fullImageHeight) { // && mainCropWindow->getZoom() != mainCropWindow->getZoomFitVal()) {
int x,y;
mainCropWindow->getCropPosition(x,y);
mainCropWindow->setCropPosition(x,y, false);
} else {
mainCropWindow->zoomFit (false);
}
fullImageWidth = w;
fullImageHeight = h;
}
}
}
void ImageArea::syncBeforeAfterViews () {