home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / vrac / ve2tv103.zip / TVEDIT.H < prev    next >
C/C++ Source or Header  |  1994-07-31  |  4KB  |  161 lines

  1. // File    : TVEDIT.H
  2. // Author  : Eric Woodruff,  CIS ID: 72134,1150
  3. // Updated : Sun 07/31/94 15:56:28
  4. // Note    : Copyright 1994, Eric Woodruff, All rights reserved
  5. // Compiler: Borland C++ 3.1 to 4.02
  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.  
  50. // Start up options structure
  51. struct StartUp
  52. {
  53.     ushort EdOpts;
  54. #if !defined(__DPMI16__) && !defined(__DPMI32__)
  55.     ushort VirtualMemory;
  56.     short  bufSizeInK;
  57. #else
  58.     short  bufSizeInK;
  59.     short  MaxAllocatable;
  60. #endif
  61. };
  62.  
  63. #define IndAtTop    0x01
  64. #define SaveDeskTop 0x02
  65.  
  66. // Data structure for the demo.
  67. struct DemoData
  68. {
  69.     ushort  Size1;            // The real size of this memo.
  70.     char    ShortText[255];   // A short memo.
  71.  
  72.     ushort  Size2;            // The real size of this memo.
  73.     char    LongText[1024];   // A long memo.
  74. };
  75.  
  76. #if defined(Uses_TVMEditorApp)
  77.  
  78. #if !defined(__STDIO_H)
  79. #include <stdio.h>        // Needed by FILE * for the macro file.
  80. #endif
  81.  
  82. // Exit code values.
  83. #define EXIT_NOERR      0
  84. #define EXIT_RSCERR     1
  85. #define EXIT_SYNTAX     2
  86. #define EXIT_SWERR      3
  87. #define EXIT_GENERR     4
  88.  
  89. class _FAR TDeskTop;
  90. class _FAR TDialog;
  91. class _FAR TEvent;
  92. class _FAR TMenuBar;
  93. class _FAR TStatusLine;
  94. class _FAR TPalette;
  95. class _FAR TVMEditWindow;
  96.  
  97. #ifdef INCLUDE_HEAPVIEW
  98. class _FAR THeapView;
  99. #endif
  100.  
  101. class TVMEditorApp : public TApplication
  102. {
  103. public:
  104.     static FILE * _NEAR MacroFile;       // Macro file pointer.
  105.     static ushort _NEAR MacroStatus;     // Macro play/record status.
  106.  
  107.     TVMEditorApp(void);
  108.     static TMenuBar *initMenuBar(TRect r);
  109.     static TStatusLine *initStatusLine(TRect r);
  110.     static TDeskTop *initDeskTop(TRect r);
  111.  
  112.     virtual void initScreen();                  // Sets correct palette.
  113.     virtual void idle(void);
  114.     virtual void getEvent(TEvent &event);
  115.     virtual void handleEvent(TEvent &event);
  116.     virtual void outOfMemory(void);
  117.     virtual TPalette& getPalette() const;
  118.  
  119.     void loadConfig(Boolean UseFileSetting);
  120.     void saveConfig(void);
  121.     void saveDeskTop(void);
  122.     void restoreDeskTop(void);
  123.  
  124. private:
  125. #ifdef INCLUDE_HEAPVIEW
  126.     THeapView *heap;
  127. #endif
  128.  
  129.     // State of CAPS, ScrollLock, and NumLock for the editors.
  130.     // NOTE: This variable along with the overridden idle() function must
  131.     // be present in the application class if the editor indicators are to
  132.     // display the proper CAPS, ScrollLock, and NumLock settings at all times.
  133.     uchar kbFlags;
  134.  
  135.     TVMEditWindow *openEditor(char *fileName, Boolean visible);
  136.  
  137.     void ReplaceKeyMaps(void);
  138.     void MemoDemo(void);
  139.     void DemoMsgViewer(void);
  140. };
  141.  
  142. // A couple of useful functions.
  143. #if _TV_VERSION == 0x0103
  144. ushort executeDialog(TDialog *d, void *data);
  145. #endif
  146. Boolean isTileable(TView *p, void *);
  147.  
  148. // Other stuff.
  149. extern TVMEditWindow *clipWindow;
  150.  
  151. class _FAR TDialog;
  152.  
  153. ushort   doEditDialog(int dialog, ...);
  154. ushort   doMemoEditDialog(int dialog, ...);
  155.  
  156. #ifdef __TVMEDITOR_CODES
  157. void doSignsOfLife(SignsOfLife lifeSign, ushort cmnd, long count, long total);
  158. #endif
  159.  
  160. #endif
  161.