commit after merge with trunk

This commit is contained in:
askv 2010-09-09 20:26:00 -07:00
parent 84ecfe412a
commit aa77b69443
18 changed files with 394 additions and 301 deletions

View File

@ -712,3 +712,13 @@ HISTOGRAM_BUTTON_L;L
### ###
CURVEEDITOR_NURBS;Control cage CURVEEDITOR_NURBS;Control cage
###
MAIN_BUTTON_SAVE_TOOLTIP;Save current image <b>Ctrl+S</b>
MAIN_BUTTON_PUTTOQUEUE_TOOLTIP;Add current image to processing queue <b>Ctrl+Q</b>
MAIN_BUTTON_SENDTOEDITOR_TOOLTIP;Edit current image in external editor <b>Ctrl+E</b>
###
SAVEDLG_AUTOSUFFIX;Automatically add a suffix if the file already exists

View File

@ -721,3 +721,6 @@ MAIN_BUTTON_SAVE_TOOLTIP;Save current image <b>Ctrl+S</b>
MAIN_BUTTON_PUTTOQUEUE_TOOLTIP;Add current image to processing queue <b>Ctrl+Q</b> MAIN_BUTTON_PUTTOQUEUE_TOOLTIP;Add current image to processing queue <b>Ctrl+Q</b>
MAIN_BUTTON_SENDTOEDITOR_TOOLTIP;Edit current image in external editor <b>Ctrl+E</b> MAIN_BUTTON_SENDTOEDITOR_TOOLTIP;Edit current image in external editor <b>Ctrl+E</b>
###
SAVEDLG_AUTOSUFFIX;Automatically add a suffix if the file already exists

View File

@ -723,3 +723,6 @@ MAIN_BUTTON_SAVE_TOOLTIP;Enregistrer l'image courante <b>Ctrl+S</b>
MAIN_BUTTON_PUTTOQUEUE_TOOLTIP;Ajouter l'image courante à la file de traitement <b>Ctrl+Q</b> MAIN_BUTTON_PUTTOQUEUE_TOOLTIP;Ajouter l'image courante à la file de traitement <b>Ctrl+Q</b>
MAIN_BUTTON_SENDTOEDITOR_TOOLTIP;Éditer l'image courante dans l'éditeur externe <b>Ctrl+E</b> MAIN_BUTTON_SENDTOEDITOR_TOOLTIP;Éditer l'image courante dans l'éditeur externe <b>Ctrl+E</b>
###
SAVEDLG_AUTOSUFFIX;Ajouter automatiquement un suffixe si le fichier existe déjà

View File

