| 1 | /* ======================================================================== *\
|
|---|
| 2 | !
|
|---|
| 3 | ! *
|
|---|
| 4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
|---|
| 5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
|---|
| 6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
|---|
| 7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
|---|
| 8 | ! *
|
|---|
| 9 | ! * Permission to use, copy, modify and distribute this software and its
|
|---|
| 10 | ! * documentation for any purpose is hereby granted without fee,
|
|---|
| 11 | ! * provided that the above copyright notice appear in all copies and
|
|---|
| 12 | ! * that both that copyright notice and this permission notice appear
|
|---|
| 13 | ! * in supporting documentation. It is provided "as is" without express
|
|---|
| 14 | ! * or implied warranty.
|
|---|
| 15 | ! *
|
|---|
| 16 | !
|
|---|
| 17 | !
|
|---|
| 18 | ! Author(s): Nicola Galante 09/2004 <mailto:nicola.galante@pi.infn.it>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2004
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | //
|
|---|
| 27 | // MagicTrigger
|
|---|
| 28 | // ------------
|
|---|
| 29 | //
|
|---|
| 30 | // Camera Display Games: Reversi
|
|---|
| 31 | //
|
|---|
| 32 | // Start the game by:
|
|---|
| 33 | // MagicReversi reversi;
|
|---|
| 34 | //
|
|---|
| 35 | // Rules:
|
|---|
| 36 | // ------
|
|---|
| 37 | //
|
|---|
| 38 | // Use the mouse to put a stone at some place. If between your newly
|
|---|
| 39 | // placed stone and the next stone (in a row) of your color are stones
|
|---|
| 40 | // of other colors this stones are won by you. You can only place a
|
|---|
| 41 | // stone if you win at least one stone from your 'enemy'. If you
|
|---|
| 42 | // cannot do so, you are skipped. If nobody can make a move anymore
|
|---|
| 43 | // the game is over. The player has won who has the most stones in
|
|---|
| 44 | // his own color.
|
|---|
| 45 | // The present player is indicated by <*>
|
|---|
| 46 | // Use the Escape key to abort a game.
|
|---|
| 47 | // If the game was aborted or has been stopped youcan access the
|
|---|
| 48 | // options in the context menu.
|
|---|
| 49 | //
|
|---|
| 50 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 51 | #include "MagicTriggerButton.h"
|
|---|
| 52 |
|
|---|
| 53 | #include <iostream>
|
|---|
| 54 |
|
|---|
| 55 | #include <KeySymbols.h>
|
|---|
| 56 |
|
|---|
| 57 | #include <TText.h>
|
|---|
| 58 | #include <TMarker.h>
|
|---|
| 59 | #include <TRandom.h>
|
|---|
| 60 | #include <TCanvas.h>
|
|---|
| 61 | #include <TClonesArray.h>
|
|---|
| 62 | #include <TInterpreter.h>
|
|---|
| 63 | #include <TRootEmbeddedCanvas.h>
|
|---|
| 64 | #include <TGButton.h>
|
|---|
| 65 | #include <TGTextEntry.h>
|
|---|
| 66 | #include <TGTextBuffer.h>
|
|---|
| 67 | #include <TGClient.h>
|
|---|
| 68 | #include <TQObject.h>
|
|---|
| 69 | //#include <RQ_OBJECT.h>
|
|---|
| 70 |
|
|---|
| 71 | #include "MHexagon.h"
|
|---|
| 72 | #include "MagicTriggerDisplay.h"
|
|---|
| 73 | #include "MGeomPix.h"
|
|---|
| 74 | #include "MGeomCamCT1.h"
|
|---|
| 75 | #include "MGeomCamMagic.h"
|
|---|
| 76 |
|
|---|
| 77 | ClassImp(MagicTriggerButton);
|
|---|
| 78 |
|
|---|
| 79 | using namespace std;
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 | // ------------------------------------------------------------------------
|
|---|
| 83 | //
|
|---|
| 84 | // default constructor
|
|---|
| 85 | //
|
|---|
| 86 | MagicTriggerButton::MagicTriggerButton(const TGWindow *p, const char* text, Int_t id,
|
|---|
| 87 | GContext_t norm, FontStruct_t font,
|
|---|
| 88 | UInt_t option): TGTextButton(p,text)
|
|---|
| 89 | {
|
|---|
| 90 | // Create a main frame
|
|---|
| 91 | //fButton = new TGTextButton(p,text);
|
|---|
| 92 |
|
|---|
| 93 | this->Connect("Clicked()","MagicTriggerButton",this,"Signal(Int_t,Int_t)");
|
|---|
| 94 | //this->Connect("Clicked()","MagicTriggerDisplay",gROOT->FindObject("MagicTriggerDisplay"),"Update()");
|
|---|
| 95 |
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 | void MagicTriggerButton::SetValue(const Int_t cell, const Int_t lut)
|
|---|
| 100 | {
|
|---|
| 101 | fValue[0] = (Long_t)cell;
|
|---|
| 102 | fValue[1] = (Long_t)lut;
|
|---|
| 103 | }
|
|---|
| 104 |
|
|---|
| 105 | void MagicTriggerButton::Clicked()
|
|---|
| 106 | {
|
|---|
| 107 | //TQObject::Disconnect(this,"Signal(Int_t,Int_t)",gROOT->FindObject("MagicTriggerDisplay"),"Update(Int_t,Int_t)");
|
|---|
| 108 | //this->Connect("Signal(Int_t,Int_t)","MagicTriggerDisplay",gROOT->FindObject("MagicTriggerDisplay"),"Update(Int_t,Int_t)");
|
|---|
| 109 | Emit("Clicked()");
|
|---|
| 110 | }
|
|---|
| 111 |
|
|---|
| 112 | void MagicTriggerButton::Signal(Int_t cell, Int_t lut)
|
|---|
| 113 | {
|
|---|
| 114 | //this->SetValue(cell,lut);
|
|---|
| 115 | Emit("Signal(Int_t, Int_t)",fValue);
|
|---|
| 116 | //cout << fValue[0] << " ---- " << fValue[1] << endl;
|
|---|
| 117 | }
|
|---|
| 118 |
|
|---|
| 119 | //Bool_t MagicTriggerButton::Connect(const char *signal, const char *receiver_class,
|
|---|
| 120 | // void *receiver, const char *slot)
|
|---|
| 121 | //{
|
|---|
| 122 | // return TQObject::Connect(this,signal, receiver_class, receiver, slot);
|
|---|
| 123 | //}
|
|---|