OSDN Git Service

BrowseRefs: Implemented an example of how to use the BrowseRefs dialog as ref-picker.
authorJohan 't Hart <johanthart@gmail.com>
Wed, 27 May 2009 22:48:35 +0000 (00:48 +0200)
committerFrank Li <lznuaa@gmail.com>
Thu, 28 May 2009 05:49:28 +0000 (13:49 +0800)
For this, see the additional '...' button at the top-right of the rebase dialog.

src/Resources/TortoiseProcENG.rc
src/TortoiseProc/RebaseDlg.cpp
src/TortoiseProc/RebaseDlg.h
src/TortoiseProc/resource.h

index 8b202fb..522f9bb 100644 (file)
Binary files a/src/Resources/TortoiseProcENG.rc and b/src/Resources/TortoiseProcENG.rc differ
index 51125f3..e1b7a3a 100644 (file)
@@ -7,6 +7,7 @@
 #include "AppUtils.h"\r
 #include "MessageBox.h"\r
 #include "UnicodeUtils.h"\r
+#include "BrowseRefsDlg.h"\r
 // CRebaseDlg dialog\r
 \r
 IMPLEMENT_DYNAMIC(CRebaseDlg, CResizableStandAloneDialog)\r
@@ -54,6 +55,7 @@ BEGIN_MESSAGE_MAP(CRebaseDlg, CResizableStandAloneDialog)
        ON_CBN_SELCHANGE(IDC_REBASE_COMBOXEX_BRANCH,   &CRebaseDlg::OnCbnSelchangeBranch)\r
        ON_CBN_SELCHANGE(IDC_REBASE_COMBOXEX_UPSTREAM, &CRebaseDlg::OnCbnSelchangeUpstream)\r
        ON_MESSAGE(MSG_REBASE_UPDATE_UI, OnRebaseUpdateUI)\r
+       ON_BN_CLICKED(IDC_BUTTON_BROWSE, &CRebaseDlg::OnBnClickedButtonBrowse)\r
 END_MESSAGE_MAP()\r
 \r
 void CRebaseDlg::AddRebaseAnchor()\r
@@ -1206,3 +1208,18 @@ void CRebaseDlg::OnBnClickedAbort()
        }\r
        __super::OnCancel();\r
 }\r
+\r
+void CRebaseDlg::OnBnClickedButtonBrowse()\r
+{\r
+       CString origRef;\r
+       m_UpstreamCtrl.GetLBText(m_UpstreamCtrl.GetCurSel(), origRef);\r
+       CString resultRef = CBrowseRefsDlg::PickRef(false,origRef);\r
+       if(resultRef.IsEmpty())\r
+               return;\r
+       if(wcsncmp(resultRef,L"refs/",5)==0)\r
+               resultRef = resultRef.Mid(5);\r
+       if(wcsncmp(resultRef,L"heads/",6)==0)\r
+               resultRef = resultRef.Mid(6);\r
+       m_UpstreamCtrl.SetCurSel(m_UpstreamCtrl.FindStringExact(0,resultRef));\r
+\r
+}\r
index 581d3ef..eb2ed75 100644 (file)
@@ -131,4 +131,5 @@ public:
        int  m_CurrentRebaseIndex;\r
        int  StateAction();\r
        int  GoNext();\r
+       afx_msg void OnBnClickedButtonBrowse();\r
 };\r
index 115e1a6..d0f02e9 100644 (file)
Binary files a/src/TortoiseProc/resource.h and b/src/TortoiseProc/resource.h differ