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

Last change on this file since 8983 was 8755, checked in by tbretz, 17 years ago
*** empty log message ***
File size: 4.6 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 SetPrettyPalette() {}
37 void SetDeepBlueSeaPalette() {}
38 void SetInvDeepBlueSeaPalette() {}
39 void SetFreezed(Bool_t f=kTRUE) { }
40 void SetAbberation(Float_t f=0.0713) { }
41 void SetAutoScale() { }
42 void SetMinMax(Double_t min=-1111, Double_t max=-1111) { SetMinimum(min); SetMaximum(max); }
43 TH1 *ShowBackground(Int_t niter=2, Option_t *option="same") { return 0; }
44 Int_t ShowPeaks(Double_t sigma=2, Option_t *option="", Double_t threshold=0.05) { return 0; }
45 void SetErrorSpread(Bool_t f=kTRUE) { }
46
47 // Make the full pad sensible for the context menu
48 Int_t DistancetoPrimitive(Int_t px, Int_t py) { return 0; }
49
50 ClassDef(MagicJamAbc, 0) // Helper class for MagicJam
51};
52
53// --------------------------------------------------------------------
54class TASImage;
55
56class MagicJamEditor : public MagicJamAbc
57{
58 Int_t fWidth;
59
60 TASImage *fImage;
61
62 void Move(int dx, int dy);
63 void InitGeom(int wx, int hy);
64 Int_t GetPixelIndexFlt(Float_t px, Float_t py) const;
65
66public:
67 MagicJamEditor(const char *name=0);
68 ~MagicJamEditor();
69
70 // MagicJamEditor
71 void SetAllUsed() { MHCamera::SetAllUsed(); } //*MENU*
72 void Reset(Option_t *o="") { MHCamera::Reset(o); } //*MENU*
73 void Invert() { for (UInt_t i=0; i<GetNumPixels(); i++) if (IsUsed(i)) ResetUsed(i); else SetUsed(i); } //*MENU*
74 void SetWidthHeight(Int_t dx, Int_t dy); //*MENU*
75 Bool_t ShowUnused() const { return TestBit(kNoUnused); }
76 void DoNotDisplayUnused(Bool_t b) { b ? SetBit(kNoUnused) : ResetBit(kNoUnused); } //*TOGGLE* *GETTER=ShowUnused
77
78 void LoadGame(const char *name="default.jam");//*MENU* *ARGS={name=>fName}
79 void SaveGame(const char *name="default.jam"); //*MENU* *ARGS={name=>fName}
80
81 void ShowImageAsBackground(const char *name); //*MENU*
82 void RemoveBackgroundImage(); //*MENU*
83
84 // TObject
85 void Paint(Option_t *o);
86 void Draw(Option_t *o="");
87 void EventInfo(Int_t event, Int_t px, Int_t py, TObject *);
88 void ExecuteEvent(Int_t event, Int_t px, Int_t py);
89
90 ClassDef(MagicJamEditor, 0) // Editor for the MAGIC Jam games
91};
92
93// --------------------------------------------------------------------
94
95class MagicJam : public MagicJamAbc
96{
97private:
98 Int_t fNumPlayers;
99 Int_t fNumPlayer;
100
101 MagicJam *fGame; //!
102
103 void FillPix(Int_t idx);
104 Int_t CountPlayer(Int_t player) const;
105 Int_t CountPlayers() const;
106
107public:
108 MagicJam(const char *jam="mtools/jam/default.jam", MagicJam *game=NULL);
109
110 // MagicJam
111 void SetNumPlayers(Byte_t n=2); //*MENU*
112 void LoadGame(const char *name="default.jam"); //*MENU* *ARGS={name=>fName}
113 void Reset(Option_t *o=""); //*MENU*
114 void StartEditor() const; //*MENU*
115 void OpenInEditor() const; //*MENU*
116 void ShowDirectory(const char *dir="mtools/jam"); //*MENU*
117
118 // TObject
119 void ExecuteEvent(Int_t event, Int_t px, Int_t py);
120 void Paint(Option_t *o);
121 void Draw(Option_t *o=0);
122 void RecursiveRemove(TObject *obj);
123
124 ClassDef(MagicJam, 0) // MAGIC-Jam (game)
125};
126
127#endif
Note: See TracBrowser for help on using the repository browser.