[commit] r1326 - in trunk/GME: Console Gme
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Thu May 26 16:16:49 CDT 2011
Author: ksmyth
Date: Thu May 26 16:16:49 2011
New Revision: 1326
Log:
Fix Ctrl-C and Ctrl-A (et al) in Console window by passing PreTranslateMessage through the ActiveX boundary. (TODO: do this for all ActiveXs)
Modified:
trunk/GME/Console/ConsoleCtl.cpp
trunk/GME/Console/ConsoleCtl.h
trunk/GME/Console/HtmlCtrl.h
trunk/GME/Console/Resource.h
trunk/GME/Gme/GMEConsole.cpp
trunk/GME/Gme/GMEConsole.h
trunk/GME/Gme/GMEOLEIt.cpp
Modified: trunk/GME/Console/ConsoleCtl.cpp
==============================================================================
--- trunk/GME/Console/ConsoleCtl.cpp Thu May 26 16:10:47 2011 (r1325)
+++ trunk/GME/Console/ConsoleCtl.cpp Thu May 26 16:16:49 2011 (r1326)
@@ -59,6 +59,10 @@
DISP_FUNCTION(CConsoleCtrl, "SetGMEApp", SetGMEApp, VT_EMPTY, VTS_DISPATCH)
DISP_FUNCTION(CConsoleCtrl, "SetGMEProj", SetGMEProj, VT_EMPTY, VTS_DISPATCH)
DISP_FUNCTION_ID(CConsoleCtrl, "NavigateTo", dispidNavigateTo, NavigateTo, VT_EMPTY, VTS_BSTR)
+#ifdef _WIN64
+#error GetCWnd may overflow
+#endif
+ DISP_PROPERTY_EX_ID(CConsoleCtrl, "GetCWnd", 0x43576E64, GetCWnd, SetCWnd, VT_I4)
DISP_FUNCTION_ID(CConsoleCtrl, "AboutBox", DISPID_ABOUTBOX, AboutBox, VT_EMPTY, VTS_NONE)
//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()
@@ -830,5 +834,15 @@
return TRUE; // message was handled
}
+BOOL CConsoleCtrl::PreTranslateMessage(MSG* pMsg) {
+ HWND h = ::GetFocus();
+ while (h) {
+ if (h == m_browser.GetSafeHwnd()) {
+ return m_browser.PreTranslateMessage(pMsg);
+ }
+ h = ::GetParent(h);
+ }
+ return FALSE;
+}
Modified: trunk/GME/Console/ConsoleCtl.h
==============================================================================
--- trunk/GME/Console/ConsoleCtl.h Thu May 26 16:10:47 2011 (r1325)
+++ trunk/GME/Console/ConsoleCtl.h Thu May 26 16:16:49 2011 (r1326)
@@ -1,9 +1,4 @@
-#if !defined(AFX_CONSOLECTL_H__06A2BBCD_6B16_4C6F_A339_6685CEC1DF65__INCLUDED_)
-#define AFX_CONSOLECTL_H__06A2BBCD_6B16_4C6F_A339_6685CEC1DF65__INCLUDED_
-
-#if _MSC_VER > 1000
#pragma once
-#endif // _MSC_VER > 1000
#include "HtmlCtrl.h"
#include "ScriptEdit.h"
@@ -111,10 +106,11 @@
eventidClickMGAID = 1L,
//}}AFX_DISP_ID
};
-
+ afx_msg int GetCWnd() { return (int)(void*)(CWnd*)this; }
+ afx_msg void SetCWnd(void*) { }
+ BOOL PreTranslateMessage(MSG* pMsg);
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
-#endif // !defined(AFX_CONSOLECTL_H__06A2BBCD_6B16_4C6F_A339_6685CEC1DF65__INCLUDED)
Modified: trunk/GME/Console/HtmlCtrl.h
==============================================================================
--- trunk/GME/Console/HtmlCtrl.h Thu May 26 16:10:47 2011 (r1325)
+++ trunk/GME/Console/HtmlCtrl.h Thu May 26 16:16:49 2011 (r1326)
@@ -1,9 +1,4 @@
-#if !defined(AFX_HTMLCTRL_H__24472601_5F31_49E1_A4BC_D5855C8786D7__INCLUDED_)
-#define AFX_HTMLCTRL_H__24472601_5F31_49E1_A4BC_D5855C8786D7__INCLUDED_
-
-#if _MSC_VER > 1000
#pragma once
-#endif // _MSC_VER > 1000
// HtmlCtrl.h : header file
//
@@ -88,4 +83,3 @@
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
-#endif // !defined(AFX_HTMLCTRL_H__24472601_5F31_49E1_A4BC_D5855C8786D7__INCLUDED_)
Modified: trunk/GME/Console/Resource.h
==============================================================================
--- trunk/GME/Console/Resource.h Thu May 26 16:10:47 2011 (r1325)
+++ trunk/GME/Console/Resource.h Thu May 26 16:16:49 2011 (r1326)
@@ -35,13 +35,15 @@
#define IDI_BTNUP 214
#define IDI_BTNDN 215
#define IDI_BTNRET 216
+#define IDR_ACCELERATOR_HTML_CTRL 216
+#define ID_ACCELERATOR_HTML_CTRL_C 32768
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 216
-#define _APS_NEXT_COMMAND_VALUE 32768
+#define _APS_NEXT_RESOURCE_VALUE 217
+#define _APS_NEXT_COMMAND_VALUE 32770
#define _APS_NEXT_CONTROL_VALUE 201
#define _APS_NEXT_SYMED_VALUE 124
#endif
Modified: trunk/GME/Gme/GMEConsole.cpp
==============================================================================
--- trunk/GME/Gme/GMEConsole.cpp Thu May 26 16:10:47 2011 (r1325)
+++ trunk/GME/Gme/GMEConsole.cpp Thu May 26 16:16:49 2011 (r1326)
@@ -58,6 +58,7 @@
if(!m_Console.Create(_T("Console"),WS_CHILD | WS_BORDER | WS_VISIBLE,CRect(0,0,230,300),this,IDC_CONSOLE_CTRL)) {
+ ASSERT(FALSE);
return -1;
}
Modified: trunk/GME/Gme/GMEConsole.h
==============================================================================
--- trunk/GME/Gme/GMEConsole.h Thu May 26 16:10:47 2011 (r1325)
+++ trunk/GME/Gme/GMEConsole.h Thu May 26 16:16:49 2011 (r1326)
@@ -1,12 +1,8 @@
//{{AFX_INCLUDES()
#include "console.h"
//}}AFX_INCLUDES
-#if !defined(AFX_GMECONSOLE_H__C58BF4E8_E3F7_4717_BBDA_B908B0DD4D5E__INCLUDED_)
-#define AFX_GMECONSOLE_H__C58BF4E8_E3F7_4717_BBDA_B908B0DD4D5E__INCLUDED_
-#if _MSC_VER > 1000
#pragma once
-#endif // _MSC_VER > 1000
// GMEConsole.h : header file
//
@@ -54,9 +50,16 @@
DECLARE_EVENTSINK_MAP()
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
+
+virtual BOOL PreTranslateMessage(MSG* pMsg)
+{
+ CWnd* cwnd = 0;
+ m_Console.InvokeHelper(0x43576E64 /* magic from ConsoleCtl.cpp */, DISPATCH_PROPERTYGET, VT_I4, (void*)&cwnd, 0);
+ return cwnd->PreTranslateMessage(pMsg);
+}
+
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
-#endif // !defined(AFX_GMECONSOLE_H__C58BF4E8_E3F7_4717_BBDA_B908B0DD4D5E__INCLUDED_)
Modified: trunk/GME/Gme/GMEOLEIt.cpp
==============================================================================
--- trunk/GME/Gme/GMEOLEIt.cpp Thu May 26 16:10:47 2011 (r1325)
+++ trunk/GME/Gme/GMEOLEIt.cpp Thu May 26 16:16:49 2011 (r1326)
@@ -2552,8 +2552,8 @@
{
CGMEEventLogger::LogGMEEvent(_T("CGMEOLEIt::Help\r\n"));
- static const char * htmlhelp =
- "Scripting HELP<br>\
+ static const wchar_t * htmlhelp =
+ L"Scripting HELP<br>\
Predefined variables available in this scripting environment: "gme", "project" and "it".<br>\
<b>gme</b> implements the IGMEOLEApp interface. i.e.: gme.OpenProject('MGA=c:\myproj.mga') <br>\
<b>project</b> implements the IMgaProject interface. i.e.: myrootfolder = project.RootFolder<br>\
More information about the gme-commit
mailing list