1
// TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2009, 2011, 2013, 2018 - TortoiseGit
4 // Copyright (C) 2003-2008 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "TortoiseProc.h"
22 #include "SettingsColors2.h"
24 IMPLEMENT_DYNAMIC(CSettingsColors2
, ISettingsPropPage
)
25 CSettingsColors2::CSettingsColors2()
26 : ISettingsPropPage(CSettingsColors2::IDD
)
30 CSettingsColors2::~CSettingsColors2()
34 void CSettingsColors2::DoDataExchange(CDataExchange
* pDX
)
36 ISettingsPropPage::DoDataExchange(pDX
);
37 DDX_Control(pDX
, IDC_CURRENT_BRANCH
, this->m_cCurrentBranch
);
38 DDX_Control(pDX
, IDC_LOCAL_BRANCH
, this->m_cLocalBranch
);
39 DDX_Control(pDX
, IDC_REMOTE_BRANCH
, this->m_cRemoteBranch
);
40 DDX_Control(pDX
, IDC_TAGS
, this->m_cTags
);
41 DDX_Control(pDX
, IDC_FILTERMATCHCOLOR
, m_cFilterMatch
);
45 BEGIN_MESSAGE_MAP(CSettingsColors2
, ISettingsPropPage
)
46 ON_BN_CLICKED(IDC_RESTORE
, OnBnClickedRestore
)
47 ON_BN_CLICKED(IDC_CURRENT_BRANCH
, &CSettingsColors2::OnBnClickedColor
)
48 ON_BN_CLICKED(IDC_LOCAL_BRANCH
, &CSettingsColors2::OnBnClickedColor
)
49 ON_BN_CLICKED(IDC_REMOTE_BRANCH
, &CSettingsColors2::OnBnClickedColor
)
50 ON_BN_CLICKED(IDC_TAGS
, &CSettingsColors2::OnBnClickedColor
)
51 ON_BN_CLICKED(IDC_FILTERMATCHCOLOR
, &CSettingsColors2::OnBnClickedColor
)
54 BOOL
CSettingsColors2::OnInitDialog()
56 ISettingsPropPage::OnInitDialog();
58 m_cCurrentBranch
.SetColor(m_Colors
.GetColor(CColors::CurrentBranch
));
59 m_cLocalBranch
.SetColor(m_Colors
.GetColor(CColors::LocalBranch
));
60 m_cRemoteBranch
.SetColor(m_Colors
.GetColor(CColors::RemoteBranch
));
61 m_cTags
.SetColor(m_Colors
.GetColor(CColors::Tag
));
62 m_cFilterMatch
.SetColor(m_Colors
.GetColor(CColors::FilterMatch
));
64 CString sDefaultText
, sCustomText
;
65 sDefaultText
.LoadString(IDS_COLOURPICKER_DEFAULTTEXT
);
66 sCustomText
.LoadString(IDS_COLOURPICKER_CUSTOMTEXT
);
68 m_cCurrentBranch
.EnableAutomaticButton(sDefaultText
, m_Colors
.GetColor(CColors::CurrentBranch
, true));
69 m_cCurrentBranch
.EnableOtherButton(sCustomText
);
71 m_cLocalBranch
.EnableAutomaticButton(sDefaultText
, m_Colors
.GetColor(CColors::LocalBranch
, true));
72 m_cLocalBranch
.EnableOtherButton(sCustomText
);
74 m_cRemoteBranch
.EnableAutomaticButton(sDefaultText
, m_Colors
.GetColor(CColors::RemoteBranch
, true));
75 m_cRemoteBranch
.EnableOtherButton(sCustomText
);
77 m_cTags
.EnableAutomaticButton(sDefaultText
, m_Colors
.GetColor(CColors::Tag
, true));
78 m_cTags
.EnableOtherButton(sCustomText
);
80 m_cFilterMatch
.EnableAutomaticButton(sDefaultText
, m_Colors
.GetColor(CColors::FilterMatch
, true));
81 m_cFilterMatch
.EnableOtherButton(sCustomText
);
86 void CSettingsColors2::OnBnClickedRestore()
88 m_cCurrentBranch
.SetColor(m_Colors
.GetColor(CColors::CurrentBranch
, true));
89 m_cLocalBranch
.SetColor(m_Colors
.GetColor(CColors::LocalBranch
, true));
90 m_cRemoteBranch
.SetColor(m_Colors
.GetColor(CColors::RemoteBranch
, true));
91 m_cTags
.SetColor(m_Colors
.GetColor(CColors::Tag
, true));
92 m_cFilterMatch
.SetColor(m_Colors
.GetColor(CColors::FilterMatch
, true));
96 BOOL
CSettingsColors2::OnApply()
98 m_Colors
.SetColor(CColors::CurrentBranch
, m_cCurrentBranch
.GetColor() == -1 ? m_cCurrentBranch
.GetAutomaticColor() : m_cCurrentBranch
.GetColor());
99 m_Colors
.SetColor(CColors::LocalBranch
, m_cLocalBranch
.GetColor() == -1 ? m_cLocalBranch
.GetAutomaticColor() : m_cLocalBranch
.GetColor());
100 m_Colors
.SetColor(CColors::RemoteBranch
, m_cRemoteBranch
.GetColor() == -1 ? m_cRemoteBranch
.GetAutomaticColor() : m_cRemoteBranch
.GetColor());
101 m_Colors
.SetColor(CColors::Tag
, m_cTags
.GetColor() == -1 ? m_cTags
.GetAutomaticColor() : m_cTags
.GetColor());
102 m_Colors
.SetColor(CColors::FilterMatch
, m_cFilterMatch
.GetColor() == -1 ? m_cFilterMatch
.GetAutomaticColor() : m_cFilterMatch
.GetColor());
103 return ISettingsPropPage::OnApply();
106 void CSettingsColors2::OnBnClickedColor()