OSDN Git Service

ProgressDlg: Changed 'OK' into 'Close' and 'Cancel' into 'Abort'
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / Colors.cpp
1 // TortoiseSVN - a Windows shell extension for easy version control\r
2 \r
3 // Copyright (C) 2003-2007 - TortoiseSVN\r
4 \r
5 // This program is free software; you can redistribute it and/or\r
6 // modify it under the terms of the GNU General Public License\r
7 // as published by the Free Software Foundation; either version 2\r
8 // of the License, or (at your option) any later version.\r
9 \r
10 // This program is distributed in the hope that it will be useful,\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13 // GNU General Public License for more details.\r
14 \r
15 // You should have received a copy of the GNU General Public License\r
16 // along with this program; if not, write to the Free Software Foundation,\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
18 //\r
19 #include "StdAfx.h"\r
20 #include ".\colors.h"\r
21 \r
22 CColors::COLOR_DATA CColors::m_ColorArray[]=\r
23 {\r
24         {Cmd,_T("Software\\TortoiseGit\\Colors\\Cmd"),RGB(100, 100, 100)},\r
25         {Conflict,_T("Software\\TortoiseGit\\Colors\\Conflict"), RGB(255, 0, 0)},\r
26         {Modified,_T("Software\\TortoiseGit\\Colors\\Modified"), RGB(0, 50, 160)},\r
27         {Merged,_T("Software\\TortoiseGit\\Colors\\Merged"), RGB(0, 100, 0)},\r
28         {Deleted,_T("Software\\TortoiseGit\\Colors\\Deleted"), RGB(100, 0, 0)},\r
29         {Added,_T("Software\\TortoiseGit\\Colors\\Added"), RGB(100, 0, 100)},\r
30         {LastCommit,_T("Software\\TortoiseGit\\Colors\\LastCommit"), RGB(100, 100, 100)},\r
31         {DeletedNode,_T("Software\\TortoiseGit\\Colors\\DeletedNode"), RGB(255, 0, 0)},\r
32         {AddedNode,_T("Software\\TortoiseGit\\Colors\\AddedNode"), RGB(0, 255, 0)},\r
33         {ReplacedNode,_T("Software\\TortoiseGit\\Colors\\ReplacedNode"), RGB(0, 255, 0)},\r
34         {RenamedNode,_T("Software\\TortoiseGit\\Colors\\RenamedNode"), RGB(0, 0, 255)},\r
35         {LastCommitNode,_T("Software\\TortoiseGit\\Colors\\LastCommitNode"), RGB(200, 200, 200)},\r
36         {PropertyChanged,_T("Software\\TortoiseGit\\Colors\\PropertyChanged"), RGB(0, 50, 160)},\r
37         {CurrentBranch,_T("Software\\TortoiseGit\\Colors\\CurrentBranch"), RGB(200, 0, 0)},\r
38         {LocalBranch,_T("Software\\TortoiseGit\\Colors\\LocalBranch"), RGB(0, 195, 0)},\r
39         {RemoteBranch,_T("Software\\TortoiseGit\\Colors\\RemoteBranch"), RGB(255, 221, 170)},\r
40         {Tag,_T("Software\\TortoiseGit\\Colors\\Tag"), RGB(255, 255, 0)},\r
41         {Stash,_T("Software\\TortoiseGit\\Colors\\Stash"), RGB(128, 128, 128)},\r
42         {BranchLine1,_T("Software\\TortoiseGit\\Colors\\BranchLine1"), RGB(0,0,0)},\r
43         {BranchLine2,_T("Software\\TortoiseGit\\Colors\\BranchLine2"), RGB(0xFF,0,0)},\r
44         {BranchLine3,_T("Software\\TortoiseGit\\Colors\\BranchLine3"), RGB(0,0xFF,0)},\r
45         {BranchLine4,_T("Software\\TortoiseGit\\Colors\\BranchLine4"), RGB(0,0,0xFF)},\r
46         {BranchLine5,_T("Software\\TortoiseGit\\Colors\\BranchLine5"), RGB(128,128,128)},\r
47         {BranchLine6,_T("Software\\TortoiseGit\\Colors\\BranchLine6"), RGB(128,128,0)},\r
48         {BranchLine7,_T("Software\\TortoiseGit\\Colors\\BranchLine7"), RGB(0,128,128)},\r
49         {BranchLine8,_T("Software\\TortoiseGit\\Colors\\BranchLine8"), RGB(128,0,128)},\r
50         {COLOR_END,_T("Software\\TortoiseGit\\Colors\\END"),RGB(0,0,0)},\r
51 \r
52 };\r
53 \r
54 CColors::CColors(void) \r
55 {\r
56 }\r
57 \r
58 CColors::~CColors(void)\r
59 {\r
60 }\r
61 \r
62 COLORREF CColors::GetColor(Colors col, bool bDefault /*=true*/)\r
63 {\r
64         int i=0;\r
65         while(1)\r
66         {\r
67                 if(m_ColorArray[i].Color == COLOR_END)\r
68                         return RGB(0,0,0);\r
69 \r
70                 if(m_ColorArray[i].Color == col)\r
71                 {\r
72                         if(bDefault)\r
73                                 return m_ColorArray[i].Default;\r
74                         else\r
75                         {\r
76                                 CRegDWORD reg(m_ColorArray[i].RegKey,m_ColorArray[i].Default);\r
77                                 return (COLORREF)(DWORD) reg;\r
78                         }\r
79                 }\r
80 \r
81                 i++;\r
82         }\r
83 }\r
84 \r
85 void CColors::SetColor(Colors col, COLORREF cr)\r
86 {\r
87         int i=0;\r
88         while(1)\r
89         {\r
90                 if(m_ColorArray[i].Color == COLOR_END)\r
91                         break;\r
92 \r
93                 if(m_ColorArray[i].Color == col)\r
94                 {\r
95                         CRegDWORD reg(m_ColorArray[i].RegKey,m_ColorArray[i].Default);\r
96                         reg=cr;\r
97                         \r
98                 }\r
99                 i++;\r
100         }\r
101 }\r