Refactor: Move ColumnManager to separate files
[TortoiseGit.git] / src / TortoiseProc / URLDlg.cpp
blobb1ab516dcf0a466f43611aa52db3b78878ef5183
1 // TortoiseGit - 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.
19 #include "stdafx.h"
21 #include "TortoiseProc.h"
22 #include "URLDlg.h"
24 IMPLEMENT_DYNAMIC(CURLDlg, CResizableStandAloneDialog)
25 CURLDlg::CURLDlg(CWnd* pParent /*=nullptr*/)
26 : CResizableStandAloneDialog(CURLDlg::IDD, pParent)
28 m_height = 0;
31 CURLDlg::~CURLDlg()
35 void CURLDlg::DoDataExchange(CDataExchange* pDX)
37 CResizableStandAloneDialog::DoDataExchange(pDX);
38 DDX_Control(pDX, IDC_URLCOMBO, m_URLCombo);
42 BEGIN_MESSAGE_MAP(CURLDlg, CResizableStandAloneDialog)
43 ON_WM_SIZING()
44 END_MESSAGE_MAP()
47 BOOL CURLDlg::OnInitDialog()
49 CResizableStandAloneDialog::OnInitDialog();
51 m_URLCombo.SetURLHistory(TRUE);
52 m_URLCombo.LoadHistory(_T("Software\\TortoiseGit\\History\\repoURLS"), _T("url"));
53 m_URLCombo.SetCurSel(0);
54 m_URLCombo.SetFocus();
56 RECT rect;
57 GetWindowRect(&rect);
58 m_height = rect.bottom - rect.top;
59 AddAnchor(IDC_LABEL, TOP_LEFT);
60 AddAnchor(IDC_URLCOMBO, TOP_LEFT, TOP_RIGHT);
61 AddAnchor(IDOK, BOTTOM_RIGHT);
62 AddAnchor(IDCANCEL, BOTTOM_RIGHT);
63 EnableSaveRestore(_T("URLDlg"));
64 return FALSE;
67 void CURLDlg::OnOK()
69 if (m_URLCombo.IsWindowEnabled())
71 m_URLCombo.SaveHistory();
72 m_url = m_URLCombo.GetString();
73 UpdateData();
76 CResizableStandAloneDialog::OnOK();
80 void CURLDlg::OnSizing(UINT fwSide, LPRECT pRect)
82 // don't allow the dialog to be changed in height
83 switch (fwSide)
85 case WMSZ_BOTTOM:
86 case WMSZ_BOTTOMLEFT:
87 case WMSZ_BOTTOMRIGHT:
88 pRect->bottom = pRect->top + m_height;
89 break;
90 case WMSZ_TOP:
91 case WMSZ_TOPLEFT:
92 case WMSZ_TOPRIGHT:
93 pRect->top = pRect->bottom - m_height;
94 break;
96 CResizableStandAloneDialog::OnSizing(fwSide, pRect);