Adding new option to get the DE by its name (moreover to get it by its ID).
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 May 2007 11:14:43 +0000 (11:14 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 May 2007 11:14:43 +0000 (11:14 +0000)
(Christian)

MUON/mapping/AliMpDEVisu.cxx
MUON/mapping/AliMpDEVisu.h

index 4d5ebfc..c1de220 100644 (file)
@@ -160,7 +160,7 @@ AliMpDEVisu::AliMpDEVisu(UInt_t w, UInt_t h)
   fCurrentDEName = detElem->GetDEName();
   fNameDECombo = new  TGComboBox(hframe, kDEName);
 
-  UpdateNameView();
+  UpdateNameView(kTRUE);
   fNameDECombo->Resize(160, 20);
   fNameDECombo->Select(0);
   fNameDECombo->Associate(this);
@@ -367,6 +367,10 @@ void AliMpDEVisu::DrawDE(Bool_t info)
   fEcanvas->GetCanvas()->cd();
   fEcanvas->GetCanvas()->SetEditable(kTRUE);
   
+  fNameDECombo->Select(fDEOccurrence[fCurrentDetElem]);
+  TGLBEntry* entry = fNameDECombo->GetSelectedEntry();
+  entry->SetBackgroundColor(0xDDDDDD);
+
   if (AliMpDEManager::GetStationType(fCurrentDetElem) == AliMp::kStation345 ) {
     
     DrawSlat("PMCI");
@@ -605,7 +609,7 @@ Bool_t AliMpDEVisu::ProcessMessage(Long_t msg, Long_t parm1, Long_t /*parm2*/)
           {
             case kChamberCombo: 
               UpdateComboDE();
-              UpdateNameView();
+              UpdateNameView(kTRUE);
               break;
               
             case kDECombo:
@@ -676,13 +680,13 @@ void AliMpDEVisu::UpdateComboCH()
 
     AliMpDetElement* detElem = AliMpDEManager::GetDetElement(fCurrentDEName);
 
-    Int_t Idx =  AliMpDEManager::GetChamberId(detElem->GetId());
-    fChamberCombo->Select(Idx);
+    Int_t idx =  AliMpDEManager::GetChamberId(detElem->GetId());
+    fChamberCombo->Select(idx);
 
     UpdateComboDE();
 
-    Idx = detElem->GetId() % 100;
-    fDECombo->Select(Idx);
+    idx = detElem->GetId() % 100;
+    fDECombo->Select(idx);
 
     fCurrentDetElem = fDEComboIdx[fDECombo->GetSelected()];
 
@@ -709,7 +713,7 @@ void AliMpDEVisu::UpdateComboDE()
 }
 
 //__________________________________________________________
-void AliMpDEVisu::UpdateNameView()
+void AliMpDEVisu::UpdateNameView(Bool_t firstTime)
 {
   /// update DE name in respect to selected DE id.
     
@@ -719,11 +723,21 @@ void AliMpDEVisu::UpdateNameView()
 
   fCurrentDEName = detElem->GetDEName();
 
-  Int_t entry = fNameDECombo->GetNumberOfEntries();
-  if (fDEOccurrence[fCurrentDetElem] == -1) {
-      fNameDECombo->AddEntry(fCurrentDEName.Data(), entry);
-      fNameDEComboIdx[entry] = fCurrentDEName;
-      fDEOccurrence[fCurrentDetElem] = entry;
+  if (firstTime) {
+    AliMpDEIterator it;
+    fNameDECombo->RemoveAll();
+  
+    for ( it.First(fChamberCombo->GetSelected()); !it.IsDone(); it.Next() ) {
+
+      Int_t detElemId = it.CurrentDE()->GetId();
+      TString deName  = it.CurrentDE()->GetDEName();
+
+      Int_t idx = fNameDECombo->GetNumberOfEntries();
+      fNameDECombo->AddEntry(deName.Data(), idx);
+      fNameDEComboIdx[idx]   = deName;
+      fDEOccurrence[detElemId] = idx;
+    }
   }
 
   fNameDECombo->Select(fDEOccurrence[fCurrentDetElem]);
index 53bf514..93a3e0c 100644 (file)
@@ -53,7 +53,7 @@ public:
     void   DrawSlat(Option_t* option, Bool_t popup = kFALSE);
 
     void   ResetManu();
-    void   UpdateNameView();
+    void   UpdateNameView(Bool_t firstTime = kFALSE);
     void   PopUpManuMotif(AliMpSlat* slat);
     void   PopUpManuMotif(AliMpSector* sector);
     void   PopUpZoom(Int_t ix0, Int_t iy0, Int_t ix1, Int_t iy1);