ROOT logo
// @(#)root/eve:$Id: TEveProjectionAxesEditor.cxx 27341 2009-02-03 19:47:35Z matevz $
// Author: Matevz Tadel 2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#include "TEveProjectionAxesEditor.h"
#include "TEveProjectionAxes.h"
#include "TEveGValuators.h"

#include "TGComboBox.h"
#include "TGButton.h"
#include "TGLabel.h"
#include "TG3DLine.h"

//______________________________________________________________________________
// GUI editor for TEveProjectionAxes.
//

ClassImp(TEveProjectionAxesEditor);

//______________________________________________________________________________
TEveProjectionAxesEditor::TEveProjectionAxesEditor(const TGWindow *p, Int_t width, Int_t height,
                                                   UInt_t options, Pixel_t back) :
   TGedFrame(p, width, height, options | kVerticalFrame, back),
   fM(0),

   fLabMode(0),
   fAxesMode(0),

   fCenterFrame(0),
   fDrawCenter(0),
   fDrawOrigin(0)
{
   // Constructor.

   MakeTitle("TEveProjectionAxis");
   Int_t labw=52;

   {
      TGHorizontalFrame* f = new TGHorizontalFrame(this);

      TGCompositeFrame *labfr = new TGHorizontalFrame(f, labw, 20, kFixedSize);
      labfr->AddFrame(new TGLabel(labfr, "Labels:") , new TGLayoutHints(kLHintsLeft  | kLHintsBottom));
      f->AddFrame(labfr, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 0, 1, 1, 1));

      fLabMode = new TGComboBox(f, "Position");
      fLabMode->AddEntry("Value", 1);
      fLabMode->AddEntry("Position", 0);
      fLabMode->GetTextEntry()->SetToolTipText("Set tick-marks on equidistant values/screen position.");
      TGListBox* lb = fLabMode->GetListBox();
      lb->Resize(lb->GetWidth(), 2*18);
      fLabMode->Resize(80, 20);
      fLabMode->Connect("Selected(Int_t)", "TEveProjectionAxesEditor", this, "DoLabMode(Int_t)");
      f->AddFrame(fLabMode, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
      AddFrame(f);
   }

   {
      TGHorizontalFrame* f = new TGHorizontalFrame(this);
      TGCompositeFrame *labfr = new TGHorizontalFrame(f, labw, 20, kFixedSize);
      labfr->AddFrame(new TGLabel(labfr, "Axes:") , new TGLayoutHints(kLHintsLeft  | kLHintsBottom));
      f->AddFrame(labfr, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 0, 1, 1, 1));


      fAxesMode = new TGComboBox(f, "All");
      fAxesMode->AddEntry("Horizontal", TEveProjectionAxes::kHorizontal);
      fAxesMode->AddEntry("Vertical",TEveProjectionAxes::kVertical);
      fAxesMode->AddEntry("All", TEveProjectionAxes::kAll);
      TGListBox* lb = fAxesMode->GetListBox();
      lb->Resize(lb->GetWidth(), 2*18);
      fAxesMode->Resize(80, 20);
      fAxesMode->Connect("Selected(Int_t)", "TEveProjectionAxesEditor", this, "DoAxesMode(Int_t)");
      f->AddFrame(fAxesMode, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
      AddFrame(f);
   }

   //______________________________________________________________________________

   // center tab
   fCenterFrame = CreateEditorTabSubFrame("Center");

   TGCompositeFrame *title1 = new TGCompositeFrame(fCenterFrame, 180, 10,
                                                   kHorizontalFrame |
                                                   kLHintsExpandX   |
                                                   kFixedWidth      |
                                                   kOwnBackground);
   title1->AddFrame(new TGLabel(title1, "Distortion Center"),
                    new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
   title1->AddFrame(new TGHorizontal3DLine(title1),
                    new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
   fCenterFrame->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));


   {

      TGHorizontalFrame* hf1 = new TGHorizontalFrame(fCenterFrame);

      fDrawOrigin = new TGCheckButton(hf1, "DrawOrigin");
      hf1->AddFrame(fDrawOrigin, new TGLayoutHints(kLHintsLeft, 2,1,0,4));
      fDrawOrigin->Connect("Toggled(Bool_t)"," TEveProjectionAxesEditor", this, "DoDrawOrigin()");


      fDrawCenter = new TGCheckButton(hf1, "DrawCenter");
      hf1->AddFrame(fDrawCenter, new TGLayoutHints(kLHintsLeft, 2,1,0,4));
      fDrawCenter->Connect("Toggled(Bool_t)"," TEveProjectionAxesEditor", this, "DoDrawCenter()");

      fCenterFrame->AddFrame(hf1, new TGLayoutHints(kLHintsTop, 0,0,0,0));

   }
}

/******************************************************************************/

//______________________________________________________________________________
void TEveProjectionAxesEditor::SetModel(TObject* obj)
{
   // Set model object.

   fM = dynamic_cast<TEveProjectionAxes*>(obj);

   fLabMode->Select(fM->GetLabMode(), kFALSE);
   fAxesMode->Select(fM->GetAxesMode(), kFALSE);
   fDrawCenter->SetState(fM->GetDrawCenter()  ? kButtonDown : kButtonUp);
   fDrawOrigin->SetState(fM->GetDrawOrigin()  ? kButtonDown : kButtonUp);

}

