Scope
FPUControlPage.cpp
1 #include "stdafx.h"
2 #include "FPUControlPage.h"
3 
4 namespace scope {
5  namespace gui {
6 
7 CFPUControlPage::CFPUControlPage(const uint32_t& _area)
8  : area(_area)
9  , strtitle(L"")
10  , xpos_edit(&scope_controller.GuiParameters.areas[area]->fpuxystage.xpos, true)
11  , ypos_edit(&scope_controller.GuiParameters.areas[area]->fpuxystage.ypos, true)
12  , etlcalibrationfile_edit(&scope_controller.GuiParameters.areas[area]->fpuzstage.calibrationfile, true)
13  , setxyzero_button(&scope_controller.FPU[area].SetZeroButton)
14  , fpustageinfos_edit(&scope_controller.GuiParameters.areas[area]->fpuxystage.stageinfo, true)
15  , diagram(area, &scope_controller.GuiParameters) {
16  std::wstringstream stream;
17  stream << L"Area " << area+1;
18  strtitle = stream.str();
19  SetTitle(strtitle.c_str()); // Be careful, do not assign a local variable (since SetTitle takes only the pointer, which will become invalid for a local variable)
20 }
21 
22 BOOL CFPUControlPage::OnInitDialog(CWindow wndFocus, LPARAM lInitParam) {
23  xpos_edit.AttachToDlgItem(GetDlgItem(IDC_POSX_EDIT));
24  ypos_edit.AttachToDlgItem(GetDlgItem(IDC_POSY_EDIT));
25  etlcalibrationfile_edit.AttachToDlgItem(GetDlgItem(IDC_ETLCALIBRATIONFILE_EDIT));
26  setxyzero_button.AttachToDlgItem(GetDlgItem(IDC_SETXYZERO_BUTTON));
27  fpustageinfos_edit.AttachToDlgItem(GetDlgItem(IDC_STANDAINFOS_EDIT));
28 
29  diagram.AttachToDlgItem(GetDlgItem(IDC_FPUDIAGRAM));
30 
31  SetMsgHandled(false);
32  return 0;
33 }
34 
35 LRESULT CFPUControlPage::OnCalibrationFileButton(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) {
36  COMDLG_FILTERSPEC fileTypes[] = {{ L"ETL calibration file", L"*.txt" }};
37  CShellFileSaveDialog dlg(NULL, FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST | FOS_FILEMUSTEXIST, L"txt", fileTypes, 1);
38  dlg.GetPtr()->SetTitle(L"Select Fast Z calibration file");
39  IShellItem *psiFolder;
40  SHCreateItemFromParsingName(L"C:\\Temp\\", NULL, IID_PPV_ARGS(&psiFolder));
41  dlg.GetPtr()->SetFolder(psiFolder);
42 
43  if ( IDOK == dlg.DoModal(::GetDesktopWindow()) ) { // Crashes without GetDesktopWindow (see here: http://comments.gmane.org/gmane.comp.windows.wtl/16780), CMainDlgFrame is probably not a top level window?!
44  CString filepath;
45  dlg.GetFilePath(filepath);
46  std::wstring strfilepath(filepath.GetString());
47  DBOUT(L"Fast Z calibration file loaded from " << strfilepath);
48  scope_controller.GuiParameters.areas[area]->fpuzstage.LoadCalibration(strfilepath);
49  }
50  return 0;
51 }
52 
53 }
54 }
CScopeEditCtrl< double > ypos_edit
edit for the FPU stage's y position
CScopeFOVDiagram diagram
diagram displaying FOV positions
*bool AttachToDlgItem(HWND hWnd)
()
CFPUControlPage(const uint32_t &_area)
create the edit objects (e.g.
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
ScopeController scope_controller
Our ScopeController here.
const uint32_t area
the area the FPU serves
BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam)
attach the dialog controls to the edit objects
CScopeEditCtrl< std::wstring > fpustageinfos_edit
edit control for displaying FPU stage information
CScopeEditCtrl< std::wstring > etlcalibrationfile_edit
edit for the FPU fast Z calibration file name
This is the include file for standard system include files, or project specific include files that ar...
#define DBOUT(s)
A debug output to the debug console.
Definition: helpers.h:153
CScopeEditCtrl< double > xpos_edit
edit for the FPU stage's x position
CScopeButtonCtrl setxyzero_button
button to set current xy position as zero
std::wstring strtitle
the page title
LRESULT OnCalibrationFileButton(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled)
Loads fast z calibration file.
static parameters::Scope GuiParameters
The complete pseudo-global parameter set of the microscope.
bool AttachToDlgItem(HWND hWnd)
Attach the control to a dialog item.