diff --git a/rtdata/languages/default b/rtdata/languages/default index 0e922fc4f..18d16235b 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1945,6 +1945,7 @@ PREFERENCES_LENSFUNDBDIR;Lensfun database directory PREFERENCES_LENSFUNDBDIR_TOOLTIP;Directory containing the Lensfun database. Leave empty to use the default directories. PREFERENCES_LENSPROFILESDIR;Lens profiles directory PREFERENCES_LENSPROFILESDIR_TOOLTIP;Directory containing Adobe Lens Correction Profiles (LCPs) +PREFERENCES_MAX_ZOOM_TITLE;Maximum zoom PREFERENCES_MAXRECENTFOLDERS;Maximum number of recent folders PREFERENCES_MENUGROUPEXTPROGS;Group 'Open with' PREFERENCES_MENUGROUPFILEOPERATIONS;Group 'File operations' diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index ef2b7a52b..1649034f8 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -43,6 +43,32 @@ using namespace rtengine; +namespace { + inline double zoomLimitToFraction(Options::MaxZoom z) { + switch (z) { + case Options::MaxZoom::PERCENTS_100: + return 1.; + case Options::MaxZoom::PERCENTS_200: + return 2.; + case Options::MaxZoom::PERCENTS_300: + return 3.; + case Options::MaxZoom::PERCENTS_400: + return 4.; + case Options::MaxZoom::PERCENTS_500: + return 5.; + case Options::MaxZoom::PERCENTS_600: + return 6.; + case Options::MaxZoom::PERCENTS_700: + return 7.; + case Options::MaxZoom::PERCENTS_800: + return 8.; + case Options::MaxZoom::PERCENTS_1600: + default: + return 16.; + } + } +} + bool CropWindow::initialized = false; Glib::ustring CropWindow::zoomOuttt; @@ -2284,13 +2310,18 @@ void CropWindow::updateHoveredPicker (rtengine::Coord *imgPos) } void CropWindow::changeZoom (int zoom, bool notify, int centerx, int centery, bool needsRedraw) { - if (zoom < 0) { zoom = 0; } else if (zoom > int(zoomSteps.size())-1) { zoom = int(zoomSteps.size())-1; } + // Limit zoom according to user preferences + double zoomLimit = zoomLimitToFraction(options.maxZoomLimit); + while(zoomSteps[zoom].zoom > zoomLimit && zoom != 0) { + --zoom; + } + cropZoom = zoom; cropLabel = zoomSteps[cropZoom].label; diff --git a/rtgui/options.cc b/rtgui/options.cc index 61d67f9b6..2da791cd8 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -368,6 +368,7 @@ void Options::setDefaults() fbShowDateTime = true; fbShowBasicExif = true; fbShowExpComp = false; + maxZoomLimit = MaxZoom::PERCENTS_1600; #ifdef _WIN32 // use windows setting for visibility of hidden files/folders SHELLFLAGSTATE sft = { 0 }; @@ -574,8 +575,8 @@ void Options::setDefaults() rtSettings.darkFramesPath = ""; rtSettings.flatFieldsPath = ""; - rtSettings.cameraProfilesPath = ""; - rtSettings.lensProfilesPath = ""; + rtSettings.cameraProfilesPath = ""; + rtSettings.lensProfilesPath = ""; #ifdef _WIN32 const gchar* sysRoot = g_getenv("SystemRoot"); // Returns e.g. "c:\Windows" @@ -1729,6 +1730,9 @@ void Options::readFromFile(Glib::ustring fname) if (keyFile.has_key("GUI", "ZoomOnScroll")) { zoomOnScroll = keyFile.get_boolean("GUI", "ZoomOnScroll"); } + if (keyFile.has_key("GUI", "MaxZoom")) { + maxZoomLimit = static_cast(keyFile.get_integer("GUI", "MaxZoom")); + } } if (keyFile.has_group("Crop Settings")) { @@ -2582,6 +2586,7 @@ void Options::saveToFile(Glib::ustring fname) keyFile.set_integer("GUI", "Complexity", complexity); keyFile.set_boolean("GUI", "InspectorWindow", inspectorWindow); keyFile.set_boolean("GUI", "ZoomOnScroll", zoomOnScroll); + keyFile.set_integer("GUI", "MaxZoom", static_cast(maxZoomLimit)); //Glib::ArrayHandle crvopen = crvOpen; //keyFile.set_integer_list ("GUI", "CurvePanelsExpanded", crvopen); diff --git a/rtgui/options.h b/rtgui/options.h index 7c6f1d9fb..72d2b2462 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -368,6 +368,22 @@ public: CropGuidesMode cropGuides; bool cropAutoFit; + // Other options + + // Maximum zoom + enum class MaxZoom: int { + PERCENTS_100 = 0, + PERCENTS_200, + PERCENTS_300, + PERCENTS_400, + PERCENTS_500, + PERCENTS_600, + PERCENTS_700, + PERCENTS_800, + PERCENTS_1600, + }; + MaxZoom maxZoomLimit; + // Performance options Glib::ustring clutsDir; int rgbDenoiseThreadLimit; // maximum number of threads for the denoising tool ; 0 = use the maximum available diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 103075274..ba7fb2de0 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -697,7 +697,7 @@ Gtk::Widget* Preferences::getImageProcessingPanel () dirgrid->attach_next_to(*cameraProfilesDirLabel, *clutsDirLabel, Gtk::POS_BOTTOM, 1, 1); dirgrid->attach_next_to(*cameraProfilesDir, *cameraProfilesDirLabel, Gtk::POS_RIGHT, 1, 1); - //Lens Profiles Dir + //Lens Profiles Dir Gtk::Label *lensProfilesDirLabel = Gtk::manage(new Gtk::Label(M("PREFERENCES_LENSPROFILESDIR") + ":")); lensProfilesDirLabel->set_tooltip_text(M("PREFERENCES_LENSPROFILESDIR_TOOLTIP")); setExpandAlignProperties(lensProfilesDirLabel, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); @@ -744,6 +744,29 @@ Gtk::Widget* Preferences::getImageProcessingPanel () cropFrame->add(*cropGrid); vbImageProcessing->pack_start(*cropFrame, Gtk::PACK_SHRINK, 4); + // Other: max zoom + { + Gtk::Frame *frame = Gtk::manage(new Gtk::Frame(M("GENERAL_OTHER"))); + frame->set_label_align (0.025, 0.5); + Gtk::Grid *grid = Gtk::manage(new Gtk::Grid()); + + Gtk::Label *label = Gtk::manage(new Gtk::Label(M("PREFERENCES_MAX_ZOOM_TITLE") + ": ", Gtk::ALIGN_START)); + label->set_line_wrap(true); + grid->attach(*label, 0, 0); + + maxZoomCombo = Gtk::manage(new Gtk::ComboBoxText()); + + // Labels order matches to Options::MaxZoom enum + for (int i = 1; i <= 8; ++i) { + maxZoomCombo->append(Glib::ustring::compose("%100%%", i)); + } + maxZoomCombo->append("1600%"); + + grid->attach(*maxZoomCombo, 1, 0, 1, 1); + frame->add(*grid); + vbImageProcessing->pack_start(*frame, Gtk::PACK_SHRINK, 4); + } + swImageProcessing->add(*vbImageProcessing); return swImageProcessing; @@ -1994,6 +2017,7 @@ void Preferences::storePreferences() moptions.cropGuides = Options::CropGuidesMode(cropGuidesCombo->get_active_row_number()); moptions.cropAutoFit = cropAutoFitCB->get_active(); + moptions.maxZoomLimit = Options::MaxZoom(maxZoomCombo->get_active_row_number()); toolLocationPreference->updateOptions(); @@ -2228,6 +2252,7 @@ void Preferences::fillPreferences() cropGuidesCombo->set_active(moptions.cropGuides); cropAutoFitCB->set_active(moptions.cropAutoFit); + maxZoomCombo->set_active(static_cast(options.maxZoomLimit)); addc.block(false); setc.block(false); diff --git a/rtgui/preferences.h b/rtgui/preferences.h index 219844d55..bc8dc0d22 100644 --- a/rtgui/preferences.h +++ b/rtgui/preferences.h @@ -249,6 +249,8 @@ class Preferences final : Gtk::ComboBoxText *cropGuidesCombo; Gtk::CheckButton *cropAutoFitCB; + Gtk::ComboBoxText *maxZoomCombo; + Gtk::ComboBoxText *metadataSyncCombo; Gtk::ComboBoxText *xmpSidecarCombo;