@ -6099,7 +6099,7 @@ void CLASS adobe_coeff (const char *make, const char *model)
{ "Canon EOS", 0, 0, { "Canon EOS", 0, 0,
{ 8197,-2000,-1118,-6714,14335,2592,-2536,3178,8266 } }, { 8197,-2000,-1118,-6714,14335,2592,-2536,3178,8266 } },
{ "Canon PowerShot A530", 0, 0, { "Canon PowerShot A530", 0, 0,
{ 0 } }, /* don't want the A5 matrix */ { 0 } }, /* don't want the A5 matrix */
{ "Canon PowerShot A50", 0, 0, { "Canon PowerShot A50", 0, 0,
{ -5300,9846,1776,3436,684,3939,-5540,9879,6200,-1404,11175,217 } }, { -5300,9846,1776,3436,684,3939,-5540,9879,6200,-1404,11175,217 } },
{ "Canon PowerShot A5", 0, 0, { "Canon PowerShot A5", 0, 0,
@ -8937,7 +8937,7 @@ dcrMutex->lock ();
ifname = fname;//strdup (fname); ifname = fname;//strdup (fname);
image = NULL; image = NULL;
exif_base = -1; exif_base = -1;
ciff_base = -1; ciff_base = -1;
ciff_len = -1; ciff_len = -1;
@ -9012,23 +9012,23 @@ dcrMutex->lock ();
if (filters) { if (filters) {
ri->allocation = (short unsigned int*)calloc(height*width, sizeof(unsigned short)); ri->allocation = (short unsigned int*)calloc(height*width, sizeof(unsigned short));
ri->data = (unsigned short**)calloc(height, sizeof(unsigned short*)); ri->data = (unsigned short**)calloc(height, sizeof(unsigned short*));
for (int i=0; i<height; i++) for (int i=0; i<height; i++)
ri->data[i] = ri->allocation + i*width; ri->data[i] = ri->allocation + i*width;
for (int row = 0; row < height; row++) for (int row = 0; row < height; row++)
for (int col = 0; col < width; col++) for (int col = 0; col < width; col++)
if (ISGREEN(ri,row,col)) if (ISGREEN(ri,row,col))
ri->data[row][col] = image[row*width+col][1]; ri->data[row][col] = image[row*width+col][1];
else if (ISRED(ri,row,col)) else if (ISRED(ri,row,col))
ri->data[row][col] = image[row*width+col][0]; ri->data[row][col] = image[row*width+col][0];
else else
ri->data[row][col] = image[row*width+col][2]; ri->data[row][col] = image[row*width+col][2];
} }
else { else {
ri->allocation = (short unsigned int*)calloc(3*height*width, sizeof(unsigned short)); ri->allocation = (short unsigned int*)calloc(3*height*width, sizeof(unsigned short));
ri->data = (unsigned short**)calloc(height, sizeof(unsigned short*)); ri->data = (unsigned short**)calloc(height, sizeof(unsigned short*));
for (int i=0; i<height; i++) for (int i=0; i<height; i++)
ri->data[i] = ri->allocation + 3*i*width; ri->data[i] = ri->allocation + 3*i*width;
for (int row = 0; row < height; row++) for (int row = 0; row < height; row++)
for (int col = 0; col < width; col++) { for (int col = 0; col < width; col++) {
ri->data[row][3*col+0] = image[row*width+col][0]; ri->data[row][3*col+0] = image[row*width+col][0];
ri->data[row][3*col+1] = image[row*width+col][1]; ri->data[row][3*col+1] = image[row*width+col][1];
@ -9079,7 +9079,7 @@ dcrMutex->lock ();
exif_base = -1; exif_base = -1;
ciff_base = -1; ciff_base = -1;
ciff_len = -1; ciff_len = -1;
half_size = 1; half_size = 1;
bright = 1.0; bright = 1.0;
verbose = settings->verbose; verbose = settings->verbose;
@ -9165,8 +9165,8 @@ t1.set ();
fclose (ifp); fclose (ifp);
dcrMutex->unlock (); dcrMutex->unlock ();
return NULL; return NULL;
} }
use_camera_wb = 0; use_camera_wb = 0;
highlight = 1; highlight = 1;
half_size = 0; half_size = 0;
@ -9180,7 +9180,7 @@ t1.set ();
} }
t2.set(); t2.set();
iheight = ::height; iheight = ::height;
iwidth = ::width; iwidth = ::width;
@ -9193,7 +9193,7 @@ t2.set();
if (zero_is_bad) remove_zeroes(); if (zero_is_bad) remove_zeroes();
rtengine::Thumbnail* tpp = new rtengine::Thumbnail; rtengine::Thumbnail* tpp = new rtengine::Thumbnail;
tpp->isRaw = true; tpp->isRaw = true;
tpp->embProfileLength = 0; tpp->embProfileLength = 0;
if (profile_length) { if (profile_length) {
@ -9207,12 +9207,12 @@ t2.set();
tpp->embProfile = NULL; tpp->embProfile = NULL;
tpp->embProfileData = NULL; tpp->embProfileData = NULL;
} }
fclose(ifp); fclose(ifp);
tpp->redMultiplier = pre_mul[0]; tpp->redMultiplier = pre_mul[0];
tpp->greenMultiplier = pre_mul[1]; tpp->greenMultiplier = pre_mul[1];
tpp->blueMultiplier = pre_mul[2]; tpp->blueMultiplier = pre_mul[2];
t3.set (); t3.set ();
scale_colors(); scale_colors();
@ -9221,13 +9221,13 @@ t3.set ();
unsigned filter = filters; unsigned filter = filters;
int firstgreen = 1; int firstgreen = 1;
// locate first green location in the first row // locate first green location in the first row
while (!FISGREEN(filter,1,firstgreen)) while (!FISGREEN(filter,1,firstgreen))
firstgreen++; firstgreen++;
int skip = 1; int skip = 1;
if (fixwh==1) // fix height, scale width if (fixwh==1) // fix height, scale width
skip = (::height-firstgreen-1) / h; skip = (::height-firstgreen-1) / h;
else else
skip = (::width-firstgreen-1) / w; skip = (::width-firstgreen-1) / w;
if (skip%2) if (skip%2)
skip--; skip--;
@ -9237,7 +9237,7 @@ t3.set ();
int hskip = skip, vskip = skip; int hskip = skip, vskip = skip;
if (!strcmp (model, "D1X")) if (!strcmp (model, "D1X"))
hskip *=2; hskip *=2;
rml.exifBase = exif_base; rml.exifBase = exif_base;
rml.ciffBase = ciff_base; rml.ciffBase = ciff_base;
rml.ciffLength = ciff_len; rml.ciffLength = ciff_len;
@ -9245,7 +9245,7 @@ t3.set ();
tpp->camwbGreen = tpp->greenMultiplier / pre_mul[1]; tpp->camwbGreen = tpp->greenMultiplier / pre_mul[1];
tpp->camwbBlue = tpp->blueMultiplier / pre_mul[2]; tpp->camwbBlue = tpp->blueMultiplier / pre_mul[2];
tpp->defGain = 1.0 / MIN(MIN(pre_mul[0],pre_mul[1]),pre_mul[2]); tpp->defGain = 1.0 / MIN(MIN(pre_mul[0],pre_mul[1]),pre_mul[2]);
tpp->gammaCorrected = true; tpp->gammaCorrected = true;
int ix = 0; int ix = 0;
@ -9272,7 +9272,7 @@ t3.set ();
tmpImg->g[y][x] = g; tmpImg->g[y][x] = g;
tmpImg->b[y][x] = b; tmpImg->b[y][x] = b;
} }
} }
} }
else { else {
for (int row=1, y=0; row< ::height-1 && y<tmph; row+=vskip, y++) { for (int row=1, y=0; row< ::height-1 && y<tmph; row+=vskip, y++) {
@ -9283,9 +9283,9 @@ t3.set ();
tmpImg->g[y][x] = image[ofs][1]; tmpImg->g[y][x] = image[ofs][1];
tmpImg->b[y][x] = image[ofs][2]; tmpImg->b[y][x] = image[ofs][2];
} }
} }
} }
if (fuji_width) { if (fuji_width) {
int fw = fuji_width / hskip; int fw = fuji_width / hskip;
double step = sqrt(0.5); double step = sqrt(0.5);
@ -9298,7 +9298,7 @@ t3.set ();
for (int col=0; col < wide; col++) { for (int col=0; col < wide; col++) {
unsigned ur = r = fw + (row-col)*step; unsigned ur = r = fw + (row-col)*step;
unsigned uc = c = (row+col)*step; unsigned uc = c = (row+col)*step;
if (ur > tmph-2 || uc > tmpw-2) if (ur > tmph-2 || uc > tmpw-2)
continue; continue;
double fr = r - ur; double fr = r - ur;
double fc = c - uc; double fc = c - uc;
@ -9311,22 +9311,22 @@ t3.set ();
delete tmpImg; delete tmpImg;
tmpImg = fImg; tmpImg = fImg;
} }
if (fixwh==1) // fix height, scale width if (fixwh==1) // fix height, scale width
w = tmpw * h / tmph; w = tmpw * h / tmph;
else else
h = tmph * w / tmpw; h = tmph * w / tmpw;
tpp->thumbImg = tmpImg->resize (w, h, TI_Bilinear); tpp->thumbImg = tmpImg->resize (w, h, TI_Bilinear);
delete tmpImg; delete tmpImg;
if (fuji_width) if (fuji_width)
tpp->scale = (double)(::height - fuji_width) / sqrt(0.5) / h; tpp->scale = (double)(::height - fuji_width) / sqrt(0.5) / h;
else else
tpp->scale = (double)::height / h; tpp->scale = (double)::height / h;
t4.set (); t4.set ();
// generate histogram for auto exposure // generate histogram for auto exposure
tpp->aeHistCompression = 3; tpp->aeHistCompression = 3;
@ -9348,7 +9348,7 @@ t4.set ();
start = 8; start = 8;
end = ::width-8; end = ::width-8;
} }
for (int j=start; j<end; j++) for (int j=start; j<end; j++)
if (FISGREEN(filter,i,j)) if (FISGREEN(filter,i,j))
tpp->aeHistogram[image[i* ::width+j][1]>>tpp->aeHistCompression]+=gadd; tpp->aeHistogram[image[i* ::width+j][1]>>tpp->aeHistCompression]+=gadd;
else if (FISRED(filter,i,j)) else if (FISRED(filter,i,j))
@ -9356,7 +9356,7 @@ t4.set ();
else if (FISBLUE(filter,i,j)) else if (FISBLUE(filter,i,j))
tpp->aeHistogram[image[i* ::width+j][2]>>tpp->aeHistCompression]+=badd; tpp->aeHistogram[image[i* ::width+j][2]>>tpp->aeHistCompression]+=badd;
} }
t5.set (); t5.set ();
// generate autoWB // generate autoWB
@ -9376,7 +9376,7 @@ t5.set ();
start = 32; start = 32;
end = ::width-32; end = ::width-32;
} }
for (int j=start; j<end; j++) { for (int j=start; j<end; j++) {
if (FISGREEN(filter,i,j)) { if (FISGREEN(filter,i,j)) {
double d = tpp->defGain * image[i* ::width+j][1]; double d = tpp->defGain * image[i* ::width+j][1];
if (d>64000) if (d>64000)
@ -9404,7 +9404,7 @@ t5.set ();
double reds = pow (avg_r/rn, 1.0/6.0) * tpp->camwbRed; double reds = pow (avg_r/rn, 1.0/6.0) * tpp->camwbRed;
double greens = pow (avg_g/gn, 1.0/6.0) * tpp->camwbGreen; double greens = pow (avg_g/gn, 1.0/6.0) * tpp->camwbGreen;
double blues = pow (avg_b/bn, 1.0/6.0) * tpp->camwbBlue; double blues = pow (avg_b/bn, 1.0/6.0) * tpp->camwbBlue;
double rm = rgb_cam[0][0]*reds + rgb_cam[0][1]*greens + rgb_cam[0][2]*blues; double rm = rgb_cam[0][0]*reds + rgb_cam[0][1]*greens + rgb_cam[0][2]*blues;
double gm = rgb_cam[1][0]*reds + rgb_cam[1][1]*greens + rgb_cam[1][2]*blues; double gm = rgb_cam[1][0]*reds + rgb_cam[1][1]*greens + rgb_cam[1][2]*blues;
double bm = rgb_cam[2][0]*reds + rgb_cam[2][1]*greens + rgb_cam[2][2]*blues; double bm = rgb_cam[2][0]*reds + rgb_cam[2][1]*greens + rgb_cam[2][2]*blues;
@ -9413,7 +9413,7 @@ t5.set ();
t6.set (); t6.set ();
if (settings->verbose) printf ("0: %d, 1: %d, 2: %d, 3: %d, 4: %d, 5: %d All: %d\n", t1.etime(t0), t2.etime(t1), t3.etime(t2), t4.etime(t3), t5.etime(t4), t6.etime(t5), t6.etime(t0)); if (settings->verbose) printf ("0: %d, 1: %d, 2: %d, 3: %d, 4: %d, 5: %d All: %d\n", t1.etime(t0), t2.etime(t1), t3.etime(t2), t4.etime(t3), t5.etime(t4), t6.etime(t5), t6.etime(t0));
int deg = 0; int deg = 0;
if (flip==5) if (flip==5)
@ -9434,7 +9434,7 @@ if (settings->verbose) printf ("0: %d, 1: %d, 2: %d, 3: %d, 4: %d, 5: %d All: %d
tpp->colorMatrix[a][b] = rgb_cam[a][b]; tpp->colorMatrix[a][b] = rgb_cam[a][b];
tpp->init (); tpp->init ();
free (image); free (image);
dcrMutex->unlock (); dcrMutex->unlock ();

View File

@ -201,7 +201,16 @@ void ImProcCoordinator::updatePreviewImage (int todo) {
progress ("Conversion to RGB...",100*readyphase/numofphases); progress ("Conversion to RGB...",100*readyphase/numofphases);
if (todo!=CROP) { if (todo!=CROP) {
previmg->getMutex().lock(); 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(); previmg->getMutex().unlock();
} }
if (!resultValid) { if (!resultValid) {

View File

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

View File

@ -0,0 +1,43 @@
/*
* 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 {
InitialImage* InitialImage::load (const Glib::ustring& fname, bool isRaw, int* errorCode, ProgressListener* pl) {
ImageSource* isrc;
if (!isRaw)
isrc = new StdImageSource ();
else
isrc = new RawImageSource ();
isrc->setProgressListener (pl);
*errorCode = isrc->load (fname);
if (*errorCode) {
delete isrc;
return NULL;
}
return isrc;
}
}

View File

@ -222,7 +222,7 @@ void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl) {
void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl) { void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl) {
if (bpl) if (bpl)
Glib::Thread::create(sigc::bind(sigc::ptr_fun(batchProcessingThread), job, bpl), 0, false, true, Glib::THREAD_PRIORITY_NORMAL); Glib::Thread::create(sigc::bind(sigc::ptr_fun(batchProcessingThread), job, bpl), 0, false, true, Glib::THREAD_PRIORITY_LOW);
} }
} }

View File

@ -197,14 +197,17 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img) {
if (img && fname!="") { if (img && fname!="") {
int err = 0; int err = 0;
if (saveFormat.format=="tif") if (saveFormat.format=="tif")
err = img->saveAsTIFF (fname, saveFormat.tiffBits); err = img->saveAsTIFF (fname, saveFormat.tiffBits,saveFormat.tiffUncompressed);
else if (saveFormat.format=="png") else if (saveFormat.format=="png")
err = img->saveAsPNG (fname, saveFormat.pngCompression, saveFormat.pngBits); err = img->saveAsPNG (fname, saveFormat.pngCompression, saveFormat.pngBits);
else if (saveFormat.format=="jpg") else if (saveFormat.format=="jpg")
err = img->saveAsJPEG (fname, saveFormat.jpegQuality); err = img->saveAsJPEG (fname, saveFormat.jpegQuality);
img->free (); img->free ();
if (!err && saveFormat.saveParams) if (!err && saveFormat.saveParams)
processing->params.save (removeExtension(fname) + paramFileExtension); // We keep the extension to avoid overwriting the profile when we have
// the same output filename with different extension
//processing->params.save (removeExtension(fname) + paramFileExtension);
processing->params.save (fname + paramFileExtension);
if (processing->thumbnail) { if (processing->thumbnail) {
processing->thumbnail->imageDeveloped (); processing->thumbnail->imageDeveloped ();
processing->thumbnail->imageRemovedFromQueue (); processing->thumbnail->imageRemovedFromQueue ();

View File

@ -59,7 +59,7 @@ void BatchQueueEntryUpdater::process () {
if (stopped) if (stopped)
#undef THREAD_PRIORITY_NORMAL #undef THREAD_PRIORITY_NORMAL
thread = Glib::Thread::create(sigc::mem_fun(*this, &BatchQueueEntryUpdater::process_), (unsigned long int)0, true, true, Glib::THREAD_PRIORITY_NORMAL); thread = Glib::Thread::create(sigc::mem_fun(*this, &BatchQueueEntryUpdater::process_), (unsigned long int)0, true, true, Glib::THREAD_PRIORITY_LOW);
} }
void BatchQueueEntryUpdater::process_ () { void BatchQueueEntryUpdater::process_ () {

View File

@ -7,7 +7,7 @@
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* RawTherapee is distributed in the hope that it will be useful, * RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -110,13 +110,13 @@ EditorPanel::EditorPanel (FilePanel* filePanel) : beforePreviewHandler(NULL), be
toolBarPanel->pack_end (*vsepcl, Gtk::PACK_SHRINK, 4); toolBarPanel->pack_end (*vsepcl, Gtk::PACK_SHRINK, 4);
toolBarPanel->pack_end (*iarea->imageArea->indClippedPanel, Gtk::PACK_SHRINK, 0); toolBarPanel->pack_end (*iarea->imageArea->indClippedPanel, Gtk::PACK_SHRINK, 0);
toolBarPanel->pack_end (*vsepz, Gtk::PACK_SHRINK, 2); toolBarPanel->pack_end (*vsepz, Gtk::PACK_SHRINK, 2);
afterBox = Gtk::manage (new Gtk::VBox ()); afterBox = Gtk::manage (new Gtk::VBox ());
afterBox->pack_start (*iarea); afterBox->pack_start (*iarea);
beforeAfterBox = Gtk::manage (new Gtk::HBox()); beforeAfterBox = Gtk::manage (new Gtk::HBox());
beforeAfterBox->pack_start (*afterBox); beforeAfterBox->pack_start (*afterBox);
editbox->pack_start (*toolBarPanel, Gtk::PACK_SHRINK); editbox->pack_start (*toolBarPanel, Gtk::PACK_SHRINK);
editbox->pack_start (*beforeAfterBox); editbox->pack_start (*beforeAfterBox);
@ -171,7 +171,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel) : beforePreviewHandler(NULL), be
iops->pack_end (*iarea->imageArea->zoomPanel, Gtk::PACK_SHRINK, 1); iops->pack_end (*iarea->imageArea->zoomPanel, Gtk::PACK_SHRINK, 1);
iops->pack_end (*vsepz2, Gtk::PACK_SHRINK, 2); iops->pack_end (*vsepz2, Gtk::PACK_SHRINK, 2);
editbox->pack_start (*Gtk::manage(new Gtk::HSeparator()), Gtk::PACK_SHRINK, 4); editbox->pack_start (*Gtk::manage(new Gtk::HSeparator()), Gtk::PACK_SHRINK, 4);
editbox->pack_start (*iops, Gtk::PACK_SHRINK, 4); editbox->pack_start (*iops, Gtk::PACK_SHRINK, 4);
editbox->show_all (); editbox->show_all ();
@ -211,9 +211,9 @@ EditorPanel::EditorPanel (FilePanel* filePanel) : beforePreviewHandler(NULL), be
show_all (); show_all ();
// save as dialog // save as dialog
if (Glib::file_test (options.lastSaveAsPath, Glib::FILE_TEST_IS_DIR)) if (Glib::file_test (options.lastSaveAsPath, Glib::FILE_TEST_IS_DIR))
saveAsDialog = new SaveAsDialog (options.lastSaveAsPath); saveAsDialog = new SaveAsDialog (options.lastSaveAsPath);
else else
saveAsDialog = new SaveAsDialog (Glib::get_user_special_dir (G_USER_DIRECTORY_PICTURES)); saveAsDialog = new SaveAsDialog (Glib::get_user_special_dir (G_USER_DIRECTORY_PICTURES));
saveAsDialog->set_default_size (options.saveAsDialogWidth, options.saveAsDialogHeight); saveAsDialog->set_default_size (options.saveAsDialogWidth, options.saveAsDialogHeight);
@ -228,7 +228,7 @@ EditorPanel::EditorPanel (FilePanel* filePanel) : beforePreviewHandler(NULL), be
iarea->imageArea->setCropGUIListener (tpc->getCropGUIListener()); iarea->imageArea->setCropGUIListener (tpc->getCropGUIListener());
iarea->imageArea->setPointerMotionListener (navigator); iarea->imageArea->setPointerMotionListener (navigator);
iarea->imageArea->setImageAreaToolListener (tpc); iarea->imageArea->setImageAreaToolListener (tpc);
// initialize components // initialize components
info->set_active (options.showInfo); info->set_active (options.showInfo);
tpc->readOptions (); tpc->readOptions ();
@ -278,12 +278,12 @@ EditorPanel::~EditorPanel () {
delete green; delete green;
delete leftbox; delete leftbox;
delete vboxright; delete vboxright;
delete saveAsDialog; delete saveAsDialog;
} }
void EditorPanel::on_realize () { void EditorPanel::on_realize () {
Gtk::VBox::on_realize (); Gtk::VBox::on_realize ();
vboxright->set_size_request (options.toolPanelWidth, -1); vboxright->set_size_request (options.toolPanelWidth, -1);
} }
@ -322,11 +322,11 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) {
if (openThm->getType()!=FT_Raw) if (openThm->getType()!=FT_Raw)
profilep->initProfile (options.defProfImg, ldprof, NULL); profilep->initProfile (options.defProfImg, ldprof, NULL);
else else
profilep->initProfile (options.defProfRaw, ldprof, NULL); profilep->initProfile (options.defProfRaw, ldprof, NULL);
openThm->addThumbnailListener (this); openThm->addThumbnailListener (this);
info_toggled (); info_toggled ();
beforeAfterToggled(); beforeAfterToggled();
beforeAfterToggled(); beforeAfterToggled();
@ -339,7 +339,7 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) {
} }
void EditorPanel::close () { void EditorPanel::close () {
if (ipc) if (ipc)
{ {
saveProfile (); saveProfile ();
@ -349,7 +349,7 @@ void EditorPanel::close () {
if (ipc) if (ipc)
ipc->setPreviewImageListener (NULL); ipc->setPreviewImageListener (NULL);
if (beforeIpc) if (beforeIpc)
beforeIpc->setPreviewImageListener (NULL); beforeIpc->setPreviewImageListener (NULL);
@ -361,9 +361,9 @@ void EditorPanel::close () {
delete iarea->imageArea->mainCropWindow; delete iarea->imageArea->mainCropWindow;
iarea->imageArea->mainCropWindow = NULL; iarea->imageArea->mainCropWindow = NULL;
rtengine::StagedImageProcessor::destroy (ipc); rtengine::StagedImageProcessor::destroy (ipc);
ipc = NULL; ipc = NULL;
iarea->imageArea->setPreviewHandler (NULL); iarea->imageArea->setPreviewHandler (NULL);
iarea->imageArea->setImProcCoordinator (NULL); iarea->imageArea->setImProcCoordinator (NULL);
navigator->previewWindow->setPreviewHandler (NULL); navigator->previewWindow->setPreviewHandler (NULL);
@ -373,17 +373,17 @@ void EditorPanel::close () {
openThm->decreaseRef (); openThm->decreaseRef ();
} }
} }
void EditorPanel::saveProfile () { void EditorPanel::saveProfile () {
ProcParams params; ProcParams params;
ipc->getParams (&params); ipc->getParams (&params);
if (options.saveParamsFile) if (options.saveParamsFile)
params.save (openThm->getFileName() + paramFileExtension); params.save (openThm->getFileName() + paramFileExtension);
if (openThm && options.saveParamsCache) if (openThm && options.saveParamsCache)
openThm->setProcParams (params, EDITOR); openThm->setProcParams (params, EDITOR);
} }
@ -397,7 +397,7 @@ Glib::ustring EditorPanel::getFileName () {
return openThm->getFileName (); return openThm->getFileName ();
} }
// TODO!!! // TODO!!!
void EditorPanel::procParamsChanged (rtengine::procparams::ProcParams* params, rtengine::ProcEvent ev, Glib::ustring descr, ParamsEdited* paramsEdited) { void EditorPanel::procParamsChanged (rtengine::procparams::ProcParams* params, rtengine::ProcEvent ev, Glib::ustring descr, ParamsEdited* paramsEdited) {
// if (ev!=EvPhotoLoaded) // if (ev!=EvPhotoLoaded)
@ -417,7 +417,7 @@ int setprocstate (void* data) {
if (p->epih->destroyed) { if (p->epih->destroyed) {
if (p->epih->pending == 1) if (p->epih->pending == 1)
delete p->epih; delete p->epih;
else else
p->epih->pending--; p->epih->pending--;
delete p; delete p;
gdk_threads_leave (); gdk_threads_leave ();
@ -457,7 +457,7 @@ void EditorPanel::refreshProcessingState (bool state) {
if (wlast) if (wlast)
statusBox->remove (*wlast); statusBox->remove (*wlast);
} }
if (state) if (state)
statusBox->pack_end (*red, Gtk::PACK_SHRINK, 4); statusBox->pack_end (*red, Gtk::PACK_SHRINK, 4);
else else
statusBox->pack_end (*green, Gtk::PACK_SHRINK, 4); statusBox->pack_end (*green, Gtk::PACK_SHRINK, 4);
@ -486,7 +486,7 @@ int disperror (void* data) {
if (p->epih->destroyed) { if (p->epih->destroyed) {
if (p->epih->pending == 1) if (p->epih->pending == 1)
delete p->epih; delete p->epih;
else else
p->epih->pending--; p->epih->pending--;
delete p; delete p;
gdk_threads_leave (); gdk_threads_leave ();
@ -515,13 +515,13 @@ void EditorPanel::info_toggled () {
const rtengine::ImageMetaData* idata = ipc->getInitialImage()->getMetaData(); const rtengine::ImageMetaData* idata = ipc->getInitialImage()->getMetaData();
if (idata && idata->hasExif()) if (idata && idata->hasExif())
infoString = Glib::ustring::compose ("%1 %2\nF/%3 %4 sec\n%5: %6\n%7: %8 mm\n", infoString = Glib::ustring::compose ("%1 %2\nF/%3 %4 sec\n%5: %6\n%7: %8 mm\n",
Glib::ustring(idata->getMake()), Glib::ustring(idata->getModel()), Glib::ustring(idata->getMake()), Glib::ustring(idata->getModel()),
Glib::ustring(idata->apertureToString(idata->getFNumber())), Glib::ustring(idata->shutterToString(idata->getShutterSpeed())), Glib::ustring(idata->apertureToString(idata->getFNumber())), Glib::ustring(idata->shutterToString(idata->getShutterSpeed())),
M("QINFO_ISO"), idata->getISOSpeed(), M("QINFO_ISO"), idata->getISOSpeed(),
M("QINFO_FOCALLENGTH"), idata->getFocalLen()) M("QINFO_FOCALLENGTH"), idata->getFocalLen())
+ Glib::ustring::compose ("%1: %2", M("QINFO_LENS"), Glib::ustring(idata->getLens())); + Glib::ustring::compose ("%1: %2", M("QINFO_LENS"), Glib::ustring(idata->getLens()));
else else
infoString = M("QINFO_NOEXIF"); infoString = M("QINFO_NOEXIF");
iarea->imageArea->setInfoText (infoString); iarea->imageArea->setInfoText (infoString);
@ -531,7 +531,7 @@ void EditorPanel::info_toggled () {
void EditorPanel::hideHistoryActivated () { void EditorPanel::hideHistoryActivated () {
removeIfThere (hpanedl, leftbox, false); removeIfThere (hpanedl, leftbox, false);
if (hidehp->get_active()) if (hidehp->get_active())
hpanedl->pack1 (*leftbox, false, true); hpanedl->pack1 (*leftbox, false, true);
options.showHistory = hidehp->get_active(); options.showHistory = hidehp->get_active();
} }
@ -583,7 +583,7 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) {
iarea->imageArea->zoomPanel->zoom11Clicked(); iarea->imageArea->zoomPanel->zoom11Clicked();
return true; return true;
case GDK_f: case GDK_f:
case GDK_F: case GDK_F:
iarea->imageArea->zoomPanel->zoomFitClicked(); iarea->imageArea->zoomPanel->zoomFitClicked();
return true; return true;
} }
@ -613,8 +613,8 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) {
void EditorPanel::procParamsChanged (Thumbnail* thm, int whoChangedIt) { void EditorPanel::procParamsChanged (Thumbnail* thm, int whoChangedIt) {
if (whoChangedIt!=EDITOR) if (whoChangedIt!=EDITOR)
tpc->profileChange (&openThm->getProcParams(), rtengine::EvProfileChangeNotification, M("PROGRESSDLG_PROFILECHANGEDINBROWSER")); tpc->profileChange (&openThm->getProcParams(), rtengine::EvProfileChangeNotification, M("PROGRESSDLG_PROFILECHANGEDINBROWSER"));
} }
bool EditorPanel::idle_saveImage (ProgressConnector<rtengine::IImage16*> *pc, Glib::ustring fname, SaveFormat sf, bool findNewNameIfNeeded){ bool EditorPanel::idle_saveImage (ProgressConnector<rtengine::IImage16*> *pc, Glib::ustring fname, SaveFormat sf, bool findNewNameIfNeeded){
@ -719,7 +719,7 @@ void EditorPanel::saveAsPressed () {
SaveFormat sf = saveAsDialog->getFormat (); SaveFormat sf = saveAsDialog->getFormat ();
if (getExtension (fname)!=sf.format) if (getExtension (fname)!=sf.format)
fname = fname + "." + sf.format; fname = fname + "." + sf.format;
options.saveFormat = sf; options.saveFormat = sf;
if (saveAsDialog->getImmediately ()) { if (saveAsDialog->getImmediately ()) {
@ -731,7 +731,7 @@ void EditorPanel::saveAsPressed () {
if (response==Gtk::RESPONSE_NO) if (response==Gtk::RESPONSE_NO)
return; return;
} }
// save image // save image
rtengine::procparams::ProcParams pparams; rtengine::procparams::ProcParams pparams;
ipc->getParams (&pparams); ipc->getParams (&pparams);
rtengine::ProcessingJob* job = rtengine::ProcessingJob::create (ipc->getInitialImage(), pparams); rtengine::ProcessingJob* job = rtengine::ProcessingJob::create (ipc->getInitialImage(), pparams);
@ -901,12 +901,12 @@ void EditorPanel::beforeAfterToggled () {
removeIfThere (afterBox, afterLabel, false); removeIfThere (afterBox, afterLabel, false);
if (beforeIarea) { if (beforeIarea) {
if (beforeIpc) if (beforeIpc)
beforeIpc->stopProcessing (); beforeIpc->stopProcessing ();
iarea->setBeforeAfterViews (NULL, iarea); iarea->setBeforeAfterViews (NULL, iarea);
delete beforeIarea; delete beforeIarea;
beforeIarea = NULL; beforeIarea = NULL;
if (beforeIpc) if (beforeIpc)
beforeIpc->setPreviewImageListener (NULL); beforeIpc->setPreviewImageListener (NULL);
delete beforePreviewHandler; delete beforePreviewHandler;
beforePreviewHandler = NULL; beforePreviewHandler = NULL;
@ -944,7 +944,7 @@ void EditorPanel::beforeAfterToggled () {
iarea->setBeforeAfterViews (beforeIarea, iarea); iarea->setBeforeAfterViews (beforeIarea, iarea);
beforeIarea->setBeforeAfterViews (beforeIarea, iarea); beforeIarea->setBeforeAfterViews (beforeIarea, iarea);
rtengine::procparams::ProcParams params; rtengine::procparams::ProcParams params;
if (history->getBeforeLineParams (params)) if (history->getBeforeLineParams (params))
historyBeforeLineChanged (params); historyBeforeLineChanged (params);
@ -952,7 +952,7 @@ void EditorPanel::beforeAfterToggled () {
} }
void EditorPanel::histogramChanged (unsigned int* rh, unsigned int* gh, unsigned int* bh, unsigned int* lh, unsigned int* bcrgb, unsigned int* bcl) { void EditorPanel::histogramChanged (unsigned int* rh, unsigned int* gh, unsigned int* bh, unsigned int* lh, unsigned int* bcrgb, unsigned int* bcl) {
histogramPanel->histogramChanged (rh, gh, bh, lh); histogramPanel->histogramChanged (rh, gh, bh, lh);
tpc->updateCurveBackgroundHistogram (bcrgb, bcl); tpc->updateCurveBackgroundHistogram (bcrgb, bcl);
} }

View File

@ -90,6 +90,7 @@ void Options::setDefaults () {
maxCacheEntries = 10000; maxCacheEntries = 10000;
thumbnailFormat = FT_Custom16; thumbnailFormat = FT_Custom16;
thumbInterp = 1; thumbInterp = 1;
autoSuffix = false;
saveParamsFile = false; saveParamsFile = false;
saveParamsCache = true; saveParamsCache = true;
paramsLoadLocation = PLL_Cache; paramsLoadLocation = PLL_Cache;
@ -198,6 +199,7 @@ if (keyFile.has_group ("Output")) {
if (keyFile.has_key ("Output", "Path")) savePathTemplate = keyFile.get_string ("Output", "Path"); if (keyFile.has_key ("Output", "Path")) savePathTemplate = keyFile.get_string ("Output", "Path");
if (keyFile.has_key ("Output", "PathTemplate")) savePathTemplate = keyFile.get_string ("Output", "PathTemplate"); if (keyFile.has_key ("Output", "PathTemplate")) savePathTemplate = keyFile.get_string ("Output", "PathTemplate");
if (keyFile.has_key ("Output", "PathFolder")) savePathFolder = keyFile.get_string ("Output", "PathFolder"); if (keyFile.has_key ("Output", "PathFolder")) savePathFolder = keyFile.get_string ("Output", "PathFolder");
if (keyFile.has_key ("Output", "AutoSuffix")) autoSuffix = keyFile.get_boolean("Output", "AutoSuffix");
if (keyFile.has_key ("Output", "UsePathTemplate")) saveUsePathTemplate = keyFile.get_boolean("Output", "UsePathTemplate"); if (keyFile.has_key ("Output", "UsePathTemplate")) saveUsePathTemplate = keyFile.get_boolean("Output", "UsePathTemplate");
if (keyFile.has_key ("Output", "LastSaveAsPath")) lastSaveAsPath = keyFile.get_string ("Output", "LastSaveAsPath"); if (keyFile.has_key ("Output", "LastSaveAsPath")) lastSaveAsPath = keyFile.get_string ("Output", "LastSaveAsPath");
} }
@ -357,6 +359,7 @@ int Options::saveToFile (Glib::ustring fname) {
keyFile.set_boolean ("Output", "SaveProcParams", saveFormat.saveParams); keyFile.set_boolean ("Output", "SaveProcParams", saveFormat.saveParams);
keyFile.set_string ("Output", "PathTemplate", savePathTemplate); keyFile.set_string ("Output", "PathTemplate", savePathTemplate);
keyFile.set_string ("Output", "PathFolder", savePathFolder); keyFile.set_string ("Output", "PathFolder", savePathFolder);
keyFile.set_boolean("Output", "AutoSuffix", autoSuffix);
keyFile.set_boolean("Output", "UsePathTemplate", saveUsePathTemplate); keyFile.set_boolean("Output", "UsePathTemplate", saveUsePathTemplate);
keyFile.set_string ("Output", "LastSaveAsPath", lastSaveAsPath); keyFile.set_string ("Output", "LastSaveAsPath", lastSaveAsPath);

View File

@ -95,6 +95,7 @@ class Options {
Glib::ustring language; Glib::ustring language;
Glib::ustring theme; Glib::ustring theme;
static Glib::ustring cacheBaseDir; static Glib::ustring cacheBaseDir;
bool autoSuffix;
bool saveParamsFile; bool saveParamsFile;
bool saveParamsCache; bool saveParamsCache;
PPLoadLocation paramsLoadLocation; PPLoadLocation paramsLoadLocation;

View File

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

View File

@ -22,6 +22,8 @@
extern Options options; extern Options options;
SaveAsDialog::SaveAsDialog (Glib::ustring initialDir) { SaveAsDialog::SaveAsDialog (Glib::ustring initialDir) {
set_title(M("GENERAL_SAVE"));
Gtk::VBox* vbox = get_vbox (); Gtk::VBox* vbox = get_vbox ();
fchooser = new Gtk::FileChooserWidget (Gtk::FILE_CHOOSER_ACTION_SAVE); fchooser = new Gtk::FileChooserWidget (Gtk::FILE_CHOOSER_ACTION_SAVE);
@ -41,6 +43,16 @@ SaveAsDialog::SaveAsDialog (Glib::ustring initialDir) {
Gtk::HSeparator* hsep1 = new Gtk::HSeparator (); Gtk::HSeparator* hsep1 = new Gtk::HSeparator ();
vbox->pack_start (*hsep1, Gtk::PACK_SHRINK, 2); vbox->pack_start (*hsep1, Gtk::PACK_SHRINK, 2);
// Unique filename option
// ~~~~~~~~~~~~~~~~~~~~~~
autoSuffix = new Gtk::CheckButton (M("SAVEDLG_AUTOSUFFIX"));
autoSuffix->set_active(options.autoSuffix);
vbox->pack_start (*autoSuffix, Gtk::PACK_SHRINK, 4);
Gtk::HSeparator* hsep2 = new Gtk::HSeparator ();
vbox->pack_start (*hsep2, Gtk::PACK_SHRINK, 2);
// Output Options // Output Options
// ~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~
formatOpts = new SaveFormatPanel (); formatOpts = new SaveFormatPanel ();
@ -49,8 +61,8 @@ SaveAsDialog::SaveAsDialog (Glib::ustring initialDir) {
vbox->pack_start (*formatOpts, Gtk::PACK_SHRINK, 4); vbox->pack_start (*formatOpts, Gtk::PACK_SHRINK, 4);
Gtk::HSeparator* hsep2 = new Gtk::HSeparator (); Gtk::HSeparator* hsep3 = new Gtk::HSeparator ();
vbox->pack_start (*hsep2, Gtk::PACK_SHRINK, 2); vbox->pack_start (*hsep3, Gtk::PACK_SHRINK, 2);
// queue/immediate // queue/immediate
// ~~~~~~~~~~~~~ // ~~~~~~~~~~~~~
@ -83,6 +95,11 @@ SaveAsDialog::SaveAsDialog (Glib::ustring initialDir) {
show_all_children (); show_all_children ();
} }
bool SaveAsDialog::getAutoSuffix () {
return autoSuffix->get_active();
}
bool SaveAsDialog::getImmediately () { bool SaveAsDialog::getImmediately () {
return immediately->get_active (); return immediately->get_active ();

View File

@ -28,6 +28,7 @@ class SaveAsDialog : public Gtk::Dialog, public FormatChangeListener {
protected: protected:
Gtk::FileChooserWidget* fchooser; Gtk::FileChooserWidget* fchooser;
Gtk::CheckButton* autoSuffix;
SaveFormatPanel* formatOpts; SaveFormatPanel* formatOpts;
Glib::ustring fname; Glib::ustring fname;
Gtk::FileFilter filter_jpg; Gtk::FileFilter filter_jpg;
@ -43,6 +44,7 @@ class SaveAsDialog : public Gtk::Dialog, public FormatChangeListener {
Glib::ustring getFileName (); Glib::ustring getFileName ();
Glib::ustring getDirectory (); Glib::ustring getDirectory ();
SaveFormat getFormat (); SaveFormat getFormat ();
bool getAutoSuffix ();
bool getImmediately (); bool getImmediately ();
bool getToHeadOfQueue (); bool getToHeadOfQueue ();
bool getToTailOfQueue (); bool getToTailOfQueue ();

View File

@ -401,7 +401,7 @@ bool ThumbBrowserBase::Internal::on_expose_event(GdkEventExpose* event) {
dirty = false; dirty = false;
Glib::RefPtr<Gdk::Window> window = get_window(); Glib::RefPtr<Gdk::Window> window = get_window();
int w = get_width(); int w = get_width();
int h = get_height(); int h = get_height();
@ -411,14 +411,14 @@ bool ThumbBrowserBase::Internal::on_expose_event(GdkEventExpose* event) {
Glib::RefPtr<Pango::Context> context = get_pango_context (); Glib::RefPtr<Pango::Context> context = get_pango_context ();
context->set_font_description (get_style()->get_font()); context->set_font_description (get_style()->get_font());
for (int i=0; i<parent->fd.size(); i++) { 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; parent->fd[i]->updatepriority = false;
else { else {
parent->fd[i]->updatepriority = true; parent->fd[i]->updatepriority = true;
parent->fd[i]->draw (); parent->fd[i]->draw ();
} }
} }
return true; return true;
} }

View File

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