OSDN Git Service

Enable Submodule Add dialog resizable
[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         int  ParserShortLog(CTGitPath *path ,CString &hash,int count=-1 ,int mask=CGit::LOG_INFO_ONLY_HASH );\r
64 \r
65         int  ParserFromRefLog(CString ref);\r
66 \r
67         int FetchFullInfo(int i);\r
68 //      void AddFullInfo(\r
69 \r
70         Lanes m_Lns;\r
71         int      m_FirstFreeLane;\r
72         MAP_HASH_REV m_HashMap;\r
73         void updateLanes(GitRev& c, Lanes& lns, CString &sha) ;\r
74         void setLane(CString& sha) ;\r
75         \r
76         \r
77 \r
78 \r
79 #if 0\r
80         /// Ascending date sorting.\r
81         struct AscDateSort\r
82         {\r
83                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
84                 {\r
85                         return pStart->tmDate < pEnd->tmDate;\r
86                 }\r
87         };\r
88         /// Descending date sorting.\r
89         struct DescDateSort\r
90         {\r
91                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
92                 {\r
93                         return pStart->tmDate > pEnd->tmDate;\r
94                 }\r
95         };\r
96         /// Ascending revision sorting.\r
97         struct AscRevSort\r
98         {\r
99                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
100                 {\r
101                         return pStart->Rev < pEnd->Rev;\r
102                 }\r
103         };\r
104         /// Descending revision sorting.\r
105         struct DescRevSort\r
106         {\r
107                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
108                 {\r
109                         return pStart->Rev > pEnd->Rev;\r
110                 }\r
111         };\r
112         /// Ascending author sorting.\r
113         struct AscAuthorSort\r
114         {\r
115                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
116                 {\r
117                         int ret = pStart->sAuthor.CompareNoCase(pEnd->sAuthor);\r
118                         if (ret == 0)\r
119                                 return pStart->Rev < pEnd->Rev;\r
120                         return ret<0;\r
121                 }\r
122         };\r
123         /// Descending author sorting.\r
124         struct DescAuthorSort\r
125         {\r
126                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
127                 {\r
128                         int ret = pStart->sAuthor.CompareNoCase(pEnd->sAuthor);\r
129                         if (ret == 0)\r
130                                 return pStart->Rev > pEnd->Rev;\r
131                         return ret>0;\r
132                 }\r
133         };\r
134         /// Ascending bugID sorting.\r
135         struct AscBugIDSort\r
136         {\r
137                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
138                 {\r
139                         int ret = pStart->sBugIDs.CompareNoCase(pEnd->sBugIDs);\r
140                         if (ret == 0)\r
141                                 return pStart->Rev < pEnd->Rev;\r
142                         return ret<0;\r
143                 }\r
144         };\r
145         /// Descending bugID sorting.\r
146         struct DescBugIDSort\r
147         {\r
148                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
149                 {\r
150                         int ret = pStart->sBugIDs.CompareNoCase(pEnd->sBugIDs);\r
151                         if (ret == 0)\r
152                                 return pStart->Rev > pEnd->Rev;\r
153                         return ret>0;\r
154                 }\r
155         };\r
156         /// Ascending message sorting.\r
157         struct AscMessageSort\r
158         {\r
159                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
160                 {\r
161                         return pStart->sShortMessage.CompareNoCase(pEnd->sShortMessage)<0;\r
162                 }\r
163         };\r
164         /// Descending message sorting.\r
165         struct DescMessageSort\r
166         {\r
167                 bool operator()(GitRev& pStart, GitRev& pEnd)\r
168                 {\r
169                         return pStart->sShortMessage.CompareNoCase(pEnd->sShortMessage)>0;\r
170                 }\r
171         };\r
172         /// Ascending action sorting\r
173         struct AscActionSort\r
174         {\r
175                 bool operator() (GitRev& pStart, GitRev& pEnd)\r
176                 {\r
177                         if (pStart->actions == pEnd->actions)\r
178                                 return pStart->Rev < pEnd->Rev;\r
179                         return pStart->actions < pEnd->actions;\r
180                 }\r
181         };\r
182         /// Descending action sorting\r
183         struct DescActionSort\r
184         {\r
185                 bool operator() (GitRev& pStart, GitRev& pEnd)\r
186                 {\r
187                         if (pStart->actions == pEnd->actions)\r
188                                 return pStart->Rev > pEnd->Rev;\r
189                         return pStart->actions > pEnd->actions;\r
190                 }\r
191         };\r
192 #endif\r
193 };\r