home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / FOXPRO / WINDOW / WIND.PRG
Text File  |  1991-01-26  |  20KB  |  815 lines

  1. * TRUE windowing for force.
  2. * ALBERT ALEXANDER BUKOSKI
  3. * RELEASED TO THE PUBLIC DOMAIN
  4. *
  5. * This code was going to be part of the DFORCE.LIB. But the darn .EXE
  6. * file was just to big. This is NOT the fault of FORCE. The coding is quilty.
  7. * There are a massive amount of array handling functions. This results in
  8. * alot of allocation in the stack of sometimes empty vars. This method of
  9. * windowing is not stack based but header based.
  10. * I have ported this puppy to assembler and the exe size went way, way
  11. * south.
  12. * Suggestions: 
  13. * 1. Delete the information getting functions (ie w_row, w_col, etc)
  14. * and this will result in a little space savings on you EXEs
  15. * 2. Decrease the number of windows to a lesser amount.
  16. *
  17. * This is only one method of windowing.
  18.  
  19. ****************************************************************************
  20. * W_INIT()
  21. * INCLUDE FILE: dwindow.hdr
  22. *
  23. * FUNCTION LOGICAL w_init PROTOTYPE
  24. * PURPOSE: Sets up window procedures. Must be used before all other window
  25. * functions
  26. * PARAMETERS: None.
  27. *
  28. * RETURNS: .T. if sucessesful
  29. *
  30. * EXAMPLE: 
  31. * * Set up windows procedures.
  32. * w_init()
  33. * ....
  34. * ....
  35. * SEE ALSO:
  36. ****************************************************************************
  37. * W_MAKE()
  38. * INCLUDE FILE: dwindow.hdr
  39. * FUNCTION UINT w_make PROTOTYPE
  40. * PARAMETERS VALUE UINT r, VALUE UINT c, VALUE UINT r1, VALUE UINT c1,;
  41. * VALUE CHAR border, VALUE CHAR fill_pat, VALUE INT color, VALUE LOGICAL shadow
  42. * PURPOSE: Defines window for later drawing.
  43. * PARAMETERS: w_make(tr,tc,br,bc,border type, fill pattern, color,shadow)
  44. * tr = top row
  45. * tc = top column
  46. * br = bottom row
  47. * bc = bottom column
  48. * border =See FILL() function.
  49. * fill pattern =See FILL() function.
  50. * color    = See FILL() function.
  51. * shadow = .T. for shadows, else .F. for none
  52. *
  53. * RETURNS: Handle of window.
  54. *
  55. * EXAMPLE: 
  56. * * Set up windows procedures then define a window.
  57. * vardef
  58. *  uint max_win[10] && Array to hold window structure
  59. * enddef 
  60. * procedure force_main
  61. * w_init()
  62. * max_win[0] = w_make(3,3,10,55,&single_box,"    ",&white_blue,.T.)
  63. * ....
  64. * ....
  65. * endpro
  66. * SEE ALSO:
  67. ****************************************************************************
  68. * W_OPEN()
  69. * INCLUDE FILE: dwindow.hdr
  70. * PROCEDURE w_open PROTOTYPE
  71. * PARAMETERS VALUE UINT handle[]
  72.  
  73. * PURPOSE: Draws pre defined window. 
  74. * PARAMETERS: w_open( array[Number])
  75. * Number is window made with w_make()
  76. *
  77. * RETURNS: Nothing.
  78. *
  79. * * Set up windows procedures,define a window, then open
  80. * vardef
  81. *  uint max_win[10] && Array to hold window structure
  82. * enddef 
  83. * procedure force_main
  84. * w_init()
  85. * win_max[0] = w_make(3,3,10,55,&single_box,"    ",&white_blue,.T.)
  86. * ....
  87. * ....
  88. * w_open(max_win[0])
  89. * ....
  90. * ....
  91. * endpro
  92. * SEE ALSO:
  93. ****************************************************************************
  94. * W_SAY()
  95. * INCLUDE FILE: dwindow.hdr
  96. * PROCEDURE w_say PROTOTYPE
  97. * PARAMETERS VALUE UINT handle[], VALUE UINT row, VALUE UINT column, ;
  98. * VALUE CHAR string
  99. *
  100. * PURPOSE: Writes string in window. 
  101. * PARAMETERS: w_say( array[Number], row, col, string)
  102. * Number is window made with w_make()
  103. * W_SAY() uses relative windowing positions. 
  104. *
  105. * RETURNS: Nothing.
  106. *
  107. * * Set up windows procedures,define a window, then open and say something
  108. * vardef
  109. *  uint max_win[10] && Array to hold window structure
  110. * enddef 
  111. * procedure force_main
  112. * w_init()
  113. * win_max[0] = w_make(3,3,10,55,&single_box,"    ",&white_blue,.T.)
  114. * ....
  115. * ....
  116. * w_open(max_win[0])
  117. * w_say(max_win[0], 0,0,"Check this puppy out")
  118. * w_say(max_win[0], 1,0,"He is so messy")
  119. * ....
  120. * ....
  121. * endpro
  122. * SEE ALSO:
  123. ****************************************************************************
  124. * W_OPEN_EXPLODE()
  125. * INCLUDE FILE: dwindow.hdr
  126. * PROCEDURE w_open_explode PROTOTYPE
  127. * PARAMETERS VALUE UINT handle[], VALUE UINT speed
  128. * PURPOSE: Draws pre defined window that explodes. 
  129. * PARAMETERS: w_open_explode( array[Number], delay)
  130. * Number is window made with w_make(). This is the same function as w_open()
  131. * but is seperate to reduce code size. Delay is the time delay for exploding
  132. * imploding.
  133. *
  134. * RETURNS: Nothing.
  135. *
  136. * * Set up windows procedures,define a window, then open with exploding effect.
  137. * vardef
  138. *  uint max_win[10] && Array to hold window structure
  139. * enddef 
  140. * procedure force_main
  141. * w_init()
  142. * win_max[0] = w_make(3,3,10,55,&single_box,"    ",&white_blue,.T.)
  143. * ....
  144. * ....
  145. * w_open_explode(max_win[0],2)
  146. * ....
  147. * ....
  148. * endpro
  149. * SEE ALSO:
  150. ****************************************************************************
  151. * W_CLOSE()
  152. * INCLUDE FILE: dwindow.hdr
  153. * PROCEDURE w_open_explode PROTOTYPE
  154. * PARAMETERS VALUE UINT handle[], VALUE UINT speed
  155. *
  156. * PURPOSE: Closes a window. 
  157. * PARAMETERS: w_close( array[Number])
  158. * Number is window made with w_make()
  159. *
  160. * RETURNS: Nothing.
  161. *
  162. * * Set up windows procedures,define a window, open    it, close it.
  163. * vardef
  164. *  uint max_win[10] && Array to hold window structure
  165. * enddef 
  166. * procedure force_main
  167. * w_init()
  168. * win_max[0] = w_make(3,3,10,55,&single_box,"    ",&white_blue,.T.)
  169. * ....
  170. * ....
  171. * w_open(max_win[0])
  172. * delay(1)
  173. * w_close(max_win[0])
  174. * endpro
  175. * SEE ALSO:
  176. ****************************************************************************
  177. * W_CLOSE_IMPLODE()
  178. * INCLUDE FILE: dwindow.hdr
  179. * PROCEDURE w_open_implode PROTOTYPE
  180. * PARAMETERS VALUE UINT handle[], VALUE UINT speed
  181. *
  182. * PURPOSE: Closes a window by imploding it. 
  183. * PARAMETERS: w_open_explode( array[Number], delay)
  184. * Number is window made with w_make(). Delay is the time delay for imploding
  185. * window.
  186. *
  187. * RETURNS: Nothing.
  188. *
  189. * * Set up windows procedures,define a window, open it, close it.
  190. * vardef
  191. *  uint max_win[10] && Array to hold window structure
  192. * enddef 
  193. * procedure force_main
  194. * w_init()
  195. * win_max[0] = w_make(3,3,10,55,&single_box,"    ",&white_blue,.T.)
  196. * ....
  197. * ....
  198. * w_open(max_win[0])
  199. * delay(1)
  200. * w_close_implode(max_win[0])
  201. * endpro
  202. * SEE ALSO:
  203. ****************************************************************************
  204. * W_CLEAR()
  205. * INCLUDE FILE: dwindow.hdr
  206. *
  207. * PROCEDURE w_clear PROTOTYPE
  208. * PARAMETERS VALUE UINT handle[]
  209. * PURPOSE: Clears inside a window. 
  210. * PARAMETERS: w_clear( array[Number])
  211. * Window is cleared from 1,1 of cursor position leaving border alone.
  212. *
  213. * RETURNS: Nothing.
  214. *
  215. * * Set up windows procedures,define a window, open    it, clear inside.
  216. * vardef
  217. *  uint max_win[10] && Array to hold window structure
  218. * enddef 
  219. * procedure force_main
  220. * w_init()
  221. * win_max[0] = w_make(3,3,10,55,&single_box,"    ",&white_blue,.T.)
  222. * ....
  223. * ....
  224. * w_open(max_win[0])
  225. * delay(1)
  226. * w_clear(max_win[0])
  227. * endpro
  228. * SEE ALSO:
  229. ****************************************************************************
  230. * W_ALTER()
  231. * INCLUDE FILE: dwindow.hdr
  232. * PROCEDURE w_alter PROTOTYPE
  233. * PARAMETERS VALUE UINT handle[], VALUE UINT new_row, VALUE UINT new_col,;
  234. * VALUE UINT new_row1, VALUE UINT new_col1 
  235. * PURPOSE: Resize or move a window. 
  236. * PARAMETERS: w_alter(array number, row, col, bottom row, bottom col)
  237. *
  238. * RETURNS: Nothing.
  239. *
  240. * * Set up windows procedures,define a window, open it, clear inside and resize
  241. * vardef
  242. *  uint max_win[10] && Array to hold window structure
  243. * enddef 
  244. * procedure force_main
  245. * w_init()
  246. * win_max[0] = w_make(3,3,10,55,&single_box,"    ",&white_blue,.T.)
  247. * ....
  248. * ....
  249. * w_open(max_win[0])
  250. * delay(1)
  251. * w_alter(max_win[0],0,0,24,79)
  252. * w_clear(max_win[0])
  253. * endpro
  254. * SEE ALSO:
  255. ****************************************************************************
  256. * W_HEADER()
  257. * INCLUDE FILE: dwindow.hdr
  258. * FUNCTION LOGICAL w_header PROTOTYPE
  259. * PARAMETERS VALUE UINT handle[], VALUE CHAR msg, VALUE INT color
  260. * PURPOSE: Places a Header in a window. 
  261. * PARAMETERS: w_header(array number, message, color of string)
  262. *
  263. * RETURNS: .T. if okay.
  264. *
  265. * * Place a header on a window with blue on white
  266. * vardef
  267. *  uint max_win[10] && Array to hold window structure
  268. * enddef 
  269. * procedure force_main
  270. * w_init()
  271. * win_max[0] = w_make(3,3,10,55,&single_box,"    ",&white_blue,.T.)
  272. * ....
  273. * ....
  274. * w_open(max_win[0])
  275. * delay(1)
  276. * w_header(max_win[0],"[ Testing Header ]",&white_blue)
  277. * ...
  278. * endpro
  279. * SEE ALSO:
  280. ****************************************************************************
  281. * W_FOOTER()
  282. * INCLUDE FILE: dwindow.hdr
  283. * FUNCTION LOGICAL w_footer PROTOTYPE
  284. * PARAMETERS VALUE UINT handle[], VALUE CHAR msg, VALUE INT color
  285. * PURPOSE: Places a footer in a window. 
  286. * PARAMETERS: w_footer(array number, message, color of string)
  287. *
  288. * RETURNS: .T. if okay.
  289. *
  290. * * Place a footer on a window with blue on white
  291. * vardef
  292. *  uint max_win[10] && Array to hold window structure
  293. * enddef 
  294. * procedure force_main
  295. * w_init()
  296. * win_max[0] = w_make(3,3,10,55,&single_box,"    ",&white_blue,.T.)
  297. * ....
  298. * ....
  299. * w_open(max_win[0])
  300. * delay(1)
  301. * w_footer(max_win[0],"[ Testing Footer ]",&white_blue)
  302. * ...
  303. * endpro
  304. * SEE ALSO:
  305. ****************************************************************************
  306. * W_ROW()
  307. * INCLUDE FILE: dwindow.hdr
  308. * FUNCTION INT w_row PROTOTYPE
  309. * PARAMETERS VALUE UINT handle[]
  310. * PURPOSE: Returns top row of a window. 
  311. * PARAMETERS: w_row(array number)
  312. *
  313. * RETURNS: Row of top left of window.
  314. *
  315. * EXAMPLE:
  316. * * Where is window number 3 ?
  317. * ? w_row(win[3])
  318. * SEE ALSO:
  319. ****************************************************************************
  320. * W_COL()
  321. * INCLUDE FILE: dwindow.hdr
  322. * FUNCTION INT w_col PROTOTYPE
  323. * PARAMETERS VALUE UINT handle[]
  324. * PURPOSE: Returns bottom column of a window. 
  325. * PARAMETERS: w_col(array number)
  326. *
  327. * RETURNS: Bottom column of window.
  328. *
  329. * EXAMPLE:
  330. * * Where is window number 3 ?
  331. * ? w_row(win[3])
  332. * ? w_col(win[3])
  333. * SEE ALSO:
  334. ****************************************************************************
  335. * W_COLOR()
  336. * INCLUDE FILE: dwindow.hdr
  337. * FUNCTION INT w_color PROTOTYPE
  338. * PARAMETERS VALUE UINT handle[]
  339. * PURPOSE: Returns current color of a window. 
  340. * PARAMETERS: w_color(array number)
  341. *
  342. * RETURNS: Color number value.
  343. *
  344. * EXAMPLE:
  345. * * Where is window number 3 and the color?
  346. * ? w_row(win[3])
  347. * ? w_col(win[3])
  348. * ? w_color(win[3])
  349. * SEE ALSO:
  350. ****************************************************************************
  351. * W_ACTIVE()
  352. * INCLUDE FILE: dwindow.hdr
  353. * FUNCTION LOGICAL w_active PROTOTYPE
  354. * PARAMETERS VALUE UINT handle[]
  355. * PURPOSE: Returns if a window is active. 
  356. * PARAMETERS: w_active(array number)
  357. *
  358. * RETURNS: .T. if window is active.
  359. *
  360. * EXAMPLE:
  361. * * Where is window number 3 and is the window active?
  362. * ? w_row(win[3])
  363. * ? w_col(win[3])
  364. * ? w_active(win[3])
  365. * SEE ALSO:
  366. * $Header:   D:/pvcs/dforce/wind.prv   1.0   12 Dec 1991 02:08:40   ALEX  $
  367. * $Log:   D:/pvcs/dforce/wind.prv  $
  368. *  
  369. *     Rev 1.0   12 Dec 1991 02:08:40   ALEX
  370. *  Initial revision.
  371.  
  372.  
  373. #include colors.hdr
  374. #include keys.hdr
  375. #include string.hdr
  376. #include iif.hdr
  377. #include math.hdr
  378. #include io.hdr
  379. #include system.hdr
  380. #include dstring.hdr
  381. #pragma W_FUNC_PROC-
  382.  
  383. vardef extern
  384.  byte __color_std
  385. enddef
  386.  
  387. vardef private
  388. #define DWINDOWS 50
  389.   uint cur_x[&DWINDOWS]
  390.   uint cur_y[&DWINDOWS]
  391.   uint r_win[&DWINDOWS]
  392.   uint c_win[&DWINDOWS]
  393.   uint r1_win[&DWINDOWS]
  394.   uint c1_win[&DWINDOWS]
  395.   uint clr_win[&DWINDOWS]
  396.   uint w_back[&DWINDOWS]
  397.   uint max_header
  398.   uint w_head_clr[&DWINDOWS]
  399.   uint w_foot_clr[&DWINDOWS]
  400.   char bord_win[&DWINDOWS]
  401.   char fill_win[&DWINDOWS]
  402.   char(79) footer_win[&DWINDOWS]
  403.   char(79) header_win[&DWINDOWS]
  404.   logical shad_win[&DWINDOWS]
  405.   logical w_head[&DWINDOWS]
  406.   logical w_foot[&DWINDOWS]
  407.   logical expld[&DWINDOWS]
  408.   logical active_w[&DWINDOWS]
  409. enddef
  410.  
  411. * These functions are internal calls to some routines I wrote to get
  412. * the status of the called array. They are not available to be released
  413.  
  414. * All this does is clear the screen using the scroll function. Modify
  415. * the scroll function to go down and clear with current attribute.
  416.  
  417. procedure dbclr prototype
  418. parameters value uint , value uint ,value uint ,value uint ,value uint 
  419.  
  420.  
  421. * This function make a shadow on the screen
  422. * I decided not to make a shadow with FILL() in order for
  423. * W_SAY to work. You have 3 choice for this. 1 Write a routine
  424. * to make a shadow(TYPE 6 on FILL function). 2 Remove support for 
  425. * making shadows. 3. Modify W_SAY to work with what ever type
  426. * of shadow you want.
  427. procedure df_shadow prototype
  428. parameters value uint tr, value uint tc,value uint br ,value uint bc
  429.  
  430. * w_header and w_footer simply return .T. if there is a HEADER 
  431. * or FOOTER for that particular window.
  432. * for w_header
  433. function logical DF_HDR prototype
  434. PARAMETERS VALUE UINT
  435.  
  436. * for w_footer
  437. function logical DF_FTR prototype
  438. parameters value uint 
  439.  
  440.  
  441. function logical w_init
  442. max_header = 0
  443. return .t.
  444. endpro
  445.  
  446. procedure w_open_explode
  447. PARAMS VALUE UINT h, VALUE UINT speed
  448. VARDEF
  449.        UINT    ir,ic,ir1,ic1
  450.     LOGICAL    odd
  451.     UINT  BC
  452.     UINT  SC
  453. ENDDEF
  454. *w_back[h] = savescrn(r_win[h],c_win[h],r1_win[h],c1_win[h])
  455. w_back[h] = savescrn(0,0,24,79)
  456. active_w[h] = .t.
  457.     ir = (r_win[h] + r1_win[h]) / 2 - 1
  458.     ic = (c_win[h] + c1_win[h]) / 2 - 1
  459.     ir1 = ir + 1
  460.     ic1 = ic + 1
  461.     odd = .f.
  462.     REPEAT
  463.     odd = .NOT. odd
  464.     IF odd
  465.     IF ( ir > r_win[h] )
  466.             ir = ir - 1
  467.     ENDIF
  468.     IF ( ir1 < r1_win[h] )
  469.             ir1 = ir1 + 1
  470.     ENDIF
  471.     ENDIF
  472.             
  473.     IF ( ic > c_win[h] )
  474.     ic = ic - 1                           
  475.     ENDIF                               
  476.     IF ( ic1 < c1_win[h] )
  477.     ic1 = ic1 + 1
  478.     ENDIF
  479.     FILL(ir,ic,ir1,ic1,bord_win[h],fill_win[h],clr_win[h],clr_win[h] , 0 )
  480. if shad_win[h]
  481. df_shadow(ir,ic,ir1,ic1)
  482. endif
  483. * A little trick to delay for hundreths of a second
  484.  
  485.     sound(0,speed)
  486.     UNTIL ir = r_win[h] .AND. ic = c_win[h] .AND. ir1 = r1_win[h] .AND. ic1 = c1_win[h] 
  487. ENDPRO
  488.  
  489. procedure w_close_implode
  490. PARAMETERS value uint h, value int delay_len
  491. VARDEF
  492. int start_ul_row,start_ul_col,start_lr_row ,start_lr_col ,temp_ul_row,temp_ul_col,;  
  493. temp_lr_row,temp_lr_col,diff_row ,diff_col,increment 
  494. int sleep_cnt
  495. int step_cnt
  496. int inc_row
  497. int inc_col
  498. int sleep
  499. ENDDEF
  500. sleep = 1
  501.  
  502. start_ul_row = r1_win[h] - 1
  503. start_ul_col = c1_win[h] - 1
  504. start_lr_row = r1_win[h]
  505. start_lr_col = c1_win[h]
  506.  
  507. temp_ul_row  = r_win[h]
  508. temp_ul_col  = c_win[h]
  509. temp_lr_row  = r1_win[h]
  510. temp_lr_col  = c1_win[h]
  511.  
  512. diff_row     = start_ul_row - r_win[h]
  513. diff_col     = start_ul_col - c_win[h]
  514.  
  515. IF diff_row > diff_col
  516.     increment = diff_col
  517. ELSE
  518.     increment = diff_row
  519. ENDIF
  520.  
  521. inc_row = diff_row / increment
  522. inc_col = diff_col / increment
  523.  
  524. step_cnt = 1
  525.  
  526. DO WHILE step_cnt <= increment
  527. RESTORESCRN(w_back[h])
  528.  
  529.     temp_ul_row = trunc(temp_ul_row + inc_row)
  530.     temp_ul_col = trunc(temp_ul_col + inc_col)
  531.     
  532.     @ temp_ul_row + 1, temp_ul_col + 1 CLEAR TO;
  533.     temp_lr_row - 1, temp_lr_col - 1
  534.     
  535. fill(temp_ul_row, temp_ul_col, temp_lr_row, temp_lr_col,bord_win[h],fill_win[h],clr_win[h],clr_win[h] ,0)
  536. if shad_win[h]
  537. df_shadow(temp_ul_row, temp_ul_col, temp_lr_row, temp_lr_col)
  538. endif
  539.     sound(0,delay_len)
  540.     sleep_cnt = 1
  541.     
  542.     DO WHILE sleep_cnt < sleep
  543.         sleep_cnt = sleep_cnt + 1
  544.     ENDDO
  545.     
  546.     step_cnt = step_cnt + 1
  547. ENDDO
  548.  
  549. RESTORESCRN(w_back[h])
  550. active_w[h] = .f.
  551. ENDPRO
  552.  
  553. function uint w_make
  554. parameters value uint r, value uint c, value uint r1, value uint c1,;
  555. value char bord, value char fill_pat, value int clr,value logical shad
  556. vardef
  557.  uint h
  558. enddef
  559.  
  560. h = max_header 
  561. cur_x[h]    = 0
  562. cur_y[h]    = 0
  563. r_win[h]       = r    
  564. c_win[h]       = c    
  565. r1_win[h]      = r1    
  566. c1_win[h]   = c1 
  567. bord_win[h] = bord
  568. fill_win[h] = fill_pat
  569. clr_win[h]  = clr
  570. w_back[h]    = 0
  571. w_head_clr[h] =    0
  572. w_foot_clr[h] =    0
  573. footer_win[h] = ""
  574. header_win[h] =""
  575. w_head[h] = .f.
  576. w_foot[h] = .f.
  577. active_w[h] = .f.
  578. shad_win[h] = shad
  579.  
  580. max_header = max_header + 1
  581. return h
  582. endpro
  583.  
  584. procedure w_open
  585. parameters value uint h
  586.  
  587. w_back[h] = savescrn(r_win[h],c_win[h],r1_win[h]+2,c1_win[h]+2)
  588. active_w[h] = .t.
  589. fill(r_win[h],c_win[h],r1_win[h],c1_win[h],bord_win[h], fill_win[h] , clr_win[h],; 
  590. clr_win[h], 0)
  591. if shad_win[h]
  592. df_shadow(r_win[h],c_win[h],r1_win[h],c1_win[h])
  593. endif
  594.  
  595. endpro
  596.  
  597.  
  598. function int w_row
  599. parameters value uint h
  600. return    r_win[h]
  601. endpro
  602.  
  603. function int w_col
  604. parameters value uint h
  605. return    c1_win[h]
  606. endpro
  607.  
  608. function int w_color
  609. parameters value uint h
  610. return    clr_win[h]
  611. endpro
  612.  
  613.  
  614. function logical w_active
  615. parameters value uint h
  616. return    active_w[h]
  617. endpro
  618.  
  619. procedure w_close
  620. parameters value uint h
  621. cur_x[h] = 0
  622. cur_y[h] = 0
  623. active_w[h] = .f.
  624. restorescrn(w_back[h])
  625. endpro
  626.  
  627. procedure w_clear
  628. parameters value uint h
  629. vardef
  630.   byte old
  631. enddef
  632. old = __color_std
  633. __color_Std = clr_win[h]
  634. dbclr( 0, r_win[h] +1,c_win[h], r1_win[h] + 1, c1_win[h] )
  635. __color_Std = old 
  636. ENDPRO
  637.  
  638. function logical w_say
  639. parameters value uint h,value uint  X, value uint Y, value char saytext
  640.  vardef
  641.   byte old
  642.   int slen
  643.   char stext, work
  644.  enddef
  645.  work  = " "
  646.  old = __color_std
  647.  __color_std = clr_win[h]
  648.  
  649.      X = X + r_win[h]
  650.      Y = Y + c_win[h] + 1
  651.  
  652.      if Y >= r1_win[h]
  653.          Y = cur_y[h]
  654.      endif
  655.  
  656.      if X >= r1_win[h]
  657.          X = cur_x[h]
  658.      endif
  659.  
  660.      if len(SayText) >= c1_win[h] - Y
  661.          Do while len(SayText) > 1
  662.              sText = substr(SayText, 1, c1_win[h] - y)
  663.              sLen  = iifn(len(sText) = c1_win[h] - Y,rat(" ",sText),len(stext))
  664.              @ X + 1, Y say Substr(SayText, 1, sLen )
  665.         SayText = Substr(SayText,sLen+1,sLen+1)
  666.              X = X + 1
  667.              if X >= r1_win[h]
  668.                  return (.f.)
  669.              endif
  670.          Enddo
  671.          cur_x[h] = X
  672.          cur_y[h] = Y
  673.      else
  674.          @ X + 1,Y say saytext
  675.      endif
  676.  __color_std = old
  677. return (.t.)
  678.  endpro
  679.  
  680.  
  681. function logical w_header
  682. parameters value uint h, value char msg, value int clr
  683. vardef 
  684.   byte old
  685.   int  Y, Size
  686. enddef
  687. old = __color_std
  688. __color_std = clr
  689. header_win[h] = msg
  690. w_head[h] = .t.
  691. w_head_clr[h] =    clr
  692.     y = c_win[h] + 1
  693.     Size = len(msg)
  694.     Size = (c1_win[h] - Y - Size)/2
  695.  
  696.     if Size < 0
  697.         return .f.
  698.     endif
  699.  
  700.     Y = Y + Size
  701.       @ r_win[h] , Y say msg
  702.  
  703. __color_std = old
  704.  
  705. Return .t.
  706. endpro
  707.  
  708. function logical w_footer
  709. parameters value uint h, value char msg, value int clr
  710. vardef 
  711.   byte old
  712.   int  Y, Size
  713. enddef
  714. old = __color_std
  715. __color_std = clr
  716. footer_win[h] = msg
  717. w_foot[h] = .t.
  718. w_foot_clr[h] =    clr
  719.     y = c_win[h] + 1
  720.     Size = len(msg)
  721.     Size = (c1_win[h] - Y - Size)/2
  722.  
  723.     if Size < 0
  724.         return .f.
  725.     endif
  726.  
  727.  Y = Y + Size
  728. @ r1_win[h] , Y say msg
  729. __color_std = old
  730. Return .t.
  731. ENDPRO
  732.  
  733. * I wanted a move, resize function all in one. That way, any modification
  734. * could be done by the user.
  735.  
  736. procedure w_alter
  737. parameters value uint h, value uint r, value uint c, value uint r1, value uint c1 
  738. vardef 
  739.   uint saved,old
  740. enddef
  741.  
  742. old = w_back[h]          && Saved background
  743. r_win[h] = r          && Give new value to positions
  744. c_win[h] = c
  745. r1_win[h] =    r1
  746. c1_win[h] =    c1
  747. restorescrn( old)      && Restore old screen
  748. w_back[h] = savescrn(r_win[h],c_win[h],r1_win[h],c1_win[h])
  749.  
  750. fill(r_win[h],c_win[h],r1_win[h],c1_win[h],; && Redraw window in new area
  751. bord_win[h],fill_win[h],clr_win[h],clr_win[h], 0) 
  752.  
  753. if shad_win[h]
  754. df_shadow(r_win[h],c_win[h],r1_win[h],c1_win[h])
  755. endif
  756.  
  757. if w_foot[h] 
  758.   w_footer(h,footer_win[h],w_foot_clr[h]) && Check if there is a footer
  759. endif
  760. if w_head[h] 
  761.   w_header(h,header_win[h],w_head_clr[h]) && Check if there is a footer
  762. endif
  763. endpro
  764.  
  765.