From 2a87c2767020e3db2d27bcc52fd001524fc3f17e Mon Sep 17 00:00:00 2001 From: san Date: Mon, 5 Dec 2011 15:11:04 +0000 Subject: [PATCH] POSEIDONGUI issue #31415: API to hide widgets for title editing, not to confuse the users with the titles that can be edited but are not saved to resource manager. --- src/Plot2d/Plot2d_SetupViewDlg.cxx | 80 ++++++++++++++++++++++++++++++ src/Plot2d/Plot2d_SetupViewDlg.h | 9 ++++ src/Plot2d/Plot2d_ViewFrame.cxx | 14 ++++++ src/Plot2d/Plot2d_ViewFrame.h | 4 ++ 4 files changed, 107 insertions(+) diff --git a/src/Plot2d/Plot2d_SetupViewDlg.cxx b/src/Plot2d/Plot2d_SetupViewDlg.cxx index 8b8c5ae7b..0402410f3 100755 --- a/src/Plot2d/Plot2d_SetupViewDlg.cxx +++ b/src/Plot2d/Plot2d_SetupViewDlg.cxx @@ -516,6 +516,86 @@ QString Plot2d_SetupViewDlg::getY2Title() return myTitleY2Edit->text(); } +/*! + \brief Shows/hides widgets for the main title editing + \sa isTitleEditable() +*/ +void Plot2d_SetupViewDlg::setTitleEditable( bool editable ) +{ + myTitleCheck->setVisible( editable ); + myTitleEdit->setVisible( editable ); +} + +/*! + \brief Get visibility state of the widgets for the main title editing + \return true if the widgets are visible + \sa setTitleEditable() +*/ +bool Plot2d_SetupViewDlg::isTitleEditable() +{ + return myTitleEdit->isVisible(); +} + +/*! + \brief Shows/hides widgets for the X axis title editing + \sa isXTitleEditable() +*/ +void Plot2d_SetupViewDlg::setXTitleEditable( bool editable ) +{ + myTitleXCheck->setVisible( editable ); + myTitleXEdit->setVisible( editable ); +} + +/*! + \brief Get visibility state of the widgets for the X axis title editing + \return true if the widgets are visible + \sa setXTitleEditable() +*/ +bool Plot2d_SetupViewDlg::isXTitleEditable() +{ + return myTitleXEdit->isVisible(); +} + +/*! + \brief Shows/hides widgets for the Y axis title editing + \sa isYTitleEditable() +*/ +void Plot2d_SetupViewDlg::setYTitleEditable( bool editable ) +{ + myTitleYCheck->setVisible( editable ); + myTitleYEdit->setVisible( editable ); +} + +/*! + \brief Get visibility state of the widgets for the Y axis title editing + \return true if the widgets are visible + \sa setYTitleEditable() +*/ +bool Plot2d_SetupViewDlg::isYTitleEditable() +{ + return myTitleYEdit->isVisible(); +} + +/*! + \brief Shows/hides widgets for the second Y axis title editing + \sa isY2TitleEditable() +*/ +void Plot2d_SetupViewDlg::setY2TitleEditable( bool editable ) +{ + myTitleY2Check->setVisible( editable ); + myTitleY2Edit->setVisible( editable ); +} + +/*! + \brief Get visibility state of the widgets for the second Y axis title editing + \return true if the widgets are visible + \sa setY2TitleEditable() +*/ +bool Plot2d_SetupViewDlg::isY2TitleEditable() +{ + return myTitleY2Edit->isVisible(); +} + /*! \brief Set curve type. \param type curve type: 0 (points), 1 (lines) or 2 (splines) diff --git a/src/Plot2d/Plot2d_SetupViewDlg.h b/src/Plot2d/Plot2d_SetupViewDlg.h index 923dd5f40..342a64f04 100755 --- a/src/Plot2d/Plot2d_SetupViewDlg.h +++ b/src/Plot2d/Plot2d_SetupViewDlg.h @@ -57,6 +57,15 @@ public: QString getYTitle(); QString getY2Title(); + void setTitleEditable( bool ); + bool isTitleEditable(); + void setXTitleEditable( bool ); + bool isXTitleEditable(); + void setYTitleEditable( bool ); + bool isYTitleEditable(); + void setY2TitleEditable( bool ); + bool isY2TitleEditable(); + void setCurveType( const int ); int getCurveType(); diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index d8957f229..5039740b6 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -932,6 +932,16 @@ int Plot2d_ViewFrame::testOperation( const QMouseEvent& me ) } } +/*! + Protected virtual method called by onSettings() slot, + can be redefined to customize the dialog box appearance. + \param theDlg a pointer to the 2D plot settings dialog box instance + \sa onSettings() +*/ +void Plot2d_ViewFrame::setupSettingsDlg( Plot2d_SetupViewDlg* /*theDlg*/ ) +{ +} + /*! "Settings" toolbar action slot */ @@ -977,6 +987,10 @@ void Plot2d_ViewFrame::onSettings() #endif Plot2d_SetupViewDlg* dlg = new Plot2d_SetupViewDlg( this, true, mySecondY ); + + // Allow derived classes to customize the dialog box appearance + setupSettingsDlg( dlg ); + dlg->setMainTitle( myTitleEnabled, myTitle ); dlg->setXTitle( myXTitleEnabled, myXTitle ); dlg->setYTitle( myYTitleEnabled, myYTitle ); diff --git a/src/Plot2d/Plot2d_ViewFrame.h b/src/Plot2d/Plot2d_ViewFrame.h index 40335b34a..76291eb42 100755 --- a/src/Plot2d/Plot2d_ViewFrame.h +++ b/src/Plot2d/Plot2d_ViewFrame.h @@ -27,6 +27,7 @@ class Plot2d_Plot2d; class Plot2d_Prs; +class Plot2d_SetupViewDlg; class QCustomEvent; class QwtPlotCurve; class QwtPlotGrid; @@ -169,6 +170,8 @@ protected: void setCurveType( QwtPlotCurve* curve, int curveType ); + virtual void setupSettingsDlg( Plot2d_SetupViewDlg* ); + public slots: void onViewPan(); void onViewZoom(); @@ -191,6 +194,7 @@ protected: void plotMousePressed( const QMouseEvent& ); bool plotMouseMoved( const QMouseEvent& ); void plotMouseReleased( const QMouseEvent& ); + signals: void vpModeHorChanged(); -- 2.39.2