From 40b60bc03570ab41e5b34ed39b1c4bd33ef8bc97 Mon Sep 17 00:00:00 2001 From: "natureh.510" Date: Sun, 6 Apr 2014 16:09:54 +0200 Subject: [PATCH] Solving issue 2326: "Copy/Paste bug" ; The "Fill mode" button (Profile selector) is now extended to the "Load" and "Paste" buttons. --- rtgui/clipboard.h | 1 + rtgui/partialpastedlg.cc | 8 ++--- rtgui/profilepanel.cc | 71 +++++++++++++++++++++++++--------------- 3 files changed, 50 insertions(+), 30 deletions(-) diff --git a/rtgui/clipboard.h b/rtgui/clipboard.h index 0b3054bad..4934cdf81 100644 --- a/rtgui/clipboard.h +++ b/rtgui/clipboard.h @@ -46,6 +46,7 @@ class Clipboard { const rtengine::procparams::PartialProfile& getPartialProfile () { return partProfile; }; void setProcParams (const rtengine::procparams::ProcParams& pparams); const rtengine::procparams::ProcParams& getProcParams () { return *partProfile.pparams; } + const ParamsEdited& getParamsEdited () { return *partProfile.pedited; } bool hasProcParams () { return partProfile.pparams; } bool hasPEdited () { return partProfile.pedited; } diff --git a/rtgui/partialpastedlg.cc b/rtgui/partialpastedlg.cc index 25e0bcf76..2887cfd94 100644 --- a/rtgui/partialpastedlg.cc +++ b/rtgui/partialpastedlg.cc @@ -624,8 +624,8 @@ void PartialPasteDlg::applyPaste (rtengine::procparams::ProcParams* dstPP, Param if (!vibrance->get_active ()) filterPE.vibrance = falsePE.vibrance; if (!chmixer->get_active ()) filterPE.chmixer = falsePE.chmixer; - if (!blackwhite->get_active ()) filterPE.blackwhite = falsePE.blackwhite; - if (!hsveq->get_active ()) filterPE.hsvequalizer = falsePE.hsvequalizer; + if (!blackwhite->get_active ()) filterPE.blackwhite = falsePE.blackwhite; + if (!hsveq->get_active ()) filterPE.hsvequalizer = falsePE.hsvequalizer; if (!rgbcurves->get_active ()) filterPE.rgbCurves = falsePE.rgbCurves; if (!icm->get_active ()) filterPE.icm = falsePE.icm; @@ -649,8 +649,8 @@ void PartialPasteDlg::applyPaste (rtengine::procparams::ProcParams* dstPP, Param if (!raw_ccSteps->get_active ()) filterPE.raw.ccSteps = falsePE.raw.ccSteps; if (!raw_dcb_iterations->get_active ()) filterPE.raw.dcbIterations = falsePE.raw.dcbIterations; if (!raw_dcb_enhance->get_active ()) filterPE.raw.dcbEnhance = falsePE.raw.dcbEnhance; - //if (!raw_all_enhance->get_active ()) filterPE.raw.allEnhance = falsePE.raw.allEnhance; - if (!raw_lmmse_iterations->get_active ()) filterPE.raw.lmmseIterations = falsePE.raw.lmmseIterations; + //if (!raw_all_enhance->get_active ()) filterPE.raw.allEnhance = falsePE.raw.allEnhance; + if (!raw_lmmse_iterations->get_active ()) filterPE.raw.lmmseIterations = falsePE.raw.lmmseIterations; if (!raw_expos->get_active ()) filterPE.raw.exPos = falsePE.raw.exPos; if (!raw_preser->get_active ()) filterPE.raw.exPreser = falsePE.raw.exPreser; diff --git a/rtgui/profilepanel.cc b/rtgui/profilepanel.cc index 1f433f174..70991e121 100644 --- a/rtgui/profilepanel.cc +++ b/rtgui/profilepanel.cc @@ -425,32 +425,35 @@ void ProfilePanel::load_clicked (GdkEventButton* event) { bool customCreated = false; if (!custom) { custom = new PartialProfile (true); - custom->set(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 (!customCreated && fillMode->get_active()) + custom->pparams->setDefaults(); + custom->set(true); + bool prevState = changeconn.block(true); Gtk::TreeIter newEntry = addCustomRow(); profiles->set_active (newEntry); currRow = profiles->get_active(); changeconn.block(prevState); - if (event->state & Gdk::CONTROL_MASK) { - // applying partial profile - PartialProfile ppTemp(true); - // the 2 next line modify custom->pedited without modifying custom->pparams - partialProfileDlg->applyPaste (ppTemp.pparams, ppTemp.pedited, custom->pparams, custom->pedited); - if (fillMode->get_active()) - *custom->pparams = *ppTemp.pparams; - *custom->pedited = *ppTemp.pedited; - ppTemp.deleteInstance(); + // Now we have procparams initialized to default if fillMode is on + // and paramsedited initialized to default in all cases + + if (event->state & Gdk::CONTROL_MASK) + // custom.pparams = loadedFile.pparams filtered by ( loadedFile.pedited & partialPaste.pedited ) + partialProfileDlg->applyPaste (custom->pparams, !fillMode->get_active()?custom->pedited:NULL, &pp, &pe); + else { + // custom.pparams = loadedFile.pparams filtered by ( loadedFile.pedited ) + 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")); } @@ -485,27 +488,43 @@ void ProfilePanel::paste_clicked (GdkEventButton* event) { if (!custom) { custom = new PartialProfile (true); - custom->pedited->set(true); profiles->set_active (addCustomRow()); currRow = profiles->get_active(); } else { + if (fillMode->get_active()) + custom->pparams->setDefaults(); profiles->set_active(getCustomRow()); currRow = profiles->get_active(); } - - ProcParams pp = clipboard.getProcParams (); - *custom->pparams = pp; + custom->pedited->set(true); changeconn.block(prevState); - if (event->state & Gdk::CONTROL_MASK) { - // applying partial profile - PartialProfile ppTemp(true); - // the 2 next line modify custom->pedited without modifying custom->pparams - partialProfileDlg->applyPaste (ppTemp.pparams, ppTemp.pedited, custom->pparams, custom->pedited); - *custom->pedited = *ppTemp.pedited; - ppTemp.deleteInstance(); + // Now we have procparams initialized to default if fillMode is on + // and paramsedited initialized to default in all cases + + ProcParams pp = clipboard.getProcParams (); + if (clipboard.hasPEdited()) { + ParamsEdited pe = clipboard.getParamsEdited(); + 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"));