diff --git a/language/np3_de_de/menu_de_de.rc b/language/np3_de_de/menu_de_de.rc index 96344ce0c..27d092a79 100644 --- a/language/np3_de_de/menu_de_de.rc +++ b/language/np3_de_de/menu_de_de.rc @@ -360,7 +360,7 @@ BEGIN POPUP "Code &Faltung" BEGIN MENUITEM "&Aktiviere Faltung", IDM_VIEW_FOLDING - MENUITEM "Alle Falten &Umschalten\tCtrl+Alt+F", IDM_VIEW_TOGGLEFOLDS + MENUITEM "Alle Falten &Umschalten\tCtrl+Alt+F", IDM_VIEW_TOGGLEFOLDS MENUITEM SEPARATOR MENUITEM "Gehe zur &Nächsten\tAlt+ +", CMD_FOLDJUMPDOWN MENUITEM "Gehe zur &Vorherigen\tAlt+ –", CMD_FOLDJUMPUP @@ -513,6 +513,10 @@ BEGIN MENUITEM SEPARATOR MENUITEM "Öffne Web-Aktion &1", CMD_WEBACTION1 MENUITEM "Öffne Web Aktion &2", CMD_WEBACTION2 + MENUITEM SEPARATOR + MENUITEM "Code &Faltung", IDM_VIEW_FOLDING + MENUITEM "&Zeilen Nummern", IDM_VIEW_LINENUMBERS + MENUITEM "&Selektionsrand", IDM_VIEW_MARGIN END POPUP "+" BEGIN diff --git a/language/np3_en_us/menu_en_us.rc b/language/np3_en_us/menu_en_us.rc index 9ab51c795..c926b34eb 100644 --- a/language/np3_en_us/menu_en_us.rc +++ b/language/np3_en_us/menu_en_us.rc @@ -360,7 +360,7 @@ BEGIN POPUP "&Folding" BEGIN MENUITEM "Code &Folding", IDM_VIEW_FOLDING - MENUITEM "&Toggle Folds\tCtrl+Alt+F", IDM_VIEW_TOGGLEFOLDS + MENUITEM "&Toggle Folds\tCtrl+Alt+F", IDM_VIEW_TOGGLEFOLDS MENUITEM SEPARATOR MENUITEM "Jump &Next Fold\tAlt+ +", CMD_FOLDJUMPDOWN MENUITEM "Jump &Prev Fold\tAlt+ –", CMD_FOLDJUMPUP @@ -513,6 +513,10 @@ BEGIN MENUITEM SEPARATOR MENUITEM "Open Web Action &1", CMD_WEBACTION1 MENUITEM "Open Web Action &2", CMD_WEBACTION2 + MENUITEM SEPARATOR + MENUITEM "&Folding", IDM_VIEW_FOLDING + MENUITEM "Line &Numbers", IDM_VIEW_LINENUMBERS + MENUITEM "Selection &Margin", IDM_VIEW_MARGIN END POPUP "+" BEGIN diff --git a/src/Helpers.c b/src/Helpers.c index e849a4430..53be0bb54 100644 --- a/src/Helpers.c +++ b/src/Helpers.c @@ -158,8 +158,7 @@ static void _GetTrueWindowsVersion() // load the System-DLL HINSTANCE const hNTdllDll = LoadLibrary(L"ntdll.dll"); - - if (hNTdllDll != NULL) + if (hNTdllDll) { // get the function pointer to RtlGetVersion pRtlGetVersion = (void (WINAPI*)(PRTL_OSVERSIONINFOW)) GetProcAddress(hNTdllDll, "RtlGetVersion"); diff --git a/src/Notepad3.c b/src/Notepad3.c index 73e8ccdba..18fd27552 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -714,6 +714,8 @@ static bool _InsertLanguageMenu(HMENU hMenuBar) // // _CleanUpResources() // +static _invalid_parameter_handler _hOldInvalidParamHandler = NULL; + static void _CleanUpResources(const HWND hwnd, bool bIsInitialized) { if (hwnd) { @@ -734,9 +736,9 @@ static void _CleanUpResources(const HWND hwnd, bool bIsInitialized) UndoRedoSelectionUTArray = NULL; } + // ------------------------------- // Save Settings is done elsewhere - - Scintilla_ReleaseResources(); + // ------------------------------- if (Globals.hMainMenu) { DestroyMenu(Globals.hMainMenu); @@ -744,6 +746,8 @@ static void _CleanUpResources(const HWND hwnd, bool bIsInitialized) FreeLanguageResources(); + Scintilla_ReleaseResources(); + if (bIsInitialized) { UnregisterClass(s_wchWndClass, Globals.hInstance); } @@ -754,6 +758,10 @@ static void _CleanUpResources(const HWND hwnd, bool bIsInitialized) FreeMem(s_lpOrigFileArg); s_lpOrigFileArg = NULL; } + + if (_hOldInvalidParamHandler) { + _set_invalid_parameter_handler(_hOldInvalidParamHandler); + } } @@ -785,7 +793,7 @@ void InvalidParameterHandler(const wchar_t* expression, // int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nShowCmd) { - _set_invalid_parameter_handler(InvalidParameterHandler); + _hOldInvalidParamHandler = _set_invalid_parameter_handler(InvalidParameterHandler); _CrtSetReportMode(_CRT_ASSERT, 0); // Disable the message box for assertions. _InitGlobals(); @@ -2987,7 +2995,7 @@ LRESULT MsgContextMenu(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) (nID != IDC_REBAR) && (nID != IDC_TOOLBAR)) return DefWindowProc(hwnd, umsg, wParam, lParam); - HMENU hmenu = LoadMenu(Globals.hLngResContainer, MAKEINTRESOURCE(IDR_MUI_POPUPMENU)); + HMENU hMenuCtx = LoadMenu(Globals.hLngResContainer, MAKEINTRESOURCE(IDR_MUI_POPUPMENU)); //SetMenuDefaultItem(GetSubMenu(hmenu,1),0,false); POINT pt; @@ -3023,10 +3031,10 @@ LRESULT MsgContextMenu(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) break; } - TrackPopupMenuEx(GetSubMenu(hmenu, imenu), + TrackPopupMenuEx(GetSubMenu(hMenuCtx, imenu), TPM_LEFTBUTTON | TPM_RIGHTBUTTON, pt.x + 1, pt.y + 1, hwnd, NULL); - DestroyMenu(hmenu); + DestroyMenu(hMenuCtx); return FALSE; } @@ -3096,9 +3104,8 @@ LRESULT MsgTrayMessage(HWND hwnd, WPARAM wParam, LPARAM lParam) { case WM_RBUTTONUP: { - - HMENU hMenu = LoadMenu(Globals.hLngResContainer, MAKEINTRESOURCE(IDR_MUI_POPUPMENU)); - HMENU hMenuPopup = GetSubMenu(hMenu, 2); + HMENU hTrayMenu = LoadMenu(Globals.hLngResContainer, MAKEINTRESOURCE(IDR_MUI_POPUPMENU)); + HMENU hMenuPopup = GetSubMenu(hTrayMenu, 2); POINT pt; int iCmd; @@ -3113,7 +3120,7 @@ LRESULT MsgTrayMessage(HWND hwnd, WPARAM wParam, LPARAM lParam) PostMessage(hwnd, WM_NULL, 0, 0); - DestroyMenu(hMenu); + DestroyMenu(hTrayMenu); if (iCmd == IDM_TRAY_RESTORE) { ShowNotifyIcon(hwnd, false); @@ -5613,9 +5620,9 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case IDM_HELP_ABOUT: { //~HMODULE hRichEdit = LoadLibrary(L"RICHED20.DLL"); // Use RICHEDIT_CONTROL_VER for control in common_res.h - HMODULE hRichEdit = LoadLibrary(L"MSFTEDIT.DLL"); // Use "RichEdit50W" for control in common_res.h; - if (hRichEdit != INVALID_HANDLE_VALUE) { - ThemedDialogBox(Globals.hLngResContainer, MAKEINTRESOURCE(IDD_MUI_ABOUT), hwnd, AboutDlgProc); + HMODULE const hRichEdit = LoadLibrary(L"MSFTEDIT.DLL"); // Use "RichEdit50W" for control in common_res.h; + if (hRichEdit) { + ThemedDialogBox(Globals.hLngResContainer, MAKEINTRESOURCE(IDD_MUI_ABOUT), hwnd, AboutDlgProc); FreeLibrary(hRichEdit); } } diff --git a/src/Notepad3.vcxproj b/src/Notepad3.vcxproj index d88142c4b..5faab0433 100644 --- a/src/Notepad3.vcxproj +++ b/src/Notepad3.vcxproj @@ -130,6 +130,7 @@ $(IntermediateOutputPath);%(AdditionalLibraryDirectories) Default + true @@ -194,6 +195,7 @@ $(IntermediateOutputPath);%(AdditionalLibraryDirectories) Default + true @@ -264,6 +266,7 @@ UseLinkTimeCodeGeneration true + true @@ -334,6 +337,7 @@ UseLinkTimeCodeGeneration true + true