From 259a413babd628a6d0a66d2556340244ebf62e44 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Thu, 7 Jun 2018 16:22:00 +0200 Subject: [PATCH] + add: MUI aware strings for Schemes and Styles --- language/common_res.h | 10 ++++ language/np3_af_za/strings_af_za.rc | Bin 23614 -> 24746 bytes language/np3_de_de/lexer_de_de.rc | Bin 34822 -> 34830 bytes language/np3_de_de/strings_de_de.rc | Bin 26540 -> 27670 bytes language/np3_en_uk/strings_en_uk.rc | Bin 23650 -> 24786 bytes language/np3_en_us/strings_en_us.rc | Bin 23120 -> 24172 bytes language/np3_es_es/strings_es_es.rc | Bin 23696 -> 24832 bytes language/np3_fr_fr/strings_fr_fr.rc | Bin 23602 -> 24738 bytes language/np3_nl_nl/strings_nl_nl.rc | Bin 23104 -> 24682 bytes src/Notepad3.c | 4 +- src/Styles.c | 87 ++++++++++++++++++---------- src/Styles.h | 5 +- 12 files changed, 71 insertions(+), 35 deletions(-) diff --git a/language/common_res.h b/language/common_res.h index da982c2b4..c716ff538 100644 --- a/language/common_res.h +++ b/language/common_res.h @@ -110,6 +110,16 @@ #define IDS_MUI_PASS_FAILURE 15016 #define IDS_MUI_NOPASS 15017 #define IDS_MUI_CMDLINEHELP 15018 +#define IDS_MUI_STY_BASESTD 15019 +#define IDS_MUI_STY_BASE2ND 15020 +#define IDS_MUI_STY_LEXDEF 15021 +#define IDS_MUI_STY_LEXSTYLE 15022 +#define IDS_MUI_TITLE_RELBASE 15023 +#define IDS_MUI_TITLE_FIXBASE 15024 +#define IDS_MUI_TITLE_RELCUR 15025 +#define IDS_MUI_TITLE_FIXCUR 15026 +#define IDS_MUI_TITLE_RELARB 15027 +#define IDS_MUI_TITLE_FIXARB 15028 #define IDR_MAINWND 16000 #define IDR_MAINWND128 16001 diff --git a/language/np3_af_za/strings_af_za.rc b/language/np3_af_za/strings_af_za.rc index 11c13bffaa303264ac0cb872e2ed0ae55d9af0da..36f70197cabe6b9e4e956e42c2dd419a585ce9fb 100644 GIT binary patch delta 654 zcmaiwy-EW?6ot>WOSUmtw#*=eWU!FLE>$*vAcQ4L48t(P%st;Z_kO%PFQ3lqcSP&6jz7a3w}{b2h#3aF=jfB;`r5oG zG|$FJvLBWwZRkLSI}rvvr;|cv=F77W|7mv1MXOVl2pLTwU#uYbr l4Y~WSxL#UUJ0ZnW6Goj`fAq|h)H|nC4^tkg-@c-y_XG7ZYfS(E delta 18 acmZ2=ka6D*#tonRCO4?MY+e-1!3zLZy9f;c diff --git a/language/np3_de_de/lexer_de_de.rc b/language/np3_de_de/lexer_de_de.rc index 8a5b45b99c6b22e4c776150f4f4f0b0ac185fc1d..829f668a211706b2785571b4e840adbabe054c1a 100644 GIT binary patch delta 97 zcmZphz|=Q^X+sCspAw42W)G%<}=dDT2WTNV-kF z$R)0<%23Q;1+^W!eq`4`bc6jkSTx+7%D)+2o@qBvov9{7^b)ZO^kq delta 14 WcmbPsgK^Dy#tmH&o4>>;@dE%h)dsQv diff --git a/language/np3_en_uk/strings_en_uk.rc b/language/np3_en_uk/strings_en_uk.rc index 8304c24d961799f586887ec4bc62ab1c9c359f39..cc75f602ff69651f691f533260095949c2270c6a 100644 GIT binary patch delta 670 zcma))!D_-l5QhI;#S~f%(q3ExQiF#=ym?crAV@75K~F)bJrzM}4}Fe#kwP!M_7U1g z=o|D6oXNV`4MHi)vP*XU@1Oa}&xiN@>AfY>${Yz+NYO_Ra}0SW)TjpSF#n>^!Ywv< z#2PPn!XApN_ITy{1`)cn3mWG|N{l<9bc&Q1TRgD(zqASWv*hX_Mzkx{noT^T%lf|v zZZ}$=O-NrC!DR>`T=N!&ok28p+Ez=06f<_4II~NoSs~xr*-}nLE2Bo{&9FKtMi_Jd zCRsz#r?BkHkzusH>0^KeX0$F>BI|5Ykkg&wSm7|Vf6l0>tW!y_prv0wp!=(`B#=Az oIElVE-&kjxnBo+5mhyMV?PPu?Y5$y5FLrxEATM6MC(|?k09L?p0{{R3 delta 14 Wcmca~knzzD#tk98+ngW&s=~s^jy4(}!2Uv(hY*hlPL5KkLO%8NZp6npP delta 18 acmaE}hw;J|#tk2QCN~JVYz_#N;ROI%3kU%K diff --git a/language/np3_es_es/strings_es_es.rc b/language/np3_es_es/strings_es_es.rc index 97d3f60147a41f50674d1485bc02513b4825d094..63fe177b91c6ddc4b7c356d5a044e4130f6b0171 100644 GIT binary patch delta 704 zcmaiwL2AN46o!Adg3uxwx^l3l8eA0J)t%Nz3$}q6L03|!u7aD|MOXC*%ABA#D7bRl z8}ta?r0-3d%xFXzCNm`Oefi$M+GdtNneWgm3=m+92|8$F0GD=vu3TpePW(oohAyU< z;RWvqv4Ehe1wQCLg@cy-EtXQ8CY~cs!{jtE$1C-p<>h0qJ~@r3-bGLDvX*V*4J{&^ zVkn~ng5t@~8_Qxsl{Pc<9IEFjz$4Ai|D3?5XFth>tMw|=y{?upDr#W16My4e?o48j z=p&neb`O^k2aqd!)!CAzcaO&8Z#`Qk{`Q mo3iP!!>xAENeW7rIaT5vN#ux0!Yl3Dr#SM<9&bXglKTUqd3FE* delta 14 VcmZoT#5iFm^9Pk_FFIJx>H zhBxuvul-s}6HW7_|L*zSbI!+S<@Kxb9*pe?rkG)l0YXeLoR-^=Yz>?Mf(lS>uJG$lhAtDM7T+hQJ`b_wX zq5U|*9(w58ktNv#T9(n9 zotgLh|KHou!@GR*Azz6)5px!C)mg%-a}1g&;bR)piXE#WkC3Z~Syu@!JT}~?xuRHm zAK;!ciJDu%UU#12IJB@A>+UjQY7GswL>z$^YC*=Fr-bXCF=CXF@lN7~_Yx{88&uyE z4BsVe_$nCiUx(&Yu;HKP8WP>l=uJQk6!DL6U@AZ)dcPSUhfZ-VSdp(o9y^YP9H<9N zSaB)%IatM89xts;y{a*K@O9`SR2NwZ&7!0@NKVDgLyB4Nv2jehRLt#OmZ<09D(1sf z2dO*{-*U=yLiA$)o^EsLwe>E^sVFw{>Yj!j!Yxd-?=VM!sCuNf6;<4cOj=5&67AzM zMUC1qaPTRTkr0Z5elr@I=dW1aeu)2tqRdv!DHH8I{sLmeUcL}Qdi{s*VJuEY`i(gxn}Nq`zwycw8LB& zFgU(Du^0JwUdK_r3Zvkl&tx+jx}Re_<;Tj2#Vxm2WLz6;VAZdh#=8p~3#x*X5dr(D zdAa%RsUKzSO4MQIhRR%O4|xQZ)75J(hrCGY@QUpIgW)w97e{Vc)^IYjE@NQSzu0~0YjcHrsOvW01e;;QEX~fdQ5s_`gP%k&-dfREjAhsb zHp@O_pD}}dN*Cii{eDjK3oOobyr&=7!AP=VlabiYNV3c9Bg*|>mdEl_ATQ%|c9dno zT|JQq`-JI~{a^VVC(UfDmI+osTImk=GK+AKhQ;Xk*YT%+9|i+rWQLVVtrc>( zy_9uGKH9buF-eWL_FAmO49l`J_`Uw@b9-=xLYnp*!!#u?(U9vbXz^J z;`SQ0PPEjC(Nu3UdNk?N>ferBJaPrm9|*No)6|1uOZ8YswbLt&`q%8DbtkOZOO>~^ U+oXLvoxViCqrM5V|D4zTFJwk&SpWb4 delta 561 zcmX9)QAkr!80L&|+3xPWJL;VCQX(>!D3#2aWOLkftz7eVF&H9a$VFrf3E6{;7!f}7 zBtGmLArUeph7UsqCnWX|mmXqI5fNjA58+ct^wd*Cbawaf@$rBE_kaI?&ZR}Hx18K8H_;qk<9y0Kt3Mpfy823BX7C1q7*bFh&v4GMr=cK0?OGe5DatAn z6@ux>U#M#ei%flRuz%M-5%%?F!~q(%IHK^)lM<*;H^Wdm^IOuW~yUT5q hRz#LfN(6<6M+l_0v7dSZ$4Y@WP7&7MvGvDP{tpA~(H#H) diff --git a/src/Notepad3.c b/src/Notepad3.c index 1ff572767..b7dad8251 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -8127,9 +8127,9 @@ static void __fastcall _UpdateStatusbarDelayed(bool bForceRedraw) if (s_iCurLexer != iCurLexer) { if (Style_IsCurLexerStandard()) - Style_GetStdLexerName(tchLexerName, MINI_BUFFER); + Style_GetLexerDisplayName(NULL, tchLexerName, MINI_BUFFER); // don't distinguish between STD/2ND else - Style_GetCurrentLexerName(tchLexerName, MINI_BUFFER); + Style_GetLexerDisplayName(Style_GetCurrentLexerPtr(), tchLexerName, MINI_BUFFER); StringCchPrintf(tchStatusBar[STATUS_LEXER], txtWidth, L"%s%s", g_mxStatusBarPrefix[STATUS_LEXER], tchLexerName); s_iCurLexer = iCurLexer; diff --git a/src/Styles.c b/src/Styles.c index 88602689d..ff567a9a3 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -4275,8 +4275,8 @@ PEDITLEXER __fastcall Style_MatchLexer(LPCWSTR lpszMatch,bool bCheckNames) { WCHAR tch[COUNTOF(g_pLexArray[0]->szExtensions)] = { L'\0' }; WCHAR *p1,*p2; - if (!bCheckNames) { - + if (!bCheckNames) + { for (i = 0; i < COUNTOF(g_pLexArray); i++) { ZeroMemory(tch,sizeof(WCHAR)*COUNTOF(tch)); StringCchCopy(tch,COUNTOF(tch),g_pLexArray[i]->szExtensions); @@ -4294,12 +4294,9 @@ PEDITLEXER __fastcall Style_MatchLexer(LPCWSTR lpszMatch,bool bCheckNames) { } } } - else { - int cch = lstrlen(lpszMatch); if (cch >= 3) { - for (i = 0; i < COUNTOF(g_pLexArray); i++) { if (StrCmpNI(g_pLexArray[i]->pszName,lpszMatch,cch) == 0) return(g_pLexArray[i]); @@ -4548,13 +4545,18 @@ void Style_ToggleUse2ndDefault(HWND hwnd) void Style_SetDefaultFont(HWND hwnd, bool bGlobalDefault) { WCHAR newStyle[BUFSIZE_STYLE_VALUE] = { L'\0' }; + WCHAR lexerName[BUFSIZE_STYLE_VALUE] = { L'\0' }; + WCHAR styleName[BUFSIZE_STYLE_VALUE] = { L'\0' }; PEDITLEXER const pLexer = bGlobalDefault ? GetCurrentStdLexer() : g_pLexCurrent; PEDITSTYLE const pLexerDefStyle = &(pLexer->Styles[STY_DEFAULT]); StringCchCopyW(newStyle, COUNTOF(newStyle), pLexer->Styles[STY_DEFAULT].szValue); - if (Style_SelectFont(hwnd, newStyle, COUNTOF(newStyle), pLexer->pszName, pLexer->Styles[STY_DEFAULT].pszName, + GetLngString(pLexer->resID, lexerName, COUNTOF(lexerName)); + GetLngString(pLexer->Styles[STY_DEFAULT].rid, styleName, COUNTOF(styleName)); + + if (Style_SelectFont(hwnd, newStyle, COUNTOF(newStyle), lexerName, styleName, IsStyleStandardDefault(pLexerDefStyle), IsStyleSchemeDefault(pLexerDefStyle), false, true)) { // set new styles to current lexer's default text @@ -5291,21 +5293,21 @@ bool Style_SelectFont(HWND hwnd,LPWSTR lpszStyle,int cchStyle, LPCWSTR sLexerNam if (bGlobalDefaultStyle) { if (bRelFontSize) - StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" +++ BASE (%s) +++", sStyleName); + FormatLngString(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_RELBASE, sStyleName); else - StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" BASE (%s)", sStyleName); + FormatLngString(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_FIXBASE, sStyleName); } else if (bCurrentDefaultStyle) { if (bRelFontSize) - StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" +++ %s: %s Style +++", sLexerName, sStyleName); + FormatLngString(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_RELCUR, sLexerName, sStyleName); else - StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" %s: %s Style", sLexerName, sStyleName); + FormatLngString(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_FIXCUR, sLexerName, sStyleName); } else { if (bRelFontSize) - StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" +++ Style '%s' (%s) +++", sStyleName, sLexerName); + FormatLngString(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_RELARB, sStyleName, sLexerName); else - StringCchPrintfW(FontSelTitle, COUNTOF(FontSelTitle), L" Style '%s' (%s)", sStyleName, sLexerName); + FormatLngString(FontSelTitle, COUNTOF(FontSelTitle), IDS_MUI_TITLE_FIXARB, sStyleName, sLexerName); } if (bWithEffects) @@ -5719,6 +5721,16 @@ void Style_SetStyles(HWND hwnd, int iStyle, LPCWSTR lpszStyle, bool bInitDefault } +//============================================================================= +// +// Style_GetCurrentLexerPtr() +// +PEDITLEXER Style_GetCurrentLexerPtr() +{ + return g_pLexCurrent; +} + + //============================================================================= // // Style_GetCurrentLexerRID() @@ -5731,24 +5743,30 @@ int Style_GetCurrentLexerRID() //============================================================================= // -// Style_GetCurrentLexerName() +// Style_GetLexerDisplayName() // -void Style_GetCurrentLexerName(LPWSTR lpszName, int cchName) +void Style_GetLexerDisplayName(PEDITLEXER pLexer, LPWSTR lpszName, int cchName) { - if (!GetLngString(g_pLexCurrent->resID, lpszName, cchName)) { - StringCchCopyW(lpszName, cchName, g_pLexCurrent->pszName); + if (!pLexer) { + //pLexer = Style_GetUse2ndDefault() ? &lexStandard2nd : &lexStandard; + pLexer = &lexStandard; // don't distinguish between STD/2ND + } + if (!GetLngString(pLexer->resID, lpszName, cchName)) { + StringCchCopyW(lpszName, cchName, pLexer->pszName); } } //============================================================================= // -// Style_GetStdLexerName() +// Style_GetStyleDisplayName() // -void Style_GetStdLexerName(LPWSTR lpszName, int cchName) +void Style_GetStyleDisplayName(PEDITSTYLE pStyle, LPWSTR lpszName, int cchName) { - if (!GetLngString(lexStandard.resID, lpszName, cchName)) { - StringCchCopyW(lpszName, cchName, lexStandard.pszName); + if (pStyle) { + if (!GetLngString(pStyle->rid, lpszName, cchName)) { + StringCchCopyW(lpszName, cchName, pStyle->pszName); + } } } @@ -5908,7 +5926,6 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam // findlexer int found = -1; for (int i = 0; i < COUNTOF(g_pLexArray); ++i) { - //if (StringCchCompareX(g_pLexArray[i]->pszName, g_pLexCurrent->pszName) == 0) { if (g_pLexArray[i] == g_pLexCurrent) { found = i; break; @@ -6055,6 +6072,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam APPLY_DIALOG_ITEM_TEXT; } + WCHAR name[80] = { L'\0' }; WCHAR label[128] = { L'\0' }; //DialogEnableWindow(hwnd, IDC_STYLEEDIT, true); @@ -6081,16 +6099,18 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam pCurrentStyle = &(pCurrentLexer->Styles[STY_DEFAULT]); if (pCurrentStyle->rid == IDS_LEX_STD_STYLE) { - StringCchCopyW(label, COUNTOF(label), L"BASE (Default Style):"); + GetLngString(IDS_MUI_STY_BASESTD, label, COUNTOF(label)); } else { - StringCchCopyW(label, COUNTOF(label), L"BASE (2nd Default Style):"); + GetLngString(IDS_MUI_STY_BASE2ND, label, COUNTOF(label)); DialogEnableWindow(hwnd, IDC_STYLEEDIT_ROOT, false); } } else { pCurrentStyle = &(pCurrentLexer->Styles[STY_DEFAULT]); - StringCchPrintfW(label, COUNTOF(label), L"%s: Default style:", pCurrentLexer->pszName); + GetLngString(pCurrentLexer->resID, name, COUNTOF(name)); + + StringCchPrintfW(label, COUNTOF(label), L"%s: Default Style:", name); } SetDlgItemText(hwnd, IDC_STYLELABEL, label); SetDlgItemText(hwnd, IDC_STYLEEDIT, pCurrentStyle->szValue); @@ -6110,12 +6130,13 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam if (IsLexerStandard(pCurrentLexer)) { if (pCurrentLexer->Styles[STY_DEFAULT].rid == IDS_LEX_STD_STYLE) - StringCchCopyW(label, COUNTOF(label), L"BASE (Default Style):"); + GetLngString(IDS_MUI_STY_BASESTD, label, COUNTOF(label)); else - StringCchCopyW(label, COUNTOF(label), L"BASE (2nd Default Style):"); + GetLngString(IDS_MUI_STY_BASE2ND, label, COUNTOF(label)); } else { - StringCchPrintfW(label, COUNTOF(label), L"%s: Default style:", pCurrentLexer->pszName); + GetLngString(pCurrentLexer->resID, name, COUNTOF(name)); + FormatLngString(label, COUNTOF(label), IDS_MUI_STY_LEXDEF, name); } SetDlgItemText(hwnd, IDC_STYLELABEL_ROOT, label); @@ -6127,7 +6148,8 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam if (pCurrentStyle) { bIsStyleSelected = true; - StringCchPrintfW(label, COUNTOF(label), L"%s's style:", pCurrentStyle->pszName); + GetLngString(pCurrentStyle->rid, name, COUNTOF(name)); + FormatLngString(label, COUNTOF(label), IDS_MUI_STY_LEXSTYLE, name); SetDlgItemText(hwnd, IDC_STYLELABEL, label); SetDlgItemText(hwnd, IDC_STYLEEDIT, pCurrentStyle->szValue); } @@ -6298,9 +6320,12 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam case IDC_STYLEFONT: if (pCurrentStyle) { WCHAR tch[BUFSIZE_STYLE_VALUE] = { L'\0' }; + WCHAR lexerName[BUFSIZE_STYLE_VALUE] = { L'\0' }; + WCHAR styleName[BUFSIZE_STYLE_VALUE] = { L'\0' }; GetDlgItemText(hwnd, IDC_STYLEEDIT, tch, COUNTOF(tch)); - - if (Style_SelectFont(hwnd, tch, COUNTOF(tch), pCurrentLexer->pszName, pCurrentStyle->pszName, + GetLngString(pCurrentLexer->resID, lexerName, COUNTOF(lexerName)); + GetLngString(pCurrentStyle->rid, styleName, COUNTOF(styleName)); + if (Style_SelectFont(hwnd, tch, COUNTOF(tch), lexerName, styleName, IsStyleStandardDefault(pCurrentStyle), IsStyleSchemeDefault(pCurrentStyle), false, true)) { SetDlgItemText(hwnd, IDC_STYLEEDIT, tch); } @@ -6564,7 +6589,7 @@ INT_PTR CALLBACK Style_SelectLexerDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPAR for (int i = 0; i < lvItems; i++) { lvi.iItem = i; ListView_GetItem(hwndLV,&lvi); - if (StringCchCompareX(((PEDITLEXER)lvi.lParam)->pszName, g_pLexCurrent->pszName) == 0) + if (((PEDITLEXER)lvi.lParam)->lexerID == g_pLexCurrent->lexerID) { ListView_SetItemState(hwndLV,i,LVIS_FOCUSED|LVIS_SELECTED,LVIS_FOCUSED|LVIS_SELECTED); ListView_EnsureVisible(hwndLV,i,false); diff --git a/src/Styles.h b/src/Styles.h index 00850b1fc..febf29687 100644 --- a/src/Styles.h +++ b/src/Styles.h @@ -106,9 +106,10 @@ bool Style_SelectFont(HWND,LPWSTR,int,LPCWSTR,LPCWSTR,bool,bool,bool,bool); bool Style_SelectColor(HWND,bool,LPWSTR,int,bool); void Style_SetStyles(HWND,int,LPCWSTR,bool); bool Style_IsCurLexerStandard(); +PEDITLEXER Style_GetCurrentLexerPtr(); int Style_GetCurrentLexerRID(); -void Style_GetCurrentLexerName(LPWSTR,int); -void Style_GetStdLexerName(LPWSTR lpszName, int cchName); +void Style_GetLexerDisplayName(PEDITLEXER pLexer, LPWSTR lpszName, int cchName); +void Style_GetStyleDisplayName(PEDITSTYLE pStyle, LPWSTR lpszName, int cchName); int Style_GetLexerIconId(PEDITLEXER); bool Style_HasLexerForExt(LPCWSTR); HTREEITEM Style_AddLexerToTreeView(HWND,PEDITLEXER);