Salome HOME
IPAL9285,9292,9314
[modules/visu.git] / src / VISUGUI / VisuGUI.cxx
index 670339b09fbd3531da4cba9a56fe2d4d4fd7d685..ced02edf286d7ad476290cd8de1e3e8be76be6a1 100644 (file)
@@ -425,7 +425,7 @@ CreatePrs3d(SalomeApp_Module* theModule,
     SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
     int aValue = aResourceMgr->integerValue("Visu:BuildDefaultPrs3d",0);
     if(!aValue){
-      if(TDlg* aDlg = new TDlg(GetDesktop(theModule))){ // dialog box in creation mode
+      if(TDlg* aDlg = new TDlg(theModule)){ // dialog box in creation mode
        aDlg->initFromPrsObject(aPrs3d);
        if(IsDlgModal)
          if(aDlg->exec() && (aDlg->storeToPrsObject(aPrs3d))) {
@@ -651,6 +651,10 @@ OnErasePrs()
   if(MYDEBUG) MESSAGE("OnErasePrs");
 
   QApplication::setOverrideCursor(Qt::waitCursor);
+
+  SVTK_ViewWindow* vw = GetViewWindow(this);
+  if (vw) vw->unHighlightAll();
+
   SALOME_ListIO aList;
   SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
   mgr->selectedObjects(aList);
@@ -661,8 +665,9 @@ OnErasePrs()
     CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
     ErasePrs(this, anObject, false);
   }
-  if (SVTK_ViewWindow* vw = GetViewWindow( this ))
-    vw->Repaint();
+
+  if (vw) vw->Repaint();
+
   QApplication::restoreOverrideCursor();
 }
 
@@ -673,7 +678,7 @@ EditPrs3d (SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs3d)
   TPrs3d_i* aPrsObject = dynamic_cast<TPrs3d_i*>(thePrs3d);
   if (aPrsObject) {
     //TDlg* aDlg = new TDlg (GetDesktop(theModule), false, true);
-    TDlg* aDlg = new TDlg (GetDesktop(theModule));
+    TDlg* aDlg = new TDlg (theModule);
     aDlg->initFromPrsObject(aPrsObject);
     if (aDlg->exec()) {
       if (!(aDlg->storeToPrsObject(aPrsObject))) {
@@ -770,40 +775,6 @@ OnEditPrs()
     vw->highlight(anIO, 1);
 }
 
-void
-VisuGUI::
-OnDeletePrs()
-{
-  _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
-  if (CheckLock(aCStudy))
-    return;
-  SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
-
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-  if (anIO.IsNull())
-    return;
-
-  // There is a transaction
-  SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
-  aStudyBuilder->NewCommand();
-
-  // is it Prs3d object ?
-  VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
-  if (aPrsObject) {
-    DeletePrs3d(this, aPrsObject, anIO);
-  }
-
-  // is it Curve object ?
-  VISU::Curve_i* aCurveObject = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
-  if (aCurveObject) {
-    //jfa tmp:DeleteCurve(this, aCurveObject, anIO);
-  }
-
-  aStudyBuilder->CommitCommand();
-}
-
-
 void
 VisuGUI::
 OnEraseAll()
@@ -1106,75 +1077,6 @@ OnCreateTable()
   }
 }
 
-void
-VisuGUI::
-OnDeleteObject()
-{
-  _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
-  if (CheckLock(aCStudy))
-    return;
-  SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
-
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-  if (anIO.IsNull() || !anIO->hasEntry())
-    return;
-
-  SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
-  if (!aSObject->_is_nil()) {
-    SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
-    for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
-      SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
-      CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
-      ErasePrs(this, aChildObj);
-    }
-    SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
-    // There is a transaction
-    aStudyBuilder->NewCommand();
-    CORBA::Object_var anObj = VISU::SObjectToObject(aSObject);
-    if (!CORBA::is_nil(anObj)) {
-      VISU::Base_var aBase = VISU::Base::_narrow(anObj);
-      if (!CORBA::is_nil(aBase)) {
-        VISU::VISUType aType = aBase->GetType();
-        switch (aType) {
-        case VISU::TRESULT:
-          {
-            SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
-           for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
-              SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
-              CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
-              if (CORBA::is_nil(aChildObj)) continue;
-              VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj);
-              if (CORBA::is_nil(aPrs3d)) continue;
-              VISU::Prs3d_i* pPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aPrs3d).in());
-              DeletePrs3d(this, pPrs3d, NULL);
-           }
-           break;
-         }
-        case VISU::TTABLE:
-          {
-            SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
-           for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
-              SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
-              CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
-              if (CORBA::is_nil(aChildObj)) continue;
-              CORBA::Object_ptr aCurve = VISU::Curve::_narrow(aChildObj);
-              if (CORBA::is_nil(aCurve)) continue;
-              //VISU::Curve_i* pCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
-              //jfa tmp:DeleteCurve(this, pCurve, NULL);
-            }
-            break;
-          }
-        }
-      }
-    }
-    aStudyBuilder->RemoveObjectWithChildren(aSObject);
-    aStudyBuilder->CommitCommand();
-    //jfa tmp:GetActiveStudy()->unHighlightAll();
-    updateObjBrowser(true);
-  }
-}
-
 void
 VisuGUI::
 OnDeleteObjects()
@@ -1514,38 +1416,6 @@ OnRestoreViewParams()
   VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
 }
 
-void
-VisuGUI::
-OnDeleteViewParams()
-{
-  _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
-  if (CheckLock(aCStudy))
-    return;
-  SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
-
-  Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
-  _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
-  if (!aSObject) return;
-
-  VISU::VISUType aType = (VISU::VISUType)getValue(aSObject, "myType").toInt();
-  if (aType == VISU::TVIEW3D) {
-    SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
-    SALOME_ListIO aListIO, aNewListIO;
-    aSelectionMgr->selectedObjects(aListIO);
-    for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
-      if (it.Value()->getEntry() != anIO->getEntry()) {
-        aNewListIO.Append(it.Value());
-      }
-    }
-    aSelectionMgr->setSelectedObjects(aNewListIO);
-
-    aCStudy->NewBuilder()->RemoveObject(aSObject);
-
-    updateObjBrowser();
-  }
-}
-
 void
 VisuGUI::
 OnRename()
@@ -1735,25 +1605,23 @@ OnShowAnimation()
   const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
 
   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
-  SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
 
-  SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(anIO->getEntry());
-  if (aSObj->_is_nil()) return;
+  _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
+  if (!aSObj) return;
 
   VISU::Storable::TRestoringMap aMap;
-  SALOMEDS::GenericAttribute_var anAttr;
+  _PTR(GenericAttribute) anAttr;
   if (!aSObj->FindAttribute(anAttr, "AttributeComment")) return;
 
-  SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
+  _PTR(AttributeComment) aComment (anAttr);
   string aComm = aComment->Value();
-  QString strIn(aComm.c_str());
-  VISU::Storable::StrToMap(strIn,aMap);
+  QString strIn (aComm.c_str());
+  VISU::Storable::StrToMap(strIn, aMap);
   bool isExist;
   VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
   if (aType != VISU::TANIMATION) return;
 
   VisuGUI_TimeAnimationDlg* aAnimationDlg =
-//    new VisuGUI_TimeAnimationDlg(GetDesktop(this), aCStudy);
     new VisuGUI_TimeAnimationDlg(this, aCStudy);
   aAnimationDlg->restoreFromStudy(aSObj);
   aAnimationDlg->show();
@@ -1767,7 +1635,6 @@ OnCopyPresentation()
   if (CheckLock(aCStudy))
     return;
 
-  //VISU::Prs3d_i* aPrsObject = GetSelectedPrs3d();
   Handle(SALOME_InteractiveObject) anIO;
   CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
   if (CORBA::is_nil(anObject)) return;
@@ -1858,7 +1725,13 @@ void
 VisuGUI::
 OnSelectionInfo()
 {
-  (new VisuGUI_SelectionDlg(GetDesktop(this)))->show();
+  if (GetViewWindow())
+    (new VisuGUI_SelectionDlg(GetDesktop(this)))->show();
+  else
+    SUIT_MessageBox::warn1(GetDesktop(this),
+                           tr("WRN_VISU"),
+                           tr("ERR_ACTIVATE_VIEW3D"),
+                           tr("BUT_OK") );
 }
 
 void
@@ -2093,16 +1966,13 @@ createActions()
                 this, SLOT(OnCreatePlot3D()));
 
   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
-  createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap), tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
+  createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIconSet(aPixmap),
+                tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
                this, SLOT(OnCreatePlot2dView()));
 
-  //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
-  //createAction( VISU_DELETE, tr("MEN_DELETE_OBJ"), QIconSet(), tr("MEN_DELETE_OBJ"), "", 0, aParent, false,
-  //              this, SLOT(OnDeleteObject()));
-
   createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIconSet(),
                 tr("MEN_DELETE_OBJS"), "", 0, aParent, false,
-               this, SLOT(OnDeleteObjects()));
+                this, SLOT(OnDeleteObjects()));
 
   //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
   //createAction( 4022, tr("MEN_RENAME_TABLE"), QIconSet(aPixmap), tr("MEN_RENAME_TABLE"), "", 0, aParent, false,
@@ -2120,8 +1990,16 @@ createActions()
   createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIconSet(), tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
                this, SLOT(OnExportTableToFile()));
 
-  createAction( VISU_IMPORT_MED, tr("MEN_IMPORT_MED"), QIconSet(),
-                tr("MEN_IMPORT_MED"), "", 0, aParent, false,
+  createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIconSet(),
+                tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
+               this, SLOT(OnImportMedField()));
+
+  createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIconSet(),
+                tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
+               this, SLOT(OnImportMedField()));
+
+  createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIconSet(),
+                tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
                this, SLOT(OnImportMedField()));
 
   //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
@@ -2157,10 +2035,6 @@ createActions()
   createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIconSet(), tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
                this, SLOT(OnDisplayOnlyPrs()));
 
-  //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
-  createAction( VISU_DELETE_PRS, tr("MEN_DELETE_PRS"), QIconSet(), tr("MEN_DELETE_PRS"), "", 0, aParent, false,
-               this, SLOT(OnDeletePrs()));
-
   //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
   createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIconSet(), tr("MEN_COPY_PRS"), "", 0, aParent, false,
                this, SLOT(OnCopyPresentation()));
@@ -2185,20 +2059,22 @@ createActions()
   createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIconSet(), tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
                this, SLOT(OnClearContainer()));
 
-  //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
   createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
                 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
                this, SLOT(OnSaveViewParams()));
+  createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIconSet(),
+                tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
+               this, SLOT(OnSaveViewParams()));
 
   //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
   createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIconSet(),
                 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
                this, SLOT(OnRestoreViewParams()));
 
-  //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
   createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIconSet(),
                 tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
-               this, SLOT(OnDeleteViewParams()));
+               //this, SLOT(OnDeleteViewParams()));
+               this, SLOT(OnDeleteObjects()));
 
   createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIconSet(),
                 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
@@ -2299,8 +2175,8 @@ createActions()
                 tr("MEN_SCALING"), "", 0, aParent, false,
                this, SLOT(OnScaling()));
 
-  //aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUBE_AXES"));
-  createAction( VISU_CUBE_AXES, tr("MEN_CUBE_AXES"), QIconSet(/*aPixmap*/),
+  aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUBE_AXES"));
+  createAction( VISU_CUBE_AXES, tr("MEN_CUBE_AXES"), QIconSet(aPixmap),
                 tr("MEN_CUBE_AXES"), "", 0, aParent, false,
                this, SLOT(OnCubeAxes()));
 
@@ -2315,7 +2191,7 @@ createMenus()
 {
   // Add actions to menus
   int aMenuId;
-  aMenuId = createMenu( tr( "MEN_FILE" ), -1 );
+  aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
   createMenu( separator(), aMenuId, -1, 10 );
   createMenu( VISU_IMPORT_FROM_FILE, aMenuId, 10 ); // import from file
   createMenu( VISU_EXPLORE_MED, aMenuId, 10 ); // explore MED file
@@ -2360,6 +2236,16 @@ createToolBars()
   createTool( VISU_CUT_LINES, aToolId );
   createTool( VISU_STREAM_LINES, aToolId );
   createTool( VISU_PLOT_3D, aToolId );
+
+  aToolId = createTool(tr("TOOL_REPRESENTATION"));
+  createTool( VISU_POINTS, aToolId );
+  createTool( VISU_WIREFRAME, aToolId );
+  createTool( VISU_SURFACE, aToolId );
+  createTool( VISU_ERASE_ALL, aToolId );
+  createTool( VISU_GLOBAL_SELECTION, aToolId );
+  createTool( VISU_PARTIAL_SELECTION, aToolId );
+  createTool( VISU_SCALING, aToolId );
+  createTool( VISU_CUBE_AXES, aToolId );
 }
 
 void
@@ -2374,7 +2260,7 @@ createPopupMenus()
   mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
   mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
 
-  mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
+  //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
 
   // create
   mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
@@ -2402,9 +2288,6 @@ createPopupMenus()
   mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
 
   // delete
-  mgr->insert( action( VISU_DELETE_OBJS ), -1, -1, -1 );
-  //mgr->insert( action( VISU_DELETE ), -1, -1, -1 ); // TODO: remove
-  //mgr->insert( action( VISU_DELETE_PRS ), -1, -1, -1 ); // TODO: remove
   mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
 
   // table commands
@@ -2447,12 +2330,12 @@ createPopupMenus()
 
   mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
   mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 );
-  mgr->insert( action( VISU_SHOW_ANIMATION ), -1, -1, -1 );
 
   mgr->insert( separator(), -1, -1, -1 );
 
   // view parameters commands
   mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
+  mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
   mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
   mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
 
@@ -2479,24 +2362,17 @@ createPopupMenus()
   mgr->setRule( action( VISU_IMPORT_TABLE ), aRule, true );
   mgr->setRule( action( VISU_PLOT2D ), aRule, true );
 
-  //aRule = aSel_One_ObjBr + " and $type in {'VISU::TRESULT' 'VISU::TTABLE' 'VISU::TCONTAINER'}";
-  //mgr->setRule( action( VISU_DELETE ), aRule, true );
-
-  QString aDeletable ("$type in {'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' ");
-  aDeletable += aPrsAll + " 'VISU::TRESULT' 'VISU::TMESH'}";
-  mgr->setRule( action( VISU_DELETE_OBJS ), aSel_Some_ObjBr + " and " + aDeletable, true );
-
   // timestamp commands
   aRule = aSel_One_ObjBr + " and type='VISU::TTIMESTAMP'";
   mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true );
   mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true );
   mgr->setRule( action( VISU_CUT_PLANES ), aRule, true );
   mgr->setRule( action( VISU_CUT_LINES ), aRule, true );
+  mgr->setRule( action( VISU_PLOT_3D ), aRule, true );
   aRule += " and nbComponents>1";
   mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule, true );
   mgr->setRule( action( VISU_VECTORS ), aRule, true );
   mgr->setRule( action( VISU_STREAM_LINES ), aRule, true );
-  mgr->setRule( action( VISU_PLOT_3D ), aRule, true );
 
   // table commands
   aRule = aSel_One_ObjBr + " and type='VISU::TTABLE'";
@@ -2512,19 +2388,17 @@ createPopupMenus()
   mgr->setRule( action( VISU_DISPLAY ), aRule + "and (isVisible=false)", true );// TODO: aRule.arg(" and isVisible=0"), true );
   mgr->setRule( action( VISU_DISPLAY_ONLY ), aRule, true );
 
+  aRule = "selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "}";
   mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule, true );
 
+  aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
   mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule, true );
   mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule, true );
 
-  //aRule = "selcount=1 and $type in {'VISU::TTABLE' 'VISU::TCURVE' "
-  //        "'VISU::TCONTAINER' 'VISU::TMESH' " + aPrsAll + "}";
-  //mgr->setRule( action( VISU_DELETE_PRS ), aRule, true );
-
   // View parameters
