[NEW_FEATURE] Global override feature is available.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@17 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2007-08-28 23:03:17 +00:00
parent 1d523a9125
commit f72f29ac58
3 changed files with 42 additions and 13 deletions

View File

@ -205,17 +205,31 @@ void ScintillaEditView::setStyle(int styleID, COLORREF fgColour, COLORREF bgColo
if (style._fontStyle != -1)
{
if (go.enableBold)
if (go.enableBold && (style._fontStyle & FONTSTYLE_BOLD))
{
fontStyle |= (style._fontStyle & FONTSTYLE_BOLD)?FONTSTYLE_BOLD:~FONTSTYLE_BOLD;
fontStyle |= FONTSTYLE_BOLD;
}
if (go.enableItalic)
else
{
fontStyle |= (style._fontStyle & FONTSTYLE_ITALIC)?FONTSTYLE_ITALIC:~FONTSTYLE_ITALIC;
fontStyle &= ~FONTSTYLE_BOLD;
}
if (go.enableUnderLine)
if (go.enableItalic && (style._fontStyle & FONTSTYLE_ITALIC))
{
fontStyle |= (style._fontStyle & FONTSTYLE_UNDERLINE)?FONTSTYLE_UNDERLINE:~FONTSTYLE_UNDERLINE;
fontStyle |= FONTSTYLE_ITALIC;
}
else
{
fontStyle &= ~FONTSTYLE_ITALIC;
}
if (go.enableUnderLine && (style._fontStyle & FONTSTYLE_UNDERLINE))
{
fontStyle |= FONTSTYLE_UNDERLINE;
}
else
{
fontStyle &= ~FONTSTYLE_UNDERLINE;
}
}
}

View File

@ -129,6 +129,14 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
enableDlgTheme(_hSelf, ETDT_ENABLETAB);
redraw();
}
const NppGUI & nppGUI = pNppParam->getNppGUI();
::SendDlgItemMessage(_hSelf, IDC_GLOBAL_FG_CHECK, BM_SETCHECK, nppGUI._globalOverride.enableFg, 0);
::SendDlgItemMessage(_hSelf, IDC_GLOBAL_BG_CHECK, BM_SETCHECK, nppGUI._globalOverride.enableBg, 0);
::SendDlgItemMessage(_hSelf, IDC_GLOBAL_FONT_CHECK, BM_SETCHECK, nppGUI._globalOverride.enableFont, 0);
::SendDlgItemMessage(_hSelf, IDC_GLOBAL_FONTSIZE_CHECK, BM_SETCHECK, nppGUI._globalOverride.enableFontSize, 0);
::SendDlgItemMessage(_hSelf, IDC_GLOBAL_BOLD_CHECK, BM_SETCHECK, nppGUI._globalOverride.enableBold, 0);
::SendDlgItemMessage(_hSelf, IDC_GLOBAL_ITALIC_CHECK, BM_SETCHECK, nppGUI._globalOverride.enableItalic, 0);
::SendDlgItemMessage(_hSelf, IDC_GLOBAL_UNDERLINE_CHECK, BM_SETCHECK, nppGUI._globalOverride.enableUnderLine, 0);
goToCenter();
return TRUE;
@ -243,9 +251,9 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
case IDC_GLOBAL_FG_CHECK :
{
GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle();
glo.enableFg = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0));
notifyDataModified();
return TRUE;
}
@ -253,6 +261,7 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
{
GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle();
glo.enableBg = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0));
notifyDataModified();
return TRUE;
}
@ -260,18 +269,21 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
{
GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle();
glo.enableFont = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0));
notifyDataModified();
return TRUE;
}
case IDC_GLOBAL_FONTSIZE_CHECK :
{
GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle();
glo.enableFontSize = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0));
notifyDataModified();
return TRUE;
}
case IDC_GLOBAL_BOLD_CHECK :
{
GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle();
glo.enableBold = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0));
notifyDataModified();
return TRUE;
}
@ -279,12 +291,14 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
{
GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle();
glo.enableItalic = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0));
notifyDataModified();
return TRUE;
}
case IDC_GLOBAL_UNDERLINE_CHECK :
{
GlobalOverride & glo = (NppParameters::getInstance())->getGlobalOverrideStyle();
glo.enableUnderLine = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, wParam, BM_GETCHECK, 0, 0));
notifyDataModified();
return TRUE;
}
@ -494,12 +508,12 @@ void WordStyleDlg::setVisualFromStyleList()
}
//--Warning text
bool showWarning = ((_currentLexerIndex == 0) && (style._styleID == STYLE_DEFAULT));//?SW_SHOW:SW_HIDE;
//bool showWarning = ((_currentLexerIndex == 0) && (style._styleID == STYLE_DEFAULT));//?SW_SHOW:SW_HIDE;
COLORREF c = RGB(0xFF, 0x00, 0x00);
char str[256];
strcpy(str, _originalWarning);
if (!showWarning)
//if (!showWarning)
{
if (!_originalWarning[0])
// Get the original text for the usage afterward
@ -520,14 +534,15 @@ void WordStyleDlg::setVisualFromStyleList()
strcat(strcat(str, " : "), styleName);
}
else
/*else
{
if (!str[0])
{
::GetWindowText(_hStyleInfoStaticText, _originalWarning, sizeof(_originalWarning));
strcpy(str, _originalWarning);
}
}
}*/
// PAD for fix a display glitch
strcat(str, " ");
colourHooker.setColour(c);

View File

@ -691,8 +691,8 @@
</LexerStyles>
<GlobalStyles>
<!-- Attention : Don't modify the name of styleID="0" -->
<WidgetStyle name="Global override" styleID="0" fgColor="FFFFFFFF" bgColor="000000" 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="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="12" />
<WidgetStyle name="Bad brace colour" styleID="35" fgColor="800000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />