/********************************************************************
                           SavClose

  Description: Save and close active document (for QEDIT keyboard
               emulation)
  Syntax:      SAVCLOSE

  To map this script to a shortcut key:

  1. Save this script in the GwdTextEditor\script directory.
  2. From the Macro menu, choose Macro command.
  3. Choose the New button.
  4. In the New Macro Name input box, type a name for the macro. For
     example Script_SaveAndClose. In this dialog you can also define
     shortcut key for this macro.
  5. Choose the OK button.
  6. In the Edit Macro dialog box edit box enter the following two
     lines:
        Param1 "savclose.c"
        ExecScript
  7. Choose the Close button.
  8. You can now define shortcut key for Script_SaveAndClose macro
     in the Key Mapping dialog box.

  Author: Vedran Gaco
********************************************************************/

#include <stdio.h>
#include <editor/doc.h>

int main(void)
{
   HDOC hdoc = Gte_GetActiveDocument();
   if(hdoc != NULL) {
      // if(Gte_IsModified(hDoc)) // Save only if the file are modified
      Gte_SaveFile(hdoc, FALSE);
      Gte_CloseDocument(hdoc);
   }
   return 0;
}

