Enhance Shortcut Mapper and make it translatable
This commit is contained in:
parent
70f7287e58
commit
fb17638de7
@ -447,6 +447,31 @@
|
|||||||
<Item id="2232" name="啟用共用底線字"/>
|
<Item id="2232" name="啟用共用底線字"/>
|
||||||
</SubDialog>
|
</SubDialog>
|
||||||
</StyleConfig>
|
</StyleConfig>
|
||||||
|
<ShortcutMapper title="快速鍵管理">
|
||||||
|
<Item id="2602" name="修改"/>
|
||||||
|
<Item id="2603" name="刪除"/>
|
||||||
|
<Item id="2606" name="清除"/>
|
||||||
|
<Item id="1" name="關閉"/>
|
||||||
|
<ColumnName name="名稱"/>
|
||||||
|
<ColumnShortcut name="快速鍵"/>
|
||||||
|
<ColumnCategory name="類別"/>
|
||||||
|
<ColumnPlugin name="外掛"/>
|
||||||
|
<MainMenuTab name="主選單"/>
|
||||||
|
<MacrosTab name="巨集"/>
|
||||||
|
<RunCommandsTab name="自訂指令"/>
|
||||||
|
<PluginCommandsTab name="外掛指令"/>
|
||||||
|
<ScintillaCommandsTab name="Scintilla 指令"/>
|
||||||
|
</ShortcutMapper>
|
||||||
|
<ShortcutMapperSubDialg title="快速鍵設定">
|
||||||
|
<Item id="1" name="確認"/>
|
||||||
|
<Item id="2" name="取消"/>
|
||||||
|
<Item id="5006" name="名稱"/>
|
||||||
|
<Item id="5008" name="增加"/>
|
||||||
|
<Item id="5009" name="移除"/>
|
||||||
|
<Item id="5010" name="套用"/>
|
||||||
|
<Item id="5007" name="這將會移除快速鍵"/>
|
||||||
|
<Item id="5012" name="快速鍵重複定義"/>
|
||||||
|
</ShortcutMapperSubDialg>
|
||||||
<UserDefine title="自訂程式語言">
|
<UserDefine title="自訂程式語言">
|
||||||
<Item id="20001" name="停靠面板"/>
|
<Item id="20001" name="停靠面板"/>
|
||||||
<Item id="20002" name="重新命名"/>
|
<Item id="20002" name="重新命名"/>
|
||||||
|
@ -446,9 +446,33 @@
|
|||||||
<Item id="2231" name="Enable global italic font style"/>
|
<Item id="2231" name="Enable global italic font style"/>
|
||||||
<Item id="2232" name="Enable global underline font style"/>
|
<Item id="2232" name="Enable global underline font style"/>
|
||||||
</SubDialog>
|
</SubDialog>
|
||||||
|
|
||||||
</StyleConfig>
|
</StyleConfig>
|
||||||
|
|
||||||
|
<ShortcutMapper title="Shortcut Mapper">
|
||||||
|
<Item id="2602" name="Modify"/>
|
||||||
|
<Item id="2603" name="Delete"/>
|
||||||
|
<Item id="2606" name="Clear"/>
|
||||||
|
<Item id="1" name="Close"/>
|
||||||
|
<ColumnName name="Name"/>
|
||||||
|
<ColumnShortcut name="Shortcut"/>
|
||||||
|
<ColumnCategory name="Category"/>
|
||||||
|
<ColumnPlugin name="Plugin"/>
|
||||||
|
<MainMenuTab name="Main menu"/>
|
||||||
|
<MacrosTab name="Macros"/>
|
||||||
|
<RunCommandsTab name="Run commands"/>
|
||||||
|
<PluginCommandsTab name="Plugin commands"/>
|
||||||
|
<ScintillaCommandsTab name="Scintilla commands"/>
|
||||||
|
</ShortcutMapper>
|
||||||
|
<ShortcutMapperSubDialg title="Shortcut">
|
||||||
|
<Item id="1" name="OK"/>
|
||||||
|
<Item id="2" name="Cancel"/>
|
||||||
|
<Item id="5006" name="Name"/>
|
||||||
|
<Item id="5008" name="Add"/>
|
||||||
|
<Item id="5009" name="Remove"/>
|
||||||
|
<Item id="5010" name="Apply"/>
|
||||||
|
<Item id="5007" name="This will remove the accelerator"/>
|
||||||
|
<Item id="5012" name="CONFLICT FOUND!"/>
|
||||||
|
</ShortcutMapperSubDialg>
|
||||||
<UserDefine title="User-Defined">
|
<UserDefine title="User-Defined">
|
||||||
<Item id="20001" name="Dock"/>
|
<Item id="20001" name="Dock"/>
|
||||||
<Item id="20002" name="Rename"/>
|
<Item id="20002" name="Rename"/>
|
||||||
@ -987,6 +1011,7 @@ Do you want to continue?"/>
|
|||||||
<UDLNewNameError title="UDL Error" message="This name is used by another language,
|
<UDLNewNameError title="UDL Error" message="This name is used by another language,
|
||||||
please give another one."/>
|
please give another one."/>
|
||||||
<UDLRemoveCurrentLang title="Remove the current language" message="Are you sure?"/>
|
<UDLRemoveCurrentLang title="Remove the current language" message="Are you sure?"/>
|
||||||
|
<SCMapperDoDeleteOrNot title="Are you sure?" message="Are you sure you want to delete this shortcut?"/>
|
||||||
<FindCharRangeValueError title="Range Value problem" message="You should type between from 0 to 255."/>
|
<FindCharRangeValueError title="Range Value problem" message="You should type between from 0 to 255."/>
|
||||||
</MessageBox>
|
</MessageBox>
|
||||||
<ClipboardHistory>
|
<ClipboardHistory>
|
||||||
|
@ -2458,7 +2458,6 @@ void Notepad_plus::command(int id)
|
|||||||
GridState st = id==IDM_SETTING_SHORTCUT_MAPPER_MACRO?STATE_MACRO:id==IDM_SETTING_SHORTCUT_MAPPER_RUN?STATE_USER:STATE_MENU;
|
GridState st = id==IDM_SETTING_SHORTCUT_MAPPER_MACRO?STATE_MACRO:id==IDM_SETTING_SHORTCUT_MAPPER_RUN?STATE_USER:STATE_MENU;
|
||||||
ShortcutMapper shortcutMapper;
|
ShortcutMapper shortcutMapper;
|
||||||
shortcutMapper.init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), st);
|
shortcutMapper.init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), st);
|
||||||
_nativeLangSpeaker.changeShortcutmapperLang(&shortcutMapper);
|
|
||||||
shortcutMapper.doDialog(_nativeLangSpeaker.isRTL());
|
shortcutMapper.doDialog(_nativeLangSpeaker.isRTL());
|
||||||
shortcutMapper.destroy();
|
shortcutMapper.destroy();
|
||||||
break;
|
break;
|
||||||
|
@ -29,28 +29,22 @@
|
|||||||
#include "ShortcutMapper.h"
|
#include "ShortcutMapper.h"
|
||||||
#include "Notepad_plus.h"
|
#include "Notepad_plus.h"
|
||||||
|
|
||||||
#ifdef UNICODE
|
|
||||||
#define numToStr std::to_wstring
|
|
||||||
#else
|
|
||||||
#define numToStr std::to_string
|
|
||||||
#endif //UNICODE
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
void ShortcutMapper::initTabs() {
|
void ShortcutMapper::initTabs()
|
||||||
|
{
|
||||||
HWND hTab = _hTabCtrl = ::GetDlgItem(_hSelf, IDC_BABYGRID_TABBAR);
|
HWND hTab = _hTabCtrl = ::GetDlgItem(_hSelf, IDC_BABYGRID_TABBAR);
|
||||||
TCITEM tie;
|
TCITEM tie;
|
||||||
tie.mask = TCIF_TEXT;
|
tie.mask = TCIF_TEXT;
|
||||||
tie.pszText = tabNames[0];
|
|
||||||
::SendMessage(hTab, TCM_INSERTITEM, 0, reinterpret_cast<LPARAM>(&tie));
|
for (size_t i = 0; i < _nbTab; ++i)
|
||||||
tie.pszText = tabNames[1];
|
{
|
||||||
::SendMessage(hTab, TCM_INSERTITEM, 1, reinterpret_cast<LPARAM>(&tie));
|
_tabNames[i] = getTabString(i);
|
||||||
tie.pszText = tabNames[2];
|
|
||||||
::SendMessage(hTab, TCM_INSERTITEM, 2, reinterpret_cast<LPARAM>(&tie));
|
tie.pszText = const_cast<LPWSTR>(_tabNames[i].c_str());
|
||||||
tie.pszText = tabNames[3];
|
::SendMessage(hTab, TCM_INSERTITEM, i, reinterpret_cast<LPARAM>(&tie));
|
||||||
::SendMessage(hTab, TCM_INSERTITEM, 3, reinterpret_cast<LPARAM>(&tie));
|
}
|
||||||
tie.pszText = tabNames[4];
|
|
||||||
::SendMessage(hTab, TCM_INSERTITEM, 4, reinterpret_cast<LPARAM>(&tie));
|
|
||||||
|
|
||||||
TabCtrl_SetCurSel(_hTabCtrl, int(_currentState));
|
TabCtrl_SetCurSel(_hTabCtrl, int(_currentState));
|
||||||
|
|
||||||
@ -78,10 +72,29 @@ void ShortcutMapper::getClientRect(RECT & rc) const
|
|||||||
rc.right -= NppParameters::getInstance()->_dpiManager.scaleX(5);
|
rc.right -= NppParameters::getInstance()->_dpiManager.scaleX(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutMapper::translateTab(int index, const TCHAR * newname) {
|
generic_string ShortcutMapper::getTabString(size_t i) const
|
||||||
if (index < 0 || index > 4)
|
{
|
||||||
return;
|
if (i >= _nbTab)
|
||||||
generic_strncpy(tabNames[index], newname, maxTabName);
|
return TEXT("");
|
||||||
|
|
||||||
|
NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance()->getNativeLangSpeaker();
|
||||||
|
switch (i)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
return nativeLangSpeaker->getShortcutMapperLangStr("MacrosTab", TEXT("Macros"));
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
return nativeLangSpeaker->getShortcutMapperLangStr("RunCommandsTab", TEXT("Run commands"));
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
return nativeLangSpeaker->getShortcutMapperLangStr("PluginCommandsTab", TEXT("Plugin commands"));
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
return nativeLangSpeaker->getShortcutMapperLangStr("ScintillaCommandsTab", TEXT("Scintilla commands"));
|
||||||
|
|
||||||
|
default: //0
|
||||||
|
return nativeLangSpeaker->getShortcutMapperLangStr("MainMenuTab", TEXT("Main menu"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutMapper::initBabyGrid() {
|
void ShortcutMapper::initBabyGrid() {
|
||||||
@ -122,6 +135,8 @@ void ShortcutMapper::initBabyGrid() {
|
|||||||
_babygrid.setProtectColor(RGB(255,130,120));
|
_babygrid.setProtectColor(RGB(255,130,120));
|
||||||
_babygrid.setHighlightColorProtect(RGB(244,10,20));
|
_babygrid.setHighlightColorProtect(RGB(244,10,20));
|
||||||
_babygrid.setHighlightColorProtectNoFocus(RGB(230,194,190));
|
_babygrid.setHighlightColorProtectNoFocus(RGB(230,194,190));
|
||||||
|
|
||||||
|
NppParameters::getInstance()->getNativeLangSpeaker()->changeDlgLang(_hSelf, "ShortcutMapper");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutMapper::fillOutBabyGrid()
|
void ShortcutMapper::fillOutBabyGrid()
|
||||||
@ -131,57 +146,82 @@ void ShortcutMapper::fillOutBabyGrid()
|
|||||||
_babygrid.setInitialContent(true);
|
_babygrid.setInitialContent(true);
|
||||||
|
|
||||||
size_t nbItems = 0;
|
size_t nbItems = 0;
|
||||||
|
NativeLangSpeaker* nativeLangSpeaker = nppParam->getNativeLangSpeaker();
|
||||||
|
generic_string nameStr = nativeLangSpeaker->getShortcutMapperLangStr("ColumnName", TEXT("Name"));
|
||||||
|
generic_string shortcutStr = nativeLangSpeaker->getShortcutMapperLangStr("ColumnShortcut", TEXT("Shortcut"));
|
||||||
|
|
||||||
_babygrid.setText(0, 1, TEXT("Name"));
|
_babygrid.setText(0, 1, nameStr.c_str());
|
||||||
_babygrid.setText(0, 2, TEXT("Shortcut"));
|
_babygrid.setText(0, 2, shortcutStr.c_str());
|
||||||
|
|
||||||
switch(_currentState) {
|
switch(_currentState)
|
||||||
case STATE_MENU: {
|
{
|
||||||
|
case STATE_MENU:
|
||||||
|
{
|
||||||
nbItems = nppParam->getUserShortcuts().size();
|
nbItems = nppParam->getUserShortcuts().size();
|
||||||
_babygrid.setLineColNumber(nbItems, 3);
|
_babygrid.setLineColNumber(nbItems, 3);
|
||||||
_babygrid.setText(0, 3, TEXT("Category"));
|
generic_string categoryStr = nativeLangSpeaker->getShortcutMapperLangStr("ColumnCategory", TEXT("Category"));
|
||||||
break; }
|
_babygrid.setText(0, 3, categoryStr.c_str());
|
||||||
case STATE_MACRO: {
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case STATE_MACRO:
|
||||||
|
{
|
||||||
nbItems = nppParam->getMacroList().size();
|
nbItems = nppParam->getMacroList().size();
|
||||||
_babygrid.setLineColNumber(nbItems, 2);
|
_babygrid.setLineColNumber(nbItems, 2);
|
||||||
break; }
|
}
|
||||||
case STATE_USER: {
|
break;
|
||||||
|
|
||||||
|
case STATE_USER:
|
||||||
|
{
|
||||||
nbItems = nppParam->getUserCommandList().size();
|
nbItems = nppParam->getUserCommandList().size();
|
||||||
_babygrid.setLineColNumber(nbItems, 2);
|
_babygrid.setLineColNumber(nbItems, 2);
|
||||||
break; }
|
}
|
||||||
case STATE_PLUGIN: {
|
break;
|
||||||
|
|
||||||
|
case STATE_PLUGIN:
|
||||||
|
{
|
||||||
nbItems = nppParam->getPluginCommandList().size();
|
nbItems = nppParam->getPluginCommandList().size();
|
||||||
_babygrid.setLineColNumber(nbItems, 3);
|
_babygrid.setLineColNumber(nbItems, 3);
|
||||||
_babygrid.setText(0, 3, TEXT("Plugin"));
|
generic_string pluginStr = nativeLangSpeaker->getShortcutMapperLangStr("ColumnPlugin", TEXT("Plugin"));
|
||||||
break; }
|
_babygrid.setText(0, 3, pluginStr.c_str());
|
||||||
case STATE_SCINTILLA: {
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case STATE_SCINTILLA:
|
||||||
|
{
|
||||||
nbItems = nppParam->getScintillaKeyList().size();
|
nbItems = nppParam->getScintillaKeyList().size();
|
||||||
_babygrid.setLineColNumber(nbItems, 2);
|
_babygrid.setLineColNumber(nbItems, 2);
|
||||||
break; }
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isMarker = false;
|
bool isMarker = false;
|
||||||
|
|
||||||
switch(_currentState) {
|
switch(_currentState)
|
||||||
case STATE_MENU: {
|
{
|
||||||
|
case STATE_MENU:
|
||||||
|
{
|
||||||
vector<CommandShortcut> & cshortcuts = nppParam->getUserShortcuts();
|
vector<CommandShortcut> & cshortcuts = nppParam->getUserShortcuts();
|
||||||
for(size_t i = 0; i < nbItems; ++i)
|
for (size_t i = 0; i < nbItems; ++i)
|
||||||
{
|
{
|
||||||
if (findKeyConflicts(nullptr, cshortcuts[i].getKeyCombo(), i))
|
if (findKeyConflicts(nullptr, cshortcuts[i].getKeyCombo(), i))
|
||||||
isMarker = _babygrid.setMarker(true);
|
isMarker = _babygrid.setMarker(true);
|
||||||
|
|
||||||
_babygrid.setText(i+1, 1, cshortcuts[i].getName());
|
_babygrid.setText(i + 1, 1, cshortcuts[i].getName());
|
||||||
if (cshortcuts[i].isEnabled()) //avoid empty strings for better performance
|
if (cshortcuts[i].isEnabled()) //avoid empty strings for better performance
|
||||||
_babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str());
|
_babygrid.setText(i + 1, 2, cshortcuts[i].toString().c_str());
|
||||||
_babygrid.setText(i+1, 3, cshortcuts[i].getCategory());
|
_babygrid.setText(i + 1, 3, cshortcuts[i].getCategory());
|
||||||
if (isMarker)
|
if (isMarker)
|
||||||
isMarker = _babygrid.setMarker(false);
|
isMarker = _babygrid.setMarker(false);
|
||||||
}
|
}
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), true);
|
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), true);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_CLEAR), true);
|
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_CLEAR), true);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_DELETE), false);
|
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_DELETE), false);
|
||||||
break; }
|
}
|
||||||
case STATE_MACRO: {
|
break;
|
||||||
|
|
||||||
|
case STATE_MACRO:
|
||||||
|
{
|
||||||
vector<MacroShortcut> & cshortcuts = nppParam->getMacroList();
|
vector<MacroShortcut> & cshortcuts = nppParam->getMacroList();
|
||||||
for(size_t i = 0; i < nbItems; ++i)
|
for(size_t i = 0; i < nbItems; ++i)
|
||||||
{
|
{
|
||||||
@ -199,8 +239,11 @@ void ShortcutMapper::fillOutBabyGrid()
|
|||||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), shouldBeEnabled);
|
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), shouldBeEnabled);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_CLEAR), shouldBeEnabled);
|
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_CLEAR), shouldBeEnabled);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_DELETE), shouldBeEnabled);
|
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_DELETE), shouldBeEnabled);
|
||||||
break; }
|
}
|
||||||
case STATE_USER: {
|
break;
|
||||||
|
|
||||||
|
case STATE_USER:
|
||||||
|
{
|
||||||
vector<UserCommand> & cshortcuts = nppParam->getUserCommandList();
|
vector<UserCommand> & cshortcuts = nppParam->getUserCommandList();
|
||||||
for(size_t i = 0; i < nbItems; ++i)
|
for(size_t i = 0; i < nbItems; ++i)
|
||||||
{
|
{
|
||||||
@ -218,8 +261,11 @@ void ShortcutMapper::fillOutBabyGrid()
|
|||||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), shouldBeEnabled);
|
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), shouldBeEnabled);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_CLEAR), shouldBeEnabled);
|
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_CLEAR), shouldBeEnabled);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_DELETE), shouldBeEnabled);
|
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_DELETE), shouldBeEnabled);
|
||||||
break; }
|
}
|
||||||
case STATE_PLUGIN: {
|
break;
|
||||||
|
|
||||||
|
case STATE_PLUGIN:
|
||||||
|
{
|
||||||
vector<PluginCmdShortcut> & cshortcuts = nppParam->getPluginCommandList();
|
vector<PluginCmdShortcut> & cshortcuts = nppParam->getPluginCommandList();
|
||||||
for(size_t i = 0; i < nbItems; ++i)
|
for(size_t i = 0; i < nbItems; ++i)
|
||||||
{
|
{
|
||||||
@ -238,8 +284,11 @@ void ShortcutMapper::fillOutBabyGrid()
|
|||||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), shouldBeEnabled);
|
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), shouldBeEnabled);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_CLEAR), shouldBeEnabled);
|
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_CLEAR), shouldBeEnabled);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_DELETE), false);
|
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_DELETE), false);
|
||||||
break; }
|
}
|
||||||
case STATE_SCINTILLA: {
|
break;
|
||||||
|
|
||||||
|
case STATE_SCINTILLA:
|
||||||
|
{
|
||||||
vector<ScintillaKeyMap> & cshortcuts = nppParam->getScintillaKeyList();
|
vector<ScintillaKeyMap> & cshortcuts = nppParam->getScintillaKeyList();
|
||||||
for(size_t i = 0; i < nbItems; ++i)
|
for(size_t i = 0; i < nbItems; ++i)
|
||||||
{
|
{
|
||||||
@ -266,14 +315,15 @@ void ShortcutMapper::fillOutBabyGrid()
|
|||||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), true);
|
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), true);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_CLEAR), false);
|
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_CLEAR), false);
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_DELETE), false);
|
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_DELETE), false);
|
||||||
break; }
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (nbItems > 0)
|
|
||||||
//restore the last view
|
if (nbItems > 0) //restore the last view
|
||||||
_babygrid.setLastView(_lastHomeRow[_currentState], _lastCursorRow[_currentState]);
|
_babygrid.setLastView(_lastHomeRow[_currentState], _lastCursorRow[_currentState]);
|
||||||
else
|
else //clear the info area
|
||||||
//clear the info area
|
|
||||||
::SendDlgItemMessage(_hSelf, IDC_BABYGRID_INFO, WM_SETTEXT, 0, 0);
|
::SendDlgItemMessage(_hSelf, IDC_BABYGRID_INFO, WM_SETTEXT, 0, 0);
|
||||||
|
|
||||||
_babygrid.setInitialContent(false);
|
_babygrid.setInitialContent(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,32 +345,42 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
{
|
{
|
||||||
for (const HFONT & hFont : _hGridFonts)
|
for (const HFONT & hFont : _hGridFonts)
|
||||||
::DeleteObject(hFont);
|
::DeleteObject(hFont);
|
||||||
|
|
||||||
_hGridFonts.clear();
|
_hGridFonts.clear();
|
||||||
_hGridFonts.shrink_to_fit();
|
_hGridFonts.shrink_to_fit();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case WM_NOTIFY: {
|
case WM_NOTIFY:
|
||||||
|
{
|
||||||
NMHDR nmh = *((NMHDR*)lParam);
|
NMHDR nmh = *((NMHDR*)lParam);
|
||||||
if (nmh.hwndFrom == _hTabCtrl) {
|
if (nmh.hwndFrom == _hTabCtrl)
|
||||||
if (nmh.code == TCN_SELCHANGE) {
|
{
|
||||||
|
if (nmh.code == TCN_SELCHANGE)
|
||||||
|
{
|
||||||
//save the current view
|
//save the current view
|
||||||
_lastHomeRow[_currentState] = _babygrid.getHomeRow();
|
_lastHomeRow[_currentState] = _babygrid.getHomeRow();
|
||||||
_lastCursorRow[_currentState] = _babygrid.getSelectedRow();
|
_lastCursorRow[_currentState] = _babygrid.getSelectedRow();
|
||||||
int index = TabCtrl_GetCurSel(_hTabCtrl);
|
int index = TabCtrl_GetCurSel(_hTabCtrl);
|
||||||
switch (index) {
|
|
||||||
|
switch (index)
|
||||||
|
{
|
||||||
case 0:
|
case 0:
|
||||||
_currentState = STATE_MENU;
|
_currentState = STATE_MENU;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
_currentState = STATE_MACRO;
|
_currentState = STATE_MACRO;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
_currentState = STATE_USER;
|
_currentState = STATE_USER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
_currentState = STATE_PLUGIN;
|
_currentState = STATE_PLUGIN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
_currentState = STATE_SCINTILLA;
|
_currentState = STATE_SCINTILLA;
|
||||||
break;
|
break;
|
||||||
@ -328,7 +388,8 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
fillOutBabyGrid();
|
fillOutBabyGrid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break; }
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case NPPM_INTERNAL_FINDKEYCONFLICTS:
|
case NPPM_INTERNAL_FINDKEYCONFLICTS:
|
||||||
{
|
{
|
||||||
@ -339,6 +400,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
|
|
||||||
const bool isConflict = findKeyConflicts(&conflictInfo, *reinterpret_cast<KeyCombo*>(wParam), _babygrid.getSelectedRow() - 1);
|
const bool isConflict = findKeyConflicts(&conflictInfo, *reinterpret_cast<KeyCombo*>(wParam), _babygrid.getSelectedRow() - 1);
|
||||||
*reinterpret_cast<bool*>(lParam) = isConflict;
|
*reinterpret_cast<bool*>(lParam) = isConflict;
|
||||||
|
|
||||||
if (isConflict)
|
if (isConflict)
|
||||||
::SendDlgItemMessage(_hSelf, IDC_BABYGRID_INFO, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(conflictInfo.c_str()));
|
::SendDlgItemMessage(_hSelf, IDC_BABYGRID_INFO, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(conflictInfo.c_str()));
|
||||||
else
|
else
|
||||||
@ -381,7 +443,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
csc.clear();
|
csc.clear();
|
||||||
shortcuts[row - 1] = csc;
|
shortcuts[row - 1] = csc;
|
||||||
//shortcut was altered
|
//shortcut was altered
|
||||||
nppParam->addUserModifiedIndex(row-1);
|
nppParam->addUserModifiedIndex(row - 1);
|
||||||
|
|
||||||
//save the current view
|
//save the current view
|
||||||
_lastHomeRow[_currentState] = _babygrid.getHomeRow();
|
_lastHomeRow[_currentState] = _babygrid.getHomeRow();
|
||||||
@ -393,8 +455,9 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
//Notify current Accelerator class to update everything
|
//Notify current Accelerator class to update everything
|
||||||
nppParam->getAccelerator()->updateShortcuts();
|
nppParam->getAccelerator()->updateShortcuts();
|
||||||
nppParam->setShortcutDirty();
|
nppParam->setShortcutDirty();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case STATE_MACRO:
|
case STATE_MACRO:
|
||||||
{
|
{
|
||||||
//Get MacroShortcut corresponding to row
|
//Get MacroShortcut corresponding to row
|
||||||
@ -412,8 +475,9 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
//Notify current Accelerator class to update everything
|
//Notify current Accelerator class to update everything
|
||||||
nppParam->getAccelerator()->updateShortcuts();
|
nppParam->getAccelerator()->updateShortcuts();
|
||||||
nppParam->setShortcutDirty();
|
nppParam->setShortcutDirty();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case STATE_USER:
|
case STATE_USER:
|
||||||
{
|
{
|
||||||
//Get UserCommand corresponding to row
|
//Get UserCommand corresponding to row
|
||||||
@ -434,8 +498,9 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
//Notify current Accelerator class to update everything
|
//Notify current Accelerator class to update everything
|
||||||
nppParam->getAccelerator()->updateShortcuts();
|
nppParam->getAccelerator()->updateShortcuts();
|
||||||
nppParam->setShortcutDirty();
|
nppParam->setShortcutDirty();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case STATE_PLUGIN:
|
case STATE_PLUGIN:
|
||||||
{
|
{
|
||||||
//Get PluginCmdShortcut corresponding to row
|
//Get PluginCmdShortcut corresponding to row
|
||||||
@ -443,7 +508,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
PluginCmdShortcut pcsc = shortcuts[row - 1];
|
PluginCmdShortcut pcsc = shortcuts[row - 1];
|
||||||
pcsc.clear();
|
pcsc.clear();
|
||||||
//shortcut was altered
|
//shortcut was altered
|
||||||
nppParam->addPluginModifiedIndex(row-1);
|
nppParam->addPluginModifiedIndex(row - 1);
|
||||||
shortcuts[row - 1] = pcsc;
|
shortcuts[row - 1] = pcsc;
|
||||||
|
|
||||||
//save the current view
|
//save the current view
|
||||||
@ -464,18 +529,23 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
|
|
||||||
::SendMessage(_hParent, NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED, cmdID, reinterpret_cast<LPARAM>(&shortcut));
|
::SendMessage(_hParent, NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED, cmdID, reinterpret_cast<LPARAM>(&shortcut));
|
||||||
nppParam->setShortcutDirty();
|
nppParam->setShortcutDirty();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case STATE_SCINTILLA:
|
case STATE_SCINTILLA:
|
||||||
{
|
{
|
||||||
// Do nothing
|
// Do nothing
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not isModified)
|
if (not isModified)
|
||||||
::SendMessage(_hSelf, WM_COMMAND, MAKEWPARAM(IDD_BABYGRID_ID1, BGN_ROWCHANGED), row);
|
::SendMessage(_hSelf, WM_COMMAND, MAKEWPARAM(IDD_BABYGRID_ID1, BGN_ROWCHANGED), row);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IDM_BABYGRID_MODIFY :
|
case IDM_BABYGRID_MODIFY :
|
||||||
{
|
{
|
||||||
if (_babygrid.getNumberRows() < 1)
|
if (_babygrid.getNumberRows() < 1)
|
||||||
@ -496,7 +566,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
if (csc.doDialog() != -1 && prevcsc != csc)
|
if (csc.doDialog() != -1 && prevcsc != csc)
|
||||||
{
|
{
|
||||||
//shortcut was altered
|
//shortcut was altered
|
||||||
nppParam->addUserModifiedIndex(row-1);
|
nppParam->addUserModifiedIndex(row - 1);
|
||||||
shortcuts[row - 1] = csc;
|
shortcuts[row - 1] = csc;
|
||||||
|
|
||||||
//save the current view
|
//save the current view
|
||||||
@ -510,8 +580,8 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
nppParam->getAccelerator()->updateShortcuts();
|
nppParam->getAccelerator()->updateShortcuts();
|
||||||
nppParam->setShortcutDirty();
|
nppParam->setShortcutDirty();
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case STATE_MACRO:
|
case STATE_MACRO:
|
||||||
{
|
{
|
||||||
@ -535,8 +605,8 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
nppParam->getAccelerator()->updateShortcuts();
|
nppParam->getAccelerator()->updateShortcuts();
|
||||||
nppParam->setShortcutDirty();
|
nppParam->setShortcutDirty();
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case STATE_USER:
|
case STATE_USER:
|
||||||
{
|
{
|
||||||
@ -561,8 +631,8 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
nppParam->getAccelerator()->updateShortcuts();
|
nppParam->getAccelerator()->updateShortcuts();
|
||||||
nppParam->setShortcutDirty();
|
nppParam->setShortcutDirty();
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case STATE_PLUGIN:
|
case STATE_PLUGIN:
|
||||||
{
|
{
|
||||||
@ -574,7 +644,7 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
if (pcsc.doDialog() != -1 && prevpcsc != pcsc)
|
if (pcsc.doDialog() != -1 && prevpcsc != pcsc)
|
||||||
{
|
{
|
||||||
//shortcut was altered
|
//shortcut was altered
|
||||||
nppParam->addPluginModifiedIndex(row-1);
|
nppParam->addPluginModifiedIndex(row - 1);
|
||||||
shortcuts[row - 1] = pcsc;
|
shortcuts[row - 1] = pcsc;
|
||||||
|
|
||||||
//save the current view
|
//save the current view
|
||||||
@ -596,20 +666,20 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
::SendMessage(_hParent, NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED, cmdID, reinterpret_cast<LPARAM>(&shortcut));
|
::SendMessage(_hParent, NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED, cmdID, reinterpret_cast<LPARAM>(&shortcut));
|
||||||
nppParam->setShortcutDirty();
|
nppParam->setShortcutDirty();
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case STATE_SCINTILLA:
|
case STATE_SCINTILLA:
|
||||||
{
|
{
|
||||||
//Get ScintillaKeyMap corresponding to row
|
//Get ScintillaKeyMap corresponding to row
|
||||||
vector<ScintillaKeyMap> & shortcuts = nppParam->getScintillaKeyList();
|
vector<ScintillaKeyMap> & shortcuts = nppParam->getScintillaKeyList();
|
||||||
ScintillaKeyMap skm = shortcuts[row - 1], prevskm = shortcuts[row-1];
|
ScintillaKeyMap skm = shortcuts[row - 1], prevskm = shortcuts[row - 1];
|
||||||
skm.init(_hInst, _hSelf);
|
skm.init(_hInst, _hSelf);
|
||||||
if (skm.doDialog() != -1 && prevskm != skm)
|
if (skm.doDialog() != -1 && prevskm != skm)
|
||||||
{
|
{
|
||||||
//shortcut was altered
|
//shortcut was altered
|
||||||
nppParam->addScintillaModifiedIndex(row-1);
|
nppParam->addScintillaModifiedIndex(row - 1);
|
||||||
shortcuts[row-1] = skm;
|
shortcuts[row - 1] = skm;
|
||||||
|
|
||||||
//save the current view
|
//save the current view
|
||||||
_lastHomeRow[_currentState] = _babygrid.getHomeRow();
|
_lastHomeRow[_currentState] = _babygrid.getHomeRow();
|
||||||
@ -623,11 +693,13 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
nppParam->getScintillaAccelerator()->updateKeys();
|
nppParam->getScintillaAccelerator()->updateKeys();
|
||||||
nppParam->setShortcutDirty();
|
nppParam->setShortcutDirty();
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not isModified)
|
if (not isModified)
|
||||||
::SendMessage(_hSelf, WM_COMMAND, MAKEWPARAM(IDD_BABYGRID_ID1, BGN_ROWCHANGED), row);
|
::SendMessage(_hSelf, WM_COMMAND, MAKEWPARAM(IDD_BABYGRID_ID1, BGN_ROWCHANGED), row);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -636,9 +708,15 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
if (_babygrid.getNumberRows() < 1)
|
if (_babygrid.getNumberRows() < 1)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (::MessageBox(_hSelf, TEXT("Are you sure you want to delete this shortcut?"), TEXT("Are you sure?"), MB_OKCANCEL) == IDOK)
|
NppParameters *nppParam = NppParameters::getInstance();
|
||||||
|
int res = nppParam->getNativeLangSpeaker()->messageBox("SCMapperDoDeleteOrNot",
|
||||||
|
_hSelf,
|
||||||
|
TEXT("Are you sure you want to delete this shortcut?"),
|
||||||
|
TEXT("Are you sure?"),
|
||||||
|
MB_OKCANCEL);
|
||||||
|
|
||||||
|
if (res == IDOK)
|
||||||
{
|
{
|
||||||
NppParameters *nppParam = NppParameters::getInstance();
|
|
||||||
const int row = _babygrid.getSelectedRow();
|
const int row = _babygrid.getSelectedRow();
|
||||||
int shortcutIndex = row-1;
|
int shortcutIndex = row-1;
|
||||||
DWORD cmdID = 0;
|
DWORD cmdID = 0;
|
||||||
@ -681,15 +759,15 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
nbElem = theMacros.size();
|
nbElem = theMacros.size();
|
||||||
HMENU m = reinterpret_cast<HMENU>(::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0));
|
HMENU m = reinterpret_cast<HMENU>(::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0));
|
||||||
hMenu = ::GetSubMenu(m, MENUINDEX_MACRO);
|
hMenu = ::GetSubMenu(m, MENUINDEX_MACRO);
|
||||||
modifCmd = IDM_SETTING_SHORTCUT_MAPPER_MACRO;
|
modifCmd = IDM_SETTING_SHORTCUT_MAPPER_MACRO;
|
||||||
for (size_t i = shortcutIndex ; i < nbElem ; ++i) //lower the IDs of the remaining items so there are no gaps
|
for (size_t i = shortcutIndex; i < nbElem; ++i) //lower the IDs of the remaining items so there are no gaps
|
||||||
{
|
{
|
||||||
MacroShortcut ms = theMacros[i];
|
MacroShortcut ms = theMacros[i];
|
||||||
ms.setID(ms.getID() - 1); //shift all IDs
|
ms.setID(ms.getID() - 1); //shift all IDs
|
||||||
theMacros[i] = ms;
|
theMacros[i] = ms;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case STATE_USER:
|
case STATE_USER:
|
||||||
{
|
{
|
||||||
@ -715,15 +793,15 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
nbElem = theUserCmds.size();
|
nbElem = theUserCmds.size();
|
||||||
HMENU m = reinterpret_cast<HMENU>(::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0));
|
HMENU m = reinterpret_cast<HMENU>(::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0));
|
||||||
hMenu = ::GetSubMenu(m, MENUINDEX_RUN);
|
hMenu = ::GetSubMenu(m, MENUINDEX_RUN);
|
||||||
modifCmd = IDM_SETTING_SHORTCUT_MAPPER_RUN;
|
modifCmd = IDM_SETTING_SHORTCUT_MAPPER_RUN;
|
||||||
for (size_t i = shortcutIndex ; i < nbElem ; ++i) //lower the IDs of the remaining items so there are no gaps
|
for (size_t i = shortcutIndex; i < nbElem; ++i) //lower the IDs of the remaining items so there are no gaps
|
||||||
{
|
{
|
||||||
UserCommand uc = theUserCmds[i];
|
UserCommand uc = theUserCmds[i];
|
||||||
uc.setID(uc.getID() - 1); //shift all IDs
|
uc.setID(uc.getID() - 1); //shift all IDs
|
||||||
theUserCmds[i] = uc;
|
theUserCmds[i] = uc;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// updateShortcuts() will update all menu item - the menu items will be shifted
|
// updateShortcuts() will update all menu item - the menu items will be shifted
|
||||||
@ -781,16 +859,23 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
_rightClickMenu.enableItem(IDM_BABYGRID_CLEAR, false);
|
_rightClickMenu.enableItem(IDM_BABYGRID_CLEAR, false);
|
||||||
else
|
else
|
||||||
_rightClickMenu.enableItem(IDM_BABYGRID_CLEAR, true);
|
_rightClickMenu.enableItem(IDM_BABYGRID_CLEAR, true);
|
||||||
switch(_currentState) {
|
|
||||||
|
switch(_currentState)
|
||||||
|
{
|
||||||
case STATE_MACRO:
|
case STATE_MACRO:
|
||||||
case STATE_USER: {
|
case STATE_USER:
|
||||||
|
{
|
||||||
_rightClickMenu.enableItem(IDM_BABYGRID_DELETE, true);
|
_rightClickMenu.enableItem(IDM_BABYGRID_DELETE, true);
|
||||||
break; }
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case STATE_MENU:
|
case STATE_MENU:
|
||||||
case STATE_PLUGIN:
|
case STATE_PLUGIN:
|
||||||
case STATE_SCINTILLA: {
|
case STATE_SCINTILLA:
|
||||||
|
{
|
||||||
_rightClickMenu.enableItem(IDM_BABYGRID_DELETE, false);
|
_rightClickMenu.enableItem(IDM_BABYGRID_DELETE, false);
|
||||||
break; }
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -824,34 +909,38 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
{
|
{
|
||||||
vector<CommandShortcut> & vShortcuts = nppParam->getUserShortcuts();
|
vector<CommandShortcut> & vShortcuts = nppParam->getUserShortcuts();
|
||||||
findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyCombo(), currentIndex);
|
findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyCombo(), currentIndex);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case STATE_MACRO:
|
case STATE_MACRO:
|
||||||
{
|
{
|
||||||
vector<MacroShortcut> & vShortcuts = nppParam->getMacroList();
|
vector<MacroShortcut> & vShortcuts = nppParam->getMacroList();
|
||||||
findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyCombo(), currentIndex);
|
findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyCombo(), currentIndex);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case STATE_USER:
|
case STATE_USER:
|
||||||
{
|
{
|
||||||
vector<UserCommand> & vShortcuts = nppParam->getUserCommandList();
|
vector<UserCommand> & vShortcuts = nppParam->getUserCommandList();
|
||||||
findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyCombo(), currentIndex);
|
findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyCombo(), currentIndex);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case STATE_PLUGIN:
|
case STATE_PLUGIN:
|
||||||
{
|
{
|
||||||
vector<PluginCmdShortcut> & vShortcuts = nppParam->getPluginCommandList();
|
vector<PluginCmdShortcut> & vShortcuts = nppParam->getPluginCommandList();
|
||||||
findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyCombo(), currentIndex);
|
findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyCombo(), currentIndex);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case STATE_SCINTILLA:
|
case STATE_SCINTILLA:
|
||||||
{
|
{
|
||||||
vector<ScintillaKeyMap> & vShortcuts = nppParam->getScintillaKeyList();
|
vector<ScintillaKeyMap> & vShortcuts = nppParam->getScintillaKeyList();
|
||||||
size_t sciCombos = vShortcuts[currentIndex].getSize();
|
size_t sciCombos = vShortcuts[currentIndex].getSize();
|
||||||
for (size_t sciIndex = 0; sciIndex < sciCombos; ++sciIndex)
|
for (size_t sciIndex = 0; sciIndex < sciCombos; ++sciIndex)
|
||||||
findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyComboByIndex(sciIndex), currentIndex);
|
findKeyConflicts(&conflictInfo, vShortcuts[currentIndex].getKeyComboByIndex(sciIndex), currentIndex);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conflictInfo.empty())
|
if (conflictInfo.empty())
|
||||||
@ -861,13 +950,16 @@ INT_PTR CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
} //switch (HIWORD(wParam))
|
}
|
||||||
}
|
}
|
||||||
} //switch (LOWORD(wParam))
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} //switch (message)
|
|
||||||
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -905,9 +997,9 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
|
|||||||
{
|
{
|
||||||
if (not keyConflictLocation->empty())
|
if (not keyConflictLocation->empty())
|
||||||
*keyConflictLocation += TEXT("\r\n");
|
*keyConflictLocation += TEXT("\r\n");
|
||||||
*keyConflictLocation += tabNames[gridState];
|
*keyConflictLocation += _tabNames[gridState];
|
||||||
*keyConflictLocation += TEXT(" | ");
|
*keyConflictLocation += TEXT(" | ");
|
||||||
*keyConflictLocation += numToStr(itemIndex + 1);
|
*keyConflictLocation += std::to_wstring(itemIndex + 1);
|
||||||
*keyConflictLocation += TEXT(" ");
|
*keyConflictLocation += TEXT(" ");
|
||||||
*keyConflictLocation += vShortcuts[itemIndex].getName();
|
*keyConflictLocation += vShortcuts[itemIndex].getName();
|
||||||
*keyConflictLocation += TEXT(" ( ");
|
*keyConflictLocation += TEXT(" ( ");
|
||||||
@ -939,9 +1031,9 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
|
|||||||
{
|
{
|
||||||
if (not keyConflictLocation->empty())
|
if (not keyConflictLocation->empty())
|
||||||
*keyConflictLocation += TEXT("\r\n");
|
*keyConflictLocation += TEXT("\r\n");
|
||||||
*keyConflictLocation += tabNames[gridState];
|
*keyConflictLocation += _tabNames[gridState];
|
||||||
*keyConflictLocation += TEXT(" | ");
|
*keyConflictLocation += TEXT(" | ");
|
||||||
*keyConflictLocation += numToStr(itemIndex + 1);
|
*keyConflictLocation += std::to_wstring(itemIndex + 1);
|
||||||
*keyConflictLocation += TEXT(" ");
|
*keyConflictLocation += TEXT(" ");
|
||||||
*keyConflictLocation += vShortcuts[itemIndex].getName();
|
*keyConflictLocation += vShortcuts[itemIndex].getName();
|
||||||
*keyConflictLocation += TEXT(" ( ");
|
*keyConflictLocation += TEXT(" ( ");
|
||||||
@ -973,9 +1065,9 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
|
|||||||
{
|
{
|
||||||
if (not keyConflictLocation->empty())
|
if (not keyConflictLocation->empty())
|
||||||
*keyConflictLocation += TEXT("\r\n");
|
*keyConflictLocation += TEXT("\r\n");
|
||||||
*keyConflictLocation += tabNames[gridState];
|
*keyConflictLocation += _tabNames[gridState];
|
||||||
*keyConflictLocation += TEXT(" | ");
|
*keyConflictLocation += TEXT(" | ");
|
||||||
*keyConflictLocation += numToStr(itemIndex + 1);
|
*keyConflictLocation += std::to_wstring(itemIndex + 1);
|
||||||
*keyConflictLocation += TEXT(" ");
|
*keyConflictLocation += TEXT(" ");
|
||||||
*keyConflictLocation += vShortcuts[itemIndex].getName();
|
*keyConflictLocation += vShortcuts[itemIndex].getName();
|
||||||
*keyConflictLocation += TEXT(" ( ");
|
*keyConflictLocation += TEXT(" ( ");
|
||||||
@ -1007,9 +1099,9 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
|
|||||||
{
|
{
|
||||||
if (not keyConflictLocation->empty())
|
if (not keyConflictLocation->empty())
|
||||||
*keyConflictLocation += TEXT("\r\n");
|
*keyConflictLocation += TEXT("\r\n");
|
||||||
*keyConflictLocation += tabNames[gridState];
|
*keyConflictLocation += _tabNames[gridState];
|
||||||
*keyConflictLocation += TEXT(" | ");
|
*keyConflictLocation += TEXT(" | ");
|
||||||
*keyConflictLocation += numToStr(itemIndex + 1);
|
*keyConflictLocation += std::to_wstring(itemIndex + 1);
|
||||||
*keyConflictLocation += TEXT(" ");
|
*keyConflictLocation += TEXT(" ");
|
||||||
*keyConflictLocation += vShortcuts[itemIndex].getName();
|
*keyConflictLocation += vShortcuts[itemIndex].getName();
|
||||||
*keyConflictLocation += TEXT(" ( ");
|
*keyConflictLocation += TEXT(" ( ");
|
||||||
@ -1044,9 +1136,9 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
|
|||||||
{
|
{
|
||||||
if (not keyConflictLocation->empty())
|
if (not keyConflictLocation->empty())
|
||||||
*keyConflictLocation += TEXT("\r\n");
|
*keyConflictLocation += TEXT("\r\n");
|
||||||
*keyConflictLocation += tabNames[gridState];
|
*keyConflictLocation += _tabNames[gridState];
|
||||||
*keyConflictLocation += TEXT(" | ");
|
*keyConflictLocation += TEXT(" | ");
|
||||||
*keyConflictLocation += numToStr(itemIndex + 1);
|
*keyConflictLocation += std::to_wstring(itemIndex + 1);
|
||||||
if (sciIndex > 0)
|
if (sciIndex > 0)
|
||||||
*keyConflictLocation += TEXT("* ");
|
*keyConflictLocation += TEXT("* ");
|
||||||
else
|
else
|
||||||
@ -1060,8 +1152,8 @@ bool ShortcutMapper::findKeyConflicts(__inout_opt generic_string * const keyConf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} //case STATE_SCINTILLA
|
}
|
||||||
} //switch (gridState)
|
}
|
||||||
} //for (...)
|
}
|
||||||
return retIsConflict;
|
return retIsConflict;
|
||||||
}
|
}
|
||||||
|
@ -37,13 +37,7 @@ enum GridState {STATE_MENU, STATE_MACRO, STATE_USER, STATE_PLUGIN, STATE_SCINTIL
|
|||||||
|
|
||||||
class ShortcutMapper : public StaticDialog {
|
class ShortcutMapper : public StaticDialog {
|
||||||
public:
|
public:
|
||||||
ShortcutMapper() : _currentState(STATE_MENU), StaticDialog() {
|
ShortcutMapper() : _currentState(STATE_MENU), StaticDialog() {};
|
||||||
generic_strncpy(tabNames[0], TEXT("Main menu"), maxTabName);
|
|
||||||
generic_strncpy(tabNames[1], TEXT("Macros"), maxTabName);
|
|
||||||
generic_strncpy(tabNames[2], TEXT("Run commands"), maxTabName);
|
|
||||||
generic_strncpy(tabNames[3], TEXT("Plugin commands"), maxTabName);
|
|
||||||
generic_strncpy(tabNames[4], TEXT("Scintilla commands"), maxTabName);
|
|
||||||
};
|
|
||||||
~ShortcutMapper() {};
|
~ShortcutMapper() {};
|
||||||
|
|
||||||
void init(HINSTANCE hInst, HWND parent, GridState initState = STATE_MENU) {
|
void init(HINSTANCE hInst, HWND parent, GridState initState = STATE_MENU) {
|
||||||
@ -64,7 +58,6 @@ public:
|
|||||||
::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_SHORTCUTMAPPER_DLG), _hParent, dlgProc, reinterpret_cast<LPARAM>(this));
|
::DialogBoxParam(_hInst, MAKEINTRESOURCE(IDD_SHORTCUTMAPPER_DLG), _hParent, dlgProc, reinterpret_cast<LPARAM>(this));
|
||||||
};
|
};
|
||||||
void getClientRect(RECT & rc) const;
|
void getClientRect(RECT & rc) const;
|
||||||
void translateTab(int index, const TCHAR * newname);
|
|
||||||
|
|
||||||
bool findKeyConflicts(__inout_opt generic_string * const keyConflictLocation,
|
bool findKeyConflicts(__inout_opt generic_string * const keyConflictLocation,
|
||||||
const KeyCombo & itemKeyCombo, const size_t & itemIndex) const;
|
const KeyCombo & itemKeyCombo, const size_t & itemIndex) const;
|
||||||
@ -73,14 +66,14 @@ protected :
|
|||||||
INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int maxTabName = 64;
|
|
||||||
BabyGridWrapper _babygrid;
|
BabyGridWrapper _babygrid;
|
||||||
ContextMenu _rightClickMenu;
|
ContextMenu _rightClickMenu;
|
||||||
|
|
||||||
GridState _currentState;
|
GridState _currentState;
|
||||||
HWND _hTabCtrl = nullptr;
|
HWND _hTabCtrl = nullptr;
|
||||||
|
|
||||||
TCHAR tabNames[5][maxTabName];
|
const static int _nbTab = 5;
|
||||||
|
generic_string _tabNames[_nbTab];
|
||||||
|
|
||||||
//save/restore the last view
|
//save/restore the last view
|
||||||
std::vector<size_t> _lastHomeRow;
|
std::vector<size_t> _lastHomeRow;
|
||||||
@ -101,6 +94,7 @@ private:
|
|||||||
void initTabs();
|
void initTabs();
|
||||||
void initBabyGrid();
|
void initBabyGrid();
|
||||||
void fillOutBabyGrid();
|
void fillOutBabyGrid();
|
||||||
|
generic_string getTabString(size_t i) const;
|
||||||
|
|
||||||
bool isConflict(const KeyCombo & lhs, const KeyCombo & rhs) const
|
bool isConflict(const KeyCombo & lhs, const KeyCombo & rhs) const
|
||||||
{
|
{
|
||||||
|
@ -389,8 +389,13 @@ INT_PTR CALLBACK Shortcut::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
|||||||
|
|
||||||
if (iFound != -1)
|
if (iFound != -1)
|
||||||
::SendDlgItemMessage(_hSelf, IDC_KEY_COMBO, CB_SETCURSEL, iFound, 0);
|
::SendDlgItemMessage(_hSelf, IDC_KEY_COMBO, CB_SETCURSEL, iFound, 0);
|
||||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_WARNING_STATIC), isEnabled()?SW_HIDE:SW_SHOW);
|
|
||||||
|
// Hide this warning on startup
|
||||||
|
::ShowWindow(::GetDlgItem(_hSelf, IDC_WARNING_STATIC), SW_HIDE);
|
||||||
|
|
||||||
updateConflictState();
|
updateConflictState();
|
||||||
|
NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance()->getNativeLangSpeaker();
|
||||||
|
nativeLangSpeaker->changeDlgLang(_hSelf, "ShortcutMapperSubDialg");
|
||||||
goToCenter();
|
goToCenter();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -778,7 +783,8 @@ void ScintillaKeyMap::applyToCurrentIndex()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScintillaKeyMap::validateDialog() {
|
void ScintillaKeyMap::validateDialog()
|
||||||
|
{
|
||||||
bool valid = isValid(); //current combo valid?
|
bool valid = isValid(); //current combo valid?
|
||||||
bool isDisabling = _keyCombo._key == 0; //true if this keycombo were to disable the shortcut
|
bool isDisabling = _keyCombo._key == 0; //true if this keycombo were to disable the shortcut
|
||||||
bool isDisabled = !isEnabled(); //true if this shortcut already is
|
bool isDisabled = !isEnabled(); //true if this shortcut already is
|
||||||
@ -846,6 +852,11 @@ INT_PTR CALLBACK ScintillaKeyMap::run_dlgProc(UINT Message, WPARAM wParam, LPARA
|
|||||||
showCurrentSettings();
|
showCurrentSettings();
|
||||||
validateDialog();
|
validateDialog();
|
||||||
|
|
||||||
|
// Hide this warning on startup
|
||||||
|
::ShowWindow(::GetDlgItem(_hSelf, IDC_WARNING_STATIC), SW_HIDE);
|
||||||
|
|
||||||
|
NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance()->getNativeLangSpeaker();
|
||||||
|
nativeLangSpeaker->changeDlgLang(_hSelf, "ShortcutMapperSubDialg");
|
||||||
goToCenter();
|
goToCenter();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -856,19 +867,16 @@ INT_PTR CALLBACK ScintillaKeyMap::run_dlgProc(UINT Message, WPARAM wParam, LPARA
|
|||||||
{
|
{
|
||||||
case IDC_CTRL_CHECK :
|
case IDC_CTRL_CHECK :
|
||||||
_keyCombo._isCtrl = BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0);
|
_keyCombo._isCtrl = BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0);
|
||||||
//applyToCurrentIndex();
|
|
||||||
validateDialog();
|
validateDialog();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case IDC_ALT_CHECK :
|
case IDC_ALT_CHECK :
|
||||||
_keyCombo._isAlt = BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0);
|
_keyCombo._isAlt = BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0);
|
||||||
//applyToCurrentIndex();
|
|
||||||
validateDialog();
|
validateDialog();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case IDC_SHIFT_CHECK :
|
case IDC_SHIFT_CHECK :
|
||||||
_keyCombo._isShift = BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0);
|
_keyCombo._isShift = BST_CHECKED == ::SendDlgItemMessage(_hSelf, static_cast<int32_t>(wParam), BM_GETCHECK, 0, 0);
|
||||||
//applyToCurrentIndex();
|
|
||||||
validateDialog();
|
validateDialog();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
@ -935,7 +943,7 @@ INT_PTR CALLBACK ScintillaKeyMap::run_dlgProc(UINT Message, WPARAM wParam, LPARA
|
|||||||
{
|
{
|
||||||
auto i = ::SendDlgItemMessage(_hSelf, IDC_KEY_COMBO, CB_GETCURSEL, 0, 0);
|
auto i = ::SendDlgItemMessage(_hSelf, IDC_KEY_COMBO, CB_GETCURSEL, 0, 0);
|
||||||
_keyCombo._key = namedKeyArray[i].id;
|
_keyCombo._key = namedKeyArray[i].id;
|
||||||
//applyToCurrentIndex();
|
::ShowWindow(::GetDlgItem(_hSelf, IDC_WARNING_STATIC), isEnabled() ? SW_HIDE : SW_SHOW);
|
||||||
validateDialog();
|
validateDialog();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -33,29 +33,24 @@
|
|||||||
#define IDC_STATIC -1
|
#define IDC_STATIC -1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IDD_SHORTCUT_DLG DIALOGEX 0, 0, 180, 102
|
IDD_SHORTCUT_DLG DIALOGEX 0, 0, 180, 105
|
||||||
STYLE DS_SETFONT | /*DS_MODALFRAME |*/ DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
|
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
WS_SYSMENU
|
|
||||||
EXSTYLE WS_EX_TOOLWINDOW
|
EXSTYLE WS_EX_TOOLWINDOW
|
||||||
CAPTION "Shortcut"
|
CAPTION "Shortcut"
|
||||||
FONT 8, TEXT("MS Shell Dlg"), 400, 0, 0x1
|
FONT 8, TEXT("MS Shell Dlg"), 400, 0, 0x1
|
||||||
BEGIN
|
BEGIN
|
||||||
CONTROL "CTRL",IDC_CTRL_CHECK,"Button",BS_AUTOCHECKBOX |
|
CONTROL "CTRL",IDC_CTRL_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,30,33,10
|
||||||
WS_TABSTOP,12,30,33,10
|
CONTROL "ALT",IDC_ALT_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,51,28,10
|
||||||
CONTROL "ALT",IDC_ALT_CHECK,"Button",BS_AUTOCHECKBOX |
|
CONTROL "SHIFT",IDC_SHIFT_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,57,42,35,10
|
||||||
WS_TABSTOP,12,51,28,10
|
COMBOBOX IDC_KEY_COMBO,110,40,64,270,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
CONTROL "SHIFT",IDC_SHIFT_CHECK,"Button",BS_AUTOCHECKBOX |
|
|
||||||
WS_TABSTOP,57,42,35,10
|
|
||||||
COMBOBOX IDC_KEY_COMBO,110,40,64,270,CBS_DROPDOWNLIST |
|
|
||||||
WS_VSCROLL | WS_TABSTOP
|
|
||||||
PUSHBUTTON "OK",IDOK,32,74,50,14
|
PUSHBUTTON "OK",IDOK,32,74,50,14
|
||||||
PUSHBUTTON "Cancel",IDCANCEL,103,73,50,14
|
PUSHBUTTON "Cancel",IDCANCEL,103,73,50,14
|
||||||
LTEXT "+",IDC_STATIC,45,42,8,8
|
LTEXT "+",IDC_STATIC,45,42,8,8
|
||||||
LTEXT "+",IDC_STATIC,96,42,8,8
|
LTEXT "+",IDC_STATIC,96,42,8,8
|
||||||
EDITTEXT IDC_NAME_EDIT,56,9,118,14,ES_AUTOHSCROLL
|
EDITTEXT IDC_NAME_EDIT,56,9,118,14,ES_AUTOHSCROLL
|
||||||
LTEXT "Name :",IDC_NAME_STATIC,15,12,34,8,0,WS_EX_RIGHT
|
LTEXT "Name :",IDC_NAME_STATIC,15,12,34,8,0,WS_EX_RIGHT
|
||||||
LTEXT "This will disable the accelerator!",IDC_WARNING_STATIC,6,91,170,8
|
LTEXT "This will disable the accelerator",IDC_WARNING_STATIC,6,93,170,8
|
||||||
LTEXT "CONFLICT FOUND!",IDC_CONFLICT_STATIC,6,91,170,8
|
LTEXT "CONFLICT FOUND!",IDC_CONFLICT_STATIC,6,93,170,8
|
||||||
END
|
END
|
||||||
|
|
||||||
IDD_SHORTCUTSCINT_DLG DIALOGEX 0, 0, 286, 114
|
IDD_SHORTCUTSCINT_DLG DIALOGEX 0, 0, 286, 114
|
||||||
@ -64,25 +59,20 @@ EXSTYLE WS_EX_TOOLWINDOW
|
|||||||
CAPTION "Shortcut"
|
CAPTION "Shortcut"
|
||||||
FONT 8, TEXT("MS Shell Dlg"), 400, 0, 0x1
|
FONT 8, TEXT("MS Shell Dlg"), 400, 0, 0x1
|
||||||
BEGIN
|
BEGIN
|
||||||
CONTROL "CTRL",IDC_CTRL_CHECK,"Button",BS_AUTOCHECKBOX |
|
CONTROL "CTRL",IDC_CTRL_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,114,27,33,10
|
||||||
WS_TABSTOP,114,27,33,10
|
CONTROL "ALT",IDC_ALT_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,114,48,28,10
|
||||||
CONTROL "ALT",IDC_ALT_CHECK,"Button",BS_AUTOCHECKBOX |
|
CONTROL "SHIFT",IDC_SHIFT_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,39,35,10
|
||||||
WS_TABSTOP,114,48,28,10
|
COMBOBOX IDC_KEY_COMBO,212,37,64,270,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
CONTROL "SHIFT",IDC_SHIFT_CHECK,"Button",BS_AUTOCHECKBOX |
|
PUSHBUTTON "Apply", IDC_BUTTON_APPLY, 210, 66, 48, 14
|
||||||
WS_TABSTOP,159,39,35,10
|
PUSHBUTTON "OK",IDOK,144,84,48,14
|
||||||
COMBOBOX IDC_KEY_COMBO,212,37,64,270,CBS_DROPDOWNLIST |
|
PUSHBUTTON "Cancel",IDCANCEL,210,84,48,14
|
||||||
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,147,39,8,8
|
||||||
LTEXT "+",IDC_STATIC,198,39,8,8
|
LTEXT "+",IDC_STATIC,198,39,8,8
|
||||||
EDITTEXT IDC_NAME_EDIT,158,6,118,14,ES_AUTOHSCROLL | ES_READONLY
|
EDITTEXT IDC_NAME_EDIT,158,6,118,14,ES_AUTOHSCROLL | ES_READONLY
|
||||||
LTEXT "Name :",IDC_NAME_STATIC,117,9,34,8,0,WS_EX_RIGHT
|
LTEXT "Name :",IDC_NAME_STATIC,117,9,34,8,0,WS_EX_RIGHT
|
||||||
LTEXT "This will remove the accelerator!",IDC_WARNING_STATIC,114,99,162,8
|
LTEXT "This will remove the accelerator",IDC_WARNING_STATIC,6,101,162,8
|
||||||
LTEXT "CONFLICT FOUND!",IDC_CONFLICT_STATIC,114,99,162,8
|
LTEXT "CONFLICT FOUND!",IDC_CONFLICT_STATIC,6,101,162,8
|
||||||
LISTBOX IDC_LIST_KEYS,6,6,90,72,LBS_NOINTEGRALHEIGHT |
|
LISTBOX IDC_LIST_KEYS,6,6,90,72,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||||
WS_VSCROLL | WS_TABSTOP
|
|
||||||
PUSHBUTTON "Add",IDC_BUTTON_ADD,6,84,42,14
|
PUSHBUTTON "Add",IDC_BUTTON_ADD,6,84,42,14
|
||||||
PUSHBUTTON "Remove",IDC_BUTTON_RMVE,56,84,40,14
|
PUSHBUTTON "Remove",IDC_BUTTON_RMVE,56,84,40,14
|
||||||
PUSHBUTTON "Apply",IDC_BUTTON_APPLY,210,60,48,14
|
|
||||||
END
|
END
|
||||||
|
@ -944,34 +944,27 @@ void NativeLangSpeaker::changeShortcutLang()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeLangSpeaker::changeShortcutmapperLang(ShortcutMapper * sm)
|
generic_string NativeLangSpeaker::getShortcutMapperLangStr(const char *nodeName, const TCHAR *defaultStr) const
|
||||||
{
|
{
|
||||||
if (!_nativeLangA) return;
|
if (!_nativeLangA) return defaultStr;
|
||||||
|
|
||||||
TiXmlNodeA *shortcuts = _nativeLangA->FirstChild("Dialog");
|
TiXmlNodeA *targetNode = _nativeLangA->FirstChild("Dialog");
|
||||||
if (!shortcuts) return;
|
if (!targetNode) return defaultStr;
|
||||||
|
|
||||||
shortcuts = shortcuts->FirstChild("ShortcutMapper");
|
targetNode = targetNode->FirstChild("ShortcutMapper");
|
||||||
if (!shortcuts) return;
|
if (!targetNode) return defaultStr;
|
||||||
|
|
||||||
for (TiXmlNodeA *childNode = shortcuts->FirstChildElement("Item");
|
targetNode = targetNode->FirstChild(nodeName);
|
||||||
childNode ;
|
if (!targetNode) return defaultStr;
|
||||||
childNode = childNode->NextSibling("Item") )
|
|
||||||
|
const char *name = (targetNode->ToElement())->Attribute("name");
|
||||||
|
if (name && name[0])
|
||||||
{
|
{
|
||||||
TiXmlElementA *element = childNode->ToElement();
|
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||||
int index;
|
return wmc->char2wchar(name, _nativeLangEncoding);
|
||||||
if (element->Attribute("index", &index))
|
|
||||||
{
|
|
||||||
if (index > -1 && index < 5) //valid index only
|
|
||||||
{
|
|
||||||
const char *name = element->Attribute("name");
|
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
|
||||||
const wchar_t * nameW = wmc->char2wchar(name, _nativeLangEncoding);
|
|
||||||
sm->translateTab(index, nameW);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return defaultStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +60,6 @@ public:
|
|||||||
generic_string getNativeLangMenuString(int itemID) const;
|
generic_string getNativeLangMenuString(int itemID) const;
|
||||||
void changeMenuLang(HMENU menuHandle, generic_string & pluginsTrans, generic_string & windowTrans);
|
void changeMenuLang(HMENU menuHandle, generic_string & pluginsTrans, generic_string & windowTrans);
|
||||||
void changeShortcutLang();
|
void changeShortcutLang();
|
||||||
void changeShortcutmapperLang(ShortcutMapper * sm);
|
|
||||||
void changeStyleCtrlsLang(HWND hDlg, int *idArray, const char **translatedText);
|
void changeStyleCtrlsLang(HWND hDlg, int *idArray, const char **translatedText);
|
||||||
void changeUserDefineLang(UserDefineDialog *userDefineDlg);
|
void changeUserDefineLang(UserDefineDialog *userDefineDlg);
|
||||||
void changeUserDefineLangPopupDlg(HWND hDlg);
|
void changeUserDefineLangPopupDlg(HWND hDlg);
|
||||||
@ -82,6 +81,7 @@ public:
|
|||||||
return _nativeLangEncoding;
|
return _nativeLangEncoding;
|
||||||
};
|
};
|
||||||
bool getMsgBoxLang(const char *msgBoxTagName, generic_string & title, generic_string & message);
|
bool getMsgBoxLang(const char *msgBoxTagName, generic_string & title, generic_string & message);
|
||||||
|
generic_string getShortcutMapperLangStr(const char *nodeName, const TCHAR *defaultStr) const;
|
||||||
generic_string getProjectPanelLangMenuStr(const char * nodeName, int cmdID, const TCHAR *defaultStr) const;
|
generic_string getProjectPanelLangMenuStr(const char * nodeName, int cmdID, const TCHAR *defaultStr) const;
|
||||||
generic_string getFileBrowserLangMenuStr(int cmdID, const TCHAR *defaultStr) const;
|
generic_string getFileBrowserLangMenuStr(int cmdID, const TCHAR *defaultStr) const;
|
||||||
generic_string getAttrNameStr(const TCHAR *defaultStr, const char *nodeL1Name, const char *nodeL2Name = NULL) const;
|
generic_string getAttrNameStr(const TCHAR *defaultStr, const char *nodeL1Name, const char *nodeL2Name = NULL) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user