SynEdit: Customizable DividerDraw settings (solves issue #13322)

git-svn-id: trunk@19220 -
This commit is contained in:
martin 2009-04-04 18:27:45 +00:00
parent db361b7ad5
commit 9918770992
10 changed files with 1122 additions and 111 deletions

View File

@ -312,7 +312,6 @@ type
procedure WMSetFocus(var Msg: TWMSetFocus); message WM_SETFOCUS;
procedure WMVScroll(var Msg: {$IFDEF SYN_LAZARUS}TLMScroll{$ELSE}TWMScroll{$ENDIF}); message WM_VSCROLL;
private
FDividerDrawLevel: Integer;
fFirstLine: integer;
fBlockIndent: integer;
FBlockSelection: TSynEditSelection;
@ -434,7 +433,8 @@ type
procedure AquirePrimarySelection;
function GetUndoList: TSynEditUndoList;
procedure SetDividerDrawLevel(const AValue: Integer);
function GetDividerDrawLevel: Integer; deprecated;
procedure SetDividerDrawLevel(const AValue: Integer); deprecated;
procedure SurrenderPrimarySelection;
procedure BookMarkOptionsChanged(Sender: TObject);
procedure ComputeCaret(X, Y: Integer);
@ -928,7 +928,9 @@ type
{$ENDIF}
property SelectionMode: TSynSelectionMode
read GetSelectionMode write SetSelectionMode default smNormal;
property CFDividerDrawLevel: Integer read FDividerDrawLevel write SetDividerDrawLevel;
// See Highlighter for new methods
property CFDividerDrawLevel: Integer
read GetDividerDrawLevel write SetDividerDrawLevel; deprecated;
property TabWidth: integer read fTabWidth write SetTabWidth default 8;
property WantTabs: boolean read fWantTabs write SetWantTabs default FALSE;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
@ -981,7 +983,6 @@ type
property Color;
{$IFDEF SYN_LAZARUS}
property Cursor default crIBeam;
property CFDividerDrawLevel;
{$ENDIF}
property Enabled;
property Font;
@ -1320,6 +1321,11 @@ begin
end;
end;
function TCustomSynEdit.GetDividerDrawLevel: Integer;
begin
Result := fHighlighter.DrawDividerLevel;
end;
procedure TCustomSynEdit.SurrenderPrimarySelection;
begin
if PrimarySelection.OnRequest=@PrimarySelectionRequest then
@ -3287,6 +3293,8 @@ var
nTokenLen: integer; // Pos in Char // Len in Byte ??
attr: TSynHighlighterAttributes;
ypos: Integer;
DividerInfo: TSynDividerDrawConfigSetting;
cl: Integer;
begin
// Initialize rcLine for drawing. Note that Top and Bottom are updated
// inside the loop. Get only the starting point for this.
@ -3354,12 +3362,14 @@ var
// draw splitter line
if Assigned(fHighlighter) then begin
fHighlighter.DrawDividerLevel := FDividerDrawLevel;
if (fHighlighter.DrawDivider[CurTextIndex]) then
DividerInfo := fHighlighter.DrawDivider[CurTextIndex];
if DividerInfo.Color <> clNone then
begin
ypos := rcToken.Bottom - 1;
LCLIntf.MoveToEx(dc, nRightEdge, ypos, nil);
LCLIntf.LineTo(dc, fGutterWidth - 1, ypos);
cl := DividerInfo.Color;
if cl = clDefault then
cl := fRightEdgeColor;
fTextDrawer.DrawLine(nRightEdge, ypos, fGutterWidth - 1, ypos, cl);
end;
end;
end;
@ -4930,7 +4940,8 @@ end;
procedure TCustomSynEdit.SetDividerDrawLevel(const AValue: Integer);
begin
FDividerDrawLevel := AValue;
if assigned(fHighlighter) then
fHighlighter.DrawDividerLevel := AValue;
Invalidate;
end;
@ -8855,6 +8866,7 @@ begin
RegisterPropertyToSkip(TSynGutter, 'AllowSkipGutterSeparatorDraw', '', '');
RegisterPropertyToSkip(TSynGutter, 'GutterParts', '', '');
RegisterPropertyToSkip(TSynGutter, 'OnChange', '', '');
RegisterPropertyToSkip(TSynEdit, 'CFDividerDrawLevel', '', '');
end;
initialization

View File

@ -157,6 +157,43 @@ const
type
TSynDividerDrawConfigSetting = Record
Color: TColor;
end;
const
SynEmptyDividerDrawConfigSetting: TSynDividerDrawConfigSetting =
( Color: clNone );
type
{ TSynDividerDrawConfig }
TSynDividerDrawConfig = class
private
FDepth: Integer;
FTopSetting, FNestSetting: TSynDividerDrawConfigSetting;
fOnChange: TNotifyEvent;
function GetNestColor: TColor; virtual;
function GetTopColor: TColor; virtual;
procedure SetNestColor(const AValue: TColor); virtual;
procedure SetTopColor(const AValue: TColor); virtual;
protected
function GetMaxDrawDepth: Integer; virtual;
procedure SetMaxDrawDepth(AValue: Integer); virtual;
procedure Changed;
public
// Do not use to set values, or you skip the change notification
property TopSetting: TSynDividerDrawConfigSetting read FTopSetting;
property NestSetting: TSynDividerDrawConfigSetting read FNestSetting;
public
constructor Create;
procedure Assign(Src: TSynDividerDrawConfig); virtual;
property MaxDrawDepth: Integer read GetMaxDrawDepth write SetMaxDrawDepth;
property TopColor: TColor read GetTopColor write SetTopColor;
property NestColor: TColor read GetNestColor write SetNestColor;
property OnChange: TNotifyEvent read fOnChange write fOnChange;
end;
{ TSynCustomHighlighter }
TSynCustomHighlighter = class(TComponent)
@ -197,7 +234,9 @@ type
// code fold - only valid if hcCodeFolding in Capabilities
property LineIndex: Integer read FLineIndex;
property CurrentRanges: TSynHighlighterRangeList read FCurrentRanges;
function GetDrawDivider(Index: integer): Boolean; virtual;
function GetDrawDivider(Index: integer): TSynDividerDrawConfigSetting; virtual;
function GetDividerDrawConfig(Index: Integer): TSynDividerDrawConfig; virtual;
function GetDividerDrawConfigCount: Integer; virtual;
public
procedure DefHighlightChange(Sender: TObject);
{$IFNDEF SYN_CPPB_1} class {$ENDIF}
@ -227,7 +266,8 @@ type
procedure Next; virtual; abstract;
procedure NextToEol;
property DrawDivider[Index: integer]: Boolean read GetDrawDivider;
property DrawDivider[Index: integer]: TSynDividerDrawConfigSetting
read GetDrawDivider;
property DrawDividerLevel: Integer read FDrawDividerLevel write SetDrawDividerLevel;
public
property CurrentLines: TSynEditStrings read FCurrentLines write SetCurrentLines;
@ -273,6 +313,10 @@ type
index SYN_ATTR_SYMBOL read GetDefaultAttribute;
property WhitespaceAttribute: TSynHighlighterAttributes
index SYN_ATTR_WHITESPACE read GetDefaultAttribute;
property DividerDrawConfig[Index: Integer]: TSynDividerDrawConfig
read GetDividerDrawConfig;
property DividerDrawConfigCount: Integer read GetDividerDrawConfigCount;
published
property DefaultFilter: string read GetDefaultFilter write SetDefaultFilter
stored IsFilterStored;
@ -898,6 +942,8 @@ begin
end;
end;
end;
for i := 0 to DividerDrawConfigCount - 1 do
DividerDrawConfig[i].Assign(Src.DividerDrawConfig[i]);
// assign the sample source text only if same or descendant class
if Src is ClassType then
SampleSource := Src.SampleSource;
@ -1208,9 +1254,19 @@ begin
//DefHighlightChange(Self);
end;
function TSynCustomHighlighter.GetDrawDivider(Index: integer): Boolean;
function TSynCustomHighlighter.GetDrawDivider(Index: integer): TSynDividerDrawConfigSetting;
begin
result := false;
result := SynEmptyDividerDrawConfigSetting;
end;
function TSynCustomHighlighter.GetDividerDrawConfig(Index: Integer): TSynDividerDrawConfig;
begin
Result := nil;
end;
function TSynCustomHighlighter.GetDividerDrawConfigCount: Integer;
begin
Result := 0;
end;
{ TSynHighlighterRangeList }
@ -1230,6 +1286,64 @@ begin
Result := SizeOf(Pointer);
end;
{ TSynDividerDrawConfig }
function TSynDividerDrawConfig.GetNestColor: TColor;
begin
Result := FNestSetting.Color;
end;
function TSynDividerDrawConfig.GetTopColor: TColor;
begin
Result := FTopSetting.Color;
end;
procedure TSynDividerDrawConfig.SetNestColor(const AValue: TColor);
begin
if AValue = FNestSetting.Color then exit;
FNestSetting.Color := AValue;
Changed;
end;
procedure TSynDividerDrawConfig.SetTopColor(const AValue: TColor);
begin
if AValue = FTopSetting.Color then exit;
FTopSetting.Color := AValue;
Changed;
end;
function TSynDividerDrawConfig.GetMaxDrawDepth: Integer;
begin
Result := FDepth;
end;
procedure TSynDividerDrawConfig.SetMaxDrawDepth(AValue: Integer);
begin
if FDepth = AValue then exit;
FDepth := AValue;
Changed;
end;
procedure TSynDividerDrawConfig.Changed;
begin
if Assigned(fOnChange) then
fOnChange(Self);
end;
constructor TSynDividerDrawConfig.Create;
begin
inherited;
FDepth := 0;
FTopSetting.Color := clDefault;
FNestSetting.Color := clDefault;
end;
procedure TSynDividerDrawConfig.Assign(Src: TSynDividerDrawConfig);
begin
fOnChange := src.fOnChange;
FDepth := Src.FDepth;
end;
initialization
G_PlaceableHighlighters := TSynHighlighterList.Create;
finalization

View File

@ -123,7 +123,7 @@ type
function GetFoldNodeInfoCount(Line: Integer): Integer; virtual;
property CodeFoldRange: TSynCustomHighlighterRange read FCodeFoldRange;
function GetRangeClass: TSynCustomHighlighterRangeClass; virtual;
function TopCodeFoldBlockType: Pointer;
function TopCodeFoldBlockType(DownIndex: Integer = 0): Pointer;
function StartCodeFoldBlock(ABlockType: Pointer;
IncreaseLevel: Boolean = true): TSynCustomCodeFoldBlock; virtual;
procedure EndCodeFoldBlock(DecreaseLevel: Boolean = True); virtual;
@ -327,12 +327,20 @@ begin
Result:=TSynCustomHighlighterRange;
end;
function TSynCustomFoldHighlighter.TopCodeFoldBlockType: Pointer;
function TSynCustomFoldHighlighter.TopCodeFoldBlockType(DownIndex: Integer = 0): Pointer;
var
Fold: TSynCustomCodeFoldBlock;
begin
if (CodeFoldRange<>nil) and (CodeFoldRange.CodeFoldStackSize>0) then
Result:=CodeFoldRange.Top.BlockType
else
Result:=nil;
Result:=nil;
if (CodeFoldRange<>nil) then begin
Fold := CodeFoldRange.Top;
while (Fold <> nil) and (DownIndex > 0) do begin
Fold := Fold.Parent;
dec(DownIndex);
end;
if Fold <> nil then
Result := Fold.BlockType
end;
end;
function TSynCustomFoldHighlighter.StartCodeFoldBlock(ABlockType: Pointer;

View File

@ -57,8 +57,9 @@ uses
{$ELSE}
Windows, Messages,
{$ENDIF}
Classes, Registry, Controls, SynEditHighlighterFoldBase, SynEditMiscProcs,
SynEditTypes, SynEditHighlighter, SynEditTextBuffer, SynEditTextBase;
Classes, Registry, Controls, Graphics, SynEditHighlighterFoldBase, SynEditMiscProcs,
SynEditTypes, SynEditHighlighter, SynEditTextBuffer, SynEditTextBase,
SynEditStrConst;
type
TtkTokenKind = (tkAsm, tkComment, tkIdentifier, tkKey, tkNull, tkNumber,
@ -105,12 +106,15 @@ type
cfbtExcept,
cfbtRepeat
);
TPascalWordTrippletRanges = set of TPascalCodeFoldBlockType;
TPascalCodeFoldBlockTypes = set of TPascalCodeFoldBlockType;
const
CountPascalCodeFoldBlockOffset: Pointer =
Pointer(PtrInt(Integer(high(TPascalCodeFoldBlockType))+1));
PascalWordTrippletRanges: TPascalWordTrippletRanges =
cfbtAll: TPascalCodeFoldBlockTypes =
[low(TPascalCodeFoldBlockType)..high(TPascalCodeFoldBlockType)];
PascalWordTrippletRanges: TPascalCodeFoldBlockTypes =
[cfbtBeginEnd, cfbtProcedure, cfbtClass, cfbtProgram, cfbtRecord,
cfbtTry, cfbtExcept, cfbtRepeat
];
@ -126,6 +130,29 @@ type
pcmMacPas
);
TSynPasDividerDrawLocation = (
pddlUnitSection,
pddlUses,
pddlVarGlobal, // Var, Type, Const in global scope
pddlVarLocal, // Var, Type, Const in local (procedure) scope
pddlStructGlobal, // Class, Object, Record in global type block
pddlStructLocal, // Class, Object, Record in local (procedure) type block
pddlProcedure,
pddlBeginEnd, // Includes Repeat
pddlTry
);
const
PasDividerDrawLocationDefaults: Array [TSynPasDividerDrawLocation] of
Integer = (1, 0, // unit, uses
1, 0, // var
1, 0, // struct
2, 0, // proc, begin
0);
type
{ TSynPasSynRange }
TSynPasSynRange = class(TSynCustomHighlighterRange)
@ -208,6 +235,7 @@ type
FCatchNodeInfo: Boolean;
FNodeInfoLine, FNodeInfoCount: Integer;
FNodeInfoList: Array of TSynFoldNodeInfo;
FDividerDrawConfig: Array [TSynPasDividerDrawLocation] of TSynDividerDrawConfig;
procedure GrowNodeInfoList;
function GetPasCodeFoldRange: TSynPasSynRange;
procedure SetCompilerMode(const AValue: TPascalCompilerMode);
@ -338,6 +366,8 @@ type
procedure SetD4syntax(const Value: boolean);
procedure InitNode(var Node: TSynFoldNodeInfo; EndOffs: Integer;
ABlockType: TPascalCodeFoldBlockType);
procedure CreateDividerDrawConfig;
procedure DestroyDividerDrawConfig;
protected
function GetFoldNodeInfo(Line, Index: Integer): TSynFoldNodeInfo; override;
function GetFoldNodeInfoCount(Line: Integer): Integer; override;
@ -351,7 +381,7 @@ type
procedure EndCodeFoldBlock(DecreaseLevel: Boolean = True); override;
procedure CloseBeginEndBlocks;
procedure EndCodeFoldBlockLastLine;
function TopPascalCodeFoldBlockType: TPascalCodeFoldBlockType;
function TopPascalCodeFoldBlockType(DownIndex: Integer = 0): TPascalCodeFoldBlockType;
function GetRangeClass: TSynCustomHighlighterRangeClass; override;
property PasCodeFoldRange: TSynPasSynRange read GetPasCodeFoldRange;
@ -361,7 +391,9 @@ type
function LastLinePasFoldLevelFix(Index: Integer): integer;
function LastLineFoldLevelFix(Index: Integer): integer;
function GetDrawDivider(Index: integer): Boolean; override;
function GetDrawDivider(Index: integer): TSynDividerDrawConfigSetting; override;
function GetDividerDrawConfig(Index: Integer): TSynDividerDrawConfig; override;
function GetDividerDrawConfigCount: Integer; override;
public
{$IFNDEF SYN_CPPB_1} class {$ENDIF}
function GetCapabilities: TSynHighlighterCapabilities; override;
@ -369,6 +401,7 @@ type
function GetLanguageName: string; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
override;
function GetEol: Boolean; override;
@ -435,9 +468,6 @@ type
implementation
uses
Graphics, SynEditStrConst;
const
RESERVED_WORDS_TP: array [1..54] of String = (
'absolute', 'and', 'array', 'asm',
@ -1671,6 +1701,7 @@ end;
constructor TSynPasSyn.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
CreateDividerDrawConfig;
fD4syntax := true;
fAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler);
AddAttribute(fAsmAttri);
@ -1706,6 +1737,12 @@ begin
FNodeInfoLine := -1;
end; { Create }
destructor TSynPasSyn.Destroy;
begin
DestroyDividerDrawConfig;
inherited Destroy;
end;
procedure TSynPasSyn.SetLine(const NewValue: string; LineNumber:Integer);
begin
//DebugLn(['TSynPasSyn.SetLine START LineNumber=',LineNumber,' Line="',NewValue,'"']);
@ -2299,11 +2336,11 @@ begin
end;
end;
function TSynPasSyn.TopPascalCodeFoldBlockType: TPascalCodeFoldBlockType;
function TSynPasSyn.TopPascalCodeFoldBlockType(DownIndex: Integer = 0): TPascalCodeFoldBlockType;
var
p: Pointer;
begin
p := inherited TopCodeFoldBlockType;
p := TopCodeFoldBlockType(DownIndex);
if p >= CountPascalCodeFoldBlockOffset then
p := p - PtrUInt(CountPascalCodeFoldBlockOffset);
Result := TPascalCodeFoldBlockType(PtrUInt(p));
@ -2511,11 +2548,163 @@ begin
end;
end;
function TSynPasSyn.GetDrawDivider(Index: integer): Boolean;
function TSynPasSyn.GetDrawDivider(Index: integer): TSynDividerDrawConfigSetting;
function CheckFoldNestLevel(MaxDepth, StartLvl: Integer;
CountTypes, SkipTypes: TPascalCodeFoldBlockTypes;
out ResultLvl: Integer): Boolean;
var
i, j, m: Integer;
t: TPascalCodeFoldBlockType;
begin
i := 0;
j := StartLvl;
m := CurrentCodeFoldBlockLevel;
t := TopPascalCodeFoldBlockType(j);
while (i <= MaxDepth) and (j < m) and
((t in CountTypes) or (t in SkipTypes)) do begin
inc(j);
if t in CountTypes then
inc(i);
t := TopPascalCodeFoldBlockType(j)
end;
ResultLvl := i;
Result := i <= MaxDepth;
end;
var
nxt, cur: TPascalCodeFoldBlockType;
CloseCnt, ClosedByNextLine, ClosedInLastLine: Integer;
i, top, c: Integer;
t: TSynPasDividerDrawLocation;
begin
result := (EndFoldLevel(Index) < DrawDividerLevel) and
(EndFoldLevel(Index - 1) > MinimumFoldLevel(Index)) and
(MinimumFoldLevel(Index) = EndFoldLevel(Index)); // not a mixed line
Result := inherited;
if (index = 0) then exit;
CloseCnt := EndFoldLevel(Index - 1) - MinimumFoldLevel(Index);
if (CloseCnt = 0) or (MinimumFoldLevel(Index) <> EndFoldLevel(Index)) then // not a mixed line
exit;
// SetRange[Index] has the folds at the start of this line
// ClosedByNextLine: Folds closed by the next lines LastLineFix
// must be taken from SetRange[Index+1] (end of this line)
ClosedByNextLine := -LastLineFoldLevelFix(Index + 1);
// ClosedInLastLine: Folds Closed by this lines LastLineFix
// must be ignored. (They are part of SetRange[Index] / this line)
ClosedInLastLine := -LastLineFoldLevelFix(Index);
// Get the highest close-offset
i := ClosedByNextLine - 1;
if i >= 0 then begin
SetRange(CurrentRanges[Index]); // Checking ClosedByNextLine
top := 0;
end else begin
SetRange(CurrentRanges[Index - 1]); // Checking Closed in this Line
i := CloseCnt - ClosedByNextLine + ClosedInLastLine - 1;
top := ClosedInLastLine;
end;
cur := TopPascalCodeFoldBlockType(i + 1);
while (i >= top) do begin
nxt := cur; // The "next higher" close node compared to current
cur := TopPascalCodeFoldBlockType(i);
Result := FDividerDrawConfig[pddlUses].TopSetting; //// xxxx
case cur of
cfbtUnitSection:
if FDividerDrawConfig[pddlUnitSection].MaxDrawDepth > 0 then
exit(FDividerDrawConfig[pddlUnitSection].TopSetting);
cfbtUses:
if FDividerDrawConfig[pddlUses].MaxDrawDepth > 0 then
exit(FDividerDrawConfig[pddlUses].TopSetting);
cfbtVarType:
if nxt = cfbtProcedure then begin
if CheckFoldNestLevel(FDividerDrawConfig[pddlVarLocal].MaxDrawDepth - 1,
i + 2, [cfbtProcedure], cfbtAll, c) then begin
if c = 0
then exit(FDividerDrawConfig[pddlVarLocal].TopSetting)
else exit(FDividerDrawConfig[pddlVarLocal].NestSetting);
end;
end
else // global var
if FDividerDrawConfig[pddlVarGlobal].MaxDrawDepth > 0 then exit;
cfbtClass, cfbtRecord:
begin
if CheckFoldNestLevel(0, i + 1, [cfbtProcedure],
cfbtAll - [cfbtVarType], c)
then t := pddlStructGlobal
else t := pddlStructLocal;
if CheckFoldNestLevel(FDividerDrawConfig[t].MaxDrawDepth - 1,
i + 1, [cfbtClass, cfbtRecord],
cfbtAll - [cfbtVarType], c) then begin
if c = 0
then exit(FDividerDrawConfig[t].TopSetting)
else exit(FDividerDrawConfig[t].NestSetting);
end;
end;
cfbtProcedure:
if CheckFoldNestLevel(FDividerDrawConfig[pddlProcedure].MaxDrawDepth - 1,
i + 1, [cfbtProcedure], cfbtAll, c) then begin
if c = 0
then exit(FDividerDrawConfig[pddlProcedure].TopSetting)
else exit(FDividerDrawConfig[pddlProcedure].NestSetting);
end;
cfbtBeginEnd, cfbtRepeat:
if CheckFoldNestLevel(FDividerDrawConfig[pddlBeginEnd].MaxDrawDepth - 1,
i + 1, [cfbtBeginEnd, cfbtRepeat],
cfbtAll - [cfbtProcedure], c) then begin
if c = 0
then exit(FDividerDrawConfig[pddlBeginEnd].TopSetting)
else exit(FDividerDrawConfig[pddlBeginEnd].NestSetting);
end;
cfbtTry:
if CheckFoldNestLevel(FDividerDrawConfig[pddlTry].MaxDrawDepth - 1,
i + 1, [cfbtTry], cfbtAll - [cfbtProcedure], c)
then begin
if c = 0
then exit(FDividerDrawConfig[pddlTry].TopSetting)
else exit(FDividerDrawConfig[pddlTry].NestSetting);
end;
end;
dec(i);
if (i < top) and (ClosedByNextLine > 0) then begin
// Switch to blocks closed in this line
SetRange(CurrentRanges[Index - 1]);
i := CloseCnt - ClosedByNextLine + ClosedInLastLine - 1;
ClosedByNextLine := 0;
top := ClosedInLastLine;
cur := TopPascalCodeFoldBlockType(i + 1);
end;
end;
Result := inherited;
end;
procedure TSynPasSyn.CreateDividerDrawConfig;
var
i: TSynPasDividerDrawLocation;
begin
for i := low(TSynPasDividerDrawLocation) to high(TSynPasDividerDrawLocation) do
begin
FDividerDrawConfig[i] := TSynDividerDrawConfig.Create;
FDividerDrawConfig[i].OnChange := {$IFDEF FPC}@{$ENDIF}DefHighlightChange;
FDividerDrawConfig[i].MaxDrawDepth := PasDividerDrawLocationDefaults[i];
end;
end;
procedure TSynPasSyn.DestroyDividerDrawConfig;
var
i: TSynPasDividerDrawLocation;
begin
for i := low(TSynPasDividerDrawLocation) to high(TSynPasDividerDrawLocation) do
FreeAndNil(FDividerDrawConfig[i]);
end;
function TSynPasSyn.GetDividerDrawConfig(Index: Integer): TSynDividerDrawConfig;
begin
Result := FDividerDrawConfig[TSynPasDividerDrawLocation(Index)];
end;
function TSynPasSyn.GetDividerDrawConfigCount: Integer;
begin
Result := ord(high(TSynPasDividerDrawLocation))
- ord(low(TSynPasDividerDrawLocation)) + 1;
end;
function TSynPasSyn.GetFoldNodeInfo(Line, Index: Integer): TSynFoldNodeInfo;

View File

@ -239,6 +239,7 @@ type
procedure TextOut(X, Y: Integer; Text: PChar; Length: Integer); virtual;
procedure ExtTextOut(X, Y: Integer; fuOptions: UINT; const ARect: TRect;
Text: PChar; Length: Integer); virtual;
procedure DrawLine(X, Y, X2, Y2: Integer; AColor: TColor);
procedure SetBaseFont(Value: TFont); virtual;
procedure SetBaseStyle(const Value: TFontStyles); virtual;
procedure SetStyle(Value: TFontStyles); virtual;
@ -1171,6 +1172,18 @@ begin
end;
end;
procedure TheTextDrawer.DrawLine(X, Y, X2, Y2: Integer; AColor: TColor);
var
Pen, OldPen: HPen;
old : TPoint;
begin
Pen := CreateColorPen(AColor);
OldPen := SelectObject(FDC, Pen);
MoveToEx(FDC, X, Y, @old);
LineTo(FDC, X2, Y2);
DeleteObject(SelectObject(FDC, OldPen));
end;
procedure TheTextDrawer.ReleaseTemporaryResources;
begin
FFontStock.ReleaseFontHandles;

View File

@ -337,6 +337,57 @@ const
)
);
type
TEditorOptionsDividerInfo = record
Name: String; // Name for display
Xml: String; // Name for XML
BoolOpt: Boolean; // Checkbox only
MaxLevel: Integer;
end;
TEditorOptionsDividerInfoList = Array [0..999] of TEditorOptionsDividerInfo;
PEditorOptionsDividerInfoList = ^TEditorOptionsDividerInfoList;
TEditorOptionsDividerRecord = record
Count: Integer;
Info: PEditorOptionsDividerInfoList;
end;
const
EditorOptionsDividerInfoPas: Array [0..8] of TEditorOptionsDividerInfo
= (
(Name: dlgDivPasUnitSectionName; Xml: 'Sect'; BoolOpt: True; MaxLevel: 1),
(Name: dlgDivPasUsesName; Xml: 'Uses'; BoolOpt: True; MaxLevel: 0),
(Name: dlgDivPasVarGlobalName; Xml: 'GVar'; BoolOpt: True; MaxLevel: 1),
(Name: dlgDivPasVarLocalName; Xml: 'LVar'; BoolOpt: False; MaxLevel: 0),
(Name: dlgDivPasStructGlobalName; Xml: 'GStruct'; BoolOpt: False; MaxLevel: 1),
(Name: dlgDivPasStructLocalName; Xml: 'LStruct'; BoolOpt: False; MaxLevel: 0),
(Name: dlgDivPasProcedureName; Xml: 'Proc'; BoolOpt: False; MaxLevel: 1),
(Name: dlgDivPasBeginEndName; Xml: 'Begin'; BoolOpt: False; MaxLevel: 0),
(Name: dlgDivPasTryName; Xml: 'Try'; BoolOpt: False; MaxLevel: 0)
);
EditorOptionsDividerDefaults: array[TLazSyntaxHighlighter] of
TEditorOptionsDividerRecord =
( (Count: 0; Info: nil), // none
(Count: 0; Info: nil), // text
(Count: 9; Info: {$IFDEF FPC}@{$ENDIF}EditorOptionsDividerInfoPas[0]), // Freepas
(Count: 9; Info: {$IFDEF FPC}@{$ENDIF}EditorOptionsDividerInfoPas[0]), // pas
(Count: 0; Info: nil), // lfm
(Count: 0; Info: nil), // xml
(Count: 0; Info: nil), // html
(Count: 0; Info: nil), // cpp
(Count: 0; Info: nil), // perl
(Count: 0; Info: nil), // java
(Count: 0; Info: nil), // shell
(Count: 0; Info: nil), // python
(Count: 0; Info: nil), // php
(Count: 0; Info: nil), // sql
(Count: 0; Info: nil) // jscript
);
const
EditorOptsFormatVersion = 4;
@ -491,7 +542,6 @@ type
// Code Folding
FUseCodeFolding: Boolean;
FCFDividerDrawLevel: Integer;
public
constructor Create;
destructor Destroy; override;
@ -524,6 +574,11 @@ type
DefaultPascalSyn: TPreviewPasSyn);
procedure WriteHighlighterSettings(Syn: TSrcIDEHighlighter;
SynColorScheme: String);
procedure ReadHighlighterFoldSettings(Syn: TSrcIDEHighlighter);
procedure ReadDefaultsForHighlighterFoldSettings(Syn: TSrcIDEHighlighter);
procedure WriteHighlighterFoldSettings(Syn: TSrcIDEHighlighter);
function GetLineColors(Syn: TSrcIDEHighlighter;
AddHilightAttr: TAdditionalHilightAttribute; {TODO: MFR maybe remove?}
out FG, BG: TColor; out Styles, StylesMask: TFontStyles): Boolean;
@ -636,8 +691,6 @@ type
// Code Folding
property UseCodeFolding: Boolean
read FUseCodeFolding write FUseCodeFolding default True;
property CFDividerDrawLevel: Integer
read FCFDividerDrawLevel write FCFDividerDrawLevel default 4;
end;
const
@ -1446,9 +1499,6 @@ begin
fCodeTemplateFileName, '"');
end;
end;
// Code Folding
FCFDividerDrawLevel := 4;
end;
destructor TEditorOptions.Destroy;
@ -1636,8 +1686,6 @@ begin
FUseCodeFolding :=
XMLConfig.GetValue(
'EditorOptions/CodeFolding/UseCodeFolding', True);
FCFDividerDrawLevel :=
XMLConfig.GetValue('EditorOptions/CodeFolding/DividerDrawLevel', 4);
except
on E: Exception do
DebugLn('[TEditorOptions.Load] ERROR: ', e.Message);
@ -1794,8 +1842,6 @@ begin
// Code Folding
XMLConfig.SetDeleteValue('EditorOptions/CodeFolding/UseCodeFolding',
FUseCodeFolding, True);
XMLConfig.SetDeleteValue('EditorOptions/CodeFolding/DividerDrawLevel',
FCFDividerDrawLevel, 4);
InvalidateFileStateCache;
XMLConfig.Flush;
@ -2265,16 +2311,92 @@ begin
end;
end;
procedure TEditorOptions.ReadHighlighterFoldSettings(Syn: TSrcIDEHighlighter);
var
TheInfo: TEditorOptionsDividerRecord;
Conf: TSynDividerDrawConfig;
ConfName: String;
Path: String;
i: Integer;
begin
ReadDefaultsForHighlighterFoldSettings(Syn);
TheInfo := EditorOptionsDividerDefaults
[HighlighterList[HighlighterList.FindByHighlighter(Syn)].TheType];
// read settings, that are different from the defaults
for i := 0 to TheInfo.Count - 1 do begin
Conf := Syn.DividerDrawConfig[i];
ConfName := TheInfo.Info^[i].Xml;
Path := 'EditorOptions/DividerDraw/Lang' + StrToValidXMLName(Syn.LanguageName) +
'/Type' + ConfName + '/' ;
Conf.MaxDrawDepth := XMLConfig.GetValue(Path + 'MaxDepth/Value',
Conf.MaxDrawDepth);
Conf.TopColor := XMLConfig.GetValue(Path + 'TopColor/Value',
Conf.TopColor);
Conf.NestColor := XMLConfig.GetValue(Path + 'NestColor/Value',
Conf.NestColor);
end;
end;
procedure TEditorOptions.ReadDefaultsForHighlighterFoldSettings(Syn: TSrcIDEHighlighter);
var
TheInfo: TEditorOptionsDividerRecord;
i: Integer;
begin
TheInfo := EditorOptionsDividerDefaults
[HighlighterList[HighlighterList.FindByHighlighter(Syn)].TheType];
for i := 0 to TheInfo.Count - 1 do begin
Syn.DividerDrawConfig[i].MaxDrawDepth := TheInfo.Info^[i].MaxLeveL;
Syn.DividerDrawConfig[i].TopColor := clDefault;
Syn.DividerDrawConfig[i].NestColor := clDefault;
end;
end;
procedure TEditorOptions.WriteHighlighterFoldSettings(Syn: TSrcIDEHighlighter);
var
DefSyn: TSrcIDEHighlighter;
i: Integer;
Path: String;
Conf, DefConf: TSynDividerDrawConfig;
TheInfo: TEditorOptionsDividerRecord;
ConfName: String;
begin
DefSyn := TCustomSynClass(Syn.ClassType).Create(Nil);
try
ReadDefaultsForHighlighterFoldSettings(DefSyn);
TheInfo := EditorOptionsDividerDefaults
[HighlighterList[HighlighterList.FindByHighlighter(Syn)].TheType];
for i := 0 to TheInfo.Count - 1 do begin
Conf := Syn.DividerDrawConfig[i];
DefConf := DefSyn.DividerDrawConfig[i]; // default value
ConfName := TheInfo.Info^[i].Xml;
Path := 'EditorOptions/DividerDraw/Lang' +
StrToValidXMLName(Syn.LanguageName) + '/Type' + ConfName + '/' ;
XMLConfig.SetDeleteValue(Path + 'MaxDepth/Value', Conf.MaxDrawDepth,
DefConf.MaxDrawDepth);
XMLConfig.SetDeleteValue(Path + 'TopColor/Value', Conf.TopColor,
DefConf.TopColor);
XMLConfig.SetDeleteValue(Path + 'NestColor/Value', Conf.NestColor,
DefConf.NestColor);
end;
finally
DefSyn.Free;
end;
end;
procedure TEditorOptions.GetHighlighterSettings(Syn: TSrcIDEHighlighter);
// read highlight settings from config file
begin
ReadHighlighterSettings(Syn, '');
ReadHighlighterFoldSettings(Syn);
end;
procedure TEditorOptions.SetHighlighterSettings(Syn: TSrcIDEHighlighter);
// write highlight settings to config file
begin
WriteHighlighterSettings(Syn, '');
WriteHighlighterFoldSettings(Syn);
end;
function TEditorOptions.GetLineColors(Syn: TSrcIDEHighlighter;
@ -2433,9 +2555,6 @@ begin
MarkCaret.Trim := FMarkupCurWordTrim;
end;
// Code Folding
ASynEdit.CFDividerDrawLevel := FCFDividerDrawLevel;
KeyMap.AssignTo(ASynEdit.KeyStrokes, TSourceEditorWindowInterface);
end;

View File

@ -1,12 +1,11 @@
inherited EditorCodefoldingOptionsFrame: TEditorCodefoldingOptionsFrame
Height = 88
Width = 400
ClientHeight = 88
ClientWidth = 400
TabOrder = 0
Height = 334
Width = 521
ClientHeight = 334
ClientWidth = 521
Visible = False
DesignLeft = 110
DesignTop = 145
DesignLeft = 230
DesignTop = 230
object Bevel1: TBevel[0]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = chkCodeFoldingEnabled
@ -15,46 +14,280 @@ inherited EditorCodefoldingOptionsFrame: TEditorCodefoldingOptionsFrame
AnchorSideRight.Side = asrBottom
Left = 0
Height = 2
Top = 23
Width = 400
Top = 25
Width = 521
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
end
object lblDividerDrawLevel: TLabel[1]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = edDividerDrawLevel
AnchorSideTop.Side = asrCenter
Left = 0
Height = 14
Top = 35
Width = 94
Caption = 'lblDividerDrawLevel'
object LanguageLabel: TLabel[1]
AnchorSideLeft.Control = LanguageComboBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = LanguageComboBox
Left = 206
Height = 16
Top = 31
Width = 81
BorderSpacing.Left = 6
BorderSpacing.Right = 6
Caption = 'LanguageLabel'
ParentColor = False
end
object chkCodeFoldingEnabled: TCheckBox[2]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
Left = 0
Height = 17
Height = 19
Top = 0
Width = 131
Width = 136
Caption = 'chkCodeFoldingEnabled'
OnChange = chkCodeFoldingEnabledChange
TabOrder = 0
end
object edDividerDrawLevel: TSpinEdit[3]
AnchorSideLeft.Control = lblDividerDrawLevel
AnchorSideLeft.Side = asrBottom
object LanguageComboBox: TComboBox[3]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Bevel1
AnchorSideTop.Side = asrBottom
Left = 100
Height = 23
Left = 0
Height = 21
Top = 31
Width = 50
BorderSpacing.Left = 6
Width = 200
AutoComplete = False
BorderSpacing.Top = 6
MaxValue = 10
ItemHeight = 13
ItemWidth = 0
OnChange = LanguageComboBoxChange
OnExit = LanguageComboBoxExit
OnKeyDown = LanguageComboBoxKeyDown
TabOrder = 1
Value = 1
Text = 'LanguageComboBox'
end
object FoldConfigListBox: TListBox[4]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = LanguageComboBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = LanguageComboBox
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 276
Top = 58
Width = 200
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 6
ItemHeight = 0
OnClick = FoldConfigListBoxClick
OnSelectionChange = FoldConfigListBoxSelectionChange
TabOrder = 2
end
object DividerConfPanel: TPanel[5]
AnchorSideLeft.Control = FoldConfigListBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = FoldConfigListBox
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 206
Height = 276
Top = 58
Width = 315
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 6
BevelOuter = bvNone
ClientHeight = 276
ClientWidth = 315
TabOrder = 3
object DividerBoolPanel: TPanel
AnchorSideLeft.Control = DividerConfPanel
AnchorSideTop.Control = DividerConfPanel
AnchorSideRight.Control = DividerConfPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DividerSpinPanel
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 23
Top = 0
Width = 315
Anchors = [akTop, akLeft, akRight, akBottom]
AutoSize = True
BevelOuter = bvNone
ClientHeight = 23
ClientWidth = 315
TabOrder = 1
Visible = False
object DividerOnOffCheckBox: TCheckBox
AnchorSideLeft.Control = DividerBoolPanel
AnchorSideTop.Control = DividerBoolPanel
AnchorSideRight.Control = DividerBoolPanel
AnchorSideRight.Side = asrBottom
Left = 0
Height = 19
Top = 0
Width = 315
Anchors = [akTop, akLeft, akRight]
Caption = 'DividerOnOffCheckBox'
OnChange = DividerOnOffCheckBoxChange
TabOrder = 0
end
end
object DividerSpinPanel: TPanel
AnchorSideLeft.Control = DividerConfPanel
AnchorSideTop.Control = DividerConfPanel
AnchorSideRight.Control = DividerConfPanel
AnchorSideRight.Side = asrBottom
Left = 0
Height = 23
Top = 0
Width = 315
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BevelOuter = bvNone
ClientHeight = 23
ClientWidth = 315
TabOrder = 0
object DividerSpinLabel: TLabel
AnchorSideLeft.Control = DividerSpinEdit
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = DividerSpinEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = DividerSpinPanel
AnchorSideRight.Side = asrBottom
Left = 53
Height = 16
Top = 3
Width = 262
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 3
Caption = 'DividerSpinLabel'
ParentColor = False
end
object DividerSpinEdit: TSpinEdit
AnchorSideLeft.Control = DividerSpinPanel
AnchorSideTop.Control = DividerSpinPanel
Left = 0
Height = 23
Top = 0
Width = 50
OnChange = DividerSpinEditChange
TabOrder = 0
end
end
object NestLvlPanel: TPanel
AnchorSideLeft.Control = DividerConfPanel
AnchorSideTop.Control = TopLvlPanel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = DividerConfPanel
AnchorSideRight.Side = asrBottom
Left = 0
Height = 44
Top = 80
Width = 315
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 6
BevelOuter = bvNone
ClientHeight = 44
ClientWidth = 315
TabOrder = 2
Visible = False
object NestLvlColorLabel: TLabel
AnchorSideLeft.Control = NestLvlPanel
AnchorSideTop.Control = NestLvlPanel
Left = 0
Height = 16
Top = 0
Width = 97
Caption = 'NestLvlColorLabel'
ParentColor = False
end
object NestLvlColorBox: TColorBox
AnchorSideLeft.Control = NestLvlPanel
AnchorSideTop.Control = NestLvlColorLabel
AnchorSideTop.Side = asrBottom
Left = 0
Height = 22
Top = 22
Width = 100
DefaultColorColor = clWhite
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
AutoComplete = False
BorderSpacing.Top = 6
ItemHeight = 16
ItemWidth = 0
OnChange = NestLvlColorBoxChange
TabOrder = 0
end
object NestLvlColorCheckBox: TCheckBox
AnchorSideLeft.Control = NestLvlColorBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = NestLvlColorBox
AnchorSideTop.Side = asrCenter
Left = 106
Height = 19
Top = 24
Width = 129
BorderSpacing.Left = 6
Caption = 'NestLvlColorCheckBox'
OnChange = NestLvlColorCheckBoxChange
TabOrder = 1
end
end
object TopLvlPanel: TPanel
AnchorSideLeft.Control = DividerConfPanel
AnchorSideTop.Control = DividerConfPanel
AnchorSideRight.Control = DividerConfPanel
AnchorSideRight.Side = asrBottom
Left = 0
Height = 44
Top = 30
Width = 315
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 30
BevelOuter = bvNone
ClientHeight = 44
ClientWidth = 315
TabOrder = 3
object TopLvlColorLabel: TLabel
AnchorSideLeft.Control = TopLvlPanel
AnchorSideTop.Control = TopLvlPanel
Left = 0
Height = 16
Top = 0
Width = 94
Caption = 'TopLvlColorLabel'
ParentColor = False
end
object TopLvlColorBox: TColorBox
AnchorSideLeft.Control = TopLvlPanel
AnchorSideTop.Control = TopLvlColorLabel
AnchorSideTop.Side = asrBottom
Left = 0
Height = 22
Top = 22
Width = 100
DefaultColorColor = clWhite
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames]
AutoComplete = False
BorderSpacing.Top = 6
ItemHeight = 16
ItemWidth = 0
OnChange = TopLvlColorBoxChange
TabOrder = 0
end
object TopLvlColorCheckBox: TCheckBox
AnchorSideLeft.Control = TopLvlColorBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = TopLvlColorBox
AnchorSideTop.Side = asrCenter
Left = 106
Height = 19
Top = 24
Width = 126
BorderSpacing.Left = 6
Caption = 'TopLvlColorCheckBox'
OnChange = TopLvlColorCheckBoxChange
TabOrder = 1
end
end
end
end

