SynEdit: Allow configuration for folding

git-svn-id: trunk@19234 -
This commit is contained in:
martin 2009-04-05 20:46:30 +00:00
parent 7f608f7cb4
commit d683c26988
9 changed files with 699 additions and 285 deletions

View File

@ -7552,10 +7552,15 @@ begin
end; end;
procedure TCustomSynEdit.HighlighterAttrChanged(Sender: TObject); procedure TCustomSynEdit.HighlighterAttrChanged(Sender: TObject);
var
t: integer;
begin begin
RecalcCharExtent; RecalcCharExtent;
SizeOrFontChanged(TRUE); //jr 2000-10-01 SizeOrFontChanged(TRUE); //jr 2000-10-01
Invalidate; Invalidate;
t := 0;
if fHighlighter.AttributeChangeNeedScan then
ScanFrom(t, FLines.Count - 1);
end; end;
procedure TCustomSynEdit.StatusChanged(AChanges: TSynStatusChanges); procedure TCustomSynEdit.StatusChanged(AChanges: TSynStatusChanges);

View File

@ -211,6 +211,7 @@ type
procedure SetDrawDividerLevel(const AValue: Integer); procedure SetDrawDividerLevel(const AValue: Integer);
procedure SetEnabled(const Value: boolean); //DDH 2001-10-23 procedure SetEnabled(const Value: boolean); //DDH 2001-10-23
protected protected
FAttributeChangeNeedScan: Boolean;
fDefaultFilter: string; fDefaultFilter: string;
fUpdateChange: boolean; //mh 2001-09-13 fUpdateChange: boolean; //mh 2001-09-13
procedure AddAttribute(AAttrib: TSynHighlighterAttributes); procedure AddAttribute(AAttrib: TSynHighlighterAttributes);
@ -237,6 +238,7 @@ type
function GetDividerDrawConfigCount: Integer; virtual; function GetDividerDrawConfigCount: Integer; virtual;
public public
procedure DefHighlightChange(Sender: TObject); procedure DefHighlightChange(Sender: TObject);
property AttributeChangeNeedScan: Boolean read FAttributeChangeNeedScan;
{$IFNDEF SYN_CPPB_1} class {$ENDIF} {$IFNDEF SYN_CPPB_1} class {$ENDIF}
function GetCapabilities: TSynHighlighterCapabilities; virtual; function GetCapabilities: TSynHighlighterCapabilities; virtual;
{$IFNDEF SYN_CPPB_1} class {$ENDIF} {$IFNDEF SYN_CPPB_1} class {$ENDIF}
@ -1042,8 +1044,10 @@ procedure TSynCustomHighlighter.DefHighlightChange(Sender: TObject);
begin begin
if fUpdateCount > 0 then if fUpdateCount > 0 then
fUpdateChange := TRUE fUpdateChange := TRUE
else else begin
fAttrChangeHooks.Fire; fAttrChangeHooks.Fire;
FAttributeChangeNeedScan := False;
end;
end; end;
function TSynCustomHighlighter.GetAttribCount: integer; function TSynCustomHighlighter.GetAttribCount: integer;

View File

@ -120,6 +120,10 @@ type
fRanges: TSynCustomHighlighterRanges; fRanges: TSynCustomHighlighterRanges;
FRootCodeFoldBlock: TSynCustomCodeFoldBlock; FRootCodeFoldBlock: TSynCustomCodeFoldBlock;
protected protected
function GetFoldConfig(Index: Integer): Boolean; virtual;
function GetFoldConfigCount: Integer; virtual;
procedure SetFoldConfig(Index: Integer; const AValue: Boolean); virtual;
function GetFoldNodeInfo(Line, Index: Integer): TSynFoldNodeInfo; virtual; function GetFoldNodeInfo(Line, Index: Integer): TSynFoldNodeInfo; virtual;
function GetFoldNodeInfoCount(Line: Integer): Integer; virtual; function GetFoldNodeInfoCount(Line: Integer): Integer; virtual;
property CodeFoldRange: TSynCustomHighlighterRange read FCodeFoldRange; property CodeFoldRange: TSynCustomHighlighterRange read FCodeFoldRange;
@ -159,6 +163,11 @@ type
procedure SetLine({$IFDEF FPC}const {$ENDIF}NewValue: String; procedure SetLine({$IFDEF FPC}const {$ENDIF}NewValue: String;
LineNumber:Integer // 0 based LineNumber:Integer // 0 based
); override; ); override;
public
property FoldConfig[Index: Integer]: Boolean
read GetFoldConfig write SetFoldConfig;
property FoldConfigCount: Integer read GetFoldConfigCount;
end; end;
{ TSynCustomHighlighterRanges } { TSynCustomHighlighterRanges }
@ -316,6 +325,20 @@ begin
Result := 0; Result := 0;
end; end;
function TSynCustomFoldHighlighter.GetFoldConfig(Index: Integer): Boolean;
begin
Result := False;
end;
function TSynCustomFoldHighlighter.GetFoldConfigCount: Integer;
begin
Result := 0;
end;
procedure TSynCustomFoldHighlighter.SetFoldConfig(Index: Integer; const AValue: Boolean);
begin
end;
function TSynCustomFoldHighlighter.GetFoldNodeInfo(Line, Index: Integer): TSynFoldNodeInfo; function TSynCustomFoldHighlighter.GetFoldNodeInfo(Line, Index: Integer): TSynFoldNodeInfo;
begin begin
Result.FoldAction := [sfaInvalid]; Result.FoldAction := [sfaInvalid];

View File

