mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 12:19:16 +02:00
LazReport, allow to distinguish between name.lrt and name.frt in new from template dialog
git-svn-id: trunk@42995 -
This commit is contained in:
parent
f3f2450272
commit
a6d9f9da26
@ -13,19 +13,19 @@ object frTemplForm: TfrTemplForm
|
||||
OnCreate = FormCreate
|
||||
OnDeactivate = FormDeactivate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.1'
|
||||
LCLVersion = '1.3'
|
||||
object GroupBox1: TGroupBox
|
||||
AnchorSideTop.Control = Owner
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = ButtonPanel1
|
||||
Left = 253
|
||||
Height = 230
|
||||
Height = 236
|
||||
Top = 0
|
||||
Width = 209
|
||||
Anchors = [akTop, akRight, akBottom]
|
||||
Caption = 'Description'
|
||||
ClientHeight = 213
|
||||
ClientHeight = 219
|
||||
ClientWidth = 205
|
||||
TabOrder = 0
|
||||
object Image1: TImage
|
||||
@ -53,7 +53,7 @@ object frTemplForm: TfrTemplForm
|
||||
AnchorSideRight.Control = GroupBox1
|
||||
AnchorSideBottom.Control = ButtonPanel1
|
||||
Left = 6
|
||||
Height = 224
|
||||
Height = 230
|
||||
Top = 6
|
||||
Width = 241
|
||||
HelpContext = 65
|
||||
@ -63,14 +63,14 @@ object frTemplForm: TfrTemplForm
|
||||
ItemHeight = 0
|
||||
OnClick = ListBox1Click
|
||||
OnDblClick = LB1DblClick
|
||||
ScrollWidth = 239
|
||||
ScrollWidth = 237
|
||||
TabOrder = 1
|
||||
TopIndex = -1
|
||||
end
|
||||
object ButtonPanel1: TButtonPanel
|
||||
Left = 6
|
||||
Height = 42
|
||||
Top = 236
|
||||
Height = 36
|
||||
Top = 242
|
||||
Width = 450
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.DefaultCaption = True
|
||||
|
@ -69,7 +69,7 @@ begin
|
||||
begin
|
||||
if (SearchRec.Attr and faDirectory) = 0 then begin
|
||||
if CheckLrtTemplate(SearchRec.Name) then
|
||||
LB1.Items.Add(ChangeFileExt(SearchRec.Name, ''));
|
||||
LB1.Items.AddObject(ChangeFileExt(SearchRec.Name, ''), Lb1);
|
||||
end;
|
||||
R := FindNextUTF8(SearchRec);
|
||||
end;
|
||||
@ -95,11 +95,21 @@ begin
|
||||
Image1.Picture.Clear;
|
||||
end
|
||||
else
|
||||
if FileExistsUTF8(FTemplatePath + LB1.Items[Index] + '.frt') then
|
||||
CurReport.LoadTemplate(FTemplatePath + LB1.Items[Index] + '.frt', Memo1.Lines, Image1.Picture.Bitmap,False)
|
||||
else
|
||||
if FileExistsUTF8(FTemplatePath + LB1.Items[Index] + '.lrt') then
|
||||
CurReport.LoadTemplateXML(FTemplatePath + LB1.Items[Index] + '.lrt', Memo1.Lines, Image1.Picture.Bitmap,False)
|
||||
begin
|
||||
if LB1.Items.Objects[Index]=LB1 then
|
||||
begin
|
||||
// lrt template
|
||||
if FileExistsUTF8(FTemplatePath + LB1.Items[Index] + '.lrt') then
|
||||
CurReport.LoadTemplateXML(FTemplatePath + LB1.Items[Index] + '.lrt',
|
||||
Memo1.Lines, Image1.Picture.Bitmap,False);
|
||||
end else
|
||||
begin
|
||||
// frt template
|
||||
if FileExistsUTF8(FTemplatePath + LB1.Items[Index] + '.frt') then
|
||||
CurReport.LoadTemplate(FTemplatePath + LB1.Items[Index] + '.frt',
|
||||
Memo1.Lines, Image1.Picture.Bitmap,False);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -123,17 +133,26 @@ begin
|
||||
end;
|
||||
|
||||
procedure TfrTemplForm.FormDeactivate(Sender: TObject);
|
||||
var
|
||||
Index: Integer;
|
||||
aFileName: string;
|
||||
begin
|
||||
DefaultTemplate := false;
|
||||
if ModalResult = mrOk then
|
||||
begin
|
||||
if LB1.Items.Objects[LB1.ItemIndex]=self then
|
||||
Index := LB1.ItemIndex;
|
||||
if LB1.Items.Objects[Index]=self then
|
||||
DefaultTemplate := true
|
||||
else
|
||||
if FileExistsUTF8(FTemplatePath + LB1.Items[LB1.ItemIndex] + '.lrt') then
|
||||
TemplName := FTemplatePath + LB1.Items[LB1.ItemIndex] + '.lrt'
|
||||
begin
|
||||
aFileName := FTemplatePath + LB1.Items[LB1.ItemIndex];
|
||||
if LB1.Items.Objects[Index]=LB1 then
|
||||
aFileName := aFileName + '.lrt'
|
||||
else
|
||||
TemplName := FTemplatePath + LB1.Items[LB1.ItemIndex] + '.frt';
|
||||
aFileName := aFileName + '.frt';
|
||||
if FileExists(aFileName) then
|
||||
TemplName := aFileName;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user