home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 9.ddi / TVSRC.ZIP / TVTEXT2.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  4.8 KB  |  144 lines

  1. /*------------------------------------------------------------*/
  2. /* filename -       tvtext2.cpp                               */
  3. /*                                                            */
  4. /*------------------------------------------------------------*/
  5.  
  6. /*------------------------------------------------------------*/
  7. /*                                                            */
  8. /*    Turbo Vision -  Version 1.0                             */
  9. /*                                                            */
  10. /*                                                            */
  11. /*    Copyright (c) 1991 by Borland International             */
  12. /*    All Rights Reserved.                                    */
  13. /*                                                            */
  14. /*------------------------------------------------------------*/
  15.  
  16. #define Uses_TEditWindow
  17. #define Uses_TFileList
  18. #define Uses_TProgram
  19. #define Uses_MsgBox
  20. #define Uses_TChDirDialog
  21. #define Uses_TFileDialog
  22. #define Uses_TFileInfoPane
  23. #define Uses_TSystemError
  24. #define Uses_TDeskTop
  25. #include <tv.h>
  26.  
  27. #if !defined( __CTYPE_H )
  28. #include <ctype.h>
  29. #endif  // __CTYPE_H
  30.  
  31. static const char altCodes1[] =
  32.     "QWERTYUIOP\0\0\0\0ASDFGHJKL\0\0\0\0\0ZXCVBNM";
  33. static const char altCodes2[] = "1234567890-=";
  34.  
  35. #pragma warn -rng
  36.  
  37. char getAltChar(ushort keyCode)
  38. {
  39.     if ((keyCode & 0xff) == 0)
  40.         {
  41.         ushort tmp = (keyCode >> 8);
  42.  
  43.         if( tmp == 2 )
  44.             return '\xF0';      // special case to handle alt-Space
  45.  
  46.         else if( tmp >= 0x10 && tmp <= 0x32 )
  47.             return altCodes1[tmp-0x10];     // alt-letter
  48.  
  49.         else if( tmp >= 0x78 && tmp <= 0x83 )
  50.             return altCodes2[tmp - 0x78];   // alt-number
  51.  
  52.         }
  53.     return 0;
  54. }
  55.  
  56. ushort getAltCode(char c)
  57. {
  58.     if( c == 0 )
  59.         return 0;
  60.  
  61.     c = toupper(c);
  62.  
  63.     if( unsigned(c) == '\xF0' )
  64.         return 0x200;       // special case to handle alt-Space
  65.  
  66.     for( int i = 0; i < sizeof( altCodes1 ); i++)
  67.        if( altCodes1[i] == c )
  68.         return (i+0x10) << 8;
  69.  
  70.     for( i = 0; i < sizeof( altCodes2); i++)
  71.         if (altCodes2[i] == c)
  72.             return (i+0x78) << 8;
  73.  
  74.     return 0;
  75. }
  76.  
  77. #pragma warn .rng
  78.  
  79. const char * near TEditWindow::clipboardTitle = "Clipboard";
  80. const char * near TEditWindow::untitled = "Untitled";
  81.  
  82. const char * near TFileList::tooManyFiles = "Too many files.";
  83.  
  84. const char * near TProgram::exitText = "~Alt-X~ Exit";
  85.  
  86. const char * near MsgBoxText::yesText = "~Y~es";
  87. const char * near MsgBoxText::noText = "~N~o";
  88. const char * near MsgBoxText::okText = "O~K~";
  89. const char * near MsgBoxText::cancelText = "Cancel";
  90. const char * near MsgBoxText::warningText = "Warning";
  91. const char * near MsgBoxText::errorText = "Error";
  92. const char * near MsgBoxText::informationText = "Information";
  93. const char * near MsgBoxText::confirmText = "Confirm";
  94.  
  95. const char * near TChDirDialog::changeDirTitle = "Change Directory";
  96. const char * near TChDirDialog::dirNameText = "Directory ~n~ame";
  97. const char * near TChDirDialog::dirTreeText = "Directory ~t~ree";
  98. const char * near TChDirDialog::okText = "O~K~";
  99. const char * near TChDirDialog::chdirText = "~C~hdir";
  100. const char * near TChDirDialog::revertText = "~R~evert";
  101. const char * near TChDirDialog::helpText = "Help";
  102. const char * near TChDirDialog::drivesText = "Drives";
  103. const char * near TChDirDialog::invalidText = "Invalid directory";
  104.  
  105. const char * near TFileDialog::filesText = "~F~iles";
  106. const char * near TFileDialog::openText = "~O~pen";
  107. const char * near TFileDialog::okText = "O~K~";
  108. const char * near TFileDialog::replaceText = "~R~eplace";
  109. const char * near TFileDialog::clearText = "~C~lear";
  110. const char * near TFileDialog::cancelText = "Cancel";
  111. const char * near TFileDialog::helpText = "~H~elp";
  112. const char * near TFileDialog::invalidDriveText = "Invalid drive or directory";
  113. const char * near TFileDialog::invalidFileText = "Invalid file name.";
  114.  
  115. const char * near TFileInfoPane::pmText = "p";
  116. const char * near TFileInfoPane::amText = "a";
  117. const char * const near TFileInfoPane::months[] =
  118.     {
  119.     "","Jan","Feb","Mar","Apr","May","Jun",
  120.     "Jul","Aug","Sep","Oct","Nov","Dec"
  121.     };
  122.  
  123. const char * const near TSystemError::errorString[] =
  124. {
  125.     "Critical disk error on drive %c",
  126.     "Disk is write-protected in drive %c",
  127.     "Disk is not ready in drive %c",
  128.     "Data integrity error on drive %c",
  129.     "Seek error on drive %c",
  130.     "Unknown media type in drive %c",
  131.     "Sector not found on drive %c",
  132.     "Printer out of paper",
  133.     "Write fault on drive %c",
  134.     "Read fault on drive %c",
  135.     "Hardware failure on drive %c",
  136.     "Bad memory image of FAT detected",
  137.     "Device access error",
  138.     "Insert diskette in drive %c"
  139. };
  140.  
  141. const char * near TSystemError::sRetryOrCancel = "~Enter~ Retry  ~Esc~ Cancel";
  142.  
  143. const char near TDeskTop::defaultBkgrnd = '\xB0';
  144.