From e93671ebba37bc1b9a34812eaf507f1c7414c5a5 Mon Sep 17 00:00:00 2001 From: Frank Li Date: Thu, 16 Apr 2009 12:33:17 +0800 Subject: [PATCH] Issue 66 in tortoisegit: Some log lines lose color or disappear after you click on them Signed-off-by: Frank Li --- src/TortoiseProc/GitLogListBase.cpp | 43 ++++++++++++++++++++----------------- src/TortoiseProc/LogDlg.cpp | 9 +------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/src/TortoiseProc/GitLogListBase.cpp b/src/TortoiseProc/GitLogListBase.cpp index 96b1a17e6..453ed3352 100644 --- a/src/TortoiseProc/GitLogListBase.cpp +++ b/src/TortoiseProc/GitLogListBase.cpp @@ -57,6 +57,7 @@ CGitLogListBase::CGitLogListBase():CHintListCtrl() , m_bStrictStopped(false) , m_pStoreSelection(NULL) , m_nSelectedFilter(LOGFILTER_ALL) + , m_bVista(false) { // use the default GUI font, create a copy of it and // change the copy to BOLD (leave the rest of the font @@ -119,6 +120,13 @@ CGitLogListBase::CGitLogListBase():CHintListCtrl() m_ContextMenuMask &= ~GetContextMenuBit(ID_REBASE_EDIT); m_ContextMenuMask &= ~GetContextMenuBit(ID_REBASE_SKIP); + OSVERSIONINFOEX inf; + SecureZeroMemory(&inf, sizeof(OSVERSIONINFOEX)); + inf.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + GetVersionEx((OSVERSIONINFO *)&inf); + WORD fullver = MAKEWORD(inf.dwMinorVersion, inf.dwMajorVersion); + m_bVista = (fullver >= 0x0600); + m_ColumnRegKey=_T("log"); } @@ -309,7 +317,9 @@ void CGitLogListBase::FillBackGround(HDC hdc, int Index,CRect &rect) GetItem(&rItem); GitRev* pLogEntry = (GitRev*)m_arShownList.GetAt(Index); + HBRUSH brush; + if (m_Theme.IsAppThemed() && m_bVista) { m_Theme.Open(m_hWnd, L"Explorer"); @@ -323,34 +333,27 @@ void CGitLogListBase::FillBackGround(HDC hdc, int Index,CRect &rect) } else { -#if 0 - if (pLogEntry->bCopiedSelf) - { - // unfortunately, the pLVCD->nmcd.uItemState does not contain valid - // information at this drawing stage. But we can check the whether the - // previous stage changed the background color of the item - if (pLVCD->clrTextBk == GetSysColor(COLOR_MENU)) - { - HBRUSH brush; - brush = ::CreateSolidBrush(::GetSysColor(COLOR_MENU)); - if (brush) - { - ::FillRect(pLVCD->nmcd.hdc, &rect, brush); - ::DeleteObject(brush); - } - } - } -#endif + if(pLogEntry->m_Action&CTGitPath::LOGACTIONS_REBASE_SQUASH) + brush = ::CreateSolidBrush(RGB(156,156,156)); + else if(pLogEntry->m_Action&CTGitPath::LOGACTIONS_REBASE_EDIT) + brush = ::CreateSolidBrush(RGB(200,200,128)); + + if (brush == NULL) + return; + + ::FillRect(hdc, &rect, brush); + ::DeleteObject(brush); + } if (m_Theme.IsBackgroundPartiallyTransparent(LVP_LISTDETAIL, state)) m_Theme.DrawParentBackground(m_hWnd, hdc, &rect); - + else m_Theme.DrawBackground(hdc, LVP_LISTDETAIL, state, &rect, NULL); } else { - HBRUSH brush; + if (rItem.state & LVIS_SELECTED) { if (::GetFocus() == m_hWnd) diff --git a/src/TortoiseProc/LogDlg.cpp b/src/TortoiseProc/LogDlg.cpp index bb49da226..7be01d9cf 100644 --- a/src/TortoiseProc/LogDlg.cpp +++ b/src/TortoiseProc/LogDlg.cpp @@ -77,7 +77,6 @@ CLogDlg::CLogDlg(CWnd* pParent /*=NULL*/) , m_maxChild(0) , m_bIncludeMerges(FALSE) , m_hAccel(NULL) - , m_bVista(false) { m_bFilterWithRegex = !!CRegDWORD(_T("Software\\TortoiseGit\\UseRegexFilter"), TRUE); m_bAllBranch=FALSE; @@ -171,13 +170,7 @@ BOOL CLogDlg::OnInitDialog() m_hAccel = LoadAccelerators(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_ACC_LOGDLG)); - OSVERSIONINFOEX inf; - SecureZeroMemory(&inf, sizeof(OSVERSIONINFOEX)); - inf.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - GetVersionEx((OSVERSIONINFO *)&inf); - WORD fullver = MAKEWORD(inf.dwMinorVersion, inf.dwMajorVersion); - m_bVista = (fullver >= 0x0600); - + // use the state of the "stop on copy/rename" option from the last time UpdateData(FALSE); -- 2.11.4.GIT