Removed Windows-style line breaks (^M) from all .cc and .h source files.

This commit is contained in:
Wyatt Olson
2010-05-01 16:26:14 -06:00
parent e1a028e535
commit 1b563a4b82
284 changed files with 39262 additions and 39262 deletions

View File

@@ -1,28 +1,28 @@
/*
* 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/>.
*/
/*
* 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 <editorpanel.h>
#include <options.h>
#include <progressdialog.h>
#include <rtwindow.h>
#include <guiutils.h>
#include <procparamchangers.h>
#include <safegtk.h>
#include <safegtk.h>
using namespace rtengine::procparams;
@@ -63,58 +63,58 @@ EditorPanel::EditorPanel (Thumbnail* tmb, rtengine::InitialImage* isrc) : parent
// build the middle of the screen
Gtk::VBox* editbox = Gtk::manage (new Gtk::VBox ());
info = Gtk::manage (new Gtk::ToggleButton ());
Gtk::Image* infoimg = Gtk::manage (new Gtk::Image (argv0+"/images/info.png"));
info->add (*infoimg);
info->set_relief(Gtk::RELIEF_NONE);
info->set_tooltip_text (M("MAIN_TOOLTIP_QINFO"));
info = Gtk::manage (new Gtk::ToggleButton ());
Gtk::Image* infoimg = Gtk::manage (new Gtk::Image (argv0+"/images/info.png"));
info->add (*infoimg);
info->set_relief(Gtk::RELIEF_NONE);
info->set_tooltip_text (M("MAIN_TOOLTIP_QINFO"));
beforeAfter = Gtk::manage (new Gtk::ToggleButton (M("MAIN_TOGGLE_BEFORE_AFTER")));
beforeAfter->set_tooltip_text (M("MAIN_TOOLTIP_TOGGLE"));
beforeAfter = Gtk::manage (new Gtk::ToggleButton (M("MAIN_TOGGLE_BEFORE_AFTER")));
beforeAfter->set_tooltip_text (M("MAIN_TOOLTIP_TOGGLE"));
Gtk::VSeparator* vsept = Gtk::manage (new Gtk::VSeparator ());
Gtk::VSeparator* vsepz = Gtk::manage (new Gtk::VSeparator ());
Gtk::VSeparator* vsepi = Gtk::manage (new Gtk::VSeparator ());
Gtk::VSeparator* vseph = Gtk::manage (new Gtk::VSeparator ());
hidehp = Gtk::manage (new Gtk::ToggleButton ());
Gtk::Label* hidehpLabel = Gtk::manage (new Gtk::Label ());
hidehpLabel->set_markup ("<b>H</b>");
Gtk::Image* hpimg = Gtk::manage (new Gtk::Image (argv0+"/images/left.png"));
Gtk::HBox* hidehpBox = Gtk::manage (new Gtk::HBox ());
hidehpBox->pack_start (*hpimg, Gtk::PACK_SHRINK, 2);
hidehpBox->pack_start (*hidehpLabel, Gtk::PACK_SHRINK, 2);
hidehp->add (*hidehpBox);
hidehp->set_relief(Gtk::RELIEF_NONE);
hidehp->set_active (options.showHistory);
hidehp->set_tooltip_text (M("MAIN_TOOLTIP_HIDEHP"));
Gtk::VSeparator* vsepi = Gtk::manage (new Gtk::VSeparator ());
Gtk::VSeparator* vseph = Gtk::manage (new Gtk::VSeparator ());
hidehp = Gtk::manage (new Gtk::ToggleButton ());
Gtk::Label* hidehpLabel = Gtk::manage (new Gtk::Label ());
hidehpLabel->set_markup ("<b>H</b>");
Gtk::Image* hpimg = Gtk::manage (new Gtk::Image (argv0+"/images/left.png"));
Gtk::HBox* hidehpBox = Gtk::manage (new Gtk::HBox ());
hidehpBox->pack_start (*hpimg, Gtk::PACK_SHRINK, 2);
hidehpBox->pack_start (*hidehpLabel, Gtk::PACK_SHRINK, 2);
hidehp->add (*hidehpBox);
hidehp->set_relief(Gtk::RELIEF_NONE);
hidehp->set_active (options.showHistory);
hidehp->set_tooltip_text (M("MAIN_TOOLTIP_HIDEHP"));
Gtk::VSeparator* vsepcl = Gtk::manage (new Gtk::VSeparator ());
Gtk::VSeparator* vsepz2 = Gtk::manage (new Gtk::VSeparator ());
iarea = new ImageAreaPanel ();
Gtk::HBox* toolBarPanel = Gtk::manage (new Gtk::HBox ());
toolBarPanel->pack_start (*hidehp, Gtk::PACK_SHRINK, 1);
toolBarPanel->pack_start (*vseph, Gtk::PACK_SHRINK, 2);
toolBarPanel->pack_start (*info, Gtk::PACK_SHRINK, 1);
toolBarPanel->pack_start (*beforeAfter, Gtk::PACK_SHRINK, 1);
toolBarPanel->pack_start (*vsepi, Gtk::PACK_SHRINK, 2);
Gtk::HBox* toolBarPanel = Gtk::manage (new Gtk::HBox ());
toolBarPanel->pack_start (*hidehp, Gtk::PACK_SHRINK, 1);
toolBarPanel->pack_start (*vseph, Gtk::PACK_SHRINK, 2);
toolBarPanel->pack_start (*info, Gtk::PACK_SHRINK, 1);
toolBarPanel->pack_start (*beforeAfter, Gtk::PACK_SHRINK, 1);
toolBarPanel->pack_start (*vsepi, Gtk::PACK_SHRINK, 2);
toolBarPanel->pack_start (*tpc->getToolBar(), Gtk::PACK_SHRINK, 1);
toolBarPanel->pack_start (*vsept, Gtk::PACK_SHRINK, 2);
toolBarPanel->pack_end (*tpc->coarse, 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 (*tpc->coarse, 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 (*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 (*toolBarPanel, Gtk::PACK_SHRINK);
editbox->pack_start (*beforeAfterBox);
// build right side panel
@@ -193,17 +193,17 @@ EditorPanel::EditorPanel (Thumbnail* tmb, rtengine::InitialImage* isrc) : parent
iarea->imageArea->setPointerMotionListener (navigator);
iarea->imageArea->setImageAreaToolListener (tpc);
// initialize components
info->set_active (options.showInfo);
tpc->readOptions ();
// initialize components
info->set_active (options.showInfo);
tpc->readOptions ();
// connect event handlers
info->signal_toggled().connect( sigc::mem_fun(*this, &EditorPanel::info_toggled) );
beforeAfter->signal_toggled().connect( sigc::mem_fun(*this, &EditorPanel::beforeAfterToggled) );
hidehp->signal_toggled().connect( sigc::mem_fun(*this, &EditorPanel::hideHistoryActivated) );
saveimgas->signal_pressed().connect( sigc::mem_fun(*this, &EditorPanel::saveAsPressed) );
queueimg->signal_pressed().connect( sigc::mem_fun(*this, &EditorPanel::queueImgPressed) );
sendtogimp->signal_pressed().connect( sigc::mem_fun(*this, &EditorPanel::sendToGimpPressed) );
info->signal_toggled().connect( sigc::mem_fun(*this, &EditorPanel::info_toggled) );
beforeAfter->signal_toggled().connect( sigc::mem_fun(*this, &EditorPanel::beforeAfterToggled) );
hidehp->signal_toggled().connect( sigc::mem_fun(*this, &EditorPanel::hideHistoryActivated) );
saveimgas->signal_pressed().connect( sigc::mem_fun(*this, &EditorPanel::saveAsPressed) );
queueimg->signal_pressed().connect( sigc::mem_fun(*this, &EditorPanel::queueImgPressed) );
sendtogimp->signal_pressed().connect( sigc::mem_fun(*this, &EditorPanel::sendToGimpPressed) );
// open image
open (tmb, isrc);
@@ -223,9 +223,9 @@ EditorPanel::~EditorPanel () {
delete beforeIarea;
if (ipc)
ipc->setPreviewImageListener (NULL);
ipc->setPreviewImageListener (NULL);
if (beforeIpc)
beforeIpc->setPreviewImageListener (NULL);
beforeIpc->setPreviewImageListener (NULL);
delete previewHandler;
delete beforePreviewHandler;
@@ -256,88 +256,88 @@ void EditorPanel::on_realize () {
rtengine::InitialImage* EditorPanel::loadImage (Thumbnail* tmb) {
// try to load the image
Glib::ustring filename = tmb->getFileName ();
int error;
// InitialImage* isrc = InitialImage::load (filename, tmb->getType()==FT_Raw, error, this);
ProgressDialog<rtengine::InitialImage*>* pdload = new ProgressDialog<rtengine::InitialImage*> (M("PROGRESSDLG_LOADING"));
rtengine::InitialImage* isrc;
pdload->setFunc (sigc::bind(sigc::ptr_fun(&rtengine::InitialImage::load), filename, tmb->getType()==FT_Raw, &error, pdload->getProgressListener()), &isrc);
pdload->start ();
delete pdload;
// try to load the image
Glib::ustring filename = tmb->getFileName ();
int error;
// InitialImage* isrc = InitialImage::load (filename, tmb->getType()==FT_Raw, error, this);
ProgressDialog<rtengine::InitialImage*>* pdload = new ProgressDialog<rtengine::InitialImage*> (M("PROGRESSDLG_LOADING"));
rtengine::InitialImage* isrc;
pdload->setFunc (sigc::bind(sigc::ptr_fun(&rtengine::InitialImage::load), filename, tmb->getType()==FT_Raw, &error, pdload->getProgressListener()), &isrc);
pdload->start ();
delete pdload;
if (error)
return NULL;
else
return isrc;
return isrc;
}
void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) {
// initialize everything
openThm = tmb;
openThm->increaseRef ();
// initialize everything
openThm = tmb;
openThm->increaseRef ();
previewHandler = new PreviewHandler ();
this->isrc = isrc;
ipc = rtengine::StagedImageProcessor::create (isrc);
ipc->setProgressListener (this);
ipc->setPreviewImageListener (previewHandler);
ipc->setPreviewScale (10);
tpc->initImage (ipc, tmb->getType()==FT_Raw);
ipc->setHistogramListener (this);
// iarea->fitZoom (); // tell to the editorPanel that the next image has to be fitted to the screen
this->isrc = isrc;
ipc = rtengine::StagedImageProcessor::create (isrc);
ipc->setProgressListener (this);
ipc->setPreviewImageListener (previewHandler);
ipc->setPreviewScale (10);
tpc->initImage (ipc, tmb->getType()==FT_Raw);
ipc->setHistogramListener (this);
// iarea->fitZoom (); // tell to the editorPanel that the next image has to be fitted to the screen
iarea->imageArea->setPreviewHandler (previewHandler);
iarea->imageArea->setImProcCoordinator (ipc);
navigator->previewWindow->setPreviewHandler (previewHandler);
navigator->previewWindow->setImageArea (iarea->imageArea);
// try to load the last saved parameters from the cache or from the pp2 file
ProcParams* ldprof = NULL;
if (openThm->hasProcParams()) {
ldprof = new ProcParams ();
*ldprof = openThm->getProcParams ();
}
// initialize profile
if (openThm->getType()!=FT_Raw)
profilep->initProfile (options.defProfImg, ldprof, NULL);
else
profilep->initProfile (options.defProfRaw, ldprof, NULL);
// try to load the last saved parameters from the cache or from the pp2 file
ProcParams* ldprof = NULL;
if (openThm->hasProcParams()) {
ldprof = new ProcParams ();
*ldprof = openThm->getProcParams ();
}
// initialize profile
if (openThm->getType()!=FT_Raw)
profilep->initProfile (options.defProfImg, ldprof, NULL);
else
profilep->initProfile (options.defProfRaw, ldprof, NULL);
openThm->addThumbnailListener (this);
info_toggled ();
info_toggled ();
}
void EditorPanel::close () {
saveProfile ();
saveProfile ();
// close image processor and the current thumbnail
tpc->closeImage (); // this call stops image processing
tpc->writeOptions ();
// close image processor and the current thumbnail
tpc->closeImage (); // this call stops image processing
tpc->writeOptions ();
if (ipc)
rtengine::StagedImageProcessor::destroy (ipc);
rtengine::StagedImageProcessor::destroy (ipc);
if (beforeIpc)
rtengine::StagedImageProcessor::destroy (beforeIpc);
rtengine::StagedImageProcessor::destroy (beforeIpc);
openThm->removeThumbnailListener (this);
openThm->decreaseRef ();
openThm->decreaseRef ();
}
void EditorPanel::saveProfile () {
ProcParams params;
ipc->getParams (&params);
if (options.saveParamsFile)
params.save (openThm->getFileName() + ".pp2");
if (openThm && options.saveParamsCache)
openThm->setProcParams (params, EDITOR);
}
void EditorPanel::saveProfile () {
ProcParams params;
ipc->getParams (&params);
if (options.saveParamsFile)
params.save (openThm->getFileName() + ".pp2");
if (openThm && options.saveParamsCache)
openThm->setProcParams (params, EDITOR);
}
Glib::ustring EditorPanel::getShortName () {
@@ -352,19 +352,19 @@ Glib::ustring EditorPanel::getFileName () {
// TODO!!!
void EditorPanel::procParamsChanged (rtengine::procparams::ProcParams* params, rtengine::ProcEvent ev, Glib::ustring descr, ParamsEdited* paramsEdited) {
// if (ev!=EvPhotoLoaded)
// if (ev!=EvPhotoLoaded)
// saveLabel->set_markup (Glib::ustring("<span foreground=\"#AA0000\" weight=\"bold\">") + M("MAIN_BUTTON_SAVE") + "</span>");
}
struct spsparams {
bool state;
EditorPanelIdleHelper* epih;
};
int setprocstate (void* data) {
gdk_threads_enter ();
spsparams* p = (spsparams*)data;
struct spsparams {
bool state;
EditorPanelIdleHelper* epih;
};
int setprocstate (void* data) {
gdk_threads_enter ();
spsparams* p = (spsparams*)data;
if (p->epih->destroyed) {
if (p->epih->pending == 1)
@@ -377,30 +377,30 @@ int setprocstate (void* data) {
}
p->epih->epanel->refreshProcessingState (p->state);
p->epih->pending--;
delete p;
gdk_threads_leave ();
return 0;
}
void EditorPanel::setProgressState (int state) {
p->epih->pending--;
delete p;
gdk_threads_leave ();
return 0;
}
void EditorPanel::setProgressState (int state) {
epih->pending++;
spsparams* p = new spsparams;
p->state = state;
p->epih = epih;
g_idle_add (setprocstate, p);
}
void EditorPanel::refreshProcessingState (bool state) {
spsparams* p = new spsparams;
p->state = state;
p->epih = epih;
g_idle_add (setprocstate, p);
}
void EditorPanel::refreshProcessingState (bool state) {
// Set proc params of thumbnail. It saves it into the cache and updates the file browser.
if (ipc && openThm && !state && tpc->getChangedState()) {
rtengine::procparams::ProcParams pparams;
ipc->getParams (&pparams);
if (ipc && openThm && !state && tpc->getChangedState()) {
rtengine::procparams::ProcParams pparams;
ipc->getParams (&pparams);
openThm->setProcParams (pparams, EDITOR, false);
}
}
// change state of the led
std::vector<Widget*> children = (std::vector<Widget*>) statusBox->get_children();
@@ -413,26 +413,26 @@ void EditorPanel::refreshProcessingState (bool state) {
statusBox->pack_end (*red, Gtk::PACK_SHRINK, 4);
else
statusBox->pack_end (*green, Gtk::PACK_SHRINK, 4);
}
struct errparams {
Glib::ustring descr;
EditorPanelIdleHelper* epih;
};
void EditorPanel::displayError (Glib::ustring descr) {
}
struct errparams {
Glib::ustring descr;
EditorPanelIdleHelper* epih;
};
void EditorPanel::displayError (Glib::ustring descr) {
if (parent) {
Gtk::MessageDialog* msgd = new Gtk::MessageDialog (*parent, descr, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
msgd->set_title (M("MAIN_MSG_CANNOTSAVE"));
msgd->run ();
delete msgd;
}
}
int disperror (void* data) {
gdk_threads_enter ();
}
int disperror (void* data) {
gdk_threads_enter ();
errparams* p = (errparams*)data;
if (p->epih->destroyed) {
@@ -444,48 +444,48 @@ int disperror (void* data) {
gdk_threads_leave ();
return 0;
}
p->epih->epanel->displayError (p->descr);
p->epih->epanel->displayError (p->descr);
p->epih->pending--;
delete p;
gdk_threads_leave ();
return 0;
}
void EditorPanel::error (Glib::ustring descr) {
gdk_threads_leave ();
return 0;
}
epih->pending++;
errparams* p = new errparams;
p->descr = descr;
p->epih = epih;
g_idle_add (disperror, p);
}
void EditorPanel::info_toggled () {
void EditorPanel::error (Glib::ustring descr) {
epih->pending++;
errparams* p = new errparams;
p->descr = descr;
p->epih = epih;
g_idle_add (disperror, p);
}
void EditorPanel::info_toggled () {
Glib::ustring infoString;
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",
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
infoString = M("QINFO_NOEXIF");
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",
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
infoString = M("QINFO_NOEXIF");
iarea->imageArea->setInfoText (infoString);
iarea->imageArea->infoEnabled (info->get_active ());
}
void EditorPanel::hideHistoryActivated () {
iarea->imageArea->setInfoText (infoString);
iarea->imageArea->infoEnabled (info->get_active ());
}
void EditorPanel::hideHistoryActivated () {
removeIfThere (hpanedl, leftbox, false);
if (hidehp->get_active())
hpanedl->pack1 (*leftbox, false, true);
}
}
bool EditorPanel::handleShortcutKey (GdkEventKey* event) {
@@ -529,27 +529,27 @@ void EditorPanel::procParamsChanged (Thumbnail* thm, int whoChangedIt) {
rtengine::IImage16* EditorPanel::processImage () {
rtengine::procparams::ProcParams pparams;
ipc->getParams (&pparams);
rtengine::ProcessingJob* job = rtengine::ProcessingJob::create (ipc->getInitialImage(), pparams);
int err = 0;
ProgressDialog<rtengine::IImage16*>* pdproc = new ProgressDialog<rtengine::IImage16*> (M("PROGRESSDLG_PROCESSING"));
rtengine::IImage16* img;
pdproc->setFunc (sigc::bind(sigc::ptr_fun(&rtengine::processImage), job, err, pdproc->getProgressListener()), &img);
pdproc->start ();
rtengine::procparams::ProcParams pparams;
ipc->getParams (&pparams);
rtengine::ProcessingJob* job = rtengine::ProcessingJob::create (ipc->getInitialImage(), pparams);
int err = 0;
ProgressDialog<rtengine::IImage16*>* pdproc = new ProgressDialog<rtengine::IImage16*> (M("PROGRESSDLG_PROCESSING"));
rtengine::IImage16* img;
pdproc->setFunc (sigc::bind(sigc::ptr_fun(&rtengine::processImage), job, err, pdproc->getProgressListener()), &img);
pdproc->start ();
delete pdproc;
return img;
return img;
}
BatchQueueEntry* EditorPanel::createBatchQueueEntry () {
rtengine::procparams::ProcParams pparams;
ipc->getParams (&pparams);
rtengine::ProcessingJob* job = rtengine::ProcessingJob::create (ipc->getInitialImage(), pparams);
int prevh = options.maxThumbnailHeight;
int prevw = prevh;
guint8* prev = NULL;//(guint8*) previewHandler->getImagePreview (prevw, prevh);
return new BatchQueueEntry (job, pparams, openThm->getFileName(), prev, prevw, prevh, openThm);
rtengine::procparams::ProcParams pparams;
ipc->getParams (&pparams);
rtengine::ProcessingJob* job = rtengine::ProcessingJob::create (ipc->getInitialImage(), pparams);
int prevh = options.maxThumbnailHeight;
int prevw = prevh;
guint8* prev = NULL;//(guint8*) previewHandler->getImagePreview (prevw, prevh);
return new BatchQueueEntry (job, pparams, openThm->getFileName(), prev, prevw, prevh, openThm);
}
int EditorPanel::saveImage (rtengine::IImage16* img, Glib::ustring& fname, SaveFormat sf, bool findNewNameIfNeeded) {
@@ -560,26 +560,26 @@ int EditorPanel::saveImage (rtengine::IImage16* img, Glib::ustring& fname, SaveF
while (Glib::file_test (fileName, Glib::FILE_TEST_EXISTS) && tries<1000) {
fileName = Glib::ustring::compose("%1-%2.%3", fname, tries, sf.format);
tries++;
}
}
if (tries==1000)
return -1000;
}
ProgressDialog<int>* pdsave = new ProgressDialog<int> (M("PROGRESSDLG_SAVING"));
ProgressDialog<int>* pdsave = new ProgressDialog<int> (M("PROGRESSDLG_SAVING"));
img->setSaveProgressListener (pdsave->getProgressListener());
int err;
if (sf.format=="tif")
pdsave->setFunc (sigc::bind(sigc::mem_fun(img, &rtengine::IImage16::saveAsTIFF), fileName, sf.tiffBits), &err);
else if (sf.format=="png")
pdsave->setFunc (sigc::bind(sigc::mem_fun(img, &rtengine::IImage16::saveAsPNG), fileName, sf.pngCompression, sf.pngBits), &err);
else if (sf.format=="jpg")
pdsave->setFunc (sigc::bind(sigc::mem_fun(img, &rtengine::IImage16::saveAsJPEG), fileName, sf.jpegQuality), &err);
pdsave->start ();
int err;
if (sf.format=="tif")
pdsave->setFunc (sigc::bind(sigc::mem_fun(img, &rtengine::IImage16::saveAsTIFF), fileName, sf.tiffBits), &err);
else if (sf.format=="png")
pdsave->setFunc (sigc::bind(sigc::mem_fun(img, &rtengine::IImage16::saveAsPNG), fileName, sf.pngCompression, sf.pngBits), &err);
else if (sf.format=="jpg")
pdsave->setFunc (sigc::bind(sigc::mem_fun(img, &rtengine::IImage16::saveAsJPEG), fileName, sf.jpegQuality), &err);
pdsave->start ();
delete pdsave;
fname = fileName;
return err;
return err;
}
void EditorPanel::saveAsPressed () {
@@ -610,22 +610,22 @@ void EditorPanel::saveAsPressed () {
if (img) {
fname = removeExtension (fname);
err = saveImage (img, fname, sf, false);
img->free ();
if (!err) {
openThm->imageDeveloped ();
// save processing parameters, if needed
if (sf.saveParams) {
rtengine::procparams::ProcParams pparams;
ipc->getParams (&pparams);
img->free ();
if (!err) {
openThm->imageDeveloped ();
// save processing parameters, if needed
if (sf.saveParams) {
rtengine::procparams::ProcParams pparams;
ipc->getParams (&pparams);
pparams.save (removeExtension (fname) + ".out.pp2");
}
}
}
}
if (!img || err) {
if (!img || err) {
Glib::ustring msg_ = Glib::ustring("<b>") + fname + ": " + M("MAIN_MSG_ERRORDURINGIMAGESAVING") + "\n</b>";
Gtk::MessageDialog msgd (*parent, msg_, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
msgd.run ();
}
}
}
else {
BatchQueueEntry* bqe = createBatchQueueEntry ();
@@ -640,79 +640,79 @@ void EditorPanel::saveAsPressed () {
void EditorPanel::queueImgPressed () {
saveProfile ();
parent->addBatchQueueJob (createBatchQueueEntry ());
parent->addBatchQueueJob (createBatchQueueEntry ());
}
void EditorPanel::sendToGimpPressed () {
// develop image
rtengine::IImage16* img = processImage ();
if (img) {
// get file name base
Glib::ustring shortname = removeExtension (Glib::path_get_basename (openThm->getFileName()));
Glib::ustring dirname = Glib::get_tmp_dir ();
Glib::ustring filename = Glib::build_filename (dirname, shortname);
SaveFormat sf;
sf.format = "tif";
sf.tiffBits = 16;
int err = saveImage (img, filename, sf, true);
img->free ();
if (!err) {
bool success=false;
Glib::ustring cmdLine;
// start gimp
if (options.editorToSendTo==1) {
#ifdef _WIN32
cmdLine = Glib::ustring("\"") + Glib::build_filename (Glib::build_filename(options.gimpDir,"bin"), "gimp-win-remote") + "\" gimp-2.4.exe" + " \"" + filename + "\"";
#else
cmdLine = Glib::ustring("gimp-remote ") + " \"" + filename + "\"";
#endif
success = safe_spawn_command_line_async (cmdLine);
if (!success){
#ifdef _WIN32
int ver = 12;
while (!success && ver) {
cmdLine = Glib::ustring("\"") + Glib::build_filename (Glib::build_filename(options.gimpDir,"bin"), Glib::ustring::compose("gimp-2.%1.exe",ver)) + "\" \"" + filename + "\"";
ver--;
success = safe_spawn_command_line_async (cmdLine);
}
#elif defined __APPLE__
cmdLine = Glib::ustring("gimp ") + " \"" + filename + "\"";
success = safe_spawn_command_line_async (cmdLine);
#else
cmdLine = Glib::ustring("gimp ") + " \"" + filename + "\"";
success = safe_spawn_command_line_async (cmdLine);
#endif
}
}
else if (options.editorToSendTo==2) {
#ifdef __APPLE__
cmdLine = Glib::ustring("open -a \'") + Glib::build_filename(options.psDir,"Photoshop.app\' ") + "\'" + filename + "\'";
#else
cmdLine = Glib::ustring("\"") + Glib::build_filename(options.psDir,"Photoshop.exe") + "\" \"" + filename + "\"";
#endif
success = safe_spawn_command_line_async (cmdLine);
}
else if (options.editorToSendTo==3) {
#ifdef __APPLE__
cmdLine = Glib::ustring("") + options.customEditorProg + filename;
#else
cmdLine = Glib::ustring("\"") + options.customEditorProg + "\" \"" + filename + "\"";
#endif
success = safe_spawn_command_line_async (cmdLine);
}
if (!success) {
Gtk::MessageDialog* msgd = new Gtk::MessageDialog (*parent, M("MAIN_MSG_CANNOTSTARTEDITOR"), false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
msgd->set_secondary_text (M("MAIN_MSG_CANNOTSTARTEDITOR_SECONDARY"));
msgd->set_title (M("MAIN_BUTTON_SENDTOEDITOR"));
msgd->run ();
delete msgd;
}
}
}
}
void EditorPanel::sendToGimpPressed () {
// develop image
rtengine::IImage16* img = processImage ();
if (img) {
// get file name base
Glib::ustring shortname = removeExtension (Glib::path_get_basename (openThm->getFileName()));
Glib::ustring dirname = Glib::get_tmp_dir ();
Glib::ustring filename = Glib::build_filename (dirname, shortname);
SaveFormat sf;
sf.format = "tif";
sf.tiffBits = 16;
int err = saveImage (img, filename, sf, true);
img->free ();
if (!err) {
bool success=false;
Glib::ustring cmdLine;
// start gimp
if (options.editorToSendTo==1) {
#ifdef _WIN32
cmdLine = Glib::ustring("\"") + Glib::build_filename (Glib::build_filename(options.gimpDir,"bin"), "gimp-win-remote") + "\" gimp-2.4.exe" + " \"" + filename + "\"";
#else
cmdLine = Glib::ustring("gimp-remote ") + " \"" + filename + "\"";
#endif
success = safe_spawn_command_line_async (cmdLine);
if (!success){
#ifdef _WIN32
int ver = 12;
while (!success && ver) {
cmdLine = Glib::ustring("\"") + Glib::build_filename (Glib::build_filename(options.gimpDir,"bin"), Glib::ustring::compose("gimp-2.%1.exe",ver)) + "\" \"" + filename + "\"";
ver--;
success = safe_spawn_command_line_async (cmdLine);
}
#elif defined __APPLE__
cmdLine = Glib::ustring("gimp ") + " \"" + filename + "\"";
success = safe_spawn_command_line_async (cmdLine);
#else
cmdLine = Glib::ustring("gimp ") + " \"" + filename + "\"";
success = safe_spawn_command_line_async (cmdLine);
#endif
}
}
else if (options.editorToSendTo==2) {
#ifdef __APPLE__
cmdLine = Glib::ustring("open -a \'") + Glib::build_filename(options.psDir,"Photoshop.app\' ") + "\'" + filename + "\'";
#else
cmdLine = Glib::ustring("\"") + Glib::build_filename(options.psDir,"Photoshop.exe") + "\" \"" + filename + "\"";
#endif
success = safe_spawn_command_line_async (cmdLine);
}
else if (options.editorToSendTo==3) {
#ifdef __APPLE__
cmdLine = Glib::ustring("") + options.customEditorProg + filename;
#else
cmdLine = Glib::ustring("\"") + options.customEditorProg + "\" \"" + filename + "\"";
#endif
success = safe_spawn_command_line_async (cmdLine);
}
if (!success) {
Gtk::MessageDialog* msgd = new Gtk::MessageDialog (*parent, M("MAIN_MSG_CANNOTSTARTEDITOR"), false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
msgd->set_secondary_text (M("MAIN_MSG_CANNOTSTARTEDITOR_SECONDARY"));
msgd->set_title (M("MAIN_BUTTON_SENDTOEDITOR"));
msgd->run ();
delete msgd;
}
}
}
}
void EditorPanel::saveOptions () {
@@ -746,7 +746,7 @@ void EditorPanel::beforeAfterToggled () {
beforePreviewHandler = NULL;
if (beforeIpc)
rtengine::StagedImageProcessor::destroy (beforeIpc);
beforeIpc = NULL;
beforeIpc = NULL;
}
if (beforeAfter->get_active ()) {
@@ -770,9 +770,9 @@ void EditorPanel::beforeAfterToggled () {
beforePreviewHandler = new PreviewHandler ();
isrc->increaseRef ();
beforeIpc = rtengine::StagedImageProcessor::create (isrc);
beforeIpc->setPreviewScale (10);
beforeIpc->setPreviewImageListener (beforePreviewHandler);
beforeIpc = rtengine::StagedImageProcessor::create (isrc);
beforeIpc->setPreviewScale (10);
beforeIpc->setPreviewImageListener (beforePreviewHandler);
beforeIarea->imageArea->setPreviewHandler (beforePreviewHandler);
beforeIarea->imageArea->setImProcCoordinator (beforeIpc);