1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2009-2011 - TortoiseGit
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.
21 #include "RefLogDlg.h"
23 #include "RefLogList.h"
25 IMPLEMENT_DYNAMIC(CRefLogList
, CGitLogList
)
27 CRefLogList::CRefLogList()
29 m_ColumnRegKey
=_T("reflog");
30 this->m_ContextMenuMask
|= this->GetContextMenuBit(ID_LOG
);
33 void CRefLogList::InsertRefLogColumn()
37 CRegDWORD
regFullRowSelect(_T("Software\\TortoiseGit\\FullRowSelect"), TRUE
);
38 DWORD exStyle
= LVS_EX_HEADERDRAGDROP
| LVS_EX_DOUBLEBUFFER
| LVS_EX_INFOTIP
| LVS_EX_SUBITEMIMAGES
;
39 if (DWORD(regFullRowSelect
))
40 exStyle
|= LVS_EX_FULLROWSELECT
;
41 SetExtendedStyle(exStyle
);
43 static UINT normal
[] =
58 m_dwDefaultColumns
= 0xFFFF;
62 m_ColumnManager
.SetNames(normal
, _countof(normal
));
63 m_ColumnManager
.ReadSettings(m_dwDefaultColumns
,0, m_ColumnRegKey
+_T("loglist"), _countof(normal
), with
);
69 void CRefLogList::OnLvnGetdispinfoLoglist(NMHDR
*pNMHDR
, LRESULT
*pResult
)
71 NMLVDISPINFO
*pDispInfo
= reinterpret_cast<NMLVDISPINFO
*>(pNMHDR
);
73 // Create a pointer to the item
74 LV_ITEM
* pItem
= &(pDispInfo
)->item
;
76 // Do the list need text information?
77 if (!(pItem
->mask
& LVIF_TEXT
))
80 // By default, clear text buffer.
81 lstrcpyn(pItem
->pszText
, _T(""), pItem
->cchTextMax
);
83 bool bOutOfRange
= pItem
->iItem
>= ShownCountWithStopped();
86 if (m_bNoDispUpdates
|| bOutOfRange
)
90 int itemid
= pItem
->iItem
;
91 GitRev
* pLogEntry
= NULL
;
92 if (itemid
< m_arShownList
.GetCount())
93 pLogEntry
= reinterpret_cast<GitRev
*>(m_arShownList
.GetAt(pItem
->iItem
));
98 switch (pItem
->iSubItem
)
100 case this->REFLOG_HASH
:
103 lstrcpyn(pItem
->pszText
,pLogEntry
->m_CommitHash
.ToString(), pItem
->cchTextMax
);
108 lstrcpyn(pItem
->pszText
, pLogEntry
->m_Ref
, pItem
->cchTextMax
);
112 lstrcpyn(pItem
->pszText
, (LPCTSTR
)pLogEntry
->m_RefAction
, pItem
->cchTextMax
);
116 lstrcpyn(pItem
->pszText
, (LPCTSTR
)pLogEntry
->GetSubject().Trim(), pItem
->cchTextMax
);
124 void CRefLogList::OnNMCustomdrawLoglist(NMHDR
*pNMHDR
, LRESULT
*pResult
)
126 UNREFERENCED_PARAMETER(pNMHDR
);
127 // Take the default processing unless we set this to something else below.
128 *pResult
= CDRF_DODEFAULT
;