//
//
// File : SALOMEGUI_NonIsometricDlg.cxx
-// Author : Vasily Rusyaev
+// Author : Vasily Rusyaev
// Module : VISU
-// $Header$
+// $Header$
#include "VisuGUI_NonIsometricDlg.h"
-#include "VisuGUI_Selection.h"
-#include "VisuGUI.h"
+
+#include "VisuGUI_Tools.h"
+
#include "VISU_Actor.h"
#include "VISU_PipeLine.hxx"
-#include "QtxDblSpinBox.h"
-
#include "SalomeApp_Application.h"
-#include "SalomeApp_SelectionMgr.h"
+#include "LightApp_SelectionMgr.h"
+#include "SVTK_ViewWindow.h"
#include "SVTK_RenderWindowInteractor.h"
#include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
#include "SUIT_ViewWindow.h"
-#include "VTKViewer_ViewWindow.h"
-#include "utilities.h"
-#include "SALOME_Selection.h"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SALOME_ListIO.hxx"
+#include "QtxDblSpinBox.h"
+
+#include "utilities.h"
+
#include <qgroupbox.h>
#include <qlabel.h>
#include <qpushbutton.h>
setName("NonIsometricDlg");
setCaption(tr("DLG_TITLE"));
setSizeGripEnabled(TRUE);
-
- SUIT_ViewWindow* sf = VisuGUI::application()->activeViewManager()->getActiveView();
- VTKViewer_ViewWindow* aViewWnd = dynamic_cast<VTKViewer_ViewWindow*>(sf);
+
+ SVTK_ViewWindow* aViewWnd = VISU::GetViewWindow();
// Create layout for this dialog
- QGridLayout* layoutDlg = new QGridLayout( this );
+ QGridLayout* layoutDlg = new QGridLayout (this);
layoutDlg->setSpacing(6);
layoutDlg->setMargin(11);
-
+
// Create croup box with grid layout
- QGroupBox* GroupBox = new QGroupBox( this, "GroupBox" );
- QGridLayout* glGroupBox = new QGridLayout( GroupBox );
+ QGroupBox* GroupBox = new QGroupBox(this, "GroupBox");
+ QGridLayout* glGroupBox = new QGridLayout(GroupBox);
glGroupBox->setMargin(11);
glGroupBox->setSpacing(6);
-
+
// "X" scaling
QLabel* TextLabelX = new QLabel (tr("LBL_X"), GroupBox, "TextLabelX");
- m_sbXcoeff = new QtxDblSpinBox( -DBL_MAX, DBL_MAX, 0.1, GroupBox );
-//m_sbXcoeff->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
- m_sbXcoeff->setMinimumWidth( 80 );
- m_sbXcoeff->setValue( 1.0 );
-
+ m_sbXcoeff = new QtxDblSpinBox(-DBL_MAX, DBL_MAX, 0.1, GroupBox);
+ m_sbXcoeff->setMinimumWidth(80);
+ m_sbXcoeff->setValue(1.0);
+
// "Y" scaling
QLabel* TextLabelY = new QLabel (tr("LBL_Y"), GroupBox, "TextLabelY");
- m_sbYcoeff = new QtxDblSpinBox( -DBL_MAX, DBL_MAX, 0.1, GroupBox );
-//m_sbYcoeff->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
- m_sbYcoeff->setMinimumWidth( 80 );
- m_sbYcoeff->setValue( 1.0 );
-
+ m_sbYcoeff = new QtxDblSpinBox(-DBL_MAX, DBL_MAX, 0.1, GroupBox);
+ m_sbYcoeff->setMinimumWidth(80);
+ m_sbYcoeff->setValue(1.0);
+
// "Z" scaling
QLabel* TextLabelZ = new QLabel (tr("LBL_Z"), GroupBox, "TextLabelZ");
- m_sbZcoeff = new QtxDblSpinBox( -DBL_MAX, DBL_MAX, 0.1, GroupBox );
-//m_sbZcoeff->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
- m_sbZcoeff->setMinimumWidth( 80 );
- m_sbZcoeff->setValue( 1.0 );
+ m_sbZcoeff = new QtxDblSpinBox(-DBL_MAX, DBL_MAX, 0.1, GroupBox);
+ m_sbZcoeff->setMinimumWidth(80);
+ m_sbZcoeff->setValue(1.0);
// Get initial values from the current VTK viewer
- if ( aViewWnd ) {
+ if (aViewWnd) {
double aScaleFactor[3];
aViewWnd->GetScale(aScaleFactor);
m_sbXcoeff -> setValue(aScaleFactor[0]);
}
// Create <Reset> button
- m_bReset = new QPushButton( tr( "&Reset" ), GroupBox, "m_bReset" );
+ m_bReset = new QPushButton(tr("&Reset"), GroupBox, "m_bReset");
// Layout widgets in the group box
- glGroupBox->addWidget( TextLabelX, 0, 0 );
- glGroupBox->addWidget( m_sbXcoeff, 0, 1 );
- glGroupBox->addWidget( TextLabelY, 0, 2 );
- glGroupBox->addWidget( m_sbYcoeff, 0, 3 );
- glGroupBox->addWidget( TextLabelZ, 0, 4 );
- glGroupBox->addWidget( m_sbZcoeff, 0, 5 );
- glGroupBox->addWidget( m_bReset, 0, 6 );
-
+ glGroupBox->addWidget(TextLabelX, 0, 0);
+ glGroupBox->addWidget(m_sbXcoeff, 0, 1);
+ glGroupBox->addWidget(TextLabelY, 0, 2);
+ glGroupBox->addWidget(m_sbYcoeff, 0, 3);
+ glGroupBox->addWidget(TextLabelZ, 0, 4);
+ glGroupBox->addWidget(m_sbZcoeff, 0, 5);
+ glGroupBox->addWidget(m_bReset, 0, 6);
+
// OK, CANCEL, Apply button
- QGroupBox* aWgt = new QGroupBox( this );
- QHBoxLayout* aHBoxLayout = new QHBoxLayout( aWgt );
+ QGroupBox* aWgt = new QGroupBox(this);
+ QHBoxLayout* aHBoxLayout = new QHBoxLayout(aWgt);
aHBoxLayout->setMargin(11);
aHBoxLayout->setSpacing(6);
// Create <OK> button
- QPushButton* m_bOk = new QPushButton( tr( "O&K" ), aWgt, "m_bOk" );
- m_bOk->setDefault( TRUE );
- m_bOk->setAutoDefault( TRUE );
+ QPushButton* m_bOk = new QPushButton(tr("O&K"), aWgt, "m_bOk");
+ m_bOk->setDefault(TRUE);
+ m_bOk->setAutoDefault(TRUE);
// Create <Apply> button
- QPushButton* m_bApply = new QPushButton( tr( "&Apply" ), aWgt, "m_bApply" );
- m_bApply->setAutoDefault( TRUE );
+ QPushButton* m_bApply = new QPushButton(tr("&Apply"), aWgt, "m_bApply");
+ m_bApply->setAutoDefault(TRUE);
// Create <Cancel> button
- QPushButton* m_bCancel = new QPushButton( tr( "&Cancel" ), aWgt, "m_bCancel" );
- m_bCancel->setAutoDefault( TRUE );
+ QPushButton* m_bCancel = new QPushButton(tr("&Cancel"), aWgt, "m_bCancel");
+ m_bCancel->setAutoDefault(TRUE);
// Layout buttons
- aHBoxLayout->addWidget( m_bOk );
- aHBoxLayout->addWidget( m_bApply );
+ aHBoxLayout->addWidget(m_bOk);
+ aHBoxLayout->addWidget(m_bApply);
aHBoxLayout->addStretch();
- aHBoxLayout->addWidget( m_bCancel );
+ aHBoxLayout->addWidget(m_bCancel);
// Layout top level widgets
layoutDlg->addWidget(GroupBox,0,0);
layoutDlg->addWidget(aWgt,1,0);
// signals and slots connections
- connect( m_bCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
- connect( m_bOk, SIGNAL( clicked() ), this, SLOT( onClickOk( ) ) );
- connect( m_bApply, SIGNAL( clicked() ), this, SLOT( onClickApply( ) ) );
- connect( m_bReset, SIGNAL( clicked() ), this, SLOT( onClickReset( ) ) );
-
- this->resize( 100, this->sizeHint().height() );
+ connect(m_bCancel, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(m_bOk, SIGNAL(clicked()), this, SLOT(onClickOk()));
+ connect(m_bApply, SIGNAL(clicked()), this, SLOT(onClickApply()));
+ connect(m_bReset, SIGNAL(clicked()), this, SLOT(onClickReset()));
+
+ this->resize(100, this->sizeHint().height());
}
-/*
+/*
* Destroys the object and frees any allocated resources
*/
VisuGUI_NonIsometricDlg::~VisuGUI_NonIsometricDlg()
{
- // no need to delete child widgets, Qt does it all for us
+ // no need to delete child widgets, Qt does it all for us
}
void VisuGUI_NonIsometricDlg::onClickOk()
accept();
}
-void VisuGUI_NonIsometricDlg::onClickApply(){
- SUIT_ViewWindow* sf = VisuGUI::application()->activeViewManager()->getActiveView();
- SalomeApp_SelectionMgr* mgr = VisuGUI::application()->selectionMgr();
-
+void VisuGUI_NonIsometricDlg::onClickApply()
+{
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
+ (SUIT_Session::session()->activeApplication());
+ LightApp_SelectionMgr* mgr = anApp->selectionMgr();
- VTKViewer_ViewWindow* vf = dynamic_cast<VTKViewer_ViewWindow*>(sf);
- if( !vf )
+ SVTK_ViewWindow* vf = VISU::GetViewWindow();
+ if (!vf)
return;
-
+
double aScale[3] = {m_sbXcoeff->value(), m_sbYcoeff->value(), m_sbZcoeff->value()};
vf->SetScale(aScale);
SALOME_ListIO selected;
- mgr->selectedObjects( selected );
- SALOME_ListIteratorOfListIO Itinit( selected );
- SVTK_RenderWindowInteractor* rw = dynamic_cast<SVTK_RenderWindowInteractor*>( vf->getRWInteractor() );
+ mgr->selectedObjects(selected);
+ SALOME_ListIteratorOfListIO Itinit(selected);
- if( rw )
+ if (vf)
for (; Itinit.More(); Itinit.Next()) {
- rw->highlight(Itinit.Value(), true);
+ vf->highlight(Itinit.Value(), true);
}
}
void VisuGUI_NonIsometricDlg::onClickReset()
{
m_bReset->setFocus();
- m_sbXcoeff->setValue( 1.0 );
- m_sbYcoeff->setValue( 1.0 );
- m_sbZcoeff->setValue( 1.0 );
+ m_sbXcoeff->setValue(1.0);
+ m_sbYcoeff->setValue(1.0);
+ m_sbZcoeff->setValue(1.0);
}
-