-
Notifications
You must be signed in to change notification settings - Fork 0
/
Modeler1SourceView.cpp
84 lines (64 loc) · 1.77 KB
/
Modeler1SourceView.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
// Modeler1SourceView.cpp : implementation file
//
#include "stdafx.h"
#include "Modeler1.h"
#include "Modeler1SourceView.h"
#include "MainFrm.h"
// CModeler1SourceView
IMPLEMENT_DYNCREATE(CModeler1SourceView, CEditView)
CModeler1SourceView::CModeler1SourceView()
{
}
CModeler1SourceView::~CModeler1SourceView()
{
}
BEGIN_MESSAGE_MAP(CModeler1SourceView, CEditView)
ON_WM_CHAR()
ON_WM_CREATE()
END_MESSAGE_MAP()
// CModeler1SourceView diagnostics
#ifdef _DEBUG
void CModeler1SourceView::AssertValid() const
{
CEditView::AssertValid();
}
#ifndef _WIN32_WCE
void CModeler1SourceView::Dump(CDumpContext& dc) const
{
CEditView::Dump(dc);
}
#endif
#endif //_DEBUG
// CModeler1SourceView message handlers
void CModeler1SourceView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CEditView::OnChar(nChar, nRepCnt, nFlags);
CEdit& ctrlEdit = this->GetEditCtrl();
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
CElementManager* pManager = pFrame->GetManager();
if (pManager->HasSelection())
{
shared_ptr<CElement> pElement = nullptr;
pElement = pManager->m_selection.GetHead();
CString text;
ctrlEdit.GetWindowText(text);
pElement->m_code = T2W((LPTSTR)(LPCTSTR)text);
}
}
int CModeler1SourceView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CEditView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
CEdit& ctrlEdit = this->GetEditCtrl();
CFont* pFont = ctrlEdit.GetFont();
LOGFONT LogFont;
pFont->GetLogFont(&LogFont);
CFont* NewFont = new CFont();
lstrcpy(LogFont.lfFaceName, _T("Calibri"));
LogFont.lfHeight = 16;
LogFont.lfWeight = FW_NORMAL;
NewFont->CreateFontIndirect(&LogFont);
ctrlEdit.SetFont(NewFont);
return 0;
}