[dasher: 141/217] Win32 decoupled Canvas from knowing that dasher interface stores settings
- From: Patrick Welche <pwelche src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dasher: 141/217] Win32 decoupled Canvas from knowing that dasher interface stores settings
- Date: Sat, 27 Feb 2016 12:12:10 +0000 (UTC)
commit 9e9d0c17df6e14e57c2abb45e10f373b71c65052
Author: ipomoena <amajorek google com>
Date: Wed Dec 9 17:23:53 2015 -0800
Win32 decoupled Canvas from knowing that dasher interface stores settings
Src/Win32/Dasher.cpp | 2 +-
Src/Win32/Widgets/Canvas.cpp | 14 ++------------
Src/Win32/Widgets/Canvas.h | 2 +-
Src/Win32/Widgets/Screen.cpp | 3 ++-
Src/Win32/Widgets/Screen.h | 2 +-
5 files changed, 7 insertions(+), 16 deletions(-)
---
diff --git a/Src/Win32/Dasher.cpp b/Src/Win32/Dasher.cpp
index a307e2c..cd794ce 100644
--- a/Src/Win32/Dasher.cpp
+++ b/Src/Win32/Dasher.cpp
@@ -49,7 +49,7 @@ CDasher::CDasher(HWND Parent, CDasherWindow *pWindow, CEdit *pEdit, Dasher::CSet
//The following was done in SetupUI, i.e. the first thing in Realize.
// So doing here:
m_pCanvas = new CCanvas(this);
- m_pCanvas->Create(m_hParent); // TODO - check return
+ m_pCanvas->Create(m_hParent, GetStringParameter(SP_DASHER_FONT)); // TODO - check return
// Framerate settings: currently 40fps.
SetTimer(m_pCanvas->getwindow(), 1, 25, NULL);
diff --git a/Src/Win32/Widgets/Canvas.cpp b/Src/Win32/Widgets/Canvas.cpp
index 3fe0497..99ba9b2 100644
--- a/Src/Win32/Widgets/Canvas.cpp
+++ b/Src/Win32/Widgets/Canvas.cpp
@@ -54,7 +54,7 @@ CCanvas::CCanvas(CDasher *DI) : m_pDasherInterface(DI) {
#endif
}
-HWND CCanvas::Create(HWND hParent) {
+HWND CCanvas::Create(HWND hParent, const std::string &strFont) {
HWND hWnd = CWindowImpl<CCanvas>::Create(hParent, NULL, NULL, WS_CHILD | WS_VISIBLE ,
0);//WS_EX_CLIENTEDGE);
m_hdc = GetDC();
@@ -64,19 +64,9 @@ HWND CCanvas::Create(HWND hParent) {
// TODO: Is this better placed in CDasher?
m_pKeyboardHelper = new CKeyboardHelper;
- m_pScreen = new CScreen(m_hdc, m_hWnd, 300, 300);
- m_pScreen->SetFont(m_pDasherInterface->GetStringParameter(SP_DASHER_FONT));
+ m_pScreen = new CScreen(m_hdc, m_hWnd, 300, 300, strFont);
m_pDasherInterface->ChangeScreen(m_pScreen);
-
-// for(int i = 0; i < 18; i++)
-// {
-// keycoords[i] = 0;
-// }
-
-// running = 0;
-// previoustime = GetTickCount();
-// direction = 0;
return hWnd;
}
diff --git a/Src/Win32/Widgets/Canvas.h b/Src/Win32/Widgets/Canvas.h
index 09624b3..993610d 100644
--- a/Src/Win32/Widgets/Canvas.h
+++ b/Src/Win32/Widgets/Canvas.h
@@ -76,7 +76,7 @@ class CCanvas : public ATL::CWindowImpl<CCanvas> {
CCanvas(Dasher::CDasher *DI);
~CCanvas();
- HWND Create(HWND hParent);
+ HWND Create(HWND hParent, const std::string &strFont);
LRESULT OnSize(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
#ifndef HAVE_NO_THEME
diff --git a/Src/Win32/Widgets/Screen.cpp b/Src/Win32/Widgets/Screen.cpp
index 6c34d3e..3a401bc 100644
--- a/Src/Win32/Widgets/Screen.cpp
+++ b/Src/Win32/Widgets/Screen.cpp
@@ -27,11 +27,12 @@ static char THIS_FILE[] = __FILE__;
/////////////////////////////////////////////////////////////////////////////
-CScreen::CScreen(HDC hdc, HWND hWnd, Dasher::screenint iWidth, Dasher::screenint iHeight)
+CScreen::CScreen(HDC hdc, HWND hWnd, Dasher::screenint iWidth, Dasher::screenint iHeight, const std::string
&strFont)
:CLabelListScreen(iWidth, iHeight), m_hdc(hdc) {
m_hWnd = hWnd;
CreateBuffers();
+ SetFont(strFont);
}
void CScreen::CreateBuffers() {
diff --git a/Src/Win32/Widgets/Screen.h b/Src/Win32/Widgets/Screen.h
index aab14ba..1186a60 100644
--- a/Src/Win32/Widgets/Screen.h
+++ b/Src/Win32/Widgets/Screen.h
@@ -31,7 +31,7 @@ class CScreen:public Dasher::CLabelListScreen, private NoClones {
public:
//Saves a lot of typing; typedefs are equal to their declaration & do not create distinct types.
typedef Dasher::screenint screenint;
- CScreen(HDC hdc, HWND hWnd, screenint width, screenint height);
+ CScreen(HDC hdc, HWND hWnd, screenint width, screenint height, const std::string &strFont);
~CScreen();
void SetColourScheme(const Dasher::CColourIO::ColourInfo *pColours) override;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]