OSDN Git Service

Fix Compare with preview version crash problem at log dialog.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / LogDlg.cpp
index b42f96d..e2bb8a1 100644 (file)
@@ -216,7 +216,7 @@ BOOL CLogDlg::OnInitDialog()
        m_LogList.DeleteAllItems();\r
        m_LogList.InsertGitColumn();\r
 \r
-       m_ChangedFileListCtrl.Init(SVNSLC_COLEXT | SVNSLC_COLSTATUS |IDS_STATUSLIST_COLADD|IDS_STATUSLIST_COLDEL , _T("LogDlg"));\r
+       m_ChangedFileListCtrl.Init(SVNSLC_COLEXT | SVNSLC_COLSTATUS |IDS_STATUSLIST_COLADD|IDS_STATUSLIST_COLDEL , _T("LogDlg"),(SVNSLC_POPALL ^ SVNSLC_POPCOMMIT),false);\r
 \r
        GetDlgItem(IDC_LOGLIST)->UpdateData(FALSE);\r
 \r
@@ -337,7 +337,7 @@ BOOL CLogDlg::OnInitDialog()
        // set the choices for the "Show All" button\r
        temp.LoadString(IDS_LOG_SHOWALL);\r
        m_btnShow.AddEntry(temp);\r
-       temp.LoadString(IDS_LOG_SHOWRANGE);\r
+       temp.LoadString(IDS_LOG_SHOW_WHOLE);\r
        m_btnShow.AddEntry(temp);\r
        m_btnShow.SetCurrentEntry((LONG)CRegDWORD(_T("Software\\TortoiseGit\\ShowAllEntry")));\r
 \r
@@ -348,6 +348,7 @@ BOOL CLogDlg::OnInitDialog()
        //m_tTo = 0;\r
        //m_tFrom = (DWORD)-1;\r
 \r
+       m_LogList.m_Path=m_path;\r
        m_LogList.FetchLogAsync(LogCallBack,this);\r
 \r
        GetDlgItem(IDC_LOGLIST)->SetFocus();\r
@@ -375,7 +376,7 @@ void CLogDlg::LogRunStatus(int cur)
 \r
                GetDlgItem(IDC_PROGRESS)->ShowWindow(TRUE);\r
 \r
-               DialogEnableWindow(IDC_GETALL, FALSE);\r
+               //DialogEnableWindow(IDC_GETALL, FALSE);\r
                DialogEnableWindow(IDC_NEXTHUNDRED, FALSE);\r
                DialogEnableWindow(IDC_CHECK_STOPONCOPY, FALSE);\r
                DialogEnableWindow(IDC_INCLUDEMERGE, FALSE);\r
@@ -390,12 +391,12 @@ void CLogDlg::LogRunStatus(int cur)
                if (!m_bShowedAll)\r
                        DialogEnableWindow(IDC_NEXTHUNDRED, TRUE);\r
 \r
-               //DialogEnableWindow(IDC_CHECK_STOPONCOPY, TRUE);\r
+               DialogEnableWindow(IDC_GETALL, TRUE);\r
                //DialogEnableWindow(IDC_INCLUDEMERGE, TRUE);\r
                DialogEnableWindow(IDC_STATBUTTON, TRUE);\r
                DialogEnableWindow(IDC_REFRESH, TRUE);\r
 \r
-               PostMessage(WM_TIMER, LOGFILTER_TIMER);\r
+//             PostMessage(WM_TIMER, LOGFILTER_TIMER);\r
 \r
                //CTime time=m_LogList.GetOldestTime();\r
                CTime begin,end;\r
@@ -426,6 +427,8 @@ void CLogDlg::SetDlgTitle(bool bOffline)
        {\r
                if (m_path.IsUrl())\r
                        SetWindowText(m_sTitle + _T(" - ") + m_path.GetUIPathString());\r
+               else if (m_path.IsEmpty())\r
+                       SetWindowText(m_sTitle + _T(" - ") + CString(_T("Whole Project")));\r
                else if (m_path.IsDirectory())\r
                        SetWindowText(m_sTitle + _T(" - ") + m_path.GetWinPathString());\r
                else\r
@@ -512,19 +515,25 @@ void CLogDlg::FillLogMessageCtrl(bool bShow /* = true*/)
                }\r
                GitRev* pLogEntry = reinterpret_cast<GitRev *>(m_LogList.m_arShownList.GetAt(selIndex));\r
 \r
-               // set the log message text\r
-               pMsgView->SetWindowText(_T("Commit:")+pLogEntry->m_CommitHash+_T("\r\n\r\n*")+pLogEntry->m_Subject+_T("\n\n")+pLogEntry->m_Body);\r
-               // turn bug ID's into links if the bugtraq: properties have been set\r
-               // and we can find a match of those in the log message\r
-               m_ProjectProperties.FindBugID(pLogEntry->m_Body, pMsgView);\r
-               CAppUtils::FormatTextInRichEditControl(pMsgView);\r
+               if(!pLogEntry->m_IsFull)\r
+               {\r
+                       pMsgView->SetWindowText(_T("load ..."));\r
+               }else\r
+               {\r
+                       // set the log message text\r
+                       pMsgView->SetWindowText(_T("Commit:")+pLogEntry->m_CommitHash+_T("\r\n\r\n*")+pLogEntry->m_Subject+_T("\n\n")+pLogEntry->m_Body);\r
+                       // turn bug ID's into links if the bugtraq: properties have been set\r
+                       // and we can find a match of those in the log message\r
+                       m_ProjectProperties.FindBugID(pLogEntry->m_Body, pMsgView);\r
+                       CAppUtils::FormatTextInRichEditControl(pMsgView);\r
 \r
-               m_ChangedFileListCtrl.UpdateWithGitPathList(pLogEntry->m_Files);\r
-               m_ChangedFileListCtrl.m_CurrentVersion=pLogEntry->m_CommitHash;\r
-               m_ChangedFileListCtrl.Show(0);\r
+                       m_ChangedFileListCtrl.UpdateWithGitPathList(pLogEntry->m_Files);\r
+                       m_ChangedFileListCtrl.m_CurrentVersion=pLogEntry->m_CommitHash;\r
+                       m_ChangedFileListCtrl.Show(SVNSLC_SHOWVERSIONED);\r
 \r
-               m_ChangedFileListCtrl.SetRedraw(TRUE);\r
-               return;\r
+                       m_ChangedFileListCtrl.SetRedraw(TRUE);\r
+                       return;\r
+               }\r
 #if 0\r
                // fill in the changed files list control\r
                if ((m_cHidePaths.GetState() & 0x0003)==BST_CHECKED)\r
