📄 pageprofileprofile.cpp
字号:
//
// PageProfileProfile.cpp
//
// Copyright (c) Shareaza Development Team, 2002-2004.
// This file is part of SHAREAZA (www.shareaza.com)
//
// Shareaza 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.
//
// Shareaza 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 Shareaza; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
#include "StdAfx.h"
#include "Shareaza.h"
#include "Settings.h"
#include "GProfile.h"
#include "XML.h"
#include "PageProfileProfile.h"
#include "WorldGPS.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNCREATE(CProfileProfilePage, CSettingsPage)
BEGIN_MESSAGE_MAP(CProfileProfilePage, CSettingsPage)
//{{AFX_MSG_MAP(CProfileProfilePage)
ON_CBN_CLOSEUP(IDC_LOC_COUNTRY, OnCloseUpCountry)
ON_CBN_CLOSEUP(IDC_LOC_CITY, OnCloseUpCity)
ON_LBN_SELCHANGE(IDC_INTEREST_LIST, OnSelChangeInterestList)
ON_CBN_SELCHANGE(IDC_INTEREST_ALL, OnSelChangeInterestAll)
ON_CBN_EDITCHANGE(IDC_INTEREST_ALL, OnEditChangeInterestAll)
ON_BN_CLICKED(IDC_INTEREST_ADD, OnInterestAdd)
ON_BN_CLICKED(IDC_INTEREST_REMOVE, OnInterestRemove)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CProfileProfilePage property page
CProfileProfilePage::CProfileProfilePage() : CSettingsPage( CProfileProfilePage::IDD )
{
//{{AFX_DATA_INIT(CProfileProfilePage)
m_sLocCity = _T("");
m_sLocCountry = _T("");
m_sLocLatitude = _T("");
m_sLocLongitude = _T("");
//}}AFX_DATA_INIT
m_pWorld = NULL;
}
CProfileProfilePage::~CProfileProfilePage()
{
if ( m_pWorld ) delete m_pWorld;
}
void CProfileProfilePage::DoDataExchange(CDataExchange* pDX)
{
CSettingsPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CProfileProfilePage)
DDX_Control(pDX, IDC_INTEREST_REMOVE, m_wndInterestRemove);
DDX_Control(pDX, IDC_INTEREST_ADD, m_wndInterestAdd);
DDX_Control(pDX, IDC_INTEREST_ALL, m_wndInterestAll);
DDX_Control(pDX, IDC_INTEREST_LIST, m_wndInterestList);
DDX_Control(pDX, IDC_LOC_CITY, m_wndCity);
DDX_Control(pDX, IDC_LOC_COUNTRY, m_wndCountry);
DDX_CBString(pDX, IDC_LOC_CITY, m_sLocCity);
DDX_CBString(pDX, IDC_LOC_COUNTRY, m_sLocCountry);
DDX_Text(pDX, IDC_LOC_LAT, m_sLocLatitude);
DDX_Text(pDX, IDC_LOC_LONG, m_sLocLongitude);
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
// CProfileProfilePage message handlers
BOOL CProfileProfilePage::OnInitDialog()
{
CSettingsPage::OnInitDialog();
m_pWorld = new CWorldGPS();
m_pWorld->Load();
CWorldCountry* pCountry = m_pWorld->m_pCountry;
for ( int nCountry = m_pWorld->m_nCountry ; nCountry ; nCountry--, pCountry++ )
{
m_wndCountry.SetItemData( m_wndCountry.AddString( pCountry->m_sName ), (LPARAM)pCountry );
}
if ( CXMLElement* pLocation = MyProfile.GetXML( _T("location") ) )
{
if ( CXMLElement* pPolitical = pLocation->GetElementByName( _T("political") ) )
{
m_sLocCountry = pPolitical->GetAttributeValue( _T("country") );
m_sLocCity = pPolitical->GetAttributeValue( _T("city") ) + _T(", ")
+ pPolitical->GetAttributeValue( _T("state") );
}
if ( CXMLElement* pCoordinates = pLocation->GetElementByName( _T("coordinates") ) )
{
CString str = pCoordinates->GetAttributeValue( _T("latitude") );
float nValue;
if ( _stscanf( str, _T("%f"), &nValue ) == 1 )
{
m_sLocLatitude.Format( nValue >= 0 ?
_T("%.2f
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -