OSDN Git Service

Add double click to view patch at patch list ctrl
authorFrank Li <lznuaa@gmail.com>
Tue, 14 Apr 2009 07:28:08 +0000 (15:28 +0800)
committerFrank Li <lznuaa@gmail.com>
Tue, 14 Apr 2009 07:28:08 +0000 (15:28 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/TortoiseProc/SendMailDlg.cpp
src/TortoiseProc/SendMailDlg.h

index 47914da..a92d4ef 100644 (file)
@@ -6,6 +6,7 @@
 #include "SendMailDlg.h"\r
 #include "MessageBox.h"\r
 #include "commonresource.h"\r
+#include "AppUtils.h"\r
 // CSendMailDlg dialog\r
 \r
 IMPLEMENT_DYNAMIC(CSendMailDlg, CResizableStandAloneDialog)\r
@@ -16,7 +17,7 @@ CSendMailDlg::CSendMailDlg(CWnd* pParent /*=NULL*/)
        , m_CC(_T(""))\r
        , m_Subject(_T(""))\r
        , m_bAttachment(FALSE)\r
-       , m_bBranch(FALSE)\r
+       , m_bCombine(FALSE)\r
 {\r
 \r
 }\r
@@ -30,9 +31,8 @@ void CSendMailDlg::DoDataExchange(CDataExchange* pDX)
        CDialog::DoDataExchange(pDX);\r
        DDX_Text(pDX, IDC_SENDMAIL_TO, m_To);\r
        DDX_Text(pDX, IDC_SENDMAIL_CC, m_CC);\r
-       DDX_Text(pDX, IDC_SENDMAIL_SUBJECT, m_Subject);\r
        DDX_Check(pDX, IDC_SENDMAIL_ATTACHMENT, m_bAttachment);\r
-       DDX_Check(pDX, IDC_SENDMAIL_COMBINE, m_bBranch);\r
+       DDX_Check(pDX, IDC_SENDMAIL_COMBINE, m_bCombine);\r
        DDX_Control(pDX, IDC_SENDMAIL_PATCHS, m_ctrlList);\r
        DDX_Control(pDX,IDC_SENDMAIL_SETUP, this->m_SmtpSetup);\r
        DDX_Control(pDX,IDC_SENDMAIL_TO,m_ctrlTO);\r
@@ -43,6 +43,9 @@ void CSendMailDlg::DoDataExchange(CDataExchange* pDX)
 BEGIN_MESSAGE_MAP(CSendMailDlg, CResizableStandAloneDialog)\r
        ON_BN_CLICKED(IDC_SENDMAIL_COMBINE, &CSendMailDlg::OnBnClickedSendmailCombine)\r
        ON_BN_CLICKED(IDOK, &CSendMailDlg::OnBnClickedOk)\r
+       ON_NOTIFY(LVN_ITEMCHANGED, IDC_SENDMAIL_PATCHS, &CSendMailDlg::OnLvnItemchangedSendmailPatchs)\r
+       ON_NOTIFY(NM_DBLCLK, IDC_SENDMAIL_PATCHS, &CSendMailDlg::OnNMDblclkSendmailPatchs)\r
+       ON_EN_CHANGE(IDC_SENDMAIL_SUBJECT, &CSendMailDlg::OnEnChangeSendmailSubject)\r
 END_MESSAGE_MAP()\r
 \r
 \r
@@ -90,12 +93,17 @@ BOOL CSendMailDlg::OnInitDialog()
        \r
 //     m_ctrlCC.AddSearchString(_T("Tortoisegit-dev@google.com"));\r
 //     m_ctrlTO.AddSearchString(_T("Tortoisegit-dev@google.com"));\r
-\r
+       this->UpdateData(FALSE);\r
+       OnBnClickedSendmailCombine();\r
        return TRUE;\r
 }\r
 void CSendMailDlg::OnBnClickedSendmailCombine()\r
 {\r
        // TODO: Add your control notification handler code here\r
+       this->UpdateData();\r
+       this->GetDlgItem(IDC_SENDMAIL_SUBJECT)->EnableWindow(this->m_bCombine);\r
+       if(m_bCombine)\r
+               GetDlgItem(IDC_SENDMAIL_SUBJECT)->SetWindowText(this->m_Subject);\r
 }\r
 \r
 void CSendMailDlg::OnBnClickedOk()\r
@@ -126,3 +134,35 @@ void CSendMailDlg::OnBnClickedOk()
        OnOK();\r
        // TODO: Add your control notification handler code here\r
 }\r
+\r
+void CSendMailDlg::OnLvnItemchangedSendmailPatchs(NMHDR *pNMHDR, LRESULT *pResult)\r
+{\r
+       LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);\r
+       // TODO: Add your control notification handler code here\r
+       \r
+       *pResult = 0;\r
+}\r
+\r
+void CSendMailDlg::OnNMDblclkSendmailPatchs(NMHDR *pNMHDR, LRESULT *pResult)\r
+{\r
+       LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);\r
+       // TODO: Add your control notification handler code here\r
+       CString path=this->m_ctrlList.GetItemText(pNMItemActivate->iItem,0);\r
+       CTGitPath gitpath;\r
+       gitpath.SetFromWin(path);\r
+       \r
+       CAppUtils::StartUnifiedDiffViewer(path,gitpath.GetFilename());\r
+\r
+       *pResult = 0;\r
+}\r
+\r
+void CSendMailDlg::OnEnChangeSendmailSubject()\r
+{\r
+       // TODO:  If this is a RICHEDIT control, the control will not\r
+       // send this notification unless you override the CResizableStandAloneDialog::OnInitDialog()\r
+       // function and call CRichEditCtrl().SetEventMask()\r
+       // with the ENM_CHANGE flag ORed into the mask.\r
+\r
+       // TODO:  Add your control notification handler code here\r
+       GetDlgItem(IDC_SENDMAIL_SUBJECT)->GetWindowText(this->m_Subject);\r
+}\r
index 427cfb2..836f942 100644 (file)
@@ -33,10 +33,13 @@ public:
        CString m_CC;\r
        CString m_Subject;\r
        BOOL m_bAttachment;\r
-       BOOL m_bBranch;\r
+       BOOL m_bCombine;\r
        CListCtrl m_ctrlList;\r
        CTGitPathList m_PathList;\r
 \r
        afx_msg void OnBnClickedSendmailCombine();\r
        afx_msg void OnBnClickedOk();\r
+       afx_msg void OnLvnItemchangedSendmailPatchs(NMHDR *pNMHDR, LRESULT *pResult);\r
+       afx_msg void OnNMDblclkSendmailPatchs(NMHDR *pNMHDR, LRESULT *pResult);\r
+       afx_msg void OnEnChangeSendmailSubject();\r
 };\r