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.

142 lines
4.4 KiB

  1. //
  2. // CApplicationWindow.H
  3. //
  4. // Application Window Class
  5. //
  6. #ifndef _CAPPLICATIONWINDOW_H_
  7. #define _CAPPLICATIONWINDOW_H_
  8. #define MAX_OPEN_FILES 10
  9. typedef enum _WARNLEVEL {
  10. WarnLevelUnknown,
  11. WarnLevelInfo,
  12. WarnLevelWarn,
  13. WarnLevelError
  14. } WARNLEVEL;
  15. //
  16. // Structures
  17. //
  18. typedef struct _LINEPOINTER {
  19. struct _LINEPOINTER *pNext; // next line
  20. struct _LINEPOINTER *pPrev; // previous line
  21. LPTSTR psLine; // pointer to beggining of line
  22. ULONG uSequenceNumber; // sequence number affliation
  23. FILETIME Time; // adjusted time
  24. ULONG nFile; // file that this line came from
  25. ULONG nLine; // orginal files line number
  26. ULONG nFilterId; // which filter can filter this line
  27. WARNLEVEL WarnLevel; // line warning level
  28. BOOL fSyncPoint:1; // this line being used to synchronize
  29. BOOL fFiltered:1; // TRUE if the line shouldn't be shown
  30. } LINEPOINTER, * LPLINEPOINTER;
  31. //
  32. // CApplicationWindow
  33. //
  34. class
  35. CApplicationWindow
  36. {
  37. private: // data
  38. HWND _hWnd; // our window handle
  39. HMENU _hMenu; // Filter menu handle
  40. TCHAR _szOpenFileNameFilter[ MAX_PATH ];
  41. TEXTMETRIC _tm; // text metrics of text font
  42. LONG _xSpace; // size of a space
  43. LONG _xWindow; // window max X
  44. LONG _yWindow; // window max Y
  45. LONG _xMargin; // margin size
  46. BOOL _fVertSBVisible:1; // is the vertical scroll bar visible?
  47. ULONG _nFiles; // number of files open
  48. LPTSTR _pFiles[ MAX_OPEN_FILES ];
  49. LINEPOINTER * _pNodes[ MAX_OPEN_FILES ];
  50. LPTSTR _pszFilenames[ MAX_OPEN_FILES ];
  51. LINEPOINTER * _pLines;
  52. ULONG _cTotalLineCount;
  53. LINEPOINTER _LineFinder;
  54. ULONG _uFinderLength;
  55. ULONG _uPointer; // current line
  56. ULONG _uStartSelection; // used to highlite and copy text.
  57. ULONG _uEndSelection;
  58. BOOL _fSelection:1; // if we are in selection mode
  59. private: // methods
  60. ~CApplicationWindow( );
  61. HRESULT
  62. Cleanup( BOOL fInitializing = FALSE );
  63. LRESULT
  64. _OnVerticalScroll( WPARAM wParam, LPARAM lParam );
  65. LRESULT
  66. _OnHorizontalScroll( WPARAM wParam, LPARAM lParam );
  67. LRESULT
  68. _OnCommand( WPARAM wParam, LPARAM lParam );
  69. HRESULT
  70. _PaintLine( PAINTSTRUCT * pps, LINEPOINTER *pCurrent, LONG wxStart,
  71. LONG wy, COLORREF crText, COLORREF crDark,
  72. COLORREF crNormal, COLORREF crHightlite );
  73. LRESULT
  74. _OnPaint( WPARAM wParam, LPARAM lParam );
  75. LRESULT
  76. _OnDestroyWindow( );
  77. LRESULT
  78. _OnCreate( );
  79. static LRESULT CALLBACK
  80. About( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  81. HRESULT
  82. _SaveAllFiles( );
  83. static BOOL CALLBACK
  84. _EnumSaveAllFiles( HWND hWnd, LPARAM lParam );
  85. HRESULT
  86. _LoadFile( LPTSTR pszFilename );
  87. BOOL
  88. _FindSequencePoint( LPTSTR * ppszSequence, ULONG * pnSequence );
  89. HRESULT
  90. _CalculateOffset( FILETIME * pftOper1, FILETIME * pftOper2,
  91. INT * pnDir, FILETIME * pftOffset );
  92. HRESULT
  93. _RetrieveTimeDate( LPTSTR pszCurrent, SYSTEMTIME * pst, OUT LPTSTR * ppszFinal );
  94. BOOL
  95. _OnKeyDown( WPARAM wParam, LPARAM lParam );
  96. HRESULT
  97. _UpdateTitle( );
  98. LRESULT
  99. _OnCloseWindow( );
  100. LRESULT
  101. _OnCreate( HWND hwnd, LPCREATESTRUCT pcs );
  102. LRESULT
  103. _OnSize( LPARAM lParam );
  104. LRESULT
  105. _OnMouseWheel( SHORT iDelta );
  106. LRESULT
  107. _FindNext( WPARAM wParam, LPARAM lParam );
  108. LRESULT
  109. _MarkAll( WPARAM wParam, LPARAM lParam );
  110. HRESULT
  111. _FillClipboard( );
  112. HRESULT
  113. _GetFilename( LPTSTR pszFilename, LPTSTR pszFilenameOut, LONG * pcch );
  114. HRESULT
  115. _CombineFiles( );
  116. static LRESULT CALLBACK
  117. _StatusWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
  118. HRESULT
  119. _ApplyFilters( );
  120. LRESULT
  121. _OnLeftButtonDown( WPARAM wParam, LPARAM lParam );
  122. public:
  123. CApplicationWindow( );
  124. static LRESULT CALLBACK
  125. WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
  126. };
  127. typedef CApplicationWindow CAPPLICATIONWINDOW;
  128. typedef CApplicationWindow * PCAPPLICATIONWINDOW, *LPCAPPLICATIONWINDOW;
  129. #endif // _CAPPLICATIONWINDOW_H_