ShopEd.cpp
arcaed/ShopEd.cpp · 4.8 KB
From the archive arcaed_source.zip
Download the archive « Back to the archive contents
/*
* Arcanum Editor - ROM area editor
* Copyright (C) 1999 Lucas Wall <kthulhu@usa.net>
*
* 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
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* If you make changes to the source and want to make the public you can
* mail the diferences to me <kthulhu@usa.net> and I'll add them to the
* main distribution. Of course your name will be added to the program with
* information about the changes you made.
*
*
* Packed on Thu Aug 19 03:02:25 1999
*
*/
/*
* File: ShopEd.cpp
*
* Changes:
*
* 19/08/99 Lucas Wall <kthulhu@usa.net>
* First source release. Its quite messy and has no
* comments. I never planed to release the source code... :-)
*
*/
// ShopEd.cpp : implementation file
//
#include "stdafx.h"
#include "arcaed.h"
#include "ShopEd.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CShopEd dialog
CShopEd::CShopEd(CWnd* pParent /*=NULL*/)
: CDialog(CShopEd::IDD, pParent)
{
//{{AFX_DATA_INIT(CShopEd)
m_Buy = 0;
m_Close = 0;
m_Open = 0;
m_Sell = 0;
//}}AFX_DATA_INIT
int i;
for ( i = 0; i < 5; i++ )
m_trade[i] = 0;
}
void CShopEd::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_SHOPED_TRADE1, m_Trade[0]);
DDX_Control(pDX, IDC_SHOPED_TRADE2, m_Trade[1]);
DDX_Control(pDX, IDC_SHOPED_TRADE3, m_Trade[2]);
DDX_Control(pDX, IDC_SHOPED_TRADE4, m_Trade[3]);
DDX_Control(pDX, IDC_SHOPED_TRADE5, m_Trade[4]);
//{{AFX_DATA_MAP(CShopEd)
DDX_Control(pDX, IDC_SHOPED_SELL_SPIN, m_SellSpin);
DDX_Control(pDX, IDC_SHOPED_OPEN_SPIN, m_OpenSpin);
DDX_Control(pDX, IDC_SHOPED_CLOSE_SPIN, m_CloseSpin);
DDX_Control(pDX, IDC_SHOPED_BUY_SPIN, m_BuySpin);
DDX_Text(pDX, IDC_SHOPED_BUY, m_Buy);
DDV_MinMaxInt(pDX, m_Buy, 0, 32767);
DDX_Text(pDX, IDC_SHOPED_CLOSE, m_Close);
DDV_MinMaxInt(pDX, m_Close, 0, 23);
DDX_Text(pDX, IDC_SHOPED_OPEN, m_Open);
DDV_MinMaxInt(pDX, m_Open, 0, 23);
DDX_Text(pDX, IDC_SHOPED_SELL, m_Sell);
DDV_MinMaxInt(pDX, m_Sell, 0, 32767);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CShopEd, CDialog)
//{{AFX_MSG_MAP(CShopEd)
ON_CBN_SELCHANGE(IDC_SHOPED_TRADE1, OnSelchangeShopedTrade)
ON_CBN_SELCHANGE(IDC_SHOPED_TRADE2, OnSelchangeShopedTrade)
ON_CBN_SELCHANGE(IDC_SHOPED_TRADE3, OnSelchangeShopedTrade)
ON_CBN_SELCHANGE(IDC_SHOPED_TRADE4, OnSelchangeShopedTrade)
ON_CBN_SELCHANGE(IDC_SHOPED_TRADE5, OnSelchangeShopedTrade)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CShopEd message handlers
BOOL CShopEd::OnInitDialog()
{
CDialog::OnInitDialog();
int i, j, index;
CString text;
m_BuySpin.SetBuddy( GetDlgItem( IDC_SHOPED_BUY ) );
m_SellSpin.SetBuddy( GetDlgItem( IDC_SHOPED_SELL ) );
m_OpenSpin.SetBuddy( GetDlgItem( IDC_SHOPED_OPEN ) );
m_CloseSpin.SetBuddy( GetDlgItem( IDC_SHOPED_CLOSE ) );
m_BuySpin.SetRange( 0, 32767 );
m_SellSpin.SetRange( 0, 32767 );
m_OpenSpin.SetRange( 0, 23 );
m_CloseSpin.SetRange( 0, 23 );
for ( i = 0; i < tables.m_objtypes.GetSize(); i++ )
{
for ( j = 0; j < 5; j++ )
{
index = m_Trade[j].AddString( tables.m_objtypes[i]->m_text );
ASSERT( index != CB_ERR && index != CB_ERRSPACE );
m_Trade[j].SetItemData( index, tables.m_objtypes[i]->m_num );
if ( tables.m_objtypes[i]->m_num == m_trade[j] )
m_Trade[j].SetCurSel( index );
}
}
text.LoadString( IDS_NOTHING );
for ( i = 0; i < 5; i++ )
{
index = m_Trade[i].InsertString( 0, text );
ASSERT( index != CB_ERR && index != CB_ERRSPACE );
m_Trade[i].SetItemData( index, 0 );
if ( m_trade[i] == 0 ) m_Trade[i].SetCurSel( 0 );
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CShopEd::OnSelchangeShopedTrade()
{
int i, index;
for ( i = 0; i < 5; i++ )
{
index = m_Trade[i].GetCurSel();
if ( index != CB_ERR )
m_trade[i] = m_Trade[i].GetItemData( index );
}
}