Skip to content

Commit b342455

Browse files
committedAug 1, 2016
Version 1.02
1 parent cbb8156 commit b342455

31 files changed

+1594
-300
lines changed
 

‎README.md

+17
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,23 @@ version 2.0. See "LICENSE.txt".
4444

4545
## LLCL ChangeLog
4646

47+
* [Version 1.02] (https://github.com/FChrisF/LLCL/releases/tag/v1.0.2):
48+
49+
Main changes and additions:
50+
- TRadioGroup control added (not enabled by default),
51+
- TRegistry class added (Registry.pas),
52+
- TClipboard: SetAsText bug fix,
53+
- TStringGrid: ColCount and RowCount bug fix,
54+
- bug fixes when application was starting and closing,
55+
- bug fixes and non standard ItemStrings property removed
56+
for internal TCustomBox class,
57+
- TForm: ShowModal bug fix (with several modal forms),
58+
- DeleteFile and RenameFile added (SysUtils), and also
59+
DeleteFileUTF8 and RenameFileUTF8 (FileUtil/LazFileUtils),
60+
- internal TMemoLines et TBoxStrings classes (for TMemo and
61+
TComboBox/TListBox controls) modified for a better LCL/VCL
62+
compatibility (data accessing).
63+
4764
* [Version 1.01] (https://github.com/FChrisF/LLCL/releases/tag/v1.0.1):
4865

4966
Main changes and additions:

‎README.txt

+95-31
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,21 @@ the Light VCL (LVCL), with some additions and modifications.
4242

4343
LLCL ChangeLog:
4444

45+
* Version 1.02:
46+
Main changes and additions:
47+
- TRadioGroup control added (not enabled by default),
48+
- TRegistry class added (Registry.pas),
49+
- TClipboard: SetAsText bug fix,
50+
- TStringGrid: ColCount and RowCount bug fix,
51+
- bug fixes when application was starting and closing,
52+
- bug fixes and non standard ItemStrings property removed
53+
for internal TCustomBox class,
54+
- TForm: ShowModal bug fix (with several modal forms),
55+
- DeleteFile and RenameFile added (SysUtils), and also
56+
DeleteFileUTF8 and RenameFileUTF8 (FileUtil/LazFileUtils),
57+
- internal TMemoLines et TBoxStrings classes (for TMemo and
58+
TComboBox/TListBox controls) modified for a better LCL/VCL
59+
compatibility (data accessing).
4560
* Version 1.01:
4661
Main changes and additions:
4762
- TStringGrid control added (Grids.pas),
@@ -63,7 +78,7 @@ LLCL ChangeLog:
6378
- a few bug fixes and some minor additions/modifications.
6479
Note: controls and functionalities not enabled by default
6580
can be activated by defining the corresponding option(s) in
66-
the option files LLCLOptions.inc.
81+
the option file LLCLOptions.inc.
6782

6883
* Version 1.00:
6984
- Initial public release.
@@ -110,8 +125,8 @@ modified LGPL license used for the standard LCL of Lazarus.
110125
The files/units present in the Ligth LCL replace the main
111126
standard files/units used inside the LCL/VCL: Classes,
112127
ClipBrd, ComCtrls, Controls, Dialogs, ExtCtrls, FileCtrl,
113-
Forms, Graphics, Grids, IniFiles, Menus, StdCtrls, SysUtils
114-
and Variants.
128+
Forms, Graphics, Grids, IniFiles, Menus, Registry, StdCtrls,
129+
SysUtils and Variants.
115130

116131
Plus an additional unit for the VCL: XPMan.
117132

@@ -197,6 +212,9 @@ Free Pascal: http://www.freepascal.org
197212
Lazarus: http://www.lazarus-ide.org
198213
Delphi: http://www.embarcadero.com
199214

215+
FreePascal/Lazarus forum for discussion:
216+
http://forum.lazarus.freepascal.org/index.php/topic,30027.0.html
217+
200218

201219
6. GENERAL NOTES
202220
----------------
@@ -331,23 +349,26 @@ Delphi: http://www.embarcadero.com
331349

332350
7.1 CONTROL CLASSES AVAILABLE
333351
-----------------------------
352+
334353
Standard: TLabel, TButton, TEdit, TMemo, TCheckBox,
335354
TRadioButton, TGroupBox, TComboBox, TListBox,
336-
TStaticText, TMainMenu, TPopupMenu
355+
TStaticText, TMainMenu, TPopupMenu, TRadioGroup
337356
Additional: TImage, TTrayIcon, TStringGrid
338357
Common: TProgressBar, TTrackBar, TXPManifest (Delphi)
339358
Dialogs: TOpenDialog, TSaveDialog, TSelectDirectoryDialog
340359
(FPC only, and not enabled by default)
341360
System: TTimer
342361

343-
Other classes: TCustomForm, TForm, TClipboard, TIniFile
362+
Other classes: TCustomForm, TForm, TClipboard, TIniFile,
363+
TRegistry
344364

345365
General variables: Application (TApplication), Mouse(TMouse),
346366
Clipboard(TClipboard)
347367

348368

349369
7.2 BASE CLASSES TREE
350370
---------------------
371+
351372
(TObject)
352373
!
353374
TPersistent
@@ -369,6 +390,7 @@ TNonVisualControl* TVisualControl*
369390

370391
7.3 CLASSES DETAILS
371392
--------------------
393+
372394
Standard public methods, properties and events available
373395
[rwd] options: r=read, w=write, d=design time.
374396

@@ -461,21 +483,24 @@ TStringList (Classes - TObject)
461483

462484
TStrings = TStringList
463485

464-
TMemoLines (StdCtrls - TPersistent)
465-
constructor Create(Memo: TMemo);
486+
TCtrlStrings (StdCtrls - TPersistent)
487+
constructor Create(ParentCtrl: TWinControl);
466488
destructor Destroy; override;
467-
function Add(const S: string): integer;
468-
procedure Clear;
469-
property Strings: TStrings; [rwd]
489+
function Add(const S: string): integer; virtual;
490+
procedure Clear; virtual;
491+
property Count: integer; [r]
492+
Note: TCtrlStrings is specific to the LLCL
493+
494+
TMemoLines (StdCtrls - TCtrlStrings)
495+
function Add(const S: string): integer; override;
496+
procedure Clear; override;
497+
property Strings[index: integer]: string; default; [r]
470498
Note: TMemoLines is specific to the LLCL
471499

472-
TBoxStrings (SdtCtrls - TPersistent)
473-
constructor Create(Box: TCustomBox);
474-
destructor Destroy; override;
475-
function Add(const S: string): integer;
476-
procedure Clear;
477-
property Items[n: integer]: string; default; [r]
478-
property Strings: TStrings; [rw]
500+
TBoxStrings (SdtCtrls - TCtrlStrings)
501+
function Add(const S: string): integer; override;
502+
procedure Clear; override;
503+
property Items[index: integer]: string; default; [r]
479504
Note: TBoxStrings is specific to the LLCL
480505

481506
TCustomBox (SdtCtrls - TWinControl)
@@ -485,7 +510,6 @@ TCustomBox (SdtCtrls - TWinControl)
485510
property ItemCount: integer; [r]
486511
property ItemIndex: integer; [rwd]
487512
property Items: TBoxStrings; [r]
488-
property ItemStrings: TStrings; [rw]
489513
property Sorted: boolean; [d]
490514
Note: TCustomBox is specific to the LLCL
491515

@@ -648,8 +672,8 @@ TComboBox (SdtCtrls - TCustomBox)
648672

649673
TEdit (StdCtrls - TWinControl)
650674
constructor Create(AOwner: TComponent); override;
651-
property PasswordChar: Char; [d]
652675
procedure SelectAll;
676+
property PasswordChar: Char; [d]
653677
property ReadOnly: boolean; [rwd]
654678
property Text: string; [rwd]
655679
property OnChange: TNotifyEvent; [rwd]
@@ -692,15 +716,26 @@ TPopupMenu (Menus - TMenu)
692716
TRadioButton (SdtCtrls - TCheckBox)
693717
constructor Create(AOwner: TComponent); override;
694718

719+
TRadioGroup (ExtCtrls - TGroupBox)
720+
constructor Create(AOwner: TComponent); override;
721+
destructor Destroy; override;
722+
property ColumnLayout: TColumnLayout; [rw] *
723+
property Columns: integer; [rw]
724+
property ItemIndex: integer; [rw]
725+
property Items: TRadioGroupStrings; [r]
726+
*: only for FPC/Lazarus
727+
Note: available only if LLCL_OPT_USERADIOGROUP is defined (see
728+
the option file LLCLOptions.inc)
729+
695730
TStaticText (SdtCtrls - TWinControl)
696731
constructor Create(AOwner: TComponent); override;
697732
property BorderStyle: boolean; [d]
698733

699734
TOpenDialog (Dialogs - TNonVisualControl)
700735
constructor Create(AOwner: TComponent); override;
701736
destructor Destroy; override;
702-
property DefaultExt: string; [rwd]
703737
function Execute: boolean; virtual;
738+
property DefaultExt: string; [rwd]
704739
property FileName: string; [rwd]
705740
property Files: TStringList; [rw]
706741
property Filter: string; [rwd]
@@ -744,11 +779,6 @@ TStringGrid (Grids - TWinControl)
744779
property DefaultRowHeight: integer; [rwd] *4
745780
property FixedCols: integer; [rwd] *5
746781
property FixedRows: integer; [rwd] *6
747-
property OnCompareCells: TOnCompareCells; [rwd] *3
748-
property OnGetEditText: TGetEditEvent; [rwd]
749-
property OnHeaderClick: THdrEvent; [rwd] *3
750-
property OnSelectCell: TOnSelectCellEvent; [rwd]
751-
property OnSetEditText: TSetEditEvent; [rwd]
752782
property Options: TGridOptions; [rd]
753783
property Row: integer; [rw]
754784
property RowCount: integer; [rwd]
@@ -757,6 +787,11 @@ TStringGrid (Grids - TWinControl)
757787
property Selection: TGridRect; [r]
758788
property SortColumn: integer; [r] *3
759789
property SortOrder: TSortOrder; [rw] *3
790+
property OnCompareCells: TOnCompareCells; [rwd] *3
791+
property OnGetEditText: TGetEditEvent; [rwd]
792+
property OnHeaderClick: THdrEvent; [rwd] *3
793+
property OnSelectCell: TOnSelectCellEvent; [rwd]
794+
property OnSetEditText: TSetEditEvent; [rwd]
760795
*1: only for columns (i.e. IsColumn = True)
761796
*2: not possible at design time for Delphi
762797
*3: not present in the standard Delphi VCL
@@ -792,14 +827,14 @@ TTrayIcon (ExtCtrl - TNonVisualControl)
792827
procedure Show;
793828
procedure Hide;
794829
procedure ShowBalloonHint;
795-
property Icon: TIcon; [rwd]
796-
property Hint: string; [rwd]
797-
property Visible: boolean; [rwd]
798-
property PopUpMenu: TPopupMenu; [rwd] *
799830
property BalloonFlags: TBalloonFlags; [rwd]
800831
property BalloonHint: string; [rwd] **
801832
property BalloonTimeout: integer; [rwd] ***
802833
property BalloonTitle: string; [rwd]
834+
property Icon: TIcon; [rwd]
835+
property Hint: string; [rwd]
836+
property Visible: boolean; [rwd]
837+
property PopUpMenu: TPopupMenu; [rwd] *
803838
property OnDblClick: TNotifyEvent; [rwd]
804839
*: Available if LLCL_OPT_USEMENUS is not undefined
805840
**: Balloon notifications are possible only for Windows 2000+
@@ -878,15 +913,15 @@ TStream (Classes - TObject)
878913
function CopyFrom(Source: TStream; Count: integer): integer;
879914
procedure LoadFromFile(const FileName: string);
880915
procedure LoadFromStream(aStream: TStream); virtual;
881-
property Position: integer; [rw]
882916
function Read(var Buffer; Count: integer): integer; virtual; abstract;
883917
procedure ReadBuffer(var Buffer; Count: integer);
884918
procedure SaveToFile(const FileName: string);
885919
procedure SaveToStream(aStream: TStream); virtual;
886920
function Seek(Offset: integer; Origin: Word): integer; overload; virtual; abstract;
887921
function Seek(Offset: int64; Origin: TSeekOrigin): int64; overload; virtual; abstract;
888-
property Size: integer; [rw]
889922
function Write(var Buffer; Count: integer): integer; virtual; abstract;
923+
property Position: integer; [rw]
924+
property Size: integer; [rw]
890925

891926
THandleStream (Classes - TStream)
892927
constructor Create(aHandle: THandle);
@@ -979,6 +1014,35 @@ TIniFile (IniFiles - TObject)
9791014
property FileName: string; [r]
9801015
Note: string date/time formats are specific in LLCL SysUtils
9811016

1017+
TRegistry (Registry - TObject)
1018+
constructor Create; overload;
1019+
destructor Destroy; override;
1020+
procedure CloseKey;
1021+
function CreateKey(const Key: string): boolean;
1022+
function DeleteKey(const Key: string): boolean;
1023+
function DeleteValue(const Name: string): boolean;
1024+
function GetDataInfo(const ValueName: string; var Value: TRegDataInfo): boolean;
1025+
function GetKeyInfo(var Value: TRegKeyInfo): boolean;
1026+
procedure GetKeyNames(Strings: TStrings);
1027+
procedure GetValueNames(Strings: TStrings);
1028+
function KeyExists(const Key: string): boolean;
1029+
function OpenKey(const Key: string; CanCreate: boolean): boolean;
1030+
function OpenKeyReadOnly(const Key: String): boolean;
1031+
function ReadBinaryData(const Name: string; var Buffer; BufSize: integer): integer;
1032+
function ReadBool(const Name: string): boolean;
1033+
function ReadDate(const Name: string): TDateTime;
1034+
function ReadInteger(const Name: string): integer;
1035+
function ReadString(const Name: string): string;
1036+
function ValueExists(const Name: string): boolean;
1037+
procedure WriteBinaryData(const Name: string; var Buffer; BufSize: integer);
1038+
procedure WriteBool(const Name: string; Value: boolean);
1039+
procedure WriteDate(const Name: string; Value: TDateTime);
1040+
procedure WriteInteger(const Name: string; Value: integer);
1041+
procedure WriteString(const Name, Value: string);
1042+
property Access: longword; [rw]
1043+
property CurrentKey: HKEY; [r]
1044+
property RootKey: HKEY; [rw]
1045+
9821046

9831047
7.4 SPECIFIC NOTES
9841048
------------------

‎sources/Classes.pas

+16-19
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
2425
Version 1.01:
2526
* TReader: ReadStringInts (and StringIntProperty), ReadIntArray added
2627
Version 1.00:
@@ -154,7 +155,7 @@ TStringList = class;
154155
TStringList = class
155156
private
156157
fCount: integer;
157-
fCapacity : integer;
158+
fCapacity: integer;
158159
fListStr: array of string;
159160
// fListObj[] is allocated only if objects are used (not nil)
160161
fListObj: array of TObject;
@@ -500,8 +501,8 @@ implementation
500501

501502
PTypeInfo = ^TTypeInfo;
502503
TTypeInfo = record
503-
Kind : TTypeKind;
504-
Name : shortstring;
504+
Kind: TTypeKind;
505+
Name: shortstring;
505506
// here the type data follows as TTypeData record
506507
end;
507508

@@ -516,15 +517,15 @@ TTypeInfo = record
516517
const
517518
BooleanIdents: array[Boolean] of String = ('False', 'True');
518519

519-
function GetTypeData(ptrTypeInfo: PTypeInfo) : PTypeData; forward;
520-
function GetEnumNameValue(ptrTypeInfo: PTypeInfo; const Name: string): integer; forward;
521-
function GetColorFromIdent(Ident: PChar): integer; forward;
522-
function ClassSameText(const S1, S2: string): boolean; forward;
520+
function GetTypeData(ptrTypeInfo: PTypeInfo): PTypeData; forward;
521+
function GetEnumNameValue(ptrTypeInfo: PTypeInfo; const Name: string): integer; forward;
522+
function GetColorFromIdent(Ident: PChar): integer; forward;
523+
function ClassSameText(const S1, S2: string): boolean; forward;
523524

524525
{$ifdef MSWindows}
525526
var
526527
RegisteredClasses: TList = nil;
527-
function CreateComponent(const AClassName: shortstring; AOwner: TComponent): TComponent; forward;
528+
function CreateComponent(const AClassName: shortstring; AOwner: TComponent): TComponent; forward;
528529
{$endif}
529530

530531
// Workaround for Unicode FPC when using the standard SysUtils unit
@@ -535,7 +536,6 @@ function CreateComponent(const AClassName: shortstring; AOwner: TComponent): TCo
535536
function Class_IntToStr(Value: integer): string; forward;
536537
{$endif}
537538

538-
539539
//------------------------------------------------------------------------------
540540

541541
function GetTypeData(ptrTypeInfo: PTypeInfo): PTypeData;
@@ -701,7 +701,7 @@ function ClassSameText(const S1, S2: string): boolean;
701701
end;
702702

703703
{$ifdef Def_FPC_StdSys}
704-
function Class_IntToStr(Value: integer): string;
704+
function Class_IntToStr(Value: integer): string;
705705
begin
706706
Str(Value, result);
707707
end;
@@ -1000,7 +1000,7 @@ function TStringList.NameOf(const Value: string; const Separator: string='='): s
10001000
P := PChar(pointer(fListStr[i]))+j+L;
10011001
while P^=' ' do Inc(P); // trim left value
10021002
if StrIComp(P,pointer(Value))=0 then begin
1003-
result := copy(fListStr[i], 1, j-1);
1003+
result := Copy(fListStr[i], 1, j-1);
10041004
exit;
10051005
end;
10061006
end;
@@ -1675,13 +1675,12 @@ procedure TPersistent.ReadProperty(const PropName: string; Reader: TReader);
16751675
i: integer;
16761676
SubProp: TPersistent;
16771677
begin
1678-
if self=nil then exit;
16791678
i := pos('.', PropName);
16801679
if i > 0 then
16811680
SubProp := SubProperty(Copy(PropName, 1, i-1))
16821681
else SubProp := nil;
16831682
if SubProp<>nil then
1684-
SubProp.ReadProperty(Copy(PropName, i+1, 200),Reader)
1683+
SubProp.ReadProperty(Copy(PropName, i+1, 200), Reader)
16851684
else
16861685
with Reader do begin
16871686
{$ifdef debug}
@@ -1792,7 +1791,7 @@ function GetClass(const AClassName: shortstring): TPersistentClass;
17921791
result := nil;
17931792
end;
17941793

1795-
function GetClass(const AClassName: string): TPersistentClass;
1794+
function GetClass(const AClassName: string): TPersistentClass;
17961795
begin
17971796
result := GetClass(shortstring(AClassName));
17981797
end;
@@ -1890,7 +1889,7 @@ destructor TComponent.Destroy;
18901889

18911890
function TComponent.GetComponentCount: integer;
18921891
begin
1893-
if (self=nil) or (fComponents=nil) then
1892+
if fComponents=nil then
18941893
result := 0
18951894
else
18961895
result := fComponents.Count;
@@ -1915,8 +1914,6 @@ function TComponent.FindComponent(const CompName: string): TComponent;
19151914

19161915
procedure TMemoryStream.SetCapacity(Value: integer);
19171916
begin
1918-
if self=nil then
1919-
exit;
19201917
fCapacity := Value;
19211918
ReallocMem(fMemory,fCapacity);
19221919
if fPosition>=fCapacity then // adjust Position if truncated
@@ -2105,7 +2102,7 @@ function TCustomMemoryStream.GetSize(): integer;
21052102

21062103
function TCustomMemoryStream.Read(var Buffer; Count: integer): integer;
21072104
begin
2108-
if (self<>nil) and (Memory<>nil) then
2105+
if Memory<>nil then
21092106
if (FPosition>=0) and (Count>0) then begin
21102107
result := FSize - FPosition;
21112108
if result>0 then begin
@@ -2120,7 +2117,7 @@ function TCustomMemoryStream.Read(var Buffer; Count: integer): integer;
21202117

21212118
procedure TCustomMemoryStream.SaveToStream(aStream: TStream);
21222119
begin
2123-
if (self<>nil) and (FSize<>0) and (aStream<>nil) and (Memory<>nil) then
2120+
if (FSize<>0) and (aStream<>nil) and (Memory<>nil) then
21242121
aStream.Write(Memory^, FSize);
21252122
end;
21262123

‎sources/ClipBrd.pas

+6-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
25+
* TClipboard: SetAsText fix
2426
Version 1.01:
2527
* File creation.
2628
* TClipboard/Clipboard implemented (only for text)
@@ -116,11 +118,12 @@ function TClipboard.GetAsText(): string;
116118
end;
117119

118120
procedure TClipboard.SetAsText(const Value: string);
119-
var lpText: pointer;
121+
var pText: pointer;
120122
var len: cardinal;
121123
begin
122-
lpText := LLCLS_CLPB_SetTextPtr(Value, len);
123-
SetBuffer(LLCLS_CLPB_GetTextFormat(), lpText, len);
124+
pText := LLCLS_CLPB_SetTextPtr(Value, len);
125+
SetBuffer(LLCLS_CLPB_GetTextFormat(), pText, len);
126+
FreeMem(pText);
124127
end;
125128

126129
procedure TClipboard.SetBuffer(Format: cardinal; Buffer: pointer; Size: integer);

‎sources/ComCtrls.pas

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
2425
Version 1.01:
2526
* TWinControl: notifications for child controls modified
2627
* TTrackBar: 'Orientation' and 'TickStyle' properties now accessible (design time only)

‎sources/Controls.pas

+24-15
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
25+
* Some improvements for controls created at runtime
26+
* Support for TRadioGroup
2427
Version 1.01:
2528
* Bug fix and modification: background color support
2629
* TStringGrid and TSelectDirectoryDialog control types added
@@ -113,7 +116,7 @@ interface
113116
ATTRadioButton, ATTGroupBox, ATTMemo, ATTComboBox, ATTListBox, ATTStaticText,
114117
ATTImage, ATTProgressBar, ATTTrackBar, ATTMenuItem, ATTMainMenu, ATTPopupMenu,
115118
ATTTimer, ATTTrayIcon, ATTOpenDialog, ATTSaveDialog, ATTSelectDirectoryDialog,
116-
ATTStringGrid);
119+
ATTStringGrid, ATTRadioGroup); // (ATTRadioGroup not used)
117120

