Skip to content

Commit d4dc32d

Browse files
committed
1 parent a09bef7 commit d4dc32d

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

src/PluginDefinition.cpp

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ NppData nppData;
4949
wchar_t iniFilePath[MAX_PATH];
5050
bool doCloseTag = false;
5151

52-
#define DOCKABLE_DEMO_INDEX 15
52+
#define DOCKABLE_DEMO_INDEX 16
5353

5454
//
5555
// Initialize your plugin data here
@@ -137,15 +137,16 @@ void commandMenuInit()
137137
setCommand(11, L"Get File Names Demo", getFileNamesDemo, NULL, false);
138138
setCommand(12, L"Get Session File Names Demo", getSessionFileNamesDemo, NULL, false);
139139
setCommand(13, L"Save Current Session Demo", saveCurrentSessionDemo, NULL, false);
140+
setCommand(14, L"Get Command Shortcut Demo", getCommandShortcutDemo, NULL, false);
140141

141-
setCommand(14, L"---", NULL, NULL, false);
142+
setCommand(15, L"---", NULL, NULL, false);
142143

143144
setCommand(DOCKABLE_DEMO_INDEX, L"Dockable Dialog Demo", DockableDlgDemo, NULL, false);
144145

145-
setCommand(16, L"---", NULL, NULL, false);
146+
setCommand(17, L"---", NULL, NULL, false);
146147

147-
setCommand(17, L"Plugin Communication Guide", goToPluginCommunicationGuide, NULL, false);
148-
setCommand(18, L"Get Plugin Demo Source Code", goToPluginDemoRepo, NULL, false);
148+
setCommand(18, L"Plugin Communication Guide", goToPluginCommunicationGuide, NULL, false);
149+
setCommand(19, L"Get Plugin Demo Source Code", goToPluginDemoRepo, NULL, false);
149150
}
150151

151152

@@ -448,6 +449,27 @@ void saveCurrentSessionDemo()
448449
::MessageBox(nppData._nppHandle, sessionPath, L"Saved Session File :", MB_OK);
449450
}
450451

452+
void getCommandShortcutDemo()
453+
{
454+
ShortcutKey sk;
455+
456+
// Grt shortcut of current full file path shortcut
457+
::SendMessage(nppData._nppHandle, NPPM_GETSHORTCUTBYCMDID, funcItem[4]._cmdID, reinterpret_cast<LPARAM>(&sk));
458+
459+
std::string msg;
460+
msg = "KEY: ";
461+
msg += static_cast<char>(sk._key);
462+
msg += " Crtl: ";
463+
msg += sk._isCtrl ? "Yes" : "No";
464+
msg += " Alt: ";
465+
msg += sk._isAlt ? "Yes" : "No";
466+
msg += " Shift: ";
467+
msg += sk._isShift ? "Yes" : "No";
468+
469+
470+
::MessageBoxA(nppData._nppHandle, msg.c_str(), "Shorcut", MB_OK);
471+
}
472+
451473
// Dockable Dialog Demo
452474
//
453475
// This demonstration shows you how to do a dockable dialog.

src/PluginDefinition.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ void insertHtmlCloseTag();
8484
void getFileNamesDemo();
8585
void getSessionFileNamesDemo();
8686
void saveCurrentSessionDemo();
87+
void getCommandShortcutDemo();
8788
void DockableDlgDemo();
8889
void goToPluginCommunicationGuide();
8990
void goToPluginDemoRepo();

0 commit comments

Comments
 (0)