Salome HOME
e7c5560571551cc053c606e11d28595a5584a538
[modules/visu.git] / src / VISUGUI / VisuGUI.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  VISU VISUGUI : GUI of VISU component
23 //  File   : VisuGUI.cxx
24 //  Author :
25 //  Module : VISU
26
27 #include "VisuGUI.h"
28
29 // STL Includes
30 #include <exception>
31 #include <typeinfo>
32 #include <vector>
33
34 // QT Includes
35 #include <QList>
36 #include <QVector>
37 #include <QColorDialog>
38 #include <QDateTime>
39 #include <QMenu>
40
41 // VTK Includes
42 #include <vtkRenderer.h>
43 #include <vtkRenderWindow.h>
44 #include <vtkActorCollection.h>
45 #include <vtkTimerLog.h>
46
47 // SALOME Includes
48 #include "SALOME_LifeCycleCORBA.hxx"
49
50 #include "SUIT_ResourceMgr.h"
51 #include "SUIT_MessageBox.h"
52
53 #include "SUIT_ViewWindow.h"
54 #include "SUIT_ViewManager.h"
55 #include "SUIT_Desktop.h"
56 #include "SUIT_DataBrowser.h"
57 #include "SUIT_OverrideCursor.h"
58
59 #include "CAM_Module.h"
60
61 #include "SVTK_ViewWindow.h"
62 #include "SVTK_ViewModel.h"
63 #include "SVTK_Functor.h"
64 //#include "SVTK_MainWindow.h"
65
66 #include "SPlot2d_ViewModel.h"
67 #include "VisuGUI_SetupPlot2dDlg.h"
68 #include "Plot2d_SetupCurveDlg.h"
69 #include "Plot2d_ViewManager.h"
70
71 #include "QtxPagePrefMgr.h"
72 #include "OB_Browser.h"
73
74 #include "SALOME_ListIteratorOfListIO.hxx"
75
76 #include "SalomeApp_Application.h"
77 #include "SalomeApp_DataModel.h"
78 #include "SalomeApp_Study.h"
79 #include "SalomeApp_CheckFileDlg.h"
80
81 #include "LightApp_SelectionMgr.h"
82 #include "LightApp_Selection.h"
83 #include "LightApp_Preferences.h"
84 #include "LightApp_DataOwner.h"
85
86 #include "QtxAction.h"
87 #include "QtxFontEdit.h"
88
89 #include "VISUConfig.hh"
90 #include "VISU_Gen_i.hh"
91 #include "VISU_Mesh_i.hh"
92 #include "VISU_Table_i.hh"
93 #include "VISU_PointMap3d_i.hh"
94 #include "VISU_Result_i.hh"
95 #include "VISU_View_i.hh"
96 #include "VISU_ViewManager_i.hh"
97 #include "VISU_Plot3D_i.hh"
98
99 #include "VISU_Actor.h"
100
101 #include "VisuGUI_Prs3dTools.h"
102 #include "VisuGUI_Tools.h"
103
104 #include "VisuGUI_SelectionPanel.h"
105 #include "VisuGUI_FeatureEdgesPanel.h"
106 #include "VisuGUI_NameDlg.h"
107 #include "VisuGUI_CursorDlg.h"
108 #include "VisuGUI_Selection.h"
109 #include "VisuGUI_TimeAnimation.h"
110 #include "VisuGUI_EditContainerDlg.h"
111 #include "VisuGUI_ClippingDlg.h"
112 #include "VisuGUI_Plot3DDlg.h"
113 #include "VisuGUI_OffsetDlg.h"
114 #include "VisuGUI_Displayer.h"
115 #include "VisuGUI_BuildProgressDlg.h"
116 #include "VisuGUI_TransparencyDlg.h"
117 #include "VisuGUI_CacheDlg.h"
118 #include "VisuGUI_Table3dDlg.h"
119 #include "VisuGUI_ClippingPanel.h"
120 #include "VisuGUI_FilterScalarsDlg.h"
121
122 #include "VISU_ScalarMap_i.hh"
123 #include "VisuGUI_ScalarBarDlg.h"
124
125 #include "VISU_DeformedShape_i.hh"
126 #include "VisuGUI_DeformedShapeDlg.h"
127
128 #include "VISU_DeformedShapeAndScalarMap_i.hh"
129 #include "VisuGUI_DeformedShapeAndScalarMapDlg.h"
130
131 #include "VISU_IsoSurfaces_i.hh"
132 #include "VisuGUI_IsoSurfacesDlg.h"
133
134 #include "VISU_CutPlanes_i.hh"
135 #include "VisuGUI_CutPlanesDlg.h"
136
137 #include "VISU_CutLines_i.hh"
138 #include "VisuGUI_CutLinesDlg.h"
139
140 #include "VISU_StreamLines_i.hh"
141 #include "VisuGUI_StreamLinesDlg.h"
142
143 #include "VISU_Vectors_i.hh"
144 #include "VisuGUI_VectorsDlg.h"
145
146 #include "VisuGUI_TableDlg.h"
147 #include "VisuGUI_FileInfoDlg.h"
148
149 #include "SALOMEconfig.h"
150 #include CORBA_SERVER_HEADER(MED_Gen)
151
152 #include "utilities.h"
153
154 #include "VisuGUI_ActionsDef.h"
155
156 #include "VisuGUI_Timer.h"
157
158 //#include "VVTK_ViewModel.h"
159
160 #include "VisuGUI_Slider.h"
161 #include "VisuGUI_Sweep.h"
162 #include <VISU_ScalarMapAct.h>
163 #include <VISU_GaussPtsAct.h>
164 #include "VisuGUI_ValuesLabelingDlg.h"
165
166 using namespace VISU;
167
168 #ifdef _DEBUG_
169 static int MYDEBUG = 0;
170 #else
171 static int MYDEBUG = 0;
172 #endif
173
174 #ifdef WIN32
175 #define usleep(A) _sleep(A/1000)
176 #endif
177
178 //////////////////////////////////////////////////
179 // Class: VisuGUI
180 //////////////////////////////////////////////////
181
182 VisuGUI
183 ::VisuGUI():
184   SalomeApp_Module( "VISU" ),
185   myDisplayer( 0 ),
186   mySlider( NULL ),
187   mySweep( NULL )
188 {
189 }
190
191 VisuGUI
192 ::~VisuGUI()
193 {
194 }
195
196 void
197 VisuGUI
198 ::OnImportFromFile()
199 {
200   if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
201
202   if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
203     return;
204
205   SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
206
207   // Get file name(s)
208   QStringList aFilter;
209   aFilter.append( tr( "FLT_MED_FILES" ) );
210   aFilter.append( tr( "FLT_DISTRIBUTED_MED_FILES" ) );
211   aFilter.append( tr( "FLT_ALL_FILES" ) );
212
213   bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
214
215   SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
216   fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
217   fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
218   fd.setFilters( aFilter );
219   fd.SetChecked( toUseBuildProgress );
220   if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
221     fd.setDirectory( QDir::currentPath() );
222
223   QStringList fileNames;
224   if ( !fd.exec() )
225     return; // cancelled, return
226
227   fileNames = fd.selectedFiles();
228   toUseBuildProgress = fd.IsChecked();
229
230   if ( fileNames.count() == 0 )
231     return; // nothing selected, return
232
233   SUIT_OverrideCursor wc;
234   QStringList errors;
235
236   for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
237     QFileInfo aFileInfo( *it );
238
239     if ( !aFileInfo.exists() ) {
240       // file not exist
241       errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
242                      arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
243     }
244     else {
245       try {
246         if ( !toUseBuildProgress ) {
247           // build progress is not used, use build flags from settings
248           bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields",     true );
249           bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max",    true );
250           bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups",     true );
251           bool toBuildAll    = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
252           bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once",    false );
253
254           QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
255           application()->putInfo( anInfo );
256
257           VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
258
259           if ( CORBA::is_nil( aResult.in() ) ) {
260             errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
261                            arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
262           }
263           else {
264             aResult->SetBuildFields( toBuildFields, toBuildMinMax );
265             aResult->SetBuildGroups( toBuildGroups );
266             aResult->Build( toBuildAll, toBuildAtOnce );
267             application()->putInfo( anInfo + tr("INF_DONE") );
268           }
269         } // if ( !toUseBuildProgress )
270         else {
271           // use build progress
272           wc.suspend();
273           VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
274           aBuildProgressDlg->setFileName( aFileInfo.filePath() );
275           aBuildProgressDlg->setGenerator( GetVisuGen(this) );
276           aBuildProgressDlg->exec();
277           wc.resume();
278         }
279       } // try
280       catch(...) {
281         errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
282       }
283     } // else // if ( !aFileInfo.exists() )
284   } // for (...)
285
286   if ( errors.count() > 0 ) {
287     SUIT_MessageBox::critical( GetDesktop(this),
288                                tr("ERR_ERROR"),
289                                tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
290   }
291   else {
292     UpdateObjBrowser(this);
293   }
294 }
295
296 void
297 VisuGUI
298 ::OnImportTableFromFile()
299 {
300   if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
301   if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
302     return;
303
304   QStringList aFilter;
305   aFilter.append( tr("FLT_TABLE_FILES") );
306   aFilter.append( tr("FLT_ALL_FILES") );
307
308   QString anInitialPath = "";
309   if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
310     anInitialPath = QDir::currentPath();
311
312   QStringList aFiles = SUIT_FileDlg::getOpenFileNames(GetDesktop(this),
313                                                       anInitialPath,
314                                                       aFilter,
315                                                       tr("TLT_IMPORT_TABLE"));
316   if ( aFiles.count() == 0 )
317     return; // nothing selected
318
319   QStringList errors;
320   for ( QStringList::ConstIterator it = aFiles.begin(); it != aFiles.end(); ++it ) {
321     QFileInfo aFileInfo( *it );
322
323     if ( !aFileInfo.exists() ) {
324       errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
325                      arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
326     }
327     else {
328       try {
329         QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
330         application()->putInfo( anInfo );
331
332         CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData());
333
334         if (CORBA::is_nil(anObject.in())) {
335           errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
336                          arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
337         }
338         else {
339           application()->putInfo( anInfo + tr("INF_DONE") );
340         }
341       }
342       catch(...) {
343         errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
344       }
345     }
346   }
347
348   if ( errors.count() > 0 ) {
349     SUIT_MessageBox::critical( GetDesktop(this),
350                                tr("ERR_ERROR"),
351                                tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
352   }
353   else {
354     UpdateObjBrowser(this);
355   }
356 }
357
358 void
359 VisuGUI
360 ::OnExportTableToFile()
361 {
362   if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
363
364   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
365
366   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
367   SALOME_ListIO aListIO;
368   aSelectionMgr->selectedObjects(aListIO);
369
370   if (aListIO.Extent() > 0) {
371     const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
372     if (anIO->hasEntry()) {
373       _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
374       if (!aSObj) return;
375
376       // find table attribute
377       bool isTOR = true;
378       _PTR(GenericAttribute) anAttr;
379
380       if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
381         isTOR = false;
382         if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
383           // if the current SObject is a table title
384           // we take a father contaning the table
385           aSObj = aSObj->GetFather();
386
387           if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
388             isTOR = true;
389           } else {
390             if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
391               return;
392             }
393           }
394         }
395       }
396
397       // get table title in order to have default name of the file
398       QString aTitle;
399       if (isTOR) {
400         _PTR(AttributeTableOfReal) aTabAttr (anAttr);
401         if (!aTabAttr) return;
402         aTitle = aTabAttr->GetTitle().c_str();
403       } else {
404         _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
405         if (!aTabAttr) return;
406         aTitle = aTabAttr->GetTitle().c_str();
407       }
408       aTitle.simplified();
409       aTitle = aTitle.replace(QRegExp(" "), "_").replace(QRegExp("\\*"), "" );
410
411       // get default path for the file
412       SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
413       QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
414       if (aDir.isEmpty()) {
415         aDir = aResourceMgr->stringValue("VISU","InputDir","");
416         if (aDir.isEmpty()) {
417           aDir = getenv("CSF_PATHData");
418         }
419       }
420       QString aPath = Qtx::addSlash(aDir) + aTitle;
421
422       // get name for the file
423       QStringList aFilter;
424       aFilter.append("Table Files (*.xls)");
425
426       QFileInfo aFileInfo =
427         SUIT_FileDlg::getFileName(GetDesktop(this),
428                                   aPath,
429                                   aFilter,
430                                   tr("MEN_EXPORT_TABLE"), // "Export Table To File"
431                                   false);
432
433       // export
434       QString aFile = aFileInfo.filePath();
435       if (!aFile.isEmpty()) {
436         application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
437         aDir = Qtx::dir(aFile, true);
438         aResourceMgr->setValue("VISU", "OutputDir", aDir);
439
440         try {
441           GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), (const char*)aFile.toLatin1());
442           application()->putInfo(aFile + " " + tr("INF_DONE"));
443         } catch(std::exception& exc) {
444           INFOS(exc.what());
445           SUIT_MessageBox::warning(GetDesktop(this),
446                                    tr("WRN_VISU"),
447                                    tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()) );
448
449         } catch(...) {
450           INFOS((const char*)tr("ERR_ERROR_DURING_EXPORT").toLatin1());
451           SUIT_MessageBox::warning( GetDesktop(this),
452                                     tr("WRN_VISU"),
453                                     tr("ERR_ERROR_DURING_EXPORT") );
454
455         }
456       }
457     }
458   }
459 }
460
461 void
462 VisuGUI
463 ::OnImportMedField()
464 {
465   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
466   if (CheckLock(aCStudy,GetDesktop(this)))
467     return;
468   SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
469
470   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
471   SALOME_ListIO aListIO;
472   aSelectionMgr->selectedObjects(aListIO);
473
474   SALOME_ListIteratorOfListIO It (aListIO);
475   QApplication::setOverrideCursor(Qt::WaitCursor);
476   for (; It.More(); It.Next()) {
477     Handle(SALOME_InteractiveObject) anIO = It.Value();
478     SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
479     if (!aSObject->_is_nil()) {
480
481       // try to load a component data from an opened (presumably) study
482       // The same in SUPERVISION: NPAL14522
483       {
484         SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
485         CORBA::String_var aCompIOR;
486         if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
487           CORBA::String_var aCompDataType = aSComp->ComponentDataType();
488
489           // obtain a driver by a component data type
490           // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
491           SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
492           SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
493           try {
494             CORBA::Object_var
495               anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
496             if (CORBA::is_nil(anEngineObj))
497               anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
498
499             if (!CORBA::is_nil(anEngineObj))
500               anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
501
502             if (!CORBA::is_nil(anEngine)) {
503               // try to load
504               SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
505               aStudyBuilder->LoadWith(aSComp, anEngine);
506             }
507           }
508           catch (...) {
509           }
510         }
511       }
512
513       CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
514       if (!CORBA::is_nil(anObject)) {
515         SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
516         if (!CORBA::is_nil(aMED.in()))
517           GetVisuGen(this)->ImportMed(aSObject);
518         SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
519         if (!CORBA::is_nil(aField.in()))
520           GetVisuGen(this)->ImportMedField(aField);
521       } else {
522         SALOMEDS::SObject_var aSFather = aSObject->GetFather();
523         SALOMEDS::GenericAttribute_var anAttr;
524         aSFather->FindAttribute(anAttr, "AttributeName");
525         SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
526         CORBA::String_var aValue = aName->Value();
527         if (strcmp(aValue.in(), "MEDFIELD") == 0)
528           GetVisuGen(this)->ImportMed(aSObject);
529       }
530     }
531   }
532   UpdateObjBrowser(this, true);
533   QApplication::restoreOverrideCursor();
534 }
535
536 void VisuGUI::OnLoadComponentData()
537 {
538   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
539   if (CheckLock(aCStudy,GetDesktop(this)))
540     return;
541   SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
542
543   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
544   SALOME_ListIO aListIO;
545   aSelectionMgr->selectedObjects(aListIO);
546
547   SALOME_ListIteratorOfListIO It (aListIO);
548   QApplication::setOverrideCursor(Qt::WaitCursor);
549   for (; It.More(); It.Next()) {
550     Handle(SALOME_InteractiveObject) anIO = It.Value();
551     SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
552     if (!aSObject->_is_nil()) {
553
554       // try to load a component data from an opened (presumably) study
555       // The same in SUPERVISION: NPAL14522
556       {
557         SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
558         CORBA::String_var aCompIOR;
559         if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
560           CORBA::String_var aCompDataType = aSComp->ComponentDataType();
561
562           QString anInfo ("Loading ");
563           anInfo = anInfo + aCompDataType.in() + " Component Data ...";
564           application()->putInfo( anInfo );
565
566           // obtain a driver by a component data type
567           // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
568           SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
569           SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
570           try {
571             CORBA::Object_var
572               anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
573             if (CORBA::is_nil(anEngineObj))
574               anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
575
576             if (!CORBA::is_nil(anEngineObj))
577               anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
578
579             if (!CORBA::is_nil(anEngine)) {
580               // try to load
581               SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
582               aStudyBuilder->LoadWith(aSComp, anEngine);
583             }
584
585             application()->putInfo( anInfo + tr("INF_DONE"));
586           }
587           catch (...) {
588             application()->putInfo( anInfo + tr("INF_FAILED"));
589           }
590         }
591       }
592     }
593   }
594   QApplication::restoreOverrideCursor();
595 }
596
597 void
598 CreateCurves( SalomeApp_Module* theModule,
599               VISU::CutLines_i* thePrs,
600               QDialog* theDlg,
601               const bool theCreate = true )
602 {
603   if ( !thePrs )
604     return;
605   VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg );
606   if ( !aCutDlg )
607     return;
608
609   _PTR(Study)   aStudy = GetCStudy( GetAppStudy( theModule ) );
610   _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry() );
611
612   if ( !theCreate && aSObject ) {
613     // Remove old Table
614     _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
615     _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
616     for (; aIter->More(); aIter->Next()) {
617       _PTR(SObject) aTblObj = aIter->Value();
618       if( aTblObj ) {
619         _PTR(GenericAttribute) anAttr;
620         if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
621           _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
622           SalomeApp_Study* salome_study = GetAppStudy( theModule );
623           for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
624             salome_study->deleteReferencesTo( aChildIter->Value() );
625             _PTR(SObject) aSO = aChildIter->Value();
626             if(aSO){
627               Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO);
628               if (aRestoringMap["myComment"] == "CURVE") {
629                 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
630                 if(!CORBA::is_nil(aCORBAObject)){
631                   PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
632                   if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
633                     PlotRemoveCurve(theModule, aCurve);
634                   }
635                 }
636               }
637             }
638
639           }
640
641           aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
642
643           //UpdateObjBrowser(theModule,true,aTblObj);
644           break;
645         }
646       }
647     }
648   }
649
650   if ( aCutDlg->isGenerateTable() ) {
651     GetVisuGen( theModule )->CreateTable( thePrs->GetEntry().c_str() );
652     if ( aCutDlg->isGenerateCurves() ) {
653       if ( aSObject ) {
654         _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
655         _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
656         for (; aIter->More(); aIter->Next()) {
657           _PTR(SObject) aTblObj = aIter->Value();
658           if ( aTblObj ) {
659             _PTR(GenericAttribute) anAttr;
660             if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
661               CreatePlot( theModule, aTblObj );
662             }
663           }
664         }
665       }
666     }
667   }
668
669   if (!theCreate && aSObject) {
670     UpdateObjBrowser(theModule);
671   }
672 }
673
674 void
675 VisuGUI
676 ::OnCreateMesh()
677 {
678   _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
679   if (CheckLock(aStudy,GetDesktop(this)))
680     return;
681
682   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
683   if(aSelectionInfo.empty())
684     return;
685
686   // Get selected SObject
687   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
688   Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
689   if (anIO.IsNull() || !anIO->hasEntry())
690     return;
691
692   // create a VTK view window if it does not exist
693   SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
694
695   // create mesh presentation and display it in aViewWindow
696   VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
697   aViewWindow->highlight(anIO, 1);
698   if (aPrs)
699     emit presentationCreated(aPrs);
700 }
701
702 void
703 VisuGUI
704 ::OnCreateManyMesh()
705 {
706   _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
707   if (CheckLock(aStudy,GetDesktop(this)))
708     return;
709
710   // create a VTK view window if it does not exist
711   SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
712
713   // Get selected SObject
714   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
715   SALOME_ListIO aListIO;
716   aSelectionMgr->selectedObjects(aListIO);
717   SALOME_ListIteratorOfListIO anIter (aListIO);
718   for (; anIter.More(); anIter.Next()) {
719     Handle(SALOME_InteractiveObject) anIO = anIter.Value();
720     if (anIO.IsNull() || !anIO->hasEntry())
721       return;
722
723     // create mesh presentation and display it in aViewWindow
724     VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
725     aViewWindow->highlight(anIO, 1);
726     if (aPrs)
727       emit presentationCreated(aPrs);
728   }
729 }
730
731 void
732 VisuGUI
733 ::OnCreateScalarMap()
734 {
735   Prs3d_i* aPrs = CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
736   if (aPrs)
737     emit presentationCreated(aPrs);
738 }
739
740
741 void
742 VisuGUI
743 ::OnCreateDeformedShape()
744 {
745   Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
746   if (aPrs)
747     emit presentationCreated(aPrs);
748 }
749
750 void
751 VisuGUI
752 ::OnCreateDeformedShapeAndScalarMap()
753 {
754   Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShapeAndScalarMap_i,VisuGUI_DeformedShapeAndScalarMapDlg,1>(this);
755   if (aPrs)
756     emit presentationCreated(aPrs);
757 }
758
759 void
760 VisuGUI
761 ::OnCreateVectors()
762 {
763   Prs3d_i* aPrs = CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
764   if (aPrs)
765     emit presentationCreated(aPrs);
766 }
767
768 void
769 VisuGUI
770 ::OnCreateIsoSurfaces()
771 {
772   Prs3d_i* aPrs = CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
773   if (aPrs)
774     emit presentationCreated(aPrs);
775 }
776
777 void
778 VisuGUI
779 ::OnCreateCutPlanes()
780 {
781   Prs3d_i* aPrs = CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
782   if (aPrs)
783     emit presentationCreated(aPrs);
784 }
785
786 void
787 VisuGUI
788 ::OnCreateCutLines()
789 {
790   Prs3d_i* aPrs = CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
791   if (aPrs)
792     emit presentationCreated(aPrs);
793 }
794
795 void
796 VisuGUI
797 ::OnCreateStreamLines()
798 {
799   Prs3d_i* aPrs = CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
800   if (aPrs)
801     emit presentationCreated(aPrs);
802 }
803
804 void
805 VisuGUI
806 ::OnCreatePlot3D()
807 {
808   Prs3d_i* aPrs = CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
809   if (aPrs)
810     emit presentationCreated(aPrs);
811 }
812
813 void
814 VisuGUI
815 ::OnCreatePlot2dView()
816 {
817   CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
818   GetVisuGen( this )->CreateContainer();
819   UpdateObjBrowser(this);
820 }
821
822 void
823 VisuGUI
824 ::OnDisplayPrs()
825 {
826   if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
827
828   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
829   if (!aSelectionMgr)
830     return;
831
832   QApplication::setOverrideCursor(Qt::WaitCursor);
833
834   SALOME_ListIO aSel, aList;
835   aSelectionMgr->selectedObjects(aSel);
836   extractContainers(aSel, aList);
837
838   for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
839     Handle(SALOME_InteractiveObject) anIO = it.Value();
840     TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
841     VISU::Base_i* aBase = anObjectInfo.myBase;
842     if(!aBase)
843       continue;
844
845     VISU::VISUType aType = aBase->GetType();
846     switch (aType) {
847     case VISU::TPOINTMAP3D:
848       if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
849         displayer()->Display(anIO->getEntry());
850         aViewWindow->highlight(anIO, 1);
851         aViewWindow->getRenderer()->ResetCameraClippingRange();
852         aViewWindow->Repaint();
853         break;
854       }
855       else {
856         if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false))
857           aPlot2d->Repaint();
858         displayer()->Display(anIO->getEntry());
859       }
860     case VISU::TCURVE:
861     case VISU::TCONTAINER:
862     case VISU::TTABLE:
863       displayer()->Display(anIO->getEntry());
864       break;
865     default: {
866       VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
867       if(aPrs3d){
868         if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
869           displayer()->Display(anIO->getEntry());
870           aViewWindow->highlight(anIO, 1);
871           aViewWindow->getRenderer()->ResetCameraClippingRange();
872           aViewWindow->Repaint();
873         }
874       }
875     }
876     }
877   }
878
879   QApplication::restoreOverrideCursor();
880 }
881
882 void
883 VisuGUI
884 ::OnDisplayOnlyPrs()
885 {
886   /// to correct IMP 0016100
887   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
888   if (!aSelectionMgr)
889     return;
890   
891   SALOME_ListIO aSel, aList;
892   aSelectionMgr->selectedObjects(aSel);
893   extractContainers(aSel, aList);
894   Handle(SALOME_InteractiveObject) anIO = aList.First();
895   activateAppropriateViewer(anIO);
896   OnEraseAll();
897   OnDisplayPrs();
898 }
899
900 void VisuGUI::activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO )
901 {
902   TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), theIO->getEntry());
903   VISU::Base_i* aBase = anObjectInfo.myBase;
904   if(!aBase)
905     return;
906
907   std::string anEntry = theIO->getEntry();
908   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
909   _PTR(SObject) SO = aCStudy->FindObjectID( theIO->getEntry() );
910
911   CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(SO);
912   if(CORBA::is_nil(aCORBAObject))
913     return;
914
915   VISU::VISUType aType = aBase->GetType();
916
917   if ( VISU::GetPrs3dFromBase(aBase) ) {
918     // activate SVTK Viewer
919     getApp()->getViewManager( SVTK_Viewer::Type(), true );
920     return;
921   }
922
923   switch (aType) {
924   case VISU::TCURVE:
925   case VISU::TCONTAINER:
926   case VISU::TTABLE: {
927     // Activate Plot2d
928     GetPlot2dViewer(this, true);
929     break;
930   }
931   case VISU::TCOLOREDPRS3DHOLDER :
932   case VISU::TPOINTMAP3D : {
933     //find curves under pointmap 3d
934     bool hasCurvesChildren = false;
935
936     SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
937     QString aViewerType = aViewMgr->getType();
938
939     _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(SO);
940     _PTR(SObject) aChild;
941     for (; anIter->More(); anIter->Next()) {
942       aChild = anIter->Value();
943       CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aChild);
944       if(!CORBA::is_nil(aCORBAObject)){
945         PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
946         if( dynamic_cast<VISU::Curve_i*>(aServant.in()))
947           hasCurvesChildren = true;
948       }
949     }
950
951     if (hasCurvesChildren && ( aViewerType == SPlot2d_Viewer::Type() || aViewerType == SVTK_Viewer::Type() ) ) {
952       return;
953     } else {
954       // activate SVTK Viewer  
955       getApp()->getViewManager( SVTK_Viewer::Type(), true );
956       return;
957     }
958     break;
959   }
960   }
961 }
962
963 void
964 VisuGUI
965 ::OnErasePrs()
966 {
967   if(MYDEBUG) MESSAGE("OnErasePrs");
968   QApplication::setOverrideCursor(Qt::WaitCursor);
969
970   SALOME_ListIO aList, aSel;
971   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
972   aSelectionMgr->selectedObjects(aSel);
973   extractContainers(aSel, aList);
974
975   for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
976     Handle(SALOME_InteractiveObject) anIO = it.Value();
977     TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
978     VISU::Base_i* aBase = anObjectInfo.myBase;
979     ErasePrs(this, aBase, /*repaint_view_window = */true);
980   }
981
982   QApplication::restoreOverrideCursor();
983 }
984
985 //----------------------------------------------------------------------------
986 void
987 VisuGUI
988 ::OnEraseAll()
989 {
990   startOperation( myEraseAll );
991   if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
992     vw->unHighlightAll();
993     if (vtkRenderer *aRen = vw->getRenderer()) {
994       vtkActor *anActor;
995       vtkActorCollection *anActColl = aRen->GetActors();
996       for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
997         if (anActor->GetVisibility() > 0)
998           if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
999             RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
1000             anVISUActor->VisibilityOff();
1001           }
1002       }
1003       vw->Repaint();
1004     }
1005   } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
1006     aPlot2d->EraseAll();
1007   }
1008 }
1009
1010
1011 namespace
1012 {
1013   //----------------------------------------------------------------------------
1014   VISU::Prs3d_i*
1015   GetPrsToModify(const SalomeApp_Module* theModule,
1016                  Handle(SALOME_InteractiveObject)& theIO)
1017   {
1018     VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
1019     if(aSelectionInfo.empty())
1020       return NULL;
1021
1022     VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1023     theIO = aSelectionItem.myIO;
1024     return VISU::GetPrs3dToModify(theModule, aSelectionItem.myObjectInfo.myBase);
1025   }
1026 }
1027
1028 //----------------------------------------------------------------------------
1029 void
1030 VisuGUI
1031 ::OnEditScalarMap()
1032 {
1033   Handle(SALOME_InteractiveObject) anIO;
1034   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1035     EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
1036 }
1037
1038 //----------------------------------------------------------------------------
1039 void
1040 VisuGUI
1041 ::OnEditDeformedShape()
1042 {
1043   Handle(SALOME_InteractiveObject) anIO;
1044   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1045     VisuGUI_DeformedShapeDlg::EditPrs3d(this, aPrs3d, anIO);
1046   //    EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
1047 }
1048
1049 //----------------------------------------------------------------------------
1050 void
1051 VisuGUI
1052 ::OnEditDeformedShapeAndScalarMap()
1053 {
1054   Handle(SALOME_InteractiveObject) anIO;
1055   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1056     EditPrs3d<VISU::DeformedShapeAndScalarMap_i, VisuGUI_DeformedShapeAndScalarMapDlg, 1>(this, anIO, aPrs3d);
1057 }
1058
1059 //----------------------------------------------------------------------------
1060 void
1061 VisuGUI
1062 ::OnEditCutPlanes()
1063 {
1064   Handle(SALOME_InteractiveObject) anIO;
1065   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1066     EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
1067 }
1068
1069 //----------------------------------------------------------------------------
1070 void
1071 VisuGUI
1072 ::OnEditCutLines()
1073 {
1074   Handle(SALOME_InteractiveObject) anIO;
1075   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1076     EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
1077 }
1078
1079 //----------------------------------------------------------------------------
1080 void
1081 VisuGUI
1082 ::OnEditIsoSurfaces()
1083 {
1084   Handle(SALOME_InteractiveObject) anIO;
1085   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1086     EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
1087 }
1088
1089 //----------------------------------------------------------------------------
1090 void
1091 VisuGUI
1092 ::OnEditVectors()
1093 {
1094   Handle(SALOME_InteractiveObject) anIO;
1095   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1096     EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
1097 }
1098
1099 //----------------------------------------------------------------------------
1100 void
1101 VisuGUI
1102 ::OnEditStreamLines()
1103 {
1104   Handle(SALOME_InteractiveObject) anIO;
1105   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1106     EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
1107 }
1108
1109 //----------------------------------------------------------------------------
1110 void
1111 VisuGUI
1112 ::OnEditPlot3D()
1113 {
1114   Handle(SALOME_InteractiveObject) anIO;
1115   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1116     EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
1117 }
1118
1119
1120 //----------------------------------------------------------------------------
1121 void
1122 VisuGUI
1123 ::OnMakeSurfaceframe()
1124 {
1125   ChangeRepresentation(this, VISU::SURFACEFRAME);
1126 }
1127
1128 //----------------------------------------------------------------------------
1129 void
1130 VisuGUI
1131 ::OnMakeInsideframe()
1132 {
1133   ChangeRepresentation(this, VISU::INSIDEFRAME);
1134 }
1135
1136 //----------------------------------------------------------------------------
1137 void
1138 VisuGUI
1139 ::OnMakeWireframe()
1140 {
1141   ChangeRepresentation(this, VISU::WIREFRAME);
1142 }
1143
1144 //----------------------------------------------------------------------------
1145 void
1146 VisuGUI
1147 ::OnMakeSurface()
1148 {
1149   ChangeRepresentation(this, VISU::SHADED);
1150 }
1151
1152 //----------------------------------------------------------------------------
1153 void
1154 VisuGUI
1155 ::OnMakePoints()
1156 {
1157   ChangeRepresentation(this, VISU::POINT);
1158 }
1159
1160 //----------------------------------------------------------------------------
1161 void
1162 VisuGUI
1163 ::OnMakeShrink()
1164 {
1165   ChangeRepresentation(this, VISU::SHRINK);
1166 }
1167
1168 //----------------------------------------------------------------------------
1169 void
1170 VisuGUI
1171 ::OnMakeFeatureEdges()
1172 {
1173   ChangeRepresentation(this, VISU::FEATURE_EDGES);
1174 }
1175
1176 //----------------------------------------------------------------------------
1177 void
1178 VisuGUI
1179 ::OnSetShadingOn()
1180 {
1181   SetShading(this, true);
1182 }
1183
1184 //----------------------------------------------------------------------------
1185 void
1186 VisuGUI
1187 ::OnSetShadingOff()
1188 {
1189   SetShading(this, false);
1190 }
1191
1192
1193 //----------------------------------------------------------------------------
1194 void
1195 VisuGUI
1196 ::OnChangeColor()
1197 {
1198   VISU_Actor* anActor = NULL;
1199   VISU::Prs3d_i* aPrs3d = NULL;
1200   SVTK_ViewWindow* aViewWindow = NULL;
1201   if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1202     return;
1203
1204   VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1205   VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
1206
1207   SALOMEDS::Color anOldColor, aNewColor;
1208   int aRepresent = anActor->GetRepresentation();
1209   if (aMesh) {
1210     switch (aRepresent) {
1211       case VISU::POINT :
1212         anOldColor = aMesh->GetNodeColor();
1213         break;
1214       case VISU::WIREFRAME :
1215       case VISU::INSIDEFRAME :
1216         anOldColor = aMesh->GetLinkColor();
1217         break;
1218       case VISU::SHADED :
1219       case VISU::SURFACEFRAME :
1220         anOldColor = aMesh->GetCellColor();
1221         break;
1222     }
1223   } else if (aDeformedShape) {
1224     anOldColor = aDeformedShape->GetColor();
1225   } else {
1226     return;
1227   }
1228
1229   QColor aColor (int(255*anOldColor.R),
1230                  int(255*anOldColor.G),
1231                  int(255*anOldColor.B));
1232   QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1233   if (aColorNew.isValid()) {
1234     aNewColor.R = aColorNew.red()/255.;
1235     aNewColor.G = aColorNew.green()/255.;
1236     aNewColor.B = aColorNew.blue()/255.;
1237     if (aMesh) {
1238       switch (aRepresent) {
1239         case VISU::POINT :
1240           aMesh->SetNodeColor(aNewColor);
1241           break;
1242         case VISU::WIREFRAME :
1243         case VISU::INSIDEFRAME :
1244           aMesh->SetLinkColor(aNewColor);
1245           break;
1246         case VISU::SHADED :
1247         case VISU::SURFACEFRAME :
1248           aMesh->SetCellColor(aNewColor);
1249           break;
1250       }
1251     } else {
1252       aDeformedShape->SetColor(aNewColor);
1253     }
1254     RecreateActor(this, aPrs3d);
1255   }
1256 }
1257
1258 //----------------------------------------------------------------------------
1259 void
1260 VisuGUI
1261 ::OnChangeWireframeColor()
1262 {
1263   VISU_Actor* anActor = NULL;
1264   VISU::Prs3d_i* aPrs3d = NULL;
1265   SVTK_ViewWindow* aViewWindow = NULL;
1266   if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1267     return;
1268
1269   VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1270   if(!aMesh)
1271     return;
1272
1273   SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
1274   QColor aColor (int(255*anOldColor.R),
1275                  int(255*anOldColor.G),
1276                  int(255*anOldColor.B));
1277   QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1278   if (aColorNew.isValid()) {
1279     aNewColor.R = aColorNew.red()/255.;
1280     aNewColor.G = aColorNew.green()/255.;
1281     aNewColor.B = aColorNew.blue()/255.;
1282     aMesh->SetLinkColor(aNewColor);
1283     RecreateActor(this, aMesh);
1284   }
1285 }
1286
1287 //----------------------------------------------------------------------------
1288 void
1289 VisuGUI
1290 ::OnChangeOpacity()
1291 {
1292   VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
1293   aDialog->show();
1294 }
1295
1296 //----------------------------------------------------------------------------
1297 void
1298 VisuGUI
1299 ::OnChangeLines()
1300 {
1301   VISU_Actor* anActor = NULL;
1302   VISU_ActorBase* anActorBase = NULL;
1303   VISU::Prs3d_i* aPrs3d = NULL;
1304   SVTK_ViewWindow* aViewWindow = NULL;
1305   float oldlwid;
1306   bool isPrs3d = false;
1307
1308   if (GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) {
1309     isPrs3d = true;
1310   }
1311   else {
1312     aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
1313     VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1314     VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1315     VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
1316     anActorBase = VISU::FindActorBase(aViewWindow, aTable);
1317     oldlwid = anActorBase->GetLineWidth();
1318   }
1319
1320
1321   VisuGUI_CursorDlg* CursorDlg =
1322     new VisuGUI_CursorDlg (GetDesktop(this), (const char*)tr("DLG_LINEWIDTH_TITLE").toLatin1(), TRUE);
1323
1324   CursorDlg->helpFileName = "viewing_3d_presentations_intro_page.html#width_opacity_anchor";
1325   CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1326   CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1327   CursorDlg->SpinBox1->setMinimum(1);
1328   CursorDlg->SpinBox1->setMaximum(10);
1329
1330   int intlwid = int(oldlwid);
1331   CursorDlg->SpinBox1->setValue(intlwid);
1332
1333   int ret = CursorDlg->exec();
1334   if (ret == 1) {
1335     intlwid  = CursorDlg->SpinBox1->value();
1336     float newlwid = intlwid;
1337     if (isPrs3d)
1338       anActor->SetLineWidth(newlwid);
1339     else
1340       anActorBase->SetLineWidth(newlwid);
1341   }
1342   delete CursorDlg;
1343 }
1344
1345 //----------------------------------------------------------------------------
1346 void
1347 VisuGUI
1348 ::OnShowTable()
1349 {
1350   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1351   if(aSelectionInfo.empty())
1352     return;
1353
1354   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1355   Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1356   VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1357   _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1358   if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
1359     aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() );
1360
1361   if( !IsSObjectTable( aSObject ) )
1362     return;
1363
1364   VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
1365                                                aSObject,
1366                                                false,
1367                                                //SAL2670 Orientation of show tables
1368                                                VisuGUI_TableDlg::ttAuto,
1369                                                Qt::Vertical );
1370   dlg->show();
1371 }
1372
1373 //----------------------------------------------------------------------------
1374 void
1375 VisuGUI
1376 ::OnShowTablePlot()
1377 {
1378   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1379   if(aSelectionInfo.empty())
1380     return;
1381
1382   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1383   Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1384   VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1385   _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1386   if(VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1387     VisuGUI_Table3DDlg*aDlg = new VisuGUI_Table3DDlg( this );
1388     aDlg->initFromPrsObject( aTable );
1389     if ( runAndWait(aDlg, 0) > 0 ) {
1390       aDlg->storeToPrsObject(aTable);
1391       aTable->UpdateActors();
1392     }
1393     delete aDlg;
1394   }
1395 }
1396
1397 //----------------------------------------------------------------------------
1398 void
1399 VisuGUI
1400 ::OnShowScalarBar()
1401 {
1402   SetScalarBarVisibility(true);
1403 }
1404
1405 void
1406 VisuGUI
1407 ::OnHideScalarBar()
1408 {
1409   SetScalarBarVisibility(false);
1410 }
1411
1412 void
1413 VisuGUI
1414 ::SetScalarBarVisibility(bool theVisibility)
1415 {
1416   printf ("\nOnHideScalarBar");
1417   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1418   SALOME_ListIO aListIO;
1419   aSelectionMgr->selectedObjects(aListIO);
1420
1421   SALOME_ListIteratorOfListIO It (aListIO);
1422
1423   bool update = false;
1424   for (; It.More(); It.Next()) {
1425     Handle(SALOME_InteractiveObject)& anIO = It.Value();
1426     std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1427     if (!aPrsList.empty()) {
1428       for (int i = 0, n = aPrsList.size(); i < n; i++) {
1429         VISU::Prs3d_i* aPrsObject = aPrsList[i];
1430         if (aPrsObject) {
1431           VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1432           if (aScalar) {
1433             aScalar->SetBarVisible( theVisibility );
1434             RecreateActor(this, aScalar);
1435             update = true;
1436           }
1437         }
1438       }
1439     }
1440   }
1441   if (update) {
1442     if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this))
1443       vw->Repaint();
1444   }
1445 }
1446
1447 //----------------------------------------------------------------------------
1448 void
1449 VisuGUI
1450 ::OnCreateTable()
1451 {
1452   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1453   if(aSelectionInfo.empty())
1454     return;
1455
1456   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1457   _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1458   VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1459
1460   if((aBase && aBase->GetType() == VISU::TCUTLINES) || IsSObjectTable(aSObject)) {
1461     GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1462     UpdateObjBrowser(this);
1463   }
1464 }
1465
1466 //----------------------------------------------------------------------------
1467 void
1468 VisuGUI
1469 ::OnDeleteObjects()
1470 {
1471   SalomeApp_Study* anAppStudy = GetAppStudy(this);
1472   _PTR(Study) aCStudy = GetCStudy(anAppStudy);
1473   if (CheckLock(aCStudy,GetDesktop(this)))
1474     return;
1475
1476   SALOME_ListIO aList;
1477   LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1478   mgr->selectedObjects(aList,QString::null,false);
1479   int i = 0, nbSelected = aList.Extent();
1480   if (nbSelected < 1) return;
1481
1482   std::vector<std::string> anEntries (nbSelected);
1483   QString aNameList;
1484   Handle(SALOME_InteractiveObject) anIO;
1485   for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1486     anIO = it.Value();
1487     if (anIO->hasEntry()) {
1488       if (IsRemovable(anIO->getEntry(), this)) {
1489         aNameList.append("\n    - ");
1490         // Get Name Of the Main Object if it's a referenced object
1491         VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1492         if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1493           _PTR(SObject) aRefSObject;
1494           if (aSObject->ReferencedObject(aRefSObject)) {
1495             QString aRefName = QString::fromStdString ( aRefSObject->GetName() );
1496             aNameList.append( aRefName );
1497           }
1498           else
1499             aNameList.append(anIO->getName());
1500         }
1501         anEntries[i++] = anIO->getEntry();
1502       }
1503     }
1504   }
1505   nbSelected = i;
1506   if (nbSelected < 1) {
1507     SUIT_MessageBox::warning(GetDesktop(this),
1508                              QObject::tr("WRN_VISU"),
1509                              QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1510     return;
1511   }
1512
1513   if ( SUIT_MessageBox::question( GetDesktop(this),
1514                                   QObject::tr( "WRN_VISU" ),
1515                                   QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
1516                                   SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
1517     return;
1518
1519   // There is a transaction
1520   _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1521   aStudyBuilder->NewCommand();
1522
1523   for (i = 0; i < nbSelected; i++) {
1524     VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anEntries[i]);
1525     if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1526       emit beforeObjectDelete(QString(aSObject->GetID().c_str()));
1527       _PTR(SObject) aRefSObject;
1528       if (aSObject->ReferencedObject(aRefSObject)) {
1529         // It can be a reference on curve, published under a container.
1530         // In this case the curve should be removed from the container.
1531         // See bug 10441.
1532         VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
1533         VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
1534         if(aRefBase && aRefBase->GetType() == VISU::TMESH){
1535           DeleteSObject(this, aCStudy, aRefSObject);
1536           UpdateObjBrowser(this, true, aRefSObject);
1537         }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
1538           CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
1539           VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
1540           _PTR(SObject) aParentSO = aSObject->GetFather();
1541           VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
1542           if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
1543             if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
1544               if(aContainer->GetNbCurves() > 0){
1545                 aContainer->RemoveCurve(aCurve);
1546                 UpdateObjBrowser(this, true, aParentSO);
1547               }
1548             }
1549           }
1550         }
1551       }
1552       else{
1553         DeleteSObject(this, aCStudy, aSObject);
1554         UpdateObjBrowser(this, true, aSObject);
1555       }
1556     }
1557   }
1558
1559   // Finish transaction
1560   aStudyBuilder->CommitCommand();
1561   mgr->clearSelected();
1562 }
1563
1564 //----------------------------------------------------------------------------
1565 void
1566 VisuGUI
1567 ::OnPlotData()
1568 {
1569   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1570   if(aSelectionInfo.empty())
1571     return;
1572
1573   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1574   if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
1575     if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) {
1576       if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
1577         _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1578         _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
1579         if(IsSObjectTable(aSObject)){
1580           VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1581           if(aDlg->exec() == QDialog::Accepted){
1582             if(!IsStudyLocked(aStudy)){
1583               // if study is not locked - create new container, create curves and insert them
1584               // into container, then plot container if current viewer is of VIEW_PLOT2D type
1585               int horIndex;
1586               QList<int> verIndices, zIndices;
1587               aDlg->getCurvesSource( horIndex, verIndices, zIndices );
1588               if( horIndex >= 0 && verIndices.count() > 0 ){
1589                 CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
1590                 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
1591                   for( int i = 0; i < verIndices.count(); i++ ){
1592                     VISU::Curve_var aCurveObject =
1593                       GetVisuGen(this)->CreateCurveWithZ(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 );
1594                     if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1595                       bool isAuto;
1596                       int  marker, line, lineWidth;
1597                       QColor color;
1598                       if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1599                                                     line, lineWidth, color) && !isAuto )
1600                       {
1601                         SALOMEDS::Color c;
1602                         c.R = color.red()  /255.;
1603                         c.G = color.green()/255.;
1604                         c.B = color.blue() /255.;
1605                         aCurve->SetColor( c );
1606                         aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1607                         aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1608                       }
1609                       aContainer->AddCurve(aCurveObject);
1610                     }
1611                   }
1612                   UpdateObjBrowser(this);
1613                   PlotContainer( this, aContainer, VISU::eDisplay );
1614                 }
1615               }
1616             } else {
1617               // get name of SObject
1618               QString aSObjectName;
1619               _PTR(GenericAttribute) anAttr;
1620               if(aSObject->FindAttribute( anAttr, "AttributeName" )){
1621                 _PTR(AttributeName) aName = anAttr;
1622                 aSObjectName = QString( aName->Value().c_str() );
1623               }
1624               // if study is locked just get curves info and plot them
1625               // if current viewer is of VIEW_PLOT2D type
1626               QList<Plot2d_Curve*> container;
1627               aDlg->getCurves( container );
1628               if ( !container.isEmpty() ) {
1629                 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1630                 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1631               }
1632             }
1633           }
1634           delete aDlg;
1635         }
1636       }
1637     }
1638   }else if(!aSelectionItem.myIO.IsNull()){
1639     // check if Table SObject is selected
1640     _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1641     if(IsSObjectTable(aSObject)){
1642       VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1643       if(aDlg->exec() == QDialog::Accepted){
1644         _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1645         if(!IsStudyLocked(aStudy)){
1646           // if study is not locked - create new table and container objects, create curves
1647           // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1648           int horIndex;
1649           QList<int> verIndices, zIndices;
1650           aDlg->getCurvesSource( horIndex, verIndices, zIndices );
1651           if ( horIndex >= 0 && verIndices.count() > 0 ) {
1652             VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
1653             if(!CORBA::is_nil(aTableObject)){
1654               VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
1655               VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
1656               for ( int i = 0; i < verIndices.count(); i++ ) {
1657                 VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZ
1658                   ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1 );
1659                 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1660                   bool isAuto;
1661                   int  marker, line, lineWidth;
1662                   QColor color;
1663                   if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1664                                                 line, lineWidth, color) && !isAuto )
1665                   {
1666                     SALOMEDS::Color c;
1667                     c.R = color.red()/255.;
1668                     c.G = color.green()/255.;
1669                     c.B = color.blue()/255.;
1670                     aCurve->SetColor( c );
1671                     aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1672                     aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1673                   }
1674                   aContainerObject->AddCurve(aCurveObject);
1675                 }
1676               }
1677               UpdateObjBrowser(this);
1678               PlotContainer( this, aContainer, VISU::eDisplay );
1679             }
1680           }
1681         } else {
1682           // get name of SObject
1683           QString aSObjectName;
1684           _PTR(GenericAttribute) anAttr;
1685           if(aSObject->FindAttribute(anAttr, "AttributeName")){
1686             _PTR(AttributeName) aName = anAttr;
1687             aSObjectName = QString( aName->Value().c_str() );
1688           }
1689           // if study is locked just get curves info and plot them
1690           QList<Plot2d_Curve*> container;
1691           aDlg->getCurves( container );
1692           if ( !container.isEmpty() ) {
1693             GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1694             GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1695           }
1696         }
1697       }
1698       delete aDlg;
1699     }
1700   }
1701 }
1702
1703 //----------------------------------------------------------------------------
1704 void
1705 VisuGUI
1706 ::OnCurveProperties()
1707 {
1708   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1709   if(aSelectionInfo.size() != 1)
1710     return;
1711
1712   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1713   Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1714   VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1715   if(!aBase)
1716     return;
1717
1718   if(aBase->GetType() == VISU::TCURVE) {
1719     // Curve object
1720     if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)){
1721       if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
1722         Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1723
1724         aDlg.setLine( (Plot2d::LineType)aCurve->GetLine(), aCurve->GetLineWidth() );
1725         aDlg.setMarker( (Plot2d::MarkerType)aCurve->GetMarker() );
1726         SALOMEDS::Color aColor = aCurve->GetColor();
1727         aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1728         if( aDlg.exec() == QDialog::Accepted ) {
1729           aCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1730           aCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1731           SALOMEDS::Color newColor;
1732           newColor.R = aDlg.getColor().red()/255.;
1733           newColor.G = aDlg.getColor().green()/255.;
1734           newColor.B = aDlg.getColor().blue()/255.;
1735           aCurve->SetColor( newColor );
1736           PlotCurve(this, aCurve, VISU::eDisplay);
1737         }
1738       }
1739     }
1740   }
1741 }
1742
1743 //----------------------------------------------------------------------------
1744 void
1745 VisuGUI
1746 ::OnClearContainer()
1747 {
1748   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1749   if (CheckLock(aCStudy,GetDesktop(this)))
1750     return;
1751
1752   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1753   if(aSelectionInfo.empty())
1754     return;
1755
1756   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1757   VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1758   if(!aBase)
1759     return;
1760
1761   if(aBase->GetType() == VISU::TCONTAINER){
1762     // Container object
1763     if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
1764       if(aContainer && aContainer->GetNbCurves() > 0){
1765         aContainer->Clear();
1766         UpdateObjBrowser(this);
1767       }
1768     }
1769   }
1770 }
1771
1772 //----------------------------------------------------------------------------
1773 void
1774 VisuGUI
1775 ::OnEditContainer()
1776 {
1777   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1778   if(aSelectionInfo.empty())
1779     return;
1780
1781   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1782   VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1783   if(!aBase)
1784     return;
1785
1786   VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase);
1787   if(!aContainer)
1788     return;
1789
1790   VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
1791   aDlg->initFromPrsObject(aContainer);
1792   if (aDlg->exec()) {
1793     aDlg->storeToPrsObject(aContainer);
1794     UpdateObjBrowser(this, true);
1795   }
1796   delete aDlg;
1797 }
1798
1799 //----------------------------------------------------------------------------
1800 void
1801 VisuGUI
1802 ::OnSaveViewParams()
1803 {
1804   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1805   if (CheckLock(aCStudy,GetDesktop(this)))
1806     return;
1807
1808   SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1809   if (aViewMgr->getType() != SVTK_Viewer::Type())
1810     return;
1811
1812   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1813   SALOME_ListIO aListIO;
1814   aSelectionMgr->selectedObjects(aListIO);
1815   if (aListIO.Extent() > 1)
1816     return;
1817
1818   if (aListIO.Extent() == 0) {
1819     VISU::View3D_i::SaveViewParams(aViewMgr, (const char*)VISU::View3D_i::GenerateViewParamsName().toLatin1());
1820   } else {
1821     const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1822     VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1823   }
1824   UpdateObjBrowser(this);
1825 }
1826
1827 //----------------------------------------------------------------------------
1828 void
1829 VisuGUI
1830 ::OnRestoreViewParams()
1831 {
1832   SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1833   if (aViewMgr->getType() != SVTK_Viewer::Type())
1834     return;
1835
1836   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1837   SALOME_ListIO aListIO;
1838   aSelectionMgr->selectedObjects(aListIO);
1839   if (aListIO.Extent() != 1)
1840     return;
1841
1842   const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1843   //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1844   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1845   _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1846   if ( aSObj )
1847     VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1848 }
1849
1850 //----------------------------------------------------------------------------
1851 void
1852 VisuGUI
1853 ::OnRename()
1854 {
1855   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1856   if (CheckLock(aCStudy,GetDesktop(this)))
1857     return;
1858
1859   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1860   if (aSelectionInfo.empty())
1861     return;
1862
1863   VisuGUI_Selection aSel (this);
1864   aSel.init("", getApp()->selectionMgr());
1865   if (aSel.count() < 1) return;
1866
1867   bool isAny = false; // is there any appropriate object selected
1868   for (int i = 0; i < aSelectionInfo.size(); i++) {
1869     VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
1870     VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
1871
1872     _PTR(SObject) aSObject = anObjectInfo.mySObject;
1873     if (!aSObject)
1874       continue;
1875
1876     // Check, if the selected object can be renamed
1877     QString aStr = aSel.parameter(i, "type" ).toString();
1878     if (aStr == "VISU::TSCALARMAP" || aStr == "VISU::TISOSURFACES" ||
1879         aStr == "VISU::TDEFORMEDSHAPE" || aStr == "VISU::TCUTPLANES" ||
1880         aStr == "VISU::TCUTLINES" || aStr == "VISU::TVECTORS" ||
1881         aStr == "VISU::TSTREAMLINES" || aStr == "VISU::TPLOT3D" ||
1882         aStr == "VISU::TSCALARMAPONDEFORMEDSHAPE" || aStr == "VISU::TCOLOREDPRS3DHOLDER" ||
1883         aStr == "VISU::TTABLE" || aStr == "VISU::TCURVE" || aStr == "VISU::TCONTAINER" ||
1884         aStr == "VISU::POINTMAP3D" || aStr == "VISU::TVIEW3D" ||
1885         aStr == "VISU::TMESH" || aStr == "VISU::TPOINTMAP3D" || aStr == "VISU::TGAUSSPOINTS")
1886     {
1887       _PTR(GenericAttribute) anAttr;
1888       if (aSObject->FindAttribute(anAttr, "AttributeName")) {
1889         isAny = true;
1890         _PTR(AttributeName) aName (anAttr);
1891         QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
1892         if (!Name.isEmpty()) {
1893           QApplication::setOverrideCursor(Qt::WaitCursor);
1894
1895           // rename specific objects
1896           if (VISU::Base_i* aBase = anObjectInfo.myBase) {
1897             switch (aBase->GetType()) {
1898             case VISU::TCURVE: { // Curve object
1899               if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
1900                 aCurve->SetName(Name.toLatin1().constData(), true);
1901               break;
1902             }
1903             case VISU::TTABLE: { // Table object
1904               if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
1905                 aTable->SetName(Name.toLatin1().constData(), true);
1906               break;
1907             }
1908             case VISU::TPOINTMAP3D: { // Table object
1909               if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1910                 aTable3d->SetTitle(Name.toLatin1().constData());
1911                 aTable3d->UpdateActors();
1912               }
1913               break;
1914             }
1915             case VISU::TCONTAINER: { // Container object
1916               if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
1917                 aContainer->SetName(Name.toLatin1().constData(), true);
1918               break;
1919             }
1920             default: {
1921             }}
1922           }
1923
1924           // rename the study object
1925           Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1926           aName->SetValue(Name.toLatin1().constData()); // rename the SObject
1927           anIO->setName(Name.toLatin1().constData()); // rename the InteractiveObject
1928
1929           ViewManagerList aViewManagerList;
1930           getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
1931           SUIT_ViewManager* aViewManager;
1932           foreach( aViewManager, aViewManagerList ) {
1933             if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
1934               if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
1935                 aViewer->renameAll( anIO, Name.toLatin1().constData() );
1936             }
1937           }
1938
1939           UpdateObjBrowser(this, false);
1940           QApplication::restoreOverrideCursor();
1941         }
1942       }
1943     }
1944   } // for
1945
1946   if (!isAny) {
1947     SUIT_MessageBox::warning(GetDesktop(this),
1948                              QObject::tr("WRN_VISU"),
1949                              QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1950   }
1951 }
1952
1953 //----------------------------------------------------------------------------
1954 void
1955 VisuGUI
1956 ::OnClippingPlanes()
1957 {
1958   new VisuGUI_ClippingDlg (this, false);
1959 }
1960
1961 //----------------------------------------------------------------------------
1962 void
1963 VisuGUI
1964 ::OnSweep()
1965 {
1966   OnDisplayPrs();
1967   if ( !mySweep->toggleViewAction()->isChecked() )
1968     mySweep->toggleViewAction()->trigger();
1969   mySweep->onSelectionChanged();
1970   mySweep->onFirst();
1971   mySweep->onPlay(true);
1972 }
1973
1974 //----------------------------------------------------------------------------
1975 void
1976 VisuGUI
1977 ::OnTimeAnimation(VISU::Animation::AnimationMode theMode)
1978 {
1979   if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
1980     return;
1981
1982   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1983   VisuGUI_TimeAnimationDlg* aAnimationDlg =
1984     new VisuGUI_TimeAnimationDlg (this, aCStudy, theMode);
1985
1986   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1987   SALOME_ListIO aListIO;
1988   aSelectionMgr->selectedObjects(aListIO);
1989
1990   SALOME_ListIteratorOfListIO It (aListIO);
1991   for (; It.More(); It.Next()) {
1992     _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
1993     if ( !aAnimationDlg->addField(aSObject) ) {
1994       SUIT_MessageBox::warning(GetDesktop(this),
1995                                tr("WRN_VISU"),
1996                                tr("ERR_CANT_CREATE_ANIMATION") );
1997       delete aAnimationDlg;
1998       return;
1999     }
2000   }
2001   aAnimationDlg->show();
2002 }
2003
2004 //----------------------------------------------------------------------------
2005 void
2006 VisuGUI::
2007 OnParallelTimeAnimation()
2008 {
2009   OnTimeAnimation(VISU::Animation::PARALLEL);
2010 }
2011
2012 void
2013 VisuGUI::
2014 OnSucccessiveTimeAnimation()
2015 {
2016   OnTimeAnimation(VISU::Animation::SUCCESSIVE);
2017 }
2018
2019 //----------------------------------------------------------------------------
2020 void
2021 VisuGUI
2022 ::OnShowAnimation()
2023 {
2024   if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2025     return;
2026
2027   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2028   SALOME_ListIO aListIO;
2029   aSelectionMgr->selectedObjects(aListIO);
2030
2031   if (aListIO.Extent() != 1)
2032     return;
2033
2034   const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2035
2036   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2037
2038   _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
2039   if (!aSObj)
2040     return;
2041
2042   VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2043   if (aType != VISU::TANIMATION)
2044     return;
2045
2046   VisuGUI_TimeAnimationDlg* aAnimationDlg =
2047     new VisuGUI_TimeAnimationDlg(this, aCStudy);
2048   aAnimationDlg->restoreFromStudy(aSObj);
2049   aAnimationDlg->show();
2050 }
2051
2052 //----------------------------------------------------------------------------
2053 void
2054 VisuGUI
2055 ::OnCopyPresentation()
2056 {
2057   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2058   if (CheckLock(aCStudy,GetDesktop(this)))
2059     return;
2060
2061   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2062   if(aSelectionInfo.empty())
2063     return;
2064
2065   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2066   VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2067   if(!aBase)
2068     return;
2069
2070   VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aBase);
2071   if(!aPrs3d)
2072     return;
2073
2074   if(aBase->GetType() != VISU::TMESH){
2075     VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aBase);
2076     switch (aBase->GetType()) {
2077     case VISU::TSCALARMAP:
2078       TSameAsFactory<VISU::TSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2079       break;
2080     case VISU::TDEFORMEDSHAPE:
2081       TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2082       break;
2083     case VISU::TSCALARMAPONDEFORMEDSHAPE:
2084     case VISU::TDEFORMEDSHAPEANDSCALARMAP:
2085       TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2086       break;
2087     case VISU::TCUTPLANES:
2088       TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2089       break;
2090     case VISU::TCUTLINES:
2091       TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2092       break;
2093     case VISU::TISOSURFACES:
2094       TSameAsFactory<VISU::TISOSURFACES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2095       break;
2096     case VISU::TSTREAMLINES:
2097       TSameAsFactory<VISU::TSTREAMLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2098       break;
2099     case VISU::TVECTORS:
2100       TSameAsFactory<VISU::TVECTORS>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2101       break;
2102     case VISU::TPLOT3D:
2103       TSameAsFactory<VISU::TPLOT3D>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2104       break;
2105     }
2106     UpdateObjBrowser(this);
2107   }
2108 }
2109
2110 //----------------------------------------------------------------------------
2111 void
2112 VisuGUI
2113 ::OnToggleSelectionPanel()
2114 {
2115   if (GetActiveViewWindow<SVTK_ViewWindow>(this))
2116   {
2117     if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2118     {
2119       if( VisuGUI_SelectionPanel* aSelectionPanel =
2120           dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2121       {
2122         if( aSelectionPanel->isVisible() )
2123           aSelectionPanel->hide();
2124         else
2125           aSelectionPanel->show();
2126       }
2127     }
2128   }
2129   else
2130     SUIT_MessageBox::warning(GetDesktop(this),
2131                              tr("WRN_VISU"),
2132                              tr("ERR_ACTIVATE_VIEW3D") );
2133 }
2134
2135 //----------------------------------------------------------------------------
2136 void
2137 VisuGUI
2138 ::OnSwitchSelectionMode()
2139 {
2140   QAction* anAction = dynamic_cast<QAction*>( sender() );
2141   if( !anAction )
2142     return;
2143
2144   bool isAnyChecked = false;
2145   for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2146   {
2147     QAction* aRefAction = action( anId );
2148     isAnyChecked |= aRefAction->isChecked();
2149     if( anAction != aRefAction )
2150       aRefAction->setChecked( false );
2151     else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2152     {
2153       if( VisuGUI_SelectionPanel* aSelectionPanel =
2154           dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2155         aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
2156     }
2157   }
2158   // At least one action must be checked
2159   if( !isAnyChecked )
2160     anAction->setChecked( true );
2161 }
2162
2163 //----------------------------------------------------------------------------
2164 void
2165 VisuGUI
2166 ::OnSwitchSelectionMode( int theId )
2167 {
2168   for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2169   {
2170     QAction* aRefAction = action( anId );
2171     aRefAction->setChecked( anId == VISU_ACTOR_SELECTION + theId );
2172   }
2173 }
2174
2175 //----------------------------------------------------------------------------
2176 void
2177 VisuGUI
2178 ::OnMergeScalarBars()
2179 {
2180   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2181   SALOME_ListIO aListIO;
2182   aSelectionMgr->selectedObjects(aListIO);
2183
2184   SALOME_ListIteratorOfListIO It (aListIO);
2185
2186   // first find the bounds
2187   double aMin, aMax; bool first = true;
2188   for (; It.More(); It.Next()) {
2189     Handle(SALOME_InteractiveObject)& anIO = It.Value();
2190     std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2191     if (!aPrsList.empty()) {
2192       for (int i = 0, n = aPrsList.size(); i < n; i++) {
2193         VISU::Prs3d_i* aPrsObject = aPrsList[i];
2194         if (aPrsObject) {
2195           VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2196           if (aScalar) {
2197             if (first) {
2198               first = false;
2199               aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
2200             } else {
2201               if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
2202               if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
2203             }
2204           }
2205         }
2206       }
2207     }
2208   }
2209
2210   // set the computed range to every selected ScalarMap
2211   bool update = false;
2212   for (It.Initialize(aListIO); It.More(); It.Next() ) {
2213     Handle(SALOME_InteractiveObject)& anIO = It.Value();
2214     std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2215     if (!aPrsList.empty()) {
2216       for (int i = 0, n = aPrsList.size(); i < n; i++) {
2217         VISU::Prs3d_i* aPrsObject = aPrsList[i];
2218         if(aPrsObject){
2219           VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2220           if (aScalar) {
2221             aScalar->SetRange(aMin, aMax);
2222             RecreateActor(this, aScalar);
2223             update = true;
2224           }
2225         }
2226       }
2227     }
2228   }
2229   if (update) {
2230     if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2231       vw->getRenderer()->ResetCameraClippingRange();
2232       vw->Repaint();
2233     }
2234   }
2235 }
2236
2237 //----------------------------------------------------------------------------
2238 void
2239 VisuGUI
2240 ::OnFreeScalarBars()
2241 {
2242   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2243   SALOME_ListIO aListIO;
2244   aSelectionMgr->selectedObjects(aListIO);
2245
2246   SALOME_ListIteratorOfListIO It (aListIO);
2247
2248   // restore the source range for every ScalarMap
2249   bool update = false;
2250   for (; It.More(); It.Next()) {
2251     Handle(SALOME_InteractiveObject)& anIO = It.Value();
2252     std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2253     if (!aPrsList.empty()) {
2254       for (int i = 0, n = aPrsList.size(); i < n; i++) {
2255         VISU::Prs3d_i* aPrsObject = aPrsList[i];
2256         if (aPrsObject) {
2257           VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2258           if (aScalar) {
2259             aScalar->SetSourceRange();
2260             RecreateActor(this, aScalar);
2261             update = true;
2262           }
2263         }
2264       }
2265     }
2266   }
2267   if (update) {
2268     if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2269       vw->getRenderer()->ResetCameraClippingRange();
2270       vw->Repaint();
2271     }
2272   }
2273 }
2274
2275 //----------------------------------------------------------------------------
2276 void
2277 VisuGUI
2278 ::OnTranslatePrs()
2279 {
2280   if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
2281   VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
2282   aDlg->exec();
2283 }
2284
2285 void
2286 VisuGUI
2287 ::OnArrangeActors()
2288 {
2289   if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
2290     ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), this, aViewWindow);
2291     aDlg->exec();
2292     delete aDlg;
2293   }
2294 }
2295
2296
2297 void
2298 VisuGUI
2299 ::initialize( CAM_Application* theApp )
2300 {
2301   SalomeApp_Module::initialize( theApp );
2302
2303   mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() );
2304
2305   mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() );
2306
2307   createActions();
2308   createMenus();
2309   createToolBars();
2310   createPopupMenus();
2311   createPanels();
2312
2313   // tmp
2314   action( VISU_ACTOR_SELECTION )->setChecked( true );
2315 }
2316
2317 void
2318 VisuGUI
2319 ::createActions()
2320 {
2321   QPixmap aPixmap;
2322   QWidget* aParent = application()->desktop();
2323   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2324
2325   // Create actions
2326
2327   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED"));
2328   createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIcon(aPixmap),
2329                 tr("MEN_IMPORT_FROM_FILE"), "", (Qt::CTRL + Qt::Key_I), aParent, false,
2330                 this, SLOT(OnImportFromFile()));
2331
2332   createAction( VISU_IMPORT_TABLE, "", QIcon(),
2333                 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
2334                 this, SLOT(OnImportTableFromFile()));
2335
2336   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
2337   createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIcon(aPixmap),
2338                 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
2339                 this, SLOT(OnCreateScalarMap()));
2340
2341   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
2342   createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIcon(aPixmap),
2343                 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
2344                 this, SLOT(OnCreateDeformedShape()));
2345
2346   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
2347   createAction( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), QIcon(aPixmap),
2348                 tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), "", 0, aParent, false,
2349                 this, SLOT(OnCreateDeformedShapeAndScalarMap()));
2350
2351   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
2352   createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIcon(aPixmap),
2353                 tr("MEN_VECTORS"), "", 0, aParent, false,
2354                 this, SLOT(OnCreateVectors()));
2355
2356   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
2357   createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIcon(aPixmap),
2358                 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
2359                 this, SLOT(OnCreateIsoSurfaces()));
2360
2361   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
2362   createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIcon(aPixmap),
2363                 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
2364                 this, SLOT(OnCreateCutPlanes()));
2365
2366   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
2367   createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIcon(aPixmap),
2368                 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
2369                 this, SLOT(OnCreateStreamLines()));
2370
2371   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
2372   createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIcon(aPixmap),
2373                 tr("MEN_CUT_LINES"), "", 0, aParent, false,
2374                 this, SLOT(OnCreateCutLines()));
2375
2376   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2377   createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIcon(aPixmap),
2378                 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2379                 this, SLOT(OnCreatePlot3D()));
2380
2381   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2382   createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIcon(aPixmap),
2383                 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2384                 this, SLOT(OnCreatePlot2dView()));
2385
2386   createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIcon(),
2387                 tr("MEN_DELETE_OBJS"), "", Qt::Key_Delete, aParent, false,
2388                 this, SLOT(OnDeleteObjects()));
2389
2390   createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIcon(),
2391                 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2392                 this, SLOT(OnShowTable()));
2393
2394   createAction( VISU_EDIT_POINTMAP3D, tr("MEN_EDIT_PRS"), QIcon(),
2395                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2396                 this, SLOT(OnShowTablePlot()));
2397
2398   createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIcon(),
2399                 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2400                 this, SLOT(OnPlotData()));
2401
2402   createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIcon(),
2403                 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2404                 this, SLOT(OnExportTableToFile()));
2405
2406   createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIcon(),
2407                 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2408                 this, SLOT(OnImportMedField()));
2409
2410   createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIcon(),
2411                 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2412                 this, SLOT(OnImportMedField()));
2413
2414   createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIcon(),
2415                 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2416                 this, SLOT(OnImportMedField()));
2417
2418   createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIcon(),
2419                 tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
2420                 this, SLOT(OnLoadComponentData()));
2421
2422   createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIcon(),
2423                 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2424                 this, SLOT(OnCreateMesh()));
2425
2426   createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIcon(),
2427                 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2428                 this, SLOT(OnCreateManyMesh()));
2429
2430   createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIcon(),
2431                 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2432                 this, SLOT(OnTranslatePrs()));
2433
2434   createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIcon(),
2435                 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2436                 this, SLOT(OnMergeScalarBars()));
2437
2438   createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIcon(),
2439                 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2440                 this, SLOT(OnFreeScalarBars()));
2441
2442   createAction( VISU_ERASE, tr("MEN_HIDE"), QIcon(),
2443                 tr("MEN_HIDE"), "", 0, aParent, false,
2444                 this, SLOT(OnErasePrs()));
2445
2446   createAction( VISU_DISPLAY, tr("MEN_SHOW"), QIcon(),
2447                 tr("MEN_SHOW"), "", 0, aParent, false,
2448                 this, SLOT(OnDisplayPrs()));
2449
2450   createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIcon(),
2451                 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2452                 this, SLOT(OnDisplayOnlyPrs()));
2453
2454   createAction( VISU_SHOW_SCALAR_BAR, tr("MEN_SHOW_SCALAR_BAR"), QIcon(),
2455                 tr("MEN_SHOW_SCALAR_BAR"), "", 0, aParent, false,
2456                 this, SLOT(OnShowScalarBar()));
2457
2458   createAction( VISU_HIDE_SCALAR_BAR, tr("MEN_HIDE_SCALAR_BAR"), QIcon(),
2459                 tr("MEN_HIDE_SCALAR_BAR"), "", 0, aParent, false,
2460                 this, SLOT(OnHideScalarBar()));
2461
2462   createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIcon(),
2463                 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2464                 this, SLOT(OnCopyPresentation()));
2465
2466   createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIcon(),
2467                 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2468                 this, SLOT(OnCurveProperties()));
2469
2470   createAction( VISU_RENAME, tr("MEN_RENAME"), QIcon(),
2471                 tr("MEN_RENAME"), "", Qt::Key_F2, aParent, false,
2472                 this, SLOT(OnRename()));
2473
2474   createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(),
2475                 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2476                 this, SLOT(OnEditContainer()));
2477
2478   createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIcon(),
2479                 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2480                 this, SLOT(OnClearContainer()));
2481
2482   createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2483                 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2484                 this, SLOT(OnSaveViewParams()));
2485   createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2486                 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2487                 this, SLOT(OnSaveViewParams()));
2488
2489   createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIcon(),
2490                 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2491                 this, SLOT(OnRestoreViewParams()));
2492
2493   //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIcon(),
2494   //              tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2495   //              this, SLOT(OnDeleteObjects()));
2496
2497   createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIcon(),
2498                 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2499                 this, SLOT(OnArrangeActors()));
2500
2501   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2502   createAction( VISU_POINTS, tr("MEN_POINTS"), QIcon(aPixmap),
2503                 tr("MEN_POINTS"), "", 0, aParent, false,
2504                 this, SLOT(OnMakePoints()));
2505
2506   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2507   createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIcon(aPixmap),
2508                 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2509                 this, SLOT(OnMakeWireframe()));
2510
2511   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2512   createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIcon(aPixmap),
2513                 tr("MEN_SURFACE"), "", 0, aParent, false,
2514                 this, SLOT(OnMakeSurface()));
2515
2516   createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIcon(),
2517                 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2518                 this, SLOT(OnMakeInsideframe()));
2519
2520   createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIcon(),
2521                 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2522                 this, SLOT(OnMakeSurfaceframe()));
2523
2524   createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIcon(),
2525                 tr("MEN_SHRINK"), "", 0, aParent, false,
2526                 this, SLOT(OnMakeShrink()));
2527
2528   createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIcon(),
2529                 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2530                 this, SLOT(OnMakeShrink()));
2531
2532   createAction( VISU_FEATURE_EDGES, tr("MEN_FEATURE_EDGES"), QIcon(),
2533                 tr("MEN_FEATURE_EDGES"), "", 0, aParent, false,
2534                 this, SLOT(OnMakeFeatureEdges()));
2535
2536   createAction( VISU_SHADING, tr("MEN_SHADING"), QIcon(),
2537                 tr("MEN_SHADING"), "", 0, aParent, false,
2538                 this, SLOT(OnSetShadingOn()));
2539
2540   createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIcon(),
2541                 tr("MEN_NOSHADING"), "", 0, aParent, false,
2542                 this, SLOT(OnSetShadingOff()));
2543
2544   createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIcon(),
2545                 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2546                 this, SLOT(OnChangeColor()));
2547
2548   createAction( VISU_COLOR, tr("MEN_COLOR"), QIcon(),
2549                 tr("MEN_COLOR"), "", 0, aParent, false,
2550                 this, SLOT(OnChangeColor()));
2551
2552   createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIcon(),
2553                 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2554                 this, SLOT(OnChangeWireframeColor()));
2555
2556   createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIcon(),
2557                 tr("MEN_OPACITY"), "", 0, aParent, false,
2558                 this, SLOT(OnChangeOpacity()));
2559
2560   createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIcon(),
2561                 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2562                 this, SLOT(OnChangeLines()));
2563
2564
2565   createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2566                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2567                 this, SLOT(OnEditScalarMap()));
2568
2569   createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIcon(),
2570                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2571                 this, SLOT(OnEditDeformedShape()));
2572
2573   createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIcon(),
2574                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2575                 this, SLOT(OnEditCutPlanes()));
2576
2577   createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIcon(),
2578                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2579                 this, SLOT(OnEditCutLines()));
2580
2581   createAction( VISU_EDIT_ISOSURFACES, tr("MEN_EDIT_PRS"), QIcon(),
2582                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2583                 this, SLOT(OnEditIsoSurfaces()));
2584
2585   createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIcon(),
2586                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2587                 this, SLOT(OnEditVectors()));
2588
2589   createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIcon(),
2590                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2591                 this, SLOT(OnEditStreamLines()));
2592
2593   createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIcon(),
2594                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2595                 this, SLOT(OnEditPlot3D()));
2596
2597   createAction( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2598                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2599                 this, SLOT(OnEditDeformedShapeAndScalarMap()));
2600
2601   createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIcon(),
2602                 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2603                 this, SLOT(OnCreateTable()));
2604
2605   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP_PANEL"));
2606   createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIcon(aPixmap),
2607                 tr("MEN_SWEEP"), "", 0, aParent, false,
2608                 this, SLOT(OnSweep()));
2609
2610   createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIcon(),
2611                 tr("MEN_CLIPPING"), "", 0, aParent, false,
2612                 this, SLOT(OnClippingPlanes()));
2613
2614   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2615   createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIcon(aPixmap),
2616                 tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false,
2617                 this, SLOT(OnParallelTimeAnimation()));
2618
2619   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2620   createAction( VISU_SUCCCESSIVEANIMATION, tr("MEN_SUCCCESSIVE_ANIMATION"), QIcon(aPixmap),
2621                 tr("MEN_SUCCCESSIVE_ANIMATION"), "", 0, aParent, false,
2622                 this, SLOT(OnSucccessiveTimeAnimation()));
2623
2624   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2625   createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIcon(aPixmap),
2626                 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2627                 this, SLOT(OnEraseAll()));
2628
2629   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL"));
2630   createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap),
2631                 tr("MEN_SELECTION_PANEL"), "", 0, aParent, false,
2632                 this, SLOT(OnToggleSelectionPanel()));
2633
2634   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION"));
2635   createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap),
2636                 tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true,
2637                 this, SLOT(OnSwitchSelectionMode()));
2638
2639   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION"));
2640   createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap),
2641                 tr("MEN_CELL_SELECTION"), "", 0, aParent, true,
2642                 this, SLOT(OnSwitchSelectionMode()));
2643
2644   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION"));
2645   createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap),
2646                 tr("MEN_POINT_SELECTION"), "", 0, aParent, true,
2647                 this, SLOT(OnSwitchSelectionMode()));
2648
2649   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION"));
2650   createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap),
2651                 tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
2652                 this, SLOT(OnSwitchSelectionMode()));
2653
2654   // Defenition of the actions for the "Navigation" tool bar
2655   registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
2656   registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
2657
2658   createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(),
2659                 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2660                 this, SLOT(OnShowAnimation()));
2661
2662   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2663   createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIcon(aPixmap),
2664                 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
2665                 this, SLOT(OnPlot3dFromCutPlane()));
2666
2667   createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(),
2668                 tr("MEN_MANAGE_CACHE"), "", 0, aParent, false,
2669                 this, SLOT( OnManageCache() ) );
2670
2671   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
2672   createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap),
2673                 tr("MEN_MULTIPR_VIEW_FULL_RES"), "", 0, aParent, false,
2674                 this, SLOT(OnMultiprViewFullRes()));
2675
2676   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_MEDIUM"));
2677   createAction( VISU_MULTIPR_MED_RES, tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), QIcon(aPixmap),
2678                 tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), "", 0, aParent, false,
2679                 this, SLOT(OnMultiprViewMediumRes()));
2680
2681   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_LOW"));
2682   createAction( VISU_MULTIPR_LOW_RES, tr("MEN_MULTIPR_VIEW_LOW_RES"), QIcon(aPixmap),
2683                 tr("MEN_MULTIPR_VIEW_LOW_RES"), "", 0, aParent, false,
2684                 this, SLOT(OnMultiprViewLowRes()));
2685
2686   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_HIDE"));
2687   createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIcon(aPixmap),
2688                 tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
2689                 this, SLOT(OnMultiprViewHide()));
2690
2691   createAction( VISU_FILE_INFO, tr("MEN_FILE_INFO"), QIcon(),
2692                 tr("MEN_FILE_INFO"), "", 0, aParent, false,
2693                 this, SLOT(OnFileInfo()));
2694
2695   createAction( VISU_EXPORT_MED, tr("MEN_EXPORT_MED"), QIcon(),
2696                 tr("MEN_EXPORT_MED"), "", 0, aParent, false,
2697                 this, SLOT(OnExportMED()));
2698
2699   createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
2700                 tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
2701                 this, SLOT(OnFilterScalars()));
2702                 
2703   createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(),
2704                 tr("MEN_VALUES_LABELING"), "", 0, aParent, true,
2705                 this, SLOT(OnValuesLabeling())); 
2706
2707   createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(),
2708                 tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
2709                 this, SLOT(OnValuesLabelingParams())); 
2710
2711 }
2712
2713 void
2714 VisuGUI
2715 ::createMenus()
2716 {
2717   // Add actions to menus
2718   int aMenuId;
2719   aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
2720   createMenu( separator(), aMenuId, -1, 10 );
2721
2722   int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
2723   createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
2724   createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
2725
2726   aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2727   createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2728   createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2729   createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2730   createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2731   createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2732   createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2733   createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2734   createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
2735   createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
2736
2737   aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2738   int parentId =
2739     createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2740   createMenu( VISU_POINTS, parentId, 10 ); //   points
2741   createMenu( VISU_WIREFRAME, parentId, 10 ); //   wireframe
2742   createMenu( VISU_SURFACE, parentId, 10 ); //   surface
2743   createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2744 }
2745
2746 void
2747 VisuGUI
2748 ::createToolBars()
2749 {
2750   int aToolId = createTool( tr("TOOL_IMPORT") );
2751   createTool( VISU_IMPORT_FROM_FILE, aToolId );
2752
2753   aToolId = createTool(tr("TOOL_VISUALISATION"));
2754   createTool( VISU_SCALAR_MAP, aToolId );
2755   createTool( VISU_DEFORMED_SHAPE, aToolId );
2756   createTool( VISU_VECTORS, aToolId );
2757   createTool( VISU_ISO_SURFACES, aToolId );
2758   createTool( VISU_CUT_PLANES, aToolId );
2759   createTool( VISU_CUT_LINES, aToolId );
2760   createTool( VISU_STREAM_LINES, aToolId );
2761   createTool( VISU_PLOT_3D, aToolId );
2762   createTool( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aToolId );
2763
2764   aToolId = createTool(tr("TOOL_REPRESENTATION"));
2765   createTool( VISU_POINTS, aToolId );
2766   createTool( VISU_WIREFRAME, aToolId );
2767   createTool( VISU_SURFACE, aToolId );
2768   createTool( VISU_ERASE_ALL, aToolId );
2769
2770   aToolId = createTool(tr("TOOL_SELECTION"));
2771   createTool( VISU_SELECTION_PANEL, aToolId );
2772   createTool( separator(), aToolId );
2773   createTool( VISU_ACTOR_SELECTION, aToolId );
2774   createTool( VISU_CELL_SELECTION, aToolId );
2775   createTool( VISU_POINT_SELECTION, aToolId );
2776   createTool( VISU_GAUSS_POINT_SELECTION, aToolId );
2777
2778   aToolId = createTool( tr( "TOOL_NAVIGATION" ) );
2779   createTool( VISU_SLIDER_PANEL, aToolId );
2780   createTool( separator(), aToolId );
2781   createTool( VISU_SWEEP_PANEL, aToolId );
2782 }
2783
2784 void
2785 VisuGUI
2786 ::createPopupMenus()
2787 {
2788   // Prepare popup menus
2789   QtxPopupMgr* mgr = popupMgr();
2790
2791   // VISU root commands
2792   mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
2793   mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
2794   mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
2795
2796   //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
2797
2798   // create
2799   mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2800   mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2801   mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2802   mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2803   mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2804   mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2805   mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2806   mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
2807   mgr->insert( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), -1, -1, -1 ); // scalar map on deformed shape
2808
2809   mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2810   mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
2811
2812   mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
2813
2814   // edit
2815   mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
2816   mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
2817   mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
2818   mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
2819   mgr->insert( action( VISU_EDIT_ISOSURFACES ), -1, -1, -1 );
2820   mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
2821   mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
2822   mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
2823   mgr->insert( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ), -1, -1, -1 );
2824   mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
2825   mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 );
2826
2827   mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 );
2828
2829   // rename
2830   mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
2831
2832   // copy
2833   mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
2834
2835   // delete
2836   mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
2837   
2838   // labeling
2839   mgr->insert( separator(), -1, -1, -1 );
2840   mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 );
2841   mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 );
2842   mgr->insert( separator(), -1, -1, -1 );
2843
2844   // table commands
2845   mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
2846   mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
2847   mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
2848
2849   mgr->insert( separator(), -1, -1, -1 );
2850
2851   mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
2852   mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
2853   mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
2854
2855   mgr->insert( action( VISU_HIDE_SCALAR_BAR ), -1, -1, -1 ); // hide scalar bar
2856   mgr->insert( action( VISU_SHOW_SCALAR_BAR ), -1, -1, -1 ); // show scalar bar
2857
2858   // "Representation" submenu
2859   int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
2860   mgr->insert( action( VISU_POINTS )      , parentId, -1, -1 ); // points
2861   mgr->insert( action( VISU_WIREFRAME )   , parentId, -1, -1 ); // wireframe
2862   mgr->insert( action( VISU_SURFACE )     , parentId, -1, -1 ); // surface
2863   mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
2864   mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
2865   mgr->insert( action( VISU_FEATURE_EDGES ), parentId, -1, -1 ); // feature edges
2866   mgr->insert( action( VISU_SHRINK )      , parentId, -1, -1 ); // shrink
2867   mgr->insert( action( VISU_UNSHRINK )    , parentId, -1, -1 ); // unshrink
2868   mgr->insert( separator(), parentId, -1, -1 );
2869   mgr->insert( action( VISU_SHADING )     , parentId, -1, -1 ); // shading
2870   mgr->insert( action( VISU_NOSHADING )   , parentId, -1, -1 ); // noshading
2871
2872   // "Properties" submenu
2873   parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
2874   mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
2875   mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
2876   mgr->insert( action( VISU_COLOR )     , parentId, -1, -1 ); // color
2877   mgr->insert( action( VISU_OPACITY )   , parentId, -1, -1 ); // opacity
2878   mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
2879
2880   mgr->insert( separator(), -1, -1, -1 );
2881
2882   // Other presentations management
2883   mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
2884   mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
2885
2886   mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
2887   mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
2888
2889   mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
2890   mgr->insert( action( VISU_PARALLELANIMATION ), -1, -1, -1 );
2891   mgr->insert( action( VISU_SUCCCESSIVEANIMATION ), -1, -1, -1 );
2892
2893   mgr->insert( separator(), -1, -1, -1 );
2894
2895   // view parameters commands
2896   mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
2897   mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
2898   mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
2899   //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
2900
2901   mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
2902
2903   mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
2904
2905   mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
2906   mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
2907   mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
2908   mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
2909
2910   mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 );
2911   mgr->insert( action( VISU_EXPORT_MED ), -1, -1, -1 );
2912
2913   // Rules
2914
2915   QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2916                    "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
2917                    "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
2918   QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2919                          "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
2920                          "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
2921
2922   // VISU root commands
2923   QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
2924   mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule );
2925   mgr->setRule( action( VISU_IMPORT_TABLE ), aRule );
2926   mgr->setRule( action( VISU_PLOT2D ), aRule );
2927
2928   // timestamp commands
2929   aRule = "client='ObjectBrowser' and selcount=1 and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'}";
2930   mgr->setRule( action( VISU_SCALAR_MAP ), aRule );
2931   mgr->setRule( action( VISU_ISO_SURFACES ), aRule );
2932   mgr->setRule( action( VISU_CUT_PLANES ), aRule );
2933   mgr->setRule( action( VISU_CUT_LINES ), aRule );
2934   mgr->setRule( action( VISU_PLOT_3D ), aRule );
2935   aRule += " and nbComponents>1";
2936   mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule );
2937   mgr->setRule( action( VISU_VECTORS ), aRule );
2938   mgr->setRule( action( VISU_STREAM_LINES ), aRule );
2939   mgr->setRule( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), aRule );
2940
2941   // display/erase commands
2942   QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
2943   QString aTableOrContHide = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreVisibleCurves)";
2944   QString aTableOrContShow = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreHiddenCurves)";
2945   QString orCurveVisible   = "or (type='VISU::TCURVE' and isVisible)";
2946   QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
2947   QString aPrsVisible   = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}) and isVisible and (not isPlot2dViewer))";
2948   QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
2949   QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
2950
2951   QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible +
2952     " or (client='ObjectBrowser' and (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
2953
2954   QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible +
2955     " or (client='ObjectBrowser' and (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
2956
2957   QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "})"
2958     " or (client='ObjectBrowser' and ((type='VISU::TTABLE' and nbChildren>0) or"
2959     " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'})))) ) or" + aComponent;
2960
2961   QString aScalarBarHideRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}) and isScalarMapAct=1 and " + aPrsVisible + " and isScalarBarVisible )";
2962   QString aScalarBarShowRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}) and isScalarMapAct=1 and " + aPrsVisible + " and (not isScalarBarVisible) )";
2963
2964   mgr->setRule( action( VISU_ERASE ), anEraseRule );
2965   mgr->setRule( action( VISU_DISPLAY ), aDisplayRule );
2966   mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule );
2967
2968   mgr->setRule( action( VISU_HIDE_SCALAR_BAR ), aScalarBarHideRule );
2969   mgr->setRule( action( VISU_SHOW_SCALAR_BAR ), aScalarBarShowRule );
2970
2971   aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}";
2972   mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule );
2973
2974   aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2975   mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule );
2976   mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule );
2977
2978   aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
2979   mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
2980   
2981   // labeling
2982
2983   aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'"  + aPrsAll + " }";
2984   mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule );
2985   mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
2986   mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
2987
2988   // view parameters
2989   aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
2990   mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule );
2991   mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'" );
2992   mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'" );
2993   //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2994
2995   mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'SVTK'} and selcount=0" );
2996
2997   // 3D presentations commands
2998   QString aPrsType    = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
2999   QString aPrsType2    = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
3000   QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3001   //QString aSurfFrameType   = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3002   QString aSurfFrameType   = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCUTPLANES' 'VISU::TISOSURFACES' 'VISU::TPLOT3D' }";
3003   //QString aPrsType    = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3004   QString aSurfType   = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3005                         " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3006   QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3007   QString aLineType   = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
3008                         "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3009
3010   QString aFeatureEdgesType =  " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
3011
3012   aRule = "selcount=1";
3013   mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
3014   aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3015
3016   // "Representation" submenu
3017   QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3018   QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3019   QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3020   QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3021   QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}";
3022   QString aNotFeatureEdges =  " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
3023
3024   mgr->setRule( action( VISU_POINTS )      , aRule + aPrsType + aNotPoints );
3025   mgr->setRule( action( VISU_WIREFRAME )   , aRule + aPrsType2 + aNotWirefr );
3026   mgr->setRule( action( VISU_SURFACE )     , aRule + aSurfType + aNotSurfac );
3027   mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside );
3028   mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr );
3029   mgr->setRule( action( VISU_FEATURE_EDGES ), aRule + aFeatureEdgesType + aNotFeatureEdges );
3030
3031   mgr->setRule( action( VISU_SHRINK )  , aRule + aShrinkType + " and isShrunk=0" );
3032   mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1" );
3033
3034   mgr->setRule( action( VISU_SHADING )  , aRule + " and isScalarMapAct=1 and isShading=0" );
3035   mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1" );
3036
3037   // "Properties" submenu
3038   mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3039   mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3040   mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
3041                " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
3042                "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" );
3043   mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" );
3044   mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1" );
3045
3046   // rename command
3047   QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
3048
3049   aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TMESH' 'VISU::TPOINTMAP3D' " + aCurveAll + " " + aPrsAll + "})";
3050   mgr->setRule( action( VISU_RENAME ), aRule );
3051
3052   // copy presentation command
3053   aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
3054   mgr->setRule( action( VISU_COPY_PRS ), aRule );
3055
3056   // Curve commands
3057   aRule = "selcount=1 and type='VISU::TCURVE'";
3058   mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
3059
3060   // Table Commands
3061   aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";
3062   mgr->setRule( action( VISU_SHOW_TABLE ), aRule );
3063   mgr->setRule( action( VISU_CREATE_CURVES ), aRule );
3064   mgr->setRule( action( VISU_EXPORT_TABLE ), aRule );
3065
3066   // curve container commands
3067   aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
3068   mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule );
3069   mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule );
3070
3071   mgr->setRule( action( VISU_EDIT_SCALARMAP ),
3072                 "selcount=1 and type='VISU::TSCALARMAP'" );
3073   mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
3074                 "selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
3075   mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ),
3076                 "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
3077   mgr->setRule( action( VISU_EDIT_CUTPLANES ),
3078                 "selcount=1 and type='VISU::TCUTPLANES'" );
3079   mgr->setRule( action( VISU_EDIT_CUTLINES ),
3080                 "selcount=1 and type='VISU::TCUTLINES'" );
3081   mgr->setRule( action( VISU_EDIT_ISOSURFACES ),
3082                 "selcount=1 and type='VISU::TISOSURFACES'" );
3083   mgr->setRule( action( VISU_EDIT_VECTORS ),
3084                 "selcount=1 and type='VISU::TVECTORS'" );
3085   mgr->setRule( action( VISU_EDIT_STREAMLINES ),
3086                 "selcount=1 and type='VISU::TSTREAMLINES'" );
3087   mgr->setRule( action( VISU_EDIT_PLOT3D ),
3088                 "selcount=1 and type='VISU::TPLOT3D'" );
3089   mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
3090                 "selcount=1 and type='VISU::TPOINTMAP3D'" );
3091
3092   aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
3093   mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
3094
3095   aRule = "selcount=1 and ($type in {" + aSimplePrsAll + "})";
3096   mgr->setRule( action( VISU_SWEEP ), aRule );
3097
3098   aRule = "client='ObjectBrowser' and selcount>0";
3099   aRule += " and $type in {'VISU::TFIELD'}";
3100   aRule += " and nbTimeStamps>1";
3101   aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3102   mgr->setRule( action( VISU_PARALLELANIMATION ), aRule );
3103
3104   aRule = "client='ObjectBrowser'";
3105   aRule += " and (selcount=1 and nbTimeStamps>1 or selcount>1 and nbTimeStamps>0)";
3106   aRule += " and $type in {'VISU::TFIELD'}";
3107   aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3108   mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule );
3109
3110   aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
3111   mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1" );
3112   mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1" );
3113   mgr->setRule( action( VISU_EDIT_PLOT3D ),
3114                 "selcount=1 and type='VISU::TPLOT3D'" );
3115
3116   //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
3117   //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
3118
3119   aRule = "client='ObjectBrowser' and selcount>=1 and $type in {'VISU::TPART'} and ";
3120   {
3121     QString aCustomRule = aRule + "fullResolution=1 and resolutionState!='F'";
3122     mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aCustomRule );
3123   }
3124   {
3125     QString aCustomRule = aRule + "mediumResolution=1 and resolutionState!='M'";
3126     mgr->setRule( action( VISU_MULTIPR_MED_RES ), aCustomRule );
3127   }
3128   {
3129     QString aCustomRule = aRule + "lowResolution=1 and resolutionState!='L'";
3130     mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aCustomRule );
3131   }
3132   {
3133     QString aCustomRule = aRule + "resolutionState!='H'";
3134     mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule );
3135   }
3136
3137   mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
3138   mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
3139 }
3140
3141 void VisuGUI::createPanels()
3142 {
3143   myPanels.insert( SelectionPanelId,    new VisuGUI_SelectionPanel( this ) );
3144   myPanels.insert( FeatureEdgesPanelId, new VisuGUI_FeatureEdgesPanel( this ) );
3145   myPanels.insert( ClippingPlanesPanelId, new VisuGUI_ClippingPanel( this ) );
3146
3147   QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end();
3148   for( ; it != itEnd; ++it )
3149   {
3150     if( VisuGUI_Panel* aPanel = it.value() )
3151     {
3152       aPanel->hide();
3153       GetDesktop(this)->addDockWidget( Qt::RightDockWidgetArea, aPanel );
3154     }
3155   }
3156 }
3157
3158 //***************************************************************************
3159 void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle )
3160 {
3161   SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
3162
3163   //TODO: object Browser DONE
3164   SUIT_DataBrowser* ob = getApp()->objectBrowser();
3165   bool isOBClient = (ob && theClient == ob->popupClientType());
3166
3167   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3168   SALOME_ListIO aListIO;
3169   aSelectionMgr->selectedObjects(aListIO);
3170
3171   if (aListIO.Extent() < 1) return;
3172
3173   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3174
3175   // Check if "Merge Scalar Range" can be applied
3176   int nbPrs = 0;
3177   SALOME_ListIteratorOfListIO It (aListIO);
3178   for (; It.More(); It.Next()) {
3179     Handle(SALOME_InteractiveObject)& anIO = It.Value();
3180
3181     if (!anIO.IsNull() && anIO->hasEntry()) {
3182       _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3183       if ( !aSObject )
3184         continue;
3185
3186       if ( !isOBClient ) {
3187         QString aName = QString( aSObject->GetName().c_str() );
3188         while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
3189           aName.remove( (aName.length() - 1), 1 );
3190         theTitle = aName;
3191       }
3192
3193       CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
3194       if (CORBA::is_nil(aCORBAObject)) {
3195         VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3196         if (aType == VISU::TTIMESTAMP) {
3197           _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
3198           _PTR(SObject) aPrs;
3199           for (; anIter->More(); anIter->Next()) {
3200             aPrs = anIter->Value();
3201             if (!aPrs)
3202               continue;
3203             std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
3204             nbPrs += aSubList.size();
3205           }
3206         }
3207       }
3208     }
3209   }
3210   if (nbPrs > 1) {
3211     theMenu->addSeparator();
3212     theMenu->addAction( action( VISU_MERGE_SCALAR_BARS ) );
3213     theMenu->addAction( action( VISU_FREE_SCALAR_BARS  ) );
3214   }
3215
3216   // Check if some curves selected (for bug PAL10611)
3217   bool isCurves = false;
3218   bool isOneCutPlane = false;
3219   SALOME_ListIteratorOfListIO It1 (aListIO);
3220   for (; It1.More() && !isCurves; It1.Next()) {
3221     Handle(SALOME_InteractiveObject)& anIO = It1.Value();
3222     if (!anIO.IsNull() && anIO->hasEntry()) {
3223       _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3224       if ( !aSObject )
3225         continue;
3226       VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3227       if (aType == VISU::TCURVE) {
3228         isCurves = true;
3229       }  else {
3230         VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
3231         if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
3232           if (aPrsObject->GetType() == VISU::TCUTPLANES) {
3233             if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
3234               isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
3235           }
3236         }
3237       }
3238     }
3239   }
3240
3241   if (isOneCutPlane)
3242     theMenu->addAction( action( VISU_PLOT3D_FROM_CUTPLANE ) );
3243
3244   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
3245   if(aSelectionInfo.empty())
3246     return;
3247
3248   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
3249   Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
3250   _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
3251   Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
3252   CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
3253
3254   if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
3255     if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
3256       theMenu->addAction( action( VISU_MANAGE_CACHE ) );
3257   }
3258
3259   theMenu->addSeparator();
3260
3261   // Check if some (nb > 0) removable objects selected
3262   if (isOBClient && IsRemovableSelected(this)) {
3263     theMenu->addAction( action( VISU_DELETE_OBJS ) );
3264   }
3265   if (isCurves) {
3266     theMenu->removeAction( action( myDisplay ) );
3267     theMenu->removeAction( action( myErase ) );
3268     theMenu->removeAction( action( myDisplayOnly ) );
3269     theMenu->removeAction( action( myEraseAll ) );
3270   }
3271
3272   // Check single selection
3273   if (aListIO.Extent() != 1)
3274     return;
3275
3276   // Check if the object's data is loaded
3277   _PTR(SComponent) aSComp = aSObject->GetFatherComponent();
3278   std::string aCompIOR;
3279   if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
3280     //std::string aCompDataType = aSComp->ComponentDataType();
3281     theMenu->addAction( action( VISU_LOAD_COMPONENT_DATA ) ); // "Load Component Data"
3282   }
3283
3284   VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
3285   if (aType == VISU::TANIMATION) {
3286     theMenu->addAction( action( VISU_SHOW_ANIMATION ) );
3287   } else if (isOBClient) {
3288     if (IsSObjectTable(aSObject)) {
3289       /*      action( VISU_SHOW_TABLE )->addTo(theMenu);
3290       theMenu->addAction( action( VISU_CREATE_CURVES ) );
3291       theMenu->addAction( action( VISU_EXPORT_TABLE ) );
3292       theMenu->addSeparator();
3293       action( VISU_DELETE_OBJS )->addTo(theMenu);*/// dmv - code was moved up
3294     } else {
3295       if (!CORBA::is_nil(anObject)) {
3296         SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
3297         if (!CORBA::is_nil(aMED.in())) {
3298           theMenu->addAction( action( VISU_IMPORT_MED_STRUCTURE ) ); // "Import Structure"
3299         }
3300
3301         SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
3302         if (!CORBA::is_nil(aField)) {
3303           theMenu->addAction( action( VISU_IMPORT_MED_TIMESTAMP ) ); // "Import TimeStamp"
3304         }
3305       } else {
3306         _PTR(SObject) aSFather1 = aSObject->GetFather();
3307         if (aSFather1) {
3308           std::string aValue = aSFather1->GetName();
3309           if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
3310             theMenu->addAction( action( VISU_IMPORT_MED_FIELD ) ); // "Import Field"
3311           }
3312         }
3313       }
3314     }
3315   }
3316 }
3317
3318
3319 //***************************************************************************
3320 void
3321 VisuGUI
3322 ::windows( QMap<int, int>& theMap ) const
3323 {
3324   theMap.clear();
3325   theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
3326   theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
3327 }
3328
3329
3330 void
3331 VisuGUI
3332 ::viewManagers( QStringList& theList ) const
3333 {
3334   theList.clear();
3335   // append SVTK viewer only if there is no opened VVTK
3336 //   SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
3337 //   if( vm && vm->getViewsCount()>0 )
3338 //     theList.append( VVTK_Viewer::Type() );
3339 //   else
3340     theList.append( SVTK_Viewer::Type() );
3341 }
3342
3343
3344 QString
3345 VisuGUI
3346 ::engineIOR() const
3347 {
3348   CORBA::String_var anIOR = GetVisuGen(this)->GetID();
3349   return QString(anIOR.in());
3350 }
3351
3352
3353 bool
3354 VisuGUI
3355 ::activateModule( SUIT_Study* theStudy )
3356 {
3357   bool aResult = SalomeApp_Module::activateModule( theStudy );
3358
3359   studyActivated();
3360   setMenuShown( true );
3361   setToolShown( true );
3362
3363   // Reset actions accelerator keys
3364   QList<QKeySequence> shortcuts;
3365   shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
3366   action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
3367
3368   action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
3369   action(VISU_RENAME     )->setEnabled(true); // Rename: Key_F2
3370
3371   ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init();
3372
3373   emit moduleActivated();
3374
3375   return aResult;
3376 }
3377
3378
3379 bool
3380 VisuGUI
3381 ::deactivateModule( SUIT_Study* theStudy )
3382 {
3383   setMenuShown( false );
3384   setToolShown( false );
3385
3386   QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end();
3387   for( ; it != itEnd; ++it )
3388   {
3389     if( VisuGUI_Panel* aPanel = it.value() )
3390       aPanel->hide();
3391   }
3392
3393   // Unset actions accelerator keys
3394   action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
3395
3396   action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
3397   action(VISU_RENAME     )->setEnabled(false); // Rename: Key_F2
3398
3399   bool aResult = SalomeApp_Module::deactivateModule( theStudy );
3400   
3401   emit moduleDeactivated();
3402
3403   return aResult;
3404 }
3405
3406 LightApp_Selection*
3407 VisuGUI
3408 ::createSelection() const
3409 {
3410   return new VisuGUI_Selection( (SalomeApp_Module*)this );
3411 }
3412
3413 //******************************************************************
3414 void VisuGUI::studyActivated()
3415 {
3416   GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
3417   
3418 }
3419
3420 /*
3421 extern "C" {
3422   CAM_Module*
3423   createModule()
3424   {
3425     return new VisuGUI();
3426   }
3427 }
3428 */
3429
3430 void VisuGUI::createPreferences()
3431 {
3432   // TAB: "MED import"
3433   int importTab = addPreference( tr( "MED import" ) );
3434   //printf( "++++++++++++++++++ Tab index %d\n", importTab );
3435
3436   //int importFrame = addPreference( tr( "MED FRAME" ), importTab );
3437   //printf( "Frame index %d\n", importFrame );
3438
3439   // group: "MED files import"
3440   int importGr = addPreference( tr( "MED files import" ), importTab );
3441   //printf( "Group index %d\n", importGr );
3442   setPreferenceProperty( importGr, "columns", 2 );
3443
3444   addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
3445   addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
3446   addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
3447   addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
3448   addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
3449   addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
3450   addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
3451
3452   // TAB: "Scalar Bar"
3453   int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
3454
3455   int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
3456   setPreferenceProperty( rangeGr, "columns", 2 );
3457
3458   int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
3459   QStringList modes;
3460   modes.append( tr( "VISU_MODULUS" ) );
3461   modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
3462   modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
3463   modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
3464   QList<QVariant> indices;
3465   indices.append( 0 );
3466   indices.append( 1 );
3467   indices.append( 2 );
3468   indices.append( 3 );
3469   setPreferenceProperty( mode, "strings", modes );
3470   setPreferenceProperty( mode, "indexes", indices );
3471
3472   int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
3473   QStringList types;
3474   types.append( tr( "VISU_FIELD_RANGE" ) );
3475   types.append( tr( "VISU_IMPOSED_RANGE" ) );
3476   indices.clear();
3477   indices.append( 0 );
3478   indices.append( 1 );
3479   setPreferenceProperty( rangetype, "strings", types );
3480   setPreferenceProperty( rangetype, "indexes", indices );
3481
3482   addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
3483
3484   int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
3485   setPreferenceProperty( imposedGr, "columns", 4 );
3486
3487   int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_min" );
3488   int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_max" );
3489   setPreferenceProperty( min, "step", 0.1 );
3490   setPreferenceProperty( max, "step", 0.1 );
3491
3492   // group: "Font"
3493   int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
3494   setPreferenceProperty( fontGr, "columns", 2 );
3495
3496   addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false );
3497   addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
3498
3499   addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false );
3500   addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
3501
3502   // group: "Colors & Labels"
3503   int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
3504   setPreferenceProperty( colorsLabelsGr, "columns", 4 );
3505
3506   int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
3507                               LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
3508   setPreferenceProperty( numcol, "min", 2 );
3509   setPreferenceProperty( numcol, "max", 256 );
3510
3511   addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr,
3512                  LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
3513
3514   int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
3515                               LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
3516   setPreferenceProperty( numlab, "min", 2 );
3517   setPreferenceProperty( numlab, "max", 65 );
3518
3519   int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr,
3520     LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" );
3521
3522   setPreferenceProperty( lPrec, "min", 1 );
3523   setPreferenceProperty( lPrec, "max", 100 );
3524   
3525   int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3526   //setPreferenceProperty( frame, "orientation", "vertical" );
3527   setPreferenceProperty( frame, "columns", "2" );
3528
3529   // group: "Orientation"
3530   int orientGr = addPreference( tr( "VISU_ORIENTATION" ), frame, LightApp_Preferences::GroupBox );
3531   setPreferenceProperty( orientGr, "columns", 2 );
3532   int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
3533                               LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
3534   QStringList orients;
3535   orients.append( tr( "VISU_VERTICAL" ) );
3536   orients.append( tr( "VISU_HORIZONTAL" ) );
3537   indices.clear();
3538   indices.append( 0 );
3539   indices.append( 1 );
3540   setPreferenceProperty( orient, "strings", orients );
3541   setPreferenceProperty( orient, "indexes", indices );
3542
3543   // group: "Scalar bars default position"
3544   int scalarBarGr = addPreference( tr( "Scalar bars default position" ), frame, LightApp_Preferences::GroupBox );
3545   addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
3546
3547
3548   // group: "Origin & Size Vertical"
3549   //int psSzFrame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3550   //setPreferenceProperty( psSzFrame, "orientation", "horizontal" );
3551   //setPreferenceProperty( psSzFrame, "columns", "2" );
3552
3553   int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ),
3554                                   frame, LightApp_Preferences::GroupBox );
3555   setPreferenceProperty( posVSizeGr, "columns", 2 );
3556   int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
3557                           LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
3558   int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
3559                           LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
3560
3561   int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
3562                           LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
3563   int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
3564                           LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
3565
3566   int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr,
3567                           LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" );
3568   
3569   int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr,
3570                           LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" );
3571   
3572   int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
3573                           LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
3574   int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
3575                           LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_height" );
3576
3577   setPreferenceProperty( xv, "step", 0.1 );
3578   setPreferenceProperty( yv, "step", 0.1 );
3579   setPreferenceProperty( wv, "step", 0.1 );
3580   setPreferenceProperty( hv, "step", 0.1 );
3581   setPreferenceProperty( xv, "min", 0.0 );
3582   setPreferenceProperty( yv, "min", 0.0 );
3583   setPreferenceProperty( wv, "min", 0.0 );
3584   setPreferenceProperty( hv, "min", 0.0 );
3585   setPreferenceProperty( twv, "min", 0 );
3586   setPreferenceProperty( twv, "special", "auto" );
3587   setPreferenceProperty( lwv, "min", 0 );
3588   setPreferenceProperty( lwv, "special", "auto" );
3589   setPreferenceProperty( bwv, "min", 0 );
3590   setPreferenceProperty( bwv, "special", "auto" );
3591   setPreferenceProperty( bhv, "min", 0 );
3592   setPreferenceProperty( bhv, "special", "auto" );
3593   setPreferenceProperty( xv, "max", 1.0 );
3594   setPreferenceProperty( yv, "max", 1.0 );
3595   setPreferenceProperty( wv, "max", 1.0 );
3596   setPreferenceProperty( hv, "max", 1.0 );
3597   setPreferenceProperty( twv, "max", 100 );
3598   setPreferenceProperty( lwv, "max", 100 );
3599   setPreferenceProperty( bwv, "max", 100 );
3600   setPreferenceProperty( bhv, "max", 100 );
3601
3602   // group: "Origin & Size Horizontal"
3603   int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ),
3604                                   frame, LightApp_Preferences::GroupBox );
3605   setPreferenceProperty( posHSizeGr, "columns", 2 );
3606
3607   int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
3608                           LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
3609   int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
3610                           LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
3611
3612   int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
3613                           LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
3614   int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
3615                           LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
3616
3617   int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr,
3618                           LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" );
3619   
3620   int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr,
3621                           LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" );
3622   
3623   int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr,
3624                           LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
3625   int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr,
3626                           LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
3627
3628   setPreferenceProperty( xh, "step", 0.1 );
3629   setPreferenceProperty( yh, "step", 0.1 );
3630   setPreferenceProperty( wh, "step", 0.1 );
3631   setPreferenceProperty( hh, "step", 0.1 );
3632   setPreferenceProperty( xh, "min", 0.0 );
3633   setPreferenceProperty( yh, "min", 0.0 );
3634   setPreferenceProperty( wh, "min", 0.0 );
3635   setPreferenceProperty( hh, "min", 0.0 );
3636   setPreferenceProperty( twh, "min", 0 );
3637   setPreferenceProperty( twh, "special", "auto" );
3638   setPreferenceProperty( lwh, "min", 0 );
3639   setPreferenceProperty( lwh, "special", "auto" );
3640   setPreferenceProperty( bwh, "min", 0 );
3641   setPreferenceProperty( bwh, "special", "auto" );
3642   setPreferenceProperty( bhh, "min", 0 );
3643   setPreferenceProperty( bhh, "special", "auto" );
3644   setPreferenceProperty( xh, "max", 1.0 );
3645   setPreferenceProperty( yh, "max", 1.0 );
3646   setPreferenceProperty( wh, "max", 1.0 );
3647   setPreferenceProperty( hh, "max", 1.0 );
3648   setPreferenceProperty( twh, "max", 100 );
3649   setPreferenceProperty( lwh, "max", 100 );
3650   setPreferenceProperty( bwh, "max", 100 );
3651   setPreferenceProperty( bhh, "max", 100 );
3652
3653   // TAB: "CutLines"
3654   int cutLineTab = addPreference( tr( "CutLines" ) );
3655
3656   // group: "CutLines preferences"
3657   int cutLineGr = addPreference( tr( "VISU_CUTLINE_PREF" ), cutLineTab );
3658   setPreferenceProperty( cutLineGr, "columns", 1 );
3659   addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
3660   addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
3661   addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
3662   addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
3663   addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
3664
3665   // TAB: "Sweep, Animation, 3D Cache"
3666   int animationTab = addPreference( tr( "Sweep, Animation" ) );
3667   {
3668     // group: "3D Cache System prefereces"
3669     {
3670       int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab );
3671       setPreferenceProperty( cacheGroup, "columns", 2 );
3672       
3673       int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup,
3674                                        LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
3675       
3676       modes.clear();
3677       modes.append( tr( "VISU_MINIMAL" ) );
3678       modes.append( tr( "VISU_LIMITED" ) );
3679       setPreferenceProperty( memory_mode, "strings", modes );
3680       
3681       indices.clear();
3682       indices.append( 0 );
3683       indices.append( 1 );
3684       setPreferenceProperty( memory_mode, "indexes", indices );
3685       
3686       int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup,
3687                                         LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
3688       setPreferenceProperty( memory_limit, "min", 1 );
3689       setPreferenceProperty( memory_limit, "max", 5000 );
3690       setPreferenceProperty( memory_limit, "step", 10 );
3691     }
3692
3693     // group: "Animation preferences"
3694     {
3695       int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
3696       setPreferenceProperty( animationGroup, "columns", 3 );
3697       
3698       int speed = addPreference( tr( "Speed" ), animationGroup, LightApp_Preferences::IntSpin, "VISU", "speed" );
3699       addPreference( tr( "Cycled animation" ), animationGroup, LightApp_Preferences::Bool, "VISU", "cycled_animation" );
3700       addPreference( tr( "Use proportional timing" ), animationGroup, LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
3701       addPreference( tr( "Clean memory at each frame" ), animationGroup, LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
3702       
3703       setPreferenceProperty( speed, "min", 1 );
3704       setPreferenceProperty( speed, "max", 99 );
3705     }
3706
3707     // group: "Sweeping preferences"
3708     {
3709       int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab );
3710       setPreferenceProperty( sweepGroup, "columns", 2 );
3711       
3712       int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
3713       QStringList sweep_modes;
3714       sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
3715       sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
3716       sweep_modes.append( tr( "VISU_SIN_SWEEP" ) );
3717       indices.clear();
3718       indices.append( 0 );
3719       indices.append( 1 );
3720       indices.append( 2 );
3721       setPreferenceProperty( modeSw, "strings", sweep_modes );
3722       setPreferenceProperty( modeSw, "indexes", indices );
3723       
3724       int timestep   = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup,
3725                                       LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
3726       /*    int nbcycles   = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup,
3727             LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );*/
3728       int nbsteps    = addPreference( tr( "VISU_NB_STEPS" ),  sweepGroup,
3729                                       LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
3730       int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
3731       QStringList ranges;
3732       ranges.append( tr( "PERIOD_PI" ) );
3733       ranges.append( tr( "PERIOD_2PI" ) );
3734       indices.clear();
3735       indices.append( 0 );
3736       indices.append( 1 );
3737       setPreferenceProperty( rangeSw, "strings", ranges );
3738       setPreferenceProperty( rangeSw, "indexes", indices );
3739       
3740       setPreferenceProperty( timestep, "min",  0.1 );
3741       setPreferenceProperty( timestep, "step", 0.1 );
3742       setPreferenceProperty( timestep, "max",  1000 );
3743       //    setPreferenceProperty( nbcycles, "max",  100  );
3744       setPreferenceProperty( nbsteps,  "max",  200  );
3745     }
3746   }
3747
3748   // TAB: Representation ; group: "Representation properties"
3749   int representationTab = addPreference( tr( "Representation" ) );
3750
3751   int representGr = addPreference( tr( "VISU_REPRESENT_PROPS" ), representationTab );
3752   setPreferenceProperty( representGr, "columns", 2 );
3753
3754   QStringList mesh_modes;
3755   mesh_modes.append( "Points" );
3756   mesh_modes.append( "Wireframe" );
3757   mesh_modes.append( "Insideframe" );
3758   mesh_modes.append( "Surfaceframe" );
3759   mesh_modes.append( "Surface" );
3760   mesh_modes.append( "Feature edges" );
3761   QList<QVariant> mesh_indices;
3762   mesh_indices.append( 0 );
3763   mesh_indices.append( 1 );
3764   mesh_indices.append( 3 );
3765   mesh_indices.append( 4 );
3766   mesh_indices.append( 2 );
3767   mesh_indices.append( 5 );
3768
3769   QStringList modes0 = mesh_modes;
3770   modes0.removeAll( "Feature edges" );
3771   QList<QVariant> indices0 = mesh_indices;
3772   indices0.removeAll( 5 );
3773
3774   QStringList modes1 = modes0;
3775   modes1.removeAll( "Insideframe" );
3776   QList<QVariant> indices1 = indices0;
3777   indices1.removeAll( 3 );
3778
3779   QStringList modes2 = modes1;
3780   modes2.removeAll( "Surfaceframe" );
3781   QList<QVariant> indices2 = indices1;
3782   indices2.removeAll( 4 );
3783
3784   QStringList modes3 = modes2;
3785   modes3.removeAll( "Surface" );
3786   QList<QVariant> indices3 = indices2;
3787   indices3.removeAll( 2 );
3788
3789
3790   int mesh_represent = addPreference( tr( "VISU_MESH" ), representGr, LightApp_Preferences::Selector, "VISU", "mesh_represent" );
3791   setPreferenceProperty( mesh_represent, "strings", mesh_modes );
3792   setPreferenceProperty( mesh_represent, "indexes", mesh_indices );
3793   addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" );
3794
3795   int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" );
3796   setPreferenceProperty( scalar_map_represent, "strings", modes0 );
3797   setPreferenceProperty( scalar_map_represent, "indexes", indices0 );
3798   addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" );
3799
3800   int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" );
3801   setPreferenceProperty( iso_surfaces_represent, "strings", modes2 );
3802   setPreferenceProperty( iso_surfaces_represent, "indexes", indices2 );
3803   int sp = addPreference( "", representGr, LightApp_Preferences::Space );
3804   setPreferenceProperty( sp, "hstretch", 0 );
3805   setPreferenceProperty( sp, "vstretch", 0 );
3806
3807   int cut_planes_represent = addPreference( tr( "VISU_CUT_PLANES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_planes_represent" );
3808   setPreferenceProperty( cut_planes_represent, "strings", modes2 );
3809   setPreferenceProperty( cut_planes_represent, "indexes", indices2 );
3810   addPreference( "", representGr, LightApp_Preferences::Space );
3811
3812   int cut_lines_represent = addPreference( tr( "VISU_CUT_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_lines_represent" );
3813   setPreferenceProperty( cut_lines_represent, "strings", modes3 );
3814   setPreferenceProperty( cut_lines_represent, "indexes", indices3 );
3815   sp = addPreference( "", representGr, LightApp_Preferences::Space );
3816   setPreferenceProperty( sp, "hstretch", 0 );
3817   setPreferenceProperty( sp, "vstretch", 0 );
3818
3819   int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
3820   setPreferenceProperty( deformed_shape_represent, "strings", modes0 );
3821   setPreferenceProperty( deformed_shape_represent, "indexes", indices0 );
3822   addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" );
3823
3824   int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" );
3825   setPreferenceProperty( vectors_represent, "strings", modes3 );
3826   setPreferenceProperty( vectors_represent, "indexes", indices3 );
3827   sp = addPreference( "", representGr, LightApp_Preferences::Space );
3828   setPreferenceProperty( sp, "hstretch", 0 );
3829   setPreferenceProperty( sp, "vstretch", 0 );
3830
3831   int stream_lines_represent = addPreference( tr( "VISU_STREAM_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "stream_lines_represent" );
3832   setPreferenceProperty( stream_lines_represent, "strings", modes3 );
3833   setPreferenceProperty( stream_lines_represent, "indexes", indices3 );
3834   sp = addPreference( "", representGr, LightApp_Preferences::Space );
3835   setPreferenceProperty( sp, "hstretch", 0 );
3836   setPreferenceProperty( sp, "vstretch", 0 );
3837
3838   int plot3d_represent = addPreference( tr( "VISU_PLOT3D" ), representGr, LightApp_Preferences::Selector, "VISU", "plot3d_represent" );
3839   setPreferenceProperty( plot3d_represent, "strings", modes2 );
3840   setPreferenceProperty( plot3d_represent, "indexes", indices2 );
3841   sp = addPreference( "", representGr, LightApp_Preferences::Space );
3842   setPreferenceProperty( sp, "hstretch", 0 );
3843   setPreferenceProperty( sp, "vstretch", 0 );
3844
3845   int scalar_def_represent = addPreference( tr( "VISU_DEFORMED_SHAPE_AND_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
3846   setPreferenceProperty( scalar_def_represent, "strings", modes1 );
3847   setPreferenceProperty( scalar_def_represent, "indexes", indices1 );
3848   addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
3849
3850   int point_precision = addPreference( tr( "VISU_FLOATING_POINT_PRECISION" ), representGr,
3851                                        LightApp_Preferences::IntSpin, "VISU", "floating_point_precision" );
3852   setPreferenceProperty( point_precision, "min", 1 );
3853   setPreferenceProperty( point_precision, "max", 16 );
3854   setPreferenceProperty( point_precision, "step", 1 );
3855   addPreference( "", representGr, LightApp_Preferences::Space );
3856
3857   addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
3858   sp = addPreference( "", representGr, LightApp_Preferences::Space );
3859   setPreferenceProperty( sp, "hstretch", 0 );
3860   setPreferenceProperty( sp, "vstretch", 0 );
3861
3862   addPreference( tr( "VISU_DISP_ONLY" ), representGr, LightApp_Preferences::Bool, "VISU", "display_only" );
3863   addPreference( "", representGr, LightApp_Preferences::Space );
3864
3865   addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr,
3866                  LightApp_Preferences::Bool, "VISU", "automatic_fit_all" );
3867
3868   // TAB: Feature edges ; group: "Feature edges properties"
3869   int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) );
3870
3871   int featureEdgesGr = addPreference( tr( "VISU_FEATURE_EDGES_PROPS" ), featureEdgesTab );
3872   setPreferenceProperty( featureEdgesGr, "columns", 2 );
3873
3874   int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
3875                                              LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
3876   setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
3877   setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
3878   setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
3879
3880   addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" );
3881   addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" );
3882   addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
3883   addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
3884   //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
3885   
3886   // TAB: "Values labels"
3887   
3888   int valLblTab = addPreference( tr( "VALUES_LABELING" ) );
3889
3890   // "Font" group
3891   int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab );
3892   setPreferenceProperty( valLblFontGr, "columns", 2 );
3893
3894   // font
3895   addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
3896
3897   // color
3898   addPreference( tr( "COLOR" ), valLblFontGr, 
3899     LightApp_Preferences::Color, "VISU", "values_labeling_color" );
3900
3901 }
3902
3903 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
3904 {
3905   if (a != QString("VISU")) return;
3906   if (b == QString("scalar_bar_orientation")) return;
3907   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
3908   float sbX1,sbY1,sbW,sbH;
3909   float aTol = 1.00000009999999;
3910   QString aWarning;
3911   if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
3912     sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01);
3913     sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05);
3914     if(sbX1+sbW > aTol){
3915       aWarning = "Origin and Size Vertical: X+Width > 1\n";
3916       sbX1=0.01;
3917       sbW=0.05;
3918       aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
3919       aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
3920     }
3921   }
3922   else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
3923     sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01);
3924     sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5);
3925     if(sbY1+sbH > aTol){
3926       aWarning = "Origin and Size Vertical: Y+Height > 1\n";
3927       sbY1=0.01;
3928       sbH=0.5;
3929       aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
3930       aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
3931     }
3932   }
3933   else if(b ==  QString("scalar_bar_horizontal_x") || b ==  QString("scalar_bar_horizontal_width")){
3934     sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2);
3935     sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6);
3936     if(sbX1+sbW > aTol){
3937       aWarning = "Origin and Size Horizontal: X+Width > 1\n";
3938       sbX1=0.2;
3939       sbW=0.6;
3940       aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
3941       aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
3942     }
3943   }
3944   else if(b ==  QString("scalar_bar_horizontal_y") || b ==  QString("scalar_bar_horizontal_height")){
3945     sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01);
3946     sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12);
3947     if(sbY1+sbH > aTol){
3948       aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
3949       sbY1=0.01;
3950       sbH=0.12;
3951       aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
3952       aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
3953     }
3954   } 
3955   
3956   if ( !aWarning.isEmpty() ){
3957     aWarning += "The default values are applied instead.";
3958     SUIT_MessageBox::warning(GetDesktop(this),
3959                              tr("ERR_SCALARBAR_PARAMS"),
3960                              aWarning );
3961   }
3962 }
3963
3964 SUIT_ViewManager*
3965 VisuGUI
3966 ::getViewManager(const QString& theType,
3967                  const bool theIsCreate)
3968 {
3969   return getApp()->getViewManager(theType,theIsCreate);
3970 }
3971
3972 VISU::TViewToPrs3d&
3973 VisuGUI
3974 ::getScalarBarsMap()
3975 {
3976   return myScalarBarsMap;
3977 }
3978
3979 LightApp_Displayer* VisuGUI::displayer()
3980 {
3981   if( !myDisplayer )
3982     myDisplayer = new VisuGUI_Displayer( getApp() );
3983
3984   return myDisplayer;
3985 }
3986
3987
3988 void VisuGUI::OnPlot3dFromCutPlane()
3989 {
3990  _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3991  if (CheckLock(aCStudy, GetDesktop(this)))
3992    return;
3993
3994  LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3995  SALOME_ListIO aListIO;
3996  aSelectionMgr->selectedObjects(aListIO);
3997
3998  if (aListIO.Extent() < 1) return;
3999
4000
4001  VISU::CutPlanes_i* aCutPrs = 0;
4002  Handle(SALOME_InteractiveObject) anIO;
4003  _PTR(SObject) aSObject;
4004  SALOME_ListIteratorOfListIO It (aListIO);
4005  for (; It.More(); It.Next()) {
4006    anIO = It.Value();
4007
4008    if (!anIO.IsNull() && anIO->hasEntry()) {
4009      aSObject = aCStudy->FindObjectID(anIO->getEntry());
4010      if ( !aSObject )
4011         continue;
4012      VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
4013      if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
4014        if (aPrsObject->GetType() == VISU::TCUTPLANES) {
4015          aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
4016          if (aCutPrs)
4017            break;
4018        }
4019      }
4020    }
4021  }
4022
4023  if (aCutPrs) {
4024    _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
4025    if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
4026      QString aViewType = aViewManager->getType();
4027      //bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
4028
4029      Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
4030      VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
4031      if (aType != TTIMESTAMP )
4032         return;
4033
4034      QString aMeshName = aRestoringMap["myMeshName"];
4035      QString anEntity = aRestoringMap["myEntityId"];
4036      QString aFieldName = aRestoringMap["myFieldName"];
4037      QString aTimeStampId = aRestoringMap["myTimeStampId"];
4038
4039      int aPos;
4040      SUIT_ViewWindow* aViewWindow = 0;
4041 //      if (anIsVVTK) {
4042 //      aViewWindow = GetViewWindow<VVTK_Viewer>(this);
4043 //      aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
4044 //      } else {
4045         aViewWindow = GetViewWindow<SVTK_Viewer>(this);
4046         aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
4047         //     }
4048      GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
4049
4050      VISU::Plot3D_i* aPrs3d =
4051        CreatePrs3dFromFactory<VISU::Plot3D_i>(this,
4052                                               aTimeStampSObj,
4053                                               (const char*)aMeshName.toLatin1(),
4054                                               (Entity)anEntity.toInt(),
4055                                               (const char*)aFieldName.toLatin1(),
4056                                               aTimeStampId.toInt(),
4057                                               ColoredPrs3d_i::EPublishUnderTimeStamp);
4058      if (aPrs3d) {
4059         SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4060         int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
4061         if (!aValue) {
4062           VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
4063           aDlg->initFromPrsObject(aPrs3d, true);
4064           int    aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
4065           double aRotX = aCutPrs->GetRotateX();
4066           double aRotY = aCutPrs->GetRotateY();
4067           double aPlanePos = aCutPrs->GetPlanePosition(0);
4068           aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
4069
4070           if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
4071             DeletePrs3d(this, aPrs3d);
4072             delete aDlg;
4073             return;
4074           }
4075           delete aDlg;
4076           UpdateObjBrowser(this, true, aTimeStampSObj);
4077         }
4078         SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
4079         if ( aSVtkWindow ) {
4080           PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
4081           aSVtkWindow->onFitAll();
4082
4083           AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
4084         }
4085         if (aPrs3d)
4086           emit presentationCreated(aPrs3d);
4087      }
4088    }
4089    application()->putInfo(QObject::tr("INF_DONE"));
4090  }
4091 }
4092
4093 void VisuGUI::OnManageCache()
4094 {
4095   mySlider->show();
4096 }
4097
4098
4099 //---------------------------------------------------------------
4100 void VisuGUI::OnMultiprViewFullRes()
4101 {
4102   OnMultiprChangeRes(VISU::Result::FULL);
4103 }
4104
4105
4106 //---------------------------------------------------------------
4107 void VisuGUI::OnMultiprViewMediumRes()
4108 {
4109   OnMultiprChangeRes(VISU::Result::MEDIUM);
4110 }
4111
4112
4113 //---------------------------------------------------------------
4114 void VisuGUI::OnMultiprViewLowRes()
4115 {
4116   OnMultiprChangeRes(VISU::Result::LOW);
4117 }
4118
4119
4120 //---------------------------------------------------------------
4121 void VisuGUI::OnMultiprViewHide()
4122 {
4123   OnMultiprChangeRes(VISU::Result::HIDDEN);
4124 }
4125
4126
4127 //---------------------------------------------------------------
4128 void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution)
4129 {
4130   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4131   if (CheckLock(aCStudy,GetDesktop(this)))
4132     return;
4133
4134   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
4135   if(aSelectionInfo.empty())
4136     return;
4137
4138   QApplication::setOverrideCursor(Qt::WaitCursor);
4139
4140   typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
4141   typedef std::map<TResultPtr, _PTR(SObject)> TResult2SObject;
4142   TResult2SObject aResult2SObject;
4143
4144   for (int i=0; i < aSelectionInfo.size(); i++) {
4145     VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
4146
4147     _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
4148     if (!aSObject)
4149       continue;
4150
4151     VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
4152     if(CORBA::is_nil(aResult.in()))
4153       continue;
4154
4155     VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
4156     if(!aCResult)
4157       continue;
4158
4159     Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSObject);
4160     bool anIsFound = false;
4161     QString aMeshName = Storable::FindValue(aRestoringMap, "myMeshName", &anIsFound);
4162     if(!anIsFound)
4163       continue;
4164
4165     std::string aPartName = aSObject->GetName();
4166
4167     aCResult->SetResolution(aMeshName.toLatin1().data(), aPartName.c_str(), theResolution);
4168
4169     aResult2SObject[TResultPtr(aCResult)] = aSObject;
4170   }
4171
4172   // To update all result observers
4173   TResult2SObject::const_iterator anIter = aResult2SObject.begin();
4174   for(; anIter != aResult2SObject.end(); anIter++){
4175     const TResultPtr& aResultPtr = anIter->first;
4176     const _PTR(SObject)& aSObject = anIter->second;
4177     aResultPtr->UpdateObservers();
4178     VISU::UpdateObjBrowser(this, false, aSObject);
4179   }
4180
4181   QApplication::restoreOverrideCursor();
4182 }
4183
4184 //---------------------------------------------------------------
4185 void VisuGUI::OnFileInfo()
4186 {
4187   SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4188   SUIT_DataOwnerPtrList lst;
4189   getApp()->selectionMgr()->selected( lst );
4190   LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4191   VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4192   VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4193   if(!aCResult)
4194     return;
4195   VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aCResult->GetMEDFileInfo() );
4196   dlg.exec();
4197 }
4198
4199 //---------------------------------------------------------------
4200 void VisuGUI::OnExportMED()
4201 {
4202   SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4203   SUIT_DataOwnerPtrList lst;
4204   getApp()->selectionMgr()->selected( lst );
4205   LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4206   VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4207   VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4208   if(!aResult)
4209     return;
4210   //  VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aResult->GetMEDFileInfo() );
4211   //  dlg.exec();
4212
4213   SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4214   QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
4215
4216   // get name for the file
4217   QStringList aFilter;
4218   aFilter.append("MED Files (*.med)");
4219
4220   std::string anInitFileName = aResult->GetInitFileName();
4221   QFileInfo anInitFileInfo(anInitFileName.c_str());
4222   QString aBaseName = anInitFileInfo.fileName();
4223
4224   QString aPath = Qtx::addSlash(aDir) + aBaseName;
4225
4226   QFileInfo aFileInfo =
4227     SUIT_FileDlg::getFileName(GetDesktop(this),
4228                               aPath,
4229                               aFilter,
4230                               tr("MEN_EXPORT_MED"), // "Export To Med File"
4231                               false);
4232
4233   QString aFile = aFileInfo.filePath();
4234   if ( aFile.length() > 0 ) {
4235     aResult->ExportMED((const char*)aFile.toLatin1());
4236   }
4237 }
4238
4239 void VisuGUI::OnFilterScalars()
4240 {
4241   VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
4242   aDlg->show();
4243 }
4244
4245 /*!
4246   \brief SLOT called when "Labeling" popup menu item of presentation is clicked 
4247    activates/deactivates labeling of results of the screen. This functionality works 
4248    to numbering in SMESH module but is intended for showing results on the screen 
4249    instead of elements numbers
4250    \sa OnValuesLabelingParams()
4251 */
4252 void VisuGUI::OnValuesLabeling()
4253 {
4254   // to do: rewrite for several actors if necessary
4255
4256   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
4257   if ( aSelectionInfo.empty() )
4258     return;
4259
4260   TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
4261   VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
4262   if(!aPrs3d)
4263     return;
4264
4265   SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
4266   if(!aViewWindow)
4267     return;
4268
4269   VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
4270   if(!anActor)
4271     return;
4272
4273   if( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
4274   {
4275     aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() );
4276     aViewWindow->Repaint();
4277   }
4278   else if( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>(anActor) )
4279   {
4280     aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() );
4281     aViewWindow->Repaint();
4282   }
4283 }
4284
4285 /*!
4286   \brief SLOT called when "Labeling parameters" popup menu item of presentation 
4287   is clicked launch dialog box for changing parameters of labeling
4288   \sa OnValuesLabeling()
4289 */
4290 void VisuGUI::OnValuesLabelingParams()
4291 {
4292   Handle(SALOME_InteractiveObject) anIO;
4293   if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
4294     EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);  
4295 }
4296 /*!
4297   \brief Adds preferences for dfont of VTK viewer
4298   \param label label
4299   \param pIf group identifier
4300   \param param parameter
4301   \return identifier of preferences
4302 */
4303 int VisuGUI::addVtkFontPref( 
4304   const QString& label, 
4305   const int pId, 
4306   const QString& param, 
4307   const bool useSize )
4308 {
4309   int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
4310   
4311   setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
4312
4313   QStringList fam;
4314   fam.append( tr( "VISU_FONT_ARIAL" ) );
4315   fam.append( tr( "VISU_FONT_COURIER" ) );
4316   fam.append( tr( "VISU_FONT_TIMES" ) );
4317
4318   setPreferenceProperty( tfont, "fonts", fam );
4319
4320   int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
4321   if ( useSize )
4322     f |= QtxFontEdit::UserSize | QtxFontEdit::Size;
4323
4324   setPreferenceProperty( tfont, "features", f );
4325
4326   return tfont;
4327 }