1000 lines
28 KiB
C++
1000 lines
28 KiB
C++
#include "..\cd_file.h"
|
||
|
||
#define DOS 1
|
||
#define WINDOWS 2
|
||
|
||
|
||
//////////////////////////////////////////////////////////////////////////////
|
||
//////////////////////////////////////////////////////////////////////////////
|
||
/*****/ void Abre_Ficha_CD_in(void); /*****/
|
||
/*****/ void GetLineCD_in(void); /*****/
|
||
/*****/ FILE *CD_in; /*****/
|
||
//////////////////////////////////////////////////////////////////////////////
|
||
//////////////////////////////////////////////////////////////////////////////
|
||
CD_FILE CD_in1;
|
||
struct Cabecera CD_cabecera;
|
||
|
||
|
||
int Items_for = DOS;
|
||
int Item_select = 1;
|
||
int CurrTopLineCD_in = 1; int CurrRowCD_in = 1;
|
||
int CurrColCD_in = 1;
|
||
|
||
void main(int argc, char *argv[]){
|
||
int ok = 0, key;
|
||
|
||
int Curr_Item = 1;
|
||
|
||
printf("\nJD Soft...\n");
|
||
printf("\nAbriendo fichero de datos...");
|
||
Inicializa_Apertura(argv[1]);
|
||
printf(" OK!\n");
|
||
printf("Ordenando... ");
|
||
Sort();
|
||
printf(" OK!\n");
|
||
|
||
|
||
|
||
}
|
||
|
||
fclose(CD_in);
|
||
return;
|
||
}
|
||
|
||
|
||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||
//Û Û
|
||
//Û ÜÜ ÜÜÜ ÜÜÜ ÜÜÜ ÜÜÜÜÜ Ü Ü ÜÜÜ ÜÜ ÜÜÜ Û
|
||
//Û Û Û Û Û Û Û Û Û Û Û Û Û Û Û Û Û
|
||
//Û ÛßßÛ Ûßß Ûß ÛßÛ Û Û Û ÛßÛ ÛßßÛ ßßÜ Û
|
||
//Û Û Û Û ÛÜÜ Û Û Û ÛÜÜÛ Û Û Û Û ÜÜÜß Û
|
||
//Û Û
|
||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||
|
||
void Abre_Ficha_CD_in(void){
|
||
|
||
char ArchivoDatos[]="JD_Soft.FV";
|
||
char Memoria;
|
||
void *Imagen;
|
||
|
||
int cm;
|
||
cm = JD_imagesize(200, 212, 440, 267);
|
||
if ( (Imagen = malloc( cm /*imagesize(200, 212, 440, 267)*/ ) ) == NULL ) Memoria = 0;
|
||
else {
|
||
Memoria = 1;
|
||
getimage( 200, 212, 440, 267, Imagen );
|
||
Imprime_Estaticos( 113, "cd_in.img");
|
||
settextstyle( SMALL_FONT, HORIZ_DIR, 4);
|
||
}
|
||
|
||
if (Items_for == DOS)
|
||
sprintf(ArchivoDatos, "CD_D%02d.dat", Item_select );
|
||
else
|
||
sprintf(ArchivoDatos, "CD_W%02d.dat", Item_select );
|
||
|
||
//ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ//
|
||
//Û CD_in Apertura de Indice, y Datos, o creaci¢n... Û//
|
||
//ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß//
|
||
|
||
int LSJ = sizeof(struct Cabecera);
|
||
int LSC = sizeof(CD_FILE);
|
||
|
||
if ( (CD_in = fopen( ArchivoDatos, "r+b"))==NULL) {
|
||
|
||
FILE *fa;
|
||
|
||
if ( (fa = fopen( ArchivoDatos, "wb" ) )!=NULL ) {
|
||
|
||
Poner_a_cero_estructura_actual_CD_in();
|
||
CD_cabecera.Records = 0;
|
||
rewind(fa);
|
||
|
||
fwrite(&CD_cabecera, LSJ, 1, fa); fseek(fa, (long)LSJ, SEEK_SET);
|
||
fwrite(&CD_in1, LSC, 1, fa);
|
||
|
||
if (fclose(fa) == EOF ) exit(1);
|
||
}
|
||
|
||
if ( (CD_in = fopen( ArchivoDatos, "r+b"))==NULL) {
|
||
if ( Memoria ) free(Imagen);
|
||
restorecrtmode();
|
||
printf("NO SE PUDO ABRIR EL FICHERO INDICE EN LA 2§ PASADA");
|
||
exit(1);
|
||
}
|
||
}
|
||
|
||
rewind(CD_in);
|
||
if ( fread(&CD_cabecera, LSJ, 1, CD_in) != 1 ) {
|
||
if ( Memoria ) free(Imagen);
|
||
restorecrtmode();
|
||
printf("NO SE PUDO LEER EN EL FICHERO: INDICE");
|
||
exit(1);
|
||
}
|
||
fseek(CD_in, (long)LSJ, SEEK_SET);
|
||
if ( fread(&CD_in1, LSC, 1, CD_in) != 1 ) {
|
||
if ( Memoria ) free(Imagen);
|
||
restorecrtmode();
|
||
printf("NO SE PUDO LEER EN EL FICHERO: DATOS");
|
||
exit(1);
|
||
}
|
||
|
||
if( Memoria ) {
|
||
putimage( 200, 212, Imagen, COPY_PUT);
|
||
free(Imagen);
|
||
}
|
||
|
||
}
|
||
|
||
void Poner_a_cero_estructura_actual_CD_in(void){
|
||
|
||
char CR = 13, LF = 10, BEEP = 7, ANY = 26;
|
||
sprintf( CD_cabecera.Nombre_del_Programa, "%c %c %c - CD_OUT - %c %c", CR, LF, BEEP, CR, LF );
|
||
sprintf( CD_cabecera.Comentario_Inicial, "Jos‚ David Guill‚n %c %c %c %c", CR, LF, BEEP, ANY );
|
||
CD_cabecera.VerHi = 1; CD_cabecera.VerLow = 0;
|
||
CD_cabecera.Register = 1;
|
||
|
||
CD_in1.Typo.DOS_WINDOWS = ( Items_for == DOS ? 0 : 1);
|
||
CD_in1.Typo.Tipo_de_Programa = Item_select;
|
||
CD_in1.Typo.T_Dibujo = 0;
|
||
CD_in1.Typo.Install = 0;
|
||
CD_in1.Typo.Ejecutable = 0;
|
||
|
||
strcpy( CD_in1.Nombre, "\0" );
|
||
for(CR=0; CR<32; CR++)
|
||
// strcpy( CD_in1.Comentario[CR], " ");
|
||
strcpy( CD_in1.Comentario[CR], " ");
|
||
|
||
strcpy( CD_in1.N_Img, "\0");
|
||
strcpy( CD_in1.Dir_P, "\0");
|
||
|
||
CD_in1.Alt_Install.Usar_VGA_COPY = 0;
|
||
CD_in1.Alt_Install.Usar_ARJ = 0;
|
||
CD_in1.Alt_Install.Usar_ZIP = 0;
|
||
CD_in1.Alt_Install.Usar_LHA = 0;
|
||
CD_in1.Alt_Install.Usar_XCopy = 0;
|
||
CD_in1.Alt_Install.Usar_Install_P = 0;
|
||
// CD_in1.Alt_Install.Usar_NO_Install = 0;
|
||
|
||
strcpy( CD_in1.N_Install, "\0");
|
||
strcpy( CD_in1.N_Exe, "\0");
|
||
|
||
}
|
||
|
||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||
//Û Û
|
||
//Û ÜÜ ÜÜÜ ÜÜÜ Ü Ü ÜÜÜ Ü Ü ÜÜÜÜ Û
|
||
//Û Û Û Û Û Û Û Û Û Û Û Û Û Û
|
||
//Û ÛßßÛ ÛßÛ Û ÛßßÛ Û Û Û Û Û Û
|
||
//Û Û Û Û Û ÛÜÜ Û Û ÜÛÜ ßÜß ÛÜÜÛ Û
|
||
//Û Û
|
||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||
|
||
|
||
|
||
|
||
void PutLineCD_in(void){
|
||
|
||
int LSJ = sizeof(struct Cabecera);
|
||
int LSC = sizeof(CD_FILE);
|
||
|
||
int CurrRecord = CurrTopLineCD_in + CurrRowCD_in - 1;
|
||
|
||
fseek(CD_in, (long)LSJ + ( LSC * CurrRecord ) - LSC, SEEK_SET); // Se coloca
|
||
fwrite(&CD_in1, LSC, 1, CD_in); // Y escribe
|
||
|
||
}
|
||
|
||
void GetLineCD_in(void){
|
||
|
||
int LSJ = sizeof(struct Cabecera);
|
||
int LSC = sizeof(CD_FILE);
|
||
|
||
int CurrRecord = CurrTopLineCD_in + CurrRowCD_in - 1;
|
||
|
||
fseek(CD_in, (long)LSJ + ( LSC * CurrRecord ) - LSC, SEEK_SET); // Se coloca
|
||
fread(&CD_in1, LSC, 1, CD_in); // Y lee
|
||
|
||
}
|
||
|
||
void DeleteRecordCD_in(void) {
|
||
|
||
long CurrRecord;
|
||
int LSJ = sizeof(struct Cabecera);
|
||
int LSC = sizeof(CD_FILE);
|
||
|
||
CurrRecord = CurrTopLineCD_in + CurrRowCD_in - 1;
|
||
|
||
if ( (CD_cabecera.Records == 0) ) { BEEP();
|
||
Poner_a_cero_estructura_actual_CD_in();
|
||
fseek(CD_in, (long)LSJ + ( LSC * ( 0 ) ), SEEK_SET);
|
||
fwrite(&CD_in1, LSC, 1, CD_in);
|
||
PrintWholeScreenCD_in();
|
||
GetLineCD_in();
|
||
EditCursorCD_in(0);
|
||
|
||
} else {
|
||
|
||
CD_cabecera.Records -= 1;
|
||
|
||
unsigned int p = CurrRecord - 1;
|
||
|
||
while( p <= CD_cabecera.Records ) {
|
||
|
||
fseek(CD_in, (long)LSJ + ( LSC * ( p + 1 ) ), SEEK_SET); // Se coloca
|
||
fread(&CD_in1, LSC, 1, CD_in); // Y lee
|
||
|
||
fseek(CD_in, (long)LSJ + ( LSC * p ), SEEK_SET); // Se coloca
|
||
fwrite(&CD_in1, LSC, 1, CD_in); // Y escribe
|
||
|
||
p++;
|
||
};
|
||
|
||
rewind(CD_in);
|
||
fwrite(&CD_cabecera, LSJ, 1, CD_in); // Acualiza n§ de registros
|
||
|
||
if ((CurrRecord - 1) == CD_cabecera.Records + 1) CurrRowCD_in--;
|
||
/* Û */
|
||
/* ßßßÛ */ PrintWholeScreenCD_in();
|
||
/* ß */ GetLineCD_in();
|
||
EditCursorCD_in(0);
|
||
|
||
PrintLineCD_in2();
|
||
}
|
||
}
|
||
|
||
|
||
|
||
void AddRecordCD_in(void){
|
||
|
||
long CurrRecord= CurrTopLineCD_in + CurrRowCD_in - 1;
|
||
|
||
int LSJ = sizeof(struct Cabecera);
|
||
int LSC = sizeof(CD_FILE);
|
||
|
||
if( CurrRecord < 100000 ) {
|
||
|
||
long avance = CD_cabecera.Records;
|
||
|
||
while( avance >= (CurrRecord-1) ) {
|
||
|
||
fseek(CD_in, (long)LSJ + ( LSC * avance ), SEEK_SET);
|
||
fread(&CD_in1, LSC, 1, CD_in);
|
||
|
||
fseek(CD_in, (long)LSJ + ( LSC * (avance + 1) ), SEEK_SET);
|
||
fwrite(&CD_in1, LSC, 1, CD_in);
|
||
|
||
avance--;
|
||
};
|
||
|
||
// CD_in1_inx.Fin = CD_in1_inx.Fin + 1;
|
||
CD_cabecera.Records++;
|
||
|
||
rewind(CD_in);
|
||
fwrite(&CD_cabecera, LSJ, 1, CD_in); // Acualiza n§ de registros
|
||
|
||
Poner_a_cero_estructura_actual_CD_in();
|
||
|
||
fseek(CD_in, (long)LSJ + ( LSC * ( CurrTopLineCD_in + CurrRowCD_in - 1) ), SEEK_SET);
|
||
fwrite(&CD_in1, LSC, 1, CD_in);
|
||
|
||
CurrRowCD_in++;
|
||
if (CurrRowCD_in>19) { CurrTopLineCD_in++; CurrRowCD_in--; }
|
||
PrintWholeScreenCD_in();
|
||
GetLineCD_in();
|
||
EditCursorCD_in(0);
|
||
PrintLineCD_in2();
|
||
|
||
}
|
||
|
||
}
|
||
|
||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||
//Û Û
|
||
//Û ÜÜÜ ÜÜ Ü Ü ÜÜÜÜÜ ÜÜ Ü Ü ÜÜ Û
|
||
//Û Û Û Û Û ÛÛ Û Û Û Û Û Û Û Û Û
|
||
//Û Ûßß ÛßßÛ Û ÛÛ Û ÛßßÛ Û Û ÛßßÛ Û
|
||
//Û Û Û Û Û Û Û Û Û ÛÜÜ ÛÜÜ Û Û Û
|
||
//Û Û
|
||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||
|
||
void Mueve_Abajo_CD_in(void){
|
||
|
||
int CurrRecord = CurrTopLineCD_in + CurrRowCD_in - 1;
|
||
|
||
if (CurrRowCD_in == 19) {
|
||
if ( (CurrRecord - 1) >= CD_cabecera.Records) { BEEP(); EditCursorCD_in(0); }
|
||
else { CurrTopLineCD_in++;
|
||
PrintWholeScreenCD_in();
|
||
GetLineCD_in();
|
||
PrintLineCD_in2();
|
||
}
|
||
} else {
|
||
if( (CurrRecord - 1) >= CD_cabecera.Records) { BEEP(); EditCursorCD_in(0); }
|
||
else { CurrRowCD_in++;
|
||
GetLineCD_in();
|
||
PrintLineCD_in2();
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
void Mueve_Arriba_CD_in(void){
|
||
int CurrRecord = CurrTopLineCD_in + CurrRowCD_in - 1;
|
||
|
||
if (CurrRowCD_in==1) {
|
||
if ((CurrRecord - 1) <= 0) { BEEP(); EditCursorCD_in(0); }
|
||
else {
|
||
CurrTopLineCD_in--;
|
||
PrintWholeScreenCD_in();
|
||
GetLineCD_in();
|
||
PrintLineCD_in2();
|
||
}
|
||
|
||
} else {
|
||
if( (CurrRecord - 1) <= 0) { BEEP(); // Do nothing, get over...
|
||
|
||
} else { CurrRowCD_in--;
|
||
GetLineCD_in();
|
||
PrintLineCD_in2();
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
void EditCursorCD_in(int ShowHide) {
|
||
|
||
char Buffer[80];
|
||
int Ch;
|
||
|
||
if (!ShowHide) {
|
||
setcolor(255);
|
||
setfillstyle(SOLID_FILL, 255);
|
||
Borra_Campo_Visual( CurrColCD_in );
|
||
setcolor(240);
|
||
} else {
|
||
setcolor(240);
|
||
setfillstyle(SOLID_FILL, 240);
|
||
Borra_Campo_Visual( CurrColCD_in );
|
||
Texto_Normal
|
||
}
|
||
|
||
switch(CurrColCD_in){
|
||
case 1:
|
||
// Nombre del Programa 26 d.
|
||
outtextxy( 8, 98 + (CurrRowCD_in-1) * 12, CD_in1.Nombre );
|
||
break;
|
||
case 2:
|
||
// Nombre del Instalador
|
||
outtextxy( 175, 98 + (CurrRowCD_in-1) * 12, CD_in1.N_Install );
|
||
break;
|
||
case 3:
|
||
// Nombre del Ejecutable
|
||
outtextxy( 233, 98 + (CurrRowCD_in-1) * 12, CD_in1.N_Exe);
|
||
break;
|
||
case 4:
|
||
// ¨ Es Instalable ? ¨ Cual es el Tipo ?
|
||
if ( CD_in1.Alt_Install.Usar_VGA_COPY ) strcpy( Buffer, "VCpy" ); else
|
||
if ( CD_in1.Alt_Install.Usar_ARJ ) strcpy( Buffer, "Arj" ); else
|
||
if ( CD_in1.Alt_Install.Usar_ZIP ) strcpy( Buffer, "Zip" ); else
|
||
if ( CD_in1.Alt_Install.Usar_XCopy ) strcpy( Buffer, "Xcpy" ); else
|
||
if ( CD_in1.Alt_Install.Usar_Install_P) strcpy( Buffer, "Inst" ); else
|
||
if ( CD_in1.Alt_Install.Usar_LHA ) strcpy( Buffer, "NO I" ); else
|
||
strcpy( Buffer, "NO I" );
|
||
outtextxy( 291, 98 + (CurrRowCD_in-1) * 12, Buffer );
|
||
break;
|
||
|
||
case 5:
|
||
// ¨ Es ejecutable ?
|
||
strcpy( Buffer, (CD_in1.Typo.Ejecutable ? "SI" : "NO") );
|
||
outtextxy( 321, 98 + (CurrRowCD_in-1) * 12, Buffer );
|
||
break;
|
||
|
||
case 6:
|
||
// ¨ Tiene Dibujo ?
|
||
strcpy( Buffer, (CD_in1.Typo.T_Dibujo ? "SI" : "NO") );
|
||
outtextxy( 353, 98 + (CurrRowCD_in-1) * 12, Buffer );
|
||
break;
|
||
case 7:
|
||
// Directorio
|
||
outtextxy( 123, 338, CD_in1.Dir_P );
|
||
break;
|
||
case 8:
|
||
// Nombre Imagen
|
||
outtextxy( 123, 358, CD_in1.N_Img );
|
||
break;
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
void PrintLineCD_in(void){
|
||
|
||
char Buffer[80];
|
||
|
||
setcolor(240);
|
||
setfillstyle(SOLID_FILL, 240);
|
||
Borra_Campo_Visual(-1);
|
||
|
||
Texto_Normal
|
||
// Nombre del Programa 26 d.
|
||
outtextxy( 8, 98 + (CurrRowCD_in-1) * 12, CD_in1.Nombre );
|
||
// Nombre del Instalador
|
||
outtextxy( 175, 98 + (CurrRowCD_in-1) * 12, CD_in1.N_Install );
|
||
// Nombre del Ejecutable
|
||
outtextxy( 233, 98 + (CurrRowCD_in-1) * 12, CD_in1.N_Exe);
|
||
// ¨ Es Instalable ? ¨ Cual es el Tipo ?
|
||
if ( CD_in1.Alt_Install.Usar_VGA_COPY ) strcpy( Buffer, "VCpy" ); else
|
||
if ( CD_in1.Alt_Install.Usar_ARJ ) strcpy( Buffer, "Arj" ); else
|
||
if ( CD_in1.Alt_Install.Usar_ZIP ) strcpy( Buffer, "Zip" ); else
|
||
if ( CD_in1.Alt_Install.Usar_XCopy ) strcpy( Buffer, "Xcpy" ); else
|
||
if ( CD_in1.Alt_Install.Usar_Install_P) strcpy( Buffer, "Inst" ); else
|
||
if ( CD_in1.Alt_Install.Usar_LHA ) strcpy( Buffer, "NO I" ); else
|
||
strcpy( Buffer, "NO I" );
|
||
outtextxy( 291, 98 + (CurrRowCD_in-1) * 12, Buffer );
|
||
// ¨ Es ejecutable ?
|
||
strcpy( Buffer, (CD_in1.Typo.Ejecutable ? "SI" : "NO") );
|
||
outtextxy( 321, 98 + (CurrRowCD_in-1) * 12, Buffer );
|
||
// ¨ Tiene Dibujo ?
|
||
strcpy( Buffer, (CD_in1.Typo.T_Dibujo ? "SI" : "NO") );
|
||
outtextxy( 353, 98 + (CurrRowCD_in-1) * 12, Buffer );
|
||
// Directorio
|
||
outtextxy( 123, 338, CD_in1.Dir_P );
|
||
// Nombre Imagen
|
||
outtextxy( 123, 358, CD_in1.N_Img );
|
||
|
||
}
|
||
|
||
|
||
void PrintLineCD_in2(void){
|
||
|
||
setcolor(240);
|
||
setfillstyle(SOLID_FILL, 240);
|
||
Borra_Campo_Visual(7);
|
||
Borra_Campo_Visual(8);
|
||
|
||
Texto_Normal
|
||
// Directorio
|
||
outtextxy( 123, 338, CD_in1.Dir_P );
|
||
// Nombre Imagen
|
||
outtextxy( 123, 358, CD_in1.N_Img );
|
||
|
||
}
|
||
|
||
void PrintWholeScreenCD_in(void){
|
||
|
||
int tmp = CurrRowCD_in;
|
||
|
||
setcolor(240);
|
||
setfillstyle(SOLID_FILL, 240);
|
||
Borra_Campo_Visual(-2);
|
||
|
||
for(CurrRowCD_in = 1; CurrRowCD_in < (19+1); CurrRowCD_in++)
|
||
|
||
if ( (CurrTopLineCD_in + CurrRowCD_in - 1) <= (CD_cabecera.Records + 1) ) {
|
||
GetLineCD_in();
|
||
PrintLineCD_in();
|
||
}
|
||
|
||
PrintLineCD_in2();
|
||
CurrRowCD_in = tmp;
|
||
|
||
}
|
||
|
||
void Edit_Item_CD_in(void){
|
||
|
||
char buffer[80];
|
||
|
||
switch(CurrColCD_in){
|
||
case 1:
|
||
// Nombre del Programa 26 d.
|
||
// Puntero a cadena, T/N, Dtos, Color, Fondo, Up, Left, Right, Down, Linea
|
||
InputCadenaG_T4( CD_in1.Nombre, 0, 26, 255, 250, 8, 98/*, 175, 327*/, CurrRowCD_in-1);
|
||
break;
|
||
case 2:
|
||
// Nombre del Instalador
|
||
InputCadenaG_T4( CD_in1.N_Install, 0, 8, 255, 250, 175, 98/*, 227, 327*/, CurrRowCD_in-1);
|
||
break;
|
||
case 3:
|
||
// Nombre del Ejecutable
|
||
InputCadenaG_T4( CD_in1.N_Exe, 0, 8, 255, 250, 233, 98/*, 285, 327*/, CurrRowCD_in-1);
|
||
break;
|
||
case 4:
|
||
// ¨ Es Instalable ? ¨ Cual es el Tipo ?
|
||
if ( CD_in1.Alt_Install.Usar_VGA_COPY ) strcpy( buffer, "1" ); else
|
||
if ( CD_in1.Alt_Install.Usar_ARJ ) strcpy( buffer, "2" ); else
|
||
if ( CD_in1.Alt_Install.Usar_ZIP ) strcpy( buffer, "3" ); else
|
||
if ( CD_in1.Alt_Install.Usar_XCopy ) strcpy( buffer, "4" ); else
|
||
if ( CD_in1.Alt_Install.Usar_Install_P) strcpy( buffer, "5" ); else
|
||
if ( CD_in1.Alt_Install.Usar_LHA ) strcpy( buffer, "6" );
|
||
|
||
InputCadenaG_T4( buffer, 1, 1, 255, 250, 291, 98/*, 315, 327*/, CurrRowCD_in-1);
|
||
|
||
CD_in1.Alt_Install.Usar_VGA_COPY = 0;
|
||
CD_in1.Alt_Install.Usar_ARJ = 0;
|
||
CD_in1.Alt_Install.Usar_ZIP = 0;
|
||
CD_in1.Alt_Install.Usar_XCopy = 0;
|
||
CD_in1.Alt_Install.Usar_Install_P = 0;
|
||
CD_in1.Alt_Install.Usar_LHA = 0;
|
||
|
||
switch( atoi(buffer) ) {
|
||
|
||
case 1: CD_in1.Alt_Install.Usar_VGA_COPY = 1;
|
||
break;
|
||
case 2: CD_in1.Alt_Install.Usar_ARJ = 1;
|
||
break;
|
||
case 3: CD_in1.Alt_Install.Usar_ZIP = 1;
|
||
break;
|
||
case 4: CD_in1.Alt_Install.Usar_XCopy = 1;
|
||
break;
|
||
case 5: CD_in1.Alt_Install.Usar_Install_P = 1;
|
||
break;
|
||
case 6: CD_in1.Alt_Install.Usar_LHA = 1;
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
break;
|
||
case 5:
|
||
// ¨ Es ejecutable ?
|
||
strcpy( buffer, (CD_in1.Typo.Ejecutable ? "1" : "0") );
|
||
InputCadenaG_T4( buffer, 1, 1, 255, 250, 321, 98/*, 347, 327*/, CurrRowCD_in-1);
|
||
CD_in1.Typo.Ejecutable = atoi(buffer);
|
||
break;
|
||
case 6:
|
||
// ¨ Tiene Dibujo ?
|
||
strcpy( buffer, (CD_in1.Typo.T_Dibujo ? "1" : "0") );
|
||
InputCadenaG_T4( buffer, 1, 1, 255, 250, 353, 98/*, 377, 327*/, CurrRowCD_in-1);
|
||
CD_in1.Typo.T_Dibujo = atoi(buffer);
|
||
break;
|
||
case 7:
|
||
// Directorio
|
||
InputCadenaG_T4( CD_in1.Dir_P, 0, 40, 255, 250, 123, 338/*, 377, 352*/, 0);
|
||
break;
|
||
case 8:
|
||
// Nombre Imagen
|
||
InputCadenaG_T4( CD_in1.N_Img, 0, 8, 255, 250, 123, 358/*, 175, 372*/, 0);
|
||
break;
|
||
}
|
||
PutLineCD_in();
|
||
GetLineCD_in();
|
||
PrintLineCD_in();
|
||
PrintLineCD_in2();
|
||
|
||
}
|
||
|
||
|
||
|
||
void Borra_Campo_Visual(int Columna){
|
||
|
||
|
||
switch( Columna ) {
|
||
case -2:
|
||
// ** Nombre
|
||
bar( 8, 98, 169, 327 );
|
||
// ** Nombre Install
|
||
bar( 175, 98, 227, 327 );
|
||
// ** Nombre Exe
|
||
bar( 233, 98, 285, 327 );
|
||
// ** Instalable
|
||
bar( 291, 98, 315, 327 );
|
||
// ** Ejecutable
|
||
bar( 321, 98, 347, 327 );
|
||
// ** Imagen
|
||
bar( 353, 98, 377, 327 );
|
||
// *** Directorio
|
||
bar( 123, 338, 377, 352 );
|
||
// *** Nombre Imagen
|
||
bar( 123, 358, 175, 372 );
|
||
// *** Directorio
|
||
bar( 123, 338, 377, 352 );
|
||
// *** Nombre Imagen
|
||
bar( 123, 358, 175, 372 );
|
||
break;
|
||
case -1:
|
||
// *** Los Borra -> TODOS
|
||
// C:\>del.
|
||
// Todos los archivos en el directorio
|
||
// seran eliminados. ¨ Si / No ? S
|
||
// C:\>_
|
||
// ** Nombre
|
||
bar( 8, 98 + (CurrRowCD_in-1) * 12, 169, 98 + ( CurrRowCD_in - 1 ) * 12 + 10);
|
||
// ** Nombre Install
|
||
bar( 175, 98 + (CurrRowCD_in-1) * 12, 227, 98 + ( CurrRowCD_in - 1 ) * 12 + 10);
|
||
// ** Nombre Exe
|
||
bar( 233, 98 + (CurrRowCD_in-1) * 12, 285, 98 + ( CurrRowCD_in - 1 ) * 12 + 10);
|
||
// ** Instalable
|
||
bar( 291, 98 + (CurrRowCD_in-1) * 12, 315, 98 + ( CurrRowCD_in - 1 ) * 12 + 10);
|
||
// ** Ejecutable
|
||
bar( 321, 98 + (CurrRowCD_in-1) * 12, 347, 98 + ( CurrRowCD_in - 1 ) * 12 + 10);
|
||
// ** Imagen
|
||
bar( 353, 98 + (CurrRowCD_in-1) * 12, 377, 98 + ( CurrRowCD_in - 1 ) * 12 + 10 );
|
||
// *** Directorio
|
||
bar( 123, 338, 377, 352 );
|
||
// *** Nombre Imagen
|
||
bar( 123, 358, 175, 372 );
|
||
break;
|
||
case 1:
|
||
// ** Nombre
|
||
bar( 8, 98 + (CurrRowCD_in-1) * 12, 169, 98 + ( CurrRowCD_in - 1 ) * 12 + 10);
|
||
break;
|
||
case 2:
|
||
// ** Nombre Install
|
||
bar( 175, 98 + (CurrRowCD_in-1) * 12, 227, 98 + ( CurrRowCD_in - 1 ) * 12 + 10);
|
||
break;
|
||
case 3:
|
||
// ** Nombre Exe
|
||
bar( 233, 98 + (CurrRowCD_in-1) * 12, 285, 98 + ( CurrRowCD_in - 1 ) * 12 + 10);
|
||
break;
|
||
case 4:
|
||
// ** Instalable
|
||
bar( 291, 98 + (CurrRowCD_in-1) * 12, 315, 98 + ( CurrRowCD_in - 1 ) * 12 + 10);
|
||
break;
|
||
case 5:
|
||
// ** Ejecutable
|
||
bar( 321, 98 + (CurrRowCD_in-1) * 12, 347, 98 + ( CurrRowCD_in - 1 ) * 12 + 10);
|
||
break;
|
||
case 6:
|
||
// ** Imagen
|
||
bar( 353, 98 + (CurrRowCD_in-1) * 12, 377, 98 + ( CurrRowCD_in - 1 ) * 12 + 10 );
|
||
break;
|
||
case 7:
|
||
// *** Directorio
|
||
bar( 123, 338, 377, 352 );
|
||
break;
|
||
case 8:
|
||
// *** Nombre Imagen
|
||
bar( 123, 358, 175, 372 );
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
|
||
}
|
||
|
||
|
||
int InputCadenaG_T4(char *s, int numalp, int lmax, int cc, int cf, int X0, int Y0/*, int X1, int Y1*/, int RoW)
|
||
{
|
||
|
||
int ls; // longitud cadena
|
||
char *s1; // puntero a cadena inicial
|
||
int c, ok;
|
||
|
||
s1 = s; // inicio cadena
|
||
|
||
setcolor(cf); // pone color a 0 para borrar
|
||
setfillstyle(SOLID_FILL, cf);
|
||
Borra_Campo_Visual(CurrColCD_in);
|
||
setcolor(cc); // devuelve el color a su estado
|
||
|
||
outtextxy( X0, Y0+RoW*12, s );
|
||
|
||
ls = strlen ( s ); // Longitud de actual
|
||
|
||
if ( ls < lmax ) {
|
||
setcolor(250);
|
||
outtextxy( X0+textwidth( s1 ), Y0+RoW*12, "þ");
|
||
}
|
||
|
||
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--;
|
||
|
||
*s = '\0';
|
||
|
||
setcolor(cf);
|
||
setfillstyle(SOLID_FILL, cf);
|
||
Borra_Campo_Visual(CurrColCD_in);
|
||
//bar(X0, Y0+RoW*12+/*2*/4, X1-2, Y0+4+RoW*12 + 10);
|
||
|
||
setcolor(cc);
|
||
outtextxy( X0, Y0+RoW*12, s1 );
|
||
setcolor(4);
|
||
outtextxy( X0+textwidth( s1 ), Y0+RoW*12, "þ");
|
||
setcolor(cc);
|
||
|
||
} else {
|
||
if ( !numalp && c >= 32 && c <= 254 /* isprint(c) */ && ls < lmax) {
|
||
|
||
*s++ = c;
|
||
ls++;
|
||
|
||
*s = '\0';
|
||
setcolor(cf);
|
||
setfillstyle(SOLID_FILL, cf);
|
||
Borra_Campo_Visual(CurrColCD_in);
|
||
//bar(X0, Y0+RoW*12+/*2*/4, X1-2, Y0+4+RoW*12 + 10);
|
||
setcolor(cc);
|
||
outtextxy( X0, Y0+RoW*12, s1 );
|
||
|
||
if ( ls < lmax ) {
|
||
setcolor(4);
|
||
outtextxy( X0+textwidth( s1 ), Y0+RoW*12, "þ");
|
||
setcolor(cc);
|
||
}
|
||
|
||
|
||
} else {
|
||
if ( numalp && isdigit(c) && ls < lmax) {
|
||
*s++ = c;
|
||
ls++;
|
||
|
||
*s = '\0'; // Cero final
|
||
setcolor(cf);
|
||
setfillstyle(SOLID_FILL, cf);
|
||
Borra_Campo_Visual(CurrColCD_in);
|
||
//bar(X0, Y0+RoW*12+4, X1-2, Y0+4+RoW*12 + 10);
|
||
setcolor(cc);
|
||
|
||
outtextxy( X0, Y0+RoW*12, s1 );
|
||
|
||
if ( ls < lmax ) {
|
||
setcolor(4);
|
||
outtextxy( X0+textwidth( s1 ), Y0+RoW*12, "þ");
|
||
setcolor(cc);
|
||
}
|
||
|
||
|
||
}
|
||
/*ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ*/
|
||
else if( c == 27 ) {*s='\0'; ok = 1; }
|
||
/*ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ*/
|
||
else BEEP();
|
||
}
|
||
}
|
||
|
||
}while(!ok);
|
||
|
||
ok = 1;
|
||
*s = ' ';
|
||
while( ok ) {
|
||
if(*s==' ') { *s = '\0'; s--;
|
||
} else { s++; ok = 0; }
|
||
}
|
||
|
||
*s = '\0';
|
||
|
||
while(kbhit()) getch(); // Vacia Buffer impidiendo falsas
|
||
// pulsaciones...
|
||
|
||
return ls;
|
||
}
|
||
|
||
void BEEP(void){
|
||
|
||
sound(440);
|
||
delay(50);
|
||
nosound();
|
||
|
||
}
|
||
|
||
void Inicializa_Apertura(void) {
|
||
|
||
CurrTopLineCD_in = 1;
|
||
CurrRowCD_in = 1;
|
||
CurrColCD_in = 1;
|
||
Abre_Ficha_CD_in();
|
||
PrintWholeScreenCD_in();
|
||
GetLineCD_in();
|
||
EditCursorCD_in(0);
|
||
|
||
}
|
||
|
||
void Muestra_Informacion(void){
|
||
|
||
char Buffer[80];
|
||
|
||
setcolor(240);
|
||
setfillstyle(SOLID_FILL, 240);
|
||
|
||
bar( 13, 388, 182, 434 );
|
||
|
||
setcolor(255);
|
||
sprintf( Buffer, "Modulo:" );
|
||
switch ( Item_select ) {
|
||
case 1: strcat( Buffer, " Juegos" ); break;
|
||
case 2: strcat( Buffer, " P.Texto" ); break;
|
||
case 3: strcat( Buffer, " M£sica" ); break;
|
||
case 4: strcat( Buffer, " Dibujo" ); break;
|
||
case 5: strcat( Buffer, " Utild." ); break;
|
||
case 6: strcat( Buffer, " Base D" ); break;
|
||
case 7: strcat( Buffer, " Hoja C" ); break;
|
||
case 8: strcat( Buffer, " Red" ); break;
|
||
case 9: strcat( Buffer, " Lenguaj" ); break;
|
||
case 10:strcat( Buffer, " Scanner" ); break;
|
||
case 11:strcat( Buffer, " News" ); break;
|
||
case 12:strcat( Buffer, " Compr" ); break;
|
||
case 13:strcat( Buffer, " Videos" ); break;
|
||
case 14:strcat( Buffer, " Varios" ); break;
|
||
case 15:strcat( Buffer, " CD's" ); break;
|
||
default: strcat( Buffer, "ERROR" ); break;
|
||
}
|
||
|
||
strcat( Buffer, ( (Items_for==DOS) ? ", DOS" : ", WINDOWS") );
|
||
outtextxy( 15, 390, Buffer);
|
||
|
||
sprintf( Buffer, "Linea %02d. Reg %d / %d", CurrRowCD_in, (CurrRowCD_in+CurrTopLineCD_in-1), (CD_cabecera.Records + 1) );
|
||
outtextxy( 15, 400, Buffer);
|
||
|
||
|
||
|
||
}
|
||
|
||
|
||
|
||
/////// EDITAR COMENTARIO....
|
||
|
||
int Editar_Comentario(void)
|
||
{
|
||
|
||
int ls; // longitud cadena
|
||
char *s1, *s, *s_tmp, *s_tmp1; // puntero a cadena inicial
|
||
int key, ok, Linea = 0, Columna = 0, X, Y, lmax;
|
||
char Buffer[80];
|
||
|
||
X = 395; Y = 105; lmax = 35;
|
||
ok = 0;
|
||
|
||
s_tmp1 = s_tmp = s = s1 = CD_in1.Comentario[0]; // inicio cadena
|
||
|
||
s += lmax ; *s = '\0';
|
||
s = s_tmp;
|
||
|
||
do {
|
||
|
||
setcolor(250); // pone color a 0 para borrar
|
||
setfillstyle(SOLID_FILL, 250); // selecciona los atributos de
|
||
bar( X, Y+Linea*11, X + 230, Y+Linea*11 + 11); // relleno, y Borra el campo
|
||
setcolor(255); // devuelve el color a su estado
|
||
|
||
outtextxy( X, Y+Linea*11, s1 ); // e imprime la cadena.
|
||
// ls = strlen ( s ); // Longitud de la cadena actual
|
||
|
||
|
||
if ( Columna < lmax ) { // Muestra cursor si es posible
|
||
setcolor(251);
|
||
strncpy( Buffer, s1, Columna );
|
||
Buffer[Columna] = '\0';
|
||
outtextxy( X + textwidth( Buffer ), Y+Linea*11+2, "Ü");
|
||
}
|
||
|
||
switch ( ( key = getch() ) ) { // obtiene tecla
|
||
// Intro o Return
|
||
case 13:
|
||
|
||
if( Linea < 31 ) {
|
||
setcolor(240); // pone color a 0 para borrar
|
||
setfillstyle(SOLID_FILL, 240); // selecciona los atributos de
|
||
bar( X, Y+Linea*11, X + 230, Y+Linea*11 + 11); // relleno, y Borra el campo
|
||
setcolor(255); // devuelve el color a su estado
|
||
outtextxy( X, Y+Linea*11, s1 ); // e imprime la cadena.
|
||
|
||
Linea++;
|
||
s_tmp1 = s_tmp = s = s1 = CD_in1.Comentario[Linea]; // inicio cadena
|
||
s += lmax; *s = '\0';
|
||
Columna = 0;
|
||
s = s_tmp1 = s_tmp = s1;
|
||
}
|
||
break;
|
||
|
||
case 0:
|
||
|
||
switch ( key = getch() ) {
|
||
|
||
// F. Arriba
|
||
case 72:
|
||
if( Linea > 0 ) {
|
||
setcolor(240); // pone color a 0 para borrar
|
||
setfillstyle(SOLID_FILL, 240); // selecciona los atributos de
|
||
bar( X, Y+Linea*11, X + 230, Y+Linea*11 + 11); // relleno, y Borra el campo
|
||
setcolor(255); // devuelve el color a su estado
|
||
outtextxy( X, Y+Linea*11, s1 ); // e imprime la cadena.
|
||
|
||
Linea--;
|
||
s_tmp1 = s_tmp = s = s1 = CD_in1.Comentario[Linea]; // inicio cadena
|
||
s += lmax; *s = '\0';
|
||
if ( Columna < strlen( s1 ) ) s_tmp += Columna; else { Columna = 0;
|
||
s_tmp = s1; }
|
||
s = s_tmp1 = s_tmp;
|
||
|
||
}
|
||
|
||
break;
|
||
// F. Abajo
|
||
case 80:
|
||
|
||
if( Linea < 31 ) {
|
||
setcolor(240); // pone color a 0 para borrar
|
||
setfillstyle(SOLID_FILL, 240); // selecciona los atributos de
|
||
bar( X, Y+Linea*11, X + 230, Y+Linea*11 + 11); // relleno, y Borra el campo
|
||
setcolor(255); // devuelve el color a su estado
|
||
outtextxy( X, Y+Linea*11, s1 ); // e imprime la cadena.
|
||
|
||
Linea++;
|
||
s_tmp1 = s_tmp = s = s1 = CD_in1.Comentario[Linea]; // inicio cadena
|
||
s += lmax; *s = '\0';
|
||
if ( Columna < strlen( s1 ) ) s_tmp += Columna; else { Columna = 0;
|
||
s_tmp = s1; }
|
||
s = s_tmp1 = s_tmp;
|
||
}
|
||
break;
|
||
// F. Derecha
|
||
case 77:
|
||
case 9:
|
||
if ( Columna < strlen(s1) ) { Columna++; s++; }
|
||
break;
|
||
// F. Izquierda
|
||
case 75:
|
||
case 15:
|
||
if ( Columna > 0) { Columna--; s--; }
|
||
break;
|
||
default:
|
||
BEEP();
|
||
|
||
}
|
||
|
||
break;
|
||
// Back Space
|
||
case 8:
|
||
if ( Columna > 0 ) {
|
||
Columna--;
|
||
s--;
|
||
s_tmp1 = s_tmp = s;
|
||
while ( *s_tmp1 != NULL ) {
|
||
s_tmp1++;
|
||
*s_tmp = *s_tmp1;
|
||
s_tmp++;
|
||
}
|
||
}
|
||
break;
|
||
case 27:
|
||
ok = 1;
|
||
break;
|
||
default:
|
||
if ( key >= 32 && key <= 254 && Columna < lmax) {
|
||
*s++ = key;
|
||
Columna++;
|
||
}
|
||
else BEEP();
|
||
break;
|
||
}
|
||
}while(!ok);
|
||
|
||
while(kbhit()) getch(); // Vacia Buffer impidiendo falsas
|
||
// pulsaciones...
|
||
|
||
setcolor(240); // pone color a 0 para borrar
|
||
setfillstyle(SOLID_FILL, 240); // selecciona los atributos de
|
||
bar( X, Y+Linea*11, X + 230, Y+Linea*11 + 11); // relleno, y Borra el campo
|
||
setcolor(255); // devuelve el color a su estado
|
||
|
||
outtextxy( X, Y+Linea*11, s1 ); // e imprime la cadena.
|
||
PutLineCD_in();
|
||
GetLineCD_in();
|
||
|
||
|
||
return /* de momento nada */ 0;
|
||
|
||
}
|
||
|
||
void Muestra_Comentario(void){
|
||
|
||
int X, Y;
|
||
|
||
X = 395; Y = 105;
|
||
|
||
setcolor(240); // pone color a 0 para borrar
|
||
setfillstyle(SOLID_FILL, 240); // selecciona los atributos de
|
||
for(int Linea=0; Linea<32; Linea++ ){
|
||
bar( X, Y+Linea*11, X + 230, Y+Linea*11 + 11); // relleno, y Borra el campo
|
||
setcolor(255); // devuelve el color a su estado
|
||
outtextxy( X, Y+Linea*11, CD_in1.Comentario[Linea] ); // e imprime la cadena.
|
||
}
|
||
} |