OSDN Git Service

Status List intergrate to LogDlg
[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 \r
26 class CLogDlg;\r
27 \r
28 /**\r
29  * \ingroup TortoiseProc\r
30  * Instances of CStoreSelection save the selection of the CLogDlg. When the instance\r
31  * is deleted the destructor restores the selection.\r
32  */\r
33 typedef std::map<CString, int> MAP_HASH_REV;\r
34 \r
35 class CStoreSelection\r
36 {\r
37 public:\r
38         CStoreSelection(CLogDlg* dlg);\r
39         ~CStoreSelection();\r
40 protected:\r
41         CLogDlg* m_logdlg;\r
42         std::set<LONG> m_SetSelectedRevisions;\r
43 };\r
44 \r
45 /**\r
46  * \ingroup TortoiseProc\r
47  * Contains the data of one log entry, used in the log dialog\r
48  */\r
49 #if 0\r
50 typedef struct LogEntryData\r
51 {   \r
52         git_revnum_t Rev;\r
53         __time64_t tmDate;\r
54         CString sDate;\r
55         CString sAuthor;\r
56         CString sMessage;\r
57         CString sShortMessage;\r
58         CString sBugIDs;\r
59         DWORD dwFileChanges;\r
60         LogChangedPathArray* pArChangedPaths;\r
61         BOOL bCopies;\r
62         BOOL bCopiedSelf;\r
63         DWORD actions;\r
64         BOOL haschildren;\r
65         DWORD childStackDepth;\r
66 } LOGENTRYDATA, *PLOGENTRYDATA;\r
67 #endif\r
68 /**\r
69  * \ingroup TortoiseProc\r
70  * Helper class for the log dialog, handles all the log entries, including\r
71  * sorting.\r
72  */\r
73 class CLogDataVector :  public std::vector<GitRev>\r
74 {\r
75 public:\r
76         /// De-allocates log items.\r
77         CLogDataVector()\r
78         {\r
79                 m_FirstFreeLane=0;\r
80         }\r
81         void ClearAll();\r
82         int  ParserFromLog();\r
83         int ParserShortLog();\r
84         int FetchFullInfo(int i);\r
85 \r
86         Lanes m_Lanes;\r
87         int      m_FirstFreeLane;\r
88         MAP_HASH_REV m_HashMap;\r
89         void updateLanes(GitRev& c, Lanes& lns, CString &sha) ;\r
90         void setLane(CString& sha) ;\r
91         \r
92         \r
93 \r
94 \r
95 #if 0\r
96         /// Ascending date sorting.\r
97         struct AscDateSort\r
98         {\r
99                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
100                 {\r
101                         return pStart->tmDate < pEnd->tmDate;\r
102                 }\r
103         };\r
104         /// Descending date sorting.\r
105         struct DescDateSort\r
106         {\r
107                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
108                 {\r
109                         return pStart->tmDate > pEnd->tmDate;\r
110                 }\r
111         };\r
112         /// Ascending revision sorting.\r
113         struct AscRevSort\r
114         {\r
115                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
116                 {\r
117                         return pStart->Rev < pEnd->Rev;\r
118                 }\r
119         };\r
120         /// Descending revision sorting.\r
121         struct DescRevSort\r
122         {\r
123                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
124                 {\r
125                         return pStart->Rev > pEnd->Rev;\r
126                 }\r
127         };\r
128         /// Ascending author sorting.\r
129         struct AscAuthorSort\r
130         {\r
131                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
132                 {\r
133                         int ret = pStart->sAuthor.CompareNoCase(pEnd->sAuthor);\r
134                         if (ret == 0)\r
135                                 return pStart->Rev < pEnd->Rev;\r
136                         return ret<0;\r
137                 }\r
138         };\r
139         /// Descending author sorting.\r
140         struct DescAuthorSort\r
141         {\r
142                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
143                 {\r
144                         int ret = pStart->sAuthor.CompareNoCase(pEnd->sAuthor);\r
145                         if (ret == 0)\r
146                                 return pStart->Rev > pEnd->Rev;\r
147                         return ret>0;\r
148                 }\r
149         };\r
150         /// Ascending bugID sorting.\r
151         struct AscBugIDSort\r
152         {\r
153                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
154                 {\r
155                         int ret = pStart->sBugIDs.CompareNoCase(pEnd->sBugIDs);\r
156                         if (ret == 0)\r
157                                 return pStart->Rev < pEnd->Rev;\r
158                         return ret<0;\r
159                 }\r
160         };\r
161         /// Descending bugID sorting.\r
162         struct DescBugIDSort\r
163         {\r
164                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
165                 {\r
166                         int ret = pStart->sBugIDs.CompareNoCase(pEnd->sBugIDs);\r
167                         if (ret == 0)\r
168                                 return pStart->Rev > pEnd->Rev;\r
169                         return ret>0;\r
170                 }\r
171         };\r
172         /// Ascending message sorting.\r
173         struct AscMessageSort\r
174         {\r
175                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
176                 {\r
177                         return pStart->sShortMessage.CompareNoCase(pEnd->sShortMessage)<0;\r
178                 }\r
179         };\r
180         /// Descending message sorting.\r
181         struct DescMessageSort\r
182         {\r
183                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
184                 {\r
185                         return pStart->sShortMessage.CompareNoCase(pEnd->sShortMessage)>0;\r
186                 }\r
187         };\r
188         /// Ascending action sorting\r
189         struct AscActionSort\r
190         {\r
191                 bool operator() (GitRev& pStart, GitRev& pEnd)\r
192                 {\r
193                         if (pStart->actions == pEnd->actions)\r
194                                 return pStart->Rev < pEnd->Rev;\r
195                         return pStart->actions < pEnd->actions;\r
196                 }\r
197         };\r
198         /// Descending action sorting\r
199         struct DescActionSort\r
200         {\r
201                 bool operator() (GitRev& pStart, GitRev& pEnd)\r
202                 {\r
203                         if (pStart->actions == pEnd->actions)\r
204                                 return pStart->Rev > pEnd->Rev;\r
205                         return pStart->actions > pEnd->actions;\r
206                 }\r
207         };\r
208 #endif\r
209 };\r