6 #include "StandAloneDlg.h"
9 const int gPickRef_Head
= 1;
10 const int gPickRef_Tag
= 2;
11 const int gPickRef_Remote
= 4;
12 const int gPickRef_All
= gPickRef_Head
| gPickRef_Tag
| gPickRef_Remote
;
13 const int gPickRef_NoTag
= gPickRef_All
& ~gPickRef_Tag
;
18 typedef std::map
<CString
,CShadowTree
> TShadowTreeMap
;
20 CShadowTree():m_hTree(NULL
),m_pParent(NULL
){}
22 CShadowTree
* GetNextSub(CString
& nameLeft
, bool bCreateIfNotExist
);
24 bool IsLeaf()const {return m_ShadowTree
.empty();}
25 CString
GetRefName()const
29 return m_pParent
->GetRefName()+"/"+m_csRefName
;
31 bool IsFrom(const wchar_t* from
)const
33 return wcsncmp(GetRefName(),from
,wcslen(from
))==0;
36 CShadowTree
* FindLeaf(CString partialRefName
);
41 CString m_csDate_Iso8601
;
47 TShadowTreeMap m_ShadowTree
;
48 CShadowTree
* m_pParent
;
50 typedef std::vector
<CShadowTree
*> VectorPShadowTree
;
52 class CBrowseRefsDlg
: public CResizableStandAloneDialog
54 DECLARE_DYNAMIC(CBrowseRefsDlg
)
57 CBrowseRefsDlg(CString cmdPath
, CWnd
* pParent
= NULL
); // standard constructor
58 virtual ~CBrowseRefsDlg();
62 eCmd_ViewLog
= WM_APP
,
68 eCmd_DeleteRemoteBranch
,
86 enum { IDD
= IDD_DIALOG_BROWSE_REFS
};
89 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
93 afx_msg
void OnBnClickedOk();
94 virtual BOOL
OnInitDialog();
96 CString
GetSelectedRef(bool onlyIfLeaf
, bool pickFirstSelIfMultiSel
= false);
98 void Refresh(CString selectRef
= CString());
100 CShadowTree
& GetTreeNode(CString refName
, CShadowTree
* pTreePos
=NULL
, bool bCreateIfNotExist
=false);
102 void FillListCtrlForTreeNode(HTREEITEM treeNode
);
104 void FillListCtrlForShadowTree(CShadowTree
* pTree
, CString refNamePrefix
, bool isFirstLevel
);
106 bool SelectRef(CString refName
, bool bExactMatch
);
108 bool ConfirmDeleteRef(VectorPShadowTree
& leafs
);
109 bool DoDeleteRefs(VectorPShadowTree
& leafs
, bool bForce
);
110 bool DoDeleteRef(CString completeRefName
, bool bForce
);
112 CString
GetFullRefName(CString partialRefName
);
117 CShadowTree m_TreeRoot
;
118 CShadowTree
* m_pListCtrlRoot
;
119 CTreeCtrl m_RefTreeCtrl
;
120 CListCtrl m_ListRefLeafs
;
124 afx_msg
void OnTvnSelchangedTreeRef(NMHDR
*pNMHDR
, LRESULT
*pResult
);
127 afx_msg
void OnContextMenu(CWnd
* pWndFrom
, CPoint point
);
129 void OnContextMenu_ListRefLeafs(CPoint point
);
130 void OnContextMenu_RefTreeCtrl(CPoint point
);
132 bool AreAllFrom(VectorPShadowTree
& leafs
, const wchar_t* from
);
133 void ShowContextMenu(CPoint point
, HTREEITEM hTreePos
, VectorPShadowTree
& selectedLeafs
);
134 virtual BOOL
PreTranslateMessage(MSG
* pMsg
);
135 afx_msg
void OnLvnColumnclickListRefLeafs(NMHDR
*pNMHDR
, LRESULT
*pResult
);
136 afx_msg
void OnDestroy();
137 afx_msg
void OnNMDblclkListRefLeafs(NMHDR
*pNMHDR
, LRESULT
*pResult
);
138 afx_msg
void OnLvnEndlabeleditListRefLeafs(NMHDR
*pNMHDR
, LRESULT
*pResult
);
139 afx_msg
void OnLvnBeginlabeleditListRefLeafs(NMHDR
*pNMHDR
, LRESULT
*pResult
);
143 CString m_initialRef
;
147 static CString
PickRef(bool returnAsHash
= false, CString initialRef
= CString(), int pickRef_Kind
= gPickRef_All
);
148 static bool PickRefForCombo(CComboBoxEx
* pComboBox
, int pickRef_Kind
= gPickRef_All
);