-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFontChildFrame.cpp
112 lines (90 loc) · 2.77 KB
/
FontChildFrame.cpp
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
// EditViewChildFrame.cpp : implementation file
//
#include "stdafx.h"
#include "SCIPicEditor.h"
#include "FontChildFrame.h"
#include "RasterView.h"
#include "ViewCelChooser.h"
#include "FontPreviewView.h"
// CEditFontChildFrame
IMPLEMENT_DYNCREATE(CEditFontChildFrame, CMDITabChildWnd)
CEditFontChildFrame::CEditFontChildFrame()
{
_pViewMainView = NULL;
_pFontPreviewView = NULL;
}
CEditFontChildFrame::~CEditFontChildFrame()
{
}
BEGIN_MESSAGE_MAP(CEditFontChildFrame, CMDITabChildWnd)
ON_WM_CREATE()
ON_COMMAND_EX(IDR_TOOLBARDRAWVIEW, OnBarCheck)
ON_UPDATE_COMMAND_UI(IDR_TOOLBARDRAWVIEW, OnUpdateControlBarMenu)
END_MESSAGE_MAP()
void CEditFontChildFrame::HookUpNonViews(CDocument *pDoc)
{
}
int CEditFontChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (__super::OnCreate(lpCreateStruct) == -1)
return -1;
return 0;
}
BOOL CEditFontChildFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext)
{
// This is the code for a static splitter.
CRect cr;
GetClientRect(&cr);
int heightTop = cr.Height() / 3;
int heightChooser = cr.Height() * 2 / 3;
CSize paneSize;
int rc;
m_wndSplitter.CreateStatic(this, 2, 1);
rc = m_wndSplitterTop.CreateStatic(&m_wndSplitter, 1, 2, WS_CHILD | WS_VISIBLE | WS_BORDER, m_wndSplitter.IdFromRowCol(0, 0));
if (rc == FALSE)
{
return rc;
}
paneSize.SetSize(cr.Width(), heightChooser);
rc = m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CEditViewCelChooser), paneSize, pContext);
if (rc == FALSE)
{
return rc;
}
paneSize.SetSize(cr.Width() / 5, heightTop);
rc = m_wndSplitterTop.CreateView(0, 0, RUNTIME_CLASS(CRasterView), paneSize, pContext);
if (rc == FALSE)
{
return rc;
}
_pViewMainView = (CRasterView*)m_wndSplitterTop.GetPane(0, 0);
paneSize.SetSize(cr.Width() * 4 / 5, heightTop);
rc = m_wndSplitterTop.CreateView(0, 1, RUNTIME_CLASS(CFontPreviewView), paneSize, pContext);
if (rc == FALSE)
{
return rc;
}
// This does nothing
m_wndSplitter.SetRowInfo(0, heightTop, 20);
return rc;
}
BOOL CEditFontChildFrame::OnCmdMsg(UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo)
{
BOOL fRet = __super::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
if (!fRet)
{
// If unhandled, give it the main (even if it was non-active).
// NOTE: if it was active, it was already asked to handle it above.
// We could optimize for that case here, if desired.
if (_pViewMainView)
{
fRet = _pViewMainView->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
if (!fRet)
{
// Give to CommandType view?
}
}
return fRet;
}
// CEditFontChildFrame message handlers