-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWinTrs80Thread.cpp
More file actions
109 lines (77 loc) · 2.25 KB
/
WinTrs80Thread.cpp
File metadata and controls
109 lines (77 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// WinTrs80Thread.cpp : implementation file
//
#include "stdafx.h"
#include "WinTrs80Thread.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CWinTrs80Thread
//IMPLEMENT_DYNCREATE(CWinTrs80Thread, CWinThread)
IMPLEMENT_DYNAMIC(CWinTrs80Thread, CWinThread)
BEGIN_MESSAGE_MAP(CWinTrs80Thread, CWinThread)
//{{AFX_MSG_MAP(CWinTrs80Thread)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
CWinTrs80Thread::CWinTrs80Thread(CChildView *client_wnd, CWinTrs80Thread** ptr, CTrs80Configurator *config)
{
m_view = client_wnd;
m_ptr_to_me = ptr;
m_config = config;
}
CWinTrs80Thread::~CWinTrs80Thread()
{
*m_ptr_to_me = NULL;
}
//**************************************************
BOOL CWinTrs80Thread::InitInstance()
{
HDC hdc;
SetThreadPriority(THREAD_PRIORITY_TIME_CRITICAL);
m_view->lpDDSBack->GetDC(&hdc);
m_cdc.Attach(hdc);
m_trs80.AttachCDC(&m_cdc);
m_trs80.Boot(m_config);
m_trs80.DetachCDC();
m_cdc.Detach();
m_view->lpDDSBack->ReleaseDC(hdc);
// avoid entering standard message loop by returning FALSE
return FALSE;
}
//**************************************************
int CWinTrs80Thread::ExitInstance()
{
return CWinThread::ExitInstance();
}
//**************************************************
void CWinTrs80Thread::Paint(CDC* cdc)
{
if (m_cdc.m_hDC)
m_trs80.Paint(cdc);
}
//**************************************************
void CWinTrs80Thread::SetCharDown(unsigned char c, unsigned char oem)
{
m_trs80.SetCharDown(c, oem);
}
//**************************************************
void CWinTrs80Thread::SetCharUp(unsigned char c, unsigned char oem)
{
m_trs80.SetCharUp(c, oem);
}
//**************************************************
void CWinTrs80Thread::KillThreadAsync()
{
m_trs80.SuspendExecutionAsync();
}
//**************************************************
void CWinTrs80Thread::GetDisplaySize(CDC *dc, CSize *size)
{
m_trs80.GetDisplaySize(dc, size);
}
/////////////////////////////////////////////////////////////////////////////
// CWinTrs80Thread message handlers