#include <TCanvas.h>
#include <TEnv.h>
#include <TGComboBox.h>
+#include <TGFileDialog.h>
#include <TGLabel.h>
#include <TObjArray.h>
#include <TObjString.h>
#include <TGButtonGroup.h>
#include <TGMsgBox.h>
+#include <TSystem.h>
/// \class AliMUONPainterMasterFrame
///
//_____________________________________________________________________________
AliMUONPainterMasterFrame::AliMUONPainterMasterFrame(const TGWindow* p,
- UInt_t w, UInt_t h)
+ UInt_t w, UInt_t h, AliMUONPainterMatrix* matrix)
: TGCompositeFrame(p,w,h,kVerticalFrame),
- fNavigationFrame(0x0),
- fPainterMatrixFrame(0x0),
- fBackButton(0x0),
- fForwardButton(0x0),
- fGroupTitle(0x0),
- fNavigation(),
- fCurrentNavigationPosition(-1),
- fAttPainterSelectorFrame(0x0)
+fNavigationFrame(0x0),
+fPainterMatrixFrame(0x0),
+fBackButton(0x0),
+fForwardButton(0x0),
+fGroupTitle(0x0),
+fPrintMeButton(0x0),
+fPrintAsButton(0x0),
+fNavigation(),
+fCurrentNavigationPosition(-1),
+fAttPainterSelectorFrame(0x0)
{
/// ctor
AddFrame(fNavigationFrame,new TGLayoutHints(kLHintsExpandX|kLHintsTop,
fgkBorderSize,fgkBorderSize,
fgkBorderSize,fgkBorderSize));
-
+
fBackButton = new TGPictureButton(fNavigationFrame,
- gClient->GetPicture("tb_back.xpm"));
+ gClient->GetPicture("tb_back.xpm"));
fForwardButton = new TGPictureButton(fNavigationFrame,
- gClient->GetPicture("tb_forw.xpm"));
+ gClient->GetPicture("tb_forw.xpm"));
+
+ fPrintMeButton = new TGTextButton(fNavigationFrame,"Print");
+ fPrintAsButton = new TGTextButton(fNavigationFrame,"Print As...");
fAttPainterSelectorFrame = new AliMUONAttPainterSelectorFrame(fNavigationFrame,w/2,20);
fNavigationFrame->AddFrame(fForwardButton,new TGLayoutHints(kLHintsCenterY));
fNavigationFrame->AddFrame(fAttPainterSelectorFrame,new TGLayoutHints(kLHintsCenterY,10));
-
+
+ fNavigationFrame->AddFrame(fPrintMeButton,new TGLayoutHints(kLHintsCenterY,10));
+ fNavigationFrame->AddFrame(fPrintAsButton,new TGLayoutHints(kLHintsCenterY,10));
+
fAttPainterSelectorFrame->Connect("Clicked(AliMUONAttPainter*)",
"AliMUONPainterMasterFrame",
this,
this,
"Backward()");
+ fPrintMeButton->Connect("Clicked()","AliMUONPainterMasterFrame",
+ this,
+ "PrintMe()");
+
+ fPrintAsButton->Connect("Clicked()","AliMUONPainterMasterFrame",
+ this,
+ "PrintAs()");
-
UInt_t w1 = wi;
// UInt_t h1 = hi - fNavigationFrame->GetHeight() - 3*fgkBorderSize;
UInt_t h1 = hi - 7*12;
- MakeTopPainterMatrix(w1,h1);
+ MakeTopPainterMatrix(w1,h1,matrix);
AddFrame(fPainterMatrixFrame,new TGLayoutHints(kLHintsExpandX,
fgkBorderSize,fgkBorderSize,
this,
"PainterMatrixWantToShow(AliMUONPainterMatrix*)");
- fPainterMatrixFrame->DataSourceWasChanged("*",0x0,-1);
+ fPainterMatrixFrame->DataSourceWasChanged(matrix->DataPattern().Data(),matrix->Data(),matrix->DataIndex());
}
//_____________________________________________________________________________
ShowPainterMatrix(group);
}
-
+
+//_____________________________________________________________________________
+void
+AliMUONPainterMasterFrame::PrintAs() const
+{
+ /// Handle the PrintAs button
+
+ TGFileInfo fileInfo;
+
+ new TGFileDialog(gClient->GetRoot(),gClient->GetRoot(),
+ kFDSave,&fileInfo);
+
+ if ( fileInfo.fFilename )
+ {
+ SaveAs(gSystem->ExpandPathName(Form("%s",fileInfo.fFilename)),"RECREATE");
+ }
+}
+
+//_____________________________________________________________________________
+void
+AliMUONPainterMasterFrame::PrintMe() const
+{
+ /// Handle the PrintMe button
+
+ SaveAs(gSystem->ExpandPathName(Form("%s.png",fPainterMatrixFrame->Matrix()->GetName())),"RECREATE");
+}
+
//_____________________________________________________________________________
void
AliMUONPainterMasterFrame::SetNavigation(Int_t i)
TString basename(Form("%s-DUAL",painter->GetName()));
- TString newName = AliMUONPainterMatrix::NameIt(basename.Data(),a);
+ TString newName = AliMUONPainterMatrix::NameIt(currentMatrix->Whatname(),basename.Data(),a);
AliMUONPainterMatrix* matrix = AliMUONPainterRegistry::Instance()->PainterMatrix(newName.Data());
// create "opposite" attributes
AliMUONAttPainter a1(a);
AliMUONAttPainter a2(a);
-
- if ( a.IsCathodeDefined() )
- {
- a2.SetCathode(!a.IsCathode0(),!a.IsCathode1());
- }
-
- if ( a.IsPlaneDefined() )
- {
- a2.SetPlane(!a.IsBendingPlane(),!a.IsNonBendingPlane());
- }
+
+ a2.Invert();
a1.SetCathodeAndPlaneDisabled(kTRUE);
a2.SetCathodeAndPlaneDisabled(kTRUE);
AliMpArea area(painter->Area());
- if ( area.Dimensions().X() > 1.2*area.Dimensions().Y() )
+ if ( area.GetDimensionX() > 1.2*area.GetDimensionY() )
{
nx = 1;
ny = 2;
/// Update ourselves
fPainterMatrixFrame->Update();
+ fPainterMatrixFrame->UpdateInterface(kFALSE);
}
//_____________________________________________________________________________
//_____________________________________________________________________________
void
-AliMUONPainterMasterFrame::MakeTopPainterMatrix(UInt_t w, UInt_t h)
+AliMUONPainterMasterFrame::MakeTopPainterMatrix(UInt_t w, UInt_t h, AliMUONPainterMatrix* matrix)
{
/// Create the first painter matrix that appears when we are create
/// FIXME: how to make this more flexible ?
fPainterMatrixFrame = new AliMUONPainterMatrixFrame(this,w,h);
- AliMUONAttPainter att;
-
- att.SetPlane(kTRUE,kFALSE);
-// att.SetCathode(kTRUE,kFALSE);
- att.SetViewPoint(kTRUE,kFALSE);
-
- TString name = AliMUONPainterMatrix::NameIt("Tracker",att);
-
- AliMUONPainterMatrix* painterMatrix = AliMUONPainterRegistry::Instance()->PainterMatrix(name);
-
- if (!painterMatrix)
+ if (matrix)
{
- AliError(Form("Could not get pre-defined painter matrix %s : check that !",name.Data()));
+ PainterMatrixWantToShow(matrix);
}
else
{
- PainterMatrixWantToShow(painterMatrix);
-// fPainterMatrixFrame->Use(painterMatrix);
-// ShowPainterMatrix(painterMatrix);
+ AliError("Cannot work without a painterMatrix");
}
}
// First check if we already have this matrix available
- TString newName = AliMUONPainterMatrix::NameIt(currentMatrix->Basename(),a);
+ TString newName = AliMUONPainterMatrix::NameIt(currentMatrix->Whatname(),currentMatrix->Basename(),a);
AliMUONPainterMatrix* matrix = AliMUONPainterRegistry::Instance()->PainterMatrix(newName.Data());