some tweaks to the cropping GUI, inspired by recent comments on pixls.us

This commit is contained in:
Alberto Griggio
2018-01-01 22:48:16 +01:00
parent e9782e15e2
commit 0ac3bafbca
2 changed files with 20 additions and 6 deletions

View File

@@ -313,7 +313,7 @@ void CropWindow::buttonPress (int button, int type, int bstate, int x, int y)
changeZoom (zoom11index, true, action_x, action_y);
fitZoom = false;
} else {
zoomFit ();
zoomFitCrop ();
}
} else {
zoom11 ();
@@ -612,6 +612,10 @@ void CropWindow::buttonRelease (int button, int num, int bstate, int x, int y)
}
needRedraw = true;
if (fitZoom) {
zoomFitCrop();
}
} else if (state == SCropWinMove) {
if (iarea->showColorPickers () && !colorPickers.empty()) {
needRedraw = true;
@@ -722,6 +726,10 @@ void CropWindow::buttonRelease (int button, int num, int bstate, int x, int y)
cropgl->cropManipReady ();
iarea->setToolHand ();
needRedraw = true;
if (fitZoom) {
zoomFitCrop();
}
}
if (decorated) {
@@ -1356,6 +1364,12 @@ void CropWindow::expose (Cairo::RefPtr<Cairo::Context> cr)
drawObservedFrame (cr);
}
} else {
CropParams cropParams = cropHandler.cropParams;
if (state == SNormal && cropParams.guide != "None") {
cropParams.guide = "Frame";
}
bool useBgColor = (state == SNormal);
if (cropHandler.cropPixbuf) {
imgW = cropHandler.cropPixbuf->get_width ();
imgH = cropHandler.cropPixbuf->get_height ();
@@ -1772,7 +1786,7 @@ void CropWindow::expose (Cairo::RefPtr<Cairo::Context> cr)
if (cropHandler.cropParams.enabled) {
int cropX, cropY;
cropHandler.getPosition (cropX, cropY);
drawCrop (cr, x + imgAreaX + imgX, y + imgAreaY + imgY, imgW, imgH, cropX, cropY, zoomSteps[cropZoom].zoom, cropHandler.cropParams, (this == iarea->mainCropWindow), true, cropHandler.isFullDisplay ());
drawCrop (cr, x + imgAreaX + imgX, y + imgAreaY + imgY, imgW, imgH, cropX, cropY, zoomSteps[cropZoom].zoom, cropParams, (this == iarea->mainCropWindow), useBgColor, cropHandler.isFullDisplay ());
}
if (observedCropWin) {
@@ -1853,7 +1867,7 @@ void CropWindow::expose (Cairo::RefPtr<Cairo::Context> cr)
cr->fill();
if (cropHandler.cropParams.enabled) {
drawCrop (cr, x + imgAreaX + imgX, y + imgAreaY + imgY, rough->get_width(), rough->get_height(), cropX, cropY, zoomSteps[cropZoom].zoom, cropHandler.cropParams, (this == iarea->mainCropWindow), true, cropHandler.isFullDisplay ());
drawCrop (cr, x + imgAreaX + imgX, y + imgAreaY + imgY, rough->get_width(), rough->get_height(), cropX, cropY, zoomSteps[cropZoom].zoom, cropParams, (this == iarea->mainCropWindow), useBgColor, cropHandler.isFullDisplay ());
}
if (observedCropWin) {
@@ -2097,7 +2111,7 @@ void CropWindow::zoomFitCrop ()
centerY = cropHandler.cropParams.y + cropHandler.cropParams.h / 2;
setCropAnchorPosition(centerX, centerY);
changeZoom (cz, true, centerX, centerY);
fitZoom = false;
fitZoom = true; //false;
} else {
zoomFit();
}

View File

@@ -638,7 +638,7 @@ void ImageArea::initialImageArrived (CropWindow* cw)
if (mainCropWindow) {
if(firstOpen || options.prevdemo != PD_Sidecar || (!options.rememberZoomAndPan) ) {
mainCropWindow->zoomFit ();
mainCropWindow->zoomFitCrop ();
firstOpen = false;
mainCropWindow->cropHandler.getFullImageSize(fullImageWidth, fullImageHeight);
} else {
@@ -646,7 +646,7 @@ void ImageArea::initialImageArrived (CropWindow* cw)
mainCropWindow->cropHandler.getFullImageSize(w, h);
if(w != fullImageWidth || h != fullImageHeight) {
mainCropWindow->zoomFit ();
mainCropWindow->zoomFitCrop ();
}
fullImageWidth = w;