[NEW] Make Styler dialog of UDL2 translatable.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@962 f5eea248-9336-0410-98b8-ebc06183d4e3
remotes/trunk
Don Ho 12 years ago
parent 60239d517f
commit 2352cb8d52

@ -363,15 +363,38 @@
<Item id="20011" name="Transparency"/>
<Item id="20015" name="Import..."/>
<Item id="20016" name="Export..."/>
<Item id="0" name="Colour Style"/>
<Item id="1" name="Foreground colour"/>
<Item id="2" name="Background colour"/>
<Item id="3" name="Font Style"/>
<Item id="4" name="Font name:"/>
<Item id="5" name="Font size:"/>
<Item id="6" name="Bold"/>
<Item id="7" name="Italic"/>
<Item id="8" name="Underline"/>
<StylerDialog title="Styler Dialog">
<Item id="25030" name="Font options:"/>
<Item id="25006" name="Foreground colour"/>
<Item id="25007" name="Background colour"/>
<Item id="25031" name="Name:"/>
<Item id="25032" name="Size:"/>
<Item id="25001" name="Bold"/>
<Item id="25002" name="Italic"/>
<Item id="25003" name="Underline"/>
<Item id="25029" name="Nesting:"/>
<Item id="25008" name="Delimiter 1"/>
<Item id="25009" name="Delimiter 2"/>
<Item id="25010" name="Delimiter 3"/>
<Item id="25011" name="Delimiter 4"/>
<Item id="25012" name="Delimiter 5"/>
<Item id="25013" name="Delimiter 6"/>
<Item id="25014" name="Delimiter 7"/>
<Item id="25015" name="Delimiter 8"/>
<Item id="25018" name="Keyword 1"/>
<Item id="25019" name="Keyword 2"/>
<Item id="25020" name="Keyword 3"/>
<Item id="25021" name="Keyword 4"/>
<Item id="25022" name="Keyword 5"/>
<Item id="25023" name="Keyword 6"/>
<Item id="25024" name="Keyword 7"/>
<Item id="25025" name="Keyword 8"/>
<Item id="25016" name="Comment"/>
<Item id="25017" name="Comment line"/>
<Item id="25026" name="Operator 1"/>
<Item id="25027" name="Operator 2"/>
<Item id="25028" name="Numbers"/>
</StylerDialog>
<Folder title="Folder &amp;&amp; Default">
<Item id="21101" name="Default Style Settings"/>
<Item id="21201" name="Folder Open Keywords Settings"/>

@ -426,15 +426,6 @@
</SubDialog>
</StyleConfig>
<UserDefine title="Langage utilisateur">
<Item id="0" name="Couleurs"/>
<Item id="1" name="Premier plan"/>
<Item id="2" name="Arričre-plan"/>
<Item id="3" name="Police"/>
<Item id="4" name="Famille :"/>
<Item id="5" name="Taille :"/>
<Item id="6" name="Gras"/>
<Item id="7" name="Italique"/>
<Item id="8" name="Souligné"/>
<Item id="20001" name="Ancrer"/>
<Item id="20002" name="Renommer"/>
<Item id="20003" name="Nouveau..."/>
@ -446,6 +437,38 @@
<Item id="20012" name="Ignorer la casse"/>
<Item id="20015" name="Importer..."/>
<Item id="20016" name="Exporter..."/>
<StylerDialog title="Styler">
<Item id="25030" name="Police:"/>
<Item id="25006" name="Premier plan"/>
<Item id="25007" name="Arričre-plan"/>
<Item id="25031" name="Nom:"/>
<Item id="25032" name="Taille:"/>
<Item id="25001" name="Gras"/>
<Item id="25002" name="Italique"/>
<Item id="25003" name="Souligné"/>
<Item id="25029" name="Héberge:"/>
<Item id="25008" name="Délimiteur 1"/>
<Item id="25009" name="Délimiteur 2"/>
<Item id="25010" name="Délimiteur 3"/>
<Item id="25011" name="Délimiteur 4"/>
<Item id="25012" name="Délimiteur 5"/>
<Item id="25013" name="Délimiteur 6"/>
<Item id="25014" name="Délimiteur 7"/>
<Item id="25015" name="Délimiteur 8"/>
<Item id="25018" name="Mot clé 1"/>
<Item id="25019" name="Mot clé 2"/>
<Item id="25020" name="Mot clé 3"/>
<Item id="25021" name="Mot clé 4"/>
<Item id="25022" name="Mot clé 5"/>
<Item id="25023" name="Mot clé 6"/>
<Item id="25024" name="Mot clé 7"/>
<Item id="25025" name="Mot clé 8"/>
<Item id="25016" name="Commentaire"/>
<Item id="25017" name="Commentaire sur une ligne"/>
<Item id="25026" name="Opérateur 1"/>
<Item id="25027" name="Opérateur 2"/>
<Item id="25028" name="Nombres"/>
</StylerDialog>
<Folder title="Bloc &amp;&amp; défaut">
<Item id="21101" name="Style par défaut"/>
<Item id="21201" name="Définition de bloc ouvrant"/>

