Solving issue 2326: "Copy/Paste bug" ; The "Fill mode" button (Profile selector) is now extended to the "Load" and "Paste" buttons.

This commit is contained in:
natureh.510
2014-04-06 16:09:54 +02:00
parent 290558f454
commit 40b60bc035
3 changed files with 50 additions and 30 deletions

View File

@@ -46,6 +46,7 @@ class Clipboard {
const rtengine::procparams::PartialProfile& getPartialProfile () { return partProfile; }; const rtengine::procparams::PartialProfile& getPartialProfile () { return partProfile; };
void setProcParams (const rtengine::procparams::ProcParams& pparams); void setProcParams (const rtengine::procparams::ProcParams& pparams);
const rtengine::procparams::ProcParams& getProcParams () { return *partProfile.pparams; } const rtengine::procparams::ProcParams& getProcParams () { return *partProfile.pparams; }
const ParamsEdited& getParamsEdited () { return *partProfile.pedited; }
bool hasProcParams () { return partProfile.pparams; } bool hasProcParams () { return partProfile.pparams; }
bool hasPEdited () { return partProfile.pedited; } bool hasPEdited () { return partProfile.pedited; }

View File

@@ -425,32 +425,35 @@ void ProfilePanel::load_clicked (GdkEventButton* event) {
bool customCreated = false; bool customCreated = false;
if (!custom) { if (!custom) {
custom = new PartialProfile (true); custom = new PartialProfile (true);
custom->set(true);
customCreated = true; customCreated = true;
} }
else if (fillMode->get_active())
custom->pparams->setDefaults();
int err = custom->load (fname); ProcParams pp;
ParamsEdited pe;
int err = pp.load (fname, &pe);
if (!err) { if (!err) {
if (!customCreated && fillMode->get_active())
custom->pparams->setDefaults();
custom->set(true);
bool prevState = changeconn.block(true); bool prevState = changeconn.block(true);
Gtk::TreeIter newEntry = addCustomRow(); Gtk::TreeIter newEntry = addCustomRow();
profiles->set_active (newEntry); profiles->set_active (newEntry);
currRow = profiles->get_active(); currRow = profiles->get_active();
changeconn.block(prevState); changeconn.block(prevState);
if (event->state & Gdk::CONTROL_MASK) { // Now we have procparams initialized to default if fillMode is on
// applying partial profile // and paramsedited initialized to default in all cases
PartialProfile ppTemp(true);
// the 2 next line modify custom->pedited without modifying custom->pparams if (event->state & Gdk::CONTROL_MASK)
partialProfileDlg->applyPaste (ppTemp.pparams, ppTemp.pedited, custom->pparams, custom->pedited); // custom.pparams = loadedFile.pparams filtered by ( loadedFile.pedited & partialPaste.pedited )
if (fillMode->get_active()) partialProfileDlg->applyPaste (custom->pparams, !fillMode->get_active()?custom->pedited:NULL, &pp, &pe);
*custom->pparams = *ppTemp.pparams; else {
*custom->pedited = *ppTemp.pedited; // custom.pparams = loadedFile.pparams filtered by ( loadedFile.pedited )
ppTemp.deleteInstance(); pe.combine(*custom->pparams, pp, true);
if (!fillMode->get_active())
*custom->pedited = pe;
} }
if (fillMode->get_active())
custom->pedited->set(true);
changeTo (custom, M("PROFILEPANEL_PFILE")); changeTo (custom, M("PROFILEPANEL_PFILE"));
} }
@@ -485,27 +488,43 @@ void ProfilePanel::paste_clicked (GdkEventButton* event) {
if (!custom) { if (!custom) {
custom = new PartialProfile (true); custom = new PartialProfile (true);
custom->pedited->set(true);
profiles->set_active (addCustomRow()); profiles->set_active (addCustomRow());
currRow = profiles->get_active(); currRow = profiles->get_active();
} }
else { else {
if (fillMode->get_active())
custom->pparams->setDefaults();
profiles->set_active(getCustomRow()); profiles->set_active(getCustomRow());
currRow = profiles->get_active(); currRow = profiles->get_active();
} }
custom->pedited->set(true);
ProcParams pp = clipboard.getProcParams ();
*custom->pparams = pp;
changeconn.block(prevState); changeconn.block(prevState);
if (event->state & Gdk::CONTROL_MASK) { // Now we have procparams initialized to default if fillMode is on
// applying partial profile // and paramsedited initialized to default in all cases
PartialProfile ppTemp(true);
// the 2 next line modify custom->pedited without modifying custom->pparams ProcParams pp = clipboard.getProcParams ();
partialProfileDlg->applyPaste (ppTemp.pparams, ppTemp.pedited, custom->pparams, custom->pedited); if (clipboard.hasPEdited()) {
*custom->pedited = *ppTemp.pedited; ParamsEdited pe = clipboard.getParamsEdited();
ppTemp.deleteInstance(); if (event->state & Gdk::CONTROL_MASK)
// custom.pparams = clipboard.pparams filtered by ( clipboard.pedited & partialPaste.pedited )
partialProfileDlg->applyPaste (custom->pparams, !fillMode->get_active()?custom->pedited:NULL, &pp, &pe);
else {
// custom.pparams = clipboard.pparams filtered by ( clipboard.pedited )
pe.combine(*custom->pparams, pp, true);
if (!fillMode->get_active())
*custom->pedited = pe;
}
}
else {
if (event->state & Gdk::CONTROL_MASK)
// custom.pparams = clipboard.pparams filtered by ( partialPaste.pedited )
partialProfileDlg->applyPaste (custom->pparams, NULL, &pp, NULL);
else {
// custom.pparams = clipboard.pparams non filtered
*custom->pparams = pp;
}
} }
changeTo (custom, M("HISTORY_FROMCLIPBOARD")); changeTo (custom, M("HISTORY_FROMCLIPBOARD"));