1 // TortoiseSVN - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2007 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "LogDlgHelper.h"
23 CStoreSelection::CStoreSelection(CLogDlg
* dlg
)
28 int selIndex
= m_logdlg
->m_LogList
.GetSelectionMark();
31 POSITION pos
= m_logdlg
->m_LogList
.GetFirstSelectedItemPosition();
32 int nIndex
= m_logdlg
->m_LogList
.GetNextSelectedItem(pos
);
33 if ( nIndex
!=-1 && nIndex
< m_logdlg
->m_arShownList
.GetSize() )
35 PLOGENTRYDATA pLogEntry
= reinterpret_cast<PLOGENTRYDATA
>(m_logdlg
->m_arShownList
.GetAt(nIndex
));
36 m_SetSelectedRevisions
.insert(pLogEntry
->Rev
);
39 nIndex
= m_logdlg
->m_LogList
.GetNextSelectedItem(pos
);
40 if ( nIndex
!=-1 && nIndex
< m_logdlg
->m_arShownList
.GetSize() )
42 pLogEntry
= reinterpret_cast<PLOGENTRYDATA
>(m_logdlg
->m_arShownList
.GetAt(nIndex
));
43 m_SetSelectedRevisions
.insert(pLogEntry
->Rev
);
51 CStoreSelection::~CStoreSelection()
54 if ( m_SetSelectedRevisions
.size()>0 )
56 for (int i
=0; i
<m_logdlg
->m_arShownList
.GetCount(); ++i
)
58 LONG nRevision
= reinterpret_cast<PLOGENTRYDATA
>(m_logdlg
->m_arShownList
.GetAt(i
))->Rev
;
59 if ( m_SetSelectedRevisions
.find(nRevision
)!=m_SetSelectedRevisions
.end() )
61 m_logdlg
->m_LogList
.SetSelectionMark(i
);
62 m_logdlg
->m_LogList
.SetItemState(i
, LVIS_SELECTED
, LVIS_SELECTED
);
63 m_logdlg
->m_LogList
.EnsureVisible(i
, FALSE
);