From 4745388c8fe673d9220089eb72f054b882c48b21 Mon Sep 17 00:00:00 2001 From: skv Date: Mon, 8 Sep 2014 16:08:00 +0400 Subject: [PATCH] Remove unused files --- src/CurveCreator/CurveCreator_CurveEditor.cxx | 511 ------------------ src/CurveCreator/CurveCreator_CurveEditor.hxx | 166 ------ src/CurveCreator/CurveCreator_ICurve.cxx | 459 ---------------- src/CurveCreator/CurveCreator_Listener.hxx | 41 -- src/CurveCreator/CurveCreator_NewPointDlg.cxx | 196 ------- src/CurveCreator/CurveCreator_NewPointDlg.h | 70 --- src/CurveCreator/CurveCreator_UndoOptsDlg.cxx | 237 -------- src/CurveCreator/CurveCreator_UndoOptsDlg.h | 73 --- 8 files changed, 1753 deletions(-) delete mode 100644 src/CurveCreator/CurveCreator_CurveEditor.cxx delete mode 100644 src/CurveCreator/CurveCreator_CurveEditor.hxx delete mode 100644 src/CurveCreator/CurveCreator_ICurve.cxx delete mode 100755 src/CurveCreator/CurveCreator_Listener.hxx delete mode 100755 src/CurveCreator/CurveCreator_NewPointDlg.cxx delete mode 100755 src/CurveCreator/CurveCreator_NewPointDlg.h delete mode 100644 src/CurveCreator/CurveCreator_UndoOptsDlg.cxx delete mode 100644 src/CurveCreator/CurveCreator_UndoOptsDlg.h diff --git a/src/CurveCreator/CurveCreator_CurveEditor.cxx b/src/CurveCreator/CurveCreator_CurveEditor.cxx deleted file mode 100644 index 559eabd5a..000000000 --- a/src/CurveCreator/CurveCreator_CurveEditor.cxx +++ /dev/null @@ -1,511 +0,0 @@ -// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -// File: CurveCreator_CurveEditor.cxx -// Author: Sergey KHROMOV - -#include "CurveCreator_CurveEditor.hxx" - -//======================================================================= -// function: Constructor -// purpose: -//======================================================================= -CurveCreator_CurveEditor::CurveCreator_CurveEditor - (CurveCreator_Curve* thePCurve) - : myNbUndos (0), - myNbRedos (0), - myPCurve (thePCurve), - myUndoDepth (-1), - myOpLevel(0) -{ - if (myPCurve != NULL) { - if (myPCurve->isLocked()) { - // This curve is locked by another editor. Invalid case. - myPCurve = NULL; - } else { - // Lock the curve. - myPCurve->myIsLocked = true; - myCurrenPos = myListDiffs.end(); - } - } -} - -//======================================================================= -// function: Destructor -// purpose: -//======================================================================= -CurveCreator_CurveEditor::~CurveCreator_CurveEditor() -{ - if (myPCurve != NULL) { - // Unlock the curve. - myPCurve->myIsLocked = false; - } -} - -//======================================================================= -// function: getCurve -// purpose: -//======================================================================= -CurveCreator_Curve *CurveCreator_CurveEditor::getCurve() const -{ - return myPCurve; -} - -//======================================================================= -// function: isAttached -// purpose: -//======================================================================= -bool CurveCreator_CurveEditor::isAttached() const -{ - return (myPCurve != NULL); -} - -//======================================================================= -// function: undo -// purpose: -//======================================================================= -void CurveCreator_CurveEditor::undo() -{ - if (myNbUndos > 0) { - myNbUndos--; - myNbRedos++; - myCurrenPos--; - myCurrenPos->applyUndo(myPCurve); - } -} - -//======================================================================= -// function: redo -// purpose: -//======================================================================= -void CurveCreator_CurveEditor::redo() -{ - if (myNbRedos > 0) { - myCurrenPos->applyRedo(myPCurve); - myCurrenPos++; - myNbRedos--; - myNbUndos++; - } -} - -//======================================================================= -// function: getNbUndo -// purpose: -//======================================================================= -int CurveCreator_CurveEditor::getNbUndo() const -{ - return myNbUndos; -} - -//======================================================================= -// function: getNbRedo -// purpose: -//======================================================================= -int CurveCreator_CurveEditor::getNbRedo() const -{ - return myNbRedos; -} - -//======================================================================= -// function: setUndoDepth -// purpose: -//======================================================================= -void CurveCreator_CurveEditor::setUndoDepth(const int theDepth) -{ - if (theDepth == 0) { - // Reset all undo/redo data. - myNbUndos = 0; - myNbRedos = 0; - myListDiffs.clear(); - myCurrenPos = myListDiffs.end(); - myUndoDepth = 0; - } else if (theDepth == -1) { - // There is nothing to do as the depth become unlimited. - myUndoDepth = -1; - } else if (theDepth > 0) { - // The new "real" depth is set. - if (theDepth < myNbRedos) { - // The new depth is less then number of redos. Remove the latest redos. - int aShift = (myNbRedos - theDepth); - ListDiff::iterator aFromPos = myListDiffs.end(); - - while (aShift--) { - aFromPos--; - } - - myListDiffs.erase(aFromPos, myListDiffs.end()); - myNbRedos = theDepth; - } - - if (theDepth < myNbUndos + myNbRedos) { - // The new depth is less then the total number of differences. - // Remove the first undos. - int aShift = (myNbUndos + myNbRedos - theDepth); - ListDiff::iterator aToPos = myListDiffs.begin(); - - while (aShift--) { - aToPos++; - } - - myListDiffs.erase(myListDiffs.begin(), aToPos); - myNbUndos = theDepth - myNbRedos; - } - - myUndoDepth = theDepth; - } -} - -//======================================================================= -// function: getUndoDepth -// purpose: -//======================================================================= -int CurveCreator_CurveEditor::getUndoDepth() const -{ - return myUndoDepth; -} - -//======================================================================= -// function: setType -// purpose: -//======================================================================= -void CurveCreator_CurveEditor::setType(const CurveCreator::Type theType, - const int theISection) -{ - if (myPCurve != NULL) { - startOperation(); - // Set the difference. - if (addEmptyDiff()) { - myListDiffs.back().init(myPCurve, CurveCreator_Operation::SetType, - theType, theISection); - } - - // Update the curve. - myPCurve->setType(theType, theISection); - finishOperation(); - } -} - -//======================================================================= -// function: addPoints -// purpose: -//======================================================================= -void CurveCreator_CurveEditor::addPoints - (const CurveCreator::Coordinates &thePoints, - const int theISection) -{ - if (myPCurve != NULL) { - // Set the difference. - startOperation(); - if (addEmptyDiff()) { - myListDiffs.back().init(myPCurve, CurveCreator_Operation::AddPoints, - thePoints, theISection); - } - - // Update the curve. - myPCurve->addPoints(thePoints, theISection); - finishOperation(); - } -} - -//======================================================================= -// function: addSection -// purpose: -//======================================================================= -void CurveCreator_CurveEditor::addSection - (const std::string& theName, const CurveCreator::Type theType, - const bool theIsClosed, - const CurveCreator::Coordinates &thePoints) -{ - if (myPCurve != NULL) { - // Set the difference. - startOperation(); - if (addEmptyDiff()) { - myListDiffs.back().init(myPCurve, CurveCreator_Operation::AddSection, - theName, thePoints, theType, theIsClosed); - } - - // Update the curve. - myPCurve->addSection(theName, theType, theIsClosed, thePoints); - finishOperation(); - } -} - -//======================================================================= -// function: removeSection -// purpose: -//======================================================================= -void CurveCreator_CurveEditor::removeSection(const int theISection) -{ - if (myPCurve != NULL) { - // Set the difference. - startOperation(); - if (addEmptyDiff()) { - myListDiffs.back().init(myPCurve, CurveCreator_Operation::RemoveSection, - theISection); - } - - // Update the curve. - myPCurve->removeSection(theISection); - finishOperation(); - } -} - -//======================================================================= -// function: insertPoints -// purpose: -//======================================================================= -void CurveCreator_CurveEditor::insertPoints - (const CurveCreator::Coordinates &thePoints, - const int theISection, - const int theIPnt) -{ - if (myPCurve != NULL) { - // Set the difference. - startOperation(); - if (addEmptyDiff()) { - myListDiffs.back().init(myPCurve, CurveCreator_Operation::InsertPoints, - thePoints, theISection, theIPnt); - } - - // Update the curve. - myPCurve->insertPoints(thePoints, theISection, theIPnt); - finishOperation(); - } -} - -//======================================================================= -// function: movePoints -// purpose: -//======================================================================= -void CurveCreator_CurveEditor::movePoint(const int theISection, - const int theOrigIPnt, - const int theNewIPnt ) -{ - startOperation(); - myPCurve->movePoint(theISection, theOrigIPnt, theNewIPnt); - finishOperation(); -} - -//======================================================================= -// function: removePoints -// purpose: -//======================================================================= -void CurveCreator_CurveEditor::removePoints - (const int theISection, - const int theIPnt, - const int theNbPoints) -{ - if (myPCurve != NULL) { - // Set the difference. - startOperation(); - if (addEmptyDiff()) { - myListDiffs.back().init(myPCurve, CurveCreator_Operation::RemovePoints, - theISection, theIPnt, theNbPoints); - } - - // Update the curve. - myPCurve->removePoints(theISection, theIPnt, theNbPoints); - finishOperation(); - } -} - -//======================================================================= -// function: clear -// purpose: -//======================================================================= -void CurveCreator_CurveEditor::clear() -{ - if (myPCurve != NULL) { - startOperation(); - // Set the difference. - if (addEmptyDiff()) { - myListDiffs.back().init(myPCurve, CurveCreator_Operation::Clear); - } - - // Update the curve. - myPCurve->clear(); - finishOperation(); - } -} - -//======================================================================= -// function: setCoordinates -// purpose: -//======================================================================= -void CurveCreator_CurveEditor::setCoordinates - (const CurveCreator::Coordinates &theCoords, - const int theISection, - const int theIPnt) -{ - if (myPCurve != NULL) { - // Set the difference. - startOperation(); - if (addEmptyDiff()) { - myListDiffs.back().init(myPCurve, CurveCreator_Operation::SetCoordinates, - theCoords, theISection, theIPnt); - } - - // Update the curve. - myPCurve->setCoordinates(theCoords, theISection, theIPnt); - finishOperation(); - } -} - -//======================================================================= -// function: setClosed -// purpose: -//======================================================================= -void CurveCreator_CurveEditor::setClosed(const bool theIsClosed, - const int theISection) -{ - if (myPCurve != NULL) { - // Set the difference. - startOperation(); - if (addEmptyDiff()) { - myListDiffs.back().init(myPCurve, CurveCreator_Operation::SetClosed, - theIsClosed, theISection); - } - - // Update the curve. - myPCurve->setClosed(theIsClosed, theISection); - finishOperation(); - } -} - -//======================================================================= -// function: setName -// purpose: -//======================================================================= -void CurveCreator_CurveEditor::setName(const std::string& theName, - const int theISection) -{ - if (myPCurve != NULL) { - // Set the difference. - startOperation(); - if (addEmptyDiff()) { - myListDiffs.back().init(myPCurve, CurveCreator_Operation::RenameSection, - theName, theISection); - } - myPCurve->setName( theName, theISection ); - finishOperation(); - } -} - -//======================================================================= -// function: moveSection -// purpose: -//======================================================================= -void CurveCreator_CurveEditor::moveSection(const int theISection, - const int theNewIndex) -{ - if (myPCurve != NULL) { - // Set the difference. - startOperation(); - if (addEmptyDiff()) { - myListDiffs.back().init(myPCurve, CurveCreator_Operation::MoveSection, - theISection, theNewIndex); - } - - // Update the curve. - myPCurve->moveSection(theISection, theNewIndex); - finishOperation(); - } -} - -//======================================================================= -// function: join -// purpose: -//======================================================================= -void CurveCreator_CurveEditor::join(const int theISectionTo, - const int theISectionFrom) -{ - if (myPCurve != NULL) { - // Set the difference. - startOperation(); - if (addEmptyDiff()) { - myListDiffs.back().init(myPCurve, CurveCreator_Operation::Join, - theISectionTo, theISectionFrom); - } - - // Update the curve. - myPCurve->join(theISectionTo, theISectionFrom); - finishOperation(); - } -} - -//======================================================================= -// function: join -// purpose: -//======================================================================= -void CurveCreator_CurveEditor::join() -{ - if (myPCurve != NULL) { - // Set the difference. - startOperation(); - if (addEmptyDiff()) { - myListDiffs.back().init(myPCurve, CurveCreator_Operation::Join); - } - - // Update the curve. - myPCurve->join(); - finishOperation(); - } -} - -//======================================================================= -// function: addDiff -// purpose: -//======================================================================= -bool CurveCreator_CurveEditor::addEmptyDiff() -{ - bool isEnabled = false; - - if (myUndoDepth != 0) { - // Forget all Redos after the current one. - if (myNbRedos > 0) { - myNbRedos = 0; - myListDiffs.erase(myCurrenPos, myListDiffs.end()); - } - - if (myUndoDepth == -1 || myNbUndos < myUndoDepth) { - // Increase the number of undos. - myNbUndos++; - } else { - // If there are too many differences, remove the first one. - myListDiffs.pop_front(); - } - - // Add new difference. - myListDiffs.push_back(CurveCreator_Diff()); - myCurrenPos = myListDiffs.end(); - isEnabled = true; - } - - return isEnabled; -} - -void CurveCreator_CurveEditor::startOperation() -{ - myOpLevel++; -} - -void CurveCreator_CurveEditor::finishOperation() -{ - myOpLevel--; -} diff --git a/src/CurveCreator/CurveCreator_CurveEditor.hxx b/src/CurveCreator/CurveCreator_CurveEditor.hxx deleted file mode 100644 index 32aa00948..000000000 --- a/src/CurveCreator/CurveCreator_CurveEditor.hxx +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -// File: CurveCreator_CurveEditor.hxx -// Author: Sergey KHROMOV - -#ifndef _CurveCreator_CurveEditor_HeaderFile -#define _CurveCreator_CurveEditor_HeaderFile - -#include "CurveCreator_Diff.hxx" -#include "CurveCreator_Curve.hxx" - -#include - -/** - * The CurveCreator_CurveEditor is designed to manage of - * editing operations of CurveCreator_Curve class. - */ -class CURVECREATOR_EXPORT CurveCreator_CurveEditor -{ - -private: - - typedef std::list ListDiff; - -public: - - //! Constuctor, initialized by the curve object - CurveCreator_CurveEditor(CurveCreator_Curve* thePCurve); - - //! Destructor, detaches from the Curve - ~CurveCreator_CurveEditor(); - - //! Returns the curve. - CurveCreator_Curve *getCurve() const; - - //! This method returns true if this editor is attached to a valid curve. - bool isAttached() const; - - //! Undo previous operation - void undo(); - - //! Redo last previously �undoed� operation - void redo(); - - //! Get number of available undo operations - int getNbUndo() const; - - //! Get number of available redo operations - int getNbRedo() const; - - //! Set depth of undo operations (unlimited if \a theDepth is -1 - // or disabled if \a theDepth is 0) - void setUndoDepth(const int theDepth = -1); - - //! Get depth of undo operations. - int getUndoDepth() const; - - /** Set type of the specified section (or all sections - * if \a theISection is -1). - */ - void setType(const CurveCreator::Type theType, const int theISection = -1); - - /** Set section closed (or all sections - * if \a theISection is -1). - */ - void setClosed(const bool theIsClosed, const int theISection); - - /** Set section name (if theISection is invalid it is ignored). - */ - void setName(const std::string& theName, const int theISection); - - /** Add points to the specified section (or last section - * if \a theISection is -1). - */ - void addPoints(const CurveCreator::Coordinates &thePoints, - const int theISection = -1); - - //! Add a new section. - void addSection(const std::string &theName, const CurveCreator::Type theType, - const bool theIsClosed, - const CurveCreator::Coordinates &thePoints); - - //! Removes the section. If theISection equals -1, removes the last section. - void removeSection(const int theISection = -1); - - /** Insert points in the given position (add to the end of list - * if \a theIPnt parameter is -1) of the specified section - * (or last section if \a theISection parameter is -1). - */ - void insertPoints(const CurveCreator::Coordinates &thePoints, - const int theISection = -1, - const int theIPnt = -1); - - /** Remove \a nbPoints points from given \a theISection, - * starting from given \a theIPnt (of all points up to the end of - * section if \a theNbPoints is -1). - */ - void removePoints(const int theISection, - const int theIPnt, - const int theNbPoints = -1); - - /** Mobe point in \a theISection from given position \a theOrigIPnt - * to new position \a theNewIPnt. - */ - void movePoint(const int theISection, - const int theOrigIPnt, - const int theNewIPnt ); - - //! Remove all sections. - void clear(); - - //! Set coordinates of specified point - void setCoordinates(const CurveCreator::Coordinates &theCoords, - const int theISection, - const int theIPnt); - - /** Move specified \a theISection to the specified position - * in the sections list. - */ - void moveSection(const int theISection, const int theNewIndex); - - //! Join two sections to one section - void join(const int theISectionTo, const int theISectionFrom); - - //! Join all sections to the single curve - void join(); - - void startOperation(); - void finishOperation(); -private: - - /** This method updates all undo/redo information required to be updated - * after curve modification operation. It returns false if undo/redo - * is disabled and true otherwise. - */ - bool addEmptyDiff(); - -private: - - int myNbUndos; - int myNbRedos; - ListDiff::iterator myCurrenPos; - ListDiff myListDiffs; - CurveCreator_Curve* myPCurve; - int myUndoDepth; - int myOpLevel; -}; - -#endif diff --git a/src/CurveCreator/CurveCreator_ICurve.cxx b/src/CurveCreator/CurveCreator_ICurve.cxx deleted file mode 100644 index fc73f56e7..000000000 --- a/src/CurveCreator/CurveCreator_ICurve.cxx +++ /dev/null @@ -1,459 +0,0 @@ -// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -// File: CurveCreator_ICurve.cxx -// Author: Sergey KHROMOV - -#include "CurveCreator_ICurve.hxx" -#include "CurveCreator_Section.hxx" -#include "CurveCreator_Listener.hxx" - -#include - -//======================================================================= -// function: Constructor -// purpose: -//======================================================================= -CurveCreator_ICurve::CurveCreator_ICurve - (const CurveCreator::Dimension theDimension) -: myIsLocked (false), - myDimension (theDimension), - myListener(NULL) -{ -} - -//======================================================================= -// function: Destructor -// purpose: -//======================================================================= -CurveCreator_ICurve::~CurveCreator_ICurve() -{ - // Delete all allocated data. - clear(); -} - -//======================================================================= -// function: isLocked -// purpose: -//======================================================================= -bool CurveCreator_ICurve::isLocked() const -{ - return myIsLocked; -} - -//======================================================================= -// function: getDimension -// purpose: -//======================================================================= -CurveCreator::Dimension CurveCreator_ICurve::getDimension() const -{ - return myDimension; -} - -//======================================================================= -// function: getNbPoints -// purpose: -//======================================================================= -int CurveCreator_ICurve::getNbPoints(const int theISection) const -{ - int aNbCoords = 0; - - if (theISection == -1) { - int i = 0; - const int aNbSections = getNbSections(); - - for (; i < aNbSections; i++) { - aNbCoords += mySections[i]->myPoints.size(); - } - } else { - aNbCoords = mySections.at(theISection)->myPoints.size(); - } - - return aNbCoords/myDimension; -} - -//======================================================================= -// function: getNbSections -// purpose: -//======================================================================= -int CurveCreator_ICurve::getNbSections() const -{ - return mySections.size(); -} - -//======================================================================= -// function: getCoordinates -// purpose: -//======================================================================= -CurveCreator::Coordinates CurveCreator_ICurve::getCoordinates - (const int theISection, const int theIPnt) const -{ - CurveCreator_Section *aSection = mySections.at(theISection); - CurveCreator::Coordinates::const_iterator - anIter = aSection->myPoints.begin() + toICoord(theIPnt); - CurveCreator::Coordinates aResult(anIter, anIter + myDimension); - - return aResult; -} - -//======================================================================= -// function: getType -// purpose: -//======================================================================= -CurveCreator::Type CurveCreator_ICurve::getType(const int theISection) const -{ - return mySections.at(theISection)->myType; -} - -//======================================================================= -// function: getPoints -// purpose: -//======================================================================= -const CurveCreator::Coordinates &CurveCreator_ICurve::getPoints - (const int theISection) const -{ - return mySections.at(theISection)->myPoints; -} - -//======================================================================= -// function: isClosed -// purpose: -//======================================================================= -bool CurveCreator_ICurve::isClosed(const int theISection) const -{ - return mySections.at(theISection)->myIsClosed; -} - -std::string CurveCreator_ICurve::getSectionName(const int theISection) const -{ - return mySections.at(theISection)->myName; -} - -//======================================================================= -// function: setType -// purpose: -//======================================================================= -void CurveCreator_ICurve::setType - (const CurveCreator::Type theType, const int theISection) -{ - if (theISection == -1) { - int i = 0; - const int aNbSections = getNbSections(); - - for (; i < aNbSections; i++) { - mySections[i]->myType = theType; - } - if( myListener ) - myListener->curveChanged(); - } else { - if( mySections.at(theISection)->myType != theType ){ - mySections.at(theISection)->myType = theType; - if( myListener ) - myListener->sectionTypeChanged(theISection); - } - } -} - -//======================================================================= -// function: addSection -// purpose: -//======================================================================= -void CurveCreator_ICurve::addSection - (const std::string& theName, - const CurveCreator::Type theType, - const bool theIsClosed, - const CurveCreator::Coordinates &thePoints) -{ - CurveCreator_Section *aSection = new CurveCreator_Section; - - std::string aName = theName; - if( aName.empty() ){ - aName = getUnicSectionName(); - } - aSection->myName = aName; - aSection->myType = theType; - aSection->myIsClosed = theIsClosed; - aSection->myPoints = thePoints; - mySections.push_back(aSection); - if( myListener ) - myListener->sectionAdded( -1 ); -} - -//======================================================================= -// function: removeSection -// purpose: -//======================================================================= -void CurveCreator_ICurve::removeSection(const int theISection) -{ - if (theISection == -1) { - delete mySections.back(); - mySections.pop_back(); - } else { - Sections::iterator anIterRm = mySections.begin() + theISection; - - delete *anIterRm; - mySections.erase(anIterRm); - } - if( myListener ) - myListener->sectionRemoved(theISection); -} - -//======================================================================= -// function: insertPoints -// purpose: -//======================================================================= -void CurveCreator_ICurve::insertPoints - (const CurveCreator::Coordinates &thePoints, - const int theISection, - const int theIPnt) -{ - if (theIPnt == -1) { - // Add points to the end of section points. - addPoints(thePoints, theISection); - } else { - CurveCreator_Section *aSection = - (theISection == -1 ? mySections.back() : mySections.at(theISection)); - - aSection->myPoints.insert(aSection->myPoints.begin() + toICoord(theIPnt), - thePoints.begin(), thePoints.end()); - if( myListener ) - myListener->pointInserted( theISection, theIPnt ); - } -} - -void CurveCreator_ICurve::movePoint(const int theISection, const int theIPointFrom, const int theNewIndex) -{ - CurveCreator::Coordinates aCoords = getCoordinates(theISection, theIPointFrom ); - insertPoints(aCoords, theISection, theNewIndex+1); - int aRemPntIndx = theIPointFrom; - if( theNewIndex < theIPointFrom ) - aRemPntIndx++; - removePoints(theISection, aRemPntIndx, 1 ); -} - -//======================================================================= -// function: removePoints -// purpose: -//======================================================================= -void CurveCreator_ICurve::removePoints(const int theISection, - const int theIPnt, - const int theNbPoints) -{ - CurveCreator_Section *aSection = mySections.at(theISection); - CurveCreator::Coordinates::iterator anIterBegin = - aSection->myPoints.begin() + toICoord(theIPnt); - CurveCreator::Coordinates::iterator anIterEnd = - (theNbPoints == -1 ? - aSection->myPoints.end() : anIterBegin + toICoord(theNbPoints)); - - aSection->myPoints.erase(anIterBegin, anIterEnd); - if( myListener ) - myListener->pointRemoved(theISection, theIPnt, theNbPoints ); -} - -//======================================================================= -// function: clear -// purpose: -//======================================================================= -void CurveCreator_ICurve::clear() -{ - // Delete all allocated data. - int i = 0; - const int aNbSections = getNbSections(); - - for (; i < aNbSections; i++) { - delete mySections[i]; - } - - mySections.clear(); - if( myListener ) - myListener->curveChanged(); -} - -//======================================================================= -// function: setCoordinates -// purpose: -//======================================================================= -void CurveCreator_ICurve::setCoordinates - (const CurveCreator::Coordinates &theCoords, - const int theISection, - const int theIPnt) -{ - if (theCoords.size() == myDimension) { - CurveCreator_Section *aSection = mySections.at(theISection); - int i; - - for (i = 0; i < myDimension; i++) { - aSection->myPoints.at(toICoord(theIPnt) + i) = theCoords[i]; - } - - if( myListener ) - myListener->pointChanged( theISection, theIPnt ); - } -} - -//======================================================================= -// function: setClosed -// purpose: -//======================================================================= -void CurveCreator_ICurve::setClosed(const bool theIsClosed, - const int theISection) -{ - if (theISection == -1) { - int aSize = mySections.size(); - int i; - - for (i = 0; i < aSize; i++) { - mySections[i]->myIsClosed = theIsClosed; - if( myListener ){ - myListener->sectionClosed( theISection, theIsClosed ); - } - } - } else { - mySections.at(theISection)->myIsClosed = theIsClosed; - if( myListener ){ - myListener->sectionClosed( theISection, theIsClosed ); - } - } -} - -/** Set name of the specified section. - */ -void CurveCreator_ICurve::setName( const std::string& theName, const int theISection ) -{ - if( ( theISection >= 0 ) && ( theISection < mySections.size() )){ - mySections.at(theISection)->myName = theName; - } -} - -//======================================================================= -// function: moveSection -// purpose: -//======================================================================= -void CurveCreator_ICurve::moveSection(const int theISection, - const int theNewIndex) -{ - if (theISection != theNewIndex) { - CurveCreator_Section *aSection = mySections.at(theISection); - - // Remove section - Sections::iterator anIter = mySections.begin() + theISection; - - mySections.erase(anIter); - - // Insert section. - anIter = mySections.begin() + theNewIndex; - mySections.insert(anIter, aSection); - } -} - -//======================================================================= -// function: join -// purpose: -//======================================================================= -void CurveCreator_ICurve::join(const int theISectionTo, - const int theISectionFrom) -{ - if (theISectionTo != theISectionFrom) { - CurveCreator_Section *aSection1 = mySections.at(theISectionTo); - CurveCreator_Section *aSection2 = mySections.at(theISectionFrom); - - aSection1->myPoints.insert(aSection1->myPoints.end(), - aSection2->myPoints.begin(), aSection2->myPoints.end()); - - removeSection(theISectionFrom); - if( myListener ) - myListener->curveChanged(); - } -} - -//======================================================================= -// function: join -// purpose: -//======================================================================= -void CurveCreator_ICurve::join() -{ - const int aSize = mySections.size(); - - if (aSize > 1) { - CurveCreator_Section *aSection1 = mySections[0]; - int i; - - for (i = 1; i < aSize; i++) { - CurveCreator_Section *aSection2 = mySections[i]; - - aSection1->myPoints.insert(aSection1->myPoints.end(), - aSection2->myPoints.begin(), aSection2->myPoints.end()); - delete aSection2; - } - - // Just erace section pointers as they were deleted before. - mySections.erase(mySections.begin() + 1, mySections.end()); - if( myListener ) - myListener->curveChanged(); - } -} - -//======================================================================= -// function: toICoord -// purpose: -//======================================================================= -int CurveCreator_ICurve::toICoord(const int theIPnt) const -{ - return theIPnt*myDimension; -} - -//======================================================================= -// function: getUnicSectionName -// purpose: return unic section name -//======================================================================= -std::string CurveCreator_ICurve::getUnicSectionName() -{ - for( int i = 0 ; i < 1000000 ; i++ ){ - char aBuffer[255]; - sprintf( aBuffer, "Section_%d", i+1 ); - std::string aName(aBuffer); - int j; - for( j = 0 ; j < mySections.size() ; j++ ){ - if( mySections[j]->myName == aName ) - break; - } - if( j == mySections.size() ) - return aName; - } - return ""; -} - -//======================================================================= -// function: setListener -// purpose: set curve changes listener -//======================================================================= -void CurveCreator_ICurve::setListener( CurveCreator_Listener* theListener ) -{ - myListener = theListener; -} - -//======================================================================= -// function: setListener -// purpose: set curve changes listener -//======================================================================= -void CurveCreator_ICurve::removeListener() -{ - myListener = NULL; -} diff --git a/src/CurveCreator/CurveCreator_Listener.hxx b/src/CurveCreator/CurveCreator_Listener.hxx deleted file mode 100755 index 4fd4a29fa..000000000 --- a/src/CurveCreator/CurveCreator_Listener.hxx +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef CURVE_CREATOR_LISTENER_HXX -#define CURVE_CREATOR_LISTENER_HXX - -class CurveCreator_Listener -{ -public: - CurveCreator_Listener(void){}; - virtual ~CurveCreator_Listener(void){}; - - virtual void pointChanged( int theSection, int thePoint ){} - virtual void pointRemoved( int theSection, int theFirstPoint, int thePointCnt ){} - virtual void pointInserted( int theSection, int theIndx ){} - - virtual void sectionClosed( int theSection, bool isClosed ){} - virtual void sectionAdded( int theSection ){} - virtual void sectionRemoved( int theSection ){} - virtual void sectionTypeChanged( int theSection ){} - - virtual void curveChanged(){} -}; - -#endif \ No newline at end of file diff --git a/src/CurveCreator/CurveCreator_NewPointDlg.cxx b/src/CurveCreator/CurveCreator_NewPointDlg.cxx deleted file mode 100755 index bb15571e8..000000000 --- a/src/CurveCreator/CurveCreator_NewPointDlg.cxx +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include "CurveCreator_NewPointDlg.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -CurveCreator_NewPointDlg::CurveCreator_NewPointDlg(CurveCreator::Dimension theDim, QWidget *parent) : - QWidget(parent), myX(NULL), myY(NULL), myZ(NULL), myIsEdit(false), myDim(theDim), - myIsInstantSketchingEnabled(false) -{ - QString aTitle = QString(tr("ADD_NEW_POINT")); - setWindowTitle(aTitle); - - QFrame* aFrame = new QFrame( this ); - QVBoxLayout* aLayout = new QVBoxLayout( aFrame ); - - QFrame* aCoordFrame = new QFrame( aFrame ); - QGridLayout* aCoordLayout = new QGridLayout( aCoordFrame ); - - QLabel* aLbl = new QLabel( tr("X_COORD"), this); - myX = new QDoubleSpinBox(this); - aCoordLayout->addWidget(aLbl, 0, 0); - aCoordLayout->addWidget(myX, 0, 1 ); - - aLbl = new QLabel( tr("Y_COORD"), this); - myY = new QDoubleSpinBox(this); - aCoordLayout->addWidget(aLbl, 1, 0 ); - aCoordLayout->addWidget(myY, 1, 1 ); - - myZLabel = new QLabel( tr("Z_COORD"), this); - myZ = new QDoubleSpinBox(this); - aCoordLayout->addWidget(myZLabel, 2,0 ); - aCoordLayout->addWidget(myZ, 2,1 ); - - if( theDim != CurveCreator::Dim3d ){ - myZ->hide(); - myZLabel->hide(); - } - - myBtnFrame = new QFrame( aFrame ); - QHBoxLayout* aBtnsLayout = new QHBoxLayout( myBtnFrame ); - - myAddBtn = new QPushButton( tr( "ADD_BTN" ), myBtnFrame ); - myCancelBtn = new QPushButton( tr( "CANCEL" ), myBtnFrame ); - - connect( myCancelBtn, SIGNAL( clicked() ), this, SIGNAL( cancelPoint() ) ); - - aBtnsLayout->addWidget( myAddBtn ); - aBtnsLayout->addStretch( 1 ); - aBtnsLayout->addWidget( myCancelBtn ); - - aLayout->addWidget( aCoordFrame, 0 ); - aLayout->addWidget( myBtnFrame, 1 ); - - clear(); - updateTitle(); -} - -void CurveCreator_NewPointDlg::setSectionName( const QString& theName ) -{ - mySectionName = theName; - updateTitle(); -} - -void CurveCreator_NewPointDlg::setEditMode( bool isEdit ) -{ - myIsEdit = isEdit; - if( myIsEdit ){ - myAddBtn->setText(tr("OK")); - myAddBtn->disconnect( SIGNAL( clicked() ) ); - connect( myAddBtn, SIGNAL( clicked() ), this, SIGNAL( modifyPoint() ) ); - } - else{ - myAddBtn->setText(tr("ADD_BTN")); - myAddBtn->disconnect( SIGNAL( clicked() ) ); - connect( myAddBtn, SIGNAL( clicked() ), this, SIGNAL( addPoint() ) ); - } - updateTitle(); -} - -void CurveCreator_NewPointDlg::updateTitle() -{ - QString aTitle; - if( !myIsEdit ){ - if( mySectionName.isEmpty() ){ - aTitle = tr("ADD_NEW_POINT"); - } - else{ - aTitle = QString(tr("ADD_NEW_POINT_TO_%1")).arg(mySectionName); - } - } - else{ - aTitle = tr("SET_POINT_COORDINATES"); - } - setWindowTitle(aTitle); -} - -CurveCreator::Coordinates CurveCreator_NewPointDlg::getCoordinates() const -{ - CurveCreator::Coordinates aCoords; - double anX = myX->value(); - aCoords.push_back(anX); - double anY = myY->value(); - aCoords.push_back(anY); - if( myDim == CurveCreator::Dim3d ){ - double aZ = myZ->value(); - aCoords.push_back(aZ); - } - return aCoords; -} - -void CurveCreator_NewPointDlg::clear() -{ - initSpinBox(myX); - initSpinBox(myY); - initSpinBox(myZ); -} - -void CurveCreator_NewPointDlg::setDimension(CurveCreator::Dimension theDim) -{ - if( theDim == CurveCreator::Dim2d ){ - myZ->hide(); - myZLabel->hide(); - } - else{ - myZ->show(); - myZLabel->show(); - } -} - -void CurveCreator_NewPointDlg::setCoordinates( const CurveCreator::Coordinates& theCoords ) -{ - double anX = theCoords[0]; - myX->setValue(anX); - double anY = theCoords[1]; - myY->setValue(anY); - if( theCoords.size() == 3 ){ - double aZ = theCoords[2]; - myZ->setValue(aZ); - } - if( isInstantSketchingEnabled() ) - emit addPoint(); -} - -bool CurveCreator_NewPointDlg::isInstantSketchingEnabled() const -{ - return myIsInstantSketchingEnabled; -} - -void CurveCreator_NewPointDlg::setInstantSketchingEnabled( const bool theState ) -{ - myIsInstantSketchingEnabled = theState; -} - -//======================================================================= -// function: initSpinBox -// purpose: -//======================================================================= -void CurveCreator_NewPointDlg::initSpinBox(QDoubleSpinBox *theSpinBox) -{ - const double aCoordMin = -1.e+15; - const double aCoordMax = 1.e+15; - const double aStep = 10; - const int aPrecision = 6; - - theSpinBox->setDecimals( qAbs( aPrecision ) ); - theSpinBox->setRange(aCoordMin, aCoordMax); - theSpinBox->setSingleStep(aStep); - theSpinBox->setValue(0.0); -} diff --git a/src/CurveCreator/CurveCreator_NewPointDlg.h b/src/CurveCreator/CurveCreator_NewPointDlg.h deleted file mode 100755 index a86189e54..000000000 --- a/src/CurveCreator/CurveCreator_NewPointDlg.h +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef CURVECREATOR_NEWPOINTDLG_H -#define CURVECREATOR_NEWPOINTDLG_H - -#include "CurveCreator.hxx" - -#include - -class QDoubleSpinBox; -class QDialogButtonBox; -class QAbstractButton; -class QPushButton; -class QLabel; -class QFrame; - -class CurveCreator_NewPointDlg : public QWidget -{ - Q_OBJECT -public: - explicit CurveCreator_NewPointDlg(CurveCreator::Dimension theDim, QWidget *parent = 0); - CurveCreator::Coordinates getCoordinates() const; - void clear(); - void setSectionName( const QString& theName ); - void setEditMode( bool isEdit ); - void setCoordinates( const CurveCreator::Coordinates& theCoords ); - void setDimension(CurveCreator::Dimension theDim); - bool isInstantSketchingEnabled() const; - void setInstantSketchingEnabled( const bool theState ); -signals: - void addPoint(); - void modifyPoint(); - void cancelPoint(); -public slots: -protected slots: -protected: - void updateTitle(); - void initSpinBox(QDoubleSpinBox *theSpinBox); -private: - QFrame* myBtnFrame; - CurveCreator::Dimension myDim; - QDoubleSpinBox* myX; - QDoubleSpinBox* myY; - QDoubleSpinBox* myZ; - QLabel* myZLabel; - QPushButton* myAddBtn; - QPushButton* myCancelBtn; - bool myIsEdit; - QString mySectionName; - bool myIsInstantSketchingEnabled; -}; - -#endif // CURVECREATOR_NEWPOINTDLG_H diff --git a/src/CurveCreator/CurveCreator_UndoOptsDlg.cxx b/src/CurveCreator/CurveCreator_UndoOptsDlg.cxx deleted file mode 100644 index ec8fd5898..000000000 --- a/src/CurveCreator/CurveCreator_UndoOptsDlg.cxx +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -// File: CurveCreator_UndoOptsDlg.cxx -// Author: Sergey KHROMOV - -#include "CurveCreator_UndoOptsDlg.h" - -#include -#include -#include -#include -#include -#include -#include - -#define UNDO_DEPTH_UNLIMITED 0 -#define UNDO_DEPTH_DISABLED 1 -#define UNDO_DEPTH_FIX_SIZE 2 - -//======================================================================= -// function: Constructor -// purpose: -//======================================================================= -CurveCreator_UndoOptsDlg::CurveCreator_UndoOptsDlg(QWidget* parent) - : QDialog (parent), - myUndoDepth (UNDO_DEPTH_UNLIMITED), - myOptsBtnGrp (NULL), - myBufferSizeEdit (NULL), - myOkBtn (NULL), - myCancelBtn (NULL) -{ - setWindowTitle(tr("CC_UNDO_OPTIONS_TITLE")); - - // Set Undo/Redo options group - QGroupBox *anUndoOptsGrp = - new QGroupBox(tr("CC_UNDO_OPTIONS_MODIFY")); - QGridLayout *anUndoOptsLO = new QGridLayout(anUndoOptsGrp); - QRadioButton *aDisabledRdBtn = - new QRadioButton(tr("CC_UNDO_OPTIONS_DISABLED"), anUndoOptsGrp); - QRadioButton *aFixSizeRdBtn = - new QRadioButton(tr("CC_UNDO_OPTIONS_FIXED_SIZE"), anUndoOptsGrp); - QRadioButton *anUnlimRdBtn = - new QRadioButton(tr("CC_UNDO_OPTIONS_UNLIMITED"), anUndoOptsGrp); - - myOptsBtnGrp = new QButtonGroup(anUndoOptsGrp); - myBufferSizeEdit = new QLineEdit(anUndoOptsGrp); - anUndoOptsLO->setMargin(9); - anUndoOptsLO->setSpacing(6); - anUndoOptsLO->addWidget(aDisabledRdBtn, 0, 0); - anUndoOptsLO->addWidget(aFixSizeRdBtn, 1, 0); - anUndoOptsLO->addWidget(anUnlimRdBtn, 2, 0); - anUndoOptsLO->addWidget(myBufferSizeEdit, 1, 1); - myOptsBtnGrp->addButton(anUnlimRdBtn, UNDO_DEPTH_UNLIMITED); - myOptsBtnGrp->addButton(aDisabledRdBtn, UNDO_DEPTH_DISABLED); - myOptsBtnGrp->addButton(aFixSizeRdBtn, UNDO_DEPTH_FIX_SIZE); - - // Set OK/Cancel buttons group - QGroupBox *anOkCancelGrp = new QGroupBox; - QGridLayout *anOkCancelLO = new QGridLayout(anOkCancelGrp); - - myOkBtn = new QPushButton(tr("GEOM_BUT_OK"), anOkCancelGrp); - myCancelBtn = new QPushButton(tr("GEOM_BUT_CANCEL"), anOkCancelGrp); - anOkCancelLO->setMargin(9); - anOkCancelLO->setSpacing(6); - anOkCancelLO->addWidget(myOkBtn, 0, 0); - anOkCancelLO->addWidget(myCancelBtn, 0, 1); - - // Set main group - QGroupBox *aMainGrp = new QGroupBox; - QVBoxLayout *aMainLO = new QVBoxLayout(aMainGrp); - - aMainLO->addWidget(anUndoOptsGrp); - aMainLO->addWidget(anOkCancelGrp); - - setLayout(aMainLO); - - init(); -} - -//======================================================================= -// function: Destructor -// purpose: -//======================================================================= -CurveCreator_UndoOptsDlg::~CurveCreator_UndoOptsDlg() -{ -} - -//======================================================================= -// function: setUndoDepth -// purpose: -//======================================================================= -void CurveCreator_UndoOptsDlg::setUndoDepth(const int theDepth) -{ - myUndoDepth = theDepth; - - const int aDepthId = myUndoDepth + 1; - int anId = UNDO_DEPTH_FIX_SIZE; - - if (aDepthId == UNDO_DEPTH_UNLIMITED || - aDepthId == UNDO_DEPTH_DISABLED) { - anId = aDepthId; - } else if (myUndoDepth > 0) { - myBufferSizeEdit->setText(QString::number(myUndoDepth)); - } - - myOptsBtnGrp->button(anId)->setChecked(true); - optionChanged(anId); -} - -//======================================================================= -// function: getUndoDepth -// purpose: -//======================================================================= -int CurveCreator_UndoOptsDlg::getUndoDepth() const -{ - return myUndoDepth; -} - -//======================================================================= -// function: isEnabled -// purpose: -//======================================================================= -bool CurveCreator_UndoOptsDlg::isEnabled() const -{ - return (myUndoDepth + 1 != UNDO_DEPTH_DISABLED); -} - -//======================================================================= -// function: isUnlimited -// purpose: -//======================================================================= -bool CurveCreator_UndoOptsDlg::isUnlimited() const -{ - return (myUndoDepth + 1 == UNDO_DEPTH_UNLIMITED); -} - -//======================================================================= -// function: init -// purpose: -//======================================================================= -void CurveCreator_UndoOptsDlg::init() -{ - // Initialize sections group. - myOptsBtnGrp->setExclusive(true); - myOptsBtnGrp->button(UNDO_DEPTH_UNLIMITED)->setChecked(true); - connect(myOptsBtnGrp, SIGNAL(buttonClicked(int)), - this, SLOT(optionChanged(int))); - - // Initialize line edit. - QIntValidator *aValidator = new QIntValidator(myBufferSizeEdit); - - aValidator->setBottom(1); - myBufferSizeEdit->setValidator(aValidator); - optionChanged(UNDO_DEPTH_UNLIMITED); - - // Init buttons. - myOkBtn->setDefault(true); - - connect(myOkBtn, SIGNAL(clicked()), this, SLOT(accept())); - connect(myCancelBtn, SIGNAL(clicked()), this, SLOT(reject())); - - setTabOrder(); -} - -//======================================================================= -// function: setTabOrder -// purpose: -//======================================================================= -void CurveCreator_UndoOptsDlg::setTabOrder() -{ - QWidget::setTabOrder(myOptsBtnGrp->button(UNDO_DEPTH_DISABLED), - myOptsBtnGrp->button(UNDO_DEPTH_FIX_SIZE)); - QWidget::setTabOrder(myOptsBtnGrp->button(UNDO_DEPTH_FIX_SIZE), - myBufferSizeEdit); - QWidget::setTabOrder(myBufferSizeEdit, - myOptsBtnGrp->button(UNDO_DEPTH_UNLIMITED)); - QWidget::setTabOrder(myOptsBtnGrp->button(UNDO_DEPTH_UNLIMITED), myOkBtn); - QWidget::setTabOrder(myOkBtn, myCancelBtn); -} - -//======================================================================= -// function: optionChanged -// purpose: -//======================================================================= -void CurveCreator_UndoOptsDlg::optionChanged(int theId) -{ - switch (theId) { - case UNDO_DEPTH_FIX_SIZE: - myBufferSizeEdit->setEnabled(true); - break; - case UNDO_DEPTH_UNLIMITED: - case UNDO_DEPTH_DISABLED: - default: - myBufferSizeEdit->setEnabled(false); - break; - } -} - -//======================================================================= -// function: accept -// purpose: -//======================================================================= -void CurveCreator_UndoOptsDlg::accept() -{ - const int anId = myOptsBtnGrp->checkedId(); - - switch (anId) { - case UNDO_DEPTH_FIX_SIZE: - myUndoDepth = myBufferSizeEdit->text().toInt(); - break; - case UNDO_DEPTH_UNLIMITED: - case UNDO_DEPTH_DISABLED: - myUndoDepth = anId - 1; - break; - default: - break; - } - - QDialog::accept(); -} diff --git a/src/CurveCreator/CurveCreator_UndoOptsDlg.h b/src/CurveCreator/CurveCreator_UndoOptsDlg.h deleted file mode 100644 index 86aa87aa3..000000000 --- a/src/CurveCreator/CurveCreator_UndoOptsDlg.h +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -// File: CurveCreator_UndoOptsDlg.h -// Author: Sergey KHROMOV - -#ifndef _CurveCreator_UndoOptsDlg_HeaderFile -#define _CurveCreator_UndoOptsDlg_HeaderFile - -#include - -class QButtonGroup; -class QLineEdit; -class QPushButton; - - -class CurveCreator_UndoOptsDlg : public QDialog -{ - Q_OBJECT - -public: - - CurveCreator_UndoOptsDlg(QWidget* parent); - - ~CurveCreator_UndoOptsDlg(); - - void setUndoDepth(const int theDepth); - - int getUndoDepth() const; - - bool isEnabled() const; - - bool isUnlimited() const; - -private: - - void init(); - - void setTabOrder(); - -private slots: - - void optionChanged(int theId); - - void accept(); - -protected: - - int myUndoDepth; - QButtonGroup *myOptsBtnGrp; - QLineEdit *myBufferSizeEdit; - QPushButton *myOkBtn; - QPushButton *myCancelBtn; - -}; - -#endif -- 2.39.2