First commit 09/12/1994

This commit is contained in:
José David Guillén 2021-09-03 17:43:05 +02:00
commit 89a9bade50
18 changed files with 6079 additions and 0 deletions

1457
ADDVIEW2.CPP Normal file

File diff suppressed because it is too large Load Diff

977
CATALOGO.CPP Normal file
View File

@ -0,0 +1,977 @@
/*
Cat logo Gr fico
por Jos David Guilln
Copyright (c) 1994 JD Software Original. All rights reserved.
*/
#ifdef __TINY__
#error CATALOGO will not run in the tiny model.
#endif
#include <dos.h>
#include <bios.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <graphics.h>
#include "..\jd_lib\key.h"
#include "catalogo.h"
int huge DetectVGA256()
{
return 2;
}
// extern int leepcx(char diu[80]);
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* Begin main function */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
int main(int argc, char *argv[])
{
int ch = 32;
union REGS ent, sal;
char *NaC;
NaC = argv[0];
if(argc >=2 ) CheckArg(argc, argv);
{ auto unsigned disk;
_dos_getdrive(&disk);
if(disk==1 || disk==2) NoIniSb = 0;
}
struct boton menu[4];
menu[0].left = 20; menu[0].up = 20; menu[0].right = 170; menu[0].down = 100;
menu[1].left = 20; menu[1].up = 140; menu[1].right = 170; menu[1].down = 220;
menu[2].left = 20; menu[2].up = 260; menu[2].right = 170; menu[2].down = 340;
menu[3].left = 20; menu[3].up = 380; menu[3].right = 170; menu[3].down = 460;
// key_init(INIT);
lee_setup();
Initialize(); /* Set system into Graphics mode */
if ( !NoIniSb || Inicializa_SB() == 0 ) sb2 = 0; /* Fun with sound...? Yea.. SB0 */
/*if (leepcx("catalogo.img")==0)*/
DibujaPantalla(); /* Dise¤a la pantalla de visualizaci¢n */
inicializa_raton_grafico(0, 0, 624, 464, 320, 240);
if (sb!=0) Sound_SN("catalog0");
if (raton!=0) activa_raton();
do{
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* Comprueba las teclas pulsadas */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
if (kbhit()) {
if(raton!=0) desactiva_raton();
ch = getch();
switch ( ch ) {
case 109:
case 77:
if (sb!=0) Sound_SN("catalog1");
Menu_Mirar(0);
break;
case 117:
case 85:
if (sb!=0) Sound_SN("catalog1");
Menu_Utilidad();
break;
case 105:
case 73:
if (sb!=0) Sound_SN("catalog1");
Info( NaC /*LEXE*/ );
break;
case 115:
case 83:
if (sb!=0) Sound_SN("catalog9");
if (raton!=0) desactiva_raton();
fundido_al_negro();
closegraph(); /* Return the system to text mode */
cprintf("Gracias por utilizar mi Software\nJos David Guilln\n");
sleep(2);
if(sb2) SOUNDFXDRIVER(FINDRV);
// key_init(RESTORE);
exit(1);
break;
case 0:
ch = getch();
if (ch== 15 && raton!=0) {
activa_raton();
do{
ent.x.ax = 3;
int86(0x33, &ent, &sal); /* lee posici¢n y estados del bot¢n */
boton_izq = sal.x.bx & 1;
boton_der = (sal.x.bx >> 1) & 1;
x_raton = sal.x.cx;
y_raton = sal.x.dx;
}while(boton_izq==0);
if(x_raton >= 110 && x_raton <= 118 && y_raton >= 78 && y_raton <= 86) {
desactiva_raton();
if (sb!=0) Sound_SN("catalogb");
Animacion();
activa_raton();
}
}
break;
default:
if (sb) Sound_SN("catalog3");
if(raton!=0) activa_raton();
}
// if (ch==0) getch();
}
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* Comprueba las pulsaciones del rat¢n */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
if(raton!=0) {
ent.x.ax = 3;
int86(0x33, &ent, &sal); /* lee posici¢n y estados del bot¢n */
boton_izq = sal.x.bx & 1;
boton_der = (sal.x.bx >> 1) & 1;
x_raton = sal.x.cx;
y_raton = sal.x.dx;
if(boton_izq==1 || boton_der==1) {
if (raton!=0) desactiva_raton();
if( CheckButon(4, menu) ) {
switch(bpush) {
case 1:
Menu_Mirar(0);
break;
case 2:
Menu_Utilidad();
break;
case 3:
Info( NaC /*LEXE*/ );
break;
case 4:
if (sb!=0) Sound_SN("cataloga");
if (raton!=0) desactiva_raton();
fundido_al_negro();
closegraph(); /* Return the system to text mode */
cprintf ("Gracias por utilizar mi Software\nJos David Guilln\n");
sleep(2);
if(sb2) SOUNDFXDRIVER(FINDRV);
// key_init(RESTORE);
exit(1);
default:
break;
}
}
if (raton!=0) activa_raton();
}
}
gotoxy(1,1);
printf("x: %3d y: %3d", x_raton, y_raton);
}while(1);
}
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* */
/* INITIALIZE: Initializes the graphics system and reports */
/* any errors which occured. */
/* */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
void Initialize(void)
{
int errorcode;
int Gd = 9, Gm = 2;
//int Gd = DETECT, Gm;
// installuserdriver("Svga256", DetectVGA256);
//errorcode = registerfarbgidriver(Svga256_fdriver);
errorcode = registerbgidriver(EGAVGA_driver);
/* report any registration errors */
if (errorcode < 0)
{
printf("Graphics error: %s\n%d", grapherrormsg(errorcode), errorcode);
printf("Press any key to halt (REGISTRATION FAR):");
getch();
exit(1); /* terminate with an error code */
}
/* initialize graphics and local variables */
initgraph(&Gd,&Gm,"");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n%d", grapherrormsg(errorcode), errorcode);
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
}
}
// ÛÛÛÛÛ Û Û Û Û ÛÛ
// ÄÄÄÄÄÄÄÛÛÄÄÄÄÄÄÄÄÛÄÛÄÄÄÄÄÄÛÛÄÛÄÄÄÄÄÄÄÄÄÛÛÄÛÄÄÄÄÄÄÄÄÄÄÄÄÄÛÄÛÄÄÄÄÛÄÛÄÄÄÄÄÄÄÄÄÄ
// ÄÄÄÄÄÄÄÄÛÛÄÄÄÄÄÄÛÄÄÄÛÄÄÄÛÛÄÄÄÄÛÄÄÄÄÄÄÄÛÄÄÄÄÛÄÄÄÄÄÄÛÄÄÄÄÛÄÄÄÛÄÄÛÄÄÛÄÄÄÄÄÛÛÛÛÛ
// ÄÄÄÄÄÄÄÄÄÛÛÄÄÛÛÛÄÄÄÄÛÛÄÛÄÄÄÄÄÄÄÛÄÄÄÄÄÛÄÄÄÄÄÛÛÄÄÄÄÛÄÛÄÄÄÛÄÄÄÄÛÄÛÄÄÛÄÄÄÄÛÄÄÄÄÄ
// ÄÄÄÄÄÄÄÛÛÛÄÄÄÄÄÄÄÄÄÄÄÄÛÄÄÄÄÄÄÄÄÄÛÄÄÄÛÄÄÄÄÄÄÄÛÄÄÄÛÄÄÄÛÄÛÄÄÄÄÄÄÛÄÄÄÛÄÄÄÄÛÄÄÄÄÄ
// ÄÄÄÄÄÄÛÛÛÛÛÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÛÄÛÄÄÄÄÄÄÄÄÄÛÄÛÄÄÄÄÄÛÄÄÄÄÄÄÄÄÄÄÄÄÛÄÄÛÄÄÄÄÄÄ
// ÛÛÛ Û ÛÛ ÛÛ
void Sound_SN(char headfile[])
{
if ( sb2 ) {
strcpy(dir_sfx, headfile);
strcat(dir_sfx, ".voc");
if( strcmp( vieja_dir_sfx, dir_sfx ) != 0 ) {
strcpy(vieja_dir_sfx, dir_sfx);
PlaySound(1);
} else PlaySound(0);
} else {
sound(440);
delay(50);
nosound();
}
}
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* Borra las distintas pantallas de visualizaci¢n #1 #2 y #3 */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
void BorraViewPort(int view)
{
setcolor(0);
setlinestyle(0, 0, NORM_WIDTH);
setfillstyle(1, 0);
if(view==1) bar(217, 32, 298, 206);
if(view==2) bar(325, 32, 593, 206);
if(view==3) bar(216, 272, 593, 448);
}
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* Da un mensaje de ERROR en modo GRµFICO */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/*void MensajeError(int erronum)
{
char *msg_error[] = { "Error leyendo dispositivo E/S",
"Error de proteccion contra escritura",
"Error Disco lleno",
"Error utilizando Sound_SN Blaster",
"Error FALTA MEMORIA",
"Error Ficheros necesarios",
"de uso interno no encontrados",
"Error SISTEMA ALTERADO",
"INTENTO DE PIRATEO",
"Error el dispositivo: PRN",
"Error de tipo DESCONOCIDO",
"compruebe su sistema minuciosamente"
};
// ImprimeBoton(160, 176, 480, 304, 7, 63, 8);
}*/
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* Principio del Menu Mirar */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
void Menu_Mirar(int Mirar_Modificar)
{
union REGS ent, sal;
int ch, x, y;
int salir = FALSE;
char *texto[] = { "Juegos ", "M£sica ", "P.Textos",
"Contabil. ", "Electr¢n. ", "Gr ficos",
"Utilidades", "Lenguajes ", "Windows ",
"Varios... ", "RETROCEDER", " " };
struct boton menu[11];
menu[0].left = 325; menu[0].up = 33; menu[0].right = 412; menu[0].down = 76;
menu[1].left = 413; menu[1].up = 33; menu[1].right = 503; menu[1].down = 76;
menu[2].left = 504; menu[2].up = 33; menu[2].right = 592; menu[2].down = 76;
menu[3].left = 325; menu[3].up = 77; menu[3].right = 412; menu[3].down = 120;
menu[4].left = 413; menu[4].up = 77; menu[4].right = 503; menu[4].down = 120;
menu[5].left = 504; menu[5].up = 77; menu[5].right = 592; menu[5].down = 120;
menu[6].left = 325; menu[6].up = 121; menu[6].right = 412; menu[6].down = 164;
menu[7].left = 413; menu[7].up = 121; menu[7].right = 503; menu[7].down = 164;
menu[8].left = 504; menu[8].up = 121; menu[8].right = 592; menu[8].down = 164;
menu[9].left = 325; menu[9].up = 165; menu[9].right = 412; menu[9].down = 205;
menu[10].left = 413; menu[10].up = 165; menu[10].right = 592; menu[10].down = 205;
for(x=0; x<11; x++) ImprimeBoton2 (1, 7, 63, 56, menu[x]);
ch=-1;
for(y=40; y<=169; y+=43) { /* 40 */
for(x=330; x<=510; x+=90) {
++ch;
setcolor(15);
outtextxy(x+1, y+1, texto[ch]);
setcolor(1);
outtextxy(x, y, texto[ch]);
setcolor(4);
if(ch!=11) outtextxy(x+1, y+5, "-");
}
}
if(raton!=0) {
inicializa_raton_grafico(325, 33, 584, 189, 454, 111);
activa_raton();
}
x=11; /* Las x's representan el boton pulsado, que sera 11 en el caso de que
se pulse salir para no activar ninguna opcion */
do{
if (kbhit()) {
if (raton!=0) desactiva_raton();
ch = getch();
switch( ch ) {
case 0: getch();
break;
case 74:
case 106: x=1;
salir = TRUE;
break;
case 77:
case 109: x=2;
salir = TRUE;
break;
case 80:
case 112: x=3;
salir = TRUE;
break;
case 67:
case 99: x=4;
salir = TRUE;
break;
case 69:
case 101: x=5;
salir = TRUE;
break;
case 71:
case 103: x=6;
salir = TRUE;
break;
case 85:
case 117: x=7;
salir = TRUE;
break;
case 76:
case 108: x=8;
salir = TRUE;
break;
case 87:
case 119: x=9;
salir = TRUE;
break;
case 86:
case 118: x=10;
salir = TRUE;
break;
case 82:
case 114: salir = TRUE;
break;
default:
if (sb) Sound_SN("catalog3");
break;
}
if (raton!=0) activa_raton();
}
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* Comprueba las pulsaciones del rat¢n */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
if(raton!=0 && !salir ) {
ent.x.ax = 3;
int86(0x33, &ent, &sal); /* lee posici¢n y estados del bot¢n */
boton_izq = sal.x.bx & 1;
boton_der = (sal.x.bx >> 1) & 1;
x_raton = sal.x.cx;
y_raton = sal.x.dx;
if(boton_izq==1 || boton_der==1) {
desactiva_raton();
if( CheckButon(11, menu) ) { x = bpush; salir = TRUE; }
activa_raton();
}
}
}while(!salir);
if (raton!=0) desactiva_raton();
if (sb) Sound_SN("catalog1");
BorraViewPort(2);
if(x!=11) {
if(Mirar_Modificar>=0 && Mirar_Modificar<=1) Editar_Modificar(Mirar_Modificar, x);
if(Mirar_Modificar==2) Imprimir_Individual(x);
}
if (raton!=0) inicializa_raton_grafico(0, 0, 624, 464, 320, 240);
}
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* Dibuja el Men£ de Utilidad */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
void Dibuja_Menu_Utilidad(void)
{
setcolor(15);
outtextxy(329, 39, "Pedidos");
outtextxy(329, 97, "Impresi¢n");
outtextxy(329, 105, " Completa");
outtextxy(461, 97, "Impresi¢n");
outtextxy(461, 105, " Individual");
outtextxy(329, 151, "Men£");
outtextxy(329, 159, " Principal");
outtextxy(461, 151, "RETROCEDER");
setcolor(1);
outtextxy(330, 40, "Pedidos");
outtextxy(330, 98, "Impresi¢n");
outtextxy(330, 106, " Completa");
outtextxy(462, 98, "Impresi¢n");
outtextxy(462, 106, " Individual");
outtextxy(330, 152, "Men£");
outtextxy(330, 160, " Principal");
outtextxy(462, 152, "RETROCEDER");
setcolor(4);
outtextxy(330, 45, "-");
outtextxy(330, 111, " -");
outtextxy(462, 111, " -");
outtextxy(330, 157, "-");
outtextxy(462, 157, "-");
}
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* Principio del Men£ Utilidad */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
void Menu_Utilidad(void)
{
union REGS ent, sal;
int ch;
int salir = FALSE;
struct boton menu[6];
menu[0].left = 325; menu[0].up = 33; menu[0].right = 455; menu[0].down = 90;
menu[1].left = 457; menu[1].up = 33; menu[1].right = 592; menu[1].down = 90;
menu[2].left = 325; menu[2].up = 91; menu[2].right = 455; menu[2].down = 146;
menu[3].left = 457; menu[3].up = 91; menu[3].right = 592; menu[3].down = 146;
menu[4].left = 325; menu[4].up = 147; menu[4].right = 455; menu[4].down = 205;
menu[5].left = 457; menu[5].up = 147; menu[5].right = 592; menu[5].down = 205;
for(ch=0; ch<6; ch++) ImprimeBoton2 (1, 7, 63, 56, menu[ch]);
Dibuja_Menu_Utilidad();
if(raton!=0) {
inicializa_raton_grafico(325, 33, 584, 189, 454, 111);
activa_raton();
}
do{
if (kbhit()) {
if (raton!=0) desactiva_raton();
ch = getch();
switch( ch ) {
case 0: getch();
break;
case 80:
case 112: if (sb) Sound_SN("catalog1");
EditarModificarPedidos();
for(ch=0; ch<6; ch++) ImprimeBoton2 (1, 7, 63, 56, menu[ch]);
Dibuja_Menu_Utilidad();
if(raton!=0) inicializa_raton_grafico(325, 33, 584, 189, 454, 111);
break;
case 67:
case 99: if (sb) Sound_SN("catalog1");
Imprimir_Individual(0);
for(ch=0; ch<6; ch++) ImprimeBoton2 (1, 7, 63, 56, menu[ch]);
Dibuja_Menu_Utilidad();
if(raton!=0) inicializa_raton_grafico(325, 33, 584, 189, 454, 111);
break;
case 73:
case 105: if (sb) Sound_SN("catalog1");
Menu_Mirar(2);
for(ch=0; ch<6; ch++) ImprimeBoton2 (1, 7, 63, 56, menu[ch]);
Dibuja_Menu_Utilidad();
if(raton!=0) inicializa_raton_grafico(325, 33, 584, 189, 454, 111);
break;
case 77:
case 109: if( Setup.codigo == 0 ) Menu_Principal();
else { if(PideCodigo() == 1) Menu_Principal(); }
for(ch=0; ch<6; ch++) ImprimeBoton2 (1, 7, 63, 56, menu[ch]);
Dibuja_Menu_Utilidad();
if(raton!=0) inicializa_raton_grafico(325, 33, 584, 189, 454, 111);
break;
case 82:
case 114:
if (sb) Sound_SN("catalog1");
salir = TRUE;
break;
default:
if (sb) Sound_SN("catalog3");
break;
}
if (raton!=0) activa_raton();
}
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* Comprueba las pulsaciones del rat¢n */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
if(raton!=0 && !salir ) {
ent.x.ax = 3;
int86(0x33, &ent, &sal); /* lee posici¢n y estados del bot¢n */
boton_izq = sal.x.bx & 1;
boton_der = (sal.x.bx >> 1) & 1;
x_raton = sal.x.cx;
y_raton = sal.x.dx;
if(boton_izq==1 || boton_der==1) {
desactiva_raton();
if( CheckButon(6, menu) ) {
switch(bpush) {
case 1:
EditarModificarPedidos();
for(ch=0; ch<6; ch++) ImprimeBoton2 (1, 7, 63, 56, menu[ch]);
Dibuja_Menu_Utilidad();
if(raton!=0) inicializa_raton_grafico(325, 33, 584, 189, 454, 111);
break;
/* case 2:
break; VACIO VACIO VACIO VACIO VACIO VACIO
*/
case 3:
Imprimir_Individual(0);
for(ch=0; ch<6; ch++) ImprimeBoton2 (1, 7, 63, 56, menu[ch]);
Dibuja_Menu_Utilidad();
if(raton!=0) inicializa_raton_grafico(325, 33, 584, 189, 454, 111);
break;
case 4:
Menu_Mirar(2);
for(ch=0; ch<6; ch++) ImprimeBoton2 (1, 7, 63, 56, menu[ch]);
Dibuja_Menu_Utilidad();
if(raton!=0) inicializa_raton_grafico(325, 33, 584, 189, 454, 111);
break;
case 5:
if( Setup.codigo == 0 ) Menu_Principal();
else { if(PideCodigo() == 1) Menu_Principal(); }
for(ch=0; ch<6; ch++) ImprimeBoton2 (1, 7, 63, 56, menu[ch]);
Dibuja_Menu_Utilidad();
if(raton!=0) inicializa_raton_grafico(325, 33, 584, 189, 454, 111);
break;
case 6:
salir = TRUE;
break;
default:
activa_raton();
break;
}
} else activa_raton();
}
}
}while(!salir);
if (raton!=0) desactiva_raton();
BorraViewPort(2);
if(raton!=0) {
inicializa_raton_grafico(0, 0, 624, 464, 320, 240);
activa_raton();
}
}
void Dibuja_Menu_Principal(void)
{
setcolor(1);
outtextxy(462, 40, "Modificar");
outtextxy(462, 48, " Comentario");
outtextxy(330, 98, "Configuracion");
outtextxy(330, 152, "Add/Supr.");
outtextxy(330, 160, " Programas");
outtextxy(462, 152, "RETROCEDER");
setcolor(4);
outtextxy(462, 45, "-");
outtextxy(330, 103, "-");
outtextxy(330, 157, "-");
outtextxy(462, 157, "-");
}
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* Principio del Men£ Principal */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
void Menu_Principal(void)
{
union REGS ent, sal;
int ch;
int salir = FALSE;
struct boton menu[6];
menu[0].left = 325; menu[0].up = 33; menu[0].right = 455; menu[0].down = 90;
menu[1].left = 457; menu[1].up = 33; menu[1].right = 592; menu[1].down = 90;
menu[2].left = 325; menu[2].up = 91; menu[2].right = 455; menu[2].down = 146;
menu[3].left = 457; menu[3].up = 91; menu[3].right = 592; menu[3].down = 146;
menu[4].left = 325; menu[4].up = 147; menu[4].right = 455; menu[4].down = 205;
menu[5].left = 457; menu[5].up = 147; menu[5].right = 592; menu[5].down = 205;
for(ch=0; ch<6; ch++) ImprimeBoton2 (1, 7, 63, 56, menu[ch]);
Dibuja_Menu_Principal();
if(raton!=0) {
inicializa_raton_grafico(325, 33, 584, 189, 454, 111);
activa_raton();
}
do{
if (kbhit()) {
if (raton!=0) desactiva_raton();
ch = getch();
switch( ch ) {
case 0: getch();
break;
case 77:
case 109: if (sb) Sound_SN("catalog1");
Modificar_Comentario();
for(ch=0; ch<6; ch++) ImprimeBoton2 (1, 7, 63, 56, menu[ch]);
Dibuja_Menu_Principal();
if(raton!=0) inicializa_raton_grafico(325, 33, 584, 189, 454, 111);
break;
case 67:
case 99: if (sb) Sound_SN("catalog1");
Configuracion();
BorraViewPort(1);
for(ch=0; ch<6; ch++) ImprimeBoton2 (1, 7, 63, 56, menu[ch]);
Dibuja_Menu_Principal();
if(raton!=0) inicializa_raton_grafico(325, 33, 584, 189, 454, 111);
break;
case 65:
case 97: if (sb) Sound_SN("catalog1");
Menu_Mirar(1);
for(ch=0; ch<6; ch++) ImprimeBoton2 (1, 7, 63, 56, menu[ch]);
Dibuja_Menu_Principal();
if(raton!=0) inicializa_raton_grafico(325,33,584, 189, 454, 111);
break;
case 82:
case 114:
if (sb) Sound_SN("catalog1");
salir = TRUE;
break;
default:
if (sb) Sound_SN("catalog3");
break;
}
if (raton!=0) activa_raton();
}
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* Comprueba las pulsaciones del rat¢n */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
if(raton!=0 && !salir ) {
ent.x.ax = 3;
int86(0x33, &ent, &sal); /* lee posici¢n y estados del bot¢n */
boton_izq = sal.x.bx & 1;
boton_der = (sal.x.bx >> 1) & 1;
x_raton = sal.x.cx;
y_raton = sal.x.dx;
if(boton_izq==1 || boton_der==1) {
desactiva_raton();
if( CheckButon(6, menu) ) {
switch(bpush) {
/* case 1:
EditarModificarPedidos();
for(ch=0; ch<6; ch++) ImprimeBoton2 (1, 7, 63, 56, menu[ch]);
Dibuja_Menu_Principal();
if(raton!=0) inicializa_raton_grafico(325, 33, 584, 189, 454, 111);
break;
*/
case 2:
Modificar_Comentario();
for(ch=0; ch<6; ch++) ImprimeBoton2 (1, 7, 63, 56, menu[ch]);
Dibuja_Menu_Principal();
if(raton!=0) inicializa_raton_grafico(325, 33, 584, 189, 454, 111);
break;
case 3:
Configuracion();
BorraViewPort(1);
for(ch=0; ch<6; ch++) ImprimeBoton2 (1, 7, 63, 56, menu[ch]);
Dibuja_Menu_Principal();
if(raton!=0) inicializa_raton_grafico(325, 33, 584, 189, 454, 111);
break;
// case 4:
// /* VACIO */
// break;
case 5:
Menu_Mirar(1);
for(ch=0; ch<6; ch++) ImprimeBoton2 (1, 7, 63, 56, menu[ch]);
Dibuja_Menu_Principal();
if(raton!=0) inicializa_raton_grafico(325, 33, 584, 189, 454, 111);
break;
case 6:
salir = TRUE;
break;
default:
activa_raton();
break;
}
} else activa_raton();
}
}
}while(!salir);
if (raton!=0) desactiva_raton();
BorraViewPort(2);
if(raton!=0) {
inicializa_raton_grafico(0, 0, 624, 464, 320, 240);
activa_raton();
}
}
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
void CheckArg(int nargumentos, char *argumentos[]) {
int contador;
for(contador=1; contador<=nargumentos; contador++) {
if ( !strcmpi( argumentos[contador], "SB0") ) NoIniSb = 0;
if ( !strcmpi( argumentos[contador], "PO" ) ) PunteroRaton = 1;
if ( !strcmpi( argumentos[contador], "NS" ) ) sb=0;
if ( !strcmp ( argumentos[contador], "/?" ) || !strcmpi( argumentos[contador], "/H") ) {
//////////////////////// Show Help Screen ////////////////////////
clrscr();
textcolor(WHITE); textbackground(BLUE);
cprintf("Copyright (c) J.D. System 1994. Jos David Guilln Dominguez... Cat logo 4.0 ");
textbackground(BLACK);
gotoxy(1,3);
printf("Sintaxis:\n");
printf(" SB0 ---------> redirecciona sonidos al Speaker\n");
printf(" NS ----------> sin sonido de ninguna clase\n");
printf(" PO ----------> puntero original de raton\n");
printf(" /? o /H -----> muestra esta Pantalla\n");
printf("\nTodos los parametros se pueden definir por defecto en la variable de entorno SET");
printf("\nSET JD_C4 = SB0 PO \n\n");
gotoxy(1, 23);
exit(0);
}
}
}
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
int CheckButon(int nb, struct boton menu[])
{
union REGS ent, sal;
int y;
int Pulso = 0;
for(y = 0; y < nb; y++) {
if(x_raton >= menu[y].left && x_raton <= menu[y].right &&
y_raton >= menu[y].up && y_raton <= menu[y].down) {
bpush = y + 1;
Pulso = 1;
}
}
if(Pulso) {
ImprimeBoton2 (0, 7, 56, 63, menu[bpush-1]);
if (sb!=0) Sound_SN("catalog2");
if (raton!=0) activa_raton();
do {
ent.x.ax = 3;
int86(0x33, &ent, &sal); /* lee posici¢n y estados del bot¢n */
boton_izq = sal.x.bx & 1;
boton_der = (sal.x.bx >> 1) & 1;
} while(boton_izq==1 || boton_der==1);
if (raton!=0) desactiva_raton();
ImprimeBoton2 (0, 7, 63, 56, menu[bpush-1]);
} else if (sb!=0) Sound_SN("catalog4");
return Pulso;
}
int PideCodigo(void){
int Devuelve = 0;
char string[15] = "\0";
BorraViewPort(2);
/////// Devolvera 1. Si el c¢digo es correcto.
setcolor(12);
outtextxy( 42 * 8 - 7, 6 * 16 - 16, "C¢digo:" );
setcolor(4);
outtextxy( 328, 79 , "C¢digo:" );
// sprintf(string, "%05ld", Setup.codigo);
InputCadenaG( string, 1, 8, 53, 6, 63, 57);
if( Setup. codigo == atol(string) ) Devuelve = 1;
BorraViewPort(2);
return Devuelve;
}

