OSDN Git Service

BrowseRef: Use CMessageBox to display confirm message.
[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);\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 \r
41 class CBrowseRefsDlg : public CResizableStandAloneDialog\r
42 {\r
43         DECLARE_DYNAMIC(CBrowseRefsDlg)\r
44 \r
45 public:\r
46         CBrowseRefsDlg(CString cmdPath, CWnd* pParent = NULL);   // standard constructor\r
47         virtual ~CBrowseRefsDlg();\r
48 \r
49         enum eCmd\r
50         {\r
51                 eCmd_ViewLog = WM_APP,\r
52                 eCmd_AddRemote,\r
53                 eCmd_ManageRemotes,\r
54                 eCmd_CreateBranch,\r
55                 eCmd_CreateTag,\r
56                 eCmd_DeleteBranch,\r
57                 eCmd_DeleteTag\r
58         };\r
59 \r
60 // Dialog Data\r
61         enum { IDD = IDD_DIALOG_BROWSE_REFS };\r
62 \r
63 protected:\r
64         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support\r
65 \r
66         DECLARE_MESSAGE_MAP()\r
67 public:\r
68         afx_msg void OnBnClickedOk();\r
69         virtual BOOL OnInitDialog();\r
70 \r
71         void                    Refresh();\r
72 \r
73         CShadowTree&    GetTreeNode(CString refName, CShadowTree* pTreePos=NULL);\r
74 \r
75         void                    FillListCtrlForTreeNode(HTREEITEM treeNode);\r
76 \r
77         void                    FillListCtrlForShadowTree(CShadowTree* pTree, CString refNamePrefix, bool isFirstLevel);\r
78 \r
79         bool                    SelectRef(CString refName);\r
80 \r
81         bool                    ConfirmDeleteRef(CString completeRefName);\r
82         bool                    DoDeleteRef(CString completeRefName, bool bForce);\r
83 \r
84 private:\r
85         CString                 m_cmdPath;\r
86 \r
87         CShadowTree             m_TreeRoot;\r
88         CTreeCtrl               m_RefTreeCtrl;\r
89         CListCtrl               m_ListRefLeafs;\r
90         afx_msg void OnTvnSelchangedTreeRef(NMHDR *pNMHDR, LRESULT *pResult);\r
91 public:\r
92 \r
93         afx_msg void OnContextMenu(CWnd* pWndFrom, CPoint point);\r
94 \r
95         void            OnContextMenu_ListRefLeafs(CPoint point);\r
96         void            OnContextMenu_RefTreeCtrl(CPoint point);\r
97         virtual BOOL PreTranslateMessage(MSG* pMsg);\r
98 };\r