From fc78a64066f1870fcfc65b1c78b54ebe61ae4bbb Mon Sep 17 00:00:00 2001 From: Alexander Brock Date: Sat, 20 Jul 2024 14:56:21 +0200 Subject: [PATCH] Move scale option from perspective correction to lens/geometry --- rtdata/languages/default | 4 ++-- rtengine/iptransform.cc | 12 +++++------ rtengine/perspectivecorrection.cc | 1 - rtengine/procparams.cc | 20 ++++++++++++------ rtengine/procparams.h | 4 +++- rtgui/addsetids.h | 1 - rtgui/batchtoolpanelcoord.cc | 5 ++--- rtgui/lensgeom.cc | 35 ++++++++++++++++++++++++++++--- rtgui/lensgeom.h | 8 ++++++- rtgui/paramsedited.cc | 15 ++++++------- rtgui/paramsedited.h | 2 +- rtgui/perspective.cc | 25 +--------------------- rtgui/perspective.h | 11 ++-------- 13 files changed, 75 insertions(+), 68 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 3f2f898c1..2026194ba 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1535,7 +1535,6 @@ HISTORY_MSG_PDSHARPEN_RADIUS;CS - Radius HISTORY_MSG_PDSHARPEN_RADIUS_BOOST;CS - Corner radius boost HISTORY_MSG_PERSP_CAM_ANGLE;Perspective - Camera HISTORY_MSG_PERSP_CAM_FL;Perspective - Camera -HISTORY_MSG_PERSP_CAM_SCALE;Perspective - Scale HISTORY_MSG_PERSP_CAM_SHIFT;Perspective - Camera HISTORY_MSG_PERSP_CTRL_LINE;Perspective - Control lines HISTORY_MSG_PERSP_METHOD;Perspective - Method @@ -1575,6 +1574,7 @@ HISTORY_MSG_TONE_EQUALIZER_ENABLED;Tone equalizer HISTORY_MSG_TONE_EQUALIZER_PIVOT;Tone equalizer - Pivot HISTORY_MSG_TONE_EQUALIZER_REGULARIZATION;Tone equalizer - Regularization HISTORY_MSG_TONE_EQUALIZER_SHOW_COLOR_MAP;Tone equalizer - Tonal map +HISTORY_MSG_TRANS_SCALE;Geometry - Scale HISTORY_MSG_TRANS_METHOD;Geometry - Method HISTORY_MSG_WAVBALCHROM;Equalizer chrominance HISTORY_MSG_WAVBALLUM;Equalizer luminance @@ -2836,6 +2836,7 @@ TP_LABCURVE_LCREDSK_TOOLTIP;If enabled, the LC Curve affects only red and skin-t TP_LABCURVE_RSTPROTECTION;Red and skin-tones protection TP_LABCURVE_RSTPRO_TOOLTIP;Works on the Chromaticity slider and the CC curve. TP_LENSGEOM_AUTOCROP;Auto-Crop +TP_LENSGEOM_SCALE;Scale TP_LENSGEOM_FILL;Auto-fill TP_LENSGEOM_LABEL;Lens / Geometry TP_LENSGEOM_LIN;Linear @@ -3729,7 +3730,6 @@ TP_PDSHARPENING_LABEL;Capture Sharpening TP_PERSPECTIVE_CAMERA_CROP_FACTOR;Crop factor TP_PERSPECTIVE_CAMERA_FOCAL_LENGTH;Focal length TP_PERSPECTIVE_CAMERA_DEFISH;De-fish -TP_PERSPECTIVE_CAMERA_SCALE;Scale TP_PERSPECTIVE_CAMERA_FRAME;Correction TP_PERSPECTIVE_CAMERA_PITCH;Vertical TP_PERSPECTIVE_CAMERA_ROLL;Rotation diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index dfda091c5..99ae90d24 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -519,8 +519,8 @@ bool ImProcFunctions::transCoord (int W, int H, const std::vector &src, break; } - x_d /= params->perspective.camera_scale; - y_d /= params->perspective.camera_scale; + x_d /= params->commonTrans.getScale(); + y_d /= params->commonTrans.getScale(); if (params->distortion.defish) { x_d /= f_defish; y_d /= f_defish; @@ -1254,8 +1254,8 @@ void ImProcFunctions::transformGeneral(bool highQuality, Imagefloat *original, I break; } - x_d /= params->perspective.camera_scale; - y_d /= params->perspective.camera_scale; + x_d /= params->commonTrans.getScale(); + y_d /= params->commonTrans.getScale(); if (params->distortion.defish) { x_d /= f_defish; y_d /= f_defish; @@ -1448,9 +1448,7 @@ bool ImProcFunctions::needsPerspective () const params->perspective.projection_rotate || params->perspective.projection_shift_horiz || params->perspective.projection_shift_vert || - params->perspective.projection_yaw || - params->perspective.camera_scale > 1.0 + 1e-6 || - params->perspective.camera_scale < 1.0 - 1e-6 )); + params->perspective.projection_yaw)); } bool ImProcFunctions::needsGradient () const diff --git a/rtengine/perspectivecorrection.cc b/rtengine/perspectivecorrection.cc index 02cb9477d..5494d9ac8 100644 --- a/rtengine/perspectivecorrection.cc +++ b/rtengine/perspectivecorrection.cc @@ -308,7 +308,6 @@ PerspectiveCorrection::Params PerspectiveCorrection::autocompute(ImageSource *sr neutral.distortion.focal_length = pparams->distortion.focal_length; neutral.perspective.camera_focal_length = pparams->perspective.camera_focal_length; neutral.perspective.camera_crop_factor = pparams->perspective.camera_crop_factor; - neutral.perspective.camera_scale = pparams->perspective.camera_scale; neutral.perspective.method = pparams->perspective.method; neutral.lensProf = pparams->lensProf; ImProcFunctions ipf(&neutral, true); diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 64071ba79..1c036c1a4 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -1974,13 +1974,19 @@ bool CoarseTransformParams::operator !=(const CoarseTransformParams& other) cons CommonTransformParams::CommonTransformParams() : method("log"), - autofill(true) + autofill(true), + scale(1.0) { } +double CommonTransformParams::getScale() const +{ + return autofill ? 1.0 : scale; +} + bool CommonTransformParams::operator ==(const CommonTransformParams& other) const { - return method == other.method && autofill == other.autofill; + return method == other.method && autofill == other.autofill && std::abs(scale - other.scale) < 1e-6; } bool CommonTransformParams::operator !=(const CommonTransformParams& other) const @@ -2108,7 +2114,6 @@ PerspectiveParams::PerspectiveParams() : camera_yaw(0.0), projection_pitch(0.0), projection_rotate(0.0), - camera_scale(1.0), projection_shift_horiz(0.0), projection_shift_vert(0.0), projection_yaw(0.0) @@ -2125,7 +2130,6 @@ bool PerspectiveParams::operator ==(const PerspectiveParams& other) const && camera_focal_length == other.camera_focal_length && camera_crop_factor == other.camera_crop_factor && camera_pitch == other.camera_pitch - && camera_scale == other.camera_scale && camera_roll == other.camera_roll && camera_shift_horiz == other.camera_shift_horiz && camera_shift_vert == other.camera_shift_vert @@ -6754,6 +6758,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo // Common properties for transformations saveToKeyfile(!pedited || pedited->commonTrans.method, "Common Properties for Transformations", "Method", commonTrans.method, keyFile); + saveToKeyfile(!pedited || pedited->commonTrans.scale, "Common Properties for Transformations", "Scale", commonTrans.scale, keyFile); saveToKeyfile(!pedited || pedited->commonTrans.autofill, "Common Properties for Transformations", "AutoFill", commonTrans.autofill, keyFile); // Rotation @@ -6781,7 +6786,6 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->perspective.camera_crop_factor, "Perspective", "CameraCropFactor", perspective.camera_crop_factor, keyFile); saveToKeyfile(!pedited || pedited->perspective.camera_focal_length, "Perspective", "CameraFocalLength", perspective.camera_focal_length, keyFile); saveToKeyfile(!pedited || pedited->perspective.camera_pitch, "Perspective", "CameraPitch", perspective.camera_pitch, keyFile); - saveToKeyfile(!pedited || pedited->perspective.camera_scale, "Perspective", "CameraScale", perspective.camera_scale, keyFile); saveToKeyfile(!pedited || pedited->perspective.camera_roll, "Perspective", "CameraRoll", perspective.camera_roll, keyFile); saveToKeyfile(!pedited || pedited->perspective.camera_shift_horiz, "Perspective", "CameraShiftHorizontal", perspective.camera_shift_horiz, keyFile); saveToKeyfile(!pedited || pedited->perspective.camera_shift_vert, "Perspective", "CameraShiftVertical", perspective.camera_shift_vert, keyFile); @@ -8968,6 +8972,11 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) } else { commonTrans.method = "lin"; } + if (keyFile.has_key("Common Properties for Transformations", "Scale")) { + assignFromKeyfile(keyFile, "Common Properties for Transformations", "Scale", commonTrans.scale, pedited->commonTrans.scale); + } else { + commonTrans.scale = 1.0; + } assignFromKeyfile(keyFile, "Common Properties for Transformations", "AutoFill", commonTrans.autofill, pedited->commonTrans.autofill); } @@ -9034,7 +9043,6 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Perspective", "CameraShiftHorizontal", perspective.camera_shift_horiz, pedited->perspective.camera_shift_horiz); assignFromKeyfile(keyFile, "Perspective", "CameraShiftVertical", perspective.camera_shift_vert, pedited->perspective.camera_shift_vert); assignFromKeyfile(keyFile, "Perspective", "CameraPitch", perspective.camera_pitch, pedited->perspective.camera_pitch); - assignFromKeyfile(keyFile, "Perspective", "CameraScale", perspective.camera_scale, pedited->perspective.camera_scale); assignFromKeyfile(keyFile, "Perspective", "CameraRoll", perspective.camera_roll, pedited->perspective.camera_roll); assignFromKeyfile(keyFile, "Perspective", "CameraCropFactor", perspective.camera_crop_factor, pedited->perspective.camera_crop_factor); assignFromKeyfile(keyFile, "Perspective", "CameraFocalLength", perspective.camera_focal_length, pedited->perspective.camera_focal_length); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index a22dc0533..8a4fe5bf8 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -929,9 +929,12 @@ struct CoarseTransformParams { struct CommonTransformParams { Glib::ustring method; bool autofill; + double scale; CommonTransformParams(); + double getScale() const; + bool operator ==(const CommonTransformParams& other) const; bool operator !=(const CommonTransformParams& other) const; }; @@ -1025,7 +1028,6 @@ struct PerspectiveParams { double camera_yaw; double projection_pitch; double projection_rotate; - double camera_scale; double projection_shift_horiz; double projection_shift_vert; double projection_yaw; diff --git a/rtgui/addsetids.h b/rtgui/addsetids.h index 1600b1918..b5f611122 100644 --- a/rtgui/addsetids.h +++ b/rtgui/addsetids.h @@ -25,7 +25,6 @@ enum { ADDSET_PERSP_CAM_ANGLE, ADDSET_PERSP_CAM_DEFISH, ADDSET_PERSP_CAM_FOCAL_LENGTH, - ADDSET_PERSP_CAM_SCALE, ADDSET_PERSP_CAM_SHIFT, ADDSET_PERSP_PROJ_ANGLE, ADDSET_PERSP_PROJ_ROTATE, diff --git a/rtgui/batchtoolpanelcoord.cc b/rtgui/batchtoolpanelcoord.cc index 708002059..ba9e0ef0f 100644 --- a/rtgui/batchtoolpanelcoord.cc +++ b/rtgui/batchtoolpanelcoord.cc @@ -152,7 +152,7 @@ void BatchToolPanelCoordinator::initSession () rotate->setAdjusterBehavior (false); resize->setAdjusterBehavior (false); distortion->setAdjusterBehavior (false); - perspective->setAdjusterBehavior (false, false, false, false, false, false, false, false); + perspective->setAdjusterBehavior (false, false, false, false, false, false, false); gradient->setAdjusterBehavior (false, false, false, false); pcvignette->setAdjusterBehavior (false, false, false); cacorrection->setAdjusterBehavior (false); @@ -204,8 +204,7 @@ void BatchToolPanelCoordinator::initSession () options.baBehav[ADDSET_PERSP_CAM_ANGLE], options.baBehav[ADDSET_PERSP_PROJ_ANGLE], options.baBehav[ADDSET_PERSP_PROJ_SHIFT], - options.baBehav[ADDSET_PERSP_PROJ_ROTATE], - options.baBehav[ADDSET_PERSP_CAM_SCALE] + options.baBehav[ADDSET_PERSP_PROJ_ROTATE] ); gradient->setAdjusterBehavior (options.baBehav[ADDSET_GRADIENT_DEGREE], options.baBehav[ADDSET_GRADIENT_FEATHER], options.baBehav[ADDSET_GRADIENT_STRENGTH], options.baBehav[ADDSET_GRADIENT_CENTER]); pcvignette->setAdjusterBehavior (options.baBehav[ADDSET_PCVIGNETTE_STRENGTH], options.baBehav[ADDSET_PCVIGNETTE_FEATHER], options.baBehav[ADDSET_PCVIGNETTE_ROUNDNESS]); diff --git a/rtgui/lensgeom.cc b/rtgui/lensgeom.cc index 0064ecee3..da36d99b5 100644 --- a/rtgui/lensgeom.cc +++ b/rtgui/lensgeom.cc @@ -18,6 +18,8 @@ */ #include "lensgeom.h" +#include + #include "eventmapper.h" #include "guiutils.h" #include "rtimage.h" @@ -31,8 +33,8 @@ const Glib::ustring LensGeometry::TOOL_NAME = "lensgeom"; LensGeometry::LensGeometry () : FoldableToolPanel(this, TOOL_NAME, M("TP_LENSGEOM_LABEL")), rlistener(nullptr), lastFill(false) { - auto m = ProcEventMapper::getInstance(); + EvTransScale = m->newEvent(TRANSFORM, "HISTORY_MSG_TRANS_SCALE"); EvTransMethod = m->newEvent(TRANSFORM, "HISTORY_MSG_TRANS_METHOD"); Gtk::Box* hb1 = Gtk::manage (new Gtk::Box ()); @@ -44,6 +46,11 @@ LensGeometry::LensGeometry () : FoldableToolPanel(this, TOOL_NAME, M("TP_LENSGEO hb1->pack_end (*method, Gtk::PACK_EXPAND_WIDGET, 4); pack_start( *hb1, Gtk::PACK_SHRINK, 4); + scale= Gtk::manage (new Adjuster (M("TP_LENSGEOM_SCALE"), 0.1, 10, 0.01, 1)); + scale->setAdjusterListener (this); + scale->setLogScale(300, 0.1); + pack_start (*scale); + fill = Gtk::manage (new Gtk::CheckButton (M("TP_LENSGEOM_FILL"))); pack_start (*fill); @@ -57,6 +64,7 @@ LensGeometry::LensGeometry () : FoldableToolPanel(this, TOOL_NAME, M("TP_LENSGEO fillConn = fill->signal_toggled().connect(sigc::mem_fun(*this, &LensGeometry::fillPressed)); fill->set_active (true); + scale->setEnabled(!fill->get_active()); show_all (); } @@ -78,6 +86,7 @@ void LensGeometry::read (const ProcParams* pp, const ParamsEdited* pedited) } fill->set_inconsistent (!pedited->commonTrans.autofill); + scale->setEditedState (pedited->commonTrans.scale ? Edited : UnEdited); } fillConn.block (true); @@ -85,9 +94,12 @@ void LensGeometry::read (const ProcParams* pp, const ParamsEdited* pedited) fillConn.block (false); autoCrop->set_sensitive (!pp->commonTrans.autofill); + scale->setValue (pp->commonTrans.scale); + lastFill = pp->commonTrans.autofill; method->block (false); + scale->setEnabled(!fill->get_active()); enableListener (); } @@ -97,11 +109,13 @@ void LensGeometry::write (ProcParams* pp, ParamsEdited* pedited) if( currentRow >= 0 && method->get_active_text() != M("GENERAL_UNCHANGED")) { pp->commonTrans.method = currentRow == 0 ? "log" : "lin"; } - pp->commonTrans.autofill = fill->get_active (); + pp->commonTrans.autofill = fill->get_active (); + pp->commonTrans.scale = scale->getValue (); if (pedited) { pedited->commonTrans.method = method->get_active_text() != M("GENERAL_UNCHANGED"); - pedited->commonTrans.autofill = !fill->get_inconsistent(); + pedited->commonTrans.autofill = !fill->get_inconsistent(); + pedited->commonTrans.scale = scale->getEditedState(); } } @@ -113,6 +127,19 @@ void LensGeometry::autoCropPressed () } } +void LensGeometry::adjusterChanged(Adjuster *a, double newval) +{ + if (listener) { + if (a == scale) { + listener->panelChanged (EvTransScale, + Glib::ustring::format(scale->getValue())); + } + else { + std::cout << "Unknown adjuster given in LensGeometry::adjusterChanged, file " << __FILE__ << " line " << __LINE__ << std::endl; + } + } +} + void LensGeometry::fillPressed () { @@ -138,6 +165,7 @@ void LensGeometry::fillPressed () listener->panelChanged (EvTransAutoFill, M("GENERAL_DISABLED")); } } + scale->setEnabled(!fill->get_active()); } void LensGeometry::methodChanged () @@ -153,5 +181,6 @@ void LensGeometry::setBatchMode (bool batchMode) ToolPanel::setBatchMode (batchMode); removeIfThere (this, autoCrop); + scale->showEditedCB (); } diff --git a/rtgui/lensgeom.h b/rtgui/lensgeom.h index fa260e177..a84cfe84d 100644 --- a/rtgui/lensgeom.h +++ b/rtgui/lensgeom.h @@ -22,21 +22,25 @@ #include "lensgeomlistener.h" #include "toolpanel.h" +#include "adjuster.h" class LensGeometry final : public ToolParamBlock, - public FoldableToolPanel + public FoldableToolPanel, + public AdjusterListener { protected: MyComboBoxText* method; Gtk::Button* autoCrop; LensGeomListener* rlistener; + Adjuster* scale; Gtk::CheckButton* fill; bool lastFill; sigc::connection fillConn; rtengine::ProcEvent EvTransMethod; + rtengine::ProcEvent EvTransScale; public: static const Glib::ustring TOOL_NAME; @@ -55,6 +59,8 @@ public: rlistener = l; } + void adjusterChanged (Adjuster* a, double newval) override; + private: IdleRegister idle_register; }; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index bf17f6687..a717bc8e5 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -345,6 +345,7 @@ void ParamsEdited::set(bool v) coarse.vflip = v; commonTrans.method = v; commonTrans.autofill = v; + commonTrans.scale = v; rotate.degree = v; distortion.amount = v; distortion.defish = v; @@ -365,7 +366,6 @@ void ParamsEdited::set(bool v) perspective.camera_crop_factor = v; perspective.camera_focal_length = v; perspective.camera_pitch = v; - perspective.camera_scale = v; perspective.camera_roll = v; perspective.camera_shift_horiz = v; perspective.camera_shift_vert = v; @@ -1079,6 +1079,7 @@ void ParamsEdited::initFrom(const std::vector& coarse.hflip = coarse.hflip && p.coarse.hflip == other.coarse.hflip; coarse.vflip = coarse.vflip && p.coarse.vflip == other.coarse.vflip; commonTrans.method = commonTrans.method && p.commonTrans.method == other.commonTrans.method; + commonTrans.scale = commonTrans.scale && p.commonTrans.scale == other.commonTrans.scale; commonTrans.autofill = commonTrans.autofill && p.commonTrans.autofill == other.commonTrans.autofill; rotate.degree = rotate.degree && p.rotate.degree == other.rotate.degree; distortion.amount = distortion.amount && p.distortion.amount == other.distortion.amount; @@ -1100,7 +1101,6 @@ void ParamsEdited::initFrom(const std::vector& perspective.camera_crop_factor = perspective.camera_crop_factor && p.perspective.camera_crop_factor == other.perspective.camera_crop_factor; perspective.camera_focal_length = perspective.camera_focal_length && p.perspective.camera_focal_length == other.perspective.camera_focal_length; perspective.camera_pitch = perspective.camera_pitch && p.perspective.camera_pitch == other.perspective.camera_pitch; - perspective.camera_scale = perspective.camera_scale && p.perspective.camera_scale == other.perspective.camera_scale; perspective.camera_roll = perspective.camera_roll && p.perspective.camera_roll == other.perspective.camera_roll; perspective.camera_shift_horiz = perspective.camera_shift_horiz && p.perspective.camera_shift_horiz == other.perspective.camera_shift_horiz; perspective.camera_shift_vert = perspective.camera_shift_vert && p.perspective.camera_shift_vert == other.perspective.camera_shift_vert; @@ -3444,6 +3444,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.commonTrans.method = mods.commonTrans.method; } + if (commonTrans.scale) { + toEdit.commonTrans.scale = mods.commonTrans.scale; + } + if (commonTrans.autofill) { toEdit.commonTrans.autofill = mods.commonTrans.autofill; } @@ -3512,13 +3516,6 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.perspective.camera_crop_factor = dontforceSet && options.baBehav[ADDSET_PERSP_CAM_FOCAL_LENGTH] ? toEdit.perspective.camera_crop_factor + mods.perspective.camera_crop_factor : mods.perspective.camera_crop_factor; } - if (perspective.camera_scale) { - toEdit.perspective.camera_scale = - dontforceSet && options.baBehav[ADDSET_PERSP_CAM_FOCAL_LENGTH] - ? toEdit.perspective.camera_scale + mods.perspective.camera_scale - : mods.perspective.camera_scale; - } - if (perspective.camera_focal_length) { toEdit.perspective.camera_focal_length = dontforceSet && options.baBehav[ADDSET_PERSP_CAM_FOCAL_LENGTH] ? toEdit.perspective.camera_focal_length + mods.perspective.camera_focal_length : mods.perspective.camera_focal_length; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 4d267a437..dc55b830c 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -397,6 +397,7 @@ struct CoarseTransformParamsEdited { struct CommonTransformParamsEdited { bool method; + bool scale; bool autofill; }; @@ -1205,7 +1206,6 @@ struct PerspectiveParamsEdited { bool camera_crop_factor; bool camera_focal_length; bool camera_pitch; - bool camera_scale; bool camera_roll; bool camera_shift_horiz; bool camera_shift_vert; diff --git a/rtgui/perspective.cc b/rtgui/perspective.cc index 2204cc6d3..55c100e12 100644 --- a/rtgui/perspective.cc +++ b/rtgui/perspective.cc @@ -97,7 +97,6 @@ PerspCorrection::PerspCorrection () : FoldableToolPanel(this, TOOL_NAME, M("TP_P EvPerspMethod = mapper->newEvent(TRANSFORM, "HISTORY_MSG_PERSP_METHOD"); EvPerspProjAngle = mapper->newEvent(TRANSFORM, "HISTORY_MSG_PERSP_PROJ_ANGLE"); EvPerspProjRotate = mapper->newEvent(TRANSFORM, "HISTORY_MSG_PERSP_PROJ_ROTATE"); - EvPerspCamScale = mapper->newEvent(TRANSFORM, "HISTORY_MSG_PERSP_CAM_SCALE"); EvPerspProjShift = mapper->newEvent(TRANSFORM, "HISTORY_MSG_PERSP_PROJ_SHIFT"); EvPerspRender = mapper->newEvent(TRANSFORM, "GENERAL_NA"); // Void events. @@ -106,7 +105,6 @@ PerspCorrection::PerspCorrection () : FoldableToolPanel(this, TOOL_NAME, M("TP_P EvPerspCamShiftVoid = mapper->newEvent(M_VOID, "HISTORY_MSG_PERSP_CAM_SHIFT"); EvPerspProjAngleVoid = mapper->newEvent(M_VOID, "HISTORY_MSG_PERSP_PROJ_ANGLE"); EvPerspProjRotateVoid = mapper->newEvent(M_VOID, "HISTORY_MSG_PERSP_PROJ_ROTATE"); - EvPerspCamScaleVoid = mapper->newEvent(M_VOID, "HISTORY_MSG_PERSP_CAM_SCALE"); EvPerspProjShiftVoid = mapper->newEvent(M_VOID, "HISTORY_MSG_PERSP_PROJ_SHIFT"); setCamBasedEventsActive(); EvPerspControlLines = mapper->newEvent(M_VOID, "HISTORY_MSG_PERSP_CTRL_LINE"); @@ -251,9 +249,6 @@ PerspCorrection::PerspCorrection () : FoldableToolPanel(this, TOOL_NAME, M("TP_P projection_rotate = Gtk::manage (new Adjuster (M("TP_PERSPECTIVE_PROJECTION_ROTATE"), -45, 45, 0.01, 0, ipers_rotate_left, ipers_rotate_right)); projection_rotate->setAdjusterListener (this); - camera_scale= Gtk::manage (new Adjuster (M("TP_PERSPECTIVE_CAMERA_SCALE"), 0.1, 10, 0.01, 1)); - camera_scale->setAdjusterListener (this); - Gtk::Frame* recovery_frame = Gtk::manage (new Gtk::Frame (M("TP_PERSPECTIVE_RECOVERY_FRAME"))); recovery_frame->set_label_align(0.025, 0.5); @@ -277,7 +272,6 @@ PerspCorrection::PerspCorrection () : FoldableToolPanel(this, TOOL_NAME, M("TP_P camera_vbox->pack_start (*camera_crop_factor); camera_vbox->pack_start (*camera_shift_horiz); camera_vbox->pack_start (*camera_shift_vert); - camera_vbox->pack_start (*camera_scale); camera_vbox->pack_start (*camera_roll); camera_vbox->pack_start (*camera_pitch); camera_vbox->pack_start (*camera_yaw); @@ -306,7 +300,6 @@ PerspCorrection::PerspCorrection () : FoldableToolPanel(this, TOOL_NAME, M("TP_P vert->setLogScale(2, 0); camera_focal_length->setLogScale(4000, 0.5); camera_crop_factor->setLogScale(300, 0.1); - camera_scale->setLogScale(300, 0.1); method->signal_changed().connect(sigc::mem_fun(*this, &PerspCorrection::methodChanged)); @@ -324,7 +317,6 @@ void PerspCorrection::read (const ProcParams* pp, const ParamsEdited* pedited) camera_crop_factor->setEditedState (pedited->perspective.camera_crop_factor ? Edited : UnEdited); camera_focal_length->setEditedState (pedited->perspective.camera_focal_length ? Edited : UnEdited); camera_pitch->setEditedState (pedited->perspective.camera_pitch ? Edited : UnEdited); - camera_scale->setEditedState (pedited->perspective.camera_scale ? Edited : UnEdited); camera_roll->setEditedState (pedited->perspective.camera_roll ? Edited : UnEdited); camera_shift_horiz->setEditedState (pedited->perspective.camera_shift_horiz ? Edited : UnEdited); camera_shift_vert->setEditedState (pedited->perspective.camera_shift_vert ? Edited : UnEdited); @@ -341,7 +333,6 @@ void PerspCorrection::read (const ProcParams* pp, const ParamsEdited* pedited) vert->setValue (pp->perspective.vertical); setFocalLengthValue (pp, metadata); camera_pitch->setValue (pp->perspective.camera_pitch); - camera_scale->setValue (pp->perspective.camera_scale); camera_roll->setValue (pp->perspective.camera_roll); camera_shift_horiz->setValue (pp->perspective.camera_shift_horiz); camera_shift_vert->setValue (pp->perspective.camera_shift_vert); @@ -394,7 +385,6 @@ void PerspCorrection::write (ProcParams* pp, ParamsEdited* pedited) pp->perspective.camera_focal_length = camera_focal_length->getValue (); } pp->perspective.camera_pitch = camera_pitch->getValue (); - pp->perspective.camera_scale = camera_scale->getValue (); pp->perspective.camera_roll = camera_roll->getValue (); pp->perspective.camera_shift_horiz = camera_shift_horiz->getValue (); pp->perspective.camera_shift_vert = camera_shift_vert->getValue (); @@ -423,7 +413,6 @@ void PerspCorrection::write (ProcParams* pp, ParamsEdited* pedited) pedited->perspective.camera_crop_factor= camera_crop_factor->getEditedState (); pedited->perspective.camera_focal_length = camera_focal_length->getEditedState (); pedited->perspective.camera_pitch = camera_pitch->getEditedState(); - pedited->perspective.camera_scale = camera_scale->getEditedState(); pedited->perspective.camera_roll = camera_roll->getEditedState(); pedited->perspective.camera_shift_horiz = camera_shift_horiz->getEditedState(); pedited->perspective.camera_shift_vert = camera_shift_vert->getEditedState(); @@ -449,7 +438,6 @@ void PerspCorrection::setDefaults (const ProcParams* defParams, const ParamsEdit ? defParams->perspective.camera_focal_length : PerspectiveParams::DEFAULT_CAMERA_FOCAL_LENGTH); camera_pitch->setDefault (defParams->perspective.camera_pitch); - camera_scale->setDefault (defParams->perspective.camera_scale); camera_roll->setDefault (defParams->perspective.camera_roll); camera_shift_horiz->setDefault (defParams->perspective.camera_shift_horiz); camera_shift_vert->setDefault (defParams->perspective.camera_shift_vert); @@ -466,7 +454,6 @@ void PerspCorrection::setDefaults (const ProcParams* defParams, const ParamsEdit camera_crop_factor->setDefaultEditedState (pedited->perspective.camera_crop_factor ? Edited : UnEdited); camera_focal_length->setDefaultEditedState (pedited->perspective.camera_focal_length ? Edited : UnEdited); camera_pitch->setDefaultEditedState (pedited->perspective.camera_pitch ? Edited : UnEdited); - camera_scale->setDefaultEditedState (std::abs(pedited->perspective.camera_scale - 1.0) > 1e-6 ? Edited : UnEdited); camera_roll->setDefaultEditedState (pedited->perspective.camera_roll ? Edited : UnEdited); camera_shift_horiz->setDefaultEditedState (pedited->perspective.camera_shift_horiz ? Edited : UnEdited); camera_shift_vert->setDefaultEditedState (pedited->perspective.camera_shift_vert ? Edited : UnEdited); @@ -482,7 +469,6 @@ void PerspCorrection::setDefaults (const ProcParams* defParams, const ParamsEdit camera_crop_factor->setDefaultEditedState (Irrelevant); camera_focal_length->setDefaultEditedState (Irrelevant); camera_pitch->setDefaultEditedState (Irrelevant); - camera_scale->setDefaultEditedState (Irrelevant); camera_roll->setDefaultEditedState (Irrelevant); camera_shift_horiz->setDefaultEditedState (Irrelevant); camera_shift_vert->setDefaultEditedState (Irrelevant); @@ -519,9 +505,6 @@ void PerspCorrection::adjusterChanged(Adjuster* a, double newval) camera_shift_horiz->getValue(), M("TP_PERSPECTIVE_CAMERA_SHIFT_VERTICAL"), camera_shift_vert->getValue())); - } else if (a == camera_scale) { - listener->panelChanged (*event_persp_cam_scale, - Glib::ustring::format(camera_scale->getValue())); } else if (a == camera_pitch || a == camera_roll|| a == camera_yaw) { listener->panelChanged (*event_persp_cam_angle, Glib::ustring::compose("%1=%2\n%3=%4\n%5=%6", @@ -643,8 +626,7 @@ void PerspCorrection::setAdjusterBehavior ( bool camera_angle_add, bool projection_angle_add, bool projection_shift_add, - bool projection_rotate_add, - bool projection_scale_add + bool projection_rotate_add ) { @@ -653,7 +635,6 @@ void PerspCorrection::setAdjusterBehavior ( camera_crop_factor->setAddMode(camera_focal_length_add); camera_focal_length->setAddMode(camera_focal_length_add); camera_pitch->setAddMode(camera_angle_add); - camera_scale->setAddMode(projection_scale_add); camera_roll->setAddMode(camera_angle_add); camera_shift_horiz->setAddMode(camera_shift_add); camera_shift_vert->setAddMode(camera_shift_add); @@ -694,7 +675,6 @@ void PerspCorrection::trimValues (rtengine::procparams::ProcParams* pp) camera_focal_length->trimValue(pp->perspective.camera_focal_length); } camera_pitch->trimValue(pp->perspective.camera_pitch); - camera_scale->trimValue(pp->perspective.camera_scale); camera_roll->trimValue(pp->perspective.camera_roll); camera_shift_horiz->trimValue(pp->perspective.camera_shift_horiz); camera_shift_vert->trimValue(pp->perspective.camera_shift_vert); @@ -715,7 +695,6 @@ void PerspCorrection::setBatchMode (bool batchMode) camera_crop_factor->showEditedCB (); camera_focal_length->showEditedCB (); camera_pitch->showEditedCB (); - camera_scale->showEditedCB (); camera_roll->showEditedCB (); camera_shift_horiz->showEditedCB (); camera_shift_vert->showEditedCB (); @@ -894,7 +873,6 @@ void PerspCorrection::setCamBasedEventsActive(bool active) event_persp_cam_focal_length = &EvPerspCamFocalLength; event_persp_cam_shift = &EvPerspCamShift; event_persp_cam_angle = &EvPerspCamAngle; - event_persp_cam_scale = &EvPerspCamScale; event_persp_proj_shift = &EvPerspProjShift; event_persp_proj_rotate = &EvPerspProjRotate; event_persp_proj_angle = &EvPerspProjAngle; @@ -902,7 +880,6 @@ void PerspCorrection::setCamBasedEventsActive(bool active) event_persp_cam_focal_length = &EvPerspCamFocalLengthVoid; event_persp_cam_shift = &EvPerspCamShiftVoid; event_persp_cam_angle = &EvPerspCamAngleVoid; - event_persp_cam_scale = &EvPerspCamScaleVoid; event_persp_proj_shift = &EvPerspProjShiftVoid; event_persp_proj_rotate = &EvPerspProjRotateVoid; event_persp_proj_angle = &EvPerspProjAngleVoid; diff --git a/rtgui/perspective.h b/rtgui/perspective.h index 776dd041c..5f13cf683 100644 --- a/rtgui/perspective.h +++ b/rtgui/perspective.h @@ -64,7 +64,6 @@ protected: Gtk::Button* lines_button_erase; Adjuster* projection_pitch; Adjuster* projection_rotate; - Adjuster* camera_scale; Adjuster* projection_shift_horiz; Adjuster* projection_shift_vert; Adjuster* projection_yaw; @@ -75,7 +74,6 @@ protected: rtengine::ProcEvent EvPerspMethod; rtengine::ProcEvent EvPerspProjShift; rtengine::ProcEvent EvPerspProjRotate; - rtengine::ProcEvent EvPerspCamScale; rtengine::ProcEvent EvPerspProjAngle; rtengine::ProcEvent EvPerspRender; rtengine::ProcEvent EvPerspCamFocalLengthVoid; @@ -83,14 +81,12 @@ protected: rtengine::ProcEvent EvPerspCamAngleVoid; rtengine::ProcEvent EvPerspProjShiftVoid; rtengine::ProcEvent EvPerspProjRotateVoid; - rtengine::ProcEvent EvPerspCamScaleVoid; rtengine::ProcEvent EvPerspProjAngleVoid; rtengine::ProcEvent* event_persp_cam_focal_length; rtengine::ProcEvent* event_persp_cam_shift; rtengine::ProcEvent* event_persp_cam_angle; rtengine::ProcEvent* event_persp_proj_shift; rtengine::ProcEvent* event_persp_proj_rotate; - rtengine::ProcEvent* event_persp_cam_scale; rtengine::ProcEvent* event_persp_proj_angle; LensGeomListener* lens_geom_listener; PerspCorrectionPanelListener* panel_listener; @@ -125,16 +121,13 @@ public: void linesEraseButtonPressed (void); void methodChanged (void); void requestApplyControlLines(void); - void setAdjusterBehavior ( - bool badd, + void setAdjusterBehavior (bool badd, bool camera_focal_length_add, bool camera_shift_add, bool camera_angle_add, bool projection_angle_add, bool projection_shift_add, - bool projection_rotate_add, - bool projection_scale_add - ); + bool projection_rotate_add); void setControlLineEditMode(bool active); void setEditProvider (EditDataProvider* provider) override; void setLensGeomListener (LensGeomListener* listener)