118121
TMouseButton = (mbLeft, mbRight, mbMiddle);
119122

@@ -226,7 +229,7 @@ TVisualControl = class(TControl)
226229
property Color: integer read fColor write SetColor;
227230
property Transparent: boolean read fTransparent write fTransparent;
228231
property Caption: string read fCaption write SetCaption;
229-
property Alignment: TAlignment read fAlignment write fAlignment; // Run-time modification ignored; write present only for dynamical control creation purpose
232+
property Alignment: TAlignment read fAlignment write fAlignment; // Runtime modification ignored; write present only for dynamical control creation purpose
230233
property Visible: boolean read fVisible write SetVisible;
231234
property AutoSize: boolean read fAutoSize write fAutoSize;
232235
property ParentFont: boolean read fParentFont write fParentFont;
@@ -310,7 +313,7 @@ TWinControl = class(TVisualControl)
310313
procedure SetCaption(const Value: string); override;
311314
function GetTabOrder(): integer;
312315
procedure SetTabOrder(Value: integer);
313-
procedure ClickCall(ChangeFocus: boolean; DoSetFocus: boolean);
316+
procedure ClickCall(ChangeFocus: boolean; DoSetFocus: boolean); virtual;
314317
function ColorCall(var Msg: TWMCtlColorStatic): boolean;
315318
function ColorForSubCont(SubContMsg: integer; SubConthWnd: THandle): boolean; virtual;
316319
procedure FormFocus();
@@ -334,7 +337,7 @@ TWinControl = class(TVisualControl)
334337
// procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND; // Used in Forms, if "top invisible" form (but not here)
335338
// procedure WMNCActivate(var Msg: TWMNCActivate); message WM_NCACTIVATE; // Used in Forms, if "top invisible" form (but not here)
336339
procedure WMPaint(var Msg: TWMPaint); message WM_PAINT;
337-
procedure WMDestroy(var Msg: TWMDestroy); message WM_DESTROY; // Used also in Forms
340+
procedure WMDestroy(var Msg: TWMDestroy); message WM_DESTROY;
338341
// procedure WMActivate(var Msg: TWMActivate); message WM_ACTIVATE; // Used in Forms (but not here)
339342
procedure WMSetFocus(var Msg: TWMSetFocus); message WM_SETFOCUS; // Used also in StdCtrls and Forms
340343
procedure WMEraseBkGnd(var Msg: TWMEraseBkGnd); message WM_ERASEBKGND;
@@ -933,16 +936,20 @@ procedure TWinControl.SetHandle(Value: THandle);
933936
procedure TWinControl.SetColor(Value: integer);
934937
begin
935938
inherited;
939+
if fHandle=0 then exit; // (may be called in create constructor)
936940
if ATType in TContainControls then
937-
LLCL_RedrawWindow(Handle, nil, 0, RDW_INVALIDATE or RDW_ALLCHILDREN);
938-
LLCL_InvalidateRect(Handle, nil, true);
941+
LLCL_RedrawWindow(fHandle, nil, 0, RDW_INVALIDATE or RDW_ALLCHILDREN);
942+
LLCL_InvalidateRect(fHandle, nil, true);
939943
end;
940944

