1 #include "CurveCreator_Widget.h"
\r
2 #include "CurveCreator_TreeView.h"
\r
3 #include "QVBoxLayout"
\r
4 #include "CurveCreator_Curve.hxx"
\r
5 #include "CurveCreator_CurveEditor.hxx"
\r
6 #include "CurveCreator.hxx"
\r
7 #include "CurveCreator_NewPointDlg.h"
\r
8 #include "CurveCreator_NewSectionDlg.h"
\r
10 #include <QHBoxLayout>
\r
11 #include <QVBoxLayout>
\r
13 #include <QLineEdit>
\r
14 #include <QGroupBox>
\r
15 #include <QToolButton>
\r
20 CurveCreator_Widget::CurveCreator_Widget(QWidget *parent) :
\r
21 QWidget(parent), myNewPointEditor(NULL)
\r
23 //TODO remove it for debug only
\r
24 myCurve = new CurveCreator_Curve(CurveCreator::Dim2d);
\r
25 myEdit = new CurveCreator_CurveEditor( myCurve );
\r
26 CurveCreator::Coordinates aCoords;
\r
28 aCoords.push_back(10);
\r
29 aCoords.push_back(20);
\r
30 aCoords.push_back(1);
\r
31 aCoords.push_back(2);
\r
33 myEdit->addSection("",CurveCreator::BSpline, true, aCoords );
\r
36 aCoords.push_back(11);
\r
37 aCoords.push_back(21);
\r
38 aCoords.push_back(111);
\r
39 aCoords.push_back(211);
\r
40 aCoords.push_back(101);
\r
41 aCoords.push_back(201);
\r
42 aCoords.push_back(13);
\r
43 aCoords.push_back(25);
\r
44 myEdit->addSection("",CurveCreator::Polyline, false, aCoords );
\r
47 for( int i = 0 ; i < 1000000 ; i++ ){
\r
48 double anX = ((double)i)/10000.;
\r
49 double anY = ((double)i)/10000. + 3.4;
\r
50 aCoords.push_back(anX);
\r
51 aCoords.push_back(anY);
\r
53 myEdit->addSection("",CurveCreator::Polyline, true, aCoords );
\r
56 myNewPointEditor = new CurveCreator_NewPointDlg(myCurve->getDimension(), this);
\r
57 connect( myNewPointEditor, SIGNAL(addPoint()), this, SLOT(onAddNewPoint()));
\r
59 myNewSectionEditor = new CurveCreator_NewSectionDlg(this);
\r
60 connect( myNewSectionEditor, SIGNAL(addSection()), this, SLOT(onAddNewSection()));
\r
62 QHBoxLayout* aNameLayout = new QHBoxLayout();
\r
63 QLabel* aNameLabel = new QLabel(tr("CURVE_NAME_TLT"), this);
\r
64 aNameLayout->addWidget(aNameLabel);
\r
65 QLineEdit* aNameEdit = new QLineEdit(this);
\r
66 aNameLayout->addWidget(aNameEdit);
\r
68 QGroupBox* aSectionGroup = new QGroupBox(tr("SECTION_GROUP_TLT"),this);
\r
70 mySectionView = new CurveCreator_TreeView(myCurve, aSectionGroup);
\r
71 connect( mySectionView, SIGNAL(selectionChanged()), this, SLOT( onSelectionChanged() ) );
\r
72 connect( mySectionView, SIGNAL(pointEntered(int,int)), this, SLOT(onEditPoint(int,int)) );
\r
73 connect( mySectionView, SIGNAL(sectionEntered(int)), this, SLOT(onEditSection(int)) );
\r
74 connect( mySectionView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onContextMenu(QPoint)) );
\r
75 QToolBar* aTB = new QToolBar(tr("TOOL_BAR_TLT"), aSectionGroup);
\r
76 // QToolButton* anUndoBtn = new QToolButton(aTB);
\r
77 QAction* anAct = createAction( UNDO_ID, tr("UNDO"), tr(":images/ICON_UNDO"), tr("UNDO_TLT"), QKeySequence(Qt::ControlModifier|Qt::Key_Z) );
\r
78 aTB->addAction(anAct);
\r
80 anAct = createAction( REDO_ID, tr("REDO"), tr(":images/ICON_REDO"), tr("REDO_TLT"), QKeySequence(Qt::ControlModifier|Qt::Key_Y) );
\r
81 aTB->addAction(anAct);
\r
83 aTB->addSeparator();
\r
85 anAct = createAction( NEW_SECTION_ID, tr("ICON_NEW_SECTION"), tr(":images/ICON_NEW_SECTION"), tr("NEW_SECTION_TLT"), QKeySequence(Qt::ControlModifier|Qt::Key_N) );
\r
86 connect(anAct, SIGNAL(triggered()), this, SLOT(onNewSection()) );
\r
87 aTB->addAction(anAct);
\r
89 anAct = createAction( INSERT_SECTION_BEFORE_ID, tr("INSERT_SECTION_BEFORE"), tr(":images/ICON_INSERT_SECTION_BEFORE"), tr("INSERT_SECTION_BEFORE_TLT"),
\r
90 QKeySequence(Qt::ControlModifier | Qt::Key_Insert ) );
\r
91 connect(anAct, SIGNAL(triggered()), this, SLOT(onInsertSectionBefore()) );
\r
93 anAct = createAction( INSERT_SECTION_AFTER_ID, tr("INSERT_SECTION_AFTER"), tr(":images/ICON_INSERT_SECTION_AFTER"), tr("INSERT_SECTION_AFTER_TLT"),
\r
94 QKeySequence(Qt::ControlModifier | Qt::ShiftModifier | Qt::Key_Insert ) );
\r
95 connect(anAct, SIGNAL(triggered()), this, SLOT(onInsertSectionAfter()) );
\r
97 anAct = createAction( NEW_POINT_ID, tr("ICON_NEW_POINT"), tr(":images/ICON_NEW_POINT"), tr("NEW_POINT_TLT"), QKeySequence(Qt::ControlModifier|Qt::Key_P) );
\r
98 connect(anAct, SIGNAL(triggered()), this, SLOT(onNewPoint()) );
\r
99 aTB->addAction(anAct);
\r
100 aTB->addSeparator();
\r
102 anAct = createAction( INSERT_POINT_BEFORE_ID, tr("INSERT_POINT_BEFORE"), tr(":images/ICON_POINT_BEFORE"), tr("INSERT_POINT_BEFORE_TLT"), QKeySequence(Qt::ControlModifier|Qt::Key_B) );
\r
103 connect(anAct, SIGNAL(triggered()), this, SLOT(onInsertPointBefore()) );
\r
105 anAct = createAction( INSERT_POINT_AFTER_ID, tr("INSERT_POINT_AFTER"), tr(":images/ICON_POINT_AFTER"), tr("INSERT_POINT_AFTER_TLT"), QKeySequence(Qt::ControlModifier|Qt::Key_M) );
\r
106 connect(anAct, SIGNAL(triggered()), this, SLOT(onInsertPointAfter()) );
\r
108 anAct = createAction( CLOSE_SECTIONS_ID, tr("CLOSE_SECTIONS"), tr(":images/ICON_CLOSE_SECTIONS"), tr("CLOSE_SECTIONS_TLT"), QKeySequence(Qt::ControlModifier|Qt::Key_W) );
\r
109 connect(anAct, SIGNAL(triggered()), this, SLOT(onCloseSections()) );
\r
111 anAct = createAction( UNCLOSE_SECTIONS_ID, tr("UNCLOSE_SECTIONS"), tr(":images/ICON_UNCLOSE_SECTIONS"), tr("UNCLOSE_SECTIONS_TLT"), QKeySequence(Qt::ControlModifier|Qt::Key_S) );
\r
112 connect(anAct, SIGNAL(triggered()), this, SLOT(onUncloseSections()) );
\r
114 anAct = createAction( SET_SECTIONS_POLYLINE_ID, tr("SET_SECTIONS_POLYLINE"), tr(":images/ICON_POLYLINE"), tr("SET_POLYLINE_TLT"), QKeySequence(Qt::ControlModifier|Qt::Key_E) );
\r
115 connect(anAct, SIGNAL(triggered()), this, SLOT(onSetPolyline()) );
\r
117 anAct = createAction( SET_SECTIONS_SPLINE_ID, tr("SET_SECTIONS_SPLINE"), tr(":images/ICON_SPLINE"), tr("SET_SPLINE_TLT"), QKeySequence(Qt::ControlModifier|Qt::Key_R) );
\r
118 connect(anAct, SIGNAL(triggered()), this, SLOT(onSetSpline()) );
\r
120 anAct = createAction( REMOVE_ID, tr("ICON_REMOVE"), tr(":images/ICON_REMOVE"), tr("REMOVE_TLT"), QKeySequence(Qt::ControlModifier|Qt::Key_Delete ) );
\r
121 connect(anAct, SIGNAL(triggered()), this, SLOT(onRemove()) );
\r
122 aTB->addAction(anAct);
\r
123 aTB->addSeparator();
\r
125 anAct = createAction( JOIN_ID, tr("ICON_JOIN"), tr(":images/ICON_JOIN"), tr("JOIN_TLT"), QKeySequence(Qt::ControlModifier|Qt::Key_Plus ) );
\r
126 connect( anAct, SIGNAL(triggered()), this, SLOT(onJoin()) );
\r
127 aTB->addAction(anAct);
\r
128 aTB->addSeparator();
\r
130 anAct = createAction( UP_ID, tr("ICON_STEP_UP"), tr(":images/ICON_STEP_UP"), tr("STEP_UP_TLT"), QKeySequence(Qt::ControlModifier|Qt::Key_Up ) );
\r
131 connect( anAct, SIGNAL(triggered()), this, SLOT(onMoveUp()) );
\r
132 aTB->addAction(anAct);
\r
134 anAct = createAction( DOWN_ID, tr("ICON_STEP_DOWN"), tr(":images/ICON_STEP_DOWN"), tr("STEP_DOWN"), QKeySequence(Qt::ControlModifier|Qt::Key_Down ) );
\r
135 connect( anAct, SIGNAL(triggered()), this, SLOT(onMoveDown()) );
\r
136 aTB->addAction(anAct);
\r
138 anAct = createAction( CLEAR_ALL_ID, tr("CLEAR_ALL"), tr(":images/ICON_CLEAR_ALL"), tr("CLEAR_ALL_TLT"), QKeySequence(Qt::ControlModifier | Qt::ShiftModifier | Qt::Key_Delete ) );
\r
139 connect( anAct, SIGNAL(triggered()), this, SLOT( onClearAll()) );
\r
140 aTB->addAction(anAct);
\r
142 anAct = createAction( JOIN_ALL_ID, tr("JOIN_ALL"), tr(":images/ICON_JOIN_ALL"), tr("JOIN_ALL_TLT"), QKeySequence(Qt::ControlModifier | Qt::ShiftModifier | Qt::Key_Plus ) );
\r
143 connect( anAct, SIGNAL(triggered()), this, SLOT(onJoinAll()) );
\r
144 aTB->addAction(anAct);
\r
146 QVBoxLayout* aSectLayout = new QVBoxLayout();
\r
147 aSectLayout->addWidget(aTB);
\r
148 aSectLayout->addWidget(mySectionView);
\r
149 aSectionGroup->setLayout(aSectLayout);
\r
150 QVBoxLayout* aLay = new QVBoxLayout();
\r
151 aLay->addLayout(aNameLayout);
\r
152 aLay->addWidget(aSectionGroup);
\r
154 onSelectionChanged();
\r
157 void CurveCreator_Widget::onSelectionChanged()
\r
159 QList<ActionId> anEnabledAct;
\r
160 anEnabledAct << NEW_SECTION_ID;
\r
161 int aSectCnt = myCurve->getNbPoints();
\r
163 anEnabledAct << CLEAR_ALL_ID;
\r
165 anEnabledAct << JOIN_ALL_ID;
\r
166 QList<int> aSelSections = mySectionView->getSelectedSections();
\r
167 QList< QPair< int, int > > aSelPoints = mySectionView->getSelectedPoints();
\r
168 CurveCreator_TreeView::SelectionType aSelType = mySectionView->getSelectionType();
\r
169 switch( aSelType ){
\r
170 case CurveCreator_TreeView::ST_NOSEL:{
\r
173 case CurveCreator_TreeView::ST_SECTIONS:{
\r
174 if( aSelSections.size() > 1 ){
\r
175 anEnabledAct << JOIN_ID;
\r
177 if( aSelSections[0] > 0 ){
\r
178 anEnabledAct << UP_ID;
\r
180 if( aSelSections.size() == 1 ){
\r
181 anEnabledAct << NEW_POINT_ID << INSERT_SECTION_BEFORE_ID << INSERT_SECTION_AFTER_ID;
\r
183 if( aSelSections[ aSelSections.size() - 1 ] < ( myCurve->getNbSections() - 1 ) ){
\r
184 anEnabledAct << DOWN_ID;
\r
186 anEnabledAct << CLOSE_SECTIONS_ID << UNCLOSE_SECTIONS_ID << SET_SECTIONS_POLYLINE_ID << SET_SECTIONS_SPLINE_ID;
\r
189 case CurveCreator_TreeView::ST_POINTS_ONE_SECTION:{
\r
190 if( aSelPoints[0].second > 0 ){
\r
191 anEnabledAct << UP_ID;
\r
193 int aLastIndex = aSelPoints.size()-1;
\r
194 int aSect = aSelPoints[0].first;
\r
195 if( aSelPoints[aLastIndex].second < (myCurve->getNbPoints(aSect) - 1)){
\r
196 anEnabledAct << DOWN_ID;
\r
198 if( aSelPoints.size() == 1){
\r
199 anEnabledAct << INSERT_POINT_BEFORE_ID << INSERT_POINT_AFTER_ID;
\r
204 int aSelObjsCnt = aSelPoints.size() + aSelSections.size();
\r
205 if( aSelObjsCnt > 0 ){
\r
206 anEnabledAct << REMOVE_ID;
\r
208 if( myCurve->getNbSections() > 0 ){
\r
209 anEnabledAct << REMOVE_ALL_ID;
\r
211 if( myCurve->getNbSections() > 1 ){
\r
212 anEnabledAct << JOIN_ALL_ID;
\r
214 QList<ActionId> anIds = myActionMap.keys();
\r
215 for( int i = 0 ; i < anIds.size() ; i++ ){
\r
216 if( myActionMap.contains(anIds[i]) ){
\r
217 if( anEnabledAct.contains(anIds[i]) ){
\r
218 myActionMap[anIds[i]]->setEnabled(true);
\r
221 myActionMap[anIds[i]]->setEnabled(false);
\r
227 void CurveCreator_Widget::onNewPoint()
\r
231 QList<int> aSelSection = mySectionView->getSelectedSections();
\r
232 if( aSelSection.size() > 0 ){
\r
233 mySection = aSelSection[0];
\r
236 QList< QPair<int,int> > aSelPoints = mySectionView->getSelectedPoints();
\r
237 if( aSelPoints.size() > 0 ){
\r
238 mySection = aSelPoints[0].first;
\r
239 myPointNum = aSelPoints[0].second + 1;
\r
243 if( mySection < 0 ){
\r
244 mySection = myCurve->getNbSections() - 1;
\r
246 aSectName = QString::fromStdString( myCurve->getSectionName(mySection));
\r
247 if( myPointNum < 0 ){
\r
248 myPointNum = myCurve->getNbPoints(mySection);
\r
250 myNewPointEditor->clear();
\r
251 myNewPointEditor->setEditMode(false);
\r
252 myNewPointEditor->setSectionName(aSectName);
\r
253 if( myNewPointEditor->exec() == QDialog::Accepted ){
\r
258 void CurveCreator_Widget::onAddNewPoint()
\r
260 CurveCreator::Coordinates aCoords = myNewPointEditor->getCoordinates();
\r
261 myEdit->insertPoints(aCoords, mySection, myPointNum );
\r
262 mySectionView->pointsAdded( mySection, myPointNum );
\r
263 myNewPointEditor->clear();
\r
267 void CurveCreator_Widget::onNewSection()
\r
269 myNewSectionEditor->clear();
\r
270 myNewSectionEditor->setEditMode(false);
\r
271 QString aSectName = QString( myCurve->getUnicSectionName().c_str() );
\r
272 myNewSectionEditor->setSectionParameters(aSectName, true, CurveCreator::Polyline );
\r
273 if( myNewSectionEditor->exec() == QDialog::Accepted ){
\r
278 void CurveCreator_Widget::onAddNewSection()
\r
280 CurveCreator::Coordinates aCoords;
\r
281 myEdit->addSection( myNewSectionEditor->getName().toStdString(), myNewSectionEditor->getSectionType(),
\r
282 myNewSectionEditor->isClosed(), aCoords );
\r
283 mySectionView->sectionAdded( mySection );
\r
284 QString aNewName = QString(myCurve->getUnicSectionName().c_str());
\r
285 myNewSectionEditor->setSectionName(aNewName);
\r
289 QAction* CurveCreator_Widget::createAction( ActionId theId, const QString& theName, const QString& theImageName,
\r
290 const QString& theToolTip, const QKeySequence& theShortcut )
\r
292 QAction* anAct = new QAction(theName,this);
\r
293 QIcon anIcon(theImageName);
\r
294 if( !anIcon.isNull() ){
\r
295 anAct->setIcon(anIcon);
\r
297 anAct->setShortcut(theShortcut);
\r
298 anAct->setToolTip(theToolTip);
\r
299 myActionMap[theId] = anAct;
\r
303 QAction* CurveCreator_Widget::getAction(ActionId theId)
\r
305 if( myActionMap.contains(theId) )
\r
306 return myActionMap[theId];
\r
310 void CurveCreator_Widget::onEditSection( int theSection )
\r
312 mySection = theSection;
\r
313 QString aSectName = QString::fromStdString( myCurve->getSectionName(theSection));
\r
314 bool isClosed = myCurve->isClosed(theSection);
\r
315 CurveCreator::Type aType = myCurve->getType(theSection);
\r
316 myNewSectionEditor->setEditMode(true);
\r
317 myNewSectionEditor->setSectionParameters( aSectName, isClosed, aType );
\r
318 if( myNewSectionEditor->exec() == QDialog::Accepted ){
\r
319 QString aName = myNewSectionEditor->getName();
\r
320 bool isClosed = myNewSectionEditor->isClosed();
\r
321 CurveCreator::Type aSectType = myNewSectionEditor->getSectionType();
\r
322 myEdit->setClosed( isClosed, mySection );
\r
323 myEdit->setName( aName.toStdString(), mySection );
\r
324 myEdit->setType( aSectType, mySection );
\r
325 mySectionView->sectionChanged(mySection);
\r
329 void CurveCreator_Widget::onEditPoint( int theSection, int thePoint )
\r
331 if( !myNewPointEditor ){
\r
333 QString aSectName = QString::fromStdString( myCurve->getSectionName(theSection));
\r
334 myNewPointEditor->setEditMode(true);
\r
335 myNewPointEditor->setSectionName(aSectName);
\r
336 CurveCreator::Coordinates aCoords = myCurve->getCoordinates(theSection,thePoint);
\r
337 myNewPointEditor->setCoordinates(aCoords);
\r
338 if( myNewPointEditor->exec() == QDialog::Accepted ){
\r
339 aCoords = myNewPointEditor->getCoordinates();
\r
340 myEdit->setCoordinates(aCoords, theSection, thePoint);
\r
341 mySectionView->pointDataChanged(theSection, thePoint );
\r
345 void CurveCreator_Widget::onJoin()
\r
347 QList<int> aSections = mySectionView->getSelectedSections();
\r
348 if( aSections.size() == 0 ){
\r
351 int aMainSect = aSections[0];
\r
352 int aMainSectSize = myCurve->getNbPoints(aMainSect);
\r
353 for( int i = 1 ; i < aSections.size() ; i++ ){
\r
354 int aSectNum = aSections[i] - (i-1);
\r
355 myEdit->join( aMainSect, aSectNum );
\r
356 mySectionView->sectionsRemoved( aSectNum );
\r
358 int aNewSectSize = myCurve->getNbPoints(aMainSect);
\r
359 if( aNewSectSize != aMainSectSize )
\r
360 mySectionView->pointsAdded( aMainSect, aMainSectSize, aNewSectSize-aMainSectSize );
\r
363 void CurveCreator_Widget::onRemove()
\r
365 QList< QPair<int,int> > aSelPoints = mySectionView->getSelectedPoints();
\r
367 int aRemoveCnt = 0;
\r
368 for( int i = 0 ; i < aSelPoints.size() ; i++ ){
\r
369 if( aCurrSect != aSelPoints[i].first ){
\r
371 aCurrSect = aSelPoints[i].first;
\r
373 int aPntIndx = aSelPoints[i].second - aRemoveCnt;
\r
374 myEdit->removePoints(aCurrSect,aPntIndx, 1);
\r
375 mySectionView->pointsRemoved( aCurrSect, aPntIndx );
\r
378 QList<int> aSections = mySectionView->getSelectedSections();
\r
379 for( int i = 0 ; i < aSections.size() ; i++ ){
\r
380 int aSectNum = aSections[i] - (i);
\r
381 myEdit->removeSection( aSectNum );
\r
382 mySectionView->sectionsRemoved( aSectNum );
\r
384 mySectionView->clearSelection();
\r
387 void CurveCreator_Widget::onMoveUp()
\r
389 if( mySectionView->getSelectionType() == CurveCreator_TreeView::ST_SECTIONS ){
\r
391 QList<int> aSections = mySectionView->getSelectedSections();
\r
392 for( int i = 0 ; i < aSections.size() ; i++ ){
\r
393 int anIndx = aSections[i];
\r
394 myEdit->moveSection( anIndx, anIndx-1);
\r
395 mySectionView->sectionsSwapped( anIndx, -1 );
\r
400 QList< QPair<int,int> > aPoints = mySectionView->getSelectedPoints();
\r
401 for( int i = 0 ; i < aPoints.size() ; i++ ){
\r
402 int aSection = aPoints[i].first;
\r
403 int aPoint = aPoints[i].second;
\r
404 myEdit->movePoint(aSection, aPoint, aPoint-2);
\r
405 mySectionView->pointsSwapped( aSection, aPoint, -1 );
\r
410 void CurveCreator_Widget::onMoveDown()
\r
412 if( mySectionView->getSelectionType() == CurveCreator_TreeView::ST_SECTIONS ){
\r
414 QList<int> aSections = mySectionView->getSelectedSections();
\r
415 for( int i = aSections.size()-1 ; i >=0 ; i-- ){
\r
416 int anIndx = aSections[i];
\r
417 myEdit->moveSection( anIndx, anIndx+1);
\r
418 mySectionView->sectionsSwapped( anIndx, 1 );
\r
423 QList< QPair<int,int> > aPoints = mySectionView->getSelectedPoints();
\r
424 for( int i = aPoints.size() - 1; i >= 0 ; i-- ){
\r
425 int aSection = aPoints[i].first;
\r
426 int aPoint = aPoints[i].second;
\r
427 myEdit->movePoint(aSection, aPoint, aPoint+1);
\r
428 mySectionView->pointsSwapped( aSection, aPoint, 1 );
\r
433 void CurveCreator_Widget::onClearAll()
\r
436 mySectionView->reset();
\r
437 onSelectionChanged();
\r
440 void CurveCreator_Widget::onJoinAll()
\r
443 mySectionView->reset();
\r
444 onSelectionChanged();
\r
447 void CurveCreator_Widget::onInsertSectionBefore()
\r
452 void CurveCreator_Widget::onInsertSectionAfter()
\r
457 void CurveCreator_Widget::onInsertPointBefore()
\r
462 void CurveCreator_Widget::onInsertPointAfter()
\r
467 void CurveCreator_Widget::onUndoSettings()
\r
472 void CurveCreator_Widget::onSetSpline()
\r
474 QList<int> aSelSections = mySectionView->getSelectedSections();
\r
475 for( int i = 0 ; i < aSelSections.size() ; i++ ){
\r
476 myEdit->setType(CurveCreator::BSpline, aSelSections[i]);
\r
477 mySectionView->sectionChanged(aSelSections[i]);
\r
481 void CurveCreator_Widget::onSetPolyline()
\r
483 QList<int> aSelSections = mySectionView->getSelectedSections();
\r
484 for( int i = 0 ; i < aSelSections.size() ; i++ ){
\r
485 myEdit->setType(CurveCreator::Polyline, aSelSections[i]);
\r
486 mySectionView->sectionChanged(aSelSections[i]);
\r
490 void CurveCreator_Widget::onCloseSections()
\r
492 QList<int> aSelSections = mySectionView->getSelectedSections();
\r
493 for( int i = 0 ; i < aSelSections.size() ; i++ ){
\r
494 myEdit->setClosed(true, aSelSections[i]);
\r
495 mySectionView->sectionChanged(aSelSections[i]);
\r
499 void CurveCreator_Widget::onUncloseSections()
\r
501 QList<int> aSelSections = mySectionView->getSelectedSections();
\r
502 for( int i = 0 ; i < aSelSections.size() ; i++ ){
\r
503 myEdit->setClosed(false, aSelSections[i]);
\r
504 mySectionView->sectionChanged(aSelSections[i]);
\r
508 void CurveCreator_Widget::onContextMenu( QPoint thePoint )
\r
510 QList<ActionId> aContextActions;
\r
511 aContextActions << CLEAR_ALL_ID << JOIN_ALL_ID << SEPARATOR_ID <<
\r
512 INSERT_SECTION_BEFORE_ID << INSERT_SECTION_AFTER_ID << SEPARATOR_ID <<
\r
513 CLOSE_SECTIONS_ID << UNCLOSE_SECTIONS_ID << SET_SECTIONS_POLYLINE_ID <<
\r
514 SET_SECTIONS_SPLINE_ID << SEPARATOR_ID <<
\r
515 INSERT_POINT_BEFORE_ID << INSERT_POINT_AFTER_ID;
\r
516 QPoint aGlPoint = mySectionView->mapToGlobal(thePoint);
\r
517 bool isVis = false;
\r
518 QList<ActionId> aResAct;
\r
519 for( int i = 0 ; i < aContextActions.size() ; i++ ){
\r
520 if( aContextActions[i] != SEPARATOR_ID ){
\r
521 if( myActionMap.contains(aContextActions[i]) ){
\r
522 QAction* anAct = myActionMap[aContextActions[i]];
\r
523 if( anAct->isEnabled() ){
\r
524 aResAct << aContextActions[i];
\r
530 aResAct << SEPARATOR_ID;
\r
536 QMenu* aMenu = new QMenu(this);
\r
537 for( int i = 0 ; i < aResAct.size() ; i++ ){
\r
538 if( aResAct[i] == SEPARATOR_ID ){
\r
539 aMenu->addSeparator();
\r
542 QAction* anAct = myActionMap[aResAct[i]];
\r
543 aMenu->insertAction(NULL, anAct);
\r
546 aMenu->exec(aGlPoint);
\r