Fix menu items' state is not maintained due to save macro command
Fixes #4112, fixes #4114, closes #4115
This commit is contained in:
parent
2a15c216a8
commit
926a5f5300
@ -1970,7 +1970,7 @@ void Notepad_plus::checkMacroState()
|
||||
enableCommand(IDM_MACRO_STARTRECORDINGMACRO, !_recordingMacro, MENU | TOOLBAR);
|
||||
enableCommand(IDM_MACRO_STOPRECORDINGMACRO, _recordingMacro, MENU | TOOLBAR);
|
||||
enableCommand(IDM_MACRO_PLAYBACKRECORDEDMACRO, !_macro.empty() && !_recordingMacro, MENU | TOOLBAR);
|
||||
enableCommand(IDM_MACRO_SAVECURRENTMACRO, !_macro.empty() && !_recordingMacro, MENU | TOOLBAR);
|
||||
enableCommand(IDM_MACRO_SAVECURRENTMACRO, !_macro.empty() && !_recordingMacro && !_recordingSaved, MENU | TOOLBAR);
|
||||
|
||||
enableCommand(IDM_MACRO_RUNMULTIMACRODLG, (!_macro.empty() && !_recordingMacro) || !((NppParameters::getInstance())->getMacroList()).empty(), MENU | TOOLBAR);
|
||||
}
|
||||
|
@ -309,6 +309,7 @@ private:
|
||||
Macro _macro;
|
||||
bool _recordingMacro = false;
|
||||
bool _playingBackMacro = false;
|
||||
bool _recordingSaved = false;
|
||||
RunMacroDlg _runMacroDlg;
|
||||
|
||||
// For conflict detection when saving Macros or RunCommands
|
||||
|
@ -897,6 +897,7 @@ void Notepad_plus::command(int id)
|
||||
_subEditView.execute(SCI_STARTRECORD);
|
||||
_recordingMacro = true;
|
||||
}
|
||||
_recordingSaved = false;
|
||||
checkMacroState();
|
||||
break;
|
||||
}
|
||||
@ -928,7 +929,11 @@ void Notepad_plus::command(int id)
|
||||
case IDM_MACRO_SAVECURRENTMACRO :
|
||||
{
|
||||
if (addCurrentMacro())
|
||||
{
|
||||
_recordingSaved = true;
|
||||
_runMacroDlg.initMacroList();
|
||||
checkMacroState();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IDM_EDIT_FULLPATHTOCLIP :
|
||||
|
@ -613,8 +613,9 @@ void Accelerator::updateMenuItemByCommand(CommandShortcut csc)
|
||||
int cmdID = csc.getID();
|
||||
|
||||
// Ensure that the menu item checks set prior to this update remain in affect.
|
||||
// Ensure that the menu item state is also maintained
|
||||
UINT cmdFlags = GetMenuState(_hAccelMenu, cmdID, MF_BYCOMMAND );
|
||||
cmdFlags = MF_BYCOMMAND | ((cmdFlags&MF_CHECKED) ? MF_CHECKED : MF_UNCHECKED);
|
||||
cmdFlags = MF_BYCOMMAND | ((cmdFlags&MF_CHECKED) ? MF_CHECKED : MF_UNCHECKED) | ((cmdFlags&MF_DISABLED) ? MF_DISABLED : MF_ENABLED);
|
||||
::ModifyMenu(_hAccelMenu, cmdID, cmdFlags, cmdID, csc.toMenuItemString().c_str());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user