124
CATALOGO.H Normal file
View File

@ -0,0 +1,124 @@
#ifndef Catalogo
#define Catalogo Jos_David
#define TRUE 1
#define FALSE 0
#define FINDRV 9
#define FINALSOUND 8
extern int x_raton; // En el M¢dulo: Craton.CPP
extern int y_raton; // En el M¢dulo: Craton.CPP
extern int boton_izq; // En el M¢dulo: Craton.CPP
extern int boton_der; // En el M¢dulo: Craton.CPP
int bpush;
int GraphDriver = 9; /* The Graphics device driver */
int GraphMode = 2; /* The Graphics mode value */
int ErrorCode; /* Reports any graphics errors */
char *dir_voc = "123456789012";
char *dir_sfx = "123456789012";
char vieja_dir_sfx[] = "123456789012";
extern int raton; /* Indica si esta instalado el raton (def. NO) */
int PunteroRaton = 0; /* Se deja el puntero de raton original ¨? (def. NO) */
int access = 0; /* Indica si se tiene acceso al menu ppal. (def. NO) */
int sb = 1; /* Indica si esta instalada la SB (def. SI) */
int sb2 = 1;
int NoIniSb = 1;
struct boton {
int left;
int up;
int right;
int down;
};
/* */
/* Prototipos de Funci¢n */
/* */
int PideCodigo(void);
void Initialize(void);
void Menu_Utilidad(void);
void Menu_Principal(void);
void BorraViewPort(int view);
void asigna_modo_video(void);
void Dibuja_Menu_Utilidad(void);
void Dibuja_Menu_Utilidad(void);
void Menu_Mirar(int Mirar_Modificar);
int CheckButon(int nb, struct boton menu[]);
void CheckArg(int nargumentos, char *argumentos[]);
void Sound_SN(char headfile[]);
extern void Info(char *nombrecargado);
extern void Modificar_Comentario(void);
extern void Editar_Modificar(int Mirar_Modificar, int X);
extern void EditarModificarPedidos(void);
// En el M¢dulo: Craton.CPP
extern void inicializa_raton_grafico(int x1, int y1, int x2,
int y2, int px, int py);
extern void desactiva_raton(void);
extern void activa_raton(void);
extern int Inicializa_SB(void);
extern void PlaySound(int Lee);
extern "C" void SOUNDFXDRIVER(int);
// En el M¢dulo: Cgraph.CPP
extern void DibujaPantalla(void);
extern void ImprimeBoton2 (int fill, int cdf, int cs1, int cs2, struct boton parm);
extern void fundido_al_negro(void);
extern int Animacion(void); // En el M¢dulo: Animaci¢n.CPP
void Imprimir_Individual(int x);
extern struct JD {
char esc; char color[8]; char prog[14];
char nl; char rt; char autor[36];
char pt; char ef;
};
extern struct JD cabecera;
extern struct setup {
int version; // uso interno, para versi¢n
long registrado; // registrado ¨ SI o NO ?
char usuario[20]; // registrado a ...
long codigo; // codigo de acceso ­­­ 0 = no c¢digo !!!
char futura_ampliacion[50];
};
extern struct setup Setup;
extern FILE *JD_s; // Fichero Setup
extern char ArchivoSetup[];
extern void lee_setup(void);
extern void Configuracion(void);
extern int InputCadenaG(char *s, int numalp, int lmax, int px, int py, int cc, int cf);
#endif

BIN
CATALOGO.PRJ Normal file

Binary file not shown.

330
CGRAPH.CPP Normal file
View File

