Enhancement of "Word characters list"
While double-clicking to select or searching with "Match whole word only" option, the selected characters stop on non-word characters. With this enhancement, users can include any non-word character into word characters list, to change its default behaviour.pull/2714/merge
parent
035bcfeb22
commit
6a05bedd05
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<NotepadPlus>
|
<NotepadPlus>
|
||||||
<Native-Langue name="正體中文" filename="chinese.xml" version="7.0">
|
<Native-Langue name="正體中文" filename="chinese.xml" version="7.3.1">
|
||||||
<Menu>
|
<Menu>
|
||||||
<Main>
|
<Main>
|
||||||
<!-- Main Menu Entries -->
|
<!-- Main Menu Entries -->
|
||||||
|
@ -827,6 +827,9 @@
|
||||||
<Item id="6252" name="起"/>
|
<Item id="6252" name="起"/>
|
||||||
<Item id="6255" name="迄"/>
|
<Item id="6255" name="迄"/>
|
||||||
<Item id="6256" name="容許多行選取"/>
|
<Item id="6256" name="容許多行選取"/>
|
||||||
|
<Item id="6161" name="定義單字的字符 (Word character list)"/>
|
||||||
|
<Item id="6162" name="使用原始的單字字符集(建議使用)"/>
|
||||||
|
<Item id="6163" name="添加你的字符集(不建議選取如果你不了解這選項)"/>
|
||||||
</Delimiter>
|
</Delimiter>
|
||||||
|
|
||||||
<Cloud title="雲端">
|
<Cloud title="雲端">
|
||||||
|
@ -981,5 +984,16 @@
|
||||||
</FileMenu>
|
</FileMenu>
|
||||||
</Menus>
|
</Menus>
|
||||||
</ProjectManager>
|
</ProjectManager>
|
||||||
|
<MiscStrings>
|
||||||
|
<word-chars-list-tip value="這允許你附加字符在當前單字字符集中,當滑鼠雙擊以進行選擇或以『僅符合整個單字』選項進行搜索。"/>
|
||||||
|
<word-chars-list-warning-begin value="警告:"/>
|
||||||
|
<!-- $INT_REPLACE$ is a place holder, don't translate it -->
|
||||||
|
<word-chars-list-space-warning value="$INT_REPLACE$ 空白字元(space)"/>
|
||||||
|
<!-- $INT_REPLACE$ is a place holder, don't translate it -->
|
||||||
|
<word-chars-list-tab-warning value="$INT_REPLACE$ 空白字元(TAB)"/>
|
||||||
|
<word-chars-list-warning-end value=" 在你的單字字符集中。"/>
|
||||||
|
<cloud-invalid-warning value="無效路徑"/>
|
||||||
|
<cloud-restart-warning value="請重新啟動 Notepad++ 以讓改變生效"/>
|
||||||
|
</MiscStrings>
|
||||||
</Native-Langue>
|
</Native-Langue>
|
||||||
</NotepadPlus>
|
</NotepadPlus>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<NotepadPlus>
|
<NotepadPlus>
|
||||||
<Native-Langue name="English" filename="english.xml" version="7.0">
|
<Native-Langue name="English" filename="english.xml" version="7.3.1">
|
||||||
<Menu>
|
<Menu>
|
||||||
<Main>
|
<Main>
|
||||||
<!-- Main Menu Entries -->
|
<!-- Main Menu Entries -->
|
||||||
|
@ -828,6 +828,10 @@
|
||||||
<Item id="6252" name="Open"/>
|
<Item id="6252" name="Open"/>
|
||||||
<Item id="6255" name="Close"/>
|
<Item id="6255" name="Close"/>
|
||||||
<Item id="6256" name="Allow on several lines"/>
|
<Item id="6256" name="Allow on several lines"/>
|
||||||
|
<Item id="6161" name="Word character list"/>
|
||||||
|
<Item id="6162" name="Use default Word character list as it is"/>
|
||||||
|
<Item id="6163" name="Add your character as part of word
|
||||||
|
(don't choose it unless you know what you're doing)"/>
|
||||||
</Delimiter>
|
</Delimiter>
|
||||||
|
|
||||||
<Cloud title="Cloud">
|
<Cloud title="Cloud">
|
||||||
|
@ -983,5 +987,16 @@
|
||||||
</FileMenu>
|
</FileMenu>
|
||||||
</Menus>
|
</Menus>
|
||||||
</ProjectManager>
|
</ProjectManager>
|
||||||
|
<MiscStrings>
|
||||||
|
<word-chars-list-tip value="This allows you to include additional character into current word characters while double clicking for selection or searching with "Match whole word only" option checked."/>
|
||||||
|
<word-chars-list-warning-begin value="Be aware: "/>
|
||||||
|
<!-- $INT_REPLACE$ is a place holder, don't translate it -->
|
||||||
|
<word-chars-list-space-warning value="$INT_REPLACE$ space(s)"/>
|
||||||
|
<!-- $INT_REPLACE$ is a place holder, don't translate it -->
|
||||||
|
<word-chars-list-tab-warning value="$INT_REPLACE$ TAB(s)"/>
|
||||||
|
<word-chars-list-warning-end value=" in your character list."/>
|
||||||
|
<cloud-invalid-warning value="Invalid path."/>
|
||||||
|
<cloud-restart-warning value="Please restart Notepad++ to take effect."/>
|
||||||
|
</MiscStrings>
|
||||||
</Native-Langue>
|
</Native-Langue>
|
||||||
</NotepadPlus>
|
</NotepadPlus>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<NotepadPlus>
|
<NotepadPlus>
|
||||||
<Native-Langue name="Français" filename="french.xml" version="7.0">
|
<Native-Langue name="Français" filename="french.xml" version="7.3.1">
|
||||||
<Menu>
|
<Menu>
|
||||||
<Main>
|
<Main>
|
||||||
<!-- Main Menu Entries -->
|
<!-- Main Menu Entries -->
|
||||||
|
@ -810,6 +810,10 @@
|
||||||
<Item id="6252" name="Début"/>
|
<Item id="6252" name="Début"/>
|
||||||
<Item id="6255" name="Fin"/>
|
<Item id="6255" name="Fin"/>
|
||||||
<Item id="6256" name="Sur plusieurs lignes"/>
|
<Item id="6256" name="Sur plusieurs lignes"/>
|
||||||
|
<Item id="6161" name="Liste des caractère de mot"/>
|
||||||
|
<Item id="6162" name="Utiliser la liste originale des caractère de mot comme telle quelle"/>
|
||||||
|
<Item id="6163" name="Inclure les caractères comme la partie des caractères de mot
|
||||||
|
(Ne pas prendre cette option si tu ne sais pas ce qu'elle fait)"/>
|
||||||
</Delimiter>
|
</Delimiter>
|
||||||
|
|
||||||
<Cloud title="Cloud">
|
<Cloud title="Cloud">
|
||||||
|
@ -967,5 +971,16 @@
|
||||||
</FileMenu>
|
</FileMenu>
|
||||||
</Menus>
|
</Menus>
|
||||||
</ProjectManager>
|
</ProjectManager>
|
||||||
|
<MiscStrings>
|
||||||
|
<word-chars-list-tip value="Cela te permet d'inclure des caractères supplémentaires dans les caractères de mot courants, lors de double-cliquant pour la sélection ou la recherche avec l'option "Mot entier uniquement"."/>
|
||||||
|
<word-chars-list-warning-begin value="Attention : "/>
|
||||||
|
<!-- $INT_REPLACE$ is a place holder, don't translate it -->
|
||||||
|
<word-chars-list-space-warning value="$INT_REPLACE$ espace(s)"/>
|
||||||
|
<!-- $INT_REPLACE$ is a place holder, don't translate it -->
|
||||||
|
<word-chars-list-tab-warning value="$INT_REPLACE$ TAB(s)"/>
|
||||||
|
<word-chars-list-warning-end value=" dans la liste des caractères de mot."/>
|
||||||
|
<cloud-invalid-warning value="Chemin invalide."/>
|
||||||
|
<cloud-restart-warning value="Veuillez redémarrer Notepad++ afin que le changement prenne effet."/>
|
||||||
|
</MiscStrings>
|
||||||
</Native-Langue>
|
</Native-Langue>
|
||||||
</NotepadPlus>
|
</NotepadPlus>
|
||||||
|
|
|
@ -714,7 +714,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
||||||
_dockingManager.setActiveTab(cti._cont, cti._activeTab);
|
_dockingManager.setActiveTab(cti._cont, cti._activeTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
retrieveDefaultWordChars();
|
retrieveDefaultWordChars(nppGUI._defaultWordChars);
|
||||||
|
|
||||||
//Load initial docs into doctab
|
//Load initial docs into doctab
|
||||||
loadBufferIntoView(_mainEditView.getCurrentBufferID(), MAIN_VIEW);
|
loadBufferIntoView(_mainEditView.getCurrentBufferID(), MAIN_VIEW);
|
||||||
|
@ -6664,40 +6664,47 @@ bool Notepad_plus::undoStreamComment()
|
||||||
//return retVal;
|
//return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notepad_plus::retrieveDefaultWordChars()
|
void Notepad_plus::retrieveDefaultWordChars(string & charList)
|
||||||
{
|
{
|
||||||
auto defaultCharListLen = _mainEditView.execute(SCI_GETWORDCHARS);
|
auto defaultCharListLen = _mainEditView.execute(SCI_GETWORDCHARS);
|
||||||
char *defaultCharList = new char[defaultCharListLen + 1];
|
char *defaultCharList = new char[defaultCharListLen + 1];
|
||||||
_mainEditView.execute(SCI_GETWORDCHARS, 0, reinterpret_cast<LPARAM>(defaultCharList));
|
_mainEditView.execute(SCI_GETWORDCHARS, 0, reinterpret_cast<LPARAM>(defaultCharList));
|
||||||
_defaultCharList = defaultCharList;
|
charList = defaultCharList;
|
||||||
delete[] defaultCharList;
|
delete[] defaultCharList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notepad_plus::restoreDefaultWordChars()
|
void Notepad_plus::restoreDefaultWordChars()
|
||||||
{
|
{
|
||||||
_mainEditView.execute(SCI_SETWORDCHARS, 0, reinterpret_cast<LPARAM>(_defaultCharList.c_str()));
|
NppParameters *pNppParam = NppParameters::getInstance();
|
||||||
_subEditView.execute(SCI_SETWORDCHARS, 0, reinterpret_cast<LPARAM>(_defaultCharList.c_str()));
|
const NppGUI & nppGUI = pNppParam->getNppGUI();
|
||||||
|
_mainEditView.execute(SCI_SETWORDCHARS, 0, reinterpret_cast<LPARAM>(nppGUI._defaultWordChars.c_str()));
|
||||||
|
_subEditView.execute(SCI_SETWORDCHARS, 0, reinterpret_cast<LPARAM>(nppGUI._defaultWordChars.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notepad_plus::addWordChars(const char *chars2add)
|
void Notepad_plus::setCustomWordChars()
|
||||||
{
|
{
|
||||||
size_t chars2addLen = strlen(chars2add);
|
NppParameters *pNppParam = NppParameters::getInstance();
|
||||||
if (not chars2addLen)
|
const NppGUI & nppGUI = pNppParam->getNppGUI();
|
||||||
|
_mainEditView.execute(SCI_SETWORDCHARS, 0, reinterpret_cast<LPARAM>(nppGUI._customWordChars.c_str()));
|
||||||
|
_subEditView.execute(SCI_SETWORDCHARS, 0, reinterpret_cast<LPARAM>(nppGUI._customWordChars.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Notepad_plus::addCustomWordChars()
|
||||||
|
{
|
||||||
|
NppParameters *pNppParam = NppParameters::getInstance();
|
||||||
|
const NppGUI & nppGUI = pNppParam->getNppGUI();
|
||||||
|
|
||||||
|
if (nppGUI._customWordChars.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto oldCharListLen = _mainEditView.execute(SCI_GETWORDCHARS);
|
|
||||||
char *oldCharList = new char[oldCharListLen + 1];
|
|
||||||
|
|
||||||
_mainEditView.execute(SCI_GETWORDCHARS, 0, reinterpret_cast<LPARAM>(oldCharList));
|
|
||||||
string chars2addStr;
|
string chars2addStr;
|
||||||
|
for (size_t i = 0; i < nppGUI._customWordChars.length(); ++i)
|
||||||
for (size_t i = 0; i < chars2addLen; ++i)
|
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
char char2check = chars2add[i];
|
char char2check = nppGUI._customWordChars[i];
|
||||||
for (auto j = 0; j < oldCharListLen; ++j)
|
for (size_t j = 0; j < nppGUI._defaultWordChars.length(); ++j)
|
||||||
{
|
{
|
||||||
char wordChar = oldCharList[j];
|
char wordChar = nppGUI._defaultWordChars[j];
|
||||||
if (char2check == wordChar)
|
if (char2check == wordChar)
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -6712,15 +6719,10 @@ void Notepad_plus::addWordChars(const char *chars2add)
|
||||||
|
|
||||||
if (not chars2addStr.empty())
|
if (not chars2addStr.empty())
|
||||||
{
|
{
|
||||||
string newCharList = oldCharList;
|
string newCharList = nppGUI._defaultWordChars;
|
||||||
newCharList += chars2addStr;
|
newCharList += chars2addStr;
|
||||||
//MessageBoxA(NULL, oldCharList, "AVANT", MB_OK);
|
|
||||||
_mainEditView.execute(SCI_SETWORDCHARS, 0, reinterpret_cast<LPARAM>(newCharList.c_str()));
|
_mainEditView.execute(SCI_SETWORDCHARS, 0, reinterpret_cast<LPARAM>(newCharList.c_str()));
|
||||||
_subEditView.execute(SCI_SETWORDCHARS, 0, reinterpret_cast<LPARAM>(newCharList.c_str()));
|
_subEditView.execute(SCI_SETWORDCHARS, 0, reinterpret_cast<LPARAM>(newCharList.c_str()));
|
||||||
|
|
||||||
//_mainEditView.execute(SCI_GETWORDCHARS, 0, (LPARAM)charList);
|
|
||||||
//MessageBoxA(NULL, charList, "APRES", MB_OK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] oldCharList;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -643,10 +643,10 @@ private:
|
||||||
static bool deleteForward(ScintillaEditView *pCurrentView, BufferID targetBufID);
|
static bool deleteForward(ScintillaEditView *pCurrentView, BufferID targetBufID);
|
||||||
static bool selectBack(ScintillaEditView *pCurrentView, BufferID targetBufID);
|
static bool selectBack(ScintillaEditView *pCurrentView, BufferID targetBufID);
|
||||||
|
|
||||||
void retrieveDefaultWordChars();
|
void retrieveDefaultWordChars(std::string & charList);
|
||||||
std::string _defaultCharList;
|
void addCustomWordChars();
|
||||||
void addWordChars(const char *chars2add);
|
|
||||||
void restoreDefaultWordChars();
|
void restoreDefaultWordChars();
|
||||||
|
void setCustomWordChars();
|
||||||
|
|
||||||
static int getRandomNumber(int rangeMax = -1)
|
static int getRandomNumber(int rangeMax = -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1286,7 +1286,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
|
|
||||||
case NPPM_INTERNAL_SETCARETWIDTH:
|
case NPPM_INTERNAL_SETCARETWIDTH:
|
||||||
{
|
{
|
||||||
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParam->getNppGUI());
|
const NppGUI & nppGUI = pNppParam->getNppGUI();
|
||||||
|
|
||||||
if (nppGUI._caretWidth < 4)
|
if (nppGUI._caretWidth < 4)
|
||||||
{
|
{
|
||||||
|
@ -1329,9 +1329,19 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case NPPM_INTERNAL_SETWORDCHARS:
|
||||||
|
{
|
||||||
|
const NppGUI & nppGUI = pNppParam->getNppGUI();
|
||||||
|
if (nppGUI._isWordCharDefault)
|
||||||
|
restoreDefaultWordChars();
|
||||||
|
else
|
||||||
|
addCustomWordChars();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
case NPPM_INTERNAL_SETMULTISELCTION:
|
case NPPM_INTERNAL_SETMULTISELCTION:
|
||||||
{
|
{
|
||||||
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParam->getNppGUI());
|
const NppGUI & nppGUI = pNppParam->getNppGUI();
|
||||||
_mainEditView.execute(SCI_SETMULTIPLESELECTION, nppGUI._enableMultiSelection);
|
_mainEditView.execute(SCI_SETMULTIPLESELECTION, nppGUI._enableMultiSelection);
|
||||||
_subEditView.execute(SCI_SETMULTIPLESELECTION, nppGUI._enableMultiSelection);
|
_subEditView.execute(SCI_SETMULTIPLESELECTION, nppGUI._enableMultiSelection);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1339,7 +1349,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
|
|
||||||
case NPPM_INTERNAL_SETCARETBLINKRATE:
|
case NPPM_INTERNAL_SETCARETBLINKRATE:
|
||||||
{
|
{
|
||||||
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParam->getNppGUI());
|
const NppGUI & nppGUI = pNppParam->getNppGUI();
|
||||||
_mainEditView.execute(SCI_SETCARETPERIOD, nppGUI._caretBlinkRate);
|
_mainEditView.execute(SCI_SETCARETPERIOD, nppGUI._caretBlinkRate);
|
||||||
_subEditView.execute(SCI_SETCARETPERIOD, nppGUI._caretBlinkRate);
|
_subEditView.execute(SCI_SETCARETPERIOD, nppGUI._caretBlinkRate);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1459,13 +1469,13 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
|
|
||||||
case NPPM_INTERNAL_GETCHECKDOCOPT:
|
case NPPM_INTERNAL_GETCHECKDOCOPT:
|
||||||
{
|
{
|
||||||
return (LRESULT)(const_cast<NppGUI &>(pNppParam->getNppGUI()))._fileAutoDetection;
|
return (LRESULT)(pNppParam->getNppGUI())._fileAutoDetection;
|
||||||
}
|
}
|
||||||
|
|
||||||
case NPPM_INTERNAL_SETCHECKDOCOPT:
|
case NPPM_INTERNAL_SETCHECKDOCOPT:
|
||||||
{
|
{
|
||||||
// If nothing is changed by user, then we allow to set this value
|
// If nothing is changed by user, then we allow to set this value
|
||||||
if ((const_cast<NppGUI &>(pNppParam->getNppGUI()))._fileAutoDetection == (const_cast<NppGUI &>(pNppParam->getNppGUI()))._fileAutoDetectionOriginalValue)
|
if ((const_cast<NppGUI &>(pNppParam->getNppGUI()))._fileAutoDetection == (pNppParam->getNppGUI())._fileAutoDetectionOriginalValue)
|
||||||
(const_cast<NppGUI &>(pNppParam->getNppGUI()))._fileAutoDetection = (ChangeDetect)wParam;
|
(const_cast<NppGUI &>(pNppParam->getNppGUI()))._fileAutoDetection = (ChangeDetect)wParam;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1753,7 +1763,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
|
|
||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
{
|
{
|
||||||
NppGUI & nppgui = const_cast<NppGUI &>((pNppParam->getNppGUI()));
|
const NppGUI & nppgui = (pNppParam->getNppGUI());
|
||||||
if (((nppgui._isMinimizedToTray && !_isAdministrator) || _pPublicInterface->isPrelaunch()) && (wParam == SC_MINIMIZE))
|
if (((nppgui._isMinimizedToTray && !_isAdministrator) || _pPublicInterface->isPrelaunch()) && (wParam == SC_MINIMIZE))
|
||||||
{
|
{
|
||||||
if (nullptr == _pTrayIco)
|
if (nullptr == _pTrayIco)
|
||||||
|
@ -2035,7 +2045,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
|
|
||||||
case NPPM_ISSTATUSBARHIDDEN:
|
case NPPM_ISSTATUSBARHIDDEN:
|
||||||
{
|
{
|
||||||
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParam->getNppGUI());
|
const NppGUI & nppGUI = pNppParam->getNppGUI();
|
||||||
return !nppGUI._statusBarShow;
|
return !nppGUI._statusBarShow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2220,7 +2230,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
|
|
||||||
case WM_ENTERMENULOOP:
|
case WM_ENTERMENULOOP:
|
||||||
{
|
{
|
||||||
NppGUI & nppgui = const_cast<NppGUI &>((pNppParam->getNppGUI()));
|
const NppGUI & nppgui = pNppParam->getNppGUI();
|
||||||
if (!nppgui._menuBarShow && !wParam && !_sysMenuEntering)
|
if (!nppgui._menuBarShow && !wParam && !_sysMenuEntering)
|
||||||
::SetMenu(hwnd, _mainMenuHandle);
|
::SetMenu(hwnd, _mainMenuHandle);
|
||||||
|
|
||||||
|
@ -2229,7 +2239,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
|
|
||||||
case WM_EXITMENULOOP:
|
case WM_EXITMENULOOP:
|
||||||
{
|
{
|
||||||
NppGUI & nppgui = const_cast<NppGUI &>((pNppParam->getNppGUI()));
|
const NppGUI & nppgui = pNppParam->getNppGUI();
|
||||||
if (!nppgui._menuBarShow && !wParam && !_sysMenuEntering)
|
if (!nppgui._menuBarShow && !wParam && !_sysMenuEntering)
|
||||||
::SetMenu(hwnd, NULL);
|
::SetMenu(hwnd, NULL);
|
||||||
_sysMenuEntering = false;
|
_sysMenuEntering = false;
|
||||||
|
|
|
@ -4676,6 +4676,24 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||||
if (themePath != NULL && themePath[0])
|
if (themePath != NULL && themePath[0])
|
||||||
_nppGUI._themeName.assign(themePath);
|
_nppGUI._themeName.assign(themePath);
|
||||||
}
|
}
|
||||||
|
else if (!lstrcmp(nm, TEXT("wordCharList")))
|
||||||
|
{
|
||||||
|
const TCHAR * value = element->Attribute(TEXT("useDefault"));
|
||||||
|
if (value && value[0])
|
||||||
|
{
|
||||||
|
if (lstrcmp(value, TEXT("yes")) == 0)
|
||||||
|
_nppGUI._isWordCharDefault = true;
|
||||||
|
else if (lstrcmp(value, TEXT("no")) == 0)
|
||||||
|
_nppGUI._isWordCharDefault = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TCHAR *charsAddedW = element->Attribute(TEXT("charsAdded"));
|
||||||
|
if (charsAddedW)
|
||||||
|
{
|
||||||
|
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
_nppGUI._customWordChars = wmc->wchar2char(charsAddedW, SC_CP_UTF8);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (!lstrcmp(nm, TEXT("delimiterSelection")))
|
else if (!lstrcmp(nm, TEXT("delimiterSelection")))
|
||||||
{
|
{
|
||||||
int leftmost = 0;
|
int leftmost = 0;
|
||||||
|
@ -5416,6 +5434,16 @@ void NppParameters::createXmlTreeFromGUIParams()
|
||||||
GUIConfigElement->SetAttribute(TEXT("path"), _nppGUI._themeName.c_str());
|
GUIConfigElement->SetAttribute(TEXT("path"), _nppGUI._themeName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// <GUIConfig name="wordCharList" useDefault="yes" charsAdded=".$%" />
|
||||||
|
{
|
||||||
|
TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
|
||||||
|
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("wordCharList"));
|
||||||
|
GUIConfigElement->SetAttribute(TEXT("useDefault"), _nppGUI._isWordCharDefault ? TEXT("yes") : TEXT("no"));
|
||||||
|
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
const wchar_t* charsAddStr = wmc->char2wchar(_nppGUI._customWordChars.c_str(), SC_CP_UTF8);
|
||||||
|
GUIConfigElement->SetAttribute(TEXT("charsAdded"), charsAddStr);
|
||||||
|
}
|
||||||
|
|
||||||
// <GUIConfig name="delimiterSelection" leftmostDelimiter="40" rightmostDelimiter="41" delimiterSelectionOnEntireDocument="no" />
|
// <GUIConfig name="delimiterSelection" leftmostDelimiter="40" rightmostDelimiter="41" delimiterSelectionOnEntireDocument="no" />
|
||||||
{
|
{
|
||||||
TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
|
TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
|
||||||
|
|
|
@ -760,6 +760,9 @@ struct NppGUI final
|
||||||
bool _delimiterSelectionOnEntireDocument = false;
|
bool _delimiterSelectionOnEntireDocument = false;
|
||||||
bool _backSlashIsEscapeCharacterForSql = true;
|
bool _backSlashIsEscapeCharacterForSql = true;
|
||||||
|
|
||||||
|
bool _isWordCharDefault = true;
|
||||||
|
std::string _defaultWordChars;
|
||||||
|
std::string _customWordChars;
|
||||||
|
|
||||||
// 0 : do nothing
|
// 0 : do nothing
|
||||||
// 1 : don't draw underline
|
// 1 : don't draw underline
|
||||||
|
|
|
@ -371,15 +371,23 @@ IDD_PREFERENCE_DELIMITERSETTINGS_BOX DIALOGEX 0, 0, 455, 185
|
||||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
||||||
FONT 8, "MS Shell Dlg", 0, 0, 0x1
|
FONT 8, "MS Shell Dlg", 0, 0, 0x1
|
||||||
BEGIN
|
BEGIN
|
||||||
GROUPBOX "Delimiter selection settings (Ctrl + Mouse double click)",IDC_DELIMITERSETTINGS_GB_STATIC,89,44,268,89,BS_CENTER
|
GROUPBOX "Word character list",IDC_WORDCHARLIST_GB_STATIC,89,2,268,93,BS_CENTER
|
||||||
RTEXT "Open",IDD_STATIC_OPENDELIMITER,117,67,34,8
|
CONTROL "Use default Word character list as it is",IDC_RADIO_WORDCHAR_DEFAULT,"Button",BS_AUTORADIOBUTTON | WS_GROUP,100,18,250,10
|
||||||
EDITTEXT IDC_EDIT_OPENDELIMITER,156,65,14,14
|
CONTROL "Add your character as part of word\r(don't choose it unless you know what you're doing)",IDC_RADIO_WORDCHAR_CUSTOM,
|
||||||
LTEXT "bla bla bla bla bla bla",IDD_STATIC_BLABLA,172,67,56,8
|
"Button",BS_AUTORADIOBUTTON | BS_MULTILINE | WS_GROUP,100,32,250,20
|
||||||
LTEXT "bla bla bla bla bla bla bla bla bla bla bla bla",IDD_STATIC_BLABLA2NDLINE,132,87,126,8
|
EDITTEXT IDC_WORDCHAR_CUSTOM_EDIT,111,54,180,14,ES_AUTOHSCROLL
|
||||||
EDITTEXT IDC_EDIT_CLOSEDELIMITER,237,65,14,14
|
PUSHBUTTON "?",IDD_WORDCHAR_QUESTION_BUTTON,303,53,16,14
|
||||||
LTEXT "Close",IDD_STATIC_CLOSEDELIMITER,252,67,47,8
|
LTEXT "",IDD_STATIC_WORDCHAR_WARNING,111,70,210,8
|
||||||
|
|
||||||
|
GROUPBOX "Delimiter selection settings (Ctrl + Mouse double click)",IDC_DELIMITERSETTINGS_GB_STATIC,89,113,268,70,BS_CENTER
|
||||||
|
RTEXT "Open",IDD_STATIC_OPENDELIMITER,117,128,34,8
|
||||||
|
EDITTEXT IDC_EDIT_OPENDELIMITER,156,126,14,14
|
||||||
|
LTEXT "bla bla bla bla bla bla",IDD_STATIC_BLABLA,172,128,56,8
|
||||||
|
LTEXT "bla bla bla bla bla bla bla bla bla bla bla bla",IDD_STATIC_BLABLA2NDLINE,132,148,126,8
|
||||||
|
EDITTEXT IDC_EDIT_CLOSEDELIMITER,237,126,14,14
|
||||||
|
LTEXT "Close",IDD_STATIC_CLOSEDELIMITER,252,128,47,8
|
||||||
CONTROL "Allow on several lines",IDD_SEVERALLINEMODEON_CHECK,
|
CONTROL "Allow on several lines",IDD_SEVERALLINEMODEON_CHECK,
|
||||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,109,160,10
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,166,160,10
|
||||||
END
|
END
|
||||||
|
|
||||||
IDD_PREFERENCE_SETTINGSONCLOUD_BOX DIALOGEX 0, 0, 455, 185
|
IDD_PREFERENCE_SETTINGSONCLOUD_BOX DIALOGEX 0, 0, 455, 185
|
||||||
|
@ -391,7 +399,7 @@ BEGIN
|
||||||
CONTROL "Set your cloud location path here:",IDC_WITHCLOUD_RADIO,"Button",BS_AUTORADIOBUTTON,125,72,180,10
|
CONTROL "Set your cloud location path here:",IDC_WITHCLOUD_RADIO,"Button",BS_AUTORADIOBUTTON,125,72,180,10
|
||||||
EDITTEXT IDC_CLOUDPATH_EDIT,134,88,179,14,ES_AUTOHSCROLL
|
EDITTEXT IDC_CLOUDPATH_EDIT,134,88,179,14,ES_AUTOHSCROLL
|
||||||
PUSHBUTTON "...",IDD_CLOUDPATH_BROWSE_BUTTON,320,87,16,14
|
PUSHBUTTON "...",IDD_CLOUDPATH_BROWSE_BUTTON,320,87,16,14
|
||||||
LTEXT "",IDC_SETTINGSONCLOUD_WARNING_STATIC,131,117,135,20
|
LTEXT "",IDC_SETTINGSONCLOUD_WARNING_STATIC,131,117,220,20
|
||||||
END
|
END
|
||||||
|
|
||||||
IDD_PREFERENCE_SEARCHENGINE_BOX DIALOGEX 0, 0, 455, 185
|
IDD_PREFERENCE_SEARCHENGINE_BOX DIALOGEX 0, 0, 455, 185
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "preferenceDlg.h"
|
#include "preferenceDlg.h"
|
||||||
#include "lesDlgs.h"
|
#include "lesDlgs.h"
|
||||||
#include "EncodingMapper.h"
|
#include "EncodingMapper.h"
|
||||||
|
#include "localization.h"
|
||||||
|
|
||||||
#define MyGetGValue(rgb) (LOBYTE((rgb)>>8))
|
#define MyGetGValue(rgb) (LOBYTE((rgb)>>8))
|
||||||
|
|
||||||
|
@ -2888,6 +2889,142 @@ INT_PTR CALLBACK MultiInstDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DelimiterSettingsDlg::detectSpace(const char *text2Check, int & nbSp, int & nbTab)
|
||||||
|
{
|
||||||
|
nbSp = nbTab = 0;
|
||||||
|
for (size_t i = 0; i < strlen(text2Check); ++i)
|
||||||
|
{
|
||||||
|
if (text2Check[i] == ' ')
|
||||||
|
++nbSp;
|
||||||
|
else if (text2Check[i] == '\t')
|
||||||
|
++nbTab;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HWND CreateToolTip(int toolID, HWND hDlg, HINSTANCE hInst, const PTSTR pszText)
|
||||||
|
{
|
||||||
|
if (!toolID || !hDlg || !pszText)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the window of the tool.
|
||||||
|
HWND hwndTool = GetDlgItem(hDlg, toolID);
|
||||||
|
if (!hwndTool)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the tooltip. g_hInst is the global instance handle.
|
||||||
|
HWND hwndTip = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL,
|
||||||
|
WS_POPUP | TTS_ALWAYSTIP | TTS_BALLOON,
|
||||||
|
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
|
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||||
|
hDlg, NULL,
|
||||||
|
hInst, NULL);
|
||||||
|
|
||||||
|
if (!hwndTip)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Associate the tooltip with the tool.
|
||||||
|
TOOLINFO toolInfo = { 0 };
|
||||||
|
toolInfo.cbSize = sizeof(toolInfo);
|
||||||
|
toolInfo.hwnd = hDlg;
|
||||||
|
toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
|
||||||
|
toolInfo.uId = (UINT_PTR)hwndTool;
|
||||||
|
toolInfo.lpszText = pszText;
|
||||||
|
if (!SendMessage(hwndTip, TTM_ADDTOOL, 0, (LPARAM)&toolInfo))
|
||||||
|
{
|
||||||
|
DestroyWindow(hwndTip);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hwndTip;
|
||||||
|
}
|
||||||
|
|
||||||
|
generic_string DelimiterSettingsDlg::getWarningText(size_t nbSp, size_t nbTab) const
|
||||||
|
{
|
||||||
|
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
|
||||||
|
|
||||||
|
generic_string msg;
|
||||||
|
if (nbSp && nbTab)
|
||||||
|
{
|
||||||
|
generic_string nbSpStr = std::to_wstring(nbSp);
|
||||||
|
generic_string nbTabStr = std::to_wstring(nbTab);
|
||||||
|
generic_string warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin");
|
||||||
|
generic_string space = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-space-warning");
|
||||||
|
generic_string tab = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tab-warning");
|
||||||
|
generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end");
|
||||||
|
|
||||||
|
if (not warnBegin.empty() && not space.empty() && not tab.empty() && not warnEnd.empty())
|
||||||
|
{
|
||||||
|
space = stringReplace(space, TEXT("$INT_REPLACE$"), nbSpStr);
|
||||||
|
tab = stringReplace(tab, TEXT("$INT_REPLACE$"), nbTabStr);
|
||||||
|
msg = warnBegin;
|
||||||
|
msg += space;
|
||||||
|
msg += TEXT(" && ");
|
||||||
|
msg += tab;
|
||||||
|
msg += warnEnd;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg = TEXT("Be aware: ");
|
||||||
|
msg += nbSpStr;
|
||||||
|
msg += TEXT(" space(s) && ");
|
||||||
|
msg += std::to_wstring(nbTab);
|
||||||
|
msg += TEXT(" TAB(s) in your character list.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (nbSp && not nbTab)
|
||||||
|
{
|
||||||
|
generic_string nbSpStr = std::to_wstring(nbSp);
|
||||||
|
generic_string warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin");
|
||||||
|
generic_string space = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-space-warning");
|
||||||
|
generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end");
|
||||||
|
if (not warnBegin.empty() && not space.empty() && not warnEnd.empty())
|
||||||
|
{
|
||||||
|
space = stringReplace(space, TEXT("$INT_REPLACE$"), nbSpStr);
|
||||||
|
msg = warnBegin;
|
||||||
|
msg += space;
|
||||||
|
msg += warnEnd;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg = TEXT("Be aware: ");
|
||||||
|
msg += std::to_wstring(nbSp);
|
||||||
|
msg += TEXT(" space(s) in your character list.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (not nbSp && nbTab)
|
||||||
|
{
|
||||||
|
generic_string nbTabStr = std::to_wstring(nbTab);
|
||||||
|
generic_string warnBegin = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-begin");
|
||||||
|
generic_string tab = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tab-warning");
|
||||||
|
generic_string warnEnd = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-warning-end");
|
||||||
|
if (not warnBegin.empty() && not tab.empty() && not warnEnd.empty())
|
||||||
|
{
|
||||||
|
tab = stringReplace(tab, TEXT("$INT_REPLACE$"), nbTabStr);
|
||||||
|
msg = warnBegin;
|
||||||
|
msg += tab;
|
||||||
|
msg += warnEnd;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg = TEXT("Be aware: ");
|
||||||
|
msg += std::to_wstring(nbTab);
|
||||||
|
msg += TEXT(" TAB(s) in your character list.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else //(not nbSp && not nbTab)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance())->getNppGUI());
|
NppGUI & nppGUI = const_cast<NppGUI &>((NppParameters::getInstance())->getNppGUI());
|
||||||
|
@ -2895,6 +3032,9 @@ INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT message, WPARAM wParam,
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Delimiter
|
||||||
|
//
|
||||||
TCHAR opener[2];
|
TCHAR opener[2];
|
||||||
opener[0] = nppGUI._leftmostDelimiter;
|
opener[0] = nppGUI._leftmostDelimiter;
|
||||||
opener[1] = '\0';
|
opener[1] = '\0';
|
||||||
|
@ -2932,6 +3072,35 @@ INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT message, WPARAM wParam,
|
||||||
::MoveWindow(::GetDlgItem(_hSelf, IDC_EDIT_CLOSEDELIMITER), p->x, p->y, _closerRect.right, _closerRect.bottom, TRUE);
|
::MoveWindow(::GetDlgItem(_hSelf, IDC_EDIT_CLOSEDELIMITER), p->x, p->y, _closerRect.right, _closerRect.bottom, TRUE);
|
||||||
::MoveWindow(::GetDlgItem(_hSelf, IDD_STATIC_CLOSEDELIMITER), p->x + _closerRect.right + 4, p->y + 4, _closerLabelRect.right, _closerLabelRect.bottom, TRUE);
|
::MoveWindow(::GetDlgItem(_hSelf, IDD_STATIC_CLOSEDELIMITER), p->x + _closerRect.right + 4, p->y + 4, _closerLabelRect.right, _closerLabelRect.bottom, TRUE);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Word Char List
|
||||||
|
//
|
||||||
|
|
||||||
|
::SetDlgItemTextA(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT, nppGUI._customWordChars.c_str());
|
||||||
|
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_DEFAULT, BM_SETCHECK, nppGUI._isWordCharDefault ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||||
|
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_CUSTOM, BM_SETCHECK, not nppGUI._isWordCharDefault ? BST_CHECKED : BST_UNCHECKED, 0);
|
||||||
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), not nppGUI._isWordCharDefault);
|
||||||
|
|
||||||
|
int nbSp = 0;
|
||||||
|
int nbTab = 0;
|
||||||
|
detectSpace(nppGUI._customWordChars.c_str(), nbSp, nbTab);
|
||||||
|
generic_string msg = getWarningText(nbSp, nbTab);
|
||||||
|
::SetDlgItemText(_hSelf, IDD_STATIC_WORDCHAR_WARNING, msg.c_str());
|
||||||
|
|
||||||
|
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
|
||||||
|
generic_string tip2show = pNativeSpeaker->getLocalizedStrFromID("word-chars-list-tip");
|
||||||
|
if (tip2show.empty())
|
||||||
|
tip2show = TEXT("This allows you to include additional character into current word characters while double clicking for selection or searching with \"Match whole word only\" option checked.");
|
||||||
|
|
||||||
|
_tip = CreateToolTip(IDD_WORDCHAR_QUESTION_BUTTON, _hSelf, _hInst, const_cast<PTSTR>(tip2show.c_str()));
|
||||||
|
if (_tip)
|
||||||
|
{
|
||||||
|
SendMessage(_tip, TTM_ACTIVATE, TRUE, 0);
|
||||||
|
SendMessage(_tip, TTM_SETMAXTIPWIDTH, 0, 200);
|
||||||
|
|
||||||
|
// Make tip stay 30 seconds
|
||||||
|
SendMessage(_tip, TTM_SETDELAYTIME, TTDT_AUTOPOP, MAKELPARAM((30000), (0)));
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2972,6 +3141,24 @@ INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT message, WPARAM wParam,
|
||||||
nppGUI._rightmostDelimiter = static_cast<char>(closer[0]);
|
nppGUI._rightmostDelimiter = static_cast<char>(closer[0]);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case IDC_WORDCHAR_CUSTOM_EDIT:
|
||||||
|
{
|
||||||
|
char customText[MAX_PATH];
|
||||||
|
::GetDlgItemTextA(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT, customText, MAX_PATH-1);
|
||||||
|
nppGUI._customWordChars = customText;
|
||||||
|
|
||||||
|
int nbSp = 0;
|
||||||
|
int nbTab = 0;
|
||||||
|
detectSpace(customText, nbSp, nbTab);
|
||||||
|
generic_string msg = getWarningText(nbSp, nbTab);
|
||||||
|
::SetDlgItemText(_hSelf, IDD_STATIC_WORDCHAR_WARNING, msg.c_str());
|
||||||
|
|
||||||
|
if (not nppGUI._isWordCharDefault)
|
||||||
|
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETWORDCHARS, 0, 0);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -2994,6 +3181,26 @@ INT_PTR CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT message, WPARAM wParam,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case IDC_RADIO_WORDCHAR_DEFAULT:
|
||||||
|
{
|
||||||
|
//::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_DEFAULT, BM_SETCHECK, BST_CHECKED, 0);
|
||||||
|
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_CUSTOM, BM_SETCHECK, BST_UNCHECKED, 0);
|
||||||
|
nppGUI._isWordCharDefault = true;
|
||||||
|
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETWORDCHARS, 0, 0);
|
||||||
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), not nppGUI._isWordCharDefault);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
case IDC_RADIO_WORDCHAR_CUSTOM:
|
||||||
|
{
|
||||||
|
::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_DEFAULT, BM_SETCHECK, BST_UNCHECKED, 0);
|
||||||
|
//::SendDlgItemMessage(_hSelf, IDC_RADIO_WORDCHAR_CUSTOM, BM_SETCHECK, BST_CHECKED, 0);
|
||||||
|
nppGUI._isWordCharDefault = false;
|
||||||
|
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETWORDCHARS, 0, 0);
|
||||||
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_WORDCHAR_CUSTOM_EDIT), not nppGUI._isWordCharDefault);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
default :
|
default :
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -3019,12 +3226,19 @@ INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT message, WPARAM wParam, LP
|
||||||
TCHAR inputDirExpanded[MAX_PATH] = {'\0'};
|
TCHAR inputDirExpanded[MAX_PATH] = {'\0'};
|
||||||
::SendDlgItemMessage(_hSelf, IDC_CLOUDPATH_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir));
|
::SendDlgItemMessage(_hSelf, IDC_CLOUDPATH_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir));
|
||||||
::ExpandEnvironmentStrings(inputDir, inputDirExpanded, MAX_PATH);
|
::ExpandEnvironmentStrings(inputDir, inputDirExpanded, MAX_PATH);
|
||||||
|
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
|
||||||
if (::PathFileExists(inputDirExpanded))
|
if (::PathFileExists(inputDirExpanded))
|
||||||
{
|
{
|
||||||
nppGUI._cloudPath = inputDirExpanded;
|
nppGUI._cloudPath = inputDirExpanded;
|
||||||
nppParams->setCloudChoice(inputDirExpanded);
|
nppParams->setCloudChoice(inputDirExpanded);
|
||||||
|
|
||||||
generic_string message = nppParams->isCloudPathChanged() ? TEXT("Please restart Notepad++ to take effect.") : TEXT("");
|
generic_string message;
|
||||||
|
if (nppParams->isCloudPathChanged())
|
||||||
|
{
|
||||||
|
message = pNativeSpeaker->getLocalizedStrFromID("cloud-restart-warning");
|
||||||
|
if (message.empty())
|
||||||
|
message = TEXT("Please restart Notepad++ to take effect.");
|
||||||
|
}
|
||||||
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str());
|
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3032,7 +3246,9 @@ INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT message, WPARAM wParam, LP
|
||||||
bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_WITHCLOUD_RADIO, BM_GETCHECK, 0, 0));
|
bool isChecked = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_WITHCLOUD_RADIO, BM_GETCHECK, 0, 0));
|
||||||
if (isChecked)
|
if (isChecked)
|
||||||
{
|
{
|
||||||
generic_string message = TEXT("Invalid path.");
|
generic_string message = pNativeSpeaker->getLocalizedStrFromID("cloud-invalid-warning");
|
||||||
|
if (message.empty())
|
||||||
|
message = TEXT("Invalid path.");
|
||||||
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str());
|
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str());
|
||||||
nppParams->removeCloudChoice();
|
nppParams->removeCloudChoice();
|
||||||
}
|
}
|
||||||
|
@ -3075,7 +3291,14 @@ INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT message, WPARAM wParam, LP
|
||||||
nppGUI._cloudPath = TEXT("");
|
nppGUI._cloudPath = TEXT("");
|
||||||
nppParams->removeCloudChoice();
|
nppParams->removeCloudChoice();
|
||||||
|
|
||||||
generic_string message = nppParams->isCloudPathChanged() ? TEXT("Please restart Notepad++ to take effect.") : TEXT("");
|
generic_string message;
|
||||||
|
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
|
||||||
|
if (nppParams->isCloudPathChanged())
|
||||||
|
{
|
||||||
|
message = pNativeSpeaker->getLocalizedStrFromID("cloud-restart-warning");
|
||||||
|
if (message.empty())
|
||||||
|
message = TEXT("Please restart Notepad++ to take effect.");
|
||||||
|
}
|
||||||
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str());
|
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str());
|
||||||
|
|
||||||
::SendDlgItemMessage(_hSelf, IDC_CLOUDPATH_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(nppGUI._cloudPath.c_str()));
|
::SendDlgItemMessage(_hSelf, IDC_CLOUDPATH_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(nppGUI._cloudPath.c_str()));
|
||||||
|
@ -3086,7 +3309,10 @@ INT_PTR CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT message, WPARAM wParam, LP
|
||||||
|
|
||||||
case IDC_WITHCLOUD_RADIO:
|
case IDC_WITHCLOUD_RADIO:
|
||||||
{
|
{
|
||||||
generic_string message = TEXT("Invalid path.");
|
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
|
||||||
|
generic_string message = pNativeSpeaker->getLocalizedStrFromID("cloud-invalid-warning");
|
||||||
|
if (message.empty())
|
||||||
|
message = TEXT("Invalid path.");
|
||||||
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str());
|
::SetDlgItemText(_hSelf, IDC_SETTINGSONCLOUD_WARNING_STATIC, message.c_str());
|
||||||
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_CLOUDPATH_EDIT), true);
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_CLOUDPATH_EDIT), true);
|
||||||
|
|
|
@ -189,11 +189,19 @@ class DelimiterSettingsDlg : public StaticDialog
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
DelimiterSettingsDlg() {};
|
DelimiterSettingsDlg() {};
|
||||||
|
~DelimiterSettingsDlg() {
|
||||||
|
if (_tip)
|
||||||
|
::DestroyWindow(_tip);
|
||||||
|
};
|
||||||
|
|
||||||
private :
|
private :
|
||||||
INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
|
||||||
POINT _singleLineModePoint, _multiLineModePoint;
|
POINT _singleLineModePoint, _multiLineModePoint;
|
||||||
RECT _closerRect, _closerLabelRect;
|
RECT _closerRect, _closerLabelRect;
|
||||||
|
HWND _tip = nullptr;
|
||||||
|
|
||||||
|
INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
void detectSpace(const char *text2Check, int & nbSp, int & nbTab);
|
||||||
|
generic_string getWarningText(size_t nbSp, size_t nbTab) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SettingsOnCloudDlg : public StaticDialog
|
class SettingsOnCloudDlg : public StaticDialog
|
||||||
|
@ -249,7 +257,6 @@ private :
|
||||||
void makeCategoryList();
|
void makeCategoryList();
|
||||||
int32_t getIndexFromName(const TCHAR *name) const;
|
int32_t getIndexFromName(const TCHAR *name) const;
|
||||||
void showDialogByIndex(size_t index) const;
|
void showDialogByIndex(size_t index) const;
|
||||||
//ControlsTab _ctrlTab;
|
|
||||||
WindowVector _wVector;
|
WindowVector _wVector;
|
||||||
BarsDlg _barsDlg;
|
BarsDlg _barsDlg;
|
||||||
MarginsDlg _marginsDlg;
|
MarginsDlg _marginsDlg;
|
||||||
|
|
|
@ -70,6 +70,14 @@
|
||||||
#define IDC_MONOINST_RADIO (IDD_PREFERENCE_MULTIINSTANCE_BOX + 4)
|
#define IDC_MONOINST_RADIO (IDD_PREFERENCE_MULTIINSTANCE_BOX + 4)
|
||||||
#define IDD_STATIC_RESTARTNOTE (IDD_PREFERENCE_MULTIINSTANCE_BOX + 5)
|
#define IDD_STATIC_RESTARTNOTE (IDD_PREFERENCE_MULTIINSTANCE_BOX + 5)
|
||||||
|
|
||||||
|
#define IDD_PREFERENCE_WORDCHARLIST_BOX 6160 //(IDD_PREFERENCE_BOX + 150)
|
||||||
|
#define IDC_WORDCHARLIST_GB_STATIC (IDD_PREFERENCE_WORDCHARLIST_BOX + 1)
|
||||||
|
#define IDC_RADIO_WORDCHAR_DEFAULT (IDD_PREFERENCE_WORDCHARLIST_BOX + 2)
|
||||||
|
#define IDC_RADIO_WORDCHAR_CUSTOM (IDD_PREFERENCE_WORDCHARLIST_BOX + 3)
|
||||||
|
#define IDC_WORDCHAR_CUSTOM_EDIT (IDD_PREFERENCE_WORDCHARLIST_BOX + 4)
|
||||||
|
#define IDD_WORDCHAR_QUESTION_BUTTON (IDD_PREFERENCE_WORDCHARLIST_BOX + 5)
|
||||||
|
#define IDD_STATIC_WORDCHAR_WARNING (IDD_PREFERENCE_WORDCHARLIST_BOX + 6)
|
||||||
|
|
||||||
#define IDD_PREFERENCE_MARGEIN_BOX 6200 //(IDD_PREFERENCE_BOX + 200)
|
#define IDD_PREFERENCE_MARGEIN_BOX 6200 //(IDD_PREFERENCE_BOX + 200)
|
||||||
#define IDC_FMS_GB_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 1)
|
#define IDC_FMS_GB_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 1)
|
||||||
#define IDC_RADIO_SIMPLE (IDD_PREFERENCE_MARGEIN_BOX + 2)
|
#define IDC_RADIO_SIMPLE (IDD_PREFERENCE_MARGEIN_BOX + 2)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// This file is part of Notepad++ project
|
// This file is part of Notepad++ project
|
||||||
// Copyright (C)2003 Don HO <don.h@free.fr>
|
// Copyright (C)2017 Don HO <don.h@free.fr>
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
// modify it under the terms of the GNU General Public License
|
||||||
|
@ -30,8 +30,6 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "ToolTip.h"
|
#include "ToolTip.h"
|
||||||
|
|
||||||
INT_PTR CALLBACK dlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
|
||||||
|
|
||||||
void ToolTip::init(HINSTANCE hInst, HWND hParent)
|
void ToolTip::init(HINSTANCE hInst, HWND hParent)
|
||||||
{
|
{
|
||||||
if (_hSelf == NULL)
|
if (_hSelf == NULL)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// This file is part of Notepad++ project
|
// This file is part of Notepad++ project
|
||||||
// Copyright (C)2003 Don HO <don.h@free.fr>
|
// Copyright (C)2017 Don HO <don.h@free.fr>
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
// modify it under the terms of the GNU General Public License
|
||||||
|
@ -26,8 +26,7 @@
|
||||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
|
||||||
#ifndef __TOOLTIP_H__
|
#pragma once
|
||||||
#define __TOOLTIP_H__
|
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
|
@ -36,7 +35,7 @@
|
||||||
class ToolTip : public Window
|
class ToolTip : public Window
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
ToolTip() : _bTrackMouse(FALSE) {};
|
ToolTip() {};
|
||||||
|
|
||||||
void destroy(){
|
void destroy(){
|
||||||
::DestroyWindow(_hSelf);
|
::DestroyWindow(_hSelf);
|
||||||
|
@ -52,15 +51,13 @@ public:
|
||||||
void Show(RECT rectTitle, const TCHAR* pszTitleText, int iXOff = 0, int iWidthOff = 0);
|
void Show(RECT rectTitle, const TCHAR* pszTitleText, int iXOff = 0, int iWidthOff = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WNDPROC _defaultProc;
|
WNDPROC _defaultProc = nullptr;
|
||||||
BOOL _bTrackMouse;
|
BOOL _bTrackMouse = FALSE;
|
||||||
TOOLINFO _ti;
|
TOOLINFO _ti;
|
||||||
|
|
||||||
static LRESULT CALLBACK staticWinProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
|
static LRESULT CALLBACK staticWinProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
|
||||||
return (((ToolTip *)(::GetWindowLongPtr(hwnd, GWLP_USERDATA)))->runProc(Message, wParam, lParam));
|
return (((ToolTip *)(::GetWindowLongPtr(hwnd, GWLP_USERDATA)))->runProc(Message, wParam, lParam));
|
||||||
};
|
};
|
||||||
LRESULT runProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
LRESULT runProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
||||||
void SendHitMessage();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __TOOLTIP_H__
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ void NativeLangSpeaker::init(TiXmlDocumentA *nativeLangDocRootA, bool loadIfEngl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
generic_string NativeLangSpeaker::getSpecialMenuEntryName(const char *entryName)
|
generic_string NativeLangSpeaker::getSpecialMenuEntryName(const char *entryName) const
|
||||||
{
|
{
|
||||||
if (!_nativeLangA) return TEXT("");
|
if (!_nativeLangA) return TEXT("");
|
||||||
TiXmlNodeA *mainMenu = _nativeLangA->FirstChild("Menu");
|
TiXmlNodeA *mainMenu = _nativeLangA->FirstChild("Menu");
|
||||||
|
@ -173,7 +173,7 @@ generic_string NativeLangSpeaker::getSpecialMenuEntryName(const char *entryName)
|
||||||
return TEXT("");
|
return TEXT("");
|
||||||
}
|
}
|
||||||
|
|
||||||
generic_string NativeLangSpeaker::getNativeLangMenuString(int itemID)
|
generic_string NativeLangSpeaker::getNativeLangMenuString(int itemID) const
|
||||||
{
|
{
|
||||||
if (!_nativeLangA)
|
if (!_nativeLangA)
|
||||||
return TEXT("");
|
return TEXT("");
|
||||||
|
@ -207,6 +207,30 @@ generic_string NativeLangSpeaker::getNativeLangMenuString(int itemID)
|
||||||
return TEXT("");
|
return TEXT("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generic_string NativeLangSpeaker::getLocalizedStrFromID(const char *strID) const
|
||||||
|
{
|
||||||
|
if (not _nativeLangA)
|
||||||
|
return TEXT("");
|
||||||
|
|
||||||
|
if (not strID)
|
||||||
|
return TEXT("");
|
||||||
|
|
||||||
|
TiXmlNodeA *node = _nativeLangA->FirstChild("MiscStrings");
|
||||||
|
if (not node) return TEXT("");
|
||||||
|
|
||||||
|
node = node->FirstChild(strID);
|
||||||
|
if (not node) return TEXT("");
|
||||||
|
|
||||||
|
TiXmlElementA *element = node->ToElement();
|
||||||
|
|
||||||
|
const char *value = element->Attribute("value");
|
||||||
|
if (not value) return TEXT("");
|
||||||
|
|
||||||
|
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
return wmc->char2wchar(value, _nativeLangEncoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MenuPosition & getMenuPosition(const char *id)
|
MenuPosition & getMenuPosition(const char *id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,8 +56,8 @@ public:
|
||||||
TiXmlNodeA * searchDlgNode(TiXmlNodeA *node, const char *dlgTagName);
|
TiXmlNodeA * searchDlgNode(TiXmlNodeA *node, const char *dlgTagName);
|
||||||
bool changeDlgLang(HWND hDlg, const char *dlgTagName, char *title = NULL);
|
bool changeDlgLang(HWND hDlg, const char *dlgTagName, char *title = NULL);
|
||||||
void changeLangTabDrapContextMenu(HMENU hCM);
|
void changeLangTabDrapContextMenu(HMENU hCM);
|
||||||
generic_string getSpecialMenuEntryName(const char *entryName);
|
generic_string getSpecialMenuEntryName(const char *entryName) const;
|
||||||
generic_string getNativeLangMenuString(int itemID);
|
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 changeShortcutmapperLang(ShortcutMapper * sm);
|
||||||
|
@ -85,6 +85,8 @@ public:
|
||||||
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(const char * nodeName, int cmdID, const TCHAR *defaultStr) const;
|
//generic_string getFileBrowserLangMenuStr(const char * nodeName, 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;
|
||||||
|
generic_string getLocalizedStrFromID(const char *strID) const;
|
||||||
|
|
||||||
int messageBox(const char *msgBoxTagName, HWND hWnd, const TCHAR *message, const TCHAR *title, int msgBoxType, int intInfo = 0, const TCHAR *strInfo = NULL);
|
int messageBox(const char *msgBoxTagName, HWND hWnd, const TCHAR *message, const TCHAR *title, int msgBoxType, int intInfo = 0, const TCHAR *strInfo = NULL);
|
||||||
private:
|
private:
|
||||||
TiXmlNodeA *_nativeLangA;
|
TiXmlNodeA *_nativeLangA;
|
||||||
|
|
|
@ -410,6 +410,7 @@
|
||||||
#define NPPM_INTERNAL_RELOADSCROLLTOEND (NOTEPADPLUS_USER_INTERNAL + 42) // Used by Monitoring feature
|
#define NPPM_INTERNAL_RELOADSCROLLTOEND (NOTEPADPLUS_USER_INTERNAL + 42) // Used by Monitoring feature
|
||||||
#define NPPM_INTERNAL_FINDKEYCONFLICTS (NOTEPADPLUS_USER_INTERNAL + 43)
|
#define NPPM_INTERNAL_FINDKEYCONFLICTS (NOTEPADPLUS_USER_INTERNAL + 43)
|
||||||
#define NPPM_INTERNAL_SCROLLBEYONDLASTLINE (NOTEPADPLUS_USER_INTERNAL + 44)
|
#define NPPM_INTERNAL_SCROLLBEYONDLASTLINE (NOTEPADPLUS_USER_INTERNAL + 44)
|
||||||
|
#define NPPM_INTERNAL_SETWORDCHARS (NOTEPADPLUS_USER_INTERNAL + 45)
|
||||||
|
|
||||||
//wParam: 0
|
//wParam: 0
|
||||||
//lParam: document new index
|
//lParam: document new index
|
||||||
|
|
Loading…
Reference in New Issue