OSDN Git Service

Hover Balloon at gitblame view support
authorFrank Li <lznuaa@gmail.com>
Tue, 13 Jan 2009 16:25:44 +0000 (00:25 +0800)
committerFrank Li <lznuaa@gmail.com>
Tue, 13 Jan 2009 16:25:44 +0000 (00:25 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/Git/targetver.h
src/TortoiseGitBlame/TortoiseGitBlameView.cpp
src/TortoiseGitBlame/TortoiseGitBlameView.h
src/TortoiseGitBlame/targetver.h
src/TortoiseProc/GitLogListBase.cpp
src/Utils/targetver.h

index f583181..8d61047 100644 (file)
@@ -8,11 +8,11 @@
 // Modify the following defines if you have to target a platform prior to the ones specified below.\r
 // Refer to MSDN for the latest info on corresponding values for different platforms.\r
 #ifndef WINVER                          // Specifies that the minimum required platform is Windows Vista.\r
-#define WINVER 0x0600           // Change this to the appropriate value to target other versions of Windows.\r
+#define WINVER 0x0500           // Change this to the appropriate value to target other versions of Windows.\r
 #endif\r
 \r
 #ifndef _WIN32_WINNT            // Specifies that the minimum required platform is Windows Vista.\r
-#define _WIN32_WINNT 0x0600     // Change this to the appropriate value to target other versions of Windows.\r
+#define _WIN32_WINNT 0x0500     // Change this to the appropriate value to target other versions of Windows.\r
 #endif\r
 \r
 #ifndef _WIN32_WINDOWS          // Specifies that the minimum required platform is Windows 98.\r
index e152a90..6382244 100644 (file)
@@ -25,6 +25,7 @@
 #include "TortoiseGitBlameDoc.h"\r
 #include "TortoiseGitBlameView.h"\r
 #include "MainFrm.h"\r
+#include "Balloon.h"\r
 \r
 #ifdef _DEBUG\r
 #define new DEBUG_NEW\r
@@ -122,6 +123,9 @@ int CTortoiseGitBlameView::OnCreate(LPCREATESTRUCT lpcs)
        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
        return CView::OnCreate(lpcs);\r
 }\r
 \r
@@ -1132,8 +1136,8 @@ void CTortoiseGitBlameView::DrawBlame(HDC hDC)
                        ::SetTextColor(hDC, m_textcolor);\r
                        if (m_CommitHash[i].GetLength()>0)\r
                        {\r
-                               if (m_CommitHash[i].Compare(m_MouseHash)==0)\r
-                                       ::SetBkColor(hDC, m_mouseauthorcolor);\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
@@ -2607,4 +2611,71 @@ void CTortoiseGitBlameView::FocusOn(GitRev *pRev)
        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"),pRev->m_CommitHash,pRev->m_Subject,pRev->m_AuthorDate.Format(_T("%Y-%m-%d %H:%M")));\r
+                               m_ToolTip.AddTool(this,str);\r
+                               m_ToolTip.DisplayToolTip(&point);\r
+                       //}\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
 }
\ No newline at end of file
index bbee267..b0f2a09 100644 (file)
@@ -11,6 +11,7 @@
 #include "SciEdit.h"\r
 \r
 #include "GitBlameLogList.h"\r
+#include "Balloon.h"\r
 \r
 const COLORREF black = RGB(0,0,0);\r
 const COLORREF white = RGB(0xff,0xff,0xff);\r
@@ -70,6 +71,7 @@ protected:
 \r
 // Generated message map functions\r
 protected:\r
+       BOOL PreTranslateMessage(MSG* pMsg);\r
        afx_msg void OnFilePrintPreview();\r
        afx_msg void OnRButtonUp(UINT nFlags, CPoint point);\r
        afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);\r
@@ -79,6 +81,8 @@ protected:
        afx_msg void OnLButtonDown(UINT nFlags,CPoint point);\r
        afx_msg void OnRButtonDown(UINT nFlags,CPoint point){OnLButtonDown(nFlags,point);CView::OnRButtonDown(nFlags,point);};\r
        afx_msg void OnSciGetBkColor(NMHDR*, LRESULT*);\r
+       afx_msg void OnMouseHover(UINT nFlags, CPoint point);\r
+       afx_msg void OnMouseMove(UINT nFlags, CPoint point);\r
        DECLARE_MESSAGE_MAP()\r
 \r
 public:\r
@@ -87,6 +91,7 @@ public:
        void FocusOn(GitRev *pRev);\r
 \r
        CSciEdit                        m_TextView;\r
+       CBalloon                        m_ToolTip;\r
 \r
        HINSTANCE hInstance;\r
        HINSTANCE hResource;\r
@@ -139,7 +144,7 @@ public:
        void SetSelectedLine(LONG line) { m_SelectedLine=line;};\r
 \r
        LONG                                            m_mouserev;\r
-       CString                                         m_MouseHash;\r
+       LONG                                            m_MouseLine;\r
        LONG                                            m_selectedrev;\r
        LONG                                            m_selectedorigrev;\r
        CString                                         m_SelectedHash;\r
index 27867ba..72b5953 100644 (file)
@@ -9,11 +9,11 @@
 // Modify the following defines if you have to target a platform prior to the ones specified below.\r
 // Refer to MSDN for the latest info on corresponding values for different platforms.\r
 #ifndef WINVER                          // Specifies that the minimum required platform is Windows Vista.\r
-#define WINVER 0x0600           // Change this to the appropriate value to target other versions of Windows.\r
+#define WINVER 0x0500           // Change this to the appropriate value to target other versions of Windows.\r
 #endif\r
 \r
 #ifndef _WIN32_WINNT            // Specifies that the minimum required platform is Windows Vista.\r
-#define _WIN32_WINNT 0x0600     // Change this to the appropriate value to target other versions of Windows.\r
+#define _WIN32_WINNT 0x0500     // Change this to the appropriate value to target other versions of Windows.\r
 #endif\r
 \r
 #ifndef _WIN32_WINDOWS          // Specifies that the minimum required platform is Windows 98.\r
index 2433d19..b43065f 100644 (file)
@@ -126,7 +126,7 @@ int CGitLogListBase:: OnCreate(LPCREATESTRUCT lpCreateStruct)
 \r
 void CGitLogListBase::PreSubclassWindow()\r
 {\r
-       SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_SUBITEMIMAGES);\r
+       SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES);\r
        // load the icons for the action columns\r
        m_Theme.SetWindowTheme(GetSafeHwnd(), L"Explorer", NULL);\r
        CHintListCtrl::PreSubclassWindow();\r
index f583181..8d61047 100644 (file)
@@ -8,11 +8,11 @@
 // Modify the following defines if you have to target a platform prior to the ones specified below.\r
 // Refer to MSDN for the latest info on corresponding values for different platforms.\r
 #ifndef WINVER                          // Specifies that the minimum required platform is Windows Vista.\r
-#define WINVER 0x0600           // Change this to the appropriate value to target other versions of Windows.\r
+#define WINVER 0x0500           // Change this to the appropriate value to target other versions of Windows.\r
 #endif\r
 \r
 #ifndef _WIN32_WINNT            // Specifies that the minimum required platform is Windows Vista.\r
-#define _WIN32_WINNT 0x0600     // Change this to the appropriate value to target other versions of Windows.\r
+#define _WIN32_WINNT 0x0500     // Change this to the appropriate value to target other versions of Windows.\r
 #endif\r
 \r
 #ifndef _WIN32_WINDOWS          // Specifies that the minimum required platform is Windows 98.\r