From 9128785e176594bfdebc2c359051a06a89263c98 Mon Sep 17 00:00:00 2001 From: donho Date: Wed, 29 Aug 2007 17:48:03 +0000 Subject: [PATCH] [BUG_FIXED] Fix the bold/italic/underline refresh problem in Stylers Configurator for Scintilla component. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@18 f5eea248-9336-0410-98b8-ebc06183d4e3 --- .../ScitillaComponent/ScintillaEditView.cpp | 47 ++++++++----------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 0dd8a173f..324c30431 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -165,14 +165,11 @@ void ScintillaEditView::setSpecialStyle(int styleID, COLORREF fgColour, COLORREF if ((!fontName)||(strcmp(fontName, ""))) execute(SCI_STYLESETFONT, (WPARAM)styleID, (LPARAM)fontName); - if ((fontStyle != -1) && (fontStyle != 0)) + if (fontStyle != -1) { - if (fontStyle & FONTSTYLE_BOLD) - execute(SCI_STYLESETBOLD, (WPARAM)styleID, (LPARAM)true); - if (fontStyle & FONTSTYLE_ITALIC) - execute(SCI_STYLESETITALIC, (WPARAM)styleID, (LPARAM)true); - if (fontStyle & FONTSTYLE_UNDERLINE) - execute(SCI_STYLESETUNDERLINE, (WPARAM)styleID, (LPARAM)true); + execute(SCI_STYLESETBOLD, (WPARAM)styleID, fontStyle & FONTSTYLE_BOLD); + execute(SCI_STYLESETITALIC, (WPARAM)styleID, fontStyle & FONTSTYLE_ITALIC); + execute(SCI_STYLESETUNDERLINE, (WPARAM)styleID, fontStyle & FONTSTYLE_UNDERLINE); } if (fontSize > 0) @@ -205,31 +202,26 @@ void ScintillaEditView::setStyle(int styleID, COLORREF fgColour, COLORREF bgColo if (style._fontStyle != -1) { - if (go.enableBold && (style._fontStyle & FONTSTYLE_BOLD)) + if (go.enableBold) { - fontStyle |= FONTSTYLE_BOLD; + if (style._fontStyle & FONTSTYLE_BOLD) + fontStyle |= FONTSTYLE_BOLD; + else + fontStyle &= ~FONTSTYLE_BOLD; } - else - { - fontStyle &= ~FONTSTYLE_BOLD; - } - - if (go.enableItalic && (style._fontStyle & FONTSTYLE_ITALIC)) - { - fontStyle |= FONTSTYLE_ITALIC; - } - else + if (go.enableItalic) { - fontStyle &= ~FONTSTYLE_ITALIC; + if (style._fontStyle & FONTSTYLE_ITALIC) + fontStyle |= FONTSTYLE_ITALIC; + else + fontStyle &= ~FONTSTYLE_ITALIC; } - - if (go.enableUnderLine && (style._fontStyle & FONTSTYLE_UNDERLINE)) + if (go.enableUnderLine) { - fontStyle |= FONTSTYLE_UNDERLINE; - } - else - { - fontStyle &= ~FONTSTYLE_UNDERLINE; + if (style._fontStyle & FONTSTYLE_UNDERLINE) + fontStyle |= FONTSTYLE_UNDERLINE; + else + fontStyle &= ~FONTSTYLE_UNDERLINE; } } } @@ -265,7 +257,6 @@ void ScintillaEditView::setXmlLexer(LangType type) setPhpEmbeddedLexer(); setEmbeddedAspLexer(); } - } void ScintillaEditView::setEmbeddedJSLexer()