@ -91,11 +91,13 @@ type
{$IFDEF SYN_LAZARUS} {$IFDEF SYN_LAZARUS}
TPascalCodeFoldBlockType = ( TPascalCodeFoldBlockType = (
cfbtNone, cfbtNone,
cfbtBeginEnd, cfbtBeginEnd, // Nested
cfbtTopBeginEnd, // Begin of Procedure
cfbtNestedComment, cfbtNestedComment,
cfbtProcedure, cfbtProcedure,
cfbtUses, cfbtUses,
cfbtVarType, cfbtVarType,
cfbtLocalVarType,
cfbtClass, cfbtClass,
cfbtClassSection, cfbtClassSection,
cfbtUnitSection, cfbtUnitSection,
@ -104,7 +106,9 @@ type
cfbtRecord, cfbtRecord,
cfbtTry, cfbtTry,
cfbtExcept, cfbtExcept,
cfbtRepeat cfbtRepeat,
cfbtAsm,
cfbtCase
); );
TPascalCodeFoldBlockTypes = set of TPascalCodeFoldBlockType; TPascalCodeFoldBlockTypes = set of TPascalCodeFoldBlockType;
@ -115,8 +119,8 @@ const
cfbtAll: TPascalCodeFoldBlockTypes = cfbtAll: TPascalCodeFoldBlockTypes =
[low(TPascalCodeFoldBlockType)..high(TPascalCodeFoldBlockType)]; [low(TPascalCodeFoldBlockType)..high(TPascalCodeFoldBlockType)];
PascalWordTrippletRanges: TPascalCodeFoldBlockTypes = PascalWordTrippletRanges: TPascalCodeFoldBlockTypes =
[cfbtBeginEnd, cfbtProcedure, cfbtClass, cfbtProgram, cfbtRecord, [cfbtBeginEnd, cfbtTopBeginEnd, cfbtProcedure, cfbtClass, cfbtProgram, cfbtRecord,
cfbtTry, cfbtExcept, cfbtRepeat cfbtTry, cfbtExcept, cfbtRepeat, cfbtAsm, cfbtCase
]; ];
type type
@ -237,6 +241,7 @@ type
FNodeInfoLine, FNodeInfoCount: Integer; FNodeInfoLine, FNodeInfoCount: Integer;
FNodeInfoList: Array of TSynFoldNodeInfo; FNodeInfoList: Array of TSynFoldNodeInfo;
FDividerDrawConfig: Array [TSynPasDividerDrawLocation] of TSynDividerDrawConfig; FDividerDrawConfig: Array [TSynPasDividerDrawLocation] of TSynDividerDrawConfig;
FFoldConfig: Array [TPascalCodeFoldBlockType] of Boolean;
procedure GrowNodeInfoList; procedure GrowNodeInfoList;
function GetPasCodeFoldRange: TSynPasSynRange; function GetPasCodeFoldRange: TSynPasSynRange;
procedure SetCompilerMode(const AValue: TPascalCompilerMode); procedure SetCompilerMode(const AValue: TPascalCompilerMode);
@ -369,7 +374,12 @@ type
ABlockType: TPascalCodeFoldBlockType); ABlockType: TPascalCodeFoldBlockType);
procedure CreateDividerDrawConfig; procedure CreateDividerDrawConfig;
procedure DestroyDividerDrawConfig; procedure DestroyDividerDrawConfig;
procedure InitFoldConfig;
protected protected
function GetFoldConfig(Index: Integer): Boolean; override;
function GetFoldConfigCount: Integer; override;
procedure SetFoldConfig(Index: Integer; const AValue: Boolean); override;
function GetFoldNodeInfo(Line, Index: Integer): TSynFoldNodeInfo; override; function GetFoldNodeInfo(Line, Index: Integer): TSynFoldNodeInfo; override;
function GetFoldNodeInfoCount(Line: Integer): Integer; override; function GetFoldNodeInfoCount(Line: Integer): Integer; override;
@ -377,8 +387,8 @@ type
function IsFilterStored: boolean; override; //mh 2000-10-08 function IsFilterStored: boolean; override; //mh 2000-10-08
procedure CreateRootCodeFoldBlock; override; procedure CreateRootCodeFoldBlock; override;
function StartPascalCodeFoldBlock(ABlockType: TPascalCodeFoldBlockType; function StartPascalCodeFoldBlock(ABlockType: TPascalCodeFoldBlockType):
SubBlock: boolean = false): TSynCustomCodeFoldBlock; TSynCustomCodeFoldBlock;
procedure EndCodeFoldBlock(DecreaseLevel: Boolean = True); override; procedure EndCodeFoldBlock(DecreaseLevel: Boolean = True); override;
procedure CloseBeginEndBlocks; procedure CloseBeginEndBlocks;
procedure EndCodeFoldBlockLastLine; procedure EndCodeFoldBlockLastLine;
@ -871,14 +881,15 @@ begin
EndCodeFoldBlock; EndCodeFoldBlock;
end else if TopPascalCodeFoldBlockType = cfbtTry then begin end else if TopPascalCodeFoldBlockType = cfbtTry then begin
EndCodeFoldBlock; EndCodeFoldBlock;
end else if TopPascalCodeFoldBlockType = cfbtBeginEnd then begin end else if TopPascalCodeFoldBlockType in [cfbtTopBeginEnd, cfbtAsm] then begin
EndCodeFoldBlock; EndCodeFoldBlock;
if TopPascalCodeFoldBlockType = cfbtProcedure then if TopPascalCodeFoldBlockType = cfbtProcedure then
EndCodeFoldBlock; EndCodeFoldBlock;
if TopPascalCodeFoldBlockType = cfbtProgram then if TopPascalCodeFoldBlockType = cfbtProgram then
EndCodeFoldBlock; EndCodeFoldBlock;
end end else if TopPascalCodeFoldBlockType in [cfbtBeginEnd, cfbtCase] then begin
else if TopPascalCodeFoldBlockType = cfbtUnitSection then begin EndCodeFoldBlock;
end else if TopPascalCodeFoldBlockType = cfbtUnitSection then begin
EndCodeFoldBlockLastLine; EndCodeFoldBlockLastLine;
if TopPascalCodeFoldBlockType = cfbtUnit then // "Unit".."end." if TopPascalCodeFoldBlockType = cfbtUnit then // "Unit".."end."
EndCodeFoldBlock; EndCodeFoldBlock;
@ -915,8 +926,8 @@ begin
end else end else
if KeyComp('Case') then begin if KeyComp('Case') then begin
if TopPascalCodeFoldBlockType in if TopPascalCodeFoldBlockType in
[cfbtBeginEnd, cfbtTry, cfbtExcept, cfbtRepeat] then [cfbtBeginEnd, cfbtTopBeginEnd, cfbtCase, cfbtTry, cfbtExcept, cfbtRepeat] then
StartPascalCodeFoldBlock(cfbtBeginEnd,true); StartPascalCodeFoldBlock(cfbtCase);
Result := tkKey; Result := tkKey;
end else Result := tkIdentifier; end else Result := tkIdentifier;
end; end;
@ -944,7 +955,7 @@ begin
fRange := fRange + [rsAsm]; fRange := fRange + [rsAsm];
fAsmStart := True; fAsmStart := True;
{$IFDEF SYN_LAZARUS} {$IFDEF SYN_LAZARUS}
StartPascalCodeFoldBlock(cfbtBeginEnd); StartPascalCodeFoldBlock(cfbtAsm);
//debugln('TSynPasSyn.Func37 BEGIN ',dbgs(ord(TopPascalCodeFoldBlockType)),' LineNumber=',dbgs(fLineNumber),' ',dbgs(MinimumCodeFoldBlockLevel),' ',dbgs(CurrentCodeFoldBlockLevel)); //debugln('TSynPasSyn.Func37 BEGIN ',dbgs(ord(TopPascalCodeFoldBlockType)),' LineNumber=',dbgs(fLineNumber),' ',dbgs(MinimumCodeFoldBlockLevel),' ',dbgs(CurrentCodeFoldBlockLevel));
{$ENDIF} {$ENDIF}
end else Result := tkIdentifier; end else Result := tkIdentifier;
@ -964,12 +975,13 @@ begin
if (fRange * [rsImplementation, rsInterface] = []) then if (fRange * [rsImplementation, rsInterface] = []) then
Include(fRange, rsImplementation); Include(fRange, rsImplementation);
PasCodeFoldRange.BracketNestLevel := 0; // Reset in case of partial code PasCodeFoldRange.BracketNestLevel := 0; // Reset in case of partial code
if TopPascalCodeFoldBlockType=cfbtVarType then EndCodeFoldBlockLastLine; if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
EndCodeFoldBlockLastLine;
Result := tkKey; Result := tkKey;
{$IFDEF SYN_LAZARUS} if TopPascalCodeFoldBlockType in [cfbtProcedure]
StartPascalCodeFoldBlock(cfbtBeginEnd); then StartPascalCodeFoldBlock(cfbtTopBeginEnd)
else StartPascalCodeFoldBlock(cfbtBeginEnd);
//debugln('TSynPasSyn.Func37 BEGIN ',dbgs(ord(TopPascalCodeFoldBlockType)),' LineNumber=',dbgs(fLineNumber),' ',dbgs(MinimumCodeFoldBlockLevel),' ',dbgs(CurrentCodeFoldBlockLevel)); //debugln('TSynPasSyn.Func37 BEGIN ',dbgs(ord(TopPascalCodeFoldBlockType)),' LineNumber=',dbgs(fLineNumber),' ',dbgs(MinimumCodeFoldBlockLevel),' ',dbgs(CurrentCodeFoldBlockLevel));
{$ENDIF}
end else end else
Result := tkIdentifier; Result := tkIdentifier;
end; end;
@ -997,9 +1009,13 @@ begin
else if KeyComp('Var') then begin else if KeyComp('Var') then begin
if (PasCodeFoldRange.BracketNestLevel = 0) and if (PasCodeFoldRange.BracketNestLevel = 0) and
(TopPascalCodeFoldBlockType in (TopPascalCodeFoldBlockType in
[cfbtVarType, cfbtNone, cfbtProcedure, cfbtProgram, cfbtUnit, cfbtUnitSection]) then begin [cfbtVarType, cfbtLocalVarType, cfbtNone, cfbtProcedure, cfbtProgram,
if TopPascalCodeFoldBlockType=cfbtVarType then EndCodeFoldBlockLastLine; cfbtUnit, cfbtUnitSection]) then begin
StartPascalCodeFoldBlock(cfbtVarType); if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
EndCodeFoldBlockLastLine;
if TopPascalCodeFoldBlockType in [cfbtProcedure]
then StartPascalCodeFoldBlock(cfbtLocalVarType)
else StartPascalCodeFoldBlock(cfbtVarType);
end; end;
Result := tkKey; Result := tkKey;
end end
@ -1115,8 +1131,8 @@ begin
else if KeyComp('Try') then else if KeyComp('Try') then
begin begin
if TopPascalCodeFoldBlockType in if TopPascalCodeFoldBlockType in
[cfbtBeginEnd, cfbtTry, cfbtExcept, cfbtRepeat] then [cfbtBeginEnd, cfbtTopBeginEnd, cfbtCase, cfbtTry, cfbtExcept, cfbtRepeat] then
StartPascalCodeFoldBlock(cfbtTry,true); StartPascalCodeFoldBlock(cfbtTry);
Result := tkKey; Result := tkKey;
end end
else if KeyComp('Inline') then Result := tkKey else Result := tkIdentifier; else if KeyComp('Inline') then Result := tkKey else Result := tkIdentifier;
@ -1131,7 +1147,6 @@ begin
else if KeyComp('Uses') then begin else if KeyComp('Uses') then begin
if (TopPascalCodeFoldBlockType in if (TopPascalCodeFoldBlockType in
[cfbtNone, cfbtProgram, cfbtUnit, cfbtUnitSection]) then begin [cfbtNone, cfbtProgram, cfbtUnit, cfbtUnitSection]) then begin
if TopPascalCodeFoldBlockType=cfbtVarType then EndCodeFoldBlockLastLine;
StartPascalCodeFoldBlock(cfbtUses); StartPascalCodeFoldBlock(cfbtUses);
end; end;
Result := tkKey; Result := tkKey;
@ -1143,7 +1158,7 @@ function TSynPasSyn.Func65: TtkTokenKind;
begin begin
if KeyComp('Repeat') then begin if KeyComp('Repeat') then begin
Result := tkKey; Result := tkKey;
StartPascalCodeFoldBlock(cfbtRepeat, True); StartPascalCodeFoldBlock(cfbtRepeat);
end end
else Result := tkIdentifier; else Result := tkIdentifier;
end; end;
@ -1153,11 +1168,14 @@ begin
if KeyComp('Type') then begin if KeyComp('Type') then begin
if (PasCodeFoldRange.BracketNestLevel = 0) if (PasCodeFoldRange.BracketNestLevel = 0)
and (TopPascalCodeFoldBlockType in and (TopPascalCodeFoldBlockType in
[cfbtVarType, cfbtNone, cfbtProcedure, cfbtProgram, cfbtUnit, cfbtUnitSection]) [cfbtVarType, cfbtLocalVarType, cfbtNone, cfbtProcedure, cfbtProgram,
and not(rsAfterEqual in fRange) cfbtUnit, cfbtUnitSection]) and not(rsAfterEqual in fRange)
then begin then begin
if TopPascalCodeFoldBlockType=cfbtVarType then EndCodeFoldBlockLastLine; if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
StartPascalCodeFoldBlock(cfbtVarType); EndCodeFoldBlockLastLine;
if TopPascalCodeFoldBlockType in [cfbtProcedure]
then StartPascalCodeFoldBlock(cfbtLocalVarType)
else StartPascalCodeFoldBlock(cfbtVarType);
end; end;
Result := tkKey; Result := tkKey;
end end
@ -1178,9 +1196,13 @@ begin
else if KeyComp('Const') then begin else if KeyComp('Const') then begin
if (PasCodeFoldRange.BracketNestLevel = 0) and if (PasCodeFoldRange.BracketNestLevel = 0) and
(TopPascalCodeFoldBlockType in (TopPascalCodeFoldBlockType in
[cfbtVarType, cfbtNone, cfbtProcedure, cfbtProgram, cfbtUnit, cfbtUnitSection]) then begin [cfbtVarType, cfbtLocalVarType, cfbtNone, cfbtProcedure, cfbtProgram,
if TopPascalCodeFoldBlockType=cfbtVarType then EndCodeFoldBlockLastLine; cfbtUnit, cfbtUnitSection]) then begin
StartPascalCodeFoldBlock(cfbtVarType); if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
EndCodeFoldBlockLastLine;
if TopPascalCodeFoldBlockType in [cfbtProcedure]
then StartPascalCodeFoldBlock(cfbtLocalVarType)
else StartPascalCodeFoldBlock(cfbtVarType);
end; end;
Result := tkKey; Result := tkKey;
end end
@ -1197,7 +1219,7 @@ begin
if KeyComp('Except') then begin if KeyComp('Except') then begin
Result := tkKey; Result := tkKey;
if TopPascalCodeFoldBlockType = cfbtTry then if TopPascalCodeFoldBlockType = cfbtTry then
StartPascalCodeFoldBlock(cfbtExcept, True); StartPascalCodeFoldBlock(cfbtExcept);
end end
else Result := tkIdentifier; else Result := tkIdentifier;
end; end;
@ -1224,7 +1246,7 @@ begin
if KeyComp('Finally') then begin if KeyComp('Finally') then begin
Result := tkKey; Result := tkKey;
if TopPascalCodeFoldBlockType = cfbtTry then if TopPascalCodeFoldBlockType = cfbtTry then
StartPascalCodeFoldBlock(cfbtExcept, True); StartPascalCodeFoldBlock(cfbtExcept);
end end
else Result := tkIdentifier; else Result := tkIdentifier;
end; end;
@ -1240,7 +1262,8 @@ begin
(fRange * [rsInterface, rsImplementation] = []) then (fRange * [rsInterface, rsImplementation] = []) then
begin begin
CloseBeginEndBlocks; CloseBeginEndBlocks;
if TopPascalCodeFoldBlockType=cfbtVarType then EndCodeFoldBlockLastLine; if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
EndCodeFoldBlockLastLine;
if TopPascalCodeFoldBlockType=cfbtUnitSection then EndCodeFoldBlockLastLine; if TopPascalCodeFoldBlockType=cfbtUnitSection then EndCodeFoldBlockLastLine;
StartPascalCodeFoldBlock(cfbtUnitSection); StartPascalCodeFoldBlock(cfbtUnitSection);
fRange := fRange + [rsInterface]; fRange := fRange + [rsInterface];
@ -1378,7 +1401,8 @@ begin
if not(rsAfterEqual in fRange) then begin if not(rsAfterEqual in fRange) then begin
PasCodeFoldRange.BracketNestLevel := 0; // Reset in case of partial code PasCodeFoldRange.BracketNestLevel := 0; // Reset in case of partial code
CloseBeginEndBlocks; CloseBeginEndBlocks;
if TopPascalCodeFoldBlockType=cfbtVarType then EndCodeFoldBlockLastLine; if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
EndCodeFoldBlockLastLine;
if ((rsImplementation in fRange) and if ((rsImplementation in fRange) and
not(TopPascalCodeFoldBlockType in [cfbtClass, cfbtClassSection])) not(TopPascalCodeFoldBlockType in [cfbtClass, cfbtClassSection]))
then then
@ -1400,7 +1424,8 @@ begin
if not(rsAfterEqual in fRange) then begin if not(rsAfterEqual in fRange) then begin
PasCodeFoldRange.BracketNestLevel := 0; // Reset in case of partial code PasCodeFoldRange.BracketNestLevel := 0; // Reset in case of partial code
CloseBeginEndBlocks; CloseBeginEndBlocks;
if TopPascalCodeFoldBlockType=cfbtVarType then EndCodeFoldBlockLastLine; if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
EndCodeFoldBlockLastLine;
if ((rsImplementation in fRange) and if ((rsImplementation in fRange) and
not(TopPascalCodeFoldBlockType in [cfbtClass, cfbtClassSection])) not(TopPascalCodeFoldBlockType in [cfbtClass, cfbtClassSection]))
then then
@ -1499,7 +1524,8 @@ begin
if KeyComp('Finalization') then begin if KeyComp('Finalization') then begin
PasCodeFoldRange.BracketNestLevel := 0; // Reset in case of partial code PasCodeFoldRange.BracketNestLevel := 0; // Reset in case of partial code
CloseBeginEndBlocks; CloseBeginEndBlocks;
if TopPascalCodeFoldBlockType=cfbtVarType then EndCodeFoldBlockLastLine; if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
EndCodeFoldBlockLastLine;
if TopPascalCodeFoldBlockType=cfbtUnitSection then EndCodeFoldBlockLastLine; if TopPascalCodeFoldBlockType=cfbtUnitSection then EndCodeFoldBlockLastLine;
StartPascalCodeFoldBlock(cfbtUnitSection); StartPascalCodeFoldBlock(cfbtUnitSection);
fRange := fRange - [rsInterface] + [rsImplementation]; fRange := fRange - [rsInterface] + [rsImplementation];
@ -1524,7 +1550,8 @@ begin
begin begin
PasCodeFoldRange.BracketNestLevel := 0; // Reset in case of partial code PasCodeFoldRange.BracketNestLevel := 0; // Reset in case of partial code
CloseBeginEndBlocks; CloseBeginEndBlocks;
if TopPascalCodeFoldBlockType = cfbtVarType then EndCodeFoldBlockLastLine; if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
EndCodeFoldBlockLastLine;
if ((rsImplementation in fRange) and if ((rsImplementation in fRange) and
not(TopPascalCodeFoldBlockType in [cfbtClass, cfbtClassSection])) not(TopPascalCodeFoldBlockType in [cfbtClass, cfbtClassSection]))
then then
@ -1544,7 +1571,8 @@ begin
if not(rsAfterEqual in fRange) then begin if not(rsAfterEqual in fRange) then begin
PasCodeFoldRange.BracketNestLevel := 0; // Reset in case of partial code PasCodeFoldRange.BracketNestLevel := 0; // Reset in case of partial code
CloseBeginEndBlocks; CloseBeginEndBlocks;
if TopPascalCodeFoldBlockType=cfbtVarType then EndCodeFoldBlockLastLine; if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
EndCodeFoldBlockLastLine;
if ((rsImplementation in fRange) and if ((rsImplementation in fRange) and
not(TopPascalCodeFoldBlockType in [cfbtClass, cfbtClassSection])) not(TopPascalCodeFoldBlockType in [cfbtClass, cfbtClassSection]))
then then
@ -1555,7 +1583,8 @@ begin
if KeyComp('Implementation') then begin if KeyComp('Implementation') then begin
PasCodeFoldRange.BracketNestLevel := 0; // Reset in case of partial code PasCodeFoldRange.BracketNestLevel := 0; // Reset in case of partial code
CloseBeginEndBlocks; CloseBeginEndBlocks;
if TopPascalCodeFoldBlockType=cfbtVarType then EndCodeFoldBlockLastLine; if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
EndCodeFoldBlockLastLine;
if TopPascalCodeFoldBlockType=cfbtUnitSection then EndCodeFoldBlockLastLine; if TopPascalCodeFoldBlockType=cfbtUnitSection then EndCodeFoldBlockLastLine;
StartPascalCodeFoldBlock(cfbtUnitSection); StartPascalCodeFoldBlock(cfbtUnitSection);
fRange := fRange - [rsInterface] + [rsImplementation]; fRange := fRange - [rsInterface] + [rsImplementation];
@ -1575,7 +1604,8 @@ begin
if KeyComp('Initialization') then begin if KeyComp('Initialization') then begin
PasCodeFoldRange.BracketNestLevel := 0; // Reset in case of partial code PasCodeFoldRange.BracketNestLevel := 0; // Reset in case of partial code
CloseBeginEndBlocks; CloseBeginEndBlocks;
if TopPascalCodeFoldBlockType=cfbtVarType then EndCodeFoldBlockLastLine; if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
EndCodeFoldBlockLastLine;
if TopPascalCodeFoldBlockType=cfbtUnitSection then EndCodeFoldBlockLastLine; if TopPascalCodeFoldBlockType=cfbtUnitSection then EndCodeFoldBlockLastLine;
StartPascalCodeFoldBlock(cfbtUnitSection); StartPascalCodeFoldBlock(cfbtUnitSection);
fRange := fRange - [rsInterface] + [rsImplementation]; fRange := fRange - [rsInterface] + [rsImplementation];
@ -1703,6 +1733,7 @@ constructor TSynPasSyn.Create(AOwner: TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
CreateDividerDrawConfig; CreateDividerDrawConfig;
InitFoldConfig;
fD4syntax := true; fD4syntax := true;
fAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler); fAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler);
AddAttribute(fAsmAttri); AddAttribute(fAsmAttri);
@ -2478,11 +2509,12 @@ begin
end; end;
function TSynPasSyn.StartPascalCodeFoldBlock( function TSynPasSyn.StartPascalCodeFoldBlock(
ABlockType: TPascalCodeFoldBlockType; ABlockType: TPascalCodeFoldBlockType): TSynCustomCodeFoldBlock;
SubBlock: boolean): TSynCustomCodeFoldBlock;
var var
p: PtrInt; p: PtrInt;
FoldBlock: Boolean;
begin begin
FoldBlock := FFoldConfig[ABlockType];
p := 0; p := 0;
if FCatchNodeInfo then begin // exclude subblocks, because they do not increase the foldlevel yet if FCatchNodeInfo then begin // exclude subblocks, because they do not increase the foldlevel yet
GrowNodeInfoList; GrowNodeInfoList;
@ -2491,10 +2523,10 @@ begin
include(FNodeInfoList[FNodeInfoCount].FoldAction, sfaOpen); include(FNodeInfoList[FNodeInfoCount].FoldAction, sfaOpen);
inc(FNodeInfoCount); inc(FNodeInfoCount);
end; end;
if SubBlock then if not FoldBlock then
p := PtrInt(CountPascalCodeFoldBlockOffset); p := PtrInt(CountPascalCodeFoldBlockOffset);
Result:=TSynCustomCodeFoldBlock( Result:=TSynCustomCodeFoldBlock(
inherited StartCodeFoldBlock(p+Pointer(PtrInt(ABlockType)), not SubBlock)); inherited StartCodeFoldBlock(p+Pointer(PtrInt(ABlockType)), FoldBlock));
end; end;
procedure TSynPasSyn.EndCodeFoldBlock(DecreaseLevel: Boolean); procedure TSynPasSyn.EndCodeFoldBlock(DecreaseLevel: Boolean);
@ -2513,10 +2545,12 @@ end;
procedure TSynPasSyn.CloseBeginEndBlocks; procedure TSynPasSyn.CloseBeginEndBlocks;
begin begin
if not(TopPascalCodeFoldBlockType in if not(TopPascalCodeFoldBlockType in
[cfbtBeginEnd, cfbtExcept, cfbtTry, cfbtRepeat]) then [cfbtBeginEnd, cfbtTopBeginEnd, cfbtCase, cfbtAsm, cfbtExcept, cfbtTry,
cfbtRepeat]) then
exit; exit;
while TopPascalCodeFoldBlockType in while TopPascalCodeFoldBlockType in
[cfbtBeginEnd, cfbtExcept, cfbtTry, cfbtRepeat] do [cfbtBeginEnd, cfbtTopBeginEnd, cfbtCase, cfbtAsm, cfbtExcept, cfbtTry,
cfbtRepeat] do
EndCodeFoldBlockLastLine; EndCodeFoldBlockLastLine;
if TopPascalCodeFoldBlockType = cfbtProcedure then if TopPascalCodeFoldBlockType = cfbtProcedure then
EndCodeFoldBlockLastLine; // This procedure did have a begin/end block, so it must end too EndCodeFoldBlockLastLine; // This procedure did have a begin/end block, so it must end too
@ -2615,27 +2649,25 @@ begin
cfbtUses: cfbtUses:
if FDividerDrawConfig[pddlUses].MaxDrawDepth > 0 then if FDividerDrawConfig[pddlUses].MaxDrawDepth > 0 then
exit(FDividerDrawConfig[pddlUses].TopSetting); exit(FDividerDrawConfig[pddlUses].TopSetting);
cfbtLocalVarType:
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;
cfbtVarType: cfbtVarType:
if nxt = cfbtProcedure then begin if FDividerDrawConfig[pddlVarGlobal].MaxDrawDepth > 0 then
if CheckFoldNestLevel(FDividerDrawConfig[pddlVarLocal].MaxDrawDepth - 1, exit(FDividerDrawConfig[pddlVarGlobal].TopSetting);
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(FDividerDrawConfig[pddlVarGlobal].TopSetting);
cfbtClass, cfbtRecord: cfbtClass, cfbtRecord:
begin begin
if CheckFoldNestLevel(0, i + 1, [cfbtProcedure], if CheckFoldNestLevel(0, i + 1, [cfbtProcedure],
cfbtAll - [cfbtVarType], c) cfbtAll - [cfbtVarType, cfbtLocalVarType], c)
then t := pddlStructGlobal then t := pddlStructGlobal
else t := pddlStructLocal; else t := pddlStructLocal;
if CheckFoldNestLevel(FDividerDrawConfig[t].MaxDrawDepth - 1, if CheckFoldNestLevel(FDividerDrawConfig[t].MaxDrawDepth - 1,
i + 1, [cfbtClass, cfbtRecord], i + 1, [cfbtClass, cfbtRecord],
cfbtAll - [cfbtVarType], c) then begin cfbtAll - [cfbtVarType, cfbtLocalVarType], c) then begin
if c = 0 if c = 0
then exit(FDividerDrawConfig[t].TopSetting) then exit(FDividerDrawConfig[t].TopSetting)
else exit(FDividerDrawConfig[t].NestSetting); else exit(FDividerDrawConfig[t].NestSetting);
@ -2648,14 +2680,14 @@ begin
then exit(FDividerDrawConfig[pddlProcedure].TopSetting) then exit(FDividerDrawConfig[pddlProcedure].TopSetting)
else exit(FDividerDrawConfig[pddlProcedure].NestSetting); else exit(FDividerDrawConfig[pddlProcedure].NestSetting);
end; end;
cfbtBeginEnd, cfbtRepeat: cfbtTopBeginEnd:
if CheckFoldNestLevel(FDividerDrawConfig[pddlBeginEnd].MaxDrawDepth - 1, if FDividerDrawConfig[pddlBeginEnd].MaxDrawDepth > 0 then
i + 1, [cfbtBeginEnd, cfbtRepeat], exit(FDividerDrawConfig[pddlBeginEnd].TopSetting);
cfbtAll - [cfbtProcedure], c) then begin cfbtBeginEnd, cfbtRepeat, cfbtCase, cfbtAsm:
if c = 0 if CheckFoldNestLevel(FDividerDrawConfig[pddlBeginEnd].MaxDrawDepth - 2,
then exit(FDividerDrawConfig[pddlBeginEnd].TopSetting) i + 1, [cfbtBeginEnd, cfbtRepeat, cfbtCase, cfbtAsm],
else exit(FDividerDrawConfig[pddlBeginEnd].NestSetting); cfbtAll - [cfbtProcedure, cfbtTopBeginEnd], c) then
end; exit(FDividerDrawConfig[pddlBeginEnd].NestSetting);
cfbtTry: cfbtTry:
if CheckFoldNestLevel(FDividerDrawConfig[pddlTry].MaxDrawDepth - 1, if CheckFoldNestLevel(FDividerDrawConfig[pddlTry].MaxDrawDepth - 1,
i + 1, [cfbtTry], cfbtAll - [cfbtProcedure], c) i + 1, [cfbtTry], cfbtAll - [cfbtProcedure], c)
@ -2698,6 +2730,40 @@ begin
FreeAndNil(FDividerDrawConfig[i]); FreeAndNil(FDividerDrawConfig[i]);
end; end;
procedure TSynPasSyn.InitFoldConfig;
var
i: TPascalCodeFoldBlockType;
begin
for i := low(TPascalCodeFoldBlockType) to high(TPascalCodeFoldBlockType) do
FFoldConfig[i] := i in [cfbtBeginEnd, cfbtTopBeginEnd, cfbtNestedComment,
cfbtProcedure, cfbtUses, cfbtLocalVarType, cfbtClass,
cfbtClassSection, cfbtRecord, cfbtRepeat, cfbtCase,
cfbtAsm];
end;
function TSynPasSyn.GetFoldConfig(Index: Integer): Boolean;
begin
// + 1 as we skip cfbtNone;
Result := FFoldConfig[TPascalCodeFoldBlockType(Index + 1)];
end;
function TSynPasSyn.GetFoldConfigCount: Integer;
begin
// excluded cfbtNone;
Result := ord(high(TPascalCodeFoldBlockType)) -
ord(low(TPascalCodeFoldBlockType));
end;
procedure TSynPasSyn.SetFoldConfig(Index: Integer; const AValue: Boolean);
begin
if FFoldConfig[TPascalCodeFoldBlockType(Index + 1)] = AValue then
exit;
FFoldConfig[TPascalCodeFoldBlockType(Index + 1)] := AValue;
FAttributeChangeNeedScan := True;
DefHighlightChange(self);
// Todo: Since all synedits will rescan => delete all foldranges
end;
function TSynPasSyn.GetDividerDrawConfig(Index: Integer): TSynDividerDrawConfig; function TSynPasSyn.GetDividerDrawConfig(Index: Integer): TSynDividerDrawConfig;
begin begin
Result := FDividerDrawConfig[TSynPasDividerDrawLocation(Index)]; Result := FDividerDrawConfig[TSynPasDividerDrawLocation(Index)];

View File

@ -39,7 +39,7 @@ uses
// LCL // LCL
Controls, Graphics, LCLProc, FileUtil, LResources, Controls, Graphics, LCLProc, FileUtil, LResources,
// synedit // synedit
SynEdit, SynEditAutoComplete, SynEditHighlighter, SynEditKeyCmds, SynEdit, SynEditAutoComplete, SynEditHighlighter, SynEditHighlighterFoldBase, SynEditKeyCmds,
SynEditStrConst, SynEditMarkupBracket, SynEditMarkupHighAll, SynEditMarkupWordGroup, SynEditStrConst, SynEditMarkupBracket, SynEditMarkupHighAll, SynEditMarkupWordGroup,
SynGutter, SynGutterBase, SynGutterCodeFolding, SynGutterLineNumber, SynGutterChanges, SynGutter, SynGutterBase, SynGutterCodeFolding, SynGutterLineNumber, SynGutterChanges,
SynHighlighterCPP, SynHighlighterHTML, SynHighlighterJava, SynHighlighterLFM, SynHighlighterCPP, SynHighlighterHTML, SynHighlighterJava, SynHighlighterLFM,
@ -387,6 +387,85 @@ const
(Count: 0; Info: nil) // jscript (Count: 0; Info: nil) // jscript
); );
type
TEditorOptionsFoldInfo = record
Name: String; // Name for display
Xml: String; // Name for XML
Index: Integer; // FHighlighter.FoldConf[index]
Enabled: Boolean;
end;
TEditorOptionsFoldInfoList = Array [0..999] of TEditorOptionsFoldInfo;
PEditorOptionsFoldInfoList = ^TEditorOptionsFoldInfoList;
TEditorOptionsFoldRecord = record
Count: Integer;
Info: PEditorOptionsFoldInfoList;
end;
const
EditorOptionsFoldInfoPas: Array [0..17] of TEditorOptionsFoldInfo
= (
(Name: dlgFoldPasProcedure; Xml: 'Procedure';
Index: ord(cfbtProcedure)-1; Enabled: True),
(Name: dlgFoldLocalPasVarType; Xml: 'LocalVarType';
Index: ord(cfbtLocalVarType)-1; Enabled: True),
(Name: dlgFoldPasProcBeginEnd; Xml: 'ProcBeginEnd';
Index: ord(cfbtTopBeginEnd)-1; Enabled: True),
(Name: dlgFoldPasBeginEnd; Xml: 'BeginEnd';
Index: ord(cfbtBeginEnd)-1; Enabled: True),
(Name: dlgFoldPasRepeat; Xml: 'Repeat';
Index: ord(cfbtRepeat)-1; Enabled: False),
(Name: dlgFoldPasCase; Xml: 'Case';
Index: ord(cfbtCase)-1; Enabled: False),
(Name: dlgFoldPasTry; Xml: 'Try';
Index: ord(cfbtTry)-1; Enabled: False),
(Name: dlgFoldPasExcept; Xml: 'Except';
Index: ord(cfbtExcept)-1; Enabled: False),
(Name: dlgFoldPasAsm; Xml: 'Asm';
Index: ord(cfbtAsm)-1; Enabled: True),
(Name: dlgFoldPasProgram; Xml: 'Program';
Index: ord(cfbtProgram)-1; Enabled: False),
(Name: dlgFoldPasUnit; Xml: 'Unit';
Index: ord(cfbtUnit)-1; Enabled: False),
(Name: dlgFoldPasUnitSection; Xml: 'UnitSection';
Index: ord(cfbtUnitSection)-1; Enabled: False),
(Name: dlgFoldPasUses; Xml: 'Uses';
Index: ord(cfbtUses)-1; Enabled: True),
(Name: dlgFoldPasVarType; Xml: 'VarType';
Index: ord(cfbtVarType)-1; Enabled: False),
(Name: dlgFoldPasClass; Xml: 'Class';
Index: ord(cfbtClass)-1; Enabled: True),
(Name: dlgFoldPasClassSection; Xml: 'ClassSection';
Index: ord(cfbtClassSection)-1; Enabled: True),
(Name: dlgFoldPasRecord; Xml: 'Record';
Index: ord(cfbtRecord)-1; Enabled: True),
(Name: dlgFoldPasNestedComment; Xml: 'NestedComment';
Index: ord(cfbtNestedComment)-1;Enabled: True)
);
EditorOptionsFoldDefaults: array[TLazSyntaxHighlighter] of
TEditorOptionsFoldRecord =
( (Count: 0; Info: nil), // none
(Count: 0; Info: nil), // text
(Count: 18; Info: {$IFDEF FPC}@{$ENDIF}EditorOptionsFoldInfoPas[0]), // Freepas
(Count: 18; Info: {$IFDEF FPC}@{$ENDIF}EditorOptionsFoldInfoPas[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 const
EditorOptsFormatVersion = 4; EditorOptsFormatVersion = 4;
@ -2317,11 +2396,12 @@ var
Conf: TSynDividerDrawConfig; Conf: TSynDividerDrawConfig;
ConfName: String; ConfName: String;
Path: String; Path: String;
i: Integer; i, h: Integer;
TheFoldInfo: TEditorOptionsFoldRecord;
begin begin
i := HighlighterList.FindByHighlighter(Syn); h := HighlighterList.FindByHighlighter(Syn);
if i < 0 then exit; if h < 0 then exit;
TheInfo := EditorOptionsDividerDefaults[HighlighterList[i].TheType]; TheInfo := EditorOptionsDividerDefaults[HighlighterList[h].TheType];
ReadDefaultsForHighlighterFoldSettings(Syn); ReadDefaultsForHighlighterFoldSettings(Syn);
@ -2338,35 +2418,56 @@ begin
Conf.NestColor := XMLConfig.GetValue(Path + 'NestColor/Value', Conf.NestColor := XMLConfig.GetValue(Path + 'NestColor/Value',
Conf.NestColor); Conf.NestColor);
end; end;
if (syn is TSynCustomFoldHighlighter) then begin
TheFoldInfo := EditorOptionsFoldDefaults[HighlighterList[h].TheType];
for i := 0 to TheFoldInfo.Count - 1 do begin
ConfName := TheFoldInfo.Info^[i].Xml;
Path := 'EditorOptions/FoldConfig/Lang' +
StrToValidXMLName(Syn.LanguageName) + '/Type' + ConfName + '/' ;
TSynCustomFoldHighlighter(Syn).FoldConfig[TheFoldInfo.Info^[i].Index] :=
XMLConfig.GetValue(Path + 'Enabled/Value',
TSynCustomFoldHighlighter(Syn).FoldConfig[TheFoldInfo.Info^[i].Index]);
end;
end;
end; end;
procedure TEditorOptions.ReadDefaultsForHighlighterFoldSettings(Syn: TSrcIDEHighlighter); procedure TEditorOptions.ReadDefaultsForHighlighterFoldSettings(Syn: TSrcIDEHighlighter);
var var
TheInfo: TEditorOptionsDividerRecord; TheInfo: TEditorOptionsDividerRecord;
i: Integer; i, h: Integer;
TheFoldInfo: TEditorOptionsFoldRecord;
begin begin
i := HighlighterList.FindByHighlighter(Syn); h := HighlighterList.FindByHighlighter(Syn);
if i < 0 then exit; if h < 0 then exit;
TheInfo := EditorOptionsDividerDefaults[HighlighterList[i].TheType]; TheInfo := EditorOptionsDividerDefaults[HighlighterList[h].TheType];
for i := 0 to TheInfo.Count - 1 do begin for i := 0 to TheInfo.Count - 1 do begin
Syn.DividerDrawConfig[i].MaxDrawDepth := TheInfo.Info^[i].MaxLeveL; Syn.DividerDrawConfig[i].MaxDrawDepth := TheInfo.Info^[i].MaxLeveL;
Syn.DividerDrawConfig[i].TopColor := clDefault; Syn.DividerDrawConfig[i].TopColor := clDefault;
Syn.DividerDrawConfig[i].NestColor := clDefault; Syn.DividerDrawConfig[i].NestColor := clDefault;
end; end;
if (syn is TSynCustomFoldHighlighter) then begin
TheFoldInfo := EditorOptionsFoldDefaults[HighlighterList[h].TheType];
for i := 0 to TheFoldInfo.Count - 1 do begin
TSynCustomFoldHighlighter(Syn).FoldConfig[TheFoldInfo.Info^[i].Index]
:= TheFoldInfo.Info^[i].Enabled;
end;
end;
end; end;
procedure TEditorOptions.WriteHighlighterFoldSettings(Syn: TSrcIDEHighlighter); procedure TEditorOptions.WriteHighlighterFoldSettings(Syn: TSrcIDEHighlighter);
var var
DefSyn: TSrcIDEHighlighter; DefSyn: TSrcIDEHighlighter;
i: Integer; i, h: Integer;
Path: String; Path: String;
Conf, DefConf: TSynDividerDrawConfig; Conf, DefConf: TSynDividerDrawConfig;
TheInfo: TEditorOptionsDividerRecord; TheInfo: TEditorOptionsDividerRecord;
ConfName: String; ConfName: String;
TheFoldInfo: TEditorOptionsFoldRecord;
begin begin
i := HighlighterList.FindByHighlighter(Syn); h := HighlighterList.FindByHighlighter(Syn);
if i < 0 then exit; if h < 0 then exit;
TheInfo := EditorOptionsDividerDefaults[HighlighterList[i].TheType]; TheInfo := EditorOptionsDividerDefaults[HighlighterList[h].TheType];
DefSyn := TCustomSynClass(Syn.ClassType).Create(Nil); DefSyn := TCustomSynClass(Syn.ClassType).Create(Nil);
try try
@ -2384,6 +2485,19 @@ begin
XMLConfig.SetDeleteValue(Path + 'NestColor/Value', Conf.NestColor, XMLConfig.SetDeleteValue(Path + 'NestColor/Value', Conf.NestColor,
DefConf.NestColor); DefConf.NestColor);
end; end;
if (syn is TSynCustomFoldHighlighter) then begin
TheFoldInfo := EditorOptionsFoldDefaults[HighlighterList[h].TheType];
for i := 0 to TheFoldInfo.Count - 1 do begin
ConfName := TheFoldInfo.Info^[i].Xml;
Path := 'EditorOptions/FoldConfig/Lang' +
StrToValidXMLName(Syn.LanguageName) + '/Type' + ConfName + '/' ;
XMLConfig.SetDeleteValue(Path + 'Enabled/Value',
TSynCustomFoldHighlighter(Syn).FoldConfig[TheFoldInfo.Info^[i].Index],
TSynCustomFoldHighlighter(DefSyn).FoldConfig[TheFoldInfo.Info^[i].Index]);
end;
end;
finally finally
DefSyn.Free; DefSyn.Free;
end; end;

View File

@ -1,11 +1,12 @@
inherited EditorCodefoldingOptionsFrame: TEditorCodefoldingOptionsFrame inherited EditorCodefoldingOptionsFrame: TEditorCodefoldingOptionsFrame
Height = 334 Height = 334
Width = 521 Width = 521
Anchors = [akTop]
ClientHeight = 334 ClientHeight = 334
ClientWidth = 521 ClientWidth = 521
Visible = False Visible = False
DesignLeft = 230 DesignLeft = 115
DesignTop = 230 DesignTop = 115
object Bevel1: TBevel[0] object Bevel1: TBevel[0]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = chkCodeFoldingEnabled AnchorSideTop.Control = chkCodeFoldingEnabled
@ -19,96 +20,52 @@ inherited EditorCodefoldingOptionsFrame: TEditorCodefoldingOptionsFrame
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6 BorderSpacing.Top = 6
end end
object LanguageLabel: TLabel[1] object DividerConfPanel: TPanel[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 = 19
Top = 0
Width = 136
Caption = 'chkCodeFoldingEnabled'
TabOrder = 0
end
object LanguageComboBox: TComboBox[3]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Bevel1
Left = 0
Height = 21
Top = 31
Width = 200
AutoComplete = False
BorderSpacing.Top = 6
ItemHeight = 13
ItemWidth = 0
OnChange = LanguageComboBoxChange
OnExit = LanguageComboBoxExit
OnKeyDown = LanguageComboBoxKeyDown
TabOrder = 1
Text = 'LanguageComboBox'
end
object FoldConfigListBox: TListBox[4]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = LanguageComboBox AnchorSideTop.Control = LanguageComboBox
AnchorSideTop.Side = asrBottom 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.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 206 Left = 0
Height = 276 Height = 276
Top = 58 Top = 58
Width = 315 Width = 521
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 6 BorderSpacing.Top = 6
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 276 ClientHeight = 276
ClientWidth = 315 ClientWidth = 521
TabOrder = 3 TabOrder = 2
object LanguageLabel: TLabel
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 DividerBoolPanel: TPanel object DividerBoolPanel: TPanel
AnchorSideLeft.Control = DividerConfPanel AnchorSideLeft.Control = DividerConfigListBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = DividerConfPanel AnchorSideTop.Control = DividerConfPanel
AnchorSideRight.Control = DividerConfPanel AnchorSideRight.Control = DividerConfPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DividerSpinPanel AnchorSideBottom.Control = DividerSpinPanel
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 0 Left = 206
Height = 23 Height = 23
Top = 0 Top = 0
Width = 315 Width = 315
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Left = 6
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 23 ClientHeight = 23
ClientWidth = 315 ClientWidth = 315
@ -130,16 +87,18 @@ inherited EditorCodefoldingOptionsFrame: TEditorCodefoldingOptionsFrame
end end
end end
object DividerSpinPanel: TPanel object DividerSpinPanel: TPanel
AnchorSideLeft.Control = DividerConfPanel AnchorSideLeft.Control = DividerConfigListBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = DividerConfPanel AnchorSideTop.Control = DividerConfPanel
AnchorSideRight.Control = DividerConfPanel AnchorSideRight.Control = DividerConfPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 206
Height = 23 Height = 23
Top = 0 Top = 0
Width = 315 Width = 315
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoSize = True AutoSize = True
BorderSpacing.Left = 6
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 23 ClientHeight = 23
ClientWidth = 315 ClientWidth = 315
@ -172,17 +131,19 @@ inherited EditorCodefoldingOptionsFrame: TEditorCodefoldingOptionsFrame
end end
end end
object NestLvlPanel: TPanel object NestLvlPanel: TPanel
AnchorSideLeft.Control = DividerConfPanel AnchorSideLeft.Control = DividerConfigListBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = TopLvlPanel AnchorSideTop.Control = TopLvlPanel
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = DividerConfPanel AnchorSideRight.Control = DividerConfPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 206
Height = 44 Height = 44
Top = 80 Top = 80
Width = 315 Width = 315
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoSize = True AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Top = 6 BorderSpacing.Top = 6
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 44 ClientHeight = 44
@ -232,16 +193,18 @@ inherited EditorCodefoldingOptionsFrame: TEditorCodefoldingOptionsFrame
end end
end end
object TopLvlPanel: TPanel object TopLvlPanel: TPanel
AnchorSideLeft.Control = DividerConfPanel AnchorSideLeft.Control = DividerConfigListBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = DividerConfPanel AnchorSideTop.Control = DividerConfPanel
AnchorSideRight.Control = DividerConfPanel AnchorSideRight.Control = DividerConfPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 206
Height = 44 Height = 44
Top = 30 Top = 30
Width = 315 Width = 315
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoSize = True AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Top = 30 BorderSpacing.Top = 30
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 44 ClientHeight = 44
@ -289,5 +252,125 @@ inherited EditorCodefoldingOptionsFrame: TEditorCodefoldingOptionsFrame
TabOrder = 1 TabOrder = 1
end end
end end
object DividerConfigListBox: TListBox
AnchorSideLeft.Control = DividerConfPanel
AnchorSideTop.Control = DividerConfPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DividerConfPanel
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 276
Top = 0
Width = 200
Anchors = [akTop, akLeft, akBottom]
ItemHeight = 0
OnClick = DividerConfigListBoxClick
OnSelectionChange = DividerConfigListBoxSelectionChange
TabOrder = 4
end
end
object chkCodeFoldingEnabled: TCheckBox[2]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
Left = 0
Height = 19
Top = 0
Width = 136
Caption = 'chkCodeFoldingEnabled'
TabOrder = 0
end
object LanguageComboBox: TComboBox[3]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Bevel1
Left = 0
Height = 21
Top = 31
Width = 200
AutoComplete = False
BorderSpacing.Top = 6
ItemHeight = 13
ItemWidth = 0
OnChange = LanguageComboBoxChange
OnExit = LanguageComboBoxExit
OnKeyDown = LanguageComboBoxKeyDown
TabOrder = 1
Text = 'LanguageComboBox'
end
object FoldConfPanel: TPanel[4]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = LanguageComboBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 276
Top = 58
Width = 521
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 6
BevelOuter = bvNone
ClientHeight = 276
ClientWidth = 521
TabOrder = 3
object FoldConfigCheckListBox: TCheckListBox
AnchorSideLeft.Control = FoldConfPanel
AnchorSideTop.Control = FoldConfPanel
AnchorSideBottom.Control = FoldConfPanel
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 276
Top = 0
Width = 200
Anchors = [akTop, akLeft, akBottom]
ExtendedSelect = False
ItemHeight = 0
OnClickCheck = FoldConfigCheckListBoxClickCheck
OnExit = FoldConfigCheckListBoxClickCheck
OnKeyUp = FoldConfigCheckListBoxKeyUp
TabOrder = 0
end
end
object ToolBar1: TToolBar[5]
AnchorSideLeft.Control = LanguageComboBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = LanguageComboBox
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 206
Height = 26
Top = 28
Width = 315
Align = alNone
BorderSpacing.Left = 6
Caption = 'ToolBar1'
TabOrder = 4
object DividerSpeedButton: TSpeedButton
Tag = 1
Left = 1
Height = 22
Top = 2
Width = 70
Caption = 'Divider'
Color = clBtnFace
Down = True
GroupIndex = 1
NumGlyphs = 0
OnClick = DividerSpeedButtonClick
end
object FoldSpeedButton: TSpeedButton
Tag = 1
Left = 71
Height = 22
Top = 2
Width = 70
Caption = 'Fold'
Color = clBtnFace
GroupIndex = 1
NumGlyphs = 0
OnClick = FoldSpeedButtonClick
end
end end
end end

View File

@ -1,111 +1,141 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TEditorCodefoldingOptionsFrame','FORMDATA',[ LazarusResources.Add('TEditorCodefoldingOptionsFrame','FORMDATA',[
'TPF0'#241#30'TEditorCodefoldingOptionsFrame'#29'EditorCodefoldingOptionsFram' 'TPF0'#241#30'TEditorCodefoldingOptionsFrame'#29'EditorCodefoldingOptionsFram'
+'e'#6'Height'#3'N'#1#5'Width'#3#9#2#12'ClientHeight'#3'N'#1#11'ClientWidth'#3 +'e'#6'Height'#3'N'#1#5'Width'#3#9#2#7'Anchors'#11#5'akTop'#0#12'ClientHeight'
+#9#2#7'Visible'#8#10'DesignLeft'#3#230#0#9'DesignTop'#3#230#0#0#242#2#0#6'TB' +#3'N'#1#11'ClientWidth'#3#9#2#7'Visible'#8#10'DesignLeft'#2's'#9'DesignTop'#2
+'evel'#6'Bevel1'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Cont' +'s'#0#242#2#0#6'TBevel'#6'Bevel1'#22'AnchorSideLeft.Control'#7#5'Owner'#21'A'
+'rol'#7#21'chkCodeFoldingEnabled'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'A' +'nchorSideTop.Control'#7#21'chkCodeFoldingEnabled'#18'AnchorSideTop.Side'#7#9
+'nchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#4 +'asrBottom'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7
+'Left'#2#0#6'Height'#2#2#3'Top'#2#25#5'Width'#3#9#2#7'Anchors'#11#5'akTop'#6 +#9'asrBottom'#4'Left'#2#0#6'Height'#2#2#3'Top'#2#25#5'Width'#3#9#2#7'Anchors'
+'akLeft'#7'akRight'#0#17'BorderSpacing.Top'#2#6#0#0#242#2#1#6'TLabel'#13'Lan' +#11#5'akTop'#6'akLeft'#7'akRight'#0#17'BorderSpacing.Top'#2#6#0#0#242#2#1#6
+'guageLabel'#22'AnchorSideLeft.Control'#7#16'LanguageComboBox'#19'AnchorSide' +'TPanel'#16'DividerConfPanel'#22'AnchorSideLeft.Control'#7#5'Owner'#21'Ancho'
+'Left.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#16'LanguageComboBox'#4 +'rSideTop.Control'#7#16'LanguageComboBox'#18'AnchorSideTop.Side'#7#9'asrBott'
+'Left'#3#206#0#6'Height'#2#16#3'Top'#2#31#5'Width'#2'Q'#18'BorderSpacing.Lef' +'om'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asr'
+'t'#2#6#19'BorderSpacing.Right'#2#6#7'Caption'#6#13'LanguageLabel'#11'Parent' +'Bottom'#24'AnchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7
+'Color'#8#0#0#242#2#2#9'TCheckBox'#21'chkCodeFoldingEnabled'#22'AnchorSideLe' +#9'asrBottom'#4'Left'#2#0#6'Height'#3#20#1#3'Top'#2':'#5'Width'#3#9#2#7'Anch'
+'ft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#5'Owner'#4'Left'#2#0#6'H' +'ors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#17'BorderSpacing.Top'#2
+'eight'#2#19#3'Top'#2#0#5'Width'#3#136#0#7'Caption'#6#21'chkCodeFoldingEnabl' +#6#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#3#20#1#11'ClientWidth'#3#9#2#8
+'ed'#8'TabOrder'#2#0#0#0#242#2#3#9'TComboBox'#16'LanguageComboBox'#22'Anchor' +'TabOrder'#2#2#0#6'TLabel'#13'LanguageLabel'#22'AnchorSideLeft.Control'#7#16
+'SideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#6'Bevel1'#4'Left'#2 +'LanguageComboBox'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.C'
+#0#6'Height'#2#21#3'Top'#2#31#5'Width'#3#200#0#12'AutoComplete'#8#17'BorderS' +'ontrol'#7#16'LanguageComboBox'#4'Left'#3#206#0#6'Height'#2#16#3'Top'#2#31#5
+'pacing.Top'#2#6#10'ItemHeight'#2#13#9'ItemWidth'#2#0#8'OnChange'#7#22'Langu' +'Width'#2'Q'#18'BorderSpacing.Left'#2#6#19'BorderSpacing.Right'#2#6#7'Captio'
+'ageComboBoxChange'#6'OnExit'#7#20'LanguageComboBoxExit'#9'OnKeyDown'#7#23'L' +'n'#6#13'LanguageLabel'#11'ParentColor'#8#0#0#6'TPanel'#16'DividerBoolPanel'
+'anguageComboBoxKeyDown'#8'TabOrder'#2#1#4'Text'#6#16'LanguageComboBox'#0#0 +#22'AnchorSideLeft.Control'#7#20'DividerConfigListBox'#19'AnchorSideLeft.Sid'
+#242#2#4#8'TListBox'#17'FoldConfigListBox'#22'AnchorSideLeft.Control'#7#5'Ow' +'e'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#16'DividerConfPanel'#23'Ancho'
+'ner'#21'AnchorSideTop.Control'#7#16'LanguageComboBox'#18'AnchorSideTop.Side' +'rSideRight.Control'#7#16'DividerConfPanel'#20'AnchorSideRight.Side'#7#9'asr'
+#7#9'asrBottom'#23'AnchorSideRight.Control'#7#16'LanguageComboBox'#20'Anchor' +'Bottom'#24'AnchorSideBottom.Control'#7#16'DividerSpinPanel'#21'AnchorSideBo'
+'SideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#5'Owner'#21'A' +'ttom.Side'#7#9'asrBottom'#4'Left'#3#206#0#6'Height'#2#23#3'Top'#2#0#5'Width'
+'nchorSideBottom.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#3#20#1#3'Top'#2 +#3';'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'AutoSize'
+':'#5'Width'#3#200#0#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom' +#9#18'BorderSpacing.Left'#2#6#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2
+#0#17'BorderSpacing.Top'#2#6#10'ItemHeight'#2#0#7'OnClick'#7#22'FoldConfigLi' +#23#11'ClientWidth'#3';'#1#8'TabOrder'#2#1#7'Visible'#8#0#9'TCheckBox'#20'Di'
+'stBoxClick'#17'OnSelectionChange'#7' FoldConfigListBoxSelectionChange'#8'Ta' +'viderOnOffCheckBox'#22'AnchorSideLeft.Control'#7#16'DividerBoolPanel'#21'An'
+'bOrder'#2#2#0#0#242#2#5#6'TPanel'#16'DividerConfPanel'#22'AnchorSideLeft.Co' +'chorSideTop.Control'#7#16'DividerBoolPanel'#23'AnchorSideRight.Control'#7#16
+'ntrol'#7#17'FoldConfigListBox'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'An' +'DividerBoolPanel'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2#0#6'Hei'
+'chorSideTop.Control'#7#17'FoldConfigListBox'#23'AnchorSideRight.Control'#7#5 +'ght'#2#19#3'Top'#2#0#5'Width'#3';'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akR'
+'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control' +'ight'#0#7'Caption'#6#20'DividerOnOffCheckBox'#8'OnChange'#7#26'DividerOnOff'
+#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3#206#0#6'Heigh' +'CheckBoxChange'#8'TabOrder'#2#0#0#0#0#6'TPanel'#16'DividerSpinPanel'#22'Anc'
+'t'#3#20#1#3'Top'#2':'#5'Width'#3';'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'ak' +'horSideLeft.Control'#7#20'DividerConfigListBox'#19'AnchorSideLeft.Side'#7#9
+'Right'#8'akBottom'#0#18'BorderSpacing.Left'#2#6#10'BevelOuter'#7#6'bvNone' +'asrBottom'#21'AnchorSideTop.Control'#7#16'DividerConfPanel'#23'AnchorSideRi'
+#12'ClientHeight'#3#20#1#11'ClientWidth'#3';'#1#8'TabOrder'#2#3#0#6'TPanel' +'ght.Control'#7#16'DividerConfPanel'#20'AnchorSideRight.Side'#7#9'asrBottom'
+#16'DividerBoolPanel'#22'AnchorSideLeft.Control'#7#16'DividerConfPanel'#21'A' +#4'Left'#3#206#0#6'Height'#2#23#3'Top'#2#0#5'Width'#3';'#1#7'Anchors'#11#5'a'
+'nchorSideTop.Control'#7#16'DividerConfPanel'#23'AnchorSideRight.Control'#7 +'kTop'#6'akLeft'#7'akRight'#0#8'AutoSize'#9#18'BorderSpacing.Left'#2#6#10'Be'
+#16'DividerConfPanel'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideB' +'velOuter'#7#6'bvNone'#12'ClientHeight'#2#23#11'ClientWidth'#3';'#1#8'TabOrd'
+'ottom.Control'#7#16'DividerSpinPanel'#21'AnchorSideBottom.Side'#7#9'asrBott' +'er'#2#0#0#6'TLabel'#16'DividerSpinLabel'#22'AnchorSideLeft.Control'#7#15'Di'
+'om'#4'Left'#2#0#6'Height'#2#23#3'Top'#2#0#5'Width'#3';'#1#7'Anchors'#11#5'a' +'viderSpinEdit'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Cont'
+'kTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'AutoSize'#9#10'BevelOuter'#7#6'b' +'rol'#7#15'DividerSpinEdit'#18'AnchorSideTop.Side'#7#9'asrCenter'#23'AnchorS'
+'vNone'#12'ClientHeight'#2#23#11'ClientWidth'#3';'#1#8'TabOrder'#2#1#7'Visib' +'ideRight.Control'#7#16'DividerSpinPanel'#20'AnchorSideRight.Side'#7#9'asrBo'
+'le'#8#0#9'TCheckBox'#20'DividerOnOffCheckBox'#22'AnchorSideLeft.Control'#7 +'ttom'#4'Left'#2'5'#6'Height'#2#16#3'Top'#2#3#5'Width'#3#6#1#7'Anchors'#11#5
+#16'DividerBoolPanel'#21'AnchorSideTop.Control'#7#16'DividerBoolPanel'#23'An' +'akTop'#6'akLeft'#7'akRight'#0#18'BorderSpacing.Left'#2#3#7'Caption'#6#16'Di'
+'chorSideRight.Control'#7#16'DividerBoolPanel'#20'AnchorSideRight.Side'#7#9 +'viderSpinLabel'#11'ParentColor'#8#0#0#9'TSpinEdit'#15'DividerSpinEdit'#22'A'
+'asrBottom'#4'Left'#2#0#6'Height'#2#19#3'Top'#2#0#5'Width'#3';'#1#7'Anchors' +'nchorSideLeft.Control'#7#16'DividerSpinPanel'#21'AnchorSideTop.Control'#7#16
+#11#5'akTop'#6'akLeft'#7'akRight'#0#7'Caption'#6#20'DividerOnOffCheckBox'#8 +'DividerSpinPanel'#4'Left'#2#0#6'Height'#2#23#3'Top'#2#0#5'Width'#2'2'#8'OnC'
+'OnChange'#7#26'DividerOnOffCheckBoxChange'#8'TabOrder'#2#0#0#0#0#6'TPanel' +'hange'#7#21'DividerSpinEditChange'#8'TabOrder'#2#0#0#0#0#6'TPanel'#12'NestL'
+#16'DividerSpinPanel'#22'AnchorSideLeft.Control'#7#16'DividerConfPanel'#21'A' +'vlPanel'#22'AnchorSideLeft.Control'#7#20'DividerConfigListBox'#19'AnchorSid'
+'nchorSideTop.Control'#7#16'DividerConfPanel'#23'AnchorSideRight.Control'#7 +'eLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#11'TopLvlPanel'#18'A'
+#16'DividerConfPanel'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2#0#6 +'nchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#16'DividerC'
+'Height'#2#23#3'Top'#2#0#5'Width'#3';'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7 +'onfPanel'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#3#206#0#6'Height'
+'akRight'#0#8'AutoSize'#9#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2#23#11 +#2','#3'Top'#2'P'#5'Width'#3';'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'
+'ClientWidth'#3';'#1#8'TabOrder'#2#0#0#6'TLabel'#16'DividerSpinLabel'#22'Anc' +#0#8'AutoSize'#9#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#10'Bev'
+'horSideLeft.Control'#7#15'DividerSpinEdit'#19'AnchorSideLeft.Side'#7#9'asrB' +'elOuter'#7#6'bvNone'#12'ClientHeight'#2','#11'ClientWidth'#3';'#1#8'TabOrde'
+'ottom'#21'AnchorSideTop.Control'#7#15'DividerSpinEdit'#18'AnchorSideTop.Sid' +'r'#2#2#7'Visible'#8#0#6'TLabel'#17'NestLvlColorLabel'#22'AnchorSideLeft.Con'
+'e'#7#9'asrCenter'#23'AnchorSideRight.Control'#7#16'DividerSpinPanel'#20'Anc' +'trol'#7#12'NestLvlPanel'#21'AnchorSideTop.Control'#7#12'NestLvlPanel'#4'Lef'
+'horSideRight.Side'#7#9'asrBottom'#4'Left'#2'5'#6'Height'#2#16#3'Top'#2#3#5 +'t'#2#0#6'Height'#2#16#3'Top'#2#0#5'Width'#2'a'#7'Caption'#6#17'NestLvlColor'
+'Width'#3#6#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#18'BorderSpacing' +'Label'#11'ParentColor'#8#0#0#9'TColorBox'#15'NestLvlColorBox'#22'AnchorSide'
+'.Left'#2#3#7'Caption'#6#16'DividerSpinLabel'#11'ParentColor'#8#0#0#9'TSpinE' +'Left.Control'#7#12'NestLvlPanel'#21'AnchorSideTop.Control'#7#17'NestLvlColo'
+'dit'#15'DividerSpinEdit'#22'AnchorSideLeft.Control'#7#16'DividerSpinPanel' +'rLabel'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#2#22#3
+#21'AnchorSideTop.Control'#7#16'DividerSpinPanel'#4'Left'#2#0#6'Height'#2#23 +'Top'#2#22#5'Width'#2'd'#17'DefaultColorColor'#7#7'clWhite'#5'Style'#11#16'c'
,#3'Top'#2#0#5'Width'#2'2'#8'OnChange'#7#21'DividerSpinEditChange'#8'TabOrder' ,'bStandardColors'#16'cbExtendedColors'#14'cbSystemColors'#16'cbIncludeDefaul'
+#2#0#0#0#0#6'TPanel'#12'NestLvlPanel'#22'AnchorSideLeft.Control'#7#16'Divide' +'t'#13'cbCustomColor'#13'cbPrettyNames'#0#12'AutoComplete'#8#17'BorderSpacin'
+'rConfPanel'#21'AnchorSideTop.Control'#7#11'TopLvlPanel'#18'AnchorSideTop.Si' +'g.Top'#2#6#10'ItemHeight'#2#16#9'ItemWidth'#2#0#8'OnChange'#7#21'NestLvlCol'
+'de'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#16'DividerConfPanel'#20'An' +'orBoxChange'#8'TabOrder'#2#0#0#0#9'TCheckBox'#20'NestLvlColorCheckBox'#22'A'
+'chorSideRight.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#2','#3'Top'#2'P'#5 +'nchorSideLeft.Control'#7#15'NestLvlColorBox'#19'AnchorSideLeft.Side'#7#9'as'
+'Width'#3';'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'AutoSize'#9#17 +'rBottom'#21'AnchorSideTop.Control'#7#15'NestLvlColorBox'#18'AnchorSideTop.S'
+'BorderSpacing.Top'#2#6#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2','#11 +'ide'#7#9'asrCenter'#4'Left'#2'j'#6'Height'#2#19#3'Top'#2#24#5'Width'#3#129#0
+'ClientWidth'#3';'#1#8'TabOrder'#2#2#7'Visible'#8#0#6'TLabel'#17'NestLvlColo' +#18'BorderSpacing.Left'#2#6#7'Caption'#6#20'NestLvlColorCheckBox'#8'OnChange'
+'rLabel'#22'AnchorSideLeft.Control'#7#12'NestLvlPanel'#21'AnchorSideTop.Cont' +#7#26'NestLvlColorCheckBoxChange'#8'TabOrder'#2#1#0#0#0#6'TPanel'#11'TopLvlP'
+'rol'#7#12'NestLvlPanel'#4'Left'#2#0#6'Height'#2#16#3'Top'#2#0#5'Width'#2'a' +'anel'#22'AnchorSideLeft.Control'#7#20'DividerConfigListBox'#19'AnchorSideLe'
+#7'Caption'#6#17'NestLvlColorLabel'#11'ParentColor'#8#0#0#9'TColorBox'#15'Ne' +'ft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#16'DividerConfPanel'#23
+'stLvlColorBox'#22'AnchorSideLeft.Control'#7#12'NestLvlPanel'#21'AnchorSideT' +'AnchorSideRight.Control'#7#16'DividerConfPanel'#20'AnchorSideRight.Side'#7#9
+'op.Control'#7#17'NestLvlColorLabel'#18'AnchorSideTop.Side'#7#9'asrBottom'#4 +'asrBottom'#4'Left'#3#206#0#6'Height'#2','#3'Top'#2#30#5'Width'#3';'#1#7'Anc'
+'Left'#2#0#6'Height'#2#22#3'Top'#2#22#5'Width'#2'd'#17'DefaultColorColor'#7#7 +'hors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'AutoSize'#9#18'BorderSpacing.Lef'
+'clWhite'#5'Style'#11#16'cbStandardColors'#16'cbExtendedColors'#14'cbSystemC' +'t'#2#6#17'BorderSpacing.Top'#2#30#10'BevelOuter'#7#6'bvNone'#12'ClientHeigh'
+'olors'#16'cbIncludeDefault'#13'cbCustomColor'#13'cbPrettyNames'#0#12'AutoCo' +'t'#2','#11'ClientWidth'#3';'#1#8'TabOrder'#2#3#0#6'TLabel'#16'TopLvlColorLa'
+'mplete'#8#17'BorderSpacing.Top'#2#6#10'ItemHeight'#2#16#9'ItemWidth'#2#0#8 +'bel'#22'AnchorSideLeft.Control'#7#11'TopLvlPanel'#21'AnchorSideTop.Control'
+'OnChange'#7#21'NestLvlColorBoxChange'#8'TabOrder'#2#0#0#0#9'TCheckBox'#20'N' +#7#11'TopLvlPanel'#4'Left'#2#0#6'Height'#2#16#3'Top'#2#0#5'Width'#2'^'#7'Cap'
+'estLvlColorCheckBox'#22'AnchorSideLeft.Control'#7#15'NestLvlColorBox'#19'An' +'tion'#6#16'TopLvlColorLabel'#11'ParentColor'#8#0#0#9'TColorBox'#14'TopLvlCo'
+'chorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#15'NestLvlCol' +'lorBox'#22'AnchorSideLeft.Control'#7#11'TopLvlPanel'#21'AnchorSideTop.Contr'
+'orBox'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2'j'#6'Height'#2#19#3 +'ol'#7#16'TopLvlColorLabel'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#0
+'Top'#2#24#5'Width'#3#129#0#18'BorderSpacing.Left'#2#6#7'Caption'#6#20'NestL' +#6'Height'#2#22#3'Top'#2#22#5'Width'#2'd'#17'DefaultColorColor'#7#7'clWhite'
+'vlColorCheckBox'#8'OnChange'#7#26'NestLvlColorCheckBoxChange'#8'TabOrder'#2 +#5'Style'#11#16'cbStandardColors'#16'cbExtendedColors'#14'cbSystemColors'#16
+#1#0#0#0#6'TPanel'#11'TopLvlPanel'#22'AnchorSideLeft.Control'#7#16'DividerCo' +'cbIncludeDefault'#13'cbCustomColor'#13'cbPrettyNames'#0#12'AutoComplete'#8
+'nfPanel'#21'AnchorSideTop.Control'#7#16'DividerConfPanel'#23'AnchorSideRigh' +#17'BorderSpacing.Top'#2#6#10'ItemHeight'#2#16#9'ItemWidth'#2#0#8'OnChange'#7
+'t.Control'#7#16'DividerConfPanel'#20'AnchorSideRight.Side'#7#9'asrBottom'#4 +#20'TopLvlColorBoxChange'#8'TabOrder'#2#0#0#0#9'TCheckBox'#19'TopLvlColorChe'
+'Left'#2#0#6'Height'#2','#3'Top'#2#30#5'Width'#3';'#1#7'Anchors'#11#5'akTop' +'ckBox'#22'AnchorSideLeft.Control'#7#14'TopLvlColorBox'#19'AnchorSideLeft.Si'
+#6'akLeft'#7'akRight'#0#8'AutoSize'#9#17'BorderSpacing.Top'#2#30#10'BevelOut' +'de'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#14'TopLvlColorBox'#18'Anchor'
+'er'#7#6'bvNone'#12'ClientHeight'#2','#11'ClientWidth'#3';'#1#8'TabOrder'#2#3 +'SideTop.Side'#7#9'asrCenter'#4'Left'#2'j'#6'Height'#2#19#3'Top'#2#24#5'Widt'
+#0#6'TLabel'#16'TopLvlColorLabel'#22'AnchorSideLeft.Control'#7#11'TopLvlPane' +'h'#2'~'#18'BorderSpacing.Left'#2#6#7'Caption'#6#19'TopLvlColorCheckBox'#8'O'
+'l'#21'AnchorSideTop.Control'#7#11'TopLvlPanel'#4'Left'#2#0#6'Height'#2#16#3 +'nChange'#7#25'TopLvlColorCheckBoxChange'#8'TabOrder'#2#1#0#0#0#8'TListBox'
+'Top'#2#0#5'Width'#2'^'#7'Caption'#6#16'TopLvlColorLabel'#11'ParentColor'#8#0 +#20'DividerConfigListBox'#22'AnchorSideLeft.Control'#7#16'DividerConfPanel'
+#0#9'TColorBox'#14'TopLvlColorBox'#22'AnchorSideLeft.Control'#7#11'TopLvlPan' +#21'AnchorSideTop.Control'#7#16'DividerConfPanel'#20'AnchorSideRight.Side'#7
+'el'#21'AnchorSideTop.Control'#7#16'TopLvlColorLabel'#18'AnchorSideTop.Side' +#9'asrBottom'#24'AnchorSideBottom.Control'#7#16'DividerConfPanel'#21'AnchorS'
+#7#9'asrBottom'#4'Left'#2#0#6'Height'#2#22#3'Top'#2#22#5'Width'#2'd'#17'Defa' +'ideBottom.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#3#20#1#3'Top'#2#0#5'Wi'
+'ultColorColor'#7#7'clWhite'#5'Style'#11#16'cbStandardColors'#16'cbExtendedC' +'dth'#3#200#0#7'Anchors'#11#5'akTop'#6'akLeft'#8'akBottom'#0#10'ItemHeight'#2
+'olors'#14'cbSystemColors'#16'cbIncludeDefault'#13'cbCustomColor'#13'cbPrett' +#0#7'OnClick'#7#25'DividerConfigListBoxClick'#17'OnSelectionChange'#7'#Divid'
+'yNames'#0#12'AutoComplete'#8#17'BorderSpacing.Top'#2#6#10'ItemHeight'#2#16#9 +'erConfigListBoxSelectionChange'#8'TabOrder'#2#4#0#0#0#242#2#2#9'TCheckBox'
+'ItemWidth'#2#0#8'OnChange'#7#20'TopLvlColorBoxChange'#8'TabOrder'#2#0#0#0#9 +#21'chkCodeFoldingEnabled'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSi'
+'TCheckBox'#19'TopLvlColorCheckBox'#22'AnchorSideLeft.Control'#7#14'TopLvlCo' +'deTop.Control'#7#5'Owner'#4'Left'#2#0#6'Height'#2#19#3'Top'#2#0#5'Width'#3
+'lorBox'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7 +#136#0#7'Caption'#6#21'chkCodeFoldingEnabled'#8'TabOrder'#2#0#0#0#242#2#3#9
+#14'TopLvlColorBox'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2'j'#6'Hei' +'TComboBox'#16'LanguageComboBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'An'
+'ght'#2#19#3'Top'#2#24#5'Width'#2'~'#18'BorderSpacing.Left'#2#6#7'Caption'#6 +'chorSideTop.Control'#7#6'Bevel1'#4'Left'#2#0#6'Height'#2#21#3'Top'#2#31#5'W'
+#19'TopLvlColorCheckBox'#8'OnChange'#7#25'TopLvlColorCheckBoxChange'#8'TabOr' +'idth'#3#200#0#12'AutoComplete'#8#17'BorderSpacing.Top'#2#6#10'ItemHeight'#2
+'der'#2#1#0#0#0#0#0 +#13#9'ItemWidth'#2#0#8'OnChange'#7#22'LanguageComboBoxChange'#6'OnExit'#7#20
+'LanguageComboBoxExit'#9'OnKeyDown'#7#23'LanguageComboBoxKeyDown'#8'TabOrder'
+#2#1#4'Text'#6#16'LanguageComboBox'#0#0#242#2#4#6'TPanel'#13'FoldConfPanel'
+#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#16'Langua'
+'geComboBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRight.Contro'
+'l'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.C'
+'ontrol'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#2#0#6'H'
+'eight'#3#20#1#3'Top'#2':'#5'Width'#3#9#2#7'Anchors'#11#5'akTop'#6'akLeft'#7
+'akRight'#8'akBottom'#0#17'BorderSpacing.Top'#2#6#10'BevelOuter'#7#6'bvNone'
+#12'ClientHeight'#3#20#1#11'ClientWidth'#3#9#2#8'TabOrder'#2#3#0#13'TCheckLi'
+'stBox'#22'FoldConfigCheckListBox'#22'AnchorSideLeft.Control'#7#13'FoldConfP'
+'anel'#21'AnchorSideTop.Control'#7#13'FoldConfPanel'#24'AnchorSideBottom.Con'
+'trol'#7#13'FoldConfPanel'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#2
+#0#6'Height'#3#20#1#3'Top'#2#0#5'Width'#3#200#0#7'Anchors'#11#5'akTop'#6'akL'
+'eft'#8'akBottom'#0#14'ExtendedSelect'#8#10'ItemHeight'#2#0#12'OnClickCheck'
+#7' FoldConfigCheckListBoxClickCheck'#6'OnExit'#7' FoldConfigCheckListBoxCli'
+'ckCheck'#7'OnKeyUp'#7#27'FoldConfigCheckListBoxKeyUp'#8'TabOrder'#2#0#0#0#0
+#242#2#5#8'TToolBar'#8'ToolBar1'#22'AnchorSideLeft.Control'#7#16'LanguageCom'
+'boBox'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#16
+'LanguageComboBox'#18'AnchorSideTop.Side'#7#9'asrCenter'#23'AnchorSideRight.'
,'Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#3#206#0
+#6'Height'#2#26#3'Top'#2#28#5'Width'#3';'#1#5'Align'#7#6'alNone'#18'BorderSp'
+'acing.Left'#2#6#7'Caption'#6#8'ToolBar1'#8'TabOrder'#2#4#0#12'TSpeedButton'
+#18'DividerSpeedButton'#3'Tag'#2#1#4'Left'#2#1#6'Height'#2#22#3'Top'#2#2#5'W'
+'idth'#2'F'#7'Caption'#6#7'Divider'#5'Color'#7#9'clBtnFace'#4'Down'#9#10'Gro'
+'upIndex'#2#1#9'NumGlyphs'#2#0#7'OnClick'#7#23'DividerSpeedButtonClick'#0#0
+#12'TSpeedButton'#15'FoldSpeedButton'#3'Tag'#2#1#4'Left'#2'G'#6'Height'#2#22
+#3'Top'#2#2#5'Width'#2'F'#7'Caption'#6#4'Fold'#5'Color'#7#9'clBtnFace'#10'Gr'
+'oupIndex'#2#1#9'NumGlyphs'#2#0#7'OnClick'#7#20'FoldSpeedButtonClick'#0#0#0#0
]); ]);

