2 #include "HistogramView.h"
3 #include "helpers/ScopeMultiImage.h"
4 #include "helpers/ScopeMultiImageResonanceSW.h"
5 #include "helpers/ScopeMultiHistogram.h"
6 #include "controllers/ScopeLogger.h"
15 , current_frame(
std::make_shared<
scope::SCOPE_MULTIIMAGE_T>())
17 , lower_limits(channels, 0)
18 , upper_limits(channels, range)
19 , renderer(width, channels, current_histogram)
20 , dragginglower(channels, false)
21 , draggingupper(channels, false)
22 , llpos(channels, 0.0)
23 , ulpos(channels, 511.0) {
45 DBOUT(L
"OnLButtonUp");
51 if ( nFlags == MK_LBUTTON ) {
52 for ( uint32_t c = 0 ; c <
channels ; c++ ) {
55 llpos[c] = std::min(
ulpos[c], static_cast<FLOAT>(point.x));
61 ulpos[c] = std::max(
llpos[c], static_cast<FLOAT>(point.x));
69 ::SendMessage(GetParent().m_hWnd, WM_UPDATEHISTOLIMITS, NULL, NULL);
78 BOOL CHistogramView::PreTranslateMessage(MSG* pMsg) {
85 ATLASSERT(BeginPaint(&paint));
92 assert(_size.cx == 512);
97 void CHistogramView::OnDisplayChange(UINT , CSize ) {
104 for ( uint32_t c = 0 ; c <
channels ; c++ ) {
115 for ( uint32_t c = 0 ; c <
channels ; c++ ) {
124 for ( uint32_t c = 0 ; c <
channels ; c++ ) {
140 ScopeMultiHistogramPtr updated_histogram(std::make_shared<scope::ScopeMultiHistogram>(
area,
channels, 512,
range));
const uint32_t area
for which area
const uint32_t channels
how many channels
void OnLButtonDown(UINT nFlags, CPoint point)
Ask renderer for hit test and set click state.
std::vector< uint16_t > upper_limits
upper limit values of all channels/the value that corresponds to histogram array index (because of ra...
std::vector< bool > dragginglower
Keeps track of mouse dragging which lower limit.
uint16_t range
what uin16_t histogram range is used
std::array< std::unique_ptr< Area >, SCOPE_NAREAS > areas
holds AreaParameters for all areas.
void OnLButtonUp(UINT nFlags, CPoint point)
Releases click state.
void SetLimits()
Set limits in renderer and scope_controller.
void FullRange()
Set lower and upper limits to full range.
ScopeMultiHistogramPtr current_histogram
currently displayed histogram
SCOPE_MULTIIMAGECPTR_T current_frame
image corresponding to the currently displayed histogram
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.
void SetHistogram(scope::ScopeMultiHistogramPtr _hist)
Sets the pointer to the current multi histogram.
void Render()
Draws the current multi histogram with the limit lines.
std::vector< bool > draggingupper
Keeps track of mouse dragging which upper limit.
void OnMouseMove(UINT nFlags, CPoint point)
If moving with left mouse button down, give position to Renderer and render limit bars...
bool ClickedAt(const CPoint _clickpoint, uint32_t &_channel, bool &_uplo)
Checks if click hit a limit (+-5 pixel) and if yes, on which channel and upper or lower limit line...
This is the include file for standard system include files, or project specific include files that ar...
void OnShowWindow(BOOL bShow, UINT nStatus)
Create the renderer only now, because now the window is shown.
void Create(const HWND &_hwnd)
Creates the render target for a hwnd, the brushes for painting, and sets the limit position to the wi...
std::vector< uint16_t > lower_limits
lower limit values of all channels/the value that corresponds to histogram array index (because of ra...
void SetLowerLimitPosition(const uint32_t &_channel, const FLOAT &_pos)
Set position of a lower limit line.
void Optimize()
Set lower limit to the first value with count >0 and the upper limit to the last value with count >0...
#define DBOUT(s)
A debug output to the debug console.
std::vector< FLOAT > ulpos
Keeps track of the upper limit positions in screen coordinates/histogram array index.
void OnSize(UINT, CSize _size)
Resize the Renderer accordingly, be careful not to resize to 0.
void UpdateHistogramFrame()
Update Histogram with current parameters.
A multi channel histogram.
ScopeController scope_controller
the ScopeController kept handy here
void Size(const CSize &size)
Resizes the renderer and the limit positions.
d2d::D2HistogramRender renderer
this one handles all of the Views rendering
CHistogramView(const uint32_t &_area, const uint32_t &_channels, uint16_t _range)
Initialize everything.
void OnPaint(CDCHandle)
Render the histogram and the limit bars (both via Renderer)
std::vector< FLOAT > llpos
Keeps track of the lower limit positions in screen coordinates/histogram array index.
virtual void OnFinalMessage(HWND)
Do not do 'delete this;' because view is a member of frame and gets destroyed when frame is destroyed...
static parameters::Scope GuiParameters
The complete pseudo-global parameter set of the microscope.
void SetUpperLimitPosition(const uint32_t &_channel, const FLOAT &_pos)
Set position of an upper limit line.
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...