RepoBrowser: added Extension column
[TortoiseGit.git] / src / TortoiseProc / RepositoryBrowser.h
blob0621e024ef69a14f4386553bdf47244ee1ee52c6
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2009-2012 - TortoiseGit
4 // Copyright (C) 2012 - Sven Strickroth <email@cs-ware.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #pragma once
22 #include "git2.h"
23 #include <map>
24 #include "StandAloneDlg.h"
26 #define REPOBROWSER_CTRL_MIN_WIDTH 20
28 class CShadowFilesTree;
30 typedef std::map<CString, CShadowFilesTree> TShadowFilesTreeMap;
32 class CShadowFilesTree
34 public:
35 CShadowFilesTree()
36 : m_hTree(NULL)
37 , m_pParent(NULL)
38 , m_bFolder(false)
39 , m_iSize(0)
42 CString m_sName;
43 size_t m_iSize;
44 bool m_bFolder;
46 HTREEITEM m_hTree;
48 TShadowFilesTreeMap m_ShadowTree;
49 CShadowFilesTree* m_pParent;
51 CString GetFullName() const
53 if (m_pParent == NULL)
54 return m_sName;
56 return m_pParent->GetFullName() + _T("/") + m_sName;
59 typedef std::vector<CShadowFilesTree *> TShadowFilesTreeList;
61 class CRepositoryBrowser : public CResizableStandAloneDialog
63 DECLARE_DYNAMIC(CRepositoryBrowser)
65 public:
66 CRepositoryBrowser(CString rev, CWnd* pParent = NULL); // standard constructor
67 virtual ~CRepositoryBrowser();
69 // Dialog Data
70 enum { IDD = IDD_REPOSITORY_BROWSER };
72 static bool s_bSortLogical;
74 enum eCmd
76 eCmd_ViewLog = WM_APP,
79 enum eCol
81 eCol_Name,
82 eCol_Extension,
83 eCol_FileSize,
86 private:
87 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
89 DECLARE_MESSAGE_MAP()
91 afx_msg void OnOK();
92 afx_msg void OnCancel();
93 virtual BOOL OnInitDialog();
95 CTreeCtrl m_RepoTree;
96 CListCtrl m_RepoList;
98 afx_msg void OnLvnColumnclickRepoList(NMHDR *pNMHDR, LRESULT *pResult);
99 int m_currSortCol;
100 bool m_currSortDesc;
102 CShadowFilesTree m_TreeRoot;
103 int ReadTreeRecursive(git_repository &repo, git_tree * tree, CShadowFilesTree * treeroot);
104 int ReadTree(CShadowFilesTree * treeroot);
105 int m_nIconFolder;
106 int m_nOpenIconFolder;
108 void Refresh();
109 CString m_sRevision;
110 void FillListCtrlForTreeNode(HTREEITEM treeNode);
111 void FillListCtrlForShadowTree(CShadowFilesTree* pTree);
112 afx_msg void OnTvnSelchangedRepoTree(NMHDR *pNMHDR, LRESULT *pResult);
114 afx_msg void OnNMDblclk_RepoList(NMHDR *pNMHDR, LRESULT *pResult);
115 afx_msg void OnContextMenu(CWnd* pWndFrom, CPoint point);
116 void OnContextMenu_RepoList(CPoint point);
118 afx_msg void OnBnClickedButtonRevision();
120 virtual BOOL PreTranslateMessage(MSG* pMsg);
122 /// resizes the control so that the divider is at position 'point'
123 void HandleDividerMove(CPoint point, bool bDraw);
124 bool bDragMode;
125 void SaveDividerPosition();
126 int oldy, oldx;
127 /// draws the bar when the tree and list control are resized
128 void DrawXorBar(CDC * pDC, int x1, int y1, int width, int height);
129 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
130 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
131 afx_msg void OnCaptureChanged(CWnd *pWnd);
132 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
133 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);