Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

ScriptEditorFrm.cpp

00001 /* QuestDesigner - Open Zelda's Project
00002    Copyright (C) 2003 Kronuz
00003    Copyright (C) 2001/2003 Open Zelda's Project
00004  
00005    This program is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU General Public License
00007    as published by the Free Software Foundation; either version 2
00008    of the License, or (at your option) any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software
00017    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 */
00019 
00021 // ScriptEditorFrm.cpp : implementation of the CScriptEditorFrame class
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 /*hWnd*/)
00036 {
00037     // remove ourseves from the idle message pump
00038     CMessageLoop *pLoop = _Module.GetMessageLoop();
00039     ATLASSERT(NULL!=pLoop);
00040     pLoop->RemoveIdleHandler(this);
00041 
00042     // the main toolbar buttons seem to stay active for a long time
00043     // after we have closed _all_ the MDI child window so were going 
00044     // to force idle processing to update the toolbar.
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     // update the main window's title bar
00057     //UIUpdateTitle();
00058         
00059     // check if we are we the active window...
00060     if(m_pMainFrame->MDIGetActive()==m_hWnd) {
00061         // fake idle processing for the view so it updates
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     // create our view
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     // register ourselves for idle updates
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 /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
00092 {
00093     CChildFrame::Unregister();
00094     return 0;
00095 }
00096 LRESULT CScriptEditorFrame::OnForwardMsg(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
00097 {
00098     LPMSG pMsg = (LPMSG)lParam;
00099     // we need the base class to do its stuff
00100     if(baseClass::PreTranslateMessage(pMsg))
00101         return TRUE;
00102 
00103     // the messages need to be hended to the active view
00104     return m_pScriptEditorView->PreTranslateMessage(pMsg);
00105 }
00106 LRESULT CScriptEditorFrame::OnSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/)
00107 {
00108     // System settings or metrics have changed.  Propogate this message
00109     // to all the child windows so they can update themselves as appropriate.
00110     SendMessageToDescendants(uMsg, wParam, lParam, TRUE);
00111 
00112     return 0;
00113 }
00114 LRESULT CScriptEditorFrame::OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
00115 {
00116     // We give the focus to the view
00117     m_pScriptEditorView->SetFocus();
00118 
00119     // Pumping idle messages to update the main window
00120     PumpIdleMessages();
00121     return 0;
00122 }
00123 
00124 LRESULT CScriptEditorFrame::OnSelectLine(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
00125 {
00126     m_pScriptEditorView->SelectLine(lParam-1);
00127     return 0;
00128 }

Generated on Wed Apr 16 19:12:22 2003 for QuestDesigner by doxygen1.2.18