941945
procedure TWinControl.SetCaption(const Value: string);
942946
begin
943947
inherited;
944-
UpdTextSize(Value);
945-
LLCLS_SendMessageSetText(fHandle, WM_SETTEXT, Value);
948+
if fHandle=0 then exit; // (later when created at runtime)
949+
begin
950+
UpdTextSize(Value);
951+
LLCLS_SendMessageSetText(fHandle, WM_SETTEXT, Value);
952+
end;
946953
end;
947954

948955
function TWinControl.GetTabOrder(): integer;
@@ -1067,6 +1074,7 @@ procedure TWinControl.AdjustTextSize(var Size: TSize);
10671074
procedure TWinControl.SetEnabled(Value: boolean);
10681075
begin
10691076
fEnabled := Value;
1077+
if fHandle=0 then exit; // (later when created at runtime)
10701078
LLCL_EnableWindow(fHandle, Value);
10711079
if (not Value) and Focused() then
10721080
NewFormFocus(tftNextGroup);
@@ -1428,18 +1436,18 @@ procedure TWinControl.DefaultHandler(var Message);
14281436
procedure TWinControl.Update;
14291437
begin
14301438
// (No inherited)
1431-
LLCL_UpdateWindow(Handle);
1439+
LLCL_UpdateWindow(fHandle);
14321440
end;
14331441

