OSDN Git Service

Merge with stable
[winmerge-jp/winmerge-jp.git] / Src / StdAfx.h
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
4 //
5 /**
6  * @file  Src/StdAfx.h
7  *
8  * @brief Project-wide includes and declarations
9  */
10 #pragma once
11
12 #if _MSC_VER >= 1500
13 #if defined _M_IX86
14 #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
15 #elif defined _M_IA64
16 #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
17 #elif defined _M_X64
18 #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
19 #else
20 #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
21 #endif
22 #endif
23
24 // Set WINVER for VC6, VS2005 and VS2008
25 //On VS2003 default is set to 0x0501 (Windows XP and Windows .NET Server)
26 //On VS2005 default is set to 0x0502 (Windows Server 2003)
27 //On VS2008 default is set to 0x0600 (Windows VISTA)
28 //
29 // Set WINVER below or in project properties (for preprocessor)
30
31 #if _MSC_VER < 1300
32 #       define WINVER 0x0400
33 #elif _MSC_VER == 1400
34         // VS2005 is too noisy when _MSC_VER is not set
35 #       if !defined(WINVER)
36 #               define WINVER 0x0501
37 #       endif
38 #elif _MSC_VER >= 1500
39         // On Win XP, with VS2008, do not use default WINVER 0x0600 because of 
40         // some windows structure used in API (on VISTA they are longer)
41 #       if !defined(WINVER)
42 #               define WINVER 0x0501
43 #       endif /* !defined(WINVER) */
44 #endif /* _MSC_VER = 1500 */
45
46 #define VC_EXTRALEAN            // Exclude rarely-used stuff from Windows headers
47
48 // Disable VC6's "identifier was truncated..." warning. It is meaningless.
49 #if _MSC_VER == 1200
50         #pragma warning(disable: 4786)
51 #endif
52  
53 // Common MFC headers
54
55 #include <afxwin.h>         // MFC core and standard components
56 #include <afxext.h>         // MFC extensions
57 #include <afxcmn.h>         // MFC support for Windows Common Controls
58
59 #include <afxtempl.h>       // MFC C++ template collection classes
60 #include <afxpriv.h>        // MFC private declarations (crystal text needs but doesn't include this)
61 #include <afxole.h>         // MFC OLE (COM) support
62
63 // For CSizingControlBar
64 #include "sizecbar.h"
65 #include "scbarg.h"
66
67 #include "coretypes.h"
68
69 #define IF_IS_TRUE_ALL(expression, index, count) \
70         for (index = 0; index < count; index++) { if ((expression)) ; else break; } \
71         if (index == count)
72
73
74 /**
75  * @name User-defined Windows-messages
76  */
77 /* @{ */
78 /// Directory compare thread asks UI (view) update
79 const UINT MSG_UI_UPDATE = WM_USER + 1;
80 /// Request to save panesizes
81 const UINT MSG_STORE_PANESIZES = WM_USER + 2;
82 /* @} */
83
84 /// Seconds ignored in filetime differences if option enabled
85 static const UINT SmallTimeDiff = 2;
86
87 #include "UnicodeString.h"
88 #include "MergeApp.h"
89
90         /** @brief Wrapper around CMergeApp::TranslateDialog() */
91 void NTAPI LangTranslateDialog(HWND);
92
93         /** @brief Lang aware version of AfxMessageBox() */
94 int NTAPI LangMessageBox(UINT, UINT nType = MB_OK, UINT nIDHelp = (UINT)-1);
95
96         /** @brief Get appropriate clipboard format for TCHAR text, ie, CF_TEXT or CF_UNICODETEXT */
97 int GetClipTcharTextFormat();
98
99         /** @brief include for the custom dialog boxes, with do not ask/display again */
100 #include "MessageBoxDialog.h"
101
102 #ifdef _MAX_PATH
103 #  undef _MAX_PATH
104 #endif
105 #define _MAX_PATH (260 * sizeof(wchar_t) / sizeof(TCHAR))
106
107 #ifdef MAX_PATH
108 #  undef MAX_PATH
109 #endif
110 #define MAX_PATH (260 * sizeof(wchar_t) / sizeof(TCHAR))
111
112 #define WMPROFILE(x) CWinMergeProfile __wmtl__(x)
113
114 class CWinMergeProfile
115 {
116 private:
117         LARGE_INTEGER li[2];
118         LARGE_INTEGER freq;
119         TCHAR funcname[256];
120 public:
121         CWinMergeProfile(LPCTSTR pFuncName) {
122                 lstrcpy(funcname, pFuncName);
123                 QueryPerformanceFrequency(&freq);
124                 QueryPerformanceCounter(&li[0]);
125         }
126         ~CWinMergeProfile() {
127                 QueryPerformanceCounter(&li[1]);
128                 TCHAR buf[256];
129                 wsprintf(buf, _T("funcname=%s t=%d[us]\n"), funcname, (int)((double)(li[1].QuadPart-li[0].QuadPart)/freq.QuadPart*1000.0*1000.0));
130                 OutputDebugString(buf);
131         }
132 };
133
134 //{{AFX_INSERT_LOCATION}}
135 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.