OSDN Git Service

GitBlame Use command Line argument to open file
[tortoisegit/TortoiseGitJp.git] / src / TortoiseGitBlame / TortoiseGitBlameView.cpp
index e79f41b..c5a6796 100644 (file)
 \r
 #include "TortoiseGitBlameDoc.h"\r
 #include "TortoiseGitBlameView.h"\r
+#include "MainFrm.h"\r
+#include "Balloon.h"\r
+#include "EditGotoDlg.h"\r
 \r
 #ifdef _DEBUG\r
 #define new DEBUG_NEW\r
 #endif\r
 \r
+UINT CTortoiseGitBlameView::m_FindDialogMessage;\r
 \r
 // CTortoiseGitBlameView\r
 \r
@@ -39,10 +43,21 @@ BEGIN_MESSAGE_MAP(CTortoiseGitBlameView, CView)
        ON_COMMAND(ID_FILE_PRINT, &CView::OnFilePrint)\r
        ON_COMMAND(ID_FILE_PRINT_DIRECT, &CView::OnFilePrint)\r
        ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CTortoiseGitBlameView::OnFilePrintPreview)\r
+       ON_COMMAND(ID_EDIT_FIND,OnEditFind)\r
+       ON_COMMAND(ID_EDIT_GOTO,OnEditGoto)\r
        ON_WM_CREATE()\r
        ON_WM_SIZE()\r
+       ON_WM_MOUSEMOVE()\r
+       ON_WM_MOUSEHOVER()\r
+       ON_WM_MOUSELEAVE()\r
+       ON_WM_LBUTTONDOWN()\r
+       ON_WM_RBUTTONDOWN()\r
+       ON_NOTIFY(SCN_PAINTED,0,OnSciPainted)\r
+       ON_NOTIFY(SCN_GETBKCOLOR,0,OnSciGetBkColor)\r
+    ON_REGISTERED_MESSAGE(m_FindDialogMessage,   OnFindDialogMessage)  \r
 END_MESSAGE_MAP()\r
 \r
+\r
 // CTortoiseGitBlameView construction/destruction\r
 \r
 CTortoiseGitBlameView::CTortoiseGitBlameView()\r
@@ -52,12 +67,12 @@ CTortoiseGitBlameView::CTortoiseGitBlameView()
        hResource = 0;\r
        currentDialog = 0;\r
        wMain = 0;\r
-       wEditor = 0;\r
+       m_wEditor = 0;\r
        wLocator = 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
@@ -82,6 +97,14 @@ CTortoiseGitBlameView::CTortoiseGitBlameView()
        m_lowestrev = LONG_MAX;\r
        m_highestrev = 0;\r
        m_colorage = true;\r
+\r
+       m_bShowLine=true;\r
+\r
+       m_bShowAuthor=true;\r
+       m_bShowDate=false;\r
+\r
+    m_FindDialogMessage   =   ::RegisterWindowMessage(FINDMSGSTRING);   \r
+       m_pFindDialog = NULL;\r
 }\r
 \r
 CTortoiseGitBlameView::~CTortoiseGitBlameView()\r
@@ -98,7 +121,7 @@ int CTortoiseGitBlameView::OnCreate(LPCREATESTRUCT lpcs)
 \r
        CRect rect,rect1;\r
        this->GetWindowRect(&rect1);\r
-       rect.left=m_blamewidth;\r
+       rect.left=m_blamewidth+LOCATOR_WIDTH;\r
        rect.right=rect.Width();\r
        rect.top=0;\r
        rect.bottom=rect.Height();\r
@@ -106,8 +129,15 @@ int CTortoiseGitBlameView::OnCreate(LPCREATESTRUCT lpcs)
        m_TextView.Init(0);\r
        m_TextView.ShowWindow( SW_SHOW);\r
        //m_TextView.InsertText(_T("Abdadfasdf"));\r
-        \r
+       m_wEditor = m_TextView.m_hWnd;\r
+       CreateFont();\r
+       InitialiseEditor();\r
+       m_ToolTip.Create(this->GetParent());    \r
+       m_ToolTip.AddTool(this,_T("Test"));\r
+       \r
+       ::AfxGetApp()->GetMainWnd();\r
        return CView::OnCreate(lpcs);\r
+       \r
 }\r
 \r
 void CTortoiseGitBlameView::OnSize(UINT nType,int cx, int cy)\r
@@ -139,6 +169,8 @@ void CTortoiseGitBlameView::OnDraw(CDC* /*pDC*/)
        if (!pDoc)\r
                return;\r
 \r
+       DrawBlame(this->GetDC()->m_hDC);\r
+       DrawLocatorBar(this->GetDC()->m_hDC);\r
        // TODO: add draw code for native data here\r
 }\r
 \r
@@ -250,7 +282,7 @@ LRESULT CTortoiseGitBlameView::SendEditor(UINT Msg, WPARAM wParam, LPARAM lParam
        {\r
                return ((SciFnDirect) m_directFunction)(m_directPointer, Msg, wParam, lParam);\r
        }\r
-       return ::SendMessage(wEditor, Msg, wParam, lParam);     \r
+       return ::SendMessage(m_wEditor, Msg, wParam, lParam);   \r
 }\r
 \r
 void CTortoiseGitBlameView::GetRange(int start, int end, char *text) \r
@@ -260,7 +292,8 @@ void CTortoiseGitBlameView::GetRange(int start, int end, char *text)
        tr.chrg.cpMin = start;\r
        tr.chrg.cpMax = end;\r
        tr.lpstrText = text;\r
-       SendMessage(wEditor, EM_GETTEXTRANGE, 0, reinterpret_cast<LPARAM>(&tr));\r
+\r
+       SendMessage(m_wEditor, EM_GETTEXTRANGE, 0, reinterpret_cast<LPARAM>(&tr));\r
 #endif\r
 }\r
 \r
@@ -348,7 +381,7 @@ BOOL CTortoiseGitBlameView::OpenFile(const char *fileName)
        SendEditor(SCI_SETSAVEPOINT);\r
        SendEditor(SCI_CANCEL);\r
        SendEditor(SCI_SETUNDOCOLLECTION, 0);\r
-       ::ShowWindow(wEditor, SW_HIDE);\r
+       ::ShowWindow(m_wEditor, SW_HIDE);\r
        std::ifstream File;\r
        File.open(fileName);\r
        if (!File.good())\r
@@ -498,7 +531,7 @@ BOOL CTortoiseGitBlameView::OpenFile(const char *fileName)
                SendEditor(SCI_SETCODEPAGE, SC_CP_UTF8);\r
 \r
        SendEditor(SCI_SETUNDOCOLLECTION, 1);\r
-       ::SetFocus(wEditor);\r
+       ::SetFocus(m_wEditor);\r
        SendEditor(EM_EMPTYUNDOBUFFER);\r
        SendEditor(SCI_SETSAVEPOINT);\r
        SendEditor(SCI_GOTOPOS, 0);\r
@@ -507,7 +540,7 @@ BOOL CTortoiseGitBlameView::OpenFile(const char *fileName)
 \r
        //check which lexer to use, depending on the filetype\r
        SetupLexer(fileName);\r
-       ::ShowWindow(wEditor, SW_SHOW);\r
+       ::ShowWindow(m_wEditor, SW_SHOW);\r
        m_blamewidth = 0;\r
        ::InvalidateRect(wMain, NULL, TRUE);\r
        RECT rc;\r
@@ -517,28 +550,32 @@ BOOL CTortoiseGitBlameView::OpenFile(const char *fileName)
        return TRUE;\r
 }\r
 \r
