OSDN Git Service

Continued work on BrowserRefsDlg
authorJohan t Hart <johanthart@gmail.com>
Fri, 24 Apr 2009 22:27:29 +0000 (00:27 +0200)
committerFrank Li <lznuaa@gmail.com>
Sat, 25 Apr 2009 23:59:40 +0000 (07:59 +0800)
src/TortoiseProc/BrowseRefsDlg.cpp
src/TortoiseProc/BrowseRefsDlg.h

index bf9ca63..fe33cc8 100644 (file)
@@ -4,6 +4,7 @@
 #include "stdafx.h"\r
 #include "TortoiseProc.h"\r
 #include "BrowseRefsDlg.h"\r
 #include "stdafx.h"\r
 #include "TortoiseProc.h"\r
 #include "BrowseRefsDlg.h"\r
+#include "LogDlg.h"\r
 \r
 \r
 // CBrowseRefsDlg dialog\r
 \r
 \r
 // CBrowseRefsDlg dialog\r
@@ -31,6 +32,7 @@ void CBrowseRefsDlg::DoDataExchange(CDataExchange* pDX)
 BEGIN_MESSAGE_MAP(CBrowseRefsDlg, CResizableStandAloneDialog)\r
        ON_BN_CLICKED(IDOK, &CBrowseRefsDlg::OnBnClickedOk)\r
        ON_NOTIFY(TVN_SELCHANGED, IDC_TREE_REF, &CBrowseRefsDlg::OnTvnSelchangedTreeRef)\r
 BEGIN_MESSAGE_MAP(CBrowseRefsDlg, CResizableStandAloneDialog)\r
        ON_BN_CLICKED(IDOK, &CBrowseRefsDlg::OnBnClickedOk)\r
        ON_NOTIFY(TVN_SELCHANGED, IDC_TREE_REF, &CBrowseRefsDlg::OnTvnSelchangedTreeRef)\r
+       ON_NOTIFY(NM_RCLICK, IDC_LIST_REF_LEAFS, &CBrowseRefsDlg::OnNMRClickListRefLeafs)\r
 END_MESSAGE_MAP()\r
 \r
 \r
 END_MESSAGE_MAP()\r
 \r
 \r
@@ -257,3 +259,32 @@ void CBrowseRefsDlg::FillListCtrlForShadowTree(CShadowTree* pTree, CString refNa
                }\r
        }\r
 }\r
                }\r
        }\r
 }\r
+\r
+void CBrowseRefsDlg::OnNMRClickListRefLeafs(NMHDR *pNMHDR, LRESULT *pResult)\r
+{\r
+       LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);\r
+       *pResult = 0;\r
+\r
+       CMenu popupMenu;\r
+       popupMenu.CreatePopupMenu();\r
+       popupMenu.AppendMenu(MF_STRING,eCmd_ViewLog,L"View log");\r
+\r
+       CShadowTree* pTree = (CShadowTree*)m_ListRefLeafs.GetItemData(pNMHDR->idFrom);\r
+       if(pTree==NULL)\r
+               return;\r
+\r
+\r
+       const MSG* pCurrMsg=GetCurrentMessage();\r
+       eCmd cmd=(eCmd)popupMenu.TrackPopupMenuEx(TPM_LEFTALIGN|TPM_RETURNCMD, pCurrMsg->pt.x, pCurrMsg->pt.y, this, 0);\r
+       switch(cmd)\r
+       {\r
+       case eCmd_ViewLog:\r
+               {\r
+                       CLogDlg dlg;\r
+                       theApp.m_pMainWnd = &dlg;\r
+                       dlg.SetParams("", "", pTree->m_csRef, "", "");\r
+                       dlg.DoModal();\r
+               }\r
+               break;\r
+       }\r
+}\r
index 28e7d9a..f90cce2 100644 (file)
@@ -37,6 +37,11 @@ public:
        CBrowseRefsDlg(CWnd* pParent = NULL);   // standard constructor\r
        virtual ~CBrowseRefsDlg();\r
 \r
        CBrowseRefsDlg(CWnd* pParent = NULL);   // standard constructor\r
        virtual ~CBrowseRefsDlg();\r
 \r
+       enum eCmd\r
+       {\r
+               eCmd_ViewLog = WM_APP\r
+       };\r
+\r
 // Dialog Data\r
        enum { IDD = IDD_DIALOG_BROWSE_REFS };\r
 \r
 // Dialog Data\r
        enum { IDD = IDD_DIALOG_BROWSE_REFS };\r
 \r
@@ -65,4 +70,6 @@ private:
        CTreeCtrl               m_RefTreeCtrl;\r
        CListCtrl               m_ListRefLeafs;\r
        afx_msg void OnTvnSelchangedTreeRef(NMHDR *pNMHDR, LRESULT *pResult);\r
        CTreeCtrl               m_RefTreeCtrl;\r
        CListCtrl               m_ListRefLeafs;\r
        afx_msg void OnTvnSelchangedTreeRef(NMHDR *pNMHDR, LRESULT *pResult);\r
+public:\r
+       afx_msg void OnNMRClickListRefLeafs(NMHDR *pNMHDR, LRESULT *pResult);\r
 };\r
 };\r