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

  1. // InsertMain.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "tracker.h"
  6. #include "InsertMain.h"
  7. #include "insertfilter.h"
  8. #include "insertDist.h"
  9. #include "isSynth.h"
  10. #include "isDistortion.h"
  11. #include "isInsert.h"
  12.  
  13. #ifdef _DEBUG
  14. #define new DEBUG_NEW
  15. #undef THIS_FILE
  16. static char THIS_FILE[] = __FILE__;
  17. #endif
  18.  
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CInsertMain dialog
  21. static char *modnames[]=
  22. {
  23.     "unused",
  24.         "ENVELOPE",
  25.         "LFO",
  26.         "CONTROLLER",
  27.         "OSCILLATOR",
  28.         
  29.         // inserts
  30.         "FILTER",
  31.         "DISTORTION",
  32.         
  33.         // stereo fx
  34.         "DELAY",
  35.         "CHORUS",        
  36.         NULL,    
  37. };
  38.  
  39.  
  40. CInsertMain::CInsertMain(CWnd* pParent /*=NULL*/)
  41.     : CVoiceBaseDlg(CInsertMain::IDD, pParent)
  42. {
  43.     //{{AFX_DATA_INIT(CInsertMain)
  44.         // NOTE: the ClassWizard will add member initialization here
  45.     //}}AFX_DATA_INIT
  46. }
  47.  
  48.  
  49. void CInsertMain::DoDataExchange(CDataExchange* pDX)
  50. {
  51.     CVoiceBaseDlg::DoDataExchange(pDX);
  52.     //{{AFX_DATA_MAP(CInsertMain)
  53.     DDX_Control(pDX, IDC_STATIC_INSWIN, m_inswin);
  54.     DDX_Control(pDX, IDC_LIST_INSERTS, m_listInsert);
  55.     //}}AFX_DATA_MAP
  56. }
  57.  
  58.  
  59. BEGIN_MESSAGE_MAP(CInsertMain, CVoiceBaseDlg)
  60.     //{{AFX_MSG_MAP(CInsertMain)
  61.     ON_LBN_SELCHANGE(IDC_LIST_INSERTS, OnSelchangeListInserts)
  62.     ON_BN_CLICKED(IDC_BUTTON_INSDIST, OnButtonInsdist)
  63.     ON_BN_CLICKED(IDC_BUTTON_INSFILTER, OnButtonInsfilter)
  64.     ON_BN_CLICKED(IDC_BUTTON_DELINSERT, OnButtonDelinsert)
  65.     //}}AFX_MSG_MAP
  66. END_MESSAGE_MAP()
  67.  
  68. /////////////////////////////////////////////////////////////////////////////
  69. // CInsertMain message handlers
  70.  
  71. void CInsertMain::UpdateVoiceData()
  72. {
  73.     m_listInsert.ResetContent();
  74.     isInsert *ins;
  75.     int i;
  76.     for (i=0;i<voice->GetNrOfInserts();i++)
  77.     {
  78.         ins = voice->GetInsert(i);
  79.         m_listInsert.InsertString(i,modnames[ins->GetType()]);
  80.         m_listInsert.SetItemData(i,ins->GetType());
  81.         
  82.         //m_modlist.InsertItem (0,"envelope");
  83.     }
  84.     int typ;
  85.     m_listInsert.SetCurSel(curselins);
  86.     typ = m_listInsert.GetItemData(curselins);
  87.     switch (typ)
  88.     {
  89.     case is_FILTER :
  90.         current = filed;
  91.         break;
  92.     case is_DISTORTION :
  93.         current = disted;
  94.         break;
  95.     }
  96.     
  97.  
  98.     CRect wrect;
  99.     current->SetVoice (voice->GetInsert(curselins),voice,instrument,synth);
  100.     current->UpdateInsertData(); 
  101.     current->GetClientRect(&wrect);
  102.     current->MoveWindow(4,20,wrect.Width(),wrect.Height());
  103.     current->ShowWindow(SW_SHOW);
  104.  
  105.     
  106.     
  107. }
  108. void CInsertMain::OnSelchangeListInserts() 
  109. {
  110.     // TODO: Add your control notification handler code here
  111.     int typ;
  112.     curselins = m_listInsert.GetCurSel();
  113.     
  114.  
  115.     typ = m_listInsert.GetItemData(curselins);
  116.     current->ShowWindow(SW_HIDE);
  117.  
  118.     switch (typ)
  119.     {
  120.         case is_FILTER :
  121.             current = filed;
  122.             break;
  123.         case is_DISTORTION :
  124.             current = disted;
  125.             break;
  126.     }
  127.  
  128.     CRect wrect;
  129.     
  130.     current->SetVoice (voice->GetInsert(curselins),voice,instrument,synth);
  131.     current->UpdateInsertData(); 
  132.     current->GetClientRect(&wrect);
  133.     current->MoveWindow(4,20,wrect.Width(),wrect.Height());
  134.     
  135.     current->ShowWindow(SW_SHOW);
  136.     
  137. }
  138.  
  139. BOOL CInsertMain::OnInitDialog() 
  140. {
  141.     CVoiceBaseDlg::OnInitDialog();
  142.     CRect wrect;
  143.     
  144.     curselins=0;
  145.     filed= (CInsertBaseDlg *)new CInsertFilter();
  146.     disted= (CInsertBaseDlg *)new CInsertDist();
  147.     //lfoed = (CModulateBaseDlg *)new CModLfo();
  148.     
  149.     filed->Create(MAKEINTRESOURCE(IDD_DIALOG_INSERTFILTER),&m_inswin);
  150.     disted->Create(MAKEINTRESOURCE(IDD_DIALOG_INSERTDIST),&m_inswin);
  151.     
  152.     
  153.     current = filed;
  154.     current->GetClientRect(&wrect);
  155.     current->MoveWindow(4,20,wrect.Width(),wrect.Height());
  156.     
  157.     current->UpdateWindow();
  158.     current->ShowWindow(SW_HIDE);
  159.     curselins=0;
  160.     // TODO: Add extra initialization here
  161.     
  162.     return TRUE;  // return TRUE unless you set the focus to a control
  163.                   // EXCEPTION: OCX Property Pages should return FALSE
  164. }
  165.  
  166. void CInsertMain::OnButtonInsdist() 
  167. {
  168.     // TODO: Add your control notification handler code here
  169.     voice->AddInsert(is_DISTORTION);    
  170.     UpdateVoiceData();
  171. }
  172.  
  173. void CInsertMain::OnButtonInsfilter() 
  174. {
  175.     // TODO: Add your control notification handler code here
  176.     voice->AddInsert(is_FILTER);
  177.     UpdateVoiceData();    
  178. }
  179.  
  180. void CInsertMain::OnButtonDelinsert() 
  181. {
  182.     // TODO: Add your control notification handler code here
  183.     voice->DelInsert();
  184.     UpdateVoiceData();
  185.     
  186. }
  187.