Correctly deallocate buffer
[TortoiseGit.git] / src / TortoiseMerge / GotoLineDlg.cpp
blobf1d2675597129ce213650167e7a2314d199ec19f
1 // TortoiseGitMerge - a Diff/Patch program
3 // Copyright (C) 2011 - 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"
20 #include "TortoiseMerge.h"
21 #include "GotoLineDlg.h"
22 #include "afxdialogex.h"
25 // CGotoLineDlg dialog
27 IMPLEMENT_DYNAMIC(CGotoLineDlg, CDialogEx)
29 CGotoLineDlg::CGotoLineDlg(CWnd* pParent /*=NULL*/)
30 : CDialogEx(CGotoLineDlg::IDD, pParent)
31 , m_nLine(0)
32 , m_nLow(-1)
33 , m_nHigh(-1)
38 CGotoLineDlg::~CGotoLineDlg()
42 void CGotoLineDlg::DoDataExchange(CDataExchange* pDX)
44 CDialogEx::DoDataExchange(pDX);
45 DDX_Text(pDX, IDC_NUMBER, m_nLine);
46 DDX_Control(pDX, IDC_NUMBER, m_cNumber);
50 BEGIN_MESSAGE_MAP(CGotoLineDlg, CDialogEx)
51 END_MESSAGE_MAP()
56 BOOL CGotoLineDlg::OnInitDialog()
58 CDialogEx::OnInitDialog();
60 if (!m_sLabel.IsEmpty())
62 SetDlgItemText(IDC_LINELABEL, m_sLabel);
64 SetDlgItemText(IDC_NUMBER, L"");
65 GetDlgItem(IDC_NUMBER)->SetFocus();
67 return FALSE;
71 void CGotoLineDlg::OnOK()
73 UpdateData();
74 if ((m_nLine < m_nLow)||(m_nLine > m_nHigh))
76 CString sError;
77 sError.Format(IDS_GOTO_OUTOFRANGE, m_nLow, m_nHigh);
78 m_cNumber.ShowBalloonTip(L"", sError);
79 m_cNumber.SetSel(0, -1);
80 return;
82 CDialogEx::OnOK();