TPV/TPV_CFG.CPP
2021-09-08 21:44:52 +02:00

958 lines
33 KiB
C++
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <dos.h>
#include <math.h>
#include <time.h>
#include <alloc.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#include <graphics.h>
#include "c:\program\src_dos\libs\make_bot\make_bot.h"
#include "c:\program\src_dos\libs\bdatos\bdatos.hh"
#include "tpv_def.h"
#include "tpv_num.h"
CONFIG Config = {
LTBKSLASH_FILL, EGA_BLUE, EGA_BLACK,
EGA_RED, EGA_BLACK, EGA_DARKGRAY,
EGA_LIGHTRED, EGA_DARKGRAY,
EGA_WHITE, EGA_RED, EGA_BLACK, EGA_WHITE,
{ 0, { "PrnFile.out" }, 66, "", "", { "\0", "\0", "\0", "\0" },
{ "\0", "\0", "\0", "\0" } },
// Horas inicio, y fin
{
{ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
{ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } },
5, // 5 de la ma¤ana ( cambio horario )
0,
0
},
// Impr. Ticket / Cobro Completo / InicioCaja
{ 0, 0, 6, 0 },
0,
// Tiempo para lanzar el protector de pantalla (en sg.)
120,
"fonts\\prot_ptl.fnt",
"fonts\\vent_msg.fnt",
{ 8, 12, 16, 20, 24, 4 },
1, 2
};
BDatos BConfig;
BDatos BThemes;
void PreviewEntorno( void );
void NoStandard( int BPush );
void MuestraCFG( int Campo, int Item, char como );
// ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
// Û Parte principal del m¢dulo Û
// ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
#define CFG_BASE 120
#define CFG_BASEd 10
#define FUENTES 0x00
#define COLOR 0x01
#define FONDO 0x02
#define TAMANO 0x04
#define FUENTE 0x08
typedef struct
{
char Elementos[40];
char Propiedades;
char Color, Fondo;
char Tamano, Fuente[40];
} ELEMENTOS;
typedef struct
{
char Tema[40];
ELEMENTOS Elementos[7];
} THEMES;
// Cada elemento tiene unas propiedades, de las cuales depende el poder usar
// los distintos pulsadores o no.
THEMES Tema = {
"Combinaci¢n standard",
{
{ "Fondo de pantalla", COLOR | FONDO | FUENTE },
{ "Texto normal", COLOR | FONDO },
{ "Texto se¤alado", COLOR | FONDO },
{ "Digitos (numeros grandes)", COLOR | FONDO },
{ "Digitos (borde del n£mero)",COLOR },
{ "Fuente del Protector", FUENTE },
{ "Letrero digital", COLOR | FONDO | FUENTE }
// A¥ADIR NUEVOS ELEMENTOS ( RESPETANDO NO SOLAPAR LAS Ä^
}
};
char Elementos[][40] = {
{ "Fondo de pantalla" },
{ "Texto normal" },
{ "Texto se¤alado" },
{ "Digitos (numeros grandes)" },
{ "Digitos (borde del n£mero)" },
{ "Fuente del Protector" },
{ "Letrero digital" }
// A¥ADIR NUEVOS ELEMENTOS ( RESPETANDO NO SOLAPAR LAS Ä^
};
int NumElementos = 7, NumFuentes, NumCombinaciones;
int ListaDesplegable( char Texto[][40], int NumEtos, int DesX, int DesY, char POS );
void CargaFuentesElemento( int NumElemento );
void MuestraElemento( int CurrElemento );
int ObtenTamano( int TOld );
int ObtenColor( void );
void EditCFG( int Campo, int Item, char como );
/**************************************************************************\
|* *|
|* ConfigurarEntorno *|
|* *|
|* Descripci¢n: *|
|* Permite cambiar las opciones de configuraci¢n... *|
|* *|
|* Entradas: (ninguna) *|
|* Salidas: (ninguna) *|
|* *|
\**************************************************************************/
char Combinaciones[50][40], Fuentes[50][40];
void ConfigurarEntorno( void )
{
int CurrCombinacion, CurrElemento, CurrFuente, i, BPush, ok, oldTmp;
int CurrRow, key;
char buffer[80];
char NumItems[] = { 7, 14 };
char ItemActual = 0;
CurrCombinacion = 0;
CurrElemento = 0;
CurrFuente = 0;
// Rellenamos la pantalla con un fondo atractivo...
setfillstyle( Config.FillBgS, Config.FillBgC );
bar( 0, 0, 640, 480 );
Imprime_Estaticos( CFG_BASE+0, "systm\\Tpv.img"); // Imprime botones estaticos 'Seccion 1'
// Flecha hacia abajo
ponicono( 184, 276, flecha, 2 );
ponicono( 184, 331, flecha, 2 );
ponicono( 184, 386, flecha, 2 );
if ( BThemes.AbrirReg( "datos\\themes.cfg", sizeof( THEMES ) ) == ERROR )
Error( 1, BThemes.cError);
// Inicializamos el tema por defecto
if ( BThemes.Registros() == 0 )
{
Tema.Elementos[0].Fondo = Config.FillBgF;
Tema.Elementos[0].Color = Config.FillBgC; Tema.Elementos[0].Tamano = Config.FillBgS;
Tema.Elementos[1].Color = Config.TxtFgN ; Tema.Elementos[1].Fondo = Config.TxtBgN ;
Tema.Elementos[2].Color = Config.TxtFgI ; Tema.Elementos[2].Fondo = Config.TxtBgI ;
Tema.Elementos[3].Color = Config.NumFg ; Tema.Elementos[3].Fondo = Config.NumBg ;
Tema.Elementos[4].Color = Config.NumLn ;
strcpy( Tema.Elementos[5].Fuente, Config.Prot_fnt );
Tema.Elementos[6].Color = Config.DigFg ; Tema.Elementos[6].Fondo = Config.DigBg ;
strcpy( Tema.Elementos[6].Fuente, Config.Vent_msg );
if ( BThemes.InsReg( (void *)&Tema, 0, ARRIBA ) == ERROR )
Error( 1, BThemes.cError);
} else
if ( BThemes.LeeReg( (void *)&Tema, CurrCombinacion ) == ERROR )
Error( 1, BThemes.cError);
CargaFuentesElemento( CurrElemento );
MuestraElemento( CurrElemento );
PreviewEntorno();
Imprime_Estaticos( ItemActual+125, "systm\\Tpv.img"); // Imprime botones estaticos 'Seccion 1'
for ( CurrRow = 0; CurrRow < NumItems[ ItemActual ]; CurrRow ++ )
MuestraCFG( CurrRow, ItemActual, NORMAL );
CurrRow = 0;
ok = 0;
do {
MuestraCFG( CurrRow, ItemActual, INTENSO );
BPush = Comprueba_Secuencia( CFG_BASEd, NULL );
MuestraCFG( CurrRow, ItemActual, NORMAL );
switch ( BPush )
{
case 0: // No se pulso ningun BOTON
while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER
break;
case -2: // Hay una tecla normal en BUFFER
if ( (key=getch()) != 27 && key != 13 )
ungetch( key );
EditCFG( CurrRow, ItemActual, NORMAL );
while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER
break;
case -1: // Hay una tecla especial en BUFFER
switch( getch() )
{
// Flecha Izquierda
case 75:
case 15:
// Flecha Arriba
case 72:
CurrRow--; if ( CurrRow < 0 ) CurrRow = NumItems[ItemActual] - 1;
break;
// Flecha Derecha
case 77:
case 9:
// Flecha Abajo
case 80:
CurrRow++; if ( CurrRow >= NumItems[ItemActual] ) CurrRow = 0;
break;
// Inicio
case 71:
CurrRow = 0;
break;
// Fin
case 79:
CurrRow = NumItems[ItemActual];
break;
}
break;
// Men£ Principal
case 1:
ok = 1;
break;
// Combinaciones
case 2:
break;
// Guardar combinaci¢n
case 3:
// GuardaCombinacion();
break;
// Eliminar combinaci¢n
case 4:
/*
if ( CurrCombinacion != 0 && Optar( 1, "Eliminar combinaci¢n", "Confirme la eliminaci¢n", "de la combinaci¢n actual.", NULL ) )
{
if ( BThemes.DelReg( CurrCombinacion ) == ERROR )
Error( 1, BThemes.cError);
CurrCombinacion --;
if ( BThemes.LeeReg( (void *)&Config, CurrCombinacion ) == ERROR )
Error( 1, BThemes.cError);
PreviewEntorno();
}
*/
break;
// Elementos
case 5:
oldTmp = CurrElemento;
CurrElemento = ListaDesplegable( Elementos, NumElementos, 5, 330, ARRIBA );
if ( oldTmp != CurrElemento )
{
CargaFuentesElemento( CurrElemento );
MuestraElemento( CurrElemento );
PreviewEntorno();
}
break;
// Fuentes
case 6:
if ( Tema.Elementos[CurrElemento].Propiedades & FUENTE )
{
oldTmp = CurrFuente;
CurrFuente = ListaDesplegable( Fuentes, NumFuentes, 5, 385, ARRIBA );
if ( oldTmp != CurrFuente )
{
if ( CurrElemento == 0 )
Tema.Elementos[CurrElemento].Tamano = CurrFuente;
strcpy( Tema.Elementos[CurrElemento].Fuente, Fuentes[CurrFuente] );
PreviewEntorno();
}
}
break;
// Color
case 7:
if ( Tema.Elementos[CurrElemento].Propiedades & COLOR )
{
Tema.Elementos[CurrElemento].Color = ObtenColor();
PreviewEntorno();
setfillstyle( SOLID_FILL, Tema.Elementos[CurrElemento].Color );
bar( 292, 332, 308, 348 );
}
break;
// Fondo
case 8:
if ( Tema.Elementos[CurrElemento].Propiedades & FONDO )
{
Tema.Elementos[CurrElemento].Fondo = ObtenColor();
PreviewEntorno();
setfillstyle( SOLID_FILL, Tema.Elementos[CurrElemento].Fondo );
bar( 292, 360, 308, 376 );
}
break;
// Tama¤o
case 9:
if ( Tema.Elementos[CurrElemento].Propiedades & TAMANO )
{
Tema.Elementos[CurrElemento].Tamano = ObtenTamano( Tema.Elementos[CurrElemento].Tamano );
PreviewEntorno();
setfillstyle( SOLID_FILL, EGA_LIGHTGRAY );
bar( 264, 387, 308, 403 );
sprintf( buffer, "%3d", Tema.Elementos[CurrElemento].Tamano );
outtextxy( 264, 387, buffer );
}
break;
// Impresora
// Ventas
// Varios...
case 10:
case 11:
case 12:
ItemActual = BPush - 10;
Imprime_Estaticos( ItemActual+125, "systm\\Tpv.img"); // Imprime botones estaticos 'Seccion 1'
for ( CurrRow = 0; CurrRow < NumItems[ ItemActual ]; CurrRow ++ )
MuestraCFG( CurrRow, ItemActual, NORMAL );
CurrRow = 0;
break;
default:
NoStandard( BPush );
break;
}
} while( !ok );
// Copiamos el Tema actual a las opciones de configuracion
Config.FillBgF= Tema.Elementos[0].Fondo;
Config.FillBgC= Tema.Elementos[0].Color; Config.FillBgS= Tema.Elementos[0].Tamano;
Config.TxtFgN = Tema.Elementos[1].Color; Config.TxtBgN = Tema.Elementos[1].Fondo;
Config.TxtFgI = Tema.Elementos[2].Color; Config.TxtBgI = Tema.Elementos[2].Fondo;
Config.NumFg = Tema.Elementos[3].Color; Config.NumBg = Tema.Elementos[3].Fondo;
Config.NumLn = Tema.Elementos[4].Color;
strcpy( Config.Prot_fnt, Tema.Elementos[5].Fuente );
Config.DigFg = Tema.Elementos[6].Color ; Config.DigBg = Tema.Elementos[6].Fondo ;
strcpy( Config.Vent_msg, Tema.Elementos[6].Fuente );
// Salvamos la configuraci¢n
if ( BConfig.EscribeReg( (void *)&Config, 0 ) == ERROR )
Error( 1, BConfig.cError);
// Salvamos la configuraci¢n
if ( BThemes.EscribeReg( (void *)&Tema, CurrCombinacion ) == ERROR )
Error( 1, BThemes.cError);
BThemes.CerrarReg();
}
/**************************************************************************\
|* *|
|* PreviewPantalla *|
|* *|
|* Descripci¢n: *|
|* Realiza el preview de la mini-pantalla *|
|* *|
|* Entradas: (ninguna) *|
|* Salidas: (ninguna) *|
|* *|
\**************************************************************************/
void PreviewEntorno( void )
{
// setbkcolor( Tema.Elementos[0].Fondo );
setfillstyle( Tema.Elementos[0].Tamano, Tema.Elementos[0].Color );
bar( 6, 36, 309, 239 );
Imprime_Estaticos( CFG_BASE+1, "systm\\Tpv.img" );
settextstyle( SMALL_FONT, HORIZ_DIR, 4 );
// Campos
setfillstyle( SOLID_FILL, Tema.Elementos[1].Fondo );
bar( 51, 55, 179, 63 );
bar( 41, 67, 84, 75 ); bar( 121, 67, 179, 75 );
bar( 51, 79, 99, 87 ); bar( 141, 79, 179, 87 );
// Visualizaci¢n R pida
bar( 12, 119, 68, 221 );
bar( 74, 119, 214, 221 );
bar( 220, 119, 243, 221 );
bar( 249, 119, 303, 221 );
// Texto Iluminado
setfillstyle( SOLID_FILL, Tema.Elementos[2].Fondo );
setcolor( Tema.Elementos[2].Color );
bar( 15, 122, 67, 129 );
outtextxy( 11, 120, " 000124 " );
setcolor( Tema.Elementos[1].Color );
outtextxy( 11, 120, " Albaranes de compra " );
outtextxy( 11, 130, " 000136 Aliados en el juego " );
outtextxy( 11, 140, " 000250 Baticoco de mono " );
outtextxy( 11, 150, " 000045 Garganta profunda " );
outtextxy( 8, 120, " 003 1.500 " );
outtextxy( 8, 130, " 045 9.999 " );
outtextxy( 8, 140, " 009 415 " );
outtextxy( 8, 150, " 010 2.250 " );
setcolor( EGA_WHITE );
outtextxy( 10, 224, " C¢digo de la descripci¢n." );
Imprime_Estaticos( CFG_BASE+2, "systm\\Tpv.img" );
}
void MuestraElemento( int CurrElemento )
{
char buffer[80];
settextstyle( SMALL_FONT, HORIZ_DIR, 5 );
setfillstyle( SOLID_FILL, Config.TxtBgN );
setcolor( Config.TxtFgN );
// Nombre del elemento
bar( 7, 332, 178, 348 );
outtextxy( 10, 332, Tema.Elementos[CurrElemento].Elementos );
// Fuente
bar( 7, 387, 178, 403 );
if ( Tema.Elementos[CurrElemento].Propiedades & FUENTE )
outtextxy( 10, 387, Tema.Elementos[CurrElemento].Fuente );
// Color
if ( Tema.Elementos[CurrElemento].Propiedades & COLOR )
setfillstyle( SOLID_FILL, Tema.Elementos[CurrElemento].Color );
else
setfillstyle( SOLID_FILL, EGA_LIGHTGRAY );
bar( 292, 332, 308, 348 );
// Fondo
if ( Tema.Elementos[CurrElemento].Propiedades & FONDO )
setfillstyle( SOLID_FILL, Tema.Elementos[CurrElemento].Fondo );
else
setfillstyle( SOLID_FILL, EGA_LIGHTGRAY );
bar( 292, 360, 308, 376 );
// Tamano
setfillstyle( SOLID_FILL, EGA_LIGHTGRAY );
bar( 264, 387, 308, 403 );
sprintf( buffer, "%3d", Tema.Elementos[CurrElemento].Tamano );
if ( Tema.Elementos[CurrElemento].Propiedades & TAMANO )
outtextxy( 264, 387, buffer );
}
int ObtenTamano( int TOld )
{
char buffer[80];
sprintf ( buffer, "%d", TOld );
if ( ( InputCadenaG( buffer, 1, 4, Config.TxtBgN, Config.TxtFgN, 264, 387, 308, 403 ) >> 8 ) )
itoa( TOld, buffer, 10 );
return atoi(buffer);
}
void CargaFuentesElemento( int NumElemento )
{
// Cargamos el tipo de fuente necesario
switch( NumElemento )
{
// Fondo de pantalla
case 0:
strcpy( Fuentes[ 0], "Sin Fondo" );
strcpy( Fuentes[ 1], "Fondo Solido" );
strcpy( Fuentes[ 2], "Lineas Horizontales" );
strcpy( Fuentes[ 3], "Lineas Inclinadas ////" );
strcpy( Fuentes[ 4], "Lineas Inclinadas2 ////" );
strcpy( Fuentes[ 5], "Lineas Inclinadas3 \\\\\\\\" );
strcpy( Fuentes[ 6], "Lineas Inclinadas4 \\\\\\\\" );
strcpy( Fuentes[ 7], "Crusado suave" );
strcpy( Fuentes[ 8], "Crusado Grueso" );
strcpy( Fuentes[ 9], "Lineas intercaladas" );
strcpy( Fuentes[10], "Punteado" );
strcpy( Fuentes[11], "Lineas semi-juntas" );
NumFuentes = 12;
break;
// Fuente del Protector
// Letrero digital
case 5:
case 6:
// Realizamos una recopilaci¢n de fuentes .FNT
// NumFuentes = AdquirirArchivos( Fuentes, "FONTS\*.FNT" );
NumFuentes = 0;
break;
default:
NumFuentes = 0;
}
}
////////////////////////////////////////////////////////////////////////
//////////////////////C O N F I G U R A C I O N/////////////////////////
////////////////////////////////////////////////////////////////////////
char ColorR[18*18+10], ColorG[18*18+10], ColorB[18*18+10];
void RecuadraRGB( int Color );
int ObtenColor( void )
{
char BPush, ok, Reg;
int CurrCol, R, G, B;
Optar( ENCUADRE, "Elija Color, o definal¢:", NULL );
Imprime_Estaticos( CFG_BASE+3, "systm\\Tpv.img" );
CurrCol = 1;
RecuadraRGB( CurrCol );
ok = 0;
do {
Imprime_Bordes( CFG_BASEd + 1, ( CurrCol + 2 ), 11 );
BPush = Comprueba_Secuencia( CFG_BASEd + 1, /*RatonParaColor*/NULL );
Imprime_Bordes( CFG_BASEd + 1, ( CurrCol + 2 ), -1 );
switch ( BPush )
{
case 0: // No se pulso ningun BOTON
while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER
break;
case -2: // Hay una tecla normal en BUFFER
while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER
break;
case -1: // Hay una tecla especial en BUFFER
while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER
break;
// Aceptar
case 1:
Reg = 0;
ok = 1;
break;
// Cancelar
case 2:
Reg = 1;
ok = 1;
break;
default:
if ( BPush >=2 && BPush <= 18 )
{
CurrCol = BPush - 2;
putimage( 413, 295 - R - 18, ColorR, COPY_PUT );
putimage( 428, 295 - G - 18, ColorG, COPY_PUT );
putimage( 443, 295 - B - 18, ColorB, COPY_PUT );
RecuadraRGB( CurrCol );
}
}
} while( !ok );
if ( Reg == 1 )
{
// Restauro los registros anteriores
}
Optar( ENCUADRE, "Elija Color, o definal¢:", NULL );
return (CurrCol - 1);
}
void RecuadraRGB( int Color )
{
char R, G, B;
R = G = B = 0;
getimage( 413, 295 - R - 18, 413 + 18, 295 - R, ColorR );
getimage( 428, 295 - G - 18, 428 + 18, 295 - G, ColorG );
getimage( 443, 295 - B - 18, 443 + 18, 295 - B, ColorB );
ponicono( 413, 295 - R - 18, led_off, 1);
ponicono( 428, 295 - G - 18, led_off, 1);
ponicono( 443, 295 - B - 18, led_off, 1);
}
int ListaDesplegable( char Texto[][40], int NumEtos, int DesX, int DesY, char POS )
{
static int PorDonde, NumEl = -1;
if ( NumEl != NumEtos )
{
NumEl = NumEtos; PorDonde = 0;
}
PorDonde ++; if ( PorDonde >= NumEtos ) PorDonde = 0;
// Fuente
setfillstyle( SOLID_FILL, Config.TxtBgN );
setcolor( Config.TxtFgN );
bar( DesX+2, DesY+2, DesX + 175, DesY + 18 );
outtextxy( DesX + 5, DesY + 2, Texto[PorDonde] );
return PorDonde;
}
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛA partir de aqui, ya no es standard...ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
void MuestraCFG( int Campo, int Item, char como )
{
int X0, Y0, X1, Y1;
char buffer[80], draw;
int i;
draw = 1;
switch( Item )
{
case 0:
switch ( Campo )
{
// Imprimir en un archivo ( SI/NO )
case 0:
draw = 0;
X0 = 350; Y0 = 95; X1 = 370; Y1 = 115;
setfillstyle( SOLID_FILL, ( como == NORMAL ) ? EGA_LIGHTGRAY : EGA_RED );
bar( X0, Y0, X1, Y1 );
if ( !Config.Impresora.Printer )
ponicono( X0+5, Y0+5, led_on, 1 );
else
ponicono( X0+5, Y0+5, led_off, 1 );
break;
// Archivo donde imprimir
case 1:
X0 = 541; Y0 = 99; X1 = 629; Y1 = 116;
sprintf( buffer, "%s", Config.Impresora.PrintTo );
break;
// Numero de lineas
case 2:
X0 = 541; Y0 = 124; X1 = 629; Y1 = 141;
sprintf( buffer, "%d", Config.Impresora.Lineas );
break;
// Imprimir normal
case 3:
X0 = 466; Y0 = 176; X1 = 629; Y1 = 193;
sprintf( buffer, "%s", Config.Impresora.Normal );
break;
// Imprimir Condensado
case 4:
X0 = 466; Y0 = 201; X1 = 631; Y1 = 218;
sprintf( buffer, "%s", Config.Impresora.Condensado );
break;
// Comentario inicial ( Tickets ventas )
case 5:
draw = 0;
X0 = 421; Y0 = 250; X1 = 629; Y1 = 310;
setfillstyle( SOLID_FILL, ( como == NORMAL ) ? Config.TxtBgN : Config.TxtBgI );
bar( X0, Y0, X1, Y1 );
setcolor ( ( como == NORMAL ) ? Config.TxtFgN : Config.TxtFgI );
for ( i=0; i<4; i++)
outtextxy( X0+3, Y0 + i*15, &Config.Impresora.PrincipioTickets[i][0] );
break;
// Comentario inicial ( Tickets ventas )
case 6:
draw = 0;
X0 = 421; Y0 = 321; X1 = 629; Y1 = 381;
setfillstyle( SOLID_FILL, ( como == NORMAL ) ? Config.TxtBgN : Config.TxtBgI );
bar( X0, Y0, X1, Y1 );
setcolor ( ( como == NORMAL ) ? Config.TxtFgN : Config.TxtFgI );
for ( i=0; i<4; i++)
outtextxy( X0+3, Y0 + i*15, &Config.Impresora.FinTickets[i][0] );
break;
}
break;
case 1:
switch( Campo )
{
case 0:
X0 = 541; Y0 = 39; X1 = 629; Y1 = 56;
{
auto char TipoProtector[3][10] = { "Scroll V.", "Externo", "Ninguno" };
sprintf( buffer, "%s", TipoProtector[Config.TProtector] );
}
break;
case 1:
X0 = 541; Y0 = 64; X1 = 629; Y1 = 81;
sprintf( buffer, " %03d", (int)Config.Protector );
break;
case 2:
X0 = 541; Y0 = 120; X1 = 629; Y1 = 134;
sprintf( buffer, " %02d", (int)Config.VProductos.CambioHorario );
break;
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
X0 = 352; Y0 = 181 + 20*(Campo-3); X1 = 379; Y1 = Y0 + 16;
setfillstyle( SOLID_FILL, EGA_LIGHTGRAY );
bar( /*X0+*/381, Y0, /*X1+*/500, Y1 );
sprintf( buffer, " :00 >-> %02d:00", (int)Config.HorasMedicion[ ( Campo - 3 + 1 ) % 6 ] );
TextoDoble( X0, Y0, buffer );
sprintf( buffer, " %02d", (int)Config.HorasMedicion[Campo-3] );
break;
case 9:
case 10:
case 11:
case 12:
X0 = 352; Y0 = 331 + 20*(Campo-9); X1 = 379; Y1 = Y0 + 16;
setfillstyle( SOLID_FILL, EGA_LIGHTGRAY );
bar( /*X0+*/381, Y0, /*X1+*/500, Y1 );
sprintf( buffer, " :00 >-> %02d:00", (int)Config.VProductos.HoraIni[ ( Campo - 9 + 1 ) % 4 ].hora );
TextoDoble( X0, Y0, buffer );
sprintf( buffer, " %02d", (int)Config.VProductos.HoraIni[ ( Campo - 9 ) % 4 ].hora );
break;
// Permitir modificar P.C en compras ?
case 13:
X0 = 581; Y0 = 424; X1 = 629; Y1 = 441;
sprintf( buffer, "%s", Config.VProductos.CambioPC == 1 ? "SI" : "NO" );
break;
// Reloj
case 14:
break;
}
break;
}
if ( draw )
{
setfillstyle( SOLID_FILL, ( como == NORMAL ) ? Config.TxtBgN : Config.TxtBgI );
bar( X0, Y0, X1, Y1 );
setcolor ( ( como == NORMAL ) ? Config.TxtFgN : Config.TxtFgI );
outtextxy( X0+2, Y0, buffer );
}
}
void EditCFG( int Campo, int Item, char como )
{
int X0, Y0, X1, Y1;
char buffer[80], draw;
draw = 1;
switch( Item )
{
case 0:
switch ( Campo )
{
// Imprimir en un archivo ( SI/NO )
case 0:
draw = 0;
X0 = 350; Y0 = 95; X1 = 370; Y1 = 115;
Config.Impresora.Printer = !Config.Impresora.Printer;
while( kbhit() ) getch();
break;
// Archivo donde imprimir
case 1:
X0 = 541; Y0 = 99; X1 = 629; Y1 = 116;
strcpy( buffer, Config.Impresora.PrintTo );
if ( !( InputCadenaG( buffer, 0, 20, Config.TxtBgN, Config.TxtFgN, X0, Y0, X1, Y1) >> 8 ) )
strcpy( Config.Impresora.PrintTo, buffer );
break;
// Numero de lineas
case 2:
X0 = 541; Y0 = 124; X1 = 629; Y1 = 141;
sprintf( buffer, "%d", Config.Impresora.Lineas );
if ( !( InputCadenaG( buffer, 1, 3, Config.TxtBgN, Config.TxtFgN, X0, Y0, X1, Y1) >> 8 ) )
Config.Impresora.Lineas = atoi( buffer );
Config.Impresora.Lineas = Config.Impresora.Lineas < 30 ? 30 : Config.Impresora.Lineas;
break;
// Imprimir normal
case 3:
X0 = 466; Y0 = 176; X1 = 629; Y1 = 193;
strcpy( buffer, Config.Impresora.Normal );
if ( !( InputCadenaG( buffer, 0, 20, Config.TxtBgN, Config.TxtFgN, X0, Y0, X1, Y1) >> 8 ) )
strcpy( Config.Impresora.Normal, buffer );
break;
// Imprimir Condensado
case 4:
X0 = 466; Y0 = 201; X1 = 631; Y1 = 218;
strcpy( buffer, Config.Impresora.Condensado );
if ( !( InputCadenaG( buffer, 0, 20, Config.TxtBgN, Config.TxtFgN, X0, Y0, X1, Y1) >> 8 ) )
strcpy( Config.Impresora.Condensado, buffer );
break;
// Comentario inicial ( Tickets ventas )
case 5:
X0 = 424; Y0 = 250; X1 = 629; Y1 = 310;
EditComentario( (char *)(&Config.Impresora.PrincipioTickets[0][0]), 3, 25, Config.TxtBgN, Config.TxtFgN, X0, Y0, X1, Y1, 15 );
break;
// Comentario inicial ( Tickets ventas )
case 6:
X0 = 424; Y0 = 321; X1 = 629; Y1 = 381;
EditComentario( (char *)(&Config.Impresora.FinTickets[0][0]), 3, 25, Config.TxtBgN, Config.TxtFgN, X0, Y0, X1, Y1, 15 );
break;
}
break;
case 1:
switch( Campo )
{
case 0:
Config.TProtector = (++Config.TProtector)%3;
break;
case 1:
X0 = 541; Y0 = 64; X1 = 629; Y1 = 81;
sprintf( buffer, "%d", (int)Config.Protector );
if ( !( InputCadenaG( buffer, 1, 3, Config.TxtBgN, Config.TxtFgN, X0, Y0, X1, Y1) >> 8 ) )
Config.Protector = atof( buffer );
break;
case 2:
X0 = 541; Y0 = 120; X1 = 629; Y1 = 134;
sprintf( buffer, "%d", (int)Config.VProductos.CambioHorario );
if ( !( InputCadenaG( buffer, 1, 2, Config.TxtBgN, Config.TxtFgN, X0, Y0, X1, Y1) >> 8 ) )
Config.VProductos.CambioHorario = atoi( buffer ) % 25;
break;
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
X0 = 352; Y0 = 181 + 20*(Campo-3); X1 = 379; Y1 = Y0 + 16;
sprintf( buffer, "%d", (int)Config.HorasMedicion[Campo-3] );
if ( !( InputCadenaG( buffer, 1, 2, Config.TxtBgN, Config.TxtFgN, X0, Y0, X1, Y1) >> 8 ) )
{
Config.HorasMedicion[Campo-3] = atoi( buffer ) % 25;
MuestraCFG( ( ( Campo - 1) < 3 ) ? 8 : ( Campo - 1), Item, NORMAL );
}
break;
case 9:
case 10:
case 11:
case 12:
X0 = 352; Y0 = 331 + 20*(Campo-9); X1 = 379; Y1 = Y0 + 16;
sprintf( buffer, "%d", (int)Config.VProductos.HoraIni[Campo-9].hora );
if ( !( InputCadenaG( buffer, 1, 2, Config.TxtBgN, Config.TxtFgN, X0, Y0, X1, Y1) >> 8 ) )
{
Config.VProductos.HoraIni[Campo-9].hora = atoi( buffer ) % 25;
MuestraCFG( ( (Campo - 1) < 0 ) ? 12 : ( Campo - 1), Item, NORMAL );
}
break;
// Permitir modificar P.C en compras ?
case 13:
X0 = 581; Y0 = 424; X1 = 629; Y1 = 441;
Config.VProductos.CambioPC = !Config.VProductos.CambioPC;
break;
}
break;
}
while( kbhit() ) getch();
}
/*
void MuestraCFG( int Campo, int Item, char como )
{
int X0, Y0, X1, Y1;
char buffer[80], draw;
draw = 1;
switch( Item )
{
case 0:
switch ( Campo )
{
// Imprimir en un archivo ( SI/NO )
case 0:
draw = 0;
X0 = 350; Y0 = 95; X1 = 370; Y1 = 115;
setfillstyle( SOLID_FILL, ( como == NORMAL ) ? EGA_LIGHTGRAY : EGA_RED );
bar( X0, Y0, X1, Y1 );
if ( !Config.Impresora.Printer )
ponicono( X0+5, Y0+5, led_on, 1 );
else
ponicono( X0+5, Y0+5, led_off, 1 );
break;
// Archivo donde imprimir
case 1:
X0 = 541; Y0 = 99; X1 = 629; Y1 = 116;
sprintf( buffer, "%s", Config.Impresora.PrintTo );
break;
// Numero de lineas
case 2:
X0 = 541; Y0 = 124; X1 = 629; Y1 = 141;
sprintf( buffer, "%d", Config.Impresora.Lineas );
break;
// Imprimir normal
case 3:
X0 = 466; Y0 = 324; X1 = 629; Y1 = 341;
sprintf( buffer, "%s", Config.Impresora.Normal );
break;
// Imprimir Condensado
case 4:
X0 = 466; Y0 = 349; X1 = 631; Y1 = 366;
sprintf( buffer, "%s", Config.Impresora.Condensado );
break;
}
break;
}
if ( draw )
{
setfillstyle( SOLID_FILL, ( como == NORMAL ) ? Config.TxtBgN : Config.TxtBgI );
bar( X0, Y0, X1, Y1 );
setcolor ( ( como == NORMAL ) ? Config.TxtFgN : Config.TxtFgI );
outtextxy( X0+2, Y0, buffer );
}
}
*/
/**************************************************************************\
|* *|
|* NoStandard *|
|* *|
|* Descripci¢n: *|
|* Opciones no standard de esta configuraci¢n... *|
|* *|
|* Entradas: N§ de opci¢n seleccionada *|
|* Salidas: (ninguna) *|
|* *|
\**************************************************************************/
void NoStandard( int BPush )
{
}