-void CTortoiseGitBlameView::SetAStyle(int style, COLORREF fore, COLORREF back, int size, const char *face) \r
+void CTortoiseGitBlameView::SetAStyle(int style, COLORREF fore, COLORREF back, int size, CString *face) \r
 {\r
        SendEditor(SCI_STYLESETFORE, style, fore);\r
        SendEditor(SCI_STYLESETBACK, style, back);\r
        if (size >= 1)\r
                SendEditor(SCI_STYLESETSIZE, style, size);\r
        if (face) \r
-               SendEditor(SCI_STYLESETFONT, style, reinterpret_cast<LPARAM>(face));\r
+               SendEditor(SCI_STYLESETFONT, style, reinterpret_cast<LPARAM>(this->m_TextView.StringForControl(*face).GetBuffer()));\r
 }\r
 \r
 void CTortoiseGitBlameView::InitialiseEditor() \r
 {\r
-#if 0\r
-       m_directFunction = SendMessage(wEditor, SCI_GETDIRECTFUNCTION, 0, 0);\r
-       m_directPointer = SendMessage(wEditor, SCI_GETDIRECTPOINTER, 0, 0);\r
+\r
+       m_directFunction = ::SendMessage(m_wEditor, SCI_GETDIRECTFUNCTION, 0, 0);\r
+       m_directPointer = ::SendMessage(m_wEditor, SCI_GETDIRECTPOINTER, 0, 0);\r
        // Set up the global default style. These attributes are used wherever no explicit choices are made.\r
-       SetAStyle(STYLE_DEFAULT, black, white, (DWORD)CRegStdWORD(_T("Software\\TortoiseGit\\BlameFontSize"), 10), \r
-               ((stdstring)(CRegStdString(_T("Software\\TortoiseGit\\BlameFontName"), _T("Courier New")))).c_str());\r
+       SetAStyle(STYLE_DEFAULT, \r
+                         black, \r
+                         white, \r
+                       (DWORD)CRegStdWORD(_T("Software\\TortoiseGit\\BlameFontSize"), 10), \r
+                       &CString(((stdstring)CRegStdString(_T("Software\\TortoiseGit\\BlameFontName"), _T("Courier New"))).c_str())\r
+                       );\r
        SendEditor(SCI_SETTABWIDTH, (DWORD)CRegStdWORD(_T("Software\\TortoiseGit\\BlameTabSize"), 4));\r
        SendEditor(SCI_SETREADONLY, TRUE);\r
-       LRESULT pix = SendEditor(SCI_TEXTWIDTH, STYLE_LINENUMBER, (LPARAM)_T("_99999"));\r
-       if (ShowLine)\r
+       LRESULT pix = SendEditor(SCI_TEXTWIDTH, STYLE_LINENUMBER, (LPARAM)this->m_TextView.StringForControl(_T("_99999")).GetBuffer());\r
+       if (m_bShowLine)\r
                SendEditor(SCI_SETMARGINWIDTHN, 0, pix);\r
        else\r
                SendEditor(SCI_SETMARGINWIDTHN, 0);\r
@@ -552,12 +589,14 @@ void CTortoiseGitBlameView::InitialiseEditor()
        SendEditor(SCI_SETCARETFORE, ::GetSysColor(COLOR_WINDOWTEXT));\r
        m_regOldLinesColor = CRegStdWORD(_T("Software\\TortoiseGit\\BlameOldColor"), RGB(230, 230, 255));\r
        m_regNewLinesColor = CRegStdWORD(_T("Software\\TortoiseGit\\BlameNewColor"), RGB(255, 230, 230));\r
-#endif\r
+       \r
+       this->m_TextView.Call(SCI_SETWRAPMODE, SC_WRAP_NONE);\r
+\r
 }\r
 \r
 void CTortoiseGitBlameView::StartSearch()\r
 {\r
-       if (currentDialog)\r
+       if (m_pFindDialog)\r
                return;\r
        bool bCase = false;\r
        // Initialize FINDREPLACE\r
@@ -574,87 +613,53 @@ void CTortoiseGitBlameView::StartSearch()
        currentDialog = FindText(&fr);\r
 }\r
 \r
-bool CTortoiseGitBlameView::DoSearch(LPSTR what, DWORD flags)\r
+bool CTortoiseGitBlameView::DoSearch(CString what, DWORD flags)\r
 {\r
-#if 0\r
-       TCHAR szWhat[80];\r
+\r
+       //char szWhat[80];\r
        int pos = SendEditor(SCI_GETCURRENTPOS);\r
        int line = SendEditor(SCI_LINEFROMPOSITION, pos);\r
        bool bFound = false;\r
        bool bCaseSensitive = !!(flags & FR_MATCHCASE);\r
 \r
-       strcpy_s(szWhat, sizeof(szWhat), what);\r
+       //strcpy_s(szWhat, sizeof(szWhat), what);\r
 \r
        if(!bCaseSensitive)\r
        {\r
-               char *p;\r
-               size_t len = strlen(szWhat);\r
-               for (p = szWhat; p < szWhat + len; p++)\r
-               {\r
-                       if (isupper(*p)&&__isascii(*p))\r
-                               *p = _tolower(*p);\r
-               }\r
+               what=what.MakeLower();\r
        }\r
 \r
-       CString sWhat = CString(szWhat);\r
+       //CString sWhat = CString(szWhat);\r
        \r
-       char buf[20];\r
-       int i=0;\r
-       for (i=line; (i<(int)authors.size())&&(!bFound); ++i)\r
+       //char buf[20];\r
+       //int i=0;\r
+       int i=line;\r
+       do\r
        {\r
                int bufsize = SendEditor(SCI_GETLINE, i);\r
                char * linebuf = new char[bufsize+1];\r
                SecureZeroMemory(linebuf, bufsize+1);\r
                SendEditor(SCI_GETLINE, i, (LPARAM)linebuf);\r
+               CString oneline=this->m_TextView.StringFromControl(linebuf);\r
                if (!bCaseSensitive)\r
                {\r
-                       char *p;\r
-                       for (p = linebuf; p < linebuf + bufsize; p++)\r
-                       {\r
-                               if (isupper(*p)&&__isascii(*p))\r
-                                       *p = _tolower(*p);\r
-                       }\r
+                       oneline=oneline.MakeLower();\r
                }\r
-               _stprintf_s(buf, 20, _T("%ld"), revs[i]);\r
-               if (authors[i].compare(sWhat)==0)\r
-                       bFound = true;\r
-               else if ((!bCaseSensitive)&&(_stricmp(authors[i].c_str(), szWhat)==0))\r
+               //_stprintf_s(buf, 20, _T("%ld"), revs[i]);\r
+               if (this->m_Authors[i].Find(what)>=0)\r
                        bFound = true;\r
-               else if (strcmp(buf, szWhat) == 0)\r
+               else if ((!bCaseSensitive)&&(this->m_Authors[i].MakeLower().Find(what)>=0))\r
                        bFound = true;\r
-               else if (strstr(linebuf, szWhat))\r
+               else if (oneline.Find(what) >=0)\r
                        bFound = true;\r
+               \r
                delete [] linebuf;\r
-       }\r
-       if (!bFound)\r
-       {\r
-               for (i=0; (i<line)&&(!bFound); ++i)\r
-               {\r
-                       int bufsize = SendEditor(SCI_GETLINE, i);\r
-                       char * linebuf = new char[bufsize+1];\r
-                       SecureZeroMemory(linebuf, bufsize+1);\r
-                       SendEditor(SCI_GETLINE, i, (LPARAM)linebuf);\r
-                       if (!bCaseSensitive)\r
-                       {\r
-                               char *p;\r
-                               for (p = linebuf; p < linebuf + bufsize; p++)\r
-                               {\r
-                                       if (isupper(*p)&&__isascii(*p))\r
-                                               *p = _tolower(*p);\r
-                               }\r
-                       }\r
-                       _stprintf_s(buf, 20, _T("%ld"), revs[i]);\r
-                       if (authors[i].compare(sWhat)==0)\r
-                               bFound = true;\r
-                       else if ((!bCaseSensitive)&&(_stricmp(authors[i].c_str(), szWhat)==0))\r
-                               bFound = true;\r
-                       else if (strcmp(buf, szWhat) == 0)\r
-                               bFound = true;\r
-                       else if (strstr(linebuf, szWhat))\r
-                               bFound = true;\r
-                       delete [] linebuf;\r
-               }\r
-       }\r
+\r
+               i++;\r
+               if(i>=m_CommitHash.size())\r
+                       i=0;\r
+       }while(i!=line &&(!bFound));\r
+\r
        if (bFound)\r
        {\r
                GotoLine(i);\r
@@ -666,9 +671,9 @@ bool CTortoiseGitBlameView::DoSearch(LPSTR what, DWORD flags)
        }\r
        else\r
        {\r
-               ::MessageBox(wMain, searchstringnotfound, "CTortoiseGitBlameView", MB_ICONINFORMATION);\r
+               ::MessageBox(wMain, what+_T(" not found"), _T("CTortoiseGitBlameView"), MB_ICONINFORMATION);\r
        }\r
