00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00021
00022
00023
00024 #include "stdafx.h"
00025 #include "ScriptEditorFrm.h"
00026 #include "MainFrm.h"
00027
00028 CScriptEditorFrame::CScriptEditorFrame(CMainFrame *pMainFrame) :
00029 m_pScriptEditorView(NULL)
00030 {
00031 m_pMainFrame = pMainFrame;
00032 m_pCmdBar = NULL;
00033 }
00034
00035 void CScriptEditorFrame::OnFinalMessage(HWND )
00036 {
00037
00038 CMessageLoop *pLoop = _Module.GetMessageLoop();
00039 ATLASSERT(NULL!=pLoop);
00040 pLoop->RemoveIdleHandler(this);
00041
00042
00043
00044
00045 PumpIdleMessages();
00046
00047 delete this;
00048 }
00049 void CScriptEditorFrame::SetCommandBarCtrlForContextMenu(CTabbedMDICommandBarCtrl* pCmdBar)
00050 {
00051 m_pCmdBar = pCmdBar;
00052 }
00053
00054 BOOL CScriptEditorFrame::OnIdle()
00055 {
00056
00057
00058
00059
00060 if(m_pMainFrame->MDIGetActive()==m_hWnd) {
00061
00062 m_pScriptEditorView->OnIdle();
00063 }
00064 return FALSE;
00065 }
00066
00067 LRESULT CScriptEditorFrame::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
00068 {
00069 m_pScriptEditorView = new CScriptEditorView(this);
00070
00071
00072 m_hWndClient = m_pScriptEditorView->Create( m_hWnd,
00073 rcDefault,
00074 NULL,
00075 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_HSCROLL | WS_VSCROLL,
00076 WS_EX_CLIENTEDGE);
00077 if ( NULL == m_hWndClient ) {
00078 ATLTRACE ( _T ( "Error: failed to create child window\n" ) );
00079 return FALSE;
00080 }
00081
00082
00083 CMessageLoop * pLoop = _Module.GetMessageLoop();
00084 ATLASSERT(NULL!=pLoop);
00085 pLoop->AddIdleHandler(this);
00086
00087 CChildFrame::Register(tScriptEditor);
00088 SetMsgHandled(FALSE);
00089 return TRUE;
00090 }
00091 LRESULT CScriptEditorFrame::OnDestroy(UINT , WPARAM , LPARAM , BOOL& bHandled)
00092 {
00093 CChildFrame::Unregister();
00094 return 0;
00095 }
00096 LRESULT CScriptEditorFrame::OnForwardMsg(UINT , WPARAM , LPARAM lParam, BOOL& )
00097 {
00098 LPMSG pMsg = (LPMSG)lParam;
00099
00100 if(baseClass::PreTranslateMessage(pMsg))
00101 return TRUE;
00102
00103
00104 return m_pScriptEditorView->PreTranslateMessage(pMsg);
00105 }
00106 LRESULT CScriptEditorFrame::OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& )
00107 {
00108
00109
00110 SendMessageToDescendants(uMsg, wParam, lParam, TRUE);
00111
00112 return 0;
00113 }
00114 LRESULT CScriptEditorFrame::OnSetFocus(UINT , WPARAM , LPARAM , BOOL& )
00115 {
00116
00117 m_pScriptEditorView->SetFocus();
00118
00119
00120 PumpIdleMessages();
00121 return 0;
00122 }
00123
00124 LRESULT CScriptEditorFrame::OnSelectLine(UINT , WPARAM , LPARAM lParam, BOOL& )
00125 {
00126 m_pScriptEditorView->SelectLine(lParam-1);
00127 return 0;
00128 }