[ENHANCEMENT] Enhance the localization system - no need to update nativeLang.xml if menu sub-entries are moved.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@950 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
75ccf352d4
commit
caaaef7c26
@ -20,44 +20,82 @@
|
|||||||
</Entries>
|
</Entries>
|
||||||
<!-- Sub Menu Entries -->
|
<!-- Sub Menu Entries -->
|
||||||
<SubEntries>
|
<SubEntries>
|
||||||
<Item posX="0" posY="19" name="Fichiers récents"/>
|
<!--Item posX="0" posY="19" name="Fichiers récents"/-->
|
||||||
<Item posX="1" posY="9" name="Copier dans le presse-papiers"/>
|
<Item subMenuId="file-recentFiles" name="Fichiers récents"/>
|
||||||
<Item posX="1" posY="10" name="Indentation"/>
|
<!--Item posX="1" posY="9" name="Copier dans le presse-papiers"/-->
|
||||||
<Item posX="1" posY="11" name="MAJUSCULE/minuscule"/>
|
<Item subMenuId="edit-copyToClipboard" name="Copier dans le presse-papiers"/>
|
||||||
<Item posX="1" posY="12" name="Ligne"/>
|
<!--Item posX="1" posY="10" name="Indentation"/-->
|
||||||
<Item posX="1" posY="13" name="Commentaire"/>
|
<Item subMenuId="edit-indent" name="Indentation"/>
|
||||||
<Item posX="1" posY="14" name="Autocomplétion"/>
|
<!--Item posX="1" posY="11" name="MAJUSCULE/minuscule"/-->
|
||||||
<Item posX="1" posY="15" name="Convertir les sauts de ligne"/>
|
<Item subMenuId="edit-convertCaseTo" name="MAJUSCULE/minuscule"/>
|
||||||
<Item posX="1" posY="16" name="Traitement des espacements"/>
|
<!--Item posX="1" posY="12" name="Ligne"/-->
|
||||||
<Item posX="1" posY="17" name="Collage spécial"/>
|
<Item subMenuId="edit-lineOperations" name="Ligne"/>
|
||||||
<Item posX="2" posY="16" name="Marquer tout"/>
|
<!--Item posX="1" posY="13" name="Commentaire"/-->
|
||||||
<Item posX="2" posY="17" name="Enlever toutes les marques"/>
|
<Item subMenuId="edit-comment" name="Commentaire"/>
|
||||||
<Item posX="2" posY="18" name="Aller vers le haut"/>
|
<!--Item posX="1" posY="14" name="Autocomplétion"/-->
|
||||||
<Item posX="2" posY="19" name="Aller vers le bas"/>
|
<Item subMenuId="edit-autoCompletion" name="Autocomplétion"/>
|
||||||
<Item posX="2" posY="21" name="Signet"/>
|
<!--Item posX="1" posY="15" name="Convertir les sauts de ligne"/-->
|
||||||
<Item posX="3" posY="4" name="Symboles spéciaux"/>
|
<Item subMenuId="edit-eolConversion" name="Convertir les sauts de ligne"/>
|
||||||
<Item posX="3" posY="5" name="Zoom"/>
|
<!--Item posX="1" posY="16" name="Traitement des espacements"/-->
|
||||||
<Item posX="3" posY="6" name="Déplacer/Cloner le document actuel"/>
|
<Item subMenuId="edit-blankOperations" name="Traitement des espacements"/>
|
||||||
<Item posX="3" posY="16" name="Replier le niveau"/>
|
<!--Item posX="1" posY="17" name="Collage spécial"/-->
|
||||||
<Item posX="3" posY="17" name="Déplier le niveau"/>
|
<Item subMenuId="edit-pasteSpecial" name="Collage spécial"/>
|
||||||
<Item posX="3" posY="21" name="Projet"/>
|
<!--Item posX="2" posY="16" name="Marquer tout"/-->
|
||||||
<Item posX="4" posY="5" name="Codage de caractères"/>
|
<Item subMenuId="search-markAll" name="Marquer tout"/>
|
||||||
<Item posX="4" posY="5" posZ="0" name="Arabe"/>
|
<!--Item posX="2" posY="17" name="Enlever toutes les marques"/-->
|
||||||
<Item posX="4" posY="5" posZ="1" name="Langues baltes"/>
|
<Item subMenuId="search-unmarkAll" name="Enlever toutes les marques"/>
|
||||||
<Item posX="4" posY="5" posZ="2" name="Langues celtiques"/>
|
<!--Item posX="2" posY="18" name="Aller vers le haut"/-->
|
||||||
<Item posX="4" posY="5" posZ="3" name="Cyrillique"/>
|
<Item subMenuId="search-jumpUp" name="Aller vers le haut"/>
|
||||||
<Item posX="4" posY="5" posZ="4" name="Langues d’Europe centrale"/>
|
<!--Item posX="2" posY="19" name="Aller vers le bas"/-->
|
||||||
<Item posX="4" posY="5" posZ="5" name="Chinois"/>
|
<Item subMenuId="search-jumpDown" name="Aller vers le bas"/>
|
||||||
<Item posX="4" posY="5" posZ="6" name="Langues d’Europe orientale"/>
|
<!--Item posX="2" posY="21" name="Signet"/-->
|
||||||
<Item posX="4" posY="5" posZ="7" name="Grec"/>
|
<Item subMenuId="search-bookmark" name="Signet"/>
|
||||||
<Item posX="4" posY="5" posZ="8" name="Hébreu"/>
|
<!--Item posX="3" posY="4" name="Symboles spéciaux"/-->
|
||||||
<Item posX="4" posY="5" posZ="9" name="Japonais"/>
|
<Item subMenuId="view-showSymbol" name="Symboles spéciaux"/>
|
||||||
<Item posX="4" posY="5" posZ="10" name="Coréen"/>
|
<!--Item posX="3" posY="5" name="Zoom"/-->
|
||||||
<Item posX="4" posY="5" posZ="11" name="Langues d’Europe du Nord"/>
|
<Item subMenuId="view-zoom" name="Zoom"/>
|
||||||
<Item posX="4" posY="5" posZ="12" name="Thaï"/>
|
<!--Item posX="3" posY="6" name="Déplacer/Cloner le document actuel"/-->
|
||||||
<Item posX="4" posY="5" posZ="13" name="Turc"/>
|
<Item subMenuId="view-moveCloneDocument" name="Déplacer/Cloner le document actuel"/>
|
||||||
<Item posX="4" posY="5" posZ="14" name="Langues d’Europe occidentale"/>
|
<!--Item posX="3" posY="16" name="Replier le niveau"/-->
|
||||||
<Item posX="4" posY="5" posZ="15" name="Vietnamien"/>
|
<Item subMenuId="view-collapsLevel" name="Replier le niveau"/>
|
||||||
|
<!--Item posX="3" posY="17" name="Déplier le niveau"/-->
|
||||||
|
<Item subMenuId="view-uncollapseLevel" name="Déplier le niveau"/>
|
||||||
|
<!--Item posX="3" posY="21" name="Projet"/-->
|
||||||
|
<Item subMenuId="view-project" name="Projet"/>
|
||||||
|
<!--Item posX="4" posY="5" name="Codage de caractères"/-->
|
||||||
|
<Item subMenuId="encoding-characterSets" name="Codage de caractères"/>
|
||||||
|
<!--Item posX="4" posY="5" posZ="0" name="Arabe"/-->
|
||||||
|
<Item subMenuId="encoding-arabic" name="Arabe"/>
|
||||||
|
<!--Item posX="4" posY="5" posZ="1" name="Langues baltes"/-->
|
||||||
|
<Item subMenuId="encoding-baltic" name="Langues baltes"/>
|
||||||
|
<!--Item posX="4" posY="5" posZ="2" name="Langues celtiques"/-->
|
||||||
|
<Item subMenuId="encoding-celtic" name="Langues celtiques"/>
|
||||||
|
<!--Item posX="4" posY="5" posZ="3" name="Cyrillique"/-->
|
||||||
|
<Item subMenuId="encoding-cyrillic" name="Cyrillique"/>
|
||||||
|
<!--Item posX="4" posY="5" posZ="4" name="Langues d’Europe centrale"/-->
|
||||||
|
<Item subMenuId="encoding-centralEuropean" name="Langues d’Europe centrale"/>
|
||||||
|
<!--Item posX="4" posY="5" posZ="5" name="Chinois"/-->
|
||||||
|
<Item subMenuId="encoding-chinese" name="Chinois"/>
|
||||||
|
<!--Item posX="4" posY="5" posZ="6" name="Langues d’Europe orientale"/-->
|
||||||
|
<Item subMenuId="encoding-easternEuropean" name="Langues d’Europe orientale"/>
|
||||||
|
<!--Item posX="4" posY="5" posZ="7" name="Grec"/-->
|
||||||
|
<Item subMenuId="encoding-greek" name="Grec"/>
|
||||||
|
<!--Item posX="4" posY="5" posZ="8" name="Hébreu"/-->
|
||||||
|
<Item subMenuId="encoding-hebrew" name="Hébreu"/>
|
||||||
|
<!--Item posX="4" posY="5" posZ="9" name="Japonais"/-->
|
||||||
|
<Item subMenuId="encoding-japanese" name="Japonais"/>
|
||||||
|
<!--Item posX="4" posY="5" posZ="10" name="Coréen"/-->
|
||||||
|
<Item subMenuId="encoding-korean" name="Coréen"/>
|
||||||
|
<!--Item posX="4" posY="5" posZ="11" name="Langues d’Europe du Nord"/-->
|
||||||
|
<Item subMenuId="encoding-northEuropean" name="Langues d’Europe du Nord"/>
|
||||||
|
<!--Item posX="4" posY="5" posZ="12" name="Thaï"/-->
|
||||||
|
<Item subMenuId="encoding-thai" name="Thaï"/>
|
||||||
|
<!--Item posX="4" posY="5" posZ="13" name="Turc"/-->
|
||||||
|
<Item subMenuId="encoding-turkish" name="Turc"/>
|
||||||
|
<!--Item posX="4" posY="5" posZ="14" name="Langues d’Europe occidentale"/-->
|
||||||
|
<Item subMenuId="encoding-westernEuropean" name="Langues d’Europe occidentale"/>
|
||||||
|
<!--Item posX="4" posY="5" posZ="15" name="Vietnamien"/-->
|
||||||
|
<Item subMenuId="encoding-vietnamese" name="Vietnamien"/>
|
||||||
<Item posX="6" posY="4" name="Importer"/>
|
<Item posX="6" posY="4" name="Importer"/>
|
||||||
</SubEntries>
|
</SubEntries>
|
||||||
<!-- all menu item -->
|
<!-- all menu item -->
|
||||||
|
@ -151,7 +151,74 @@ generic_string NativeLangSpeaker::getNativeLangMenuString(int itemID)
|
|||||||
return TEXT("");
|
return TEXT("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct MenuPosition {
|
||||||
|
int _x;
|
||||||
|
int _y;
|
||||||
|
int _z;
|
||||||
|
char _id[64];
|
||||||
|
//MenuPosition(): _x(-1), _y(-1), _z(-1){_id[0] = '\0';};
|
||||||
|
};
|
||||||
|
|
||||||
|
MenuPosition menuPos[] = {
|
||||||
|
//==============================================
|
||||||
|
// { x, y, z, id},
|
||||||
|
//==============================================
|
||||||
|
{ 0, 19, -1, "file-recentFiles"},
|
||||||
|
|
||||||
|
{ 1, 9, -1, "edit-copyToClipboard"},
|
||||||
|
{ 1, 10, -1, "edit-indent"},
|
||||||
|
{ 1, 11, -1, "edit-convertCaseTo"},
|
||||||
|
{ 1, 12, -1, "edit-lineOperations"},
|
||||||
|
{ 1, 13, -1, "edit-comment"},
|
||||||
|
{ 1, 14, -1, "edit-autoCompletion"},
|
||||||
|
{ 1, 15, -1, "edit-eolConversion"},
|
||||||
|
{ 1, 16, -1, "edit-blankOperations"},
|
||||||
|
{ 1, 17, -1, "edit-pasteSpecial"},
|
||||||
|
|
||||||
|
{ 2, 16, -1, "search-markAll"},
|
||||||
|
{ 2, 17, -1, "search-unmarkAll"},
|
||||||
|
{ 2, 18, -1, "search-jumpUp"},
|
||||||
|
{ 2, 19, -1, "search-jumpDown"},
|
||||||
|
{ 2, 21, -1, "search-bookmark"},
|
||||||
|
|
||||||
|
{ 3, 4, -1, "view-showSymbol"},
|
||||||
|
{ 3, 5, -1, "view-zoom"},
|
||||||
|
{ 3, 6, -1, "view-moveCloneDocument"},
|
||||||
|
{ 3, 16, -1, "view-collapsLevel"},
|
||||||
|
{ 3, 17, -1, "view-uncollapseLevel"},
|
||||||
|
{ 3, 21, -1, "view-project"},
|
||||||
|
|
||||||
|
{ 4, 5, -1, "encoding-characterSets"},
|
||||||
|
{ 4, 5, 0, "encoding-arabic"},
|
||||||
|
{ 4, 5, 1, "encoding-baltic"},
|
||||||
|
{ 4, 5, 2, "encoding-celtic"},
|
||||||
|
{ 4, 5, 3, "encoding-cyrillic"},
|
||||||
|
{ 4, 5, 4, "encoding-centralEuropean"},
|
||||||
|
{ 4, 5, 5, "encoding-chinese"},
|
||||||
|
{ 4, 5, 6, "encoding-easternEuropean"},
|
||||||
|
{ 4, 5, 7, "encoding-greek"},
|
||||||
|
{ 4, 5, 8, "encoding-hebrew"},
|
||||||
|
{ 4, 5, 9, "encoding-japanese"},
|
||||||
|
{ 4, 5, 10, "encoding-korean"},
|
||||||
|
{ 4, 5, 11, "encoding-northEuropean"},
|
||||||
|
{ 4, 5, 12, "encoding-thai"},
|
||||||
|
{ 4, 5, 13, "encoding-turkish"},
|
||||||
|
{ 4, 5, 14, "encoding-westernEuropean"},
|
||||||
|
{ 4, 5, 15, "encoding-vietnamese"},
|
||||||
|
{-1, -1, -1, ""} // End of array
|
||||||
|
};
|
||||||
|
|
||||||
|
MenuPosition & getMenuPosition(const char *id) {
|
||||||
|
|
||||||
|
int nbSubMenuPos = sizeof(menuPos)/sizeof(MenuPosition);
|
||||||
|
|
||||||
|
for(int i = 0; i < nbSubMenuPos; i++)
|
||||||
|
{
|
||||||
|
if (strcmp(menuPos[i]._id, id) == 0)
|
||||||
|
return menuPos[i];
|
||||||
|
}
|
||||||
|
return menuPos[nbSubMenuPos-1];
|
||||||
|
};
|
||||||
|
|
||||||
void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & pluginsTrans, generic_string & windowTrans)
|
void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & pluginsTrans, generic_string & windowTrans)
|
||||||
{
|
{
|
||||||
@ -239,12 +306,19 @@ void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & plugin
|
|||||||
{
|
{
|
||||||
TiXmlElementA *element = childNode->ToElement();
|
TiXmlElementA *element = childNode->ToElement();
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
const char *xStr = element->Attribute("posX", &x);
|
//const char *xStr = element->Attribute("posX", &x);
|
||||||
const char *yStr = element->Attribute("posY", &y);
|
//const char *yStr = element->Attribute("posY", &y);
|
||||||
|
const char *subMenuIdStr = element->Attribute("subMenuId");
|
||||||
const char *name = element->Attribute("name");
|
const char *name = element->Attribute("name");
|
||||||
if (!xStr || !yStr || !name)
|
|
||||||
|
if (!subMenuIdStr || !name)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
MenuPosition & menuPos = getMenuPosition(subMenuIdStr);
|
||||||
|
x = menuPos._x;
|
||||||
|
y = menuPos._y;
|
||||||
|
z = menuPos._z;
|
||||||
|
|
||||||
HMENU hSubMenu = ::GetSubMenu(menuHandle, x);
|
HMENU hSubMenu = ::GetSubMenu(menuHandle, x);
|
||||||
if (!hSubMenu)
|
if (!hSubMenu)
|
||||||
continue;
|
continue;
|
||||||
@ -255,8 +329,8 @@ void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & plugin
|
|||||||
HMENU hMenu = hSubMenu;
|
HMENU hMenu = hSubMenu;
|
||||||
int pos = y;
|
int pos = y;
|
||||||
|
|
||||||
const char *zStr = element->Attribute("posZ", &z);
|
//const char *zStr = element->Attribute("posZ", &z);
|
||||||
if (zStr)
|
if (z != -1)
|
||||||
{
|
{
|
||||||
HMENU hSubMenu3 = ::GetSubMenu(hSubMenu2, z);
|
HMENU hSubMenu3 = ::GetSubMenu(hSubMenu2, z);
|
||||||
if (!hSubMenu3)
|
if (!hSubMenu3)
|
||||||
|
Loading…
Reference in New Issue
Block a user