14341442
function TWinControl.ClientRect(): TRect;
14351443
begin
1436-
LLCL_GetClientRect(Handle, result);
1444+
LLCL_GetClientRect(fHandle, result);
14371445
end;
14381446

14391447
procedure TWinControl.Show;
14401448
begin
14411449
inherited;
1442-
HandleNeeded;
1450+
if fHandle=0 then exit; // (later when created at runtime)
14431451
LLCL_ShowWindow(fHandle, fShowCommand);
14441452
if Assigned(EOnShow) then
14451453
EOnShow(self);
@@ -1448,7 +1456,7 @@ procedure TWinControl.Show;
14481456
procedure TWinControl.Hide;
14491457
begin
14501458
inherited;
1451-
HandleNeeded;
1459+
if fHandle=0 then exit; // (later when created at runtime)
14521460
LLCL_ShowWindow(fHandle, SW_HIDE);
14531461
if Focused() then
14541462
NewFormFocus(tftNextGroup);
@@ -1477,21 +1485,22 @@ procedure TWinControl.SetFocus();
14771485
begin
14781486
if CanFocus() then
14791487
begin
1480-
LLCL_SetFocus(Handle);
1488+
LLCL_SetFocus(fHandle);
14811489
UpdateFormFocus();
14821490
end;
14831491
end;
14841492

14851493
procedure TWinControl.SetBounds(ALeft, ATop, AWidth, AHeight: integer);
14861494
begin
14871495
inherited;
1496+
if fHandle=0 then exit; // (later when created at runtime)
14881497
if ATType<>ATTCustomForm then // Done inside Forms for them
1489-
LLCL_MoveWindow(Handle, ALeft, ATop, AWidth, AHeight, true);
1498+
LLCL_MoveWindow(fHandle, ALeft, ATop, AWidth, AHeight, true);
14901499
end;
14911500

14921501
procedure TWinControl.BringToFront;
14931502
begin
1494-
LLCL_SetForegroundWindow(Handle);
1503+
LLCL_SetForegroundWindow(fHandle);
14951504
end;
14961505

14971506
procedure TWinControl.WMLButtonDown(var Msg: TWMLButtonDown);

‎sources/Dialogs.pas

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
2425
Version 1.01:
2526
* SelectDirectory added (for FPC/Lazarus)
2627
* TSelectDirectoryDialog added for FPC/Lazarus (not enabled by default - see LLCL_OPT_USESELECTDIRECTORYDIALOG in LLCLOptions.inc)

‎sources/ExtCtrls.pas

+268-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
25+
* TRadioGroup added (not enabled by default - see LLCLOptions.inc)
2426
Version 1.01:
2527
* TImage: Changed added (when bitmap data are changed)
2628
* TImage: SetStretch modified
@@ -80,7 +82,10 @@ interface
8082

8183
uses
8284
LLCLOSInt, Windows, {$IFDEF FPC}LMessages{$ELSE}Messages, ShellAPI{$ENDIF},
83-
Classes, Controls, {$ifdef LLCL_OPT_USEMENUS}Menus,{$endif} Graphics;
85+
Classes, Controls,
86+
{$ifdef LLCL_OPT_USEMENUS}Menus,{$endif}
87+
{$ifdef LLCL_OPT_USERADIOGROUP} StdCtrls,{$endif}
88+
Graphics;
8489

8590
type
8691

@@ -185,6 +190,48 @@ TTrayIcon = class(TNonVisualControl)
185190
property OnDblClick: TNotifyEvent read EOnDblClick write EOnDblClick;
186191
end;
187192

