GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4HisDrawOptionsShort.cpp
Go to the documentation of this file.
1 // $Id: TGo4HisDrawOptionsShort.cpp 3124 2021-03-30 08:47:53Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
15 
16 #include "TROOT.h"
17 #include "TColor.h"
18 #include "TAttLine.h"
19 #include "TAttFill.h"
20 #include "TAttMarker.h"
21 
22 #include "TGo4MdiArea.h"
23 #include "TGo4ViewPanel.h"
24 
25 #include <QColorDialog>
26 
27 
28 TGo4HisDrawOptionsShort::TGo4HisDrawOptionsShort(QWidget *parent, const char* name)
29  : QGo4Widget(parent,name)
30 {
31  setupUi(this);
32  QObject::connect(Xlin, SIGNAL(clicked()), this, SLOT(SlotXlin()));
33  QObject::connect(Xlog, SIGNAL(clicked()), this, SLOT(SlotXlog()));
34  QObject::connect(Ylin, SIGNAL(clicked()), this, SLOT(SlotYlin()));
35  QObject::connect(Ylog, SIGNAL(clicked()), this, SLOT(SlotYlog()));
36  QObject::connect(Zlin, SIGNAL(clicked()), this, SLOT(SlotZlin()));
37  QObject::connect(Zlog, SIGNAL(clicked()), this, SLOT(SlotZlog()));
38  QObject::connect(D1his, SIGNAL(clicked()), this, SLOT(SlotD1his()));
39  QObject::connect(D1line, SIGNAL(clicked()), this, SLOT(SlotD1line()));
40  QObject::connect(D2scatter, SIGNAL(clicked()), this, SLOT(SlotD2scatter()));
41  QObject::connect(D2pixel, SIGNAL(clicked()), this, SLOT(SlotD2pixel()));
42  QObject::connect(D2surfcol, SIGNAL(clicked()), this, SLOT(SlotD2surfcol()));
43  QObject::connect(D2lego, SIGNAL(clicked()), this, SLOT(SlotD2lego()));
44  QObject::connect(D2contfill, SIGNAL(clicked()), this, SLOT(SlotD2contfill()));
45  QObject::connect(D2contline, SIGNAL(clicked()), this, SLOT(SlotD2contline()));
46  QObject::connect(LineColor, SIGNAL(clicked()), this, SLOT(SlotLineColor()));
47  QObject::connect(FillColor, SIGNAL(clicked()), this, SLOT(SlotFillColor()));
48  QObject::connect(MarkerColor, SIGNAL(clicked()), this, SLOT(SlotMarkerColor()));
49 }
50 
52 {
53  SetDrawOpt(3, 0, "");
54 }
55 
57 {
58  SetDrawOpt(3, 1, "");
59 }
60 
62 {
63  SetDrawOpt(4, 0, "");
64 }
65 
67 {
68  SetDrawOpt(4, 1, "");
69 }
70 
72 {
73  SetDrawOpt(5, 0, "");
74 }
75 
77 {
78  SetDrawOpt(5, 1, "");
79 }
80 
82 {
83  SetDrawOpt(0, 0, "");
84 }
85 
87 {
88  SetDrawOpt(0, 0, "L");
89 }
90 
92 {
93  SetDrawOpt(0, 0, "HIST");
94 }
95 
97 {
98  SetDrawOpt(0, 0, "COLZ");
99 }
100 
102 {
103  SetDrawOpt(0, 0, "SURF2");
104 }
105 
107 {
108  SetDrawOpt(0, 0, "LEGO2");
109 }
110 
112 {
113  SetDrawOpt(0, 0, "CONT0Z");
114 }
115 
117 {
118  SetDrawOpt(0, 0, "CONT1Z");
119 }
120 
122 {
123  ChangeColor(0);
124 }
125 
127 {
128  ChangeColor(1);
129 }
130 
132 {
133  ChangeColor(2);
134 }
135 
137 {
139  if (panel==0) return;
140 
141  TPad* pad = panel->GetActivePad();
142  TObject* obj = panel->GetSelectedObject(pad, 0);
143 
144  Color_t icol = 0;
145 
146  switch (kind) {
147  case 0: {
148  TAttLine* att = dynamic_cast<TAttLine*> (obj);
149  if (att==0) return;
150  icol = att->GetLineColor();
151  break;
152  }
153  case 1: {
154  TAttFill* att = dynamic_cast<TAttFill*> (obj);
155  if (att==0) return;
156  icol = att->GetFillColor();
157  break;
158  }
159  case 2: {
160  TAttMarker* att = dynamic_cast<TAttMarker*> (obj);
161  if (att==0) return;
162  icol = att->GetMarkerColor();
163  break;
164  }
165  }
166 
167  TColor* rcol = gROOT->GetColor(icol);
168 
169  QColor qcol;
170 
171  if (rcol!=0)
172  qcol.setRgb(rcol->GetRed(), rcol->GetGreen(), rcol->GetBlue());
173 
174  QColor c = QColorDialog::getColor(qcol);
175  if (!c.isValid()) return;
176 
177  icol = TColor::GetColor(c.red(), c.green(), c.blue());
178 
179  switch (kind) {
180  case 0: {
181  TAttLine* att = dynamic_cast<TAttLine*> (obj);
182  if (att!=0) att->SetLineColor(icol);
183  break;
184  }
185  case 1: {
186  TAttFill* att = dynamic_cast<TAttFill*> (obj);
187  if (att!=0) att->SetFillColor(icol);
188  break;
189  }
190  case 2: {
191  TAttMarker* att = dynamic_cast<TAttMarker*> (obj);
192  if (att!=0) att->SetMarkerColor(icol);
193  break;
194  }
195  }
196 
197  panel->MarkPadModified(pad);
198 
199  panel->ShootRepaintTimer(pad);
200 
201  panel->ActivateInGedEditor(obj);
202 }
203 
204 void TGo4HisDrawOptionsShort::SetDrawOpt(int kind, int value, const char *dropt)
205 {
207  if (panel!=0) panel->ChangeDrawOption(kind, value,dropt);
208 }
virtual void ShootRepaintTimer()
virtual void ActivateInGedEditor(TObject *obj)
void SetDrawOpt(int kind, int value, const char *dropt)
static TGo4MdiArea * Instance()
Definition: TGo4MdiArea.cpp:26
virtual void MarkPadModified(TPad *pad)
TGo4ViewPanel * GetActivePanel()
Definition: TGo4MdiArea.cpp:62
TGo4HisDrawOptionsShort(QWidget *parent=0, const char *name=0)
virtual void ChangeDrawOption(int kind, int value, const char *drawopt)
virtual TPad * GetActivePad()
virtual TObject * GetSelectedObject(TPad *pad, const char **drawopt)