mirror of
https://github.com/QB64Official/qb64.git
synced 2024-08-22 11:25:08 +00:00
Extends idemessagebox to take any number of buttons. Also:
Adds welcome message with instructions to whitelist QB64 in antivirus/antimalware software.
This commit is contained in:
parent
cf7ed33f61
commit
5ac2f6291c
2 changed files with 61 additions and 28 deletions
|
@ -15,6 +15,7 @@ DIM SHARED IDEShowErrorsImmediately AS _BYTE
|
||||||
DIM SHARED ShowLineNumbersSeparator AS _BYTE, ShowLineNumbersUseBG AS _BYTE
|
DIM SHARED ShowLineNumbersSeparator AS _BYTE, ShowLineNumbersUseBG AS _BYTE
|
||||||
DIM SHARED IgnoreWarnings AS _BYTE, qb64versionprinted AS _BYTE
|
DIM SHARED IgnoreWarnings AS _BYTE, qb64versionprinted AS _BYTE
|
||||||
DIM SHARED DisableSyntaxHighlighter AS _BYTE, ExeToSourceFolderFirstTimeMsg AS _BYTE
|
DIM SHARED DisableSyntaxHighlighter AS _BYTE, ExeToSourceFolderFirstTimeMsg AS _BYTE
|
||||||
|
DIM SHARED WhiteListQB64FirstTimeMsg AS _BYTE
|
||||||
|
|
||||||
IF LoadedIDESettings = 0 THEN
|
IF LoadedIDESettings = 0 THEN
|
||||||
'We only want to load the file once when QB64 first starts
|
'We only want to load the file once when QB64 first starts
|
||||||
|
@ -190,6 +191,19 @@ IF LoadedIDESettings = 0 THEN
|
||||||
ExeToSourceFolderFirstTimeMsg = 0
|
ExeToSourceFolderFirstTimeMsg = 0
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
result = ReadConfigSetting("WhiteListQB64FirstTimeMsg", value$)
|
||||||
|
IF result THEN
|
||||||
|
IF value$ = "TRUE" OR VAL(value$) = -1 THEN
|
||||||
|
WhiteListQB64FirstTimeMsg = -1
|
||||||
|
ELSE
|
||||||
|
WhiteListQB64FirstTimeMsg = 0
|
||||||
|
WriteConfigSetting "'[GENERAL SETTINGS]", "WhiteListQB64FirstTimeMsg", "FALSE"
|
||||||
|
END IF
|
||||||
|
ELSE
|
||||||
|
WriteConfigSetting "'[GENERAL SETTINGS]", "WhiteListQB64FirstTimeMsg", "FALSE"
|
||||||
|
WhiteListQB64FirstTimeMsg = 0
|
||||||
|
END IF
|
||||||
|
|
||||||
result = ReadConfigSetting("SaveExeWithSource", value$)
|
result = ReadConfigSetting("SaveExeWithSource", value$)
|
||||||
IF result THEN
|
IF result THEN
|
||||||
IF value$ = "TRUE" OR VAL(value$) = -1 THEN
|
IF value$ = "TRUE" OR VAL(value$) = -1 THEN
|
||||||
|
|
|
@ -173,7 +173,7 @@ FUNCTION ide2 (ignore)
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
PCOPY 3, 0
|
PCOPY 3, 0
|
||||||
idemessagebox ideerrormessageTITLE$, errorat$
|
result = idemessagebox(ideerrormessageTITLE$, errorat$, "")
|
||||||
errorReportDone:
|
errorReportDone:
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
|
@ -1037,6 +1037,20 @@ FUNCTION ide2 (ignore)
|
||||||
|
|
||||||
END IF 'skipdisplay
|
END IF 'skipdisplay
|
||||||
|
|
||||||
|
IF WhiteListQB64FirstTimeMsg = 0 THEN
|
||||||
|
result = idemessagebox("Welcome to QB64", "QB64 is an independent compiler and as such both 'qb64" + extension$ + "'" + CHR$(10) + _
|
||||||
|
"and the programs you create with it may eventually be flagged" + CHR$(10) + _
|
||||||
|
"as false positives by your antivirus/antimalware software." + CHR$(10) + CHR$(10) + _
|
||||||
|
"It is advisable to whitelist your whole QB64 folder to avoid" + CHR$(10) + _
|
||||||
|
"operation errors.", "OK;Don't show this again")
|
||||||
|
|
||||||
|
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
||||||
|
IF result = 2 THEN
|
||||||
|
WriteConfigSetting "'[GENERAL SETTINGS]", "WhiteListQB64FirstTimeMsg", "TRUE"
|
||||||
|
END IF
|
||||||
|
WhiteListQB64FirstTimeMsg = -1
|
||||||
|
END IF
|
||||||
|
|
||||||
STATIC idechangedbefore AS _BYTE
|
STATIC idechangedbefore AS _BYTE
|
||||||
IF idechangemade THEN
|
IF idechangemade THEN
|
||||||
|
|
||||||
|
@ -1463,17 +1477,19 @@ FUNCTION ide2 (ignore)
|
||||||
|
|
||||||
IF ExeToSourceFolderFirstTimeMsg = 0 THEN
|
IF ExeToSourceFolderFirstTimeMsg = 0 THEN
|
||||||
IF SaveExeWithSource THEN
|
IF SaveExeWithSource THEN
|
||||||
idemessagebox "Run", "Your program will be compiled to the same folder where your" + CHR$(10) + _
|
result = idemessagebox("Run", "Your program will be compiled to the same folder where your" + CHR$(10) + _
|
||||||
"source code is saved. You can change that by unchecking the" + CHR$(10) + _
|
"source code is saved. You can change that by unchecking the" + CHR$(10) + _
|
||||||
"option 'Output EXE to Source Folder' in the Run menu."
|
"option 'Output EXE to Source Folder' in the Run menu.", "OK;Don't show this again")
|
||||||
ELSE
|
ELSE
|
||||||
idemessagebox "Run", "Your program will be compiled to your QB64 folder. You can" + CHR$(10) + _
|
result = idemessagebox("Run", "Your program will be compiled to your QB64 folder. You can" + CHR$(10) + _
|
||||||
"change that by checking the option 'Output EXE to Source" + CHR$(10) + _
|
"change that by checking the option 'Output EXE to Source" + CHR$(10) + _
|
||||||
"Folder' in the Run menu."
|
"Folder' in the Run menu.", "OK;Don't show this again")
|
||||||
END IF
|
END IF
|
||||||
|
IF result = 2 THEN
|
||||||
WriteConfigSetting "'[GENERAL SETTINGS]", "ExeToSourceFolderFirstTimeMsg", "TRUE"
|
WriteConfigSetting "'[GENERAL SETTINGS]", "ExeToSourceFolderFirstTimeMsg", "TRUE"
|
||||||
ExeToSourceFolderFirstTimeMsg = -1
|
ExeToSourceFolderFirstTimeMsg = -1
|
||||||
END IF
|
END IF
|
||||||
|
END IF
|
||||||
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
||||||
|
|
||||||
'run program
|
'run program
|
||||||
|
@ -2655,7 +2671,7 @@ FUNCTION ide2 (ignore)
|
||||||
|
|
||||||
IF KALT AND (KB = KEY_DOWN OR KB = KEY_UP) THEN
|
IF KALT AND (KB = KEY_DOWN OR KB = KEY_UP) THEN
|
||||||
IF IdeBmkN = 0 THEN
|
IF IdeBmkN = 0 THEN
|
||||||
idemessagebox "Bookmarks", "No bookmarks exist (Use Alt+Left to create a bookmark)"
|
result = idemessagebox("Bookmarks", "No bookmarks exist (Use Alt+Left to create a bookmark)", "")
|
||||||
SCREEN , , 3, 0: idewait4mous: idewait4alt
|
SCREEN , , 3, 0: idewait4mous: idewait4alt
|
||||||
idealthighlight = 0
|
idealthighlight = 0
|
||||||
LOCATE , , 0: COLOR 0, 7: LOCATE 1, 1: PRINT menubar$;
|
LOCATE , , 0: COLOR 0, 7: LOCATE 1, 1: PRINT menubar$;
|
||||||
|
@ -2663,7 +2679,7 @@ FUNCTION ide2 (ignore)
|
||||||
END IF
|
END IF
|
||||||
IF IdeBmkN = 1 THEN
|
IF IdeBmkN = 1 THEN
|
||||||
IF idecy = IdeBmk(1).y THEN
|
IF idecy = IdeBmk(1).y THEN
|
||||||
idemessagebox "Bookmarks", "No other bookmarks exist"
|
result = idemessagebox("Bookmarks", "No other bookmarks exist", "")
|
||||||
SCREEN , , 3, 0: idewait4mous: idewait4alt
|
SCREEN , , 3, 0: idewait4mous: idewait4alt
|
||||||
idealthighlight = 0
|
idealthighlight = 0
|
||||||
LOCATE , , 0: COLOR 0, 7: LOCATE 1, 1: PRINT menubar$;
|
LOCATE , , 0: COLOR 0, 7: LOCATE 1, 1: PRINT menubar$;
|
||||||
|
@ -3140,7 +3156,7 @@ FUNCTION ide2 (ignore)
|
||||||
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
||||||
GOTO specialchar
|
GOTO specialchar
|
||||||
ELSE
|
ELSE
|
||||||
idemessagebox "Compilation status", "No warnings to display."
|
result = idemessagebox("Compilation status", "No warnings to display.", "")
|
||||||
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
||||||
GOTO ideloop
|
GOTO ideloop
|
||||||
END IF
|
END IF
|
||||||
|
@ -4862,13 +4878,13 @@ FUNCTION ide2 (ignore)
|
||||||
IF menu$(m, s) = "#Next Bookmark Alt+Down" OR menu$(m, s) = "#Previous Bookmark Alt+Up" THEN
|
IF menu$(m, s) = "#Next Bookmark Alt+Down" OR menu$(m, s) = "#Previous Bookmark Alt+Up" THEN
|
||||||
PCOPY 2, 0
|
PCOPY 2, 0
|
||||||
IF IdeBmkN = 0 THEN
|
IF IdeBmkN = 0 THEN
|
||||||
idemessagebox "Bookmarks", "No bookmarks exist (Use Alt+Left to create a bookmark)"
|
result = idemessagebox("Bookmarks", "No bookmarks exist (Use Alt+Left to create a bookmark)", "")
|
||||||
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
||||||
GOTO ideloop
|
GOTO ideloop
|
||||||
END IF
|
END IF
|
||||||
IF IdeBmkN = 1 THEN
|
IF IdeBmkN = 1 THEN
|
||||||
IF idecy = IdeBmk(1).y THEN
|
IF idecy = IdeBmk(1).y THEN
|
||||||
idemessagebox "Bookmarks", "No other bookmarks exist"
|
result = idemessagebox("Bookmarks", "No other bookmarks exist", "")
|
||||||
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
||||||
GOTO ideloop
|
GOTO ideloop
|
||||||
END IF
|
END IF
|
||||||
|
@ -4916,7 +4932,7 @@ FUNCTION ide2 (ignore)
|
||||||
PCOPY 2, 0
|
PCOPY 2, 0
|
||||||
m$ = "QB64 Version " + Version$ + CHR$(10) + BuildNum$
|
m$ = "QB64 Version " + Version$ + CHR$(10) + BuildNum$
|
||||||
IF LEN(AutoBuildMsg$) THEN m$ = m$ + CHR$(10) + AutoBuildMsg$
|
IF LEN(AutoBuildMsg$) THEN m$ = m$ + CHR$(10) + AutoBuildMsg$
|
||||||
idemessagebox "About", m$
|
result = idemessagebox("About", m$, "")
|
||||||
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt
|
||||||
GOTO ideloop
|
GOTO ideloop
|
||||||
END IF
|
END IF
|
||||||
|
@ -5443,7 +5459,7 @@ FUNCTION ide2 (ignore)
|
||||||
ideshowtext
|
ideshowtext
|
||||||
SCREEN , , 0, 0: LOCATE , , 1: SCREEN , , 3, 0
|
SCREEN , , 0, 0: LOCATE , , 1: SCREEN , , 3, 0
|
||||||
PCOPY 3, 0
|
PCOPY 3, 0
|
||||||
idemessagebox "Search complete", "No changes made."
|
result = idemessagebox("Search complete", "No changes made.", "")
|
||||||
ELSE
|
ELSE
|
||||||
idenomatch
|
idenomatch
|
||||||
END IF
|
END IF
|
||||||
|
@ -6397,7 +6413,7 @@ SUB FindQuoteComment (text$, __cursor AS LONG, c AS _BYTE, q AS _BYTE)
|
||||||
END SUB
|
END SUB
|
||||||
|
|
||||||
SUB idechanged (totalChanges AS LONG)
|
SUB idechanged (totalChanges AS LONG)
|
||||||
idemessagebox "Change Complete", LTRIM$(STR$(totalChanges)) + " substitutions."
|
result = idemessagebox("Change Complete", LTRIM$(STR$(totalChanges)) + " substitutions.", "")
|
||||||
END SUB
|
END SUB
|
||||||
|
|
||||||
FUNCTION idechangeit$
|
FUNCTION idechangeit$
|
||||||
|
@ -7848,7 +7864,7 @@ FUNCTION idenewtxt (a$)
|
||||||
END FUNCTION
|
END FUNCTION
|
||||||
|
|
||||||
SUB idenomatch
|
SUB idenomatch
|
||||||
idemessagebox "Search complete", "Match not found."
|
result = idemessagebox("Search complete", "Match not found.", "")
|
||||||
END SUB
|
END SUB
|
||||||
|
|
||||||
FUNCTION idefiledialog$(programname$, mode AS _BYTE)
|
FUNCTION idefiledialog$(programname$, mode AS _BYTE)
|
||||||
|
@ -8933,7 +8949,7 @@ SUB ideshowtext
|
||||||
|
|
||||||
FOR m = 1 TO LEN(a2$) 'print to the screen while checking required color changes
|
FOR m = 1 TO LEN(a2$) 'print to the screen while checking required color changes
|
||||||
IF timeElapsedSince(startTime) > 1 THEN
|
IF timeElapsedSince(startTime) > 1 THEN
|
||||||
idemessagebox "Syntax Highlighter Disabled", StrReplace$("Syntax Highlighter has been disabled to avoid locking up the IDE.\nThis may have been caused by lines that are too long.\nYou can reenable the Highlighter in the 'Options' menu.", "\n", CHR$(10))
|
result = idemessagebox("Syntax Highlighter Disabled", StrReplace$("Syntax Highlighter has been disabled to avoid locking up the IDE.\nThis may have been caused by lines that are too long.\nYou can reenable the Highlighter in the 'Options' menu.", "\n", CHR$(10)), "")
|
||||||
DisableSyntaxHighlighter = -1
|
DisableSyntaxHighlighter = -1
|
||||||
WriteConfigSetting "'[GENERAL SETTINGS]", "DisableSyntaxHighlighter", "TRUE"
|
WriteConfigSetting "'[GENERAL SETTINGS]", "DisableSyntaxHighlighter", "TRUE"
|
||||||
menu$(OptionsMenuID, OptionsMenuDisableSyntax) = CHR$(7) + "Disable Syntax #Highlighter"
|
menu$(OptionsMenuID, OptionsMenuDisableSyntax) = CHR$(7) + "Disable Syntax #Highlighter"
|
||||||
|
@ -11743,7 +11759,7 @@ END FUNCTION
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SUB idemessagebox (titlestr$, messagestr$)
|
FUNCTION idemessagebox (titlestr$, messagestr$, buttons$)
|
||||||
|
|
||||||
'-------- generic dialog box header --------
|
'-------- generic dialog box header --------
|
||||||
PCOPY 0, 2
|
PCOPY 0, 2
|
||||||
|
@ -11758,7 +11774,7 @@ SUB idemessagebox (titlestr$, messagestr$)
|
||||||
|
|
||||||
'-------- init --------
|
'-------- init --------
|
||||||
MessageLines = 1
|
MessageLines = 1
|
||||||
DIM FullMessage$(1 TO 4)
|
DIM FullMessage$(1 TO 8)
|
||||||
PrevScan = 1
|
PrevScan = 1
|
||||||
DO
|
DO
|
||||||
NextScan = INSTR(NextScan + 1, messagestr$, CHR$(10))
|
NextScan = INSTR(NextScan + 1, messagestr$, CHR$(10))
|
||||||
|
@ -11785,7 +11801,8 @@ SUB idemessagebox (titlestr$, messagestr$)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
o(i).typ = 3
|
o(i).typ = 3
|
||||||
o(i).y = 3 + MessageLines
|
o(i).y = 3 + MessageLines
|
||||||
o(i).txt = idenewtxt("OK")
|
IF buttons$ = "" THEN buttons$ = "OK"
|
||||||
|
o(i).txt = idenewtxt(StrReplace$(buttons$, ";", sep))
|
||||||
o(i).dft = 1
|
o(i).dft = 1
|
||||||
'-------- end of init --------
|
'-------- end of init --------
|
||||||
|
|
||||||
|
@ -11867,13 +11884,15 @@ SUB idemessagebox (titlestr$, messagestr$)
|
||||||
'-------- end of generic input response --------
|
'-------- end of generic input response --------
|
||||||
|
|
||||||
'specific post controls
|
'specific post controls
|
||||||
IF K$ = CHR$(27) OR K$ = CHR$(13) OR (focus = 1 AND info <> 0) THEN EXIT SUB
|
IF K$ = CHR$(27) THEN EXIT FUNCTION
|
||||||
|
|
||||||
|
IF K$ = CHR$(13) OR (info <> 0) THEN idemessagebox = focus: EXIT FUNCTION
|
||||||
'end of custom controls
|
'end of custom controls
|
||||||
|
|
||||||
mousedown = 0
|
mousedown = 0
|
||||||
mouseup = 0
|
mouseup = 0
|
||||||
LOOP
|
LOOP
|
||||||
END SUB
|
END FUNCTION
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -15403,10 +15422,10 @@ FUNCTION BinaryFormatCheck% (pathToCheck$, pathSepToCheck$, fileToCheck$)
|
||||||
|
|
||||||
SELECT CASE Format%
|
SELECT CASE Format%
|
||||||
CASE 2300 'VBDOS
|
CASE 2300 'VBDOS
|
||||||
idemessagebox "Invalid format", "VBDOS binary format not supported."
|
result = idemessagebox("Invalid format", "VBDOS binary format not supported.", "")
|
||||||
BinaryFormatCheck% = 1
|
BinaryFormatCheck% = 1
|
||||||
CASE 764 'QBX 7.1
|
CASE 764 'QBX 7.1
|
||||||
idemessagebox "Invalid format", "QBX 7.1 binary format not supported."
|
result = idemessagebox("Invalid format", "QBX 7.1 binary format not supported.", "")
|
||||||
BinaryFormatCheck% = 1
|
BinaryFormatCheck% = 1
|
||||||
CASE 252 'QuickBASIC 4.5
|
CASE 252 'QuickBASIC 4.5
|
||||||
IF INSTR(_OS$, "WIN") THEN
|
IF INSTR(_OS$, "WIN") THEN
|
||||||
|
@ -15446,7 +15465,7 @@ FUNCTION BinaryFormatCheck% (pathToCheck$, pathSepToCheck$, fileToCheck$)
|
||||||
PCOPY 3, 0
|
PCOPY 3, 0
|
||||||
|
|
||||||
IF _FILEEXISTS(ofile$) = 0 THEN
|
IF _FILEEXISTS(ofile$) = 0 THEN
|
||||||
idemessagebox "Binary format", "Conversion failed."
|
result = idemessagebox("Binary format", "Conversion failed.", "")
|
||||||
BinaryFormatCheck% = 2 'conversion failed
|
BinaryFormatCheck% = 2 'conversion failed
|
||||||
ELSE
|
ELSE
|
||||||
pathToCheck$ = getfilepath$(ofile$)
|
pathToCheck$ = getfilepath$(ofile$)
|
||||||
|
@ -15462,7 +15481,7 @@ FUNCTION BinaryFormatCheck% (pathToCheck$, pathSepToCheck$, fileToCheck$)
|
||||||
END IF
|
END IF
|
||||||
ELSE
|
ELSE
|
||||||
IF _FILEEXISTS("source/utilities/QB45BIN.bas") = 0 THEN
|
IF _FILEEXISTS("source/utilities/QB45BIN.bas") = 0 THEN
|
||||||
idemessagebox "Binary format", "Conversion utility not found. Cannot open QuickBASIC 4.5 binary format."
|
result = idemessagebox("Binary format", "Conversion utility not found. Cannot open QuickBASIC 4.5 binary format.", "")
|
||||||
BinaryFormatCheck% = 1
|
BinaryFormatCheck% = 1
|
||||||
EXIT FUNCTION
|
EXIT FUNCTION
|
||||||
END IF
|
END IF
|
||||||
|
@ -15487,7 +15506,7 @@ FUNCTION BinaryFormatCheck% (pathToCheck$, pathSepToCheck$, fileToCheck$)
|
||||||
COLOR 7, 1: LOCATE idewy - 3, 2: PRINT SPACE$(idewx - 2);: LOCATE idewy - 2, 2: PRINT SPACE$(idewx - 2);: LOCATE idewy - 1, 2: PRINT SPACE$(idewx - 2); 'clear status window
|
COLOR 7, 1: LOCATE idewy - 3, 2: PRINT SPACE$(idewx - 2);: LOCATE idewy - 2, 2: PRINT SPACE$(idewx - 2);: LOCATE idewy - 1, 2: PRINT SPACE$(idewx - 2); 'clear status window
|
||||||
dummy = DarkenFGBG(0)
|
dummy = DarkenFGBG(0)
|
||||||
PCOPY 3, 0
|
PCOPY 3, 0
|
||||||
idemessagebox "Binary format", "Error launching conversion utility."
|
result = idemessagebox("Binary format", "Error launching conversion utility.", "")
|
||||||
END IF
|
END IF
|
||||||
BinaryFormatCheck% = 1
|
BinaryFormatCheck% = 1
|
||||||
END IF
|
END IF
|
||||||
|
|
Loading…
Reference in a new issue