Added CString wrapper for get_windows_home_directory()
[TortoiseGit.git] / src / TortoiseProc / Settings / SettingsColors3.cpp
blob539b13f71dfeac97da8ef5fd4b23b6a176826011
1 // TortoiseGit - 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 "SettingsColors3.h"
22 #include ".\settingscolors3.h"
24 IMPLEMENT_DYNAMIC(CSettingsColors3, ISettingsPropPage)
25 CSettingsColors3::CSettingsColors3()
26 : ISettingsPropPage(CSettingsColors3::IDD)
30 CSettingsColors3::~CSettingsColors3()
34 void CSettingsColors3::DoDataExchange(CDataExchange* pDX)
36 ISettingsPropPage::DoDataExchange(pDX);
37 DDX_Control(pDX, IDC_COLOR_LINE1, m_cLine[0]);
38 DDX_Control(pDX, IDC_COLOR_LINE2, m_cLine[1]);
39 DDX_Control(pDX, IDC_COLOR_LINE3, m_cLine[2]);
40 DDX_Control(pDX, IDC_COLOR_LINE4, m_cLine[3]);
41 DDX_Control(pDX, IDC_COLOR_LINE5, m_cLine[4]);
42 DDX_Control(pDX, IDC_COLOR_LINE6, m_cLine[5]);
43 DDX_Control(pDX, IDC_COLOR_LINE7, m_cLine[6]);
44 DDX_Control(pDX, IDC_COLOR_LINE8, m_cLine[7]);
49 BEGIN_MESSAGE_MAP(CSettingsColors3, ISettingsPropPage)
50 ON_BN_CLICKED(IDC_RESTORE, OnBnClickedRestore)
51 ON_BN_CLICKED(IDC_COLOR_LINE1, &CSettingsColors3::OnBnClickedColor)
52 ON_BN_CLICKED(IDC_COLOR_LINE2, &CSettingsColors3::OnBnClickedColor)
53 ON_BN_CLICKED(IDC_COLOR_LINE3, &CSettingsColors3::OnBnClickedColor)
54 ON_BN_CLICKED(IDC_COLOR_LINE4, &CSettingsColors3::OnBnClickedColor)
55 ON_BN_CLICKED(IDC_COLOR_LINE5, &CSettingsColors3::OnBnClickedColor)
56 ON_BN_CLICKED(IDC_COLOR_LINE6, &CSettingsColors3::OnBnClickedColor)
57 ON_BN_CLICKED(IDC_COLOR_LINE7, &CSettingsColors3::OnBnClickedColor)
58 ON_BN_CLICKED(IDC_COLOR_LINE8, &CSettingsColors3::OnBnClickedColor)
59 END_MESSAGE_MAP()
61 BOOL CSettingsColors3::OnInitDialog()
63 ISettingsPropPage::OnInitDialog();
65 CString sDefaultText, sCustomText;
66 sDefaultText.LoadString(IDS_COLOURPICKER_DEFAULTTEXT);
67 sCustomText.LoadString(IDS_COLOURPICKER_CUSTOMTEXT);
69 for(int i=0;i<8;i++)
71 m_cLine[i].SetColor(m_Colors.GetColor((CColors::Colors)(CColors::BranchLine1+i)));
72 m_cLine[i].EnableAutomaticButton(sDefaultText, m_Colors.GetColor((CColors::Colors)(CColors::BranchLine1+i), true));
73 m_cLine[i].EnableOtherButton(sCustomText);
76 return TRUE;
79 void CSettingsColors3::OnBnClickedRestore()
81 for(int i=0;i<8;i++)
83 m_cLine[i].SetColor(m_Colors.GetColor((CColors::Colors)(CColors::BranchLine1+i)));
85 SetModified(TRUE);
88 BOOL CSettingsColors3::OnApply()
90 for(int i=0;i<8;i++)
92 m_Colors.SetColor((CColors::Colors)(CColors::BranchLine1+i),
93 m_cLine[i].GetColor() == -1 ? m_cLine[i].GetAutomaticColor() : m_cLine[i].GetColor());
95 return ISettingsPropPage::OnApply();
98 void CSettingsColors3::OnBnClickedColor()
100 SetModified();