From 5ea16b2d660c191252474270455af7a3c5822eab Mon Sep 17 00:00:00 2001 From: akl Date: Thu, 21 Nov 2013 18:37:39 +0000 Subject: [PATCH] Fix Undo/Redo of section removing. --- src/HYDROCurveCreator/CurveCreator_Diff.cxx | 3 +- .../CurveCreator_Operation.cxx | 37 +------------------ .../CurveCreator_Operation.hxx | 13 ------- 3 files changed, 3 insertions(+), 50 deletions(-) diff --git a/src/HYDROCurveCreator/CurveCreator_Diff.cxx b/src/HYDROCurveCreator/CurveCreator_Diff.cxx index fba15d13..128deb7c 100644 --- a/src/HYDROCurveCreator/CurveCreator_Diff.cxx +++ b/src/HYDROCurveCreator/CurveCreator_Diff.cxx @@ -525,12 +525,13 @@ bool CurveCreator_Diff::addSectionToUndo const int theIndex, CurveCreator_Operation &theOperation) const { + const std::string aName = theCurve->getSectionName(theIndex); const CurveCreator::Coordinates &aPnts = theCurve->getPoints(theIndex); const CurveCreator::SectionType aType = theCurve->getSectionType(theIndex); const bool isClosed = theCurve->isClosed(theIndex); bool isOK = theOperation.init(CurveCreator_Operation::AddSection, - aPnts, aType, isClosed); + aName, aPnts, aType, isClosed); return isOK; } diff --git a/src/HYDROCurveCreator/CurveCreator_Operation.cxx b/src/HYDROCurveCreator/CurveCreator_Operation.cxx index fa9cdb07..0d2bb484 100644 --- a/src/HYDROCurveCreator/CurveCreator_Operation.cxx +++ b/src/HYDROCurveCreator/CurveCreator_Operation.cxx @@ -173,41 +173,6 @@ bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType, return isOK; } -//======================================================================= -// function: Constructor -// purpose: -//======================================================================= -bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType, - const CurveCreator::Coordinates &theCoords, - const int theIntParam1, - const int theIntParam2) -{ - bool isOK = false; - - if (theType == CurveCreator_Operation::AddSection) { - const int aNbCoords = theCoords.size(); - const size_t aSize = - 3*sizeof(theIntParam1) + aNbCoords*sizeof(CurveCreator::TypeCoord); - int *pIntData = (int *)allocate(aSize); - - *pIntData++ = theIntParam1; - *pIntData++ = theIntParam2; - *pIntData++ = aNbCoords; - - CurveCreator::TypeCoord *pRealData = (CurveCreator::TypeCoord *)pIntData; - int i = 0; - - for (; i < aNbCoords; i++) { - *pRealData++ = theCoords[i]; - } - - myType = theType; - isOK = true; - } - - return isOK; -} - //======================================================================= // function: Constructor // purpose: @@ -239,7 +204,7 @@ bool CurveCreator_Operation::init(const CurveCreator_Operation::Type theType, pIntData = (int*)aStrPtr; *pIntData++ = aNbCoords; - CurveCreator::TypeCoord *pRealData = (CurveCreator::TypeCoord *)aStrPtr; + CurveCreator::TypeCoord *pRealData = (CurveCreator::TypeCoord *)pIntData; int i = 0; for (; i < aNbCoords; i++) { diff --git a/src/HYDROCurveCreator/CurveCreator_Operation.hxx b/src/HYDROCurveCreator/CurveCreator_Operation.hxx index be8ceef6..1b83cd51 100644 --- a/src/HYDROCurveCreator/CurveCreator_Operation.hxx +++ b/src/HYDROCurveCreator/CurveCreator_Operation.hxx @@ -142,19 +142,6 @@ public: bool init(const Type theType, const CurveCreator::Coordinates &theCoords, const int theIntParam); - /** - * This method initializes the object with an operation with one - * CurveCreator::Coordinates parameter and two integer parameters. - * It is applicable to the following operations: - * - * @return true in case of success; false otherwise. - */ - bool init(const Type theType, const CurveCreator::Coordinates &theCoords, - const int theIntParam1, const int theIntParam2); /** * This method initializes the object with an operation with * list of pairs of integer parameters and CurveCreator::Coordinates parameters. -- 2.39.2