OSDN Git Service

Fix open second file log list error
authorFrank Li <lznuaa@gmail.com>
Tue, 13 Jan 2009 13:52:01 +0000 (21:52 +0800)
committerFrank Li <lznuaa@gmail.com>
Tue, 13 Jan 2009 13:52:01 +0000 (21:52 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/TortoiseGitBlame/OutputWnd.cpp
src/TortoiseGitBlame/TortoiseGitBlameView.cpp
src/TortoiseGitBlame/TortoiseGitBlameView.h
src/TortoiseProc/GitLogListBase.cpp
src/TortoiseProc/GitLogListBase.h
src/TortoiseProc/TortoiseProc.vcproj

index 223180e..9ae92c1 100644 (file)
@@ -169,8 +169,9 @@ int COutputWnd::LoadHistory(CString filename)
        m_LogList.ReloadHashMap();\r
        CTGitPath path;\r
        path.SetFromWin(filename);\r
        m_LogList.ReloadHashMap();\r
        CTGitPath path;\r
        path.SetFromWin(filename);\r
-\r
-       m_LogList.FillGitLog(&path,CGit::LOG_INFO_FULLHISTORY);\r
+       \r
+       m_LogList.Clear();\r
+       m_LogList.FillGitLog(&path,0/*CGit::LOG_INFO_FULLHISTORY*/);\r
 \r
        return 0;\r
 \r
 \r
        return 0;\r
 \r
index d08a359..45adf2b 100644 (file)
@@ -65,7 +65,7 @@ CTortoiseGitBlameView::CTortoiseGitBlameView()
 \r
        m_font = 0;\r
        m_italicfont = 0;\r
 \r
        m_font = 0;\r
        m_italicfont = 0;\r
-       m_blamewidth = 100;\r
+       m_blamewidth = 0;\r
        m_revwidth = 0;\r
        m_datewidth = 0;\r
        m_authorwidth = 0;\r
        m_revwidth = 0;\r
        m_datewidth = 0;\r
        m_authorwidth = 0;\r
@@ -92,6 +92,9 @@ CTortoiseGitBlameView::CTortoiseGitBlameView()
        m_colorage = true;\r
 \r
        m_bShowLine=true;\r
        m_colorage = true;\r
 \r
        m_bShowLine=true;\r
+\r
+       m_bShowAuthor=true;\r
+       m_bShowDate=false;\r
 }\r
 \r
 CTortoiseGitBlameView::~CTortoiseGitBlameView()\r
 }\r
 \r
 CTortoiseGitBlameView::~CTortoiseGitBlameView()\r
