lazreport: From Michael VC:

- tfrdesigner is now registered as a component, so it can be dropped on a form,
  giving end-users the possibility to design their reports.
- Fixed bug that prevented checkbox/roundrect/shape buttons from being visible
  when designing a report in the IDE.
- Fixed access violations that occurred when one of checkbox/roundrect/shape
  was dropped on a report.
- Removed debug statements from roundrect code.

git-svn-id: trunk@16219 -
This commit is contained in:
mattias 2008-08-25 09:37:35 +00:00
parent 73ec8979e6
commit f27c0074d7
6 changed files with 39 additions and 37 deletions

View File

@ -606,7 +606,7 @@ constructor TfrBarCodeObject.Create(aOwner: TComponent);
begin begin
inherited Create(aOwner); inherited Create(aOwner);
if not assigned(frBarCodeForm) and not (csDesigning in ComponentState) then if not assigned(frBarCodeForm) {and not (csDesigning in ComponentState)} then
begin begin
frBarCodeForm := TfrBarCodeForm.Create(nil); frBarCodeForm := TfrBarCodeForm.Create(nil);
frRegisterObject(TfrBarCodeView, frBarCodeForm.Image1.Picture.Bitmap, frRegisterObject(TfrBarCodeView, frBarCodeForm.Image1.Picture.Bitmap,

View File

@ -98,11 +98,16 @@ end;
constructor TfrCheckBoxView.Create; constructor TfrCheckBoxView.Create;
begin begin
inherited Create; inherited Create;
Typ := gtAddIn; BeginUpdate;
FrameWidth := 2; try
Frames:=frAllFrames; Typ := gtAddIn;
Checked:=True; FrameWidth := 2;
BaseName := 'Check'; Frames:=frAllFrames;
Checked:=True;
BaseName := 'Check';
Finally
EndUpdate;
end;
end; end;
procedure TfrCheckBoxView.Draw(aCanvas: TCanvas); procedure TfrCheckBoxView.Draw(aCanvas: TCanvas);
@ -182,7 +187,7 @@ constructor TfrCheckBoxObject.Create(aOwner: TComponent);
begin begin
inherited Create(aOwner); inherited Create(aOwner);
if not assigned(lrBMPCheckBox) and not (csDesigning in ComponentState) then if not assigned(lrBMPCheckBox) {and not (csDesigning in ComponentState)} then
begin begin
lrBMPCheckBox := TbitMap.Create; lrBMPCheckBox := TbitMap.Create;
lrBMPCheckBox.LoadFromLazarusResource('fr_checkbox'); lrBMPCheckBox.LoadFromLazarusResource('fr_checkbox');

View File

@ -287,6 +287,7 @@ type
property Width: double read GetWidth write SetWidth; property Width: double read GetWidth write SetWidth;
property Height: double read GetHeight write SetHeight; property Height: double read GetHeight write SetHeight;
end; end;
TfrViewClass = Class of TFRView;
TfrStretcheable = class(TfrView) TfrStretcheable = class(TfrView)
protected protected
@ -1043,7 +1044,7 @@ type
function frCreateObject(Typ: Byte; const ClassName: String): TfrView; function frCreateObject(Typ: Byte; const ClassName: String): TfrView;
procedure frRegisterObject(ClassRef: TClass; ButtonBmp: TBitmap; procedure frRegisterObject(ClassRef: TFRViewClass; ButtonBmp: TBitmap;
const ButtonHint: String; EditorForm: TfrObjEditorForm); const ButtonHint: String; EditorForm: TfrObjEditorForm);
procedure frRegisterExportFilter(ClassRef: TClass; procedure frRegisterExportFilter(ClassRef: TClass;
const FilterDesc, FilterExt: String); const FilterDesc, FilterExt: String);
@ -1073,7 +1074,7 @@ type
end; end;
TfrAddInObjectInfo = record TfrAddInObjectInfo = record
ClassRef: TClass; ClassRef: TfrViewClass;
EditorForm: TfrObjEditorForm; EditorForm: TfrObjEditorForm;
ButtonBmp: TBitmap; ButtonBmp: TBitmap;
ButtonHint: String; ButtonHint: String;
@ -1246,8 +1247,8 @@ begin
if frAddIns[i].ClassRef.ClassName = ClassName then if frAddIns[i].ClassRef.ClassName = ClassName then
begin begin
Result := TfrView(frAddIns[i].ClassRef.NewInstance); Result := frAddIns[i].ClassRef.Create;
Result.Create; // Result.Create;
Result.Typ := gtAddIn; Result.Typ := gtAddIn;
break; break;
end; end;
@ -1268,7 +1269,7 @@ begin
end; end;
end; end;
procedure frRegisterObject(ClassRef: TClass; ButtonBmp: TBitmap; procedure frRegisterObject(ClassRef: TfrViewClass; ButtonBmp: TBitmap;
const ButtonHint: String; EditorForm: TfrObjEditorForm); const ButtonHint: String; EditorForm: TfrObjEditorForm);
begin begin
frAddIns[frAddInsCount].ClassRef := ClassRef; frAddIns[frAddInsCount].ClassRef := ClassRef;

View File

@ -8,6 +8,7 @@ uses
Classes, SysUtils, LResources, Classes, SysUtils, LResources,
LR_Const, LR_Const,
LR_Class, LR_Class,
LR_Desgn,
LR_Barc, LR_Barc,
LR_DBSet, LR_DBSet,
LR_DSet, LR_DSet,
@ -47,7 +48,7 @@ begin
TfrBarCodeObject,TfrRoundRectObject,TfrShapeObject, TfrBarCodeObject,TfrRoundRectObject,TfrShapeObject,
TfrCheckBoxObject,TfrCompositeReport,TfrUserDataset, TfrCheckBoxObject,TfrCompositeReport,TfrUserDataset,
TfrTextExport,TfrHTMExport,TfrCSVExport, TfrTextExport,TfrHTMExport,TfrCSVExport,
TfrPrintGrid]); TfrPrintGrid,TfrDesigner]);
RegisterComponentEditor(TfrReport, TfrRepEditor); RegisterComponentEditor(TfrReport, TfrRepEditor);
end; end;

