This repository has been archived by the owner on Mar 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCustomControls.h
165 lines (133 loc) · 3.34 KB
/
CustomControls.h
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#pragma once
#include "afxwin.h"
#include "ndbport.h"
#include "LTPViewer.h"
inline void RegisterClass(LPCTSTR name)
{
WNDCLASS wndcls;
HINSTANCE hInst = AfxGetInstanceHandle();
if (!(::GetClassInfo(hInst, name, &wndcls)))
{
// otherwise we need to register a new class
wndcls.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
wndcls.lpfnWndProc = ::DefWindowProc;
wndcls.cbClsExtra = wndcls.cbWndExtra = 0;
wndcls.hInstance = hInst;
wndcls.hIcon = NULL;
wndcls.hCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW);
wndcls.hbrBackground = (HBRUSH) (COLOR_3DFACE + 1);
wndcls.lpszMenuName = NULL;
wndcls.lpszClassName = name;
if (!AfxRegisterClass(&wndcls))
{
AfxThrowResourceException();
}
}
}
// CBlockTrailerControl
class CBlockTrailerControl : public CWnd
{
DECLARE_DYNAMIC(CBlockTrailerControl)
public:
CBlockTrailerControl();
CBlockTrailerControl(const BREF& bref, CB cb, NDBViewer * pNDBViewer);
virtual ~CBlockTrailerControl();
protected:
DECLARE_MESSAGE_MAP()
virtual void PreSubclassWindow();
private:
CButton m_groupBox;
CStatic m_labels;
CStatic m_values;
BLOCKTRAILER m_bt;
BOOL m_fValidCRC;
WORD m_wSig;
};
// CBlockTrailerControl
class CPageTrailerControl : public CWnd
{
DECLARE_DYNAMIC(CPageTrailerControl)
public:
CPageTrailerControl();
CPageTrailerControl(IB ib, NDBViewer * pNDBViewer);
virtual ~CPageTrailerControl();
protected:
DECLARE_MESSAGE_MAP()
virtual void PreSubclassWindow();
private:
CButton m_groupBox;
CStatic m_labels;
CStatic m_values;
PAGETRAILER m_pt;
BOOL m_fValidCRC;
};
#pragma once
// CBinaryListBox
enum BinaryListBoxMode
{
MODE_BINARY = 1,
MODE_HEX = 2,
MODE_UNICODE = 3
};
#define HEX_BYTES_PER_LINE 12
#define BINARY_BYTES_PER_LINE 4
#define UNICODE_BYTES_PER_LINE 64
#define NULL_WCHAR_REPLACEMENT L'?'
class CBinaryListBox : public CListBox
{
DECLARE_DYNAMIC(CBinaryListBox)
public:
CBinaryListBox();
void SetData(BYTE * pData, UINT size, IB ibStart);
void SetMode(BinaryListBoxMode m) { m_mode = m; Populate(); }
virtual ~CBinaryListBox();
protected:
void Populate();
void ByteToString(LPWSTR pBuffer, BYTE b);
BinaryListBoxMode m_mode;
BYTE * m_pData;
UINT m_dataSize;
IB m_ibStart;
DECLARE_MESSAGE_MAP()
};
#pragma once
// CFileRangeControl
enum RangeType
{
TYPE_BLOCK = 1,
TYPE_PAGE,
TYPE_META
};
struct RangeData
{
CB start;
CB end;
RangeType type;
};
class CFileRangeControl : public CWnd
{
DECLARE_DYNAMIC(CFileRangeControl)
public:
CFileRangeControl(CB startRange, CB endRange, NDBViewer * pNDBViewer);
CFileRangeControl(NDBViewer * pNDBViewer);
virtual ~CFileRangeControl();
protected:
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnPaint();
void SetNewLimits(CB startRange, CB endRange);
void AddRange(CB start, CB end, RangeType rt);
void SelectRange(CB start, CB end, RangeType rt);
private:
CB m_cbStart;
CB m_cbEnd;
LONG m_minWidth;
RangeData selection;
NDBViewer * m_pNDBViewer;
CStatic m_staticStart;
CStatic m_staticEnd;
CList<RangeData> m_data;
CBitmap * m_pBM;
protected:
virtual void PreSubclassWindow();
};