home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a067 / 1.img / GRUMP501.EXE / MOVING.PRG < prev    next >
Encoding:
Text File  |  1991-04-23  |  2.5 KB  |  65 lines

  1. /*
  2.    Program: CHECKMOVE()
  3.    System: GRUMPFISH LIBRARY
  4.    Author: Greg Lief
  5.    Copyright (c) 1989, Greg Lief
  6.    Clipper 5.x Version
  7.    Compile instructions: clipper moving /n/w/a
  8.  
  9.    Called by: POPCALC()
  10.               POPSTOP()
  11.  
  12.    Handles screen movement of desktop utility windows
  13.    Returns Logical Value: .T. if window was moved, .F. if not
  14.  
  15.    NOT FOR USE AS A STAND-ALONE FUNCTION!!!
  16. */
  17. //───── begin preprocessor directives
  18.  
  19. #include "inkey.ch"
  20.  
  21. //───── end preprocessor directives
  22.  
  23.  
  24. function checkmove(nkey, topoffset, leftoffset, ntop, nleft, oldscrn)
  25. local buffer, ret_val := .f.
  26. if (nkey == K_UP    .and. ntop > 0) .or. ;
  27.    (nkey == K_DOWN  .and. ntop < maxrow() - topoffset) .or. ;
  28.    (nkey == K_LEFT  .and. nleft > 0) .or. ;
  29.    (nkey == K_RIGHT .and. nleft < maxcol() - leftoffset) .or. ;
  30.    nkey == K_HOME .or. nkey == K_END .or. ;
  31.    nkey == K_PGUP .or. nkey == K_PGDN .or. ;
  32.    nkey == K_CTRL_LEFT .or. nkey == K_CTRL_RIGHT
  33.  
  34.    //───── save screen image at current location
  35.    buffer := savescreen(ntop, nleft, ntop+topoffset - 1, nleft+leftoffset - 2)
  36.    restscreen(ntop, nleft, ntop + topoffset, nleft + leftoffset, oldscrn)
  37.  
  38.    //───── determine new screen coordinates for calculator box
  39.    //───── first check for 'big moves' (home, end, pgup, pgdn, ^left, ^right)
  40.    if nkey == K_HOME .or. nkey == K_END .or. nkey == K_PGUP .or. ;
  41.             nkey == K_PGDN .or. nkey == K_CTRL_LEFT .or. nkey == K_CTRL_RIGHT
  42.       ntop := if(nkey == K_HOME .or. nkey == K_PGUP, 0, ;
  43.               if(nkey == K_PGDN .or. nkey == K_END, maxrow() - topoffset, ntop))
  44.       nleft := if(nkey == K_HOME .or. nkey == K_CTRL_LEFT, 0, ;
  45.                if(nkey == K_END .or. nkey == K_CTRL_RIGHT, ;
  46.                maxcol() - leftoffset, nleft))
  47.    else
  48.       ntop -= if(nkey == K_DOWN, -1, if(nkey == K_UP, 1, 0))
  49.       nleft -= if(nkey == K_RIGHT, -1, if(nkey == K_LEFT, 1, 0))
  50.    endif
  51.    //───── note: cannot use virtual windowing functions because of the
  52.    //───── transparent shadow functions... sorry, folks!
  53.    oldscrn := savescreen(ntop, nleft, ntop + topoffset, nleft + leftoffset)
  54.    gfattr(ntop+1, nleft+leftoffset-1, ntop+topoffset-1, nleft+leftoffset, 8)
  55.    gfattr(ntop+topoffset-1, nleft+2, ntop+topoffset, nleft+leftoffset, 8)
  56.    restscreen(ntop, nleft, ntop+topoffset-1, nleft+leftoffset-2, buffer)
  57.    ret_val := .t.
  58. endif
  59. return ret_val
  60.  
  61. * end function CheckMove()
  62. *--------------------------------------------------------------------*
  63.  
  64. * eof moving.prg
  65.