-#endif\r
+\r
        return true;\r
 }\r
 \r
@@ -677,9 +682,9 @@ bool CTortoiseGitBlameView::GotoLine(long line)
        --line;\r
        if (line < 0)\r
                return false;\r
-       if ((unsigned long)line >= authors.size())\r
+       if ((unsigned long)line >= m_CommitHash.size())\r
        {\r
-               line = authors.size()-1;\r
+               line = m_CommitHash.size()-1;\r
        }\r
 \r
        int nCurrentPos = SendEditor(SCI_GETCURRENTPOS);\r
@@ -907,10 +912,10 @@ void CTortoiseGitBlameView::Notify(SCNotification *notification)
 //             InvalidateRect(wLocator, NULL, FALSE);\r
                break;\r
        case SCN_GETBKCOLOR:\r
-               if ((m_colorage)&&(notification->line < (int)revs.size()))\r
-               {\r
-                       notification->lParam = InterColor(DWORD(m_regOldLinesColor), DWORD(m_regNewLinesColor), (revs[notification->line]-m_lowestrev)*100/((m_highestrev-m_lowestrev)+1));\r
-               }\r
+//             if ((m_colorage)&&(notification->line < (int)revs.size()))\r
+//             {\r
+//                     notification->lParam = InterColor(DWORD(m_regOldLinesColor), DWORD(m_regNewLinesColor), (revs[notification->line]-m_lowestrev)*100/((m_highestrev-m_lowestrev)+1));\r
+//             }\r
                break;\r
        }\r
 }\r
@@ -980,38 +985,58 @@ void CTortoiseGitBlameView::GotoLineDlg()
 \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
-       HDC hDC = ::GetDC(wBlame);\r
+       HDC hDC = this->GetDC()->m_hDC;\r
        HFONT oldfont = (HFONT)::SelectObject(hDC, m_font);\r
+       \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
-       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
-       if (ShowAuthor)\r
+       if ( m_bShowAuthor)\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
-                       ::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 0\r
        if (ShowPath)\r
        {\r
                SIZE maxwidth = {0};\r
@@ -1024,14 +1049,16 @@ LONG CTortoiseGitBlameView::GetBlameWidth()
                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
-       ReleaseDC(wBlame, hDC);\r
-#endif\r
+       //::ReleaseDC(wBlame, hDC);\r
+\r
        //return m_blamewidth;\r
-       return 100;\r
+       return blamewidth;\r
+\r
 }\r
 \r
 void CTortoiseGitBlameView::CreateFont()\r
@@ -1052,11 +1079,12 @@ void CTortoiseGitBlameView::CreateFont()
 \r
        ::ReleaseDC(wBlame, hDC);\r
 \r
+       //m_TextView.SetFont(lf.lfFaceName,((DWORD)CRegStdWORD(_T("Software\\TortoiseGit\\BlameFontSize"), 10)));\r
 }\r
 \r
 void CTortoiseGitBlameView::DrawBlame(HDC hDC)\r
 {\r
-#if 0\r
+\r
        if (hDC == NULL)\r
                return;\r
        if (m_font == NULL)\r
@@ -1070,40 +1098,60 @@ void CTortoiseGitBlameView::DrawBlame(HDC hDC)
        TCHAR buf[MAX_PATH];\r
        RECT rc;\r
        BOOL sel = FALSE;\r
-       ::GetClientRect(wBlame, &rc);\r
+       //::GetClientRect(this->m_hWnd, &rc);\r
        for (LRESULT i=line; i<(line+linesonscreen); ++i)\r
        {\r
                sel = FALSE;\r
-               if (i < (int)revs.size())\r
+               if (i < (int)m_CommitHash.size())\r
                {\r
-                       if (mergelines[i])\r
-                               oldfont = (HFONT)::SelectObject(hDC, m_italicfont);\r
-                       else\r
+               //      if (mergelines[i])\r
+               //              oldfont = (HFONT)::SelectObject(hDC, m_italicfont);\r
+               //      else\r
                                oldfont = (HFONT)::SelectObject(hDC, m_font);\r
                        ::SetBkColor(hDC, m_windowcolor);\r
                        ::SetTextColor(hDC, m_textcolor);\r
-                       if (authors[i].GetLength()>0)\r
+                       if (m_CommitHash[i].GetLength()>0)\r
                        {\r
-                               if (authors[i].Compare(m_mouseauthor)==0)\r
-                                       ::SetBkColor(hDC, m_mouseauthorcolor);\r
-                               if (authors[i].Compare(m_selectedauthor)==0)\r
+                               //if (m_CommitHash[i].Compare(m_MouseHash)==0)\r
+                               //      ::SetBkColor(hDC, m_mouseauthorcolor);\r
+                               if (m_CommitHash[i].Compare(m_SelectedHash)==0)\r
                                {\r
                                        ::SetBkColor(hDC, m_selectedauthorcolor);\r
                                        ::SetTextColor(hDC, m_texthighlightcolor);\r
                                        sel = TRUE;\r
                                }\r
                        }\r
-                       if ((revs[i] == m_mouserev)&&(!sel))\r
+\r
+                       if(m_MouseLine == i)\r
                                ::SetBkColor(hDC, m_mouserevcolor);\r
-                       if (revs[i] == m_selectedrev)\r
+\r
+                       //if ((revs[i] == m_mouserev)&&(!sel))\r
+                       //      ::SetBkColor(hDC, m_mouserevcolor);\r
+                       //if (revs[i] == m_selectedrev)\r
+                       //{\r
+                       //      ::SetBkColor(hDC, m_selectedrevcolor);\r
+                       //      ::SetTextColor(hDC, m_texthighlightcolor);\r
+                       //}\r
+\r
+                       CString str;\r
+                       str.Format(_T("%d"),m_ID[i]);\r
+\r
+                       //_stprintf_s(buf, MAX_PATH, _T("%8ld       "), revs[i]);\r
+                       rc.top=Y;\r
+                       rc.left=LOCATOR_WIDTH;          \r
+                       rc.bottom=Y+height;\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
-                               ::SetBkColor(hDC, m_selectedrevcolor);\r
-                               ::SetTextColor(hDC, m_texthighlightcolor);\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
-                       _stprintf_s(buf, MAX_PATH, _T("%8ld       "), revs[i]);\r
-                       rc.right = rc.left + m_revwidth;\r
-                       ::ExtTextOut(hDC, 0, Y, ETO_CLIPPED, &rc, buf, _tcslen(buf), 0);\r
-                       int Left = m_revwidth;\r
+#if 0\r
                        if (ShowDate)\r
                        {\r
                                rc.right = rc.left + Left + m_datewidth;\r
@@ -1111,13 +1159,9 @@ void CTortoiseGitBlameView::DrawBlame(HDC hDC)
                                ::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
                        {\r
                                rc.right = rc.left + Left + m_pathwidth;\r
@@ -1125,7 +1169,8 @@ void CTortoiseGitBlameView::DrawBlame(HDC hDC)
                                ::ExtTextOut(hDC, Left, Y, ETO_CLIPPED, &rc, buf, _tcslen(buf), 0);\r
                                Left += m_authorwidth;\r
                        }\r
-                       if ((i==m_SelectedLine)&&(currentDialog))\r
+#endif\r
+                       if ((i==m_SelectedLine)&&(m_pFindDialog))\r
                        {\r
                                LOGBRUSH brush;\r
                                brush.lbColor = m_textcolor;\r
@@ -1156,7 +1201,6 @@ void CTortoiseGitBlameView::DrawBlame(HDC hDC)
                        Y += height;\r
                }\r
        }\r
-#endif\r
 }\r
 \r
 void CTortoiseGitBlameView::DrawHeader(HDC hDC)\r
@@ -1211,13 +1255,17 @@ void CTortoiseGitBlameView::DrawLocatorBar(HDC hDC)
        COLORREF blackColor = GetSysColor(COLOR_WINDOWTEXT);\r
 \r
        RECT rc;\r
-       ::GetClientRect(wLocator, &rc);\r
+       //::GetClientRect(wLocator, &rc);\r
+       this->GetClientRect(&rc);\r
+\r
+       rc.right=LOCATOR_WIDTH;\r
+\r
        RECT lineRect = rc;\r
        LONG height = rc.bottom-rc.top;\r
        LONG currentLine = 0;\r
 \r
        // draw the colored bar\r
-       for (std::vector<LONG>::const_iterator it = revs.begin(); it != revs.end(); ++it)\r
+       for (std::vector<LONG>::const_iterator it = m_ID.begin(); it != m_ID.end(); ++it)\r
        {\r
                currentLine++;\r
                // get the line color\r
@@ -1228,22 +1276,23 @@ void CTortoiseGitBlameView::DrawLocatorBar(HDC hDC)
                }\r
                SetBkColor(hDC, cr);\r
                lineRect.top = Y;\r
-               lineRect.bottom = (currentLine * height / revs.size());\r
+               lineRect.bottom = (currentLine * height / m_ID.size());\r
                ::ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &lineRect, NULL, 0, NULL);\r
                Y = lineRect.bottom;\r
        }\r
 \r
