[NEW_FEATURE] Global Override style - incomplete.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@14 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
dd759bfa42
commit
e34c53d63a
|
@ -275,6 +275,19 @@ struct Style
|
|||
};
|
||||
};
|
||||
|
||||
struct GlobalOverride
|
||||
{
|
||||
bool isEnable() const {return (enableFg || enableBg || enableFont || enableFontSize || enableBold || enableItalic || enableUnderLine);};
|
||||
bool enableFg;
|
||||
bool enableBg;
|
||||
bool enableFont;
|
||||
bool enableFontSize;
|
||||
bool enableBold;
|
||||
bool enableItalic;
|
||||
bool enableUnderLine;
|
||||
GlobalOverride():enableFg(false), enableBg(false), enableFont(false), enableFontSize(false), enableBold(false), enableItalic(false), enableUnderLine(false) {};
|
||||
};
|
||||
|
||||
const int MAX_STYLE = 30;
|
||||
|
||||
struct StyleArray
|
||||
|
@ -528,6 +541,7 @@ struct NppGUI
|
|||
bool _useDir;
|
||||
char _backupDir[MAX_PATH];
|
||||
DockingManagerData _dockingData;
|
||||
GlobalOverride _globalOverride;
|
||||
};
|
||||
|
||||
struct ScintillaViewParams
|
||||
|
@ -779,6 +793,7 @@ public:
|
|||
StyleArray & getGlobalStylers() {return _widgetStyleArray;};
|
||||
|
||||
StyleArray & getMiscStylerArray() {return _widgetStyleArray;};
|
||||
GlobalOverride & getGlobalOverrideStyle() {return _nppGUI._globalOverride;};
|
||||
|
||||
COLORREF getCurLineHilitingColour() {
|
||||
int i = _widgetStyleArray.getStylerIndexByName("Current line background colour");
|
||||
|
|
|
@ -1023,7 +1023,6 @@ int FindReplaceDlg::processAll(int op, bool isEntire, const char *fileName, cons
|
|||
ascii_to_utf8(fileName, fileNameLen, _uniFileName);
|
||||
*/
|
||||
pLine = _uniCharLine;
|
||||
//_pFinder->add(FoundInfo(start, end, _uniCharLine, _uniFileName, _pFinder->_lineCounter), lineNumber + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -154,8 +154,7 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
|
|||
}
|
||||
return ::CallWindowProc(_scintillaDefaultProc, hwnd, Message, wParam, lParam);
|
||||
}
|
||||
|
||||
void ScintillaEditView::setStyle(int styleID, COLORREF fgColour, COLORREF bgColour, const char *fontName, int fontStyle, int fontSize)
|
||||
void ScintillaEditView::setSpecialStyle(int styleID, COLORREF fgColour, COLORREF bgColour, const char *fontName, int fontStyle, int fontSize)
|
||||
{
|
||||
if (!((fgColour >> 24) & 0xFF))
|
||||
execute(SCI_STYLESETFORE, styleID, fgColour);
|
||||
|
@ -178,7 +177,50 @@ void ScintillaEditView::setStyle(int styleID, COLORREF fgColour, COLORREF bgColo
|
|||
|
||||
if (fontSize > 0)
|
||||
execute(SCI_STYLESETSIZE, styleID, fontSize);
|
||||
}
|
||||
|
||||
void ScintillaEditView::setStyle(int styleID, COLORREF fgColour, COLORREF bgColour, const char *fontName, int fontStyle, int fontSize)
|
||||
{
|
||||
GlobalOverride & go = _pParameter->getGlobalOverrideStyle();
|
||||
//go.enableBg = true;
|
||||
|
||||
const char *localFn = fontName;
|
||||
|
||||
if (go.isEnable())
|
||||
{
|
||||
StyleArray & stylers = _pParameter->getMiscStylerArray();
|
||||
int i = stylers.getStylerIndexByName("Global override");
|
||||
if (i != -1)
|
||||
{
|
||||
Style & style = stylers.getStyler(i);
|
||||
|
||||
if (go.enableFg)
|
||||
fgColour = style._fgColor;
|
||||
if (go.enableBg)
|
||||
bgColour = style._bgColor;
|
||||
if (go.enableFont && style._fontName && style._fontName[0])
|
||||
localFn = style._fontName;
|
||||
if (go.enableFontSize && (style._fontSize > 0))
|
||||
fontSize = style._fontSize;
|
||||
|
||||
if (style._fontStyle != -1)
|
||||
{
|
||||
if (go.enableBold)
|
||||
{
|
||||
fontStyle |= (style._fontStyle & FONTSTYLE_BOLD)?FONTSTYLE_BOLD:~FONTSTYLE_BOLD;
|
||||
}
|
||||
if (go.enableItalic)
|
||||
{
|
||||
fontStyle |= (style._fontStyle & FONTSTYLE_ITALIC)?FONTSTYLE_ITALIC:~FONTSTYLE_ITALIC;
|
||||
}
|
||||
if (go.enableUnderLine)
|
||||
{
|
||||
fontStyle |= (style._fontStyle & FONTSTYLE_UNDERLINE)?FONTSTYLE_UNDERLINE:~FONTSTYLE_UNDERLINE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
setSpecialStyle(styleID, fgColour, bgColour, localFn, fontStyle, fontSize);
|
||||
}
|
||||
|
||||
|
||||
|
@ -515,14 +557,14 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
|
|||
if (iFind != -1)
|
||||
{
|
||||
Style & styleFind = stylers.getStyler(iFind);
|
||||
setStyle(styleFind._styleID, styleFind._fgColor, styleFind._bgColor, styleFind._fontName, styleFind._fontStyle, styleFind._fontSize);
|
||||
setSpecialStyle(styleFind._styleID, styleFind._fgColor, styleFind._bgColor, styleFind._fontName, styleFind._fontStyle, styleFind._fontSize);
|
||||
}
|
||||
|
||||
iFind = stylers.getStylerIndexByID(SCE_UNIVERSAL_SELECT_STYLE);
|
||||
if (iFind != -1)
|
||||
{
|
||||
Style & styleFind = stylers.getStyler(iFind);
|
||||
setStyle(styleFind._styleID, styleFind._fgColor, styleFind._bgColor, styleFind._fontName, styleFind._fontStyle, styleFind._fontSize);
|
||||
setSpecialStyle(styleFind._styleID, styleFind._fgColor, styleFind._bgColor, styleFind._fontName, styleFind._fontStyle, styleFind._fontSize);
|
||||
}
|
||||
|
||||
int caretWidth = 1;
|
||||
|
@ -718,7 +760,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
|
|||
if (indexLineNumber != -1)
|
||||
{
|
||||
static Style & styleLN = stylers.getStyler(indexLineNumber);
|
||||
setStyle(styleLN._styleID, styleLN._fgColor, styleLN._bgColor, styleLN._fontName, styleLN._fontStyle, styleLN._fontSize);
|
||||
setSpecialStyle(styleLN._styleID, styleLN._fgColor, styleLN._bgColor, styleLN._fontName, styleLN._fontStyle, styleLN._fontSize);
|
||||
}
|
||||
|
||||
execute(SCI_SETTABWIDTH, ((NppParameters::getInstance())->getNppGUI())._tabSize);
|
||||
|
|
|
@ -621,6 +621,7 @@ protected:
|
|||
int _maxNbDigit; // For Line Number Marge
|
||||
|
||||
void setStyle(int styleID, COLORREF fgColor, COLORREF bgColor = -1, const char *fontName = NULL, int fontStyle = -1, int fontSize = 0);
|
||||
void setSpecialStyle(int styleID, COLORREF fgColor, COLORREF bgColor = -1, const char *fontName = NULL, int fontStyle = -1, int fontSize = 0);
|
||||
void setCppLexer(LangType type);
|
||||
void setXmlLexer(LangType type);
|
||||
void setUserLexer();
|
||||
|
@ -678,9 +679,9 @@ protected:
|
|||
};
|
||||
|
||||
void setTeXLexer() {
|
||||
for (int i = 0 ; i < 4 ; i++)
|
||||
execute(SCI_SETKEYWORDS, i, reinterpret_cast<LPARAM>(""));
|
||||
setLexer(SCLEX_TEX, L_TEX, "tex", 0);
|
||||
//execute(SCI_SETLEXER, SCLEX_TEX);
|
||||
//makeStyle("tex");
|
||||
};
|
||||
|
||||
void setNsisLexer() {
|
||||
|
|
|
@ -73,7 +73,6 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
|
|||
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, (LPARAM)_lsArray.getLexerDescFromIndex(i));
|
||||
}
|
||||
|
||||
//_hStyleList = ::GetDlgItem(_hSelf, IDC_STYLES_LIST);
|
||||
_hCheckBold = ::GetDlgItem(_hSelf, IDC_BOLD_CHECK);
|
||||
_hCheckItalic = ::GetDlgItem(_hSelf, IDC_ITALIC_CHECK);
|
||||
_hCheckUnderline = ::GetDlgItem(_hSelf, IDC_UNDERLINE_CHECK);
|
||||
|
@ -242,6 +241,43 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
case IDC_GLOBAL_FG_CHECK :
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case IDC_GLOBAL_BG_CHECK :
|
||||
printStr("touched!");
|
||||
return TRUE;
|
||||
|
||||
case IDC_GLOBAL_FONT_CHECK :
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
case IDC_GLOBAL_FONTSIZE_CHECK :
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
case IDC_GLOBAL_BOLD_CHECK :
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case IDC_GLOBAL_ITALIC_CHECK :
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
case IDC_GLOBAL_UNDERLINE_CHECK :
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
default:
|
||||
switch (HIWORD(wParam))
|
||||
{
|
||||
|
@ -436,9 +472,17 @@ void WordStyleDlg::setStyleListFromLexer(int index)
|
|||
|
||||
void WordStyleDlg::setVisualFromStyleList()
|
||||
{
|
||||
if (_isShownGOCtrls)
|
||||
showGlobalOverrideCtrls(false);
|
||||
|
||||
Style & style = getCurrentStyler();
|
||||
|
||||
// Global override style
|
||||
if (strcmp(style._styleDesc, "Global override") == 0)
|
||||
{
|
||||
showGlobalOverrideCtrls(true);
|
||||
}
|
||||
|
||||
//--Warning text
|
||||
bool showWarning = ((_currentLexerIndex == 0) && (style._styleID == STYLE_DEFAULT));//?SW_SHOW:SW_HIDE;
|
||||
|
||||
|
|
|
@ -114,6 +114,7 @@ private :
|
|||
|
||||
bool _isDirty;
|
||||
bool _isSync;
|
||||
bool _isShownGOCtrls;
|
||||
|
||||
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
|
@ -169,6 +170,18 @@ private :
|
|||
}
|
||||
void setStyleListFromLexer(int index);
|
||||
void setVisualFromStyleList();
|
||||
|
||||
void showGlobalOverrideCtrls(bool show)
|
||||
{
|
||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_GLOBAL_FG_CHECK), show?SW_SHOW:SW_HIDE);
|
||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_GLOBAL_BG_CHECK), show?SW_SHOW:SW_HIDE);
|
||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_GLOBAL_FONT_CHECK), show?SW_SHOW:SW_HIDE);
|
||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_GLOBAL_FONTSIZE_CHECK), show?SW_SHOW:SW_HIDE);
|
||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_GLOBAL_BOLD_CHECK), show?SW_SHOW:SW_HIDE);
|
||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_GLOBAL_ITALIC_CHECK), show?SW_SHOW:SW_HIDE);
|
||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_GLOBAL_UNDERLINE_CHECK), show?SW_SHOW:SW_HIDE);
|
||||
_isShownGOCtrls = show;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //WORD_STYLE_H
|
||||
|
|
|
@ -64,5 +64,12 @@ BEGIN
|
|||
LTEXT "Language :",IDC_LANGDESC_STATIC,19,10,61,8
|
||||
GROUPBOX "",IDC_STATIC,181,0,310,184
|
||||
LTEXT "+",IDC_PLUSSYMBOL2_STATIC,83,193,8,8
|
||||
CONTROL "Enable global foreground color",IDC_GLOBAL_FG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,191,114,132,10
|
||||
CONTROL "Enable global background color",IDC_GLOBAL_BG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,191,129,131,10
|
||||
CONTROL "Enable global font",IDC_GLOBAL_FONT_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,110,153,10
|
||||
CONTROL "Enable global font size",IDC_GLOBAL_FONTSIZE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,125,135,10
|
||||
CONTROL "Enable global bold font style",IDC_GLOBAL_BOLD_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,328,140,135,10
|
||||
CONTROL "Enable global Italic font style",IDC_GLOBAL_ITALIC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,328,155,135,10
|
||||
CONTROL "Enable global underline font style",IDC_GLOBAL_UNDERLINE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,328,170,135,10
|
||||
END
|
||||
|
||||
|
|
|
@ -45,6 +45,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|||
#define IDC_PLUSSYMBOL_STATIC (IDD_STYLER_DLG + 23)
|
||||
#define IDC_PLUSSYMBOL2_STATIC (IDD_STYLER_DLG + 24)
|
||||
#define IDC_LANGDESC_STATIC (IDD_STYLER_DLG + 25)
|
||||
|
||||
#define IDC_GLOBAL_FG_CHECK (IDD_STYLER_DLG + 26)
|
||||
#define IDC_GLOBAL_BG_CHECK (IDD_STYLER_DLG + 27)
|
||||
#define IDC_GLOBAL_FONT_CHECK (IDD_STYLER_DLG + 28)
|
||||
#define IDC_GLOBAL_FONTSIZE_CHECK (IDD_STYLER_DLG + 29)
|
||||
#define IDC_GLOBAL_BOLD_CHECK (IDD_STYLER_DLG + 30)
|
||||
#define IDC_GLOBAL_ITALIC_CHECK (IDD_STYLER_DLG + 31)
|
||||
#define IDC_GLOBAL_UNDERLINE_CHECK (IDD_STYLER_DLG + 32)
|
||||
|
||||
# define IDD_GLOBAL_STYLER_DLG 2300
|
||||
#define IDC_SAVECLOSE_BUTTON (IDD_GLOBAL_STYLER_DLG + 1)
|
||||
|
|
|
@ -346,10 +346,10 @@
|
|||
<LexerType name="tex" desc="TeX" ext="">
|
||||
<WordsStyle name="DEFAULT" styleID="0" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
<WordsStyle name="SPECIAL" styleID="1" fgColor="FF8000" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" />
|
||||
<WordsStyle name="GROUP" styleID="2" fgColor="FF00FF" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" />
|
||||
<WordsStyle name="GROUP" styleID="2" fgColor="8000FF" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" />
|
||||
<WordsStyle name="SYMBOL" styleID="3" fgColor="800000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
<WordsStyle name="COMMAND" styleID="4" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" />
|
||||
<WordsStyle name="TEXT" styleID="5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="4" fontSize="" />
|
||||
<WordsStyle name="TEXT" styleID="5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
</LexerType>
|
||||
<LexerType name="nsis" desc="NSIS" ext="">
|
||||
<WordsStyle name="DEFAULT" styleID="0" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" />
|
||||
|
@ -691,6 +691,7 @@
|
|||
</LexerStyles>
|
||||
<GlobalStyles>
|
||||
<!-- Attention : Don't modify the name of styleID="0" -->
|
||||
<WidgetStyle name="Global override" styleID="0" fgColor="000000" 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="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" />
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Version="8,00"
|
||||
Name="Notepad++"
|
||||
ProjectGUID="{FCF60E65-1B78-4D1D-AB59-4FC00AC8C248}"
|
||||
RootNamespace="Notepad++"
|
||||
|
@ -573,11 +573,11 @@
|
|||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\ScitillaComponent\resource.h"
|
||||
RelativePath="..\src\resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\resource.h"
|
||||
RelativePath="..\src\ScitillaComponent\resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
|
Loading…
Reference in New Issue