]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
"isActiveView" global parameter added, "activeView" parameter calculation is changed...
authorasv <asv@opencascade.com>
Mon, 11 Jul 2005 11:06:42 +0000 (11:06 +0000)
committerasv <asv@opencascade.com>
Mon, 11 Jul 2005 11:06:42 +0000 (11:06 +0000)
src/SalomeApp/SalomeApp_Selection.cxx
src/SalomeApp/SalomeApp_Selection.h

index 4bba5366222b56e99d6132ce1d25adff237d52e5..3a45e9ecff3cf446c0391cb23a8fb7af414e7cd1 100644 (file)
@@ -7,6 +7,7 @@
 #include "SalomeApp_Application.h"
 
 #include "SUIT_Session.h"
+#include "SUIT_ViewWindow.h"
 
 SalomeApp_Selection::SalomeApp_Selection()
 : myStudy( 0 )
@@ -53,18 +54,10 @@ QtxValue SalomeApp_Selection::param( const int, const QString& p ) const
 
 QtxValue SalomeApp_Selection::globalParam( const QString& p ) const
 {
-  if( p=="client" )
-    return QtxValue( myPopupClient );
-  else if ( p=="activeView" )
-    {
-      QString aViewType = "";
-      SUIT_ViewWindow* anActiveView = study()->application()->desktop()->activeWindow();
-      if (anActiveView)
-       aViewType = anActiveView->getViewManager()->getType();
-      return QtxValue(aViewType);
-    }
-  else
-    return QtxPopupMgr::Selection::globalParam( p );
+  if      ( p == "client" )        return QtxValue( myPopupClient );
+  else if ( p == "isActiveView" )  return QtxValue( (bool)activeVW() );
+  else if ( p == "activeView" )    return QtxValue( activeViewType() );
+  else                             return QtxPopupMgr::Selection::globalParam( p );
 }
 
 void SalomeApp_Selection::processOwner( const SalomeApp_DataOwner* )
@@ -77,3 +70,28 @@ QString SalomeApp_Selection::entry( const int index ) const
     return myEntries[ index ];
   return QString();
 }
+
+QString SalomeApp_Selection::activeViewType() const
+{
+  SUIT_ViewWindow* win = activeVW();
+  if ( win ) {
+    SUIT_ViewManager* vm = win->getViewManager();
+    if ( vm )
+      return vm->getType();
+  }
+  return QString::null;
+}
+
+SUIT_ViewWindow* SalomeApp_Selection::activeVW() const
+{
+  SUIT_Session* session = SUIT_Session::session();
+  if ( session ) {
+    SUIT_Application* app = session->activeApplication();
+    if ( app ) {
+      SUIT_Desktop* desk = app->desktop();
+      if ( desk ) 
+       return desk->activeWindow();
+    }
+  }
+  return 0;
+}
index a9134f93f4f2583d4088a0ba0ee4433f52fedc7d..b3fca5bc91727ca546325d6317f15ff5e36703c0 100644 (file)
@@ -35,6 +35,7 @@ class SalomeApp_SelectionMgr;
 class SalomeApp_DataOwner;
 class SalomeApp_Study;
 class SALOMEDSClient_Study;
+class SUIT_ViewWindow;
 
 
 class SalomeApp_Selection : public QtxPopupMgr::Selection
@@ -53,6 +54,8 @@ public:
 protected:
   QString                        entry( const int ) const;
   SalomeApp_Study*               study() const { return myStudy; }
+  QString                        activeViewType() const;
+  SUIT_ViewWindow*               activeVW() const;
 
 private:
   QString                        myPopupClient;