Solving issue 1762: "Auto Levels does not work with 8-bit images" and issue 1148: "Auto White Balance doesn't work in a File Browser tab"

This commit is contained in:
natureh 510
2013-03-29 11:28:08 +01:00
parent 148c0cbca4
commit 5bd68ce99a
13 changed files with 187 additions and 202 deletions

View File

@@ -94,6 +94,10 @@ namespace rtengine {
dstValue = (unsigned char)(srcValue >> 8);
}
template <>
inline void ImageDatas::convertTo<unsigned char, int> (unsigned char srcValue, int &dstValue) {
dstValue = (int)(srcValue) << 8;
}
template <>
inline void ImageDatas::convertTo<unsigned char, unsigned short> (unsigned char srcValue, unsigned short &dstValue) {
dstValue = (unsigned short)(srcValue) << 8;
}
@@ -435,33 +439,42 @@ namespace rtengine {
for (int i=0; i<height; i++)
for (int j=0; j<width; j++) {
histogram[(int)Color::igamma_srgb (r(i,j))>>histcompr]++;
histogram[(int)Color::igamma_srgb (g(i,j))>>histcompr]++;
histogram[(int)Color::igamma_srgb (b(i,j))>>histcompr]++;
float r_, g_, b_;
convertTo<T, float>(r(i,j), r_);
convertTo<T, float>(g(i,j), g_);
convertTo<T, float>(b(i,j), b_);
histogram[(int)Color::igamma_srgb (r_)>>histcompr]++;
histogram[(int)Color::igamma_srgb (g_)>>histcompr]++;
histogram[(int)Color::igamma_srgb (b_)>>histcompr]++;
}
}
void computeHistogramAutoWB (double &avg_r, double &avg_g, double &avg_b, int &n, LUTu &histogram, int compression) {
void computeHistogramAutoWB (double &avg_r, double &avg_g, double &avg_b, int &n, LUTu &histogram, const int compression) {
histogram.clear();
avg_r = avg_g = avg_b = 0.;
n=0;
for (unsigned int i=0; i<(unsigned int)(height); i++)
for (unsigned int j=0; j<(unsigned int)(width); j++) {
int rtmp = Color::igamma_srgb (r(i,j));
int gtmp = Color::igamma_srgb (g(i,j));
int btmp = Color::igamma_srgb (b(i,j));
float r_, g_, b_;
convertTo<T, float>(r(i,j), r_);
convertTo<T, float>(g(i,j), g_);
convertTo<T, float>(b(i,j), b_);
int rtemp = Color::igamma_srgb (r_);
int gtemp = Color::igamma_srgb (g_);
int btemp = Color::igamma_srgb (b_);
histogram[rtmp>>compression]++;
histogram[gtmp>>compression]+=2;
histogram[btmp>>compression]++;
histogram[rtemp>>compression]++;
histogram[gtemp>>compression]+=2;
histogram[btemp>>compression]++;
if (rtmp<64000 && gtmp<64000 && btmp<64000) {
// autowb computation
avg_r += rtmp;
avg_g += gtmp;
avg_b += btmp;
if (r_>64000.f || g_>64000.f || b_>64000.f) continue;
avg_r += double(r_);
avg_g += double(g_);
avg_b += double(b_);
n++;
}
}
}
ColorTemp getAutoWB () {
@@ -471,46 +484,23 @@ namespace rtengine {
int n = 0;
//int p = 6;
for (int i=1; i<height-1; i++)
for (int j=1; j<width-1; j++) {
if (r(i, j)>64000 || g(i, j)>64000 || b(i, j)>64000)
continue;
avg_r += SQR(r(i, j));
avg_g += SQR(g(i, j));
avg_b += SQR(b(i, j));
for (unsigned int i=0; i<(unsigned int)(height); i++)
for (unsigned int j=0; j<(unsigned int)(width); j++) {
float r_, g_, b_;
convertTo<T, float>(r(i,j), r_);
convertTo<T, float>(g(i,j), g_);
convertTo<T, float>(b(i,j), b_);
if (r_>64000.f || g_>64000.f || b_>64000.f) continue;
avg_r += double(r_);
avg_g += double(g_);
avg_b += double(b_);
/*avg_r += intpow( (double)r(i, j), p);
avg_g += intpow( (double)g(i, j), p);
avg_b += intpow( (double)b(i, j), p);*/
n++;
}
for (int i=1; i<height-1; i++)
for (int j=1; j<width-1; j++) {
if (r(i, j)>64000 || g(i, j)>64000 || b(i, j)>64000)
continue;
avg_r += SQR(r(i, j));
avg_g += SQR(g(i, j));
avg_b += SQR(b(i, j));
/*avg_r += intpow((double)r(i, j), p);
avg_g += intpow((double)g(i, j), p);
avg_b += intpow((double)b(i, j), p);*/
n++;
}
for (int i=1; i<height-1; i++)
for (int j=1; j<width-1; j++) {
if (r(i, j)>64000 || g(i, j)>64000 || b(i, j)>64000)
continue;
avg_r += SQR(r(i, j));
avg_g += SQR(g(i, j));
avg_b += SQR(b(i, j));
/*avg_r += intpow((double)r(i, j), p);
avg_g += intpow((double)g(i, j), p);
avg_b += intpow((double)b(i, j), p);*/
n++;
}
return ColorTemp (sqrt(avg_r/n), sqrt(avg_g/n), sqrt(avg_b/n));
return ColorTemp (avg_r/double(n), avg_g/double(n), avg_b/double(n));
//return ColorTemp (pow(avg_r/n, 1.0/p), pow(avg_g/n, 1.0/p), pow(avg_b/n, 1.0/p));
}
@@ -557,17 +547,23 @@ namespace rtengine {
for (size_t i=0; i<red.size(); i++) {
transformPixel (red[i].x, red[i].y, tran, x, y);
if (x>=0 && y>=0 && x<width && y<height) {
reds += this->r(y, x);
float v;
convertTo<T, float>(this->r(y, x), v);
reds += double(v);
rn++;
}
transformPixel (green[i].x, green[i].y, tran, x, y);
if (x>=0 && y>=0 && x<width && y<height) {
greens += this->g(y, x);
float v;
convertTo<T, float>(this->g(y, x), v);
greens += double(v);
gn++;
}
transformPixel (blue[i].x, blue[i].y, tran, x, y);
if (x>=0 && y>=0 && x<width && y<height) {
blues += this->b(y, x);
float v;
convertTo<T, float>(this->b(y, x), v);
blues += double(v);
bn++;
}
}
@@ -872,33 +868,42 @@ namespace rtengine {
for (int i=0; i<height; i++)
for (int j=0; j<width; j++) {
histogram[(int)Color::igamma_srgb (r(i,j))>>histcompr]++;
histogram[(int)Color::igamma_srgb (g(i,j))>>histcompr]++;
histogram[(int)Color::igamma_srgb (b(i,j))>>histcompr]++;
float r_, g_, b_;
convertTo<T, float>(r(i,j), r_);
convertTo<T, float>(g(i,j), g_);
convertTo<T, float>(b(i,j), b_);
histogram[(int)Color::igamma_srgb (r_)>>histcompr]++;
histogram[(int)Color::igamma_srgb (g_)>>histcompr]++;
histogram[(int)Color::igamma_srgb (b_)>>histcompr]++;
}
}
void computeHistogramAutoWB (double &avg_r, double &avg_g, double &avg_b, int &n, LUTu &histogram, int compression) {
void computeHistogramAutoWB (double &avg_r, double &avg_g, double &avg_b, int &n, LUTu &histogram, const int compression) {
histogram.clear();
avg_r = avg_g = avg_b = 0.;
n=0;
for (unsigned int i=0; i<(unsigned int)(height); i++)
for (unsigned int j=0; j<(unsigned int)(width); j++) {
int rtmp = Color::igamma_srgb (r(i,j));
int gtmp = Color::igamma_srgb (g(i,j));
int btmp = Color::igamma_srgb (b(i,j));
float r_, g_, b_;
convertTo<T, float>(r(i,j), r_);
convertTo<T, float>(g(i,j), g_);
convertTo<T, float>(b(i,j), b_);
int rtemp = Color::igamma_srgb (r_);
int gtemp = Color::igamma_srgb (g_);
int btemp = Color::igamma_srgb (b_);
histogram[rtmp>>compression]++;
histogram[gtmp>>compression]+=2;
histogram[btmp>>compression]++;
histogram[rtemp>>compression]++;
histogram[gtemp>>compression]+=2;
histogram[btemp>>compression]++;
if (rtmp<64000 && gtmp<64000 && btmp<64000) {
// autowb computation
avg_r += rtmp;
avg_g += gtmp;
avg_b += btmp;
if (r_>64000.f || g_>64000.f || b_>64000.f) continue;
avg_r += double(r_);
avg_g += double(g_);
avg_b += double(b_);
n++;
}
}
}
ColorTemp getAutoWB () {
@@ -908,46 +913,23 @@ namespace rtengine {
int n = 0;
//int p = 6;
for (int i=1; i<height-1; i++)
for (int j=1; j<width-1; j++) {
if (r(i, j)>64000 || g(i, j)>64000 || b(i, j)>64000)
continue;
avg_r += SQR(r(i, j));
avg_g += SQR(g(i, j));
avg_b += SQR(b(i, j));
for (unsigned int i=0; i<(unsigned int)(height); i++)
for (unsigned int j=0; j<(unsigned int)(width); j++) {
float r_, g_, b_;
convertTo<T, float>(r(i,j), r_);
convertTo<T, float>(g(i,j), g_);
convertTo<T, float>(b(i,j), b_);
if (r_>64000.f || g_>64000.f || b_>64000.f) continue;
avg_r += double(r_);
avg_g += double(g_);
avg_b += double(b_);
/*avg_r += intpow( (double)r(i, j), p);
avg_g += intpow( (double)g(i, j), p);
avg_b += intpow( (double)b(i, j), p);*/
n++;
}
for (int i=1; i<height-1; i++)
for (int j=1; j<width-1; j++) {
if (r(i, j)>64000 || g(i, j)>64000 || b(i, j)>64000)
continue;
avg_r += SQR(r(i, j));
avg_g += SQR(g(i, j));
avg_b += SQR(b(i, j));
/*avg_r += intpow((double)r(i, j), p);
avg_g += intpow((double)g(i, j), p);
avg_b += intpow((double)b(i, j), p);*/
n++;
}
for (int i=1; i<height-1; i++)
for (int j=1; j<width-1; j++) {
if (r(i, j)>64000 || g(i, j)>64000 || b(i, j)>64000)
continue;
avg_r += SQR(r(i, j));
avg_g += SQR(g(i, j));
avg_b += SQR(b(i, j));
/*avg_r += intpow((double)r(i, j), p);
avg_g += intpow((double)g(i, j), p);
avg_b += intpow((double)b(i, j), p);*/
n++;
}
return ColorTemp (sqrt(avg_r/n), sqrt(avg_g/n), sqrt(avg_b/n));
return ColorTemp (avg_r/double(n), avg_g/double(n), avg_b/double(n));
//return ColorTemp (pow(avg_r/n, 1.0/p), pow(avg_g/n, 1.0/p), pow(avg_b/n, 1.0/p));
}
@@ -994,17 +976,23 @@ namespace rtengine {
for (size_t i=0; i<red.size(); i++) {
transformPixel (red[i].x, red[i].y, tran, x, y);
if (x>=0 && y>=0 && x<width && y<height) {
reds += this->r(y, x);
float v;
convertTo<T, float>(this->r(y, x), v);
reds += double(v);
rn++;
}
transformPixel (green[i].x, green[i].y, tran, x, y);
if (x>=0 && y>=0 && x<width && y<height) {
greens += this->g(y, x);
float v;
convertTo<T, float>(this->g(y, x), v);
greens += double(v);
gn++;
}
transformPixel (blue[i].x, blue[i].y, tran, x, y);
if (x>=0 && y>=0 && x<width && y<height) {
blues += this->b(y, x);
float v;
convertTo<T, float>(this->b(y, x), v);
blues += double(v);
bn++;
}
}

View File

@@ -163,24 +163,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
if (settings->verbose) printf("Demosaic %s\n",rp.dmethod.c_str());
//TODO - denoise branch - is this code for WB params still necessary?
currWB = ColorTemp (params.wb.temperature, params.wb.green, params.wb.method);
if (params.wb.method=="Camera")
currWB = imgsrc->getWB ();
else if (params.wb.method=="Auto") {
if (!awbComputed) {
autoWB = imgsrc->getAutoWB ();
awbComputed = true;
}
currWB = autoWB;
}
params.wb.temperature = currWB.getTemp ();
params.wb.green = currWB.getGreen ();
imgsrc->demosaic( rp );
//imgsrc->getImage (currWB, tr, orig_prev, pp, params.hlrecovery, params.icm, params.raw);
//imgsrc->convertColorSpace(orig_prev, params.icm, params.raw);
if (highDetailNeeded) {
highDetailRawComputed = true;
@@ -190,8 +173,6 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
}
else
highDetailRawComputed = false;
}

View File

@@ -2222,7 +2222,7 @@ void RawImageSource::getRAWHistogram (LUTu & histRedRaw, LUTu & histGreenRaw, LU
if (ri->isBayer()) {
for (int j=start; j<end; j++) {
int c = FC(i, j); // three colors, 0=R, 1=G, 2=B
int c4 = ( c == 1 && !i&1 ) ? 3 : c; // four colors, 0=R, 1=G1, 2=B, 3=G2
int c4 = ( c == 1 && !(i&1) ) ? 3 : c; // four colors, 0=R, 1=G1, 2=B, 3=G2
idx = CLIP((int)Color::gamma(mult*(ri->data[i][j]-(cblacksom[c4]/*+black_lev[c4]*/))));
switch (c) {
@@ -2279,35 +2279,31 @@ void RawImageSource::getRowStartEnd (int x, int &start, int &end) {
int end = min(H+W-fw-i, fw+i) - 32;
for (int j=start; j<end; j++) {
if (!ri->isBayer()) {
double d = CLIP(initialGain*(rawData[i][3*j]));
if (d>64000)
continue;
avg_r += d; rn++;
d = CLIP(initialGain*(rawData[i][3*j+1]));
if (d>64000)
continue;
avg_g += d; gn++;
d = CLIP(initialGain*(rawData[i][3*j+2]));
if (d>64000)
continue;
avg_b += d; bn++;
double dr = CLIP(initialGain*(rawData[i][3*j] ));
double dg = CLIP(initialGain*(rawData[i][3*j+1]));
double db = CLIP(initialGain*(rawData[i][3*j+2]));
if (dr>64000. || dg>64000. || db>64000.) continue;
avg_r += dr;
avg_g += dg;
avg_b += db;
rn = gn = ++bn;
}
else {
int c = FC( i, j);
double d = CLIP(initialGain*(rawData[i][j]));
if (d>64000)
if (d>64000.)
continue;
double dp = d;
if (c==0) {
avg_r += dp;
rn++;
}
else if (c==1) {
avg_g += dp;
// Let's test green first, because they are more numerous
if (c==1) {
avg_g += d;
gn++;
}
else if (c==2) {
avg_b += dp;
else if (c==0) {
avg_r += d;
rn++;
}
else /*if (c==2)*/ {
avg_b += d;
bn++;
}
}
@@ -2318,10 +2314,12 @@ void RawImageSource::getRowStartEnd (int x, int &start, int &end) {
if (!ri->isBayer()) {
for (int i=32; i<H-32; i++)
for (int j=32; j<W-32; j++) {
// each loop read 1 rgb triplet value
double dr = CLIP(initialGain*(rawData[i][3*j] ));
double dg = CLIP(initialGain*(rawData[i][3*j+1]));
double db = CLIP(initialGain*(rawData[i][3*j+2]));
if (dr>64000 || dg>64000 || db>64000) continue;
if (dr>64000. || dg>64000. || db>64000.) continue;
avg_r += dr; rn++;
avg_g += dg;
avg_b += db;
@@ -2338,19 +2336,28 @@ void RawImageSource::getRowStartEnd (int x, int &start, int &end) {
double d[2][2];
for (int i=32; i<H-32; i+=2)
for (int j=32; j<W-32; j+=2) {
//average a Bayer quartet if nobody is clipped
//average each Bayer quartet component individually if non-clipped
d[0][0] = CLIP(initialGain*(rawData[i][j] ));
d[0][1] = CLIP(initialGain*(rawData[i][j+1] ));
d[1][0] = CLIP(initialGain*(rawData[i+1][j] ));
d[1][1] = CLIP(initialGain*(rawData[i+1][j+1]));
if ( d[0][0]>64000 || d[0][1]>64000 || d[1][0]>64000 || d[1][1]>64000 ) continue;
if (d[ey][ex] <= 64000.) {
avg_r += d[ey][ex];
avg_g += d[1-ey][ex] + d[ey][1-ex];
avg_b += d[1-ey][1-ex];
rn++;
}
gn = 2*rn;
bn = rn;
if (d[1-ey][ex] <= 64000.) {
avg_g += d[1-ey][ex];
gn++;
}
if (d[ey][1-ex] <= 64000.) {
avg_g += d[ey][1-ex];
gn++;
}
if (d[1-ey][1-ex] <= 64000.) {
avg_b += d[1-ey][1-ex];
bn++;
}
}
}
}
if( settings->verbose )

View File

@@ -124,7 +124,7 @@ Thumbnail* Thumbnail::loadFromImage (const Glib::ustring& fname, int &w, int &h,
if (n>0) {
ColorTemp cTemp;
cTemp.mul2temp (avg_r/n, avg_g/n, avg_b/n, tpp->autowbTemp, tpp->autowbGreen);
cTemp.mul2temp (avg_r/double(n), avg_g/double(n), avg_b/double(n), tpp->autowbTemp, tpp->autowbGreen);
}
tpp->init ();
@@ -435,21 +435,21 @@ Thumbnail* Thumbnail::loadFromRaw (const Glib::ustring& fname, RawMetaDataLocati
for (int j = start; j < end; j++) {
if (FISGREEN(filter,i,j)) {
double d = tpp->defGain * image[i * width + j][1];
if (d > 64000)
if (d > 64000.)
continue;
avg_g += d;
gn++;
}
if (FISRED(filter,i,j)) {
else if (FISRED(filter,i,j)) {
double d = tpp->defGain * image[i * width + j][0];
if (d > 64000)
if (d > 64000.)
continue;
avg_r += d;
rn++;
}
if (FISBLUE(filter,i,j)) {
else if (FISBLUE(filter,i,j)) {
double d = tpp->defGain * image[i * width + j][2];
if (d > 64000)
if (d > 64000.)
continue;
avg_b += d;
bn++;
@@ -542,11 +542,8 @@ IImage8* Thumbnail::quickProcessImage (const procparams::ProcParams& params, int
Image8* baseImg = resizeTo<Image8>(rwidth, rheight, interp, thumbImg);
if (params.coarse.rotate) {
printf("Thumbnail::quickProcessImage: demande la rotation de l'image de %d degres / %d(%d) x %d(%d) devient ", params.coarse.rotate, baseImg->getW(), baseImg->getWidth(), baseImg->getH(), baseImg->getHeight());
if (params.coarse.rotate)
baseImg->rotate (params.coarse.rotate);
printf("%d(%d) x %d(%d)\n", baseImg->getW(), baseImg->getWidth(), baseImg->getH(), baseImg->getHeight());
}
if (params.coarse.hflip)
baseImg->hflip ();
@@ -907,9 +904,6 @@ void Thumbnail::getSpotWB (const procparams::ProcParams& params, int xp, int yp,
if (params.coarse.vflip) tr |= TR_VFLIP;
// calculate spot wb (copy & pasted from stdimagesource)
unsigned short igammatab[256];
for (int i=0; i<256; i++)
igammatab[i] = (unsigned short)(255.0*pow(i/255.0,Color::sRGBGamma));
double reds = 0, greens = 0, blues = 0;
int rn = 0, gn = 0, bn = 0;
thumbImg->getSpotWBData(reds, greens, blues, rn, gn, bn, red, green, blue, tr);

View File

@@ -302,6 +302,7 @@ ColorTemp StdImageSource::getSpotWB (std::vector<Coord2D> &red, std::vector<Coor
img->getSpotWBData(reds, greens, blues, rn, gn, bn, red, green, blue, tran);
double img_r, img_g, img_b;
wb.getMultipliers (img_r, img_g, img_b);
if( settings->verbose )
printf ("AVG: %g %g %g\n", reds/rn, greens/gn, blues/bn);
return ColorTemp (reds/rn*img_r, greens/gn*img_g, blues/bn*img_b);

View File

@@ -324,6 +324,9 @@ bool FileBrowserEntry::pressNotify (int button, int type, int bstate, int x, i
bool b = ThumbBrowserEntryBase::pressNotify (button, type, bstate, x, y);
if (!iatlistener || !iatlistener->getToolBar())
return true;
ToolMode tm = iatlistener->getToolBar()->getTool ();
int ix = x - startx - ofsX;
int iy = y - starty - ofsY;
@@ -407,13 +410,13 @@ bool FileBrowserEntry::releaseNotify (int button, int type, int bstate, int x, i
if (!b) {
if (state==SRotateSelecting) {
iatlistener->rotateSelectionReady (rot_deg, thumbnail);
iatlistener->getToolBar()->setTool (TMHand);
if (iatlistener->getToolBar()) iatlistener->getToolBar()->setTool (TMHand);
}
else if (cropgl && (state==SCropSelecting || state==SResizeH1 || state==SResizeH2 || state==SResizeW1 || state==SResizeW2 || state==SCropMove)) {
cropgl->cropManipReady ();
cropgl = NULL;
iatlistener->cropSelectionReady ();
iatlistener->getToolBar()->setTool (TMHand);
if (iatlistener->getToolBar()) iatlistener->getToolBar()->setTool (TMHand);
}
state = SNormal;
if (parent)
@@ -472,7 +475,7 @@ bool FileBrowserEntry::onArea (CursorArea a, int x, int y) {
void FileBrowserEntry::updateCursor (int x, int y) {
if (!iatlistener)
if (!iatlistener || !iatlistener->getToolBar())
return;
ToolMode tm = iatlistener->getToolBar()->getTool ();

View File

@@ -49,6 +49,7 @@ FilePanel::FilePanel () : parent(NULL) {
dirpaned->pack1 (*placespaned, false, true);
tpc = new BatchToolPanelCoordinator (this);
tpc->removeWbTool();
fileCatalog = Gtk::manage ( new FileCatalog (tpc->coarse, tpc->getToolBar(),this) );
ribbonPane = Gtk::manage ( new Gtk::Paned() );
ribbonPane->add(*fileCatalog);
@@ -247,7 +248,7 @@ bool FilePanel::handleShortcutKey (GdkEventKey* event) {
}
}
if(tpc->getToolBar()->handleShortcutKey(event))
if(tpc->getToolBar() && tpc->getToolBar()->handleShortcutKey(event))
return true;
if(tpc->handleShortcutKey(event))

View File

@@ -455,7 +455,7 @@ void ImageArea::setPointerMotionHListener (PointerMotionListener* pml) {
ToolMode ImageArea::getToolMode () {
if (listener)
if (listener && listener->getToolBar())
return listener->getToolBar()->getTool ();
else
return TMHand;
@@ -463,7 +463,7 @@ ToolMode ImageArea::getToolMode () {
void ImageArea::setToolHand () {
if (listener)
if (listener && listener->getToolBar())
listener->getToolBar()->setTool (TMHand);
}

View File

@@ -31,6 +31,7 @@ class ImageAreaToolListener {
virtual void cropSelectionReady () {}
virtual void rotateSelectionReady (double rotate_deg, Thumbnail* thm=NULL) {}
virtual ToolBar* getToolBar () { return NULL; }
virtual void removeWbTool() =0;
virtual CropGUIListener* startCropEditing (Thumbnail* thm=NULL) { return NULL; }
};

View File

@@ -108,9 +108,9 @@ class Thumbnail {
const Glib::ustring& getExifString ();
const Glib::ustring& getDateTimeString ();
void getCamWB (double& temp, double& green) { if (tpp) tpp->getCamWB (temp, green); }
void getAutoWB (double& temp, double& green) { if (tpp) tpp->getAutoWB (temp, green); }
void getSpotWB (int x, int y, int rect, double& temp, double& green) { if (tpp) tpp->getSpotWB (getProcParams(), x, y, rect, temp, green); }
void getCamWB (double& temp, double& green) { if (tpp) tpp->getCamWB (temp, green); else temp = green = -1.0; }
void getAutoWB (double& temp, double& green) { if (tpp) tpp->getAutoWB (temp, green); else temp = green = -1.0; }
void getSpotWB (int x, int y, int rect, double& temp, double& green) { if (tpp) tpp->getSpotWB (getProcParams(), x, y, rect, temp, green); else temp = green = -1.0; }
void applyAutoExp (rtengine::procparams::ProcParams& pparams) { if (tpp) tpp->applyAutoExp (pparams); }
ThFileType getType ();

View File

@@ -19,8 +19,7 @@
#include "toolbar.h"
#include "multilangmgr.h"
#include "rtimage.h"
extern Glib::ustring argv0;
#include "guiutils.h"
ToolBar::ToolBar () : listener (NULL) {
@@ -82,11 +81,11 @@ void ToolBar::setTool (ToolMode tool) {
handConn.block (true);
cropConn.block (true);
wbConn.block (true);
if (wbTool) wbConn.block (true);
straConn.block (true);
handTool->set_active (false);
wbTool->set_active (false);
if (wbTool) wbTool->set_active (false);
cropTool->set_active (false);
straTool->set_active (false);
@@ -95,7 +94,7 @@ void ToolBar::setTool (ToolMode tool) {
handTool->grab_focus();; // switch focus to the handTool button
}
else if (tool==TMSpotWB)
wbTool->set_active (true);
if (wbTool) wbTool->set_active (true);
else if (tool==TMCropSelect)
cropTool->set_active (true);
else if (tool==TMStraighten)
@@ -105,7 +104,7 @@ void ToolBar::setTool (ToolMode tool) {
handConn.block (false);
cropConn.block (false);
wbConn.block (false);
if (wbTool) wbConn.block (false);
straConn.block (false);
}
@@ -113,10 +112,10 @@ void ToolBar::hand_pressed () {
handConn.block (true);
cropConn.block (true);
wbConn.block (true);
if (wbTool) wbConn.block (true);
straConn.block (true);
if (current!=TMHand) {
wbTool->set_active (false);
if (wbTool) wbTool->set_active (false);
cropTool->set_active (false);
straTool->set_active (false);
current = TMHand;
@@ -124,7 +123,7 @@ void ToolBar::hand_pressed () {
handTool->set_active (true);
handConn.block (false);
cropConn.block (false);
wbConn.block (false);
if (wbTool) wbConn.block (false);
straConn.block (false);
if (listener)
@@ -135,7 +134,7 @@ void ToolBar::wb_pressed () {
handConn.block (true);
cropConn.block (true);
wbConn.block (true);
if (wbTool) wbConn.block (true);
straConn.block (true);
if (current!=TMSpotWB) {
handTool->set_active (false);
@@ -143,10 +142,10 @@ void ToolBar::wb_pressed () {
straTool->set_active (false);
current = TMSpotWB;
}
wbTool->set_active (true);
if (wbTool) wbTool->set_active (true);
handConn.block (false);
cropConn.block (false);
wbConn.block (false);
if (wbTool) wbConn.block (false);
straConn.block (false);
if (listener)
@@ -157,11 +156,11 @@ void ToolBar::crop_pressed () {
handConn.block (true);
cropConn.block (true);
wbConn.block (true);
if (wbTool) wbConn.block (true);
straConn.block (true);
if (current!=TMCropSelect) {
handTool->set_active (false);
wbTool->set_active (false);
if (wbTool) wbTool->set_active (false);
straTool->set_active (false);
current = TMCropSelect;
}
@@ -179,18 +178,18 @@ void ToolBar::stra_pressed () {
handConn.block (true);
cropConn.block (true);
wbConn.block (true);
if (wbTool) wbConn.block (true);
straConn.block (true);
if (current!=TMStraighten) {
handTool->set_active (false);
wbTool->set_active (false);
if (wbTool) wbTool->set_active (false);
cropTool->set_active (false);
current = TMStraighten;
}
straTool->set_active (true);
handConn.block (false);
cropConn.block (false);
wbConn.block (false);
if (wbTool) wbConn.block (false);
straConn.block (false);
if (listener)
@@ -231,3 +230,11 @@ bool ToolBar::handleShortcutKey (GdkEventKey* event) {
return false;
}
void ToolBar::removeWbTool() {
if (wbTool) {
wbConn.disconnect();
removeIfThere(this, wbTool, false);
wbTool = NULL;
}
}

View File

@@ -57,6 +57,7 @@ class ToolBar : public Gtk::HBox {
void stra_pressed ();
bool handleShortcutKey (GdkEventKey* event);
void removeWbTool();
};
#endif

View File

@@ -232,6 +232,7 @@ class ToolPanelCoordinator : public ToolPanelListener,
void cropSelectionReady ();
void rotateSelectionReady (double rotate_deg, Thumbnail* thm=NULL);
ToolBar* getToolBar () { return toolBar; }
void removeWbTool() { if (toolBar) toolBar->removeWbTool(); }
int getSpotWBRectSize ();
CropGUIListener* startCropEditing (Thumbnail* thm=NULL) { return crop; }