Browse Source

Avoid user confusion between Global override & Default Styles

Fix #15640, close #15706
pull/15711/head
Don Ho 1 month ago
parent
commit
1890ea65f9
  1. 17
      PowerEditor/installer/nativeLang/english.xml
  2. 16
      PowerEditor/installer/nativeLang/english_customizable.xml
  3. 18
      PowerEditor/installer/nativeLang/french.xml
  4. 2
      PowerEditor/installer/nativeLang/taiwaneseMandarin.xml
  5. 17
      PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp
  6. 9
      PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h
  7. 19
      PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.rc
  8. 1
      PowerEditor/src/WinControls/ColourPicker/WordStyleDlgRes.h
  9. 2
      PowerEditor/src/stylers.model.xml

17
PowerEditor/installer/nativeLang/english.xml

@ -630,14 +630,15 @@ Translation note:
<Item id="2219" name="Default keywords"/>
<Item id="2221" name="User-defined keywords"/>
<Item id="2225" name="Language:"/>
<Item id="2226" name="Enable global foreground color"/>
<Item id="2227" name="Enable global background color"/>
<Item id="2228" name="Enable global font"/>
<Item id="2229" name="Enable global font size"/>
<Item id="2230" name="Enable global bold font style"/>
<Item id="2231" name="Enable global italic font style"/>
<Item id="2232" name="Enable global underline font style"/>
<Item id="2226" name="Force foreground color for all styles"/>
<Item id="2227" name="Force background color for all styles"/>
<Item id="2228" name="Force font choice for all styles"/>
<Item id="2229" name="Force font size choice for all styles"/>
<Item id="2230" name="Force bold choice for all styles"/>
<Item id="2231" name="Force italic choice for all styles"/>
<Item id="2232" name="Force underline choice for all styles"/>
<Item id="2234" name="Go to settings"/>
<Item id="2235" name="What is Global override?"/>
</SubDialog>
</StyleConfig>
@ -1819,6 +1820,8 @@ Click on &quot;?&quot; button on right to open website with User Manual."/>
C, C++, Java, C#, Objective-C, PHP, JavaScript, JSP, CSS, Perl, Rust, PowerShell and JSON.
If you select advanced mode but do not edit files in the aforementioned languages, the indentation will remain in basic mode."/>
<!-- Don't translate "&quot;Global override&quot; and &quot;Default Style&quot; -->
<global-override-tip value="Enabling &quot;Global override&quot; here will override that parameter in all language styles. What you probably really want is to use the &quot;Default Style&quot; settings instead"/>
</MiscStrings>
</Native-Langue>
</NotepadPlus>

16
PowerEditor/installer/nativeLang/english_customizable.xml

@ -630,14 +630,15 @@ Translation note:
<Item id="2219" name="Default keywords"/>
<Item id="2221" name="User-defined keywords"/>
<Item id="2225" name="Language:"/>
<Item id="2226" name="Enable global foreground color"/>
<Item id="2227" name="Enable global background color"/>
<Item id="2228" name="Enable global font"/>
<Item id="2229" name="Enable global font size"/>
<Item id="2230" name="Enable global bold font style"/>
<Item id="2231" name="Enable global italic font style"/>
<Item id="2232" name="Enable global underline font style"/>
<Item id="2226" name="Force foreground color for all styles"/>
<Item id="2227" name="Force background color for all styles"/>
<Item id="2228" name="Force font choice for all styles"/>
<Item id="2229" name="Force font size choice for all styles"/>
<Item id="2230" name="Force bold choice for all styles"/>
<Item id="2231" name="Force italic choice for all styles"/>
<Item id="2232" name="Force underline choice for all styles"/>
<Item id="2234" name="Go to settings"/>
<Item id="2235" name="What is Global override?"/>
</SubDialog>
</StyleConfig>
@ -1818,6 +1819,7 @@ Click on &quot;?&quot; button on right to open website with User Manual."/>
C, C++, Java, C#, Objective-C, PHP, JavaScript, JSP, CSS, Perl, Rust, PowerShell and JSON.
If you select advanced mode but do not edit files in the aforementioned languages, the indentation will remain in basic mode."/>
<global-override-tip value="Enabling &quot;Global override&quot; here will override that parameter in all language styles. What you probably really want is to use the &quot;Default Style&quot; settings instead"/>
</MiscStrings>
</Native-Langue>
</NotepadPlus>

