1 // SALOME VTKViewer : build VTK viewer into Salome desktop
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
29 #include "SVTK_NonIsometricDlg.h"
30 #include "SVTK_MainWindow.h"
31 #include "SVTK_Renderer.h"
33 #include "QtxDblSpinBox.h"
34 #include "QtxAction.h"
36 #include <qgroupbox.h>
38 #include <qpushbutton.h>
47 ::SVTK_NonIsometricDlg(QtxAction* theAction,
48 SVTK_MainWindow* theParent,
50 SVTK_DialogBase(theAction,
53 m_MainWindow(theParent)
55 setCaption(tr("DLG_TITLE"));
56 setSizeGripEnabled(TRUE);
58 // Create layout for this dialog
59 QGridLayout* layoutDlg = new QGridLayout (this);
60 layoutDlg->setSpacing(6);
61 layoutDlg->setMargin(11);
63 // Create croup box with grid layout
64 QGroupBox* aGroupBox = new QGroupBox(this, "GroupBox");
65 QHBoxLayout* aHBoxLayout = new QHBoxLayout(aGroupBox);
66 aHBoxLayout->setMargin(11);
67 aHBoxLayout->setSpacing(6);
70 QLabel* TextLabelX = new QLabel (tr("LBL_X"), aGroupBox, "TextLabelX");
71 TextLabelX->setFixedWidth(15);
72 m_sbXcoeff = new QtxDblSpinBox(-VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, 0.1, aGroupBox);
73 m_sbXcoeff->setMinimumWidth(80);
74 m_sbXcoeff->setValue(1.0);
77 QLabel* TextLabelY = new QLabel (tr("LBL_Y"), aGroupBox, "TextLabelY");
78 TextLabelY->setFixedWidth(15);
79 m_sbYcoeff = new QtxDblSpinBox(-VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, 0.1, aGroupBox);
80 m_sbYcoeff->setMinimumWidth(80);
81 m_sbYcoeff->setValue(1.0);
84 QLabel* TextLabelZ = new QLabel (tr("LBL_Z"), aGroupBox, "TextLabelZ");
85 TextLabelZ->setFixedWidth(15);
86 m_sbZcoeff = new QtxDblSpinBox(-VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, 0.1, aGroupBox);
87 m_sbZcoeff->setMinimumWidth(80);
88 m_sbZcoeff->setValue(1.0);
90 // Create <Reset> button
91 m_bReset = new QPushButton(tr("&Reset"), aGroupBox, "m_bReset");
93 // Layout widgets in the group box
94 aHBoxLayout->addWidget(TextLabelX);
95 aHBoxLayout->addWidget(m_sbXcoeff);
96 aHBoxLayout->addWidget(TextLabelY);
97 aHBoxLayout->addWidget(m_sbYcoeff);
98 aHBoxLayout->addWidget(TextLabelZ);
99 aHBoxLayout->addWidget(m_sbZcoeff);
100 //aHBoxLayout->addStretch();
101 aHBoxLayout->addWidget(m_bReset);
103 // OK, CANCEL, Apply button
104 QGroupBox* aGroupBox2 = new QGroupBox(this);
105 QHBoxLayout* aHBoxLayout2 = new QHBoxLayout(aGroupBox2);
106 aHBoxLayout2->setMargin(11);
107 aHBoxLayout2->setSpacing(6);
108 // Create <OK> button
109 QPushButton* m_bOk = new QPushButton(tr("O&K"), aGroupBox2, "m_bOk");
110 m_bOk->setDefault(TRUE);
111 m_bOk->setAutoDefault(TRUE);
112 // Create <Apply> button
113 QPushButton* m_bApply = new QPushButton(tr("&Apply"), aGroupBox2, "m_bApply");
114 m_bApply->setAutoDefault(TRUE);
115 // Create <Cancel> button
116 QPushButton* m_bCancel = new QPushButton(tr("&Cancel"), aGroupBox2, "m_bCancel");
117 m_bCancel->setAutoDefault(TRUE);
120 aHBoxLayout2->addWidget(m_bOk);
121 aHBoxLayout2->addWidget(m_bApply);
122 aHBoxLayout2->addStretch();
123 aHBoxLayout2->addWidget(m_bCancel);
125 // Layout top level widgets
126 layoutDlg->addWidget(aGroupBox,0,0);
127 layoutDlg->addWidget(aGroupBox2,1,0);
129 // signals and slots connections
130 connect(m_bCancel, SIGNAL(clicked()), this, SLOT(onClickClose()));
131 connect(m_bOk, SIGNAL(clicked()), this, SLOT(onClickOk()));
132 connect(m_bApply, SIGNAL(clicked()), this, SLOT(onClickApply()));
133 connect(m_bReset, SIGNAL(clicked()), this, SLOT(onClickReset()));
135 this->resize(100, this->sizeHint().height());
139 * Destroys the object and frees any allocated resources
142 ::~SVTK_NonIsometricDlg()
144 // no need to delete child widgets, Qt does it all for us
151 // Get values from the VTK view
152 double aScaleFactor[3];
153 m_MainWindow->GetScale(aScaleFactor);
154 m_sbXcoeff->setValue(aScaleFactor[0]);
155 m_sbYcoeff->setValue(aScaleFactor[1]);
156 m_sbZcoeff->setValue(aScaleFactor[2]);
173 double aScale[3] = {m_sbXcoeff->value(), m_sbYcoeff->value(), m_sbZcoeff->value()};
174 m_MainWindow->SetScale(aScale);
181 m_bReset->setFocus();
182 m_sbXcoeff->setValue(1.0);
183 m_sbYcoeff->setValue(1.0);
184 m_sbZcoeff->setValue(1.0);