mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-08-06 18:40:25 +00:00
Merge pull request #361 from a740g/IDE-fixes
IDE Open & Save GUI dialog fixes
This commit is contained in:
commit
cd5f7a420b
1 changed files with 121 additions and 114 deletions
|
@ -20292,51 +20292,57 @@ end sub
|
||||||
' Download = MKI$(0) 'still working
|
' Download = MKI$(0) 'still working
|
||||||
'END FUNCTION
|
'END FUNCTION
|
||||||
|
|
||||||
Function SaveFile$ (IdeOpenFile as string)
|
|
||||||
STATIC Default_StartDir$
|
FUNCTION SaveFile$ (IdeOpenFile AS STRING)
|
||||||
|
SHARED Default_StartDir$
|
||||||
|
|
||||||
IF Default_StartDir$ = "" THEN
|
IF Default_StartDir$ = "" THEN
|
||||||
Default_StartDir$ = _STARTDIR$
|
Default_StartDir$ = _STARTDIR$
|
||||||
if Right$(Default_StartDir$, 1) <> idepathsep$ then Default_StartDir$ = Default_StartDir$ + idepathsep$
|
IF RIGHT$(Default_StartDir$, 1) <> idepathsep$ THEN Default_StartDir$ = Default_StartDir$ + idepathsep$
|
||||||
|
END IF
|
||||||
|
|
||||||
|
f$ = _SAVEFILEDIALOG$("Save Source File", Default_StartDir$ + IdeOpenFile, "*.bas|*.BAS|*.Bas", "QB64-PE BAS File")
|
||||||
|
IF f$ = "" THEN
|
||||||
|
SaveFile$ = "C"
|
||||||
|
EXIT FUNCTION 'someone canceled the input.
|
||||||
END IF
|
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"
|
IF FileHasExtension(f$) = 0 THEN f$ = f$ + ".bas"
|
||||||
path$ = idezgetfilepath$(ideroot$, f$)
|
path$ = idezgetfilepath$(ideroot$, f$)
|
||||||
pathseppos = _INSTRREV(f$, idepathsep$)
|
pathseppos = _INSTRREV(f$, idepathsep$)
|
||||||
IF pathseppos > 0 THEN f$ = Mid$(f$, pathseppos +1)
|
IF pathseppos > 0 THEN f$ = MID$(f$, pathseppos + 1)
|
||||||
|
|
||||||
|
Default_StartDir$ = path$
|
||||||
|
IF RIGHT$(Default_StartDir$, 1) <> idepathsep$ THEN Default_StartDir$ = Default_StartDir$ + idepathsep$
|
||||||
|
|
||||||
ideerror = 3
|
ideerror = 3
|
||||||
OPEN path$ + idepathsep$ + f$ FOR BINARY AS #150
|
OPEN path$ + idepathsep$ + f$ FOR BINARY AS #150
|
||||||
ideerror = 1
|
ideerror = 1
|
||||||
ideprogname$ = f$: _TITLE ideprogname + " - " + WindowTitle
|
ideprogname$ = f$
|
||||||
|
_TITLE ideprogname$ + " - " + WindowTitle
|
||||||
idesave path$ + idepathsep$ + f$
|
idesave path$ + idepathsep$ + f$
|
||||||
idepath$ = path$
|
idepath$ = path$
|
||||||
IdeAddRecent path$ + idepathsep$ + f$
|
IdeAddRecent path$ + idepathsep$ + f$
|
||||||
IdeSaveBookmarks path$ + idepathsep$ + f$
|
IdeSaveBookmarks path$ + idepathsep$ + f$
|
||||||
CLOSE #150
|
CLOSE #150
|
||||||
end sub
|
END FUNCTION
|
||||||
|
|
||||||
|
|
||||||
|
FUNCTION OpenFile$ (IdeOpenFile AS STRING) 'load routine copied/pasted from the old IDE file load/save dialog routines
|
||||||
|
SHARED Default_StartDir$
|
||||||
Function OpenFile$ (IdeOpenFile as string)'load routine copied/pasted from the old IDE file load/save dialog routines
|
|
||||||
|
|
||||||
STATIC Default_StartDir$
|
|
||||||
|
|
||||||
IF Default_StartDir$ = "" THEN
|
IF Default_StartDir$ = "" THEN
|
||||||
Default_StartDir$ = _STARTDIR$
|
Default_StartDir$ = _STARTDIR$
|
||||||
if Right$(Default_StartDir$, 1) <> idepathsep$ then Default_StartDir$ = Default_StartDir$ + idepathsep$
|
IF RIGHT$(Default_StartDir$, 1) <> idepathsep$ THEN Default_StartDir$ = Default_StartDir$ + idepathsep$
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
ideopenloop:
|
ideopenloop:
|
||||||
IF IdeOpenFile = "" THEN f$ = _OpenFileDialog$("Open Source File", Default_StartDir$, "*.bas|*.BAS|*.Bas|*.bi|*.BI|*.Bi|*.bm|*.BM|*.Bm", "QB64-PE Source Files", 0) ELSE f$ = IdeOpenFile
|
IF IdeOpenFile = "" THEN f$ = _OPENFILEDIALOG$("Open Source File", Default_StartDir$, "*.bas|*.BAS|*.Bas|*.bi|*.BI|*.Bi|*.bm|*.BM|*.Bm", "QB64-PE Source Files", 0) ELSE f$ = IdeOpenFile
|
||||||
IF f$ = "" THEN OpenFile$ = "C":EXIT FUNCTION
|
IF f$ = "" THEN OpenFile$ = "C": EXIT FUNCTION
|
||||||
path$ = ideztakepath$ (f$)
|
path$ = ideztakepath$(f$)
|
||||||
|
|
||||||
Default_StartDir$ = path$
|
Default_StartDir$ = path$
|
||||||
if Right$(Default_StartDir$, 1) <> idepathsep$ then Default_StartDir$ = Default_StartDir$ + idepathsep$
|
IF RIGHT$(Default_StartDir$, 1) <> idepathsep$ THEN Default_StartDir$ = Default_StartDir$ + idepathsep$
|
||||||
|
|
||||||
IF _FILEEXISTS(path$ + idepathsep$ + f$) = 0 THEN 'see if the user forgot the .bas extension and check for the file
|
IF _FILEEXISTS(path$ + idepathsep$ + f$) = 0 THEN 'see if the user forgot the .bas extension and check for the file
|
||||||
|
|
||||||
|
@ -20409,7 +20415,8 @@ Function OpenFile$ (IdeOpenFile as string)'load routine copied/pasted from the o
|
||||||
idepath$ = path$
|
idepath$ = path$
|
||||||
IdeAddRecent idepath$ + idepathsep$ + ideprogname$
|
IdeAddRecent idepath$ + idepathsep$ + ideprogname$
|
||||||
IdeImportBookmarks idepath$ + idepathsep$ + ideprogname$
|
IdeImportBookmarks idepath$ + idepathsep$ + ideprogname$
|
||||||
end sub
|
END FUNCTION
|
||||||
|
|
||||||
|
|
||||||
SUB ExportCodeAs (docFormat$)
|
SUB ExportCodeAs (docFormat$)
|
||||||
' Get the current source code, convert it to the desired document format and
|
' Get the current source code, convert it to the desired document format and
|
||||||
|
|
Loading…
Reference in a new issue