Added fit-crop-to-screen Editor button, issue 2706

This commit is contained in:
DrSlony
2015-03-11 15:59:41 +01:00
parent 598161a50d
commit 1addf4bf3c
13 changed files with 570 additions and 7 deletions

View File

@@ -1575,6 +1575,27 @@ void CropWindow::zoomFit () {
fitZoom = true;
}
void CropWindow::zoomFitCrop () {
if(cropHandler.cropParams.enabled) {
double z = cropHandler.getFitCropZoom ();
int cz = MAXZOOMSTEPS;
if (z < zoomSteps[0].zoom)
cz = 0;
else
for (int i=0; i<MAXZOOMSTEPS; i++)
if (zoomSteps[i].zoom <= z && zoomSteps[i+1].zoom > z) {
cz = i;
break;
}
zoomVersion = exposeVersion;
int centerX,centerY;
centerX = cropHandler.cropParams.x + cropHandler.cropParams.w / 2;
centerY = cropHandler.cropParams.y + cropHandler.cropParams.h / 2;
changeZoom (cz, true, centerX, centerY, false);
fitZoom = false;
}
}
void CropWindow::buttonPressed (LWButton* button, int actionCode, void* actionData) {
if (button==bZoomIn) // zoom in
@@ -1597,14 +1618,14 @@ void CropWindow::redrawNeeded (LWButton* button) {
iarea->redraw ();
}
void CropWindow::changeZoom (int zoom, bool notify, int centerx, int centery) {
void CropWindow::changeZoom (int zoom, bool notify, int centerx, int centery, bool skipZoomIfUnchanged) {
if (zoom<0)
zoom = 0;
else if (zoom>MAXZOOMSTEPS)
zoom = MAXZOOMSTEPS;
if (cropZoom == zoom) {
if (cropZoom == zoom && skipZoomIfUnchanged) {
// We are already at the start/end of the zoom range, so we do nothing
return;
}