mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 15:03:35 +02:00
MG: fixed update bottomitem on wmsize
git-svn-id: trunk@1477 -
This commit is contained in:
parent
8e4ae5f28d
commit
64825ceb38
@ -26,8 +26,8 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LCLLinux, Forms, Controls, Buttons, StdCtrls, ComCtrls,
|
Classes, SysUtils, LCLLinux, Forms, Controls, Buttons, StdCtrls, ComCtrls,
|
||||||
ExtCtrls, Menus, LResources, Graphics, ImgList, SynEdit, DefineTemplates,
|
ExtCtrls, Menus, LResources, Graphics, Dialogs, ImgList, SynEdit,
|
||||||
CodeToolManager, CodeToolsOptions;
|
DefineTemplates, CodeToolManager, CodeToolsOptions;
|
||||||
|
|
||||||
type
|
type
|
||||||
TCodeToolsDefinesEditor = class(TForm)
|
TCodeToolsDefinesEditor = class(TForm)
|
||||||
@ -111,6 +111,7 @@ type
|
|||||||
procedure DeleteFilePathBitBtnClick(Sender: TObject);
|
procedure DeleteFilePathBitBtnClick(Sender: TObject);
|
||||||
procedure InsertFilePathBitBtnClick(Sender: TObject);
|
procedure InsertFilePathBitBtnClick(Sender: TObject);
|
||||||
procedure InsertNodeMenuItemClick(Sender: TObject);
|
procedure InsertNodeMenuItemClick(Sender: TObject);
|
||||||
|
procedure ProjectSpecificCheckBoxClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
FDefineTree: TDefineTree;
|
FDefineTree: TDefineTree;
|
||||||
FLastSelectedNode: TTreeNode;
|
FLastSelectedNode: TTreeNode;
|
||||||
@ -119,10 +120,11 @@ type
|
|||||||
procedure RebuildDefineTreeView;
|
procedure RebuildDefineTreeView;
|
||||||
procedure AddDefineNodes(ANode: TDefineTemplate; AParent: TTreeNode;
|
procedure AddDefineNodes(ANode: TDefineTemplate; AParent: TTreeNode;
|
||||||
WithChilds,WithNextSiblings: boolean);
|
WithChilds,WithNextSiblings: boolean);
|
||||||
procedure SetNodeImages(ANode: TTreeNode);
|
procedure SetNodeImages(ANode: TTreeNode; WithSubNodes: boolean);
|
||||||
procedure ValueAsPathToValueAsText;
|
procedure ValueAsPathToValueAsText;
|
||||||
procedure SaveSelectedValues;
|
procedure SaveSelectedValues(ATreeNode: TTreeNode);
|
||||||
procedure ShowSelectedValues;
|
procedure ShowSelectedValues;
|
||||||
|
procedure SetTypeLabel;
|
||||||
function ValueToFilePathText(const AValue: string): string;
|
function ValueToFilePathText(const AValue: string): string;
|
||||||
procedure InsertNewNode(Behind: boolean; Action: TDefineAction);
|
procedure InsertNewNode(Behind: boolean; Action: TDefineAction);
|
||||||
public
|
public
|
||||||
@ -293,8 +295,8 @@ procedure TCodeToolsDefinesEditor.MoveFilePathUpBitBtnClick(Sender: TObject);
|
|||||||
var y: integer;
|
var y: integer;
|
||||||
begin
|
begin
|
||||||
if ValueAsFilePathsSynEdit.ReadOnly then exit;
|
if ValueAsFilePathsSynEdit.ReadOnly then exit;
|
||||||
y:=ValueAsFilePathsSynEdit.CaretY;
|
y:=ValueAsFilePathsSynEdit.CaretY-1;
|
||||||
if (y>1) and (y<=ValueAsFilePathsSynEdit.Lines.Count) then
|
if (y>0) and (y<ValueAsFilePathsSynEdit.Lines.Count) then
|
||||||
ValueAsFilePathsSynEdit.Lines.Move(y,y-1);
|
ValueAsFilePathsSynEdit.Lines.Move(y,y-1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -302,8 +304,8 @@ procedure TCodeToolsDefinesEditor.MoveFilePathDownBitBtnClick(Sender: TObject);
|
|||||||
var y: integer;
|
var y: integer;
|
||||||
begin
|
begin
|
||||||
if ValueAsFilePathsSynEdit.ReadOnly then exit;
|
if ValueAsFilePathsSynEdit.ReadOnly then exit;
|
||||||
y:=ValueAsFilePathsSynEdit.CaretY;
|
y:=ValueAsFilePathsSynEdit.CaretY-1;
|
||||||
if (y>=1) and (y<ValueAsFilePathsSynEdit.Lines.Count) then
|
if (y>=0) and (y<ValueAsFilePathsSynEdit.Lines.Count-1) then
|
||||||
ValueAsFilePathsSynEdit.Lines.Move(y,y+1);
|
ValueAsFilePathsSynEdit.Lines.Move(y,y+1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -311,8 +313,8 @@ procedure TCodeToolsDefinesEditor.DeleteFilePathBitBtnClick(Sender: TObject);
|
|||||||
var y: integer;
|
var y: integer;
|
||||||
begin
|
begin
|
||||||
if ValueAsFilePathsSynEdit.ReadOnly then exit;
|
if ValueAsFilePathsSynEdit.ReadOnly then exit;
|
||||||
y:=ValueAsFilePathsSynEdit.CaretY;
|
y:=ValueAsFilePathsSynEdit.CaretY-1;
|
||||||
if (y>=1) and (y<=ValueAsFilePathsSynEdit.Lines.Count) then
|
if (y>=0) and (y<ValueAsFilePathsSynEdit.Lines.Count) then
|
||||||
ValueAsFilePathsSynEdit.Lines.Delete(y);
|
ValueAsFilePathsSynEdit.Lines.Delete(y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -320,8 +322,8 @@ procedure TCodeToolsDefinesEditor.InsertFilePathBitBtnClick(Sender: TObject);
|
|||||||
var y: integer;
|
var y: integer;
|
||||||
begin
|
begin
|
||||||
if ValueAsFilePathsSynEdit.ReadOnly then exit;
|
if ValueAsFilePathsSynEdit.ReadOnly then exit;
|
||||||
y:=ValueAsFilePathsSynEdit.CaretY;
|
y:=ValueAsFilePathsSynEdit.CaretY-1;
|
||||||
if (y>=1) and (y<=ValueAsFilePathsSynEdit.Lines.Count) then
|
if (y>=0) and (y<ValueAsFilePathsSynEdit.Lines.Count) then
|
||||||
ValueAsFilePathsSynEdit.Lines.Insert(y,'');
|
ValueAsFilePathsSynEdit.Lines.Insert(y,'');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -353,6 +355,25 @@ begin
|
|||||||
InsertNewNode(Behind,Action);
|
InsertNewNode(Behind,Action);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCodeToolsDefinesEditor.ProjectSpecificCheckBoxClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
SelTreeNode: TTreeNode;
|
||||||
|
SelDefNode: TDefineTemplate;
|
||||||
|
begin
|
||||||
|
if not SelectedItemGroupBox.Enabled then exit;
|
||||||
|
SelTreeNode:=DefineTreeView.Selected;
|
||||||
|
if SelTreeNode=nil then exit;
|
||||||
|
SelDefNode:=TDefineTemplate(SelTreeNode.Data);
|
||||||
|
if ProjectSpecificCheckBox.Checked=(dtfProjectSpecific in SelDefNode.Flags)
|
||||||
|
then exit;
|
||||||
|
if ProjectSpecificCheckBox.Checked then
|
||||||
|
Include(SelDefNode.Flags,dtfProjectSpecific)
|
||||||
|
else
|
||||||
|
Exclude(SelDefNode.Flags,dtfProjectSpecific);
|
||||||
|
SetNodeImages(SelTreeNode,true);
|
||||||
|
SetTypeLabel;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCodeToolsDefinesEditor.CreateComponents;
|
procedure TCodeToolsDefinesEditor.CreateComponents;
|
||||||
|
|
||||||
procedure CreateWinControl(var AWinControl: TWinControl;
|
procedure CreateWinControl(var AWinControl: TWinControl;
|
||||||
@ -535,6 +556,7 @@ begin
|
|||||||
SelectedItemGroupBox);
|
SelectedItemGroupBox);
|
||||||
ProjectSpecificCheckBox.Caption:=
|
ProjectSpecificCheckBox.Caption:=
|
||||||
'Node and its children are only valid for this project';
|
'Node and its children are only valid for this project';
|
||||||
|
ProjectSpecificCheckBox.OnClick:=@ProjectSpecificCheckBoxClick;
|
||||||
|
|
||||||
CreateWinControl(NameLabel,TLabel,'NameLabel',SelectedItemGroupBox);
|
CreateWinControl(NameLabel,TLabel,'NameLabel',SelectedItemGroupBox);
|
||||||
NameLabel.Caption:='Name:';
|
NameLabel.Caption:='Name:';
|
||||||
@ -619,7 +641,7 @@ begin
|
|||||||
//writeln(' AAA ',StringOfChar(' ',ANode.Level*2),' ',ANode.Name,' ',WithChilds,',',WithNextSiblings);
|
//writeln(' AAA ',StringOfChar(' ',ANode.Level*2),' ',ANode.Name,' ',WithChilds,',',WithNextSiblings);
|
||||||
DefineTreeView.Items.BeginUpdate;
|
DefineTreeView.Items.BeginUpdate;
|
||||||
NewTreeNode:=DefineTreeView.Items.AddChildObject(AParent,ANode.Name,ANode);
|
NewTreeNode:=DefineTreeView.Items.AddChildObject(AParent,ANode.Name,ANode);
|
||||||
SetNodeImages(NewTreeNode);
|
SetNodeImages(NewTreeNode,false);
|
||||||
if WithChilds and (ANode.FirstChild<>nil) then begin
|
if WithChilds and (ANode.FirstChild<>nil) then begin
|
||||||
AddDefineNodes(ANode.FirstChild,NewTreeNode,true,true);
|
AddDefineNodes(ANode.FirstChild,NewTreeNode,true,true);
|
||||||
end;
|
end;
|
||||||
@ -629,7 +651,8 @@ begin
|
|||||||
DefineTreeView.Items.EndUpdate;
|
DefineTreeView.Items.EndUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCodeToolsDefinesEditor.SetNodeImages(ANode: TTreeNode);
|
procedure TCodeToolsDefinesEditor.SetNodeImages(ANode: TTreeNode;
|
||||||
|
WithSubNodes: boolean);
|
||||||
var ADefineTemplate: TDefineTemplate;
|
var ADefineTemplate: TDefineTemplate;
|
||||||
begin
|
begin
|
||||||
ADefineTemplate:=TDefineTemplate(ANode.Data);
|
ADefineTemplate:=TDefineTemplate(ANode.Data);
|
||||||
@ -648,17 +671,24 @@ begin
|
|||||||
ANode.ImageIndex:=-1;
|
ANode.ImageIndex:=-1;
|
||||||
end;
|
end;
|
||||||
ANode.SelectedIndex:=ANode.ImageIndex;
|
ANode.SelectedIndex:=ANode.ImageIndex;
|
||||||
if dtfAutoGenerated in ADefineTemplate.Flags then begin
|
if ADefineTemplate.IsAutoGenerated then begin
|
||||||
if dtfProjectSpecific in ADefineTemplate.Flags then
|
if ADefineTemplate.IsProjectSpecific then
|
||||||
ANode.StateIndex:=13
|
ANode.StateIndex:=13
|
||||||
else
|
else
|
||||||
ANode.StateIndex:=11;
|
ANode.StateIndex:=11;
|
||||||
end else begin
|
end else begin
|
||||||
if dtfProjectSpecific in ADefineTemplate.Flags then
|
if ADefineTemplate.IsProjectSpecific then
|
||||||
ANode.StateIndex:=12
|
ANode.StateIndex:=12
|
||||||
else
|
else
|
||||||
ANode.StateIndex:=10;
|
ANode.StateIndex:=10;
|
||||||
end;
|
end;
|
||||||
|
if WithSubNodes then begin
|
||||||
|
ANode:=ANode.GetFirstChild;
|
||||||
|
while ANode<>nil do begin
|
||||||
|
SetNodeImages(ANode,true);
|
||||||
|
ANode:=ANode.GetNextSibling;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCodeToolsDefinesEditor.ValueAsPathToValueAsText;
|
procedure TCodeToolsDefinesEditor.ValueAsPathToValueAsText;
|
||||||
@ -694,22 +724,21 @@ begin
|
|||||||
ValueAsTextSynEdit.Text:=s;
|
ValueAsTextSynEdit.Text:=s;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCodeToolsDefinesEditor.SaveSelectedValues;
|
procedure TCodeToolsDefinesEditor.SaveSelectedValues(ATreeNode: TTreeNode);
|
||||||
var
|
var
|
||||||
SelTreeNode: TTreeNode;
|
ADefNode: TDefineTemplate;
|
||||||
SelDefNode: TDefineTemplate;
|
|
||||||
s: string;
|
s: string;
|
||||||
l: integer;
|
l: integer;
|
||||||
begin
|
begin
|
||||||
SelTreeNode:=DefineTreeView.Selected;
|
if (ATreeNode<>nil) then begin
|
||||||
if (SelTreeNode<>nil) then begin
|
ADefNode:=TDefineTemplate(ATreeNode.Data);
|
||||||
SelDefNode:=TDefineTemplate(SelTreeNode.Data);
|
if (not ADefNode.IsAutoGenerated) then begin
|
||||||
if (not SelDefNode.IsAutoGenerated) then begin
|
|
||||||
if ProjectSpecificCheckBox.Checked then
|
if ProjectSpecificCheckBox.Checked then
|
||||||
Include(SelDefNode.Flags,dtfProjectSpecific);
|
Include(ADefNode.Flags,dtfProjectSpecific);
|
||||||
SelDefNode.Name:=NameEdit.Text;
|
ADefNode.Name:=NameEdit.Text;
|
||||||
SelDefNode.Variable:=VariableEdit.Text;
|
ATreeNode.Text:=ADefNode.Name;
|
||||||
SelDefNode.Description:=DescriptionEdit.Text;
|
ADefNode.Variable:=VariableEdit.Text;
|
||||||
|
ADefNode.Description:=DescriptionEdit.Text;
|
||||||
s:=ValueAsTextSynEdit.Text;
|
s:=ValueAsTextSynEdit.Text;
|
||||||
l:=length(s);
|
l:=length(s);
|
||||||
if (l>0) and (s[l] in [#13,#10]) then begin
|
if (l>0) and (s[l] in [#13,#10]) then begin
|
||||||
@ -719,7 +748,7 @@ begin
|
|||||||
dec(l);
|
dec(l);
|
||||||
SetLength(s,l);
|
SetLength(s,l);
|
||||||
end;
|
end;
|
||||||
SelDefNode.Value:=s;
|
ADefNode.Value:=s;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -728,21 +757,14 @@ procedure TCodeToolsDefinesEditor.ShowSelectedValues;
|
|||||||
var
|
var
|
||||||
SelTreeNode: TTreeNode;
|
SelTreeNode: TTreeNode;
|
||||||
SelDefNode: TDefineTemplate;
|
SelDefNode: TDefineTemplate;
|
||||||
s: string;
|
|
||||||
begin
|
begin
|
||||||
SelTreeNode:=DefineTreeView.Selected;
|
SelTreeNode:=DefineTreeView.Selected;
|
||||||
if SelTreeNode<>FLastSelectedNode then begin
|
if SelTreeNode<>FLastSelectedNode then begin
|
||||||
SaveSelectedValues;
|
SaveSelectedValues(FLastSelectedNode);
|
||||||
end;
|
end;
|
||||||
if SelTreeNode<>nil then begin
|
if SelTreeNode<>nil then begin
|
||||||
SelDefNode:=TDefineTemplate(SelTreeNode.Data);
|
SelDefNode:=TDefineTemplate(SelTreeNode.Data);
|
||||||
SelectedItemGroupBox.Enabled:=true;
|
SelectedItemGroupBox.Enabled:=true;
|
||||||
s:='Action: '+DefineActionNames[SelDefNode.Action];
|
|
||||||
if SelDefNode.IsAutoGenerated then
|
|
||||||
s:=s+', auto generated';
|
|
||||||
if SelDefNode.IsProjectSpecific then
|
|
||||||
s:=s+', project specific';
|
|
||||||
TypeLabel.Caption:=s;
|
|
||||||
ProjectSpecificCheckBox.Checked:=dtfProjectSpecific in SelDefNode.Flags;
|
ProjectSpecificCheckBox.Checked:=dtfProjectSpecific in SelDefNode.Flags;
|
||||||
NameEdit.Text:=SelDefNode.Name;
|
NameEdit.Text:=SelDefNode.Name;
|
||||||
DescriptionEdit.Text:=SelDefNode.Description;
|
DescriptionEdit.Text:=SelDefNode.Description;
|
||||||
@ -760,17 +782,36 @@ begin
|
|||||||
ValueAsFilePathsSynEdit.ReadOnly:=ValueAsTextSynEdit.ReadOnly;
|
ValueAsFilePathsSynEdit.ReadOnly:=ValueAsTextSynEdit.ReadOnly;
|
||||||
end else begin
|
end else begin
|
||||||
SelectedItemGroupBox.Enabled:=false;
|
SelectedItemGroupBox.Enabled:=false;
|
||||||
TypeLabel.Caption:='none selected';
|
|
||||||
ProjectSpecificCheckBox.Enabled:=false;
|
|
||||||
NameEdit.Text:='';
|
NameEdit.Text:='';
|
||||||
DescriptionEdit.Text:='';
|
DescriptionEdit.Text:='';
|
||||||
VariableEdit.Text:='';
|
VariableEdit.Text:='';
|
||||||
ValueAsTextSynEdit.Text:='';
|
ValueAsTextSynEdit.Text:='';
|
||||||
ValueAsFilePathsSynEdit.Text:='';
|
ValueAsFilePathsSynEdit.Text:='';
|
||||||
end;
|
end;
|
||||||
|
SetTypeLabel;
|
||||||
FLastSelectedNode:=SelTreeNode;
|
FLastSelectedNode:=SelTreeNode;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCodeToolsDefinesEditor.SetTypeLabel;
|
||||||
|
var
|
||||||
|
SelTreeNode: TTreeNode;
|
||||||
|
SelDefNode: TDefineTemplate;
|
||||||
|
s: string;
|
||||||
|
begin
|
||||||
|
SelTreeNode:=DefineTreeView.Selected;
|
||||||
|
if SelTreeNode<>nil then begin
|
||||||
|
SelDefNode:=TDefineTemplate(SelTreeNode.Data);
|
||||||
|
s:='Action: '+DefineActionNames[SelDefNode.Action];
|
||||||
|
if SelDefNode.IsAutoGenerated then
|
||||||
|
s:=s+', auto generated';
|
||||||
|
if SelDefNode.IsProjectSpecific then
|
||||||
|
s:=s+', project specific';
|
||||||
|
end else begin
|
||||||
|
s:='none selected';
|
||||||
|
end;
|
||||||
|
TypeLabel.Caption:=s;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCodeToolsDefinesEditor.ValueToFilePathText(const AValue: string
|
function TCodeToolsDefinesEditor.ValueToFilePathText(const AValue: string
|
||||||
): string;
|
): string;
|
||||||
var i: integer;
|
var i: integer;
|
||||||
@ -793,10 +834,11 @@ begin
|
|||||||
ParentNode:=nil;
|
ParentNode:=nil;
|
||||||
if SelTreeNode<>nil then begin
|
if SelTreeNode<>nil then begin
|
||||||
// there is an selected node
|
// there is an selected node
|
||||||
if Behind then
|
if Behind then begin
|
||||||
// insert behind selected node
|
// insert behind selected node
|
||||||
NodeInFront:=SelTreeNode
|
NodeInFront:=SelTreeNode;
|
||||||
else begin
|
ParentNode:=NodeInFront.Parent;
|
||||||
|
end else begin
|
||||||
// insert as last child of selected node
|
// insert as last child of selected node
|
||||||
ParentNode:=SelTreeNode;
|
ParentNode:=SelTreeNode;
|
||||||
NodeInFront:=ParentNode.GetFirstChild;
|
NodeInFront:=ParentNode.GetFirstChild;
|
||||||
@ -808,12 +850,15 @@ begin
|
|||||||
end else begin
|
end else begin
|
||||||
// no node selected, add as last root node
|
// no node selected, add as last root node
|
||||||
NodeInFront:=DefineTreeView.Items.GetLastNode;
|
NodeInFront:=DefineTreeView.Items.GetLastNode;
|
||||||
if NodeInFront<>nil then begin
|
|
||||||
while NodeInFront.GetNextSibling<>nil do
|
|
||||||
NodeInFront:=NodeInFront.GetNextSibling;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
// find a unique name
|
if (ParentNode<>nil) and (TDefineTemplate(ParentNode.Data).IsAutoGenerated)
|
||||||
|
then begin
|
||||||
|
MessageDlg('Invalid Parent','Auto created nodes can not be edited,'#13
|
||||||
|
+'nor can they have non auto created child nodes.',mtInformation,[mbCancel]
|
||||||
|
,0);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
// find an unique name
|
||||||
if ParentNode<>nil then
|
if ParentNode<>nil then
|
||||||
FirstNode:=ParentNode.GetFirstChild
|
FirstNode:=ParentNode.GetFirstChild
|
||||||
else
|
else
|
||||||
@ -839,15 +884,14 @@ begin
|
|||||||
NewDefNode:=TDefineTemplate.Create(NewName,NewDescription,NewVariable,
|
NewDefNode:=TDefineTemplate.Create(NewName,NewDescription,NewVariable,
|
||||||
NewValue,Action);
|
NewValue,Action);
|
||||||
// add node to treeview
|
// add node to treeview
|
||||||
if ParentNode<>nil then
|
if (NodeInFront<>nil) then
|
||||||
// add as last child
|
|
||||||
NewTreeNode:=DefineTreeView.Items.AddChildObject(ParentNode,NewName,
|
|
||||||
NewDefNode)
|
|
||||||
else if (NodeInFront<>nil) and (NodeInFront.GetNextSibling<>nil) then
|
|
||||||
// insert in front
|
// insert in front
|
||||||
NewTreeNode:=DefineTreeView.Items.InsertObjectBehind(
|
NewTreeNode:=DefineTreeView.Items.InsertObjectBehind(
|
||||||
NodeInFront,NewName,NewDefNode);
|
NodeInFront,NewName,NewDefNode)
|
||||||
SetNodeImages(NewTreeNode);
|
else
|
||||||
|
// add as last child
|
||||||
|
NewTreeNode:=DefineTreeView.Items.AddChildObject(ParentNode,NewName,
|
||||||
|
NewDefNode);
|
||||||
|
|
||||||
// add node to define tree
|
// add node to define tree
|
||||||
if NodeInFront<>nil then
|
if NodeInFront<>nil then
|
||||||
@ -856,6 +900,9 @@ begin
|
|||||||
TDefineTemplate(ParentNode.Data).AddChild(NewDefNode)
|
TDefineTemplate(ParentNode.Data).AddChild(NewDefNode)
|
||||||
else
|
else
|
||||||
FDefineTree.Add(NewDefNode);
|
FDefineTree.Add(NewDefNode);
|
||||||
|
|
||||||
|
SetNodeImages(NewTreeNode,true);
|
||||||
|
DefineTreeView.Selected:=NewTreeNode;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCodeToolsDefinesEditor.Assign(ACodeToolBoss: TCodeToolManager;
|
procedure TCodeToolsDefinesEditor.Assign(ACodeToolBoss: TCodeToolManager;
|
||||||
|
@ -1505,6 +1505,8 @@ type
|
|||||||
function GetMaxScrollTop: integer;
|
function GetMaxScrollTop: integer;
|
||||||
function GetNodeAtInternalY(Y: Integer): TTreeNode;
|
function GetNodeAtInternalY(Y: Integer): TTreeNode;
|
||||||
function GetNodeAtY(Y: Integer): TTreeNode;
|
function GetNodeAtY(Y: Integer): TTreeNode;
|
||||||
|
function GetNodeDrawAreaWidth: integer;
|
||||||
|
function GetNodeDrawAreaHeight: integer;
|
||||||
procedure GetSelectedIndex(Node: TTreeNode); virtual;
|
procedure GetSelectedIndex(Node: TTreeNode); virtual;
|
||||||
function IsCustomDrawn(Target: TCustomDrawTarget;
|
function IsCustomDrawn(Target: TCustomDrawTarget;
|
||||||
Stage: TCustomDrawStage): Boolean;
|
Stage: TCustomDrawStage): Boolean;
|
||||||
@ -1521,6 +1523,7 @@ type
|
|||||||
procedure SetDragMode(Value: TDragMode); override;
|
procedure SetDragMode(Value: TDragMode); override;
|
||||||
procedure SetOptions(NewOptions: TTreeViewOptions);
|
procedure SetOptions(NewOptions: TTreeViewOptions);
|
||||||
procedure WndProc(var Message: TLMessage); override;
|
procedure WndProc(var Message: TLMessage); override;
|
||||||
|
|
||||||
property AutoExpand: Boolean read GetAutoExpand write SetAutoExpand default False;
|
property AutoExpand: Boolean read GetAutoExpand write SetAutoExpand default False;
|
||||||
property BorderStyle: TBorderStyle
|
property BorderStyle: TBorderStyle
|
||||||
read FBorderStyle write SetBorderStyle default bsSingle;
|
read FBorderStyle write SetBorderStyle default bsSingle;
|
||||||
@ -1754,6 +1757,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.23 2002/03/04 13:07:21 lazarus
|
||||||
|
MG: fixed update bottomitem on wmsize
|
||||||
|
|
||||||
Revision 1.22 2002/03/04 07:28:53 lazarus
|
Revision 1.22 2002/03/04 07:28:53 lazarus
|
||||||
MG: find declaration: fixed function in with context
|
MG: find declaration: fixed function in with context
|
||||||
|
|
||||||
|
@ -595,11 +595,8 @@ begin
|
|||||||
Result:=Result.Parent;
|
Result:=Result.Parent;
|
||||||
if Result<>nil then Result:=Result.GetNextSibling;
|
if Result<>nil then Result:=Result.GetNextSibling;
|
||||||
end;
|
end;
|
||||||
//writeln('TTreeNode.GetNextVisible A ',HexStr(Cardinal(Result),8));
|
if (Result<>nil) and (not Result.IsVisible) then
|
||||||
if (Result<>nil) and (TreeView<>nil) and (not TreeView.IsNodeVisible(Result))
|
|
||||||
then
|
|
||||||
Result:=nil;
|
Result:=nil;
|
||||||
//writeln('TTreeNode.GetNextVisible B ',HexStr(Cardinal(Result),8));
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TTreeNode.GetPrevVisible: TTreeNode;
|
function TTreeNode.GetPrevVisible: TTreeNode;
|
||||||
@ -950,8 +947,12 @@ writeln('');
|
|||||||
taInsert:
|
taInsert:
|
||||||
begin
|
begin
|
||||||
// insert node in front of ANode
|
// insert node in front of ANode
|
||||||
//writeln('[TTreeNode.InternalMove] ANode.Index=',ANode.Index);
|
//writeln('[TTreeNode.InternalMove] ANode.Index=',ANode.Index,' ANode=',HexStr(Cardinal(ANode),8));
|
||||||
Owner.MoveTopLvlNode(-1,ANode.Index,Self);
|
FNextBrother:=ANode;
|
||||||
|
FPrevBrother:=ANode.GetPrevSibling;
|
||||||
|
if Owner<>nil then begin
|
||||||
|
Owner.MoveTopLvlNode(-1,ANode.Index,Self);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1011,11 +1012,11 @@ procedure TTreeNode.MoveTo(Destination: TTreeNode; Mode: TNodeAttachMode);
|
|||||||
{
|
{
|
||||||
TNodeAttachMode = (naAdd, naAddFirst, naAddChild, naAddChildFirst, naInsert);
|
TNodeAttachMode = (naAdd, naAddFirst, naAddChild, naAddChildFirst, naInsert);
|
||||||
|
|
||||||
naAdd: add as last sibling of Destination
|
naAdd: add as last sibling of Destination
|
||||||
naAddFirst: add as first sibling of Destnation
|
naAddFirst: add as first sibling of Destnation
|
||||||
naAddChild: add as last child of Destination
|
naAddChild: add as last child of Destination
|
||||||
naAddChildFirst: add as first child of Destination
|
naAddChildFirst: add as first child of Destination
|
||||||
naInsert: insert in front of Destination
|
naInsert: insert in front of Destination
|
||||||
}
|
}
|
||||||
var
|
var
|
||||||
AddMode: TAddMode;
|
AddMode: TAddMode;
|
||||||
@ -1581,7 +1582,7 @@ begin
|
|||||||
if (PrevNode<>nil) and (PrevNode.GetNextSibling<>nil) then
|
if (PrevNode<>nil) and (PrevNode.GetNextSibling<>nil) then
|
||||||
Result:=InternalAddObject(PrevNode.GetNextSibling,S,Data,taInsert)
|
Result:=InternalAddObject(PrevNode.GetNextSibling,S,Data,taInsert)
|
||||||
else
|
else
|
||||||
Result:=AddObject(nil,S,Data);
|
Result:=AddObject(PrevNode,S,Data);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TTreeNodes.InternalAddObject(Node: TTreeNode; const S: string;
|
function TTreeNodes.InternalAddObject(Node: TTreeNode; const S: string;
|
||||||
@ -1611,6 +1612,7 @@ writeln('');
|
|||||||
Owner.Invalidate;
|
Owner.Invalidate;
|
||||||
ok:=true;
|
ok:=true;
|
||||||
finally
|
finally
|
||||||
|
// this construction creates nicer exception output
|
||||||
if not ok then
|
if not ok then
|
||||||
Result.Free;
|
Result.Free;
|
||||||
end;
|
end;
|
||||||
@ -1863,10 +1865,10 @@ writeln('[TTreeNodes.MoveTopLvlNode] TopLvlFromIndex=',TopLvlFromIndex,
|
|||||||
TreeNodeError('TTreeNodes.MoveTopLvlNode inserting nil');
|
TreeNodeError('TTreeNodes.MoveTopLvlNode inserting nil');
|
||||||
// insert node
|
// insert node
|
||||||
if FTopLvlCount=FTopLvlCapacity then GrowTopLvlItems;
|
if FTopLvlCount=FTopLvlCapacity then GrowTopLvlItems;
|
||||||
|
inc(FTopLvlCount);
|
||||||
for i:=FTopLvlCount-1 downto TopLvlToIndex+1 do
|
for i:=FTopLvlCount-1 downto TopLvlToIndex+1 do
|
||||||
FTopLvlItems[i]:=FTopLvlItems[i-1];
|
FTopLvlItems[i]:=FTopLvlItems[i-1];
|
||||||
FTopLvlItems[TopLvlToIndex]:=Node;
|
FTopLvlItems[TopLvlToIndex]:=Node;
|
||||||
inc(FTopLvlCount);
|
|
||||||
end else begin
|
end else begin
|
||||||
// nothing to do
|
// nothing to do
|
||||||
end;
|
end;
|
||||||
@ -2038,8 +2040,10 @@ begin
|
|||||||
if (i>0) and (FTopLvlItems[i].FPrevBrother<>FTopLvlItems[i-1]) then
|
if (i>0) and (FTopLvlItems[i].FPrevBrother<>FTopLvlItems[i-1]) then
|
||||||
exit(-9);
|
exit(-9);
|
||||||
if (i<FTopLvlCount-1) and (FTopLvlItems[i].FNextBrother<>FTopLvlItems[i+1])
|
if (i<FTopLvlCount-1) and (FTopLvlItems[i].FNextBrother<>FTopLvlItems[i+1])
|
||||||
then
|
then begin
|
||||||
|
writeln(' CONSISTENCY i=',i,' FTopLvlCount=',FTopLvlCount,' FTopLvlItems[i]=',HexStr(Cardinal(FTopLvlItems[i]),8),' FTopLvlItems[i].FNextBrother=',HexStr(Cardinal(FTopLvlItems[i].FNextBrother),8),' FTopLvlItems[i+1]=',HexStr(Cardinal(FTopLvlItems[i+1]),8));
|
||||||
exit(-10);
|
exit(-10);
|
||||||
|
end;
|
||||||
if (i=FTopLvlCount-1) and (FTopLvlItems[i].FNextBrother<>nil) then
|
if (i=FTopLvlCount-1) and (FTopLvlItems[i].FNextBrother<>nil) then
|
||||||
exit(-11);
|
exit(-11);
|
||||||
end;
|
end;
|
||||||
@ -2909,6 +2913,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomTreeView.GetNodeDrawAreaWidth: integer;
|
||||||
|
begin
|
||||||
|
Result:=ClientWidth-ScrollBarWidth-BorderWidth*2;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCustomTreeView.GetNodeDrawAreaHeight: integer;
|
||||||
|
begin
|
||||||
|
Result:=ClientHeight-ScrollBarWidth-BorderWidth*2;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCustomTreeView.GetNodeAt(X, Y: Integer): TTreeNode;
|
function TCustomTreeView.GetNodeAt(X, Y: Integer): TTreeNode;
|
||||||
//var HitTest: TTVHitTestInfo;
|
//var HitTest: TTVHitTestInfo;
|
||||||
begin
|
begin
|
||||||
@ -3030,7 +3044,6 @@ begin
|
|||||||
//writeln('[TCustomTreeView.IsNodeVisible] A Node=',HexStr(Cardinal(ANode),8),
|
//writeln('[TCustomTreeView.IsNodeVisible] A Node=',HexStr(Cardinal(ANode),8),
|
||||||
//' ANode.AreParentsExpanded=',ANode.AreParentsExpanded);
|
//' ANode.AreParentsExpanded=',ANode.AreParentsExpanded);
|
||||||
if Result then begin
|
if Result then begin
|
||||||
UpdateAllTops;
|
|
||||||
//writeln('[TCustomTreeView.IsNodeVisible] B Node=',HexStr(Cardinal(ANode),8),
|
//writeln('[TCustomTreeView.IsNodeVisible] B Node=',HexStr(Cardinal(ANode),8),
|
||||||
//' ',FScrolledTop,'>=',ANode.Top,'+',ANode.Height,' or ',FScrolledTop,'+',ClientHeight,'<',ANode.Top);
|
//' ',FScrolledTop,'>=',ANode.Top,'+',ANode.Height,' or ',FScrolledTop,'+',ClientHeight,'<',ANode.Top);
|
||||||
if (FScrolledTop>=ANode.Top+ANode.Height)
|
if (FScrolledTop>=ANode.Top+ANode.Height)
|
||||||
@ -3141,9 +3154,10 @@ procedure TCustomTreeView.SetSelection(Value: TTreeNode);
|
|||||||
begin
|
begin
|
||||||
if FSelectedNode=Value then exit;
|
if FSelectedNode=Value then exit;
|
||||||
FSelectedNode:=Value;
|
FSelectedNode:=Value;
|
||||||
if Value <> nil then
|
if Value <> nil then begin
|
||||||
Value.Selected := True;
|
Value.Selected := True;
|
||||||
// TreeView_SelectItem(Handle, nil);
|
Value.MakeVisible;
|
||||||
|
end;
|
||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3899,14 +3913,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomTreeView.EnsureNodeIsVisible(ANode: TTreeNode);
|
procedure TCustomTreeView.EnsureNodeIsVisible(ANode: TTreeNode);
|
||||||
|
var b: integer;
|
||||||
begin
|
begin
|
||||||
if ANode=nil then exit;
|
if ANode=nil then exit;
|
||||||
ANode.ExpandParents;
|
ANode.ExpandParents;
|
||||||
UpdateAllTops;
|
|
||||||
if ANode.Top<ScrolledTop then
|
if ANode.Top<ScrolledTop then
|
||||||
ScrolledTop:=ANode.Top
|
ScrolledTop:=ANode.Top
|
||||||
else if ANode.Top+ANode.Height>ScrolledTop+(ClientHeight-ScrollBarWidth) then
|
else begin
|
||||||
ScrolledTop:=ANode.Top+ANode.Height-(ClientHeight-ScrollBarWidth);
|
b:=ANode.Top+ANode.Height-GetNodeDrawAreaHeight;
|
||||||
|
if ScrolledTop<b then ScrolledTop:=b;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomTreeView.CreateNode: TTreeNode;
|
function TCustomTreeView.CreateNode: TTreeNode;
|
||||||
@ -4243,7 +4259,7 @@ end;
|
|||||||
|
|
||||||
procedure TCustomTreeView.WMSize(var Msg: TLMSize);
|
procedure TCustomTreeView.WMSize(var Msg: TLMSize);
|
||||||
begin
|
begin
|
||||||
Include(FStates,tvsScrollbarChanged);
|
FStates:=FStates+[tvsScrollbarChanged,tvsBottomItemNeedsUpdate];
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -4312,7 +4328,7 @@ begin
|
|||||||
if FTreeNodes=nil then exit(-6);
|
if FTreeNodes=nil then exit(-6);
|
||||||
Result:=FTreeNodes.ConsistencyCheck;
|
Result:=FTreeNodes.ConsistencyCheck;
|
||||||
if Result<>0 then begin
|
if Result<>0 then begin
|
||||||
dec(Result,100);
|
dec(Result,1000);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
if FUpdateCount<0 then exit(-7);
|
if FUpdateCount<0 then exit(-7);
|
||||||
|
Loading…
Reference in New Issue
Block a user