]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Updating Mode combobox with the names of components
authorpkv <pkv@opencascade.com>
Wed, 21 Sep 2005 15:05:57 +0000 (15:05 +0000)
committerpkv <pkv@opencascade.com>
Wed, 21 Sep 2005 15:05:57 +0000 (15:05 +0000)
src/VISUGUI/VisuGUI_ScalarBarDlg.cxx

index 6a24502f209e0062666744fa1f2d6d2094f3025b..62a3a4b637465d9f0ced0e9d582eee80a142ce61 100644 (file)
@@ -506,7 +506,6 @@ void VisuGUI_ScalarBarPane::storeToResources() {
  */
 void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) {
   initFromResources();
-  myModeCombo->setCurrentItem(thePrs->GetScalarMode());
   setPosAndSize( thePrs->GetPosX(),
                 thePrs->GetPosY(),
                 thePrs->GetWidth(),
@@ -525,7 +524,27 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) {
   setRange( thePrs->GetMin(), thePrs->GetMax(),
            /*0.0, 0.0,*/ thePrs->IsRangeFixed() );
   setScalarBarData( thePrs->GetNbColors(), thePrs->GetLabels() );
-  bool isScalarMode = (thePrs->GetField()->myNbComp > 1);
+  //
+  int aNbComp=thePrs->GetField()->myNbComp;
+  bool isScalarMode = (aNbComp > 1);
+  //
+  // update myModeCombo
+  VISU::TNames& aNamesOfComponents    =thePrs->GetField()->myCompNames;
+  VISU::TNames& aUnitNamesOfComponents=thePrs->GetField()->myUnitNames;
+  myModeCombo->clear();
+  myModeCombo->insertItem("<Modulus>");
+  for (int i=1; i<=aNbComp; ++i) {
+    VISU::TName  aNmUn=aNamesOfComponents[i-1];
+    VISU::TName& aUnits=aUnitNamesOfComponents[i-1];
+    if (!aUnits.empty()) {
+      aNmUn+=", ";
+      aNmUn+=aUnits;
+    }
+    myModeCombo->insertItem(aNmUn);
+  }
+  //
+  myModeCombo->setCurrentItem(thePrs->GetScalarMode());
+  //
   myModeLbl->setEnabled(isScalarMode);
   myModeCombo->setEnabled(isScalarMode);