ROOT logo
// @(#)root/ged:$Id: TCurlyArcEditor.cxx 20882 2007-11-19 11:31:26Z rdm $
// Author: Ilka Antcheva, Otto Schaile 15/12/04

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

//////////////////////////////////////////////////////////////////////////
//                                                                      //
//  TCurlyArcEditor                                                     //
//                                                                      //
//  Implements GUI for editing CurlyArc attributes: radius, phi1, phi2. //                                             //
//                                                                      //
//////////////////////////////////////////////////////////////////////////
//Begin_Html
/*
<img src="gif/TCurlyArcEditor.gif">
*/
//End_Html


#include "TCurlyArcEditor.h"
#include "TGLabel.h"
#include "TGNumberEntry.h"
#include "TCurlyArc.h"
#include "iostream"

ClassImp(TCurlyArcEditor)

enum ECurlyArcWid {
   kCRLA_RAD,
   kCRLA_FMIN,
   kCRLA_FMAX,
   kCRLA_CX,
   kCRLA_CY
};

//______________________________________________________________________________
TCurlyArcEditor::TCurlyArcEditor(const TGWindow *p, Int_t width,
                           Int_t height, UInt_t options, Pixel_t back)
   : TGedFrame(p, width, height, options | kVerticalFrame, back)
{
   // Constructor of CurlyArc GUI.

   fCurlyArc = 0;

   MakeTitle("Curly Arc");

   TGCompositeFrame *f3 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
   AddFrame(f3, new TGLayoutHints(kLHintsTop, 1, 1, 2, 0));

   TGCompositeFrame *f3a = new TGCompositeFrame(f3, 80, 20);
   f3->AddFrame(f3a, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));

   TGLabel *fRadiusLabel = new TGLabel(f3a, "Radius:");
   f3a->AddFrame(fRadiusLabel, new TGLayoutHints(kLHintsNormal, 8, 0, 5, 5));

   TGLabel *fPhiminLabel = new TGLabel(f3a, "Phimin:");
   f3a->AddFrame(fPhiminLabel, new TGLayoutHints(kLHintsNormal, 8, 0, 5, 5));

   TGLabel *fPhimaxLabel = new TGLabel(f3a, "Phimax:");
   f3a->AddFrame(fPhimaxLabel, new TGLayoutHints(kLHintsNormal, 8, 0, 5, 5));

   TGLabel *fCenterXLabel = new TGLabel(f3a, "Center X:");
   f3a->AddFrame(fCenterXLabel, new TGLayoutHints(kLHintsNormal, 8, 0, 6, 5));

   TGLabel *fCenterYLabel = new TGLabel(f3a, "Y:");
   f3a->AddFrame(fCenterYLabel, new TGLayoutHints(kLHintsNormal, 49, 0, 6, 0));

   TGCompositeFrame *f3b = new TGCompositeFrame(f3, 80, 20);
   f3->AddFrame(f3b, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));

   fRadiusEntry = new TGNumberEntry(f3b, 0.02, 7, kCRLA_RAD,
                                    TGNumberFormat::kNESRealThree,
                                    TGNumberFormat::kNEANonNegative,
                                    TGNumberFormat::kNELNoLimits);
   fRadiusEntry->GetNumberEntry()->SetToolTipText("Set radius of arc.");
   f3b->AddFrame(fRadiusEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));

   fPhiminEntry = new TGNumberEntry(f3b, 0, 7, kCRLA_FMIN,
                                    TGNumberFormat::kNESInteger,
                                    TGNumberFormat::kNEANonNegative,
                                    TGNumberFormat::kNELLimitMinMax, 0, 360);
   fPhiminEntry->GetNumberEntry()->SetToolTipText("Set Phimin in degrees.");
   f3b->AddFrame(fPhiminEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));

   fPhimaxEntry = new TGNumberEntry(f3b, 0, 7, kCRLA_FMAX,
                                    TGNumberFormat::kNESInteger,
                                    TGNumberFormat::kNEANonNegative,
                                    TGNumberFormat::kNELLimitMinMax, 0, 360);
   fPhimaxEntry->GetNumberEntry()->SetToolTipText("Set Phimax in degrees.");
   f3b->AddFrame(fPhimaxEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));

   fCenterXEntry = new TGNumberEntry(f3b, 0.0, 7, kCRLA_CX,
                                     TGNumberFormat::kNESRealThree,
                                     TGNumberFormat::kNEANonNegative,
                                     TGNumberFormat::kNELNoLimits);
   fCenterXEntry->GetNumberEntry()->SetToolTipText("Set center X coordinate.");
   f3b->AddFrame(fCenterXEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));

   fCenterYEntry = new TGNumberEntry(f3b, 0.0, 7, kCRLA_CY,
                                     TGNumberFormat::kNESRealThree,
                                     TGNumberFormat::kNEANonNegative,
                                     TGNumberFormat::kNELNoLimits);
   fCenterYEntry->GetNumberEntry()->SetToolTipText("Set center Y coordinate.");
   f3b->AddFrame(fCenterYEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));

}

