source: trunk/MagicSoft/Mars/mtools/MagicJam.h@ 9488

Last change on this file since 9488 was 8988, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 4.7 KB
Line 
1#ifndef MARS_MagicJam
2#define MARS_Magicjam
3
4#ifndef MARS_MHCamera
5#include "MHCamera.h"
6#endif
7
8// --------------------------------------------------------------------
9
10class MagicJamAbc : public MHCamera
11{
12public:
13 // Remove this items from the context menu
14 void SetLineAttributes() { }
15 void SetFillAttributes() { }
16 void SetMarkerAttributes() { }
17 void SetName(const char *name) { MHCamera::SetName(name); }
18 void SetTitle(const char *name) { MHCamera::SetTitle(name); }
19 TH1 *DrawCopy(const Option_t *o="") const { return MHCamera::DrawCopy(o); }
20 void PrintInfo() const { }
21 void SetDrawOption(Option_t *option="") { MHCamera::SetDrawOption(option); }
22 Int_t Fit(const char *formula ,Option_t *option="" ,Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0) { return 0; }
23 Int_t Fit(TF1 *f1 ,Option_t *option="" ,Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0) { return 0; }
24 void SetMaximum(Double_t maximum=-1111) { MHCamera::SetMaximum(maximum); }
25 void SetMinimum(Double_t minimum=-1111) { MHCamera::SetMinimum(minimum); }
26 void Add(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1) { }
27 void Add(TF1 *h1, Double_t c1, Option_t *) { }
28 void Add(const TH1 *h1, Double_t c1=1) { }
29 void Divide(TF1 *f1, Double_t c1=1) { }
30 void Divide(const TH1 *h1) { }
31 void Divide(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option="") { }
32 void Multiply(TF1 *h1, Double_t c1=1) { }
33 void Multiply(const TH1 *h1) { }
34 void Multiply(const TH1 *h1, const TH1 *h2, Double_t c1=1, Double_t c2=1, Option_t *option="") { }
35 void Smooth(int, int, int) { }
36 void Smooth(int, const Option_t *) { }
37 void SetPrettyPalette() {}
38 void SetDeepBlueSeaPalette() {}
39 void SetInvDeepBlueSeaPalette() {}
40 void SetFreezed(Bool_t f=kTRUE) { }
41 void SetAbberation(Float_t f=0.0713) { }
42 void SetAutoScale() { }
43 void SetMinMax(Double_t min=-1111, Double_t max=-1111) { SetMinimum(min); SetMaximum(max); }
44 TH1 *ShowBackground(Int_t niter=2, Option_t *option="same") { return 0; }
45 Int_t ShowPeaks(Double_t sigma=2, Option_t *option="", Double_t threshold=0.05) { return 0; }
46 void SetErrorSpread(Bool_t f=kTRUE) { }
47
48 // Make the full pad sensible for the context menu
49 Int_t DistancetoPrimitive(Int_t px, Int_t py) { return 0; }
50
51 ClassDef(MagicJamAbc, 0) // Helper class for MagicJam
52};
53
54// --------------------------------------------------------------------
55class TASImage;
56
57class MagicJamEditor : public MagicJamAbc
58{
59 Int_t fWidth;
60
61 TASImage *fImage;
62
63 void Move(int dx, int dy);
64 void InitGeom(int wx, int hy);
65 Int_t GetPixelIndexFlt(Float_t px, Float_t py) const;
66
67public:
68 MagicJamEditor(const char *name=0);
69 ~MagicJamEditor();
70
71 // MagicJamEditor
72 void SetAllUsed() { MHCamera::SetAllUsed(); } //*MENU*
73 void Reset(Option_t *o="") { MHCamera::Reset(o); } //*MENU*
74 void Invert() { for (UInt_t i=0; i<GetNumPixels(); i++) if (IsUsed(i)) ResetUsed(i); else SetUsed(i); } //*MENU*
75 void SetWidthHeight(Int_t dx, Int_t dy); //*MENU*
76 Bool_t ShowUnused() const { return TestBit(kNoUnused); }
77 void DoNotDisplayUnused(Bool_t b) { b ? SetBit(kNoUnused) : ResetBit(kNoUnused); } //*TOGGLE* *GETTER=ShowUnused
78
79 void LoadGame(const char *name="default.jam");//*MENU* *ARGS={name=>fName}
80 void SaveGame(const char *name="default.jam"); //*MENU* *ARGS={name=>fName}
81
82 void ShowImageAsBackground(const char *name); //*MENU*
83 void RemoveBackgroundImage(); //*MENU*
84
85 // TObject
86 void Paint(Option_t *o);
87 void Draw(Option_t *o="");
88 void EventInfo(Int_t event, Int_t px, Int_t py, TObject *);
89 void ExecuteEvent(Int_t event, Int_t px, Int_t py);
90
91 ClassDef(MagicJamEditor, 0) // Editor for the MAGIC Jam games
92};
93
94// --------------------------------------------------------------------
95
96class MagicJam : public MagicJamAbc
97{
98private:
99 Int_t fNumPlayers;
100 Int_t fNumPlayer;
101
102 MagicJam *fGame; //!
103
104 void FillPix(Int_t idx);
105 Int_t CountPlayer(Int_t player) const;
106 Int_t CountPlayers() const;
107
108public:
109 MagicJam(const char *jam="mtools/jam/default.jam", MagicJam *game=NULL);
110
111 // MagicJam
112 void SetNumPlayers(Byte_t n=2); //*MENU*
113 void LoadGame(const char *name="default.jam"); //*MENU* *ARGS={name=>fName}
114 void Reset(Option_t *o=""); //*MENU*
115 void StartEditor() const; //*MENU*
116 void OpenInEditor() const; //*MENU*
117 void ShowDirectory(const char *dir="mtools/jam"); //*MENU*
118
119 // TObject
120 void ExecuteEvent(Int_t event, Int_t px, Int_t py);
121 void Paint(Option_t *o);
122 void Draw(Option_t *o=0);
123 void RecursiveRemove(TObject *obj);
124
125 ClassDef(MagicJam, 0) // MAGIC-Jam (game)
126};
127
128#endif
Note: See TracBrowser for help on using the repository browser.