From c5378a84b861f873cf14a1a4f21c729fbca300e4 Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 6 Oct 2008 09:05:33 +0000 Subject: [PATCH] Merging from the BR_VP5_DEV branch. --- src/Plot2d/Plot2d_SetupViewDlg.cxx | 16 +++++++++++++++ src/Plot2d/Plot2d_SetupViewDlg.h | 2 ++ src/Plot2d/Plot2d_ViewManager.cxx | 25 +++++++++++++++++++----- src/Plot2d/Plot2d_ViewManager.h | 2 ++ src/Plot2d/Plot2d_ViewModel.cxx | 31 +++++++++++++++++++++++++++++- src/Plot2d/Plot2d_ViewModel.h | 9 ++++++--- 6 files changed, 76 insertions(+), 9 deletions(-) diff --git a/src/Plot2d/Plot2d_SetupViewDlg.cxx b/src/Plot2d/Plot2d_SetupViewDlg.cxx index add4a56d0..8b8c5ae7b 100755 --- a/src/Plot2d/Plot2d_SetupViewDlg.cxx +++ b/src/Plot2d/Plot2d_SetupViewDlg.cxx @@ -22,6 +22,8 @@ #include "Plot2d_SetupViewDlg.h" +#include +#include #include #include @@ -305,10 +307,13 @@ Plot2d_SetupViewDlg::Plot2d_SetupViewDlg( QWidget* parent, myOkBtn->setDefault( TRUE ); myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this ); myCancelBtn->setAutoDefault( TRUE ); + myHelpBtn = new QPushButton( tr( "BUT_HELP" ), this ); + myHelpBtn->setAutoDefault( TRUE ); QHBoxLayout* btnLayout = new QHBoxLayout; btnLayout->addWidget( myOkBtn ); btnLayout->addStretch(); btnLayout->addWidget( myCancelBtn ); + btnLayout->addWidget( myHelpBtn ); // layout widgets topLayout->addWidget( myTitleCheck, 0, 0 ); @@ -344,6 +349,7 @@ Plot2d_SetupViewDlg::Plot2d_SetupViewDlg( QWidget* parent, connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( myHelpBtn, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); if ( mySecondAxisY ) { connect( myTitleY2Check, SIGNAL( clicked() ), this, SLOT( onY2TitleChecked() ) ); @@ -838,3 +844,13 @@ bool Plot2d_SetupViewDlg::isSetAsDefault() { return myDefCheck->isChecked(); } + +/*! + Slot, called when user clicks "Help" button +*/ +void Plot2d_SetupViewDlg::onHelp() +{ + SUIT_Application* app = SUIT_Session::session()->activeApplication(); + if ( app ) + app->onHelpContextModule( "GUI", "plot2d_viewer_page.html", "settings" ); +} diff --git a/src/Plot2d/Plot2d_SetupViewDlg.h b/src/Plot2d/Plot2d_SetupViewDlg.h index dc75f4daa..923dd5f40 100755 --- a/src/Plot2d/Plot2d_SetupViewDlg.h +++ b/src/Plot2d/Plot2d_SetupViewDlg.h @@ -93,6 +93,7 @@ protected slots: void onXGridMinorChecked(); void onYGridMinorChecked(); void onY2GridMinorChecked(); + void onHelp(); private: QCheckBox* myTitleCheck; @@ -126,6 +127,7 @@ private: QCheckBox* myDefCheck; QPushButton* myOkBtn; QPushButton* myCancelBtn; + QPushButton* myHelpBtn; bool mySecondAxisY; }; diff --git a/src/Plot2d/Plot2d_ViewManager.cxx b/src/Plot2d/Plot2d_ViewManager.cxx index cccfe1865..efd1fa6f8 100755 --- a/src/Plot2d/Plot2d_ViewManager.cxx +++ b/src/Plot2d/Plot2d_ViewManager.cxx @@ -74,17 +74,32 @@ void Plot2d_ViewManager::createView() SLOT: called if action "Clone view" is activated, emits signal cloneView() */ void Plot2d_ViewManager::onCloneView() +{ + if( sender() && sender()->inherits( "Plot2d_ViewWindow" ) ) + { + Plot2d_ViewWindow* srcWnd = ( Plot2d_ViewWindow* )sender(); + cloneView( srcWnd ); + } +} + +/*! + \brief Creates clone of source window + \param srcWnd source window + \return Pointer on the new window + \sa onCloneView() +*/ +Plot2d_ViewWindow* Plot2d_ViewManager::cloneView( Plot2d_ViewWindow* srcWnd ) { SUIT_ViewWindow* vw = createViewWindow(); - Plot2d_ViewWindow *newWnd = 0, *clonedWnd = 0; + Plot2d_ViewWindow* newWnd = 0; if( vw && vw->inherits( "Plot2d_ViewWindow" ) ) newWnd = ( Plot2d_ViewWindow* )vw; - if( sender() && sender()->inherits( "Plot2d_ViewWindow" ) ) - clonedWnd = ( Plot2d_ViewWindow* )sender(); - if( newWnd && clonedWnd ) - emit cloneView( clonedWnd->getViewFrame(), newWnd->getViewFrame() ); + if( newWnd && srcWnd ) + emit cloneView( srcWnd->getViewFrame(), newWnd->getViewFrame() ); + + return newWnd; } /*! diff --git a/src/Plot2d/Plot2d_ViewManager.h b/src/Plot2d/Plot2d_ViewManager.h index 42b23a02c..4eeb0ffd8 100755 --- a/src/Plot2d/Plot2d_ViewManager.h +++ b/src/Plot2d/Plot2d_ViewManager.h @@ -24,6 +24,7 @@ class SUIT_Desktop; class SUIT_PreferenceMgr; +class Plot2d_ViewWindow; class Plot2d_Viewer; class Plot2d_ViewFrame; @@ -36,6 +37,7 @@ public: ~Plot2d_ViewManager(); Plot2d_Viewer* getPlot2dModel() const; + Plot2d_ViewWindow* cloneView( Plot2d_ViewWindow* srcWnd ); static int fillPreferences( SUIT_PreferenceMgr*, const int ); diff --git a/src/Plot2d/Plot2d_ViewModel.cxx b/src/Plot2d/Plot2d_ViewModel.cxx index fae67f5cf..19127bc54 100755 --- a/src/Plot2d/Plot2d_ViewModel.cxx +++ b/src/Plot2d/Plot2d_ViewModel.cxx @@ -175,8 +175,37 @@ void Plot2d_Viewer::onDumpView() /*! SLOT: called when action "Clone view" is activated */ -void Plot2d_Viewer::onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* ) +void Plot2d_Viewer::onCloneView( Plot2d_ViewFrame* clonedVF, Plot2d_ViewFrame* newVF ) { + if( !clonedVF || !newVF ) + return; + + // 1) Copy all properties of view + + newVF->copyPreferences( clonedVF ); + + // 2) Display all curves displayed in cloned view + + curveList aCurves; + clonedVF->getCurves( aCurves ); + curveList::const_iterator anIt = aCurves.begin(), aLast = aCurves.end(); + + for( ; anIt!=aLast; anIt++ ) + if( clonedVF->isVisible( *anIt ) ) + newVF->displayCurve( *anIt, false ); + newVF->Repaint(); + + if ( newVF ) + { + // find view window corresponding to the frame + QWidget* p = newVF->parentWidget(); + while( p && !p->inherits( "SUIT_ViewWindow" ) ) + p = p->parentWidget(); + + // emits signal + if ( p && p->inherits( "SUIT_ViewWindow" ) ) + emit viewCloned( (SUIT_ViewWindow*)p ); + } } /*! diff --git a/src/Plot2d/Plot2d_ViewModel.h b/src/Plot2d/Plot2d_ViewModel.h index db0c471d2..b2c0b0416 100755 --- a/src/Plot2d/Plot2d_ViewModel.h +++ b/src/Plot2d/Plot2d_ViewModel.h @@ -48,11 +48,14 @@ public: void update(); void clearPrs(); void setAutoDel(bool theDel); + +signals: + void viewCloned( SUIT_ViewWindow* ); protected slots: - void onChangeBgColor(); - void onDumpView(); - void onShowToolbar(); + void onChangeBgColor(); + void onDumpView(); + void onShowToolbar(); virtual void onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* ); private: -- 2.39.2