Merge pull request #6872 from 0v3rt1r3d/0v3rt1r3d/max-zoom-preference
Implement maximal zoom feature
This commit is contained in:
commit
f687bda276
@ -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'
|
||||
|
@ -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;
|
||||
|
@ -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 };
|
||||
@ -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<MaxZoom>(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<int>(maxZoomLimit));
|
||||
|
||||
//Glib::ArrayHandle<int> crvopen = crvOpen;
|
||||
//keyFile.set_integer_list ("GUI", "CurvePanelsExpanded", crvopen);
|
||||
|
@ -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
|
||||
|
@ -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<int>(options.maxZoomLimit));
|
||||
|
||||
addc.block(false);
|
||||
setc.block(false);
|
||||
|
@ -249,6 +249,8 @@ class Preferences final :
|
||||
Gtk::ComboBoxText *cropGuidesCombo;
|
||||
Gtk::CheckButton *cropAutoFitCB;
|
||||
|
||||
Gtk::ComboBoxText *maxZoomCombo;
|
||||
|
||||
Gtk::ComboBoxText *metadataSyncCombo;
|
||||
Gtk::ComboBoxText *xmpSidecarCombo;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user