Merge of andreyskv-classicui with default

This commit is contained in:
Andrey Skvortsov
2010-10-06 19:06:06 -07:00
46 changed files with 3751 additions and 3117 deletions

View File

@@ -1,6 +1,3 @@
!!!!!!!!!!!!!!!!!!!!!!!!!
! Untranslated keys follow; remove the ! prefix after an entry is translated.
!!!!!!!!!!!!!!!!!!!!!!!!!

View File

@@ -412,7 +412,8 @@ PREFERENCES_DIRLAST;Last visited directory
PREFERENCES_DIROTHER;Other
PREFERENCES_DIRSELECTDLG;Select Image Directory at Startup...
PREFERENCES_DIRSOFTWARE;Installation directory
PREFERENCES_DMETHOD;Method
PREFERENCES_DMETHOD;Preview
PREFERENCES_DMETHODBATCH;Batch
PREFERENCES_EDITORCMDLINE;Other command line
PREFERENCES_EXTERNALEDITOR;External editor
PREFERENCES_FALSECOLOR;False color suppression steps
@@ -471,6 +472,10 @@ PREFERENCES_TAB_GENERAL;General
PREFERENCES_TAB_IMPROC;Image Processing
PREFERENCES_TAB_OUTPUT;Output Options
PREFERENCES_THUMBSIZE;Thumbnail Size
PREFERENCES_WORKFLOW;Workflow
PREFERENCES_EDITORLAYOUT;Editor Layout
PREFERENCES_SINGLETAB;Single tab mode
PREFERENCES_MULTITAB;Multiple tabs mode
PROFILEPANEL_FILEDLGFILTERANY;Any files
PROFILEPANEL_FILEDLGFILTERPP;Postprocessing profiles
PROFILEPANEL_LABEL;Postprocessing Profiles

View File

@@ -1,5 +1,6 @@
[General]
TabbedEditor=true
StoreLastProfile=true
StartupDirectory=last
StartupPath=
@@ -85,6 +86,7 @@ ToolPanelsExpanded=1;1;0;0;0;1;1;0;0;0;0;1;1;0;0;0;0;0;
[Algorithms]
DemosaicMethod=hphd
DemosaicMethodBatch=hphd
ColorCorrection=1
[Crop Settings]

View File

@@ -1,5 +1,6 @@
[General]
TabbedEditor=true
StoreLastProfile=true
StartupDirectory=last
StartupPath=
@@ -85,6 +86,7 @@ ToolPanelsExpanded=1;1;0;0;0;1;1;0;0;0;0;1;1;0;0;0;0;0;
[Algorithms]
DemosaicMethod=hphd
DemosaicMethodBatch=hphd
ColorCorrection=1
[Crop Settings]

View File

@@ -1,5 +1,6 @@
[General]
TabbedEditor=true
StoreLastProfile=true
StartupDirectory=last
StartupPath=
@@ -85,6 +86,7 @@ ToolPanelsExpanded=1;1;0;0;0;1;1;0;0;0;0;1;1;0;0;0;0;0;
[Algorithms]
DemosaicMethod=hphd
DemosaicMethodBatch=hphd
ColorCorrection=1
[Crop Settings]

View File

