-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAlegrDiff.h
288 lines (255 loc) · 7.55 KB
/
AlegrDiff.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
// AlegrDiff.h : main header file for the ALEGRDIFF application
//
#if !defined(AFX_ALEGRDIFF_H__48D02BA0_0458_4A17_937D_9DD31867151E__INCLUDED_)
#define AFX_ALEGRDIFF_H__48D02BA0_0458_4A17_937D_9DD31867151E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define WM_SETMESSAGESTRING_POST (WM_APP + 0xAA)
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
#include "ApplicationProfile.h"
#include "FileListSupport.h"
/////////////////////////////////////////////////////////////////////////////
// CAlegrDiffApp:
// See AlegrDiff.cpp for the implementation of this class
//
enum eColumns
{
ColumnName,
ColumnSubdir,
ColumnDate1,
ColumnDate2,
ColumnLength1,
ColumnLength2,
ColumnComparisionResult,
MaxColumns,
};
enum {
UpdateViewsColorsChanged = 0x100000,
UpdateViewsFilePairChanged = 0x200000,
UpdateViewsMetricsChanged = 0x300000,
UpdateViewsFilePairDeleteFromList = 0x400000,
UpdateViewsFilePairDeleteView = 0x400000,
UpdateViewsCloseOpenFiles = 0x500000,
UpdateViewsReplaceFilePair = 0x600000,
};
class FilePairChangedArg : public CObject
{
public:
class FilePair * m_pPair;
class FilePair * m_pNewPair;
FilePairChangedArg(FilePair * pPair, FilePair* pNewPair = nullptr)
: m_pPair(pPair),
m_pNewPair(pNewPair)
{
}
};
class CAlegrDiffApp : public CWinApp
{
public:
CAlegrDiffApp();
~CAlegrDiffApp();
void OpenPairOfPathnames(LPTSTR path1, LPTSTR path2);
void CompareFiles(LPCTSTR OPTIONAL pName1, LPCTSTR OPTIONAL pName2);
void OpenPairOrFile(LPCTSTR pName1, LPCTSTR OPTIONAL pName2 = NULL);
void CompareDirectories(LPCTSTR dir1, LPCTSTR dir2, LPCTSTR filter = NULL);
void ParseCommandLine();
void NotifyFilePairReplaced(FilePair * pPair, FilePair* pNewPair);
void NotifyFilePairChanged(FilePair * pPair);
CApplicationProfile Profile;
struct COLOR_PAIR
{
COLORREF Text;
COLORREF BG;
};
struct NORMAL_OR_SELECTED_COLOR
{
COLOR_PAIR Normal;
COLOR_PAIR Selected;
};
NORMAL_OR_SELECTED_COLOR m_TextColor =
{
{ RGB(0, 0, 0), RGB(255, 255, 255) },
{ RGB(0, 0, 0), RGB(153, 201, 239) },
};
NORMAL_OR_SELECTED_COLOR m_ErasedLineColor =
{
{ RGB(0, 0, 0), RGB(235, 153, 153) },
{ RGB(0, 0, 0), RGB(153, 140, 208) },
};
NORMAL_OR_SELECTED_COLOR m_ErasedColor =
{
{ RGB(0, 0, 0), RGB(255, 204, 204) },
{ RGB(0, 0, 0), RGB(153, 170, 208) },
};
NORMAL_OR_SELECTED_COLOR m_AddedLineColor =
{
{ RGB(0, 0, 0), RGB(215, 227, 188) },
{ RGB(0, 0, 0), RGB(129, 184, 199) },
};
NORMAL_OR_SELECTED_COLOR m_AddedColor =
{
{ RGB(0, 0, 0), RGB(235, 241, 221) },
{ RGB(0, 0, 0), RGB(141, 193, 219) },
};
NORMAL_OR_SELECTED_COLOR m_AcceptedColor =
{
{ RGB(0, 0, 0), RGB(240, 240, 0) },
{ RGB(0, 0, 0), RGB(141, 141, 0) },
};
NORMAL_OR_SELECTED_COLOR m_DiscardedColor =
{
{ RGB(0, 0, 0), RGB(192, 192, 192) },
{ RGB(0, 0, 0), RGB(128, 128, 128) },
};
COLORREF m_LineNumberTextColor = RGB(43, 145, 175);
union
{
DWORD m_PreferencesFlags;
struct
{
bool m_bRecurseSubdirs : 1;
bool m_bAdvancedCompareDialog : 1;
bool m_BinaryComparision : 1;
bool m_AutoReloadChangedFiles : 1;
bool m_bIgnoreWhitespaces : 1;
bool m_bShowLineNumbers : 1;
bool m_bFindBackward : 1;
bool m_bCaseSensitive : 1;
bool m_bCancelSelectionOnMerge : 1;
bool m_bUseMd5 : 1;
bool m_bFindWholeWord : 1;
bool m_bDoNotCompareFileContents : 1;
};
};
union
{
DWORD m_StatusFlags;
struct
{
bool m_bShowToolbar:1;
bool m_bShowStatusBar:1;
bool :1;
bool :1;
};
};
CString m_FileDir1;
CString m_FileDir2;
CString m_LastSaveMergedDir;
CString m_CopyFilesDir;
CString m_CustomFileOpenFilter;
CStringHistory m_FindHistory;
CStringHistory m_RecentFolders;
CStringHistory m_FileFilters;
CStringHistory m_RecentFiles;
UCHAR m_ColumnArray[MaxColumns];
UCHAR m_ColumnSort[MaxColumns];
SHORT m_ColumnWidthArray[MaxColumns];
CString m_sBinaryFilesFilter;
CString m_sCppFilesFilter;
CString m_sIgnoreFilesFilter;
CString m_FindString;
DWORD m_MinimalLineLength;
DWORD m_NumberOfIdenticalLines;
DWORD m_PercentsOfLookLikeDifference;
DWORD m_MinMatchingChars;
DWORD m_ShowFilesMask;
int m_MaxSearchDistance;
int m_MinIdenticalLines;
int m_MinPercentWeakIdenticalLines; // default 10
int m_TabIndent;
int m_GoToLineFileSelection;
int m_SearchScope;
enum FileComparisonMode
{
FileComparisonModeDefault = 0,
FileComparisonModeText = 1,
FileComparisonModeBinary = 2,
FileComparisonModeMin = FileComparisonModeDefault,
FileComparisonModeMax = FileComparisonModeBinary,
};
int m_ComparisonMode;
int m_NumberOfPanes;
LOGFONT m_NormalLogFont;
CFont m_NormalFont;
LOGFONT m_AddedLogFont;
CFont m_AddedFont;
LOGFONT m_ErasedLogFont;
CFont m_ErasedFont;
int m_FontPointSize;
void OnFontChanged();
void UpdateAllViews(LPARAM lHint = 0L, CObject* pHint = NULL);
CDocument * OpenFilePairView(FilePair * pPair);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAlegrDiffApp)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
//}}AFX_VIRTUAL
// Implementation
CMultiDocTemplate * m_pFileDiffTemplate;
CMultiDocTemplate * m_pBinaryDiffTemplate;
CMultiDocTemplate * m_pListDiffTemplate;
//{{AFX_MSG(CAlegrDiffApp)
afx_msg void OnAppAbout();
afx_msg void OnFileComparedirectories();
afx_msg void OnFileComparefiles();
afx_msg void OnFilePreferences();
afx_msg void OnUpdateViewIgnoreWhitespaces(CCmdUI* pCmdUI);
afx_msg void OnUpdateViewShowLineNumbers(CCmdUI* pCmdUI);
afx_msg void OnUpdateEditAccept(CCmdUI* pCmdUI);
afx_msg void OnUpdateEditDecline(CCmdUI* pCmdUI);
afx_msg void OnHelpUsing();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
afx_msg void OnFileCreatedirectoryfingerprint();
afx_msg void OnFileCheckDirectoryFingerprint();
afx_msg void OnWindowCloseall();
};
typedef CAlegrDiffApp CThisApp;
inline CThisApp * GetApp() noexcept
{
return (CThisApp *) AfxGetApp();
}
enum {
SetPositionMakeVisible = 1,
SetPositionMakeCentered = 2,
SetPositionCancelSelection = 4,
MoveCaretPositionAlways = 8,
SetWordSelectionMode = 0x10,
OnUpdateListViewItem = 0x100,
};
class InvalidatedRange : public CObject
{
public:
TextPosLine begin; // line position
TextPosLine end;
};
void ModifyOpenFileMenu(CCmdUI* pCmdUI, class FileItem * pFile, UINT FormatID, UINT DisabledItemID);
void OpenFileForEditing(class FileItem * pFile);
void CopyFilesToFolder(FileItem ** ppFiles, int nCount, bool bAddSubdirToTarget);
CString FileTimeToStr(FILETIME FileTime, LCID locale = LOCALE_USER_DEFAULT);
inline CString FileTimeToStr(ULONGLONG const &FileTime, LCID locale = LOCALE_USER_DEFAULT)
{
return FileTimeToStr(reinterpret_cast<FILETIME const&>(FileTime), locale);
}
void FileTimeToStr(FILETIME FileTime, TCHAR str[256], LCID locale);
inline void FileTimeToStr(ULONGLONG const& FileTime, TCHAR str[256], LCID locale = LOCALE_USER_DEFAULT)
{
FileTimeToStr(reinterpret_cast<FILETIME const&>(FileTime), str, locale);
}
CString UlonglongToStr(ULONGLONG Length, LCID locale = LOCALE_USER_DEFAULT);
CString FileLengthToStrKb(ULONGLONG Length);
void FileLengthToStrKb(ULONGLONG Length, TCHAR buf[64]);
void AFXAPI AbbreviateName(LPTSTR lpszCanon, int cchMax, BOOL bAtLeastName);
CString CreateCustomFilter(LPCTSTR Extension);
int BrowseForFile(int TitleID, CString & Name, CString & BrowseFolder,
CStringHistory * pHistory);
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ALEGRDIFF_H__48D02BA0_0458_4A17_937D_9DD31867151E__INCLUDED_)