Hi all,
these are some fixes as follows:
1 & 2) The only really important and no-brainer: fix TPaintBox not
triggering OnPaint.
3) Add some (ugly, I admit) casts to work-around some badly translated
Winapi headers in FPC 2.0.4 and remove the associated warnings. I've
verified that the 2 functions affected receive CONST arguments
according to WinSDK.
4) One I'm almost sure will get rejected: Add methods for handling
boolean value, by means of a wrapper around 'integer' methods. To make
things "worse" I couldn't resist renaming the parameters from
'Default' to 'DefaultValue'...
5) Fix a single method, TApplication.CreateForm(), for which the
Reference parameter should be 'out', not 'var', and the compiler hint
was annoying me ;-)
Best regards,
Flávio
Index: H:/projetos/lazarus/lcl/extctrls.pp
===================================================================
--- H:/projetos/lazarus/lcl/extctrls.pp (revision 10613)
+++ H:/projetos/lazarus/lcl/extctrls.pp (working copy)
@@ -471,8 +471,6 @@
{ TPaintBox }
TPaintBox = class(TGraphicControl)
- private
- FOnPaint: TNotifyEvent;
protected
procedure Paint; override;
public
Index: H:/projetos/lazarus/lcl/include/paintbox.inc
===================================================================
--- H:/projetos/lazarus/lcl/include/paintbox.inc (revision 10613)
+++ H:/projetos/lazarus/lcl/include/paintbox.inc (working copy)
@@ -38,7 +38,7 @@
end;
exit;
end;
- if Assigned(FOnPaint) then begin
+ if Assigned(OnPaint) then begin
Canvas.Font := Font;
Canvas.Brush.Color := Color;
inherited Paint;
Index: H:/projetos/lazarus/lcl/interfaces/win32/win32winapi.inc
===================================================================
--- H:/projetos/lazarus/lcl/interfaces/win32/win32winapi.inc (revision 10613)
+++ H:/projetos/lazarus/lcl/interfaces/win32/win32winapi.inc (working copy)
@@ -1111,12 +1111,8 @@
End;
function TWin32WidgetSet.DrawFocusRect(DC: HDC; const Rect: TRect): boolean;
-var
- lRect: Windows.RECT;
begin
- {$message warn TWin32WidgetSet.DrawFocusRect TODO: optimize Rect copying}
- lRect:=Rect;
- Result:= Windows.DrawFocusRect(DC, lRect);
+ Result:= Windows.DrawFocusRect(DC, PRect(@Rect)^);
end;
{------------------------------------------------------------------------------
@@ -1434,12 +1430,8 @@
function TWin32WidgetSet.FrameRect(DC: HDC; const ARect: TRect;
hBr: HBRUSH) : integer;
-var
- lRect: Windows.RECT;
begin
- {$message warn TWin32WidgetSet.FrameRect TODO: optimize ARect copying}
- lRect := ARect;
- Result := Windows.FrameRect(DC, lRect, hBr);
+ Result := Windows.FrameRect(DC, PRect(@ARect)^, hBr);
end;
{------------------------------------------------------------------------------
Index: H:/projetos/lazarus/lcl/propertystorage.pas
===================================================================
--- H:/projetos/lazarus/lcl/propertystorage.pas (revision 10613)
+++ H:/projetos/lazarus/lcl/propertystorage.pas (working copy)
@@ -137,8 +137,8 @@
procedure RestoreProperties; virtual;
Procedure GetPropertyList(List: TStrings); virtual; abstract;
procedure FinishPropertyList(List: TStrings); virtual;
- function DoReadInteger(const Section, Ident : String; Default: Integer): Integer; Virtual;
- function DoReadString(const Section, Ident, Default: string): string; Virtual; Abstract;
+ function DoReadInteger(const Section, Ident : String; DefaultValue: Integer): Integer; Virtual;
+ function DoReadString(const Section, Ident, DefaultValue: string): string; Virtual; Abstract;
procedure DoWriteString(const Section, Ident, Value: string); Virtual; Abstract;
procedure DoWriteInteger(const Section, Ident : String; Value: Integer); Virtual;
Procedure DoEraseSections(const ARootSection : String);virtual;abstract;
@@ -150,14 +150,16 @@
// Public Read/Write methods
procedure StorageNeeded(ReadOnly: Boolean);Virtual;
procedure FreeStorage; Virtual;
- function ReadString(const Ident, Default: string): string;
- function ReadInteger(const Ident: string; Default: Longint): Longint;
+ function ReadBoolean(const Ident: string; DefaultValue: Boolean): Boolean;
+ function ReadString(const Ident, DefaultValue: string): string;
+ function ReadInteger(const Ident: string; DefaultValue: Longint): Longint;
procedure ReadRect(const Ident: string; out ARect: TRect;
const Default: TRect);
procedure ReadStrings(const Ident: string; const List: TStrings;
const DefaultList: TStrings = nil);
procedure WriteString(const Ident, Value: string);
procedure WriteInteger(const Ident: string; Value: Longint);
+ procedure WriteBoolean(const Ident: string; Value: Boolean);
procedure WriteRect(const Ident: string; const Value: TRect);
procedure WriteStrings(const Ident: string; const List: TStrings);
procedure EraseSections;
@@ -657,9 +659,9 @@
end;
function TCustomPropertyStorage.DoReadInteger(const Section, Ident: String;
- Default: Integer): Integer;
+ DefaultValue: Integer): Integer;
begin
- Result:=StrToIntDef(DoReadString(Section,Ident,IntToStr(Default)),Default);
+ Result:=StrToIntDef(DoReadString(Section,Ident,IntToStr(DefaultValue)),DefaultValue);
end;
procedure TCustomPropertyStorage.DoWriteInteger(const Section, Ident: String;
@@ -676,9 +678,9 @@
begin
end;
-function TCustomPropertyStorage.ReadString(const Ident, Default: string): string;
+function TCustomPropertyStorage.ReadString(const Ident, DefaultValue: string): string;
begin
- Result := DoReadString(RootSection, Ident, Default);
+ Result := DoReadString(RootSection, Ident, DefaultValue);
end;
procedure TCustomPropertyStorage.WriteString(const Ident, Value: string);
@@ -686,11 +688,16 @@
DoWriteString(RootSection, Ident, Value);
end;
-function TCustomPropertyStorage.ReadInteger(const Ident: string; Default: Longint): Longint;
+function TCustomPropertyStorage.ReadInteger(const Ident: string; DefaultValue: Longint): Longint;
begin
- Result := DoReadInteger(RootSection, Ident, Default);
+ Result := DoReadInteger(RootSection, Ident, DefaultValue);
end;
+function TCustomPropertyStorage.ReadBoolean(const Ident: string; DefaultValue: Boolean): Boolean;
+begin
+ Result := DoReadInteger(RootSection, Ident, Ord(DefaultValue)) <> Ord(False);
+end;
+
procedure TCustomPropertyStorage.ReadRect(const Ident: string;
out ARect: TRect; const Default: TRect);
begin
@@ -732,6 +739,11 @@
DoWriteInteger(RootSection, Ident, Value);
end;
+procedure TCustomPropertyStorage.WriteBoolean(const Ident: string; Value: Boolean);
+begin
+ DoWriteInteger(RootSection, Ident, Ord(Value));
+end;
+
procedure TCustomPropertyStorage.WriteRect(const Ident: string;
const Value: TRect);
begin
Index: H:/projetos/lazarus/lcl/forms.pp
===================================================================
--- H:/projetos/lazarus/lcl/forms.pp (revision 10613)
+++ H:/projetos/lazarus/lcl/forms.pp (working copy)
@@ -983,7 +983,7 @@
destructor Destroy; override;
procedure ControlDestroyed(AControl: TControl);
procedure BringToFront;
- procedure CreateForm(InstanceClass: TComponentClass; var Reference);
+ procedure CreateForm(InstanceClass: TComponentClass; out Reference);
procedure UpdateMainForm(AForm: TForm);
procedure QueueAsyncCall(AMethod: TDataEvent; Data: PtrInt);
procedure ReleaseComponent(AComponent: TComponent);
Index: H:/projetos/lazarus/lcl/include/application.inc
===================================================================
--- H:/projetos/lazarus/lcl/include/application.inc (revision 10613)
+++ H:/projetos/lazarus/lcl/include/application.inc (working copy)
@@ -1541,7 +1541,7 @@
forms list
------------------------------------------------------------------------------}
procedure TApplication.CreateForm(InstanceClass: TComponentClass;
- var Reference);
+ out Reference);
var
Instance: TComponent;
ok: boolean;