Scope
BehaviorSettingsPage.cpp
1 #include "StdAfx.h"
2 #include "BehaviorSettingsPage.h"
3 
4 namespace scope {
5  namespace gui {
6 
7 CBehaviorSettingsPage::CBehaviorSettingsPage(void)
8  : CToolTipDialog(TTS_NOPREFIX)
9  , start_behavior_button(&scope_controller.StartBehaviorButton)
10  , framecount_edit(&scope_controller.FrameCounter[0])
11  , totaltime_edit(&scope_controller.TotalTime)
12  , trialcount_edit(&scope_controller.TrialCounter) {
13 }
14 
15 BOOL CBehaviorSettingsPage::OnInitDialog(CWindow wndFocus, LPARAM lInitParam) {
16  start_behavior_button.AttachToDlgItem(GetDlgItem(IDC_STARTBEHAVIOR_BUTTON));
17  framecount_edit.AttachToDlgItem(GetDlgItem(IDC_FRAMES_EDIT));
18  totaltime_edit.AttachToDlgItem(GetDlgItem(IDC_TOTALTIME_EDIT));
19  trialcount_edit.AttachToDlgItem(GetDlgItem(IDC_TRIALS_EDIT));
20 
21  planes_list.Attach(GetDlgItem(IDC_PLANES_LIST));
22  planes_list.InsertColumn(0, L"Plane", 0, 40);
23  std::wostringstream stream;
24  for ( uint32_t a = 0 ; a < SCOPE_NAREAS ; a++ ) {
25  stream.str(L"");
26  stream << L"FastZ " << a+1;
27  planes_list.InsertColumn(1+2*a, stream.str().c_str(), 0, 60);
28  stream.str(L"");
29  stream << L"Pockels " << a+1;
30  planes_list.InsertColumn(2+2*a, stream.str().c_str(), 0, 60);
31  }
33 
34  SetMsgHandled(false);
35  return 0;
36 }
37 
38 LRESULT CBehaviorSettingsPage::OnAddPlane(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) {
39  DBOUT(L"CTimeSeriesSettingsPage::OnAddPlane");
40 
41  // Get plane information for every area and add to timeseries plane vectors
42  std::array<parameters::PlaneProperties, SCOPE_NAREAS> planes;
43  for ( uint32_t a = 0 ; a < SCOPE_NAREAS ; a++ ) {
44  planes[a].position = scope_controller.GuiParameters.areas[a]->Currentframe().fastz();
45  planes[a].pockels = scope_controller.GuiParameters.areas[a]->Currentframe().pockels();
46  }
48 
50 
51  return 0;
52 }
53 
54 LRESULT CBehaviorSettingsPage::OnDeletePlane(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) {
55  int32_t sel = planes_list.GetSelectedIndex();
56  if ( sel == -1 )
57  return 0;
58  // Delete the selected plane from the vector
61  return 0;
62 }
63 
65  uint32_t n = 0;
66  std::wostringstream stream;
67  planes_list.DeleteAllItems();
68  for ( const auto& pa : scope_controller.GuiParameters.behavior.planes ) {
69  stream.str(L"");
70  stream << L"Plane " << n;
71  planes_list.InsertItem(n, stream.str().c_str(), NULL);
72  stream.str(L"");
73  stream << n;
74  planes_list.SetItemText(n, 0, stream.str().c_str()); // plane no
75  uint32_t a = 0;
76  for ( const auto& p : pa ) { // for each area fastz position and pockels
77  stream.str(L"");
78  stream << std::setprecision(1) << p.position();
79  planes_list.SetItemText(n, 2*a + 1, stream.str().c_str());
80  stream.str(L"");
81  stream << std::setprecision(2) << p.pockels();
82  planes_list.SetItemText(n, 2*a + 2, stream.str().c_str());
83  a++;
84  }
85  n++;
86  }
87 }
88 
89 }}
CListViewCtrl planes_list
list box for all planes
bool AttachToDlgItem(HWND hWnd)
Attach the control to a dialog item.
Definition: ScopeEditCtrl.h:68
std::array< std::unique_ptr< Area >, SCOPE_NAREAS > areas
holds AreaParameters for all areas.
Definition: Scope.h:231
void UpdatePlanesList()
updates the list view ctrl on add/delete plane
Behavior behavior
the BehaviorParameters
Definition: Scope.h:243
This is the include file for standard system include files, or project specific include files that ar...
CScopeEditCtrl< double > framecount_edit
Edit control (disabled) that displays current framecount of curren trial.
#define DBOUT(s)
A debug output to the debug console.
Definition: helpers.h:153
scope::ScopeController scope_controller
a scope controller
CScopeEditCtrl< double > trialcount_edit
Edit control (disabled) that displays current trial number.
BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam)
Handles dialog initialization.
CScopeButtonCtrl start_behavior_button
start behavior triggered scanning
std::vector< std::array< PlaneProperties, SCOPE_NAREAS > > planes
vector with properties for all planes, for alternating planes on alternating repeats, one for each area
Definition: Runstates.h:124
static parameters::Scope GuiParameters
The complete pseudo-global parameter set of the microscope.
CScopeEditCtrl< double > totaltime_edit
Edit control (disabled) that displays elapsed total time since start of first trial.
bool AttachToDlgItem(HWND hWnd)
Attach the control to a dialog item.