123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <conio.h>
- #include "eurodefs.h"
- #include "euro_fxd.h"
- #include "euro.equ"
- #include "euro_sym.h"
- #include "euro_def.h"
- #include "euro_var.h"
- #include "euro_gen.h"
- #include "euro_grf.h"
- #include "euro_dsk.h"
- #include "euro_fix.h"
- #include "euro_sel.h"
- #include "euro_inf.h"
- #include "euro_cnt.h"
- #include "euro_usr.h"
- #include "euro_net.h"
- #include "euro_spt.h"
- #include "defines.h"
- extern char return_doskey;
- //********************************************************************************************************************************
- short DoTextINPUT( char *string, short cursor, short MaxChars, char input, char state )
- {
- return_doskey = TRUE;
- strcpy( TextEditBuffer, string );
- short StringLength = strlen (string);
-
- if (kbhit())
- {
- if ( (KeyInput[0] = getch()) == 0)
- KeyInput[1] = getch();
- // Function Key Controlers
- if (KeyInput[0]==0)
- {
- //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
- //º LEFT ARROW º
- //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
- if ( KeyInput[1]==L_ARROW && cursor > 0 )
- cursor--;
-
- //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
- //º RIGHT ARROW º
- //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
- if ( KeyInput[1]==R_ARROW && cursor < StringLength )
- cursor++;
- //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
- //º HOME º
- //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
- if ( KeyInput[1]==HOME )
- cursor = 0;
- //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
- //º END º
- //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
- if ( KeyInput[1]==END )
- cursor = StringLength;
- //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
- //º DELETE º
- //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
- if ( KeyInput[1]==DELETE && cursor < StringLength )
- for ( short c=cursor; c < StringLength+1; c++)
- { TextEditBuffer[c] = TextEditBuffer[c+1]; }
- }
- else
- // Normal Key Control
- {
- //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
- //º BACKSPACE º
- //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
- if ( KeyInput[0]==B_SPACE && cursor > 0 )
- { for ( short c=cursor; c < StringLength+1; c++)
- { TextEditBuffer[c-1] = TextEditBuffer[c]; } cursor--;}
- //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
- //º RETURN º
- //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
- if ( KeyInput[0]==RETURN )
- EuroTextEditState = 0;
-
- //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
- //º NORMAL KEYPRESS º
- //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
- if ( KeyInput[0] > 31 &&
- KeyInput[0] < 128 &&
- StringLength < MaxChars &&
- state == ENABLE_INPUT)
- {
- if ( (input == NORMAL) || (input == DIAL && LegalDial[ KeyInput[0] ] < 128) )
- {
- if ( cursor < (StringLength+1) )
- for ( short c=StringLength+3; c > cursor; c--)
- { TextEditBuffer[c] = TextEditBuffer[c-1]; }
- TextEditBuffer[cursor] = KeyInput[0];
- cursor++;
- }
- }
- }
- return_doskey = FALSE;
- }
-
- return(cursor);
- }
|