//______________________________________________________________________________
void TEveProjectionAxesEditor::DoDrawOrigin()
{
   // Slot for setting draw of origin.

   fM->SetDrawOrigin(fDrawOrigin->IsOn());
   Update();
}

//______________________________________________________________________________
void TEveProjectionAxesEditor::DoDrawCenter()
{
   // Slot for setting draw of center.

   fM->SetDrawCenter(fDrawCenter->IsOn());
   Update();
}

//______________________________________________________________________________
void TEveProjectionAxesEditor::DoLabMode(Int_t mode)
{
   // Slot for setting tick-mark step mode.

   TEveProjectionAxes::ELabMode em = (TEveProjectionAxes::ELabMode ) mode;
   fM->SetLabMode(em);
   Update();
}

//______________________________________________________________________________
void TEveProjectionAxesEditor::DoAxesMode(Int_t mode)
{
   // Slot for setting number of axes.

   TEveProjectionAxes::EAxesMode em = (TEveProjectionAxes::EAxesMode ) mode;
   fM->SetAxesMode(em);
   Update();
}
 TEveProjectionAxesEditor.cxx:1
 TEveProjectionAxesEditor.cxx:2
 TEveProjectionAxesEditor.cxx:3
 TEveProjectionAxesEditor.cxx:4
 TEveProjectionAxesEditor.cxx:5
 TEveProjectionAxesEditor.cxx:6
 TEveProjectionAxesEditor.cxx:7
 TEveProjectionAxesEditor.cxx:8
 TEveProjectionAxesEditor.cxx:9
 TEveProjectionAxesEditor.cxx:10
 TEveProjectionAxesEditor.cxx:11
 TEveProjectionAxesEditor.cxx:12
 TEveProjectionAxesEditor.cxx:13
 TEveProjectionAxesEditor.cxx:14
 TEveProjectionAxesEditor.cxx:15
 TEveProjectionAxesEditor.cxx:16
 TEveProjectionAxesEditor.cxx:17
 TEveProjectionAxesEditor.cxx:18
 TEveProjectionAxesEditor.cxx:19
 TEveProjectionAxesEditor.cxx:20
 TEveProjectionAxesEditor.cxx:21
 TEveProjectionAxesEditor.cxx:22
 TEveProjectionAxesEditor.cxx:23
 TEveProjectionAxesEditor.cxx:24
 TEveProjectionAxesEditor.cxx:25
 TEveProjectionAxesEditor.cxx:26
 TEveProjectionAxesEditor.cxx:27
 TEveProjectionAxesEditor.cxx:28
 TEveProjectionAxesEditor.cxx:29
 TEveProjectionAxesEditor.cxx:30
 TEveProjectionAxesEditor.cxx:31
 TEveProjectionAxesEditor.cxx:32
 TEveProjectionAxesEditor.cxx:33
 TEveProjectionAxesEditor.cxx:34
 TEveProjectionAxesEditor.cxx:35
 TEveProjectionAxesEditor.cxx:36
 TEveProjectionAxesEditor.cxx:37
 TEveProjectionAxesEditor.cxx:38
 TEveProjectionAxesEditor.cxx:39
 TEveProjectionAxesEditor.cxx:40
 TEveProjectionAxesEditor.cxx:41
 TEveProjectionAxesEditor.cxx:42
 TEveProjectionAxesEditor.cxx:43
 TEveProjectionAxesEditor.cxx:44
 TEveProjectionAxesEditor.cxx:45
 TEveProjectionAxesEditor.cxx:46
 TEveProjectionAxesEditor.cxx:47
 TEveProjectionAxesEditor.cxx:48
 TEveProjectionAxesEditor.cxx:49
 TEveProjectionAxesEditor.cxx:50
 TEveProjectionAxesEditor.cxx:51
 TEveProjectionAxesEditor.cxx:52
 TEveProjectionAxesEditor.cxx:53
 TEveProjectionAxesEditor.cxx:54
 TEveProjectionAxesEditor.cxx:55
 TEveProjectionAxesEditor.cxx:56
 TEveProjectionAxesEditor.cxx:57
 TEveProjectionAxesEditor.cxx:58
 TEveProjectionAxesEditor.cxx:59
 TEveProjectionAxesEditor.cxx:60
 TEveProjectionAxesEditor.cxx:61
 TEveProjectionAxesEditor.cxx:62
 TEveProjectionAxesEditor.cxx:63
 TEveProjectionAxesEditor.cxx:64
 TEveProjectionAxesEditor.cxx:65
 TEveProjectionAxesEditor.cxx:66
 TEveProjectionAxesEditor.cxx:67
 TEveProjectionAxesEditor.cxx:68
 TEveProjectionAxesEditor.cxx:69
 TEveProjectionAxesEditor.cxx:70
 TEveProjectionAxesEditor.cxx:71
 TEveProjectionAxesEditor.cxx:72
 TEveProjectionAxesEditor.cxx:73
 TEveProjectionAxesEditor.cxx:74
 TEveProjectionAxesEditor.cxx:75
 TEveProjectionAxesEditor.cxx:76
 TEveProjectionAxesEditor.cxx:77
 TEveProjectionAxesEditor.cxx:78
 TEveProjectionAxesEditor.cxx:79
 TEveProjectionAxesEditor.cxx:80
 TEveProjectionAxesEditor.cxx:81
 TEveProjectionAxesEditor.cxx:82
 TEveProjectionAxesEditor.cxx:83
 TEveProjectionAxesEditor.cxx:84
 TEveProjectionAxesEditor.cxx:85
 TEveProjectionAxesEditor.cxx:86
 TEveProjectionAxesEditor.cxx:87
 TEveProjectionAxesEditor.cxx:88
 TEveProjectionAxesEditor.cxx:89
 TEveProjectionAxesEditor.cxx:90
 TEveProjectionAxesEditor.cxx:91
 TEveProjectionAxesEditor.cxx:92
 TEveProjectionAxesEditor.cxx:93
 TEveProjectionAxesEditor.cxx:94
 TEveProjectionAxesEditor.cxx:95
 TEveProjectionAxesEditor.cxx:96
 TEveProjectionAxesEditor.cxx:97
 TEveProjectionAxesEditor.cxx:98
 TEveProjectionAxesEditor.cxx:99
 TEveProjectionAxesEditor.cxx:100
 TEveProjectionAxesEditor.cxx:101
 TEveProjectionAxesEditor.cxx:102
 TEveProjectionAxesEditor.cxx:103
 TEveProjectionAxesEditor.cxx:104
 TEveProjectionAxesEditor.cxx:105
 TEveProjectionAxesEditor.cxx:106
 TEveProjectionAxesEditor.cxx:107
 TEveProjectionAxesEditor.cxx:108
 TEveProjectionAxesEditor.cxx:109
 TEveProjectionAxesEditor.cxx:110
 TEveProjectionAxesEditor.cxx:111
 TEveProjectionAxesEditor.cxx:112
 TEveProjectionAxesEditor.cxx:113
 TEveProjectionAxesEditor.cxx:114
 TEveProjectionAxesEditor.cxx:115
 TEveProjectionAxesEditor.cxx:116
 TEveProjectionAxesEditor.cxx:117
 TEveProjectionAxesEditor.cxx:118
 TEveProjectionAxesEditor.cxx:119
 TEveProjectionAxesEditor.cxx:120
 TEveProjectionAxesEditor.cxx:121
 TEveProjectionAxesEditor.cxx:122
 TEveProjectionAxesEditor.cxx:123
 TEveProjectionAxesEditor.cxx:124
 TEveProjectionAxesEditor.cxx:125
 TEveProjectionAxesEditor.cxx:126
 TEveProjectionAxesEditor.cxx:127
 TEveProjectionAxesEditor.cxx:128
 TEveProjectionAxesEditor.cxx:129
 TEveProjectionAxesEditor.cxx:130
 TEveProjectionAxesEditor.cxx:131
 TEveProjectionAxesEditor.cxx:132
 TEveProjectionAxesEditor.cxx:133
 TEveProjectionAxesEditor.cxx:134
 TEveProjectionAxesEditor.cxx:135
 TEveProjectionAxesEditor.cxx:136
 TEveProjectionAxesEditor.cxx:137
 TEveProjectionAxesEditor.cxx:138
 TEveProjectionAxesEditor.cxx:139
 TEveProjectionAxesEditor.cxx:140
 TEveProjectionAxesEditor.cxx:141
 TEveProjectionAxesEditor.cxx:142
 TEveProjectionAxesEditor.cxx:143
 TEveProjectionAxesEditor.cxx:144
 TEveProjectionAxesEditor.cxx:145
 TEveProjectionAxesEditor.cxx:146
 TEveProjectionAxesEditor.cxx:147
 TEveProjectionAxesEditor.cxx:148
 TEveProjectionAxesEditor.cxx:149
 TEveProjectionAxesEditor.cxx:150
 TEveProjectionAxesEditor.cxx:151
 TEveProjectionAxesEditor.cxx:152
 TEveProjectionAxesEditor.cxx:153
 TEveProjectionAxesEditor.cxx:154
 TEveProjectionAxesEditor.cxx:155
 TEveProjectionAxesEditor.cxx:156
 TEveProjectionAxesEditor.cxx:157
 TEveProjectionAxesEditor.cxx:158
 TEveProjectionAxesEditor.cxx:159
 TEveProjectionAxesEditor.cxx:160
 TEveProjectionAxesEditor.cxx:161
 TEveProjectionAxesEditor.cxx:162
 TEveProjectionAxesEditor.cxx:163
 TEveProjectionAxesEditor.cxx:164
 TEveProjectionAxesEditor.cxx:165
 TEveProjectionAxesEditor.cxx:166
 TEveProjectionAxesEditor.cxx:167
 TEveProjectionAxesEditor.cxx:168
 TEveProjectionAxesEditor.cxx:169
 TEveProjectionAxesEditor.cxx:170