1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Initial support for HTML Help. All the ad-hoc help-file finding code

and various calls to WinHelp() have been centralised into a new file
winhelp.c, which in turn has been modified to detect a .CHM file as
well as .HLP and select between them as appropriate. It explicitly
tries to load HHCTRL.OCX and use GetProcAddress, meaning that it
_should_ still work correctly on pre-HTML-Help platforms, falling
gracefully back to WinHelp, but although I tested this by
temporarily renaming my own HHCTRL.OCX I haven't yet been able to
test it on a real HTML-Help-free platform.

Also in this checkin: a new .but file and docs makefile changes to
make it convenient to build the sources for a .CHM. As yet, owing to
limitations of Halibut's CHM support, I'm not able to write a .CHM
directly, more's the pity.

[originally from svn r7000]
This commit is contained in:
Simon Tatham
2006-12-17 11:16:07 +00:00
parent 86eac20abb
commit 1dac1bc911
12 changed files with 379 additions and 303 deletions

View File

@ -94,28 +94,20 @@ void filereq_free(filereq *state)
/* Callback function to launch context help. */
static VOID CALLBACK message_box_help_callback(LPHELPINFO lpHelpInfo)
{
if (help_path) {
char *context = NULL;
char *context = NULL;
#define CHECK_CTX(name) \
do { \
if (lpHelpInfo->dwContextId == WINHELP_CTXID_ ## name) \
context = WINHELP_CTX_ ## name; \
} while (0)
CHECK_CTX(errors_hostkey_absent);
CHECK_CTX(errors_hostkey_changed);
CHECK_CTX(errors_cantloadkey);
CHECK_CTX(option_cleanup);
CHECK_CTX(pgp_fingerprints);
do { \
if (lpHelpInfo->dwContextId == WINHELP_CTXID_ ## name) \
context = WINHELP_CTX_ ## name; \
} while (0)
CHECK_CTX(errors_hostkey_absent);
CHECK_CTX(errors_hostkey_changed);
CHECK_CTX(errors_cantloadkey);
CHECK_CTX(option_cleanup);
CHECK_CTX(pgp_fingerprints);
#undef CHECK_CTX
if (context) {
/* We avoid using malloc, in case we're in a situation where
* it would be awkward to do so. */
char cmd[WINHELP_CTX_MAXLEN+10];
sprintf(cmd, "JI(`',`%.*s')", WINHELP_CTX_MAXLEN, context);
WinHelp(hwnd, help_path, HELP_COMMAND, (DWORD)cmd);
requested_help = TRUE;
}
}
if (context)
launch_help(hwnd, context);
}
int message_box(LPCTSTR text, LPCTSTR caption, DWORD style, DWORD helpctxid)
@ -136,7 +128,7 @@ int message_box(LPCTSTR text, LPCTSTR caption, DWORD style, DWORD helpctxid)
mbox.lpszCaption = caption;
mbox.dwContextHelpId = helpctxid;
mbox.dwStyle = style;
if (helpctxid != 0 && help_path) mbox.dwStyle |= MB_HELP;
if (helpctxid != 0 && has_help()) mbox.dwStyle |= MB_HELP;
return MessageBoxIndirect(&mbox);
}