1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2003-2006 - Stefan Kueng
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
20 #include "registry.h"
\r
21 #include "..\TortoiseProc\resource.h"
\r
22 #include "..\TortoiseProc\AppUtils.h"
\r
23 #include "PathUtils.h"
\r
24 #include ".\soundutils.h"
\r
25 #include "mmsystem.h"
\r
27 #pragma comment(lib, "Winmm")
\r
29 CSoundUtils::CSoundUtils(void)
\r
33 CSoundUtils::~CSoundUtils(void)
\r
37 void CSoundUtils::RegisterTGitSounds()
\r
39 // create the event labels
\r
40 CRegString eventlabelerr = CRegString(_T("AppEvents\\EventLabels\\TGit_Error\\"));
\r
41 eventlabelerr = CString(MAKEINTRESOURCE(IDS_ERR_ERROR));
\r
42 CRegString eventlabelwarn = CRegString(_T("AppEvents\\EventLabels\\TGit_Warning\\"));
\r
43 eventlabelwarn = CString(MAKEINTRESOURCE(IDS_WARN_WARNING));
\r
44 CRegString eventlabelnote = CRegString(_T("AppEvents\\EventLabels\\TGit_Notification\\"));
\r
45 eventlabelnote = CString(MAKEINTRESOURCE(IDS_WARN_NOTE));
\r
47 CRegString appscheme = CRegString(_T("AppEvents\\Schemes\\Apps\\TortoiseProc\\"));
\r
48 appscheme = _T("TortoiseGit");
\r
50 CString apppath = CPathUtils::GetAppDirectory();
\r
52 CRegistryKey schemenamekey = CRegistryKey(_T("AppEvents\\Schemes\\Names"));
\r
53 CStringList schemenames;
\r
54 schemenamekey.getSubKeys(schemenames);
\r
55 // if the sound scheme has been modified but not save under a different name,
\r
56 // the name of the sound scheme is ".current" and not under the names list.
\r
57 // so add the .current scheme to the list too
\r
58 schemenames.AddHead(_T(".current"));
\r
60 for (pos = schemenames.GetHeadPosition(); pos != NULL;)
\r
62 CString name = schemenames.GetNext(pos);
\r
63 if ((name.CompareNoCase(_T(".none"))!=0)&&(name.CompareNoCase(_T(".nosound"))!=0))
\r
65 CString errorkey = _T("AppEvents\\Schemes\\Apps\\TortoiseProc\\TGit_Error\\") + name + _T("\\");
\r
66 CRegString errorkeyval = CRegString(errorkey);
\r
67 if (((CString)(errorkeyval)).IsEmpty())
\r
69 errorkeyval = apppath + _T("TortoiseGit_Error.wav");
\r
71 CString warnkey = _T("AppEvents\\Schemes\\Apps\\TortoiseProc\\TGit_Warning\\") + name + _T("\\");
\r
72 CRegString warnkeyval = CRegString(warnkey);
\r
73 if (((CString)(warnkeyval)).IsEmpty())
\r
75 warnkeyval = apppath + _T("TortoiseGit_Warning.wav");
\r
77 CString notificationkey = _T("AppEvents\\Schemes\\Apps\\TortoiseProc\\TGit_Notification\\") + name + _T("\\");
\r
78 CRegString notificationkeyval = CRegString(notificationkey);
\r
79 if (((CString)(notificationkeyval)).IsEmpty())
\r
81 notificationkeyval = apppath + _T("TortoiseGit_Notification.wav");
\r
87 void CSoundUtils::PlayTGitWarning()
\r
89 PlaySound(_T("TGit_Warning"), NULL, SND_APPLICATION | SND_ASYNC | SND_NODEFAULT);
\r
92 void CSoundUtils::PlayTGitError()
\r
94 PlaySound(_T("TGit_Error"), NULL, SND_APPLICATION | SND_ASYNC | SND_NODEFAULT);
\r
97 void CSoundUtils::PlayTGitNotification()
\r
99 PlaySound(_T("TGit_Notification"), NULL, SND_APPLICATION | SND_ASYNC | SND_NODEFAULT);
\r