-       if (revs.size())\r
+       if (m_ID.size())\r
        {\r
                // now draw two lines indicating the scroll position of the source view\r
                SetBkColor(hDC, blackColor);\r
-               lineRect.top = line * height / revs.size();\r
+               lineRect.top = line * height / m_ID.size();\r
                lineRect.bottom = lineRect.top+1;\r
                ::ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &lineRect, NULL, 0, NULL);\r
-               lineRect.top = (line + linesonscreen) * height / revs.size();\r
+               lineRect.top = (line + linesonscreen) * height / m_ID.size();\r
                lineRect.bottom = lineRect.top+1;\r
                ::ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &lineRect, NULL, 0, NULL);\r
        }\r
+\r
 }\r
 \r
 void CTortoiseGitBlameView::StringExpand(LPSTR str)\r
@@ -1614,7 +1663,7 @@ void CTortoiseGitBlameView::InitSize()
                sourcerc.right -= LOCATOR_WIDTH;\r
        }\r
        ::InvalidateRect(wMain, NULL, FALSE);\r
-    ::SetWindowPos(wEditor, 0, sourcerc.left, sourcerc.top, sourcerc.right - sourcerc.left, sourcerc.bottom - sourcerc.top, 0);\r
+    ::SetWindowPos(m_wEditor, 0, sourcerc.left, sourcerc.top, sourcerc.right - sourcerc.left, sourcerc.bottom - sourcerc.top, 0);\r
        ::SetWindowPos(wBlame, 0, blamerc.left, blamerc.top, blamerc.right - blamerc.left, blamerc.bottom - blamerc.top, 0);\r
        if (m_colorage)\r
                ::SetWindowPos(wLocator, 0, 0, blamerc.top, LOCATOR_WIDTH, blamerc.bottom - blamerc.top, SWP_SHOWWINDOW);\r
