Add an option to mute all sounds in preferences dialog

Fix #7950, close #9507
This commit is contained in:
mere-human 2021-02-14 17:00:33 +02:00 committed by Don HO
parent ea33a0cb76
commit 6e43ba6ea5
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
10 changed files with 34 additions and 14 deletions

View File

@ -251,7 +251,7 @@ CXX = $(CROSS_COMPILE)g++
CXXFLAGS = $(INCLUDESPECIAL) -DTIXML_USE_STL -DTIXMLA_USE_STL $(UNICODE) -std=c++17 -fpermissive CXXFLAGS = $(INCLUDESPECIAL) -DTIXML_USE_STL -DTIXMLA_USE_STL $(UNICODE) -std=c++17 -fpermissive
INCLUDES = $(patsubst %,-I%,$(DIRS)) -I./include INCLUDES = $(patsubst %,-I%,$(DIRS)) -I./include
LDFLAGS = -Wl,--subsystem,windows -municode -mwindows LDFLAGS = -Wl,--subsystem,windows -municode -mwindows
LIBS = -lcomdlg32 -lcomctl32 -lgdi32 -lole32 -loleacc -lshell32 -lshlwapi -ldbghelp -lversion -lcrypt32 -lsensapi -lwininet -lwintrust -lwinmm -luuid LIBS = -lcomdlg32 -lcomctl32 -lgdi32 -lole32 -loleacc -lshell32 -lshlwapi -ldbghelp -lversion -lcrypt32 -lsensapi -lwininet -lwintrust -luuid
RC = $(CROSS_COMPILE)windres RC = $(CROSS_COMPILE)windres

View File

@ -1052,6 +1052,7 @@ You can define several column markers by using white space to separate the diffe
<Item id="6344" name="Document Peeker"/> <Item id="6344" name="Document Peeker"/>
<Item id="6345" name="Peek on tab"/> <Item id="6345" name="Peek on tab"/>
<Item id="6346" name="Peek on document map"/> <Item id="6346" name="Peek on document map"/>
<Item id="6360" name="Mute all sounds"/>
</MISC> </MISC>
</Preference> </Preference>
<MultiMacro title="Run a Macro Multiple Times"> <MultiMacro title="Run a Macro Multiple Times">

View File

@ -5280,6 +5280,10 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
const TCHAR* saveDlgExtFilterToAllTypes = element->Attribute(TEXT("saveDlgExtFilterToAllTypes")); const TCHAR* saveDlgExtFilterToAllTypes = element->Attribute(TEXT("saveDlgExtFilterToAllTypes"));
if (saveDlgExtFilterToAllTypes) if (saveDlgExtFilterToAllTypes)
_nppGUI._setSaveDlgExtFiltToAllTypes = (lstrcmp(saveDlgExtFilterToAllTypes, TEXT("yes")) == 0); _nppGUI._setSaveDlgExtFiltToAllTypes = (lstrcmp(saveDlgExtFilterToAllTypes, TEXT("yes")) == 0);
const TCHAR * optMuteSounds = element->Attribute(TEXT("muteSounds"));
if (optMuteSounds)
_nppGUI._muteSounds = lstrcmp(optMuteSounds, TEXT("yes")) == 0;
} }
else if (!lstrcmp(nm, TEXT("commandLineInterpreter"))) else if (!lstrcmp(nm, TEXT("commandLineInterpreter")))
{ {
@ -6213,6 +6217,7 @@ void NppParameters::createXmlTreeFromGUIParams()
GUIConfigElement->SetAttribute(TEXT("docPeekOnTab"), _nppGUI._isDocPeekOnTab ? TEXT("yes") : TEXT("no")); GUIConfigElement->SetAttribute(TEXT("docPeekOnTab"), _nppGUI._isDocPeekOnTab ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("docPeekOnMap"), _nppGUI._isDocPeekOnMap ? TEXT("yes") : TEXT("no")); GUIConfigElement->SetAttribute(TEXT("docPeekOnMap"), _nppGUI._isDocPeekOnMap ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("saveDlgExtFilterToAllTypes"), _nppGUI._setSaveDlgExtFiltToAllTypes ? TEXT("yes") : TEXT("no")); GUIConfigElement->SetAttribute(TEXT("saveDlgExtFilterToAllTypes"), _nppGUI._setSaveDlgExtFiltToAllTypes ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("muteSounds"), _nppGUI._muteSounds ? TEXT("yes") : TEXT("no"));
} }
// <GUIConfig name="Searching" "monospacedFontFindDlg"="no" stopFillingFindField="no" findDlgAlwaysVisible="no" confirmReplaceOpenDocs="yes" confirmMacroReplaceOpenDocs="yes" confirmReplaceInFiles="yes" confirmMacroReplaceInFiles="yes" /> // <GUIConfig name="Searching" "monospacedFontFindDlg"="no" stopFillingFindField="no" findDlgAlwaysVisible="no" confirmReplaceOpenDocs="yes" confirmMacroReplaceOpenDocs="yes" confirmReplaceInFiles="yes" confirmMacroReplaceInFiles="yes" />

