home *** CD-ROM | disk | FTP | other *** search
/ Xentax forum attachments archive / xentax.7z / 8090 / ModelEdit.7z / WeightSetSelectDlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2006-03-08  |  1.8 KB  |  79 lines

  1. // WeightSetSelectDlg.cpp : implementation file
  2. //
  3.  
  4. #include "precompile.h"
  5. #include "modeledit.h"
  6. #include "WeightSetSelectDlg.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // WeightSetSelectDlg dialog
  16.  
  17.  
  18. WeightSetSelectDlg::WeightSetSelectDlg(Model *pModel, DWORD iStartingSel, CWnd* pParent /*=NULL*/)
  19.     : CDialog(WeightSetSelectDlg::IDD, pParent)
  20. {
  21.     //{{AFX_DATA_INIT(WeightSetSelectDlg)
  22.         // NOTE: the ClassWizard will add member initialization here
  23.     //}}AFX_DATA_INIT
  24.  
  25.     m_pModel = pModel;
  26.     m_SelectedSet = iStartingSel;
  27. }
  28.  
  29.  
  30. void WeightSetSelectDlg::DoDataExchange(CDataExchange* pDX)
  31. {
  32.     CDialog::DoDataExchange(pDX);
  33.     //{{AFX_DATA_MAP(WeightSetSelectDlg)
  34.     DDX_Control(pDX, IDC_WEIGHTSETS, m_WeightSets);
  35.     //}}AFX_DATA_MAP
  36. }
  37.  
  38.  
  39. BEGIN_MESSAGE_MAP(WeightSetSelectDlg, CDialog)
  40.     //{{AFX_MSG_MAP(WeightSetSelectDlg)
  41.     //}}AFX_MSG_MAP
  42. END_MESSAGE_MAP()
  43.  
  44. /////////////////////////////////////////////////////////////////////////////
  45. // WeightSetSelectDlg message handlers
  46.  
  47. void WeightSetSelectDlg::OnOK() 
  48. {
  49.     int iSel;
  50.  
  51.     iSel = m_WeightSets.GetCurSel();
  52.     if(iSel >= 0 && iSel < (int)m_pModel->NumWeightSets())
  53.     {
  54.         m_SelectedSet = (DWORD)iSel;
  55.     }
  56.     else
  57.     {
  58.         m_SelectedSet = INVALID_MODEL_WEIGHTSET;
  59.     }
  60.     
  61.     CDialog::OnOK();
  62. }
  63.  
  64. BOOL WeightSetSelectDlg::OnInitDialog() 
  65. {
  66.     DWORD i;
  67.     
  68.     CDialog::OnInitDialog();
  69.  
  70.     for(i=0; i < m_pModel->NumWeightSets(); i++)
  71.     {
  72.         m_WeightSets.AddString(m_pModel->GetWeightSet(i)->GetName());
  73.     }
  74.     m_WeightSets.SetCurSel((int)m_SelectedSet);
  75.     
  76.     return TRUE;  // return TRUE unless you set the focus to a control
  77.                   // EXCEPTION: OCX Property Pages should return FALSE
  78. }
  79.