IDE, add config for editor zic-zac highlight

git-svn-id: trunk@27691 -
This commit is contained in:
martin 2010-10-13 22:36:50 +00:00
parent 769c0bbc2d
commit a232a31041
4 changed files with 179 additions and 39 deletions

View File

@ -39,7 +39,7 @@ uses
// LCL
Controls, ExtCtrls, Graphics, LCLProc, FileUtil, LResources, Forms, Dialogs,
// Synedit
SynEdit, SynEditAutoComplete, SynEditKeyCmds, SynEditStrConst,
SynEdit, SynEditAutoComplete, SynEditKeyCmds, SynEditStrConst, SynEditTypes,
SynEditMiscClasses, SynBeautifier, SynEditTextTrimmer, SynEditMouseCmds,
SynPluginTemplateEdit, SynPluginSyncroEdit,
SynGutter, SynGutterBase, SynGutterCodeFolding, SynGutterLineNumber,
@ -149,32 +149,32 @@ const
);
ahaSupportedFeatures: array[TAdditionalHilightAttribute] of TSynHighlighterAttrFeatures =
(
{ ahaNone } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaTextBlock } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaExecutionPoint } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaEnabledBreakpoint } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaDisabledBreakpoint } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaInvalidBreakpoint } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaUnknownBreakpoint } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaErrorLine } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaIncrementalSearch } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaHighlightAll } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaBracketMatch } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaMouseLink } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaLineNumber } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaLineHighlight } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaNone } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaTextBlock } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaExecutionPoint } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaEnabledBreakpoint } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaDisabledBreakpoint } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaInvalidBreakpoint } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaUnknownBreakpoint } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaErrorLine } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaIncrementalSearch } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaHighlightAll } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaBracketMatch } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaMouseLink } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaLineNumber } [hafBackColor, hafForeColor, hafFrameColor, hafStyle],
{ ahaLineHighlight } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaModifiedLine } [hafBackColor, hafForeColor, hafFrameColor],
{ ahaCodeFoldingTree } [hafBackColor, hafForeColor, hafFrameColor],
{ ahaHighlightWord } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaFoldedCode } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaWordGroup } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaTemplateEditCur } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaTemplateEditSync } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaTemplateEditOther } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaSyncroEditCur } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaSyncroEditSync } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaSyncroEditOther } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaSyncroEditArea } [hafBackColor, hafForeColor, hafFrameColor, hafStyle, hafStyleMask],
{ ahaHighlightWord } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaFoldedCode } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaWordGroup } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaTemplateEditCur } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaTemplateEditSync } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaTemplateEditOther } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaSyncroEditCur } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaSyncroEditSync } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaSyncroEditOther } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaSyncroEditArea } [hafBackColor, hafForeColor, hafFrameColor, hafFrameStyle, hafFrameEdges, hafStyle, hafStyleMask],
{ ahaGutterSeparator } [hafBackColor, hafForeColor],
{ ahaGutter } [hafBackColor],
{ ahaRightMargin} [hafForeColor]
@ -1586,6 +1586,8 @@ begin
Dest.Background := Src.Background;
Dest.Foreground := Src.Foreground;
Dest.FrameColor := Src.FrameColor;
Dest.FrameEdges := Src.FrameEdges;
Dest.FrameStyle := Src.FrameStyle;
Dest.Style := Src.Style;
Dest.StyleMask := Src.StyleMask;
end;
@ -4121,6 +4123,8 @@ begin
aMarkup.Foreground := clNone;
aMarkup.Background := clNone;
aMarkup.FrameColor := clNone;
aMarkup.FrameEdges := sfeAround;
aMarkup.FrameStyle := slsSolid;
aMarkup.Style := [];
aMarkup.StyleMask := [];
end;
@ -4305,6 +4309,8 @@ begin
aDest.Background := Src.Background;
aDest.Foreground := Src.Foreground;
aDest.FrameColor := Src.FrameColor;
aDest.FrameEdges := Src.FrameEdges;
aDest.FrameStyle := Src.FrameStyle;
aDest.Style := Src.Style;
aDest.StyleMask := Src.StyleMask;
aDest.Features := Src.Features;
@ -4315,8 +4321,11 @@ begin
aDest.Background := aDefault.Background;
if Foreground = clDefault then
aDest.Foreground := aDefault.Foreground;
if FrameColor = clDefault then
if FrameColor = clDefault then begin
aDest.FrameColor := aDefault.FrameColor;
aDest.FrameEdges := aDefault.FrameEdges;
aDest.FrameStyle := aDefault.FrameStyle;
end;
end;
if aDest is TColorSchemeAttribute then
TColorSchemeAttribute(aDest).Group := Src.Group;
@ -4336,6 +4345,8 @@ begin
aDest.Foreground := Src.Foreground;
aDest.Background := Src.Background;
aDest.FrameColor := Src.FrameColor;
aDest.FrameEdges := Src.FrameEdges;
aDest.FrameStyle := Src.FrameStyle;
aDest.Style := Src.Style;
aDest.StyleMask := Src.StyleMask;
aDest.EndUpdate;
@ -4359,6 +4370,11 @@ begin
(Background = Other.Background) and
(Foreground = Other.Foreground) and
(FrameColor = Other.FrameColor) and
( (FrameColor = clNone) or
( (FrameStyle = Other.FrameStyle) and
(FrameEdges = Other.FrameEdges)
)
) and
(Style = Other.Style) and
(StyleMask = Other.StyleMask) and
(Features = Other.Features);
@ -4421,6 +4437,8 @@ begin
Background := Defaults.Background;
Foreground := Defaults.Foreground;
FrameColor := Defaults.FrameColor;
FrameEdges := Defaults.FrameEdges;
FrameStyle := Defaults.FrameStyle;
Style := Defaults.Style;
StyleMask := Defaults.StyleMask;
UseSchemeGlobals := Defaults.UseSchemeGlobals;

