Scope
TimeSeriesSettingsPage.cpp
1 #include "StdAfx.h"
2 #include "TimeSeriesSettingsPage.h"
3 
4 namespace scope {
5  namespace gui {
6 
7 CTimeSeriesSettingsPage::CTimeSeriesSettingsPage(void)
8  : CToolTipDialog(TTS_NOPREFIX)
9  , start_timeseries_button(&scope_controller.StartTimeseriesButton)
10  , frames_edit(&scope_controller.GuiParameters.timeseries.frames[0], true, true)
11  , frames_progress(&scope_controller.FrameCounter[0])
12  , firsttriggered_check(&scope_controller.GuiParameters.timeseries.triggered, true, true)
13  , alltriggered_check(&scope_controller.GuiParameters.timeseries.alltriggered, true, true)
14  , totaltime_edit(&scope_controller.GuiParameters.timeseries.totaltimes[0], true, true)
15  , repeats_edit(&scope_controller.GuiParameters.timeseries.repeats, true, true)
16  , repeats_progress(&scope_controller.RepeatCounter)
17  , betweenrepeats_edit(&scope_controller.GuiParameters.timeseries.betweenrepeats, true, true)
18  , overalltime_edit(&scope_controller.GuiParameters.timeseries.overalltime, true, true) {
19 }
20 
21 BOOL CTimeSeriesSettingsPage::OnInitDialog(CWindow wndFocus, LPARAM lInitParam) {
22  start_timeseries_button.AttachToDlgItem(GetDlgItem(IDC_STARTTIMESERIES_BUTTON));
23  frames_edit.AttachToDlgItem(GetDlgItem(IDC_FRAMES_EDIT));
24  frames_progress.AttachToDlgItem(GetDlgItem(IDC_FRAMES_PROGRESS));
25  firsttriggered_check.AttachToDlgItem(GetDlgItem(IDC_FIRSTTRIGGERED));
26  alltriggered_check.AttachToDlgItem(GetDlgItem(IDC_ALLTRIGGERED));
27  totaltime_edit.AttachToDlgItem(GetDlgItem(IDC_TOTALTIME_EDIT));
28  repeats_edit.AttachToDlgItem(GetDlgItem(IDC_REPEATS_EDIT));
29  repeats_progress.AttachToDlgItem(GetDlgItem(IDC_REPEATS_PROGRESS));
30  betweenrepeats_edit.AttachToDlgItem(GetDlgItem(IDC_BETWEENREPEATS_EDIT));
31  overalltime_edit.AttachToDlgItem(GetDlgItem(IDC_OVERALLTIME_EDIT));
32 
33  planes_list.Attach(GetDlgItem(IDC_PLANES_LIST));
34  planes_list.InsertColumn(0, L"Plane", 0, 40);
35  CString label(L"");
36  for ( uint32_t a = 0 ; a < SCOPE_NAREAS ; a++ ) {
37  label.Format(L"FastZ %d", a+1);
38  planes_list.InsertColumn(1+2*a, label, 0, 60);
39  label.Format(L"Pockels %d", a+1);
40  planes_list.InsertColumn(2+2*a, label, 0, 60);
41  }
43 
44  SetMsgHandled(false);
45  return 0;
46 }
47 
48 LRESULT CTimeSeriesSettingsPage::OnAddPlane(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) {
49  DBOUT(L"CTimeSeriesSettingsPage::OnAddPlane");
50 
51  // Get plane information for every area and add to timeseries plane vectors
52  std::array<parameters::PlaneProperties, SCOPE_NAREAS> planes;
53  for ( uint32_t a = 0 ; a < SCOPE_NAREAS ; a++ ) {
54  planes[a].position = scope_controller.GuiParameters.areas[a]->Currentframe().fastz();
55  planes[a].pockels = scope_controller.GuiParameters.areas[a]->Currentframe().pockels();
56  }
58 
60 
61  return 0;
62 }
63 
64 LRESULT CTimeSeriesSettingsPage::OnDeletePlane(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) {
65  int32_t sel = planes_list.GetSelectedIndex();
66  if ( sel == -1 )
67  return 0;
68  // Delete the selected plane from the vector
71  return 0;
72 }
73 
75  uint32_t n = 0;
76  CString tmp(L"");
77  planes_list.DeleteAllItems();
78  for ( auto& pa : scope_controller.GuiParameters.timeseries.planes ) {
79  tmp.Format(L"Plane %d", n);
80  planes_list.InsertItem(n, tmp, NULL);
81  tmp.Format(L"%d", n);
82  planes_list.SetItemText(n, 0, tmp); // plane no
83  uint32_t a = 0;
84  for ( auto& p : pa ) { // for each area fastz position and pockels
85  tmp.Format(L"%.1f", p.position());
86  planes_list.SetItemText(n, 2*a + 1, tmp);
87  tmp.Format(L"%.2f", p.pockels());
88  planes_list.SetItemText(n, 2*a + 2, tmp);
89  a++;
90  }
91  n++;
92  }
93 }
94 
95 }}
CScopeEditCtrl< double > overalltime_edit
time in seconds for all timeseries
bool AttachToDlgItem(HWND hWnd)
Attach the control to a dialog item.
Definition: ScopeEditCtrl.h:68
void UpdatePlanesList()
updates the list view ctrl on add/delete plane
std::array< std::unique_ptr< Area >, SCOPE_NAREAS > areas
holds AreaParameters for all areas.
Definition: Scope.h:231
scope::ScopeController scope_controller
a scope controller
CScopeProgressCtrl repeats_progress
Progress indicator for repeats.
CScopeEditCtrl< double > totaltime_edit
the total time the timeseries will take
CScopeEditCtrl< uint32_t > frames_edit
number of frames to scan
Timeseries timeseries
the TimeseriesParameters
Definition: Scope.h:240
BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam)
Handles dialog initialization.
CScopeButtonCtrl start_timeseries_button
start timeseries scanning
This is the include file for standard system include files, or project specific include files that ar...
CListViewCtrl planes_list
list box for all planes
#define DBOUT(s)
A debug output to the debug console.
Definition: helpers.h:153
bool AttachToDlgItem(HWND hWnd)
Attach the control to a dialog item.
BOOL AttachToDlgItem(HWND hWnd)
Attach the control to a dialog item and set range.
CScopeCheckBoxCtrl firsttriggered_check
is the first timeseries triggered
CScopeCheckBoxCtrl alltriggered_check
are all timeseries triggered
CScopeProgressCtrl frames_progress
progress indicator for frames of a single repeat
std::vector< std::array< PlaneProperties, SCOPE_NAREAS > > planes
vector with properties for all planes, for alternating planes on repeating timeseries, one for each area
Definition: Runstates.h:96
CScopeEditCtrl< uint32_t > repeats_edit
How often should the timeseries be repeated.
CScopeEditCtrl< double > betweenrepeats_edit
Time in seconds between the end of one and the next timeseries.
static parameters::Scope GuiParameters
The complete pseudo-global parameter set of the microscope.
bool AttachToDlgItem(HWND hWnd)
Attach the control to a dialog item.