Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a "Defaults" button to the "Options (Editor > Compare/Merge)" dialog. #2348

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Src/Merge.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1851,6 +1851,7 @@ BEGIN
COMBOBOX IDC_BREAK_TYPE,36,94,234,34,CBS_DROPDOWNLIST | WS_VSCROLL | WS_GROUP | WS_TABSTOP
LTEXT "W&ord break characters:",IDC_STATIC,24,112,246,10
EDITTEXT IDC_BREAK_CHARS,24,124,246,14,ES_AUTOHSCROLL
PUSHBUTTON "Defaults", IDC_COMPARE_DEFAULTS, 191, 228, 88, 14
END

IDD_PROPPAGE_EDITOR_SYNTAX DIALOGEX 0, 0, 285, 242
Expand Down Expand Up @@ -3122,7 +3123,8 @@ BEGIN
0, 0, 100, 0,
0, 0, 100, 0,
0, 0, 100, 0,
0, 0, 100, 0
0, 0, 100, 0,
100, 0, 0, 0
END

IDD_PROPPAGE_EDITOR_SYNTAX AFX_DIALOG_LAYOUT
Expand Down
17 changes: 17 additions & 0 deletions Src/PropEditorCompareMerge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ void PropEditorCompareMerge::DoDataExchange(CDataExchange* pDX)

BEGIN_MESSAGE_MAP(PropEditorCompareMerge, OptionsPanel)
//{{AFX_MSG_MAP(PropEditorCompareMerge)
ON_BN_CLICKED(IDC_COMPARE_DEFAULTS, OnDefaults)
ON_BN_CLICKED(IDC_VIEW_LINE_DIFFERENCES, OnLineDiffControlClicked)
ON_BN_CLICKED(IDC_EDITOR_CHARLEVEL, OnLineDiffControlClicked)
ON_BN_CLICKED(IDC_EDITOR_WORDLEVEL, OnLineDiffControlClicked)
Expand Down Expand Up @@ -105,6 +106,22 @@ void PropEditorCompareMerge::LoadComboBoxStrings()
{ _("Diff hunk"), _("Inline diff"), _("Line"), _("Character") });
}

/**
* @brief Sets options to defaults
*/
void PropEditorCompareMerge::OnDefaults()
{
m_bAutomaticRescan = GetOptionsMgr()->GetDefault<bool>(OPT_AUTOMATIC_RESCAN);
m_nCopyGranularity = GetOptionsMgr()->GetDefault<unsigned>(OPT_COPY_GRANULARITY);
m_bViewLineDifferences = GetOptionsMgr()->GetDefault<bool>(OPT_WORDDIFF_HIGHLIGHT);
m_bBreakOnWords = GetOptionsMgr()->GetDefault<bool>(OPT_BREAK_ON_WORDS);
m_nBreakType = GetOptionsMgr()->GetDefault<unsigned>(OPT_BREAK_TYPE);
m_breakChars = GetOptionsMgr()->GetDefault<String>(OPT_BREAK_SEPARATORS);

UpdateDataToWindow();
UpdateLineDiffControls();
}

/**
* @brief Handlers any clicks in any of the line differencing controls
*/
Expand Down
1 change: 1 addition & 0 deletions Src/PropEditorCompareMerge.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class PropEditorCompareMerge : public OptionsPanel
// Generated message map functions
//{{AFX_MSG(PropEditorCompareMerge)
afx_msg BOOL OnInitDialog() override;
afx_msg void OnDefaults();
afx_msg void OnLineDiffControlClicked();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
Expand Down
Loading