Committing patch from issue 1240: "Partial profile handling"

This commit is contained in:
natureh
2012-02-26 03:23:08 +01:00
parent c21fa69aea
commit dd93fff44c
60 changed files with 2243 additions and 2214 deletions

View File

@@ -19,3 +19,51 @@
#include "clipboard.h"
Clipboard clipboard;
Clipboard::Clipboard () : partProfile (false) {}
Clipboard::~Clipboard () {
partProfile.deleteInstance();
}
/*
* set both the "pparams" and "pedited" field of the PartialProfile; each one can be NULL
*/
void Clipboard::setPartialProfile (const rtengine::procparams::PartialProfile& pprofile) {
if (pprofile.pparams) {
if (!partProfile.pparams) partProfile.pparams = new rtengine::procparams::ProcParams();
*partProfile.pparams = *pprofile.pparams;
}
else {
if (partProfile.pparams) {
delete partProfile.pparams;
partProfile.pparams = NULL;
}
}
if (pprofile.pedited) {
if (!partProfile.pedited) partProfile.pedited = new ParamsEdited();
*partProfile.pedited = *pprofile.pedited;
}
else {
if (partProfile.pedited) {
delete partProfile.pedited;
partProfile.pedited = NULL;
}
}
}
/*
* this method copy the procparams to "pparams" and delete "pedited"
*/
void Clipboard::setProcParams (const rtengine::procparams::ProcParams& pparams) {
// copy procparams
if (!partProfile.pparams) partProfile.pparams = new rtengine::procparams::ProcParams();
*partProfile.pparams = pparams;
// delete pedited
if (partProfile.pedited) {
delete partProfile.pedited;
partProfile.pedited = NULL;
}
}