#include <cstdint>
// Line allocation granularity
-#define CHAR_ALIGN 16
-#define ALIGN_BUF_SIZE(size) ((size) / CHAR_ALIGN) * CHAR_ALIGN + CHAR_ALIGN;
+constexpr size_t CHAR_ALIGN = 16;
+constexpr size_t ALIGN_BUF_SIZE(size_t size) { return ((size) / CHAR_ALIGN) * CHAR_ALIGN + CHAR_ALIGN; }
typedef unsigned long lineflags_t;
COLORINDEX_MASK = 0xC0000000,
};
-const int COLORINDEX_COUNT = COLORINDEX_LAST - COLORINDEX_NONE;
+constexpr int COLORINDEX_COUNT = COLORINDEX_LAST - COLORINDEX_NONE;
/**
* @brief Wrapper for Syntax coloring colors.
#define new DEBUG_NEW
#endif
-#define REMEMBER_COUNT 64
+constexpr int REMEMBER_COUNT = 64;
/////////////////////////////////////////////////////////////////////////////
// CMemComboBox
#include "varprop.h"
#include "OptionsMgr.h"
-#define MAX_PATH_FULL 32767
+constexpr size_t MAX_PATH_FULL = 32767;
struct AsyncWriterThreadParams
{
const uintptr_t SPECIAL_ITEM_POS = (uintptr_t)(reinterpret_cast<DIFFITEM *>( - 1L));
/** Default column width in directory compare */
-const UINT DefColumnWidth = 111;
+constexpr int DefColumnWidth = 111;
/**
* @brief Directory compare results view.
#define WMU_CHILDFRAMEREMOVED (WM_APP + 11)
#define WMU_CHILDFRAMEACTIVATE (WM_APP + 12)
#define WMU_CHILDFRAMEACTIVATED (WM_APP + 13)
-#define IDT_UPDATEMAINMENU 1
+constexpr UINT_PTR IDT_UPDATEMAINMENU = 1;
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
-#define IDT_SAVEPOSITION 2
+constexpr UINT_PTR IDT_SAVEPOSITION = 2;
/////////////////////////////////////////////////////////////////////////////
// CMergeEditFrame construction/destruction
/**
* @brief Non-diff lines shown above diff when scrolling to it
*/
-const UINT CONTEXT_LINES_ABOVE = 5;
+constexpr int CONTEXT_LINES_ABOVE = 5;
/**
* @brief Non-diff lines shown below diff when scrolling to it
*/
-const UINT CONTEXT_LINES_BELOW = 3;
+constexpr int CONTEXT_LINES_BELOW = 3;
-#define FLAG_RESCAN_WAITS_FOR_IDLE 1
+constexpr unsigned FLAG_RESCAN_WAITS_FOR_IDLE = 1;
/////////////////////////////////////////////////////////////////////////////
*/
#pragma once
+#include "LineInfo.h"
+
/**
The Crystal Editor keeps a DWORD of flags for each line.
It does not use all of the available bits.
information; here are the list of WinMerge flags.
So, these constants are used with the SetLineFlag(2) calls.
*/
-enum MERGE_LINEFLAGS : DWORD
+enum MERGE_LINEFLAGS : lineflags_t
{
LF_DIFF = 0x00200000UL,
-// LF_GHOST = 0x00400000UL,
+ // LF_GHOST = 0x00400000UL,
LF_TRIVIAL = 0x00800000UL,
LF_MOVED = 0x01000000UL,
LF_SNP = 0x02000000UL,
+ // LF_WINMERGE_FLAGS is LF_DIFF | LF_GHOST | LF_TRIVIAL | LF_MOVED | LF_SNP
+ LF_WINMERGE_FLAGS = 0x03E00000UL,
+ // Flags for non-ignored difference
+ // Note that we must include ghost flag to include ghost lines
+ LF_NONTRIVIAL_DIFF = ((LF_DIFF | LF_GHOST) & (~LF_TRIVIAL))
};
-
-// LF_WINMERGE_FLAGS is LF_DIFF | LF_GHOST | LF_TRIVIAL | LF_MOVED | LF_SNP
-#define LF_WINMERGE_FLAGS 0x03E00000UL
-
-// Flags for non-ignored difference
-// Note that we must include ghost flag to include ghost lines
-#define LF_NONTRIVIAL_DIFF ((LF_DIFF | LF_GHOST) & (~LF_TRIVIAL))
class COptionsMgr;
-const int CustomColorsAmount = 16;
+constexpr int CustomColorsAmount = 16;
/** @brief Property page for colors options; used in options property sheet */
class PropMergeColors : public OptionsPanel
#endif
/// Flags for enabling and mode of extension
-#define CONTEXT_F_ENABLED 0x01
-#define CONTEXT_F_ADVANCED 0x02
-#define CONTEXT_F_COMPARE_AS 0x04
+enum
+{
+ CONTEXT_F_ENABLED = 0x0a,
+ CONTEXT_F_ADVANCED = 0x0a,
+ CONTEXT_F_COMPARE_AS = 0x04
+};
// registry values
static const tchar_t* f_RegValueEnabled = _T("ContextMenuEnabled");
static char THIS_FILE[] = __FILE__;
#endif
-#define IDC_IPEDIT 1000
+constexpr UINT IDC_IPEDIT = 1000;
/// Some stuff is from https://www.codeguru.com/cpp/controls/listview/editingitemsandsubitem/article.php/c923/Editable-subitems.htm