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