#include <Midad/Gui/GuiButton.h>#include <Midad/Gui/GuiTable.h>#include <Midad/Gui/GuiMainWindow.h>#include <Midad/Gui/GuiMenu.h>#include <Midad/Gui/GuiBox.h>#include <Midad/Gui/GuiTab.h>#include <Midad/Gui/GuiFrame.h>#include <Midad/Gui/GuiCanvas.h>#include <Midad/Gui/GuiStatusBar.h>#include <Midad/Gui/GuiSlider.h>#include <Midad/Gui/GuiTextEntry.h>#include <Midad/Util/CompositeRange.h>#include <Midad/Base/ColorAxis.h>#include <Midad/Base/ZoomPad.h>#include "TROOT.h"#include "TApplication.h"#include "TGTableLayout.h"#include "TCanvas.h"#include "TH1F.h"#include <sigc++/sigc++.h>#include <sigc++/retype_return.h>#include <string>#include <sstream>#include <iostream>Go to the source code of this file.
Functions | |
| void | set_pad_in_history (ZoomPad *pad, UndoHistory *hist) |
| void | print_range (RangeDouble *r) |
| void | zoom_range (RangeControl< double > *rc, RangeDouble *r) |
| void | update_canvas (TCanvas *canvas) |
| int | main (int argc, char *argv[]) |
|
||||||||||||
|
Definition at line 57 of file test-Canvas.cxx. References GuiCompositeFrameBase::Add(), GuiButtonBase::clicked, GuiMainWindow::ConnectClose(), ZoomPad::GetCurRange(), RangeAxis::GetSelectionRange(), Range< TYPE >::modified, print_range(), RangeDouble, NR::rc(), ZoomPad::selection, set_pad_in_history(), GuiBase::SetLayoutHints(), GuiMainWindow::SetMinSize(), GuiMainWindow::ShowAll(), update_canvas(), GuiSlider::UseExtremaControl(), GuiSlider::UseRangeControl(), and Range2D< TYPE >::x. 00058 {
00059 TApplication theApp("App", &argc, argv);
00060
00061 GuiMainWindow mw(300,300);
00062
00063 GuiBox box(mw,kVerticalFrame);
00064 mw.Add(box);
00065
00066 GuiCanvas gc(box);
00067 gc.SetLayoutHints(kLHintsExpandX|kLHintsExpandY);
00068 box.Add(gc);
00069
00070 GuiSlider s1(box,kHorizontalFrame);
00071 box.Add(s1);
00072
00073 GuiBox hbox(box,kHorizontalFrame);
00074 hbox.SetLayoutHints(kLHintsExpandX);
00075 box.Add(hbox);
00076
00077 GuiTextButton b_undo(hbox,"Undo");
00078 b_undo.SetLayoutHints(kLHintsExpandX);
00079 hbox.Add(b_undo);
00080 GuiTextButton b_redo(hbox,"Redo");
00081 b_redo.SetLayoutHints(kLHintsExpandX);
00082 hbox.Add(b_redo);
00083
00084
00085 gc.GetCanvas()->cd();
00086 ZoomPad zp("blah","blah",.2,.2,.8,.8);
00087 zp.Draw();
00088 zp.cd();
00089 RangeDouble* hxr = zp.GetCurRange().x;
00090 hxr->modified.connect(bind(slot(print_range),hxr));
00091 TH1F h1("gaus","gaus",100,-3,3);
00092 h1.FillRandom("gaus");
00093 h1.Draw();
00094
00095
00096 UndoHistory* hist = manage(new UndoHistory);
00097
00098 zp.selection.connect(bind(bind(slot(set_pad_in_history),hist),&zp));
00099
00100 RangeDouble* range = manage(new RangeDouble(2,8));
00101 RangeControl<double> rc(hist,range);
00102 RangeDouble* extrema = manage(new RangeDouble(2,8));
00103 RangeControl<double> ec(hist,extrema);
00104 s1.UseRangeControl(rc);
00105 s1.UseExtremaControl(ec);
00106
00107 gc.GetCanvas()->cd();
00108 ColorAxis* ca[4];
00109 ca[0] = new ColorAxis(20,0.05,range, .1,.1,.9,.1);
00110 ca[1] = new ColorAxis(20,0.05,range, .1,.1,.1,.9);
00111 ca[2] = new ColorAxis(20,0.05,range, .1,.9,.9,.9,510,"-");
00112 ca[3] = new ColorAxis(20,0.05,range, .9,.1,.9,.9,510,"+L");
00113 for (int i=0; i<4; ++i) {
00114 RangeDouble& sel = ca[i]->GetSelectionRange();
00115 sel.modified.connect(bind(slot(rc,&RangeControl<double>::Apply),&sel));
00116 ca[i]->Draw();
00117 }
00118
00119 range->modified.connect(bind(slot(print_range),range));
00120 range->modified.connect(bind(slot(update_canvas),gc.GetCanvas())); // last!
00121
00122 b_undo.clicked.connect(retype_return<void>(slot(*hist,&UndoHistory::Undo)));
00123 b_redo.clicked.connect(retype_return<void>(slot(*hist,&UndoHistory::Redo)));
00124
00125
00126 mw.ShowAll();
00127 mw.SetMinSize();
00128 mw.ConnectClose();
00129
00130 theApp.Run();
00131 return 0;
00132 } // end of main()
|
|
|
Definition at line 42 of file test-Canvas.cxx. References Range< TYPE >::Max(), Range< TYPE >::Min(), and RangeDouble. Referenced by main().
|
|
||||||||||||
|
Definition at line 33 of file test-Canvas.cxx. References ZoomPad::ApplySelectionToZoom(), ZoomPad::GetCurRange(), UndoHistory::Store(), Range2D< TYPE >::x, and Range2D< TYPE >::y. Referenced by main(). 00034 {
00035 CompositeRange<double> cr;
00036 cr.push_back(pad->GetCurRange().x);
00037 cr.push_back(pad->GetCurRange().y);
00038 hist->Store(cr);
00039 pad->ApplySelectionToZoom();
00040 }
|
|
|
Definition at line 51 of file test-Canvas.cxx. Referenced by main(). 00052 {
00053 canvas->Modified();
00054 canvas->Update();
00055 }
|
|
||||||||||||
|
Definition at line 46 of file test-Canvas.cxx. References Range< TYPE >::Max(), Range< TYPE >::Min(), RangeDouble, and RangeControl< TYPE >::Set().
|
1.3.9.1