#include "HYDROGUI_VTKPrs.h"
#include "HYDROGUI_VTKPrsDisplayer.h"
#include "HYDROGUI_AbstractDisplayer.h"
+#include "HYDROGUI_PolylineOp.h"
#include <HYDROData_Image.h>
#include <HYDROData_Lambert93.h>
}
}
+ if ( anIsOCCView )
+ {
+ SUIT_Operation* anOp = application()->activeStudy()->activeOperation();
+ HYDROGUI_PolylineOp* aPolylineOp = dynamic_cast<HYDROGUI_PolylineOp*>( anOp );
+ if ( aPolylineOp && aPolylineOp->deleteEnabled() )
+ theMenu->addAction( action( DeleteId ) );
+ }
+
if( anIsObjectBrowser || anIsGraphicsView || anIsOCCView || anIsVTKView )
{
theMenu->addAction( action( ShowAllId ) );
protected slots:
void onOperation();
+ void onDelete();
+
bool onUndo( int theNumActions );
bool onRedo( int theNumActions );
createAction( SplitImageId, "SPLIT_IMAGE" );
createAction( EditSplittedImageId, "EDIT_SPLITTED_IMAGE" );
- createAction( DeleteId, "DELETE", "", Qt::Key_Delete );
+ createAction( DeleteId, "DELETE", "", Qt::Key_Delete, false,
+ SLOT( onDelete() ) );
createAction( SetColorId, "COLOR" );
startOperation( anId );
}
+void HYDROGUI_Module::onDelete()
+{
+ SUIT_Operation* anOp = application()->activeStudy()->activeOperation();
+ HYDROGUI_PolylineOp* aPolylineOp = dynamic_cast<HYDROGUI_PolylineOp*>( anOp );
+ if ( aPolylineOp && aPolylineOp->deleteEnabled() )
+ aPolylineOp->deleteSelected();
+ else
+ startOperation( DeleteId );
+}
+
bool HYDROGUI_Module::onUndo( int theNumActions )
{
QApplication::setOverrideCursor( Qt::WaitCursor );
{
return myEditorWidget->getSelectedPoints();
}
+
+/**
+ * Redirect the delete action to editor widget
+ */
+void HYDROGUI_PolylineDlg::deleteSelected()
+{
+ myEditorWidget->removeSelected();
+}
+
+/**
+ * Checks whether there are some to delete
+ */
+bool HYDROGUI_PolylineDlg::deleteEnabled()
+{
+ return myEditorWidget->removeEnabled();
+}
QList<int> getSelectedSections();
QList< QPair< int, int > > getSelectedPoints();
+ void deleteSelected();
+ bool deleteEnabled();
+
protected slots:
void processStartedSubOperation( QWidget* );
void processFinishedSubOperation( QWidget* );
erasePreview();
}
+/**
+ * Redirect the delete action to input panel
+ */
+void HYDROGUI_PolylineOp::deleteSelected()
+{
+ HYDROGUI_PolylineDlg* aPanel = (HYDROGUI_PolylineDlg*)inputPanel();
+ aPanel->deleteSelected();
+}
+
+/**
+ * Checks whether there are some to delete
+ */
+bool HYDROGUI_PolylineOp::deleteEnabled()
+{
+ HYDROGUI_PolylineDlg* aPanel = (HYDROGUI_PolylineDlg*)inputPanel();
+ return aPanel->deleteEnabled();
+}
+
void HYDROGUI_PolylineOp::startOperation()
{
if( myCurve )
HYDROGUI_PolylineOp( HYDROGUI_Module* theModule, bool isEdit );
virtual ~HYDROGUI_PolylineOp();
+ void deleteSelected();
+ bool deleteEnabled();
+
protected:
virtual void startOperation();
virtual void abortOperation();