OSDN Git Service

Show correct hight light color
authorFrank Li <lznuaa@gmail.com>
Fri, 26 Dec 2008 13:44:23 +0000 (21:44 +0800)
committerFrank Li <lznuaa@gmail.com>
Fri, 26 Dec 2008 13:44:23 +0000 (21:44 +0800)
src/TortoiseProc/GitLogList.cpp

index 2fe5c00..38bea67 100644 (file)
@@ -330,6 +330,13 @@ void CGitLogList::DrawTagBranch(HDC hdc,CRect &rect,INT_PTR index)
 {\r
        GitRev* data = (GitRev*)m_arShownList.GetAt(index);\r
        CRect rt=rect;\r
+       LVITEM   rItem;\r
+       SecureZeroMemory(&rItem, sizeof(LVITEM));\r
+       rItem.mask  = LVIF_STATE;\r
+       rItem.iItem = index;\r
+       rItem.stateMask = LVIS_SELECTED | LVIS_FOCUSED;\r
+       GetItem(&rItem);\r
+\r
        for(int i=0;i<m_HashMap[data->m_CommitHash].size();i++)\r
        {\r
                CString str;\r
@@ -357,9 +364,24 @@ void CGitLogList::DrawTagBranch(HDC hdc,CRect &rect,INT_PTR index)
                        GetTextExtentPoint32(hdc, shortname,shortname.GetLength(),&size);\r
                \r
                        rt.SetRect(rt.left,rt.top,rt.left+size.cx,rt.bottom);\r
-               \r
+                       rt.right+=4;\r
                        ::FillRect(hdc, &rt, brush);\r
-                       ::DrawText(hdc,shortname,shortname.GetLength(),&rt,DT_CENTER);\r
+                       if (rItem.state & LVIS_SELECTED)\r
+                       {\r
+                               COLORREF   clrOld   = ::SetTextColor(hdc,::GetSysColor(COLOR_HIGHLIGHTTEXT));   \r
+                               ::DrawText(hdc,shortname,shortname.GetLength(),&rt,DT_CENTER);\r
+                               ::SetTextColor(hdc,clrOld);   \r
+                       }else\r
+                       {\r
+                               ::DrawText(hdc,shortname,shortname.GetLength(),&rt,DT_CENTER);\r
+                       }\r
+\r
+                       \r
+                       ::MoveToEx(hdc,rt.left,rt.top,NULL);\r
+                       ::LineTo(hdc,rt.right,rt.top);\r
+                       ::LineTo(hdc,rt.right,rt.bottom);\r
+                       ::LineTo(hdc,rt.left,rt.bottom);\r
+                       ::LineTo(hdc,rt.left,rt.top);\r
                                \r
                        rt.left=rt.right+3;\r
                }\r
@@ -367,7 +389,16 @@ void CGitLogList::DrawTagBranch(HDC hdc,CRect &rect,INT_PTR index)
                        ::DeleteObject(brush);\r
        }               \r
        rt.right=rect.right;\r
-       ::DrawText(hdc,data->m_Subject,data->m_Subject.GetLength(),&rt,DT_LEFT);\r
+\r
+       if (rItem.state & LVIS_SELECTED)\r
+       {\r
+               COLORREF   clrOld   = ::SetTextColor(hdc,::GetSysColor(COLOR_HIGHLIGHTTEXT));   \r
+               ::DrawText(hdc,data->m_Subject,data->m_Subject.GetLength(),&rt,DT_LEFT);\r
+               ::SetTextColor(hdc,clrOld);   \r
+       }else\r
+       {\r
+               ::DrawText(hdc,data->m_Subject,data->m_Subject.GetLength(),&rt,DT_LEFT);\r
+       }\r
        \r
 }\r
 \r