home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / w3_prog / zap.arj / ZAP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-29  |  5.1 KB  |  148 lines

  1. /***********************************************************************
  2. * Zap                                                                  *
  3. * ===                                                                  *
  4. *                                                                      *
  5. * Windows 3 Text Editor                                                *
  6. *                                                                      *
  7. * This programme was developed using Microsoft C6.0 and the Microsoft  *
  8. * SDK, however any ANSI C could be used if suitable libraries and the  *
  9. * Windows header are available.                                        *
  10. ***********************************************************************/
  11.  
  12.  
  13. /***********************************************************************
  14. * Menu Items                                                           *
  15. ***********************************************************************/
  16.  
  17. #define IDM_FILE_NEW    100
  18. #define IDM_FILE_OPEN   101
  19. #define IDM_FILE_INSERT 102
  20. #define IDM_FILE_SAVE   103
  21. #define IDM_FILE_SAVEAS 104
  22. #define IDM_FILE_PRINT  105
  23. #define IDM_FILE_EXIT   106
  24. #define IDM_FILE_ABOUT  107
  25.  
  26. #define IDM_EDIT_UNDO           110
  27. #define IDM_EDIT_CUT            111
  28. #define IDM_EDIT_COPY           112
  29. #define IDM_EDIT_PASTE          113
  30. #define IDM_EDIT_CLEAR          114
  31. #define IDM_EDIT_SELECTALL      115
  32. #define IDM_EDIT_SEARCH         116
  33. #define IDM_EDIT_REPLACE        117
  34.  
  35. #define IDM_WINDOW_OPEN         120
  36. #define IDM_WINDOW_CLOSE        121
  37.  
  38.  
  39. /***********************************************************************
  40. * Control IDs                                                          *
  41. ***********************************************************************/
  42.  
  43. #define IDC_EDIT 200
  44.  
  45.  
  46. /***********************************************************************
  47. * System Constants                                                     *
  48. ***********************************************************************/
  49.  
  50. #define INITIAL_WIDTH   80
  51. #define INITIAL_DEPTH   25
  52.  
  53. #define MAX_DOS_NAME    96
  54. #define MAX_FILES       4
  55.  
  56. #define UNTITLED        "Untitled"
  57. /* #define DEFAULT_NAME    "*.*" */
  58.  
  59. #define TRANS_BUF_SIZE  0XC000
  60.  
  61. #define WORK_STR_LEN    256
  62.  
  63.  
  64. /***********************************************************************
  65. * Edit structure                                                       *
  66. ***********************************************************************/
  67.  
  68. typedef struct
  69. { HANDLE  ds;
  70.   HWND    hwnd;
  71.   char    name[MAX_DOS_NAME];
  72.   int     top, status;
  73.   FARPROC proc;
  74. } EDIT_WND;
  75.  
  76.  
  77. /***********************************************************************
  78. * Function Prototypes - main module                                    *
  79. ***********************************************************************/
  80.  
  81. int PASCAL WinMain(HANDLE, HANDLE, LPSTR, int);
  82. BOOL InitApplication(HANDLE);
  83. BOOL InitInstance(HANDLE, int);
  84. long FAR PASCAL MainWndProc(HWND, unsigned, WORD, LONG);
  85. BOOL FAR PASCAL AboutProc(HWND, unsigned, WORD, LONG);
  86. void Comment(char *);
  87.  
  88.  
  89. /***********************************************************************
  90. * Function Prototypes - window management module                       *
  91. ***********************************************************************/
  92.  
  93. BOOL ReadFile(int, BOOL);
  94. BOOL SaveFile(int, BOOL);
  95.  
  96. BOOL CreateEditWindow(void);
  97. void RearrangeEditWindows(void);
  98. void RedrawStatusBar(HDC, int);
  99.  
  100. BOOL SendToClipboard(LPSTR);
  101.  
  102.  
  103. /***********************************************************************
  104. * Function Prototypes - subclassing module                             *
  105. ***********************************************************************/
  106.  
  107. long FAR PASCAL NewEditWndProc(HWND, unsigned, WORD, LONG);
  108.  
  109. BOOL IsSeparator(char);
  110. BOOL IsNotSeparator(char);
  111.  
  112.  
  113. /***********************************************************************
  114. * Function Prototypes - editting functions module                      *
  115. ***********************************************************************/
  116.  
  117. BOOL FAR PASCAL GotoLineProc(HWND, unsigned, WORD, LONG);
  118. long GetCurrentLine(int);
  119. void GotoLine(int, long);
  120.  
  121. BOOL FAR PASCAL SearchProc(HWND, unsigned, WORD, LONG);
  122. BOOL FAR PASCAL ReplaceProc(HWND, unsigned, WORD, LONG);
  123. BOOL FAR PASCAL ConfirmProc(HWND, unsigned, WORD, LONG);
  124.  
  125. void TranslateString(char *, char *);
  126. long lstrstr(LPSTR, LPSTR, BOOL);
  127.  
  128.  
  129. /***********************************************************************
  130. * Function Prototypes - printing module                                *
  131. ***********************************************************************/
  132.  
  133. BOOL PrintFile(int);
  134. int FAR PASCAL AbortProc(HDC, int);
  135. int FAR PASCAL AbortDlg(HWND, unsigned, WORD, LONG);
  136.  
  137.  
  138. /***********************************************************************
  139. * Useful macros                                                        *
  140. ***********************************************************************/
  141.  
  142. #define CurWndProc EditWnd[CurrentFile].proc
  143. #define CurWnd     EditWnd[CurrentFile].hwnd
  144.  
  145. #define CONTROL_DOWN key_state[VK_CONTROL] & 0x80
  146. #define SHIFT_DOWN   key_state[VK_SHIFT]   & 0x80
  147.  
  148.