OSDN Git Service

Sync Dialog Scroll the correct line number
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / GitLogListBase.cpp
index 1760744..af05f00 100644 (file)
@@ -206,7 +206,7 @@ void CGitLogListBase::InsertGitColumn()
 {\r
        CString temp;\r
 \r
-       int c = ((CHeaderCtrl*)(GetDlgItem(0)))->GetItemCount()-1;\r
+       int c = GetHeaderCtrl()->GetItemCount()-1;\r
        \r
        while (c>=0)\r
                DeleteColumn(c--);\r
@@ -425,28 +425,38 @@ void CGitLogListBase::DrawTagBranch(HDC hdc,CRect &rect,INT_PTR index)
                str=m_HashMap[data->m_CommitHash][i];\r
                \r
                CString shortname;\r
-               HBRUSH brush=0;\r
-               shortname=_T("");\r
+               HBRUSH brush = 0;\r
+               shortname = _T("");\r
+               COLORREF colRef = 0;\r
+\r
+               //Determine label color\r
                if(GetShortName(str,shortname,_T("refs/heads/")))\r
                {\r
                        if( shortname == m_CurrentBranch )\r
-                               brush = ::CreateSolidBrush(m_Colors.GetColor(CColors::CurrentBranch));\r
+                               colRef = m_Colors.GetColor(CColors::CurrentBranch);\r
                        else\r
-                               brush = ::CreateSolidBrush(m_Colors.GetColor(CColors::LocalBranch));\r
+                               colRef = m_Colors.GetColor(CColors::LocalBranch);\r
 \r
                }else if(GetShortName(str,shortname,_T("refs/remotes/")))\r
                {\r
-                       brush = ::CreateSolidBrush(m_Colors.GetColor(CColors::RemoteBranch));\r
+                       colRef = m_Colors.GetColor(CColors::RemoteBranch);\r
                }\r
                else if(GetShortName(str,shortname,_T("refs/tags/")))\r
                {\r
-                       brush = ::CreateSolidBrush(m_Colors.GetColor(CColors::Tag));\r
+                       colRef = m_Colors.GetColor(CColors::Tag);\r
                }\r
                else if(GetShortName(str,shortname,_T("refs/stash")))\r
                {\r
-                       brush = ::CreateSolidBrush(m_Colors.GetColor(CColors::Stash));\r
+                       colRef = m_Colors.GetColor(CColors::Stash);\r
                        shortname=_T("stash");\r
                }\r
+\r
+               //When row selected, ajust label color\r
+               if (!(m_Theme.IsAppThemed() && m_bVista))\r
+                       if (rItem.state & LVIS_SELECTED)\r
+                               colRef = CColors::MixColors(colRef, ::GetSysColor(COLOR_HIGHLIGHT), 150);\r
+\r
+               brush = ::CreateSolidBrush(colRef);\r
                \r
 \r
                if(!shortname.IsEmpty())\r
@@ -456,8 +466,24 @@ void CGitLogListBase::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
-                       rt.right+=4;\r
+                       rt.right+=8;\r
+\r
+                       //Fill interior of ref label\r
                        ::FillRect(hdc, &rt, brush);\r
+\r
+                       //Draw edge of label\r
+                       CDC W_Dc;\r
+                       W_Dc.Attach(hdc);\r
+\r
+                       CRect rectEdge = rt;\r
+\r
+                       W_Dc.Draw3dRect(rectEdge, m_Colors.Lighten(colRef,100), m_Colors.Darken(colRef,100));\r
+                       rectEdge.DeflateRect(1,1);\r
+                       W_Dc.Draw3dRect(rectEdge, m_Colors.Lighten(colRef,50), m_Colors.Darken(colRef,50));\r
+\r
+                       W_Dc.Detach();\r
+\r
+                       //Draw text inside label\r
                        if (m_Theme.IsAppThemed() && m_bVista)\r
                        {\r
                                int txtState = LISS_NORMAL;\r
@@ -481,13 +507,14 @@ void CGitLogListBase::DrawTagBranch(HDC hdc,CRect &rect,INT_PTR index)
                        }\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
+                       //::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
                                \r
-                       rt.left=rt.right+3;\r
+                       rt.left=rt.right+1;\r
                }\r
                if(brush)\r
                        ::DeleteObject(brush);\r
