Added advanced taskbar grouping and highlighting in Win7
[TortoiseGit.git] / src / TortoiseProc / refloglist.cpp
blob13da01db2d61119e754eaf8df366ae44693afbea
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2009-2011,2013 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.
19 #include "stdafx.h"
20 #include "resource.h"
21 #include "RefLogDlg.h"
22 #include "git.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()
35 CString temp;
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[] =
45 IDS_HASH,
46 IDS_REF,
47 IDS_ACTION,
48 IDS_MESSAGE,
51 static int with[] =
53 ICONITEMBORDER+16*4,
54 ICONITEMBORDER+16*4,
55 ICONITEMBORDER+16*4,
56 LOGLIST_MESSAGE_MIN,
58 m_dwDefaultColumns = 0xFFFF;
60 SetRedraw(false);
62 m_ColumnManager.SetNames(normal, _countof(normal));
63 m_ColumnManager.ReadSettings(m_dwDefaultColumns,0, m_ColumnRegKey+_T("loglist"), _countof(normal), with);
65 SetRedraw(true);
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))
78 return;
80 // By default, clear text buffer.
81 lstrcpyn(pItem->pszText, _T(""), pItem->cchTextMax);
83 bool bOutOfRange = pItem->iItem >= ShownCountWithStopped();
85 *pResult = 0;
86 if (m_bNoDispUpdates || bOutOfRange)
87 return;
89 // Which item number?
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));
95 CString temp;
97 // Which column?
98 switch (pItem->iSubItem)
100 case this->REFLOG_HASH:
101 if (pLogEntry)
103 lstrcpyn(pItem->pszText,pLogEntry->m_CommitHash.ToString(), pItem->cchTextMax);
105 break;
106 case REFLOG_REF:
107 if(pLogEntry)
108 lstrcpyn(pItem->pszText, pLogEntry->m_Ref, pItem->cchTextMax);
109 break;
110 case REFLOG_ACTION:
111 if (pLogEntry)
112 lstrcpyn(pItem->pszText, (LPCTSTR)pLogEntry->m_RefAction, pItem->cchTextMax);
113 break;
114 case REFLOG_MESSAGE:
115 if (pLogEntry)
116 lstrcpyn(pItem->pszText, (LPCTSTR)pLogEntry->GetSubject().Trim(), pItem->cchTextMax);
117 break;
119 default:
120 ASSERT(false);
124 void CRefLogList::OnNMCustomdrawLoglist(NMHDR * /*pNMHDR*/, LRESULT *pResult)
126 // Take the default processing unless we set this to something else below.
127 *pResult = CDRF_DODEFAULT;