]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix for bug IPAL10387 : Supervisor viewer has no "View Operations" toolbar.
authormkr <mkr@opencascade.com>
Tue, 22 Nov 2005 15:00:48 +0000 (15:00 +0000)
committermkr <mkr@opencascade.com>
Tue, 22 Nov 2005 15:00:48 +0000 (15:00 +0000)
src/SUPERVGraph/Makefile.in
src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx
src/SUPERVGraph/SUPERVGraph_ViewFrame.h
src/SUPERVGraph/resources/SUPERVGraph_images.po [new file with mode: 0644]
src/SUPERVGraph/resources/SUPERVGraph_msg_en.po [new file with mode: 0644]
src/SUPERVGraph/resources/view_pan.png [new file with mode: 0644]
src/SUPERVGraph/resources/view_reset.png [new file with mode: 0644]
src/SalomeApp/resources/SalomeApp.xml

index 6c6b8845201e70ac893b30792b1352ed8e80aa89..149feb93f4b7650e79eded6ccc533e0de94b8032 100755 (executable)
@@ -2,7 +2,7 @@
 top_srcdir=@top_srcdir@
 top_builddir=../..
 srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl
+VPATH=.:@srcdir@:@top_srcdir@/idl:@srcdir@/resources
 
 
 @COMMENCE@
@@ -12,6 +12,10 @@ EXPORT_HEADERS = SUPERVGraph_ViewFrame.h \
                 SUPERVGraph_ViewModel.h \
                 SUPERVGraph.h
 
+# .po files to transmit in .qm
+PO_FILES = SUPERVGraph_images.po \
+          SUPERVGraph_msg_en.po  
+
 # Libraries targets
 
 LIB = libSUPERVGraph.la
@@ -25,6 +29,9 @@ LIB_MOC =       SUPERVGraph_moc.cxx \
                  SUPERVGraph_ViewManager_moc.cxx \
                  SUPERVGraph_ViewModel_moc.cxx 
 
+RESOURCES_FILES = view_pan.png \
+                 view_reset.png
+
 LIB_CLIENT_IDL = 
 
 CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
index 297be488d8a640c10bfd9648e15f42f4b601f183..1a8362daac37138cb1dadb623ea4aaa57012b990 100755 (executable)
@@ -28,6 +28,9 @@
 
 #include "SUPERVGraph_ViewFrame.h"
 
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+
 //QT Include
 #include <qlayout.h>
 #include <qcolordialog.h>
@@ -77,6 +80,43 @@ SUPERVGraph_ViewFrame::SUPERVGraph_ViewFrame( SUIT_Desktop* theDesktop )
   int G = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorGreen").toInt();
   int B = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorBlue").toInt();
   setBackgroundColor(QColor(R,G,B));*/
+
+  myToolBar = new QToolBar(this);
+  myToolBar->setCloseMode(QDockWindow::Undocked);
+  myToolBar->setLabel(tr("LBL_TOOLBAR_LABEL"));
+  createActions();
+  createToolBar();
+}
+
+void SUPERVGraph_ViewFrame::createActions()
+{
+  if (!myActionsMap.isEmpty()) return;
+  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+  QAction* aAction;
+
+  // Panning
+  aAction = new QAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "SUPERVGraph", tr( "ICON_SUPERVGraph_PAN" ) ),
+                       tr( "MNU_PAN_VIEW" ), 0, this);
+  aAction->setStatusTip(tr("DSC_PAN_VIEW"));
+  connect(aAction, SIGNAL(activated()), this, SLOT(onViewPan()));
+  myActionsMap[ PanId ] = aAction;
+
+  // Reset
+  aAction = new QAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "SUPERVGraph", tr( "ICON_SUPERVGraph_RESET" ) ),
+                       tr( "MNU_RESET_VIEW" ), 0, this);
+  aAction->setStatusTip(tr("DSC_RESET_VIEW"));
+  connect(aAction, SIGNAL(activated()), this, SLOT(onViewReset()));
+  myActionsMap[ ResetId ] = aAction;
+}
+
+//================================================================
+// Function : createToolBar
+// Purpose  : 
+//================================================================
+void SUPERVGraph_ViewFrame::createToolBar()
+{
+  myActionsMap[PanId]->addTo(myToolBar);
+  myActionsMap[ResetId]->addTo(myToolBar);
 }
 
 SUPERVGraph_ViewFrame::~SUPERVGraph_ViewFrame() {}