@@ -65,7 +65,7 @@ class ImageSource : public InitialImage {
ImageSource () : references (1), embProfile(NULL), idata(NULL) {}
virtual ~ImageSource () {}
virtual int load (Glib::ustring fname) =0;
virtual int load (Glib::ustring fname, bool batch = false) =0;
virtual void getImage (ColorTemp ctemp, int tran, Image16* image, PreviewProps pp, HRecParams hlp, ColorManagementParams cmp) {}
virtual ColorTemp getWB () =0;
virtual ColorTemp getAutoWB () =0;

View File

@@ -20,6 +20,7 @@
#include <curves.h>
#include <mytime.h>
#include <refreshmap.h>
#include <simpleprocess.h>
#define CLIPTO(a,b,c) ((a)>b?((a)<c?(a):c):b)
#define CLIP(a) ((a)<65535 ? (a) : (65535));
@@ -258,7 +259,16 @@ void ImProcCoordinator::updatePreviewImage (int todo) {
progress ("Conversion to RGB...",100*readyphase/numofphases);
if (todo!=CROP) {
previmg->getMutex().lock();
ipf.lab2rgb (nprevl, previmg);
try
{
ipf.lab2rgb (nprevl, previmg);
}
catch(char * str)
{
progress ("Error converting file...",0);
mProcessing.unlock ();
return;
}
previmg->getMutex().unlock();
}
if (!resultValid) {
@@ -566,7 +576,11 @@ void ImProcCoordinator::startProcessing () {
thread = NULL;
updaterRunning = true;
updaterThreadStart.unlock ();
thread = Glib::Thread::create(sigc::mem_fun(*this, &ImProcCoordinator::process), 0, false, true, Glib::THREAD_PRIORITY_NORMAL);
batchThread->yield(); //the running batch should wait other threads to avoid conflict
thread = Glib::Thread::create(sigc::mem_fun(*this, &ImProcCoordinator::process), 0, true, true, Glib::THREAD_PRIORITY_NORMAL);
}
else
updaterThreadStart.unlock ();

View File

@@ -38,6 +38,9 @@ extern const Settings* settings;
void ImProcFunctions::lab2rgb (LabImage* lab, Image8* image) {
if (chroma_scale == 0)
return;
if (monitorTransform) {
int ix = 0;
short* buffer = new short [3*lab->W];

View File

@@ -32,7 +32,11 @@ InitialImage* InitialImage::load (const Glib::ustring& fname, bool isRaw, int* e
isrc = new RawImageSource ();
isrc->setProgressListener (pl);
*errorCode = isrc->load (fname);
if(isRaw && pl == NULL)
*errorCode = isrc->load (fname, true);
else
*errorCode = isrc->load (fname);
if (*errorCode) {
delete isrc;
return NULL;

View File

@@ -0,0 +1,54 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include <rtengine.h>
#include <stdimagesource.h>
#include <rawimagesource.h>
namespace rtengine {
Glib::Mutex* qMutex2 = NULL;
InitialImage* InitialImage::load (const Glib::ustring& fname, bool isRaw, int* errorCode, ProgressListener* pl) {
if (!qMutex2)
qMutex2 = new Glib::Mutex ();
qMutex2->lock();
ImageSource* isrc;
if (!isRaw)
isrc = new StdImageSource ();
else
isrc = new RawImageSource ();
isrc->setProgressListener (pl);
if(isRaw && pl == NULL)
*errorCode = isrc->load (fname, true);
else
*errorCode = isrc->load (fname);
if (*errorCode) {
delete isrc;
return NULL;
}
qMutex2->unlock();
return isrc;
}
}

View File

@@ -724,7 +724,7 @@ void RawImageSource::inverse33 (double (*coeff)[3], double (*icoeff)[3]) {
icoeff[2][2] = (coeff[0][1]*coeff[1][0]-coeff[0][0]*coeff[1][1]) / nom;
}
int RawImageSource::load (Glib::ustring fname) {
int RawImageSource::load (Glib::ustring fname, bool batch) {
fileName = fname;
@@ -802,6 +802,7 @@ int RawImageSource::load (Glib::ustring fname) {
// global correction
int ng1=0, ng2=0;
double avgg1=0, avgg2=0;
#pragma omp parallel for
for (int i=border; i<H-border; i++)
for (int j=border; j<W-border; j++)
if (ISGREEN(ri,i,j)) {
@@ -816,6 +817,7 @@ int RawImageSource::load (Glib::ustring fname) {
}
double corrg1 = ((double)avgg1/ng1 + (double)avgg2/ng2) / 2.0 / ((double)avgg1/ng1);
double corrg2 = ((double)avgg1/ng1 + (double)avgg2/ng2) / 2.0 / ((double)avgg2/ng2);
#pragma omp parallel for
for (int i=border; i<H-border; i++)
for (int j=border; j<W-border; j++)
if (ISGREEN(ri,i,j))
@@ -898,23 +900,45 @@ int RawImageSource::load (Glib::ustring fname) {
//MyTime t1,t2;
//t1.set();
// demosaic
if (settings->demosaicMethod=="hphd")
hphd_demosaic ();
else if (settings->demosaicMethod=="vng4")
vng4_demosaic ();
else if (settings->demosaicMethod=="ahd")
if(!batch)
{
if (settings->demosaicMethod=="hphd")
hphd_demosaic ();
else if (settings->demosaicMethod=="vng4")
vng4_demosaic ();
else if (settings->demosaicMethod=="ahd")
//ahd_demosaic ();
fast_demo ();
else if (settings->demosaicMethod=="bilinear")
bilinear_demosaic();
//else if (settings->demosaicMethod=="ppg")
// ppg_demosaic ();
else if (settings->demosaicMethod=="amaze")
amaze_demosaic_RT ();//Emil's code for AMaZE
else if (settings->demosaicMethod=="dcb")
dcb_demosaic(settings->dcb_iterations, settings->dcb_enhance? 1:0);
else if (settings->demosaicMethod=="bilinear")
bilinear_demosaic();
//else if (settings->demosaicMethod=="ppg")
// ppg_demosaic ();
else if (settings->demosaicMethod=="amaze")
amaze_demosaic_RT ();//Emil's code for AMaZE
else if (settings->demosaicMethod=="dcb")
dcb_demosaic(settings->dcb_iterations, settings->dcb_enhance? 1:0);
else
eahd_demosaic ();
}
else
eahd_demosaic ();
{
if (settings->demosaicMethodBatch =="hphd")
hphd_demosaic ();
else if (settings->demosaicMethodBatch=="vng4")
vng4_demosaic ();
else if (settings->demosaicMethodBatch=="ahd")
fast_demo ();
else if (settings->demosaicMethodBatch=="bilinear")
bilinear_demosaic();
//else if (settings->demosaicMethod=="ppg")
// ppg_demosaic ();
else if (settings->demosaicMethodBatch=="amaze")
amaze_demosaic_RT ();//Emil's code for AMaZE
else if (settings->demosaicMethodBatch=="dcb")
dcb_demosaic(settings->dcb_iterations, settings->dcb_enhance? 1:0);
else
eahd_demosaic ();
}
//t2.set();
//printf("Demosaicing:%d usec\n",t2.etime(t1));
}
@@ -1155,7 +1179,8 @@ void RawImageSource::colorSpaceConversion (Image16* im, ColorManagementParams cm
for (int j=0; j<3; j++)
for (int k=0; k<3; k++)
mat[i][j] += camMatrix[i][k] * work[k][j];
#pragma omp parallel for
for (int i=0; i<im->height; i++)
for (int j=0; j<im->width; j++) {
@@ -1177,7 +1202,8 @@ void RawImageSource::colorSpaceConversion (Image16* im, ColorManagementParams cm
if (hTransform) {
if (cmp.gammaOnInput) {
double gd = pow (2.0, defgain);
defgain = 0.0;
defgain = 0.0;
#pragma omp parallel for
for (int i=0; i<im->height; i++)
for (int j=0; j<im->width; j++) {
im->r[i][j] = CurveFactory::gamma (CLIP(defgain*im->r[i][j]));

View File

@@ -1,183 +1,183 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _RAWIMAGESOURCE_
#define _RAWIMAGESOURCE_
#include <imagesource.h>
#include <lcms.h>
#define HR_SCALE 2
namespace rtengine {
template<class T> void freeArray (T** a, int H) {
for (int i=0; i<H; i++)
delete [] a[i];
delete [] a;
}
template<class T> T** allocArray (int W, int H) {
T** t = new T*[H];
for (int i=0; i<H; i++)
t[i] = new T[W];
return t;
}
template<class T> void freeArray2 (T** a, int H) {
for (int i=0; i<H; i++)
delete [] a[i];
}
class RawImageSource : public ImageSource {
protected:
Glib::Mutex isrcMutex;
int W, H;
ColorTemp wb;
ProgressListener* plistener;
double coeff[3][3];
double icoeff[3][3];
double cam[3][3];
double icam[3][3];
bool fuji;
bool d1x;
int border;
char** hpmap;
float** hrmap[3]; // for color propagation
char** needhr; // for color propagation
int max[3];
double defGain;
int blcode[16][16][32];
bool full;
Glib::ustring oldmethod;
cmsHPROFILE camProfile;
cmsHPROFILE embProfile;
RawImage* ri;
// to accelerate CIELAB conversion:
double lc00, lc01, lc02, lc10, lc11, lc12, lc20, lc21, lc22;
double* cache;
int threshold;
// the interpolated green plane:
unsigned short** green;
// the interpolated red plane:
unsigned short** red;
// the interpolated blue plane:
unsigned short** blue;
void hphd_vertical (float** hpmap, int col_from, int col_to);
void hphd_horizontal (float** hpmap, int row_from, int row_to);
void hphd_green ();
void correction_YIQ_LQ_ (Image16* im, int row_from, int row_to);
void hlRecovery (std::string method, unsigned short* red, unsigned short* green, unsigned short* blue, int i, int sx1, int width, int skip);
int defTransform (int tran);
void rotateLine (unsigned short* line, unsigned short** channel, int tran, int i, int w, int h);
void transformRect (PreviewProps pp, int tran, int &sx1, int &sy1, int &width, int &height, int &fw);
void transformPosition (int x, int y, int tran, int& tx, int& ty);
void updateHLRecoveryMap (std::string method, double rm, double gm, double bm);
void updateHLRecoveryMap_ColorPropagation ();
void HLRecovery_ColorPropagation (unsigned short* red, unsigned short* green, unsigned short* blue, int i, int sx1, int width, int skip);
void interpolate_image(Image16* image, HRecParams hrp, double rm, double gm, double bm, int skip, int tran, int fw, int imwidth, int imheight, int sx, int sy, int start, int end);
public:
RawImageSource ();
~RawImageSource ();
int load (Glib::ustring fname);
void getImage (ColorTemp ctemp, int tran, Image16* image, PreviewProps pp, HRecParams hrp, ColorManagementParams cmp);
ColorTemp getWB () { return wb; }
ColorTemp getAutoWB ();
ColorTemp getSpotWB (std::vector<Coord2D> red, std::vector<Coord2D> green, std::vector<Coord2D>& blue, int tran);
double getDefGain () { return defGain; }
double getGamma () { return 2.2; }
void getFullSize (int& w, int& h, int tr = TR_NONE);
void getSize (int tran, PreviewProps pp, int& w, int& h);
ImageData* getImageData () { return idata; }
void setProgressListener (ProgressListener* pl) { plistener = pl; }
int getAEHistogram (unsigned int* histogram, int& histcompr);
static void colorSpaceConversion (Image16* im, ColorManagementParams cmp, cmsHPROFILE embedded, cmsHPROFILE camprofile, double cam[3][3], double& defgain);
static void inverse33 (double (*coeff)[3], double (*icoeff)[3]);
static void HLRecovery_Luminance (unsigned short* rin, unsigned short* gin, unsigned short* bin, unsigned short* rout, unsigned short* gout, unsigned short* bout, int width, int maxval);
static void HLRecovery_CIELab (unsigned short* rin, unsigned short* gin, unsigned short* bin, unsigned short* rout, unsigned short* gout, unsigned short* bout, int width, int maxval, double cam[3][3], double icam[3][3]);
protected:
typedef unsigned short ushort;
void correction_YIQ_LQ (Image16* i, int times);
inline void convert_row_to_YIQ (unsigned short* r, unsigned short* g, unsigned short* b, int* Y, int* I, int* Q, int W);
inline void convert_row_to_RGB (unsigned short* r, unsigned short* g, unsigned short* b, int* Y, int* I, int* Q, int W);
inline void convert_to_cielab_row (unsigned short* ar, unsigned short* ag, unsigned short* ab, short* oL, short* oa, short* ob);
inline void interpolate_row_g (unsigned short* agh, unsigned short* agv, int i);
inline void interpolate_row_rb (unsigned short* ar, unsigned short* ab, unsigned short* pg, unsigned short* cg, unsigned short* ng, int i);
inline void interpolate_row_rb_mul_pp (unsigned short* ar, unsigned short* ab, unsigned short* pg, unsigned short* cg, unsigned short* ng, int i, double r_mul, double g_mul, double b_mul, int x1, int width, int skip);
int LinEqSolve (int nDim, float* pfMatr, float* pfVect, float* pfSolution);//Emil's CA auto correction
void CA_correct_RT (); //Emil's pre-demosaic CA correction
void cfa_clean (float thresh); //Emil's hot/dead pixel filter
void ddct8x8s(int isgn, float **a);
void cfa_linedn (float linenoiselevel); //Emil's line denoise
void green_equilibrate (float greenthresh);//Emil's green equilibration
void eahd_demosaic ();
void hphd_demosaic ();
void vng4_demosaic ();
void ppg_demosaic();
void amaze_demosaic_RT (); //Emil's code for AMaZE
void fast_demo (); //Emil's fast demosaic
void dcb_demosaic(int iterations, int dcb_enhance);
void ahd_demosaic();
void bilinear_demosaic();
void bilinear_interpolate_block(ushort (*image)[4], int start, int end);
void border_interpolate(int border, ushort (*image)[4], int start = 0, int end = 0);
void dcb_initTileLimits(int &colMin, int &rowMin, int &colMax, int &rowMax, int x0, int y0, int border);
void fill_raw( ushort (*cache )[4], int x0, int y0, ushort** rawData);
void fill_border( ushort (*cache )[4], int border, int x0, int y0);
void copy_to_buffer(ushort (*image2)[3], ushort (*image)[4]);
void dcb_hid(ushort (*image)[4], ushort (*bufferH)[3], ushort (*bufferV)[3], int x0, int y0);
void dcb_color(ushort (*image)[4], int x0, int y0);
void dcb_hid2(ushort (*image)[4], int x0, int y0);
void dcb_map(ushort (*image)[4], int x0, int y0);
void dcb_correction(ushort (*image)[4], int x0, int y0);
void dcb_pp(ushort (*image)[4], int x0, int y0);
void dcb_correction2(ushort (*image)[4], int x0, int y0);
void restore_from_buffer(ushort (*image)[4], ushort (*image2)[3]);
void dcb_refinement(ushort (*image)[4], int x0, int y0);
void dcb_color_full(ushort (*image)[4], int x0, int y0, float (*chroma)[2]);
void transLine (unsigned short* red, unsigned short* green, unsigned short* blue, int i, Image16* image, int tran, int imw, int imh, int fw);
void hflip (Image16* im);
void vflip (Image16* im);
};
};
#endif
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _RAWIMAGESOURCE_
#define _RAWIMAGESOURCE_
#include <imagesource.h>
#include <lcms.h>
#define HR_SCALE 2
namespace rtengine {
template<class T> void freeArray (T** a, int H) {
for (int i=0; i<H; i++)
delete [] a[i];
delete [] a;
}
template<class T> T** allocArray (int W, int H) {
T** t = new T*[H];
for (int i=0; i<H; i++)
t[i] = new T[W];
return t;
}
template<class T> void freeArray2 (T** a, int H) {
for (int i=0; i<H; i++)
delete [] a[i];
}
class RawImageSource : public ImageSource {
protected:
Glib::Mutex isrcMutex;
int W, H;
ColorTemp wb;
ProgressListener* plistener;
double coeff[3][3];
double icoeff[3][3];
double cam[3][3];
double icam[3][3];
bool fuji;
bool d1x;
int border;
char** hpmap;
float** hrmap[3]; // for color propagation
char** needhr; // for color propagation
int max[3];
double defGain;
int blcode[16][16][32];
bool full;
Glib::ustring oldmethod;
cmsHPROFILE camProfile;
cmsHPROFILE embProfile;
RawImage* ri;
// to accelerate CIELAB conversion:
double lc00, lc01, lc02, lc10, lc11, lc12, lc20, lc21, lc22;
double* cache;
int threshold;
// the interpolated green plane:
unsigned short** green;
// the interpolated red plane:
unsigned short** red;
// the interpolated blue plane:
unsigned short** blue;
void hphd_vertical (float** hpmap, int col_from, int col_to);
void hphd_horizontal (float** hpmap, int row_from, int row_to);
void hphd_green ();
void correction_YIQ_LQ_ (Image16* im, int row_from, int row_to);
void hlRecovery (std::string method, unsigned short* red, unsigned short* green, unsigned short* blue, int i, int sx1, int width, int skip);
int defTransform (int tran);
void rotateLine (unsigned short* line, unsigned short** channel, int tran, int i, int w, int h);
void transformRect (PreviewProps pp, int tran, int &sx1, int &sy1, int &width, int &height, int &fw);
void transformPosition (int x, int y, int tran, int& tx, int& ty);
void updateHLRecoveryMap (std::string method, double rm, double gm, double bm);
void updateHLRecoveryMap_ColorPropagation ();
void HLRecovery_ColorPropagation (unsigned short* red, unsigned short* green, unsigned short* blue, int i, int sx1, int width, int skip);
void interpolate_image(Image16* image, HRecParams hrp, double rm, double gm, double bm, int skip, int tran, int fw, int imwidth, int imheight, int sx, int sy, int start, int end);
public:
RawImageSource ();
~RawImageSource ();
int load (Glib::ustring fname, bool batch = false);
void getImage (ColorTemp ctemp, int tran, Image16* image, PreviewProps pp, HRecParams hrp, ColorManagementParams cmp);
ColorTemp getWB () { return wb; }
ColorTemp getAutoWB ();
ColorTemp getSpotWB (std::vector<Coord2D> red, std::vector<Coord2D> green, std::vector<Coord2D>& blue, int tran);
double getDefGain () { return defGain; }
double getGamma () { return 2.2; }
void getFullSize (int& w, int& h, int tr = TR_NONE);
void getSize (int tran, PreviewProps pp, int& w, int& h);
ImageData* getImageData () { return idata; }
void setProgressListener (ProgressListener* pl) { plistener = pl; }
int getAEHistogram (unsigned int* histogram, int& histcompr);
static void colorSpaceConversion (Image16* im, ColorManagementParams cmp, cmsHPROFILE embedded, cmsHPROFILE camprofile, double cam[3][3], double& defgain);
static void inverse33 (double (*coeff)[3], double (*icoeff)[3]);
static void HLRecovery_Luminance (unsigned short* rin, unsigned short* gin, unsigned short* bin, unsigned short* rout, unsigned short* gout, unsigned short* bout, int width, int maxval);
static void HLRecovery_CIELab (unsigned short* rin, unsigned short* gin, unsigned short* bin, unsigned short* rout, unsigned short* gout, unsigned short* bout, int width, int maxval, double cam[3][3], double icam[3][3]);
protected:
typedef unsigned short ushort;
void correction_YIQ_LQ (Image16* i, int times);
inline void convert_row_to_YIQ (unsigned short* r, unsigned short* g, unsigned short* b, int* Y, int* I, int* Q, int W);
inline void convert_row_to_RGB (unsigned short* r, unsigned short* g, unsigned short* b, int* Y, int* I, int* Q, int W);
inline void convert_to_cielab_row (unsigned short* ar, unsigned short* ag, unsigned short* ab, short* oL, short* oa, short* ob);
inline void interpolate_row_g (unsigned short* agh, unsigned short* agv, int i);
inline void interpolate_row_rb (unsigned short* ar, unsigned short* ab, unsigned short* pg, unsigned short* cg, unsigned short* ng, int i);
inline void interpolate_row_rb_mul_pp (unsigned short* ar, unsigned short* ab, unsigned short* pg, unsigned short* cg, unsigned short* ng, int i, double r_mul, double g_mul, double b_mul, int x1, int width, int skip);
int LinEqSolve (int nDim, float* pfMatr, float* pfVect, float* pfSolution);//Emil's CA auto correction
void CA_correct_RT ();
void cfa_clean (float thresh);//Emil's hot/dead pixel filter
void ddct8x8s(int isgn, float **a);
void cfa_linedn (float linenoiselevel);//Emil's line denoise
void green_equilibrate (float greenthresh);//Emil's green equilibration
void eahd_demosaic ();
void hphd_demosaic ();
void vng4_demosaic ();
void ppg_demosaic();
void amaze_demosaic_RT ();//Emil's code for AMaZE
void fast_demo ();
void dcb_demosaic(int iterations, int dcb_enhance);
void ahd_demosaic();
void bilinear_demosaic();
void bilinear_interpolate_block(ushort (*image)[4], int start, int end);
void border_interpolate(int border, ushort (*image)[4], int start = 0, int end = 0);
void dcb_initTileLimits(int &colMin, int &rowMin, int &colMax, int &rowMax, int x0, int y0, int border);
void fill_raw( ushort (*cache )[4], int x0, int y0, ushort** rawData);
void fill_border( ushort (*cache )[4], int border, int x0, int y0);
void copy_to_buffer(ushort (*image2)[3], ushort (*image)[4]);
void dcb_hid(ushort (*image)[4], ushort (*bufferH)[3], ushort (*bufferV)[3], int x0, int y0);
void dcb_color(ushort (*image)[4], int x0, int y0);
void dcb_hid2(ushort (*image)[4], int x0, int y0);
void dcb_map(ushort (*image)[4], int x0, int y0);
void dcb_correction(ushort (*image)[4], int x0, int y0);
void dcb_pp(ushort (*image)[4], int x0, int y0);
void dcb_correction2(ushort (*image)[4], int x0, int y0);
void restore_from_buffer(ushort (*image)[4], ushort (*image2)[3]);
void dcb_refinement(ushort (*image)[4], int x0, int y0);
void dcb_color_full(ushort (*image)[4], int x0, int y0, float (*chroma)[2]);
void transLine (unsigned short* red, unsigned short* green, unsigned short* blue, int i, Image16* image, int tran, int imw, int imh, int fw);
void hflip (Image16* im);
void vflip (Image16* im);
};
};
#endif

View File

@@ -26,6 +26,7 @@ namespace rtengine {
public:
bool dualThreadEnabled; ///< If true, the image processing operations with utilize two processor cores (if possible)
std::string demosaicMethod; ///< The algorithm used for demosaicing. Can be "eahd", "hphd", "ahd", "vng4", "amaze", "bilinear".
std::string demosaicMethodBatch; ///< The algorithm used for demosaicing. Can be "eahd", "hphd", "ahd", "vng4", "amaze", "bilinear".
int colorCorrectionSteps; ///< The number of color correction steps applied right after the demosaicing
Glib::ustring iccDirectory; ///< The directory containing the possible output icc profiles
int colorimetricIntent; ///< Colorimetric intent used at color space conversions

View File

@@ -29,6 +29,9 @@
#undef THREAD_PRIORITY_NORMAL
Glib::Thread *batchThread = NULL;
Glib::Mutex* qMutex = NULL;
namespace rtengine {
IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* pl) {
@@ -213,6 +216,10 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl) {
if (!qMutex)
qMutex = new Glib::Mutex ();
qMutex->lock();
ProcessingJob* currentJob = job;
while (currentJob) {
@@ -222,12 +229,22 @@ void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl) {
bpl->error ("Can not load input image.");
currentJob = bpl->imageReady (img);
}
qMutex->unlock();
}
void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl) {
if (bpl)
Glib::Thread::create(sigc::bind(sigc::ptr_fun(batchProcessingThread), job, bpl), 0, false, true, Glib::THREAD_PRIORITY_NORMAL);
batchThread = Glib::Thread::create(sigc::bind(sigc::ptr_fun(batchProcessingThread), job, bpl), 0, true, true, Glib::THREAD_PRIORITY_LOW);
if(qMutex)
{
delete qMutex;
qMutex = NULL;
}
}
}

26
rtengine/simpleprocess.h Normal file
View File

@@ -0,0 +1,26 @@
/*
* File: simpleprocess.h
* Author: askv
*
* Created on September 18, 2010, 8:31 PM
*/
#ifndef SIMPLEPROCESS_H
#define SIMPLEPROCESS_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
namespace rtengine {
extern Glib::Thread *batchThread;
}
#endif /* SIMPLEPROCESS_H */

View File

@@ -70,7 +70,7 @@ StdImageSource::~StdImageSource () {
freeArray<char>(needhr, img->height);
}
int StdImageSource::load (Glib::ustring fname) {
int StdImageSource::load (Glib::ustring fname, bool batch) {
fileName = fname;

View File

@@ -43,7 +43,7 @@ class StdImageSource : public ImageSource {
StdImageSource ();
~StdImageSource ();
int load (Glib::ustring fname);
int load (Glib::ustring fname, bool batch = false);
void getImage (ColorTemp ctemp, int tran, Image16* image, PreviewProps pp, HRecParams hrp, ColorManagementParams cmp);
ColorTemp getWB () { return wb; }
ColorTemp getAutoWB ();

View File

@@ -54,13 +54,13 @@ ProcParams* Updater::getParams () {
void Updater::startProcessing () {
#undef THREAD_PRIORITY_NORMAL
#undef THREAD_PRIORITY_LOW
tstart.lock ();
if (ipc && !running) {
running = true;
tstart.unlock ();
Glib::Thread::create(sigc::mem_fun(*this, &Updater::process), 0, false, true, Glib::THREAD_PRIORITY_NORMAL);
Glib::Thread::create(sigc::mem_fun(*this, &Updater::process), 0, false, true, Glib::THREAD_PRIORITY_LOW);
}
else
tstart.unlock ();

View File

@@ -57,9 +57,10 @@ void BatchQueueEntryUpdater::add (guint8* oimg, int ow, int oh, int newh, BQEntr
void BatchQueueEntryUpdater::process () {
if (stopped)
#undef THREAD_PRIORITY_NORMAL
thread = Glib::Thread::create(sigc::mem_fun(*this, &BatchQueueEntryUpdater::process_), (unsigned long int)0, true, true, Glib::THREAD_PRIORITY_NORMAL);
if (stopped){
#undef THREAD_PRIORITY_LOW
thread = Glib::Thread::create(sigc::mem_fun(*this, &BatchQueueEntryUpdater::process_), (unsigned long int)0, true, true, Glib::THREAD_PRIORITY_LOW);
}
}
void BatchQueueEntryUpdater::process_ () {
@@ -93,7 +94,7 @@ void BatchQueueEntryUpdater::stop () {
tostop = true;
Glib::Thread::self()->yield();
if (!stopped)
thread->join ();
thread->join ();
gdk_threads_enter();
}

View File

@@ -268,7 +268,7 @@ void CropHandler::update () {
// crop->setWindow (cropX, cropY, cropW, cropH, zoom>=1000 ? 1 : zoom); --> we use the "getWindow" hook instead of setting the size before
crop->setListener (this);
cropPixbuf.clear ();
Glib::Thread::create(sigc::mem_fun(*crop, &DetailedCrop::fullUpdate), 0, false, true, Glib::THREAD_PRIORITY_NORMAL);
Glib::Thread::create(sigc::mem_fun(*crop, &DetailedCrop::fullUpdate), 0, false, true, Glib::THREAD_PRIORITY_LOW);
}
}

View File

@@ -66,7 +66,7 @@ class CropWindow : public LWButtonListener, public CropHandlerListener {
int xpos, ypos, width, height;
// image handling
CropHandler cropHandler;
ImageArea* iarea;
int cropZoom; // *1000
@@ -88,6 +88,7 @@ class CropWindow : public LWButtonListener, public CropHandlerListener {
void getObservedFrameArea(int& x, int& y, int& w, int& h);
public:
CropHandler cropHandler;
CropWindow (ImageArea* parent, rtengine::StagedImageProcessor* ipc_);
~CropWindow ();

File diff suppressed because it is too large Load Diff

View File

@@ -32,6 +32,7 @@
#include <thumbnaillistener.h>
#include <navigator.h>
#include <progressconnector.h>
#include <filepanel.h>
class EditorPanel;
struct EditorPanelIdleHelper {
@@ -81,6 +82,9 @@ class EditorPanel : public Gtk::VBox,
ToolPanelCoordinator* tpc;
RTWindow* parent;
SaveAsDialog* saveAsDialog;
BatchToolPanelCoordinator* btpCoordinator;
FilePanel* fPanel;
Thumbnail* openThm;
rtengine::InitialImage* isrc;
@@ -100,7 +104,7 @@ class EditorPanel : public Gtk::VBox,
int err;
public:
EditorPanel ();
EditorPanel (FilePanel* filePanel = NULL);
virtual ~EditorPanel ();
void open (Thumbnail* tmb, rtengine::InitialImage* isrc);
@@ -143,6 +147,8 @@ class EditorPanel : public Gtk::VBox,
bool handleShortcutKey (GdkEventKey* event);
//void saveOptions ();
Gtk::Paned *catalogPane;
};
#endif

View File

@@ -32,7 +32,7 @@ FileBrowser::FileBrowser ()
fbih->destroyed = false;
fbih->pending = 0;
profileStore.parseProfiles ();
// profileStore.parseProfiles ();
signal_style_changed().connect( sigc::mem_fun(*this, &FileBrowser::styleChanged) );

File diff suppressed because it is too large Load Diff

View File

@@ -67,7 +67,7 @@ class PreviewLoader : public ProcessingThread<DirEntry> {
void end ();
};
class FileCatalog : public Gtk::VBox,
class FileCatalog : public Gtk::VBox,
public DirSelectionListener,
public PreviewLoaderListener,
public FilterPanelListener,
@@ -77,9 +77,7 @@ class FileCatalog : public Gtk::VBox,
#endif
{
// thumbnail browsers
FileBrowser* fileBrowser;
Gtk::HBox* hBox;
Glib::ustring selectedDirectory;
bool enabled;
@@ -141,6 +139,9 @@ class FileCatalog : public Gtk::VBox,
void trashChanged ();
public:
// thumbnail browsers
FileBrowser* fileBrowser;
CoarsePanel* coarsePanel;
ToolBar* toolBar;

View File

@@ -1,228 +1,244 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include <filepanel.h>
#include <rtwindow.h>
int fbinit (void* data) {
gdk_threads_enter ();
((FilePanel*)data)->init ();
gdk_threads_leave ();
return 0;
}
FilePanel::FilePanel () : parent(NULL) {
dirpaned = new Gtk::HPaned ();
dirpaned->set_position (options.dirBrowserWidth);
dirBrowser = new DirBrowser ();
placesBrowser = new PlacesBrowser ();
recentBrowser = new RecentBrowser ();
placespaned = new Gtk::VPaned ();
placespaned->set_size_request(50,100);
placespaned->set_position (options.dirBrowserHeight);
Gtk::VBox* obox = Gtk::manage (new Gtk::VBox ());
obox->pack_start (*recentBrowser, Gtk::PACK_SHRINK, 4);
obox->pack_start (*dirBrowser);
placespaned->pack1 (*placesBrowser, false, true);
placespaned->pack2 (*obox, true, true);
dirpaned->pack1 (*placespaned, false, true);
tpc = new BatchToolPanelCoordinator (this);
fileCatalog = new FileCatalog (tpc->coarse, tpc->getToolBar());
fileCatalog->set_size_request(50,150);
dirpaned->pack2 (*fileCatalog, true, true);
placesBrowser->setDirBrowserRemoteInterface (dirBrowser);
recentBrowser->setDirBrowserRemoteInterface (dirBrowser);
dirBrowser->addDirSelectionListener (fileCatalog);
dirBrowser->addDirSelectionListener (recentBrowser);
dirBrowser->addDirSelectionListener (placesBrowser);
fileCatalog->setFileSelectionListener (this);
rightBox = new Gtk::HBox ();
rightBox->set_size_request(50,100);
rightNotebook = new Gtk::Notebook ();
Gtk::VBox* taggingBox = new Gtk::VBox ();
history = new History (false);
tpc->addPParamsChangeListener (history);
history->setProfileChangeListener (tpc);
Gtk::ScrolledWindow* sFilterPanel = new Gtk::ScrolledWindow();
filterPanel = new FilterPanel ();
sFilterPanel->add (*filterPanel);
sFilterPanel->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
fileCatalog->setFilterPanel (filterPanel);
fileCatalog->setImageAreaToolListener (tpc);
//------------------
rightNotebook->set_tab_pos (Gtk::POS_LEFT);
Gtk::Label* devLab = new Gtk::Label (M("MAIN_TAB_DEVELOP"));
devLab->set_angle (90);
Gtk::Label* filtLab = new Gtk::Label (M("MAIN_TAB_FILTER"));
filtLab->set_angle (90);
Gtk::Label* tagLab = new Gtk::Label (M("MAIN_TAB_TAGGING"));
tagLab->set_angle (90);
tpcPaned = new Gtk::VPaned ();
tpcPaned->pack1 (*tpc->toolPanelNotebook, false, true);
tpcPaned->pack2 (*history, true, true);
rightNotebook->append_page (*tpcPaned, *devLab);
rightNotebook->append_page (*sFilterPanel, *filtLab);
rightNotebook->append_page (*taggingBox, *tagLab);
rightBox->pack_start (*rightNotebook);
pack1(*dirpaned, true, true);
pack2(*rightBox, false, true);
fileCatalog->setFileSelectionChangeListener (tpc);
fileCatalog->setFileSelectionListener (this);
g_idle_add (fbinit, this);
show_all ();
}
void FilePanel::setAspect () {
int winW, winH;
parent->get_size(winW, winH);
placespaned->set_position(options.dirBrowserHeight);
dirpaned->set_position(options.dirBrowserWidth);
tpcPaned->set_position(options.browserToolPanelHeight);
set_position(winW - options.browserToolPanelWidth);
}
void FilePanel::init () {
dirBrowser->fillDirTree ();
placesBrowser->refreshPlacesList ();
if (argv1!="")
dirBrowser->open (argv1);
else {
if (options.startupDir==STARTUPDIR_HOME)
dirBrowser->open (Glib::get_home_dir());
else if (options.startupDir==STARTUPDIR_CURRENT)
dirBrowser->open (argv0);
else if (options.startupDir==STARTUPDIR_CUSTOM || options.startupDir==STARTUPDIR_LAST)
dirBrowser->open (options.startupPath);
}
}
bool FilePanel::fileSelected (Thumbnail* thm) {
if (!parent)
return false;
// try to open the file
fileCatalog->setEnabled (false);
ProgressConnector<rtengine::InitialImage*> *ld = new ProgressConnector<rtengine::InitialImage*>();
ld->startFunc (sigc::bind(sigc::ptr_fun(&rtengine::InitialImage::load), thm->getFileName (), thm->getType()==FT_Raw, &error, parent->getProgressListener()),
sigc::bind(sigc::mem_fun(*this,&FilePanel::imageLoaded), thm, ld) );
return true;
}
bool FilePanel::imageLoaded( Thumbnail* thm, ProgressConnector<rtengine::InitialImage*> *pc ){
if (pc->returnValue() && thm) {
EditorPanel* epanel = Gtk::manage (new EditorPanel ());
parent->addEditorPanel (epanel,Glib::path_get_basename (thm->getFileName()));
epanel->open(thm, pc->returnValue() );
}else {
Glib::ustring msg_ = Glib::ustring("<b>") + M("MAIN_MSG_CANNOTLOAD") + " \"" + thm->getFileName() + "\" .\n</b>";
Gtk::MessageDialog msgd (msg_, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
msgd.run ();
}
delete pc;
parent->setProgress(0.);
parent->setProgressStr("");
fileCatalog->setEnabled (true);
return false; // MUST return false from idle function
}
void FilePanel::saveOptions () {
int winW, winH;
parent->get_size(winW, winH);
options.dirBrowserWidth = dirpaned->get_position ();
options.dirBrowserHeight = placespaned->get_position ();
options.browserToolPanelWidth = winW - get_position();
options.browserToolPanelHeight = tpcPaned->get_position ();
if (options.startupDir==STARTUPDIR_LAST && fileCatalog->lastSelectedDir ()!="")
options.startupPath = fileCatalog->lastSelectedDir ();
fileCatalog->closeDir ();
}
void FilePanel::open (const Glib::ustring& d) {
if (Glib::file_test (d, Glib::FILE_TEST_IS_DIR))
dirBrowser->open (d.c_str());
else if (Glib::file_test (d, Glib::FILE_TEST_EXISTS))
dirBrowser->open (Glib::path_get_dirname(d), Glib::path_get_basename(d));
}
bool FilePanel::addBatchQueueJob (BatchQueueEntry* bqe) {
if (parent)
parent->addBatchQueueJob (bqe);
return true;
}
void FilePanel::optionsChanged () {
tpc->optionsChanged ();
fileCatalog->refreshAll ();
}
bool FilePanel::handleShortcutKey (GdkEventKey* event) {
bool ctrl = event->state & GDK_CONTROL_MASK;
bool shift = event->state & GDK_SHIFT_MASK;
if (!ctrl) {
switch(event->keyval) {
}
}
else {
switch (event->keyval) {
}
}
if(tpc->getToolBar()->handleShortcutKey(event))
return true;
if(fileCatalog->handleShortcutKey(event))
return true;
return false;
}
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include <filepanel.h>
#include <rtwindow.h>
int fbinit (void* data) {
gdk_threads_enter ();
((FilePanel*)data)->init ();
gdk_threads_leave ();
return 0;
}
FilePanel::FilePanel () : parent(NULL) {
isloading = false;
dirpaned = new Gtk::HPaned ();
dirpaned->set_position (options.dirBrowserWidth);
dirBrowser = new DirBrowser ();
placesBrowser = new PlacesBrowser ();
recentBrowser = new RecentBrowser ();
placespaned = new Gtk::VPaned ();
placespaned->set_size_request(50,100);
placespaned->set_position (options.dirBrowserHeight);
Gtk::VBox* obox = Gtk::manage (new Gtk::VBox ());
obox->pack_start (*recentBrowser, Gtk::PACK_SHRINK, 4);
obox->pack_start (*dirBrowser);
placespaned->pack1 (*placesBrowser, false, true);
placespaned->pack2 (*obox, true, true);
dirpaned->pack1 (*placespaned, false, true);
tpc = new BatchToolPanelCoordinator (this);
fileCatalog = new FileCatalog (tpc->coarse, tpc->getToolBar());
ribbonPane = new Gtk::Paned();
ribbonPane->add(*fileCatalog);
ribbonPane->set_size_request(50,150);
dirpaned->pack2 (*ribbonPane, true, true);
placesBrowser->setDirBrowserRemoteInterface (dirBrowser);
recentBrowser->setDirBrowserRemoteInterface (dirBrowser);
dirBrowser->addDirSelectionListener (fileCatalog);
dirBrowser->addDirSelectionListener (recentBrowser);
dirBrowser->addDirSelectionListener (placesBrowser);
fileCatalog->setFileSelectionListener (this);
rightBox = new Gtk::HBox ();
rightBox->set_size_request(50,100);
rightNotebook = new Gtk::Notebook ();
Gtk::VBox* taggingBox = new Gtk::VBox ();
history = new History (false);
tpc->addPParamsChangeListener (history);
history->setProfileChangeListener (tpc);
Gtk::ScrolledWindow* sFilterPanel = new Gtk::ScrolledWindow();
filterPanel = new FilterPanel ();
sFilterPanel->add (*filterPanel);
sFilterPanel->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
fileCatalog->setFilterPanel (filterPanel);
fileCatalog->setImageAreaToolListener (tpc);
//------------------
rightNotebook->set_tab_pos (Gtk::POS_LEFT);
Gtk::Label* devLab = new Gtk::Label (M("MAIN_TAB_DEVELOP"));
devLab->set_angle (90);
Gtk::Label* filtLab = new Gtk::Label (M("MAIN_TAB_FILTER"));
filtLab->set_angle (90);
Gtk::Label* tagLab = new Gtk::Label (M("MAIN_TAB_TAGGING"));
tagLab->set_angle (90);
tpcPaned = new Gtk::VPaned ();
tpcPaned->pack1 (*tpc->toolPanelNotebook, false, true);
tpcPaned->pack2 (*history, true, true);
rightNotebook->append_page (*tpcPaned, *devLab);
rightNotebook->append_page (*sFilterPanel, *filtLab);
rightNotebook->append_page (*taggingBox, *tagLab);
rightBox->pack_start (*rightNotebook);
pack1(*dirpaned, true, true);
pack2(*rightBox, false, true);
fileCatalog->setFileSelectionChangeListener (tpc);
fileCatalog->setFileSelectionListener (this);
g_idle_add (fbinit, this);
show_all ();
}
void FilePanel::setAspect () {
int winW, winH;
parent->get_size(winW, winH);
placespaned->set_position(options.dirBrowserHeight);
dirpaned->set_position(options.dirBrowserWidth);
tpcPaned->set_position(options.browserToolPanelHeight);
set_position(winW - options.browserToolPanelWidth);
}
void FilePanel::init () {
dirBrowser->fillDirTree ();
placesBrowser->refreshPlacesList ();
if (argv1!="")
dirBrowser->open (argv1);
else {
if (options.startupDir==STARTUPDIR_HOME)
dirBrowser->open (Glib::get_home_dir());
else if (options.startupDir==STARTUPDIR_CURRENT)
dirBrowser->open (argv0);
else if (options.startupDir==STARTUPDIR_CUSTOM || options.startupDir==STARTUPDIR_LAST)
dirBrowser->open (options.startupPath);
}
}
bool FilePanel::fileSelected (Thumbnail* thm) {
if (!parent)
return false;
// try to open the file
// fileCatalog->setEnabled (false);
if (isloading)
return false;
isloading = true;
ProgressConnector<rtengine::InitialImage*> *ld = new ProgressConnector<rtengine::InitialImage*>();
ld->startFunc (sigc::bind(sigc::ptr_fun(&rtengine::InitialImage::load), thm->getFileName (), thm->getType()==FT_Raw, &error, parent->getProgressListener()),
sigc::bind(sigc::mem_fun(*this,&FilePanel::imageLoaded), thm, ld) );
return true;
}
bool FilePanel::imageLoaded( Thumbnail* thm, ProgressConnector<rtengine::InitialImage*> *pc ){
if (pc->returnValue() && thm) {
if (options.tabbedUI){
EditorPanel* epanel = Gtk::manage (new EditorPanel ());
parent->addEditorPanel (epanel,Glib::path_get_basename (thm->getFileName()));
epanel->open(thm, pc->returnValue() );
}
else{
parent->SetEditorCurrent();
parent->epanel->open(thm, pc->returnValue() );
}
}else {
Glib::ustring msg_ = Glib::ustring("<b>") + M("MAIN_MSG_CANNOTLOAD") + " \"" + thm->getFileName() + "\" .\n</b>";
Gtk::MessageDialog msgd (msg_, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
msgd.run ();
}
delete pc;
parent->setProgress(0.);
parent->setProgressStr("");
isloading = false;
return false; // MUST return false from idle function
}
void FilePanel::saveOptions () {
int winW, winH;
parent->get_size(winW, winH);
options.dirBrowserWidth = dirpaned->get_position ();
options.dirBrowserHeight = placespaned->get_position ();
options.browserToolPanelWidth = winW - get_position();
options.browserToolPanelHeight = tpcPaned->get_position ();
if (options.startupDir==STARTUPDIR_LAST && fileCatalog->lastSelectedDir ()!="")
options.startupPath = fileCatalog->lastSelectedDir ();
fileCatalog->closeDir ();
}
void FilePanel::open (const Glib::ustring& d) {
if (Glib::file_test (d, Glib::FILE_TEST_IS_DIR))
dirBrowser->open (d.c_str());
else if (Glib::file_test (d, Glib::FILE_TEST_EXISTS))
dirBrowser->open (Glib::path_get_dirname(d), Glib::path_get_basename(d));
}
bool FilePanel::addBatchQueueJob (BatchQueueEntry* bqe) {
if (parent)
parent->addBatchQueueJob (bqe);
return true;
}
void FilePanel::optionsChanged () {
tpc->optionsChanged ();
fileCatalog->refreshAll ();
}
bool FilePanel::handleShortcutKey (GdkEventKey* event) {
bool ctrl = event->state & GDK_CONTROL_MASK;
bool shift = event->state & GDK_SHIFT_MASK;
if (!ctrl) {
switch(event->keyval) {
}
}
else {
switch (event->keyval) {
}
}
if(tpc->getToolBar()->handleShortcutKey(event))
return true;
if(fileCatalog->handleShortcutKey(event))
return true;
return false;
}

View File

@@ -1,80 +1,85 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _FILEPANEL_
#define _FILEPANEL_
#include <gtkmm.h>
#include <batchtoolpanelcoord.h>
#include <filecatalog.h>
#include <dirbrowser.h>
#include <fileselectionlistener.h>
#include <placesbrowser.h>
#include <recentbrowser.h>
#include <pparamschangelistener.h>
#include <history.h>
#include <filterpanel.h>
#include <progressconnector.h>
class RTWindow;
class FilePanel : public Gtk::HPaned,
public FileSelectionListener,
public PParamsChangeListener
{
protected:
Gtk::VPaned* placespaned;
Gtk::HPaned* dirpaned;
DirBrowser* dirBrowser;
PlacesBrowser* placesBrowser;
RecentBrowser* recentBrowser;
FileCatalog* fileCatalog; // filecatalog is the file browser with the button bar above it
Gtk::HBox* rightBox;
Gtk::VPaned* tpcPaned;
BatchToolPanelCoordinator* tpc;
History* history;
FilterPanel* filterPanel;
RTWindow* parent;
Gtk::Notebook* rightNotebook;
int error;
public:
FilePanel ();
void setParent (RTWindow* p) { parent = p; }
void init (); // dont call it directly, the constructor calls it as idle source
void setAspect();
void open (const Glib::ustring& d); // open a file or a directory
void refreshEditedState (const std::set<Glib::ustring>& efiles) { fileCatalog->refreshEditedState (efiles); }
// call this before closeing rt: it saves file browser relating things into options
void saveOptions ();
// interface fileselectionlistener
bool fileSelected (Thumbnail* thm);
bool addBatchQueueJob (BatchQueueEntry* bqe);
void optionsChanged ();
bool imageLoaded( Thumbnail* thm, ProgressConnector<rtengine::InitialImage*> * );
bool handleShortcutKey (GdkEventKey* event);
};
#endif
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _FILEPANEL_
#define _FILEPANEL_
#include <gtkmm.h>
#include <batchtoolpanelcoord.h>
#include <filecatalog.h>
#include <dirbrowser.h>
#include <fileselectionlistener.h>
#include <placesbrowser.h>
#include <recentbrowser.h>
#include <pparamschangelistener.h>
#include <history.h>
#include <filterpanel.h>
#include <progressconnector.h>
class RTWindow;
class FilePanel : public Gtk::HPaned,
public FileSelectionListener,
public PParamsChangeListener
{
protected:
Gtk::Paned* placespaned;
Gtk::HPaned* dirpaned;
//DirBrowser* dirBrowser;
PlacesBrowser* placesBrowser;
RecentBrowser* recentBrowser;
// FileCatalog* fileCatalog; // filecatalog is the file browser with the button bar above it
Gtk::HBox* rightBox;
Gtk::VPaned* tpcPaned;
BatchToolPanelCoordinator* tpc;
History* history;
//FilterPanel* filterPanel;
RTWindow* parent;
Gtk::Notebook* rightNotebook;
int error;
bool isloading;
public:
FilePanel ();
DirBrowser* dirBrowser;
FilterPanel* filterPanel;
FileCatalog* fileCatalog;
Gtk::Paned *ribbonPane;
void setParent (RTWindow* p) { parent = p; }
void init (); // dont call it directly, the constructor calls it as idle source
void setAspect();
void open (const Glib::ustring& d); // open a file or a directory
void refreshEditedState (const std::set<Glib::ustring>& efiles) { fileCatalog->refreshEditedState (efiles); }
// call this before closeing rt: it saves file browser relating things into options
void saveOptions ();
// interface fileselectionlistener
bool fileSelected (Thumbnail* thm);
bool addBatchQueueJob (BatchQueueEntry* bqe);
void optionsChanged ();
bool imageLoaded( Thumbnail* thm, ProgressConnector<rtengine::InitialImage*> * );
bool handleShortcutKey (GdkEventKey* event);
};
#endif

243
rtgui/filterpanel.cc.orig Normal file
View File

@@ -0,0 +1,243 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include <filterpanel.h>
#include <multilangmgr.h>
#include <rtengine.h>
using namespace rtengine;
FilterPanel::FilterPanel () : listener (NULL) {
set_border_width (4);
enabled = Gtk::manage (new Gtk::CheckButton (M("EXIFFILTER_METADATAFILTER")));
pack_start (*enabled, Gtk::PACK_SHRINK, 2);
pack_start (*Gtk::manage(new Gtk::HSeparator ()), Gtk::PACK_SHRINK, 2);
enaFNumber = Gtk::manage (new Gtk::CheckButton (M("EXIFFILTER_APERTURE")+":"));
Gtk::VBox* fnvb = Gtk::manage(new Gtk::VBox ());
Gtk::HBox* fnhb = Gtk::manage(new Gtk::HBox ());
fnvb->pack_start (*enaFNumber, Gtk::PACK_SHRINK, 0);
fnumberFrom = Gtk::manage(new Gtk::Entry ());
fnumberTo = Gtk::manage(new Gtk::Entry ());
fnhb->pack_start (*fnumberFrom, true, true, 2);
fnhb->pack_start (*Gtk::manage(new Gtk::Label(" - ")), false, false, 4);
fnhb->pack_start (*fnumberTo, true, true, 2);
fnvb->pack_start (*fnhb, Gtk::PACK_SHRINK, 0);
pack_start (*fnvb, Gtk::PACK_SHRINK, 4);
enaShutter = Gtk::manage(new Gtk::CheckButton(M("EXIFFILTER_SHUTTER")+":"));
Gtk::VBox* svb = Gtk::manage(new Gtk::VBox ());
Gtk::HBox* shb = Gtk::manage(new Gtk::HBox ());
svb->pack_start (*enaShutter, Gtk::PACK_SHRINK, 0);
shutterFrom = Gtk::manage(new Gtk::Entry ());
shutterTo = Gtk::manage(new Gtk::Entry ());
shb->pack_start (*shutterFrom, true, true, 2);
shb->pack_start (*Gtk::manage(new Gtk::Label(" - ")), false, false, 4);
shb->pack_start (*shutterTo, true, true, 2);
svb->pack_start (*shb, Gtk::PACK_SHRINK, 0);
pack_start (*svb, Gtk::PACK_SHRINK, 4);
enaISO = Gtk::manage(new Gtk::CheckButton(M("EXIFFILTER_ISO")+":"));
Gtk::VBox* ivb = Gtk::manage(new Gtk::VBox ());
Gtk::HBox* ihb = Gtk::manage(new Gtk::HBox ());
ivb->pack_start (*enaISO, Gtk::PACK_SHRINK, 0);
isoFrom = Gtk::manage(new Gtk::Entry ());
isoTo = Gtk::manage(new Gtk::Entry ());
ihb->pack_start (*isoFrom, true, true, 2);
ihb->pack_start (*Gtk::manage(new Gtk::Label(" - ")), false, false, 4);
ihb->pack_start (*isoTo, true, true, 2);
ivb->pack_start (*ihb, Gtk::PACK_SHRINK, 0);
pack_start (*ivb, Gtk::PACK_SHRINK, 4);
enaFocalLen = Gtk::manage(new Gtk::CheckButton(M("EXIFFILTER_FOCALLEN")+":"));
Gtk::VBox* fvb = Gtk::manage(new Gtk::VBox ());
Gtk::HBox* fhb = Gtk::manage(new Gtk::HBox ());
fvb->pack_start (*enaFocalLen, Gtk::PACK_SHRINK, 0);
focalFrom = Gtk::manage(new Gtk::Entry ());
focalTo = Gtk::manage(new Gtk::Entry ());
fhb->pack_start (*focalFrom, true, true, 2);
fhb->pack_start (*Gtk::manage(new Gtk::Label(" - ")), false, false, 4);
fhb->pack_start (*focalTo, true, true, 2);
fvb->pack_start (*fhb, Gtk::PACK_SHRINK, 0);
pack_start (*fvb, Gtk::PACK_SHRINK, 4);
enaCamera = Gtk::manage(new Gtk::CheckButton(M("EXIFFILTER_CAMERA")+":"));
Gtk::VBox* cvb = Gtk::manage(new Gtk::VBox ());
cvb->pack_start (*enaCamera, Gtk::PACK_SHRINK, 0);
camera = Gtk::manage(new Gtk::ListViewText (1, false, Gtk::SELECTION_MULTIPLE));
camera->set_headers_visible (false);
Gtk::ScrolledWindow* scamera = Gtk::manage(new Gtk::ScrolledWindow());
scamera->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS);
scamera->add(*camera);
cvb->pack_start (*scamera, Gtk::PACK_SHRINK, 0);
pack_start (*cvb, Gtk::PACK_SHRINK, 4);
enaLens = Gtk::manage(new Gtk::CheckButton(M("EXIFFILTER_LENS")+":"));
Gtk::VBox* lvb = Gtk::manage(new Gtk::VBox ());
lvb->pack_start (*enaLens, Gtk::PACK_SHRINK, 0);
lens = Gtk::manage(new Gtk::ListViewText (1, false, Gtk::SELECTION_MULTIPLE));
lens->set_headers_visible (false);
Gtk::ScrolledWindow* slens = Gtk::manage(new Gtk::ScrolledWindow());
slens->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS);
slens->add(*lens);
lvb->pack_start (*slens, Gtk::PACK_SHRINK, 0);
pack_start (*lvb, Gtk::PACK_SHRINK, 4);
conns = 0;
sChange[conns++] = fnumberFrom->signal_changed().connect (sigc::mem_fun(*this, &FilterPanel::valueChanged));
sChange[conns++] = fnumberTo->signal_changed().connect (sigc::mem_fun(*this, &FilterPanel::valueChanged));
sChange[conns++] = shutterFrom->signal_changed().connect (sigc::mem_fun(*this, &FilterPanel::valueChanged));
sChange[conns++] = shutterTo->signal_changed().connect (sigc::mem_fun(*this, &FilterPanel::valueChanged));
sChange[conns++] = isoFrom->signal_changed().connect (sigc::mem_fun(*this, &FilterPanel::valueChanged));
sChange[conns++] = isoTo->signal_changed().connect (sigc::mem_fun(*this, &FilterPanel::valueChanged));
sChange[conns++] = focalFrom->signal_changed().connect (sigc::mem_fun(*this, &FilterPanel::valueChanged));
sChange[conns++] = focalTo->signal_changed().connect (sigc::mem_fun(*this, &FilterPanel::valueChanged));
sChange[conns++] = camera->get_selection()->signal_changed().connect(sigc::mem_fun(*this, &FilterPanel::valueChanged));
sChange[conns++] = lens->get_selection()->signal_changed().connect(sigc::mem_fun(*this, &FilterPanel::valueChanged));
sChange[conns++] = enaFNumber->signal_toggled().connect( sigc::mem_fun(*this, &FilterPanel::valueChanged) );
sChange[conns++] = enaShutter->signal_toggled().connect( sigc::mem_fun(*this, &FilterPanel::valueChanged) );
sChange[conns++] = enaFocalLen->signal_toggled().connect( sigc::mem_fun(*this, &FilterPanel::valueChanged) );
sChange[conns++] = enaISO->signal_toggled().connect( sigc::mem_fun(*this, &FilterPanel::valueChanged) );
sChange[conns++] = enaCamera->signal_toggled().connect( sigc::mem_fun(*this, &FilterPanel::valueChanged) );
sChange[conns++] = enaLens->signal_toggled().connect( sigc::mem_fun(*this, &FilterPanel::valueChanged) );
sChange[conns++] = enabled->signal_toggled().connect( sigc::mem_fun(*this, &FilterPanel::valueChanged) );
set_size_request (0, -1);
show_all ();
}
void FilterPanel::setFilter (ExifFilterSettings& defefs, bool updateLists) {
for (int i=0; i<conns; i++)
sChange[i].block (true);
// enaFNumber->set_active (curefs.filterFNumber);
fnumberFrom->set_text (ImageMetaData::apertureToString (defefs.fnumberFrom));
curefs.fnumberFrom = defefs.fnumberFrom;
fnumberTo->set_text (ImageMetaData::apertureToString (defefs.fnumberTo));
curefs.fnumberTo = defefs.fnumberTo;
// enaShutter->set_active (curefs.filterShutter);
shutterFrom->set_text (ImageMetaData::shutterToString (defefs.shutterFrom));
curefs.shutterFrom = defefs.shutterFrom;
shutterTo->set_text (ImageMetaData::shutterToString (defefs.shutterTo));
curefs.shutterTo = defefs.shutterTo;
// enaISO->set_active (curefs.filterISO);
std::stringstream out;
out << defefs.isoFrom;
isoFrom->set_text ( out.str() );
curefs.isoFrom = defefs.isoFrom;
isoTo->set_text (Glib::ustring::format ((double)defefs.isoTo));
curefs.isoTo = defefs.isoTo;
// enaFocalLen->set_active (curefs.filterFocalLen);
focalFrom->set_text (Glib::ustring::format (defefs.focalFrom));
curefs.focalFrom = defefs.focalFrom;
focalTo->set_text (Glib::ustring::format (defefs.focalTo));
curefs.focalTo = defefs.focalTo;
// enaCamera->set_active (curefs.filterCamera);
Glib::RefPtr<Gtk::TreeSelection> cselection = camera->get_selection ();
// enaLens->set_active (curefs.filterLens);
Glib::RefPtr<Gtk::TreeSelection> lselection = lens->get_selection ();
if( updateLists ){
lens->clear_items();
curefs.lenses.clear();
for (std::set<std::string>::iterator i = defefs.lenses.begin(); i!=defefs.lenses.end(); i++) {
lens->append_text (*i);
curefs.lenses.insert(*i);
}
lselection->select_all();
camera->clear_items();
curefs.cameras.clear();
for (std::set<std::string>::iterator i = defefs.cameras.begin(); i!=defefs.cameras.end(); i++) {
camera->append_text(*i);
curefs.cameras.insert(*i);
}
cselection->select_all();
}else{
for( Gtk::TreeModel::Children::iterator iter = lens->get_model()->children().begin(); iter != lens->get_model()->children().end();iter++){
Glib::ustring v;
iter->get_value(0,v);
if( defefs.lenses.find( v ) != defefs.lenses.end() )
lselection->select( iter );
else
lselection->unselect( iter );
}
for( Gtk::TreeModel::Children::iterator iter = camera->get_model()->children().begin(); iter != camera->get_model()->children().end();iter++){
Glib::ustring v;
iter->get_value(0,v);
if( defefs.cameras.find( v ) != defefs.cameras.end() )
cselection->select(iter);
else
cselection->unselect(iter);
}
}
curefs = defefs;
for (int i=0; i<conns; i++)
sChange[i].block (false);
}
bool FilterPanel::isEnabled () {
return enabled->get_active () && is_sensitive();
}
ExifFilterSettings FilterPanel::getFilter () {
ExifFilterSettings efs;
efs.fnumberFrom = atof (fnumberFrom->get_text().c_str());
efs.fnumberTo = atof (fnumberTo->get_text().c_str());
efs.focalFrom = atof (focalFrom->get_text().c_str());
efs.focalTo = atof (focalTo->get_text().c_str());
efs.isoFrom = atoi (isoFrom->get_text().c_str());
efs.isoTo = atoi (isoTo->get_text().c_str());
efs.shutterFrom = ImageMetaData::shutterFromString (shutterFrom->get_text());
efs.shutterTo = ImageMetaData::shutterFromString (shutterTo->get_text());
efs.filterFNumber = enaFNumber->get_active ();
efs.filterShutter = enaShutter->get_active ();
efs.filterFocalLen = enaFocalLen->get_active ();
efs.filterISO = enaISO->get_active ();
efs.filterCamera = enaCamera->get_active ();
efs.filterLens = enaLens->get_active ();
std::vector<int> sel = camera->get_selected ();
for (int i=0; i<sel.size(); i++)
efs.cameras.insert (camera->get_text (sel[i]));
sel = lens->get_selected ();
for (int i=0; i<sel.size(); i++)
efs.lenses.insert (lens->get_text (sel[i]));
return efs;
}
void FilterPanel::valueChanged () {
if (listener)
listener->exifFilterChanged ();
}

View File

@@ -44,6 +44,7 @@ ImageArea::ImageArea (ImageAreaPanel* p) : parent(p) {
signal_size_allocate().connect( sigc::mem_fun(*this, &ImageArea::on_resized) );
dirty = false;
ipc = NULL;
}
void ImageArea::on_realize()

View File

@@ -44,7 +44,7 @@ class ImageArea : public Gtk::DrawingArea, public CropWindowListener {
bool showClippedH, showClippedS;
ImageAreaPanel* parent;
CropWindow* mainCropWindow;
std::list<CropWindow*> cropWins;
PreviewHandler* previewHandler;
rtengine::StagedImageProcessor* ipc;
@@ -60,7 +60,7 @@ class ImageArea : public Gtk::DrawingArea, public CropWindowListener {
CropWindow* getCropWindow (int x, int y);
public:
CropWindow* mainCropWindow;
ZoomPanel* zoomPanel;
IndicateClippedPanel* indClippedPanel;

View File

@@ -118,12 +118,14 @@ void Options::setDefaults () {
thumbnailZoomRatios.push_back (1.0);
overlayedFileNames = true;
showFileNames = true;
tabbedUI = false;
int babehav[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0};
baBehav = std::vector<int> (babehav, babehav+ADDSET_PARAM_NUM);
rtSettings.dualThreadEnabled = true;
rtSettings.demosaicMethod = "amaze";//Emil's code for AMaZE
rtSettings.demosaicMethod = "hphd";
rtSettings.demosaicMethodBatch = "hphd";
rtSettings.ca_autocorrect = false;//Emil's CA correction
rtSettings.hotdeadpix_filt = true;//Emil's hot/dead pixel filter
@@ -161,8 +163,8 @@ int Options::readFromFile (Glib::ustring fname) {
setDefaults ();
if (keyFile.has_group ("General")) {
Glib::ustring stup;
if (keyFile.has_group ("General")) {
if (keyFile.has_key ("General", "TabbedEditor")) tabbedUI= keyFile.get_boolean ("General", "TabbedEditor");
if (keyFile.has_key ("General", "StartupDirectory") && keyFile.get_string ("General", "StartupDirectory") == "home")
startupDir = STARTUPDIR_HOME;
else if (keyFile.has_key ("General", "StartupDirectory") && keyFile.get_string ("General", "StartupDirectory") == "current")
@@ -272,6 +274,7 @@ if (keyFile.has_group ("GUI")) {
if (keyFile.has_group ("Algorithms")) {
if (keyFile.has_key ("Algorithms", "DemosaicMethod")) rtSettings.demosaicMethod = keyFile.get_string ("Algorithms", "DemosaicMethod");
if (keyFile.has_key ("Algorithms", "DemosaicMethodBatch")) rtSettings.demosaicMethodBatch = keyFile.get_string ("Algorithms", "DemosaicMethodBatch");
if (keyFile.has_key ("Algorithms", "ColorCorrection")) rtSettings.colorCorrectionSteps = keyFile.get_integer ("Algorithms", "ColorCorrection");
if (keyFile.has_key ("Algorithms", "DCBIterations")) rtSettings.dcb_iterations = keyFile.get_integer("Algorithms", "DCBIterations");
if (keyFile.has_key ("Algorithms", "DCBEnhance")) rtSettings.dcb_enhance = keyFile.get_boolean("Algorithms", "DCBEnhance");
@@ -301,7 +304,8 @@ if (keyFile.has_group ("Batch Processing")) {
int Options::saveToFile (Glib::ustring fname) {
rtengine::SafeKeyFile keyFile;
keyFile.set_boolean ("General", "TabbedEditor", tabbedUI);
keyFile.set_boolean ("General", "StoreLastProfile", savesParamsAtExit);
if (startupDir==STARTUPDIR_HOME)
keyFile.set_string ("General", "StartupDirectory", "home");
@@ -403,6 +407,7 @@ int Options::saveToFile (Glib::ustring fname) {
keyFile.set_integer_list ("GUI", "CurvePanelsExpanded", crvopen);
keyFile.set_string ("Algorithms", "DemosaicMethod", rtSettings.demosaicMethod);
keyFile.set_string ("Algorithms", "DemosaicMethodBatch", rtSettings.demosaicMethodBatch);
keyFile.set_integer ("Algorithms", "ColorCorrection", rtSettings.colorCorrectionSteps);
keyFile.set_integer ("Algorithms", "DCBIterations", rtSettings.dcb_iterations);
keyFile.set_boolean ("Algorithms", "DCBEnhance", rtSettings.dcb_enhance);

View File

@@ -126,6 +126,7 @@ class Options {
std::vector<double> thumbnailZoomRatios;
bool overlayedFileNames;
bool showFileNames;
bool tabbedUI;
Options ();

View File

@@ -26,7 +26,7 @@
extern Options options;
extern Glib::ustring argv0;
Preferences::Preferences (int initialPage) {
Preferences::Preferences (RTWindow *rtwindow):parent(rtwindow) {
set_title (M("MAIN_BUTTON_PREFERENCES"));
@@ -77,7 +77,7 @@ Preferences::Preferences (int initialPage) {
nb->append_page (*getFileBrowserPanel(), M("PREFERENCES_TAB_BROWSER"));
nb->append_page (*getColorManagementPanel(),M("PREFERENCES_TAB_COLORMGR"));
nb->append_page (*getBatchProcPanel(), M("PREFERENCES_BATCH_PROCESSING"));
nb->set_current_page (initialPage);
nb->set_current_page (0);
fillPreferences ();
@@ -255,6 +255,7 @@ Gtk::Widget* Preferences::getProcParamsPanel () {
Gtk::VBox* fdb = Gtk::manage (new Gtk::VBox ());
fdb->set_border_width (4);
fdem->add (*fdb);
Gtk::Label* dmlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_DMETHOD")+":"));
dmethod = Gtk::manage (new Gtk::ComboBoxText ());
Gtk::HBox* hb11 = Gtk::manage (new Gtk::HBox ());
@@ -268,6 +269,21 @@ Gtk::Widget* Preferences::getProcParamsPanel () {
dmethod->append_text ("DCB");
dmethod->append_text ("Fast Demosaic");//("AHD");
dmethod->append_text ("Bilinear");
Gtk::Label* dmlab2 = Gtk::manage (new Gtk::Label (M("PREFERENCES_DMETHODBATCH")+": "));
dmethodBatch = Gtk::manage (new Gtk::ComboBoxText ());
Gtk::HBox* hb111 = Gtk::manage (new Gtk::HBox ());
hb111->pack_start (*dmlab2, Gtk::PACK_SHRINK, 4);
hb111->pack_start (*dmethodBatch);
dmethodBatch->append_text ("EAHD");
dmethodBatch->append_text ("HPHD");
dmethodBatch->append_text ("VNG-4");
//dmethod->append_text ("PPG");
dmethodBatch->append_text ("AMaZE");//Emil's code for AMaZE
dmethodBatch->append_text ("DCB");
dmethodBatch->append_text ("Fast Demosaic");//("AHD");
dmethodBatch->append_text ("Bilinear");
Gtk::Label* cclab = Gtk::manage (new Gtk::Label (M("PREFERENCES_FALSECOLOR")+":"));
ccSteps = Gtk::manage (new Gtk::SpinButton ());
ccSteps->set_digits (0);
@@ -316,6 +332,7 @@ Gtk::Widget* Preferences::getProcParamsPanel () {
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fdb->pack_start (*hb11, Gtk::PACK_SHRINK, 4);
fdb->pack_start (*hb111, Gtk::PACK_SHRINK, 4);
fdb->pack_start (*hb12, Gtk::PACK_SHRINK, 4);
fdb->pack_start (*hb13, Gtk::PACK_SHRINK, 4);
fdb->pack_start (*dcbEnhance, Gtk::PACK_SHRINK, 4);
@@ -338,6 +355,7 @@ Gtk::Widget* Preferences::getProcParamsPanel () {
}
dmconn = dmethod->signal_changed().connect( sigc::mem_fun(*this, &Preferences::dmethodChanged) );
dmconnBatch = dmethod->signal_changed().connect( sigc::mem_fun(*this, &Preferences::dmethodBatchChanged) );
return mvbpp;
}
@@ -377,6 +395,21 @@ Gtk::Widget* Preferences::getGeneralPanel () {
Gtk::VBox* mvbsd = new Gtk::VBox ();
Gtk::Frame* fworklflow = new Gtk::Frame (M("PREFERENCES_WORKFLOW"));
Gtk::HBox* hbworkflow = new Gtk::HBox ();
hbworkflow->set_border_width (4);
Gtk::Label* flayoutlab = new Gtk::Label (M("PREFERENCES_EDITORLAYOUT")+":");
editorLayout = new Gtk::ComboBoxText ();
editorLayout->append_text (M("PREFERENCES_SINGLETAB"));
editorLayout->append_text (M("PREFERENCES_MULTITAB"));
editorLayout->set_active (1);
hbworkflow->pack_start (*flayoutlab, Gtk::PACK_SHRINK, 4);
hbworkflow->pack_start (*editorLayout);
fworklflow->add (*hbworkflow);
mvbsd->pack_start (*fworklflow, Gtk::PACK_SHRINK, 4);
Gtk::Frame* flang = new Gtk::Frame (M("PREFERENCES_DEFAULTLANG"));
Gtk::HBox* hblang = new Gtk::HBox ();
hblang->set_border_width (4);
@@ -384,7 +417,6 @@ Gtk::Widget* Preferences::getGeneralPanel () {
languages = new Gtk::ComboBoxText ();
std::vector<Glib::ustring> langs;
parseDir (argv0 + "/languages", langs, "");
for (int i=0; i<langs.size(); i++) {
if ("default" != langs[i] && "README" != langs[i] && "LICENSE" != langs[i]) {
languages->append_text (langs[i]);
@@ -532,7 +564,7 @@ Gtk::Widget* Preferences::getGeneralPanel () {
tconn = theme->signal_changed().connect( sigc::mem_fun(*this, &Preferences::themeChanged) );
fconn = fontbutton->signal_font_set().connect( sigc::mem_fun(*this, &Preferences::fontChanged) );
return mvbsd;
}
@@ -764,6 +796,21 @@ void Preferences::storePreferences () {
moptions.rtSettings.demosaicMethod = "ahd";
else if (dmethod->get_active_row_number()==6)
moptions.rtSettings.demosaicMethod = "bilinear";
if (dmethodBatch->get_active_row_number()==0)
moptions.rtSettings.demosaicMethodBatch = "eahd";
else if (dmethodBatch->get_active_row_number()==1)
moptions.rtSettings.demosaicMethodBatch = "hphd";
else if (dmethodBatch->get_active_row_number()==2)
moptions.rtSettings.demosaicMethodBatch = "vng4";
else if (dmethodBatch->get_active_row_number()==3)
moptions.rtSettings.demosaicMethodBatch = "amaze";
else if (dmethodBatch->get_active_row_number()==4)
moptions.rtSettings.demosaicMethodBatch = "dcb";
else if (dmethodBatch->get_active_row_number()==5)
moptions.rtSettings.demosaicMethodBatch = "ahd";
else if (dmethodBatch->get_active_row_number()==6)
moptions.rtSettings.demosaicMethodBatch = "bilinear";
moptions.rtSettings.dcb_iterations=(int)dcbIterations->get_value();
moptions.rtSettings.dcb_enhance=dcbEnhance->get_active();
moptions.rtSettings.ca_autocorrect=caAutoCorrect->get_active();//Emil's CA correction
@@ -811,11 +858,14 @@ void Preferences::storePreferences () {
for (Gtk::TreeIter sections=behModel->children().begin(); sections!=behModel->children().end(); sections++)
for (Gtk::TreeIter adjs=sections->children().begin(); adjs!=sections->children().end(); adjs++)
moptions.baBehav[adjs->get_value (behavColumns.addsetid)] = adjs->get_value (behavColumns.badd);
moptions.tabbedUI = (bool)editorLayout->get_active_row_number();
}
void Preferences::fillPreferences () {
dmconn.block (true);
dmconnBatch.block(true);
tconn.block (true);
fconn.block (true);
@@ -836,7 +886,7 @@ void Preferences::fillPreferences () {
blinkClipped->set_active (moptions.blinkClipped);
hlThresh->set_value (moptions.highlightThreshold);
shThresh->set_value (moptions.shadowThreshold);
edGimp->set_active (moptions.editorToSendTo==1);
edOther->set_active (moptions.editorToSendTo==3);
#ifdef _WIN32
@@ -868,6 +918,22 @@ void Preferences::fillPreferences () {
dmethod->set_active (5);
else if (moptions.rtSettings.demosaicMethod=="bilinear")
dmethod->set_active (6);
if (moptions.rtSettings.demosaicMethodBatch=="eahd")
dmethodBatch->set_active (0);
else if (moptions.rtSettings.demosaicMethodBatch=="hphd")
dmethodBatch->set_active (1);
else if (moptions.rtSettings.demosaicMethodBatch=="vng4")
dmethodBatch->set_active (2);
else if (moptions.rtSettings.demosaicMethodBatch=="amaze")//Emil's code for AMaZE
dmethodBatch->set_active (3);
else if (moptions.rtSettings.demosaicMethodBatch=="dcb")
dmethodBatch->set_active (4);
else if (moptions.rtSettings.demosaicMethodBatch=="ahd")
dmethodBatch->set_active (5);
else if (moptions.rtSettings.demosaicMethodBatch=="bilinear")
dmethodBatch->set_active (6);
dcbEnhance->set_active(moptions.rtSettings.dcb_enhance);
dcbIterations->set_value(moptions.rtSettings.dcb_iterations);
dcbEnhance->set_sensitive(moptions.rtSettings.demosaicMethod=="dcb");
@@ -913,6 +979,7 @@ void Preferences::fillPreferences () {
saveParamsCache->set_active (moptions.saveParamsCache);
loadParamsPreference->set_active (moptions.paramsLoadLocation);
editorLayout->set_active(moptions.tabbedUI);
addc.block (true);
setc.block (true);
if (moptions.baBehav.size() == ADDSET_PARAM_NUM) {
@@ -929,6 +996,7 @@ void Preferences::fillPreferences () {
setc.block (false);
dmconn.block (false);
dmconnBatch.block(false);
tconn.block (false);
fconn.block (false);
}
@@ -950,6 +1018,7 @@ void Preferences::okPressed () {
storePreferences ();
options.copyFrom (&moptions);
workflowUpdate();
hide ();
}
@@ -1000,6 +1069,26 @@ void Preferences::dmethodChanged () {
}
}
void Preferences::dmethodBatchChanged () {
if (dmethod->get_active_row_number()==0)
ccSteps->set_value (2);
else if (dmethod->get_active_row_number()==1)
ccSteps->set_value (1);
else if (dmethod->get_active_row_number()==2)
ccSteps->set_value (2);
if (dmethod->get_active_row_number()==4) {
dcbEnhance->set_sensitive(true);
dcbIterations->set_sensitive(true);
dcbIterationsLabel->set_sensitive(true);
} else {
dcbEnhance->set_sensitive(false);
dcbIterations->set_sensitive(false);
dcbIterationsLabel->set_sensitive(false);
}
}
void Preferences::aboutPressed () {
Splash* splash = new Splash (-1);
@@ -1028,6 +1117,14 @@ void Preferences::switchThemeTo(Glib::ustring newTheme) {
gdk_event_send_clientmessage_toall ((GdkEvent*)&event);
}
void Preferences::workflowUpdate (){
if(moptions.tabbedUI)
parent->epanel->hide_all();
else
parent->epanel->show_all();
}
void Preferences::switchFontTo(Glib::ustring newFont) {
Gtk::RC::parse_string (Glib::ustring::compose(
@@ -1037,6 +1134,7 @@ void Preferences::switchFontTo(Glib::ustring newFont) {
gdk_event_send_clientmessage_toall ((GdkEvent*)&event);
}
void Preferences::addExtPressed () {
Gtk::TreeNodeChildren c = extensionModel->children ();

View File

@@ -1,158 +1,163 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __PREFERENCES_H__
#define __PREFERENCES_H__
#include <gtkmm.h>
#include <adjuster.h>
#include <options.h>
#include <vector>
class Preferences : public Gtk::Dialog {
class ExtensionColumns : public Gtk::TreeModel::ColumnRecord {
public:
Gtk::TreeModelColumn<bool> enabled;
Gtk::TreeModelColumn<Glib::ustring> ext;
ExtensionColumns() { add(enabled); add(ext); }
};
ExtensionColumns extensionColumns;
Glib::RefPtr<Gtk::ListStore> extensionModel;
class BehavColumns : public Gtk::TreeModel::ColumnRecord {
public:
Gtk::TreeModelColumn<Glib::ustring> label;
Gtk::TreeModelColumn<bool> badd;
Gtk::TreeModelColumn<bool> bset;
Gtk::TreeModelColumn<bool> visible;
Gtk::TreeModelColumn<int> addsetid;
BehavColumns() { add(label); add(badd); add(bset); add(visible); add(addsetid); }
};
Glib::RefPtr<Gtk::TreeStore> behModel;
BehavColumns behavColumns;
protected:
Gtk::ComboBoxText* rprofiles;
Gtk::ComboBoxText* iprofiles;
Gtk::ComboBoxText* dmethod;
Gtk::ComboBoxText* languages;
Gtk::Entry* dateformat;
Gtk::Entry* startupdir;
Gtk::RadioButton* sdcurrent;
Gtk::RadioButton* sdlast;
Gtk::RadioButton* sdhome;
Gtk::RadioButton* sdother;
Gtk::FileChooserButton* gimpDir;
Gtk::FileChooserButton* psDir;
Gtk::Entry* editorToSendTo;
Gtk::RadioButton* edGimp;
Gtk::RadioButton* edPS;
Gtk::RadioButton* edOther;
Gtk::CheckButton* showDateTime;
Gtk::CheckButton* showBasicExif;
Gtk::SpinButton* ccSteps;
Gtk::Label* dcbIterationsLabel;
Gtk::SpinButton* dcbIterations;
Gtk::CheckButton* dcbEnhance;
Gtk::CheckButton* caAutoCorrect;//Emil's CA correction
Gtk::CheckButton* HotDeadPixFilt;//Emil's hot/dead pixel filter
Gtk::Label* LineDenoiseLabel;//Emil's line denoise
Gtk::SpinButton* LineDenoise;
Gtk::Label* GreenEquilLabel;//Emil's Green equilibration
Gtk::SpinButton* GreenEquil;
Gtk::FileChooserButton* iccDir;
Gtk::FileChooserButton* monProfile;
Gtk::CheckButton* blinkClipped;
Gtk::SpinButton* hlThresh;
Gtk::SpinButton* shThresh;
Gtk::ComboBoxText* intent;
Gtk::ComboBoxText* theme;
Gtk::FontButton* fontbutton;
Gtk::ComboBoxText* cformat;
Gtk::SpinButton* maxThumbSize;
Gtk::SpinButton* maxCacheEntries;
Gtk::Button* clearThumbnails;
Gtk::Button* clearProfiles;
Gtk::Button* clearAll;
Gtk::Entry* extension;
Gtk::TreeView* extensions;
Gtk::Button* addExt;
Gtk::Button* delExt;
Gtk::CheckButton* overlayedFileNames;
Gtk::CheckButton* saveParamsFile;
Gtk::CheckButton* saveParamsCache;
Gtk::ComboBoxText* loadParamsPreference;
Options moptions;
Glib::ustring initialTheme;
Glib::ustring initialFont;
sigc::connection dmconn, tconn, fconn, addc, setc;
void fillPreferences ();
void storePreferences ();
void parseDir (Glib::ustring dirname, std::vector<Glib::ustring>& items, Glib::ustring ext);
void dmethodChanged ();
void themeChanged ();
void fontChanged ();
void switchThemeTo (Glib::ustring newTheme);
void switchFontTo (Glib::ustring newFont);
void appendBehavList (Gtk::TreeModel::iterator& parent, Glib::ustring label, int id, bool set);
Gtk::Widget* getProcParamsPanel ();
Gtk::Widget* getColorManagementPanel ();
Gtk::Widget* getFileBrowserPanel ();
Gtk::Widget* getGeneralPanel ();
Gtk::Widget* getBatchProcPanel ();
public:
Preferences (int initialPage=0);
void savePressed ();
void loadPressed ();
void okPressed ();
void cancelPressed ();
void aboutPressed ();
void selectStartupDir ();
void addExtPressed ();
void delExtPressed ();
void clearProfilesPressed ();
void clearThumbImagesPressed ();
void clearAllPressed ();
void behAddRadioToggled (const Glib::ustring& path);
void behSetRadioToggled (const Glib::ustring& path);
// void selectICCProfileDir ();
// void selectMonitorProfile ();
};
#endif
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __PREFERENCES_H__
#define __PREFERENCES_H__
#include <gtkmm.h>
#include <adjuster.h>
#include <options.h>
#include <vector>
#include "rtwindow.h"
class Preferences : public Gtk::Dialog {
class ExtensionColumns : public Gtk::TreeModel::ColumnRecord {
public:
Gtk::TreeModelColumn<bool> enabled;
Gtk::TreeModelColumn<Glib::ustring> ext;
ExtensionColumns() { add(enabled); add(ext); }
};
ExtensionColumns extensionColumns;
Glib::RefPtr<Gtk::ListStore> extensionModel;
class BehavColumns : public Gtk::TreeModel::ColumnRecord {
public:
Gtk::TreeModelColumn<Glib::ustring> label;
Gtk::TreeModelColumn<bool> badd;
Gtk::TreeModelColumn<bool> bset;
Gtk::TreeModelColumn<bool> visible;
Gtk::TreeModelColumn<int> addsetid;
BehavColumns() { add(label); add(badd); add(bset); add(visible); add(addsetid); }
};
Glib::RefPtr<Gtk::TreeStore> behModel;
BehavColumns behavColumns;
protected:
Gtk::ComboBoxText* rprofiles;
Gtk::ComboBoxText* iprofiles;
Gtk::ComboBoxText* dmethod;
Gtk::ComboBoxText* dmethodBatch;
Gtk::ComboBoxText* languages;
Gtk::Entry* dateformat;
Gtk::Entry* startupdir;
Gtk::RadioButton* sdcurrent;
Gtk::RadioButton* sdlast;
Gtk::RadioButton* sdhome;
Gtk::RadioButton* sdother;
Gtk::FileChooserButton* gimpDir;
Gtk::FileChooserButton* psDir;
Gtk::Entry* editorToSendTo;
Gtk::RadioButton* edGimp;
Gtk::RadioButton* edPS;
Gtk::RadioButton* edOther;
Gtk::CheckButton* showDateTime;
Gtk::CheckButton* showBasicExif;
Gtk::SpinButton* ccSteps;
Gtk::Label* dcbIterationsLabel;
Gtk::SpinButton* dcbIterations;
Gtk::CheckButton* dcbEnhance;
Gtk::CheckButton* caAutoCorrect;//Emil's CA correction
Gtk::CheckButton* HotDeadPixFilt;//Emil's hot/dead pixel filter
Gtk::Label* LineDenoiseLabel;//Emil's line denoise
Gtk::SpinButton* LineDenoise;
Gtk::Label* GreenEquilLabel;//Emil's Green equilibration
Gtk::SpinButton* GreenEquil;
Gtk::FileChooserButton* iccDir;
Gtk::FileChooserButton* monProfile;
Gtk::CheckButton* blinkClipped;
Gtk::SpinButton* hlThresh;
Gtk::SpinButton* shThresh;
Gtk::ComboBoxText* intent;
Gtk::ComboBoxText* theme;
Gtk::FontButton* fontbutton;
Gtk::ComboBoxText* cformat;
Gtk::SpinButton* maxThumbSize;
Gtk::SpinButton* maxCacheEntries;
Gtk::Button* clearThumbnails;
Gtk::Button* clearProfiles;
Gtk::Button* clearAll;
Gtk::Entry* extension;
Gtk::TreeView* extensions;
Gtk::Button* addExt;
Gtk::Button* delExt;
Gtk::CheckButton* overlayedFileNames;
Gtk::CheckButton* saveParamsFile;
Gtk::CheckButton* saveParamsCache;
Gtk::ComboBoxText* loadParamsPreference;
Gtk::ComboBoxText* editorLayout;
RTWindow* parent;
Options moptions;
sigc::connection dmconn, dmconnBatch, tconn, addc, setc;
Glib::ustring initialTheme;
Glib::ustring initialFont;
void fillPreferences ();
void storePreferences ();
void parseDir (Glib::ustring dirname, std::vector<Glib::ustring>& items, Glib::ustring ext);
void dmethodChanged ();
void dmethodBatchChanged ();
void workflowUpdate();
void themeChanged ();
void fontChanged ();
void switchThemeTo (Glib::ustring newTheme);
void switchFontTo (Glib::ustring newFont);
void appendBehavList (Gtk::TreeModel::iterator& parent, Glib::ustring label, int id, bool set);
Gtk::Widget* getProcParamsPanel ();
Gtk::Widget* getColorManagementPanel ();
Gtk::Widget* getFileBrowserPanel ();
Gtk::Widget* getGeneralPanel ();
Gtk::Widget* getBatchProcPanel ();
public:
Preferences (RTWindow *rtwindow);
void savePressed ();
void loadPressed ();
void okPressed ();
void cancelPressed ();
void aboutPressed ();
void selectStartupDir ();
void addExtPressed ();
void delExtPressed ();
void clearProfilesPressed ();
void clearThumbImagesPressed ();
void clearAllPressed ();
void behAddRadioToggled (const Glib::ustring& path);
void behSetRadioToggled (const Glib::ustring& path);
// void selectICCProfileDir ();
// void selectMonitorProfile ();
};
#endif

View File

@@ -1,214 +1,215 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include <previewwindow.h>
#include <guiutils.h>
#include <imagearea.h>
PreviewWindow::PreviewWindow () : previewHandler(NULL), mainCropWin(NULL),cCropMoving(NULL),cNormal(NULL), isMoving(false) {
rconn = signal_size_allocate().connect( sigc::mem_fun(*this, &PreviewWindow::on_resized) );
}
PreviewWindow::~PreviewWindow () {
if( cCropMoving )
delete cCropMoving;
if( cNormal )
delete cNormal;
}
void PreviewWindow::on_realize () {
Gtk::DrawingArea::on_realize ();
add_events(Gdk::EXPOSURE_MASK | Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::SCROLL_MASK);
cCropMoving = new Gdk::Cursor (Gdk::FLEUR);
cNormal = new Gdk::Cursor (Gdk::ARROW);
}
void PreviewWindow::getObservedFrameArea (int& x, int& y, int& w, int& h) {
if (mainCropWin) {
int cropX, cropY, cropW, cropH;
mainCropWin->getCropRectangle (cropX, cropY, cropW, cropH);
// translate it to screen coordinates
x = imgX + cropX*zoom;
y = imgY + cropY*zoom;
w = cropW * zoom;
h = cropH * zoom;
}
}
void PreviewWindow::updatePreviewImage () {
int W = get_width(), H = get_height();
Glib::RefPtr<Gdk::Window> wind = get_window();
if( ! wind )
return;
backBuffer = Gdk::Pixmap::create (wind, W, H, -1);
backBuffer->draw_rectangle (get_style()->get_base_gc(Gtk::STATE_NORMAL), true, 0, 0, W, H);
if (previewHandler) {
Glib::RefPtr<Gdk::Pixbuf> resPixbuf = previewHandler->getRoughImage (W, H, zoom);
if (resPixbuf) {
imgW = resPixbuf->get_width();
imgH = resPixbuf->get_height();
imgX = (W-imgW)/2;
imgY = (H-imgH)/2;
backBuffer->draw_pixbuf (get_style()->get_base_gc(Gtk::STATE_NORMAL), resPixbuf, 0, 0, imgX, imgY, -1, -1, Gdk::RGB_DITHER_NONE, 0, 0);
Cairo::RefPtr<Cairo::Context> cr = backBuffer->create_cairo_context();
if (previewHandler->getCropParams().enabled)
drawCrop (cr, imgX, imgY, imgW, imgH, 0, 0, zoom, previewHandler->getCropParams());
}
}
}
void PreviewWindow::setPreviewHandler (PreviewHandler* ph) {
previewHandler = ph;
previewHandler->addPreviewImageListener (this);
}
void PreviewWindow::on_resized (Gtk::Allocation& req) {
updatePreviewImage ();
queue_draw ();
}
bool PreviewWindow::on_expose_event (GdkEventExpose* event) {
if (backBuffer) {
Glib::RefPtr<Gdk::Window> window = get_window();
int bufferW, bufferH;
backBuffer->get_size (bufferW, bufferH);
if (!mainCropWin) {
mainCropWin = imageArea->getMainCropWindow ();
if (mainCropWin)
mainCropWin->addCropWindowListener (this);
}
if (get_width()!=bufferW && get_height()!=bufferH)
updatePreviewImage ();
window->draw_drawable (get_style()->get_base_gc(Gtk::STATE_NORMAL), backBuffer, 0, 0, 0, 0, -1, -1);
if (mainCropWin) {
Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context();
int x, y, w, h;
getObservedFrameArea (x, y, w, h);
cr->set_source_rgb (1.0, 1.0, 1.0);
cr->set_line_width (3);
cr->rectangle (x-1.5, y-1.5, w+2, h+2);
cr->stroke ();
cr->set_source_rgb (1.0, 0.0, 0.0);
cr->set_line_width (1);
cr->rectangle (x-1.5, y-1.5, w+2, h+2);
cr->stroke ();
}
}
return true;
}
void PreviewWindow::previewImageChanged () {
updatePreviewImage ();
queue_draw ();
}
void PreviewWindow::setImageArea (ImageArea* ia) {
imageArea = ia;
mainCropWin = ia->getMainCropWindow ();
if (mainCropWin)
mainCropWin->addCropWindowListener (this);
}
void PreviewWindow::cropPositionChanged (CropWindow* w) {
queue_draw ();
}
void PreviewWindow::cropWindowSizeChanged (CropWindow* w) {
queue_draw ();
}
void PreviewWindow::cropZoomChanged (CropWindow* w) {
queue_draw ();
}
bool PreviewWindow::on_motion_notify_event (GdkEventMotion* event) {
if (!mainCropWin)
return true;
int x, y, w, h;
getObservedFrameArea (x, y, w, h);
bool inside = event->x > x-6 && event->x < x+w-1+6 && event->y > y-6 && event->y < y+h-1+6;
bool moreInside = event->x > x+6 && event->x < x+w-1-6 && event->y > y+6 && event->y < y+h-1-6;
if (isMoving)
mainCropWin->remoteMove ((event->x - press_x)/zoom, (event->y - press_y)/zoom);
else if (inside && !moreInside)
get_window()->set_cursor (*cCropMoving);
else
get_window()->set_cursor (*cNormal);
return true;
}
bool PreviewWindow::on_button_press_event (GdkEventButton* event) {
if (!mainCropWin)
return true;
int x, y, w, h;
getObservedFrameArea (x, y, w, h);
bool inside = event->x > x-6 && event->x < x+w-1+6 && event->y > y-6 && event->y < y+h-1+6;
bool moreInside = event->x > x+6 && event->x < x+w-1-6 && event->y > y+6 && event->y < y+h-1-6;
if (!isMoving) {
isMoving = true;
if (!inside || moreInside) {
mainCropWin->remoteMove ((event->x - (x+w/2))/zoom, (event->y - (y+h/2))/zoom);
press_x = x+w/2;
press_y = y+h/2;
}
else {
press_x = event->x;
press_y = event->y;
}
get_window()->set_cursor (*cCropMoving);
}
return true;
}
bool PreviewWindow::on_button_release_event (GdkEventButton* event) {
if (!mainCropWin)
return true;
if (isMoving) {
isMoving = false;
get_window()->set_cursor (*cNormal);
mainCropWin->remoteMoveReady ();
}
return true;
}
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include <previewwindow.h>
#include <guiutils.h>
#include <imagearea.h>
PreviewWindow::PreviewWindow () : previewHandler(NULL), mainCropWin(NULL),cCropMoving(NULL),cNormal(NULL), isMoving(false), imageArea(NULL) {
rconn = signal_size_allocate().connect( sigc::mem_fun(*this, &PreviewWindow::on_resized) );
}
PreviewWindow::~PreviewWindow () {
if( cCropMoving )
delete cCropMoving;
if( cNormal )
delete cNormal;
}
void PreviewWindow::on_realize () {
Gtk::DrawingArea::on_realize ();
add_events(Gdk::EXPOSURE_MASK | Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::SCROLL_MASK);
cCropMoving = new Gdk::Cursor (Gdk::FLEUR);
cNormal = new Gdk::Cursor (Gdk::ARROW);
}
void PreviewWindow::getObservedFrameArea (int& x, int& y, int& w, int& h) {
if (mainCropWin) {
int cropX, cropY, cropW, cropH;
mainCropWin->getCropRectangle (cropX, cropY, cropW, cropH);
// translate it to screen coordinates
x = imgX + cropX*zoom;
y = imgY + cropY*zoom;
w = cropW * zoom;
h = cropH * zoom;
}
}
void PreviewWindow::updatePreviewImage () {
int W = get_width(), H = get_height();
Glib::RefPtr<Gdk::Window> wind = get_window();
if( ! wind )
return;
backBuffer = Gdk::Pixmap::create (wind, W, H, -1);
backBuffer->draw_rectangle (get_style()->get_base_gc(Gtk::STATE_NORMAL), true, 0, 0, W, H);
if (previewHandler) {
Glib::RefPtr<Gdk::Pixbuf> resPixbuf = previewHandler->getRoughImage (W, H, zoom);
if (resPixbuf) {
imgW = resPixbuf->get_width();
imgH = resPixbuf->get_height();
imgX = (W-imgW)/2;
imgY = (H-imgH)/2;
backBuffer->draw_pixbuf (get_style()->get_base_gc(Gtk::STATE_NORMAL), resPixbuf, 0, 0, imgX, imgY, -1, -1, Gdk::RGB_DITHER_NONE, 0, 0);
Cairo::RefPtr<Cairo::Context> cr = backBuffer->create_cairo_context();
if (previewHandler->getCropParams().enabled)
drawCrop (cr, imgX, imgY, imgW, imgH, 0, 0, zoom, previewHandler->getCropParams());
}
}
}
void PreviewWindow::setPreviewHandler (PreviewHandler* ph) {
previewHandler = ph;
if (previewHandler)
previewHandler->addPreviewImageListener (this);
}
void PreviewWindow::on_resized (Gtk::Allocation& req) {
updatePreviewImage ();
queue_draw ();
}
bool PreviewWindow::on_expose_event (GdkEventExpose* event) {
if (backBuffer) {
Glib::RefPtr<Gdk::Window> window = get_window();
int bufferW, bufferH;
backBuffer->get_size (bufferW, bufferH);
if (!mainCropWin && imageArea) {
mainCropWin = imageArea->getMainCropWindow ();
if (mainCropWin)
mainCropWin->addCropWindowListener (this);
}
if (get_width()!=bufferW && get_height()!=bufferH)
updatePreviewImage ();
window->draw_drawable (get_style()->get_base_gc(Gtk::STATE_NORMAL), backBuffer, 0, 0, 0, 0, -1, -1);
if (mainCropWin) {
Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context();
int x, y, w, h;
getObservedFrameArea (x, y, w, h);
cr->set_source_rgb (1.0, 1.0, 1.0);
cr->set_line_width (3);
cr->rectangle (x-1.5, y-1.5, w+2, h+2);
cr->stroke ();
cr->set_source_rgb (1.0, 0.0, 0.0);
cr->set_line_width (1);
cr->rectangle (x-1.5, y-1.5, w+2, h+2);
cr->stroke ();
}
}
return true;
}
void PreviewWindow::previewImageChanged () {
updatePreviewImage ();
queue_draw ();
}
void PreviewWindow::setImageArea (ImageArea* ia) {
imageArea = ia;
mainCropWin = ia->getMainCropWindow ();
if (mainCropWin)
mainCropWin->addCropWindowListener (this);
}
void PreviewWindow::cropPositionChanged (CropWindow* w) {
queue_draw ();
}
void PreviewWindow::cropWindowSizeChanged (CropWindow* w) {
queue_draw ();
}
void PreviewWindow::cropZoomChanged (CropWindow* w) {
queue_draw ();
}
bool PreviewWindow::on_motion_notify_event (GdkEventMotion* event) {
if (!mainCropWin)
return true;
int x, y, w, h;
getObservedFrameArea (x, y, w, h);
bool inside = event->x > x-6 && event->x < x+w-1+6 && event->y > y-6 && event->y < y+h-1+6;
bool moreInside = event->x > x+6 && event->x < x+w-1-6 && event->y > y+6 && event->y < y+h-1-6;
if (isMoving)
mainCropWin->remoteMove ((event->x - press_x)/zoom, (event->y - press_y)/zoom);
else if (inside && !moreInside)
get_window()->set_cursor (*cCropMoving);
else
get_window()->set_cursor (*cNormal);
return true;
}
bool PreviewWindow::on_button_press_event (GdkEventButton* event) {
if (!mainCropWin)
return true;
int x, y, w, h;
getObservedFrameArea (x, y, w, h);
bool inside = event->x > x-6 && event->x < x+w-1+6 && event->y > y-6 && event->y < y+h-1+6;
bool moreInside = event->x > x+6 && event->x < x+w-1-6 && event->y > y+6 && event->y < y+h-1-6;
if (!isMoving) {
isMoving = true;
if (!inside || moreInside) {
mainCropWin->remoteMove ((event->x - (x+w/2))/zoom, (event->y - (y+h/2))/zoom);
press_x = x+w/2;
press_y = y+h/2;
}
else {
press_x = event->x;
press_y = event->y;
}
get_window()->set_cursor (*cCropMoving);
}
return true;
}
bool PreviewWindow::on_button_release_event (GdkEventButton* event) {
if (!mainCropWin)
return true;
if (isMoving) {
isMoving = false;
get_window()->set_cursor (*cNormal);
mainCropWin->remoteMoveReady ();
}
return true;
}

View File

@@ -44,9 +44,10 @@ class ProcessingThread {
virtual void end () {}
void process () {
if (stopped)
if (stopped){
#undef THREAD_PRIORITY_NORMAL
thread = Glib::Thread::create(sigc::mem_fun(*this, &ProcessingThread::process_), (unsigned long int)0, true, true, Glib::THREAD_PRIORITY_NORMAL);
}
}
void process_ () {
stopped = false;

View File

@@ -37,6 +37,7 @@ RTWindow::RTWindow () {
set_title("RawTherapee "+versionString);
property_allow_shrink() = true;
set_default_size(options.windowWidth, options.windowHeight);
maximize();
set_modal(false);
set_resizable(true);
if (options.windowMaximized)
@@ -60,6 +61,7 @@ RTWindow::RTWindow () {
hbf->set_spacing (2);
hbf->show_all ();
mainNB->append_page (*fpanel, *hbf);
fpanel->signal_expose_event().connect( sigc::mem_fun(*this, &RTWindow::on_expose_event_fpanel) );
bpanel = new BatchQueuePanel ();
bpanel->setParent (this);
@@ -71,6 +73,20 @@ RTWindow::RTWindow () {
hbb->set_spacing (2);
hbb->show_all ();
mainNB->append_page (*bpanel, *hbb);
epanel = new EditorPanel (fpanel);
epanel->setParent (this);
// decorate tab
Gtk::HBox* hbe = Gtk::manage (new Gtk::HBox ());
hbe->pack_start (*Gtk::manage (new Gtk::Image (Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU)));
hbe->pack_start (*Gtk::manage (new Gtk::Label("Editor")));
hbe->set_spacing (2);
hbe->show_all ();
mainNB->append_page (*epanel, *hbe);
mainNB->set_current_page (mainNB->page_num (*fpanel));
epanel->signal_expose_event().connect( sigc::mem_fun(*this, &RTWindow::on_expose_event_epanel) );
signal_key_press_event().connect( sigc::mem_fun(*this, &RTWindow::keyPressed) );
@@ -104,6 +120,9 @@ RTWindow::RTWindow () {
add (*mainBox);
show_all ();
if(options.tabbedUI)
epanel->hide_all();
}
void RTWindow::on_realize () {
@@ -164,7 +183,7 @@ void RTWindow::addEditorPanel (EditorPanel* ep, const std::string &name) {
epanels[ name ] = ep;
filesEdited.insert ( name );
fpanel->refreshEditedState (filesEdited);
fpanel->refreshEditedState (filesEdited);
}
void RTWindow::remEditorPanel (EditorPanel* ep) {
@@ -212,8 +231,10 @@ void RTWindow::addBatchQueueJob (BatchQueueEntry* bqe, bool head) {
bool RTWindow::on_delete_event(GdkEventAny* event) {
fpanel->saveOptions ();
bpanel->saveOptions ();
// epanel->saveOptions();
/* if (fileBrowser->getFileCatalog()->getBatchQueue()->hasJobs()) {
Gtk::MessageDialog msgd (M("MAIN_MSG_EXITJOBSINQUEUEQUEST"), false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO, true);
@@ -259,7 +280,7 @@ bool RTWindow::on_delete_event(GdkEventAny* event) {
void RTWindow::showPreferences () {
Preferences *pref = new Preferences ();
Preferences *pref = new Preferences (this);
pref->run ();
delete pref;
@@ -297,3 +318,36 @@ void RTWindow::toggle_fullscreen () {
void RTWindow::error (Glib::ustring descr){
prLabel.set_text ( descr );
}
void RTWindow::SetEditorCurrent()
{
mainNB->set_current_page (mainNB->page_num (*epanel));
}
bool RTWindow::on_expose_event_epanel(GdkEventExpose* event)
{
if(!options.tabbedUI && epanel->catalogPane->get_children().size() ==0 ){
FileCatalog *fCatalog = fpanel->fileCatalog;
fpanel->ribbonPane->remove(*fCatalog);
epanel->catalogPane->add(*fCatalog);
fCatalog->fileBrowser->setArrangement(ThumbBrowserBase::TB_Horizontal);
fCatalog->redrawAll();
}
return false; // Gtk::VBox::on_expose_event(event);
}
bool RTWindow::on_expose_event_fpanel(GdkEventExpose* event)
{
if(!options.tabbedUI && fpanel->ribbonPane->get_children().size() ==0 ){
FileCatalog *fCatalog = fpanel->fileCatalog;
epanel->catalogPane->remove(*fCatalog);
//dirpaned->pack2(*fileCatalog,true,true);
fpanel->ribbonPane->add(*fCatalog);
fCatalog->fileBrowser->setArrangement(ThumbBrowserBase::TB_Vertical);
fCatalog->redrawAll();
}
return false; // Gtk::HPaned::on_expose_event(event);
}

View File

@@ -30,7 +30,7 @@ class RTWindow : public Gtk::Window, public rtengine::ProgressListener{
private:
Gtk::Notebook* mainNB;
FilePanel* fpanel;
FilePanel* fpanel;
BatchQueuePanel* bpanel;
std::set<Glib::ustring> filesEdited;
std::map<Glib::ustring, EditorPanel*> epanels;
@@ -41,7 +41,8 @@ class RTWindow : public Gtk::Window, public rtengine::ProgressListener{
bool is_fullscreen;
Gtk::Button * btn_fullscreen;
bool on_expose_event_epanel(GdkEventExpose* event);
bool on_expose_event_fpanel(GdkEventExpose* event);
public:
RTWindow ();
@@ -64,6 +65,8 @@ class RTWindow : public Gtk::Window, public rtengine::ProgressListener{
void setProgressState (int state);
void error (Glib::ustring descr);
rtengine::ProgressListener* getProgressListener () { return pldBridge; }
EditorPanel* epanel;
void SetEditorCurrent();
};
#endif

View File

@@ -138,11 +138,11 @@ void ThumbBrowserBase::arrangeFiles () {
if (arrangement==TB_Horizontal) {
int numOfRows = 1;
if (rowHeight>0) {
numOfRows = (internal.get_height()+rowHeight/2)/rowHeight;
if (numOfRows<1)
numOfRows = 1;
}
// if (rowHeight>0) {
// numOfRows = (internal.get_height()+rowHeight/2)/rowHeight;
// if (numOfRows<1)
// numOfRows = 1;
// }
int ct = 0;
int currx = 0; int curry = 0;
@@ -401,7 +401,7 @@ bool ThumbBrowserBase::Internal::on_expose_event(GdkEventExpose* event) {
dirty = false;
Glib::RefPtr<Gdk::Window> window = get_window();
Glib::RefPtr<Gdk::Window> window = get_window();
int w = get_width();
int h = get_height();
@@ -411,14 +411,14 @@ bool ThumbBrowserBase::Internal::on_expose_event(GdkEventExpose* event) {
Glib::RefPtr<Pango::Context> context = get_pango_context ();
context->set_font_description (get_style()->get_font());
for (int i=0; i<parent->fd.size(); i++) {
if (!parent->fd[i]->drawable || !parent->fd[i]->insideWindow (0, 0, w, h))
if (!parent->fd[i]->drawable || !parent->fd[i]->insideWindow (0, 0, w, h))
parent->fd[i]->updatepriority = false;
else {
parent->fd[i]->updatepriority = true;
parent->fd[i]->draw ();
}
}
return true;
}
@@ -480,7 +480,7 @@ void ThumbBrowserBase::zoomChanged (bool zoomIn) {
#ifdef _WIN32
gdk_window_process_updates (get_window()->gobj(), true);
#endif
}
}
void ThumbBrowserBase::refreshThumbImages () {
for (int i=0; i<fd.size(); i++){
@@ -502,7 +502,7 @@ void ThumbBrowserBase::refreshEditedState (const std::set<Glib::ustring>& efiles
void ThumbBrowserBase::setArrangement (Arrangement a) {
arrangement = a;
arrangement = a;
redraw ();
}

View File

@@ -91,7 +91,7 @@ class ThumbBrowserBase : public Gtk::VBox {
void zoomIn () { zoomChanged (true); }
void zoomOut () { zoomChanged (false); }
const std::vector<ThumbBrowserEntryBase*>& getEntries () { return fd; }
const std::vector<ThumbBrowserEntryBase*>& getEntries () { return fd; }
void styleChanged (const Glib::RefPtr<Gtk::Style>& style);
void redraw (); // arrange files and draw area
void refreshThumbImages (); // refresh thumbnail sizes, re-generate thumbnail images, arrange and draw

View File

@@ -344,8 +344,8 @@ void ThumbBrowserEntryBase::draw () {
Glib::RefPtr<Gdk::GC> gc_ = Gdk::GC::create (w->get_window());
Gdk::Color textn = w->get_style()->get_text(Gtk::STATE_NORMAL);
Gdk::Color texts = w->get_style()->get_text(Gtk::STATE_SELECTED);
// Gdk::Color textn = w->get_style()->get_text(Gtk::STATE_NORMAL);
// Gdk::Color texts = w->get_style()->get_text(Gtk::STATE_SELECTED);
Gdk::Color bgn = w->get_style()->get_bg(Gtk::STATE_NORMAL);
Gdk::Color bgs = w->get_style()->get_bg(Gtk::STATE_SELECTED);

View File

@@ -1,175 +1,165 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include <thumbimageupdater.h>
#include <gtkmm.h>
#define threadNum 4 // IF LCMS GETS THREAD SAFETY WE CAN ENABLE MORE THREADS
ThumbImageUpdater thumbImageUpdater;
ThumbImageUpdater::ThumbImageUpdater ()
: tostop(false), stopped(true), qMutex(NULL), startMutex(NULL) {
threadPool = new Glib::Thread* [threadNum];
}
ThumbImageUpdater::~ThumbImageUpdater ()
{
delete [] threadPool;
}
void ThumbImageUpdater::add (Thumbnail* t, const rtengine::procparams::ProcParams& params, int height, bool* priority, ThumbImageUpdateListener* l) {
if (!qMutex)
qMutex = new Glib::Mutex ();
if (!startMutex)
startMutex = new Glib::Mutex ();
qMutex->lock ();
// look up if an older version is in the queue
std::list<Job>::iterator i;
for (i=jqueue.begin(); i!=jqueue.end(); i++)
if (i->thumbnail==t && i->listener==l) {
i->pparams = params;
i->height = height;
i->priority = priority;
break;
}
// not found, create and append new job
if (i==jqueue.end ()) {
Job j;
j.thumbnail = t;
j.pparams = params;
j.height = height;
j.listener = l;
j.priority = priority;
jqueue.push_back (j);
}
qMutex->unlock ();
}
void ThumbImageUpdater::process () {
if (stopped) {
#undef THREAD_PRIORITY_LOW
stopped = false;
thread = Glib::Thread::create(sigc::mem_fun(*this, &ThumbImageUpdater::process_), (unsigned long int)0, true, true, Glib::THREAD_PRIORITY_LOW);
}
}
void ThumbImageUpdater::process_ () {
stopped = false;
tostop = false;
while (!tostop && !jqueue.empty ()) {
qMutex->lock ();
int threads = 0;
for (; threads<threadNum && !jqueue.empty (); threads++) {
// find first entry having update priority, if any
std::list<Job>::iterator i;
for (i=jqueue.begin (); i!=jqueue.end(); i++)
if (*(i->priority))
break;
if (i==jqueue.end())
i = jqueue.begin();
Job current = *i;
jqueue.erase (i);
if (current.listener)
threadPool[threads] = Glib::Thread::create(sigc::bind(sigc::mem_fun(*this, &ThumbImageUpdater::processJob), current), 0, true, true, Glib::THREAD_PRIORITY_LOW);
//else
// threadPool[threads] = NULL;
}
qMutex->unlock ();
for (int j=0; j<threads; j++)
if (threadPool[j])
threadPool[j]->join ();
for(int j =0; j <threadNum;j++)
threadPool[j] = NULL;
}
stopped = true;
}
void ThumbImageUpdater::processJob (Job current) {
if (current.listener) {
double scale = 1.0;
rtengine::IImage8* img = current.thumbnail->processThumbImage (current.pparams, current.height, scale);
if (img)
current.listener->updateImage (img, scale, current.pparams.crop);
}
}
void ThumbImageUpdater::stop () {
if (stopped) {
tostop = true;
return; }
gdk_threads_leave();
tostop = true;
Glib::Thread::self()->yield();
if (!stopped)
thread->join ();
gdk_threads_enter();
}
void ThumbImageUpdater::removeJobs () {
if (!qMutex)
return;
qMutex->lock ();
while (!jqueue.empty())
jqueue.pop_front ();
qMutex->unlock ();
}
void ThumbImageUpdater::removeJobs (ThumbImageUpdateListener* listener) {
if (!qMutex)
return;
qMutex->lock ();
bool ready = false;
while (!ready) {
ready = true;
std::list<Job>::iterator i;
for (i=jqueue.begin(); i!=jqueue.end(); i++)
if (i->listener == listener) {
jqueue.erase (i);
ready = false;
break;
}
}
qMutex->unlock ();
}
void ThumbImageUpdater::terminate () {
stop ();
removeJobs ();
}
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include <thumbimageupdater.h>
#include <gtkmm.h>
#define threadNum 8
ThumbImageUpdater thumbImageUpdater;
ThumbImageUpdater::ThumbImageUpdater ()
: tostop(false), stopped(true), qMutex(NULL), startMutex(NULL), threadPool(NULL) {
}
ThumbImageUpdater::~ThumbImageUpdater ()
{
delete threadPool;
}
void ThumbImageUpdater::add (Thumbnail* t, const rtengine::procparams::ProcParams& params, int height, bool* priority, ThumbImageUpdateListener* l) {
if (!qMutex)
qMutex = new Glib::Mutex ();
if (!startMutex)
startMutex = new Glib::Mutex ();
qMutex->lock ();
// look up if an older version is in the queue
std::list<Job>::iterator i;
for (i=jqueue.begin(); i!=jqueue.end(); i++)
if (i->thumbnail==t && i->listener==l) {
i->pparams = params;
i->height = height;
i->priority = priority;
break;
}
// not found, create and append new job
if (i==jqueue.end ()) {
Job j;
j.thumbnail = t;
j.pparams = params;
j.height = height;
j.listener = l;
j.priority = priority;
jqueue.push_back (j);
}
qMutex->unlock ();
}
void ThumbImageUpdater::process () {
if (stopped) {
stopped = false;
if(!threadPool)
threadPool = new Glib::ThreadPool(threadNum,0);
//thread = Glib::Thread::create (sigc::mem_fun(*this, &ThumbImageUpdater::process_), (unsigned long int)0, true, true, Glib::THREAD_PRIORITY_NORMAL);
process_();
}
}
void ThumbImageUpdater::process_ () {
stopped = false;
tostop = false;
while (!tostop && !jqueue.empty ()) {
std::list<Job>::iterator i;
for (i=jqueue.begin (); i!=jqueue.end(); i++)
if (*(i->priority))
break;
if (i==jqueue.end())
i = jqueue.begin();
Job current = *i;
if (current.listener)
threadPool->push(sigc::bind(sigc::mem_fun(*this, &ThumbImageUpdater::processJob), current));
jqueue.erase (i);
}
stopped = true;
//printf("Threads # %d \n", threadPool->get_num_threads());
}
void ThumbImageUpdater::processJob (Job current) {
if (current.listener) {
double scale = 1.0;
rtengine::IImage8* img = current.thumbnail->processThumbImage (current.pparams, current.height, scale);
if (img)
current.listener->updateImage (img, scale, current.pparams.crop);
}
}
void ThumbImageUpdater::stop () {
gdk_threads_leave();
tostop = true;
if (threadPool) {
threadPool->shutdown(TRUE);
threadPool = NULL;
}
gdk_threads_enter();
}
void ThumbImageUpdater::removeJobs () {
if (!qMutex)
return;
qMutex->lock ();
while (!jqueue.empty())
jqueue.pop_front ();
qMutex->unlock ();
}
void ThumbImageUpdater::removeJobs (ThumbImageUpdateListener* listener) {
if (!qMutex)
return;
qMutex->lock ();
bool ready = false;
while (!ready) {
ready = true;
std::list<Job>::iterator i;
for (i=jqueue.begin(); i!=jqueue.end(); i++)
if (i->listener == listener) {
jqueue.erase (i);
ready = false;
break;
}
}
qMutex->unlock ();
}
void ThumbImageUpdater::terminate () {
stop ();
removeJobs ();
}

View File

@@ -1,68 +1,70 @@
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _THUMBIMAGEUPDATER_
#define _THUMBIMAGEUPDATER_
#include <glibmm.h>
#include <rtengine.h>
#include <thumbnail.h>
class ThumbImageUpdateListener {
public:
virtual void updateImage (rtengine::IImage8* img, double scale, rtengine::procparams::CropParams cropParams) {}
};
class ThumbImageUpdater {
struct Job {
Thumbnail* thumbnail;
rtengine::procparams::ProcParams pparams;
int height;
bool* priority;
ThumbImageUpdateListener* listener;
};
protected:
bool tostop;
bool stopped;
std::list<Job> jqueue;
Glib::Thread* thread;
Glib::Mutex* qMutex;
Glib::Mutex* startMutex;
Glib::Thread **threadPool;
public:
ThumbImageUpdater ();
~ThumbImageUpdater ();
void add (Thumbnail* t, const rtengine::procparams::ProcParams& params, int height, bool* priority, ThumbImageUpdateListener* l);
void process ();
void stop ();
void removeJobs ();
void removeJobs (ThumbImageUpdateListener* listener);
void terminate ();
void process_ ();
void processJob (Job current);
};
extern ThumbImageUpdater thumbImageUpdater;
#endif
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
*
* RawTherapee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _THUMBIMAGEUPDATER_
#define _THUMBIMAGEUPDATER_
#include <glibmm.h>
#include <rtengine.h>
#include <thumbnail.h>
#include <glib.h>
class ThumbImageUpdateListener {
public:
virtual void updateImage (rtengine::IImage8* img, double scale, rtengine::procparams::CropParams cropParams) {}
};
class ThumbImageUpdater {
struct Job {
Thumbnail* thumbnail;
rtengine::procparams::ProcParams pparams;
int height;
bool* priority;
ThumbImageUpdateListener* listener;
};
protected:
bool tostop;
bool stopped;
std::list<Job> jqueue;
Glib::Thread* thread;
Glib::Mutex* qMutex;
Glib::Mutex* startMutex;
//Glib::Thread **threadPool;
Glib::ThreadPool * threadPool;
public:
ThumbImageUpdater ();
~ThumbImageUpdater ();
void add (Thumbnail* t, const rtengine::procparams::ProcParams& params, int height, bool* priority, ThumbImageUpdateListener* l);
void process ();
void stop ();
void removeJobs ();
void removeJobs (ThumbImageUpdateListener* listener);
void terminate ();
void process_ ();
void processJob (Job current);
};
extern ThumbImageUpdater thumbImageUpdater;
#endif

View File

@@ -254,7 +254,7 @@ void ToolPanelCoordinator::initImage (rtengine::StagedImageProcessor* ipc_, bool
void ToolPanelCoordinator::closeImage () {
if (ipc) {
ipc->stopProcessing ();
ipc->stopProcessing ();
ipc = NULL;
}
}

0
tools/generateTranslationDiffs.sh Executable file → Normal file
View File