[NEW_FEATURE] Change language on the run time for Unicode version (in progress - reloading another language is ok).
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@385 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
be3285aa2c
commit
43bf9f4c9e
@ -4588,13 +4588,11 @@ bool Notepad_plus::reloadLang()
|
||||
}
|
||||
|
||||
int indexWindow = ::GetMenuItemCount(_mainMenuHandle) - 2;
|
||||
::ModifyMenu(_mainMenuHandle, MENUINDEX_PLUGINS, MF_BYPOSITION, 0, windowTrans.c_str());
|
||||
::ModifyMenu(_mainMenuHandle, indexWindow, MF_BYPOSITION, 0, windowTrans.c_str());
|
||||
windowTrans += TEXT("...");
|
||||
::ModifyMenu(_mainMenuHandle, IDM_WINDOW_WINDOWS, MF_BYCOMMAND, IDM_WINDOW_WINDOWS, windowTrans.c_str());
|
||||
|
||||
::DrawMenuBar(_hSelf);
|
||||
/*
|
||||
// Update context menu strings
|
||||
// Update scintilla context menu strings
|
||||
vector<MenuItemUnit> & tmp = pNppParam->getContextMenuItems();
|
||||
size_t len = tmp.size();
|
||||
TCHAR menuName[64];
|
||||
@ -4604,10 +4602,23 @@ bool Notepad_plus::reloadLang()
|
||||
{
|
||||
::GetMenuString(_mainMenuHandle, tmp[i]._cmdID, menuName, 64, MF_BYCOMMAND);
|
||||
tmp[i]._itemName = purgeMenuItemString(menuName);
|
||||
//printStr(tmp[i]._itemName.c_str());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
vector<CommandShortcut> & shortcuts = pNppParam->getUserShortcuts();
|
||||
len = shortcuts.size();
|
||||
|
||||
for(size_t i = 0; i < len; i++)
|
||||
{
|
||||
CommandShortcut & csc = shortcuts[i];
|
||||
::GetMenuString(_mainMenuHandle, csc.getID(), menuName, 64, MF_BYCOMMAND);
|
||||
csc.setName(purgeMenuItemString(menuName, true).c_str());
|
||||
}
|
||||
_accelerator.updateFullMenu();
|
||||
|
||||
_scintaccelerator.updateKeys();
|
||||
|
||||
|
||||
if (_tabPopupMenu.isCreated())
|
||||
{
|
||||
changeLangTabContextMenu();
|
||||
@ -4616,7 +4627,6 @@ bool Notepad_plus::reloadLang()
|
||||
{
|
||||
changeLangTabDrapContextMenu();
|
||||
}
|
||||
pNppParam->reloadContextMenuFromXmlTree(_mainMenuHandle);
|
||||
|
||||
if (_preference.isCreated())
|
||||
{
|
||||
@ -5328,7 +5338,7 @@ void Notepad_plus::changeLangTabContextMenu()
|
||||
#else
|
||||
if (pGoToView && pGoToView[0])
|
||||
{
|
||||
::ModifyMenu(hCM, POS_GO2VIEW, MF_BYPOSITION, 0, goToViewG);
|
||||
::ModifyMenu(hCM, POS_GO2VIEW, MF_BYPOSITION, 0, pGoToView);
|
||||
}
|
||||
if (pCloneToView && pCloneToView[0])
|
||||
{
|
||||
@ -6791,7 +6801,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
||||
// Shortcut Accelerator : should be the last one since it will capture all the shortcuts
|
||||
_accelerator.init(_mainMenuHandle, _hSelf);
|
||||
pNppParam->setAccelerator(&_accelerator);
|
||||
|
||||
|
||||
// Scintilla key accelerator
|
||||
vector<HWND> scints;
|
||||
scints.push_back(_mainEditView.getHSelf());
|
||||
|
@ -1120,6 +1120,13 @@ public:
|
||||
winVer getWinVersion() { return _winVersion;};
|
||||
FindHistory & getFindHistory() {return _findHistory;};
|
||||
|
||||
#ifdef UNICODE
|
||||
const vector<wstring> & getLocalizationList() const {
|
||||
return _localizationList;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
NppParameters();
|
||||
~NppParameters();
|
||||
@ -1177,8 +1184,9 @@ private:
|
||||
|
||||
vector<ScintillaKeyMap> _scintillaKeyCommands; //scintilla keycommands. Static size
|
||||
vector<int> _scintillaModifiedKeyIndices; //modified scintilla keys. Indices static, determined by searching for commandId. Needed when saving alterations
|
||||
|
||||
|
||||
#ifdef UNICODE
|
||||
vector<wstring> _localizationList;
|
||||
#endif
|
||||
//vector<generic_string> _noMenuCmdNames;
|
||||
vector<MenuItemUnit> _contextMenuItems;
|
||||
Session _session;
|
||||
|
@ -263,8 +263,7 @@ BOOL CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
||||
_babygrid.setText(row, 2, skm.toString().c_str());
|
||||
|
||||
//Notify current Accelerator class to update key
|
||||
//nppParam->getScintillaAccelerator()->updateKeys();
|
||||
nppParam->getScintillaAccelerator()->updateKey(prevskm, skm);
|
||||
nppParam->getScintillaAccelerator()->updateKeys();
|
||||
|
||||
//::SendMessage(_hParent, NPPM_INTERNAL_BINDSCINTILLAKEY, scintillaSc.toKeyDef(), scintillaSc.getScintillaKey());
|
||||
//::SendMessage(_hParent, NPPM_INTERNAL_CLEARSCINTILLAKEY, scintillaShortcuts[index].toKeyDef(), 0);
|
||||
|
@ -34,14 +34,14 @@ END
|
||||
|
||||
IDD_PREFERENCE_BAR_BOX DIALOGEX 0, 0, 370, 180
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
|
||||
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x1
|
||||
BEGIN
|
||||
GROUPBOX "Tool bar",IDC_TOOLBAR_GB_STATIC,17,5,145,68,BS_CENTER
|
||||
CONTROL "Hide",IDC_CHECK_HIDE,"Button",BS_AUTOCHECKBOX,24,15,94,10
|
||||
CONTROL "Small icons",IDC_RADIO_SMALLICON,"Button",BS_AUTORADIOBUTTON,24,29,114,10
|
||||
CONTROL "Big icons",IDC_RADIO_BIGICON,"Button",BS_AUTORADIOBUTTON,24,43,109,10
|
||||
CONTROL "Small standard icons",IDC_RADIO_STANDARD,"Button",BS_AUTORADIOBUTTON,24,57,119,10
|
||||
GROUPBOX "Tab bar",IDC_TABBAR_GB_STATIC,183,5,176,151,BS_CENTER
|
||||
GROUPBOX "Tool bar",IDC_TOOLBAR_GB_STATIC,17,47,147,68,BS_CENTER
|
||||
CONTROL "Hide",IDC_CHECK_HIDE,"Button",BS_AUTOCHECKBOX,24,57,94,10
|
||||
CONTROL "Small icons",IDC_RADIO_SMALLICON,"Button",BS_AUTORADIOBUTTON,24,71,114,10
|
||||
CONTROL "Big icons",IDC_RADIO_BIGICON,"Button",BS_AUTORADIOBUTTON,24,85,109,10
|
||||
CONTROL "Small standard icons",IDC_RADIO_STANDARD,"Button",BS_AUTORADIOBUTTON,24,99,119,10
|
||||
GROUPBOX "Tab bar",IDC_TABBAR_GB_STATIC,183,6,176,151,BS_CENTER
|
||||
CONTROL "Hide",IDC_CHECK_TAB_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,16,108,10
|
||||
CONTROL "Multi-Line",IDC_CHECK_TAB_MULTILINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,30,134,10
|
||||
CONTROL "Vertical",IDC_CHECK_TAB_VERTICAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,44,134,10
|
||||
@ -49,13 +49,13 @@ BEGIN
|
||||
CONTROL "Lock (No Drag N Drop)",IDC_CHECK_LOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,73,134,10
|
||||
CONTROL "Draw the inactive tabs",IDC_CHECK_DRAWINACTIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,88,134,10
|
||||
CONTROL "Draw the orange top bar",IDC_CHECK_ORANGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,103,133,10
|
||||
CONTROL "Enable close button on each tab",IDC_CHECK_ENABLETABCLOSE,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,118,133,10
|
||||
CONTROL "Double click to close document",IDC_CHECK_DBCLICK2CLOSE,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,133,133,10
|
||||
CONTROL "Show Status Bar",IDC_CHECK_SHOWSTATUSBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,140,130,10
|
||||
GROUPBOX "Menu bar",IDC_MENUBAR_GB_STATIC,16,77,147,49,BS_CENTER
|
||||
CONTROL "Hide (Use Alt or F10 key to toggle it)",IDC_CHECK_HIDEMENUBAR,"Button",BS_AUTOCHECKBOX | BS_MULTILINE,24,87,135,26
|
||||
CONTROL "Enable close button on each tab",IDC_CHECK_ENABLETABCLOSE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,118,133,10
|
||||
CONTROL "Double click to close document",IDC_CHECK_DBCLICK2CLOSE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,133,133,10
|
||||
CONTROL "Show Status Bar",IDC_CHECK_SHOWSTATUSBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,163,130,10
|
||||
GROUPBOX "Menu bar",IDC_MENUBAR_GB_STATIC,17,120,147,35,BS_CENTER
|
||||
CONTROL "Hide (Use Alt or F10 key to toggle it)",IDC_CHECK_HIDEMENUBAR,"Button",BS_AUTOCHECKBOX | BS_MULTILINE,24,127,135,25
|
||||
GROUPBOX "Localization",IDC_LOCALIZATION_GB_STATIC,17,6,147,35,BS_CENTER
|
||||
COMBOBOX IDC_COMBO_LOCALIZATION,28,20,119,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
IDD_PREFERENCE_MARGEIN_BOX DIALOGEX 0, 0, 392, 185
|
||||
|
@ -170,10 +170,14 @@ BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_SHOWSTATUSBAR, BM_SETCHECK, showStatus, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_HIDEMENUBAR, BM_SETCHECK, !showMenu, 0);
|
||||
|
||||
if (!nppGUI._doTaskList)
|
||||
{
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_STYLEMRU), FALSE);
|
||||
}
|
||||
#ifndef UNICODE
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_LOCALIZATION_GB_STATIC), FALSE);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_COMBO_LOCALIZATION), FALSE);
|
||||
#else
|
||||
const vector<wstring> & localList = pNppParam->getLocalizationList();
|
||||
for (size_t i = 0 ; i < localList.size() ; i++)
|
||||
::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_ADDSTRING, 0, (LPARAM)localList[i].c_str());
|
||||
#endif
|
||||
|
||||
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture();
|
||||
if (enableDlgTheme)
|
||||
|
@ -45,6 +45,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#define IDC_CHECK_TAB_VERTICAL (IDD_PREFERENCE_BAR_BOX + 20)
|
||||
#define IDC_MENUBAR_GB_STATIC (IDD_PREFERENCE_BAR_BOX + 21)
|
||||
#define IDC_CHECK_HIDEMENUBAR (IDD_PREFERENCE_BAR_BOX + 22)
|
||||
#define IDC_LOCALIZATION_GB_STATIC (IDD_PREFERENCE_BAR_BOX + 23)
|
||||
#define IDC_COMBO_LOCALIZATION (IDD_PREFERENCE_BAR_BOX + 24)
|
||||
|
||||
#define IDD_PREFERENCE_MARGEIN_BOX 6200 //(IDD_PREFERENCE_BOX + 200)
|
||||
#define IDC_FMS_GB_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 1)
|
||||
|
@ -601,22 +601,27 @@ void ScintillaAccelerator::init(vector<HWND> * vScintillas, HMENU hMenu, HWND me
|
||||
_nrScintillas = (int)nr;
|
||||
}
|
||||
|
||||
void ScintillaAccelerator::updateKeys() {
|
||||
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++) {
|
||||
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
|
||||
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
|
||||
if (skm.isEnabled())
|
||||
{ //no validating, scintilla accepts more keys
|
||||
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) {
|
||||
if (skm.getMenuCmdID() != 0)
|
||||
{
|
||||
updateMenuItemByID(skm, skm.getMenuCmdID());
|
||||
}
|
||||
if (j == 0) //j is unsigned, so default method doesnt work
|
||||
@ -625,30 +630,25 @@ 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), 0);
|
||||
// ::SendMessage(_vScintillas[i], SCI_ASSIGNCMDKEY, skmNew.toKeyDef(0), skmNew.getScintillaKeyID());
|
||||
//}
|
||||
}
|
||||
|
||||
void ScintillaAccelerator::updateMenuItemByID(ScintillaKeyMap skm, int id) {
|
||||
void ScintillaAccelerator::updateMenuItemByID(ScintillaKeyMap skm, int id)
|
||||
{
|
||||
NppParameters *pNppParam = NppParameters::getInstance();
|
||||
const int commandSize = 64;
|
||||
TCHAR cmdName[commandSize];
|
||||
::GetMenuString(_hAccelMenu, id, cmdName, commandSize, MF_BYCOMMAND);
|
||||
int i = 0;
|
||||
while(cmdName[i] != 0) {
|
||||
if (cmdName[i] == '\t') {
|
||||
while(cmdName[i] != 0)
|
||||
{
|
||||
if (cmdName[i] == '\t')
|
||||
{
|
||||
cmdName[i] = 0;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
generic_string menuItem = cmdName;
|
||||
if (skm.isEnabled()) {
|
||||
if (skm.isEnabled())
|
||||
{
|
||||
menuItem += TEXT("\t");
|
||||
//menuItem += TEXT("Sc:"); //sc: scintilla shortcut
|
||||
menuItem += skm.toString();
|
||||
|
@ -346,6 +346,8 @@ public:
|
||||
HACCEL getAccTable() const {return _hAccTable;};
|
||||
|
||||
void updateShortcuts();
|
||||
void updateFullMenu();
|
||||
|
||||
private:
|
||||
HMENU _hAccelMenu;
|
||||
HWND _hMenuParent;
|
||||
@ -358,7 +360,6 @@ private:
|
||||
::DestroyAcceleratorTable(_hAccTable);
|
||||
_hAccTable = ::CreateAcceleratorTable(_pAccelArray, _nbAccelItems);
|
||||
};
|
||||
void updateFullMenu();
|
||||
void updateMenuItemByCommand(CommandShortcut csc);
|
||||
};
|
||||
|
||||
|
@ -627,6 +627,10 @@
|
||||
RelativePath="..\src\resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\WinControls\Preference\resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\WinControls\StaticDialog\RunDlg\RunDlg.h"
|
||||
>
|
||||
|
Loading…
Reference in New Issue
Block a user