View File

@ -435,40 +435,40 @@ end;
(********************************************************) (********************************************************)
constructor TfrRoundRectView.Create; constructor TfrRoundRectView.Create;
begin begin
inherited Create; inherited;
DebugLn('TfrRoundRectView.Create'); BeginUpdate;
//Initialization try
Typ := gtAddIn; //Initialization
Frames := frAllFrames; Typ := gtAddIn;
BaseName := 'RoundRect'; Frames := frAllFrames;
BaseName := 'RoundRect';
//Default values //Default values
fCadre.SGradian:=False; fCadre.SGradian:=False;
fCadre.GradStyle:=gsHorizontal; fCadre.GradStyle:=gsHorizontal;
fCadre.SdColor := clGray; fCadre.SdColor := clGray;
fCadre.wShadow := 6; fCadre.wShadow := 6;
fCadre.sCurve := True; fCadre.sCurve := True;
fCadre.wCurve := 10; fCadre.wCurve := 10;
finally
Endupdate;
end;
end; end;
procedure TfrRoundRectView.Assign(From: TfrView); procedure TfrRoundRectView.Assign(From: TfrView);
begin begin
inherited Assign(From); inherited Assign(From);
DebugLn('TfrRoundRectView.Assign');
fCadre := TfrRoundRectView(From).fCadre; fCadre := TfrRoundRectView(From).fCadre;
end; end;
procedure TfrRoundRectView.LoadFromStream(Stream: TStream); procedure TfrRoundRectView.LoadFromStream(Stream: TStream);
begin begin
inherited LoadFromStream(Stream); inherited LoadFromStream(Stream);
DebugLn('TfrRoundRectView.LoadFromStream');
Stream.Read(fCadre, SizeOf(fCadre)); Stream.Read(fCadre, SizeOf(fCadre));
end; end;
procedure TfrRoundRectView.SaveToStream(Stream: TStream); procedure TfrRoundRectView.SaveToStream(Stream: TStream);
begin begin
inherited SaveToStream(Stream); inherited SaveToStream(Stream);
DebugLn('TfrRoundRectView.SaveToStream(');
Stream.Write(fCadre, SizeOf(fCadre)); Stream.Write(fCadre, SizeOf(fCadre));
end; end;
@ -501,8 +501,6 @@ end;
procedure TfrRoundRectView.CalcGaps; procedure TfrRoundRectView.CalcGaps;
begin begin
inherited CalcGaps; inherited CalcGaps;
DebugLn('TfrRoundRectView.CalcGaps');
// Zone de text (MEMO) // Zone de text (MEMO)
Drect.Left := DRect.Left + (fCadre.wCurve div 4); Drect.Left := DRect.Left + (fCadre.wCurve div 4);
DRect.Top := DRect.Top + (fCadre.wCurve div 4); DRect.Top := DRect.Top + (fCadre.wCurve div 4);
@ -518,10 +516,8 @@ var
OldDRect: TRect; OldDRect: TRect;
OldFill: TColor; OldFill: TColor;
begin begin
DebugLn(sysutils.format('TfrRoundRectView.ShowBackGround docmode=%d, fCadre.wShadow =%d',[DocMode,fCadre.wShadow]));
// prevent screen garbage in designer // prevent screen garbage in designer
if (DocMode <> dmDesigning) or fCadre.SGradian then Exit; if (DocMode <> dmDesigning) or fCadre.SGradian then Exit;
DebugLn('TfrRoundRectView.ShowBackGround');
BeginUpdate; BeginUpdate;
try try
OldDRect := DRect; OldDRect := DRect;
@ -559,7 +555,6 @@ var
begin begin
if DisableDrawing then Exit; if DisableDrawing then Exit;
DebugLn('TfrRoundRectView.ShowFrame');
with Canvas do with Canvas do
begin begin
if fCadre.SGradian then if fCadre.SGradian then
@ -919,7 +914,7 @@ constructor TfrRoundRectObject.Create(aOwner: TComponent);
begin begin
inherited Create(aOwner); inherited Create(aOwner);
if not assigned(frRoundRectForm) and not (csDesigning in ComponentState) then if not assigned(frRoundRectForm) {and not (csDesigning in ComponentState)} then
begin begin
frRoundRectForm := TfrRoundRectForm.Create(nil); frRoundRectForm := TfrRoundRectForm.Create(nil);
frRegisterObject(TfrRoundRectView, frRoundRectForm.Image1.Picture.Bitmap, frRegisterObject(TfrRoundRectView, frRoundRectForm.Image1.Picture.Bitmap,

View File

@ -213,7 +213,7 @@ constructor TfrShapeObject.Create(aOwner: TComponent);
begin begin
inherited Create(aOwner); inherited Create(aOwner);
if not assigned(frShapeForm) and not (csDesigning in ComponentState) then if not assigned(frShapeForm) {and not (csDesigning in ComponentState)} then
begin begin
frShapeForm:=TfrShapeForm.Create(nil); frShapeForm:=TfrShapeForm.Create(nil);
frRegisterObject(TfrShapeView, frShapeForm.Image1.Picture.Bitmap, frRegisterObject(TfrShapeView, frShapeForm.Image1.Picture.Bitmap,