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