@@ -1002,38 +1005,58 @@ void CTortoiseGitBlameView::GotoLineDlg()
 \r
 LONG CTortoiseGitBlameView::GetBlameWidth()\r
 {\r
 \r
 LONG CTortoiseGitBlameView::GetBlameWidth()\r
 {\r
-#if 0\r
-       if (m_blamewidth)\r
-               return m_blamewidth;\r
        LONG blamewidth = 0;\r
        SIZE width;\r
        CreateFont();\r
        LONG blamewidth = 0;\r
        SIZE width;\r
        CreateFont();\r
-       HDC hDC = ::GetDC(wBlame);\r
+       HDC hDC = this->GetDC()->m_hDC;\r
        HFONT oldfont = (HFONT)::SelectObject(hDC, m_font);\r
        HFONT oldfont = (HFONT)::SelectObject(hDC, m_font);\r
+       \r
        TCHAR buf[MAX_PATH];\r
        TCHAR buf[MAX_PATH];\r
-       _stprintf_s(buf, MAX_PATH, _T("%8ld "), 88888888);\r
+       //_stprintf_s(buf, MAX_PATH, _T("%8ld "), 88888888);\r
+       //::GetTextExtentPoint(hDC, buf, _tcslen(buf), &width);\r
+       //m_revwidth = width.cx + BLAMESPACE;\r
+       //blamewidth += m_revwidth;\r
+\r
+       int maxnum=0;\r
+       for (int i=0;i<this->m_Authors.size();i++)\r
+       {\r
+               if(m_ID[i]>maxnum)\r
+                       maxnum=m_ID[i];\r
+       }\r
+       _stprintf_s(buf, MAX_PATH, _T("%d."), maxnum);\r
        ::GetTextExtentPoint(hDC, buf, _tcslen(buf), &width);\r
        m_revwidth = width.cx + BLAMESPACE;\r
        blamewidth += m_revwidth;\r
        ::GetTextExtentPoint(hDC, buf, _tcslen(buf), &width);\r
        m_revwidth = width.cx + BLAMESPACE;\r
        blamewidth += m_revwidth;\r
-       if (ShowDate)\r
+\r
+#if 0\r
+       _stprintf_s(buf, MAX_PATH, _T("%d"), m_CommitHash.size());\r
+       ::GetTextExtentPoint(hDC, buf, _tcslen(buf), &width);\r
+       m_linewidth = width.cx + BLAMESPACE;\r
+       blamewidth += m_revwidth;\r
+#endif \r
+\r
+       if (m_bShowDate)\r
        {\r
                _stprintf_s(buf, MAX_PATH, _T("%30s"), _T("31.08.2001 06:24:14"));\r
                ::GetTextExtentPoint32(hDC, buf, _tcslen(buf), &width);\r
                m_datewidth = width.cx + BLAMESPACE;\r
                blamewidth += m_datewidth;\r
        }\r
        {\r
                _stprintf_s(buf, MAX_PATH, _T("%30s"), _T("31.08.2001 06:24:14"));\r
                ::GetTextExtentPoint32(hDC, buf, _tcslen(buf), &width);\r
                m_datewidth = width.cx + BLAMESPACE;\r
                blamewidth += m_datewidth;\r
        }\r
-       if (ShowAuthor)\r
+       if ( m_bShowAuthor)\r
        {\r
                SIZE maxwidth = {0};\r
        {\r
                SIZE maxwidth = {0};\r
-               for (std::vector<CString>::iterator I = authors.begin(); I != authors.end(); ++I)\r
+\r
+               for (int i=0;i<this->m_Authors.size();i++)\r
+               //for (std::vector<CString>::iterator I = authors.begin(); I != authors.end(); ++I)\r
                {\r
                {\r
-                       ::GetTextExtentPoint32(hDC, I->c_str(), I->size(), &width);\r
+                       ::GetTextExtentPoint32(hDC,m_Authors[i] , m_Authors[i].GetLength(), &width);\r
                        if (width.cx > maxwidth.cx)\r
                                maxwidth = width;\r
                }\r
                m_authorwidth = maxwidth.cx + BLAMESPACE;\r
                blamewidth += m_authorwidth;\r
        }\r
                        if (width.cx > maxwidth.cx)\r
                                maxwidth = width;\r
                }\r
                m_authorwidth = maxwidth.cx + BLAMESPACE;\r
                blamewidth += m_authorwidth;\r
        }\r
+#if 0\r
        if (ShowPath)\r
        {\r
                SIZE maxwidth = {0};\r
        if (ShowPath)\r
        {\r
                SIZE maxwidth = {0};\r
@@ -1046,14 +1069,16 @@ LONG CTortoiseGitBlameView::GetBlameWidth()
                m_pathwidth = maxwidth.cx + BLAMESPACE;\r
                blamewidth += m_pathwidth;\r
        }\r
                m_pathwidth = maxwidth.cx + BLAMESPACE;\r
                blamewidth += m_pathwidth;\r
        }\r
+#endif\r
        ::SelectObject(hDC, oldfont);\r
        POINT pt = {blamewidth, 0};\r
        LPtoDP(hDC, &pt, 1);\r
        m_blamewidth = pt.x;\r
        ::SelectObject(hDC, oldfont);\r
        POINT pt = {blamewidth, 0};\r
        LPtoDP(hDC, &pt, 1);\r
        m_blamewidth = pt.x;\r
-       ReleaseDC(wBlame, hDC);\r
-#endif\r
+       //::ReleaseDC(wBlame, hDC);\r
+\r
        //return m_blamewidth;\r
        //return m_blamewidth;\r
-       return 100;\r
+       return blamewidth;\r
+\r
 }\r
 \r
 void CTortoiseGitBlameView::CreateFont()\r
 }\r
 \r
 void CTortoiseGitBlameView::CreateFont()\r
@@ -1125,7 +1150,7 @@ void CTortoiseGitBlameView::DrawBlame(HDC hDC)
                        //}\r
 \r
                        CString str;\r
                        //}\r
 \r
                        CString str;\r
