home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / BTMTSRC3.ZIP / B_SBINIT.C < prev    next >
C/C++ Source or Header  |  1990-07-02  |  10KB  |  247 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. /*            This module was originally written by Bob Hartman             */
  14. /*                                                                          */
  15. /*                                                                          */
  16. /*                  BinkleyTerm Initial Fullscreen Setup                    */
  17. /*                                                                          */
  18. /*                                                                          */
  19. /*    For complete  details  of the licensing restrictions, please refer    */
  20. /*    to the License  agreement,  which  is published in its entirety in    */
  21. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.240.    */
  22. /*                                                                          */
  23. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  24. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  25. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  26. /*    NOT HAVE THESE FILES,  YOU  SHOULD  IMMEDIATELY CONTACT BIT BUCKET    */
  27. /*    SOFTWARE CO.  AT ONE OF THE  ADDRESSES  LISTED BELOW.  IN NO EVENT    */
  28. /*    SHOULD YOU  PROCEED TO USE THIS FILE  WITHOUT HAVING  ACCEPTED THE    */
  29. /*    TERMS  OF  THE  BINKLEYTERM  LICENSING  AGREEMENT,  OR  SUCH OTHER    */
  30. /*    AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO.      */
  31. /*                                                                          */
  32. /*                                                                          */
  33. /* You can contact Bit Bucket Software Co. at any one of the following      */
  34. /* addresses:                                                               */
  35. /*                                                                          */
  36. /* Bit Bucket Software Co.        FidoNet  1:104/501, 1:132/491, 1:141/491  */
  37. /* P.O. Box 460398                AlterNet 7:491/0                          */
  38. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  39. /*                                Internet f491.n132.z1.fidonet.org         */
  40. /*                                                                          */
  41. /* Please feel free to contact us at any time to share your comments about  */
  42. /* our software and/or licensing policies.                                  */
  43. /*                                                                          */
  44. /*--------------------------------------------------------------------------*/
  45.  
  46. #include <stdio.h>
  47. #include <time.h>
  48. #include <string.h>
  49.  
  50. #ifdef __TURBOC__
  51. #include <alloc.h>
  52. #else
  53. #include <malloc.h>
  54. #endif
  55.  
  56. #include "com.h"
  57. #include "xfer.h"
  58. #include "zmodem.h"
  59. #include "keybd.h"
  60. #include "sbuf.h"
  61. #include "sched.h"
  62. #include "externs.h"
  63. #include "prototyp.h"
  64. #include "vfossil.h"
  65.  
  66. extern VIOMODEINFO vfos_mode;
  67.  
  68. void b_sbinit ()
  69. {
  70.    register int r;
  71.    char *savep;
  72.  
  73.    savep = malloc (4096);
  74.    for (r = 0; r < 132; r++)
  75.       {
  76.       blanks[r * 2] = ' ';
  77.       blanks[r * 2 + 1] = 7;
  78.       }
  79.  
  80.    vfossil_init ();
  81.    if (vfos_mode.col < 80)
  82.       vfos_mode.col = 80;
  83.    if (vfos_mode.row < 23)
  84.       vfos_mode.row = 23;
  85.  
  86.    SB_ROWS = (int) vfos_mode.row - 1;
  87.    SB_COLS = (int) vfos_mode.col;
  88.  
  89.    screen_clear ();
  90.    sb_init ();
  91.    free (savep);
  92.    wholewin = (REGIONP) sb_new (0, 0, SB_ROWS, SB_COLS);
  93.    settingswin = (REGIONP) sb_new (1, 1, 7, 22);
  94.    historywin = (REGIONP) sb_new (1, 23, 7, 23);
  95.    holdwin = (REGIONP) sb_new (1, 46, 7, SB_COLS - 47);
  96.    callwin = (REGIONP) sb_new (8, 1, SB_ROWS - 13, SB_COLS - 2);
  97.    filewin = (REGIONP) sb_new (SB_ROWS - 5, 1, 4, SB_COLS - 2);
  98.  
  99.    sb_fill (wholewin, ' ', colors.background);
  100.    sb_fill (settingswin, ' ', colors.settings);
  101.    sb_fill (historywin, ' ', colors.history);
  102.    sb_fill (holdwin, ' ', colors.hold);
  103.    sb_fill (callwin, ' ', colors.call);
  104.    sb_fill (filewin, ' ', colors.file);
  105.  
  106.    sb_box (settingswin, boxtype, colors.settings);
  107.    sb_box (historywin, boxtype, colors.history);
  108.    sb_box (holdwin, boxtype, colors.hold);
  109.    sb_box (callwin, boxtype, colors.call);
  110.    sb_box (filewin, boxtype, colors.file);
  111.  
  112.    sb_move (settingswin, 0, 1);
  113.    sb_puts (settingswin, (unsigned char *) msgtxt[M_CURRENT_SETTINGS]);
  114.  
  115.    sb_move (historywin, 0, 1);
  116.    sb_puts (historywin, (unsigned char *) msgtxt[M_TODAY_GLANCE]);
  117.  
  118.    sb_move (holdwin, 0, 1);
  119.    sb_puts (holdwin, (unsigned char *) msgtxt[M_PENDING_OUTBOUND]);
  120.  
  121.    sb_move (holdwin, 3, 7);
  122.    sb_puts (holdwin, (unsigned char *) msgtxt[M_INITIALIZING_SYSTEM]);
  123.  
  124.    sb_move (callwin, 0, 1);
  125.    sb_puts (callwin, (unsigned char *) msgtxt[M_RECENT_ACTIVITY]);
  126.  
  127.    sb_move (filewin, 0, 1);
  128.    sb_puts (filewin, (unsigned char *) msgtxt[M_TRANSFER_STATUS]);
  129.  
  130.    sb_move (wholewin, 0, 1);
  131.    (void) sprintf (junk, msgtxt[M_NODE_COLON], Full_Addr_Str (&my_addr));
  132.    sb_puts (wholewin, (unsigned char *) junk);
  133.    sb_move (wholewin, 0, SB_COLS - 1 - (int) strlen (system_name));
  134.    sb_puts (wholewin, (unsigned char *) system_name);
  135.  
  136.    bottom_line ();
  137.  
  138.    sb_move (settingswin, SET_EVNT_ROW, 2);
  139.    sb_puts (settingswin, (unsigned char *) msgtxt[M_EVENT_COLON]);
  140.    sb_move (settingswin, SET_PORT_ROW, 2);
  141.    sb_puts (settingswin, (unsigned char *) msgtxt[M_PORT_COLON]);
  142.    sb_move (settingswin, SET_STAT_ROW, 2);
  143.    sb_puts (settingswin, (unsigned char *) msgtxt[M_STATUS_INIT]);
  144.  
  145.    do_today ();
  146.  
  147.    settingswin->sr0 = settingswin->r0 + 1;
  148.    settingswin->sr1 = settingswin->r1 - 1;
  149.    settingswin->sc0 = settingswin->c0 + 1;
  150.    settingswin->sc1 = settingswin->c1 - 1;
  151.  
  152.    historywin->sr0 = historywin->r0 + 1;
  153.    historywin->sr1 = historywin->r1 - 1;
  154.    historywin->sc0 = historywin->c0 + 1;
  155.    historywin->sc1 = historywin->c1 - 1;
  156.  
  157.    holdwin->sr0 = holdwin->r0 + 1;
  158.    holdwin->sr1 = holdwin->r1 - 1;
  159.    holdwin->sc0 = holdwin->c0 + 1;
  160.    holdwin->sc1 = holdwin->c1 - 1;
  161.  
  162.    callwin->sr0 = callwin->r0 + 1;
  163.    callwin->sr1 = callwin->r1 - 1;
  164.    callwin->sc0 = callwin->c0 + 1;
  165.    callwin->sc1 = callwin->c1 - 1;
  166.  
  167.    filewin->sr0 = filewin->r0 + 1;
  168.    filewin->sr1 = filewin->r1 - 1;
  169.    filewin->sc0 = filewin->c0 + 1;
  170.    filewin->sc1 = filewin->c1 - 1;
  171. }
  172.  
  173. void do_today ()
  174. {
  175.    char j[30];
  176.    ADDR tmp;
  177.  
  178.    if (fullscreen)
  179.       {
  180.       sb_move (historywin, HIST_BBS_ROW, 2);
  181.       sb_puts (historywin, (unsigned char *) msgtxt[M_BBS_MAIL]);
  182.       (void) sprintf (j, "%d/%d", hist.bbs_calls, hist.mail_calls);
  183.       (void) sprintf (junk, "%-8.8s", j);
  184.       sb_puts (historywin, (unsigned char *) junk);
  185.  
  186.       sb_move (historywin, HIST_ATT_ROW, 2);
  187.       sb_puts (historywin, (unsigned char *) msgtxt[M_CALLS_OUT]);
  188.       (void) sprintf (junk, "%-6d", hist.calls_made);
  189.       sb_puts (historywin, (unsigned char *) junk);
  190.  
  191.       sb_move (historywin, HIST_CONN_ROW, 2);
  192.       sb_puts (historywin, (unsigned char *) msgtxt[M_GOOD_COST]);
  193.       (void) sprintf (j, "%d/%ld", hist.connects, hist.callcost);
  194.       (void) sprintf (junk, "%-8.8s", j);
  195.       sb_puts (historywin, (unsigned char *) junk);
  196.  
  197.       sb_move (historywin, HIST_FILE_ROW, 2);
  198.       sb_puts (historywin, (unsigned char *) msgtxt[M_FILES_IO]);
  199.       (void) sprintf (j, "%d/%d", hist.files_in, hist.files_out);
  200.       (void) sprintf (junk, "%-8.8s", j);
  201.       sb_puts (historywin, (unsigned char *) junk);
  202.  
  203.       sb_move (historywin, HIST_LAST_ROW, 2);
  204.       sb_puts (historywin, (unsigned char *) msgtxt[M_LAST]);
  205.       }
  206.  
  207.    tmp.Zone = hist.last_zone;
  208.    tmp.Net = hist.last_net;
  209.    tmp.Node = hist.last_node;
  210. tmp.Point = 0;
  211. tmp.Domain = NULL;
  212.    last_type (hist.last_caller, &tmp);
  213. }
  214.  
  215. void bottom_line ()
  216. {
  217.    if (fullscreen)
  218.       {
  219.       sb_move (wholewin, SB_ROWS - 1, 0);
  220.       (void) sb_putc (wholewin, ' ');
  221.       sb_puts (wholewin, (unsigned char *) ANNOUNCE);
  222. #ifdef OVERLAYS
  223.       sb_puts (wholewin, (unsigned char *) "-Overlay");
  224. #endif
  225.       sb_move (wholewin, SB_ROWS - 1, SB_COLS - 23);
  226.       sb_puts (wholewin, (unsigned char *) msgtxt[M_ALTF10]);
  227.       }
  228. }
  229.  
  230. void put_up_time ()
  231. {
  232.    struct tm *tp;
  233.    time_t ltime;
  234.  
  235.    if (fullscreen && (un_attended || doing_poll))
  236.       {
  237.       (void) time (<ime);
  238.       tp = localtime (<ime);
  239.       sb_move (settingswin, SET_TIME_ROW, SET_TIME_COL);
  240.       (void) sprintf (junk, "%s %s %02d @ %02d:%02d",
  241.                wkday[tp->tm_wday], mtext[tp->tm_mon], tp->tm_mday,
  242.                tp->tm_hour, tp->tm_min);
  243.       sb_puts (settingswin, (unsigned char *) junk);
  244.       sb_show ();
  245.       }
  246. }
  247.