home *** CD-ROM | disk | FTP | other *** search
/ Sound Sensations! / sound_sensations.iso / soundb / sndhack / edit.c < prev    next >
C/C++ Source or Header  |  1991-07-31  |  3KB  |  112 lines

  1. #include <windows.h>
  2. #include "app.h"
  3.  
  4. /*
  5.  * Module: edit.c
  6.  *
  7.  * Contains: Edit window specific functions.  Messages
  8.  * and menu commands directed to the Edit window should
  9.  * be located here.
  10.  *
  11.  */
  12.  
  13.  
  14. /*********************************************************************/
  15. /* Local Function Prototypes                                         */
  16. /*********************************************************************/
  17.  
  18.  
  19. /*********************************************************************/
  20. /* Local data and structures                                         */
  21. /*********************************************************************/
  22.  
  23.  
  24. /*********************************************************************/
  25. /* Global functions                                                  */
  26. /*********************************************************************/
  27.  
  28. /*-------------------------------------------------------------------*/
  29. /* Edit window message processor                                     */
  30. /*-------------------------------------------------------------------*/
  31.  
  32. long EditProc(hWnd, message, wParam, lParam)
  33. HWND       hWnd;
  34. unsigned   message;
  35. WORD       wParam;
  36. LONG       lParam;
  37. {
  38.   switch (message) {
  39.  
  40.     case WM_SETFOCUS:
  41.       SetFocus(hEditWindow);
  42.       break;
  43.  
  44.     case WM_SIZE:
  45.       MoveWindow(hEditWindow, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
  46.       break;
  47.  
  48.     default:
  49.       return(DefWindowProc(hWnd, message, wParam, lParam));
  50.     }
  51.  
  52.   return(0L);
  53. }
  54.  
  55. /*-------------------------------------------------------------------*/
  56. /* Edit window command processor                                     */
  57. /*-------------------------------------------------------------------*/
  58.  
  59. void EditMenuCommand(hWnd, id)
  60. HWND hWnd;
  61. int id;
  62. {
  63.   LPSTR lpszText;
  64.  
  65.   switch (id) {
  66.     case IDM_UNDO:
  67.       SendMessage(hEditWindow,WM_UNDO,0,0L);
  68.       break;
  69.  
  70.     case IDM_CLEAR:
  71.       SendMessage(hEditWindow,WM_CLEAR,0,0L);
  72.       break;
  73.  
  74.     case IDM_CUT:
  75.       SendMessage(hEditWindow,WM_CUT,0,0L);
  76.       break;
  77.  
  78.     case IDM_COPY:
  79.       SendMessage(hEditWindow,WM_COPY,0,0L);
  80.       break;
  81.  
  82.     case IDM_PASTE:
  83.       SendMessage(hEditWindow,WM_PASTE,0, 0L);
  84.       break;
  85.  
  86.     default:
  87.       break;
  88.   }
  89. }
  90.  
  91.  
  92. /*-------------------------------------------------------------------*/
  93. /* Stuff some text into the Edit window.  Okay, okay I suppose the   */
  94. /* real way to do this is to copy text into the clipboard and from   */
  95. /* there insert it into the Edit window.  But after all, this is a   */
  96. /* Sound *Hack* utility and by actually sending the Edit window a    */
  97. /* message that it has received a character the job gets done.       */
  98. /*-------------------------------------------------------------------*/
  99.  
  100. void EditPutString(str)
  101. char *str;
  102. {
  103.   while (*str)
  104.     SendMessage(hEditWindow, WM_CHAR, *str++, 0L);
  105. }
  106.  
  107.  
  108. /**********************************************************************/
  109. /* Local functions                                                    */
  110. /**********************************************************************/
  111.  
  112.