Scope
scope::gui::CChannelFrame Class Reference

#include <ChannelFrame.h>

Inherits CFrameWindowImpl< CChannelFrame >, CUpdateUI< CChannelFrame >, CToolBarHelper< CChannelFrame >, CIdleHandler, and Active< bool >.

Public Member Functions

 CChannelFrame (const uint32_t &_area)
 
 ~CChannelFrame ()
 
uint32_t Area () const
 
Called via Win32 messages

=

virtual void OnFinalMessage (HWND)
 
virtual BOOL OnIdle ()
 
int OnCreate (LPCREATESTRUCT lpCreateStruct)
 
void OnDestroy ()
 
void OnSizing (UINT fwSide, LPRECT pRect)
 
BOOL OnMouseWheel (UINT nFlags, short zDelta, CPoint pt)
 
void OnSameSize (UINT uCode, int nID, HWND hwncCtrl)
 
void OnDoubleSize (UINT uCode, int nID, HWND hwncCtrl)
 
void OnHalfSize (UINT uCode, int nID, HWND hwncCtrl)
 
Called by CChannelView via user defined Win32 message
LRESULT OnUpdateMousePixel (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
Called by the DisplayController

these run in the DisplayController's Run thread

virtual void UpdateStatus (const RunState &_rs)
 
virtual void SetHistogramLimits (const uint32_t &_channel, const uint16_t &_lower, const uint16_t &_upper)
 
virtual void LayOverAndRender (scope::SCOPE_MULTIIMAGECPTR_T const _multi)
 
virtual void UpdateScaleText (const std::wstring &_text)
 
- Public Member Functions inherited from Active< bool >
 Active ()
 
std::future< bool > Send (const Command &_cmd)
 
void AbortCurrent ()
 
void Quit ()
 

Public Attributes

CCommandBarCtrl m_CmdBar
 

Protected Member Functions

bool RunLayOverAndRender (StopCondition *const sc, scope::SCOPE_MULTIIMAGECPTR_T const _multi)
 
bool RunUpdateStatusbar (StopCondition *const sc, scope::SCOPE_MULTIIMAGECPTR_T const _multi)
 
void UpdateScaleText ()
 
void UncheckScaleButtons ()
 
- Protected Member Functions inherited from Active< bool >
 Active (const Active &)
 
void operator= (const Active &)
 

Protected Attributes

scope::ScopeController scope_controller
 
const uint32_t area
 
const uint32_t channels
 
bool attached
 
CChannelView view
 
scope::SCOPE_MULTIIMAGECPTR_T current_frame
 
std::wstring framecountstr
 
D2D1_POINT_2F mousepos
 
std::wstring mouseposstr
 
std::wstring statusstr
 
CMultiPaneStatusBarCtrl m_wndStatusBar
 
CToolBarCtrl toolbar
 
std::vector< ColorPropschannel_colors
 
scope::SCOPE_OVERLAY_T overlay
 
- Protected Attributes inherited from Active< bool >
StopCondition stop
 
bool done
 
SynchronizedQueue< const std::function< void(StopCondition *const sc)> > ptq
 
std::thread thread
 

Static Protected Attributes

static std::array< int32_t, 4 > colorcombo_resources = { IDC_COLORCOMBO1, IDC_COLORCOMBO2, IDC_COLORCOMBO3, IDC_COLORCOMBO4 }
 

Additional Inherited Members

- Public Types inherited from Active< bool >
typedef std::function< bool(StopCondition *const sc)> Command
 

Detailed Description

Manages the display of images.

Definition at line 26 of file ChannelFrame.h.

Constructor & Destructor Documentation

scope::gui::CChannelFrame::CChannelFrame ( const uint32_t &  _area)

Initialize everything.

Parameters
[in]_areawhich the CChannelFrame is for

Definition at line 17 of file ChannelFrame.cpp.

scope::gui::CChannelFrame::~CChannelFrame ( )

Detach if not yet happened and quit.

Definition at line 30 of file ChannelFrame.cpp.

Member Function Documentation

bool scope::gui::CChannelFrame::RunLayOverAndRender ( StopCondition *const  sc,
scope::SCOPE_MULTIIMAGECPTR_T const  _multi 
)
protected

Worker function which will run in the Active's thread.

Calculates overlay, copies it to a Direct2D bitmap and renders

Definition at line 63 of file ChannelFrame.cpp.

bool scope::gui::CChannelFrame::RunUpdateStatusbar ( StopCondition *const  sc,
scope::SCOPE_MULTIIMAGECPTR_T const  _multi 
)
protected

Worker function for all statusbar updates which will run in the Active's thread.

Since UISetText does string buffer delete and new we need to protect it. Additionally, UIUpdateStatusbar sends a settext message to the statusbar and does not return until the message is processes. Taken together having a worker function for the Active, ensuring only one call to UISetText and UIUpdateStatusbar at a time is the most robust solution. (Finally...)

Definition at line 82 of file ChannelFrame.cpp.

void scope::gui::CChannelFrame::UpdateScaleText ( )
protected

Updates the scale text with current values from scope_controller::GuiParameters.

Definition at line 110 of file ChannelFrame.cpp.

void scope::gui::CChannelFrame::UncheckScaleButtons ( )
protected

Unchecks all scale buttons.

Definition at line 120 of file ChannelFrame.cpp.

void scope::gui::CChannelFrame::OnFinalMessage ( HWND  )
virtual

delete this to free the memory

Definition at line 44 of file ChannelFrame.cpp.

BOOL scope::gui::CChannelFrame::OnIdle ( )
virtual

Updates toolbar and statusbar.

Definition at line 57 of file ChannelFrame.cpp.

int scope::gui::CChannelFrame::OnCreate ( LPCREATESTRUCT  lpCreateStruct)

Create view, toolbar, and statusbar etc.

Resize window correctly.

Definition at line 126 of file ChannelFrame.cpp.

void scope::gui::CChannelFrame::OnDestroy ( )

Detaches frame from ScopeController, because after OnDestroy the HWND is not valid anymore.

Definition at line 48 of file ChannelFrame.cpp.

void scope::gui::CChannelFrame::OnSizing ( UINT  fwSide,
LPRECT  pRect 
)

Keeps the aspect ratio.

We subtract 20 for the window border and 92 for the tool- and statusbar to end up with the correct size ChannelFrame must have for correct aspect ratio in ChannelView

Definition at line 216 of file ChannelFrame.cpp.

BOOL scope::gui::CChannelFrame::OnMouseWheel ( UINT  nFlags,
short  zDelta,
CPoint  pt 
)

Handles mouse wheel events to change zoom or pockels cell value (wheel+Ctrl)

Definition at line 242 of file ChannelFrame.cpp.

void scope::gui::CChannelFrame::OnSameSize ( UINT  uCode,
int  nID,
HWND  hwncCtrl 
)

Sets window size to match the real frame size.

Definition at line 260 of file ChannelFrame.cpp.

void scope::gui::CChannelFrame::OnDoubleSize ( UINT  uCode,
int  nID,
HWND  hwncCtrl 
)

Sets window size to double the real frame size.

Definition at line 267 of file ChannelFrame.cpp.

void scope::gui::CChannelFrame::OnHalfSize ( UINT  uCode,
int  nID,
HWND  hwncCtrl 
)

Sets window size to half the real frame size.

Definition at line 274 of file ChannelFrame.cpp.

LRESULT scope::gui::CChannelFrame::OnUpdateMousePixel ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL &  bHandled 
)

Mouse movements are received in the client window (CChannelView) with the correct coordinates.

CChannelView passes this on to CChannelFrame which uses this function to process and show intensity values of the corresponding image pixel

Definition at line 231 of file ChannelFrame.cpp.

void scope::gui::CChannelFrame::UpdateStatus ( const RunState _rs)
virtual

Updates the statusstr and send RunUpdateStatusbar to the Active object.

Definition at line 290 of file ChannelFrame.cpp.

void scope::gui::CChannelFrame::SetHistogramLimits ( const uint32_t &  _channel,
const uint16_t &  _lower,
const uint16_t &  _upper 
)
virtual

Sets upper and lower limit of displayed colors for a channel.

Definition at line 281 of file ChannelFrame.cpp.

void scope::gui::CChannelFrame::LayOverAndRender ( scope::SCOPE_MULTIIMAGECPTR_T const  _multi)
virtual

Sends the worker function 'RunLayOverAndRender' to the ActiveObject.

Parameters
[in]_multiPointer to the current multi image

Definition at line 295 of file ChannelFrame.cpp.

void scope::gui::CChannelFrame::UpdateScaleText ( const std::wstring &  _text)
virtual

Updates scale text.

Calls CChannelView::UpdateScale

Definition at line 307 of file ChannelFrame.cpp.

uint32_t scope::gui::CChannelFrame::Area ( ) const
inline
Returns
the CChannelFrame's area

Definition at line 194 of file ChannelFrame.h.

Member Data Documentation

scope::ScopeController scope::gui::CChannelFrame::scope_controller
protected

the ScopeController kept handy here

Definition at line 35 of file ChannelFrame.h.

const uint32_t scope::gui::CChannelFrame::area
protected

area for this CChannelFrame

Definition at line 38 of file ChannelFrame.h.

const uint32_t scope::gui::CChannelFrame::channels
protected

number of channels in this area

Definition at line 41 of file ChannelFrame.h.

bool scope::gui::CChannelFrame::attached
protected

are we attached to ScopeController?

Definition at line 44 of file ChannelFrame.h.

CChannelView scope::gui::CChannelFrame::view
protected

The view inside the client window.

Definition at line 47 of file ChannelFrame.h.

scope::SCOPE_MULTIIMAGECPTR_T scope::gui::CChannelFrame::current_frame
protected

currently displayed image

Definition at line 50 of file ChannelFrame.h.

std::wstring scope::gui::CChannelFrame::framecountstr
protected

Holds the current frame count etc as string.

We need a class member for this since UIUpdateStatus bar runs asynchronously. A local string would get deleted once it is out of scope.

Definition at line 53 of file ChannelFrame.h.

D2D1_POINT_2F scope::gui::CChannelFrame::mousepos
protected

current mouse position in device independent pixels (for the renderer)

Definition at line 56 of file ChannelFrame.h.

std::wstring scope::gui::CChannelFrame::mouseposstr
protected

holds the current mouse position as string

Definition at line 59 of file ChannelFrame.h.

std::wstring scope::gui::CChannelFrame::statusstr
protected

holds the current run status as string

Definition at line 62 of file ChannelFrame.h.

CMultiPaneStatusBarCtrl scope::gui::CChannelFrame::m_wndStatusBar
protected

the statusbar

Definition at line 65 of file ChannelFrame.h.

CToolBarCtrl scope::gui::CChannelFrame::toolbar
protected

the toolbar

Definition at line 68 of file ChannelFrame.h.

std::vector<ColorProps> scope::gui::CChannelFrame::channel_colors
protected

Ordered by channel number.

Definition at line 71 of file ChannelFrame.h.

scope::SCOPE_OVERLAY_T scope::gui::CChannelFrame::overlay
protected

Overlay of channels of the currently displayed image, use shared_ptr because it is used from different thread (e.g.

the Active's worker thread)

Definition at line 74 of file ChannelFrame.h.

std::array< int32_t, 4 > scope::gui::CChannelFrame::colorcombo_resources = { IDC_COLORCOMBO1, IDC_COLORCOMBO2, IDC_COLORCOMBO3, IDC_COLORCOMBO4 }
staticprotected

The resource IDs of the channel color combo boxes.

Definition at line 77 of file ChannelFrame.h.

CCommandBarCtrl scope::gui::CChannelFrame::m_CmdBar

the command bar.

public, CToolBarHelper needs this to compile...

Definition at line 99 of file ChannelFrame.h.


The documentation for this class was generated from the following files: