From 0991f86153107e6b3a6b644b57543f6b0d50f3ec Mon Sep 17 00:00:00 2001 From: jfa Date: Wed, 20 Jul 2005 06:38:02 +0000 Subject: [PATCH] IPAL9429: Import Field popup-menu item added for MED fields --- src/VISUGUI/VISU_msg_en.po | 8 +++++- src/VISUGUI/VisuGUI.cxx | 47 +++++++++++++++++++++----------- src/VISUGUI/VisuGUI_ActionsDef.h | 6 ++-- 3 files changed, 42 insertions(+), 19 deletions(-) diff --git a/src/VISUGUI/VISU_msg_en.po b/src/VISUGUI/VISU_msg_en.po index 19fe079e..a5519dac 100644 --- a/src/VISUGUI/VISU_msg_en.po +++ b/src/VISUGUI/VISU_msg_en.po @@ -242,9 +242,15 @@ msgstr "Global Selection" msgid "VisuGUI::MEN_PARTIAL_SELECTION" msgstr "Partial Selection" -msgid "VisuGUI::MEN_IMPORT_MED" +msgid "VisuGUI::MEN_IMPORT_MED_STRUCTURE" msgstr "Import Structure" +msgid "VisuGUI::MEN_IMPORT_MED_TIMESTAMP" +msgstr "Import TimeStamp" + +msgid "VisuGUI::MEN_IMPORT_MED_FIELD" +msgstr "Import Field" + msgid "VisuGUI::MEN_DELETE_OBJS" msgstr "Delete" diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 0d31866c..506f77e0 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -2114,8 +2114,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("")); @@ -2374,7 +2382,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 @@ -2591,8 +2599,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 type='MEDFIELD'"; + //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true ); } //*************************************************************************** @@ -2618,6 +2626,7 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q _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); @@ -2631,17 +2640,23 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q 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" } } } diff --git a/src/VISUGUI/VisuGUI_ActionsDef.h b/src/VISUGUI/VisuGUI_ActionsDef.h index 416578ac..94e1ed64 100644 --- a/src/VISUGUI/VisuGUI_ActionsDef.h +++ b/src/VISUGUI/VisuGUI_ActionsDef.h @@ -7,8 +7,10 @@ //#define VISU_IMPORT_TABLE 199 #define VISU_IMPORT_FROM_FILE 4002 #define VISU_EXPLORE_MED 4003 -#define VISU_IMPORT_MED 4004 -#define VISU_IMPORT_TABLE 4005 +#define VISU_IMPORT_TABLE 4004 +#define VISU_IMPORT_MED_STRUCTURE 4005 +#define VISU_IMPORT_MED_TIMESTAMP 4006 +#define VISU_IMPORT_MED_FIELD 4007 #define VISU_SCALAR_MAP 4011 #define VISU_DEFORMED_SHAPE 4012 -- 2.39.2