1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2009-2011,2013,2015 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"
24 #include "LoglistUtils.h"
26 IMPLEMENT_DYNAMIC(CRefLogList
, CGitLogList
)
28 CRefLogList::CRefLogList()
30 m_ColumnRegKey
=_T("reflog");
31 this->m_ContextMenuMask
|= this->GetContextMenuBit(ID_LOG
);
34 void CRefLogList::InsertRefLogColumn()
38 CRegDWORD
regFullRowSelect(_T("Software\\TortoiseGit\\FullRowSelect"), TRUE
);
39 DWORD exStyle
= LVS_EX_HEADERDRAGDROP
| LVS_EX_DOUBLEBUFFER
| LVS_EX_INFOTIP
| LVS_EX_SUBITEMIMAGES
;
40 if (DWORD(regFullRowSelect
))
41 exStyle
|= LVS_EX_FULLROWSELECT
;
42 SetExtendedStyle(exStyle
);
44 static UINT normal
[] =
50 IDS_STATUSLIST_COLDATE
,
61 m_dwDefaultColumns
= 0xFFFF;
65 m_ColumnManager
.SetNames(normal
, _countof(normal
));
66 m_ColumnManager
.ReadSettings(m_dwDefaultColumns
,0, m_ColumnRegKey
+_T("loglist"), _countof(normal
), with
);
72 void CRefLogList::OnLvnGetdispinfoLoglist(NMHDR
*pNMHDR
, LRESULT
*pResult
)
74 NMLVDISPINFO
*pDispInfo
= reinterpret_cast<NMLVDISPINFO
*>(pNMHDR
);
76 // Create a pointer to the item
77 LV_ITEM
* pItem
= &(pDispInfo
)->item
;
79 // Do the list need text information?
80 if (!(pItem
->mask
& LVIF_TEXT
))
83 // By default, clear text buffer.
84 lstrcpyn(pItem
->pszText
, _T(""), pItem
->cchTextMax
);
86 bool bOutOfRange
= pItem
->iItem
>= ShownCountWithStopped();
89 if (m_bNoDispUpdates
|| bOutOfRange
)
93 int itemid
= pItem
->iItem
;
94 GitRevLoglist
* pLogEntry
= nullptr;
95 if (itemid
< m_arShownList
.GetCount())
96 pLogEntry
= reinterpret_cast<GitRevLoglist
*>(m_arShownList
.GetAt(pItem
->iItem
));
101 switch (pItem
->iSubItem
)
106 lstrcpyn(pItem
->pszText
,pLogEntry
->m_CommitHash
.ToString(), pItem
->cchTextMax
- 1);
111 lstrcpyn(pItem
->pszText
, pLogEntry
->m_Ref
, pItem
->cchTextMax
- 1);
115 lstrcpyn(pItem
->pszText
, (LPCTSTR
)pLogEntry
->m_RefAction
, pItem
->cchTextMax
- 1);
119 lstrcpyn(pItem
->pszText
, (LPCTSTR
)pLogEntry
->GetSubject().Trim(), pItem
->cchTextMax
- 1);
123 lstrcpyn(pItem
->pszText
, (LPCTSTR
)CLoglistUtils::FormatDateAndTime(pLogEntry
->GetCommitterDate(), m_DateFormat
, true, m_bRelativeTimes
), pItem
->cchTextMax
- 1);
131 void CRefLogList::OnNMCustomdrawLoglist(NMHDR
* /*pNMHDR*/, LRESULT
*pResult
)
133 // Take the default processing unless we set this to something else below.
134 *pResult
= CDRF_DODEFAULT
;