193+
{$ifdef LLCL_OPT_USERADIOGROUP}
194+
TRadioGroupStrings = class(TCtrlStrings) // (not standard)
195+
public
196+
function Add(const S: string): integer; override;
197+
procedure Clear; override;
198+
property Items[index: integer]: string read GetString; default;
199+
end;
200+
201+
TColumnLayout = (clHorizontalThenVertical, clVerticalThenHorizontal);
202+
203+
TRadioGroup = class(TGroupBox)
204+
private
205+
fItems: TRadioGroupStrings;
206+
fItemIndex: integer;
207+
fColumns: integer;
208+
fColumnLayout: TColumnLayout; // also used internally for Delphi
209+
function GetItemIndex(): integer;
210+
procedure SetItemIndex(Value: integer);
211+
procedure SetColumns(Value: integer);
212+
procedure SetRadioBPos();
213+
procedure CreateRadioB(const sCaption: string; nTabOrder: integer);
214+
procedure RadioBClick(Sender: TObject);
215+
{$IFDEF FPC}
216+
procedure SetColumnLayout(AValue: TColumnLayout);
217+
{$ENDIF}
218+
protected
219+
procedure CreateHandle; override;
220+
procedure ReadProperty(const PropName: string; Reader: TReader); override;
221+
function SubProperty(const SubPropName: string): TPersistent; override;
222+
procedure ClickCall(ChangeFocus: boolean; DoSetFocus: boolean); override;
223+
public
224+
constructor Create(AOwner: TComponent); override;
225+
destructor Destroy; override;
226+
property Items: TRadioGroupStrings read fItems;
227+
property ItemIndex: integer read GetItemIndex write SetItemIndex;
228+
property Columns: integer read fColumns write SetColumns;
229+
{$IFDEF FPC}
230+
property ColumnLayout: TColumnLayout read fColumnLayout write SetColumnLayout;
231+
{$ENDIF}
232+
end;
233+
{$endif LLCL_OPT_USERADIOGROUP}
234+
188235
//------------------------------------------------------------------------------
189236

190237
implementation
@@ -198,9 +245,13 @@ implementation
198245

199246
{$ifdef LLCL_OPT_USEIMAGE}
200247
type
201-
TPPicture = class(TPicture); // To access to protected part
248+
TPPicture = class(TPicture); // To access to protected part
202249
{$endif LLCL_OPT_USEIMAGE}
203250

251+
{$ifdef LLCL_OPT_USERADIOGROUP}
252+
TPRadioButton = class(TRadioButton); // To access to protected part
253+
{$endif LLCL_OPT_USERADIOGROUP}
254+
204255
const
205256
NIF_MESSAGE = $00000001; // SysTray
206257
NIF_ICON = $00000002;
@@ -547,10 +598,224 @@ procedure TTrayIcon.ShowBalloonHint;
547598
LLCLS_Shell_NotifyIconBalloon(NIM_MODIFY, @fSysTrayInfo, CheckWin32Version(LLCL_WIN2000_MAJ, LLCL_WIN2000_MIN), SYSTEM_INFOFLAGS[fBalloonFlags], fBalloonTimeout, fBalloonTitle, fBalloonHint);
548599
end;
549600

601+
{$ifdef LLCL_OPT_USERADIOGROUP}
602+
{ TRadioGroupStrings }
603+
604+
function TRadioGroupStrings.Add(const S: string): integer;
605+
begin
606+
with TRadioGroup(fParentCtrl) do
607+
begin
608+
CreateRadioB(S, ControlCount);
609+
SetRadioBPos();
610+
TRadioButton(Controls[Pred(ControlCount)]).Visible := true;
611+
end;
612+
result := inherited Add(S);
613+
end;
614+
615+
procedure TRadioGroupStrings.Clear;
616+
var i: integer;
617+
begin
618+
with TRadioGroup(fParentCtrl) do
619+
begin
620+
for i := 0 to Pred(ControlCount) do
621+
LLCL_DestroyWindow(TRadioButton(Controls[i]).Handle);
622+
Controls.Clear;
623+
fItemIndex := -1;
624+
end;
625+
inherited;
626+
end;
627+
628+
{ TRadioGroup }
629+
630+
constructor TRadioGroup.Create(AOwner: TComponent);
631+
begin
632+
inherited;
633+
// ATType := ATTRadioGroup; // (not used - keep GroupBox type and behavior)
634+
fItems := TRadioGroupStrings.Create(self);
635+
fItemIndex := -1;
636+
fColumns := 1;
637+
fColumnLayout := {$IFDEF FPC}clHorizontalThenVertical{$ELSE}clVerticalThenHorizontal{$ENDIF}
638+
end;
639+
640+
procedure TRadioGroup.CreateHandle;
641+
var i: integer;
642+
begin
643+
inherited;
644+
// Creates RadioButtons
645+
for i := 0 to Pred(fItems.Count) do
646+
CreateRadioB(fItems[i], i);
647+
SetRadioBPos();
648+
if fItemIndex>=0 then // (avoid RadioBClick);
649+
TRadioButton(Controls[fItemIndex]).Checked := true;
650+
for i := 0 to Pred(fItems.Count) do
651+
TRadioButton(Controls[i]).Visible := true;
652+
end;
653+
654+
procedure TRadioGroup.CreateRadioB(const sCaption: string; nTabOrder: integer);
655+
var RBTmp: TRadioButton;
656+
begin
657+
RBTmp := TRadioButton.Create(self);
658+
RBTmp.Caption := sCaption;
659+
RBTmp.TabOrder := nTabOrder;
660+
RBTMP.Visible := false;;
661+
RBTMP.OnClick := {$IFDEF LLCL_OBJFPC_MODE}@{$ENDIF}RadioBClick;
662+
RBTMP.Parent := self;
663+
end;
664+
665+
destructor TRadioGroup.Destroy;
666+
begin
667+
fItems.Free;
668+
inherited;
669+
end;
670+
671+
function TRadioGroup.GetItemIndex(): integer;
672+
var i: integer;
673+
begin
674+
fItemIndex := -1;
675+
for i := 0 to Pred(ControlCount) do
676+
if TRadioButton(Controls[i]).Checked then
677+
begin
678+
fItemIndex := i;
679+
break;
680+
end;
681+
result := fItemIndex;
682+
end;
683+
684+
procedure TRadioGroup.SetItemIndex(Value: integer);
685+
var i: integer;
686+
begin
687+
fItemIndex := Value;
688+
if fItemIndex=-1 then
689+
begin
690+
i := GetItemIndex();
691+
if i>=0 then
692+
TRadioButton(Controls[i]).Checked := false;
693+
RadioBClick(self);
694+
end
695+
else
696+
TPRadioButton(Controls[Value]).ClickCall(false, false); // raise an error for incorrect index
697+
end;
698+
699+
procedure TRadioGroup.SetColumns(Value: integer);
700+
begin
701+
if Value<1 then
702+
raise Exception.CreateFmt(LLCL_STR_EXCT_RGROUPCOLUMN, [Value])
703+
else
704+
begin
705+
fColumns := Value;
706+
SetRadioBPos();
707+
end;
708+
end;
709+
710+
// Positions of RadioButtons are slightly different than for LCL/VCL
711+
procedure TRadioGroup.SetRadioBPos();
712+
const WidthMargin = 8;
713+
const HeightMargin = 10;
714+
var WPosHandle: HDWP;
715+
var nCol, nRow: integer;
716+
var nTop, nLeft, nTopStart: integer;
717+
var IncWidth, IncHeight: integer;
718+
var i, iItemBreak: integer;
719+
begin
720+
if ControlCount = 0 then exit;
721+
nCol := fColumns;
722+
if fColumnLayout=clHorizontalThenVertical then
723+
begin
724+
if ControlCount<nCol then nCol := ControlCount; // Specific to FPC, but clHorizontalThenVertical is already specific to FPC
725+
nRow := (ControlCount + Pred(nCol)) div nCol;
726+
iItemBreak := nCol;
727+
end
728+
else
729+
begin
730+
nRow := (ControlCount + Pred(nCol)) div nCol;
731+
{$IFDEF FPC}
732+
// Re-computes real number of columns
733+
nCol := (ControlCount + Pred(nRow)) div nRow;
734+
{$ENDIF}
735+
iItemBreak := nRow;
736+
end;
737+
IncWidth := (Width - (WidthMargin * 2)) div nCol;
738+
IncHeight := (Height - (HeightMargin * 2)) div nRow;
739+
nTopStart := HeightMargin + (IncHeight div 2);
740+
nTop := nTopStart - IncHeight;
741+
nLeft := WidthMargin - IncWidth;
742+
WPosHandle := LLCL_BeginDeferWindowPos(ControlCount);
743+
if WPosHandle = 0 then exit;
744+
for i := 0 to Pred(ControlCount) do
745+
begin
746+
if (i mod iItemBreak)=0 then
747+
if fColumnLayout=clHorizontalThenVertical then
748+
begin
749+
nTop := nTop + IncHeight;
750+
nLeft := WidthMargin;
751+
end
752+
else
753+
begin
754+
nTop := nTopStart;
755+
nLeft := nLeft + IncWidth;
756+
end
757+
else
758+
if fColumnLayout=clHorizontalThenVertical then
759+
nLeft := nLeft + IncWidth
760+
else
761+
nTop := nTop + IncHeight;
762+
with TRadioButton(Controls[i]) do
763+
LLCL_DeferWindowPos(WPosHandle, Handle, 0, nLeft, nTop, Width, Height, SWP_NOZORDER or SWP_NOACTIVATE);
764+
end;
765+
LLCL_EndDeferWindowPos(WPosHandle);
766+
end;
767+
768+
procedure TRadioGroup.RadioBClick(Sender: TObject);
769+
begin
770+
if Assigned(OnClick) then
771+
OnClick(self);
772+
end;
773+
774+
procedure TRadioGroup.ReadProperty(const PropName: string; Reader: TReader);
775+
const Properties: array[0..2] of PChar = ('ItemIndex', 'Columns', 'ColumnLayout');
776+
begin
777+
case StringIndex(PropName, Properties) of
778+
0 : fItemIndex := Reader.IntegerProperty;
779+
1 : fColumns := Reader.IntegerProperty;
780+
2 : Reader.IdentProperty(fColumnLayout, TypeInfo(TColumnLayout));
781+
else inherited;
782+
end;
783+
end;
784+
785+
function TRadioGroup.SubProperty(const SubPropName: string): TPersistent;
786+
const SubProperties: array[0..0] of PChar = ('Items');
787+
begin
788+
case StringIndex(SubPropName, SubProperties) of
789+
0 : result := fItems;
790+
else result := inherited SubProperty(SubPropName);
791+
end;
792+
end;
793+
794+
procedure TRadioGroup.ClickCall(ChangeFocus: boolean; DoSetFocus: boolean);
795+
var OnClickSave: TNotifyEvent;
796+
begin
797+
OnClickSave := OnClick;
798+
OnClick := nil;
799+
inherited;
800+
OnClick := OnClickSave;
801+
end;
802+
803+
{$IFDEF FPC}
804+
procedure TRadioGroup.SetColumnLayout(AValue: TColumnLayout);
805+
begin
806+
fColumnLayout := AValue;
807+
SetRadioBPos();
808+
end;
809+
{$ENDIF}
810+
{$endif LLCL_OPT_USERADIOGROUP}
811+
550812
//------------------------------------------------------------------------------
551813