@ -0,0 +1,330 @@
///////////////////////////////////////////////////////////////////////////
///// Nombre: Cgraph.cpp ///
///// Modulo: Perteneciente a Catalogo.C ///
//// Descripci¢n: Confecciona la pantalla de inicio ///
//// ///
//// Autor: Jos David Guilln Dominguez ///
//// Fecha: (Unknow) ///
//// ///
//// Compilador Borland C++ 3.0 ( Creaci¢n original en Turbo C 2.0 ) ///
///////////////////////////////////////////////////////////////////////////
#include <graphics.h> // Libreria de Funciones Graficas
#include <dos.h>
extern struct boton {
int left;
int up;
int right;
int down;
};
void fundido_al_negro(void);
void pon_paleta(char *punt, int bandera);
void DibujaPantalla(void);
void DibujaOjo(void);
void DibujaInfo(void);
void DibujaSalir(void);
void ImprimeBoton (int left, int up, int right, int down,
int cdf, int cs1, int cs2);
void ImprimeBoton2 (int fill, int cdf, int cs1, int cs2, struct boton parm);
//void ImprimeBoton2 (struct boton parm);
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* Esta Funci¢n imprimira los botones, pasandole como argumentos la estructura
boton, que define:
Izquierda ( left ) "int"
Arriba ( up )
Derecha ( right ) "int"
Abajo ( down )
Color de Fondo ( cdf ) "int"
Color Sombra 1 ( cs1 ) "int"
Color Sombra 2 ( cs2 ) "int"
Constante de Lugar: ( cdl ) "int"
1 Sombra en ESI
2 Sombra en EII
3 Sombra en ESD
4 Sombra en EID
GENERADOR DE BOTONES INVENCION DEL FUENTE EXCLUSIVA DE Jos David Guilln */
void ImprimeBoton (int left, int up, int right, int down,
int cdf, int cs1, int cs2)
{
int puntos[14];
puntos[0] = left+1; puntos[1] = up-1;
puntos[2] = right+1; puntos[3] = up-1;
puntos[4] = right+1; puntos[5] = down+1;
puntos[6] = (right-2); puntos[7] = (down-2);
puntos[8] = (right-2); puntos[9] = (up+2);
puntos[10] = (left+2); puntos[11] = (up+2);
puntos[12] = left+1; puntos[13] = up-1;
setcolor(cs2);
setfillstyle(SOLID_FILL, cs2);
setlinestyle(0, 1, NORM_WIDTH);
fillpoly(7, puntos);
setcolor(cs1);
setfillstyle(SOLID_FILL, cs1);
setlinestyle(0, 1, NORM_WIDTH);
puntos[0] = left; puntos[1] = up;
puntos[2] = left; puntos[3] = down+1;
puntos[4] = right+1; puntos[5] = down+1;
puntos[6] = (right-2); puntos[7] = (down-2);
puntos[8] = (left+3); puntos[9] = (down-2);
puntos[10] = (left+3); puntos[11] = (up+3);
puntos[12] = left; puntos[13] = up;
fillpoly(7, puntos);
setcolor(cdf);
setfillstyle(SOLID_FILL, cdf);
bar(left+3, up+3, right-3, down-3);
}
void ImprimeBoton2 (int fill, int cdf, int cs1, int cs2, struct boton parm)
{
int puntos[14];
puntos[0] = parm.left+1; puntos[1] = parm.up-1;
puntos[2] = parm.right+1; puntos[3] = parm.up-1;
puntos[4] = parm.right+1; puntos[5] = parm.down+1;
puntos[6] = (parm.right-2); puntos[7] = (parm.down-2);
puntos[8] = (parm.right-2); puntos[9] = (parm.up+2);
puntos[10] = (parm.left+2); puntos[11] = (parm.up+2);
puntos[12] = parm.left+1; puntos[13] = parm.up-1;
setcolor(cs2);
setfillstyle(SOLID_FILL, cs2);
setlinestyle(0, 1, NORM_WIDTH);
fillpoly(7, puntos);
setcolor(cs1);
setfillstyle(SOLID_FILL, cs1);
setlinestyle(0, 1, NORM_WIDTH);
puntos[0] = parm.left; puntos[1] = parm.up;
puntos[2] = parm.left; puntos[3] = parm.down+1;
puntos[4] = parm.right+1; puntos[5] = parm.down+1;
puntos[6] = (parm.right-2); puntos[7] = (parm.down-2);
puntos[8] = (parm.left+3); puntos[9] = (parm.down-2);
puntos[10] = (parm.left+3); puntos[11] = (parm.up+3);
puntos[12] = parm.left; puntos[13] = parm.up;
fillpoly(7, puntos);
if(fill) {
setcolor(cdf);
setfillstyle(SOLID_FILL, cdf);
bar(parm.left+3, parm.up+3, parm.right-3, parm.down-3);
}
}
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* DibujaPantalla confecciona la pantalla de inicio */
void DibujaPantalla(void)
{
int i;
int x = 30;
int y[4] = {30, 150, 270, 390};
char *texto[] = { "Mirar ",
"Utilidades ",
"Informaci¢n",
"Salir "};
setfillstyle(6, 57);
floodfill(0, 0, 1);
ImprimeBoton(20, 20, 170, 100, 7, 63, 56);
ImprimeBoton(20, 140, 170, 220, 7, 63, 56);
ImprimeBoton(20, 260, 170, 340, 7, 63, 56);
ImprimeBoton(20, 380, 170, 460, 7, 63, 56);
setcolor(0);
for(i=0; i<4; i++) {
outtextxy( x, y[i], texto[i]);
outtextxy( x+1, y[i]+6, "-");
}
DibujaOjo();
DibujaInfo();
DibujaSalir();
ImprimeBoton(205, 20, 605, 220, 7, 63, 56);
ImprimeBoton(213, 29, 302, 209, 0, 56, 63); /* 214 29 302 209 */
ImprimeBoton(322, 29, 596, 209, 0, 56, 63);
ImprimeBoton(205, 260, 605, 460, 7, 63, 56);
ImprimeBoton(213, 269, 596, 451, 0, 56, 63); /* 214 269 596 451 */
}
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* Realiza el Dibujo del Ojo */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
void DibujaOjo(void)
{
setcolor(0);
setlinestyle(0, 0, NORM_WIDTH);
ellipse(98, 70, 0, 360, 10, 12);
ellipse(120, 65,0, 360, 12, 10);
setfillstyle(SOLID_FILL, 6);
floodfill(98, 70, 0);
floodfill(120, 65, 0);
setcolor(0);
circle(101, 76, 4);
circle(126, 70, 4);
setfillstyle(SOLID_FILL, 0);
floodfill(101, 76, 0);
floodfill(126, 70, 0);
pieslice(114, 82, 0, 360, 5);
ellipse(116, 88, 185, 360, 15, 5);
}
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* Dibuja la 'I' de Info */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
void DibujaInfo(void)
{
setcolor(0);
setfillstyle(SOLID_FILL, 62);
fillellipse(130, 310, 18, 25);
settextstyle(DEFAULT_FONT, HORIZ_DIR, 3);
outtextxy(119, 300, "i");
settextstyle(DEFAULT_FONT, HORIZ_DIR, 1);
}
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* Dibuja Mi JD */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
/* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */
void DibujaSalir(void)
{
setcolor(56);
setlinestyle(0, 0, THICK_WIDTH);
line(75, 403, 100, 403); /* J */
line(100, 403, 100, 443); /* J */
line(84, 436, 75, 436); /* J */
line(105, 403, 120, 403); /* D */
setcolor(63);
line(75, 404, 75, 414); /* J */
line(75, 414, 90, 414); /* J */
line(90, 414, 90, 438); /* J */
line(75, 437, 75, 448); /* J */
line(105, 403, 105, 456); /* D */
line(105, 456, 120, 456); /* D */
arc(88, 443, 180, 353, 13); /* J */
setlinestyle(0, 0, THICK_WIDTH);
setcolor(56);
setlinestyle(0, 0, THICK_WIDTH);
arc(87, 438, 180, 353, 4); /* J */
setlinestyle(0, 0, THICK_WIDTH);
ellipse(115, 429, 280, 80, 23, 27); /* D */
}
void fundido_al_negro(void)
{
// int OK=0;
typedef union {
struct {
unsigned char rojo, verde, azul;
}color;
unsigned char RGB[3];
}DAC;
typedef DAC DACARRAY[16];
union REGS regs;
struct SREGS sregs;
int m,n;
DACARRAY Buffer; // Array de 16 estructuras de 3
//obtencion de la paleta a travs de la BIOS.
regs.h.ah=0x10;
regs.h.al=0x17;
regs.x.bx=0;
regs.x.cx=16;
regs.x.dx=FP_OFF(Buffer);
sregs.es=FP_SEG(Buffer);
int86x(0x10,&regs,&regs,&sregs);
for(m=0;m<64;m++)
// while(!OK)
{
for(n=0;n<16;n++)
{
if (Buffer[n].RGB[0]>0) { Buffer[n].RGB[0]--; }
if (Buffer[n].RGB[1]>0) { Buffer[n].RGB[1]--; }
if (Buffer[n].RGB[2]>0) { Buffer[n].RGB[2]--; }
// if (Buffer[n].RGB[1]<=0 && Buffer[n].RGB[1]<=0 && Buffer[n].RGB[2]<=0) OK = 1;
}
pon_paleta((char*)Buffer, -1);
delay(15);
} //;
}
void pon_paleta(char *punt, int bandera)
{
struct SREGS seg;
union REGS regs;
unsigned int n;
char far *cPaleta, *dir_pal;
cPaleta=punt;
if(bandera==0){
dir_pal=cPaleta;
for(n=12; n>0; n--) {
*cPaleta=*cPaleta >> 2;
*dir_pal=*cPaleta;
cPaleta++;dir_pal++;
}
}
regs.x.ax = 0x1012;
regs.x.bx = 0;
regs.x.cx = 16;
regs.x.dx = FP_OFF(cPaleta);
seg.es = FP_SEG(cPaleta);
int86x(0x10, &regs, &regs, &seg); // funci¢n para asignar los colores
}

196
CINFO.CPP Normal file
View File

@ -0,0 +1,196 @@
///////////////////////////////////////////////////////////////////////////
///// Nombre: CInfo.CPP ///
///// Modulo: Perteneciente a Catalogo.C ///
//// Descripci¢n: Muestra informaci¢n del sistema.. (CPU, VIDEO...) ///
//// ///
//// Autor: Jos David Guilln Dominguez ///
//// Fecha: 26 - 07 - 1994 ///
//// ///
//// Compilador Borland C++ 3.0 ///
///////////////////////////////////////////////////////////////////////////
#include <dos.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <graphics.h>
void DatosRaton(void);
void printxy(int x, int y, int m, char *texto);
extern int raton; /* Indica si esta instalado el raton (def. NO) */
extern int x_raton; // En el M¢dulo: Craton.CPP
extern int y_raton; // En el M¢dulo: Craton.CPP
extern int boton_izq; // En el M¢dulo: Craton.CPP
extern int boton_der; // En el M¢dulo: Craton.CPP
extern int dir_raton [32+32]; // En el M¢dulo: Craton.CPP
extern int access; /* Indica si se tiene acceso al menu ppal. (def. NO) */
extern void BorraViewPort(int view);
extern void printxy(int x, int y, int m, char *texto);
extern void desactiva_raton(void); // En el M¢dulo: Craton.CPP
extern void activa_raton(void); // En el M¢dulo: Craton.CPP
extern void inicializa_raton_grafico(int x1, // En el M¢dulo: Craton.CPP
int y1, int x2, int y2, int px, int py);
extern int sb2;
void Info(char *nombrecargado)
{
union REGS ent, sal;
int salir;
BorraViewPort( 3);
setcolor(63);
printxy(28, 19, 0, "Programa y versi¢n: CATALOGO v4.0, JùD Anyware");
setcolor( 8);
printxy(29, 39, 1, "P. EXE: ");
printxy(29, 40, 1, "Versi¢n registrada a:");
printxy(29, 42, 1, "Ejecuci¢n de INFO: Interna");
printxy(29, 44, 1, "DOS, enviroment:");
printxy(29, 45, 1, "DOS, memoria:");
printxy(29, 46, 1, "Hardware detectado: CPU: FPU:");
printxy(29, 47, 1, "Raton: ");
printxy(29, 49, 1, "Gr ficos: 640x480 VGA, 16 colores");
printxy(29, 50, 1, "Driver Gr fico: VGA Device Driver (EGAVGA)");
printxy(29, 51, 1, "Chips Gr fico:");
printxy(29, 53, 1, "Salida de sonido digital:");
printxy(29, 55, 1, "Nivel de acceso:");
setcolor( 7);
printxy(37, 39, 1, nombrecargado); // Lugar desde donde fue ejecutado
// el programa.
printxy(51, 40, 1, "Versi¢n PreView"); // Nombre del usuario registrado
// Enviroment del DOS
{
auto int ver;
auto int mayor, menor;
auto char buffer[5];
ver = bdos(0x30, 0, 0);
mayor = ver & 0xFF;
menor = ver >> 8;
sprintf(buffer, "%d.%d", mayor, menor );
printxy(46, 44, 1, buffer);
}
printxy(49, 45, 1, " "); // Memoria reportada por el DOS
/////////////////////////// Hardware detecci¢n ////////////////////////////
printxy(54, 46, 1, " "); // C.P.U.
printxy(71, 46, 1, " "); // F.P.U.
if (raton) DatosRaton(); // Raton
else printxy(36, 47, 1, "Raton no instalado");
if(access) printxy(49, 55, 1, "COMPLETO"); // Nivel de acceso COMPLETO
else printxy(49, 55, 1, "BAJO"); // Nivel de acceso BAJO
if(sb2) printxy(55, 53, 1, "Sound Blaster DETECT");
else printxy(55, 53, 1, "usando Speaker");
salir = 0;
if(raton!=0) {
inicializa_raton_grafico(325, 33, 584, 189, 454, 111);
activa_raton();
}
do {
if (kbhit()) {
getch();
salir = 1;
}
if( raton!=0 && !salir ) {
ent.x.ax = 3;
int86(0x33, &ent, &sal); /* lee posici¢n y estados del bot¢n */
boton_izq = sal.x.bx & 1;
boton_der = (sal.x.bx >> 1) & 1;
if (boton_izq || boton_der) salir = 1;
}
}while (!salir);
desactiva_raton();
BorraViewPort( 3);
if(raton!=0) {
inicializa_raton_grafico(0, 0, 624, 464, 320, 240);
activa_raton();
}
}
void DatosRaton(void)
{
struct SREGS segmento;
union REGS registro;
static char *tipo[]={"Bus","Serie","InPort","PS/2","HP"};
struct {
int status;
int botones;
short verhi,verlo;
short tipo,irq;
} minfo;
registro.x.ax=0;
int86(0x33,&registro,&registro);
minfo.status=registro.x.ax;
minfo.botones=registro.x.bx;
registro.x.ax=0x24;
int86(0x33,&registro,&registro);
minfo.verhi=registro.h.bh; minfo.verlo=registro.h.bl;
minfo.tipo=registro.h.ch-1;
minfo.irq=registro.h.cl;
/////////////////////////////////////////////////////////////////
//////////////////// Muestra datos obtenidos //////////////////
/////////////////////////////////////////////////////////////////
char *string = "buffer de linea";
printxy(36, 47, 1, tipo[minfo.tipo]);
itoa(minfo.verhi, string, 10);
printxy(43, 47, 1, string);
printxy(45, 47, 1, ".");
itoa(minfo.verlo, string, 10);
printxy(46, 47, 1, string);
printxy(48, 47, 1, ", IRQ ");
itoa(minfo.irq, string, 10);
printxy(54, 47, 1, string);
printxy(56, 47, 1, ",");
itoa(minfo.botones, string, 10);
printxy(58, 47, 1, string);
printxy(60, 47, 1, "Botones");
}
void printxy(int x, int y, int m, char *texto)
{
if (m==1) outtextxy( x*8 -7, y*8 - 7, texto); else outtextxy( x*8 - 7, y*16 - 16, texto);
}

310
CMENSAJE.CPP Normal file
View File

