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
,
80 enum { IDD
= IDD_DIALOG_BROWSE_REFS
};
83 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
87 afx_msg
void OnBnClickedOk();
88 virtual BOOL
OnInitDialog();
90 CString
GetSelectedRef(bool onlyIfLeaf
);
92 void Refresh(CString selectRef
= CString());
94 CShadowTree
& GetTreeNode(CString refName
, CShadowTree
* pTreePos
=NULL
, bool bCreateIfNotExist
=false);
96 void FillListCtrlForTreeNode(HTREEITEM treeNode
);
98 void FillListCtrlForShadowTree(CShadowTree
* pTree
, CString refNamePrefix
, bool isFirstLevel
);
100 bool SelectRef(CString refName
, bool bExactMatch
);
102 bool ConfirmDeleteRef(CString completeRefName
);
103 bool DoDeleteRef(CString completeRefName
, bool bForce
);
105 CString
GetFullRefName(CString partialRefName
);
110 CShadowTree m_TreeRoot
;
111 CTreeCtrl m_RefTreeCtrl
;
112 CListCtrl m_ListRefLeafs
;
116 afx_msg
void OnTvnSelchangedTreeRef(NMHDR
*pNMHDR
, LRESULT
*pResult
);
119 afx_msg
void OnContextMenu(CWnd
* pWndFrom
, CPoint point
);
121 void OnContextMenu_ListRefLeafs(CPoint point
);
122 void OnContextMenu_RefTreeCtrl(CPoint point
);
124 void ShowContextMenu(CPoint point
, HTREEITEM hTreePos
, VectorPShadowTree
& selectedLeafs
);
125 virtual BOOL
PreTranslateMessage(MSG
* pMsg
);
126 afx_msg
void OnLvnColumnclickListRefLeafs(NMHDR
*pNMHDR
, LRESULT
*pResult
);
127 afx_msg
void OnDestroy();
128 afx_msg
void OnNMDblclkListRefLeafs(NMHDR
*pNMHDR
, LRESULT
*pResult
);
132 CString m_initialRef
;
136 static CString
PickRef(bool returnAsHash
= false, CString initialRef
= CString(), int pickRef_Kind
= gPickRef_All
);
137 static bool PickRefForCombo(CComboBoxEx
* pComboBox
, int pickRef_Kind
= gPickRef_All
);