[RELEASE_4_8_1] Notepad++ v4.8.1 release :
1. Enhance shortcut mapper; fix bug - get back Shift+Del, Shift+Ins and Ctrl+Ins shortcut. 2. Disable GUP on Notepad++ launch time under vista due to UAC issue. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@140 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
c7162f9555
commit
d550ce44b2
|
@ -1,4 +1,4 @@
|
|||
Notepad++ v4.8 fixed bugs and added features (from v4.7.5) :
|
||||
Notepad++ v4.8.1 fixed bugs and added features (from v4.7.5) :
|
||||
|
||||
1. Enhance Shortcut Mapper - all the commands (including plugins commands) can be assigned to a shortcut, even for the unmapped ones.
|
||||
2. Upgrade Scintilla from v1.73 to v1.75
|
||||
|
@ -30,9 +30,9 @@ Included plugins :
|
|||
1. TexFX v0.24a
|
||||
2. NppExec v0.2 RC3.2
|
||||
3. Spell Checker v1.3.1
|
||||
4. Explorer plugin v1.7.1
|
||||
5. Hex editor v0.84
|
||||
6. Base64 encoder/decoder v1.2
|
||||
7. FTP_synchronize v0.9.6
|
||||
8. NppExport v0.2.7
|
||||
9. Compare plugin v1.5.1
|
||||
4. Hex editor v0.84
|
||||
5. Base64 encoder/decoder v1.2
|
||||
6. FTP_synchronize v0.9.6
|
||||
7. NppExport v0.2.7.2
|
||||
8. Compare plugin v1.5.1
|
||||
9. Light Explorer v1.4
|
||||
|
|
|
@ -17,18 +17,16 @@
|
|||
|
||||
; Define the application name
|
||||
!define APPNAME "Notepad++"
|
||||
!define APPNAMEANDVERSION "Notepad++ v4.8"
|
||||
!define APPNAMEANDVERSION "Notepad++ v4.8.1"
|
||||
|
||||
!define VERSION_MAJOR 4
|
||||
!define VERSION_MINOR 8
|
||||
!define VERSION_MINOR 81
|
||||
|
||||
; Main Install settings
|
||||
Name "${APPNAMEANDVERSION}"
|
||||
InstallDir "$PROGRAMFILES\Notepad++"
|
||||
InstallDirRegKey HKLM "Software\${APPNAME}" ""
|
||||
OutFile "..\bin\npp.4.8.Installer.exe"
|
||||
|
||||
|
||||
OutFile "..\bin\npp.4.8.1.Installer.exe"
|
||||
|
||||
; GetWindowsVersion
|
||||
;
|
||||
|
@ -179,7 +177,7 @@ OutFile "..\bin\npp.4.8.Installer.exe"
|
|||
!insertmacro MUI_LANGUAGE "PortugueseBR"
|
||||
!insertmacro MUI_LANGUAGE "Ukrainian"
|
||||
!insertmacro MUI_LANGUAGE "Turkish"
|
||||
;!insertmacro MUI_LANGUAGE "Catalan"
|
||||
!insertmacro MUI_LANGUAGE "Catalan"
|
||||
!insertmacro MUI_LANGUAGE "Arabic"
|
||||
!insertmacro MUI_LANGUAGE "Lithuanian"
|
||||
!insertmacro MUI_LANGUAGE "Finnish"
|
||||
|
@ -256,6 +254,7 @@ LangString langFileName ${LANG_BULGARIAN} "bulgarian.xml"
|
|||
LangString langFileName ${LANG_INDONESIAN} "indonesian.xml"
|
||||
LangString langFileName ${LANG_JAPANESE} "japanese.xml"
|
||||
LangString langFileName ${LANG_CROATIAN} "croatian.xml"
|
||||
LangString langFileName ${LANG_SERBIAN} "serbian.xml"
|
||||
|
||||
;--------------------------------
|
||||
;Variables
|
||||
|
@ -613,12 +612,18 @@ SubSection "Plugins" Plugins
|
|||
SetOutPath "$INSTDIR\plugins"
|
||||
File "..\bin\plugins\FunctionList.dll"
|
||||
SectionEnd
|
||||
*/
|
||||
|
||||
Section "File Browser" FileBrowser
|
||||
Delete "$INSTDIR\plugins\Explorer.dll"
|
||||
SetOutPath "$INSTDIR\plugins"
|
||||
File "..\bin\plugins\Explorer.dll"
|
||||
SectionEnd
|
||||
*/
|
||||
Section "Light Explorer" FileBrowserLite
|
||||
Delete "$INSTDIR\plugins\LightExplorer.dll"
|
||||
SetOutPath "$INSTDIR\plugins"
|
||||
File "..\bin\plugins\LightExplorer.dll"
|
||||
SectionEnd
|
||||
|
||||
Section "Hex Editor" HexEditor
|
||||
Delete "$INSTDIR\plugins\HexEditorPlugin.dll"
|
||||
|
@ -842,12 +847,18 @@ SubSection un.Plugins
|
|||
Delete "$INSTDIR\plugins\FunctionList.dll"
|
||||
RMDir "$INSTDIR\plugins\"
|
||||
SectionEnd
|
||||
*/
|
||||
|
||||
Section un.FileBrowser
|
||||
Delete "$INSTDIR\plugins\Explorer.dll"
|
||||
Delete "$INSTDIR\Explorer.ini"
|
||||
RMDir "$INSTDIR\plugins\"
|
||||
SectionEnd
|
||||
*/
|
||||
Section un.FileBrowserLite
|
||||
Delete "$INSTDIR\plugins\LightExplorer.dll"
|
||||
Delete "$INSTDIR\lightExplorer.ini"
|
||||
RMDir "$INSTDIR\plugins\"
|
||||
SectionEnd
|
||||
|
||||
Section un.HexEditor
|
||||
Delete "$INSTDIR\plugins\HexEditor.dll"
|
||||
|
|
|
@ -58,9 +58,7 @@ struct SortTaskListPred
|
|||
|
||||
Notepad_plus::Notepad_plus(): Window(), _mainWindowStatus(0), _pDocTab(NULL), _pEditView(NULL),
|
||||
_pMainSplitter(NULL), _isfullScreen(false),
|
||||
_recordingMacro(false), _pTrayIco(NULL), _isUDDocked(false),\
|
||||
_isCmdScModified(false), _isMacrosScModified(false), _isUserCmdScModified(false),\
|
||||
_isScintillaKeyModified(false), _isPluginCmdScModified(false), _isRTL(false), \
|
||||
_recordingMacro(false), _pTrayIco(NULL), _isUDDocked(false), _isRTL(false),
|
||||
_linkTriggered(true), _isDocModifing(false), _isHotspotDblClicked(false), _isSaving(false)
|
||||
{
|
||||
_winVersion = getWindowsVersion();
|
||||
|
@ -5266,10 +5264,9 @@ void Notepad_plus::changeShortcutLang()
|
|||
{
|
||||
if (index > -1 && index < mainSize) { //valid index only
|
||||
const char *name = element->Attribute("name");
|
||||
CommandShortcut csc = mainshortcuts[index];
|
||||
CommandShortcut & csc = mainshortcuts[index];
|
||||
if (csc.getID() == id) {
|
||||
strncpy(csc._name, name, 64);
|
||||
mainshortcuts[index] = csc;
|
||||
csc.setName(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5295,9 +5292,8 @@ void Notepad_plus::changeShortcutLang()
|
|||
{
|
||||
if (index > -1 && index < scinSize) { //valid index only
|
||||
const char *name = element->Attribute("name");
|
||||
ScintillaKeyMap skm = scinshortcuts[index];
|
||||
strncpy(skm._name, name, 64);
|
||||
scinshortcuts[index] = skm;
|
||||
ScintillaKeyMap & skm = scinshortcuts[index];
|
||||
skm.setName(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5654,7 +5650,6 @@ bool Notepad_plus::addCurrentMacro()
|
|||
int cmdID = ID_MACRO + nbMacro;
|
||||
MacroShortcut ms(Shortcut(), _macro, cmdID);
|
||||
ms.init(_hInst, _hSelf);
|
||||
ms._canModifyName = true;
|
||||
|
||||
if (ms.doDialog() != -1)
|
||||
{
|
||||
|
@ -5667,7 +5662,6 @@ bool Notepad_plus::addCurrentMacro()
|
|||
|
||||
theMacros.push_back(ms);
|
||||
::InsertMenu(hMacroMenu, posBase + nbMacro, MF_BYPOSITION, cmdID, ms.toMenuItemString().c_str());
|
||||
_isMacrosScModified = true;
|
||||
_accelerator.updateShortcuts();
|
||||
return true;
|
||||
}
|
||||
|
@ -6212,30 +6206,30 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||
len = shortcuts.size();
|
||||
int readI, writeI;
|
||||
for(size_t i = 0; i < len; i++) {
|
||||
CommandShortcut csc = shortcuts[i];
|
||||
if (!csc._name[0]) {
|
||||
if (::GetMenuString(_mainMenuHandle, csc.getID(), csc._name, 64, MF_BYCOMMAND)) {
|
||||
CommandShortcut & csc = shortcuts[i];
|
||||
if (!csc.getName()[0]) {
|
||||
if (::GetMenuString(_mainMenuHandle, csc.getID(), menuName, 64, MF_BYCOMMAND)) {
|
||||
readI = 0; writeI = 0;
|
||||
while(csc._name[readI] != 0)
|
||||
while(menuName[readI] != 0)
|
||||
{
|
||||
if (csc._name[readI] == '&')
|
||||
if (menuName[readI] == '&')
|
||||
{
|
||||
readI++;
|
||||
continue;
|
||||
}
|
||||
if (csc._name[readI] == '\t')
|
||||
if (menuName[readI] == '\t')
|
||||
{
|
||||
csc._name[writeI] = 0;
|
||||
menuName[writeI] = 0;
|
||||
break;
|
||||
}
|
||||
csc._name[writeI] = csc._name[readI];
|
||||
menuName[writeI] = menuName[readI];
|
||||
writeI++;
|
||||
readI++;
|
||||
}
|
||||
csc._name[writeI] = 0;
|
||||
menuName[writeI] = 0;
|
||||
}
|
||||
}
|
||||
shortcuts[i] = csc;
|
||||
csc.setName(menuName);
|
||||
}
|
||||
|
||||
//Translate non-menu shortcuts
|
||||
|
@ -6245,12 +6239,9 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||
pNppParam->reloadPluginCmds();
|
||||
|
||||
// Shortcut Accelerator : should be the last one since it will capture all the shortcuts
|
||||
_accelerator.init(::LoadAccelerators(_hInst, MAKEINTRESOURCE(IDR_NPP_ACCELERATORS)), _mainMenuHandle, _hSelf);
|
||||
_accelerator.init(_mainMenuHandle, _hSelf);
|
||||
pNppParam->setAccelerator(&_accelerator);
|
||||
|
||||
if (_accelerator.updateShortcuts())
|
||||
_isCmdScModified = true;
|
||||
|
||||
// Scintilla key accelerator
|
||||
vector<HWND> scints;
|
||||
scints.push_back(_mainEditView.getHSelf());
|
||||
|
@ -7168,7 +7159,6 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||
}
|
||||
case NPPM_INTERNAL_CMDLIST_MODIFIED :
|
||||
{
|
||||
_isCmdScModified = true;
|
||||
//changeMenuShortcut(lParam, (const char *)wParam);
|
||||
::DrawMenuBar(_hSelf);
|
||||
return TRUE;
|
||||
|
@ -7176,25 +7166,21 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||
|
||||
case NPPM_INTERNAL_MACROLIST_MODIFIED :
|
||||
{
|
||||
_isMacrosScModified = true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case NPPM_INTERNAL_USERCMDLIST_MODIFIED :
|
||||
{
|
||||
_isUserCmdScModified = true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case NPPM_INTERNAL_SCINTILLAKEYMODIFIED :
|
||||
{
|
||||
_isScintillaKeyModified = true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case NPPM_INTERNAL_PLUGINCMDLIST_MODIFIED :
|
||||
{
|
||||
_isPluginCmdScModified = true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -8142,3 +8128,4 @@ winVer getWindowsVersion()
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -454,12 +454,6 @@ private:
|
|||
Accelerator _accelerator;
|
||||
ScintillaAccelerator _scintaccelerator;
|
||||
|
||||
bool _isCmdScModified;
|
||||
bool _isMacrosScModified;
|
||||
bool _isUserCmdScModified;
|
||||
bool _isScintillaKeyModified;
|
||||
bool _isPluginCmdScModified;
|
||||
|
||||
PluginsManager _pluginsManager;
|
||||
|
||||
bool _isRTL;
|
||||
|
|
|
@ -546,160 +546,6 @@ END
|
|||
// xp style
|
||||
1 RT_MANIFEST "notepad++.exe.manifest"
|
||||
|
||||
IDR_NPP_ACCELERATORS ACCELERATORS
|
||||
BEGIN
|
||||
//Only Alt-F4 accelerator as Stub. rest gets loaded on runtime
|
||||
VK_F4, IDM_FILE_EXIT, VIRTKEY, ALT
|
||||
|
||||
/*
|
||||
//File menu
|
||||
"N", IDM_FILE_NEW, VIRTKEY, CONTROL
|
||||
"O", IDM_FILE_OPEN, VIRTKEY, CONTROL
|
||||
//"R", IDM_FILE_RELOAD, VIRTKEY, CONTROL, SHIFT
|
||||
"S", IDM_FILE_SAVE, VIRTKEY, CONTROL
|
||||
"S", IDM_FILE_SAVEAS, VIRTKEY, CONTROL, ALT
|
||||
"S", IDM_FILE_SAVEALL, VIRTKEY, CONTROL, SHIFT
|
||||
"W", IDM_FILE_CLOSE, VIRTKEY, CONTROL
|
||||
//"None", IDM_FILE_CLOSEALL, VIRTKEY, CONTROL
|
||||
//"None", IDM_FILE_CLOSEALL_BUT_CURRENT, VIRTKEY, CONTROL
|
||||
"P", IDM_FILE_PRINT, VIRTKEY, CONTROL
|
||||
//"None", IDM_FILE_PRINTNOW, VIRTKEY, CONTROL
|
||||
//"None", IDM_OPEN_ALL_RECENT_FILE, VIRTKEY, CONTROL
|
||||
VK_F4, IDM_FILE_EXIT, VIRTKEY, ALT
|
||||
|
||||
//Edit menu
|
||||
//"Z", IDM_EDIT_UNDO, VIRTKEY, CONTROL
|
||||
//"Y", IDM_EDIT_REDO, VIRTKEY, CONTROL
|
||||
//"X", IDM_EDIT_CUT, VIRTKEY, CONTROL
|
||||
//"C", IDM_EDIT_COPY, VIRTKEY, CONTROL
|
||||
//"V", IDM_EDIT_PASTE, VIRTKEY, CONTROL
|
||||
//VK_DEL, IDM_EDIT_DELETE, VIRTKEY
|
||||
//"A", IDM_EDIT_SELECTALL, VIRTKEY, CONTROL
|
||||
//"None", IDM_EDIT_FULLPATHTOCLIP, VIRTKEY, CONTROL
|
||||
//"None", IDM_EDIT_FILENAMETOCLIP, VIRTKEY, CONTROL
|
||||
//"None", IDM_EDIT_CURRENTDIRTOCLIP, VIRTKEY, CONTROL
|
||||
//VK_TAB, IDM_EDIT_INS_TAB, VIRTKEY
|
||||
//VK_TAB, IDM_EDIT_RMV_TAB, VIRTKEY, SHIFT
|
||||
//"D", IDM_EDIT_DUP_LINE, VIRTKEY, CONTROL
|
||||
"I", IDM_EDIT_SPLIT_LINES, VIRTKEY, CONTROL
|
||||
"J", IDM_EDIT_JOIN_LINES, VIRTKEY, CONTROL
|
||||
VK_UP, IDM_EDIT_LINE_UP, VIRTKEY, CONTROL, SHIFT
|
||||
VK_DOWN, IDM_EDIT_LINE_DOWN, VIRTKEY, CONTROL, SHIFT
|
||||
//VK_SPACE, IDM_EDIT_TRIMTRAILING, VIRTKEY, CONTROL, ALT, SHIFT
|
||||
"C", IDM_EDIT_COLUMNMODE, VIRTKEY, ALT
|
||||
"U", IDM_EDIT_UPPERCASE, VIRTKEY, CONTROL, SHIFT
|
||||
"U", IDM_EDIT_LOWERCASE, VIRTKEY, CONTROL
|
||||
"Q", IDM_EDIT_BLOCK_COMMENT, VIRTKEY, CONTROL
|
||||
"K", IDM_EDIT_BLOCK_COMMENT_SET, VIRTKEY, CONTROL
|
||||
"K", IDM_EDIT_BLOCK_UNCOMMENT, VIRTKEY, CONTROL, SHIFT
|
||||
"Q", IDM_EDIT_STREAM_COMMENT, VIRTKEY, CONTROL, SHIFT
|
||||
VK_SPACE, IDM_EDIT_AUTOCOMPLETE, VIRTKEY, CONTROL
|
||||
VK_SPACE, IDM_EDIT_AUTOCOMPLETE_CURRENTFILE, VIRTKEY, CONTROL, SHIFT
|
||||
"R", IDM_EDIT_RTL, VIRTKEY, CONTROL, ALT
|
||||
"L", IDM_EDIT_LTR, VIRTKEY, CONTROL, ALT
|
||||
|
||||
//Search menu
|
||||
"F", IDM_SEARCH_FIND, VIRTKEY, CONTROL
|
||||
"F", IDM_SEARCH_FINDINFILES, VIRTKEY, CONTROL, SHIFT
|
||||
VK_F3, IDM_SEARCH_FINDNEXT, VIRTKEY
|
||||
VK_F3, IDM_SEARCH_FINDPREV, VIRTKEY, SHIFT
|
||||
VK_F3, IDM_SEARCH_VOLATILE_FINDNEXT, VIRTKEY, CONTROL
|
||||
VK_F3, IDM_SEARCH_VOLATILE_FINDPREV, VIRTKEY, CONTROL, SHIFT
|
||||
"M", IDM_SEARCH_MARKALL, VIRTKEY, CONTROL
|
||||
"M", IDM_SEARCH_UNMARKALL, VIRTKEY, CONTROL, SHIFT
|
||||
"H", IDM_SEARCH_REPLACE, VIRTKEY, CONTROL
|
||||
"I", IDM_SEARCH_FINDINCREMENT, VIRTKEY, CONTROL, ALT
|
||||
"G", IDM_SEARCH_GOTOLINE, VIRTKEY, CONTROL
|
||||
"B", IDM_SEARCH_GOTOMATCHINGBRACE, VIRTKEY, CONTROL
|
||||
VK_F2, IDM_SEARCH_TOGGLE_BOOKMARK, VIRTKEY, CONTROL
|
||||
VK_F2, IDM_SEARCH_NEXT_BOOKMARK, VIRTKEY
|
||||
VK_F2, IDM_SEARCH_PREV_BOOKMARK, VIRTKEY, SHIFT
|
||||
//VK_F2, IDM_SEARCH_CLEAR_BOOKMARKS, VIRTKEY, ALT
|
||||
|
||||
//View menu
|
||||
VK_F11, IDM_VIEW_FULLSCREENTOGGLE, VIRTKEY
|
||||
//VK_F11, IDM_VIEW_ALWAYSONTOP, VIRTKEY, CONTROL
|
||||
//VK_F10, IDM_VIEW_TAB_SPACE, VIRTKEY
|
||||
//VK_F10, IDM_VIEW_EOL, VIRTKEY, CONTROL
|
||||
//VK_F10, IDM_VIEW_ALL_CHARACTERS, VIRTKEY, ALT
|
||||
//VK_F10, IDM_VIEW_INDENT_GUIDE, VIRTKEY, ALT
|
||||
//VK_F10, IDM_VIEW_WRAP, VIRTKEY, ALT
|
||||
//VK_F10, IDM_VIEW_WRAP_SYMBOL, VIRTKEY, ALT
|
||||
//VK_F10, IDM_VIEW_USER_DLG, VIRTKEY, ALT
|
||||
//VK_F10, IDM_VIEW_ZOOMIN, VIRTKEY, ALT
|
||||
//VK_F10, IDM_VIEW_ZOOMOUT, VIRTKEY, ALT
|
||||
//VK_F10, IDM_VIEW_ZOOMRESTORE, VIRTKEY, ALT
|
||||
"0", IDM_VIEW_TOGGLE_FOLDALL, VIRTKEY, ALT
|
||||
"F", IDM_VIEW_FOLD_CURRENT, VIRTKEY, CONTROL, ALT
|
||||
"1", IDM_VIEW_FOLD_1, VIRTKEY, ALT
|
||||
"2", IDM_VIEW_FOLD_2, VIRTKEY, ALT
|
||||
"3", IDM_VIEW_FOLD_3, VIRTKEY, ALT
|
||||
"4", IDM_VIEW_FOLD_4, VIRTKEY, ALT
|
||||
"5", IDM_VIEW_FOLD_5, VIRTKEY, ALT
|
||||
"6", IDM_VIEW_FOLD_6, VIRTKEY, ALT
|
||||
"7", IDM_VIEW_FOLD_7, VIRTKEY, ALT
|
||||
"8", IDM_VIEW_FOLD_8, VIRTKEY, ALT
|
||||
"F", IDM_VIEW_UNFOLD_CURRENT, VIRTKEY, CONTROL, ALT, SHIFT
|
||||
"1", IDM_VIEW_UNFOLD_1, VIRTKEY, ALT, SHIFT
|
||||
"2", IDM_VIEW_UNFOLD_2, VIRTKEY, ALT, SHIFT
|
||||
"3", IDM_VIEW_UNFOLD_3, VIRTKEY, ALT, SHIFT
|
||||
"4", IDM_VIEW_UNFOLD_4, VIRTKEY, ALT, SHIFT
|
||||
"5", IDM_VIEW_UNFOLD_5, VIRTKEY, ALT, SHIFT
|
||||
"6", IDM_VIEW_UNFOLD_6, VIRTKEY, ALT, SHIFT
|
||||
"7", IDM_VIEW_UNFOLD_7, VIRTKEY, ALT, SHIFT
|
||||
"8", IDM_VIEW_UNFOLD_8, VIRTKEY, ALT, SHIFT
|
||||
"0", IDM_VIEW_TOGGLE_UNFOLDALL, VIRTKEY, ALT, SHIFT
|
||||
"H", IDM_VIEW_HIDELINES, VIRTKEY, ALT
|
||||
//"H", IDM_VIEW_GOTO_ANOTHER_VIEW, VIRTKEY, ALT
|
||||
//"H", IDM_VIEW_CLONE_TO_ANOTHER_VIEW, VIRTKEY, ALT
|
||||
//"H", IDM_VIEW_SYNSCROLLV, VIRTKEY, ALT
|
||||
//"H", IDM_VIEW_SYNSCROLLH, VIRTKEY, ALT
|
||||
|
||||
//Format menu
|
||||
//"N", IDM_FORMAT_TODOS, VIRTKEY, ALT
|
||||
//"N", IDM_FORMAT_TOUNIX, VIRTKEY, ALT, SHIFT
|
||||
//"N", IDM_FORMAT_TOMAC, VIRTKEY, CONTROL, SHIFT
|
||||
//"E", IDM_FORMAT_ANSI, VIRTKEY, CONTROL
|
||||
//"E", IDM_FORMAT_UTF_8, VIRTKEY, CONTROL, SHIFT
|
||||
//"E", IDM_FORMAT_AS_UTF_8, VIRTKEY, ALT
|
||||
//"E", IDM_FORMAT_UCS_2BE, VIRTKEY, ALT, SHIFT
|
||||
//"E", IDM_FORMAT_UCS_2LE, VIRTKEY, CONTROL, ALT, SHIFT
|
||||
|
||||
//Settings menu
|
||||
//"P", IDM_SETTING_PREFERECE, VIRTKEY, ALT
|
||||
//"P", IDM_LANGSTYLE_CONFIG_DLG, VIRTKEY, CONTROL, SHIFT
|
||||
//"P", IDM_SETTING_SHORTCUT_MAPPER, VIRTKEY, CONTROL, ALT, SHIFT
|
||||
|
||||
//Macro menu
|
||||
"R", IDC_EDIT_TOGGLEMACRORECORDING, VIRTKEY, CONTROL, SHIFT
|
||||
"P", IDM_MACRO_PLAYBACKRECORDEDMACRO, VIRTKEY, CONTROL, SHIFT
|
||||
//"M", IDM_MACRO_SAVECURRENTMACRO, VIRTKEY, ALT
|
||||
//"M", IDM_MACRO_RUNMULTIMACRODLG, VIRTKEY, ALT, SHIFT
|
||||
|
||||
//Run menu
|
||||
VK_F5, IDM_EXECUTE, VIRTKEY
|
||||
|
||||
//Window menu
|
||||
//"W", IDM_WINDOW_WINDOWS, VIRTKEY, ALT
|
||||
|
||||
//Help menu
|
||||
//VK_F1, IDM_HOMESWEETHOME, VIRTKEY
|
||||
//VK_F1, IDM_PROJECTPAGE, VIRTKEY
|
||||
//VK_F1, IDM_ONLINEHELP, VIRTKEY
|
||||
//VK_F1, IDM_FORUM, VIRTKEY
|
||||
//VK_F1, IDM_PLUGINSHOME, VIRTKEY
|
||||
VK_F1, IDM_ABOUT, VIRTKEY
|
||||
|
||||
//Misc accelerators
|
||||
VK_TAB, IDC_PREV_DOC, VIRTKEY, CONTROL, SHIFT
|
||||
VK_TAB, IDC_NEXT_DOC, VIRTKEY, CONTROL
|
||||
|
||||
//Scintilla accelerators. Do not use this table
|
||||
//VK_HOME, IDC_KEY_HOME, VIRTKEY
|
||||
//VK_END, IDC_KEY_END, VIRTKEY
|
||||
//VK_HOME, IDC_KEY_SELECT_2_HOME, VIRTKEY, SHIFT
|
||||
//VK_END, IDC_KEY_SELECT_2_END, VIRTKEY, SHIFT
|
||||
*/
|
||||
|
||||
END
|
||||
|
||||
|
||||
|
|
|
@ -184,14 +184,19 @@ WinMenuKeyDefinition winKeyDefs[] = { //array of accelerator keys for all std me
|
|||
|
||||
ScintillaKeyDefinition scintKeyDefs[] = { //array of accelerator keys for all possible scintilla functions, values can be 0 for vKey, which means its unused
|
||||
{"SCI_CUT", SCI_CUT, true, false, false, VK_X, IDM_EDIT_CUT},
|
||||
{"", SCI_CUT, false, false, true, VK_DELETE, 0},
|
||||
{"SCI_COPY", SCI_COPY, true, false, false, VK_C, IDM_EDIT_COPY},
|
||||
{"", SCI_COPY, true, false, false, VK_INSERT, 0},
|
||||
{"SCI_PASTE", SCI_PASTE, true, false, false, VK_V, IDM_EDIT_PASTE},
|
||||
{"", SCI_PASTE, false, false, true, VK_INSERT, 0},
|
||||
{"SCI_SELECTALL", SCI_SELECTALL, true, false, false, VK_A, IDM_EDIT_SELECTALL},
|
||||
{"SCI_CLEAR", SCI_CLEAR, false, false, false, VK_DELETE, IDM_EDIT_DELETE},
|
||||
{"SCI_CLEARALL", SCI_CLEARALL, false, false, false, 0, 0},
|
||||
{"SCI_UNDO", SCI_UNDO, true, false, false, VK_Z, IDM_EDIT_UNDO},
|
||||
{"", SCI_UNDO, false, true, false, VK_BACK, 0},
|
||||
{"SCI_REDO", SCI_REDO, true, false, false, VK_Y, IDM_EDIT_REDO},
|
||||
{"SCI_NEWLINE", SCI_NEWLINE, false, false, false, VK_RETURN, 0},
|
||||
{"", SCI_NEWLINE, false, false, true, VK_RETURN, 0},
|
||||
{"SCI_TAB", SCI_TAB, false, false, false, VK_TAB, IDM_EDIT_INS_TAB},
|
||||
{"SCI_BACKTAB", SCI_BACKTAB, false, false, true, VK_TAB, IDM_EDIT_RMV_TAB},
|
||||
{"SCI_FORMFEED", SCI_FORMFEED, false, false, false, 0, 0},
|
||||
|
@ -228,7 +233,7 @@ ScintillaKeyDefinition scintKeyDefs[] = { //array of accelerator keys for all po
|
|||
{"SCI_WORDLEFTEND", SCI_WORDLEFTEND, false, false, false, 0, 0},
|
||||
{"SCI_WORDLEFTENDEXTEND", SCI_WORDLEFTENDEXTEND, false, false, false, 0, 0},
|
||||
{"SCI_WORDRIGHTEND", SCI_WORDRIGHTEND, false, false, false, 0, 0},
|
||||
{"SCI_WORDRIGHTEXTEND", SCI_WORDRIGHTEXTEND, true, false, true, VK_RIGHT, 0},
|
||||
{"SCI_WORDRIGHTENDEXTEND", SCI_WORDRIGHTENDEXTEND, true, false, true, VK_RIGHT, 0},
|
||||
{"SCI_WORDPARTLEFT", SCI_WORDPARTLEFT, true, false, false, VK_OEM_2, 0},
|
||||
{"SCI_WORDPARTLEFTEXTEND", SCI_WORDPARTLEFTEXTEND, true, false, true, VK_OEM_2, 0},
|
||||
{"SCI_WORDPARTRIGHT", SCI_WORDPARTRIGHT, true, false, false, VK_OEM_5, 0},
|
||||
|
@ -267,6 +272,7 @@ ScintillaKeyDefinition scintKeyDefs[] = { //array of accelerator keys for all po
|
|||
{"SCI_STUTTEREDPAGEDOWN", SCI_STUTTEREDPAGEDOWN, false, false, false, 0, 0},
|
||||
{"SCI_STUTTEREDPAGEDOWNEXTEND", SCI_STUTTEREDPAGEDOWNEXTEND,false, false, false, 0, 0},
|
||||
{"SCI_DELETEBACK", SCI_DELETEBACK, false, false, false, VK_BACK, 0},
|
||||
{"", SCI_DELETEBACK, false, false, true, VK_BACK, 0},
|
||||
{"SCI_DELETEBACKNOTLINE", SCI_DELETEBACKNOTLINE, false, false, false, 0, 0},
|
||||
{"SCI_DELWORDLEFT", SCI_DELWORDLEFT, true, false, false, VK_BACK, 0},
|
||||
{"SCI_DELWORDRIGHT", SCI_DELWORDRIGHT, true, false, false, VK_DELETE, 0},
|
||||
|
@ -283,22 +289,21 @@ ScintillaKeyDefinition scintKeyDefs[] = { //array of accelerator keys for all po
|
|||
//{"SCI_CALLTIPCANCEL", SCI_CALLTIPCANCEL, false, false, false, 0, 0},
|
||||
//{"SCI_SETSAVEPOINT", SCI_SETSAVEPOINT, false, false, false, 0, 0},
|
||||
//{"SCI_CLEARDOCUMENTSTYLE", SCI_CLEARDOCUMENTSTYLE, false, false, false, 0, 0},
|
||||
//{"SCI_CUT", SCI_CUT, false, false, true, VK_DELETE, 0},
|
||||
//{"SCI_COPY", SCI_COPY, true, false, false, VK_INSERT, 0},
|
||||
//{"SCI_PASTE", SCI_PASTE, false, false, true, VK_INSERT, 0},
|
||||
//
|
||||
//
|
||||
//{"SCI_CHOOSECARETX", SCI_CHOOSECARETX, false, false, false, 0, 0},
|
||||
//{"SCI_AUTOCCOMPLETE", SCI_AUTOCCOMPLETE, false, false, false, 0, 0},
|
||||
//{"SCI_AUTOCCANCEL", SCI_AUTOCCANCEL, false, false, false, 0, 0},
|
||||
//{"SCI_CLEARREGISTEREDIMAGES", SCI_CLEARREGISTEREDIMAGES, false, false, false, 0, 0},
|
||||
//{"SCI_HOMEDISPLAYEXTEND", SCI_HOMEDISPLAYEXTEND, false, true, true, VK_HOME, 0},
|
||||
//{SCI_LINEENDDISPLAYEXTEND, SCI_LINEENDDISPLAYEXTEND, false, true, true, VK_END, 0},
|
||||
//{"SCI_DELETEBACK", SCI_DELETEBACK, false, false, true, VK_BACK, 0},
|
||||
//{"SCI_LINEENDDISPLAYEXTEND", SCI_LINEENDDISPLAYEXTEND, false, true, true, VK_END, 0},
|
||||
//
|
||||
//{"SCI_DELWORDRIGHTEND", SCI_DELWORDRIGHTEND, false, false, false, 0, 0},
|
||||
//{"SCI_LOWERCASE", SCI_LOWERCASE, false, false, false, 0, 0},
|
||||
//{"SCI_UPPERCASE", SCI_UPPERCASE, false, false, false, 0, 0},
|
||||
//{"SCI_LOWERCASE", SCI_LOWERCASE, true, false, false, VK_U, 0},
|
||||
//{"SCI_UPPERCASE", SCI_UPPERCASE, true, false, true, VK_U, 0},
|
||||
//{"SCI_NEWLINE", SCI_NEWLINE, false, false, true, VK_RETURN, 0},
|
||||
//
|
||||
//{"SCI_FORMFEED", SCI_FORMFEED, true, false, false, VK_L, 0},
|
||||
//{"SCI_CLEARALLCMDKEYS", SCI_CLEARALLCMDKEYS, false, false, false, 0, 0},
|
||||
//{"SCI_STARTRECORD", SCI_STARTRECORD, false, false, false, 0, 0},
|
||||
|
@ -307,7 +312,7 @@ ScintillaKeyDefinition scintKeyDefs[] = { //array of accelerator keys for all po
|
|||
//{"SCI_TARGETFROMSELECTION", SCI_TARGETFROMSELECTION, false, false, false, 0, 0},
|
||||
//{"SCI_STYLERESETDEFAULT", SCI_STYLERESETDEFAULT, false, false, false, 0, 0},
|
||||
//{"SCI_STYLECLEARALL", SCI_STYLECLEARALL, false, false, false, 0, 0},
|
||||
//{"SCI_UNDO", SCI_UNDO, false, true, false, VK_BACK, 0}
|
||||
//
|
||||
};
|
||||
|
||||
|
||||
|
@ -875,11 +880,24 @@ void NppParameters::initScintillaKeys() {
|
|||
|
||||
int nrCommands = sizeof(scintKeyDefs)/sizeof(ScintillaKeyDefinition);
|
||||
|
||||
//Warning! Matching function have to be consecutive
|
||||
ScintillaKeyDefinition skd;
|
||||
|
||||
size_t prevIndex = -1;
|
||||
int prevID = -1;
|
||||
for(int i = 0; i < nrCommands; i++) {
|
||||
skd = scintKeyDefs[i];
|
||||
_scintillaKeyCommands.push_back(ScintillaKeyMap(Shortcut(skd.name, skd.isCtrl, skd.isAlt, skd.isShift, skd.vKey), skd.functionId, skd.redirFunctionId));
|
||||
if (skd.functionId == prevID) {
|
||||
KeyCombo kc;
|
||||
kc._isCtrl = skd.isCtrl;
|
||||
kc._isAlt = skd.isAlt;
|
||||
kc._isShift = skd.isShift;
|
||||
kc._key = skd.vKey;
|
||||
_scintillaKeyCommands[prevIndex].addKeyCombo(kc);
|
||||
} else {
|
||||
_scintillaKeyCommands.push_back(ScintillaKeyMap(Shortcut(skd.name, skd.isCtrl, skd.isAlt, skd.isShift, skd.vKey), skd.functionId, skd.redirFunctionId));
|
||||
prevIndex++;
|
||||
}
|
||||
prevID = skd.functionId;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1085,20 +1103,14 @@ void NppParameters::feedShortcut(TiXmlNode *node)
|
|||
const char *idStr = (childNode->ToElement())->Attribute("id", &id);
|
||||
if (idStr)
|
||||
{
|
||||
Shortcut sc;
|
||||
if (getShortcuts(childNode, sc))// && sc.isValid()) //do not validate
|
||||
//find the commandid that matches this Shortcut sc and alter it, push back its index in the modified list, if not present
|
||||
int len = (int)_shortcuts.size();
|
||||
for(int i = 0; i < len; i++)
|
||||
{
|
||||
//find the commandid that matches this Shortcut sc and alter it, push back its index in the modified list, if not present
|
||||
int len = (int)_shortcuts.size();
|
||||
for(int i = 0; i < len; i++)
|
||||
{
|
||||
if (_shortcuts[i].getID() == id)
|
||||
{ //found our match
|
||||
CommandShortcut csc = CommandShortcut(sc, id);
|
||||
strncpy(csc._name, _shortcuts[i]._name, nameLenMax);
|
||||
_shortcuts[i] = csc;
|
||||
addUserModifiedIndex(i);
|
||||
}
|
||||
if (_shortcuts[i].getID() == id)
|
||||
{ //found our match
|
||||
getShortcuts(childNode, _shortcuts[i]);
|
||||
addUserModifiedIndex(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1195,33 +1207,27 @@ void NppParameters::feedPluginCustomizedCmds(TiXmlNode *node)
|
|||
childNode ;
|
||||
childNode = childNode->NextSibling("PluginCommand") )
|
||||
{
|
||||
Shortcut sc;
|
||||
if (getShortcuts(childNode, sc))// && sc.isValid())
|
||||
const char *moduleName = (childNode->ToElement())->Attribute("moduleName");
|
||||
if (!moduleName)
|
||||
continue;
|
||||
|
||||
int internalID = -1;
|
||||
const char *internalIDStr = (childNode->ToElement())->Attribute("internalID", &internalID);
|
||||
|
||||
if (!internalIDStr)
|
||||
continue;
|
||||
|
||||
//Find the corresponding plugincommand and alter it, put the index in the list
|
||||
int len = (int)_pluginCommands.size();
|
||||
for(int i = 0; i < len; i++)
|
||||
{
|
||||
const char *moduleName = (childNode->ToElement())->Attribute("moduleName");
|
||||
if (!moduleName)
|
||||
continue;
|
||||
|
||||
int internalID = -1;
|
||||
const char *internalIDStr = (childNode->ToElement())->Attribute("internalID", &internalID);
|
||||
|
||||
if (!internalIDStr)
|
||||
continue;
|
||||
|
||||
//Find the corresponding plugincommand and alter it, put the index in the list
|
||||
int len = (int)_pluginCommands.size();
|
||||
for(int i = 0; i < len; i++)
|
||||
PluginCmdShortcut & pscOrig = _pluginCommands[i];
|
||||
if (!_strnicmp(pscOrig.getModuleName(), moduleName, strlen(moduleName)) && pscOrig.getInternalID() == internalID)
|
||||
{
|
||||
PluginCmdShortcut pscOrig = _pluginCommands[i];
|
||||
if (!_strnicmp(pscOrig.getModuleName(), moduleName, strlen(moduleName)) && pscOrig.getInternalID() == internalID)
|
||||
{
|
||||
//Found matching command
|
||||
PluginCmdShortcut pcs(sc, _pluginCommands[i].getID(), moduleName, internalID);
|
||||
strncpy(pcs._name, pscOrig._name, 64);
|
||||
_pluginCommands[i] = pcs;
|
||||
addPluginModifiedIndex(i);
|
||||
break;
|
||||
}
|
||||
//Found matching command
|
||||
getShortcuts(childNode, _pluginCommands[i]);
|
||||
addPluginModifiedIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1236,33 +1242,56 @@ void NppParameters::feedScintKeys(TiXmlNode *node)
|
|||
childNode ;
|
||||
childNode = childNode->NextSibling("ScintKey") )
|
||||
{
|
||||
Shortcut sc;
|
||||
if (getShortcuts(childNode, sc))
|
||||
int scintKey;
|
||||
const char *keyStr = (childNode->ToElement())->Attribute("ScintID", &scintKey);
|
||||
if (!keyStr)
|
||||
continue;
|
||||
|
||||
int menuID;
|
||||
keyStr = (childNode->ToElement())->Attribute("menuCmdID", &menuID);
|
||||
if (!keyStr)
|
||||
continue;
|
||||
|
||||
//Find the corresponding scintillacommand and alter it, put the index in the list
|
||||
size_t len = _scintillaKeyCommands.size();
|
||||
for(size_t i = 0; i < len; i++)
|
||||
{
|
||||
int scintKey;
|
||||
const char *keyStr = (childNode->ToElement())->Attribute("ScintID", &scintKey);
|
||||
if (!keyStr)
|
||||
continue;
|
||||
|
||||
int menuID;
|
||||
keyStr = (childNode->ToElement())->Attribute("menuCmdID", &menuID);
|
||||
if (!keyStr)
|
||||
continue;
|
||||
|
||||
//Find the corresponding scintillacommand and alter it, put the index in the list
|
||||
size_t len = _scintillaKeyCommands.size();
|
||||
for(size_t i = 0; i < len; i++)
|
||||
ScintillaKeyMap & skmOrig = _scintillaKeyCommands[i];
|
||||
if (skmOrig.getScintillaKeyID() == scintKey &&skmOrig.getMenuCmdID() == menuID)
|
||||
{
|
||||
ScintillaKeyMap skmOrig = _scintillaKeyCommands[i];
|
||||
if (skmOrig.getScintillaKeyID() == scintKey &&skmOrig.getMenuCmdID() == menuID)
|
||||
//Found matching command
|
||||
_scintillaKeyCommands[i].clearDups();
|
||||
getShortcuts(childNode, _scintillaKeyCommands[i]);
|
||||
_scintillaKeyCommands[i].setKeyComboByIndex(0, _scintillaKeyCommands[i].getKeyCombo());
|
||||
addScintillaModifiedIndex(i);
|
||||
KeyCombo kc;
|
||||
for (TiXmlNode *nextNode = childNode->FirstChildElement("NextKey");
|
||||
nextNode ;
|
||||
nextNode = childNode->NextSibling("NextKey") )
|
||||
{
|
||||
//Found matching command
|
||||
ScintillaKeyMap skm(sc, scintKey, menuID);
|
||||
strncpy(skm._name, skmOrig._name, 64);
|
||||
_scintillaKeyCommands[i] = skm;
|
||||
addScintillaModifiedIndex(i);
|
||||
break;
|
||||
const char *str = (nextNode->ToElement())->Attribute("Ctrl");
|
||||
if (!str)
|
||||
continue;
|
||||
kc._isCtrl = !strcmp("yes", str);
|
||||
|
||||
str = (nextNode->ToElement())->Attribute("Alt");
|
||||
if (!str)
|
||||
continue;
|
||||
kc._isAlt = !strcmp("yes", str);
|
||||
|
||||
str = (nextNode->ToElement())->Attribute("Shift");
|
||||
if (!str)
|
||||
continue;
|
||||
kc._isShift = !strcmp("yes", str);
|
||||
|
||||
int key;
|
||||
str = (nextNode->ToElement())->Attribute("Key", &key);
|
||||
if (!str)
|
||||
continue;
|
||||
kc._key = key;
|
||||
_scintillaKeyCommands[i].addKeyCombo(kc);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1296,11 +1325,7 @@ bool NppParameters::getShortcuts(TiXmlNode *node, Shortcut & sc)
|
|||
if (!keyStr)
|
||||
return false;
|
||||
|
||||
strncpy(sc._name, name, 64);
|
||||
sc._isCtrl = isCtrl;
|
||||
sc._isAlt = isAlt;
|
||||
sc._isShift = isShift;
|
||||
sc._key = (unsigned char)key;
|
||||
sc = Shortcut(name, isCtrl, isAlt, isShift, key);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1371,23 +1396,24 @@ void NppParameters::writeUserDefinedLang()
|
|||
|
||||
void NppParameters::insertCmd(TiXmlNode *shortcutsRoot, const CommandShortcut & cmd)
|
||||
{
|
||||
const KeyCombo & key = cmd.getKeyCombo();
|
||||
TiXmlNode *sc = shortcutsRoot->InsertEndChild(TiXmlElement("Shortcut"));
|
||||
sc->ToElement()->SetAttribute("id", cmd.getID());
|
||||
sc->ToElement()->SetAttribute("Ctrl", cmd._isCtrl?"yes":"no");
|
||||
sc->ToElement()->SetAttribute("Alt", cmd._isAlt?"yes":"no");
|
||||
sc->ToElement()->SetAttribute("Shift", cmd._isShift?"yes":"no");
|
||||
sc->ToElement()->SetAttribute("Key", cmd._key);
|
||||
sc->ToElement()->SetAttribute("Ctrl", key._isCtrl?"yes":"no");
|
||||
sc->ToElement()->SetAttribute("Alt", key._isAlt?"yes":"no");
|
||||
sc->ToElement()->SetAttribute("Shift", key._isShift?"yes":"no");
|
||||
sc->ToElement()->SetAttribute("Key", key._key);
|
||||
}
|
||||
|
||||
void NppParameters::insertMacro(TiXmlNode *macrosRoot, const MacroShortcut & macro)
|
||||
{
|
||||
const KeyCombo & key = macro.getKeyCombo();
|
||||
TiXmlNode *macroRoot = macrosRoot->InsertEndChild(TiXmlElement("Macro"));
|
||||
|
||||
macroRoot->ToElement()->SetAttribute("name", macro._name);
|
||||
macroRoot->ToElement()->SetAttribute("Ctrl", macro._isCtrl?"yes":"no");
|
||||
macroRoot->ToElement()->SetAttribute("Alt", macro._isAlt?"yes":"no");
|
||||
macroRoot->ToElement()->SetAttribute("Shift", macro._isShift?"yes":"no");
|
||||
macroRoot->ToElement()->SetAttribute("Key", macro._key);
|
||||
macroRoot->ToElement()->SetAttribute("name", macro.getName());
|
||||
macroRoot->ToElement()->SetAttribute("Ctrl", key._isCtrl?"yes":"no");
|
||||
macroRoot->ToElement()->SetAttribute("Alt", key._isAlt?"yes":"no");
|
||||
macroRoot->ToElement()->SetAttribute("Shift", key._isShift?"yes":"no");
|
||||
macroRoot->ToElement()->SetAttribute("Key", key._key);
|
||||
for (size_t i = 0 ; i < macro._macro.size() ; i++)
|
||||
{
|
||||
TiXmlNode *actionNode = macroRoot->InsertEndChild(TiXmlElement("Action"));
|
||||
|
@ -1402,36 +1428,54 @@ void NppParameters::insertMacro(TiXmlNode *macrosRoot, const MacroShortcut & mac
|
|||
|
||||
void NppParameters::insertUserCmd(TiXmlNode *userCmdRoot, const UserCommand & userCmd)
|
||||
{
|
||||
const KeyCombo & key = userCmd.getKeyCombo();
|
||||
TiXmlNode *cmdRoot = userCmdRoot->InsertEndChild(TiXmlElement("Command"));
|
||||
cmdRoot->ToElement()->SetAttribute("name", userCmd._name);
|
||||
cmdRoot->ToElement()->SetAttribute("Ctrl", userCmd._isCtrl?"yes":"no");
|
||||
cmdRoot->ToElement()->SetAttribute("Alt", userCmd._isAlt?"yes":"no");
|
||||
cmdRoot->ToElement()->SetAttribute("Shift", userCmd._isShift?"yes":"no");
|
||||
cmdRoot->ToElement()->SetAttribute("Key", userCmd._key);
|
||||
cmdRoot->ToElement()->SetAttribute("name", userCmd.getName());
|
||||
cmdRoot->ToElement()->SetAttribute("Ctrl", key._isCtrl?"yes":"no");
|
||||
cmdRoot->ToElement()->SetAttribute("Alt", key._isAlt?"yes":"no");
|
||||
cmdRoot->ToElement()->SetAttribute("Shift", key._isShift?"yes":"no");
|
||||
cmdRoot->ToElement()->SetAttribute("Key", key._key);
|
||||
cmdRoot->InsertEndChild(TiXmlText(userCmd._cmd.c_str()));
|
||||
}
|
||||
|
||||
void NppParameters::insertPluginCmd(TiXmlNode *pluginCmdRoot, const PluginCmdShortcut & pluginCmd)
|
||||
{
|
||||
const KeyCombo & key = pluginCmd.getKeyCombo();
|
||||
TiXmlNode *pluginCmdNode = pluginCmdRoot->InsertEndChild(TiXmlElement("PluginCommand"));
|
||||
pluginCmdNode->ToElement()->SetAttribute("moduleName", pluginCmd._moduleName);
|
||||
pluginCmdNode->ToElement()->SetAttribute("internalID", pluginCmd._internalID);
|
||||
pluginCmdNode->ToElement()->SetAttribute("Ctrl", pluginCmd._isCtrl?"yes":"no");
|
||||
pluginCmdNode->ToElement()->SetAttribute("Alt", pluginCmd._isAlt?"yes":"no");
|
||||
pluginCmdNode->ToElement()->SetAttribute("Shift", pluginCmd._isShift?"yes":"no");
|
||||
pluginCmdNode->ToElement()->SetAttribute("Key", pluginCmd._key);
|
||||
pluginCmdNode->ToElement()->SetAttribute("moduleName", pluginCmd.getModuleName());
|
||||
pluginCmdNode->ToElement()->SetAttribute("internalID", pluginCmd.getInternalID());
|
||||
pluginCmdNode->ToElement()->SetAttribute("Ctrl", key._isCtrl?"yes":"no");
|
||||
pluginCmdNode->ToElement()->SetAttribute("Alt", key._isAlt?"yes":"no");
|
||||
pluginCmdNode->ToElement()->SetAttribute("Shift", key._isShift?"yes":"no");
|
||||
pluginCmdNode->ToElement()->SetAttribute("Key", key._key);
|
||||
}
|
||||
|
||||
void NppParameters::insertScintKey(TiXmlNode *scintKeyRoot, const ScintillaKeyMap & scintKeyMap)
|
||||
{
|
||||
TiXmlNode *keyRoot = scintKeyRoot->InsertEndChild(TiXmlElement("ScintKey"));
|
||||
|
||||
keyRoot->ToElement()->SetAttribute("ScintID", scintKeyMap.getScintillaKeyID());
|
||||
keyRoot->ToElement()->SetAttribute("menuCmdID", scintKeyMap.getMenuCmdID());
|
||||
keyRoot->ToElement()->SetAttribute("Ctrl", scintKeyMap._isCtrl?"yes":"no");
|
||||
keyRoot->ToElement()->SetAttribute("Alt", scintKeyMap._isAlt?"yes":"no");
|
||||
keyRoot->ToElement()->SetAttribute("Shift", scintKeyMap._isShift?"yes":"no");
|
||||
keyRoot->ToElement()->SetAttribute("Key", scintKeyMap._key);
|
||||
|
||||
//Add main shortcut
|
||||
KeyCombo key = scintKeyMap.getKeyComboByIndex(0);
|
||||
keyRoot->ToElement()->SetAttribute("Ctrl", key._isCtrl?"yes":"no");
|
||||
keyRoot->ToElement()->SetAttribute("Alt", key._isAlt?"yes":"no");
|
||||
keyRoot->ToElement()->SetAttribute("Shift", key._isShift?"yes":"no");
|
||||
keyRoot->ToElement()->SetAttribute("Key", key._key);
|
||||
|
||||
//Add additional shortcuts
|
||||
size_t size = scintKeyMap.getSize();
|
||||
if (size > 1) {
|
||||
TiXmlNode * keyNext;
|
||||
for(size_t i = 1; i < size; i++) {
|
||||
keyNext = keyRoot->InsertEndChild(TiXmlElement("NextKey"));
|
||||
key = scintKeyMap.getKeyComboByIndex(i);
|
||||
keyNext->ToElement()->SetAttribute("Ctrl", key._isCtrl?"yes":"no");
|
||||
keyNext->ToElement()->SetAttribute("Alt", key._isAlt?"yes":"no");
|
||||
keyNext->ToElement()->SetAttribute("Shift", key._isShift?"yes":"no");
|
||||
keyNext->ToElement()->SetAttribute("Key", key._key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NppParameters::writeSession(const Session & session, const char *fileName)
|
||||
|
@ -3902,3 +3946,4 @@ void NppParameters::addScintillaModifiedIndex(int index)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ class ScintillaEditView : public Window
|
|||
public:
|
||||
ScintillaEditView()
|
||||
: Window(), _pScintillaFunc(NULL),_pScintillaPtr(NULL),
|
||||
_currentIndex(0), _folderStyle(FOLDER_STYLE_BOX), _maxNbDigit(_MARGE_LINENUMBER_NB_CHIFFRE)
|
||||
_currentIndex(0), _folderStyle(FOLDER_STYLE_BOX), _maxNbDigit(_MARGE_LINENUMBER_NB_CHIFFRE), _wrapRestoreNeeded(false)
|
||||
{
|
||||
++_refCount;
|
||||
};
|
||||
|
|
|
@ -93,35 +93,35 @@ void ShortcutMapper::fillOutBabyGrid()
|
|||
case STATE_MENU: {
|
||||
vector<CommandShortcut> & cshortcuts = nppParam->getUserShortcuts();
|
||||
for(size_t i = 0; i < nrItems; i++) {
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i]._name);
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i].getName());
|
||||
_babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str());
|
||||
}
|
||||
break; }
|
||||
case STATE_MACRO: {
|
||||
vector<MacroShortcut> & cshortcuts = nppParam->getMacroList();
|
||||
for(size_t i = 0; i < nrItems; i++) {
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i]._name);
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i].getName());
|
||||
_babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str());
|
||||
}
|
||||
break; }
|
||||
case STATE_USER: {
|
||||
vector<UserCommand> & cshortcuts = nppParam->getUserCommandList();
|
||||
for(size_t i = 0; i < nrItems; i++) {
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i]._name);
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i].getName());
|
||||
_babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str());
|
||||
}
|
||||
break; }
|
||||
case STATE_PLUGIN: {
|
||||
vector<PluginCmdShortcut> & cshortcuts = nppParam->getPluginCommandList();
|
||||
for(size_t i = 0; i < nrItems; i++) {
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i]._name);
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i].getName());
|
||||
_babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str());
|
||||
}
|
||||
break; }
|
||||
case STATE_SCINTILLA: {
|
||||
vector<ScintillaKeyMap> & cshortcuts = nppParam->getScintillaKeyList();
|
||||
for(size_t i = 0; i < nrItems; i++) {
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i]._name);
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i].getName());
|
||||
_babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str());
|
||||
}
|
||||
break; }
|
||||
|
@ -212,7 +212,7 @@ BOOL CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
msc.init(_hInst, _hSelf);
|
||||
if (msc.doDialog() != -1 && prevmsc != msc) { //shortcut was altered
|
||||
shortcuts[row - 1] = msc;
|
||||
_babygrid.setText(row, 1, msc._name);
|
||||
_babygrid.setText(row, 1, msc.getName());
|
||||
_babygrid.setText(row, 2, msc.toString().c_str());
|
||||
|
||||
//Notify current Accelerator class to update everything
|
||||
|
@ -228,7 +228,7 @@ BOOL CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
prevucmd = ucmd;
|
||||
if (ucmd.doDialog() != -1 && prevucmd != ucmd) { //shortcut was altered
|
||||
shortcuts[row - 1] = ucmd;
|
||||
_babygrid.setText(row, 1, ucmd._name);
|
||||
_babygrid.setText(row, 1, ucmd.getName());
|
||||
_babygrid.setText(row, 2, ucmd.toString().c_str());
|
||||
|
||||
//Notify current Accelerator class to update everything
|
||||
|
|
|
@ -204,7 +204,6 @@ BOOL CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
|||
::GetDlgItemText(_hSelf, IDC_COMBO_RUN_PATH, cmd, MAX_PATH);
|
||||
UserCommand uc(Shortcut(), cmd, cmdID);
|
||||
uc.init(_hInst, _hSelf);
|
||||
uc._canModifyName = true;
|
||||
|
||||
if (uc.doDialog() != -1)
|
||||
{
|
||||
|
|
|
@ -67,7 +67,7 @@ public :
|
|||
::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_ADDSTRING, 0, (LPARAM)"Current recorded macro");
|
||||
|
||||
for (size_t i = 0 ; i < macroList.size() ; i++)
|
||||
::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_ADDSTRING, 0, (LPARAM)macroList[i]._name);
|
||||
::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_ADDSTRING, 0, (LPARAM)macroList[i].getName());
|
||||
|
||||
::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_SETCURSEL, 0, 0);
|
||||
m_macroIndex = 0;
|
||||
|
|
|
@ -162,19 +162,85 @@ string Shortcut::toString() const
|
|||
if (!isEnabled())
|
||||
return sc;
|
||||
|
||||
if (_isCtrl)
|
||||
if (_keyCombo._isCtrl)
|
||||
sc += "Ctrl+";
|
||||
if (_isAlt)
|
||||
if (_keyCombo._isAlt)
|
||||
sc += "Alt+";
|
||||
if (_isShift)
|
||||
if (_keyCombo._isShift)
|
||||
sc += "Shift+";
|
||||
|
||||
string key;
|
||||
getKeyStrFromVal(_key, key);
|
||||
sc += key;
|
||||
string keyString;
|
||||
getKeyStrFromVal(_keyCombo._key, keyString);
|
||||
sc += keyString;
|
||||
return sc;
|
||||
}
|
||||
|
||||
string ScintillaKeyMap::toString() const {
|
||||
return toString(0);
|
||||
}
|
||||
|
||||
string ScintillaKeyMap::toString(int index) const {
|
||||
string sc = "";
|
||||
if (!isEnabled())
|
||||
return sc;
|
||||
|
||||
KeyCombo kc = _keyCombos[index];
|
||||
if (kc._isCtrl)
|
||||
sc += "Ctrl+";
|
||||
if (kc._isAlt)
|
||||
sc += "Alt+";
|
||||
if (kc._isShift)
|
||||
sc += "Shift+";
|
||||
|
||||
string keyString;
|
||||
getKeyStrFromVal(kc._key, keyString);
|
||||
sc += keyString;
|
||||
return sc;
|
||||
}
|
||||
|
||||
KeyCombo ScintillaKeyMap::getKeyComboByIndex(int index) const {
|
||||
return _keyCombos[index];
|
||||
}
|
||||
|
||||
void ScintillaKeyMap::setKeyComboByIndex(int index, KeyCombo combo) {
|
||||
if(combo._key == 0 && (size > 1)) { //remove the item if possible
|
||||
_keyCombos.erase(_keyCombos.begin() + index);
|
||||
}
|
||||
_keyCombos[index] = combo;
|
||||
}
|
||||
|
||||
void ScintillaKeyMap::removeKeyComboByIndex(int index) {
|
||||
if (size > 1 && index > -1 && index < int(size)) {
|
||||
_keyCombos.erase(_keyCombos.begin() + index);
|
||||
size--;
|
||||
}
|
||||
}
|
||||
|
||||
int ScintillaKeyMap::addKeyCombo(KeyCombo combo) { //returns index where key is added, or -1 when invalid
|
||||
if (combo._key == 0) //do not allow to add disabled keycombos
|
||||
return -1;
|
||||
if (!isEnabled()) { //disabled, override current combo with new enabled one
|
||||
_keyCombos[0] = combo;
|
||||
return 0;
|
||||
}
|
||||
for(size_t i = 0; i < size; i++) { //if already in the list do not add it
|
||||
KeyCombo & kc = _keyCombos[i];
|
||||
if (combo._key == kc._key && combo._isCtrl == kc._isCtrl && combo._isAlt == kc._isAlt && combo._isShift == kc._isShift)
|
||||
return i; //already in the list
|
||||
}
|
||||
_keyCombos.push_back(combo);
|
||||
size++;
|
||||
return (size - 1);
|
||||
}
|
||||
|
||||
bool ScintillaKeyMap::isEnabled() const {
|
||||
return (_keyCombos[0]._key != 0);
|
||||
}
|
||||
|
||||
size_t ScintillaKeyMap::getSize() const {
|
||||
return size;
|
||||
}
|
||||
|
||||
void getKeyStrFromVal(unsigned char keyVal, string & str)
|
||||
{
|
||||
str = "";
|
||||
|
@ -198,13 +264,13 @@ void getNameStrFromCmd(DWORD cmd, string & str)
|
|||
{
|
||||
vector<MacroShortcut> & theMacros = (NppParameters::getInstance())->getMacroList();
|
||||
int i = cmd - ID_MACRO;
|
||||
str = theMacros[i]._name;
|
||||
str = theMacros[i].getName();
|
||||
}
|
||||
else if ((cmd >= ID_USER_CMD) && (cmd < ID_USER_CMD_LIMIT))
|
||||
{
|
||||
vector<UserCommand> & userCommands = (NppParameters::getInstance())->getUserCommandList();
|
||||
int i = cmd - ID_USER_CMD;
|
||||
str = userCommands[i]._name;
|
||||
str = userCommands[i].getName();
|
||||
}
|
||||
else if ((cmd >= ID_PLUGINS_CMD) && (cmd < ID_PLUGINS_CMD_LIMIT))
|
||||
{
|
||||
|
@ -218,7 +284,7 @@ void getNameStrFromCmd(DWORD cmd, string & str)
|
|||
break;
|
||||
}
|
||||
}
|
||||
str = pluginCmds[i]._name;
|
||||
str = pluginCmds[i].getName();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -266,16 +332,16 @@ BOOL CALLBACK Shortcut::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
|
|||
::SendDlgItemMessage(_hSelf, IDC_NAME_EDIT, EM_SETREADONLY, TRUE, 0);
|
||||
int textlen = (int)::SendDlgItemMessage(_hSelf, IDC_NAME_EDIT, WM_GETTEXTLENGTH, 0, 0);
|
||||
|
||||
::SendDlgItemMessage(_hSelf, IDC_CTRL_CHECK, BM_SETCHECK, _isCtrl?BST_CHECKED:BST_UNCHECKED, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_ALT_CHECK, BM_SETCHECK, _isAlt?BST_CHECKED:BST_UNCHECKED, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_SHIFT_CHECK, BM_SETCHECK, _isShift?BST_CHECKED:BST_UNCHECKED, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CTRL_CHECK, BM_SETCHECK, _keyCombo._isCtrl?BST_CHECKED:BST_UNCHECKED, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_ALT_CHECK, BM_SETCHECK, _keyCombo._isAlt?BST_CHECKED:BST_UNCHECKED, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_SHIFT_CHECK, BM_SETCHECK, _keyCombo._isShift?BST_CHECKED:BST_UNCHECKED, 0);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDOK), isValid() && (textlen > 0 || !_canModifyName));
|
||||
int iFound = -1;
|
||||
for (size_t i = 0 ; i < nrKeys ; i++)
|
||||
{
|
||||
::SendDlgItemMessage(_hSelf, IDC_KEY_COMBO, CB_ADDSTRING, 0, (LPARAM)namedKeyArray[i].name);
|
||||
|
||||
if (_key == namedKeyArray[i].id)
|
||||
if (_keyCombo._key == namedKeyArray[i].id)
|
||||
iFound = i;
|
||||
}
|
||||
|
||||
|
@ -293,22 +359,22 @@ BOOL CALLBACK Shortcut::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
|
|||
switch (wParam)
|
||||
{
|
||||
case IDC_CTRL_CHECK :
|
||||
_isCtrl = BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0);
|
||||
_keyCombo._isCtrl = BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDOK), isValid() && (textlen > 0 || !_canModifyName));
|
||||
return TRUE;
|
||||
|
||||
case IDC_ALT_CHECK :
|
||||
_isAlt = BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0);
|
||||
_keyCombo._isAlt = BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDOK), isValid() && (textlen > 0 || !_canModifyName));
|
||||
return TRUE;
|
||||
|
||||
case IDC_SHIFT_CHECK :
|
||||
_isShift = BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0);
|
||||
_keyCombo._isShift = BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0);
|
||||
return TRUE;
|
||||
|
||||
case IDOK :
|
||||
if (!isEnabled()) {
|
||||
_isCtrl = _isAlt = _isShift = false;
|
||||
_keyCombo._isCtrl = _keyCombo._isAlt = _keyCombo._isShift = false;
|
||||
}
|
||||
if (_canModifyName)
|
||||
::SendDlgItemMessage(_hSelf, IDC_NAME_EDIT, WM_GETTEXT, nameLenMax, (LPARAM)_name);
|
||||
|
@ -333,7 +399,7 @@ BOOL CALLBACK Shortcut::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
|
|||
if (LOWORD(wParam) == IDC_KEY_COMBO)
|
||||
{
|
||||
int i = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETCURSEL, 0, 0);
|
||||
_key = namedKeyArray[i].id;
|
||||
_keyCombo._key = namedKeyArray[i].id;
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDOK), isValid() && (textlen > 0 || !_canModifyName));
|
||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_WARNING_STATIC), isEnabled()?SW_HIDE:SW_SHOW);
|
||||
return TRUE;
|
||||
|
@ -350,9 +416,8 @@ BOOL CALLBACK Shortcut::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
|
||||
// return true if one of CommandShortcuts is deleted. Otherwise false.
|
||||
bool Accelerator::updateShortcuts(/*HWND nppHandle*/)
|
||||
void Accelerator::updateShortcuts()
|
||||
{
|
||||
bool isCmdScModified = false;
|
||||
NppParameters *pNppParam = NppParameters::getInstance();
|
||||
|
||||
vector<CommandShortcut> & shortcuts = pNppParam->getUserShortcuts();
|
||||
|
@ -367,16 +432,16 @@ bool Accelerator::updateShortcuts(/*HWND nppHandle*/)
|
|||
|
||||
if (_pAccelArray)
|
||||
delete [] _pAccelArray;
|
||||
|
||||
_pAccelArray = new ACCEL[nbMenu+nbMacro+nbUserCmd+nbPluginCmd];
|
||||
|
||||
int offset = 0;
|
||||
size_t i = 0;
|
||||
//no validation performed, it might be that invalid shortcuts are being used by default. Allows user to 'hack', might be a good thing
|
||||
for(i = 0; i < nbMenu; i++) {
|
||||
if (shortcuts[i].isEnabled()) {// && shortcuts[i].isValid()) {
|
||||
_pAccelArray[offset].cmd = (WORD)(shortcuts[i].getID());
|
||||
_pAccelArray[offset].fVirt = FVIRTKEY | (shortcuts[i]._isCtrl?FCONTROL:0) | (shortcuts[i]._isAlt?FALT:0) | (shortcuts[i]._isShift?FSHIFT:0);
|
||||
_pAccelArray[offset].key = shortcuts[i]._key;
|
||||
_pAccelArray[offset].fVirt = shortcuts[i].getAcceleratorModifiers();
|
||||
_pAccelArray[offset].key = shortcuts[i].getKeyCombo()._key;
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
@ -384,8 +449,8 @@ bool Accelerator::updateShortcuts(/*HWND nppHandle*/)
|
|||
for(i = 0; i < nbMacro; i++) {
|
||||
if (macros[i].isEnabled()) {// && macros[i].isValid()) {
|
||||
_pAccelArray[offset].cmd = (WORD)(macros[i].getID());
|
||||
_pAccelArray[offset].fVirt = FVIRTKEY | (macros[i]._isCtrl?FCONTROL:0) | (macros[i]._isAlt?FALT:0) | (macros[i]._isShift?FSHIFT:0);
|
||||
_pAccelArray[offset].key = macros[i]._key;
|
||||
_pAccelArray[offset].fVirt = macros[i].getAcceleratorModifiers();
|
||||
_pAccelArray[offset].key = macros[i].getKeyCombo()._key;
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
@ -393,8 +458,8 @@ bool Accelerator::updateShortcuts(/*HWND nppHandle*/)
|
|||
for(i = 0; i < nbUserCmd; i++) {
|
||||
if (userCommands[i].isEnabled()) {// && userCommands[i].isValid()) {
|
||||
_pAccelArray[offset].cmd = (WORD)(userCommands[i].getID());
|
||||
_pAccelArray[offset].fVirt = FVIRTKEY | (userCommands[i]._isCtrl?FCONTROL:0) | (userCommands[i]._isAlt?FALT:0) | (userCommands[i]._isShift?FSHIFT:0);
|
||||
_pAccelArray[offset].key = userCommands[i]._key;
|
||||
_pAccelArray[offset].fVirt = userCommands[i].getAcceleratorModifiers();
|
||||
_pAccelArray[offset].key = userCommands[i].getKeyCombo()._key;
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
@ -402,8 +467,8 @@ bool Accelerator::updateShortcuts(/*HWND nppHandle*/)
|
|||
for(i = 0; i < nbPluginCmd; i++) {
|
||||
if (pluginCommands[i].isEnabled()) {// && pluginCommands[i].isValid()) {
|
||||
_pAccelArray[offset].cmd = (WORD)(pluginCommands[i].getID());
|
||||
_pAccelArray[offset].fVirt = FVIRTKEY | (pluginCommands[i]._isCtrl?FCONTROL:0) | (pluginCommands[i]._isAlt?FALT:0) | (pluginCommands[i]._isShift?FSHIFT:0);
|
||||
_pAccelArray[offset].key = pluginCommands[i]._key;
|
||||
_pAccelArray[offset].fVirt = pluginCommands[i].getAcceleratorModifiers();
|
||||
_pAccelArray[offset].key = pluginCommands[i].getKeyCombo()._key;
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
@ -412,7 +477,7 @@ bool Accelerator::updateShortcuts(/*HWND nppHandle*/)
|
|||
|
||||
updateFullMenu();
|
||||
reNew(); //update the table
|
||||
return isCmdScModified;
|
||||
return;
|
||||
}
|
||||
|
||||
void Accelerator::updateFullMenu() {
|
||||
|
@ -518,13 +583,16 @@ void ScintillaAccelerator::updateKeys() {
|
|||
NppParameters *pNppParam = NppParameters::getInstance();
|
||||
vector<ScintillaKeyMap> & map = pNppParam->getScintillaKeyList();
|
||||
size_t mapSize = map.size();
|
||||
size_t index;
|
||||
|
||||
for(int i = 0; i < _nrScintillas; i++) {
|
||||
::SendMessage(_vScintillas[i], SCI_CLEARALLCMDKEYS, 0, 0);
|
||||
for(size_t j = mapSize - 1; j >= 0; j--) { //reverse order, top of the list has highest priority
|
||||
ScintillaKeyMap skm = map[j];
|
||||
if (skm.isEnabled()) { //no validating, scintilla accepts more keys
|
||||
::SendMessage(_vScintillas[i], SCI_ASSIGNCMDKEY, skm.toKeyDef(), skm.getScintillaKeyID());
|
||||
size_t size = skm.getSize();
|
||||
for(index = 0; index < size; index++)
|
||||
::SendMessage(_vScintillas[i], SCI_ASSIGNCMDKEY, skm.toKeyDef(index), skm.getScintillaKeyID());
|
||||
}
|
||||
if (skm.getMenuCmdID() != 0) {
|
||||
updateMenuItemByID(skm, skm.getMenuCmdID());
|
||||
|
@ -538,10 +606,10 @@ void ScintillaAccelerator::updateKeys() {
|
|||
void ScintillaAccelerator::updateKey(ScintillaKeyMap skmOld, ScintillaKeyMap skmNew) {
|
||||
updateKeys(); //do a full update, double mappings can make this work badly
|
||||
return;
|
||||
for(int i = 0; i < _nrScintillas; i++) {
|
||||
::SendMessage(_vScintillas[i], SCI_CLEARCMDKEY, skmOld.toKeyDef(), 0);
|
||||
::SendMessage(_vScintillas[i], SCI_ASSIGNCMDKEY, skmNew.toKeyDef(), skmNew.getScintillaKeyID());
|
||||
}
|
||||
//for(int i = 0; i < _nrScintillas; i++) {
|
||||
// ::SendMessage(_vScintillas[i], SCI_CLEARCMDKEY, skmOld.toKeyDef(0), 0);
|
||||
// ::SendMessage(_vScintillas[i], SCI_ASSIGNCMDKEY, skmNew.toKeyDef(0), skmNew.getScintillaKeyID());
|
||||
//}
|
||||
}
|
||||
|
||||
void ScintillaAccelerator::updateMenuItemByID(ScintillaKeyMap skm, int id) {
|
||||
|
@ -565,3 +633,168 @@ void ScintillaAccelerator::updateMenuItemByID(ScintillaKeyMap skm, int id) {
|
|||
::ModifyMenu(_hAccelMenu, id, MF_BYCOMMAND, id, menuItem.c_str());
|
||||
::DrawMenuBar(_hMenuParent);
|
||||
}
|
||||
|
||||
//This procedure uses _keyCombo as a temp. variable to store current settings which can then later be applied (by pressing OK)
|
||||
void ScintillaKeyMap::applyToCurrentIndex() {
|
||||
int index = (int)::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_GETCURSEL, 0, 0);
|
||||
if(index == LB_ERR)
|
||||
return;
|
||||
setKeyComboByIndex(index, _keyCombo);
|
||||
updateListItem(index);
|
||||
::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_SETCURSEL, index, 0);
|
||||
|
||||
}
|
||||
|
||||
void ScintillaKeyMap::validateDialog() {
|
||||
bool valid = isValid(); //current combo valid?
|
||||
bool isDisabling = _keyCombo._key == 0; //true if this keycombo were to disable the shortcut
|
||||
bool isDisabled = !isEnabled(); //true if this shortcut already is
|
||||
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_BUTTON_ADD), valid && !isDisabling);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_BUTTON_APPLY), valid && (!isDisabling || size == 1));
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_BUTTON_RMVE), (size > 1)?TRUE:FALSE);
|
||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_WARNING_STATIC), isDisabled?SW_SHOW:SW_HIDE);
|
||||
}
|
||||
|
||||
void ScintillaKeyMap::showCurrentSettings() {
|
||||
int i = ::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_GETCURSEL, 0, 0);
|
||||
_keyCombo = _keyCombos[i];
|
||||
::SendDlgItemMessage(_hSelf, IDC_CTRL_CHECK, BM_SETCHECK, _keyCombo._isCtrl?BST_CHECKED:BST_UNCHECKED, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_ALT_CHECK, BM_SETCHECK, _keyCombo._isAlt?BST_CHECKED:BST_UNCHECKED, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_SHIFT_CHECK, BM_SETCHECK, _keyCombo._isShift?BST_CHECKED:BST_UNCHECKED, 0);
|
||||
for (size_t i = 0 ; i < nrKeys ; i++)
|
||||
{
|
||||
if (_keyCombo._key == namedKeyArray[i].id)
|
||||
{
|
||||
::SendDlgItemMessage(_hSelf, IDC_KEY_COMBO, CB_SETCURSEL, i, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScintillaKeyMap::updateListItem(int index) {
|
||||
::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_INSERTSTRING, index, (LPARAM)toString(index).c_str());
|
||||
::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_DELETESTRING, index+1, 0);
|
||||
}
|
||||
|
||||
BOOL CALLBACK ScintillaKeyMap::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
||||
switch (Message)
|
||||
{
|
||||
case WM_INITDIALOG :
|
||||
{
|
||||
::SetDlgItemText(_hSelf, IDC_NAME_EDIT, _name);
|
||||
int textlen = (int)::SendDlgItemMessage(_hSelf, IDC_NAME_EDIT, WM_GETTEXTLENGTH, 0, 0);
|
||||
_keyCombo = _keyCombos[0];
|
||||
|
||||
for (size_t i = 0 ; i < nrKeys ; i++)
|
||||
{
|
||||
::SendDlgItemMessage(_hSelf, IDC_KEY_COMBO, CB_ADDSTRING, 0, (LPARAM)namedKeyArray[i].name);
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < size; i++) {
|
||||
::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_ADDSTRING, 0, (LPARAM)toString(i).c_str());
|
||||
}
|
||||
::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_SETCURSEL, 0, 0);
|
||||
|
||||
showCurrentSettings();
|
||||
validateDialog();
|
||||
|
||||
goToCenter();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_COMMAND :
|
||||
{
|
||||
switch (wParam)
|
||||
{
|
||||
case IDC_CTRL_CHECK :
|
||||
_keyCombo._isCtrl = BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0);
|
||||
//applyToCurrentIndex();
|
||||
validateDialog();
|
||||
return TRUE;
|
||||
|
||||
case IDC_ALT_CHECK :
|
||||
_keyCombo._isAlt = BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0);
|
||||
//applyToCurrentIndex();
|
||||
validateDialog();
|
||||
return TRUE;
|
||||
|
||||
case IDC_SHIFT_CHECK :
|
||||
_keyCombo._isShift = BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0);
|
||||
//applyToCurrentIndex();
|
||||
return TRUE;
|
||||
|
||||
case IDOK :
|
||||
//Cleanup
|
||||
_keyCombo._key = 0;
|
||||
_keyCombo._isCtrl = _keyCombo._isAlt = _keyCombo._isShift = false;
|
||||
::EndDialog(_hSelf, 0);
|
||||
return TRUE;
|
||||
|
||||
case IDCANCEL :
|
||||
::EndDialog(_hSelf, -1);
|
||||
return TRUE;
|
||||
|
||||
case IDC_BUTTON_ADD: {
|
||||
int oldsize = size;
|
||||
int res = addKeyCombo(_keyCombo);
|
||||
if (res > -1) {
|
||||
if (res == oldsize) {
|
||||
::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_INSERTSTRING, -1, (LPARAM)toString(res).c_str());
|
||||
}else { //update current string, can happen if it was disabled
|
||||
updateListItem(res);
|
||||
}
|
||||
::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_SETCURSEL, res, 0);
|
||||
}
|
||||
showCurrentSettings();
|
||||
validateDialog();
|
||||
return TRUE; }
|
||||
|
||||
case IDC_BUTTON_RMVE: {
|
||||
if (size == 1) //cannot delete last shortcut
|
||||
return TRUE;
|
||||
int i = ::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_GETCURSEL, 0, 0);
|
||||
removeKeyComboByIndex(i);
|
||||
::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_DELETESTRING, i, 0);
|
||||
if (i == size)
|
||||
i = size - 1;
|
||||
::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_SETCURSEL, i, 0);
|
||||
showCurrentSettings();
|
||||
validateDialog();
|
||||
return TRUE; }
|
||||
|
||||
case IDC_BUTTON_APPLY: {
|
||||
applyToCurrentIndex();
|
||||
validateDialog();
|
||||
return TRUE; }
|
||||
|
||||
default:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == LBN_SELCHANGE)
|
||||
{
|
||||
switch(LOWORD(wParam)) {
|
||||
case IDC_KEY_COMBO:
|
||||
{
|
||||
int i = ::SendDlgItemMessage(_hSelf, IDC_KEY_COMBO, CB_GETCURSEL, 0, 0);
|
||||
_keyCombo._key = namedKeyArray[i].id;
|
||||
//applyToCurrentIndex();
|
||||
validateDialog();
|
||||
return TRUE;
|
||||
}
|
||||
case IDC_LIST_KEYS:
|
||||
{
|
||||
showCurrentSettings();
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
default :
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -61,73 +61,86 @@ static int keyTranslate(int keyIn) {
|
|||
}
|
||||
};
|
||||
|
||||
class Shortcut : public StaticDialog {
|
||||
public:
|
||||
char _name[nameLenMax];
|
||||
struct KeyCombo {
|
||||
bool _isCtrl;
|
||||
bool _isAlt;
|
||||
bool _isShift;
|
||||
unsigned char _key;
|
||||
bool _canModifyName;
|
||||
};
|
||||
|
||||
Shortcut():_isCtrl(false), _isAlt(false), _isShift(false), _key(0), _canModifyName(false) {_name[0] = '\0';};
|
||||
Shortcut(const Shortcut & shortcut) {
|
||||
this->_isCtrl = shortcut._isCtrl;
|
||||
this->_isAlt = shortcut._isAlt;
|
||||
this->_isShift = shortcut._isShift;
|
||||
this->_key = shortcut._key;
|
||||
strcpy(this->_name, shortcut._name);
|
||||
this->_canModifyName = shortcut._canModifyName;
|
||||
class Shortcut : public StaticDialog {
|
||||
public:
|
||||
Shortcut(): _canModifyName(false) {
|
||||
_name[0] = '\0';
|
||||
_keyCombo._isCtrl = false;
|
||||
_keyCombo._isAlt = false;
|
||||
_keyCombo._isShift = false;
|
||||
_keyCombo._key = 0;
|
||||
};
|
||||
Shortcut(const char *name, bool isCtrl, bool isAlt, bool isShift, unsigned char key) :\
|
||||
_isCtrl(isCtrl), _isAlt(isAlt), _isShift(isShift), _key(key) {
|
||||
|
||||
Shortcut(const char *name, bool isCtrl, bool isAlt, bool isShift, unsigned char key) : _canModifyName(false) {
|
||||
_name[0] = '\0';
|
||||
if (name)
|
||||
strcpy(_name, name);
|
||||
this->_canModifyName = false;
|
||||
_keyCombo._isCtrl = isCtrl;
|
||||
_keyCombo._isAlt = isAlt;
|
||||
_keyCombo._isShift = isShift;
|
||||
_keyCombo._key = key;
|
||||
};
|
||||
|
||||
Shortcut(const Shortcut & sc) {
|
||||
lstrcpyn(_name, sc._name, nameLenMax);
|
||||
_keyCombo = sc._keyCombo;
|
||||
_canModifyName = sc._canModifyName;
|
||||
}
|
||||
|
||||
BYTE getAcceleratorModifiers() {
|
||||
return ( FVIRTKEY | (_keyCombo._isCtrl?FCONTROL:0) | (_keyCombo._isAlt?FALT:0) | (_keyCombo._isShift?FSHIFT:0) );
|
||||
};
|
||||
|
||||
Shortcut & operator=(const Shortcut & sc) {
|
||||
//Do not allow setting empty names
|
||||
//So either we have an empty name or the other name has to be set
|
||||
if (_name[0] == 0 || sc._name[0] != 0)
|
||||
lstrcpyn(_name, sc._name, nameLenMax);
|
||||
_keyCombo = sc._keyCombo;
|
||||
this->_canModifyName = sc._canModifyName;
|
||||
return *this;
|
||||
}
|
||||
friend inline const bool operator==(const Shortcut & a, const Shortcut & b) {
|
||||
return ((strcmp(a._name, b._name) == 0) && (a._isCtrl == b._isCtrl) && (a._isAlt == b._isAlt) && (a._isShift == b._isShift) && (a._key == b._key));
|
||||
return ((strcmp(a._name, b._name) == 0) &&
|
||||
(a._keyCombo._isCtrl == b._keyCombo._isCtrl) &&
|
||||
(a._keyCombo._isAlt == b._keyCombo._isAlt) &&
|
||||
(a._keyCombo._isShift == b._keyCombo._isShift) &&
|
||||
(a._keyCombo._key == b._keyCombo._key)
|
||||
);
|
||||
};
|
||||
|
||||
friend inline const bool operator!=(const Shortcut & a, const Shortcut & b) {
|
||||
return !((strcmp(a._name, b._name) == 0) && (a._isCtrl == b._isCtrl) && (a._isAlt == b._isAlt) && (a._isShift == b._isShift) && (a._key == b._key));
|
||||
return !(a == b);
|
||||
};
|
||||
|
||||
void copyShortcut(const Shortcut & sc) {
|
||||
if (this != &sc)
|
||||
{
|
||||
strcpy(this->_name, sc._name);
|
||||
this->_isAlt = sc._isAlt;
|
||||
this->_isCtrl = sc._isCtrl;
|
||||
this->_isShift = sc._isShift;
|
||||
this->_key = sc._key;
|
||||
this->_canModifyName = sc._canModifyName;
|
||||
}
|
||||
};
|
||||
|
||||
int doDialog() {
|
||||
virtual int doDialog() {
|
||||
return ::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_SHORTCUT_DLG), _hParent, (DLGPROC)dlgProc, (LPARAM)this);
|
||||
};
|
||||
|
||||
bool isValid() const { //valid should only be used in cases where the shortcut isEnabled().
|
||||
if (_key == 0)
|
||||
return true; //disabled key always valid, just disabled
|
||||
virtual bool isValid() const { //valid should only be used in cases where the shortcut isEnabled().
|
||||
if (_keyCombo._key == 0)
|
||||
return true; //disabled _keyCombo always valid, just disabled
|
||||
|
||||
//These keys need a modifier, else invalid
|
||||
if ( ((_key >= 'A') && (_key <= 'Z')) || ((_key >= '0') && (_key <= '9')) || _key == VK_SPACE || _key == VK_CAPITAL || _key == VK_BACK || _key == VK_RETURN) {
|
||||
return ((_isCtrl) || (_isAlt));
|
||||
if ( ((_keyCombo._key >= 'A') && (_keyCombo._key <= 'Z')) || ((_keyCombo._key >= '0') && (_keyCombo._key <= '9')) || _keyCombo._key == VK_SPACE || _keyCombo._key == VK_CAPITAL || _keyCombo._key == VK_BACK || _keyCombo._key == VK_RETURN) {
|
||||
return ((_keyCombo._isCtrl) || (_keyCombo._isAlt));
|
||||
}
|
||||
// the remaining keys are always valid
|
||||
return true;
|
||||
};
|
||||
bool isEnabled() const { //true if key != 0, false if key == 0, in which case no accelerator should be made
|
||||
return (_key != 0);
|
||||
virtual bool isEnabled() const { //true if _keyCombo != 0, false if _keyCombo == 0, in which case no accelerator should be made
|
||||
return (_keyCombo._key != 0);
|
||||
};
|
||||
|
||||
string toString() const; //the hotkey part
|
||||
string toMenuItemString(int cmdID = 0) { //string suitable for menu, uses menu to retrieve name if command is specified
|
||||
virtual string toString() const; //the hotkey part
|
||||
string toMenuItemString() const { //string suitable for menu
|
||||
string str = _name;
|
||||
if(isEnabled())
|
||||
{
|
||||
|
@ -136,9 +149,23 @@ public:
|
|||
}
|
||||
return str;
|
||||
};
|
||||
protected :
|
||||
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
||||
const KeyCombo & getKeyCombo() const {
|
||||
return _keyCombo;
|
||||
};
|
||||
|
||||
const char * getName() const {
|
||||
return _name;
|
||||
};
|
||||
|
||||
void setName(const char * name) {
|
||||
lstrcpyn(_name, name, nameLenMax);
|
||||
}
|
||||
|
||||
protected :
|
||||
KeyCombo _keyCombo;
|
||||
virtual BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
||||
bool _canModifyName;
|
||||
char _name[nameLenMax];
|
||||
};
|
||||
|
||||
class CommandShortcut : public Shortcut {
|
||||
|
@ -147,24 +174,78 @@ public:
|
|||
unsigned long getID() const {return _id;};
|
||||
void setID(unsigned long id) { _id = id;};
|
||||
|
||||
protected :
|
||||
private :
|
||||
unsigned long _id;
|
||||
};
|
||||
|
||||
|
||||
class ScintillaKeyMap : public Shortcut {
|
||||
public:
|
||||
ScintillaKeyMap(Shortcut sc, unsigned long scintillaKeyID, unsigned long id): Shortcut(sc), _menuCmdID(id), _scintillaKeyID(scintillaKeyID) {};
|
||||
ScintillaKeyMap(Shortcut sc, unsigned long scintillaKeyID, unsigned long id): Shortcut(sc), _menuCmdID(id), _scintillaKeyID(scintillaKeyID) {
|
||||
_keyCombos.clear();
|
||||
_keyCombos.push_back(_keyCombo);
|
||||
_keyCombo._key = 0;
|
||||
size = 1;
|
||||
};
|
||||
unsigned long getScintillaKeyID() const {return _scintillaKeyID;};
|
||||
int getMenuCmdID() const {return _menuCmdID;};
|
||||
int toKeyDef() const {
|
||||
int keymod = (_isCtrl?SCMOD_CTRL:0) | (_isAlt?SCMOD_ALT:0) | (_isShift?SCMOD_SHIFT:0);
|
||||
return keyTranslate((int)_key) + (keymod << 16);
|
||||
int toKeyDef(int index) const {
|
||||
KeyCombo kc = _keyCombos[index];
|
||||
int keymod = (kc._isCtrl?SCMOD_CTRL:0) | (kc._isAlt?SCMOD_ALT:0) | (kc._isShift?SCMOD_SHIFT:0);
|
||||
return keyTranslate((int)kc._key) + (keymod << 16);
|
||||
};
|
||||
|
||||
KeyCombo getKeyComboByIndex(int index) const;
|
||||
void ScintillaKeyMap::setKeyComboByIndex(int index, KeyCombo combo);
|
||||
void removeKeyComboByIndex(int index);
|
||||
void clearDups() {
|
||||
if (size > 1)
|
||||
_keyCombos.erase(_keyCombos.begin()+1, _keyCombos.end());
|
||||
size = 1;
|
||||
};
|
||||
int addKeyCombo(KeyCombo combo);
|
||||
bool isEnabled() const;
|
||||
size_t getSize() const;
|
||||
|
||||
string toString() const;
|
||||
string toString(int index) const;
|
||||
|
||||
int doDialog() {
|
||||
return ::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_SHORTCUTSCINT_DLG), _hParent, (DLGPROC)dlgProc, (LPARAM)this);
|
||||
};
|
||||
|
||||
//only compares the internal KeyCombos, nothing else
|
||||
friend inline const bool operator==(const ScintillaKeyMap & a, const ScintillaKeyMap & b) {
|
||||
bool equal = a.size == b.size;
|
||||
if (!equal)
|
||||
return false;
|
||||
size_t i = 0;
|
||||
while(equal && (i < a.size)) {
|
||||
equal =
|
||||
(a._keyCombos[i]._isCtrl == b._keyCombos[i]._isCtrl) &&
|
||||
(a._keyCombos[i]._isAlt == b._keyCombos[i]._isAlt) &&
|
||||
(a._keyCombos[i]._isShift == b._keyCombos[i]._isShift) &&
|
||||
(a._keyCombos[i]._key == b._keyCombos[i]._key);
|
||||
i++;
|
||||
}
|
||||
return equal;
|
||||
};
|
||||
|
||||
friend inline const bool operator!=(const ScintillaKeyMap & a, const ScintillaKeyMap & b) {
|
||||
return !(a == b);
|
||||
};
|
||||
|
||||
private:
|
||||
unsigned long _scintillaKeyID;
|
||||
int _menuCmdID;
|
||||
vector<KeyCombo> _keyCombos;
|
||||
size_t size;
|
||||
void applyToCurrentIndex();
|
||||
void validateDialog();
|
||||
void showCurrentSettings();
|
||||
void updateListItem(int index);
|
||||
protected :
|
||||
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
||||
};
|
||||
|
||||
|
||||
|
@ -216,7 +297,7 @@ private:
|
|||
};
|
||||
|
||||
class PluginCmdShortcut : public CommandShortcut {
|
||||
friend class NppParameters;
|
||||
//friend class NppParameters;
|
||||
public:
|
||||
PluginCmdShortcut(Shortcut sc, int id, const char *moduleName, unsigned short internalID) :\
|
||||
CommandShortcut(sc, id), _id(id), _internalID(internalID) {
|
||||
|
@ -233,7 +314,7 @@ public:
|
|||
int getInternalID() const {return _internalID;};
|
||||
unsigned long getID() const {return _id;};
|
||||
|
||||
protected :
|
||||
private :
|
||||
unsigned long _id;
|
||||
char _moduleName[nameLenMax];
|
||||
int _internalID;
|
||||
|
@ -242,39 +323,31 @@ protected :
|
|||
class Accelerator { //Handles accelerator keys for Notepad++ menu, including custom commands
|
||||
friend class ShortcutMapper;
|
||||
public:
|
||||
Accelerator():_hAccelMenu(NULL), _hMenuParent(NULL), _hAccTable(NULL), _didCopy(false), _pAccelArray(NULL), _nbAccelItems(0){};
|
||||
Accelerator():_hAccelMenu(NULL), _hMenuParent(NULL), _hAccTable(NULL), _pAccelArray(NULL), _nbAccelItems(0){};
|
||||
~Accelerator(){
|
||||
if (_didCopy)
|
||||
if (_hAccTable)
|
||||
::DestroyAcceleratorTable(_hAccTable);
|
||||
if (_pAccelArray)
|
||||
delete [] _pAccelArray;
|
||||
};
|
||||
void init(HACCEL hAccel, HMENU hMenu, HWND menuParent) {
|
||||
_hAccTable = hAccel;
|
||||
void init(HMENU hMenu, HWND menuParent) {
|
||||
_hAccelMenu = hMenu;
|
||||
_hMenuParent = menuParent;
|
||||
_nbOriginalAccelItem = ::CopyAcceleratorTable(_hAccTable, NULL, 0);
|
||||
updateShortcuts();
|
||||
};
|
||||
HACCEL getAccTable() const {return _hAccTable;};
|
||||
|
||||
bool updateShortcuts(/*HWND nppHandle = NULL*/);
|
||||
//bool updateCommand(CommandShortcut & csc);
|
||||
void updateShortcuts();
|
||||
private:
|
||||
HMENU _hAccelMenu;
|
||||
HWND _hMenuParent;
|
||||
HACCEL _hAccTable;
|
||||
bool _didCopy;
|
||||
|
||||
ACCEL *_pAccelArray;
|
||||
int _nbOriginalAccelItem;
|
||||
int _nbAccelItems;
|
||||
|
||||
void reNew() {
|
||||
if (!_didCopy)
|
||||
_didCopy = true;
|
||||
else
|
||||
if(_hAccTable)
|
||||
::DestroyAcceleratorTable(_hAccTable);
|
||||
|
||||
_hAccTable = ::CreateAcceleratorTable(_pAccelArray, _nbAccelItems);
|
||||
};
|
||||
void updateFullMenu();
|
||||
|
@ -287,7 +360,6 @@ public:
|
|||
void init(vector<HWND> * vScintillas, HMENU hMenu, HWND menuParent);
|
||||
void updateKeys();
|
||||
void updateKey(ScintillaKeyMap skmOld, ScintillaKeyMap skm);
|
||||
|
||||
private:
|
||||
HMENU _hAccelMenu;
|
||||
HWND _hMenuParent;
|
||||
|
|
|
@ -48,3 +48,32 @@ BEGIN
|
|||
LTEXT "This will disable the accelerator!",IDC_WARNING_STATIC,
|
||||
6,90,170,8
|
||||
END
|
||||
|
||||
IDD_SHORTCUTSCINT_DLG DIALOGEX 0, 0, 286, 114
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_TOOLWINDOW
|
||||
CAPTION "Shortcut"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "CTRL",IDC_CTRL_CHECK,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,114,27,33,10
|
||||
CONTROL "ALT",IDC_ALT_CHECK,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,114,48,28,10
|
||||
CONTROL "SHIFT",IDC_SHIFT_CHECK,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,159,39,35,10
|
||||
COMBOBOX IDC_KEY_COMBO,212,37,64,270,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "OK",IDOK,144,78,48,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,210,78,48,14
|
||||
LTEXT "+",IDC_STATIC,147,39,8,8
|
||||
LTEXT "+",IDC_STATIC,198,39,8,8
|
||||
EDITTEXT IDC_NAME_EDIT,158,6,93,14,ES_AUTOHSCROLL | ES_READONLY
|
||||
LTEXT "Name :",IDC_NAME_STATIC,117,9,34,8,0,WS_EX_RIGHT
|
||||
LTEXT "This will remove the accelerator!",IDC_WARNING_STATIC,
|
||||
120,98,138,8
|
||||
LISTBOX IDC_LIST_KEYS,6,6,90,72,LBS_NOINTEGRALHEIGHT |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Add",IDC_BUTTON_ADD,6,84,42,14
|
||||
PUSHBUTTON "Remove",IDC_BUTTON_RMVE,56,84,40,14
|
||||
PUSHBUTTON "Apply",IDC_BUTTON_APPLY,210,60,48,14
|
||||
END
|
||||
|
|
|
@ -20,6 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|||
#ifndef IDD_SHORTCUT_DLG
|
||||
|
||||
#define IDD_SHORTCUT_DLG 5000
|
||||
#define IDD_SHORTCUTSCINT_DLG 5001
|
||||
|
||||
#define IDC_CTRL_CHECK (IDD_SHORTCUT_DLG + 1)
|
||||
#define IDC_ALT_CHECK (IDD_SHORTCUT_DLG + 2)
|
||||
|
@ -28,4 +29,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|||
#define IDC_NAME_EDIT (IDD_SHORTCUT_DLG + 5)
|
||||
#define IDC_NAME_STATIC (IDD_SHORTCUT_DLG + 6)
|
||||
#define IDC_WARNING_STATIC (IDD_SHORTCUT_DLG + 7)
|
||||
#define IDC_BUTTON_ADD (IDD_SHORTCUT_DLG + 8)
|
||||
#define IDC_BUTTON_RMVE (IDD_SHORTCUT_DLG + 9)
|
||||
#define IDC_BUTTON_APPLY (IDD_SHORTCUT_DLG + 10)
|
||||
#define IDC_LIST_KEYS (IDD_SHORTCUT_DLG + 11)
|
||||
#endif //IDD_SHORTCUT_DLG
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
<Language name="haskell" ext="hs lhs as las" commentLine="--">
|
||||
<Keywords name="instre1">as case class data default deriving do else hiding if import in infix infixl infixr instance let module newtype of proc qualified rec then type where _</Keywords>
|
||||
</Language>
|
||||
<Language name="html" ext="html htm shtml shtm" commentLine="" commentStart="<!--" commentEnd="-->">
|
||||
<Language name="html" ext="html htm shtml shtm xhtml" commentLine="" commentStart="<!--" commentEnd="-->">
|
||||
<Keywords name="instre1">!doctype a abbr accept-charset accept accesskey acronym action address align alink alt applet archive area axis b background base basefont bdo bgcolor big blockquote body border br button caption cellpadding cellspacing center char charoff charset checkbox checked cite class classid clear code codebase codetype col colgroup color cols colspan compact content coords data datafld dataformatas datapagesize datasrc datetime dd declare defer del dfn dir disabled div dl dt em enctype event face fieldset file font for form frame frameborder frameset h1 h2 h3 h4 h5 h6 head headers height hidden hr href hreflang hspace html http-equiv i id iframe image img input ins isindex ismap kbd label lang language leftmargin legend li link longdesc map marginwidth marginheight maxlength media menu meta method multiple name noframes nohref noresize noscript noshade nowrap object ol onblur onchange onclick ondblclick onfocus onkeydown onkeypress onkeyup onload onmousedown onmousemove onmouseover onmouseout onmouseup optgroup option onreset onselect onsubmit onunload p param password profile pre prompt public q radio readonly rel reset rev rows rowspan rules s samp scheme scope script select selected shape size small span src standby start strike strong style sub submit summary sup tabindex table target tbody td text textarea tfoot th thead title topmargin tr tt type u ul usemap valign value valuetype var version vlink vspace width xml xmlns</Keywords>
|
||||
</Language>
|
||||
<Language name="ini" ext="ini inf reg url" commentLine=";">
|
||||
|
@ -186,7 +186,7 @@
|
|||
<Keywords name="type3">std ieee work standard textio std_logic_1164 std_logic_arith std_logic_misc std_logic_signed std_logic_textio std_logic_unsigned numeric_bit numeric_std math_complex math_real vital_primitives vital_timing</Keywords>
|
||||
<Keywords name="type4">boolean bit character severity_level integer real time delay_length natural positive string bit_vector file_open_kind file_open_status line text side width std_ulogic std_ulogic_vector std_logic std_logic_vector X01 X01Z UX01 UX01Z unsigned signed</Keywords>
|
||||
</Language>
|
||||
<Language name="xml" ext="xml xsml xsl kml" commentLine="" commentStart="<!--" commentEnd="-->">
|
||||
<Language name="xml" ext="xml xsml xsl xsd kml wsdl" commentLine="" commentStart="<!--" commentEnd="-->">
|
||||
</Language>
|
||||
<Language name="yaml" ext="yml" commentLine="#">
|
||||
</Language>
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
#ifndef RESOURCE_H
|
||||
#define RESOURCE_H
|
||||
|
||||
#define NOTEPAD_PLUS_VERSION "Notepad++ v4.8"
|
||||
#define VERSION_VALUE "4.8\0" // should be X.Y : ie. if VERSION_DIGITALVALUE == 4, 7, 1, 0 , then X = 4, Y = 71
|
||||
#define VERSION_DIGITALVALUE 4, 8, 0, 0
|
||||
#define NOTEPAD_PLUS_VERSION "Notepad++ v4.8.1"
|
||||
#define VERSION_VALUE "4.8.1\0" // should be X.Y : ie. if VERSION_DIGITALVALUE == 4, 7, 1, 0 , then X = 4, Y = 71
|
||||
#define VERSION_DIGITALVALUE 4, 8, 1, 0
|
||||
|
||||
#ifndef IDC_STATIC
|
||||
#define IDC_STATIC -1
|
||||
|
@ -28,7 +28,6 @@
|
|||
|
||||
#define IDI_M30ICON 100
|
||||
#define IDR_MENU1 101
|
||||
#define IDR_ACCELERATOR1 102
|
||||
#define IDR_RT_MANIFEST 103
|
||||
|
||||
#define IDI_NEW_OFF_ICON 201
|
||||
|
@ -216,8 +215,6 @@
|
|||
#define IDC_ICON_INPUT_ICON 1203
|
||||
|
||||
#define IDR_M30_MENU 1500
|
||||
#define IDR_NPP_ACCELERATORS 1501
|
||||
//#define IDR_NPP_ACCELERATORS_98 1502
|
||||
|
||||
// #define IDD_FIND_REPLACE_DLG 1600
|
||||
|
||||
|
@ -318,3 +315,4 @@
|
|||
|
||||
#endif // RESOURCE_H
|
||||
|
||||
|
||||
|
|
|
@ -237,13 +237,19 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int nCmdSh
|
|||
string version = "-v";
|
||||
version += VERSION_VALUE;
|
||||
|
||||
winVer curWinVer = notepad_plus_plus.getWinVersion();
|
||||
|
||||
bool isUpExist = nppGui._doesExistUpdater = (::PathFileExists(updaterFullPath.c_str()) == TRUE);
|
||||
bool doUpdate = !nppGui._neverUpdate;
|
||||
bool winSupported = notepad_plus_plus.getWinVersion() >= WV_W2K;
|
||||
bool winSupported = (curWinVer >= WV_W2K);
|
||||
|
||||
// Vista UAC de mes couilles!!!
|
||||
bool isVista = (curWinVer == WV_VISTA);
|
||||
|
||||
if (!winSupported)
|
||||
nppGui._doesExistUpdater = false;
|
||||
|
||||
if (TheFirstOne && isUpExist && doUpdate && winSupported)
|
||||
if (TheFirstOne && isUpExist && doUpdate && winSupported && !isVista)
|
||||
{
|
||||
Process updater(updaterFullPath.c_str(), version.c_str(), updaterDir.c_str());
|
||||
updater.run();
|
||||
|
|
Loading…
Reference in New Issue