home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 April (Special) / Chip-Special_1997-04_cd.bin / canon / bj364 / bj364d1.exe / BJL.BIN / SOURCE.ZIP / BJL_DOS.C next >
C/C++ Source or Header  |  1996-06-05  |  103KB  |  2,698 lines

  1. // ========================================================================================
  2. //    BJ Printer Setup Utility Program
  3. //    DOS Base
  4. //    BJ Printer (such as the A250 and A240)
  5. //
  6. //    1. Version 1.00 [August 18, '95]       : Tsukasa Jackie AIBA    : created new
  7. //    2. Version 1.01 [September 21, '95]    : Tsukasa Jackie AIBA    : added A240
  8. //    3. Version 1.02 [September 26, '95]    : Tsukasa Jackie AIBA    : added mono display
  9. //    4. Version 1.03 [March 12, '96]        : Tsukasa Jackie AIBA    : added MultiPASS C2500
  10. //    5. Version 1.10 [April 30, '96]        : Tsukasa Jackie AIBA    : Added BJC-80/240/4200/4550
  11. //    6. Version 1.11 [May 15, 1996]         : Srinivas Krishnamurti  : Added code to delete TestPrint option for B380IF
  12. //    7. Version 1.12 [May 17, 1996]         : Srinivas Krishnamurti  : Bug fixes
  13. //    8. Version 1.13 [June 5, 1996]         : Srinivas Krishnamurti  : Added back Test Print option without Demo Print to B380IF
  14. //
  15. //    Copyright Canon Information Systems, Inc. 1995, 1996
  16. // ========================================================================================
  17.  
  18. /*
  19.     BJL_DOS.c
  20.  
  21.     C-scape for DOS version 4.0.1. Software
  22.     Copyright (c) 1992 by Liant Software Corporation.
  23.     ALL RIGHTS RESERVED.
  24.  
  25.     This program is A250 and A240 setup utility how to use a mouse with C-scape for DOS version 4.0.1.
  26.  
  27.     There are 6 windows.
  28.     Window 0 is a software title.
  29.     Window 1 is an exit, status, send, default, about and help menu.
  30.     Window 2 is a Settings Mode menu.
  31.     Window 3 is a Printer Action menu.
  32.     Window 4 is a Parameter Settings menu.
  33.     Window 5 is a help menu.
  34.  
  35.     You can select windows by moving the mouse over the desired window.
  36.     When you are finished you can quit by pressing ESC or by 
  37.     clicking the mouse on the field that says "exit".
  38.  
  39. */
  40.  
  41. // ***********************************************************************
  42. //        include standard headers
  43. // ***********************************************************************
  44.  
  45. #include    <stdio.h>
  46. #include    <string.h>
  47. #include    <time.h>                // for popdecl.h
  48.  
  49. #include    <dos.h>
  50. #include    <errno.h>
  51. #include    <memory.h>
  52. #include    <stdlib.h>
  53. #include    <io.h>
  54. #include    <conio.h>
  55. #include    <fcntl.h>
  56. #include    <sys\types.h>
  57. #include    <sys\stat.h>
  58. #include    <direct.h>
  59. #include    <bios.h>
  60.  
  61. // ***********************************************************************
  62. //        include original headers
  63. // ***********************************************************************
  64.  
  65. #include    "..\h\cscape.h"
  66. #include    "..\h\ostdlib.h"        // for exit(), otolower()
  67. #include    "..\h\popdecl.h"        // for popups
  68. #include    "..\h\scancode.h"       // for event codes
  69. #include    "..\h\useful.h"         // for STATE_2NAMES
  70. #include    "..\h\cmwinobj.h"       // for bcwin_Class
  71. #include    "..\h\dpref.h"
  72. #include    "..\h\ogldecl.h"
  73. #include    "..\h\slug.h"
  74. #include    "..\h\pmwinobj.h"       // for pmwin stuff
  75. #include    "..\h\disppvs.h"        // for PCCOLS, disp_GetPixval, disp_FreePixval
  76. #include    "..\h\framer.h"
  77. #include    "..\h\oakalloc.h"       // for omalloc of icon title string
  78. #include    "..\h\oaktag.h"         // tags for omalloc
  79. #include    "..\h\helpdecl.h"       // for the help system
  80. #include    "..\h\pcmode.h"         // for the help system
  81.  
  82. #include    "letter.h"
  83. #include    "command.h"
  84.  
  85. // ***********************************************************************
  86. //  function name   : int main(int argc, char **argv)
  87. //  function        : BJ Printer Setup Utility
  88. //  input           : int        argc
  89. //                  : char       **argv
  90. //  output          : 1                            // failure
  91. //                  : 0                            // success
  92. // ***********************************************************************
  93. int main(int argc, char **argv)
  94. {
  95.     int               m;
  96.     menu_type         menu_0,    menu_5;
  97.  
  98.     choice_old = (byte)NULL;
  99.     fp_help = NULL;
  100. //
  101.     StartCheck();
  102. //
  103.     dp_SetApplName(" bjl_dos ");                                // Open the display
  104.     dp_SetWindowName(" BJ Printer Setup Utility ");
  105.     argc = dp_PickArgs(argc, argv);
  106.  
  107.                                     // Use background character win to make a nice background
  108.     if(colors == CO_COLOR)
  109.     {
  110.         if(disp_Init(def_ModeGraphics, bcwin_Class))
  111.             ogl_Init(def_MiniOGL);                              // Initialize the Oakland Graphics Library
  112.         else
  113.         {
  114.             if(!disp_Init(def_ModeText, bcwin_Class))           // Initialize the device interface for text mode
  115.             {
  116.                 printf("%s", INITFAIL_MSG);                     // Initialization failure
  117.                 exit(1);
  118.                 return(1);
  119.             }
  120.         }
  121.     }
  122.     else
  123.     {
  124.         if(disp_Init(pc_ModeVGA50, bcwin_Class))
  125.             ogl_Init(def_MiniOGL);                              // Initialize the Oakland Graphics Library
  126.         else
  127.         {
  128.             if(!disp_Init(def_ModeText, bcwin_Class))           // Initialize the device interface for text mode
  129.             {
  130.                 printf("%s", INITFAIL_MSG);                     // Initialization failure
  131.                 exit(1);
  132.                 return(1);
  133.             }
  134.         }
  135.     }
  136.  
  137.     bdcua_InitCombo();                // Initialize the text and graphics (use bd_cua in either mode)
  138.  
  139.                                                                 // Display the background
  140.     bcwin_SetChar(disp_GetBackWin(), (byte)BK_CHAR);            // a half-dense block char
  141.     win_SetAttr(disp_GetBackWin(), (byte)BK_COLOR1);
  142.     win_SetShadowAttr(disp_GetBackWin(), (byte)BK_COLOR2);
  143.     disp_Repaint();
  144.  
  145.     if(!hard_InitMouse())                                       // Check the mouse driver
  146.     {
  147.         if(!opc_Verify(NULL, ERROR, 0, ERROR_MOUSE))
  148.         {
  149.             disp_Close();                                       // Close down the display interface
  150.             exit(1);
  151.             return(1);
  152.         }
  153.     }
  154.     else
  155.         sedwin_MouseInit();                                     // Turn on the mouse
  156.  
  157.     if((colors == CO_COLOR) & (disp_GetColors() <= 2L))         // Map colors for 2 color video modes
  158.     {
  159.         disp_MapMono(TRUE);
  160.         colors = BW_COLOR;
  161.     }
  162. ////
  163. //colors = BW_COLOR;
  164. //
  165.  
  166.     if(!ChoiceDataInitial())
  167.     {
  168.         disp_Close();                            // Close down the display interface
  169.         exit(1);
  170.         return(1);
  171.     }
  172.  
  173. // read a help file --------------------------------------------------------------------------------
  174.  
  175.     PrinterIDNumber();
  176.     printer_old = printerID;
  177.  
  178.     if(choice[a240+15][4] == '2')                        // 15.(WIN4_MENU) Printer Port
  179.         port = LPT2;
  180.     else
  181.         port = LPT1;
  182.  
  183. // create the windows 0 -- Title -------------------------------------------------------------------
  184.  
  185.     menu_0 = menu_Open();
  186.     menu_Printf(menu_0, WINDOW_0, NULL);
  187.  
  188.     window_0 = sed_Open(menu_0);
  189.     switch(colors)
  190.     {
  191.         case BW_COLOR:                                          // Monochrome
  192.             sed_SetColors(window_0, WHITE_BLACK, WHITE_BLACK, BLACK_WHITE);
  193.             break;
  194.         case SVGA_COLOR:                                        // Super VGA
  195.             sed_SetColors(window_0, RED_BLACK, RED_BLACK, BLACK_RED);
  196.             break;
  197.         default:
  198.         case CO_COLOR:                                          // Graphics
  199.             sed_SetColors(window_0, RED_BLACK, RED_BLACK, BLACK_RED);
  200.             break;
  201.     }
  202.  
  203.     sed_SetBorderFeature(window_0, BD_TOP);
  204.     sed_SetPosition(window_0, 2, 35);
  205.     sed_SetHeight(window_0, 1);
  206.     sed_SetWidth(window_0, 34);
  207.     sed_SetShadow(window_0, 0);
  208.  
  209. // create the windows 1 ----------------------------------------------------------------------------
  210.  
  211.     switch(colors)
  212.     {
  213.         case BW_COLOR:                                          // Monochrome
  214.             window_1 = frame_Open(menu_bar, bd_1, BLACK_WHITE, WHITE_BLACK, WHITE_BLACK);
  215.             break;
  216.         case SVGA_COLOR:                                        // Super VGA
  217.             window_1 = frame_Open(menu_bar, bd_1, BLACK_WHITE, WHITE_BLACK, BLACK_WHITE);
  218.             break;
  219.         default:
  220.         case CO_COLOR:                                          // Graphics
  221.             window_1 = frame_Open(menu_bar, bd_1, GRAY_WHITE, YELLOW_GRAY, GRAY_WHITE2);
  222.             break;
  223.     }
  224.  
  225.     sed_SetLabel(window_1, 1);
  226.  
  227.     // Attach a mouse handler to the sed
  228.     win_SetMouse(window_1, winmou_All);
  229.     win_SetMouseFeature(window_1, MOUF_TRACK);
  230.  
  231. // create the windows 2 ----------------------------------------------------------------------------
  232.  
  233.     Win2_Menu_Main();
  234.  
  235. // create the windows 3 ----------------------------------------------------------------------------
  236.  
  237.     Win3_Menu_Printer();
  238.  
  239. // create the windows 4 ----------------------------------------------------------------------------
  240.  
  241.     Win4_Menu(0);
  242.  
  243. // create the windows 5 ----------------------------------------------------------------------------
  244.  
  245.     menu_5 = menu_Open();
  246.     menu_Printf(menu_5, WINDOW_5_TITLE, NULL);
  247.  
  248.     window_5 = sed_Open(menu_5);
  249.     switch(colors)
  250.     {
  251.         case BW_COLOR:                                          // Monochrome
  252.             sed_SetColors(window_5, BLACK_WHITE, WHITE_BLACK, WHITE_BLACK);
  253.             break;
  254.         case SVGA_COLOR:                                        // Super VGA
  255.             sed_SetColors(window_5, WHITE_BLACK, WHITE_BLACK, BLACK_WHITE);
  256.             break;
  257.         default:
  258.         case CO_COLOR:                                          // Graphics
  259.             sed_SetColors(window_5, WHITE_GRAY, WHITE_GRAY, GRAY_WHITE);
  260.             break;
  261.     }
  262.  
  263.     sed_SetBorder(window_5, bd_cua);
  264.     sed_SetBorderFeature(window_5, BD_OUTLINE | BD_PROMPT | BD_TOP);
  265.     sed_SetPosition(window_5, 27, 0);
  266.     sed_SetHeight(window_5, 1);
  267.     sed_SetWidth(window_5, 78);
  268.     sed_SetShadow(window_5, 0);
  269.  
  270. // -------------------------------------------------------------------------------------------------
  271.  
  272.     sedlist[3] = window_1;
  273.     sed_SetSpecial(window_1, spc_Jump);
  274.     sed_SetAux(window_1, aux_Top);
  275.  
  276.     sed_Repaint(window_0);
  277.     sed_Repaint(window_1);
  278.     sed_Repaint(window_5);
  279.  
  280. // #########     Main loop Start     ##########
  281.  
  282.     reduction = 0;
  283.  
  284.     while(TRUE)
  285.     {
  286.         Win2_Menu_Sub();
  287.         Win2_Menu_Main();////
  288.  
  289.         choice_old = (byte)NULL;
  290.         if(printer_old != printerID)
  291.         {
  292.             if(printer_old >= BJC240)
  293.             {
  294.                for(m=0; m<10; m++)
  295.                 sed_ProtectField(window_3, m);
  296.             }
  297.             else
  298.             {
  299.                for(m=0; m<9; m++)
  300.                 sed_ProtectField(window_3, m);
  301.             }
  302.             sed_Go(window_3);
  303.             sed_Close(window_3);
  304.             Win3_Menu_Printer();
  305.             printer_old = printerID;
  306.  
  307. ////            sed_Close(window_2);
  308. ////            Win2_Menu_Main();
  309.         }
  310.         Win4_Menu(1);
  311.     }
  312.  
  313. // #########     Main loop End     ##########
  314.  
  315.     EndDisplay();
  316.  
  317. }
  318.  
  319. // *********************************************************************************
  320. //  function name   : void Win2_PopUp_Printer(sed_type sed)
  321. //  function        : window 2 pop up menu (Select Printer)
  322. //  input           : sed_type            win_21    : window 2
  323. //  output          : void
  324. // *********************************************************************************
  325. void Win2_PopUp_Printer(sed_type win_21)
  326. {
  327.     int         i;
  328.     bob_type    bob;
  329.  
  330.     for(i=0; i<sed_GetFieldCount(win_21); i++)
  331.     {
  332.         if(((bob = sed_GetFieldBob(win_21, i)) != NULL) && bob_IsSed(bob))
  333.             Win2_PopUp_Printer(bob);
  334.     }
  335.  
  336.     switch(colors)
  337.     {
  338.         case BW_COLOR:                                              // Monochrome
  339.             sed_SetColors(win_21, WHITE_BLACK, BLACK_WHITE, BLACK_LCYAN);
  340.             break;
  341.         case SVGA_COLOR:                                            // Super VGA
  342.             sed_SetColors(win_21, CYAN_BLACK, CYAN_WHITE, BLACK_CYAN);
  343.             break;
  344.         default:
  345.         case CO_COLOR:                                              // Graphics
  346.             sed_SetColors(win_21, CYAN_BLACK, CYAN_GRAY, BLACK_CYAN);
  347.             break;
  348.     }
  349.  
  350.     sed_SetBorder(win_21, bd_cua);
  351.     sed_SetBorderFeature(win_21, BD_TOP | BD_OUTLINE | BD_TITLE | BD_PROMPT);
  352.     sed_SetBorderTitle(win_21, WINDOW_2_TITLE);
  353.     sed_SetPosition(win_21, 2, 2);
  354.     sed_SetHeight(win_21, MAX_PRINTER);
  355.     sed_SetWidth(win_21, 24);
  356.     sed_SetShadow(win_21, 1);
  357.     sed_SetShadowAttr(win_21, BK_COLOR3);
  358. }
  359.  
  360. // *********************************************************************************
  361. //  function name   : int PrinterSet(VOID *sdata, int idata)
  362. //  function        : Select a Printer in window 2 pop up menu
  363. //  input           : VOID *sdata
  364. //                  : int idata
  365. //  output          : TRUE
  366. // *********************************************************************************
  367. int PrinterSet(VOID *sdata, int idata)
  368. {
  369.  
  370.     switch(idata)
  371.     {
  372.         case 92:
  373.             strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S0);
  374.             printerID = MPC2500;   //// MultiPASS C2500
  375.             break;
  376.         case 190:
  377.             strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S30);
  378.             printerID = MPC30;     //// MultiPASS C30
  379.             break;
  380.         case 191:
  381.             strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_SIF);
  382.             printerID = B380IF;    //// CFX-B380IF
  383.             break;
  384.         case 94:
  385.             strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S2);
  386.             printerID = BJC210;    //// BJC-210
  387.             break;
  388.         case 95:
  389.             strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S3);
  390.             printerID = BJC80;     //// BJC-80
  391.             break;
  392.         case 96:
  393.             strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S4);
  394.             printerID = BJC240;    //// BJC-240
  395.             break;
  396.         case 97:
  397.             strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S5);
  398.             printerID = BJC4200;   //// BJC-4200
  399.             break;
  400.         case 98:
  401.             strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S6);
  402.             printerID = BJC4550;   //// BJC-4550
  403.             break;
  404.         case 93:
  405.         default:
  406.             strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S1);
  407.             printerID = BJC4100;   //// BJC-4100
  408.             break;
  409.     }
  410.  
  411.     return(TRUE);
  412. }
  413.  
  414. // *********************************************************************************
  415. //  function name   : void Win2_PopUp(sed_type sed)
  416. //  function        : window 2 pop up menu (Setting Mode)
  417. //  input           : sed_type            win_20    : window 2
  418. //  output          : void
  419. // *********************************************************************************
  420. void Win2_PopUp(sed_type win_20)
  421. {
  422.     int         i;
  423.     bob_type    bob;
  424.  
  425.     for(i=0;i<sed_GetFieldCount(win_20);i++)
  426.     {
  427.         if(((bob = sed_GetFieldBob(win_20, i)) != NULL) && bob_IsSed(bob))
  428.             Win2_PopUp(bob);
  429.     }
  430.  
  431.     switch(colors)
  432.     {
  433.         case BW_COLOR:                                              // Monochrome
  434.             sed_SetColors(win_20, WHITE_BLACK, BLACK_WHITE, BLACK_LCYAN);
  435.             break;
  436.         case SVGA_COLOR:                                            // Super VGA
  437.             sed_SetColors(win_20, CYAN_BLACK, CYAN_WHITE, BLACK_CYAN);
  438.             break;
  439.         default:
  440.         case CO_COLOR:                                              // Graphics
  441.             sed_SetColors(win_20, CYAN_BLACK, CYAN_GRAY, BLACK_CYAN);
  442.             break;
  443.     }
  444.  
  445.     sed_SetBorder(win_20, bd_cua);
  446.     sed_SetBorderFeature(win_20, BD_TOP | BD_OUTLINE | BD_TITLE | BD_PROMPT);
  447.     sed_SetBorderTitle(win_20, WINDOW_2_TITLE);
  448.     sed_SetPosition(win_20, 4, 2);
  449.     sed_SetHeight(win_20, 2);
  450.     sed_SetWidth(win_20, 24);
  451.     sed_SetShadow(win_20, 1);
  452.     sed_SetShadowAttr(win_20, BK_COLOR3);
  453. }
  454.  
  455. // *********************************************************************************
  456. //  function name   : int ModeSet(VOID *sdata, int idata)
  457. //  function        : Select a Setting Mode in window 2 pop up menu
  458. //  input           : VOID *sdata
  459. //                  : int idata
  460. //  output          : TRUE
  461. // *********************************************************************************
  462. int ModeSet(VOID *sdata, int idata)
  463. {
  464.     if(idata == 91)
  465.         strcpy(&choice[a240][0], WINDOW_4_0_S1);
  466.     else
  467.         strcpy(&choice[a240][0], WINDOW_4_0_S0);
  468.  
  469.     return(TRUE);
  470. }
  471.  
  472. // *********************************************************************************
  473. //  function name   : void Win3_PopUp(sed_type sed)
  474. //  function        : window 3 pop up menu
  475. //  input           : sed_type            win_30    : window 3
  476. //  output          : void
  477. // *********************************************************************************
  478. void Win3_PopUp(sed_type win_30)
  479. {
  480.     int         i;
  481.     bob_type    bob;
  482.  
  483.     for(i=0;i<sed_GetFieldCount(win_30);i++)
  484.     {
  485.         if(((bob = sed_GetFieldBob(win_30, i)) != NULL) && bob_IsSed(bob))
  486.             Win3_PopUp(bob);
  487.     }
  488.  
  489.     sed_SetBorderFeature(win_30, BD_TOP | BD_OUTLINE | BD_TITLE | BD_PROMPT);
  490.     switch(colors)
  491.     {
  492.         case BW_COLOR:                                              // Monochrome
  493.             sed_SetColors(win_30, WHITE_BLACK, BLACK_WHITE, BLACK_LCYAN);
  494.             break;
  495.         case SVGA_COLOR:                                            // Super VGA
  496.             sed_SetColors(win_30, GREEN_BLACK, GREEN_WHITE, BLACK_GREEN);
  497.             break;
  498.         default:
  499.         case CO_COLOR:                                              // Graphics
  500.             sed_SetColors(win_30, GREEN_BLACK, GREEN_GRAY, BLACK_GREEN);
  501.             break;
  502.     }
  503.  
  504.     sed_SetShadow(win_30, 1);
  505.     sed_SetShadowAttr(win_30, BK_COLOR3);
  506. }
  507.  
  508. // *********************************************************************************
  509. //  function name   : int SelectDisplay(VOID *sdata, int idata)
  510. //  function        : Send to Printer in window 3 pop up menu (Power Off and etc.)
  511. //  input           : VOID *sdata
  512. //                  : int idata
  513. //  output          : TRUE                            // move
  514. // *********************************************************************************
  515. int SelectDisplay(VOID *sdata, int idata)
  516. {
  517.     int            ini, port_240,    port_250;
  518.  
  519.     ini = port_240 = port_250 = 0;
  520.  
  521.     sed_Repaint(window_3);
  522.  
  523.     sed_ToggleExit(window_3);                        // Quit this window
  524.     sed_SetNextWin(window_3, sed_GetWin(sedlist[1]));
  525.  
  526.     if(idata != PNG)
  527.     {
  528.         if(PrinterCheck(1))
  529.         {
  530.             CommandOutput(BJL_BEGIN_SETTINGS);               // Start
  531.             CommandOutput(BJL_LF);
  532.  
  533.             switch(idata)
  534.             {
  535.                 case P1A:                                    // Power Off Command
  536.                     CommandOutput(BJL_POWER_OFF);
  537.                     break;
  538.                 case P2A:
  539.                     CommandOutput(BJL_RESET);
  540.                     break;
  541.                 case P3A:
  542.                     CommandOutput(BJL_EJECT_PAPER);
  543.                     break;
  544.                 case P4A:
  545.                     CommandOutput(BJL_SWITCH_CONTROL);
  546.                     CommandOutput(BJL_CONTROL_LQ);
  547.                     break;
  548.                 case P4B:
  549.                     CommandOutput(BJL_SWITCH_CONTROL);
  550.                     CommandOutput(BJL_CONTROL_BJ);
  551.                     break;
  552.                 case P4C:
  553.                     CommandOutput(BJL_SWITCH_CONTROL);
  554.                     CommandOutput(BJL_CONTROL_AUTO);
  555.                     break;
  556.                 case P5A:
  557.                     CommandOutput(BJL_TEST_PRINT);
  558.                     CommandOutput(BJL_A);
  559.                     break;
  560. #if 0
  561.                 case P5B:
  562.                     CommandOutput(BJL_TEST_PRINT);
  563.                     CommandOutput(BJL_B);
  564.                     break;
  565.                 case P5C:
  566.                     CommandOutput(BJL_TEST_PRINT);
  567.                     CommandOutput(BJL_C);
  568.                     break;
  569. #endif
  570.                 case P5D:
  571.                     CommandOutput(BJL_TEST_PRINT);
  572.                     CommandOutput(BJL_DEMO_PRINT);
  573.                     break;
  574.                 case P5E:
  575.                     CommandOutput(BJL_TEST_PRINT);
  576.                     CommandOutput(BJL_NOZZLE_CHECK);
  577.                     break;
  578.                 case P6A:
  579.                     CommandOutput(BJL_CURRENT_SETTINGS);
  580.                     CommandOutput(BJL_ON);
  581.                     break;
  582.                 case P7A:
  583.                     CommandOutput(BJL_CHANGE_HEAD);
  584.                     CommandOutput(BJL_1);
  585.                     break;
  586.                 case P8A:
  587.                     CommandOutput(BJL_NORMAL_CLEANING);
  588.                     CommandOutput(BJL_1);
  589.                     break;
  590.                 case P8B:
  591.                     CommandOutput(BJL_NORMAL_CLEANING);
  592.                     CommandOutput(BJL_6);
  593.                     break;
  594.                 case P9A:
  595.                     CommandOutput(BJL_INITIALIZE_SETTINGS);
  596.                     CommandOutput(BJL_FACTORY);
  597.                     ini = 1;
  598.                     if(choice[15][4] == '2')                        // 15.(WIN4_MENU) Printer Port
  599.                         port_250 = 1;
  600.                     if(choice[38][4] == '2')                        // 38.(WIN4_MENU) Printer Port
  601.                         port_240 = 1;
  602.                     memcpy(choice, choice_US_BJ, WIN4_BUFF);
  603.                     if(port_250)
  604.                         choice[15][4] = '2';
  605.                     if(port_240)
  606.                         choice[38][4] = '2';
  607.                     strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S3);
  608.                     break;
  609.                 case P9B:
  610.                     CommandOutput(BJL_INITIALIZE_SETTINGS);
  611.                     CommandOutput(BJL_TABLE1);
  612.                     ini = 1;
  613.                     if(choice[15][4] == '2')                        // 15.(WIN4_MENU) Printer Port
  614.                         port_250 = 1;
  615.                     if(choice[38][4] == '2')                        // 38.(WIN4_MENU) Printer Port
  616.                         port_240 = 1;
  617.                     memcpy(choice, choice_US_LQ, WIN4_BUFF);
  618.                     if(port_250)
  619.                         choice[15][4] = '2';
  620.                     if(port_240)
  621.                         choice[38][4] = '2';
  622.                     PrinterName();
  623.                     break;
  624.                 case P9C:
  625.                     CommandOutput(BJL_INITIALIZE_SETTINGS);
  626.                     CommandOutput(BJL_TABLE2);
  627.                     ini = 1;
  628.                     if(choice[15][4] == '2')                        // 15.(WIN4_MENU) Printer Port
  629.                         port_250 = 1;
  630.                     if(choice[38][4] == '2')                        // 38.(WIN4_MENU) Printer Port
  631.                         port_240 = 1;
  632.                     memcpy(choice, choice_US_BJ, WIN4_BUFF);
  633.                     if(port_250)
  634.                         choice[15][4] = '2';
  635.                     if(port_240)
  636.                         choice[38][4] = '2';
  637.                     PrinterName();
  638.                     break;
  639.                 case P9D:
  640.                     CommandOutput(BJL_INITIALIZE_SETTINGS);
  641.                     CommandOutput(BJL_TABLE3);
  642.                     ini = 1;
  643.                     if(choice[15][4] == '2')                        // 15.(WIN4_MENU) Printer Port
  644.                         port_250 = 1;
  645.                     if(choice[38][4] == '2')                        // 38.(WIN4_MENU) Printer Port
  646.                         port_240 = 1;
  647.                     memcpy(choice, choice_Eu_LQ, WIN4_BUFF);
  648.                     if(port_250)
  649.                         choice[15][4] = '2';
  650.                     if(port_240)
  651.                         choice[38][4] = '2';
  652.                     PrinterName();
  653.                     break;
  654.                 case P9E:
  655.                     CommandOutput(BJL_INITIALIZE_SETTINGS);
  656.                     CommandOutput(BJL_TABLE4);
  657.                     ini = 1;
  658.                     if(choice[15][4] == '2')                        // 15.(WIN4_MENU) Printer Port
  659.                         port_250 = 1;
  660.                     if(choice[38][4] == '2')                        // 38.(WIN4_MENU) Printer Port
  661.                         port_240 = 1;
  662.                     memcpy(choice, choice_Eu_BJ, WIN4_BUFF);
  663.                     if(port_250)
  664.                         choice[15][4] = '2';
  665.                     if(port_240)
  666.                         choice[38][4] = '2';
  667.                     PrinterName();
  668.                     break;
  669.                 case P9F:
  670.                     CommandOutput(BJL_INITIALIZE_SETTINGS);
  671.                     CommandOutput(BJL_TABLE5);
  672.                     ini = 1;
  673.                     if(choice[15][4] == '2')                        // 15.(WIN4_MENU) Printer Port
  674.                         port_250 = 1;
  675.                     if(choice[38][4] == '2')                        // 38.(WIN4_MENU) Printer Port
  676.                         port_240 = 1;
  677.                     memcpy(choice, choice_As_BJ, WIN4_BUFF);
  678.                     if(port_250)
  679.                         choice[15][4] = '2';
  680.                     if(port_240)
  681.                         choice[38][4] = '2';
  682.                     PrinterName();
  683.                     break;
  684.                 case P0A:
  685.                     CommandOutput(BJL_DUMP_MODE);
  686.                     CommandOutput(BJL_ON);
  687.                     break;
  688.                 case P0B:
  689.                     CommandOutput(BJL_DUMP_MODE);
  690.                     CommandOutput(BJL_OFF);
  691.                     break;
  692.             }
  693.             CommandOutput(BJL_LF);
  694.  
  695.             CommandOutput(BJL_END_SETTINGS);
  696.             CommandOutput(BJL_LF);
  697.  
  698.             if(ini)
  699.             {
  700.                 if(!iniFileWrite())
  701.                     EndDisplay();
  702.                 choice_old = (byte)NULL;
  703.                 Win4_Menu(1);
  704.             }
  705.         }
  706.     }
  707.  
  708.     return(TRUE);
  709. }
  710.  
  711. // ***********************************************************************
  712. //  function name   : int MenuBar0(VOID *sdata, int idata)
  713. //  function        : Exit this program's (Menu Bar)
  714. //  input           : VOID            *sdata
  715. //                  : int             idata           // NOT use
  716. //  output          : TRUE                            // move
  717. // ***********************************************************************
  718. int MenuBar0(VOID *sdata, int idata)
  719. {
  720.     menu_type   menu_0_1;
  721.     sed_type    window_0_1;
  722.  
  723.     menu_0_1 = menu_Open();
  724.  
  725.     menu_Printf(menu_0_1, MENU_0_OK, NULL, &gmenu_funcs, NULL, OKAY_STR);
  726.     menu_Printf(menu_0_1, MENU_0_CA, NULL, &gmenu_funcs, NULL, CANCEL_STR);
  727.  
  728.     window_0_1 = sed_Open(menu_0_1);
  729.     switch(colors)
  730.     {
  731.         case BW_COLOR:                                                  // Monochrome
  732.             sed_SetColors(window_0_1, WHITE_BLACK, WHITE_BLACK, BLACK_WHITE);
  733.             break;
  734.         case SVGA_COLOR:                                                // Super VGA
  735.             sed_SetColors(window_0_1, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
  736.             break;
  737.         default:
  738.         case CO_COLOR:                                                  // Graphics
  739.             sed_SetColors(window_0_1, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
  740.             break;
  741.     }
  742.     win_SetMouse(window_0_1, winmou_All);
  743.     win_SetMouseFeature(window_0_1, MOUF_GREEDY);
  744.  
  745.     sed_SetBorder(window_0_1, bd_cua);
  746.     bord_SetTitle(window_0_1, MENU_0_T);
  747.     bord_SetFeature(window_0_1, BD_TOP | BD_TITLE | BD_OUTLINE | BD_PROMPT | BD_MOVE);
  748.     sed_SetPosition(window_0_1, 6, 22);
  749.     sed_SetShadow(window_0_1, 1);
  750.  
  751.     sed_Repaint(window_0_1);
  752.  
  753.     if(sed_Go(window_0_1) == OKAY)
  754.     {
  755.         sed_Close(window_0_1);
  756.         EndDisplay();             // quit = TRUE;
  757.     }
  758.     else
  759.         sed_Close(window_0_1);
  760.  
  761.     sed_ToggleExit(window_1);                        // Quit this window
  762.     sed_SetNextWin(window_1, sed_GetWin(sedlist[3]));
  763.     kb_Stuff(FN10);
  764.  
  765.     return(TRUE);
  766. }
  767.  
  768. // ***********************************************************************
  769. //  function name   : int MenuBar1(VOID *sdata, int idata)
  770. //  function        : Display this program's about (Menu Bar)
  771. //  input           : VOID            *sdata
  772. //                  : int             idata           // NOT use
  773. //  output          : TRUE                            // move
  774. // ***********************************************************************
  775. int MenuBar1(VOID *sdata, int idata)
  776. {
  777.     menu_type   menu_1_1;
  778.     sed_type    window_1_1;
  779.  
  780.     menu_1_1 = menu_Open();
  781.     menu_Printf(menu_1_1, MENU_1_1);
  782.     menu_Printf(menu_1_1, MENU_1_2);
  783.     menu_Printf(menu_1_1, MENU_1_3);
  784.     menu_Printf(menu_1_1, MENU_1_4);
  785.     menu_Printf(menu_1_1, MENU_1_5);
  786.     menu_Printf(menu_1_1, MENU_1_OK, NULL, &menu_funcs);
  787.  
  788.     window_1_1 = sed_Open(menu_1_1);
  789.     switch(colors){
  790.         case BW_COLOR:                                              // Monochrome
  791.             sed_SetColors(window_1_1, BLACK_WHITE, BLACK_WHITE, WHITE_BLACK);
  792.             break;
  793.         case SVGA_COLOR:                                            // Super VGA
  794.             sed_SetColors(window_1_1, RED_WHITE, RED_WHITE, WHITE_RED);
  795.             break;
  796.         default:
  797.         case CO_COLOR:                                              // Graphics
  798.             sed_SetColors(window_1_1, RED_WHITE, RED_WHITE, WHITE_RED);
  799.             break;
  800.     }
  801.     sed_SetShadow(window_1_1, 1);
  802.     win_SetMouse(window_1_1, winmou_All);
  803.     win_SetMouseFeature(window_1_1, MOUF_GREEDY);
  804.  
  805.     sed_SetBorder(window_1_1, bd_cua);
  806.     bord_SetTitle(window_1_1, MENU_1_T);
  807.     bord_SetFeature(window_1_1, BD_TOP | BD_TITLE | BD_OUTLINE | BD_MOVE);
  808.     sed_SetPosition(window_1_1, 6, 14);
  809.  
  810.     sed_Repaint(window_1_1);
  811.     sed_Go(window_1_1);
  812.     sed_Close(window_1_1);
  813.  
  814.     sed_ToggleExit(window_1);                        // Quit this window
  815.     sed_SetNextWin(window_1, sed_GetWin(sedlist[3]));
  816.     kb_Stuff(FN8);
  817.  
  818.     return(TRUE);
  819. }
  820.  
  821. // ***********************************************************************
  822. //  function name   : int MenuBar2(VOID *sdata, int idata)
  823. //  function        : Send printer's setting parameters (Menu Bar)
  824. //  input           : VOID            *sdata
  825. //                  : int             idata           // NOT use
  826. //  output          : TRUE                            // move
  827. // ***********************************************************************
  828. int MenuBar2(VOID *sdata, int idata)
  829. {
  830.     menu_type   menu_2_1;
  831.     sed_type    window_2_1;
  832.  
  833.     menu_2_1 = menu_Open();
  834.     menu_Printf(menu_2_1, MENU_2_OK, NULL, &gmenu_funcs, NULL, OKAY_STR);
  835.     menu_Printf(menu_2_1, MENU_2_CA, NULL, &gmenu_funcs, NULL, CANCEL_STR);
  836.  
  837.     window_2_1 = sed_Open(menu_2_1);
  838.     switch(colors)
  839.     {
  840.         case BW_COLOR:                                                  // Monochrome
  841.             sed_SetColors(window_2_1, WHITE_BLACK, WHITE_BLACK, BLACK_WHITE);
  842.             break;
  843.         case SVGA_COLOR:                                                // Super VGA
  844.             sed_SetColors(window_2_1, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
  845.             break;
  846.         default:
  847.         case CO_COLOR:                                                  // Graphics
  848.             sed_SetColors(window_2_1, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
  849.             break;
  850.     }
  851.     sed_SetShadow(window_2_1, 1);
  852.     win_SetMouse(window_2_1, winmou_All);
  853.     win_SetMouseFeature(window_2_1, MOUF_GREEDY);
  854.  
  855.     sed_SetBorder(window_2_1, bd_cua);
  856.     bord_SetTitle(window_2_1, MENU_2_T);
  857.     bord_SetFeature(window_2_1, BD_TOP | BD_TITLE | BD_OUTLINE | BD_PROMPT | BD_MOVE);
  858.     sed_SetPosition(window_2_1, 6, 22);
  859.  
  860.     sed_Repaint(window_2_1);
  861.  
  862.     if(sed_Go(window_2_1) == OKAY)
  863.     {
  864.         if(PrinterCheck(1))
  865.         {
  866.             if((printerID == BJC210) || (printerID == BJC240))
  867.             {
  868.                 if((memcmp(&choice[45][0], &choice_US_LQ[45][0], 9)) && (memcmp(&choice[26][0], &choice_US_LQ[26][0], 9)))
  869.                 {
  870.                     sed_Close(window_2_1);
  871.                     sed_ToggleExit(window_1);
  872.                     sed_SetNextWin(window_1, sed_GetWin(sedlist[3]));
  873.                     kb_Stuff(FN6);
  874.                     opc_Prompt(NULL, ERROR, 0, ERROR_REDUCTION);
  875.                     return(TRUE);
  876.                 }
  877.             }
  878. //
  879.             CommandOutput(BJL_BEGIN_SETTINGS);              //// Start
  880.             CommandOutput(BJL_LF);
  881.  
  882.             CommandOutput(BJL_CONTROL_MODE);                //// BJ Mode
  883.             CommandOutput(BJL_CONTROL_BJ);
  884.             CommandOutput(BJL_LF);
  885.  
  886.             if(printerID != BJC80)
  887.             {
  888.                 CommandOutput(BJL_SELECT_FONT);             // 5. Font
  889.                 switch(choice[a240+5][FONT_ORDER])
  890.                 {
  891.                     case FONT_ROMAN:
  892.                         CommandOutput(BJL_ROMAN);
  893.                         break;
  894.                     case FONT_GOTHIC:
  895.                         CommandOutput(BJL_GOTHIC);
  896.                         break;
  897.                     case FONT_PRESTIGE:
  898.                         CommandOutput(BJL_PRESTIGE);
  899.                         break;
  900.                     case FONT_SCRIPT:
  901.                         CommandOutput(BJL_SCRIPT);
  902.                         break;
  903.                     case FONT_DRAFT:
  904.                         CommandOutput(BJL_DRAFT);
  905.                         break;
  906.                     case FONT_COURIER:
  907.                     default:
  908.                         CommandOutput(BJL_COURIER);
  909.                         break;
  910.                 }
  911.                 CommandOutput(BJL_LF);
  912.             }
  913.  
  914.             CommandOutput(BJL_CODE_PAGE);                  // 6. Code Page
  915.             switch(choice[a240+6][3])
  916.             {
  917.                 case '0':
  918.                     if(choice[a240+6][2] == '5')
  919.                         CommandOutput(BJL_850);
  920.                     else
  921.                         CommandOutput(BJL_860);
  922.                     break;
  923.                 case '3':
  924.                     CommandOutput(BJL_863);
  925.                     break;
  926.                 case '5':
  927.                     if(choice[a240+6][2] == '6')
  928.                         CommandOutput(BJL_865);
  929.                     else
  930.                         CommandOutput(BJL_855);
  931.                     break;
  932.                 case '2':
  933.                     CommandOutput(BJL_852);
  934.                     break;
  935.                 case '4':
  936.                     CommandOutput(BJL_864);
  937.                     break;
  938.                 case '9':
  939.                     CommandOutput(BJL_869);
  940.                     break;
  941.                 case '7':
  942.                 default:
  943.                     if(choice[a240+6][1] == '8')
  944.                         CommandOutput(BJL_857);
  945.                     else
  946.                         CommandOutput(BJL_437);
  947.                     break;
  948.             }
  949.             CommandOutput(BJL_LF);
  950.  
  951.             CommandOutput(BJL_PAGE_LENGTH);               // 7. Page Length
  952.             if(choice[a240+7][2] == '2')
  953.                 CommandOutput(BJL_12);
  954.             else
  955.                 CommandOutput(BJL_11);
  956.             CommandOutput(BJL_LF);
  957.  
  958.             CommandOutput(BJL_CHARACTER_SET);             // 8. Character Set
  959.             switch(choice[a240+8][5])
  960.             {
  961.                 case '2':
  962.                     CommandOutput(BJL_SET_2);
  963.                     break;
  964.                 case '1':
  965.                 default:
  966.                     CommandOutput(BJL_SET_1);
  967.                     break;
  968.             }
  969.             CommandOutput(BJL_LF);
  970.  
  971.             CommandOutput(BJL_TEXT_SCALE);                // 9. Text Scale Mode
  972.             if(choice[a240+9][1] == CHAR_ENABLE)
  973.                 CommandOutput(BJL_ON);
  974.             else
  975.                 CommandOutput(BJL_OFF);
  976.             CommandOutput(BJL_LF);
  977.  
  978.             CommandOutput(BJL_AUTOMATIC_LF);              // 11. Auto Line Feed (LF)
  979.             if(choice[a240+11][9] == '+')
  980.                 CommandOutput(BJL_ON);
  981.             else
  982.                 CommandOutput(BJL_OFF);
  983.             CommandOutput(BJL_LF);
  984.  
  985.             CommandOutput(BJL_AUTOMATIC_CR);              // 12. Auto Carriage Return (CR)
  986.             if(choice[a240+12][9] == '+')
  987.                 CommandOutput(BJL_ON);
  988.             else
  989.                 CommandOutput(BJL_OFF);
  990.             CommandOutput(BJL_LF);
  991.  
  992.             CommandOutput(BJL_AGM);                       // 13. Auto AGM
  993.             if(choice[a240+13][1] == CHAR_ENABLE)
  994.                 CommandOutput(BJL_ON);
  995.             else
  996.                 CommandOutput(BJL_OFF);
  997.             CommandOutput(BJL_LF);
  998.  
  999.             if((printerID == BJC80) || (printerID >= MPC2500))
  1000.             {
  1001.                 CommandOutput(BJL_PAPER_LOAD_POSITION);   // Top Margin
  1002.                 switch(choice[47][1])
  1003.                 {
  1004.                     case '1':
  1005.                         CommandOutput(BJL_10_0);
  1006.                         break;
  1007.                     case '5':
  1008.                         CommandOutput(BJL_5_0);
  1009.                         break;
  1010.                     case '8':
  1011.                         CommandOutput(BJL_8_5);
  1012.                         break;
  1013.                     case '3':
  1014.                     default:
  1015.                         CommandOutput(BJL_3_0);
  1016.                         break;
  1017.                 }
  1018.                 CommandOutput(BJL_LF);
  1019.  
  1020.                 CommandOutput(BJL_HOST_LOCK_OUT);           // Font Lock
  1021.                 if(choice[49][1] == CHAR_ENABLE)
  1022.                     CommandOutput(BJL_ON);
  1023.                 else
  1024.                     CommandOutput(BJL_OFF);
  1025.                 CommandOutput(BJL_LF);
  1026.             }
  1027.  
  1028.             CommandOutput(BJL_END_SETTINGS);
  1029.             CommandOutput(BJL_LF);
  1030. //
  1031.             CommandOutput(BJL_BEGIN_SETTINGS);            //// Start
  1032.             CommandOutput(BJL_LF);
  1033.  
  1034.             CommandOutput(BJL_CONTROL_MODE);              //// LQ Mode
  1035.             CommandOutput(BJL_CONTROL_LQ);
  1036.             CommandOutput(BJL_LF);
  1037.  
  1038.             if(printerID != BJC80)
  1039.             {
  1040.                 CommandOutput(BJL_SELECT_FONT);           // 16(5). Font
  1041.                 switch(choice[a240+16][FONT_ORDER])
  1042.                 {
  1043.                     case FONT_COURIER:
  1044.                         CommandOutput(BJL_COURIER);
  1045.                         break;
  1046.                     case FONT_GOTHIC:
  1047.                         CommandOutput(BJL_GOTHIC);
  1048.                         break;
  1049.                     case FONT_PRESTIGE:
  1050.                         CommandOutput(BJL_PRESTIGE);
  1051.                         break;
  1052.                     case FONT_SCRIPT:
  1053.                         CommandOutput(BJL_SCRIPT);
  1054.                         break;
  1055.                     case FONT_DRAFT:
  1056.                         CommandOutput(BJL_DRAFT);
  1057.                         break;
  1058.                     case FONT_ROMAN:
  1059.                     default:
  1060.                         CommandOutput(BJL_ROMAN);
  1061.                         break;
  1062.                 }
  1063.                 CommandOutput(BJL_LF);
  1064.             }
  1065.  
  1066.             CommandOutput(BJL_CODE_PAGE);                 // 17(6). Code Page
  1067.             switch(choice[a240+17][3])
  1068.             {
  1069.                 case '0':
  1070.                     if(choice[a240+17][2] == '5')
  1071.                         CommandOutput(BJL_850);
  1072.                     else
  1073.                         CommandOutput(BJL_860);
  1074.                     break;
  1075.                 case '3':
  1076.                     CommandOutput(BJL_863);
  1077.                     break;
  1078.                 case '5':
  1079.                     if(choice[a240+17][2] == '6')
  1080.                         CommandOutput(BJL_865);
  1081.                     else
  1082.                         CommandOutput(BJL_855);
  1083.                     break;
  1084.                 case '2':
  1085.                     CommandOutput(BJL_852);
  1086.                     break;
  1087.                 case '4':
  1088.                     CommandOutput(BJL_864);
  1089.                     break;
  1090.                 case '9':
  1091.                     CommandOutput(BJL_869);
  1092.                     break;
  1093.                 case '7':
  1094.                 default:
  1095.                     if(choice[a240+17][1] == '8')
  1096.                         CommandOutput(BJL_857);
  1097.                     else
  1098.                         CommandOutput(BJL_437);
  1099.                     break;
  1100.             }
  1101.             CommandOutput(BJL_LF);
  1102.  
  1103.             if((printerID != BJC80) && (printerID < MPC2500))
  1104.             {
  1105.                 CommandOutput(BJL_PAGE_LENGTH);           // 18(7). Page Length
  1106.                 if(choice[a240+18][1] == '2')
  1107.                     CommandOutput(BJL_22);
  1108.                 else if(choice[a240+18][2] == '2')
  1109.                     CommandOutput(BJL_12);
  1110.                 else
  1111.                     CommandOutput(BJL_11);
  1112.                 CommandOutput(BJL_LF);
  1113.             }
  1114.  
  1115.             CommandOutput(BJL_CHARACTER_SET);             // 19(8). Character Set
  1116.             switch(choice[a240+19][1])
  1117.             {
  1118.                 case CHAR_SET_ITALIC:
  1119.                     CommandOutput(BJL_ITALIC);
  1120.                     break;
  1121.                 case CHAR_SET_GRAPHIC:
  1122.                 default:
  1123.                     CommandOutput(BJL_GRAPHICS);
  1124.                     break;
  1125.             }
  1126.             CommandOutput(BJL_LF);
  1127.  
  1128.             CommandOutput(BJL_TEXT_SCALE);                // 20(9). Text Scale Mode
  1129.             if(choice[a240+20][1] == CHAR_ENABLE)
  1130.                 CommandOutput(BJL_ON);
  1131.             else
  1132.                 CommandOutput(BJL_OFF);
  1133.             CommandOutput(BJL_LF);
  1134.  
  1135.             CommandOutput(BJL_AUTOMATIC_LF);              // 21(11). Auto Line Feed (LF)
  1136.             if(choice[a240+21][9] == '+')
  1137.                 CommandOutput(BJL_ON);
  1138.             else
  1139.                 CommandOutput(BJL_OFF);
  1140.             CommandOutput(BJL_LF);
  1141.  
  1142.             CommandOutput(BJL_INTERNATIONAL_CHAR);        // 14. International Character Set
  1143.             switch(choice[a240+14][1])
  1144.             {
  1145.                 case 'J':
  1146.                     CommandOutput(BJL_JAPAN);
  1147.                     break;
  1148.                 case 'N':
  1149.                     CommandOutput(BJL_NORWAY);
  1150.                     break;
  1151.                 case 'D':
  1152.                     if(printerID == BJC80)
  1153.                         CommandOutput(BJL_DENMARK);
  1154.                     else
  1155.                     {
  1156.                         if(choice[a240+14][9] == '2')
  1157.                             CommandOutput(BJL_DENMARK_2);
  1158.                         else
  1159.                             CommandOutput(BJL_DENMARK_1);
  1160.                     }
  1161.                     break;
  1162.                 case 'S':
  1163.                     if(printerID == BJC80)
  1164.                     {
  1165.                         if(choice[a240+14][2] == 'p')
  1166.                             CommandOutput(BJL_SPAIN);
  1167.                         else
  1168.                             CommandOutput(BJL_SWEDEN);
  1169.                     }
  1170.                     else
  1171.                     {
  1172.                         switch(choice[a240+14][7])
  1173.                         {
  1174.                             case '2':
  1175.                                 CommandOutput(BJL_SPAIN_2);
  1176.                                 break;
  1177.                             case '1':
  1178.                                 CommandOutput(BJL_SPAIN_1);
  1179.                                 break;
  1180.                             case '7':
  1181.                             default:
  1182.                                 CommandOutput(BJL_SWEDEN);
  1183.                                 break;
  1184.                         }
  1185.                     }
  1186.                     break;
  1187.                 case 'L':
  1188.                     if(choice[a240+14][2] == 'a')
  1189.                         CommandOutput(BJL_LATIN_AMERICA);
  1190.                     else
  1191.                         CommandOutput(BJL_LEGAL);
  1192.                     break;
  1193.                 case 'K':
  1194.                     CommandOutput(BJL_KOREA);
  1195.                     break;
  1196.                 case 'F':
  1197.                     CommandOutput(BJL_FRANCE);
  1198.                     break;
  1199.                 case 'G':
  1200.                     CommandOutput(BJL_GERMANY);
  1201.                     break;
  1202.                 case 'I':
  1203.                     CommandOutput(BJL_ITALY);
  1204.                     break;
  1205.                 case 'U':
  1206.                 default:
  1207.                     if(choice[a240+14][3] == 'K')
  1208.                         CommandOutput(BJL_UK);
  1209.                     else
  1210.                         CommandOutput(BJL_USA);
  1211.                     break;
  1212.             }
  1213.             CommandOutput(BJL_LF);
  1214.  
  1215.             if((printerID == BJC80) || (printerID >= MPC2500))
  1216.             {
  1217.                 CommandOutput(BJL_PAPER_LOAD_POSITION);   // Top Margin
  1218.                 switch(choice[48][1])
  1219.                 {
  1220.                     case '1':
  1221.                         CommandOutput(BJL_10_0);
  1222.                         break;
  1223.                     case '5':
  1224.                         CommandOutput(BJL_5_0);
  1225.                         break;
  1226.                     case '8':
  1227.                         CommandOutput(BJL_8_5);
  1228.                         break;
  1229.                     case '3':
  1230.                     default:
  1231.                         CommandOutput(BJL_3_0);
  1232.                         break;
  1233.                 }
  1234.                 CommandOutput(BJL_LF);
  1235.  
  1236.                 CommandOutput(BJL_HOST_LOCK_OUT);           // Font Lock
  1237.                 if(choice[50][1] == CHAR_ENABLE)
  1238.                     CommandOutput(BJL_ON);
  1239.                 else
  1240.                     CommandOutput(BJL_OFF);
  1241.                 CommandOutput(BJL_LF);
  1242.             }
  1243.  
  1244.             CommandOutput(BJL_END_SETTINGS);
  1245.             CommandOutput(BJL_LF);
  1246.  
  1247. //
  1248.             CommandOutput(BJL_BEGIN_SETTINGS);            //// Start
  1249.             CommandOutput(BJL_LF);
  1250.  
  1251.             CommandOutput(BJL_CONTROL_MODE);              //// Common
  1252.             CommandOutput(BJL_CONTROL_COMMON);
  1253.             CommandOutput(BJL_LF);
  1254.  
  1255.             CommandOutput(BJL_PAPER_SIZE);                // 1. Paper Selection
  1256.             switch(choice[a240+1][PAPER_ORDER])
  1257.             {
  1258.                 case PAPER_A4:
  1259.                     CommandOutput(BJL_A4);
  1260.                     break;
  1261.                 case PAPER_B5:
  1262.                     CommandOutput(BJL_B5);
  1263.                     break;
  1264.                 case PAPER_10_ENVELOPE:
  1265.                     CommandOutput(BJL_10_ENVELOPE);
  1266.                     break;
  1267.                 case PAPER_DL_ENVELOPE:
  1268.                     CommandOutput(BJL_DL_ENVELOPE);
  1269.                     break;
  1270.                 case PAPER_LETTER:
  1271.                 default:
  1272.                     if(choice[a240+1][PAPER_ORDER_3] == PAPER_LEGAL)
  1273.                         CommandOutput(BJL_LEGAL);
  1274.                     else
  1275.                         CommandOutput(BJL_LETTER);
  1276.                     break;
  1277.             }
  1278.             CommandOutput(BJL_LF);
  1279.  
  1280.             CommandOutput(BJL_PRINT_MODE);                // 2. Print Mode
  1281.             if(choice[a240+2][1] == 'F')
  1282.                 CommandOutput(BJL_FINE);
  1283.             else if(choice[a240+2][6] == 'S')
  1284.                 CommandOutput(BJL_HS);
  1285.             else
  1286.                 CommandOutput(BJL_HQ);
  1287.             CommandOutput(BJL_LF);
  1288.  
  1289.             CommandOutput(BJL_SMOOTHING);                 // 3. Smoothing
  1290.             if(choice[a240+3][1] == CHAR_ENABLE)
  1291.                 CommandOutput(BJL_ON);
  1292.             else
  1293.                 CommandOutput(BJL_OFF);
  1294.             CommandOutput(BJL_LF);
  1295.  
  1296.             if((printerID >= BJC210) && (printerID <= BJC240))
  1297.             {
  1298.                 CommandOutput(BJL_SET_REDUCTION);         // 35. Reduction (A240 only)
  1299.                 switch(choice[45][REDUCTION_ORDER])
  1300.                 {
  1301.                     case REDUCTION_TWO_THIRDS:
  1302.                         CommandOutput(BJL_WIDE3);
  1303.                         break;
  1304.                     case REDUCTION_ONE_HALF:
  1305.                         CommandOutput(BJL_FORM1);
  1306.                         break;
  1307.                     case REDUCTION_DISABLE:
  1308.                     default:
  1309.                         CommandOutput(BJL_OFF);
  1310.                         break;
  1311.                 }
  1312.                 CommandOutput(BJL_LF);
  1313.             }
  1314.  
  1315.             if(printerID < MPC2500)
  1316.             {
  1317.                 if(printerID >= BJC240)
  1318.                 {
  1319.                     CommandOutput(BJL_AUTOMATIC_POWER_ON);      // 36. Auto Power On
  1320.                     if(choice[46][1] == CHAR_ENABLE)
  1321.                         CommandOutput(BJL_ENABLE);
  1322.                     else
  1323.                         CommandOutput(BJL_DISABLE);
  1324.                     CommandOutput(BJL_LF);
  1325.                 }
  1326.  
  1327.                 CommandOutput(BJL_AUTOMATIC_POWER_OFF);         // 4. Auto Power Off
  1328.                 switch(choice[a240+4][2])
  1329.                 {
  1330.                     case ' ':
  1331.                         CommandOutput(BJL_1);
  1332.                         break;
  1333.                     case '0':
  1334.                         switch(choice[a240+4][1])
  1335.                         {
  1336.                             case '1':
  1337.                                 CommandOutput(BJL_10);
  1338.                                 break;
  1339.                             case '3':
  1340.                                 CommandOutput(BJL_30);
  1341.                                 break;
  1342.                             case '6':
  1343.                             default:
  1344.                                 CommandOutput(BJL_60);
  1345.                                 break;
  1346.                         }
  1347.                         break;
  1348.                     case 'i':
  1349.                     default:
  1350.                         CommandOutput(BJL_DISABLE);
  1351.                         break;
  1352.                 }
  1353.                 CommandOutput(BJL_LF);
  1354.             }
  1355.  
  1356.             if(printerID == BJC80)
  1357.             {
  1358.                 CommandOutput(BJL_SELECT_FONT);                 // 16(5). Font ////BJC-80 only
  1359.                 switch(choice[a240+16][FONT_ORDER])
  1360.                 {
  1361.                     case FONT_COURIER:
  1362.                         CommandOutput(BJL_COURIER);
  1363.                         break;
  1364.                     case FONT_GOTHIC:
  1365.                         CommandOutput(BJL_GOTHIC);
  1366.                         break;
  1367.                     case FONT_PRESTIGE:
  1368.                         CommandOutput(BJL_PRESTIGE);
  1369.                         break;
  1370.                     case FONT_SCRIPT:
  1371.                         CommandOutput(BJL_SCRIPT);
  1372.                         break;
  1373.                     case FONT_DRAFT:
  1374.                         CommandOutput(BJL_DRAFT);
  1375.                         break;
  1376.                     case FONT_ROMAN:
  1377.                     default:
  1378.                         CommandOutput(BJL_ROMAN);
  1379.                         break;
  1380.                 }
  1381.                 CommandOutput(BJL_LF);
  1382.             }
  1383.  
  1384.             CommandOutput(BJL_SWITCH_BUFFERS);                  // 10. Download Buffer
  1385.             if(choice[a240+10][1] == CHAR_ENABLE)
  1386.                 CommandOutput(BJL_DOWNLOAD);
  1387.             else
  1388.                 CommandOutput(BJL_INPUT);
  1389.             CommandOutput(BJL_LF);
  1390.  
  1391.             CommandOutput(BJL_END_SETTINGS);
  1392.             CommandOutput(BJL_LF);
  1393.         }
  1394.     }
  1395.  
  1396.     sed_Close(window_2_1);
  1397.  
  1398.     sed_ToggleExit(window_1);                        // Quit this window
  1399.     sed_SetNextWin(window_1, sed_GetWin(sedlist[3]));
  1400.     kb_Stuff(FN6);
  1401.  
  1402.     return(TRUE);
  1403. }
  1404.  
  1405. // *********************************************************************************
  1406. //  function name   : void CommandOutput(unsigned char *,unsigned int,unsigned int,unsigned int)
  1407. //  function        : output commands
  1408. //  input           : unsigned char     *commandBJL    : command code
  1409. //                    unsigned int       commandLen    : number of command length
  1410. //                    unsigned int       commandPar    : number of parameter     ; no 0
  1411. //                    unsigned int       commandNV     : NV-RAM store 1          ; not 0
  1412. //  output          : void
  1413. // *********************************************************************************
  1414. void CommandOutput
  1415.     (
  1416.     unsigned char  *commandBJL,
  1417.     unsigned int    commandLen,
  1418.     unsigned int    commandPer,
  1419.     unsigned int    commandNV
  1420.     )
  1421. {
  1422.     while(commandLen-- > 0)
  1423.     {
  1424.         _bios_printer((unsigned int)_WRITE, (unsigned int)port, (unsigned int)*commandBJL);
  1425.         *commandBJL++;
  1426.     }
  1427.  
  1428.     if(commandPer)
  1429.         CommandOutput(BJL_EQU);
  1430.  
  1431. #if 0
  1432.     if(commandNV)
  1433.         ;
  1434. #endif
  1435. }
  1436.  
  1437. // ***********************************************************************
  1438. //  function name   : int MenuBar3(VOID *sdata, int idata)
  1439. //  function        : Display printer's status (Menu Bar)
  1440. //  input           : VOID            *sdata
  1441. //                  : int             idata           // NOT use
  1442. //  output          : TRUE                            // move
  1443. // ***********************************************************************
  1444. int MenuBar3(VOID *sdata, int idata)
  1445. {
  1446.     PrinterCheck(0);
  1447.  
  1448.     sed_ToggleExit(window_1);                        // Quit this window
  1449.     sed_SetNextWin(window_1, sed_GetWin(sedlist[3]));
  1450.     kb_Stuff(FN5);
  1451.  
  1452.     return(TRUE);
  1453. }
  1454.  
  1455. // ***********************************************************************
  1456. //  function name   : int MenuBar4(VOID *sdata, int idata)
  1457. //  function        : Change the default settings (Menu Bar)
  1458. //  input           : VOID            *sdata
  1459. //                  : int             idata           // NOT use
  1460. //  output          : TRUE                            // move
  1461. // ***********************************************************************
  1462. int MenuBar4(VOID *sdata, int idata)
  1463. {
  1464.     menu_type   menu_4_1;
  1465.     sed_type    window_4_1;
  1466.  
  1467.     menu_4_1 = menu_Open();
  1468.     menu_Printf(menu_4_1, MENU_4_OK, NULL, &gmenu_funcs, NULL, OKAY_STR);
  1469.     menu_Printf(menu_4_1, MENU_4_CA, NULL, &gmenu_funcs, NULL, CANCEL_STR);
  1470.  
  1471.     window_4_1 = sed_Open(menu_4_1);
  1472.     switch(colors)
  1473.     {
  1474.         case BW_COLOR:                                                  // Monochrome
  1475.             sed_SetColors(window_4_1, WHITE_BLACK, WHITE_BLACK, BLACK_WHITE);
  1476.             break;
  1477.         case SVGA_COLOR:                                                // Super VGA
  1478.             sed_SetColors(window_4_1, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
  1479.             break;
  1480.         default:
  1481.         case CO_COLOR:                                                  // Graphics
  1482.             sed_SetColors(window_4_1, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
  1483.             break;
  1484.     }
  1485.     sed_SetShadow(window_4_1, 1);
  1486.     win_SetMouse(window_4_1, winmou_All);
  1487.     win_SetMouseFeature(window_4_1, MOUF_GREEDY);
  1488.  
  1489.     sed_SetBorder(window_4_1, bd_cua);
  1490.     bord_SetTitle(window_4_1, MENU_4_T);
  1491.     bord_SetFeature(window_4_1, BD_TOP | BD_TITLE | BD_OUTLINE | BD_PROMPT | BD_MOVE);
  1492.     sed_SetPosition(window_4_1, 6, 26);
  1493.  
  1494.     sed_Repaint(window_4_1);
  1495.  
  1496.     if(sed_Go(window_4_1) == OKAY)
  1497.     {
  1498.         if(printerID == BJC80)
  1499.             memcpy(choice, choice_US_BJ, WIN4_BUFF);
  1500.         else
  1501.             memcpy(choice, choice_default, WIN4_BUFF);
  1502.  
  1503.         choice_old = (byte)NULL;
  1504.         Win4_Menu(1);
  1505.     }
  1506.  
  1507.     sed_Close(window_4_1);
  1508.  
  1509.     sed_ToggleExit(window_1);                        // Quit this window
  1510.     sed_SetNextWin(window_1, sed_GetWin(sedlist[3]));
  1511.     kb_Stuff(FN7);
  1512.  
  1513.     return(TRUE);
  1514. }
  1515.  
  1516. // ***********************************************************************
  1517. //  function name   : int MenuBar5(VOID *sdata, int idata)
  1518. //  function        : Display this program's help (Menu Bar)
  1519. //  input           : VOID            *sdata
  1520. //                  : int             idata           // NOT use
  1521. //  output          : TRUE                            // move
  1522. // ***********************************************************************
  1523. int MenuBar5(VOID *sdata, int idata)
  1524. {
  1525.     menu_type   menu_5_1;
  1526.     sed_type    window_5_1;
  1527.  
  1528.     menu_5_1 = menu_Open();
  1529.     menu_Printf(menu_5_1, MENU_5_1);
  1530.     menu_Printf(menu_5_1, MENU_5_2);
  1531.     menu_Printf(menu_5_1, MENU_5_3);
  1532.     menu_Printf(menu_5_1, MENU_5_OK, NULL, &menu_funcs);
  1533.  
  1534.     window_5_1 = sed_Open(menu_5_1);
  1535.     switch(colors)
  1536.     {
  1537.         case BW_COLOR:                                                  // Monochrome
  1538.             sed_SetColors(window_5_1, WHITE_BLACK, WHITE_BLACK, BLACK_WHITE);
  1539.             break;
  1540.         case SVGA_COLOR:                                                // Super VGA
  1541.             sed_SetColors(window_5_1, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
  1542.             break;
  1543.         default:
  1544.         case CO_COLOR:                                                  // Graphics
  1545.             sed_SetColors(window_5_1, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
  1546.             break;
  1547.     }
  1548.     sed_SetShadow(window_5_1, 1);
  1549.     win_SetMouse(window_5_1, winmou_All);
  1550.     win_SetMouseFeature(window_5_1, MOUF_GREEDY);
  1551.  
  1552.     sed_SetBorder(window_5_1, bd_cua);
  1553.     bord_SetTitle(window_5_1, MENU_5_T);
  1554.     bord_SetFeature(window_5_1, BD_TOP | BD_TITLE | BD_OUTLINE | BD_MOVE);
  1555.     sed_SetPosition(window_5_1, 6, 16);
  1556.  
  1557.     sed_Repaint(window_5_1);
  1558.     sed_Go(window_5_1);
  1559.     sed_Close(window_5_1);
  1560.  
  1561.     sed_ToggleExit(window_1);                        // Quit this window
  1562.     sed_SetNextWin(window_1, sed_GetWin(sedlist[3]));
  1563.     kb_Stuff(FN9);
  1564.  
  1565.     return(TRUE);
  1566. }
  1567.  
  1568. // ***********************************************************************
  1569. //  function name   : void PrinterCheck(int check)
  1570. //  function        : check the printer
  1571. //  input           : int         check      : 0 - Full check (for status)
  1572. //                  :                        : 1 - Busy check only (for send)
  1573. //  output          : int                    : FALSE - NG
  1574. //                                           : TRUE - OK
  1575. // ***********************************************************************
  1576. int PrinterCheck(int check)
  1577. {
  1578.     menu_type           menu_p_check;
  1579.     sed_type            window_p_check;
  1580.  
  1581.     unsigned int        status;                          // printer's status
  1582.     int                 err = 0;
  1583.  
  1584.     if(choice[a240+15][4] == '2')                        // Printer Port
  1585.         port = LPT2;
  1586.     else
  1587.         port = LPT1;
  1588.  
  1589.     status = _bios_printer((unsigned int)_STATUS, (unsigned int)port, (unsigned int)NULL);
  1590.  
  1591.     if(check)
  1592.     {
  1593.         if((!(status&PRINTER_TIME_OUT))&(!(status&PRINTER_I_O_ERROR))&(!(status&PRINTER_OUT_OF_PAPER)))
  1594.             return(TRUE);
  1595.     }
  1596.  
  1597.     menu_p_check = menu_Open();
  1598.     menu_Printf(menu_p_check, "\n");
  1599.  
  1600.     if(status&PRINTER_TIME_OUT)                        // Printer timed out
  1601.     {
  1602.         menu_Printf(menu_p_check, "   !%s   \n   -%s  \n\n", &ErrorMsg[0][0], &PRINTER_ERROR);
  1603.         err = 1;
  1604.     }
  1605.     if(status&PRINTER_NOT_USED1)                       // Not used
  1606.     {
  1607.         menu_Printf(menu_p_check, "   !%s   \n   -%s  \n\n", &ErrorMsg[1][0], &PRINTER_ERROR);
  1608.         err = 1;
  1609.     }
  1610.     if(status&PRINTER_NOT_USED2)                       // Not used
  1611.     {
  1612.         menu_Printf(menu_p_check, "   !%s   \n   -%s  \n\n", &ErrorMsg[2][0], &PRINTER_ERROR);
  1613.         err = 1;
  1614.     }
  1615.     if(status&PRINTER_I_O_ERROR)                       // I/O error
  1616.     {
  1617.         menu_Printf(menu_p_check, "   !%s   \n   -%s  \n\n", &ErrorMsg[3][0], &PRINTER_ERROR);
  1618.         err = 1;
  1619.     }
  1620.     if(status&PRINTER_OUT_OF_PAPER)                    // Out of paper
  1621.     {
  1622.         menu_Printf(menu_p_check, "   !%s   \n   -%s  \n\n", &ErrorMsg[5][0], &PRINTER_ERROR);
  1623.         err = 1;
  1624.     }
  1625. //
  1626.  
  1627.     if((!check)&(!err))
  1628.     {
  1629.         if(status&PRINTER_SELECTED)                     // Printer selected
  1630.             menu_Printf(menu_p_check, "   *%s   \n", &ErrorMsg[4][0]);
  1631.         if(status&PRINTER_ACKNOWLEDGE)                  // Acknowledge
  1632.             menu_Printf(menu_p_check, "   *%s   \n", &ErrorMsg[6][0]);
  1633.         if(status&PRINTER_NOT_BUSY)                     // Printer not busy
  1634.             menu_Printf(menu_p_check, "   *%s   \n", &ErrorMsg[7][0]);
  1635.         if(status&(!PRINTER_NO_ERROR))                  // Printer NO Error
  1636.             menu_Printf(menu_p_check, "   *%s   \n", &ErrorMsg[8][0]);
  1637.     }
  1638.  
  1639.     menu_Printf(menu_p_check, MENU_3_OK2, NULL, &menu_funcs);
  1640.     window_p_check = sed_Open(menu_p_check);
  1641.     switch(colors)
  1642.     {
  1643.         case BW_COLOR:                                                      // Monochrome
  1644.             sed_SetColors(window_p_check, WHITE_BLACK, WHITE_BLACK, BLACK_LCYAN);
  1645.             break;
  1646.         case SVGA_COLOR:                                                    // Super VGA
  1647.             sed_SetColors(window_p_check, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
  1648.             break;
  1649.         default:
  1650.         case CO_COLOR:                                                      // Graphics
  1651.             sed_SetColors(window_p_check, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
  1652.             break;
  1653.     }
  1654.     sed_SetShadow(window_p_check, 1);
  1655.     win_SetMouse(window_p_check, winmou_All);
  1656.     win_SetMouseFeature(window_p_check, MOUF_GREEDY);
  1657.  
  1658.     sed_SetBorder(window_p_check, bd_cua);
  1659.     bord_SetTitle(window_p_check, MENU_3_T);
  1660.     bord_SetFeature(window_p_check, BD_TOP | BD_TITLE | BD_OUTLINE | BD_PROMPT | BD_MOVE);
  1661.     sed_SetPosition(window_p_check, 6, 20);
  1662.  
  1663.     sed_Repaint(window_p_check);
  1664.     sed_Go(window_p_check);
  1665.     sed_Close(window_p_check);
  1666.  
  1667.     return(FALSE);
  1668. }
  1669.  
  1670. // ***********************************************************************
  1671. //  function name   : int ConfirmDelete(void)
  1672. //  function        : confirm the delete menu box
  1673. //  input           : char    *file            : file name
  1674. //  output          : TRUE    -> delete
  1675. //                  : FALSE   -> NOT delete
  1676. // ***********************************************************************
  1677. int ConfirmDelete(char *file)
  1678. {
  1679.     menu_type   menu_2_delete;
  1680.     sed_type    window_2_delete;
  1681.  
  1682.     menu_2_delete = menu_Open();
  1683.     menu_Printf(menu_2_delete, MENU_2_D_F,  &file[0]);
  1684.     menu_Printf(menu_2_delete, MENU_2_D_OK, NULL, &gmenu_funcs, NULL, OKAY_STR);
  1685.     menu_Printf(menu_2_delete, MENU_2_D_CA, NULL, &gmenu_funcs, NULL, CANCEL_STR);
  1686.  
  1687.     window_2_delete = sed_Open(menu_2_delete);
  1688.     switch(colors)
  1689.     {
  1690.         case BW_COLOR:                                                      // Monochrome
  1691.             sed_SetColors(window_2_delete, WHITE_BLACK, WHITE_BLACK, BLACK_WHITE);
  1692.             break;
  1693.         case SVGA_COLOR:                                                    // Super VGA
  1694.             sed_SetColors(window_2_delete, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
  1695.             break;
  1696.         default:
  1697.         case CO_COLOR:                                                      // Graphics
  1698.             sed_SetColors(window_2_delete, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
  1699.             break;
  1700.     }
  1701.     sed_SetShadow(window_2_delete, 1);
  1702.     win_SetMouse(window_2_delete, winmou_All);
  1703.     win_SetMouseFeature(window_2_delete, MOUF_GREEDY);
  1704.  
  1705.     sed_SetBorder(window_2_delete, bd_cua);
  1706.     bord_SetTitle(window_2_delete, MENU_2_D_T);
  1707.     bord_SetFeature(window_2_delete, BD_TOP | BD_TITLE | BD_OUTLINE | BD_PROMPT | BD_MOVE);
  1708.     sed_Center(window_2_delete);
  1709.  
  1710.     sed_Repaint(window_2_delete);
  1711.  
  1712.     if(sed_Go(window_2_delete) == OKAY)
  1713.     {
  1714.         sed_Close(window_2_delete);
  1715.         return(TRUE);
  1716.     }
  1717.     else
  1718.     {
  1719.         sed_Close(window_2_delete);
  1720.         return(FALSE);
  1721.     }
  1722. }
  1723.  
  1724. // create the windows 4 ------------------------------------------------------------------------
  1725. // *********************************************************************************
  1726. //  function name   : void Win4_Menu(int first)
  1727. //  function        : window 3 pop up menu
  1728. //  input           : int        first        : 0 -> first, 1 -> NOT first, 2 -> special
  1729. //  output          : TRUE                    : 1
  1730. // *********************************************************************************
  1731. int Win4_Menu(int first)
  1732. {
  1733.     menu_type     menu_4;
  1734.     int           autoPowerOn, reduction, topMargin;
  1735.  
  1736.     if(choice_old == choice[a240][1])
  1737.         return(TRUE);
  1738.  
  1739.     if(first)
  1740.         sed_Close(window_4);
  1741.  
  1742.     topMargin = 0;
  1743.     if((printerID >= BJC240) && (printerID < MPC2500))
  1744.         autoPowerOn = 1;
  1745.     else
  1746.         autoPowerOn = 0;
  1747.  
  1748.     if((printerID >= BJC210) && (printerID <= BJC240))
  1749.         reduction = 1;
  1750.     else
  1751.         reduction = 0;
  1752.  
  1753.     menu_4 = menu_Open();
  1754.  
  1755.     menu_Printf(            menu_4, WINDOW_4_0,      &choice[a240][0]);
  1756.     if(printerID == BJC80)
  1757.     {
  1758.         menu_Printf(        menu_4, WINDOW_4_1,      &choice[a240+1][0],     &list_funcs,    WINDOW_4_5_H, WINDOW_4_1_80) ; // Paper size
  1759.         topMargin = 2;
  1760.     }
  1761.     else if(printerID >= MPC2500)
  1762.     {
  1763.         menu_Printf(        menu_4, WINDOW_4_1,      &choice[a240+1][0],     &list_funcs,    WINDOW_4_5_H, WINDOW_4_1_2500);
  1764.         topMargin = 1;
  1765.     }
  1766.     else
  1767.         menu_Printf(        menu_4, WINDOW_4_1,      &choice[a240+1][0],     &list_funcs,    WINDOW_4_5_H, WINDOW_4_1_S) ;
  1768.  
  1769.     if((printerID == BJC210) || (printerID == BJC240))
  1770.         menu_Printf(        menu_4, WINDOW_4_2,      &choice[a240+2][0],     &list_funcs,    WINDOW_4_5_H, WINDOW_4_2_240); // Print Mode
  1771.     else
  1772.         menu_Printf(        menu_4, WINDOW_4_2,      &choice[2][0],          &list_funcs,    WINDOW_4_5_H, WINDOW_4_2_S) ;
  1773.  
  1774.     menu_Printf(            menu_4, WINDOW_4_3,      &choice[a240+3][0],     &list_funcs,    WINDOW_4_5_H, WINDOW_4_3_S) ;
  1775.  
  1776.     if(reduction)
  1777.         menu_Printf(        menu_4, WINDOW_4_35,     &choice[45][0],         &list_funcs,    WINDOW_4_5_H, WINDOW_4_35_S);
  1778.  
  1779.     if(printerID < MPC2500)
  1780.     {
  1781.         if(autoPowerOn)
  1782.             menu_Printf(    menu_4, WINDOW_4_36,     &choice[46][0],         &list_funcs,    WINDOW_4_5_H, WINDOW_4_3_S) ; // Auto Power On
  1783.  
  1784.         if(printerID == BJC80)
  1785.             menu_Printf(    menu_4, WINDOW_4_4,      &choice[a240+4][0],     &list_funcs,    WINDOW_4_5_H, WINDOW_4_4_80); // Auto Power Off
  1786.         else
  1787.             menu_Printf(    menu_4, WINDOW_4_4,      &choice[a240+4][0],     &list_funcs,    WINDOW_4_5_H, WINDOW_4_4_S) ; // Auto Power Off
  1788.     }
  1789.  
  1790.     if(choice[a240][1] == BUBBLE_JET)
  1791.     {
  1792.         if((printerID == BJC80) || (printerID >= MPC2500))
  1793.             menu_Printf(    menu_4, WINDOW_4_5_B,    &choice[a240+5][0],     &list_funcs,    WINDOW_4_6_H, WINDOW_4_5_80) ;
  1794.         else
  1795.             menu_Printf(    menu_4, WINDOW_4_5_B,    &choice[a240+5][0],     &list_funcs,    WINDOW_4_6_H, WINDOW_4_5_S) ;
  1796.  
  1797.         if(printerID == BJC4100)
  1798.             menu_Printf(    menu_4, WINDOW_4_6_B,    &choice[6][0],          &list_funcs,    WINDOW_4_6_H, WINDOW_4_6_S) ;
  1799.         else if((printerID == BJC80) || (printerID >= MPC2500))
  1800.             menu_Printf(    menu_4, WINDOW_4_6_B,    &choice[6][0],          &list_funcs,    WINDOW_4_6_H, WINDOW_4_6_80);
  1801.         else
  1802.             menu_Printf(    menu_4, WINDOW_4_6_B,    &choice[a240+6][0],     &list_funcs,    WINDOW_4_6_H, WINDOW_4_6_240);
  1803.  
  1804.         if((printerID == BJC80) || (printerID >= MPC2500))
  1805.             menu_Printf(    menu_4, WINDOW_4_7_B,    &choice[a240+7][0],     &list_funcs,    WINDOW_4_2_H, WINDOW_4_7_S1); // Page Length
  1806.         else
  1807.             menu_Printf(    menu_4, WINDOW_4_7_B,    &choice[a240+7][0],     &list_funcs,    WINDOW_4_6_H, WINDOW_4_7_S1); // Page Length
  1808.  
  1809.         menu_Printf(        menu_4, WINDOW_4_8_B,    &choice[a240+8][0],     &list_funcs,    WINDOW_4_6_H, WINDOW_4_8_S1);
  1810.         menu_Printf(        menu_4, WINDOW_4_9_B,    &choice[a240+9][0],     &list_funcs,    WINDOW_4_6_H, WINDOW_4_3_S) ;
  1811.         menu_Printf(        menu_4, WINDOW_4_10,     &choice[a240+10][0],    &list_funcs,    WINDOW_4_5_H, WINDOW_4_3_S) ;
  1812.         menu_Printf(        menu_4, WINDOW_4_11_B,   &choice[a240+11][0],    &list_funcs,    WINDOW_4_6_H, WINDOW_4_11_S);
  1813.         menu_Printf(        menu_4, WINDOW_4_12,     &choice[a240+12][0],    &list_funcs,    WINDOW_4_2_H, WINDOW_4_12_S);
  1814.         menu_Printf(        menu_4, WINDOW_4_13,     &choice[a240+13][0],    &list_funcs,    WINDOW_4_2_H, WINDOW_4_3_S) ;
  1815.         menu_Printf(        menu_4, WINDOW_4_14_C,   NULL,                   &click_funcs,   WINDOW_4_3_H) ;
  1816.         if((printerID == BJC80) || (printerID >= MPC2500))
  1817.         {
  1818.             menu_Printf(    menu_4, WINDOW_4_TOP_B,  &choice[47][0],         &list_funcs,    WINDOW_4_6_H, WINDOW_4_TOP_S); // BJ Top Margin
  1819.             menu_Printf(    menu_4, WINDOW_4_LOCK_B, &choice[49][0],         &list_funcs,    WINDOW_4_6_H, WINDOW_4_3_S)  ; // BJ Host Lock
  1820.         }
  1821.     }
  1822.     else
  1823.     {
  1824.         if((printerID == BJC80) || (printerID >= MPC2500))
  1825.             menu_Printf(    menu_4, WINDOW_4_5_L,    &choice[a240+16][0],    &list_funcs,    WINDOW_4_6_H, WINDOW_4_5_80);
  1826.         else
  1827.             menu_Printf(    menu_4, WINDOW_4_5_L,    &choice[a240+16][0],    &list_funcs,    WINDOW_4_6_H, WINDOW_4_5_S) ;
  1828.  
  1829.         if(printerID == BJC4100)
  1830.             menu_Printf(    menu_4, WINDOW_4_6_L,    &choice[17][0],         &list_funcs,    WINDOW_4_6_H, WINDOW_4_6_S) ;
  1831.         else if((printerID == BJC80) || (printerID >= MPC2500))
  1832.             menu_Printf(    menu_4, WINDOW_4_6_L,    &choice[17][0],         &list_funcs,    WINDOW_4_6_H, WINDOW_4_6_80);
  1833.         else
  1834.             menu_Printf(    menu_4, WINDOW_4_6_L,    &choice[a240+17][0],    &list_funcs,    WINDOW_4_6_H, WINDOW_4_6_240);
  1835.  
  1836.         if((printerID == BJC80) || (printerID >= MPC2500))
  1837.             menu_Printf(    menu_4, WINDOW_4_7_L_80, NULL,                   &click_funcs,   WINDOW_4_2_H);                // Page Length
  1838.         else
  1839.             menu_Printf(    menu_4, WINDOW_4_7_L,    &choice[a240+18][0],    &list_funcs,    WINDOW_4_6_H, WINDOW_4_7_S0); // Page Length
  1840.  
  1841.         menu_Printf(        menu_4, WINDOW_4_8_L,    &choice[a240+19][0],    &list_funcs,    WINDOW_4_6_H, WINDOW_4_8_S0);
  1842.         menu_Printf(        menu_4, WINDOW_4_9_L,    &choice[a240+20][0],    &list_funcs,    WINDOW_4_6_H, WINDOW_4_3_S) ;
  1843.         menu_Printf(        menu_4, WINDOW_4_10,     &choice[a240+10][0],    &list_funcs,    WINDOW_4_5_H, WINDOW_4_3_S) ;
  1844.         menu_Printf(        menu_4, WINDOW_4_11_L,   &choice[a240+21][0],    &list_funcs,    WINDOW_4_6_H, WINDOW_4_11_S);
  1845.         menu_Printf(        menu_4, WINDOW_4_12_C,   NULL,                   &click_funcs,   WINDOW_4_2_H) ;
  1846.         menu_Printf(        menu_4, WINDOW_4_13_C,   NULL,                   &click_funcs,   WINDOW_4_2_H) ;
  1847.         if(printerID == BJC80)
  1848.             menu_Printf(    menu_4, WINDOW_4_14,     &choice[a240+14][0],    &list_funcs,    WINDOW_4_3_H, WINDOW_4_14_80);
  1849.         else
  1850.             menu_Printf(    menu_4, WINDOW_4_14,     &choice[a240+14][0],    &list_funcs,    WINDOW_4_3_H, WINDOW_4_14_S);
  1851.         if((printerID == BJC80) || (printerID >= MPC2500))
  1852.         {
  1853.             menu_Printf(    menu_4, WINDOW_4_TOP_L,  &choice[48][0],         &list_funcs,    WINDOW_4_6_H, WINDOW_4_TOP_S); // LQ Top Margin
  1854.             menu_Printf(    menu_4, WINDOW_4_LOCK_L, &choice[50][0],         &list_funcs,    WINDOW_4_6_H, WINDOW_4_3_S)  ; // LQ Host Lock
  1855.         }
  1856.     }
  1857.  
  1858.     menu_Printf(            menu_4, WINDOW_4_15,     &choice[a240+15][0],    &list_funcs,    WINDOW_4_4_H, WINDOW_4_15_S);  // Printer Port
  1859.  
  1860.     window_4 = sed_Open(menu_4);
  1861.     switch(colors)
  1862.     {
  1863.         case BW_COLOR:                                              // Monochrome
  1864.             sed_SetColors(window_4, WHITE_BLACK, BLACK_WHITE, BLACK_LCYAN);
  1865.             break;
  1866.         case SVGA_COLOR:                                            // Super VGA
  1867.             sed_SetColors(window_4, CYAN_BLACK, CYAN_WHITE, BLACK_CYAN);
  1868.             break;
  1869.         default:
  1870.         case CO_COLOR:                                              // Graphics
  1871.             sed_SetColors(window_4, CYAN_BLACK, CYAN_GRAY, BLACK_CYAN);
  1872.             break;
  1873.     }
  1874.  
  1875.     sed_SetBorder(window_4, bd_cua);
  1876.     sed_SetBorderFeature(window_4, BD_TITLE | BD_OUTLINE | BD_TOP | BD_PROMPT);
  1877.  
  1878.     sed_SetBorderTitle(window_4, WINDOW_4_TITLE);
  1879.     sed_SetPosition(window_4, 4, 29);
  1880.     sed_SetHeight(window_4, autoPowerOn+reduction+topMargin+16);
  1881.     sed_SetWidth(window_4, 47);
  1882.     sed_SetShadow(window_4, 1);
  1883.     sed_SetShadowAttr(window_4, BK_COLOR3);
  1884.     sed_SetLabel(window_4, 4);
  1885.  
  1886.     // Attach a mouse handler to the sed
  1887.     win_SetMouse(window_4, winmou_All);
  1888.     win_SetMouseFeature(window_4, MOUF_TRACK);
  1889.  
  1890.     sed_Repaint(window_4);
  1891.  
  1892.     choice_old = choice[a240][1];
  1893.  
  1894.     sedlist[2] = window_4;
  1895.     sed_SetSpecial(window_4, spc_Jump);
  1896.     sed_SetAux(window_4, aux_Top);
  1897.  
  1898.     return(TRUE);
  1899. }
  1900.  
  1901. // create the windows 3 ------------------------------------------------------------------------
  1902. // *********************************************************************************
  1903. //  function name   : void Win3_Menu_Printer(void)
  1904. //  function        : window 3 pop up menu
  1905. //  input           : void
  1906. //  output          : TRUE                    : 1
  1907. // *********************************************************************************
  1908. int Win3_Menu_Printer(void)
  1909. {
  1910.     int height;
  1911.  
  1912.     height = 9;
  1913.  
  1914.     switch(printerID)
  1915.     {
  1916.         case MPC2500:
  1917.         case MPC30:
  1918. //        case B380IF:        // SK, 5/15/96  
  1919.         case BJC4100:
  1920.             switch(colors)
  1921.             {
  1922.                 case BW_COLOR:                                                                  // Monochrome
  1923.                     window_3 = slug_Open(win3_menu, SLUG_VERTICAL, bd_cua, WHITE_BLACK, BLACK_LCYAN, BLACK_WHITE);
  1924.                     break;
  1925.                 case SVGA_COLOR:                                                                // Super VGA
  1926.                     window_3 = slug_Open(win3_menu, SLUG_VERTICAL, bd_cua, GREEN_BLACK, WHITE_GREEN, GREEN_WHITE);
  1927.                     break;
  1928.                 default:
  1929.                 case CO_COLOR:                                                                  // Graphics
  1930.                     window_3 = slug_Open(win3_menu, SLUG_VERTICAL, bd_cua, GREEN_BLACK, GRAY_GREEN, GREEN_GRAY);
  1931.                     break;
  1932.             }
  1933.             break;
  1934.  
  1935.         case B380IF:        // SK, 5/15/96; to remove Test Print option
  1936.             switch(colors)
  1937.             {
  1938.                 case BW_COLOR:                                                                  // Monochrome
  1939.                     window_3 = slug_Open(win3_menu_B380IF, SLUG_VERTICAL, bd_cua, WHITE_BLACK, BLACK_LCYAN, BLACK_WHITE);
  1940.                     break;
  1941.                 case SVGA_COLOR:                                                                // Super VGA
  1942.                     window_3 = slug_Open(win3_menu_B380IF, SLUG_VERTICAL, bd_cua, GREEN_BLACK, WHITE_GREEN, GREEN_WHITE);
  1943.                     break;
  1944.                 default:
  1945.                 case CO_COLOR:                                                                  // Graphics
  1946.                     window_3 = slug_Open(win3_menu_B380IF, SLUG_VERTICAL, bd_cua, GREEN_BLACK, GRAY_GREEN, GREEN_GRAY);
  1947.                     break;
  1948.             }
  1949.             break;
  1950.  
  1951.         case BJC4200:
  1952.         case BJC4550:
  1953.             height++;
  1954.             switch(colors)
  1955.             {
  1956.                 case BW_COLOR:                                                                  // Monochrome
  1957.                     window_3 = slug_Open(win3_menu_4200, SLUG_VERTICAL, bd_cua, WHITE_BLACK, BLACK_LCYAN, BLACK_WHITE);
  1958.                     break;
  1959.                 case SVGA_COLOR:                                                                // Super VGA
  1960.                     window_3 = slug_Open(win3_menu_4200, SLUG_VERTICAL, bd_cua, GREEN_BLACK, WHITE_GREEN, GREEN_WHITE);
  1961.                     break;
  1962.                 default:
  1963.                 case CO_COLOR:                                                                  // Graphics
  1964.                     window_3 = slug_Open(win3_menu_4200, SLUG_VERTICAL, bd_cua, GREEN_BLACK, GRAY_GREEN, GREEN_GRAY);
  1965.                     break;
  1966.             }
  1967.             break;
  1968.  
  1969.         case BJC210:
  1970.             switch(colors)
  1971.             {
  1972.                 case BW_COLOR:                                                                  // Monochrome
  1973.                     window_3 = slug_Open(win3_menu_210, SLUG_VERTICAL, bd_cua, WHITE_BLACK, BLACK_LCYAN, BLACK_WHITE);
  1974.                     break;
  1975.                 case SVGA_COLOR:                                                                // Super VGA
  1976.                     window_3 = slug_Open(win3_menu_210, SLUG_VERTICAL, bd_cua, GREEN_BLACK, WHITE_GREEN, GREEN_WHITE);
  1977.                     break;
  1978.                 default:
  1979.                 case CO_COLOR:                                                                  // Graphics
  1980.                     window_3 = slug_Open(win3_menu_210, SLUG_VERTICAL, bd_cua, GREEN_BLACK, GRAY_GREEN, GREEN_GRAY);
  1981.                     break;
  1982.             }
  1983.             break;
  1984.  
  1985.         case BJC240:
  1986.             height++;
  1987.             switch(colors)
  1988.             {
  1989.                 case BW_COLOR:                                                                  // Monochrome
  1990.                     window_3 = slug_Open(win3_menu_240, SLUG_VERTICAL, bd_cua, WHITE_BLACK, BLACK_LCYAN, BLACK_WHITE);
  1991.                     break;
  1992.                 case SVGA_COLOR:                                                                // Super VGA
  1993.                     window_3 = slug_Open(win3_menu_240, SLUG_VERTICAL, bd_cua, GREEN_BLACK, WHITE_GREEN, GREEN_WHITE);
  1994.                     break;
  1995.                 default:
  1996.                 case CO_COLOR:                                                                  // Graphics
  1997.                     window_3 = slug_Open(win3_menu_240, SLUG_VERTICAL, bd_cua, GREEN_BLACK, GRAY_GREEN, GREEN_GRAY);
  1998.                     break;
  1999.             }
  2000.             break;
  2001.  
  2002.         case BJC80:
  2003.             switch(colors)
  2004.             {
  2005.                 case BW_COLOR:                                                                  // Monochrome
  2006.                     window_3 = slug_Open(win3_menu_80, SLUG_VERTICAL, bd_cua, WHITE_BLACK, BLACK_LCYAN, BLACK_WHITE);
  2007.                     break;
  2008.                 case SVGA_COLOR:                                                                // Super VGA
  2009.                     window_3 = slug_Open(win3_menu_80, SLUG_VERTICAL, bd_cua, GREEN_BLACK, WHITE_GREEN, GREEN_WHITE);
  2010.                     break;
  2011.                 default:
  2012.                 case CO_COLOR:                                                                  // Graphics
  2013.                     window_3 = slug_Open(win3_menu_80, SLUG_VERTICAL, bd_cua, GREEN_BLACK, GRAY_GREEN, GREEN_GRAY);
  2014.                     break;
  2015.             }
  2016.             break;
  2017.     }
  2018.  
  2019.     Win3_PopUp(window_3);
  2020.  
  2021.     sed_SetBorder(window_3, bd_cua);
  2022.     sed_SetBorderFeature(window_3, BD_TOP | BD_OUTLINE | BD_TITLE | BD_PROMPT);
  2023.     sed_SetBorderTitle(window_3, WINDOW_3_TITLE);
  2024.     sed_SetPosition(window_3, 13, 1);
  2025.     sed_SetHeight(window_3, height);
  2026.     sed_SetWidth(window_3, 25);
  2027.     sed_SetShadow(window_3, 1);
  2028.     sed_SetShadowAttr(window_3, BK_COLOR3);
  2029.     sed_SetLabel(window_3, 3);
  2030.  
  2031.     // Attach a mouse handler to the sed
  2032.     win_SetMouse(window_3, winmou_All);
  2033.     win_SetMouseFeature(window_3, MOUF_TRACK);
  2034.  
  2035.     sed_Repaint(window_3);
  2036.  
  2037.     sedlist[1] = window_3;
  2038.     sed_SetSpecial(window_3, spc_Jump);
  2039.     sed_SetAux(window_3, aux_Top);
  2040.  
  2041.     return(TRUE);
  2042. }
  2043.  
  2044. // create the windows sub menu 2 ---------------------------------------------------
  2045. // *********************************************************************************
  2046. //  function name   : void Win2_Menu_Sub(void)
  2047. //  function        : window 2 sub pop up menu
  2048. //  input           : void
  2049. //  output          : void
  2050. // *********************************************************************************
  2051. void Win2_Menu_Sub()
  2052. {
  2053.     int         fh, i, j;
  2054.     unsigned    k;
  2055.     char        filespec[OFILE_MAXSPEC + 1];
  2056.     char        buf[1024];
  2057.  
  2058.     filespec[0] = (byte)NULL;
  2059.     i = j = k = mode = 0;
  2060.  
  2061.     // Window 2 Start
  2062.  
  2063.     switch(sed_Go(window_2))
  2064.     {
  2065.         case PRINTER:
  2066.             sed_Close(window_2);////
  2067.             switch(colors)
  2068.             {
  2069.                 case BW_COLOR:                                                              // Monochrome
  2070.                     win_21 = slug_Open(win2_menu_printer, SLUG_VERTICAL, bd_cua, WHITE_BLACK, BLACK_LCYAN, BLACK_WHITE);
  2071.                     break;
  2072.                 case SVGA_COLOR:                                                            // Super VGA
  2073.                     win_21 = slug_Open(win2_menu_printer, SLUG_VERTICAL, bd_cua, CYAN_BLACK, BLACK_CYAN, BLACK_BLUE);
  2074.                     break;
  2075.                 default:
  2076.                 case CO_COLOR:                                                              // Graphics
  2077.                     win_21 = slug_Open(win2_menu_printer, SLUG_VERTICAL, bd_cua, CYAN_BLACK, BLACK_CYAN, GRAY_CYAN);
  2078.                     break;
  2079.             }
  2080.  
  2081.             Win2_PopUp_Printer(win_21);
  2082.             sed_Repaint(win_21);
  2083.             sed_Go(win_21);
  2084.             sed_Close(win_21);
  2085.  
  2086.             EndHelpFile();
  2087.             PrinterIDNumber();
  2088.             break;
  2089. //
  2090.         case MODE:
  2091.             sed_Close(window_2);////
  2092.             mode = 1;
  2093.             switch(colors)
  2094.             {
  2095.                 case BW_COLOR:                                                              // Monochrome
  2096.                     win_20 = slug_Open(win2_menu, SLUG_VERTICAL, bd_cua, WHITE_BLACK, BLACK_LCYAN, BLACK_WHITE);
  2097.                     break;
  2098.                 case SVGA_COLOR:                                                            // Super VGA
  2099.                     win_20 = slug_Open(win2_menu, SLUG_VERTICAL, bd_cua, CYAN_BLACK, BLACK_CYAN, BLACK_BLUE);
  2100.                     break;
  2101.                 default:
  2102.                 case CO_COLOR:                                                              // Graphics
  2103.                     win_20 = slug_Open(win2_menu, SLUG_VERTICAL, bd_cua, CYAN_BLACK, BLACK_CYAN, GRAY_CYAN);
  2104.                     break;
  2105.             }
  2106.             Win2_PopUp(win_20);
  2107.             sed_Repaint(win_20);
  2108.             sed_Go(win_20);
  2109.             sed_Close(win_20);
  2110.             break;
  2111. //
  2112.         case OPEN:
  2113. ////            sed_Close(window_2);////
  2114.             mode = 2;
  2115.             while(TRUE)
  2116.             {
  2117.                 if(_getcwd(filespec, OFILE_MAXSPEC))
  2118.                 {
  2119.                     for(i=0;filespec[i] != (byte)NULL;i++);
  2120.                     if(filespec[i-1] != '\\')
  2121.                     {
  2122.                         filespec[i] = '\\';
  2123.                         filespec[i+1] = (byte)NULL;
  2124.                     }
  2125.                 }
  2126.                 else
  2127.                     break;
  2128.                 if(!(opc_FileBox(NULL, WINDOW_2_1_O, 0, filespec, OFILE_MAXSPEC, "*.ini")))
  2129.                     break;
  2130.                 else
  2131.                 {
  2132.                     if((fh = _open(filespec, _O_RDONLY)) != FILE_ERROR)
  2133.                     {
  2134.                         i=j=0;
  2135.                         _read(fh, buf, WIN4_BUFF);
  2136.                         if((!(memcmp(buf,WINDOW_4_0_S0,WINDOW_4_0_S0_N)))|(!(memcmp(buf,WINDOW_4_0_S1,WINDOW_4_0_S1_N))))
  2137.                         {
  2138.                             for(k=0;i<WIN4_MENU;k++)
  2139.                             {
  2140.                                 if(buf[k] >= ' ')
  2141.                                 {
  2142.                                     choice[i][j] = buf[k];
  2143.                                     j++;
  2144.                                 }
  2145.                                 else
  2146.                                 {
  2147.                                     choice[i][j] = (byte)NULL;
  2148.                                     j=0;
  2149.                                     i++;
  2150.                                 }
  2151.                             }
  2152.                             _close(fh);
  2153.                             EndHelpFile();
  2154.                             PrinterIDNumber();
  2155.                             break;
  2156.                         }
  2157.                         else
  2158.                         {
  2159.                             _close(fh);
  2160.                             opc_Prompt(NULL, ERROR, 0, ERROR_FILE2);
  2161.                         }
  2162.                     }
  2163.                     else
  2164.                     {
  2165.                         switch(errno)
  2166.                         {
  2167.                             case EACCES:
  2168.                                 opc_Prompt(NULL, ERROR, 0, ERROR_FILE4);
  2169.                                 break;
  2170.                             case EINVAL:
  2171.                                 opc_Prompt(NULL, ERROR, 0, ERROR_FILE5);
  2172.                                 break;
  2173.                             case EMFILE:
  2174.                                 opc_Prompt(NULL, ERROR, 0, ERROR_FILE6);
  2175.                                 break;
  2176.                             case ENOENT:
  2177.                             default:
  2178.                                 opc_Prompt(NULL, ERROR, 0, ERROR_FILE3);
  2179.                                 break;
  2180.                         }
  2181.                     }
  2182.                 }
  2183.             }
  2184.             sed_Close(window_2);////
  2185.             break;
  2186. //
  2187.         case SAVE:
  2188. ////            sed_Close(window_2);////
  2189.             mode = 3;
  2190.             while(TRUE)
  2191.             {
  2192.                 if(_getcwd(filespec, OFILE_MAXSPEC))
  2193.                 {
  2194.                     for(i=0;filespec[i] != (byte)NULL;i++)
  2195.                         ;
  2196.                     if(filespec[i-1] != '\\')
  2197.                     {
  2198.                         filespec[i] = '\\';
  2199.                         filespec[i+1] = (byte)NULL;
  2200.                     }
  2201.                 }
  2202.                 else
  2203.                     break;
  2204.                 if(!(opc_FileBox(NULL, WINDOW_2_2_S, 0, filespec, OFILE_MAXSPEC, "*.ini")))
  2205.                     break;
  2206.                 else
  2207.                 {
  2208.                     if((fh = _open(filespec, _O_WRONLY | _O_CREAT, _S_IREAD | _S_IWRITE)) != FILE_ERROR)
  2209.                     {
  2210.                         i=j=0;
  2211.                         for(k=0;i<WIN4_MENU;i++,j=0,k++)
  2212.                         {
  2213.                             for(;choice[i][j] != (byte)NULL;j++,k++)
  2214.                                 buf[k] = choice[i][j];
  2215.                             buf[k] = '\n';
  2216.                         }
  2217.                         if(_write(fh, buf, k) == FILE_ERROR)
  2218.                         {
  2219.                             _close(fh);
  2220.                             opc_Prompt(NULL, ERROR, 0, ERROR_FILE);
  2221.                         }
  2222.                         else
  2223.                         {
  2224.                             _close(fh);
  2225.                             break;
  2226.                         }
  2227.                     }
  2228.                     else
  2229.                         opc_Prompt(NULL, ERROR, 0, ERROR_FILE);
  2230.                 }
  2231.             }
  2232.             sed_Close(window_2);////
  2233.             break;
  2234. //
  2235.         case DELETE:
  2236. ////            sed_Close(window_2);////
  2237.             mode = 4;
  2238.             while(TRUE)
  2239.             {
  2240.                 if(_getcwd(filespec, OFILE_MAXSPEC))
  2241.                 {
  2242.                     for(i=0;filespec[i] != (byte)NULL;i++)
  2243.                         ;
  2244.                     if(filespec[i-1] != '\\')
  2245.                     {
  2246.                         filespec[i] = '\\';
  2247.                         filespec[i+1] = (byte)NULL;
  2248.                     }
  2249.                 }
  2250.                 else
  2251.                     break;
  2252.                 if(!(opc_FileBox(NULL, WINDOW_2_3_D, 0, filespec, OFILE_MAXSPEC, "*.ini")))
  2253.                     break;
  2254.                 else
  2255.                 {
  2256.                     if(ConfirmDelete(filespec))
  2257.                     {
  2258.                         if(!remove(filespec))
  2259.                             break;
  2260.                         else
  2261.                         {
  2262.                             switch(errno)
  2263.                             {
  2264.                                 case EACCES:
  2265.                                     opc_Prompt(NULL, ERROR, 0, ERROR_FILE4);
  2266.                                     break;
  2267.                                 case EINVAL:
  2268.                                     opc_Prompt(NULL, ERROR, 0, ERROR_FILE5);
  2269.                                     break;
  2270.                                 case EMFILE:
  2271.                                     opc_Prompt(NULL, ERROR, 0, ERROR_FILE6);
  2272.                                     break;
  2273.                                 case ENOENT:
  2274.                                 default:
  2275.                                     opc_Prompt(NULL, ERROR, 0, ERROR_FILE3);
  2276.                                     break;
  2277.                             }
  2278.                         }
  2279.                     }
  2280.                     else
  2281.                         break;
  2282.                 }
  2283.             }
  2284.             sed_Close(window_2);////
  2285.             break;
  2286. //
  2287.         default:
  2288.             sed_Close(window_2);////
  2289.             break;
  2290.     }
  2291. }
  2292.  
  2293. // create the windows 2 ------------------------------------------------------------------------
  2294. // *********************************************************************************
  2295. //  function name   : void Win2_Menu_Main(void)
  2296. //  function        : window 2 pop up menu
  2297. //  input           : void
  2298. //  output          : void
  2299. // *********************************************************************************
  2300. void Win2_Menu_Main(void)
  2301. {
  2302.     menu_type   menu_2;
  2303.  
  2304.     // Window 2 Start
  2305.  
  2306.     menu_2 = menu_Open();
  2307.  
  2308.     if(printerID == MPC2500)
  2309.         menu_Printf(menu_2, WINDOW_2_5_MP, &choice[PRINTER_NAME][0]);
  2310.     else if(printerID == MPC30)
  2311.         menu_Printf(menu_2, WINDOW_2_5_C30, &choice[PRINTER_NAME][0]);
  2312.     else
  2313.         menu_Printf(menu_2, WINDOW_2_5, &choice[PRINTER_NAME][0]);
  2314.     menu_Printf(menu_2, WINDOW_2_4, NULL, &gmenu_funcs, WINDOW_2_4_H, PRINTER_STR);
  2315.     menu_Printf(menu_2, WINDOW_2_0, NULL, &gmenu_funcs, WINDOW_2_0_H, MODE_STR);
  2316.     menu_Printf(menu_2, WINDOW_2_1, NULL, &gmenu_funcs, WINDOW_2_1_H, OPEN_STR);
  2317.     menu_Printf(menu_2, WINDOW_2_2, NULL, &gmenu_funcs, WINDOW_2_2_H, SAVE_STR);
  2318.     menu_Printf(menu_2, WINDOW_2_3, NULL, &gmenu_funcs, WINDOW_2_3_H, DELETE_STR);
  2319.  
  2320.     window_2 = sed_Open(menu_2);
  2321.     switch(colors)
  2322.     {
  2323.         case BW_COLOR:                                              // Monochrome
  2324.             sed_SetColors(window_2, WHITE_BLACK, BLACK_WHITE, BLACK_LCYAN);
  2325.             break;
  2326.         case SVGA_COLOR:                                            // Super VGA
  2327.             sed_SetColors(window_2, CYAN_BLACK, CYAN_WHITE, BLACK_CYAN);
  2328.             break;
  2329.         default:
  2330.         case CO_COLOR:                                              // Graphics
  2331.             sed_SetColors(window_2, CYAN_BLACK, CYAN_GRAY, BLACK_CYAN);
  2332.             break;
  2333.     }
  2334.  
  2335.     sed_SetBorder(window_2, bd_cua);
  2336.     sed_SetBorderFeature(window_2, BD_TITLE | BD_OUTLINE | BD_TOP | BD_PROMPT);
  2337.     sed_SetBorderTitle(window_2, WINDOW_2_TITLE);
  2338.     sed_SetPosition(window_2, 2, 1);
  2339.     sed_SetHeight(window_2, 6);
  2340.     sed_SetWidth(window_2, 25);
  2341.     sed_SetShadow(window_2, 1);
  2342.     sed_SetShadowAttr(window_2, BK_COLOR3);
  2343.     sed_SetLabel(window_2, 2);
  2344.  
  2345.     // Attach a mouse handler to the sed
  2346.     win_SetMouse(window_2, winmou_All);
  2347.     win_SetMouseFeature(window_2, MOUF_TRACK);
  2348.  
  2349.     // Attach a mouse handler to the sed
  2350.     win_SetMouse(window_2, winmou_All);
  2351.     win_SetMouseFeature(window_2, MOUF_TRACK);
  2352.  
  2353.     sed_Repaint(window_2);
  2354.  
  2355.     sedlist[0] = window_2;
  2356.     sed_SetSpecial(window_2, spc_Jump);
  2357.     sed_SetAux(window_2, aux_Top);
  2358.  
  2359.     switch(mode)
  2360.     {
  2361.         case 1:
  2362.             kb_Stuff(CTRL_M);
  2363.             break;
  2364.         case 2:
  2365.             kb_Stuff(CTRL_O);
  2366.             break;
  2367.         case 3:
  2368.             kb_Stuff(CTRL_S);
  2369.             break;
  2370.         case 4:
  2371.             kb_Stuff(CTRL_D);
  2372.             break;
  2373.         default:
  2374.             break;
  2375.     }
  2376. }
  2377.  
  2378. // *********************************************************************************
  2379. //  function name   : void StartCheck(void)
  2380. //  function        : check to start program
  2381. //  input           : void
  2382. //  output          : void
  2383. // *********************************************************************************
  2384. void StartCheck()
  2385. {
  2386.     char        buf_1[OFILE_MAXSPEC + 9],    dir_tmp[OFILE_MAXSPEC + 10];
  2387.     int         fh,    i,    j;
  2388. //
  2389.     _searchenv(INI_FILE, ".", dir_tmp);
  2390.     if(*dir_tmp == (byte)NULL)
  2391.     {
  2392.         _searchenv(INI_FILE, "PATH", dir_tmp);
  2393.         if(*dir_tmp == (byte)NULL)
  2394.             InitError();
  2395.         if(_chdrive(toupper(dir_tmp[0])-0x40) == FILE_ERROR)
  2396.             InitError();
  2397.         for(i=0;i<(OFILE_MAXSPEC + 10);i++)
  2398.         {
  2399.             if(dir_tmp[i] == '\\')
  2400.             {
  2401.                 if(!(memcmp(&dir_tmp[i+1], INI_FILE, 7)))
  2402.                 {
  2403.                     dir_tmp[i] = (byte)NULL;
  2404.                     break;
  2405.                 }
  2406.             }
  2407.         }
  2408.         if(_chdir(dir_tmp) == FILE_ERROR)
  2409.             InitError();
  2410.     }
  2411.  
  2412.     if((fh = _open(INI_FILE, _O_RDONLY)) != FILE_ERROR)
  2413.     {
  2414.         i = _read(fh, buf_1, (OFILE_MAXSPEC + 8));
  2415.         if(!(memcmp(buf_1, "monitor", 7)))
  2416.         {
  2417.             colors = SVGA_COLOR;
  2418.             for(j=0;buf_1[j] != '\n';j++);
  2419.             for(;buf_1[j] <= ' ';j++);
  2420.             memcpy(buf_1, (buf_1+j), (i-j));
  2421.             buf_1[i-j] = (byte)NULL;
  2422.         }
  2423.         else
  2424.         {
  2425.             colors = CO_COLOR;
  2426.             buf_1[i] = (byte)NULL;
  2427.         }
  2428.         _close(fh);
  2429.  
  2430.         if(_chdrive(toupper(buf_1[0])-0x40) == FILE_ERROR)
  2431.             InitError();
  2432.         if(_chdir(buf_1) == FILE_ERROR)
  2433.             InitError();
  2434.     }
  2435.     else
  2436.         InitError();
  2437. }
  2438.  
  2439. // *********************************************************************************
  2440. //  function name   : int ChoiceDataInitial(void)
  2441. //  function        : check to start program
  2442. //  input           : void
  2443. //  output          : FALSE                       // failure
  2444. //                  : TRUE                        // success
  2445. // *********************************************************************************
  2446. int ChoiceDataInitial()
  2447. {
  2448.     int         fh,    i, j;
  2449.     unsigned    k;
  2450.     char        buf[1024];
  2451. //
  2452.     i = j = 0;
  2453.     if((fh = _open("bjsetup.ini", _O_RDONLY)) != FILE_ERROR)
  2454.     {
  2455.         _read(fh, buf, WIN4_BUFF);
  2456.         _close(fh);
  2457.         if((!(memcmp(buf, WINDOW_4_0_S0, WINDOW_4_0_S0_N)))|(!(memcmp(buf, WINDOW_4_0_S1, WINDOW_4_0_S1_N))))
  2458.         {
  2459.             for(k=0;i<WIN4_MENU;k++)
  2460.             {
  2461.                 if(buf[k] >= ' ')
  2462.                 {
  2463.                     choice[i][j] = buf[k];
  2464.                     j++;
  2465.                 }
  2466.                 else
  2467.                 {
  2468.                     choice[i][j] = (byte)NULL;
  2469.                     j=0;
  2470.                     i++;
  2471.                 }
  2472.             }
  2473.         }
  2474.         else
  2475.         {
  2476.             memcpy(choice, choice_default, WIN4_BUFF);
  2477.             if(!iniFileWrite())
  2478.                 return(FALSE);
  2479.         }
  2480.     }
  2481.     else
  2482.     {
  2483.         memcpy(choice, choice_default, WIN4_BUFF);
  2484.         if(!iniFileWrite())
  2485.             return(FALSE);
  2486.     }
  2487.     return(TRUE);
  2488. }
  2489.  
  2490. // ***********************************************************************
  2491. //  function name   : int iniFileWrite(void)
  2492. //  function        : write "bjsetup.ini"
  2493. //  input           : void
  2494. //  output          : FALSE                        // failure
  2495. //                  : TRUE                         // success
  2496. // ***********************************************************************
  2497. int iniFileWrite()
  2498. {
  2499.     int         fh,    i,    j;
  2500.     unsigned    k;
  2501. ////    char        buf[WIN4_BUFF+WIN4_MENU*4];
  2502.     char        buf[1024];
  2503.  
  2504.     if((fh = _open("bjsetup.ini", _O_WRONLY | _O_CREAT, _S_IREAD | _S_IWRITE)) == FILE_ERROR)
  2505.     {
  2506.         if(!opc_Verify(NULL, ERROR, 0, ERROR_FILE))
  2507.         {
  2508.             _close(fh);
  2509.             return(FALSE);
  2510.         }
  2511.     }
  2512.     for(i=j=k=0;i<WIN4_MENU;i++,j=0,k++)
  2513.     {
  2514.         for(;choice[i][j] != (byte)NULL;j++,k++)
  2515.             buf[k] = choice[i][j];
  2516.         buf[k] = '\n';
  2517.     }
  2518.     if(_write(fh, buf, k) == FILE_ERROR)
  2519.     {
  2520.         if(!opc_Verify(NULL, ERROR, 0, ERROR_FILE))
  2521.         {
  2522.             _close(fh);
  2523.             return(FALSE);
  2524.         }
  2525.     }
  2526.     _close(fh);
  2527.     return(TRUE);
  2528. }
  2529.  
  2530. // ***********************************************************************
  2531. //  function name   : void EndHelpFile(void)
  2532. //  function        : Close help file
  2533. //  input           : void
  2534. //  output          : void
  2535. // ***********************************************************************
  2536. void EndHelpFile()
  2537. {
  2538.     if(fp_help)
  2539.     {
  2540.         help_Close();
  2541.         fclose(fp_help);
  2542.     }
  2543.     _fcloseall();
  2544. }
  2545.  
  2546. // ***********************************************************************
  2547. //  function name   : int EndDisplay(void)
  2548. //  function        : Exit this program
  2549. //  input           : void
  2550. //  output          : 0
  2551. // ***********************************************************************
  2552. int EndDisplay()
  2553. {
  2554.     EndHelpFile();
  2555.     sed_Close(window_0);                // close the windows
  2556.     sed_Close(window_1);
  2557.     sed_Close(window_2);
  2558.     sed_Close(window_3);
  2559.     sed_Close(window_4);
  2560.     sed_Close(window_5);
  2561.  
  2562.     win_Close(disp_GetBackWin());       // Close the background window
  2563.     disp_SetAttr(WHITE_BLACK);
  2564.     disp_Repaint();
  2565.     disp_Close();                       // shut down the display
  2566.  
  2567.     exit(0);
  2568.     return(0);
  2569. }
  2570.  
  2571. // ***********************************************************************
  2572. //  function name   : int InitError(void)
  2573. //  function        : Initial error of no "BJL.ini" and exit this program
  2574. //  input           : void
  2575. //  output          : 1
  2576. // ***********************************************************************
  2577. int InitError()
  2578. {
  2579.     printf(ERROR_INIT);
  2580.     exit(1);
  2581.     return(1);
  2582. }
  2583.  
  2584. // ***********************************************************************
  2585. //  function name   : void PrinterIDNumber(void)
  2586. //  function        : Set printer ID and select help file
  2587. //  input           : void
  2588. //  output          : void
  2589. // ***********************************************************************
  2590. void PrinterIDNumber()
  2591. {
  2592.     if(!(memcmp(&choice[PRINTER_NAME][0], WINDOW_2_0_S0, 7)))
  2593.     {
  2594.         if(!(memcmp(&choice[PRINTER_NAME][0], WINDOW_2_0_S30, 13)))
  2595.         {
  2596.             printerID = MPC30;     //// MultiPASS C30
  2597.             a240 = 0;
  2598.             fp_help = fopen("bjsetup6.hlp", "rb");
  2599.         }
  2600.         else
  2601.         {
  2602.             printerID = MPC2500;   //// MultiPASS C2500
  2603.             a240 = 0;
  2604.             fp_help = fopen("bjsetup6.hlp", "rb");
  2605.         }
  2606.     }
  2607.     else if(!(memcmp(&choice[PRINTER_NAME][0], WINDOW_2_0_SIF, 7)))
  2608.     {
  2609.         printerID = B380IF;    //// CFX-B380IF
  2610.         a240 = 0;
  2611.         fp_help = fopen("bjsetup7.hlp", "rb");         // SK, 5/15/96 - changed to bjsetup7.hlp from bjsetup6.hlp
  2612.     }
  2613.     else if(!(memcmp(&choice[PRINTER_NAME][0], WINDOW_2_0_S1, 7)))
  2614.     {
  2615.         printerID = BJC4100;   //// BJC-4100
  2616.         a240 = 0;
  2617.         fp_help = fopen("bjsetup1.hlp", "rb");
  2618.     }
  2619.     else if(!(memcmp(&choice[PRINTER_NAME][0], WINDOW_2_0_S2, 7)))
  2620.     {
  2621.         printerID = BJC210;   //// BJC-210
  2622.         a240 = 23;
  2623.         fp_help = fopen("bjsetup2.hlp", "rb");
  2624.     }
  2625.     else if(!(memcmp(&choice[PRINTER_NAME][0], WINDOW_2_0_S3, 7)))
  2626.     {
  2627.         printerID = BJC80;    //// BJC-80
  2628.         a240 = 0;
  2629.         fp_help = fopen("bjsetup3.hlp", "rb");
  2630.     }
  2631.     else if(!(memcmp(&choice[PRINTER_NAME][0], WINDOW_2_0_S4, 7)))
  2632.     {
  2633.         printerID = BJC240;   //// BJC-240
  2634.         a240 = 0;
  2635.         fp_help = fopen("bjsetup4.hlp", "rb");
  2636.     }
  2637.     else if(!(memcmp(&choice[PRINTER_NAME][0], WINDOW_2_0_S5, 7)))
  2638.     {
  2639.         printerID = BJC4200;   //// BJC-4200
  2640.         a240 = 0;
  2641.         fp_help = fopen("bjsetup5.hlp", "rb");
  2642.     }
  2643.     else if(!(memcmp(&choice[PRINTER_NAME][0], WINDOW_2_0_S6, 7)))
  2644.     {
  2645.         printerID = BJC4550;   //// BJC-4550
  2646.         a240 = 0;
  2647.         fp_help = fopen("bjsetup5.hlp", "rb");
  2648.     }
  2649.  
  2650.     if(!fp_help)
  2651.         opc_Prompt(NULL, ERROR, 0, ERROR_HELP);
  2652.     else
  2653.     {
  2654.         if(help_Init(fp_help, help_View, 8800, (VOID *) &hvd) != HELP_OK)
  2655.             opc_Prompt(NULL, ERROR, 0, ERROR_HELP);
  2656.     }
  2657. }
  2658.  
  2659. // ***********************************************************************
  2660. //  function name   : void PrinterName(void)
  2661. //  function        : Set printer name
  2662. //  input           : void
  2663. //  output          : void
  2664. // ***********************************************************************
  2665. void PrinterName()
  2666. {
  2667.     switch(printerID)
  2668.     {
  2669.         case MPC2500:
  2670.             strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S0);
  2671.             break;
  2672.         case MPC30:
  2673.             strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S30);
  2674.             break;
  2675.         case B380IF:
  2676.             strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_SIF);
  2677.             break;
  2678.         case BJC4100:
  2679.             strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S1);
  2680.             break;
  2681.         case BJC210:
  2682.             strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S2);
  2683.             break;
  2684.         case BJC80:
  2685.             strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S3);
  2686.             break;
  2687.         case BJC240:
  2688.             strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S4);
  2689.             break;
  2690.         case BJC4200:
  2691.             strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S5);
  2692.             break;
  2693.         case BJC4550:
  2694.             strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S6);
  2695.             break;
  2696.     }
  2697. }
  2698.