From 3c8fe5d20653a5d9f82c46123592525199bbce1c Mon Sep 17 00:00:00 2001 From: vincents Date: Tue, 26 Jul 2005 08:45:15 +0000 Subject: [PATCH] =?UTF-8?q?initialize=20variables=20at=20declaration=20ins?= =?UTF-8?q?tead=20in=20the=20unit=20initialization=20=20=20from=20Florian?= =?UTF-8?q?=20K=EF=BF=BDberle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: trunk@7426 - --- docs/Contributors.txt | 1 + lcl/controls.pp | 11 +++++------ lcl/forms.pp | 15 +++++---------- lcl/graphics.pp | 18 +++++++----------- lcl/include/dragdock.inc | 5 ++++- lcl/include/picture.inc | 4 ++-- lcl/interfacebase.pp | 10 +++++----- lcl/lclproc.pas | 6 ++---- lcl/lresources.pp | 9 +++------ 9 files changed, 34 insertions(+), 45 deletions(-) diff --git a/docs/Contributors.txt b/docs/Contributors.txt index 7e5712b7bb..75e39ea7e2 100644 --- a/docs/Contributors.txt +++ b/docs/Contributors.txt @@ -18,6 +18,7 @@ Darius Blaszijk Dean Zobec Eric Chapman Felipe Monteiro de Carvalho +Florian Koeberle Francisco Manuel GongYu Hans-Joachim Ott diff --git a/lcl/controls.pp b/lcl/controls.pp index cfd4f20580..13afec2c97 100644 --- a/lcl/controls.pp +++ b/lcl/controls.pp @@ -2022,8 +2022,8 @@ uses var // The interface knows, which TWinControl has the capture. This stores // what child control of this TWinControl has actually the capture. - CaptureControl: TControl; - DockSiteHash: TDynHashArray; + CaptureControl: TControl=nil; + DockSiteHash: TDynHashArray=nil; procedure AdjustBorderSpace(var RemainingClientRect, CurBorderSpace: TRect; Left, Top, Right, Bottom: integer); @@ -2933,13 +2933,9 @@ end; {$ENDIF not VER1_0} initialization - //DebugLn('controls.pp - initialization'); Mouse := TMouse.Create; - DragControl := nil; - CaptureControl := nil; DefaultDockTreeClass := TDockTree; - DockSiteHash := nil; RegisterIntegerConsts(TypeInfo(TCursor), @IdentToCursor, @CursorToIdent); @@ -2952,6 +2948,9 @@ end. { ============================================================================= $Log$ + Revision 1.316 2005/07/26 08:45:15 vincents + initialize variables at declaration instead in the unit initialization from Florian Köberle + Revision 1.315 2005/07/22 11:15:56 mattias updated russian translation for windows from Rostislav Okulov diff --git a/lcl/forms.pp b/lcl/forms.pp index 9764cf7ea4..5c0ecdb1d3 100644 --- a/lcl/forms.pp +++ b/lcl/forms.pp @@ -1202,7 +1202,7 @@ var Application: TApplication; Screen: TScreen; ExceptionObject: TExceptObject; - HintWindowClass: THintWindowClass; + HintWindowClass: THintWindowClass=THintWindow; type TMessageBoxFunction = @@ -1222,10 +1222,10 @@ uses WSForms; // Widgetset uses circle is allowed var - FocusMessages: Boolean; - FocusCount: Integer; - HandlingException: boolean; - HaltingProgram: boolean; + FocusMessages: Boolean=True; + FocusCount: Integer=0; + HandlingException: boolean=False; + HaltingProgram: boolean=False; procedure Register; begin @@ -1669,11 +1669,6 @@ end; //============================================================================== initialization - FocusCount := 0; - Focusmessages := True; - HandlingException := false; - HaltingProgram := false; - HintWindowClass := THintWindow; LCLProc.OwnerFormDesignerModifiedProc:=@IfOwnerIsFormThenDesignerModified; Screen:= TScreen.Create(nil); Application:= TApplication.Create(nil); diff --git a/lcl/graphics.pp b/lcl/graphics.pp index 0d1d0d5556..a6fac32a56 100644 --- a/lcl/graphics.pp +++ b/lcl/graphics.pp @@ -1418,8 +1418,8 @@ type FormatID: TClipboardFormat); var - OnLoadGraphicFromClipboardFormat: TOnLoadGraphicFromClipboardFormat; - OnSaveGraphicToClipboardFormat: TOnSaveGraphicToClipboardFormat; + OnLoadGraphicFromClipboardFormat: TOnLoadGraphicFromClipboardFormat=nil; + OnSaveGraphicToClipboardFormat: TOnSaveGraphicToClipboardFormat=nil; function TestStreamBitmapNativeType(const AStream: TStream): TBitmapNativeType; function TestStreamIsBMP(const AStream: TStream): boolean; @@ -1435,7 +1435,8 @@ function ReadXPMSize(XPM: PPChar; var Width, Height, ColorCount: integer var { Stores information about the current screen - initialized on Interface startup } - ScreenInfo: TScreenInfo; + ScreenInfo: TScreenInfo=(PixelsPerInchX:72;PixelsPerInchY:72; + ColorDepth:24;Initialized:false;); FontResourceCache: TFontHandleCache; PenResourceCache: TPenHandleCache; @@ -1934,14 +1935,6 @@ begin end; initialization - ScreenInfo.Initialized:=false; - ScreenInfo.ColorDepth:=24; - ScreenInfo.PixelsPerInchX:=72; - ScreenInfo.PixelsPerInchY:=72; - PicClipboardFormats:=nil; - PicFileFormats:=nil; - OnLoadGraphicFromClipboardFormat:=nil; - OnSaveGraphicToClipboardFormat:=nil; FontResourceCache:=TFontHandleCache.Create; PenResourceCache:=TPenHandleCache.Create; BrushResourceCache:=TBrushHandleCache.Create; @@ -1962,6 +1955,9 @@ end. { ============================================================================= $Log$ + Revision 1.179 2005/07/26 08:45:15 vincents + initialize variables at declaration instead in the unit initialization from Florian Köberle + Revision 1.178 2005/07/19 08:31:21 vincents added ColorBox (from Darius) to LCL diff --git a/lcl/include/dragdock.inc b/lcl/include/dragdock.inc index 5b40bd53d3..a027360f77 100644 --- a/lcl/include/dragdock.inc +++ b/lcl/include/dragdock.inc @@ -15,7 +15,7 @@ } var - DragControl: TControl; // control, that started the drag + DragControl: TControl=nil; // control, that started the drag DragObject: TDragObject; // the drag information object DragObjectAutoFree: Boolean; // True, if DragObject was auto created DragStartPos: TPoint; // mouse position at start of drag @@ -362,6 +362,9 @@ end; { ============================================================================= $Log$ + Revision 1.9 2005/07/26 08:45:15 vincents + initialize variables at declaration instead in the unit initialization from Florian Köberle + Revision 1.8 2005/02/05 16:09:52 marc * first 64bit changes diff --git a/lcl/include/picture.inc b/lcl/include/picture.inc index ea3e43b4fc..1557e5c2a6 100644 --- a/lcl/include/picture.inc +++ b/lcl/include/picture.inc @@ -268,8 +268,8 @@ end; //------------------------------------------------------------------------------ var - PicClipboardFormats: TPicClipboardFormats; - PicFileFormats: TPicFileFormatsList; + PicClipboardFormats: TPicClipboardFormats=nil; + PicFileFormats: TPicFileFormatsList=nil; function GetPicFileFormats: TPicFileFormatsList; begin diff --git a/lcl/interfacebase.pp b/lcl/interfacebase.pp index 7b9cb4f03c..f59f69da90 100644 --- a/lcl/interfacebase.pp +++ b/lcl/interfacebase.pp @@ -83,7 +83,7 @@ type TInputDialogFunction = Function (const InputCaption, InputPrompt : String; MaskInput : Boolean; var Value : String) : Boolean; var - InputDialogFunction: TInputDialogFunction; + InputDialogFunction: TInputDialogFunction=nil; type TPromptDialogFunction = Function(const DialogCaption, DialogMessage : String; @@ -95,7 +95,7 @@ var PromptDialogFunction: TPromptDialogFunction; var - InterfaceObject: TWidgetSet; + InterfaceObject: TWidgetSet=nil; implementation @@ -107,9 +107,6 @@ const {$I intfbasewinapi.inc} {$I intfbaselcl.inc} -initialization - InputDialogFunction:=nil; - InterfaceObject:=nil; finalization InputDialogFunction:=nil; @@ -118,6 +115,9 @@ end. { $Log$ + Revision 1.56 2005/07/26 08:45:15 vincents + initialize variables at declaration instead in the unit initialization from Florian Köberle + Revision 1.55 2004/09/24 21:34:14 micha convert LM_CREATE message to interface methods remove SendMsgToInterface, CNSendMessage and related methods diff --git a/lcl/lclproc.pas b/lcl/lclproc.pas index bf05693aac..ed380f0085 100644 --- a/lcl/lclproc.pas +++ b/lcl/lclproc.pas @@ -72,8 +72,8 @@ type var - SendApplicationMessageFunction: TSendApplicationMessageFunction; - OwnerFormDesignerModifiedProc: TOwnerFormDesignerModifiedProc; + SendApplicationMessageFunction: TSendApplicationMessageFunction=nil; + OwnerFormDesignerModifiedProc: TOwnerFormDesignerModifiedProc=nil; function SendApplicationMessage(Msg: Cardinal; WParam: WParam; LParam: LParam):Longint; procedure OwnerFormDesignerModified(AComponent: TComponent); @@ -1942,8 +1942,6 @@ end; initialization InitializeDebugOutput; - SendApplicationMessageFunction:=nil; - OwnerFormDesignerModifiedProc:=nil; InterfaceFinalizationHandlers:=TList.Create; finalization InterfaceFinalizationHandlers.Free; diff --git a/lcl/lresources.pp b/lcl/lresources.pp index 42f643eb9a..97c2da97c7 100644 --- a/lcl/lresources.pp +++ b/lcl/lresources.pp @@ -187,8 +187,8 @@ type var LazarusResources: TLResourceList; - LRSObjectReaderClass: TLRSObjectReaderClass; - LRSObjectWriterClass: TLRSObjectWriterClass; + LRSObjectReaderClass: TLRSObjectReaderClass=TLRSObjectReader; + LRSObjectWriterClass: TLRSObjectWriterClass=TLRSObjectWriter; function InitLazResourceComponent(Instance: TComponent; RootAncestor: TClass): Boolean; @@ -276,7 +276,7 @@ const var ByteToStr: array[char] of shortstring; - ByteToStrValid: boolean; + ByteToStrValid: boolean=false; procedure InitByteToStr; var @@ -3155,9 +3155,6 @@ end; procedure InternalInit; begin LazarusResources:=TLResourceList.Create; - ByteToStrValid:=false; - LRSObjectReaderClass:=TLRSObjectReader; - LRSObjectWriterClass:=TLRSObjectWriter; end; initialization