Convert almost all IdleRegister::add()
calls to add(std::function<>)
This commit is contained in:
parent
5af3f64a9d
commit
b08fb04dae
@ -39,25 +39,6 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace rtengine;
|
using namespace rtengine;
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
|
|
||||||
struct NLParams {
|
|
||||||
BatchQueueListener* listener;
|
|
||||||
int qsize;
|
|
||||||
bool queueRunning;
|
|
||||||
bool queueError;
|
|
||||||
Glib::ustring queueErrorMessage;
|
|
||||||
};
|
|
||||||
|
|
||||||
bool bqnotifylistenerUI(NLParams* params)
|
|
||||||
{
|
|
||||||
params->listener->queueSizeChanged (params->qsize, params->queueRunning, params->queueError, params->queueErrorMessage);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
BatchQueue::BatchQueue (FileCatalog* aFileCatalog) : processing(nullptr), fileCatalog(aFileCatalog), sequence(0), listener(nullptr)
|
BatchQueue::BatchQueue (FileCatalog* aFileCatalog) : processing(nullptr), fileCatalog(aFileCatalog), sequence(0), listener(nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -606,14 +587,13 @@ void BatchQueue::setProgress(double p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// No need to acquire the GUI, setProgressUI will do it
|
// No need to acquire the GUI, setProgressUI will do it
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](BatchQueue* bq) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
bq->redraw();
|
redraw();
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<BatchQueue>(func, this, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BatchQueue::setProgressStr(const Glib::ustring& str)
|
void BatchQueue::setProgressStr(const Glib::ustring& str)
|
||||||
@ -638,12 +618,15 @@ void BatchQueue::error(const Glib::ustring& descr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (listener) {
|
if (listener) {
|
||||||
NLParams* params = new NLParams;
|
BatchQueueListener* const bql = listener;
|
||||||
params->listener = listener;
|
|
||||||
params->queueRunning = false;
|
idle_register.add(
|
||||||
params->queueError = true;
|
[bql, descr]() -> bool
|
||||||
params->queueErrorMessage = descr;
|
{
|
||||||
idle_register.add<NLParams>(bqnotifylistenerUI, params, true);
|
bql->queueSizeChanged(0, false, true, descr);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -974,15 +957,21 @@ void BatchQueue::notifyListener ()
|
|||||||
{
|
{
|
||||||
const bool queueRunning = processing;
|
const bool queueRunning = processing;
|
||||||
if (listener) {
|
if (listener) {
|
||||||
NLParams* params = new NLParams;
|
BatchQueueListener* const bql = listener;
|
||||||
params->listener = listener;
|
|
||||||
|
int qsize = 0;
|
||||||
{
|
{
|
||||||
MYREADERLOCK(l, entryRW);
|
MYREADERLOCK(l, entryRW);
|
||||||
params->qsize = fd.size();
|
qsize = fd.size();
|
||||||
}
|
}
|
||||||
params->queueRunning = queueRunning;
|
|
||||||
params->queueError = false;
|
idle_register.add(
|
||||||
idle_register.add<NLParams>(bqnotifylistenerUI, params, true);
|
[bql, qsize, queueRunning]() -> bool
|
||||||
|
{
|
||||||
|
bql->queueSizeChanged(qsize, queueRunning, false, {});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,14 +172,14 @@ BatchQueuePanel::BatchQueuePanel (FileCatalog* aFileCatalog) : parent(nullptr)
|
|||||||
show_all ();
|
show_all ();
|
||||||
|
|
||||||
if (batchQueue->loadBatchQueue()) {
|
if (batchQueue->loadBatchQueue()) {
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](BatchQueue* bq) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
bq->resizeLoadedQueue();
|
batchQueue->resizeLoadedQueue();
|
||||||
return false;
|
return false;
|
||||||
};
|
},
|
||||||
|
G_PRIORITY_LOW
|
||||||
idle_register.add<BatchQueue>(func, batchQueue, false, G_PRIORITY_LOW);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,14 +375,13 @@ void BlackWhite::BWChanged (double redbw, double greenbw, double bluebw)
|
|||||||
nextgreenbw = greenbw;
|
nextgreenbw = greenbw;
|
||||||
nextbluebw = bluebw;
|
nextbluebw = bluebw;
|
||||||
|
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](BlackWhite* self) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
self->BWComputed_();
|
BWComputed_();
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<BlackWhite>(func, this, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlackWhite::BWComputed_ ()
|
bool BlackWhite::BWComputed_ ()
|
||||||
|
@ -891,17 +891,16 @@ void ColorToning::autoColorTonChanged(int bwct, int satthres, int satprot)
|
|||||||
nextsatth = satthres;
|
nextsatth = satthres;
|
||||||
nextsatpr = satprot;
|
nextsatpr = satprot;
|
||||||
|
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](ColorToning* self) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
self->disableListener();
|
disableListener();
|
||||||
self->saturatedOpacity->setValue(self->nextsatpr);
|
saturatedOpacity->setValue(nextsatpr);
|
||||||
self->satProtectionThreshold->setValue(self->nextsatth);
|
satProtectionThreshold->setValue(nextsatth);
|
||||||
self->enableListener();
|
enableListener();
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<ColorToning>(func, this, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorToning::adjusterChanged (ThresholdAdjuster* a, double newBottom, double newTop)
|
void ColorToning::adjusterChanged (ThresholdAdjuster* a, double newBottom, double newTop)
|
||||||
|
198
rtgui/crop.cc
198
rtgui/crop.cc
@ -28,29 +28,6 @@ extern Options options;
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
class RefreshSpinHelper
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
Crop* crop;
|
|
||||||
bool notify;
|
|
||||||
RefreshSpinHelper (Crop* _crop, bool _notify)
|
|
||||||
: crop(_crop), notify(_notify) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
bool refreshSpinsUI(RefreshSpinHelper* rsh)
|
|
||||||
{
|
|
||||||
rsh->crop->refreshSpins(rsh->notify);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool notifyListenerUI(Crop* self)
|
|
||||||
{
|
|
||||||
self->notifyListener();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline void get_custom_ratio(int w, int h, double &rw, double &rh)
|
inline void get_custom_ratio(int w, int h, double &rw, double &rh)
|
||||||
{
|
{
|
||||||
if (w < h) {
|
if (w < h) {
|
||||||
@ -589,7 +566,13 @@ void Crop::doresetCrop ()
|
|||||||
int W = maxw;
|
int W = maxw;
|
||||||
int H = maxh;
|
int H = maxh;
|
||||||
cropResized (X, Y, W, H);
|
cropResized (X, Y, W, H);
|
||||||
idle_register.add<Crop>(notifyListenerUI, this, false);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
notifyListener();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
refreshSpins();
|
refreshSpins();
|
||||||
}
|
}
|
||||||
@ -628,13 +611,25 @@ void Crop::enabledChanged ()
|
|||||||
void Crop::hFlipCrop ()
|
void Crop::hFlipCrop ()
|
||||||
{
|
{
|
||||||
nx = maxw - nx - nw;
|
nx = maxw - nx - nw;
|
||||||
idle_register.add<RefreshSpinHelper>(refreshSpinsUI, new RefreshSpinHelper(this, false), true);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
refreshSpins(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Crop::vFlipCrop ()
|
void Crop::vFlipCrop ()
|
||||||
{
|
{
|
||||||
ny = maxh - ny - nh;
|
ny = maxh - ny - nh;
|
||||||
idle_register.add<RefreshSpinHelper>(refreshSpinsUI, new RefreshSpinHelper(this, false), true);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
refreshSpins(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Crop::rotateCrop (int deg, bool hflip, bool vflip)
|
void Crop::rotateCrop (int deg, bool hflip, bool vflip)
|
||||||
@ -674,7 +669,13 @@ void Crop::rotateCrop (int deg, bool hflip, bool vflip)
|
|||||||
}
|
}
|
||||||
|
|
||||||
lastRotationDeg = deg;
|
lastRotationDeg = deg;
|
||||||
idle_register.add<RefreshSpinHelper>(refreshSpinsUI, new RefreshSpinHelper(this, false), true);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
refreshSpins(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Crop::positionChanged ()
|
void Crop::positionChanged ()
|
||||||
@ -688,7 +689,13 @@ void Crop::positionChanged ()
|
|||||||
int W = nw;
|
int W = nw;
|
||||||
int H = nh;
|
int H = nh;
|
||||||
cropMoved (X, Y, W, H);
|
cropMoved (X, Y, W, H);
|
||||||
idle_register.add<Crop>(notifyListenerUI, this, false);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
notifyListener();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Crop::widthChanged ()
|
void Crop::widthChanged ()
|
||||||
@ -701,7 +708,13 @@ void Crop::widthChanged ()
|
|||||||
int W = (int)w->get_value ();
|
int W = (int)w->get_value ();
|
||||||
int H = nh;
|
int H = nh;
|
||||||
cropWidth2Resized (X, Y, W, H);
|
cropWidth2Resized (X, Y, W, H);
|
||||||
idle_register.add<Crop>(notifyListenerUI, this, false);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
notifyListener();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Crop::heightChanged ()
|
void Crop::heightChanged ()
|
||||||
@ -714,7 +727,13 @@ void Crop::heightChanged ()
|
|||||||
int W = nw;
|
int W = nw;
|
||||||
int H = (int)h->get_value ();
|
int H = (int)h->get_value ();
|
||||||
cropHeight2Resized (X, Y, W, H);
|
cropHeight2Resized (X, Y, W, H);
|
||||||
idle_register.add<Crop>(notifyListenerUI, this, false);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
notifyListener();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fixed ratio toggle button
|
// Fixed ratio toggle button
|
||||||
@ -808,7 +827,13 @@ void Crop::adjustCropToRatio()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This will save the options
|
// This will save the options
|
||||||
idle_register.add<RefreshSpinHelper>(refreshSpinsUI, new RefreshSpinHelper(this, true), true);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
refreshSpins(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Crop::refreshSize ()
|
void Crop::refreshSize ()
|
||||||
@ -882,26 +907,13 @@ void Crop::setDimensions (int mw, int mh)
|
|||||||
|
|
||||||
void Crop::sizeChanged(int x, int y, int ow, int oh)
|
void Crop::sizeChanged(int x, int y, int ow, int oh)
|
||||||
{
|
{
|
||||||
struct Params {
|
idle_register.add(
|
||||||
Crop* crop;
|
[this, x, y]() -> bool
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
};
|
|
||||||
|
|
||||||
Params* const params = new Params{
|
|
||||||
this,
|
|
||||||
x,
|
|
||||||
y
|
|
||||||
};
|
|
||||||
|
|
||||||
const auto func =
|
|
||||||
[](Params* params) -> bool
|
|
||||||
{
|
{
|
||||||
params->crop->setDimensions(params->x, params->y);
|
setDimensions(x, y);
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<Params>(func, params, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Crop::refreshSpins (bool notify)
|
bool Crop::refreshSpins (bool notify)
|
||||||
@ -969,7 +981,13 @@ void Crop::cropMoved (int &X, int &Y, int &W, int &H)
|
|||||||
nw = W;
|
nw = W;
|
||||||
nh = H;
|
nh = H;
|
||||||
|
|
||||||
idle_register.add<RefreshSpinHelper>(refreshSpinsUI, new RefreshSpinHelper(this, false), true);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
refreshSpins(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
// Glib::signal_idle().connect (sigc::mem_fun(*this, &Crop::refreshSpins));
|
// Glib::signal_idle().connect (sigc::mem_fun(*this, &Crop::refreshSpins));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1013,7 +1031,13 @@ void Crop::cropWidth1Resized (int &X, int &Y, int &W, int &H, float custom_ratio
|
|||||||
nw = W;
|
nw = W;
|
||||||
nh = H;
|
nh = H;
|
||||||
|
|
||||||
idle_register.add<RefreshSpinHelper>(refreshSpinsUI, new RefreshSpinHelper(this, false), true);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
refreshSpins(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Crop::cropWidth2Resized (int &X, int &Y, int &W, int &H, float custom_ratio)
|
void Crop::cropWidth2Resized (int &X, int &Y, int &W, int &H, float custom_ratio)
|
||||||
@ -1053,7 +1077,13 @@ void Crop::cropWidth2Resized (int &X, int &Y, int &W, int &H, float custom_ratio
|
|||||||
nw = W;
|
nw = W;
|
||||||
nh = H;
|
nh = H;
|
||||||
|
|
||||||
idle_register.add<RefreshSpinHelper>(refreshSpinsUI, new RefreshSpinHelper(this, false), true);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
refreshSpins(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Crop::cropHeight1Resized (int &X, int &Y, int &W, int &H, float custom_ratio)
|
void Crop::cropHeight1Resized (int &X, int &Y, int &W, int &H, float custom_ratio)
|
||||||
@ -1096,7 +1126,13 @@ void Crop::cropHeight1Resized (int &X, int &Y, int &W, int &H, float custom_rati
|
|||||||
nw = W;
|
nw = W;
|
||||||
nh = H;
|
nh = H;
|
||||||
|
|
||||||
idle_register.add<RefreshSpinHelper>(refreshSpinsUI, new RefreshSpinHelper(this, false), true);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
refreshSpins(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Crop::cropHeight2Resized (int &X, int &Y, int &W, int &H, float custom_ratio)
|
void Crop::cropHeight2Resized (int &X, int &Y, int &W, int &H, float custom_ratio)
|
||||||
@ -1136,7 +1172,13 @@ void Crop::cropHeight2Resized (int &X, int &Y, int &W, int &H, float custom_rati
|
|||||||
nw = W;
|
nw = W;
|
||||||
nh = H;
|
nh = H;
|
||||||
|
|
||||||
idle_register.add<RefreshSpinHelper>(refreshSpinsUI, new RefreshSpinHelper(this, false), true);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
refreshSpins(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Crop::cropTopLeftResized (int &X, int &Y, int &W, int &H, float custom_ratio)
|
void Crop::cropTopLeftResized (int &X, int &Y, int &W, int &H, float custom_ratio)
|
||||||
@ -1178,7 +1220,13 @@ void Crop::cropTopLeftResized (int &X, int &Y, int &W, int &H, float custom_rati
|
|||||||
nw = W;
|
nw = W;
|
||||||
nh = H;
|
nh = H;
|
||||||
|
|
||||||
idle_register.add<RefreshSpinHelper>(refreshSpinsUI, new RefreshSpinHelper(this, false), true);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
refreshSpins(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Crop::cropTopRightResized (int &X, int &Y, int &W, int &H, float custom_ratio)
|
void Crop::cropTopRightResized (int &X, int &Y, int &W, int &H, float custom_ratio)
|
||||||
@ -1218,7 +1266,13 @@ void Crop::cropTopRightResized (int &X, int &Y, int &W, int &H, float custom_rat
|
|||||||
nw = W;
|
nw = W;
|
||||||
nh = H;
|
nh = H;
|
||||||
|
|
||||||
idle_register.add<RefreshSpinHelper>(refreshSpinsUI, new RefreshSpinHelper(this, false), true);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
refreshSpins(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Crop::cropBottomLeftResized (int &X, int &Y, int &W, int &H, float custom_ratio)
|
void Crop::cropBottomLeftResized (int &X, int &Y, int &W, int &H, float custom_ratio)
|
||||||
@ -1258,7 +1312,13 @@ void Crop::cropBottomLeftResized (int &X, int &Y, int &W, int &H, float custom_r
|
|||||||
nw = W;
|
nw = W;
|
||||||
nh = H;
|
nh = H;
|
||||||
|
|
||||||
idle_register.add<RefreshSpinHelper>(refreshSpinsUI, new RefreshSpinHelper(this, false), true);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
refreshSpins(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Crop::cropBottomRightResized (int &X, int &Y, int &W, int &H, float custom_ratio)
|
void Crop::cropBottomRightResized (int &X, int &Y, int &W, int &H, float custom_ratio)
|
||||||
@ -1295,7 +1355,13 @@ void Crop::cropBottomRightResized (int &X, int &Y, int &W, int &H, float custom_
|
|||||||
nw = W;
|
nw = W;
|
||||||
nh = H;
|
nh = H;
|
||||||
|
|
||||||
idle_register.add<RefreshSpinHelper>(refreshSpinsUI, new RefreshSpinHelper(this, false), true);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
refreshSpins(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Crop::cropInit (int &x, int &y, int &w, int &h)
|
void Crop::cropInit (int &x, int &y, int &w, int &h)
|
||||||
@ -1409,12 +1475,24 @@ void Crop::cropResized (int &x, int &y, int& x2, int& y2)
|
|||||||
nw = W;
|
nw = W;
|
||||||
nh = H;
|
nh = H;
|
||||||
|
|
||||||
idle_register.add<RefreshSpinHelper>(refreshSpinsUI, new RefreshSpinHelper(this, false), true);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
refreshSpins(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Crop::cropManipReady ()
|
void Crop::cropManipReady ()
|
||||||
{
|
{
|
||||||
idle_register.add<Crop>(notifyListenerUI, this, false);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
notifyListener();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
double Crop::getRatio () const
|
double Crop::getRatio () const
|
||||||
|
@ -338,70 +338,69 @@ void CropHandler::setDetailedCrop(
|
|||||||
bool expected = false;
|
bool expected = false;
|
||||||
|
|
||||||
if (redraw_needed.compare_exchange_strong(expected, true)) {
|
if (redraw_needed.compare_exchange_strong(expected, true)) {
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](CropHandler* self) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
self->cimg.lock ();
|
cimg.lock ();
|
||||||
|
|
||||||
if (self->redraw_needed.exchange(false)) {
|
if (redraw_needed.exchange(false)) {
|
||||||
self->cropPixbuf.clear ();
|
cropPixbuf.clear ();
|
||||||
|
|
||||||
if (!self->enabled) {
|
if (!enabled) {
|
||||||
self->cropimg.clear();
|
cropimg.clear();
|
||||||
self->cropimgtrue.clear();
|
cropimgtrue.clear();
|
||||||
self->cimg.unlock ();
|
cimg.unlock ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self->cropimg.empty()) {
|
if (!cropimg.empty()) {
|
||||||
if (self->cix == self->cropX && self->ciy == self->cropY && self->ciw == self->cropW && self->cih == self->cropH && self->cis == (self->zoom >= 1000 ? 1 : self->zoom / 10)) {
|
if (cix == cropX && ciy == cropY && ciw == cropW && cih == cropH && cis == (zoom >= 1000 ? 1 : zoom / 10)) {
|
||||||
// calculate final image size
|
// calculate final image size
|
||||||
float czoom = self->zoom >= 1000 ?
|
float czoom = zoom >= 1000 ?
|
||||||
self->zoom / 1000.f :
|
zoom / 1000.f :
|
||||||
float((self->zoom/10) * 10) / float(self->zoom);
|
float((zoom/10) * 10) / float(zoom);
|
||||||
int imw = self->cropimg_width * czoom;
|
int imw = cropimg_width * czoom;
|
||||||
int imh = self->cropimg_height * czoom;
|
int imh = cropimg_height * czoom;
|
||||||
|
|
||||||
if (imw > self->ww) {
|
if (imw > ww) {
|
||||||
imw = self->ww;
|
imw = ww;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imh > self->wh) {
|
if (imh > wh) {
|
||||||
imh = self->wh;
|
imh = wh;
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::RefPtr<Gdk::Pixbuf> tmpPixbuf = Gdk::Pixbuf::create_from_data (self->cropimg.data(), Gdk::COLORSPACE_RGB, false, 8, self->cropimg_width, self->cropimg_height, 3 * self->cropimg_width);
|
Glib::RefPtr<Gdk::Pixbuf> tmpPixbuf = Gdk::Pixbuf::create_from_data (cropimg.data(), Gdk::COLORSPACE_RGB, false, 8, cropimg_width, cropimg_height, 3 * cropimg_width);
|
||||||
self->cropPixbuf = Gdk::Pixbuf::create (Gdk::COLORSPACE_RGB, false, 8, imw, imh);
|
cropPixbuf = Gdk::Pixbuf::create (Gdk::COLORSPACE_RGB, false, 8, imw, imh);
|
||||||
tmpPixbuf->scale (self->cropPixbuf, 0, 0, imw, imh, 0, 0, czoom, czoom, Gdk::INTERP_TILES);
|
tmpPixbuf->scale (cropPixbuf, 0, 0, imw, imh, 0, 0, czoom, czoom, Gdk::INTERP_TILES);
|
||||||
tmpPixbuf.clear ();
|
tmpPixbuf.clear ();
|
||||||
|
|
||||||
Glib::RefPtr<Gdk::Pixbuf> tmpPixbuftrue = Gdk::Pixbuf::create_from_data (self->cropimgtrue.data(), Gdk::COLORSPACE_RGB, false, 8, self->cropimg_width, self->cropimg_height, 3 * self->cropimg_width);
|
Glib::RefPtr<Gdk::Pixbuf> tmpPixbuftrue = Gdk::Pixbuf::create_from_data (cropimgtrue.data(), Gdk::COLORSPACE_RGB, false, 8, cropimg_width, cropimg_height, 3 * cropimg_width);
|
||||||
self->cropPixbuftrue = Gdk::Pixbuf::create (Gdk::COLORSPACE_RGB, false, 8, imw, imh);
|
cropPixbuftrue = Gdk::Pixbuf::create (Gdk::COLORSPACE_RGB, false, 8, imw, imh);
|
||||||
tmpPixbuftrue->scale (self->cropPixbuftrue, 0, 0, imw, imh, 0, 0, czoom, czoom, Gdk::INTERP_TILES);
|
tmpPixbuftrue->scale (cropPixbuftrue, 0, 0, imw, imh, 0, 0, czoom, czoom, Gdk::INTERP_TILES);
|
||||||
tmpPixbuftrue.clear ();
|
tmpPixbuftrue.clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
self->cropimg.clear();
|
cropimg.clear();
|
||||||
self->cropimgtrue.clear();
|
cropimgtrue.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
self->cimg.unlock ();
|
cimg.unlock ();
|
||||||
|
|
||||||
if (self->displayHandler) {
|
if (displayHandler) {
|
||||||
self->displayHandler->cropImageUpdated ();
|
displayHandler->cropImageUpdated ();
|
||||||
|
|
||||||
if (self->initial.exchange(false)) {
|
if (initial.exchange(false)) {
|
||||||
self->displayHandler->initialImageArrived ();
|
displayHandler->initialImageArrived ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self->cimg.unlock();
|
cimg.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<CropHandler>(func, this, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,19 +289,18 @@ void DirPyrDenoise::chromaChanged (double autchroma, double autred, double autbl
|
|||||||
nextred = autred;
|
nextred = autred;
|
||||||
nextblue = autblue;
|
nextblue = autblue;
|
||||||
|
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](DirPyrDenoise* self) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
self->disableListener();
|
disableListener();
|
||||||
self->chroma->setValue(self->nextchroma);
|
chroma->setValue(nextchroma);
|
||||||
self->redchro->setValue(self->nextred);
|
redchro->setValue(nextred);
|
||||||
self->bluechro->setValue(self->nextblue);
|
bluechro->setValue(nextblue);
|
||||||
self->enableListener();
|
enableListener();
|
||||||
self->updateNoiseLabel();
|
updateNoiseLabel();
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<DirPyrDenoise>(func, this, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirPyrDenoise::noiseTilePrev (int tileX, int tileY, int prevX, int prevY, int sizeT, int sizeP)
|
void DirPyrDenoise::noiseTilePrev (int tileX, int tileY, int prevX, int prevY, int sizeT, int sizeP)
|
||||||
@ -313,17 +312,16 @@ void DirPyrDenoise::noiseTilePrev (int tileX, int tileY, int prevX, int prevY, i
|
|||||||
nextsizeT = sizeT;
|
nextsizeT = sizeT;
|
||||||
nextsizeP = sizeP;
|
nextsizeP = sizeP;
|
||||||
|
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](DirPyrDenoise* self) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
self->disableListener();
|
disableListener();
|
||||||
self->enableListener();
|
enableListener();
|
||||||
self->updateTileLabel();
|
updateTileLabel();
|
||||||
self->updatePrevLabel();
|
updatePrevLabel();
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<DirPyrDenoise>(func, this, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirPyrDenoise::updateTileLabel ()
|
void DirPyrDenoise::updateTileLabel ()
|
||||||
@ -361,16 +359,18 @@ void DirPyrDenoise::updatePrevLabel ()
|
|||||||
|
|
||||||
void DirPyrDenoise::noiseChanged (double nresid, double highresid)
|
void DirPyrDenoise::noiseChanged (double nresid, double highresid)
|
||||||
{
|
{
|
||||||
const auto func =
|
nextnresid = nresid;
|
||||||
[](DirPyrDenoise* self) -> bool
|
nexthighresid = highresid;
|
||||||
{
|
|
||||||
self->disableListener();
|
|
||||||
self->enableListener();
|
|
||||||
self->updateNoiseLabel();
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
idle_register.add<DirPyrDenoise>(func, this, false);
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
disableListener();
|
||||||
|
enableListener();
|
||||||
|
updateNoiseLabel();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirPyrDenoise::updateNoiseLabel()
|
void DirPyrDenoise::updateNoiseLabel()
|
||||||
|
@ -38,34 +38,15 @@ using namespace rtengine::procparams;
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
struct spparams {
|
void setprogressStrUI(double val, const Glib::ustring str, MyProgressBar* pProgress)
|
||||||
double val;
|
|
||||||
Glib::ustring str;
|
|
||||||
MyProgressBar *pProgress;
|
|
||||||
Glib::RefPtr<Gtk::CssProvider> cssProvider;
|
|
||||||
};
|
|
||||||
|
|
||||||
bool setprogressStrUI(spparams* s)
|
|
||||||
{
|
{
|
||||||
if ( ! s->str.empty() ) {
|
if (!str.empty()) {
|
||||||
s->pProgress->set_text ( M (s->str) );
|
pProgress->set_text(M(str));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( s->val >= 0 ) {
|
if (val >= 0.0) {
|
||||||
s->pProgress->set_fraction ( s->val );
|
pProgress->set_fraction(val);
|
||||||
|
|
||||||
if (s->cssProvider) {
|
|
||||||
if ( s->val < 1.0 ) {
|
|
||||||
s->cssProvider->load_from_data ("ProgressBar { background-color: red }");
|
|
||||||
} else {
|
|
||||||
s->cssProvider->load_from_data ("ProgressBar { background-color: grey }");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s->pProgress->get_style_context()->set_background (s->pProgress->get_window());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1186,19 +1167,28 @@ void EditorPanel::clearParamChanges()
|
|||||||
|
|
||||||
void EditorPanel::setProgress(double p)
|
void EditorPanel::setProgress(double p)
|
||||||
{
|
{
|
||||||
spparams *s = new spparams;
|
MyProgressBar* const pl = progressLabel;
|
||||||
s->val = p;
|
|
||||||
s->pProgress = progressLabel;
|
idle_register.add(
|
||||||
idle_register.add<spparams>(setprogressStrUI, s, true);
|
[p, pl]() -> bool
|
||||||
|
{
|
||||||
|
setprogressStrUI(p, {}, pl);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorPanel::setProgressStr(const Glib::ustring& str)
|
void EditorPanel::setProgressStr(const Glib::ustring& str)
|
||||||
{
|
{
|
||||||
spparams *s = new spparams;
|
MyProgressBar* const pl = progressLabel;
|
||||||
s->str = str;
|
|
||||||
s->val = -1;
|
idle_register.add(
|
||||||
s->pProgress = progressLabel;
|
[str, pl]() -> bool
|
||||||
idle_register.add<spparams>(setprogressStrUI, s, true);
|
{
|
||||||
|
setprogressStrUI(-1.0, str, pl);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorPanel::setProgressState(bool inProcessing)
|
void EditorPanel::setProgressState(bool inProcessing)
|
||||||
@ -1243,39 +1233,27 @@ void EditorPanel::error(const Glib::ustring& descr)
|
|||||||
|
|
||||||
void EditorPanel::error(const Glib::ustring& title, const Glib::ustring& descr)
|
void EditorPanel::error(const Glib::ustring& title, const Glib::ustring& descr)
|
||||||
{
|
{
|
||||||
struct errparams {
|
|
||||||
Glib::ustring descr;
|
|
||||||
Glib::ustring title;
|
|
||||||
EditorPanelIdleHelper* epih;
|
|
||||||
};
|
|
||||||
|
|
||||||
epih->pending++;
|
epih->pending++;
|
||||||
errparams* const p = new errparams;
|
|
||||||
p->descr = descr;
|
|
||||||
p->title = title;
|
|
||||||
p->epih = epih;
|
|
||||||
|
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](errparams* p) -> bool
|
[this, descr, title]() -> bool
|
||||||
{
|
{
|
||||||
if (p->epih->destroyed)
|
if (epih->destroyed) {
|
||||||
{
|
if (epih->pending == 1) {
|
||||||
if (p->epih->pending == 1) {
|
delete epih;
|
||||||
delete p->epih;
|
|
||||||
} else {
|
} else {
|
||||||
p->epih->pending--;
|
--epih->pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
p->epih->epanel->displayError (p->title, p->descr);
|
epih->epanel->displayError(title, descr);
|
||||||
p->epih->pending--;
|
--epih->pending;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<errparams>(func, p, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorPanel::displayError(const Glib::ustring& title, const Glib::ustring& descr)
|
void EditorPanel::displayError(const Glib::ustring& title, const Glib::ustring& descr)
|
||||||
@ -1296,16 +1274,16 @@ void EditorPanel::displayError(const Glib::ustring& title, const Glib::ustring&
|
|||||||
// This is only called from the ThreadUI, so within the gtk thread
|
// This is only called from the ThreadUI, so within the gtk thread
|
||||||
void EditorPanel::refreshProcessingState (bool inProcessingP)
|
void EditorPanel::refreshProcessingState (bool inProcessingP)
|
||||||
{
|
{
|
||||||
spparams *s = new spparams;
|
double val;
|
||||||
s->pProgress = progressLabel;
|
Glib::ustring str;
|
||||||
|
|
||||||
if (inProcessingP) {
|
if (inProcessingP) {
|
||||||
if (processingStartedTime == 0) {
|
if (processingStartedTime == 0) {
|
||||||
processingStartedTime = ::time (nullptr);
|
processingStartedTime = ::time (nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
s->str = "PROGRESSBAR_PROCESSING";
|
val = 1.0;
|
||||||
s->val = 1.0;
|
str = "PROGRESSBAR_PROCESSING";
|
||||||
} else {
|
} else {
|
||||||
// Set proc params of thumbnail. It saves it into the cache and updates the file browser.
|
// Set proc params of thumbnail. It saves it into the cache and updates the file browser.
|
||||||
if (ipc && openThm && tpc->getChangedState()) {
|
if (ipc && openThm && tpc->getChangedState()) {
|
||||||
@ -1326,8 +1304,8 @@ void EditorPanel::refreshProcessingState (bool inProcessingP)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set progress bar "done"
|
// Set progress bar "done"
|
||||||
s->str = "PROGRESSBAR_READY";
|
val = 0.0;
|
||||||
s->val = 0.0;
|
str = "PROGRESSBAR_READY";
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
@ -1342,7 +1320,7 @@ void EditorPanel::refreshProcessingState (bool inProcessingP)
|
|||||||
|
|
||||||
isProcessing = inProcessingP;
|
isProcessing = inProcessingP;
|
||||||
|
|
||||||
setprogressStrUI (s);
|
setprogressStrUI(val, str, progressLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorPanel::info_toggled ()
|
void EditorPanel::info_toggled ()
|
||||||
|
@ -1925,21 +1925,15 @@ void FileBrowser::openNextPreviousEditorImage (Glib::ustring fname, eRTNav nextP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBrowser::_thumbRearrangementNeeded ()
|
|
||||||
{
|
|
||||||
refreshThumbImages (); // arrangeFiles is NOT enough
|
|
||||||
}
|
|
||||||
|
|
||||||
void FileBrowser::thumbRearrangementNeeded ()
|
void FileBrowser::thumbRearrangementNeeded ()
|
||||||
{
|
{
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](FileBrowser* self) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
self->_thumbRearrangementNeeded();
|
refreshThumbImages();// arrangeFiles is NOT enough
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<FileBrowser>(func, this, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBrowser::selectionChanged ()
|
void FileBrowser::selectionChanged ()
|
||||||
|
@ -192,7 +192,6 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void thumbRearrangementNeeded () override;
|
void thumbRearrangementNeeded () override;
|
||||||
void _thumbRearrangementNeeded ();
|
|
||||||
|
|
||||||
void selectionChanged () override;
|
void selectionChanged () override;
|
||||||
|
|
||||||
|
@ -855,14 +855,13 @@ void FileCatalog::previewsFinished (int dir_id)
|
|||||||
currentEFS = dirEFS;
|
currentEFS = dirEFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](FileCatalog* self) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
self->previewsFinishedUI();
|
previewsFinishedUI();
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<FileCatalog>(func, this, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileCatalog::setEnabled (bool e)
|
void FileCatalog::setEnabled (bool e)
|
||||||
@ -901,10 +900,9 @@ void FileCatalog::refreshHeight ()
|
|||||||
set_size_request(0, newHeight + 2); // HOMBRE: yeah, +2, there's always 2 pixels missing... sorry for this dirty hack O:)
|
set_size_request(0, newHeight + 2); // HOMBRE: yeah, +2, there's always 2 pixels missing... sorry for this dirty hack O:)
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileCatalog::_openImage (std::vector<Thumbnail*> tmb)
|
void FileCatalog::_openImage(const std::vector<Thumbnail*>& tmb)
|
||||||
{
|
{
|
||||||
|
if (enabled && listener) {
|
||||||
if (enabled && listener != nullptr) {
|
|
||||||
bool continueToLoad = true;
|
bool continueToLoad = true;
|
||||||
|
|
||||||
for (size_t i = 0; i < tmb.size() && continueToLoad; i++) {
|
for (size_t i = 0; i < tmb.size() && continueToLoad; i++) {
|
||||||
@ -919,40 +917,30 @@ void FileCatalog::_openImage (std::vector<Thumbnail*> tmb)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FCOIParams {
|
|
||||||
FileCatalog* catalog;
|
|
||||||
std::vector<Thumbnail*> tmb;
|
|
||||||
};
|
|
||||||
|
|
||||||
bool openRequestedUI(FCOIParams* params)
|
|
||||||
{
|
|
||||||
params->catalog->_openImage (params->tmb);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FileCatalog::filterApplied()
|
void FileCatalog::filterApplied()
|
||||||
{
|
{
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](FileCatalog* self) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
self->_refreshProgressBar();
|
_refreshProgressBar();
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<FileCatalog>(func, this, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileCatalog::openRequested(const std::vector<Thumbnail*>& tmb)
|
void FileCatalog::openRequested(const std::vector<Thumbnail*>& tmb)
|
||||||
{
|
{
|
||||||
FCOIParams* params = new FCOIParams;
|
for (auto thumb : tmb) {
|
||||||
params->catalog = this;
|
thumb->increaseRef();
|
||||||
params->tmb = tmb;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < tmb.size(); i++) {
|
|
||||||
tmb[i]->increaseRef ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
idle_register.add<FCOIParams>(openRequestedUI, params, true);
|
idle_register.add(
|
||||||
|
[this, tmb]() -> bool
|
||||||
|
{
|
||||||
|
_openImage(tmb);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileCatalog::deleteRequested(const std::vector<FileBrowserEntry*>& tbe, bool inclBatchProcessed)
|
void FileCatalog::deleteRequested(const std::vector<FileBrowserEntry*>& tbe, bool inclBatchProcessed)
|
||||||
@ -1821,11 +1809,14 @@ void FileCatalog::addAndOpenFile (const Glib::ustring& fname)
|
|||||||
FileBrowserEntry* entry = new FileBrowserEntry (tmb, file->get_parse_name ());
|
FileBrowserEntry* entry = new FileBrowserEntry (tmb, file->get_parse_name ());
|
||||||
previewReady (selectedDirectoryId, entry);
|
previewReady (selectedDirectoryId, entry);
|
||||||
// open the file
|
// open the file
|
||||||
FCOIParams* params = new FCOIParams;
|
|
||||||
params->catalog = this;
|
|
||||||
params->tmb.push_back (tmb);
|
|
||||||
tmb->increaseRef ();
|
tmb->increaseRef ();
|
||||||
idle_register.add<FCOIParams>(openRequestedUI, params, true);
|
idle_register.add(
|
||||||
|
[this, tmb]() -> bool
|
||||||
|
{
|
||||||
|
_openImage({tmb});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
} catch(Gio::Error&) {}
|
} catch(Gio::Error&) {}
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ public:
|
|||||||
|
|
||||||
void on_realize() override;
|
void on_realize() override;
|
||||||
void reparseDirectory ();
|
void reparseDirectory ();
|
||||||
void _openImage (std::vector<Thumbnail*> tmb);
|
void _openImage (const std::vector<Thumbnail*>& tmb);
|
||||||
|
|
||||||
void zoomIn ();
|
void zoomIn ();
|
||||||
void zoomOut ();
|
void zoomOut ();
|
||||||
|
@ -139,14 +139,13 @@ FilePanel::FilePanel () : parent(nullptr), error(0)
|
|||||||
|
|
||||||
fileCatalog->setFileSelectionListener (this);
|
fileCatalog->setFileSelectionListener (this);
|
||||||
|
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](FilePanel* self) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
self->init();
|
init();
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<FilePanel>(func, this, false);
|
|
||||||
|
|
||||||
show_all ();
|
show_all ();
|
||||||
}
|
}
|
||||||
|
@ -562,14 +562,14 @@ void HistogramRGBArea::update (int valh, int rh, int gh, int bh)
|
|||||||
|
|
||||||
harih->pending++;
|
harih->pending++;
|
||||||
|
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](HistogramRGBAreaIdleHelper* harih) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
if (harih->destroyed) {
|
if (harih->destroyed) {
|
||||||
if (harih->pending == 1) {
|
if (harih->pending == 1) {
|
||||||
delete harih;
|
delete harih;
|
||||||
} else {
|
} else {
|
||||||
harih->pending--;
|
--harih->pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -578,12 +578,11 @@ void HistogramRGBArea::update (int valh, int rh, int gh, int bh)
|
|||||||
harih->harea->updateBackBuffer(-1, -1, -1);
|
harih->harea->updateBackBuffer(-1, -1, -1);
|
||||||
harih->harea->queue_draw ();
|
harih->harea->queue_draw ();
|
||||||
|
|
||||||
harih->pending--;
|
--harih->pending;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<HistogramRGBAreaIdleHelper>(func, harih, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistogramRGBArea::updateOptions (bool r, bool g, bool b, bool l, bool c, bool raw, bool bar)
|
void HistogramRGBArea::updateOptions (bool r, bool g, bool b, bool l, bool c, bool raw, bool bar)
|
||||||
@ -760,30 +759,30 @@ void HistogramArea::update(
|
|||||||
}
|
}
|
||||||
|
|
||||||
haih->pending++;
|
haih->pending++;
|
||||||
|
|
||||||
// Can be done outside of the GUI thread
|
// Can be done outside of the GUI thread
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](HistogramAreaIdleHelper* haih) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
if (haih->destroyed) {
|
if (haih->destroyed) {
|
||||||
if (haih->pending == 1) {
|
if (haih->pending == 1) {
|
||||||
delete haih;
|
delete haih;
|
||||||
} else {
|
} else {
|
||||||
haih->pending--;
|
--haih->pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
haih->harea->setDirty (true);
|
haih->harea->setDirty(true);
|
||||||
haih->harea->updateBackBuffer ();
|
haih->harea->updateBackBuffer();
|
||||||
haih->harea->queue_draw ();
|
haih->harea->queue_draw();
|
||||||
|
|
||||||
haih->pending--;
|
--haih->pending;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<HistogramAreaIdleHelper>(func, haih, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistogramArea::updateBackBuffer ()
|
void HistogramArea::updateBackBuffer ()
|
||||||
|
@ -1518,28 +1518,27 @@ void MyDiagonalCurve::updateBackgroundHistogram (LUTu & hist)
|
|||||||
|
|
||||||
mcih->pending++;
|
mcih->pending++;
|
||||||
|
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](MyCurveIdleHelper* mcih) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
if (mcih->destroyed) {
|
if (mcih->destroyed) {
|
||||||
if (mcih->pending == 1) {
|
if (mcih->pending == 1) {
|
||||||
delete mcih;
|
delete mcih;
|
||||||
} else {
|
} else {
|
||||||
mcih->pending--;
|
--mcih->pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcih->clearPixmap ();
|
mcih->clearPixmap();
|
||||||
mcih->myCurve->queue_draw ();
|
mcih->myCurve->queue_draw();
|
||||||
|
|
||||||
mcih->pending--;
|
--mcih->pending;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<MyCurveIdleHelper>(func, mcih, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyDiagonalCurve::reset(const std::vector<double> &resetCurve, double identityValue)
|
void MyDiagonalCurve::reset(const std::vector<double> &resetCurve, double identityValue)
|
||||||
|
@ -23,18 +23,6 @@
|
|||||||
using namespace rtengine;
|
using namespace rtengine;
|
||||||
using namespace rtengine::procparams;
|
using namespace rtengine::procparams;
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
|
|
||||||
struct iaimgpar {
|
|
||||||
IImage8* image;
|
|
||||||
PreviewHandlerIdleHelper* pih;
|
|
||||||
double scale;
|
|
||||||
CropParams cp;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
PreviewHandler::PreviewHandler () : image(nullptr), previewScale(1.)
|
PreviewHandler::PreviewHandler () : image(nullptr), previewScale(1.)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -61,22 +49,14 @@ void PreviewHandler::setImage(rtengine::IImage8* i, double scale, const rtengine
|
|||||||
{
|
{
|
||||||
pih->pending++;
|
pih->pending++;
|
||||||
|
|
||||||
iaimgpar* iap = new iaimgpar;
|
idle_register.add(
|
||||||
iap->image = i;
|
[this, i, scale, cp]() -> bool
|
||||||
iap->pih = pih;
|
|
||||||
iap->scale = scale;
|
|
||||||
iap->cp = cp;
|
|
||||||
|
|
||||||
const auto func =
|
|
||||||
[](iaimgpar* iap) -> bool
|
|
||||||
{
|
{
|
||||||
PreviewHandlerIdleHelper* const pih = iap->pih;
|
|
||||||
|
|
||||||
if (pih->destroyed) {
|
if (pih->destroyed) {
|
||||||
if (pih->pending == 1) {
|
if (pih->pending == 1) {
|
||||||
delete pih;
|
delete pih;
|
||||||
} else {
|
} else {
|
||||||
pih->pending--;
|
--pih->pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -84,21 +64,21 @@ void PreviewHandler::setImage(rtengine::IImage8* i, double scale, const rtengine
|
|||||||
|
|
||||||
if (pih->phandler->image) {
|
if (pih->phandler->image) {
|
||||||
IImage8* const oldImg = pih->phandler->image;
|
IImage8* const oldImg = pih->phandler->image;
|
||||||
oldImg->getMutex().lock ();
|
|
||||||
pih->phandler->image = iap->image;
|
oldImg->getMutex().lock();
|
||||||
oldImg->getMutex().unlock ();
|
pih->phandler->image = i;
|
||||||
|
oldImg->getMutex().unlock();
|
||||||
} else {
|
} else {
|
||||||
pih->phandler->image = iap->image;
|
pih->phandler->image = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
pih->phandler->cropParams = iap->cp;
|
pih->phandler->cropParams = cp;
|
||||||
pih->phandler->previewScale = iap->scale;
|
pih->phandler->previewScale = scale;
|
||||||
pih->pending--;
|
--pih->pending;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<iaimgpar>(func, iap, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -106,20 +86,14 @@ void PreviewHandler::delImage(IImage8* i)
|
|||||||
{
|
{
|
||||||
pih->pending++;
|
pih->pending++;
|
||||||
|
|
||||||
iaimgpar* iap = new iaimgpar;
|
idle_register.add(
|
||||||
iap->image = i;
|
[this, i]() -> bool
|
||||||
iap->pih = pih;
|
|
||||||
|
|
||||||
const auto func =
|
|
||||||
[](iaimgpar* iap) -> bool
|
|
||||||
{
|
{
|
||||||
PreviewHandlerIdleHelper* const pih = iap->pih;
|
|
||||||
|
|
||||||
if (pih->destroyed) {
|
if (pih->destroyed) {
|
||||||
if (pih->pending == 1) {
|
if (pih->pending == 1) {
|
||||||
delete pih;
|
delete pih;
|
||||||
} else {
|
} else {
|
||||||
pih->pending--;
|
--pih->pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -127,57 +101,51 @@ void PreviewHandler::delImage(IImage8* i)
|
|||||||
|
|
||||||
if (pih->phandler->image) {
|
if (pih->phandler->image) {
|
||||||
IImage8* oldImg = pih->phandler->image;
|
IImage8* oldImg = pih->phandler->image;
|
||||||
oldImg->getMutex().lock ();
|
oldImg->getMutex().lock();
|
||||||
pih->phandler->image = nullptr;
|
pih->phandler->image = nullptr;
|
||||||
oldImg->getMutex().unlock ();
|
oldImg->getMutex().unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
iap->image->free ();
|
i->free();
|
||||||
pih->phandler->previewImgMutex.lock ();
|
pih->phandler->previewImgMutex.lock();
|
||||||
pih->phandler->previewImg.clear ();
|
pih->phandler->previewImg.clear();
|
||||||
pih->phandler->previewImgMutex.unlock ();
|
pih->phandler->previewImgMutex.unlock();
|
||||||
|
|
||||||
pih->pending--;
|
--pih->pending;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<iaimgpar>(func, iap, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewHandler::imageReady(const rtengine::procparams::CropParams& cp)
|
void PreviewHandler::imageReady(const rtengine::procparams::CropParams& cp)
|
||||||
{
|
{
|
||||||
pih->pending++;
|
pih->pending++;
|
||||||
iaimgpar* iap = new iaimgpar;
|
|
||||||
iap->pih = pih;
|
|
||||||
iap->cp = cp;
|
|
||||||
|
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](iaimgpar* iap) -> bool
|
[this, cp]() -> bool
|
||||||
{
|
{
|
||||||
PreviewHandlerIdleHelper* const pih = iap->pih;
|
|
||||||
|
|
||||||
if (pih->destroyed) {
|
if (pih->destroyed) {
|
||||||
if (pih->pending == 1) {
|
if (pih->pending == 1) {
|
||||||
delete pih;
|
delete pih;
|
||||||
} else {
|
} else {
|
||||||
pih->pending--;
|
--pih->pending;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pih->phandler->previewImgMutex.lock ();
|
pih->phandler->previewImgMutex.lock();
|
||||||
pih->phandler->previewImg = Gdk::Pixbuf::create_from_data (pih->phandler->image->getData(), Gdk::COLORSPACE_RGB, false, 8, pih->phandler->image->getWidth(), pih->phandler->image->getHeight(), 3 * pih->phandler->image->getWidth());
|
pih->phandler->previewImg = Gdk::Pixbuf::create_from_data(pih->phandler->image->getData(), Gdk::COLORSPACE_RGB, false, 8, pih->phandler->image->getWidth(), pih->phandler->image->getHeight(), 3 * pih->phandler->image->getWidth());
|
||||||
pih->phandler->previewImgMutex.unlock ();
|
pih->phandler->previewImgMutex.unlock ();
|
||||||
pih->phandler->cropParams = iap->cp;
|
|
||||||
|
pih->phandler->cropParams = cp;
|
||||||
pih->phandler->previewImageChanged ();
|
pih->phandler->previewImageChanged ();
|
||||||
pih->pending--;
|
--pih->pending;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<iaimgpar>(func, iap, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::RefPtr<Gdk::Pixbuf> PreviewHandler::getRoughImage (int x, int y, int w, int h, double zoom)
|
Glib::RefPtr<Gdk::Pixbuf> PreviewHandler::getRoughImage (int x, int y, int w, int h, double zoom)
|
||||||
|
@ -366,60 +366,60 @@ void Resize::sizeChanged(int mw, int mh, int ow, int oh)
|
|||||||
|
|
||||||
void Resize::setDimensions ()
|
void Resize::setDimensions ()
|
||||||
{
|
{
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](Resize* self) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
self->wconn.block(true);
|
wconn.block(true);
|
||||||
self->hconn.block(true);
|
hconn.block(true);
|
||||||
self->scale->block(true);
|
scale->block(true);
|
||||||
|
|
||||||
int refw, refh;
|
int refw, refh;
|
||||||
|
|
||||||
if (self->appliesTo->get_active_row_number() == 0 && self->cropw) {
|
if (appliesTo->get_active_row_number() == 0 && cropw) {
|
||||||
// Applies to Cropped area
|
// Applies to Cropped area
|
||||||
refw = self->cropw;
|
refw = cropw;
|
||||||
refh = self->croph;
|
refh = croph;
|
||||||
} else {
|
} else {
|
||||||
// Applies to Full image or crop is disabled
|
// Applies to Full image or crop is disabled
|
||||||
refw = self->maxw;
|
refw = maxw;
|
||||||
refh = self->maxh;
|
refh = maxh;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->w->set_range(32, MAX_SCALE * refw);
|
w->set_range(32, MAX_SCALE * refw);
|
||||||
self->h->set_range(32, MAX_SCALE * refh);
|
h->set_range(32, MAX_SCALE * refh);
|
||||||
|
|
||||||
switch (self->spec->get_active_row_number()) {
|
switch (spec->get_active_row_number()) {
|
||||||
case 0: {
|
case 0: {
|
||||||
// Scale mode
|
// Scale mode
|
||||||
self->w->set_value(static_cast<double>(static_cast<int>(static_cast<double>(refw) * self->scale->getValue() + 0.5)));
|
w->set_value(static_cast<double>(static_cast<int>(static_cast<double>(refw) * scale->getValue() + 0.5)));
|
||||||
self->h->set_value(static_cast<double>(static_cast<int>(static_cast<double>(refh) * self->scale->getValue() + 0.5)));
|
h->set_value(static_cast<double>(static_cast<int>(static_cast<double>(refh) * scale->getValue() + 0.5)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 1: {
|
case 1: {
|
||||||
// Width mode
|
// Width mode
|
||||||
const double tmp_scale = self->w->get_value() / static_cast<double>(refw);
|
const double tmp_scale = w->get_value() / static_cast<double>(refw);
|
||||||
self->scale->setValue(tmp_scale);
|
scale->setValue(tmp_scale);
|
||||||
self->h->set_value(static_cast<double>(static_cast<int>(static_cast<double>(refh) * tmp_scale + 0.5)));
|
h->set_value(static_cast<double>(static_cast<int>(static_cast<double>(refh) * tmp_scale + 0.5)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 2: {
|
case 2: {
|
||||||
// Height mode
|
// Height mode
|
||||||
const double tmp_scale = self->h->get_value() / static_cast<double>(refh);
|
const double tmp_scale = h->get_value() / static_cast<double>(refh);
|
||||||
self->scale->setValue(tmp_scale);
|
scale->setValue(tmp_scale);
|
||||||
self->w->set_value(static_cast<double>(static_cast<int>(static_cast<double>(refw) * tmp_scale + 0.5)));
|
w->set_value(static_cast<double>(static_cast<int>(static_cast<double>(refw) * tmp_scale + 0.5)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 3: {
|
case 3: {
|
||||||
// Bounding box mode
|
// Bounding box mode
|
||||||
const double tmp_scale =
|
const double tmp_scale =
|
||||||
self->w->get_value() / self->h->get_value() < static_cast<double>(refw) / static_cast<double>(refh)
|
w->get_value() / h->get_value() < static_cast<double>(refw) / static_cast<double>(refh)
|
||||||
? self->w->get_value() / static_cast<double>(refw)
|
? w->get_value() / static_cast<double>(refw)
|
||||||
: self->h->get_value() / static_cast<double>(refh);
|
: h->get_value() / static_cast<double>(refh);
|
||||||
|
|
||||||
self->scale->setValue(tmp_scale);
|
scale->setValue(tmp_scale);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,14 +428,13 @@ void Resize::setDimensions ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self->scale->block(false);
|
scale->block(false);
|
||||||
self->wconn.block(false);
|
wconn.block(false);
|
||||||
self->hconn.block(false);
|
hconn.block(false);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<Resize>(func, this, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Resize::fitBoxScale()
|
void Resize::fitBoxScale()
|
||||||
|
@ -672,28 +672,20 @@ void Retinex::minmaxChanged (double cdma, double cdmin, double mini, double maxi
|
|||||||
nextminT = Tmin;
|
nextminT = Tmin;
|
||||||
nextmaxT = Tmax;
|
nextmaxT = Tmax;
|
||||||
|
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](Retinex* self) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected
|
GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected
|
||||||
// FIXME: The above can't be true?!
|
// FIXME: The above can't be true?!
|
||||||
self->minmaxComputed_();
|
disableListener();
|
||||||
|
enableListener();
|
||||||
|
updateLabel();
|
||||||
|
updateTrans();
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
idle_register.add<Retinex>(func, this, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Retinex::minmaxComputed_ ()
|
|
||||||
{
|
|
||||||
|
|
||||||
disableListener ();
|
|
||||||
enableListener ();
|
|
||||||
updateLabel ();
|
|
||||||
updateTrans ();
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
void Retinex::updateLabel ()
|
void Retinex::updateLabel ()
|
||||||
{
|
{
|
||||||
if (!batchMode) {
|
if (!batchMode) {
|
||||||
|
@ -108,7 +108,6 @@ public:
|
|||||||
void autoOpenCurve () override;
|
void autoOpenCurve () override;
|
||||||
void medianmapChanged ();
|
void medianmapChanged ();
|
||||||
void minmaxChanged (double cdma, double cdmin, double mini, double maxi, double Tmean, double Tsigma, double Tmin, double Tmax) override;
|
void minmaxChanged (double cdma, double cdmin, double mini, double maxi, double Tmean, double Tsigma, double Tmin, double Tmax) override;
|
||||||
bool minmaxComputed_ ();
|
|
||||||
void updateLabel ();
|
void updateLabel ();
|
||||||
void updateTrans ();
|
void updateTrans ();
|
||||||
void neutral_pressed ();
|
void neutral_pressed ();
|
||||||
|
@ -832,41 +832,6 @@ void ToneCurve::enableAll ()
|
|||||||
histmatching->set_sensitive(true);
|
histmatching->set_sensitive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ToneCurve::autoExpComputed_ ()
|
|
||||||
{
|
|
||||||
|
|
||||||
GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected
|
|
||||||
disableListener ();
|
|
||||||
enableAll ();
|
|
||||||
expcomp->setValue (nextExpcomp);
|
|
||||||
brightness->setValue (nextBrightness);
|
|
||||||
contrast->setValue (nextContrast);
|
|
||||||
black->setValue (nextBlack);
|
|
||||||
hlcompr->setValue (nextHlcompr);
|
|
||||||
hlcomprthresh->setValue (nextHlcomprthresh);
|
|
||||||
enaconn.block (true);
|
|
||||||
hrenabled->set_active (nextHLRecons);
|
|
||||||
enaconn.block (false);
|
|
||||||
|
|
||||||
if (nextHLRecons) {
|
|
||||||
hlrbox->show();
|
|
||||||
} else if (!batchMode) {
|
|
||||||
hlrbox->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!black->getAddMode() && !batchMode) {
|
|
||||||
shcompr->set_sensitive(!((int)black->getValue () == 0)); //at black=0 shcompr value has no effect
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hlcompr->getAddMode() && !batchMode) {
|
|
||||||
hlcomprthresh->set_sensitive(!((int)hlcompr->getValue () == 0)); //at hlcompr=0 hlcomprthresh value has no effect
|
|
||||||
}
|
|
||||||
|
|
||||||
enableListener ();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ToneCurve::setBatchMode (bool batchMode)
|
void ToneCurve::setBatchMode (bool batchMode)
|
||||||
{
|
{
|
||||||
ToolPanel::setBatchMode (batchMode);
|
ToolPanel::setBatchMode (batchMode);
|
||||||
@ -967,9 +932,62 @@ void ToneCurve::histmatchingToggled()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ToneCurve::histmatchingComputed()
|
void ToneCurve::autoExpChanged(double expcomp, int bright, int contr, int black, int hlcompr, int hlcomprthresh, bool hlrecons)
|
||||||
{
|
{
|
||||||
GThreadLock lock;
|
nextBlack = black;
|
||||||
|
nextExpcomp = expcomp;
|
||||||
|
nextBrightness = bright;
|
||||||
|
nextContrast = contr;
|
||||||
|
nextHlcompr = hlcompr;
|
||||||
|
nextHlcomprthresh = hlcomprthresh;
|
||||||
|
nextHLRecons = hlrecons;
|
||||||
|
|
||||||
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected
|
||||||
|
// FIXME: We don't need the GThreadLock, don't we?
|
||||||
|
disableListener();
|
||||||
|
enableAll();
|
||||||
|
this->expcomp->setValue(nextExpcomp);
|
||||||
|
brightness->setValue(nextBrightness);
|
||||||
|
contrast->setValue(nextContrast);
|
||||||
|
this->black->setValue(nextBlack);
|
||||||
|
this->hlcompr->setValue(nextHlcompr);
|
||||||
|
this->hlcomprthresh->setValue(nextHlcomprthresh);
|
||||||
|
enaconn.block(true);
|
||||||
|
hrenabled->set_active(nextHLRecons);
|
||||||
|
enaconn.block(false);
|
||||||
|
|
||||||
|
if (nextHLRecons) {
|
||||||
|
hlrbox->show();
|
||||||
|
} else if (!batchMode) {
|
||||||
|
hlrbox->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->black->getAddMode() && !batchMode) {
|
||||||
|
shcompr->set_sensitive(static_cast<int>(this->black->getValue())); //at black=0 shcompr value has no effect
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->hlcompr->getAddMode() && !batchMode) {
|
||||||
|
this->hlcomprthresh->set_sensitive(static_cast<int>(this->hlcompr->getValue())); //at hlcompr=0 hlcomprthresh value has no effect
|
||||||
|
}
|
||||||
|
|
||||||
|
enableListener();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ToneCurve::autoMatchedToneCurveChanged(rtengine::procparams::ToneCurveParams::TcMode curveMode, const std::vector<double>& curve)
|
||||||
|
{
|
||||||
|
nextToneCurveMode = curveMode;
|
||||||
|
nextToneCurve = curve;
|
||||||
|
|
||||||
|
idle_register.add(
|
||||||
|
[this]() -> bool
|
||||||
|
{
|
||||||
|
GThreadLock lock; // FIXME: Obsolete
|
||||||
disableListener();
|
disableListener();
|
||||||
enableAll();
|
enableAll();
|
||||||
brightness->setValue(0);
|
brightness->setValue(0);
|
||||||
@ -977,11 +995,11 @@ bool ToneCurve::histmatchingComputed()
|
|||||||
black->setValue(0);
|
black->setValue(0);
|
||||||
|
|
||||||
if (!black->getAddMode() && !batchMode) {
|
if (!black->getAddMode() && !batchMode) {
|
||||||
shcompr->set_sensitive(!((int)black->getValue() == 0));
|
shcompr->set_sensitive(static_cast<int>(black->getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hlcompr->getAddMode() && !batchMode) {
|
if (!hlcompr->getAddMode() && !batchMode) {
|
||||||
hlcomprthresh->set_sensitive(!((int)hlcompr->getValue () == 0)); //at hlcompr=0 hlcomprthresh value has no effect
|
hlcomprthresh->set_sensitive(static_cast<int>(hlcompr->getValue())); //at hlcompr=0 hlcomprthresh value has no effect
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autolevels->get_active() ) {
|
if (autolevels->get_active() ) {
|
||||||
@ -994,46 +1012,13 @@ bool ToneCurve::histmatchingComputed()
|
|||||||
|
|
||||||
toneCurveMode->set_active(rtengine::toUnderlying(nextToneCurveMode));
|
toneCurveMode->set_active(rtengine::toUnderlying(nextToneCurveMode));
|
||||||
shape->setCurve(nextToneCurve);
|
shape->setCurve(nextToneCurve);
|
||||||
shape2->setCurve({ DCT_Linear });
|
shape2->setCurve({DCT_Linear});
|
||||||
shape->openIfNonlinear();
|
shape->openIfNonlinear();
|
||||||
|
|
||||||
enableListener();
|
enableListener();
|
||||||
fromHistMatching = true;
|
fromHistMatching = true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
);
|
||||||
void ToneCurve::autoExpChanged(double expcomp, int bright, int contr, int black, int hlcompr, int hlcomprthresh, bool hlrecons)
|
|
||||||
{
|
|
||||||
nextBlack = black;
|
|
||||||
nextExpcomp = expcomp;
|
|
||||||
nextBrightness = bright;
|
|
||||||
nextContrast = contr;
|
|
||||||
nextHlcompr = hlcompr;
|
|
||||||
nextHlcomprthresh = hlcomprthresh;
|
|
||||||
nextHLRecons = hlrecons;
|
|
||||||
|
|
||||||
const auto func =
|
|
||||||
[](ToneCurve* self) -> bool
|
|
||||||
{
|
|
||||||
self->autoExpComputed_();
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
idle_register.add<ToneCurve>(func, this, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ToneCurve::autoMatchedToneCurveChanged(rtengine::procparams::ToneCurveParams::TcMode curveMode, const std::vector<double>& curve)
|
|
||||||
{
|
|
||||||
nextToneCurveMode = curveMode;
|
|
||||||
nextToneCurve = curve;
|
|
||||||
|
|
||||||
const auto func =
|
|
||||||
[](ToneCurve* self) -> bool
|
|
||||||
{
|
|
||||||
self->histmatchingComputed();
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
idle_register.add<ToneCurve>(func, this, false);
|
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,6 @@ public:
|
|||||||
void clip_changed ();
|
void clip_changed ();
|
||||||
bool clip_changed_ ();
|
bool clip_changed_ ();
|
||||||
void waitForAutoExp ();
|
void waitForAutoExp ();
|
||||||
bool autoExpComputed_ ();
|
|
||||||
void enableAll ();
|
void enableAll ();
|
||||||
void curveChanged (CurveEditor* ce) override;
|
void curveChanged (CurveEditor* ce) override;
|
||||||
void curveMode1Changed ();
|
void curveMode1Changed ();
|
||||||
@ -131,7 +130,6 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
void histmatchingToggled();
|
void histmatchingToggled();
|
||||||
bool histmatchingComputed();
|
|
||||||
|
|
||||||
void autoExpChanged(double expcomp, int bright, int contr, int black, int hlcompr, int hlcomprthresh, bool hlrecons) override;
|
void autoExpChanged(double expcomp, int bright, int contr, int black, int hlcompr, int hlcomprthresh, bool hlrecons) override;
|
||||||
void autoMatchedToneCurveChanged(rtengine::procparams::ToneCurveParams::TcMode curveMode, const std::vector<double>& curve) override;
|
void autoMatchedToneCurveChanged(rtengine::procparams::ToneCurveParams::TcMode curveMode, const std::vector<double>& curve) override;
|
||||||
|
@ -297,74 +297,74 @@ void ToolPanelCoordinator::imageTypeChanged (bool isRaw, bool isBayer, bool isXt
|
|||||||
{
|
{
|
||||||
if (isRaw) {
|
if (isRaw) {
|
||||||
if (isBayer) {
|
if (isBayer) {
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](ToolPanelCoordinator* self) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
self->rawPanelSW->set_sensitive (true);
|
rawPanelSW->set_sensitive(true);
|
||||||
self->sensorxtrans->FoldableToolPanel::hide();
|
sensorxtrans->FoldableToolPanel::hide();
|
||||||
self->sensorbayer->FoldableToolPanel::show();
|
sensorbayer->FoldableToolPanel::show();
|
||||||
self->preprocess->FoldableToolPanel::show();
|
preprocess->FoldableToolPanel::show();
|
||||||
self->flatfield->FoldableToolPanel::show();
|
flatfield->FoldableToolPanel::show();
|
||||||
self->retinex->FoldableToolPanel::setGrayedOut(false);
|
retinex->FoldableToolPanel::setGrayedOut(false);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
idle_register.add<ToolPanelCoordinator>(func, this, false);
|
);
|
||||||
}
|
}
|
||||||
else if (isXtrans) {
|
else if (isXtrans) {
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](ToolPanelCoordinator* self) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
self->rawPanelSW->set_sensitive (true);
|
rawPanelSW->set_sensitive(true);
|
||||||
self->sensorxtrans->FoldableToolPanel::show();
|
sensorxtrans->FoldableToolPanel::show();
|
||||||
self->sensorbayer->FoldableToolPanel::hide();
|
sensorbayer->FoldableToolPanel::hide();
|
||||||
self->preprocess->FoldableToolPanel::show();
|
preprocess->FoldableToolPanel::show();
|
||||||
self->flatfield->FoldableToolPanel::show();
|
flatfield->FoldableToolPanel::show();
|
||||||
self->retinex->FoldableToolPanel::setGrayedOut(false);
|
retinex->FoldableToolPanel::setGrayedOut(false);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
idle_register.add<ToolPanelCoordinator>(func, this, false);
|
);
|
||||||
}
|
}
|
||||||
else if (isMono) {
|
else if (isMono) {
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](ToolPanelCoordinator* self) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
self->rawPanelSW->set_sensitive (true);
|
rawPanelSW->set_sensitive(true);
|
||||||
self->sensorbayer->FoldableToolPanel::hide();
|
sensorbayer->FoldableToolPanel::hide();
|
||||||
self->sensorxtrans->FoldableToolPanel::hide();
|
sensorxtrans->FoldableToolPanel::hide();
|
||||||
self->preprocess->FoldableToolPanel::hide();
|
preprocess->FoldableToolPanel::hide();
|
||||||
self->flatfield->FoldableToolPanel::show();
|
flatfield->FoldableToolPanel::show();
|
||||||
self->retinex->FoldableToolPanel::setGrayedOut(false);
|
retinex->FoldableToolPanel::setGrayedOut(false);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
idle_register.add<ToolPanelCoordinator>(func, this, false);
|
);
|
||||||
} else {
|
} else {
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](ToolPanelCoordinator* self) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
self->rawPanelSW->set_sensitive (true);
|
rawPanelSW->set_sensitive(true);
|
||||||
self->sensorbayer->FoldableToolPanel::hide();
|
sensorbayer->FoldableToolPanel::hide();
|
||||||
self->sensorxtrans->FoldableToolPanel::hide();
|
sensorxtrans->FoldableToolPanel::hide();
|
||||||
self->preprocess->FoldableToolPanel::hide();
|
preprocess->FoldableToolPanel::hide();
|
||||||
self->flatfield->FoldableToolPanel::hide();
|
flatfield->FoldableToolPanel::hide();
|
||||||
self->retinex->FoldableToolPanel::setGrayedOut(false);
|
retinex->FoldableToolPanel::setGrayedOut(false);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
idle_register.add<ToolPanelCoordinator>(func, this, false);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const auto func =
|
idle_register.add(
|
||||||
[](ToolPanelCoordinator* self) -> bool
|
[this]() -> bool
|
||||||
{
|
{
|
||||||
self->rawPanelSW->set_sensitive (false);
|
rawPanelSW->set_sensitive(false);
|
||||||
self->retinex->FoldableToolPanel::setGrayedOut(true);
|
retinex->FoldableToolPanel::setGrayedOut(true);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
idle_register.add<ToolPanelCoordinator>(func, this, false);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user