home *** CD-ROM | disk | FTP | other *** search
/ Large Pack of OldSkool DOS MOD Trackers / beaversweeper_v101.zip / src / SendFxView10.cpp < prev    next >
C/C++ Source or Header  |  2003-01-06  |  3KB  |  150 lines

  1. // SendFxView10.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "tracker.h"
  6.  
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12.  
  13. #include "SendFxView10.h"
  14. #include "isSynth.h"
  15. #include "trackerdoc.h"
  16. #include "DSPEffectTemplate.h"
  17.  
  18.  
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CSendFxView
  21.  
  22. IMPLEMENT_DYNCREATE(CSendFxView, CFormView)
  23.  
  24. CSendFxView::CSendFxView()
  25.     : CFormView(CSendFxView::IDD)
  26. {
  27.     //{{AFX_DATA_INIT(CSendFxView)
  28.     //}}AFX_DATA_INIT
  29. }
  30.  
  31. CSendFxView::~CSendFxView()
  32. {
  33. }
  34.  
  35. void CSendFxView::DoDataExchange(CDataExchange* pDX)
  36. {
  37.     CFormView::DoDataExchange(pDX);
  38.     //{{AFX_DATA_MAP(CSendFxView)
  39.     DDX_Control(pDX, IDC_COMBO1, m_chainsel);
  40.     //}}AFX_DATA_MAP
  41. }
  42.  
  43.  
  44. BEGIN_MESSAGE_MAP(CSendFxView, CFormView)
  45.     //{{AFX_MSG_MAP(CSendFxView)
  46.     ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  47.     //}}AFX_MSG_MAP
  48. END_MESSAGE_MAP()
  49.  
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CSendFxView diagnostics
  52.  
  53. #ifdef _DEBUG
  54. void CSendFxView::AssertValid() const
  55. {
  56.     CFormView::AssertValid();
  57. }
  58.  
  59. void CSendFxView::Dump(CDumpContext& dc) const
  60. {
  61.     CFormView::Dump(dc);
  62. }
  63. #endif //_DEBUG
  64.  
  65. /////////////////////////////////////////////////////////////////////////////
  66. // CSendFxView message handlers
  67.  
  68. void CSendFxView::OnInitialUpdate() 
  69. {
  70.     CFormView::OnInitialUpdate();
  71.     
  72.     // TODO: Add your specialized code here and/or call the base class
  73.     m_chainsel.AddString( _T("EffectChain 1") );
  74.     m_chainsel.AddString( _T("EffectChain 2") );
  75.     m_chainsel.AddString( _T("EffectChain 3") );
  76.     m_chainsel.SetCurSel(0);
  77.  
  78.     m_effect_template[0] = 0;
  79.     m_effect_template[1] = 0;
  80.     m_effect_template[2] = 0;
  81.  
  82.     m_current_chain = 0;
  83.  
  84.     OnSelchangeCombo1();
  85.     
  86.     
  87. }
  88.  
  89. void CSendFxView::OnSelchangeCombo1() 
  90. {
  91.     // TODO: Add your control notification handler code here
  92.  
  93.     // ta bort redan existerande
  94.     for (int i=0;i<3;i++) {        
  95.         if (m_effect_template[i]) {
  96.             delete m_effect_template[i];
  97.             m_effect_template[i] = 0;
  98.         }
  99.     }
  100.     
  101.     CTrackerDoc *doc = (CTrackerDoc*) GetDocument();    
  102.  
  103.     m_current_chain = 0;
  104.  
  105.     if (!doc) return;
  106.     isSynth *synth = doc->synth;
  107.     if (!synth) return;
  108.     int sel = m_chainsel.GetCurSel();
  109.     if (sel < 0)
  110.         return;
  111.     if (sel >= 3)
  112.         return;
  113.  
  114.     // hΣmta effektchain
  115.     m_current_chain = &synth->effectChain[ sel ];
  116.  
  117.     updateChain();
  118.         
  119. }
  120.  
  121.  
  122. void CSendFxView::updateChain(void)
  123. {
  124.     if (!m_current_chain)
  125.         return;
  126.  
  127.     // Position?
  128.     POINT p;
  129.     p.x = 10;
  130.     p.y = 40;
  131.     int spacing = 1;
  132.  
  133.     CTrackerDoc *doc = (CTrackerDoc *) GetDocument();
  134.  
  135.     // TODO: Add your control notification handler code here
  136.     for (int i=0;i<3;i++) {
  137.         WINDOWPLACEMENT pm;
  138.         m_effect_template[i] = new CDSPEffectTemplate();
  139.         m_effect_template[i]->setChain( m_current_chain, i );
  140.         m_effect_template[i]->Create( IDD_SENDFX_TEMPLATE, this );    
  141.         m_effect_template[i]->SetWindowPos( 0, p.x, p.y, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW );
  142.         m_effect_template[i]->GetWindowPlacement( &pm );
  143.         m_effect_template[i]->setPlayer( doc ? doc->pl : 0 );
  144.         //p.y += tmp.bottom - tmp.left;
  145.         p.y += pm.rcNormalPosition.bottom - pm.rcNormalPosition.top + spacing;
  146.  
  147.     }
  148.  
  149. }
  150.