X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=src%2FTortoiseProc%2FLogDlg.cpp;h=c78a09fdd821e606b2051998427e0a2c5ccc5b6e;hb=42581c68fae181bd6de188d005b8ce2e2c87508d;hp=9552a37d03cf0d70defe755056078af9f4973a2c;hpb=78c2eb138365a30ecfef24677bb676840f5a39a8;p=tortoisegit%2FTortoiseGitJp.git diff --git a/src/TortoiseProc/LogDlg.cpp b/src/TortoiseProc/LogDlg.cpp index 9552a37..c78a09f 100644 --- a/src/TortoiseProc/LogDlg.cpp +++ b/src/TortoiseProc/LogDlg.cpp @@ -1,12 +1,9 @@ // TortoiseGit - a Windows shell extension for easy version control - // Copyright (C) 2003-2008 - TortoiseGit - // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. - // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -25,7 +22,7 @@ #include "ProgressDlg.h" //#include "RepositoryBrowser.h" //#include "CopyDlg.h" -//#include "StatGraphDlg.h" +#include "StatGraphDlg.h" #include "Logdlg.h" #include "MessageBox.h" #include "Registry.h" @@ -53,16 +50,12 @@ const UINT CLogDlg::m_FindDialogMessage = RegisterWindowMessage(FINDMSGSTRING); - - IMPLEMENT_DYNAMIC(CLogDlg, CResizableStandAloneDialog) CLogDlg::CLogDlg(CWnd* pParent /*=NULL*/) : CResizableStandAloneDialog(CLogDlg::IDD, pParent) , m_logcounter(0) , m_nSearchIndex(0) , m_wParam(0) - , m_nSelectedFilter(LOGFILTER_ALL) - , m_bNoDispUpdates(FALSE) , m_currentChangedArray(NULL) , m_nSortColumn(0) , m_bShowedAll(false) @@ -72,14 +65,14 @@ CLogDlg::CLogDlg(CWnd* pParent /*=NULL*/) , m_bSelectionMustBeContinuous(false) , m_bShowBugtraqColumn(false) , m_lowestRev(_T("")) - , m_bStrictStopped(false) + , m_sLogInfo(_T("")) , m_pFindDialog(NULL) , m_bCancelled(FALSE) , m_pNotifyWindow(NULL) - , m_bThreadRunning(FALSE) + , m_bAscending(FALSE) - , m_pStoreSelection(NULL) + , m_limit(0) , m_childCounter(0) , m_maxChild(0) @@ -93,15 +86,8 @@ CLogDlg::CLogDlg(CWnd* pParent /*=NULL*/) CLogDlg::~CLogDlg() { - InterlockedExchange(&m_bNoDispUpdates, TRUE); - m_CurrentFilteredChangedArray.RemoveAll(); - - if ( m_pStoreSelection ) - { - delete m_pStoreSelection; - m_pStoreSelection = NULL; - } + m_CurrentFilteredChangedArray.RemoveAll(); } @@ -114,7 +100,7 @@ void CLogDlg::DoDataExchange(CDataExchange* pDX) DDX_Control(pDX, IDC_SPLITTERTOP, m_wndSplitter1); DDX_Control(pDX, IDC_SPLITTERBOTTOM, m_wndSplitter2); DDX_Check(pDX, IDC_CHECK_STOPONCOPY, m_bStrict); - DDX_Text(pDX, IDC_SEARCHEDIT, m_sFilterText); + DDX_Text(pDX, IDC_SEARCHEDIT, m_LogList.m_sFilterText); DDX_Control(pDX, IDC_DATEFROM, m_DateFrom); DDX_Control(pDX, IDC_DATETO, m_DateTo); DDX_Control(pDX, IDC_HIDEPATHS, m_cHidePaths); @@ -127,26 +113,26 @@ void CLogDlg::DoDataExchange(CDataExchange* pDX) BEGIN_MESSAGE_MAP(CLogDlg, CResizableStandAloneDialog) ON_REGISTERED_MESSAGE(m_FindDialogMessage, OnFindDialogMessage) ON_BN_CLICKED(IDC_GETALL, OnBnClickedGetall) - ON_NOTIFY(NM_DBLCLK, IDC_LOGMSG, OnNMDblclkChangedFileList) + //ON_NOTIFY(NM_DBLCLK, IDC_LOGMSG, OnNMDblclkChangedFileList) ON_WM_CONTEXTMENU() ON_WM_SETCURSOR() ON_BN_CLICKED(IDHELP, OnBnClickedHelp) ON_NOTIFY(LVN_ITEMCHANGED, IDC_LOGLIST, OnLvnItemchangedLoglist) ON_NOTIFY(EN_LINK, IDC_MSGVIEW, OnEnLinkMsgview) ON_BN_CLICKED(IDC_STATBUTTON, OnBnClickedStatbutton) - //ON_NOTIFY(NM_CUSTOMDRAW, IDC_LOGLIST, OnNMCustomdrawLoglist) + ON_MESSAGE(WM_FILTEREDIT_INFOCLICKED, OnClickedInfoIcon) ON_MESSAGE(WM_FILTEREDIT_CANCELCLICKED, OnClickedCancelFilter) - //ON_NOTIFY(LVN_GETDISPINFO, IDC_LOGLIST, OnLvnGetdispinfoLoglist) + ON_EN_CHANGE(IDC_SEARCHEDIT, OnEnChangeSearchedit) ON_WM_TIMER() ON_NOTIFY(DTN_DATETIMECHANGE, IDC_DATETO, OnDtnDatetimechangeDateto) ON_NOTIFY(DTN_DATETIMECHANGE, IDC_DATEFROM, OnDtnDatetimechangeDatefrom) ON_BN_CLICKED(IDC_NEXTHUNDRED, OnBnClickedNexthundred) - ON_NOTIFY(NM_CUSTOMDRAW, IDC_LOGMSG, OnNMCustomdrawChangedFileList) - ON_NOTIFY(LVN_GETDISPINFO, IDC_LOGMSG, OnLvnGetdispinfoChangedFileList) + //ON_NOTIFY(NM_CUSTOMDRAW, IDC_LOGMSG, OnNMCustomdrawChangedFileList) + //ON_NOTIFY(LVN_GETDISPINFO, IDC_LOGMSG, OnLvnGetdispinfoChangedFileList) ON_NOTIFY(LVN_COLUMNCLICK,IDC_LOGLIST , OnLvnColumnclick) - ON_NOTIFY(LVN_COLUMNCLICK, IDC_LOGMSG, OnLvnColumnclickChangedFileList) + //ON_NOTIFY(LVN_COLUMNCLICK, IDC_LOGMSG, OnLvnColumnclickChangedFileList) ON_BN_CLICKED(IDC_HIDEPATHS, OnBnClickedHidepaths) ON_BN_CLICKED(IDC_CHECK_STOPONCOPY, &CLogDlg::OnBnClickedCheckStoponcopy) @@ -223,30 +209,14 @@ BOOL CLogDlg::OnInitDialog() if ((!m_ProjectProperties.sUrl.IsEmpty())||(!m_ProjectProperties.sCheckRe.IsEmpty())) m_bShowBugtraqColumn = true; - theme.SetWindowTheme(m_LogList.GetSafeHwnd(), L"Explorer", NULL); - theme.SetWindowTheme(m_ChangedFileListCtrl.GetSafeHwnd(), L"Explorer", NULL); + //theme.SetWindowTheme(m_LogList.GetSafeHwnd(), L"Explorer", NULL); + //theme.SetWindowTheme(m_ChangedFileListCtrl.GetSafeHwnd(), L"Explorer", NULL); // set up the columns m_LogList.DeleteAllItems(); + m_LogList.InsertGitColumn(); - m_ChangedFileListCtrl.SetExtendedStyle ( LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER ); - m_ChangedFileListCtrl.DeleteAllItems(); - int c = ((CHeaderCtrl*)(m_ChangedFileListCtrl.GetDlgItem(0)))->GetItemCount()-1; - while (c>=0) - m_ChangedFileListCtrl.DeleteColumn(c--); - temp.LoadString(IDS_PROGRS_ACTION); - 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(this->FILELIST_PATH, temp); - - m_ChangedFileListCtrl.SetRedraw(false); - CAppUtils::ResizeAllListCtrlCols(&m_ChangedFileListCtrl); - m_ChangedFileListCtrl.SetRedraw(true); - + m_ChangedFileListCtrl.Init(SVNSLC_COLEXT | SVNSLC_COLSTATUS |IDS_STATUSLIST_COLADD|IDS_STATUSLIST_COLDEL , _T("LogDlg")); GetDlgItem(IDC_LOGLIST)->UpdateData(FALSE); @@ -367,7 +337,7 @@ BOOL CLogDlg::OnInitDialog() // set the choices for the "Show All" button temp.LoadString(IDS_LOG_SHOWALL); m_btnShow.AddEntry(temp); - temp.LoadString(IDS_LOG_SHOWRANGE); + temp.LoadString(IDS_LOG_SHOW_WHOLE); m_btnShow.AddEntry(temp); m_btnShow.SetCurrentEntry((LONG)CRegDWORD(_T("Software\\TortoiseGit\\ShowAllEntry"))); @@ -375,20 +345,68 @@ BOOL CLogDlg::OnInitDialog() // first start a thread to obtain the log messages without // blocking the dialog - m_tTo = 0; - m_tFrom = (DWORD)-1; - InterlockedExchange(&m_bThreadRunning, TRUE); - InterlockedExchange(&m_bNoDispUpdates, TRUE); - if (AfxBeginThread(LogThreadEntry, this)==NULL) - { - InterlockedExchange(&m_bThreadRunning, FALSE); - InterlockedExchange(&m_bNoDispUpdates, FALSE); - CMessageBox::Show(NULL, IDS_ERR_THREADSTARTFAILED, IDS_APPNAME, MB_OK | MB_ICONERROR); - } + //m_tTo = 0; + //m_tFrom = (DWORD)-1; + + m_LogList.m_Path=m_path; + m_LogList.FetchLogAsync(LogCallBack,this); + GetDlgItem(IDC_LOGLIST)->SetFocus(); return FALSE; } +void CLogDlg::LogRunStatus(int cur) +{ + if( cur == GITLOG_START ) + { + CString temp; + temp.LoadString(IDS_PROGRESSWAIT); + + // change the text of the close button to "Cancel" since now the thread + // is running, and simply closing the dialog doesn't work. + if (!GetDlgItem(IDOK)->IsWindowVisible()) + { + temp.LoadString(IDS_MSGBOX_CANCEL); + SetDlgItemText(IDCANCEL, temp); + } + + // We use a progress bar while getting the logs + m_LogProgress.SetRange32(0, 100); + m_LogProgress.SetPos(0); + + GetDlgItem(IDC_PROGRESS)->ShowWindow(TRUE); + + //DialogEnableWindow(IDC_GETALL, FALSE); + DialogEnableWindow(IDC_NEXTHUNDRED, FALSE); + DialogEnableWindow(IDC_CHECK_STOPONCOPY, FALSE); + DialogEnableWindow(IDC_INCLUDEMERGE, FALSE); + DialogEnableWindow(IDC_STATBUTTON, FALSE); + DialogEnableWindow(IDC_REFRESH, FALSE); + DialogEnableWindow(IDC_HIDEPATHS,FALSE); + } + + if( cur == GITLOG_END) + { + + if (!m_bShowedAll) + DialogEnableWindow(IDC_NEXTHUNDRED, TRUE); + + DialogEnableWindow(IDC_GETALL, TRUE); + //DialogEnableWindow(IDC_INCLUDEMERGE, TRUE); + DialogEnableWindow(IDC_STATBUTTON, TRUE); + DialogEnableWindow(IDC_REFRESH, TRUE); + +// PostMessage(WM_TIMER, LOGFILTER_TIMER); + + //CTime time=m_LogList.GetOldestTime(); + CTime begin,end; + m_LogList.GetTimeRange(begin,end); + m_DateFrom.SetTime(&begin); + m_DateTo.SetTime(&end); + } + + m_LogProgress.SetPos(cur); +} void CLogDlg::SetDlgTitle(bool bOffline) { if (m_sTitle.IsEmpty()) @@ -409,6 +427,8 @@ void CLogDlg::SetDlgTitle(bool bOffline) { if (m_path.IsUrl()) SetWindowText(m_sTitle + _T(" - ") + m_path.GetUIPathString()); + else if (m_path.IsEmpty()) + SetWindowText(m_sTitle + _T(" - ") + CString(_T("Whole Project"))); else if (m_path.IsDirectory()) SetWindowText(m_sTitle + _T(" - ") + m_path.GetWinPathString()); else @@ -453,12 +473,11 @@ void CLogDlg::FillLogMessageCtrl(bool bShow /* = true*/) pMsgView->SetWindowText(_T(" ")); // empty the changed files list m_ChangedFileListCtrl.SetRedraw(FALSE); - InterlockedExchange(&m_bNoDispUpdates, TRUE); +// InterlockedExchange(&m_bNoDispUpdates, TRUE); m_currentChangedArray = NULL; - m_ChangedFileListCtrl.SetExtendedStyle ( LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER ); + //m_ChangedFileListCtrl.SetExtendedStyle ( LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER ); m_ChangedFileListCtrl.DeleteAllItems(); - m_ChangedFileListCtrl.SetItemCountEx(0); - + // if we're not here to really show a selected revision, just // get out of here after clearing the views, which is what is intended // if that flag is not set. @@ -466,7 +485,7 @@ void CLogDlg::FillLogMessageCtrl(bool bShow /* = true*/) { // force a redraw m_ChangedFileListCtrl.Invalidate(); - InterlockedExchange(&m_bNoDispUpdates, FALSE); +// InterlockedExchange(&m_bNoDispUpdates, FALSE); m_ChangedFileListCtrl.SetRedraw(TRUE); return; } @@ -477,7 +496,7 @@ void CLogDlg::FillLogMessageCtrl(bool bShow /* = true*/) if (selCount == 0) { // if nothing is selected, we have nothing more to do - InterlockedExchange(&m_bNoDispUpdates, FALSE); +// InterlockedExchange(&m_bNoDispUpdates, FALSE); m_ChangedFileListCtrl.SetRedraw(TRUE); return; } @@ -488,24 +507,30 @@ void CLogDlg::FillLogMessageCtrl(bool bShow /* = true*/) // list fully. POSITION pos = m_LogList.GetFirstSelectedItemPosition(); int selIndex = m_LogList.GetNextSelectedItem(pos); - if (selIndex >= m_arShownList.GetCount()) + if (selIndex >= m_LogList.m_arShownList.GetCount()) { - InterlockedExchange(&m_bNoDispUpdates, FALSE); +// InterlockedExchange(&m_bNoDispUpdates, FALSE); m_ChangedFileListCtrl.SetRedraw(TRUE); return; } - GitRev* pLogEntry = reinterpret_cast(m_arShownList.GetAt(selIndex)); - - // set the log message text - 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->m_Body, pMsgView); - CAppUtils::FormatTextInRichEditControl(pMsgView); - m_currentChangedArray = &(pLogEntry->m_Files); - if (m_currentChangedArray == NULL) + GitRev* pLogEntry = reinterpret_cast(m_LogList.m_arShownList.GetAt(selIndex)); + + if(!pLogEntry->m_IsFull) + { + pMsgView->SetWindowText(_T("load ...")); + }else { - InterlockedExchange(&m_bNoDispUpdates, FALSE); + // set the log message text + pMsgView->SetWindowText(_T("Commit:")+pLogEntry->m_CommitHash+_T("\r\n\r\n*")+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->m_Body, pMsgView); + CAppUtils::FormatTextInRichEditControl(pMsgView); + + m_ChangedFileListCtrl.UpdateWithGitPathList(pLogEntry->m_Files); + m_ChangedFileListCtrl.m_CurrentVersion=pLogEntry->m_CommitHash; + m_ChangedFileListCtrl.Show(SVNSLC_SHOWVERSIONED); + m_ChangedFileListCtrl.SetRedraw(TRUE); return; } @@ -538,7 +563,8 @@ void CLogDlg::FillLogMessageCtrl(bool bShow /* = true*/) } // redraw the views - InterlockedExchange(&m_bNoDispUpdates, FALSE); +// InterlockedExchange(&m_bNoDispUpdates, FALSE); +#if 0 if (m_currentChangedArray) { m_ChangedFileListCtrl.SetItemCountEx(m_currentChangedArray->GetCount()); @@ -554,6 +580,7 @@ void CLogDlg::FillLogMessageCtrl(bool bShow /* = true*/) m_ChangedFileListCtrl.SetItemCountEx(0); m_ChangedFileListCtrl.Invalidate(); } +#endif CAppUtils::ResizeAllListCtrlCols(&m_ChangedFileListCtrl); // sort according to the settings if (m_nSortColumnPathList > 0) @@ -571,53 +598,32 @@ void CLogDlg::OnBnClickedGetall() void CLogDlg::GetAll(bool bForceAll /* = false */) { -#if 0 + // fetch all requested log messages, either the specified range or // really *all* available log messages. - UpdateData(); + ///UpdateData(); INT_PTR entry = m_btnShow.GetCurrentEntry(); if (bForceAll) entry = 0; switch (entry) { - case 0: // show all - - m_endrev = 0; - m_startrev = m_LogRevision; - if (m_bStrict) - m_bShowedAll = true; - + case 0: // show all branch; + m_LogList.m_bAllBranch=true; break; - case 1: // show range - { - - // ask for a revision range - CRevisionRangeDlg dlg; - dlg.SetStartRevision(m_startrev); - dlg.SetEndRevision( (m_endrev>=0) ? m_endrev : 0); - if (dlg.DoModal()!=IDOK) - { - return; - } - m_endrev = dlg.GetEndRevision(); - m_startrev = dlg.GetStartRevision(); - if (((m_endrev.IsNumber())&&(m_startrev.IsNumber()))|| - (m_endrev.IsHead()||m_startrev.IsHead())) - { - if (((LONG)m_startrev < (LONG)m_endrev)|| - (m_endrev.IsHead())) - { - git_revnum_t temp = m_startrev; - m_startrev = m_endrev; - m_endrev = temp; - } - } - m_bShowedAll = false; - } - + case 1: // show whole project + m_LogList.m_Path.Reset(); + SetWindowText(m_sTitle + _T(" - ")); break; } + //m_LogList.m_bExitThread=TRUE; + //::WaitForSingleObject(m_LogList.m_LoadingThread->m_hThread,INFINITE); + + m_LogList.TerminateThread(); + + m_LogList.Clear(); + m_LogList.FetchLogAsync(LogCallBack,this); +#if 0 m_ChangedFileListCtrl.SetItemCountEx(0); m_ChangedFileListCtrl.Invalidate(); // We need to create CStoreSelection on the heap or else @@ -662,58 +668,7 @@ void CLogDlg::OnBnClickedRefresh() void CLogDlg::Refresh (bool autoGoOnline) { -#if 0 - // refreshing means re-downloading the already shown log messages - UpdateData(); - m_maxChild = 0; - m_childCounter = 0; - - if ((m_limit == 0)||(m_bStrict)||(int(m_logEntries.size()-1) > m_limit)) - { - if (m_logEntries.size() != 0) - { - m_endrev = m_logEntries[m_logEntries.size()-1]->Rev; - } - } - m_startrev = -1; - m_bCancelled = FALSE; - - // We need to create CStoreSelection on the heap or else - // the variable will run out of the scope before the - // thread ends. Therefore we let the thread delete - // the instance. - m_pStoreSelection = new CStoreSelection(this); - m_ChangedFileListCtrl.SetItemCountEx(0); - m_ChangedFileListCtrl.Invalidate(); - m_LogList.SetItemCountEx(0); - m_LogList.Invalidate(); - InterlockedExchange(&m_bNoDispUpdates, TRUE); - CWnd * pMsgView = GetDlgItem(IDC_MSGVIEW); - pMsgView->SetWindowText(_T("")); - - SetSortArrow(&m_LogList, -1, true); - - m_LogList.DeleteAllItems(); - m_arShownList.RemoveAll(); - m_logEntries.ClearAll(); - - // reset the cached HEAD property & go on-line - - if (autoGoOnline) - { - SetDlgTitle (false); - logCachePool.GetRepositoryInfo().ResetHeadRevision (m_sUUID, m_sRepositoryRoot); - } - - InterlockedExchange(&m_bThreadRunning, TRUE); - if (AfxBeginThread(LogThreadEntry, this)==NULL) - { - InterlockedExchange(&m_bThreadRunning, FALSE); - CMessageBox::Show(NULL, IDS_ERR_THREADSTARTFAILED, IDS_APPNAME, MB_OK | MB_ICONERROR); - } - GetDlgItem(IDC_LOGLIST)->UpdateData(FALSE); - InterlockedExchange(&m_bNoDispUpdates, FALSE); -#endif + m_LogList.Refresh(); } void CLogDlg::OnBnClickedNexthundred() @@ -793,10 +748,18 @@ void CLogDlg::OnCancel() CString temp, temp2; GetDlgItemText(IDOK, temp); temp2.LoadString(IDS_MSGBOX_CANCEL); - if ((temp.Compare(temp2)==0)||(m_bThreadRunning)) + if ((temp.Compare(temp2)==0)||(this->IsThreadRunning())) { - m_bCancelled = true; - return; + //m_bCancelled = true; + //return; + if(m_LogList.m_bThreadRunning) + { + //m_LogList.m_bExitThread=true; + //WaitForSingleObject(m_LogList.m_LoadingThread->m_hThread,INFINITE); + m_LogList.TerminateThread(); + } + + //m_LogList.TerminateThread(); } UpdateData(); if (m_bSaveStrict) @@ -931,253 +894,9 @@ BOOL CLogDlg::Log(git_revnum_t rev, const CString& author, const CString& date, return TRUE; } -//this is the thread function which calls the subversion function -UINT CLogDlg::LogThreadEntry(LPVOID pVoid) -{ - return ((CLogDlg*)pVoid)->LogThread(); -} - GitRev g_rev; //this is the thread function which calls the subversion function -UINT CLogDlg::LogThread() -{ - - InterlockedExchange(&m_bThreadRunning, TRUE); - - //does the user force the cache to refresh (shift or control key down)? - bool refresh = (GetKeyState (VK_CONTROL) < 0) - || (GetKeyState (VK_SHIFT) < 0); - - //disable the "Get All" button while we're receiving - //log messages. - DialogEnableWindow(IDC_GETALL, FALSE); - DialogEnableWindow(IDC_NEXTHUNDRED, FALSE); - DialogEnableWindow(IDC_CHECK_STOPONCOPY, FALSE); - DialogEnableWindow(IDC_INCLUDEMERGE, FALSE); - DialogEnableWindow(IDC_STATBUTTON, FALSE); - DialogEnableWindow(IDC_REFRESH, FALSE); - - CString temp; - temp.LoadString(IDS_PROGRESSWAIT); - m_LogList.ShowText(temp, true); - // change the text of the close button to "Cancel" since now the thread - // is running, and simply closing the dialog doesn't work. - if (!GetDlgItem(IDOK)->IsWindowVisible()) - { - temp.LoadString(IDS_MSGBOX_CANCEL); - SetDlgItemText(IDCANCEL, temp); - } - // We use a progress bar while getting the logs - m_LogProgress.SetRange32(0, 100); - m_LogProgress.SetPos(0); - GetDlgItem(IDC_PROGRESS)->ShowWindow(TRUE); -// git_revnum_t r = -1; - - // get the repository root url, because the changed-files-list has the - // paths shown there relative to the repository root. -// CTGitPath rootpath; -// BOOL succeeded = GetRootAndHead(m_path, rootpath, r); - -// m_sRepositoryRoot = rootpath.GetGitPathString(); -// m_sURL = m_path.GetGitPathString(); - - // we need the UUID to unambigously identify the log cache -// if (logCachePool.IsEnabled()) -// m_sUUID = logCachePool.GetRepositoryInfo().GetRepositoryUUID (rootpath); - - // if the log dialog is started from a working copy, we need to turn that - // local path into an url here -// if (succeeded) -// { -// if (!m_path.IsUrl()) -// { -// m_sURL = GetURLFromPath(m_path); - - // The URL is escaped because Git::logReceiver - // returns the path in a native format -// m_sURL = CPathUtils::PathUnescape(m_sURL); - // } -// m_sRelativeRoot = m_sURL.Mid(CPathUtils::PathUnescape(m_sRepositoryRoot).GetLength()); -// m_sSelfRelativeURL = m_sRelativeRoot; - // } -#if 0 - if (succeeded && !m_mergePath.IsEmpty() && m_mergedRevs.empty()) - { - // in case we got a merge path set, retrieve the merge info - // of that path and check whether one of the merge URLs - // match the URL we show the log for. - GitPool localpool(pool); - git_error_clear(Err); - apr_hash_t * mergeinfo = NULL; - if (git_client_mergeinfo_get_merged (&mergeinfo, m_mergePath.GetGitApiPath(localpool), GitRev(GitRev::REV_WC), m_pctx, localpool) == NULL) - { - // now check the relative paths - apr_hash_index_t *hi; - const void *key; - void *val; - - if (mergeinfo) - { - for (hi = apr_hash_first(localpool, mergeinfo); hi; hi = apr_hash_next(hi)) - { - apr_hash_this(hi, &key, NULL, &val); - if (m_sURL.Compare(CUnicodeUtils::GetUnicode((char*)key)) == 0) - { - apr_array_header_t * arr = (apr_array_header_t*)val; - if (val) - { - for (long i=0; inelts; ++i) - { - git_merge_range_t * pRange = APR_ARRAY_IDX(arr, i, git_merge_range_t*); - if (pRange) - { - for (git_revnum_t r=pRange->start+1; r<=pRange->end; ++r) - { - m_mergedRevs.insert(r); - } - } - } - } - break; - } - } - } - } - } - - m_LogProgress.SetPos(1); - if (m_startrev == GitRev::REV_HEAD) - { - m_startrev = r; - } - if (m_endrev == GitRev::REV_HEAD) - { - m_endrev = r; - } - if (m_limit != 0) - { - m_limitcounter = m_limit; - m_LogProgress.SetRange32(0, m_limit); - } - else - m_LogProgress.SetRange32(m_endrev, m_startrev); - - if (!m_pegrev.IsValid()) - m_pegrev = m_startrev; - size_t startcount = m_logEntries.size(); - m_lowestRev = -1; - m_bStrictStopped = false; - - if (succeeded) - { - succeeded = ReceiveLog (CTGitPathList(m_path), m_pegrev, m_startrev, m_endrev, m_limit, m_bStrict, m_bIncludeMerges, refresh); - if ((!succeeded)&&(!m_path.IsUrl())) - { - // try again with REV_WC as the start revision, just in case the path doesn't - // exist anymore in HEAD - succeeded = ReceiveLog(CTGitPathList(m_path), GitRev(), GitRev::REV_WC, m_endrev, m_limit, m_bStrict, m_bIncludeMerges, refresh); - } - } - m_LogList.ClearText(); - if (!succeeded) - { - m_LogList.ShowText(GetLastErrorMessage(), true); - } - else - { - if (!m_wcRev.IsValid()) - { - // fetch the revision the wc path is on so we can mark it - CTGitPath revWCPath = m_ProjectProperties.GetPropsPath(); - if (!m_path.IsUrl()) - revWCPath = m_path; - if (DWORD(CRegDWORD(_T("Software\\TortoiseGit\\RecursiveLogRev"), FALSE))) - { - git_revnum_t minrev, maxrev; - bool switched, modified, sparse; - GetWCRevisionStatus(revWCPath, true, minrev, maxrev, switched, modified, sparse); - if (maxrev) - m_wcRev = maxrev; - } - else - { - CTGitPath dummypath; - GitStatus status; - git_wc_status2_t * stat = status.GetFirstFileStatus(revWCPath, dummypath, false, git_depth_empty); - if (stat && stat->entry && stat->entry->cmt_rev) - m_wcRev = stat->entry->cmt_rev; - if (stat && stat->entry && (stat->entry->kind == git_node_dir)) - m_wcRev = stat->entry->revision; - } - } - } - if (m_bStrict && (m_lowestRev>1) && ((m_limit>0) ? ((startcount + m_limit)>m_logEntries.size()) : (m_endrevShowWindow(FALSE); - m_bCancelled = true; -#endif - InterlockedExchange(&m_bThreadRunning, FALSE); - m_LogList.RedrawItems(0, m_arShownList.GetCount()); - m_LogList.SetRedraw(false); - m_LogList.ResizeAllListCtrlCols(); - m_LogList.SetRedraw(true); - if ( m_pStoreSelection ) - { - // Deleting the instance will restore the - // selection of the CLogDlg. - delete m_pStoreSelection; - m_pStoreSelection = NULL; - } - else - { - // If no selection has been set then this must be the first time - // the revisions are shown. Let's preselect the topmost revision. - if ( m_LogList.GetItemCount()>0 ) - { - m_LogList.SetSelectionMark(0); - m_LogList.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED); - } - } - - if (!GetDlgItem(IDOK)->IsWindowVisible()) - { - temp.LoadString(IDS_MSGBOX_OK); - SetDlgItemText(IDCANCEL, temp); - } - - RefreshCursor(); - // make sure the filter is applied (if any) now, after we refreshed/fetched - // the log messages - PostMessage(WM_TIMER, LOGFILTER_TIMER); - - return 0; -} @@ -1270,7 +989,7 @@ void CLogDlg::OnContextMenu(CWnd* pWnd, CPoint point) } else if (pWnd == &m_ChangedFileListCtrl) { - ShowContextMenuForChangedpaths(pWnd, point); + //ShowContextMenuForChangedpaths(pWnd, point); } else if ((selCount == 1)&&(pWnd == GetDlgItem(IDC_MSGVIEW))) { @@ -1295,12 +1014,12 @@ void CLogDlg::OnContextMenu(CWnd* pWnd, CPoint point) sMenuItemText.LoadString(IDS_SCIEDIT_SELECTALL); popup.AppendMenu(MF_STRING | MF_ENABLED, EM_SETSEL, sMenuItemText); - if (selIndex >= 0) - { - popup.AppendMenu(MF_SEPARATOR); - sMenuItemText.LoadString(IDS_LOG_POPUP_EDITLOG); - popup.AppendMenu(MF_STRING | MF_ENABLED, CGitLogList::ID_EDITAUTHOR, sMenuItemText); - } + //if (selIndex >= 0) + //{ + // popup.AppendMenu(MF_SEPARATOR); + // sMenuItemText.LoadString(IDS_LOG_POPUP_EDITLOG); + // popup.AppendMenu(MF_STRING | MF_ENABLED, CGitLogList::ID_EDITAUTHOR, sMenuItemText); + //} int cmd = popup.TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY, point.x, point.y, this, 0); switch (cmd) @@ -1711,9 +1430,9 @@ void CLogDlg::DoDiffFromLog(INT_PTR selIndex, GitRev* rev1, GitRev* rev2, bool b CString cmd; - cmd.Format(_T("git.cmd cat-file -p %s:%s"),rev1->m_CommitHash,(*m_currentChangedArray)[selIndex].GetGitPathString()); + cmd.Format(_T("git.exe cat-file -p %s:%s"),rev1->m_CommitHash,(*m_currentChangedArray)[selIndex].GetGitPathString()); g_Git.RunLogFile(cmd,file1); - cmd.Format(_T("git.cmd cat-file -p %s:%s"),rev2->m_CommitHash,(*m_currentChangedArray)[selIndex].GetGitPathString()); + cmd.Format(_T("git.exe cat-file -p %s:%s"),rev2->m_CommitHash,(*m_currentChangedArray)[selIndex].GetGitPathString()); g_Git.RunLogFile(cmd,file2); CAppUtils::DiffFlags flags; @@ -2060,7 +1779,8 @@ BOOL CLogDlg::PreTranslateMessage(MSG* pMsg) BOOL CLogDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) { - if (m_bThreadRunning) + //if (this->IsThreadRunning()) + if(m_LogList.m_bNoDispUpdates) { // only show the wait cursor over the list control if ((pWnd)&& @@ -2090,14 +1810,15 @@ void CLogDlg::OnLvnItemchangedLoglist(NMHDR *pNMHDR, LRESULT *pResult) { LPNMLISTVIEW pNMLV = reinterpret_cast(pNMHDR); *pResult = 0; - if (m_bThreadRunning) + //if (this->IsThreadRunning()) + if(m_LogList.m_bNoDispUpdates) return; if (pNMLV->iItem >= 0) { m_nSearchIndex = pNMLV->iItem; if (pNMLV->iSubItem != 0) return; - if ((pNMLV->iItem == m_arShownList.GetCount())&&(m_bStrict)&&(m_bStrictStopped)) + if ((pNMLV->iItem == m_LogList.m_arShownList.GetCount())&&(m_bStrict)&&(1/*m_bStrictStopped*/)) { // remove the selected state if (pNMLV->uChanged & LVIF_STATE) @@ -2146,30 +1867,30 @@ void CLogDlg::OnEnLinkMsgview(NMHDR *pNMHDR, LRESULT *pResult) void CLogDlg::OnBnClickedStatbutton() { -#if 0 - if (m_bThreadRunning) + + if (this->IsThreadRunning()) return; - if (m_arShownList.IsEmpty()) + if (m_LogList.m_arShownList.IsEmpty()) return; // nothing is shown, so no statistics. // the statistics dialog expects the log entries to be sorted by date SortByColumn(3, false); CPtrArray shownlist; - RecalculateShownList(&shownlist); + m_LogList.RecalculateShownList(&shownlist); // create arrays which are aware of the current filter CStringArray m_arAuthorsFiltered; CDWordArray m_arDatesFiltered; CDWordArray m_arFileChangesFiltered; for (INT_PTR i=0; i(shownlist.GetAt(i)); - CString strAuthor = pLogEntry->sAuthor; + GitRev* pLogEntry = reinterpret_cast(shownlist.GetAt(i)); + CString strAuthor = pLogEntry->m_AuthorName; if ( strAuthor.IsEmpty() ) { strAuthor.LoadString(IDS_STATGRAPH_EMPTYAUTHOR); } m_arAuthorsFiltered.Add(strAuthor); - m_arDatesFiltered.Add(static_cast(pLogEntry->tmDate)); - m_arFileChangesFiltered.Add(pLogEntry->dwFileChanges); + m_arDatesFiltered.Add(pLogEntry->m_AuthorDate.GetTime()); + m_arFileChangesFiltered.Add(pLogEntry->m_Files.GetCount()); } CStatGraphDlg dlg; dlg.m_parAuthors = &m_arAuthorsFiltered; @@ -2180,7 +1901,7 @@ void CLogDlg::OnBnClickedStatbutton() // restore the previous sorting SortByColumn(m_nSortColumn, m_bAscending); OnTimer(LOGFILTER_TIMER); -#endif + } #if 0 @@ -2377,8 +2098,8 @@ void CLogDlg::OnNMCustomdrawChangedFileList(NMHDR *pNMHDR, LRESULT *pResult) // Take the default processing unless we set this to something else below. *pResult = CDRF_DODEFAULT; - if (m_bNoDispUpdates) - return; +// if (m_bNoDispUpdates) +// return; // First thing - check the draw stage. If it's the control's prepaint // stage, then tell Windows we want messages for every item. @@ -2542,7 +2263,7 @@ LRESULT CLogDlg::OnClickedInfoIcon(WPARAM /*wParam*/, LPARAM lParam) CPoint point; CString temp; point = CPoint(rect->left, rect->bottom); -#define LOGMENUFLAGS(x) (MF_STRING | MF_ENABLED | (m_nSelectedFilter == x ? MF_CHECKED : MF_UNCHECKED)) +#define LOGMENUFLAGS(x) (MF_STRING | MF_ENABLED | (m_LogList.m_nSelectedFilter == x ? MF_CHECKED : MF_UNCHECKED)) CMenu popup; if (popup.CreatePopupMenu()) { @@ -2581,7 +2302,7 @@ LRESULT CLogDlg::OnClickedInfoIcon(WPARAM /*wParam*/, LPARAM lParam) } else { - m_nSelectedFilter = selection; + m_LogList.m_nSelectedFilter = selection; SetFilterCueText(); } SetTimer(LOGFILTER_TIMER, 1000, NULL); @@ -2592,42 +2313,28 @@ LRESULT CLogDlg::OnClickedInfoIcon(WPARAM /*wParam*/, LPARAM lParam) LRESULT CLogDlg::OnClickedCancelFilter(WPARAM /*wParam*/, LPARAM /*lParam*/) { -#if 0 + KillTimer(LOGFILTER_TIMER); - m_sFilterText.Empty(); + m_LogList.m_sFilterText.Empty(); UpdateData(FALSE); theApp.DoWaitCursor(1); CStoreSelection storeselection(this); FillLogMessageCtrl(false); - InterlockedExchange(&m_bNoDispUpdates, TRUE); - m_arShownList.RemoveAll(); - // reset the time filter too - m_timFrom = (__time64_t(m_tFrom)); - m_timTo = (__time64_t(m_tTo)); - m_DateFrom.SetTime(&m_timFrom); - m_DateTo.SetTime(&m_timTo); - m_DateFrom.SetRange(&m_timFrom, &m_timTo); - m_DateTo.SetRange(&m_timFrom, &m_timTo); + m_LogList.RemoveFilter(); + + CTime begin,end; + m_LogList.GetTimeRange(begin,end); + m_DateFrom.SetTime(&begin); + m_DateTo.SetTime(&end); - for (DWORD i=0; iShowWindow(SW_HIDE); GetDlgItem(IDC_SEARCHEDIT)->ShowWindow(SW_SHOW); GetDlgItem(IDC_SEARCHEDIT)->SetFocus(); UpdateLogInfoLabel(); -#endif + return 0L; } @@ -2635,7 +2342,7 @@ LRESULT CLogDlg::OnClickedCancelFilter(WPARAM /*wParam*/, LPARAM /*lParam*/) void CLogDlg::SetFilterCueText() { CString temp; - switch (m_nSelectedFilter) + switch (m_LogList.m_nSelectedFilter) { case LOGFILTER_ALL: temp.LoadString(IDS_LOG_FILTER_ALL); @@ -2657,376 +2364,21 @@ void CLogDlg::SetFilterCueText() temp = _T(" ")+temp; m_cFilter.SetCueBanner(temp); } -#if 0 -void CLogDlg::OnLvnGetdispinfoLoglist(NMHDR *pNMHDR, LRESULT *pResult) -{ - NMLVDISPINFO *pDispInfo = reinterpret_cast(pNMHDR); - - // Create a pointer to the item - LV_ITEM* pItem = &(pDispInfo)->item; - - // Do the list need text information? - if (!(pItem->mask & LVIF_TEXT)) - return; - - // By default, clear text buffer. - lstrcpyn(pItem->pszText, _T(""), pItem->cchTextMax); - - bool bOutOfRange = pItem->iItem >= ShownCountWithStopped(); - - *pResult = 0; - if (m_bNoDispUpdates || m_bThreadRunning || bOutOfRange) - return; - - // Which item number? - int itemid = pItem->iItem; - GitRev * pLogEntry = NULL; - if (itemid < m_arShownList.GetCount()) - pLogEntry = reinterpret_cast(m_arShownList.GetAt(pItem->iItem)); - - // Which column? - switch (pItem->iSubItem) - { - case this->LOGLIST_GRAPH: //Graphic - if (pLogEntry) - { - } - break; - 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 this->LOGLIST_AUTHOR: //Author - if (pLogEntry) - lstrcpyn(pItem->pszText, (LPCTSTR)pLogEntry->m_AuthorName, pItem->cchTextMax); - break; - case this->LOGLIST_DATE: //Date - if (pLogEntry) - lstrcpyn(pItem->pszText, (LPCTSTR)pLogEntry->m_AuthorDate.Format(_T("%Y-%m-%d %H:%M")), pItem->cchTextMax); - break; - - case 5: - - break; - default: - ASSERT(false); - } -} -#endif -void CLogDlg::OnLvnGetdispinfoChangedFileList(NMHDR *pNMHDR, LRESULT *pResult) -{ - - NMLVDISPINFO *pDispInfo = reinterpret_cast(pNMHDR); - - //Create a pointer to the item - LV_ITEM* pItem= &(pDispInfo)->item; - - *pResult = 0; - if ((m_bNoDispUpdates)||(m_bThreadRunning)) - { - if (pItem->mask & LVIF_TEXT) - lstrcpyn(pItem->pszText, _T(""), pItem->cchTextMax); - return; - } - if ((m_currentChangedArray!=NULL)&&(pItem->iItem >= m_currentChangedArray->GetCount())) - { - if (pItem->mask & LVIF_TEXT) - lstrcpyn(pItem->pszText, _T(""), pItem->cchTextMax); - return; - } - if ((m_currentChangedArray==NULL)&&(pItem->iItem >= m_currentChangedPathList.GetCount())) - { - if (pItem->mask & LVIF_TEXT) - lstrcpyn(pItem->pszText, _T(""), pItem->cchTextMax); - return; - } - CTGitPath lcpath = NULL; - if (m_currentChangedArray) - lcpath = (*m_currentChangedArray)[pItem->iItem]; - //Does the list need text information? - if (pItem->mask & LVIF_TEXT) - { - //Which column? - switch (pItem->iSubItem) - { - 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 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 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 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; -} - -void CLogDlg::OnEnChangeSearchedit() -{ -#if 0 - UpdateData(); - if (m_sFilterText.IsEmpty()) - { - CStoreSelection storeselection(this); - // clear the filter, i.e. make all entries appear - theApp.DoWaitCursor(1); - KillTimer(LOGFILTER_TIMER); - FillLogMessageCtrl(false); - InterlockedExchange(&m_bNoDispUpdates, TRUE); - m_arShownList.RemoveAll(); - for (DWORD i=0; iShowWindow(SW_HIDE); - GetDlgItem(IDC_SEARCHEDIT)->ShowWindow(SW_SHOW); - GetDlgItem(IDC_SEARCHEDIT)->SetFocus(); - DialogEnableWindow(IDC_STATBUTTON, !(((m_bThreadRunning)||(m_arShownList.IsEmpty())))); - return; - } - if (Validate(m_sFilterText)) - SetTimer(LOGFILTER_TIMER, 1000, NULL); - else - KillTimer(LOGFILTER_TIMER); -#endif -} - -bool CLogDlg::ValidateRegexp(LPCTSTR regexp_str, tr1::wregex& pat, bool bMatchCase /* = false */) -{ - try - { - tr1::regex_constants::syntax_option_type type = tr1::regex_constants::ECMAScript; - if (!bMatchCase) - type |= tr1::regex_constants::icase; - pat = tr1::wregex(regexp_str, type); - return true; - } - catch (exception) {} - return false; -} bool CLogDlg::Validate(LPCTSTR string) { if (!m_bFilterWithRegex) return true; tr1::wregex pat; - return ValidateRegexp(string, pat, false); + return m_LogList.ValidateRegexp(string, pat, false); } -void CLogDlg::RecalculateShownList(CPtrArray * pShownlist) -{ -#if 0 - pShownlist->RemoveAll(); - tr1::wregex pat;//(_T("Remove"), tr1::regex_constants::icase); - bool bRegex = false; - if (m_bFilterWithRegex) - bRegex = ValidateRegexp(m_sFilterText, pat, false); - - tr1::regex_constants::match_flag_type flags = tr1::regex_constants::match_any; - CString sRev; - for (DWORD i=0; isBugIDs); - if (regex_search(wstring((LPCTSTR)m_logEntries[i]->sBugIDs), pat, flags)&&IsEntryInDateRange(i)) - { - pShownlist->Add(m_logEntries[i]); - continue; - } - } - if ((m_nSelectedFilter == LOGFILTER_ALL)||(m_nSelectedFilter == LOGFILTER_MESSAGES)) - { - ATLTRACE(_T("messge = \"%s\"\n"), (LPCTSTR)m_logEntries[i]->sMessage); - if (regex_search(wstring((LPCTSTR)m_logEntries[i]->sMessage), pat, flags)&&IsEntryInDateRange(i)) - { - pShownlist->Add(m_logEntries[i]); - continue; - } - } - if ((m_nSelectedFilter == LOGFILTER_ALL)||(m_nSelectedFilter == LOGFILTER_PATHS)) - { - LogChangedPathArray * cpatharray = m_logEntries[i]->pArChangedPaths; - - bool bGoing = true; - for (INT_PTR cpPathIndex = 0; cpPathIndexGetCount() && bGoing; ++cpPathIndex) - { - LogChangedPath * cpath = cpatharray->GetAt(cpPathIndex); - if (regex_search(wstring((LPCTSTR)cpath->sCopyFromPath), pat, flags)&&IsEntryInDateRange(i)) - { - pShownlist->Add(m_logEntries[i]); - bGoing = false; - continue; - } - if (regex_search(wstring((LPCTSTR)cpath->sPath), pat, flags)&&IsEntryInDateRange(i)) - { - pShownlist->Add(m_logEntries[i]); - bGoing = false; - continue; - } - if (regex_search(wstring((LPCTSTR)cpath->GetAction()), pat, flags)&&IsEntryInDateRange(i)) - { - pShownlist->Add(m_logEntries[i]); - bGoing = false; - continue; - } - } - if (!bGoing) - continue; - } - if ((m_nSelectedFilter == LOGFILTER_ALL)||(m_nSelectedFilter == LOGFILTER_AUTHORS)) - { - if (regex_search(wstring((LPCTSTR)m_logEntries[i]->sAuthor), pat, flags)&&IsEntryInDateRange(i)) - { - pShownlist->Add(m_logEntries[i]); - continue; - } - } - if ((m_nSelectedFilter == LOGFILTER_ALL)||(m_nSelectedFilter == LOGFILTER_REVS)) - { - sRev.Format(_T("%ld"), m_logEntries[i]->Rev); - if (regex_search(wstring((LPCTSTR)sRev), pat, flags)&&IsEntryInDateRange(i)) - { - pShownlist->Add(m_logEntries[i]); - continue; - } - } - } // if (bRegex) - else - { - CString find = m_sFilterText; - find.MakeLower(); - if ((m_nSelectedFilter == LOGFILTER_ALL)||(m_nSelectedFilter == LOGFILTER_BUGID)) - { - CString sBugIDs = m_logEntries[i]->sBugIDs; - - sBugIDs = sBugIDs.MakeLower(); - if ((sBugIDs.Find(find) >= 0)&&(IsEntryInDateRange(i))) - { - pShownlist->Add(m_logEntries[i]); - continue; - } - } - if ((m_nSelectedFilter == LOGFILTER_ALL)||(m_nSelectedFilter == LOGFILTER_MESSAGES)) - { - CString msg = m_logEntries[i]->sMessage; - - msg = msg.MakeLower(); - if ((msg.Find(find) >= 0)&&(IsEntryInDateRange(i))) - { - pShownlist->Add(m_logEntries[i]); - continue; - } - } - if ((m_nSelectedFilter == LOGFILTER_ALL)||(m_nSelectedFilter == LOGFILTER_PATHS)) - { - LogChangedPathArray * cpatharray = m_logEntries[i]->pArChangedPaths; - - bool bGoing = true; - for (INT_PTR cpPathIndex = 0; cpPathIndexGetCount() && bGoing; ++cpPathIndex) - { - LogChangedPath * cpath = cpatharray->GetAt(cpPathIndex); - CString path = cpath->sCopyFromPath; - path.MakeLower(); - if ((path.Find(find)>=0)&&(IsEntryInDateRange(i))) - { - pShownlist->Add(m_logEntries[i]); - bGoing = false; - continue; - } - path = cpath->sPath; - path.MakeLower(); - if ((path.Find(find)>=0)&&(IsEntryInDateRange(i))) - { - pShownlist->Add(m_logEntries[i]); - bGoing = false; - continue; - } - path = cpath->GetAction(); - path.MakeLower(); - if ((path.Find(find)>=0)&&(IsEntryInDateRange(i))) - { - pShownlist->Add(m_logEntries[i]); - bGoing = false; - continue; - } - } - } - if ((m_nSelectedFilter == LOGFILTER_ALL)||(m_nSelectedFilter == LOGFILTER_AUTHORS)) - { - CString msg = m_logEntries[i]->sAuthor; - msg = msg.MakeLower(); - if ((msg.Find(find) >= 0)&&(IsEntryInDateRange(i))) - { - pShownlist->Add(m_logEntries[i]); - continue; - } - } - if ((m_nSelectedFilter == LOGFILTER_ALL)||(m_nSelectedFilter == LOGFILTER_REVS)) - { - sRev.Format(_T("%ld"), m_logEntries[i]->Rev); - if ((sRev.Find(find) >= 0)&&(IsEntryInDateRange(i))) - { - pShownlist->Add(m_logEntries[i]); - continue; - } - } - } // else (from if (bRegex)) - } // for (DWORD i=0; iIsThreadRunning()) { // thread still running! So just restart the timer. SetTimer(LOGFILTER_TIMER, 1000, NULL); @@ -3035,9 +2387,9 @@ void CLogDlg::OnTimer(UINT_PTR nIDEvent) CWnd * focusWnd = GetFocus(); bool bSetFocusToFilterControl = ((focusWnd != GetDlgItem(IDC_DATEFROM))&&(focusWnd != GetDlgItem(IDC_DATETO)) && (focusWnd != GetDlgItem(IDC_LOGLIST))); - if (m_sFilterText.IsEmpty()) + if (m_LogList.m_sFilterText.IsEmpty()) { - DialogEnableWindow(IDC_STATBUTTON, !(((m_bThreadRunning)||(m_arShownList.IsEmpty())))); + DialogEnableWindow(IDC_STATBUTTON, !(((this->IsThreadRunning())||(m_LogList.m_arShownList.IsEmpty())))); // do not return here! // we also need to run the filter if the filter text is empty: // 1. to clear an existing filter @@ -3049,18 +2401,8 @@ void CLogDlg::OnTimer(UINT_PTR nIDEvent) FillLogMessageCtrl(false); // now start filter the log list - InterlockedExchange(&m_bNoDispUpdates, TRUE); - RecalculateShownList(&m_arShownList); - InterlockedExchange(&m_bNoDispUpdates, FALSE); - + m_LogList.StartFilter(); - m_LogList.DeleteAllItems(); - m_LogList.SetItemCountEx(m_LogList.ShownCountWithStopped()); - m_LogList.RedrawItems(0, m_LogList.ShownCountWithStopped()); - m_LogList.SetRedraw(false); - m_LogList.ResizeAllListCtrlCols(); - m_LogList.SetRedraw(true); - m_LogList.Invalidate(); if ( m_LogList.GetItemCount()==1 ) { m_LogList.SetSelectionMark(0); @@ -3073,7 +2415,7 @@ void CLogDlg::OnTimer(UINT_PTR nIDEvent) GetDlgItem(IDC_SEARCHEDIT)->SetFocus(); UpdateLogInfoLabel(); } // if (nIDEvent == LOGFILTER_TIMER) - DialogEnableWindow(IDC_STATBUTTON, !(((m_bThreadRunning)||(m_arShownList.IsEmpty())))); + DialogEnableWindow(IDC_STATBUTTON, !(((this->IsThreadRunning())||(m_LogList.m_arShownList.IsEmpty())))); __super::OnTimer(nIDEvent); } @@ -3084,9 +2426,9 @@ void CLogDlg::OnDtnDatetimechangeDateto(NMHDR * /*pNMHDR*/, LRESULT *pResult) try { CTime time(_time.GetYear(), _time.GetMonth(), _time.GetDay(), 23, 59, 59); - if (time.GetTime() != m_tTo) + if (time.GetTime() != m_LogList.m_To.GetTime()) { - m_tTo = (DWORD)time.GetTime(); + m_LogList.m_To = (DWORD)time.GetTime(); SetTimer(LOGFILTER_TIMER, 10, NULL); } } @@ -3104,9 +2446,9 @@ void CLogDlg::OnDtnDatetimechangeDatefrom(NMHDR * /*pNMHDR*/, LRESULT *pResult) try { CTime time(_time.GetYear(), _time.GetMonth(), _time.GetDay(), 0, 0, 0); - if (time.GetTime() != m_tFrom) + if (time.GetTime() != m_LogList.m_From.GetTime()) { - m_tFrom = (DWORD)time.GetTime(); + m_LogList.m_From = (DWORD)time.GetTime(); SetTimer(LOGFILTER_TIMER, 10, NULL); } } @@ -3117,16 +2459,7 @@ void CLogDlg::OnDtnDatetimechangeDatefrom(NMHDR * /*pNMHDR*/, LRESULT *pResult) *pResult = 0; } -BOOL CLogDlg::IsEntryInDateRange(int i) -{ -#if 0 - __time64_t time = m_logEntries[i]->tmDate; - if ((time >= m_tFrom)&&(time <= m_tTo)) - return TRUE; -#endif - return FALSE; -} CTGitPathList CLogDlg::GetChangedPathsFromSelectedRevisions(bool bRelativePaths /* = false */, bool bUseFilter /* = true */) { @@ -3236,7 +2569,7 @@ void CLogDlg::SortByColumn(int nSortColumn, bool bAscending) void CLogDlg::OnLvnColumnclick(NMHDR *pNMHDR, LRESULT *pResult) { - if (m_bThreadRunning) + if (this->IsThreadRunning()) return; //no sorting while the arrays are filled LPNMLISTVIEW pNMLV = reinterpret_cast(pNMHDR); const int nColumn = pNMLV->iSubItem; @@ -3296,7 +2629,8 @@ void CLogDlg::SetSortArrow(CListCtrl * control, int nColumn, bool bAscending) } void CLogDlg::OnLvnColumnclickChangedFileList(NMHDR *pNMHDR, LRESULT *pResult) { - if (m_bThreadRunning) +#if 0 + if (this->IsThreadRunning()) return; //no sorting while the arrays are filled if (m_currentChangedArray == NULL) return; @@ -3309,6 +2643,7 @@ void CLogDlg::OnLvnColumnclickChangedFileList(NMHDR *pNMHDR, LRESULT *pResult) SetSortArrow(&m_ChangedFileListCtrl, m_nSortColumnPathList, m_bAscendingPathList); m_ChangedFileListCtrl.Invalidate(); *pResult = 0; +#endif } int CLogDlg::m_nSortColumnPathList = 0; @@ -3470,25 +2805,26 @@ void CLogDlg::OnBnClickedIncludemerge() void CLogDlg::UpdateLogInfoLabel() { -#if 0 - git_revnum_t rev1 = 0; - git_revnum_t rev2 = 0; + + git_revnum_t rev1 ; + git_revnum_t rev2 ; long selectedrevs = 0; - if (m_arShownList.GetCount()) + int count =m_LogList.m_arShownList.GetCount(); + if (count) { - PLOGENTRYDATA pLogEntry = reinterpret_cast(m_arShownList.GetAt(0)); - rev1 = pLogEntry->Rev; - pLogEntry = reinterpret_cast(m_arShownList.GetAt(m_arShownList.GetCount()-1)); - rev2 = pLogEntry->Rev; + rev1 = (reinterpret_cast(m_LogList.m_arShownList.GetAt(0)))->m_CommitHash; + //pLogEntry = reinterpret_cast(m_arShownList.GetAt(m_arShownList.GetCount()-1)); + rev2 = (reinterpret_cast(m_LogList.m_arShownList.GetAt(count-1)))->m_CommitHash; selectedrevs = m_LogList.GetSelectedCount(); } CString sTemp; - sTemp.Format(IDS_LOG_LOGINFOSTRING, m_arShownList.GetCount(), rev2, rev1, selectedrevs); + sTemp.Format(_T("Showing %ld revision(s), from revision %s to revision %s - %ld revision(s) selected"), count, rev2.Left(6), rev1.Left(6), selectedrevs); m_sLogInfo = sTemp; -#endif + UpdateData(FALSE); } +#if 0 void CLogDlg::ShowContextMenuForChangedpaths(CWnd* /*pWnd*/, CPoint point) { @@ -3513,9 +2849,9 @@ void CLogDlg::ShowContextMenuForChangedpaths(CWnd* /*pWnd*/, CPoint point) bool bOneRev = true; int sel=m_LogList.GetNextSelectedItem(pos); - GitRev * pLogEntry = reinterpret_cast(m_arShownList.GetAt(sel)); + GitRev * pLogEntry = reinterpret_cast(m_LogList.m_arShownList.GetAt(sel)); GitRev * rev1 = pLogEntry; - GitRev * rev2 = reinterpret_cast(m_arShownList.GetAt(sel+1)); + GitRev * rev2 = reinterpret_cast(m_LogList.m_arShownList.GetAt(sel+1)); #if 0 bool bOneRev = true; if (pos) @@ -4024,6 +3360,7 @@ void CLogDlg::ShowContextMenuForChangedpaths(CWnd* /*pWnd*/, CPoint point) } // if (popup.CreatePopupMenu()) } +#endif void CLogDlg::OnDtnDropdownDatefrom(NMHDR * /*pNMHDR*/, LRESULT *pResult) { @@ -4115,35 +3452,43 @@ CString CLogDlg::GetAbsoluteUrlFromRelativeUrl(const CString& url) } -int CLogDataVector::ParserFromLog() +void CLogDlg::OnEnChangeSearchedit() { - CString log; - GitRev rev; - g_Git.GetLog(log); - - CString begin; - begin.Format(_T("#<%c>"),LOG_REV_ITEM_BEGIN); - - if(log.GetLength()==0) - return 0; - - int start=4; - int length; - int next =1; - while( next>0 ) + UpdateData(); + if (m_LogList.m_sFilterText.IsEmpty()) { - next=log.Find(begin,start); - if(next >0 ) - length = next - start+4; - else - length = log.GetLength()-start+4; - - CString onelog =log; - onelog=log.Mid(start -4,length); - rev.ParserFromLog(onelog); - this->push_back(rev); - start = next +4; + CStoreSelection storeselection(this); + // clear the filter, i.e. make all entries appear + theApp.DoWaitCursor(1); + KillTimer(LOGFILTER_TIMER); + FillLogMessageCtrl(false); + m_LogList.StartFilter(); +#if 0 + InterlockedExchange(&m_bNoDispUpdates, TRUE); + m_arShownList.RemoveAll(); + for (DWORD i=0; iShowWindow(SW_HIDE); + GetDlgItem(IDC_SEARCHEDIT)->ShowWindow(SW_SHOW); + GetDlgItem(IDC_SEARCHEDIT)->SetFocus(); + DialogEnableWindow(IDC_STATBUTTON, !(((this->IsThreadRunning())||(m_LogList.m_arShownList.IsEmpty())))); + return; } + if (Validate(m_LogList.m_sFilterText)) + SetTimer(LOGFILTER_TIMER, 1000, NULL); + else + KillTimer(LOGFILTER_TIMER); - return 0; -} +} \ No newline at end of file