// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
//
// 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
-//
+// 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 :
-// Author :
-// Module :
+// File :
+// Author :
+// Module :
// $Header$
#include "VVTK_MainWindow.h"
#include "VVTK_RecorderDlg.h"
#include "VISU_WidgetCtrl.hxx"
#include "VISU_GaussPtsAct.h"
-#include "VISU_Event.h"
+#include "VISU_Event.h"
#include "SVTK_ViewWindow.h"
#include "SVTK_RenderWindowInteractor.h"
#include "VVTK_PickingDlg.h"
#include "VVTK_SegmentationCursorDlg.h"
-#include "SUIT_Application.h"
-#include "SUIT_Session.h"
-#include "SUIT_Tools.h"
-#include "SUIT_ViewWindow.h"
-#include "SUIT_ResourceMgr.h"
-#include "SUIT_Accel.h"
-#include "SUIT_MessageBox.h"
-#include "QtxAction.h"
-#include "QtxMultiAction.h"
+#include <SUIT_Tools.h>
+#include <SUIT_Accel.h>
+#include <SUIT_Session.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_ViewWindow.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Application.h>
+
+#include <QtxAction.h>
+#include <QtxMultiAction.h>
+#include <QtxActionToolMgr.h>
#include <QImage>
#include <QToolBar>
//----------------------------------------------------------------------------
VVTK_MainWindow
-::VVTK_MainWindow(QWidget* theParent,
+::VVTK_MainWindow(QWidget* theParent,
const char* theName,
SUIT_ResourceMgr* theResourceMgr,
SUIT_ViewWindow* theViewWindow):
myInteractorStyle->Delete();
- addToolBar( Qt::LeftToolBarArea, myToolBar );
+ if ( getToolBar() )
+ addToolBar( Qt::LeftToolBarArea, getToolBar() );
//TO DO:
//myActionsMap[NonIsometric]->removeFrom(myToolBar);
+ QtxAction* anAction = 0;
+ QtxActionToolMgr* mgr = myViewWindow->toolMgr();
+
+ // Dump view
+ anAction = new QtxAction(tr("MNU_DUMP_VIEW"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_DUMP" ) ),
+ tr( "MNU_DUMP_VIEW" ), 0, this);
+ anAction->setStatusTip(tr("DSC_DUMP_VIEW"));
+ connect(anAction, SIGNAL(activated()), myViewWindow, SLOT(onDumpView()));
+ mgr->registerAction( anAction, DumpId );
+
// Recording
- myRecordingToolBar = new QToolBar(tr("LBL_TOOLBAR_RECORD_LABEL"), this);
- addToolBar(Qt::LeftToolBarArea, myRecordingToolBar );
+ myRecordingToolBar = mgr->createToolBar( tr( "LBL_TOOLBAR_RECORD_LABEL" ) );
+ addToolBar( Qt::LeftToolBarArea, mgr->toolBar( myRecordingToolBar ) );
- myStartAction = new QtxAction(tr("MNU_VVTK_RECORDING_START"),
+ myStartAction = new QtxAction(tr("MNU_VVTK_RECORDING_START"),
theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_RECORDING_START" ) ),
tr( "MNU_VVTK_RECORDING_START" ), 0, this);
myStartAction->setStatusTip(tr("DSC_VVTK_RECORDING_START"));
- //myStartAction->addTo( myRecordingToolBar );
- myRecordingToolBar->addAction( myStartAction );
connect( myStartAction, SIGNAL( triggered ( bool ) ), this, SLOT( OnStartRecording() ) );
+ mgr->append( myStartAction, myRecordingToolBar );
- myPlayAction = new QtxAction(tr("MNU_VVTK_RECORDING_PLAY"),
+ myPlayAction = new QtxAction(tr("MNU_VVTK_RECORDING_PLAY"),
theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_RECORDING_PLAY" ) ),
tr( "MNU_VVTK_RECORDING_PLAY" ), 0, this);
myPlayAction->setStatusTip(tr("DSC_VVTK_RECORDING_PLAY"));
myPlayAction->setEnabled( false );
//myPlayAction->addTo( myRecordingToolBar );
- myRecordingToolBar->addAction( myPlayAction );
+ // myRecordingToolBar->addAction( myPlayAction );
+ mgr->append( myPlayAction, myRecordingToolBar );
connect( myPlayAction, SIGNAL( triggered ( bool ) ), this, SLOT( OnPlayRecording() ) );
- myPauseAction = new QtxAction(tr("MNU_VVTK_RECORDING_PAUSE"),
+ myPauseAction = new QtxAction(tr("MNU_VVTK_RECORDING_PAUSE"),
theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_RECORDING_PAUSE" ) ),
tr( "MNU_VVTK_RECORDING_PAUSE" ), 0, this);
myPauseAction->setStatusTip(tr("DSC_VVTK_RECORDING_PAUSE"));
myPauseAction->setEnabled( false );
//myPauseAction->addTo( myRecordingToolBar );
- myRecordingToolBar->addAction( myPauseAction );
+ //myRecordingToolBar->addAction( myPauseAction );
+ mgr->append( myPauseAction, myRecordingToolBar );
connect( myPauseAction, SIGNAL( triggered ( bool ) ), this, SLOT( OnPauseRecording() ) );
- myStopAction = new QtxAction(tr("MNU_VVTK_RECORDING_STOP"),
+ myStopAction = new QtxAction(tr("MNU_VVTK_RECORDING_STOP"),
theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_RECORDING_STOP" ) ),
tr( "MNU_VVTK_RECORDING_STOP" ), 0, this);
myStopAction->setStatusTip(tr("DSC_VVTK_RECORDING_STOP"));
myStopAction->setEnabled( false );
//myStopAction->addTo( myRecordingToolBar );
- myRecordingToolBar->addAction( myStopAction );
+ //myRecordingToolBar->addAction( myStopAction );
+ mgr->append( myStopAction, myRecordingToolBar );
connect( myStopAction, SIGNAL( triggered ( bool ) ), this, SLOT( OnStopRecording() ) );
-
+
myRecorder = VVTK_Recorder::New();
//myRecorder->CheckExistAVIMaker();
//if(myRecorder->ErrorStatus())
void
VVTK_MainWindow
::Initialize(SVTK_RenderWindowInteractor* theInteractor)
-{
+{
vtkInteractorStyle* aStyle = theInteractor->GetInteractorStyle();
if(SVTK_InteractorStyle *anInteractorStyle = dynamic_cast<SVTK_InteractorStyle*>(aStyle)){
anInteractorStyle->SetControllerIncrement(myControllerIncrement.GetPointer());
myRecorder->SetUseSkippedFrames(true);
myRecorder->SetRenderWindow(theInteractor->getRenderWindow());
- disconnect( myActionsMap[ DumpId ], SIGNAL( activated() ),
- myViewWindow, SLOT( onDumpView() ) );
-
- connect( myActionsMap[ DumpId ], SIGNAL( activated() ),
- this, SLOT( onDumpView() ) );
+ if ( myViewWindow->toolMgr()->action( DumpId ) )
+ {
+ disconnect( myViewWindow->toolMgr()->action( DumpId ), SIGNAL( activated() ), myViewWindow, SLOT( onDumpView() ) );
+ connect( myViewWindow->toolMgr()->action( DumpId ), SIGNAL( activated() ), this, SLOT( onDumpView() ) );
+ }
SVTK_MainWindow::Initialize(theInteractor);
}
VVTK_MainWindow::~VVTK_MainWindow()
{
- if(myRecorder)
+ if ( myRecorder )
myRecorder->Delete();
}
{
QImage img = dumpView();
if( img.isNull() )
- return;
+ return;
SUIT_Application* app = SUIT_Session::session()->activeApplication();
QString fileName = app->getFileName( false, QString::null,
}
//----------------------------------------------------------------------------
-void
+void
VVTK_MainWindow
::action( const int accelAction )
{
//----------------------------------------------------------------------------
VVTK_MainWindow1
-::VVTK_MainWindow1(QSplitter* theParent,
+::VVTK_MainWindow1(QSplitter* theParent,
const char* theName,
SUIT_ResourceMgr* theResourceMgr,
SUIT_ViewWindow* theViewWindow):
QtxAction* anAction;
aPixmap = theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_INTERACTOR_STYLE_SWITCH" ) );
- anAction = new QtxAction(tr("MNU_VVTK_INTERACTOR_STYLE_SWITCH"),
+ anAction = new QtxAction(tr("MNU_VVTK_INTERACTOR_STYLE_SWITCH"),
aPixmap,
- tr( "MNU_VVTK_INTERACTOR_STYLE_SWITCH" ),
- 0,
- this,
- //"VVTK/SVTK StyleSwitch",
+ tr( "MNU_VVTK_INTERACTOR_STYLE_SWITCH" ),
+ 0,
+ this,
+ //"VVTK/SVTK StyleSwitch",
true);
anAction->setCheckable(true);
anAction->setStatusTip(tr("DSC_VVTK_INTERACTOR_STYLE_SWITCH"));
myStyleSwitchAction->toggle();
aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_SELECTION_MODE_SWITCH"));
- myPickingAction = new QtxAction(tr("MNU_VVTK_SELECTION_MODE_SWITCH"),
+ myPickingAction = new QtxAction(tr("MNU_VVTK_SELECTION_MODE_SWITCH"),
aPixmap,
- tr( "MNU_VVTK_SELECTION_MODE_SWITCH" ),
- 0,
- this,
- //"VVTK/SVTK SelectionSwitch",
+ tr( "MNU_VVTK_SELECTION_MODE_SWITCH" ),
+ 0,
+ this,
+ //"VVTK/SVTK SelectionSwitch",
true);
myPickingAction->setCheckable(true);
myPickingAction->setStatusTip(tr("DSC_VVTK_SELECTION_MODE_SWITCH"));
// Plane/Sphere Segmentation
aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_PLANE_SEGMENTATION_SWITCH"));
- myPlaneSegmentationAction = new QtxAction(tr("MNU_VVTK_PLANE_SEGMENTATION_SWITCH"),
+ myPlaneSegmentationAction = new QtxAction(tr("MNU_VVTK_PLANE_SEGMENTATION_SWITCH"),
aPixmap,
- tr( "MNU_VVTK_PLANE_SEGMENTATION_SWITCH" ),
- 0,
- this,
- //"VVTK/SVTK PlaneSegmentationSwitch",
+ tr( "MNU_VVTK_PLANE_SEGMENTATION_SWITCH" ),
+ 0,
+ this,
+ //"VVTK/SVTK PlaneSegmentationSwitch",
true);
myPlaneSegmentationAction->setCheckable(true);
myPlaneSegmentationAction->setStatusTip(tr("DSC_VVTK_PLANE_SEGMENTATION_SWITCH"));
connect( myPlaneSegmentationAction, SIGNAL( triggered() ), this, SLOT( OnSegmentationSwitch() ) );
aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_SPHERE_SEGMENTATION_SWITCH"));
- mySphereSegmentationAction = new QtxAction(tr("MNU_VVTK_SPHERE_SEGMENTATION_SWITCH"),
+ mySphereSegmentationAction = new QtxAction(tr("MNU_VVTK_SPHERE_SEGMENTATION_SWITCH"),
aPixmap,
- tr( "MNU_VVTK_SPHERE_SEGMENTATION_SWITCH" ),
- 0,
- this,
- //"VVTK/SVTK SphereSegmentationSwitch",
+ tr( "MNU_VVTK_SPHERE_SEGMENTATION_SWITCH" ),
+ 0,
+ this,
+ //"VVTK/SVTK SphereSegmentationSwitch",
true);
mySphereSegmentationAction->setCheckable(true);
mySphereSegmentationAction->setStatusTip(tr("DSC_VVTK_SPHERE_SEGMENTATION_SWITCH"));
//----------------------------------------------------------------------------
VVTK_MainWindow2*
VVTK_MainWindow1
-::CreateMainWindow2(QWidget* theParent,
+::CreateMainWindow2(QWidget* theParent,
const char* theName,
SUIT_ResourceMgr* theResourceMgr,
SUIT_ViewWindow* theViewWindow)
{
if ( theIsSelectionOn && !isVisible() )
return;
-
+
Selection_Mode aSelectionMode = SelectionMode();
if(theIsSelectionOn && aSelectionMode != GaussPointSelection)
SetSelectionMode(GaussPointSelection);
//----------------------------------------------------------------------------
-VISU_WidgetCtrl*
+VISU_WidgetCtrl*
VVTK_MainWindow1
::GetWidgetCtrl()
{
return myRenderer->GetWidgetCtrl();
}
-VISU_InsideCursorSettings*
+VISU_InsideCursorSettings*
VVTK_MainWindow1
::GetInsideCursorSettings()
{
return mySegmentationCursorDlg->GetInsideCursorSettings();
}
-VISU_OutsideCursorSettings*
+VISU_OutsideCursorSettings*
VVTK_MainWindow1
::GetOutsideCursorSettings()
{
return mySegmentationCursorDlg->GetOutsideCursorSettings();
}
-VISU_PickingSettings*
+VISU_PickingSettings*
VVTK_MainWindow1
::GetPickingSettings()
{
if( !theAction )
return;
-
+
VISU_WidgetCtrl *aWidgetCtrl = myRenderer->GetWidgetCtrl();
-
+
if (anIsSegmentationOn) {
int anIndex = (theAction == myPlaneSegmentationAction) ? 0 : 1;
aWidgetCtrl->SetActiveIndex(anIndex);
//----------------------------------------------------------------------------
VVTK_MainWindow2
-::VVTK_MainWindow2(QWidget* theParent,
+::VVTK_MainWindow2(QWidget* theParent,
const char* theName,
SUIT_ResourceMgr* theResourceMgr,
SUIT_ViewWindow* theViewWindow,