From: vsv Date: Fri, 24 Jun 2005 10:23:22 +0000 (+0000) Subject: View activation bug X-Git-Tag: T3_0_0_a4~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c7ac5921131b007858074c5f1e49d186c3493661;p=modules%2Fvisu.git View activation bug --- diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index f4824a13..8e9a45f8 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -878,8 +878,9 @@ OnEraseAll() void VisuGUI::ChangeRepresentation (VISU::PresentationType theType) { - SVTK_ViewWindow* vw = GetViewWindow(); - if (!vw) return; + SUIT_ViewWindow* aView = GetActiveView(this, VTKViewer_Viewer::Type()); + if (!aView) return; + SVTK_ViewWindow* vw = (SVTK_ViewWindow*) aView; Handle(SALOME_InteractiveObject) anIO; CORBA::Object_var anObject = GetSelectedObj(this, &anIO); diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index d48e9fc1..5be5ef5b 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -318,6 +318,24 @@ namespace VISU return NULL; } + + //************************************************************ + SUIT_ViewWindow* GetActiveView(const SalomeApp_Module* theModule, QString theType) + { + if(SalomeApp_Application* anApp = theModule->getApp()){ + if(SUIT_ViewManager* aViewManager = anApp->activeViewManager()){ + if (!theType.isNull()) { + if (aViewManager->getType() != theType) + return 0; + } + return aViewManager->getActiveView(); + } + } + return 0; + } + + + //************************************************************ SVTK_ViewWindow* GetViewWindow() { diff --git a/src/VISUGUI/VisuGUI_Tools.h b/src/VISUGUI/VisuGUI_Tools.h index 91034aeb..e02b91d4 100644 --- a/src/VISUGUI/VisuGUI_Tools.h +++ b/src/VISUGUI/VisuGUI_Tools.h @@ -40,6 +40,7 @@ #include CORBA_SERVER_HEADER(MED_Gen) class SUIT_Desktop; +class SUIT_ViewWindow; class VISU_Actor; class SVTK_ViewWindow; class SPlot2d_Viewer; @@ -67,8 +68,11 @@ namespace VISU{ VISU::Storable::TRestoringMap getMapOfValue(_PTR(SObject) theSObject); QString getValue(SALOMEDS::SObject_var theSObject, QString theKey); QString getValue(_PTR(SObject) theSObject, QString theKey); + SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule, const bool theCreate = false ); SVTK_ViewWindow* GetViewWindow(); + SUIT_ViewWindow* GetActiveView(const SalomeApp_Module* theModule, QString theType = QString::null); + VISU_Actor* PublishInView(const SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs); VISU_Actor* UpdateViewer(const SalomeApp_Module* theModule,