mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-22 21:34:58 +02:00
Make select text foreground color setting optional
Make selected text with syntax highlighting as default behaviour. To override the default behaviour, user can add an empty xml file named "enableSelectFgColor.xml" (beside of "config.xml") to set the select foreground color in Style Configurator.
This commit is contained in:
parent
44b2bef69b
commit
cd1a468b1c
@ -1440,18 +1440,17 @@ bool NppParameters::load()
|
||||
delete _pXmlExternalLexerDoc[i];
|
||||
}
|
||||
|
||||
//------------------------------//
|
||||
// blacklist.xml : for per user //
|
||||
//------------------------------//
|
||||
_blacklistPath = _userPath;
|
||||
PathAppend(_blacklistPath, TEXT("blacklist.xml"));
|
||||
//-------------------------------------------------------------//
|
||||
// enableSelectFgColor.xml : for per user //
|
||||
// This empty xmj file is optional - user adds this empty file //
|
||||
// manually in order to set selected text's foreground color. //
|
||||
//-------------------------------------------------------------//
|
||||
generic_string enableSelectFgColorPath = _userPath;
|
||||
PathAppend(enableSelectFgColorPath, TEXT("enableSelectFgColor.xml"));
|
||||
|
||||
if (PathFileExists(_blacklistPath.c_str()))
|
||||
if (PathFileExists(enableSelectFgColorPath.c_str()))
|
||||
{
|
||||
_pXmlBlacklistDoc = new TiXmlDocument(_blacklistPath);
|
||||
loadOkay = _pXmlBlacklistDoc->LoadFile();
|
||||
if (loadOkay)
|
||||
getBlackListFromXmlTree();
|
||||
_isSelectFgColorEnabled = true;
|
||||
}
|
||||
return isAllLaoded;
|
||||
}
|
||||
|
@ -1810,6 +1810,7 @@ public:
|
||||
void setAdminMode(bool isAdmin) { _isAdminMode = isAdmin; }
|
||||
bool isAdmin() const { return _isAdminMode; }
|
||||
bool regexBackward4PowerUser() const { return _findHistory._regexBackward4PowerUser; }
|
||||
bool isSelectFgColorEnabled() const { return _isSelectFgColorEnabled; };
|
||||
|
||||
private:
|
||||
bool _isAnyShortcutModified = false;
|
||||
@ -1837,7 +1838,6 @@ private:
|
||||
generic_string _shortcutsPath;
|
||||
generic_string _contextMenuPath;
|
||||
generic_string _sessionPath;
|
||||
generic_string _blacklistPath;
|
||||
generic_string _nppPath;
|
||||
generic_string _userPath;
|
||||
generic_string _stylerPath;
|
||||
@ -1873,6 +1873,8 @@ private:
|
||||
bool _isElevationRequired = false;
|
||||
bool _isAdminMode = false;
|
||||
|
||||
bool _isSelectFgColorEnabled = false;
|
||||
|
||||
public:
|
||||
generic_string getWingupFullPath() const { return _wingupFullPath; };
|
||||
generic_string getWingupParams() const { return _wingupParams; };
|
||||
|
@ -2557,7 +2557,8 @@ void ScintillaEditView::expand(size_t& line, bool doExpand, bool force, int visL
|
||||
|
||||
void ScintillaEditView::performGlobalStyles()
|
||||
{
|
||||
StyleArray & stylers = NppParameters::getInstance().getMiscStylerArray();
|
||||
NppParameters& nppParams = NppParameters::getInstance();
|
||||
StyleArray & stylers = nppParams.getMiscStylerArray();
|
||||
|
||||
int i = stylers.getStylerIndexByName(TEXT("Current line background colour"));
|
||||
if (i != -1)
|
||||
@ -2576,7 +2577,9 @@ void ScintillaEditView::performGlobalStyles()
|
||||
selectColorFore = style._fgColor;
|
||||
}
|
||||
execute(SCI_SETSELBACK, 1, selectColorBack);
|
||||
execute(SCI_SETSELFORE, 1, selectColorFore);
|
||||
|
||||
if (nppParams.isSelectFgColorEnabled())
|
||||
execute(SCI_SETSELFORE, 1, selectColorFore);
|
||||
|
||||
COLORREF caretColor = black;
|
||||
i = stylers.getStylerIndexByID(SCI_SETCARETFORE);
|
||||
@ -2640,7 +2643,7 @@ void ScintillaEditView::performGlobalStyles()
|
||||
COLORREF foldfgColor = white, foldbgColor = grey, activeFoldFgColor = red;
|
||||
getFoldColor(foldfgColor, foldbgColor, activeFoldFgColor);
|
||||
|
||||
ScintillaViewParams & svp = (ScintillaViewParams &)NppParameters::getInstance().getSVP();
|
||||
ScintillaViewParams & svp = (ScintillaViewParams &)nppParams.getSVP();
|
||||
for (int j = 0 ; j < NB_FOLDER_STATE ; ++j)
|
||||
defineMarker(_markersArray[FOLDER_TYPE][j], _markersArray[svp._folderStyle][j], foldfgColor, foldbgColor, activeFoldFgColor);
|
||||
|
||||
|
@ -751,6 +751,15 @@ void WordStyleDlg::setVisualFromStyleList()
|
||||
_pFgColour->setEnabled((style._colorStyle & COLORSTYLE_FOREGROUND) != 0);
|
||||
isEnable = true;
|
||||
}
|
||||
|
||||
// Selected text colour style
|
||||
if (style._styleDesc && lstrcmp(style._styleDesc, TEXT("Selected text colour")) == 0)
|
||||
{
|
||||
isEnable = false; // disable by default for "Selected text colour" style
|
||||
|
||||
if (NppParameters::getInstance().isSelectFgColorEnabled())
|
||||
isEnable = true;
|
||||
}
|
||||
enableFg(isEnable);
|
||||
|
||||
isEnable = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user