OSDN Git Service

Fix Issue 22 Error deleting file from context menu if filename contains spaces
[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         {BranchLine1,_T("Software\\TortoiseGit\\Colors\\BranchLine1"), RGB(0,0,0)},\r
42         {BranchLine2,_T("Software\\TortoiseGit\\Colors\\BranchLine2"), RGB(0xFF,0,0)},\r
43         {BranchLine3,_T("Software\\TortoiseGit\\Colors\\BranchLine3"), RGB(0,0xFF,0)},\r
44         {BranchLine4,_T("Software\\TortoiseGit\\Colors\\BranchLine4"), RGB(0,0,0xFF)},\r
45         {BranchLine5,_T("Software\\TortoiseGit\\Colors\\BranchLine5"), RGB(128,128,128)},\r
46         {BranchLine6,_T("Software\\TortoiseGit\\Colors\\BranchLine6"), RGB(128,128,0)},\r
47         {BranchLine7,_T("Software\\TortoiseGit\\Colors\\BranchLine7"), RGB(0,128,128)},\r
48         {BranchLine8,_T("Software\\TortoiseGit\\Colors\\BranchLine8"), RGB(128,0,128)},\r
49         {COLOR_END,_T("Software\\TortoiseGit\\Colors\\END"),RGB(0,0,0)},\r
50 \r
51 };\r
52 \r
53 CColors::CColors(void) \r
54 {\r
55 }\r
56 \r
57 CColors::~CColors(void)\r
58 {\r
59 }\r
60 \r
61 COLORREF CColors::GetColor(Colors col, bool bDefault /*=true*/)\r
62 {\r
63         int i=0;\r
64         while(1)\r
65         {\r
66                 if(m_ColorArray[i].Color == COLOR_END)\r
67                         return RGB(0,0,0);\r
68 \r
69                 if(m_ColorArray[i].Color == col)\r
70                 {\r
71                         if(bDefault)\r
72                                 return m_ColorArray[i].Default;\r
73                         else\r
74                         {\r
75                                 CRegDWORD reg(m_ColorArray[i].RegKey,m_ColorArray[i].Default);\r
76                                 return (COLORREF)(DWORD) reg;\r
77                         }\r
78                 }\r
79 \r
80                 i++;\r
81         }\r
82 }\r
83 \r
84 void CColors::SetColor(Colors col, COLORREF cr)\r
85 {\r
86         int i=0;\r
87         while(1)\r
88         {\r
89                 if(m_ColorArray[i].Color == COLOR_END)\r
90                         break;\r
91 \r
92                 if(m_ColorArray[i].Color == col)\r
93                 {\r
94                         CRegDWORD reg(m_ColorArray[i].RegKey,m_ColorArray[i].Default);\r
95                         reg=cr;\r
96                         \r
97                 }\r
98                 i++;\r
99         }\r
100 }\r