]> SALOME platform Git repositories - modules/visu.git/blob - src/VISUGUI/VisuGUI_CutPlanesDlg.cxx
Salome HOME
85bc997f66e3ea7378b7585d91da6eebf898b07a
[modules/visu.git] / src / VISUGUI / VisuGUI_CutPlanesDlg.cxx
1 //  VISU VISUGUI : GUI of VISU component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 //
22 //
23 //
24 //  File   : VisuGUI_CutPlanesDlg.cxx
25 //  Author : Laurent CORNABE & Hubert ROLLAND
26 //  Module : VISU
27 //  $Header$
28
29 #include "VisuGUI_CutPlanesDlg.h"
30
31 #include "VisuGUI.h"
32 #include "VisuGUI_Tools.h"
33 #include "VisuGUI_ViewTools.h"
34
35 #include "VISU_CutPlanes_i.hh"
36 #include "VISU_CutPlanesPL.hxx"
37
38 #include "OB_Browser.h"
39
40 #include "SVTK_ViewWindow.h"
41
42 #include "LightApp_Application.h"
43
44 #include "SUIT_Application.h"
45 #include "SUIT_Desktop.h"
46 #include "SUIT_ViewWindow.h"
47 #include "SUIT_ViewManager.h"
48 #include "SUIT_Session.h"
49 #include "SUIT_MessageBox.h"
50 #include "SUIT_ResourceMgr.h"
51
52 #include <qlayout.h>
53 #include <qcheckbox.h>
54 #include <qstyle.h>
55 #include <qstring.h>
56 #include <qvalidator.h>
57 #include <qlineedit.h>
58 #include <qtabwidget.h>
59
60 #include <vtkRenderer.h>
61 #include <vtkPolyData.h>
62 #include <vtkAppendPolyData.h>
63 #include <vtkDataSetMapper.h>
64
65 using namespace std;
66
67 //extern VisuGUI *visuGUI;
68
69 VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane (QWidget* theParent)
70      : QFrame(theParent), myPreviewActor(0)
71 {
72   QGridLayout* TopLayout = new QGridLayout( this );
73   TopLayout->setSpacing( 6 );
74   TopLayout->setMargin( 10 );
75
76   QButtonGroup* SelPlane = new QButtonGroup (tr("TXT_ORIENTATION"), this, "SelPlane");
77   //SelPlane->setTitle(tr("TXT_ORIENTATION"));
78   SelPlane->setColumnLayout(0, Qt::Vertical);
79   SelPlane->layout()->setSpacing( 0 );
80   SelPlane->layout()->setMargin( 0 );
81   QGridLayout* SelPlaneLayout = new QGridLayout( SelPlane->layout() );
82   SelPlaneLayout->setAlignment( Qt::AlignTop );
83   SelPlaneLayout->setSpacing( 6 );
84   SelPlaneLayout->setMargin( 11 );
85
86   RBxy = new QRadioButton (tr("PARALLEL_XOY"), SelPlane, "RBxy");
87   RByz = new QRadioButton (tr("PARALLEL_YOZ"), SelPlane, "RByz");
88   RBzx = new QRadioButton (tr("PARALLEL_ZOX"), SelPlane, "RBzx");
89   SelPlaneLayout->addWidget( RBxy, 0, 0 );
90   SelPlaneLayout->addWidget( RByz, 0, 1 );
91   SelPlaneLayout->addWidget( RBzx, 0, 2 );
92
93   QLabel* LabelPosi_3 = new QLabel (tr("LBL_NB_PLANS"), this, "LabelPosi_3");
94
95   nbPlan = new QSpinBox( 1, 100, 1, this, "nbPlan" );
96   nbPlan->setValue( 1 );
97   nbPlan->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
98
99   myPosTable = new QTable (this, "Positions of planes");
100   myPosTable->setMaximumHeight( 227 );
101   myPosTable->setMinimumWidth( 294 );
102   myPosTable->setNumCols(2);
103   myPosTable->setNumRows(0);
104   connect( myPosTable, SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)) );
105
106   QHeader *th = myPosTable->horizontalHeader();
107   th->setLabel( 0, "Position" );
108   th->setLabel( 1, "Set default" );
109   th->setStyle("QStyle::CE_PushButton");
110
111   QGroupBox* GBrot = new QGroupBox (tr("LBL_ROTATION"), this, "GBrot");
112   GBrot->setColumnLayout(0, Qt::Vertical);
113   GBrot->layout()->setSpacing( 0 );
114   GBrot->layout()->setMargin( 0 );
115   QGridLayout* GBrotLayout = new QGridLayout( GBrot->layout() );
116   GBrotLayout->setAlignment( Qt::AlignTop );
117   GBrotLayout->setSpacing( 6 );
118   GBrotLayout->setMargin( 11 );
119
120   LabelRot1 = new QLabel (tr("LBL_ROT_X"), GBrot, "LabelRot1");
121   GBrotLayout->addWidget( LabelRot1, 0, 0 );
122
123   Rot1 = new QtxDblSpinBox( -180, 180, 10, GBrot );
124   Rot1->setValue( 0 );
125   Rot1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
126   connect( Rot1, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
127   GBrotLayout->addWidget( Rot1, 0, 1 );
128
129   LabelRot2 = new QLabel (tr("LBL_ROT_Y"), GBrot, "LabelRot2");
130   GBrotLayout->addWidget( LabelRot2, 1, 0 );
131
132   Rot2 = new QtxDblSpinBox( -180, 180, 10, GBrot );
133   Rot2->setValue( 0 );
134   Rot2->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
135   connect( Rot2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
136   GBrotLayout->addWidget( Rot2, 1, 1 );
137
138   QLabel* aPosLbl = new QLabel(tr( "LBL_POS" ), this);
139   myPosSpn = new QtxDblSpinBox( 0, 1, 0.1, this );
140
141   myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), this);
142   myPreviewCheck->setChecked(false);
143   connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
144
145   TopLayout->addMultiCellWidget( SelPlane, 0, 0, 0, 1 );
146   TopLayout->addMultiCellWidget( GBrot, 1, 1, 0, 1 );
147   TopLayout->addWidget( LabelPosi_3,   2, 0 );
148   TopLayout->addWidget( nbPlan,        2, 1 );
149   TopLayout->addMultiCellWidget( myPosTable, 3, 3, 0, 1 );
150   TopLayout->setRowStretch ( 3, 3 );
151   TopLayout->addWidget(aPosLbl, 4, 0 );
152   TopLayout->addWidget(myPosSpn, 4, 1 );
153   TopLayout->addMultiCellWidget( myPreviewCheck, 5, 5, 0, 1 );
154
155   // signals and slots connections
156   connect( SelPlane, SIGNAL( clicked( int )), this, SLOT( orientationChanged( int ) ) );
157   connect( nbPlan, SIGNAL( valueChanged( int )), this, SLOT( DrawTable( ) ) );
158   connect( myPosSpn, SIGNAL( valueChanged( double )), this, SLOT( DrawTable( ) ) );
159   connect( th, SIGNAL( clicked(int)), this, SLOT( setDefault(int) ) );
160
161   // default values
162   myCutPlanes = NULL;
163   hasInit = false;
164   X1 = 0; X2 = 0;
165   Y1 = 0; Y2 = 0;
166   Z1 = 0; Z2 = 0;
167   RByz->setChecked( true );
168
169 } // End of Constructor
170
171 VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane()
172 {
173   deletePlanes();
174   if (myCutPlanes)
175     myCutPlanes->Destroy();
176   if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
177     vf->Repaint();
178 }
179
180 void VisuGUI_CutPlanesPane::initFromPrsObject (VISU::CutPlanes_i* thePrs)
181 {
182   setNbPlanes(thePrs->GetNbPlanes());
183   setRotation(thePrs->GetRotateX()*180./PI, thePrs->GetRotateY()*180./PI);
184   setPlanePos(thePrs->GetOrientationType());
185   myPosSpn->setValue(thePrs->GetDisplacement());
186   hasInit = true;
187   // init table
188   myCutPlanes = new VISU::CutPlanes_i(thePrs->GetResult(),false);
189   myCutPlanes->SameAs(thePrs);
190   DrawTable();
191
192   // Draw Preview
193   if (myPreviewCheck->isChecked()) {
194     createPlanes();
195   }
196 }
197
198 void VisuGUI_CutPlanesPane::createPlanes()
199 {
200   if (VISU::GetActiveViewWindow<SVTK_ViewWindow>() == NULL) return;
201   if (myCutPlanes == NULL) return;
202   if (myPreviewActor != 0) return;
203
204   vtkAppendPolyData* aPolyData = myCutPlanes->GetCutPlanesPL()->GetAppendPolyData();
205   if (!aPolyData->GetOutput()->GetNumberOfCells()) {
206     onPreviewCheck(false);
207     return;
208   }
209   vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
210   aPlaneMapper->SetInput(aPolyData->GetOutput());
211   aPlaneMapper->ScalarVisibilityOff();
212
213   myPreviewActor = SALOME_Actor::New();
214   myPreviewActor->PickableOff();
215   myPreviewActor->SetMapper(aPlaneMapper);
216   aPlaneMapper->Delete();
217   VISU::GetActiveViewWindow<SVTK_ViewWindow>()->AddActor(myPreviewActor);
218 }
219
220 int VisuGUI_CutPlanesPane::storeToPrsObject (VISU::CutPlanes_i* thePrs)
221 {
222   thePrs->SetOrientation(getOrientaion(), getRotation1()*PI/180., getRotation2()*PI/180.);
223   thePrs->SetNbPlanes(getNbPlanes());
224   thePrs->SetDisplacement(myPosSpn->value());
225   for (int i = 0; i < getNbPlanes(); ++i) {
226     QCheckTableItem* anItem = (QCheckTableItem*)myPosTable->item(i, 1);
227     if (!anItem)
228       break;
229     if (!anItem->isChecked())
230       thePrs->SetPlanePosition(i, myPosTable->text(i, 0).toDouble());
231     else
232       thePrs->SetDefault(i);
233   }
234   return 1;
235 }
236
237 /*!
238   Called when orientation is changed
239 */
240 void VisuGUI_CutPlanesPane::orientationChanged (int Id)
241 {
242   if (Id == 0) { // RBxy->isChecked()
243     LabelRot1->setText(tr("LBL_ROT_X"));
244     LabelRot2->setText(tr("LBL_ROT_Y"));
245   } else if (Id == 1) { // RByz->isChecked()
246     LabelRot1->setText(tr("LBL_ROT_Y"));
247     LabelRot2->setText(tr("LBL_ROT_Z"));
248   } else {
249     LabelRot1->setText(tr("LBL_ROT_Z"));
250     LabelRot2->setText(tr("LBL_ROT_X"));
251   }
252   DrawTable();
253 }
254
255 /*!
256   Sets planes orientation and position
257 */
258 void VisuGUI_CutPlanesPane::setPlanePos (const VISU::CutPlanes::Orientation orient)
259 {
260   if (orient == VISU::CutPlanes::XY)           // xy
261     {
262       RBxy->setChecked( true );
263       orientationChanged( 0 );
264     }
265   else if (orient == VISU::CutPlanes::YZ)       // yz
266     {
267       RByz->setChecked( true );
268       orientationChanged( 1 );
269     }
270   else                         // zx
271    {
272      RBzx->setChecked( true );
273      orientationChanged( 2 );
274    }
275
276 }
277
278 /*!
279   Gets planes orientation
280 */
281 VISU::CutPlanes::Orientation VisuGUI_CutPlanesPane::getOrientaion()
282 {
283   VISU::CutPlanes::Orientation orient;
284   if ( RBxy->isChecked() )     // xy
285     orient = VISU::CutPlanes::XY;
286   else if ( RByz->isChecked() )     // yz
287     orient = VISU::CutPlanes::YZ;
288   else if ( RBzx->isChecked() )     // zx
289     orient = VISU::CutPlanes::ZX;
290   return orient;
291 }
292
293 /*!
294   Sets planes rotation
295 */
296 void VisuGUI_CutPlanesPane::setRotation (const double r1, const double r2)
297 {
298   Rot1->setValue( r1 );
299   Rot2->setValue( r2 );
300 }
301
302 /*!
303   Draw the table of planes positions
304 */
305 void VisuGUI_CutPlanesPane::DrawTable()
306 {
307   if (myCutPlanes == NULL) return;
308   if (!hasInit) return;
309
310   int aNbRows = myPosTable->numRows();
311   int aNbPlanes = getNbPlanes();
312
313   myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
314   myCutPlanes->SetNbPlanes(aNbPlanes);
315   myCutPlanes->SetDisplacement(myPosSpn->value());
316   if (aNbRows>0)
317     for (int i = 0; i < aNbRows; ++i) {
318       QCheckTableItem* aItem = (QCheckTableItem*)myPosTable->item( i, 1 );
319       if (aItem == 0) break;
320       if (!aItem->isChecked())
321         myCutPlanes->SetPlanePosition(i, myPosTable->text(i, 0).toDouble());
322     }
323
324   if (aNbPlanes > aNbRows)
325     myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
326   else if (aNbPlanes < aNbRows)
327     myPosTable->setNumRows(aNbPlanes);
328
329   int aMin = (aNbRows < aNbPlanes)? aNbRows : aNbPlanes;
330   for (int i = 0; i<aMin; i++) {
331     myPosTable->setText(i, 0, QString::number(myCutPlanes->GetPlanePosition(i)));
332     ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(myCutPlanes->IsDefault(i));
333   }
334
335   QHeader *vh = myPosTable->verticalHeader();
336   QString str("Plane# %1");
337   for (int i=aMin; i<aNbPlanes; i++) {
338     VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem(myPosTable,
339                                                              QTableItem::OnTyping,
340                                                              QString::number(myCutPlanes->GetPlanePosition(i)));
341     aEditItem->setReplaceable(false);
342     aEditItem->setEnabled(!myCutPlanes->IsDefault(i));
343     myPosTable->setItem(i, 0, aEditItem);
344
345     QCheckTableItem* aCheck = new QCheckTableItem(myPosTable, 0);
346     aCheck->setChecked(myCutPlanes->IsDefault(i));
347     aCheck->setReplaceable(false);
348     myPosTable->setItem(i, 1, aCheck);
349
350     vh->setLabel( i, str.arg(i+1) );
351   }
352
353   // Update preview
354   if (myPreviewCheck->isChecked()) {
355     if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
356       myCutPlanes->GetPL()->Update();
357       deletePlanes();
358       createPlanes();
359       vf->Repaint();
360     }
361   }
362 }
363
364 void VisuGUI_CutPlanesPane::setDefault (int all)
365 {
366   myPosTable->setCurrentCell(-1, 1);
367   myPosTable->clearSelection();
368   if (all == 0) return;
369   if (all == 1)
370     for (int i = 0; i < getNbPlanes(); ++i)
371       ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
372
373   for (int i = 0; i < getNbPlanes(); ++i) {
374     if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
375       myCutPlanes->SetDefault(i);
376       myPosTable->setText( i, 0, QString::number(myCutPlanes->GetPlanePosition(i)));
377       myPosTable->item( i, 0 )->setEnabled(false);
378     } else
379       myPosTable->item( i, 0 )->setEnabled(true);
380   }
381 }
382
383 void VisuGUI_CutPlanesPane::onValueChanged (int theRow, int theCol)
384 {
385   if (theCol == 0) {
386     QString aTxt = myPosTable->text(theRow, 0);
387     bool isChanged = !aTxt.isEmpty();
388     ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged);
389
390     if (myPreviewCheck->isChecked()) {
391       //Update Preview
392       if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
393         myCutPlanes->SetPlanePosition( theRow, aTxt.toDouble());
394         myCutPlanes->GetPL()->Update();
395         deletePlanes();
396         createPlanes();
397         vf->Repaint();
398       }
399     }
400   } else {
401     bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
402     if (isDefault) {
403       myCutPlanes->SetDefault(theRow);
404       myPosTable->setText(theRow, 0, QString::number(myCutPlanes->GetPlanePosition(theRow)));
405
406       if (myPreviewCheck->isChecked()) {
407         if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
408           //Update Preview
409           myCutPlanes->GetPL()->Update();
410           deletePlanes();
411           createPlanes();
412           vf->Repaint();
413         }
414       }
415     }
416     myPosTable->item(theRow, 0)->setEnabled(!isDefault);
417   }
418 }
419
420 void VisuGUI_CutPlanesPane::deletePlanes()
421 {
422   if (myPreviewActor == 0) return;
423   vtkRenderer* aRend       = myPreviewActor->GetRenderer();
424   if(aRend)
425     myPreviewActor->RemoveFromRender(aRend);
426 //  Bug IPAL11962: preview is still in the viewer, if viewer not active.
427 //   if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
428 //     vf->RemoveActor(myPreviewActor);
429   myPreviewActor->Delete();
430   myPreviewActor = 0;
431 }
432
433 void VisuGUI_CutPlanesPane::onRotation (double theValue)
434 {
435   if (myCutPlanes == NULL) return;
436   if (myPreviewCheck->isChecked()) {
437     if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
438       myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
439       myCutPlanes->GetPL()->Update();
440       deletePlanes();
441       createPlanes();
442       vf->Repaint();
443     }
444   }
445 }
446
447 void VisuGUI_CutPlanesPane::onPreviewCheck (bool thePreview)
448 {
449   if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
450     if (thePreview) {
451       storeToPrsObject(myCutPlanes);
452       myCutPlanes->GetPL()->Update();
453       createPlanes();
454       vf->onFitAll();
455     } else {
456       deletePlanes();
457       vf->Repaint();
458     }
459   }
460 }
461
462 //###################################################################
463
464
465 /*!
466   Constructor
467 */
468 VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg (SalomeApp_Module* theModule)
469      : QDialog(VISU::GetDesktop(theModule), "VisuGUI_CutPlanesDlg", false,
470                WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
471 {
472   setCaption("Cut Planes Definition");
473   setSizeGripEnabled(true);
474
475   QVBoxLayout* TopLayout = new QVBoxLayout (this);
476   TopLayout->setSpacing(6);
477   TopLayout->setMargin(11);
478
479   // Tab pane
480   QTabWidget* aTabBox = new QTabWidget(this);
481   myCutPane = new VisuGUI_CutPlanesPane(this/*, myMgr*/);
482   aTabBox->addTab(myCutPane, "Cut Planes");
483   myScalarPane = new VisuGUI_ScalarBarPane(this, false);
484   myScalarPane->setMargin(5);
485   aTabBox->addTab(myScalarPane, "Scalar Bar");
486
487   TopLayout->addWidget(aTabBox);
488
489   QGroupBox* GroupButtons = new QGroupBox(this, "GroupButtons");
490   GroupButtons->setGeometry(QRect(10, 10, 281, 48));
491   GroupButtons->setTitle("");
492   GroupButtons->setColumnLayout(0, Qt::Vertical);
493   GroupButtons->layout()->setSpacing(0);
494   GroupButtons->layout()->setMargin(0);
495   QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
496   GroupButtonsLayout->setAlignment(Qt::AlignTop);
497   GroupButtonsLayout->setSpacing(6);
498   GroupButtonsLayout->setMargin(11);
499
500   QPushButton* buttonOk = new QPushButton(tr("&OK"), GroupButtons, "buttonOk");
501   buttonOk->setAutoDefault(TRUE);
502   buttonOk->setDefault(TRUE);
503   GroupButtonsLayout->addWidget(buttonOk, 0, 0);
504   GroupButtonsLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1);
505
506   QPushButton* buttonCancel = new QPushButton(tr("&Cancel"), GroupButtons, "buttonCancel");
507   buttonCancel->setAutoDefault(TRUE);
508   GroupButtonsLayout->addWidget(buttonCancel, 0, 2);
509
510   QPushButton* buttonHelp = new QPushButton(tr("&Help"), GroupButtons, "buttonHelp");
511   buttonHelp->setAutoDefault(TRUE);
512   GroupButtonsLayout->addWidget(buttonHelp, 0, 3);
513
514   TopLayout->addWidget(GroupButtons);
515
516   connect(buttonOk,     SIGNAL(clicked()), this, SLOT(accept()));
517   connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
518   connect(buttonHelp,   SIGNAL(clicked()), this, SLOT(onHelp()));
519   //connect(myMgr, SIGNAL(closeAllViews()), this, SLOT(reject()));
520   //connect(VisuGUI::application()->desktop(),
521   //        SIGNAL(windowActivated(SUIT_ViewWindow*)),
522   //        this, SLOT(onWindowActivated(SUIT_ViewWindow*)));
523 }
524
525 void VisuGUI_CutPlanesDlg::initFromPrsObject (VISU::CutPlanes_i* thePrs)
526 {
527   myPrs = thePrs;
528   myScalarPane->initFromPrsObject(thePrs);
529   myCutPane->initFromPrsObject(thePrs);
530 }
531
532 int VisuGUI_CutPlanesDlg::storeToPrsObject (VISU::CutPlanes_i* thePrs)
533 {
534   return (myScalarPane->storeToPrsObject(thePrs) &&
535           myCutPane->storeToPrsObject(thePrs));
536 }
537
538 void VisuGUI_CutPlanesDlg::accept()
539 {
540   //if ( !VisuGUI::CheckActiveStudyLock() ) {
541   //  reject();
542   //  return;
543   //}
544   if (myScalarPane->check())
545     {
546       myScalarPane->deletePreview();
547       QDialog::accept();
548     }
549 }
550
551 void VisuGUI_CutPlanesDlg::reject() {
552   myScalarPane->deletePreview();
553   QDialog::reject();
554 }
555
556 void VisuGUI_CutPlanesDlg::onHelp()
557 {
558   QString aHelpFileName = "/files/cut_lines_resentation.htm";
559   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
560   if (app) {
561     VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
562     app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
563   }
564   else {
565     SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
566                            QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
567                            arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName),
568                            QObject::tr("BUT_OK"));
569   }
570 }
571
572 //void VisuGUI_CutPlanesDlg::onWindowActivated (SUIT_ViewWindow* theWnd)
573 //{
574 //  if (theWnd != myStudyWnd)
575 //    reject();
576 //}
577
578 //###################################################################
579
580 QWidget* VisuGUI_NumEditItem::createEditor() const
581 {
582   QLineEdit *editline = new QLineEdit(text(), table()->viewport());
583   QDoubleValidator *dvalidator = new QDoubleValidator(table()->viewport());
584   dvalidator->setDecimals(32);
585   editline->setValidator(dvalidator);
586   return editline;
587 }