; FAXFORMS.FS
;

#AUTO MACRO Go


MENU CoverMenu
{
; Menu displayed when on the cover page only
;
PopUp "&File"
  Begin
    MENUITEM "&Problem", Problem
    MENUITEM "&Memo", Memo
    MENUITEM "&Tragedy", Tragedy
    MENUITEM "&Something", Something
    MENUITEM "&CoverSheet", CoverSheet
    MENUITEM "&Message Below", MessageBelow
    MENUITEM SEPARATOR
    MENUITEM "E&xit", ExitFiller
    MENUITEM SEPARATOR
    MENUITEM "&Escape", SystemRestoreSystem
  END
}

MENU EditFaxFormMenu
{
; Menu displayed when on some of the fax forms (includes text effects menu)
;
PopUp "&File"
  Begin
    MENUITEM "&Main", ReLoadCover
    MENUITEM SEPARATOR
    MENUITEM "Form &Info...", FileFormInfo
    MENUITEM SEPARATOR
    MENUITEM "&Fax", GoAndFax
    MENUITEM "&Print", PrintForm
    MENUITEM SEPARATOR
    MENUITEM "&Exit", ExitFiller
  END
PopUp "&Edit"
  Begin
    MENUITEM "Cu&t", EditCut
    MENUITEM "&Copy", EditCopy
    MENUITEM "&Paste", EditPaste
  END
PopUp "&Text"
  Begin
    MENUITEM "&Bold", EditBold
    MENUITEM "&Italic", EditItalic
    MENUITEM "&Underline", EditUnderline
    MENUITEM SEPARATOR
    MENUITEM "Import &Text...", EditLoadText
  END
PopUp "&View"
  Begin
    MENUITEM "&Enlarge", ViewEnlarge
    MENUITEM "&Real Size", ViewRealSize
    MENUITEM "Fit &Sides", ViewFitSides
    MENUITEM "&Full Page", ViewFitInWindow
  END
PopUp "&Help"
  Begin
    MENUITEM "&About...", Info
  END
}

MENU FaxFormMenu
{
; Menu displayed when on some of the fax forms (excludes text effects menu)
;
PopUp "&File"
  Begin
    MENUITEM "&Main", ReLoadCover
    MENUITEM SEPARATOR
    MENUITEM "Form &Info...", FileFormInfo
    MENUITEM SEPARATOR
    MENUITEM "&Fax", GoAndFax
    MENUITEM "&Print", PrintForm
    MENUITEM SEPARATOR
    MENUITEM "&Exit", ExitFiller
  END
PopUp "&Edit"
  Begin
    MENUITEM "Cu&t", EditCut
    MENUITEM "&Copy", EditCopy
    MENUITEM "&Paste", EditPaste
  END
PopUp "&View"
  Begin
    MENUITEM "&Enlarge", ViewEnlarge
    MENUITEM "&Real Size", ViewRealSize
    MENUITEM "Fit &Sides", ViewFitSides
    MENUITEM "&Full Page", ViewFitInWindow
  END
PopUp "&Help"
  Begin
    MENUITEM "&About...", Info
  END
}


MACRO Info
{
Message="[0][PerForm PRO Plus|FAX Form System Version 1.0|by Michael Harris|All artwork used with permission|Copyright 1990 by John Caldwell][Continue]"
}



MACRO Go
{
; Initialize the system and load the cover form
;
WindowSetTitle="FaxForm Pro"
WindowCloseAll
ViewShowRibbon 0
ViewShowGraphics 1
LoadCover
}


MACRO LoadCover
{
; Load up the cover form.  No other form window is open when this macro is
; run, so the "view" can be set before opening the form and it will stick.
;
CoverMenu
ViewFitInWindow
BeginExec FileOpenForm
  File="fx_cover.frp"
  Title="Select Form"
EndExec
WindowFormMaximize
}


MACRO ReLoadCover
{
; Close down the currently loaded form and reload the cover form.  The
; data entered on the fax page is discarded.  Could be changed to save the
; fill data to a file, and add a Data menu for retrieval later.
;
EditAbandonChanges
FileCloseForm
LoadCover
}


