Introducing TweakOperator, for better tool's special mode handling
This commit is contained in:
@@ -558,6 +558,14 @@ void BatchToolPanelCoordinator::panelChanged(const rtengine::ProcEvent& event, c
|
||||
}
|
||||
}
|
||||
|
||||
void BatchToolPanelCoordinator::setTweakOperator (rtengine::TweakOperator *tOperator)
|
||||
{
|
||||
}
|
||||
|
||||
void BatchToolPanelCoordinator::unsetTweakOperator (rtengine::TweakOperator *tOperator)
|
||||
{
|
||||
}
|
||||
|
||||
void BatchToolPanelCoordinator::getAutoWB (double& temp, double& green, double equal, double tempBias)
|
||||
{
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@ public:
|
||||
|
||||
// toolpanellistener interface
|
||||
void panelChanged(const rtengine::ProcEvent& event, const Glib::ustring& descr) override;
|
||||
void setTweakOperator (rtengine::TweakOperator *tOperator) override;
|
||||
void unsetTweakOperator (rtengine::TweakOperator *tOperator) override;
|
||||
|
||||
// profilechangelistener interface
|
||||
void profileChange(
|
||||
|
||||
@@ -1092,7 +1092,7 @@ void CropWindow::pointerMoved (int bstate, int x, int y)
|
||||
rtengine::StagedImageProcessor* ipc = iarea->getImProcCoordinator();
|
||||
if(ipc) {
|
||||
procparams::ProcParams params;
|
||||
ipc->getParams(¶ms);
|
||||
ipc->getParams(¶ms, true);
|
||||
isRaw = params.raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE) || params.raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE);
|
||||
if(isRaw) {
|
||||
ImageSource *isrc = static_cast<ImageSource*>(ipc->getInitialImage());
|
||||
|
||||
@@ -197,10 +197,12 @@ void Spot::editToggled ()
|
||||
{
|
||||
if (listener) {
|
||||
if (edit->get_active()) {
|
||||
listener->setTweakOperator(this);
|
||||
listener->refreshPreview(EvSpotEnabledOPA); // reprocess the preview w/o creating History entry
|
||||
subscribe();
|
||||
} else {
|
||||
unsubscribe();
|
||||
listener->unsetTweakOperator(this);
|
||||
listener->refreshPreview(EvSpotEnabled); // reprocess the preview w/o creating History entry
|
||||
}
|
||||
}
|
||||
@@ -701,6 +703,38 @@ void Spot::switchOffEditMode ()
|
||||
}
|
||||
|
||||
EditSubscriber::switchOffEditMode(); // disconnect
|
||||
listener->unsetTweakOperator(this);
|
||||
listener->refreshPreview(EvSpotEnabled); // reprocess the preview w/o creating History entry
|
||||
}
|
||||
|
||||
void Spot::tweakParams(procparams::ProcParams& pparams)
|
||||
{
|
||||
//params->raw.bayersensor.method = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::FAST);
|
||||
//params->raw.xtranssensor.method = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FAST);
|
||||
|
||||
// -> disabling all transform
|
||||
//params->coarse = CoarseTransformParams();
|
||||
pparams.lensProf = LensProfParams();
|
||||
pparams.cacorrection = CACorrParams();
|
||||
pparams.distortion = DistortionParams();
|
||||
pparams.rotate = RotateParams();
|
||||
pparams.perspective = PerspectiveParams();
|
||||
pparams.vignetting = VignettingParams();
|
||||
|
||||
// -> disabling standard crop
|
||||
pparams.crop.enabled = false;
|
||||
|
||||
// -> disabling time consuming and unnecessary tool
|
||||
pparams.sh.enabled = false;
|
||||
pparams.blackwhite.enabled = false;
|
||||
pparams.dehaze.enabled = false;
|
||||
pparams.wavelet.enabled = false;
|
||||
pparams.filmSimulation.enabled = false;
|
||||
pparams.sharpenEdge.enabled = false;
|
||||
pparams.sharpenMicro.enabled = false;
|
||||
pparams.sharpening.enabled = false;
|
||||
pparams.softlight.enabled = false;
|
||||
pparams.gradient.enabled = false;
|
||||
pparams.pcvignette.enabled = false;
|
||||
pparams.colorappearance.enabled = false;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "toolpanel.h"
|
||||
#include "editwidgets.h"
|
||||
#include "../rtengine/procparams.h"
|
||||
#include "../rtengine/tweakoperator.h"
|
||||
|
||||
/**
|
||||
* @brief Let the user create/edit/delete points for Spot Removal tool
|
||||
@@ -36,7 +37,7 @@
|
||||
* (the point will be deleted on button release).
|
||||
*/
|
||||
|
||||
class Spot : public ToolParamBlock, public FoldableToolPanel, public EditSubscriber
|
||||
class Spot : public ToolParamBlock, public FoldableToolPanel, public EditSubscriber, public rtengine::TweakOperator
|
||||
{
|
||||
|
||||
private:
|
||||
@@ -99,6 +100,9 @@ public:
|
||||
bool pick3 (const bool picked);
|
||||
void switchOffEditMode ();
|
||||
|
||||
//TweakOperator interface
|
||||
void tweakParams(rtengine::procparams::ProcParams& pparams) override;
|
||||
|
||||
rtengine::ProcEvent EvSpotEnabled;
|
||||
rtengine::ProcEvent EvSpotEnabledOPA; // used to toggle-on the Spot 'On Preview Adjustment' mode
|
||||
rtengine::ProcEvent EvSpotEntry;
|
||||
|
||||
@@ -40,6 +40,10 @@ public:
|
||||
virtual void refreshPreview(const rtengine::ProcEvent& event) = 0;
|
||||
/// @brief Used to notify all listeners that a parameters has been effectively changed
|
||||
virtual void panelChanged(const rtengine::ProcEvent& event, const Glib::ustring& descr) = 0;
|
||||
/// @brief Set the TweakOperator to the StagedImageProcessor, to let some tool enter into special modes
|
||||
virtual void setTweakOperator (rtengine::TweakOperator *tOperator) = 0;
|
||||
/// @brief Unset the TweakOperator to the StagedImageProcessor
|
||||
virtual void unsetTweakOperator (rtengine::TweakOperator *tOperator) = 0;
|
||||
};
|
||||
|
||||
/// @brief This class control the space around the group of tools inside a tab, as well as the space separating each tool. */
|
||||
|
||||
@@ -379,6 +379,20 @@ void ToolPanelCoordinator::imageTypeChanged (bool isRaw, bool isBayer, bool isXt
|
||||
|
||||
}
|
||||
|
||||
void ToolPanelCoordinator::setTweakOperator (rtengine::TweakOperator *tOperator)
|
||||
{
|
||||
if (ipc && tOperator) {
|
||||
ipc->setTweakOperator(tOperator);
|
||||
}
|
||||
}
|
||||
|
||||
void ToolPanelCoordinator::unsetTweakOperator (rtengine::TweakOperator *tOperator)
|
||||
{
|
||||
if (ipc && tOperator) {
|
||||
ipc->unsetTweakOperator(tOperator);
|
||||
}
|
||||
}
|
||||
|
||||
void ToolPanelCoordinator::refreshPreview (const rtengine::ProcEvent& event)
|
||||
{
|
||||
if (!ipc) {
|
||||
|
||||
@@ -239,7 +239,10 @@ public:
|
||||
// toolpanellistener interface
|
||||
void refreshPreview(const rtengine::ProcEvent& event) override;
|
||||
void panelChanged(const rtengine::ProcEvent& event, const Glib::ustring& descr) override;
|
||||
void setTweakOperator (rtengine::TweakOperator *tOperator) override;
|
||||
void unsetTweakOperator (rtengine::TweakOperator *tOperator) override;
|
||||
|
||||
// FilmNegProvider interface
|
||||
void imageTypeChanged (bool isRaw, bool isBayer, bool isXtrans, bool isMono = false) override;
|
||||
|
||||
// void autoContrastChanged (double autoContrast);
|
||||
|
||||
Reference in New Issue
Block a user