@ -28,6 +28,7 @@
#include "precompiledHeaders.h"
#include "localization.h"
#include "UserDefineDialog.h"
#include "ScintillaEditView.h"
#include "Parameters.h"
@ -1491,6 +1492,9 @@ BOOL CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
case WM_INITDIALOG :
{
NativeLangSpeaker *pNativeLangSpeaker = pNppParam->getNativeLangSpeaker();
pNativeLangSpeaker->changeUserDefineLangPopupDlg(hwnd);
::SetProp(hwnd, TEXT("Styler dialog prop"), (HANDLE)lParam);
dlg = (StylerDlg *)::GetProp(hwnd, TEXT("Styler dialog prop"));
Style & style = SharedParametersDialog::_pUserLang->_styleArray.getStyler(dlg->stylerIndex);

@ -585,7 +585,7 @@ void NativeLangSpeaker::changeStyleCtrlsLang(HWND hDlg, int *idArray, const char
}
}
void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg)
void NativeLangSpeaker::changeUserDefineLangPopupDlg(HWND hDlg)
{
if (!_nativeLangA) return;
@ -595,7 +595,47 @@ void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg)
userDefineDlgNode = userDefineDlgNode->FirstChild("UserDefine");
if (!userDefineDlgNode) return;
//UserDefineDialog *userDefineDlg = _pEditView->getUserDefineDlg();
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
TiXmlNodeA *stylerDialogNode = userDefineDlgNode->FirstChild("StylerDialog");
if (!stylerDialogNode) return;
const char *titre = (stylerDialogNode->ToElement())->Attribute("title");
if (titre &&titre[0])
{
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
::SetWindowText(hDlg, nameW);
}
for (TiXmlNodeA *childNode = stylerDialogNode->FirstChildElement("Item");
childNode ;
childNode = childNode->NextSibling("Item") )
{
TiXmlElementA *element = childNode->ToElement();
int id;
const char *sentinel = element->Attribute("id", &id);
const char *name = element->Attribute("name");
if (sentinel && (name && name[0]))
{
HWND hItem = ::GetDlgItem(hDlg, id);
if (hItem)
{
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
::SetWindowText(hItem, nameW);
}
}
}
}
void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg)
{
if (!_nativeLangA) return;
TiXmlNodeA *userDefineDlgNode = _nativeLangA->FirstChild("Dialog");
if (!userDefineDlgNode) return;
userDefineDlgNode = userDefineDlgNode->FirstChild("UserDefine");
if (!userDefineDlgNode) return;
HWND hDlg = userDefineDlg->getHSelf();
#ifdef UNICODE
@ -613,7 +653,7 @@ void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg)
::SetWindowText(hDlg, titre);
#endif
}
// pour ses propres controls
// for each control
const int nbControl = 9;
const char *translatedText[nbControl];
for (int i = 0 ; i < nbControl ; i++)
@ -654,14 +694,13 @@ void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg)
}
}
}
const int nbDlg = 4;
HWND hDlgArrary[nbDlg];
hDlgArrary[0] = userDefineDlg->getFolderHandle();
hDlgArrary[1] = userDefineDlg->getKeywordsHandle();
hDlgArrary[2] = userDefineDlg->getCommentHandle();
hDlgArrary[3] = userDefineDlg->getSymbolHandle();
/*
const int nbGrpFolder = 3;
int folderID[nbGrpFolder][nbControl] = {
//{IDC_DEFAULT_COLORSTYLEGROUP_STATIC, IDC_DEFAULT_FG_STATIC, IDC_DEFAULT_BG_STATIC, IDC_DEFAULT_FONTSTYLEGROUP_STATIC, IDC_DEFAULT_FONTNAME_STATIC, IDC_DEFAULT_FONTSIZE_STATIC, IDC_DEFAULT_BOLD_CHECK, IDC_DEFAULT_ITALIC_CHECK, IDC_DEFAULT_UNDERLINE_CHECK},\
@ -693,11 +732,12 @@ void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg)
};
int nbGpArray[nbDlg] = {nbGrpFolder, nbGrpKeywords, nbGrpComment, nbGrpOperator};
*/
const char nodeNameArray[nbDlg][16] = {"Folder", "Keywords", "Comment", "Operator"};
for (int i = 0 ; i < nbDlg ; i++)
{
/*
for (int j = 0 ; j < nbGpArray[i] ; j++)
{
switch (i)
@ -708,6 +748,7 @@ void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg)
case 3 : changeStyleCtrlsLang(hDlgArrary[i], operatorID[j], translatedText); break;
}
}
*/
TiXmlNodeA *node = userDefineDlgNode->FirstChild(nodeNameArray[i]);
if (node)

@ -54,6 +54,7 @@ public:
void changeShortcutmapperLang(ShortcutMapper * sm);
void changeStyleCtrlsLang(HWND hDlg, int *idArray, const char **translatedText);
void changeUserDefineLang(UserDefineDialog *userDefineDlg);
void changeUserDefineLangPopupDlg(HWND hDlg);
void changeFindReplaceDlgLang(FindReplaceDlg & findReplaceDlg);
void changePrefereceDlgLang(PreferenceDlg & preference);
bool isRTL() const {

Loading…
Cancel
Save