552814
initialization
553-
RegisterClasses([TTimer, TTrayIcon {$ifdef LLCL_OPT_USEIMAGE}, TImage{$endif}]);
815+
RegisterClasses([TTimer, TTrayIcon
816+
{$ifdef LLCL_OPT_USEIMAGE}, TImage{$endif}
817+
{$ifdef LLCL_OPT_USERADIOGROUP}, TRadioGroup{$endif}
818+
]);
554819

555820
{$IFDEF FPC}
556821
{$POP}

‎sources/FileCtrl.pas

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
2425
Version 1.01:
2526
* File creation.
2627
* SelectDirectory added (for Delphi)

‎sources/FileUtil.pas

+14
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
25+
* DeleteFileUTF8 and RenameFileUTF8 added
2426
Version 1.01:
2527
Version 1.00:
2628
* File creation.
@@ -61,6 +63,8 @@ function DirectoryExistsUTF8(const Directory: string): boolean;
6163
function ForceDirectoriesUTF8(const Dir: string): boolean;
6264
function CreateDirUTF8(const Dir: string): boolean;
6365
function RemoveDirUTF8(const Dir: string): boolean;
66+
function DeleteFileUTF8(const FileName: string): boolean;
67+
function RenameFileUTF8(const OldName, NewName: string): boolean;
6468
// (No GetFileVersionUTF8 function)
6569

6670
function SysErrorMessageUTF8(ErrorCode: integer): string;
@@ -160,6 +164,16 @@ function RemoveDirUTF8(const Dir: string): boolean;
160164
result := LazFileUtils.RemoveDirUTF8(Dir);
161165
end;
162166

167+
function DeleteFileUTF8(const FileName: string): boolean;
168+
begin
169+
result := LazFileUtils.DeleteFileUTF8(FileName);
170+
end;
171+
172+
function RenameFileUTF8(const OldName, NewName: string): boolean;
173+
begin
174+
result := LazFileUtils.RenameFileUTF8(OldName, NewName);
175+
end;
176+
163177
//------------------------------------------------------------------------------
164178

165179
// (Functions belonging to LazUTF8)

‎sources/Forms.pas

+40-28
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
25+
* Bug fix for ShowModal in TCustomForm
26+
* Modifications and bug fix when application is terminating
2427
Version 1.01:
2528
* Bug fix: Color in TCustomForm
2629
* TForm: 'BorderStyle', 'Position' and 'FormStyle' properties now accessible (design time only)
@@ -95,7 +98,7 @@ interface
9598
Classes, SysUtils, Controls, {$ifdef LLCL_OPT_USEMENUS}Menus,{$endif} Graphics;
9699

97100
const
98-
LLCLVersion = 0100; // Can be tested {$IF Declared(...)}
101+
LLCLVersion = 0102; // Can be tested {$IF Declared(...)}
99102
LLCLOSType = 'WIN'; // in user's programs
100103

101104
type
@@ -152,7 +155,6 @@ TCustomForm = class(TWinControl)
152155
procedure CallOnPaint;
153156
procedure WMActivate(var Msg: TWMActivate); message WM_ACTIVATE;
154157
procedure WMSetFocus(var Msg: TWMSetFocus); message WM_SETFOCUS;
155-
procedure WMDestroy(var Msg: TWMDestroy); message WM_DESTROY;
156158
procedure WMClose(var Msg: TWMClose); message WM_CLOSE;
157159
{$ifdef LLCL_OPT_USEMENUS}
158160
procedure WMCommand(var Msg: TWMCommand); message WM_COMMAND;
@@ -203,6 +205,7 @@ TApplication = class(TComponent)
203205
fIcon: TIcon;
204206
fNonClientMetrics: TCustomNonClientMetrics;
205207
fTerminated: boolean;
208+
fPostQuitDone: boolean;
206209
fMainForm: TCustomForm;
207210
fShowMainForm: boolean;
208211
fTitle: string;
@@ -229,6 +232,7 @@ TApplication = class(TComponent)
229232
procedure ModalFormsRestore(ActiveWindowHandle: THandle; var FormsStateList: TList);
230233
{$ifdef LLCL_OPT_TOPFORM}
231234
procedure SetVisible(ShowCall: boolean);
235+
function TopHandle(): THandle;
232236
{$endif}
233237
protected
234238
function AppHandle(): THandle;
@@ -361,7 +365,6 @@ destructor TCustomForm.Destroy;
361365
begin
362366
if Assigned(EOnDestroy) then
363367
EOnDestroy(Self);
364-
LLCL_DestroyWindow(Handle);
365368
inherited;
366369
end;
367370

