Skip to content

Commit 9657606

Browse files
committed
AcceleratorTo now remembers which plugin called it
1 parent 24d7440 commit 9657606

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

doc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,6 +1310,7 @@ class CMUSHclientDoc : public CDocument
13101310
map<long, WORD> m_AcceleratorToCommandMap; // command to send for accelerator
13111311
map<WORD, string> m_CommandToMacroMap; // what that command does
13121312
map<WORD, short> m_CommandToSendToMap; // where it goes (eg. 0 = world, 1 = command etc.)
1313+
map<WORD, string> m_CommandToPluginMap; // what plugin it belongs to
13131314
HACCEL m_accelerator;
13141315

13151316
// for mapping colours to colours

scripting/methods/methods_accelerators.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ WORD key;
133133
// and where to send it
134134
m_CommandToSendToMap [command] = SendTo;
135135

136+
// remember which plugin did it
137+
m_CommandToPluginMap [command].empty ();
138+
139+
if (m_CurrentPlugin)
140+
m_CommandToPluginMap [command] = m_CurrentPlugin->m_strID;
141+
136142
} // end of having something to do (ie. not deleting accelerator)
137143

138144
// create new handle

sendvw.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2535,6 +2535,11 @@ void CSendView::OnAcceleratorCommand (UINT nID)
25352535
CString strExtraOutput;
25362536
pDoc->m_iCurrentActionSource = eUserAccelerator;
25372537

2538+
CPlugin * pSavedPlugin = pDoc->m_CurrentPlugin;
2539+
2540+
// which plugin wanted it
2541+
pDoc->m_CurrentPlugin = pDoc->GetPlugin (pDoc->m_CommandToPluginMap [nID].c_str ());
2542+
25382543
// ok let's do it now
25392544
pDoc->SendTo (pDoc->m_CommandToSendToMap [nID],
25402545
sCommand.c_str (),
@@ -2545,6 +2550,8 @@ void CSendView::OnAcceleratorCommand (UINT nID)
25452550
strExtraOutput // if we sent to output, it goes here
25462551
);
25472552

2553+
pDoc->m_CurrentPlugin = pSavedPlugin;
2554+
25482555
// display any stuff sent to output window
25492556

25502557
if (!strExtraOutput.IsEmpty ())

0 commit comments

Comments
 (0)