X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROCurveCreator%2FCurveCreator_Widget.h;h=31b4db039e842234c039fda0e007ce125c1378f1;hb=8e79913fc37eacbd1edf9dc08632b6f8bc7250d8;hp=399711e8a79bffc9bb4f24becfc4bf9622c74bc2;hpb=28b09f8fc96218c317aa67805bb3fc0e296aedbd;p=modules%2Fhydro.git diff --git a/src/HYDROCurveCreator/CurveCreator_Widget.h b/src/HYDROCurveCreator/CurveCreator_Widget.h index 399711e8..31b4db03 100644 --- a/src/HYDROCurveCreator/CurveCreator_Widget.h +++ b/src/HYDROCurveCreator/CurveCreator_Widget.h @@ -51,9 +51,27 @@ class CurveCreator_NewSectionDlg; class CURVECREATOR_EXPORT CurveCreator_Widget : public QWidget { Q_OBJECT + +public: + enum ActionFlags { + NoFlags = 0x00000000, + DisableDetectionMode = 0x00000001, + DisableNewSection = 0x00000002, + DisableClosedSection = 0x00000004 + }; + + enum ActionMode { + NoneMode, + AdditionMode, + ModificationMode, + DetectionMode + }; + public: explicit CurveCreator_Widget( QWidget* parent, CurveCreator_ICurve *theCurve, + const int theActionFlags = NoFlags, + const QStringList& theCoordTitles = QStringList(), Qt::WindowFlags fl=0, int theLocalPointRowLimit = 20); @@ -68,14 +86,17 @@ public: void setCurve( CurveCreator_ICurve* theCurve ); QList getSelectedSections(); - QList< QPair< int, int > > getSelectedPoints(); + void setSelectedSections( const QList& theSections ); void removeSelected(); bool removeEnabled(); + void setActionMode( const ActionMode& theMode ); + ActionMode getActionMode() const; + signals: void selectionChanged(); - void subOperationStarted( QWidget* ); + void subOperationStarted( QWidget*, bool ); void subOperationFinished( QWidget* ); public slots: @@ -87,7 +108,6 @@ protected slots: void onModeChanged(bool checked); void onNewSection(); void onSelectionChanged(); - void onAddNewPoint(const CurveCreator::Coordinates& theCoords); void onAddNewSection(); void onEditSection( int theSection ); void onModifySection(); @@ -104,7 +124,6 @@ protected slots: void onRedo(); void onUndoSettings(); void onContextMenu(QPoint thePoint); - void onGetCoordsByClick( QMouseEvent* ); void onMousePress( SUIT_ViewWindow*, QMouseEvent* theEvent ); void onMouseRelease( SUIT_ViewWindow*, QMouseEvent* theEvent ); @@ -118,7 +137,11 @@ protected slots: void onCellChanged( int theRow, int theColumn ); protected: - enum ActionId{ UNDO_ID, + void addCoordsByClick( QMouseEvent* ); + +protected: + enum ActionId{ NONE_ID, + UNDO_ID, REDO_ID, NEW_SECTION_ID, ADDITION_MODE_ID, @@ -136,26 +159,20 @@ protected: DETECTION_MODE_ID }; - enum ActionMode { - NoneMode, - AdditionMode, - ModificationMode, - DetectionMode - }; - private: OCCViewer_Viewer* getOCCViewer(); QAction* createAction( ActionId theId, const QString& theName, const QPixmap& theImage, const QString& theToolTip, const QKeySequence& theShortcut ); QAction* getAction(ActionId theId); - ActionMode getActionMode() const; + QAction* getAction(ActionMode theMode); void updateActionsStates(); void updateUndoRedo(); void removeSection(); void removePoint(); + void addNewPoint(const CurveCreator::Coordinates& theCoords); void insertPointToSelectedSegment( const int theXPosition, const int theYPosition ); void moveSelectedPoints( const int theXPosition, const int theYPosition ); @@ -168,6 +185,8 @@ private: void setSelectedPoints( const CurveCreator_ICurve::SectionToPointList& = CurveCreator_ICurve::SectionToPointList() ); + void stopActionMode(); + void startCurveModification( CurveCreator_ICurve::SectionToPointList& thePoints, const bool theFillPoints = true ); void finishCurveModification( const CurveCreator_ICurve::SectionToPointList& thePoints = @@ -198,8 +217,11 @@ private: QPoint myDragStartPosition; int myDragInteractionStyle; CurveCreator_ICurve::SectionToPointList myDragPoints; + QMap myInitialDragPointsCoords; bool myDragged; QByteArray myGuiState; + int myPressedX; + int myPressedY; }; #endif // CURVECREATOR_WIDGET_H