OSDN Git Service

Log Filter From To Time Work
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / GitLogList.cpp
index 22b5b9d..0649b43 100644 (file)
@@ -80,6 +80,9 @@ CGitLogList::CGitLogList():CHintListCtrl()
        m_bFilterWithRegex = !!CRegDWORD(_T("Software\\TortoiseGit\\UseRegexFilter"), TRUE);\r
 \r
        g_Git.GetMapHashToFriendName(m_HashMap);\r
        m_bFilterWithRegex = !!CRegDWORD(_T("Software\\TortoiseGit\\UseRegexFilter"), TRUE);\r
 \r
        g_Git.GetMapHashToFriendName(m_HashMap);\r
+\r
+       m_From=CTime(1970,1,2,0,0,0);\r
+       m_To=CTime::GetCurrentTime();\r
 }\r
 \r
 CGitLogList::~CGitLogList()\r
 }\r
 \r
 CGitLogList::~CGitLogList()\r
@@ -261,10 +264,6 @@ void CGitLogList::ResizeAllListCtrlCols()
 \r
 }\r
 \r
 \r
 }\r
 \r
-void Refresh()\r
-{\r
-       \r
-}\r
 \r
 BOOL CGitLogList::GetShortName(CString ref, CString &shortname,CString prefix)\r
 {\r
 \r
 BOOL CGitLogList::GetShortName(CString ref, CString &shortname,CString prefix)\r
 {\r
@@ -1806,6 +1805,21 @@ UINT CGitLogList::LogThreadEntry(LPVOID pVoid)
        return ((CGitLogList*)pVoid)->LogThread();\r
 }\r
 \r
        return ((CGitLogList*)pVoid)->LogThread();\r
 }\r
 \r
+void CGitLogList::GetTimeRange(CTime &oldest, CTime &latest)\r
+{\r
+       //CTime time;\r
+       oldest=CTime::GetCurrentTime();\r
+       latest=CTime(1971,1,2,0,0,0);\r
+       for(int i=0;i<m_logEntries.size();i++)\r
+       {\r
+               if(m_logEntries[i].m_AuthorDate.GetTime() < oldest.GetTime())\r
+                       oldest = m_logEntries[i].m_AuthorDate.GetTime();\r
+\r
+               if(m_logEntries[i].m_AuthorDate.GetTime() > latest.GetTime())\r
+                       latest = m_logEntries[i].m_AuthorDate.GetTime();\r
+\r
+       }\r
+}\r
 \r
 UINT CGitLogList::LogThread()\r
 {\r
 \r
 UINT CGitLogList::LogThread()\r
 {\r
@@ -1906,6 +1920,9 @@ void CGitLogList::Refresh()
                        InterlockedExchange(&m_bNoDispUpdates, FALSE);\r
                        CMessageBox::Show(NULL, IDS_ERR_THREADSTARTFAILED, IDS_APPNAME, MB_OK | MB_ICONERROR);\r
                }\r
                        InterlockedExchange(&m_bNoDispUpdates, FALSE);\r
                        CMessageBox::Show(NULL, IDS_ERR_THREADSTARTFAILED, IDS_APPNAME, MB_OK | MB_ICONERROR);\r
                }\r
+               m_sFilterText.Empty();\r
+               m_From=CTime(1970,1,2,0,0,0);\r
+               m_To=CTime::GetCurrentTime();\r
        }\r
 }\r
 bool CGitLogList::ValidateRegexp(LPCTSTR regexp_str, tr1::wregex& pat, bool bMatchCase /* = false */)\r
        }\r
 }\r
 bool CGitLogList::ValidateRegexp(LPCTSTR regexp_str, tr1::wregex& pat, bool bMatchCase /* = false */)\r
@@ -2112,15 +2129,13 @@ void CGitLogList::RecalculateShownList(CPtrArray * pShownlist)
 \r
 BOOL CGitLogList::IsEntryInDateRange(int i)\r
 {\r
 \r
 BOOL CGitLogList::IsEntryInDateRange(int i)\r
 {\r
-#if 0\r
-       __time64_t time = m_logEntries[i]->tmDate;\r
-       if ((time >= m_tFrom)&&(time <= m_tTo))\r
+       __time64_t time = m_logEntries[i].m_AuthorDate.GetTime();\r
+       if ((time >= m_From.GetTime())&&(time <= m_To.GetTime()))\r
                return TRUE;\r
 \r
        return FALSE;\r
 \r
                return TRUE;\r
 \r
        return FALSE;\r
 \r
-#endif;\r
-       return TRUE;\r
+//     return TRUE;\r
 }\r
 void CGitLogList::StartFilter()\r
 {\r
 }\r
 void CGitLogList::StartFilter()\r
 {\r
@@ -2133,7 +2148,7 @@ void CGitLogList::StartFilter()
        SetItemCountEx(ShownCountWithStopped());\r
        RedrawItems(0, ShownCountWithStopped());\r
        SetRedraw(false);\r
        SetItemCountEx(ShownCountWithStopped());\r
        RedrawItems(0, ShownCountWithStopped());\r
        SetRedraw(false);\r
-       ResizeAllListCtrlCols();\r
+       //ResizeAllListCtrlCols();\r
        SetRedraw(true);\r
        Invalidate();\r
 }\r
        SetRedraw(true);\r
        Invalidate();\r
 }\r