mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-21 19:30:06 +01:00
* Sort Names in data panels. Add PageCount (bug ID #33371)
git-svn-id: trunk@57463 -
This commit is contained in:
parent
f6fe6b4f9e
commit
7f15e1c27b
@ -39,13 +39,16 @@ type
|
|||||||
procedure TVDataStartDrag(Sender: TObject; var DragObject: TDragObject);
|
procedure TVDataStartDrag(Sender: TObject; var DragObject: TDragObject);
|
||||||
procedure TVFunctionsStartDrag(Sender: TObject; var DragObject: TDragObject);
|
procedure TVFunctionsStartDrag(Sender: TObject; var DragObject: TDragObject);
|
||||||
private
|
private
|
||||||
|
FPageCount : TFPExprIdentifierDef;
|
||||||
FIdentifiers: TFPExprIdentifierDefs;
|
FIdentifiers: TFPExprIdentifierDefs;
|
||||||
FUserVariables : TTreeNode;
|
FUserVariables : TTreeNode;
|
||||||
FBuiltinVariables : TTreeNode;
|
FBuiltinVariables : TTreeNode;
|
||||||
FDataLastDown : TPoint;
|
FDataLastDown : TPoint;
|
||||||
FReport: TFPReport;
|
FReport: TFPReport;
|
||||||
FReportData: TFPReportDataCollection;
|
FReportData: TFPReportDataCollection;
|
||||||
|
|
||||||
procedure AddBuiltInVariables(aParent: TTreeNode);
|
procedure AddBuiltInVariables(aParent: TTreeNode);
|
||||||
|
procedure AddUserVariables(aParent: TTreeNode; Vars: TFPReportVariables);
|
||||||
procedure SetReport(AValue: TFPReport);
|
procedure SetReport(AValue: TFPReport);
|
||||||
public
|
public
|
||||||
Constructor Create(AOwner : TComponent); override;
|
Constructor Create(AOwner : TComponent); override;
|
||||||
@ -190,19 +193,25 @@ Var
|
|||||||
ID : TFPBuiltInExprIdentifierDef;
|
ID : TFPBuiltInExprIdentifierDef;
|
||||||
CatNodes : Array[TBuiltInCategory] of TTreeNode;
|
CatNodes : Array[TBuiltInCategory] of TTreeNode;
|
||||||
C : TBuiltInCategory;
|
C : TBuiltInCategory;
|
||||||
|
L : TStringList;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
L:=Nil;
|
||||||
With TVFunctions.Items do
|
With TVFunctions.Items do
|
||||||
try
|
try
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
Clear;
|
Clear;
|
||||||
if not Assigned(Report) then
|
if not Assigned(Report) then
|
||||||
exit;
|
exit;
|
||||||
|
L:=TStringList.Create;
|
||||||
|
For I:=0 to BuiltinIdentifiers.IdentifierCount-1 do
|
||||||
|
L.AddObject(BuiltinIdentifiers.Identifiers[i].Name,BuiltinIdentifiers.Identifiers[i]);
|
||||||
|
L.Sort;
|
||||||
For C in TBuiltInCategory do
|
For C in TBuiltInCategory do
|
||||||
CatNodes[C]:=AddChild(Nil,CatNames[C]);
|
CatNodes[C]:=AddChild(Nil,CatNames[C]);
|
||||||
For I:=0 to BuiltinIdentifiers.IdentifierCount-1 do
|
For I:=0 to L.Count-1 do
|
||||||
begin
|
begin
|
||||||
ID:=BuiltinIdentifiers.Identifiers[i];
|
ID:=TFPBuiltInExprIdentifierDef(L.Objects[i]);
|
||||||
S:=ID.Name;
|
S:=ID.Name;
|
||||||
A:='';
|
A:='';
|
||||||
For J:=1 to ID.ArgumentCount do
|
For J:=1 to ID.ArgumentCount do
|
||||||
@ -224,6 +233,7 @@ begin
|
|||||||
CatNodes[C].Expand(True);
|
CatNodes[C].Expand(True);
|
||||||
finally
|
finally
|
||||||
EndUpdate;
|
EndUpdate;
|
||||||
|
FreeAndNil(L);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -257,13 +267,15 @@ Var
|
|||||||
D : TFPReportData;
|
D : TFPReportData;
|
||||||
FN,RDN : String;
|
FN,RDN : String;
|
||||||
I,J : integer;
|
I,J : integer;
|
||||||
|
L : TStringList;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
L:=Nil;
|
||||||
With TVData.Items do
|
With TVData.Items do
|
||||||
try
|
try
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
Clear;
|
Clear;
|
||||||
|
L:=TStringList.Create;
|
||||||
if not Assigned(Report) then
|
if not Assigned(Report) then
|
||||||
exit;
|
exit;
|
||||||
For I:=0 to Report.ReportData.Count-1 do
|
For I:=0 to Report.ReportData.Count-1 do
|
||||||
@ -276,9 +288,13 @@ begin
|
|||||||
RDN:=Format(SUnNamedData,[i+1]);
|
RDN:=Format(SUnNamedData,[i+1]);
|
||||||
DN:=AddChild(Nil,RDN);
|
DN:=AddChild(Nil,RDN);
|
||||||
DN.Data:=D;
|
DN.Data:=D;
|
||||||
|
L.Clear;
|
||||||
For J:=0 to D.FieldCount-1 do
|
For J:=0 to D.FieldCount-1 do
|
||||||
|
L.Add(D.FieldNames[J]);
|
||||||
|
L.Sort;
|
||||||
|
For J:=0 to L.Count-1 do
|
||||||
begin
|
begin
|
||||||
FN:=D.FieldNames[J];
|
FN:=L[J];
|
||||||
N:=AddChild(DN,FN);
|
N:=AddChild(DN,FN);
|
||||||
N.Data:=D;
|
N.Data:=D;
|
||||||
end;
|
end;
|
||||||
@ -290,35 +306,69 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TReportDataDisplay.AddUserVariables(aParent : TTreeNode; Vars : TFPReportVariables);
|
||||||
|
|
||||||
|
Var
|
||||||
|
V : TFPReportVariable;
|
||||||
|
I : Integer;
|
||||||
|
N : TTreeNode;
|
||||||
|
L : TStringList;
|
||||||
|
|
||||||
|
begin
|
||||||
|
L:=TStringList.Create;
|
||||||
|
try
|
||||||
|
For I:=0 to Vars.Count-1 do
|
||||||
|
L.AddObject(Vars[i].Name,Vars[i]);
|
||||||
|
L.Sort;
|
||||||
|
For I:=0 to FReport.Variables.Count-1 do
|
||||||
|
begin
|
||||||
|
V:=TFPReportVariable(L.Objects[i]);
|
||||||
|
N:=TVVariables.Items.AddChild(aParent,V.Name);
|
||||||
|
N.Data:=V;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
L.Free;
|
||||||
|
end;
|
||||||
|
AParent.Expand(false);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TReportDataDisplay.AddBuiltInVariables(aParent : TTreeNode);
|
procedure TReportDataDisplay.AddBuiltInVariables(aParent : TTreeNode);
|
||||||
|
|
||||||
Var
|
Var
|
||||||
V : TFPExprIdentifierDef;
|
V : TFPExprIdentifierDef;
|
||||||
I : Integer;
|
I : Integer;
|
||||||
N : TTreeNode;
|
N : TTreeNode;
|
||||||
|
L : TStringList;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|
||||||
if Assigned(Fidentifiers) then
|
if Assigned(Fidentifiers) then
|
||||||
FIdentifiers.Clear
|
FIdentifiers.Clear
|
||||||
else
|
else
|
||||||
FIdentifiers:=TFPExprIdentifierDefs.Create(TFPExprIdentifierDef);
|
FIdentifiers:=TFPExprIdentifierDefs.Create(TFPExprIdentifierDef);
|
||||||
if Assigned(FReport) then
|
if Assigned(FReport) then
|
||||||
FReport.AddBuiltinsToExpressionIdentifiers(FIdentifiers);
|
FReport.AddBuiltinsToExpressionIdentifiers(FIdentifiers);
|
||||||
For I:=0 to Fidentifiers.Count-1 do
|
if FIdentifiers.FindIdentifier('PageCount')=Nil then
|
||||||
begin
|
FIdentifiers.AddIntegerVariable('PageCount',-1);
|
||||||
V:=FIdentifiers[i];
|
L:=TStringList.Create;
|
||||||
N:=TVVariables.Items.AddChild(aParent,V.Name);
|
try
|
||||||
N.Data:=V;
|
For I:=0 to Fidentifiers.Count-1 do
|
||||||
end;
|
L.AddObject(Fidentifiers[i].Name,Fidentifiers[i]);
|
||||||
|
L.Sort;
|
||||||
|
For I:=0 to L.Count-1 do
|
||||||
|
begin
|
||||||
|
V:=TFPExprIdentifierDef(L.Objects[i]);
|
||||||
|
N:=TVVariables.Items.AddChild(aParent,V.Name);
|
||||||
|
N.Data:=V;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
L.Free;
|
||||||
|
end;
|
||||||
|
AParent.Expand(false);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TReportDataDisplay.RefreshVariables;
|
procedure TReportDataDisplay.RefreshVariables;
|
||||||
|
|
||||||
Var
|
|
||||||
V : TFPReportVariable;
|
|
||||||
I : Integer;
|
|
||||||
N : TTreeNode;
|
|
||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
With TVVariables.Items do
|
With TVVariables.Items do
|
||||||
@ -330,12 +380,7 @@ begin
|
|||||||
FUserVariables:=AddChild(Nil,SUserDefined);
|
FUserVariables:=AddChild(Nil,SUserDefined);
|
||||||
FBuiltinVariables:=AddChild(Nil,SBuiltIn);
|
FBuiltinVariables:=AddChild(Nil,SBuiltIn);
|
||||||
AddBuiltInVariables(FBuiltinVariables);
|
AddBuiltInVariables(FBuiltinVariables);
|
||||||
For I:=0 to FReport.Variables.Count-1 do
|
AddUservariables(FUserVariables,FReport.Variables);
|
||||||
begin
|
|
||||||
V:=FReport.Variables[I];
|
|
||||||
N:=AddChild(FUserVariables,V.Name);
|
|
||||||
N.Data:=V;
|
|
||||||
end;
|
|
||||||
finally
|
finally
|
||||||
EndUpdate;
|
EndUpdate;
|
||||||
end;
|
end;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user