First commit 11/11/1991
This commit is contained in:
359
SV_TEXT.CPP
Normal file
359
SV_TEXT.CPP
Normal file
@ -0,0 +1,359 @@
|
||||
#include <graphics.h>
|
||||
#include <conio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "..\libs\make_bot\make_bot.h"
|
||||
|
||||
|
||||
extern void BEEP(void);
|
||||
int InputCadenaG(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo);
|
||||
int InputCadenaG_l(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo, int Row);
|
||||
int InputCadenaG_T4(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo, int RoW);
|
||||
|
||||
int InputCadenaG(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo)
|
||||
{
|
||||
|
||||
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);
|
||||
bar(Campo.left+2, Campo.up+2, Campo.right-2, Campo.down-2);
|
||||
|
||||
setcolor(cc); // devuelve el color a su estado
|
||||
|
||||
outtextxy( Campo.left+2, Campo.up+2, s );
|
||||
|
||||
ls = strlen ( s ); // Longitud de actual
|
||||
|
||||
if ( ls < lmax ) {
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+2, "<EFBFBD>");
|
||||
}
|
||||
|
||||
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);
|
||||
bar(Campo.left+2, Campo.up+2, Campo.right-2, Campo.down-2);
|
||||
setcolor(cc);
|
||||
outtextxy( Campo.left+2, Campo.up+2, s1 );
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+2, "<EFBFBD>");
|
||||
setcolor(cc);
|
||||
|
||||
} else {
|
||||
|
||||
if ( !numalp && c >= 32 && c <= 254 /* isprint(c) */ && ls < lmax) {
|
||||
|
||||
*s++ = c;
|
||||
ls++;
|
||||
|
||||
*s = '\0';
|
||||
setcolor(cf);
|
||||
setfillstyle(SOLID_FILL, cf);
|
||||
bar(Campo.left+2, Campo.up+2, Campo.right-2, Campo.down-2);
|
||||
setcolor(cc);
|
||||
|
||||
outtextxy( Campo.left+2, Campo.up+2, s1 );
|
||||
|
||||
if ( ls < lmax ) {
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+2, "<EFBFBD>");
|
||||
setcolor(cc);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
if ( numalp && isdigit(c) && ls < lmax) {
|
||||
*s++ = c;
|
||||
ls++;
|
||||
|
||||
*s = '\0'; // Cero final
|
||||
setcolor(cf);
|
||||
setfillstyle(SOLID_FILL, cf);
|
||||
bar(Campo.left+2, Campo.up+2, Campo.right-2, Campo.down-2);
|
||||
setcolor(cc);
|
||||
|
||||
outtextxy( Campo.left+2, Campo.up+2, s1 );
|
||||
|
||||
if ( ls < lmax ) {
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+2, "<EFBFBD>");
|
||||
setcolor(cc);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
else if( c == 27 ) {*s='\0'; ok = 1; }
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int InputCadenaG_l(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo, 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);
|
||||
bar(Campo.left+2, Campo.up+4+RoW*/*9*//*14*/15+2, Campo.right-2, Campo.up+4+RoW*/*9*//*14*/15 + /*9*/16);
|
||||
|
||||
setcolor(cc); // devuelve el color a su estado
|
||||
|
||||
outtextxy( Campo.left+2, Campo.up+/*3*/2+RoW*/*9*//*14*/15, s );
|
||||
|
||||
ls = strlen ( s ); // Longitud de actual
|
||||
|
||||
if ( ls < lmax ) {
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+/*3*/2+RoW*/*9*//*14*/15, "<EFBFBD>");
|
||||
}
|
||||
|
||||
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);
|
||||
bar(Campo.left+2, Campo.up+4+RoW*/*9*//*14*/15+2, Campo.right-2, Campo.up+4+RoW*/*9*//*14*/15 + /*9*/16);
|
||||
// bar(Campo.left+2, Campo.up+3+RoW*/*9*/14+2, Campo.right-2, Campo.up+3+RoW*/*9*/14 + /*9*/16);
|
||||
setcolor(cc);
|
||||
outtextxy( Campo.left+2, Campo.up+/*3*/2+RoW*/*9*//*14*/15, s1 );
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+/*3*/2+RoW*/*9*//*14*/15, "<EFBFBD>");
|
||||
setcolor(cc);
|
||||
|
||||
} else {
|
||||
if ( !numalp && c >= 32 && c <= 254 /* isprint(c) */ && ls < lmax) {
|
||||
|
||||
*s++ = c;
|
||||
ls++;
|
||||
|
||||
*s = '\0';
|
||||
setcolor(cf);
|
||||
setfillstyle(SOLID_FILL, cf);
|
||||
bar(Campo.left+2, Campo.up+4+RoW*/*9*//*14*/15+2, Campo.right-2, Campo.up+4+RoW*/*9*//*14*/15 + /*9*/16);
|
||||
// bar(Campo.left+2, Campo.up+3+RoW*/*9*/14+2, Campo.right-2, Campo.up+3+RoW*/*9*/14 + /*9*/16);
|
||||
setcolor(cc);
|
||||
outtextxy( Campo.left+2, Campo.up+/*3*/2+RoW*/*9*//*14*/15, s1 );
|
||||
|
||||
if ( ls < lmax ) {
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+/*3*/2+RoW*/*9*//*14*/15, "<EFBFBD>");
|
||||
setcolor(cc);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
if ( numalp && isdigit(c) && ls < lmax) {
|
||||
*s++ = c;
|
||||
ls++;
|
||||
|
||||
*s = '\0'; // Cero final
|
||||
setcolor(cf);
|
||||
setfillstyle(SOLID_FILL, cf);
|
||||
bar(Campo.left+2, Campo.up+4+RoW*/*9*//*14*/15+2, Campo.right-2, Campo.up+4+RoW*/*9*//*14*/15 + /*9*/16);
|
||||
// bar(Campo.left+2, Campo.up+3+RoW*/*9*/14+2, Campo.right-2, Campo.up+3+RoW*/*9*/14 + /*9*/16);
|
||||
setcolor(cc);
|
||||
|
||||
outtextxy( Campo.left+2, Campo.up+/*3*/2+RoW*/*9*//*14*/15, s1 );
|
||||
|
||||
if ( ls < lmax ) {
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+/*3*/+RoW*/*9*//*14*/15, "<EFBFBD>");
|
||||
setcolor(cc);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
else if( c == 27 ) {*s='\0'; ok = 1; }
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//outtextxy( PS[0].left+2, (PS[0].up+3)+(CurrRowStock1-1)*12, Buffer );
|
||||
|
||||
int InputCadenaG_T4(char *s, int numalp, int lmax, int cc, int cf, struct boton Campo, 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);
|
||||
bar(Campo.left+2, Campo.up+RoW*12+/*2*/4, Campo.right-2, Campo.up+4+RoW*12 + 10);
|
||||
|
||||
setcolor(cc); // devuelve el color a su estado
|
||||
|
||||
outtextxy( Campo.left+2, Campo.up+3+RoW*12, s );
|
||||
|
||||
ls = strlen ( s ); // Longitud de actual
|
||||
|
||||
if ( ls < lmax ) {
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+3+RoW*12, "<EFBFBD>");
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
bar(Campo.left+2, Campo.up+RoW*12+/*2*/4, Campo.right-2, Campo.up+4+RoW*12 + 10);
|
||||
|
||||
setcolor(cc);
|
||||
outtextxy( Campo.left+2, Campo.up+3+RoW*12, s1 );
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+3+RoW*12, "<EFBFBD>");
|
||||
setcolor(cc);
|
||||
|
||||
} else {
|
||||
if ( !numalp && c >= 32 && c <= 254 /* isprint(c) */ && ls < lmax) {
|
||||
|
||||
*s++ = c;
|
||||
ls++;
|
||||
|
||||
*s = '\0';
|
||||
setcolor(cf);
|
||||
setfillstyle(SOLID_FILL, cf);
|
||||
bar(Campo.left+2, Campo.up+RoW*12+/*2*/4, Campo.right-2, Campo.up+4+RoW*12 + 10);
|
||||
setcolor(cc);
|
||||
outtextxy( Campo.left+2, Campo.up+3+RoW*12, s1 );
|
||||
|
||||
if ( ls < lmax ) {
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+3+RoW*12, "<EFBFBD>");
|
||||
setcolor(cc);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
if ( numalp && isdigit(c) && ls < lmax) {
|
||||
*s++ = c;
|
||||
ls++;
|
||||
|
||||
*s = '\0'; // Cero final
|
||||
setcolor(cf);
|
||||
setfillstyle(SOLID_FILL, cf);
|
||||
bar(Campo.left+2, Campo.up+RoW*12+/*2*/4, Campo.right-2, Campo.up+4+RoW*12 + 10);
|
||||
setcolor(cc);
|
||||
|
||||
outtextxy( Campo.left+2, Campo.up+3+RoW*12, s1 );
|
||||
|
||||
if ( ls < lmax ) {
|
||||
setcolor(4);
|
||||
outtextxy( Campo.left+2+textwidth( s1 ), Campo.up+3+RoW*12, "<EFBFBD>");
|
||||
setcolor(cc);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
else if( c == 27 ) {*s='\0'; ok = 1; }
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
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;
|
||||
}
|
Reference in New Issue
Block a user