|
@@ -79,7 +79,7 @@ type TMyFunc = function(_EBP: Pointer; Cur: Pointer;
|
|
function newnode(const Atext:string;Achildren,Anext:Pnode):Pnode;
|
|
function newnode(const Atext:string;Achildren,Anext:Pnode):Pnode;
|
|
|
|
|
|
begin
|
|
begin
|
|
- new(newnode);
|
|
|
|
|
|
+ newnode:=new(Pnode);
|
|
with newnode^ do
|
|
with newnode^ do
|
|
begin
|
|
begin
|
|
next:=Anext;
|
|
next:=Anext;
|
|
@@ -179,19 +179,17 @@ begin
|
|
if EndWidth > 0 then
|
|
if EndWidth > 0 then
|
|
begin
|
|
begin
|
|
for I := 1 to EndWidth do
|
|
for I := 1 to EndWidth do
|
|
- begin
|
|
|
|
Graph[I]:= Chars[StraightOrTee+1];
|
|
Graph[I]:= Chars[StraightOrTee+1];
|
|
- end;
|
|
|
|
J := J + EndWidth;
|
|
J := J + EndWidth;
|
|
end;
|
|
end;
|
|
Inc(J);
|
|
Inc(J);
|
|
- if Children <> False then
|
|
|
|
|
|
+ if Children 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 <> False then
|
|
|
|
|
|
+ if Expanded then
|
|
Graph[J] := Chars[Retracted+2]
|
|
Graph[J] := Chars[Retracted+2]
|
|
else
|
|
else
|
|
Graph[J] := Chars[Retracted+1];
|
|
Graph[J] := Chars[Retracted+1];
|
|
@@ -203,7 +201,59 @@ end;
|
|
|
|
|
|
procedure Toutlineviewer.draw;
|
|
procedure Toutlineviewer.draw;
|
|
|
|
|
|
|
|
+var c_normal,c_normal_x,c_select,c_focus:byte;
|
|
|
|
+ maxpos:sw_integer;
|
|
|
|
+ b:Tdrawbuffer;
|
|
|
|
+
|
|
|
|
+ function draw_item(cur:pointer;level,position:sw_integer;
|
|
|
|
+ lines:longint;flags:word):boolean;
|
|
|
|
+
|
|
|
|
+ var c,i:byte;
|
|
|
|
+ s,t:string;
|
|
|
|
+
|
|
|
|
+ begin
|
|
|
|
+ draw_item:=position>=delta.y+size.y;
|
|
|
|
+ if (position<delta.y) or draw_item then
|
|
|
|
+ exit;
|
|
|
|
+
|
|
|
|
+ maxpos:=position;
|
|
|
|
+ s:=getgraph(level,lines,flags);
|
|
|
|
+ t:=gettext(cur);
|
|
|
|
+
|
|
|
|
+ {Determine text colour.}
|
|
|
|
+ if isselected(position) then
|
|
|
|
+ c:=c_select
|
|
|
|
+ else if (foc=position) and (state and sffocused<>0) then
|
|
|
|
+ c:=c_focus
|
|
|
|
+ else if flags and ovexpanded<>0 then
|
|
|
|
+ c:=c_normal_x
|
|
|
|
+ else
|
|
|
|
+ c:=c_normal;
|
|
|
|
+
|
|
|
|
+ {Fill drawbuffer with graph and text to draw.}
|
|
|
|
+ for i:=0 to size.x-1 do
|
|
|
|
+ begin
|
|
|
|
+ wordrec(b[i]).hi:=c;
|
|
|
|
+ if i+delta.x<=length(s) then
|
|
|
|
+ wordrec(b[i]).lo:=byte(s[i+delta.x])
|
|
|
|
+ else if i+delta.x-length(s)<length(t) then
|
|
|
|
+ wordrec(b[i]).lo:=byte(s[i+delta.x-length(s)])
|
|
|
|
+ else
|
|
|
|
+ wordrec(b[i]).lo:=byte(' ');
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+ {Draw!}
|
|
|
|
+ writeline(0,position-delta.y,size.x,1,b);
|
|
|
|
+ end;
|
|
|
|
+
|
|
begin
|
|
begin
|
|
|
|
+ c_normal:=getcolor(4);
|
|
|
|
+ c_normal_x:=getcolor(1);
|
|
|
|
+ c_focus:=getcolor(2);
|
|
|
|
+ c_select:=getcolor(3);
|
|
|
|
+ maxpos:=-1;
|
|
|
|
+ foreach(@draw_item);
|
|
|
|
+ writeline(0,maxpos+1,size.x,size.y-(maxpos-delta.y),b);
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure Toutlineviewer.expandall(node:pointer);
|
|
procedure Toutlineviewer.expandall(node:pointer);
|