OSDN Git Service

BrowseRefs: Context menu enhancements
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / BrowseRefsDlg.h
1 #pragma once\r
2 \r
3 #include "Git.h"\r
4 #include <map>\r
5 #include "afxcmn.h"\r
6 #include "StandAloneDlg.h"\r
7 \r
8 class CShadowTree\r
9 {\r
10 public:\r
11         typedef std::map<CString,CShadowTree> TShadowTreeMap;\r
12 \r
13         CShadowTree():m_hTree(NULL),m_pParent(NULL){}\r
14         \r
15         CShadowTree*    GetNextSub(CString& nameLeft, bool bCreateIfNotExist);\r
16 \r
17         bool                    IsLeaf()const {return m_ShadowTree.empty();}\r
18         CString                 GetRefName()const\r
19         {\r
20                 if(m_pParent==NULL)\r
21                         return m_csRefName;\r
22                 return m_pParent->GetRefName()+"/"+m_csRefName;\r
23         }\r
24         bool                    IsFrom(const wchar_t* from)const\r
25         {\r
26                 return wcsncmp(GetRefName(),from,wcslen(from))==0;\r
27         }\r
28 \r
29         CString                 m_csRefName;\r
30         CString                 m_csRefHash;\r
31         CString                 m_csDate;\r
32         CString                 m_csAuthor;\r
33         CString                 m_csSubject;\r
34 \r
35         HTREEITEM               m_hTree;\r
36 \r
37         TShadowTreeMap  m_ShadowTree;\r
38         CShadowTree*    m_pParent;\r
39 };\r
40 typedef std::vector<CShadowTree*> VectorPShadowTree;\r
41 \r
42 class CBrowseRefsDlg : public CResizableStandAloneDialog\r
43 {\r
44         DECLARE_DYNAMIC(CBrowseRefsDlg)\r
45 \r
46 public:\r
47         CBrowseRefsDlg(CString cmdPath, CWnd* pParent = NULL);   // standard constructor\r
48         virtual ~CBrowseRefsDlg();\r
49 \r
50         enum eCmd\r
51         {\r
52                 eCmd_ViewLog = WM_APP,\r
53                 eCmd_AddRemote,\r
54                 eCmd_ManageRemotes,\r
55                 eCmd_CreateBranch,\r
56                 eCmd_CreateTag,\r
57                 eCmd_DeleteBranch,\r
58                 eCmd_DeleteTag\r
59         };\r
60 \r
61 // Dialog Data\r
62         enum { IDD = IDD_DIALOG_BROWSE_REFS };\r
63 \r
64 protected:\r
65         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support\r
66 \r
67         DECLARE_MESSAGE_MAP()\r
68 public:\r
69         afx_msg void OnBnClickedOk();\r
70         virtual BOOL OnInitDialog();\r
71 \r
72         void                    Refresh(bool bSelectCurHead=false);\r
73 \r
74         CShadowTree&    GetTreeNode(CString refName, CShadowTree* pTreePos=NULL, bool bCreateIfNotExist=false);\r
75 \r
76         void                    FillListCtrlForTreeNode(HTREEITEM treeNode);\r
77 \r
78         void                    FillListCtrlForShadowTree(CShadowTree* pTree, CString refNamePrefix, bool isFirstLevel);\r
79 \r
80         bool                    SelectRef(CString refName);\r
81 \r
82         bool                    ConfirmDeleteRef(CString completeRefName);\r
83         bool                    DoDeleteRef(CString completeRefName, bool bForce);\r
84 \r
85 private:\r
86         CString                 m_cmdPath;\r
87 \r
88         CShadowTree             m_TreeRoot;\r
89         CTreeCtrl               m_RefTreeCtrl;\r
90         CListCtrl               m_ListRefLeafs;\r
91         afx_msg void OnTvnSelchangedTreeRef(NMHDR *pNMHDR, LRESULT *pResult);\r
92 public:\r
93 \r
94         afx_msg void OnContextMenu(CWnd* pWndFrom, CPoint point);\r
95 \r
96         void            OnContextMenu_ListRefLeafs(CPoint point);\r
97         void            OnContextMenu_RefTreeCtrl(CPoint point);\r
98 \r
99         void            ShowContextMenu(CPoint point, HTREEITEM hTreePos, VectorPShadowTree& selectedLeafs);\r
100         virtual BOOL PreTranslateMessage(MSG* pMsg);\r
101 };\r