MACRO ExitFiller
{
; Close down the currently loaded form and exit Filler.  The data entered on
; the fax page is discarded.  Could be changed to save the fill data to a
; file, and add a Data menu for retrieval later.
;
EditAbandonChanges
FileExit
}

MACRO prepfaxformmenu
{
; Common initialization functions for loading a form with the FaxFormMenu
;
FileCloseForm
FaxFormMenu
ViewFitSides
}


MACRO prepeditfaxformmenu
{
; Common initialization functions for loading a form with the EditFaxFormMenu
;
FileCloseForm
EditFaxFormMenu
ViewFitSides
}


MACRO windowadjust
{
; Maximize the current form window and set the window title to the title in
; the form info structure in the form.
;
WindowFormMaximize
WindowFormSetTitle=FORMTITLE()
}


MACRO Problem
{
; Load the problem form
;
prepfaxformmenu
FileOpenForm "10.frp"
windowadjust
}


MACRO Memo
{
; Load the memo form
;
prepeditfaxformmenu
FileOpenForm "18.frp"
windowadjust
}


MACRO Tragedy
{
; Load the tragedy form
;
prepfaxformmenu
FileOpenForm "20.frp"
windowadjust
}


MACRO Something
{
; Load the something form
;
prepfaxformmenu
FileOpenForm "24.frp"
windowadjust
}


MACRO CoverSheet
{
; Load the cover form
;
prepeditfaxformmenu
FileOpenForm "94.frp"
windowadjust
}


MACRO MessageBelow
{
; Load the "message below" form
;
prepeditfaxformmenu
FileOpenForm "95.frp"
windowadjust
}


MACRO PrintForm
{
; Print the current form.  Specifying FAST mode is okay for all printers
; because printers that support only regular speed will use the slower
; speed, those that support FAST will use it.
;
BeginExec FilePrint
  PAGEFROM    "ALL"
  COPIES      1
  PRINTSPEED  "FAST"
  PRINTCOLORS "AS_COLOR"
  PRINTFORM   "YES"
  PRINTDATA   "YES"
  DATA        "CURRENT"
EndExec
}


MACRO GoAndFax
{
; Set up a DDE conversation with Winfax if a fax number has been entered.
; Pokes the correct fields to Winfax and starts the FAX.
;
If FAX_NO
  ;
  ; A FAX number has been entered so DDE WinFAX
  ;
  BeginExec DDEInitiate
    Application="FAXMNG"
    Topic="Transmit"
  EndExec
  BeginExec DDEPoke
    Application="FAXMNG"
    Topic="Transmit"
    Item="Fax Number"
    Value=FAX_NO
  EndExec
  BeginExec DDEPoke
    Application="FAXMNG"
    Topic="Transmit"
    Item="Receiver"
    Value=RECIPIENT
  EndExec
  BeginExec DDETerminate
    Application="FAXMNG"
    Topic="Transmit"
  EndExec
  BeginExec FileFax
    PAGEFROM    "ALL"
    COPIES      1
    PRINTSPEED  "REGULAR"
    PRINTCOLORS "AS_COLOR"
    PRINTFORM   "YES"
    PRINTDATA   "YES"
    DATA        "CURRENT"
  EndExec
Else
  ;
  ; No FAX number has been entered
  ;
  TOFAXORNOTOFAX=Message "[0][A Fax number has not been specified.|Please enter a number on the form|or in WinFax.][Fax Page|WinFax]"
  If TOFAXORNOTOFAX="2"
    BeginExec FileFax
      PAGEFROM    "ALL"
      COPIES      1
      PRINTSPEED  "REGULAR"
      PRINTCOLORS "AS_COLOR"
      PRINTFORM   "YES"
      PRINTDATA   "YES"
      DATA        "CURRENT"
    EndExec
  Else
    LocateGotoField "FAX_NO"
  End
End
}


