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

  1. #include "precompile.h"
  2. #include "modeledit.h"
  3. #include "ImportLODDlg.h"
  4.  
  5. using namespace std;
  6.  
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12.  
  13.  
  14. BEGIN_MESSAGE_MAP( CImportLODDlg, CDialog )
  15.     ON_WM_CONTEXTMENU()
  16.     ON_COMMAND(ID_IMPORTLODS_EXPANDALL, OnPieceExpandAll)
  17.     ON_COMMAND(ID_IMPORTLODS_COLLAPSEALL, OnPieceCollapseAll)
  18. END_MESSAGE_MAP()
  19.  
  20.  
  21. CImportLODDlg::CImportLODDlg( CWnd* parent /*=NULL*/ )
  22.     : CDialog( CImportLODDlg::IDD, parent )
  23. {
  24. }
  25.  
  26.  
  27. void CImportLODDlg::DoDataExchange( CDataExchange* pDX )
  28. {
  29.     CDialog::DoDataExchange( pDX );
  30.  
  31.     // load the dialog data
  32.     if( !pDX->m_bSaveAndValidate )
  33.     {
  34.     }
  35.     // retrieve the dialog data
  36.     else
  37.     {
  38.         m_ModelEditDlg->GetSelectedPieceLODs( &m_PieceList, m_ImportModel, m_Selection );
  39.     }
  40. }
  41.  
  42.  
  43. BOOL CImportLODDlg::OnInitDialog( void )
  44. {
  45.     CDialog::OnInitDialog();
  46.  
  47.     // Set up the lod list
  48.     m_PieceList.SubclassDlgItem( IDC_PIECES, this );
  49.     m_PieceList.EnableMultiSelect( TRUE );
  50.     m_PieceList.EnableEditText( FALSE );
  51.  
  52.     m_ModelEditDlg->FillPieceList( &m_PieceList, m_ImportModel );
  53.  
  54.     UpdateData( FALSE );
  55.  
  56.     return TRUE;
  57. }
  58.  
  59.  
  60. void CImportLODDlg::OnContextMenu( CWnd* pWnd, CPoint point ) 
  61. {
  62.     CMenu menu;
  63.     
  64.     if( pWnd->m_hWnd == m_PieceList.m_hWnd )
  65.     {
  66.         VERIFY( menu.LoadMenu( IDR_IMPORTLODS ) );
  67.     }
  68.     else return;
  69.  
  70.     CMenu* popup = menu.GetSubMenu( 0 );
  71.     ASSERT( popup );
  72.  
  73.     popup->TrackPopupMenu( TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this );
  74. }
  75.  
  76.  
  77. void CImportLODDlg::OnPieceExpandAll( void )
  78. {
  79.     m_PieceList.ExpandAll();
  80. }
  81.  
  82.  
  83. void CImportLODDlg::OnPieceCollapseAll( void )
  84. {
  85.     m_PieceList.CollapseAll();
  86.     m_PieceList.ClearSelection();
  87. }
  88.