1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2009-2011, 2013, 2015-2017 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 "refloglist.h"
22 #include "LoglistUtils.h"
24 IMPLEMENT_DYNAMIC(CRefLogList
, CGitLogList
)
26 CRefLogList::CRefLogList()
28 m_ColumnRegKey
= L
"reflog";
29 this->m_ContextMenuMask
|= this->GetContextMenuBit(ID_LOG
);
30 this->m_ContextMenuMask
&= ~GetContextMenuBit(ID_COMPARETWOCOMMITCHANGES
);
33 void CRefLogList::InsertRefLogColumn()
37 CRegDWORD
regFullRowSelect(L
"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
[] =
49 IDS_STATUSLIST_COLDATE
,
60 m_dwDefaultColumns
= 0xFFFF;
64 m_ColumnManager
.SetNames(normal
, _countof(normal
));
65 m_ColumnManager
.ReadSettings(m_dwDefaultColumns
, 0, m_ColumnRegKey
+ L
"loglist", _countof(normal
), with
);
70 void CRefLogList::OnLvnGetdispinfoLoglist(NMHDR
*pNMHDR
, LRESULT
*pResult
)
72 NMLVDISPINFO
*pDispInfo
= reinterpret_cast<NMLVDISPINFO
*>(pNMHDR
);
74 // Create a pointer to the item
75 LV_ITEM
* pItem
= &(pDispInfo
)->item
;
77 // Do the list need text information?
78 if (!(pItem
->mask
& LVIF_TEXT
))
81 // By default, clear text buffer.
82 lstrcpyn(pItem
->pszText
, L
"", pItem
->cchTextMax
);
84 bool bOutOfRange
= pItem
->iItem
>= ShownCountWithStopped();
87 if (m_bNoDispUpdates
|| bOutOfRange
)
91 GitRevLoglist
* pLogEntry
= m_arShownList
.SafeGetAt(pItem
->iItem
);
96 switch (pItem
->iSubItem
)
101 lstrcpyn(pItem
->pszText
,pLogEntry
->m_CommitHash
.ToString(), pItem
->cchTextMax
- 1);
106 lstrcpyn(pItem
->pszText
, pLogEntry
->m_Ref
, pItem
->cchTextMax
- 1);
110 lstrcpyn(pItem
->pszText
, (LPCTSTR
)pLogEntry
->m_RefAction
, pItem
->cchTextMax
- 1);
114 lstrcpyn(pItem
->pszText
, (LPCTSTR
)pLogEntry
->GetSubject().Trim(), pItem
->cchTextMax
- 1);
118 lstrcpyn(pItem
->pszText
, (LPCTSTR
)CLoglistUtils::FormatDateAndTime(pLogEntry
->GetCommitterDate(), m_DateFormat
, true, m_bRelativeTimes
), pItem
->cchTextMax
- 1);
126 void CRefLogList::OnNMCustomdrawLoglist(NMHDR
* /*pNMHDR*/, LRESULT
*pResult
)
128 // Take the default processing unless we set this to something else below.
129 *pResult
= CDRF_DODEFAULT
;
132 BOOL
CRefLogList::OnToolTipText(UINT
/*id*/, NMHDR
* /*pNMHDR*/, LRESULT
* /*pResult*/)