X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=src%2FTortoiseProc%2FGitLogListBase.cpp;h=0ab5e825b9fc95b3d3c7808006176fb41be98c15;hb=b1906e376dc9aef0c654761014abcc07ea078d90;hp=51ba5d738005bb0a1e01d4bf119e6482c961c939;hpb=a7cc3b4752d7663677abdda43edd658411932a3b;p=tortoisegit%2FTortoiseGitJp.git diff --git a/src/TortoiseProc/GitLogListBase.cpp b/src/TortoiseProc/GitLogListBase.cpp index 51ba5d7..0ab5e82 100644 --- a/src/TortoiseProc/GitLogListBase.cpp +++ b/src/TortoiseProc/GitLogListBase.cpp @@ -58,6 +58,7 @@ CGitLogListBase::CGitLogListBase():CHintListCtrl() , m_pStoreSelection(NULL) , m_nSelectedFilter(LOGFILTER_ALL) , m_bVista(false) + , m_bShowWC(false) { // use the default GUI font, create a copy of it and // change the copy to BOLD (leave the rest of the font @@ -73,7 +74,11 @@ CGitLogListBase::CGitLogListBase():CHintListCtrl() m_IsIDReplaceAction=FALSE; m_wcRev.m_CommitHash=GIT_REV_ZERO; - m_wcRev.m_Subject=_T("Working Copy"); + m_wcRev.m_Subject=_T("Working dir changes"); + m_wcRev.m_ParentHash.clear(); + m_wcRev.m_Mark=_T('-'); + m_wcRev.m_IsUpdateing=FALSE; + m_wcRev.m_IsFull = TRUE; m_hModifiedIcon = (HICON)LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ACTIONMODIFIED), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE); m_hReplacedIcon = (HICON)LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ACTIONREPLACED), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE); @@ -196,7 +201,9 @@ void CGitLogListBase::PreSubclassWindow() { SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES); // load the icons for the action columns - m_Theme.SetWindowTheme(GetSafeHwnd(), L"Explorer", NULL); +// m_Theme.Open(m_hWnd, L"ListView"); + m_Theme.Open(m_hWnd, L"Explorer::ListView;ListView"); + m_Theme.SetWindowTheme(m_hWnd, L"Explorer", NULL); CHintListCtrl::PreSubclassWindow(); } @@ -204,7 +211,7 @@ void CGitLogListBase::InsertGitColumn() { CString temp; - int c = ((CHeaderCtrl*)(GetDlgItem(0)))->GetItemCount()-1; + int c = GetHeaderCtrl()->GetItemCount()-1; while (c>=0) DeleteColumn(c--); @@ -323,6 +330,7 @@ BOOL CGitLogListBase::GetShortName(CString ref, CString &shortname,CString prefi } return FALSE; } + void CGitLogListBase::FillBackGround(HDC hdc, int Index,CRect &rect) { // HBRUSH brush; @@ -334,12 +342,11 @@ void CGitLogListBase::FillBackGround(HDC hdc, int Index,CRect &rect) GetItem(&rItem); GitRev* pLogEntry = (GitRev*)m_arShownList.GetAt(Index); - HBRUSH brush; + HBRUSH brush = NULL; if (m_Theme.IsAppThemed() && m_bVista) { - m_Theme.Open(m_hWnd, L"Explorer"); int state = LISS_NORMAL; if (rItem.state & LVIS_SELECTED) { @@ -355,18 +362,28 @@ void CGitLogListBase::FillBackGround(HDC hdc, int Index,CRect &rect) else if(pLogEntry->m_Action&CTGitPath::LOGACTIONS_REBASE_EDIT) brush = ::CreateSolidBrush(RGB(200,200,128)); - if (brush == NULL) - return; + if(pLogEntry->m_CommitHash == GIT_REV_ZERO) + brush = ::CreateSolidBrush(RGB(200,200,128)); + } + if (brush != NULL) + { ::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); + { + if (m_Theme.IsBackgroundPartiallyTransparent(LVP_LISTITEM, state)) + m_Theme.DrawParentBackground(m_hWnd, hdc, &rect); + + CRect rectDraw = rect; + if(rItem.state & LVIS_SELECTED) + rectDraw.InflateRect(1,0); + else + rectDraw.InflateRect(1,1); + + m_Theme.DrawBackground(hdc, LVP_LISTITEM, state, rectDraw, &rect); + } } else { @@ -387,7 +404,9 @@ void CGitLogListBase::FillBackGround(HDC hdc, int Index,CRect &rect) brush = ::CreateSolidBrush(RGB(156,156,156)); else if(pLogEntry->m_Action&CTGitPath::LOGACTIONS_REBASE_EDIT) brush = ::CreateSolidBrush(RGB(200,200,128)); - else + else if(pLogEntry->m_CommitHash == GIT_REV_ZERO) + brush = ::CreateSolidBrush(RGB(200,200,128)); + else brush = ::CreateSolidBrush(::GetSysColor(COLOR_WINDOW)); } if (brush == NULL) @@ -416,28 +435,38 @@ void CGitLogListBase::DrawTagBranch(HDC hdc,CRect &rect,INT_PTR index) str=m_HashMap[data->m_CommitHash][i]; CString shortname; - HBRUSH brush=0; - shortname=_T(""); + HBRUSH brush = 0; + shortname = _T(""); + COLORREF colRef = 0; + + //Determine label color if(GetShortName(str,shortname,_T("refs/heads/"))) { if( shortname == m_CurrentBranch ) - brush = ::CreateSolidBrush(m_Colors.GetColor(CColors::CurrentBranch)); + colRef = m_Colors.GetColor(CColors::CurrentBranch); else - brush = ::CreateSolidBrush(m_Colors.GetColor(CColors::LocalBranch)); + colRef = m_Colors.GetColor(CColors::LocalBranch); }else if(GetShortName(str,shortname,_T("refs/remotes/"))) { - brush = ::CreateSolidBrush(m_Colors.GetColor(CColors::RemoteBranch)); + colRef = m_Colors.GetColor(CColors::RemoteBranch); } else if(GetShortName(str,shortname,_T("refs/tags/"))) { - brush = ::CreateSolidBrush(m_Colors.GetColor(CColors::Tag)); + colRef = m_Colors.GetColor(CColors::Tag); } else if(GetShortName(str,shortname,_T("refs/stash"))) { - brush = ::CreateSolidBrush(m_Colors.GetColor(CColors::Stash)); + colRef = m_Colors.GetColor(CColors::Stash); shortname=_T("stash"); } + + //When row selected, ajust label color + if (!(m_Theme.IsAppThemed() && m_bVista)) + if (rItem.state & LVIS_SELECTED) + colRef = CColors::MixColors(colRef, ::GetSysColor(COLOR_HIGHLIGHT), 150); + + brush = ::CreateSolidBrush(colRef); if(!shortname.IsEmpty()) @@ -447,42 +476,81 @@ void CGitLogListBase::DrawTagBranch(HDC hdc,CRect &rect,INT_PTR index) GetTextExtentPoint32(hdc, shortname,shortname.GetLength(),&size); rt.SetRect(rt.left,rt.top,rt.left+size.cx,rt.bottom); - rt.right+=4; + rt.right+=8; + + //Fill interior of ref label ::FillRect(hdc, &rt, brush); - if (rItem.state & LVIS_SELECTED) + + //Draw edge of label + CDC W_Dc; + W_Dc.Attach(hdc); + + CRect rectEdge = rt; + + W_Dc.Draw3dRect(rectEdge, m_Colors.Lighten(colRef,100), m_Colors.Darken(colRef,100)); + rectEdge.DeflateRect(1,1); + W_Dc.Draw3dRect(rectEdge, m_Colors.Lighten(colRef,50), m_Colors.Darken(colRef,50)); + + W_Dc.Detach(); + + //Draw text inside label + if (m_Theme.IsAppThemed() && m_bVista) { - COLORREF clrOld = ::SetTextColor(hdc,::GetSysColor(COLOR_HIGHLIGHTTEXT)); - ::DrawText(hdc,shortname,shortname.GetLength(),&rt,DT_CENTER); - ::SetTextColor(hdc,clrOld); - }else + int txtState = LISS_NORMAL; + if (rItem.state & LVIS_SELECTED) + txtState = LISS_SELECTED; + + m_Theme.DrawText(hdc, LVP_LISTITEM, txtState, shortname, -1, DT_CENTER | DT_SINGLELINE | DT_VCENTER, 0, &rt); + } + else { - ::DrawText(hdc,shortname,shortname.GetLength(),&rt,DT_CENTER); + if (rItem.state & LVIS_SELECTED) + { + COLORREF clrNew = ::GetSysColor(COLOR_HIGHLIGHTTEXT); + COLORREF clrOld = ::SetTextColor(hdc,clrNew); + ::DrawText(hdc,shortname,shortname.GetLength(),&rt,DT_CENTER | DT_SINGLELINE | DT_VCENTER); + ::SetTextColor(hdc,clrOld); + }else + { + ::DrawText(hdc,shortname,shortname.GetLength(),&rt,DT_CENTER | DT_SINGLELINE | DT_VCENTER); + } } - ::MoveToEx(hdc,rt.left,rt.top,NULL); - ::LineTo(hdc,rt.right,rt.top); - ::LineTo(hdc,rt.right,rt.bottom); - ::LineTo(hdc,rt.left,rt.bottom); - ::LineTo(hdc,rt.left,rt.top); + //::MoveToEx(hdc,rt.left,rt.top,NULL); + //::LineTo(hdc,rt.right,rt.top); + //::LineTo(hdc,rt.right,rt.bottom); + //::LineTo(hdc,rt.left,rt.bottom); + //::LineTo(hdc,rt.left,rt.top); + - rt.left=rt.right+3; + rt.left=rt.right+1; } if(brush) ::DeleteObject(brush); } rt.right=rect.right; - if (rItem.state & LVIS_SELECTED) + if (m_Theme.IsAppThemed() && m_bVista) { - COLORREF clrOld = ::SetTextColor(hdc,::GetSysColor(COLOR_HIGHLIGHTTEXT)); - ::DrawText(hdc,data->m_Subject,data->m_Subject.GetLength(),&rt,DT_LEFT); - ::SetTextColor(hdc,clrOld); - }else + int txtState = LISS_NORMAL; + if (rItem.state & LVIS_SELECTED) + txtState = LISS_SELECTED; + + m_Theme.DrawText(hdc, LVP_LISTITEM, txtState, data->m_Subject, -1, DT_LEFT | DT_SINGLELINE | DT_VCENTER, 0, &rt); + } + else { - ::DrawText(hdc,data->m_Subject,data->m_Subject.GetLength(),&rt,DT_LEFT); + if (rItem.state & LVIS_SELECTED) + { + COLORREF clrOld = ::SetTextColor(hdc,::GetSysColor(COLOR_HIGHLIGHTTEXT)); + ::DrawText(hdc,data->m_Subject,data->m_Subject.GetLength(),&rt,DT_LEFT | DT_SINGLELINE | DT_VCENTER); + ::SetTextColor(hdc,clrOld); + }else + { + ::DrawText(hdc,data->m_Subject,data->m_Subject.GetLength(),&rt,DT_LEFT | DT_SINGLELINE | DT_VCENTER); + } } - } static COLORREF blend(const COLORREF& col1, const COLORREF& col2, int amount = 128) { @@ -791,7 +859,7 @@ void CGitLogListBase::DrawGraph(HDC hdc,CRect &rect,INT_PTR index) continue; COLORREF color = i == activeLane ? activeColor : m_LineColors[i % Lanes::COLORS_NUM]; - paintGraphLane(hdc, rect.Height(),ln, x1, x2, color,activeColor, rect.top); + paintGraphLane(hdc, rect.Height(),ln, x1+rect.left, x2+rect.left, color,activeColor, rect.top); } #if 0 @@ -815,7 +883,6 @@ void CGitLogListBase::DrawGraph(HDC hdc,CRect &rect,INT_PTR index) } #endif - TRACE(_T("index %d %d\r\n"),index,data->m_Lanes.size()); } void CGitLogListBase::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult) @@ -871,7 +938,9 @@ void CGitLogListBase::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult) pLVCD->clrTextBk = RGB(156,156,156); else if(data->m_Action&CTGitPath::LOGACTIONS_REBASE_EDIT) pLVCD->clrTextBk = RGB(200,200,128); - else + else if(data->m_CommitHash == GIT_REV_ZERO) + pLVCD->clrTextBk = RGB(200,200,128); + else pLVCD->clrTextBk = ::GetSysColor(COLOR_WINDOW); if(data->m_Action&CTGitPath::LOGACTIONS_REBASE_CURRENT) @@ -888,13 +957,15 @@ void CGitLogListBase::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult) // if ((data->childStackDepth)||(m_mergedRevs.find(data->Rev) != m_mergedRevs.end())) // crText = GetSysColor(COLOR_GRAYTEXT); -// if (data->Rev == m_wcRev) -// { -// SelectObject(pLVCD->nmcd.hdc, m_boldFont); +// + if (data->m_CommitHash == GIT_REV_ZERO) + { + //crText = GetSysColor(COLOR_GRAYTEXT); + SelectObject(pLVCD->nmcd.hdc, m_boldFont); // We changed the font, so we're returning CDRF_NEWFONT. This // tells the control to recalculate the extent of the text. -// *pResult = CDRF_NOTIFYSUBITEMDRAW | CDRF_NEWFONT; -// } + *pResult = CDRF_NOTIFYSUBITEMDRAW | CDRF_NEWFONT; + } } } if (m_arShownList.GetCount() == (INT_PTR)pLVCD->nmcd.dwItemSpec) @@ -920,7 +991,14 @@ void CGitLogListBase::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult) { CRect rect; GetSubItemRect(pLVCD->nmcd.dwItemSpec, pLVCD->iSubItem, LVIR_BOUNDS, rect); + if(pLVCD->iSubItem == 0) + { + CRect second; + GetSubItemRect(pLVCD->nmcd.dwItemSpec, pLVCD->iSubItem+1, LVIR_BOUNDS, second); + rect.right=second.left; + } + TRACE(_T("A Graphic left %d right %d\r\n"),rect.left,rect.right); FillBackGround(pLVCD->nmcd.hdc, (INT_PTR)pLVCD->nmcd.dwItemSpec,rect); DrawGraph(pLVCD->nmcd.hdc,rect,pLVCD->nmcd.dwItemSpec); @@ -955,7 +1033,8 @@ void CGitLogListBase::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult) return; } - } + + } } if (pLVCD->iSubItem == 1) @@ -977,6 +1056,7 @@ void CGitLogListBase::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult) GitRev* pLogEntry = reinterpret_cast(m_arShownList.GetAt(pLVCD->nmcd.dwItemSpec)); CRect rect; GetSubItemRect(pLVCD->nmcd.dwItemSpec, pLVCD->iSubItem, LVIR_BOUNDS, rect); + TRACE(_T("Action left %d right %d\r\n"),rect.left,rect.right); // Get the selected state of the // item being drawn. @@ -1199,7 +1279,7 @@ void CGitLogListBase::OnContextMenu(CWnd* pWnd, CPoint point) if (GetSelectedCount() == 1) { { - if (m_hasWC) + //if (m_hasWC) { if(m_ContextMenuMask&GetContextMenuBit(ID_COMPARE)) popup.AppendMenuIcon(ID_COMPARE, IDS_LOG_POPUP_COMPARE, IDI_DIFF); @@ -1330,7 +1410,7 @@ void CGitLogListBase::OnContextMenu(CWnd* pWnd, CPoint point) if(m_ContextMenuMask&GetContextMenuBit(ID_CHERRY_PICK)) popup.AppendMenuIcon(ID_CHERRY_PICK, IDS_CHERRY_PICK_VERSION, IDI_EXPORT); - if(GetSelectedCount()<=2) + if(GetSelectedCount()<=2 || (IsSelectionContinuous() && GetSelectedCount() > 0)) if(m_ContextMenuMask&GetContextMenuBit(ID_CREATE_PATCH)) popup.AppendMenuIcon(ID_CREATE_PATCH, IDS_CREATE_PATCH, IDI_PATCH); @@ -1677,9 +1757,12 @@ int CGitLogListBase::FillGitShortLog() mask = CGit::LOG_INFO_ONLY_HASH | CGit::LOG_INFO_BOUNDARY; // if(this->m_bAllBranch) mask |= m_ShowMask; + + if(m_bShowWC) + this->m_logEntries.insert(m_logEntries.begin(),this->m_wcRev); this->m_logEntries.FetchShortLog(path,m_StartRef,-1,mask); - + //this->m_logEntries.ParserFromLog(); if(IsInWorkingThread()) PostMessage(LVM_SETITEMCOUNT, (WPARAM) this->m_logEntries.size(),(LPARAM) LVSICF_NOINVALIDATEALL); @@ -1690,7 +1773,9 @@ int CGitLogListBase::FillGitShortLog() for(unsigned int i=0;i0 || m_logEntries[i].m_CommitHash != GIT_REV_ZERO) + m_logEntries[i].m_Subject=_T("parser..."); + if(this->m_IsOldFirst) { this->m_arShownList.Add(&m_logEntries[m_logEntries.size()-1-i]); @@ -1898,6 +1983,7 @@ void CGitLogListBase::FetchFullLogInfo(CString &from, CString &to) { CGitCall_FetchFullLogInfo fetcher(this); int mask= + CGit::LOG_INFO_FULL_DIFF| CGit::LOG_INFO_STAT| CGit::LOG_INFO_FILESTATE| CGit::LOG_INFO_DETECT_COPYRENAME| @@ -1983,6 +2069,9 @@ UINT CGitLogListBase::LogThread() int update=0; for(int i=0;im_logEntries[i].ParserFromLog(m_logEntries.m_RawlogData,start); m_logEntries.m_HashMap[m_logEntries[i].m_CommitHash]=i;