OSDN Git Service

Add Help button handle and add Anchor at format patch for refbrowse button
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / FormatPatchDlg.cpp
index f644b94..1d5baa5 100644 (file)
@@ -6,6 +6,8 @@
 #include "FormatPatchDlg.h"\r
 #include "git.h"\r
 #include "BrowseFolder.h"\r
+#include "LogDlg.h"\r
+#include "BrowseRefsDlg.h"\r
 // CFormatPatchDlg dialog\r
 \r
 IMPLEMENT_DYNAMIC(CFormatPatchDlg, CResizableStandAloneDialog)\r
@@ -51,6 +53,7 @@ BEGIN_MESSAGE_MAP(CFormatPatchDlg, CResizableStandAloneDialog)
        ON_BN_CLICKED(IDC_RADIO_SINCE, &CFormatPatchDlg::OnBnClickedRadio)\r
        ON_BN_CLICKED(IDC_RADIO_NUM, &CFormatPatchDlg::OnBnClickedRadio)\r
        ON_BN_CLICKED(IDC_RADIO_RANGE, &CFormatPatchDlg::OnBnClickedRadio)\r
+       ON_BN_CLICKED(IDC_BUTTON_REF, &CFormatPatchDlg::OnBnClickedButtonRef)\r
 END_MESSAGE_MAP()\r
 \r
 BOOL CFormatPatchDlg::OnInitDialog()\r
@@ -74,6 +77,8 @@ BOOL CFormatPatchDlg::OnInitDialog()
        AddAnchor(IDC_CHECK_SENDMAIL,BOTTOM_LEFT);\r
        AddAnchor(IDOK,BOTTOM_RIGHT);\r
        AddAnchor(IDCANCEL,BOTTOM_RIGHT);\r
+       AddAnchor(IDHELP, BOTTOM_RIGHT);\r
+       AddAnchor(IDC_BUTTON_REF,TOP_RIGHT);\r
 \r
        this->AddOthersToAnchor();\r
 \r
@@ -83,6 +88,7 @@ BOOL CFormatPatchDlg::OnInitDialog()
 \r
        STRING_VECTOR list;\r
        g_Git.GetBranchList(list,NULL,CGit::BRANCH_ALL);\r
+       m_cSince.SetMaxHistoryItems(list.size());\r
        m_cSince.AddString(list);\r
 \r
        if(!m_Since.IsEmpty())\r
@@ -126,12 +132,38 @@ void CFormatPatchDlg::OnBnClickedButtonDir()
 \r
 void CFormatPatchDlg::OnBnClickedButtonFrom()\r
 {\r
-       // TODO: Add your control notification handler code here\r
+       CLogDlg dlg;\r
+       // tell the dialog to use mode for selecting revisions\r
+       dlg.SetSelect(true);\r
+       // only one revision must be selected however\r
+       dlg.SingleSelection(true);\r
+       if ( dlg.DoModal() == IDOK )\r
+       {\r
+               // get selected hash if any\r
+               CString selectedHash = dlg.GetSelectedHash();\r
+               // load into window, do this even if empty so that it is clear that nothing has been selected\r
+               m_cFrom.AddString(selectedHash);\r
+               CheckRadioButton(IDC_RADIO_SINCE, IDC_RADIO_RANGE, IDC_RADIO_RANGE);\r
+               OnBnClickedRadio();\r
+       }\r
 }\r
 \r
 void CFormatPatchDlg::OnBnClickedButtonTo()\r
 {\r
-       // TODO: Add your control notification handler code here\r
+       CLogDlg dlg;\r
+       // tell the dialog to use mode for selecting revisions\r
+       dlg.SetSelect(true);\r
+       // only one revision must be selected however\r
+       dlg.SingleSelection(true);\r
+       if ( dlg.DoModal() == IDOK )\r
+       {\r
+               // get selected hash if any\r
+               CString selectedHash = dlg.GetSelectedHash();\r
+               // load into window, do this even if empty so that it is clear that nothing has been selected\r
+               m_cTo.AddString(selectedHash);\r
+               CheckRadioButton(IDC_RADIO_SINCE, IDC_RADIO_RANGE, IDC_RADIO_RANGE);\r
+               OnBnClickedRadio();\r
+       }\r
 }\r
 \r
 void CFormatPatchDlg::OnBnClickedOk()\r
@@ -169,3 +201,12 @@ void CFormatPatchDlg::OnBnClickedRadio()
                m_cTo.EnableWindow(TRUE);\r
        }\r
 }\r
+\r
+void CFormatPatchDlg::OnBnClickedButtonRef()\r
+{\r
+       if(CBrowseRefsDlg::PickRefForCombo(&m_cSince, gPickRef_NoTag))\r
+       {\r
+               CheckRadioButton(IDC_RADIO_SINCE, IDC_RADIO_RANGE, IDC_RADIO_SINCE);\r
+               OnBnClickedRadio();\r
+       }\r
+}\r