//______________________________________________________________________________
TCurlyArcEditor::~TCurlyArcEditor()
{
   // Destructor of CurlyArc editor.
}

//______________________________________________________________________________
void TCurlyArcEditor::ConnectSignals2Slots()
{
   // Connect signals to slots.
 
   fCenterXEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoCenterXY()");
   (fCenterXEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoCenterXY()");
   fCenterYEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoCenterXY()");
   (fCenterYEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoCenterXY()");
   fRadiusEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoRadius()");
   (fRadiusEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoRadius()");
   fPhiminEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoPhimin()");
   (fPhiminEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoPhimin()");
   fPhimaxEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoPhimax()");
   (fPhimaxEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoPhimax()");

   fInit = kFALSE;
}

//______________________________________________________________________________
void TCurlyArcEditor::SetModel(TObject* obj)
{
   // Pick up the used curly arc attributes.

   fCurlyArc = (TCurlyArc *)obj;
   fAvoidSignal = kTRUE;

   Double_t val = fCurlyArc->GetRadius();
   fRadiusEntry->SetNumber(val);

   val = fCurlyArc->GetPhimin();
   fPhiminEntry->SetNumber(val);

   val = fCurlyArc->GetPhimax();
   fPhimaxEntry->SetNumber(val);

   val = fCurlyArc->GetStartX();
   fCenterXEntry->SetNumber(val);

   val = fCurlyArc->GetStartY();
   fCenterYEntry->SetNumber(val);

   if (fInit) ConnectSignals2Slots();

   fAvoidSignal = kFALSE;
}

//______________________________________________________________________________
void TCurlyArcEditor::DoCenterXY()
{
   // Slot connected to set center .

   if (fAvoidSignal) return;
   fCurlyArc->SetCenter((Double_t)fCenterXEntry->GetNumber(), (Double_t)fCenterYEntry->GetNumber());
   fCurlyArc->Paint(fCurlyArc->GetDrawOption());
   Update();
}

//______________________________________________________________________________
void TCurlyArcEditor::DoRadius()
{
   // Slot connected to the radius setting.

   if (fAvoidSignal) return;
   fCurlyArc->SetRadius((Double_t)fRadiusEntry->GetNumber());
   fCurlyArc->Paint(fCurlyArc->GetDrawOption());
   Update();
}

//______________________________________________________________________________
void TCurlyArcEditor::DoPhimin()
{
   // Slot connected to the phimin setting.

   if (fAvoidSignal) return;
   fCurlyArc->SetPhimin((Double_t)fPhiminEntry->GetNumber());
   fCurlyArc->Paint(fCurlyArc->GetDrawOption());
   Update();
}

//______________________________________________________________________________
void TCurlyArcEditor::DoPhimax()
{
   // Slot connected to the phimax setting.

   if (fAvoidSignal) return;
   fCurlyArc->SetPhimax((Double_t)fPhimaxEntry->GetNumber());
   fCurlyArc->Paint(fCurlyArc->GetDrawOption());
   Update();
}
 TCurlyArcEditor.cxx:1
 TCurlyArcEditor.cxx:2
 TCurlyArcEditor.cxx:3
 TCurlyArcEditor.cxx:4
 TCurlyArcEditor.cxx:5
 TCurlyArcEditor.cxx:6
 TCurlyArcEditor.cxx:7
 TCurlyArcEditor.cxx:8
 TCurlyArcEditor.cxx:9
 TCurlyArcEditor.cxx:10
 TCurlyArcEditor.cxx:11
 TCurlyArcEditor.cxx:12
 TCurlyArcEditor.cxx:13
 TCurlyArcEditor.cxx:14
 TCurlyArcEditor.cxx:15
 TCurlyArcEditor.cxx:16
 TCurlyArcEditor.cxx:17
 TCurlyArcEditor.cxx:18
 TCurlyArcEditor.cxx:19
 TCurlyArcEditor.cxx:20
 TCurlyArcEditor.cxx:21
 TCurlyArcEditor.cxx:22
 TCurlyArcEditor.cxx:23
 TCurlyArcEditor.cxx:24
 TCurlyArcEditor.cxx:25
 TCurlyArcEditor.cxx:26
 TCurlyArcEditor.cxx:27
 TCurlyArcEditor.cxx:28
 TCurlyArcEditor.cxx:29
 TCurlyArcEditor.cxx:30
 TCurlyArcEditor.cxx:31
 TCurlyArcEditor.cxx:32
 TCurlyArcEditor.cxx:33
 TCurlyArcEditor.cxx:34
 TCurlyArcEditor.cxx:35
 TCurlyArcEditor.cxx:36
 TCurlyArcEditor.cxx:37
 TCurlyArcEditor.cxx:38
 TCurlyArcEditor.cxx:39
 TCurlyArcEditor.cxx:40
 TCurlyArcEditor.cxx:41
 TCurlyArcEditor.cxx:42
 TCurlyArcEditor.cxx:43
 TCurlyArcEditor.cxx:44
 TCurlyArcEditor.cxx:45
 TCurlyArcEditor.cxx:46
 TCurlyArcEditor.cxx:47
 TCurlyArcEditor.cxx:48
 TCurlyArcEditor.cxx:49
 TCurlyArcEditor.cxx:50
 TCurlyArcEditor.cxx:51
 TCurlyArcEditor.cxx:52
 TCurlyArcEditor.cxx:53
 TCurlyArcEditor.cxx:54
 TCurlyArcEditor.cxx:55
 TCurlyArcEditor.cxx:56
 TCurlyArcEditor.cxx:57
 TCurlyArcEditor.cxx:58
 TCurlyArcEditor.cxx:59
 TCurlyArcEditor.cxx:60
 TCurlyArcEditor.cxx:61
 TCurlyArcEditor.cxx:62
 TCurlyArcEditor.cxx:63
 TCurlyArcEditor.cxx:64
 TCurlyArcEditor.cxx:65
 TCurlyArcEditor.cxx:66
 TCurlyArcEditor.cxx:67
 TCurlyArcEditor.cxx:68
 TCurlyArcEditor.cxx:69
 TCurlyArcEditor.cxx:70
 TCurlyArcEditor.cxx:71
 TCurlyArcEditor.cxx:72
 TCurlyArcEditor.cxx:73
 TCurlyArcEditor.cxx:74
 TCurlyArcEditor.cxx:75
 TCurlyArcEditor.cxx:76
 TCurlyArcEditor.cxx:77
 TCurlyArcEditor.cxx:78
 TCurlyArcEditor.cxx:79
 TCurlyArcEditor.cxx:80
 TCurlyArcEditor.cxx:81
 TCurlyArcEditor.cxx:82
 TCurlyArcEditor.cxx:83
 TCurlyArcEditor.cxx:84
 TCurlyArcEditor.cxx:85
 TCurlyArcEditor.cxx:86
 TCurlyArcEditor.cxx:87
 TCurlyArcEditor.cxx:88
 TCurlyArcEditor.cxx:89
 TCurlyArcEditor.cxx:90
 TCurlyArcEditor.cxx:91
 TCurlyArcEditor.cxx:92
 TCurlyArcEditor.cxx:93
 TCurlyArcEditor.cxx:94
 TCurlyArcEditor.cxx:95
 TCurlyArcEditor.cxx:96
 TCurlyArcEditor.cxx:97
 TCurlyArcEditor.cxx:98
 TCurlyArcEditor.cxx:99
 TCurlyArcEditor.cxx:100
 TCurlyArcEditor.cxx:101
 TCurlyArcEditor.cxx:102
 TCurlyArcEditor.cxx:103
 TCurlyArcEditor.cxx:104
 TCurlyArcEditor.cxx:105
 TCurlyArcEditor.cxx:106
 TCurlyArcEditor.cxx:107
 TCurlyArcEditor.cxx:108
 TCurlyArcEditor.cxx:109
 TCurlyArcEditor.cxx:110
 TCurlyArcEditor.cxx:111
 TCurlyArcEditor.cxx:112
 TCurlyArcEditor.cxx:113
 TCurlyArcEditor.cxx:114
 TCurlyArcEditor.cxx:115
 TCurlyArcEditor.cxx:116
 TCurlyArcEditor.cxx:117
 TCurlyArcEditor.cxx:118
 TCurlyArcEditor.cxx:119
 TCurlyArcEditor.cxx:120
 TCurlyArcEditor.cxx:121
 TCurlyArcEditor.cxx:122
 TCurlyArcEditor.cxx:123
 TCurlyArcEditor.cxx:124
 TCurlyArcEditor.cxx:125
 TCurlyArcEditor.cxx:126
 TCurlyArcEditor.cxx:127
 TCurlyArcEditor.cxx:128
 TCurlyArcEditor.cxx:129
 TCurlyArcEditor.cxx:130
 TCurlyArcEditor.cxx:131
 TCurlyArcEditor.cxx:132
 TCurlyArcEditor.cxx:133
 TCurlyArcEditor.cxx:134
 TCurlyArcEditor.cxx:135
 TCurlyArcEditor.cxx:136
 TCurlyArcEditor.cxx:137
 TCurlyArcEditor.cxx:138
 TCurlyArcEditor.cxx:139
 TCurlyArcEditor.cxx:140
 TCurlyArcEditor.cxx:141
 TCurlyArcEditor.cxx:142
 TCurlyArcEditor.cxx:143
 TCurlyArcEditor.cxx:144
 TCurlyArcEditor.cxx:145
 TCurlyArcEditor.cxx:146
 TCurlyArcEditor.cxx:147
 TCurlyArcEditor.cxx:148
 TCurlyArcEditor.cxx:149
 TCurlyArcEditor.cxx:150
 TCurlyArcEditor.cxx:151
 TCurlyArcEditor.cxx:152
 TCurlyArcEditor.cxx:153
 TCurlyArcEditor.cxx:154
 TCurlyArcEditor.cxx:155
 TCurlyArcEditor.cxx:156
 TCurlyArcEditor.cxx:157
 TCurlyArcEditor.cxx:158
 TCurlyArcEditor.cxx:159
 TCurlyArcEditor.cxx:160
 TCurlyArcEditor.cxx:161
 TCurlyArcEditor.cxx:162
 TCurlyArcEditor.cxx:163
 TCurlyArcEditor.cxx:164
 TCurlyArcEditor.cxx:165
 TCurlyArcEditor.cxx:166
 TCurlyArcEditor.cxx:167
 TCurlyArcEditor.cxx:168
 TCurlyArcEditor.cxx:169
 TCurlyArcEditor.cxx:170
 TCurlyArcEditor.cxx:171
 TCurlyArcEditor.cxx:172
 TCurlyArcEditor.cxx:173
 TCurlyArcEditor.cxx:174
 TCurlyArcEditor.cxx:175
 TCurlyArcEditor.cxx:176
 TCurlyArcEditor.cxx:177
 TCurlyArcEditor.cxx:178
 TCurlyArcEditor.cxx:179
 TCurlyArcEditor.cxx:180
 TCurlyArcEditor.cxx:181
 TCurlyArcEditor.cxx:182
 TCurlyArcEditor.cxx:183
 TCurlyArcEditor.cxx:184
 TCurlyArcEditor.cxx:185
 TCurlyArcEditor.cxx:186
 TCurlyArcEditor.cxx:187
 TCurlyArcEditor.cxx:188
 TCurlyArcEditor.cxx:189
 TCurlyArcEditor.cxx:190
 TCurlyArcEditor.cxx:191
 TCurlyArcEditor.cxx:192
 TCurlyArcEditor.cxx:193
 TCurlyArcEditor.cxx:194
 TCurlyArcEditor.cxx:195
 TCurlyArcEditor.cxx:196
 TCurlyArcEditor.cxx:197
 TCurlyArcEditor.cxx:198
 TCurlyArcEditor.cxx:199
 TCurlyArcEditor.cxx:200
 TCurlyArcEditor.cxx:201
 TCurlyArcEditor.cxx:202
 TCurlyArcEditor.cxx:203
 TCurlyArcEditor.cxx:204
 TCurlyArcEditor.cxx:205
 TCurlyArcEditor.cxx:206
 TCurlyArcEditor.cxx:207
 TCurlyArcEditor.cxx:208
 TCurlyArcEditor.cxx:209