/* * 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:18 1999 * */ /* * File: AreaData.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... :-) * */ // AreaData.cpp : implementation file // #include "stdafx.h" #include "arcaed.h" #include "AreaData.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CAreaData dialog CAreaData::CAreaData(CWnd* pParent /*=NULL*/) : CDialog(CAreaData::IDD, pParent) { //{{AFX_DATA_INIT(CAreaData) m_Autores = _T(""); m_Creditos = _T(""); m_MaxNivel = 0; m_MaxVnum = 0; m_MinNivel = 0; m_MinVnum = 0; m_Nombre = _T(""); m_Seguridad = 0; m_Recu = 0; //}}AFX_DATA_INIT } void CAreaData::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAreaData) DDX_Control(pDX, IDC_AREAED_RECLIST, m_RecList); DDX_Control(pDX, IDC_AREAED_REC_SPIN, m_RecSpin); DDX_Control(pDX, IDC_AREAED_SEGURIDAD_SPIN, m_SeguridadSpin); DDX_Control(pDX, IDC_AREAED_MINVNUM_SPIN, m_MinVnumSpin); DDX_Control(pDX, IDC_AREAED_MINNIVEL_SPIN, m_MinNivelSpin); DDX_Control(pDX, IDC_AREAED_MAXVNUM_SPIN, m_MaxVnumSpin); DDX_Control(pDX, IDC_AREAED_MAXNIVEL_SPIN, m_MaxNivelSpin); DDX_Text(pDX, IDC_AREAED_AUTORES, m_Autores); DDX_Text(pDX, IDC_AREAED_CREDITOS, m_Creditos); DDX_Text(pDX, IDC_AREAED_MAXNIVEL, m_MaxNivel); DDV_MinMaxInt(pDX, m_MaxNivel, 0, 32767); DDX_Text(pDX, IDC_AREAED_MAXVNUM, m_MaxVnum); DDV_MinMaxInt(pDX, m_MaxVnum, 0, 32767); DDX_Text(pDX, IDC_AREAED_MINNIVEL, m_MinNivel); DDV_MinMaxInt(pDX, m_MinNivel, 0, 32767); DDX_Text(pDX, IDC_AREAED_MINVNUM, m_MinVnum); DDV_MinMaxInt(pDX, m_MinVnum, 0, 32767); DDX_Text(pDX, IDC_AREAED_NOMBRE, m_Nombre); DDX_Text(pDX, IDC_AREAED_SEGURIDAD, m_Seguridad); DDV_MinMaxInt(pDX, m_Seguridad, 0, 9); DDX_Text(pDX, IDC_AREAED_RECED, m_Recu); DDV_MinMaxLong(pDX, m_Recu, 0, 2000000); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CAreaData, CDialog) //{{AFX_MSG_MAP(CAreaData) ON_LBN_SELCHANGE(IDC_AREAED_RECLIST, OnSelchangeAreaedReclist) ON_EN_CHANGE(IDC_AREAED_RECED, OnChangeAreaedReced) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CAreaData message handlers BOOL CAreaData::OnInitDialog() { CDialog::OnInitDialog(); m_MaxNivelSpin.SetBuddy( GetDlgItem( IDC_AREAED_MAXNIVEL ) ); m_MinNivelSpin.SetBuddy( GetDlgItem( IDC_AREAED_MINNIVEL ) ); m_MaxVnumSpin.SetBuddy( GetDlgItem( IDC_AREAED_MAXVNUM ) ); m_MinVnumSpin.SetBuddy( GetDlgItem( IDC_AREAED_MINVNUM ) ); m_SeguridadSpin.SetBuddy( GetDlgItem( IDC_AREAED_SEGURIDAD ) ); m_RecSpin.SetBuddy( GetDlgItem( IDC_AREAED_RECED ) ); m_MaxNivelSpin.SetRange( 0, 60 ); m_MinNivelSpin.SetRange( 0, 60 ); m_MaxVnumSpin.SetRange( 0, 32767 ); m_MinVnumSpin.SetRange( 0, 32767 ); m_SeguridadSpin.SetRange( 0, 9 ); m_RecSpin.SetRange( 0, UD_MAXVAL ); for ( int i = 0; i < m_recu.GetSize(); i++ ) { int index = m_RecList.AddString( m_recu[i]->m_text ); ASSERT( index != LB_ERR && index != LB_ERRSPACE ); m_RecList.SetItemData( index, i ); } m_RecList.SetCurSel( 0 ); OnSelchangeAreaedReclist(); if ( tables.m_mudtype == MUD_ROMDEFAULT ) { GetDlgItem( IDC_AREAED_AUTORES )->EnableWindow( FALSE ); GetDlgItem( IDC_AREAED_SEGURIDAD )->EnableWindow( FALSE ); GetDlgItem( IDC_AREAED_MINNIVEL )->EnableWindow( FALSE ); GetDlgItem( IDC_AREAED_MAXNIVEL )->EnableWindow( FALSE ); GetDlgItem( IDC_AREAED_RECLIST )->EnableWindow( FALSE ); GetDlgItem( IDC_AREAED_RECED )->EnableWindow( FALSE ); } if ( tables.m_mudtype == MUD_ROMOLC ) { GetDlgItem( IDC_AREAED_MINNIVEL )->EnableWindow( FALSE ); GetDlgItem( IDC_AREAED_MAXNIVEL )->EnableWindow( FALSE ); GetDlgItem( IDC_AREAED_RECLIST )->EnableWindow( FALSE ); GetDlgItem( IDC_AREAED_RECED )->EnableWindow( FALSE ); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CAreaData::OnSelchangeAreaedReclist() { int sel; UpdateData( TRUE ); if ( ( sel = m_RecList.GetCurSel() ) == LB_ERR ) { GetDlgItem( IDC_AREAED_RECED )->EnableWindow( FALSE ); m_Recu = 0; UpdateData( FALSE ); return; } GetDlgItem( IDC_AREAED_RECED )->EnableWindow(); int index = m_RecList.GetItemData( sel ); m_Recu = m_recu[index]->m_num; UpdateData( FALSE ); } void CAreaData::OnChangeAreaedReced() { int sel = m_RecList.GetCurSel(); if ( sel == LB_ERR ) return; UpdateData( TRUE ); int index = m_RecList.GetItemData( sel ); m_recu[index]->m_num = m_Recu; }