From: ouv Date: Tue, 11 Oct 2005 14:14:39 +0000 (+0000) Subject: Moved to SVTK X-Git-Tag: BR-D5-38-2003_D2005-12-10~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=93140e8ce33da557b8c83a61c2377faf3ecf81d7;p=modules%2Fvisu.git Moved to SVTK --- diff --git a/src/VISUGUI/VisuGUI_CubeAxesDlg.cxx b/src/VISUGUI/VisuGUI_CubeAxesDlg.cxx deleted file mode 100755 index 97640bd6..00000000 --- a/src/VISUGUI/VisuGUI_CubeAxesDlg.cxx +++ /dev/null @@ -1,594 +0,0 @@ -// VISU VISUGUI : GUI for SMESH component -// -// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : VisuGUI_CubeAxesDlg.cxx -// Author : Sergey LITONIN -// Module : VISU - -#include "VisuGUI_CubeAxesDlg.h" - -#include "VisuGUI.h" -#include "VisuGUI_Tools.h" -#include "VisuGUI_FontWg.h" - -#include "SVTK_ViewWindow.h" -#include "SVTK_CubeAxesActor2D.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -/*! - * Class : AxisWg - * Description : Tab of dialog - */ - -//======================================================================= -// name : VisuGUI_AxisWg::AxisWg -// Purpose : Constructor -//======================================================================= -VisuGUI_AxisWg::VisuGUI_AxisWg (QWidget* theParent) -: QFrame(theParent) -{ - QValueList< QLabel* > aLabels; - - // "Name" grp - - myNameGrp = new QGroupBox(3, Qt::Vertical, tr("AXIS_NAME"), this); - myIsNameVisible = new QCheckBox(tr("IS_VISIBLE"), myNameGrp); - - QHBox* aHBox = new QHBox(myNameGrp); - aHBox->setSpacing(5); - QLabel* aLabel = new QLabel(tr("NAME"), aHBox); - myAxisName = new QLineEdit(aHBox); - aLabels.append(aLabel); - - aHBox = new QHBox(myNameGrp); - aHBox->setSpacing(5); - aLabel = new QLabel(tr("FONT"), aHBox); - myNameFont = new VisuGUI_FontWg(aHBox); - aLabels.append(aLabel); - - - // "Labels" grp - - myLabelsGrp = new QGroupBox(4, Qt::Vertical, tr("LABELS"), this); - myIsLabelsVisible = new QCheckBox(tr("IS_VISIBLE"), myLabelsGrp); - - aHBox = new QHBox(myLabelsGrp); - aHBox->setSpacing(5); - aLabel = new QLabel(tr("NUMBER"), aHBox); - myLabelNumber = new QLineEdit(aHBox); - myLabelNumber->setValidator(new QIntValidator(0, 25, this)); - myLabelNumber->installEventFilter(this); - aLabels.append(aLabel); - - aHBox = new QHBox(myLabelsGrp); - aHBox->setSpacing(5); - aLabel = new QLabel(tr("OFFSET"), aHBox); - myLabelOffset = new QLineEdit(aHBox); - aLabels.append(aLabel); - - aHBox = new QHBox(myLabelsGrp); - aHBox->setSpacing(5); - aLabel = new QLabel(tr("FONT"), aHBox); - myLabelsFont = new VisuGUI_FontWg(aHBox); - aLabels.append(aLabel); - - // "Tick marks" grp - - myTicksGrp = new QGroupBox(2, Qt::Vertical, tr("TICK_MARKS"), this); - myIsTicksVisible = new QCheckBox(tr("IS_VISIBLE"), myTicksGrp); - - aHBox = new QHBox(myTicksGrp); - aHBox->setSpacing(5); - aLabel = new QLabel(tr("LENGTH"), aHBox); - myTickLength = new QLineEdit(aHBox); - aLabels.append(aLabel); - - // Layout - - QVBoxLayout* aLay = new QVBoxLayout(this, 0, 5); - aLay->addWidget(myNameGrp); - aLay->addWidget(myLabelsGrp); - aLay->addWidget(myTicksGrp); - - // init - myIsNameVisible->setChecked(true); - myIsLabelsVisible->setChecked(true); - myIsTicksVisible->setChecked(true); - updateControlState(); - - // Adjust label widths - QValueList< QLabel* >::iterator anIter; - int aMaxWidth = 0; - for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++) - aMaxWidth = QMAX(aMaxWidth, (*anIter)->sizeHint().width()); - for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++) - (*anIter)->setFixedWidth(aMaxWidth); - - // connect signals and slots - connect(myIsNameVisible, SIGNAL(stateChanged(int)), SLOT(onNameChecked())); - connect(myIsLabelsVisible, SIGNAL(stateChanged(int)), SLOT(onLabelsChecked())); - connect(myIsTicksVisible, SIGNAL(stateChanged(int)), SLOT(onTicksChecked())); -} - -VisuGUI_AxisWg::~VisuGUI_AxisWg() -{ -} - -void VisuGUI_AxisWg::updateControlState() -{ - onNameChecked(); - onLabelsChecked(); - onTicksChecked(); -} - -bool VisuGUI_AxisWg::eventFilter(QObject* o, QEvent* e) -{ - if (e->type() == QEvent::FocusOut) { - bool isOK = false; - int k = myLabelNumber->text().toInt(&isOK); - if (isOK && k > 25) myLabelNumber->setText("25"); - } - return false; -} - -//======================================================================= -// name : VisuGUI_AxisWg::onNameChecked -// Purpose : -//======================================================================= -void VisuGUI_AxisWg::setEnabled(QGroupBox* theGrp, const bool theState) -{ - QObjectList aChildren(*theGrp->children()); - QObject* anObj; - for(anObj = aChildren.first(); anObj !=0; anObj = aChildren.next()) - if (anObj !=0 && anObj->inherits("QHBox")) - ((QHBox*)anObj)->setEnabled(theState); -} - -//======================================================================= -// Labels : VisuGUI_AxisWg::onLabelsChecked -// Purpose : -//======================================================================= -void VisuGUI_AxisWg::onLabelsChecked() -{ - setEnabled(myLabelsGrp, myIsLabelsVisible->isChecked()); -} - -//======================================================================= -// Labels : VisuGUI_AxisWg::onTicksChecked -// Purpose : -//======================================================================= -void VisuGUI_AxisWg::onTicksChecked() -{ - setEnabled(myTicksGrp, myIsTicksVisible->isChecked()); -} - -//======================================================================= -// name : VisuGUI_AxisWg::onNameChecked -// Purpose : -//======================================================================= -void VisuGUI_AxisWg::onNameChecked() -{ - setEnabled(myNameGrp, myIsNameVisible->isChecked()); -} - -//======================================================================= -// name : VisuGUI_AxisWg::UseName -// Purpose : -//======================================================================= -void VisuGUI_AxisWg::UseName(const bool toUse) -{ - myIsNameVisible->setChecked(toUse); -} - -//======================================================================= -// name : VisuGUI_AxisWg::SetName -// Purpose : -//================================================== ===================== -void VisuGUI_AxisWg::SetName(const QString& theName) -{ - myAxisName->setText(theName); -} - -//======================================================================= -// name : VisuGUI_AxisWg::SetNameFont -// Purpose : -//======================================================================= -void VisuGUI_AxisWg::SetNameFont(const QColor& theColor, - const int theFont, - const bool theIsBold, - const bool theIsItalic, - const bool theIsShadow) -{ - myNameFont->SetData(theColor, theFont, theIsBold, theIsItalic, theIsShadow); -} - -//======================================================================= -// name : VisuGUI_AxisWg::SetNameFont -// Purpose : -//======================================================================= -bool VisuGUI_AxisWg::ReadData(vtkAxisActor2D* theActor) -{ - if (theActor == 0) - return false; - - // Name - - bool useName = theActor->GetTitleVisibility(); - QString aTitle(theActor->GetTitle()); - - QColor aTitleColor(255, 255, 255); - int aTitleFontFamily = VTK_ARIAL; - bool isTitleBold = false; - bool isTitleItalic = false; - bool isTitleShadow = false; - - vtkTextProperty* aTitleProp = theActor->GetTitleTextProperty(); - if (aTitleProp !=0) - { - float c[ 3 ]; - aTitleProp->GetColor(c); - aTitleColor.setRgb((int)(c[ 0 ] * 255), (int)(c[ 1 ] * 255), (int)(c[ 2 ] * 255)); - aTitleFontFamily = aTitleProp->GetFontFamily(); - isTitleBold = aTitleProp->GetBold() ? true : false; - isTitleItalic = aTitleProp->GetItalic() ? true : false; - isTitleShadow = aTitleProp->GetShadow() ? true : false; - } - - myIsNameVisible->setChecked(useName); - myAxisName->setText(aTitle); - myNameFont->SetData(aTitleColor, aTitleFontFamily, isTitleBold, isTitleItalic, isTitleShadow); - - // Labels - - bool useLabels = theActor->GetLabelVisibility(); - int nbLabels = theActor->GetNumberOfLabels(); - int anOffset = theActor->GetTickOffset(); - - QColor aLabelsColor(255, 255, 255); - int aLabelsFontFamily = VTK_ARIAL; - bool isLabelsBold = false; - bool isLabelsItalic = false; - bool isLabelsShadow = false; - - vtkTextProperty* aLabelsProp = theActor->GetLabelTextProperty(); - if (aLabelsProp !=0) - { - float c[ 3 ]; - aLabelsProp->GetColor(c); - aLabelsColor.setRgb((int)(c[ 0 ] * 255), (int)(c[ 1 ] * 255), (int)(c[ 2 ] * 255)); - aLabelsFontFamily = aLabelsProp->GetFontFamily(); - isLabelsBold = aLabelsProp->GetBold() ? true : false; - isLabelsItalic = aLabelsProp->GetItalic() ? true : false; - isLabelsShadow = aLabelsProp->GetShadow() ? true : false; - } - - myIsLabelsVisible->setChecked(useLabels); - myLabelNumber->setText(QString("%1").arg(nbLabels)); - myLabelOffset->setText(QString("%1").arg(anOffset)); - myLabelsFont->SetData(aLabelsColor, aLabelsFontFamily, isLabelsBold, isLabelsItalic, isLabelsShadow); - - // Tick marks - bool useTickMarks = theActor->GetTickVisibility(); - int aTickLength = theActor->GetTickLength(); - - myIsTicksVisible->setChecked(useTickMarks); - myTickLength->setText(QString("%1").arg(aTickLength)); - - return true; -} - -//======================================================================= -// name : VisuGUI_CubeAxesDlg::Apply -// Purpose : -//======================================================================= -bool VisuGUI_AxisWg::Apply(vtkAxisActor2D* theActor) -{ - if (theActor == 0) - return false; - - // Name - - theActor->SetTitleVisibility(myIsNameVisible->isChecked() ? 1 : 0); - theActor->SetTitle(myAxisName->text().latin1()); - - QColor aTitleColor(255, 255, 255); - int aTitleFontFamily = VTK_ARIAL; - bool isTitleBold = false; - bool isTitleItalic = false; - bool isTitleShadow = false; - - myNameFont->GetData(aTitleColor, aTitleFontFamily, isTitleBold, isTitleItalic, isTitleShadow); - vtkTextProperty* aTitleProp = theActor->GetTitleTextProperty(); - if (aTitleProp) - { - aTitleProp->SetColor(aTitleColor.red() / 255., - aTitleColor.green() / 255., - aTitleColor.blue() / 255.); - aTitleProp->SetFontFamily(aTitleFontFamily); - - aTitleProp->SetBold(isTitleBold ? 1 : 0); - aTitleProp->SetItalic(isTitleItalic ? 1 : 0); - aTitleProp->SetShadow(isTitleShadow ? 1 : 0); - - theActor->SetTitleTextProperty(aTitleProp); - } - - // Labels - - theActor->SetLabelVisibility(myIsLabelsVisible->isChecked() ? 1 : 0); - - bool isOk = false; - int nbLabels = myLabelNumber->text().toInt(&isOk); - if (isOk) - theActor->SetNumberOfLabels(nbLabels); - - int anOffset = myLabelOffset->text().toInt(&isOk); - if (isOk) - theActor->SetTickOffset(anOffset); - - QColor aLabelsColor(255, 255, 255); - int aLabelsFontFamily = VTK_ARIAL; - bool isLabelsBold = false; - bool isLabelsItalic = false; - bool isLabelsShadow = false; - - myLabelsFont->GetData(aLabelsColor, aLabelsFontFamily, isLabelsBold, isLabelsItalic, isLabelsShadow); - vtkTextProperty* aLabelsProp = theActor->GetLabelTextProperty(); - if (aLabelsProp) - { - aLabelsProp->SetColor(aLabelsColor.red() / 255., - aLabelsColor.green() / 255., - aLabelsColor.blue() / 255.); - aLabelsProp->SetFontFamily(aLabelsFontFamily); - - aLabelsProp->SetBold(isLabelsBold ? 1 : 0); - aLabelsProp->SetItalic(isLabelsItalic ? 1 : 0); - aLabelsProp->SetShadow(isLabelsShadow ? 1 : 0); - - aLabelsProp->Modified(); - theActor->SetLabelTextProperty(aLabelsProp); - } - - - // Tick marks - theActor->SetTickVisibility(myIsTicksVisible->isChecked()); - int aTickLength = myTickLength->text().toInt(&isOk); - if (isOk) - theActor->SetTickLength(aTickLength); - - return true; -} - -/* - Class : VisuGUI_CubeAxesDlg - Description : Dialog for specifynig cube axes properties -*/ - -//======================================================================= -// name : VisuGUI_CubeAxesDlg::VisuGUI_CubeAxesDlg -// Purpose : Constructor -//======================================================================= -VisuGUI_CubeAxesDlg::VisuGUI_CubeAxesDlg(QWidget* theParent) -: QDialog(theParent, "VisuGUI_CubeAxesDlg", false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose) -{ - setCaption(tr("CAPTION")); - - QVBoxLayout* aLay = new QVBoxLayout(this, 5, 5); - aLay->addWidget(createMainFrame(this)); - aLay->addWidget(createButtonFrame(this)); - - Init(); - -//if (VISU::GetDesktop()->getMainFrame()) -// connect(VISU::GetDesktop()->getMainFrame(), SIGNAL(windowActivated(QWidget*)), -// SLOT(onWindowActivated(QWidget*))); -} - -//======================================================================= -// name : VisuGUI_CubeAxesDlg::createMainFrame -// Purpose : Create frame containing dialog's input fields -//======================================================================= -QWidget* VisuGUI_CubeAxesDlg::createMainFrame(QWidget* theParent) -{ - QFrame* aFrame = new QFrame(theParent); - - myTabWg = new QTabWidget(aFrame); - - myAxes[ 0 ] = new VisuGUI_AxisWg(myTabWg); - myAxes[ 1 ] = new VisuGUI_AxisWg(myTabWg); - myAxes[ 2 ] = new VisuGUI_AxisWg(myTabWg); - - myTabWg->addTab(myAxes[ 0 ], tr("X_AXIS")); - myTabWg->addTab(myAxes[ 1 ], tr("Y_AXIS")); - myTabWg->addTab(myAxes[ 2 ], tr("Z_AXIS")); - - myTabWg->setMargin(5); - - myIsVisible = new QCheckBox(tr("IS_VISIBLE"), aFrame); - - QVBoxLayout* aLay = new QVBoxLayout(aFrame, 0, 5); - aLay->addWidget(myTabWg); - aLay->addWidget(myIsVisible); - - return aFrame; -} - -//======================================================================= -// name : VisuGUI_CubeAxesDlg::createButtonFrame -// Purpose : Create frame containing buttons -//======================================================================= -QWidget* VisuGUI_CubeAxesDlg::createButtonFrame(QWidget* theParent) -{ - QFrame* aFrame = new QFrame(theParent); - aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken); - - myOkBtn = new QPushButton(tr("BUT_OK"), aFrame); - myApplyBtn = new QPushButton(tr("BUT_APPLY"), aFrame); - myCloseBtn = new QPushButton(tr("BUT_CLOSE"), aFrame); - - QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); - - QHBoxLayout* aLay = new QHBoxLayout(aFrame, 5, 5); - - aLay->addWidget(myOkBtn); - aLay->addWidget(myApplyBtn); - aLay->addItem(aSpacer); - aLay->addWidget(myCloseBtn); - - connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk())); - connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply())); - connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose())); - - return aFrame; -} - -//======================================================================= -// name : VisuGUI_CubeAxesDlg::~VisuGUI_CubeAxesDlg -// Purpose : Destructor -//======================================================================= -VisuGUI_CubeAxesDlg::~VisuGUI_CubeAxesDlg() -{ -} - -//======================================================================= -// name : VisuGUI_CubeAxesDlg::Init -// Purpose : Init dialog fields, connect signals and slots, show dialog -//======================================================================= -bool VisuGUI_CubeAxesDlg::Init() -{ - SVTK_ViewWindow* aFrame = VISU::GetViewWindow(); - if (aFrame == 0) - return false; - - SVTK_CubeAxesActor2D* anActor = aFrame->GetCubeAxes(); - if (anActor == 0) - return false; - - myAxes[ 0 ]->ReadData(anActor->GetXAxisActor2D()); - myAxes[ 1 ]->ReadData(anActor->GetYAxisActor2D()); - myAxes[ 2 ]->ReadData(anActor->GetZAxisActor2D()); - - myIsVisible->setChecked(anActor->GetVisibility() ? true : false); - - return true; - -} - -//======================================================================= -// name : VisuGUI_CubeAxesDlg::isValid -// Purpose : Verify validity of entry data -//======================================================================= -bool VisuGUI_CubeAxesDlg::isValid() const -{ - return true; -} - -//======================================================================= -// name : VisuGUI_CubeAxesDlg::onApply -// Purpose : Verify validity of entry data -//======================================================================= -bool VisuGUI_CubeAxesDlg::onApply() -{ - bool isOk = true; - - try - { - SVTK_ViewWindow* aFrame = VISU::GetViewWindow(); - if (aFrame == 0) - return false; - - SVTK_CubeAxesActor2D* anActor = aFrame->GetCubeAxes(); - if (anActor == 0) - return false; - - isOk = isOk && myAxes[ 0 ]->Apply(anActor->GetXAxisActor2D()); - isOk = isOk && myAxes[ 1 ]->Apply(anActor->GetYAxisActor2D()); - isOk = isOk && myAxes[ 2 ]->Apply(anActor->GetZAxisActor2D()); - - - //anActor->SetXLabel(myAxes[ 0 ]->myAxisName->text()); - //anActor->SetYLabel(myAxes[ 1 ]->myAxisName->text()); - //anActor->SetZLabel(myAxes[ 2 ]->myAxisName->text()); - - //anActor->SetNumberOfLabels(anActor->GetXAxisActor2D()->GetNumberOfLabels()); - if (myIsVisible->isChecked()) - anActor->VisibilityOn(); - else - anActor->VisibilityOff(); - - if (isOk) - aFrame->Repaint(); - } - catch(...) - { - isOk = false; - } - - return isOk; -} - -//======================================================================= -// name : VisuGUI_CubeAxesDlg::onOk -// Purpose : SLOT called when "Ok" button pressed. -//======================================================================= -void VisuGUI_CubeAxesDlg::onOk() -{ - if (onApply()) - onClose(); -} - -//======================================================================= -// name : VisuGUI_CubeAxesDlg::onClose -// Purpose : SLOT called when "Close" button pressed. Close dialog -//======================================================================= -void VisuGUI_CubeAxesDlg::onClose() -{ - reject(); -} - -//======================================================================= -// name : VisuGUI_CubeAxesDlg::onClose -// Purpose : SLOT called when "Close" button pressed. Close dialog -//======================================================================= -void VisuGUI_CubeAxesDlg::onWindowActivated (QWidget*) -{ - SVTK_ViewWindow* aFrame = VISU::GetViewWindow(); - if (aFrame) - Init(); - else - onClose(); -} diff --git a/src/VISUGUI/VisuGUI_CubeAxesDlg.h b/src/VISUGUI/VisuGUI_CubeAxesDlg.h deleted file mode 100755 index 59bcbb0c..00000000 --- a/src/VISUGUI/VisuGUI_CubeAxesDlg.h +++ /dev/null @@ -1,132 +0,0 @@ -// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : VisuGUI_CubeAxesDlg.h -// Author : Sergey LITONIN -// Module : VISU - - -#ifndef VisuGUI_CubeAxesDlg_H -#define VisuGUI_CubeAxesDlg_H - -#include -#include - -class QWidget; -class QFrame; -class QPushButton; -class QTabWidget; -class QCheckBox; -class QLineEdit; -class VisuGUI_FontWg; -class QGroupBox; -class VisuGUI_AxisWg; -class vtkAxisActor2D; - -/*! - * Class : VisuGUI_CubeAxesDlg - * Description : Dialog for specifynig cube axes properties - */ -class VisuGUI_CubeAxesDlg : public QDialog -{ - Q_OBJECT - -public: - VisuGUI_CubeAxesDlg( QWidget* ); - virtual ~VisuGUI_CubeAxesDlg(); - - bool Init(); - -private slots: - void onOk(); - bool onApply(); - void onClose(); - - void onWindowActivated( QWidget* ); - -private: - QWidget* createButtonFrame( QWidget* ); - QWidget* createMainFrame ( QWidget* ); - bool isValid() const; - -private: - QTabWidget* myTabWg; - QCheckBox* myIsVisible; - - QPushButton* myOkBtn; - QPushButton* myApplyBtn; - QPushButton* myCloseBtn; - VisuGUI_AxisWg* myAxes[ 3 ]; -}; - -/*! - * Class : VisuGUI_AxisWg - * Description : Tab of dialog - */ -class VisuGUI_AxisWg : public QFrame -{ - Q_OBJECT - -public: - VisuGUI_AxisWg( QWidget* ); - ~VisuGUI_AxisWg(); - - void UseName( const bool ); - void SetName( const QString& ); - void SetNameFont( const QColor&, const int, const bool, const bool, const bool ); - bool ReadData( vtkAxisActor2D* ); - bool Apply( vtkAxisActor2D* ); - -protected: - bool eventFilter(QObject*, QEvent*); - -private slots: - void onNameChecked(); - void onLabelsChecked(); - void onTicksChecked(); - -private: - void updateControlState(); - void setEnabled( QGroupBox*, const bool ); - -private: - // name - QGroupBox* myNameGrp; - QCheckBox* myIsNameVisible; - QLineEdit* myAxisName; - VisuGUI_FontWg* myNameFont; - - // labels - QGroupBox* myLabelsGrp; - QCheckBox* myIsLabelsVisible; - QLineEdit* myLabelNumber; - QLineEdit* myLabelOffset; - VisuGUI_FontWg* myLabelsFont; - - // tick marks - QGroupBox* myTicksGrp; - QCheckBox* myIsTicksVisible; - QLineEdit* myTickLength; - - friend class VisuGUI_CubeAxesDlg; -}; - -#endif diff --git a/src/VISUGUI/VisuGUI_FontWg.cxx b/src/VISUGUI/VisuGUI_FontWg.cxx deleted file mode 100755 index 78d62a1c..00000000 --- a/src/VISUGUI/VisuGUI_FontWg.cxx +++ /dev/null @@ -1,149 +0,0 @@ -// VISU VISUGUI : GUI for SMESH component -// -// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : VisuGUI_CubeAxesDlg.cxx -// Author : Sergey LITONIN -// Module : VISU - -#include "VisuGUI_FontWg.h" - -#include -#include -#include -#include - -#include - -/*! - * Class : VisuGUI_FontWg - * Description : Dialog for specifynig font - */ - -//======================================================================= -// name : VisuGUI_FontWg -// Purpose : Constructor -//======================================================================= -VisuGUI_FontWg::VisuGUI_FontWg( QWidget* theParent ) -: QHBox( theParent ) -{ - setSpacing( 5 ); - myColorBtn = new QToolButton( this ); - myColorBtn->setMinimumWidth( 20 ); - - myFamily = new QComboBox( this ); - myFamily->insertItem( tr( "ARIAL" ) ); - myFamily->insertItem( tr( "COURIER" ) ); - myFamily->insertItem( tr( "TIMES" ) ); - - myBold = new QCheckBox( tr( "BOLD" ), this ); - myItalic = new QCheckBox( tr( "ITALIC" ), this ); - myShadow = new QCheckBox( tr( "SHADOW" ), this ); - - connect( myColorBtn, SIGNAL( clicked() ), SLOT( onColor() ) ); -} - -//======================================================================= -// name : ~VisuGUI_FontWg -// Purpose : Destructor -//======================================================================= -VisuGUI_FontWg::~VisuGUI_FontWg() -{ -} - -//======================================================================= -// name : SetColor -// Purpose : -//======================================================================= -void VisuGUI_FontWg::SetColor( const QColor& theColor ) -{ - myColorBtn->setPaletteBackgroundColor( theColor ); -} - -//======================================================================= -// name : GetColor -// Purpose : -//======================================================================= -QColor VisuGUI_FontWg::GetColor() const -{ - return myColorBtn->paletteBackgroundColor(); -} - -//======================================================================= -// name : onColor -// Purpose : -//======================================================================= -void VisuGUI_FontWg::onColor() -{ - QColor aColor = QColorDialog::getColor( GetColor(), this ); - if ( aColor.isValid() ) - SetColor( aColor ); -} - -//======================================================================= -// name : SetData -// Purpose : -//======================================================================= -void VisuGUI_FontWg::SetData( const QColor& theColor, - const int theFamily, - const bool theBold, - const bool theItalic, - const bool theShadow ) -{ - SetColor( theColor ); - - if ( theFamily == VTK_ARIAL ) - myFamily->setCurrentItem( 0 ); - else if ( theFamily == VTK_COURIER ) - myFamily->setCurrentItem( 1 ); - else - myFamily->setCurrentItem( 2 ); - - myBold->setChecked( theBold ); - myItalic->setChecked( theItalic ); - myShadow->setChecked( theShadow ); -} - -//======================================================================= -// name : GetData -// Purpose : -//======================================================================= -void VisuGUI_FontWg::GetData( QColor& theColor, - int& theFamily, - bool& theBold, - bool& theItalic, - bool& theShadow ) const -{ - theColor = GetColor(); - - int anItem =myFamily->currentItem(); - if ( anItem == 0 ) - theFamily = VTK_ARIAL; - else if ( anItem == 1 ) - theFamily = VTK_COURIER; - else - theFamily = VTK_TIMES; - - theBold = myBold->isChecked(); - theItalic = myItalic->isChecked(); - theShadow = myShadow->isChecked(); -} diff --git a/src/VISUGUI/VisuGUI_FontWg.h b/src/VISUGUI/VisuGUI_FontWg.h deleted file mode 100755 index e3a45ee4..00000000 --- a/src/VISUGUI/VisuGUI_FontWg.h +++ /dev/null @@ -1,68 +0,0 @@ -// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : VisuGUI_FontWg.h -// Author : Sergey LITONIN -// Module : VISU - - -#ifndef VisuGUI_FontWg_H -#define VisuGUI_FontWg_H - -#include - -class QToolButton; -class QComboBox; -class QCheckBox; -class QColor; - - -/*! - * Class : VisuGUI_FontWg - * Description : Dialog for specifynig font - */ -class VisuGUI_FontWg : public QHBox -{ - Q_OBJECT - -public: - VisuGUI_FontWg( QWidget* ); - virtual ~VisuGUI_FontWg(); - - void SetColor( const QColor& ); - QColor GetColor() const; - - void SetData( const QColor&, const int, const bool, const bool, const bool ); - - void GetData( QColor&, int&, bool&, bool&, bool& ) const; - -private slots: - void onColor(); - -private: - QToolButton* myColorBtn; - QComboBox* myFamily; - QCheckBox* myBold; - QCheckBox* myItalic; - QCheckBox* myShadow; -}; - -#endif diff --git a/src/VISUGUI/VisuGUI_NonIsometricDlg.cxx b/src/VISUGUI/VisuGUI_NonIsometricDlg.cxx deleted file mode 100644 index beca47aa..00000000 --- a/src/VISUGUI/VisuGUI_NonIsometricDlg.cxx +++ /dev/null @@ -1,186 +0,0 @@ -// VISU VISUGUI : GUI of VISU component -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : SALOMEGUI_NonIsometricDlg.cxx -// Author : Vasily Rusyaev -// Module : VISU -// $Header$ - -#include "VisuGUI_NonIsometricDlg.h" - -#include "VisuGUI_Tools.h" - -#include "VISU_Actor.h" -#include "VISU_PipeLine.hxx" - -#include "SalomeApp_Application.h" -#include "SalomeApp_SelectionMgr.h" - -#include "SVTK_ViewWindow.h" -#include "SVTK_RenderWindowInteractor.h" - -#include "SUIT_Desktop.h" -#include "SUIT_Session.h" -#include "SUIT_ViewWindow.h" - -#include "SALOME_ListIteratorOfListIO.hxx" -#include "SALOME_ListIO.hxx" - -#include "QtxDblSpinBox.h" - -#include "utilities.h" - -#include -#include -#include -#include - -using namespace std; - -/*! - Constructor -*/ -VisuGUI_NonIsometricDlg::VisuGUI_NonIsometricDlg (QWidget* parent, const char* name, bool modal, WFlags fl) - : QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) -{ - if (!name) - setName("NonIsometricDlg"); - setCaption(tr("DLG_TITLE")); - setSizeGripEnabled(TRUE); - - SVTK_ViewWindow* aViewWnd = VISU::GetViewWindow(); - - // Create layout for this dialog - QGridLayout* layoutDlg = new QGridLayout (this); - layoutDlg->setSpacing(6); - layoutDlg->setMargin(11); - - // Create croup box with grid layout - QGroupBox* GroupBox = new QGroupBox(this, "GroupBox"); - QGridLayout* glGroupBox = new QGridLayout(GroupBox); - glGroupBox->setMargin(11); - glGroupBox->setSpacing(6); - - // "X" scaling - QLabel* TextLabelX = new QLabel (tr("LBL_X"), GroupBox, "TextLabelX"); - m_sbXcoeff = new QtxDblSpinBox(-DBL_MAX, DBL_MAX, 0.1, GroupBox); - m_sbXcoeff->setMinimumWidth(80); - m_sbXcoeff->setValue(1.0); - - // "Y" scaling - QLabel* TextLabelY = new QLabel (tr("LBL_Y"), GroupBox, "TextLabelY"); - m_sbYcoeff = new QtxDblSpinBox(-DBL_MAX, DBL_MAX, 0.1, GroupBox); - m_sbYcoeff->setMinimumWidth(80); - m_sbYcoeff->setValue(1.0); - - // "Z" scaling - QLabel* TextLabelZ = new QLabel (tr("LBL_Z"), GroupBox, "TextLabelZ"); - m_sbZcoeff = new QtxDblSpinBox(-DBL_MAX, DBL_MAX, 0.1, GroupBox); - m_sbZcoeff->setMinimumWidth(80); - m_sbZcoeff->setValue(1.0); - - // Get initial values from the current VTK viewer - if (aViewWnd) { - double aScaleFactor[3]; - aViewWnd->GetScale(aScaleFactor); - m_sbXcoeff -> setValue(aScaleFactor[0]); - m_sbYcoeff -> setValue(aScaleFactor[1]); - m_sbZcoeff -> setValue(aScaleFactor[2]); - } - - // Create button - m_bReset = new QPushButton(tr("&Reset"), GroupBox, "m_bReset"); - - // Layout widgets in the group box - glGroupBox->addWidget(TextLabelX, 0, 0); - glGroupBox->addWidget(m_sbXcoeff, 0, 1); - glGroupBox->addWidget(TextLabelY, 0, 2); - glGroupBox->addWidget(m_sbYcoeff, 0, 3); - glGroupBox->addWidget(TextLabelZ, 0, 4); - glGroupBox->addWidget(m_sbZcoeff, 0, 5); - glGroupBox->addWidget(m_bReset, 0, 6); - - // OK, CANCEL, Apply button - QGroupBox* aWgt = new QGroupBox(this); - QHBoxLayout* aHBoxLayout = new QHBoxLayout(aWgt); - aHBoxLayout->setMargin(11); - aHBoxLayout->setSpacing(6); - // Create button - QPushButton* m_bOk = new QPushButton(tr("O&K"), aWgt, "m_bOk"); - m_bOk->setDefault(TRUE); - m_bOk->setAutoDefault(TRUE); - // Create button - QPushButton* m_bApply = new QPushButton(tr("&Apply"), aWgt, "m_bApply"); - m_bApply->setAutoDefault(TRUE); - // Create button - QPushButton* m_bCancel = new QPushButton(tr("&Cancel"), aWgt, "m_bCancel"); - m_bCancel->setAutoDefault(TRUE); - - // Layout buttons - aHBoxLayout->addWidget(m_bOk); - aHBoxLayout->addWidget(m_bApply); - aHBoxLayout->addStretch(); - aHBoxLayout->addWidget(m_bCancel); - - // Layout top level widgets - layoutDlg->addWidget(GroupBox,0,0); - layoutDlg->addWidget(aWgt,1,0); - - // signals and slots connections - connect(m_bCancel, SIGNAL(clicked()), this, SLOT(reject())); - connect(m_bOk, SIGNAL(clicked()), this, SLOT(onClickOk())); - connect(m_bApply, SIGNAL(clicked()), this, SLOT(onClickApply())); - connect(m_bReset, SIGNAL(clicked()), this, SLOT(onClickReset())); - - this->resize(100, this->sizeHint().height()); -} - -/* - * Destroys the object and frees any allocated resources - */ -VisuGUI_NonIsometricDlg::~VisuGUI_NonIsometricDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - -void VisuGUI_NonIsometricDlg::onClickOk() -{ - //apply changes - onClickApply(); - //Close dialog - accept(); -} - -void VisuGUI_NonIsometricDlg::onClickApply() -{ - SalomeApp_Application* anApp = dynamic_cast - (SUIT_Session::session()->activeApplication()); - SalomeApp_SelectionMgr* mgr = anApp->selectionMgr(); - - SVTK_ViewWindow* vf = VISU::GetViewWindow(); - if (!vf) - return; - - double aScale[3] = {m_sbXcoeff->value(), m_sbYcoeff->value(), m_sbZcoeff->value()}; - vf->SetScale(aScale); - - SALOME_ListIO selected; - mgr->selectedObjects(selected); - SALOME_ListIteratorOfListIO Itinit(selected); - - if (vf) - for (; Itinit.More(); Itinit.Next()) { - vf->highlight(Itinit.Value(), true); - } -} - -void VisuGUI_NonIsometricDlg::onClickReset() -{ - m_bReset->setFocus(); - m_sbXcoeff->setValue(1.0); - m_sbYcoeff->setValue(1.0); - m_sbZcoeff->setValue(1.0); -} diff --git a/src/VISUGUI/VisuGUI_NonIsometricDlg.h b/src/VISUGUI/VisuGUI_NonIsometricDlg.h deleted file mode 100644 index 739f87ec..00000000 --- a/src/VISUGUI/VisuGUI_NonIsometricDlg.h +++ /dev/null @@ -1,40 +0,0 @@ -// VISU VISUGUI : GUI of VISU component -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// -// -// File : VisuGUI_NonIsometricDlg.h -// Author : Vasily Rusyaev -// Module : VISU -// $Header$ - -#ifndef VisuGUI_NONISOMETRICDLG_H -#define VisuGUI_NONISOMETRICDLG_H - -#include -class QtxDblSpinBox; -class QPushButton; - -class VisuGUI_NonIsometricDlg : public QDialog -{ - Q_OBJECT - -public: - VisuGUI_NonIsometricDlg (QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); - ~VisuGUI_NonIsometricDlg(); - -private: - QtxDblSpinBox* m_sbXcoeff; - QtxDblSpinBox* m_sbYcoeff; - QtxDblSpinBox* m_sbZcoeff; - QPushButton* m_bReset ; - -private slots: - void onClickApply(); - void onClickReset(); - void onClickOk(); - void onFunctionChanged(); -}; - -#endif // VisuGUI_NONISOMETRICDLG_H