-  //jfa tmp:aRule = "(client='VTKViewer' and selcount=0) or (selcount=1 and type='VISU::TVIEW3D')";
-  //jfa tmp:mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), aRule, true );
-  mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0", true ); //jfa tmp
+  aRule = "selcount=1 and type='VISU::TVIEW3D'";
+  mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule, true );
+  mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0", true );
   mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
   mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
 
@@ -2594,7 +2468,7 @@ createPopupMenus()
   mgr->setRule( action( VISU_SWEEP ), aRule, true );
 
   // Selection info popup item
-  aRule = "client='ObjectBrowser' and selcount=1" + aInsideType;
+  aRule = "client='VTKViewer' and selcount=1" + aInsideType;
   mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true );
 
   aRule = "client='ObjectBrowser' and selcount>0 and $type in {'VISU::TFIELD'} and nbTimeStamps>1";
@@ -2604,11 +2478,8 @@ createPopupMenus()
   mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1", true );
   mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1", true );
 
-  aRule = "client='ObjectBrowser' and type='MEDFIELD'";
-  mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
-
-  aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TANIMATION'";
-  mgr->setRule( action( VISU_SHOW_ANIMATION ), aRule, true );
+  //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
+  //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
 }
 
 //***************************************************************************
@@ -2616,7 +2487,7 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
 {
   SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
 
-  // Check multiple selection
+  // Check if some (nb > 0) removable objects selected
   if (IsRemovableSelected(this)) {
     action( VISU_DELETE_OBJS )->addTo(theMenu);
   }
@@ -2628,29 +2499,43 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q
   if (aListIO.Extent() != 1) return;
 
   Handle(SALOME_InteractiveObject) anIO;
-  CORBA::Object_var anObject = GetSelectedObj( this, &anIO );
-  _PTR(SObject) SO = GetCStudy( GetAppStudy( this ) )->FindObjectID( anIO->getEntry() );
-  if (IsSObjectTable(SO)) {
+  VISU::Storable::TRestoringMap aMap;
+  CORBA::Object_var anObject = GetSelectedObj( this, &anIO, &aMap);
+
+  _PTR(SObject) SO = GetCStudy(GetAppStudy(this))->FindObjectID(anIO->getEntry());
+  bool isExist;
+  VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
+
+  if (aType == VISU::TANIMATION) {
+    action( VISU_SHOW_ANIMATION )->addTo(theMenu);
+
+  } else if (IsSObjectTable(SO)) {
     action( VISU_SHOW_TABLE )->addTo(theMenu);
     action( VISU_CREATE_CURVES )->addTo(theMenu);
     action( VISU_EXPORT_TABLE )->addTo(theMenu);
     theMenu->insertSeparator();
-    //action( VISU_DELETE )->addTo(theMenu);
+
   } else {
     if (!CORBA::is_nil(anObject)) {
       SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
       if (!CORBA::is_nil(aMED.in())) {
-        action( VISU_IMPORT_MED )->addTo(theMenu);
-      } else {
-       _PTR(SObject) aSFather = SO->GetFather();
-        if (aSFather) {
-         _PTR(GenericAttribute) anAttr;
-          aSFather->FindAttribute(anAttr, "AttributeName");
-          if (anAttr) {
-            _PTR(AttributeName) aName (anAttr);
-            std::string aValue = aName->Value();
-            if (strcmp(aValue.c_str(), "MEDFIELD") == 0)
-              action( VISU_IMPORT_MED )->addTo(theMenu);
+        action( VISU_IMPORT_MED_STRUCTURE )->addTo(theMenu);
+      }
+
+      SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject); // "Import Structure"
+      if (!CORBA::is_nil(aField)) {
+        action( VISU_IMPORT_MED_TIMESTAMP )->addTo(theMenu); // "Import TimeStamp"
+      }
+    } else {
+      _PTR(SObject) aSFather = SO->GetFather();
+      if (aSFather) {
+       _PTR(GenericAttribute) anAttr;
+        aSFather->FindAttribute(anAttr, "AttributeName");
+        if (anAttr) {
+          _PTR(AttributeName) aName (anAttr);
+          std::string aValue = aName->Value();
+          if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
+            action( VISU_IMPORT_MED_FIELD )->addTo(theMenu); // "Import Field"
           }
         }
       }