📄 frxdesgneditors.pas
字号:
{******************************************}
{ }
{ FastReport v3.0 }
{ Property editors for Designer }
{ }
{ Copyright (c) 1998-2005 }
{ by Alexander Tzyganenko, }
{ Fast Reports Inc. }
{ }
{******************************************}
unit frxDesgnEditors;
interface
{$I frx.inc}
implementation
uses
Windows, Classes, SysUtils, Graphics, Controls, StdCtrls, Forms, Menus,
Dialogs, frxClass, frxDMPClass, frxDesgn, frxDsgnIntf, frxUtils,
frxCtrls, frxCustomEditors, frxEditPage, frxEditMemo,
frxEditDataBand, frxEditStrings, frxEditFormat, frxEditGroup, frxEditSysMemo,
frxCodeUtils, frxEditPicture, frxEditFrame, frxRes
{$IFDEF Delphi6}
, Variants
{$ENDIF};
type
{ Component editors }
TfrxPageEditor = class(TfrxComponentEditor)
public
function Edit:Boolean; override;
function HasEditor:Boolean; override;
end;
TfrxMemoEditor = class(TfrxCustomMemoEditor)
public
function Edit:Boolean; override;
function HasEditor:Boolean; override;
end;
TfrxSysMemoEditor = class(TfrxCustomMemoEditor)
public
function Edit:Boolean; override;
function HasEditor:Boolean; override;
end;
TfrxLineEditor = class(TfrxViewEditor)
public
procedure GetMenuItems; override;
function Execute(Tag:Integer; Checked:Boolean):Boolean; override;
end;
TfrxPictureEditor = class(TfrxViewEditor)
public
function Edit:Boolean; override;
function HasEditor:Boolean; override;
procedure GetMenuItems; override;
function Execute(Tag:Integer; Checked:Boolean):Boolean; override;
end;
TfrxBandEditor = class(TfrxComponentEditor)
public
procedure GetMenuItems; override;
function Execute(Tag:Integer; Checked:Boolean):Boolean; override;
end;
TfrxDataBandEditor = class(TfrxBandEditor)
public
function Edit:Boolean; override;
function HasEditor:Boolean; override;
procedure GetMenuItems; override;
function Execute(Tag:Integer; Checked:Boolean):Boolean; override;
end;
TfrxHeaderEditor = class(TfrxBandEditor)
public
procedure GetMenuItems; override;
function Execute(Tag:Integer; Checked:Boolean):Boolean; override;
end;
TfrxPageHeaderEditor = class(TfrxBandEditor)
public
procedure GetMenuItems; override;
function Execute(Tag:Integer; Checked:Boolean):Boolean; override;
end;
TfrxPageFooterEditor = class(TfrxComponentEditor)
public
procedure GetMenuItems; override;
function Execute(Tag:Integer; Checked:Boolean):Boolean; override;
end;
TfrxGroupHeaderEditor = class(TfrxBandEditor)
public
function Edit:Boolean; override;
function HasEditor:Boolean; override;
procedure GetMenuItems; override;
function Execute(Tag:Integer; Checked:Boolean):Boolean; override;
end;
TfrxDialogControlEditor = class(TfrxComponentEditor)
public
function Edit:Boolean; override;
function HasEditor:Boolean; override;
end;
TfrxSubreportEditor = class(TfrxComponentEditor)
public
function Edit:Boolean; override;
function HasEditor:Boolean; override;
procedure GetMenuItems; override;
function Execute(Tag:Integer; Checked:Boolean):Boolean; override;
end;
{ Property editors }
TfrxMemoProperty = class(TfrxClassProperty)
public
function GetAttributes:TfrxPropertyAttributes; override;
function Edit:Boolean; override;
end;
TfrxFrameProperty = class(TfrxClassProperty)
public
function GetAttributes:TfrxPropertyAttributes; override;
function Edit:Boolean; override;
end;
TfrxPictureProperty = class(TfrxClassProperty)
public
function GetValue:String; override;
function GetAttributes:TfrxPropertyAttributes; override;
function Edit:Boolean; override;
end;
TfrxBitmapProperty = class(TfrxClassProperty)
public
function GetValue:String; override;
function GetAttributes:TfrxPropertyAttributes; override;
function Edit:Boolean; override;
end;
TfrxDataSetProperty = class(TfrxPropertyEditor)
public
function GetValue:String; override;
function GetAttributes:TfrxPropertyAttributes; override;
procedure GetValues; override;
procedure SetValue(const Value:String); override;
end;
TfrxDataFieldProperty = class(TfrxPropertyEditor)
public
function GetValue:String; override;
function GetAttributes:TfrxPropertyAttributes; override;
procedure GetValues; override;
procedure SetValue(const Value:String); override;
end;
TfrxEventProperty = class(TfrxStringProperty)
public
function GetAttributes:TfrxPropertyAttributes; override;
function Edit:Boolean; override;
procedure GetValues; override;
end;
TfrxLocSizeXProperty = class(TfrxFloatProperty)
protected
FRatio:Extended;
public
constructor Create(Designer:TfrxCustomDesigner); override;
function GetValue:String; override;
procedure SetValue(const Value:String); override;
end;
TfrxLocSizeYProperty = class(TfrxLocSizeXProperty)
public
constructor Create(Designer:TfrxCustomDesigner); override;
end;
TfrxPaperXProperty = class(TfrxFloatProperty)
protected
FRatio:Extended;
public
constructor Create(Designer:TfrxCustomDesigner); override;
function GetValue:String; override;
procedure SetValue(const Value:String); override;
end;
TfrxPaperYProperty = class(TfrxPaperXProperty)
public
constructor Create(Designer:TfrxCustomDesigner); override;
end;
TfrxStringsProperty = class(TfrxClassProperty)
public
function GetAttributes:TfrxPropertyAttributes; override;
function Edit:Boolean; override;
end;
TfrxBrushProperty = class(TfrxEnumProperty)
public
function GetAttributes:TfrxPropertyAttributes; override;
procedure OnDrawLBItem(Control:TWinControl; Index:Integer;
ARect:TRect; State:TOwnerDrawState); override;
procedure OnDrawItem(Canvas:TCanvas; ARect:TRect); override;
end;
TfrxFrameStyleProperty = class(TfrxEnumProperty)
public
function GetAttributes:TfrxPropertyAttributes; override;
function GetExtraLBSize:Integer; override;
procedure OnDrawLBItem(Control:TWinControl; Index:Integer;
ARect:TRect; State:TOwnerDrawState); override;
procedure OnDrawItem(Canvas:TCanvas; ARect:TRect); override;
end;
TfrxDisplayFormatProperty = class(TfrxStringProperty)
public
function GetAttributes:TfrxPropertyAttributes; override;
function Edit:Boolean; override;
end;
TfrxBooleanProperty = class(TfrxEnumProperty)
public
function GetAttributes:TfrxPropertyAttributes; override;
procedure OnDrawLBItem(Control:TWinControl; Index:Integer;
ARect:TRect; State:TOwnerDrawState); override;
procedure OnDrawItem(Canvas:TCanvas; ARect:TRect); override;
end;
{ TfrxPageEditor }
function TfrxPageEditor.Edit:Boolean;
begin
Result:= False;
if (Component is TfrxReportPage) and
(TfrxReportPage(Component).Subreport = nil) then
with TfrxPageEditorForm.Create(Designer) do
begin
Result:= ShowModal = mrOk;
Free;
end;
end;
function TfrxPageEditor.HasEditor:Boolean;
begin
Result:= True;
end;
{ TfrxMemoEditor }
function TfrxMemoEditor.Edit:Boolean;
begin
with TfrxMemoEditorForm.Create(Designer) do
begin
MemoView:= TfrxMemoView(Component);
Result:= ShowModal = mrOk;
if Result then
begin
TfrxMemoView(Component).Text:= Memo.Text;
TfrxMemoView(Component).DataField:= '';
end;
Free;
end;
end;
function TfrxMemoEditor.HasEditor:Boolean;
begin
Result:= True;
end;
{ TfrxSysMemoEditor }
function TfrxSysMemoEditor.Edit:Boolean;
begin
with TfrxSysMemoEditorForm.Create(Designer) do
begin
Text:= TfrxSysMemoView(Component).Text;
Result:= ShowModal = mrOk;
if Result then
TfrxSysMemoView(Component).Text:= Text;
Free;
end;
end;
function TfrxSysMemoEditor.HasEditor:Boolean;
begin
Result:= True;
end;
{ TfrxLineEditor }
function TfrxLineEditor.Execute(Tag:Integer; Checked:Boolean):Boolean;
var
i:Integer;
c:TfrxComponent;
l:TfrxCustomLineView;
begin
Result:= inherited Execute(Tag, Checked);
for i:= 0 to Designer.SelectedObjects.Count-1 do
begin
c:= Designer.SelectedObjects[i];
if (c is TfrxCustomLineView) and not (rfDontModify in c.Restrictions) then
begin
l:= TfrxCustomLineView(c);
case Tag of
0:l.Diagonal:= Checked;
1:if Checked then
l.StretchMode:= smMaxHeight else
l.StretchMode:= smDontStretch;
end;
Result:= True;
end;
end;
end;
procedure TfrxLineEditor.GetMenuItems;
var
l:TfrxCustomLineView;
begin
l:= TfrxCustomLineView(Component);
if l is TfrxLineView then
AddItem(frxResources.Get('lvDiagonal'), 0, l.Diagonal);
AddItem(frxResources.Get('mvStretch'), 1, l.StretchMode = smMaxHeight);
inherited;
end;
{ TfrxPictureEditor }
function TfrxPictureEditor.Edit:Boolean;
begin
with TfrxPictureEditorForm.Create(Designer) do
begin
Image.Picture.Assign(TfrxPictureView(Component).Picture);
Result:= ShowModal = mrOk;
if Result then
TfrxPictureView(Component).Picture.Assign(Image.Picture);
Free;
end;
end;
function TfrxPictureEditor.HasEditor:Boolean;
begin
Result:= True;
end;
function TfrxPictureEditor.Execute(Tag:Integer; Checked:Boolean):Boolean;
var
i:Integer;
c:TfrxComponent;
p:TfrxPictureView;
begin
Result:= inherited Execute(Tag, Checked);
for i:= 0 to Designer.SelectedObjects.Count-1 do
begin
c:= Designer.SelectedObjects[i];
if (c is TfrxPictureView) and not (rfDontModify in c.Restrictions) then
begin
p:= TfrxPictureView(c);
case Tag of
0:p.AutoSize:= Checked;
1:p.Stretched:= Checked;
2:p.Center:= Checked;
3:p.KeepAspectRatio:= Checked;
end;
Result:= True;
end;
end;
end;
procedure TfrxPictureEditor.GetMenuItems;
var
p:TfrxPictureView;
begin
p:= TfrxPictureView(Component);
AddItem(frxResources.Get('pvAutoSize'), 0, p.AutoSize);
AddItem(frxResources.Get('mvStretch'), 1, p.Stretched);
AddItem(frxResources.Get('pvCenter'), 2, p.Center);
AddItem(frxResources.Get('pvAspect'), 3, p.KeepAspectRatio);
AddItem('-',-1);
inherited;
end;
{ TfrxBandEditor }
function TfrxBandEditor.Execute(Tag:Integer; Checked:Boolean):Boolean;
var
b:TfrxBand;
begin
Result:= False;
b:= Designer.SelectedObjects[0];
if not (rfDontModify in b.Restrictions) then
begin
case Tag of
10:b.Stretched:= Checked;
11:b.AllowSplit:= Checked;
12:b.KeepChild:= Checked;
13:b.PrintChildIfInvisible:= Checked;
14:b.StartNewPage:= Checked;
end;
Result:= True;
end;
end;
procedure TfrxBandEditor.GetMenuItems;
var
b:TfrxBand;
begin
if Designer.SelectedObjects.Count > 1 then Exit;
b:= TfrxBand(Component);
if not b.Vertical then
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -