OSDN Git Service

Update first commit can't show when launch log dialog
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / GitLogListBase.cpp
index 0ab5e82..f4e2314 100644 (file)
@@ -361,9 +361,6 @@ void CGitLogListBase::FillBackGround(HDC hdc, int Index,CRect &rect)
                                brush = ::CreateSolidBrush(RGB(156,156,156));\r
                        else if(pLogEntry->m_Action&CTGitPath::LOGACTIONS_REBASE_EDIT)\r
                                brush = ::CreateSolidBrush(RGB(200,200,128));\r
-\r
-                       if(pLogEntry->m_CommitHash == GIT_REV_ZERO)\r
-                               brush = ::CreateSolidBrush(RGB(200,200,128));\r
                }\r
 \r
                if (brush != NULL)\r
@@ -404,8 +401,6 @@ void CGitLogListBase::FillBackGround(HDC hdc, int Index,CRect &rect)
                                brush = ::CreateSolidBrush(RGB(156,156,156));\r
                        else if(pLogEntry->m_Action&CTGitPath::LOGACTIONS_REBASE_EDIT)\r
                                brush = ::CreateSolidBrush(RGB(200,200,128));\r
-                       else if(pLogEntry->m_CommitHash == GIT_REV_ZERO)\r
-                               brush = ::CreateSolidBrush(RGB(200,200,128));\r
                        else\r
                                brush = ::CreateSolidBrush(::GetSysColor(COLOR_WINDOW));\r
                }\r
@@ -938,8 +933,6 @@ void CGitLogListBase::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult)
                                                pLVCD->clrTextBk = RGB(156,156,156);\r
                                        else if(data->m_Action&CTGitPath::LOGACTIONS_REBASE_EDIT)\r
                                                pLVCD->clrTextBk  = RGB(200,200,128);\r
-                                       else if(data->m_CommitHash == GIT_REV_ZERO)\r
-                                               pLVCD->clrTextBk  = RGB(200,200,128);\r
                                        else\r
                                                pLVCD->clrTextBk  = ::GetSysColor(COLOR_WINDOW);\r
 \r
@@ -960,8 +953,8 @@ void CGitLogListBase::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult)
 //                                     \r
                                        if (data->m_CommitHash == GIT_REV_ZERO)\r
                                        {\r
-                                               //crText = GetSysColor(COLOR_GRAYTEXT);\r
-                                               SelectObject(pLVCD->nmcd.hdc, m_boldFont);\r
+                                               //crText = GetSysColor(RGB(200,200,0));\r
+                                               //SelectObject(pLVCD->nmcd.hdc, m_boldFont);\r
                                                // We changed the font, so we're returning CDRF_NEWFONT. This\r
                                                // tells the control to recalculate the extent of the text.\r
                                                *pResult = CDRF_NOTIFYSUBITEMDRAW | CDRF_NEWFONT;\r
@@ -1000,7 +993,10 @@ void CGitLogListBase::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult)
                                        \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
+                                       GitRev* data = (GitRev*)m_arShownList.GetAt(pLVCD->nmcd.dwItemSpec);\r
+                                       if( data ->m_CommitHash != GIT_REV_ZERO)\r
+                                               DrawGraph(pLVCD->nmcd.hdc,rect,pLVCD->nmcd.dwItemSpec);\r
 \r
                                        *pResult = CDRF_SKIPDEFAULT;\r
                                        return;\r
@@ -1155,7 +1151,7 @@ void CGitLogListBase::OnLvnGetdispinfoLoglist(NMHDR *pNMHDR, LRESULT *pResult)
                        lstrcpyn(pItem->pszText, (LPCTSTR)pLogEntry->m_AuthorName, pItem->cchTextMax);\r
                break;\r
        case this->LOGLIST_DATE: //Date\r
-               if (pLogEntry)\r
+               if (pLogEntry && pLogEntry->m_CommitHash != GIT_REV_ZERO)\r
                        lstrcpyn(pItem->pszText,\r
                                CAppUtils::FormatDateAndTime( pLogEntry->m_AuthorDate, m_DateFormat, true, m_bRelativeTimes ), \r
                                pItem->cchTextMax);\r
@@ -1278,8 +1274,9 @@ void CGitLogListBase::OnContextMenu(CWnd* pWnd, CPoint point)
 \r
                if (GetSelectedCount() == 1)\r
                {\r
+                       \r
                        {\r
-                               //if (m_hasWC)\r
+                               if(pSelLogEntry->m_CommitHash != GIT_REV_ZERO)\r
                                {\r
                                        if(m_ContextMenuMask&GetContextMenuBit(ID_COMPARE))\r
                                                popup.AppendMenuIcon(ID_COMPARE, IDS_LOG_POPUP_COMPARE, IDI_DIFF);\r
@@ -1290,6 +1287,10 @@ void CGitLogListBase::OnContextMenu(CWnd* pWnd, CPoint point)
                                        // But until that's implemented, the context menu entry for\r
                                        // this feature is commented out.\r
                                        //popup.AppendMenu(ID_BLAMECOMPARE, IDS_LOG_POPUP_BLAMECOMPARE, IDI_BLAME);\r
+                               }else\r
+                               {\r
+                                       if(m_ContextMenuMask&GetContextMenuBit(ID_COMMIT))\r
+                                               popup.AppendMenuIcon(ID_COMMIT, IDS_LOG_POPUP_COMMIT, IDI_COMMIT);\r
                                }\r
                                if(m_ContextMenuMask&GetContextMenuBit(ID_GNUDIFF1))\r
                                        popup.AppendMenuIcon(ID_GNUDIFF1, IDS_LOG_POPUP_GNUDIFF_CH, IDI_DIFF);\r
@@ -1325,30 +1326,33 @@ void CGitLogListBase::OnContextMenu(CWnd* pWnd, CPoint point)
                        format.LoadString(IDS_RESET_TO_THIS_FORMAT);\r
                        str.Format(format,g_Git.GetCurrentBranch());\r
 \r
-                       if(m_ContextMenuMask&GetContextMenuBit(ID_RESET))\r
-                               popup.AppendMenuIcon(ID_RESET,str,IDI_REVERT);\r
+                       if(pSelLogEntry->m_CommitHash != GIT_REV_ZERO)\r
+                       {\r
+                               if(m_ContextMenuMask&GetContextMenuBit(ID_RESET))\r
+                                       popup.AppendMenuIcon(ID_RESET,str,IDI_REVERT);\r
 \r
-                       if(m_ContextMenuMask&GetContextMenuBit(ID_SWITCHTOREV))\r
-                               popup.AppendMenuIcon(ID_SWITCHTOREV, IDS_SWITCH_TO_THIS , IDI_SWITCH);\r
+                               if(m_ContextMenuMask&GetContextMenuBit(ID_SWITCHTOREV))\r
+                                       popup.AppendMenuIcon(ID_SWITCHTOREV, IDS_SWITCH_TO_THIS , IDI_SWITCH);\r
 \r
-                       if(m_ContextMenuMask&GetContextMenuBit(ID_CREATE_BRANCH))\r
-                               popup.AppendMenuIcon(ID_CREATE_BRANCH, IDS_CREATE_BRANCH_AT_THIS , IDI_COPY);\r
+                               if(m_ContextMenuMask&GetContextMenuBit(ID_CREATE_BRANCH))\r
+                                       popup.AppendMenuIcon(ID_CREATE_BRANCH, IDS_CREATE_BRANCH_AT_THIS , IDI_COPY);\r
 \r
-                       if(m_ContextMenuMask&GetContextMenuBit(ID_CREATE_TAG))\r
-                               popup.AppendMenuIcon(ID_CREATE_TAG,IDS_CREATE_TAG_AT_THIS , IDI_COPY);\r
+                               if(m_ContextMenuMask&GetContextMenuBit(ID_CREATE_TAG))\r
+                                       popup.AppendMenuIcon(ID_CREATE_TAG,IDS_CREATE_TAG_AT_THIS , IDI_COPY);\r
                        \r
-                       format.LoadString(IDS_REBASE_THIS_FORMAT);\r
-                       str.Format(format,g_Git.GetCurrentBranch());\r
+                               format.LoadString(IDS_REBASE_THIS_FORMAT);\r
+                               str.Format(format,g_Git.GetCurrentBranch());\r
 \r
-                       if(pSelLogEntry->m_CommitHash != m_HeadHash)\r
-                               if(m_ContextMenuMask&GetContextMenuBit(ID_REBASE_TO_VERSION))\r
-                                       popup.AppendMenuIcon(ID_REBASE_TO_VERSION, str , IDI_REBASE);                   \r
+                               if(pSelLogEntry->m_CommitHash != m_HeadHash)\r
+                                       if(m_ContextMenuMask&GetContextMenuBit(ID_REBASE_TO_VERSION))\r
+                                               popup.AppendMenuIcon(ID_REBASE_TO_VERSION, str , IDI_REBASE);                   \r
 \r
-                       if(m_ContextMenuMask&GetContextMenuBit(ID_EXPORT))\r
-                               popup.AppendMenuIcon(ID_EXPORT,IDS_EXPORT_TO_THIS, IDI_EXPORT); \r
+                               if(m_ContextMenuMask&GetContextMenuBit(ID_EXPORT))\r
+                                       popup.AppendMenuIcon(ID_EXPORT,IDS_EXPORT_TO_THIS, IDI_EXPORT); \r
                        \r
 \r
-                       popup.AppendMenu(MF_SEPARATOR, NULL);\r
+                               popup.AppendMenu(MF_SEPARATOR, NULL);\r
+                       }\r
 \r
                }\r
 \r
@@ -1387,7 +1391,7 @@ void CGitLogListBase::OnContextMenu(CWnd* pWnd, CPoint point)
                                popup.AppendMenu(MF_SEPARATOR, NULL);\r
                }\r
 \r
