home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / BTMTSRC3.ZIP / SB_BOX.C < prev    next >
C/C++ Source or Header  |  1990-05-14  |  5KB  |  116 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software, Co.                       */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          Freely Available<tm> Software.                 */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*  (C) Copyright 1987-90, Bit Bucket Software Co., a Delaware Corporation. */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*                Box Drawing subroutines for BinkleyTerm                   */
  14. /*                                                                          */
  15. /*                                                                          */
  16. /*    For complete  details  of the licensing restrictions, please refer    */
  17. /*    to the License  agreement,  which  is published in its entirety in    */
  18. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.240.    */
  19. /*                                                                          */
  20. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  21. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  22. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  23. /*    NOT HAVE THESE FILES,  YOU  SHOULD  IMMEDIATELY CONTACT BIT BUCKET    */
  24. /*    SOFTWARE CO.  AT ONE OF THE  ADDRESSES  LISTED BELOW.  IN NO EVENT    */
  25. /*    SHOULD YOU  PROCEED TO USE THIS FILE  WITHOUT HAVING  ACCEPTED THE    */
  26. /*    TERMS  OF  THE  BINKLEYTERM  LICENSING  AGREEMENT,  OR  SUCH OTHER    */
  27. /*    AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO.      */
  28. /*                                                                          */
  29. /*                                                                          */
  30. /* You can contact Bit Bucket Software Co. at any one of the following      */
  31. /* addresses:                                                               */
  32. /*                                                                          */
  33. /* Bit Bucket Software Co.        FidoNet  1:104/501, 1:132/491, 1:141/491  */
  34. /* P.O. Box 460398                AlterNet 7:491/0                          */
  35. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  36. /*                                Internet f491.n132.z1.fidonet.org         */
  37. /*                                                                          */
  38. /* Please feel free to contact us at any time to share your comments about  */
  39. /* our software and/or licensing policies.                                  */
  40. /*                                                                          */
  41. /*                                                                          */
  42. /*   This module is derived from code developed by Augie Hansen in his      */
  43. /*   book "Proficient C" published by Microsoft Press.  Mr. Hansen was      */
  44. /*   kind enough to give us verbal permission to use his routines, and      */
  45. /*   Bob, Vince and Alan (and all our full screen users) are grateful.      */
  46. /*   If you decide to use this code in some package you are doing, give     */
  47. /*   some thought to going out and buying the book. He deserves that.       */
  48. /*                                                                          */
  49. /*--------------------------------------------------------------------------*/
  50.  
  51.  
  52. #include <stdio.h>
  53.  
  54. #include "sbuf.h"
  55. #include "video.h"
  56. #include "box.h"
  57. #include "com.h"
  58. #include "xfer.h"
  59. #include "zmodem.h"
  60. #include "keybd.h"
  61. #include "sched.h"
  62. #include "externs.h"
  63. #include "prototyp.h"
  64.  
  65. static BOXTYPE box[] = {
  66.    '+'  , '+'  , '+'  , '+'  , '-'  , '-'  , '|'  , '|'  ,
  67.    ULC11, URC11, LLC11, LRC11, HBAR1, HBAR1, VBAR1, VBAR1,
  68.    ULC22, URC22, LLC22, LRC22, HBAR2, HBAR2, VBAR2, VBAR2,
  69.    ULC12, URC12, LLC12, LRC12, HBAR1, HBAR1, VBAR2, VBAR2,
  70.    ULC21, URC21, LLC21, LRC21, HBAR2, HBAR2, VBAR1, VBAR1,
  71.    BLOCK, BLOCK, BLOCK, BLOCK, HBART, HBARB, BLOCK, BLOCK
  72. };
  73.  
  74. void sb_box (win, type, attr)
  75. REGIONP win;
  76. int type;
  77. int attr;
  78. {
  79.    register int r;
  80.    int x;
  81.    int maxr, maxc;
  82.    BOXTYPE *boxp;
  83.  
  84.    boxp = &box[type];
  85.    maxc = win->c1 - win->c0;
  86.    maxr = win->r1 - win->r0;
  87.    x = maxc - 1;
  88.  
  89.    /* draw top row */
  90.    sb_move (win, 0, 0);
  91.    sb_wca (win, boxp->ul, attr, 1);
  92.    sb_move (win, 0, 1);
  93.    sb_wca (win, boxp->tbar, attr, x);
  94.    sb_move (win, 0, maxc);
  95.    sb_wca (win, boxp->ur, attr, 1);
  96.  
  97.    /* draw left and right sides */
  98.    for (r = 1; r < maxr; r++)
  99.       {
  100.       sb_move (win, r, 0);
  101.       sb_wca (win, boxp->lbar, attr, 1);
  102.       sb_move (win, r, maxc);
  103.       sb_wca (win, boxp->rbar, attr, 1);
  104.       }
  105.  
  106.    /* draw bottom row */
  107.    sb_move (win, maxr, 0);
  108.    sb_wca (win, boxp->ll, attr, 1);
  109.    sb_move (win, maxr, 1);
  110.    sb_wca (win, boxp->bbar, attr, x);
  111.    sb_move (win, maxr, maxc);
  112.    sb_wca (win, boxp->lr, attr, 1);
  113.  
  114.    return;
  115. }
  116.