home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / QBAS / WNDTOOL5.ZIP / SETQUAD.SUB < prev    next >
Text File  |  1989-04-26  |  6KB  |  135 lines

  1. '
  2. '$PAGE
  3. '
  4. '******************************************************************************
  5. '                    Function :                                               *
  6. '                                                                             *
  7. ' Purpose:                                                                    *
  8. '                                                                             *
  9. '                                                                             *
  10. ' Results:                                                                    *
  11. '                                                                             *
  12. ' Usage  :                                                                    *
  13. '                                                                             *
  14. '                                                                             *
  15. ' Date Written : 01/01/89 - Date Tested: 01/01/89 - Author: James P Morgan    *
  16. ' Date Modified:          -            :          -       :                   *
  17. '-----------------------------------------------------------------------------*
  18. ' NOTE:                                                                       *
  19. '******************************************************************************
  20. '                                                                             *
  21. '     SUB PROGRAM NAME          (PARAMETERS)                 STATIC/RECURSIVE *
  22. '-----------------------------------------------------------------------------*
  23. '                                                                             *
  24. '============================================================================
  25. '
  26. SUB    SETQUAD(QUADRANT%,CROW%,CCOL%,MSGLEN%,MSGLINES%)                STATIC
  27.  
  28.        DEFINT A-Z                               'make all short interger by default
  29.  
  30.        SELECT CASE QUADRANT%                    'set row and column co-ordinates
  31.           CASE 0                                'based on the quadrant of the screen
  32.                 GOSUB SETQUAD.QUAD0             'center
  33.  
  34.           CASE 1
  35.                 GOSUB SETQUAD.QUAD1             'upper left
  36.  
  37.           CASE 2
  38.                 GOSUB SETQUAD.QUAD2             'upper right
  39.  
  40.           CASE 3
  41.                 GOSUB SETQUAD.QUAD3             'lower right
  42.  
  43.           CASE 4
  44.                 GOSUB SETQUAD.QUAD4             'lower left
  45.  
  46.           CASE ELSE                             'invalid quadrant specified
  47.                 CROW%=12                        'default to center of screen
  48.                 CCOL%=40
  49.                 QUADRANT%=0                     'let caller know we changed it
  50.  
  51.        END SELECT
  52.  
  53.        EXIT SUB                                 'return to caller
  54.  
  55. '
  56. SETQUAD.QUAD0:
  57.        CROW%=12                                 'center point based on 80 by 25 screen size
  58.        CCOL%=40                                 'center co-ordinate of screen
  59.  
  60.        RETURN
  61.  
  62. SETQUAD.QUAD1:
  63.        CROW%=7                                  'center point for quadrant 1
  64.        CCOL%=20                                 'top left quadrant of screen
  65.  
  66.        IF MSGLEN%\2<CCOL% THEN                  'will the longest line be outside screen edge
  67.           GOTO SETQUAD.QUAD1.CONT
  68.        END IF
  69.  
  70.        CCOL%=(MSGLEN%\2)                        'quadrant 1 new center point
  71. SETQUAD.QUAD1.CONT:
  72.        IF CROW%-(MSGLINES%\2)>=1  THEN          'will the window overflow botton of screen
  73.           RETURN
  74.        END IF
  75.  
  76.        CROW%=1+(MSGLINES%\2)                    'quadrant 2 new center point
  77.  
  78.        RETURN
  79.  
  80. SETQUAD.QUAD2:
  81.        CROW%=7                                  'center point for quadrant 2
  82.        CCOL%=60                                 'top right quadrant of screen
  83.  
  84.        IF (MSGLEN%\2)+CCOL%<80 THEN             'will the longest line be outside screen edge
  85.           GOTO SETQUAD.QUAD2.CONT
  86.        END IF
  87.  
  88.        CCOL%=79-(MSGLEN%\2)                     'quadrant 2 new center point
  89. SETQUAD.QUAD2.CONT:
  90.        IF CROW%-(MSGLINES%\2)>=1  THEN          'will the window overflow botton of screen
  91.            RETURN
  92.        END IF
  93.  
  94.        CROW%=1+(MSGLINES%\2)                    'quadrant 2 new center point
  95.  
  96.        RETURN
  97.  
  98. '
  99. SETQUAD.QUAD3:
  100.        CROW%=18                                 'center point for quadrant 3
  101.        CCOL%=60                                 'bottom right quadrant of screen
  102.        IF (MSGLEN%\2)+CCOL%<80 THEN
  103.           GOTO SETQUAD.QUAD3.CONT               'will the longest line be outside screen edge
  104.        END IF
  105.  
  106.        CCOL%=79-(MSGLEN%\2)                     'quadrant 3 new center point
  107. SETQUAD.QUAD3.CONT:
  108.        IF CROW%+(MSGLINES%\2)<=23 THEN          'will the window overflow botton of screen
  109.            RETURN
  110.        END IF
  111.  
  112.        CROW%=23%-(MSGLINES%\2)                  'quadrant 3 new center point
  113.  
  114.        RETURN
  115.  
  116. SETQUAD.QUAD4:
  117.        CROW%=18                                 'center point for quadrant 4
  118.        CCOL%=20                                 'bottom left quadrant of screen
  119.        IF MSGLEN%\2<CCOL% THEN
  120.           GOTO SETQUAD.QUAD4.CONT               'will the longest line be outside screen edge
  121.        END IF
  122.  
  123.        CCOL%=(MSGLEN%\2)                        'quadrant 4 new center point
  124. SETQUAD.QUAD4.CONT:
  125.        IF CROW%+(MSGLINES%\2)<=23 THEN          'will the window overflow botton of screen
  126.            RETURN
  127.        END IF
  128.  
  129.        CROW%=23%-(MSGLINES%\2)                  'quadrant 4 new center point
  130.  
  131.        RETURN
  132.  
  133.        EXIT SUB                                 'return to caller
  134. END SUB
  135.