From ccca9c348f9533863f5c62c4a8145c07b7266512 Mon Sep 17 00:00:00 2001 From: apo Date: Mon, 3 Oct 2005 06:29:59 +0000 Subject: [PATCH] Correct naming of files for VVTK_MainWindow class implementation --- src/VVTK/Makefile.in | 6 +- .../{VVTK_View.cxx => VVTK_MainWindow.cxx} | 126 ++++++++++-------- src/VVTK/{VVTK_View.h => VVTK_MainWindow.h} | 43 +++--- src/VVTK/VVTK_ViewWindow.cxx | 12 +- 4 files changed, 108 insertions(+), 79 deletions(-) rename src/VVTK/{VVTK_View.cxx => VVTK_MainWindow.cxx} (86%) rename src/VVTK/{VVTK_View.h => VVTK_MainWindow.h} (74%) diff --git a/src/VVTK/Makefile.in b/src/VVTK/Makefile.in index 45d817ff..0e1e27d5 100755 --- a/src/VVTK/Makefile.in +++ b/src/VVTK/Makefile.in @@ -19,7 +19,7 @@ EXPORT_HEADERS = \ VVTK_InteractorStyle.h \ VVTK_SegmentationCursorDlg.h \ VVTK_ViewWindow.h \ - VVTK_View.h + VVTK_MainWindow.h # Libraries targets LIB = libVVTK.la @@ -31,14 +31,14 @@ LIB_SRC = \ VVTK_SegmentationCursorDlg.cxx \ VVTK_ViewWindow.cxx \ VVTK_Renderer.cxx \ - VVTK_View.cxx + VVTK_MainWindow.cxx LIB_MOC = \ VVTK_ViewWindow.h \ VVTK_ViewModel.h \ VVTK_ViewManager.h \ VVTK_SegmentationCursorDlg.h \ - VVTK_View.h + VVTK_MainWindow.h CPPFLAGS += \ $(QT_INCLUDES) \ diff --git a/src/VVTK/VVTK_View.cxx b/src/VVTK/VVTK_MainWindow.cxx similarity index 86% rename from src/VVTK/VVTK_View.cxx rename to src/VVTK/VVTK_MainWindow.cxx index c184e254..6591795f 100644 --- a/src/VVTK/VVTK_View.cxx +++ b/src/VVTK/VVTK_MainWindow.cxx @@ -26,7 +26,7 @@ // Module : // $Header$ -#include "VVTK_View.h" +#include "VVTK_MainWindow.h" #include "VVTK_InteractorStyle.h" #include "VISU_ImplicitFunctionWidget.h" #include "VISU_GaussPtsAct.h" @@ -43,10 +43,10 @@ #include //---------------------------------------------------------------------------- -VVTK_MainWindowBase -::VVTK_MainWindowBase(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr): +VVTK_MainWindow +::VVTK_MainWindow(QWidget* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr): SVTK_MainWindow(theParent,theName,theResourceMgr), myInteractorStyle(VVTK_InteractorStyle::New()) { @@ -54,58 +54,24 @@ VVTK_MainWindowBase moveDockWindow(myToolBar,Qt::DockLeft); myActionsMap[NonIsometric]->removeFrom(myToolBar); - - myPtsToolBar = new QToolBar(this); - myPtsToolBar->setCloseMode(QDockWindow::Undocked); - myPtsToolBar->setLabel(tr("LBL_TOOLBAR_LABEL")); - moveDockWindow(myPtsToolBar,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->setToggleAction(true); - anAction->toggle(); - anAction->setStatusTip(tr("DSC_VVTK_INTERACTOR_STYLE_SWITCH")); - connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool))); - anAction->addTo( myPtsToolBar ); - - 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( myPtsToolBar ); } void -VVTK_MainWindowBase +VVTK_MainWindow ::Initialize(SVTK_RenderWindowInteractor* theInteractor) { SVTK_MainWindow::Initialize(theInteractor); PushInteractorStyle(myInteractorStyle.GetPointer()); } -VVTK_MainWindowBase -::~VVTK_MainWindowBase() +VVTK_MainWindow +::~VVTK_MainWindow() {} //---------------------------------------------------------------------------- void -VVTK_MainWindowBase +VVTK_MainWindow ::OnInteractorStyleSwitch(bool theIsGaussStyleOn) { if ( theIsGaussStyleOn ) @@ -116,7 +82,7 @@ VVTK_MainWindowBase //---------------------------------------------------------------------------- void -VVTK_MainWindowBase +VVTK_MainWindow ::OnSelectionModeSwitch(bool theIsSelectionOn) { SetSelectionMode(theIsSelectionOn? NodeSelection: ActorSelection); @@ -127,7 +93,7 @@ int convertAction( const int accelAction ); void -VVTK_MainWindowBase +VVTK_MainWindow ::action( const int accelAction ) { if ( accelAction == SUIT_Accel::ZoomFit ) @@ -144,12 +110,46 @@ VVTK_MainWindow1 ::VVTK_MainWindow1(QSplitter* theParent, const char* theName, SUIT_ResourceMgr* theResourceMgr): - VVTK_MainWindowBase(theParent,theName,theResourceMgr), + VVTK_MainWindow(theParent,theName,theResourceMgr), + myStyleSwitchAction(NULL), mySplitter(theParent) { + myPtsToolBar = new QToolBar(this); + myPtsToolBar->setCloseMode(QDockWindow::Undocked); + myPtsToolBar->setLabel(tr("LBL_TOOLBAR_LABEL")); + moveDockWindow(myPtsToolBar,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->setToggleAction(true); + anAction->toggle(); + anAction->setStatusTip(tr("DSC_VVTK_INTERACTOR_STYLE_SWITCH")); + connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool))); + anAction->addTo( myPtsToolBar ); + myStyleSwitchAction = anAction; + + 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( myPtsToolBar ); + aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_PLANE_SEGMENTATION_SWITCH")); anAction = new QtxAction(tr("MNU_VVTK_PLANE_SEGMENTATION_SWITCH"), aPixmap, @@ -173,7 +173,7 @@ VVTK_MainWindow1 VVTK_Renderer1* theRenderer) { myRenderer = theRenderer; - VVTK_MainWindowBase::Initialize(theInteractor); + VVTK_MainWindow::Initialize(theInteractor); mySegmentationCursorDlg->SetWidget( theRenderer->GetImplicitFunctionWidget() ); } @@ -182,14 +182,28 @@ VVTK_MainWindow1 {} +//---------------------------------------------------------------------------- +VVTK_MainWindow2* +VVTK_MainWindow1 +::CreateMainWindow2(QWidget* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr) +{ + return new VVTK_MainWindow2(theParent, + theName, + theResourceMgr, + this, + myStyleSwitchAction); +} + + //---------------------------------------------------------------------------- void VVTK_MainWindow1 ::AddActor(VTKViewer_Actor* theActor, bool theIsUpdate) { - VISU_GaussPtsAct* anActor = dynamic_cast(theActor); - if( anActor ) + if(VISU_GaussPtsAct1* anActor = dynamic_cast(theActor)) mySegmentationCursorDlg->AddActor( anActor ); SVTK_MainWindow::AddActor( theActor, theIsUpdate ); @@ -201,8 +215,7 @@ VVTK_MainWindow1 ::RemoveActor(VTKViewer_Actor* theActor, bool theIsUpdate) { - VISU_GaussPtsAct* anActor = dynamic_cast(theActor); - if( anActor ) + if(VISU_GaussPtsAct1* anActor = dynamic_cast(theActor)) mySegmentationCursorDlg->RemoveActor( anActor ); SVTK_MainWindow::RemoveActor( theActor, theIsUpdate ); @@ -254,10 +267,13 @@ VVTK_MainWindow2 ::VVTK_MainWindow2(QWidget* theParent, const char* theName, SUIT_ResourceMgr* theResourceMgr, - VVTK_MainWindow1* theMainWindow): - VVTK_MainWindowBase(theParent,theName,theResourceMgr), + VVTK_MainWindow1* theMainWindow, + QtxAction* theStyleSwitchAction): + VVTK_MainWindow(theParent,theName,theResourceMgr), myMainWindow(theMainWindow) -{} +{ + connect(theStyleSwitchAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool))); +} void VVTK_MainWindow2 @@ -265,7 +281,7 @@ VVTK_MainWindow2 VVTK_Renderer2* theRenderer) { myRenderer = theRenderer; - VVTK_MainWindowBase::Initialize(theInteractor); + VVTK_MainWindow::Initialize(theInteractor); myRenderer->SetRenderer1(myMainWindow->GetRenderer1()); } diff --git a/src/VVTK/VVTK_View.h b/src/VVTK/VVTK_MainWindow.h similarity index 74% rename from src/VVTK/VVTK_View.h rename to src/VVTK/VVTK_MainWindow.h index 1be8c53d..bc9e4009 100644 --- a/src/VVTK/VVTK_View.h +++ b/src/VVTK/VVTK_MainWindow.h @@ -1,5 +1,5 @@ -#ifndef VVTK_VIEW_H -#define VVTK_VIEW_H +#ifndef VVTK_MAINWINDOW_H +#define VVTK_MAINWINDOW_H #ifdef WIN32 #pragma warning( disable:4251 ) @@ -8,27 +8,28 @@ #include "VVTK.h" #include "SVTK_MainWindow.h" -class VVTK_Renderer1; -class VVTK_Renderer2; class QSplitter; class VVTK_SegmentationCursorDlg; +class VVTK_MainWindow2; +class VVTK_Renderer1; +class VVTK_Renderer2; //---------------------------------------------------------------------------- -class VVTK_EXPORT VVTK_MainWindowBase: public SVTK_MainWindow +class VVTK_EXPORT VVTK_MainWindow: public SVTK_MainWindow { Q_OBJECT; public: - VVTK_MainWindowBase(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr); + VVTK_MainWindow(QWidget* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr); virtual void Initialize(SVTK_RenderWindowInteractor* theInteractor); virtual - ~VVTK_MainWindowBase(); + ~VVTK_MainWindow(); public slots: void OnInteractorStyleSwitch(bool theIsGaussStyleOn); @@ -39,13 +40,12 @@ public: action( const int ); protected: - QToolBar* myPtsToolBar; vtkSmartPointer myInteractorStyle; }; //---------------------------------------------------------------------------- -class VVTK_EXPORT VVTK_MainWindow1: public VVTK_MainWindowBase +class VVTK_EXPORT VVTK_MainWindow1: public VVTK_MainWindow { Q_OBJECT; @@ -58,9 +58,15 @@ public: Initialize(SVTK_RenderWindowInteractor* theInteractor, VVTK_Renderer1* theRenderer); + virtual ~VVTK_MainWindow1(); + VVTK_MainWindow2* + CreateMainWindow2(QWidget* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr); + virtual void AddActor(VTKViewer_Actor* theActor, @@ -71,7 +77,7 @@ public: RemoveActor(VTKViewer_Actor* theActor, bool theIsUpdate = false); - VVTK_Renderer1* + VVTK_Renderer1* GetRenderer1(); virtual @@ -83,6 +89,9 @@ public: protected: VVTK_Renderer1* myRenderer; + + QtxAction* myStyleSwitchAction; + QToolBar* myPtsToolBar; QSplitter* mySplitter; VVTK_SegmentationCursorDlg* mySegmentationCursorDlg; @@ -90,16 +99,18 @@ public: //---------------------------------------------------------------------------- -class VVTK_EXPORT VVTK_MainWindow2: public VVTK_MainWindowBase +class VVTK_EXPORT VVTK_MainWindow2: public VVTK_MainWindow { Q_OBJECT; -public: + friend class VVTK_MainWindow1; + VVTK_MainWindow2(QWidget* theParent, const char* theName, SUIT_ResourceMgr* theResourceMgr, - VVTK_MainWindow1* theMainWindow); - + VVTK_MainWindow1* theMainWindow, + QtxAction* theStyleSwitchAction); +public: virtual void Initialize(SVTK_RenderWindowInteractor* theInteractor, diff --git a/src/VVTK/VVTK_ViewWindow.cxx b/src/VVTK/VVTK_ViewWindow.cxx index 4ec356c8..9d29b8a7 100755 --- a/src/VVTK/VVTK_ViewWindow.cxx +++ b/src/VVTK/VVTK_ViewWindow.cxx @@ -28,7 +28,7 @@ #include "VVTK_ViewWindow.h" #include "VVTK_ViewModel.h" -#include "VVTK_View.h" +#include "VVTK_MainWindow.h" #include "SVTK_View.h" #include "SUIT_Session.h" @@ -95,10 +95,9 @@ VVTK_ViewWindow myView1 = new SVTK_View(myMainWindow1); } { - myMainWindow2 = new VVTK_MainWindow2(aSplitter, - "VVTK_SegmantationWindow", - aResourceMgr, - myMainWindow1); + myMainWindow2 = myMainWindow1->CreateMainWindow2(aSplitter, + "VVTK_SegmantationWindow", + aResourceMgr); SVTK_RenderWindowInteractor* anIteractor = new SVTK_RenderWindowInteractor(myMainWindow2,"SVTK_RenderWindowInteractor1"); @@ -125,6 +124,9 @@ VVTK_ViewWindow aSelector->Delete(); SVTK_ViewWindow::Initialize(myView1,theModel); + connect(myView2,SIGNAL(selectionChanged()), + theModel,SLOT(onSelectionChanged())); + myMainWindow = myMainWindow1; myView = myView1; } -- 2.39.2