@@ -1645,7 +1694,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
        switch (message) \r
        {\r
        case WM_CREATE:\r
-               app.wEditor = ::CreateWindow(\r
+               app.m_wEditor = ::CreateWindow(\r
                        "Scintilla",\r
                        "Source",\r
                        WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_CLIPCHILDREN,\r
@@ -1656,8 +1705,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                        app.hResource,\r
                        0);\r
                app.InitialiseEditor();\r
-               ::ShowWindow(app.wEditor, SW_SHOW);\r
-               ::SetFocus(app.wEditor);\r
+               ::ShowWindow(app.m_wEditor, SW_SHOW);\r
+               ::SetFocus(app.m_wEditor);\r
                app.wBlame = ::CreateWindow(\r
                        _T("TortoiseGitBlameViewBlame"), \r
                        _T("blame"), \r
@@ -1725,7 +1774,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
                        wp.length = sizeof(WINDOWPLACEMENT);\r
                        GetWindowPlacement(app.wMain, &wp);\r
                        state = wp.showCmd;\r
-                       ::DestroyWindow(app.wEditor);\r
+                       ::DestroyWindow(app.m_wEditor);\r
                        ::PostQuitMessage(0);\r
                }\r
                return 0;\r
@@ -1874,34 +1923,6 @@ LRESULT CALLBACK WndBlameProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
                // fall through\r
        case WM_LBUTTONDOWN:\r
                {\r
-                       int y = ((int)(short)HIWORD(lParam));\r
-                       LONG_PTR line = app.SendEditor(SCI_GETFIRSTVISIBLELINE);\r
-                       LONG_PTR height = app.SendEditor(SCI_TEXTHEIGHT);\r
-                       line = line + (y/height);\r
-                       if (line < (LONG)app.revs.size())\r
-                       {\r
-                               app.SetSelectedLine(line);\r
-                               if (app.revs[line] != app.m_selectedrev)\r
-                               {\r
-                                       app.m_selectedrev = app.revs[line];\r
-                                       app.m_selectedorigrev = app.origrevs[line];\r
-                                       app.m_selectedauthor = app.authors[line];\r
-                                       app.m_selecteddate = app.dates[line];\r
-                               }\r
-                               else\r
-                               {\r
-                                       app.m_selectedauthor.clear();\r
-                                       app.m_selecteddate.clear();\r
-                                       app.m_selectedrev = -2;\r
-                                       app.m_selectedorigrev = -2;\r
-                               }\r
-                               ::InvalidateRect(app.wBlame, NULL, FALSE);\r
-                       }\r
-                       else\r
-                       {\r
-                               app.SetSelectedLine(-1);\r
-                       }\r
-               }\r
                break;\r
        case WM_SETFOCUS:\r
                ::SetFocus(app.wBlame);\r
@@ -1998,24 +2019,27 @@ LRESULT CALLBACK WndLocatorProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
 }\r
 #endif\r
 \r
-void CTortoiseGitBlameView::SetupLexer(LPCSTR filename)\r
+void CTortoiseGitBlameView::SetupLexer(CString filename)\r
 {\r
-#if 0\r
-       char line[20];\r
-       const char * lineptr = _tcsrchr(filename, '.');\r
 \r
-       if (lineptr)\r
+       TCHAR *line;\r
+       //const char * lineptr = _tcsrchr(filename, '.');\r
+       int start=filename.ReverseFind(_T('.'));\r
+       if (start>0)\r
        {\r
-               _tcscpy_s(line, 20, lineptr+1);\r
-               _tcslwr_s(line, 20);\r
+               //_tcscpy_s(line, 20, lineptr+1);\r
+               //_tcslwr_s(line, 20);\r
+               CString ext=filename.Right(filename.GetLength()-start-1);\r
+               line=ext.GetBuffer();\r
+\r
                if ((_tcscmp(line, _T("py"))==0)||\r
                        (_tcscmp(line, _T("pyw"))==0)||\r
                        (_tcscmp(line, _T("pyw"))==0))\r
                {\r
                        SendEditor(SCI_SETLEXER, SCLEX_PYTHON);\r
-                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("and assert break class continue def del elif \\r
+                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)(m_TextView.StringForControl(_T("and assert break class continue def del elif \\r
 else except exec finally for from global if import in is lambda None \\r
-not or pass print raise return try while yield"));\r
+not or pass print raise return try while yield")).GetBuffer()));\r
                        SetAStyle(SCE_P_DEFAULT, black);\r
                        SetAStyle(SCE_P_COMMENTLINE, darkGreen);\r
                        SetAStyle(SCE_P_NUMBER, RGB(0, 0x80, 0x80));\r
@@ -2043,15 +2067,15 @@ not or pass print raise return try while yield"));
                        (_tcscmp(line, _T("mak"))==0))\r
                {\r
                        SendEditor(SCI_SETLEXER, SCLEX_CPP);\r
-                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("and and_eq asm auto bitand bitor bool break \\r
+                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)(m_TextView.StringForControl(_T("and and_eq asm auto bitand bitor bool break \\r
 case catch char class compl const const_cast continue \\r
 default delete do double dynamic_cast else enum explicit export extern false float for \\r
 friend goto if inline int long mutable namespace new not not_eq \\r
 operator or or_eq private protected public \\r
 register reinterpret_cast return short signed sizeof static static_cast struct switch \\r
 template this throw true try typedef typeid typename union unsigned using \\r
-virtual void volatile wchar_t while xor xor_eq"));\r
-                       SendEditor(SCI_SETKEYWORDS, 3, (LPARAM)_T("a addindex addtogroup anchor arg attention \\r
+virtual void volatile wchar_t while xor xor_eq")).GetBuffer()));\r
+                       SendEditor(SCI_SETKEYWORDS, 3, (LPARAM)(m_TextView.StringForControl(_T("a addindex addtogroup anchor arg attention \\r
 author b brief bug c class code date def defgroup deprecated dontinclude \\r
 e em endcode endhtmlonly endif endlatexonly endlink endverbatim enum example exception \\r
 f$ f[ f] file fn hideinitializer htmlinclude htmlonly \\r
@@ -2060,40 +2084,40 @@ mainpage name namespace nosubgrouping note overload \
 p page par param post pre ref relates remarks return retval \\r
 sa section see showinitializer since skip skipline struct subsection \\r
 test throw todo typedef union until \\r
-var verbatim verbinclude version warning weakgroup $ @ \\ & < > # { }"));\r
+var verbatim verbinclude version warning weakgroup $ @ \\ & < > # { }")).GetBuffer()));\r
                        SetupCppLexer();\r
                }\r
                if (_tcscmp(line, _T("cs"))==0)\r
                {\r
                        SendEditor(SCI_SETLEXER, SCLEX_CPP);\r
-                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("abstract as base bool break byte case catch char checked class \\r
+                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)(m_TextView.StringForControl(_T("abstract as base bool break byte case catch char checked class \\r
 const continue decimal default delegate do double else enum \\r
 event explicit extern false finally fixed float for foreach goto if \\r
 implicit in int interface internal is lock long namespace new null \\r
 object operator out override params private protected public \\r
 readonly ref return sbyte sealed short sizeof stackalloc static \\r
 string struct switch this throw true try typeof uint ulong \\r
-unchecked unsafe ushort using virtual void while"));\r
+unchecked unsafe ushort using virtual void while")).GetBuffer()));\r
                        SetupCppLexer();\r
                }\r
                if ((_tcscmp(line, _T("rc"))==0)||\r
                        (_tcscmp(line, _T("rc2"))==0))\r
                {\r
                        SendEditor(SCI_SETLEXER, SCLEX_CPP);\r
-                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("ACCELERATORS ALT AUTO3STATE AUTOCHECKBOX AUTORADIOBUTTON \\r
+                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)(m_TextView.StringForControl(_T("ACCELERATORS ALT AUTO3STATE AUTOCHECKBOX AUTORADIOBUTTON \\r
 BEGIN BITMAP BLOCK BUTTON CAPTION CHARACTERISTICS CHECKBOX CLASS \\r
 COMBOBOX CONTROL CTEXT CURSOR DEFPUSHBUTTON DIALOG DIALOGEX DISCARDABLE \\r
 EDITTEXT END EXSTYLE FONT GROUPBOX ICON LANGUAGE LISTBOX LTEXT \\r
 MENU MENUEX MENUITEM MESSAGETABLE POPUP \\r
 PUSHBUTTON RADIOBUTTON RCDATA RTEXT SCROLLBAR SEPARATOR SHIFT STATE3 \\r
-STRINGTABLE STYLE TEXTINCLUDE VALUE VERSION VERSIONINFO VIRTKEY"));\r
+STRINGTABLE STYLE TEXTINCLUDE VALUE VERSION VERSIONINFO VIRTKEY")).GetBuffer()));\r
                        SetupCppLexer();\r
                }\r
                if ((_tcscmp(line, _T("idl"))==0)||\r
                        (_tcscmp(line, _T("odl"))==0))\r
                {\r
                        SendEditor(SCI_SETLEXER, SCLEX_CPP);\r
-                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("aggregatable allocate appobject arrays async async_uuid \\r
+                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)(m_TextView.StringForControl(_T("aggregatable allocate appobject arrays async async_uuid \\r
 auto_handle \\r
 bindable boolean broadcast byte byte_count \\r
 call_as callback char coclass code comm_status \\r
@@ -2124,29 +2148,29 @@ shape short signed size_is small source strict_context_handle \
 string struct switch switch_is switch_type \\r
 transmit_as typedef \\r
 uidefault union unique unsigned user_marshal usesgetlasterror uuid \\r
-v1_enum vararg version void wchar_t wire_marshal"));\r
+v1_enum vararg version void wchar_t wire_marshal")).GetBuffer()));\r
                        SetupCppLexer();\r
                }\r
                if (_tcscmp(line, _T("java"))==0)\r
                {\r
                        SendEditor(SCI_SETLEXER, SCLEX_CPP);\r
-                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("abstract assert boolean break byte case catch char class \\r
+                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)(m_TextView.StringForControl(_T("abstract assert boolean break byte case catch char class \\r
 const continue default do double else extends final finally float for future \\r
 generic goto if implements import inner instanceof int interface long \\r
 native new null outer package private protected public rest \\r
 return short static super switch synchronized this throw throws \\r
-transient try var void volatile while"));\r
+transient try var void volatile while")).GetBuffer()));\r
                        SetupCppLexer();\r
                }\r
                if (_tcscmp(line, _T("js"))==0)\r
                {\r
                        SendEditor(SCI_SETLEXER, SCLEX_CPP);\r
-                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("abstract boolean break byte case catch char class \\r
+                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)(m_TextView.StringForControl(_T("abstract boolean break byte case catch char class \\r
 const continue debugger default delete do double else enum export extends \\r
 final finally float for function goto if implements import in instanceof \\r
 int interface long native new package private protected public \\r
 return short static super switch synchronized this throw throws \\r
-transient try typeof var void volatile while with"));\r
+transient try typeof var void volatile while with")).GetBuffer()));\r
                        SetupCppLexer();\r
                }\r
                if ((_tcscmp(line, _T("pas"))==0)||\r
@@ -2154,13 +2178,13 @@ transient try typeof var void volatile while with"));
                        (_tcscmp(line, _T("pp"))==0))\r
                {\r
                        SendEditor(SCI_SETLEXER, SCLEX_PASCAL);\r
-                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("and array as begin case class const constructor \\r
+                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)(m_TextView.StringForControl(_T("and array as begin case class const constructor \\r
 destructor div do downto else end except file finally \\r
 for function goto if implementation in inherited \\r
 interface is mod not object of on or packed \\r
 procedure program property raise record repeat \\r
 set shl shr then threadvar to try type unit \\r
-until uses var while with xor"));\r
+until uses var while with xor")).GetBuffer()));\r
                        SetupCppLexer();\r
                }\r
                if ((_tcscmp(line, _T("as"))==0)||\r
@@ -2168,11 +2192,11 @@ until uses var while with xor"));
                        (_tcscmp(line, _T("jsfl"))==0))\r
                {\r
                        SendEditor(SCI_SETLEXER, SCLEX_CPP);\r
-                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("add and break case catch class continue default delete do \\r
+                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)(m_TextView.StringForControl(_T("add and break case catch class continue default delete do \\r
 dynamic else eq extends false finally for function ge get gt if implements import in \\r
 instanceof interface intrinsic le lt ne new not null or private public return \\r
-set static super switch this throw true try typeof undefined var void while with"));\r
-                       SendEditor(SCI_SETKEYWORDS, 1, (LPARAM)_T("Array Arguments Accessibility Boolean Button Camera Color \\r
+set static super switch this throw true try typeof undefined var void while with")).GetBuffer()));\r
+                       SendEditor(SCI_SETKEYWORDS, 1, (LPARAM)(m_TextView.StringForControl(_T("Array Arguments Accessibility Boolean Button Camera Color \\r
 ContextMenu ContextMenuItem Date Error Function Key LoadVars LocalConnection Math \\r
 Microphone Mouse MovieClip MovieClipLoader NetConnection NetStream Number Object \\r
 PrintJob Selection SharedObject Sound Stage String StyleSheet System TextField \\r
@@ -2185,7 +2209,7 @@ loadVariables loadVariablesNum maxscroll mbchr mblength mbord mbsubstring MMExec
 NaN newline nextFrame nextScene on onClipEvent onUpdate ord parseFloat parseInt play \\r
 prevFrame prevScene print printAsBitmap printAsBitmapNum printNum random removeMovieClip \\r
 scroll set setInterval setProperty startDrag stop stopAllSounds stopDrag substring \\r
-targetPath tellTarget toggleHighQuality trace unescape unloadMovie unLoadMovieNum updateAfterEvent"));\r
+targetPath tellTarget toggleHighQuality trace unescape unloadMovie unLoadMovieNum updateAfterEvent")).GetBuffer()));\r
                        SetupCppLexer();\r
                }\r
                if ((_tcscmp(line, _T("html"))==0)||\r
@@ -2207,7 +2231,7 @@ targetPath tellTarget toggleHighQuality trace unescape unloadMovie unLoadMovieNu
                {\r
                        SendEditor(SCI_SETLEXER, SCLEX_HTML);\r
                        SendEditor(SCI_SETSTYLEBITS, 7);\r
-                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)_T("a abbr acronym address applet area b base basefont \\r
+                       SendEditor(SCI_SETKEYWORDS, 0, (LPARAM)(m_TextView.StringForControl(_T("a abbr acronym address applet area b base basefont \\r
 bdo big blockquote body br button caption center \\r
 cite code col colgroup dd del dfn dir div dl dt em \\r
 fieldset font form frame frameset h1 h2 h3 h4 h5 h6 \\r
@@ -2237,30 +2261,30 @@ scheme scope selected shape size span src standby start style \
 summary tabindex target text title topmargin type usemap \\r
 valign value valuetype version vlink vspace width \\r
 text password checkbox radio submit reset \\r
-file hidden image"));\r
-                       SendEditor(SCI_SETKEYWORDS, 1, (LPARAM)_T("assign audio block break catch choice clear disconnect else elseif \\r
+file hidden image")).GetBuffer()));\r
+                       SendEditor(SCI_SETKEYWORDS, 1, (LPARAM)(m_TextView.StringForControl(_T("assign audio block break catch choice clear disconnect else elseif \\r
 emphasis enumerate error exit field filled form goto grammar help \\r
 if initial link log menu meta noinput nomatch object option p paragraph \\r
 param phoneme prompt property prosody record reprompt return s say-as \\r
-script sentence subdialog submit throw transfer value var voice vxml"));\r
-                       SendEditor(SCI_SETKEYWORDS, 2, (LPARAM)_T("accept age alphabet anchor application base beep bridge category charset \\r
+script sentence subdialog submit throw transfer value var voice vxml")).GetBuffer()));\r
+                       SendEditor(SCI_SETKEYWORDS, 2, (LPARAM)(m_TextView.StringForControl(_T("accept age alphabet anchor application base beep bridge category charset \\r
 classid cond connecttimeout content contour count dest destexpr dtmf dtmfterm \\r
 duration enctype event eventexpr expr expritem fetchtimeout finalsilence \\r
 gender http-equiv id level maxage maxstale maxtime message messageexpr \\r
 method mime modal mode name namelist next nextitem ph pitch range rate \\r
 scope size sizeexpr skiplist slot src srcexpr sub time timeexpr timeout \\r
-transferaudio type value variant version volume xml:lang"));\r
-                       SendEditor(SCI_SETKEYWORDS, 3, (LPARAM)_T("and assert break class continue def del elif \\r
+transferaudio type value variant version volume xml:lang")).GetBuffer()));\r
+                       SendEditor(SCI_SETKEYWORDS, 3, (LPARAM)(m_TextView.StringForControl(_T("and assert break class continue def del elif \\r
 else except exec finally for from global if import in is lambda None \\r
-not or pass print raise return try while yield"));\r
-                       SendEditor(SCI_SETKEYWORDS, 4, (LPARAM)_T("and argv as argc break case cfunction class continue declare default do \\r
+not or pass print raise return try while yield")).GetBuffer()));\r
+                       SendEditor(SCI_SETKEYWORDS, 4, (LPARAM)(m_TextView.StringForControl(_T("and argv as argc break case cfunction class continue declare default do \\r
 die echo else elseif empty enddeclare endfor endforeach endif endswitch \\r
 endwhile e_all e_parse e_error e_warning eval exit extends false for \\r
 foreach function global http_cookie_vars http_get_vars http_post_vars \\r
 http_post_files http_env_vars http_server_vars if include include_once \\r
 list new not null old_function or parent php_os php_self php_version \\r
 print require require_once return static switch stdclass this true var \\r
-xor virtual while __file__ __line__ __sleep __wakeup"));\r
+xor virtual while __file__ __line__ __sleep __wakeup")).GetBuffer()));\r
 \r
                        SetAStyle(SCE_H_TAG, darkBlue);\r
                        SetAStyle(SCE_H_TAGUNKNOWN, red);\r
@@ -2293,14 +2317,14 @@ xor virtual while __file__ __line__ __sleep __wakeup"));
                        // Show the whole section of VBScript with light blue background\r
                        for (int bstyle=SCE_HB_DEFAULT; bstyle<=SCE_HB_STRINGEOL; bstyle++) {\r
                                SendEditor(SCI_STYLESETFONT, bstyle, \r
-                                       reinterpret_cast<LPARAM>("Lucida Console"));\r
+                                       reinterpret_cast<LPARAM>(m_TextView.StringForControl(_T("Lucida Console")).GetBuffer()));\r
                                SendEditor(SCI_STYLESETBACK, bstyle, lightBlue);\r
                                // This call extends the backround colour of the last style on the line to the edge of the window\r
                                SendEditor(SCI_STYLESETEOLFILLED, bstyle, 1);\r
                        }\r
                        SendEditor(SCI_STYLESETBACK, SCE_HB_STRINGEOL, RGB(0x7F,0x7F,0xFF));\r
                        SendEditor(SCI_STYLESETFONT, SCE_HB_COMMENTLINE, \r
-                               reinterpret_cast<LPARAM>("Lucida Console"));\r
+                               reinterpret_cast<LPARAM>(m_TextView.StringForControl(_T("Lucida Console")).GetBuffer()));\r
 \r
                        SetAStyle(SCE_HBA_DEFAULT, black);\r
                        SetAStyle(SCE_HBA_COMMENTLINE, darkGreen);\r
@@ -2313,14 +2337,14 @@ xor virtual while __file__ __line__ __sleep __wakeup"));
                        // Show the whole section of ASP VBScript with bright yellow background\r
                        for (int bastyle=SCE_HBA_DEFAULT; bastyle<=SCE_HBA_STRINGEOL; bastyle++) {\r
                                SendEditor(SCI_STYLESETFONT, bastyle, \r
-                                       reinterpret_cast<LPARAM>("Lucida Console"));\r
+                                       reinterpret_cast<LPARAM>(m_TextView.StringForControl(_T("Lucida Console")).GetBuffer()));\r
                                SendEditor(SCI_STYLESETBACK, bastyle, RGB(0xFF, 0xFF, 0));\r
                                // This call extends the backround colour of the last style on the line to the edge of the window\r
                                SendEditor(SCI_STYLESETEOLFILLED, bastyle, 1);\r
                        }\r
                        SendEditor(SCI_STYLESETBACK, SCE_HBA_STRINGEOL, RGB(0xCF,0xCF,0x7F));\r
                        SendEditor(SCI_STYLESETFONT, SCE_HBA_COMMENTLINE, \r
-                               reinterpret_cast<LPARAM>("Lucida Console"));\r
+                               reinterpret_cast<LPARAM>(m_TextView.StringForControl(_T("Lucida Console")).GetBuffer()));\r
 \r
                        // If there is no need to support embedded Javascript, the following code can be dropped.\r
                        // Javascript will still be correctly processed but will be displayed in just the default style.\r
@@ -2364,7 +2388,7 @@ xor virtual while __file__ __line__ __sleep __wakeup"));
                        // Show the whole section of Javascript with off white background\r
                        for (int jstyle=SCE_HJ_DEFAULT; jstyle<=SCE_HJ_SYMBOLS; jstyle++) {\r
                                SendEditor(SCI_STYLESETFONT, jstyle, \r
-                                       reinterpret_cast<LPARAM>("Lucida Console"));\r
+                                       reinterpret_cast<LPARAM>(m_TextView.StringForControl(_T("Lucida Console")).GetBuffer()));\r
                                SendEditor(SCI_STYLESETBACK, jstyle, offWhite);\r
                                SendEditor(SCI_STYLESETEOLFILLED, jstyle, 1);\r
                        }\r
@@ -2374,7 +2398,7 @@ xor virtual while __file__ __line__ __sleep __wakeup"));
                        // Show the whole section of Javascript with brown background\r
                        for (int jastyle=SCE_HJA_DEFAULT; jastyle<=SCE_HJA_SYMBOLS; jastyle++) {\r
                                SendEditor(SCI_STYLESETFONT, jastyle, \r
-                                       reinterpret_cast<LPARAM>("Lucida Console"));\r
+                                       reinterpret_cast<LPARAM>(m_TextView.StringForControl(_T("Lucida Console")).GetBuffer()));\r
                                SendEditor(SCI_STYLESETBACK, jastyle, RGB(0xDF, 0xDF, 0x7F));\r
                                SendEditor(SCI_STYLESETEOLFILLED, jastyle, 1);\r
                        }\r
@@ -2388,7 +2412,7 @@ xor virtual while __file__ __line__ __sleep __wakeup"));
                SetupCppLexer();\r
        }\r
        SendEditor(SCI_COLOURISE, 0, -1);\r
-#endif\r
+\r
 }\r
 \r
 void CTortoiseGitBlameView::SetupCppLexer()\r
@@ -2408,3 +2432,289 @@ void CTortoiseGitBlameView::SetupCppLexer()
        SetAStyle(SCE_C_PREPROCESSOR, RGB(0x80, 0, 0));\r
        SetAStyle(SCE_C_OPERATOR, RGB(0x80, 0x80, 0));\r
 }\r
+\r
+\r
+void CTortoiseGitBlameView::UpdateInfo()\r
+{\r
+       CString &data = GetDocument()->m_BlameData;\r
+       CString one;\r
+       int pos=0;\r
+\r
+       CLogDataVector * pRevs= GetLogData();\r
+\r
+       this->m_CommitHash.clear();\r
+       this->m_Authors.clear();\r
+       this->m_ID.clear();\r
+       CString line;\r
+\r
+       CreateFont();\r
+\r
+       SendEditor(SCI_SETREADONLY, FALSE);\r
+       SendEditor(SCI_CLEARALL);\r
+       SendEditor(EM_EMPTYUNDOBUFFER);\r
+       SendEditor(SCI_SETSAVEPOINT);\r
+       SendEditor(SCI_CANCEL);\r
+       SendEditor(SCI_SETUNDOCOLLECTION, 0);\r
+\r
+       while( pos>=0 )\r
+       {\r
+               one=data.Tokenize(_T("\n"),pos);\r
+               if(one.IsEmpty())\r
+                       continue;\r
+               m_CommitHash.push_back(one.Left(40));\r
+               int start=0;\r
+               start=one.Find(_T(')'),40);\r
+               if(start>0)\r
+               {\r
+                       line=one.Right(one.GetLength()-start-2);\r
+                       this->m_TextView.InsertText(line,true);\r
+               }\r
+               int id=pRevs->m_HashMap[one.Left(40)];          \r
+               if(id>=0 && id <GetLogData()->size())\r
+               {\r
+                       m_ID.push_back(pRevs->size()-id);\r
+                       m_Authors.push_back(pRevs->at(id).m_AuthorName);\r
+               }else\r
+               {\r
+                       ASSERT(FALSE);\r
+               }\r
+       }\r
+\r
+       SetupLexer(GetDocument()->m_CurrentFileName);\r
+\r
+       SendEditor(SCI_SETUNDOCOLLECTION, 1);\r
+       SendEditor(EM_EMPTYUNDOBUFFER);\r
+       SendEditor(SCI_SETSAVEPOINT);\r
+       SendEditor(SCI_GOTOPOS, 0);\r
+       SendEditor(SCI_SETSCROLLWIDTHTRACKING, TRUE);\r
+       SendEditor(SCI_SETREADONLY, TRUE);\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
+CGitBlameLogList * CTortoiseGitBlameView::GetLogList()\r
+{\r
+       return &(GetDocument()->GetMainFrame()->m_wndOutput.m_LogList);\r
+}\r
+\r
+\r
+CLogDataVector * CTortoiseGitBlameView::GetLogData()\r
+{\r
+       return &(GetDocument()->GetMainFrame()->m_wndOutput.m_LogList.m_logEntries);\r
+}\r
+\r
+void CTortoiseGitBlameView::OnSciPainted(NMHDR *,LRESULT *)\r
+{\r
+       this->Invalidate();\r
+}\r
+\r
+void CTortoiseGitBlameView::OnLButtonDown(UINT nFlags,CPoint point)\r
+{\r
+\r
+       LONG_PTR line = SendEditor(SCI_GETFIRSTVISIBLELINE);\r
+       LONG_PTR height = SendEditor(SCI_TEXTHEIGHT);\r
+       line = line + (point.y/height);\r
+                       \r
+       if (line < (LONG)m_CommitHash.size())\r
+       {\r
+               SetSelectedLine(line);\r
+               if (m_CommitHash[line] != m_SelectedHash)\r
+               {\r
+                       m_SelectedHash = m_CommitHash[line];\r
+//                     app.m_selectedorigrev = app.origrevs[line];\r
+//                     app.m_selectedauthor = app.authors[line];\r
+//                     app.m_selecteddate = app.dates[line];\r
+                       \r
+                       \r
+                       this->GetLogList()->SetItemState(this->GetLogList()->GetItemCount()-m_ID[line],\r
+                                                                                                                       LVIS_SELECTED,\r
+                                                                                                                       LVIS_SELECTED);\r
+\r
+                       GitRev *pRev;\r
+                       pRev=&this->GetLogData()->at(this->GetLogList()->GetItemCount()-m_ID[line]);\r
+                       this->GetDocument()->GetMainFrame()->m_wndProperties.UpdateProperties(pRev);\r
+               }\r
+               else\r
+               {\r
+                       m_SelectedHash.Empty();\r
+//                     app.m_selecteddate.clear();\r
+//                     app.m_selectedrev = -2;\r
+//                     app.m_selectedorigrev = -2;\r
+               }\r
+               //::InvalidateRect( NULL, FALSE);\r
+               this->Invalidate();\r
+               this->m_TextView.Invalidate();\r
+               \r
+       }\r
+       else\r
+       {\r
+               SetSelectedLine(-1);\r
+       }\r
+               \r
+       CView::OnLButtonDown(nFlags,point);\r
+}\r
+\r
+void CTortoiseGitBlameView::OnSciGetBkColor(NMHDR* hdr, LRESULT* result)\r
+{\r
+\r
+       SCNotification *notification=reinterpret_cast<SCNotification *>(hdr);\r
+\r
+       if ((m_colorage)&&(notification->line < (int)m_CommitHash.size()))\r
+       {\r
+               if(m_CommitHash[notification->line] == this->m_SelectedHash )\r
+                       notification->lParam = m_selectedauthorcolor;\r
+               else\r
+                       notification->lParam = InterColor(DWORD(m_regOldLinesColor), DWORD(m_regNewLinesColor), (m_ID[notification->line]-m_lowestrev)*100/((m_highestrev-m_lowestrev)+1));\r
+       }\r
+\r
+}\r
+\r
+void CTortoiseGitBlameView::FocusOn(GitRev *pRev)\r
+{\r
+       m_SelectedHash = pRev->m_CommitHash;\r
+\r
+       //GitRev *pRev;\r
+       //pRev=&this->GetLogData()->at(this->GetLogList()->GetItemCount()-m_ID[line]);\r
+       this->GetDocument()->GetMainFrame()->m_wndProperties.UpdateProperties(pRev);\r
+\r
+       this->Invalidate();\r
+       this->m_TextView.Invalidate();\r
+\r
+}\r
+\r
+void CTortoiseGitBlameView::OnMouseHover(UINT nFlags, CPoint point)\r
+{\r
+\r
+       LONG_PTR line = SendEditor(SCI_GETFIRSTVISIBLELINE);\r
+       LONG_PTR height = SendEditor(SCI_TEXTHEIGHT);\r
+       line = line + (point.y/height);\r
+                       \r
+       if (line < (LONG)m_CommitHash.size())\r
+       {\r
+               if (line != m_MouseLine)\r
+               {\r
+                       m_MouseLine = line;//m_CommitHash[line];\r
+//                     app.m_selectedorigrev = app.origrevs[line];\r
+//                     app.m_selectedauthor = app.authors[line];\r
+//                     app.m_selecteddate = app.dates[line];\r
+                       \r
+                       \r
+                       GitRev *pRev;\r
+                       pRev=&this->GetLogData()->at(this->GetLogList()->GetItemCount()-m_ID[line]);\r
+                       //this->GetDocument()->GetMainFrame()->m_wndProperties.UpdateProperties(pRev);\r
+                       this->ClientToScreen(&point);\r
+                       //BALLOON_INFO bi;\r
+                       //if(m_ToolTip.GetTool(this, bi))\r
+                       //{\r
+                       //      bi.sBalloonTip=pRev->m_CommitHash;\r
+                               CString str;\r
+                               str.Format(_T("%s\n<b>%s</b>\n%s\n%s"),pRev->m_CommitHash,\r
+                                                                                                          pRev->m_Subject,\r
+                                                                                                          pRev->m_AuthorDate.Format(_T("%Y-%m-%d %H:%M")),\r
+                                                                                                          pRev->m_Body);\r
+                               m_ToolTip.AddTool(this,str);\r
+                               m_ToolTip.DisplayToolTip(&point);\r
+                       //}\r
+       \r
+                       CRect rect;\r
+                       this->ScreenToClient(&point);\r
+                       rect.left=LOCATOR_WIDTH;\r
+                       rect.right=this->m_blamewidth+rect.left;\r
+                       rect.top=point.y-height;\r
+                       rect.bottom=point.y+height;\r
+                       this->InvalidateRect(rect);\r
+\r
+               }\r
+               else\r
+               {\r
+                       m_MouseLine=-1;\r
+//                     app.m_selecteddate.clear();\r
+//                     app.m_selectedrev = -2;\r
+//                     app.m_selectedorigrev = -2;\r
+               }\r
+               //::InvalidateRect( NULL, FALSE);\r
+               //this->Invalidate();\r
+       }\r
+       \r
+//      const CString str=_T("this is a <b>Message Balloon</b>\n<hr=100%>\n<ct=0x0000FF>Warning! Warning!</ct>\nSomething unexpected happened");\r
+        //CBalloon::ShowBalloon(NULL, point, \r
+         //            str,\r
+         //             FALSE, (HICON)IDI_EXCLAMATION,\r
+               //                 (UINT)CBalloon ::BALLOON_RIGHT_TOP, (UINT)CBalloon ::BALLOON_EFFECT_SOLID,(COLORREF)NULL,  (COLORREF)NULL,  (COLORREF)NULL);\r
+}\r
+\r
+void CTortoiseGitBlameView::OnMouseMove(UINT nFlags, CPoint point)\r
+{\r
+       TRACKMOUSEEVENT tme;\r
+       tme.cbSize=sizeof(TRACKMOUSEEVENT);\r
+       tme.dwFlags=TME_HOVER|TME_LEAVE;\r
+       tme.hwndTrack=this->m_hWnd;\r
+       tme.dwHoverTime=1;\r
+       TrackMouseEvent(&tme);\r
+}\r
+\r
+\r
+BOOL CTortoiseGitBlameView::PreTranslateMessage(MSG* pMsg)\r
+{\r
+       m_ToolTip.RelayEvent(pMsg);\r
+       return CView::PreTranslateMessage(pMsg);\r
+}\r
+\r
+void CTortoiseGitBlameView::OnEditFind()\r
+{\r
+    m_pFindDialog=new CFindReplaceDialog();\r
+       \r
+    m_pFindDialog->Create(TRUE,_T(""),NULL,FR_DOWN,this);  \r
+}\r
+\r
+void CTortoiseGitBlameView::OnEditGoto()\r
+{\r
+    CEditGotoDlg dlg;\r
+    if(dlg.DoModal()==IDOK)\r
+    {\r
+        this->GotoLine(dlg.m_LineNumber);\r
+    }\r
+}\r
+\r
+LRESULT CTortoiseGitBlameView::OnFindDialogMessage(WPARAM   wParam,   LPARAM   lParam)//Õâ¸öÒ²ÊÇÕÒÄǸö³ÌÐò¸ÄµÄ£¬Ö»²»¹ý»»³ÉÁË×Ô¼ºµÄÀà   \r
+{   \r
+    ASSERT(m_pFindDialog   !=   NULL);   \r
+    \r
+    //   If   the   FR_DIALOGTERM   flag   is   set,   \r
+          //   invalidate   the   handle   identifying   the   dialog   box.   \r
+    if   (m_pFindDialog->IsTerminating())   \r
+    {   \r
+            m_pFindDialog   =   NULL;   \r
+            return   0;   \r
+    }   \r
+\r
+    //   If   the   FR_FINDNEXT   flag   is   set,   \r
+    //   call   the   application-defined   search   routine   \r
+    //   to   search   for   the   requested   string.   \r
+    if(m_pFindDialog->FindNext())   \r
+    {   \r
+            //read   data   from   dialog   \r
+        CString   FindName   =   m_pFindDialog->GetFindString();   \r
+        bool   bMatchCase   =   m_pFindDialog->MatchCase()   ==   TRUE;   \r
+        bool   bMatchWholeWord   =   m_pFindDialog->MatchWholeWord()   ==   TRUE;   \r
+        bool   bSearchDown   =   m_pFindDialog->SearchDown()   ==   TRUE;   \r
+               \r
+               DoSearch(FindName,m_pFindDialog->m_fr.Flags);\r
+            //with   given   name   do   search   \r
+    //        *FindWhatYouNeed(FindName,   bMatchCase,   bMatchWholeWord,   bSearchDown);   \r
+    }   \r
+\r
+    return   0;   \r
+}   \r
+\r