From 718b900b0704f97f3449a75a5d3060ab9d42cb33 Mon Sep 17 00:00:00 2001 From: Roland Heyder Date: Wed, 19 Jun 2024 14:58:29 +0200 Subject: [PATCH 1/4] IDE Help extension - added further pages to the core pages queue - added handling for new {{PageReferences}} wiki template - added more name substitutes for the breadcrumb links --- source/ide/ide_methods.bas | 11 ++++++++++- source/ide/wiki/wiki_methods.bas | 31 ++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 13c100b33..b7ef2e0b6 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -2559,7 +2559,8 @@ FUNCTION ide2 (ignore) oldlnk = lnk LOOP - IF Back_Name$(Help_Back_Pos) = "Alphabetical" OR Back_Name$(Help_Back_Pos) = "By Usage" THEN + '!!! RS:HCWD:#1 !!! (abbrev. page titles) + IF Back_Name$(Help_Back_Pos) = "KWs Alphab." OR Back_Name$(Help_Back_Pos) = "KWs by Usage" THEN IF lnkx1 > 3 THEN cx = px + 1 GOTO helpscanrow @@ -19008,12 +19009,20 @@ FUNCTION ideupdatehelpbox IF INSTR(f$, CHR$(0) + PageName2$ + CHR$(0)) = 0 THEN f$ = CHR$(0) + PageName2$ + f$ PageName2$ = "QB64_Help_Menu.txt" IF INSTR(f$, CHR$(0) + PageName2$ + CHR$(0)) = 0 THEN f$ = CHR$(0) + PageName2$ + f$ + PageName2$ = "Data_types.txt" + IF INSTR(f$, CHR$(0) + PageName2$ + CHR$(0)) = 0 THEN f$ = CHR$(0) + PageName2$ + f$ + PageName2$ = "Variable_Types.txt" + IF INSTR(f$, CHR$(0) + PageName2$ + CHR$(0)) = 0 THEN f$ = CHR$(0) + PageName2$ + f$ PageName2$ = "ERROR_Codes.txt" IF INSTR(f$, CHR$(0) + PageName2$ + CHR$(0)) = 0 THEN f$ = CHR$(0) + PageName2$ + f$ + PageName2$ = "Quick_Reference_-_Tables.txt" + IF INSTR(f$, CHR$(0) + PageName2$ + CHR$(0)) = 0 THEN f$ = CHR$(0) + PageName2$ + f$ PageName2$ = "Keywords_currently_not_supported_by_QB64.txt" IF INSTR(f$, CHR$(0) + PageName2$ + CHR$(0)) = 0 THEN f$ = CHR$(0) + PageName2$ + f$ PageName2$ = "Keyword_Reference_-_By_usage.txt" IF INSTR(f$, CHR$(0) + PageName2$ + CHR$(0)) = 0 THEN f$ = CHR$(0) + PageName2$ + f$ + PageName2$ = "Metacommand.txt" + IF INSTR(f$, CHR$(0) + PageName2$ + CHR$(0)) = 0 THEN f$ = CHR$(0) + PageName2$ + f$ et# = TIMER(0.001) - st#: IF et# < 0 THEN et# = et# + 86400 IF 1.25 - et# > 0 THEN _DELAY 1.25 - et# UpdateStep = UpdateStep + 1 diff --git a/source/ide/wiki/wiki_methods.bas b/source/ide/wiki/wiki_methods.bas index 1a47d2b33..dd30739e2 100644 --- a/source/ide/wiki/wiki_methods.bas +++ b/source/ide/wiki/wiki_methods.bas @@ -1,10 +1,27 @@ FUNCTION Back2BackName$ (a$) - IF a$ = "Keyword Reference - Alphabetical" THEN Back2BackName$ = "Alphabetical": EXIT FUNCTION - IF a$ = "Keyword Reference - By usage" THEN Back2BackName$ = "By Usage": EXIT FUNCTION - IF a$ = "Keywords currently not supported by QB64" THEN Back2BackName$ = "Unsupported": EXIT FUNCTION - IF a$ = "QB64 Help Menu" THEN Back2BackName$ = "Help": EXIT FUNCTION - IF a$ = "QB64 FAQ" THEN Back2BackName$ = "FAQ": EXIT FUNCTION - Back2BackName$ = a$ + SELECT CASE a$ + CASE "Base Comparisons": Back2BackName$ = "Base Compare" + CASE "Bitwise Operators": Back2BackName$ = "Bitwise OPs" + CASE "Downloading Files": Back2BackName$ = "Downloads" + CASE "Function (explanatory)": Back2BackName$ = "FUNC expl." + CASE "Greater Than Or Equal": Back2BackName$ = "Greater|Equal" + CASE "Keyboard scancodes": Back2BackName$ = "KB Scancodes" + CASE "Keyword Reference - Alphabetical": Back2BackName$ = "KWs Alphab." 'scan sources for + CASE "Keyword Reference - By usage": Back2BackName$ = "KWs by Usage" ' '!!! RS:HCWD:#1 !!! + CASE "Keywords currently not supported by QB64": Back2BackName$ = "Unsupp. KWs" + CASE "Less Than Or Equal": Back2BackName$ = "Less|Equal" + CASE "Mathematical Operations": Back2BackName$ = "Math OPs" + CASE "QB64 Help Menu": Back2BackName$ = "QB64 Help" + CASE "Quick Reference - Tables": Back2BackName$ = "QRef. Tables" + CASE "Relational Operations": Back2BackName$ = "Relational OPs" + CASE "Scientific notation": Back2BackName$ = "Sci. Notation" + CASE "Sub (explanatory)": Back2BackName$ = "SUB expl." + CASE "Windows Environment": Back2BackName$ = "Win Env." + CASE "Windows Libraries": Back2BackName$ = "Win Lib." + CASE "Windows Printer Settings": Back2BackName$ = "Win Print" + CASE "Windows Registry Access": Back2BackName$ = "Win Reg." + CASE ELSE: Back2BackName$ = a$ + END SELECT END FUNCTION FUNCTION Wiki$ (PageName$) 'Read cached wiki page (download, if not yet cached) @@ -703,7 +720,7 @@ SUB WikiParse (a$) 'Wiki page interpret END IF 'Template wrapped plugin - IF (cb$ = "PageNavigation" OR RIGHT$(cb$, 6) = "Plugin") AND Help_LockParse = 0 THEN 'no plugins in blocks + IF (cb$ = "PageNavigation" OR cb$ = "PageReferences" OR RIGHT$(cb$, 6) = "Plugin") AND Help_LockParse = 0 THEN 'no plugins in blocks pit$ = Wiki$("Template:" + cb$) IF INSTR(pit$, "{{PageInternalError}}") = 0 THEN a$ = LEFT$(a$, i) + pit$ + RIGHT$(a$, LEN(a$) - i) From c92a050116a38602aa7cad68b39b7d712634787b Mon Sep 17 00:00:00 2001 From: Roland Heyder Date: Wed, 19 Jun 2024 15:11:30 +0200 Subject: [PATCH 2/4] IDE Help Menu revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - added ´Metacommands´ and ´Variable Types´ items for direct access to the respective wiki pages - reworded the item desciptions --- source/ide/ide_methods.bas | 50 ++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index b7ef2e0b6..4c648d89c 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -479,20 +479,24 @@ FUNCTION ide2 (ignore) m = m + 1: i = 0 menu$(m, i) = "Help": i = i + 1 menu$(m, i) = "#View Shift+F1": i = i + 1 - menuDesc$(m, i - 1) = "Displays help window" + menuDesc$(m, i - 1) = "Opens the help window with last viewed article" menu$(m, i) = "#Contents Page": i = i + 1 - menuDesc$(m, i - 1) = "Displays help contents page" - menu$(m, i) = "Keyword #Index": i = i + 1 - menuDesc$(m, i - 1) = "Displays keyword index page" + menuDesc$(m, i - 1) = "Displays the help contents page" + menu$(m, i) = "Keywords #Index": i = i + 1 + menuDesc$(m, i - 1) = "Displays the keywords index page (sorted alphabetically)" menu$(m, i) = "#Keywords by Usage": i = i + 1 - menuDesc$(m, i - 1) = "Displays keywords index by usage" + menuDesc$(m, i - 1) = "Displays the keywords index page (sorted by usage)" + menu$(m, i) = "#Metacommands": i = i + 1 + menuDesc$(m, i - 1) = "Displays the metacommands overview page" + menu$(m, i) = "Variable #Types": i = i + 1 + menuDesc$(m, i - 1) = "Displays the variable types overview page" menu$(m, i) = "-": i = i + 1 menu$(m, i) = "#Update Current Page": i = i + 1 - menuDesc$(m, i - 1) = "Downloads the latest version of an article from the wiki" + menuDesc$(m, i - 1) = "Downloads the latest version of the current article from the Wiki" menu$(m, i) = "Update All #Pages...": i = i + 1 - menuDesc$(m, i - 1) = "Downloads the latest version of all articles from the wiki" + menuDesc$(m, i - 1) = "Downloads the latest version of all articles from the Wiki" menu$(m, i) = "View Current Page On #Wiki": i = i + 1 - menuDesc$(m, i - 1) = "Launches the default browser and navigates to the current article on the wiki" + menuDesc$(m, i - 1) = "Opens the current article on the Wiki using your standard browser" menu$(m, i) = "-": i = i + 1 'menu$(m, i) = "Check for #Newer Version...": i = i + 1 'menuDesc$(m, i - 1) = "Displays the current version of QB64-PE" @@ -5444,7 +5448,7 @@ FUNCTION ide2 (ignore) lnk$ = "QB64 Help Menu" GOTO OpenHelpLink END IF - IF menu$(m, s) = "Keyword #Index" THEN + IF menu$(m, s) = "Keywords #Index" THEN PCOPY 3, 0: SCREEN , , 3, 0 lnk$ = "Keyword Reference - Alphabetical" GOTO OpenHelpLink @@ -5454,6 +5458,16 @@ FUNCTION ide2 (ignore) lnk$ = "Keyword Reference - By usage" GOTO OpenHelpLink END IF + IF menu$(m, s) = "#Metacommands" THEN + PCOPY 3, 0: SCREEN , , 3, 0 + lnk$ = "Metacommand" + GOTO OpenHelpLink + END IF + IF menu$(m, s) = "Variable #Types" THEN + PCOPY 3, 0: SCREEN , , 3, 0 + lnk$ = "Variable Types" + GOTO OpenHelpLink + END IF IF menu$(m, s) = "#View Shift+F1" THEN @@ -18629,18 +18643,22 @@ SUB IdeMakeContextualMenu menuDesc$(m, i - 1) = "Selects all contents of current article" menu$(m, i) = "-": i = i + 1 menu$(m, i) = "#Contents Page": i = i + 1 - menuDesc$(m, i - 1) = "Displays help contents page" - menu$(m, i) = "Keyword #Index": i = i + 1 - menuDesc$(m, i - 1) = "Displays keyword index page" + menuDesc$(m, i - 1) = "Displays the help contents page" + menu$(m, i) = "Keywords #Index": i = i + 1 + menuDesc$(m, i - 1) = "Displays the keywords index page (sorted alphabetically)" menu$(m, i) = "#Keywords by Usage": i = i + 1 - menuDesc$(m, i - 1) = "Displays keywords index by usage" + menuDesc$(m, i - 1) = "Displays the keywords index page (sorted by usage)" + menu$(m, i) = "#Metacommands": i = i + 1 + menuDesc$(m, i - 1) = "Displays the metacommands overview page" + menu$(m, i) = "Variable #Types": i = i + 1 + menuDesc$(m, i - 1) = "Displays the variable types overview page" menu$(m, i) = "-": i = i + 1 menu$(m, i) = "#Update Current Page": i = i + 1 - menuDesc$(m, i - 1) = "Downloads the latest version of this article from the wiki" + menuDesc$(m, i - 1) = "Downloads the latest version of the current article from the Wiki" menu$(m, i) = "Update All #Pages...": i = i + 1 - menuDesc$(m, i - 1) = "Downloads the latest version of all articles from the wiki" + menuDesc$(m, i - 1) = "Downloads the latest version of all articles from the Wiki" menu$(m, i) = "View Current Page On #Wiki": i = i + 1 - menuDesc$(m, i - 1) = "Launches the default browser and navigates to the current article on the wiki" + menuDesc$(m, i - 1) = "Opens the current article on the Wiki using your standard browser" menu$(m, i) = "-": i = i + 1 menu$(m, i) = "Clo#se Help ESC": i = i + 1 menuDesc$(m, i - 1) = "Closes help window" From ef3b235d95f25b7ad8bdfc6cc7be32d1de4aaa2d Mon Sep 17 00:00:00 2001 From: Roland Heyder Date: Wed, 19 Jun 2024 15:27:19 +0200 Subject: [PATCH 3/4] Improved blank line logic - an explicit blank line check now cancels any pending request for an implicit one - avoid blank lines between multiple successive horizontal rulers --- source/ide/wiki/wiki_methods.bas | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/ide/wiki/wiki_methods.bas b/source/ide/wiki/wiki_methods.bas index dd30739e2..d3150d5d9 100644 --- a/source/ide/wiki/wiki_methods.bas +++ b/source/ide/wiki/wiki_methods.bas @@ -134,7 +134,7 @@ END FUNCTION SUB Help_AddTxt (t$, col, link) 'Add help text, handle word wrap IF t$ = "" THEN EXIT SUB - IF Help_ChkBlank <> 0 THEN Help_CheckBlankLine: Help_ChkBlank = 0 + IF Help_ChkBlank <> 0 THEN Help_CheckBlankLine FOR i = 1 TO LEN(t$) c = ASC(t$, i) @@ -227,6 +227,7 @@ SUB Help_CheckBlankLine 'Make sure the last help line is a blank line (implies f IF ASC(Help_Txt$, Help_Txt_Len - 2) < 128 THEN Help_NewLine IF ASC(Help_Txt$, Help_Txt_Len - 6) < 128 THEN Help_NewLine END IF + Help_ChkBlank = 0 END SUB SUB Help_CheckRemoveBlankLine 'If the last help line is blank, then remove it @@ -802,17 +803,17 @@ SUB WikiParse (a$) 'Wiki page interpret 'Rulers IF c$(4) = "----" AND nl = 1 THEN i = i + 3 - Help_CheckBlankLine + IF Help_ChkBlank = -1 THEN Help_ChkBlank = 0: ELSE Help_CheckBlankLine Help_AddTxt STRING$(Help_ww, 196), 14, 0 - Help_ChkBlank = 1 + Help_ChkBlank = -1 GOTO charDone END IF IF c$(4) = "
" OR c$(6) = "
" THEN IF c$(4) = "
" THEN i = i + 3 IF c$(6) = "
" THEN i = i + 5 - Help_CheckBlankLine + IF Help_ChkBlank = -1 THEN Help_ChkBlank = 0: ELSE Help_CheckBlankLine Help_AddTxt STRING$(Help_ww, 196), 14, 0 - Help_ChkBlank = 1 + Help_ChkBlank = -1 GOTO charDone END IF END IF From 59d8777689f5376b87fdb8543eaa598968e48db5 Mon Sep 17 00:00:00 2001 From: Roland Heyder Date: Wed, 19 Jun 2024 15:43:16 +0200 Subject: [PATCH 4/4] Longstanding bugs fixed - Select All (CTRL-A) in the help text actually didn't select ALL after text was selected manually once before, because Help_cx1/_cy1 were not reset (bug goes back to the SDL versions) - help text width is a known value, no need to set millions of chars - fixed Definition lists eating the first char, if list introducer is followed by space --- source/ide/ide_methods.bas | 5 +++-- source/ide/wiki/wiki_methods.bas | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index 4c648d89c..bd689105f 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -2426,8 +2426,9 @@ FUNCTION ide2 (ignore) Help_Select = 2 Help_SelX1 = 1 Help_SelY1 = 1 - Help_SelX2 = 10000000 + Help_SelX2 = help_w Help_SelY2 = help_h + Help_cx1 = 1: Help_cy1 = 1 Help_cx = 1: Help_cy = help_h + 1 GOTO keep_select END IF @@ -2781,7 +2782,7 @@ FUNCTION ide2 (ignore) Help_SelX1 = Help_cx: Help_SelX2 = Help_cx1 - 1 END IF ELSE - Help_SelX1 = 1: Help_SelX2 = 10000000 + Help_SelX1 = 1: Help_SelX2 = help_w IF Help_cy > Help_cy1 THEN Help_SelY1 = Help_cy1: Help_SelY2 = Help_cy IF Help_cx = 1 THEN Help_SelY2 = Help_cy - 1 diff --git a/source/ide/wiki/wiki_methods.bas b/source/ide/wiki/wiki_methods.bas index d3150d5d9..0314a2c4e 100644 --- a/source/ide/wiki/wiki_methods.bas +++ b/source/ide/wiki/wiki_methods.bas @@ -826,8 +826,8 @@ SUB WikiParse (a$) 'Wiki page interpret IF c$(2) = "; " THEN i = i + 1 IF ah = 0 AND dl = 0 THEN Help_CheckBlankLine Help_Bold = 1: col = Help_Col: Help_DList = 1 - IF c$(3) = ";* " OR c$(3) = ";# " THEN i = i + 2: Help_DList = 3 'list dot belongs to description IF c$(2) = ";*" OR c$(2) = ";#" THEN i = i + 1: Help_DList = 2 'list dot belongs to description + IF c$(3) = ";* " OR c$(3) = ";# " THEN i = i + 1: Help_DList = 3 'list dot belongs to description IF dl < 3 THEN Help_AddTxt "Þ ", 11, 0: dl = 1 Help_LIndent$ = Help_LIndent$ + "Þ "