Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

WaveOpen.cpp

Go to the documentation of this file.
00001 /*
00002 ===========================================================================
00003 Copyright (C) 1999-2005 Id Software, Inc.
00004 
00005 This file is part of Quake III Arena source code.
00006 
00007 Quake III Arena source code is free software; you can redistribute it
00008 and/or modify it under the terms of the GNU General Public License as
00009 published by the Free Software Foundation; either version 2 of the License,
00010 or (at your option) any later version.
00011 
00012 Quake III Arena source code is distributed in the hope that it will be
00013 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Foobar; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 ===========================================================================
00021 */
00022 // WaveOpen.cpp : implementation file
00023 //
00024 
00025 #include "stdafx.h"
00026 #include "Radiant.h"
00027 #include "WaveOpen.h"
00028 #include "mmsystem.h"
00029 
00030 #ifdef _DEBUG
00031 #define new DEBUG_NEW
00032 #undef THIS_FILE
00033 static char THIS_FILE[] = __FILE__;
00034 #endif
00035 
00037 // CWaveOpen
00038 
00039 IMPLEMENT_DYNAMIC(CWaveOpen, CFileDialog)
00040 
00041 CWaveOpen::CWaveOpen(BOOL bOpenFileDialog, LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
00042         DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) :
00043         CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd)
00044 {
00045   m_ofn.Flags |= (OFN_EXPLORER | OFN_ENABLETEMPLATE);
00046   m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_PLAYWAVE);
00047 }
00048 
00049 
00050 BEGIN_MESSAGE_MAP(CWaveOpen, CFileDialog)
00051     //{{AFX_MSG_MAP(CWaveOpen)
00052     ON_BN_CLICKED(IDC_BTN_PLAY, OnBtnPlay)
00053     //}}AFX_MSG_MAP
00054 END_MESSAGE_MAP()
00055 
00056 
00057 void CWaveOpen::OnFileNameChange()
00058 {
00059   CString str = GetPathName();
00060   str.MakeLower();
00061   CWnd *pWnd = GetDlgItem(IDC_BTN_PLAY);
00062   if (pWnd == NULL)
00063   {
00064     return;
00065   }
00066   if (str.Find(".wav") >= 0)
00067   {
00068     pWnd->EnableWindow(TRUE);
00069   }
00070   else
00071   {
00072     pWnd->EnableWindow(FALSE);
00073   }
00074 }
00075 
00076 void CWaveOpen::OnBtnPlay() 
00077 {
00078   sndPlaySound(NULL, NULL);
00079   CString str = GetPathName();
00080   if (str.GetLength() > 0)
00081   {
00082     sndPlaySound(str, SND_FILENAME | SND_ASYNC);
00083   }
00084 }
00085 
00086 BOOL CWaveOpen::OnInitDialog() 
00087 {
00088     CFileDialog::OnInitDialog();
00089     
00090   CWnd *pWnd = GetDlgItem(IDC_BTN_PLAY);
00091   if (pWnd != NULL)
00092   {
00093     pWnd->EnableWindow(FALSE);
00094   }
00095     
00096     return TRUE;  // return TRUE unless you set the focus to a control
00097                   // EXCEPTION: OCX Property Pages should return FALSE
00098 }

Generated on Thu Aug 25 12:38:42 2005 for Quake III Arena by  doxygen 1.3.9.1