mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 12:49:13 +02:00
LCL: TTreeView: fixed crash on painting tree lines
git-svn-id: trunk@17959 -
This commit is contained in:
parent
60b5ca6f81
commit
9d570a2eba
@ -98,6 +98,7 @@ type
|
|||||||
property Evaluator: TExpressionEvaluator read FEvaluator write SetEvaluator;
|
property Evaluator: TExpressionEvaluator read FEvaluator write SetEvaluator;
|
||||||
property ChangeStamp: integer read FChangeStamp;
|
property ChangeStamp: integer read FChangeStamp;
|
||||||
procedure IncreaseChangeStamp; inline;
|
procedure IncreaseChangeStamp; inline;
|
||||||
|
procedure WriteDebugReport;
|
||||||
property ErrorNode: TCompOptCondNode read FErrorNode write FErrorNode;
|
property ErrorNode: TCompOptCondNode read FErrorNode write FErrorNode;
|
||||||
property ErrorMsg: string read FErrorMsg write FErrorMsg;
|
property ErrorMsg: string read FErrorMsg write FErrorMsg;
|
||||||
end;
|
end;
|
||||||
@ -362,6 +363,22 @@ begin
|
|||||||
FChangeStamp:=Low(Integer);
|
FChangeStamp:=Low(Integer);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCompOptConditionals.WriteDebugReport;
|
||||||
|
|
||||||
|
procedure WriteNode(Prefix: string; Node: TCompOptCondNode);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
DebugLn([Prefix,'Type=',COCNodeTypeNames[Node.NodeType],' Value=',Node.Value]);
|
||||||
|
for i:=0 to Node.Count-1 do
|
||||||
|
WriteNode(Prefix+' ',Node.Childs[i]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
DebugLn(['TCompOptConditionals.WriteDebugReport ']);
|
||||||
|
WriteNode(' ',Root);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TCompilerDiffTool }
|
{ TCompilerDiffTool }
|
||||||
|
|
||||||
procedure TCompilerDiffTool.SetDiff(const AValue: TStrings);
|
procedure TCompilerDiffTool.SetDiff(const AValue: TStrings);
|
||||||
|
@ -27,7 +27,7 @@ uses
|
|||||||
Classes, SysUtils, LCLProc, FileProcs, Controls, LResources, Forms, ComCtrls,
|
Classes, SysUtils, LCLProc, FileProcs, Controls, LResources, Forms, ComCtrls,
|
||||||
Menus, Dialogs,
|
Menus, Dialogs,
|
||||||
ProjectIntf, IDEImagesIntf,
|
ProjectIntf, IDEImagesIntf,
|
||||||
CompOptsModes;
|
LazarusIDEStrConsts, CompOptsModes;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -231,13 +231,17 @@ procedure TCompOptsConditionalsFrame.ConsistencyCheck;
|
|||||||
RaiseCatchableException('');
|
RaiseCatchableException('');
|
||||||
if TVNode=nil then
|
if TVNode=nil then
|
||||||
RaiseCatchableException('');
|
RaiseCatchableException('');
|
||||||
if COCNode<>TCompOptCondNode(TVNode.Data) then
|
if TVNode.Data=nil then
|
||||||
RaiseCatchableException('');
|
RaiseCatchableException('');
|
||||||
|
if COCNode<>TCompOptCondNode(TVNode.Data) then
|
||||||
|
RaiseCatchableException(TCompOptCondNode(TObject(TVNode.Data)).Value+'<>'+COCNode.Value+' TVNode='+TVNode.Text);
|
||||||
ChildTVNode:=TVNode.GetFirstChild;
|
ChildTVNode:=TVNode.GetFirstChild;
|
||||||
for i:=0 to COCNode.Count-1 do begin
|
for i:=0 to COCNode.Count-1 do begin
|
||||||
CheckNode(COCNode.Childs[i],ChildTVNode);
|
CheckNode(COCNode.Childs[i],ChildTVNode);
|
||||||
ChildTVNode:=ChildTVNode.GetNextSibling;
|
ChildTVNode:=ChildTVNode.GetNextSibling;
|
||||||
end;
|
end;
|
||||||
|
if ChildTVNode<>nil then
|
||||||
|
RaiseCatchableException('');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -310,10 +314,19 @@ begin
|
|||||||
if not GetSelectedNode(COCNode,TVNode,true) then exit;
|
if not GetSelectedNode(COCNode,TVNode,true) then exit;
|
||||||
NewCOCNode:=TCompOptCondNode.Create(COCNode.Owner);
|
NewCOCNode:=TCompOptCondNode.Create(COCNode.Owner);
|
||||||
s:=NodeToCaption(COCNode);
|
s:=NodeToCaption(COCNode);
|
||||||
NewTVNode:=COCTreeView.Items.AddObject(TVNode,s,COCNode);
|
NewTVNode:=COCTreeView.Items.AddObject(TVNode,s,NewCOCNode);
|
||||||
NewTVNode.MoveTo(TVNode,naAddChildFirst);
|
NewTVNode.MoveTo(TVNode,AttachMode);
|
||||||
NewTVNode.ImageIndex:=FNodeTypeImageIDs[NewCOCNode.NodeType];
|
NewTVNode.ImageIndex:=FNodeTypeImageIDs[NewCOCNode.NodeType];
|
||||||
NewTVNode.StateIndex:=NewTVNode.ImageIndex;
|
NewTVNode.StateIndex:=NewTVNode.ImageIndex;
|
||||||
|
case AttachMode of
|
||||||
|
naAdd: NewCOCNode.Move(COCNode.Parent,COCNode.Parent.Count);
|
||||||
|
naAddFirst: NewCOCNode.Move(COCNode.Parent,0);
|
||||||
|
naAddChild: NewCOCNode.Move(COCNode,COCNode.Count);
|
||||||
|
naAddChildFirst: NewCOCNode.Move(COCNode,0);
|
||||||
|
naInsert: NewCOCNode.Move(COCNode.Parent,COCNode.Index);
|
||||||
|
naInsertBehind: NewCOCNode.Move(COCNode.Parent,COCNode.Index+1);
|
||||||
|
end;
|
||||||
|
TVNode.Expanded:=true;
|
||||||
ConsistencyCheck;
|
ConsistencyCheck;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -335,6 +348,16 @@ begin
|
|||||||
FNodeTypeImageIDs[cocntElseIf]:=IDEImages.LoadImage(24,'da_elseif');
|
FNodeTypeImageIDs[cocntElseIf]:=IDEImages.LoadImage(24,'da_elseif');
|
||||||
FNodeTypeImageIDs[cocntElse]:=IDEImages.LoadImage(24,'da_else');
|
FNodeTypeImageIDs[cocntElse]:=IDEImages.LoadImage(24,'da_else');
|
||||||
FNodeTypeImageIDs[cocntAddValue]:=IDEImages.LoadImage(24,'da_define');
|
FNodeTypeImageIDs[cocntAddValue]:=IDEImages.LoadImage(24,'da_define');
|
||||||
|
|
||||||
|
InsertAboveMenuItem.Caption:=dlgCOCreateNodeAbove;
|
||||||
|
InsertBelowMenuItem.Caption:=dlgCOCreateNodeBelow;
|
||||||
|
InsertChildMenuItem.Caption:=dlgCOCreateChildNode;
|
||||||
|
DeleteMenuItem.Caption:=lisCodeToolsDefsDeleteNode;
|
||||||
|
PropertiesMenuItem.Caption:=lisCEProperties;
|
||||||
|
MoveLvlDownMenuItem.Caption:=dlgCOMoveLevelDown;
|
||||||
|
MoveLvlUpMenuItem.Caption:=dlgCOMoveLevelUp;
|
||||||
|
MoveDownMenuItem.Caption:=dlgCOMoveDown;
|
||||||
|
MoveUpMenuItem.Caption:=dlgCOMoveUp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
@ -3611,6 +3611,10 @@ resourcestring
|
|||||||
lisCEConstants = 'Constants';
|
lisCEConstants = 'Constants';
|
||||||
lisCEProcedures = 'Procedures';
|
lisCEProcedures = 'Procedures';
|
||||||
lisCEProperties = 'Properties';
|
lisCEProperties = 'Properties';
|
||||||
|
dlgCOMoveLevelDown = 'Move level down';
|
||||||
|
dlgCOMoveLevelUp = 'Move level up';
|
||||||
|
dlgCOMoveDown = 'Move down';
|
||||||
|
dlgCOMoveUp = 'Move up';
|
||||||
lisCEOMode = 'Preferred Exhibition Mode';
|
lisCEOMode = 'Preferred Exhibition Mode';
|
||||||
lisCEOModeCategory = 'Category';
|
lisCEOModeCategory = 'Category';
|
||||||
lisCEOModeSource = 'Source';
|
lisCEOModeSource = 'Source';
|
||||||
@ -3999,6 +4003,9 @@ resourcestring
|
|||||||
rsCreatingSymLinkFailed = 'Creating symbolic link "%s" failed!';
|
rsCreatingSymLinkFailed = 'Creating symbolic link "%s" failed!';
|
||||||
rsCreatingSymLinkNotSupported = 'Creating symbolic link is not supported on this platform!';
|
rsCreatingSymLinkNotSupported = 'Creating symbolic link is not supported on this platform!';
|
||||||
lisPutLrsFilesInOutputDirectory = 'Save .lrs files in the output directory';
|
lisPutLrsFilesInOutputDirectory = 'Save .lrs files in the output directory';
|
||||||
|
dlgCOCreateNodeAbove = 'Create node above';
|
||||||
|
dlgCOCreateNodeBelow = 'Create node below';
|
||||||
|
dlgCOCreateChildNode = 'Create child node';
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ type
|
|||||||
property Owner: TLazCompOptConditionals read FOwner;
|
property Owner: TLazCompOptConditionals read FOwner;
|
||||||
property Parent: TCompOptCondNode read FParent;
|
property Parent: TCompOptCondNode read FParent;
|
||||||
property Count: integer read GetCount;
|
property Count: integer read GetCount;
|
||||||
property Childs[Index: integer]: TCompOptCondNode read GetChilds;
|
property Childs[Index: integer]: TCompOptCondNode read GetChilds; default;
|
||||||
property Index: integer read GetIndex write SetIndex;
|
property Index: integer read GetIndex write SetIndex;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1052,6 +1052,7 @@ begin
|
|||||||
if (NewIndex<0) or (NewIndex>FParent.Count) then
|
if (NewIndex<0) or (NewIndex>FParent.Count) then
|
||||||
NewIndex:=FParent.Count;
|
NewIndex:=FParent.Count;
|
||||||
FParent.fChilds.Insert(NewIndex,Self);
|
FParent.fChilds.Insert(NewIndex,Self);
|
||||||
|
FParent.Changed;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -4152,7 +4152,7 @@ var
|
|||||||
var
|
var
|
||||||
CurMid: integer;
|
CurMid: integer;
|
||||||
begin
|
begin
|
||||||
if (CurNode <> nil) and (tvoShowRoot in Options) or (CurNode.Parent<>nil)
|
if (CurNode <> nil) and ((tvoShowRoot in Options) or (CurNode.Parent<>nil))
|
||||||
then begin
|
then begin
|
||||||
Result := DrawTreeLines(CurNode.Parent);
|
Result := DrawTreeLines(CurNode.Parent);
|
||||||
if ShowLines then
|
if ShowLines then
|
||||||
|
Loading…
Reference in New Issue
Block a user