Merge pull request #4358 from Beep6581/initialimage_fixes

Fix random behaviour when opening images in SETM and 'Auto zoom to fit the crop area' is enabled
This commit is contained in:
Ingo Weyrich
2018-02-03 18:36:21 +01:00
committed by GitHub
5 changed files with 12 additions and 24 deletions

View File

@@ -2577,7 +2577,7 @@ void CropWindow::initialImageArrived ()
{
for (auto listener : listeners) {
listener->initialImageArrived (this);
listener->initialImageArrived();
}
}

View File

@@ -40,7 +40,7 @@ public:
virtual void cropPositionChanged (CropWindow*) {}
virtual void cropWindowSizeChanged (CropWindow*) {}
virtual void cropZoomChanged (CropWindow*) {}
virtual void initialImageArrived (CropWindow*) {}
virtual void initialImageArrived () {}
};
class ImageArea;

View File

@@ -1068,7 +1068,6 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc)
// since there was no resize event
if (iareapanel->imageArea->mainCropWindow) {
iareapanel->imageArea->mainCropWindow->cropHandler.newImage (ipc, false);
iareapanel->imageArea->mainCropWindow->initialImageArrived();
// In single tab mode, the image is not always updated between switches
// normal redraw don't work, so this is the hard way

View File

@@ -25,7 +25,7 @@
#include "../rtengine/refreshmap.h"
#include "options.h"
ImageArea::ImageArea (ImageAreaPanel* p) : parent(p), firstOpen(true), fullImageWidth(0), fullImageHeight(0)
ImageArea::ImageArea (ImageAreaPanel* p) : parent(p), fullImageWidth(0), fullImageHeight(0)
{
infotext = "";
@@ -633,33 +633,23 @@ void ImageArea::setZoom (double zoom)
zoomPanel->refreshZoomLabel ();
}
void ImageArea::initialImageArrived (CropWindow* cw)
void ImageArea::initialImageArrived ()
{
if (mainCropWindow) {
if(firstOpen || options.prevdemo != PD_Sidecar || (!options.rememberZoomAndPan) ) {
int w, h;
mainCropWindow->cropHandler.getFullImageSize(w, h);
if(options.prevdemo != PD_Sidecar || !options.rememberZoomAndPan || w != fullImageWidth || h != fullImageHeight) {
if (options.cropAutoFit || options.bgcolor != 0) {
mainCropWindow->zoomFitCrop();
} else {
mainCropWindow->zoomFit();
}
firstOpen = false;
mainCropWindow->cropHandler.getFullImageSize(fullImageWidth, fullImageHeight);
} else {
int w, h;
mainCropWindow->cropHandler.getFullImageSize(w, h);
if(w != fullImageWidth || h != fullImageHeight) {
if (options.cropAutoFit) {
mainCropWindow->zoomFitCrop();
} else {
mainCropWindow->zoomFit();
}
}
fullImageWidth = w;
fullImageHeight = h;
} else if ((options.cropAutoFit || options.bgcolor != 0) && mainCropWindow->cropHandler.cropParams.enabled) {
mainCropWindow->zoomFitCrop();
}
fullImageWidth = w;
fullImageHeight = h;
}
}

View File

@@ -65,7 +65,6 @@ protected:
void get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const;
void get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const;
bool firstOpen;
int fullImageWidth, fullImageHeight;
public:
CropWindow* mainCropWindow;
@@ -148,7 +147,7 @@ public:
void cropPositionChanged (CropWindow* cw);
void cropWindowSizeChanged (CropWindow* cw);
void cropZoomChanged (CropWindow* cw);
void initialImageArrived (CropWindow* cw) ;
void initialImageArrived ();
// LockablePickerToolListener interface
void switchPickerVisibility (bool isVisible);