代码拉取完成,页面将自动刷新
/**
* @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*/);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。