-                       str.Format(_T("%d.%s"),m_ID[i],m_Authors[i]);\r
+                       str.Format(_T("%d"),m_ID[i]);\r
 \r
                        //_stprintf_s(buf, MAX_PATH, _T("%8ld       "), revs[i]);\r
                        rc.top=Y;\r
 \r
                        //_stprintf_s(buf, MAX_PATH, _T("%8ld       "), revs[i]);\r
                        rc.top=Y;\r
@@ -1134,6 +1159,14 @@ void CTortoiseGitBlameView::DrawBlame(HDC hDC)
                        rc.right = rc.left + m_blamewidth;\r
                        ::ExtTextOut(hDC, LOCATOR_WIDTH, Y, ETO_CLIPPED, &rc, str, str.GetLength(), 0);\r
                        int Left = m_revwidth;\r
                        rc.right = rc.left + m_blamewidth;\r
                        ::ExtTextOut(hDC, LOCATOR_WIDTH, Y, ETO_CLIPPED, &rc, str, str.GetLength(), 0);\r
                        int Left = m_revwidth;\r
+                       \r
+                       if (m_bShowAuthor)\r
+                       {\r
+                               rc.right = rc.left + Left + m_authorwidth;\r
+                               //_stprintf_s(buf, MAX_PATH, _T("%-30s            "), authors[i].c_str());\r
+                               ::ExtTextOut(hDC, Left, Y, ETO_CLIPPED, &rc, m_Authors[i], m_Authors[i].GetLength(), 0);\r
+                               Left += m_authorwidth;\r
+                       }\r
 #if 0\r
                        if (ShowDate)\r
                        {\r
 #if 0\r
                        if (ShowDate)\r
                        {\r
@@ -1142,13 +1175,7 @@ void CTortoiseGitBlameView::DrawBlame(HDC hDC)
                                ::ExtTextOut(hDC, Left, Y, ETO_CLIPPED, &rc, buf, _tcslen(buf), 0);\r
                                Left += m_datewidth;\r
                        }\r
                                ::ExtTextOut(hDC, Left, Y, ETO_CLIPPED, &rc, buf, _tcslen(buf), 0);\r
                                Left += m_datewidth;\r
                        }\r
-                       if (ShowAuthor)\r
-                       {\r
-                               rc.right = rc.left + Left + m_authorwidth;\r
-                               _stprintf_s(buf, MAX_PATH, _T("%-30s            "), authors[i].c_str());\r
-                               ::ExtTextOut(hDC, Left, Y, ETO_CLIPPED, &rc, buf, _tcslen(buf), 0);\r
-                               Left += m_authorwidth;\r
-                       }\r
+                       \r
 #endif\r
 #if 0\r
                        if (ShowPath)\r
 #endif\r
 #if 0\r
                        if (ShowPath)\r
@@ -2479,6 +2506,14 @@ void CTortoiseGitBlameView::UpdateInfo()
        m_lowestrev=1;\r
        m_highestrev=this->GetLogData()->size();\r
 \r
        m_lowestrev=1;\r
        m_highestrev=this->GetLogData()->size();\r
 \r
+       GetBlameWidth();\r
+       CRect rect;\r
+       this->GetClientRect(rect);\r
+       //this->m_TextView.GetWindowRect(rect);\r
+       //this->m_TextView.ScreenToClient(rect);\r
+       rect.left=this->m_blamewidth;\r
+       this->m_TextView.MoveWindow(rect);\r
+\r
        this->Invalidate();\r
 }\r
 \r
        this->Invalidate();\r
 }\r
 \r
index afebfb7..bbee267 100644 (file)
@@ -21,7 +21,7 @@ const COLORREF darkBlue = RGB(0, 0, 0x80);
 const COLORREF lightBlue = RGB(0xA6, 0xCA, 0xF0);\r
 const int blockSize = 128 * 1024;\r
 \r
 const COLORREF lightBlue = RGB(0xA6, 0xCA, 0xF0);\r
 const int blockSize = 128 * 1024;\r
 \r
-#define BLAMESPACE 20\r
+#define BLAMESPACE 5\r
 #define HEADER_HEIGHT 18\r
 #define LOCATOR_WIDTH 10\r
 \r
 #define HEADER_HEIGHT 18\r
 #define LOCATOR_WIDTH 10\r
 \r
