1 // stdafx.h : include file for standard system include files,
2 // or project specific include files that are used frequently, but
3 // are changed infrequently
8 * @brief Project-wide includes and declarations
12 // On Win XP, with VS2008, do not use default WINVER 0x0600 because of
13 // some windows structure used in API (on VISTA they are longer)
15 # define WINVER 0x0501
16 #endif /* !defined(WINVER) */
18 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
22 #include <afxwin.h> // MFC core and standard components
23 #include <afxext.h> // MFC extensions
24 #include <afxcmn.h> // MFC support for Windows Common Controls
26 #include <afxtempl.h> // MFC C++ template collection classes
27 #include <afxpriv.h> // MFC private declarations (crystal text needs but doesn't include this)
28 #include <afxole.h> // MFC OLE (COM) support
32 // For CSizingControlBar
39 #include <unordered_set>
50 #include <boost/flyweight.hpp>
53 * @name User-defined Windows-messages
56 /// Directory compare thread asks UI (view) update
57 const UINT MSG_UI_UPDATE = WM_USER + 1;
58 /// Request to save panesizes
59 const UINT MSG_STORE_PANESIZES = WM_USER + 2;
60 /// Request to generate file compare report
61 const UINT MSG_GENERATE_FLIE_COMPARE_REPORT = WM_USER + 3;
64 /// Seconds ignored in filetime differences if option enabled
65 static const UINT SmallTimeDiff = 2;
67 #include "UnicodeString.h"
70 /** @brief Wrapper around CMergeApp::TranslateDialog() */
71 void NTAPI LangTranslateDialog(HWND);
73 /** @brief Lang aware version of AfxMessageBox() */
74 int NTAPI LangMessageBox(UINT, UINT nType = MB_OK, UINT nIDHelp = (UINT)-1);
76 /** @brief include for the custom dialog boxes, with do not ask/display again */
77 #include "MessageBoxDialog.h"
82 #define _MAX_PATH (260 * sizeof(wchar_t) / sizeof(tchar_t))
87 #define MAX_PATH (260 * sizeof(wchar_t) / sizeof(tchar_t))
92 #define MAX_PATH_FULL (32767 * sizeof(wchar_t) / sizeof(tchar_t))
94 #define WMPROFILE(x) CWinMergeProfile __wmtl__(x)
96 class CWinMergeProfile
100 static CMapStringToPtr map;
101 static LARGE_INTEGER origin;
104 tchar_t funcname[256];
106 explicit CWinMergeProfile(const tchar_t* pFuncName) {
108 _stprintf_s(buf, _T("%-*s funcname=%s Start\n"), level, L"", pFuncName);
109 OutputDebugString(buf);
110 lstrcpy(funcname, pFuncName);
111 QueryPerformanceFrequency(&freq);
112 QueryPerformanceCounter(&li[0]);
113 if (origin.QuadPart == 0)
117 ~CWinMergeProfile() {
118 QueryPerformanceCounter(&li[1]);
121 int elapsed = (int)((double)(li[1].QuadPart - li[0].QuadPart) / freq.QuadPart*1000.0*1000.0);
122 int tim = (int)((double)(li[1].QuadPart - origin.QuadPart) / freq.QuadPart*1000.0*1000.0);
127 void *pstatv = nullptr;
128 if (!map.Lookup(funcname, pstatv))
131 map[funcname] = (void *)pstat;
135 pstat = reinterpret_cast<stat *>(pstatv);
137 pstat->sum += elapsed;
139 _stprintf_s(buf, _T("%-*s funcname=%s t=%d[us] count=%d sum=%d[us] time=%g[ms]\n"), level, L"", funcname, elapsed, pstat->count, pstat->sum, tim/1000.0);
140 OutputDebugString(buf);
142 static void ResetTimer()
144 QueryPerformanceCounter(&origin);
146 static void Terminiate()