From: prascle Date: Wed, 3 Sep 2008 08:18:23 +0000 (+0000) Subject: PR: YACS Viewer in progress X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bd5d9a0f82e2af6f24a055f064e0ce612c1aa711;p=modules%2Fgui.git PR: YACS Viewer in progress --- diff --git a/adm_local/unix/config_files/check_pyqt.m4 b/adm_local/unix/config_files/check_pyqt.m4 index 68da58e35..363b25437 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 383c0114a..ab304f13f 100644 --- a/configure.ac +++ b/configure.ac @@ -638,6 +638,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/doc/salome/tui/GUI/doxyfile.in b/doc/salome/tui/GUI/doxyfile.in index 192abd083..453a91b8d 100755 --- a/doc/salome/tui/GUI/doxyfile.in +++ b/doc/salome/tui/GUI/doxyfile.in @@ -10,7 +10,7 @@ CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English USE_WINDOWS_ENCODING = NO BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = NO +REPEAT_BRIEF = YES ABBREVIATE_BRIEF = ALWAYS_DETAILED_SEC = YES INLINE_INHERITED_MEMB = YES @@ -40,8 +40,8 @@ EXTRACT_PRIVATE = YES EXTRACT_STATIC = YES EXTRACT_LOCAL_CLASSES = YES EXTRACT_LOCAL_METHODS = NO -HIDE_UNDOC_MEMBERS = YES -HIDE_UNDOC_CLASSES = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO HIDE_FRIEND_COMPOUNDS = NO HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = YES @@ -49,7 +49,7 @@ CASE_SENSE_NAMES = YES HIDE_SCOPE_NAMES = NO SHOW_INCLUDE_FILES = YES INLINE_INFO = YES -SORT_MEMBER_DOCS = NO +SORT_MEMBER_DOCS = YES SORT_BRIEF_DOCS = NO SORT_BY_SCOPE_NAME = NO GENERATE_TODOLIST = YES @@ -96,19 +96,19 @@ FILTER_SOURCE_FILES = YES #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO +SOURCE_BROWSER = YES +INLINE_SOURCES = YES STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = NO +REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES -USE_HTAGS = NO +#USE_HTAGS = NO VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 3 +COLS_IN_ALPHA_INDEX = 2 IGNORE_PREFIX = #--------------------------------------------------------------------------- @@ -119,17 +119,17 @@ HTML_OUTPUT = GUI HTML_FILE_EXTENSION = .html HTML_HEADER = sources/myheader.html HTML_FOOTER = sources/footer.html -HTML_STYLESHEET = sources/doxygen.css +#HTML_STYLESHEET = sources/doxygen.css HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO CHM_FILE = HHC_LOCATION = GENERATE_CHI = NO -BINARY_TOC = YES -TOC_EXPAND = YES +BINARY_TOC = NO +TOC_EXPAND = NO DISABLE_INDEX = NO ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = NO +GENERATE_TREEVIEW = YES TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- @@ -192,14 +192,14 @@ PERLMOD_MAKEVAR_PREFIX = # Configuration options related to the preprocessor #--------------------------------------------------------------------------- ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = YES +MACRO_EXPANSION = NO EXPAND_ONLY_PREDEF = NO SEARCH_INCLUDES = YES INCLUDE_PATH = INCLUDE_FILE_PATTERNS = PREDEFINED = EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = NO +SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references @@ -217,24 +217,24 @@ CLASS_DIAGRAMS = YES HIDE_UNDOC_RELATIONS = NO HAVE_DOT = YES CLASS_GRAPH = YES -COLLABORATION_GRAPH = NO -GROUP_GRAPHS = NO +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES UML_LOOK = NO TEMPLATE_RELATIONS = YES INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = NO +INCLUDED_BY_GRAPH = YES CALL_GRAPH = NO GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = jpg +DOT_IMAGE_FORMAT = png DOT_PATH = DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1200 -MAX_DOT_GRAPH_DEPTH = 0 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 1000 DOT_TRANSPARENT = NO DOT_MULTI_TARGETS = NO -GENERATE_LEGEND = NO +GENERATE_LEGEND = YES DOT_CLEANUP = YES #--------------------------------------------------------------------------- diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index d05f9fc2c..2fb61a635 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -90,6 +90,10 @@ #endif #endif +#include +#include +#include + #ifndef DISABLE_OCCVIEWER #include #ifndef DISABLE_SALOMEOBJECT @@ -600,6 +604,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 ); @@ -701,6 +707,9 @@ void LightApp_Application::onNewWindow() type = QxGraph_Viewer::Type(); break; #endif + case NewQxSceneViewId: + type = QxScene_Viewer::Type(); + break; } if ( !type.isEmpty() ) @@ -822,6 +831,9 @@ void LightApp_Application::updateCommandsStatus() if( a ) a->setEnabled( activeStudy() ); #endif + a = action( NewQxSceneViewId ); + if( a ) + a->setEnabled( activeStudy() ); } /*! @@ -1261,6 +1273,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 834b7ceee..11ef06c53 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -77,7 +77,7 @@ public: enum { RenameId = CAM_Application::UserID, CloseId, CloseAllId, GroupAllId, PreferencesId, MRUId, ModulesListId, - NewGLViewId, NewPlot2dId, NewOCCViewId, NewVTKViewId, NewQxGraphViewId, UserID }; + NewGLViewId, NewPlot2dId, NewOCCViewId, NewVTKViewId, NewQxGraphViewId, NewQxSceneViewId, UserID }; protected: enum { NewStudyId = 1, OpenStudyId }; diff --git a/src/LightApp/Makefile.am b/src/LightApp/Makefile.am index a463e61e7..2a018a7ef 100755 --- a/src/LightApp/Makefile.am +++ b/src/LightApp/Makefile.am @@ -168,6 +168,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 @@ -251,3 +253,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 b48320370..c2229dcaa 100644 --- a/src/LightApp/resources/LightApp.xml +++ b/src/LightApp/resources/LightApp.xml @@ -39,6 +39,7 @@ + @@ -115,4 +116,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 4e14d719f..50763e20f 100644 --- a/src/LightApp/resources/LightApp_msg_en.ts +++ b/src/LightApp/resources/LightApp_msg_en.ts @@ -225,6 +225,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 82c27dbce..41cc92467 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..00d897340 --- /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: + 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(); + + //! Actions ID + enum { FitAllId, FitRectId, ZoomId, ScaleOpId, PanId, GlobalPanId, MoveOpId, ResetId }; + + 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 373ab093b..3899be9c5 100644 --- a/src/SalomeApp/resources/SalomeApp.xml +++ b/src/SalomeApp/resources/SalomeApp.xml @@ -48,6 +48,7 @@ + @@ -145,6 +146,12 @@ +
+ + + + +