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
This commit is contained in:
parent
482b4c0dca
commit
62aab6380c
@ -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()
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user