From: nds Date: Mon, 6 Oct 2008 10:25:26 +0000 (+0000) Subject: Merging from the BR_V5_DEV branch. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ee878aaea0076c4a39ccb62811f1f60efd5127a9;p=modules%2Fgui.git Merging from the BR_V5_DEV branch. --- diff --git a/src/SVTK/SALOME_Actor.cxx b/src/SVTK/SALOME_Actor.cxx index 7f17c2708..678d9de95 100644 --- a/src/SVTK/SALOME_Actor.cxx +++ b/src/SVTK/SALOME_Actor.cxx @@ -509,7 +509,7 @@ SALOME_Actor if(myIsPreselected){ const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex(); int anExtent = aMapIndex.Extent(); - anIsChanged |= (anExtent == 0); + anIsChanged |= (anExtent == 0 || anExtent == 1); anIsChanged |= (anExtent == 2 && (anObjId != aMapIndex(1) || anEdgeId != aMapIndex(2))); if(anIsChanged){ TColStd_IndexedMapOfInteger aMapIndex; diff --git a/src/SVTK/SALOME_Actor.h b/src/SVTK/SALOME_Actor.h index db4e2e56e..ffa0bdca7 100644 --- a/src/SVTK/SALOME_Actor.h +++ b/src/SVTK/SALOME_Actor.h @@ -54,8 +54,12 @@ class SVTK_Actor; class SVTK_RectPicker; class SVTK_InteractorStyle; -extern int SALOME_POINT_SIZE; -extern int SALOME_LINE_WIDTH; +SVTK_EXPORT extern int SALOME_POINT_SIZE; +SVTK_EXPORT extern int SALOME_LINE_WIDTH; + +#ifdef WIN32 +#pragma warning ( disable:4251 ) +#endif #ifdef WIN32 #pragma warning ( disable:4251 ) diff --git a/src/SVTK/SVTK_CubeAxesDlg.cxx b/src/SVTK/SVTK_CubeAxesDlg.cxx index 1258e98ed..92c3f2847 100644 --- a/src/SVTK/SVTK_CubeAxesDlg.cxx +++ b/src/SVTK/SVTK_CubeAxesDlg.cxx @@ -48,29 +48,60 @@ #include /*! - * Class : AxisWg - * Description : Tab of dialog - */ + \class SVTK_CubeAxesDlg::AxisWidget + \brief Axis tab widget of the "Graduated axis" dialog box + \internal +*/ + +class SVTK_CubeAxesDlg::AxisWidget : public QFrame +{ +public: + AxisWidget( QWidget* ); + ~AxisWidget(); + + void UseName( const bool ); + void SetName( const QString& ); + void SetNameFont( const QColor&, const int, const bool, const bool, const bool ); + bool ReadData( vtkAxisActor2D* ); + bool Apply( vtkAxisActor2D* ); + +private: + // name + QGroupBox* myNameGrp; + QLineEdit* myAxisName; + SVTK_FontWidget* myNameFont; + + // labels + QGroupBox* myLabelsGrp; + QtxIntSpinBox* myLabelNumber; + QtxIntSpinBox* myLabelOffset; + SVTK_FontWidget* myLabelsFont; + + // tick marks + QGroupBox* myTicksGrp; + QtxIntSpinBox* myTickLength; + + friend class SVTK_CubeAxesDlg; +}; /*! Constructor */ -SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) +SVTK_CubeAxesDlg::AxisWidget::AxisWidget (QWidget* theParent) : QFrame(theParent) { QList< QLabel* > aLabels; // "Name" grp - myNameGrp = new QGroupBox(tr("AXIS_NAME"), this); + myNameGrp = new QGroupBox(SVTK_CubeAxesDlg::tr("AXIS_NAME"), this); + myNameGrp->setCheckable( true ); + QVBoxLayout* aVBox = new QVBoxLayout; - myIsNameVisible = new QCheckBox(tr("IS_VISIBLE"), myNameGrp); - aVBox->addWidget(myIsNameVisible); - QHBoxLayout* aHBox = new QHBoxLayout; aHBox->setSpacing(5); - QLabel* aLabel = new QLabel(tr("NAME")); + QLabel* aLabel = new QLabel(SVTK_CubeAxesDlg::tr("NAME")); aHBox->addWidget(aLabel); myAxisName = new QLineEdit; aHBox->addWidget(myAxisName); @@ -79,7 +110,7 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) aHBox = new QHBoxLayout; aHBox->setSpacing(5); - aLabel = new QLabel(tr("FONT")); + aLabel = new QLabel(SVTK_CubeAxesDlg::tr("FONT")); aHBox->addWidget(aLabel); myNameFont = new SVTK_FontWidget(myNameGrp); aHBox->addWidget(myNameFont); @@ -90,35 +121,32 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) // "Labels" grp - myLabelsGrp = new QGroupBox(tr("LABELS"), this); - aVBox = new QVBoxLayout; + myLabelsGrp = new QGroupBox(SVTK_CubeAxesDlg::tr("LABELS"), this); + myLabelsGrp->setCheckable( true ); - myIsLabelsVisible = new QCheckBox(tr("IS_VISIBLE"), myLabelsGrp); - aVBox->addWidget(myIsLabelsVisible); + aVBox = new QVBoxLayout; aHBox = new QHBoxLayout; aHBox->setSpacing(5); - aLabel = new QLabel(tr("NUMBER")); + aLabel = new QLabel(SVTK_CubeAxesDlg::tr("NUMBER")); aHBox->addWidget(aLabel); myLabelNumber = new QtxIntSpinBox(0,25,1,myLabelsGrp); - myLabelNumber->setObjectName("SpinBoxLabelNumber"); aHBox->addWidget(myLabelNumber); aLabels.append(aLabel); aVBox->addLayout(aHBox); aHBox = new QHBoxLayout; aHBox->setSpacing(5); - aLabel = new QLabel(tr("OFFSET")); + aLabel = new QLabel(SVTK_CubeAxesDlg::tr("OFFSET")); aHBox->addWidget(aLabel); myLabelOffset = new QtxIntSpinBox(0,100,1,myLabelsGrp); - myLabelOffset->setObjectName("SpinBoxLabellOffset"); aHBox->addWidget(myLabelOffset); aLabels.append(aLabel); aVBox->addLayout(aHBox); aHBox = new QHBoxLayout; aHBox->setSpacing(5); - aLabel = new QLabel(tr("FONT")); + aLabel = new QLabel(SVTK_CubeAxesDlg::tr("FONT")); aHBox->addWidget(aLabel); myLabelsFont = new SVTK_FontWidget(myLabelsGrp); aHBox->addWidget(myLabelsFont); @@ -129,18 +157,16 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) // "Tick marks" grp - myTicksGrp = new QGroupBox(tr("TICK_MARKS"), this); - aVBox = new QVBoxLayout; + myTicksGrp = new QGroupBox(SVTK_CubeAxesDlg::tr("TICK_MARKS"), this); + myTicksGrp->setCheckable( true ); - myIsTicksVisible = new QCheckBox(tr("IS_VISIBLE"), myTicksGrp); - aVBox->addWidget(myIsTicksVisible); + aVBox = new QVBoxLayout; aHBox = new QHBoxLayout; aHBox->setSpacing(5); - aLabel = new QLabel(tr("LENGTH")); + aLabel = new QLabel(SVTK_CubeAxesDlg::tr("LENGTH")); aHBox->addWidget(aLabel); myTickLength = new QtxIntSpinBox(0,100,1,myTicksGrp); - myTickLength->setObjectName("SpinBoxTickLength"); aHBox->addWidget(myTickLength); aLabels.append(aLabel); aVBox->addLayout(aHBox); @@ -150,17 +176,16 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) // Layout QVBoxLayout* aLay = new QVBoxLayout(this); - aLay->setMargin(0); + aLay->setMargin(5); aLay->setSpacing(5); aLay->addWidget(myNameGrp); aLay->addWidget(myLabelsGrp); aLay->addWidget(myTicksGrp); // init - myIsNameVisible->setChecked(true); - myIsLabelsVisible->setChecked(true); - myIsTicksVisible->setChecked(true); - updateControlState(); + myNameGrp->setChecked( true ); + myLabelsGrp->setChecked( true ); + myTicksGrp->setChecked( true ); // Adjust label widths QList< QLabel* >::iterator anIter; @@ -169,74 +194,35 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) aMaxWidth = qMax(aMaxWidth, (*anIter)->sizeHint().width()); for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++) (*anIter)->setFixedWidth(aMaxWidth); - - // connect signals and slots - connect(myIsNameVisible, SIGNAL(stateChanged(int)), SLOT(onNameChecked())); - connect(myIsLabelsVisible, SIGNAL(stateChanged(int)), SLOT(onLabelsChecked())); - connect(myIsTicksVisible, SIGNAL(stateChanged(int)), SLOT(onTicksChecked())); } /*! Destructor */ -SVTK_AxisWidget::~SVTK_AxisWidget() -{ -} - -void SVTK_AxisWidget::updateControlState() +SVTK_CubeAxesDlg::AxisWidget::~AxisWidget() { - onNameChecked(); - onLabelsChecked(); - onTicksChecked(); } -void SVTK_AxisWidget::setEnabled(QGroupBox* theGrp, const bool theState) +void SVTK_CubeAxesDlg::AxisWidget::UseName(const bool toUse) { - QObjectList aChildren(theGrp->children()); - QObject* anObj; - for(int i = 0; i < aChildren.size(); i++) - { - anObj = aChildren.at(i); - if (anObj !=0 && anObj->inherits("QHBoxLayout")) - ((QHBoxLayout*)anObj)->setEnabled(theState); - } -} - -void SVTK_AxisWidget::onLabelsChecked() -{ - setEnabled(myLabelsGrp, myIsLabelsVisible->isChecked()); -} - -void SVTK_AxisWidget::onTicksChecked() -{ - setEnabled(myTicksGrp, myIsTicksVisible->isChecked()); + myNameGrp->setChecked(toUse); } -void SVTK_AxisWidget::onNameChecked() -{ - setEnabled(myNameGrp, myIsNameVisible->isChecked()); -} - -void SVTK_AxisWidget::UseName(const bool toUse) -{ - myIsNameVisible->setChecked(toUse); -} - -void SVTK_AxisWidget::SetName(const QString& theName) +void SVTK_CubeAxesDlg::AxisWidget::SetName(const QString& theName) { myAxisName->setText(theName); } -void SVTK_AxisWidget::SetNameFont(const QColor& theColor, - const int theFont, - const bool theIsBold, - const bool theIsItalic, - const bool theIsShadow) +void SVTK_CubeAxesDlg::AxisWidget::SetNameFont(const QColor& theColor, + const int theFont, + const bool theIsBold, + const bool theIsItalic, + const bool theIsShadow) { myNameFont->SetData(theColor, theFont, theIsBold, theIsItalic, theIsShadow); } -bool SVTK_AxisWidget::ReadData(vtkAxisActor2D* theActor) +bool SVTK_CubeAxesDlg::AxisWidget::ReadData(vtkAxisActor2D* theActor) { if (theActor == 0) return false; @@ -264,7 +250,7 @@ bool SVTK_AxisWidget::ReadData(vtkAxisActor2D* theActor) isTitleShadow = aTitleProp->GetShadow() ? true : false; } - myIsNameVisible->setChecked(useName); + myNameGrp->setChecked(useName); myAxisName->setText(aTitle); myNameFont->SetData(aTitleColor, aTitleFontFamily, isTitleBold, isTitleItalic, isTitleShadow); @@ -292,7 +278,7 @@ bool SVTK_AxisWidget::ReadData(vtkAxisActor2D* theActor) isLabelsShadow = aLabelsProp->GetShadow() ? true : false; } - myIsLabelsVisible->setChecked(useLabels); + myLabelsGrp->setChecked(useLabels); myLabelNumber->setValue(nbLabels); myLabelOffset->setValue(anOffset); myLabelsFont->SetData(aLabelsColor, aLabelsFontFamily, isLabelsBold, isLabelsItalic, isLabelsShadow); @@ -301,20 +287,20 @@ bool SVTK_AxisWidget::ReadData(vtkAxisActor2D* theActor) bool useTickMarks = theActor->GetTickVisibility(); int aTickLength = theActor->GetTickLength(); - myIsTicksVisible->setChecked(useTickMarks); + myTicksGrp->setChecked(useTickMarks); myTickLength->setValue(aTickLength); return true; } -bool SVTK_AxisWidget::Apply(vtkAxisActor2D* theActor) +bool SVTK_CubeAxesDlg::AxisWidget::Apply(vtkAxisActor2D* theActor) { if (theActor == 0) return false; // Name - theActor->SetTitleVisibility(myIsNameVisible->isChecked() ? 1 : 0); + theActor->SetTitleVisibility(myNameGrp->isChecked() ? 1 : 0); theActor->SetTitle(myAxisName->text().toLatin1()); QColor aTitleColor(255, 255, 255); @@ -341,7 +327,7 @@ bool SVTK_AxisWidget::Apply(vtkAxisActor2D* theActor) // Labels - theActor->SetLabelVisibility(myIsLabelsVisible->isChecked() ? 1 : 0); + theActor->SetLabelVisibility(myLabelsGrp->isChecked() ? 1 : 0); int nbLabels = myLabelNumber->value(); theActor->SetNumberOfLabels(nbLabels); @@ -374,7 +360,7 @@ bool SVTK_AxisWidget::Apply(vtkAxisActor2D* theActor) // Tick marks - theActor->SetTickVisibility(myIsTicksVisible->isChecked()); + theActor->SetTickVisibility(myTicksGrp->isChecked()); int aTickLength = myTickLength->value(); theActor->SetTickLength(aTickLength); @@ -418,16 +404,14 @@ QWidget* SVTK_CubeAxesDlg::createMainFrame(QWidget* theParent) myTabWg = new QTabWidget(aFrame); - myAxes[ 0 ] = new SVTK_AxisWidget(myTabWg); - myAxes[ 1 ] = new SVTK_AxisWidget(myTabWg); - myAxes[ 2 ] = new SVTK_AxisWidget(myTabWg); + myAxes[ 0 ] = new AxisWidget(myTabWg); + myAxes[ 1 ] = new AxisWidget(myTabWg); + myAxes[ 2 ] = new AxisWidget(myTabWg); myTabWg->addTab(myAxes[ 0 ], tr("X_AXIS")); myTabWg->addTab(myAxes[ 1 ], tr("Y_AXIS")); myTabWg->addTab(myAxes[ 2 ], tr("Z_AXIS")); - myTabWg->setContentsMargins(5,5,5,5); - myIsVisible = new QCheckBox(tr("IS_VISIBLE"), aFrame); QVBoxLayout* aLay = new QVBoxLayout(aFrame); diff --git a/src/SVTK/SVTK_CubeAxesDlg.h b/src/SVTK/SVTK_CubeAxesDlg.h index dc47654fe..d4f90568a 100644 --- a/src/SVTK/SVTK_CubeAxesDlg.h +++ b/src/SVTK/SVTK_CubeAxesDlg.h @@ -29,23 +29,13 @@ #include "SVTK_DialogBase.h" -#include - class QWidget; class QPushButton; class QTabWidget; class QCheckBox; -class QLineEdit; -class QGroupBox; class QtxAction; -class QtxIntSpinBox; - -class vtkAxisActor2D; class SVTK_CubeAxesActor2D; - -class SVTK_FontWidget; -class SVTK_AxisWidget; class SVTK_MainWindow; /*! @@ -56,6 +46,8 @@ class SVTK_CubeAxesDlg : public SVTK_DialogBase { Q_OBJECT + class AxisWidget; + public: SVTK_CubeAxesDlg(QtxAction* theAction, SVTK_MainWindow* theParent, @@ -84,56 +76,7 @@ private: QPushButton* myOkBtn; QPushButton* myApplyBtn; QPushButton* myCloseBtn; - SVTK_AxisWidget* myAxes[ 3 ]; -}; - -/*! - * Class : SVTK_AxisWidget - * Description : Tab of dialog - */ -class SVTK_EXPORT SVTK_AxisWidget : public QFrame -{ - Q_OBJECT - -public: - SVTK_AxisWidget( QWidget* ); - ~SVTK_AxisWidget(); - - void UseName( const bool ); - void SetName( const QString& ); - void SetNameFont( const QColor&, const int, const bool, const bool, const bool ); - bool ReadData( vtkAxisActor2D* ); - bool Apply( vtkAxisActor2D* ); - -private slots: - void onNameChecked(); - void onLabelsChecked(); - void onTicksChecked(); - -private: - void updateControlState(); - void setEnabled( QGroupBox*, const bool ); - -private: - // name - QGroupBox* myNameGrp; - QCheckBox* myIsNameVisible; - QLineEdit* myAxisName; - SVTK_FontWidget* myNameFont; - - // labels - QGroupBox* myLabelsGrp; - QCheckBox* myIsLabelsVisible; - QtxIntSpinBox* myLabelNumber; - QtxIntSpinBox* myLabelOffset; - SVTK_FontWidget* myLabelsFont; - - // tick marks - QGroupBox* myTicksGrp; - QCheckBox* myIsTicksVisible; - QtxIntSpinBox* myTickLength; - - friend class SVTK_CubeAxesDlg; + AxisWidget* myAxes[ 3 ]; }; #endif diff --git a/src/SVTK/SVTK_GenericRenderWindowInteractor.cxx b/src/SVTK/SVTK_GenericRenderWindowInteractor.cxx index 3dffbae50..fa4943202 100644 --- a/src/SVTK/SVTK_GenericRenderWindowInteractor.cxx +++ b/src/SVTK/SVTK_GenericRenderWindowInteractor.cxx @@ -134,7 +134,7 @@ SVTK_Selector* SVTK_GenericRenderWindowInteractor ::GetSelector() { - return mySelector.GetPointer(); + return mySelector; } /*! diff --git a/src/SVTK/SVTK_GenericRenderWindowInteractor.h b/src/SVTK/SVTK_GenericRenderWindowInteractor.h index 9bb7cbfcd..06c0241e8 100644 --- a/src/SVTK/SVTK_GenericRenderWindowInteractor.h +++ b/src/SVTK/SVTK_GenericRenderWindowInteractor.h @@ -122,7 +122,7 @@ class SVTK_EXPORT SVTK_GenericRenderWindowInteractor: public QVTK_GenericRenderW SVTK_GenericRenderWindowInteractor(); ~SVTK_GenericRenderWindowInteractor(); - vtkSmartPointer mySelector; //!< Keeps a pointer to SVTK_Selector + SVTK_Selector* mySelector; //!< Keeps a pointer to SVTK_Selector QWidget* myRenderWidget; //!< Keeps a pointer to QWidget, where vtkRenderWindow maps to. }; diff --git a/src/SVTK/SVTK_MainWindow.cxx b/src/SVTK/SVTK_MainWindow.cxx index 2dfd255c5..d23d48393 100644 --- a/src/SVTK/SVTK_MainWindow.cxx +++ b/src/SVTK/SVTK_MainWindow.cxx @@ -29,9 +29,11 @@ #include "SALOME_Actor.h" #include +#include #include #include +#include #include #include @@ -42,6 +44,7 @@ #include #include #include +#include #include "SVTK_NonIsometricDlg.h" #include "SVTK_UpdateRateDlg.h" @@ -55,9 +58,6 @@ #include "SVTK_InteractorStyle.h" #include "SVTK_Selector.h" -#include -#include - /*! Constructor */ @@ -71,11 +71,6 @@ SVTK_MainWindow { setObjectName(theName); setWindowFlags( windowFlags() & ~Qt::Window ); - - myToolBar = myViewWindow->toolMgr()->createToolBar( tr("LBL_TOOLBAR_LABEL"), -1, this ); - - createActions(theResourceMgr); - createToolBar(); } /*! @@ -85,6 +80,11 @@ void SVTK_MainWindow ::Initialize(SVTK_RenderWindowInteractor* theInteractor) { + myToolBar = toolMgr()->createToolBar( tr("LBL_TOOLBAR_LABEL"), -1, this ); + + createActions( SUIT_Session::session()->activeApplication()->resourceMgr() ); + createToolBar(); + myInteractor = theInteractor; SetEventDispatcher(myInteractor->GetDevice()); @@ -101,7 +101,6 @@ SVTK_MainWindow mySetRotationPointDlg = new SVTK_SetRotationPointDlg ( action( ChangeRotationPointId ), this, "SVTK_SetRotationPointDlg" ); myTextRegionDlg = new SVTK_TextRegionDlg( action( TextRegion ), this, "SVTK_TextRegionDlg"); - } /*! @@ -112,6 +111,14 @@ SVTK_MainWindow { } +/*! + \return assigned tool manager +*/ +QtxActionToolMgr* SVTK_MainWindow::toolMgr() const +{ + return myViewWindow->toolMgr(); +} + /*! \return used SVTK_RenderWindowInteractor */ @@ -403,7 +410,7 @@ QToolBar* SVTK_MainWindow ::getToolBar() { - return myViewWindow->toolMgr()->toolBar( myToolBar ); + return toolMgr()->toolBar( myToolBar ); } void @@ -425,7 +432,7 @@ SVTK_MainWindow ::createActions(SUIT_ResourceMgr* theResourceMgr) { QtxAction* anAction; - QtxActionToolMgr* mgr = myViewWindow->toolMgr(); + QtxActionToolMgr* mgr = toolMgr(); // Dump view anAction = new QtxAction(tr("MNU_DUMP_VIEW"), @@ -606,7 +613,7 @@ void SVTK_MainWindow ::createToolBar() { - QtxActionToolMgr* mgr = myViewWindow->toolMgr(); + QtxActionToolMgr* mgr = toolMgr(); mgr->append( DumpId, myToolBar ); mgr->append( ViewTrihedronId, myToolBar ); @@ -924,6 +931,16 @@ SVTK_MainWindow GetRenderer()->OnAdjustCubeAxes(); } +/*! + \brief Called when the "Print view" action is activated. +*/ +void SVTK_MainWindow::onPrintView() +{ + QImage img = dumpView(); + if ( myViewWindow ) + myViewWindow->printImage( img, this ); +} + /*! \return QImage, containing all scene rendering in window */ @@ -931,8 +948,19 @@ QImage SVTK_MainWindow ::dumpView() { - QPixmap px = QPixmap::grabWindow( GetInteractor()->winId() ); - return px.toImage(); + vtkRenderWindow* aWindow = GetInteractor()->getRenderWindow(); + int* aSize = aWindow->GetSize(); + int aWidth = aSize[0]; + int aHeight = aSize[1]; + + unsigned char *aData = + aWindow->GetRGBACharPixelData( 0, 0, aWidth-1, aHeight-1, 0 ); + + QImage anImage( aData, aWidth, aHeight, QImage::Format_ARGB32 ); + + anImage = anImage.rgbSwapped(); + anImage = anImage.mirrored(); + return anImage; } /*! @@ -940,36 +968,5 @@ SVTK_MainWindow */ QtxAction* SVTK_MainWindow::action( int id ) const { - return dynamic_cast( myViewWindow->toolMgr()->action( id ) ); + return dynamic_cast( toolMgr()->action( id ) ); } - -/*! - \brief Called when the "Print view" action is activated. -*/ -void SVTK_MainWindow::onPrintView() -{ - QImage img = dumpView(); - if ( myViewWindow ) - myViewWindow->printImage( img, this ); -} - - - - - - - - - - - - - - - - - - - - - diff --git a/src/SVTK/SVTK_MainWindow.h b/src/SVTK/SVTK_MainWindow.h index b15383eb9..b2e892634 100644 --- a/src/SVTK/SVTK_MainWindow.h +++ b/src/SVTK/SVTK_MainWindow.h @@ -38,6 +38,7 @@ class vtkInteractorStyle; class vtkRenderWindowInteractor; class QtxAction; +class QtxActionToolMgr; class SUIT_ResourceMgr; class SUIT_ViewWindow; @@ -241,6 +242,8 @@ public: QImage dumpView(); protected: + virtual QtxActionToolMgr* toolMgr() const; + void createActions(SUIT_ResourceMgr* theResourceMgr); diff --git a/src/SVTK/SVTK_RectPicker.cxx b/src/SVTK/SVTK_RectPicker.cxx index fb5ced7f2..8d6cfe07b 100644 --- a/src/SVTK/SVTK_RectPicker.cxx +++ b/src/SVTK/SVTK_RectPicker.cxx @@ -261,7 +261,7 @@ namespace // and handle the transformation ourselves. vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New(); aMatrix->DeepCopy(theRenderer->GetActiveCamera()-> - GetCompositePerspectiveTransformMatrix(1,0,1)); + GetCompositePerspectiveTransformMatrix( theRenderer->GetTiledAspectRatio(), 0, 1 ) ); for(vtkIdType aCellId = 0; aCellId < aNumCells; aCellId++){ vtkCell* aCell = theInput->GetCell(aCellId); diff --git a/src/SVTK/SVTK_RenderWindowInteractor.cxx b/src/SVTK/SVTK_RenderWindowInteractor.cxx index 56236ad89..66287bf79 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.cxx +++ b/src/SVTK/SVTK_RenderWindowInteractor.cxx @@ -37,7 +37,9 @@ // QT Includes // Put Qt includes before the X11 includes which #define the symbol None // (see SVTK_SpaceMouse.h) to avoid the compilation error. -#include +#ifndef WIN32 +# include +#endif #include #include "SVTK_SpaceMouse.h" @@ -414,10 +416,10 @@ QVTK_RenderWindowInteractor /*! To handle native Win32 events (from such devices as SpaceMouse) */ -bool QVTK_RenderWindowInteractor::winEvent( MSG* msg ) +bool QVTK_RenderWindowInteractor::winEvent( MSG* msg, long* result ) { // TODO: Implement event handling for SpaceMouse - return QWidget::winEvent( msg ); + return QWidget::winEvent( msg, result); } #else diff --git a/src/SVTK/SVTK_RenderWindowInteractor.h b/src/SVTK/SVTK_RenderWindowInteractor.h index 51aa1ec59..ab5f9c182 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.h +++ b/src/SVTK/SVTK_RenderWindowInteractor.h @@ -122,7 +122,7 @@ class SVTK_EXPORT QVTK_RenderWindowInteractor: public QWidget //! To handle native events (from such devices as SpaceMouse) #ifdef WIN32 - virtual bool winEvent( MSG* ); + virtual bool winEvent( MSG*, long* ); #else virtual bool x11Event( XEvent *e ); #endif diff --git a/src/SVTK/SVTK_Selector.cxx b/src/SVTK/SVTK_Selector.cxx index 0f54789d6..906574ca7 100644 --- a/src/SVTK/SVTK_Selector.cxx +++ b/src/SVTK/SVTK_Selector.cxx @@ -29,10 +29,13 @@ #include "SVTK_SelectorDef.h" -#include "VTKViewer_Filter.h" +#include #include "SALOME_Actor.h" +#include +#include + #include #include @@ -547,15 +550,24 @@ SALOME_Actor* SVTK_SelectorDef ::Pick(const SVTK_SelectionEvent* theEvent, vtkRenderer* theRenderer) const { - myCellPicker->Pick(theEvent->myX, - theEvent->myY, - 0.0, - theRenderer); - - vtkActorCollection* aListActors = myCellPicker->GetActors(); - SALOME_Actor* anActor = GetLastSALOMEActor(aListActors); + bool anAdvancedSelectionAlgorithm = true; + SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); + if ( aResourceMgr ) + anAdvancedSelectionAlgorithm = aResourceMgr->booleanValue( "VTKViewer", "use_advanced_selection_algorithm", true ); + + SALOME_Actor* anActor = NULL; + vtkActorCollection* aListActors = NULL; + if ( anAdvancedSelectionAlgorithm ) { + myCellPicker->Pick(theEvent->myX, + theEvent->myY, + 0.0, + theRenderer); - if (! anActor) { + aListActors = myCellPicker->GetActors(); + anActor = GetLastSALOMEActor(aListActors); + } + + if ( !anActor ) { myPicker->Pick(theEvent->myX, theEvent->myY, 0.0, diff --git a/src/SVTK/SVTK_ViewModel.cxx b/src/SVTK/SVTK_ViewModel.cxx index 8e5360537..b8edb171c 100644 --- a/src/SVTK/SVTK_ViewModel.cxx +++ b/src/SVTK/SVTK_ViewModel.cxx @@ -196,9 +196,11 @@ SVTK_Viewer thePopup->addSeparator(); if(TViewWindow* aView = dynamic_cast(myViewManager->getActiveView())){ - if ( !aView->getMainWindow()->getToolBar()->isVisible() ){ - thePopup->addAction( VTKViewer_Viewer::tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) ); - } + //Support of several toolbars in the popup menu + QList lst = qFindChildren( aView ); + QList::const_iterator it = lst.begin(), last = lst.end(); + for( ; it!=last; it++ ) + thePopup->addAction( (*it)->toggleViewAction() ); aView->RefreshDumpImage(); } } @@ -275,29 +277,6 @@ SVTK_Viewer } } -/*! - SLOT: called when popup item "Show toolbar" is activated, shows toolbar of active view window -*/ -void -SVTK_Viewer -::onShowToolbar() -{ - QVector aViews = myViewManager->getViews(); - for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){ - if(TViewWindow* aView = dynamic_cast(aViews.at(i))){ - //aView->getMainWindow()->getToolBar()->show(); - const QObjectList& aChildren = aView->getMainWindow()->children(); - foreach (QObject* aObj, aChildren) { - if (aObj->inherits("QToolBar")) { - QToolBar* aToolBar = dynamic_cast(aObj); - if (aToolBar) aToolBar->show(); - } - } - } - } -} - - /*! Display presentation \param prs - presentation diff --git a/src/SVTK/SVTK_ViewModel.h b/src/SVTK/SVTK_ViewModel.h index db6c4d79d..a76da1dbc 100644 --- a/src/SVTK/SVTK_ViewModel.h +++ b/src/SVTK/SVTK_ViewModel.h @@ -113,7 +113,6 @@ protected slots: void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*); void onDumpView(); - void onShowToolbar(); void onChangeBgColor(); private: