Salome HOME
CopyPresentation, Rename, ChangeOpacity, ChangeLines
authorjfa <jfa@opencascade.com>
Tue, 14 Jun 2005 09:45:32 +0000 (09:45 +0000)
committerjfa <jfa@opencascade.com>
Tue, 14 Jun 2005 09:45:32 +0000 (09:45 +0000)
src/VISUGUI/Makefile.in
src/VISUGUI/VISU_msg_en.po
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI.h
src/VISUGUI/VisuGUI_MagnitudeDlg.cxx [deleted file]
src/VISUGUI/VisuGUI_MagnitudeDlg.h [deleted file]
src/VISUGUI/VisuGUI_NameDlg.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_NameDlg.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_TimeAnimation.cxx
src/VISUGUI/VisuGUI_Tools.cxx

index 3bbdd4ce4a926ab54237a08690af6651c01833fa..8565754c477179dff132e8a68574f17a88c81d0c 100644 (file)
@@ -44,21 +44,19 @@ PO_FILES = \
 
 # Libraries targets
 LIB = libVISU.la
-#LIB_SRC =     VisuGUI_MagnitudeDlg.cxx \
-#              VisuGUI_CursorDlg.cxx \
-#              VisuGUI_SweepPrefDlg.cxx \
+#LIB_SRC =     VisuGUI_SweepPrefDlg.cxx \
 #              VisuGUI_NonIsometricDlg.cxx
 #LIB_MOC = \
-#              VisuGUI_MagnitudeDlg.h \
-#              VisuGUI_CursorDlg.h \
-#              VisuGUI_SweepPrefDlg.h \
+#              VisuGUI_SweepPrefDlg.h \
 #              VisuGUI_NonIsometricDlg.h
 
 LIB_SRC =      VisuGUI.cxx \
                VisuGUI_Selection.cxx \
                VisuGUI_Tools.cxx \
                VisuGUI_PopupTools.cxx \
+               VisuGUI_NameDlg.cxx \
                VisuGUI_FileDlg.cxx \
+               VisuGUI_CursorDlg.cxx \
                VisuGUI_TimeAnimation.cxx \
                VisuGUI_EditContainerDlg.cxx \
                VisuGUI_ScalarBarDlg.cxx \
@@ -71,7 +69,9 @@ LIB_SRC =     VisuGUI.cxx \
 
 LIB_MOC =      VisuGUI.h \
                VisuGUI_Selection.h \
+               VisuGUI_NameDlg.h \
                VisuGUI_FileDlg.h \
+               VisuGUI_CursorDlg.h \
                VisuGUI_TimeAnimation.h \
                VisuGUI_EditContainerDlg.h \
                VisuGUI_ScalarBarDlg.h \
index c30a2364ba3f78b337a5128564f298b5b5ef186d..6694feb19227434666b2fe6d4dbf3aac724e4287 100644 (file)
@@ -207,10 +207,13 @@ msgstr "Wireframe"
 #: Common
 
 msgid "BUT_CLOSE"
-msgstr ""
+msgstr "Close"
+
+msgid "BUT_CANCEL"
+msgstr "Cancel"
 
 msgid "WRN_NO_AVAILABLE_DATA"
-msgstr ""
+msgstr "No Available data in selection"
 
 
 #: VisuGUI.cxx
@@ -330,9 +333,6 @@ msgstr "Show preview"
 msgid "VisuGUI_CutLinesDlg::TXT_ORIENTATION"
 msgstr "Orientation"
 
-msgid "VisuGUI_CutLinesDlg::BUT_CANCEL"
-msgstr "Cancel"
-
 msgid "VisuGUI_CutLinesDlg::BASE_PLANE_POS"
 msgstr "Base plane position"
 
@@ -481,24 +481,6 @@ msgid "VisuGUI_IsoSurfacesDlg::DEFINE_ISOSURFACES"
 msgstr "Iso Surfaces Definition"
 
 
-#: VisuGUI_MagnitudeDlg.cxx
-
-msgid "VisuGUI_MagnitudeDlg::&OK"
-msgstr ""
-
-msgid "VisuGUI_MagnitudeDlg::&Cancel"
-msgstr ""
-
-msgid "VisuGUI_MagnitudeDlg::DLG_TITLE"
-msgstr "Deformed Shape"
-
-msgid "VisuGUI_MagnitudeDlg::TXT_MAGNITUDE_COLORING"
-msgstr "Magnitude coloring"
-
-msgid "VisuGUI_MagnitudeDlg::LBL_SCALE_FACTOR"
-msgstr "Scale Factor:"
-
-
 #: VisuGUI_NonIsometricDlg.cxx
 
 msgid "VisuGUI_NonIsometricDlg::O&K"
@@ -788,3 +770,12 @@ msgstr "Center"
 
 msgid "VisuGUI_VectorsDlg::HEAD_BTN"
 msgstr "Head"
+
+
+#: VisuGUI_NameDlg.cxx
+
+msgid "VisuGUI_NameDlg::TLT_RENAME"
+msgstr "Rename"
+
+msgid "VisuGUI_NameDlg::NAME_LBL"
+msgstr "Name: "
index 547a4ff412a9524f97a2f9351793ea06ce90ad9b..bd565d4718cbddd666c38e9e704e8540273ec237 100644 (file)
@@ -79,7 +79,9 @@
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
 #include "VisuGUI_PopupTools.h"
+#include "VisuGUI_NameDlg.h"
 #include "VisuGUI_FileDlg.h"
+#include "VisuGUI_CursorDlg.h"
 #include "VisuGUI_Selection.h"
 #include "VisuGUI_TimeAnimation.h"
 #include "VisuGUI_EditContainerDlg.h"
@@ -251,6 +253,13 @@ OnImportTableFromFile()
   }
 }
 
+void
+VisuGUI::
+OnExportTableToFile()
+{
+  if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
+}
+
 
 template<class TPrs3d_i>
 TPrs3d_i*
@@ -714,12 +723,80 @@ void
 VisuGUI::
 OnChangeOpacity()
 {
+  Handle(SALOME_InteractiveObject) anIO;
+  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+  if (CORBA::is_nil(anObject)) return;
+  PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+  if (!aServant.in()) return;
+
+  VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
+  if (!aPrsObject) return;
+
+  SVTK_ViewWindow* vw = GetViewWindow();
+  if (!vw) return;
+
+  VISU_Actor* anActor = GetActor(aPrsObject, vw);
+  if (!anActor) return;
+
+  VisuGUI_CursorDlg* CursorDlg =
+    new VisuGUI_CursorDlg (GetDesktop(this), tr("Opacity"), TRUE);
+
+  CursorDlg->Comment1->setText(tr("Set value between"));
+  CursorDlg->Comment2->setText(tr("0 (transparent) and 100 (opaque)"));
+  CursorDlg->SpinBox1->setMinValue(0);
+  CursorDlg->SpinBox1->setMaxValue(100);
+
+  float oldopac = anActor->GetOpacity();
+  int intopac = int(oldopac*100. + 0.5);
+  CursorDlg->SpinBox1->setValue(intopac);
+
+  int ret = CursorDlg->exec();
+  if (ret == 1) {
+    intopac = CursorDlg->SpinBox1->value();
+    float newopac = intopac/100.;
+    anActor->SetOpacity(newopac);
+  }
+  delete CursorDlg;
 }
 
 void
 VisuGUI::
 OnChangeLines()
 {
+  Handle(SALOME_InteractiveObject) anIO;
+  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+  if (CORBA::is_nil(anObject)) return;
+  PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+  if (!aServant.in()) return;
+
+  VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
+  if (!aPrsObject) return;
+
+  SVTK_ViewWindow* vw = GetViewWindow();
+  if (!vw) return;
+
+  VISU_Actor* anActor = GetActor(aPrsObject, vw);
+  if (!anActor) return;
+
+  VisuGUI_CursorDlg* CursorDlg =
+    new VisuGUI_CursorDlg (GetDesktop(this), tr("Line Width"), TRUE);
+
+  CursorDlg->Comment1->setText("Set value between");
+  CursorDlg->Comment2->setText("1 (thin) and 10 (thick)");
+  CursorDlg->SpinBox1->setMinValue(1);
+  CursorDlg->SpinBox1->setMaxValue(10);
+
+  float oldlwid = anActor->GetLineWidth();
+  int intlwid = int(oldlwid);
+  CursorDlg->SpinBox1->setValue(intlwid);
+
+  int ret = CursorDlg->exec();
+  if (ret == 1) {
+    intlwid  = CursorDlg->SpinBox1->value();
+    float newlwid = intlwid;
+    anActor->SetLineWidth(newlwid);
+  }
+  delete CursorDlg;
 }
 
 void
@@ -1096,19 +1173,165 @@ void
 VisuGUI::
 OnRename()
 {
+  _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+  if (CheckLock(aCStudy))
+    return;
+
+  Handle(SALOME_InteractiveObject) anIO;
+  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+
+  _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
+  if (!aSObj) return;
+
+  //TEST DU PARENT == VISU
+  _PTR(GenericAttribute) anAttr;  
+  if (aSObj->FindAttribute(anAttr, "AttributeName")) {
+    _PTR(AttributeName) aName (anAttr);
+    QString Name = VisuGUI_NameDlg::getName(GetDesktop(this), aName->Value());
+    if (!Name.isEmpty()) {
+      QApplication::setOverrideCursor(Qt::waitCursor);
+
+      // rename specific objects
+      if (!CORBA::is_nil(anObject)) {
+        VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
+        if (!CORBA::is_nil(aVisuObj)) {
+          switch (aVisuObj->GetType()) {
+            case VISU::TCURVE: // Curve object
+            {
+              CORBA::Object_ptr aCurve = VISU::Curve::_narrow(anObject);
+              if (!CORBA::is_nil(aCurve)) {
+                VISU::Curve_i* curve =
+                  dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
+                if (curve)
+                 curve->SetName(Name.latin1());
+              }
+              break;
+            }
+            case VISU::TTABLE: // Table object
+            {
+              CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
+              if (!CORBA::is_nil(aTable)) {
+                VISU::Table_i* table =
+                  dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
+                if (table)
+                 table->SetName(Name.latin1());
+              }
+              break;
+            }
+            case VISU::TCONTAINER: // Container object
+            {
+              CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
+              if (!CORBA::is_nil(aContainer)) {
+                VISU::Container_i* container =
+                  dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
+                if (container)
+                 container->SetName(Name.latin1());
+              }
+              break;
+            }
+            default:
+            {
+            }
+          }
+        }
+      }
+
+      // rename the study object
+      //getApp()->activeStudy()->renameIObject(anIO, Name);
+      aName->SetValue(Name.latin1()); // rename the SObject
+      anIO->setName(Name.latin1()); // rename the InteractiveObject
+      updateObjBrowser(false);
+
+      QApplication::restoreOverrideCursor();
+    }
+  }
 }
 
-void
+/*void
 VisuGUI::
 OnRenameTable()
 {
+  _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+  if (CheckLock(aCStudy))
+    return;
+
+  Handle(SALOME_InteractiveObject) anIO;
+  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+
+  _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
+  if (!aSObject) return;
+
+  VISU::Table_i* table = 0;
+  if (!CORBA::is_nil(anObject)) {
+    VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
+    if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TTABLE) {
+      // Table object
+      CORBA::Object_ptr aTable = VISU::Table::_narrow(anObject);
+      if (!CORBA::is_nil(aTable)) {
+       table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
+      }
+    }
+  }
+
+  //TEST DU PARENT == VISU
+  _PTR(GenericAttribute) anAttr;  
+  if (aSObj->FindAttribute(anAttr, "AttributeName")) {
+    _PTR(AttributeName) aName (anAttr);
+    QString Name = SALOMEGUI_NameDlg::getName(GetDesktop(), aName->Value());
+    if (!Name.isEmpty()) {
+      QApplication::setOverrideCursor(Qt::waitCursor);
+      if (table)
+       table->SetName(Name.latin1());
+      //getApp()->activeStudy()->renameIObject(anIO, Name);
+      anIO->setName(Name.latin1()); // rename the InteractiveObject
+      updateObjBrowser(false);
+      QApplication::restoreOverrideCursor();
+    }
+  }
 }
 
 void
 VisuGUI::
 OnRenameContainer()
 {
-}
+  _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+  if (CheckLock(aCStudy))
+    return;
+
+  Handle(SALOME_InteractiveObject) anIO;
+  CORBA::Object_var anObject = GetSelectedObj(this, &anIO);
+
+  _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
+  if (!aSObject) return;
+
+  VISU::Container_i* container = 0;
+  if (!CORBA::is_nil(anObject)) {
+    VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
+    if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) {
+      // Container object
+      CORBA::Object_ptr aContainer = VISU::Container::_narrow(anObject);
+      if (!CORBA::is_nil(aContainer)) {
+       container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
+      }
+    }
+  }
+
+  //TEST DU PARENT == VISU
+  _PTR(GenericAttribute) anAttr;  
+  if (aSObj->FindAttribute(anAttr, "AttributeName")) {
+    _PTR(AttributeName) aName (anAttr);
+    QString Name = SALOMEGUI_NameDlg::getName(QAD_Application::getDesktop(), aName->Value());
+    if (!Name.isEmpty()) {
+      QApplication::setOverrideCursor(Qt::waitCursor);
+      if (container)
+       container->SetName(Name.latin1());
+      //getApp()->activeStudy()->renameIObject(anIO, Name);
+      anIO->setName(Name.latin1()); // rename the InteractiveObject
+      updateObjBrowser(false);
+      QApplication::restoreOverrideCursor();
+    }
+  }
+}*/
 
 void
 VisuGUI::