@@ -555,6 +564,7 @@ void CLogDlg::FillLogMessageCtrl(bool bShow /* = true*/)
        \r
        // redraw the views\r
 //     InterlockedExchange(&m_bNoDispUpdates, FALSE);\r
+#if 0\r
        if (m_currentChangedArray)\r
        {\r
                m_ChangedFileListCtrl.SetItemCountEx(m_currentChangedArray->GetCount());\r
@@ -570,6 +580,7 @@ void CLogDlg::FillLogMessageCtrl(bool bShow /* = true*/)
                m_ChangedFileListCtrl.SetItemCountEx(0);\r
                m_ChangedFileListCtrl.Invalidate();\r
        }\r
+#endif\r
        CAppUtils::ResizeAllListCtrlCols(&m_ChangedFileListCtrl);\r
        // sort according to the settings\r
        if (m_nSortColumnPathList > 0)\r
@@ -587,53 +598,32 @@ void CLogDlg::OnBnClickedGetall()
 \r
 void CLogDlg::GetAll(bool bForceAll /* = false */)\r
 {\r
-#if 0\r
+\r
        // fetch all requested log messages, either the specified range or\r
        // really *all* available log messages.\r
-       UpdateData();\r
+       ///UpdateData();\r
        INT_PTR entry = m_btnShow.GetCurrentEntry();\r
        if (bForceAll)\r
                entry = 0;\r
 \r
        switch (entry)\r
        {\r
-       case 0: // show all\r
-       \r
-               m_endrev = 0;\r
-               m_startrev = m_LogRevision;\r
-               if (m_bStrict)\r
-                       m_bShowedAll = true;\r
-\r
+       case 0: // show all branch;\r
+               m_LogList.m_bAllBranch=true;\r
                break;\r
-       case 1: // show range\r
-               {\r
-\r
-                       // ask for a revision range\r
-                       CRevisionRangeDlg dlg;\r
-                       dlg.SetStartRevision(m_startrev);\r
-                       dlg.SetEndRevision( (m_endrev>=0) ? m_endrev : 0);\r
-                       if (dlg.DoModal()!=IDOK)\r
-                       {\r
-                               return;\r
-                       }\r
-                       m_endrev = dlg.GetEndRevision();\r
-                       m_startrev = dlg.GetStartRevision();\r
-                       if (((m_endrev.IsNumber())&&(m_startrev.IsNumber()))||\r
-                               (m_endrev.IsHead()||m_startrev.IsHead()))\r
-                       {\r
-                               if (((LONG)m_startrev < (LONG)m_endrev)||\r
-                                       (m_endrev.IsHead()))\r
-                               {\r
-                                       git_revnum_t temp = m_startrev;\r
-                                       m_startrev = m_endrev;\r
-                                       m_endrev = temp;\r
-                               }\r
-                       }\r
-                       m_bShowedAll = false;\r
-               }\r
-\r
+       case 1: // show whole project\r
+               m_LogList.m_Path.Reset();\r
+               SetWindowText(m_sTitle + _T(" - "));\r
                break;\r
        }\r
+       //m_LogList.m_bExitThread=TRUE;\r
+       //::WaitForSingleObject(m_LogList.m_LoadingThread->m_hThread,INFINITE);\r
+\r
+       m_LogList.TerminateThread();\r
+       \r
+       m_LogList.Clear();\r
+       m_LogList.FetchLogAsync(LogCallBack,this);\r
+#if 0\r
        m_ChangedFileListCtrl.SetItemCountEx(0);\r
        m_ChangedFileListCtrl.Invalidate();\r
        // We need to create CStoreSelection on the heap or else\r
@@ -760,8 +750,16 @@ void CLogDlg::OnCancel()
        temp2.LoadString(IDS_MSGBOX_CANCEL);\r
        if ((temp.Compare(temp2)==0)||(this->IsThreadRunning()))\r
        {\r
-               m_bCancelled = true;\r
-               return;\r
+               //m_bCancelled = true;\r
+               //return;\r
+               if(m_LogList.m_bThreadRunning)\r
+               {\r
+                       //m_LogList.m_bExitThread=true;\r
+                       //WaitForSingleObject(m_LogList.m_LoadingThread->m_hThread,INFINITE);\r
+                       m_LogList.TerminateThread();\r
+               }\r
+\r
+               //m_LogList.TerminateThread();\r
        }\r
        UpdateData();\r
        if (m_bSaveStrict)\r
@@ -2810,7 +2808,7 @@ void CLogDlg::UpdateLogInfoLabel()
 \r
        git_revnum_t rev1 ;\r
        git_revnum_t rev2 ;\r
-       long selectedrevs ;\r
+       long selectedrevs = 0;\r
        int count =m_LogList.m_arShownList.GetCount();\r
        if (count)\r
        {\r