@@ -516,13 +519,7 @@ procedure TCustomForm.CreateParams(var Params : TCreateParams);
516519
Style := cfStyle; // Replaced
517520
ExStyle := cfExStyle or WS_EX_CONTROLPARENT; // " "
518521
{$ifdef LLCL_OPT_TOPFORM}
519-
if Application.fMainFormOnTaskBar then
520-
begin
521-
if Application.MainForm<>nil then // (Not if is creating MainForm)
522-
WndParent := Application.Mainform.Handle;
523-
end
524-
else
525-
WndParent := Application.AppHandle();
522+
WndParent := Application.TopHandle();
526523
{$endif}
527524
WinClassName := TFORM_CLASS;
528525
end;
@@ -654,16 +651,9 @@ procedure TCustomForm.WMSetFocus(var Msg: TWMSetFocus);
654651
FormFocus();
655652
end;
656653

657-
procedure TCustomForm.WMDestroy(var Msg: TWMDestroy);
658-
begin
659-
inherited;
660-
if self=Application.MainForm then
661-
LLCL_PostQuitMessage(0);
662-
end;
663-
664654
procedure TCustomForm.WMClose(var Msg: TWMClose);
665655
begin
666-
// (No inherited, except for the second MainForm time)
656+
// (No inherited, except when application is terminating)
667657
if Application.Terminated then
668658
inherited
669659
else
@@ -785,13 +775,20 @@ constructor TApplication.Create(AOwner: TComponent);
785775
end;
786776

787777
destructor TApplication.Destroy;
778+
{$ifndef LLCL_OPT_TOPFORM}
779+
var i: integer;
780+
{$endif}
788781
begin
789782
fIcon.Free;
790-
LLCL_UnregisterClass(TFORM_CLASS, hInstance);
791783
{$ifdef LLCL_OPT_TOPFORM}
792784
LLCL_SetWindowLongPtr(fHandle, GWL_WNDPROC, NativeUInt(@LLCL_DefWindowProc));
785+
LLCL_DestroyWindow(TopHandle());
793786
LLCL_UnregisterClass(TAPPL_CLASS, hInstance);
787+
{$else}
788+
for i := 0 to (Components.Count - 1) do
789+
LLCL_DestroyWindow(TWincontrol(Components[i]).Handle);
794790
{$endif}
791+
LLCL_UnregisterClass(TFORM_CLASS, hInstance);
795792
inherited;
796793
end;
797794

@@ -832,8 +829,6 @@ function TAppWndProc(hWnd: THandle; Msg: integer; wParam, lParam: NativeUInt): N
832829
SC_MINIMIZE: begin Application.Minimize; exit; end;
833830
SC_RESTORE: begin Application.Restore; exit; end;
834831
end;
835-
WM_QUIT:
836-
Application.Terminate;
837832
end;
838833
result := LLCL_DefWindowProc(hWnd, Msg, wParam, lParam);
839834
end;
@@ -899,6 +894,21 @@ function TApplication.AppHandle(): THandle;
899894
{$endif}
900895
end;
901896

