EURO_INP.CPP 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <conio.h>
  5. #include "eurodefs.h"
  6. #include "euro_fxd.h"
  7. #include "euro.equ"
  8. #include "euro_sym.h"
  9. #include "euro_def.h"
  10. #include "euro_var.h"
  11. #include "euro_gen.h"
  12. #include "euro_grf.h"
  13. #include "euro_dsk.h"
  14. #include "euro_fix.h"
  15. #include "euro_sel.h"
  16. #include "euro_inf.h"
  17. #include "euro_cnt.h"
  18. #include "euro_usr.h"
  19. #include "euro_net.h"
  20. #include "euro_spt.h"
  21. #include "defines.h"
  22. extern char return_doskey;
  23. //********************************************************************************************************************************
  24. short DoTextINPUT( char *string, short cursor, short MaxChars, char input, char state )
  25. {
  26. return_doskey = TRUE;
  27. strcpy( TextEditBuffer, string );
  28. short StringLength = strlen (string);
  29. if (kbhit())
  30. {
  31. if ( (KeyInput[0] = getch()) == 0)
  32. KeyInput[1] = getch();
  33. // Function Key Controlers
  34. if (KeyInput[0]==0)
  35. {
  36. //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  37. //º LEFT ARROW º
  38. //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  39. if ( KeyInput[1]==L_ARROW && cursor > 0 )
  40. cursor--;
  41. //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  42. //º RIGHT ARROW º
  43. //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  44. if ( KeyInput[1]==R_ARROW && cursor < StringLength )
  45. cursor++;
  46. //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  47. //º HOME º
  48. //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  49. if ( KeyInput[1]==HOME )
  50. cursor = 0;
  51. //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  52. //º END º
  53. //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  54. if ( KeyInput[1]==END )
  55. cursor = StringLength;
  56. //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  57. //º DELETE º
  58. //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  59. if ( KeyInput[1]==DELETE && cursor < StringLength )
  60. for ( short c=cursor; c < StringLength+1; c++)
  61. { TextEditBuffer[c] = TextEditBuffer[c+1]; }
  62. }
  63. else
  64. // Normal Key Control
  65. {
  66. //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  67. //º BACKSPACE º
  68. //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  69. if ( KeyInput[0]==B_SPACE && cursor > 0 )
  70. { for ( short c=cursor; c < StringLength+1; c++)
  71. { TextEditBuffer[c-1] = TextEditBuffer[c]; } cursor--;}
  72. //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  73. //º RETURN º
  74. //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  75. if ( KeyInput[0]==RETURN )
  76. EuroTextEditState = 0;
  77. //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  78. //º NORMAL KEYPRESS º
  79. //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  80. if ( KeyInput[0] > 31 &&
  81. KeyInput[0] < 128 &&
  82. StringLength < MaxChars &&
  83. state == ENABLE_INPUT)
  84. {
  85. if ( (input == NORMAL) || (input == DIAL && LegalDial[ KeyInput[0] ] < 128) )
  86. {
  87. if ( cursor < (StringLength+1) )
  88. for ( short c=StringLength+3; c > cursor; c--)
  89. { TextEditBuffer[c] = TextEditBuffer[c-1]; }
  90. TextEditBuffer[cursor] = KeyInput[0];
  91. cursor++;
  92. }
  93. }
  94. }
  95. return_doskey = FALSE;
  96. }
  97. return(cursor);
  98. }