-rw-r--r-- | PropsSounds.cpp | 146 |
1 files changed, 0 insertions, 146 deletions
diff --git a/PropsSounds.cpp b/PropsSounds.cpp deleted file mode 100644 index a6f68d7..0000000 --- a/PropsSounds.cpp +++ b/dev/null | |||
@@ -1,146 +0,0 @@ | |||
1 | // PropsSounds.cpp : implementation file | ||
2 | // | ||
3 | |||
4 | #include "stdafx.h" | ||
5 | #include "PumpKIN.h" | ||
6 | #include "PropsSounds.h" | ||
7 | #include "PumpKINDlg.h" | ||
8 | |||
9 | #ifdef _DEBUG | ||
10 | #define new DEBUG_NEW | ||
11 | #undef THIS_FILE | ||
12 | static char THIS_FILE[] = __FILE__; | ||
13 | #endif | ||
14 | |||
15 | ///////////////////////////////////////////////////////////////////////////// | ||
16 | // CPropsSounds property page | ||
17 | |||
18 | IMPLEMENT_DYNCREATE(CPropsSounds, CPropertyPage) | ||
19 | |||
20 | CPropsSounds::CPropsSounds() : CPropertyPage(CPropsSounds::IDD) | ||
21 | { | ||
22 | //{{AFX_DATA_INIT(CPropsSounds) | ||
23 | m_Abort = _T(""); | ||
24 | m_Success = _T(""); | ||
25 | m_Request = _T(""); | ||
26 | //}}AFX_DATA_INIT | ||
27 | } | ||
28 | |||
29 | CPropsSounds::~CPropsSounds() | ||
30 | { | ||
31 | } | ||
32 | |||
33 | void CPropsSounds::DoDataExchange(CDataExchange* pDX) | ||
34 | { | ||
35 | CPropertyPage::DoDataExchange(pDX); | ||
36 | //{{AFX_DATA_MAP(CPropsSounds) | ||
37 | DDX_Control(pDX, IDC_RING_PLAY, m_RequestPlayCtl); | ||
38 | DDX_Control(pDX, IDC_RING_BROWSE, m_RequestBrowseCtl); | ||
39 | DDX_Control(pDX, IDC_RING, m_RequestCtl); | ||
40 | DDX_Control(pDX, IDC_FINISHED_PLAY, m_SuccessPlayCtl); | ||
41 | DDX_Control(pDX, IDC_FINISHED_BROWSE, m_SuccessBrowseCtl); | ||
42 | DDX_Control(pDX, IDC_FINISHED, m_SuccessCtl); | ||
43 | DDX_Control(pDX, IDC_ABORTED_PLAY, m_AbortPlayCtl); | ||
44 | DDX_Control(pDX, IDC_ABORTED_BROWSE, m_AbortBrowseCtl); | ||
45 | DDX_Control(pDX, IDC_ABORTED, m_AbortCtl); | ||
46 | DDX_CBString(pDX, IDC_ABORTED, m_Abort); | ||
47 | DDX_CBString(pDX, IDC_FINISHED, m_Success); | ||
48 | DDX_CBString(pDX, IDC_RING, m_Request); | ||
49 | //}}AFX_DATA_MAP | ||
50 | } | ||
51 | |||
52 | |||
53 | BEGIN_MESSAGE_MAP(CPropsSounds, CPropertyPage) | ||
54 | //{{AFX_MSG_MAP(CPropsSounds) | ||
55 | ON_BN_CLICKED(IDC_ABORTED_BROWSE, OnAbortedBrowse) | ||
56 | ON_BN_CLICKED(IDC_FINISHED_BROWSE, OnFinishedBrowse) | ||
57 | ON_BN_CLICKED(IDC_RING_BROWSE, OnRingBrowse) | ||
58 | ON_BN_CLICKED(IDC_ABORTED_PLAY, OnAbortedPlay) | ||
59 | ON_BN_CLICKED(IDC_FINISHED_PLAY, OnFinishedPlay) | ||
60 | ON_BN_CLICKED(IDC_RING_PLAY, OnRingPlay) | ||
61 | //}}AFX_MSG_MAP | ||
62 | END_MESSAGE_MAP() | ||
63 | |||
64 | ///////////////////////////////////////////////////////////////////////////// | ||
65 | // CPropsSounds message handlers | ||
66 | |||
67 | BOOL CPropsSounds::OnInitDialog() | ||
68 | { | ||
69 | CPropertyPage::OnInitDialog(); | ||
70 | |||
71 | HICON hP = AfxGetApp()->LoadIcon(IDI_PLAY); | ||
72 | HICON hB = AfxGetApp()->LoadIcon(IDI_BROWSE); | ||
73 | m_RequestPlayCtl.SetIcon(hP); | ||
74 | m_SuccessPlayCtl.SetIcon(hP); | ||
75 | m_AbortPlayCtl.SetIcon(hP); | ||
76 | m_RequestBrowseCtl.SetIcon(hB); | ||
77 | m_SuccessBrowseCtl.SetIcon(hB); | ||
78 | m_AbortBrowseCtl.SetIcon(hB); | ||
79 | |||
80 | CPumpKINDlg* pd = (CPumpKINDlg*)AfxGetMainWnd(); | ||
81 | //ASSERT_KINDOF(CPumpKINDlg,pd); | ||
82 | m_bnw=&pd->m_bnw; | ||
83 | |||
84 | m_bnw->FillInCombo(&m_RequestCtl); | ||
85 | m_bnw->FillInCombo(&m_SuccessCtl); | ||
86 | m_bnw->FillInCombo(&m_AbortCtl); | ||
87 | |||
88 | return TRUE; // return TRUE unless you set the focus to a control | ||
89 | // EXCEPTION: OCX Property Pages should return FALSE | ||
90 | } | ||
91 | |||
92 | void CPropsSounds::OnAbortedBrowse() | ||
93 | { | ||
94 | Browse(m_AbortCtl); | ||
95 | } | ||
96 | void CPropsSounds::OnFinishedBrowse() | ||
97 | { | ||
98 | Browse(m_SuccessCtl); | ||
99 | } | ||
100 | void CPropsSounds::OnRingBrowse() | ||
101 | { | ||
102 | Browse(m_RequestCtl); | ||
103 | } | ||
104 | |||
105 | void CPropsSounds::OnAbortedPlay() | ||
106 | { | ||
107 | Play(m_AbortCtl); | ||
108 | } | ||
109 | |||
110 | void CPropsSounds::OnFinishedPlay() | ||
111 | { | ||
112 | Play(m_SuccessCtl); | ||
113 | } | ||
114 | |||
115 | void CPropsSounds::OnRingPlay() | ||
116 | { | ||
117 | Play(m_RequestCtl); | ||
118 | } | ||
119 | |||
120 | void CPropsSounds::Browse(CComboBox& ctl) | ||
121 | { | ||
122 | CString f; | ||
123 | ctl.GetWindowText(f); | ||
124 | CString filter; | ||
125 | filter.LoadString(IDS_FILTER_WAV); | ||
126 | CFileDialog fd(TRUE,NULL,(LPCTSTR)f, | ||
127 | OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY | ||
128 | |OFN_LONGNAMES|OFN_NOCHANGEDIR|OFN_PATHMUSTEXIST, | ||
129 | filter,this); | ||
130 | CString title; | ||
131 | title.LoadString(IDS_TITLE_WAV); | ||
132 | fd.m_ofn.lpstrTitle=(LPCTSTR)title; | ||
133 | if(fd.DoModal()==IDOK) | ||
134 | ctl.SetWindowText(fd.GetPathName()); | ||
135 | } | ||
136 | |||
137 | void CPropsSounds::Play(CComboBox& ctl) | ||
138 | { | ||
139 | CString s; | ||
140 | ctl.GetWindowText(s); | ||
141 | CBellsNWhistles::Whistling w = m_bnw->StartSound(s); | ||
142 | if(w){ | ||
143 | Sleep(5000); | ||
144 | m_bnw->StopSound(w); | ||
145 | } | ||
146 | } | ||