Ignore:
Timestamp:
08/29/01 11:23:55 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/gui
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/gui/MGAccuracy.cc

    r913 r918  
    5858    line.DrawLine(    0, -65*4,    0, 65*4);
    5959
     60    //
     61    // Can be replaced by TGaxis axe; in a later root version
     62    // than 3.01/06. I talked to Rene
     63    //
    6064    TGaxis *axe;
    6165    axe = new TGaxis(-60*4,   0, 60*4,  0,  -4, 4, 30204, "+-N");
     
    175179MGAccuracy::~MGAccuracy()
    176180{
    177     cout << "MGAccuracy destroyed." << endl;
    178 }
    179 
    180 void MGAccuracy::UpdateText(Float_t x, Float_t y)
    181 {
    182     /*
    183      int xs = (int)floor(fmod(fabs(x), 60.));
    184      int ys = (int)floor(fmod(fabs(y), 60.));
    185      x /= 60.;
    186      y /= 60.;
    187      int xm = (int)floor(fmod(fabs(x), 60.));
    188      int ym = (int)floor(fmod(fabs(y), 60.));
    189 
    190      char tx[100];
    191      char ty[100];
    192 
    193      xm ? sprintf(tx, "%d'%02d\"", xm, xs) : sprintf(tx, "%d\"", xs);
    194      ym ? sprintf(ty, "%d'%02d\"", ym, ys) : sprintf(ty, "%d\"", ys);
    195 
    196      char txt[200];
    197      sprintf(txt, "%s / %s", tx, ty);
    198      */
    199 
    200     // FIXME: We are on a sphere
    201 
    202     float r = sqrt(x*x+y*y);
    203 
    204     int rs = (int)floor(fmod(r, 60.));
    205     r /= 60.;
    206     int rm = (int)floor(fmod(r, 60.));
     181    //    cout << "MGAccuracy destroyed." << endl;
     182}
     183
     184void MGAccuracy::UpdateText(Float_t pzd, Float_t azd, Float_t aaz)
     185{
     186    const Float_t d2r = TMath::Pi()/360.;
     187
     188    pzd *= d2r;
     189    azd *= d2r;
     190    aaz *= d2r;
     191
     192    const float dphi2 = aaz/2.;
     193    const float cos2  = cos(dphi2)*cos(dphi2);
     194    const float sin2  = sin(dphi2)*sin(dphi2);
     195
     196    float dist = acos(cos(azd)*cos2 - cos(2*pzd+azd)*sin2);
     197
     198    dist *= 3600./d2r;
     199
     200    int rs = (int)floor(fmod(dist, 60.));
     201    dist /= 60.;
     202    int rm = (int)floor(fmod(dist, 60.));
    207203
    208204    char txt[100];
     
    227223}
    228224
    229 void MGAccuracy::Update(ZdAz &zdaz)
     225void MGAccuracy::Update(ZdAz &pos, ZdAz &acc)
    230226{
    231227    //
     
    235231    static int Y = ~0;
    236232
    237     float x = zdaz.Az()*3600.; // ["]
    238     float y = zdaz.Zd()*3600.; // ["]
     233    float x = acc.Az()*3600.; // ["]
     234    float y = acc.Zd()*3600.; // ["]
    239235
    240236    int pixx = (int)(x/fPix);  // [pix]
     
    248244
    249245    UpdateCross(x, y);
    250     UpdateText(x, y);
     246    UpdateText(pos.Zd(), acc.Az(), acc.Zd());
    251247
    252248    SetModified();
  • trunk/MagicSoft/Cosy/gui/MGAccuracy.h

    r913 r918  
    3232    void InitCross();
    3333
    34     void UpdateText(Float_t x, Float_t y);
     34    void UpdateText(Float_t zd, Float_t x, Float_t y);
    3535    void UpdateCross(Float_t x, Float_t y);
    3636
     
    3939    ~MGAccuracy();
    4040
    41     void Update(ZdAz &pos);
     41    void Update(ZdAz &pos, ZdAz &acc);
    4242};
    4343
  • trunk/MagicSoft/Cosy/gui/MGCoordinate.cc

    r808 r918  
    126126MGCoordinate::~MGCoordinate()
    127127{
    128     cout << "MGCoordinate destroyed." << endl;
     128    //    cout << "MGCoordinate destroyed." << endl;
    129129}
    130130
  • trunk/MagicSoft/Cosy/gui/MGCosy.cc

    r913 r918  
    11#include "MGCosy.h"
    22
     3#include <iostream.h>
     4
    35#include "msgqueue.h"
    46
    57#include <TROOT.h>
    68
     9#include <TGTab.h>         // TGTab
    710#include <TGMenu.h>        // TGPopupMenu
    811#include <TGButton.h>      // TGButton
     
    1013#include <TGLabel.h>       // TGLabel
    1114#include <TG3DLine.h>      // TGHorizontal3DLine (TGSplitter)
     15#include <TGFrame.h>       // TGGroupFrame
    1216#include <TApplication.h>  // gApplication
    1317
     
    3135#define kPB_CALCALTAZ 0x1004
    3236#define kPB_POLARIS   0x1005
     37#define kPB_START     0x1006
    3338
    3439#define kEF_A         0x1010
     
    4348    //  crate the menu bar
    4449    //
    45     TGPopupMenu *fFileMenu = new TGPopupMenu(fClient->GetRoot());
     50    TGPopupMenu *fFileMenu = new TGPopupMenu(gClient->GetRoot());
    4651    fFileMenu->AddEntry ("Exit", IDM_EXIT) ;
    47     fFileMenu->Associate(this);
     52    //fFileMenu->Associate(this);
    4853    fList->Add(fFileMenu);
    4954
     
    5358    TGMenuBar *fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
    5459    fMenuBar->AddPopup("File", fFileMenu, fLayMenuItem);
    55     AddFrame(fMenuBar);
     60    AddFrame(fMenuBar, fLayMenuBar);
    5661    fList->Add(fMenuBar);
    5762
    5863    //
    59     //  Seperator beyonf menubar
    60     //
     64    //  Seperator beyond menubar
     65    //
     66
    6167    TGHorizontal3DLine *fLineSep = new TGHorizontal3DLine(this);
    6268    AddFrame(fLineSep, fLayMenuBar);
    6369    fList->Add(fLineSep);
    64 
    65 }
    66 
    67 void MGCosy::CreateLabel()
    68 {
     70}
     71
     72void MGCosy::CreateLabel(TGCompositeFrame *f)
     73{
     74    const int y = 25;
     75    const int x = 180;
     76
    6977    fLabel1 = new TGLabel*[3];
    70     fLabel1[0] = new TGLabel(this, "00000"); // Max: 16384
     78    fLabel1[0] = new TGLabel(f, "00000"); // Max: 16384
     79    fLabel1[1] = new TGLabel(f, "000");   // Max: 256
     80    fLabel1[2] = new TGLabel(f, "000");   // Max: 256
    7181    fLabel1[0]->SetTextJustify(kTextRight);
    72     fLabel1[0]->Move(5, 40);
     82    fLabel1[1]->SetTextJustify(kTextRight);
     83    fLabel1[2]->SetTextJustify(kTextRight);
     84    fLabel1[0]->Move(x,    y);
     85    fLabel1[1]->Move(x+43, y);
     86    fLabel1[2]->Move(x+70, y);
    7387    fList->Add(fLabel1[0]);
    74     //    AddFrame(fLabel1[0], new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
    75     fLabel1[1] = new TGLabel(this, "000");   // Max: 256
    76     fLabel1[1]->SetTextJustify(kTextRight);
    77     fLabel1[1]->Move(48, 40);
    7888    fList->Add(fLabel1[1]);
    79     //    AddFrame(fLabel1[1], new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
    80     fLabel1[2] = new TGLabel(this, "000");   // Max: 256
    81     fLabel1[2]->SetTextJustify(kTextRight);
    82     fLabel1[2]->Move(75, 40);
    8389    fList->Add(fLabel1[2]);
    84     //    AddFrame(fLabel1[2], new TGLayoutHints(kLHintsNormal, 9, 9, 9, 9));
     90    //f->AddFrame(fLabel1[0]);
     91    //f->AddFrame(fLabel1[1]);
     92    //f->AddFrame(fLabel1[2]);
    8593
    8694    fLabel2 = new TGLabel*[3];
    87     fLabel2[0] = new TGLabel(this, "00000");
     95    fLabel2[0] = new TGLabel(f, "00000");
     96    fLabel2[1] = new TGLabel(f, "000");
     97    fLabel2[2] = new TGLabel(f, "000");
    8898    fLabel2[0]->SetTextJustify(kTextRight);
    89     fLabel2[0]->Move(5, 60);
     99    fLabel2[1]->SetTextJustify(kTextRight);
     100    fLabel2[2]->SetTextJustify(kTextRight);
     101    fLabel2[0]->Move(x,    y+20);
     102    fLabel2[1]->Move(x+43, y+20);
     103    fLabel2[2]->Move(x+70, y+20);
    90104    fList->Add(fLabel2[0]);
    91     //    AddFrame(fLabel2[0], new TGLayoutHints); //(kLHintsNormal, 0, 0, 0, 0));
    92     fLabel2[1] = new TGLabel(this, "000");
    93     fLabel2[1]->SetTextJustify(kTextRight);
    94     fLabel2[1]->Move(48, 60);
    95105    fList->Add(fLabel2[1]);
    96     //    AddFrame(fLabel2[1], new TGLayoutHints); //(kLHintsNormal, 1, 0, 0, 0));
    97     fLabel2[2] = new TGLabel(this, "000");
    98     fLabel2[2]->SetTextJustify(kTextRight);
    99     fLabel2[2]->Move(75, 60);
    100106    fList->Add(fLabel2[2]);
    101     //    AddFrame(fLabel2[2], new TGLayoutHints); //(kLHintsNormal, 2, 0, 0, 0));
     107    //f->AddFrame(fLabel2[0]);
     108    //f->AddFrame(fLabel2[1]);
     109    //f->AddFrame(fLabel2[2]);
    102110
    103111    fLabel3 = new TGLabel*[3];
    104     fLabel3[0] = new TGLabel(this, "00000");
     112    fLabel3[0] = new TGLabel(f, "00000");
     113    fLabel3[1] = new TGLabel(f, "000");
     114    fLabel3[2] = new TGLabel(f, "000");
    105115    fLabel3[0]->SetTextJustify(kTextRight);
    106     fLabel3[0]->Move(5, 80);
     116    fLabel3[1]->SetTextJustify(kTextRight);
     117    fLabel3[2]->SetTextJustify(kTextRight);
     118    fLabel3[0]->Move(x,    y+40);
     119    fLabel3[1]->Move(x+43, y+40);
     120    fLabel3[2]->Move(x+70, y+40);
    107121    fList->Add(fLabel3[0]);
    108     //    AddFrame(fLabel3[0]); //, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
    109     fLabel3[1] = new TGLabel(this, "000");
    110     fLabel3[1]->SetTextJustify(kTextRight);
    111     fLabel3[1]->Move(48, 80);
    112122    fList->Add(fLabel3[1]);
    113     //    AddFrame(fLabel3[1]); //, new TGLayoutHints(kLHintsNormal, 1, 0, 0, 0));
    114     fLabel3[2] = new TGLabel(this, "000");
    115     fLabel3[2]->SetTextJustify(kTextRight);
    116     fLabel3[2]->Move(75, 80);
    117123    fList->Add(fLabel3[2]);
    118     //    AddFrame(fLabel3[2]); //, new TGLayoutHints(kLHintsNormal, 2, 0, 0, 0));
    119 }
    120 
    121 void MGCosy::CreateButton()
    122 {
    123     TGTextButton *fButton1 = new TGTextButton(this, "Position Zd/Az", kPB_POSITION);
    124     TGTextButton *fButton2 = new TGTextButton(this, "Track   Ra/Dec", kPB_TRACK);
    125     TGTextButton *fButton3 = new TGTextButton(this, "Stop",           kPB_STOP);
    126     TGTextButton *fButton4 = new TGTextButton(this, "Calc     Zd/Az", kPB_CALCALTAZ);
    127     TGTextButton *fButton5 = new TGTextButton(this, "Set Polaris",    kPB_POLARIS);
    128     fButton1->Move(110,  40);
    129     fButton2->Move(110,  65);
    130     fButton3->Move(260,  90);
    131     fButton4->Move(110,  90);
    132     fButton5->Move(110, 115);
    133     fButton1->SetToolTipText("Move Telescope to Zd/Az position.");
    134     fButton2->SetToolTipText("Track the coordinates given in Ra/Dec.");
    135     fButton3->SetToolTipText("Stop movement of telescope.");
     124    //f->AddFrame(fLabel3[0]);
     125    //f->AddFrame(fLabel3[1]);
     126    //f->AddFrame(fLabel3[2]);
     127
     128
     129    fError    = new TGLabel(f, "Error");
     130    fMoving   = new TGLabel(f, "Moving");
     131    fTracking = new TGLabel(f, "Tracking");
     132    fStopping = new TGLabel(f, "Stopping");
     133    fStopped  = new TGLabel(f, "Stopped");
     134
     135    fError   ->SetBackgroundColor(224); // red
     136    fMoving  ->SetBackgroundColor(10);  // blue
     137    fTracking->SetBackgroundColor(47);  // blue
     138    fStopping->SetBackgroundColor(164); // orange
     139    fStopped ->SetBackgroundColor(20);  // green
     140
     141    fError   ->Move(10, 25);
     142    fMoving  ->Move(10, 25+20);
     143    fTracking->Move(10, 25+40);
     144    fStopping->Move(10, 25+60);
     145    fStopped ->Move(10, 25+80);
     146
     147    fError   ->Resize(60, 20);
     148    fMoving  ->Resize(60, 20);
     149    fTracking->Resize(60, 20);
     150    fStopping->Resize(60, 20);
     151    fStopped ->Resize(60, 20);
     152
     153    fList->Add(fError);
     154    fList->Add(fMoving);
     155    fList->Add(fTracking);
     156    fList->Add(fStopping);
     157    fList->Add(fStopped);
     158}
     159
     160void MGCosy::CreateButton(TGCompositeFrame *tf1, TGCompositeFrame *tf2)
     161{
     162    const int x=15;
     163    const int y=12;
     164    const int h=16;
     165
     166    TGLabel *l1 = new TGLabel(tf1, "Move the telescope to a position given in");
     167    TGLabel *l2 = new TGLabel(tf1, "local coordinates. The given coordinates");
     168    TGLabel *l3 = new TGLabel(tf1, "are pointing coordinates, which means that the");
     169    TGLabel *l4 = new TGLabel(tf1, "coordinates are corrected for the bending of");
     170    TGLabel *l5 = new TGLabel(tf1, "the telescope.");
     171    l1->Move(x, y);
     172    l2->Move(x, y+h);
     173    l3->Move(x, y+2*h);
     174    l4->Move(x, y+3*h);
     175    l5->Move(x, y+4*h);
     176    fList->Add(l1);
     177    fList->Add(l2);
     178    fList->Add(l3);
     179    fList->Add(l4);
     180    fList->Add(l5);
     181
     182    l1 = new TGLabel(tf2, "Track a position given in sky coordinates.");
     183    l2 = new TGLabel(tf2, "Right Ascension and declination must be given");
     184    l3 = new TGLabel(tf2, "in the FK5, J2000 coordinate system");
     185    l1->Move(x, y);
     186    l2->Move(x, y+h);
     187    l3->Move(x, y+2*h);
     188    fList->Add(l1);
     189    fList->Add(l2);
     190    fList->Add(l3);
     191
     192    //
     193    // light green: 3   light red:  2   blue?:      2
     194    // dark green:  8   dark red:  50   dark blue?: 1
     195
     196    //
     197    // blue:  0-7, 9, 10,11, 14, 15, 18, 19, 22, 23, 27, 31, 33-39, 41-43
     198    //        46, 47
     199    // green: 8, 12,13, 16, 17, 20, 21, 24, 25, 26, 28, 29, 30, 40, 44
     200    //        45, 48
     201    // gray:  31, 113-
     202    // red:   164, 192, 224, 232
     203    //
     204
     205    //    TGTextButton *fButton1 = new TGTextButton(this, "Position Zd/Az", kPB_POSITION);
     206    //    TGTextButton *fButton2 = new TGTextButton(this, "Track   Ra/Dec", kPB_TRACK);
     207    TGTextButton *fButton4 = new TGTextButton(this, "Calc Zd/Az",  kPB_CALCALTAZ);
     208    TGTextButton *fButton5 = new TGTextButton(this, "Set Polaris", kPB_POLARIS);
     209    //    fButton1->Move(120,  40);
     210    //    fButton2->Move(120,  65);
     211    fButton4->Resize(80, 25);
     212    fButton5->Resize(80, 25);
     213
     214    fButton4->Move(40, 257);
     215    fButton5->Move(40, 288);
     216    //fButton4->SetBackgroundColor(12);
     217    //fButton5->SetBackgroundColor(16);
     218    //    fButton1->SetToolTipText("Move Telescope to Zd/Az position.");
     219    //    fButton2->SetToolTipText("Track the coordinates given in Ra/Dec.");
    136220    fButton4->SetToolTipText("Calculate Zd/Az corresponding to Ra/Dec.");
    137221    fButton5->SetToolTipText("Set the actual position as the position of Polaris.");
    138     fList->Add(fButton1);
    139     fList->Add(fButton2);
    140     fList->Add(fButton3);
     222    //    fList->Add(fButton1);
     223    //    fList->Add(fButton2);
    141224    fList->Add(fButton4);
    142225    fList->Add(fButton5);
     226
     227    TGTextButton *fStart = new TGTextButton(this, "Start", kPB_START);
     228    TGTextButton *fStop  = new TGTextButton(this, "Stop",  kPB_STOP);
     229    fStart->SetBackgroundColor(20);
     230    fStop ->SetBackgroundColor(224);
     231    fStart->Move(147, 275);
     232    fStop ->Move(212, 275);
     233    fStart->Resize(60, 25);
     234    fStop ->Resize(60, 25);
     235    fStart->SetToolTipText("Start a telescope movement.");
     236    fStop ->SetToolTipText("Stop any movement of telescope.");
     237    fList->Add(fStart);
     238    fList->Add(fStop);
    143239}
    144240
     
    149245
    150246    CreateMenu();
    151     CreateLabel();
    152     CreateButton();
    153 
     247
     248    TGCompositeFrame *f = new TGCompositeFrame(this, 0, 0);
     249    f->SetLayoutManager(new TGMatrixLayout(f, 3, 2, 10));
     250    fList->Add(f);
     251
     252    fTab = new TGTab(f, 300, 300);
     253    TGCompositeFrame *tf1 = fTab->AddTab("Position Zd/Az");
     254    TGCompositeFrame *tf2 = fTab->AddTab("Track Ra/Dec");
     255    fList->Add(fTab);
     256
     257    fSkyPosition = new MGSkyPosition(f, 300);
     258    fAccuracy    = new MGAccuracy   (f, 300);
     259    fVelocity    = new MGVelocity   (f, "Velocity ['/min]", 300);
     260    fOffset      = new MGVelocity   (f, "Offset se-re [']", 300);
     261
     262    fList->Add(fSkyPosition);
     263    fList->Add(fAccuracy);
     264    fList->Add(fVelocity);
     265    fList->Add(fOffset);
     266
     267    TGGroupFrame *frame = new TGGroupFrame(f, "Status");
     268    frame->Resize(300, 300);
     269    fList->Add(frame);
     270
     271    //
     272    // Layout the window, tile by tile...
     273    //
     274    f->AddFrame(fTab);
     275    f->AddFrame(fSkyPosition);
     276    f->AddFrame(fAccuracy);
     277    f->AddFrame(frame);
     278    f->AddFrame(fVelocity);
     279    f->AddFrame(fOffset);
     280
     281    AddFrame(f, new TGLayoutHints(kLHintsNormal | kLHintsExpandX, 0, 0, 1, 0));
     282
     283    //
     284    // FIXME!
     285    //
    154286    fCoord = new MGCoordinates(this, kTRUE,
    155287                               "Coordinate 1 [\xb0]:", "Coordinate 2 [\xb0]:");
    156     fCoord->Move(10, 160);
     288    fCoord->Move(40, 165);
    157289    fList->Add(fCoord);
    158290
    159     fSkyPosition = new MGSkyPosition(this, 300);
    160     fSkyPosition->Move(320, 40);
    161     fList->Add(fSkyPosition);
    162 
    163     fAccuracy = new MGAccuracy(this, 300);
    164     fAccuracy->Move(320, 360);
    165     fList->Add(fAccuracy);
    166 
    167     fVelocity = new MGVelocity(this, "Velocity ['/min]", 300);
    168     fVelocity->Move(10, 360);
    169     fList->Add(fVelocity);
    170 
    171     fOffset = new MGVelocity(this, "Offset se-re [']", 300);
    172     fOffset->Move(630, 360);
    173     fList->Add(fOffset);
     291    CreateButton(tf1, tf2);
     292    CreateLabel(frame);
    174293
    175294    //
    176295    //   Map the window, set up the layout, etc.
    177296    //
    178     const Int_t w = 650+310;
    179     const Int_t h = 690;
     297    const Int_t w = 940;
     298    const Int_t h = 660;
    180299    SetWMSizeHints(w, h, w, h, 10, 10);  // set the smallest and biggest size of the Main frame
    181 
    182     MapSubwindows();
    183     Layout();
    184300
    185301    SetWindowName("Cosy Main Window");
    186302    SetIconName("Cosy");
    187303
     304    MapSubwindows();
     305    Resize(GetDefaultSize());
    188306    MapWindow();
    189307}
     
    193311MGCosy::~MGCosy()
    194312{
    195     cout << "Deleting MGCosy." << endl;
     313    cout << "MGCosy::~MGCosy called." << endl;
    196314
    197315    delete fLayMenuBar;
     
    202320    delete fList;
    203321
    204     cout << "MGCosy deleted." << endl;
     322    cout << "MGCosy::~MGCosy done." << endl;
    205323}
    206324// ======================================================================
    207 void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off)
     325void MGCosy::EnableLabel(TGLabel *label, Bool_t stat)
     326{
     327    stat ? label->MapWindow() : label->UnmapWindow();
     328
     329    /*
     330    TGGC *fRedTextGC(TGButton::GetDefaultGC())
     331        // Set foreground color in graphics context for drawing of
     332        // TGlabel and TGButtons with text in red.
     333        ULong_t red;
     334    gClient->GetColorByName("red", red);
     335    fRedTextGC.SetForeground(red);
     336    */
     337}
     338
     339void MGCosy::Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, UInt_t stat)
    208340{
    209341    fSkyPosition->Update(pos);
    210     fAccuracy->Update(acc);
     342    fAccuracy->Update(pos, acc);
    211343    fVelocity->Update(vel);
    212344    fOffset->Update(off);
     345
     346#define kError     0x01
     347#define kMoving    0x02
     348#define kTracking  0x04
     349#define kStopping  0x08
     350#define kStopped   0x10
     351
     352    EnableLabel(fError,    stat&kError);
     353    EnableLabel(fMoving,   stat&kMoving);
     354    EnableLabel(fTracking, stat&kTracking);
     355    EnableLabel(fStopping, stat&kStopping);
     356    EnableLabel(fStopped,  stat&kStopped);
     357
     358    stat&kTracking ? fAccuracy->MapWindow() : fAccuracy->UnmapWindow();
     359    stat&kTracking ? fVelocity->MapWindow() : fVelocity->UnmapWindow();
     360    stat&kTracking ? fOffset->MapWindow()   : fOffset->UnmapWindow();
    213361}
    214362// ======================================================================
     
    221369    // window menu item is selected.
    222370
    223     //gSystem->ExitLoop();
    224     //  gSystem->DispatchOneEvent(kTRUE);
    225 
    226     //    TGMainFrame::CloseWindow();
    227     gApplication->Terminate(0);
    228 }
    229 
    230 #include <iostream.h>
     371    // gSystem->ExitLoop();
     372    // gSystem->DispatchOneEvent(kTRUE);
     373
     374    // TGMainFrame::CloseWindow();
     375    fQueue->PostMsg(WM_QUIT, 0, 0);
     376    // gApplication->Terminate(0);
     377}
     378
     379void MGCosy::Start(UInt_t id)
     380{
     381    cout << "Start " << (id?"tracking.":"positioning.") << endl;
     382
     383    XY xy = fCoord->GetCoordinates();
     384
     385    if (id)
     386    {
     387        RaDec dest(xy.X(), xy.Y());
     388        cout << dest.Ra() << kDEG << " " << dest.Dec() << kDEG << endl;
     389        fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest));
     390    }
     391    else
     392    {
     393        ZdAz dest(xy.X(), xy.Y());
     394        cout << dest.Zd() << kDEG << " " << dest.Az() << kDEG << endl;
     395        fQueue->PostMsg(WM_POSITION, &dest, sizeof(dest));
     396    }
     397
     398    cout << "PostMsg (" << (id?"WM_Track":"WM_Position") << ") returned." << endl;
     399}
    231400
    232401Bool_t MGCosy::ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2)
     
    240409        switch (GET_SUBMSG(msg))
    241410        {
     411        case kCM_TAB:
     412            //cout << "Tab: " << mp1 << endl;
     413            return kTRUE;
     414
    242415        case kCM_BUTTON:
    243416
     
    245418            {
    246419            case kPB_POSITION:
    247                 cout << "Start positioning." << endl;
    248                 {
    249                     XY xy = fCoord->GetCoordinates();
    250                     ZdAz dest(xy.X(), xy.Y());
    251                     cout << dest.Zd() << kDEG << " " << dest.Az() << kDEG << endl;
    252                     fQueue->PostMsg(WM_POSITION, &dest, sizeof(dest));
    253                 }
    254                 cout << "PostMsg(WM_POSITION) returned." << endl;
     420                Start(0);
    255421                return kTRUE;
    256422
    257423            case kPB_TRACK:
    258                 cout << "Start tracking." << endl;
    259                 {
    260                     XY xy = fCoord->GetCoordinates();
    261                     RaDec dest(xy.X(), xy.Y());
    262                     cout << dest.Ra() << kDEG << " " << dest.Dec() << kDEG << endl;
    263                     fQueue->PostMsg(WM_TRACK, &dest, sizeof(dest));
    264                 }
    265                 cout << "PostMsg(WM_TRACK) returned." << endl;
     424                Start(1);
     425                return kTRUE;
     426
     427            case kPB_START:
     428                Start(fTab->GetCurrent());
    266429                return kTRUE;
    267430
     
    269432                cout << "Sending stop movement msg." << endl;
    270433                fQueue->PostMsg(WM_STOP, 0, 0);
    271                 cout << "PostMsg(WM_STOP) returned." << endl;
     434                cout << "PostMsg (WM_Stop) returned." << endl;
    272435                return kTRUE;
    273436
     
    293456                return kTRUE;
    294457            }
    295             break;
     458            return kTRUE;
    296459
    297460        case kCM_MENU:
     
    300463            {
    301464            case IDM_EXIT:
    302                 cout << "Idm_Exit." << endl;
    303                 CloseWindow();
    304                 return kTRUE;
    305 
    306             default:
     465                fQueue->PostMsg(WM_QUIT, 0, 0);
     466                //cout << "Idm_Exit." << endl;
     467                //CloseWindow();
    307468                return kTRUE;
    308469            }
    309470            return kTRUE;
    310 
    311         default:
    312             return kTRUE;
    313471        }
    314 
    315     default:
    316         return kTRUE;
    317472    }
    318473
  • trunk/MagicSoft/Cosy/gui/MGCosy.h

    r913 r918  
    3131class MGAccuracy;
    3232class MGVelocity;
     33class TGCompositeFrame;
     34class TGTab;
    3335
    3436class MGCosy : public TGMainFrame
     
    5658    MsgQueue      *fQueue;
    5759
     60    TGTab         *fTab;
     61
     62    TGLabel *fError;
     63    TGLabel *fMoving;
     64    TGLabel *fTracking;
     65    TGLabel *fStopping;
     66    TGLabel *fStopped;
     67
    5868    void CreateMenu();
    59     void CreateLabel();
    60     void CreateButton();
     69    void CreateLabel(TGCompositeFrame *f);
     70    void CreateButton(TGCompositeFrame *tf1, TGCompositeFrame *tf2);
     71
     72    void Start(UInt_t id);
     73
     74    void EnableLabel(TGLabel *label, Bool_t stat);
    6175
    6276public:
     
    7084    TGLabel **GetLabel3() { return fLabel3; }
    7185
    72     void Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off);
     86    void Update(ZdAz pos, ZdAz acc, ZdAz vel, ZdAz off, UInt_t stat);
    7387
    7488    Bool_t ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2);
  • trunk/MagicSoft/Cosy/gui/MGEmbeddedCanvas.cc

    r913 r918  
    1212MGEmbeddedCanvas::MGEmbeddedCanvas(const char *name, const TGWindow* p,
    1313                                   const UInt_t width, Float_t range)
    14     : TRootEmbeddedCanvas(name, p, width, width, kRaisedFrame),//, 0) //234, 76, kFixedSize)
     14    : TRootEmbeddedCanvas(name, p, width+1, width+1, kRaisedFrame),//, 0) //234, 76, kFixedSize)
    1515      fModified(kFALSE), fWidth(width), fRange(range), fPix(2.*range/width)
    1616{
     
    3333    MapSubwindows();
    3434
    35     Resize(fWidth-1, fWidth-1); //GetDefaultSize()); // ???
     35    Resize(fWidth, fWidth); //GetDefaultSize()); // ???
    3636    MapWindow();
    3737
     
    4444        return;
    4545
     46    //
    4647    // FIXME: Sometimes (if the canvas couldn't be created correctly:
    4748    // X11 Pixmap error) Update hangs the Gui system.
     49    //
     50    // Fixed: Using root 3.01/06 and doing the update from within the
     51    // mainthread.
     52    //
    4853
    4954    fCanvas->Modified();
  • trunk/MagicSoft/Cosy/gui/MGSkyPosition.cc

    r913 r918  
    9898{
    9999    fText = new TText(105, 105, "");
    100     fText->SetFillStyle(4000);  // transparent
     100    //fText->SetFillStyle(4000);  // transparent
    101101    fText->SetTextAlign(33);  // right, top
    102102    fText->SetTextColor(10);  // white
     
    323323        return;
    324324
    325     cout << "Sun: x=" << x << " y=" << y;
    326     cout << "   Zd=" << deg << " Az=" << 360./D2PI*zdaz.Az() << endl;
     325    // cout << "Sun: x=" << x << " y=" << y;
     326    // cout << "   Zd=" << deg << " Az=" << 360./D2PI*zdaz.Az() << endl;
    327327
    328328    fSunL[0]->SetX1(x-3.5); fSunL[0]->SetX2(x+3.5);
  • trunk/MagicSoft/Cosy/gui/MGVelocity.cc

    r913 r918  
    109109    line.DrawLine(    0, -65*2,    0, 65*2);
    110110
     111    //
     112    // Can be replaced by TGaxis axe; in a later root version
     113    // than 3.01/06. I talked to Rene
     114    //
    111115    TGaxis *axe;
    112116    axe = new TGaxis(-60*2, 0, 60*2, 0,  -2, 2,  304, "+-N");
     
    179183MGVelocity::~MGVelocity()
    180184{
    181     delete fList;
    182 
    183185    delete fOld;
    184186    delete fAvg;
    185187
    186     cout << "MGVelocity destroyed." << endl;
     188    //    cout << "MGVelocity destroyed." << endl;
    187189}
    188190
     
    270272    //    static int Y = 0xaffe;
    271273
    272     float x = zdaz.Az()*3600.*4;
    273     float y = zdaz.Zd()*3600.*4;
     274    float x = zdaz.Az()*3600.;
     275    float y = zdaz.Zd()*3600.;
    274276
    275277    int pixx = (int)(x*fScale/fPix);
Note: See TracChangeset for help on using the changeset viewer.