GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4HisDrawOptionsShort.cpp
Go to the documentation of this file.
1// $Id$
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
28TGo4HisDrawOptionsShort::TGo4HisDrawOptionsShort(QWidget *parent, const char *name)
29 : QGo4Widget(parent,name)
30{
31 setupUi(this);
32 QObject::connect(Xlin, &QPushButton::clicked, this, &TGo4HisDrawOptionsShort::SlotXlin);
33 QObject::connect(Xlog, &QPushButton::clicked, this, &TGo4HisDrawOptionsShort::SlotXlog);
34 QObject::connect(Ylin, &QPushButton::clicked, this, &TGo4HisDrawOptionsShort::SlotYlin);
35 QObject::connect(Ylog, &QPushButton::clicked, this, &TGo4HisDrawOptionsShort::SlotYlog);
36 QObject::connect(Zlin, &QPushButton::clicked, this, &TGo4HisDrawOptionsShort::SlotZlin);
37 QObject::connect(Zlog, &QPushButton::clicked, this, &TGo4HisDrawOptionsShort::SlotZlog);
38 QObject::connect(D1his, &QPushButton::clicked, this, &TGo4HisDrawOptionsShort::SlotD1his);
39 QObject::connect(D1line, &QPushButton::clicked, this, &TGo4HisDrawOptionsShort::SlotD1line);
40 QObject::connect(D2scatter, &QPushButton::clicked, this, &TGo4HisDrawOptionsShort::SlotD2scatter);
41 QObject::connect(D2pixel, &QPushButton::clicked, this, &TGo4HisDrawOptionsShort::SlotD2pixel);
42 QObject::connect(D2surfcol, &QPushButton::clicked, this, &TGo4HisDrawOptionsShort::SlotD2surfcol);
43 QObject::connect(D2lego, &QPushButton::clicked, this, &TGo4HisDrawOptionsShort::SlotD2lego);
44 QObject::connect(D2contfill, &QPushButton::clicked, this, &TGo4HisDrawOptionsShort::SlotD2contfill);
45 QObject::connect(D2contline, &QPushButton::clicked, this, &TGo4HisDrawOptionsShort::SlotD2contline);
46 QObject::connect(LineColor, &QPushButton::clicked, this, &TGo4HisDrawOptionsShort::SlotLineColor);
47 QObject::connect(FillColor, &QPushButton::clicked, this, &TGo4HisDrawOptionsShort::SlotFillColor);
48 QObject::connect(MarkerColor, &QPushButton::clicked, this, &TGo4HisDrawOptionsShort::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
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
125
130
135
137{
139 if (!panel) return;
140
141 TPad *pad = panel->GetActivePad();
142 TObject *obj = panel->GetSelectedObject(pad, nullptr);
143
144 Color_t icol = 0;
145
146 switch (kind) {
147 case 0: {
148 TAttLine* att = dynamic_cast<TAttLine*> (obj);
149 if (!att) return;
150 icol = att->GetLineColor();
151 break;
152 }
153 case 1: {
154 TAttFill* att = dynamic_cast<TAttFill*> (obj);
155 if (!att) return;
156 icol = att->GetFillColor();
157 break;
158 }
159 case 2: {
160 TAttMarker* att = dynamic_cast<TAttMarker*> (obj);
161 if (!att) return;
162 icol = att->GetMarkerColor();
163 break;
164 }
165 }
166
167 TColor* rcol = gROOT->GetColor(icol);
168
169 QColor qcol;
170
171 if (rcol)
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) att->SetLineColor(icol);
183 break;
184 }
185 case 1: {
186 TAttFill* att = dynamic_cast<TAttFill*> (obj);
187 if (att) att->SetFillColor(icol);
188 break;
189 }
190 case 2: {
191 TAttMarker* att = dynamic_cast<TAttMarker*> (obj);
192 if (att) att->SetMarkerColor(icol);
193 break;
194 }
195 }
196
197 panel->MarkPadModified(pad);
198
199 panel->ShootRepaintTimer(pad);
200
201 panel->ActivateInGedEditor(obj);
202}
203
204void TGo4HisDrawOptionsShort::SetDrawOpt(int kind, int value, const char *dropt)
205{
207 if (panel) panel->ChangeDrawOption(kind, value,dropt);
208}
QGo4Widget(QWidget *parent=nullptr, const char *name=nullptr, Qt::WindowFlags f=Qt::Widget)
void SetDrawOpt(int kind, int value, const char *dropt)
TGo4HisDrawOptionsShort(QWidget *parent=nullptr, const char *name=nullptr)
static TGo4MdiArea * Instance()
TGo4ViewPanel * GetActivePanel()
virtual void ShootRepaintTimer()
virtual void MarkPadModified(TPad *pad)
virtual void ChangeDrawOption(int kind, int value, const char *drawopt)
virtual TObject * GetSelectedObject(TPad *pad, const char **drawopt)
virtual TPad * GetActivePad()
virtual void ActivateInGedEditor(TObject *obj)