#include "Plot2d_SetupViewDlg.h"
+#include <SUIT_Session.h>
+#include <SUIT_Application.h>
#include <QtxColorButton.h>
#include <QCheckBox>
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 );
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() ) );
{
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" );
+}
void onXGridMinorChecked();
void onYGridMinorChecked();
void onY2GridMinorChecked();
+ void onHelp();
private:
QCheckBox* myTitleCheck;
QCheckBox* myDefCheck;
QPushButton* myOkBtn;
QPushButton* myCancelBtn;
+ QPushButton* myHelpBtn;
bool mySecondAxisY;
};
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;
}
/*!
class SUIT_Desktop;
class SUIT_PreferenceMgr;
+class Plot2d_ViewWindow;
class Plot2d_Viewer;
class Plot2d_ViewFrame;
~Plot2d_ViewManager();
Plot2d_Viewer* getPlot2dModel() const;
+ Plot2d_ViewWindow* cloneView( Plot2d_ViewWindow* srcWnd );
static int fillPreferences( SUIT_PreferenceMgr*, const int );
/*!
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 );
+ }
}
/*!
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: