Scope
ChannelView.cpp
1 #include "StdAfx.h"
2 #include "ChannelView.h"
3 #include "../controllers/ScopeLogger.h"
4 #include "../controllers/ScopeController.h"
5 
6 namespace scope {
7  namespace gui {
8 
9 int CChannelView::OnCreate(LPCREATESTRUCT lpCreateStruct) {
10  renderer.Create(m_hWnd, lpCreateStruct->cx, lpCreateStruct->cy);
11  return 1;
12 }
13 
15  pMsg;
16  return false;
17 }
18 
19 void CChannelView::OnPaint(CDCHandle /*dc*/) {
20  PAINTSTRUCT paint;
21  ATLASSERT(BeginPaint(&paint));
22  renderer.Render();
23  EndPaint(&paint);
24  ValidateRect(NULL);
25 }
26 
27 void CChannelView::OnSize(UINT /*type*/, CSize size) {
28  if ( !renderer.Resize(size.cx, size.cy) )
29  ATLASSERT(Invalidate(FALSE)); // Why? If !Size than resize went wrong anyway?! (The lines are copied from example in Help)
30 }
31 
32 void CChannelView::OnDisplayChange(UINT /*bpp*/, CSize /*resolution*/) {
33  renderer.Render();
34 }
35 
36 LRESULT CChannelView::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) {
37  ::SendMessage(GetParent().m_hWnd, WM_UPDATEMOUSEPIXEL, wParam, lParam);
38  bHandled = true;
39  return 0;
40 }
41 
42 D2D1_SIZE_F CChannelView::GetRendererSize() const {
43  return renderer.GetSize();
44 }
45 
47  renderer.Render();
48 }
49 
50 void CChannelView::ResizeContent(const uint32_t& _xres, const uint32_t& _yres) {
51  renderer.ResizeBitmap(_xres, _yres);
52 }
53 
54 ID2D1Bitmap* CChannelView::GetBitmap() {
55  return renderer.Bitmap();
56 }
57 
58 void CChannelView::UpdateScaleText(const std::wstring& _text) {
60 }
61 
62 }}
63 
ID2D1Bitmap * GetBitmap()
Definition: ChannelView.cpp:54
void ResizeContent(const uint32_t &_xres, const uint32_t &_yres)
Resizes the bitmap of the renderer.
Definition: ChannelView.cpp:50
virtual bool Resize(const uint32_t &_xres, const uint32_t &_yres)
Resizes the render target.
LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Handles WM_MOUSEMOVE messages, just passes them on to ChannelFrame (the parent) via user-defined mess...
Definition: ChannelView.cpp:36
virtual void UpdateScaleText(const std::wstring &_text)
Update the scale text.
void OnPaint(CDCHandle)
Calls renderer and validates rect.
Definition: ChannelView.cpp:19
D2D1_SIZE_F GetSize(void) const
void OnDisplayChange(UINT, CSize)
Calls renderer.
Definition: ChannelView.cpp:32
virtual void UpdateScaleText(const std::wstring &_text)
Update the scale text.
Definition: ChannelView.cpp:58
int OnCreate(LPCREATESTRUCT lpCreateStruct)
Creates the renderer.
Definition: ChannelView.cpp:9
void Render()
Calls renderer.Render.
Definition: ChannelView.cpp:46
virtual void Render()
Renders the bitmap and the scale text.
ID2D1Bitmap * Bitmap() const
This is the include file for standard system include files, or project specific include files that ar...
BOOL PreTranslateMessage(MSG *pMsg)
Does nothing (-> disable default handling)
Definition: ChannelView.cpp:14
D2D1_SIZE_F GetRendererSize() const
Definition: ChannelView.cpp:42
d2d::D2ChannelRender renderer
the Direct2D renderer class
Definition: ChannelView.h:14
void OnSize(UINT, CSize size)
Calls renderer's resize.
Definition: ChannelView.cpp:27
bool ResizeBitmap(const uint32_t &_xres, const uint32_t &_yres)
Resizes the bitmap.
virtual void Create(const HWND &_hwnd, const uint32_t &_xres, const uint32_t &_yres)
Creates the render target for a hwnd, a bitmap with the desired resolution, a brushes for painting ...