void structManual :: v_draw () { ManPages manPages = (ManPages) our data; ManPage page; ManPage_Paragraph paragraph; #if motif Graphics_clearWs (our graphics.get()); #endif if (our path == SEARCH_PAGE) { HyperPage_pageTitle (this, U"Best matches"); HyperPage_intro (this, U"The best matches to your query seem to be:"); for (int i = 1; i <= our numberOfMatches; i ++) { char32 link [300]; page = manPages -> pages.at [matches [i]]; Melder_sprint (link,300, U"• @@", page -> title); HyperPage_listItem (this, link); } return; } page = manPages -> pages.at [path]; if (! our paragraphs) return; HyperPage_pageTitle (this, page -> title); for (paragraph = & page -> paragraphs [0]; paragraph -> type != 0; paragraph ++) { switch (paragraph -> type) { case kManPage_type_INTRO: HyperPage_intro (this, paragraph -> text); break; case kManPage_type_ENTRY: HyperPage_entry (this, paragraph -> text); break; case kManPage_type_NORMAL: HyperPage_paragraph (this, paragraph -> text); break; case kManPage_type_LIST_ITEM: HyperPage_listItem (this, paragraph -> text); break; case kManPage_type_TAG: HyperPage_listTag (this, paragraph -> text); break; case kManPage_type_DEFINITION: HyperPage_definition (this, paragraph -> text); break; case kManPage_type_CODE: HyperPage_code (this, paragraph -> text); break; case kManPage_type_PROTOTYPE: HyperPage_prototype (this, paragraph -> text); break; case kManPage_type_FORMULA: HyperPage_formula (this, paragraph -> text); break; case kManPage_type_PICTURE: HyperPage_picture (this, paragraph -> width, paragraph -> height, paragraph -> draw); break; case kManPage_type_SCRIPT: HyperPage_script (this, paragraph -> width, paragraph -> height, paragraph -> text); break; case kManPage_type_LIST_ITEM1: HyperPage_listItem1 (this, paragraph -> text); break; case kManPage_type_LIST_ITEM2: HyperPage_listItem2 (this, paragraph -> text); break; case kManPage_type_LIST_ITEM3: HyperPage_listItem3 (this, paragraph -> text); break; case kManPage_type_TAG1: HyperPage_listTag1 (this, paragraph -> text); break; case kManPage_type_TAG2: HyperPage_listTag2 (this, paragraph -> text); break; case kManPage_type_TAG3: HyperPage_listTag3 (this, paragraph -> text); break; case kManPage_type_DEFINITION1: HyperPage_definition1 (this, paragraph -> text); break; case kManPage_type_DEFINITION2: HyperPage_definition2 (this, paragraph -> text); break; case kManPage_type_DEFINITION3: HyperPage_definition3 (this, paragraph -> text); break; case kManPage_type_CODE1: HyperPage_code1 (this, paragraph -> text); break; case kManPage_type_CODE2: HyperPage_code2 (this, paragraph -> text); break; case kManPage_type_CODE3: HyperPage_code3 (this, paragraph -> text); break; case kManPage_type_CODE4: HyperPage_code4 (this, paragraph -> text); break; case kManPage_type_CODE5: HyperPage_code5 (this, paragraph -> text); break; default: break; } } if (ManPages_uniqueLinksHither (manPages, our path)) { long ilink, jlink, lastParagraph = 0; bool goAhead = true; while (page -> paragraphs [lastParagraph]. type != 0) lastParagraph ++; if (lastParagraph > 0) { const char32 *text = page -> paragraphs [lastParagraph - 1]. text; if (! text || text [0] == U'\0' || text [str32len (text) - 1] != U':') { if (our printing && our suppressLinksHither) goAhead = false; else HyperPage_entry (this, U"Links to this page"); } } if (goAhead) for (ilink = 1; ilink <= page -> nlinksHither; ilink ++) { long link = page -> linksHither [ilink]; bool alreadyShown = false; for (jlink = 1; jlink <= page -> nlinksThither; jlink ++) if (page -> linksThither [jlink] == link) alreadyShown = true; if (! alreadyShown) { const char32 *title = manPages -> pages.at [page -> linksHither [ilink]] -> title; char32 linkText [304]; Melder_sprint (linkText, 304, U"@@", title, U"@"); HyperPage_listItem (this, linkText); } } } if (! our printing && page -> date) { char32 signature [100]; long date = page -> date; int imonth = date % 10000 / 100; if (imonth < 0 || imonth > 12) imonth = 0; Melder_sprint (signature,100, U"© ", str32equ (page -> author, U"ppgb") ? U"Paul Boersma" : str32equ (page -> author, U"djmw") ? U"David Weenink" : page -> author, U", ", date % 100, U" ", month [imonth], U" ", date / 10000); HyperPage_any (this, U"", our p_font, our p_fontSize, 0, 0.0, 0.0, 0.0, 0.1, 0.1, HyperPage_ADD_BORDER); HyperPage_any (this, signature, our p_font, our p_fontSize, Graphics_ITALIC, 0.0, 0.03, 0.0, 0.1, 0.0, 0); } }
void structManual :: v_draw () { ManPages manPages = (ManPages) data; ManPage page; ManPage_Paragraph paragraph; #if motif Graphics_clearWs (g); #endif if (path == SEARCH_PAGE) { HyperPage_pageTitle (this, L"Best matches"); HyperPage_intro (this, L"The best matches to your query seem to be:"); for (int i = 1; i <= numberOfMatches; i ++) { wchar link [300]; page = (ManPage) manPages -> pages -> item [matches [i]]; swprintf (link, 300, L"\\bu @@%ls", page -> title); HyperPage_listItem (this, link); } return; } page = (ManPage) manPages -> pages -> item [path]; if (! paragraphs) return; HyperPage_pageTitle (this, page -> title); for (paragraph = & page -> paragraphs [0]; paragraph -> type != 0; paragraph ++) { switch (paragraph -> type) { case kManPage_type_INTRO: HyperPage_intro (this, paragraph -> text); break; case kManPage_type_ENTRY: HyperPage_entry (this, paragraph -> text); break; case kManPage_type_NORMAL: HyperPage_paragraph (this, paragraph -> text); break; case kManPage_type_LIST_ITEM: HyperPage_listItem (this, paragraph -> text); break; case kManPage_type_TAG: HyperPage_listTag (this, paragraph -> text); break; case kManPage_type_DEFINITION: HyperPage_definition (this, paragraph -> text); break; case kManPage_type_CODE: HyperPage_code (this, paragraph -> text); break; case kManPage_type_PROTOTYPE: HyperPage_prototype (this, paragraph -> text); break; case kManPage_type_FORMULA: HyperPage_formula (this, paragraph -> text); break; case kManPage_type_PICTURE: HyperPage_picture (this, paragraph -> width, paragraph -> height, paragraph -> draw); break; case kManPage_type_SCRIPT: HyperPage_script (this, paragraph -> width, paragraph -> height, paragraph -> text); break; case kManPage_type_LIST_ITEM1: HyperPage_listItem1 (this, paragraph -> text); break; case kManPage_type_LIST_ITEM2: HyperPage_listItem2 (this, paragraph -> text); break; case kManPage_type_LIST_ITEM3: HyperPage_listItem3 (this, paragraph -> text); break; case kManPage_type_TAG1: HyperPage_listTag1 (this, paragraph -> text); break; case kManPage_type_TAG2: HyperPage_listTag2 (this, paragraph -> text); break; case kManPage_type_TAG3: HyperPage_listTag3 (this, paragraph -> text); break; case kManPage_type_DEFINITION1: HyperPage_definition1 (this, paragraph -> text); break; case kManPage_type_DEFINITION2: HyperPage_definition2 (this, paragraph -> text); break; case kManPage_type_DEFINITION3: HyperPage_definition3 (this, paragraph -> text); break; case kManPage_type_CODE1: HyperPage_code1 (this, paragraph -> text); break; case kManPage_type_CODE2: HyperPage_code2 (this, paragraph -> text); break; case kManPage_type_CODE3: HyperPage_code3 (this, paragraph -> text); break; case kManPage_type_CODE4: HyperPage_code4 (this, paragraph -> text); break; case kManPage_type_CODE5: HyperPage_code5 (this, paragraph -> text); break; default: break; } } if (ManPages_uniqueLinksHither (manPages, path)) { long ilink, jlink, lastParagraph = 0; int goAhead = TRUE; while (page -> paragraphs [lastParagraph]. type != 0) lastParagraph ++; if (lastParagraph > 0) { const wchar *text = page -> paragraphs [lastParagraph - 1]. text; if (text == NULL || text [0] == '\0' || text [wcslen (text) - 1] != ':') { if (printing && suppressLinksHither) goAhead = FALSE; else HyperPage_entry (this, L"Links to this page"); } } if (goAhead) for (ilink = 1; ilink <= page -> nlinksHither; ilink ++) { long link = page -> linksHither [ilink]; int alreadyShown = FALSE; for (jlink = 1; jlink <= page -> nlinksThither; jlink ++) if (page -> linksThither [jlink] == link) alreadyShown = TRUE; if (! alreadyShown) { const wchar *title = ((ManPage) manPages -> pages -> item [page -> linksHither [ilink]]) -> title; wchar linkText [304]; swprintf (linkText, 304, L"@@%ls@", title); HyperPage_listItem (this, linkText); } } } if (! printing && page -> date) { wchar signature [100]; long date = page -> date; int imonth = date % 10000 / 100; if (imonth < 0 || imonth > 12) imonth = 0; swprintf (signature, 100, L"\\co %ls, %ld %ls %ld", wcsequ (page -> author, L"ppgb") ? L"Paul Boersma" : wcsequ (page -> author, L"djmw") ? L"David Weenink" : page -> author, date % 100, month [imonth], date / 10000); HyperPage_any (this, L"", font, fontSize, 0, 0.0, 0.0, 0.0, 0.1, 0.1, HyperPage_ADD_BORDER); HyperPage_any (this, signature, font, fontSize, Graphics_ITALIC, 0.0, 0.03, 0.0, 0.1, 0.0, 0); } }