Damir Buskulic writes: > > I desperately need a way to know when a zoom or unzoom was peformed on > an axis, and on which plot. It would be really interesting to go through > all "high level" events such as zoom/unzoom and see if it is possible to > add a signal to it. Perhaps adding a signal to TPad::Modified() would > already do the trick. It would allow one to know that something happened > and search for the event. The way I solve this is with the following things: 1) A separate "Range" object to encapsulate a min and a max value. It has setter methods which emit signals when its values change. 2) Sub class TPad to use 2 of these Range objects for horiz and vert ranges. 3) Various other classes which connect to the Range objects to either use or change their values. So, instead of Range()ing the TPad directly, one sets the Range objects' values and the TPad subclass (and anything else connected to the Range) can act accordingly. This follows the Model/View/Controller (MVC) pattern. You can browse the code for this at: http://minos.phy.bnl.gov/software/MIDAD/ The "Range" object is in MidRange.{cxx,h}. The TPad subclass is in View.{cxx,h}, and couple of ROOT GUI elements which can "view" or "control" (or both) the range are in MidRangeScale.{cxx,h} and MidRangeSlider.{cxx,h}. Note, my "MidRange" object is a bit more complex than the description above because it is templated and uses a ref counted handle (to ease sharing of the object) as well as some methods to ease the connection and disconnection of the signal. This MVC pattern is very useful and (imo) ROOT would be improved embracing it more, particularly in the parts devoted to UI. The signal/slot idiom is ideal for this and, as in the above, Rt is an adequate implementation. I have also started reimplementing this in my rewrite of this MIDAD app. This rewrite is based on a set of wrapper classes which marry the TG GUI classes to libsigc++, (which I find a superior signal/slot implementation). You can also browse this code (still under development) if you want: http://minos.phy.bnl.gov/software/MIDAD-X/ See the Scene.{cxx,h} (not complete yet), Range.h and Gui* files. Cheers, -Brett.
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:10 MET