! Premier Word Processor Application. 3.00 (c) Circle Software  Feb 1990
! ======================================================================

! This file may be freely modified by the user. ( Make a copy first! )

! Define variables.
! ================

str "lastway"    = ""
str "seekstring" = ""
str "dynitem"    = ""
int "tempint"    = 0

! General macro definitions.
! =========================


macro "CutOut"
{
    cut  "ClipBoard"
}


macro "Move"
{
    cut  marker
}


macro "Copy"
{
    copy marker
}


macro "NextWord"
{
    lastway   = direction
    direction = "forward"
    search " "
    search "~ "
    direction = lastway
} 


macro "LastWord"
{
    lastway   = direction
    direction = "backward"
    search " "
    search "~ "
    search " "
    cursor right
    direction = lastway
} 


macro "CutWord"
{
    lastway = direction
    direction = "backward"
    search " "
    cursor right  Mark
    direction = "forward"
    search "[ !]"    Mark
    direction = lastway
    cut "ClipBoard"
} 


macro "CutLine"
{
    column = leftmargin  Mark
    cursor down          Mark
    cut "ClipBoard"
} 




! Menu definition.
! ===============


macro "ClearClipBoard"  = clear "ClipBoard"
macro "SaveDocument"= filer
macro "FindText"    = finder
macro "DataBase"    = DataWindow
macro "OtherItem"   = {
                          prompt "Dynamic item name: ", dynitem
                          insert "^"+dynitem+"^"
                          update
                      }

macro "TodaysDate"  = insert date
macro "TheTime"     = insert time

macro "InsertFont"  = if ( marked )
                      {
                          insert dynitem, "MarkedStart"
                          insert dynitem, "MarkedEnd"
                          unmark
                      }

macro "InsertColour"= if ( marked )
                      { 
                          insert dynitem, "MarkedStart"
                          insert "^CBk^", "MarkedEnd"
                          unmark
                      }

macro "FJ1" = { justify on  }             ! Justify macros.
macro "FJ0" = { justify off }
macro "RJ"  = { right  }
macro "CJ"  = { centre }


macro "FullJustify" = if ( marked )
                      { 
                          insert "^FJ1^",  "MarkedStart"
                          insert "^FJ0^",  "MarkedEnd"
                          unmark
                      }

macro "CentreJust"  = { insert "^CJ^"  update  }
macro "RightJust"   = { insert "^RJ^"  update  }

macro "Bold"        = { dynitem = "^FB^"  InsertFont }
macro "Italic"      = { dynitem = "^FI^"  InsertFont }
macro "UnderLine"   = { dynitem = "^FU^"  InsertFont }
macro "SuperScript" = { dynitem = "^FSP^" InsertFont }
macro "SubScript"   = { dynitem = "^FSB^" InsertFont }

macro "Black"       = { dynitem = "^CBk^" InsertColour }
macro "White"       = { dynitem = "^CW^"  InsertColour }
macro "Grey"        = { dynitem = "^CGy^" InsertColour }
macro "Yellow"      = { dynitem = "^CY^"  InsertColour }
macro "Green"       = { dynitem = "^CG^"  InsertColour }
macro "Red"         = { dynitem = "^CR^"  InsertColour }
macro "Orange"      = { dynitem = "^CO^"  InsertColour }
macro "Blue"        = { dynitem = "^CB^"  InsertColour }

macro "PlaceMarker" = Mark
macro "Cancel"      = unmark

menu  "FontStyle"  = "Bold,Italic,UnderLine,SuperScript,SubScript"
menu  "FontColour" = "Black,White,Grey,Yellow,Green,Red,Orange,Blue"
menu  "Marked"     = "CutOut,Copy,Move,Cancel,FontStyle,FontColour,FullJustify"
menu  "Insert"     = "TodaysDate,TheTime,CentreJust,RightJust,>OtherItem"

menu "WordPMenu"= ">SaveDocument,>FindText,>DataBase,PlaceMarker,Marked,Insert"


! Define function keys, etc.
! =========================

! Alphabetic control keys.

! Function keys.

  key 0x181 = insert "^FB^"             ! f1
  key 0x191 = insert "^FI^"             ! Shift f1
  key 0x1A1 = insert "^FU^"             ! Ctrl  f1
  key 0x1B1 = swapcase                  ! Both  f1

  key 0x182 = Enter                     ! f2
  key 0x192 = Record                    ! Shift F2
  key 0x1A2 = Replay                    ! Ctrl  F2
  key 0x1B2 = if ( type == over )
                  type = insert
              else 
                  type = over           ! Both  f2

  key 0x183 = Filer                     ! f3

  key 0x184 = Finder                    ! f4
  key 0x1B4 = Command                   ! Both  f4

  key 0x185 = Paste                     ! f5
  key 0x195 = ClearClipBoard            ! Shift f5

  key 0x186 = Mark                      ! f6
  key 0x196 = Unmark                    ! shift f6

  key 0x187 = Copy                      ! f7
  key 0x197 = Move                      ! shift f7
  key 0x1A7 = Delete                    ! Ctrl  f7


! Data base functions. ( Assume a data file is open! )

  key 393 = read                                   ! F9         Read data file
  key 409 = { prompt "Text to seek: ", seekstring
              prompt "Field number: ", tempint
              seek tempint, seekstring }           ! Shift F9   Seek record
  key 425 = rewind                                 ! Ctrl  F9   Rewind file.

  key 458 = update                                 ! F10        Screen refresh.


! Most of the following keys are compatible with Edit.

! Cursor keys, etc.

  key 0x18C = cursor left               ! Normal cursor keys.
  key 0x18D = cursor right 
  key 0x18E = cursor down 
  key 0x18F = cursor up 

! Shited Cursor keys.

  key 412   = LastWord                  ! Shift left.
  key 413   = NextWord                  ! Shift right.
! key 414   Shift down, as for Page Down.
! key 415   Shift up,   as for Page Up.

! Control Cursor keys.

  key 428   = column = leftmargin       ! Ctrl left
  key 429   = column = rightmargin      ! Ctrl right
  key 430   = end                       ! Ctrl down
  key 431   = start                     ! Ctrl up

! Copy key.

  key 395   = { cursor right delete }   ! Copy.
  key 411   = CutWord                   ! Shift Copy
  key 427   = CutLine                   ! Ctrl  Copy

! Page keys.

  key 0x19F = line = line - pagelength  ! Page up.
  key 0x19E = line = line + pagelength  ! Page down.

! Insert key.

  key 461   = insert deletedchar        ! Insert.
  key 477   = Paste                     ! Shift Insert.

  key 0x01E = start                     ! Home.
  key 0x180 = print                     ! Print.
! key 0x190 =                           ! Shift Print.

  key 0x18A = insert "\t"               ! Tab key.


! Mouse. keys.

  key 256 =   {                         ! Mouse button - select.
                  line   = mouseline 
                  column = mousecolumn
                  edit mousewindow
              }

  key 257 =   {
                  if ( datafile == "None" ) 
                      flag "WordPMenu",3,0,1
                  else
                      flag "WordPMenu",3,0,0

                  offer "WordPMenu"     ! Mouse button - menu.
              }
   
  key 258 = edit mousewindow            ! Mouse button - adjust.
                 
  key 259 =   {                         ! Mouse button - select-drag.
                  line   = mouseline 
                  column = mousecolumn 
                  mark
              }
