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 "resource.h"
\r
22 #include "AppUtils.h"
\r
23 #include "PathUtils.h"
\r
24 #include ".\soundutils.h"
\r
26 #pragma comment(lib, "Winmm")
\r
28 CSoundUtils::CSoundUtils(void)
\r
32 CSoundUtils::~CSoundUtils(void)
\r
36 void CSoundUtils::RegisterTSVNSounds()
\r
38 // create the event labels
\r
39 CRegString eventlabelerr = CRegString(_T("AppEvents\\EventLabels\\TSVN_Error\\"));
\r
40 eventlabelerr = CString(MAKEINTRESOURCE(IDS_ERR_ERROR));
\r
41 CRegString eventlabelwarn = CRegString(_T("AppEvents\\EventLabels\\TSVN_Warning\\"));
\r
42 eventlabelwarn = CString(MAKEINTRESOURCE(IDS_WARN_WARNING));
\r
43 CRegString eventlabelnote = CRegString(_T("AppEvents\\EventLabels\\TSVN_Notification\\"));
\r
44 eventlabelnote = CString(MAKEINTRESOURCE(IDS_WARN_NOTE));
\r
46 CRegString appscheme = CRegString(_T("AppEvents\\Schemes\\Apps\\TortoiseProc\\"));
\r
47 appscheme = _T("TortoiseSVN");
\r
49 CString apppath = CPathUtils::GetAppDirectory();
\r
51 CRegistryKey schemenamekey = CRegistryKey(_T("AppEvents\\Schemes\\Names"));
\r
52 CStringList schemenames;
\r
53 schemenamekey.getSubKeys(schemenames);
\r
54 // if the sound scheme has been modified but not save under a different name,
\r
55 // the name of the sound scheme is ".current" and not under the names list.
\r
56 // so add the .current scheme to the list too
\r
57 schemenames.AddHead(_T(".current"));
\r
59 for (pos = schemenames.GetHeadPosition(); pos != NULL;)
\r
61 CString name = schemenames.GetNext(pos);
\r
62 if ((name.CompareNoCase(_T(".none"))!=0)&&(name.CompareNoCase(_T(".nosound"))!=0))
\r
64 CString errorkey = _T("AppEvents\\Schemes\\Apps\\TortoiseProc\\TSVN_Error\\") + name + _T("\\");
\r
65 CRegString errorkeyval = CRegString(errorkey);
\r
66 if (((CString)(errorkeyval)).IsEmpty())
\r
68 errorkeyval = apppath + _T("TortoiseSVN_Error.wav");
\r
70 CString warnkey = _T("AppEvents\\Schemes\\Apps\\TortoiseProc\\TSVN_Warning\\") + name + _T("\\");
\r
71 CRegString warnkeyval = CRegString(warnkey);
\r
72 if (((CString)(warnkeyval)).IsEmpty())
\r
74 warnkeyval = apppath + _T("TortoiseSVN_Warning.wav");
\r
76 CString notificationkey = _T("AppEvents\\Schemes\\Apps\\TortoiseProc\\TSVN_Notification\\") + name + _T("\\");
\r
77 CRegString notificationkeyval = CRegString(notificationkey);
\r
78 if (((CString)(notificationkeyval)).IsEmpty())
\r
80 notificationkeyval = apppath + _T("TortoiseSVN_Notification.wav");
\r
86 void CSoundUtils::PlayTSVNWarning()
\r
88 PlaySound(_T("TSVN_Warning"), NULL, SND_APPLICATION | SND_ASYNC | SND_NODEFAULT);
\r
91 void CSoundUtils::PlayTSVNError()
\r
93 PlaySound(_T("TSVN_Error"), NULL, SND_APPLICATION | SND_ASYNC | SND_NODEFAULT);
\r
96 void CSoundUtils::PlayTSVNNotification()
\r
98 PlaySound(_T("TSVN_Notification"), NULL, SND_APPLICATION | SND_ASYNC | SND_NODEFAULT);
\r