From d2eb5555d40eaa417c22a976492402f47455a74a Mon Sep 17 00:00:00 2001 From: Frank Li Date: Sat, 22 Nov 2008 13:34:43 +0800 Subject: [PATCH] Log Dld Message and File List Work --- Git/Git.cpp | 2 +- Git/GitRev.cpp | 59 ++++++- Git/GitRev.h | 3 +- Git/TGitPath.cpp | 43 +++++ Git/TGitPath.h | 16 +- Resources/TortoiseProcENG.rc | Bin 365226 -> 365580 bytes TortoiseProc/ILogReceiver.h | 8 +- TortoiseProc/LogDlg.cpp | 207 +++++++++++------------ TortoiseProc/LogDlg.h | 20 ++- TortoiseProc/TortoiseProc.vcproj.FSL.B20596.user | 2 +- TortoiseProc/resource.h | Bin 140406 -> 140774 bytes TortoiseShell/TortoiseShell.suo | Bin 187392 -> 187392 bytes 12 files changed, 233 insertions(+), 127 deletions(-) diff --git a/Git/Git.cpp b/Git/Git.cpp index 20ed425..765a8a4 100644 --- a/Git/Git.cpp +++ b/Git/Git.cpp @@ -100,7 +100,7 @@ int CGit::GetLog(CString& logOut) CString cmd; CString log; - cmd=("git.cmd log -C --numstat --pretty=format:\""); + cmd=("git.cmd log -C --numstat --raw --pretty=format:\""); log.Format(_T("#<%c>%%n"),LOG_REV_ITEM_BEGIN); cmd += log; log.Format(_T("#<%c>%%an%%n"),LOG_REV_AUTHOR_NAME); diff --git a/Git/GitRev.cpp b/Git/GitRev.cpp index edcd0ae..70e9a8d 100644 --- a/Git/GitRev.cpp +++ b/Git/GitRev.cpp @@ -4,6 +4,7 @@ GitRev::GitRev(void) { + m_Action=0; } GitRev::~GitRev(void) @@ -28,6 +29,7 @@ int GitRev::ParserFromLog(CString &log) TCHAR mode; CTGitPath path; this->m_Files.Clear(); + m_Action=0; while( pos>=0 ) { @@ -60,7 +62,7 @@ int GitRev::ParserFromLog(CString &log) this->m_Subject = text; break; case LOG_REV_COMMIT_BODY: - this->m_Body = text; + this->m_Body = text +_T("\n"); break; case LOG_REV_COMMIT_HASH: this->m_CommitHash = text; @@ -76,25 +78,66 @@ int GitRev::ParserFromLog(CString &log) switch(mode) { case LOG_REV_COMMIT_BODY: - this->m_Subject += one; + this->m_Body += one+_T("\n"); break; case LOG_REV_COMMIT_FILE: if(one[0]==_T(':')) { + int tabstart=0; + int actionstart=0; + CString pathname; + CString action; + one.Tokenize(_T("\t"),tabstart); + if(tabstart >0) + { + action=one.Left(tabstart); + actionstart=action.ReverseFind(_T(' ')); + if(actionstart>0) + { + action=action.Right(action.GetLength()-actionstart); + } + pathname=one.Right(one.GetLength()-tabstart); + + CTGitPath *GitPath=m_Files.LookForGitPath(pathname); + + if(GitPath) + { + this->m_Action|=GitPath->ParserAction(action); + + }else + { + path.SetFromGit(pathname); + //action must be set after setfromgit. SetFromGit will clear all status. + this->m_Action|=path.ParserAction(action); + this->m_Files.AddPath(path); + } + } }else { int tabstart=0; - - path.m_StatAdd=_wtoi(one.Tokenize(_T("\t"),tabstart)); + path.Reset(); + CString StatAdd=(one.Tokenize(_T("\t"),tabstart)); if( tabstart< 0) break; -// tabstart+=1; - path.m_StatDel=_wtoi(one.Tokenize(_T("\t"),tabstart)); -// tabstart++; + CString StatDel=(one.Tokenize(_T("\t"),tabstart)); + + //SetFromGit will reset all context of GitRev path.SetFromGit(one.Right(one.GetLength()-tabstart)); - this->m_Files.AddPath(path); + CTGitPath *GitPath=m_Files.LookForGitPath(path.GetGitPathString()); + if(GitPath) + { + GitPath->m_StatAdd=StatAdd; + GitPath->m_StatDel=StatDel; + + }else + { + //path.SetFromGit(pathname); + path.m_StatAdd=StatAdd; + path.m_StatDel=StatDel; + this->m_Files.AddPath(path); + } } break; } diff --git a/Git/GitRev.h b/Git/GitRev.h index 6bd54c8..53b95c3 100644 --- a/Git/GitRev.h +++ b/Git/GitRev.h @@ -19,6 +19,7 @@ typedef std::vector GIT_REV_LIST; #define LOG_REV_ITEM_END _T('C') + class GitRev { public: @@ -45,7 +46,7 @@ public: git_revnum_t m_CommitHash; GIT_REV_LIST m_ParentHash; CTGitPathList m_Files; - + int m_Action; int ParserFromLog(CString &log); CTime ConverFromString(CString input); }; diff --git a/Git/TGitPath.cpp b/Git/TGitPath.cpp index fa469f2..185c581 100644 --- a/Git/TGitPath.cpp +++ b/Git/TGitPath.cpp @@ -50,6 +50,7 @@ CTGitPath::CTGitPath(void) : m_bIsSpecialDirectoryKnown(false), m_bIsSpecialDirectory(false) { + m_Action=0; } CTGitPath::~CTGitPath(void) @@ -76,8 +77,24 @@ CTGitPath::CTGitPath(const CString& sUnknownPath) : m_bIsSpecialDirectory(false) { SetFromUnknown(sUnknownPath); + m_Action=0; } +int CTGitPath::ParserAction(CString action) +{ + action=action.TrimLeft(); + TCHAR c=action.GetAt(0); + if(c == _T('M')) + m_Action|= LOGACTIONS_MODIFIED; + if(c == _T('R')) + m_Action|= LOGACTIONS_REPLACED; + if(c == _T('A')) + m_Action|= LOGACTIONS_ADDED; + if(c == _T('D')) + m_Action|= LOGACTIONS_DELETED; + + return m_Action; +} void CTGitPath::SetFromGit(const char* pPath) { Reset(); @@ -411,6 +428,9 @@ void CTGitPath::Reset() m_sBackslashPath.Empty(); m_sFwdslashPath.Empty(); m_sUTF8FwdslashPath.Empty(); + this->m_Action=0; + this->m_StatAdd=_T(""); + this->m_StatDel=_T(""); ATLASSERT(IsEmpty()); } @@ -1544,3 +1564,26 @@ private: #endif #endif +CTGitPath * CTGitPathList::LookForGitPath(CString path) +{ + int i=0; + for(i=0;iGetCount();i++) + { + if((*this)[i].GetGitPathString() == path ) + return (CTGitPath*)&(*this)[i]; + } + return NULL; +} + +CString CTGitPath::GetActionName() +{ + if(m_Action & CTGitPath::LOGACTIONS_ADDED) + return _T("Added"); + if(m_Action & CTGitPath::LOGACTIONS_DELETED) + return _T("Deleted"); + if(m_Action & CTGitPath::LOGACTIONS_MODIFIED) + return _T("Modified"); + if(m_Action & CTGitPath::LOGACTIONS_REPLACED) + return _T("Rename"); + return _T("Unknown"); +} \ No newline at end of file diff --git a/Git/TGitPath.h b/Git/TGitPath.h index ba8014c..c9cad65 100644 --- a/Git/TGitPath.h +++ b/Git/TGitPath.h @@ -1,5 +1,6 @@ #pragma once + class CTGitPath { public: @@ -7,9 +8,19 @@ public: ~CTGitPath(void); CTGitPath(const CString& sUnknownPath); public: - int m_StatAdd; - int m_StatDel; + enum + { + LOGACTIONS_ADDED = 0x00000001, + LOGACTIONS_MODIFIED = 0x00000002, + LOGACTIONS_REPLACED = 0x00000004, + LOGACTIONS_DELETED = 0x00000008 + }; + CString m_StatAdd; + CString m_StatDel; + int m_Action; + int ParserAction(CString action); + CString GetActionName(); /** * Set the path as an UTF8 string with forward slashes */ @@ -276,6 +287,7 @@ public: void AddPath(const CTGitPath& newPath); bool LoadFromFile(const CTGitPath& filename); bool WriteToFile(const CString& sFilename, bool bANSI = false) const; + CTGitPath * LookForGitPath(CString path); /** * Load from the path argument string, when the 'path' parameter is used diff --git a/Resources/TortoiseProcENG.rc b/Resources/TortoiseProcENG.rc index 3bb03571d877a09835344bfd6ece181d1a28cb31..cf3749d0ee29ba118cc83ff89c747ccad5fce2b8 100644 GIT binary patch delta 223 zcmZ3rRIF!(SVIeA3)2?nS68QRaAD@)bY}=+aAXKz@RS z*LID0+clO&3#R9!ut-ervtj1ok7w{<@MQ2~a0TjdVQ`sV|DHu1Yz|mj8X@fhRN}*+ z0EJ3Gr4wCPr4dSH5lZ7BX2F#vGNeowv}INV8!3;h4%tv8h7^WWhMegWeVIeIe<)+! GB@F;tAU8?? delta 60 zcmV-C0K@-`s1~ZF7J!5SgaWh!>eZH=0|=Lp)&mZg5YYn!hfdZ5w@%gso}ibQO#@Ds S;A8^?myUh|2De;z1+W|Tbr<~r diff --git a/TortoiseProc/ILogReceiver.h b/TortoiseProc/ILogReceiver.h index 362a0de..2931789 100644 --- a/TortoiseProc/ILogReceiver.h +++ b/TortoiseProc/ILogReceiver.h @@ -52,13 +52,7 @@ private: mutable CString actionAsString; }; -enum -{ - LOGACTIONS_ADDED = 0x00000001, - LOGACTIONS_MODIFIED = 0x00000002, - LOGACTIONS_REPLACED = 0x00000004, - LOGACTIONS_DELETED = 0x00000008 -}; + /// auto-deleting extension of MFC Arrays for pointer arrays diff --git a/TortoiseProc/LogDlg.cpp b/TortoiseProc/LogDlg.cpp index 7906359..b5678c3 100644 --- a/TortoiseProc/LogDlg.cpp +++ b/TortoiseProc/LogDlg.cpp @@ -302,35 +302,45 @@ BOOL CLogDlg::OnInitDialog() // set up the columns m_LogList.DeleteAllItems(); int c = ((CHeaderCtrl*)(m_LogList.GetDlgItem(0)))->GetItemCount()-1; + while (c>=0) m_LogList.DeleteColumn(c--); - temp.LoadString(IDS_LOG_REVISION); - m_LogList.InsertColumn(0, temp); + temp.LoadString(IDS_LOG_GRAPH); + + m_LogList.InsertColumn(this->LOGLIST_GRAPH, temp); +#if 0 // make the revision column right aligned LVCOLUMN Column; Column.mask = LVCF_FMT; Column.fmt = LVCFMT_RIGHT; m_LogList.SetColumn(0, &Column); - +#endif // CString log; // g_Git.GetLog(log); temp.LoadString(IDS_LOG_ACTIONS); - m_LogList.InsertColumn(1, temp); + m_LogList.InsertColumn(this->LOGLIST_ACTION, temp); + + temp.LoadString(IDS_LOG_MESSAGE); + m_LogList.InsertColumn(this->LOGLIST_MESSAGE, temp); + temp.LoadString(IDS_LOG_AUTHOR); - m_LogList.InsertColumn(2, temp); + m_LogList.InsertColumn(this->LOGLIST_AUTHOR, temp); + temp.LoadString(IDS_LOG_DATE); - m_LogList.InsertColumn(3, temp); + m_LogList.InsertColumn(this->LOGLIST_DATE, temp); + + if (m_bShowBugtraqColumn) { temp = m_ProjectProperties.sLabel; if (temp.IsEmpty()) temp.LoadString(IDS_LOG_BUGIDS); - m_LogList.InsertColumn(4, temp); + m_LogList.InsertColumn(this->LOGLIST_BUG, temp); + } - temp.LoadString(IDS_LOG_MESSAGE); - m_LogList.InsertColumn(m_bShowBugtraqColumn ? 5 : 4, temp); + m_LogList.SetRedraw(false); ResizeAllListCtrlCols(); m_LogList.SetRedraw(true); @@ -341,13 +351,14 @@ BOOL CLogDlg::OnInitDialog() while (c>=0) m_ChangedFileListCtrl.DeleteColumn(c--); temp.LoadString(IDS_PROGRS_ACTION); - m_ChangedFileListCtrl.InsertColumn(0, temp); + m_ChangedFileListCtrl.InsertColumn(this->FILELIST_ACTION, temp); + temp.LoadString(IDS_LOG_FILE_LINE_ADD); + m_ChangedFileListCtrl.InsertColumn(this->FILELIST_ADD, temp); + temp.LoadString(IDS_LOG_FILE_LINE_DEL); + m_ChangedFileListCtrl.InsertColumn(this->FILELIST_DEL, temp); temp.LoadString(IDS_PROGRS_PATH); - m_ChangedFileListCtrl.InsertColumn(1, temp); - temp.LoadString(IDS_LOG_COPYFROM); - m_ChangedFileListCtrl.InsertColumn(2, temp); - temp.LoadString(IDS_LOG_REVISION); - m_ChangedFileListCtrl.InsertColumn(3, temp); + m_ChangedFileListCtrl.InsertColumn(this->FILELIST_PATH, temp); + m_ChangedFileListCtrl.SetRedraw(false); CAppUtils::ResizeAllListCtrlCols(&m_ChangedFileListCtrl); m_ChangedFileListCtrl.SetRedraw(true); @@ -552,7 +563,7 @@ void CLogDlg::FillLogMessageCtrl(bool bShow /* = true*/) // we fill here the log message rich edit control, // and also populate the changed files list control // according to the selected revision(s). -#if 0 + CWnd * pMsgView = GetDlgItem(IDC_MSGVIEW); // empty the log message view pMsgView->SetWindowText(_T(" ")); @@ -599,21 +610,22 @@ void CLogDlg::FillLogMessageCtrl(bool bShow /* = true*/) m_ChangedFileListCtrl.SetRedraw(TRUE); return; } - PLOGENTRYDATA pLogEntry = reinterpret_cast(m_arShownList.GetAt(selIndex)); + GitRev* pLogEntry = reinterpret_cast(m_arShownList.GetAt(selIndex)); // set the log message text - pMsgView->SetWindowText(pLogEntry->sMessage); + pMsgView->SetWindowText(_T("*")+pLogEntry->m_Subject+_T("\n\n")+pLogEntry->m_Body); // turn bug ID's into links if the bugtraq: properties have been set // and we can find a match of those in the log message - m_ProjectProperties.FindBugID(pLogEntry->sMessage, pMsgView); + m_ProjectProperties.FindBugID(pLogEntry->m_Body, pMsgView); CAppUtils::FormatTextInRichEditControl(pMsgView); - m_currentChangedArray = pLogEntry->pArChangedPaths; + m_currentChangedArray = &(pLogEntry->m_Files); if (m_currentChangedArray == NULL) { InterlockedExchange(&m_bNoDispUpdates, FALSE); m_ChangedFileListCtrl.SetRedraw(TRUE); return; } +#if 0 // fill in the changed files list control if ((m_cHidePaths.GetState() & 0x0003)==BST_CHECKED) { @@ -630,6 +642,7 @@ void CLogDlg::FillLogMessageCtrl(bool bShow /* = true*/) } m_currentChangedArray = &m_CurrentFilteredChangedArray; } +#endif } else { @@ -664,7 +677,7 @@ void CLogDlg::FillLogMessageCtrl(bool bShow /* = true*/) else SetSortArrow(&m_ChangedFileListCtrl, -1, false); m_ChangedFileListCtrl.SetRedraw(TRUE); -#endif + } void CLogDlg::OnBnClickedGetall() @@ -1232,9 +1245,11 @@ UINT CLogDlg::LogThread() this->m_logEntries.ClearAll(); this->m_logEntries.ParserFromLog(); m_LogList.SetItemCountEx(this->m_logEntries.size()); - - this->m_arShownList.Add(&g_rev); - g_rev.m_AuthorName.Append(_T("Frank Li")); + + this->m_arShownList.RemoveAll(); + + for(int i=0;im_arShownList.Add(&m_logEntries[i]); #if 0 if (!m_bShowedAll) @@ -2567,24 +2582,23 @@ void CLogDlg::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult) ::FillRect(pLVCD->nmcd.hdc, &rect, brush); ::DeleteObject(brush); } -#if 0 + // Draw the icon(s) into the compatible DC - if (pLogEntry->actions & LOGACTIONS_MODIFIED) + if (pLogEntry->m_Action & CTGitPath::LOGACTIONS_MODIFIED) ::DrawIconEx(pLVCD->nmcd.hdc, rect.left + ICONITEMBORDER, rect.top, m_hModifiedIcon, iconwidth, iconheight, 0, NULL, DI_NORMAL); nIcons++; - if (pLogEntry->actions & LOGACTIONS_ADDED) + if (pLogEntry->m_Action & CTGitPath::LOGACTIONS_ADDED) ::DrawIconEx(pLVCD->nmcd.hdc, rect.left+nIcons*iconwidth + ICONITEMBORDER, rect.top, m_hAddedIcon, iconwidth, iconheight, 0, NULL, DI_NORMAL); nIcons++; - if (pLogEntry->actions & LOGACTIONS_DELETED) + if (pLogEntry->m_Action & CTGitPath::LOGACTIONS_DELETED) ::DrawIconEx(pLVCD->nmcd.hdc, rect.left+nIcons*iconwidth + ICONITEMBORDER, rect.top, m_hDeletedIcon, iconwidth, iconheight, 0, NULL, DI_NORMAL); nIcons++; - if (pLogEntry->actions & LOGACTIONS_REPLACED) + if (pLogEntry->m_Action & CTGitPath::LOGACTIONS_REPLACED) ::DrawIconEx(pLVCD->nmcd.hdc, rect.left+nIcons*iconwidth + ICONITEMBORDER, rect.top, m_hReplacedIcon, iconwidth, iconheight, 0, NULL, DI_NORMAL); nIcons++; -#endif *pResult = CDRF_SKIPDEFAULT; return; } @@ -2596,7 +2610,7 @@ void CLogDlg::OnNMCustomdrawLoglist(NMHDR *pNMHDR, LRESULT *pResult) } void CLogDlg::OnNMCustomdrawChangedFileList(NMHDR *pNMHDR, LRESULT *pResult) { -#if 0 + NMLVCUSTOMDRAW* pLVCD = reinterpret_cast( pNMHDR ); // Take the default processing unless we set this to something else below. *pResult = CDRF_DODEFAULT; @@ -2622,11 +2636,12 @@ void CLogDlg::OnNMCustomdrawChangedFileList(NMHDR *pNMHDR, LRESULT *pResult) COLORREF crText = GetSysColor(COLOR_WINDOWTEXT); bool bGrayed = false; +#if 0 if ((m_cHidePaths.GetState() & 0x0003)==BST_INDETERMINATE) { if ((m_currentChangedArray)&&((m_currentChangedArray->GetCount() > (INT_PTR)pLVCD->nmcd.dwItemSpec))) { - if (m_currentChangedArray->GetAt(pLVCD->nmcd.dwItemSpec)->sPath.Left(m_sRelativeRoot.GetLength()).Compare(m_sRelativeRoot)!=0) + //if ((*m_currentChangedArray)[(pLVCD->nmcd.dwItemSpec)]sPath.Left(m_sRelativeRoot.GetLength()).Compare(m_sRelativeRoot)!=0) { crText = GetSysColor(COLOR_GRAYTEXT); bGrayed = true; @@ -2634,7 +2649,7 @@ void CLogDlg::OnNMCustomdrawChangedFileList(NMHDR *pNMHDR, LRESULT *pResult) } else if (m_currentChangedPathList.GetCount() > (INT_PTR)pLVCD->nmcd.dwItemSpec) { - if (m_currentChangedPathList[pLVCD->nmcd.dwItemSpec].GetGitPathString().Left(m_sRelativeRoot.GetLength()).Compare(m_sRelativeRoot)!=0) + //if (m_currentChangedPathList[pLVCD->nmcd.dwItemSpec].GetGitPathString().Left(m_sRelativeRoot.GetLength()).Compare(m_sRelativeRoot)!=0) { crText = GetSysColor(COLOR_GRAYTEXT); bGrayed = true; @@ -2642,23 +2657,23 @@ void CLogDlg::OnNMCustomdrawChangedFileList(NMHDR *pNMHDR, LRESULT *pResult) } } +#endif if ((!bGrayed)&&(m_currentChangedArray)&&(m_currentChangedArray->GetCount() > (INT_PTR)pLVCD->nmcd.dwItemSpec)) { - DWORD action = m_currentChangedArray->GetAt(pLVCD->nmcd.dwItemSpec)->action; - if (action == LOGACTIONS_MODIFIED) + DWORD action = ((*m_currentChangedArray)[pLVCD->nmcd.dwItemSpec]).m_Action; + if (action == CTGitPath::LOGACTIONS_MODIFIED) crText = m_Colors.GetColor(CColors::Modified); - if (action == LOGACTIONS_REPLACED) + if (action == CTGitPath::LOGACTIONS_REPLACED) crText = m_Colors.GetColor(CColors::Deleted); - if (action == LOGACTIONS_ADDED) + if (action == CTGitPath::LOGACTIONS_ADDED) crText = m_Colors.GetColor(CColors::Added); - if (action == LOGACTIONS_DELETED) + if (action == CTGitPath::LOGACTIONS_DELETED) crText = m_Colors.GetColor(CColors::Deleted); } // Store the color back in the NMLVCUSTOMDRAW struct. pLVCD->clrText = crText; } -#endif } void CLogDlg::DoSizeV1(int delta) @@ -2910,70 +2925,28 @@ void CLogDlg::OnLvnGetdispinfoLoglist(NMHDR *pNMHDR, LRESULT *pResult) // Which column? switch (pItem->iSubItem) { - case 0: //revision + case this->LOGLIST_GRAPH: //Graphic if (pLogEntry) { -#if 0 - _stprintf_s(pItem->pszText, pItem->cchTextMax, _T("%ld"), pLogEntry->Rev); - // to make the child entries indented, add spaces - size_t len = _tcslen(pItem->pszText); - TCHAR * pBuf = pItem->pszText + len; - DWORD nSpaces = m_maxChild-pLogEntry->childStackDepth; - while ((pItem->cchTextMax >= (int)len)&&(nSpaces)) - { - *pBuf = ' '; - pBuf++; - nSpaces--; - } - *pBuf = 0; -#endif } break; - case 1: //action -- no text in the column + case this->LOGLIST_ACTION: //action -- no text in the column + break; + case this->LOGLIST_MESSAGE: //Message + if (pLogEntry) + lstrcpyn(pItem->pszText, (LPCTSTR)pLogEntry->m_Subject, pItem->cchTextMax); break; - case 2: //author + case this->LOGLIST_AUTHOR: //Author if (pLogEntry) lstrcpyn(pItem->pszText, (LPCTSTR)pLogEntry->m_AuthorName, pItem->cchTextMax); break; - case 3: //date -#if 0 + case this->LOGLIST_DATE: //Date if (pLogEntry) - lstrcpyn(pItem->pszText, (LPCTSTR)pLogEntry->sDate, pItem->cchTextMax); + lstrcpyn(pItem->pszText, (LPCTSTR)pLogEntry->m_AuthorDate.Format(_T("%Y-%m-%d %H:%M")), pItem->cchTextMax); break; -#endif - case 4: //message or bug id -#if 0 - if (m_bShowBugtraqColumn) - { - if (pLogEntry) - lstrcpyn(pItem->pszText, (LPCTSTR)pLogEntry->sBugIDs, pItem->cchTextMax); - break; - } -#endif - // fall through here! + case 5: -#if 0 - if (pLogEntry) - { - // Add as many characters as possible from the short log message - // to the list control. If the message is longer than - // allowed width, add "..." as an indication. - const int dots_len = 3; - if (pLogEntry->sShortMessage.GetLength() >= pItem->cchTextMax && pItem->cchTextMax > dots_len) - { - lstrcpyn(pItem->pszText, (LPCTSTR)pLogEntry->sShortMessage, pItem->cchTextMax - dots_len); - lstrcpyn(pItem->pszText + pItem->cchTextMax - dots_len - 1, _T("..."), dots_len + 1); - } - else - lstrcpyn(pItem->pszText, (LPCTSTR)pLogEntry->sShortMessage, pItem->cchTextMax); - } - else if ((itemid == m_arShownList.GetCount()) && m_bStrict && m_bStrictStopped) - { - CString sTemp; - sTemp.LoadString(IDS_LOG_STOPONCOPY_HINT); - lstrcpyn(pItem->pszText, sTemp, pItem->cchTextMax); - } -#endif + break; default: ASSERT(false); @@ -2982,7 +2955,7 @@ void CLogDlg::OnLvnGetdispinfoLoglist(NMHDR *pNMHDR, LRESULT *pResult) void CLogDlg::OnLvnGetdispinfoChangedFileList(NMHDR *pNMHDR, LRESULT *pResult) { -#if 0 + NMLVDISPINFO *pDispInfo = reinterpret_cast(pNMHDR); //Create a pointer to the item @@ -3007,44 +2980,58 @@ void CLogDlg::OnLvnGetdispinfoChangedFileList(NMHDR *pNMHDR, LRESULT *pResult) lstrcpyn(pItem->pszText, _T(""), pItem->cchTextMax); return; } - LogChangedPath * lcpath = NULL; + CTGitPath lcpath = NULL; if (m_currentChangedArray) - lcpath = m_currentChangedArray->GetAt(pItem->iItem); + lcpath = (*m_currentChangedArray)[pItem->iItem]; //Does the list need text information? if (pItem->mask & LVIF_TEXT) { //Which column? switch (pItem->iSubItem) { - case 0: //Action + case this->FILELIST_ACTION: //Action +#if 0 if (lcpath) lstrcpyn(pItem->pszText, (LPCTSTR)lcpath->GetAction(), pItem->cchTextMax); else lstrcpyn(pItem->pszText, _T(""), pItem->cchTextMax); +#endif + lstrcpyn(pItem->pszText, (LPCTSTR)lcpath.GetActionName(), pItem->cchTextMax); + break; - case 1: //path + + case this->FILELIST_ADD: //add +#if 0 if (lcpath) lstrcpyn(pItem->pszText, (LPCTSTR)lcpath->sPath, pItem->cchTextMax); else lstrcpyn(pItem->pszText, (LPCTSTR)m_currentChangedPathList[pItem->iItem].GetGitPathString(), pItem->cchTextMax); +#endif + lstrcpyn(pItem->pszText, (LPCTSTR)lcpath.m_StatAdd, pItem->cchTextMax); break; - case 2: //copyfrom path + + case this->FILELIST_DEL: //del +#if 0 if (lcpath) lstrcpyn(pItem->pszText, (LPCTSTR)lcpath->sCopyFromPath, pItem->cchTextMax); else lstrcpyn(pItem->pszText, _T(""), pItem->cchTextMax); +#endif + lstrcpyn(pItem->pszText, (LPCTSTR)lcpath.m_StatDel, pItem->cchTextMax); break; - case 3: //revision + case this->FILELIST_PATH: //path +#if 0 if ((lcpath==NULL)||(lcpath->sCopyFromPath.IsEmpty())) lstrcpyn(pItem->pszText, _T(""), pItem->cchTextMax); else _stprintf_s(pItem->pszText, pItem->cchTextMax, _T("%ld"), lcpath->lCopyFromRev); +#endif + lstrcpyn(pItem->pszText, (LPCTSTR)lcpath.GetGitPathString(), pItem->cchTextMax); break; } } *pResult = 0; -#endif } void CLogDlg::OnEnChangeSearchedit() @@ -3555,7 +3542,7 @@ void CLogDlg::OnLvnColumnclickChangedFileList(NMHDR *pNMHDR, LRESULT *pResult) const int nColumn = pNMLV->iSubItem; m_bAscendingPathList = nColumn == m_nSortColumnPathList ? !m_bAscendingPathList : TRUE; m_nSortColumnPathList = nColumn; - qsort(m_currentChangedArray->GetData(), m_currentChangedArray->GetSize(), sizeof(LogChangedPath*), (GENERICCOMPAREFN)SortCompare); +// qsort(m_currentChangedArray->GetData(), m_currentChangedArray->GetSize(), sizeof(LogChangedPath*), (GENERICCOMPAREFN)SortCompare); SetSortArrow(&m_ChangedFileListCtrl, m_nSortColumnPathList, m_bAscendingPathList); m_ChangedFileListCtrl.Invalidate(); @@ -3601,7 +3588,7 @@ int CLogDlg::SortCompare(const void * pElem1, const void * pElem2) void CLogDlg::ResizeAllListCtrlCols() { -#if 0 + const int nMinimumWidth = ICONITEMBORDER+16*4; int maxcol = ((CHeaderCtrl*)(m_LogList.GetDlgItem(0)))->GetItemCount()-1; int nItemCount = m_LogList.GetItemCount(); @@ -3623,8 +3610,8 @@ void CLogDlg::ResizeAllListCtrlCols() int linewidth = m_LogList.GetStringWidth(m_LogList.GetItemText(index, col)) + 14; if (index < m_arShownList.GetCount()) { - PLOGENTRYDATA pCurLogEntry = reinterpret_cast(m_arShownList.GetAt(index)); - if ((pCurLogEntry)&&(pCurLogEntry->Rev == m_wcRev)) + GitRev * pCurLogEntry = reinterpret_cast(m_arShownList.GetAt(index)); + if ((pCurLogEntry)&&(pCurLogEntry->m_CommitHash == m_wcRev.m_CommitHash)) { // set the bold font and ask for the string width again m_LogList.SendMessage(WM_SETFONT, (WPARAM)m_boldFont, NULL); @@ -3649,7 +3636,7 @@ void CLogDlg::ResizeAllListCtrlCols() cx = linewidth; } // Adjust columns "Actions" containing icons - if (col == 1) + if (col == this->LOGLIST_ACTION) { if (cx < nMinimumWidth) { @@ -3657,6 +3644,14 @@ void CLogDlg::ResizeAllListCtrlCols() } } + if (col == this->LOGLIST_MESSAGE) + { + if (cx > LOGLIST_MESSAGE_MAX) + { + cx = LOGLIST_MESSAGE_MAX; + } + + } // keep the bug id column small if ((col == 4)&&(m_bShowBugtraqColumn)) { @@ -3669,7 +3664,7 @@ void CLogDlg::ResizeAllListCtrlCols() m_LogList.SetColumnWidth(col, cx); } } -#endif + } void CLogDlg::OnBnClickedHidepaths() diff --git a/TortoiseProc/LogDlg.h b/TortoiseProc/LogDlg.h index 2e691c9..8892d15 100644 --- a/TortoiseProc/LogDlg.h +++ b/TortoiseProc/LogDlg.h @@ -69,6 +69,24 @@ public: CLogDlg(CWnd* pParent = NULL); // standard constructor virtual ~CLogDlg(); + enum + { + LOGLIST_GRAPH, + LOGLIST_ACTION, + LOGLIST_MESSAGE, + LOGLIST_AUTHOR, + LOGLIST_DATE, + LOGLIST_BUG, + LOGLIST_MESSAGE_MAX=250 + }; + + enum + { + FILELIST_ACTION, + FILELIST_ADD, + FILELIST_DEL, + FILELIST_PATH + }; void SetParams(const CTGitPath& path, GitRev pegrev, GitRev startrev, GitRev endrev, int limit, BOOL bStrict = CRegDWORD(_T("Software\\TortoiseGit\\LastLogStrict"), FALSE), BOOL bSaveStrict = TRUE); @@ -221,7 +239,7 @@ private: BOOL m_bIncludeMerges; git_revnum_t m_lowestRev; BOOL m_bSaveStrict; - LogChangedPathArray * m_currentChangedArray; + CTGitPathList * m_currentChangedArray; LogChangedPathArray m_CurrentFilteredChangedArray; CTGitPathList m_currentChangedPathList; CPtrArray m_arShownList; diff --git a/TortoiseProc/TortoiseProc.vcproj.FSL.B20596.user b/TortoiseProc/TortoiseProc.vcproj.FSL.B20596.user index ce5b2b6..e9db27b 100644 --- a/TortoiseProc/TortoiseProc.vcproj.FSL.B20596.user +++ b/TortoiseProc/TortoiseProc.vcproj.FSL.B20596.user @@ -10,7 +10,7 @@ > DOt152WaD;ah-dI&@MQ2~aGgAHq2hFdXhx;U3jG4yaA5|Q z$%c)xlM9^KCWky!m~7<~2G`Atq?;igs2`-P1}@EyA`Lc28f?yyM^cj~IPpxs70xIz lc><3FNN}^B^Ep3|*2zpZN|POa2yDJLF=XoYK6SPJ1hVI delta 85 zcmaEMn&aCEjtwSGlM{m2rf<8#C^Ff~OK!433)^HZXSvB6Y`G?{a}EO0(>)>?r6zyi ok=i`V<&xjz1<4$nFHF{(I(-o{qYg;@bOTLBrS0D|7(e_00MW@JU;qFB diff --git a/TortoiseShell/TortoiseShell.suo b/TortoiseShell/TortoiseShell.suo index 6334fe291117145e6e4094d4210b75796e7501e1..a33f88d71772debcb59c0d1c0c248178ffefee6f 100644 GIT binary patch delta 848 zcmYk)UnoOy6bJBo>{7F#*)&Q1B@rtmiDZ)~ktzSn-+01~wy&~kWiEWp;-mEB!ij|55ROw_kW|?GJ%(4T~ez>a^w`zqJ*@g}yOkg*PON5$> zwfP;`tZ8BtWqm|gSreSYc*mvV6}+PuUun0CV4}*0Jk;23sZcA z9_sWl8_+D9U^R|WYh1JV!Rnc0XG~LThS?n10<%T3C1%THUS_Lg8_c#a%L#UL6ZY>E zZOsp6&pv`2=0I=6MmZ!qVs=b+!t9jnjLeSv1(sZwSn`WZO LUW8Y4BhTb(K@QuQq8JaF zu`#AHFfhbTKIo-A{mTSK|H+4045yb&WSqn(J>9mEQGT;kFdOsq2gZz|(^G31Be&0* z%D9q=jqyJaB!V@S%wY7NeprLiX#3Y0jF-8mFFDL8GuePeVEdOPj28k~V}Yi-gA{K6 J@{N(_DFEFpJQDx_ -- 2.11.0