Make sounds for indicating a warning or error work
[TortoiseGit.git] / src / TortoiseProc / URLDlg.cpp
blob0064b1f98b25ace36dec2d7e9db6cf3f7cbe0bd0
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"
23 #include ".\urldlg.h"
25 IMPLEMENT_DYNAMIC(CURLDlg, CResizableStandAloneDialog)
26 CURLDlg::CURLDlg(CWnd* pParent /*=NULL*/)
27 : CResizableStandAloneDialog(CURLDlg::IDD, pParent)
29 m_height = 0;
32 CURLDlg::~CURLDlg()
36 void CURLDlg::DoDataExchange(CDataExchange* pDX)
38 CResizableStandAloneDialog::DoDataExchange(pDX);
39 DDX_Control(pDX, IDC_URLCOMBO, m_URLCombo);
43 BEGIN_MESSAGE_MAP(CURLDlg, CResizableStandAloneDialog)
44 ON_WM_SIZING()
45 END_MESSAGE_MAP()
48 BOOL CURLDlg::OnInitDialog()
50 CResizableStandAloneDialog::OnInitDialog();
52 m_URLCombo.SetURLHistory(TRUE);
53 m_URLCombo.LoadHistory(_T("Software\\TortoiseGit\\History\\repoURLS"), _T("url"));
54 m_URLCombo.SetCurSel(0);
55 m_URLCombo.SetFocus();
57 RECT rect;
58 GetWindowRect(&rect);
59 m_height = rect.bottom - rect.top;
60 AddAnchor(IDC_LABEL, TOP_LEFT);
61 AddAnchor(IDC_URLCOMBO, TOP_LEFT, TOP_RIGHT);
62 AddAnchor(IDOK, BOTTOM_RIGHT);
63 AddAnchor(IDCANCEL, BOTTOM_RIGHT);
64 EnableSaveRestore(_T("URLDlg"));
65 return FALSE;
68 void CURLDlg::OnOK()
70 if (m_URLCombo.IsWindowEnabled())
72 m_URLCombo.SaveHistory();
73 m_url = m_URLCombo.GetString();
74 UpdateData();
77 CResizableStandAloneDialog::OnOK();
81 void CURLDlg::OnSizing(UINT fwSide, LPRECT pRect)
83 // don't allow the dialog to be changed in height
84 switch (fwSide)
86 case WMSZ_BOTTOM:
87 case WMSZ_BOTTOMLEFT:
88 case WMSZ_BOTTOMRIGHT:
89 pRect->bottom = pRect->top + m_height;
90 break;
91 case WMSZ_TOP:
92 case WMSZ_TOPLEFT:
93 case WMSZ_TOPRIGHT:
94 pRect->top = pRect->bottom - m_height;
95 break;
97 CResizableStandAloneDialog::OnSizing(fwSide, pRect);