source: tags/Mars-V0.10/mtools/MagicJam.h

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