222 lines
5.8 KiB
C++
222 lines
5.8 KiB
C++
#include <dos.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
#include <alloc.h>
|
|
#include <conio.h>
|
|
#include <stdlib.h>
|
|
#include <graphics.h>
|
|
|
|
|
|
#include "..\..\..\jd_lib\f_lib\make_bot.h" // Fuciones de MAKE_BOTON
|
|
|
|
//extern int Fichero_bot(char Dinamicos_Estaticos);
|
|
|
|
struct Colores {
|
|
char Texto;
|
|
char F_Texto;
|
|
char VisorLCD;
|
|
};
|
|
|
|
typedef struct {
|
|
|
|
struct Colores Colores;
|
|
|
|
} Configuracion;
|
|
extern Configuracion CFG;
|
|
|
|
|
|
|
|
char Optar( char *texto1, char *texto2, char *texto3 );
|
|
int Muestra_Mensaje(int Mensaje, char *file);
|
|
void redefine_cursor_raton(int r_e);
|
|
|
|
char Optar( char *texto1, char *texto2, char *texto3 ){
|
|
|
|
int ok = 0, inst = 0;
|
|
struct textsettingstype textinfo;
|
|
|
|
void *C_Texto, *C_Aceptar, *C_Cancelar;
|
|
|
|
C_Texto = malloc( JD_imagesize(200, 212, 440, 267) );
|
|
C_Aceptar = malloc( JD_imagesize(200, 270, 280, 295) );
|
|
C_Cancelar = malloc( JD_imagesize(360, 270, 440, 295) );
|
|
|
|
if( C_Texto == NULL || C_Aceptar == NULL || C_Cancelar == NULL) {
|
|
closegraph();
|
|
cprintf("\n\rSALIENDO");
|
|
cprintf("\n\rImposible encontrar %ldKbytes en el Heap",
|
|
( JD_imagesize(118, 160, 521, 335) +
|
|
JD_imagesize(118, 160, 521, 335) +
|
|
JD_imagesize(118, 160, 521, 335)
|
|
)
|
|
);
|
|
exit(SIN_MEMORIA);
|
|
}
|
|
|
|
gettextsettings(&textinfo);
|
|
|
|
settextstyle(SMALL_FONT, HORIZ_DIR, 5 );
|
|
// settextjustify(CENTER_TEXT, CENTER_TEXT);
|
|
|
|
getimage(200, 212, 440, 267, C_Texto);
|
|
getimage(200, 270, 280, 295, C_Aceptar);
|
|
getimage(360, 270, 440, 295, C_Cancelar);
|
|
|
|
|
|
Imprime_Estaticos(100, "PLC.DAT"); // Imprime botones estaticos 'Seccion 20'
|
|
// Fichero_bot(100);
|
|
Imprime_Secuencia(3); // Imprime secuencia 4.
|
|
Imprime_Estaticos(101, "PLC.DAT"); // Imprime textos estaticos 'Seccion 5'
|
|
// Fichero_bot(101);
|
|
|
|
outtextxy( 210+( ( 230 - textwidth(texto1) ) / 2 ), 220, texto1 );
|
|
outtextxy( 210+( ( 230 - textwidth(texto2) ) / 2 ), 235, texto2 );
|
|
outtextxy( 210+( ( 230 - textwidth(texto3) ) / 2 ), 250, texto3 );
|
|
|
|
while(!ok){ // Bucle infinito
|
|
|
|
switch( Comprueba_Secuencia( 3 ) ) { // Iniciamos comprobacion de 2¦ sec
|
|
|
|
case 0: // No se pulso ningun BOTON
|
|
// Pero el raton fue presionado en
|
|
// algun sitio...
|
|
break;
|
|
case -2: // Hay una tecla normal en BUFFER
|
|
switch( getch() ) { // La utilizamos
|
|
// ESC ( CANCELAR )
|
|
case 14:
|
|
inst = 0;
|
|
ok = 1;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
break;
|
|
case -1: // Hay una tecla especial en BUFFER
|
|
getch(); // La eliminamos
|
|
break;
|
|
// Boton Aceptar
|
|
case 1:
|
|
inst = 1;
|
|
ok = 1;
|
|
break;
|
|
// Boton Cancelar
|
|
case 2:
|
|
inst = 0;
|
|
ok = 1;
|
|
break;
|
|
default:
|
|
while( kbhit() ) getch(); // Limpiamos posibles teclas en BUFFER
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
putimage(200, 212, C_Texto, COPY_PUT);
|
|
putimage(200, 270, C_Aceptar, COPY_PUT);
|
|
putimage(360, 270, C_Cancelar, COPY_PUT);
|
|
|
|
free ( C_Texto );
|
|
free ( C_Aceptar );
|
|
free ( C_Cancelar );
|
|
|
|
|
|
settextstyle(textinfo.font, textinfo.direction, textinfo.charsize );
|
|
settextjustify(textinfo.horiz, textinfo.vert);
|
|
|
|
return inst;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int Muestra_Mensaje(int Mensaje, char *file) {
|
|
void *Imagen;
|
|
|
|
|
|
if ( (Imagen = malloc( JD_imagesize(200, 212, 440, 267) ) ) == NULL ) {
|
|
Espera_Tecla_o_Raton();
|
|
Anclar_Raton();
|
|
return -1;
|
|
} else {
|
|
getimage( 200, 212, 440, 267, Imagen );
|
|
Imprime_Estaticos( Mensaje, file);
|
|
// Fichero_bot( Mensaje );
|
|
|
|
Espera_Tecla_o_Raton();
|
|
Anclar_Raton();
|
|
putimage( 200, 212, Imagen, COPY_PUT);
|
|
free(Imagen);
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
void redefine_cursor_raton(int r_e){
|
|
|
|
struct SREGS seg;
|
|
union REGS ent, sal;
|
|
long dir;
|
|
|
|
extern int dir_raton [32+32];
|
|
|
|
if(r_e==1) { //// Cursor mientras se ejecuta
|
|
int dir_rton [32+32] = {
|
|
|
|
0x0808, /*± ± ± ± 1 ± ± ± ± ± ± ± 1 ± ± ±*/
|
|
0x0000, /*± Û Û Û ± ± Û ± ± Û ± Û ± ± Û ±*/
|
|
0x0000, /*± Û ± ± Û ± Û ± ± Û ± Û Û ± Û ±*/
|
|
0x0000, /*± Û Û Û ± ± Û ± ± Û ± Û Û ± Û ±*/
|
|
0x0800, /*± Û Û ± 1 ± Û ± ± Û ± Û ± Û Û ±*/
|
|
0x0000, /*± Û ± Û ± ± Û ± ± Û ± Û ± Û Û ±*/
|
|
0x0000, /*± Û ± ± Û ± ± Û Û ± ± Û ± ± Û ±*/
|
|
0x8000, /*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*/
|
|
0x7252, /*0 Û Û Û 0 0 Û 0 0 Û 0 Û 0 0 Û 0*/
|
|
0x4A5A, /*0 Û 0 0 Û 0 Û 0 0 Û 0 Û Û 0 Û 0*/
|
|
0x725A, /*0 Û Û Û 0 0 Û 0 0 Û 0 Û Û 0 Û 0*/
|
|
0x6256, /*0 Û Û 0 0 0 Û 0 0 Û 0 Û 0 Û Û 0*/
|
|
0x5256, /*0 Û 0 Û 0 0 Û 0 0 Û 0 Û 0 Û Û 0*/
|
|
0x4992, /*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*/
|
|
};
|
|
dir = (long)dir_rton;
|
|
|
|
} else { //// Cursor mientras se edita
|
|
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 = 3;
|
|
int86(0x33, &ent, &sal);
|
|
|
|
|
|
}
|