View File

@ -1,23 +1,111 @@
LazarusResources.Add('TEditorCodefoldingOptionsFrame','FORMDATA',[
'TPF0'#241#30'TEditorCodefoldingOptionsFrame'#29'EditorCodefoldingOptionsFram'
+'e'#6'Height'#2'X'#5'Width'#3#144#1#12'ClientHeight'#2'X'#11'ClientWidth'#3
+#144#1#8'TabOrder'#2#0#7'Visible'#8#10'DesignLeft'#2'n'#9'DesignTop'#3#145#0
+#0#242#2#0#6'TBevel'#6'Bevel1'#22'AnchorSideLeft.Control'#7#5'Owner'#21'Anch'
+'orSideTop.Control'#7#21'chkCodeFoldingEnabled'#18'AnchorSideTop.Side'#7#9'a'
+'srBottom'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7
+#9'asrBottom'#4'Left'#2#0#6'Height'#2#2#3'Top'#2#23#5'Width'#3#144#1#7'Ancho'
+'rs'#11#5'akTop'#6'akLeft'#7'akRight'#0#17'BorderSpacing.Top'#2#6#0#0#242#2#1
+#6'TLabel'#19'lblDividerDrawLevel'#22'AnchorSideLeft.Control'#7#5'Owner'#21
+'AnchorSideTop.Control'#7#18'edDividerDrawLevel'#18'AnchorSideTop.Side'#7#9
+'asrCenter'#4'Left'#2#0#6'Height'#2#14#3'Top'#2'#'#5'Width'#2'^'#7'Caption'#6
+#19'lblDividerDrawLevel'#11'ParentColor'#8#0#0#242#2#2#9'TCheckBox'#21'chkCo'
+'deFoldingEnabled'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Co'
+'ntrol'#7#5'Owner'#4'Left'#2#0#6'Height'#2#17#3'Top'#2#0#5'Width'#3#131#0#7
+'Caption'#6#21'chkCodeFoldingEnabled'#8'OnChange'#7#27'chkCodeFoldingEnabled'
+'Change'#8'TabOrder'#2#0#0#0#242#2#3#9'TSpinEdit'#18'edDividerDrawLevel'#22
+'AnchorSideLeft.Control'#7#19'lblDividerDrawLevel'#19'AnchorSideLeft.Side'#7
+#9'asrBottom'#21'AnchorSideTop.Control'#7#6'Bevel1'#18'AnchorSideTop.Side'#7
+#9'asrBottom'#4'Left'#2'd'#6'Height'#2#23#3'Top'#2#31#5'Width'#2'2'#18'Borde'
+'rSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#8'MaxValue'#2#10#8'TabOrder'#2
+#1#5'Value'#2#1#0#0#0
+'e'#6'Height'#3'N'#1#5'Width'#3#9#2#12'ClientHeight'#3'N'#1#11'ClientWidth'#3
+#9#2#7'Visible'#8#10'DesignLeft'#3#230#0#9'DesignTop'#3#230#0#0#242#2#0#6'TB'
+'evel'#6'Bevel1'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Cont'
+'rol'#7#21'chkCodeFoldingEnabled'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'A'
+'nchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#4
+'Left'#2#0#6'Height'#2#2#3'Top'#2#25#5'Width'#3#9#2#7'Anchors'#11#5'akTop'#6
+'akLeft'#7'akRight'#0#17'BorderSpacing.Top'#2#6#0#0#242#2#1#6'TLabel'#13'Lan'
+'guageLabel'#22'AnchorSideLeft.Control'#7#16'LanguageComboBox'#19'AnchorSide'
+'Left.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#16'LanguageComboBox'#4
+'Left'#3#206#0#6'Height'#2#16#3'Top'#2#31#5'Width'#2'Q'#18'BorderSpacing.Lef'
+'t'#2#6#19'BorderSpacing.Right'#2#6#7'Caption'#6#13'LanguageLabel'#11'Parent'
+'Color'#8#0#0#242#2#2#9'TCheckBox'#21'chkCodeFoldingEnabled'#22'AnchorSideLe'
+'ft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#5'Owner'#4'Left'#2#0#6'H'
+'eight'#2#19#3'Top'#2#0#5'Width'#3#136#0#7'Caption'#6#21'chkCodeFoldingEnabl'
+'ed'#8'TabOrder'#2#0#0#0#242#2#3#9'TComboBox'#16'LanguageComboBox'#22'Anchor'
+'SideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#6'Bevel1'#4'Left'#2
+#0#6'Height'#2#21#3'Top'#2#31#5'Width'#3#200#0#12'AutoComplete'#8#17'BorderS'
+'pacing.Top'#2#6#10'ItemHeight'#2#13#9'ItemWidth'#2#0#8'OnChange'#7#22'Langu'
+'ageComboBoxChange'#6'OnExit'#7#20'LanguageComboBoxExit'#9'OnKeyDown'#7#23'L'
+'anguageComboBoxKeyDown'#8'TabOrder'#2#1#4'Text'#6#16'LanguageComboBox'#0#0
+#242#2#4#8'TListBox'#17'FoldConfigListBox'#22'AnchorSideLeft.Control'#7#5'Ow'
+'ner'#21'AnchorSideTop.Control'#7#16'LanguageComboBox'#18'AnchorSideTop.Side'
+#7#9'asrBottom'#23'AnchorSideRight.Control'#7#16'LanguageComboBox'#20'Anchor'
+'SideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#5'Owner'#21'A'
+'nchorSideBottom.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#3#20#1#3'Top'#2
+':'#5'Width'#3#200#0#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'
+#0#17'BorderSpacing.Top'#2#6#10'ItemHeight'#2#0#7'OnClick'#7#22'FoldConfigLi'
+'stBoxClick'#17'OnSelectionChange'#7' FoldConfigListBoxSelectionChange'#8'Ta'
+'bOrder'#2#2#0#0#242#2#5#6'TPanel'#16'DividerConfPanel'#22'AnchorSideLeft.Co'
+'ntrol'#7#17'FoldConfigListBox'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'An'
+'chorSideTop.Control'#7#17'FoldConfigListBox'#23'AnchorSideRight.Control'#7#5
+'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'
+#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3#206#0#6'Heigh'
+'t'#3#20#1#3'Top'#2':'#5'Width'#3';'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'ak'
+'Right'#8'akBottom'#0#18'BorderSpacing.Left'#2#6#10'BevelOuter'#7#6'bvNone'
+#12'ClientHeight'#3#20#1#11'ClientWidth'#3';'#1#8'TabOrder'#2#3#0#6'TPanel'
+#16'DividerBoolPanel'#22'AnchorSideLeft.Control'#7#16'DividerConfPanel'#21'A'
+'nchorSideTop.Control'#7#16'DividerConfPanel'#23'AnchorSideRight.Control'#7
+#16'DividerConfPanel'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideB'
+'ottom.Control'#7#16'DividerSpinPanel'#21'AnchorSideBottom.Side'#7#9'asrBott'
+'om'#4'Left'#2#0#6'Height'#2#23#3'Top'#2#0#5'Width'#3';'#1#7'Anchors'#11#5'a'
+'kTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'AutoSize'#9#10'BevelOuter'#7#6'b'
+'vNone'#12'ClientHeight'#2#23#11'ClientWidth'#3';'#1#8'TabOrder'#2#1#7'Visib'
+'le'#8#0#9'TCheckBox'#20'DividerOnOffCheckBox'#22'AnchorSideLeft.Control'#7
+#16'DividerBoolPanel'#21'AnchorSideTop.Control'#7#16'DividerBoolPanel'#23'An'
+'chorSideRight.Control'#7#16'DividerBoolPanel'#20'AnchorSideRight.Side'#7#9
+'asrBottom'#4'Left'#2#0#6'Height'#2#19#3'Top'#2#0#5'Width'#3';'#1#7'Anchors'
+#11#5'akTop'#6'akLeft'#7'akRight'#0#7'Caption'#6#20'DividerOnOffCheckBox'#8
+'OnChange'#7#26'DividerOnOffCheckBoxChange'#8'TabOrder'#2#0#0#0#0#6'TPanel'
+#16'DividerSpinPanel'#22'AnchorSideLeft.Control'#7#16'DividerConfPanel'#21'A'
+'nchorSideTop.Control'#7#16'DividerConfPanel'#23'AnchorSideRight.Control'#7
+#16'DividerConfPanel'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2#0#6
+'Height'#2#23#3'Top'#2#0#5'Width'#3';'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7
+'akRight'#0#8'AutoSize'#9#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2#23#11
+'ClientWidth'#3';'#1#8'TabOrder'#2#0#0#6'TLabel'#16'DividerSpinLabel'#22'Anc'
+'horSideLeft.Control'#7#15'DividerSpinEdit'#19'AnchorSideLeft.Side'#7#9'asrB'
+'ottom'#21'AnchorSideTop.Control'#7#15'DividerSpinEdit'#18'AnchorSideTop.Sid'
+'e'#7#9'asrCenter'#23'AnchorSideRight.Control'#7#16'DividerSpinPanel'#20'Anc'
+'horSideRight.Side'#7#9'asrBottom'#4'Left'#2'5'#6'Height'#2#16#3'Top'#2#3#5
+'Width'#3#6#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#18'BorderSpacing'
+'.Left'#2#3#7'Caption'#6#16'DividerSpinLabel'#11'ParentColor'#8#0#0#9'TSpinE'
+'dit'#15'DividerSpinEdit'#22'AnchorSideLeft.Control'#7#16'DividerSpinPanel'
+#21'AnchorSideTop.Control'#7#16'DividerSpinPanel'#4'Left'#2#0#6'Height'#2#23
,#3'Top'#2#0#5'Width'#2'2'#8'OnChange'#7#21'DividerSpinEditChange'#8'TabOrder'
+#2#0#0#0#0#6'TPanel'#12'NestLvlPanel'#22'AnchorSideLeft.Control'#7#16'Divide'
+'rConfPanel'#21'AnchorSideTop.Control'#7#11'TopLvlPanel'#18'AnchorSideTop.Si'
+'de'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#16'DividerConfPanel'#20'An'
+'chorSideRight.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#2','#3'Top'#2'P'#5
+'Width'#3';'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'AutoSize'#9#17
+'BorderSpacing.Top'#2#6#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2','#11
+'ClientWidth'#3';'#1#8'TabOrder'#2#2#7'Visible'#8#0#6'TLabel'#17'NestLvlColo'
+'rLabel'#22'AnchorSideLeft.Control'#7#12'NestLvlPanel'#21'AnchorSideTop.Cont'
+'rol'#7#12'NestLvlPanel'#4'Left'#2#0#6'Height'#2#16#3'Top'#2#0#5'Width'#2'a'
+#7'Caption'#6#17'NestLvlColorLabel'#11'ParentColor'#8#0#0#9'TColorBox'#15'Ne'
+'stLvlColorBox'#22'AnchorSideLeft.Control'#7#12'NestLvlPanel'#21'AnchorSideT'
+'op.Control'#7#17'NestLvlColorLabel'#18'AnchorSideTop.Side'#7#9'asrBottom'#4
+'Left'#2#0#6'Height'#2#22#3'Top'#2#22#5'Width'#2'd'#17'DefaultColorColor'#7#7
+'clWhite'#5'Style'#11#16'cbStandardColors'#16'cbExtendedColors'#14'cbSystemC'
+'olors'#16'cbIncludeDefault'#13'cbCustomColor'#13'cbPrettyNames'#0#12'AutoCo'
+'mplete'#8#17'BorderSpacing.Top'#2#6#10'ItemHeight'#2#16#9'ItemWidth'#2#0#8
+'OnChange'#7#21'NestLvlColorBoxChange'#8'TabOrder'#2#0#0#0#9'TCheckBox'#20'N'
+'estLvlColorCheckBox'#22'AnchorSideLeft.Control'#7#15'NestLvlColorBox'#19'An'
+'chorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#15'NestLvlCol'
+'orBox'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2'j'#6'Height'#2#19#3
+'Top'#2#24#5'Width'#3#129#0#18'BorderSpacing.Left'#2#6#7'Caption'#6#20'NestL'
+'vlColorCheckBox'#8'OnChange'#7#26'NestLvlColorCheckBoxChange'#8'TabOrder'#2
+#1#0#0#0#6'TPanel'#11'TopLvlPanel'#22'AnchorSideLeft.Control'#7#16'DividerCo'
+'nfPanel'#21'AnchorSideTop.Control'#7#16'DividerConfPanel'#23'AnchorSideRigh'
+'t.Control'#7#16'DividerConfPanel'#20'AnchorSideRight.Side'#7#9'asrBottom'#4
+'Left'#2#0#6'Height'#2','#3'Top'#2#30#5'Width'#3';'#1#7'Anchors'#11#5'akTop'
+#6'akLeft'#7'akRight'#0#8'AutoSize'#9#17'BorderSpacing.Top'#2#30#10'BevelOut'
+'er'#7#6'bvNone'#12'ClientHeight'#2','#11'ClientWidth'#3';'#1#8'TabOrder'#2#3
+#0#6'TLabel'#16'TopLvlColorLabel'#22'AnchorSideLeft.Control'#7#11'TopLvlPane'
+'l'#21'AnchorSideTop.Control'#7#11'TopLvlPanel'#4'Left'#2#0#6'Height'#2#16#3
+'Top'#2#0#5'Width'#2'^'#7'Caption'#6#16'TopLvlColorLabel'#11'ParentColor'#8#0
+#0#9'TColorBox'#14'TopLvlColorBox'#22'AnchorSideLeft.Control'#7#11'TopLvlPan'
+'el'#21'AnchorSideTop.Control'#7#16'TopLvlColorLabel'#18'AnchorSideTop.Side'
+#7#9'asrBottom'#4'Left'#2#0#6'Height'#2#22#3'Top'#2#22#5'Width'#2'd'#17'Defa'
+'ultColorColor'#7#7'clWhite'#5'Style'#11#16'cbStandardColors'#16'cbExtendedC'
+'olors'#14'cbSystemColors'#16'cbIncludeDefault'#13'cbCustomColor'#13'cbPrett'
+'yNames'#0#12'AutoComplete'#8#17'BorderSpacing.Top'#2#6#10'ItemHeight'#2#16#9
+'ItemWidth'#2#0#8'OnChange'#7#20'TopLvlColorBoxChange'#8'TabOrder'#2#0#0#0#9
+'TCheckBox'#19'TopLvlColorCheckBox'#22'AnchorSideLeft.Control'#7#14'TopLvlCo'
+'lorBox'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7
+#14'TopLvlColorBox'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2'j'#6'Hei'
+'ght'#2#19#3'Top'#2#24#5'Width'#2'~'#18'BorderSpacing.Left'#2#6#7'Caption'#6
+#19'TopLvlColorCheckBox'#8'OnChange'#7#25'TopLvlColorCheckBoxChange'#8'TabOr'
+'der'#2#1#0#0#0#0#0
]);