View File

@ -27,7 +27,7 @@ interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, StdCtrls, ExtCtrls, Graphics, Classes, SysUtils, FileUtil, LResources, Forms, StdCtrls, ExtCtrls, Graphics,
LCLType, EditorOptions, LazarusIDEStrConsts, IDEOptionsIntf, Controls, LCLType, EditorOptions, LazarusIDEStrConsts, IDEOptionsIntf, Controls,
SynEditHighlighter, Spin, ComCtrls, ColorBox; SynEditHighlighter, SynEditHighlighterFoldBase, Spin, ComCtrls, ColorBox, CheckLst, Buttons;
type type
@ -35,6 +35,11 @@ type
TEditorCodefoldingOptionsFrame = class(TAbstractIDEOptionsEditor) TEditorCodefoldingOptionsFrame = class(TAbstractIDEOptionsEditor)
Bevel1: TBevel; Bevel1: TBevel;
FoldConfigCheckListBox: TCheckListBox;
FoldConfPanel: TPanel;
DividerSpeedButton: TSpeedButton;
FoldSpeedButton: TSpeedButton;
ToolBar1: TToolBar;
TopLvlPanel: TPanel; TopLvlPanel: TPanel;
TopLvlColorCheckBox: TCheckBox; TopLvlColorCheckBox: TCheckBox;
NestLvlColorCheckBox: TCheckBox; NestLvlColorCheckBox: TCheckBox;
@ -47,16 +52,20 @@ type
NestLvlColorLabel: TLabel; NestLvlColorLabel: TLabel;
LanguageComboBox: TComboBox; LanguageComboBox: TComboBox;
LanguageLabel: TLabel; LanguageLabel: TLabel;
FoldConfigListBox: TListBox; DividerConfigListBox: TListBox;
DividerConfPanel: TPanel; DividerConfPanel: TPanel;
DividerSpinPanel: TPanel; DividerSpinPanel: TPanel;
DividerBoolPanel: TPanel; DividerBoolPanel: TPanel;
DividerSpinEdit: TSpinEdit; DividerSpinEdit: TSpinEdit;
NestLvlPanel: TPanel; NestLvlPanel: TPanel;
procedure DividerOnOffCheckBoxChange(Sender: TObject); procedure DividerOnOffCheckBoxChange(Sender: TObject);
procedure DividerSpeedButtonClick(Sender: TObject);
procedure DividerSpinEditChange(Sender: TObject); procedure DividerSpinEditChange(Sender: TObject);
procedure FoldConfigListBoxClick(Sender: TObject); procedure DividerConfigListBoxClick(Sender: TObject);
procedure FoldConfigListBoxSelectionChange(Sender: TObject; User: boolean); procedure DividerConfigListBoxSelectionChange(Sender: TObject; User: boolean);
procedure FoldConfigCheckListBoxClickCheck(Sender: TObject);
procedure FoldConfigCheckListBoxKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FoldSpeedButtonClick(Sender: TObject);
procedure LanguageComboBoxChange(Sender: TObject); procedure LanguageComboBoxChange(Sender: TObject);
procedure LanguageComboBoxExit(Sender: TObject); procedure LanguageComboBoxExit(Sender: TObject);
procedure LanguageComboBoxKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure LanguageComboBoxKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
@ -69,7 +78,8 @@ type
FHighlighters: array[TLazSyntaxHighlighter] of TSrcIDEHighlighter; FHighlighters: array[TLazSyntaxHighlighter] of TSrcIDEHighlighter;
FCurHighlighter: TSrcIDEHighlighter; FCurHighlighter: TSrcIDEHighlighter;
FCurDividerConf: TSynDividerDrawConfig; FCurDividerConf: TSynDividerDrawConfig;
FCurInfo: TEditorOptionsDividerRecord; FCurDivInfo: TEditorOptionsDividerRecord;
FCurFoldInfo: TEditorOptionsFoldRecord;
protected protected
function GetHighlighter(SynType: TLazSyntaxHighlighter; function GetHighlighter(SynType: TLazSyntaxHighlighter;
CreateIfNotExists: Boolean): TSrcIDEHighlighter; CreateIfNotExists: Boolean): TSrcIDEHighlighter;
@ -104,26 +114,80 @@ end;
procedure TEditorCodefoldingOptionsFrame.LanguageComboBoxExit(Sender: TObject); procedure TEditorCodefoldingOptionsFrame.LanguageComboBoxExit(Sender: TObject);
var var
ComboBox: TComboBox absolute Sender; ComboBox: TComboBox absolute Sender;
i: Integer;
tp: TLazSyntaxHighlighter; tp: TLazSyntaxHighlighter;
begin begin
tp := EditorOpts.HighlighterList tp := EditorOpts.HighlighterList
[EditorOpts.HighlighterList.FindByName(ComboBox.Text)].TheType; [EditorOpts.HighlighterList.FindByName(ComboBox.Text)].TheType;
FCurHighlighter := GetHighlighter(tp, True); FCurHighlighter := GetHighlighter(tp, True);
FCurInfo := EditorOptionsDividerDefaults[tp]; FCurDivInfo := EditorOptionsDividerDefaults[tp];
FoldConfigListBox.Clear; FCurFoldInfo := EditorOptionsFoldDefaults[tp];
for i := 0 to FCurInfo.Count - 1 do
FoldConfigListBox.Items.add(FCurInfo.Info^[i].Name); DividerSpeedButton.Enabled := FCurDivInfo.Count > 0;
FoldConfigListBox.ItemIndex := 0; FoldSpeedButton.Enabled := FCurFoldInfo.Count > 0;
FoldConfigListBoxSelectionChange(Sender, True);
if DividerSpeedButton.Enabled and
(DividerSpeedButton.Down or not FoldSpeedButton.Enabled) then begin
DividerSpeedButton.Down := true;
DividerSpeedButtonClick(DividerSpeedButton)
end else begin
FoldSpeedButton.Down := true;
FoldSpeedButtonClick(FoldSpeedButton);
end;
end; end;
procedure TEditorCodefoldingOptionsFrame.FoldConfigListBoxClick(Sender: TObject); procedure TEditorCodefoldingOptionsFrame.FoldSpeedButtonClick(Sender: TObject);
var
i: Integer;
begin begin
FoldConfigListBoxSelectionChange(Sender, True); FoldConfPanel.Visible := true;
DividerConfPanel.Visible := False;
FoldConfigCheckListBox.Clear;
if not (assigned(FCurHighlighter) and
(FCurHighlighter is TSynCustomFoldHighlighter)) then exit;
for i := 0 to FCurFoldInfo.Count - 1 do begin
FoldConfigCheckListBox.Items.add(FCurFoldInfo.Info^[i].Name);
FoldConfigCheckListBox.Checked[i] :=
TSynCustomFoldHighlighter(FCurHighlighter).FoldConfig[FCurFoldInfo.Info^[i].Index];
end;
end; end;
procedure TEditorCodefoldingOptionsFrame.FoldConfigListBoxSelectionChange(Sender: TObject; User: boolean); procedure TEditorCodefoldingOptionsFrame.FoldConfigCheckListBoxClickCheck(Sender: TObject);
var
i: Integer;
begin
if not (assigned(FCurHighlighter) and
(FCurHighlighter is TSynCustomFoldHighlighter)) then exit;
for i := 0 to FCurFoldInfo.Count - 1 do
TSynCustomFoldHighlighter(FCurHighlighter).FoldConfig[FCurFoldInfo.Info^[i].Index]
:= FoldConfigCheckListBox.Checked[i];
end;
procedure TEditorCodefoldingOptionsFrame.FoldConfigCheckListBoxKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
FoldConfigCheckListBoxClickCheck(Sender);
end;
procedure TEditorCodefoldingOptionsFrame.DividerSpeedButtonClick(Sender: TObject);
var
i: Integer;
begin
FoldConfPanel.Visible := False;
DividerConfPanel.Visible := True;
DividerConfigListBox.Clear;
for i := 0 to FCurDivInfo.Count - 1 do
DividerConfigListBox.Items.add(FCurDivInfo.Info^[i].Name);
DividerConfigListBox.ItemIndex := 0;
DividerConfigListBoxSelectionChange(Sender, True);
end;
procedure TEditorCodefoldingOptionsFrame.DividerConfigListBoxClick(Sender: TObject);
begin
DividerConfigListBoxSelectionChange(Sender, True);
end;
procedure TEditorCodefoldingOptionsFrame.DividerConfigListBoxSelectionChange(Sender: TObject; User: boolean);
var var
ListBox: TListBox absolute Sender; ListBox: TListBox absolute Sender;
i: LongInt; i: LongInt;
@ -132,11 +196,11 @@ var
begin begin
if not assigned(FCurHighlighter) then exit; if not assigned(FCurHighlighter) then exit;
i := ListBox.ItemIndex; i := ListBox.ItemIndex;
if (i < 0) or (i >= FCurInfo.Count) then exit; if (i < 0) or (i >= FCurDivInfo.Count) then exit;
NewDiv := FCurHighlighter.DividerDrawConfig[i]; NewDiv := FCurHighlighter.DividerDrawConfig[i];
FCurDividerConf := nil; FCurDividerConf := nil;
b := FCurInfo.Info^[i].BoolOpt; b := FCurDivInfo.Info^[i].BoolOpt;
DividerBoolPanel.Visible := b; DividerBoolPanel.Visible := b;
DividerSpinPanel.Visible := not b; DividerSpinPanel.Visible := not b;
NestLvlPanel.Visible := not b; NestLvlPanel.Visible := not b;
@ -228,7 +292,6 @@ function TEditorCodefoldingOptionsFrame.GetHighlighter(SynType: TLazSyntaxHighli
CreateIfNotExists: Boolean): TSrcIDEHighlighter; CreateIfNotExists: Boolean): TSrcIDEHighlighter;
var var
SynClass: TCustomSynClass; SynClass: TCustomSynClass;
i: Integer;
begin begin
Result := FHighlighters[SynType]; Result := FHighlighters[SynType];
if (Result <> nil) or not(CreateIfNotExists) then exit; if (Result <> nil) or not(CreateIfNotExists) then exit;
@ -268,13 +331,16 @@ begin
TopLvlColorCheckBox.Caption := dlgDividerTopColorDefault; TopLvlColorCheckBox.Caption := dlgDividerTopColorDefault;
NestLvlColorLabel.Caption := dlgDividerNestColor; NestLvlColorLabel.Caption := dlgDividerNestColor;
NestLvlColorCheckBox.Caption := dlgDividerNestColorDefault; NestLvlColorCheckBox.Caption := dlgDividerNestColorDefault;
DividerSpeedButton.Caption := dlgDividerConf;
FoldSpeedButton.Caption := dlgfoldConf;
end; end;
procedure TEditorCodefoldingOptionsFrame.ReadSettings( procedure TEditorCodefoldingOptionsFrame.ReadSettings(
AOptions: TAbstractIDEOptions); AOptions: TAbstractIDEOptions);
var var
i: Integer; i: Integer;
r: TEditorOptionsDividerRecord; rd: TEditorOptionsDividerRecord;
rf: TEditorOptionsFoldRecord;
begin begin
with AOptions as TEditorOptions do with AOptions as TEditorOptions do
begin begin
@ -283,8 +349,9 @@ begin
with LanguageComboBox.Items do begin with LanguageComboBox.Items do begin
BeginUpdate; BeginUpdate;
for i := 0 to EditorOpts.HighlighterList.Count - 1 do begin for i := 0 to EditorOpts.HighlighterList.Count - 1 do begin
r := EditorOptionsDividerDefaults[HighlighterList[i].TheType]; rd := EditorOptionsDividerDefaults[HighlighterList[i].TheType];
if r.Count > 0 then rf := EditorOptionsFoldDefaults[HighlighterList[i].TheType];
if (rd.Count > 0) or (rf.Count > 0) then
Add(HighlighterList[i].SynClass.GetLanguageName); Add(HighlighterList[i].SynClass.GetLanguageName);
end; end;
EndUpdate; EndUpdate;

