home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.funduc.com
/
2014.08.ftp.funduc.com.tar
/
ftp.funduc.com
/
fshedcode-072212.zip
/
GotoDlg.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2010-09-13
|
3KB
|
91 lines
/////////////////////////////////////////////////////////////////////////////
// License (GPLv2+):
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Fshed.h"
#include "GotoDlg.h"
// CGotoDlg dialog
IMPLEMENT_DYNAMIC(CGotoDlg, CDialog)
CGotoDlg::CGotoDlg(CWnd* pParent /*=NULL*/)
: CDialog(CGotoDlg::IDD, pParent)
, m_strOffset(_T(""))
{
m_nOffset = 0;
m_bRelative = true;
}
CGotoDlg::~CGotoDlg()
{
}
void CGotoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSelectBlockDlg)
DDX_Text(pDX, IDC_OFFSET_ED, m_strOffset);
//}}AFX_DATA_MAP
if (pDX->m_bSaveAndValidate)
{
bool bPos = true;
if (m_strOffset.GetLength())
{
m_strOffset = m_strOffset.Trim();
if (m_strOffset[0] == '-')
{
bPos = false;
m_bRelative = true;
m_strOffset = m_strOffset.Mid(1);
}
else if (m_strOffset[0] == '+')
{
m_bRelative = true;
m_strOffset = m_strOffset.Mid(1);
}
}
if (_stscanf(m_strOffset, _T("x%x"), &m_nOffset) == 0)
{
if (_stscanf(m_strOffset, _T("%d"), &m_nOffset) == 0)
{
AfxMessageBox (IDS_ERR_INV_OFFSET);
pDX->Fail();
}
}
if (m_bRelative && !bPos)
m_nOffset = -m_nOffset;
}
}
BEGIN_MESSAGE_MAP(CGotoDlg, CDialog)
END_MESSAGE_MAP()
// CGotoDlg message handlers
BOOL CGotoDlg::OnInitDialog()
{
m_strOffset.Format(_T("x%x"), m_nOffset);
CDialog::OnInitDialog();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}