18
PowerEditor/installer/nativeLang/french.xml

@ -630,14 +630,15 @@ Translation note:
<Item id="2219" name="Mots-clés prédéfinis"/>
<Item id="2221" name="Mots-clés utilisateur"/>
<Item id="2225" name="Langage :"/>
<Item id="2226" name="Appliquer le premier plan global"/>
<Item id="2227" name="Appliquer l’arrière-plan global"/>
<Item id="2228" name="Appliquer la police globale"/>
<Item id="2229" name="Appliquer la taille globale"/>
<Item id="2230" name="Appliquer le style gras global"/>
<Item id="2231" name="Appliquer le style italique global"/>
<Item id="2232" name="Appliquer le style souligné global"/>
<Item id="2234" name="Aller à la boîte de dialogue Préférences"/>
<Item id="2226" name="Forcer 1er plan pour tous les styles"/>
<Item id="2227" name="Forcer arrière-plan pour tous les styles"/>
<Item id="2228" name="Forcer police pour tous les styles"/>
<Item id="2229" name="Forcer taille pour tous les styles"/>
<Item id="2230" name="Forcer style gras pour tous les styles"/>
<Item id="2231" name="Forcer italique pour tous les styles"/>
<Item id="2232" name="Forcer souligné pour tous les styles"/>
<Item id="2234" name="Forcera boîte de dialogue Préférences"/>
<Item id="2235" name="C'est quoi « Global override » ?"/>
</SubDialog>
</StyleConfig>
@ -1813,6 +1814,7 @@ Cliquez sur le bouton « ? » à droite pour ouvrir le site web du manuel utilis
C, C++, Java, C#, Objective-C, PHP, JavaScript, JSP, CSS, Perl, Rust, PowerShell et JSON
Si vous sélectionnez le mode avancé sans modifier les fichiers des langues mentionnées ci-dessus, les paramètres d'indentation resteront en mode basique."/>
<global-override-tip value="Activer le « global override » ici substituera ces paramètres dans tous les styles pour tous les langages de programmation. Vous préférerez probablement utiliser les paramètres « Default Style » à la place"/>
</MiscStrings>
</Native-Langue>
</NotepadPlus>

2
PowerEditor/installer/nativeLang/taiwaneseMandarin.xml

@ -597,6 +597,7 @@
<Item id="2231" name="開啟共用斜體"/>
<Item id="2232" name="開啟共用底線"/>
<Item id="2234" name="至相關的偏好設定"/>
<Item id="2235" name="什麼是「Global override」?"/>
</SubDialog>
</StyleConfig>
<ShortcutMapper title="管理快捷鍵">
@ -1644,6 +1645,7 @@
C、C++、Java、C#、Objective-C、PHP、JavaScript、JSP、CSS、Perl、Rust、PowerShell 與 JSON
如果你選擇進階模式但不編輯上述語言文件,縮排設定將保留為基本模式。"/>
<global-override-tip value="此處啟用「Global override」將覆蓋所有語言樣式中的此些參數。你可能真正想要的是使用「Default Style」設置"/>
</MiscStrings>
</Native-Langue>
</NotepadPlus>

17
PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp

@ -124,7 +124,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
for (size_t i = 0 ; i < sizeof(fontSizeStrs)/(3*sizeof(wchar_t)) ; ++i)
::SendMessage(_hFontSizeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontSizeStrs[i]));
const std::vector<wstring> & fontlist = (NppParameters::getInstance()).getFontList();
const std::vector<wstring> & fontlist = nppParamInst.getFontList();
for (size_t i = 0, len = fontlist.size() ; i < len ; ++i)
{
auto j = ::SendMessage(_hFontNameCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontlist[i].c_str()));
@ -157,6 +157,18 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
std::pair<intptr_t, intptr_t> pageAndCtrlID = goToPreferencesSettings();
_goToSettings.display(pageAndCtrlID.first != -1);
HWND hWhatIsGlobalOverride = ::GetDlgItem(_hSelf, IDC_GLOBAL_WHATISGLOBALOVERRIDE_LINK);
_globalOverrideLinkTip.init(_hInst, _hSelf);
_globalOverrideLinkTip.create(hWhatIsGlobalOverride, L"");
const Style& style = getCurrentStyler();
bool showWhatIsGlobalOverride = (style._styleDesc == L"Global override");
_globalOverrideLinkTip.display(showWhatIsGlobalOverride);
NativeLangSpeaker* pNativeSpeaker = nppParamInst.getNativeLangSpeaker();
wstring globalOverrideTipStr = pNativeSpeaker->getLocalizedStrFromID("global-override-tip", L"Enabling \"Global override\" here will override that parameter in all language styles. What you probably really want is to use the \"Default Style\" settings instead");
_globalOverrideTip = CreateToolTip(IDC_GLOBAL_WHATISGLOBALOVERRIDE_LINK, _hSelf, _hInst, const_cast<PTSTR>(globalOverrideTipStr.c_str()), false);
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
goToCenter(SWP_SHOWWINDOW | SWP_NOSIZE);
@ -1085,7 +1097,7 @@ std::pair<intptr_t, intptr_t> WordStyleDlg::goToPreferencesSettings()
const Style& style = getCurrentStyler();
// Global override style
// Check if it's one of following Global Styles:
if (style._styleDesc == L"Current line background colour")
{
result.first = edit1;
@ -1472,5 +1484,6 @@ void WordStyleDlg::showGlobalOverrideCtrls(bool show)
::ShowWindow(::GetDlgItem(_hSelf, IDC_GLOBAL_BOLD_CHECK), show ? SW_SHOW : SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_GLOBAL_ITALIC_CHECK), show ? SW_SHOW : SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_GLOBAL_UNDERLINE_CHECK), show ? SW_SHOW : SW_HIDE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_GLOBAL_WHATISGLOBALOVERRIDE_LINK), show ? SW_SHOW : SW_HIDE);
_isShownGOCtrls = show;
}

9
PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.h

