QList<ActionId> anEnabledAct;
if( myCurve ){
anEnabledAct << NEW_SECTION_ID << MODIFICATION_MODE_ID;
- if ( getActionMode() == ModificationMode )
+ if ( removeEnabled() )
anEnabledAct << REMOVE_ID;
QList<int> aSelSections = mySectionView->getSelectedSections();
QList< QPair< int, int > > aSelPoints = mySectionView->getSelectedPoints();
}*/
if( aSelSections.size() == 1 ){
anEnabledAct << ADDITION_MODE_ID << DETECTION_MODE_ID;
- anEnabledAct << REMOVE_ID;
}
switch ( getActionMode() ) {
case AdditionMode: {
return mySectionView->getSelectedPoints();
}
+/**
+ * According to the widget state, performs the remove action
+ */
+void CurveCreator_Widget::removeSelected()
+{
+ onRemove();
+}
+
+/**
+ * Checks whether there are some selection to be removed
+ */
+bool CurveCreator_Widget::removeEnabled()
+{
+ bool isEnabled = getActionMode() == ModificationMode;
+ if ( !isEnabled ) {
+ QList<int> aSelSections = mySectionView->getSelectedSections();
+ CurveCreator_TreeView::SelectionType aSelType = mySectionView->getSelectionType();
+ isEnabled = aSelType == CurveCreator_TreeView::ST_SECTIONS &&
+ aSelSections.size() == 1;
+ }
+ return isEnabled;
+}
+
+
//=================================================================================
// function : GeometryGUI::onGetCoordsByClick()
// purpose : Manage mouse press events in Additon mode