some spaces-tabs code cleanup
[TortoiseGit.git] / src / TortoiseProc / Settings / SettingsColors2.cpp
blob2e6687448143452f7c982cfa1ee1cb75e102830c
1 // TortoiseSVN - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #include "stdafx.h"
20 #include "TortoiseProc.h"
21 #include "SettingsColors2.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);
44 BEGIN_MESSAGE_MAP(CSettingsColors2, ISettingsPropPage)
45 ON_BN_CLICKED(IDC_RESTORE, OnBnClickedRestore)
46 ON_BN_CLICKED(IDC_CURRENT_BRANCH, &CSettingsColors2::OnBnClickedColor)
47 ON_BN_CLICKED(IDC_LOCAL_BRANCH, &CSettingsColors2::OnBnClickedColor)
48 ON_BN_CLICKED(IDC_REMOTE_BRANCH, &CSettingsColors2::OnBnClickedColor)
49 ON_BN_CLICKED(IDC_TAGS, &CSettingsColors2::OnBnClickedColor)
50 END_MESSAGE_MAP()
52 BOOL CSettingsColors2::OnInitDialog()
54 ISettingsPropPage::OnInitDialog();
56 m_cCurrentBranch.SetColor(m_Colors.GetColor(CColors::CurrentBranch));
57 m_cLocalBranch.SetColor(m_Colors.GetColor(CColors::LocalBranch));
58 m_cRemoteBranch.SetColor(m_Colors.GetColor(CColors::RemoteBranch));
59 m_cTags.SetColor(m_Colors.GetColor(CColors::Tag));
61 CString sDefaultText, sCustomText;
62 sDefaultText.LoadString(IDS_COLOURPICKER_DEFAULTTEXT);
63 sCustomText.LoadString(IDS_COLOURPICKER_CUSTOMTEXT);
65 m_cCurrentBranch.EnableAutomaticButton(sDefaultText, m_Colors.GetColor(CColors::CurrentBranch, true));
66 m_cCurrentBranch.EnableOtherButton(sCustomText);
68 m_cLocalBranch.EnableAutomaticButton(sDefaultText, m_Colors.GetColor(CColors::LocalBranch, true));
69 m_cLocalBranch.EnableOtherButton(sCustomText);
71 m_cRemoteBranch.EnableAutomaticButton(sDefaultText, m_Colors.GetColor(CColors::RemoteBranch, true));
72 m_cRemoteBranch.EnableOtherButton(sCustomText);
74 m_cTags.EnableAutomaticButton(sDefaultText, m_Colors.GetColor(CColors::Tag, true));
75 m_cTags.EnableOtherButton(sCustomText);
77 return TRUE;
80 void CSettingsColors2::OnBnClickedRestore()
82 m_cCurrentBranch.SetColor(m_Colors.GetColor(CColors::CurrentBranch));
83 m_cLocalBranch.SetColor(m_Colors.GetColor(CColors::LocalBranch));
84 m_cRemoteBranch.SetColor(m_Colors.GetColor(CColors::RemoteBranch));
85 m_cTags.SetColor(m_Colors.GetColor(CColors::Tag));
87 SetModified(TRUE);
90 BOOL CSettingsColors2::OnApply()
92 m_Colors.SetColor(CColors::CurrentBranch, m_cCurrentBranch.GetColor() == -1 ? m_cCurrentBranch.GetAutomaticColor() : m_cCurrentBranch.GetColor());
93 m_Colors.SetColor(CColors::LocalBranch, m_cLocalBranch.GetColor() == -1 ? m_cLocalBranch.GetAutomaticColor() : m_cLocalBranch.GetColor());
94 m_Colors.SetColor(CColors::RemoteBranch, m_cRemoteBranch.GetColor() == -1 ? m_cRemoteBranch.GetAutomaticColor() : m_cRemoteBranch.GetColor());
95 m_Colors.SetColor(CColors::Tag, m_cTags.GetColor() == -1 ? m_cTags.GetAutomaticColor() : m_cTags.GetColor());
97 return ISettingsPropPage::OnApply();
100 void CSettingsColors2::OnBnClickedColor()
102 SetModified();