1
// TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2022-2024 - TortoiseGit
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "StandAloneDlg.h"
23 #include "GitStatusListCtrl.h"
24 #include "GestureEnabledControl.h"
29 WorktreeDetails(CString worktreeName
, CString path
, CGitHash hash
, CString branch
)
30 : m_WorktreeName(worktreeName
)
36 bool m_isBaseRepo
= false;
37 CString m_WorktreeName
;
41 bool m_IsLocked
= false;
42 CString m_LockedReason
;
44 CString
GetFullName() const
46 return m_WorktreeName
;
50 class CWorktreeListDlg
: public CResizableStandAloneDialog
52 DECLARE_DYNAMIC(CWorktreeListDlg
)
55 CWorktreeListDlg(CWnd
* pParent
= nullptr); // standard constructor
56 virtual ~CWorktreeListDlg();
61 IDD
= IDD_WORKTREE_LIST
83 void DoDataExchange(CDataExchange
* pDX
) override
; // DDX/DDV support
87 afx_msg
void OnOK() override
;
88 afx_msg
void OnDestroy();
89 BOOL
OnInitDialog() override
;
90 BOOL
PreTranslateMessage(MSG
* pMsg
) override
;
91 afx_msg
void OnNMDblclkWorktreeList(NMHDR
* pNMHDR
, LRESULT
* pResult
);
92 afx_msg
void OnBnClickedButtonAdd();
93 afx_msg
void OnBnClickedButtonPrune();
95 CGestureEnabledControlTmpl
<CListCtrl
> m_WorktreeList
;
96 ColumnManager m_ColumnManager
;
98 std::vector
<WorktreeDetails
> m_Worktrees
;
100 int m_nIconFolder
= -1;
102 afx_msg
void OnContextMenu(CWnd
* pWndFrom
, CPoint point
);
103 void OnContextMenu_WorktreeList(CPoint point
);
104 void ShowContextMenu(CPoint point
, std::vector
<int>& indexes
);
107 int FillListCtrlWithWorktreeList(CString
& error
);
108 int GetWorktreeNames(STRING_VECTOR
& list
, CString
& error
);
110 bool RemoveWorktree(const CString
& path
, bool force
);
111 bool PruneWorktrees();