2 #include "HistogramFrame.h"
3 #include "helpers/ScopeMultiImage.h"
4 #include "helpers/ScopeMultiImageResonanceSW.h"
5 #include "controllers/ScopeController.h"
7 #include "parameters\IO.h"
19 , view(area, channels, scope_controller.GuiParameters.areas[area]->histrange)
37 void CHistogramFrame::OnFinalMessage(HWND ) {
43 std::wostringstream stream;
44 for ( uint32_t c = 0 ; c <
channels ; c++ )
57 client_rect.bottom = 356;
58 client_rect.right = 516;
59 m_hWndClient =
view.Create(m_hWnd, &client_rect, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE);
63 toolbar = CreateSimpleToolBarCtrl(m_hWnd, IDR_HISTOGRAMFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE_EX);
65 AddToolbarButtonText(
toolbar, IDC_OPTIMIZE, L
"Optimize");
66 AddToolbarButtonText(
toolbar, IDC_FULLRANGE, L
"Full range");
68 CreateSimpleReBar(ATL_SIMPLE_REBAR_STYLE);
73 m_hWndStatusBar =
m_wndStatusBar.Create(*
this, ATL_IDS_IDLEMESSAGE, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
74 UIAddStatusBar (m_hWndStatusBar);
76 int32_t anPanes[] = { IDPANE_STATUS , IDPANE_HISTOGRAMLIMITS };
79 UISetText(0, L
"Stopped");
80 UISetText(1, L
"Limits ");
83 UIEnable(IDC_CH1BUTTON, (
channels>0));
84 UIEnable(IDC_CH2BUTTON, (
channels>1));
85 UIEnable(IDC_CH3BUTTON, (
channels>2));
86 UIEnable(IDC_CH4BUTTON, (
channels>3));
91 std::wostringstream stream;
92 stream << L
"Histogram (Area " <<
area+1 << L
")";
93 SetWindowText(stream.str().c_str());
148 view.Invalidate(
false);
155 DBOUT(L
"CHistogramFrame::HistoGramAndRender dropping frames");
const uint32_t channels
number of channels for this area
Thread-safe lock-free bool to signal a requested stop to the worker function currently executed in th...
void OnFullRange(UINT uNotifyCode, int nID, CWindow wndCtl)
Calls CHistogramView::FullRange on view.
void Quit()
Send lambda with done=true to the worker, join the worker thread, and clear the packaged task queue...
CHistogramFrame(const uint32_t &_area, const uint32_t &_channels)
Simple constructor.
const uint32_t area
which area is the histogram for
~CHistogramFrame()
Detaches if not yet happened and quits.
void FullRange()
Set lower and upper limits to full range.
void UpdateStatus(const RunState &_rs)
Updates the statusstr and send RunUpdateStatusbar to the Active object.
void HistoGramAndRender(scope::SCOPE_MULTIIMAGECPTR_T const _multi)
Sends the worker function 'RunHistoGramAndRender' to the ActiveObject.
Base class for all Scope datatypes here, provides a uniform interface (and saves typing...).
std::wstring limitsstr
holds the current limits as string (we need a member since the lifetime of a local variable is too sh...
LRESULT OnUpdateHistogramLimits(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Limit bar movements are handled in the client window (CHistogramView) but we want also an update of C...
uint32_t framecount
number of the currently displayed histogram
This is the include file for standard system include files, or project specific include files that ar...
std::future< bool > Send(const Command &_cmd)
Sends a worker function/packaged task to the queue to be executed in the Active's thread...
bool attached
are we attached to ScopeController?
void Optimize()
Set lower limit to the first value with count >0 and the upper limit to the last value with count >0...
bool RunUpdateStatusbar(StopCondition *const ac)
Worker function for all statusbar updates which will run in the Active's thread.
#define DBOUT(s)
A debug output to the debug console.
void ScopeExceptionHandler(const std::string &_origin, const bool &_log, const bool &_showmessagebox, const bool &_trace, const bool &_rethrow)
Handles all exceptions and does nice logging.
CHistogramView view
The view inside the client window.
bool loghist
do we want a logarithmic count histogram
CToolBarCtrl toolbar
the toolbar
SynchronizedQueue< const std::function< void(StopCondition *const sc)> > ptq
synchronized queue of worker functions/packaged tasks that are executed in the Active' thread (see la...
void OnLogHistogram(UINT uNotifyCode, int nID, CWindow wndCtl)
Switches between normal and logarithmic histogram.
scope::ScopeController scope_controller
our ScopeController here
CMultiPaneStatusBarCtrl m_wndStatusBar
the statusbar (multipane)
void OnOptimize(UINT uNotifyCode, int nID, CWindow wndCtl)
Calls CHistogramView::Optimize on view.
std::wstring statusstr
holds the current run status as string (we need a member since the lifetime of a local variable is to...
void OnDestroy()
Detaches frame from ScopeController, because after OnDestroy the HWND is not valid anymore...
int OnCreate(LPCREATESTRUCT lpCreateStruct)
Creates view, toolbar, statusbar etc., resizes window correctly.
uint16_t LowerLimit(const uint32_t &_ch) const
Render histogram and limit bars.
void SetCurrentFrame(SCOPE_MULTIIMAGECPTR_T const _multi, const bool &_loghisto)
Sets the current frame and calculates its histogram (either with regular count or with logarithmic co...