Scope
ScopeController.cpp
1 #include "stdafx.h"
2 #include "ScopeController.h"
3 #include "ScopeController_p.h"
4 
5 namespace scope {
6 
7 parameters::Scope ScopeController::GuiParameters;
8 ScopeButton ScopeController::StartSingleButton;
9 ScopeButton ScopeController::StartLiveButton;
10 ScopeButton ScopeController::StartStackButton;
11 ScopeButton ScopeController::StartTimeseriesButton;
12 ScopeButton ScopeController::StartBehaviorButton;
13 ScopeButton ScopeController::StopButton;
14 ScopeButton ScopeController::QuitButton;
15 ScopeButton ScopeController::StackStartHereButton;
16 ScopeButton ScopeController::StackStopHereButton;
17 std::array<ScopeNumber<double>, SCOPE_NAREAS> ScopeController::SingleFrameProgress;
18 ScopeNumber<double> ScopeController::PlaneCounter(0.0, 0.0, 100.0, L"PlaneCounter");
19 std::array<ScopeNumber<double>, SCOPE_NAREAS> ScopeController::FrameCounter;
20 ScopeNumber<double> ScopeController::RepeatCounter(0.0, 0.0, 1000.0, L"RepeatCounter");
21 ScopeNumber<double> ScopeController::TotalTime(0.0, 0.0, 10000.0, L"TotalTime");
22 ScopeNumber<double> ScopeController::TrialCounter(0.0, 0.0, 10000.0, L"TrialCounter");
24 ScopeNumber<bool> ScopeController::ReadOnlyWhileScanning(false, false, true, L"ReadOnlyWhileScanning");
25 std::array<ScopeController::FPUButtons, SCOPE_NAREAS> ScopeController::FPU;
26 std::array<ScopeController::ScanModeButtons, SCOPE_NAREAS> ScopeController::ScanMode;
27 
29  static Impl sImpl;
30  return sImpl;
31 }
32 
34  return static_cast<Impl*>(BaseController<1, true>::Pimpl());
35 }
36 
38  : BaseController(&GetImpl()) {
39 }
40 
41 ScopeController::~ScopeController() {
42  // Do not call stop() here, every controller should stop in its own destructor!
43  DBOUT(L"ScopeController::~ScopeController\n");
44 }
45 
47  Pimpl()->PrepareQuit();
48 }
49 
50 bool ScopeController::LoadParameters(const std::wstring& filepath) {
51  return Pimpl()->LoadParameters(filepath);
52 }
53 
54 bool ScopeController::SaveParameters(const std::wstring& filepath) {
55  return Pimpl()->SaveParameters(filepath);
56 }
57 
60 }
61 
62 void ScopeController::OpenCloseShutter(const uint32_t& _area, const bool& _open) {
63  Pimpl()->OpenCloseShutter(_area, _open);
64 }
65 
66 bool ScopeController::GetShutterState(const uint32_t& _area) const {
67  return Pimpl()->GetShutterState(_area);
68 }
69 
70 void ScopeController::TurnOnOffSwitchResonance(const uint32_t& _area, const bool& _on) {
71  Pimpl()->TurnOnOffSwitchResonance(_area, _on);
72 }
73 
74 bool ScopeController::GetSwitchResonanceState(const uint32_t& _area) const {
75  return Pimpl()->GetSwitchResonanceState(_area);
76 }
77 
79  Pimpl()->Version();
80 }
81 
82 std::wstring ScopeController::CurrentConfigFile() const {
83  return Pimpl()->CurrentConfigFile();
84 }
85 
86 void ScopeController::AttachFrame(gui::CChannelFrame* const cframe) {
87  Pimpl()->AttachFrame(cframe);
88 }
89 
90 void ScopeController::DetachFrame(gui::CChannelFrame* const cframe) {
91  Pimpl()->DetachFrame(cframe);
92 }
93 
94 void ScopeController::AttachFrame(gui::CHistogramFrame* const hframe) {
95  Pimpl()->AttachFrame(hframe);
96 }
97 
98 bool ScopeController::HistogramAlreadyAttached(const uint32_t& _area) {
99  return Pimpl()->HistogramAlreadyAttached(_area);
100 }
101 
102 void ScopeController::DetachFrame(gui::CHistogramFrame* const hframe) {
103  Pimpl()->DetachFrame(hframe);
104 }
105 
108 }
109 
110 void ScopeController::SetHistogramLimits(const uint32_t& _area, const uint32_t& _channel, const uint16_t& _lower, const uint16_t& _upper) {
111  Pimpl()->SetHistogramLimits(_area, _channel, _lower, _upper);
112 }
113 
114 void ScopeController::RegisterScanmodeCallback(std::function<void(const uint32_t&, const ScannerVectorType&)> _callback) {
115  Pimpl()->RegisterScanmodeCallback(_callback);
116 }
117 
118 
119 }
std::wstring CurrentConfigFile() const
void AttachFrame(gui::CChannelFrame *const cframe)
Attach a CChannelFrame as observer.
void DetachFrame(gui::CChannelFrame *const cframe)
Detach an observing CChannelFrame.
static ScopeButton StageZeroButton
Button to zero main stage coordinates.
static ScopeNumber< double > TrialCounter
Updated from ScopeControllerImpl::RunBehavior, connected to edit control in CBehaviorSettingsPage.
static std::array< ScopeNumber< double >, SCOPE_NAREAS > FrameCounter
Updated from PipelineControllerImpl::Run, connected to progress indicator in CTimeSeriesSettingsPage ...
bool GetShutterState(const uint32_t &_area) const
bool GetShutterState(const uint32_t &_area) const
Current state of the shutter.
bool LoadParameters(const std::wstring &_filepath)
Loads current parameter set from disk.
void RegisterScanmodeCallback(std::function< void(const uint32_t &, const ScannerVectorType &)> _callback)
Registers a function to call when scanmode is changed.
void SetHistogramLimits(const uint32_t &_area, const uint32_t &_channel, const uint16_t &_lower, const uint16_t &_upper)
Sets display limits for a certain area and channel.
Impl * Pimpl() const
void OpenCloseShutter(const uint32_t &_area, const bool &_open)
Opens/closes the shutter.
void Version() const
Prints out the last Git commit date of the currently running version (see description at ScopeControl...
Base class for all Scope datatypes here, provides a uniform interface (and saves typing...).
Manages the display of images.
Definition: ChannelFrame.h:26
bool GetSwitchResonanceState(const uint32_t &_area) const
Current state of the resonance scanner relay.
void SetHistogramLimits(const uint32_t &_area, const uint32_t &_channel, const uint16_t &_lower, const uint16_t &_upper)
Sets the color limits for displaying imgages, calls DisplayController::SetHistogramLimits.
This is the include file for standard system include files, or project specific include files that ar...
void RegisterScanmodeCallback(std::function< void(const uint32_t &, const ScannerVectorType &)> _callback)
Registers a function to call when scanmode is changed.
bool SaveParameters(const std::wstring &_filepath)
Saves the current parameter set to disk.
Impl *const Pimpl() const
static ScopeNumber< double > PlaneCounter
Updated from ScopeControllerImpl::RunStack, connected to progress indicator in CStackSettingsPage.
bool GetSwitchResonanceState(const uint32_t &_area) const
std::wstring CurrentConfigFile() const
#define DBOUT(s)
A debug output to the debug console.
Definition: helpers.h:153
bool LoadParameters(const std::wstring &filepath)
Load a complete ScopeParameters set from disk.
static ScopeNumber< double > TotalTime
Updated from e.g.
static std::array< ScanModeButtons, SCOPE_NAREAS > ScanMode
Buttons for switching the scan mode.
Impl & GetImpl()
static local variable for singleton is in there.
void ZeroGalvoOutputs()
Zeros galvo outputs.
bool SaveParameters(const std::wstring &filepath)
Store the current complete ScopeParameters set to disk.
void TurnOnOffSwitchResonance(const uint32_t &_area, const bool &_on)
Turns the resonance scanner relay on and off.
void PrepareQuit()
Called via CMainDialogFrame::QuitApplication.
void SaveCurrentWindowPositions()
Saves current positions of windows by adding frames to WindowCollection of ScopeController::GuiParame...
void OpenCloseShutter(const uint32_t &_area, const bool &_open)
Opens/closes the shutter.
static std::array< FPUButtons, SCOPE_NAREAS > FPU
Buttons for FPU nudge.
void SaveCurrentWindowPositions()
Saves current positions of windows by adding frames to WindowCollection of ScopeController::GuiParame...
static std::array< ScopeNumber< double >, SCOPE_NAREAS > SingleFrameProgress
Updated from PipelineControllerImpl::Run.
ScopeController(void)
Injects pimpl of ScopeController into BaseControllers pimpl (saves memory, since pointer is reused fo...
static parameters::Scope GuiParameters
The complete pseudo-global parameter set of the microscope.
Base class for all controllers.
void TurnOnOffSwitchResonance(const uint32_t &_area, const bool &_on)
Turns the resonance scanner relay on and off.
void ZeroGalvoOutputs()
Calls the DaqController to set Galvo outputs to zero.
void Version()
Print the current ScopeController version to debug console.
bool HistogramAlreadyAttached(const uint32_t &_area)
static ScopeNumber< bool > ReadOnlyWhileScanning
Set to true while scanning, GUI elements can connect to this to disable buttons and controls (that ar...
static ScopeNumber< double > RepeatCounter
Updated from ScopeControllerImpl::RunTimeseries, connected to progress indicator in CTimeSeriesSettin...
void PrepareQuit()
Called by CMainDialogFrame::QuitApplication.
The implementation class of the ScopeController.