@ -0,0 +1,310 @@
//////////////////////////////////////////////////////////////////////////
///// Nombre: CMensaje.CPP ///
///// Modulo: Perteneciente a Catalogo.C ///
//// Descripci¢n: M¢dulo para editar o modificar el mensaje ///
//// ///
//// Autor: Jos David Guilln Dominguez ///
//// Fecha: 30 - 12 - 1994 ///
//// ///
//// Comentario: ///
//// ///
//// ///
//// Compilador Borland C++ 3.0 ///
///////////////////////////////////////////////////////////////////////////
#include <dos.h>
#include <conio.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <graphics.h>
///////////////////////////////////////////////////////////////////////////
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ//
///////////////////////////////////////////////////////////////////////////
extern struct JD {
char esc;
char color[8];
char prog[14];
char nl; char rt;
char autor[36];
char pt; char ef;
};
extern struct caddviewComentario {
int record_zone_init; // Zona de grabaci¢n interna
char linea[10][32 + 1]; // 32 digitos * 10 lineas
};
extern struct JD cabecera;
extern struct caddviewComentario JD_comment;
extern union REGS ent, sal;
///////////////////////////////////////////////////////////////////////////
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ//
///////////////////////////////////////////////////////////////////////////
extern struct boton { int left; int up; int right; int down; };
extern int boton_izq; extern int boton_der;
extern int x_raton; extern int y_raton;
extern int raton;
extern int bpush;
extern int sb;
extern int InputCadenaG(char *s, int numalp, int lmax, int px, int py, int cc, int cf);
extern void inicializa_raton_grafico(int x1, int y1, int x2, int y2, int px, int py);
extern void ImprimeBoton2 (int fill, int cdf, int cs1, int cs2, struct boton parm);
extern int CheckButon(int nb, struct boton menu[]);
extern void Sound_SN(char *headfile);
extern void BorraViewPort(int view);
extern void desactiva_raton(void);
extern void activa_raton(void);
void Modificar_Comentario(void);
extern void EditCursorC(int ShowHide, int y);
void Modificar_Comentario(void){
FILE *JDm_f; // Fichero Mensajes
char ArchivoMensaje[13]="CMensaje.dat";
int LSJ = sizeof(struct JD);
int LSC = sizeof(struct caddviewComentario);
int Linea_c=1, finc = 0, key, i;
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ//
//ÛÛ Comprueba apertura correcta de COMENTARIO o creaci¢n... ÛÛ//
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ//
if ( (JDm_f = fopen( ArchivoMensaje, "r+b"))==NULL) {
FILE *fa;
if ( (fa = fopen( ArchivoMensaje, "wb" ) )!=NULL ) {
auto int i;
JD_comment.record_zone_init = 0; // 0 => disponible para grabaci¢n
// 1 => datos importantes
cabecera.esc = 27;
strcpy(cabecera.color, "[31;40m");
strcpy(cabecera.prog, "Catalogo 4.0");
cabecera.nl = 13; cabecera.rt = 10;
strcpy(cabecera.autor, " Jos David Guilln");
cabecera.pt = 7; cabecera.ef = 26;
rewind(fa);
fwrite(&cabecera, LSJ, 1, fa);
fseek(fa, (long)LSJ, SEEK_SET);
for(i=0; i<10; i++)
strcpy(JD_comment. linea[i], "\0");
fwrite(&JD_comment, LSC, 1, fa);
if (fclose(fa) == EOF ) exit(1);
}
if ( (JDm_f = fopen( ArchivoMensaje, "r+b"))==NULL) {
printf("NO SE PUDO ABRIR EL FICHERO COMENTARIO EN LA 2§ PASADA");
exit(1);
}
}
fseek(JDm_f, (long)LSJ, SEEK_SET);
if ( fread(&JD_comment, LSC, 1, JDm_f) != 1 ) {
printf("NO SE PUDO LEER EL FICHERO COMENTARIO");
exit(1);
}
BorraViewPort(1);
BorraViewPort(2);
BorraViewPort(3);
////////////////////////////// Ahora se abrir  un nuevo men£ para el raton:
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
struct boton comment[4];
comment[0]. left = 217; comment[0]. up = 34; comment[0]. right = 297; comment[0]. down = 75;
comment[1]. left = 217; comment[1]. up = 76; comment[1]. right = 297; comment[1]. down = 117;
comment[2]. left = 217; comment[2]. up = 118; comment[2]. right = 297; comment[2]. down = 159;
comment[3]. left = 217; comment[3]. up = 160; comment[3]. right = 297; comment[3]. down = 204;
for(i=0; i<4; i++) ImprimeBoton2 (1, 7, 63, 56, comment[i]);
setcolor(15);
outtextxy(222, 49 , " Supr. ");
outtextxy(222, 58, " Linea");
outtextxy(222, 96 , " UP ");
outtextxy(222, 138, " DOWN ");
outtextxy(224, 179, "Salir ");
outtextxy(222, 189, " F2");
setcolor(0);
outtextxy(221, 48 , " Supr. ");
outtextxy(221, 57, " Linea");
outtextxy(221, 95 , " UP ");
outtextxy(221, 137, " DOWN ");
outtextxy(223, 178, "Salir ");
outtextxy(221, 188, " F2");
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
setcolor(14);
for(i=0; i<10; i++)
outtextxy( 42 * 8 - 7, (4 + i) * 16 - 16, JD_comment. linea[i]);
do{
EditCursorC(0, Linea_c);
if(raton) activa_raton();
/////////////////////// Aqui va una pausa de TECLADO y RATON al mismo TIEMPO
do{
if(raton){
ent.x.ax = 3;
int86(0x33, &ent, &sal); // lee posici¢n y estados del bot¢n
boton_izq = sal.x.bx & 1;
boton_der = (sal.x.bx >> 1) & 1;
x_raton = sal.x.cx;
y_raton = sal.x.dx;
} else boton_izq = 1;
}while( !boton_izq && !kbhit() );
if(raton) desactiva_raton();
if( kbhit() ) {
////////////////////////////////////////////////////////////////////////
///////////////////////////////////////// ¨ Hay una tecla en buffer ...
key = getch();
EditCursorC(1, Linea_c);
if( isprint(key) || isspace(key) ) {
if(key != 13) ungetch(key);
InputCadenaG( JD_comment. linea[Linea_c - 1], 0, 32, 42, Linea_c + 3, 63, 57);
} else {
if( key == 0 ) {
key = getch();
switch ( key ) {
// DEL --- Borra Linea
case 83:
strcpy(JD_comment. linea[Linea_c - 1], "\0");
break;
// FLECHA ARRIBA
case 72:
Linea_c--;
if (Linea_c < 1) Linea_c = 10;
break;
// FLECHA ABAJO
case 80:
Linea_c++;
if (Linea_c > 10) Linea_c = 1;
break;
// FLECHA IZQUIERDA
case 75:
case 15:
Linea_c--;
if (Linea_c < 1) Linea_c = 10;
break;
// FLECHA DERECHA
case 77:
case 9:
Linea_c++;
if (Linea_c > 10) Linea_c = 1;
break;
// F2 --> PARA SALIR
case 60:
finc = 1;
break;
default:
if (sb) Sound_SN("catalog3");
break;
} // Fin de Swicth
} // Fin Key = 0
} // Fin Is Print Key?
} // Fin Tecla en Buffer
/////////////////////////////////////////////////////////////////////////////
//ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ//
////////////////////////// Comprueba con rat¢n ( SI ) ///////////////////////
//ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß//
/////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////// ... o es el RATON ?
if(raton && boton_izq==1 || boton_der==1) {
if( CheckButon(4, comment) ) {
EditCursorC(1, Linea_c);
switch ( bpush ) {
// Suprimir Linea
case 1:
strcpy(JD_comment. linea[Linea_c - 1], "\0");
break;
// FLECHA ARRIBA
case 72:
Linea_c--;
if (Linea_c < 1) Linea_c = 10;
break;
// FLECHA ABAJO
case 80:
Linea_c++;
if (Linea_c > 10) Linea_c = 1;
break;
// FLECHA IZQUIERDA
case 75:
case 15:
Linea_c--;
if (Linea_c < 1) Linea_c = 10;
break;
// FLECHA DERECHA
case 77:
case 9:
Linea_c++;
if (Linea_c > 10) Linea_c = 1;
break;
// F2 --> PARA SALIR
case 60:
finc = 1;
break;
default:
if (sb) Sound_SN("catalog3");
break;
} // Fin de Swicth
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
}while( !finc );
BorraViewPort(1);
BorraViewPort(2);
BorraViewPort(3);
fseek(JDm_f, (long)LSJ, SEEK_SET);
fwrite(&JD_comment, LSC, 1, JDm_f);
if (fclose(JDm_f) == EOF ) exit(1);
}

993
CPEDIDOS.CPP Normal file
View File

@ -0,0 +1,993 @@
///////////////////////////////////////////////////////////////////////////
//// Nombre: CPedidos.CPP ///
//// Modulo: Perteneciente a Catalogo.CPP ///
//// Descripci¢n: M¢dulo para editar o modificar los pedidos ///
//// enlazados a este m¢dulo por CaddView.CPP ///
//// ///
//// Autor: Jos David Guilln Dominguez ///
//// Fecha: 22 - 12 - 1994 ///
//// ///
//// Comentario: ///
//// ///
//// ///
//// Compilador Borland C++ 3.0 ///
///////////////////////////////////////////////////////////////////////////
#include <dos.h>
#include <conio.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <graphics.h>
///////////////////////////////////////////////////////////////////////////
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ//
///////////////////////////////////////////////////////////////////////////
struct pedidos_descripcion {
unsigned int n_records; // n§ de grabaciones en el fichero
char nombre[24+1]; // Nombre 24 digitos + NULL
char apelli[21+1]; // Apellidos 21 digitos + NULL
char direcc[21+1]; // Direcci¢n 21 digitos + NULL
long telefono; // Telfono 5 digitos permitidos
char cpu[10 + 1]; // C.P.U. 10 digitos + NULL
int ram; // R.A.M 2 digitos permitidos
int hd; // HD. 4 digitos permitidos
};
struct pedidos_datos {
unsigned int record_zone ; int record_name;
char nombre[13+1] ; char zip[3+1] ; int kbytes ;
};
struct pedidos_descripcion JD_dp; // Descripci¢n...
struct pedidos_datos JD_dt; // Datos...
FILE *JD_p; // Fichero Pedidos
// Variables de posici¢n y registro
int CurrRowP, CurrColP;
unsigned int CurrTopLineP;
int CurrRowPD, CurrColPD= 1;
char ArchivoPedidos[]="CPedidos.DAT";
///////////////////////////////////////////////////////////////////////////
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ//
///////////////////////////////////////////////////////////////////////////
extern struct boton { int left; int up; int right; int down; };
extern int boton_izq; extern int boton_der;
extern int x_raton; extern int y_raton;
extern int raton;
extern int bpush;
extern int sb;
extern int InputCadenaG(char *s, int numalp, int lmax, int px, int py, int cc, int cf);
extern void inicializa_raton_grafico(int x1, int y1, int x2, int y2, int px, int py);
extern void ImprimeBoton2 (int fill, int cdf, int cs1, int cs2, struct boton parm);
extern int CheckButon(int nb, struct boton menu[]);
extern void Sound_SN(char *headfile);
extern void BorraViewPort(int view);
extern void desactiva_raton(void);
extern void activa_raton(void);
void EditarModificarPedidos(void);
void EditCursorPD(int ShowHide);
void EditCursorP(int ShowHide);
void PrintLineP(int permiso);
void PrintWholeScreenP(void);
void CreaPresentacion(void);
void DeleteRecordP(void);
void AddRecordP(void);
void EditItemPD(void);
void EditItemP(void);
void MoveDownP(void);
void PutLineP(void);
void GetLineP(void);
void MoveUpP(void);
void Print_in_Printer(void);
void EditarModificarPedidos(void){
union REGS ent, sal;
int finished, key, swap = 1;
CurrRowP = 1; CurrColP = 1; CurrTopLineP = 1;
CurrRowPD= 1;
struct boton menu[11];
menu[0]. left = 217; menu[0]. up = 34; menu[0]. right = 297; menu[0]. down = 65;
menu[1]. left = 217; menu[1]. up = 66; menu[1]. right = 297; menu[1]. down = 97;
menu[2]. left = 217; menu[2]. up = 98; menu[2]. right = 297; menu[2]. down = 129;
menu[3]. left = 217; menu[3]. up = 130; menu[3]. right = 256; menu[3]. down = 149;
menu[4]. left = 258; menu[4]. up = 130; menu[4]. right = 297; menu[4]. down = 149;
menu[5]. left = 217; menu[5]. up = 150; menu[5]. right = 256; menu[5]. down = 171;
menu[6]. left = 258; menu[6]. up = 150; menu[6]. right = 297; menu[6]. down = 171;
menu[7]. left = 217; menu[7]. up = 172; menu[7]. right = 297; menu[7]. down = 204;
menu[8]. left = 325; menu[8]. up = 150; menu[8]. right = 414; menu[8]. down = 204;
menu[9]. left = 415; menu[9]. up = 150; menu[9]. right = 503; menu[9]. down = 204;
menu[10]. left = 504; menu[10]. up = 150; menu[10]. right = 592; menu[10]. down = 204;
CreaPresentacion();
for(auto int i=0; i<11; i++) ImprimeBoton2 (1, 7, 63, 56, menu[i]);
setcolor(15);
outtextxy(222, 50 , "ADD F9 ");
outtextxy(222, 80 , "DEL F10");
outtextxy(223, 107, " SWAP ");
outtextxy(223, 115," F3 ");
outtextxy(222, 136, " UP ");
outtextxy(263, 136, "DOWN");
outtextxy(222, 156, "RePg");
outtextxy(262, 156, "AvPg");
outtextxy(222, 180, "Salir F2");
outtextxy(335, 160, "Imprimir");
outtextxy(335, 170, " F8");
outtextxy(425, 160, "Borrar y");
outtextxy(425, 170, "Salir F7");
/*
outtextxy(506, 130, "Borrar");
outtextxy(506, 140, "");
*/
setcolor(0);
outtextxy(221, 49 , "ADD F9 ");
outtextxy(221, 79 , "DEL F10");
outtextxy(222, 106, " SWAP ");
outtextxy(222, 114," F3 ");
outtextxy(221, 135, " UP ");
outtextxy(262, 135, "DOWN");
outtextxy(221, 155, "RePg");
outtextxy(261, 155, "AvPg");
outtextxy(221, 179, "Salir F2");
outtextxy(334, 159, "Imprimir");
outtextxy(334, 169, " F8");
outtextxy(424, 159, "Borrar y");
outtextxy(424, 169, "Salir F7");
/*
outtextxy(505, 129, "Borrar");
outtextxy(505, 139, "y Salir F6");
*/
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ//
//ÛÛ Comprueba apertura correcta de Pedidos o creaci¢n... ÛÛ//
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ//
if ( (JD_p = fopen( ArchivoPedidos, "r+b"))==NULL) {
FILE *fa;
if ( (fa = fopen( ArchivoPedidos, "wb" ) )!=NULL ) {
JD_dp. n_records = 1;
strcpy(JD_dp. nombre, "\0");
strcpy(JD_dp. apelli, "\0");
strcpy(JD_dp. direcc, "\0");
JD_dp. telefono = 0;
strcpy(JD_dp. cpu, "\0"); JD_dp. ram = 0; JD_dp. hd = 0;
rewind(fa);
fwrite(&JD_dp, sizeof(struct pedidos_descripcion), 1, fa);
JD_dt. record_zone = 0;
strcpy(JD_dt. nombre, "\0");
strcpy(JD_dt. zip, "\0");
JD_dt. kbytes = 0;
fwrite(&JD_dt, sizeof(struct pedidos_datos), 1, fa);
if (fclose(fa) == EOF ) exit(1);
}
if ( (JD_p = fopen( ArchivoPedidos, "r+b"))==NULL) {
printf("NO SE PUDO ABRIR EL FICHERO PEDIDOS EN LA 2§ PASADA");
exit(1);
}
}
if ( fread(&JD_dp, sizeof(struct pedidos_descripcion), 1, JD_p) != 1 ) { // Lee n§ de registros
// Mensaje("No se pudo LEER CPedidos.DAT", 0)
printf("NO SE PUDO LEER EL FICHERO PEDIDOS");
return;
}
setcolor(14);
outtextxy( 50 * 8 - 7, 4 * 16 - 16, JD_dp. nombre );
outtextxy( 53 * 8 - 7, 5 * 16 - 16, JD_dp. apelli );
outtextxy( 53 * 8 - 7, 6 * 16 - 16, JD_dp. direcc );
{ // Bloque abierto para la destrucci¢n prematura del string
auto char string[15];
ltoa(JD_dp. telefono, string, 10);
outtextxy( 52 * 8 - 7, 7 * 16 - 16, string );
outtextxy( 47 * 8 - 7, 8 * 16 - 16, JD_dp. cpu );
itoa(JD_dp. ram, string, 10);
outtextxy( 63 * 8 - 7, 8 * 16 - 16, string );
itoa(JD_dp. hd, string, 10);
outtextxy( 70 * 8 - 7, 8 * 16 - 16, string );
}
PrintWholeScreenP();
GetLineP();
if ( CurrRowP >= 11 ) /* N£mero de lineas DISPONIBLES */
PrintLineP(0);
else PrintLineP(1);
finished = 0;
int borrar_todo = 0;
if(raton) inicializa_raton_grafico(0, 0, 624, 464, 320, 240);
do{
if(swap) EditCursorP(0); else EditCursorPD(0);
if(raton) activa_raton();
/////////////////////// Aqui va una pausa de TECLADO y RATON al mismo TIEMPO
do{
if(raton){
ent.x.ax = 3;
int86(0x33, &ent, &sal); // lee posici¢n y estados del bot¢n
boton_izq = sal.x.bx & 1;
boton_der = (sal.x.bx >> 1) & 1;
x_raton = sal.x.cx;
y_raton = sal.x.dx;
} else boton_izq = 1;
}while( !boton_izq && !kbhit() );
if(raton) desactiva_raton();
if( kbhit() ) {
////////////////////////////////////////////////////////////////////////
///////////////////////////////////////// ¨ Hay una tecla en buffer ...
key = getch();
if(swap) EditCursorP(1); else EditCursorPD(1);
if( isprint(key) || isspace(key) ) {
if(key!=13) ungetch(key);
if(swap) EditItemP(); else EditItemPD();
} else {
if( key == 0 ) {
key = getch();
switch ( key ) {
// INICIO
case 71:
if (swap) CurrColP = 1; else CurrRowPD = 1;
break;
// FIN
case 79:
if (swap) CurrColP = 3; else CurrRowPD = 7;
break;
// FLECHA ARRIBA
case 72:
if (swap) MoveUpP(); else {
CurrRowPD--;
if (CurrRowPD == 0) CurrRowPD = 7;
}
break;
// FLECHA ABAJO
case 80:
if (swap) MoveDownP(); else {
CurrRowPD++;
if (CurrRowPD == 8) CurrRowPD = 1;
}
break;
// FLECHA IZQUIERDA
case 75:
case 15:
if (swap) {
CurrColP--;
if (CurrColP == 0) CurrColP = 3;
} else {
CurrRowPD--;
if (CurrRowPD == 0) CurrRowPD = 7;
}
break;
// FLECHA DERECHA
case 77:
case 9:
if (swap) {
CurrColP++;
if (CurrColP == 4) CurrColP = 1;
} else {
CurrRowPD++;
if (CurrRowPD == 8) CurrRowPD = 1;
}
break;
// F3 ---> SWAP
case 61:
if(swap) swap=0; else swap = 1;
break;
// ReP g
case 73:
if(swap){
CurrRowP = 1;
if(CurrTopLineP >= 20 ) { CurrTopLineP -= 19; } else { CurrTopLineP = 1; }
if(CurrTopLineP < JD_dp.n_records ) { CurrTopLineP = 1; }
PrintWholeScreenP();
GetLineP();
}
break;
// AvP g
case 81:
if (swap) {
CurrRowP = 1;
CurrTopLineP = CurrTopLineP + 19;
if (CurrTopLineP >= JD_dp.n_records)
CurrTopLineP = JD_dp.n_records;
PrintWholeScreenP();
GetLineP();
}
break;
// F2 --> PARA SALIR
case 60:
finished = 1;
break;
// F9 --> A¥ADIR
case 67:
if (swap) AddRecordP();
break;
// F10 -> BORRAR
case 68:
if (swap) DeleteRecordP();
break;
// F8 --> Imprimir
case 66:
Print_in_Printer();
GetLineP();
break;
// F7 --> Reinicializar marcas
case 65:
borrar_todo = 1;
finished = 1;
break;
default:
if (sb) Sound_SN("catalog3");
break;
} // Fin de Swicth
} // Fin Key = 0
} // Fin Is Print Key?
} // Fin Tecla en Buffer
/////////////////////////////////////////////////////////////////////////////
//ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ//
////////////////////////// Comprueba con rat¢n ( SI ) ///////////////////////
//ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß//
/////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////// ... o es el RATON ?
if(raton && boton_izq==1 || boton_der==1) {
if( CheckButon(11, menu) ) {
if(swap) EditCursorP(1); else EditCursorPD(1);
switch ( bpush ) {
// F9 --> A¥ADIR
case 1:
if(swap) AddRecordP();
break;
// F10 -> BORRAR
case 2:
if(swap) DeleteRecordP();
break;
// F3 ---> SWAP
case 3:
if(swap) swap=0; else swap = 1;
break;
// FLECHA ARRIBA
case 4:
if (swap) MoveUpP(); else {
CurrRowPD--;
if (CurrRowPD == 0) CurrRowPD = 7;
}
break;
// FLECHA ABAJO
case 5:
if (swap) MoveDownP(); else {
CurrRowPD++;
if (CurrRowPD == 8) CurrRowPD = 1;
}
break;
// ReP g
case 6:
if(swap){
CurrRowP = 1;
if(CurrTopLineP >= 20 ) { CurrTopLineP -= 19; } else { CurrTopLineP = 1; }
if(CurrTopLineP < JD_dp.n_records ) { CurrTopLineP = 1; }
PrintWholeScreenP();
GetLineP();
}
break;
// AvP g
case 7:
if(swap){
CurrRowP = 1;
CurrTopLineP = CurrTopLineP + 19;
if (CurrTopLineP >= JD_dp.n_records)
CurrTopLineP = JD_dp.n_records;
PrintWholeScreenP();
GetLineP();
}
break;
// F2 --> PARA SALIR
case 8:
finished = 1;
break;
// F8 --> Imprimir
case 9:
Print_in_Printer();
GetLineP();
break;
// F7 --> Reinicializar marcas
case 10:
borrar_todo = 1;
finished = 1;
break;
// BOTON VACIO
case 11:
break;
default:
if (sb) Sound_SN("catalog3");
break;
} // Fin de Swicth
} // fin de check buttons
} // fin ¨ pulsa boton izq. || drch ?
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
}while( !finished );
fclose(JD_p); // Fichero Pedidos
if(borrar_todo) remove(ArchivoPedidos);
BorraViewPort(1);
BorraViewPort(2);
BorraViewPort(3);
} // End Function //
void EditCursorP(int ShowHide) {
int cc, cf, lmax, i, py, pxx, Px;
// registro de color actual y de fondo
// Longitud M xima y contador de bucle
// desviaci¢n vertical y reajuste final
// desviaci¢n horizontal y "" ""
if( CurrRowP >= 11 ){ Px = CurrColP + 3; py = 18 + (CurrRowP) - 10;
} else { Px = CurrColP; py = 18 + (CurrRowP); }
switch (Px) {
case 1: pxx = 28; lmax = 13; break;
case 2: pxx = 42; lmax = 3; break;
case 3: pxx = 46; lmax = 5; break;
case 4: pxx = 52; lmax = 13; break;
case 5: pxx = 66; lmax = 3; break;
case 6: pxx = 70; lmax = 5; break;
default: pxx = 1; lmax = 80; break;
}
if (!ShowHide) { cc = 63; cf = 57; } else { cc = 14; cf = 0; }
setcolor(cf); // pone color de fondo '0' para borrar
for (i=0; i<lmax; i++) // limpia linea -imprimir sobre fondo-
outtextxy( ( pxx + i ) * 8 - 7, py * 16 - 16, "Û");
setcolor(cc); // devuelve el color a su estado
switch (Px) {
case 1:
case 4:
outtextxy( ( pxx ) * 8 - 7, py * 16 - 16, JD_dt.nombre );
break;
case 2:
case 5:
outtextxy( ( pxx ) * 8 - 7, py * 16 - 16, JD_dt.zip );
break;
case 3:
case 6:
char string[6];
sprintf(string, "%5d", JD_dt.kbytes);
// itoa( (JD_dt.kbytes), string, 10 );
outtextxy( ( pxx ) * 8 - 7, py * 16 - 16, string );
break;
default:
outtextxy( ( pxx ) * 8 - 7, py * 16 - 16, "ERROR Modulo SHOW_HIDE-Cursor, secci¢n CADDVIEW, P_CATALOGO");
break;
}
}
void EditCursorPD(int ShowHide) {
int cc, cf, lmax, i, py, pxx, Px;
// registro de color actual y de fondo
// Longitud M xima y contador de bucle
// desviaci¢n vertical y reajuste final
// desviaci¢n horizontal y "" ""
switch (CurrRowPD) {
case 1: pxx = 50; py = 4; lmax = 24; break;
case 2: pxx = 53; py = 5; lmax = 21; break;
case 3: pxx = 53; py = 6; lmax = 21; break;
case 4: pxx = 52; py = 7; lmax = 9; break;
case 5: pxx = 47; py = 8; lmax = 10; break;
case 6: pxx = 63; py = 8; lmax = 2; break;
case 7: pxx = 70; py = 8; lmax = 4; break;
default: pxx = 1; py = 1; lmax = 80; break;
}
if (!ShowHide) { cc = 63; cf = 57; } else { cc = 14; cf = 0; }
setcolor(cf); // pone color de fondo '0' para borrar
for (i=0; i<lmax; i++) // limpia linea -imprimir sobre fondo-
outtextxy( ( pxx + i ) * 8 - 7, py * 16 - 16, "Û");
setcolor(cc); // devuelve el color a su estado
auto char string[15];
switch (CurrRowPD) {
case 1:
outtextxy( 50 * 8 - 7, 4 * 16 - 16, JD_dp. nombre );
break;
case 2:
outtextxy( 53 * 8 - 7, 5 * 16 - 16, JD_dp. apelli );
break;
case 3:
outtextxy( 53 * 8 - 7, 6 * 16 - 16, JD_dp. direcc );
break;
case 4:
ltoa(JD_dp. telefono, string, 10);
outtextxy( 52 * 8 - 7, 7 * 16 - 16, string );
break;
case 5:
outtextxy( 47 * 8 - 7, 8 * 16 - 16, JD_dp. cpu );
break;
case 6:
itoa(JD_dp. ram, string, 10);
outtextxy( 63 * 8 - 7, 8 * 16 - 16, string );
break;
case 7:
itoa(JD_dp. hd, string, 10);
outtextxy( 70 * 8 - 7, 8 * 16 - 16, string );
break;
default:
outtextxy( ( pxx ) * 8 - 7, py * 16 - 16, "ERROR Modulo SHOW_HIDE-Cursor, secci¢n CADDVIEW, P_CATALOGO");
break;
}
}
void EditItemP(void) {
int lmax, pxx, py, Px;
if ( CurrRowP >= 11 ){ Px = CurrColP + 3; py = 18 + (CurrRowP) - 10;
} else { Px = CurrColP; py = 18 + (CurrRowP); }
switch (Px) {
case 1: pxx = 28; lmax = 13; break;
case 2: pxx = 42; lmax = 3; break;
case 3: pxx = 46; lmax = 5; break;
case 4: pxx = 52; lmax = 13; break;
case 5: pxx = 66; lmax = 3; break;
case 6: pxx = 70; lmax = 5; break;
default: pxx = 1; lmax = 80; break;
}
switch (Px) {
case 1:
case 4:
InputCadenaG( JD_dt.nombre, 0, lmax, pxx, py, 63, 57);
break;
case 2:
case 5:
InputCadenaG( JD_dt.zip, 0, lmax, pxx, py, 63, 57);
break;
case 3:
case 6:
char cadena[] = "32766";
itoa( (JD_dt.kbytes), cadena, 10 );
do{
if ( atoi(cadena) < 0 || atoi(cadena) > 32765 ) strcpy(cadena, "0");
InputCadenaG( cadena, 1, lmax, pxx, py, 63, 57);
}while( atoi(cadena) < 0 || atoi(cadena) > 32765);
JD_dt.kbytes = atoi(cadena);
break;
}
PutLineP();
GetLineP();
if ( CurrRowP >= 11 ) PrintLineP(0); else PrintLineP(1);
}
void EditItemPD(void) {
int lmax, pxx, py, Px;
int LSCm = sizeof(struct pedidos_descripcion);
char string[15];
switch (CurrRowPD) {
case 1:
InputCadenaG( JD_dp.nombre, 0, 24, 50, 4, 63, 57);
break;
case 2:
InputCadenaG( JD_dp.apelli, 0, 21, 53, 5, 63, 57);
break;
case 3:
InputCadenaG( JD_dp.direcc, 0, 21, 53, 6, 63, 57);
break;
case 4:
ltoa(JD_dp. telefono, string, 10);
InputCadenaG( string, 1, 9, 52, 7, 63, 57);
JD_dp. telefono = atol(string);
break;
case 5:
InputCadenaG( JD_dp.cpu, 0, 10, 47, 8, 63, 57);
break;
case 6:
itoa(JD_dp. ram, string, 10);
InputCadenaG( string, 1, 2, 63, 8, 63, 57);
JD_dp. ram = atoi(string);
break;
case 7:
itoa(JD_dp. hd, string, 10);
InputCadenaG( string, 1, 4, 70, 8, 63, 57);
JD_dp. hd = atoi(string);
break;
default:
outtextxy( ( 1 ) * 8 - 7, 2 * 16 - 16, "ERROR Modulo SHOW_HIDE-Cursor, secci¢n CADDVIEW, P_CATALOGO");
break;
}
rewind(JD_p);
fwrite(&JD_dp, LSCm, 1, JD_p);
}
void MoveUpP(void) {
if(CurrRowP==1) { if(sb) Sound_SN("catalog3"); } else {
CurrRowP--;
GetLineP();
if ( CurrRowP >= 11 ) PrintLineP(0); else PrintLineP(1);
}
}
void MoveDownP(void) {
if( (CurrRowP + CurrTopLineP - 1) >= (JD_dp. n_records) || CurrRowP == 20 ) { if (sb) Sound_SN("catalog3"); } else {
CurrRowP++;
GetLineP();
if ( CurrRowP >= 11 ) PrintLineP(0); else PrintLineP(1);
}
}
void PrintLineP( int permiso ) {
unsigned int CurrRecord = CurrTopLineP + CurrRowP - 1;
int py, i;
if ( CurrRowP >= 11 ) { py = 18 + (CurrRowP) - 10;
} else { py = 18 + (CurrRowP); }
setcolor(14); // devuelve el color a su estado
if ( CurrRecord <= (JD_dp.n_records) ) {
// | Me preparo para convertir
char kbytes[6]; // | los int a char
// para que puedan ser utilizados
// itoa( JD_dt.kbytes, kbytes, 10); // por outtext y outtextxy...
sprintf(kbytes, "%5d", JD_dt.kbytes);
switch(permiso) {
case 0:
outtextxy( ( 52 ) * 8 - 7, py * 16 - 16, JD_dt.nombre);
outtextxy( ( 66 ) * 8 - 7, py * 16 - 16, JD_dt.zip);
outtextxy( ( 70 ) * 8 - 7, py * 16 - 16, kbytes);
break;
case 1:
outtextxy( ( 28 ) * 8 - 7, py * 16 - 16, JD_dt.nombre);
outtextxy( ( 42 ) * 8 - 7, py * 16 - 16, JD_dt.zip);
outtextxy( ( 46 ) * 8 - 7, py * 16 - 16, kbytes);
break;
default:
outtextxy( ( 1 ) * 8 - 7, py * 16 - 16, "ERROR Modulo PrintLine, secci¢n CADDVIEW, P_CATALOGO _-JD-_");
break;
}
}
}
void DeleteRecordP(void) {
unsigned int CurrRecord;
int LSC = sizeof(struct pedidos_datos);
int LSCm = sizeof(struct pedidos_descripcion);
if (JD_dp. n_records == 1) { if (sb) Sound_SN("catalog5"); } else {
CurrRecord = CurrTopLineP + CurrRowP - 1;
JD_dp. n_records --;
unsigned int p = CurrRecord;
while(p <= JD_dp. n_records) {
fseek(JD_p, (long)LSCm + ( LSC * ( p + 1 ) - LSC ), SEEK_SET); // Se coloca
fread(&JD_dt, LSC, 1, JD_p); // Y lee
fseek(JD_p, (long)LSCm + ( LSC * p - LSC ), SEEK_SET); // Se coloca
fwrite(&JD_dt, LSC, 1, JD_p); // Y escribe
p++;
};
rewind(JD_p);
fwrite(&JD_dp, LSCm, 1, JD_p); // Acualiza n§ de registros
int TmpRow = CurrRowP;
int TmpCol = CurrColP;
PrintWholeScreenP();
CurrRowP = TmpRow; CurrColP = TmpCol;
if ( (CurrRecord = CurrTopLineP + CurrRowP - 1) > JD_dp. n_records ) MoveUpP();
GetLineP();
if ( CurrRowP >= 11 ) PrintLineP(0); else PrintLineP(1);
}
}
void AddRecordP(void){
unsigned int CurrRecord= CurrTopLineP + CurrRowP - 1;
if(CurrRecord < 160) {
int LSC = sizeof(struct pedidos_datos);
int LSCm = sizeof(struct pedidos_descripcion);
unsigned int avance = JD_dp. n_records;
while(avance > CurrRecord) {
fseek(JD_p, (long)LSCm + ( LSC * avance - LSC ), SEEK_SET); // Se coloca
fread(&JD_dt, LSC, 1, JD_p); // Y lee
fseek(JD_p, (long)LSCm + ( LSC * (avance + 1) - LSC ), SEEK_SET); // Se coloca
fwrite(&JD_dt, LSC, 1, JD_p); // Y escribe
avance--;
};
JD_dp. n_records ++;
rewind(JD_p);
fwrite(&JD_dp, LSCm, 1, JD_p); // Acualiza n§ de registros
JD_dt.record_zone = 0;
JD_dt.record_name = 0;
strcpy(JD_dt.nombre, "\0");
strcpy(JD_dt.zip, "\0");
JD_dt.kbytes = 0;
fseek(JD_p, (long)LSCm + ( LSC * ( CurrTopLineP + CurrRowP ) - LSC ), SEEK_SET); // Se coloca
fwrite(&JD_dt, LSC, 1, JD_p); // Y escribe
PrintWholeScreenP();
if ( (CurrRecord = CurrTopLineP + CurrRowP - 1) > JD_dp. n_records ) MoveUpP();
GetLineP();
if ( CurrRowP >= 11 ) PrintLineP(0); else PrintLineP(1);
}
}
void PrintWholeScreenP(void){
int tmp = CurrRowP;
BorraViewPort(3);
for(CurrRowP = 1; CurrRowP < 21; CurrRowP++) {
if ( ( CurrTopLineP + CurrRowP - 1 ) <= JD_dp. n_records ) {
GetLineP();
if ( CurrRowP >= 11 ) PrintLineP(0); else PrintLineP(1);
}
}
CurrRowP = tmp;
}
void PutLineP(void){
unsigned int CurrRecord = CurrTopLineP + CurrRowP - 1;
int LSC = sizeof(struct pedidos_datos);
int LSCm = sizeof(struct pedidos_descripcion);
fseek(JD_p, (long)LSCm + ( LSC * CurrRecord - LSC ), SEEK_SET); // Se coloca
fwrite(&JD_dt, LSC, 1, JD_p); // Y escribe
}
void GetLineP(void){
unsigned int CurrRecord = CurrTopLineP + CurrRowP - 1;
int LSC = sizeof(struct pedidos_datos);
int LSCm = sizeof(struct pedidos_descripcion);
fseek(JD_p, (long)LSCm + ( LSC * CurrRecord - LSC ), SEEK_SET); // Se coloca
fread(&JD_dt, LSC, 1, JD_p); // Y lee
}
void CreaPresentacion(void){
BorraViewPort(2); // Para los mensajes...
setcolor(12);
outtextxy( 42 * 8 - 7, 4 * 16 - 16, "Nombre:" );
outtextxy( 42 * 8 - 7, 5 * 16 - 16, "Apellidos:" );
outtextxy( 42 * 8 - 7, 6 * 16 - 16, "Direcci¢n:" );
outtextxy( 42 * 8 - 7, 7 * 16 - 16, "Telfono:" );
outtextxy( 42 * 8 - 7, 8 * 16 - 16, "CPU:" );
outtextxy( 58 * 8 - 7, 8 * 16 - 16, "RAM:" );
outtextxy( 66 * 8 - 7, 8 * 16 - 16, "HD:" );
setcolor( 4);
// Sistema utilizado para sombra == -1
outtextxy( 328, 47 , "Nombre:" );
outtextxy( 328, 63 , "Apellidos:" );
outtextxy( 328, 79 , "Direcci¢n:" );
outtextxy( 328, 95 , "Telfono:" );
outtextxy( 328, 111 , "CPU:" );
outtextxy( 456, 111 , "RAM:" );
outtextxy( 520, 111 , "HD:" );
}
void Print_in_Printer(void){
unsigned int cont = 0;
int columna = 1, linea = 9;
int LSC = sizeof(struct pedidos_datos);
int LSCm = sizeof(struct pedidos_descripcion);
// char buffer[28];
//////////////////////////////////////////////////////////////////////////////
// Mensaje es la funci¢n que espero incorporar no muy tarde, para mostrar //
// los mensajes, recibiendo como parametros ( 0 espera una tecla ) //
// ( 1 espera 'S' o 'N' ) //
// //
// En el par metro 0, devolvera 1 si se pulsa ESC //
// En el caso del parametro 1, devolvera 1's , 2'n [...] //
// //
//////////////////////////////////////////////////////////////////////////////
// if( !Mensaje("Prepare la impresora y pulse una tecla", 0) ) { //
//////////////////////////////////////////////////////////////////////////////
fprintf(stdprn, "\n\r" );
if (ferror(stdprn)) { clearerr(stdprn);
// Mensaje("Error en el dispositivo PRN", 0)
return;
}
fprintf(stdprn, "Nombre: %s. \n\r", JD_dp. nombre );
fprintf(stdprn, "Apellidos: %s. \n\r", JD_dp. apelli );
fprintf(stdprn, "Direcci¢n: %s. \n\r", JD_dp. direcc );
fprintf(stdprn, "Telfono: %ld. \n\r", JD_dp. telefono );
fprintf(stdprn, "C.P.U.: %-10s ", JD_dp. cpu );
fprintf(stdprn, "R.A.M.: %2.d ", JD_dp. ram );
fprintf(stdprn, "HD: %4d. \n\r\n\r\n\r", JD_dp. hd );
fseek(JD_p, (long)LSCm, SEEK_SET);
while( cont < JD_dp. n_records ) {
fread(&JD_dt, LSC, 1, JD_p);
fprintf(stdprn, "%-13s %-3s %4d ³ ", (JD_dt. nombre), (JD_dt. zip), (JD_dt. kbytes) );
columna ++; if(columna==4) { fprintf(stdprn, "\n\r");
if (ferror(stdprn)) { clearerr(stdprn);
// Mensaje("Error en el dispositivo PRN", 0)
return;
} columna=1; linea ++;
if(linea==60) { fputc(12, stdprn); // Va al principio de
// la p gina siguiente
if (ferror(stdprn)) { clearerr(stdprn);
// Mensaje("Error en el dispositivo PRN", 0)
return;
}
// Mensaje("Inserte un nuevo folio", 0);
linea = 1;
}
}
cont++;
}
fputc(12, stdprn);
// } // Fin Comprueba Mensaje
}

247
CPRINTER.CPP Normal file
View File

@ -0,0 +1,247 @@
///////////////////////////////////////////////////////////////////////////
//// Nombre: CPrinter.CPP ///
//// Modulo: Perteneciente a Catalogo.CPP ///
//// Descripci¢n: M¢dulo para imprimir total o parcialmente todo ///
//// ///
//// Autor: Jos David Guilln Dominguez ///
//// Fecha: 02 - 01 - 1995 ///
//// ///
//// Comentario: ///
//// ///
//// ///
//// Compilador Borland C++ 3.0 ///
///////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <string.h>
extern struct JD { char esc; char color[8]; char prog[14]; char nl;
char rt; char autor[36]; char pt; char ef; };
extern struct caddview_inx { unsigned int Fin[4]; unsigned int FinC; };
extern struct caddview { unsigned int record_zone; int nombre_zona;
char nombre[13+1]; char zip[3+1]; int kbytes; };
extern struct caddviewComentario {
int record_zone_init; // Zona de grabaci¢n interna
char linea[10][32 + 1]; // 32 digitos * 10 lineas
};
// extern struct JD cabecera;
extern struct caddview JD;
extern struct caddview_inx JDn;
extern struct caddviewComentario JD_comment;
extern FILE *JD_f; // Fichero JD
extern void BorraViewPort(int view);
void Select_archivo(int archivo);
void Imprimir_Individual(int x);
void Imprime_Cabecera(int cual);
void Imprime_Seccion(int cual);
void Imprime_Mensaje(void);
int Abre_Lee(void);
extern char ArchivoDatos[13];
int linea = 0;
void Imprimir_Individual(int x) {
int xm = x;
BorraViewPort(1); BorraViewPort(2); BorraViewPort(3);
linea=0;
if( xm == 0 ) {
while(xm<10){
xm++;
Select_archivo(xm);
if( !Abre_Lee() ) {
Imprime_Cabecera(xm);
Imprime_Seccion(xm);
fclose(JD_f);
if(linea>=50) { fputc(12, stdprn);
if (ferror(stdprn)) { clearerr(stdprn); // Mensaje("Error en el dispositivo PRN", 0);
return; }
// Mensaje("Inserte un nuevo folio", 0);
linea = 1;
}
}
}
Imprime_Mensaje();
} else {
Select_archivo(x);
if(Abre_Lee()) { //Mensaje("Secci¢n Vacia", 0);
return; }
Imprime_Cabecera(x);
Imprime_Seccion(x);
fclose(JD_f);
}
fputc(12, stdprn);
}
void Imprime_Cabecera(int cual) {
char *texto[] = { "Juegos ", "M£sica ", "P.Textos",
"Contabil. ", "Electr¢n. ", "Gr ficos",
"Utilidades", "Lenguajes ", "Windows ",
"Varios... " };
fprintf(stdprn, "\n\r\n\r");
if (ferror(stdprn)) { clearerr(stdprn);
// Mensaje("Error en el dispositivo PRN", 0);
return;
}
fprintf(stdprn, "%s", texto[cual-1] );
fprintf(stdprn, "\n\r\n\r");
linea += 3;
}
void Imprime_Seccion(int cual) {
int LSJ = sizeof(struct JD);
int LSI = sizeof(struct caddview_inx);
int LSC = sizeof(struct caddview);
int columna=1, x, Inicio;
switch ( cual ) { case 1: case 2: case 3: case 4: x = cual - 1; break;
case 5: case 6: case 7: case 8: x = cual - 5; break;
case 9: case 10: case 11: case 12: x = cual - 9; break;
default: break; }
if ( x==0 ) Inicio = 0; else Inicio = ( JDn.Fin[ x - 1] + 1 );
fseek(JD_f, (long)LSJ + LSI + ( LSC * Inicio ), SEEK_SET);
while (Inicio <= (JDn.Fin[x]) ) {
fread(&JD, LSC, 1, JD_f);
fprintf(stdprn, "%-13s %-3s %4d ³ ", (JD. nombre), (JD. zip), (JD. kbytes) );
columna ++;
if(columna==4) { fprintf(stdprn, "\n\r");
if (ferror(stdprn)) { clearerr(stdprn); // Mensaje("Error en el dispositivo PRN", 0);
return; }
columna=1; linea++;
if(linea==60) { fputc(12, stdprn); // Va al principio de la p gina siguiente
if (ferror(stdprn)) { clearerr(stdprn); // Mensaje("Error en el dispositivo PRN", 0);
return; }
// Mensaje("Inserte un nuevo folio", 0);
linea = 1;
}
}
Inicio++;
}
}
void Select_archivo(int archivo) {
switch (archivo) {
case 1: case 2: case 3: case 4:
strcpy(ArchivoDatos, "CATALOG1.DAT");
// strcpy(ArchivoComentario, "CATALO11.DAT");
break;
case 5: case 6: case 7: case 8:
strcpy(ArchivoDatos, "CATALOG2.DAT");
// strcpy(ArchivoComentario, "CATALO21.DAT");
break;
case 9: case 10: case 11: case 12:
default:
strcpy(ArchivoDatos, "CATALOG3.DAT");
// strcpy(ArchivoComentario, "CATALO31.DAT");
break;
}
}
int Abre_Lee(void) {
int LSJ = sizeof(struct JD);
int LSI = sizeof(struct caddview_inx);
int LSC = sizeof(struct caddview);
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ//
//ÛÛ Comprueba apertura correcta de Indice, y Datos ÛÛ//
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ//
if ( (JD_f = fopen( ArchivoDatos, "r+b"))==NULL) {
return 1;
} else {
fseek(JD_f, (long)LSJ, SEEK_SET);
if ( fread(&JDn, LSI, 1, JD_f) != 1 ) {
//Mensaje("Error de Lectura", 0);
printf("NO SE PUDO LEER EN EL FICHERO: INDICE");
return 1;
}
fseek(JD_f, (long)LSJ+LSI, SEEK_SET);
if ( fread(&JD, LSC, 1, JD_f) != 1 ) {
//Mensaje("Error de Lectura", 0);
printf("NO SE PUDO LEER EN EL FICHERO: DATOS");
return 1;
}
}
return 0;
}
void Imprime_Mensaje(void) {
FILE *JDm_f; // Fichero Mensajes
char ArchivoMensaje[13]="CMensaje.dat";
int LSJ = sizeof(struct JD);
int LSC = sizeof(struct caddviewComentario);
if ( (JDm_f = fopen( ArchivoMensaje, "r+b"))==NULL) {
// Mensaje("Error de Lectura",0);
printf("NO SE PUDO ABRIR EL FICHERO COMENTARIO EN LA 2§ PASADA");
return;
}
fseek(JDm_f, (long)LSJ, SEEK_SET);
if ( fread(&JD_comment, LSC, 1, JDm_f) != 1 ) {
// Mensaje("Error de Lectura", 0);
printf("NO SE PUDO LEER EL FICHERO COMENTARIO");
return;
}
if(linea<=52) {
fprintf(stdprn, "\n\r");
for(int i=0; i<10; i++) {
fprintf(stdprn, "\n\r");
fprintf(stdprn, " %s", JD_comment. linea[i] );
if (ferror(stdprn)) { clearerr(stdprn);
// Mensaje("Error en el dispositivo PRN", 0);
return;
}
}
}
fclose( JDm_f );
}

167
CRATON.CPP Normal file
View File

@ -0,0 +1,167 @@
///////////////////////////////////////////////////////////////////////////
///// Nombre: Craton.cpp ///
///// Modulo: Perteneciente a Catalogo.C ///
//// Descripci¢n: Utilidades para el manejo del raton ///
//// ///
//// Autor: ( Ver Pc-Mania n§ 20 ) ///
//// Autor puntero del raton: Jos David Guilln Dominguez ///
//// Fecha: ( Desconocida ) ///
//// ///
//// Compilador Borland C++ 3.0 ( Creaci¢n original en Turbo C 2.0 ) ///
///////////////////////////////////////////////////////////////////////////
#include <dos.h>
void desactiva_raton(void);
void activa_raton(void);
void inicializa_raton_grafico(int x1, int y1, int x2, int y2, int px, int py);
int raton=0;
int x_raton;
int y_raton;
int boton_izq;
int boton_der;
extern int PunteroRaton;
int dir_raton [32+32] = {
// 0x3FFF, /*± ± 1 1 1 1 1 1 1 1 1 1 1 1 1 1*/
// 0x1FFF, /*± Û ± 1 1 1 1 1 1 1 1 1 1 1 1 1*/
// 0x0FFF, /*± Û Û ± 1 1 1 1 1 1 1 1 1 1 1 1*/
// 0x07FF, /*± Û Û Û ± 1 1 1 1 1 1 1 1 1 1 1*/
// 0x03FF, /*± Û Û Û Û ± 1 1 1 1 1 1 1 1 1 1*/
// 0x07FF, /*± ± Û Û ± 1 1 1 1 1 1 1 1 1 1 1*/
// 0xC3FF, /*1 1 ± Û Û ± 1 1 1 1 1 1 1 1 1 1*/
0x007F, /*± ± ± ± ± ± ± ± ± 1 1 1 1 1 1 1*/
0x00FF, /*± Û Û Û Û Û Û ± 1 1 1 1 1 1 1 1*/
0x01FF, /*± Û Û Û Û Û ± 1 1 1 1 1 1 1 1 1*/
0x01FF, /*± Û Û Û Û Û ± 1 1 1 1 1 1 1 1 1*/
0x00FF, /*± Û Û Û Û Û Û ± 1 1 1 1 1 1 1 1*/
0x007F, /*± Û Û ± ± Û Û Û ± 1 1 1 1 1 1 1*/
0x18FF, /*± ± ± 1 1 ± Û ± 1 1 1 1 1 1 1 1*/
// 0xFC7F, /*1 1 1 1 1 1 ± Û ± 1 1 1 1 1 1 1*/
// 0xF83F, /*1 1 1 1 1 ± Û Û Û ± 1 1 1 1 1 1*/
// 0xF01F, /*1 1 1 1 ± Û Û Û Û Û ± 1 1 1 1 1*/
// 0xE00F, /*1 1 1 ± Û Û Û Û Û Û Û ± 1 1 1 1*/
// 0xE00F, /*1 1 1 ± ± ± Û Û Û ± ± ± 1 1 1 1*/
// 0xF83F, /*1 1 1 1 1 ± Û Û Û ± 1 1 1 1 1 1*/
// 0xF83F, /*1 1 1 1 1 ± ± ± ± ± 1 1 1 1 1 1*/
0x800F, /*1 ± ± ± ± ± ± ± ± ± ± ± 1 1 1 1*/
0x8083, /*1 ± Û Û Û Û Û ± ± Û Û Û ± ± 1 1*/
0x8001, /*1 ± ± ± ± ± Û ± ± Û ± ± Û ± ± 1*/
0xF810, /*1 1 1 1 1 ± Û ± ± Û ± 1 ± Û ± 1*/
0x8810, /*1 ± ± ± 1 ± Û ± ± Û ± 1 ± Û ± 1*/
0x8811, /*1 ± Û ± 1 ± Û ± ± Û ± 1 ± Û ± 1*/
0x8003, /*1 ± Û ± ± ± Û ± ± Û ± ± Û ± 1 1*/
0x8007, /*1 ± Û Û Û Û Û ± ± Û Û Û ± 1 1 1*/
0x800F, /*1 ± ± ± ± ± ± ± ± ± ± ± 1 1 1 1*/
// 0x0000, /*0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0*/
// 0x4000, /*0 Û 0 0 0 0 0 0 0 0 0 0 0 0 0 0*/
// 0x6000, /*0 Û Û 0 0 0 0 0 0 0 0 0 0 0 0 0*/
// 0x7000, /*0 Û Û Û 0 0 0 0 0 0 0 0 0 0 0 0*/
// 0x7800, /*0 Û Û Û Û 0 0 0 0 0 0 0 0 0 0 0*/
// 0x3000, /*0 0 Û Û 0 0 0 0 0 0 0 0 0 0 0 0*/
// 0x1800, /*0 0 0 Û Û 0 0 0 0 0 0 0 0 0 0 0*/
0x0000, /*0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0*/
0x7E00, /*0 Û Û Û Û Û Û 0 0 0 0 0 0 0 0 0*/
0x7C00, /*0 Û Û Û Û Û 0 0 0 0 0 0 0 0 0 0*/
0x7C00, /*0 Û Û Û Û Û 0 0 0 0 0 0 0 0 0 0*/
0x7E00, /*0 Û Û Û Û Û Û 0 0 0 0 0 0 0 0 0*/
0x6700, /*0 Û Û 0 0 Û Û Û 0 0 0 0 0 0 0 0*/
0x0200, /*0 0 0 0 0 0 Û 0 0 0 0 0 0 0 0 0*/
// 0x0100, /*0 0 0 0 0 0 0 Û 0 0 0 0 0 0 0 0*/
// 0x0380, /*0 0 0 0 0 0 Û Û Û 0 0 0 0 0 0 0*/
// 0x07C0, /*0 0 0 0 0 Û Û Û Û Û 0 0 0 0 0 0*/
// 0x0FE0, /*0 0 0 0 Û Û Û Û Û Û Û 0 0 0 0 0*/
// 0x0380, /*0 0 0 0 0 0 Û Û Û 0 0 0 0 0 0 0*/
// 0x0380, /*0 0 0 0 0 0 Û Û Û 0 0 0 0 0 0 0*/
// 0x0000, /*0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0*/
0x0000, /*0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0*/
0x3E70, /*0 0 Û Û Û Û Û 0 0 Û Û Û 0 0 0 0*/
0x0248, /*0 0 0 0 0 0 Û 0 0 Û 0 0 Û 0 0 0*/
0x0244, /*0 0 0 0 0 0 Û 0 0 Û 0 0 0 Û 0 0*/
0x0242, /*0 0 0 0 0 0 Û 0 0 Û 0 0 0 Û 0 0*/
0x2244, /*0 0 Û 0 0 0 Û 0 0 Û 0 0 0 Û 0 0*/
0x2248, /*0 0 Û 0 0 0 Û 0 0 Û 0 0 Û 0 0 0*/
0x3E70, /*0 0 Û Û Û Û Û 0 0 Û Û Û 0 0 0 0*/
0x0000 /*0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0*/
};
void inicializa_raton_grafico(int x1, int y1, int x2, int y2, int px, int py)
{
struct SREGS seg;
union REGS ent, sal;
long dir;
ent.x.ax = 0;
int86(0x33, &ent, &sal); /* averigua si hay rat¢n conectado */
raton = sal.x.ax; /* indica a la variable global el estado
del raton */
if(raton!=0) {
ent.x.ax = 15;
ent.x.cx = 5;
ent.x.dx = 11;
int86(0x33, &ent, &sal); /* fija la raz¢n mickey/pixel */
ent.x.ax = 7;
ent.x.cx = x1;
ent.x.dx = x2;
int86(0x33, &ent, &sal); /* fija la posici¢n m x. y m¡n. horizontal */
ent.x.ax = 8;
ent.x.cx = y1;
ent.x.dx = y2;
int86(0x33, &ent, &sal); /* fija la posici¢n m x. y m¡n. vertical */
if(!PunteroRaton) {
dir = (long)dir_raton;
ent.x.ax = 9;
ent.x.bx = 0;
ent.x.cx = 0;
ent.x.dx = (int) dir;
seg.es = (int) (dir >> 16);
int86x(0x33, &ent, &sal, &seg); /* asigna un cursor diferente */
}
ent.x.ax = 4;
ent.x.cx = px;
x_raton=ent.x.cx >> 1;
ent.x.dx = py;
y_raton=ent.x.dx;
int86(0x33, &ent, &sal); /* fija la posici¢n del rat¢n */
ent.x.ax = 1;
int86(0x33, &ent, &sal); /* muestra el puntero del rat¢n */
}
}
void activa_raton(void)
{
union REGS ent, sal;
ent.x.ax = 1;
int86(0x33, &ent, &sal);
}
void desactiva_raton(void)
{
union REGS ent, sal;
ent.x.ax = 2;
int86(0x33, &ent, &sal);
}

120
CSTRINGS.CPP Normal file
View File

@ -0,0 +1,120 @@
///////////////////////////////////////////////////////////////////////////
///// Nombre: Cstrings.CPP ///
///// Modulo: Perteneciente a Catalogo.C ///
//// Descripci¢n: Utilidades para el manejo de Strings... ///
//// ///
//// Autor: Jos David Guilln Dominguez ///
//// Fecha: 20 - 07 - 1994 ///
//// ///
//// Compilador Borland C++ 3.0 ///
///////////////////////////////////////////////////////////////////////////
#include <graphics.h>
#include <string.h>
#include <ctype.h>
#include <conio.h>
#include <stdio.h>
extern void Sound_SN(char headfile[]);
extern int sb; /* Indica si esta instalada la SB (def. NO) */
int InputCadenaG(char *s, int numalp, int lmax, int px, int py, int cc, int cf);
int InputCadenaG(char *s, int numalp, int lmax, int px, int py, int cc, int cf)
{
char buf[81]; // Buffer de linea
int ls; // longitud cadena
char *s1; // puntero a cadena inicial
int i, c, ok;
s1 = s; // inicio cadena
setcolor(cf); // pone color a 0 para borrar
for (i=0; i<lmax; i++) // limpia linea para imprimir
outtextxy( ( px + i ) * 8 - 7, py * 16 - 16, "Û");
setcolor(cc); // devuelve el color a su estado
outtextxy( ( px ) * 8 - 7, py * 16 - 16, s );
ls = strlen ( s ); // Longitud de actual
if ( ls < lmax ) {
setcolor(4);
outtextxy( ( px + ls ) * 8 - 7, py * 16 - 16, "þ");
}
s += ls; // se coloca en el final
do{
c = getch(); // obtiene tecla
ok = ( c == 13 || c == 0); // 13 = INTRO || Especiales
if ( c == 8 && ls > 0 && !ok ) { // 8 = Back Space
ls--;
s--;
setcolor(cf);
outtextxy( (px + ls) * 8 - 7, py * 16 - 16, "Û");
if ( ls + 1 < lmax ) outtextxy( ( px + ls + 1 ) * 8 - 7, py * 16 - 16, "Û");
setcolor(4);
outtextxy( (px + ls) * 8 - 7, py * 16 - 16, "þ");
setcolor(cc);
} else {
if ( !numalp && c >= 32 && c <= 254 /* isprint(c) */ && ls < lmax) {
*s++ = c;
ls++;
*s = '\0'; // Cero final
setcolor(cf); // pone color a 0 para borrar
for (i=0; i<lmax; i++) // limpia linea para imprimir
outtextxy( ( px + i ) * 8 - 7, py * 16 - 16, "Û");
setcolor(cc); // devuelve el color a su estado
outtextxy( (px) * 8 - 7, py * 16 - 16, s1 );
if ( ls < lmax ) {
setcolor(4);
outtextxy( ( px + ls ) * 8 - 7, py * 16 - 16, "þ");
}
} else {
if ( numalp && isdigit(c) && ls < lmax) {
*s++ = c;
ls++;
*s = '\0'; // Cero final
setcolor(cf); // pone color a 0 para borrar
for (i=0; i<lmax; i++) // limpia linea para imprimir
outtextxy( ( px + i ) * 8 - 7, py * 16 - 16, "Û");
setcolor(cc); // devuelve el color a su estado
outtextxy( (px) * 8 - 7, py * 16 - 16, s1 );
if ( ls < lmax ) {
setcolor(4);
outtextxy( ( px + ls ) * 8 - 7, py * 16 - 16, "þ");
}
} else if (!ok && sb) Sound_SN("catalog3");
}
}
}while(!ok);
*s = '\0';
while(kbhit()) getch(); // Vacia Buffer impidiendo falsas
// pulsaciones...
return ls;
}

262
C_ANIMAC.CPP Normal file
View File

@ -0,0 +1,262 @@
///////////////////////////////////////////////////////////////////////////
///// Nombre: C_Animac.CPP ///
///// Modulo: Perteneciente a Catalogo.C ///
//// Descripci¢n: Animaci¢n escondida para CATALOGO v4.0 ///
//// ///
//// Autor: Jos David Guilln Dominguez ///
//// Fecha: 23 - 07 - 1994 ///
//// ///
//// Compilador Borland C++ 3.0 ///
///////////////////////////////////////////////////////////////////////////
#include <dos.h>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <graphics.h>
//////////////////////// DECLARACIONES DE FUNCIONES //////////////////////////
int Animacion(void);
extern void BorraViewPort(int view);
extern int sb;
extern int raton;
extern void Sound_SN(char headfile[]);
void lee_ficheros_v(char *j, char *d1, char *d2);
void Lluvia_Dibujo2(char *J);
void Disparos_D_(char *d1, char *d2);
void Disparo(int x, int y, char *d);
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
// ±ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ±
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
int Animacion(void)
{
union REGS ent, sal;
int OK_NO = 1;
char *j; // J[81][116] // |
char *d1; // Disparo1[20][20] // |- Punteros a las imagenes
char *d2; // Disparo2[20][20] // |
if( (j = (char *)malloc(9600)) != NULL) // |
if( (d1 =(char *)malloc(400)) == NULL) // |- Pide memoria para la Animaci¢n
free(j); else // |
if( (d2 =(char *)malloc(400)) == NULL) // |
{ free(j); free(d1); } else { // |
BorraViewPort(2); // Limpia el VIEW PORT
lee_ficheros_v(j, d1, d2); // Lee la J, y los disparos
Lluvia_Dibujo2(j); // Muestra la J, en forma de FASERS
Disparos_D_(d1, d2); // Realiza los disparos de la D
int b_izq;
do{
if(raton){
ent.x.ax = 3;
int86(0x33, &ent, &sal); // lee posici¢n y estados del bot¢n
b_izq = sal.x.bx & 1;
} else b_izq = 0;
}while( !b_izq && !kbhit() );
// FIN, si se pulsa un boton
free(j); // |
free(d1); // |- Libera la memoria asignada
free(d2); // |
OK_NO = 0; // Todo va bien
}
BorraViewPort(2); // Limpia el View Port
return OK_NO; // Devuelve todo va bien=0 o NO=1
}
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
// ±ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ±
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
void lee_ficheros_v(char *j, char *d1, char *d2)
{
long tam=0; // | tama¤o de fichero recorrido
unsigned char byte; // | byte obtenido del fichero
int columnas = 0, filas = 0; // | columnas y filas descomprimidas
int contador; // | contador de descompresi¢n
char *Js; // |
char *D1s; // |-Punteros a las imagenes
char *D2s; // |
Js = j; D1s = d1; D2s = d2;
FILE *dbs; // Corriente al archivo
if((dbs = fopen("CATALOG0.IMG", "rb"))==NULL) {
exit(1);
}
while(!feof(dbs) && filas<=121) {
if(tam>=128) {
columnas=0;
while(columnas<=181) {
byte=(unsigned)getc(dbs);
if(byte<=192) {
/////// J ////////
if (columnas>= 0 && columnas<= 81 && filas>= 0 && filas<=116) *Js++ = byte;
/////// Disparo 1 /////
if (columnas>=89 && columnas<=107 && filas>= 4 && filas<= 21) *D1s++ = byte;
/////// Disparo 2 /////
if (columnas>=89 && columnas<=107 && filas>=30 && filas<= 47) *D2s++ = byte;
columnas++;
} else {
contador=byte&63;
byte=getc(dbs);
for(;contador>0;contador--) {
///// J ////////
if (columnas>= 0 && columnas<= 81 && filas>= 0 && filas<=116) *Js++ = byte;
///// Disparo 1 /////
if (columnas>=89 && columnas<=107 && filas>= 4 && filas<=21) *D1s++ = byte;
///// Disparo 2 /////
if (columnas>=89 && columnas<=107 && filas>=30 && filas<=47) *D2s++ = byte;
columnas++;
}
}
}
filas++;
} else {
getc(dbs);
tam++;
}
}
fclose(dbs);
}
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
// ±ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ±
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
void Lluvia_Dibujo2(char *J) {
int t, i, j;
char *Js;
Js = J;
setcolor(0); setfillstyle(0, 0);
for(i=0; i<=116; i++)
for(j=0; j<=81; j++) {
setcolor( *Js++ );
line(j + 345, i + 40, 40 + 345 /*- j*/, 116 +40);
}
}
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
// ±ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ±
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
void Disparos_D_(char *d1, char *d2){
int i;
int k=0;
for(i=0; i<=5; i++) {
if (k==1) {
Disparo(125 - k, 0 + i*18, d2);
k=0;
if (sb!=0) Sound_SN("catalogD");
} else {
Disparo(125 + k, 0 + i*18, d1);
k=1;
if (sb!=0) Sound_SN("catalogD");
}
delay(50);
}
Disparo(145, 0, d2);
delay(50);
if (sb!=0) Sound_SN("catalogD");
Disparo(161 + 0 * 18, 0 + 0*18, d1);
if (sb!=0) Sound_SN("catalogD");
delay(50);
Disparo(161 + 1 * 18, 0 + 1*18, d1);
if (sb!=0) Sound_SN("catalogD");
delay(50);
Disparo(161 + 2 * 15, 0 + 2*18, d1);
if (sb!=0) Sound_SN("catalogD");
delay(50);
Disparo(161 + 2 * 15, 0 + 3*18, d1);
if (sb!=0) Sound_SN("catalogD");
delay(50);
Disparo(161 + 1 * 18, 0 + 4*18, d1);
if (sb!=0) Sound_SN("catalogD");
delay(50);
Disparo(161 + 0 * 18, 0 + 5*18, d1);
if (sb!=0) Sound_SN("catalogD");
delay(50);
Disparo(143, 0 + 5*18, d1);
if (sb!=0) Sound_SN("catalogE");
delay(50);
}
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
// ±ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ±
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
void Disparo(int x, int y, char *d){
char *Ds;
Ds = d;
x += 335;
y += 40;
for(int y1=0; y1<=17; y1++)
for(int x1=0; x1<=18; x1++)
putpixel(x+ x1, y+ y1, *Ds++);
}

404
C_SETUP.CPP Normal file
View File

@ -0,0 +1,404 @@
///////////////////////////////////////////////////////////////////////////
//// Nombre: C_Setup.CPP ///
//// Modulo: Perteneciente a Catalogo.CPP ///
//// Descripci¢n: M¢dulo para cambiar la configuraci¢n activa. ! ///
//// ///
//// Autor: Jos David Guilln Dominguez '' 999 55555 !! ///
//// Fecha: 02 - 01 - 1995 ' 9 9 5 !!!! ///
//// 9999 5555 !!!! ///
//// Comentario: 9 5 !! ///
//// 9 5 5 !! ///
//// 999 555 ## ///
//// Compilador Borland C++ 3.0 ///
///////////////////////////////////////////////////////////////////////////
#include<graphics.h>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<ctype.h>
#include<dos.h>
extern struct JD {
char esc; char color[8]; char prog[14];
char nl; char rt; char autor[36];
char pt; char ef;
};
extern struct JD cabecera;
struct setup {
int version; // uso interno, para versi¢n
long registrado; // registrado ¨ SI o NO ?
char usuario[20]; // registrado a ...
long codigo; // codigo de acceso ­­­ 0 = no c¢digo !!!
char futura_ampliacion[50];
};
struct setup Setup;
FILE *JD_s; // Fichero Setup
char ArchivoSetup[] = "Catalogo.cfg";
extern union REGS ent, sal;
extern struct boton { int left; int up; int right; int down; };
extern int boton_izq; extern int boton_der;
extern int x_raton; extern int y_raton;
extern int raton;
extern int bpush;
extern int sb;
extern int InputCadenaG(char *s, int numalp, int lmax, int px, int py, int cc, int cf);
extern void inicializa_raton_grafico(int x1, int y1, int x2, int y2, int px, int py);
extern void ImprimeBoton2 (int fill, int cdf, int cs1, int cs2, struct boton parm);
extern int CheckButon(int nb, struct boton menu[]);
extern void Sound_SN(char *headfile);
extern void BorraViewPort(int view);
extern void desactiva_raton(void);
extern void activa_raton(void);
void EditCursorS(int ShowHide, int Linea);
void Input_command(void);
void CreaPresentacionSetup(void);
void lee_setup(void);
void Configuracion(void);
int Linea_c=1;
void Configuracion(void){
lee_setup();
////////////////////////////// Translaci¢n de funciones a ViewPort #2
int i, key;
int finc = 0;
////////////////////////////// Ahora se abrir  un nuevo men£ para el raton:
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
struct boton comment[4];
comment[0]. left = 217; comment[0]. up = 34; comment[0]. right = 297; comment[0]. down = 75;
comment[1]. left = 217; comment[1]. up = 76; comment[1]. right = 297; comment[1]. down = 117;
comment[2]. left = 217; comment[2]. up = 118; comment[2]. right = 297; comment[2]. down = 159;
comment[3]. left = 217; comment[3]. up = 160; comment[3]. right = 297; comment[3]. down = 204;
for(i=0; i<4; i++) ImprimeBoton2 (1, 7, 63, 56, comment[i]);
setcolor(15);
// outtextxy(222, 49 , " Supr. ");
// outtextxy(222, 58, " Linea");
outtextxy(222, 96 , " UP ");
outtextxy(222, 138, " DOWN ");
outtextxy(224, 179, "Salir ");
outtextxy(222, 189, " F2");
setcolor(0);
// outtextxy(221, 48 , " Supr. ");
// outtextxy(221, 57, " Linea");
outtextxy(221, 95 , " UP ");
outtextxy(221, 137, " DOWN ");
outtextxy(223, 178, "Salir ");
outtextxy(221, 188, " F2");
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
/*
Setup.version = 40;
Setup.registrado = 0;
strcpy(Setup.usuario, "NONE");
Setup.codigo = 0;
*/
CreaPresentacionSetup();
setcolor(14);
outtextxy( 50 * 8 - 7, 4 * 16 - 16, Setup. usuario );
char string[15];
sprintf(string, "%05ld", Setup.codigo);
outtextxy( 53 * 8 - 7, 6 * 16 - 16, string );
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
do{
EditCursorS(0, Linea_c);
if(raton) inicializa_raton_grafico(0, 0, 624, 464, 320, 240);
if(raton) activa_raton();
/////////////////////// Aqui va una pausa de TECLADO y RATON al mismo TIEMPO
do{
if(raton){
ent.x.ax = 3;
int86(0x33, &ent, &sal); // lee posici¢n y estados del bot¢n
boton_izq = sal.x.bx & 1;
boton_der = (sal.x.bx >> 1) & 1;
x_raton = sal.x.cx;
y_raton = sal.x.dx;
} else boton_izq = 1;
}while( !boton_izq && !kbhit() );
if(raton) desactiva_raton();
if( kbhit() ) {
////////////////////////////////////////////////////////////////////////
///////////////////////////////////////// ¨ Hay una tecla en buffer ...
key = getch();
EditCursorS(1, Linea_c);
if( isprint(key) || isspace(key) ) {
if(key != 13) ungetch(key);
Input_command();
} else {
if( key == 0 ) {
key = getch();
switch ( key ) {
// FLECHA ARRIBA
case 72:
// FLECHA IZQUIERDA
case 75:
case 15:
Linea_c--;
if (Linea_c < 1) Linea_c = 2;
break;
// FLECHA ABAJO
case 80:
// FLECHA DERECHA
case 77:
case 9:
Linea_c++;
if (Linea_c > 2) Linea_c = 1;
break;
// F2 --> PARA SALIR
case 60: finc = 1; break;
default:
if (sb) Sound_SN("catalog3");
break;
} // Fin de Swicth
} // Fin Key = 0
} // Fin Is Print Key?
} // Fin Tecla en Buffer
/////////////////////////////////////////////////////////////////////////////
//ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ//
////////////////////////// Comprueba con rat¢n ( SI ) ///////////////////////
//ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß//
/////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////// ... o es el RATON ?
if(raton && boton_izq==1 || boton_der==1) {
if( CheckButon(4, comment) ) {
EditCursorS(1, Linea_c);
switch ( bpush ) {
// FLECHA ARRIBA
case 2:
// FLECHA IZQUIERDA
Linea_c--;
if (Linea_c < 1) Linea_c = 2;
break;
// FLECHA ABAJO
case 3:
// FLECHA DERECHA
Linea_c++;
if (Linea_c > 2) Linea_c = 1;
break;
// F2 --> PARA SALIR
case 4: finc = 1; break;
default:
if (sb) Sound_SN("catalog3");
break;
} // Fin de Swicth
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
}while( !finc );
int LSJ = sizeof(struct JD);
int LSI = sizeof(struct setup);
fseek(JD_s, (long)LSJ, SEEK_SET);
fwrite(&Setup, LSI, 1, JD_s);
if (fclose(JD_s) == EOF ) exit(1);
}
void lee_setup(void){
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ//
//ÛÛ Comprueba apertura correcta de Configuracion o creaci¢n... ÛÛ//
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ//
int LSJ = sizeof(struct JD);
int LSI = sizeof(struct setup);
if ( (JD_s = fopen( ArchivoSetup, "r+b"))==NULL) {
FILE *fa;
auto int i;
if ( (fa = fopen( ArchivoSetup, "wb" ) )!=NULL ) {
cabecera.esc = 27;
strcpy(cabecera.color, "[31;40m");
strcpy(cabecera.prog, "Catalogo 4.0");
cabecera.nl = 13; cabecera.rt = 10;
strcpy(cabecera.autor, " Jos David Guilln");
cabecera.pt = 7; cabecera.ef = 26;
////// ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //////
//ÛÛ// //ÛÛ//
//ÛÛ// Incluir informaci¢n de SETUP... //ÛÛ//
//ÛÛ// //ÛÛ//
////// ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ //////
Setup.version = 40;
Setup.registrado = 0;
strcpy(Setup.usuario, "NONE");
Setup.codigo = 0;
strcpy(Setup.futura_ampliacion, "Futura Ampliaci¢n");
rewind(fa);
fwrite(&cabecera, LSJ, 1, fa);
fseek(fa, (long)LSJ, SEEK_SET);
fwrite(&Setup, LSI, 1, fa);
if (fclose(fa) == EOF ) exit(1);
}
if ( (JD_s = fopen( ArchivoSetup, "r+b"))==NULL) {
printf("NO SE PUDO ABRIR EL FICHERO SETUP EN LA 2§ PASADA");
exit(1);
}
}
fseek(JD_s, (long)LSJ, SEEK_SET);
if ( fread(&Setup, LSI, 1, JD_s) != 1 ) {
printf("NO SE PUDO LEER EN EL FICHERO: INDICE");
exit(1);
}
}
void CreaPresentacionSetup(void){
BorraViewPort(2); // Para los mensajes...
BorraViewPort(3); // Para los mensajes...
BorraViewPort(4); // Para los mensajes...
setcolor(12);
outtextxy( 42 * 8 - 7, 4 * 16 - 16, "Nombre:" );
// outtextxy( 42 * 8 - 7, 5 * 16 - 16, "Apellidos:" );
outtextxy( 42 * 8 - 7, 6 * 16 - 16, "C¢digo:" );
// outtextxy( 42 * 8 - 7, 7 * 16 - 16, "Telfono:" );
// outtextxy( 42 * 8 - 7, 8 * 16 - 16, "CPU:" );
// outtextxy( 58 * 8 - 7, 8 * 16 - 16, "RAM:" );
// outtextxy( 66 * 8 - 7, 8 * 16 - 16, "HD:" );
setcolor( 4);
// Sistema utilizado para sombra == -1
outtextxy( 328, 47 , "Nombre:" );
// outtextxy( 328, 63 , "Apellidos:" );
outtextxy( 328, 79 , "C¢digo:" );
// outtextxy( 328, 95 , "Telfono:" );
// outtextxy( 328, 111 , "CPU:" );
// outtextxy( 456, 111 , "RAM:" );
// outtextxy( 520, 111 , "HD:" );
}
void Input_command(void){
switch(Linea_c) {
case 1: InputCadenaG( Setup. usuario, 0, 19, 50, 4, 63, 57); break;
case 2:
char string[15];
sprintf(string, "%05ld", Setup.codigo);
InputCadenaG( string, 1, 8, 53, 6, 63, 57);
Setup. codigo = atol(string);
break;
}
}
void EditCursorS(int ShowHide, int Linea) {
int cc, cf, lmax, i, py, pxx;
// registro de color actual y de fondo
// Longitud M xima y contador de bucle
// desviaci¢n vertical y reajuste final
// desviaci¢n horizontal y "" ""
if(Linea==1) { lmax = 19;
py = 4;
pxx = 50;
} else {
lmax = 8;
py = 6;
pxx = 53;
}
if (!ShowHide) { cc = 63; cf = 57; } else { cc = 14; cf = 0; }
setcolor(cf); // pone color de fondo '0' para borrar
for (i=0; i<lmax; i++) // limpia linea -imprimir sobre fondo-
outtextxy( ( pxx + i ) * 8 - 7, py * 16 - 16, "Û");
setcolor(cc); // devuelve el color a su estado
switch (Linea) {
case 1:
outtextxy( ( pxx ) * 8 - 7, py * 16 - 16, Setup. usuario );
break;
case 2:
char string[15];
sprintf(string, "%05ld", Setup.codigo);
outtextxy( ( pxx ) * 8 - 7, py * 16 - 16, string );
break;
default:
outtextxy( ( pxx ) * 8 - 7, py * 16 - 16, "ERROR Modulo SHOW_HIDE-Cursor, secci¢n C_SETUP, P_CATALOGO");
break;
}
}

BIN
JD000001.IMG Normal file

Binary file not shown.

166
LEE_PCX.CPP Normal file
View File

@ -0,0 +1,166 @@
#include <dos.h> /* cabeceras que hacen que se incluyan */
#include <alloc.h>
#include <conio.h> /* durante el proceso de compilado */
#include <stdio.h> /* las funciones que el programa utilize */
#include <stdlib.h>
#include <string.h>
int leepcx(char dibujo[80]);
int asigna_memoria_pcx(void); /* se usar n en el programa. Se indica el */
void libera_memoria_pcx(void); /* tipo de dato que devuelven y el tipo */
int lee_dibujo_pcx(void); /* de dato/s que necesitan que se les */
int comprueba_dibujo(void); /* pase para funcionar. */
void descomprime_dibujo(void);
void asigna_rgb(void);
extern "C" void VUELCA_PANTALLA(unsigned char *);
/*************************** VARIABLES GLOBALES ****************************/
unsigned char *dir_planos;
unsigned char *dir_dibujo;
char dibujo[80];
char bits_pixel;
char num_planos;
int colores[16] = { 0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63 };
int ancho;
int alto;
int tecla;
FILE *handle_dibujo;
/************************** COMIENZO DEL LISTADO ***************************/
int leepcx(char diu[80])
{
strcpy(dibujo, diu);
if(asigna_memoria_pcx()==1){ /* reserva memoria al dibujo */
if(lee_dibujo_pcx()==1) { /* lee el dibujo del disco */
if(comprueba_dibujo()==1){ /* ve si formato es adecuado */
descomprime_dibujo(); /* descomprime el dibujo */
VUELCA_PANTALLA(dir_planos); /* visualiza el dibujo */
} else {
libera_memoria_pcx();
return 0;
}
} else {
libera_memoria_pcx();
return 0;
}
libera_memoria_pcx(); /* devuelve la memoria al prg*/
return 1;
}
return 0;
} /* vuelve al Programa */
int asigna_memoria_pcx(void) /* reserva memoria para cargar el dibujo */
{
if((dir_dibujo=(unsigned char *)farmalloc(153600))==NULL) {
return 0;
}
if((dir_planos=(unsigned char *)farmalloc(153600))==NULL) {
return 0;
}
return 1;
}
void libera_memoria_pcx(void) /* libera la memoria asignada al DOS */
{
farfree(dir_dibujo);
farfree(dir_planos);
}
int lee_dibujo_pcx(void)
{
int *dir_dibu;
char huge *dir;
if((handle_dibujo=fopen(dibujo, "rb"))==NULL) {
return 0;
}
dir=(char huge *)dir_dibujo;
while(!feof(handle_dibujo)) { *dir++=getc(handle_dibujo); }
if(fclose(handle_dibujo)!=NULL) {
return 0;
}
dir_dibu=(int *)dir_dibujo;
bits_pixel=*(dir_dibujo+3);
num_planos=*(dir_dibujo+65);
ancho=1+(*(dir_dibu+4));
alto =1+(*(dir_dibu+5));
return 1;
}
int comprueba_dibujo(void)
{
if(*dir_dibujo!=10) {
return 0;
}
if(bits_pixel!=1 || num_planos!=4) { /* comprueba que el */
return 0;
}
if(ancho>640 || alto>480) { /* comp. el tama¤o */
return 0;
}
return 1;
}
void descomprime_dibujo(void)
{
unsigned char huge *dir_lectura;
unsigned char huge *dir_escritura;
unsigned char byte;
int columnas, filas, contador;
dir_lectura =dir_dibujo+128; /* inicio del dibujo comprimido */
dir_escritura=dir_planos;
for(filas=alto; filas>0; filas--) {
columnas=ancho/2;
while(columnas>0) {
byte=*dir_lectura++;
if(byte<=192) { *dir_escritura++=byte; columnas--; }
else {
contador=byte&0x3F; byte=*dir_lectura++;
for(; contador>0; contador--) {
*dir_escritura++=byte; columnas--;
}
}
}
}
asigna_rgb();
}
void asigna_rgb(void)
{
struct SREGS seg;
union REGS ent, sal;
int num_color, n;
long int dir;
unsigned char *dir_col;
dir_col=dir_dibujo+16; /* divide entre 4 */
for(n=16*3; n>0; n--) { /* los colores */
*dir_col=(*dir_col) >> 2; dir_col++;
}
dir =(long)(dir_dibujo+16); /* obtiene el segmento */
seg.es=(int) (dir >> 16); /* donde estan los colores */
for(n=0; n<16; n++) {
num_color=colores[n];
ent.h.al = 18;
ent.h.ah = 16;
ent.x.bx = num_color;
ent.x.cx = 1;
ent.x.dx = (int)dir; /* offset de los colores */
int86x(0x10, &ent, &sal, &seg); /* funci¢n para asignar los colores */
dir+=3;
}
}

72
L_PCX.ASM Normal file
View File

@ -0,0 +1,72 @@
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
PUBLIC _VUELCA_PANTALLA
_VUELCA_PANTALLA PROC NEAR
PUSH BP
MOV BP,SP
PUSH AX
PUSH BX
PUSH CX
PUSH DI
PUSH DS
PUSH DX
PUSH ES
PUSH SI
LDS SI,[BP+4]
MOV AX,0A000h
MOV ES,AX
MOV DI,0
MOV AH,00010001b
MOV DX,480
CLD
SIG_LINEA: MOV BX,4
SON_4_PLANOS: PUSH AX
PUSH DX
MOV DX,3C4H ;MASCARA DE PLANOS
MOV AL,2
OUT DX,AX
POP DX
POP AX
MOV CX,80
LINEA: MOV AL,ES:[DI]
MOVSB
CMP SI,0
JNZ MISMO_SEG
MOV BP,DS
ADD BP,1000h
MOV DS,BP
MISMO_SEG: LOOP LINEA
SUB DI,80
ROL AH,1
DEC BX
JNZ SON_4_PLANOS
ADD DI,80
DEC DX
JNZ SIG_LINEA
POP SI
POP ES
POP DX
POP DS
POP DI
POP CX
POP BX
POP AX
POP BP
RET
_VUELCA_PANTALLA ENDP
_TEXT ENDS
END


98
SONIDO.ASM Normal file
View File

@ -0,0 +1,98 @@
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
DIR_VOC DD 0
DIR_SFXDRV DD 0
;------------------------------------------------------------------------------;
; INICIALIZACION DEL SFX DRIVER ;
;------------------------------------------------------------------------------;
; entrada: BX = n§ de la funci¢n ;
; ES:DI = dir. de la variable word de estado ;
; [CS:DIR_SFXDRV] = dir. de la rutina ct-voice ;
; ;
; salida: AX = 0 si la tarjeta de sonido est  instalada ;
; = -1 si no hay tarjeta de sonido ;
;------------------------------------------------------------------------------;
PUBLIC _INICIALIZADRV
_INICIALIZADRV PROC NEAR
PUSH BP
MOV BP,SP
PUSH BX
PUSH DI
PUSH ES
LES DI,[BP+4]
MOV WORD PTR CS:[DIR_SFXDRV],DI
MOV WORD PTR CS:[DIR_SFXDRV+2],ES
MOV BX,3
CALL DWORD PTR CS:[DIR_SFXDRV]
CMP AX,0
JNZ NO_HAY_TARJ
MOV BX,5
LES DI,[BP+8]
CALL DWORD PTR CS:[DIR_SFXDRV]
XOR AX,AX
NO_HAY_TARJ: POP ES
POP DI
POP BX
POP BP
RET
_INICIALIZADRV ENDP
;------------------------------------------------------------------------------;
; ELIGE UN FICHERO DE SONIDO ;
;------------------------------------------------------------------------------;
; entrada: ES:DI = dir. del fichero de sonido .VOC ;
;------------------------------------------------------------------------------;
PUBLIC _ELIGEFICHFX
_ELIGEFICHFX PROC NEAR
PUSH BP
MOV BP,SP
PUSH DI
PUSH ES
LES DI,[BP+4]
MOV WORD PTR CS:[DIR_VOC],DI
MOV WORD PTR CS:[DIR_VOC+2],ES
POP ES
POP DI
POP BP
RET
_ELIGEFICHFX ENDP
;------------------------------------------------------------------------------;
; LLAMADA AL CT-SOUND DRIVER ;
;------------------------------------------------------------------------------;
; entrada: BX = n§ de la funci¢n ;
; ES:DI = dir. del fichero de sonido .VOC ;
; [CS:DIR_SFXDRV] = dir. de la rutina ct-voice ;
;------------------------------------------------------------------------------;
PUBLIC _SOUNDFXDRIVER
_SOUNDFXDRIVER PROC NEAR
PUSH BP
MOV BP,SP
PUSH BX
PUSH DI
PUSH ES
MOV BX,[BP+4]
LES DI,CS:[DIR_VOC]
CMP BX,6
JNE NO_INI
ADD DI,ES:[DI+14h] ;ES:DI=dir. del data block
NO_INI: CALL DWORD PTR CS:[DIR_SFXDRV]
POP ES
POP DI
POP BX
POP BP
RET
_SOUNDFXDRIVER ENDP
_TEXT ENDS
END

156
SONIDOP.CPP Normal file
View File

@ -0,0 +1,156 @@
//////////////////////////////////////////////////////////////////////////////
// PROGRAMACION DEL CANAL DE SONIDO DE LA SOUND BLASTER //
// //
// por: Jos Antonio Acedo Mart¡n-Grande, miembro de "GOLDY GAMES" //
// //
// TEL: (91) 6 11 72 71 (MADRID) //
//////////////////////////////////////////////////////////////////////////////
// //
// ADAPTACION PARA CATALOGO POR Jos David Guilln //
// JD... Fv //
///////////////////////////// FICHEROS A INCLUIR ////////////////////////////
#include <dos.h>
#include <bios.h>
#include <stdio.h>
#include <alloc.h>
#include <stdlib.h>
//////////////////////////////// DEFINICIONES ////////////////////////////////
#define INICIFX 0x17
#define FINALFX 0x21
#define PAUSAFX 0x19
#define CONTIFX 0x2E
#define INICISOUND 6
#define FINALSOUND 8
#define PAUSASOUND 10
#define CONTISOUND 11
#define FINDRV 9
#define TAMSFXDRV 5000
#define TAMVOC 70000L
//////////////////////// DECLARACIONES DE FUNCIONES //////////////////////////
volatile int statusw=0; //palabra de estado del sonido FX
char sfxdriver[TAMSFXDRV]; //debe ser 16 bytes mayor que el driver
char *dir_sfxdriver;
extern char *dir_voc;
extern char *dir_sfx;
extern int sb;
extern "C" int INICIALIZADRV(char *, volatile int *);
extern "C" void ELIGEFICHFX(char *);
extern "C" void SOUNDFXDRIVER(int);
int lee_ficheros(char *, char *, long);
int asigna_memoria(void);
void libera_memoria(void);
void sin_memoria(void);
void fichero_enorme(void);
int Inicializa_SB(void);
void PlaySound(int Lee);
////////////////////////////////// PROGRAMA //////////////////////////////////
int Inicializa_SB(void)
{
int sonido = 1;
// dir_sfx=argv[1];
if ( asigna_memoria() ) return (sonido = 0);
if( lee_ficheros( "CATALOG0.drv", dir_sfxdriver, TAMSFXDRV) == 0) sonido = 0;
else {
if(INICIALIZADRV(dir_sfxdriver, &statusw)!=NULL) sonido = 0;
}
if (sonido == 0) farfree(dir_voc);
return sonido;
}
void PlaySound(int Lee){
SOUNDFXDRIVER(FINALSOUND);
if(Lee) {
if( lee_ficheros(dir_sfx, dir_voc, TAMVOC) == 1 )
ELIGEFICHFX(dir_voc);
}
SOUNDFXDRIVER(INICISOUND);
}
void fichero_enorme(void)
{
libera_memoria();
printf("El fichero VOC no puede ser mayor de %ld bytes.", TAMVOC);
exit(1);
}
int asigna_memoria(void)
{
long dir, des_dir, seg_dir;
if((dir_voc =(char *)farmalloc (80000L))==NULL) return 1;
dir_sfxdriver=sfxdriver;
dir=(long)dir_sfxdriver;
des_dir=dir & 0x0000FFFF;
seg_dir=dir & 0xFFFF0000;
des_dir=(des_dir+16) >> 4;
(long)dir_sfxdriver=seg_dir+(des_dir << 16);
return 0;
}
void libera_memoria(void)
{
farfree(dir_voc);
}
void sin_memoria(void)
{
libera_memoria();
printf("No hay suficiente memoria. Libere programas residentes.");
exit(1);
}
int lee_ficheros(char *file, char *dir_carga, long tam_fichero)
{
FILE *handle_sonido;
char *p;
long tam=0;
if((handle_sonido = fopen(file, "rb"))==NULL) {
if(file=="CATALOG0.drv") { sb = 0; return 0; }
if(file==dir_sfx) return 0;
return 0;
}
p=dir_carga;
while(!feof(handle_sonido)) {
*p=getc(handle_sonido);
(long)p++; tam++;
if(tam > tam_fichero) fichero_enorme();
}
fclose(handle_sonido);
return 1;
}