1 // TortoiseSVN - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - TortoiseSVN
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.
22 #include "HistoryCombo.h"
24 #include "XPImageButton.h"
26 class CRepositoryTree
;
29 * \ingroup TortoiseProc
30 * Interface definition
35 virtual bool ChangeToUrl(CString
& url
, GitRev
& rev
, bool bAlreadyChecked
) = 0;
36 virtual CString
GetRepoRoot() = 0;
40 * \ingroup TortoiseProc
41 * Provides a CReBarCtrl which can be used as a "control center" for the
42 * repository browser. To associate the repository bar with any repository
43 * tree control, call AssocTree() once after both objects are created. As
44 * long as they are associated, the bar and the tree form a "team" of
45 * controls that work together.
47 class CRepositoryBar
: public CReBarCtrl
49 DECLARE_DYNAMIC(CRepositoryBar
)
53 virtual ~CRepositoryBar();
57 * Creates the repository bar. Set \a in_dialog to TRUE when the bar
58 * is placed inside of a dialog. Otherwise it is assumed that the
59 * bar is placed in a frame window.
61 bool Create(CWnd
* parent
, UINT id
, bool in_dialog
= true);
64 * Show the given \a svn_url in the URL combo and the revision button.
66 void ShowUrl(const CString
& url
, GitRev rev
);
69 * Show the given \a svn_url in the URL combo and the revision button,
70 * and select it in the associated repository tree. If no \a svn_url
71 * is given, the current values are used (which effectively refreshes
74 void GotoUrl(const CString
& url
= CString(), GitRev rev
= GitRev(), bool bAlreadyChecked
= false);
77 * Returns the current URL.
79 CString
GetCurrentUrl() const;
82 * Returns the current revision
84 GitRev
GetCurrentRev() const;
87 * Saves the URL history of the HistoryCombo.
94 void SetRevision(GitRev rev
);
98 void SetIRepo(IRepo
* pRepo
) {m_pRepo
= pRepo
;}
100 void SetHeadRevision(const GitRev
& rev
) {m_headRev
= rev
;}
101 afx_msg
void OnGoUp();
103 virtual BOOL
PreTranslateMessage(MSG
* pMsg
);
104 afx_msg
void OnCbnSelChange();
105 afx_msg
void OnBnClicked();
106 afx_msg
void OnDestroy();
108 DECLARE_MESSAGE_MAP()
116 class CRepositoryCombo
: public CHistoryCombo
118 CRepositoryBar
*m_bar
;
120 CRepositoryCombo(CRepositoryBar
*bar
) : m_bar(bar
) {}
121 virtual bool OnReturnKeyPressed();
124 CButton m_btnRevision
;
125 CXPImageButton m_btnUp
;
128 CToolTips m_tooltips
;
134 * \ingroup TortoiseProc
135 * Implements a visual container for a CRepositoryBar which may be added to a
136 * dialog. A CRepositoryBarCnr is not needed if the CRepositoryBar is attached
139 class CRepositoryBarCnr
: public CStatic
141 DECLARE_DYNAMIC(CRepositoryBarCnr
)
144 CRepositoryBarCnr(CRepositoryBar
*repository_bar
);
145 ~CRepositoryBarCnr();
147 // Generated message map functions
149 afx_msg BOOL
OnEraseBkgnd(CDC
* pDC
);
150 afx_msg
void OnSize(UINT nType
, int cx
, int cy
);
151 afx_msg UINT
OnGetDlgCode();
152 afx_msg
void OnKeyDown(UINT nChar
, UINT nRepCnt
, UINT nFlags
);
154 virtual void DrawItem(LPDRAWITEMSTRUCT
);
156 DECLARE_MESSAGE_MAP()
159 CRepositoryBar
*m_pbarRepository
;