1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-06 19:50:22 +00:00

Merge pull request #356 from SteveMcNeill/main

Savefile GUI added to IDE
This commit is contained in:
Steve McNeill 2023-07-25 08:52:55 -04:00 committed by GitHub
commit 5757e38388
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6356,10 +6356,11 @@ FUNCTION ide2 (ignore)
IF r$ = "Y" THEN
IF ideprogname = "" THEN
ProposedTitle$ = FindProposedTitle$
IF ProposedTitle$ = "" THEN
r$ = idefiledialog$("untitled" + tempfolderindexstr$ + ".bas", 2)
IF ProposedTitle$ = "" THEN ProposedTitle$ = "untitled" + tempfolderindexstr$
IF UseGuiDialogs Then
a$ = Savefile$ (ProposedTitle$ + ".bas")
ELSE
r$ = idefiledialog$(ProposedTitle$ + ".bas", 2)
a$ = idefiledialog$(ProposedTitle$ + ".bas", 2)
END IF
IF ideerror > 1 THEN PCOPY 3, 0: SCREEN , , 3, 0: GOTO IDEerrorMessage
IF r$ = "C" THEN GOTO ideloop
@ -6384,14 +6385,14 @@ FUNCTION ide2 (ignore)
PCOPY 2, 0
IF ideprogname = "" THEN
ProposedTitle$ = FindProposedTitle$
IF ProposedTitle$ = "" THEN
a$ = idefiledialog$("untitled" + tempfolderindexstr$ + ".bas", 2)
IF ProposedTitle$ = "" THEN ProposedTitle$ = "untitled" + tempfolderindexstr$
IF UseGuiDialogs Then
a$ = Savefile$ (ProposedTitle$ + ".bas")
ELSE
a$ = idefiledialog$(ProposedTitle$ + ".bas", 2)
END IF
IF ideerror > 1 THEN PCOPY 3, 0: SCREEN , , 3, 0: GOTO IDEerrorMessage
ELSE
idesave idepath$ + idepathsep$ + ideprogname$
idesave idepath$ + idepathsep$ + ideprogname
END IF
PCOPY 3, 0: SCREEN , , 3, 0: GOTO ideloop
END IF
@ -6401,13 +6402,18 @@ FUNCTION ide2 (ignore)
PCOPY 2, 0
IF ideprogname = "" THEN
ProposedTitle$ = FindProposedTitle$
IF ProposedTitle$ = "" THEN
a$ = idefiledialog$("untitled" + tempfolderindexstr$ + ".bas", 2)
IF ProposedTitle$ = "" THEN ProposedTitle$ = "untitled" + tempfolderindexstr$
IF UseGuiDialogs Then
a$ = Savefile$ (ProposedTitle$ + ".bas")
ELSE
a$ = idefiledialog$(ProposedTitle$ + ".bas", 2)
END IF
ELSE
a$ = idefiledialog$(ideprogname$, 2)
IF UseGuiDialogs Then
a$ = Savefile$ (ideprogname$)
ELSE
a$ = idefiledialog$(ideprogname$, 2)
END IF
END IF
PCOPY 3, 0: SCREEN , , 3, 0
IF ideerror > 1 THEN GOTO IDEerrorMessage
@ -20286,6 +20292,35 @@ end sub
' Download = MKI$(0) 'still working
'END FUNCTION
Function SaveFile$ (IdeOpenFile as string)
STATIC Default_StartDir$
IF Default_StartDir$ = "" THEN
Default_StartDir$ = _STARTDIR$
if Right$(Default_StartDir$, 1) <> idepathsep$ then Default_StartDir$ = Default_StartDir$ + idepathsep$
END IF
f$ = _SaveFileDialog$("Save As", Default_StartDir$ + path$ + IdeOpenFile, ".bas", "QB64PE BAS file")
if f$ = "" THEN EXIT FUNCTION 'someone canceled the input.
IF FileHasExtension(f$) = 0 THEN f$ = f$ + ".bas"
path$ = idezgetfilepath$(ideroot$, f$)
pathseppos = _INSTRREV(f$, idepathsep$)
IF pathseppos > 0 THEN f$ = Mid$(f$, pathseppos +1)
ideerror = 3
OPEN path$ + idepathsep$ + f$ FOR BINARY AS #150
ideerror = 1
ideprogname$ = f$: _TITLE ideprogname + " - " + WindowTitle
idesave path$ + idepathsep$ + f$
idepath$ = path$
IdeAddRecent path$ + idepathsep$ + f$
IdeSaveBookmarks path$ + idepathsep$ + f$
CLOSE #150
end sub
Function OpenFile$ (IdeOpenFile as string)'load routine copied/pasted from the old IDE file load/save dialog routines
STATIC Default_StartDir$