@@ -102,6 +102,10 @@ public:
        BOOL bIgnoreSpaces;\r
        BOOL bIgnoreAllSpaces;\r
 \r
        BOOL bIgnoreSpaces;\r
        BOOL bIgnoreAllSpaces;\r
 \r
+       BOOL m_bShowAuthor;\r
+       BOOL m_bShowDate;\r
+\r
+\r
        LRESULT SendEditor(UINT Msg, WPARAM wParam=0, LPARAM lParam=0);\r
 \r
        void GetRange(int start, int end, char *text);\r
        LRESULT SendEditor(UINT Msg, WPARAM wParam=0, LPARAM lParam=0);\r
 \r
        void GetRange(int start, int end, char *text);\r
index a45e220..2433d19 100644 (file)
@@ -1788,4 +1788,17 @@ void CGitLogListBase::RemoveFilter()
        SetRedraw(true);\r
 \r
        InterlockedExchange(&m_bNoDispUpdates, FALSE);\r
        SetRedraw(true);\r
 \r
        InterlockedExchange(&m_bNoDispUpdates, FALSE);\r
+}\r
+\r
+void CGitLogListBase::Clear()\r
+{\r
+       m_arShownList.RemoveAll();\r
+       m_logEntries.clear();\r
+       m_logEntries.m_HashMap.clear();\r
+       DeleteAllItems();\r
+       m_logEntries.m_Lns.clear();\r
+\r
+       m_logEntries.m_FirstFreeLane=0;\r
+       m_logEntries.m_Lns.clear();\r
+\r
 }
\ No newline at end of file
 }
\ No newline at end of file
index 9548b9b..c5e6def 100644 (file)
@@ -138,6 +138,7 @@ public:
        CPtrArray                       m_arShownList;\r
        void Refresh();\r
        void RecalculateShownList(CPtrArray * pShownlist);\r
        CPtrArray                       m_arShownList;\r
        void Refresh();\r
        void RecalculateShownList(CPtrArray * pShownlist);\r
+       void Clear();\r
 \r
        int                                     m_nSelectedFilter;\r
        CLogDataVector          m_logEntries;\r
 \r
        int                                     m_nSelectedFilter;\r
        CLogDataVector          m_logEntries;\r
index 5e3421a..5b1c3be 100644 (file)
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\explorer.ico"\r
+                               RelativePath="..\Resources\explorer.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\explorer.ico"\r
+                               RelativePath=".\explorer.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\newfolder.ico"\r
+                               RelativePath="..\Resources\newfolder.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\newfolder.ico"\r
+                               RelativePath=".\newfolder.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\open.ico"\r
+                               RelativePath="..\Resources\open.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\open.ico"\r
+                               RelativePath=".\open.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\save.ico"\r
+                               RelativePath="..\Resources\save.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\save.ico"\r
+                               RelativePath=".\save.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\saveas.ico"\r
+                               RelativePath="..\Resources\saveas.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\saveas.ico"\r
+                               RelativePath=".\saveas.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\up.ico"\r
+                               RelativePath="..\Resources\up.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\up.ico"\r
+                               RelativePath=".\up.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
                                </File>\r
                        </Filter>\r
                        <Filter\r
                                </File>\r
                        </Filter>\r
                        <Filter\r
-                               Name="PrevDiff"\r
-                               >\r
-                               <File\r
-                                       RelativePath=".\Commands\PrevDiffCommand.cpp"\r
-                                       >\r
-                               </File>\r
-                               <File\r
-                                       RelativePath=".\Commands\PrevDiffCommand.h"\r
-                                       >\r
-                               </File>\r
-                       </Filter>\r
-                       <Filter\r
                                Name="Rename"\r
                                >\r
                                <File\r
                                Name="Rename"\r
                                >\r
                                <File\r
                                        >\r
                                </File>\r
                        </Filter>\r
                                        >\r
                                </File>\r
                        </Filter>\r
+                       <Filter\r
+                               Name="PrevDiff"\r
+                               >\r
+                               <File\r
+                                       RelativePath=".\Commands\PrevDiffCommand.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\Commands\PrevDiffCommand.h"\r
+                                       >\r
+                               </File>\r
+                       </Filter>\r
                </Filter>\r
                <Filter\r
                        Name="Utility Dialogs"\r
                </Filter>\r
                <Filter\r
                        Name="Utility Dialogs"\r