--- /dev/null
+// 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
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File :
+// Author :
+// Module :
+// $Header$
+
+#include "VVTK_View.h"
+#include "VVTK_InteractorStyle.h"
+
+#include "SUIT_ResourceMgr.h"
+#include "QtxAction.h"
+
+#include <qtoolbar.h>
+
+//----------------------------------------------------------------------------
+VVTK_MainWindow
+::VVTK_MainWindow(QWidget* theParent,
+ const char* theName,
+ SUIT_ResourceMgr* theResourceMgr,
+ bool theIsBase):
+ SVTK_MainWindow(theParent,theName,theResourceMgr),
+ myInteractorStyle(VVTK_InteractorStyle::New()),
+ myIsBase(theIsBase)
+{
+ myInteractorStyle->Delete();
+
+ this->moveDockWindow(myToolBar,Qt::DockLeft);
+
+ myToolBar2 = new QToolBar(this);
+ myToolBar2->setCloseMode(QDockWindow::Undocked);
+ myToolBar2->setLabel(tr("LBL_TOOLBAR_LABEL"));
+ this->moveDockWindow(myToolBar2,Qt::DockLeft);
+
+ QPixmap aPixmap;
+ QtxAction* anAction;
+ aPixmap = theResourceMgr->loadPixmap( "VISU", tr( "ICON_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",
+ true);
+ anAction->toggle();
+ anAction->setToggleAction(true);
+ anAction->setStatusTip(tr("DSC_VVTK_INTERACTOR_STYLE_SWITCH"));
+ connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onInteractorStyleSwitch(bool)));
+ anAction->addTo( myToolBar2 );
+
+ aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_SELECTION_MODE_SWITCH"));
+ anAction = new QtxAction(tr("MNU_VVTK_SELECTION_MODE_SWITCH"),
+ aPixmap,
+ tr( "MNU_VVTK_SELECTION_MODE_SWITCH" ),
+ 0,
+ this,
+ "VVTK/SVTK SelectionSwitch",
+ true);
+ anAction->setToggleAction(true);
+ anAction->setStatusTip(tr("DSC_VVTK_SELECTION_MODE_SWITCH"));
+ connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onSelectionModeSwitch(bool)));
+ anAction->addTo( myToolBar2 );
+}
+
+void
+VVTK_MainWindow
+::Initialize()
+{
+ SVTK_MainWindow::Initialize();
+
+ // important! : the default interactor style which is pushed is VVTK
+ // see onInteractorStyleSwitch() for details
+ PushInteractorStyle(myInteractorStyle.GetPointer());
+}
+
+VVTK_MainWindow
+::~VVTK_MainWindow()
+{}
+
+
+//----------------------------------------------------------------------------
+QSize
+VVTK_MainWindow
+::sizeHint() const
+{
+ QWidget* aParent = parentWidget();
+ if(myIsBase){
+ static float aCoeff = 2.0/3.0;
+ return QSize(aCoeff*aParent->width(),aCoeff*aParent->height());
+ }else{
+ static float aCoeff = 1.0/3.0;
+ return QSize(aCoeff*aParent->width(),aCoeff*aParent->height());
+ }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VVTK_MainWindow
+::onInteractorStyleSwitch(bool theIsVVTKStyle)
+{
+ // default interactor style which is pushed in this view window constructor
+ // is VVTK. If it is a current interactor style -- push SVTK "above" it.
+ // if SVTK is a current one - pop it (remove from stack), below it there MUST BE
+ // (logically) a VVTK interactor style.
+ if ( theIsVVTKStyle )
+ this->PopInteractorStyle();
+ else
+ this->PushInteractorStyle(myInteractorStyle.GetPointer());
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_MainWindow
+::onSelectionModeSwitch(bool theIsSelectionOn)
+{
+ SetSelectionMode(theIsSelectionOn? NodeSelection: ActorSelection);
+}
#include "VVTK_ViewWindow.h"
#include "VVTK_ViewModel.h"
-#include "VVTK_InteractorStyle.h"
+#include "VVTK_View.h"
-#include "SVTK_View.h"
-
-#include "SUIT_ResourceMgr.h"
#include "SUIT_Session.h"
-#include "QtxAction.h"
-
-#include <qtoolbar.h>
#include <qsplitter.h>
#include <qlayout.h>
VVTK_ViewWindow
::VVTK_ViewWindow(SUIT_Desktop* theDesktop):
SVTK_ViewWindow(theDesktop)
-{
-}
+{}
//----------------------------------------------------------------------------
void
aLayout->setAutoAdd(true);
QSplitter* aSplitter = new QSplitter(Qt::Vertical,aWidget);
- // Create SVTK_View (successor of RenderWindowInteractor).
- myMainWindow = new SVTK_MainWindow(aSplitter,"SVTK_MainWindow",aResourceMgr);
- myView = new SVTK_View(myMainWindow);
+ myVMainWindow[0] = new VVTK_MainWindow(aSplitter,
+ "SVTK_MainWindow",
+ aResourceMgr,
+ true);
+ myVMainWindow[0]->Initialize();
- // important! : the default interactor style which is pushed is VVTK
- // see onSwitchIS() for details
- myMainWindow->PushInteractorStyle(VVTK_InteractorStyle::New());
+ myVView[0] = new SVTK_View(myVMainWindow[0]);
- // create another toolbar
- myToolBar = new QToolBar(myMainWindow);
- myToolBar->setCloseMode(QDockWindow::Undocked);
- myToolBar->setLabel(tr("LBL_TOOLBAR_LABEL"));
-
- QPixmap aPixmap;
- QtxAction* anAction;
- aPixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_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",
- true);
- anAction->toggle();
- anAction->setToggleAction(true);
- anAction->setStatusTip(tr("DSC_VVTK_INTERACTOR_STYLE_SWITCH"));
- connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool)));
- anAction->addTo( myToolBar );
+ myVMainWindow[1] = new VVTK_MainWindow(aSplitter,
+ "SVTK_MainWindow",
+ aResourceMgr,
+ false);
+ myVMainWindow[1]->Initialize();
- aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_SELECTION_MODE_SWITCH"));
- anAction = new QtxAction(tr("MNU_VVTK_SELECTION_MODE_SWITCH"),
- aPixmap,
- tr( "MNU_VVTK_SELECTION_MODE_SWITCH" ),
- 0,
- this,
- "VVTK/SVTK SelectionSwitch",
- true);
- anAction->setToggleAction(true);
- anAction->setStatusTip(tr("DSC_VVTK_SELECTION_MODE_SWITCH"));
- connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnSelectionModeSwitch(bool)));
- anAction->addTo( myToolBar );
+ myVView[1] = new SVTK_View(myVMainWindow[0]);
+ myView = myVView[0];
+ myMainWindow = myVMainWindow[0];
SVTK_ViewWindow::Initialize(myView,theModel);
}
}
VVTK_ViewWindow
::~VVTK_ViewWindow()
{}
-
-//----------------------------------------------------------------------------
-void
-VVTK_ViewWindow
-::OnInteractorStyleSwitch(bool theIsVVTKStyle)
-{
- // default interactor style which is pushed in this view window constructor
- // is VVTK. If it is a current interactor style -- push SVTK "above" it.
- // if SVTK is a current one - pop it (remove from stack), below it there MUST BE
- // (logically) a VVTK interactor style.
- if ( theIsVVTKStyle )
- getMainWindow()->PopInteractorStyle();
- else
- getMainWindow()->PushInteractorStyle( SVTK_InteractorStyle::New() );
-}
-
-void
-VVTK_ViewWindow
-::OnSelectionModeSwitch(bool theIsSelectionOn)
-{
- Selection_Mode aMode = theIsSelectionOn? NodeSelection: ActorSelection;
- getMainWindow()->SetSelectionMode(aMode);
-}