Make folding style visible using proper color

Fixes #2948, closes #2949
This commit is contained in:
SinghRajenM 2017-02-24 01:23:34 +05:30 committed by Don HO
parent 3c1a7dd436
commit b45b10385f
2 changed files with 28 additions and 20 deletions

View File

@ -2343,23 +2343,8 @@ void ScintillaEditView::performGlobalStyles()
execute(SCI_SETFOLDMARGINCOLOUR, true, foldMarginColor); execute(SCI_SETFOLDMARGINCOLOUR, true, foldMarginColor);
execute(SCI_SETFOLDMARGINHICOLOUR, true, foldMarginHiColor); execute(SCI_SETFOLDMARGINHICOLOUR, true, foldMarginHiColor);
COLORREF foldfgColor = white; COLORREF foldfgColor = white, foldbgColor = grey, activeFoldFgColor = red;
COLORREF foldbgColor = grey; getFoldColor(foldfgColor, foldbgColor, activeFoldFgColor);
i = stylers.getStylerIndexByName(TEXT("Fold"));
if (i != -1)
{
Style & style = stylers.getStyler(i);
foldfgColor = style._bgColor;
foldbgColor = style._fgColor;
}
COLORREF activeFoldFgColor = red;
i = stylers.getStylerIndexByName(TEXT("Fold active"));
if (i != -1)
{
Style & style = stylers.getStyler(i);
activeFoldFgColor = style._fgColor;
}
ScintillaViewParams & svp = (ScintillaViewParams &)_pParameter->getSVP(); ScintillaViewParams & svp = (ScintillaViewParams &)_pParameter->getSVP();
for (int j = 0 ; j < NB_FOLDER_STATE ; ++j) for (int j = 0 ; j < NB_FOLDER_STATE ; ++j)
@ -3368,3 +3353,23 @@ void ScintillaEditView::setBorderEdge(bool doWithBorderEdge)
::SetWindowLongPtr(_hSelf, GWL_EXSTYLE, exStyle); ::SetWindowLongPtr(_hSelf, GWL_EXSTYLE, exStyle);
::SetWindowPos(_hSelf, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); ::SetWindowPos(_hSelf, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
} }
void ScintillaEditView::getFoldColor(COLORREF& fgColor, COLORREF& bgColor, COLORREF& activeFgColor)
{
StyleArray & stylers = _pParameter->getMiscStylerArray();
int i = stylers.getStylerIndexByName(TEXT("Fold"));
if (i != -1)
{
Style & style = stylers.getStyler(i);
fgColor = style._bgColor;
bgColor = style._fgColor;
}
i = stylers.getStylerIndexByName(TEXT("Fold active"));
if (i != -1)
{
Style & style = stylers.getStyler(i);
activeFgColor = style._fgColor;
}
}

View File

@ -266,8 +266,6 @@ public:
void saveCurrentPos(); void saveCurrentPos();
void restoreCurrentPos(); void restoreCurrentPos();
void saveCurrentFold();
void restoreCurrentFold();
void beginOrEndSelect(); void beginOrEndSelect();
bool beginEndSelectedIsStarted() const { bool beginEndSelectedIsStarted() const {
@ -347,8 +345,12 @@ public:
{ {
display = true; display = true;
} }
COLORREF foldfgColor = white, foldbgColor = grey, activeFoldFgColor = red;
getFoldColor(foldfgColor, foldbgColor, activeFoldFgColor);
for (int i = 0 ; i < NB_FOLDER_STATE ; ++i) for (int i = 0 ; i < NB_FOLDER_STATE ; ++i)
defineMarker(_markersArray[FOLDER_TYPE][i], _markersArray[style][i], white, grey, white); defineMarker(_markersArray[FOLDER_TYPE][i], _markersArray[style][i], foldfgColor, foldbgColor, activeFoldFgColor);
showMargin(ScintillaEditView::_SC_MARGE_FOLDER, display); showMargin(ScintillaEditView::_SC_MARGE_FOLDER, display);
}; };
@ -943,5 +945,6 @@ protected:
std::pair<int, int> getWordRange(); std::pair<int, int> getWordRange();
bool expandWordSelection(); bool expandWordSelection();
void getFoldColor(COLORREF& fgColor, COLORREF& bgColor, COLORREF& activeFgColor);
}; };