summaryrefslogtreecommitdiffabout
path: root/PropsSounds.cpp
authorMichael Krelin <hacker@klever.net>2004-07-05 01:53:09 (UTC)
committer Michael Krelin <hacker@klever.net>2004-07-05 01:53:09 (UTC)
commit9938ea772d372ba955b7bc1f1c48a062c3a36f8a (patch) (unidiff)
treea98185df944e3a763f9557aa74bc2837b343f048 /PropsSounds.cpp
downloadpumpkin-9938ea772d372ba955b7bc1f1c48a062c3a36f8a.zip
pumpkin-9938ea772d372ba955b7bc1f1c48a062c3a36f8a.tar.gz
pumpkin-9938ea772d372ba955b7bc1f1c48a062c3a36f8a.tar.bz2
initial commit into svn repository
git-svn-id: http://svn.klever.net/kin/pumpkin/trunk@1 fe716a7a-6dde-0310-88d9-d003556173a8
Diffstat (limited to 'PropsSounds.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--PropsSounds.cpp146
1 files changed, 146 insertions, 0 deletions
diff --git a/PropsSounds.cpp b/PropsSounds.cpp
new file mode 100644
index 0000000..a6f68d7
--- a/dev/null
+++ b/PropsSounds.cpp
@@ -0,0 +1,146 @@
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
12static char THIS_FILE[] = __FILE__;
13#endif
14
15/////////////////////////////////////////////////////////////////////////////
16// CPropsSounds property page
17
18IMPLEMENT_DYNCREATE(CPropsSounds, CPropertyPage)
19
20CPropsSounds::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
29CPropsSounds::~CPropsSounds()
30{
31}
32
33void 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
53BEGIN_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
62END_MESSAGE_MAP()
63
64/////////////////////////////////////////////////////////////////////////////
65// CPropsSounds message handlers
66
67BOOL CPropsSounds::OnInitDialog()
68{
69 CPropertyPage::OnInitDialog();
70
71HICON hP = AfxGetApp()->LoadIcon(IDI_PLAY);
72HICON 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
80CPumpKINDlg* 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
92void CPropsSounds::OnAbortedBrowse()
93{
94 Browse(m_AbortCtl);
95}
96void CPropsSounds::OnFinishedBrowse()
97{
98 Browse(m_SuccessCtl);
99}
100void CPropsSounds::OnRingBrowse()
101{
102 Browse(m_RequestCtl);
103}
104
105void CPropsSounds::OnAbortedPlay()
106{
107 Play(m_AbortCtl);
108}
109
110void CPropsSounds::OnFinishedPlay()
111{
112 Play(m_SuccessCtl);
113}
114
115void CPropsSounds::OnRingPlay()
116{
117 Play(m_RequestCtl);
118}
119
120void CPropsSounds::Browse(CComboBox& ctl)
121{
122CString f;
123 ctl.GetWindowText(f);
124CString filter;
125 filter.LoadString(IDS_FILTER_WAV);
126CFileDialog fd(TRUE,NULL,(LPCTSTR)f,
127 OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY
128 |OFN_LONGNAMES|OFN_NOCHANGEDIR|OFN_PATHMUSTEXIST,
129 filter,this);
130CString 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
137void CPropsSounds::Play(CComboBox& ctl)
138{
139CString s;
140 ctl.GetWindowText(s);
141CBellsNWhistles::Whistling w = m_bnw->StartSound(s);
142 if(w){
143 Sleep(5000);
144 m_bnw->StopSound(w);
145 }
146}