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
inherited Create(aOwner);
if not assigned(frBarCodeForm) and not (csDesigning in ComponentState) then
if not assigned(frBarCodeForm) {and not (csDesigning in ComponentState)} then
begin
frBarCodeForm := TfrBarCodeForm.Create(nil);
frRegisterObject(TfrBarCodeView, frBarCodeForm.Image1.Picture.Bitmap,

View File

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

View File

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

View File

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

View File

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

View File

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