X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_PolylineDlg.cxx;h=d5baeb9660feb61d11b168cd08871b40881c5b6f;hb=adf1c2cc49502c366a2637adfcda9c1c71b11887;hp=ef39f2af19e89049bc54a3d7e8ab925f2a82ef4a;hpb=5f1c089db35b75a592625b708921df2320563363;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_PolylineDlg.cxx b/src/HYDROGUI/HYDROGUI_PolylineDlg.cxx index ef39f2af..d5baeb96 100755 --- a/src/HYDROGUI/HYDROGUI_PolylineDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_PolylineDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,28 +21,126 @@ // #include "HYDROGUI_PolylineDlg.h" + +#include "HYDROGUI_Module.h" #include -#include +#include + +#include +#include +#include +#include +#include +#include HYDROGUI_PolylineDlg::HYDROGUI_PolylineDlg( HYDROGUI_Module* theModule, const QString& theTitle ) -: HYDROGUI_InputPanel( theModule, theTitle ) +: HYDROGUI_InputPanel( theModule, theTitle ), myName(NULL) { - CurveCreator_Curve *aStaticCurve = NULL; + QScrollArea* aScrollView = new QScrollArea( this ); + aScrollView->setFrameStyle( QFrame::NoFrame ); + addWidget( aScrollView ); + + QWidget* aContent = new QWidget( aScrollView ); + QVBoxLayout* aCLayout = new QVBoxLayout( aContent ); + aCLayout->setMargin( 0 ); + + aScrollView->setWidget( aContent ); + aScrollView->setWidgetResizable( true ); + + QHBoxLayout* aNameLayout = new QHBoxLayout(); + QLabel* aNameLabel = new QLabel(tr("POLYLINE_NAME_TLT"), aContent); + aNameLayout->addWidget(aNameLabel); + myName = new QLineEdit(aContent); + aNameLayout->addWidget(myName); - aStaticCurve = new CurveCreator_Curve(CurveCreator::Dim3d); + aCLayout->addLayout(aNameLayout); - CurveCreator_Widget *aWidget = - new CurveCreator_Widget( this, aStaticCurve); + myEditorWidget = new CurveCreator_Widget( aContent, NULL ); + aCLayout->addWidget( myEditorWidget, 3 ); - addWidget( aWidget, 0, 0 ); - setRowStretch(); + myAddElementBox = new QGroupBox( tr( "ADD_ELEMENT" ), aContent ); + aCLayout->addWidget( myAddElementBox, 2 ); + + QBoxLayout* anAddElementLayout = new QVBoxLayout( myAddElementBox ); + anAddElementLayout->setMargin( 0 ); + anAddElementLayout->setSpacing( 5 ); + + connect( myEditorWidget, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); + connect( myEditorWidget, SIGNAL( subOperationStarted(QWidget*, bool) ), this, SLOT( processStartedSubOperation(QWidget*, bool) ) ); + connect( myEditorWidget, SIGNAL( subOperationFinished(QWidget*) ), this, SLOT( processFinishedSubOperation(QWidget*) ) ); + + myAddElementBox->hide(); } HYDROGUI_PolylineDlg::~HYDROGUI_PolylineDlg() { } +void HYDROGUI_PolylineDlg::setOCCViewer( OCCViewer_Viewer* theViewer ) +{ + myEditorWidget->setOCCViewer( theViewer ); +} + +void HYDROGUI_PolylineDlg::processStartedSubOperation( QWidget* theWidget, bool theIsEdit ) +{ + myEditorWidget->setEnabled( false ); + + myAddElementBox->setTitle( theIsEdit ? tr( "EDIT_ELEMENT" ) : tr( "ADD_ELEMENT" ) ); + QBoxLayout* anAddElementLayout = dynamic_cast( myAddElementBox->layout() ); + anAddElementLayout->addWidget( theWidget ); + + theWidget->show(); + myAddElementBox->show(); +} + +void HYDROGUI_PolylineDlg::processFinishedSubOperation( QWidget* theWidget ) +{ + myEditorWidget->setEnabled( true ); + + QBoxLayout* anAddElementLayout = dynamic_cast( myAddElementBox->layout() ); + anAddElementLayout->removeWidget( theWidget ); + + theWidget->hide(); + myAddElementBox->hide(); +} + void HYDROGUI_PolylineDlg::reset() { -} \ No newline at end of file +} + +void HYDROGUI_PolylineDlg::setPolylineName( const QString& theName ) +{ + myName->setText(theName); +} + +QString HYDROGUI_PolylineDlg::getPolylineName() const +{ + return myName->text(); +} + +void HYDROGUI_PolylineDlg::setCurve( CurveCreator_ICurve* theCurve ) +{ + myEditorWidget->setCurve( theCurve ); +} + +QList HYDROGUI_PolylineDlg::getSelectedSections() +{ + return myEditorWidget->getSelectedSections(); +} + +/** + * 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(); +}