synedit: fixed codefolding subblocks when case without begin

git-svn-id: trunk@9665 -
This commit is contained in:
mattias 2006-07-22 14:45:11 +00:00
parent 5643a1ba44
commit 51bd7772b9
3 changed files with 37 additions and 5 deletions

View File

@ -1203,7 +1203,7 @@ end;
function TSynCustomHighlighter.StartCodeFoldBlock(ABlockType: Pointer;
SubBlock: boolean): TSynCustomCodeFoldBlock;
begin
if SubBlock then begin
if SubBlock and (CodeFoldRange.Top<>nil) then begin
Result:=CodeFoldRange.Top;
if (Result.BlockType=ABlockType) then
Result.Level:=Result.Level+1
@ -1218,7 +1218,7 @@ var
TopBlock: TSynCustomCodeFoldBlock;
begin
TopBlock:=CodeFoldRange.Top;
if TopBlock.Level>0 then
if (TopBlock<>nil) and (TopBlock.Level>0) then
TopBlock.Level:=TopBlock.Level-1
else begin
CodeFoldRange.Pop;

View File

@ -663,7 +663,8 @@ begin
end else
if KeyComp('Case') then begin
{$IFDEF SYN_LAZARUS}
StartPascalCodeFoldBlock(cfbtBeginEnd,true);
if TopPascalCodeFoldBlockType=cfbtBeginEnd then
StartPascalCodeFoldBlock(cfbtBeginEnd,true);
{$ENDIF}
Result := tkKey;
end else Result := tkIdentifier;
@ -819,7 +820,8 @@ begin
if KeyComp('Try') then
{$IFDEF SYN_LAZARUS}
begin
StartPascalCodeFoldBlock(cfbtBeginEnd,true);
if TopPascalCodeFoldBlockType=cfbtBeginEnd then
StartPascalCodeFoldBlock(cfbtBeginEnd,true);
Result := tkKey;
end else
{$ELSE}

View File

@ -1125,7 +1125,7 @@ var
function ControlIsVisible(AControl: TControl): boolean;
begin
Result:=(AControl<>nil)
and ((AControl.Visible) or (AControl=VisibleControl));
and ((AControl.IsVisible) or (AControl=VisibleControl));
end;
function FindNode(const AName: string): TLazDockConfigNode;
@ -1296,6 +1296,32 @@ var
end;
end;
function AllControlsAreOnSameForm: boolean;
function Check(Node: TLazDockConfigNode): boolean;
var
i: Integer;
Docker: TCustomLazControlDocker;
CurForm: TControl;
begin
if Node.TheType=ldcntControl then begin
Docker:=FindDockerByName(Node.Name);
if (Docker<>nil) and (Docker.Control<>nil) then begin
//if Docker.Control
CurForm:=Docker.Control;
while CurForm.Parent<>nil do
CurForm:=CurForm.Parent;
end;
end;
// check childs
for i:=0 to Node.ChildCount-1 do
if not Check(Node.Childs[i]) then exit(false);
Result:=true;
end;
begin
Result:=Check(Root);
end;
var
Config: TLazDockerConfig;
@ -1316,6 +1342,10 @@ begin
RemoveEmptyNodes(Root);
// check if all used controls are on the same dock form
if not AllControlsAreOnSameForm then begin
end;
// Now Root contains a Layout for the case that all visible controls are put
// into one dock form.