[NEW_FEATURE] Add 2 menu commands : "Modify Shortcut/Delete Macro" and "Modify Shortcut/Delete Command".
[NEW] Add "Modify" and "Delete" buttons on Shortcut mapper dialog. [BUG_FIXED] Fix Shortcut Mapper inconsistence issue after deleting a macro or an user command. [NEW] Add NPPM_GETCURRENTNATIVELANGENCODING message (to get the current native language enconding). [UPDATE] Update native languages files: english.xml, french.xml and chinese.xml . [BUG_FIXED] Remove characters count feature from the status bar due to its performance issue with UTF8 file. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@647 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
9400d01219
commit
49e4230a4a
@ -32,6 +32,7 @@
|
||||
<Item posX="2" posY="17" name="清除顏色標記"/>
|
||||
<Item posX="2" posY="18" name="到上一個顏色標記"/>
|
||||
<Item posX="2" posY="19" name="到下一個顏色標記"/>
|
||||
<Item posX="2" posY="21" name="書籤"/>
|
||||
<Item posX="3" posY="4" name="特殊字元"/>
|
||||
<Item posX="3" posY="5" name="焦距"/>
|
||||
<Item posX="3" posY="6" name="現行文件移動│拷貝"/>
|
||||
@ -162,6 +163,7 @@
|
||||
<Item id="43047" name="上一個搜尋結果"/>
|
||||
<Item id="43048" name="選取並搜尋下一個"/>
|
||||
<Item id="43049" name="選取並搜尋上一個"/>
|
||||
<Item id="43050" name="反向標記書籤"/>
|
||||
<Item id="44009" name="便條紙"/>
|
||||
<Item id="44010" name="折疊所有層次"/>
|
||||
<Item id="44011" name="自訂語法對話窗"/>
|
||||
@ -223,6 +225,8 @@
|
||||
<Item id="44042" name="隱藏選取行"/>
|
||||
<Item id="42040" name="開啟上列所有檔案"/>
|
||||
<Item id="42041" name="清除上列檔案清單"/>
|
||||
<Item id="48016" name="變更或移除"/>
|
||||
<Item id="48017" name="變更或移除"/>
|
||||
</Commands>
|
||||
</Main>
|
||||
<Splitter>
|
||||
@ -419,7 +423,7 @@
|
||||
|
||||
</Global>
|
||||
<Scintillas title="編輯區">
|
||||
<Item id="6216" name="źĐ˛Ĺł]Šw"/>
|
||||
<Item id="6216" name="游標設定"/>
|
||||
<Item id="6217" name="寬 :"/>
|
||||
<Item id="6219" name="閃鑠率 :"/>
|
||||
<Item id="6221" name="快"/>
|
||||
@ -431,6 +435,12 @@
|
||||
<Item id="6203" name="箭頭"/>
|
||||
<Item id="6204" name="圓形"/>
|
||||
<Item id="6205" name="方形"/>
|
||||
<Item id="6226" name="無"/>
|
||||
|
||||
<Item id="6227" name="斷行設定"/>
|
||||
<Item id="6228" name="原訂值"/>
|
||||
<Item id="6229" name="對齊"/>
|
||||
<Item id="6230" name="縮排"/>
|
||||
|
||||
<Item id="6206" name="顯示列數邊行"/>
|
||||
<Item id="6207" name="顯示書籤邊行"/>
|
||||
|
@ -31,6 +31,7 @@
|
||||
<Item posX="2" posY="17" name="Unmark All"/>
|
||||
<Item posX="2" posY="18" name="Jump Up"/>
|
||||
<Item posX="2" posY="19" name="Jump Down"/>
|
||||
<Item posX="2" posY="21" name="Bookmark"/>
|
||||
<Item posX="3" posY="4" name="Show Symbol"/>
|
||||
<Item posX="3" posY="5" name="Zoom"/>
|
||||
<Item posX="3" posY="6" name="Move/Clone Current Document"/>
|
||||
@ -158,6 +159,7 @@
|
||||
<Item id="43047" name="Previous Search Result"/>
|
||||
<Item id="43048" name="Select and Find Next"/>
|
||||
<Item id="43049" name="Select and Find Previous"/>
|
||||
<Item id="43050" name="Inverse Bookmark"/>
|
||||
<Item id="44009" name="Post-It"/>
|
||||
<Item id="44010" name="Fold All"/>
|
||||
<Item id="44011" name="User-Defined Dialogue..."/>
|
||||
@ -222,6 +224,8 @@
|
||||
<Item id="44042" name="Hide Lines"/>
|
||||
<Item id="42040" name="Open All Recent Files"/>
|
||||
<Item id="42041" name="Empty Recent Files List"/>
|
||||
<Item id="48016" name="Modify Shortcut/Delete Macro..."/>
|
||||
<Item id="48017" name="Modify Shortcut/Delete Command..."/>
|
||||
|
||||
</Commands>
|
||||
</Main>
|
||||
@ -430,6 +434,12 @@
|
||||
<Item id="6203" name="Arrow"/>
|
||||
<Item id="6204" name="Circle tree"/>
|
||||
<Item id="6205" name="Box tree"/>
|
||||
<Item id="6226" name="None"/>
|
||||
|
||||
<Item id="6227" name="Line Wrap"/>
|
||||
<Item id="6228" name="Default"/>
|
||||
<Item id="6229" name="Aligned"/>
|
||||
<Item id="6230" name="Indent"/>
|
||||
|
||||
<Item id="6206" name="Display line numbers"/>
|
||||
<Item id="6207" name="Display bookmarks"/>
|
||||
|
@ -31,6 +31,7 @@
|
||||
<Item posX="2" posY="15" name="Enlever toutes les marques"/>
|
||||
<Item posX="2" posY="16" name="Aller vers le haut"/>
|
||||
<Item posX="2" posY="17" name="Aller vers le bas"/>
|
||||
<Item posX="2" posY="21" name="Signet"/>
|
||||
<Item posX="3" posY="4" name="Symbole spéciaux"/>
|
||||
<Item posX="3" posY="5" name="Zoom"/>
|
||||
<Item posX="3" posY="6" name="Déplacer/Cloner le document actuel"/>
|
||||
@ -156,6 +157,9 @@
|
||||
<Item id="43045" name="Fenêtre de résultats de recherche"/>
|
||||
<Item id="43046" name="Résultat de recherche suivant"/>
|
||||
<Item id="43047" name="Résultat de recherche précédent"/>
|
||||
<Item id="43048" name="Sélection et recherche suivante"/>
|
||||
<Item id="43049" name="Sélection et recherche précédente"/>
|
||||
<Item id="43050" name="Inverser les signets"/>
|
||||
<Item id="44009" name="Post-it"/>
|
||||
<Item id="44010" name="Replier tous les blocs"/>
|
||||
<Item id="44011" name="Panneau de langage défini par l'utilisateur"/>
|
||||
@ -217,6 +221,8 @@
|
||||
<Item id="44042" name="Cacher les lignes"/>
|
||||
<Item id="42040" name="Ouvrir tous les fichiers récents"/>
|
||||
<Item id="42041" name="Vider la liste des fichiers récents"/>
|
||||
<Item id="48016" name="Modifier/Supprimer Macro..."/>
|
||||
<Item id="48017" name="Modifier/Supprimere Command..."/>
|
||||
|
||||
</Commands>
|
||||
</Main>
|
||||
@ -426,6 +432,12 @@
|
||||
<Item id="6203" name="Flèche"/>
|
||||
<Item id="6204" name="Cercle"/>
|
||||
<Item id="6205" name="Carré"/>
|
||||
<Item id="6226" name="Aucun"/>
|
||||
<Item id="6227" name="Line Wrap"/>
|
||||
<Item id="6228" name="Défaut"/>
|
||||
<Item id="6229" name="Aligné"/>
|
||||
<Item id="6230" name="Indent"/>
|
||||
|
||||
<Item id="6206" name="Afficher la numérotation des lignes"/>
|
||||
<Item id="6207" name="Afficher la marge de signet"/>
|
||||
<Item id="6208" name="Afficher la marge droite"/>
|
||||
|
@ -311,6 +311,11 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
|
||||
#define NPPM_SAVECURRENTFILEAS (NPPMSG + 78)
|
||||
// BOOL NPPM_SAVECURRENTFILEAS (BOOL asCopy, const TCHAR* filename)
|
||||
|
||||
#define NPPM_GETCURRENTNATIVELANGENCODING (NPPMSG + 79)
|
||||
// INT NPPM_GETCURRENTNATIVELANGENCODING(0, 0)
|
||||
// returned value : the current native language enconding
|
||||
|
||||
|
||||
#define RUNCOMMAND_USER (WM_USER + 3000)
|
||||
#define NPPM_GETFULLCURRENTPATH (RUNCOMMAND_USER + FULL_CURRENT_PATH)
|
||||
#define NPPM_GETCURRENTDIRECTORY (RUNCOMMAND_USER + CURRENT_DIRECTORY)
|
||||
|
@ -327,10 +327,17 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
||||
size_t nbMacro = macros.size();
|
||||
if (nbMacro >= 1)
|
||||
::InsertMenu(hMacroMenu, posBase - 1, MF_BYPOSITION, (unsigned int)-1, 0);
|
||||
|
||||
for (size_t i = 0 ; i < nbMacro ; i++)
|
||||
{
|
||||
::InsertMenu(hMacroMenu, posBase + i, MF_BYPOSITION, ID_MACRO + i, macros[i].toMenuItemString().c_str());
|
||||
}
|
||||
|
||||
if (nbMacro >= 1)
|
||||
{
|
||||
::InsertMenu(hMacroMenu, posBase + nbMacro + 1, MF_BYPOSITION, (unsigned int)-1, 0);
|
||||
::InsertMenu(hMacroMenu, posBase + nbMacro + 2, MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_MACRO, TEXT("Modify Shortcut/Delete Macro..."));
|
||||
}
|
||||
// Run Menu
|
||||
std::vector<UserCommand> & userCommands = pNppParam->getUserCommandList();
|
||||
HMENU hRunMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_RUN);
|
||||
@ -343,6 +350,12 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
||||
::InsertMenu(hRunMenu, runPosBase + i, MF_BYPOSITION, ID_USER_CMD + i, userCommands[i].toMenuItemString().c_str());
|
||||
}
|
||||
|
||||
if (nbUserCommand >= 1)
|
||||
{
|
||||
::InsertMenu(hRunMenu, runPosBase + nbUserCommand + 1, MF_BYPOSITION, (unsigned int)-1, 0);
|
||||
::InsertMenu(hRunMenu, runPosBase + nbUserCommand + 2, MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_RUN, TEXT("Modify Shortcut/Delete Command..."));
|
||||
}
|
||||
|
||||
// Updater menu item
|
||||
if (!nppGUI._doesExistUpdater)
|
||||
{
|
||||
@ -2298,7 +2311,7 @@ size_t Notepad_plus::getSelectedCharNumber(UniMode u)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
size_t Notepad_plus::getCurrentDocCharCount(size_t numLines, UniMode u)
|
||||
{
|
||||
if (u != uniUTF8 && u != uniCookie)
|
||||
@ -2325,6 +2338,7 @@ size_t Notepad_plus::getCurrentDocCharCount(size_t numLines, UniMode u)
|
||||
return result;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
bool Notepad_plus::isFormatUnicode(UniMode u)
|
||||
{
|
||||
@ -2378,8 +2392,7 @@ void Notepad_plus::updateStatusBar()
|
||||
|
||||
TCHAR strDonLen[64];
|
||||
size_t numLines = _pEditView->execute(SCI_GETLINECOUNT);
|
||||
wsprintf(strDonLen, TEXT("%d chars %d bytes %d lines"),\
|
||||
getCurrentDocCharCount(numLines, u),\
|
||||
wsprintf(strDonLen, TEXT("%d bytes %d lines"),\
|
||||
_pEditView->execute(SCI_GETLENGTH) * sizeofChar + getBOMSize(u),\
|
||||
numLines);
|
||||
_statusBar.setText(strDonLen, STATUSBAR_DOC_SIZE);
|
||||
@ -3205,8 +3218,19 @@ bool Notepad_plus::addCurrentMacro()
|
||||
if (nbMacro == 0)
|
||||
{
|
||||
::InsertMenu(hMacroMenu, posBase-1, MF_BYPOSITION, (unsigned int)-1, 0); //no separator yet, add one
|
||||
}
|
||||
|
||||
// Insert the separator and modify/delete command
|
||||
::InsertMenu(hMacroMenu, posBase + nbMacro + 1, MF_BYPOSITION, (unsigned int)-1, 0);
|
||||
const char * nativeLangShortcutMapperMacro = (NppParameters::getInstance())->getNativeLangMenuStringA(IDM_SETTING_SHORTCUT_MAPPER_MACRO);
|
||||
const char * shortcutMapperMacroStr = nativeLangShortcutMapperMacro?nativeLangShortcutMapperMacro:"Modify Shortcut/Delete Macro...";
|
||||
#ifdef UNICODE
|
||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||
const wchar_t * shortcutMapperMacroStrW = wmc->char2wchar(shortcutMapperMacroStr, _nativeLangSpeaker.getLangEncoding());
|
||||
::InsertMenu(hMacroMenu, posBase + nbMacro + 2, MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_MACRO, shortcutMapperMacroStrW);
|
||||
#else
|
||||
::InsertMenu(hMacroMenu, posBase + nbMacro + 2, MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_MACRO, shortcutMapperMacroStr);
|
||||
#endif
|
||||
}
|
||||
theMacros.push_back(ms);
|
||||
::InsertMenu(hMacroMenu, posBase + nbMacro, MF_BYPOSITION, cmdID, ms.toMenuItemString().c_str());
|
||||
_accelerator.updateShortcuts();
|
||||
|
@ -540,7 +540,7 @@ private:
|
||||
|
||||
void updateStatusBar();
|
||||
size_t getSelectedCharNumber(UniMode);
|
||||
size_t getCurrentDocCharCount(size_t numLines, UniMode u);
|
||||
//size_t getCurrentDocCharCount(size_t numLines, UniMode u);
|
||||
int getSelectedAreas();
|
||||
int _numSel;
|
||||
size_t getSelectedBytes();
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "Notepad_plus_Window.h"
|
||||
#include "TaskListDlg.h"
|
||||
#include "ImageListSet.h"
|
||||
#include "ShortcutMapper.h"
|
||||
|
||||
struct SortTaskListPred
|
||||
{
|
||||
@ -372,6 +373,12 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
||||
}
|
||||
break;
|
||||
|
||||
case NPPM_GETCURRENTNATIVELANGENCODING:
|
||||
{
|
||||
return _nativeLangSpeaker.getLangEncoding();
|
||||
}
|
||||
break;
|
||||
|
||||
case NPPM_INTERNAL_DOCORDERCHANGED :
|
||||
{
|
||||
BufferID id = _pEditView->getCurrentBufferID();
|
||||
|
@ -1498,15 +1498,17 @@ void Notepad_plus::command(int id)
|
||||
}
|
||||
|
||||
case IDM_SETTING_SHORTCUT_MAPPER :
|
||||
case IDM_SETTING_SHORTCUT_MAPPER_MACRO :
|
||||
case IDM_SETTING_SHORTCUT_MAPPER_RUN :
|
||||
{
|
||||
GridState st = id==IDM_SETTING_SHORTCUT_MAPPER_MACRO?STATE_MACRO:id==IDM_SETTING_SHORTCUT_MAPPER_RUN?STATE_USER:STATE_MENU;
|
||||
ShortcutMapper shortcutMapper;
|
||||
shortcutMapper.init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf());
|
||||
shortcutMapper.init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), st);
|
||||
_nativeLangSpeaker.changeShortcutmapperLang(&shortcutMapper);
|
||||
shortcutMapper.doDialog(_nativeLangSpeaker.isRTL());
|
||||
shortcutMapper.destroy();
|
||||
break;
|
||||
}
|
||||
|
||||
case IDM_SETTING_PREFERECE :
|
||||
{
|
||||
bool isFirstTime = !_preference.isCreated();
|
||||
|
@ -35,6 +35,8 @@ void ShortcutMapper::initTabs() {
|
||||
::SendMessage(hTab, TCM_INSERTITEM, 3, (LPARAM)(&tie) );
|
||||
tie.pszText = tabNames[4];
|
||||
::SendMessage(hTab, TCM_INSERTITEM, 4, (LPARAM)(&tie) );
|
||||
|
||||
TabCtrl_SetCurSel(_hTabCtrl, int(_currentState));
|
||||
}
|
||||
|
||||
void ShortcutMapper::translateTab(int index, const TCHAR * newname) {
|
||||
@ -97,6 +99,8 @@ void ShortcutMapper::fillOutBabyGrid()
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i].getName());
|
||||
_babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str());
|
||||
}
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), true);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_DELETE), false);
|
||||
break; }
|
||||
case STATE_MACRO: {
|
||||
vector<MacroShortcut> & cshortcuts = nppParam->getMacroList();
|
||||
@ -104,6 +108,9 @@ void ShortcutMapper::fillOutBabyGrid()
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i].getName());
|
||||
_babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str());
|
||||
}
|
||||
bool shouldBeEnabled = nrItems > 0;
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), shouldBeEnabled);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_DELETE), shouldBeEnabled);
|
||||
break; }
|
||||
case STATE_USER: {
|
||||
vector<UserCommand> & cshortcuts = nppParam->getUserCommandList();
|
||||
@ -111,6 +118,9 @@ void ShortcutMapper::fillOutBabyGrid()
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i].getName());
|
||||
_babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str());
|
||||
}
|
||||
bool shouldBeEnabled = nrItems > 0;
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), shouldBeEnabled);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_DELETE), shouldBeEnabled);
|
||||
break; }
|
||||
case STATE_PLUGIN: {
|
||||
vector<PluginCmdShortcut> & cshortcuts = nppParam->getPluginCommandList();
|
||||
@ -118,6 +128,9 @@ void ShortcutMapper::fillOutBabyGrid()
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i].getName());
|
||||
_babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str());
|
||||
}
|
||||
bool shouldBeEnabled = nrItems > 0;
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), shouldBeEnabled);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_DELETE), false);
|
||||
break; }
|
||||
case STATE_SCINTILLA: {
|
||||
vector<ScintillaKeyMap> & cshortcuts = nppParam->getScintillaKeyList();
|
||||
@ -125,6 +138,8 @@ void ShortcutMapper::fillOutBabyGrid()
|
||||
_babygrid.setText(i+1, 1, cshortcuts[i].getName());
|
||||
_babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str());
|
||||
}
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_MODIFY), true);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDM_BABYGRID_DELETE), false);
|
||||
break; }
|
||||
}
|
||||
}
|
||||
@ -135,7 +150,6 @@ BOOL CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
||||
{
|
||||
case WM_INITDIALOG :
|
||||
{
|
||||
|
||||
initBabyGrid();
|
||||
initTabs();
|
||||
fillOutBabyGrid();
|
||||
@ -287,13 +301,13 @@ BOOL CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
||||
{
|
||||
const int row = _babygrid.getSelectedRow();
|
||||
int shortcutIndex = row-1;
|
||||
DWORD cmdID = 0;// = _pAccel->_pAccelArray[row-1].cmd;
|
||||
DWORD cmdID = 0;
|
||||
|
||||
// Menu data
|
||||
size_t posBase = 0;
|
||||
size_t nbElem = 0;
|
||||
HMENU hMenu = NULL;
|
||||
|
||||
int modifCmd = IDM_SETTING_SHORTCUT_MAPPER_RUN;
|
||||
switch(_currentState)
|
||||
{
|
||||
case STATE_MENU:
|
||||
@ -301,7 +315,6 @@ BOOL CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
||||
case STATE_SCINTILLA:
|
||||
{
|
||||
return FALSE; //this is bad
|
||||
break;
|
||||
}
|
||||
case STATE_MACRO:
|
||||
{
|
||||
@ -315,13 +328,13 @@ BOOL CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
||||
posBase = 6;
|
||||
nbElem = theMacros.size();
|
||||
hMenu = ::GetSubMenu((HMENU)::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_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
|
||||
{
|
||||
MacroShortcut ms = theMacros[i];
|
||||
ms.setID(ms.getID() - 1); //shift all IDs
|
||||
theMacros[i] = ms;
|
||||
}
|
||||
//::SendMessage(_hParent, NPPM_INTERNAL_MACROLIST_MODIFIED, 0, 0);
|
||||
break;
|
||||
}
|
||||
case STATE_USER:
|
||||
@ -336,40 +349,35 @@ BOOL CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
||||
posBase = 2;
|
||||
nbElem = theUserCmds.size();
|
||||
hMenu = ::GetSubMenu((HMENU)::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_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
|
||||
{
|
||||
UserCommand uc = theUserCmds[i];
|
||||
uc.setID(uc.getID() - 1); //shift all IDs
|
||||
theUserCmds[i] = uc;
|
||||
}
|
||||
|
||||
//::SendMessage(_hParent, NPPM_INTERNAL_USERCMDLIST_MODIFIED, 0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// remove from menu
|
||||
::RemoveMenu(hMenu, cmdID, MF_BYCOMMAND);
|
||||
cmdID++;
|
||||
if (nbElem == 0)
|
||||
{
|
||||
::RemoveMenu(hMenu, posBase-1, MF_BYPOSITION); //remove separator
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = shortcutIndex ; i < nbElem ; i++) //lower the IDs of the remaining menu items so there are no gaps
|
||||
{
|
||||
const int commandSize = 64;
|
||||
TCHAR cmdName[commandSize];
|
||||
::GetMenuString(hMenu, cmdID, cmdName, commandSize, MF_BYCOMMAND);
|
||||
::ModifyMenu(hMenu, cmdID, MF_BYCOMMAND, cmdID-1, cmdName); //update commandID
|
||||
}
|
||||
}
|
||||
|
||||
// updateShortcuts() will update all menu item - the menu items will be shifted
|
||||
nppParam->getAccelerator()->updateShortcuts();
|
||||
|
||||
// All menu items are shifted up. So we delete the last item
|
||||
::RemoveMenu(hMenu, posBase + nbElem - 1, MF_BYPOSITION);
|
||||
|
||||
if (nbElem == 0)
|
||||
{
|
||||
::RemoveMenu(hMenu, modifCmd, MF_BYCOMMAND);
|
||||
|
||||
//remove separator
|
||||
::RemoveMenu(hMenu, posBase-1, MF_BYPOSITION);
|
||||
::RemoveMenu(hMenu, posBase-1, MF_BYPOSITION);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case IDD_BABYGRID_ID1: {
|
||||
if(HIWORD(wParam) == BGN_CELLDBCLICKED) //a cell was clicked in the properties grid
|
||||
{
|
||||
|
@ -48,7 +48,12 @@ public:
|
||||
generic_strncpy(tabNames[4], TEXT("Scintilla commands"), maxTabName);
|
||||
};
|
||||
~ShortcutMapper() {};
|
||||
//void init(HINSTANCE hInst, HWND parent) {};
|
||||
|
||||
void init(HINSTANCE hInst, HWND parent, GridState initState = STATE_MENU) {
|
||||
Window::init(hInst, parent);
|
||||
_currentState = initState;
|
||||
};
|
||||
|
||||
void destroy() {};
|
||||
void doDialog(bool isRTL = false) {
|
||||
if (isRTL)
|
||||
|
@ -32,7 +32,8 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
|
||||
CAPTION "Shortcut mapper"
|
||||
FONT 8, TEXT("MS Shell Dlg"), 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Close",IDOK,172,319,47,14
|
||||
CONTROL "",IDC_BABYGRID_TABBAR,"SysTabControl32",TCS_BUTTONS,6,6,372,
|
||||
12
|
||||
CONTROL "",IDC_BABYGRID_TABBAR,"SysTabControl32",TCS_BUTTONS,6,6,372,12
|
||||
DEFPUSHBUTTON "Modify",IDM_BABYGRID_MODIFY,118,319,47,14
|
||||
DEFPUSHBUTTON "Delete",IDM_BABYGRID_DELETE,172,319,47,14
|
||||
DEFPUSHBUTTON "Close",IDOK,226,319,47,14
|
||||
END
|
||||
|
@ -226,6 +226,7 @@ BOOL CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case IDC_BUTTON_SAVE :
|
||||
{
|
||||
std::vector<UserCommand> & theUserCmds = (NppParameters::getInstance())->getUserCommandList();
|
||||
@ -248,10 +249,26 @@ BOOL CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
|
||||
|
||||
theUserCmds.push_back(uc);
|
||||
::InsertMenu(hRunMenu, posBase + nbCmd, MF_BYPOSITION, cmdID, uc.toMenuItemString().c_str());
|
||||
|
||||
if (nbCmd == 0)
|
||||
{
|
||||
// Insert the separator and modify/delete command
|
||||
::InsertMenu(hRunMenu, posBase + nbCmd + 1, MF_BYPOSITION, (unsigned int)-1, 0);
|
||||
const char * nativeLangShortcutMapperRun = (NppParameters::getInstance())->getNativeLangMenuStringA(IDM_SETTING_SHORTCUT_MAPPER_RUN);
|
||||
const char * shortcutMapperRunStr = nativeLangShortcutMapperRun?nativeLangShortcutMapperRun:"Modify Shortcut/Delete Command...";
|
||||
#ifdef UNICODE
|
||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||
const wchar_t * shortcutMapperRunStrW = wmc->char2wchar(shortcutMapperRunStr, ::SendMessage(_hParent, NPPM_GETCURRENTNATIVELANGENCODING, 0, 0));
|
||||
::InsertMenu(hRunMenu, posBase + nbCmd + 2, MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_RUN, shortcutMapperRunStrW);
|
||||
#else
|
||||
::InsertMenu(hRunMenu, posBase + nbCmd + 2, MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_RUN, shortcutMapperRunStr);
|
||||
#endif
|
||||
}
|
||||
(NppParameters::getInstance())->getAccelerator()->updateShortcuts();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case IDC_BUTTON_FILE_BROWSER :
|
||||
{
|
||||
FileDialog fd(_hSelf, _hInst);
|
||||
|
@ -388,6 +388,8 @@
|
||||
#define IDM_SETTING_REMEMBER_LAST_SESSION (IDM_SETTING + 10)
|
||||
#define IDM_SETTING_PREFERECE (IDM_SETTING + 11)
|
||||
#define IDM_SETTING_AUTOCNBCHAR (IDM_SETTING + 15)
|
||||
#define IDM_SETTING_SHORTCUT_MAPPER_MACRO (IDM_SETTING + 16)
|
||||
#define IDM_SETTING_SHORTCUT_MAPPER_RUN (IDM_SETTING + 17)
|
||||
|
||||
#define IDM_EXECUTE (IDM + 9000)
|
||||
|
||||
|
@ -319,8 +319,8 @@
|
||||
#define NPPM_INTERNAL_RELOADNATIVELANG (NOTEPADPLUS_USER_INTERNAL + 25)
|
||||
#define NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED (NOTEPADPLUS_USER_INTERNAL + 26)
|
||||
#define NPPM_INTERNAL_SCINTILLAFINFERCLEARALL (NOTEPADPLUS_USER_INTERNAL + 27)
|
||||
//#define NPPM_INTERNAL_SEARCH_GOTONEXTFOUND (NOTEPADPLUS_USER_INTERNAL + 28)
|
||||
//#define NPPM_INTERNAL_SEARCH_GOTOPREVFOUND (NOTEPADPLUS_USER_INTERNAL + 29)
|
||||
//#define NPPM_INTERNAL_SHORTCUT_MAPPER_MACRO (NOTEPADPLUS_USER_INTERNAL + 28)
|
||||
//#define NPPM_INTERNAL_SHORTCUT_MAPPER_RUN (NOTEPADPLUS_USER_INTERNAL + 29)
|
||||
//#define NPPM_INTERNAL_FOCUS_ON_FOUND_RESULTS (NOTEPADPLUS_USER_INTERNAL + 30)
|
||||
#define NPPM_INTERNAL_RELOADSTYLERS (NOTEPADPLUS_USER_INTERNAL + 31)
|
||||
#define NPPM_INTERNAL_DOCORDERCHANGED (NOTEPADPLUS_USER_INTERNAL + 32)
|
||||
|
Loading…
Reference in New Issue
Block a user