index ea0bf5629dcff6e12fa83db140133183ee6e0f15..985c5708502490e757c6c1ddd8a98263428fa811 100755 (executable)
@@ -35,6 +35,8 @@
 #include "SUIT_PopupClient.h"
 #include "SUIT_ViewWindow.h"
 
+#include <qaction.h>
+
 class SUPERVGRAPH_EXPORT SUPERVGraph_View: public QWidget, public SUIT_PopupClient {
   Q_OBJECT;
  public:
@@ -109,9 +111,19 @@ class SUPERVGRAPH_EXPORT SUPERVGraph_ViewFrame : public SUIT_ViewWindow {
   void           onViewTrihedron(); 
 
  protected:
-  void resizeEvent( QResizeEvent* theEvent );
+  void           resizeEvent( QResizeEvent* theEvent );
   
  private:
+  void           createActions();
+  void           createToolBar();
+
+  //! Actions ID
+  enum { PanId, ResetId };
+  typedef QMap<int, QAction*> ActionsMap;
+
+  ActionsMap       myActionsMap;
+  QToolBar*        myToolBar;
+
   SUPERVGraph_View* myView;
 }; 
 #endif
diff --git a/src/SUPERVGraph/resources/SUPERVGraph_images.po b/src/SUPERVGraph/resources/SUPERVGraph_images.po
new file mode 100644 (file)
index 0000000..3b41ded
--- /dev/null
@@ -0,0 +1,11 @@
+// File:      SUPERVGraph_images.po
+// Created:   11/22/2005 10:52:37 PM
+// Author:    Margarita Karpunina
+// Copyright (C) CEA 2005
+
+msgid "ICON_SUPERVGraph_PAN"
+msgstr "view_pan.png"
+
+msgid "ICON_SUPERVGraph_RESET"
+msgstr "view_reset.png"
+
diff --git a/src/SUPERVGraph/resources/SUPERVGraph_msg_en.po b/src/SUPERVGraph/resources/SUPERVGraph_msg_en.po
new file mode 100644 (file)
index 0000000..b9ac39b
--- /dev/null
@@ -0,0 +1,19 @@
+// File:      SUPERVGraph_msg_en.po
+// Created:   11/22/2005 10:55:36 PM
+// Author:    Margarita Karpunina
+// Copyright (C) CEA 2005
+
+msgid "LBL_TOOLBAR_LABEL"
+msgstr "View Operations"
+
+msgid "DSC_RESET_VIEW"
+msgstr "Reset View Point"
+
+msgid "MNU_RESET_VIEW"
+msgstr "Reset"
+
+msgid "DSC_PAN_VIEW"
+msgstr "Panning the view"
+
+msgid "MNU_PAN_VIEW"
+msgstr "Panning"
diff --git a/src/SUPERVGraph/resources/view_pan.png b/src/SUPERVGraph/resources/view_pan.png
new file mode 100644 (file)
index 0000000..038fba1
Binary files /dev/null and b/src/SUPERVGraph/resources/view_pan.png differ
diff --git a/src/SUPERVGraph/resources/view_reset.png b/src/SUPERVGraph/resources/view_reset.png
new file mode 100644 (file)
index 0000000..1285064
Binary files /dev/null and b/src/SUPERVGraph/resources/view_reset.png differ
index 9e5af471f8bf73bee51f7a1b45de5b833b8ac2a3..3597a8e21e911488d6871c629bfbbc8be2cd5f4b 100644 (file)
@@ -38,6 +38,7 @@
     <parameter name="SalomeApp"    value="${SUITRoot}/resources"/>
     <parameter name="OB"           value="${SUITRoot}/resources"/>
     <parameter name="CAM"          value="${SUITRoot}/resources"/>
+    <parameter name="SUPERVGraph"  value="${SUITRoot}/resources"/>
     <parameter name="GEOM"         value="${GEOM_ROOT_DIR}/share/salome/resources"/>
     <parameter name="LIGHT"        value="${LIGHT_ROOT_DIR}/share/salome/resources"/>
     <parameter name="SMESH"        value="${SMESH_ROOT_DIR}/share/salome/resources"/>