View File

@ -838,6 +838,7 @@ struct NppGUI final
bool _monospacedFontFindDlg = false; bool _monospacedFontFindDlg = false;
bool _findDlgAlwaysVisible = false; bool _findDlgAlwaysVisible = false;
bool _confirmReplaceInAllOpenDocs = true; bool _confirmReplaceInAllOpenDocs = true;
bool _muteSounds = false;
writeTechnologyEngine _writeTechnologyEngine = defaultTechnology; writeTechnologyEngine _writeTechnologyEngine = defaultTechnology;
bool _isWordCharDefault = true; bool _isWordCharDefault = true;
std::string _customWordChars; std::string _customWordChars;

View File

@ -2805,7 +2805,8 @@ void FindReplaceDlg::setStatusbarMessage(const generic_string & msg, FindStatus
{ {
if (staus == FSNotFound) if (staus == FSNotFound)
{ {
::PlaySound((LPCTSTR)SND_ALIAS_SYSTEMASTERISK, NULL, SND_ALIAS_ID | SND_ASYNC); if (!NppParameters::getInstance().getNppGUI()._muteSounds)
::MessageBeep(0xFFFFFFFF);
FLASHWINFO flashInfo; FLASHWINFO flashInfo;
flashInfo.cbSize = sizeof(FLASHWINFO); flashInfo.cbSize = sizeof(FLASHWINFO);

View File

@ -1191,9 +1191,10 @@ void DisplayEditString(HWND hWnd,int SI, const TCHAR* tstring)
wcscat_s(BGHS[SI].editstringdisplay,BGHS[SI].editstring); wcscat_s(BGHS[SI].editstringdisplay,BGHS[SI].editstring);
} }
else else
{ {
MessageBeep(0); if (!NppParameters::getInstance().getNppGUI()._muteSounds)
} MessageBeep(0);
}
holdfont=(HFONT)SelectObject(cdc,BGHS[SI].hfont); holdfont=(HFONT)SelectObject(cdc,BGHS[SI].hfont);
rt.right -= 5; rt.right -= 5;
@ -1400,7 +1401,8 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
GetClientRect(hWnd, &rect); GetClientRect(hWnd, &rect);
InvalidateRect(hWnd,&rect,TRUE); InvalidateRect(hWnd,&rect,TRUE);
UpdateWindow(hWnd); UpdateWindow(hWnd);
MessageBeep(0); if (!NppParameters::getInstance().getNppGUI()._muteSounds)
MessageBeep(0);
} }
break; break;
@ -1669,9 +1671,10 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
FindResult = static_cast<int32_t>(SendMessage(BGHS[SelfIndex].hlist1, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(buffer))); FindResult = static_cast<int32_t>(SendMessage(BGHS[SelfIndex].hlist1, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(buffer)));
if(FindResult==LB_ERR) if(FindResult==LB_ERR)
{ {
MessageBeep(0); if (!NppParameters::getInstance().getNppGUI()._muteSounds)
} MessageBeep(0);
}
{ {
RECT rect; RECT rect;
rect=GetCellRect(hWnd,SelfIndex,LPBGcell->row,LPBGcell->col); rect=GetCellRect(hWnd,SelfIndex,LPBGcell->row,LPBGcell->col);

View File

@ -416,7 +416,8 @@ BEGIN
CONTROL "Peek on document map",IDC_CHECK_ENABLEDOCPEEKONMAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,269,71,140,10 CONTROL "Peek on document map",IDC_CHECK_ENABLEDOCPEEKONMAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,269,71,140,10
// "Enable Notepad++ auto-updater" should be always the 1st item, because it'll be hidden if GUP.exe is absent // "Enable Notepad++ auto-updater" should be always the 1st item, because it'll be hidden if GUP.exe is absent
CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,94,217,10 CONTROL "Mute all sounds", IDC_CHECK_MUTE_SOUNDS, "Button", BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP, 37, 94, 217, 10
CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP, 37, 78, 210, 10
CONTROL "Set Save dialog file extension filter to *.*",IDC_CHECK_SAVEDLGEXTFILTALLTYPES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,109,267,10 CONTROL "Set Save dialog file extension filter to *.*",IDC_CHECK_SAVEDLGEXTFILTALLTYPES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,109,267,10
CONTROL "Autodetect character encoding",IDC_CHECK_DETECTENCODING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,124,217,10 CONTROL "Autodetect character encoding",IDC_CHECK_DETECTENCODING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,124,217,10
CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,139,217,10 CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,139,217,10

View File

@ -981,6 +981,7 @@ INT_PTR CALLBACK MiscSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_CHECK_DIRECTWRITE_ENABLE, BM_SETCHECK, nppGUI._writeTechnologyEngine == directWriteTechnology, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_DIRECTWRITE_ENABLE, BM_SETCHECK, nppGUI._writeTechnologyEngine == directWriteTechnology, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLEDOCPEEKER, BM_SETCHECK, nppGUI._isDocPeekOnTab ? BST_CHECKED : BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLEDOCPEEKER, BM_SETCHECK, nppGUI._isDocPeekOnTab ? BST_CHECKED : BST_UNCHECKED, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLEDOCPEEKONMAP, BM_SETCHECK, nppGUI._isDocPeekOnMap ? BST_CHECKED : BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLEDOCPEEKONMAP, BM_SETCHECK, nppGUI._isDocPeekOnMap ? BST_CHECKED : BST_UNCHECKED, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_MUTE_SOUNDS, BM_SETCHECK, nppGUI._muteSounds ? BST_CHECKED : BST_UNCHECKED, 0);
::ShowWindow(::GetDlgItem(_hSelf, IDC_CHECK_AUTOUPDATE), nppGUI._doesExistUpdater?SW_SHOW:SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDC_CHECK_AUTOUPDATE), nppGUI._doesExistUpdater?SW_SHOW:SW_HIDE);
@ -1113,6 +1114,12 @@ INT_PTR CALLBACK MiscSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
return TRUE; return TRUE;
} }
case IDC_CHECK_MUTE_SOUNDS:
{
nppGUI._muteSounds = isCheckedOrNot(IDC_CHECK_MUTE_SOUNDS);
return TRUE;
}
default: default:
{ {
if (HIWORD(wParam) == CBN_SELCHANGE) if (HIWORD(wParam) == CBN_SELCHANGE)

View File

@ -206,6 +206,7 @@
#define IDC_COMBO_FILEUPDATECHOICE (IDD_PREFERENCE_SUB_MISC + 47) #define IDC_COMBO_FILEUPDATECHOICE (IDD_PREFERENCE_SUB_MISC + 47)
#define IDC_CHECK_DIRECTWRITE_ENABLE (IDD_PREFERENCE_SUB_MISC + 49) #define IDC_CHECK_DIRECTWRITE_ENABLE (IDD_PREFERENCE_SUB_MISC + 49)
#define IDC_CHECK_CLICKABLELINK_FULLBOXMODE (IDD_PREFERENCE_SUB_MISC + 50) #define IDC_CHECK_CLICKABLELINK_FULLBOXMODE (IDD_PREFERENCE_SUB_MISC + 50)
#define IDC_CHECK_MUTE_SOUNDS (IDD_PREFERENCE_SUB_MISC + 60)
#define IDD_PREFERENCE_SUB_NEWDOCUMENT 6400 //(IDD_PREFERENCE_BOX + 400) #define IDD_PREFERENCE_SUB_NEWDOCUMENT 6400 //(IDD_PREFERENCE_BOX + 400)
#define IDC_FORMAT_GB_STATIC (IDD_PREFERENCE_SUB_NEWDOCUMENT + 1) #define IDC_FORMAT_GB_STATIC (IDD_PREFERENCE_SUB_NEWDOCUMENT + 1)

View File

@ -111,7 +111,7 @@
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalOptions>/fixed:no %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/fixed:no %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>comctl32.lib;shlwapi.lib;shell32.lib;Oleacc.lib;Dbghelp.lib;Version.lib;Crypt32.lib;wintrust.lib;Sensapi.lib;winmm.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>comctl32.lib;shlwapi.lib;shell32.lib;Oleacc.lib;Dbghelp.lib;Version.lib;Crypt32.lib;wintrust.lib;Sensapi.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>LinkVerboseLib</ShowProgress> <ShowProgress>LinkVerboseLib</ShowProgress>
<OutputFile>$(OutDir)notepad++.exe</OutputFile> <OutputFile>$(OutDir)notepad++.exe</OutputFile>
<Version>1.0</Version> <Version>1.0</Version>
@ -150,7 +150,7 @@
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalOptions>/fixed:no %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/fixed:no %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>comctl32.lib;shlwapi.lib;shell32.lib;Oleacc.lib;Dbghelp.lib;Version.lib;Crypt32.lib;wintrust.lib;Sensapi.lib;winmm.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>comctl32.lib;shlwapi.lib;shell32.lib;Oleacc.lib;Dbghelp.lib;Version.lib;Crypt32.lib;wintrust.lib;Sensapi.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>LinkVerboseLib</ShowProgress> <ShowProgress>LinkVerboseLib</ShowProgress>
<OutputFile>$(OutDir)notepad++.exe</OutputFile> <OutputFile>$(OutDir)notepad++.exe</OutputFile>
<Version>1.0</Version> <Version>1.0</Version>
@ -194,7 +194,7 @@
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>comctl32.lib;shlwapi.lib;shell32.lib;Oleacc.lib;Dbghelp.lib;Version.lib;Crypt32.lib;wintrust.lib;Sensapi.lib;winmm.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>comctl32.lib;shlwapi.lib;shell32.lib;Oleacc.lib;Dbghelp.lib;Version.lib;Crypt32.lib;wintrust.lib;Sensapi.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>LinkVerboseLib</ShowProgress> <ShowProgress>LinkVerboseLib</ShowProgress>
<OutputFile>$(OutDir)notepad++.exe</OutputFile> <OutputFile>$(OutDir)notepad++.exe</OutputFile>
<Version>1.0</Version> <Version>1.0</Version>
@ -246,7 +246,7 @@ copy ..\src\contextMenu.xml ..\bin\contextMenu.xml
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>comctl32.lib;shlwapi.lib;shell32.lib;Oleacc.lib;Dbghelp.lib;Version.lib;Crypt32.lib;wintrust.lib;Sensapi.lib;winmm.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>comctl32.lib;shlwapi.lib;shell32.lib;Oleacc.lib;Dbghelp.lib;Version.lib;Crypt32.lib;wintrust.lib;Sensapi.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>LinkVerboseLib</ShowProgress> <ShowProgress>LinkVerboseLib</ShowProgress>
<OutputFile>$(OutDir)notepad++.exe</OutputFile> <OutputFile>$(OutDir)notepad++.exe</OutputFile>
<Version>1.0</Version> <Version>1.0</Version>