OSDN Git Service

Pick Ref: Implemented ref picking for push dialog
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / BrowseRefsDlg.h
index 231779a..16391be 100644 (file)
@@ -5,6 +5,13 @@
 #include "afxcmn.h"\r
 #include "StandAloneDlg.h"\r
 \r
+\r
+const int gPickRef_Head                = 1;\r
+const int gPickRef_Tag         = 2;\r
+const int gPickRef_Remote      = 4;\r
+const int gPickRef_All         = gPickRef_Head | gPickRef_Tag | gPickRef_Remote;\r
+const int gPickRef_NoTag       = gPickRef_All & ~gPickRef_Tag;\r
+\r
 class CShadowTree\r
 {\r
 public:\r
@@ -12,7 +19,7 @@ public:
 \r
        CShadowTree():m_hTree(NULL),m_pParent(NULL){}\r
        \r
-       CShadowTree*    GetNextSub(CString& nameLeft);\r
+       CShadowTree*    GetNextSub(CString& nameLeft, bool bCreateIfNotExist);\r
 \r
        bool                    IsLeaf()const {return m_ShadowTree.empty();}\r
        CString                 GetRefName()const\r
@@ -21,10 +28,17 @@ public:
                        return m_csRefName;\r
                return m_pParent->GetRefName()+"/"+m_csRefName;\r
        }\r
+       bool                    IsFrom(const wchar_t* from)const\r
+       {\r
+               return wcsncmp(GetRefName(),from,wcslen(from))==0;\r
+       }\r
+\r
+       CShadowTree*    FindLeaf(CString partialRefName);\r
 \r
        CString                 m_csRefName;\r
        CString                 m_csRefHash;\r
        CString                 m_csDate;\r
+       CString                 m_csDate_Iso8601;\r
        CString                 m_csAuthor;\r
        CString                 m_csSubject;\r
 \r
@@ -33,19 +47,33 @@ public:
        TShadowTreeMap  m_ShadowTree;\r
        CShadowTree*    m_pParent;\r
 };\r
+typedef std::vector<CShadowTree*> VectorPShadowTree;\r
 \r
 class CBrowseRefsDlg : public CResizableStandAloneDialog\r
 {\r
        DECLARE_DYNAMIC(CBrowseRefsDlg)\r
 \r
 public:\r
-       CBrowseRefsDlg(CWnd* pParent = NULL);   // standard constructor\r
+       CBrowseRefsDlg(CString cmdPath, CWnd* pParent = NULL);   // standard constructor\r
        virtual ~CBrowseRefsDlg();\r
 \r
        enum eCmd\r
        {\r
                eCmd_ViewLog = WM_APP,\r
-               eCmd_AddRemote\r
+               eCmd_AddRemote,\r
+               eCmd_ManageRemotes,\r
+               eCmd_CreateBranch,\r
+               eCmd_CreateTag,\r
+               eCmd_DeleteBranch,\r
+               eCmd_DeleteTag\r
+       };\r
+\r
+       enum eCol\r
+       {\r
+               eCol_Name,\r
+               eCol_Date,\r
+               eCol_Msg,\r
+               eCol_Hash\r
        };\r
 \r
 // Dialog Data\r
@@ -59,21 +87,32 @@ public:
        afx_msg void OnBnClickedOk();\r
        virtual BOOL OnInitDialog();\r
 \r
-       void                    Refresh();\r
+       CString                 GetSelectedRef(bool onlyIfLeaf);\r
+\r
+       void                    Refresh(CString selectRef = CString());\r
 \r
-       CShadowTree&    GetTreeNode(CString refName, CShadowTree* pTreePos=NULL);\r
+       CShadowTree&    GetTreeNode(CString refName, CShadowTree* pTreePos=NULL, bool bCreateIfNotExist=false);\r
 \r
        void                    FillListCtrlForTreeNode(HTREEITEM treeNode);\r
 \r
        void                    FillListCtrlForShadowTree(CShadowTree* pTree, CString refNamePrefix, bool isFirstLevel);\r
 \r
-       bool                    SelectRef(CString refName);\r
+       bool                    SelectRef(CString refName, bool bExactMatch);\r
+\r
+       bool                    ConfirmDeleteRef(CString completeRefName);\r
+       bool                    DoDeleteRef(CString completeRefName, bool bForce);\r
+\r
+       CString                 GetFullRefName(CString partialRefName);\r
 \r
 private:\r
+       CString                 m_cmdPath;\r
 \r
        CShadowTree             m_TreeRoot;\r
        CTreeCtrl               m_RefTreeCtrl;\r
        CListCtrl               m_ListRefLeafs;\r
+\r
+       int                             m_currSortCol;\r
+       bool                    m_currSortDesc;\r
        afx_msg void OnTvnSelchangedTreeRef(NMHDR *pNMHDR, LRESULT *pResult);\r
 public:\r
 \r
@@ -81,4 +120,19 @@ public:
 \r
        void            OnContextMenu_ListRefLeafs(CPoint point);\r
        void            OnContextMenu_RefTreeCtrl(CPoint point);\r
+\r
+       void            ShowContextMenu(CPoint point, HTREEITEM hTreePos, VectorPShadowTree& selectedLeafs);\r
+       virtual BOOL PreTranslateMessage(MSG* pMsg);\r
+       afx_msg void OnLvnColumnclickListRefLeafs(NMHDR *pNMHDR, LRESULT *pResult);\r
+       afx_msg void OnDestroy();\r
+       afx_msg void OnNMDblclkListRefLeafs(NMHDR *pNMHDR, LRESULT *pResult);\r
+\r
+\r
+public:\r
+       CString m_initialRef;\r
+       int             m_pickRef_Kind;\r
+       CString m_pickedRef;\r
+\r
+       static CString  PickRef(bool returnAsHash = false, CString initialRef = CString(), int pickRef_Kind = gPickRef_All); \r
+       static bool             PickRefForCombo(CComboBoxEx* pComboBox, int pickRef_Kind = gPickRef_All); \r
 };\r