From 62aab6380ca9da814d21daf866aa6019a2472f23 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 2 Oct 2003 12:45:29 +0000 Subject: [PATCH] Patch level : 2.0 588 Files correlati : xvaga.dll Ricompilazione Demo : [ ] Commento : Supporto per nuovo help in formato HTML git-svn-id: svn://10.65.10.50/trunk@11460 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- xvaga/oswin32.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++++++- xvaga/xvaga.cpp | 24 ++++++++++++++++++++- 2 files changed, 76 insertions(+), 2 deletions(-) diff --git a/xvaga/oswin32.cpp b/xvaga/oswin32.cpp index 617c00090..49eef6748 100755 --- a/xvaga/oswin32.cpp +++ b/xvaga/oswin32.cpp @@ -1,4 +1,5 @@ #include "wxinc.h" +#include "wx/filename.h" #include "oswin32.h" @@ -263,10 +264,43 @@ void OsWin32_Beep(int severity) } } +static wxString GetHelpDir() +{ + return "htmlhelp/"; +} + +static wxString FindHelpFile(const char* topic) +{ + wxString strTopic = topic; + + wxString strApp; + wxFileName::SplitPath(wxTheApp->argv[0], NULL, &strApp, NULL); + + if (strTopic.IsEmpty()) + { + strTopic = strApp; + strTopic += "100a"; + } + + wxString str; + for (int i = 0; i < 2; i++) + { + str = GetHelpDir(); + str += i == 0 ? strTopic.Left(2) : strApp.Left(2); + str += "/"; + str += strTopic; + str += ".html"; + if (wxFileExists(str)) + break; + } + return str; +} + int OsWin32_Help(unsigned int handle, const char* hlp, unsigned int cmd, const char* topic) { HWND hwnd = (HWND)handle; +/* switch(cmd) { case M_HELP_CONTENTS: @@ -298,7 +332,25 @@ int OsWin32_Help(unsigned int handle, const char* hlp, unsigned int cmd, const c ::WinHelp(hwnd, hlp, HELP_QUIT, 0); break; } - return TRUE; +*/ + wxString str; + switch(cmd) + { + case M_HELP_ONCONTEXT: + str = FindHelpFile(topic); + break; + default: + str = GetHelpDir(); + str += "index.html"; + break; + } + if (!str.IsEmpty() && wxFileExists(str)) + { + ::ShellExecute(hwnd, "open", str, NULL, NULL, SW_SHOWDEFAULT); + return true; + } + OsWin32_Beep(1); + return false; } bool OsWin32_TestNetworkVersion() diff --git a/xvaga/xvaga.cpp b/xvaga/xvaga.cpp index 24060ef37..d0998686b 100755 --- a/xvaga/xvaga.cpp +++ b/xvaga/xvaga.cpp @@ -1638,6 +1638,7 @@ struct XVAGA_HELP_INFO XVT_HELP_INFO xvt_help_open_helpfile(FILE_SPEC *fs, unsigned long flags) { +/* if (!help_info.m_strFilename.IsEmpty()) xvt_help_close_helpfile((XVT_HELP_INFO)&help_info); @@ -1668,6 +1669,8 @@ XVT_HELP_INFO xvt_help_open_helpfile(FILE_SPEC *fs, unsigned long flags) } } return NULL_HELP_INFO; +*/ + return (XVT_HELP_INFO)&help_info; } void xvt_help_close_helpfile(XVT_HELP_INFO hi) @@ -1675,7 +1678,8 @@ void xvt_help_close_helpfile(XVT_HELP_INFO hi) if (hi == NULL_HELP_INFO) hi = (XVT_HELP_INFO)&help_info; - XVAGA_HELP_INFO* ahi = (XVAGA_HELP_INFO*)hi; +/* + XVAGA_HELP_INFO* ahi = (XVAGA_HELP_INFO*)hi; if (!ahi->m_strFilename.IsEmpty()) { #ifdef WIN32 @@ -1689,12 +1693,14 @@ void xvt_help_close_helpfile(XVT_HELP_INFO hi) ahi->m_hc.Quit(); ahi->m_strFilename.Empty(); } +*/ } BOOLEAN xvt_help_process_event(XVT_HELP_INFO hi, WINDOW win, EVENT *ev) { BOOLEAN bProcessed = FALSE; +/* if (hi == NULL_HELP_INFO) return bProcessed; @@ -1745,6 +1751,22 @@ BOOLEAN xvt_help_process_event(XVT_HELP_INFO hi, WINDOW win, EVENT *ev) default: break; } +*/ + +#ifdef WIN32 + unsigned int hwnd = (unsigned int)xvt_vobj_get_attr(win, ATTR_NATIVE_WINDOW); + switch (ev->type) + { + case E_COMMAND: + bProcessed = OsWin32_Help(hwnd, "", ev->v.cmd.tag, NULL); + break; + case E_HELP: + bProcessed = OsWin32_Help(hwnd, "", M_HELP_ONCONTEXT, (const char*)ev->v.help.tid); + break; + default: + break; + } +#endif // WIN32 return bProcessed; }