summaryrefslogtreecommitdiff
path: root/bk_whlp.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2001-12-06 12:59:37 +0000
committerSimon Tatham <anakin@pobox.com>2001-12-06 12:59:37 +0000
commite695cb0dd19d1cbce0c49a71a913527a227a9e09 (patch)
treef83651dcbaed2607c9ff293d542f7e4e7da0b161 /bk_whlp.c
parentd098f79c9b7dd52c534fed83bb1eb6a3080a03af (diff)
downloadhalibut-e695cb0dd19d1cbce0c49a71a913527a227a9e09.zip
halibut-e695cb0dd19d1cbce0c49a71a913527a227a9e09.tar.gz
halibut-e695cb0dd19d1cbce0c49a71a913527a227a9e09.tar.bz2
halibut-e695cb0dd19d1cbce0c49a71a913527a227a9e09.tar.xz
Allow the user to specify the Help topic ID string for particular
sections. Useful if another program needs to jump to a particular topic. (Really we should support the proper CTXOMAP / HELP_WM_HELP system for doing this, but I don't like numeric IDs; you'd have to parse a bunch of #defines in order to sensibly synchronise the IDs between help file and code.) [originally from svn r1457]
Diffstat (limited to 'bk_whlp.c')
-rw-r--r--bk_whlp.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/bk_whlp.c b/bk_whlp.c
index cf4757d..c5ebdb9 100644
--- a/bk_whlp.c
+++ b/bk_whlp.c
@@ -82,6 +82,23 @@ void whlp_backend(paragraph *sourceform, keywordlist *keywords,
WHLP_FONT_STRIKEOUT, 0, 0, 0);
/*
+ * Loop over the source form finding out whether the user has
+ * specified particular help topic names for anything.
+ */
+ for (p = sourceform; p; p = p->next) {
+ p->private_data = NULL;
+ if (p->type == para_Config && p->parent) {
+ if (!ustricmp(p->keyword, L"winhelp-topic")) {
+ char *topicname;
+ whlp_convert(uadv(p->keyword), &topicname, 0);
+ /* Store the topic name in the private_data field of the
+ * containing section. */
+ p->parent->private_data = topicname;
+ }
+ }
+ }
+
+ /*
* Loop over the source form registering WHLP_TOPICs for
* everything.
*/
@@ -94,7 +111,15 @@ void whlp_backend(paragraph *sourceform, keywordlist *keywords,
p->type == para_UnnumberedChapter ||
p->type == para_Heading ||
p->type == para_Subsect) {
- p->private_data = whlp_register_topic(h, NULL, NULL);
+ char *topicid = p->private_data;
+ char *errstr;
+
+ p->private_data = whlp_register_topic(h, topicid, &errstr);
+ if (!p->private_data) {
+ p->private_data = whlp_register_topic(h, NULL, NULL);
+ error(err_winhelp_ctxclash, &p->fpos, topicid, errstr);
+ }
+ sfree(topicid);
}
}