@ -71,6 +71,13 @@ class WordStyleDlg : public StaticDialog
{
public :
WordStyleDlg() = default;
~WordStyleDlg() {
_goToSettings.destroy();
_globalOverrideLinkTip.destroy();
if (_globalOverrideTip)
::DestroyWindow(_globalOverrideTip);
};
void create(int dialogID, bool isRTL = false, bool msgDestParent = true) override;
void doDialog(bool isRTL = false);
@ -104,6 +111,8 @@ private :
HWND _hStyleInfoStaticText = nullptr;
URLCtrl _goToSettings;
URLCtrl _globalOverrideLinkTip;
HWND _globalOverrideTip = nullptr;
LexerStylerArray _lsArray;
StyleArray _globalStyles;

19
PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.rc

@ -64,19 +64,20 @@ BEGIN
LTEXT "User-defined keywords",IDC_USER_KEYWORDS_STATIC,350,135,126,8
EDITTEXT IDC_USER_KEYWORDS_EDIT,347,146,136,52,ES_MULTILINE | WS_VSCROLL
CONTROL "Enable global foreground colour",IDC_GLOBAL_FG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,191,134,132,10
CONTROL "Enable global background colour",IDC_GLOBAL_BG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,191,149,131,10
CONTROL "Enable global font",IDC_GLOBAL_FONT_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,134,153,10
CONTROL "Enable global font size",IDC_GLOBAL_FONTSIZE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,149,135,10
CONTROL "Enable global bold font style",IDC_GLOBAL_BOLD_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,164,135,10
CONTROL "Enable global italic font style",IDC_GLOBAL_ITALIC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,179,135,10
CONTROL "Enable global underline font style",IDC_GLOBAL_UNDERLINE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,194,135,10
CONTROL "Force foreground color for all styles",IDC_GLOBAL_FG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,191,134,132,10
CONTROL "Force background color for all styles",IDC_GLOBAL_BG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,191,149,132,10
CONTROL "Force font choice for all styles",IDC_GLOBAL_FONT_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,134,153,10
CONTROL "Force font size choice for all styles",IDC_GLOBAL_FONTSIZE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,149,135,10
CONTROL "Force bold choice for all styles",IDC_GLOBAL_BOLD_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,164,135,10
CONTROL "Force italic choice for all styles",IDC_GLOBAL_ITALIC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,179,135,10
CONTROL "Force underline choice for all styles",IDC_GLOBAL_UNDERLINE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,194,135,10
LTEXT "Go to settings",IDC_GLOBAL_GOTOSETTINGS_LINK,210,153,131,10,WS_TABSTOP
LTEXT "What is Global override?",IDC_GLOBAL_WHATISGLOBALOVERRIDE_LINK,191,173,132,10,WS_TABSTOP
PUSHBUTTON "Save && Close",IDC_SAVECLOSE_BUTTON,264,222,69,14
PUSHBUTTON "Cancel",IDCANCEL,337,222,50,14
LTEXT "Go to settings",IDC_GLOBAL_GOTOSETTINGS_LINK,210,153,131,10,WS_TABSTOP
CONTROL "Transparency",IDC_SC_TRANSPARENT_CHECK,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,431,221,63,10
CONTROL "",IDC_SC_PERCENTAGE_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | TBS_TRANSPARENTBKGND | NOT WS_VISIBLE | WS_TABSTOP,441,235,53,10
END

1
PowerEditor/src/WinControls/ColourPicker/WordStyleDlgRes.h

@ -56,6 +56,7 @@
#define IDC_GLOBAL_UNDERLINE_CHECK (IDD_STYLER_DLG + 32)
#define IDC_STYLEDESCRIPTION_STATIC (IDD_STYLER_DLG + 33)
#define IDC_GLOBAL_GOTOSETTINGS_LINK (IDD_STYLER_DLG + 34)
#define IDC_GLOBAL_WHATISGLOBALOVERRIDE_LINK (IDD_STYLER_DLG + 35)
# define IDD_GLOBAL_STYLER_DLG 2300
#define IDC_SAVECLOSE_BUTTON (IDD_GLOBAL_STYLER_DLG + 1)

2
PowerEditor/src/stylers.model.xml

@ -1708,7 +1708,6 @@
</LexerStyles>
<GlobalStyles>
<!-- Attention : Don't modify the name of styleID="0" -->
<WidgetStyle name="Global override" styleID="0" fgColor="FFFF80" bgColor="FF8000" fontName="Courier New" fontStyle="0" fontSize="10" />
<WidgetStyle name="Default Style" styleID="32" fgColor="000000" bgColor="FFFFFF" fontName="Courier New" fontStyle="0" fontSize="10" />
<WidgetStyle name="Indent guideline style" styleID="37" fgColor="C0C0C0" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
<WidgetStyle name="Brace highlight style" styleID="34" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="10" />
@ -1762,5 +1761,6 @@
<WidgetStyle name="Document map" styleID="0" fgColor="FF8000" bgColor="FFFFFF" />
<WidgetStyle name="EOL custom color" styleID="0" fgColor="DADADA" />
<WidgetStyle name="Non-printing characters custom color" styleID="0" fgColor="FFB56A" />
<WidgetStyle name="Global override" styleID="0" fgColor="FFFF80" bgColor="FF8000" fontName="Courier New" fontStyle="0" fontSize="10" />
</GlobalStyles>
</NotepadPlus>

Loading…
Cancel
Save