Salome HOME
Resources XML file created
[modules/shaper.git] / src / XGUI / XGUI_Viewer.cpp
index db719599f1fe25c91454020efc937b3d2ef5c9e3..c0048f2fad54430451e33e24e6f1c95d0862f5c8 100644 (file)
@@ -2,6 +2,9 @@
 #include "XGUI_MainWindow.h"
 #include "XGUI_ViewWindow.h"
 #include "XGUI_ViewPort.h"
+#include "XGUI_Workshop.h"
+
+#include <SUIT_ResourceMgr.h>
 
 #include <QMdiArea>
 #include <QMdiSubWindow>
@@ -181,8 +184,8 @@ QMdiSubWindow* XGUI_Viewer::createView(V3d_TypeOfView theType)
   if (myViews.size() == 0) 
     setTrihedronShown(true);
 
-  view->setBackground(XGUI_ViewBackground(XGUI::VerticalGradient, Qt::white, QColor(Qt::blue).lighter()));
-  //view->setBackground(XGUI_ViewBackground(Qt::black));
+  Qtx::BackgroundData aBk = XGUI_Workshop::resourceMgr()->backgroundValue("Viewer", "background");
+  view->setBackground(aBk);
   view->updateEnabledDrawMode();
 
   QMdiArea* aMDI = myMainWindow->mdiArea();
@@ -197,7 +200,9 @@ QMdiSubWindow* XGUI_Viewer::createView(V3d_TypeOfView theType)
 
 XGUI_ViewWindow* XGUI_Viewer::activeViewWindow() const
 {
-  return dynamic_cast<XGUI_ViewWindow*>(myActiveView->widget());
+  if (myActiveView)
+    return dynamic_cast<XGUI_ViewWindow*>(myActiveView->widget());
+  return 0;
 }
 
 void XGUI_Viewer::getSelectedObjects(AIS_ListOfInteractive& theList)
@@ -444,10 +449,10 @@ void XGUI_Viewer::addView(QMdiSubWindow* theView)
     connect(aWindow, SIGNAL(keyReleased(XGUI_ViewWindow*, QKeyEvent*)),
             this,    SIGNAL(keyRelease(XGUI_ViewWindow*, QKeyEvent*)));
 
-    connect(aWindow, SIGNAL(contextMenuRequested( QContextMenuEvent* )),
-            this,    SLOT  (onContextMenuRequested( QContextMenuEvent* )));
-    //connect(aWindow, SIGNAL( contextMenuRequested(QContextMenuEvent*) ), 
-    //        this, SIGNAL( contextMenuRequested(QContextMenuEvent*) ) );
+    //connect(aWindow, SIGNAL(contextMenuRequested( QContextMenuEvent* )),
+    //        this,    SLOT  (onContextMenuRequested( QContextMenuEvent* )));
+    connect(aWindow, SIGNAL( contextMenuRequested(QContextMenuEvent*) ), 
+            this, SIGNAL( contextMenuRequested(QContextMenuEvent*) ) );
 
     connect(aWindow, SIGNAL(mouseMoving(XGUI_ViewWindow*, QMouseEvent*)),
             this, SLOT(onMouseMove(XGUI_ViewWindow*, QMouseEvent*)));
@@ -590,29 +595,29 @@ void XGUI_Viewer::updateViewsDrawMode() const
 }
 
 //******************************************************
-void XGUI_Viewer::onContextMenuRequested(QContextMenuEvent* theEvent)
-{
-  XGUI_ViewWindow* aWnd = dynamic_cast<XGUI_ViewWindow*>(sender());
-  if (!aWnd) return;
-
-  QMenu aMenu;
-
-  // Include Viewer actions
-  if (myActions.size() > 0) {
-    aMenu.addActions(myActions);
-    aMenu.addSeparator();
-  }
-  if (aWnd->actions().size() > 0) {
-    aMenu.addActions(aWnd->actions());
-    aMenu.addSeparator();
-  }
-
-  QMdiArea* aMDI = myMainWindow->mdiArea();
-  if (aMenu.actions().size() > 0) {
-    QMenu* aSubMenu = aMenu.addMenu(tr("Windows"));
-    aSubMenu->addActions(aMDI->actions());
-  } else {
-    aMenu.addActions(aMDI->actions());
-  }
-  aMenu.exec(theEvent->globalPos());
-}
\ No newline at end of file
+//void XGUI_Viewer::onContextMenuRequested(QContextMenuEvent* theEvent)
+//{
+//  XGUI_ViewWindow* aWnd = dynamic_cast<XGUI_ViewWindow*>(sender());
+//  if (!aWnd) return;
+//
+//  QMenu aMenu;
+//
+//  // Include Viewer actions
+//  if (myActions.size() > 0) {
+//    aMenu.addActions(myActions);
+//    aMenu.addSeparator();
+//  }
+//  if (aWnd->actions().size() > 0) {
+//    aMenu.addActions(aWnd->actions());
+//    aMenu.addSeparator();
+//  }
+//
+//  QMdiArea* aMDI = myMainWindow->mdiArea();
+//  if (aMenu.actions().size() > 0) {
+//    QMenu* aSubMenu = aMenu.addMenu(tr("Windows"));
+//    aSubMenu->addActions(aMDI->actions());
+//  } else {
+//    aMenu.addActions(aMDI->actions());
+//  }
+//  aMenu.exec(theEvent->globalPos());
+//}