home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 26 / CD_ASCQ_26_1295.iso / vrac / tvme30.zip / TVEDIT.H < prev    next >
C/C++ Source or Header  |  1995-08-02  |  5KB  |  177 lines

  1. // File    : TVEDIT.H
  2. // Author  : Eric Woodruff,  CIS ID: 72134,1150
  3. // Updated : Wed 08/02/95 17:54:19
  4. // Note    : Copyright 1994-95, Eric Woodruff, All rights reserved
  5. // Compiler: Borland C++ 3.1 to 4.xx
  6. //
  7. // Header file for the Virtual Memory Text Editor demo.
  8. //
  9.  
  10. #if !defined(__FLAT__)
  11.  
  12. #if !defined(_NEAR)
  13. #define _NEAR   near
  14. #endif
  15.  
  16. #if !defined(_FAR)
  17. #define _FAR    far
  18. #endif
  19.  
  20. #endif
  21.  
  22. const
  23.     cmAbout         = 100,          // Standard event values.
  24.     cmRepaint       = 101,
  25.     cmColors        = 102,
  26.     cmChangePalettes = 103,
  27.     cmLoadCfg       = 104,
  28.     cmSaveCfg       = 105,
  29.     cmScreenSize    = 106,
  30.     cmUserScreen    = 107,
  31.  
  32. #if _TV_VERSION == 0x0103           // Other command values.
  33.     cmNew        = 108,             // These first few are already defined
  34.     cmOpen       = 109,             // in TV 2.0.
  35.     cmChDir      = 110,
  36.     cmDosShell   = 111,
  37.     cmCloseAll   = 112,
  38. #endif
  39.     cmShowClip   = 113,
  40.     cmRecord     = 114,
  41.     cmPlay       = 115,
  42.     cmDefaultEditorOpt = 116,
  43.     cmStartUpOpt = 117,
  44.  
  45.     cmMemoDemo   = 118,             // Demo stuff.
  46.     cmKeyHelp    = 119,
  47.     cmMsgViewer  = 120,
  48.     cmReplaceKeyMaps = 121,
  49.     cmCSHColors  = 122,
  50.     cmGetSelText = 123;
  51.  
  52. // Start up options structure and EdOpts bit values.
  53. struct StartUp
  54. {
  55.     ushort EdOpts;
  56. #if !defined(__DPMI16__) && !defined(__DPMI32__)
  57.     ushort VirtualMemory;
  58.     short  bufSizeInK;
  59. #else
  60.     short  bufSizeInK;
  61.     short  MaxAllocatable;
  62. #endif
  63. };
  64.  
  65. #define soIndicAtTop    0x01
  66. #define soSaveDeskTop   0x02
  67. #define soUseCSH        0x04
  68.  
  69. // Data structure for the demo.
  70. struct DemoData
  71. {
  72.     ushort  Size1;            // The real size of this memo.
  73.     char    ShortText[255];   // A short memo.
  74.  
  75.     ushort  Size2;            // The real size of this memo.
  76.     char    LongText[1024];   // A long memo.
  77. };
  78.  
  79. #if defined(Uses_TVMEditorApp)
  80.  
  81. #if !defined(__STDIO_H)
  82. #include <stdio.h>        // Needed by FILE * for the macro file.
  83. #endif
  84.  
  85. // Exit code values.
  86. #define EXIT_NOERR      0
  87. #define EXIT_RSCERR     1001
  88. #define EXIT_SYNTAX     1002
  89. #define EXIT_SWERR      1003
  90. #define EXIT_GENERR     1004
  91.  
  92. class _FAR TDeskTop;
  93. class _FAR TDialog;
  94. class _FAR TEvent;
  95. class _FAR TMenuBar;
  96. class _FAR TStatusLine;
  97. class _FAR TPalette;
  98.  
  99. #if defined(CSH_LIBRARY)
  100.     class _FAR TCSHEditWindow;      // Uses Color Syntax Highlighting
  101. #endif
  102. class _FAR TVMEditWindow;
  103.  
  104. #ifdef INCLUDE_HEAPVIEW
  105. class _FAR THeapView;
  106. #endif
  107.  
  108. class TVMEditorApp : public TApplication
  109. {
  110. public:
  111.     static FILE * _NEAR MacroFile;       // Macro file pointer.
  112.     static ushort _NEAR MacroStatus;     // Macro play/record status.
  113.  
  114.     TVMEditorApp(void);
  115.     static TMenuBar *initMenuBar(TRect r);
  116.     static TStatusLine *initStatusLine(TRect r);
  117.     static TDeskTop *initDeskTop(TRect r);
  118.  
  119.     virtual void initScreen();                  // Sets correct palette.
  120.     virtual void idle(void);
  121.     virtual void getEvent(TEvent &event);
  122.     virtual void handleEvent(TEvent &event);
  123.     virtual void outOfMemory(void);
  124.     virtual TPalette& getPalette() const;
  125.  
  126.     void loadConfig(Boolean UseFileSetting);
  127.     void saveConfig(void);
  128.     void saveDeskTop(void);
  129.     void restoreDeskTop(void);
  130.  
  131. private:
  132. #ifdef INCLUDE_HEAPVIEW
  133.     THeapView *heap;
  134. #endif
  135.  
  136.     // State of CAPS, ScrollLock, and NumLock for the editors.
  137.     // NOTE: This variable along with the overridden idle() function must
  138.     // be present in the application class if the editor indicators are to
  139.     // display the proper CAPS, ScrollLock, and NumLock settings at all times.
  140.     uchar kbFlags;
  141.  
  142. #if defined(CSH_LIBRARY)
  143.     TCSHEditWindow *openEditor(const char *fName, Boolean visible);
  144. #else
  145.     TVMEditWindow *openEditor(const char *fName, Boolean visible);
  146. #endif
  147.  
  148.     void ReplaceKeyMaps(void);
  149.     void MemoDemo(void);
  150.     void DemoMsgViewer(void);
  151.     void testGetText(void);
  152.  
  153. #if defined(CSH_LIBRARY)
  154.     void setCSHColors(void);
  155. #endif
  156. };
  157.  
  158. // A couple of useful functions.
  159. #if _TV_VERSION == 0x0103
  160. ushort executeDialog(TDialog *d, void *data);
  161. #endif
  162. Boolean isTileable(TView *p, void *);
  163.  
  164. // Other stuff.
  165. extern TVMEditWindow *clipWindow;
  166.  
  167. class _FAR TDialog;
  168.  
  169. ushort   doEditDialog(int dialog, ...);
  170. ushort   doMemoEditDialog(int dialog, ...);
  171.  
  172. #ifdef __TVMEDITOR_CODES
  173. void doSignsOfLife(SignsOfLife lifeSign, ushort cmnd, long count, long total);
  174. #endif
  175.  
  176. #endif
  177.