Formatted all .cc and .h code in rtengine, rtexif and rtgui using astyle

This commit is contained in:
DrSlony
2015-08-11 11:55:03 +02:00
parent effb46c3e1
commit 0e0cfb9b25
452 changed files with 133354 additions and 99460 deletions

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
@@ -28,7 +28,8 @@
using namespace rtengine::procparams;
ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL)
{
exposurePanel = Gtk::manage (new ToolVBox ());
detailsPanel = Gtk::manage (new ToolVBox ());
@@ -36,7 +37,7 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
transformPanel = Gtk::manage (new ToolVBox ());
rawPanel = Gtk::manage (new ToolVBox ());
waveletPanel = Gtk::manage (new ToolVBox ());
coarse = Gtk::manage (new CoarsePanel ());
toneCurve = Gtk::manage (new ToneCurve ());
shadowshighlights = Gtk::manage (new ShadowsHighlights ());
@@ -96,52 +97,98 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
// Best -> low ISO
// Medium -> High ISO
addPanel (colorPanel, whitebalance); toolPanels.push_back (whitebalance);
addPanel (exposurePanel, toneCurve); toolPanels.push_back (toneCurve);
addPanel (colorPanel, vibrance); toolPanels.push_back (vibrance);
addPanel (colorPanel, chmixer); toolPanels.push_back (chmixer); // << TODO: Add "Enabled"
addPanel (colorPanel, blackwhite); toolPanels.push_back (blackwhite);
addPanel (exposurePanel, shadowshighlights); toolPanels.push_back (shadowshighlights);
addPanel (detailsPanel, sharpening); toolPanels.push_back (sharpening);
addPanel (detailsPanel, sharpenEdge); toolPanels.push_back (sharpenEdge);
addPanel (detailsPanel, sharpenMicro); toolPanels.push_back (sharpenMicro);
addPanel (colorPanel, hsvequalizer); toolPanels.push_back (hsvequalizer); // << TODO: Add "Enabled"
addPanel (colorPanel, filmSimulation); toolPanels.push_back (filmSimulation);
addPanel (colorPanel, rgbcurves); toolPanels.push_back (rgbcurves); // << TODO: Add "Enabled"
addPanel (colorPanel, colortoning); toolPanels.push_back (colortoning);
addPanel (exposurePanel, epd); toolPanels.push_back (epd);
addPanel (exposurePanel, pcvignette); toolPanels.push_back (pcvignette);
addPanel (exposurePanel, gradient); toolPanels.push_back (gradient);
addPanel (exposurePanel, lcurve); toolPanels.push_back (lcurve); // << TODO: Add "Enabled" ???
addPanel (exposurePanel, colorappearance); toolPanels.push_back (colorappearance);
addPanel (detailsPanel, impulsedenoise); toolPanels.push_back (impulsedenoise);
addPanel (detailsPanel, dirpyrdenoise); toolPanels.push_back (dirpyrdenoise);
addPanel (detailsPanel, defringe); toolPanels.push_back (defringe);
addPanel (detailsPanel, dirpyrequalizer); toolPanels.push_back (dirpyrequalizer);
addPanel (waveletPanel, wavelet); toolPanels.push_back (wavelet);
addPanel (transformPanel, crop); toolPanels.push_back (crop);
addPanel (transformPanel, resize); toolPanels.push_back (resize);
addPanel (resize->getPackBox(), prsharpening); toolPanels.push_back (prsharpening);
addPanel (transformPanel, lensgeom); toolPanels.push_back (lensgeom);
addPanel (lensgeom->getPackBox(), rotate); toolPanels.push_back (rotate);
addPanel (lensgeom->getPackBox(), perspective); toolPanels.push_back (perspective);
addPanel (lensgeom->getPackBox(), lensProf); toolPanels.push_back (lensProf);
addPanel (lensgeom->getPackBox(), distortion); toolPanels.push_back (distortion);
addPanel (lensgeom->getPackBox(), cacorrection); toolPanels.push_back (cacorrection);
addPanel (lensgeom->getPackBox(), vignetting); toolPanels.push_back (vignetting);
addPanel (colorPanel, icm); toolPanels.push_back (icm);
addPanel (rawPanel, sensorbayer); toolPanels.push_back (sensorbayer);
addPanel (sensorbayer->getPackBox(), bayerprocess); toolPanels.push_back (bayerprocess);
addPanel (sensorbayer->getPackBox(), bayerrawexposure); toolPanels.push_back (bayerrawexposure);
addPanel (sensorbayer->getPackBox(), bayerpreprocess); toolPanels.push_back (bayerpreprocess);
addPanel (sensorbayer->getPackBox(), rawcacorrection); toolPanels.push_back (rawcacorrection);
addPanel (rawPanel, sensorxtrans); toolPanels.push_back (sensorxtrans);
addPanel (sensorxtrans->getPackBox(), xtransprocess); toolPanels.push_back (xtransprocess);
addPanel (sensorxtrans->getPackBox(), xtransrawexposure); toolPanels.push_back (xtransrawexposure);
addPanel (rawPanel, rawexposure); toolPanels.push_back (rawexposure);
addPanel (rawPanel, preprocess); toolPanels.push_back (preprocess);
addPanel (rawPanel, darkframe); toolPanels.push_back (darkframe);
addPanel (rawPanel, flatfield); toolPanels.push_back (flatfield);
addPanel (colorPanel, whitebalance);
toolPanels.push_back (whitebalance);
addPanel (exposurePanel, toneCurve);
toolPanels.push_back (toneCurve);
addPanel (colorPanel, vibrance);
toolPanels.push_back (vibrance);
addPanel (colorPanel, chmixer);
toolPanels.push_back (chmixer); // << TODO: Add "Enabled"
addPanel (colorPanel, blackwhite);
toolPanels.push_back (blackwhite);
addPanel (exposurePanel, shadowshighlights);
toolPanels.push_back (shadowshighlights);
addPanel (detailsPanel, sharpening);
toolPanels.push_back (sharpening);
addPanel (detailsPanel, sharpenEdge);
toolPanels.push_back (sharpenEdge);
addPanel (detailsPanel, sharpenMicro);
toolPanels.push_back (sharpenMicro);
addPanel (colorPanel, hsvequalizer);
toolPanels.push_back (hsvequalizer); // << TODO: Add "Enabled"
addPanel (colorPanel, filmSimulation);
toolPanels.push_back (filmSimulation);
addPanel (colorPanel, rgbcurves);
toolPanels.push_back (rgbcurves); // << TODO: Add "Enabled"
addPanel (colorPanel, colortoning);
toolPanels.push_back (colortoning);
addPanel (exposurePanel, epd);
toolPanels.push_back (epd);
addPanel (exposurePanel, pcvignette);
toolPanels.push_back (pcvignette);
addPanel (exposurePanel, gradient);
toolPanels.push_back (gradient);
addPanel (exposurePanel, lcurve);
toolPanels.push_back (lcurve); // << TODO: Add "Enabled" ???
addPanel (exposurePanel, colorappearance);
toolPanels.push_back (colorappearance);
addPanel (detailsPanel, impulsedenoise);
toolPanels.push_back (impulsedenoise);
addPanel (detailsPanel, dirpyrdenoise);
toolPanels.push_back (dirpyrdenoise);
addPanel (detailsPanel, defringe);
toolPanels.push_back (defringe);
addPanel (detailsPanel, dirpyrequalizer);
toolPanels.push_back (dirpyrequalizer);
addPanel (waveletPanel, wavelet);
toolPanels.push_back (wavelet);
addPanel (transformPanel, crop);
toolPanels.push_back (crop);
addPanel (transformPanel, resize);
toolPanels.push_back (resize);
addPanel (resize->getPackBox(), prsharpening);
toolPanels.push_back (prsharpening);
addPanel (transformPanel, lensgeom);
toolPanels.push_back (lensgeom);
addPanel (lensgeom->getPackBox(), rotate);
toolPanels.push_back (rotate);
addPanel (lensgeom->getPackBox(), perspective);
toolPanels.push_back (perspective);
addPanel (lensgeom->getPackBox(), lensProf);
toolPanels.push_back (lensProf);
addPanel (lensgeom->getPackBox(), distortion);
toolPanels.push_back (distortion);
addPanel (lensgeom->getPackBox(), cacorrection);
toolPanels.push_back (cacorrection);
addPanel (lensgeom->getPackBox(), vignetting);
toolPanels.push_back (vignetting);
addPanel (colorPanel, icm);
toolPanels.push_back (icm);
addPanel (rawPanel, sensorbayer);
toolPanels.push_back (sensorbayer);
addPanel (sensorbayer->getPackBox(), bayerprocess);
toolPanels.push_back (bayerprocess);
addPanel (sensorbayer->getPackBox(), bayerrawexposure);
toolPanels.push_back (bayerrawexposure);
addPanel (sensorbayer->getPackBox(), bayerpreprocess);
toolPanels.push_back (bayerpreprocess);
addPanel (sensorbayer->getPackBox(), rawcacorrection);
toolPanels.push_back (rawcacorrection);
addPanel (rawPanel, sensorxtrans);
toolPanels.push_back (sensorxtrans);
addPanel (sensorxtrans->getPackBox(), xtransprocess);
toolPanels.push_back (xtransprocess);
addPanel (sensorxtrans->getPackBox(), xtransrawexposure);
toolPanels.push_back (xtransrawexposure);
addPanel (rawPanel, rawexposure);
toolPanels.push_back (rawexposure);
addPanel (rawPanel, preprocess);
toolPanels.push_back (preprocess);
addPanel (rawPanel, darkframe);
toolPanels.push_back (darkframe);
addPanel (rawPanel, flatfield);
toolPanels.push_back (flatfield);
toolPanels.push_back (coarse);
toolPanels.push_back (exifpanel);
@@ -162,37 +209,37 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
updateVScrollbars (options.hideTPVScrollbar);
// load panel endings
for (int i=0; i<6; i++) {
vbPanelEnd[i] = Gtk::manage (new Gtk::VBox ());
imgPanelEnd[i] = Gtk::manage (new RTImage("PanelEnding.png"));
imgPanelEnd[i]->show ();
vbPanelEnd[i]->pack_start (*imgPanelEnd[i],Gtk::PACK_SHRINK);
vbPanelEnd[i]->show_all();
for (int i = 0; i < 6; i++) {
vbPanelEnd[i] = Gtk::manage (new Gtk::VBox ());
imgPanelEnd[i] = Gtk::manage (new RTImage("PanelEnding.png"));
imgPanelEnd[i]->show ();
vbPanelEnd[i]->pack_start (*imgPanelEnd[i], Gtk::PACK_SHRINK);
vbPanelEnd[i]->show_all();
}
exposurePanelSW->add (*exposurePanel);
exposurePanel->pack_start (*Gtk::manage(new Gtk::HSeparator), Gtk::PACK_SHRINK,0);
exposurePanel->pack_start (*vbPanelEnd[0],Gtk::PACK_SHRINK,4);
exposurePanel->pack_start (*Gtk::manage(new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
exposurePanel->pack_start (*vbPanelEnd[0], Gtk::PACK_SHRINK, 4);
detailsPanelSW->add (*detailsPanel);
detailsPanel->pack_start (*Gtk::manage(new Gtk::HSeparator), Gtk::PACK_SHRINK,0);
detailsPanel->pack_start (*vbPanelEnd[1],Gtk::PACK_SHRINK,4);
detailsPanel->pack_start (*Gtk::manage(new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
detailsPanel->pack_start (*vbPanelEnd[1], Gtk::PACK_SHRINK, 4);
colorPanelSW->add (*colorPanel);
colorPanel->pack_start (*Gtk::manage(new Gtk::HSeparator), Gtk::PACK_SHRINK,0);
colorPanel->pack_start (*vbPanelEnd[2],Gtk::PACK_SHRINK,4);
colorPanel->pack_start (*Gtk::manage(new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
colorPanel->pack_start (*vbPanelEnd[2], Gtk::PACK_SHRINK, 4);
waveletPanelSW->add (*waveletPanel);
waveletPanel->pack_start (*Gtk::manage(new Gtk::HSeparator), Gtk::PACK_SHRINK,0);
waveletPanel->pack_start (*vbPanelEnd[5],Gtk::PACK_SHRINK,0);
waveletPanel->pack_start (*Gtk::manage(new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
waveletPanel->pack_start (*vbPanelEnd[5], Gtk::PACK_SHRINK, 0);
transformPanelSW->add (*transformPanel);
transformPanel->pack_start (*Gtk::manage(new Gtk::HSeparator), Gtk::PACK_SHRINK,0);
transformPanel->pack_start (*vbPanelEnd[3],Gtk::PACK_SHRINK,4);
transformPanel->pack_start (*Gtk::manage(new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
transformPanel->pack_start (*vbPanelEnd[3], Gtk::PACK_SHRINK, 4);
rawPanelSW->add (*rawPanel);
rawPanel->pack_start (*Gtk::manage(new Gtk::HSeparator), Gtk::PACK_SHRINK,0);
rawPanel->pack_start (*vbPanelEnd[4],Gtk::PACK_SHRINK,0);
rawPanel->pack_start (*Gtk::manage(new Gtk::HSeparator), Gtk::PACK_SHRINK, 0);
rawPanel->pack_start (*vbPanelEnd[4], Gtk::PACK_SHRINK, 0);
@@ -206,21 +253,22 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
toiR = Gtk::manage (new TextOrIcon ("raw.png" , M("MAIN_TAB_RAW") , M("MAIN_TAB_RAW_TOOLTIP") , type));
toiM = Gtk::manage (new TextOrIcon ("meta.png" , M("MAIN_TAB_METADATA") , M("MAIN_TAB_METADATA_TOOLTIP") , type));
toolPanelNotebook->append_page (*exposurePanelSW, *toiE);
toolPanelNotebook->append_page (*detailsPanelSW, *toiD);
toolPanelNotebook->append_page (*colorPanelSW, *toiC);
toolPanelNotebook->append_page (*waveletPanelSW, *toiW);
toolPanelNotebook->append_page (*transformPanelSW, *toiT);
toolPanelNotebook->append_page (*rawPanelSW, *toiR);
toolPanelNotebook->append_page (*metadataPanel, *toiM);
toolPanelNotebook->append_page (*exposurePanelSW, *toiE);
toolPanelNotebook->append_page (*detailsPanelSW, *toiD);
toolPanelNotebook->append_page (*colorPanelSW, *toiC);
toolPanelNotebook->append_page (*waveletPanelSW, *toiW);
toolPanelNotebook->append_page (*transformPanelSW, *toiT);
toolPanelNotebook->append_page (*rawPanelSW, *toiR);
toolPanelNotebook->append_page (*metadataPanel, *toiM);
toolPanelNotebook->set_current_page (0);
toolPanelNotebook->set_scrollable ();
toolPanelNotebook->show_all ();
for (size_t i=0; i<toolPanels.size(); i++)
for (size_t i = 0; i < toolPanels.size(); i++) {
toolPanels[i]->setListener (this);
}
whitebalance->setWBProvider (this);
whitebalance->setSpotWBListener (this);
@@ -236,7 +284,8 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) {
toolBar->setToolBarListener(this);
}
void ToolPanelCoordinator::addPanel (Gtk::Box* where, FoldableToolPanel* panel) {
void ToolPanelCoordinator::addPanel (Gtk::Box* where, FoldableToolPanel* panel)
{
// no more separator!
/*if (where->children().size()) {
@@ -251,7 +300,8 @@ void ToolPanelCoordinator::addPanel (Gtk::Box* where, FoldableToolPanel* panel)
where->pack_start(*panel->getExpander(), false, false);
}
ToolPanelCoordinator::~ToolPanelCoordinator () {
ToolPanelCoordinator::~ToolPanelCoordinator ()
{
closeImage ();
@@ -259,41 +309,43 @@ ToolPanelCoordinator::~ToolPanelCoordinator () {
delete toolBar;
}
void ToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const Glib::ustring& descr) {
void ToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const Glib::ustring& descr)
{
if (!ipc) return;
if (!ipc) {
return;
}
int changeFlags=refreshmap[(int)event];
int changeFlags = refreshmap[(int)event];
ProcParams* params = ipc->beginUpdateParams ();
for (size_t i=0; i<toolPanels.size(); i++)
for (size_t i = 0; i < toolPanels.size(); i++) {
toolPanels[i]->write (params);
}
// Compensate rotation on flip
if (event==rtengine::EvCTHFlip || event==rtengine::EvCTVFlip) {
if (fabs(params->rotate.degree)>0.001) {
params->rotate.degree *= -1;
if (event == rtengine::EvCTHFlip || event == rtengine::EvCTVFlip) {
if (fabs(params->rotate.degree) > 0.001) {
params->rotate.degree *= -1;
changeFlags |= refreshmap[(int)rtengine::EvROTDegree];
rotate->read (params);
}
}
// some transformations make the crop change for convenience
if (event==rtengine::EvCTHFlip) {
if (event == rtengine::EvCTHFlip) {
crop->hFlipCrop ();
crop->write (params);
}
else if (event==rtengine::EvCTVFlip) {
} else if (event == rtengine::EvCTVFlip) {
crop->vFlipCrop ();
crop->write (params);
}
else if (event==rtengine::EvCTRotate) {
} else if (event == rtengine::EvCTRotate) {
crop->rotateCrop (params->coarse.rotate, params->coarse.hflip, params->coarse.vflip);
crop->write (params);
resize->update (params->crop.enabled, params->crop.w, params->crop.h, ipc->getFullWidth(), ipc->getFullHeight());
resize->write (params);
}
else if (event==rtengine::EvCrop) {
} else if (event == rtengine::EvCrop) {
resize->update (params->crop.enabled, params->crop.w, params->crop.h);
resize->write (params);
}
@@ -302,15 +354,20 @@ void ToolPanelCoordinator::panelChanged (rtengine::ProcEvent event, const Glib::
hasChanged = true;
for (size_t i=0; i<paramcListeners.size(); i++)
for (size_t i = 0; i < paramcListeners.size(); i++) {
paramcListeners[i]->procParamsChanged (params, event, descr);
}
}
void ToolPanelCoordinator::profileChange (const PartialProfile *nparams, rtengine::ProcEvent event, const Glib::ustring& descr, const ParamsEdited* paramsEdited) {
void ToolPanelCoordinator::profileChange (const PartialProfile *nparams, rtengine::ProcEvent event, const Glib::ustring& descr, const ParamsEdited* paramsEdited)
{
int fw, fh, tr;
int fw, fh, tr;
if (!ipc) {
return;
}
if (!ipc) return;
ProcParams *params = ipc->beginUpdateParams ();
ProcParams *mergedParams = new ProcParams();
@@ -327,11 +384,13 @@ void ToolPanelCoordinator::profileChange (const PartialProfile *nparams, rtengi
nparams->applyTo(mergedParams);
// Derive the effective changes, if it's a profile change, to prevent slow RAW rerendering if not necessary
bool filterRawRefresh=false;
if (event!=rtengine::EvPhotoLoaded) {
bool filterRawRefresh = false;
if (event != rtengine::EvPhotoLoaded) {
ParamsEdited pe(true);
std::vector<rtengine::procparams::ProcParams> lParams(2);
lParams[0]=*params; lParams[1]=*mergedParams;
lParams[0] = *params;
lParams[1] = *mergedParams;
pe.initFrom (lParams);
filterRawRefresh = pe.raw.isUnchanged() && pe.lensProf.isUnchanged();
@@ -341,9 +400,18 @@ void ToolPanelCoordinator::profileChange (const PartialProfile *nparams, rtengi
delete mergedParams;
tr = TR_NONE;
if (params->coarse.rotate==90) tr |= TR_R90;
if (params->coarse.rotate==180) tr |= TR_R180;
if (params->coarse.rotate==270) tr |= TR_R270;
if (params->coarse.rotate == 90) {
tr |= TR_R90;
}
if (params->coarse.rotate == 180) {
tr |= TR_R180;
}
if (params->coarse.rotate == 270) {
tr |= TR_R270;
}
// trimming overflowing cropped area
rtengine::ImageSource *ii = (rtengine::ImageSource*)ipc->getInitialImage();
@@ -351,44 +419,52 @@ void ToolPanelCoordinator::profileChange (const PartialProfile *nparams, rtengi
crop->trim(params, fw, fh);
// updating the GUI with updated values
for (unsigned int i=0; i<toolPanels.size(); i++) {
for (unsigned int i = 0; i < toolPanels.size(); i++) {
toolPanels[i]->read (params);
if (event==rtengine::EvPhotoLoaded || event==rtengine::EvProfileChanged)
if (event == rtengine::EvPhotoLoaded || event == rtengine::EvProfileChanged) {
toolPanels[i]->autoOpenCurve();
}
}
// start the IPC processing
if (filterRawRefresh) {
ipc->endUpdateParams ( refreshmap[(int)event] & ALLNORAW );
} else
ipc->endUpdateParams (event);
} else {
ipc->endUpdateParams (event);
}
hasChanged = event != rtengine::EvProfileChangeNotification;
for (size_t i=0; i<paramcListeners.size(); i++)
for (size_t i = 0; i < paramcListeners.size(); i++) {
paramcListeners[i]->procParamsChanged (params, event, descr);
}
}
void ToolPanelCoordinator::setDefaults (ProcParams* defparams) {
void ToolPanelCoordinator::setDefaults (ProcParams* defparams)
{
if (defparams)
for (size_t i=0; i<toolPanels.size(); i++)
for (size_t i = 0; i < toolPanels.size(); i++) {
toolPanels[i]->setDefaults (defparams);
}
}
CropGUIListener* ToolPanelCoordinator::getCropGUIListener () {
CropGUIListener* ToolPanelCoordinator::getCropGUIListener ()
{
return crop;
}
void ToolPanelCoordinator::initImage (rtengine::StagedImageProcessor* ipc_, bool raw) {
void ToolPanelCoordinator::initImage (rtengine::StagedImageProcessor* ipc_, bool raw)
{
ipc = ipc_;
toneCurve->disableListener ();
toneCurve->enableAll ();
toneCurve->enableListener ();
const rtengine::ImageMetaData* pMetaData=ipc->getInitialImage()->getMetaData();
const rtengine::ImageMetaData* pMetaData = ipc->getInitialImage()->getMetaData();
exifpanel->setImageData (pMetaData);
iptcpanel->setImageData (pMetaData);
@@ -403,17 +479,19 @@ void ToolPanelCoordinator::initImage (rtengine::StagedImageProcessor* ipc_, bool
ipc->setSizeListener (crop);
ipc->setSizeListener (resize);
}
flatfield->setShortcutPath(Glib::path_get_dirname(ipc->getInitialImage()->getFileName()));
icm->setRawMeta (raw, (const rtengine::ImageData*)pMetaData);
lensProf->setRawMeta (raw, pMetaData);
icm->setRawMeta (raw, (const rtengine::ImageData*)pMetaData);
lensProf->setRawMeta (raw, pMetaData);
toneCurve->setRaw (raw);
hasChanged = true;
}
void ToolPanelCoordinator::closeImage () {
void ToolPanelCoordinator::closeImage ()
{
if (ipc) {
ipc->stopProcessing ();
@@ -421,81 +499,102 @@ void ToolPanelCoordinator::closeImage () {
}
}
void ToolPanelCoordinator::closeAllTools() {
void ToolPanelCoordinator::closeAllTools()
{
for (size_t i=0; i<options.tpOpen.size(); i++)
if (i<expList.size())
for (size_t i = 0; i < options.tpOpen.size(); i++)
if (i < expList.size()) {
expList.at(i)->set_expanded (false);
}
}
void ToolPanelCoordinator::openAllTools() {
void ToolPanelCoordinator::openAllTools()
{
for (size_t i=0; i<options.tpOpen.size(); i++)
if (i<expList.size())
for (size_t i = 0; i < options.tpOpen.size(); i++)
if (i < expList.size()) {
expList.at(i)->set_expanded (true);
}
}
void ToolPanelCoordinator::updateToolState() {
void ToolPanelCoordinator::updateToolState()
{
for (size_t i=0; i<options.tpOpen.size(); i++)
if (i<expList.size())
for (size_t i = 0; i < options.tpOpen.size(); i++)
if (i < expList.size()) {
expList.at(i)->set_expanded (options.tpOpen.at(i));
}
if(options.tpOpen.size()>expList.size()) {
if(options.tpOpen.size() > expList.size()) {
size_t sizeWavelet = options.tpOpen.size() - expList.size();
std::vector<int> temp;
for (size_t i=0; i<sizeWavelet; i++)
temp.push_back(options.tpOpen.at(i+expList.size()));
for (size_t i = 0; i < sizeWavelet; i++) {
temp.push_back(options.tpOpen.at(i + expList.size()));
}
wavelet->updateToolState(temp);
wavelet->setExpanded(true);
}
}
void ToolPanelCoordinator::readOptions () {
void ToolPanelCoordinator::readOptions ()
{
crop->readOptions ();
}
void ToolPanelCoordinator::writeOptions () {
void ToolPanelCoordinator::writeOptions ()
{
crop->writeOptions ();
crop->writeOptions ();
options.tpOpen.clear ();
for (size_t i=0; i<expList.size(); i++)
for (size_t i = 0; i < expList.size(); i++) {
options.tpOpen.push_back (expList.at(i)->get_expanded ());
}
wavelet->writeOptions(options.tpOpen);
}
void ToolPanelCoordinator::cropSelectionReady () {
void ToolPanelCoordinator::cropSelectionReady ()
{
toolBar->setTool (TMHand);
toolBar->setTool (TMHand);
if (!ipc)
return;
}
void ToolPanelCoordinator::rotateSelectionReady (double rotate_deg, Thumbnail* thm) {
toolBar->setTool (TMHand);
if (!ipc)
return;
if (rotate_deg!=0.0)
rotate->straighten (rotate_deg);
}
void ToolPanelCoordinator::spotWBselected (int x, int y, Thumbnail* thm) {
if (!ipc)
if (!ipc) {
return;
}
}
void ToolPanelCoordinator::rotateSelectionReady (double rotate_deg, Thumbnail* thm)
{
toolBar->setTool (TMHand);
if (!ipc) {
return;
}
if (rotate_deg != 0.0) {
rotate->straighten (rotate_deg);
}
}
void ToolPanelCoordinator::spotWBselected (int x, int y, Thumbnail* thm)
{
if (!ipc) {
return;
}
// toolBar->setTool (TOOL_HAND);
int rect=whitebalance->getSize ();
int ww= ipc->getFullWidth();
int hh= ipc->getFullHeight();
if (x-rect>0 && y-rect>0 && x+rect<ww && y+rect<hh) {
int rect = whitebalance->getSize ();
int ww = ipc->getFullWidth();
int hh = ipc->getFullHeight();
if (x - rect > 0 && y - rect > 0 && x + rect < ww && y + rect < hh) {
double temp;
double green;
ipc->getSpotWB (x, y, rect, temp, green);
@@ -506,11 +605,13 @@ void ToolPanelCoordinator::spotWBselected (int x, int y, Thumbnail* thm) {
void ToolPanelCoordinator::autoCropRequested () {
void ToolPanelCoordinator::autoCropRequested ()
{
if (!ipc)
if (!ipc) {
return;
}
int x1, y1, x2, y2, w, h;
ipc->getAutoCrop (crop->getRatio(), x1, y1, w, h);
x2 = x1 + w - 1;
@@ -522,153 +623,186 @@ void ToolPanelCoordinator::autoCropRequested () {
rtengine::RawImage* ToolPanelCoordinator::getDF()
{
if (!ipc)
if (!ipc) {
return NULL;
const rtengine::ImageMetaData *imd = ipc->getInitialImage()->getMetaData();
if(imd){
int iso = imd->getISOSpeed();
double shutter = imd->getShutterSpeed();
std::string maker( imd->getMake() );
std::string model( imd->getModel() );
time_t timestamp = imd->getDateTimeAsTS();
return rtengine::dfm.searchDarkFrame( maker,model,iso,shutter, timestamp);
}
const rtengine::ImageMetaData *imd = ipc->getInitialImage()->getMetaData();
if(imd) {
int iso = imd->getISOSpeed();
double shutter = imd->getShutterSpeed();
std::string maker( imd->getMake() );
std::string model( imd->getModel() );
time_t timestamp = imd->getDateTimeAsTS();
return rtengine::dfm.searchDarkFrame( maker, model, iso, shutter, timestamp);
}
return NULL;
}
rtengine::RawImage* ToolPanelCoordinator::getFF()
{
if (!ipc)
if (!ipc) {
return NULL;
const rtengine::ImageMetaData *imd = ipc->getInitialImage()->getMetaData();
if(imd){
// int iso = imd->getISOSpeed(); temporarilly removed because unused
// double shutter = imd->getShutterSpeed(); temporarilly removed because unused
double aperture = imd->getFNumber();
double focallength = imd->getFocalLen();
std::string maker( imd->getMake() );
std::string model( imd->getModel() );
std::string lens( imd->getLens() );
time_t timestamp = imd->getDateTimeAsTS();
return rtengine::ffm.searchFlatField( maker,model,lens,focallength,aperture,timestamp);
}
const rtengine::ImageMetaData *imd = ipc->getInitialImage()->getMetaData();
if(imd) {
// int iso = imd->getISOSpeed(); temporarilly removed because unused
// double shutter = imd->getShutterSpeed(); temporarilly removed because unused
double aperture = imd->getFNumber();
double focallength = imd->getFocalLen();
std::string maker( imd->getMake() );
std::string model( imd->getModel() );
std::string lens( imd->getLens() );
time_t timestamp = imd->getDateTimeAsTS();
return rtengine::ffm.searchFlatField( maker, model, lens, focallength, aperture, timestamp);
}
return NULL;
}
Glib::ustring ToolPanelCoordinator::GetCurrentImageFilePath()
{
if (!ipc){
if (!ipc) {
return "";
}
return ipc->getInitialImage()->getFileName();
}
void ToolPanelCoordinator::straightenRequested () {
void ToolPanelCoordinator::straightenRequested ()
{
if (!ipc)
if (!ipc) {
return;
}
toolBar->setTool (TMStraighten);
}
double ToolPanelCoordinator::autoDistorRequested () {
if (!ipc)
double ToolPanelCoordinator::autoDistorRequested ()
{
if (!ipc) {
return 0.0;
}
return rtengine::ImProcFunctions::getAutoDistor (ipc->getInitialImage()->getFileName(), 400);
}
void ToolPanelCoordinator::spotWBRequested (int size) {
void ToolPanelCoordinator::spotWBRequested (int size)
{
if (!ipc)
if (!ipc) {
return;
}
toolBar->setTool (TMSpotWB);
}
void ToolPanelCoordinator::cropSelectRequested () {
void ToolPanelCoordinator::cropSelectRequested ()
{
if (!ipc)
if (!ipc) {
return;
}
toolBar->setTool (TMCropSelect);
}
void ToolPanelCoordinator::saveInputICCReference (Glib::ustring fname, bool apply_wb) {
void ToolPanelCoordinator::saveInputICCReference (Glib::ustring fname, bool apply_wb)
{
if (ipc)
if (ipc) {
ipc->saveInputICCReference (fname, apply_wb);
}
}
int ToolPanelCoordinator::getSpotWBRectSize () {
int ToolPanelCoordinator::getSpotWBRectSize ()
{
return whitebalance->getSize ();
}
void ToolPanelCoordinator::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve, /*LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma) {
colorappearance->updateCurveBackgroundHistogram (histToneCurve, histLCurve, histCCurve, /*histCLurve, histLLCurve,*/ histLCAM, histCCAM,histRed, histGreen, histBlue, histLuma);
toneCurve->updateCurveBackgroundHistogram (histToneCurve, histLCurve,histCCurve,/* histCLurve, histLLCurve,*/ histLCAM, histCCAM,histRed, histGreen, histBlue, histLuma);
lcurve->updateCurveBackgroundHistogram (histToneCurve, histLCurve, histCCurve, /*histCLurve, histLLCurve,*/ histLCAM, histCCAM,histRed, histGreen, histBlue, histLuma);
rgbcurves->updateCurveBackgroundHistogram(histToneCurve, histLCurve, histCCurve,/* histCLurve, histLLCurve, */histLCAM, histCCAM,histRed,histGreen, histBlue, histLuma);
void ToolPanelCoordinator::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve, /*LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma)
{
colorappearance->updateCurveBackgroundHistogram (histToneCurve, histLCurve, histCCurve, /*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma);
toneCurve->updateCurveBackgroundHistogram (histToneCurve, histLCurve, histCCurve,/* histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma);
lcurve->updateCurveBackgroundHistogram (histToneCurve, histLCurve, histCCurve, /*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma);
rgbcurves->updateCurveBackgroundHistogram(histToneCurve, histLCurve, histCCurve,/* histCLurve, histLLCurve, */histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma);
}
void ToolPanelCoordinator::foldAllButOne (Gtk::Box* parent, FoldableToolPanel* openedSection) {
void ToolPanelCoordinator::foldAllButOne (Gtk::Box* parent, FoldableToolPanel* openedSection)
{
for (size_t i=0; i<toolPanels.size(); i++) {
for (size_t i = 0; i < toolPanels.size(); i++) {
if (toolPanels[i]->getParent() != NULL) {
ToolPanel* currentTP = toolPanels[i];
if (currentTP->getParent() == parent) {
// Section in the same tab, we unfold it if it's not the one that has been clicked
if (currentTP != openedSection) {
currentTP->setExpanded(false);
}
else {
if (!currentTP->getExpanded())
} else {
if (!currentTP->getExpanded()) {
currentTP->setExpanded(true);
}
}
}
}
}
}
bool ToolPanelCoordinator::handleShortcutKey (GdkEventKey* event) {
bool ToolPanelCoordinator::handleShortcutKey (GdkEventKey* event)
{
//bool ctrl = event->state & GDK_CONTROL_MASK; temporarily removed because unused
//bool shift = event->state & GDK_SHIFT_MASK; temporarily removed because unused
bool alt = event->state & GDK_MOD1_MASK;
if (alt){
switch(event->keyval) {
case GDK_e:
toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*exposurePanelSW));
return true;
case GDK_d:
toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*detailsPanelSW));
return true;
case GDK_c:
toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*colorPanelSW));
return true;
case GDK_t:
toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*transformPanelSW));
return true;
case GDK_r:
toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*rawPanelSW));
return true;
case GDK_w:
toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*waveletPanelSW));
return true;
case GDK_m:
if (metadataPanel){
toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*metadataPanel));
return true;
}
}
if (alt) {
switch(event->keyval) {
case GDK_e:
toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*exposurePanelSW));
return true;
case GDK_d:
toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*detailsPanelSW));
return true;
case GDK_c:
toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*colorPanelSW));
return true;
case GDK_t:
toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*transformPanelSW));
return true;
case GDK_r:
toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*rawPanelSW));
return true;
case GDK_w:
toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*waveletPanelSW));
return true;
case GDK_m:
if (metadataPanel) {
toolPanelNotebook->set_current_page (toolPanelNotebook->page_num(*metadataPanel));
return true;
}
}
}
return false;
}
void ToolPanelCoordinator::updateVScrollbars (bool hide) {
void ToolPanelCoordinator::updateVScrollbars (bool hide)
{
GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected
Gtk::PolicyType policy = hide ? Gtk::POLICY_NEVER : Gtk::POLICY_AUTOMATIC;
exposurePanelSW->set_policy (Gtk::POLICY_AUTOMATIC, policy);
@@ -679,7 +813,8 @@ void ToolPanelCoordinator::updateVScrollbars (bool hide) {
waveletPanelSW->set_policy (Gtk::POLICY_AUTOMATIC, policy);
}
void ToolPanelCoordinator::updateTabsHeader (bool useIcons) {
void ToolPanelCoordinator::updateTabsHeader (bool useIcons)
{
GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected
TOITypes type = useIcons ? TOI_ICON : TOI_TEXT;
@@ -688,52 +823,66 @@ void ToolPanelCoordinator::updateTabsHeader (bool useIcons) {
toiC->switchTo(type);
toiT->switchTo(type);
toiR->switchTo(type);
if (toiM)
if (toiM) {
toiM->switchTo(type);
}
}
void ToolPanelCoordinator::updateTPVScrollbar (bool hide) {
updateVScrollbars (hide);
void ToolPanelCoordinator::updateTPVScrollbar (bool hide)
{
updateVScrollbars (hide);
}
void ToolPanelCoordinator::updateTabsUsesIcons (bool useIcons) {
updateTabsHeader (useIcons);
void ToolPanelCoordinator::updateTabsUsesIcons (bool useIcons)
{
updateTabsHeader (useIcons);
}
void ToolPanelCoordinator::toolSelected (ToolMode tool) {
void ToolPanelCoordinator::toolSelected (ToolMode tool)
{
GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected
switch (tool) {
case TMCropSelect:
crop->setExpanded(true);
toolPanelNotebook->set_current_page(toolPanelNotebook->page_num(*transformPanelSW));
break;
case TMSpotWB:
whitebalance->setExpanded(true);
toolPanelNotebook->set_current_page(toolPanelNotebook->page_num(*colorPanelSW));
break;
case TMStraighten:
lensgeom->setExpanded(true);
rotate->setExpanded(true);
toolPanelNotebook->set_current_page(toolPanelNotebook->page_num(*transformPanelSW));
break;
default:
break;
}
switch (tool) {
case TMCropSelect:
crop->setExpanded(true);
toolPanelNotebook->set_current_page(toolPanelNotebook->page_num(*transformPanelSW));
break;
case TMSpotWB:
whitebalance->setExpanded(true);
toolPanelNotebook->set_current_page(toolPanelNotebook->page_num(*colorPanelSW));
break;
case TMStraighten:
lensgeom->setExpanded(true);
rotate->setExpanded(true);
toolPanelNotebook->set_current_page(toolPanelNotebook->page_num(*transformPanelSW));
break;
default:
break;
}
}
void ToolPanelCoordinator::editModeSwitchedOff () {
if (editDataProvider) {
editDataProvider->switchOffEditMode();
}
void ToolPanelCoordinator::editModeSwitchedOff ()
{
if (editDataProvider) {
editDataProvider->switchOffEditMode();
}
}
void ToolPanelCoordinator::dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile) {
void ToolPanelCoordinator::dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile)
{
flatfield->setShortcutPath(dirname);
}
void ToolPanelCoordinator::setEditProvider(EditDataProvider *provider) {
editDataProvider = provider;
for (size_t i=0; i<toolPanels.size(); i++)
toolPanels.at(i)->setEditProvider(provider);
void ToolPanelCoordinator::setEditProvider(EditDataProvider *provider)
{
editDataProvider = provider;
for (size_t i = 0; i < toolPanels.size(); i++) {
toolPanels.at(i)->setEditProvider(provider);
}
}