diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index e0452e3b..0e1a06d0 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -5304,7 +5304,11 @@ void NppParameters::writeStyle2Element(Style & style2Write, Style & style2Sync, element->SetAttribute(TEXT("fontSize"), style2Write._fontSize); } - element->SetAttribute(TEXT("fontStyle"), style2Write._fontStyle); + if (style2Write._fontStyle != -1) + { + element->SetAttribute(TEXT("fontStyle"), style2Write._fontStyle); + } + if (style2Write._keywords) { @@ -5388,7 +5392,14 @@ void NppParameters::insertUserLang2Tree(TiXmlNode *node, UserLangContainer *user styleElement->SetAttribute(TEXT("fontName"), style2Write._fontName); } - styleElement->SetAttribute(TEXT("fontStyle"), style2Write._fontStyle); + if (style2Write._fontStyle == -1) + { + styleElement->SetAttribute(TEXT("fontStyle"), TEXT("0")); + } + else + { + styleElement->SetAttribute(TEXT("fontStyle"), style2Write._fontStyle); + } if (style2Write._fontSize != -1) { diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index ce26ecc2..46249f35 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -277,7 +277,7 @@ struct Style int _keywordClass; generic_string *_keywords; - Style():_styleID(-1), _styleDesc(NULL), _fgColor(COLORREF(-1)), _bgColor(COLORREF(-1)), _colorStyle(COLORSTYLE_ALL), _fontName(NULL), _fontStyle(FONTSTYLE_NONE), _fontSize(-1), _keywordClass(-1), _keywords(NULL), _nesting(0){}; + Style():_styleID(-1), _styleDesc(NULL), _fgColor(COLORREF(-1)), _bgColor(COLORREF(-1)), _colorStyle(COLORSTYLE_ALL), _fontName(NULL), _fontStyle(-1), _fontSize(-1), _keywordClass(-1), _keywords(NULL){}; ~Style(){ if (_keywords) diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 34fc2b94..c2142c73 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -489,8 +489,8 @@ void ScintillaEditView::setStyle(Style styleToSet) if (go.enableFontSize && (style._fontSize > 0)) styleToSet._fontSize = style._fontSize; - //if (style._fontStyle != -1) - //{ + if (style._fontStyle != -1) + { if (go.enableBold) { if (style._fontStyle & FONTSTYLE_BOLD) @@ -512,7 +512,7 @@ void ScintillaEditView::setStyle(Style styleToSet) else styleToSet._fontStyle &= ~FONTSTYLE_UNDERLINE; } - //} + } } } setSpecialStyle(styleToSet); diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp index f6af9232..e268903c 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp @@ -592,8 +592,8 @@ void WordStyleDlg::updateFontName() void WordStyleDlg::updateFontStyleStatus(fontStyleType whitchStyle) { Style & style = getCurrentStyler(); - //if (style._fontStyle == -1) - // style._fontStyle = 0; + if (style._fontStyle == -1) + style._fontStyle = 0; int fontStyle = FONTSTYLE_UNDERLINE; HWND hWnd = _hCheckUnderline; @@ -783,10 +783,10 @@ void WordStyleDlg::setVisualFromStyleList() ::SendMessage(_hFontSizeCombo, CB_SETCURSEL, iFontSize, 0); enableFontSize(isEnable); - //-- font style : bold et italic + //-- font style : bold & italic isEnable = false; int isBold, isItalic, isUnderline; - if (style._fontStyle != FONTSTYLE_NONE) + if (style._fontStyle != -1) { isBold = (style._fontStyle & FONTSTYLE_BOLD)?BST_CHECKED:BST_UNCHECKED; isItalic = (style._fontStyle & FONTSTYLE_ITALIC)?BST_CHECKED:BST_UNCHECKED; @@ -796,7 +796,7 @@ void WordStyleDlg::setVisualFromStyleList() ::SendMessage(_hCheckUnderline, BM_SETCHECK, isUnderline, 0); isEnable = true; } - else // -1 est comme 0 + else // -1 : reset them all { ::SendMessage(_hCheckBold, BM_SETCHECK, BST_UNCHECKED, 0); ::SendMessage(_hCheckItalic, BM_SETCHECK, BST_UNCHECKED, 0);