VisuGUI_InputPanel.cxx \
VisuGUI_BasePanel.cxx \
VisuGUI_SelectionPanel.cxx \
+ VisuGUI_SelectionPrefDlg.cxx \
VisuGUI_GaussPointsSelectionPane.cxx \
VisuGUI_Tools.cxx \
VisuGUI_ViewTools.cxx \
VisuGUI_InputPanel_moc.cxx \
VisuGUI_BasePanel_moc.cxx \
VisuGUI_SelectionPanel_moc.cxx \
+ VisuGUI_SelectionPrefDlg_moc.cxx \
VisuGUI_GaussPointsSelectionPane_moc.cxx \
VisuGUI_NameDlg_moc.cxx \
VisuGUI_FileDlg_moc.cxx \
</context>
<context>
<name>VisuGUI_GaussPointsSelectionPane</name>
- <message>
- <source>CURSOR_SIZE</source>
- <translation>Size of the cursor:</translation>
- </message>
- <message>
- <source>CURSOR_TITLE</source>
- <translation>Cursor</translation>
- </message>
<message>
<source>DISPLAY_PARENT_MESH</source>
<translation>Display parent mesh element</translation>
</message>
- <message>
- <source>PARENT_MESH_TITLE</source>
- <translation>Parent mesh element</translation>
- </message>
<message>
<source>PICKING_DLG_TITLE</source>
<translation>Picking</translation>
</message>
- <message>
- <source>POINT_TOLERANCE</source>
- <translation>Point tolerance:</translation>
- </message>
- <message>
- <source>PYRAMID_HEIGHT</source>
- <translation>Height of the pyramids:</translation>
- </message>
- <message>
- <source>SELECTION_COLOR</source>
- <translation>Selection cursor color:</translation>
- </message>
- <message>
- <source>TOLERANCE_TITLE</source>
- <translation>Tolerance</translation>
- </message>
<message>
<source>DATA_POSITION</source>
<translation>Position</translation>
<source>ACTOR_DATA_SIZE_TITLE</source>
<translation>Size</translation>
</message>
+ <message>
+ <source>SELECTION_PREFERENCES</source>
+ <translation>Selection preferences...</translation>
+ </message>
+ </context>
+ <context>
+ <name>VisuGUI_SelectionPrefDlg</name>
+ <message>
+ <source>TLT_SELECTION_PREFERENCES</source>
+ <translation>Selection preferences</translation>
+ </message>
<message>
<source>BELOW_POINT</source>
<translation>Centered</translation>
<source>CAMERA_TITLE</source>
<translation>Movement of the camera</translation>
</message>
+ <message>
+ <source>CURSOR_SIZE</source>
+ <translation>Size of the cursor:</translation>
+ </message>
+ <message>
+ <source>CURSOR_TITLE</source>
+ <translation>Cursor</translation>
+ </message>
<message>
<source>INFO_WINDOW_TITLE</source>
<translation>Information window</translation>
</message>
+ <message>
+ <source>POINT_TOLERANCE</source>
+ <translation>Point tolerance:</translation>
+ </message>
<message>
<source>POSITION</source>
<translation>Position:</translation>
</message>
+ <message>
+ <source>PYRAMID_HEIGHT</source>
+ <translation>Height of the pyramids:</translation>
+ </message>
+ <message>
+ <source>SELECTION_COLOR</source>
+ <translation>Selection cursor color:</translation>
+ </message>
<message>
<source>STEP_NUMBER</source>
<translation>Number of steps:</translation>
<source>STEP_NUMBER_TIP</source>
<translation>Number of steps between two positions</translation>
</message>
+ <message>
+ <source>TOLERANCE_TITLE</source>
+ <translation>Tolerance</translation>
+ </message>
<message>
<source>TOP_LEFT_CORNER</source>
<translation>Top-left corner</translation>
#include <QVBoxLayout>
#include <QKeyEvent>
#include <QIntValidator>
-
-#include "QtxAction.h"
-#include "QtxDoubleSpinBox.h"
-#include "QtxIntSpinBox.h"
-#include "QtxColorButton.h"
+#include <QToolButton>
#include "LightApp_Application.h"
BoxLayout->setMargin(0);
BoxLayout->setSpacing(6);
- // Cursor
- QGroupBox* CursorGroup = new QGroupBox( tr( "CURSOR_TITLE" ), aBox );
- QGridLayout* CursorGroupLayout = new QGridLayout (CursorGroup);
- CursorGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
- CursorGroupLayout->setSpacing(6);
- CursorGroupLayout->setMargin(11);
-
- QLabel* CursorSizeLabel = new QLabel( tr( "CURSOR_SIZE" ), CursorGroup );
- myCursorSizeSpinBox = new QtxDoubleSpinBox( 0, 1, 0.1, CursorGroup );
- myCursorSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-
- QLabel* PyramidHeightLabel = new QLabel( tr( "PYRAMID_HEIGHT" ), CursorGroup );
- double aHeightMin=1.e-7;
- double aHeightMax=10.;
- double aHeightStep=0.1;
- myPyramidHeightSpinBox = new QtxDoubleSpinBox(aHeightMin, aHeightMax, aHeightStep, CursorGroup );
- myPyramidHeightSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-
- QLabel* SelectionColorLabel = new QLabel( tr( "SELECTION_COLOR" ), CursorGroup );
- mySelectionColorButton = new QtxColorButton( CursorGroup );
- mySelectionColorButton->setColor( Qt::blue );
-
- CursorGroupLayout->addWidget( CursorSizeLabel, 0, 0 );
- CursorGroupLayout->addWidget( myCursorSizeSpinBox, 0, 1 );
- CursorGroupLayout->addWidget( PyramidHeightLabel, 1, 0 );
- CursorGroupLayout->addWidget( myPyramidHeightSpinBox, 1, 1 );
- CursorGroupLayout->addWidget( SelectionColorLabel, 2, 0 );
- CursorGroupLayout->addWidget( mySelectionColorButton, 2, 1 );
-
- BoxLayout->addWidget( CursorGroup );
-
- connect( myCursorSizeSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( onApplyCursorSize( double ) ) );
- connect( myPyramidHeightSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( onApplyPyramidHeight( double ) ) );
- connect( mySelectionColorButton, SIGNAL( changed( QColor )), this, SLOT( onApplySelectionColor( QColor ) ) );
-
- // Tolerance
- QGroupBox* ToleranceGroup = new QGroupBox( tr( "TOLERANCE_TITLE" ), aBox );
- QGridLayout* ToleranceGroupLayout = new QGridLayout (ToleranceGroup);
- ToleranceGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
- ToleranceGroupLayout->setSpacing(6);
- ToleranceGroupLayout->setMargin(11);
-
- QLabel* PointToleranceLabel = new QLabel( tr( "POINT_TOLERANCE" ), ToleranceGroup );
- myPointToleranceSpinBox = new QtxDoubleSpinBox( 0.001, 10.0, 0.01, ToleranceGroup );
- myPointToleranceSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-
- ToleranceGroupLayout->addWidget( PointToleranceLabel, 0, 0 );
- ToleranceGroupLayout->addWidget( myPointToleranceSpinBox, 0, 1 );
-
- BoxLayout->addWidget( ToleranceGroup );
-
- connect( myPointToleranceSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( onApplyPointTolerance( double ) ) );
-
// Display parent mesh element
QGroupBox* PositionGroup = new QGroupBox( tr( "DATA_POSITION" ), aBox );
QGridLayout* PositionGroupLayout = new QGridLayout (PositionGroup);
void VisuGUI_GaussPointsSelectionPane::Update()
{
- //printf( "VisuGUI_GaussPointsSelectionPane::Update()\n" );
VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
- myCursorSizeSpinBox->setValue( aPickingSettings->GetCursorSize() );
- myPyramidHeightSpinBox->setValue( aPickingSettings->GetPyramidHeight() );
- myPointToleranceSpinBox->setValue( aPickingSettings->GetPointTolerance() );
myDisplayParentMeshCheckBox->setChecked( aPickingSettings->GetDisplayParentMesh() );
-
- vtkFloatingPointType* aColor = aPickingSettings->GetColor();
- mySelectionColorButton->setColor( QColor( ( int )( aColor[0] * 255.0 ),
- ( int )( aColor[1] * 255.0 ),
- ( int )( aColor[2] * 255.0 ) ) );
}
void VisuGUI_GaussPointsSelectionPane::SetInteractor( SVTK_RenderWindowInteractor* theInteractor )
void VisuGUI_GaussPointsSelectionPane::Apply()
{
- /*
- VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
- aPickingSettings->SetCursorSize( myCursorSizeSpinBox->value() );
- aPickingSettings->SetPyramidHeight( myPyramidHeightSpinBox->value() );
- aPickingSettings->SetPointTolerance( myPointToleranceSpinBox->value() );
- aPickingSettings->SetDisplayParentMesh( myDisplayParentMeshCheckBox->isChecked() );
-
- QColor aButtonColor = mySelectionColorButton->color();
- vtkFloatingPointType aColor[3];
- aColor[0] = aButtonColor.red() / 255.0;
- aColor[1] = aButtonColor.green() / 255.0;
- aColor[2] = aButtonColor.blue() / 255.0;
- aPickingSettings->SetColor( aColor );
-
- aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
- */
onSelectionApply();
}
-void VisuGUI_GaussPointsSelectionPane::onApplyCursorSize( double theValue )
-{
- VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
- aPickingSettings->SetCursorSize( theValue );
- aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
-}
-
-void VisuGUI_GaussPointsSelectionPane::onApplyPyramidHeight( double theValue )
-{
- VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
- aPickingSettings->SetPyramidHeight( theValue );
- aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
-}
-
-void VisuGUI_GaussPointsSelectionPane::onApplySelectionColor( QColor theValue )
-{
- VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
- vtkFloatingPointType aColor[3];
- aColor[0] = theValue.red() / 255.0;
- aColor[1] = theValue.green() / 255.0;
- aColor[2] = theValue.blue() / 255.0;
- aPickingSettings->SetColor( aColor );
- aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
-}
-
-void VisuGUI_GaussPointsSelectionPane::onApplyPointTolerance( double theValue )
-{
- VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
- aPickingSettings->SetPointTolerance( theValue );
- aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
-}
-
void VisuGUI_GaussPointsSelectionPane::onApplyDisplayParentMesh( bool theValue )
{
VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
class QPushButton;
class QtxAction;
-class QtxDoubleSpinBox;
-class QtxIntSpinBox;
-class QtxColorButton;
class VISU_GaussPtsAct;
class VISU_PickingSettings;
void onSelectionApply();
private slots:
- void onApplyCursorSize( double );
- void onApplyPyramidHeight( double );
- void onApplySelectionColor( QColor );
- void onApplyPointTolerance( double );
void onApplyDisplayParentMesh( bool );
private:
private:
const SalomeApp_Module* myModule;
- QtxDoubleSpinBox* myCursorSizeSpinBox;
- QtxDoubleSpinBox* myPyramidHeightSpinBox;
- QtxColorButton* mySelectionColorButton;
- QtxDoubleSpinBox* myPointToleranceSpinBox;
QCheckBox* myDisplayParentMeshCheckBox;
- QtxAction* myAction;
-
VisuGUI_ValidatedLineEdit* myParentElementLineEdit;
VisuGUI_ValidatedLineEdit* myLocalPointLineEdit;
#include "VisuGUI.h"
#include "VisuGUI_Tools.h"
#include "VisuGUI_ViewTools.h"
+#include "VisuGUI_SelectionPrefDlg.h"
#include "VisuGUI_GaussPointsSelectionPane.h"
#include "VISU_Event.h"
#include "SVTK_Selector.h"
#include "SVTK_RenderWindowInteractor.h"
-#include "QtxDoubleSpinBox.h"
-#include "QtxIntSpinBox.h"
-
#include "utilities.h"
// OCCT Includes
VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const SalomeApp_Module* theModule, QWidget* theParent ) :
VisuGUI_BasePanel( tr("WINDOW_TITLE" ), theParent, /*ApplyBtn | */CloseBtn | HelpBtn ),
myModule( theModule ),
- mySelectionMgr( 0 )
+ mySelectionMgr( 0 ),
+ myPreferencesDlg( 0 )
{
QVBoxLayout* TopLayout = new QVBoxLayout ( mainFrame() );
//TopLayout->setSpacing(6);
aVBoxLayout->addStretch();
// Gauss Points Pane
- QScrollArea* aGaussPointsScrollArea = new QScrollArea( mainFrame() );
- myGaussPointsPane = new VisuGUI_GaussPointsSelectionPane( myModule, aGaussPointsScrollArea );
-
- aGaussPointsScrollArea->setWidget( myGaussPointsPane );
- aGaussPointsScrollArea->setAlignment( Qt::AlignCenter );
- aGaussPointsScrollArea->setWidgetResizable( true );
- aGaussPointsScrollArea->setMinimumWidth( myGaussPointsPane->sizeHint().width() + MARGIN_SIZE );
+ myGaussPointsPane = new VisuGUI_GaussPointsSelectionPane( myModule, mainFrame() );
// Add panes to tab widget
myTabWidget->addTab(myActorsPane, tr("MODE_ACTOR"));
myTabWidget->addTab(myCellsPane, tr("MODE_CELL"));
myTabWidget->addTab(myPointsPane, tr("MODE_POINT"));
- myTabWidget->addTab(aGaussPointsScrollArea, tr("MODE_GAUSS_POINT"));
-
- connect(myTabWidget, SIGNAL(currentChanged(int)), this, SLOT(onSelectionModeChanged(int)));
-
- TopLayout->addWidget(myTabWidget);
-
- // Information window
- myInfoWindowGroup = new QGroupBox( tr( "INFO_WINDOW_TITLE" ), mainFrame() );
- myInfoWindowGroup->setCheckable( true );
-
- QGridLayout* InfoWindowGroupLayout = new QGridLayout (myInfoWindowGroup);
- InfoWindowGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
- //InfoWindowGroupLayout->setSpacing(6);
- //InfoWindowGroupLayout->setMargin(11);
-
- QLabel* TransparencyLabel = new QLabel( tr( "TRANSPARENCY" ), myInfoWindowGroup );
- myTransparencySpinBox = new QtxIntSpinBox( 0, 100, 10, myInfoWindowGroup );
- //myTransparencySpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-
- InfoWindowGroupLayout->addWidget( TransparencyLabel, 0, 0 );
- InfoWindowGroupLayout->addWidget( myTransparencySpinBox, 0, 1 );
-
- QLabel* PositionLabel = new QLabel( tr( "POSITION" ), myInfoWindowGroup );
- myPositionComboBox = new QComboBox( myInfoWindowGroup );
- //myPositionComboBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-
- myPositionComboBox->addItem( tr( "BELOW_POINT" ) );
- myPositionComboBox->addItem( tr( "TOP_LEFT_CORNER" ) );
-
- InfoWindowGroupLayout->addWidget( TransparencyLabel, 0, 0 );
- InfoWindowGroupLayout->addWidget( myTransparencySpinBox, 0, 1 );
- InfoWindowGroupLayout->addWidget( PositionLabel, 1, 0 );
- InfoWindowGroupLayout->addWidget( myPositionComboBox, 1, 1 );
-
- TopLayout->addWidget( myInfoWindowGroup );
-
- connect( myInfoWindowGroup, SIGNAL( toggled( bool ) ), this, SLOT( onApplyInfoWindow( bool ) ) );
- connect( myTransparencySpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( onApplyTransparency( int ) ) );
- connect( myPositionComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onApplyPosition( int ) ) );
-
- // Movement of the camera
- myCameraGroup = new QGroupBox( tr( "CAMERA_TITLE" ), mainFrame() );
- myCameraGroup->setCheckable( true );
-
- QGridLayout* CameraGroupLayout = new QGridLayout (myCameraGroup);
- CameraGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
- //CameraGroupLayout->setSpacing(6);
- //CameraGroupLayout->setMargin(11);
-
- QLabel* ZoomFactorLabel = new QLabel( tr( "ZOOM_FACTOR" ), myCameraGroup );
- myZoomFactorSpinBox = new QtxDoubleSpinBox( 0.1, 10.0, 0.1, myCameraGroup );
- //myZoomFactorSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-
- QLabel* StepNumberLabel = new QLabel( tr( "STEP_NUMBER" ), myCameraGroup );
- StepNumberLabel->setToolTip( tr( "STEP_NUMBER_TIP" ) );
- myStepNumberSpinBox = new QtxIntSpinBox( 1, 100, 1, myCameraGroup );
- //myStepNumberSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myTabWidget->addTab(myGaussPointsPane, tr("MODE_GAUSS_POINT"));
- CameraGroupLayout->addWidget( ZoomFactorLabel, 0, 0 );
- CameraGroupLayout->addWidget( myZoomFactorSpinBox, 0, 1 );
- CameraGroupLayout->addWidget( StepNumberLabel, 1, 0 );
- CameraGroupLayout->addWidget( myStepNumberSpinBox, 1, 1 );
+ connect( myTabWidget, SIGNAL( currentChanged( int ) ), this, SLOT( onSelectionModeChanged( int ) ) );
- TopLayout->addWidget( myCameraGroup );
+ TopLayout->addWidget( myTabWidget );
- connect( myCameraGroup, SIGNAL( toggled( bool ) ), this, SLOT( onApplyCamera( bool ) ) );
- connect( myZoomFactorSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( onApplyZoomFactor( double ) ) );
- connect( myStepNumberSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( onApplyStepNumber( int ) ) );
+ // Preferences button
+ QPushButton* aPrefBtn = new QPushButton( tr( "SELECTION_PREFERENCES" ), mainFrame() );
+ connect( aPrefBtn, SIGNAL( clicked() ), this, SLOT( onPreferences() ) );
+ TopLayout->addWidget( aPrefBtn );
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
(SUIT_Session::session()->activeApplication());
VisuGUI_SelectionPanel::~VisuGUI_SelectionPanel()
{
+ if( myPreferencesDlg )
+ {
+ delete myPreferencesDlg;
+ myPreferencesDlg = 0;
+ }
}
-void VisuGUI_SelectionPanel::update()
+VisuGUI_SelectionPrefDlg* VisuGUI_SelectionPanel::preferencesDlg()
{
- VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
-
- myInfoWindowGroup->setChecked( aPickingSettings->GetInfoWindowEnabled() );
- myTransparencySpinBox->setValue( int(aPickingSettings->GetInfoWindowTransparency() * 100.0) );
- myPositionComboBox->setCurrentIndex( aPickingSettings->GetInfoWindowPosition() );
- myCameraGroup->setChecked( aPickingSettings->GetCameraMovementEnabled() );
- myZoomFactorSpinBox->setValue( aPickingSettings->GetZoomFactor() );
- myStepNumberSpinBox->setValue( aPickingSettings->GetStepNumber() );
+ if( !myPreferencesDlg )
+ myPreferencesDlg = new VisuGUI_SelectionPrefDlg();
+ myPreferencesDlg->update();
+ return myPreferencesDlg;
}
void VisuGUI_SelectionPanel::setSelectionMode( int theId )
break;
case 3: // Gauss Points
aViewWindow->SetSelectionMode(GaussPointSelection);
- myGaussPointsPane->Update();
+ myGaussPointsPane->update();
onSelectionEvent();
break;
}
clearFields();
}
-void VisuGUI_SelectionPanel::onApplyInfoWindow( bool theValue )
-{
- VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
- aPickingSettings->SetInfoWindowEnabled( theValue );
- aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
-}
-
-void VisuGUI_SelectionPanel::onApplyTransparency( int theValue )
-{
- VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
- aPickingSettings->SetInfoWindowTransparency( theValue / 100.0 );
- aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
-}
-
-void VisuGUI_SelectionPanel::onApplyPosition( int theValue )
-{
- VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
- aPickingSettings->SetInfoWindowPosition( theValue );
- aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
-}
-
-void VisuGUI_SelectionPanel::onApplyCamera( bool theValue )
-{
- VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
- aPickingSettings->SetCameraMovementEnabled( theValue );
- aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
-}
-
-void VisuGUI_SelectionPanel::onApplyZoomFactor( double theValue )
-{
- VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
- aPickingSettings->SetZoomFactor( theValue );
- aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
-}
-
-void VisuGUI_SelectionPanel::onApplyStepNumber( int theValue )
+void VisuGUI_SelectionPanel::onPreferences()
{
- VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
- aPickingSettings->SetStepNumber( theValue );
- aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
+ preferencesDlg()->exec();
}
void VisuGUI_SelectionPanel::onApply()
#include <vtkSmartPointer.h>
class QComboBox;
-class QGroupBox;
class QLabel;
class QLineEdit;
class QTableWidget;
class QTabWidget;
-class QtxDoubleSpinBox;
-class QtxIntSpinBox;
-
class LightApp_SelectionMgr;
class SalomeApp_Application;
class SalomeApp_Module;
class SVTK_RenderWindowInteractor;
class VisuGUI_GaussPointsSelectionPane;
+class VisuGUI_SelectionPrefDlg;
class VisuGUI_SelectionPanel: public VisuGUI_BasePanel
{
virtual ~VisuGUI_SelectionPanel ();
public:
- void update();
-
void setSelectionMode( int theId );
private:
virtual void onClose();
virtual void onHelp();
- void onApplyInfoWindow( bool );
- void onApplyTransparency( int );
- void onApplyPosition( int );
- void onApplyCamera( bool );
- void onApplyZoomFactor( double );
- void onApplyStepNumber( int );
+ void onPreferences();
void onSelectionModeChanged( int theId );
void onSelectionEvent();
void selectionModeChanged( int );
private:
+ VisuGUI_SelectionPrefDlg* preferencesDlg();
void clearFields();
private:
VisuGUI_GaussPointsSelectionPane* myGaussPointsPane;
- QGroupBox* myInfoWindowGroup;
- QtxIntSpinBox* myTransparencySpinBox;
- QComboBox* myPositionComboBox;
-
- QGroupBox* myCameraGroup;
- QtxDoubleSpinBox* myZoomFactorSpinBox;
- QtxIntSpinBox* myStepNumberSpinBox;
+ VisuGUI_SelectionPrefDlg* myPreferencesDlg;
const SalomeApp_Module* myModule;
LightApp_SelectionMgr* mySelectionMgr;
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : VisuGUI_SelectionPrefDlg.cxx
+// Author : Oleg UVAROV
+// Module : SALOME
+
+#include "VisuGUI_SelectionPrefDlg.h"
+#include "VisuGUI.h"
+
+#include "VISU_PickingSettings.h"
+
+#include <SUIT_Session.h>
+#include <SUIT_Application.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_Tools.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_ResourceMgr.h>
+
+#include <LightApp_Application.h>
+
+#include <QtxColorButton.h>
+#include <QtxDoubleSpinBox.h>
+#include <QtxIntSpinBox.h>
+
+#include <QComboBox>
+#include <QGroupBox>
+#include <QKeyEvent>
+#include <QLabel>
+#include <QLayout>
+#include <QLineEdit>
+#include <QPushButton>
+
+using namespace std;
+
+/*!
+ Constructor
+*/
+VisuGUI_SelectionPrefDlg::VisuGUI_SelectionPrefDlg( QWidget* parent )
+ : QDialog( parent ? parent : SUIT_Session::session()->activeApplication()->desktop(),
+ Qt::WindowTitleHint | Qt::WindowSystemMenuHint )
+{
+ setWindowTitle( tr("TLT_SELECTION_PREFERENCES") );
+ setSizeGripEnabled( TRUE );
+ setModal( true );
+
+ QVBoxLayout* topLayout = new QVBoxLayout( this );
+ topLayout->setMargin( 11 ); topLayout->setSpacing( 6 );
+
+ // Cursor (gauss points)
+ QGroupBox* CursorGroup = new QGroupBox( tr( "CURSOR_TITLE" ), this );
+ QGridLayout* CursorGroupLayout = new QGridLayout (CursorGroup);
+ CursorGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+ CursorGroupLayout->setSpacing(6);
+ CursorGroupLayout->setMargin(11);
+
+ QLabel* CursorSizeLabel = new QLabel( tr( "CURSOR_SIZE" ), CursorGroup );
+ myCursorSizeSpinBox = new QtxDoubleSpinBox( 0, 1, 0.1, CursorGroup );
+ myCursorSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ QLabel* PyramidHeightLabel = new QLabel( tr( "PYRAMID_HEIGHT" ), CursorGroup );
+ double aHeightMin=1.e-7;
+ double aHeightMax=10.;
+ double aHeightStep=0.1;
+ myPyramidHeightSpinBox = new QtxDoubleSpinBox(aHeightMin, aHeightMax, aHeightStep, CursorGroup );
+ myPyramidHeightSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ QLabel* SelectionColorLabel = new QLabel( tr( "SELECTION_COLOR" ), CursorGroup );
+ mySelectionColorButton = new QtxColorButton( CursorGroup );
+ mySelectionColorButton->setColor( Qt::blue );
+
+ CursorGroupLayout->addWidget( CursorSizeLabel, 0, 0 );
+ CursorGroupLayout->addWidget( myCursorSizeSpinBox, 0, 1 );
+ CursorGroupLayout->addWidget( PyramidHeightLabel, 1, 0 );
+ CursorGroupLayout->addWidget( myPyramidHeightSpinBox, 1, 1 );
+ CursorGroupLayout->addWidget( SelectionColorLabel, 2, 0 );
+ CursorGroupLayout->addWidget( mySelectionColorButton, 2, 1 );
+
+ topLayout->addWidget( CursorGroup );
+
+ // Tolerance (gauss points)
+ QGroupBox* ToleranceGroup = new QGroupBox( tr( "TOLERANCE_TITLE" ), this );
+ QGridLayout* ToleranceGroupLayout = new QGridLayout (ToleranceGroup);
+ ToleranceGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+ ToleranceGroupLayout->setSpacing(6);
+ ToleranceGroupLayout->setMargin(11);
+
+ QLabel* PointToleranceLabel = new QLabel( tr( "POINT_TOLERANCE" ), ToleranceGroup );
+ myPointToleranceSpinBox = new QtxDoubleSpinBox( 0.001, 10.0, 0.01, ToleranceGroup );
+ myPointToleranceSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ ToleranceGroupLayout->addWidget( PointToleranceLabel, 0, 0 );
+ ToleranceGroupLayout->addWidget( myPointToleranceSpinBox, 0, 1 );
+
+ topLayout->addWidget( ToleranceGroup );
+
+ // Information window
+ myInfoWindowGroup = new QGroupBox( tr( "INFO_WINDOW_TITLE" ), this );
+ myInfoWindowGroup->setCheckable( true );
+
+ QGridLayout* InfoWindowGroupLayout = new QGridLayout (myInfoWindowGroup);
+ InfoWindowGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+
+ QLabel* TransparencyLabel = new QLabel( tr( "TRANSPARENCY" ), myInfoWindowGroup );
+ myTransparencySpinBox = new QtxIntSpinBox( 0, 100, 10, myInfoWindowGroup );
+ myTransparencySpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ InfoWindowGroupLayout->addWidget( TransparencyLabel, 0, 0 );
+ InfoWindowGroupLayout->addWidget( myTransparencySpinBox, 0, 1 );
+
+ QLabel* PositionLabel = new QLabel( tr( "POSITION" ), myInfoWindowGroup );
+ myPositionComboBox = new QComboBox( myInfoWindowGroup );
+ myPositionComboBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ myPositionComboBox->addItem( tr( "BELOW_POINT" ) );
+ myPositionComboBox->addItem( tr( "TOP_LEFT_CORNER" ) );
+
+ InfoWindowGroupLayout->addWidget( TransparencyLabel, 0, 0 );
+ InfoWindowGroupLayout->addWidget( myTransparencySpinBox, 0, 1 );
+ InfoWindowGroupLayout->addWidget( PositionLabel, 1, 0 );
+ InfoWindowGroupLayout->addWidget( myPositionComboBox, 1, 1 );
+
+ topLayout->addWidget( myInfoWindowGroup );
+
+ // Movement of the camera
+ myCameraGroup = new QGroupBox( tr( "CAMERA_TITLE" ), this );
+ myCameraGroup->setCheckable( true );
+
+ QGridLayout* CameraGroupLayout = new QGridLayout (myCameraGroup);
+ CameraGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+
+ QLabel* ZoomFactorLabel = new QLabel( tr( "ZOOM_FACTOR" ), myCameraGroup );
+ myZoomFactorSpinBox = new QtxDoubleSpinBox( 0.1, 10.0, 0.1, myCameraGroup );
+ myZoomFactorSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ QLabel* StepNumberLabel = new QLabel( tr( "STEP_NUMBER" ), myCameraGroup );
+ StepNumberLabel->setToolTip( tr( "STEP_NUMBER_TIP" ) );
+ myStepNumberSpinBox = new QtxIntSpinBox( 1, 100, 1, myCameraGroup );
+ myStepNumberSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ CameraGroupLayout->addWidget( ZoomFactorLabel, 0, 0 );
+ CameraGroupLayout->addWidget( myZoomFactorSpinBox, 0, 1 );
+ CameraGroupLayout->addWidget( StepNumberLabel, 1, 0 );
+ CameraGroupLayout->addWidget( myStepNumberSpinBox, 1, 1 );
+
+ topLayout->addWidget( myCameraGroup );
+
+ // Common buttons
+ QGroupBox* GroupButtons = new QGroupBox( this );
+ QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setSpacing( 6 );
+
+ myButtonOk = new QPushButton( GroupButtons );
+ myButtonOk->setText( tr( "BUT_OK" ) );
+ myButtonOk->setAutoDefault( TRUE ); myButtonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( myButtonOk );
+
+ myButtonApply = new QPushButton( GroupButtons );
+ myButtonApply->setText( tr( "BUT_APPLY" ) );
+ myButtonApply->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( myButtonApply );
+
+ GroupButtonsLayout->addStretch();
+
+ myButtonCancel = new QPushButton( GroupButtons );
+ myButtonCancel->setText( tr( "BUT_CANCEL" ) );
+ myButtonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( myButtonCancel );
+
+ myButtonHelp = new QPushButton( GroupButtons );
+ myButtonHelp->setText( tr( "BUT_HELP" ) );
+ myButtonHelp->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( myButtonHelp );
+ /***************************************************************/
+
+ //topLayout->addWidget( GroupC1 );
+ topLayout->addWidget( GroupButtons );
+
+ // signals and slots connections
+ connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( myButtonApply, SIGNAL( clicked() ), this, SLOT( onApply() ) );
+ connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect( myButtonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) );
+
+ /* Move widget on the botton right corner of main widget */
+ SUIT_Tools::centerWidget( this, parent );
+}
+
+/*!
+ Destructor
+*/
+VisuGUI_SelectionPrefDlg::~VisuGUI_SelectionPrefDlg()
+{
+}
+
+void VisuGUI_SelectionPrefDlg::update()
+{
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+
+ myCursorSizeSpinBox->setValue( aPickingSettings->GetCursorSize() );
+ myPyramidHeightSpinBox->setValue( aPickingSettings->GetPyramidHeight() );
+ myPointToleranceSpinBox->setValue( aPickingSettings->GetPointTolerance() );
+
+ vtkFloatingPointType* aColor = aPickingSettings->GetColor();
+ mySelectionColorButton->setColor( QColor( ( int )( aColor[0] * 255.0 ),
+ ( int )( aColor[1] * 255.0 ),
+ ( int )( aColor[2] * 255.0 ) ) );
+
+ myInfoWindowGroup->setChecked( aPickingSettings->GetInfoWindowEnabled() );
+ myTransparencySpinBox->setValue( int(aPickingSettings->GetInfoWindowTransparency() * 100.0) );
+ myPositionComboBox->setCurrentIndex( aPickingSettings->GetInfoWindowPosition() );
+ myCameraGroup->setChecked( aPickingSettings->GetCameraMovementEnabled() );
+ myZoomFactorSpinBox->setValue( aPickingSettings->GetZoomFactor() );
+ myStepNumberSpinBox->setValue( aPickingSettings->GetStepNumber() );
+}
+
+void VisuGUI_SelectionPrefDlg::accept()
+{
+ onApply();
+
+ QDialog::accept();
+}
+
+void VisuGUI_SelectionPrefDlg::onApply()
+{
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+
+ aPickingSettings->SetCursorSize( myCursorSizeSpinBox->value() );
+ aPickingSettings->SetPyramidHeight( myPyramidHeightSpinBox->value() );
+ aPickingSettings->SetPointTolerance( myPointToleranceSpinBox->value() );
+
+ QColor aButtonColor = mySelectionColorButton->color();
+ vtkFloatingPointType aColor[3];
+ aColor[0] = aButtonColor.red() / 255.0;
+ aColor[1] = aButtonColor.green() / 255.0;
+ aColor[2] = aButtonColor.blue() / 255.0;
+ aPickingSettings->SetColor( aColor );
+
+ aPickingSettings->SetInfoWindowEnabled( myInfoWindowGroup->isChecked() );
+ aPickingSettings->SetInfoWindowTransparency( myTransparencySpinBox->value() / 100.0 );
+ aPickingSettings->SetInfoWindowPosition( myPositionComboBox->currentIndex() );
+ aPickingSettings->SetCameraMovementEnabled( myCameraGroup->isChecked() );
+ aPickingSettings->SetZoomFactor( myZoomFactorSpinBox->value() );
+ aPickingSettings->SetStepNumber( myStepNumberSpinBox->value() );
+
+ aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
+}
+
+void VisuGUI_SelectionPrefDlg::onHelp()
+{
+ QString aHelpFileName = "selection_preferences_page.html";
+ LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+ if (app) {
+ VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
+ app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
+ }
+ else {
+ QString platform;
+#ifdef WIN32
+ platform = "winapplication";
+#else
+ platform = "application";
+#endif
+ SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"),
+ QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName) );
+ }
+}
+
+void VisuGUI_SelectionPrefDlg::keyPressEvent( QKeyEvent* e )
+{
+ QDialog::keyPressEvent( e );
+ if ( e->isAccepted() )
+ return;
+
+ if ( e->key() == Qt::Key_F1 )
+ {
+ e->accept();
+ onHelp();
+ }
+}
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : VisuGUI_SelectionPrefDlg.cxx
+// Author : Oleg UVAROV
+// Module : SALOME
+
+#ifndef VisuGUI_SELECTIONPREFDLG_H
+#define VisuGUI_SELECTIONPREFDLG_H
+
+#include <QDialog>
+
+class QComboBox;
+class QGroupBox;
+class QPushButton;
+
+class QtxColorButton;
+class QtxDoubleSpinBox;
+class QtxIntSpinBox;
+
+class VisuGUI_SelectionPrefDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_SelectionPrefDlg( QWidget* parent = 0 );
+ ~VisuGUI_SelectionPrefDlg();
+
+public:
+ void update();
+
+private:
+ void keyPressEvent( QKeyEvent* e );
+
+protected slots:
+ void accept();
+
+ void onApply();
+ void onHelp();
+
+private:
+ QtxDoubleSpinBox* myCursorSizeSpinBox;
+ QtxDoubleSpinBox* myPyramidHeightSpinBox;
+ QtxColorButton* mySelectionColorButton;
+ QtxDoubleSpinBox* myPointToleranceSpinBox;
+
+ QGroupBox* myInfoWindowGroup;
+ QtxIntSpinBox* myTransparencySpinBox;
+ QComboBox* myPositionComboBox;
+
+ QGroupBox* myCameraGroup;
+ QtxDoubleSpinBox* myZoomFactorSpinBox;
+ QtxIntSpinBox* myStepNumberSpinBox;
+
+ QPushButton* myButtonOk;
+ QPushButton* myButtonApply;
+ QPushButton* myButtonCancel;
+ QPushButton* myButtonHelp;
+};
+
+#endif // VisuGUI_SELECTIONPREFDLG_H