Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
3.5 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. Zippy Main Window
  5. Abstract:
  6. This class implements the main window for zippy as well as controlling
  7. its child windows.
  8. Author:
  9. Marc Reyhner 8/28/2000
  10. --*/
  11. #ifndef __ZIPPYWINDOW_H__
  12. #define __ZIPPYWINDOW_H__
  13. #include "eZippy.h"
  14. // The number of colors we remember
  15. #define COLOR_HISTORY_COUNT 100
  16. // Struct representing a remembered thread color
  17. typedef struct _THREADCOLOR {
  18. DWORD processId;
  19. DWORD threadId;
  20. COLORREF color;
  21. } THREADCOLOR, FAR *LPTHREADCOLOR;
  22. typedef struct _SAVEDOUTPUT {
  23. DWORD procID;
  24. LPTSTR text;
  25. UINT len;
  26. struct _SAVEDOUTPUT *next;
  27. } SAVEDOUTPUT, FAR *LPSAVEDOUTPUT;
  28. class CTraceManager;
  29. class CZippyWindow
  30. {
  31. public:
  32. CZippyWindow();
  33. virtual ~CZippyWindow();
  34. DWORD Create(CTraceManager *rTracer);
  35. VOID AppendTextToWindow(DWORD processID, LPCTSTR text,UINT len);
  36. VOID LoadConfFile(LPTSTR confFile);
  37. BOOL IsDialogMessage(LPMSG lpMsg);
  38. INT WINAPI TranslateAccelerator(HACCEL hAccTable,LPMSG lpMsg);
  39. private:
  40. static BOOL gm_Inited;
  41. static ATOM gm_Atom;
  42. static UINT gm_FindMessageStringMsg;
  43. HWND m_hWnd;
  44. HWND m_hControlWnd;
  45. HWND m_hStatusWnd;
  46. HWND m_hWndFindReplace;
  47. BOOL m_bIsTracing;
  48. BOOL m_bIsStoringTraceData;
  49. BOOL m_bIsFindNotReplace;
  50. UINT m_nextThreadIndex;
  51. UINT m_nextThreadColor;
  52. DWORD m_lastProcessId;
  53. DWORD m_LastLogEndedInNewLine;
  54. HANDLE m_hAppendMutex;
  55. TCHAR m_SaveFile[MAX_STR_LEN];
  56. TCHAR m_SaveConfFile[MAX_STR_LEN];
  57. TCHAR m_LoadConfFile[MAX_STR_LEN];
  58. FINDREPLACE m_FindReplace;
  59. THREADCOLOR m_threadHistory[COLOR_HISTORY_COUNT];
  60. LPSAVEDOUTPUT m_lpSavedOutputStart;
  61. LPSAVEDOUTPUT m_lpSavedOutputTail;
  62. CTraceManager *m_rTracer;
  63. static DWORD _InitClassStaticMembers();
  64. static LRESULT CALLBACK _WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam,
  65. LPARAM lParam);
  66. LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam,
  67. LPARAM lParam);
  68. // Window message handlers
  69. LRESULT OnCreate(HWND hWnd);
  70. VOID OnMenuSelect(WPARAM wParam, LPARAM lParam);
  71. VOID OnSize(INT width, INT height);
  72. VOID OnSetFocus();
  73. VOID OnInitMenuPopup(WPARAM wParam, LPARAM lParam);
  74. VOID OnFindMessageString(LPARAM lParam);
  75. VOID OnClose();
  76. VOID OnDestroy();
  77. //
  78. // WM_COMMAND handler and all the helper functions for the various
  79. // command.
  80. //
  81. VOID OnCommand(WPARAM wParam, LPARAM lParam);
  82. VOID OnSave();
  83. VOID OnSaveAs();
  84. VOID OnLoadConfiguration();
  85. VOID OnSaveConfiguration();
  86. VOID OnSaveConfigurationAs();
  87. VOID OnExit();
  88. VOID OnUndo();
  89. VOID OnRedo();
  90. VOID OnCut();
  91. VOID OnCopy();
  92. VOID OnPaste();
  93. VOID OnSelectAll();
  94. VOID OnFind();
  95. VOID OnFindNext();
  96. VOID OnReplace();
  97. VOID OnChangeStatusBar();
  98. VOID OnStartTracing();
  99. VOID OnStopTracing();
  100. VOID OnRecordTracing();
  101. VOID OnClearScreen();
  102. VOID OnResetTraceFiles();
  103. VOID OnPreferences();
  104. VOID OnAbout();
  105. // Internal helper functions
  106. VOID DoLoadConfInternal();
  107. VOID DoSaveConfInternal();
  108. VOID DoReplaceAll(LPFINDREPLACE lpFindReplace);
  109. BOOL DoReplace(LPFINDREPLACE lpFindReplace);
  110. BOOL DoFindNext(LPFINDREPLACE lpFindReplace);
  111. VOID DoSaveInternal();
  112. LPTHREADCOLOR FindColorForThread(DWORD processId, DWORD threadId);
  113. DWORD ConvertHexStrToDword(LPCTSTR str, UINT strLen);
  114. BOOL ComputeNewColor(DWORD processID, LPCTSTR text, UINT len, CHARFORMAT *lpFormat);
  115. VOID GetSavedWindowPos(LPRECT savedPos);
  116. VOID SaveWindowPos(LPRECT newPos);
  117. };
  118. #endif