GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4HisDrawOptions.cpp
Go to the documentation of this file.
1 // $Id: TGo4HisDrawOptions.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 
14 #include "TGo4HisDrawOptions.h"
15 
16 #include "TROOT.h"
17 #include "TColor.h"
18 #include "TAttLine.h"
19 #include "TAttFill.h"
20 #include "TAttMarker.h"
21 
22 #include "TGo4Picture.h"
23 #include "TGo4ViewPanel.h"
24 #include "TGo4MdiArea.h"
25 
26 #include <QColorDialog>
27 
28 TGo4HisDrawOptions::TGo4HisDrawOptions( QWidget* parent, const char* name, Qt::WindowFlags fl )
29  : QWidget( parent, fl )
30 {
31  setObjectName( name ? name : "Go4HisDrawOptions");
32  setupUi(this);
33 
34  QObject::connect(DrawOption, SIGNAL(activated(int)), this, SLOT(SetDrawOptions(int)));
35  QObject::connect(ErrorBars, SIGNAL(activated(int)), this, SLOT(SetErrorBars(int)));
36  QObject::connect(Coordinates, SIGNAL(activated(int)), this, SLOT(SetCoordinates(int)));
37  QObject::connect(XStyle, SIGNAL(activated(int)), this, SLOT(XaxisStyle(int)));
38  QObject::connect(YStyle, SIGNAL(activated(int)), this, SLOT(YaxisStyle(int)));
39  QObject::connect(ZStyle, SIGNAL(activated(int)), this, SLOT(ZaxisStyle(int)));
40  QObject::connect(AutoScaleBox, SIGNAL(toggled(bool)), this, SLOT(SetAutoScale(bool)));
41  QObject::connect(LineColor, SIGNAL(clicked()), this, SLOT(SetLineColor()));
42  QObject::connect(FillColor, SIGNAL(clicked()), this, SLOT(SetFillColor()));
43  QObject::connect(MarkerColor, SIGNAL(clicked()), this, SLOT(SetMarkerColor()));
44 
45 
46  fbSettingPanelData = true;
47 
48  connect(TGo4MdiArea::Instance(), SIGNAL(panelSignal(TGo4ViewPanel*, TPad*, int)),
49  this, SLOT(panelSlot(TGo4ViewPanel*, TPad*, int)));
50 
52 
53  AutoScaleBox->setVisible(false);
54 
55  LineColor->setEnabled(false);
56  FillColor->setEnabled(false);
57  MarkerColor->setEnabled(false);
58 
59  fbSettingPanelData = false;
60 }
61 
62 void TGo4HisDrawOptions::panelSlot(TGo4ViewPanel* panel, TPad* pad, int signalid)
63 {
64  switch (signalid) {
67  break;
70  TGo4Picture* padopt = panel->GetPadOptions(pad);
71  if (padopt==0) break;
72 
73  int ndim = padopt->GetFullRangeDim();
74  if (ndim<=0) ndim = 1;
75 
76  const char* drawopt = 0;
77  TObject* obj = panel->GetSelectedObject(pad, &drawopt);
78 
79  int viewtype = view_Histo1;
80 
81  TString buf(drawopt);
82  buf.ToLower();
83 
84  if ((obj!=0) && obj->InheritsFrom("TGraphPolar"))
85  viewtype = view_Polar;
86  else
87  if ((obj!=0) && (obj->InheritsFrom("TGraph") || obj->InheritsFrom("TMultiGraph")))
88  viewtype = view_Graph;
89  else
90  if (ndim==1)
91  viewtype = view_Histo1;
92  else
93  if (buf.Contains("lego") || buf.Contains("surf"))
94  viewtype = view_Histo2ext;
95  else
96  viewtype = view_Histo2;
97 
98  fbSettingPanelData = true;
99 
100  if (fiLastView!=viewtype) UpdateView(viewtype, panel->IsWebCanvas());
101 
102  int ErrorStyle = 0, CoordStyle = 0, DrawStyle = 0;
103  DecodeDrawOption(drawopt, ErrorStyle, CoordStyle, DrawStyle);
104 
105  Coordinates->setEnabled(!panel->IsWebCanvas());
106  if (panel->IsWebCanvas()) CoordStyle = 0;
107 
108  DrawOption->setCurrentIndex(DrawStyle);
109  ErrorBars->setCurrentIndex(ErrorStyle);
110  Coordinates->setCurrentIndex(CoordStyle);
111  XStyle->setCurrentIndex(padopt->GetLogScale(0));
112  YStyle->setCurrentIndex(padopt->GetLogScale(1));
113  ZStyle->setCurrentIndex(padopt->GetLogScale(2));
114  ZStyle->setEnabled(ndim>1);
115  AutoScaleBox->setChecked(padopt->IsAutoScale());
116 
117  LineColor->setEnabled(dynamic_cast<TAttLine*>(obj)!=0);
118  FillColor->setEnabled(dynamic_cast<TAttFill*>(obj)!=0);
119  MarkerColor->setEnabled(dynamic_cast<TAttMarker*>(obj)!=0);
120 
121  fbSettingPanelData = false;
122 
123  break; }
124  default:
125  break;
126  }
127 }
128 
129 void TGo4HisDrawOptions::UpdateView(int viewtype, bool webcanvas)
130 {
131  int lines=30;
132  ErrorBars->clear();
133  DrawOption->clear();
134  Coordinates->clear();
135 
136  switch(viewtype) {
137  case view_Histo1:
138  DrawOption->addItem( QIcon(":/icons/h1_t.png"), " scatter");
139  DrawOption->addItem( QIcon(""), "AH no axis");
140  DrawOption->addItem( QIcon(""), "*H stars");
141  DrawOption->addItem( QIcon(""), "L lines");
142  DrawOption->addItem( QIcon(""), "LF2 lines+fill");
143  DrawOption->addItem( QIcon(""), "C curve");
144  DrawOption->addItem( QIcon(""), "B barchart");
145  DrawOption->addItem( QIcon(""), "P polymarkers");
146  DrawOption->addItem( QIcon(""), "P0 polymarkers");
147  DrawOption->addItem( QIcon(""), "9H high resol");
148  DrawOption->addItem( QIcon(""), "][ no right");
149  DrawOption->addItem( QIcon(""), "TEXT digits b/w");
150  DrawOption->addItem( QIcon(""), "BAR barchart");
151  DrawOption->addItem( QIcon(":/icons/lego.png"), " lego b/w");
152  DrawOption->addItem( QIcon(":/icons/lego1.png"), " lego1 shadow");
153  DrawOption->addItem( QIcon(":/icons/lego2.png"), " lego2 color");
154  DrawOption->addItem( QIcon(":/icons/surf.png"), " mesh b/w");
155  DrawOption->addItem( QIcon(":/icons/surf1.png"), " mesh color");
156  DrawOption->addItem( QIcon(":/icons/surf2.png"), " surf c");
157  DrawOption->addItem( QIcon(":/icons/surf3.png"), " mesh+contour");
158  DrawOption->addItem( QIcon(":/icons/surf4.png"), " gourand");
159  DrawOption->addItem( QIcon(":/icons/surf5.png"), " col contour");
160  DrawOption->addItem( QIcon(""), "");
161  lines=30;
162  break;
163  case view_Histo2:
164  case view_Histo2ext:
165  DrawOption->addItem( QIcon(":/icons/h1_t.png"), " scatter");
166  DrawOption->addItem( QIcon(":/icons/col.png"), " pixel c");
167  DrawOption->addItem( QIcon(":/icons/cont0.png")," cont0 c");
168  DrawOption->addItem( QIcon(":/icons/lego2.png")," lego2 color");
169  DrawOption->addItem( QIcon(":/icons/surf2.png")," surf c");
170  DrawOption->addItem( QIcon(":/icons/surf1.png")," mesh color");
171  DrawOption->addItem( QIcon(":/icons/cont1.png")," cont1 c");
172  DrawOption->addItem( QIcon(":/icons/cont1.png")," cont4");
173  DrawOption->addItem( QIcon(":/icons/lego1.png")," lego1 shadow");
174  DrawOption->addItem( QIcon(":/icons/lego.png"), " lego b/w");
175  DrawOption->addItem( QIcon(":/icons/cont2.png")," cont2 dot b/w");
176  DrawOption->addItem( QIcon(":/icons/cont3.png")," cont3 b/w");
177  DrawOption->addItem( QIcon(":/icons/surf.png"), " mesh b/w");
178  DrawOption->addItem( QIcon(":/icons/surf3.png")," mesh+contour");
179  DrawOption->addItem( QIcon(":/icons/surf4.png")," gourand");
180  DrawOption->addItem( QIcon(":/icons/surf5.png")," col contour");
181  DrawOption->addItem( QIcon(""), "ARR arrow mode");
182  DrawOption->addItem( QIcon(""), "BOX boxes");
183  DrawOption->addItem( QIcon(""), "TEXT content");
184  lines=30;
185 #ifndef __NOGO4ASI__
186  if (!webcanvas) DrawOption->addItem( QIcon(":/icons/asimage.png"), " ASImage");
187  DrawOption->addItem( QIcon(""), "");
188 #else
189  DrawOption->addItem( QIcon(""), "");
190 #endif
191  break;
192  case view_Graph:
193  DrawOption->addItem("P: default");
194  DrawOption->addItem("*: stars");
195  DrawOption->addItem("L: line");
196  DrawOption->addItem("F: fill");
197  DrawOption->addItem("F1: fill 1");
198  DrawOption->addItem("F2: fill 2");
199  DrawOption->addItem("C: smooth");
200  DrawOption->addItem("B: bar");
201  DrawOption->addItem("LP: line + mark");
202  DrawOption->addItem("L*: line + *");
203  DrawOption->addItem("FP: fill + mark");
204  DrawOption->addItem("F*: fill + *");
205  DrawOption->addItem("CP: smooth + mark");
206  DrawOption->addItem("C*: smooth + *");
207  DrawOption->addItem("BP: smooth + mark");
208  DrawOption->addItem("B*: smooth + *");
209  lines=30;
210  break;
211  case view_Polar:
212  DrawOption->addItem(": opt as is");
213  DrawOption->addItem("P: polym");
214  DrawOption->addItem("F: fill");
215  DrawOption->addItem("PF: P+F");
216  lines = 10;
217  break;
218  }
219 
220  DrawOption->setMaxVisibleItems(lines);
221 
222  switch(viewtype) {
223  case view_Histo1:
224  ErrorBars->addItem("No Errors");
225  ErrorBars->addItem("E: simple");
226  ErrorBars->addItem("E1: edges");
227  ErrorBars->addItem("E2: rectangles");
228  ErrorBars->addItem("E3: fill");
229  ErrorBars->addItem("E4: contour");
230  break;
231  case view_Histo2:
232  ErrorBars->addItem("No palette");
233  ErrorBars->addItem(QIcon(":/icons/colz.png")," +scale");
234  break;
235  case view_Histo2ext:
236  ErrorBars->addItem("No palette");
237  ErrorBars->addItem(QIcon(":/icons/colz.png")," +scale");
238  ErrorBars->addItem(" - front");
239  ErrorBars->addItem(" - back");
240  ErrorBars->addItem(" - fr & bk");
241  ErrorBars->addItem(QIcon(":/icons/colz.png")," scale - fr");
242  ErrorBars->addItem(QIcon(":/icons/colz.png"), " scale - bk");
243  ErrorBars->addItem(QIcon(":/icons/colz.png"), " scale - fr & bk");
244  break;
245  case view_Graph:
246  ErrorBars->addItem("errors as is");
247  ErrorBars->addItem("X: no errors");
248  ErrorBars->addItem(">: arrow");
249  ErrorBars->addItem("|>: full arrow");
250  ErrorBars->addItem("2: err opt 2");
251  ErrorBars->addItem("3: err opt 3");
252  ErrorBars->addItem("4: err opt 4");
253  ErrorBars->addItem("[]: asym err");
254  break;
255  case view_Polar:
256  ErrorBars->addItem(": err as is");
257  ErrorBars->addItem("E: error bars");
258  ErrorBars->addItem("N: no labels");
259  ErrorBars->addItem("EN: E+N");
260  break;
261  }
262 
263  switch(viewtype) {
264  case view_Histo1:
265  case view_Histo2:
266  case view_Histo2ext:
267  Coordinates->addItem("Cartesian");
268  Coordinates->addItem("Polar");
269  Coordinates->addItem("Spheric");
270  Coordinates->addItem("Rapidity");
271  Coordinates->addItem("Cylindric");
272  break;
273  case view_Graph:
274  Coordinates->addItem("A: norm axis");
275  Coordinates->addItem("AI: supp. axis");
276  Coordinates->addItem("AX+: top");
277  Coordinates->addItem("AY+: right");
278  Coordinates->addItem("AX+Y+: x & y");
279  Coordinates->addItem("A1: ylow = ymin");
280  break;
281  case view_Polar:
282  Coordinates->addItem(": axis as is");
283  Coordinates->addItem("A: force axis");
284  Coordinates->addItem("O: orthogonal");
285  Coordinates->addItem("AO: A+O");
286  break;
287  }
288 
289  fiLastView = viewtype;
290 }
291 
293 {
294  if (fbSettingPanelData) return;
295 
297  if (panel==0) return;
298 
299  TPad* pad = panel->GetActivePad();
300 
301  TString buf;
302  const char* drawopt = 0;
303 
304  if ((kind>=0) && (kind<=2)) {
305  CodeDrawOptions(ErrorBars->currentIndex(),
306  Coordinates->currentIndex(),
307  DrawOption->currentIndex(), buf);
308  if (buf.Length()>0) drawopt = buf.Data();
309  }
310 
311  panel->ChangeDrawOption(kind, value, drawopt);
312 }
313 
315 {
317 }
318 
320 {
322 }
323 
325 {
327 }
328 
330 {
332 }
333 
335 {
337 }
338 
340 {
342 }
343 
345 {
346  ChangeDrawOptionForCurrentPanel(10, on ? 1 : 0);
347 }
348 
349 void TGo4HisDrawOptions::DecodeDrawOption(const char* drawopt,
350  int& HisErrorStyle,
351  int& HisCoordStyle,
352  int& HisDrawStyle)
353 {
354  HisDrawStyle = 0;
355  HisErrorStyle = 0;
356  HisCoordStyle = 0;
357  if (fiLastView==view_Histo2) HisDrawStyle = 1;
358 
359  if ((drawopt==0) || (*drawopt==0)) return;
360 
361  TString buf(drawopt);
362  buf.ToLower();
363 
364 // check for error options in string:
365 
366  if (fiLastView==view_Polar) {
367  if (buf.Contains("p") && buf.Contains("f")) HisDrawStyle = 3; else
368  if (buf.Contains("f")) HisDrawStyle = 2; else
369  if (buf.Contains("p")) HisDrawStyle = 1; else HisDrawStyle = 0;
370 
371  if (buf.Contains("a") && buf.Contains("o")) HisCoordStyle = 3; else
372  if (buf.Contains("o")) HisCoordStyle = 2; else
373  if (buf.Contains("a")) HisCoordStyle = 1; else HisCoordStyle = 0;
374 
375  if (buf.Contains("e") && buf.Contains("n")) HisErrorStyle = 3; else
376  if (buf.Contains("n")) HisErrorStyle = 2; else
377  if (buf.Contains("e")) HisErrorStyle = 1; else HisErrorStyle = 0;
378 
379  return;
380  }
381 
382  if (fiLastView==view_Graph) {
383 
384  if (buf.Contains("b") && buf.Contains("*")) HisDrawStyle = 15; else
385  if (buf.Contains("b") && buf.Contains("p")) HisDrawStyle = 14; else
386  if (buf.Contains("c") && buf.Contains("*")) HisDrawStyle = 13; else
387  if (buf.Contains("c") && buf.Contains("p")) HisDrawStyle = 12; else
388  if (buf.Contains("f") && buf.Contains("*")) HisDrawStyle = 11; else
389  if (buf.Contains("f") && buf.Contains("p")) HisDrawStyle = 10; else
390  if (buf.Contains("l") && buf.Contains("*")) HisDrawStyle = 9; else
391  if (buf.Contains("l") && buf.Contains("p")) HisDrawStyle = 8; else
392  if (buf.Contains("b")) HisDrawStyle = 7; else
393  if (buf.Contains("c")) HisDrawStyle = 6; else
394  if (buf.Contains("f2")) HisDrawStyle = 5; else
395  if (buf.Contains("f1")) HisDrawStyle = 4; else
396  if (buf.Contains("f")) HisDrawStyle = 3; else
397  if (buf.Contains("l")) HisDrawStyle = 2; else
398  if (buf.Contains("*")) HisDrawStyle = 1;
399 
400  if (buf.Contains("x+") && buf.Contains("y+")) HisCoordStyle = 4; else
401  if (buf.Contains("y+")) HisCoordStyle = 3; else
402  if (buf.Contains("x+")) HisCoordStyle = 2; else
403  if (buf.Contains("a1")) HisCoordStyle = 5; else
404  if (buf.Contains("ai")) HisCoordStyle = 1; else
405  if (buf.Contains("a")) HisCoordStyle = 0; else HisCoordStyle = 1;
406 
407  if (buf.Contains("x") && (HisCoordStyle!=4) && (HisCoordStyle!=2)) HisErrorStyle = 1; else
408  if (buf.Contains("|>")) HisErrorStyle = 3; else
409  if (buf.Contains(">")) HisErrorStyle = 2; else
410  if (buf.Contains("2") && (HisDrawStyle != 5)) HisErrorStyle = 4; else
411  if (buf.Contains("3")) HisErrorStyle = 5; else
412  if (buf.Contains("4")) HisErrorStyle = 6; else
413  if (buf.Contains("[]")) HisErrorStyle = 7;
414 
415  return;
416  }
417 
418  if (fiLastView==view_Histo1) {
419  if(buf.Contains("e1")) HisErrorStyle = 2; else
420  if(buf.Contains("e2")) HisErrorStyle = 3; else
421  if(buf.Contains("e3")) HisErrorStyle = 4; else
422  if(buf.Contains("e4")) HisErrorStyle = 5; else
423  if(buf.Contains("e") && !buf.Contains("text") && !buf.Contains("lego") && !buf.Contains("image")) HisErrorStyle = 1;
424  } else { // Histo2
425  if (buf.Contains("lego") || buf.Contains("surf")) {
426  if (buf.Contains("fb") && buf.Contains("bb") && buf.Contains("z")) HisErrorStyle = 7; else
427  if (buf.Contains("bb") && buf.Contains("z")) HisErrorStyle = 6; else
428  if (buf.Contains("fb") && buf.Contains("z")) HisErrorStyle = 5; else
429  if (buf.Contains("fb") && buf.Contains("bb")) HisErrorStyle = 4; else
430  if (buf.Contains("bb")) HisErrorStyle = 3; else
431  if (buf.Contains("fb")) HisErrorStyle = 2; else
432  if (buf.Contains("z")) HisErrorStyle = 1;
433  } else
434  if (buf.Contains("z")) HisErrorStyle = 1;
435  }
436 
437  // check coordinate specs in string:
438  if(buf.Contains(",pol")) HisCoordStyle = 1; else
439  if(buf.Contains(",sph")) HisCoordStyle = 2; else
440  if(buf.Contains(",psr")) HisCoordStyle = 3; else
441  if(buf.Contains(",cyl")) HisCoordStyle = 4;
442 
443  // check draw options itself:
444 
445  if (fiLastView==view_Histo1) {
446  if(buf.Contains("surf5")) HisDrawStyle = 21; else
447  if(buf.Contains("surf4")) HisDrawStyle = 20; else
448  if(buf.Contains("surf3")) HisDrawStyle = 19; else
449  if(buf.Contains("surf2")) HisDrawStyle = 18; else
450  if(buf.Contains("surf1")) HisDrawStyle = 17; else
451  if(buf.Contains("surf")) HisDrawStyle = 16; else
452  if(buf.Contains("lego2")) HisDrawStyle = 15; else
453  if(buf.Contains("lego1")) HisDrawStyle = 14; else
454  if(buf.Contains("lego")) HisDrawStyle = 13; else
455  if(buf.Contains("lego3")) HisDrawStyle = 13; else // from gededitor
456  if(buf.Contains("bar")) HisDrawStyle = 12; else
457  if(buf.Contains("text")) HisDrawStyle = 11; else
458  if(buf.Contains("][")) HisDrawStyle = 10; else
459  if(buf.Contains("9h")) HisDrawStyle = 9; else
460  if(buf.Contains("p0")) HisDrawStyle = 8; else
461  if(*drawopt == 'p') HisDrawStyle = 7; else
462  if(*drawopt == 'P') HisDrawStyle = 7; else
463  if(*drawopt == 'b') HisDrawStyle = 6; else
464  if(*drawopt == 'B') HisDrawStyle = 6; else
465  if((*drawopt == 'c') && !buf.Contains("nostack")) HisDrawStyle = 5; else
466  if((*drawopt == 'C') && !buf.Contains("nostack")) HisDrawStyle = 5; else
467  if(buf.Contains("lf2")) HisDrawStyle = 4; else
468  if(*drawopt == 'l') HisDrawStyle = 3; else
469  if(*drawopt == 'L') HisDrawStyle = 3; else
470  if(buf.Contains("*h")) HisDrawStyle = 2; else
471  if(buf.Contains("ah")) HisDrawStyle = 1;
472 
473  if ((HisDrawStyle>=16) && ((HisCoordStyle==0) || (HisCoordStyle==2)))
474  HisCoordStyle = 1;
475  } else { // Histo2
476  if(buf.Contains("hist")) HisDrawStyle = 0; else
477  if(buf.Contains("col")) HisDrawStyle = 1; else
478  if(buf.Contains("lego3")) HisDrawStyle = 9; else // from gededitor
479  if(buf.Contains("lego1")) HisDrawStyle = 8; else
480  if(buf.Contains("lego2")) HisDrawStyle = 3; else
481  if(buf.Contains("lego")) HisDrawStyle = 9; else
482  if(buf.Contains("cont0")) HisDrawStyle = 2; else
483  if(buf.Contains("cont1")) HisDrawStyle = 6; else
484  if(buf.Contains("cont2")) HisDrawStyle = 10; else
485  if(buf.Contains("cont3")) HisDrawStyle = 11; else
486  if(buf.Contains("cont4")) HisDrawStyle = 7; else
487  if(buf.Contains("cont")) HisDrawStyle = 2; else
488  if(buf.Contains("surf1")) HisDrawStyle = 5; else
489  if(buf.Contains("surf2")) HisDrawStyle = 4; else
490  if(buf.Contains("surf3")) HisDrawStyle = 13; else
491  if(buf.Contains("surf4")) HisDrawStyle = 14; else
492  if(buf.Contains("surf5")) HisDrawStyle = 15; else
493  if(buf.Contains("surf")) HisDrawStyle = 12; else
494  if(buf.Contains("arr")) HisDrawStyle = 16; else
495  if(buf.Contains("box")) HisDrawStyle = 17; else
496  if(buf.Contains("text")) HisDrawStyle = 18; else
497  if(buf.Contains("asimage")) HisDrawStyle = 19;
498  }
499  //std::cout << *drawopt << " Decode " << buf << " Error " << HisErrorStyle
500  // << " Coord " << HisCoordStyle << " Draw " <<HisDrawStyle<< std::endl;
501 }
502 
503 void TGo4HisDrawOptions::CodeDrawOptions(int HisErrorStyle,
504  int HisCoordStyle,
505  int HisDrawStyle,
506  TString& buf)
507 {
508  buf = "";
509 
510  if (fiLastView==view_Polar) {
511  switch (HisDrawStyle) {
512  case 0: buf = ""; break;
513  case 1: buf = "P"; break;
514  case 2: buf = "F"; break;
515  case 3: buf = "PF"; break;
516  }
517 
518  switch (HisErrorStyle) {
519  case 0: break;
520  case 1: buf.Append("E"); break;
521  case 2: buf.Append("N"); break;
522  case 3: buf.Append("EN"); break;
523  }
524 
525  switch (HisCoordStyle) {
526  case 0: break;
527  case 1: buf.Append("A"); break;
528  case 2: buf.Append("O"); break;
529  case 3: buf.Append("AO"); break;
530  }
531  return;
532  }
533 
534 
535  if (fiLastView==view_Graph) {
536 
537  switch (HisDrawStyle) {
538  case 0: buf = "P"; break;
539  case 1: buf = "*"; break;
540  case 2: buf = "L"; break;
541  case 3: buf = "F"; break;
542  case 4: buf = "F1"; break;
543  case 5: buf = "F2"; break;
544  case 6: buf = "C"; break;
545  case 7: buf = "B"; break;
546  case 8: buf = "LP"; break;
547  case 9: buf = "L*"; break;
548  case 10: buf = "FP"; break;
549  case 11: buf = "F*"; break;
550  case 12: buf = "CP"; break;
551  case 13: buf = "C*"; break;
552  case 14: buf = "BP"; break;
553  case 15: buf = "B*"; break;
554  default: buf = "P";
555  }
556 
557  switch (HisErrorStyle) {
558  case 0: break;
559  case 1: buf.Append("X"); break;
560  case 2: buf.Append(">"); break;
561  case 3: buf.Append("|>"); break;
562  case 4: buf.Append("2"); break;
563  case 5: buf.Append("3"); break;
564  case 6: buf.Append("4"); break;
565  case 7: buf.Append("[]"); break;
566  }
567 
568  switch (HisCoordStyle) {
569  case 0: buf.Append("A"); break;
570  case 1: buf.Append("AI"); break;
571  case 2: buf.Append("AX+"); break;
572  case 3: buf.Append("AY+"); break;
573  case 4: buf.Append("AX+Y+"); break;
574  case 5: buf.Append("A1"); break;
575  }
576 
577  return;
578  }
579 
580  if (fiLastView==view_Histo1) {
581 
582  switch (HisDrawStyle) {
583  case 0: buf=""; break;
584  case 1: buf="ah"; break;
585  case 2: buf="*h"; break;
586  case 3: buf="l"; break;
587  case 4: buf="lf2"; break;
588  case 5: buf="c"; break;
589  case 6: buf="b"; break;
590  case 7: buf="p"; break;
591  case 8: buf="p0"; break;
592  case 9: buf="9h"; break;
593  case 10: buf="]["; break;
594  case 11: buf="text"; break;
595  case 12: buf="bar"; break;
596  case 13: buf="lego3"; break; // for geditor, "lego"
597  case 14: buf="lego1"; break;
598  case 15: buf="lego2"; break;
599  case 16: buf="surf"; break;
600  case 17: buf="surf1"; break;
601  case 18: buf="surf2"; break;
602  case 19: buf="surf3"; break;
603  case 20: buf="surf4"; break;
604  case 21: buf="surf5"; break;
605  }
606  if ((HisDrawStyle>=16) && ((HisCoordStyle==0) || (HisCoordStyle==2)))
607  HisCoordStyle = 1;
608  } else // Histo2
609 
610  switch (HisDrawStyle) {
611  case 0: buf="hist"; break;
612  case 1: buf="col"; break;
613  case 9: buf="lego3"; break;
614  case 8: buf="lego1"; break;
615  case 3: buf="lego2"; break;
616  case 2: buf="cont0"; break;
617  case 6: buf="cont1"; break;
618  case 10: buf="cont2"; break;
619  case 11: buf="cont3"; break;
620  case 7: buf="cont4"; break;
621  case 12: buf="surf"; break;
622  case 5: buf="surf1"; break;
623  case 4: buf="surf2"; break;
624  case 13: buf="surf3"; break;
625  case 14: buf="surf4"; break;
626  case 15: buf="surf5"; break;
627  case 16: buf="arr"; break;
628  case 17: buf="box"; break;
629  case 18: buf="text"; break;
630 #ifndef __NOGO4ASI__
631  case 19: buf="asimage"; break;
632 #else
633  case 19: buf=""; break;
634 #endif
635  }
636 
637  switch (HisCoordStyle) {
638  case 0: break;
639  case 1: buf.Append(",pol"); break;
640  case 2: buf.Append(",sph"); break;
641  case 3: buf.Append(",psr"); break;
642  case 4: buf.Append(",cyl"); break;
643  }
644 
645  if (fiLastView==view_Histo1)
646  switch (HisErrorStyle) {
647  case 0: break;
648  case 1: buf.Append("E"); break;
649  case 2: buf.Append("E1"); break;
650  case 3: buf.Append("E2"); break;
651  case 4: buf.Append("E3"); break;
652  case 5: buf.Append("E4"); break;
653  }
654  else
655  switch (HisErrorStyle) {
656  case 0: break;
657  case 1: buf.Append("Z"); break;
658  case 2: buf.Append("FB"); break;
659  case 3: buf.Append("BB"); break;
660  case 4: buf.Append("BBFB"); break;
661  case 5: buf.Append("ZFB"); break;
662  case 6: buf.Append("ZBB"); break;
663  case 7: buf.Append("ZBBFB"); break;
664  }
665 }
666 
667 
669 {
670  ChangeColor(0);
671 }
672 
674 {
675  ChangeColor(1);
676 }
677 
679 {
680  ChangeColor(2);
681 }
682 
684 {
686  if (panel==0) return;
687 
688  TPad* pad = panel->GetActivePad();
689  TObject* obj = panel->GetSelectedObject(pad, 0);
690 
691  Color_t icol = 0;
692 
693  switch (kind) {
694  case 0: {
695  TAttLine* att = dynamic_cast<TAttLine*> (obj);
696  if (att==0) return;
697  icol = att->GetLineColor();
698  break;
699  }
700  case 1: {
701  TAttFill* att = dynamic_cast<TAttFill*> (obj);
702  if (att==0) return;
703  icol = att->GetFillColor();
704  break;
705  }
706  case 2: {
707  TAttMarker* att = dynamic_cast<TAttMarker*> (obj);
708  if (att==0) return;
709  icol = att->GetMarkerColor();
710  break;
711  }
712  }
713 
714  TColor* rcol = gROOT->GetColor(icol);
715 
716  QColor qcol;
717 
718  if (rcol!=0)
719  qcol.setRgb(rcol->GetRed(), rcol->GetGreen(), rcol->GetBlue());
720 
721  QColor c = QColorDialog::getColor(qcol);
722  if (!c.isValid()) return;
723 
724  icol = TColor::GetColor(c.red(), c.green(), c.blue());
725 
726  switch (kind) {
727  case 0: {
728  TAttLine* att = dynamic_cast<TAttLine*> (obj);
729  if (att!=0) att->SetLineColor(icol);
730  break;
731  }
732  case 1: {
733  TAttFill* att = dynamic_cast<TAttFill*> (obj);
734  if (att!=0) att->SetFillColor(icol);
735  break;
736  }
737  case 2: {
738  TAttMarker* att = dynamic_cast<TAttMarker*> (obj);
739  if (att!=0) att->SetMarkerColor(icol);
740  break;
741  }
742  }
743 
744  panel->MarkPadModified(pad);
745 
746  panel->ShootRepaintTimer(pad);
747 
748  panel->ActivateInGedEditor(obj);
749 }
virtual void ShootRepaintTimer()
virtual void SetMarkerColor()
virtual void ZaxisStyle(int t)
virtual void SetCoordinates(int t)
virtual void XaxisStyle(int t)
virtual void ActivateInGedEditor(TObject *obj)
virtual void UpdateView(int viewtype, bool webcanvas=false)
virtual void panelSlot(TGo4ViewPanel *panel, TPad *pad, int signalid)
virtual void SetDrawOptions(int t)
Int_t GetLogScale(Int_t nscale=0)
static TGo4MdiArea * Instance()
Definition: TGo4MdiArea.cpp:26
bool IsAutoScale() const
virtual void ChangeColor(int kind)
virtual void SetFillColor()
virtual void CodeDrawOptions(int HisErrorStyle, int HisCoordStyle, int HisDrawStyle, TString &buf)
virtual void MarkPadModified(TPad *pad)
TGo4ViewPanel * GetActivePanel()
Definition: TGo4MdiArea.cpp:62
virtual void SetAutoScale(bool on)
virtual TGo4Picture * GetPadOptions(TPad *pad)
virtual void DecodeDrawOption(const char *drawopt, int &HisErrorStyle, int &HisCoordStyle, int &HisDrawStyle)
virtual void ChangeDrawOptionForCurrentPanel(int kind, int value)
virtual void SetLineColor()
virtual void ChangeDrawOption(int kind, int value, const char *drawopt)
Int_t GetFullRangeDim() const
virtual TPad * GetActivePad()
virtual TObject * GetSelectedObject(TPad *pad, const char **drawopt)
TGo4HisDrawOptions(QWidget *parent=0, const char *name=0, Qt::WindowFlags fl=Qt::Widget)
virtual bool IsWebCanvas() const
virtual void YaxisStyle(int t)
virtual void SetErrorBars(int t)