OSDN Git Service

Pick Ref: Implemented ref picking for push dialog
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / PushDlg.cpp
index 7022c2a..e26b462 100644 (file)
@@ -8,6 +8,7 @@
 #include "Git.h"\r
 #include "registry.h"\r
 #include "AppUtils.h"\r
 #include "Git.h"\r
 #include "registry.h"\r
 #include "AppUtils.h"\r
+#include "BrowseRefsDlg.h"\r
 \r
 // CPushDlg dialog\r
 \r
 \r
 // CPushDlg dialog\r
 \r
@@ -44,6 +45,8 @@ BEGIN_MESSAGE_MAP(CPushDlg, CResizableStandAloneDialog)
        ON_CBN_SELCHANGE(IDC_BRANCH_SOURCE, &CPushDlg::OnCbnSelchangeBranchSource)\r
        ON_BN_CLICKED(IDOK, &CPushDlg::OnBnClickedOk)\r
     ON_BN_CLICKED(IDC_REMOTE_MANAGE, &CPushDlg::OnBnClickedRemoteManage)\r
        ON_CBN_SELCHANGE(IDC_BRANCH_SOURCE, &CPushDlg::OnCbnSelchangeBranchSource)\r
        ON_BN_CLICKED(IDOK, &CPushDlg::OnBnClickedOk)\r
     ON_BN_CLICKED(IDC_REMOTE_MANAGE, &CPushDlg::OnBnClickedRemoteManage)\r
+       ON_BN_CLICKED(IDC_BUTTON_BROWSE_SOURCE_BRANCH, &CPushDlg::OnBnClickedButtonBrowseSourceBranch)\r
+       ON_BN_CLICKED(IDC_BUTTON_BROWSE_DEST_BRANCH, &CPushDlg::OnBnClickedButtonBrowseDestBranch)\r
 END_MESSAGE_MAP()\r
 \r
 BOOL CPushDlg::OnInitDialog()\r
 END_MESSAGE_MAP()\r
 \r
 BOOL CPushDlg::OnInitDialog()\r
@@ -57,7 +60,9 @@ BOOL CPushDlg::OnInitDialog()
        AddAnchor(IDC_STATIC_SOURCE, TOP_LEFT);\r
 \r
        AddAnchor(IDC_BRANCH_REMOTE, TOP_RIGHT);\r
        AddAnchor(IDC_STATIC_SOURCE, TOP_LEFT);\r
 \r
        AddAnchor(IDC_BRANCH_REMOTE, TOP_RIGHT);\r
+       AddAnchor(IDC_BUTTON_BROWSE_DEST_BRANCH, TOP_RIGHT);\r
        AddAnchor(IDC_BRANCH_SOURCE, TOP_LEFT);\r
        AddAnchor(IDC_BRANCH_SOURCE, TOP_LEFT);\r
+       AddAnchor(IDC_BUTTON_BROWSE_SOURCE_BRANCH, TOP_LEFT);\r
 \r
        AddAnchor(IDC_URL_GROUP, TOP_LEFT,TOP_RIGHT);\r
        AddAnchor(IDC_RD_REMOTE, TOP_LEFT);\r
 \r
        AddAnchor(IDC_URL_GROUP, TOP_LEFT,TOP_RIGHT);\r
        AddAnchor(IDC_RD_REMOTE, TOP_LEFT);\r
@@ -185,3 +190,22 @@ void CPushDlg::OnBnClickedRemoteManage()
     // TODO: Add your control notification handler code here\r
     CAppUtils::LaunchRemoteSetting();\r
 }\r
     // TODO: Add your control notification handler code here\r
     CAppUtils::LaunchRemoteSetting();\r
 }\r
+\r
+void CPushDlg::OnBnClickedButtonBrowseSourceBranch()\r
+{\r
+       if(CBrowseRefsDlg::PickRefForCombo(&m_BranchSource, gPickRef_Head))\r
+               OnCbnSelchangeBranchSource();\r
+}\r
+\r
+void CPushDlg::OnBnClickedButtonBrowseDestBranch()\r
+{\r
+       CString remoteBranchName;\r
+       m_BranchRemote.GetWindowText(remoteBranchName);\r
+       remoteBranchName = CBrowseRefsDlg::PickRef(false, remoteBranchName, gPickRef_Remote);\r
+       if(remoteBranchName.IsEmpty())\r
+               return; //Canceled\r
+       remoteBranchName = remoteBranchName.Mid(13);//Strip 'refs/remotes/'\r
+       remoteBranchName = remoteBranchName.Mid(remoteBranchName.Find('/') + 1); //Strip remote name (for example 'origin/')\r
+\r
+       m_BranchRemote.SetWindowText(remoteBranchName);\r
+}\r