View File

@ -157,8 +157,8 @@ inherited EditorColorOptionsFrame: TEditorColorOptionsFrame
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Side = asrBottom
Left = 204
Height = 1
Top = 177
Height = 16
Top = 159
Width = 50
Anchors = [akTop, akLeft, akBottom]
BorderSpacing.Left = 6
@ -225,11 +225,11 @@ inherited EditorColorOptionsFrame: TEditorColorOptionsFrame
end
object pnlUnderline: TPanel
AnchorSideLeft.Control = pnlElementAttributes
AnchorSideTop.Control = FrameColorBox
AnchorSideTop.Control = FrameEdgesBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 40
Top = 114
Top = 138
Width = 145
AutoSize = True
BorderSpacing.Left = 6
@ -321,7 +321,7 @@ inherited EditorColorOptionsFrame: TEditorColorOptionsFrame
AnchorSideTop.Control = pnlUnderline
Left = 157
Height = 40
Top = 114
Top = 138
Width = 134
AutoSize = True
BorderSpacing.Left = 6
@ -412,7 +412,7 @@ inherited EditorColorOptionsFrame: TEditorColorOptionsFrame
AnchorSideTop.Control = pnlUnderline
Left = 297
Height = 40
Top = 114
Top = 138
Width = 134
AutoSize = True
BorderSpacing.Left = 6
@ -497,6 +497,53 @@ inherited EditorColorOptionsFrame: TEditorColorOptionsFrame
TabOrder = 1
end
end
object FrameStyleBox: TComboBox
AnchorSideLeft.Control = FrameEdgesBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = FrameEdgesBox
Left = 307
Height = 21
Top = 114
Width = 97
BorderSpacing.Left = 6
ItemHeight = 15
ItemIndex = 0
Items.Strings = (
'slsSolid'
'slsDashed'
'slsDotted'
'slsWaved'
)
OnChange = ForegroundColorBoxChange
OnDrawItem = FrameStyleBoxDrawItem
ReadOnly = True
Style = csOwnerDrawFixed
TabOrder = 10
Text = 'slsSolid'
end
object FrameEdgesBox: TComboBox
AnchorSideLeft.Control = ColumnPosBevel
AnchorSideTop.Control = FrameColorBox
AnchorSideTop.Side = asrBottom
Left = 204
Height = 21
Top = 114
Width = 97
BorderSpacing.Top = 3
ItemHeight = 15
ItemIndex = 0
Items.Strings = (
'Around'
'Bottom'
'Left'
)
OnChange = ForegroundColorBoxChange
OnDrawItem = FrameEdgesBoxDrawItem
ReadOnly = True
Style = csOwnerDrawFixed
TabOrder = 11
Text = 'Around'
end
end
object pnlTop: TPanel[1]
Left = 0

