From: prascle Date: Thu, 6 Nov 2008 14:58:09 +0000 (+0000) Subject: PR: merge from tag mergeto_BR_V5_DEV_20081106 X-Git-Tag: V5_1_0rc1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bcc2e10d226f47d304e3fe8541952ad3baa8eee3;p=modules%2Fgui.git PR: merge from tag mergeto_BR_V5_DEV_20081106 --- diff --git a/adm_local/unix/config_files/check_pyqt.m4 b/adm_local/unix/config_files/check_pyqt.m4 index 34ee10161..2186ec039 100644 --- a/adm_local/unix/config_files/check_pyqt.m4 +++ b/adm_local/unix/config_files/check_pyqt.m4 @@ -121,7 +121,7 @@ if test "x$pyqt_ok" == "xyes" ; then TEST_LIB_DIRS="${TEST_LIB_DIRS} ${SIPDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages" TEST_LIB_DIRS="${TEST_LIB_DIRS} ${SIPDIR}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages/PyQt4" TEST_SIPS_DIRS="${TEST_SIPS_DIRS} ${SIPDIR} ${SIPDIR}/sip" - TEST_SIPS_DIRS="${TEST_SIPS_DIRS} ${SIPDIR}/share ${SIPDIR}/share/sip" + TEST_SIPS_DIRS="${TEST_SIPS_DIRS} ${SIPDIR}/share ${SIPDIR}/share/sip ${SIPDIR}/share/sip/PyQt4" fi if test "x${PYTHONHOME}" != "x" ; then TEST_LIB_DIRS="${TEST_LIB_DIRS} ${PYTHONHOME}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/site-packages" diff --git a/configure.ac b/configure.ac index ed55581cb..e761d9ec4 100644 --- a/configure.ac +++ b/configure.ac @@ -615,6 +615,7 @@ AC_OUTPUT([ \ ./src/SPlot2d/Makefile \ ./src/SUPERVGraph/Makefile \ ./src/QxGraph/Makefile \ + ./src/QxScene/Makefile \ ./src/LightApp/Makefile \ ./src/ResExporter/Makefile \ ./src/TOOLSGUI/Makefile \ diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 341a4527d..80d7fc139 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -91,6 +91,10 @@ #endif #endif +#include +#include +#include + #ifndef DISABLE_OCCVIEWER #include #ifndef DISABLE_SALOMEOBJECT @@ -602,6 +606,8 @@ void LightApp_Application::createActions() createActionForViewer( NewQxGraphViewId, newWinMenu, QString::number( 4 ), Qt::ALT+Qt::Key_C ); #endif + createActionForViewer( NewQxSceneViewId, newWinMenu, QString::number( 5 ), Qt::ALT+Qt::Key_S ); + createAction( RenameId, tr( "TOT_RENAME" ), QIcon(), tr( "MEN_DESK_RENAME" ), tr( "PRP_RENAME" ), Qt::SHIFT+Qt::Key_R, desk, false, this, SLOT( onRenameWindow() ) ); createMenu( RenameId, windowMenu, -1 ); @@ -710,6 +716,9 @@ void LightApp_Application::onNewWindow() type = QxGraph_Viewer::Type(); break; #endif + case NewQxSceneViewId: + type = QxScene_Viewer::Type(); + break; } if ( !type.isEmpty() ) @@ -831,6 +840,9 @@ void LightApp_Application::updateCommandsStatus() if( a ) a->setEnabled( activeStudy() ); #endif + a = action( NewQxSceneViewId ); + if( a ) + a->setEnabled( activeStudy() ); } /*! @@ -1275,6 +1287,13 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType } } #endif + if( vmType == QxScene_Viewer::Type() ) + { + viewMgr = new QxScene_ViewManager( activeStudy(), desktop() ); + QxScene_Viewer* vm = new QxScene_Viewer(); + viewMgr->setViewModel( vm ); + QxScene_ViewWindow* wnd = dynamic_cast( viewMgr->getActiveView() ); + } //#ifndef DISABLE_SUPERVGRAPHVIEWER // if( vmType == SUPERVGraph_Viewer::Type() ) // { diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h index 467de5ec5..0ae88f775 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -78,7 +78,7 @@ public: CloseId, CloseAllId, GroupAllId, PreferencesId, MRUId, ModulesListId, NewGLViewId, NewPlot2dId, NewOCCViewId, NewVTKViewId, NewQxGraphViewId, - StyleId, + NewQxSceneViewId, StyleId, UserID }; protected: diff --git a/src/LightApp/Makefile.am b/src/LightApp/Makefile.am index 10b5d2288..ac1a1efaf 100755 --- a/src/LightApp/Makefile.am +++ b/src/LightApp/Makefile.am @@ -177,6 +177,8 @@ if ENABLE_PLOT2DVIEWER else libLightApp_la_CPPFLAGS += -DDISABLE_PLOT2DVIEWER endif +libLightApp_la_CPPFLAGS+= -I$(srcdir)/../QxScene + if ENABLE_OCCVIEWER libLightApp_la_CPPFLAGS += -I$(srcdir)/../OCCViewer else !ENABLE_OCCVIEWER @@ -260,3 +262,4 @@ endif if ENABLE_QXGRAPHVIEWER libLightApp_la_LIBADD += ../QxGraph/libQxGraph.la endif + libLightApp_la_LIBADD+= ../QxScene/libQxScene.la diff --git a/src/LightApp/resources/LightApp.xml b/src/LightApp/resources/LightApp.xml index 8bb18a43d..a63e06006 100644 --- a/src/LightApp/resources/LightApp.xml +++ b/src/LightApp/resources/LightApp.xml @@ -39,6 +39,7 @@ + @@ -122,4 +123,10 @@ +
+ + + + +
diff --git a/src/LightApp/resources/LightApp_msg_en.po b/src/LightApp/resources/LightApp_msg_en.po index e380b6869..dc42b5492 100644 --- a/src/LightApp/resources/LightApp_msg_en.po +++ b/src/LightApp/resources/LightApp_msg_en.po @@ -98,6 +98,9 @@ msgstr "VT&K view" msgid "LightApp_Application::NEW_WINDOW_4" msgstr "&QxGraph view" +msgid "LightApp_Application::NEW_WINDOW_5" +msgstr "Qx&Scene view" + msgid "LightApp_Application::INF_CANCELLED" msgstr "Module activation cancelled" diff --git a/src/LightApp/resources/LightApp_msg_en.ts b/src/LightApp/resources/LightApp_msg_en.ts index d5e7a2c18..0c8e44c89 100644 --- a/src/LightApp/resources/LightApp_msg_en.ts +++ b/src/LightApp/resources/LightApp_msg_en.ts @@ -369,6 +369,10 @@ CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITASNEW_WINDOW_4 &QxGraph view + + NEW_WINDOW_5 + Qx&Scene view + OBJ_BROWSER_NAME Object diff --git a/src/Makefile.am b/src/Makefile.am index c9f34677f..4f3d6649c 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -61,7 +61,7 @@ endif if ENABLE_QXGRAPHVIEWER SUBDIRS += QxGraph endif -SUBDIRS += LightApp ResExporter +SUBDIRS += QxScene LightApp ResExporter if GUI_ENABLE_CORBA SUBDIRS += TOOLSGUI Session SalomeApp SALOME_SWIG SALOME_PY SALOME_PYQT diff --git a/src/QxScene/DebTrace.hxx b/src/QxScene/DebTrace.hxx new file mode 100644 index 000000000..369bd59c5 --- /dev/null +++ b/src/QxScene/DebTrace.hxx @@ -0,0 +1,12 @@ +#ifndef __DEBTRACE_HXX__ +#define __DEBTRACE_HXX__ + +#include + +#ifdef _DEVDEBUG_ +#define DEBTRACE(msg) {std::cerr< +#include +#include + +#define _DEVDEBUG_ +#include "DebTrace.hxx" + +/*! + Constructor +*/ +QxScene_Viewer::QxScene_Viewer() + :SUIT_ViewModel() +{ + DEBTRACE("QxScene_Viewer::QxScene_Viewer"); +} + +/*! + Destructor +*/ +QxScene_Viewer::~QxScene_Viewer() +{ + DEBTRACE("QxScene_Viewer::~QxScene_Viewer"); +} + +void QxScene_Viewer::setViewManager( SUIT_ViewManager* mgr) +{ + DEBTRACE("QxScene_Viewer::setViewManager"); + SUIT_ViewModel::setViewManager( mgr ); +} + +/*! + Start initialization of view window + \param view - view window to be initialized +*/ +void QxScene_Viewer::initView( QxScene_ViewWindow* view ) +{ + DEBTRACE("QxScene_Viewer::initView"); + if ( view ) + { + view->initLayout(); + + /* + // test add items into the current canvas view + */ + } +} + +/*! + Creates new view window + \param theDesktop - main window of application +*/ +SUIT_ViewWindow* QxScene_Viewer::createView(SUIT_Desktop* theDesktop) +{ + DEBTRACE("QxScene_Viewer::createView"); + QxScene_ViewWindow* aRes = new QxScene_ViewWindow( theDesktop, this ); + initView( aRes ); + return aRes; +} + +/*! + Builds popup for QxScene viewer +*/ +void QxScene_Viewer::contextMenuPopup(QMenu* thePopup) +{ + DEBTRACE("QxScene_Viewer::contextMenuPopup"); +} + +/*! + SLOT: called if background color is to be changed changed, passes new color to current canvas view +*/ +void QxScene_Viewer::onChangeBgColor() +{ + QxScene_ViewWindow* aView = (QxScene_ViewWindow*)(myViewManager->getActiveView()); + if( !aView ) + return; + QColor aColorActive = aView->backgroundColor(); + + QColor selColor = QColorDialog::getColor( aColorActive, aView); + if ( selColor.isValid() ) + aView->setBackgroundColor(selColor); +} + +/*! + SLOT: called when popup item "Show toolbar" is activated, shows toolbar of active view window +*/ +void QxScene_Viewer::onShowToolbar() { + QxScene_ViewWindow* aView = (QxScene_ViewWindow*)(myViewManager->getActiveView()); + if ( aView ) + aView->getToolBar()->show(); +} diff --git a/src/QxScene/QxScene_ViewModel.h b/src/QxScene/QxScene_ViewModel.h new file mode 100644 index 000000000..a891abff8 --- /dev/null +++ b/src/QxScene/QxScene_ViewModel.h @@ -0,0 +1,54 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef QXSCENE_VIEWMODEL_H +#define QXSCENE_VIEWMODEL_H + +#include "QxScene.h" + +#include "SUIT_ViewModel.h" + +class QxScene_ViewWindow; + +class QXSCENE_EXPORT QxScene_Viewer: public SUIT_ViewModel +{ + Q_OBJECT + + public: + static QString Type() { return "QxSceneViewer"; } + + QxScene_Viewer(); + virtual ~QxScene_Viewer(); + + virtual void setViewManager( SUIT_ViewManager* ); + virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop); + virtual QString getType() const { return Type(); } + + virtual void contextMenuPopup(QMenu*); + + protected: + void initView(QxScene_ViewWindow* view); + + protected slots: + void onShowToolbar(); + void onChangeBgColor(); + + private: +}; + +#endif diff --git a/src/QxScene/QxScene_ViewWindow.cxx b/src/QxScene/QxScene_ViewWindow.cxx new file mode 100644 index 000000000..3f12b72e4 --- /dev/null +++ b/src/QxScene/QxScene_ViewWindow.cxx @@ -0,0 +1,268 @@ +// SALOME QxScene : build Supervisor viewer into desktop +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "QxScene_ViewWindow.h" +#include "QxScene_Def.h" + +#include +#include +#include + +#include +#include +#include + +//QT Include +#include +#include + +#define _DEVDEBUG_ +#include "DebTrace.hxx" + +using namespace std; + +/*! + Constructor +*/ +QxScene_ViewWindow::QxScene_ViewWindow( SUIT_Desktop* theDesktop, QxScene_Viewer* theModel) + : SUIT_ViewWindow( theDesktop ) +{ + DEBTRACE("Construct QxScene_ViewWindow"); + myViewModel = theModel; + _scene = 0; + _sceneView = 0; +} + +/*! + Initialization +*/ +void QxScene_ViewWindow::initLayout() +{ + DEBTRACE("QxScene_ViewWindow::initLayout"); + createActions(); + createToolBar(); + + // --- QGraphics test + +// _scene = new QGraphicsScene(); +// _sceneView = new QGraphicsView(this); +// setCentralWidget(_sceneView); +// _sceneView->setScene(_scene); +// QGraphicsRectItem *rect = _scene->addRect(QRectF(0, 0, 100, 100)); +// _sceneView->show(); +} + +/*! + Creates actions of QxScene view window +*/ +void QxScene_ViewWindow::createActions() +{ + DEBTRACE("QxScene_ViewWindow::createActions"); + QtxActionToolMgr* mgr = toolMgr(); + QtxAction* aAction; + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + + // 2. Scaling operations + + // 2.1. Fit All + aAction = new QtxAction( tr( "MNU_FITALL" ), + aResMgr->loadPixmap( "QxSceneViewer", tr( "ICON_QXSCENE_FITALL" ) ), + tr( "MNU_FITALL" ), + 0, this); + aAction->setStatusTip( tr( "DSC_FITALL" ) ); + connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewFitAll() ) ); + mgr->registerAction( aAction, FitAllId ); + + // 2.2. Fit Rect + aAction = new QtxAction( tr( "MNU_FITRECT" ), + aResMgr->loadPixmap( "QxSceneViewer", tr( "ICON_QXSCENE_FITAREA" ) ), + tr( "MNU_FITRECT" ), + 0, this); + aAction->setStatusTip( tr( "DSC_FITRECT" ) ); + connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewFitArea() ) ); + mgr->registerAction( aAction, FitRectId ); + + // 2.3. Zoom + aAction = new QtxAction( tr( "MNU_ZOOM_VIEW" ), + aResMgr->loadPixmap( "QxSceneViewer", tr( "ICON_QXSCENE_ZOOM" ) ), + tr( "MNU_ZOOM_VIEW" ), + 0, this); + aAction->setStatusTip( tr( "DSC_ZOOM_VIEW" ) ); + connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewZoom() ) ); + mgr->registerAction( aAction, ZoomId ); + + // 2.4. Create multi-action for scaling operations + QtxMultiAction* aScaleAction = new QtxMultiAction( this ); + aScaleAction->insertAction( mgr->action( FitAllId ) ); + aScaleAction->insertAction( mgr->action( FitRectId ) ); + aScaleAction->insertAction( mgr->action( ZoomId ) ); + mgr->registerAction( aScaleAction, ScaleOpId ); + + // 3. Moving operations + + // 3.1. Panning + aAction = new QtxAction( tr( "MNU_PAN_VIEW" ), + aResMgr->loadPixmap( "QxSceneViewer", tr( "ICON_QXSCENE_PAN" ) ), + tr( "MNU_PAN_VIEW" ), + 0, this); + aAction->setStatusTip( tr( "DSC_PAN_VIEW" ) ); + connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewPan() ) ); + mgr->registerAction( aAction, PanId ); + + // 3.2. Global Panning + aAction = new QtxAction( tr( "MNU_GLOBALPAN_VIEW" ), + aResMgr->loadPixmap( "QxSceneViewer", tr( "ICON_QXSCENE_GLOBALPAN" ) ), + tr( "MNU_GLOBALPAN_VIEW" ), + 0, this); + aAction->setStatusTip( tr( "DSC_GLOBALPAN_VIEW" ) ); + connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewGlobalPan() ) ); + mgr->registerAction( aAction, GlobalPanId ); + + // 3.3. Create multi-action for moving operations + QtxMultiAction* aPanAction = new QtxMultiAction( this ); + aPanAction->insertAction( mgr->action( PanId ) ); + aPanAction->insertAction( mgr->action( GlobalPanId ) ); + mgr->registerAction( aPanAction, MoveOpId ); + + // reset + aAction = new QtxAction( tr( "MNU_RESET_VIEW" ), + aResMgr->loadPixmap( "QxSceneViewer", tr( "ICON_QXSCENE_RESET" ) ), + tr( "MNU_RESET_VIEW" ), + 0, this); + aAction->setStatusTip( tr( "DSC_RESET_VIEW" ) ); + connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewReset() ) ); + mgr->registerAction( aAction, ResetId ); +} + +/*! + Creates toolbar of QxScene view window +*/ +void QxScene_ViewWindow::createToolBar() +{ + DEBTRACE("QxScene_ViewWindow::createToolBar"); + QtxActionToolMgr* mgr = toolMgr(); + myToolBar = mgr->createToolBar( tr( "LBL_TOOLBAR_LABEL" ) ); + mgr->append( ScaleOpId, myToolBar ); + mgr->append( MoveOpId, myToolBar ); + mgr->append( ResetId, myToolBar ); +} + +/*! + \brief Get view window's toolbar. + \return toolbar +*/ +QToolBar* QxScene_ViewWindow::getToolBar() +{ + DEBTRACE("QxScene_ViewWindow::getToolBar"); + return toolMgr()->toolBar( myToolBar ); +} + +/*! + Destructor +*/ +QxScene_ViewWindow::~QxScene_ViewWindow() +{ + DEBTRACE("destructor QxScene_ViewWindow"); + +} + +/*! + Reset the active view +*/ +void QxScene_ViewWindow::onViewReset() +{ + DEBTRACE( "QxScene_ViewWindow::onViewReset" ); +} + +/*! + Sets a new center of the active view +*/ +void QxScene_ViewWindow::onViewGlobalPan() +{ + DEBTRACE( "QxScene_ViewWindow::onViewGlobalPan" ); +} + +/*! + Zooms the active view +*/ +void QxScene_ViewWindow::onViewZoom() +{ + DEBTRACE( "QxScene_ViewWindow::onViewZoom" ); +} + +/*! + Moves the active view +*/ +void QxScene_ViewWindow::onViewPan() +{ + DEBTRACE( "QxScene_ViewWindow::onViewPan" ); +} + +/*! + Fits all obejcts within a rectangular area of the active view +*/ +void QxScene_ViewWindow::onViewFitArea() +{ + DEBTRACE( "QxScene_ViewWindow::onViewFitArea" ); +} + +/*! + Fits all objects in the active view +*/ +void QxScene_ViewWindow::onViewFitAll() +{ + DEBTRACE( "QxScene_ViewWindow::onViewFitAll" ); +} + +/*! + Set background of the viewport +*/ +void QxScene_ViewWindow::setBackgroundColor( const QColor& color ) +{ + DEBTRACE("QxScene_ViewWindow::setBackgroundColor"); +} + +/*! + Returns background of the viewport +*/ +QColor QxScene_ViewWindow::backgroundColor() const +{ + DEBTRACE("QxScene_ViewWindow::backgroundColor"); +} + +/*! + Custom resize event handler +*/ +void QxScene_ViewWindow::resizeEvent( QResizeEvent* theEvent ) +{ + DEBTRACE("QxScene_ViewWindow::resizeEvent"); +} + +/*! + Get resource manager +*/ +SUIT_ResourceMgr* QxScene_ViewWindow::resMgr() const +{ + DEBTRACE("QxScene_ViewWindow::resMgr"); + return SUIT_Session::session()->resourceMgr(); +} + diff --git a/src/QxScene/QxScene_ViewWindow.h b/src/QxScene/QxScene_ViewWindow.h new file mode 100644 index 000000000..d12d6001d --- /dev/null +++ b/src/QxScene/QxScene_ViewWindow.h @@ -0,0 +1,100 @@ +// SALOME QxScene : build Supervisor viewer into desktop +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef QXSCENE_VIEWWINDOW_H +#define QXSCENE_VIEWWINDOW_H + +#include "QxScene.h" +#include "QxScene_ViewModel.h" + +#include "SUIT_ViewWindow.h" + +#include "QtxAction.h" + +#include + +#include +#include + +#ifdef WIN32 +#pragma warning ( disable:4251 ) +#endif + +class SUIT_ResourceMgr; + +class QXSCENE_EXPORT QxScene_ViewWindow : public SUIT_ViewWindow { + Q_OBJECT + + public: + //! Actions ID + enum { FitAllId, FitRectId, ZoomId, ScaleOpId, PanId, GlobalPanId, MoveOpId, ResetId }; + + QxScene_ViewWindow(SUIT_Desktop* theDesktop, QxScene_Viewer* theModel); + virtual ~QxScene_ViewWindow(); + + void setBackgroundColor( const QColor& ); + QColor backgroundColor() const; + + QToolBar* getToolBar(); + + SUIT_ResourceMgr* resMgr() const; + + QxScene_Viewer* getViewModel() const { return myViewModel; } + void setViewModel(QxScene_Viewer* theViewModel) { myViewModel = theViewModel; } + + virtual void initLayout(); + + void contextPopupEvent(QContextMenuEvent* theEvent) { emit contextMenuRequested( theEvent); } + + void setScene(QGraphicsScene* scene) { _scene = scene; } + QGraphicsScene* getScene() { return _scene; } + void setSceneView(QGraphicsView* sceneView){ _sceneView = sceneView; } + QGraphicsView* getSceneView() { return _sceneView; } + + public slots: + void onViewFitAll(); + void onViewFitArea(); + void onViewZoom(); + void onViewPan(); + void onViewGlobalPan(); + void onViewReset(); + + protected: + void resizeEvent( QResizeEvent* theEvent ); + + QGraphicsScene* _scene; + QGraphicsView* _sceneView; + + private: + void createActions(); + void createToolBar(); + + int myToolBar; + + QxScene_Viewer* myViewModel; +}; + +#ifdef WIN32 +#pragma warning ( default:4251 ) +#endif + +#endif diff --git a/src/QxScene/resources/QxSceneViewer_images.ts b/src/QxScene/resources/QxSceneViewer_images.ts new file mode 100644 index 000000000..4d12950ea --- /dev/null +++ b/src/QxScene/resources/QxSceneViewer_images.ts @@ -0,0 +1,29 @@ + + + @default + + ICON_QXSCENE_RESET + qx_view_reset.png + + + ICON_QXSCENE_ZOOM + qx_view_zoom.png + + + ICON_QXSCENE_GLOBALPAN + qx_view_glpan.png + + + ICON_QXSCENE_PAN + qx_view_pan.png + + + ICON_QXSCENE_FITALL + qx_view_fitall.png + + + ICON_QXSCENE_FITAREA + qx_view_fitarea.png + + + diff --git a/src/QxScene/resources/QxSceneViewer_msg_en.ts b/src/QxScene/resources/QxSceneViewer_msg_en.ts new file mode 100644 index 000000000..4997178c2 --- /dev/null +++ b/src/QxScene/resources/QxSceneViewer_msg_en.ts @@ -0,0 +1,36 @@ + + + @default + + MEN_CHANGE_BACKGROUND + Change background... + + + MNU_PAN_VIEW + Panning + + + DSC_PAN_VIEW + Panning the view + + + MNU_RESET_VIEW + Reset + + + DSC_RESET_VIEW + Reset View Point + + + LBL_TOOLBAR_LABEL + View Operations + + + + QxScene_ViewManager + + QXSCENE_VIEW_TITLE + QGraphics scene:%M - viewer:%V + + + diff --git a/src/QxScene/resources/QxScene_images.po b/src/QxScene/resources/QxScene_images.po new file mode 100644 index 000000000..3ecdd9553 --- /dev/null +++ b/src/QxScene/resources/QxScene_images.po @@ -0,0 +1,42 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: QxScene_images.po +// Created: 03/02/2007 +// Author: Margarita Karpunina +// Copyright (C) CEA 2007 + + +msgid "ICON_QXSCENE_FITALL" +msgstr "qx_view_fitall.png" + +msgid "ICON_QXSCENE_FITAREA" +msgstr "qx_view_fitarea.png" + +msgid "ICON_QXSCENE_ZOOM" +msgstr "qx_view_zoom.png" + +msgid "ICON_QXSCENE_PAN" +msgstr "qx_view_pan.png" + +msgid "ICON_QXSCENE_GLOBALPAN" +msgstr "qx_view_glpan.png" + +msgid "ICON_QXSCENE_RESET" +msgstr "qx_view_reset.png" + diff --git a/src/QxScene/resources/QxScene_msg_en.po b/src/QxScene/resources/QxScene_msg_en.po new file mode 100644 index 000000000..b795120ce --- /dev/null +++ b/src/QxScene/resources/QxScene_msg_en.po @@ -0,0 +1,40 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File: QxScene_msg_en.po +// Created: 03/02/2007 +// Author: Margarita Karpunina +// Copyright (C) CEA 2007 + +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" + +msgid "MEN_CHANGE_BACKGROUND" +msgstr "Change background..." diff --git a/src/QxScene/resources/qx_view_fitall.png b/src/QxScene/resources/qx_view_fitall.png new file mode 100755 index 000000000..87e001dd8 Binary files /dev/null and b/src/QxScene/resources/qx_view_fitall.png differ diff --git a/src/QxScene/resources/qx_view_fitarea.png b/src/QxScene/resources/qx_view_fitarea.png new file mode 100755 index 000000000..450dc56c6 Binary files /dev/null and b/src/QxScene/resources/qx_view_fitarea.png differ diff --git a/src/QxScene/resources/qx_view_glpan.png b/src/QxScene/resources/qx_view_glpan.png new file mode 100644 index 000000000..28ab547ea Binary files /dev/null and b/src/QxScene/resources/qx_view_glpan.png differ diff --git a/src/QxScene/resources/qx_view_pan.png b/src/QxScene/resources/qx_view_pan.png new file mode 100755 index 000000000..ec56cacc7 Binary files /dev/null and b/src/QxScene/resources/qx_view_pan.png differ diff --git a/src/QxScene/resources/qx_view_reset.png b/src/QxScene/resources/qx_view_reset.png new file mode 100755 index 000000000..66f81e604 Binary files /dev/null and b/src/QxScene/resources/qx_view_reset.png differ diff --git a/src/QxScene/resources/qx_view_zoom.png b/src/QxScene/resources/qx_view_zoom.png new file mode 100755 index 000000000..386c966d1 Binary files /dev/null and b/src/QxScene/resources/qx_view_zoom.png differ diff --git a/src/SalomeApp/resources/SalomeApp.xml b/src/SalomeApp/resources/SalomeApp.xml index 818ab0796..a399d3282 100644 --- a/src/SalomeApp/resources/SalomeApp.xml +++ b/src/SalomeApp/resources/SalomeApp.xml @@ -48,6 +48,7 @@ + @@ -149,6 +150,12 @@ +
+ + + + +