From 9bb5164cce0f90f4d19f751478b481296ad24acb Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 22 Mar 2017 14:13:51 +0100 Subject: [PATCH] allow translation of demosaic methods; hide Sub-Image selector for files with onyl 1 raw file; ... --- rtdata/languages/default | 12 +++++++ rtengine/array2D.h | 2 +- rtengine/imagesource.h | 6 ++-- rtengine/improccoordinator.cc | 12 ++++++- rtengine/improccoordinator.h | 12 +++++++ rtengine/pixelshift.cc | 63 +++++++++++++++-------------------- rtengine/rawimagesource.h | 2 ++ rtengine/rtengine.h | 16 +++++++++ rtengine/stdimagesource.h | 4 +++ rtgui/bayerprocess.cc | 27 +++++++++++++-- rtgui/bayerprocess.h | 4 +-- rtgui/defringe.cc | 1 - rtgui/sharpenedge.cc | 2 -- rtgui/sharpenmicro.cc | 2 -- rtgui/toolpanel.h | 12 +++++++ rtgui/toolpanelcoord.cc | 22 +++++++++++- rtgui/toolpanelcoord.h | 4 ++- rtgui/vibrance.cc | 2 -- 18 files changed, 149 insertions(+), 56 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 4d3bdab5c..4626c1c9b 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1748,6 +1748,18 @@ TP_RAW_PIXELSHIFTREDBLUEWEIGHT;Red&Blue weight TP_RAW_SENSOR_BAYER_LABEL;Sensor with Bayer Matrix TP_RAW_SENSOR_XTRANS_DMETHOD_TOOLTIP;3-pass gives best results (recommended for low ISO images).\n1-pass is almost undistinguishable from 3-pass for high ISO images and is faster. TP_RAW_SENSOR_XTRANS_LABEL;Sensor with X-Trans Matrix +TP_RAW_AMAZE;AMaZE +TP_RAW_IGV;igv +TP_RAW_LMMSE;lmmse +TP_RAW_EAHD;eahd +TP_RAW_HPHD;hphd +TP_RAW_VNG4;vng4 +TP_RAW_DCB;dcb +TP_RAW_AHD;ahd +TP_RAW_FAST;fast +TP_RAW_MONO;mono +TP_RAW_NONE;none (show sensor pattern) +TP_RAW_PIXELSHIFT;Pixel Shift (Pentax) TP_RESIZE_APPLIESTO;Applies to: TP_RESIZE_CROPPEDAREA;Cropped Area TP_RESIZE_FITBOX;Bounding Box diff --git a/rtengine/array2D.h b/rtengine/array2D.h index 2fe4ecad4..8a77bfc3c 100644 --- a/rtengine/array2D.h +++ b/rtengine/array2D.h @@ -202,7 +202,7 @@ public: } // use with indices - T * operator[](int index) + T * operator[](int index) const { assert((index >= 0) && (index < y)); return ptr[index]; diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 8998fa848..8b4377c89 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -81,14 +81,12 @@ public: virtual bool IsrgbSourceModified() const = 0; // tracks whether cached rgb output of demosaic has been modified virtual void setCurrentFrame(unsigned int frameNum) = 0; + virtual int getFrameCount() = 0; // use right after demosaicing image, add coarse transformation and put the result in the provided Imagefloat* virtual void getImage (const ColorTemp &ctemp, int tran, Imagefloat* image, const PreviewProps &pp, const ToneCurveParams &hlp, const ColorManagementParams &cmp, const RAWParams &raw) = 0; - virtual eSensorType getSensorType () - { - return ST_NONE; - } + virtual eSensorType getSensorType () const = 0; // true is ready to provide the AutoWB, i.e. when the image has been demosaiced for RawImageSource virtual bool isWBProviderReady () = 0; diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 31a09ef22..179947948 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -87,7 +87,7 @@ ImProcCoordinator::ImProcCoordinator () fw(0), fh(0), tr(0), fullw(1), fullh(1), pW(-1), pH(-1), - plistener(nullptr), imageListener(nullptr), aeListener(nullptr), acListener(nullptr), abwListener(nullptr), awbListener(nullptr), actListener(nullptr), adnListener(nullptr), awavListener(nullptr), dehaListener(nullptr), hListener(nullptr), + plistener(nullptr), imageListener(nullptr), aeListener(nullptr), acListener(nullptr), abwListener(nullptr), awbListener(nullptr), actListener(nullptr), adnListener(nullptr), awavListener(nullptr), dehaListener(nullptr), frameCountListener(nullptr), imageTypeListener(nullptr), hListener(nullptr), resultValid(false), lastOutputProfile("BADFOOD"), lastOutputIntent(RI__COUNT), lastOutputBPC(false), thread(nullptr), changeSinceLast(0), updaterRunning(false), destroying(false), utili(false), autili(false), wavcontlutili(false), butili(false), ccutili(false), cclutili(false), clcutili(false), opautili(false), conversionBuffer(1, 1), colourToningSatLimit(0.f), colourToningSatLimitOpacity(0.f) {} @@ -183,9 +183,14 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) progress ("Applying white balance, color correction & sRGB conversion...", 100 * readyphase / numofphases); + if(frameCountListener) { + frameCountListener->FrameCountChanged(imgsrc->getFrameCount(), params.raw.bayersensor.imageNum); + } + // raw auto CA is bypassed if no high detail is needed, so we have to compute it when high detail is needed if ( (todo & M_PREPROC) || (!highDetailPreprocessComputed && highDetailNeeded)) { imgsrc->setCurrentFrame(params.raw.bayersensor.imageNum); + imgsrc->preprocess( rp, params.lensProf, params.coarse ); imgsrc->getRAWHistogram( histRedRaw, histGreenRaw, histBlueRaw ); @@ -208,6 +213,10 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) */ // If high detail (=100%) is newly selected, do a demosaic update, since the last was just with FAST + if(imageTypeListener) { + imageTypeListener->imageTypeChanged(imgsrc->isRAW(), imgsrc->getSensorType() == ST_BAYER, imgsrc->getSensorType() == ST_FUJI_XTRANS); + } + if ( (todo & M_RAW) || (!highDetailRawComputed && highDetailNeeded) || ( params.toneCurve.hrenabled && params.toneCurve.method != "Color" && imgsrc->IsrgbSourceModified()) @@ -834,6 +843,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) updateLRGBHistograms (); hListener->histogramChanged (histRed, histGreen, histBlue, histLuma, histToneCurve, histLCurve, histCCurve, /*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRedRaw, histGreenRaw, histBlueRaw, histChroma, histLRETI); } + } diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index bf1e28aaa..19fce3a76 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -158,6 +158,8 @@ protected: AutoCamListener* acListener; AutoBWListener* abwListener; AutoWBListener* awbListener; + FrameCountListener *frameCountListener; + ImageTypeListener *imageTypeListener; AutoColorTonListener* actListener; AutoChromaListener* adnListener; @@ -335,6 +337,16 @@ public: awavListener = awa; } + void setFrameCountListener (FrameCountListener* fcl) + { + frameCountListener = fcl; + } + + void setImageTypeListener (ImageTypeListener* itl) + { + imageTypeListener = itl; + } + void saveInputICCReference (const Glib::ustring& fname, bool apply_wb); InitialImage* getInitialImage () diff --git a/rtengine/pixelshift.cc b/rtengine/pixelshift.cc index 0ef4f6b6b..0986844f5 100644 --- a/rtengine/pixelshift.cc +++ b/rtengine/pixelshift.cc @@ -133,7 +133,7 @@ void paintMotionMask(int index, bool showMotion, float gridMax, bool showOnlyMas } } -void invertMask(int xStart, int xEnd, int yStart, int yEnd, array2D &maskIn, array2D &maskOut) +void invertMask(int xStart, int xEnd, int yStart, int yEnd, const array2D &maskIn, array2D &maskOut) { #pragma omp parallel for schedule(dynamic,16) @@ -146,7 +146,7 @@ void invertMask(int xStart, int xEnd, int yStart, int yEnd, array2D &ma } } -void xorMasks(int xStart, int xEnd, int yStart, int yEnd, array2D &maskIn, array2D &maskOut) +void xorMasks(int xStart, int xEnd, int yStart, int yEnd, const array2D &maskIn, array2D &maskOut) { #pragma omp parallel for schedule(dynamic,16) @@ -375,7 +375,7 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA for(int i=0, frameIndex = 0;i<4;++i) { if(i != currFrame) { if(bayerParams.pixelShiftLmmse) { - lmmse_interpolate_omp(winw, winh, *(rawDataFrames[i]), redTmp[frameIndex], greenTmp[frameIndex], blueTmp[frameIndex], raw.bayersensor.lmmse_iterations); + lmmse_interpolate_omp(winw, winh, *(rawDataFrames[i]), redTmp[frameIndex], greenTmp[frameIndex], blueTmp[frameIndex], bayerParams.lmmse_iterations); } else { amaze_demosaic_RT (0, 0, winw, winh, *(rawDataFrames[i]), redTmp[frameIndex], greenTmp[frameIndex], blueTmp[frameIndex]); } @@ -689,9 +689,9 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA #ifdef PIXELSHIFTDEV std::cout << "WL: " << c_white[0] << " BL: " << c_black[0] << " ePerIso multiplicator: " << (65535.f / (c_white[0] - c_black[0])) << std::endl; #endif - float eperIsoRed = (eperIso / scale_mul[0]) * (65535.f / (c_white[0] - c_black[0])); - float eperIsoGreen = (eperIso * scaleGreen) * (65535.f / (c_white[1] - c_black[1])); - float eperIsoBlue = (eperIso / scale_mul[2]) * (65535.f / (c_white[2] - c_black[2])); + const float eperIsoRed = (eperIso / scale_mul[0]) * (65535.f / (c_white[0] - c_black[0])); + const float eperIsoGreen = (eperIso * scaleGreen) * (65535.f / (c_white[1] - c_black[1])); + const float eperIsoBlue = (eperIso / scale_mul[2]) * (65535.f / (c_white[2] - c_black[2])); const float clippedRed = 65535.f / scale_mul[0]; const float clippedBlue = 65535.f / scale_mul[2]; @@ -705,7 +705,7 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA nRead *= nRead; // If the values of two corresponding green pixels differ my more then motionThreshold %, the pixel will be treated as a badGreen pixel - float motionThreshold = 1.f - (motion / 100.f); + const float motionThreshold = 1.f - (motion / 100.f); // For shades of green motion indicators const float blendFactor = ((adaptive || motion == 0.f) ? 1.f : 1.f / (1.f - motionThreshold)); @@ -733,12 +733,6 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA } } - const float thresh = adaptive ? 0.f : motionThreshold; - array2D psRed(winw + 32, winh); // increase width to avoid cache conflicts - array2D psG1(winw + 32, winh); - array2D psG2(winw + 32, winh); - array2D psBlue(winw + 32, winh); - // calculate average green brightness for each frame float greenBrightness[4] = {1.f, 1.f, 1.f, 1.f}; @@ -766,18 +760,9 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA #endif for(int i = winy + 1; i < winh - 1; ++i) { - int j = winx + 1; - int c = FC(i, j); - - // offset to keep the code short. It changes its value between 0 and 1 for each iteration of the loop - unsigned int offset = c & 1; - - for(; j < winw - 1; ++j) { - float green1 = (*rawDataFrames[1 - offset])[i - offset + 1][j]; - float green2 = (*rawDataFrames[3 - offset])[i + offset][j + 1]; - (*histoThr[1 - offset])[green1]++; - (*histoThr[3 - offset])[green2]++; - offset ^= 1; // 0 => 1 or 1 => 0 + for(int j = winx + 1, offset = FC(i, j) & 1; j < winw - 1; ++j, offset ^= 1) { + (*histoThr[1 - offset])[(*rawDataFrames[1 - offset])[i - offset + 1][j]]++; + (*histoThr[3 - offset])[(*rawDataFrames[3 - offset])[i + offset][j + 1]]++; } } @@ -817,6 +802,12 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA } + const float thresh = adaptive ? 0.f : motionThreshold; + array2D psRed(winw + 32, winh); // increase width to avoid cache conflicts + array2D psG1(winw + 32, winh); + array2D psG2(winw + 32, winh); + array2D psBlue(winw + 32, winh); + // fill channels psRed, psG1, psG2 and psBlue #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) @@ -1336,7 +1327,6 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA } array2D mask(W, H, ARRAY2D_CLEAR_DATA); - array2D maskInv(W, H, ARRAY2D_CLEAR_DATA); #pragma omp parallel for schedule(dynamic,16) @@ -1346,7 +1336,7 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA for(int v = -1; v <= 1; v++) { for(int h = -1; h < 1; h++) { - v3sum[1 + h] += (psMask[i + v][j + h]); + v3sum[1 + h] += psMask[i + v][j + h]; } } @@ -1366,6 +1356,7 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA } if(holeFill) { + array2D maskInv(W, H); invertMask(winx + border - offsX, winw - (border + offsX), winy + border - offsY, winh - (border + offsY), mask, maskInv); floodFill4(winx + border - offsX, winw - (border + offsX), winy + border - offsY, winh - (border + offsY), maskInv); xorMasks(winx + border - offsX, winw - (border + offsX), winy + border - offsY, winh - (border + offsY), maskInv, mask); @@ -1403,21 +1394,21 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA if(mask[i][j] == 255) { paintMotionMask(j + offsX, showMotion, 0.5f, showOnlyMask, greenDest, redDest, blueDest); } else if(showOnlyMask) { // we want only motion mask => paint areas without motion in pure black - red[i + offsY][j + offsX] = green[i + offsY][j + offsX] = blue[i + offsY][j + offsX] = 0.f; + redDest[j + offsX] = greenDest[j + offsX] = blueDest[j + offsX] = 0.f; } else { if(smoothTransitions) { #ifdef __SSE2__ - float blend = psMask[i][j]; + const float blend = psMask[i][j]; #else - float blend = smoothFactor == 0.f ? 1.f : pow_F(std::max(psMask[i][j] - 1.f, 0.f), smoothFactor); + const float blend = smoothFactor == 0.f ? 1.f : pow_F(std::max(psMask[i][j] - 1.f, 0.f), smoothFactor); #endif - red[i + offsY][j + offsX] = intp(blend, red[i + offsY][j + offsX], psRed[i][j] ); - green[i + offsY][j + offsX] = intp(blend, green[i + offsY][j + offsX], (psG1[i][j] + psG2[i][j]) * 0.5f); - blue[i + offsY][j + offsX] = intp(blend, blue[i + offsY][j + offsX], psBlue[i][j]); + redDest[j + offsX] = intp(blend, redDest[j + offsX], psRed[i][j] ); + greenDest[j + offsX] = intp(blend, greenDest[j + offsX], (psG1[i][j] + psG2[i][j]) * 0.5f); + blueDest[j + offsX] = intp(blend, blueDest[j + offsX], psBlue[i][j]); } else { - red[i + offsY][j + offsX] = psRed[i][j]; - green[i + offsY][j + offsX] = (psG1[i][j] + psG2[i][j]) * 0.5f; - blue[i + offsY][j + offsX] = psBlue[i][j]; + redDest[j + offsX] = psRed[i][j]; + greenDest[j + offsX] = (psG1[i][j] + psG2[i][j]) * 0.5f; + blueDest[j + offsX] = psBlue[i][j]; } } } diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 0efa2b828..cfcda8477 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -204,6 +204,8 @@ public: currFrame = std::min(numFrames - 1, frameNum); ri = riFrames[currFrame]; } + int getFrameCount() {return numFrames;} + protected: typedef unsigned short ushort; void processFalseColorCorrection (Imagefloat* i, const int steps); diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index edcbae351..729363d35 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -317,6 +317,20 @@ public : virtual void WBChanged(double temp, double green) = 0; }; +class FrameCountListener +{ +public : + virtual ~FrameCountListener() = default; + virtual void FrameCountChanged(int n, int frameNum) = 0; +}; + +class ImageTypeListener +{ +public : + virtual ~ImageTypeListener() = default; + virtual void imageTypeChanged(bool isRaw, bool isBayer, bool isXtrans) = 0; +}; + class WaveletListener { public : @@ -417,12 +431,14 @@ public: virtual void setHistogramListener (HistogramListener *l) = 0; virtual void setPreviewImageListener (PreviewImageListener* l) = 0; virtual void setAutoCamListener (AutoCamListener* l) = 0; + virtual void setFrameCountListener (FrameCountListener* l) = 0; virtual void setAutoBWListener (AutoBWListener* l) = 0; virtual void setAutoWBListener (AutoWBListener* l) = 0; virtual void setAutoColorTonListener (AutoColorTonListener* l) = 0; virtual void setAutoChromaListener (AutoChromaListener* l) = 0; virtual void setRetinexListener (RetinexListener* l) = 0; virtual void setWaveletListener (WaveletListener* l) = 0; + virtual void setImageTypeListener (ImageTypeListener* l) = 0; virtual void setMonitorProfile (const Glib::ustring& monitorProfile, RenderingIntent intent) = 0; virtual void getMonitorProfile (Glib::ustring& monitorProfile, RenderingIntent& intent) const = 0; diff --git a/rtengine/stdimagesource.h b/rtengine/stdimagesource.h index 1dbddf325..baff5559d 100644 --- a/rtengine/stdimagesource.h +++ b/rtengine/stdimagesource.h @@ -51,6 +51,8 @@ public: void getAutoWBMultipliers (double &rm, double &gm, double &bm); ColorTemp getSpotWB (std::vector &red, std::vector &green, std::vector &blue, int tran, double equal); + eSensorType getSensorType() const {return ST_NONE;} + bool isWBProviderReady () { return true; @@ -96,6 +98,8 @@ public: return rgbSourceModified; } void setCurrentFrame(unsigned int frameNum) {} + int getFrameCount() {return 1;} + void getRawValues(int x, int y, int rotate, int &R, int &G, int &B) { R = G = B = 0;} diff --git a/rtgui/bayerprocess.cc b/rtgui/bayerprocess.cc index 75b27b360..ba7cfa8e8 100644 --- a/rtgui/bayerprocess.cc +++ b/rtgui/bayerprocess.cc @@ -30,7 +30,7 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA method = Gtk::manage (new MyComboBoxText ()); for( size_t i = 0; i < procparams::RAWParams::BayerSensor::numMethods; i++) { - method->append(procparams::RAWParams::BayerSensor::methodstring[i]); + method->append(M("TP_RAW_" + Glib::ustring(procparams::RAWParams::BayerSensor::methodstring[i]).uppercase())); } method->set_active(0); @@ -397,7 +397,7 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params pixelShiftNonGreenCross2->setValue (pp->raw.bayersensor.pixelShiftNonGreenCross2); pixelShiftNonGreenAmaze->setValue (pp->raw.bayersensor.pixelShiftNonGreenAmaze); pixelShiftMotion->setValue (pp->raw.bayersensor.pixelShiftMotion); - pixelShiftMotionCorrection->setValue ((int)pp->raw.bayersensor.pixelShiftMotionCorrection); + pixelShiftMotionCorrection->set_active ((int)pp->raw.bayersensor.pixelShiftMotionCorrection); if (!batchMode) { pixelShiftHoleFill->set_sensitive (pixelShiftAutomatic->getValue () != CheckValue::off && pixelShiftMotionCorrection->get_active_row_number() == 5); pixelShiftBlur->set_sensitive(pixelShiftAutomatic->getValue () != CheckValue::off && pixelShiftMotionCorrection->get_active_row_number() == 5); @@ -850,7 +850,7 @@ void BayerProcess::checkBoxToggled (CheckBox* c, CheckValue newval) #ifdef PIXELSHIFTDEV else if (c == pixelShiftAutomatic) { if (!batchMode) { - pixelShiftMotion->set_sensitive(!newval != CheckValue::off); + pixelShiftMotion->set_sensitive(newval != CheckValue::off); pixelShiftEperIso->set_sensitive(newval != CheckValue::off); pixelShiftNreadIso->set_sensitive(newval != CheckValue::off); pixelShiftPrnu->set_sensitive(newval != CheckValue::off); @@ -925,3 +925,24 @@ void BayerProcess::pixelShiftMotionMethodChanged () listener->panelChanged (EvPixelShiftMotionMethod, pixelShiftMotionMethod->get_active_text()); } } + +void BayerProcess::FrameCountChanged(int n, int frameNum) +{ + GThreadLock lock; + imageNumber->block (true); + + imageNumber->remove_all(); + imageNumber->append("1"); + for(int i = 2; i <= std::min(n, 4); ++i) { + std::ostringstream entry; + entry << i; + imageNumber->append(entry.str()); + } + imageNumber->set_active(std::min(frameNum, n - 1)); + if(n == 1) { + imageNumberBox->hide(); + } else { + imageNumberBox->show(); + } + imageNumber->block (false); +} diff --git a/rtgui/bayerprocess.h b/rtgui/bayerprocess.h index 9c2285951..8f6e794d0 100644 --- a/rtgui/bayerprocess.h +++ b/rtgui/bayerprocess.h @@ -25,8 +25,7 @@ #include "guiutils.h" #include "toolpanel.h" - -class BayerProcess : public ToolParamBlock, public AdjusterListener, public CheckBoxListener, public FoldableToolPanel +class BayerProcess : public ToolParamBlock, public AdjusterListener, public CheckBoxListener, public FoldableToolPanel, public rtengine::FrameCountListener { protected: @@ -88,6 +87,7 @@ public: void adjusterChanged (Adjuster* a, double newval); void checkBoxToggled (CheckBox* c, CheckValue newval); void pixelShiftMotionMethodChanged(); + void FrameCountChanged(int n, int frameNum); #ifdef PIXELSHIFTDEV void psMotionCorrectionChanged (); #endif diff --git a/rtgui/defringe.cc b/rtgui/defringe.cc index 8d7287ac1..0ba3dec9f 100644 --- a/rtgui/defringe.cc +++ b/rtgui/defringe.cc @@ -58,7 +58,6 @@ Defringe::Defringe () : FoldableToolPanel(this, "defringe", M("TP_DEFRINGE_LABEL pack_start (*curveEditorPF, Gtk::PACK_SHRINK, 4); - show (); } Defringe::~Defringe () diff --git a/rtgui/sharpenedge.cc b/rtgui/sharpenedge.cc index d21fe54aa..8849ffa72 100644 --- a/rtgui/sharpenedge.cc +++ b/rtgui/sharpenedge.cc @@ -48,8 +48,6 @@ SharpenEdge::SharpenEdge () : FoldableToolPanel(this, "sharpenedge", M("TP_SHARP pack_start( *amount, Gtk::PACK_SHRINK, 0);//amount pack_start( *threechannels, Gtk::PACK_SHRINK, 0);//one or 3 channels Lab - show (); - chanthreeconn = threechannels->signal_toggled().connect( sigc::mem_fun(*this, &SharpenEdge::chanthree_toggled) ); } diff --git a/rtgui/sharpenmicro.cc b/rtgui/sharpenmicro.cc index 62e982436..871e0d38b 100644 --- a/rtgui/sharpenmicro.cc +++ b/rtgui/sharpenmicro.cc @@ -53,8 +53,6 @@ SharpenMicro::SharpenMicro () : FoldableToolPanel(this, "sharpenmicro", M("TP_SH pack_start( *amount, Gtk::PACK_SHRINK, 0); pack_start( *uniformity, Gtk::PACK_SHRINK, 0); - show (); - matrixconn = matrix->signal_toggled().connect( sigc::mem_fun(*this, &SharpenMicro::matrix_toggled) ); } diff --git a/rtgui/toolpanel.h b/rtgui/toolpanel.h index bb58222d3..d5814c040 100644 --- a/rtgui/toolpanel.h +++ b/rtgui/toolpanel.h @@ -160,6 +160,18 @@ public: exp->set_expanded( expanded ); } } + + void hide() { + if (exp && !batchMode) { // conditional hide + exp->hide(); + } + } + + void show() { + if (exp) { // always show + exp->show(); + } + } bool getExpanded () { if (exp) { diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index 71281abd3..43393d90b 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -309,6 +309,25 @@ ToolPanelCoordinator::~ToolPanelCoordinator () delete toolBar; } +void ToolPanelCoordinator::imageTypeChanged(bool isRaw, bool isBayer, bool isXtrans) +{ + + if(isRaw) { + rawPanelSW->set_sensitive(true); + if (isBayer) { + sensorxtrans->FoldableToolPanel::hide(); + sensorbayer->FoldableToolPanel::show(); + } else if (isXtrans) { + sensorxtrans->FoldableToolPanel::show(); + sensorbayer->FoldableToolPanel::hide(); + } + } else { + rawPanelSW->set_sensitive(false); + } + +} + + void ToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const Glib::ustring& descr) { @@ -488,14 +507,15 @@ void ToolPanelCoordinator::initImage (rtengine::StagedImageProcessor* ipc_, bool ipc->setAutoExpListener (toneCurve); ipc->setAutoCamListener (colorappearance); ipc->setAutoBWListener (blackwhite); + ipc->setFrameCountListener (bayerprocess); ipc->setAutoWBListener (whitebalance); ipc->setAutoColorTonListener (colortoning); ipc->setAutoChromaListener (dirpyrdenoise); ipc->setWaveletListener (wavelet); ipc->setRetinexListener (retinex); - ipc->setSizeListener (crop); ipc->setSizeListener (resize); + ipc->setImageTypeListener (this); } flatfield->setShortcutPath(Glib::path_get_dirname(ipc->getInitialImage()->getFileName())); diff --git a/rtgui/toolpanelcoord.h b/rtgui/toolpanelcoord.h index 68a458916..4dedf7dad 100644 --- a/rtgui/toolpanelcoord.h +++ b/rtgui/toolpanelcoord.h @@ -92,7 +92,8 @@ class ToolPanelCoordinator : public ToolPanelListener, public SpotWBListener, public CropPanelListener, public ICMPanelListener, - public ImageAreaToolListener + public ImageAreaToolListener, + public rtengine::ImageTypeListener { protected: @@ -229,6 +230,7 @@ public: // toolpanellistener interface void panelChanged (rtengine::ProcEvent event, const Glib::ustring& descr); + void imageTypeChanged(bool isRaw, bool isBayer, bool isXtrans); // profilechangelistener interface void profileChange (const rtengine::procparams::PartialProfile* nparams, rtengine::ProcEvent event, const Glib::ustring& descr, const ParamsEdited* paramsEdited = nullptr); void setDefaults (rtengine::procparams::ProcParams* defparams); diff --git a/rtgui/vibrance.cc b/rtgui/vibrance.cc index 9aa58d1c5..51cb31a02 100644 --- a/rtgui/vibrance.cc +++ b/rtgui/vibrance.cc @@ -77,8 +77,6 @@ Vibrance::Vibrance () : FoldableToolPanel(this, "vibrance", M("TP_VIBRANCE_LABEL pack_start (*curveEditorGG, Gtk::PACK_SHRINK, 4); - show (); - pskinsconn = protectSkins->signal_toggled().connect( sigc::mem_fun(*this, &Vibrance::protectskins_toggled) ); ashiftconn = avoidColorShift->signal_toggled().connect( sigc::mem_fun(*this, &Vibrance::avoidcolorshift_toggled) ); pastsattogconn = pastSatTog->signal_toggled().connect( sigc::mem_fun(*this, &Vibrance::pastsattog_toggled) );