|
@@ -42,6 +42,8 @@ type Pnode=^Tnode;
|
|
procedure update;
|
|
procedure update;
|
|
private
|
|
private
|
|
procedure set_focus(Afocus:sw_integer);
|
|
procedure set_focus(Afocus:sw_integer);
|
|
|
|
+ function do_recurse(action,callerframe:pointer;
|
|
|
|
+ stop_if_found:boolean):pointer;
|
|
end;
|
|
end;
|
|
|
|
|
|
Toutline=object(Toutlineviewer)
|
|
Toutline=object(Toutlineviewer)
|
|
@@ -134,16 +136,8 @@ var
|
|
Graph : String;
|
|
Graph : String;
|
|
|
|
|
|
begin
|
|
begin
|
|
- { Break out flags }
|
|
|
|
- Expanded := Boolean((Flags and ovExpanded) <> 0);
|
|
|
|
- Children := Boolean((Flags and ovChildren) <> 0);
|
|
|
|
- Last := Boolean((Flags and ovLast) <> 0);
|
|
|
|
-
|
|
|
|
{ Load registers }
|
|
{ Load registers }
|
|
- J := Level*LevWidth+EndWidth+1;
|
|
|
|
- Graph[0] := Char(J);
|
|
|
|
- for I := 1 to J do
|
|
|
|
- Graph[I] := ' ';
|
|
|
|
|
|
+ graph:=space(Level*LevWidth+EndWidth+1);
|
|
|
|
|
|
{ Write bar characters }
|
|
{ Write bar characters }
|
|
J := 1;
|
|
J := 1;
|
|
@@ -155,9 +149,7 @@ begin
|
|
else
|
|
else
|
|
Graph[J] := Chars[FillerOrBar+1];
|
|
Graph[J] := Chars[FillerOrBar+1];
|
|
for I := 1 to LevWidth - 1 do
|
|
for I := 1 to LevWidth - 1 do
|
|
- begin
|
|
|
|
Graph[I]:= Chars[FillerOrBar+1];
|
|
Graph[I]:= Chars[FillerOrBar+1];
|
|
- end;
|
|
|
|
J := J + LevWidth - 1;
|
|
J := J + LevWidth - 1;
|
|
Dec(Level);
|
|
Dec(Level);
|
|
Lines := Lines shr 1;
|
|
Lines := Lines shr 1;
|
|
@@ -168,7 +160,7 @@ begin
|
|
if EndWidth > 0 then
|
|
if EndWidth > 0 then
|
|
begin
|
|
begin
|
|
Inc(J);
|
|
Inc(J);
|
|
- if Last <> False then
|
|
|
|
|
|
+ if Flags and ovLast <> 0 then
|
|
Graph[J] := Chars[YorL+2]
|
|
Graph[J] := Chars[YorL+2]
|
|
else
|
|
else
|
|
Graph[J] := Chars[YorL+1];
|
|
Graph[J] := Chars[YorL+1];
|
|
@@ -176,20 +168,17 @@ begin
|
|
if EndWidth > 0 then
|
|
if EndWidth > 0 then
|
|
begin
|
|
begin
|
|
Dec(EndWidth);
|
|
Dec(EndWidth);
|
|
- if EndWidth > 0 then
|
|
|
|
- begin
|
|
|
|
- for I := 1 to EndWidth do
|
|
|
|
- Graph[I]:= Chars[StraightOrTee+1];
|
|
|
|
- J := J + EndWidth;
|
|
|
|
- end;
|
|
|
|
|
|
+ for I := 1 to EndWidth do
|
|
|
|
+ Graph[I]:= Chars[StraightOrTee+1];
|
|
|
|
+ J := J + EndWidth;
|
|
Inc(J);
|
|
Inc(J);
|
|
- if Children then
|
|
|
|
|
|
+ if (Flags and ovChildren) <> 0 then
|
|
Graph[J] := Chars[StraightOrTee+2]
|
|
Graph[J] := Chars[StraightOrTee+2]
|
|
else
|
|
else
|
|
Graph[J] := Chars[StraightOrTee+1];
|
|
Graph[J] := Chars[StraightOrTee+1];
|
|
end;
|
|
end;
|
|
Inc(J);
|
|
Inc(J);
|
|
- if Expanded then
|
|
|
|
|
|
+ if Flags and ovExpanded <> 0 then
|
|
Graph[J] := Chars[Retracted+2]
|
|
Graph[J] := Chars[Retracted+2]
|
|
else
|
|
else
|
|
Graph[J] := Chars[Retracted+1];
|
|
Graph[J] := Chars[Retracted+1];
|
|
@@ -272,6 +261,7 @@ end;
|
|
function Toutlineviewer.firstthat(test:pointer):pointer;
|
|
function Toutlineviewer.firstthat(test:pointer):pointer;
|
|
|
|
|
|
begin
|
|
begin
|
|
|
|
+ firstthat:=do_recurse(test,get_caller_frame(get_frame),true);
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure Toutlineviewer.focused(i:sw_integer);
|
|
procedure Toutlineviewer.focused(i:sw_integer);
|
|
@@ -283,6 +273,7 @@ end;
|
|
procedure Toutlineviewer.foreach(action:pointer);
|
|
procedure Toutlineviewer.foreach(action:pointer);
|
|
|
|
|
|
begin
|
|
begin
|
|
|
|
+ do_recurse(action,get_caller_frame(get_frame),false);
|
|
end;
|
|
end;
|
|
|
|
|
|
function Toutlineviewer.getchild(node:pointer;i:sw_integer):pointer;
|
|
function Toutlineviewer.getchild(node:pointer;i:sw_integer):pointer;
|
|
@@ -295,11 +286,20 @@ function Toutlineviewer.getgraph(level:integer;lines:longint;
|
|
flags:word):string;
|
|
flags:word):string;
|
|
|
|
|
|
begin
|
|
begin
|
|
|
|
+ getgraph:=creategraph(level,lines,flags,3,3,' ³ÃÀÄÄ+Ä');
|
|
end;
|
|
end;
|
|
|
|
|
|
function Toutlineviewer.getnode(i:sw_integer):pointer;
|
|
function Toutlineviewer.getnode(i:sw_integer):pointer;
|
|
|
|
|
|
|
|
+ function test_position(node:pointer;level,position:sw_integer;lines:longInt;
|
|
|
|
+ flags:word):boolean;
|
|
|
|
+
|
|
|
|
+ begin
|
|
|
|
+ test_position:=position=i;
|
|
|
|
+ end;
|
|
|
|
+
|
|
begin
|
|
begin
|
|
|
|
+ foreach(@test_position);
|
|
end;
|
|
end;
|
|
|
|
|
|
function Toutlineviewer.getnumchildren(node:pointer):sw_integer;
|
|
function Toutlineviewer.getnumchildren(node:pointer):sw_integer;
|
|
@@ -338,6 +338,62 @@ begin
|
|
isselected:=foc=i;
|
|
isselected:=foc=i;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function Toutlineviewer.do_recurse(action,callerframe:pointer;
|
|
|
|
+ stop_if_found:boolean):pointer;
|
|
|
|
+
|
|
|
|
+var position:sw_integer;
|
|
|
|
+
|
|
|
|
+ function recurse(cur:pointer;level:integer;lines:longint;lastchild:boolean):pointer;
|
|
|
|
+
|
|
|
|
+ var i,childcount:sw_integer;
|
|
|
|
+ child:pointer;
|
|
|
|
+ flags:word;
|
|
|
|
+ children,expanded,found:boolean;
|
|
|
|
+
|
|
|
|
+ begin
|
|
|
|
+ inc(position);
|
|
|
|
+ recurse:=nil;
|
|
|
|
+
|
|
|
|
+ children:=haschildren(cur);
|
|
|
|
+ expanded:=isexpanded(cur);
|
|
|
|
+
|
|
|
|
+ {Determine flags.}
|
|
|
|
+ flags:=0;
|
|
|
|
+ if not children or expanded then
|
|
|
|
+ inc(flags,ovExpanded);
|
|
|
|
+ if children and expanded then
|
|
|
|
+ inc(flags,ovChildren);
|
|
|
|
+ if lastchild then
|
|
|
|
+ inc(flags,ovLast);
|
|
|
|
+
|
|
|
|
+ {Call the function.}
|
|
|
|
+ found:=TMyFunc(action)(callerframe,cur,level,position,lines,flags);
|
|
|
|
+
|
|
|
|
+ if stop_if_found and found then
|
|
|
|
+ recurse:=cur
|
|
|
|
+ else if children and expanded then {Recurse children?}
|
|
|
|
+ begin
|
|
|
|
+ if not lastchild then
|
|
|
|
+ lines:=lines or (1 shl level);
|
|
|
|
+ {Iterate all childs.}
|
|
|
|
+ childcount:=getnumchildren(cur);
|
|
|
|
+ for i:=0 to childcount-1 do
|
|
|
|
+ begin
|
|
|
|
+ child:=getchild(cur,i);
|
|
|
|
+ if (child<>nil) and (level<31) then
|
|
|
|
+ recurse:=recurse(child,level+1,lines,i=childcount-1);
|
|
|
|
+ {Did we find a node?}
|
|
|
|
+ if recurse<>nil then
|
|
|
|
+ break;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+begin
|
|
|
|
+ position:=-1;
|
|
|
|
+ do_recurse:=recurse(getroot,0,0,true);
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure Toutlineviewer.selected(i:sw_integer);
|
|
procedure Toutlineviewer.selected(i:sw_integer);
|
|
|
|
|
|
begin
|
|
begin
|