home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / vrac / dnalib7a.zip / POPWIND.BAS < prev    next >
BASIC Source File  |  1994-05-14  |  4KB  |  111 lines

  1. DECLARE SUB CalcByte(Attr%,LowByte%,HiByte%)
  2.  
  3. SUB POPWIND (Title$,Toprow%,Leftcolumn%,Bottomrow%,Rightcolumn%,Attr%,Shadow%,Border%) PUBLIC
  4.  
  5. $CODE SEG "DNASEG1"
  6.  
  7. CalcByte Attr%,FGround%,BGround%
  8.  
  9. SELECT CASE Border%
  10.         CASE 1
  11.           Tlc% = 218:Lbs% = 180:Rbs% = 195:Trc% = 191  'single line border
  12.           Sds% = 179
  13.           Blc% = 192:Tbs% = 196:Brc% = 217
  14.  
  15.         CASE 2
  16.           Tlc% = 201:Lbs% = 181:Rbs% = 198:Trc% = 187  'double line border
  17.           Sds% = 186
  18.           Blc% = 200:Tbs% = 205:Brc% = 188
  19.  
  20.         CASE 3
  21.           Tlc% = 213:Lbs% = 181:Rbs% = 198:Trc% = 184  'single sides double top
  22.           Sds% = 179                                 'and bottom
  23.           Blc% = 212:Tbs% = 205:Brc% = 190
  24.  
  25.         CASE 4
  26.           Tlc% = 214:Lbs% = 180:Rbs% = 195:Trc% = 183  'double sides single top
  27.           Sds% = 186                                 'and bottom
  28.           Blc% = 211:Tbs% = 196:Brc% = 189
  29.  
  30.         CASE ELSE
  31.           Tlc% = 32:Lbs% = 32:Rbs% = 32:Trc% = 32    'plain border
  32.           Sds% = 32
  33.           Blc% = 32:Tbs% = 32:Brc% = 32
  34.  
  35. END SELECT
  36.  
  37.  
  38. COLOR Fground%,Bground%
  39. LOCATE Toprow%,Leftcolumn%,0
  40. W$ = STRING$(((Rightcolumn% - Leftcolumn%) - 1), Tbs%)
  41.  
  42. '┌─────────────────────────────────────────────────────────────────────┐
  43. '│  The following block of code looks to see if you want a Title and   │░░
  44. '│  then check it's length, and the width of the window to see if it   │░░
  45. '│  will fit with even spacing and will append a period to the end of  │░░
  46. '│  the Title to keep everything centred.                              │░░
  47. '└─────────────────────────────────────────────────────────────────────┘░░
  48. '  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  49.  
  50. IF LEN(Title$) THEN
  51.   Title$ = CHR$(32) + Title$ + CHR$(32)
  52.   a% = ((Rightcolumn% - Leftcolumn%) - 1) - (LEN(Title$) + 2)
  53.   b% = a% \ 2
  54.   c% = a% - b%
  55.   T$ = STRING$(b%,Tbs%) + CHR$(Lbs%) + Title$ + CHR$(Rbs%) + STRING$(c%,Tbs%)
  56.   PRINT CHR$(Tlc%) + T$ + CHR$(Trc%);
  57. ELSE
  58.   PRINT CHR$(Tlc%) + W$ + CHR$(Trc%);
  59. END IF
  60.  
  61. '┌─────────────────────────────────────────────────────────────────────┐
  62. '│   The FOR NEXT loop simply fills in the centre of the window and    │░░
  63. '│   then the bottom line is PRINTed.                                  │░░
  64. '└─────────────────────────────────────────────────────────────────────┘░░
  65. '  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  66.  
  67. Row% = Toprow%
  68.  
  69. FOR i = Toprow% TO Bottomrow% - 2
  70.   IF Row% <= Bottomrow% - 1 THEN
  71.     INCR Row%
  72.     LOCATE Row%, Leftcolumn%,0
  73.     PRINT CHR$(Sds%) + SPACE$((Rightcolumn% - Leftcolumn%) - 1) + CHR$(Sds%);
  74.   END IF
  75. NEXT i
  76.  
  77. LOCATE Row% + 1, Leftcolumn%,0
  78. PRINT CHR$(Blc%) + W$ + CHR$(Brc%);
  79.  
  80. '┌─────────────────────────────────────────────────────────────────────┐
  81. '│   The final block of code is for PRINTing the shadow, the cursor    │░░
  82. '│   is LOCATEd and the SCREEN function is used to get the character,  │░░
  83. '│   the character is then placed into Shd1-2-3 and is then PRINTed    │░░
  84. '│   with a different attribute to give a transparent effect.          │░░
  85. '└─────────────────────────────────────────────────────────────────────┘░░
  86. '  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  87.  
  88. IF Shadow% = 1 THEN
  89.   COLOR 7,0
  90.   Row% = Toprow%
  91.   FOR j = Toprow% TO Bottomrow%
  92.     IF Row% < Bottomrow% + 1 THEN
  93.       INCR Row%
  94.       LOCATE Row%, Rightcolumn% + 1,0
  95.       Shd1% = SCREEN(Row%,Rightcolumn% + 1)
  96.       Shd2% = SCREEN(Row%,Rightcolumn% + 2)
  97.       PRINT CHR$(Shd1%) + CHR$(Shd2%);
  98.     END IF
  99.   NEXT j
  100.   Br% = Bottomrow% + 1
  101.   Lc% = Leftcolumn% + 2
  102.   FOR k% = 1 TO Rightcolumn% - Leftcolumn%
  103.     Shd3% = SCREEN(Br%,Lc%)
  104.     LOCATE Br%,Lc%,0
  105.     PRINT CHR$(Shd3%);
  106.     INCR Lc%
  107.   NEXT k%
  108. END IF
  109.  
  110. END SUB
  111.