3 Star 9 Fork 7

Gitee 极速下载/WinMerge

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/winmerge/winmerge
克隆/下载
PropCompare.cpp 6.05 KB
一键复制 编辑 原始数据 按行查看 历史
/**
* @file PropCompare.cpp
*
* @brief Implementation of PropCompare propertysheet
*/
#include "stdafx.h"
#include "PropCompare.h"
#include "OptionsDef.h"
#include "OptionsMgr.h"
#include "OptionsPanel.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
/**
* @brief Constructor.
* @param [in] optionsMgr Pointer to COptionsMgr.
*/
PropCompare::PropCompare(COptionsMgr *optionsMgr)
: OptionsPanel(optionsMgr, PropCompare::IDD)
, m_bIgnoreCase(false)
, m_bIgnoreNumbers(false)
, m_bIgnoreBlankLines(false)
, m_bIgnoreEol(true)
, m_bIgnoreCodepage(true)
, m_bIgnoreMissingTrailingEol(true)
, m_nIgnoreWhite(-1)
, m_bMovedBlocks(false)
, m_bAlignSimilarLines(false)
, m_bFilterCommentsLines(false)
, m_nDiffAlgorithm(0)
, m_bIndentHeuristic(true)
, m_bCompleteBlankOutIgnoredChanges(false)
{
}
void PropCompare::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(PropCompare)
DDX_CBIndex(pDX, IDC_DIFF_ALGORITHM, m_nDiffAlgorithm);
DDX_Check(pDX, IDC_INDENT_HEURISTIC, m_bIndentHeuristic);
DDX_Check(pDX, IDC_IGNCASE_CHECK, m_bIgnoreCase);
DDX_Check(pDX, IDC_IGNBLANKS_CHECK, m_bIgnoreBlankLines);
DDX_Check(pDX, IDC_FILTERCOMMENTS_CHECK, m_bFilterCommentsLines);
DDX_Check(pDX, IDC_CP_SENSITIVE, m_bIgnoreCodepage);
DDX_Check(pDX, IDC_EOL_SENSITIVE, m_bIgnoreEol);
DDX_Check(pDX, IDC_IGNORE_NUMBERS, m_bIgnoreNumbers);
DDX_Check(pDX, IDC_IGNEOFEOL_CHECK, m_bIgnoreMissingTrailingEol);
DDX_Radio(pDX, IDC_WHITESPACE, m_nIgnoreWhite);
DDX_Check(pDX, IDC_MOVED_BLOCKS, m_bMovedBlocks);
DDX_Check(pDX, IDC_ALIGN_SIMILAR_LINES, m_bAlignSimilarLines);
DDX_Check(pDX, IDC_COMPLETELY_BLANK_OUT_IGNORED_DIFFERENCES, m_bCompleteBlankOutIgnoredChanges);
//}}AFX_DATA_MAP
UpdateControls();
}
BEGIN_MESSAGE_MAP(PropCompare, OptionsPanel)
//{{AFX_MSG_MAP(PropCompare)
ON_BN_CLICKED(IDC_COMPARE_DEFAULTS, OnDefaults)
ON_CBN_SELCHANGE(IDC_DIFF_ALGORITHM, OnCbnSelchangeDiffAlgorithm)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/**
* @brief Reads options values from storage to UI.
* Property sheet calls this before displaying GUI to load values
* into members.
*/
void PropCompare::ReadOptions()
{
m_nIgnoreWhite = GetOptionsMgr()->GetInt(OPT_CMP_IGNORE_WHITESPACE);
m_bIgnoreBlankLines = GetOptionsMgr()->GetBool(OPT_CMP_IGNORE_BLANKLINES);
m_bFilterCommentsLines = GetOptionsMgr()->GetBool(OPT_CMP_FILTER_COMMENTLINES);
m_bIgnoreCase = GetOptionsMgr()->GetBool(OPT_CMP_IGNORE_CASE);
m_bIgnoreNumbers = GetOptionsMgr()->GetBool(OPT_CMP_IGNORE_NUMBERS);
m_bIgnoreEol = GetOptionsMgr()->GetBool(OPT_CMP_IGNORE_EOL);
m_bIgnoreCodepage = GetOptionsMgr()->GetBool(OPT_CMP_IGNORE_CODEPAGE);
m_bIgnoreMissingTrailingEol = GetOptionsMgr()->GetBool(OPT_CMP_IGNORE_MISSING_TRAILING_EOL);
m_bMovedBlocks = GetOptionsMgr()->GetBool(OPT_CMP_MOVED_BLOCKS);
m_bAlignSimilarLines = GetOptionsMgr()->GetBool(OPT_CMP_ALIGN_SIMILAR_LINES);
m_nDiffAlgorithm = GetOptionsMgr()->GetInt(OPT_CMP_DIFF_ALGORITHM);
m_bIndentHeuristic = GetOptionsMgr()->GetBool(OPT_CMP_INDENT_HEURISTIC);
m_bCompleteBlankOutIgnoredChanges = GetOptionsMgr()->GetBool(OPT_CMP_COMPLETELY_BLANK_OUT_IGNORED_CHANGES);
}
/**
* @brief Writes options values from UI to storage.
* Property sheet calls this after dialog is closed with OK button to
* store values in member variables.
*/
void PropCompare::WriteOptions()
{
GetOptionsMgr()->SaveOption(OPT_CMP_IGNORE_WHITESPACE, m_nIgnoreWhite);
GetOptionsMgr()->SaveOption(OPT_CMP_IGNORE_BLANKLINES, m_bIgnoreBlankLines);
GetOptionsMgr()->SaveOption(OPT_CMP_FILTER_COMMENTLINES, m_bFilterCommentsLines);
GetOptionsMgr()->SaveOption(OPT_CMP_IGNORE_CODEPAGE, m_bIgnoreCodepage);
GetOptionsMgr()->SaveOption(OPT_CMP_IGNORE_EOL, m_bIgnoreEol);
GetOptionsMgr()->SaveOption(OPT_CMP_IGNORE_CASE, m_bIgnoreCase);
GetOptionsMgr()->SaveOption(OPT_CMP_IGNORE_NUMBERS, m_bIgnoreNumbers);
GetOptionsMgr()->SaveOption(OPT_CMP_IGNORE_MISSING_TRAILING_EOL, m_bIgnoreMissingTrailingEol);
GetOptionsMgr()->SaveOption(OPT_CMP_MOVED_BLOCKS, m_bMovedBlocks);
GetOptionsMgr()->SaveOption(OPT_CMP_ALIGN_SIMILAR_LINES, m_bAlignSimilarLines);
GetOptionsMgr()->SaveOption(OPT_CMP_DIFF_ALGORITHM, m_nDiffAlgorithm);
GetOptionsMgr()->SaveOption(OPT_CMP_INDENT_HEURISTIC, m_bIndentHeuristic);
GetOptionsMgr()->SaveOption(OPT_CMP_COMPLETELY_BLANK_OUT_IGNORED_CHANGES, m_bCompleteBlankOutIgnoredChanges);
}
/**
* @brief Called before propertysheet is drawn.
*/
BOOL PropCompare::OnInitDialog()
{
SetDlgItemComboBoxList(IDC_DIFF_ALGORITHM,
{ _("default"), _("minimal"), _("patience"), _("histogram"), _("none") });
OptionsPanel::OnInitDialog();
return TRUE; // return TRUE unless you set the focus to a control
}
/**
* @brief Sets options to defaults
*/
void PropCompare::OnDefaults()
{
m_nIgnoreWhite = GetOptionsMgr()->GetDefault<unsigned>(OPT_CMP_IGNORE_WHITESPACE);
m_bIgnoreEol = GetOptionsMgr()->GetDefault<bool>(OPT_CMP_IGNORE_EOL);
m_bIgnoreCodepage = GetOptionsMgr()->GetDefault<bool>(OPT_CMP_IGNORE_CODEPAGE);
m_bIgnoreBlankLines = GetOptionsMgr()->GetDefault<bool>(OPT_CMP_IGNORE_BLANKLINES);
m_bFilterCommentsLines = GetOptionsMgr()->GetDefault<bool>(OPT_CMP_FILTER_COMMENTLINES);
m_bIgnoreCase = GetOptionsMgr()->GetDefault<bool>(OPT_CMP_IGNORE_CASE);
m_bIgnoreNumbers = GetOptionsMgr()->GetDefault<bool>(OPT_CMP_IGNORE_NUMBERS);
m_bIgnoreMissingTrailingEol = GetOptionsMgr()->GetDefault<bool>(OPT_CMP_IGNORE_MISSING_TRAILING_EOL);
m_bMovedBlocks = GetOptionsMgr()->GetDefault<bool>(OPT_CMP_MOVED_BLOCKS);
m_bAlignSimilarLines = GetOptionsMgr()->GetDefault<bool>(OPT_CMP_ALIGN_SIMILAR_LINES);
m_nDiffAlgorithm = GetOptionsMgr()->GetDefault<unsigned>(OPT_CMP_DIFF_ALGORITHM);
m_bIndentHeuristic = GetOptionsMgr()->GetDefault<bool>(OPT_CMP_INDENT_HEURISTIC);
m_bCompleteBlankOutIgnoredChanges = GetOptionsMgr()->GetDefault<bool>(OPT_CMP_COMPLETELY_BLANK_OUT_IGNORED_CHANGES);
UpdateData(FALSE);
}
void PropCompare::OnCbnSelchangeDiffAlgorithm()
{
UpdateControls();
}
void PropCompare::UpdateControls()
{
CComboBox * pCombo = (CComboBox*)GetDlgItem(IDC_DIFF_ALGORITHM);
int cursel = pCombo->GetCurSel();
EnableDlgItem(IDC_INDENT_HEURISTIC, cursel != 0/*default*/ && cursel != 4/*none*/);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/mirrors/WinMerge.git
git@gitee.com:mirrors/WinMerge.git
mirrors
WinMerge
WinMerge
master

搜索帮助