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

View File

@ -201,7 +201,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) {

View File

@ -38,6 +38,9 @@ extern const Settings* settings;
void ImProcFunctions::lab2rgb (LabImage* lab, Image8* image) {
if (chroma_scale == 0)
throw "Division by zero exception";
if (monitorTransform) {
int ix = 0;
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) {
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!="") {
int err = 0;
if (saveFormat.format=="tif")
err = img->saveAsTIFF (fname, saveFormat.tiffBits);
err = img->saveAsTIFF (fname, saveFormat.tiffBits,saveFormat.tiffUncompressed);
else if (saveFormat.format=="png")
err = img->saveAsPNG (fname, saveFormat.pngCompression, saveFormat.pngBits);
else if (saveFormat.format=="jpg")
err = img->saveAsJPEG (fname, saveFormat.jpegQuality);
img->free ();
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) {
processing->thumbnail->imageDeveloped ();
processing->thumbnail->imageRemovedFromQueue ();

View File

@ -59,7 +59,7 @@ 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);
thread = Glib::Thread::create(sigc::mem_fun(*this, &BatchQueueEntryUpdater::process_), (unsigned long int)0, true, true, Glib::THREAD_PRIORITY_LOW);
}
void BatchQueueEntryUpdater::process_ () {

View File

@ -7,7 +7,7 @@
* 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
@ -110,13 +110,13 @@ EditorPanel::EditorPanel (FilePanel* filePanel) : beforePreviewHandler(NULL), be
toolBarPanel->pack_end (*vsepcl, Gtk::PACK_SHRINK, 4);
toolBarPanel->pack_end (*iarea->imageArea->indClippedPanel, Gtk::PACK_SHRINK, 0);
toolBarPanel->pack_end (*vsepz, Gtk::PACK_SHRINK, 2);
afterBox = Gtk::manage (new Gtk::VBox ());
afterBox->pack_start (*iarea);
beforeAfterBox = Gtk::manage (new Gtk::HBox());
beforeAfterBox->pack_start (*afterBox);
editbox->pack_start (*toolBarPanel, Gtk::PACK_SHRINK);
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 (*vsepz2, Gtk::PACK_SHRINK, 2);
editbox->pack_start (*Gtk::manage(new Gtk::HSeparator()), Gtk::PACK_SHRINK, 4);
editbox->pack_start (*iops, Gtk::PACK_SHRINK, 4);
editbox->show_all ();
@ -211,9 +211,9 @@ EditorPanel::EditorPanel (FilePanel* filePanel) : beforePreviewHandler(NULL), be
show_all ();
// 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);
else
else
saveAsDialog = new SaveAsDialog (Glib::get_user_special_dir (G_USER_DIRECTORY_PICTURES));
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->setPointerMotionListener (navigator);
iarea->imageArea->setImageAreaToolListener (tpc);
// initialize components
info->set_active (options.showInfo);
tpc->readOptions ();
@ -278,12 +278,12 @@ EditorPanel::~EditorPanel () {
delete green;
delete leftbox;
delete vboxright;
delete saveAsDialog;
}
void EditorPanel::on_realize () {
Gtk::VBox::on_realize ();
vboxright->set_size_request (options.toolPanelWidth, -1);
}
@ -322,11 +322,11 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) {
if (openThm->getType()!=FT_Raw)
profilep->initProfile (options.defProfImg, ldprof, NULL);
else
profilep->initProfile (options.defProfRaw, ldprof, NULL);
profilep->initProfile (options.defProfRaw, ldprof, NULL);
openThm->addThumbnailListener (this);
info_toggled ();
beforeAfterToggled();
beforeAfterToggled();
@ -339,7 +339,7 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) {
}
void EditorPanel::close () {
if (ipc)
{
saveProfile ();
@ -349,7 +349,7 @@ void EditorPanel::close () {
if (ipc)
ipc->setPreviewImageListener (NULL);
if (beforeIpc)
beforeIpc->setPreviewImageListener (NULL);
@ -361,9 +361,9 @@ void EditorPanel::close () {
delete iarea->imageArea->mainCropWindow;
iarea->imageArea->mainCropWindow = NULL;
rtengine::StagedImageProcessor::destroy (ipc);
rtengine::StagedImageProcessor::destroy (ipc);
ipc = NULL;
iarea->imageArea->setPreviewHandler (NULL);
iarea->imageArea->setImProcCoordinator (NULL);
navigator->previewWindow->setPreviewHandler (NULL);
@ -373,17 +373,17 @@ void EditorPanel::close () {
openThm->decreaseRef ();
}
}
}
void EditorPanel::saveProfile () {
ProcParams params;
ipc->getParams (&params);
if (options.saveParamsFile)
params.save (openThm->getFileName() + paramFileExtension);
if (openThm && options.saveParamsCache)
if (openThm && options.saveParamsCache)
openThm->setProcParams (params, EDITOR);
}
@ -397,7 +397,7 @@ Glib::ustring EditorPanel::getFileName () {
return openThm->getFileName ();
}
// TODO!!!
// TODO!!!
void EditorPanel::procParamsChanged (rtengine::procparams::ProcParams* params, rtengine::ProcEvent ev, Glib::ustring descr, ParamsEdited* paramsEdited) {
// if (ev!=EvPhotoLoaded)
@ -417,7 +417,7 @@ int setprocstate (void* data) {
if (p->epih->destroyed) {
if (p->epih->pending == 1)
delete p->epih;
else
else
p->epih->pending--;
delete p;
gdk_threads_leave ();
@ -457,7 +457,7 @@ void EditorPanel::refreshProcessingState (bool state) {
if (wlast)
statusBox->remove (*wlast);
}
if (state)
if (state)
statusBox->pack_end (*red, Gtk::PACK_SHRINK, 4);
else
statusBox->pack_end (*green, Gtk::PACK_SHRINK, 4);
@ -486,7 +486,7 @@ int disperror (void* data) {
if (p->epih->destroyed) {
if (p->epih->pending == 1)
delete p->epih;
else
else
p->epih->pending--;
delete p;
gdk_threads_leave ();
@ -515,13 +515,13 @@ void EditorPanel::info_toggled () {
const rtengine::ImageMetaData* idata = ipc->getInitialImage()->getMetaData();
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->apertureToString(idata->getFNumber())), Glib::ustring(idata->shutterToString(idata->getShutterSpeed())),
M("QINFO_ISO"), idata->getISOSpeed(),
M("QINFO_FOCALLENGTH"), idata->getFocalLen())
+ Glib::ustring::compose ("%1: %2", M("QINFO_LENS"), Glib::ustring(idata->getLens()));
else
else
infoString = M("QINFO_NOEXIF");
iarea->imageArea->setInfoText (infoString);
@ -531,7 +531,7 @@ void EditorPanel::info_toggled () {
void EditorPanel::hideHistoryActivated () {
removeIfThere (hpanedl, leftbox, false);
if (hidehp->get_active())
if (hidehp->get_active())
hpanedl->pack1 (*leftbox, false, true);
options.showHistory = hidehp->get_active();
}
@ -583,7 +583,7 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) {
iarea->imageArea->zoomPanel->zoom11Clicked();
return true;
case GDK_f:
case GDK_F:
case GDK_F:
iarea->imageArea->zoomPanel->zoomFitClicked();
return true;
}
@ -613,8 +613,8 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) {
void EditorPanel::procParamsChanged (Thumbnail* thm, int whoChangedIt) {
if (whoChangedIt!=EDITOR)
tpc->profileChange (&openThm->getProcParams(), rtengine::EvProfileChangeNotification, M("PROGRESSDLG_PROFILECHANGEDINBROWSER"));
if (whoChangedIt!=EDITOR)
tpc->profileChange (&openThm->getProcParams(), rtengine::EvProfileChangeNotification, M("PROGRESSDLG_PROFILECHANGEDINBROWSER"));
}
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 ();
if (getExtension (fname)!=sf.format)
fname = fname + "." + sf.format;
options.saveFormat = sf;
if (saveAsDialog->getImmediately ()) {
@ -731,7 +731,7 @@ void EditorPanel::saveAsPressed () {
if (response==Gtk::RESPONSE_NO)
return;
}
// save image
// save image
rtengine::procparams::ProcParams pparams;
ipc->getParams (&pparams);
rtengine::ProcessingJob* job = rtengine::ProcessingJob::create (ipc->getInitialImage(), pparams);
@ -901,12 +901,12 @@ void EditorPanel::beforeAfterToggled () {
removeIfThere (afterBox, afterLabel, false);
if (beforeIarea) {
if (beforeIpc)
if (beforeIpc)
beforeIpc->stopProcessing ();
iarea->setBeforeAfterViews (NULL, iarea);
delete beforeIarea;
beforeIarea = NULL;
if (beforeIpc)
if (beforeIpc)
beforeIpc->setPreviewImageListener (NULL);
delete beforePreviewHandler;
beforePreviewHandler = NULL;
@ -944,7 +944,7 @@ void EditorPanel::beforeAfterToggled () {
iarea->setBeforeAfterViews (beforeIarea, iarea);
beforeIarea->setBeforeAfterViews (beforeIarea, iarea);
rtengine::procparams::ProcParams params;
if (history->getBeforeLineParams (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) {
histogramPanel->histogramChanged (rh, gh, bh, lh);
histogramPanel->histogramChanged (rh, gh, bh, lh);
tpc->updateCurveBackgroundHistogram (bcrgb, bcl);
}

View File

@ -90,6 +90,7 @@ void Options::setDefaults () {
maxCacheEntries = 10000;
thumbnailFormat = FT_Custom16;
thumbInterp = 1;
autoSuffix = false;
saveParamsFile = false;
saveParamsCache = true;
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", "PathTemplate")) savePathTemplate = keyFile.get_string ("Output", "PathTemplate");
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", "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_string ("Output", "PathTemplate", savePathTemplate);
keyFile.set_string ("Output", "PathFolder", savePathFolder);
keyFile.set_boolean("Output", "AutoSuffix", autoSuffix);
keyFile.set_boolean("Output", "UsePathTemplate", saveUsePathTemplate);
keyFile.set_string ("Output", "LastSaveAsPath", lastSaveAsPath);

View File

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

View File

@ -1,219 +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);
#ifdef _WIN32
cNormal = new Gdk::Cursor (Gdk::ARROW);
#else
cNormal = new Gdk::Cursor (Gdk::ARROW);
#endif
}
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) {
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) {
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) {
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

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

View File

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

View File

@ -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;
}

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);