OSDN Git Service

BrowseRefs: Sorting: Also backward sorting
[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_csDate_Iso8601;\r
33         CString                 m_csAuthor;\r
34         CString                 m_csSubject;\r
35 \r
36         HTREEITEM               m_hTree;\r
37 \r
38         TShadowTreeMap  m_ShadowTree;\r
39         CShadowTree*    m_pParent;\r
40 };\r
41 typedef std::vector<CShadowTree*> VectorPShadowTree;\r
42 \r
43 class CBrowseRefsDlg : public CResizableStandAloneDialog\r
44 {\r
45         DECLARE_DYNAMIC(CBrowseRefsDlg)\r
46 \r
47 public:\r
48         CBrowseRefsDlg(CString cmdPath, CWnd* pParent = NULL);   // standard constructor\r
49         virtual ~CBrowseRefsDlg();\r
50 \r
51         enum eCmd\r
52         {\r
53                 eCmd_ViewLog = WM_APP,\r
54                 eCmd_AddRemote,\r
55                 eCmd_ManageRemotes,\r
56                 eCmd_CreateBranch,\r
57                 eCmd_CreateTag,\r
58                 eCmd_DeleteBranch,\r
59                 eCmd_DeleteTag\r
60         };\r
61 \r
62         enum eCol\r
63         {\r
64                 eCol_Name,\r
65                 eCol_Date,\r
66                 eCol_Msg,\r
67                 eCol_Hash\r
68         };\r
69 \r
70 // Dialog Data\r
71         enum { IDD = IDD_DIALOG_BROWSE_REFS };\r
72 \r
73 protected:\r
74         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support\r
75 \r
76         DECLARE_MESSAGE_MAP()\r
77 public:\r
78         afx_msg void OnBnClickedOk();\r
79         virtual BOOL OnInitDialog();\r
80 \r
81         void                    Refresh(bool bSelectCurHead=false);\r
82 \r
83         CShadowTree&    GetTreeNode(CString refName, CShadowTree* pTreePos=NULL, bool bCreateIfNotExist=false);\r
84 \r
85         void                    FillListCtrlForTreeNode(HTREEITEM treeNode);\r
86 \r
87         void                    FillListCtrlForShadowTree(CShadowTree* pTree, CString refNamePrefix, bool isFirstLevel);\r
88 \r
89         bool                    SelectRef(CString refName);\r
90 \r
91         bool                    ConfirmDeleteRef(CString completeRefName);\r
92         bool                    DoDeleteRef(CString completeRefName, bool bForce);\r
93 \r
94 private:\r
95         CString                 m_cmdPath;\r
96 \r
97         CShadowTree             m_TreeRoot;\r
98         CTreeCtrl               m_RefTreeCtrl;\r
99         CListCtrl               m_ListRefLeafs;\r
100 \r
101         int                             m_currSortCol;\r
102         bool                    m_currSortDesc;\r
103         afx_msg void OnTvnSelchangedTreeRef(NMHDR *pNMHDR, LRESULT *pResult);\r
104 public:\r
105 \r
106         afx_msg void OnContextMenu(CWnd* pWndFrom, CPoint point);\r
107 \r
108         void            OnContextMenu_ListRefLeafs(CPoint point);\r
109         void            OnContextMenu_RefTreeCtrl(CPoint point);\r
110 \r
111         void            ShowContextMenu(CPoint point, HTREEITEM hTreePos, VectorPShadowTree& selectedLeafs);\r
112         virtual BOOL PreTranslateMessage(MSG* pMsg);\r
113         afx_msg void OnLvnColumnclickListRefLeafs(NMHDR *pNMHDR, LRESULT *pResult);\r
114 };\r