793 lines
23 KiB
C++
793 lines
23 KiB
C++
#include <dos.h>
|
||
#include <conio.h>
|
||
#include <ctype.h>
|
||
#include <stdio.h>
|
||
#include <alloc.h>
|
||
#include <string.h>
|
||
#include <stdarg.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 "alum_def.h"
|
||
|
||
#define BLANCO EGA_WHITE
|
||
#define ENCUADRE 3
|
||
#define SEC_OPTAR 2
|
||
|
||
void BEEP(void);
|
||
|
||
/**************************************************************************\
|
||
|* *|
|
||
|* InputCadenaG *|
|
||
|* *|
|
||
|* Descripci¢n: *|
|
||
|* Edita una cadena en formato gr fico *|
|
||
|* *|
|
||
|* Entradas: *|
|
||
|* Puntero a los datos editados *|
|
||
|* 0 alfanumerico 1 numerico *|
|
||
|* longitud de la cadena (TEXTO/NUMERO) *|
|
||
|* color del texto *|
|
||
|* color de fondo *|
|
||
|* Limites de acotacion *|
|
||
|* *|
|
||
|* Salidas: (ninguna) *|
|
||
|* *|
|
||
|* *|
|
||
\**************************************************************************/
|
||
int InputCadenaG(char *s, int numalp, int lmax, int cc, int cf, int X0, int Y0, int X1, int Y1)
|
||
{
|
||
// A todas las y les sumaba antes +RoW*12 parametro que indica la linea
|
||
|
||
int ls; // longitud cadena
|
||
char Status = 0;
|
||
char *s1; // puntero a cadena inicial
|
||
int c, ok;
|
||
|
||
s1 = s; // inicio cadena
|
||
|
||
setfillstyle(SOLID_FILL, cf);
|
||
bar(X0, Y0, X1, Y1);
|
||
setcolor(cc); outtextxy( X0, Y0, s1 );
|
||
|
||
|
||
ls = strlen ( s ); // Longitud de actual
|
||
|
||
if ( ls < lmax ) {
|
||
setcolor(BLANCO);
|
||
outtextxy( X0+textwidth( s1 ), Y0, "þ");
|
||
}
|
||
|
||
s += ls; // se coloca en el final
|
||
|
||
do{
|
||
c = getch(); // obtiene tecla
|
||
|
||
if ( c == 27 ) Status = 1;
|
||
|
||
ok = ( c == 27 || c == 13 || c == 0); // 13 = INTRO || Especiales
|
||
|
||
if ( c == 8 && ls > 0 && !ok ) { // 8 = Back Space
|
||
ls--;
|
||
s--;
|
||
|
||
*s = '\0';
|
||
|
||
setfillstyle(SOLID_FILL, cf);
|
||
bar(X0, Y0, X1, Y1);
|
||
setcolor(cc); outtextxy( X0, Y0, s1 );
|
||
setcolor(BLANCO);
|
||
|
||
outtextxy( X0+textwidth( s1 ), Y0, "þ");
|
||
setcolor(cc);
|
||
|
||
} else {
|
||
if ( !numalp && c >= 32 && c <= 254 && ls < lmax) {
|
||
|
||
*s++ = c;
|
||
ls++;
|
||
|
||
*s = '\0';
|
||
setfillstyle(SOLID_FILL, cf);
|
||
bar(X0, Y0, X1, Y1);
|
||
setcolor(cc); outtextxy( X0, Y0, s1 );
|
||
|
||
if ( ls < lmax ) {
|
||
setcolor(BLANCO);
|
||
outtextxy( X0+textwidth( s1 ), Y0, "þ");
|
||
}
|
||
|
||
|
||
} else {
|
||
if ( numalp && isdigit(c) && ls < lmax) {
|
||
*s++ = c;
|
||
ls++;
|
||
|
||
*s = '\0'; // Cero final
|
||
setfillstyle(SOLID_FILL, cf);
|
||
bar(X0, Y0, X1, Y1);
|
||
setcolor(cc); outtextxy( X0, Y0, s1 );
|
||
|
||
if ( ls < lmax ) {
|
||
setcolor(BLANCO);
|
||
outtextxy( X0+textwidth( s1 ), Y0, "þ");
|
||
}
|
||
|
||
|
||
}
|
||
/*ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ*/
|
||
else if( c == 27 ) {*s='\0'; ok = 1; }
|
||
/*ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ*/
|
||
else BEEP();
|
||
}
|
||
}
|
||
|
||
}while(!ok);
|
||
|
||
ok = 1;
|
||
*s = ' ';
|
||
while( ok && ls >= 0 ) {
|
||
if(*s==' ') { *s = '\0'; s--; ls--;
|
||
} else { s++; ok = 0; }
|
||
}
|
||
|
||
*s = '\0';
|
||
|
||
while(kbhit()) getch(); // Vacia Buffer impidiendo falsas
|
||
// pulsaciones...
|
||
|
||
return ( (Status<<8) + (ls&0x00FF) );
|
||
}
|
||
|
||
void BEEP(void)
|
||
{
|
||
|
||
sound(440);
|
||
delay(50);
|
||
nosound();
|
||
|
||
}
|
||
|
||
void formatea_long( long Numero, char *Inter_Chg)
|
||
{
|
||
char Buffer1[80];
|
||
|
||
int c;
|
||
char Nmc = 0;
|
||
|
||
|
||
if ( Numero < 0 ) { Numero *= -1; Nmc = 1; }
|
||
|
||
sprintf(Buffer1, "%lu", Numero );
|
||
|
||
Inter_Chg[0]='\0';
|
||
|
||
strrev(Buffer1);
|
||
|
||
c = strlen( Buffer1 );
|
||
|
||
while( c >= 3 )
|
||
{
|
||
c -= 3;
|
||
strncat( Inter_Chg, Buffer1, 3);
|
||
|
||
strrev(Buffer1);
|
||
|
||
Buffer1[c] = '\0';
|
||
|
||
strrev(Buffer1);
|
||
|
||
if(strlen(Buffer1)!=0)
|
||
strcat( Inter_Chg, "." );
|
||
}
|
||
|
||
strcat( Inter_Chg, Buffer1);
|
||
if ( Nmc == 1 )
|
||
strcat( Inter_Chg, "-" );
|
||
|
||
strrev(Inter_Chg);
|
||
|
||
|
||
/*// return Buffer2;*/
|
||
}
|
||
|
||
|
||
void formatea_u_long( unsigned long Numero, char *Inter_Chg)
|
||
{
|
||
char Buffer1[80];
|
||
|
||
int c;
|
||
|
||
sprintf(Buffer1, "%lu", Numero);
|
||
|
||
Inter_Chg[0]='\0';
|
||
|
||
strrev(Buffer1);
|
||
|
||
c = strlen( Buffer1 );
|
||
|
||
while( c >= 3 )
|
||
{
|
||
|
||
c -= 3;
|
||
strncat( Inter_Chg, Buffer1, 3);
|
||
|
||
strrev(Buffer1);
|
||
|
||
Buffer1[c] = '\0';
|
||
|
||
strrev(Buffer1);
|
||
|
||
if(strlen(Buffer1)!=0)
|
||
strcat( Inter_Chg, "." );
|
||
}
|
||
|
||
strcat( Inter_Chg, Buffer1);
|
||
strrev(Inter_Chg);
|
||
|
||
|
||
/*// return Buffer2;*/
|
||
}
|
||
|
||
|
||
int Optar( int optar, ... )
|
||
{
|
||
static void far *fondo, far *fd_aceptar, far *fd_cancelar;
|
||
static char Memoria = 0;
|
||
|
||
int DEV = 0, ok = 0, linea = 0;
|
||
int Center; char *buff;
|
||
struct textsettingstype texttypeinfo;
|
||
|
||
va_list ap;
|
||
va_start( ap, &optar );
|
||
|
||
if ( Memoria == 1 )
|
||
{
|
||
putimage( 170, 165, fondo , COPY_PUT );
|
||
putimage( 170, 320, fd_aceptar , COPY_PUT );
|
||
putimage( 370, 320, fd_cancelar, COPY_PUT );
|
||
|
||
farfree( fondo );
|
||
farfree( fd_aceptar );
|
||
farfree( fd_cancelar );
|
||
|
||
Memoria = 0;
|
||
|
||
if ( optar == ENCUADRE ) return DEV;
|
||
}
|
||
|
||
if ( ( fondo = farmalloc( JD_imagesize( 170, 165, 470, 315 ) ) ) != NULL &&
|
||
( fd_aceptar = farmalloc( JD_imagesize( 170, 320, 270, 350 ) ) ) != NULL &&
|
||
( fd_cancelar = farmalloc( JD_imagesize( 370, 320, 470, 350 ) ) ) != NULL )
|
||
{
|
||
Memoria = 1;
|
||
|
||
getimage( 170, 165, 470, 315, fondo );
|
||
getimage( 170, 320, 270, 350, fd_aceptar );
|
||
getimage( 370, 320, 470, 350, fd_cancelar);
|
||
|
||
gettextsettings( &texttypeinfo );
|
||
|
||
Imprime_Estaticos( 100, "systm\\alum.img" );
|
||
|
||
settextstyle( SMALL_FONT, HORIZ_DIR, 6 );
|
||
|
||
setcolor( 63 );
|
||
|
||
while ( (buff = va_arg(ap, char *)) != NULL )
|
||
{
|
||
Center = (296 - textwidth( buff ) ) / 2;
|
||
outtextxy( 172+Center, ( (linea == 0 ) ? 167 : 200 + 20*linea ), buff );
|
||
linea++;
|
||
}
|
||
|
||
va_end(ap);
|
||
|
||
settextstyle( texttypeinfo.font, texttypeinfo.direction, texttypeinfo.charsize );
|
||
|
||
|
||
if ( optar != ENCUADRE )
|
||
{
|
||
ok = 0; while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER
|
||
do {
|
||
switch( Comprueba_Secuencia( SEC_OPTAR, NULL ) )
|
||
{
|
||
case 0: // No se pulso ningun BOTON
|
||
case -2:
|
||
case -1:
|
||
while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER
|
||
if ( optar == 0 ) ok = 1;
|
||
break;
|
||
case 1:
|
||
DEV = 1; ok = 1;
|
||
break;
|
||
case 2:
|
||
DEV = 0; ok = 1;
|
||
break;
|
||
}
|
||
}while( !ok );
|
||
|
||
putimage( 170, 165, fondo , COPY_PUT );
|
||
putimage( 170, 320, fd_aceptar , COPY_PUT );
|
||
putimage( 370, 320, fd_cancelar, COPY_PUT );
|
||
|
||
farfree( fondo );
|
||
farfree( fd_aceptar );
|
||
farfree( fd_cancelar );
|
||
|
||
Memoria = 0;
|
||
|
||
}
|
||
|
||
|
||
} else {
|
||
farfree( fondo );
|
||
farfree( fd_aceptar );
|
||
farfree( fd_cancelar );
|
||
}
|
||
|
||
|
||
return DEV;
|
||
}
|
||
|
||
|
||
|
||
char led_off [18] [18] =
|
||
{
|
||
{ 3,3,3,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3 },
|
||
{ 3,3,0,7,7,7,7,0,3,3,3,3,3,3,3,3,3,3 },
|
||
{ 3,0,7,4,12,12,4,7,0,3,3,3,3,3,3,3,3,3 },
|
||
{ 0,7,4,12,4,4,4,4,8,0,3,3,3,3,3,3,3,3 },
|
||
{ 0,7,4,4,4,4,4,4,8,0,3,3,3,3,3,3,3,3 },
|
||
{ 0,7,4,4,4,4,4,12,8,0,3,3,3,3,3,3,3,3 },
|
||
{ 0,7,4,4,4,4,12,12,8,0,3,3,3,3,3,3,3,3 },
|
||
{ 3,0,8,4,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3,
|
||
3,3,3,3,3,3,0,0,0,0,0,0,0,3,3,3,3,3
|
||
};
|
||
|
||
|
||
/**************************************************************************\
|
||
|* *|
|
||
|* poicono *|
|
||
|* *|
|
||
|* Descripci¢n: *|
|
||
|* Dibuja el bitmap que se encuentra en matriz, en ¤a pos x,y *|
|
||
|* y segun un angulo de rotacion definido en pos. *|
|
||
|* *|
|
||
|* Entradas: Coordenadas x, y *|
|
||
|* Matriz del bitmap y ( 0: Normal 1: 90§ ... *|
|
||
|* *|
|
||
|* Salidas: (ninguna) *|
|
||
|* *|
|
||
\**************************************************************************/
|
||
void ponicono(int x,int y,char matriz[18][18], char pos)
|
||
{
|
||
int veces1,veces2;
|
||
|
||
for (veces1=0;veces1<=17;veces1++)
|
||
{
|
||
for (veces2=0;veces2<=17;veces2++)
|
||
{
|
||
|
||
switch( pos )
|
||
{
|
||
case 1:
|
||
if ( matriz[veces1][veces2] != 3 )
|
||
putpixel(x+veces1,y+veces2,matriz[veces1][veces2]);
|
||
break;
|
||
case 2:
|
||
if ( matriz[17-veces2][veces1] != 3 )
|
||
putpixel(x+veces1,y+veces2,matriz[17-veces2][veces1]);
|
||
break;
|
||
case 3:
|
||
if ( matriz[17-veces1][veces2] != 3 )
|
||
putpixel(x+veces1,y+veces2,matriz[17-veces1][veces2]);
|
||
break;
|
||
case 4:
|
||
if ( matriz[veces2][veces1] != 3 )
|
||
putpixel(x+veces1,y+veces2,matriz[veces2][veces1]);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
/**************************************************************************\
|
||
|* *|
|
||
|* CalculaAjusteDia *|
|
||
|* *|
|
||
|* Descripci¢n: *|
|
||
|* Calcula el ajuste necesario para el comienzo de los dias *|
|
||
|* y el n£mero de dias que tiene el mes en curso. *|
|
||
|* *|
|
||
|* Entradas: Retorno del Ajuste, y Dias del Mes *|
|
||
|* Mes para iniciar c lculos *|
|
||
|* *|
|
||
|* Salidas: OK Todo ha ido bien *|
|
||
|* ERROR *|
|
||
|* *|
|
||
\**************************************************************************/
|
||
int CalculaAjusteDias( char *Ajuste, char *DiasMes, char Mes, int Anyo )
|
||
{
|
||
int dev, n, b, dsem, dia;
|
||
|
||
// Dias de los meses, si el a¤o no es bisiesto
|
||
char DiasMeses[12] = { 31, 00, 31, 30, 31, 30,
|
||
31, 31, 30, 31, 30, 31 };
|
||
|
||
// Ajusta febrero si es bisiesto el a¤o
|
||
DiasMeses[1] = (Anyo%4 == 0) ? 29 : 28;
|
||
|
||
|
||
dev = ERROR;
|
||
// Solo si la entrada es correcta
|
||
if ( Mes >= 1 && Mes <=12 )
|
||
{
|
||
dev = OK;
|
||
// Obtenemos que dia, ( 0 - 365 ), es el 1§ del mes
|
||
dia = 0;
|
||
for ( n = 0; n < 12 && n < (Mes-1); n++ )
|
||
dia += DiasMeses[n];
|
||
|
||
n = Anyo-1988; // a¤os para bisiesto
|
||
b = (n+3)/4; // a¤os bisies. pasados
|
||
dsem = 4; // 1o. Ene 1988: Viernes
|
||
dsem += (n*365+b); // 1o. Ene actual
|
||
dsem = (dsem+dia)%7; // d¡a seleccionado
|
||
|
||
*Ajuste = dsem;
|
||
*DiasMes = DiasMeses[ Mes - 1 ];
|
||
}
|
||
|
||
return dev;
|
||
}
|
||
|
||
|
||
/**************************************************************************\
|
||
|* *|
|
||
|* TextoDoble *|
|
||
|* *|
|
||
|* Descripci¢n: *|
|
||
|* Muestra el texto, con doble letra, en las coordenadas dadas *|
|
||
|* *|
|
||
|* Entradas: X, Y, texto *|
|
||
|* *|
|
||
|* Salidas: (ninguna) *|
|
||
|* *|
|
||
\**************************************************************************/
|
||
void TextoDoble( int x, int y, char *texto )
|
||
{
|
||
setcolor( EGA_BLACK );
|
||
outtextxy( x, y, texto );
|
||
|
||
setcolor( EGA_WHITE );
|
||
outtextxy( x+1, y+1, texto );
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
/////// EDITAR COMENTARIO....
|
||
int EditComentario( char *Comentario, int Lineas, int Columnas, int cc, int cf, int X0, int Y0, int X1, int Y1, int Inc )
|
||
{
|
||
|
||
int ls; // longitud cadena
|
||
char *s1, *s, *s_tmp, *s_tmp1; // puntero a cadena inicial
|
||
int key, ok, Linea = 0, Columna = 0, lmax;
|
||
char Buffer[80];
|
||
|
||
lmax = Columnas;
|
||
|
||
setfillstyle(SOLID_FILL, cf); // selecciona los atributos de
|
||
setcolor(cc); // devuelve el color a su estado
|
||
|
||
for ( ok = 0; ok < Lineas; ok ++ )
|
||
{
|
||
bar( X0, Y0+Linea*Inc, X1, Y0+Linea*Inc + Inc); // relleno, y Borra el campo
|
||
outtextxy( X0, Y0+ok*Inc, &Comentario[ (lmax+1)*Linea ] ); // e imprime la cadena.
|
||
}
|
||
|
||
ok = 0;
|
||
|
||
s_tmp1 = s_tmp = s = s1 = &Comentario[0 + (lmax+1)*Linea ]; // inicio cadena
|
||
|
||
s += lmax ; *s = '\0';
|
||
s = s_tmp;
|
||
|
||
do {
|
||
|
||
|
||
setfillstyle(SOLID_FILL, cf); // selecciona los atributos de
|
||
bar( X0, Y0+Linea*Inc, X1, Y0+Linea*Inc + Inc); // relleno, y Borra el campo
|
||
setcolor(cc); // devuelve el color a su estado
|
||
|
||
outtextxy( X0, Y0+Linea*Inc, s1 ); // e imprime la cadena.
|
||
// ls = strlen ( s ); // Longitud de la cadena actual
|
||
|
||
|
||
if ( Columna < lmax ) { // Muestra cursor si es posible
|
||
strncpy( Buffer, s1, Columna );
|
||
Buffer[Columna] = '\0';
|
||
setcolor(BLANCO);
|
||
outtextxy( X0 + textwidth( Buffer ), Y0+Linea*Inc+2, "Ü");
|
||
}
|
||
|
||
|
||
|
||
switch ( ( key = getch() ) ) { // obtiene tecla
|
||
// Intro o Return
|
||
case 13:
|
||
if( Linea < Lineas ) {
|
||
setfillstyle(SOLID_FILL, cf); // selecciona los atributos de
|
||
bar( X0, Y0+Linea*Inc, X1, Y0+Linea*Inc + Inc); // relleno, y Borra el campo
|
||
setcolor(cc); // devuelve el color a su estado
|
||
outtextxy( X0, Y0+Linea*Inc, s1 ); // e imprime la cadena.
|
||
|
||
Linea++;
|
||
s_tmp1 = s_tmp = s = s1 = &Comentario[/*Linea + */(lmax+1)*Linea ]; // inicio cadena
|
||
s += lmax; *s = '\0';
|
||
Columna = 0;
|
||
s = s_tmp1 = s_tmp = s1;
|
||
}
|
||
break;
|
||
|
||
case 0:
|
||
|
||
switch ( key = getch() ) {
|
||
|
||
// F. Arriba
|
||
case 72:
|
||
if( Linea > 0 ) {
|
||
setfillstyle(SOLID_FILL, cf); // selecciona los atributos de
|
||
bar( X0, Y0+Linea*Inc, X1, Y0+Linea*Inc + Inc); // relleno, y Borra el campo
|
||
setcolor(cc); // devuelve el color a su estado
|
||
outtextxy( X0, Y0+Linea*Inc, s1 ); // e imprime la cadena.
|
||
|
||
Linea--;
|
||
s_tmp1 = s_tmp = s = s1 = &Comentario[/*Linea + */(lmax+1)*Linea ]; // inicio cadena
|
||
s += lmax; *s = '\0';
|
||
if ( Columna < strlen( s1 ) ) s_tmp += Columna; else { Columna = 0;
|
||
s_tmp = s1; }
|
||
s = s_tmp1 = s_tmp;
|
||
|
||
}
|
||
|
||
break;
|
||
// F. Abajo
|
||
case 80:
|
||
|
||
if( Linea < Lineas ) {
|
||
setfillstyle(SOLID_FILL, cf); // selecciona los atributos de
|
||
bar( X0, Y0+Linea*Inc, X1, Y0+Linea*Inc + Inc); // relleno, y Borra el campo
|
||
setcolor(cc); // devuelve el color a su estado
|
||
outtextxy( X0, Y0+Linea*Inc, s1 ); // e imprime la cadena.
|
||
|
||
Linea++;
|
||
s_tmp1 = s_tmp = s = s1 = &Comentario[/*Linea + */(lmax+1)*Linea ]; // inicio cadena
|
||
s += lmax; *s = '\0';
|
||
if ( Columna < strlen( s1 ) ) s_tmp += Columna; else { Columna = 0;
|
||
s_tmp = s1; }
|
||
s = s_tmp1 = s_tmp;
|
||
}
|
||
break;
|
||
// F. Derecha
|
||
case 77:
|
||
case 9:
|
||
if ( Columna < strlen(s1) ) { Columna++; s++; }
|
||
break;
|
||
// F. Izquierda
|
||
case 75:
|
||
case 11:
|
||
if ( Columna > 0) { Columna--; s--; }
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
|
||
break;
|
||
// Back Space
|
||
case 8:
|
||
if ( Columna > 0 ) {
|
||
Columna--;
|
||
s--;
|
||
s_tmp1 = s_tmp = s;
|
||
while ( *s_tmp1 != NULL ) {
|
||
s_tmp1++;
|
||
*s_tmp = *s_tmp1;
|
||
s_tmp++;
|
||
}
|
||
}
|
||
break;
|
||
case 27:
|
||
ok = 1;
|
||
break;
|
||
default:
|
||
if ( key >= 32 && key <= 254 && Columna < lmax) {
|
||
*s++ = key;
|
||
Columna++;
|
||
}
|
||
break;
|
||
}
|
||
}while(!ok);
|
||
|
||
while(kbhit()) getch(); // Vacia Buffer impidiendo falsas
|
||
// pulsaciones...
|
||
|
||
|
||
setfillstyle(SOLID_FILL, cf); // selecciona los atributos de
|
||
bar( X0, Y0+Linea*Inc, X1, Y0+Linea*Inc + Inc); // relleno, y Borra el campo
|
||
setcolor(cc); // devuelve el color a su estado
|
||
|
||
outtextxy( X0, Y0+Linea*Inc, s1 ); // e imprime la cadena.
|
||
|
||
return /* de momento nada */ 0;
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
char *PideClave( char *LineaVentana, char *Comprobante )
|
||
{
|
||
static char Clave[15+1];
|
||
|
||
Clave[0] = '\0';
|
||
Optar( ENCUADRE, LineaVentana, "Introduzca clave para:", Comprobante, NULL );
|
||
|
||
InputCadenaG( Clave, 0, 15, EGA_WHITE, EGA_WHITE, 190, 280, 450, 305 );
|
||
|
||
Optar( ENCUADRE, LineaVentana, "Introduzca clave para:", Comprobante, NULL );
|
||
|
||
return Clave;
|
||
}
|
||
|
||
|
||
void MuestraGraficas( int PosX, int PosY, int xWidth, int yWidth, int NDatos, long *Datos, char Mensajes[][12] )
|
||
{
|
||
long DMaximo;
|
||
int i, AnchoBarra;
|
||
|
||
// Limpiamos la zona de visualizaci¢n
|
||
setfillstyle( SOLID_FILL, EGA_WHITE );
|
||
bar( PosX, PosY, PosX + xWidth, PosY + yWidth );
|
||
|
||
// Calculamos el maximo valor a mostrar
|
||
DMaximo = 0;
|
||
for ( i = 0; i < NDatos; i++ )
|
||
if ( Datos[i] > DMaximo )
|
||
DMaximo = Datos[i];
|
||
|
||
// Ahora calculamos el ancho de cada barra de porcentaje
|
||
AnchoBarra = xWidth / NDatos;
|
||
|
||
// Empiezo a dibujar las barras
|
||
PosY += yWidth - 1;
|
||
yWidth -= (AnchoBarra / 4);
|
||
setfillstyle( SLASH_FILL, EGA_BLUE );
|
||
setcolor( EGA_BLACK );
|
||
for ( i = 0; i < NDatos; i++ )
|
||
{
|
||
if ( DMaximo != 0 )
|
||
bar3d( PosX + AnchoBarra*i, PosY - ( ( Datos[i] * yWidth ) / DMaximo), PosX + AnchoBarra*(i+1), PosY,
|
||
AnchoBarra / 4, 1 );
|
||
}
|
||
|
||
}
|
||
|
||
|
||
/**************************************************************************\
|
||
|* *|
|
||
|* PideClaveUsuario *|
|
||
|* *|
|
||
|* Descripci¢n: *|
|
||
|* Pide la clave de usuario y comprueba si es correcta. *|
|
||
|* *|
|
||
|* Entradas: (ninguna) *|
|
||
|* *|
|
||
|* Salidas: OK -clave correcta- ERROR -clave incorrecta- *|
|
||
|* *|
|
||
|* *|
|
||
\**************************************************************************/
|
||
char PideClaveUsuario( void )
|
||
{
|
||
return OK;
|
||
/*
|
||
char buffer[80], Clave[80];
|
||
int CodEmpl, dev;
|
||
|
||
BDatos BEmpl_p; // Base de datos de Empleados
|
||
INFO_EMPLEADOS SEmpl_p; // Estructura de Empleados
|
||
|
||
dev = ERROR;
|
||
|
||
sprintf( buffer, "datos\\%s\\info_emp.dbf", NEmpresa );
|
||
if ( BEmpl_p.AbrirReg( buffer, sizeof( INFO_EMPLEADOS ) ) == ERROR )
|
||
{
|
||
Optar( 0, " ALERTA !", "No existen empleados", "c¢digos de acceso anulados", "PERMISOS ABIERTOS", NULL );
|
||
return OK;
|
||
}
|
||
|
||
|
||
|
||
Clave[0] = '\0';
|
||
Optar( ENCUADRE, " Identifiquese !", "", "Login: ", "Password: ", NULL );
|
||
|
||
// Obtenemos el c¢digo de usuario:
|
||
do {
|
||
if ( InputCadenaG( buffer, 1, 5, EGA_WHITE, EGA_WHITE, 190, 280, 450, 305 ) >> 8 )
|
||
return ERROR;
|
||
} while ( !MatchEmpleado( atoi(buffer) ) );
|
||
|
||
// InputCadenaG( Clave, 0, 15, EGA_WHITE, EGA_WHITE, 190, 280, 450, 305 );
|
||
|
||
if ( ! ( InputCadenaG( buffer, 1, 5, EGA_WHITE, EGA_WHITE, 190, 280, 450, 305 ) >> 8 ) )
|
||
{
|
||
if ( SEmpl_p.Password[0] != '\0' && strcmpi( buffer, SEmpl_p.Password ) == 0 )
|
||
dev = OK;
|
||
}
|
||
|
||
Optar( ENCUADRE, " Identifiquese !", "", "Login: ", "Password: ", NULL );
|
||
|
||
return dev;
|
||
*/
|
||
}
|