897+
{$ifdef LLCL_OPT_TOPFORM}
898+
function TApplication.TopHandle(): THandle;
899+
begin
900+
if fMainFormOnTaskBar then
901+
begin
902+
if MainForm<>nil then // (Not if is creating MainForm)
903+
result := Mainform.Handle
904+
else
905+
result := 0;
906+
end
907+
else
908+
result := fHandle; // AppHandle()
909+
end;
910+
{$endif}
911+
902912
procedure TApplication.SetTitle(const Value: string);
903913
begin
904914
fTitle := Value;
@@ -944,8 +954,7 @@ function TApplication.ModalFormsSave(ShowWindowHandle: THandle; var FormsStateLi
944954
with TCustomForm(Components[i]) do
945955
begin
946956
FormsStateList.Add(pointer(nativeuint(Enabled))); // (Ugly hack)
947-
if Handle<>ShowWindowHandle then
948-
Enabled := false;
957+
Enabled := (Handle=ShowWindowHandle);
949958
end;
950959
{$else}
951960
if result<>0 then
@@ -1019,8 +1028,11 @@ procedure TApplication.ProcessMessages;
10191028
var msg: TMsg;
10201029
begin
10211030
while LLCL_PeekMessage(msg, 0, 0, 0, PM_REMOVE) do
1022-
if (Msg.Message=WM_QUIT) and (self<>nil) then
1023-
fTerminated := true
1031+
if Msg.Message=WM_QUIT then
1032+
begin
1033+
fTerminated := true;
1034+
break;
1035+
end
10241036
else
10251037
begin
10261038
LLCL_TranslateMessage(Msg);
@@ -1030,10 +1042,10 @@ procedure TApplication.ProcessMessages;
10301042

10311043
procedure TApplication.Terminate;
10321044
begin
1033-
if not fTerminated then
1045+
if not fPostQuitDone then
10341046
begin
1035-
fTerminated := true;
1036-
LLCL_PostMessage(fMainForm.Handle, WM_CLOSE, 0, 0); // Post or re-Post it
1047+
fPostQuitDone := true;
1048+
LLCL_PostQuitMessage(0);
10371049
end;
10381050
end;
10391051

‎sources/Graphics.pas

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
2425
Version 1.01:
2526
* TBitmap: PNG files support added (not enabled by default - see LLCL_OPT_PNGSUPPORT/LLCL_OPT_PNGSIMPLIFIED in LLCLOptions.inc)
2627
* TBitmap: transparent bitmap support added (not enabled by default - see LLCL_OPT_IMGTRANSPARENT in LLCLOptions.inc)

‎sources/Grids.pas

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
25+
* Bug fix for ColCount and RowCount modification
2426
Version 1.01:
2527
* File creation.
2628
* TStringGrid implemented
@@ -764,7 +766,7 @@ procedure TStringGrid.DelCols(Value: integer; Base: integer);
764766
if (Base-Value)<0 then TmpValue := Base; // Sanity
765767
for i:=0 to pred(TmpValue) do
766768
// ListView_DeleteColumn(Handle, Base-i);
767-
LLCL_SendMessage(Handle, LVM_DELETECOLUMN, Base-i, 0);
769+
LLCL_SendMessage(Handle, LVM_DELETECOLUMN, pred(Base-i), 0);
768770
end;
769771

770772
procedure TStringGrid.AddRows(Value: integer; Base: integer; UseDefRowHeight: boolean);
@@ -798,7 +800,7 @@ procedure TStringGrid.DelRows(Value: integer; Base: integer);
798800
else
799801
for i:=0 to pred(TmpValue) do
800802
// ListView_DeleteItem(Handle, Base-i);
801-
LLCL_SendMessage(Handle, LVM_DELETEITEM, Base-i, 0);
803+
LLCL_SendMessage(Handle, LVM_DELETEITEM, pred(Base-i), 0);
802804
end;
803805

804806
procedure TStringGrid.SetColCount(AValue: integer);

‎sources/IniFiles.pas

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
2425
Version 1.01:
2526
* File creation.
2627
* TIniFile implemented

‎sources/Interfaces.pp

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
2425
Version 1.01:
2526
Version 1.00:
2627
* File creation.

‎sources/LCLIntF.pas

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
2425
Version 1.01:
2526
* File creation.
2627

‎sources/LCLType.pp

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
2425
Version 1.01:
2526
* RT_**** constants added (point to Windows declarations)
2627
Version 1.00:

‎sources/LLCLOSInt.pas

+499-58
Large diffs are not rendered by default.

‎sources/LLCLOptions.inc

+8
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@
135135
{$DEFINE LLCL_OPT_DOUBLEBUFF}
136136
{$IFEND}
137137

138+
{ LLCL_OPT_USERADIOGROUP - ExtCtrls.pas
139+
140+
RadioGroup class used in program
141+
142+
Notes: when defined, this permits to use the RadioGroup class.
143+
}
144+
//{$DEFINE LLCL_OPT_USERADIOGROUP}
145+
138146
//------------------------------------------------------------------------------
139147

140148
{

‎sources/LLCLPng.pas

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
2425
Version 1.01:
2526
* File creation.
2627
* PNG to BMP conversion

‎sources/LLCLZlib.pas

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
2425
Version 1.01:
2526
* File creation.
2627
* Zlib interface for the Light LCL implemented

‎sources/LMessages.pp

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
2425
Version 1.01:
2526
* TWMMove, TWMNotify, TWMSysCommand added
2627
Version 1.00:

‎sources/LazFileUtils.pas

+14
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
25+
* DeleteFileUTF8 and RenameFileUTF8 added
2426
Version 1.01:
2527
Version 1.00:
2628
* File creation.
@@ -60,6 +62,8 @@ function DirectoryExistsUTF8(const Directory: string): boolean;
6062
function ForceDirectoriesUTF8(const Dir: string): boolean;
6163
function CreateDirUTF8(const Dir: string): boolean;
6264
function RemoveDirUTF8(const Dir: string): boolean;
65+
function DeleteFileUTF8(const FileName: string): boolean;
66+
function RenameFileUTF8(const OldName, NewName: string): boolean;
6367
// (No GetFileVersionUTF8 function)
6468

6569
//------------------------------------------------------------------------------
@@ -232,6 +236,16 @@ function RemoveDirUTF8(const Dir: string): boolean;
232236
result := LLCL_RemoveDirectory(@Dir[1]);
233237
end;
234238

239+
function DeleteFileUTF8(const FileName: string): boolean;
240+
begin
241+
result := LLCL_DeleteFile(@FileName[1]);
242+
end;
243+
244+
function RenameFileUTF8(const OldName, NewName: string): boolean;
245+
begin
246+
result := LLCL_MoveFile(@OldName[1], @NewName[1]);
247+
end;
248+
235249
//------------------------------------------------------------------------------
236250

237251
function LFUFindMatchingFile(var F: TSearchRec): integer;

‎sources/LazUTF8.pas

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
2425
Version 1.01:
2526
* UTF8CompareStr, UTF8CompareText, UTF8LowerCase and UTF8UpperCase added
2627
Version 1.00:

‎sources/LazUTF8Classes.pas

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
2425
Version 1.01:
2526
Version 1.00:
2627
* File creation.

‎sources/Menus.pas

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
2425
Version 1.01:
2526
Version 1.00:
2627
* File creation.

‎sources/Registry.pas

+403
Large diffs are not rendered by default.

‎sources/StdCtrls.pas

+142-141
Large diffs are not rendered by default.

‎sources/SysUtils.pas

+28
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
25+
* DeleteFile and RenameFile added
2426
Version 1.01:
2527
* Some (irrelevant) Kylix code removed
2628
* StrToInt64/StrToInt64Def/TryStrToInt64 added
@@ -391,6 +393,8 @@ function FileAge(const FileName: {$IFDEF LLCL_FPC_UNISYS}unicodestring{$ELSE}st
391393
function FileSetDate(Handle: THandle; Age: integer): integer; overload;
392394
function FileAge(const FileName: {$IFDEF LLCL_FPC_UNISYS}unicodestring{$ELSE}string{$ENDIF}; out FileDateTime: TDateTime): boolean; overload;
393395
function GetFileVersion(const aFileName: {$IFDEF LLCL_FPC_UNISYS}unicodestring{$ELSE}string{$ENDIF}): cardinal; {$IFDEF LLCL_FPC_UNISYS}overload;{$ENDIF} // (Only a string version in LCL)
396+
function DeleteFile(const FileName: {$IFDEF LLCL_FPC_UNISYS}unicodestring{$ELSE}string{$ENDIF}): boolean; {$IFDEF LLCL_FPC_UNISYS}overload;{$ENDIF}
397+
function RenameFile(const OldName, NewName: {$IFDEF LLCL_FPC_UNISYS}unicodestring{$ELSE}string{$ENDIF}): boolean; {$IFDEF LLCL_FPC_UNISYS}overload;{$ENDIF}
394398
{$endif}
395399

396400
function FindFirst(const Path: {$IFDEF LLCL_FPC_UNISYS}unicodestring{$ELSE}string{$ENDIF}; Attr: integer; var F: {$IFDEF LLCL_FPC_UNISYS}TUnicodeSearchRec{$ELSE}TSearchRec{$ENDIF}): integer; {$IFDEF LLCL_FPC_UNISYS}overload;{$ENDIF}
@@ -458,6 +462,8 @@ function FileSetDate(const FileName: rawbytestring; Age: integer): integer; ove
458462
function FileAge(const FileName: rawbytestring): integer; overload;
459463
function FileAge(const FileName: rawbytestring; out FileDateTime: TDateTime): boolean; overload;
460464
function GetFileVersion(const aFileName: rawbytestring): cardinal; overload; // (Only a string version in LCL)
465+
function DeleteFile(const FileName: rawbytestring): boolean; overload;
466+
function RenameFile(const OldName, NewName: rawbytestring): boolean; overload;
461467

462468
function FindFirst(const Path: rawbytestring; Attr: integer; var F: TRawByteSearchRec): integer; overload;
463469
function FindNext(var F: TRawByteSearchRec): integer; overload;
@@ -2714,6 +2720,18 @@ function GetFileVersion(const aFileName: {$IFDEF LLCL_FPC_UNISYS}unicodestring{
27142720
end;
27152721
end;
27162722

2723+
function DeleteFile(const FileName: {$IFDEF LLCL_FPC_UNISYS}unicodestring{$ELSE}string{$ENDIF}): boolean; {$IFDEF LLCL_FPC_UNISYS}overload;{$ENDIF}
2724+
begin
2725+
result := {$IFDEF LLCL_FPC_SYSRTL}LLCLSys_DeleteFile{$ELSE}LLCL_DeleteFile{$ENDIF}
2726+
(@FileName[1]);
2727+
end;
2728+
2729+
function RenameFile(const OldName, NewName: {$IFDEF LLCL_FPC_UNISYS}unicodestring{$ELSE}string{$ENDIF}): boolean; {$IFDEF LLCL_FPC_UNISYS}overload;{$ENDIF}
2730+
begin
2731+
result := {$IFDEF LLCL_FPC_SYSRTL}LLCLSys_MoveFile{$ELSE}LLCL_MoveFile{$ENDIF}
2732+
(@OldName[1], @NewName[1]);
2733+
end;
2734+
27172735
{$else} // Linux version of the code:
27182736

27192737
function FileCreate(const FileName: string): integer;
@@ -2846,6 +2864,16 @@ function GetFileVersion(const aFileName: rawbytestring): cardinal; overload;
28462864
result := GetFileVersion(unicodestring(aFileName));
28472865
end;
28482866

2867+
function DeleteFile(const FileName: rawbytestring): boolean; overload;
2868+
begin
2869+
result := DeleteFile(unicodestring(FileName));
2870+
end;
2871+
2872+
function RenameFile(const OldName, NewName: rawbytestring): boolean; overload;
2873+
begin
2874+
result := RenameFile(unicodestring(OldName), unicodestring(NewName));
2875+
end;
2876+
28492877
{$ENDIF LLCL_FPC_UNISYS}
28502878

28512879
function FindMatchingFile(var F: {$IFDEF LLCL_FPC_UNISYS}TUnicodeSearchRec{$ELSE}TSearchRec{$ENDIF}): integer;

‎sources/Variants.pas

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
2425
Version 1.01:
2526
Version 1.00:
2627

‎sources/XPMan.pas

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Copyright (c) 2008 Arnaud Bouchez - http://bouchez.info
2222
Portions Copyright (c) 2001 Paul Toth - http://tothpaul.free.fr
2323
24+
Version 1.02:
2425
Version 1.01:
2526
Version 1.00:
2627
* File creation.

0 commit comments

Comments
 (0)
Please sign in to comment.