OSDN Git Service

RebaseDlg: Show Commit Info at tooltip for branch and upstream branch.
authorFrank Li <lznuaa@gmail.com>
Sat, 14 Feb 2009 08:43:06 +0000 (16:43 +0800)
committerFrank Li <lznuaa@gmail.com>
Sat, 14 Feb 2009 08:43:06 +0000 (16:43 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/TortoiseProc/RebaseDlg.cpp
src/TortoiseProc/RebaseDlg.h
src/Utils/MiscUI/HistoryCombo.cpp
src/Utils/MiscUI/HistoryCombo.h

index f717127..f029ae1 100644 (file)
@@ -4,7 +4,7 @@
 #include "stdafx.h"\r
 #include "TortoiseProc.h"\r
 #include "RebaseDlg.h"\r
-\r
+#include "AppUtils.h"\r
 \r
 // CRebaseDlg dialog\r
 \r
@@ -45,6 +45,8 @@ BEGIN_MESSAGE_MAP(CRebaseDlg, CResizableStandAloneDialog)
     ON_BN_CLICKED(IDC_EDIT_ALL, &CRebaseDlg::OnBnClickedEditAll)\r
     ON_BN_CLICKED(IDC_REBASE_SPLIT, &CRebaseDlg::OnBnClickedRebaseSplit)\r
        ON_WM_SIZE()\r
+       ON_CBN_SELCHANGE(IDC_REBASE_COMBOXEX_BRANCH,   &CRebaseDlg::OnCbnSelchangeBranch)\r
+       ON_CBN_SELCHANGE(IDC_REBASE_COMBOXEX_UPSTREAM, &CRebaseDlg::OnCbnSelchangeUpstream)\r
 END_MESSAGE_MAP()\r
 \r
 void CRebaseDlg::AddRebaseAnchor()\r
@@ -107,6 +109,8 @@ BOOL CRebaseDlg::OnInitDialog()
                return FALSE;\r
        }\r
 \r
+       m_tooltips.Create(this);\r
+\r
        m_FileListCtrl.Init(SVNSLC_COLEXT | SVNSLC_COLSTATUS , _T("RebaseDlg"));\r
 \r
        m_ctrlTabCtrl.AddTab(&m_FileListCtrl,_T("Modified File"));\r
@@ -267,4 +271,45 @@ void CRebaseDlg::LoadBranchInfo()
 \r
        m_BranchCtrl.SetCurSel(current);\r
 \r
+       AddBranchToolTips(&m_BranchCtrl);\r
+       AddBranchToolTips(&m_UpstreamCtrl);\r
+\r
+}\r
+\r
+void CRebaseDlg::OnCbnSelchangeBranch()\r
+{\r
+\r
+}\r
+\r
+void CRebaseDlg::OnCbnSelchangeUpstream()\r
+{\r
+\r
+}\r
+\r
+void CRebaseDlg::AddBranchToolTips(CHistoryCombo *pBranch)\r
+{\r
+       if(pBranch)\r
+       {\r
+               CString text=pBranch->GetString();\r
+               CString tooltip;\r
+               BYTE_VECTOR data;\r
+               g_Git.GetLog(data,text,NULL,1,0);\r
+               GitRev rev;\r
+               rev.ParserFromLog(data);\r
+               tooltip.Format(_T("CommitHash:%s\nCommit by: %s  %s\n <b>%s</b> \n %s"),\r
+                       rev.m_CommitHash,\r
+                       rev.m_AuthorName,\r
+                       CAppUtils::FormatDateAndTime(rev.m_AuthorDate,DATE_LONGDATE),\r
+                       rev.m_Subject,\r
+                       rev.m_Body);\r
+\r
+               pBranch->DisableTooltip();\r
+               this->m_tooltips.AddTool(pBranch->GetComboBoxCtrl(),tooltip);\r
+       }\r
+}\r
+\r
+BOOL CRebaseDlg::PreTranslateMessage(MSG*pMsg)\r
+{\r
+       m_tooltips.RelayEvent(pMsg);\r
+       return CResizableStandAloneDialog::PreTranslateMessage(pMsg);\r
 }
