Belle II Software  release-08-01-10
DisplayHough.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 //-----------------------------------------------------------------------------
10 // Description : A class to display CDC trigger information.
11 //-----------------------------------------------------------------------------
12 
13 #ifdef TRGCDC_DISPLAY
14 
15 #include <iostream>
16 #include "trg/cdc/DisplayHough.h"
17 
18 using namespace std;
19 
20 namespace Belle2 {
26  TRGCDCDisplayHough::TRGCDCDisplayHough(const std::string& name,
27  int size)
28  : TRGCDCDisplay(name, size, 10),
29  _w(* this, size),
30  _adjustment(1., 1., 50.0, 0.1),
31  _scaler(_adjustment)
32  {
33 
34  _w.set_size_request(size, size);
35 
36  _scaler.set_update_policy(Gtk::UPDATE_CONTINUOUS);
37  _scaler.set_digits(3);
38  _scaler.set_value_pos(Gtk::POS_LEFT);
39  _scaler.set_draw_value();
40  _scaler.set_size_request(200, 30);
41  _scaler
42  .signal_value_changed()
43  .connect(sigc::mem_fun(* this,
44  & TRGCDCDisplayHough::on_scale_value_changed));
45 
46  _bottom.pack_start(_scaler, Gtk::PACK_SHRINK, 5);
47  _bottom.pack_start(_buttonPositionReset, Gtk::PACK_EXPAND_WIDGET, 2);
48  _bottom.pack_start(_buttonWireName, Gtk::PACK_SHRINK, 2);
49 
50  _box0.pack_start(_menuButtons, Gtk::PACK_SHRINK, 5);
51  _box0.pack_start(_label, Gtk::PACK_EXPAND_WIDGET, 5);
52  _box0.pack_start(_w, Gtk::PACK_EXPAND_WIDGET, 5);
53  _box0.pack_start(_bottom, Gtk::PACK_SHRINK, 5);
54 
55  set_border_width(5);
56  add(_box0);
57  show_all();
58  }
59 
60  TRGCDCDisplayHough::~TRGCDCDisplayHough()
61  {
62  }
63 
64  void
65  TRGCDCDisplayHough::on_scale_value_changed(void)
66  {
67  const double val = scale();
68  _w.scale(val);
69  cout << "TRGCDCDisplayHough ... scale value=" << val << endl;
70  _w.on_expose_event((GdkEventExpose*) NULL);
71  }
72 
73  void
74  TRGCDCDisplayHough::on_positionReset(void)
75  {
76  area().resetPosition();
77  const double val = _w.scale();
78  scale(val);
79  _w.on_expose_event((GdkEventExpose*) NULL);
80  }
81 
83 } // namespace Belle2
84 
85 #endif
Abstract base class for different kinds of events.