LCOV - code coverage report
Current view: top level - MUON/MUONgraphics - AliMUONAttPainterSelectorFrame.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 85 1.2 %
Date: 2016-06-14 17:26:59 Functions: 1 13 7.7 %

          Line data    Source code
       1             : /**************************************************************************
       2             : * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             : *                                                                        *
       4             : * Author: The ALICE Off-line Project.                                    *
       5             : * Contributors are mentioned in the code where appropriate.              *
       6             : *                                                                        *
       7             : * Permission to use, copy, modify and distribute this software and its   *
       8             : * documentation strictly for non-commercial purposes is hereby granted   *
       9             : * without fee, provided that the above copyright notice appears in all   *
      10             : * copies and that both the copyright notice and this permission notice   *
      11             : * appear in the supporting documentation. The authors make no claims     *
      12             : * about the suitability of this software for any purpose. It is          *
      13             : * provided "as is" without express or implied warranty.                  *
      14             : **************************************************************************/
      15             : 
      16             : // $Id$
      17             : 
      18             : ///\class AliMUONAttPainterSelectorFrame
      19             : ///
      20             : /// Widget to select painter view type
      21             : ///
      22             : ///\author Laurent Aphecetche, Subatech
      23             : 
      24             : #include "AliMUONAttPainterSelectorFrame.h"
      25             : 
      26             : #include "AliMUONAttPainter.h"
      27             : #include "AliMUONPainterInterfaceHelper.h"
      28             : #include "AliLog.h"
      29             : #include <TGButton.h>
      30             : #include <TGButtonGroup.h>
      31             : 
      32             : ///\cond CLASSIMP
      33          12 : ClassImp(AliMUONAttPainterSelectorFrame)
      34             : ///\endcond
      35             : 
      36             : //_____________________________________________________________________________
      37             : AliMUONAttPainterSelectorFrame::AliMUONAttPainterSelectorFrame(TGWindow* p, UInt_t w, UInt_t h)
      38           0 : : TGHorizontalFrame(p,w,h),
      39           0 : fCathode(0x0),
      40           0 : fPlane(0x0),
      41           0 : fViewPoint(0x0),
      42           0 : fAttributes()
      43           0 : {
      44             :   /// ctor
      45             :   
      46           0 :   fCathode = new TGButtonGroup(this,"Cathode",kHorizontalFrame);
      47             : 
      48           0 :   fAttributes.SetCathode(kTRUE,kFALSE);
      49           0 :   AliMUONPainterInterfaceHelper::AddRadioButton(*fCathode,fAttributes.CathodeName(),(void*)(10));
      50           0 :   fAttributes.SetCathode(kFALSE,kTRUE);
      51           0 :   AliMUONPainterInterfaceHelper::AddRadioButton(*fCathode,fAttributes.CathodeName(),(void*)(1));
      52             :                                                 
      53           0 :   fPlane = new TGButtonGroup(this,"Plane",kHorizontalFrame);
      54             :   
      55           0 :   fAttributes.SetPlane(kTRUE,kFALSE);
      56           0 :   AliMUONPainterInterfaceHelper::AddRadioButton(*fPlane,fAttributes.PlaneName(),(void*)(10));
      57           0 :   fAttributes.SetPlane(kFALSE,kTRUE);
      58           0 :   AliMUONPainterInterfaceHelper::AddRadioButton(*fPlane,fAttributes.PlaneName(),(void*)(1));
      59             : 
      60           0 :   fViewPoint = new TGButtonGroup(this,"ViewPoint",kHorizontalFrame);
      61             : 
      62           0 :   fAttributes.SetViewPoint(kTRUE,kFALSE);
      63           0 :   AliMUONPainterInterfaceHelper::AddRadioButton(*fViewPoint,fAttributes.ViewPointName(),(void*)(10));
      64           0 :   fAttributes.SetViewPoint(kFALSE,kTRUE);
      65           0 :   AliMUONPainterInterfaceHelper::AddRadioButton(*fViewPoint,fAttributes.ViewPointName(),(void*)(1));
      66             : 
      67           0 :   fViewPoint->SetState(kFALSE); //FIXME: until we're sure back views are handled correctly
      68             :   
      69           0 :   AddFrame(fCathode);
      70           0 :   AddFrame(fPlane);
      71           0 :   AddFrame(fViewPoint);
      72             :   
      73           0 :   fCathode->Connect("Clicked(Int_t)","AliMUONAttPainterSelectorFrame",this,"CathodeClicked(Int_t)");
      74           0 :   fPlane->Connect("Clicked(Int_t)","AliMUONAttPainterSelectorFrame",this,"PlaneClicked(Int_t)");
      75           0 :   fViewPoint->Connect("Clicked(Int_t)","AliMUONAttPainterSelectorFrame",this,"ViewClicked(Int_t)");
      76           0 : }
      77             : 
      78             : //_____________________________________________________________________________
      79           0 : AliMUONAttPainterSelectorFrame::~AliMUONAttPainterSelectorFrame()
      80           0 : {
      81             :   /// dtor
      82           0 : }
      83             : 
      84             : //_____________________________________________________________________________
      85             : void
      86             : AliMUONAttPainterSelectorFrame::CathodeClicked(Int_t buttonId)
      87             : {
      88             :   /// Cathode button clicked
      89             :   
      90           0 :   fAttributes.SetPlane(kFALSE,kFALSE);
      91             : 
      92           0 :   TGButton* button = fCathode->GetButton(buttonId);
      93             :   
      94           0 :   Long_t i = reinterpret_cast<Long_t>(button->GetUserData());
      95             :   
      96           0 :   if ( i == 10 ) 
      97             :   {
      98           0 :     fAttributes.SetCathode(kTRUE,kFALSE);
      99           0 :   }
     100           0 :   else if ( i == 1 ) 
     101             :   {
     102           0 :     fAttributes.SetCathode(kFALSE,kTRUE);
     103           0 :   }
     104             :   else
     105             :   {
     106           0 :     AliFatal("");
     107             :   }
     108             :   
     109           0 :   Clicked(&fAttributes);
     110           0 : }
     111             : 
     112             : //_____________________________________________________________________________
     113             : void
     114             : AliMUONAttPainterSelectorFrame::PlaneClicked(Int_t buttonId)
     115             : {
     116             :   /// Plane button clicked
     117             :   
     118           0 :   fAttributes.SetCathode(kFALSE,kFALSE);
     119             :   
     120           0 :   TGButton* button = fPlane->GetButton(buttonId);
     121             :   
     122           0 :   Long_t i = reinterpret_cast<Long_t> (button->GetUserData());
     123             :   
     124           0 :   if ( i == 10 ) 
     125             :   {
     126           0 :     fAttributes.SetPlane(kTRUE,kFALSE);
     127           0 :   }
     128           0 :   else if ( i == 1 ) 
     129             :   {
     130           0 :     fAttributes.SetPlane(kFALSE,kTRUE);
     131           0 :   }
     132             :   else
     133             :   {
     134           0 :     AliFatal("");
     135             :   }
     136             :   
     137           0 :   Clicked(&fAttributes);
     138             :   
     139           0 : }
     140             : 
     141             : //_____________________________________________________________________________
     142             : void
     143             : AliMUONAttPainterSelectorFrame::ViewClicked(Int_t buttonId)
     144             : {
     145             :   /// View button clicked
     146             : 
     147           0 :   TGButton* button = fViewPoint->GetButton(buttonId);
     148             :   
     149           0 :   Long_t i = reinterpret_cast<Long_t> (button->GetUserData());
     150             :   
     151           0 :   if ( i == 10 ) 
     152             :   {
     153           0 :     fAttributes.SetViewPoint(kTRUE,kFALSE);
     154           0 :   }
     155           0 :   else if ( i == 1 ) 
     156             :   {
     157           0 :     fAttributes.SetViewPoint(kFALSE,kTRUE);
     158           0 :   }
     159             :   else
     160             :   {
     161           0 :     AliFatal("");
     162             :   }
     163             :   
     164           0 :   Clicked(&fAttributes);
     165             :   
     166           0 : }
     167             : 
     168             : //_____________________________________________________________________________
     169             : void
     170             : AliMUONAttPainterSelectorFrame::Clicked(const AliMUONAttPainter* newValues)
     171             : {
     172             :   /// Emit a signal
     173             :   
     174           0 :   Long_t params[] = { (Long_t)newValues };
     175             :   
     176           0 :   Emit("Clicked(AliMUONAttPainter*)",params);
     177           0 : }
     178             : 
     179             : //_____________________________________________________________________________
     180             : void
     181             : AliMUONAttPainterSelectorFrame::Update(const AliMUONAttPainter& att)
     182             : {
     183             :   /// Update button state from the painter attributes
     184             : 
     185           0 :   AliMUONPainterInterfaceHelper::Unselect(*fCathode,"*");
     186           0 :   AliMUONPainterInterfaceHelper::Unselect(*fPlane,"*");
     187           0 :   AliMUONPainterInterfaceHelper::Unselect(*fViewPoint,"*");
     188             : 
     189           0 :   fAttributes = att;
     190             :   
     191           0 :   fCathode->SetState(!fAttributes.IsCathodeAndPlaneDisabled());
     192           0 :   fPlane->SetState(!fAttributes.IsCathodeAndPlaneDisabled());
     193             : 
     194           0 :   if ( fAttributes.IsCathodeDefined() ) 
     195             :   {
     196           0 :     AliMUONPainterInterfaceHelper::Select(*fCathode,fAttributes.CathodeName());
     197           0 :   }
     198             :   
     199           0 :   if ( fAttributes.IsPlaneDefined() ) 
     200             :   {
     201           0 :     AliMUONPainterInterfaceHelper::Select(*fPlane,fAttributes.PlaneName());
     202           0 :   }
     203             :   
     204           0 :   AliMUONPainterInterfaceHelper::Select(*fViewPoint,fAttributes.ViewPointName());
     205             :   
     206           0 : }

Generated by: LCOV version 1.11