1 // Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef CURVECREATOR_WIDGET_H
21 #define CURVECREATOR_WIDGET_H
23 #include "CurveCreator_Curve.hxx"
24 #include "CurveCreator.hxx"
29 #include <SUIT_ViewWindow.h>
33 class CurveCreator_CurveEditor;
34 class CurveCreator_TreeView;
35 class CurveCreator_NewPointDlg;
36 class CurveCreator_NewSectionDlg;
38 class CURVECREATOR_EXPORT CurveCreator_Widget : public QWidget
42 explicit CurveCreator_Widget( QWidget* parent,
43 CurveCreator_Curve *theCurve,
44 Qt::WindowFlags fl=0 );
46 void setCurve( CurveCreator_Curve* theCurve );
48 QList<int> getSelectedSections();
49 QList< QPair< int, int > > getSelectedPoints();
51 bool isInstantSketchingEnabled() const;
52 void setInstantSketchingEnabled( const bool theState );
55 void selectionChanged();
56 void subOperationStarted( QWidget* );
57 void subOperationFinished( QWidget* );
62 void onAdditionMode(bool checked);
63 void onModificationMode(bool checked);
64 void onDetectPoints(bool checked);
65 void onModeChanged(bool checked);
67 void onSelectionChanged();
68 void onAddNewPoint(const CurveCreator::Coordinates& theCoords);
69 void onAddNewSection();
70 void onEditSection( int theSection );
71 void onEditPoint( int theSection, int thePoint );
73 void onModifySection();
75 void onCancelSection();
82 void onInsertSectionBefore();
83 void onInsertSectionAfter();
86 void onCloseSections();
87 void onUncloseSections();
88 void onInsertPointBefore();
89 void onInsertPointAfter();
92 void onUndoSettings();
93 void onContextMenu(QPoint thePoint);
94 void onGetPointByClick( SUIT_ViewWindow*, QMouseEvent* );
95 // void onPointSelect( SUIT_ViewWindow*, QMouseEvent* );
96 void onPointDrag( SUIT_ViewWindow*, QMouseEvent* );
98 enum ActionId{ UNDO_ID, REDO_ID, NEW_SECTION_ID, ADDITION_MODE_ID, REMOVE_ID, REMOVE_ALL_ID, JOIN_ID,
99 JOIN_ALL_ID, UP_ID, DOWN_ID, INSERT_SECTION_BEFORE_ID, INSERT_SECTION_AFTER_ID,
100 INSERT_POINT_BEFORE_ID, INSERT_POINT_AFTER_ID, CLOSE_SECTIONS_ID, UNCLOSE_SECTIONS_ID,
101 SET_SECTIONS_POLYLINE_ID, SET_SECTIONS_SPLINE_ID, CLEAR_ALL_ID, SEPARATOR_ID,
102 MODIFICATION_MODE_ID, DETECTION_MODE_ID };
104 QAction* createAction( ActionId theId, const QString& theName, const QPixmap& theImage,
105 const QString& theToolTip, const QKeySequence& theShortcut );
106 QAction* getAction(ActionId theId);
107 void updateUndoRedo();
109 QMap<ActionId, QAction*> myActionMap;
110 CurveCreator_Curve* myCurve;
111 CurveCreator_CurveEditor* myEdit;
112 CurveCreator_TreeView* mySectionView;
113 CurveCreator_NewPointDlg* myNewPointEditor;
114 CurveCreator_NewSectionDlg* myNewSectionEditor;
117 QPoint myDragStartPosition;
120 #endif // CURVECREATOR_WIDGET_H