Skip to content

Commit

Permalink
Fix issue #2355: Options - Syntax color settings get reverted when "C…
Browse files Browse the repository at this point in the history
…ustomized text colors" settings is touched.
  • Loading branch information
sdottaka committed Jun 15, 2024
1 parent b514190 commit fa2bd5a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
14 changes: 8 additions & 6 deletions Src/Common/PreferencesDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@ CPreferencesDlg::CPreferencesDlg(COptionsMgr *regOptions, SyntaxColors *colors,
UINT nMenuID /*= 0*/, CWnd* pParent /*= nullptr*/) // standard constructor
: CTrDialog(IDD_PREFERENCES, pParent)
, m_pOptionsMgr(regOptions)
, m_pSyntaxColors(colors)
, m_pSyntaxColorsOrg(colors)
, m_pSyntaxColors(new SyntaxColors(colors))
, m_pageGeneral(regOptions)
, m_pageCompare(regOptions)
, m_pageMessageBoxes(regOptions)
, m_pageColorSchemes(regOptions)
, m_pageMergeColors(regOptions)
, m_pageTextColors(regOptions, colors)
, m_pageSyntaxColors(regOptions, colors)
, m_pageMarkerColors(regOptions, colors)
, m_pageTextColors(regOptions, m_pSyntaxColors.get())
, m_pageSyntaxColors(regOptions, m_pSyntaxColors.get())
, m_pageMarkerColors(regOptions, m_pSyntaxColors.get())
, m_pageDirColors(regOptions)
, m_pageArchive(regOptions)
, m_pageCodepage(regOptions)
Expand Down Expand Up @@ -360,6 +361,7 @@ void CPreferencesDlg::SaveOptions()
m_pageProject.WriteOptions();
m_pageBackups.WriteOptions();
m_pageShell.WriteOptions();
m_pSyntaxColorsOrg->Clone(m_pSyntaxColors.get());
}

/**
Expand All @@ -372,7 +374,7 @@ void CPreferencesDlg::OnImportButton()
{
if (m_pOptionsMgr->ImportOptions(s) == COption::OPT_OK)
{
Options::SyntaxColors::Load(m_pOptionsMgr, m_pSyntaxColors);
Options::SyntaxColors::Load(m_pOptionsMgr, m_pSyntaxColors.get());
theApp.m_pLineFilters->Initialize(GetOptionsMgr());
theApp.m_pSubstitutionFiltersList->Initialize(GetOptionsMgr());

Expand Down Expand Up @@ -411,7 +413,7 @@ void CPreferencesDlg::OnExportButton()

LRESULT CPreferencesDlg::OnColorSchemeChanged(WPARAM wParams, LPARAM lParam)
{
Options::SyntaxColors::Load(m_pOptionsMgr, m_pSyntaxColors);
Options::SyntaxColors::Load(m_pOptionsMgr, m_pSyntaxColors.get());
ReadOptions(true);
return 0;
}
Expand Down
11 changes: 6 additions & 5 deletions Src/Common/PreferencesDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ class CPreferencesDlg : public CTrDialog
UINT nMenuID = 0, CWnd* pParent = nullptr); // standard constructor
virtual ~CPreferencesDlg();

private:
COptionsMgr *m_pOptionsMgr;
std::unique_ptr<SyntaxColors> m_pSyntaxColors;
SyntaxColors* m_pSyntaxColorsOrg;
prdlg::CMoveConstraint m_constraint; /**< Resizes dialog controls when dialog resized */

protected:
// Dialog Data
//{{AFX_DATA(CPreferencesDlg)
Expand Down Expand Up @@ -117,9 +123,4 @@ class CPreferencesDlg : public CTrDialog
void ReadOptions(bool bUpdate = false);
void SaveOptions();
void SafeUpdatePage(CPropertyPage* pPage, bool bSaveAndValidate);

private:
COptionsMgr *m_pOptionsMgr;
SyntaxColors *m_pSyntaxColors;
prdlg::CMoveConstraint m_constraint; /**< Resizes dialog controls when dialog resized */
};

0 comments on commit fa2bd5a

Please sign in to comment.