]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- treating the closing of the popup window properly
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 8 Feb 2007 12:25:59 +0000 (12:25 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 8 Feb 2007 12:25:59 +0000 (12:25 +0000)
- add an iterator (Next button) for DetElemId
- add more infos while drawing (pad size & motif size)
(Christian)

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

index b9b46bfc110781cac63b1e5deac10bbe797c5be8..3b8c405a70fae2bda1e1506b6c7aa554f6d09d8f 100644 (file)
@@ -70,7 +70,8 @@ AliMpDEVisu::AliMpDEVisu(UInt_t w, UInt_t h)
       fCurrentDetElem(100),
       fCurrentDEName(),
       fSegmentation(),
-      fDDLStore(AliMpDDLStore::Instance())
+      fDDLStore(AliMpDDLStore::Instance()),
+      fNumberOfPopUp(0)
 
 {
 
@@ -126,6 +127,9 @@ AliMpDEVisu::AliMpDEVisu(UInt_t w, UInt_t h)
     fDECombo->Associate(this);
     hframe->AddFrame(fDECombo, new TGLayoutHints(kLHintsLeft, 10, 0, 9, 0));
 
+    TGTextButton *next = new TGTextButton(hframe,"&Next");
+    next->Connect("Clicked()","AliMpDEVisu",this,"NextDE()");
+    hframe->AddFrame(next, new TGLayoutHints(kLHintsLeft | kLHintsCenterY,5,5,3,4));
 
 // DE name
     TGLabel*  detElemName = new TGLabel(hframe, "Name :");
@@ -242,7 +246,7 @@ void AliMpDEVisu::HandleMovement(Int_t eventType, Int_t eventX, Int_t eventY, TO
 {
 /// handle cursor mouvement
 
-    if (eventType == 11) {// 61) {// double click
+    if (eventType == kButton1Down) {
        
       TCanvas *canvas = fEcanvas->GetCanvas();
       canvas->cd(1);
@@ -446,20 +450,21 @@ void AliMpDEVisu::ResetManu()
 void AliMpDEVisu::DeletePopUp() 
 {
 /// delete motif popup windows 
-  
+
     if (fTrashList.GetEntries() > 0) {
       fLogMessage->AddLine("Delete Motif PopUp Windows:");
       fLogMessage->ShowBottom();
 
-//       for (Int_t i = 0; i < fTrashList.GetEntries(); ++i) {
+      for (Int_t i = 0; i < fTrashList.GetEntries(); ++i) {
 
-//     TGTransientFrame* trans = (TGTransientFrame*)fTrashList.At(i);
-//     if (trans)
-//         delete trans;
-//       }
+       TGTransientFrame* trans = (TGTransientFrame*)fTrashList.At(i);
+       if (trans) 
+           trans->CloseWindow();
+      }
 
-      fTrashList.Delete();
-    }
+      fTrashList.Clear();
+      fNumberOfPopUp = 0;
+    } 
 }
 
 //__________________________________________________________
@@ -563,6 +568,21 @@ Bool_t AliMpDEVisu::ProcessMessage(Long_t msg, Long_t parm1, Long_t /*parm2*/)
     return true;
 }
 
+//__________________________________________________________
+void AliMpDEVisu::NextDE()
+{
+/// select next DE
+    Int_t next = fDECombo->GetSelected() + 1;
+
+    if (next < fDECombo->GetNumberOfEntries())
+       fDECombo->Select(fDECombo->GetSelected() + 1);
+    else 
+       fDECombo->Select(0);
+
+    UpdateNameView();
+}
+
 //__________________________________________________________
 void AliMpDEVisu::UpdateComboDE()
 {
@@ -572,6 +592,7 @@ void AliMpDEVisu::UpdateComboDE()
 
     AliMpDEIterator it;
     Int_t i = 0;
+    fDEComboIdx.Reset();
     Char_t text[20];
 
     for ( it.First(fChamberCombo->GetSelected()); ! it.IsDone(); it.Next() ) {
@@ -604,8 +625,11 @@ void AliMpDEVisu::PopUpManuMotif(AliMpSlat* slat)
 
 // Create transient frame
     TGTransientFrame* trans = new TGTransientFrame(fkMainWindow, fMain, 400, 400);
-    trans->DontCallClose();
-    trans->CenterOnParent();
+
+    Char_t slot[255];
+    sprintf(slot, "ClosedPopUpMotif(=%d)", fNumberOfPopUp++);
+
+     trans->Connect("CloseWindow()", "AliMpDEVisu", this, slot);
 
 // fill trash
     fTrashList.Add(trans);
@@ -616,16 +640,20 @@ void AliMpDEVisu::PopUpManuMotif(AliMpSlat* slat)
 
 // Create canvas widget
     TRootEmbeddedCanvas* eTransCanvas = 
-       new TRootEmbeddedCanvas("ETransCanvas",trans,400,400);
+       new TRootEmbeddedCanvas("ETransCanvas", trans, 400, 400);
 
-    trans->AddFrame(eTransCanvas, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 10,10,1,10));
+    trans->AddFrame(eTransCanvas, new TGLayoutHints(kLHintsCenterX,
+                                               5,5,5,5));
+
+    trans->CenterOnParent();
+    trans->Layout();
 
+    TCanvas* canvas = eTransCanvas->GetCanvas();
+    canvas->Clear();
  
 // motif painter
     AliMpMotifPosition* motifPosFound = 0x0;
-
-    TCanvas *canvas = eTransCanvas->GetCanvas();
-    canvas->Clear();
+    AliMpMotifPosition* motifPos = 0x0;
 
     for ( AliMpSlat::Size_t i = 0; i < slat->GetSize(); ++i ) {
 
@@ -634,7 +662,7 @@ void AliMpDEVisu::PopUpManuMotif(AliMpSlat* slat)
 
     for ( AliMpPCB::Size_t j = 0; j < slat->GetPCB(i)->GetSize(); ++j ) {
       
-      AliMpMotifPosition*motifPos = pcb->GetMotifPosition(j);
+      motifPos = pcb->GetMotifPosition(j);
       
       Int_t manuId = motifPos->GetID();
       if (manuId == (Int_t)fNumberEntry->GetIntNumber()) {
@@ -646,31 +674,44 @@ void AliMpDEVisu::PopUpManuMotif(AliMpSlat* slat)
        break;
     delete pcbPainter;
   }  
-
-  if(motifPosFound) {
+    
+    if(motifPosFound) {
 // maps
-    trans->MapSubwindows();
-    trans->MapWindow();
+      trans->MapSubwindows();
+      trans->MapWindow();
 // painter
-    AliMpVPainter* painter = AliMpVPainter::CreatePainter(motifPosFound);
-    painter->Draw("ZT");
+      AliMpVPainter* painter = AliMpVPainter::CreatePainter(motifPosFound);
+      painter->Draw("ZT");
 // canvas
-    canvas->Update();
-
+      canvas->Update();
   }
+    TVector2 dimension(motifPos->Dimensions());
+
+    Char_t log[255];
  
+    sprintf(log, "PopupManuMotif: motif dimension: %5.2f, %5.2f", dimension.X()*2., dimension.Y()*2.);
+    fLogMessage->AddLine(log);
+
+   sprintf(log, "PopupManuMotif: pad dimension: %4.2f, %4.2f", 
+          motifPos->GetMotif()->GetPadDimensions(0).X()*2.,  
+          motifPos->GetMotif()->GetPadDimensions(0).Y()*2. );
+
+    fLogMessage->AddLine(log);
 
+    fLogMessage->ShowBottom();
 }
 //__________________________________________________________
 void AliMpDEVisu::PopUpManuMotif(AliMpSector* sector)
 {
-
 /// pop up manu window motif painter for sector
 
 // Create transient frame
     TGTransientFrame* trans = new TGTransientFrame(fkMainWindow, fMain, 400, 400);
-    trans->DontCallClose();
-    trans->CenterOnParent();
+
+    Char_t slot[255];
+    sprintf(slot, "ClosedPopUpMotif(=%d)", fNumberOfPopUp++);
+
+     trans->Connect("CloseWindow()", "AliMpDEVisu", this, slot);
 
 // fill trash
     fTrashList.Add(trans);
@@ -681,18 +722,22 @@ void AliMpDEVisu::PopUpManuMotif(AliMpSector* sector)
 
 // Create canvas widget
     TRootEmbeddedCanvas* eTransCanvas = 
-       new TRootEmbeddedCanvas("ETransCanvas",trans,400,400);
+       new TRootEmbeddedCanvas("ETransCanvas", trans, 400, 400);
 
-    trans->AddFrame(eTransCanvas, new TGLayoutHints(kLHintsLeft | kLHintsCenterY,
-                                               10,10,1,10));
+    trans->AddFrame(eTransCanvas, new TGLayoutHints(kLHintsCenterX,
+                                               5,5,5,5));
 
-// motif painter
-    AliMpMotifPosition* motifPosFound = 0x0;
+    trans->CenterOnParent();
+    trans->Layout();
 
-    TCanvas *canvas = eTransCanvas->GetCanvas();
+    TCanvascanvas = eTransCanvas->GetCanvas();
     canvas->Clear();
 
-    for (Int_t iRow = 0; iRow < sector->GetNofRows(); ++iRow) {
+// motif painter
+    AliMpMotifPosition* motifPosFound = 0x0;
+    AliMpMotifPosition* motifPos = 0x0;
+
+     for (Int_t iRow = 0; iRow < sector->GetNofRows(); ++iRow) {
 
       AliMpRow* row = sector->GetRow(iRow);
       AliMpRowPainter* rowPainter = new  AliMpRowPainter(row);
@@ -705,7 +750,7 @@ void AliMpDEVisu::PopUpManuMotif(AliMpSector* sector)
          for (Int_t iMotif = 0; iMotif < rowSegment->GetNofMotifs(); ++iMotif){
 
            Int_t motifPositionId = rowSegment->GetMotifPositionId(iMotif);
-           AliMpMotifPosition *motifPos = rowSegment->GetRow()
+           motifPos = rowSegment->GetRow()
                ->GetMotifMap()->FindMotifPosition(motifPositionId);
                
            Int_t manuId = motifPos->GetID();
@@ -733,4 +778,29 @@ void AliMpDEVisu::PopUpManuMotif(AliMpSector* sector)
 // canvas
       canvas->Update();
     }
+
+    TVector2 dimension(motifPos->Dimensions());
+
+    Char_t log[255];
+    sprintf(log, "PopupManuMotif: motif dimension: %5.2f, %5.2f", dimension.X()*2., dimension.Y()*2.);
+    fLogMessage->AddLine(log);
+
+    sprintf(log, "PopupManuMotif: pad dimension: %4.2f, %4.2f", 
+          motifPos->GetMotif()->GetPadDimensions(0).X()*2.,  
+          motifPos->GetMotif()->GetPadDimensions(0).Y()*2. );
+
+    fLogMessage->AddLine(log);
+
+    fLogMessage->ShowBottom();
+
+}
+
+//__________________________________________________________
+void AliMpDEVisu::ClosedPopUpMotif(Int_t id)
+{
+/// close signal
+
+    TGTransientFrame* trans = (TGTransientFrame*)fTrashList.At(id);
+    fTrashList.Remove(trans);
 }
index 0553140b3f80c8ba40daaf71e88103c2648ba6ab..f03f98027c95e2a7c5857786297a4c104d1aef17 100644 (file)
@@ -43,6 +43,7 @@ public:
     void   UpdateComboDE();
     Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
     void   DrawDE();
+    void   NextDE();
     void   DrawManuMotif(Bool_t popup = kFALSE);
     void   DrawQuadrant(Option_t* option, Bool_t popup = kFALSE);
     void   DrawSlat(Option_t* option, Bool_t popup = kFALSE);
@@ -51,6 +52,8 @@ public:
     void   UpdateNameView();
     void   PopUpManuMotif(AliMpSlat* slat);
     void   PopUpManuMotif(AliMpSector* sector);
+
+    void   ClosedPopUpMotif(Int_t id);
     void   InfoDE();
     void   DeletePopUp();
     void   SaveLogMessage();
@@ -82,6 +85,8 @@ private:
     const AliMpVSegmentation* fSegmentation; //!< segmentation instance
     AliMpDDLStore*            fDDLStore;     //!< DDL Store
 
+    Int_t            fNumberOfPopUp;   //!< number of manu motif popup window open    
+
     enum {kChamberCombo, kDECombo, kPlaneType, kDEName, kManuEntries, kLogMessage};