View File

@ -1220,6 +1220,9 @@ resourcestring
dlgIndentCodeTo = 'Indent code to'; dlgIndentCodeTo = 'Indent code to';
//dlgCodeToolsTab = 'Code Tools'; //dlgCodeToolsTab = 'Code Tools';
lisAutomaticFeatures = 'Automatic features'; lisAutomaticFeatures = 'Automatic features';
dlgDividerConf = 'Divider';
dlgfoldConf = 'Folding';
dlgDividerOnOff = 'Draw divider'; dlgDividerOnOff = 'Draw divider';
dlgDividerDrawDepth = 'Draw divider level'; dlgDividerDrawDepth = 'Draw divider level';
dlgDividerTopColor = 'Line color'; dlgDividerTopColor = 'Line color';
@ -1237,6 +1240,25 @@ resourcestring
dlgDivPasBeginEndName = 'Begin/End'; dlgDivPasBeginEndName = 'Begin/End';
dlgDivPasTryName = 'Try/Except'; dlgDivPasTryName = 'Try/Except';
dlgFoldPasBeginEnd = 'Begin/End (nested)';
dlgFoldPasProcBeginEnd = 'Begin/End (procedure)';
dlgFoldPasNestedComment = 'Nested Comment';
dlgFoldPasProcedure = 'Procedure';
dlgFoldPasUses = 'Uses';
dlgFoldPasVarType = 'Var/Type (global)';
dlgFoldLocalPasVarType = 'Var/Type (local)';
dlgFoldPasClass = 'Class/Object';
dlgFoldPasClassSection = 'public/private';
dlgFoldPasUnitSection = 'Unit section';
dlgFoldPasProgram = 'Program';
dlgFoldPasUnit = 'Unit';
dlgFoldPasRecord = 'Record';
dlgFoldPasTry = 'Try';
dlgFoldPasExcept = 'Except/Finally';
dlgFoldPasRepeat = 'Repeat';
dlgFoldPasCase = 'Case';
dlgFoldPasAsm = 'Asm';
// CodeTools dialog // CodeTools dialog
dlgCodeToolsOpts = 'CodeTools Options'; dlgCodeToolsOpts = 'CodeTools Options';
dlgCodeCreation = 'Code Creation'; dlgCodeCreation = 'Code Creation';