From feed87d046c598a9d483600b4b1653b0ba0aed01 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Thu, 16 Mar 2017 14:33:26 +0100 Subject: [PATCH 1/9] adding more zoom levels to the image editor --- rtgui/crophandler.cc | 43 +++++++++++---------- rtgui/cropwindow.cc | 91 ++++++++++++++++++++++---------------------- rtgui/cropwindow.h | 13 +++++++ 3 files changed, 82 insertions(+), 65 deletions(-) diff --git a/rtgui/crophandler.cc b/rtgui/crophandler.cc index 42c6eb756..28be67705 100644 --- a/rtgui/crophandler.cc +++ b/rtgui/crophandler.cc @@ -30,7 +30,7 @@ using namespace rtengine; CropHandler::CropHandler () - : zoom(10), ww(0), wh(0), imx(-1), imy(-1), imw(0), imh(0), cax(-1), cay(-1), + : zoom(100), ww(0), wh(0), imx(-1), imy(-1), imw(0), imh(0), cax(-1), cay(-1), cx(0), cy(0), cw(0), ch(0), cropX(0), cropY(0), cropW(0), cropH(0), enabled(false), cropimg(nullptr), cropimgtrue(nullptr), cropimg_width(0), cropimg_height(0), cix(0), ciy(0), ciw(0), cih(0), cis(1), @@ -145,8 +145,8 @@ void CropHandler::setZoom (int z, int centerx, int centery) assert (ipc); int oldZoom = zoom; - float oldScale = zoom >= 1000 ? float(zoom / 1000) : 1.f / float(zoom); - float newScale = z >= 1000 ? float(z / 1000) : 1.f / float(z); + float oldScale = zoom >= 1000 ? float(zoom / 1000) : 10.f / float(zoom); + float newScale = z >= 1000 ? float(z / 1000) : 10.f / float(z); int oldcax = cax; int oldcay = cay; @@ -176,8 +176,8 @@ void CropHandler::setZoom (int z, int centerx, int centery) cw = ww * 1000 / zoom; ch = wh * 1000 / zoom; } else { - cw = ww * zoom; - ch = wh * zoom; + cw = ww * zoom / 10; + ch = wh * zoom / 10; } cx = cax - cw / 2; @@ -206,7 +206,7 @@ float CropHandler::getZoomFactor () if (zoom >= 1000) { return zoom / 1000; } else { - return 1.f / (float)zoom; + return 10.f / (float)zoom; } } @@ -221,8 +221,8 @@ void CropHandler::setWSize (int w, int h) cw = ww * 1000 / zoom; ch = wh * 1000 / zoom; } else { - cw = ww * zoom; - ch = wh * zoom; + cw = ww * zoom/10; + ch = wh * zoom/10; } compDim (); @@ -320,7 +320,7 @@ void CropHandler::setDetailedCrop (IImage8* im, IImage8* imtrue, rtengine::procp cropimgtrue = nullptr; - if (ax == cropX && ay == cropY && aw == cropW && ah == cropH && askip == (zoom >= 1000 ? 1 : zoom)) { + if (ax == cropX && ay == cropY && aw == cropW && ah == cropH && askip == (zoom >= 1000 ? 1 : zoom/10)) { cropimg_width = im->getWidth (); cropimg_height = im->getHeight (); cropimg = new unsigned char [3 * cropimg_width * cropimg_height]; @@ -362,11 +362,14 @@ void CropHandler::setDetailedCrop (IImage8* im, IImage8* imtrue, rtengine::procp } if (ch->cropimg) { - if (ch->cix == ch->cropX && ch->ciy == ch->cropY && ch->ciw == ch->cropW && ch->cih == ch->cropH && ch->cis == (ch->zoom >= 1000 ? 1 : ch->zoom)) { + if (ch->cix == ch->cropX && ch->ciy == ch->cropY && ch->ciw == ch->cropW && ch->cih == ch->cropH && ch->cis == (ch->zoom >= 1000 ? 1 : ch->zoom/10)) { // calculate final image size - int czoom = ch->zoom < 1000 ? 1000 : ch->zoom; - int imw = ch->cropimg_width * czoom / 1000; - int imh = ch->cropimg_height * czoom / 1000; + //int czoom = ch->zoom < 1000 ? 1000 : ch->zoom; + float czoom = ch->zoom >= 1000 ? + ch->zoom / 1000.f : + float((ch->zoom/10) * 10) / float(ch->zoom); + int imw = ch->cropimg_width * czoom;// / 1000; + int imh = ch->cropimg_height * czoom;// / 1000; if (imw > ch->ww) { imw = ch->ww; @@ -378,12 +381,12 @@ void CropHandler::setDetailedCrop (IImage8* im, IImage8* imtrue, rtengine::procp Glib::RefPtr tmpPixbuf = Gdk::Pixbuf::create_from_data (ch->cropimg, Gdk::COLORSPACE_RGB, false, 8, ch->cropimg_width, 2 * ch->cropimg_height, 3 * ch->cropimg_width); ch->cropPixbuf = Gdk::Pixbuf::create (Gdk::COLORSPACE_RGB, false, 8, imw, imh); - tmpPixbuf->scale (ch->cropPixbuf, 0, 0, imw, imh, 0, 0, czoom / 1000.0, czoom / 1000.0, Gdk::INTERP_NEAREST); + tmpPixbuf->scale (ch->cropPixbuf, 0, 0, imw, imh, 0, 0, czoom /* / 1000.0*/, czoom /* / 1000.0*/, Gdk::INTERP_NEAREST); tmpPixbuf.clear (); Glib::RefPtr tmpPixbuftrue = Gdk::Pixbuf::create_from_data (ch->cropimgtrue, Gdk::COLORSPACE_RGB, false, 8, ch->cropimg_width, 2 * ch->cropimg_height, 3 * ch->cropimg_width); ch->cropPixbuftrue = Gdk::Pixbuf::create (Gdk::COLORSPACE_RGB, false, 8, imw, imh); - tmpPixbuftrue->scale (ch->cropPixbuftrue, 0, 0, imw, imh, 0, 0, czoom / 1000.0, czoom / 1000.0, Gdk::INTERP_NEAREST); + tmpPixbuftrue->scale (ch->cropPixbuftrue, 0, 0, imw, imh, 0, 0, czoom /* / 1000.0*/, czoom /* / 1000.0*/, Gdk::INTERP_NEAREST); tmpPixbuftrue.clear (); } @@ -432,7 +435,7 @@ bool CropHandler::getWindow (int& cwx, int& cwy, int& cww, int& cwh, int& cskip) cwh = 32; } - cskip = zoom >= 1000 ? 1 : zoom; + cskip = zoom >= 1000 ? 1 : zoom/10; return true; } @@ -615,12 +618,12 @@ void CropHandler::compDim () scaledCAX = cax * (zoom/1000); scaledCAY = cay * (zoom/1000); } else { - wwImgSpace = int(float(ww) * float(zoom) + 0.5f); - whImgSpace = int(float(wh) * float(zoom) + 0.5f); + wwImgSpace = int(float(ww) * (float(zoom)/10.f) + 0.5f); + whImgSpace = int(float(wh) * (float(zoom)/10.f) + 0.5f); //scaledFullW = fullW / zoom; //scaledFullH = fullH / zoom; - scaledCAX = cax / zoom; - scaledCAY = cay / zoom; + scaledCAX = int(float(cax) / (float(zoom)/10.f)); + scaledCAY = int(float(cay) / (float(zoom)/10.f)); } imgX = ww / 2 - scaledCAX; diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index 46c956436..0dbece639 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -34,38 +34,6 @@ using namespace rtengine; -struct ZoomStep { - Glib::ustring label; - double zoom; - int czoom; -}; - -ZoomStep zoomSteps[] = { - {" 1%", 0.01, 100}, - {" 2%", 0.02, 50}, - {" 5%", 0.05, 20}, - {"6.7%", 1.0 / 15.0, 15}, - {" 8%", 1.0 / 12.0, 12}, - {" 10%", 0.1, 10}, - {"12.5%", 0.125, 8}, - {" 14%", 1.0 / 7.0, 7}, - {"16.6%", 1.0 / 6.0, 6}, - {" 20%", 0.2, 5}, - {" 25%", 0.25, 4}, - {" 33%", 1.0 / 3.0, 3}, - {" 50%", 0.5, 2}, - {"100%", 1.0, 1000}, - {"200%", 2.0, 2000}, - {"300%", 3.0, 3000}, - {"400%", 4.0, 4000}, - {"500%", 5.0, 5000}, - {"600%", 6.0, 6000}, - {"700%", 7.0, 7000}, - {"800%", 8.0, 8000} -}; -#define MAXZOOMSTEPS 20 -#define ZOOM11INDEX 13 - CropWindow::CropWindow (ImageArea* parent, bool isLowUpdatePriority_, bool isDetailWindow) : ObjectMOBuffer(parent), state(SNormal), press_x(0), press_y(0), action_x(0), action_y(0), pickedObject(-1), pickModifierKey(0), rot_deg(0), onResizeArea(false), deleted(false), fitZoomEnabled(true), fitZoom(false), isLowUpdatePriority(isLowUpdatePriority_), hoveredPicker(nullptr), cropLabel(Glib::ustring("100%")), @@ -74,6 +42,8 @@ CropWindow::CropWindow (ImageArea* parent, bool isLowUpdatePriority_, bool isDet imgX(-1), imgY(-1), imgW(1), imgH(1), iarea(parent), cropZoom(0), zoomVersion(0), exposeVersion(0), cropgl(nullptr), pmlistener(nullptr), pmhlistener(nullptr), observedCropWin(nullptr) { + initZoomSteps(); + Glib::RefPtr context = parent->get_pango_context () ; Pango::FontDescription fontd = context->get_font_description (); fontd.set_weight (Pango::WEIGHT_BOLD); @@ -120,6 +90,37 @@ CropWindow::~CropWindow () } } + +void CropWindow::initZoomSteps() +{ + zoomSteps.push_back(ZoomStep(" 1%", 0.01, 999)); + zoomSteps.push_back(ZoomStep(" 2%", 0.02, 500)); + zoomSteps.push_back(ZoomStep(" 5%", 0.05, 200)); + zoomSteps.push_back(ZoomStep(" 6%", 1.0/15.0, 150)); + zoomSteps.push_back(ZoomStep(" 8%", 1.0/12.0, 120)); + char lbl[64]; + for (int s = 100; s >= 50; s -= 5) { + float z = 10./float(s); + sprintf(lbl, "% 2d%%", int(z * 100)); + zoomSteps.push_back(ZoomStep(lbl, z, s)); + } + for (int s = 45; s >= 27; s -= 3) { + float z = 10./float(s); + sprintf(lbl, "% 2d%%", int(z * 100)); + zoomSteps.push_back(ZoomStep(lbl, z, s)); + } + for (int s = 25; s >= 11; --s) { + float z = 10./float(s); + sprintf(lbl, "% 2d%%", int(z * 100)); + zoomSteps.push_back(ZoomStep(lbl, z, s)); + } + zoom11index = zoomSteps.size(); + for (int s = 1; s <= 8; ++s) { + sprintf(lbl, "%d00", s); + zoomSteps.push_back(ZoomStep(lbl, s, s * 1000)); + } +} + void CropWindow::enable() { cropHandler.setEnabled (true); @@ -316,7 +317,7 @@ void CropWindow::buttonPress (int button, int type, int bstate, int x, int y) state = SNormal; zoomVersion = exposeVersion; screenCoordToImage (x, y, action_x, action_y); - changeZoom (ZOOM11INDEX, true, action_x, action_y); + changeZoom (zoom11index, true, action_x, action_y); fitZoom = false; } else { zoomFit (); @@ -1967,7 +1968,7 @@ void CropWindow::zoom11 () zoomVersion = exposeVersion; } - changeZoom (ZOOM11INDEX, true, x, y); + changeZoom (zoom11index, true, x, y); fitZoom = false; } @@ -1984,17 +1985,17 @@ bool CropWindow::isMinZoom () bool CropWindow::isMaxZoom () { - return cropZoom >= MAXZOOMSTEPS; + return cropZoom >= int(zoomSteps.size())-1; } void CropWindow::setZoom (double zoom) { - int cz = MAXZOOMSTEPS; + int cz = int(zoomSteps.size())-1; if (zoom < zoomSteps[0].zoom) { cz = 0; } else - for (int i = 0; i < MAXZOOMSTEPS; i++) + for (int i = 0; i < int(zoomSteps.size())-1; i++) if (zoomSteps[i].zoom <= zoom && zoomSteps[i + 1].zoom > zoom) { cz = i; break; @@ -2006,12 +2007,12 @@ void CropWindow::setZoom (double zoom) double CropWindow::getZoomFitVal () { double z = cropHandler.getFitZoom (); - int cz = MAXZOOMSTEPS; + int cz = int(zoomSteps.size())-1; if (z < zoomSteps[0].zoom) { cz = 0; } else - for (int i = 0; i < MAXZOOMSTEPS; i++) + for (int i = 0; i < int(zoomSteps.size())-1; i++) if (zoomSteps[i].zoom <= z && zoomSteps[i + 1].zoom > z) { cz = i; break; @@ -2025,12 +2026,12 @@ void CropWindow::zoomFit () { double z = cropHandler.getFitZoom (); - int cz = MAXZOOMSTEPS; + int cz = int(zoomSteps.size())-1; if (z < zoomSteps[0].zoom) { cz = 0; } else - for (int i = 0; i < MAXZOOMSTEPS; i++) + for (int i = 0; i < int(zoomSteps.size())-1; i++) if (zoomSteps[i].zoom <= z && zoomSteps[i + 1].zoom > z) { cz = i; break; @@ -2045,12 +2046,12 @@ void CropWindow::zoomFitCrop () { if(cropHandler.cropParams.enabled) { double z = cropHandler.getFitCropZoom (); - int cz = MAXZOOMSTEPS; + int cz = int(zoomSteps.size())-1; if (z < zoomSteps[0].zoom) { cz = 0; } else - for (int i = 0; i < MAXZOOMSTEPS; i++) + for (int i = 0; i < int(zoomSteps.size())-1; i++) if (zoomSteps[i].zoom <= z && zoomSteps[i + 1].zoom > z) { cz = i; break; @@ -2125,8 +2126,8 @@ void CropWindow::changeZoom (int zoom, bool notify, int centerx, int centery) if (zoom < 0) { zoom = 0; - } else if (zoom > MAXZOOMSTEPS) { - zoom = MAXZOOMSTEPS; + } else if (zoom > int(zoomSteps.size())-1) { + zoom = int(zoomSteps.size())-1; } cropZoom = zoom; diff --git a/rtgui/cropwindow.h b/rtgui/cropwindow.h index 52418e750..935928b88 100644 --- a/rtgui/cropwindow.h +++ b/rtgui/cropwindow.h @@ -114,6 +114,19 @@ class CropWindow : public LWButtonListener, public CropDisplayHandler, public Ed // Used by the mainCropWindow only void getObservedFrameArea (int& x, int& y, int& w, int& h, int rw = 0, int rh = 0); + struct ZoomStep { + Glib::ustring label; + double zoom; + int czoom; + + explicit ZoomStep(const Glib::ustring &l="", double z=0.0, int cz=0): + label(l), zoom(z), czoom(cz) {} + }; + std::vector zoomSteps; + size_t zoom11index; + + void initZoomSteps(); + public: CropHandler cropHandler; CropWindow (ImageArea* parent, bool isLowUpdatePriority_, bool isDetailWindow); From d41bd0d7e342b0f5f02e439c0ea48cff6a3d0179 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Thu, 16 Mar 2017 16:48:08 +0100 Subject: [PATCH 2/9] fixed typo in showing zoom percentage when the zoom factor is >= 1 --- rtgui/cropwindow.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index 0dbece639..412851dde 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -116,7 +116,7 @@ void CropWindow::initZoomSteps() } zoom11index = zoomSteps.size(); for (int s = 1; s <= 8; ++s) { - sprintf(lbl, "%d00", s); + sprintf(lbl, "%d00%%", s); zoomSteps.push_back(ZoomStep(lbl, s, s * 1000)); } } From 674cdb93be3b607e2b72f526a7ceb38d9cdf5da0 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Thu, 16 Mar 2017 23:32:02 +0100 Subject: [PATCH 3/9] improved "zoom to fit" functionality - fix regression in image quality for the previous zoom levels - ignore the finer-grained zoom levels when zooming manually (either with the scroll wheel or with the buttons), but use them only only for zoom to fit --- rtgui/crophandler.cc | 21 ++++++++++----------- rtgui/cropwindow.cc | 39 +++++++++++++++++++-------------------- rtgui/cropwindow.h | 6 ++++-- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/rtgui/crophandler.cc b/rtgui/crophandler.cc index 28be67705..4b010d387 100644 --- a/rtgui/crophandler.cc +++ b/rtgui/crophandler.cc @@ -176,8 +176,8 @@ void CropHandler::setZoom (int z, int centerx, int centery) cw = ww * 1000 / zoom; ch = wh * 1000 / zoom; } else { - cw = ww * zoom / 10; - ch = wh * zoom / 10; + cw = ww * (zoom / 10); + ch = wh * (zoom / 10); } cx = cax - cw / 2; @@ -221,8 +221,8 @@ void CropHandler::setWSize (int w, int h) cw = ww * 1000 / zoom; ch = wh * 1000 / zoom; } else { - cw = ww * zoom/10; - ch = wh * zoom/10; + cw = ww * (zoom / 10); + ch = wh * (zoom / 10); } compDim (); @@ -320,7 +320,7 @@ void CropHandler::setDetailedCrop (IImage8* im, IImage8* imtrue, rtengine::procp cropimgtrue = nullptr; - if (ax == cropX && ay == cropY && aw == cropW && ah == cropH && askip == (zoom >= 1000 ? 1 : zoom/10)) { + if (ax == cropX && ay == cropY && aw == cropW && ah == cropH && askip == (zoom >= 1000 ? 1 : zoom / 10)) { cropimg_width = im->getWidth (); cropimg_height = im->getHeight (); cropimg = new unsigned char [3 * cropimg_width * cropimg_height]; @@ -362,14 +362,13 @@ void CropHandler::setDetailedCrop (IImage8* im, IImage8* imtrue, rtengine::procp } if (ch->cropimg) { - if (ch->cix == ch->cropX && ch->ciy == ch->cropY && ch->ciw == ch->cropW && ch->cih == ch->cropH && ch->cis == (ch->zoom >= 1000 ? 1 : ch->zoom/10)) { + if (ch->cix == ch->cropX && ch->ciy == ch->cropY && ch->ciw == ch->cropW && ch->cih == ch->cropH && ch->cis == (ch->zoom >= 1000 ? 1 : ch->zoom / 10)) { // calculate final image size - //int czoom = ch->zoom < 1000 ? 1000 : ch->zoom; float czoom = ch->zoom >= 1000 ? ch->zoom / 1000.f : float((ch->zoom/10) * 10) / float(ch->zoom); - int imw = ch->cropimg_width * czoom;// / 1000; - int imh = ch->cropimg_height * czoom;// / 1000; + int imw = ch->cropimg_width * czoom; + int imh = ch->cropimg_height * czoom; if (imw > ch->ww) { imw = ch->ww; @@ -381,12 +380,12 @@ void CropHandler::setDetailedCrop (IImage8* im, IImage8* imtrue, rtengine::procp Glib::RefPtr tmpPixbuf = Gdk::Pixbuf::create_from_data (ch->cropimg, Gdk::COLORSPACE_RGB, false, 8, ch->cropimg_width, 2 * ch->cropimg_height, 3 * ch->cropimg_width); ch->cropPixbuf = Gdk::Pixbuf::create (Gdk::COLORSPACE_RGB, false, 8, imw, imh); - tmpPixbuf->scale (ch->cropPixbuf, 0, 0, imw, imh, 0, 0, czoom /* / 1000.0*/, czoom /* / 1000.0*/, Gdk::INTERP_NEAREST); + tmpPixbuf->scale (ch->cropPixbuf, 0, 0, imw, imh, 0, 0, czoom, czoom, Gdk::INTERP_NEAREST); tmpPixbuf.clear (); Glib::RefPtr tmpPixbuftrue = Gdk::Pixbuf::create_from_data (ch->cropimgtrue, Gdk::COLORSPACE_RGB, false, 8, ch->cropimg_width, 2 * ch->cropimg_height, 3 * ch->cropimg_width); ch->cropPixbuftrue = Gdk::Pixbuf::create (Gdk::COLORSPACE_RGB, false, 8, imw, imh); - tmpPixbuftrue->scale (ch->cropPixbuftrue, 0, 0, imw, imh, 0, 0, czoom /* / 1000.0*/, czoom /* / 1000.0*/, Gdk::INTERP_NEAREST); + tmpPixbuftrue->scale (ch->cropPixbuftrue, 0, 0, imw, imh, 0, 0, czoom, czoom, Gdk::INTERP_NEAREST); tmpPixbuftrue.clear (); } diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index 412851dde..996ec33f7 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -93,31 +93,22 @@ CropWindow::~CropWindow () void CropWindow::initZoomSteps() { - zoomSteps.push_back(ZoomStep(" 1%", 0.01, 999)); - zoomSteps.push_back(ZoomStep(" 2%", 0.02, 500)); - zoomSteps.push_back(ZoomStep(" 5%", 0.05, 200)); - zoomSteps.push_back(ZoomStep(" 6%", 1.0/15.0, 150)); - zoomSteps.push_back(ZoomStep(" 8%", 1.0/12.0, 120)); + zoomSteps.push_back(ZoomStep(" 1%", 0.01, 999, true)); + zoomSteps.push_back(ZoomStep(" 2%", 0.02, 500, true)); + zoomSteps.push_back(ZoomStep(" 5%", 0.05, 200, true)); + zoomSteps.push_back(ZoomStep(" 6%", 1.0/15.0, 150, true)); + zoomSteps.push_back(ZoomStep(" 8%", 1.0/12.0, 120, true)); char lbl[64]; - for (int s = 100; s >= 50; s -= 5) { + for (int s = 100; s >= 11; --s) { float z = 10./float(s); sprintf(lbl, "% 2d%%", int(z * 100)); - zoomSteps.push_back(ZoomStep(lbl, z, s)); - } - for (int s = 45; s >= 27; s -= 3) { - float z = 10./float(s); - sprintf(lbl, "% 2d%%", int(z * 100)); - zoomSteps.push_back(ZoomStep(lbl, z, s)); - } - for (int s = 25; s >= 11; --s) { - float z = 10./float(s); - sprintf(lbl, "% 2d%%", int(z * 100)); - zoomSteps.push_back(ZoomStep(lbl, z, s)); + bool is_major = (s == s/10 * 10); + zoomSteps.push_back(ZoomStep(lbl, z, s, is_major)); } zoom11index = zoomSteps.size(); for (int s = 1; s <= 8; ++s) { sprintf(lbl, "%d00%%", s); - zoomSteps.push_back(ZoomStep(lbl, s, s * 1000)); + zoomSteps.push_back(ZoomStep(lbl, s, s * 1000, true)); } } @@ -1928,7 +1919,11 @@ void CropWindow::zoomIn (bool toCursor, int cursorX, int cursorY) } } - changeZoom (cropZoom + 1, true, x, y); + int z = cropZoom + 1; + while (z < int(zoomSteps.size()) && !zoomSteps[z].is_major) { + ++z; + } + changeZoom (z, true, x, y); fitZoom = false; } @@ -1944,7 +1939,11 @@ void CropWindow::zoomOut (bool toCursor, int cursorX, int cursorY) } zoomVersion = exposeVersion; - changeZoom (cropZoom - 1, true, x, y); + int z = cropZoom - 1; + while (z >= 0 && !zoomSteps[z].is_major) { + --z; + } + changeZoom (z, true, x, y); fitZoom = false; } diff --git a/rtgui/cropwindow.h b/rtgui/cropwindow.h index 935928b88..66b6405c5 100644 --- a/rtgui/cropwindow.h +++ b/rtgui/cropwindow.h @@ -118,9 +118,11 @@ class CropWindow : public LWButtonListener, public CropDisplayHandler, public Ed Glib::ustring label; double zoom; int czoom; + bool is_major; - explicit ZoomStep(const Glib::ustring &l="", double z=0.0, int cz=0): - label(l), zoom(z), czoom(cz) {} + explicit ZoomStep(const Glib::ustring &l="", double z=0.0, + int cz=0, bool m=false): + label(l), zoom(z), czoom(cz), is_major(m) {} }; std::vector zoomSteps; size_t zoom11index; From 51f909a21e0eb055fcbd7f22d66eaf7f2eb39ec1 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Fri, 17 Mar 2017 09:04:07 +0100 Subject: [PATCH 4/9] added option for selecting whether to use the extended zoom levels --- rtdata/languages/default | 2 ++ rtgui/cropwindow.cc | 4 +++- rtgui/options.cc | 6 ++++++ rtgui/options.h | 1 + rtgui/preferences.cc | 12 ++++++++++-- rtgui/preferences.h | 1 + 6 files changed, 23 insertions(+), 3 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index ec61230ff..bf56372e5 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1055,6 +1055,8 @@ PREFERENCES_PRTPROFILE;Color profile PREFERENCES_PSPATH;Adobe Photoshop installation directory PREFERENCES_REMEMBERZOOMPAN;Remember zoom % and pan offset PREFERENCES_REMEMBERZOOMPAN_TOOLTIP;Remember the zoom % and pan offset of the current image when opening a new image.\n\nThis option only works in "Single Editor Tab Mode" and when "Demosaicing method used for the preview at <100% zoom" is set to "As in PP3". +PREFERENCES_EXTENDEDZOOMLEVELS;Use finer-grained zoom levels for "fit to screen" zooming +PREFERENCES_EXTENDEDZOOMLEVELS_TOOLTIP;This allows to better fill the editor window when using one of the "fit to screen" zoom modes. However, the preview quality might be slightly degraded, depending on the actual zoom factor computed. (Requires a restart to take effect) PREFERENCES_RGBDTL_LABEL;Max number of threads for Noise Reduction and Wavelet Levels PREFERENCES_RGBDTL_TOOLTIP;Leave the setting at "0" to automatically use as many threads as possible. The more threads run in parallel, the faster the computation. Refer to RawPedia for memory requirements. PREFERENCES_SELECTFONT;Select main font diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index 996ec33f7..576997294 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -103,7 +103,9 @@ void CropWindow::initZoomSteps() float z = 10./float(s); sprintf(lbl, "% 2d%%", int(z * 100)); bool is_major = (s == s/10 * 10); - zoomSteps.push_back(ZoomStep(lbl, z, s, is_major)); + if (is_major || options.extendedZoomLevelsForFit) { + zoomSteps.push_back(ZoomStep(lbl, z, s, is_major)); + } } zoom11index = zoomSteps.size(); for (int s = 1; s <= 8; ++s) { diff --git a/rtgui/options.cc b/rtgui/options.cc index 2f71a7106..f05cfb63b 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -348,6 +348,7 @@ void Options::setDefaults () lastScale = 5; panAccelFactor = 5; rememberZoomAndPan = true; + extendedZoomLevelsForFit = false; lastCropSize = 1; fbOnlyRaw = false; fbShowDateTime = true; @@ -1348,6 +1349,10 @@ int Options::readFromFile (Glib::ustring fname) rememberZoomAndPan = keyFile.get_boolean ("GUI", "RememberZoomAndPan"); } + if (keyFile.has_key ("GUI", "ExtendedZoomLevelsForFit")) { + extendedZoomLevelsForFit = keyFile.get_boolean ("GUI", "ExtendedZoomLevelsForFit"); + } + if (keyFile.has_key ("GUI", "LastCropSize")) { lastCropSize = keyFile.get_integer ("GUI", "LastCropSize"); } @@ -2023,6 +2028,7 @@ int Options::saveToFile (Glib::ustring fname) keyFile.set_integer ("GUI", "LastPreviewScale", lastScale); keyFile.set_integer ("GUI", "PanAccelFactor", panAccelFactor); keyFile.set_boolean ("GUI", "RememberZoomAndPan", rememberZoomAndPan); + keyFile.set_boolean ("GUI", "ExtendedZoomLevelsForFit", extendedZoomLevelsForFit); keyFile.set_integer ("GUI", "LastCropSize", lastCropSize); keyFile.set_boolean ("GUI", "ShowHistory", showHistory); keyFile.set_integer ("GUI", "ShowFilePanelState", showFilePanelState); diff --git a/rtgui/options.h b/rtgui/options.h index 522fe2bf5..5581080cd 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -215,6 +215,7 @@ public: bool filmStripShowFileNames; bool tabbedUI; bool rememberZoomAndPan; + bool extendedZoomLevelsForFit; int multiDisplayMode; // 0=none, 1=Edit panels on other display std::vector cutOverlayBrush; // Red;Green;Blue;Alpha , all ranging 0..1 std::vector navGuideBrush; // Red;Green;Blue;Alpha , all ranging 0..1 diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 5b28d94c1..a4267c116 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -1132,11 +1132,17 @@ Gtk::Widget* Preferences::getGeneralPanel () navigationGrid->attach_next_to(*panFactorLabel, Gtk::POS_LEFT, 1, 1); navigationGrid->attach_next_to(*panFactor, *panFactorLabel, Gtk::POS_RIGHT, 1, 1); + Gtk::HBox *zoombox = Gtk::manage(new Gtk::HBox()); rememberZoomPanCheckbutton = Gtk::manage( new Gtk::CheckButton (M("PREFERENCES_REMEMBERZOOMPAN")) ); - setExpandAlignProperties(rememberZoomPanCheckbutton, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); rememberZoomPanCheckbutton->set_tooltip_text(M("PREFERENCES_REMEMBERZOOMPAN_TOOLTIP")); + extendedZoomLevelsCheckbutton = Gtk::manage( new Gtk::CheckButton (M("PREFERENCES_EXTENDEDZOOMLEVELS")) ); + extendedZoomLevelsCheckbutton->set_tooltip_text(M("PREFERENCES_EXTENDEDZOOMLEVELS_TOOLTIP")); + zoombox->set_spacing(10); + zoombox->pack_start(*rememberZoomPanCheckbutton); + zoombox->pack_start(*extendedZoomLevelsCheckbutton); + setExpandAlignProperties(zoombox, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); - navigationGrid->attach_next_to(*rememberZoomPanCheckbutton, *panFactorLabel, Gtk::POS_BOTTOM, 2, 1); + navigationGrid->attach_next_to(*zoombox, *panFactorLabel, Gtk::POS_BOTTOM, 2, 1); fnav->add (*navigationGrid); mvbsd->attach_next_to(*fnav, *fclip, Gtk::POS_RIGHT, 1, 1); @@ -1570,6 +1576,7 @@ void Preferences::storePreferences () moptions.dateFormat = dateformat->get_text(); moptions.panAccelFactor = (int)panFactor->get_value(); moptions.rememberZoomAndPan = rememberZoomPanCheckbutton->get_active(); + moptions.extendedZoomLevelsForFit = extendedZoomLevelsCheckbutton->get_active(); moptions.fbShowDateTime = showDateTime->get_active (); moptions.fbShowBasicExif = showBasicExif->get_active (); moptions.fbShowExpComp = showExpComp->get_active (); @@ -1792,6 +1799,7 @@ void Preferences::fillPreferences () dateformat->set_text (moptions.dateFormat); panFactor->set_value (moptions.panAccelFactor); rememberZoomPanCheckbutton->set_active (moptions.rememberZoomAndPan); + extendedZoomLevelsCheckbutton->set_active (moptions.extendedZoomLevelsForFit); ctiffserialize->set_active(moptions.serializeTiffRead); setActiveTextOrIndex (*prtProfile, moptions.rtSettings.printerProfile, 0); diff --git a/rtgui/preferences.h b/rtgui/preferences.h index 18c8a466b..8bcfed2f0 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -121,6 +121,7 @@ class Preferences : public Gtk::Dialog, public ProfileStoreListener Gtk::SpinButton* panFactor; Gtk::CheckButton* rememberZoomPanCheckbutton; + Gtk::CheckButton* extendedZoomLevelsCheckbutton; Gtk::ComboBoxText* view; Gtk::ComboBoxText* grey; From 4bf70b72e8950bf66d30f1afc3be1a3d13156b11 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Sat, 18 Mar 2017 17:14:45 +0100 Subject: [PATCH 5/9] fixed zooming and rendering of the preview window when a LCP profile with distortion correction is active fixes #3765 --- rtengine/dcrop.cc | 30 ++++++++++++++++++++++++++++-- rtengine/iptransform.cc | 32 ++++++++++++++++++++++++-------- 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index ffce66ed9..4e944d9fd 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1076,6 +1076,17 @@ void Crop::freeAll () cropAllocated = false; } + +namespace { + +bool check_need_larger_crop_for_lcp_distortion(const ProcParams ¶ms) +{ + return (params.lensProf.lcpFile.length() > 0 && + params.lensProf.useDist); +} + +} // namespace + /** @brief Handles crop's image buffer reallocation and trigger sizeChanged of SizeListener[s] * If the scale changes, this method will free all buffers and reallocate ones of the new size. * It will then tell to the SizeListener that size has changed (sizeChanged) @@ -1130,6 +1141,23 @@ bool Crop::setCropSizes (int rcx, int rcy, int rcw, int rch, int skip, bool inte int orW, orH; parent->imgsrc->getSize (cp, orW, orH); + if (check_need_larger_crop_for_lcp_distortion(parent->params)) { + int fW, fH; + parent->imgsrc->getFullSize(fW, fH); + double dW = double(fW) * 0.15; // TODO - this is hardcoded ATM! + double dH = double(fH) * 0.15; // this is an estimate of the max + // distortion relative to the image + // size. BUT IS 15% REALLY ENOUGH? + // In fact, is there a better way?? + orW = min(int(orW + dW), fW); + orH = min(int(orH + dH), fH); + trafx = max(int(orx - dW/2.0), 0); + trafy = max(int(ory - dH/2.0), 0); + } else { + trafx = orx; + trafy = ory; + } + int cw = skips(bw, skip); int ch = skips(bh, skip); @@ -1226,8 +1254,6 @@ bool Crop::setCropSizes (int rcx, int rcy, int rcw, int rch, int skip, bool inte cropx = bx1; cropy = by1; - trafx = orx; - trafy = ory; if (settings->verbose) { printf ("setsizes ends\n"); diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index 34aab1c7b..abbb5d77d 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -83,6 +83,19 @@ float normn(float a, float b, int n) return pow_F(pown(a, n) + pown(b, n), 1.f / n); } } + +void correct_distortion(const rtengine::LCPMapper *lcp, double &x, double &y, + int cx, int cy) +{ + assert(lcp); + + x += cx; + y += cy; + lcp->correctDistortion(x, y); + x -= cx; + y -= cy; +} + } namespace rtengine @@ -142,7 +155,7 @@ bool ImProcFunctions::transCoord (int W, int H, const std::vector &src, double x_d = src[i].x, y_d = src[i].y; if (pLCPMap && params->lensProf.useDist) { - pLCPMap->correctDistortion(x_d, y_d); // must be first transform + correct_distortion(pLCPMap, x_d, y_d, 0, 0); } y_d = ascale * (y_d - h2); @@ -297,8 +310,12 @@ void ImProcFunctions::transform (Imagefloat* original, Imagefloat* transformed, if (needsLCP()) { // don't check focal length to allow distortion correction for lenses without chip LCPProfile *pLCPProf = lcpStore->getProfile(params->lensProf.lcpFile); - if (pLCPProf) pLCPMap = new LCPMapper(pLCPProf, focalLen, focalLen35mm, focusDist, 0, false, params->lensProf.useDist, - original->getWidth(), original->getHeight(), params->coarse, rawRotationDeg); + if (pLCPProf) { + pLCPMap = new LCPMapper(pLCPProf, focalLen, focalLen35mm, + focusDist, 0, false, + params->lensProf.useDist, + oW, oH, params->coarse, rawRotationDeg); + } } if (!(needsCA() || needsDistortion() || needsRotation() || needsPerspective() || needsLCP()) && (needsVignetting() || needsPCVignetting() || needsGradient())) { @@ -705,7 +722,6 @@ void ImProcFunctions::transformLuminanceOnly (Imagefloat* original, Imagefloat* void ImProcFunctions::transformHighQuality (Imagefloat* original, Imagefloat* transformed, int cx, int cy, int sx, int sy, int oW, int oH, int fW, int fH, const LCPMapper *pLCPMap, bool fullImage) { - double w2 = (double) oW / 2.0 - 0.5; double h2 = (double) oH / 2.0 - 0.5; @@ -762,11 +778,11 @@ void ImProcFunctions::transformHighQuality (Imagefloat* original, Imagefloat* tr oH * tan(hpalpha) * sqrt(SQR(4 * maxRadius) + SQR(oH * tan(hpalpha)))) / (SQR(maxRadius) * 8))); double hpcospt = (hpdeg >= 0 ? 1.0 : -1.0) * cos (hpteta), hptanpt = tan (hpteta); - double ascale = params->commonTrans.autofill ? getTransformAutoFill (oW, oH, fullImage ? pLCPMap : nullptr) : 1.0; + double ascale = params->commonTrans.autofill ? getTransformAutoFill (oW, oH, true /*fullImage*/ ? pLCPMap : nullptr) : 1.0; // smaller crop images are a problem, so only when processing fully bool enableLCPCA = pLCPMap && params->lensProf.useCA && fullImage && pLCPMap->enableCA; - bool enableLCPDist = pLCPMap && params->lensProf.useDist && fullImage; + bool enableLCPDist = pLCPMap && params->lensProf.useDist; // && fullImage; if (enableLCPCA) { enableLCPDist = false; @@ -783,7 +799,7 @@ void ImProcFunctions::transformHighQuality (Imagefloat* original, Imagefloat* tr double x_d = x, y_d = y; if (enableLCPDist) { - pLCPMap->correctDistortion(x_d, y_d); // must be first transform + correct_distortion(pLCPMap, x_d, y_d, cx, cy); // must be first transform } x_d = ascale * (x_d + cx - w2); // centering x coord & scale @@ -960,7 +976,7 @@ void ImProcFunctions::transformPreview (Imagefloat* original, Imagefloat* transf double x_d = x, y_d = y; if (pLCPMap && params->lensProf.useDist) { - pLCPMap->correctDistortion(x_d, y_d); // must be first transform + correct_distortion(pLCPMap, x_d, y_d, cx, cy); // must be first transform } y_d = ascale * (y_d + cy - h2); // centering y coord & scale From 76895027644c0c89376ea10752cd8c823b1d39a6 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Sun, 19 Mar 2017 11:59:19 +0100 Subject: [PATCH 6/9] crophandler: changed Gdk::INTERP_NEAREST to Gdk::INTERP_TILES for better zoom quality --- rtgui/crophandler.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtgui/crophandler.cc b/rtgui/crophandler.cc index a5e3db676..8ff95b01b 100644 --- a/rtgui/crophandler.cc +++ b/rtgui/crophandler.cc @@ -380,12 +380,12 @@ void CropHandler::setDetailedCrop (IImage8* im, IImage8* imtrue, rtengine::procp Glib::RefPtr tmpPixbuf = Gdk::Pixbuf::create_from_data (ch->cropimg, Gdk::COLORSPACE_RGB, false, 8, ch->cropimg_width, ch->cropimg_height, 3 * ch->cropimg_width); ch->cropPixbuf = Gdk::Pixbuf::create (Gdk::COLORSPACE_RGB, false, 8, imw, imh); - tmpPixbuf->scale (ch->cropPixbuf, 0, 0, imw, imh, 0, 0, czoom, czoom, Gdk::INTERP_NEAREST); + tmpPixbuf->scale (ch->cropPixbuf, 0, 0, imw, imh, 0, 0, czoom, czoom, Gdk::INTERP_TILES); tmpPixbuf.clear (); Glib::RefPtr tmpPixbuftrue = Gdk::Pixbuf::create_from_data (ch->cropimgtrue, Gdk::COLORSPACE_RGB, false, 8, ch->cropimg_width, ch->cropimg_height, 3 * ch->cropimg_width); ch->cropPixbuftrue = Gdk::Pixbuf::create (Gdk::COLORSPACE_RGB, false, 8, imw, imh); - tmpPixbuftrue->scale (ch->cropPixbuftrue, 0, 0, imw, imh, 0, 0, czoom, czoom, Gdk::INTERP_NEAREST); + tmpPixbuftrue->scale (ch->cropPixbuftrue, 0, 0, imw, imh, 0, 0, czoom, czoom, Gdk::INTERP_TILES); tmpPixbuftrue.clear (); } From 2d658257f23917c5b23b28db9c22ef7e5cd0dab4 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Sun, 19 Mar 2017 21:16:04 +0100 Subject: [PATCH 7/9] added fixes for #3764 by @heckflosse --- rtgui/cropwindow.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index 9cedb6f11..682a38fc3 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -1951,6 +1951,8 @@ void CropWindow::zoomOut (bool toCursor, int cursorX, int cursorY) if (toCursor) { x = cursorX; y = cursorY; + } else { + screenCoordToImage(xpos + imgX + imgW / 2, ypos + imgY + imgH / 2, x, y); } zoomVersion = exposeVersion; @@ -1980,6 +1982,8 @@ void CropWindow::zoom11 () } zoomVersion = exposeVersion; + } else { + screenCoordToImage(xpos + imgX + imgW / 2, ypos + imgY + imgH / 2, x, y); } changeZoom (zoom11index, true, x, y); From 2f9df50be3ee9e95bb53e7141cfb54bf31fe5365 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Tue, 21 Mar 2017 13:37:55 +0100 Subject: [PATCH 8/9] make CropWindow::zoomFitCrop call CropWindow::zoomFit if the image has no crop --- rtdata/languages/default | 2 +- rtgui/cropwindow.cc | 2 ++ rtgui/preferences.cc | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index ecdc7822c..1e4e6665d 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1087,7 +1087,7 @@ PREFERENCES_PSPATH;Adobe Photoshop installation directory PREFERENCES_REMEMBERZOOMPAN;Remember zoom % and pan offset PREFERENCES_REMEMBERZOOMPAN_TOOLTIP;Remember the zoom % and pan offset of the current image when opening a new image.\n\nThis option only works in "Single Editor Tab Mode" and when "Demosaicing method used for the preview at <100% zoom" is set to "As in PP3". PREFERENCES_EXTENDEDZOOMLEVELS;Use finer-grained zoom levels for "fit to screen" zooming -PREFERENCES_EXTENDEDZOOMLEVELS_TOOLTIP;This allows to better fill the editor window when using one of the "fit to screen" zoom modes. However, the preview quality might be slightly degraded, depending on the actual zoom factor computed. (Requires a restart to take effect) +PREFERENCES_EXTENDEDZOOMLEVELS_TOOLTIP;This allows to better fill the editor window when using one of the "fit to screen" zoom modes. However, the preview quality might be slightly degraded, depending on the actual zoom factor computed. PREFERENCES_RGBDTL_LABEL;Max number of threads for Noise Reduction and Wavelet Levels PREFERENCES_RGBDTL_TOOLTIP;Leave the setting at "0" to automatically use as many threads as possible. The more threads run in parallel, the faster the computation. Refer to RawPedia for memory requirements. PREFERENCES_SELECTFONT;Select main font diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index 682a38fc3..29d4b6db1 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -2082,6 +2082,8 @@ void CropWindow::zoomFitCrop () setCropAnchorPosition(centerX, centerY); changeZoom (cz, true, centerX, centerY); fitZoom = false; + } else { + zoomFit(); } } diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index f30765c92..97026a617 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -1136,7 +1136,7 @@ Gtk::Widget* Preferences::getGeneralPanel () Gtk::HBox *zoombox = Gtk::manage(new Gtk::HBox()); rememberZoomPanCheckbutton = Gtk::manage( new Gtk::CheckButton (M("PREFERENCES_REMEMBERZOOMPAN")) ); rememberZoomPanCheckbutton->set_tooltip_text(M("PREFERENCES_REMEMBERZOOMPAN_TOOLTIP")); - extendedZoomLevelsCheckbutton = Gtk::manage( new Gtk::CheckButton (M("PREFERENCES_EXTENDEDZOOMLEVELS")) ); + extendedZoomLevelsCheckbutton = Gtk::manage( new Gtk::CheckButton (M("PREFERENCES_EXTENDEDZOOMLEVELS") + " (" + M("PREFERENCES_APPLNEXTSTARTUP") + ")") ); extendedZoomLevelsCheckbutton->set_tooltip_text(M("PREFERENCES_EXTENDEDZOOMLEVELS_TOOLTIP")); zoombox->set_spacing(10); zoombox->pack_start(*rememberZoomPanCheckbutton); From f1fafebaf1f7accb9004b8151898e0400664e9b5 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Thu, 23 Mar 2017 22:08:56 +0100 Subject: [PATCH 9/9] removed the option to disable the extended zoom levels from the preferences --- rtgui/cropwindow.cc | 4 +--- rtgui/options.cc | 6 ------ rtgui/options.h | 1 - rtgui/preferences.cc | 12 ++---------- rtgui/preferences.h | 1 - 5 files changed, 3 insertions(+), 21 deletions(-) diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index 29d4b6db1..6d0391232 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -103,9 +103,7 @@ void CropWindow::initZoomSteps() float z = 10./float(s); sprintf(lbl, "% 2d%%", int(z * 100)); bool is_major = (s == s/10 * 10); - if (is_major || options.extendedZoomLevelsForFit) { - zoomSteps.push_back(ZoomStep(lbl, z, s, is_major)); - } + zoomSteps.push_back(ZoomStep(lbl, z, s, is_major)); } zoom11index = zoomSteps.size(); for (int s = 1; s <= 8; ++s) { diff --git a/rtgui/options.cc b/rtgui/options.cc index 1bc7f1706..3daa764ec 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -348,7 +348,6 @@ void Options::setDefaults () lastScale = 5; panAccelFactor = 5; rememberZoomAndPan = true; - extendedZoomLevelsForFit = false; lastCropSize = 1; fbOnlyRaw = false; fbShowDateTime = true; @@ -1349,10 +1348,6 @@ int Options::readFromFile (Glib::ustring fname) rememberZoomAndPan = keyFile.get_boolean ("GUI", "RememberZoomAndPan"); } - if (keyFile.has_key ("GUI", "ExtendedZoomLevelsForFit")) { - extendedZoomLevelsForFit = keyFile.get_boolean ("GUI", "ExtendedZoomLevelsForFit"); - } - if (keyFile.has_key ("GUI", "LastCropSize")) { lastCropSize = keyFile.get_integer ("GUI", "LastCropSize"); } @@ -2028,7 +2023,6 @@ int Options::saveToFile (Glib::ustring fname) keyFile.set_integer ("GUI", "LastPreviewScale", lastScale); keyFile.set_integer ("GUI", "PanAccelFactor", panAccelFactor); keyFile.set_boolean ("GUI", "RememberZoomAndPan", rememberZoomAndPan); - keyFile.set_boolean ("GUI", "ExtendedZoomLevelsForFit", extendedZoomLevelsForFit); keyFile.set_integer ("GUI", "LastCropSize", lastCropSize); keyFile.set_boolean ("GUI", "ShowHistory", showHistory); keyFile.set_integer ("GUI", "ShowFilePanelState", showFilePanelState); diff --git a/rtgui/options.h b/rtgui/options.h index e090bd15f..7c0a3534d 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -215,7 +215,6 @@ public: bool filmStripShowFileNames; bool tabbedUI; bool rememberZoomAndPan; - bool extendedZoomLevelsForFit; int multiDisplayMode; // 0=none, 1=Edit panels on other display std::vector cutOverlayBrush; // Red;Green;Blue;Alpha , all ranging 0..1 std::vector navGuideBrush; // Red;Green;Blue;Alpha , all ranging 0..1 diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 97026a617..8130e2dfc 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -1133,17 +1133,11 @@ Gtk::Widget* Preferences::getGeneralPanel () navigationGrid->attach_next_to(*panFactorLabel, Gtk::POS_LEFT, 1, 1); navigationGrid->attach_next_to(*panFactor, *panFactorLabel, Gtk::POS_RIGHT, 1, 1); - Gtk::HBox *zoombox = Gtk::manage(new Gtk::HBox()); rememberZoomPanCheckbutton = Gtk::manage( new Gtk::CheckButton (M("PREFERENCES_REMEMBERZOOMPAN")) ); + setExpandAlignProperties(rememberZoomPanCheckbutton, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); rememberZoomPanCheckbutton->set_tooltip_text(M("PREFERENCES_REMEMBERZOOMPAN_TOOLTIP")); - extendedZoomLevelsCheckbutton = Gtk::manage( new Gtk::CheckButton (M("PREFERENCES_EXTENDEDZOOMLEVELS") + " (" + M("PREFERENCES_APPLNEXTSTARTUP") + ")") ); - extendedZoomLevelsCheckbutton->set_tooltip_text(M("PREFERENCES_EXTENDEDZOOMLEVELS_TOOLTIP")); - zoombox->set_spacing(10); - zoombox->pack_start(*rememberZoomPanCheckbutton); - zoombox->pack_start(*extendedZoomLevelsCheckbutton); - setExpandAlignProperties(zoombox, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); - navigationGrid->attach_next_to(*zoombox, *panFactorLabel, Gtk::POS_BOTTOM, 2, 1); + navigationGrid->attach_next_to(*rememberZoomPanCheckbutton, *panFactorLabel, Gtk::POS_BOTTOM, 2, 1); fnav->add (*navigationGrid); mvbsd->attach_next_to(*fnav, *fclip, Gtk::POS_RIGHT, 1, 1); @@ -1577,7 +1571,6 @@ void Preferences::storePreferences () moptions.dateFormat = dateformat->get_text(); moptions.panAccelFactor = (int)panFactor->get_value(); moptions.rememberZoomAndPan = rememberZoomPanCheckbutton->get_active(); - moptions.extendedZoomLevelsForFit = extendedZoomLevelsCheckbutton->get_active(); moptions.fbShowDateTime = showDateTime->get_active (); moptions.fbShowBasicExif = showBasicExif->get_active (); moptions.fbShowExpComp = showExpComp->get_active (); @@ -1800,7 +1793,6 @@ void Preferences::fillPreferences () dateformat->set_text (moptions.dateFormat); panFactor->set_value (moptions.panAccelFactor); rememberZoomPanCheckbutton->set_active (moptions.rememberZoomAndPan); - extendedZoomLevelsCheckbutton->set_active (moptions.extendedZoomLevelsForFit); ctiffserialize->set_active(moptions.serializeTiffRead); setActiveTextOrIndex (*prtProfile, moptions.rtSettings.printerProfile, 0); diff --git a/rtgui/preferences.h b/rtgui/preferences.h index 8bcfed2f0..18c8a466b 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -121,7 +121,6 @@ class Preferences : public Gtk::Dialog, public ProfileStoreListener Gtk::SpinButton* panFactor; Gtk::CheckButton* rememberZoomPanCheckbutton; - Gtk::CheckButton* extendedZoomLevelsCheckbutton; Gtk::ComboBoxText* view; Gtk::ComboBoxText* grey;