@@ -1202,6 +1425,87 @@ void
 VisuGUI::
 OnCopyPresentation()
 {
+  _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+  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;
+  PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+  if (!aServant.in()) return;
+
+  VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
+  if (!aPrsObject) return;
+
+  switch (aPrsObject->GetType()) {
+  case VISU::TMESH:
+    {
+      VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
+      VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
+      aSameMesh->SameAs(aMeshPrs);
+      UpdateViewer(this, aSameMesh);
+    }
+    break;
+  case VISU::TSCALARMAP:
+    {
+      VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
+      VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
+      aSameScalar->SameAs(aScalarPrs);
+      UpdateViewer(this, aSameScalar);
+    }
+    break;
+  case VISU::TDEFORMEDSHAPE:
+    {
+      VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
+      VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
+      aSameDeformed->SameAs(aDefPrs);
+      UpdateViewer(this, aSameDeformed);
+    }
+    break;
+  case VISU::TCUTPLANES:
+    {
+      VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
+      VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
+      aSameCut->SameAs(aCutPrs);
+      UpdateViewer(this, aSameCut);
+    }
+    break;
+  case VISU::TCUTLINES:
+    {
+      VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
+      VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
+      aSameCut->SameAs(aCutPrs);
+      UpdateViewer(this, aSameCut);
+    }
+    break;
+  case VISU::TISOSURFACE:
+    {
+      VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
+      VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
+      aSameIso->SameAs(aIsoPrs);
+      UpdateViewer(this, aSameIso);
+    }
+    break;
+  case VISU::TSTREAMLINES:
+    {
+      VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
+      VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
+      aSameLines->SameAs(aLinesPrs);
+      UpdateViewer(this, aSameLines);
+    }
+    break;
+  case VISU::TVECTORS:
+    {
+      VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
+      VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
+      aSameVectors->SameAs(aVectorsPrs);
+      UpdateViewer(this, aSameVectors);
+    }
+    break;
+  }
+  updateObjBrowser();
 }
 
 void
@@ -1277,9 +1581,9 @@ createActions()
   createAction( 4021, tr("MEN_DELETE_OBJ"), QIconSet(aPixmap), tr("MEN_DELETE_OBJ"), "", 0, aParent, false,
                this, SLOT(OnDeleteObject()));
 
-  aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
-  createAction( 4022, tr("MEN_RENAME_TABLE"), QIconSet(aPixmap), tr("MEN_RENAME_TABLE"), "", 0, aParent, false,
-               this, SLOT(OnRenameTable()));
+  //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+  //createAction( 4022, tr("MEN_RENAME_TABLE"), QIconSet(aPixmap), tr("MEN_RENAME_TABLE"), "", 0, aParent, false,
+               //this, SLOT(OnRenameTable()));
 
   aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
   createAction( 4023, tr("MEN_SHOW_TABLE"), QIconSet(aPixmap), tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
@@ -1330,7 +1634,7 @@ createActions()
                this, SLOT(OnDisplayOnlyManyPrs()));
 
   aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
