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 >
Wrap
C/C++ Source or Header
|
1996-06-05
|
103KB
|
2,698 lines
// ========================================================================================
// BJ Printer Setup Utility Program
// DOS Base
// BJ Printer (such as the A250 and A240)
//
// 1. Version 1.00 [August 18, '95] : Tsukasa Jackie AIBA : created new
// 2. Version 1.01 [September 21, '95] : Tsukasa Jackie AIBA : added A240
// 3. Version 1.02 [September 26, '95] : Tsukasa Jackie AIBA : added mono display
// 4. Version 1.03 [March 12, '96] : Tsukasa Jackie AIBA : added MultiPASS C2500
// 5. Version 1.10 [April 30, '96] : Tsukasa Jackie AIBA : Added BJC-80/240/4200/4550
// 6. Version 1.11 [May 15, 1996] : Srinivas Krishnamurti : Added code to delete TestPrint option for B380IF
// 7. Version 1.12 [May 17, 1996] : Srinivas Krishnamurti : Bug fixes
// 8. Version 1.13 [June 5, 1996] : Srinivas Krishnamurti : Added back Test Print option without Demo Print to B380IF
//
// Copyright Canon Information Systems, Inc. 1995, 1996
// ========================================================================================
/*
BJL_DOS.c
C-scape for DOS version 4.0.1. Software
Copyright (c) 1992 by Liant Software Corporation.
ALL RIGHTS RESERVED.
This program is A250 and A240 setup utility how to use a mouse with C-scape for DOS version 4.0.1.
There are 6 windows.
Window 0 is a software title.
Window 1 is an exit, status, send, default, about and help menu.
Window 2 is a Settings Mode menu.
Window 3 is a Printer Action menu.
Window 4 is a Parameter Settings menu.
Window 5 is a help menu.
You can select windows by moving the mouse over the desired window.
When you are finished you can quit by pressing ESC or by
clicking the mouse on the field that says "exit".
*/
// ***********************************************************************
// include standard headers
// ***********************************************************************
#include <stdio.h>
#include <string.h>
#include <time.h> // for popdecl.h
#include <dos.h>
#include <errno.h>
#include <memory.h>
#include <stdlib.h>
#include <io.h>
#include <conio.h>
#include <fcntl.h>
#include <sys\types.h>
#include <sys\stat.h>
#include <direct.h>
#include <bios.h>
// ***********************************************************************
// include original headers
// ***********************************************************************
#include "..\h\cscape.h"
#include "..\h\ostdlib.h" // for exit(), otolower()
#include "..\h\popdecl.h" // for popups
#include "..\h\scancode.h" // for event codes
#include "..\h\useful.h" // for STATE_2NAMES
#include "..\h\cmwinobj.h" // for bcwin_Class
#include "..\h\dpref.h"
#include "..\h\ogldecl.h"
#include "..\h\slug.h"
#include "..\h\pmwinobj.h" // for pmwin stuff
#include "..\h\disppvs.h" // for PCCOLS, disp_GetPixval, disp_FreePixval
#include "..\h\framer.h"
#include "..\h\oakalloc.h" // for omalloc of icon title string
#include "..\h\oaktag.h" // tags for omalloc
#include "..\h\helpdecl.h" // for the help system
#include "..\h\pcmode.h" // for the help system
#include "letter.h"
#include "command.h"
// ***********************************************************************
// function name : int main(int argc, char **argv)
// function : BJ Printer Setup Utility
// input : int argc
// : char **argv
// output : 1 // failure
// : 0 // success
// ***********************************************************************
int main(int argc, char **argv)
{
int m;
menu_type menu_0, menu_5;
choice_old = (byte)NULL;
fp_help = NULL;
//
StartCheck();
//
dp_SetApplName(" bjl_dos "); // Open the display
dp_SetWindowName(" BJ Printer Setup Utility ");
argc = dp_PickArgs(argc, argv);
// Use background character win to make a nice background
if(colors == CO_COLOR)
{
if(disp_Init(def_ModeGraphics, bcwin_Class))
ogl_Init(def_MiniOGL); // Initialize the Oakland Graphics Library
else
{
if(!disp_Init(def_ModeText, bcwin_Class)) // Initialize the device interface for text mode
{
printf("%s", INITFAIL_MSG); // Initialization failure
exit(1);
return(1);
}
}
}
else
{
if(disp_Init(pc_ModeVGA50, bcwin_Class))
ogl_Init(def_MiniOGL); // Initialize the Oakland Graphics Library
else
{
if(!disp_Init(def_ModeText, bcwin_Class)) // Initialize the device interface for text mode
{
printf("%s", INITFAIL_MSG); // Initialization failure
exit(1);
return(1);
}
}
}
bdcua_InitCombo(); // Initialize the text and graphics (use bd_cua in either mode)
// Display the background
bcwin_SetChar(disp_GetBackWin(), (byte)BK_CHAR); // a half-dense block char
win_SetAttr(disp_GetBackWin(), (byte)BK_COLOR1);
win_SetShadowAttr(disp_GetBackWin(), (byte)BK_COLOR2);
disp_Repaint();
if(!hard_InitMouse()) // Check the mouse driver
{
if(!opc_Verify(NULL, ERROR, 0, ERROR_MOUSE))
{
disp_Close(); // Close down the display interface
exit(1);
return(1);
}
}
else
sedwin_MouseInit(); // Turn on the mouse
if((colors == CO_COLOR) & (disp_GetColors() <= 2L)) // Map colors for 2 color video modes
{
disp_MapMono(TRUE);
colors = BW_COLOR;
}
////
//colors = BW_COLOR;
//
if(!ChoiceDataInitial())
{
disp_Close(); // Close down the display interface
exit(1);
return(1);
}
// read a help file --------------------------------------------------------------------------------
PrinterIDNumber();
printer_old = printerID;
if(choice[a240+15][4] == '2') // 15.(WIN4_MENU) Printer Port
port = LPT2;
else
port = LPT1;
// create the windows 0 -- Title -------------------------------------------------------------------
menu_0 = menu_Open();
menu_Printf(menu_0, WINDOW_0, NULL);
window_0 = sed_Open(menu_0);
switch(colors)
{
case BW_COLOR: // Monochrome
sed_SetColors(window_0, WHITE_BLACK, WHITE_BLACK, BLACK_WHITE);
break;
case SVGA_COLOR: // Super VGA
sed_SetColors(window_0, RED_BLACK, RED_BLACK, BLACK_RED);
break;
default:
case CO_COLOR: // Graphics
sed_SetColors(window_0, RED_BLACK, RED_BLACK, BLACK_RED);
break;
}
sed_SetBorderFeature(window_0, BD_TOP);
sed_SetPosition(window_0, 2, 35);
sed_SetHeight(window_0, 1);
sed_SetWidth(window_0, 34);
sed_SetShadow(window_0, 0);
// create the windows 1 ----------------------------------------------------------------------------
switch(colors)
{
case BW_COLOR: // Monochrome
window_1 = frame_Open(menu_bar, bd_1, BLACK_WHITE, WHITE_BLACK, WHITE_BLACK);
break;
case SVGA_COLOR: // Super VGA
window_1 = frame_Open(menu_bar, bd_1, BLACK_WHITE, WHITE_BLACK, BLACK_WHITE);
break;
default:
case CO_COLOR: // Graphics
window_1 = frame_Open(menu_bar, bd_1, GRAY_WHITE, YELLOW_GRAY, GRAY_WHITE2);
break;
}
sed_SetLabel(window_1, 1);
// Attach a mouse handler to the sed
win_SetMouse(window_1, winmou_All);
win_SetMouseFeature(window_1, MOUF_TRACK);
// create the windows 2 ----------------------------------------------------------------------------
Win2_Menu_Main();
// create the windows 3 ----------------------------------------------------------------------------
Win3_Menu_Printer();
// create the windows 4 ----------------------------------------------------------------------------
Win4_Menu(0);
// create the windows 5 ----------------------------------------------------------------------------
menu_5 = menu_Open();
menu_Printf(menu_5, WINDOW_5_TITLE, NULL);
window_5 = sed_Open(menu_5);
switch(colors)
{
case BW_COLOR: // Monochrome
sed_SetColors(window_5, BLACK_WHITE, WHITE_BLACK, WHITE_BLACK);
break;
case SVGA_COLOR: // Super VGA
sed_SetColors(window_5, WHITE_BLACK, WHITE_BLACK, BLACK_WHITE);
break;
default:
case CO_COLOR: // Graphics
sed_SetColors(window_5, WHITE_GRAY, WHITE_GRAY, GRAY_WHITE);
break;
}
sed_SetBorder(window_5, bd_cua);
sed_SetBorderFeature(window_5, BD_OUTLINE | BD_PROMPT | BD_TOP);
sed_SetPosition(window_5, 27, 0);
sed_SetHeight(window_5, 1);
sed_SetWidth(window_5, 78);
sed_SetShadow(window_5, 0);
// -------------------------------------------------------------------------------------------------
sedlist[3] = window_1;
sed_SetSpecial(window_1, spc_Jump);
sed_SetAux(window_1, aux_Top);
sed_Repaint(window_0);
sed_Repaint(window_1);
sed_Repaint(window_5);
// ######### Main loop Start ##########
reduction = 0;
while(TRUE)
{
Win2_Menu_Sub();
Win2_Menu_Main();////
choice_old = (byte)NULL;
if(printer_old != printerID)
{
if(printer_old >= BJC240)
{
for(m=0; m<10; m++)
sed_ProtectField(window_3, m);
}
else
{
for(m=0; m<9; m++)
sed_ProtectField(window_3, m);
}
sed_Go(window_3);
sed_Close(window_3);
Win3_Menu_Printer();
printer_old = printerID;
//// sed_Close(window_2);
//// Win2_Menu_Main();
}
Win4_Menu(1);
}
// ######### Main loop End ##########
EndDisplay();
}
// *********************************************************************************
// function name : void Win2_PopUp_Printer(sed_type sed)
// function : window 2 pop up menu (Select Printer)
// input : sed_type win_21 : window 2
// output : void
// *********************************************************************************
void Win2_PopUp_Printer(sed_type win_21)
{
int i;
bob_type bob;
for(i=0; i<sed_GetFieldCount(win_21); i++)
{
if(((bob = sed_GetFieldBob(win_21, i)) != NULL) && bob_IsSed(bob))
Win2_PopUp_Printer(bob);
}
switch(colors)
{
case BW_COLOR: // Monochrome
sed_SetColors(win_21, WHITE_BLACK, BLACK_WHITE, BLACK_LCYAN);
break;
case SVGA_COLOR: // Super VGA
sed_SetColors(win_21, CYAN_BLACK, CYAN_WHITE, BLACK_CYAN);
break;
default:
case CO_COLOR: // Graphics
sed_SetColors(win_21, CYAN_BLACK, CYAN_GRAY, BLACK_CYAN);
break;
}
sed_SetBorder(win_21, bd_cua);
sed_SetBorderFeature(win_21, BD_TOP | BD_OUTLINE | BD_TITLE | BD_PROMPT);
sed_SetBorderTitle(win_21, WINDOW_2_TITLE);
sed_SetPosition(win_21, 2, 2);
sed_SetHeight(win_21, MAX_PRINTER);
sed_SetWidth(win_21, 24);
sed_SetShadow(win_21, 1);
sed_SetShadowAttr(win_21, BK_COLOR3);
}
// *********************************************************************************
// function name : int PrinterSet(VOID *sdata, int idata)
// function : Select a Printer in window 2 pop up menu
// input : VOID *sdata
// : int idata
// output : TRUE
// *********************************************************************************
int PrinterSet(VOID *sdata, int idata)
{
switch(idata)
{
case 92:
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S0);
printerID = MPC2500; //// MultiPASS C2500
break;
case 190:
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S30);
printerID = MPC30; //// MultiPASS C30
break;
case 191:
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_SIF);
printerID = B380IF; //// CFX-B380IF
break;
case 94:
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S2);
printerID = BJC210; //// BJC-210
break;
case 95:
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S3);
printerID = BJC80; //// BJC-80
break;
case 96:
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S4);
printerID = BJC240; //// BJC-240
break;
case 97:
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S5);
printerID = BJC4200; //// BJC-4200
break;
case 98:
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S6);
printerID = BJC4550; //// BJC-4550
break;
case 93:
default:
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S1);
printerID = BJC4100; //// BJC-4100
break;
}
return(TRUE);
}
// *********************************************************************************
// function name : void Win2_PopUp(sed_type sed)
// function : window 2 pop up menu (Setting Mode)
// input : sed_type win_20 : window 2
// output : void
// *********************************************************************************
void Win2_PopUp(sed_type win_20)
{
int i;
bob_type bob;
for(i=0;i<sed_GetFieldCount(win_20);i++)
{
if(((bob = sed_GetFieldBob(win_20, i)) != NULL) && bob_IsSed(bob))
Win2_PopUp(bob);
}
switch(colors)
{
case BW_COLOR: // Monochrome
sed_SetColors(win_20, WHITE_BLACK, BLACK_WHITE, BLACK_LCYAN);
break;
case SVGA_COLOR: // Super VGA
sed_SetColors(win_20, CYAN_BLACK, CYAN_WHITE, BLACK_CYAN);
break;
default:
case CO_COLOR: // Graphics
sed_SetColors(win_20, CYAN_BLACK, CYAN_GRAY, BLACK_CYAN);
break;
}
sed_SetBorder(win_20, bd_cua);
sed_SetBorderFeature(win_20, BD_TOP | BD_OUTLINE | BD_TITLE | BD_PROMPT);
sed_SetBorderTitle(win_20, WINDOW_2_TITLE);
sed_SetPosition(win_20, 4, 2);
sed_SetHeight(win_20, 2);
sed_SetWidth(win_20, 24);
sed_SetShadow(win_20, 1);
sed_SetShadowAttr(win_20, BK_COLOR3);
}
// *********************************************************************************
// function name : int ModeSet(VOID *sdata, int idata)
// function : Select a Setting Mode in window 2 pop up menu
// input : VOID *sdata
// : int idata
// output : TRUE
// *********************************************************************************
int ModeSet(VOID *sdata, int idata)
{
if(idata == 91)
strcpy(&choice[a240][0], WINDOW_4_0_S1);
else
strcpy(&choice[a240][0], WINDOW_4_0_S0);
return(TRUE);
}
// *********************************************************************************
// function name : void Win3_PopUp(sed_type sed)
// function : window 3 pop up menu
// input : sed_type win_30 : window 3
// output : void
// *********************************************************************************
void Win3_PopUp(sed_type win_30)
{
int i;
bob_type bob;
for(i=0;i<sed_GetFieldCount(win_30);i++)
{
if(((bob = sed_GetFieldBob(win_30, i)) != NULL) && bob_IsSed(bob))
Win3_PopUp(bob);
}
sed_SetBorderFeature(win_30, BD_TOP | BD_OUTLINE | BD_TITLE | BD_PROMPT);
switch(colors)
{
case BW_COLOR: // Monochrome
sed_SetColors(win_30, WHITE_BLACK, BLACK_WHITE, BLACK_LCYAN);
break;
case SVGA_COLOR: // Super VGA
sed_SetColors(win_30, GREEN_BLACK, GREEN_WHITE, BLACK_GREEN);
break;
default:
case CO_COLOR: // Graphics
sed_SetColors(win_30, GREEN_BLACK, GREEN_GRAY, BLACK_GREEN);
break;
}
sed_SetShadow(win_30, 1);
sed_SetShadowAttr(win_30, BK_COLOR3);
}
// *********************************************************************************
// function name : int SelectDisplay(VOID *sdata, int idata)
// function : Send to Printer in window 3 pop up menu (Power Off and etc.)
// input : VOID *sdata
// : int idata
// output : TRUE // move
// *********************************************************************************
int SelectDisplay(VOID *sdata, int idata)
{
int ini, port_240, port_250;
ini = port_240 = port_250 = 0;
sed_Repaint(window_3);
sed_ToggleExit(window_3); // Quit this window
sed_SetNextWin(window_3, sed_GetWin(sedlist[1]));
if(idata != PNG)
{
if(PrinterCheck(1))
{
CommandOutput(BJL_BEGIN_SETTINGS); // Start
CommandOutput(BJL_LF);
switch(idata)
{
case P1A: // Power Off Command
CommandOutput(BJL_POWER_OFF);
break;
case P2A:
CommandOutput(BJL_RESET);
break;
case P3A:
CommandOutput(BJL_EJECT_PAPER);
break;
case P4A:
CommandOutput(BJL_SWITCH_CONTROL);
CommandOutput(BJL_CONTROL_LQ);
break;
case P4B:
CommandOutput(BJL_SWITCH_CONTROL);
CommandOutput(BJL_CONTROL_BJ);
break;
case P4C:
CommandOutput(BJL_SWITCH_CONTROL);
CommandOutput(BJL_CONTROL_AUTO);
break;
case P5A:
CommandOutput(BJL_TEST_PRINT);
CommandOutput(BJL_A);
break;
#if 0
case P5B:
CommandOutput(BJL_TEST_PRINT);
CommandOutput(BJL_B);
break;
case P5C:
CommandOutput(BJL_TEST_PRINT);
CommandOutput(BJL_C);
break;
#endif
case P5D:
CommandOutput(BJL_TEST_PRINT);
CommandOutput(BJL_DEMO_PRINT);
break;
case P5E:
CommandOutput(BJL_TEST_PRINT);
CommandOutput(BJL_NOZZLE_CHECK);
break;
case P6A:
CommandOutput(BJL_CURRENT_SETTINGS);
CommandOutput(BJL_ON);
break;
case P7A:
CommandOutput(BJL_CHANGE_HEAD);
CommandOutput(BJL_1);
break;
case P8A:
CommandOutput(BJL_NORMAL_CLEANING);
CommandOutput(BJL_1);
break;
case P8B:
CommandOutput(BJL_NORMAL_CLEANING);
CommandOutput(BJL_6);
break;
case P9A:
CommandOutput(BJL_INITIALIZE_SETTINGS);
CommandOutput(BJL_FACTORY);
ini = 1;
if(choice[15][4] == '2') // 15.(WIN4_MENU) Printer Port
port_250 = 1;
if(choice[38][4] == '2') // 38.(WIN4_MENU) Printer Port
port_240 = 1;
memcpy(choice, choice_US_BJ, WIN4_BUFF);
if(port_250)
choice[15][4] = '2';
if(port_240)
choice[38][4] = '2';
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S3);
break;
case P9B:
CommandOutput(BJL_INITIALIZE_SETTINGS);
CommandOutput(BJL_TABLE1);
ini = 1;
if(choice[15][4] == '2') // 15.(WIN4_MENU) Printer Port
port_250 = 1;
if(choice[38][4] == '2') // 38.(WIN4_MENU) Printer Port
port_240 = 1;
memcpy(choice, choice_US_LQ, WIN4_BUFF);
if(port_250)
choice[15][4] = '2';
if(port_240)
choice[38][4] = '2';
PrinterName();
break;
case P9C:
CommandOutput(BJL_INITIALIZE_SETTINGS);
CommandOutput(BJL_TABLE2);
ini = 1;
if(choice[15][4] == '2') // 15.(WIN4_MENU) Printer Port
port_250 = 1;
if(choice[38][4] == '2') // 38.(WIN4_MENU) Printer Port
port_240 = 1;
memcpy(choice, choice_US_BJ, WIN4_BUFF);
if(port_250)
choice[15][4] = '2';
if(port_240)
choice[38][4] = '2';
PrinterName();
break;
case P9D:
CommandOutput(BJL_INITIALIZE_SETTINGS);
CommandOutput(BJL_TABLE3);
ini = 1;
if(choice[15][4] == '2') // 15.(WIN4_MENU) Printer Port
port_250 = 1;
if(choice[38][4] == '2') // 38.(WIN4_MENU) Printer Port
port_240 = 1;
memcpy(choice, choice_Eu_LQ, WIN4_BUFF);
if(port_250)
choice[15][4] = '2';
if(port_240)
choice[38][4] = '2';
PrinterName();
break;
case P9E:
CommandOutput(BJL_INITIALIZE_SETTINGS);
CommandOutput(BJL_TABLE4);
ini = 1;
if(choice[15][4] == '2') // 15.(WIN4_MENU) Printer Port
port_250 = 1;
if(choice[38][4] == '2') // 38.(WIN4_MENU) Printer Port
port_240 = 1;
memcpy(choice, choice_Eu_BJ, WIN4_BUFF);
if(port_250)
choice[15][4] = '2';
if(port_240)
choice[38][4] = '2';
PrinterName();
break;
case P9F:
CommandOutput(BJL_INITIALIZE_SETTINGS);
CommandOutput(BJL_TABLE5);
ini = 1;
if(choice[15][4] == '2') // 15.(WIN4_MENU) Printer Port
port_250 = 1;
if(choice[38][4] == '2') // 38.(WIN4_MENU) Printer Port
port_240 = 1;
memcpy(choice, choice_As_BJ, WIN4_BUFF);
if(port_250)
choice[15][4] = '2';
if(port_240)
choice[38][4] = '2';
PrinterName();
break;
case P0A:
CommandOutput(BJL_DUMP_MODE);
CommandOutput(BJL_ON);
break;
case P0B:
CommandOutput(BJL_DUMP_MODE);
CommandOutput(BJL_OFF);
break;
}
CommandOutput(BJL_LF);
CommandOutput(BJL_END_SETTINGS);
CommandOutput(BJL_LF);
if(ini)
{
if(!iniFileWrite())
EndDisplay();
choice_old = (byte)NULL;
Win4_Menu(1);
}
}
}
return(TRUE);
}
// ***********************************************************************
// function name : int MenuBar0(VOID *sdata, int idata)
// function : Exit this program's (Menu Bar)
// input : VOID *sdata
// : int idata // NOT use
// output : TRUE // move
// ***********************************************************************
int MenuBar0(VOID *sdata, int idata)
{
menu_type menu_0_1;
sed_type window_0_1;
menu_0_1 = menu_Open();
menu_Printf(menu_0_1, MENU_0_OK, NULL, &gmenu_funcs, NULL, OKAY_STR);
menu_Printf(menu_0_1, MENU_0_CA, NULL, &gmenu_funcs, NULL, CANCEL_STR);
window_0_1 = sed_Open(menu_0_1);
switch(colors)
{
case BW_COLOR: // Monochrome
sed_SetColors(window_0_1, WHITE_BLACK, WHITE_BLACK, BLACK_WHITE);
break;
case SVGA_COLOR: // Super VGA
sed_SetColors(window_0_1, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
break;
default:
case CO_COLOR: // Graphics
sed_SetColors(window_0_1, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
break;
}
win_SetMouse(window_0_1, winmou_All);
win_SetMouseFeature(window_0_1, MOUF_GREEDY);
sed_SetBorder(window_0_1, bd_cua);
bord_SetTitle(window_0_1, MENU_0_T);
bord_SetFeature(window_0_1, BD_TOP | BD_TITLE | BD_OUTLINE | BD_PROMPT | BD_MOVE);
sed_SetPosition(window_0_1, 6, 22);
sed_SetShadow(window_0_1, 1);
sed_Repaint(window_0_1);
if(sed_Go(window_0_1) == OKAY)
{
sed_Close(window_0_1);
EndDisplay(); // quit = TRUE;
}
else
sed_Close(window_0_1);
sed_ToggleExit(window_1); // Quit this window
sed_SetNextWin(window_1, sed_GetWin(sedlist[3]));
kb_Stuff(FN10);
return(TRUE);
}
// ***********************************************************************
// function name : int MenuBar1(VOID *sdata, int idata)
// function : Display this program's about (Menu Bar)
// input : VOID *sdata
// : int idata // NOT use
// output : TRUE // move
// ***********************************************************************
int MenuBar1(VOID *sdata, int idata)
{
menu_type menu_1_1;
sed_type window_1_1;
menu_1_1 = menu_Open();
menu_Printf(menu_1_1, MENU_1_1);
menu_Printf(menu_1_1, MENU_1_2);
menu_Printf(menu_1_1, MENU_1_3);
menu_Printf(menu_1_1, MENU_1_4);
menu_Printf(menu_1_1, MENU_1_5);
menu_Printf(menu_1_1, MENU_1_OK, NULL, &menu_funcs);
window_1_1 = sed_Open(menu_1_1);
switch(colors){
case BW_COLOR: // Monochrome
sed_SetColors(window_1_1, BLACK_WHITE, BLACK_WHITE, WHITE_BLACK);
break;
case SVGA_COLOR: // Super VGA
sed_SetColors(window_1_1, RED_WHITE, RED_WHITE, WHITE_RED);
break;
default:
case CO_COLOR: // Graphics
sed_SetColors(window_1_1, RED_WHITE, RED_WHITE, WHITE_RED);
break;
}
sed_SetShadow(window_1_1, 1);
win_SetMouse(window_1_1, winmou_All);
win_SetMouseFeature(window_1_1, MOUF_GREEDY);
sed_SetBorder(window_1_1, bd_cua);
bord_SetTitle(window_1_1, MENU_1_T);
bord_SetFeature(window_1_1, BD_TOP | BD_TITLE | BD_OUTLINE | BD_MOVE);
sed_SetPosition(window_1_1, 6, 14);
sed_Repaint(window_1_1);
sed_Go(window_1_1);
sed_Close(window_1_1);
sed_ToggleExit(window_1); // Quit this window
sed_SetNextWin(window_1, sed_GetWin(sedlist[3]));
kb_Stuff(FN8);
return(TRUE);
}
// ***********************************************************************
// function name : int MenuBar2(VOID *sdata, int idata)
// function : Send printer's setting parameters (Menu Bar)
// input : VOID *sdata
// : int idata // NOT use
// output : TRUE // move
// ***********************************************************************
int MenuBar2(VOID *sdata, int idata)
{
menu_type menu_2_1;
sed_type window_2_1;
menu_2_1 = menu_Open();
menu_Printf(menu_2_1, MENU_2_OK, NULL, &gmenu_funcs, NULL, OKAY_STR);
menu_Printf(menu_2_1, MENU_2_CA, NULL, &gmenu_funcs, NULL, CANCEL_STR);
window_2_1 = sed_Open(menu_2_1);
switch(colors)
{
case BW_COLOR: // Monochrome
sed_SetColors(window_2_1, WHITE_BLACK, WHITE_BLACK, BLACK_WHITE);
break;
case SVGA_COLOR: // Super VGA
sed_SetColors(window_2_1, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
break;
default:
case CO_COLOR: // Graphics
sed_SetColors(window_2_1, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
break;
}
sed_SetShadow(window_2_1, 1);
win_SetMouse(window_2_1, winmou_All);
win_SetMouseFeature(window_2_1, MOUF_GREEDY);
sed_SetBorder(window_2_1, bd_cua);
bord_SetTitle(window_2_1, MENU_2_T);
bord_SetFeature(window_2_1, BD_TOP | BD_TITLE | BD_OUTLINE | BD_PROMPT | BD_MOVE);
sed_SetPosition(window_2_1, 6, 22);
sed_Repaint(window_2_1);
if(sed_Go(window_2_1) == OKAY)
{
if(PrinterCheck(1))
{
if((printerID == BJC210) || (printerID == BJC240))
{
if((memcmp(&choice[45][0], &choice_US_LQ[45][0], 9)) && (memcmp(&choice[26][0], &choice_US_LQ[26][0], 9)))
{
sed_Close(window_2_1);
sed_ToggleExit(window_1);
sed_SetNextWin(window_1, sed_GetWin(sedlist[3]));
kb_Stuff(FN6);
opc_Prompt(NULL, ERROR, 0, ERROR_REDUCTION);
return(TRUE);
}
}
//
CommandOutput(BJL_BEGIN_SETTINGS); //// Start
CommandOutput(BJL_LF);
CommandOutput(BJL_CONTROL_MODE); //// BJ Mode
CommandOutput(BJL_CONTROL_BJ);
CommandOutput(BJL_LF);
if(printerID != BJC80)
{
CommandOutput(BJL_SELECT_FONT); // 5. Font
switch(choice[a240+5][FONT_ORDER])
{
case FONT_ROMAN:
CommandOutput(BJL_ROMAN);
break;
case FONT_GOTHIC:
CommandOutput(BJL_GOTHIC);
break;
case FONT_PRESTIGE:
CommandOutput(BJL_PRESTIGE);
break;
case FONT_SCRIPT:
CommandOutput(BJL_SCRIPT);
break;
case FONT_DRAFT:
CommandOutput(BJL_DRAFT);
break;
case FONT_COURIER:
default:
CommandOutput(BJL_COURIER);
break;
}
CommandOutput(BJL_LF);
}
CommandOutput(BJL_CODE_PAGE); // 6. Code Page
switch(choice[a240+6][3])
{
case '0':
if(choice[a240+6][2] == '5')
CommandOutput(BJL_850);
else
CommandOutput(BJL_860);
break;
case '3':
CommandOutput(BJL_863);
break;
case '5':
if(choice[a240+6][2] == '6')
CommandOutput(BJL_865);
else
CommandOutput(BJL_855);
break;
case '2':
CommandOutput(BJL_852);
break;
case '4':
CommandOutput(BJL_864);
break;
case '9':
CommandOutput(BJL_869);
break;
case '7':
default:
if(choice[a240+6][1] == '8')
CommandOutput(BJL_857);
else
CommandOutput(BJL_437);
break;
}
CommandOutput(BJL_LF);
CommandOutput(BJL_PAGE_LENGTH); // 7. Page Length
if(choice[a240+7][2] == '2')
CommandOutput(BJL_12);
else
CommandOutput(BJL_11);
CommandOutput(BJL_LF);
CommandOutput(BJL_CHARACTER_SET); // 8. Character Set
switch(choice[a240+8][5])
{
case '2':
CommandOutput(BJL_SET_2);
break;
case '1':
default:
CommandOutput(BJL_SET_1);
break;
}
CommandOutput(BJL_LF);
CommandOutput(BJL_TEXT_SCALE); // 9. Text Scale Mode
if(choice[a240+9][1] == CHAR_ENABLE)
CommandOutput(BJL_ON);
else
CommandOutput(BJL_OFF);
CommandOutput(BJL_LF);
CommandOutput(BJL_AUTOMATIC_LF); // 11. Auto Line Feed (LF)
if(choice[a240+11][9] == '+')
CommandOutput(BJL_ON);
else
CommandOutput(BJL_OFF);
CommandOutput(BJL_LF);
CommandOutput(BJL_AUTOMATIC_CR); // 12. Auto Carriage Return (CR)
if(choice[a240+12][9] == '+')
CommandOutput(BJL_ON);
else
CommandOutput(BJL_OFF);
CommandOutput(BJL_LF);
CommandOutput(BJL_AGM); // 13. Auto AGM
if(choice[a240+13][1] == CHAR_ENABLE)
CommandOutput(BJL_ON);
else
CommandOutput(BJL_OFF);
CommandOutput(BJL_LF);
if((printerID == BJC80) || (printerID >= MPC2500))
{
CommandOutput(BJL_PAPER_LOAD_POSITION); // Top Margin
switch(choice[47][1])
{
case '1':
CommandOutput(BJL_10_0);
break;
case '5':
CommandOutput(BJL_5_0);
break;
case '8':
CommandOutput(BJL_8_5);
break;
case '3':
default:
CommandOutput(BJL_3_0);
break;
}
CommandOutput(BJL_LF);
CommandOutput(BJL_HOST_LOCK_OUT); // Font Lock
if(choice[49][1] == CHAR_ENABLE)
CommandOutput(BJL_ON);
else
CommandOutput(BJL_OFF);
CommandOutput(BJL_LF);
}
CommandOutput(BJL_END_SETTINGS);
CommandOutput(BJL_LF);
//
CommandOutput(BJL_BEGIN_SETTINGS); //// Start
CommandOutput(BJL_LF);
CommandOutput(BJL_CONTROL_MODE); //// LQ Mode
CommandOutput(BJL_CONTROL_LQ);
CommandOutput(BJL_LF);
if(printerID != BJC80)
{
CommandOutput(BJL_SELECT_FONT); // 16(5). Font
switch(choice[a240+16][FONT_ORDER])
{
case FONT_COURIER:
CommandOutput(BJL_COURIER);
break;
case FONT_GOTHIC:
CommandOutput(BJL_GOTHIC);
break;
case FONT_PRESTIGE:
CommandOutput(BJL_PRESTIGE);
break;
case FONT_SCRIPT:
CommandOutput(BJL_SCRIPT);
break;
case FONT_DRAFT:
CommandOutput(BJL_DRAFT);
break;
case FONT_ROMAN:
default:
CommandOutput(BJL_ROMAN);
break;
}
CommandOutput(BJL_LF);
}
CommandOutput(BJL_CODE_PAGE); // 17(6). Code Page
switch(choice[a240+17][3])
{
case '0':
if(choice[a240+17][2] == '5')
CommandOutput(BJL_850);
else
CommandOutput(BJL_860);
break;
case '3':
CommandOutput(BJL_863);
break;
case '5':
if(choice[a240+17][2] == '6')
CommandOutput(BJL_865);
else
CommandOutput(BJL_855);
break;
case '2':
CommandOutput(BJL_852);
break;
case '4':
CommandOutput(BJL_864);
break;
case '9':
CommandOutput(BJL_869);
break;
case '7':
default:
if(choice[a240+17][1] == '8')
CommandOutput(BJL_857);
else
CommandOutput(BJL_437);
break;
}
CommandOutput(BJL_LF);
if((printerID != BJC80) && (printerID < MPC2500))
{
CommandOutput(BJL_PAGE_LENGTH); // 18(7). Page Length
if(choice[a240+18][1] == '2')
CommandOutput(BJL_22);
else if(choice[a240+18][2] == '2')
CommandOutput(BJL_12);
else
CommandOutput(BJL_11);
CommandOutput(BJL_LF);
}
CommandOutput(BJL_CHARACTER_SET); // 19(8). Character Set
switch(choice[a240+19][1])
{
case CHAR_SET_ITALIC:
CommandOutput(BJL_ITALIC);
break;
case CHAR_SET_GRAPHIC:
default:
CommandOutput(BJL_GRAPHICS);
break;
}
CommandOutput(BJL_LF);
CommandOutput(BJL_TEXT_SCALE); // 20(9). Text Scale Mode
if(choice[a240+20][1] == CHAR_ENABLE)
CommandOutput(BJL_ON);
else
CommandOutput(BJL_OFF);
CommandOutput(BJL_LF);
CommandOutput(BJL_AUTOMATIC_LF); // 21(11). Auto Line Feed (LF)
if(choice[a240+21][9] == '+')
CommandOutput(BJL_ON);
else
CommandOutput(BJL_OFF);
CommandOutput(BJL_LF);
CommandOutput(BJL_INTERNATIONAL_CHAR); // 14. International Character Set
switch(choice[a240+14][1])
{
case 'J':
CommandOutput(BJL_JAPAN);
break;
case 'N':
CommandOutput(BJL_NORWAY);
break;
case 'D':
if(printerID == BJC80)
CommandOutput(BJL_DENMARK);
else
{
if(choice[a240+14][9] == '2')
CommandOutput(BJL_DENMARK_2);
else
CommandOutput(BJL_DENMARK_1);
}
break;
case 'S':
if(printerID == BJC80)
{
if(choice[a240+14][2] == 'p')
CommandOutput(BJL_SPAIN);
else
CommandOutput(BJL_SWEDEN);
}
else
{
switch(choice[a240+14][7])
{
case '2':
CommandOutput(BJL_SPAIN_2);
break;
case '1':
CommandOutput(BJL_SPAIN_1);
break;
case '7':
default:
CommandOutput(BJL_SWEDEN);
break;
}
}
break;
case 'L':
if(choice[a240+14][2] == 'a')
CommandOutput(BJL_LATIN_AMERICA);
else
CommandOutput(BJL_LEGAL);
break;
case 'K':
CommandOutput(BJL_KOREA);
break;
case 'F':
CommandOutput(BJL_FRANCE);
break;
case 'G':
CommandOutput(BJL_GERMANY);
break;
case 'I':
CommandOutput(BJL_ITALY);
break;
case 'U':
default:
if(choice[a240+14][3] == 'K')
CommandOutput(BJL_UK);
else
CommandOutput(BJL_USA);
break;
}
CommandOutput(BJL_LF);
if((printerID == BJC80) || (printerID >= MPC2500))
{
CommandOutput(BJL_PAPER_LOAD_POSITION); // Top Margin
switch(choice[48][1])
{
case '1':
CommandOutput(BJL_10_0);
break;
case '5':
CommandOutput(BJL_5_0);
break;
case '8':
CommandOutput(BJL_8_5);
break;
case '3':
default:
CommandOutput(BJL_3_0);
break;
}
CommandOutput(BJL_LF);
CommandOutput(BJL_HOST_LOCK_OUT); // Font Lock
if(choice[50][1] == CHAR_ENABLE)
CommandOutput(BJL_ON);
else
CommandOutput(BJL_OFF);
CommandOutput(BJL_LF);
}
CommandOutput(BJL_END_SETTINGS);
CommandOutput(BJL_LF);
//
CommandOutput(BJL_BEGIN_SETTINGS); //// Start
CommandOutput(BJL_LF);
CommandOutput(BJL_CONTROL_MODE); //// Common
CommandOutput(BJL_CONTROL_COMMON);
CommandOutput(BJL_LF);
CommandOutput(BJL_PAPER_SIZE); // 1. Paper Selection
switch(choice[a240+1][PAPER_ORDER])
{
case PAPER_A4:
CommandOutput(BJL_A4);
break;
case PAPER_B5:
CommandOutput(BJL_B5);
break;
case PAPER_10_ENVELOPE:
CommandOutput(BJL_10_ENVELOPE);
break;
case PAPER_DL_ENVELOPE:
CommandOutput(BJL_DL_ENVELOPE);
break;
case PAPER_LETTER:
default:
if(choice[a240+1][PAPER_ORDER_3] == PAPER_LEGAL)
CommandOutput(BJL_LEGAL);
else
CommandOutput(BJL_LETTER);
break;
}
CommandOutput(BJL_LF);
CommandOutput(BJL_PRINT_MODE); // 2. Print Mode
if(choice[a240+2][1] == 'F')
CommandOutput(BJL_FINE);
else if(choice[a240+2][6] == 'S')
CommandOutput(BJL_HS);
else
CommandOutput(BJL_HQ);
CommandOutput(BJL_LF);
CommandOutput(BJL_SMOOTHING); // 3. Smoothing
if(choice[a240+3][1] == CHAR_ENABLE)
CommandOutput(BJL_ON);
else
CommandOutput(BJL_OFF);
CommandOutput(BJL_LF);
if((printerID >= BJC210) && (printerID <= BJC240))
{
CommandOutput(BJL_SET_REDUCTION); // 35. Reduction (A240 only)
switch(choice[45][REDUCTION_ORDER])
{
case REDUCTION_TWO_THIRDS:
CommandOutput(BJL_WIDE3);
break;
case REDUCTION_ONE_HALF:
CommandOutput(BJL_FORM1);
break;
case REDUCTION_DISABLE:
default:
CommandOutput(BJL_OFF);
break;
}
CommandOutput(BJL_LF);
}
if(printerID < MPC2500)
{
if(printerID >= BJC240)
{
CommandOutput(BJL_AUTOMATIC_POWER_ON); // 36. Auto Power On
if(choice[46][1] == CHAR_ENABLE)
CommandOutput(BJL_ENABLE);
else
CommandOutput(BJL_DISABLE);
CommandOutput(BJL_LF);
}
CommandOutput(BJL_AUTOMATIC_POWER_OFF); // 4. Auto Power Off
switch(choice[a240+4][2])
{
case ' ':
CommandOutput(BJL_1);
break;
case '0':
switch(choice[a240+4][1])
{
case '1':
CommandOutput(BJL_10);
break;
case '3':
CommandOutput(BJL_30);
break;
case '6':
default:
CommandOutput(BJL_60);
break;
}
break;
case 'i':
default:
CommandOutput(BJL_DISABLE);
break;
}
CommandOutput(BJL_LF);
}
if(printerID == BJC80)
{
CommandOutput(BJL_SELECT_FONT); // 16(5). Font ////BJC-80 only
switch(choice[a240+16][FONT_ORDER])
{
case FONT_COURIER:
CommandOutput(BJL_COURIER);
break;
case FONT_GOTHIC:
CommandOutput(BJL_GOTHIC);
break;
case FONT_PRESTIGE:
CommandOutput(BJL_PRESTIGE);
break;
case FONT_SCRIPT:
CommandOutput(BJL_SCRIPT);
break;
case FONT_DRAFT:
CommandOutput(BJL_DRAFT);
break;
case FONT_ROMAN:
default:
CommandOutput(BJL_ROMAN);
break;
}
CommandOutput(BJL_LF);
}
CommandOutput(BJL_SWITCH_BUFFERS); // 10. Download Buffer
if(choice[a240+10][1] == CHAR_ENABLE)
CommandOutput(BJL_DOWNLOAD);
else
CommandOutput(BJL_INPUT);
CommandOutput(BJL_LF);
CommandOutput(BJL_END_SETTINGS);
CommandOutput(BJL_LF);
}
}
sed_Close(window_2_1);
sed_ToggleExit(window_1); // Quit this window
sed_SetNextWin(window_1, sed_GetWin(sedlist[3]));
kb_Stuff(FN6);
return(TRUE);
}
// *********************************************************************************
// function name : void CommandOutput(unsigned char *,unsigned int,unsigned int,unsigned int)
// function : output commands
// input : unsigned char *commandBJL : command code
// unsigned int commandLen : number of command length
// unsigned int commandPar : number of parameter ; no 0
// unsigned int commandNV : NV-RAM store 1 ; not 0
// output : void
// *********************************************************************************
void CommandOutput
(
unsigned char *commandBJL,
unsigned int commandLen,
unsigned int commandPer,
unsigned int commandNV
)
{
while(commandLen-- > 0)
{
_bios_printer((unsigned int)_WRITE, (unsigned int)port, (unsigned int)*commandBJL);
*commandBJL++;
}
if(commandPer)
CommandOutput(BJL_EQU);
#if 0
if(commandNV)
;
#endif
}
// ***********************************************************************
// function name : int MenuBar3(VOID *sdata, int idata)
// function : Display printer's status (Menu Bar)
// input : VOID *sdata
// : int idata // NOT use
// output : TRUE // move
// ***********************************************************************
int MenuBar3(VOID *sdata, int idata)
{
PrinterCheck(0);
sed_ToggleExit(window_1); // Quit this window
sed_SetNextWin(window_1, sed_GetWin(sedlist[3]));
kb_Stuff(FN5);
return(TRUE);
}
// ***********************************************************************
// function name : int MenuBar4(VOID *sdata, int idata)
// function : Change the default settings (Menu Bar)
// input : VOID *sdata
// : int idata // NOT use
// output : TRUE // move
// ***********************************************************************
int MenuBar4(VOID *sdata, int idata)
{
menu_type menu_4_1;
sed_type window_4_1;
menu_4_1 = menu_Open();
menu_Printf(menu_4_1, MENU_4_OK, NULL, &gmenu_funcs, NULL, OKAY_STR);
menu_Printf(menu_4_1, MENU_4_CA, NULL, &gmenu_funcs, NULL, CANCEL_STR);
window_4_1 = sed_Open(menu_4_1);
switch(colors)
{
case BW_COLOR: // Monochrome
sed_SetColors(window_4_1, WHITE_BLACK, WHITE_BLACK, BLACK_WHITE);
break;
case SVGA_COLOR: // Super VGA
sed_SetColors(window_4_1, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
break;
default:
case CO_COLOR: // Graphics
sed_SetColors(window_4_1, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
break;
}
sed_SetShadow(window_4_1, 1);
win_SetMouse(window_4_1, winmou_All);
win_SetMouseFeature(window_4_1, MOUF_GREEDY);
sed_SetBorder(window_4_1, bd_cua);
bord_SetTitle(window_4_1, MENU_4_T);
bord_SetFeature(window_4_1, BD_TOP | BD_TITLE | BD_OUTLINE | BD_PROMPT | BD_MOVE);
sed_SetPosition(window_4_1, 6, 26);
sed_Repaint(window_4_1);
if(sed_Go(window_4_1) == OKAY)
{
if(printerID == BJC80)
memcpy(choice, choice_US_BJ, WIN4_BUFF);
else
memcpy(choice, choice_default, WIN4_BUFF);
choice_old = (byte)NULL;
Win4_Menu(1);
}
sed_Close(window_4_1);
sed_ToggleExit(window_1); // Quit this window
sed_SetNextWin(window_1, sed_GetWin(sedlist[3]));
kb_Stuff(FN7);
return(TRUE);
}
// ***********************************************************************
// function name : int MenuBar5(VOID *sdata, int idata)
// function : Display this program's help (Menu Bar)
// input : VOID *sdata
// : int idata // NOT use
// output : TRUE // move
// ***********************************************************************
int MenuBar5(VOID *sdata, int idata)
{
menu_type menu_5_1;
sed_type window_5_1;
menu_5_1 = menu_Open();
menu_Printf(menu_5_1, MENU_5_1);
menu_Printf(menu_5_1, MENU_5_2);
menu_Printf(menu_5_1, MENU_5_3);
menu_Printf(menu_5_1, MENU_5_OK, NULL, &menu_funcs);
window_5_1 = sed_Open(menu_5_1);
switch(colors)
{
case BW_COLOR: // Monochrome
sed_SetColors(window_5_1, WHITE_BLACK, WHITE_BLACK, BLACK_WHITE);
break;
case SVGA_COLOR: // Super VGA
sed_SetColors(window_5_1, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
break;
default:
case CO_COLOR: // Graphics
sed_SetColors(window_5_1, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
break;
}
sed_SetShadow(window_5_1, 1);
win_SetMouse(window_5_1, winmou_All);
win_SetMouseFeature(window_5_1, MOUF_GREEDY);
sed_SetBorder(window_5_1, bd_cua);
bord_SetTitle(window_5_1, MENU_5_T);
bord_SetFeature(window_5_1, BD_TOP | BD_TITLE | BD_OUTLINE | BD_MOVE);
sed_SetPosition(window_5_1, 6, 16);
sed_Repaint(window_5_1);
sed_Go(window_5_1);
sed_Close(window_5_1);
sed_ToggleExit(window_1); // Quit this window
sed_SetNextWin(window_1, sed_GetWin(sedlist[3]));
kb_Stuff(FN9);
return(TRUE);
}
// ***********************************************************************
// function name : void PrinterCheck(int check)
// function : check the printer
// input : int check : 0 - Full check (for status)
// : : 1 - Busy check only (for send)
// output : int : FALSE - NG
// : TRUE - OK
// ***********************************************************************
int PrinterCheck(int check)
{
menu_type menu_p_check;
sed_type window_p_check;
unsigned int status; // printer's status
int err = 0;
if(choice[a240+15][4] == '2') // Printer Port
port = LPT2;
else
port = LPT1;
status = _bios_printer((unsigned int)_STATUS, (unsigned int)port, (unsigned int)NULL);
if(check)
{
if((!(status&PRINTER_TIME_OUT))&(!(status&PRINTER_I_O_ERROR))&(!(status&PRINTER_OUT_OF_PAPER)))
return(TRUE);
}
menu_p_check = menu_Open();
menu_Printf(menu_p_check, "\n");
if(status&PRINTER_TIME_OUT) // Printer timed out
{
menu_Printf(menu_p_check, " !%s \n -%s \n\n", &ErrorMsg[0][0], &PRINTER_ERROR);
err = 1;
}
if(status&PRINTER_NOT_USED1) // Not used
{
menu_Printf(menu_p_check, " !%s \n -%s \n\n", &ErrorMsg[1][0], &PRINTER_ERROR);
err = 1;
}
if(status&PRINTER_NOT_USED2) // Not used
{
menu_Printf(menu_p_check, " !%s \n -%s \n\n", &ErrorMsg[2][0], &PRINTER_ERROR);
err = 1;
}
if(status&PRINTER_I_O_ERROR) // I/O error
{
menu_Printf(menu_p_check, " !%s \n -%s \n\n", &ErrorMsg[3][0], &PRINTER_ERROR);
err = 1;
}
if(status&PRINTER_OUT_OF_PAPER) // Out of paper
{
menu_Printf(menu_p_check, " !%s \n -%s \n\n", &ErrorMsg[5][0], &PRINTER_ERROR);
err = 1;
}
//
if((!check)&(!err))
{
if(status&PRINTER_SELECTED) // Printer selected
menu_Printf(menu_p_check, " *%s \n", &ErrorMsg[4][0]);
if(status&PRINTER_ACKNOWLEDGE) // Acknowledge
menu_Printf(menu_p_check, " *%s \n", &ErrorMsg[6][0]);
if(status&PRINTER_NOT_BUSY) // Printer not busy
menu_Printf(menu_p_check, " *%s \n", &ErrorMsg[7][0]);
if(status&(!PRINTER_NO_ERROR)) // Printer NO Error
menu_Printf(menu_p_check, " *%s \n", &ErrorMsg[8][0]);
}
menu_Printf(menu_p_check, MENU_3_OK2, NULL, &menu_funcs);
window_p_check = sed_Open(menu_p_check);
switch(colors)
{
case BW_COLOR: // Monochrome
sed_SetColors(window_p_check, WHITE_BLACK, WHITE_BLACK, BLACK_LCYAN);
break;
case SVGA_COLOR: // Super VGA
sed_SetColors(window_p_check, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
break;
default:
case CO_COLOR: // Graphics
sed_SetColors(window_p_check, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
break;
}
sed_SetShadow(window_p_check, 1);
win_SetMouse(window_p_check, winmou_All);
win_SetMouseFeature(window_p_check, MOUF_GREEDY);
sed_SetBorder(window_p_check, bd_cua);
bord_SetTitle(window_p_check, MENU_3_T);
bord_SetFeature(window_p_check, BD_TOP | BD_TITLE | BD_OUTLINE | BD_PROMPT | BD_MOVE);
sed_SetPosition(window_p_check, 6, 20);
sed_Repaint(window_p_check);
sed_Go(window_p_check);
sed_Close(window_p_check);
return(FALSE);
}
// ***********************************************************************
// function name : int ConfirmDelete(void)
// function : confirm the delete menu box
// input : char *file : file name
// output : TRUE -> delete
// : FALSE -> NOT delete
// ***********************************************************************
int ConfirmDelete(char *file)
{
menu_type menu_2_delete;
sed_type window_2_delete;
menu_2_delete = menu_Open();
menu_Printf(menu_2_delete, MENU_2_D_F, &file[0]);
menu_Printf(menu_2_delete, MENU_2_D_OK, NULL, &gmenu_funcs, NULL, OKAY_STR);
menu_Printf(menu_2_delete, MENU_2_D_CA, NULL, &gmenu_funcs, NULL, CANCEL_STR);
window_2_delete = sed_Open(menu_2_delete);
switch(colors)
{
case BW_COLOR: // Monochrome
sed_SetColors(window_2_delete, WHITE_BLACK, WHITE_BLACK, BLACK_WHITE);
break;
case SVGA_COLOR: // Super VGA
sed_SetColors(window_2_delete, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
break;
default:
case CO_COLOR: // Graphics
sed_SetColors(window_2_delete, BLUE_WHITE, BLUE_WHITE, WHITE_BLUE);
break;
}
sed_SetShadow(window_2_delete, 1);
win_SetMouse(window_2_delete, winmou_All);
win_SetMouseFeature(window_2_delete, MOUF_GREEDY);
sed_SetBorder(window_2_delete, bd_cua);
bord_SetTitle(window_2_delete, MENU_2_D_T);
bord_SetFeature(window_2_delete, BD_TOP | BD_TITLE | BD_OUTLINE | BD_PROMPT | BD_MOVE);
sed_Center(window_2_delete);
sed_Repaint(window_2_delete);
if(sed_Go(window_2_delete) == OKAY)
{
sed_Close(window_2_delete);
return(TRUE);
}
else
{
sed_Close(window_2_delete);
return(FALSE);
}
}
// create the windows 4 ------------------------------------------------------------------------
// *********************************************************************************
// function name : void Win4_Menu(int first)
// function : window 3 pop up menu
// input : int first : 0 -> first, 1 -> NOT first, 2 -> special
// output : TRUE : 1
// *********************************************************************************
int Win4_Menu(int first)
{
menu_type menu_4;
int autoPowerOn, reduction, topMargin;
if(choice_old == choice[a240][1])
return(TRUE);
if(first)
sed_Close(window_4);
topMargin = 0;
if((printerID >= BJC240) && (printerID < MPC2500))
autoPowerOn = 1;
else
autoPowerOn = 0;
if((printerID >= BJC210) && (printerID <= BJC240))
reduction = 1;
else
reduction = 0;
menu_4 = menu_Open();
menu_Printf( menu_4, WINDOW_4_0, &choice[a240][0]);
if(printerID == BJC80)
{
menu_Printf( menu_4, WINDOW_4_1, &choice[a240+1][0], &list_funcs, WINDOW_4_5_H, WINDOW_4_1_80) ; // Paper size
topMargin = 2;
}
else if(printerID >= MPC2500)
{
menu_Printf( menu_4, WINDOW_4_1, &choice[a240+1][0], &list_funcs, WINDOW_4_5_H, WINDOW_4_1_2500);
topMargin = 1;
}
else
menu_Printf( menu_4, WINDOW_4_1, &choice[a240+1][0], &list_funcs, WINDOW_4_5_H, WINDOW_4_1_S) ;
if((printerID == BJC210) || (printerID == BJC240))
menu_Printf( menu_4, WINDOW_4_2, &choice[a240+2][0], &list_funcs, WINDOW_4_5_H, WINDOW_4_2_240); // Print Mode
else
menu_Printf( menu_4, WINDOW_4_2, &choice[2][0], &list_funcs, WINDOW_4_5_H, WINDOW_4_2_S) ;
menu_Printf( menu_4, WINDOW_4_3, &choice[a240+3][0], &list_funcs, WINDOW_4_5_H, WINDOW_4_3_S) ;
if(reduction)
menu_Printf( menu_4, WINDOW_4_35, &choice[45][0], &list_funcs, WINDOW_4_5_H, WINDOW_4_35_S);
if(printerID < MPC2500)
{
if(autoPowerOn)
menu_Printf( menu_4, WINDOW_4_36, &choice[46][0], &list_funcs, WINDOW_4_5_H, WINDOW_4_3_S) ; // Auto Power On
if(printerID == BJC80)
menu_Printf( menu_4, WINDOW_4_4, &choice[a240+4][0], &list_funcs, WINDOW_4_5_H, WINDOW_4_4_80); // Auto Power Off
else
menu_Printf( menu_4, WINDOW_4_4, &choice[a240+4][0], &list_funcs, WINDOW_4_5_H, WINDOW_4_4_S) ; // Auto Power Off
}
if(choice[a240][1] == BUBBLE_JET)
{
if((printerID == BJC80) || (printerID >= MPC2500))
menu_Printf( menu_4, WINDOW_4_5_B, &choice[a240+5][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_5_80) ;
else
menu_Printf( menu_4, WINDOW_4_5_B, &choice[a240+5][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_5_S) ;
if(printerID == BJC4100)
menu_Printf( menu_4, WINDOW_4_6_B, &choice[6][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_6_S) ;
else if((printerID == BJC80) || (printerID >= MPC2500))
menu_Printf( menu_4, WINDOW_4_6_B, &choice[6][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_6_80);
else
menu_Printf( menu_4, WINDOW_4_6_B, &choice[a240+6][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_6_240);
if((printerID == BJC80) || (printerID >= MPC2500))
menu_Printf( menu_4, WINDOW_4_7_B, &choice[a240+7][0], &list_funcs, WINDOW_4_2_H, WINDOW_4_7_S1); // Page Length
else
menu_Printf( menu_4, WINDOW_4_7_B, &choice[a240+7][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_7_S1); // Page Length
menu_Printf( menu_4, WINDOW_4_8_B, &choice[a240+8][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_8_S1);
menu_Printf( menu_4, WINDOW_4_9_B, &choice[a240+9][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_3_S) ;
menu_Printf( menu_4, WINDOW_4_10, &choice[a240+10][0], &list_funcs, WINDOW_4_5_H, WINDOW_4_3_S) ;
menu_Printf( menu_4, WINDOW_4_11_B, &choice[a240+11][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_11_S);
menu_Printf( menu_4, WINDOW_4_12, &choice[a240+12][0], &list_funcs, WINDOW_4_2_H, WINDOW_4_12_S);
menu_Printf( menu_4, WINDOW_4_13, &choice[a240+13][0], &list_funcs, WINDOW_4_2_H, WINDOW_4_3_S) ;
menu_Printf( menu_4, WINDOW_4_14_C, NULL, &click_funcs, WINDOW_4_3_H) ;
if((printerID == BJC80) || (printerID >= MPC2500))
{
menu_Printf( menu_4, WINDOW_4_TOP_B, &choice[47][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_TOP_S); // BJ Top Margin
menu_Printf( menu_4, WINDOW_4_LOCK_B, &choice[49][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_3_S) ; // BJ Host Lock
}
}
else
{
if((printerID == BJC80) || (printerID >= MPC2500))
menu_Printf( menu_4, WINDOW_4_5_L, &choice[a240+16][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_5_80);
else
menu_Printf( menu_4, WINDOW_4_5_L, &choice[a240+16][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_5_S) ;
if(printerID == BJC4100)
menu_Printf( menu_4, WINDOW_4_6_L, &choice[17][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_6_S) ;
else if((printerID == BJC80) || (printerID >= MPC2500))
menu_Printf( menu_4, WINDOW_4_6_L, &choice[17][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_6_80);
else
menu_Printf( menu_4, WINDOW_4_6_L, &choice[a240+17][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_6_240);
if((printerID == BJC80) || (printerID >= MPC2500))
menu_Printf( menu_4, WINDOW_4_7_L_80, NULL, &click_funcs, WINDOW_4_2_H); // Page Length
else
menu_Printf( menu_4, WINDOW_4_7_L, &choice[a240+18][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_7_S0); // Page Length
menu_Printf( menu_4, WINDOW_4_8_L, &choice[a240+19][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_8_S0);
menu_Printf( menu_4, WINDOW_4_9_L, &choice[a240+20][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_3_S) ;
menu_Printf( menu_4, WINDOW_4_10, &choice[a240+10][0], &list_funcs, WINDOW_4_5_H, WINDOW_4_3_S) ;
menu_Printf( menu_4, WINDOW_4_11_L, &choice[a240+21][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_11_S);
menu_Printf( menu_4, WINDOW_4_12_C, NULL, &click_funcs, WINDOW_4_2_H) ;
menu_Printf( menu_4, WINDOW_4_13_C, NULL, &click_funcs, WINDOW_4_2_H) ;
if(printerID == BJC80)
menu_Printf( menu_4, WINDOW_4_14, &choice[a240+14][0], &list_funcs, WINDOW_4_3_H, WINDOW_4_14_80);
else
menu_Printf( menu_4, WINDOW_4_14, &choice[a240+14][0], &list_funcs, WINDOW_4_3_H, WINDOW_4_14_S);
if((printerID == BJC80) || (printerID >= MPC2500))
{
menu_Printf( menu_4, WINDOW_4_TOP_L, &choice[48][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_TOP_S); // LQ Top Margin
menu_Printf( menu_4, WINDOW_4_LOCK_L, &choice[50][0], &list_funcs, WINDOW_4_6_H, WINDOW_4_3_S) ; // LQ Host Lock
}
}
menu_Printf( menu_4, WINDOW_4_15, &choice[a240+15][0], &list_funcs, WINDOW_4_4_H, WINDOW_4_15_S); // Printer Port
window_4 = sed_Open(menu_4);
switch(colors)
{
case BW_COLOR: // Monochrome
sed_SetColors(window_4, WHITE_BLACK, BLACK_WHITE, BLACK_LCYAN);
break;
case SVGA_COLOR: // Super VGA
sed_SetColors(window_4, CYAN_BLACK, CYAN_WHITE, BLACK_CYAN);
break;
default:
case CO_COLOR: // Graphics
sed_SetColors(window_4, CYAN_BLACK, CYAN_GRAY, BLACK_CYAN);
break;
}
sed_SetBorder(window_4, bd_cua);
sed_SetBorderFeature(window_4, BD_TITLE | BD_OUTLINE | BD_TOP | BD_PROMPT);
sed_SetBorderTitle(window_4, WINDOW_4_TITLE);
sed_SetPosition(window_4, 4, 29);
sed_SetHeight(window_4, autoPowerOn+reduction+topMargin+16);
sed_SetWidth(window_4, 47);
sed_SetShadow(window_4, 1);
sed_SetShadowAttr(window_4, BK_COLOR3);
sed_SetLabel(window_4, 4);
// Attach a mouse handler to the sed
win_SetMouse(window_4, winmou_All);
win_SetMouseFeature(window_4, MOUF_TRACK);
sed_Repaint(window_4);
choice_old = choice[a240][1];
sedlist[2] = window_4;
sed_SetSpecial(window_4, spc_Jump);
sed_SetAux(window_4, aux_Top);
return(TRUE);
}
// create the windows 3 ------------------------------------------------------------------------
// *********************************************************************************
// function name : void Win3_Menu_Printer(void)
// function : window 3 pop up menu
// input : void
// output : TRUE : 1
// *********************************************************************************
int Win3_Menu_Printer(void)
{
int height;
height = 9;
switch(printerID)
{
case MPC2500:
case MPC30:
// case B380IF: // SK, 5/15/96
case BJC4100:
switch(colors)
{
case BW_COLOR: // Monochrome
window_3 = slug_Open(win3_menu, SLUG_VERTICAL, bd_cua, WHITE_BLACK, BLACK_LCYAN, BLACK_WHITE);
break;
case SVGA_COLOR: // Super VGA
window_3 = slug_Open(win3_menu, SLUG_VERTICAL, bd_cua, GREEN_BLACK, WHITE_GREEN, GREEN_WHITE);
break;
default:
case CO_COLOR: // Graphics
window_3 = slug_Open(win3_menu, SLUG_VERTICAL, bd_cua, GREEN_BLACK, GRAY_GREEN, GREEN_GRAY);
break;
}
break;
case B380IF: // SK, 5/15/96; to remove Test Print option
switch(colors)
{
case BW_COLOR: // Monochrome
window_3 = slug_Open(win3_menu_B380IF, SLUG_VERTICAL, bd_cua, WHITE_BLACK, BLACK_LCYAN, BLACK_WHITE);
break;
case SVGA_COLOR: // Super VGA
window_3 = slug_Open(win3_menu_B380IF, SLUG_VERTICAL, bd_cua, GREEN_BLACK, WHITE_GREEN, GREEN_WHITE);
break;
default:
case CO_COLOR: // Graphics
window_3 = slug_Open(win3_menu_B380IF, SLUG_VERTICAL, bd_cua, GREEN_BLACK, GRAY_GREEN, GREEN_GRAY);
break;
}
break;
case BJC4200:
case BJC4550:
height++;
switch(colors)
{
case BW_COLOR: // Monochrome
window_3 = slug_Open(win3_menu_4200, SLUG_VERTICAL, bd_cua, WHITE_BLACK, BLACK_LCYAN, BLACK_WHITE);
break;
case SVGA_COLOR: // Super VGA
window_3 = slug_Open(win3_menu_4200, SLUG_VERTICAL, bd_cua, GREEN_BLACK, WHITE_GREEN, GREEN_WHITE);
break;
default:
case CO_COLOR: // Graphics
window_3 = slug_Open(win3_menu_4200, SLUG_VERTICAL, bd_cua, GREEN_BLACK, GRAY_GREEN, GREEN_GRAY);
break;
}
break;
case BJC210:
switch(colors)
{
case BW_COLOR: // Monochrome
window_3 = slug_Open(win3_menu_210, SLUG_VERTICAL, bd_cua, WHITE_BLACK, BLACK_LCYAN, BLACK_WHITE);
break;
case SVGA_COLOR: // Super VGA
window_3 = slug_Open(win3_menu_210, SLUG_VERTICAL, bd_cua, GREEN_BLACK, WHITE_GREEN, GREEN_WHITE);
break;
default:
case CO_COLOR: // Graphics
window_3 = slug_Open(win3_menu_210, SLUG_VERTICAL, bd_cua, GREEN_BLACK, GRAY_GREEN, GREEN_GRAY);
break;
}
break;
case BJC240:
height++;
switch(colors)
{
case BW_COLOR: // Monochrome
window_3 = slug_Open(win3_menu_240, SLUG_VERTICAL, bd_cua, WHITE_BLACK, BLACK_LCYAN, BLACK_WHITE);
break;
case SVGA_COLOR: // Super VGA
window_3 = slug_Open(win3_menu_240, SLUG_VERTICAL, bd_cua, GREEN_BLACK, WHITE_GREEN, GREEN_WHITE);
break;
default:
case CO_COLOR: // Graphics
window_3 = slug_Open(win3_menu_240, SLUG_VERTICAL, bd_cua, GREEN_BLACK, GRAY_GREEN, GREEN_GRAY);
break;
}
break;
case BJC80:
switch(colors)
{
case BW_COLOR: // Monochrome
window_3 = slug_Open(win3_menu_80, SLUG_VERTICAL, bd_cua, WHITE_BLACK, BLACK_LCYAN, BLACK_WHITE);
break;
case SVGA_COLOR: // Super VGA
window_3 = slug_Open(win3_menu_80, SLUG_VERTICAL, bd_cua, GREEN_BLACK, WHITE_GREEN, GREEN_WHITE);
break;
default:
case CO_COLOR: // Graphics
window_3 = slug_Open(win3_menu_80, SLUG_VERTICAL, bd_cua, GREEN_BLACK, GRAY_GREEN, GREEN_GRAY);
break;
}
break;
}
Win3_PopUp(window_3);
sed_SetBorder(window_3, bd_cua);
sed_SetBorderFeature(window_3, BD_TOP | BD_OUTLINE | BD_TITLE | BD_PROMPT);
sed_SetBorderTitle(window_3, WINDOW_3_TITLE);
sed_SetPosition(window_3, 13, 1);
sed_SetHeight(window_3, height);
sed_SetWidth(window_3, 25);
sed_SetShadow(window_3, 1);
sed_SetShadowAttr(window_3, BK_COLOR3);
sed_SetLabel(window_3, 3);
// Attach a mouse handler to the sed
win_SetMouse(window_3, winmou_All);
win_SetMouseFeature(window_3, MOUF_TRACK);
sed_Repaint(window_3);
sedlist[1] = window_3;
sed_SetSpecial(window_3, spc_Jump);
sed_SetAux(window_3, aux_Top);
return(TRUE);
}
// create the windows sub menu 2 ---------------------------------------------------
// *********************************************************************************
// function name : void Win2_Menu_Sub(void)
// function : window 2 sub pop up menu
// input : void
// output : void
// *********************************************************************************
void Win2_Menu_Sub()
{
int fh, i, j;
unsigned k;
char filespec[OFILE_MAXSPEC + 1];
char buf[1024];
filespec[0] = (byte)NULL;
i = j = k = mode = 0;
// Window 2 Start
switch(sed_Go(window_2))
{
case PRINTER:
sed_Close(window_2);////
switch(colors)
{
case BW_COLOR: // Monochrome
win_21 = slug_Open(win2_menu_printer, SLUG_VERTICAL, bd_cua, WHITE_BLACK, BLACK_LCYAN, BLACK_WHITE);
break;
case SVGA_COLOR: // Super VGA
win_21 = slug_Open(win2_menu_printer, SLUG_VERTICAL, bd_cua, CYAN_BLACK, BLACK_CYAN, BLACK_BLUE);
break;
default:
case CO_COLOR: // Graphics
win_21 = slug_Open(win2_menu_printer, SLUG_VERTICAL, bd_cua, CYAN_BLACK, BLACK_CYAN, GRAY_CYAN);
break;
}
Win2_PopUp_Printer(win_21);
sed_Repaint(win_21);
sed_Go(win_21);
sed_Close(win_21);
EndHelpFile();
PrinterIDNumber();
break;
//
case MODE:
sed_Close(window_2);////
mode = 1;
switch(colors)
{
case BW_COLOR: // Monochrome
win_20 = slug_Open(win2_menu, SLUG_VERTICAL, bd_cua, WHITE_BLACK, BLACK_LCYAN, BLACK_WHITE);
break;
case SVGA_COLOR: // Super VGA
win_20 = slug_Open(win2_menu, SLUG_VERTICAL, bd_cua, CYAN_BLACK, BLACK_CYAN, BLACK_BLUE);
break;
default:
case CO_COLOR: // Graphics
win_20 = slug_Open(win2_menu, SLUG_VERTICAL, bd_cua, CYAN_BLACK, BLACK_CYAN, GRAY_CYAN);
break;
}
Win2_PopUp(win_20);
sed_Repaint(win_20);
sed_Go(win_20);
sed_Close(win_20);
break;
//
case OPEN:
//// sed_Close(window_2);////
mode = 2;
while(TRUE)
{
if(_getcwd(filespec, OFILE_MAXSPEC))
{
for(i=0;filespec[i] != (byte)NULL;i++);
if(filespec[i-1] != '\\')
{
filespec[i] = '\\';
filespec[i+1] = (byte)NULL;
}
}
else
break;
if(!(opc_FileBox(NULL, WINDOW_2_1_O, 0, filespec, OFILE_MAXSPEC, "*.ini")))
break;
else
{
if((fh = _open(filespec, _O_RDONLY)) != FILE_ERROR)
{
i=j=0;
_read(fh, buf, WIN4_BUFF);
if((!(memcmp(buf,WINDOW_4_0_S0,WINDOW_4_0_S0_N)))|(!(memcmp(buf,WINDOW_4_0_S1,WINDOW_4_0_S1_N))))
{
for(k=0;i<WIN4_MENU;k++)
{
if(buf[k] >= ' ')
{
choice[i][j] = buf[k];
j++;
}
else
{
choice[i][j] = (byte)NULL;
j=0;
i++;
}
}
_close(fh);
EndHelpFile();
PrinterIDNumber();
break;
}
else
{
_close(fh);
opc_Prompt(NULL, ERROR, 0, ERROR_FILE2);
}
}
else
{
switch(errno)
{
case EACCES:
opc_Prompt(NULL, ERROR, 0, ERROR_FILE4);
break;
case EINVAL:
opc_Prompt(NULL, ERROR, 0, ERROR_FILE5);
break;
case EMFILE:
opc_Prompt(NULL, ERROR, 0, ERROR_FILE6);
break;
case ENOENT:
default:
opc_Prompt(NULL, ERROR, 0, ERROR_FILE3);
break;
}
}
}
}
sed_Close(window_2);////
break;
//
case SAVE:
//// sed_Close(window_2);////
mode = 3;
while(TRUE)
{
if(_getcwd(filespec, OFILE_MAXSPEC))
{
for(i=0;filespec[i] != (byte)NULL;i++)
;
if(filespec[i-1] != '\\')
{
filespec[i] = '\\';
filespec[i+1] = (byte)NULL;
}
}
else
break;
if(!(opc_FileBox(NULL, WINDOW_2_2_S, 0, filespec, OFILE_MAXSPEC, "*.ini")))
break;
else
{
if((fh = _open(filespec, _O_WRONLY | _O_CREAT, _S_IREAD | _S_IWRITE)) != FILE_ERROR)
{
i=j=0;
for(k=0;i<WIN4_MENU;i++,j=0,k++)
{
for(;choice[i][j] != (byte)NULL;j++,k++)
buf[k] = choice[i][j];
buf[k] = '\n';
}
if(_write(fh, buf, k) == FILE_ERROR)
{
_close(fh);
opc_Prompt(NULL, ERROR, 0, ERROR_FILE);
}
else
{
_close(fh);
break;
}
}
else
opc_Prompt(NULL, ERROR, 0, ERROR_FILE);
}
}
sed_Close(window_2);////
break;
//
case DELETE:
//// sed_Close(window_2);////
mode = 4;
while(TRUE)
{
if(_getcwd(filespec, OFILE_MAXSPEC))
{
for(i=0;filespec[i] != (byte)NULL;i++)
;
if(filespec[i-1] != '\\')
{
filespec[i] = '\\';
filespec[i+1] = (byte)NULL;
}
}
else
break;
if(!(opc_FileBox(NULL, WINDOW_2_3_D, 0, filespec, OFILE_MAXSPEC, "*.ini")))
break;
else
{
if(ConfirmDelete(filespec))
{
if(!remove(filespec))
break;
else
{
switch(errno)
{
case EACCES:
opc_Prompt(NULL, ERROR, 0, ERROR_FILE4);
break;
case EINVAL:
opc_Prompt(NULL, ERROR, 0, ERROR_FILE5);
break;
case EMFILE:
opc_Prompt(NULL, ERROR, 0, ERROR_FILE6);
break;
case ENOENT:
default:
opc_Prompt(NULL, ERROR, 0, ERROR_FILE3);
break;
}
}
}
else
break;
}
}
sed_Close(window_2);////
break;
//
default:
sed_Close(window_2);////
break;
}
}
// create the windows 2 ------------------------------------------------------------------------
// *********************************************************************************
// function name : void Win2_Menu_Main(void)
// function : window 2 pop up menu
// input : void
// output : void
// *********************************************************************************
void Win2_Menu_Main(void)
{
menu_type menu_2;
// Window 2 Start
menu_2 = menu_Open();
if(printerID == MPC2500)
menu_Printf(menu_2, WINDOW_2_5_MP, &choice[PRINTER_NAME][0]);
else if(printerID == MPC30)
menu_Printf(menu_2, WINDOW_2_5_C30, &choice[PRINTER_NAME][0]);
else
menu_Printf(menu_2, WINDOW_2_5, &choice[PRINTER_NAME][0]);
menu_Printf(menu_2, WINDOW_2_4, NULL, &gmenu_funcs, WINDOW_2_4_H, PRINTER_STR);
menu_Printf(menu_2, WINDOW_2_0, NULL, &gmenu_funcs, WINDOW_2_0_H, MODE_STR);
menu_Printf(menu_2, WINDOW_2_1, NULL, &gmenu_funcs, WINDOW_2_1_H, OPEN_STR);
menu_Printf(menu_2, WINDOW_2_2, NULL, &gmenu_funcs, WINDOW_2_2_H, SAVE_STR);
menu_Printf(menu_2, WINDOW_2_3, NULL, &gmenu_funcs, WINDOW_2_3_H, DELETE_STR);
window_2 = sed_Open(menu_2);
switch(colors)
{
case BW_COLOR: // Monochrome
sed_SetColors(window_2, WHITE_BLACK, BLACK_WHITE, BLACK_LCYAN);
break;
case SVGA_COLOR: // Super VGA
sed_SetColors(window_2, CYAN_BLACK, CYAN_WHITE, BLACK_CYAN);
break;
default:
case CO_COLOR: // Graphics
sed_SetColors(window_2, CYAN_BLACK, CYAN_GRAY, BLACK_CYAN);
break;
}
sed_SetBorder(window_2, bd_cua);
sed_SetBorderFeature(window_2, BD_TITLE | BD_OUTLINE | BD_TOP | BD_PROMPT);
sed_SetBorderTitle(window_2, WINDOW_2_TITLE);
sed_SetPosition(window_2, 2, 1);
sed_SetHeight(window_2, 6);
sed_SetWidth(window_2, 25);
sed_SetShadow(window_2, 1);
sed_SetShadowAttr(window_2, BK_COLOR3);
sed_SetLabel(window_2, 2);
// Attach a mouse handler to the sed
win_SetMouse(window_2, winmou_All);
win_SetMouseFeature(window_2, MOUF_TRACK);
// Attach a mouse handler to the sed
win_SetMouse(window_2, winmou_All);
win_SetMouseFeature(window_2, MOUF_TRACK);
sed_Repaint(window_2);
sedlist[0] = window_2;
sed_SetSpecial(window_2, spc_Jump);
sed_SetAux(window_2, aux_Top);
switch(mode)
{
case 1:
kb_Stuff(CTRL_M);
break;
case 2:
kb_Stuff(CTRL_O);
break;
case 3:
kb_Stuff(CTRL_S);
break;
case 4:
kb_Stuff(CTRL_D);
break;
default:
break;
}
}
// *********************************************************************************
// function name : void StartCheck(void)
// function : check to start program
// input : void
// output : void
// *********************************************************************************
void StartCheck()
{
char buf_1[OFILE_MAXSPEC + 9], dir_tmp[OFILE_MAXSPEC + 10];
int fh, i, j;
//
_searchenv(INI_FILE, ".", dir_tmp);
if(*dir_tmp == (byte)NULL)
{
_searchenv(INI_FILE, "PATH", dir_tmp);
if(*dir_tmp == (byte)NULL)
InitError();
if(_chdrive(toupper(dir_tmp[0])-0x40) == FILE_ERROR)
InitError();
for(i=0;i<(OFILE_MAXSPEC + 10);i++)
{
if(dir_tmp[i] == '\\')
{
if(!(memcmp(&dir_tmp[i+1], INI_FILE, 7)))
{
dir_tmp[i] = (byte)NULL;
break;
}
}
}
if(_chdir(dir_tmp) == FILE_ERROR)
InitError();
}
if((fh = _open(INI_FILE, _O_RDONLY)) != FILE_ERROR)
{
i = _read(fh, buf_1, (OFILE_MAXSPEC + 8));
if(!(memcmp(buf_1, "monitor", 7)))
{
colors = SVGA_COLOR;
for(j=0;buf_1[j] != '\n';j++);
for(;buf_1[j] <= ' ';j++);
memcpy(buf_1, (buf_1+j), (i-j));
buf_1[i-j] = (byte)NULL;
}
else
{
colors = CO_COLOR;
buf_1[i] = (byte)NULL;
}
_close(fh);
if(_chdrive(toupper(buf_1[0])-0x40) == FILE_ERROR)
InitError();
if(_chdir(buf_1) == FILE_ERROR)
InitError();
}
else
InitError();
}
// *********************************************************************************
// function name : int ChoiceDataInitial(void)
// function : check to start program
// input : void
// output : FALSE // failure
// : TRUE // success
// *********************************************************************************
int ChoiceDataInitial()
{
int fh, i, j;
unsigned k;
char buf[1024];
//
i = j = 0;
if((fh = _open("bjsetup.ini", _O_RDONLY)) != FILE_ERROR)
{
_read(fh, buf, WIN4_BUFF);
_close(fh);
if((!(memcmp(buf, WINDOW_4_0_S0, WINDOW_4_0_S0_N)))|(!(memcmp(buf, WINDOW_4_0_S1, WINDOW_4_0_S1_N))))
{
for(k=0;i<WIN4_MENU;k++)
{
if(buf[k] >= ' ')
{
choice[i][j] = buf[k];
j++;
}
else
{
choice[i][j] = (byte)NULL;
j=0;
i++;
}
}
}
else
{
memcpy(choice, choice_default, WIN4_BUFF);
if(!iniFileWrite())
return(FALSE);
}
}
else
{
memcpy(choice, choice_default, WIN4_BUFF);
if(!iniFileWrite())
return(FALSE);
}
return(TRUE);
}
// ***********************************************************************
// function name : int iniFileWrite(void)
// function : write "bjsetup.ini"
// input : void
// output : FALSE // failure
// : TRUE // success
// ***********************************************************************
int iniFileWrite()
{
int fh, i, j;
unsigned k;
//// char buf[WIN4_BUFF+WIN4_MENU*4];
char buf[1024];
if((fh = _open("bjsetup.ini", _O_WRONLY | _O_CREAT, _S_IREAD | _S_IWRITE)) == FILE_ERROR)
{
if(!opc_Verify(NULL, ERROR, 0, ERROR_FILE))
{
_close(fh);
return(FALSE);
}
}
for(i=j=k=0;i<WIN4_MENU;i++,j=0,k++)
{
for(;choice[i][j] != (byte)NULL;j++,k++)
buf[k] = choice[i][j];
buf[k] = '\n';
}
if(_write(fh, buf, k) == FILE_ERROR)
{
if(!opc_Verify(NULL, ERROR, 0, ERROR_FILE))
{
_close(fh);
return(FALSE);
}
}
_close(fh);
return(TRUE);
}
// ***********************************************************************
// function name : void EndHelpFile(void)
// function : Close help file
// input : void
// output : void
// ***********************************************************************
void EndHelpFile()
{
if(fp_help)
{
help_Close();
fclose(fp_help);
}
_fcloseall();
}
// ***********************************************************************
// function name : int EndDisplay(void)
// function : Exit this program
// input : void
// output : 0
// ***********************************************************************
int EndDisplay()
{
EndHelpFile();
sed_Close(window_0); // close the windows
sed_Close(window_1);
sed_Close(window_2);
sed_Close(window_3);
sed_Close(window_4);
sed_Close(window_5);
win_Close(disp_GetBackWin()); // Close the background window
disp_SetAttr(WHITE_BLACK);
disp_Repaint();
disp_Close(); // shut down the display
exit(0);
return(0);
}
// ***********************************************************************
// function name : int InitError(void)
// function : Initial error of no "BJL.ini" and exit this program
// input : void
// output : 1
// ***********************************************************************
int InitError()
{
printf(ERROR_INIT);
exit(1);
return(1);
}
// ***********************************************************************
// function name : void PrinterIDNumber(void)
// function : Set printer ID and select help file
// input : void
// output : void
// ***********************************************************************
void PrinterIDNumber()
{
if(!(memcmp(&choice[PRINTER_NAME][0], WINDOW_2_0_S0, 7)))
{
if(!(memcmp(&choice[PRINTER_NAME][0], WINDOW_2_0_S30, 13)))
{
printerID = MPC30; //// MultiPASS C30
a240 = 0;
fp_help = fopen("bjsetup6.hlp", "rb");
}
else
{
printerID = MPC2500; //// MultiPASS C2500
a240 = 0;
fp_help = fopen("bjsetup6.hlp", "rb");
}
}
else if(!(memcmp(&choice[PRINTER_NAME][0], WINDOW_2_0_SIF, 7)))
{
printerID = B380IF; //// CFX-B380IF
a240 = 0;
fp_help = fopen("bjsetup7.hlp", "rb"); // SK, 5/15/96 - changed to bjsetup7.hlp from bjsetup6.hlp
}
else if(!(memcmp(&choice[PRINTER_NAME][0], WINDOW_2_0_S1, 7)))
{
printerID = BJC4100; //// BJC-4100
a240 = 0;
fp_help = fopen("bjsetup1.hlp", "rb");
}
else if(!(memcmp(&choice[PRINTER_NAME][0], WINDOW_2_0_S2, 7)))
{
printerID = BJC210; //// BJC-210
a240 = 23;
fp_help = fopen("bjsetup2.hlp", "rb");
}
else if(!(memcmp(&choice[PRINTER_NAME][0], WINDOW_2_0_S3, 7)))
{
printerID = BJC80; //// BJC-80
a240 = 0;
fp_help = fopen("bjsetup3.hlp", "rb");
}
else if(!(memcmp(&choice[PRINTER_NAME][0], WINDOW_2_0_S4, 7)))
{
printerID = BJC240; //// BJC-240
a240 = 0;
fp_help = fopen("bjsetup4.hlp", "rb");
}
else if(!(memcmp(&choice[PRINTER_NAME][0], WINDOW_2_0_S5, 7)))
{
printerID = BJC4200; //// BJC-4200
a240 = 0;
fp_help = fopen("bjsetup5.hlp", "rb");
}
else if(!(memcmp(&choice[PRINTER_NAME][0], WINDOW_2_0_S6, 7)))
{
printerID = BJC4550; //// BJC-4550
a240 = 0;
fp_help = fopen("bjsetup5.hlp", "rb");
}
if(!fp_help)
opc_Prompt(NULL, ERROR, 0, ERROR_HELP);
else
{
if(help_Init(fp_help, help_View, 8800, (VOID *) &hvd) != HELP_OK)
opc_Prompt(NULL, ERROR, 0, ERROR_HELP);
}
}
// ***********************************************************************
// function name : void PrinterName(void)
// function : Set printer name
// input : void
// output : void
// ***********************************************************************
void PrinterName()
{
switch(printerID)
{
case MPC2500:
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S0);
break;
case MPC30:
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S30);
break;
case B380IF:
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_SIF);
break;
case BJC4100:
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S1);
break;
case BJC210:
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S2);
break;
case BJC80:
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S3);
break;
case BJC240:
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S4);
break;
case BJC4200:
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S5);
break;
case BJC4550:
strcpy(&choice[PRINTER_NAME][0], WINDOW_2_0_S6);
break;
}
}