OSDN Git Service

Add TortoiseProc
[tortoisegit/TortoiseGitJp.git] / TortoiseProc / LogDlgHelper.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 "LogDlgHelper.h"\r
21 #include "LogDlg.h"\r
22 \r
23 CStoreSelection::CStoreSelection(CLogDlg* dlg)\r
24 {\r
25         m_logdlg = dlg;\r
26 \r
27         int selIndex = m_logdlg->m_LogList.GetSelectionMark();\r
28         if ( selIndex>=0 )\r
29         {\r
30                 POSITION pos = m_logdlg->m_LogList.GetFirstSelectedItemPosition();\r
31                 int nIndex = m_logdlg->m_LogList.GetNextSelectedItem(pos);\r
32                 if ( nIndex!=-1 && nIndex < m_logdlg->m_arShownList.GetSize() )\r
33                 {\r
34                         PLOGENTRYDATA pLogEntry = reinterpret_cast<PLOGENTRYDATA>(m_logdlg->m_arShownList.GetAt(nIndex));\r
35                         m_SetSelectedRevisions.insert(pLogEntry->Rev);\r
36                         while (pos)\r
37                         {\r
38                                 nIndex = m_logdlg->m_LogList.GetNextSelectedItem(pos);\r
39                                 if ( nIndex!=-1 && nIndex < m_logdlg->m_arShownList.GetSize() )\r
40                                 {\r
41                                         pLogEntry = reinterpret_cast<PLOGENTRYDATA>(m_logdlg->m_arShownList.GetAt(nIndex));\r
42                                         m_SetSelectedRevisions.insert(pLogEntry->Rev);\r
43                                 }\r
44                         }\r
45                 }\r
46         }\r
47 }\r
48 \r
49 CStoreSelection::~CStoreSelection()\r
50 {\r
51         if ( m_SetSelectedRevisions.size()>0 )\r
52         {\r
53                 for (int i=0; i<m_logdlg->m_arShownList.GetCount(); ++i)\r
54                 {\r
55                         LONG nRevision = reinterpret_cast<PLOGENTRYDATA>(m_logdlg->m_arShownList.GetAt(i))->Rev;\r
56                         if ( m_SetSelectedRevisions.find(nRevision)!=m_SetSelectedRevisions.end() )\r
57                         {\r
58                                 m_logdlg->m_LogList.SetSelectionMark(i);\r
59                                 m_logdlg->m_LogList.SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);\r
60                                 m_logdlg->m_LogList.EnsureVisible(i, FALSE);\r
61                         }\r
62                 }\r
63         }\r
64 }\r
65 \r
66 void CLogDataVector::ClearAll()\r
67 {\r
68         if(size() > 0)\r
69         {\r
70                 for(iterator it=begin(); it!=end(); ++it)\r
71                 {\r
72                         delete (*it)->pArChangedPaths;\r
73                         delete *it;\r
74                 }     \r
75                 clear();\r
76         }\r
77 }