From 2d5ca9ab4332bedb9fc8b193c9f0b4f6d3fa8ce7 Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 18 Dec 2013 05:03:47 +0000 Subject: [PATCH] refs #249 - Undo after Join selected sections operation works not properly --- src/HYDROCurveCreator/CurveCreator_Curve.cxx | 2 +- src/HYDROCurveCreator/CurveCreator_Diff.cxx | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/HYDROCurveCreator/CurveCreator_Curve.cxx b/src/HYDROCurveCreator/CurveCreator_Curve.cxx index a4f9947c..438b4215 100644 --- a/src/HYDROCurveCreator/CurveCreator_Curve.cxx +++ b/src/HYDROCurveCreator/CurveCreator_Curve.cxx @@ -394,7 +394,7 @@ bool CurveCreator_Curve::joinInternal( const int theISectionTo, aSection2->myPoints.begin(), aSection2->myPoints.end()); - res = removeSection(theISectionFrom); + res = removeSectionInternal(theISectionFrom); redisplayCurve(); return res; } diff --git a/src/HYDROCurveCreator/CurveCreator_Diff.cxx b/src/HYDROCurveCreator/CurveCreator_Diff.cxx index b2cecfd8..797cc68b 100644 --- a/src/HYDROCurveCreator/CurveCreator_Diff.cxx +++ b/src/HYDROCurveCreator/CurveCreator_Diff.cxx @@ -190,8 +190,18 @@ bool CurveCreator_Diff::init(const CurveCreator_Curve *theCurve, setNbUndos(3); } + // Construct undo for RemovePoints command. + int anISection = theIntParam1; + const int aNbPoints2 = theCurve->getNbPoints(theIntParam2); + CurveCreator_ICurve::SectionToPointList aSectionToPointList; + int aJoinedSize = aNbPoints + aNbPoints2; + for (int anIPoint = aNbPoints; anIPoint < aJoinedSize; anIPoint++) + aSectionToPointList.push_back(std::make_pair( anISection, anIPoint ) ); isOK = myPUndo[0].init(CurveCreator_Operation::RemovePoints, - theIntParam1, aNbPoints, -1); + aSectionToPointList); + + //isOK = myPUndo[0].init(CurveCreator_Operation::RemovePoints, + // theIntParam1, aNbPoints, -1); if (isOK) { isOK = addSectionToUndo(theCurve, theIntParam2, myPUndo[1]); -- 2.39.2