\ No newline at end of file
index e00cc4f..4aedfc5 100644 (file)
@@ -6,6 +6,8 @@
 #include "SciEdit.h"\r
 #include "SplitterControl.h"\r
 #include "HistoryCombo.h"\r
+#include "Balloon.h"\r
+#include "GitLogList.h"\r
 // CRebaseDlg dialog\r
 #define IDC_REBASE_TAB 0x1000000\r
 \r
@@ -45,6 +47,7 @@ protected:
 \r
        CRect                           m_DlgOrigRect;\r
        CRect                           m_CommitListOrigRect;\r
+       BOOL PreTranslateMessage(MSG* pMsg);\r
 \r
 public:\r
    \r
@@ -53,9 +56,13 @@ public:
     afx_msg void OnBnClickedEditAll();\r
     afx_msg void OnBnClickedRebaseSplit();\r
        afx_msg void OnSize(UINT nType, int cx, int cy);\r
+       afx_msg void OnCbnSelchangeBranch();\r
+       afx_msg void OnCbnSelchangeUpstream();\r
 \r
     CProgressCtrl m_ProgressBar;\r
     CStatic m_CtrlStatusText;\r
+       CBalloon                        m_tooltips;\r
+\r
     BOOL m_bPickAll;\r
     BOOL m_bSquashAll;\r
     BOOL m_bEditAll;\r
@@ -64,13 +71,15 @@ public:
        CMFCTabCtrl m_ctrlTabCtrl;\r
        CGitStatusListCtrl m_FileListCtrl;\r
        CSciEdit                   m_LogMessageCtrl;\r
-       CListCtrl                  m_CommitList;\r
+       \r
+       CGitLogList                m_CommitList;\r
 \r
-       CHistoryCombo      m_BranchCtrl;\r
-       CHistoryCombo      m_UpstreamCtrl;\r
+       CHistoryCombo m_BranchCtrl;\r
+       CHistoryCombo m_UpstreamCtrl;\r
 \r
        REBASE_STAGE       m_RebaseStage;\r
 \r
-\r
+       void AddBranchToolTips(CHistoryCombo *pBranch);\r
+       \r
 \r
 };\r
index 482b280..1ea9e51 100644 (file)
@@ -52,6 +52,7 @@ BOOL CHistoryCombo::PreCreateWindow(CREATESTRUCT& cs)
 \r
 BOOL CHistoryCombo::PreTranslateMessage(MSG* pMsg)\r
 {\r
+\r
        if (pMsg->message == WM_KEYDOWN)\r
        {\r
                bool bShift = !!(GetKeyState(VK_SHIFT) & 0x8000);\r
@@ -65,7 +66,7 @@ BOOL CHistoryCombo::PreTranslateMessage(MSG* pMsg)
                        return TRUE;\r
                }\r
        }\r
-       if (pMsg->message == WM_MOUSEMOVE) \r
+       if (pMsg->message == WM_MOUSEMOVE && this->m_bDyn \r
        {\r
                if ((pMsg->wParam & MK_LBUTTON) == 0)\r
                {\r
@@ -76,6 +77,7 @@ BOOL CHistoryCombo::PreTranslateMessage(MSG* pMsg)
                        return TRUE;\r
                }\r
        }\r
+\r
        return CComboBoxEx::PreTranslateMessage(pMsg);\r
 }\r
 \r
index a3f29bd..ea827fe 100644 (file)
@@ -52,7 +52,7 @@ public:
         * position, otherwise add it to the end of the list.\r
         */\r
        int AddString(CString str, INT_PTR pos = -1);\r
-\r
+       void DisableTooltip(){m_bDyn = FALSE;} //because rebase need disable combox tooltip to show version info\r
 protected:\r
        DECLARE_MESSAGE_MAP()\r
        virtual BOOL PreCreateWindow(CREATESTRUCT& cs);\r