View File

@ -27,10 +27,10 @@ interface
uses
Classes, Controls, StdCtrls, sysutils, ExtCtrls, Graphics, ColorBox, ComCtrls,
LCLProc, LCLType, LCLIntf, Dialogs, Menus,
SynEdit, SynEditMiscClasses, SynGutterCodeFolding, SynGutterLineNumber,
SynGutterChanges, SynEditMouseCmds, SynEditHighlighter, DividerBevel,
SynEdit, SynEditMiscClasses, SynGutterCodeFolding, SynGutterLineNumber, SynEditTypes,
SynGutterChanges, SynEditMouseCmds, SynEditHighlighter, SynTextDrawer, DividerBevel,
EditorOptions, IDEOptionsIntf, editor_general_options, IDEImagesIntf,
LazarusIDEStrConsts, IDEProcs, typinfo, LazConf;
LazarusIDEStrConsts, IDEProcs, typinfo, LazConf, types;
type
@ -41,6 +41,8 @@ type
ColumnPosBevel: TBevel;
BackGroundLabel: TLabel;
bvlAttributeSection: TDividerBevel;
FrameStyleBox: TComboBox;
FrameEdgesBox: TComboBox;
FileExtensionsComboBox: TComboBox;
FrameColorBox: TColorBox;
BackGroundUseDefaultCheckBox: TCheckBox;
@ -98,6 +100,10 @@ type
Shift: TShiftState; X, Y: Integer);
procedure ForegroundColorBoxChange(Sender: TObject);
procedure ForegroundColorBoxGetColors(Sender: TCustomColorBox; Items: TStrings);
procedure FrameEdgesBoxDrawItem(Control: TWinControl; Index: Integer; ARect: TRect;
State: TOwnerDrawState);
procedure FrameStyleBoxDrawItem(Control: TWinControl; Index: Integer; ARect: TRect;
State: TOwnerDrawState);
procedure GeneralCheckBoxOnChange(Sender: TObject);
procedure ComboBoxOnExit(Sender: TObject);
procedure pnlElementAttributesResize(Sender: TObject);
@ -484,6 +490,15 @@ begin
AttrToEdit.FrameColor := DefaultToNone(FrameColorBox.Selected);
FrameColorUseDefaultCheckBox.Checked := FrameColorBox.Selected <> clDefault;
end;
if Sender = FrameEdgesBox then
begin
AttrToEdit.FrameEdges := TSynFrameEdges(FrameEdgesBox.ItemIndex);
end;
if Sender = FrameStyleBox then
begin
AttrToEdit.FrameStyle := TSynLineStyle(FrameStyleBox.ItemIndex);
end;
UpdatingColor := False;
UpdateCurrentScheme;
end;
@ -500,6 +515,63 @@ begin
end;
end;
procedure TEditorColorOptionsFrame.FrameEdgesBoxDrawItem(Control: TWinControl; Index: Integer;
ARect: TRect; State: TOwnerDrawState);
var
r: TRect;
begin
if Index < 0 then exit;;
r.top := ARect.top + 3;
r.bottom := ARect.bottom - 3;
r.left := ARect.left + 5;
r.right := ARect.Right - 5;
with TCustomComboBox(Control).Canvas do
begin
FillRect(ARect);
Pen.Width := 2;
case Index of
0: Rectangle(r);
1: begin
MoveTo(r.Left, r.Bottom);
LineTo(r.Right, r.Bottom);
end;
2: begin
MoveTo(r.Left, r.Top);
LineTo(r.Left, r.Bottom);
end;
end;
end;
end;
procedure TEditorColorOptionsFrame.FrameStyleBoxDrawItem(Control: TWinControl; Index: Integer;
ARect: TRect; State: TOwnerDrawState);
var
p: TPoint;
begin
if Index < 0 then exit;;
with TCustomComboBox(Control).Canvas do
begin
FillRect(ARect);
Pen.Width := 2;
case Index of
0: Pen.Style := psSolid;
1: Pen.Style := psDash;
2: Pen.Style := psDot;
3: Pen.Style := psSolid;
end;
if Index = 3 then begin
MoveToEx(Handle, ARect.Left + 5, (ARect.Top + ARect.Bottom) div 2 - 2, @p);
WaveTo(Handle, ARect.Right - 5, (ARect.Top + ARect.Bottom) div 2 - 2, 4);
end else begin
MoveTo(ARect.Left + 5, (ARect.Top + ARect.Bottom) div 2);
LineTo(ARect.Right - 5, (ARect.Top + ARect.Bottom) div 2);
end;
end;
end;
procedure TEditorColorOptionsFrame.GeneralCheckBoxOnChange(Sender: TObject);
var
TheColorBox: TColorBox;
@ -550,6 +622,8 @@ begin
(DefaultToNone(FrameColorBox.Selected) <> AttrToEdit.FrameColor)
then begin
AttrToEdit.FrameColor := DefaultToNone(FrameColorBox.Selected);
FrameEdgesBox.Enabled := TCheckBox(Sender).Checked;
FrameStyleBox.Enabled := TCheckBox(Sender).Checked;
UpdateCurrentScheme;
end;
end;
@ -638,9 +712,6 @@ begin
CheckControl(ForeGroundUseDefaultCheckBox);
CheckControl(BackGroundUseDefaultCheckBox);
CheckControl(FrameColorUseDefaultCheckBox);
CheckControl(TextUnderlineCheckBox);
CheckControl(TextBoldCheckBox);
CheckControl(TextItalicCheckBox);
ColumnPosBevel.AnchorSide[akLeft].Control := MinAnchor;
end;
@ -801,6 +872,8 @@ begin
// Frame
FrameColorUseDefaultCheckBox.Visible := hafFrameColor in AttrToShow.Features;
FrameColorBox.Visible := hafFrameColor in AttrToShow.Features;
FrameEdgesBox.Visible := hafFrameEdges in AttrToShow.Features;
FrameStyleBox.Visible := hafFrameStyle in AttrToShow.Features;
FrameColorBox.Selected := NoneToDefault(AttrToShow.FrameColor);
if FrameColorBox.Selected = clDefault then
@ -808,6 +881,8 @@ begin
else
FrameColorBox.Tag := FrameColorBox.Selected;
FrameColorUseDefaultCheckBox.Checked := FrameColorBox.Selected <> clDefault;
FrameEdgesBox.ItemIndex := integer(AttrToShow.FrameEdges);
FrameStyleBox.ItemIndex := integer(AttrToShow.FrameStyle);
// Styles
TextBoldCheckBox.Visible := hafStyle in AttrToShow.Features;

View File

@ -1434,7 +1434,7 @@ resourcestring
dlgColorNotModified = 'Not modified';
dlgForecolor = 'Foreground';
dlgFrameColor = 'Frame color';
dlgFrameColor = 'Text-mark';
dlgUnsavedLineColor = 'Unsaved line';
dlgSavedLineColor = 'Saved line';
dlgGutterCollapsedColor = 'Collapsed';