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 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)
|
||||
{
|
||||
|
||||
@ -606,14 +587,13 @@ void BatchQueue::setProgress(double p)
|
||||
}
|
||||
|
||||
// No need to acquire the GUI, setProgressUI will do it
|
||||
const auto func =
|
||||
[](BatchQueue* bq) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
bq->redraw();
|
||||
redraw();
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<BatchQueue>(func, this, false);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void BatchQueue::setProgressStr(const Glib::ustring& str)
|
||||
@ -638,12 +618,15 @@ void BatchQueue::error(const Glib::ustring& descr)
|
||||
}
|
||||
|
||||
if (listener) {
|
||||
NLParams* params = new NLParams;
|
||||
params->listener = listener;
|
||||
params->queueRunning = false;
|
||||
params->queueError = true;
|
||||
params->queueErrorMessage = descr;
|
||||
idle_register.add<NLParams>(bqnotifylistenerUI, params, true);
|
||||
BatchQueueListener* const bql = listener;
|
||||
|
||||
idle_register.add(
|
||||
[bql, descr]() -> bool
|
||||
{
|
||||
bql->queueSizeChanged(0, false, true, descr);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -974,15 +957,21 @@ void BatchQueue::notifyListener ()
|
||||
{
|
||||
const bool queueRunning = processing;
|
||||
if (listener) {
|
||||
NLParams* params = new NLParams;
|
||||
params->listener = listener;
|
||||
BatchQueueListener* const bql = listener;
|
||||
|
||||
int qsize = 0;
|
||||
{
|
||||
MYREADERLOCK(l, entryRW);
|
||||
params->qsize = fd.size();
|
||||
qsize = fd.size();
|
||||
}
|
||||
params->queueRunning = queueRunning;
|
||||
params->queueError = false;
|
||||
idle_register.add<NLParams>(bqnotifylistenerUI, params, true);
|
||||
|
||||
idle_register.add(
|
||||
[bql, qsize, queueRunning]() -> bool
|
||||
{
|
||||
bql->queueSizeChanged(qsize, queueRunning, false, {});
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,14 +172,14 @@ BatchQueuePanel::BatchQueuePanel (FileCatalog* aFileCatalog) : parent(nullptr)
|
||||
show_all ();
|
||||
|
||||
if (batchQueue->loadBatchQueue()) {
|
||||
const auto func =
|
||||
[](BatchQueue* bq) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
bq->resizeLoadedQueue();
|
||||
batchQueue->resizeLoadedQueue();
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<BatchQueue>(func, batchQueue, false, G_PRIORITY_LOW);
|
||||
},
|
||||
G_PRIORITY_LOW
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -375,14 +375,13 @@ void BlackWhite::BWChanged (double redbw, double greenbw, double bluebw)
|
||||
nextgreenbw = greenbw;
|
||||
nextbluebw = bluebw;
|
||||
|
||||
const auto func =
|
||||
[](BlackWhite* self) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
self->BWComputed_();
|
||||
BWComputed_();
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<BlackWhite>(func, this, false);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
bool BlackWhite::BWComputed_ ()
|
||||
|
@ -891,17 +891,16 @@ void ColorToning::autoColorTonChanged(int bwct, int satthres, int satprot)
|
||||
nextsatth = satthres;
|
||||
nextsatpr = satprot;
|
||||
|
||||
const auto func =
|
||||
[](ColorToning* self) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
self->disableListener();
|
||||
self->saturatedOpacity->setValue(self->nextsatpr);
|
||||
self->satProtectionThreshold->setValue(self->nextsatth);
|
||||
self->enableListener();
|
||||
disableListener();
|
||||
saturatedOpacity->setValue(nextsatpr);
|
||||
satProtectionThreshold->setValue(nextsatth);
|
||||
enableListener();
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<ColorToning>(func, this, false);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
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)
|
||||
{
|
||||
if (w < h) {
|
||||
@ -589,7 +566,13 @@ void Crop::doresetCrop ()
|
||||
int W = maxw;
|
||||
int H = maxh;
|
||||
cropResized (X, Y, W, H);
|
||||
idle_register.add<Crop>(notifyListenerUI, this, false);
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
notifyListener();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
refreshSpins();
|
||||
}
|
||||
@ -628,13 +611,25 @@ void Crop::enabledChanged ()
|
||||
void Crop::hFlipCrop ()
|
||||
{
|
||||
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 ()
|
||||
{
|
||||
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)
|
||||
@ -674,7 +669,13 @@ void Crop::rotateCrop (int deg, bool hflip, bool vflip)
|
||||
}
|
||||
|
||||
lastRotationDeg = deg;
|
||||
idle_register.add<RefreshSpinHelper>(refreshSpinsUI, new RefreshSpinHelper(this, false), true);
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
refreshSpins(false);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void Crop::positionChanged ()
|
||||
@ -688,7 +689,13 @@ void Crop::positionChanged ()
|
||||
int W = nw;
|
||||
int H = nh;
|
||||
cropMoved (X, Y, W, H);
|
||||
idle_register.add<Crop>(notifyListenerUI, this, false);
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
notifyListener();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void Crop::widthChanged ()
|
||||
@ -701,7 +708,13 @@ void Crop::widthChanged ()
|
||||
int W = (int)w->get_value ();
|
||||
int H = nh;
|
||||
cropWidth2Resized (X, Y, W, H);
|
||||
idle_register.add<Crop>(notifyListenerUI, this, false);
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
notifyListener();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void Crop::heightChanged ()
|
||||
@ -714,7 +727,13 @@ void Crop::heightChanged ()
|
||||
int W = nw;
|
||||
int H = (int)h->get_value ();
|
||||
cropHeight2Resized (X, Y, W, H);
|
||||
idle_register.add<Crop>(notifyListenerUI, this, false);
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
notifyListener();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Fixed ratio toggle button
|
||||
@ -808,7 +827,13 @@ void Crop::adjustCropToRatio()
|
||||
}
|
||||
|
||||
// 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 ()
|
||||
@ -882,26 +907,13 @@ void Crop::setDimensions (int mw, int mh)
|
||||
|
||||
void Crop::sizeChanged(int x, int y, int ow, int oh)
|
||||
{
|
||||
struct Params {
|
||||
Crop* crop;
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
Params* const params = new Params{
|
||||
this,
|
||||
x,
|
||||
y
|
||||
};
|
||||
|
||||
const auto func =
|
||||
[](Params* params) -> bool
|
||||
idle_register.add(
|
||||
[this, x, y]() -> bool
|
||||
{
|
||||
params->crop->setDimensions(params->x, params->y);
|
||||
setDimensions(x, y);
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<Params>(func, params, true);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
bool Crop::refreshSpins (bool notify)
|
||||
@ -969,7 +981,13 @@ void Crop::cropMoved (int &X, int &Y, int &W, int &H)
|
||||
nw = W;
|
||||
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));
|
||||
}
|
||||
|
||||
@ -1013,7 +1031,13 @@ void Crop::cropWidth1Resized (int &X, int &Y, int &W, int &H, float custom_ratio
|
||||
nw = W;
|
||||
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)
|
||||
@ -1053,7 +1077,13 @@ void Crop::cropWidth2Resized (int &X, int &Y, int &W, int &H, float custom_ratio
|
||||
nw = W;
|
||||
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)
|
||||
@ -1096,7 +1126,13 @@ void Crop::cropHeight1Resized (int &X, int &Y, int &W, int &H, float custom_rati
|
||||
nw = W;
|
||||
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)
|
||||
@ -1136,7 +1172,13 @@ void Crop::cropHeight2Resized (int &X, int &Y, int &W, int &H, float custom_rati
|
||||
nw = W;
|
||||
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)
|
||||
@ -1178,7 +1220,13 @@ void Crop::cropTopLeftResized (int &X, int &Y, int &W, int &H, float custom_rati
|
||||
nw = W;
|
||||
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)
|
||||
@ -1218,7 +1266,13 @@ void Crop::cropTopRightResized (int &X, int &Y, int &W, int &H, float custom_rat
|
||||
nw = W;
|
||||
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)
|
||||
@ -1258,7 +1312,13 @@ void Crop::cropBottomLeftResized (int &X, int &Y, int &W, int &H, float custom_r
|
||||
nw = W;
|
||||
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)
|
||||
@ -1295,7 +1355,13 @@ void Crop::cropBottomRightResized (int &X, int &Y, int &W, int &H, float custom_
|
||||
nw = W;
|
||||
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)
|
||||
@ -1409,12 +1475,24 @@ void Crop::cropResized (int &x, int &y, int& x2, int& y2)
|
||||
nw = W;
|
||||
nh = H;
|
||||
|
||||
idle_register.add<RefreshSpinHelper>(refreshSpinsUI, new RefreshSpinHelper(this, false), true);
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
refreshSpins(false);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void Crop::cropManipReady ()
|
||||
{
|
||||
idle_register.add<Crop>(notifyListenerUI, this, false);
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
notifyListener();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
double Crop::getRatio () const
|
||||
|
@ -338,70 +338,69 @@ void CropHandler::setDetailedCrop(
|
||||
bool expected = false;
|
||||
|
||||
if (redraw_needed.compare_exchange_strong(expected, true)) {
|
||||
const auto func =
|
||||
[](CropHandler* self) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
self->cimg.lock ();
|
||||
cimg.lock ();
|
||||
|
||||
if (self->redraw_needed.exchange(false)) {
|
||||
self->cropPixbuf.clear ();
|
||||
if (redraw_needed.exchange(false)) {
|
||||
cropPixbuf.clear ();
|
||||
|
||||
if (!self->enabled) {
|
||||
self->cropimg.clear();
|
||||
self->cropimgtrue.clear();
|
||||
self->cimg.unlock ();
|
||||
if (!enabled) {
|
||||
cropimg.clear();
|
||||
cropimgtrue.clear();
|
||||
cimg.unlock ();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!self->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 (!cropimg.empty()) {
|
||||
if (cix == cropX && ciy == cropY && ciw == cropW && cih == cropH && cis == (zoom >= 1000 ? 1 : zoom / 10)) {
|
||||
// calculate final image size
|
||||
float czoom = self->zoom >= 1000 ?
|
||||
self->zoom / 1000.f :
|
||||
float((self->zoom/10) * 10) / float(self->zoom);
|
||||
int imw = self->cropimg_width * czoom;
|
||||
int imh = self->cropimg_height * czoom;
|
||||
float czoom = zoom >= 1000 ?
|
||||
zoom / 1000.f :
|
||||
float((zoom/10) * 10) / float(zoom);
|
||||
int imw = cropimg_width * czoom;
|
||||
int imh = cropimg_height * czoom;
|
||||
|
||||
if (imw > self->ww) {
|
||||
imw = self->ww;
|
||||
if (imw > ww) {
|
||||
imw = ww;
|
||||
}
|
||||
|
||||
if (imh > self->wh) {
|
||||
imh = self->wh;
|
||||
if (imh > 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);
|
||||
self->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);
|
||||
Glib::RefPtr<Gdk::Pixbuf> tmpPixbuf = Gdk::Pixbuf::create_from_data (cropimg.data(), Gdk::COLORSPACE_RGB, false, 8, cropimg_width, cropimg_height, 3 * cropimg_width);
|
||||
cropPixbuf = Gdk::Pixbuf::create (Gdk::COLORSPACE_RGB, false, 8, imw, imh);
|
||||
tmpPixbuf->scale (cropPixbuf, 0, 0, imw, imh, 0, 0, czoom, czoom, Gdk::INTERP_TILES);
|
||||
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);
|
||||
self->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);
|
||||
Glib::RefPtr<Gdk::Pixbuf> tmpPixbuftrue = Gdk::Pixbuf::create_from_data (cropimgtrue.data(), Gdk::COLORSPACE_RGB, false, 8, cropimg_width, cropimg_height, 3 * cropimg_width);
|
||||
cropPixbuftrue = Gdk::Pixbuf::create (Gdk::COLORSPACE_RGB, false, 8, imw, imh);
|
||||
tmpPixbuftrue->scale (cropPixbuftrue, 0, 0, imw, imh, 0, 0, czoom, czoom, Gdk::INTERP_TILES);
|
||||
tmpPixbuftrue.clear ();
|
||||
}
|
||||
|
||||
self->cropimg.clear();
|
||||
self->cropimgtrue.clear();
|
||||
cropimg.clear();
|
||||
cropimgtrue.clear();
|
||||
}
|
||||
|
||||
self->cimg.unlock ();
|
||||
cimg.unlock ();
|
||||
|
||||
if (self->displayHandler) {
|
||||
self->displayHandler->cropImageUpdated ();
|
||||
if (displayHandler) {
|
||||
displayHandler->cropImageUpdated ();
|
||||
|
||||
if (self->initial.exchange(false)) {
|
||||
self->displayHandler->initialImageArrived ();
|
||||
if (initial.exchange(false)) {
|
||||
displayHandler->initialImageArrived ();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self->cimg.unlock();
|
||||
cimg.unlock();
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<CropHandler>(func, this, false);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -289,19 +289,18 @@ void DirPyrDenoise::chromaChanged (double autchroma, double autred, double autbl
|
||||
nextred = autred;
|
||||
nextblue = autblue;
|
||||
|
||||
const auto func =
|
||||
[](DirPyrDenoise* self) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
self->disableListener();
|
||||
self->chroma->setValue(self->nextchroma);
|
||||
self->redchro->setValue(self->nextred);
|
||||
self->bluechro->setValue(self->nextblue);
|
||||
self->enableListener();
|
||||
self->updateNoiseLabel();
|
||||
disableListener();
|
||||
chroma->setValue(nextchroma);
|
||||
redchro->setValue(nextred);
|
||||
bluechro->setValue(nextblue);
|
||||
enableListener();
|
||||
updateNoiseLabel();
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<DirPyrDenoise>(func, this, false);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
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;
|
||||
nextsizeP = sizeP;
|
||||
|
||||
const auto func =
|
||||
[](DirPyrDenoise* self) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
self->disableListener();
|
||||
self->enableListener();
|
||||
self->updateTileLabel();
|
||||
self->updatePrevLabel();
|
||||
disableListener();
|
||||
enableListener();
|
||||
updateTileLabel();
|
||||
updatePrevLabel();
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<DirPyrDenoise>(func, this, false);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void DirPyrDenoise::updateTileLabel ()
|
||||
@ -361,16 +359,18 @@ void DirPyrDenoise::updatePrevLabel ()
|
||||
|
||||
void DirPyrDenoise::noiseChanged (double nresid, double highresid)
|
||||
{
|
||||
const auto func =
|
||||
[](DirPyrDenoise* self) -> bool
|
||||
{
|
||||
self->disableListener();
|
||||
self->enableListener();
|
||||
self->updateNoiseLabel();
|
||||
return false;
|
||||
};
|
||||
nextnresid = nresid;
|
||||
nexthighresid = highresid;
|
||||
|
||||
idle_register.add<DirPyrDenoise>(func, this, false);
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
disableListener();
|
||||
enableListener();
|
||||
updateNoiseLabel();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void DirPyrDenoise::updateNoiseLabel()
|
||||
|
@ -38,34 +38,15 @@ using namespace rtengine::procparams;
|
||||
namespace
|
||||
{
|
||||
|
||||
struct spparams {
|
||||
double val;
|
||||
Glib::ustring str;
|
||||
MyProgressBar *pProgress;
|
||||
Glib::RefPtr<Gtk::CssProvider> cssProvider;
|
||||
};
|
||||
|
||||
bool setprogressStrUI(spparams* s)
|
||||
void setprogressStrUI(double val, const Glib::ustring str, MyProgressBar* pProgress)
|
||||
{
|
||||
if ( ! s->str.empty() ) {
|
||||
s->pProgress->set_text ( M (s->str) );
|
||||
if (!str.empty()) {
|
||||
pProgress->set_text(M(str));
|
||||
}
|
||||
|
||||
if ( s->val >= 0 ) {
|
||||
s->pProgress->set_fraction ( s->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 }");
|
||||
if (val >= 0.0) {
|
||||
pProgress->set_fraction(val);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
spparams *s = new spparams;
|
||||
s->val = p;
|
||||
s->pProgress = progressLabel;
|
||||
idle_register.add<spparams>(setprogressStrUI, s, true);
|
||||
MyProgressBar* const pl = progressLabel;
|
||||
|
||||
idle_register.add(
|
||||
[p, pl]() -> bool
|
||||
{
|
||||
setprogressStrUI(p, {}, pl);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void EditorPanel::setProgressStr(const Glib::ustring& str)
|
||||
{
|
||||
spparams *s = new spparams;
|
||||
s->str = str;
|
||||
s->val = -1;
|
||||
s->pProgress = progressLabel;
|
||||
idle_register.add<spparams>(setprogressStrUI, s, true);
|
||||
MyProgressBar* const pl = progressLabel;
|
||||
|
||||
idle_register.add(
|
||||
[str, pl]() -> bool
|
||||
{
|
||||
setprogressStrUI(-1.0, str, pl);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
struct errparams {
|
||||
Glib::ustring descr;
|
||||
Glib::ustring title;
|
||||
EditorPanelIdleHelper* epih;
|
||||
};
|
||||
|
||||
epih->pending++;
|
||||
errparams* const p = new errparams;
|
||||
p->descr = descr;
|
||||
p->title = title;
|
||||
p->epih = epih;
|
||||
|
||||
const auto func =
|
||||
[](errparams* p) -> bool
|
||||
idle_register.add(
|
||||
[this, descr, title]() -> bool
|
||||
{
|
||||
if (p->epih->destroyed)
|
||||
{
|
||||
if (p->epih->pending == 1) {
|
||||
delete p->epih;
|
||||
if (epih->destroyed) {
|
||||
if (epih->pending == 1) {
|
||||
delete epih;
|
||||
} else {
|
||||
p->epih->pending--;
|
||||
--epih->pending;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
p->epih->epanel->displayError (p->title, p->descr);
|
||||
p->epih->pending--;
|
||||
epih->epanel->displayError(title, descr);
|
||||
--epih->pending;
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<errparams>(func, p, true);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
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
|
||||
void EditorPanel::refreshProcessingState (bool inProcessingP)
|
||||
{
|
||||
spparams *s = new spparams;
|
||||
s->pProgress = progressLabel;
|
||||
double val;
|
||||
Glib::ustring str;
|
||||
|
||||
if (inProcessingP) {
|
||||
if (processingStartedTime == 0) {
|
||||
processingStartedTime = ::time (nullptr);
|
||||
}
|
||||
|
||||
s->str = "PROGRESSBAR_PROCESSING";
|
||||
s->val = 1.0;
|
||||
val = 1.0;
|
||||
str = "PROGRESSBAR_PROCESSING";
|
||||
} else {
|
||||
// Set proc params of thumbnail. It saves it into the cache and updates the file browser.
|
||||
if (ipc && openThm && tpc->getChangedState()) {
|
||||
@ -1326,8 +1304,8 @@ void EditorPanel::refreshProcessingState (bool inProcessingP)
|
||||
}
|
||||
|
||||
// Set progress bar "done"
|
||||
s->str = "PROGRESSBAR_READY";
|
||||
s->val = 0.0;
|
||||
val = 0.0;
|
||||
str = "PROGRESSBAR_READY";
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
@ -1342,7 +1320,7 @@ void EditorPanel::refreshProcessingState (bool inProcessingP)
|
||||
|
||||
isProcessing = inProcessingP;
|
||||
|
||||
setprogressStrUI (s);
|
||||
setprogressStrUI(val, str, progressLabel);
|
||||
}
|
||||
|
||||
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 ()
|
||||
{
|
||||
const auto func =
|
||||
[](FileBrowser* self) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
self->_thumbRearrangementNeeded();
|
||||
refreshThumbImages();// arrangeFiles is NOT enough
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<FileBrowser>(func, this, false);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void FileBrowser::selectionChanged ()
|
||||
|
@ -192,7 +192,6 @@ public:
|
||||
#endif
|
||||
|
||||
void thumbRearrangementNeeded () override;
|
||||
void _thumbRearrangementNeeded ();
|
||||
|
||||
void selectionChanged () override;
|
||||
|
||||
|
@ -855,14 +855,13 @@ void FileCatalog::previewsFinished (int dir_id)
|
||||
currentEFS = dirEFS;
|
||||
}
|
||||
|
||||
const auto func =
|
||||
[](FileCatalog* self) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
self->previewsFinishedUI();
|
||||
previewsFinishedUI();
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<FileCatalog>(func, this, false);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
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:)
|
||||
}
|
||||
|
||||
void FileCatalog::_openImage (std::vector<Thumbnail*> tmb)
|
||||
void FileCatalog::_openImage(const std::vector<Thumbnail*>& tmb)
|
||||
{
|
||||
|
||||
if (enabled && listener != nullptr) {
|
||||
if (enabled && listener) {
|
||||
bool continueToLoad = true;
|
||||
|
||||
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()
|
||||
{
|
||||
const auto func =
|
||||
[](FileCatalog* self) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
self->_refreshProgressBar();
|
||||
_refreshProgressBar();
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<FileCatalog>(func, this, false);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void FileCatalog::openRequested(const std::vector<Thumbnail*>& tmb)
|
||||
{
|
||||
FCOIParams* params = new FCOIParams;
|
||||
params->catalog = this;
|
||||
params->tmb = tmb;
|
||||
|
||||
for (size_t i = 0; i < tmb.size(); i++) {
|
||||
tmb[i]->increaseRef ();
|
||||
for (auto thumb : tmb) {
|
||||
thumb->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)
|
||||
@ -1821,11 +1809,14 @@ void FileCatalog::addAndOpenFile (const Glib::ustring& fname)
|
||||
FileBrowserEntry* entry = new FileBrowserEntry (tmb, file->get_parse_name ());
|
||||
previewReady (selectedDirectoryId, entry);
|
||||
// open the file
|
||||
FCOIParams* params = new FCOIParams;
|
||||
params->catalog = this;
|
||||
params->tmb.push_back (tmb);
|
||||
tmb->increaseRef ();
|
||||
idle_register.add<FCOIParams>(openRequestedUI, params, true);
|
||||
idle_register.add(
|
||||
[this, tmb]() -> bool
|
||||
{
|
||||
_openImage({tmb});
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
} catch(Gio::Error&) {}
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ public:
|
||||
|
||||
void on_realize() override;
|
||||
void reparseDirectory ();
|
||||
void _openImage (std::vector<Thumbnail*> tmb);
|
||||
void _openImage (const std::vector<Thumbnail*>& tmb);
|
||||
|
||||
void zoomIn ();
|
||||
void zoomOut ();
|
||||
|
@ -139,14 +139,13 @@ FilePanel::FilePanel () : parent(nullptr), error(0)
|
||||
|
||||
fileCatalog->setFileSelectionListener (this);
|
||||
|
||||
const auto func =
|
||||
[](FilePanel* self) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
self->init();
|
||||
init();
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<FilePanel>(func, this, false);
|
||||
}
|
||||
);
|
||||
|
||||
show_all ();
|
||||
}
|
||||
|
@ -562,14 +562,14 @@ void HistogramRGBArea::update (int valh, int rh, int gh, int bh)
|
||||
|
||||
harih->pending++;
|
||||
|
||||
const auto func =
|
||||
[](HistogramRGBAreaIdleHelper* harih) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
if (harih->destroyed) {
|
||||
if (harih->pending == 1) {
|
||||
delete harih;
|
||||
} else {
|
||||
harih->pending--;
|
||||
--harih->pending;
|
||||
}
|
||||
|
||||
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->queue_draw ();
|
||||
|
||||
harih->pending--;
|
||||
--harih->pending;
|
||||
|
||||
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)
|
||||
@ -760,30 +759,30 @@ void HistogramArea::update(
|
||||
}
|
||||
|
||||
haih->pending++;
|
||||
|
||||
// Can be done outside of the GUI thread
|
||||
const auto func =
|
||||
[](HistogramAreaIdleHelper* haih) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
if (haih->destroyed) {
|
||||
if (haih->pending == 1) {
|
||||
delete haih;
|
||||
} else {
|
||||
haih->pending--;
|
||||
--haih->pending;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
haih->harea->setDirty (true);
|
||||
haih->harea->updateBackBuffer ();
|
||||
haih->harea->queue_draw ();
|
||||
haih->harea->setDirty(true);
|
||||
haih->harea->updateBackBuffer();
|
||||
haih->harea->queue_draw();
|
||||
|
||||
haih->pending--;
|
||||
--haih->pending;
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<HistogramAreaIdleHelper>(func, haih, false);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void HistogramArea::updateBackBuffer ()
|
||||
|
@ -1518,28 +1518,27 @@ void MyDiagonalCurve::updateBackgroundHistogram (LUTu & hist)
|
||||
|
||||
mcih->pending++;
|
||||
|
||||
const auto func =
|
||||
[](MyCurveIdleHelper* mcih) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
if (mcih->destroyed) {
|
||||
if (mcih->pending == 1) {
|
||||
delete mcih;
|
||||
} else {
|
||||
mcih->pending--;
|
||||
--mcih->pending;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
mcih->clearPixmap ();
|
||||
mcih->myCurve->queue_draw ();
|
||||
mcih->clearPixmap();
|
||||
mcih->myCurve->queue_draw();
|
||||
|
||||
mcih->pending--;
|
||||
--mcih->pending;
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<MyCurveIdleHelper>(func, mcih, false);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void MyDiagonalCurve::reset(const std::vector<double> &resetCurve, double identityValue)
|
||||
|
@ -23,18 +23,6 @@
|
||||
using namespace rtengine;
|
||||
using namespace rtengine::procparams;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct iaimgpar {
|
||||
IImage8* image;
|
||||
PreviewHandlerIdleHelper* pih;
|
||||
double scale;
|
||||
CropParams cp;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
PreviewHandler::PreviewHandler () : image(nullptr), previewScale(1.)
|
||||
{
|
||||
|
||||
@ -61,22 +49,14 @@ void PreviewHandler::setImage(rtengine::IImage8* i, double scale, const rtengine
|
||||
{
|
||||
pih->pending++;
|
||||
|
||||
iaimgpar* iap = new iaimgpar;
|
||||
iap->image = i;
|
||||
iap->pih = pih;
|
||||
iap->scale = scale;
|
||||
iap->cp = cp;
|
||||
|
||||
const auto func =
|
||||
[](iaimgpar* iap) -> bool
|
||||
idle_register.add(
|
||||
[this, i, scale, cp]() -> bool
|
||||
{
|
||||
PreviewHandlerIdleHelper* const pih = iap->pih;
|
||||
|
||||
if (pih->destroyed) {
|
||||
if (pih->pending == 1) {
|
||||
delete pih;
|
||||
} else {
|
||||
pih->pending--;
|
||||
--pih->pending;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -84,21 +64,21 @@ void PreviewHandler::setImage(rtengine::IImage8* i, double scale, const rtengine
|
||||
|
||||
if (pih->phandler->image) {
|
||||
IImage8* const oldImg = pih->phandler->image;
|
||||
oldImg->getMutex().lock ();
|
||||
pih->phandler->image = iap->image;
|
||||
oldImg->getMutex().unlock ();
|
||||
|
||||
oldImg->getMutex().lock();
|
||||
pih->phandler->image = i;
|
||||
oldImg->getMutex().unlock();
|
||||
} else {
|
||||
pih->phandler->image = iap->image;
|
||||
pih->phandler->image = i;
|
||||
}
|
||||
|
||||
pih->phandler->cropParams = iap->cp;
|
||||
pih->phandler->previewScale = iap->scale;
|
||||
pih->pending--;
|
||||
pih->phandler->cropParams = cp;
|
||||
pih->phandler->previewScale = scale;
|
||||
--pih->pending;
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<iaimgpar>(func, iap, true);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -106,20 +86,14 @@ void PreviewHandler::delImage(IImage8* i)
|
||||
{
|
||||
pih->pending++;
|
||||
|
||||
iaimgpar* iap = new iaimgpar;
|
||||
iap->image = i;
|
||||
iap->pih = pih;
|
||||
|
||||
const auto func =
|
||||
[](iaimgpar* iap) -> bool
|
||||
idle_register.add(
|
||||
[this, i]() -> bool
|
||||
{
|
||||
PreviewHandlerIdleHelper* const pih = iap->pih;
|
||||
|
||||
if (pih->destroyed) {
|
||||
if (pih->pending == 1) {
|
||||
delete pih;
|
||||
} else {
|
||||
pih->pending--;
|
||||
--pih->pending;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -127,57 +101,51 @@ void PreviewHandler::delImage(IImage8* i)
|
||||
|
||||
if (pih->phandler->image) {
|
||||
IImage8* oldImg = pih->phandler->image;
|
||||
oldImg->getMutex().lock ();
|
||||
oldImg->getMutex().lock();
|
||||
pih->phandler->image = nullptr;
|
||||
oldImg->getMutex().unlock ();
|
||||
oldImg->getMutex().unlock();
|
||||
}
|
||||
|
||||
iap->image->free ();
|
||||
pih->phandler->previewImgMutex.lock ();
|
||||
pih->phandler->previewImg.clear ();
|
||||
pih->phandler->previewImgMutex.unlock ();
|
||||
i->free();
|
||||
pih->phandler->previewImgMutex.lock();
|
||||
pih->phandler->previewImg.clear();
|
||||
pih->phandler->previewImgMutex.unlock();
|
||||
|
||||
pih->pending--;
|
||||
--pih->pending;
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<iaimgpar>(func, iap, true);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void PreviewHandler::imageReady(const rtengine::procparams::CropParams& cp)
|
||||
{
|
||||
pih->pending++;
|
||||
iaimgpar* iap = new iaimgpar;
|
||||
iap->pih = pih;
|
||||
iap->cp = cp;
|
||||
|
||||
const auto func =
|
||||
[](iaimgpar* iap) -> bool
|
||||
idle_register.add(
|
||||
[this, cp]() -> bool
|
||||
{
|
||||
PreviewHandlerIdleHelper* const pih = iap->pih;
|
||||
|
||||
if (pih->destroyed) {
|
||||
if (pih->pending == 1) {
|
||||
delete pih;
|
||||
} else {
|
||||
pih->pending--;
|
||||
--pih->pending;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
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->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->previewImgMutex.unlock ();
|
||||
pih->phandler->cropParams = iap->cp;
|
||||
|
||||
pih->phandler->cropParams = cp;
|
||||
pih->phandler->previewImageChanged ();
|
||||
pih->pending--;
|
||||
--pih->pending;
|
||||
|
||||
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)
|
||||
|
@ -366,60 +366,60 @@ void Resize::sizeChanged(int mw, int mh, int ow, int oh)
|
||||
|
||||
void Resize::setDimensions ()
|
||||
{
|
||||
const auto func =
|
||||
[](Resize* self) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
self->wconn.block(true);
|
||||
self->hconn.block(true);
|
||||
self->scale->block(true);
|
||||
wconn.block(true);
|
||||
hconn.block(true);
|
||||
scale->block(true);
|
||||
|
||||
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
|
||||
refw = self->cropw;
|
||||
refh = self->croph;
|
||||
refw = cropw;
|
||||
refh = croph;
|
||||
} else {
|
||||
// Applies to Full image or crop is disabled
|
||||
refw = self->maxw;
|
||||
refh = self->maxh;
|
||||
refw = maxw;
|
||||
refh = maxh;
|
||||
}
|
||||
|
||||
self->w->set_range(32, MAX_SCALE * refw);
|
||||
self->h->set_range(32, MAX_SCALE * refh);
|
||||
w->set_range(32, MAX_SCALE * refw);
|
||||
h->set_range(32, MAX_SCALE * refh);
|
||||
|
||||
switch (self->spec->get_active_row_number()) {
|
||||
switch (spec->get_active_row_number()) {
|
||||
case 0: {
|
||||
// Scale mode
|
||||
self->w->set_value(static_cast<double>(static_cast<int>(static_cast<double>(refw) * self->scale->getValue() + 0.5)));
|
||||
self->h->set_value(static_cast<double>(static_cast<int>(static_cast<double>(refh) * self->scale->getValue() + 0.5)));
|
||||
w->set_value(static_cast<double>(static_cast<int>(static_cast<double>(refw) * scale->getValue() + 0.5)));
|
||||
h->set_value(static_cast<double>(static_cast<int>(static_cast<double>(refh) * scale->getValue() + 0.5)));
|
||||
break;
|
||||
}
|
||||
|
||||
case 1: {
|
||||
// Width mode
|
||||
const double tmp_scale = self->w->get_value() / static_cast<double>(refw);
|
||||
self->scale->setValue(tmp_scale);
|
||||
self->h->set_value(static_cast<double>(static_cast<int>(static_cast<double>(refh) * tmp_scale + 0.5)));
|
||||
const double tmp_scale = w->get_value() / static_cast<double>(refw);
|
||||
scale->setValue(tmp_scale);
|
||||
h->set_value(static_cast<double>(static_cast<int>(static_cast<double>(refh) * tmp_scale + 0.5)));
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: {
|
||||
// Height mode
|
||||
const double tmp_scale = self->h->get_value() / static_cast<double>(refh);
|
||||
self->scale->setValue(tmp_scale);
|
||||
self->w->set_value(static_cast<double>(static_cast<int>(static_cast<double>(refw) * tmp_scale + 0.5)));
|
||||
const double tmp_scale = h->get_value() / static_cast<double>(refh);
|
||||
scale->setValue(tmp_scale);
|
||||
w->set_value(static_cast<double>(static_cast<int>(static_cast<double>(refw) * tmp_scale + 0.5)));
|
||||
break;
|
||||
}
|
||||
|
||||
case 3: {
|
||||
// Bounding box mode
|
||||
const double tmp_scale =
|
||||
self->w->get_value() / self->h->get_value() < static_cast<double>(refw) / static_cast<double>(refh)
|
||||
? self->w->get_value() / static_cast<double>(refw)
|
||||
: self->h->get_value() / static_cast<double>(refh);
|
||||
w->get_value() / h->get_value() < static_cast<double>(refw) / static_cast<double>(refh)
|
||||
? w->get_value() / static_cast<double>(refw)
|
||||
: h->get_value() / static_cast<double>(refh);
|
||||
|
||||
self->scale->setValue(tmp_scale);
|
||||
scale->setValue(tmp_scale);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -428,14 +428,13 @@ void Resize::setDimensions ()
|
||||
}
|
||||
}
|
||||
|
||||
self->scale->block(false);
|
||||
self->wconn.block(false);
|
||||
self->hconn.block(false);
|
||||
scale->block(false);
|
||||
wconn.block(false);
|
||||
hconn.block(false);
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<Resize>(func, this, false);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void Resize::fitBoxScale()
|
||||
|
@ -672,28 +672,20 @@ void Retinex::minmaxChanged (double cdma, double cdmin, double mini, double maxi
|
||||
nextminT = Tmin;
|
||||
nextmaxT = Tmax;
|
||||
|
||||
const auto func =
|
||||
[](Retinex* self) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected
|
||||
// FIXME: The above can't be true?!
|
||||
self->minmaxComputed_();
|
||||
disableListener();
|
||||
enableListener();
|
||||
updateLabel();
|
||||
updateTrans();
|
||||
return false;
|
||||
};
|
||||
|
||||
idle_register.add<Retinex>(func, this, false);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
bool Retinex::minmaxComputed_ ()
|
||||
{
|
||||
|
||||
disableListener ();
|
||||
enableListener ();
|
||||
updateLabel ();
|
||||
updateTrans ();
|
||||
return false;
|
||||
|
||||
}
|
||||
void Retinex::updateLabel ()
|
||||
{
|
||||
if (!batchMode) {
|
||||
|
@ -108,7 +108,6 @@ public:
|
||||
void autoOpenCurve () override;
|
||||
void medianmapChanged ();
|
||||
void minmaxChanged (double cdma, double cdmin, double mini, double maxi, double Tmean, double Tsigma, double Tmin, double Tmax) override;
|
||||
bool minmaxComputed_ ();
|
||||
void updateLabel ();
|
||||
void updateTrans ();
|
||||
void neutral_pressed ();
|
||||
|
@ -832,41 +832,6 @@ void ToneCurve::enableAll ()
|
||||
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)
|
||||
{
|
||||
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();
|
||||
enableAll();
|
||||
brightness->setValue(0);
|
||||
@ -977,11 +995,11 @@ bool ToneCurve::histmatchingComputed()
|
||||
black->setValue(0);
|
||||
|
||||
if (!black->getAddMode() && !batchMode) {
|
||||
shcompr->set_sensitive(!((int)black->getValue() == 0));
|
||||
shcompr->set_sensitive(static_cast<int>(black->getValue()));
|
||||
}
|
||||
|
||||
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() ) {
|
||||
@ -994,46 +1012,13 @@ bool ToneCurve::histmatchingComputed()
|
||||
|
||||
toneCurveMode->set_active(rtengine::toUnderlying(nextToneCurveMode));
|
||||
shape->setCurve(nextToneCurve);
|
||||
shape2->setCurve({ DCT_Linear });
|
||||
shape2->setCurve({DCT_Linear});
|
||||
shape->openIfNonlinear();
|
||||
|
||||
enableListener();
|
||||
fromHistMatching = true;
|
||||
|
||||
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 ();
|
||||
bool clip_changed_ ();
|
||||
void waitForAutoExp ();
|
||||
bool autoExpComputed_ ();
|
||||
void enableAll ();
|
||||
void curveChanged (CurveEditor* ce) override;
|
||||
void curveMode1Changed ();
|
||||
@ -131,7 +130,6 @@ public:
|
||||
);
|
||||
|
||||
void histmatchingToggled();
|
||||
bool histmatchingComputed();
|
||||
|
||||
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;
|
||||
|
@ -297,74 +297,74 @@ void ToolPanelCoordinator::imageTypeChanged (bool isRaw, bool isBayer, bool isXt
|
||||
{
|
||||
if (isRaw) {
|
||||
if (isBayer) {
|
||||
const auto func =
|
||||
[](ToolPanelCoordinator* self) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
self->rawPanelSW->set_sensitive (true);
|
||||
self->sensorxtrans->FoldableToolPanel::hide();
|
||||
self->sensorbayer->FoldableToolPanel::show();
|
||||
self->preprocess->FoldableToolPanel::show();
|
||||
self->flatfield->FoldableToolPanel::show();
|
||||
self->retinex->FoldableToolPanel::setGrayedOut(false);
|
||||
rawPanelSW->set_sensitive(true);
|
||||
sensorxtrans->FoldableToolPanel::hide();
|
||||
sensorbayer->FoldableToolPanel::show();
|
||||
preprocess->FoldableToolPanel::show();
|
||||
flatfield->FoldableToolPanel::show();
|
||||
retinex->FoldableToolPanel::setGrayedOut(false);
|
||||
|
||||
return false;
|
||||
};
|
||||
idle_register.add<ToolPanelCoordinator>(func, this, false);
|
||||
}
|
||||
);
|
||||
}
|
||||
else if (isXtrans) {
|
||||
const auto func =
|
||||
[](ToolPanelCoordinator* self) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
self->rawPanelSW->set_sensitive (true);
|
||||
self->sensorxtrans->FoldableToolPanel::show();
|
||||
self->sensorbayer->FoldableToolPanel::hide();
|
||||
self->preprocess->FoldableToolPanel::show();
|
||||
self->flatfield->FoldableToolPanel::show();
|
||||
self->retinex->FoldableToolPanel::setGrayedOut(false);
|
||||
rawPanelSW->set_sensitive(true);
|
||||
sensorxtrans->FoldableToolPanel::show();
|
||||
sensorbayer->FoldableToolPanel::hide();
|
||||
preprocess->FoldableToolPanel::show();
|
||||
flatfield->FoldableToolPanel::show();
|
||||
retinex->FoldableToolPanel::setGrayedOut(false);
|
||||
|
||||
return false;
|
||||
};
|
||||
idle_register.add<ToolPanelCoordinator>(func, this, false);
|
||||
}
|
||||
);
|
||||
}
|
||||
else if (isMono) {
|
||||
const auto func =
|
||||
[](ToolPanelCoordinator* self) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
self->rawPanelSW->set_sensitive (true);
|
||||
self->sensorbayer->FoldableToolPanel::hide();
|
||||
self->sensorxtrans->FoldableToolPanel::hide();
|
||||
self->preprocess->FoldableToolPanel::hide();
|
||||
self->flatfield->FoldableToolPanel::show();
|
||||
self->retinex->FoldableToolPanel::setGrayedOut(false);
|
||||
rawPanelSW->set_sensitive(true);
|
||||
sensorbayer->FoldableToolPanel::hide();
|
||||
sensorxtrans->FoldableToolPanel::hide();
|
||||
preprocess->FoldableToolPanel::hide();
|
||||
flatfield->FoldableToolPanel::show();
|
||||
retinex->FoldableToolPanel::setGrayedOut(false);
|
||||
|
||||
return false;
|
||||
};
|
||||
idle_register.add<ToolPanelCoordinator>(func, this, false);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
const auto func =
|
||||
[](ToolPanelCoordinator* self) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
self->rawPanelSW->set_sensitive (true);
|
||||
self->sensorbayer->FoldableToolPanel::hide();
|
||||
self->sensorxtrans->FoldableToolPanel::hide();
|
||||
self->preprocess->FoldableToolPanel::hide();
|
||||
self->flatfield->FoldableToolPanel::hide();
|
||||
self->retinex->FoldableToolPanel::setGrayedOut(false);
|
||||
rawPanelSW->set_sensitive(true);
|
||||
sensorbayer->FoldableToolPanel::hide();
|
||||
sensorxtrans->FoldableToolPanel::hide();
|
||||
preprocess->FoldableToolPanel::hide();
|
||||
flatfield->FoldableToolPanel::hide();
|
||||
retinex->FoldableToolPanel::setGrayedOut(false);
|
||||
|
||||
return false;
|
||||
};
|
||||
idle_register.add<ToolPanelCoordinator>(func, this, false);
|
||||
}
|
||||
);
|
||||
}
|
||||
} else {
|
||||
const auto func =
|
||||
[](ToolPanelCoordinator* self) -> bool
|
||||
idle_register.add(
|
||||
[this]() -> bool
|
||||
{
|
||||
self->rawPanelSW->set_sensitive (false);
|
||||
self->retinex->FoldableToolPanel::setGrayedOut(true);
|
||||
rawPanelSW->set_sensitive(false);
|
||||
retinex->FoldableToolPanel::setGrayedOut(true);
|
||||
|
||||
return false;
|
||||
};
|
||||
idle_register.add<ToolPanelCoordinator>(func, this, false);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user