OSDN Git Service

Modify Git Clone Control Tab order
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / LogDlgHelper.h
1 // TortoiseGit - a Windows shell extension for easy version control\r
2 \r
3 // Copyright (C) 2003-2007 - TortoiseGit\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 #pragma once\r
20 #include "Git.h"\r
21 #include "GitRev.h"\r
22 #include "GitStatus.h"\r
23 #include "ILogReceiver.h"\r
24 #include "lanes.h"\r
25 #include <set> \r
26 \r
27 class CLogDlg;\r
28 \r
29 /**\r
30  * \ingroup TortoiseProc\r
31  * Instances of CStoreSelection save the selection of the CLogDlg. When the instance\r
32  * is deleted the destructor restores the selection.\r
33  */\r
34 typedef std::map<CString, int> MAP_HASH_REV;\r
35 \r
36 class CStoreSelection\r
37 {\r
38 public:\r
39         CStoreSelection(CLogDlg* dlg);\r
40         ~CStoreSelection();\r
41 protected:\r
42         CLogDlg* m_logdlg;\r
43         std::set<LONG> m_SetSelectedRevisions;\r
44 };\r
45 \r
46 \r
47 /**\r
48  * \ingroup TortoiseProc\r
49  * Helper class for the log dialog, handles all the log entries, including\r
50  * sorting.\r
51  */\r
52 class CLogDataVector :  public std::vector<GitRev>\r
53 {\r
54 public:\r
55         /// De-allocates log items.\r
56         CLogDataVector()\r
57         {\r
58                 m_FirstFreeLane=0;\r
59         }\r
60         void ClearAll();\r
61         int  ParserFromLog(CTGitPath *path =NULL,int count = -1,int infomask=CGit::LOG_INFO_STAT|CGit::LOG_INFO_FILESTATE,\r
62                                                                                          CString *from=NULL,CString *to=NULL);\r
63 \r
64         int  FetchShortLog(CTGitPath *path , CString &hash,int count=-1 ,int mask=CGit::LOG_INFO_ONLY_HASH );\r
65         int  ParserShortLog(CTGitPath *path ,CString &hash,int count=-1 ,int mask=CGit::LOG_INFO_ONLY_HASH );\r
66 \r
67         int  ParserFromRefLog(CString ref);\r
68 \r
69         int FetchFullInfo(int i);\r
70 //      void AddFullInfo(\r
71 \r
72         Lanes m_Lns;\r
73         int      m_FirstFreeLane;\r
74         MAP_HASH_REV m_HashMap;\r
75         void updateLanes(GitRev& c, Lanes& lns, CString &sha) ;\r
76         void setLane(CString& sha) ;\r
77 \r
78         BYTE_VECTOR              m_RawlogData;\r
79         std::vector<int> m_RawLogStart;\r
80 \r
81 #if 0\r
82         /// Ascending date sorting.\r
83         struct AscDateSort\r
84         {\r
85                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
86                 {\r
87                         return pStart->tmDate < pEnd->tmDate;\r
88                 }\r
89         };\r
90         /// Descending date sorting.\r
91         struct DescDateSort\r
92         {\r
93                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
94                 {\r
95                         return pStart->tmDate > pEnd->tmDate;\r
96                 }\r
97         };\r
98         /// Ascending revision sorting.\r
99         struct AscRevSort\r
100         {\r
101                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
102                 {\r
103                         return pStart->Rev < pEnd->Rev;\r
104                 }\r
105         };\r
106         /// Descending revision sorting.\r
107         struct DescRevSort\r
108         {\r
109                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
110                 {\r
111                         return pStart->Rev > pEnd->Rev;\r
112                 }\r
113         };\r
114         /// Ascending author sorting.\r
115         struct AscAuthorSort\r
116         {\r
117                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
118                 {\r
119                         int ret = pStart->sAuthor.CompareNoCase(pEnd->sAuthor);\r
120                         if (ret == 0)\r
121                                 return pStart->Rev < pEnd->Rev;\r
122                         return ret<0;\r
123                 }\r
124         };\r
125         /// Descending author sorting.\r
126         struct DescAuthorSort\r
127         {\r
128                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
129                 {\r
130                         int ret = pStart->sAuthor.CompareNoCase(pEnd->sAuthor);\r
131                         if (ret == 0)\r
132                                 return pStart->Rev > pEnd->Rev;\r
133                         return ret>0;\r
134                 }\r
135         };\r
136         /// Ascending bugID sorting.\r
137         struct AscBugIDSort\r
138         {\r
139                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
140                 {\r
141                         int ret = pStart->sBugIDs.CompareNoCase(pEnd->sBugIDs);\r
142                         if (ret == 0)\r
143                                 return pStart->Rev < pEnd->Rev;\r
144                         return ret<0;\r
145                 }\r
146         };\r
147         /// Descending bugID sorting.\r
148         struct DescBugIDSort\r
149         {\r
150                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
151                 {\r
152                         int ret = pStart->sBugIDs.CompareNoCase(pEnd->sBugIDs);\r
153                         if (ret == 0)\r
154                                 return pStart->Rev > pEnd->Rev;\r
155                         return ret>0;\r
156                 }\r
157         };\r
158         /// Ascending message sorting.\r
159         struct AscMessageSort\r
160         {\r
161                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
162                 {\r
163                         return pStart->sShortMessage.CompareNoCase(pEnd->sShortMessage)<0;\r
164                 }\r
165         };\r
166         /// Descending message sorting.\r
167         struct DescMessageSort\r
168         {\r
169                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
170                 {\r
171                         return pStart->sShortMessage.CompareNoCase(pEnd->sShortMessage)>0;\r
172                 }\r
173         };\r
174         /// Ascending action sorting\r
175         struct AscActionSort\r
176         {\r
177                 bool operator() (GitRev& pStart, GitRev& pEnd)\r
178                 {\r
179                         if (pStart->actions == pEnd->actions)\r
180                                 return pStart->Rev < pEnd->Rev;\r
181                         return pStart->actions < pEnd->actions;\r
182                 }\r
183         };\r
184         /// Descending action sorting\r
185         struct DescActionSort\r
186         {\r
187                 bool operator() (GitRev& pStart, GitRev& pEnd)\r
188                 {\r
189                         if (pStart->actions == pEnd->actions)\r
190                                 return pStart->Rev > pEnd->Rev;\r
191                         return pStart->actions > pEnd->actions;\r
192                 }\r
193         };\r
194 #endif\r
195 };\r