Scope
FrameScanHopperPage.cpp
1 #include "StdAfx.h"
2 #include "FrameScanHopperPage.h"
3 #include "PresetNameDlg.h"
4 #include "parameters/Framescan.h"
5 #include "helpers/ScopeButton.h"
6 #include "resource.h"
7 
8 namespace scope {
9  namespace gui {
10 
12  : CFrameScanBasePage(_area, scope_controller.GuiParameters.areas[_area]->FrameHopper()) {
13 
14  // Overwrite base class enum { IDD = ... }
15  // Use different dialog resources depending if this area is a slave area (only Pockels and ETL sliders) or a master area (full control complement)
16  if ( scope_controller.GuiParameters.areas[area]->isslave() )
17  m_psp.pszTemplate = MAKEINTRESOURCE(IDD_FRAMESCAN_SLAVE_PROPPAGE);
18  else
19  m_psp.pszTemplate = MAKEINTRESOURCE(IDD_FRAMESCAN_HOPPER_PROPPAGE);
20 }
21 
22 BOOL CFrameScanHopperPage::OnInitDialog(CWindow wndFocus, LPARAM lInitParam) {
23  // Call base class dialog initialization
24  CFrameScanBasePage::OnInitDialog(wndFocus, lInitParam);
25 
26  // Add the plane list
27  // Also slave areas have this!
28  planes_list.Attach(GetDlgItem(IDC_PLANES_LIST));
29  planes_list.InsertColumn(0, L"Plane", 0, 40);
30  planes_list.InsertColumn(1, L"FastZ", 0, 40);
31  planes_list.InsertColumn(2, L"Pockels", 0, 55);
32 
34 
35  SetMsgHandled(true);
36  return 0;
37 }
38 
40  planes_list.DeleteAllItems();
41  CString tmp;
42  for ( uint32_t p = 0 ; p < scope_controller.GuiParameters.areas[area]->FrameHopper().planes.size() ; p++ ) {
43  planes_list.InsertItem(p, L"Slice", 0);
44  tmp.Format(L"%d", p);
45  planes_list.SetItemText(p, 0, tmp); // Slice no
46  tmp.Format(L"%.1f", scope_controller.GuiParameters.areas[area]->FrameHopper().planes[p].position());
47  planes_list.SetItemText(p, 1, tmp); // fast z position
48  tmp.Format(L"%.2f", scope_controller.GuiParameters.areas[area]->FrameHopper().planes[p].pockels());
49  planes_list.SetItemText(p, 2, tmp); // pockels
50  }
51 }
52 
53 LRESULT CFrameScanHopperPage::OnAddPlane(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) {
54  parameters::PlaneProperties plane(scope_controller.GuiParameters.areas[area]->FrameHopper().fastz(), scope_controller.GuiParameters.areas[area]->FrameHopper().pockels());
55  scope_controller.GuiParameters.areas[area]->FrameHopper().planes.push_back(plane);
56 
58 
59  return 0;
60 }
61 
62 LRESULT CFrameScanHopperPage::OnDeletePlane(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) {
63  int32_t sel = planes_list.GetSelectedIndex();
64  if ( sel == -1 )
65  return 0;
66 
67  // Delete the selected plane from the vector
68  scope_controller.GuiParameters.areas[area]->FrameHopper().planes.erase(sel + std::begin(scope_controller.GuiParameters.areas[area]->FrameHopper().planes));
70 
71  return 0;
72 }
73 
74 
75 }
76 
77 }
std::array< std::unique_ptr< Area >, SCOPE_NAREAS > areas
holds AreaParameters for all areas.
Definition: Scope.h:231
Parameters of a single plane for fast plane hopping/switching.
Definition: Plane.h:12
const uint32_t area
for which area are the image settings
CFrameScanHopperPage(const uint32_t &_area)
create the edit objects (e.g.
ScopeController scope_controller
our ScopeController here
Base class for all frame scan property pages.
This is the include file for standard system include files, or project specific include files that ar...
void UpdatePlanesList()
updates the list view ctrl on add/delete plane
static parameters::Scope GuiParameters
The complete pseudo-global parameter set of the microscope.
CListViewCtrl planes_list
list box for all planes