-  createAction( 4037, tr("MEN_DELETE_PRS"), QIconSet(aPixmap), tr("MEN_DELETE_PRS"), "", 0, aParent, false,
+  createAction( 4037, tr("MEN_COPY_PRS"), QIconSet(aPixmap), tr("MEN_COPY_PRS"), "", 0, aParent, false,
                this, SLOT(OnCopyPresentation()));
 
   aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
@@ -1345,9 +1649,9 @@ createActions()
   createAction( 4042, tr("MEN_EDIT_CONTAINER"), QIconSet(aPixmap), tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
                this, SLOT(OnEditContainer()));
 
-  aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
-  createAction( 4043, tr("MEN_RENAME_CONTAINER"), QIconSet(aPixmap), tr("MEN_RENAME_CONTAINER"), "", 0, aParent, false,
-               this, SLOT(OnRenameContainer()));
+  //aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
+  //createAction( 4043, tr("MEN_RENAME_CONTAINER"), QIconSet(aPixmap), tr("MEN_RENAME_CONTAINER"), "", 0, aParent, false,
+               //this, SLOT(OnRenameContainer()));
 
   aPixmap = aResourceMgr->loadPixmap("VISU",tr(""));
   createAction( 4044, tr("MEN_CLEAR_CONTAINER"), QIconSet(aPixmap), tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
@@ -1514,8 +1818,8 @@ createPopupMenus()
   mgr->setRule( action( 4016 ), aRule, true );
 
   aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTABLE'";
-  mgr->insert( action(  4022 ), -1, -1, -1 ); // rename table
-  mgr->setRule( action( 4022 ), aRule, true );
+  //mgr->insert( action(  4022 ), -1, -1, -1 ); // rename table
+  //mgr->setRule( action( 4022 ), aRule, true );
   mgr->insert( action(  4023 ), -1, -1, -1 ); // show table
   mgr->setRule( action( 4023 ), aRule, true );
   mgr->insert( action(  4024 ), -1, -1, -1 ); // create curves
@@ -1597,15 +1901,26 @@ createPopupMenus()
   mgr->insert( action(  4061 ), parentId, -1, -1 ); // line width
   mgr->setRule( action( 4061 ), aRule + aLineType + " and hasActor=1", true );
 
+  // rename command
+  QString aCurveType = "$type in {'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'}";
+  aPrsType = "$type in {'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
+             "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
+
+  aRule = "selcount=1 and (type=VISU::TVIEW3D or " + aCurveType + " or " + aPrsType + ")";
+  mgr->insert ( action( 4041 ), -1, -1, -1 ); // rename
+  mgr->setRule( action( 4041 ), aRule, true );
+
+  // copy presentation command
+  aRule = "selcount=1 and " + aPrsType;
+  mgr->insert ( action( 4037 ), -1, -1, -1 ); // copy
+  mgr->setRule( action( 4037 ), aRule, true );
+
   // curve commands
+  aPrsType = "$type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
+             "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
   aRule = "selcount=1 and type='VISU::TCURVE'";
   mgr->insert( action(  4040 ), -1, -1, -1 ); // curve properties
   mgr->setRule( action( 4040 ), aRule, true );
-  mgr->insert( action(  4041 ), -1, -1, -1 ); // rename curve
-  mgr->setRule( action( 4041 ), aRule, true );
-  QString aCurveType = "$type in {'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'}";
-  aPrsType = "$type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' "
-             "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES'}";
   aRule = "client='ObjectBrowser' and selcount>1";
   mgr->insert( action(  4034 ), -1, -1, -1 ); // display many
   mgr->setRule( action( 4034 ), aRule + " and (" + aCurveType + " or " + aPrsType + ")", true );
@@ -1618,8 +1933,8 @@ createPopupMenus()
   aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
   mgr->insert( action(  4042 ), -1, -1, -1 ); // edit container
   mgr->setRule( action( 4042 ), aRule, true );
-  mgr->insert( action(  4043 ), -1, -1, -1 ); // rename container
-  mgr->setRule( action( 4043 ), aRule, true );
+  //mgr->insert( action(  4043 ), -1, -1, -1 ); // rename container
+  //mgr->setRule( action( 4043 ), aRule, true );
   mgr->insert( action(  4044 ), -1, -1, -1 ); // clear container
   mgr->setRule( action( 4044 ), aRule, true );
 
index 7913967581ce4f07afdf439b69f7fed9185768e0..384d587d1968972c53d4b2e63337732ea389fc2a 100644 (file)
@@ -67,6 +67,7 @@ protected slots:
   void OnImportFromFile();
   void OnExploreMEDFile();
   void OnImportTableFromFile();
+  void OnExportTableToFile();
 
   void OnCreateMesh();
   void OnCreateScalarMap();
@@ -113,8 +114,8 @@ protected slots:
   void OnDeleteViewParams();
 
   void OnRename();
-  void OnRenameTable();
-  void OnRenameContainer();
+  //void OnRenameTable();
+  //void OnRenameContainer();
   void OnSweep();
   void OnTimeAnimation();
   
diff --git a/src/VISUGUI/VisuGUI_MagnitudeDlg.cxx b/src/VISUGUI/VisuGUI_MagnitudeDlg.cxx
deleted file mode 100644 (file)
index 1c37476..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-//  VISU VISUGUI : GUI of VISU component
-//
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-//  File   : VisuGUI_MagnitudeDlg.cxx
-//  Author : Laurent CORNABE & Hubert ROLLAND
-//  Module : VISU
-//  $Header$
-
-#include "VisuGUI_MagnitudeDlg.h"
-#include "VisuGUI_Selection.h"
-#include "VISU_DeformedShape_i.hh"
-#include "VisuGUI.h"
-#include "QtxDblSpinBox.h"
-
-#include "SalomeApp_Application.h"
-
-#include "SUIT_Desktop.h"
-
-#include <qlayout.h>
-#include <qtabwidget.h>
-
-using namespace std;
-
-/*!
-  Constructor
-*/
-VisuGUI_MagnitudeDlg::VisuGUI_MagnitudeDlg()
-    : QDialog(VisuGUI::application()->desktop(), "VisuGUI_MagnitudeDlg", true,
-              WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
-{
-  setCaption(tr("DLG_TITLE"));
-  setSizeGripEnabled(TRUE);
-
-  QVBoxLayout* TopLayout = new QVBoxLayout( this ); 
-  TopLayout->setSpacing( 6 );
-  TopLayout->setMargin( 11 );
-  
-  QTabWidget* aTabBox = new QTabWidget(this);
-  
-  QVBox* aBox = new QVBox(this);
-  aBox->setMargin( 11 );
-  QFrame* TopGroup = new QFrame( aBox, "TopGroup" );
-  TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken);
-  TopGroup->setLineWidth(1);
-  QGridLayout* TopGroupLayout = new QGridLayout( TopGroup );
-  TopGroupLayout->setAlignment( Qt::AlignTop | Qt::AlignCenter );
-  TopGroupLayout->setSpacing( 6 );
-  TopGroupLayout->setMargin( 11 );
-
-  QLabel* ScaleLabel = new QLabel (tr("LBL_SCALE_FACTOR"), TopGroup, "ScaleLabel");
-  TopGroupLayout->addWidget( ScaleLabel, 0, 0 );
-
-  ScalFact = new QtxDblSpinBox( 0, 1.0E+38, 0.1, TopGroup );
-  ScalFact->setPrecision( 5 );
-  ScalFact->setValue( 0.1 );
-  TopGroupLayout->addWidget( ScalFact, 0, 1 );
-
-  UseMagn = new QCheckBox (tr("TXT_MAGNITUDE_COLORING"), TopGroup, "UseMagn");
-  UseMagn->setChecked( true );
-  TopGroupLayout->addMultiCellWidget( UseMagn, 1, 1, 0, 1 );
-  //if (!enableUM)
-  //  UseMagn->hide();
-  aTabBox->addTab(aBox, "DeformedShape");
-  
-  myScalarPane = new VisuGUI_ScalarBarPane(this, false);
-  myScalarPane->setMargin( 5 );
-  aTabBox->addTab(myScalarPane, "Scalar Bar");
-
-
-  QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
-
-  QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
-  buttonOk->setAutoDefault( TRUE );
-  buttonOk->setDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-  GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
-  QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
-  buttonCancel->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
-  
-  TopLayout->addWidget( aTabBox );
-  TopLayout->addWidget( GroupButtons );
-
-  // signals and slots connections
-  connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-}
-
-
-void VisuGUI_MagnitudeDlg::initFromPrsObject(VISU::DeformedShape_i* thePrs) {
-  myScalarPane->initFromPrsObject(thePrs);
-  setFactor(thePrs->GetScale());
-  UseMagn->setChecked(thePrs->IsColored());
-}
-
-
-int VisuGUI_MagnitudeDlg::storeToPrsObject(VISU::DeformedShape_i* thePrs) {
-  myScalarPane->storeToPrsObject(thePrs);
-  thePrs->SetScale(getFactor());
-  thePrs->ShowColored(isColored());
-  return 1;
-}
-
-
-void VisuGUI_MagnitudeDlg::accept() {
-  if (myScalarPane->check())  QDialog::accept();
-}
-
diff --git a/src/VISUGUI/VisuGUI_MagnitudeDlg.h b/src/VISUGUI/VisuGUI_MagnitudeDlg.h
deleted file mode 100644 (file)
index 8b55b7f..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-//  VISU VISUGUI : GUI of VISU component
-//
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
-//
-//
-//
-//  File   : VisuGUI_MagnitudeDlg.h
-//  Author : Laurent CORNABE & Hubert ROLLAND 
-//  Module : VISU
-//  $Header$
-
-#ifndef VISUGUI_MAGNITUDEDLG_H
-#define VISUGUI_MAGNITUDEDLG_H
-
-#include "VisuGUI_ScalarBarDlg.h"
-
-#include <qdialog.h>
-#include <qgroupbox.h>
-#include <qcheckbox.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-
-#include "QtxDblSpinBox.h"
-
-namespace VISU{
-  class DeformedShape_i;
-}
-
-class VisuGUI_MagnitudeDlg : public QDialog
-{ 
-    Q_OBJECT
-
-public:
-    VisuGUI_MagnitudeDlg();
-    ~VisuGUI_MagnitudeDlg() {};
-
-    double getFactor() 
-      { return ScalFact->value(); }
-    void setFactor(double theFactor) 
-      { ScalFact->setValue(theFactor); }
-
-    bool isColored()
-      { return UseMagn->isChecked(); }
-
-    void initFromPrsObject(VISU::DeformedShape_i* thePrs);
-    int storeToPrsObject(VISU::DeformedShape_i* thePrs);
-
-protected slots:
-  void accept();
-   
- private:
-    QtxDblSpinBox* ScalFact;
-    QCheckBox* UseMagn;
-    VisuGUI_ScalarBarPane* myScalarPane;
-};
-
-#endif // VISUGUI_MAGNITUDEDLG_H
diff --git a/src/VISUGUI/VisuGUI_NameDlg.cxx b/src/VISUGUI/VisuGUI_NameDlg.cxx
new file mode 100644 (file)
index 0000000..c847861
--- /dev/null
@@ -0,0 +1,134 @@
+//  SALOME VisuGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : VisuGUI_NameDlg.cxx
+//  Author : Vadim SANDLER
+//  Module : SALOME
+//  $Header$
+
+#include "VisuGUI_NameDlg.h"
+
+#include <SUIT_Session.h>
+#include <SUIT_Application.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_Tools.h>
+
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+using namespace std;
+
+/*!
+  Constructor
+*/
+VisuGUI_NameDlg::VisuGUI_NameDlg( QWidget* parent )
+    : QDialog( parent ? parent : SUIT_Session::session()->activeApplication()->desktop(), 
+              "VisuGUI_NameDlg", 
+              true, 
+              WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+  setCaption( tr("TLT_RENAME") );
+  setSizeGripEnabled( TRUE );
+  
+  QVBoxLayout* topLayout = new QVBoxLayout( this );
+  topLayout->setMargin( 11 ); topLayout->setSpacing( 6 );
+
+  /***************************************************************/
+  QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" );
+  GroupC1->setColumnLayout(0, Qt::Vertical );
+  GroupC1->layout()->setMargin( 0 ); GroupC1->layout()->setSpacing( 0 );
+  QHBoxLayout* GroupC1Layout = new QHBoxLayout( GroupC1->layout() );
+  GroupC1Layout->setAlignment( Qt::AlignTop );
+  GroupC1Layout->setMargin( 11 ); GroupC1Layout->setSpacing( 6 );
+  
+  QLabel* TextLabel = new QLabel( GroupC1, "TextLabel1" );
+  TextLabel->setText( tr( "NAME_LBL" ) );
+  GroupC1Layout->addWidget( TextLabel );
+  
+  myLineEdit = new QLineEdit( GroupC1, "LineEdit1" );
+  myLineEdit->setMinimumSize( 250, 0 );
+  GroupC1Layout->addWidget( myLineEdit );
+  
+  /***************************************************************/
+  QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+  GroupButtons->setColumnLayout(0, Qt::Vertical );
+  GroupButtons->layout()->setMargin( 0 ); GroupButtons->layout()->setSpacing( 0 ); 
+  QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() );
+  GroupButtonsLayout->setAlignment( Qt::AlignTop );
+  GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setSpacing( 6 );
+  
+  myButtonOk = new QPushButton( GroupButtons, "buttonOk" );
+  myButtonOk->setText( tr( "BUT_OK"  ) );
+  myButtonOk->setAutoDefault( TRUE ); myButtonOk->setDefault( TRUE );
+  GroupButtonsLayout->addWidget( myButtonOk );
+
+  GroupButtonsLayout->addStretch();
+  
+  myButtonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+  myButtonCancel->setText( tr( "BUT_CANCEL"  ) );
+  myButtonCancel->setAutoDefault( TRUE );
+  GroupButtonsLayout->addWidget( myButtonCancel );
+  /***************************************************************/
+  
+  topLayout->addWidget( GroupC1 );
+  topLayout->addWidget( GroupButtons );
+  
+  // signals and slots connections
+  connect( myButtonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
+  connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+  
+  /* Move widget on the botton right corner of main widget */
+  SUIT_Tools::centerWidget( this, parent );
+}
+
+/*!
+  Destructor
+*/
+VisuGUI_NameDlg::~VisuGUI_NameDlg()
+{
+}
+
+/*!
+  Sets name
+*/
+void VisuGUI_NameDlg::setName( const QString& name )
+{
+  myLineEdit->setText( name );
+  myLineEdit->end(false);
+  myLineEdit->home(true);
+}
+
+/*!
+  Returns name entered by user
+*/
+QString VisuGUI_NameDlg::name()
+{
+  return myLineEdit->text();
+}
+
+void VisuGUI_NameDlg::accept()
+{
+  if ( name().stripWhiteSpace().isEmpty() )
+    return;
+  QDialog::accept();
+}
+
+/*!
+  Creates modal <Rename> dialog and returns name entered [ static ]
+*/
+QString VisuGUI_NameDlg::getName( QWidget* parent, const QString& oldName )
+{
+  QString n;
+  VisuGUI_NameDlg* dlg = new VisuGUI_NameDlg( parent );
+  if ( !oldName.isNull() )
+    dlg->setName( oldName );
+  if ( dlg->exec() == QDialog::Accepted ) 
+    n = dlg->name();
+  delete dlg;
+  return n;
+}
diff --git a/src/VISUGUI/VisuGUI_NameDlg.h b/src/VISUGUI/VisuGUI_NameDlg.h
new file mode 100644 (file)
index 0000000..56a9819
--- /dev/null
@@ -0,0 +1,46 @@
+//  SALOME VisuGUI : implementation of desktop and GUI kernel
+//
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : VisuGUI_NameDlg.h
+//  Author : Vadim SANDLER
+//  Module : SALOME
+//  $Header$
+
+#ifndef VisuGUI_NAMEDLG_H
+#define VisuGUI_NAMEDLG_H
+
+#include <qdialog.h>
+
+class QLineEdit;
+class QPushButton;
+
+//=================================================================================
+// class    : VisuGUI_NameDlg
+// purpose  : Common <Rename> dialog box class
+//=================================================================================
+class VisuGUI_NameDlg : public QDialog
+{ 
+  Q_OBJECT
+
+public:
+  VisuGUI_NameDlg( QWidget* parent = 0 );
+  ~VisuGUI_NameDlg();
+    
+  void            setName( const QString& name );
+  QString         name();
+    
+  static QString  getName( QWidget* parent = 0, const QString& oldName = QString::null );
+    
+protected slots:
+  void accept();
+  
+private:
+  QPushButton*    myButtonOk;
+  QPushButton*    myButtonCancel;
+  QLineEdit*      myLineEdit;
+};
+
+#endif // VisuGUI_NAMEDLG_H
index 26631626238764320223179b15bc84dc28c624d1..6c13db2622202632c0b375094653e7f7a8ed95d9 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
-//#include "VisuGUI_MagnitudeDlg.h"
+#include "VisuGUI_DeformedShapeDlg.h"
 #include "VisuGUI_CutPlanesDlg.h"
 #include "VisuGUI_VectorsDlg.h"
 #include "VisuGUI_IsoSurfacesDlg.h"
@@ -289,7 +289,7 @@ void SetupDlg::onPreferencesDlg()
     }
     break;
   case 3: //Deformed Shape
-    EDITPRS(VISU::DeformedShape_i, VisuGUI_MagnitudeDlg);
+    EDITPRS(VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg);
     break;
   case 4: //Vectors
     EDITPRS(VISU::Vectors_i, VisuGUI_VectorsDlg);
index 953a83efd1e31dce3b2e59381966ce54eb058b22..2b7f006998ff7474143f1193dd41a6d4f7d6ab8c 100644 (file)
@@ -453,6 +453,7 @@ namespace VISU
   Remove(SalomeApp_SelectionMgr* theSelectionMgr,
         const Handle(SALOME_InteractiveObject)& theIO)
   {
+    if (theIO.IsNull()) return;
     SALOME_ListIO aListIO, aNewListIO;
     theSelectionMgr->selectedObjects(aListIO);
     SALOME_ListIteratorOfListIO anIter (aListIO);