-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPane.h
More file actions
106 lines (100 loc) · 3.03 KB
/
Copy pathPane.h
File metadata and controls
106 lines (100 loc) · 3.03 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
#pragma once
#include "stdafx.h"
#include "EditorWnd.h"
class CMainFrame;
class COutput;
class CPane :public CWindowImpl<CPane>
{
EditorWindow m_editor;
CComObject<CMyScriptSite>* m_pSite;
CComObject<CScriptHostApp>* m_pApp;
CComQIPtr<IActiveScriptSite> m_spSite;
CPath m_path;
COutput& m_output;
CMainFrame* m_pFrame;
CString m_language; // VBScript,JScript,Python
public:
CPane(CMainFrame* pFrame, COutput& output) :m_pSite(nullptr), m_pApp(nullptr), m_output(output),
m_pFrame(pFrame),m_editor(pFrame)
{
}
DECLARE_WND_CLASS(NULL);
BEGIN_MSG_MAP(CPane)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
MESSAGE_HANDLER(WM_SIZE, OnSize)
COMMAND_ID_HANDLER(ID_DEBUG_STARTED, OnDebugStarted)
COMMAND_ID_HANDLER(ID_DEBUG_PARSE, OnDebugParse)
COMMAND_ID_HANDLER(ID_DEBUG_CONNECTED, OnDebugConnected)
COMMAND_ID_HANDLER(ID_DEBUG_DISCONNECTED, OnDebugDisconnected)
COMMAND_ID_HANDLER(ID_DEBUG_CLOSED, OnDebugClosed)
CHAIN_MSG_MAP_MEMBER(m_editor)
END_MSG_MAP()
LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CRect rc;
GetClientRect(&rc);
m_editor.MoveWindow(0, 0, rc.Width(), rc.Height());
return 0;
}
LRESULT OnDebugStarted(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
HRESULT hr = m_pSite->SetStarted();
ATLASSERT(SUCCEEDED(hr));
return 0;
}
LRESULT OnDebugConnected(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
HRESULT hr = m_pSite->SetConnected();
ATLASSERT(SUCCEEDED(hr));
return 0;
}
LRESULT OnDebugParse(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
int len = m_editor.SendMessage(SCI_GETTEXTLENGTH, 0, 0);
std::string text(len + 1, '\0');
m_editor.SendMessage(SCI_GETTEXT, len + 1, (LPARAM)text.data());
CStringW wide = utf8_to_wide_char(text.c_str());
HRESULT hr = m_pSite->AddScript(wide);
ATLASSERT(SUCCEEDED(hr));
return 0;
}
LRESULT OnDebugDisconnected(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
HRESULT hr = m_pSite->SetDisconnected();
ATLASSERT(SUCCEEDED(hr));
return 0;
}
LRESULT OnDebugClosed(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
HRESULT hr = m_pSite->SetTerminated();
ATLASSERT(SUCCEEDED(hr));
return 0;
}
EditorWindow& GetEditor()
{
return m_editor;
}
void SetLanguage(LPCTSTR lang);
CComObject<CScriptHostApp>* GetApp()
{
return m_pApp;
}
CComObject<CMyScriptSite>* GetSite()
{
return m_pSite;
}
void SetPath(const CPath& path);
LPCTSTR GetLanguage(void)
{
return m_language;
}
BOOL CreateEditor()
{
m_editor.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_VSCROLL | \
WS_HSCROLL);
return m_editor.IsWindow();
}
};