@@ -822,7 +849,7 @@ void CGitLogListBase::DrawGraph(HDC hdc,CRect &rect,INT_PTR index)
                        continue;\r
 \r
                COLORREF color = i == activeLane ? activeColor : m_LineColors[i % Lanes::COLORS_NUM];\r
-               paintGraphLane(hdc, rect.Height(),ln, x1, x2, color,activeColor, rect.top);\r
+               paintGraphLane(hdc, rect.Height(),ln, x1+rect.left, x2+rect.left, color,activeColor, rect.top);\r
        }\r
 \r
 #if 0\r
@@ -846,7 +873,6 @@ void CGitLogListBase::DrawGraph(HDC hdc,CRect &rect,INT_PTR index)
        }\r
 #endif\r
 \r
-       TRACE(_T("index %d %d\r\n"),index,data->m_Lanes.size());\r
 }\r
 \r
 void CGitLogListBase::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult)\r
@@ -951,7 +977,14 @@ void CGitLogListBase::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult)
                                {\r
                                        CRect rect;\r
                                        GetSubItemRect(pLVCD->nmcd.dwItemSpec, pLVCD->iSubItem, LVIR_BOUNDS, rect);\r
+                                       if(pLVCD->iSubItem == 0)\r
+                                       {\r
+                                               CRect second;\r
+                                               GetSubItemRect(pLVCD->nmcd.dwItemSpec, pLVCD->iSubItem+1, LVIR_BOUNDS, second);\r
+                                               rect.right=second.left;\r
+                                       }\r
                                        \r
+                                       TRACE(_T("A Graphic left %d right %d\r\n"),rect.left,rect.right);\r
                                        FillBackGround(pLVCD->nmcd.hdc, (INT_PTR)pLVCD->nmcd.dwItemSpec,rect);\r
                                        DrawGraph(pLVCD->nmcd.hdc,rect,pLVCD->nmcd.dwItemSpec);\r
 \r
@@ -1008,6 +1041,7 @@ void CGitLogListBase::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult)
                                GitRev* pLogEntry = reinterpret_cast<GitRev *>(m_arShownList.GetAt(pLVCD->nmcd.dwItemSpec));\r
                                CRect rect;\r
                                GetSubItemRect(pLVCD->nmcd.dwItemSpec, pLVCD->iSubItem, LVIR_BOUNDS, rect);\r
+                               TRACE(_T("Action left %d right %d\r\n"),rect.left,rect.right);\r
                                // Get the selected state of the\r
                                // item being drawn.                                                    \r
 \r
@@ -1230,7 +1264,7 @@ void CGitLogListBase::OnContextMenu(CWnd* pWnd, CPoint point)
                if (GetSelectedCount() == 1)\r
                {\r
                        {\r
-                               if (m_hasWC)\r
+                               //if (m_hasWC)\r
                                {\r
                                        if(m_ContextMenuMask&GetContextMenuBit(ID_COMPARE))\r
                                                popup.AppendMenuIcon(ID_COMPARE, IDS_LOG_POPUP_COMPARE, IDI_DIFF);\r
@@ -1361,7 +1395,7 @@ void CGitLogListBase::OnContextMenu(CWnd* pWnd, CPoint point)
                        if(m_ContextMenuMask&GetContextMenuBit(ID_CHERRY_PICK))\r
                                popup.AppendMenuIcon(ID_CHERRY_PICK, IDS_CHERRY_PICK_VERSION, IDI_EXPORT);\r
 \r
-                       if(GetSelectedCount()<=2)\r
+                       if(GetSelectedCount()<=2 || (IsSelectionContinuous() && GetSelectedCount() > 0))\r
                                if(m_ContextMenuMask&GetContextMenuBit(ID_CREATE_PATCH))\r
                                        popup.AppendMenuIcon(ID_CREATE_PATCH, IDS_CREATE_PATCH, IDI_PATCH);\r
                        \r