View File

@ -25,8 +25,9 @@ unit editor_codefolding_options;
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, StdCtrls, ExtCtrls, Spin,
EditorOptions, LazarusIDEStrConsts, IDEOptionsIntf;
Classes, SysUtils, FileUtil, LResources, Forms, StdCtrls, ExtCtrls, Graphics,
LCLType, EditorOptions, LazarusIDEStrConsts, IDEOptionsIntf, Controls,
SynEditHighlighter, Spin, ComCtrls, ColorBox;
type
@ -34,13 +35,47 @@ type
TEditorCodefoldingOptionsFrame = class(TAbstractIDEOptionsEditor)
Bevel1: TBevel;
TopLvlPanel: TPanel;
TopLvlColorCheckBox: TCheckBox;
NestLvlColorCheckBox: TCheckBox;
TopLvlColorBox: TColorBox;
NestLvlColorBox: TColorBox;
DividerOnOffCheckBox: TCheckBox;
chkCodeFoldingEnabled: TCheckBox;
edDividerDrawLevel: TSpinEdit;
lblDividerDrawLevel: TLabel;
procedure chkCodeFoldingEnabledChange(Sender: TObject);
DividerSpinLabel: TLabel;
TopLvlColorLabel: TLabel;
NestLvlColorLabel: TLabel;
LanguageComboBox: TComboBox;
LanguageLabel: TLabel;
FoldConfigListBox: TListBox;
DividerConfPanel: TPanel;
DividerSpinPanel: TPanel;
DividerBoolPanel: TPanel;
DividerSpinEdit: TSpinEdit;
NestLvlPanel: TPanel;
procedure DividerOnOffCheckBoxChange(Sender: TObject);
procedure DividerSpinEditChange(Sender: TObject);
procedure FoldConfigListBoxClick(Sender: TObject);
procedure FoldConfigListBoxSelectionChange(Sender: TObject; User: boolean);
procedure LanguageComboBoxChange(Sender: TObject);
procedure LanguageComboBoxExit(Sender: TObject);
procedure LanguageComboBoxKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure NestLvlColorBoxChange(Sender: TObject);
procedure NestLvlColorCheckBoxChange(Sender: TObject);
procedure TopLvlColorBoxChange(Sender: TObject);
procedure TopLvlColorCheckBoxChange(Sender: TObject);
private
{ private declarations }
FHighlighters: array[TLazSyntaxHighlighter] of TSrcIDEHighlighter;
FCurHighlighter: TSrcIDEHighlighter;
FCurDividerConf: TSynDividerDrawConfig;
FCurInfo: TEditorOptionsDividerRecord;
protected
function GetHighlighter(SynType: TLazSyntaxHighlighter;
CreateIfNotExists: Boolean): TSrcIDEHighlighter;
procedure ClearHighlighters;
public
destructor Destroy; override;
function GetTitle: String; override;
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
@ -52,10 +87,170 @@ implementation
{ TEditorCodefoldingOptionsFrame }
procedure TEditorCodefoldingOptionsFrame.chkCodeFoldingEnabledChange(Sender: TObject);
procedure TEditorCodefoldingOptionsFrame.LanguageComboBoxChange(Sender: TObject);
var
ComboBox: TComboBox absolute Sender;
begin
lblDividerDrawLevel.Enabled := chkCodeFoldingEnabled.Checked;
edDividerDrawLevel.Enabled := chkCodeFoldingEnabled.Checked;
if ComboBox.Items.IndexOf(ComboBox.Text) >= 0 then
LanguageComboBoxExit(Sender);
end;
procedure TEditorCodefoldingOptionsFrame.LanguageComboBoxKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if (ssCtrl in Shift) and (Key = VK_S) then
LanguageComboBoxExit(Sender);
end;
procedure TEditorCodefoldingOptionsFrame.LanguageComboBoxExit(Sender: TObject);
var
ComboBox: TComboBox absolute Sender;
i: Integer;
tp: TLazSyntaxHighlighter;
begin
tp := EditorOpts.HighlighterList
[EditorOpts.HighlighterList.FindByName(ComboBox.Text)].TheType;
FCurHighlighter := GetHighlighter(tp, True);
FCurInfo := EditorOptionsDividerDefaults[tp];
FoldConfigListBox.Clear;
for i := 0 to FCurInfo.Count - 1 do
FoldConfigListBox.Items.add(FCurInfo.Info^[i].Name);
FoldConfigListBox.ItemIndex := 0;
FoldConfigListBoxSelectionChange(Sender, True);
end;
procedure TEditorCodefoldingOptionsFrame.FoldConfigListBoxClick(Sender: TObject);
begin
FoldConfigListBoxSelectionChange(Sender, True);
end;
procedure TEditorCodefoldingOptionsFrame.FoldConfigListBoxSelectionChange(Sender: TObject; User: boolean);
var
ListBox: TListBox absolute Sender;
i: LongInt;
NewDiv: TSynDividerDrawConfig;
b: Boolean;
begin
if not assigned(FCurHighlighter) then exit;
i := ListBox.ItemIndex;
if (i < 0) or (i >= FCurInfo.Count) then exit;
NewDiv := FCurHighlighter.DividerDrawConfig[i];
FCurDividerConf := nil;
b := FCurInfo.Info^[i].BoolOpt;
DividerBoolPanel.Visible := b;
DividerSpinPanel.Visible := not b;
NestLvlPanel.Visible := not b;
DividerOnOffCheckBox.Checked := NewDiv.MaxDrawDepth > 0;
DividerSpinEdit.Value := NewDiv.MaxDrawDepth;
TopLvlColorBox.Selected := NewDiv.TopColor;
TopLvlColorBox.Tag := TopLvlColorBox.Selected;
TopLvlColorCheckBox.Checked := NewDiv.TopColor = clDefault;
TopLvlPanel.Enabled := NewDiv.MaxDrawDepth > 0;
NestLvlColorBox.Selected := NewDiv.NestColor;
NestLvlColorBox.Tag := NestLvlColorBox.Selected;
NestLvlColorCheckBox.Checked := NewDiv.NestColor = clDefault;
NestLvlPanel.Enabled := NewDiv.MaxDrawDepth > 1;
FCurDividerConf := NewDiv;
end;
procedure TEditorCodefoldingOptionsFrame.DividerOnOffCheckBoxChange(Sender: TObject);
var
Box: TCheckBox absolute Sender;
begin
if not assigned(FCurDividerConf) then exit;
if Box.Checked then
FCurDividerConf.MaxDrawDepth := 1
else
FCurDividerConf.MaxDrawDepth := 0;
TopLvlPanel.Enabled := FCurDividerConf.MaxDrawDepth > 0;
end;
procedure TEditorCodefoldingOptionsFrame.DividerSpinEditChange(Sender: TObject);
var
Spin: TSpinEdit absolute Sender;
begin
if not assigned(FCurDividerConf) then exit;
FCurDividerConf.MaxDrawDepth := Spin.Value;
TopLvlPanel.Enabled := FCurDividerConf.MaxDrawDepth > 0;
NestLvlPanel.Enabled := FCurDividerConf.MaxDrawDepth > 1;
end;
procedure TEditorCodefoldingOptionsFrame.NestLvlColorBoxChange(Sender: TObject);
begin
if not assigned(FCurDividerConf) then exit;
FCurDividerConf.NestColor := NestLvlColorBox.Selected;
if NestLvlColorBox.Selected <> clDefault then
NestLvlColorBox.Tag := NestLvlColorBox.Selected;
NestLvlColorCheckBox.Checked := NestLvlColorBox.Selected = clDefault;
end;
procedure TEditorCodefoldingOptionsFrame.NestLvlColorCheckBoxChange(Sender: TObject);
begin
if not assigned(FCurDividerConf) then exit;
if NestLvlColorCheckBox.Checked then begin
FCurDividerConf.NestColor := clDefault;
if NestLvlColorBox.Selected <> clDefault then
NestLvlColorBox.Selected := clDefault;
end else begin
FCurDividerConf.NestColor := NestLvlColorBox.Tag;
if NestLvlColorBox.Selected <> NestLvlColorBox.Tag then
NestLvlColorBox.Selected := NestLvlColorBox.Tag;
end;
end;
procedure TEditorCodefoldingOptionsFrame.TopLvlColorBoxChange(Sender: TObject);
begin
if not assigned(FCurDividerConf) then exit;
FCurDividerConf.TopColor := TopLvlColorBox.Selected;
if TopLvlColorBox.Selected <> clDefault then
TopLvlColorBox.Tag := TopLvlColorBox.Selected;
TopLvlColorCheckBox.Checked := TopLvlColorBox.Selected = clDefault;
end;
procedure TEditorCodefoldingOptionsFrame.TopLvlColorCheckBoxChange(Sender: TObject);
begin
if not assigned(FCurDividerConf) then exit;
if TopLvlColorCheckBox.Checked then begin
FCurDividerConf.TopColor := clDefault;
if TopLvlColorBox.Selected <> clDefault then
TopLvlColorBox.Selected := clDefault;
end else begin
FCurDividerConf.TopColor := TopLvlColorBox.Tag;
if TopLvlColorBox.Selected <> TopLvlColorBox.Tag then
TopLvlColorBox.Selected := TopLvlColorBox.Tag;
end;
end;
function TEditorCodefoldingOptionsFrame.GetHighlighter(SynType: TLazSyntaxHighlighter;
CreateIfNotExists: Boolean): TSrcIDEHighlighter;
var
SynClass: TCustomSynClass;
i: Integer;
begin
Result := FHighlighters[SynType];
if (Result <> nil) or not(CreateIfNotExists) then exit;
SynClass := LazSyntaxHighlighterClasses[SynType];
Result := SynClass.Create(nil);
FHighlighters[SynType] := Result;
EditorOpts.ReadHighlighterFoldSettings(Result);
end;
procedure TEditorCodefoldingOptionsFrame.ClearHighlighters;
var
i: TLazSyntaxHighlighter;
begin
for i := low(TLazSyntaxHighlighter) to high(TLazSyntaxHighlighter) do
FreeAndNil(FHighlighters[i]);
end;
destructor TEditorCodefoldingOptionsFrame.Destroy;
begin
ClearHighlighters;
inherited Destroy;
end;
function TEditorCodefoldingOptionsFrame.GetTitle: String;
@ -66,26 +261,51 @@ end;
procedure TEditorCodefoldingOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
begin
chkCodeFoldingEnabled.Caption := dlgUseCodeFolding;
lblDividerDrawLevel.Caption := dlgCFDividerDrawLevel + ':';
LanguageLabel.Caption := dlgLang;
DividerSpinLabel.Caption := dlgDividerDrawDepth;
DividerOnOffCheckBox.Caption := dlgDividerOnOff;
TopLvlColorLabel.Caption := dlgDividerTopColor;
TopLvlColorCheckBox.Caption := dlgDividerTopColorDefault;
NestLvlColorLabel.Caption := dlgDividerNestColor;
NestLvlColorCheckBox.Caption := dlgDividerNestColorDefault;
end;
procedure TEditorCodefoldingOptionsFrame.ReadSettings(
AOptions: TAbstractIDEOptions);
var
i: Integer;
r: TEditorOptionsDividerRecord;
begin
with AOptions as TEditorOptions do
begin
chkCodeFoldingEnabled.Checked := UseCodeFolding;
edDividerDrawLevel.Value := CFDividerDrawLevel;
with LanguageComboBox.Items do begin
BeginUpdate;
for i := 0 to EditorOpts.HighlighterList.Count - 1 do begin
r := EditorOptionsDividerDefaults[HighlighterList[i].TheType];
if r.Count > 0 then
Add(HighlighterList[i].SynClass.GetLanguageName);
end;
EndUpdate;
end;
LanguageComboBox.ItemIndex := 0;
LanguageComboBoxExit(LanguageComboBox);
end;
end;
procedure TEditorCodefoldingOptionsFrame.WriteSettings(
AOptions: TAbstractIDEOptions);
var
i: TLazSyntaxHighlighter;
begin
with AOptions as TEditorOptions do
begin
UseCodeFolding := chkCodeFoldingEnabled.Checked;
CFDividerDrawLevel := edDividerDrawLevel.Value;
for i := low(TLazSyntaxHighlighter) to high(TLazSyntaxHighlighter) do begin
if assigned(FHighlighters[i]) then
WriteHighlighterFoldSettings(FHighlighters[i]);
end;
end;
end;

View File

@ -1220,8 +1220,23 @@ resourcestring
dlgIndentCodeTo = 'Indent code to';
//dlgCodeToolsTab = 'Code Tools';
lisAutomaticFeatures = 'Automatic features';
dlgCFDividerDrawLevel = 'Divider Draw Level';
dlgDividerOnOff = 'Draw divider';
dlgDividerDrawDepth = 'Draw divider level';
dlgDividerTopColor = 'Line color';
dlgDividerTopColorDefault = 'Use Default';
dlgDividerNestColor = 'Nested line color';
dlgDividerNestColorDefault = 'Use Default';
dlgDivPasUnitSectionName = 'Unit sections';
dlgDivPasUsesName = 'Uses clause';
dlgDivPasVarGlobalName = 'Var/Type';
dlgDivPasVarLocalName = 'Var/Type (local)';
dlgDivPasStructGlobalName = 'Class/Struct';
dlgDivPasStructLocalName = 'Class/Struct (local)';
dlgDivPasProcedureName = 'Procedure/Function';
dlgDivPasBeginEndName = 'Begin/End';
dlgDivPasTryName = 'Try/Except';
// CodeTools dialog
dlgCodeToolsOpts = 'CodeTools Options';
dlgCodeCreation = 'Code Creation';