pulled latest translations from Transifex
[TortoiseGit.git] / src / TortoiseProc / Settings / SettingsColors.cpp
blob275d28792c80058861a5018e33a64b95668142a5
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 "SettingsColors.h"
22 #include ".\settingscolors.h"
24 IMPLEMENT_DYNAMIC(CSettingsColors, ISettingsPropPage)
25 CSettingsColors::CSettingsColors()
26 : ISettingsPropPage(CSettingsColors::IDD)
30 CSettingsColors::~CSettingsColors()
34 void CSettingsColors::DoDataExchange(CDataExchange* pDX)
36 ISettingsPropPage::DoDataExchange(pDX);
37 DDX_Control(pDX, IDC_CONFLICTCOLOR, m_cConflict);
38 DDX_Control(pDX, IDC_ADDEDCOLOR, m_cAdded);
39 DDX_Control(pDX, IDC_DELETEDCOLOR, m_cDeleted);
40 DDX_Control(pDX, IDC_MERGEDCOLOR, m_cMerged);
41 DDX_Control(pDX, IDC_MODIFIEDCOLOR, m_cModified);
42 DDX_Control(pDX, IDC_DELETEDNODECOLOR, m_cDeletedNode);
43 DDX_Control(pDX, IDC_ADDEDNODECOLOR, m_cAddedNode);
44 DDX_Control(pDX, IDC_REPLACEDNODECOLOR, m_cReplacedNode);
45 DDX_Control(pDX, IDC_RENAMEDNODECOLOR, m_cRenamedNode);
49 BEGIN_MESSAGE_MAP(CSettingsColors, ISettingsPropPage)
50 ON_BN_CLICKED(IDC_RESTORE, OnBnClickedRestore)
51 ON_BN_CLICKED(IDC_CONFLICTCOLOR, &CSettingsColors::OnBnClickedColor)
52 ON_BN_CLICKED(IDC_ADDEDCOLOR, &CSettingsColors::OnBnClickedColor)
53 ON_BN_CLICKED(IDC_DELETEDCOLOR, &CSettingsColors::OnBnClickedColor)
54 ON_BN_CLICKED(IDC_MERGEDCOLOR, &CSettingsColors::OnBnClickedColor)
55 ON_BN_CLICKED(IDC_MODIFIEDCOLOR, &CSettingsColors::OnBnClickedColor)
56 ON_BN_CLICKED(IDC_DELETEDNODECOLOR, &CSettingsColors::OnBnClickedColor)
57 ON_BN_CLICKED(IDC_ADDEDNODECOLOR, &CSettingsColors::OnBnClickedColor)
58 ON_BN_CLICKED(IDC_REPLACEDNODECOLOR, &CSettingsColors::OnBnClickedColor)
59 ON_BN_CLICKED(IDC_RENAMEDNODECOLOR, &CSettingsColors::OnBnClickedColor)
60 END_MESSAGE_MAP()
62 BOOL CSettingsColors::OnInitDialog()
64 ISettingsPropPage::OnInitDialog();
66 m_cAdded.SetColor(m_Colors.GetColor(CColors::Added));
67 m_cDeleted.SetColor(m_Colors.GetColor(CColors::Deleted));
68 m_cMerged.SetColor(m_Colors.GetColor(CColors::Merged));
69 m_cModified.SetColor(m_Colors.GetColor(CColors::Modified));
70 m_cConflict.SetColor(m_Colors.GetColor(CColors::Conflict));
71 m_cAddedNode.SetColor(m_Colors.GetColor(CColors::AddedNode));
72 m_cDeletedNode.SetColor(m_Colors.GetColor(CColors::DeletedNode));
73 m_cRenamedNode.SetColor(m_Colors.GetColor(CColors::RenamedNode));
74 m_cReplacedNode.SetColor(m_Colors.GetColor(CColors::ReplacedNode));
76 CString sDefaultText, sCustomText;
77 sDefaultText.LoadString(IDS_COLOURPICKER_DEFAULTTEXT);
78 sCustomText.LoadString(IDS_COLOURPICKER_CUSTOMTEXT);
79 m_cAdded.EnableAutomaticButton(sDefaultText, m_Colors.GetColor(CColors::Added, true));
80 m_cAdded.EnableOtherButton(sCustomText);
81 m_cDeleted.EnableAutomaticButton(sDefaultText, m_Colors.GetColor(CColors::Deleted, true));
82 m_cDeleted.EnableOtherButton(sCustomText);
83 m_cMerged.EnableAutomaticButton(sDefaultText, m_Colors.GetColor(CColors::Merged, true));
84 m_cMerged.EnableOtherButton(sCustomText);
85 m_cModified.EnableAutomaticButton(sDefaultText, m_Colors.GetColor(CColors::Modified, true));
86 m_cModified.EnableOtherButton(sCustomText);
87 m_cConflict.EnableAutomaticButton(sDefaultText, m_Colors.GetColor(CColors::Conflict, true));
88 m_cConflict.EnableOtherButton(sCustomText);
89 m_cAddedNode.EnableAutomaticButton(sDefaultText, m_Colors.GetColor(CColors::AddedNode, true));
90 m_cAddedNode.EnableOtherButton(sCustomText);
91 m_cDeletedNode.EnableAutomaticButton(sDefaultText, m_Colors.GetColor(CColors::DeletedNode, true));
92 m_cDeletedNode.EnableOtherButton(sCustomText);
93 m_cRenamedNode.EnableAutomaticButton(sDefaultText, m_Colors.GetColor(CColors::RenamedNode, true));
94 m_cRenamedNode.EnableOtherButton(sCustomText);
95 m_cReplacedNode.EnableAutomaticButton(sDefaultText, m_Colors.GetColor(CColors::ReplacedNode, true));
96 m_cReplacedNode.EnableOtherButton(sCustomText);
98 return TRUE;
101 void CSettingsColors::OnBnClickedRestore()
103 m_cAdded.SetColor(m_Colors.GetColor(CColors::Added));
104 m_cDeleted.SetColor(m_Colors.GetColor(CColors::Deleted));
105 m_cMerged.SetColor(m_Colors.GetColor(CColors::Merged));
106 m_cModified.SetColor(m_Colors.GetColor(CColors::Modified));
107 m_cConflict.SetColor(m_Colors.GetColor(CColors::Conflict));
108 m_cAddedNode.SetColor(m_Colors.GetColor(CColors::AddedNode));
109 m_cDeletedNode.SetColor(m_Colors.GetColor(CColors::DeletedNode));
110 m_cRenamedNode.SetColor(m_Colors.GetColor(CColors::RenamedNode));
111 m_cReplacedNode.SetColor(m_Colors.GetColor(CColors::ReplacedNode));
112 SetModified(TRUE);
115 BOOL CSettingsColors::OnApply()
117 m_Colors.SetColor(CColors::Added, m_cAdded.GetColor() == -1 ? m_cAdded.GetAutomaticColor() : m_cAdded.GetColor());
118 m_Colors.SetColor(CColors::Deleted, m_cDeleted.GetColor() == -1 ? m_cDeleted.GetAutomaticColor() : m_cDeleted.GetColor());
119 m_Colors.SetColor(CColors::Merged, m_cMerged.GetColor() == -1 ? m_cMerged.GetAutomaticColor() : m_cMerged.GetColor());
120 m_Colors.SetColor(CColors::Modified, m_cModified.GetColor() == -1 ? m_cModified.GetAutomaticColor() : m_cModified.GetColor());
121 m_Colors.SetColor(CColors::Conflict, m_cConflict.GetColor() == -1 ? m_cConflict.GetAutomaticColor() : m_cConflict.GetColor());
122 m_Colors.SetColor(CColors::AddedNode, m_cAddedNode.GetColor() == -1 ? m_cAddedNode.GetAutomaticColor() : m_cAddedNode.GetColor());
123 m_Colors.SetColor(CColors::DeletedNode, m_cDeletedNode.GetColor() == -1 ? m_cDeletedNode.GetAutomaticColor() : m_cDeletedNode.GetColor());
124 m_Colors.SetColor(CColors::RenamedNode, m_cRenamedNode.GetColor() == -1 ? m_cRenamedNode.GetAutomaticColor() : m_cRenamedNode.GetColor());
125 m_Colors.SetColor(CColors::ReplacedNode, m_cReplacedNode.GetColor() == -1 ? m_cReplacedNode.GetAutomaticColor() : m_cReplacedNode.GetColor());
126 m_Colors.SetColor(CColors::PropertyChanged, m_cModified.GetColor() == -1 ? m_cModified.GetAutomaticColor() : m_cModified.GetColor());
128 return ISettingsPropPage::OnApply();
131 void CSettingsColors::OnBnClickedColor()
133 SetModified();