From 0be39b934a6050f16fcf52cd0f97631b4c1c94a9 Mon Sep 17 00:00:00 2001 From: stv Date: Tue, 31 May 2005 09:17:35 +0000 Subject: [PATCH] Popup item "Dump view" --- src/OCCViewer/OCCViewer_ViewManager.cxx | 19 +++-------- src/OCCViewer/OCCViewer_ViewModel.cxx | 21 +++++++----- src/OCCViewer/OCCViewer_ViewModel.h | 3 +- src/OCCViewer/OCCViewer_ViewWindow.cxx | 8 ++--- src/OCCViewer/resources/OCCViewer_msg_en.po | 11 ++++-- src/SVTK/SVTK_ViewModel.cxx | 37 ++++++++++----------- src/SVTK/SVTK_ViewModel.h | 3 +- src/VTKViewer/VTKViewer_ViewModel.cxx | 21 +++++++----- src/VTKViewer/VTKViewer_ViewModel.h | 3 +- src/VTKViewer/resources/VTKViewer_msg_en.po | 10 +++++- 10 files changed, 75 insertions(+), 61 deletions(-) diff --git a/src/OCCViewer/OCCViewer_ViewManager.cxx b/src/OCCViewer/OCCViewer_ViewManager.cxx index 976b13d7e..017d9d781 100755 --- a/src/OCCViewer/OCCViewer_ViewManager.cxx +++ b/src/OCCViewer/OCCViewer_ViewManager.cxx @@ -4,7 +4,7 @@ int OCCViewer_ViewManager::myMaxId = 0; -//*************************************************************** +//***************************************************************/ OCCViewer_ViewManager::OCCViewer_ViewManager( SUIT_Study* study, SUIT_Desktop* theDesktop, bool DisplayTrihedron ) : SUIT_ViewManager( study, theDesktop ) { @@ -12,30 +12,19 @@ OCCViewer_ViewManager::OCCViewer_ViewManager( SUIT_Study* study, SUIT_Desktop* t setViewModel( new OCCViewer_Viewer( DisplayTrihedron ) ); } -//*************************************************************** +//***************************************************************/ OCCViewer_ViewManager::~OCCViewer_ViewManager() { } -//*************************************************************** +//***************************************************************/ void OCCViewer_ViewManager::setViewName(SUIT_ViewWindow* theView) { int aPos = myViews.find(theView); theView->setCaption( QString( "OCC scene:%1 - viewer:%2" ).arg(myId).arg(aPos+1)); } -//*************************************************************** -/*bool OCCViewer_ViewManager::insertView(SUIT_ViewWindow* theView) -{ - bool res = SUIT_ViewManager::insertView( theView ); - if ( res ) { - OCCViewer_ViewWindow* view = (OCCViewer_ViewWindow*)theView; - connect( view, SIGNAL(cloneView()), this, SLOT(createView()) ); - } - return res; -}*/ - -//*************************************************************** +//***************************************************************/ void OCCViewer_ViewManager::contextMenuPopup( QPopupMenu* popup ) { SUIT_ViewManager::contextMenuPopup( popup ); diff --git a/src/OCCViewer/OCCViewer_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx index 8878b837a..5de1e756a 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ b/src/OCCViewer/OCCViewer_ViewModel.cxx @@ -181,16 +181,21 @@ void OCCViewer_Viewer::enableMultiselection(bool isEnable) //********************************************************************* void OCCViewer_Viewer::contextMenuPopup(QPopupMenu* thePopup) { - if (thePopup->count() > 0) thePopup->insertSeparator(); - thePopup->insertItem("Change background...", this, SLOT(onChangeBgColor())); + thePopup->insertItem( tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) ); + thePopup->insertItem( tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) ); + + thePopup->insertSeparator(); OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView()); - if ( aView ) { - if ( !aView->getToolBar()->isVisible() ) { - if (thePopup->count() > 0) thePopup->insertSeparator(); - thePopup->insertItem("Show toolbar", this, SLOT(onShowToolbar())); - } - } + if ( aView && !aView->getToolBar()->isVisible() ) + thePopup->insertItem( tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) ); +} + +void OCCViewer_Viewer::onDumpView() +{ + OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView()); + if ( aView ) + aView->onDumpView(); } //********************************************************************* diff --git a/src/OCCViewer/OCCViewer_ViewModel.h b/src/OCCViewer/OCCViewer_ViewModel.h index fe8703b56..f523cb43f 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.h +++ b/src/OCCViewer/OCCViewer_ViewModel.h @@ -110,8 +110,9 @@ protected slots: void onMouseMove(SUIT_ViewWindow*, QMouseEvent*); void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*); - void onChangeBgColor(); + void onDumpView(); void onShowToolbar(); + void onChangeBgColor(); private: Handle(V3d_Viewer) myV3dViewer; diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index f9065da7b..58df1e245 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -391,7 +391,7 @@ void OCCViewer_ViewWindow::setTransformRequested ( OperationType op ) } -//**************************************************************** +//****************************************************************/ void OCCViewer_ViewWindow::vpMouseMoveEvent(QMouseEvent* theEvent) { myCurrX = theEvent->x(); @@ -442,7 +442,7 @@ void OCCViewer_ViewWindow::vpMouseMoveEvent(QMouseEvent* theEvent) } } -//**************************************************************** +//****************************************************************/ void OCCViewer_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent) { switch ( myOperation ) { @@ -523,7 +523,7 @@ void OCCViewer_ViewWindow::resetState() } -//**************************************************************** +//****************************************************************/ void OCCViewer_ViewWindow::drawRect() { QPainter aPainter(myViewPort); @@ -536,7 +536,7 @@ void OCCViewer_ViewWindow::drawRect() myRect = aRect; } -//**************************************************************** +//****************************************************************/ void OCCViewer_ViewWindow::createActions() { if (!myActionsMap.isEmpty()) return; diff --git a/src/OCCViewer/resources/OCCViewer_msg_en.po b/src/OCCViewer/resources/OCCViewer_msg_en.po index 29d9ebfad..c13b221b6 100755 --- a/src/OCCViewer/resources/OCCViewer_msg_en.po +++ b/src/OCCViewer/resources/OCCViewer_msg_en.po @@ -134,8 +134,14 @@ msgstr "Restore View" msgid "DSC_PRESETS_VIEW" msgstr "Selection of the memorized state of the active view" -msgid "MNU_DUMP_VIEW" -msgstr "Dump" +msgid "OCCViewer_Viewer::MEN_DUMP_VIEW" +msgstr "Dump view..." + +msgid "OCCViewer_Viewer::MEN_SHOW_TOOLBAR" +msgstr "Show toolbar" + +msgid "OCCViewer_Viewer::MEN_CHANGE_BACKGROUD" +msgstr "Change background..." msgid "OCC_IMAGE_FILES" msgstr "Images Files (*.bmp *.png *.jpg *.jpeg)" @@ -157,4 +163,3 @@ msgstr "Error" msgid "BUT_OK" msgstr "Ok" - diff --git a/src/SVTK/SVTK_ViewModel.cxx b/src/SVTK/SVTK_ViewModel.cxx index 04087ab3b..a9faa92cf 100644 --- a/src/SVTK/SVTK_ViewModel.cxx +++ b/src/SVTK/SVTK_ViewModel.cxx @@ -89,26 +89,20 @@ SVTK_Viewer } //========================================================== -void -SVTK_Viewer -::contextMenuPopup(QPopupMenu* thePopup) +void SVTK_Viewer::contextMenuPopup( QPopupMenu* thePopup ) { - if (thePopup->count() > 0) thePopup->insertSeparator(); - thePopup->insertItem("Change background...", this, SLOT(onChangeBgColor())); - if(SUIT_ViewWindow* aViewWindow = myViewManager->getActiveView()){ - if(SVTK_ViewWindow* aView = dynamic_cast(aViewWindow)){ - if(!aView->getToolBar()->isVisible()){ - thePopup->insertSeparator(); - thePopup->insertItem("Show toolbar", this, SLOT(onShowToolbar())); - } - } - } + thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) ); + thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) ); + + thePopup->insertSeparator(); + + SVTK_ViewWindow* aView = (SVTK_ViewWindow*)(myViewManager->getActiveView()); + if ( aView && !aView->getToolBar()->isVisible() ) + thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) ); } //========================================================== -void -SVTK_Viewer -::onMousePress(SUIT_ViewWindow* vw, QMouseEvent* event) +void SVTK_Viewer::onMousePress(SUIT_ViewWindow* vw, QMouseEvent* event) { if(SVTK_ViewWindow* aVW = dynamic_cast(vw)){ if(SVTK_RenderWindowInteractor* aRWI = aVW->getRWInteractor()){ @@ -183,10 +177,15 @@ SVTK_Viewer //!! To be done for view windows } +void SVTK_Viewer::onDumpView() +{ + SVTK_ViewWindow* aView = (SVTK_ViewWindow*)(myViewManager->getActiveView()); + if ( aView ) + aView->onDumpView(); +} + //========================================================== -void -SVTK_Viewer -::onChangeBgColor() +void SVTK_Viewer::onChangeBgColor() { QPtrVector aViews = myViewManager->getViews(); for(int i = 0, iEnd = aViews.size(); i < iEnd; i++) diff --git a/src/SVTK/SVTK_ViewModel.h b/src/SVTK/SVTK_ViewModel.h index de432ffaa..e780757c5 100644 --- a/src/SVTK/SVTK_ViewModel.h +++ b/src/SVTK/SVTK_ViewModel.h @@ -57,8 +57,9 @@ protected slots: void onMouseMove(SUIT_ViewWindow*, QMouseEvent*); void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*); - void onChangeBgColor(); + void onDumpView(); void onShowToolbar(); + void onChangeBgColor(); private: bool mySelectionEnabled; diff --git a/src/VTKViewer/VTKViewer_ViewModel.cxx b/src/VTKViewer/VTKViewer_ViewModel.cxx index 1d00cb59b..9ff5f3231 100755 --- a/src/VTKViewer/VTKViewer_ViewModel.cxx +++ b/src/VTKViewer/VTKViewer_ViewModel.cxx @@ -47,16 +47,14 @@ void VTKViewer_Viewer::setViewManager(SUIT_ViewManager* theViewManager) //********************************************************************* void VTKViewer_Viewer::contextMenuPopup(QPopupMenu* thePopup) { - if (thePopup->count() > 0) thePopup->insertSeparator(); - thePopup->insertItem("Change background...", this, SLOT(onChangeBgColor())); + thePopup->insertItem( tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) ); + thePopup->insertItem( tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) ); + + thePopup->insertSeparator(); VTKViewer_ViewWindow* aView = (VTKViewer_ViewWindow*)(myViewManager->getActiveView()); - if ( aView ) { - if ( !aView->getToolBar()->isVisible() ) { - thePopup->insertSeparator(); - thePopup->insertItem("Show toolbar", this, SLOT(onShowToolbar())); - } - } + if ( aView && !aView->getToolBar()->isVisible() ) + thePopup->insertItem( tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) ); } //********************************************************************* @@ -131,6 +129,13 @@ void VTKViewer_Viewer::enableMultiselection(bool isEnable) //!! To be done for view windows } +void VTKViewer_Viewer::onDumpView() +{ + VTKViewer_ViewWindow* aView = (VTKViewer_ViewWindow*)(myViewManager->getActiveView()); + if ( aView ) + aView->onDumpView(); +} + //********************************************************************* void VTKViewer_Viewer::onChangeBgColor() { diff --git a/src/VTKViewer/VTKViewer_ViewModel.h b/src/VTKViewer/VTKViewer_ViewModel.h index bfb6e9797..fe54aa291 100755 --- a/src/VTKViewer/VTKViewer_ViewModel.h +++ b/src/VTKViewer/VTKViewer_ViewModel.h @@ -40,8 +40,9 @@ protected slots: void onMouseMove(SUIT_ViewWindow*, QMouseEvent*); void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*); - void onChangeBgColor(); + void onDumpView(); void onShowToolbar(); + void onChangeBgColor(); private: bool mySelectionEnabled; diff --git a/src/VTKViewer/resources/VTKViewer_msg_en.po b/src/VTKViewer/resources/VTKViewer_msg_en.po index e0424be9f..23da3b43b 100755 --- a/src/VTKViewer/resources/VTKViewer_msg_en.po +++ b/src/VTKViewer/resources/VTKViewer_msg_en.po @@ -28,7 +28,7 @@ msgid "" msgstr "" "Project-Id-Version: example-Qt-message-extraction\n" "POT-Creation-Date: 1999-02-23 15:38+0200\n" -"PO-Revision-Date: 1999-02-23 15:38+0200\n" +"PO-Revision-Date: 2005-05-31 13:25+0400\n" "Last-Translator: \n" "Content-Type: text/plain; charset=iso-8859-1\n" @@ -134,3 +134,11 @@ msgstr "Error" msgid "BUT_OK" msgstr "Ok" +msgid "VTKViewer_Viewer::MEN_DUMP_VIEW" +msgstr "Dump view..." + +msgid "VTKViewer_Viewer::MEN_SHOW_TOOLBAR" +msgstr "Show toolbar" + +msgid "VTKViewer_Viewer::MEN_CHANGE_BACKGROUD" +msgstr "Change background..." -- 2.39.2