From: mkr Date: Tue, 22 Nov 2005 15:00:48 +0000 (+0000) Subject: Fix for bug IPAL10387 : Supervisor viewer has no "View Operations" toolbar. X-Git-Tag: BR_3_1_0_deb~53 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=59237058431fe5ed487edf337bba858fbe8508c9;p=modules%2Fgui.git Fix for bug IPAL10387 : Supervisor viewer has no "View Operations" toolbar. --- diff --git a/src/SUPERVGraph/Makefile.in b/src/SUPERVGraph/Makefile.in index 6c6b88452..149feb93f 100755 --- a/src/SUPERVGraph/Makefile.in +++ b/src/SUPERVGraph/Makefile.in @@ -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 diff --git a/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx b/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx index 297be488d..1a8362daa 100755 --- a/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx +++ b/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx @@ -28,6 +28,9 @@ #include "SUPERVGraph_ViewFrame.h" +#include +#include + //QT Include #include #include @@ -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() {} diff --git a/src/SUPERVGraph/SUPERVGraph_ViewFrame.h b/src/SUPERVGraph/SUPERVGraph_ViewFrame.h index ea0bf5629..985c57085 100755 --- a/src/SUPERVGraph/SUPERVGraph_ViewFrame.h +++ b/src/SUPERVGraph/SUPERVGraph_ViewFrame.h @@ -35,6 +35,8 @@ #include "SUIT_PopupClient.h" #include "SUIT_ViewWindow.h" +#include + 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 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 index 000000000..3b41ded0f --- /dev/null +++ b/src/SUPERVGraph/resources/SUPERVGraph_images.po @@ -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 index 000000000..b9ac39b42 --- /dev/null +++ b/src/SUPERVGraph/resources/SUPERVGraph_msg_en.po @@ -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 index 000000000..038fba118 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 index 000000000..12850643e Binary files /dev/null and b/src/SUPERVGraph/resources/view_reset.png differ diff --git a/src/SalomeApp/resources/SalomeApp.xml b/src/SalomeApp/resources/SalomeApp.xml index 9e5af471f..3597a8e21 100644 --- a/src/SalomeApp/resources/SalomeApp.xml +++ b/src/SalomeApp/resources/SalomeApp.xml @@ -38,6 +38,7 @@ +