Fix framing tool batch mode behavior
* Add adjuster add/set options to preferences * Update width/height limits * Trim adjuster values * Batch mode fixes * Display all settings with sensitivity * Add "(Unchanged)" option to combo boxes * Fix checked button toggle modes
This commit is contained in:
parent
7ccab91434
commit
55480f40ea
@ -134,6 +134,10 @@ enum {
|
|||||||
ADDSET_SHARP_EDGETOL,
|
ADDSET_SHARP_EDGETOL,
|
||||||
ADDSET_SHARP_HALOCTRL,
|
ADDSET_SHARP_HALOCTRL,
|
||||||
ADDSET_RESIZE_SCALE,
|
ADDSET_RESIZE_SCALE,
|
||||||
|
ADDSET_FRAMING_RELATIVE_SCALE,
|
||||||
|
ADDSET_FRAMING_BORDER_RED,
|
||||||
|
ADDSET_FRAMING_BORDER_GREEN,
|
||||||
|
ADDSET_FRAMING_BORDER_BLUE,
|
||||||
ADDSET_EPD_STRENGTH,
|
ADDSET_EPD_STRENGTH,
|
||||||
ADDSET_EPD_GAMMA,
|
ADDSET_EPD_GAMMA,
|
||||||
ADDSET_EPD_EDGESTOPPING,
|
ADDSET_EPD_EDGESTOPPING,
|
||||||
|
@ -151,6 +151,7 @@ void BatchToolPanelCoordinator::initSession ()
|
|||||||
colorappearance->setAdjusterBehavior (false, false, false, false, false, false, false, false, false, false, false, false, false, false, false);
|
colorappearance->setAdjusterBehavior (false, false, false, false, false, false, false, false, false, false, false, false, false, false, false);
|
||||||
rotate->setAdjusterBehavior (false);
|
rotate->setAdjusterBehavior (false);
|
||||||
resize->setAdjusterBehavior (false);
|
resize->setAdjusterBehavior (false);
|
||||||
|
framing->setAdjusterBehavior (false, false, false, false);
|
||||||
distortion->setAdjusterBehavior (false, false);
|
distortion->setAdjusterBehavior (false, false);
|
||||||
perspective->setAdjusterBehavior (false, false, false, false, false, false, false);
|
perspective->setAdjusterBehavior (false, false, false, false, false, false, false);
|
||||||
gradient->setAdjusterBehavior (false, false, false, false);
|
gradient->setAdjusterBehavior (false, false, false, false);
|
||||||
@ -196,6 +197,11 @@ void BatchToolPanelCoordinator::initSession ()
|
|||||||
colorappearance->setAdjusterBehavior (options.baBehav[ADDSET_CAT_DEGREE], options.baBehav[ADDSET_CAT_ADAPTSCENE], options.baBehav[ADDSET_CAT_ADAPTVIEWING], options.baBehav[ADDSET_CAT_BADPIX], options.baBehav[ADDSET_CAT_LIGHT], options.baBehav[ADDSET_CAT_CHROMA], options.baBehav[ADDSET_CAT_CONTRAST], options.baBehav[ADDSET_CAT_RSTPRO], options.baBehav[ADDSET_CAT_BRIGHT], options.baBehav[ADDSET_CAT_CONTRAST_Q], options.baBehav[ADDSET_CAT_CHROMA_S], options.baBehav[ADDSET_CAT_CHROMA_M], options.baBehav[ADDSET_CAT_HUE],options.baBehav[ADDSET_CAT_DEGREEOUT], options.baBehav[ADDSET_CAT_TEMPOUT] );
|
colorappearance->setAdjusterBehavior (options.baBehav[ADDSET_CAT_DEGREE], options.baBehav[ADDSET_CAT_ADAPTSCENE], options.baBehav[ADDSET_CAT_ADAPTVIEWING], options.baBehav[ADDSET_CAT_BADPIX], options.baBehav[ADDSET_CAT_LIGHT], options.baBehav[ADDSET_CAT_CHROMA], options.baBehav[ADDSET_CAT_CONTRAST], options.baBehav[ADDSET_CAT_RSTPRO], options.baBehav[ADDSET_CAT_BRIGHT], options.baBehav[ADDSET_CAT_CONTRAST_Q], options.baBehav[ADDSET_CAT_CHROMA_S], options.baBehav[ADDSET_CAT_CHROMA_M], options.baBehav[ADDSET_CAT_HUE],options.baBehav[ADDSET_CAT_DEGREEOUT], options.baBehav[ADDSET_CAT_TEMPOUT] );
|
||||||
rotate->setAdjusterBehavior (options.baBehav[ADDSET_ROTATE_DEGREE]);
|
rotate->setAdjusterBehavior (options.baBehav[ADDSET_ROTATE_DEGREE]);
|
||||||
resize->setAdjusterBehavior (options.baBehav[ADDSET_RESIZE_SCALE]);
|
resize->setAdjusterBehavior (options.baBehav[ADDSET_RESIZE_SCALE]);
|
||||||
|
framing->setAdjusterBehavior (
|
||||||
|
options.baBehav[ADDSET_FRAMING_RELATIVE_SCALE],
|
||||||
|
options.baBehav[ADDSET_FRAMING_BORDER_RED],
|
||||||
|
options.baBehav[ADDSET_FRAMING_BORDER_GREEN],
|
||||||
|
options.baBehav[ADDSET_FRAMING_BORDER_BLUE]);
|
||||||
distortion->setAdjusterBehavior (
|
distortion->setAdjusterBehavior (
|
||||||
options.baBehav[ADDSET_DIST_AMOUNT],
|
options.baBehav[ADDSET_DIST_AMOUNT],
|
||||||
options.baBehav[ADDSET_DIST_FOCAL_LENGTH]
|
options.baBehav[ADDSET_DIST_FOCAL_LENGTH]
|
||||||
@ -324,6 +330,10 @@ void BatchToolPanelCoordinator::initSession ()
|
|||||||
if (options.baBehav[ADDSET_DEHAZE_STRENGTH]) { pparams.dehaze.strength = 0; }
|
if (options.baBehav[ADDSET_DEHAZE_STRENGTH]) { pparams.dehaze.strength = 0; }
|
||||||
if (options.baBehav[ADDSET_ROTATE_DEGREE]) { pparams.rotate.degree = 0; }
|
if (options.baBehav[ADDSET_ROTATE_DEGREE]) { pparams.rotate.degree = 0; }
|
||||||
if (options.baBehav[ADDSET_RESIZE_SCALE]) { pparams.resize.scale = 0; }
|
if (options.baBehav[ADDSET_RESIZE_SCALE]) { pparams.resize.scale = 0; }
|
||||||
|
if (options.baBehav[ADDSET_FRAMING_RELATIVE_SCALE]) { pparams.framing.relativeBorderSize = 0; }
|
||||||
|
if (options.baBehav[ADDSET_FRAMING_BORDER_RED]) { pparams.framing.borderRed = 0; }
|
||||||
|
if (options.baBehav[ADDSET_FRAMING_BORDER_GREEN]) { pparams.framing.borderGreen = 0; }
|
||||||
|
if (options.baBehav[ADDSET_FRAMING_BORDER_BLUE]) { pparams.framing.borderBlue = 0; }
|
||||||
if (options.baBehav[ADDSET_DIST_AMOUNT]) { pparams.distortion.amount = 0; }
|
if (options.baBehav[ADDSET_DIST_AMOUNT]) { pparams.distortion.amount = 0; }
|
||||||
if (options.baBehav[ADDSET_PERSPECTIVE]) { pparams.perspective.horizontal = pparams.perspective.vertical = 0; }
|
if (options.baBehav[ADDSET_PERSPECTIVE]) { pparams.perspective.horizontal = pparams.perspective.vertical = 0; }
|
||||||
if (options.baBehav[ADDSET_PERSP_CAM_FOCAL_LENGTH]) { pparams.perspective.camera_focal_length = pparams.perspective.camera_crop_factor = 0; }
|
if (options.baBehav[ADDSET_PERSP_CAM_FOCAL_LENGTH]) { pparams.perspective.camera_focal_length = pparams.perspective.camera_crop_factor = 0; }
|
||||||
@ -467,12 +477,12 @@ void BatchToolPanelCoordinator::panelChanged(const rtengine::ProcEvent& event, c
|
|||||||
crop->write (&pparams, &pparamsEdited);
|
crop->write (&pparams, &pparamsEdited);
|
||||||
resize->update (pparams.crop.enabled, pparams.crop.w, pparams.crop.h, w, h);
|
resize->update (pparams.crop.enabled, pparams.crop.w, pparams.crop.h, w, h);
|
||||||
resize->write (&pparams, &pparamsEdited);
|
resize->write (&pparams, &pparamsEdited);
|
||||||
framing->update (pparams.crop.enabled, pparams.crop.w, pparams.crop.h, w, h);
|
framing->update (w, h);
|
||||||
framing->write (&pparams, &pparamsEdited);
|
framing->write (&pparams, &pparamsEdited);
|
||||||
} else if (event == rtengine::EvCrop) {
|
} else if (event == rtengine::EvCrop) {
|
||||||
resize->update (pparams.crop.enabled, pparams.crop.w, pparams.crop.h);
|
resize->update (pparams.crop.enabled, pparams.crop.w, pparams.crop.h);
|
||||||
resize->write (&pparams, &pparamsEdited);
|
resize->write (&pparams, &pparamsEdited);
|
||||||
framing->update (pparams.crop.enabled, pparams.crop.w, pparams.crop.h, w, h);
|
framing->update (w, h);
|
||||||
framing->write (&pparams, &pparamsEdited);
|
framing->write (&pparams, &pparamsEdited);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
158
rtgui/framing.cc
158
rtgui/framing.cc
@ -43,6 +43,7 @@ constexpr int EMPTY_COMBO_INDEX = -1;
|
|||||||
constexpr int INDEX_STANDARD = 0;
|
constexpr int INDEX_STANDARD = 0;
|
||||||
constexpr int INDEX_BBOX = 1;
|
constexpr int INDEX_BBOX = 1;
|
||||||
constexpr int INDEX_FIXED = 2;
|
constexpr int INDEX_FIXED = 2;
|
||||||
|
constexpr int INDEX_FRAMING_METHOD_UNCHANGED = 3;
|
||||||
constexpr std::array<const char*, 3> FRAMING_METHODS = {
|
constexpr std::array<const char*, 3> FRAMING_METHODS = {
|
||||||
"TP_FRAMING_METHOD_STANDARD",
|
"TP_FRAMING_METHOD_STANDARD",
|
||||||
"TP_FRAMING_METHOD_BBOX",
|
"TP_FRAMING_METHOD_BBOX",
|
||||||
@ -83,6 +84,7 @@ FramingParams::FramingMethod mapFramingMethod(int comboIndex)
|
|||||||
constexpr int INDEX_AS_IMAGE = 0;
|
constexpr int INDEX_AS_IMAGE = 0;
|
||||||
constexpr int INDEX_LANDSCAPE = 1;
|
constexpr int INDEX_LANDSCAPE = 1;
|
||||||
constexpr int INDEX_PORTRAIT = 2;
|
constexpr int INDEX_PORTRAIT = 2;
|
||||||
|
constexpr int INDEX_ORIENTATION_UNCHANGED = 3;
|
||||||
constexpr std::array<const char*, 3> ORIENTATION = {
|
constexpr std::array<const char*, 3> ORIENTATION = {
|
||||||
"GENERAL_ASIMAGE",
|
"GENERAL_ASIMAGE",
|
||||||
"GENERAL_LANDSCAPE",
|
"GENERAL_LANDSCAPE",
|
||||||
@ -122,6 +124,7 @@ FramingParams::Orientation mapOrientation(int comboIndex)
|
|||||||
// Border sizing method combo box data
|
// Border sizing method combo box data
|
||||||
constexpr int INDEX_SIZE_RELATIVE = 0;
|
constexpr int INDEX_SIZE_RELATIVE = 0;
|
||||||
constexpr int INDEX_SIZE_ABSOLUTE = 1;
|
constexpr int INDEX_SIZE_ABSOLUTE = 1;
|
||||||
|
constexpr int INDEX_SIZE_UNCHANGED = 2;
|
||||||
constexpr std::array<const char*, 2> BORDER_SIZE_METHODS = {
|
constexpr std::array<const char*, 2> BORDER_SIZE_METHODS = {
|
||||||
"TP_FRAMING_BORDER_SIZE_RELATIVE",
|
"TP_FRAMING_BORDER_SIZE_RELATIVE",
|
||||||
"TP_FRAMING_BORDER_SIZE_ABSOLUTE"
|
"TP_FRAMING_BORDER_SIZE_ABSOLUTE"
|
||||||
@ -159,6 +162,7 @@ constexpr int INDEX_BASIS_WIDTH = 1;
|
|||||||
constexpr int INDEX_BASIS_HEIGHT = 2;
|
constexpr int INDEX_BASIS_HEIGHT = 2;
|
||||||
constexpr int INDEX_BASIS_LONG = 3;
|
constexpr int INDEX_BASIS_LONG = 3;
|
||||||
constexpr int INDEX_BASIS_SHORT = 4;
|
constexpr int INDEX_BASIS_SHORT = 4;
|
||||||
|
constexpr int INDEX_BASIS_UNCHANGED = 5;
|
||||||
constexpr std::array<const char*, 5> BORDER_SIZE_BASIS = {
|
constexpr std::array<const char*, 5> BORDER_SIZE_BASIS = {
|
||||||
"TP_FRAMING_BASIS_AUTO",
|
"TP_FRAMING_BASIS_AUTO",
|
||||||
"TP_FRAMING_BASIS_WIDTH",
|
"TP_FRAMING_BASIS_WIDTH",
|
||||||
@ -205,8 +209,8 @@ FramingParams::Basis mapBasis(int comboIndex)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr int INITIAL_IMG_WIDTH = 800;
|
constexpr int INITIAL_IMG_WIDTH = 100000;
|
||||||
constexpr int INITIAL_IMG_HEIGHT = 600;
|
constexpr int INITIAL_IMG_HEIGHT = 100000;
|
||||||
|
|
||||||
constexpr int ROW_SPACING = 4;
|
constexpr int ROW_SPACING = 4;
|
||||||
constexpr float FRAME_LABEL_ALIGN_X = 0.025;
|
constexpr float FRAME_LABEL_ALIGN_X = 0.025;
|
||||||
@ -252,7 +256,9 @@ public:
|
|||||||
combo->set_active(INDEX_CURRENT);
|
combo->set_active(INDEX_CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
double value(int index)
|
int unchangedIndex() const { return ratios.size(); }
|
||||||
|
|
||||||
|
double value(int index) const
|
||||||
{
|
{
|
||||||
return ratios.at(index).value;
|
return ratios.at(index).value;
|
||||||
}
|
}
|
||||||
@ -293,7 +299,9 @@ Framing::Framing() :
|
|||||||
FoldableToolPanel(this, TOOL_NAME, M("TP_FRAMING_LABEL"), false, true),
|
FoldableToolPanel(this, TOOL_NAME, M("TP_FRAMING_LABEL"), false, true),
|
||||||
aspectRatioData(new AspectRatios),
|
aspectRatioData(new AspectRatios),
|
||||||
imgWidth(INITIAL_IMG_WIDTH),
|
imgWidth(INITIAL_IMG_WIDTH),
|
||||||
imgHeight(INITIAL_IMG_HEIGHT)
|
imgHeight(INITIAL_IMG_HEIGHT),
|
||||||
|
lastAllowUpscaling(false),
|
||||||
|
lastMinSizeEnabled(false)
|
||||||
{
|
{
|
||||||
setupFramingMethodGui();
|
setupFramingMethodGui();
|
||||||
pack_start(*Gtk::manage(new Gtk::Separator(Gtk::ORIENTATION_HORIZONTAL)));
|
pack_start(*Gtk::manage(new Gtk::Separator(Gtk::ORIENTATION_HORIZONTAL)));
|
||||||
@ -467,21 +475,23 @@ void Framing::setupBorderColorsGui()
|
|||||||
void Framing::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited)
|
void Framing::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited)
|
||||||
{
|
{
|
||||||
DisableListener disableListener(this);
|
DisableListener disableListener(this);
|
||||||
std::vector<ConnectionBlocker> blockers;
|
|
||||||
blockers.reserve(13);
|
std::array<ConnectionBlocker, 13> blockers = {
|
||||||
blockers.emplace_back(framingMethodChanged);
|
ConnectionBlocker(framingMethodChanged),
|
||||||
blockers.emplace_back(aspectRatioChanged);
|
ConnectionBlocker(aspectRatioChanged),
|
||||||
blockers.emplace_back(orientationChanged);
|
ConnectionBlocker(orientationChanged),
|
||||||
blockers.emplace_back(width.connection);
|
ConnectionBlocker(width.connection),
|
||||||
blockers.emplace_back(height.connection);
|
ConnectionBlocker(height.connection),
|
||||||
blockers.emplace_back(allowUpscalingConnection);
|
ConnectionBlocker(allowUpscalingConnection),
|
||||||
blockers.emplace_back(borderSizeMethodChanged);
|
ConnectionBlocker(borderSizeMethodChanged),
|
||||||
blockers.emplace_back(basisChanged);
|
ConnectionBlocker(basisChanged),
|
||||||
blockers.emplace_back(minSizeEnabledConnection);
|
ConnectionBlocker(minSizeEnabledConnection),
|
||||||
blockers.emplace_back(minWidth.connection);
|
ConnectionBlocker(minWidth.connection),
|
||||||
blockers.emplace_back(minHeight.connection);
|
ConnectionBlocker(minHeight.connection),
|
||||||
blockers.emplace_back(absWidth.connection);
|
ConnectionBlocker(absWidth.connection),
|
||||||
blockers.emplace_back(absHeight.connection);
|
ConnectionBlocker(absHeight.connection)
|
||||||
|
};
|
||||||
|
|
||||||
BlockAdjusterEvents blockRelative(relativeBorderSize);
|
BlockAdjusterEvents blockRelative(relativeBorderSize);
|
||||||
BlockAdjusterEvents blockRed(redAdj);
|
BlockAdjusterEvents blockRed(redAdj);
|
||||||
BlockAdjusterEvents blockGreen(greenAdj);
|
BlockAdjusterEvents blockGreen(greenAdj);
|
||||||
@ -492,6 +502,7 @@ void Framing::read(const rtengine::procparams::ProcParams* pp, const ParamsEdite
|
|||||||
|
|
||||||
updateFramingMethodGui();
|
updateFramingMethodGui();
|
||||||
updateBorderSizeGui();
|
updateBorderSizeGui();
|
||||||
|
setDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Framing::readParams(const rtengine::procparams::ProcParams* pp)
|
void Framing::readParams(const rtengine::procparams::ProcParams* pp)
|
||||||
@ -508,11 +519,13 @@ void Framing::readParams(const rtengine::procparams::ProcParams* pp)
|
|||||||
height.setValue(params.framedHeight);
|
height.setValue(params.framedHeight);
|
||||||
height.isDirty = false;
|
height.isDirty = false;
|
||||||
allowUpscaling->set_active(params.allowUpscaling);
|
allowUpscaling->set_active(params.allowUpscaling);
|
||||||
|
lastAllowUpscaling = params.allowUpscaling;
|
||||||
|
|
||||||
borderSizeMethod->set_active(mapBorderSizeMethod(params.borderSizingMethod));
|
borderSizeMethod->set_active(mapBorderSizeMethod(params.borderSizingMethod));
|
||||||
basis->set_active(mapBasis(params.basis));
|
basis->set_active(mapBasis(params.basis));
|
||||||
relativeBorderSize->setValue(params.relativeBorderSize);
|
relativeBorderSize->setValue(params.relativeBorderSize);
|
||||||
minSizeEnabled->set_active(params.minSizeEnabled);
|
minSizeEnabled->set_active(params.minSizeEnabled);
|
||||||
|
lastMinSizeEnabled = params.minSizeEnabled;
|
||||||
minWidth.setValue(params.minWidth);
|
minWidth.setValue(params.minWidth);
|
||||||
minWidth.isDirty = false;
|
minWidth.isDirty = false;
|
||||||
minHeight.setValue(params.minHeight);
|
minHeight.setValue(params.minHeight);
|
||||||
@ -607,15 +620,15 @@ void Framing::writeEdited(ParamsEdited* pedited)
|
|||||||
|
|
||||||
edits.enabled = !get_inconsistent();
|
edits.enabled = !get_inconsistent();
|
||||||
|
|
||||||
edits.framingMethod = framingMethod->get_active_row_number() != EMPTY_COMBO_INDEX;
|
edits.framingMethod = framingMethod->get_active_row_number() != INDEX_FRAMING_METHOD_UNCHANGED;
|
||||||
edits.aspectRatio = aspectRatio->get_active_row_number() != EMPTY_COMBO_INDEX;
|
edits.aspectRatio = aspectRatio->get_active_row_number() != aspectRatioData->unchangedIndex();
|
||||||
edits.orientation = orientation->get_active_row_number() != EMPTY_COMBO_INDEX;
|
edits.orientation = orientation->get_active_row_number() != INDEX_ORIENTATION_UNCHANGED;
|
||||||
edits.framedWidth = width.isDirty;
|
edits.framedWidth = width.isDirty;
|
||||||
edits.framedHeight = height.isDirty;
|
edits.framedHeight = height.isDirty;
|
||||||
edits.allowUpscaling = !allowUpscaling->get_inconsistent();
|
edits.allowUpscaling = !allowUpscaling->get_inconsistent();
|
||||||
|
|
||||||
edits.borderSizingMethod = borderSizeMethod->get_active_row_number() != EMPTY_COMBO_INDEX;
|
edits.borderSizingMethod = borderSizeMethod->get_active_row_number() != INDEX_SIZE_UNCHANGED;
|
||||||
edits.basis = basis->get_active_row_number() != EMPTY_COMBO_INDEX;
|
edits.basis = basis->get_active_row_number() != INDEX_BASIS_UNCHANGED;
|
||||||
edits.relativeBorderSize = relativeBorderSize->getEditedState();
|
edits.relativeBorderSize = relativeBorderSize->getEditedState();
|
||||||
edits.minSizeEnabled = !minSizeEnabled->get_inconsistent();
|
edits.minSizeEnabled = !minSizeEnabled->get_inconsistent();
|
||||||
edits.minWidth = minWidth.isDirty;
|
edits.minWidth = minWidth.isDirty;
|
||||||
@ -652,9 +665,27 @@ void Framing::setDefaults(const rtengine::procparams::ProcParams* defParams, con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Framing::trimValues(rtengine::procparams::ProcParams* pp)
|
||||||
|
{
|
||||||
|
relativeBorderSize->trimValue(pp->framing.relativeBorderSize);
|
||||||
|
redAdj->trimValue(pp->framing.borderRed);
|
||||||
|
greenAdj->trimValue(pp->framing.borderGreen);
|
||||||
|
blueAdj->trimValue(pp->framing.borderBlue);
|
||||||
|
}
|
||||||
|
|
||||||
void Framing::setBatchMode(bool batchMode)
|
void Framing::setBatchMode(bool batchMode)
|
||||||
{
|
{
|
||||||
|
framingMethod->append(M("GENERAL_UNCHANGED"));
|
||||||
|
aspectRatio->append(M("GENERAL_UNCHANGED"));
|
||||||
|
orientation->append(M("GENERAL_UNCHANGED"));
|
||||||
|
borderSizeMethod->append(M("GENERAL_UNCHANGED"));
|
||||||
|
basis->append(M("GENERAL_UNCHANGED"));
|
||||||
|
|
||||||
ToolPanel::setBatchMode(batchMode);
|
ToolPanel::setBatchMode(batchMode);
|
||||||
|
relativeBorderSize->showEditedCB();
|
||||||
|
redAdj->showEditedCB();
|
||||||
|
greenAdj->showEditedCB();
|
||||||
|
blueAdj->showEditedCB();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Framing::enabledChanged()
|
void Framing::enabledChanged()
|
||||||
@ -670,22 +701,43 @@ void Framing::enabledChanged()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Framing::update(bool isCropped, int croppedWidth, int croppedHeight,
|
void Framing::update(int originalWidth, int originalHeight)
|
||||||
int originalWidth, int originalHeight)
|
|
||||||
{
|
{
|
||||||
|
// This is how it is checked in resize.cc
|
||||||
if (originalWidth && originalHeight) {
|
if (originalWidth && originalHeight) {
|
||||||
imgWidth = originalWidth;
|
imgWidth = originalWidth;
|
||||||
imgHeight = originalHeight;
|
imgHeight = originalHeight;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setDimensions();
|
void Framing::setAdjusterBehavior(bool addRelativeBorderSize, bool addRed, bool addGreen,
|
||||||
|
bool addBlue)
|
||||||
|
{
|
||||||
|
relativeBorderSize->setAddMode(addRelativeBorderSize);
|
||||||
|
redAdj->setAddMode(addRed);
|
||||||
|
greenAdj->setAddMode(addGreen);
|
||||||
|
blueAdj->setAddMode(addBlue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Framing::setDimensions()
|
void Framing::setDimensions()
|
||||||
{
|
{
|
||||||
idleRegister.add([this]() -> bool {
|
idleRegister.add([this]() -> bool {
|
||||||
|
std::array<ConnectionBlocker, 6> blockers = {
|
||||||
|
ConnectionBlocker(width.connection),
|
||||||
|
ConnectionBlocker(height.connection),
|
||||||
|
ConnectionBlocker(minWidth.connection),
|
||||||
|
ConnectionBlocker(minHeight.connection),
|
||||||
|
ConnectionBlocker(absWidth.connection),
|
||||||
|
ConnectionBlocker(absHeight.connection)
|
||||||
|
};
|
||||||
|
|
||||||
|
// 16x the full image size is probably a reasonable max
|
||||||
width.value->set_range(Resize::MIN_SIZE, Resize::MAX_SCALE * imgWidth);
|
width.value->set_range(Resize::MIN_SIZE, Resize::MAX_SCALE * imgWidth);
|
||||||
height.value->set_range(Resize::MIN_SIZE, Resize::MAX_SCALE * imgHeight);
|
height.value->set_range(Resize::MIN_SIZE, Resize::MAX_SCALE * imgHeight);
|
||||||
|
minWidth.value->set_range(0, Resize::MAX_SCALE * imgWidth);
|
||||||
|
minHeight.value->set_range(0, Resize::MAX_SCALE * imgHeight);
|
||||||
|
absWidth.value->set_range(0, Resize::MAX_SCALE * imgWidth);
|
||||||
|
absHeight.value->set_range(0, Resize::MAX_SCALE * imgHeight);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
@ -693,7 +745,16 @@ void Framing::setDimensions()
|
|||||||
|
|
||||||
void Framing::updateFramingMethodGui()
|
void Framing::updateFramingMethodGui()
|
||||||
{
|
{
|
||||||
if (batchMode) return;
|
if (batchMode) {
|
||||||
|
aspectRatioLabel->show();
|
||||||
|
aspectRatio->show();
|
||||||
|
orientationLabel->show();
|
||||||
|
orientation->show();
|
||||||
|
width.show();
|
||||||
|
height.show();
|
||||||
|
allowUpscaling->show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int activeRow = framingMethod->get_active_row_number();
|
int activeRow = framingMethod->get_active_row_number();
|
||||||
if (activeRow == INDEX_STANDARD) {
|
if (activeRow == INDEX_STANDARD) {
|
||||||
@ -725,7 +786,20 @@ void Framing::updateFramingMethodGui()
|
|||||||
|
|
||||||
void Framing::updateBorderSizeGui()
|
void Framing::updateBorderSizeGui()
|
||||||
{
|
{
|
||||||
if (batchMode) return;
|
if (batchMode) {
|
||||||
|
basisLabel->show();
|
||||||
|
basis->show();
|
||||||
|
relativeBorderSize->show();
|
||||||
|
minSizeFrame->show();
|
||||||
|
absWidth.show();
|
||||||
|
absHeight.show();
|
||||||
|
|
||||||
|
aspectRatio->set_sensitive(true);
|
||||||
|
orientation->set_sensitive(true);
|
||||||
|
|
||||||
|
minSizeFrameContent->set_sensitive(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int activeRow = borderSizeMethod->get_active_row_number();
|
int activeRow = borderSizeMethod->get_active_row_number();
|
||||||
if (activeRow == INDEX_SIZE_RELATIVE) {
|
if (activeRow == INDEX_SIZE_RELATIVE) {
|
||||||
@ -821,6 +895,18 @@ void Framing::onHeightChanged()
|
|||||||
|
|
||||||
void Framing::onAllowUpscalingToggled()
|
void Framing::onAllowUpscalingToggled()
|
||||||
{
|
{
|
||||||
|
if (batchMode) {
|
||||||
|
if (allowUpscaling->get_inconsistent()) {
|
||||||
|
allowUpscaling->set_inconsistent(false);
|
||||||
|
ConnectionBlocker block(allowUpscalingConnection);
|
||||||
|
allowUpscaling->set_active(false);
|
||||||
|
} else if (lastAllowUpscaling) {
|
||||||
|
allowUpscaling->set_inconsistent(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
lastAllowUpscaling = allowUpscaling->get_active();
|
||||||
|
}
|
||||||
|
|
||||||
if (listener && (getEnabled() || batchMode)) {
|
if (listener && (getEnabled() || batchMode)) {
|
||||||
if (allowUpscaling->get_inconsistent()) {
|
if (allowUpscaling->get_inconsistent()) {
|
||||||
listener->panelChanged(EvFramingAllowUpscaling, M("GENERAL_UNCHANGED"));
|
listener->panelChanged(EvFramingAllowUpscaling, M("GENERAL_UNCHANGED"));
|
||||||
@ -850,6 +936,18 @@ void Framing::onBasisChanged()
|
|||||||
|
|
||||||
void Framing::onMinSizeToggled()
|
void Framing::onMinSizeToggled()
|
||||||
{
|
{
|
||||||
|
if (batchMode) {
|
||||||
|
if (minSizeEnabled->get_inconsistent()) {
|
||||||
|
minSizeEnabled->set_inconsistent(false);
|
||||||
|
ConnectionBlocker block(minSizeEnabledConnection);
|
||||||
|
minSizeEnabled->set_active(false);
|
||||||
|
} else if (lastMinSizeEnabled) {
|
||||||
|
minSizeEnabled->set_inconsistent(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
lastMinSizeEnabled = minSizeEnabled->get_active();
|
||||||
|
}
|
||||||
|
|
||||||
updateBorderSizeGui();
|
updateBorderSizeGui();
|
||||||
|
|
||||||
if (listener && (getEnabled() || batchMode)) {
|
if (listener && (getEnabled() || batchMode)) {
|
||||||
@ -901,4 +999,4 @@ void Framing::onAbsHeightChanged()
|
|||||||
listener->panelChanged(EvFramingAbsHeight,
|
listener->panelChanged(EvFramingAbsHeight,
|
||||||
Glib::ustring::format(absHeight.value->get_value_as_int()));
|
Glib::ustring::format(absHeight.value->get_value_as_int()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,11 +45,12 @@ public:
|
|||||||
ParamsEdited* pedited = nullptr) override;
|
ParamsEdited* pedited = nullptr) override;
|
||||||
void setDefaults(const rtengine::procparams::ProcParams* defParams,
|
void setDefaults(const rtengine::procparams::ProcParams* defParams,
|
||||||
const ParamsEdited* pedited = nullptr) override;
|
const ParamsEdited* pedited = nullptr) override;
|
||||||
|
void trimValues(rtengine::procparams::ProcParams* pp) override;
|
||||||
void setBatchMode(bool batchMode) override;
|
void setBatchMode(bool batchMode) override;
|
||||||
void enabledChanged() override;
|
void enabledChanged() override;
|
||||||
|
|
||||||
void update(bool isCropped, int croppedWidth, int croppedHeight,
|
void update(int originalWidth = 0, int originalHeight = 0);
|
||||||
int originalWidth = 0, int originalHeight = 0);
|
void setAdjusterBehavior(bool addRelativeBorderSize, bool addRed, bool addGreen, bool addBlue);
|
||||||
|
|
||||||
// AdjusterListener
|
// AdjusterListener
|
||||||
void adjusterChanged(Adjuster* adj, double newVal) override;
|
void adjusterChanged(Adjuster* adj, double newVal) override;
|
||||||
@ -146,4 +147,6 @@ private:
|
|||||||
|
|
||||||
int imgWidth;
|
int imgWidth;
|
||||||
int imgHeight;
|
int imgHeight;
|
||||||
};
|
bool lastAllowUpscaling;
|
||||||
|
bool lastMinSizeEnabled;
|
||||||
|
};
|
||||||
|
@ -81,7 +81,8 @@ void initFrom(FramingParamsEdited& edits, const ProcParams& params, const ProcPa
|
|||||||
edits.borderBlue &= curr.borderBlue == other.borderBlue;
|
edits.borderBlue &= curr.borderBlue == other.borderBlue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void combine(FramingParams& toEdit, const FramingParams& mod, const FramingParamsEdited& edits)
|
void combine(FramingParams& toEdit, const FramingParams& mod, const FramingParamsEdited& edits,
|
||||||
|
bool dontForceSet)
|
||||||
{
|
{
|
||||||
if (edits.enabled) {
|
if (edits.enabled) {
|
||||||
toEdit.enabled = mod.enabled;
|
toEdit.enabled = mod.enabled;
|
||||||
@ -112,7 +113,10 @@ void combine(FramingParams& toEdit, const FramingParams& mod, const FramingParam
|
|||||||
toEdit.basis = mod.basis;
|
toEdit.basis = mod.basis;
|
||||||
}
|
}
|
||||||
if (edits.relativeBorderSize) {
|
if (edits.relativeBorderSize) {
|
||||||
toEdit.relativeBorderSize = mod.relativeBorderSize;
|
toEdit.relativeBorderSize =
|
||||||
|
dontForceSet && options.baBehav[ADDSET_FRAMING_RELATIVE_SCALE] ?
|
||||||
|
toEdit.relativeBorderSize + mod.relativeBorderSize :
|
||||||
|
mod.relativeBorderSize;
|
||||||
}
|
}
|
||||||
if (edits.minSizeEnabled) {
|
if (edits.minSizeEnabled) {
|
||||||
toEdit.minSizeEnabled = mod.minSizeEnabled;
|
toEdit.minSizeEnabled = mod.minSizeEnabled;
|
||||||
@ -131,13 +135,19 @@ void combine(FramingParams& toEdit, const FramingParams& mod, const FramingParam
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (edits.borderRed) {
|
if (edits.borderRed) {
|
||||||
toEdit.borderRed = mod.borderRed;
|
toEdit.borderRed = dontForceSet && options.baBehav[ADDSET_FRAMING_BORDER_RED] ?
|
||||||
|
toEdit.borderRed + mod.borderRed :
|
||||||
|
mod.borderRed;
|
||||||
}
|
}
|
||||||
if (edits.borderGreen) {
|
if (edits.borderGreen) {
|
||||||
toEdit.borderGreen = mod.borderGreen;
|
toEdit.borderGreen = dontForceSet && options.baBehav[ADDSET_FRAMING_BORDER_GREEN] ?
|
||||||
|
toEdit.borderGreen + mod.borderGreen :
|
||||||
|
mod.borderGreen;
|
||||||
}
|
}
|
||||||
if (edits.borderBlue) {
|
if (edits.borderBlue) {
|
||||||
toEdit.borderBlue = mod.borderBlue;
|
toEdit.borderBlue = dontForceSet && options.baBehav[ADDSET_FRAMING_BORDER_BLUE] ?
|
||||||
|
toEdit.borderBlue + mod.borderBlue :
|
||||||
|
mod.borderBlue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6978,7 +6988,7 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
|
|||||||
toEdit.resize.allowUpscaling = mods.resize.allowUpscaling;
|
toEdit.resize.allowUpscaling = mods.resize.allowUpscaling;
|
||||||
}
|
}
|
||||||
|
|
||||||
::combine(toEdit.framing, mods.framing, framing);
|
::combine(toEdit.framing, mods.framing, framing, dontforceSet);
|
||||||
|
|
||||||
if (icm.inputProfile) {
|
if (icm.inputProfile) {
|
||||||
toEdit.icm.inputProfile = mods.icm.inputProfile;
|
toEdit.icm.inputProfile = mods.icm.inputProfile;
|
||||||
|
@ -364,6 +364,13 @@ Gtk::Widget* Preferences::getBatchProcPanel()
|
|||||||
mi->set_value(behavColumns.label, M("TP_RESIZE_LABEL"));
|
mi->set_value(behavColumns.label, M("TP_RESIZE_LABEL"));
|
||||||
appendBehavList(mi, M("TP_RESIZE_SCALE"), ADDSET_RESIZE_SCALE, true);
|
appendBehavList(mi, M("TP_RESIZE_SCALE"), ADDSET_RESIZE_SCALE, true);
|
||||||
|
|
||||||
|
mi = behModel->append();
|
||||||
|
mi->set_value(behavColumns.label, M("TP_FRAMING_LABEL"));
|
||||||
|
appendBehavList(mi, M("TP_FRAMING_BORDER_SIZE"), ADDSET_FRAMING_RELATIVE_SCALE, false);
|
||||||
|
appendBehavList(mi, M("TP_FRAMING_RED"), ADDSET_FRAMING_BORDER_RED, false);
|
||||||
|
appendBehavList(mi, M("TP_FRAMING_GREEN"), ADDSET_FRAMING_BORDER_GREEN, false);
|
||||||
|
appendBehavList(mi, M("TP_FRAMING_BLUE"), ADDSET_FRAMING_BORDER_BLUE, false);
|
||||||
|
|
||||||
mi = behModel->append();
|
mi = behModel->append();
|
||||||
mi->set_value(behavColumns.label, M("TP_LENSGEOM_SCALE"));
|
mi->set_value(behavColumns.label, M("TP_LENSGEOM_SCALE"));
|
||||||
appendBehavList(mi, M("TP_LENSGEOM_SCALE"), ADDSET_LENSGEOM_SCALE, true);
|
appendBehavList(mi, M("TP_LENSGEOM_SCALE"), ADDSET_LENSGEOM_SCALE, true);
|
||||||
|
@ -1123,12 +1123,12 @@ void ToolPanelCoordinator::panelChanged(const rtengine::ProcEvent& event, const
|
|||||||
crop->write(params);
|
crop->write(params);
|
||||||
resize->update(params->crop.enabled, params->crop.w, params->crop.h, ipc->getFullWidth(), ipc->getFullHeight());
|
resize->update(params->crop.enabled, params->crop.w, params->crop.h, ipc->getFullWidth(), ipc->getFullHeight());
|
||||||
resize->write(params);
|
resize->write(params);
|
||||||
framing->update(params->crop.enabled, params->crop.w, params->crop.h, ipc->getFullWidth(), ipc->getFullHeight());
|
framing->update(ipc->getFullWidth(), ipc->getFullHeight());
|
||||||
framing->write(params);
|
framing->write(params);
|
||||||
} else if (event == rtengine::EvCrop) {
|
} else if (event == rtengine::EvCrop) {
|
||||||
resize->update(params->crop.enabled, params->crop.w, params->crop.h);
|
resize->update(params->crop.enabled, params->crop.w, params->crop.h);
|
||||||
resize->write(params);
|
resize->write(params);
|
||||||
framing->update(params->crop.enabled, params->crop.w, params->crop.h, ipc->getFullWidth(), ipc->getFullHeight());
|
framing->update(ipc->getFullWidth(), ipc->getFullHeight());
|
||||||
framing->write(params);
|
framing->write(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user