-               if ( GetSelectedCount() >0 )\r
+               if ( GetSelectedCount() >0 && pSelLogEntry->m_CommitHash != GIT_REV_ZERO)\r
                {\r
                        if ( IsSelectionContinuous() && GetSelectedCount() >= 2 )\r
                        {\r
@@ -1761,13 +1765,17 @@ int CGitLogListBase::FillGitShortLog()
        if(m_bShowWC)\r
                this->m_logEntries.insert(m_logEntries.begin(),this->m_wcRev);\r
 \r
-       this->m_logEntries.FetchShortLog(path,m_StartRef,-1,mask);\r
+       this->m_logEntries.FetchShortLog(path,m_StartRef,-1,mask,m_bShowWC?1:0);\r
 \r
        //this->m_logEntries.ParserFromLog();\r
        if(IsInWorkingThread())\r
+       {\r
                PostMessage(LVM_SETITEMCOUNT, (WPARAM) this->m_logEntries.size(),(LPARAM) LVSICF_NOINVALIDATEALL);\r
+       }\r
        else\r
+       {\r
                SetItemCountEx(this->m_logEntries.size());\r
+       }\r
 \r
        this->m_arShownList.RemoveAll();\r
 \r
@@ -2070,7 +2078,19 @@ UINT CGitLogListBase::LogThread()
        for(int i=0;i<m_logEntries.size();i++)\r
        {\r
                if( i==0 && m_logEntries[i].m_CommitHash == GIT_REV_ZERO)\r
+               {\r
+                       m_logEntries[i].m_Files.Clear();\r
+                       m_logEntries[i].m_ParentHash.clear();\r
+                       m_logEntries[i].m_ParentHash.push_back(m_HeadHash);\r
+                       g_Git.GetCommitDiffList(m_logEntries[i].m_CommitHash,this->m_HeadHash,m_logEntries[i].m_Files);\r
+                       m_logEntries[i].m_Action =0;\r
+                       for(int j=0;j< m_logEntries[i].m_Files.GetCount();j++)\r
+                               m_logEntries[i].m_Action |= m_logEntries[i].m_Files[j].m_Action;\r
+                       \r
+                       m_logEntries[i].m_Body.Format(_T("%d files changed"),m_logEntries[i].m_Files.GetCount());\r
+                       ::PostMessage(m_hWnd,MSG_LOADED,(WPARAM)0,0);\r
                        continue;\r
+               }\r
 \r
                start=this->m_logEntries[i].ParserFromLog(m_logEntries.m_RawlogData,start);\r
                m_logEntries.m_HashMap[m_logEntries[i].m_CommitHash]=i;\r
@@ -2087,6 +2107,8 @@ UINT CGitLogListBase::LogThread()
                        InterlockedExchange(&m_logEntries[i].m_IsFull,TRUE);\r
                        update++;\r
                }\r
+               ::PostMessage(m_hWnd,MSG_LOADED,(WPARAM) i, 0);\r
+\r
                if(start<0)\r
                        break;\r
                if(start>=m_logEntries.m_RawlogData.size())\r
@@ -2095,7 +2117,6 @@ UINT CGitLogListBase::LogThread()
                int percent=i*30/m_logEntries.size() + GITLOG_START+1;\r
 \r
                ::PostMessage(GetParent()->m_hWnd,MSG_LOAD_PERCENTAGE,(WPARAM) percent, 0);\r
-               ::PostMessage(m_hWnd,MSG_LOADED,(WPARAM) i, 0);\r
 \r
                if(this->m_bExitThread)\r
                {       \r
@@ -2158,7 +2179,8 @@ void CGitLogListBase::Refresh()
                if(ret == WAIT_TIMEOUT)\r
                        TerminateThread();\r
        }\r
-\r
+       \r
+       this->SetItemCountEx(0);\r
        this->Clear();\r
 \r
        //Update branch and Tag info\r
@@ -2166,7 +2188,7 @@ void CGitLogListBase::Refresh()
        //Assume Thread have exited\r
        //if(!m_bThreadRunning)\r
        {\r
-               this->SetItemCountEx(0);\r
+               \r
                m_logEntries.clear();\r
                m_bExitThread=FALSE;\r
                InterlockedExchange(&m_bThreadRunning, TRUE);\r
@@ -2484,6 +2506,11 @@ LRESULT CGitLogListBase::OnLoad(WPARAM wParam,LPARAM lParam)
        int i=(int)wParam;\r
        this->GetItemRect(i,&rect,LVIR_BOUNDS);\r
        this->InvalidateRect(rect);\r
+\r
+       if(this->GetItemState(i,LVIF_STATE) & LVIS_SELECTED)\r
+       {\r
+               int i=0;\r
+       }\r
        return 0;\r
 }\r
 \r