From 69a57e5e8da26489f71b5cdc70df0006360ec5dd Mon Sep 17 00:00:00 2001 From: Don Ho Date: Wed, 16 Sep 2015 17:56:12 +0200 Subject: [PATCH] Fix user command save problem on exit. --- PowerEditor/src/Notepad_plus.cpp | 7 ++++--- PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index b375fb8a..7c13f1b6 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -3878,7 +3878,8 @@ bool Notepad_plus::saveScintillaParams() bool Notepad_plus::addCurrentMacro() { - vector & theMacros = (NppParameters::getInstance())->getMacroList(); + NppParameters* nppParams = NppParameters::getInstance(); + vector & theMacros = nppParams->getMacroList(); int nbMacro = theMacros.size(); @@ -3897,7 +3898,7 @@ bool Notepad_plus::addCurrentMacro() // Insert the separator and modify/delete command ::InsertMenu(hMacroMenu, posBase + nbMacro + 1, MF_BYPOSITION, (unsigned int)-1, 0); - NativeLangSpeaker *pNativeLangSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); + NativeLangSpeaker *pNativeLangSpeaker = nppParams->getNativeLangSpeaker(); generic_string nativeLangShortcutMapperMacro = pNativeLangSpeaker->getNativeLangMenuString(IDM_SETTING_SHORTCUT_MAPPER_MACRO); if (nativeLangShortcutMapperMacro == TEXT("")) nativeLangShortcutMapperMacro = TEXT("Modify Shortcut/Delete Macro..."); @@ -3907,7 +3908,7 @@ bool Notepad_plus::addCurrentMacro() theMacros.push_back(ms); ::InsertMenu(hMacroMenu, posBase + nbMacro, MF_BYPOSITION, cmdID, ms.toMenuItemString().c_str()); _accelerator.updateShortcuts(); - (NppParameters::getInstance())->setShortcutDirty(); + nppParams->setShortcutDirty(); return true; } return false; diff --git a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp index aeb2b4e9..095ed67b 100644 --- a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp +++ b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp @@ -250,18 +250,20 @@ INT_PTR CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) theUserCmds.push_back(uc); ::InsertMenu(hRunMenu, posBase + nbCmd, MF_BYPOSITION, cmdID, uc.toMenuItemString().c_str()); + NppParameters* nppParams = NppParameters::getInstance(); if (nbCmd == 0) { // Insert the separator and modify/delete command ::InsertMenu(hRunMenu, posBase + nbCmd + 1, MF_BYPOSITION, (unsigned int)-1, 0); - NativeLangSpeaker *pNativeLangSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker(); + NativeLangSpeaker *pNativeLangSpeaker = nppParams->getNativeLangSpeaker(); generic_string nativeLangShortcutMapperMacro = pNativeLangSpeaker->getNativeLangMenuString(IDM_SETTING_SHORTCUT_MAPPER_MACRO); if (nativeLangShortcutMapperMacro == TEXT("")) nativeLangShortcutMapperMacro = TEXT("Modify Shortcut/Delete Command..."); ::InsertMenu(hRunMenu, posBase + nbCmd + 2, MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_RUN, nativeLangShortcutMapperMacro.c_str()); } - (NppParameters::getInstance())->getAccelerator()->updateShortcuts(); + nppParams->getAccelerator()->updateShortcuts(); + nppParams->setShortcutDirty(); } return TRUE; }