Implement ProcEvents for framing tool
* Add new events to ProcEvents * Add new events to refresh map under RESIZE category * Add new strings for displaying events in history panel * Hook up GUI events with emitting ProcEvents
This commit is contained in:
parent
757a0a032a
commit
29945f4a35
@ -1380,6 +1380,24 @@ HISTORY_MSG_1147;Local - Jz BlackEv WhiteEv
|
||||
HISTORY_MSG_1148;Local - Jz Sigmoid
|
||||
HISTORY_MSG_1149;Local - Q Sigmoid
|
||||
HISTORY_MSG_1150;Local - Log encoding Q instead Sigmoid Q
|
||||
HISTORY_MSG_1151;Framing
|
||||
HISTORY_MSG_1152;Framing - Method
|
||||
HISTORY_MSG_1153;Framing - Aspect Ratio
|
||||
HISTORY_MSG_1154;Framing - Orientation
|
||||
HISTORY_MSG_1155;Framing - Framed Width
|
||||
HISTORY_MSG_1156;Framing - Framed Height
|
||||
HISTORY_MSG_1157;Framing - Upscaling
|
||||
HISTORY_MSG_1158;Framing - Border Sizing Method
|
||||
HISTORY_MSG_1159;Framing - Basis
|
||||
HISTORY_MSG_1160;Framing - Relative Size
|
||||
HISTORY_MSG_1161;Framing - Min Size
|
||||
HISTORY_MSG_1162;Framing - Min Width
|
||||
HISTORY_MSG_1163;Framing - Min Height
|
||||
HISTORY_MSG_1164;Framing - Border Width
|
||||
HISTORY_MSG_1165;Framing - Border Height
|
||||
HISTORY_MSG_1166;Framing - Border (R)
|
||||
HISTORY_MSG_1167;Framing - Border (G)
|
||||
HISTORY_MSG_1168;Framing - Border (B)
|
||||
HISTORY_MSG_BLSHAPE;Blur by level
|
||||
HISTORY_MSG_BLURCWAV;Blur chroma
|
||||
HISTORY_MSG_BLURWAV;Blur luminance
|
||||
|
@ -1177,6 +1177,24 @@ enum ProcEventCode {
|
||||
Evlocallabsigjz = 1147,
|
||||
Evlocallabsigq = 1148,
|
||||
Evlocallablogcie = 1149,
|
||||
EvFramingEnabled = 1150,
|
||||
EvFramingMethod = 1151,
|
||||
EvFramingAspectRatio = 1152,
|
||||
EvFramingOrientation = 1153,
|
||||
EvFramingFramedWidth = 1154,
|
||||
EvFramingFramedHeight = 1155,
|
||||
EvFramingAllowUpscaling = 1156,
|
||||
EvFramingBorderSizingMethod = 1157,
|
||||
EvFramingBasis = 1158,
|
||||
EvFramingRelativeBorderSize = 1159,
|
||||
EvFramingMinSizeEnabled = 1160,
|
||||
EvFramingMinWidth = 1161,
|
||||
EvFramingMinHeight = 1162,
|
||||
EvFramingAbsWidth = 1163,
|
||||
EvFramingAbsHeight = 1164,
|
||||
EvFramingBorderRed = 1165,
|
||||
EvFramingBorderGreen = 1166,
|
||||
EvFramingBorderBlue = 1167,
|
||||
|
||||
NUMOFEVENTS
|
||||
};
|
||||
|
@ -2014,12 +2014,15 @@ struct FramingParams {
|
||||
SHORT // Use short side of image
|
||||
};
|
||||
|
||||
// Indicates to use the image aspect ratio for border
|
||||
static constexpr double AS_IMAGE_ASPECT_RATIO = 0.0;
|
||||
|
||||
FramingParams();
|
||||
|
||||
bool enabled;
|
||||
|
||||
FramingMethod framingMethod;
|
||||
double aspectRatio; // 0 - Use aspect ratio of image
|
||||
double aspectRatio;
|
||||
Orientation orientation;
|
||||
int framedWidth;
|
||||
int framedHeight;
|
||||
|
@ -1185,7 +1185,25 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
|
||||
AUTOEXP, //Evlocallabforcebw
|
||||
AUTOEXP, //Evlocallabsigjz
|
||||
AUTOEXP, //Evlocallabsigq
|
||||
AUTOEXP //Evlocallablogcie
|
||||
AUTOEXP, //Evlocallablogcie
|
||||
RESIZE, // EvFramingEnabled
|
||||
RESIZE, // EvFramingFramingMethod
|
||||
RESIZE, // EvFramingAspectRatio
|
||||
RESIZE, // EvFramingOrientation
|
||||
RESIZE, // EvFramingFramedWidth
|
||||
RESIZE, // EvFramingFramedHeight
|
||||
RESIZE, // EvFramingAllowUpscaling
|
||||
RESIZE, // EvFramingBorderSizingMethod
|
||||
RESIZE, // EvFramingBasis
|
||||
RESIZE, // EvFramingRelativeBorderSize
|
||||
RESIZE, // EvFramingMinSizeEnabled
|
||||
RESIZE, // EvFramingMinWidth
|
||||
RESIZE, // EvFramingMinHeight
|
||||
RESIZE, // EvFramingAbsWidth
|
||||
RESIZE, // EvFramingAbsHeight
|
||||
RESIZE, // EvFramingBorderRed
|
||||
RESIZE, // EvFramingBorderGreen
|
||||
RESIZE // EvFramingBorderBlue
|
||||
};
|
||||
|
||||
|
||||
|
102
rtgui/framing.cc
102
rtgui/framing.cc
@ -28,11 +28,13 @@
|
||||
#include "../rtengine/procparams.h"
|
||||
|
||||
#include <array>
|
||||
#include <iomanip>
|
||||
#include <vector>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
using namespace rtengine;
|
||||
using rtengine::procparams::FramingParams;
|
||||
|
||||
constexpr int EMPTY_COMBO_INDEX = -1;
|
||||
@ -257,7 +259,7 @@ public:
|
||||
|
||||
int findIndex(double aspectRatio) const
|
||||
{
|
||||
if (aspectRatio == 0) return INDEX_CURRENT;
|
||||
if (aspectRatio == FramingParams::AS_IMAGE_ASPECT_RATIO) return INDEX_CURRENT;
|
||||
|
||||
for (size_t i = 1; i < ratios.size(); i++) {
|
||||
if (ratios[i].value == aspectRatio) return i;
|
||||
@ -655,6 +657,19 @@ void Framing::setBatchMode(bool batchMode)
|
||||
ToolPanel::setBatchMode(batchMode);
|
||||
}
|
||||
|
||||
void Framing::enabledChanged()
|
||||
{
|
||||
if (listener) {
|
||||
if (get_inconsistent()) {
|
||||
listener->panelChanged(EvFramingEnabled, M("GENERAL_UNCHANGED"));
|
||||
} else if (getEnabled()) {
|
||||
listener->panelChanged(EvFramingEnabled, M("GENERAL_ENABLED"));
|
||||
} else {
|
||||
listener->panelChanged(EvFramingEnabled, M("GENERAL_DISABLED"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Framing::update(bool isCropped, int croppedWidth, int croppedHeight,
|
||||
int originalWidth, int originalHeight)
|
||||
{
|
||||
@ -734,65 +749,150 @@ void Framing::updateBorderSizeGui()
|
||||
|
||||
void Framing::adjusterChanged(Adjuster* adj, double newVal)
|
||||
{
|
||||
if (listener && (getEnabled() || batchMode)) {
|
||||
Glib::ustring costr;
|
||||
if (adj == relativeBorderSize) {
|
||||
costr = Glib::ustring::format(std::setw(3), std::fixed, std::setprecision(2),
|
||||
adj->getValue());
|
||||
} else {
|
||||
costr = Glib::ustring::format(static_cast<int>(adj->getValue()));
|
||||
}
|
||||
|
||||
if (adj == relativeBorderSize) {
|
||||
listener->panelChanged(EvFramingRelativeBorderSize, costr);
|
||||
} else if (adj == redAdj) {
|
||||
listener->panelChanged(EvFramingBorderRed, costr);
|
||||
} else if (adj == greenAdj) {
|
||||
listener->panelChanged(EvFramingBorderGreen, costr);
|
||||
} else if (adj == blueAdj) {
|
||||
listener->panelChanged(EvFramingBorderBlue, costr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Framing::onFramingMethodChanged()
|
||||
{
|
||||
updateFramingMethodGui();
|
||||
|
||||
if (listener && (getEnabled() || batchMode)) {
|
||||
listener->panelChanged(EvFramingMethod, framingMethod->get_active_text());
|
||||
}
|
||||
}
|
||||
|
||||
void Framing::onAspectRatioChanged()
|
||||
{
|
||||
if (listener && (getEnabled() || batchMode)) {
|
||||
listener->panelChanged(EvFramingAspectRatio, aspectRatio->get_active_text());
|
||||
}
|
||||
}
|
||||
|
||||
void Framing::onOrientationChanged()
|
||||
{
|
||||
if (listener && (getEnabled() || batchMode)) {
|
||||
listener->panelChanged(EvFramingOrientation, orientation->get_active_text());
|
||||
}
|
||||
}
|
||||
|
||||
void Framing::onWidthChanged()
|
||||
{
|
||||
width.isDirty = true;
|
||||
|
||||
if (listener && (getEnabled() || batchMode)) {
|
||||
listener->panelChanged(EvFramingFramedWidth,
|
||||
Glib::ustring::format(width.value->get_value_as_int()));
|
||||
}
|
||||
}
|
||||
|
||||
void Framing::onHeightChanged()
|
||||
{
|
||||
height.isDirty = true;
|
||||
|
||||
if (listener && (getEnabled() || batchMode)) {
|
||||
listener->panelChanged(EvFramingFramedHeight,
|
||||
Glib::ustring::format(height.value->get_value_as_int()));
|
||||
}
|
||||
}
|
||||
|
||||
void Framing::onAllowUpscalingToggled()
|
||||
{
|
||||
if (listener && (getEnabled() || batchMode)) {
|
||||
if (allowUpscaling->get_inconsistent()) {
|
||||
listener->panelChanged(EvFramingAllowUpscaling, M("GENERAL_UNCHANGED"));
|
||||
} else if (allowUpscaling->get_active()) {
|
||||
listener->panelChanged(EvFramingAllowUpscaling, M("GENERAL_ENABLED"));
|
||||
} else {
|
||||
listener->panelChanged(EvFramingAllowUpscaling, M("GENERAL_DISABLED"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Framing::onBorderSizeMethodChanged()
|
||||
{
|
||||
updateBorderSizeGui();
|
||||
|
||||
if (listener && (getEnabled() || batchMode)) {
|
||||
listener->panelChanged(EvFramingBorderSizingMethod, borderSizeMethod->get_active_text());
|
||||
}
|
||||
}
|
||||
|
||||
void Framing::onBasisChanged()
|
||||
{
|
||||
if (listener && (getEnabled() || batchMode)) {
|
||||
listener->panelChanged(EvFramingBasis, basis->get_active_text());
|
||||
}
|
||||
}
|
||||
|
||||
void Framing::onMinSizeToggled()
|
||||
{
|
||||
updateBorderSizeGui();
|
||||
|
||||
if (listener && (getEnabled() || batchMode)) {
|
||||
if (minSizeEnabled->get_inconsistent()) {
|
||||
listener->panelChanged(EvFramingMinSizeEnabled, M("GENERAL_UNCHANGED"));
|
||||
} else if (minSizeEnabled->get_active()) {
|
||||
listener->panelChanged(EvFramingMinSizeEnabled, M("GENERAL_ENABLED"));
|
||||
} else {
|
||||
listener->panelChanged(EvFramingMinSizeEnabled, M("GENERAL_DISABLED"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Framing::onMinWidthChanged()
|
||||
{
|
||||
minWidth.isDirty = true;
|
||||
|
||||
if (listener && (getEnabled() || batchMode)) {
|
||||
listener->panelChanged(EvFramingMinWidth,
|
||||
Glib::ustring::format(minWidth.value->get_value_as_int()));
|
||||
}
|
||||
}
|
||||
|
||||
void Framing::onMinHeightChanged()
|
||||
{
|
||||
minHeight.isDirty = true;
|
||||
|
||||
if (listener && (getEnabled() || batchMode)) {
|
||||
listener->panelChanged(EvFramingMinHeight,
|
||||
Glib::ustring::format(minHeight.value->get_value_as_int()));
|
||||
}
|
||||
}
|
||||
|
||||
void Framing::onAbsWidthChanged()
|
||||
{
|
||||
absWidth.isDirty = true;
|
||||
|
||||
if (listener && (getEnabled() || batchMode)) {
|
||||
listener->panelChanged(EvFramingAbsWidth,
|
||||
Glib::ustring::format(absWidth.value->get_value_as_int()));
|
||||
}
|
||||
}
|
||||
|
||||
void Framing::onAbsHeightChanged()
|
||||
{
|
||||
absHeight.isDirty = true;
|
||||
|
||||
if (listener && (getEnabled() || batchMode)) {
|
||||
listener->panelChanged(EvFramingAbsHeight,
|
||||
Glib::ustring::format(absHeight.value->get_value_as_int()));
|
||||
}
|
||||
}
|
@ -38,6 +38,7 @@ public:
|
||||
Framing();
|
||||
~Framing();
|
||||
|
||||
// FoldableToolPanel
|
||||
void read(const rtengine::procparams::ProcParams* pp,
|
||||
const ParamsEdited* pedited = nullptr) override;
|
||||
void write(rtengine::procparams::ProcParams* pp,
|
||||
@ -45,6 +46,7 @@ public:
|
||||
void setDefaults(const rtengine::procparams::ProcParams* defParams,
|
||||
const ParamsEdited* pedited = nullptr) override;
|
||||
void setBatchMode(bool batchMode) override;
|
||||
void enabledChanged() override;
|
||||
|
||||
void update(bool isCropped, int croppedWidth, int croppedHeight,
|
||||
int originalWidth = 0, int originalHeight = 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user