Save Project File

Syntax

Gfa_Save

Gfa_SaveAs

Gfa_SaveFile filename$ [,f% = 0]

Gfa_SaveRtf

Gfa_SaveRtfFile filename$

Gfa_SavePreFile filename$ [,head$, tail$, flag]

Description

Gfa_Save saves the current project. If it hasn’t been saved before the Save dialog box is displayed to give the project a filename. Internally Gfa_SaveAs is invoked.

Gfa_SaveAs displays the Save As dialog box to save the project a (different) filename. The new filename is reflected in the title bar if the GFA-BASIC 32 IDE. The GFA-BASIC 32 most recent used files list in the register is updated with the new name.

Gfa_SaveFile saves the current project under the specified filename. The default behavior ( f = 0) is not to update the MRU list, meaning the current project is not renamed. This allows for automating a backup saving at regular time intervals without disturbing the current settings. In particular, the current line is not parsed before the file is saved.
When f <> 0 the project is given the specified name and the MRU list is updated. Nothing happens when the filename argument is an empty string.

Gfa_SaveRtf displays the Saves As dialog box to save the source code text in RTF format. Displays the Save As dialog box to give the project a (different) filename to save the code text in RTF-format. When a selection is available, only the selection is saved, otherwise the entire code. This function is also available in the Edit menu.

Gfa_SaveRtfFile filename$ saves source code text in RTF format in the specified file. Saves the source code RTF-formatted in the specified file.  When a selection is available, the selection is saved, otherwise the entire code.

Gfa_SavePreFile filename$ Saves the source code HTML-formatted in the specified file. When a selection is available, the selection is saved, otherwise the entire code. This saves the source code text in HTML code between <pre> … <\pre> tags.

- The optional parameter Head$ may contain HTML formatted text that is inserted before the <pre> tag.

- The optional parameter Tail$ may contain HTML code that is appended to the closing <\pre> tag. (For instance, "</BODY></HTML>", when the source code is added at the end of a HTML page).

- The optional integer flag% species whether to include the procedure separation line which is used in the editor to visually separate procedures. When flag = 1 adds </pre><hr><pre> (a HTML-dividing line). When flag = 0 there will be no dividing line.

See Gfa_CopyPre for an example.

Example

// Save before Test (syntax check)

 

Sub Gfa_F2

Const ID_ShiftF5 = 0x429

If Gfa_Dirty Then Gfa_Save

PostMessage Gfa_hWnd, WM_COMMAND, MakeWParam(ID_ShiftF5, 1), 0

EndSub

Here the file is saved if it has been changed since the last saving. Then WM_COMMAND with the accelerator ID of Shift + F5 is posted to the message queue of the IDE.

 

Sub Gfa_Minute

'autosave

Const Delay1 = 10             ' ten minutes timer

Static Int Timer1 = Delay1

If Timer1 = 0

If Gfa_Dirty

Local t$ = TempDir & "temp.g32"

Gfa_StatusText = "Autosaved to " + t$

Gfa_SaveFile t$           ' no filename change

EndIf

Timer1 = Delay1

EndIf

If Timer1 > 0 Then Timer1--

EndSub

Remarks

Before executing Gfa_Save, Gfa_SaveAs, or Gfa_SaveFile "Name", 1, the current line, when changed, is parsed (by invoking Gfa_Update). In case of a syntax error, the saving process is aborted. This is not the case when using Gfa_SaveFile "name", 0. When currently a line is being edited, the original line is saved, not the new edits.

See Also

Gfa_Dirty, Gfa_Load, Gfa_LoadMRU

{Created by Sjouke Hamstra; Last updated: 22/10/2014 by James Gaite}