home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / windows / baswind8.zip / SETQUAD.SUB < prev    next >
Text File  |  1990-09-14  |  6KB  |  132 lines

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