From fcd1afc44465230c756eef05df66d9b3d53562ad Mon Sep 17 00:00:00 2001 From: pyscripter Date: Fri, 23 Dec 2022 01:27:57 +0200 Subject: [PATCH 1/4] Fix #37 Fix #38 --- Source/zObjInspector.pas | 78 ++++++++++++++++++++++++++++------------ 1 file changed, 55 insertions(+), 23 deletions(-) diff --git a/Source/zObjInspector.pas b/Source/zObjInspector.pas index a4da6e3..a610c69 100644 --- a/Source/zObjInspector.pas +++ b/Source/zObjInspector.pas @@ -75,10 +75,8 @@ interface vtDouble = 15; vtExtended = 16; - dcInit = 0; - dcBeforeDestroying = 1; - dcShow = 2; - dcFinished = 3; +type + TzDialogState = (dcInit, dcBeforeDestroying, dcShow, dcFinished); type TzObjInspectorBase = class; @@ -219,7 +217,8 @@ TzCustomValueManager = class /// Get customized dialog for current item . /// class function GetDialog(const PItem: PPropItem): TComponentClass; virtual; - class procedure DialogCode(const PItem: PPropItem; Dialog: TComponent; Code: Integer); virtual; + class function DialogCode(const PItem: PPropItem; Dialog: TComponent; DlgState: + TzDialogState): Boolean; virtual; /// Get the value returned after editing from the dialog . /// class function DialogResultValue(const PItem: PPropItem; Dialog: TComponent): TValue; virtual; @@ -496,6 +495,7 @@ TzScrollObjInspectorList = class(TzObjInspectorHeader) FSI: TScrollInfo; FPrevScrollPos: Integer; procedure CMFONTCHANGED(var Message: TMessage); message CM_FONTCHANGED; + procedure CMParentFontChanged(var Message: TCMParentFontChanged); message CM_PARENTFONTCHANGED; procedure WMSize(var Message: TWMSize); message WM_SIZE; procedure WMVScroll(var Message: TWMVScroll); message WM_VSCROLL; procedure WMWINDOWPOSCHANGED(var Message: TWMWindowPosChanged); message WM_WINDOWPOSCHANGED; @@ -710,6 +710,8 @@ TzObjectInspector = class(TzCustomObjInspector) property HeaderValueText; property ObjectVisibility; property FloatPreference; + property ParentFont; + property DoubleBuffered; property OnClick; property OnContextPopup; property OnDragDrop; @@ -2109,6 +2111,17 @@ procedure TzScrollObjInspectorList.CMFONTCHANGED(var Message: TMessage); FItemHeight := Canvas.TextHeight('WA') + 4; // 17; end; +procedure TzScrollObjInspectorList.CMParentFontChanged( + var Message: TCMParentFontChanged); +begin + inherited; + if ParentFont then + begin + Canvas.Font.Assign(Font); + FItemHeight := Canvas.TextHeight('WA') + 4; + end; +end; + constructor TzScrollObjInspectorList.Create(AOwner: TComponent); begin inherited; @@ -3883,11 +3896,8 @@ procedure TzPropInspEdit.ShowModalDialog; var DialogClass: TComponentClass; Dialog: TComponent; - mr: Integer; Value: TValue; begin - if not FPropItem^.Prop.IsWritable then - Exit; DialogClass := nil; with DefaultValueManager do begin @@ -3895,25 +3905,17 @@ procedure TzPropInspEdit.ShowModalDialog; DialogClass := GetDialog(FPropItem); if Assigned(DialogClass) then begin - mr := 0; - Dialog := DialogClass.Create(Self); - if (not(Dialog is TCommonDialog)) and (not(Dialog is TzInspDialog)) then + if not (DialogClass.InheritsFrom(TCommonDialog) or DialogClass.InheritsFrom(TzInspDialog)) then raise DialogDerivedError.CreateRes(@SDialogDerivedErr); - if Dialog is TzInspDialog then - TzInspDialog(Dialog).PropItem := FPropItem; - DialogCode(FPropItem, Dialog, dcInit); - DialogCode(FPropItem, Dialog, dcShow); - if Dialog is TCommonDialog then - mr := Integer(TCommonDialog(Dialog).Execute) - else if Dialog is TzInspDialog then - mr := TzInspDialog(Dialog).ShowModal; - PostMessage(Handle, WM_LBUTTONUP, 0, 0); - if mr = mrOk then + Dialog := DialogClass.Create(Self); + if DialogCode(FPropItem, Dialog, dcInit) and + DialogCode(FPropItem, Dialog, dcShow) then begin DialogCode(FPropItem, Dialog, dcFinished); Value := DialogResultValue(FPropItem, Dialog); FInspector.DoSetValue(FPropItem, Value); end; + PostMessage(Handle, WM_LBUTTONUP, 0, 0); DialogCode(FPropItem, Dialog, dcBeforeDestroying); FreeAndNil(Dialog); end; @@ -4180,9 +4182,39 @@ procedure TzPropInspEdit.WMSETFOCUS(var Msg: TWMSetFocus); TzCustomValueManager.FloatPreference.Free; end; -class procedure TzCustomValueManager.DialogCode(const PItem: PPropItem; Dialog: TComponent; Code: Integer); +class function TzCustomValueManager.DialogCode(const PItem: PPropItem; Dialog: + TComponent; DlgState: TzDialogState): Boolean; begin - + case DlgState of + dcInit: + begin + Result := True; + if Dialog is TzInspDialog then + TzInspDialog(Dialog).PropItem := PItem + else + case GetValueType(PItem) of + vtColor: + TColorDialog(Dialog).Color := TColor(PItem.Value.AsInteger); + vtFont: + TFontDialog(Dialog).Font := TFont(PItem.Value.AsObject); + else + Result := False; + end; + end; + dcBeforeDestroying: + Result := True; + dcShow: + if Dialog is TCommonDialog then + Result := TCommonDialog(Dialog).Execute + else if Dialog is TzInspDialog then + Result := TzInspDialog(Dialog).ShowModal = mrOK + else + Result := False; + dcFinished: + Result := True; + else + Result := False; // To avoid stupid warning + end; end; class function TzCustomValueManager.DialogResultValue(const PItem: PPropItem; Dialog: TComponent): TValue; From 12688d2ae1c0856dc2cf6972aa46acb02f635f60 Mon Sep 17 00:00:00 2001 From: pyscripter Date: Thu, 9 Nov 2023 03:19:54 +0200 Subject: [PATCH 2/4] Added packages with LIBSUFFIX --- Packages/Delphi 10_4+/zControls.groupproj | 48 +++++++ Packages/Delphi 10_4+/zControls_D.dpk | 41 ++++++ Packages/Delphi 10_4+/zControls_D.dproj | 153 ++++++++++++++++++++ Packages/Delphi 10_4+/zControls_D.res | Bin 0 -> 96 bytes Packages/Delphi 10_4+/zControls_R.dpk | 51 +++++++ Packages/Delphi 10_4+/zControls_R.dproj | 168 ++++++++++++++++++++++ Packages/Delphi 10_4+/zControls_R.res | Bin 0 -> 96 bytes 7 files changed, 461 insertions(+) create mode 100644 Packages/Delphi 10_4+/zControls.groupproj create mode 100644 Packages/Delphi 10_4+/zControls_D.dpk create mode 100644 Packages/Delphi 10_4+/zControls_D.dproj create mode 100644 Packages/Delphi 10_4+/zControls_D.res create mode 100644 Packages/Delphi 10_4+/zControls_R.dpk create mode 100644 Packages/Delphi 10_4+/zControls_R.dproj create mode 100644 Packages/Delphi 10_4+/zControls_R.res diff --git a/Packages/Delphi 10_4+/zControls.groupproj b/Packages/Delphi 10_4+/zControls.groupproj new file mode 100644 index 0000000..c6c6ff0 --- /dev/null +++ b/Packages/Delphi 10_4+/zControls.groupproj @@ -0,0 +1,48 @@ + + + {164AB00E-993A-46B2-9519-5B76EDE39E45} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Packages/Delphi 10_4+/zControls_D.dpk b/Packages/Delphi 10_4+/zControls_D.dpk new file mode 100644 index 0000000..f08ed30 --- /dev/null +++ b/Packages/Delphi 10_4+/zControls_D.dpk @@ -0,0 +1,41 @@ +package zControls_D; + +{$R *.res} +{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO OFF} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION OFF} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES ON} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$LIBSUFFIX AUTO} +{$DESIGNONLY} +{$IMPLICITBUILD ON} + +requires + rtl, + vcl, + zControls_R; + +contains + zControlsReg in '..\Source\zControlsReg.pas'; + +end. + diff --git a/Packages/Delphi 10_4+/zControls_D.dproj b/Packages/Delphi 10_4+/zControls_D.dproj new file mode 100644 index 0000000..b28effc --- /dev/null +++ b/Packages/Delphi 10_4+/zControls_D.dproj @@ -0,0 +1,153 @@ + + + True + Package + Debug + VCL + zControls_D.dpk + Win32 + {BF2C4A5F-B6E3-44DF-A9B7-957B4D8C2B75} + 19.5 + 1 + + + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + zControls_D + All + .\$(Platform)\$(Config) + .\$(Platform)\$(Config) + System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) + true + $(Auto) + true + true + CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) + 2057 + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + rtl;vcl;zControls_R;$(DCC_UsePackage) + + + true + true + DEBUG;$(DCC_Define) + true + false + true + + + None + false + + + 0 + RELEASE;$(DCC_Define) + false + 0 + + + + MainSource + + + + + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + + + + Delphi.Personality.12 + Package + + + + zControls_D.dpk + + + + True + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 5121 + 1256 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + + + + + + + + + + + + + + + + True + False + + + 12 + + + + + diff --git a/Packages/Delphi 10_4+/zControls_D.res b/Packages/Delphi 10_4+/zControls_D.res new file mode 100644 index 0000000000000000000000000000000000000000..743599575b02e97248bade49ed2e3eabafe25a0a GIT binary patch literal 96 zcmZQzU|>)H;{X347|28cOhBFu5dZ(r#Sp;Y!{Epe!r;c>&k)4m3uHM0X?F%!AS)QE O%YcEC1!e#vkO2UW7YiT& literal 0 HcmV?d00001 diff --git a/Packages/Delphi 10_4+/zControls_R.dpk b/Packages/Delphi 10_4+/zControls_R.dpk new file mode 100644 index 0000000..43ee4ee --- /dev/null +++ b/Packages/Delphi 10_4+/zControls_R.dpk @@ -0,0 +1,51 @@ +package zControls_R; + +{$R *.res} +{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO OFF} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION OFF} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES ON} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$LIBSUFFIX AUTO} +{$RUNONLY} +{$IMPLICITBUILD ON} + +requires + rtl, + vcl; + +contains + zBase in '..\..\Source\zBase.pas', + zCanvasStack in '..\..\Source\zCanvasStack.pas', + zGraphicDialog in '..\..\Source\zGraphicDialog.pas' {GraphicDialog}, + zObjInspDialogs in '..\..\Source\zObjInspDialogs.pas', + zObjInspector in '..\..\Source\zObjInspector.pas', + zObjInspList in '..\..\Source\zObjInspList.pas', + zRecList in '..\..\Source\zRecList.pas', + zStringsDialog in '..\..\Source\zStringsDialog.pas' {StringsDialog}, + zUtils in '..\..\Source\zUtils.pas', + FloatConv in '..\..\Source\FloatConv\FloatConv.pas', + FloatConv.Double in '..\..\Source\FloatConv\FloatConv.Double.pas', + FloatConv.Extended in '..\..\Source\FloatConv\FloatConv.Extended.pas', + FloatConv.Single in '..\..\Source\FloatConv\FloatConv.Single.pas'; + +end. diff --git a/Packages/Delphi 10_4+/zControls_R.dproj b/Packages/Delphi 10_4+/zControls_R.dproj new file mode 100644 index 0000000..5097d7e --- /dev/null +++ b/Packages/Delphi 10_4+/zControls_R.dproj @@ -0,0 +1,168 @@ + + + True + Package + Debug + VCL + zControls_R.dpk + Win32 + {5FC6A95F-C14E-4F26-A168-6C62E8E5183C} + 19.5 + 1 + + + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + zControls_R + All + .\$(Platform)\$(Config) + .\$(Platform)\$(Config) + System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) + $(Auto) + true + true + true + CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) + 2057 + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + + + true + true + DEBUG;$(DCC_Define) + true + false + true + + + None + false + + + 0 + RELEASE;$(DCC_Define) + false + 0 + + + + MainSource + + + + + + +
GraphicDialog
+
+ + + + + +
StringsDialog
+
+ + + + + + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + Delphi.Personality.12 + Package + + + + zControls_R.dpk + + + + True + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 5121 + 1256 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + + + + + + + + + + + + + + + + True + False + + + 12 + + + + +
diff --git a/Packages/Delphi 10_4+/zControls_R.res b/Packages/Delphi 10_4+/zControls_R.res new file mode 100644 index 0000000000000000000000000000000000000000..743599575b02e97248bade49ed2e3eabafe25a0a GIT binary patch literal 96 zcmZQzU|>)H;{X347|28cOhBFu5dZ(r#Sp;Y!{Epe!r;c>&k)4m3uHM0X?F%!AS)QE O%YcEC1!e#vkO2UW7YiT& literal 0 HcmV?d00001 From 092e0acff02c0c083e4c943adc919abf6741702e Mon Sep 17 00:00:00 2001 From: pyscripter Date: Mon, 13 Nov 2023 02:21:39 +0200 Subject: [PATCH 3/4] Removed hints --- Source/zRecList.pas | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/zRecList.pas b/Source/zRecList.pas index 2e27710..1cc206d 100644 --- a/Source/zRecList.pas +++ b/Source/zRecList.pas @@ -111,8 +111,8 @@ destructor TzRecordList.Destroy; end; function TzRecordList.Add(const Rec: T): Integer; -var - PRec: PByte; +(* var + PRec: PByte; *) begin (* PRec := AllocMem(SizeOf(T)); FList.Add(PRec); @@ -149,7 +149,6 @@ function TzRecordList.Delete(const Index: Integer): Boolean; var PRec: Pointer; begin - Result := False; if (Index > -1) and (Index < FCount) then begin PRec := FList.Items[Index]; @@ -206,7 +205,6 @@ procedure TzRecordList.FreeRecord(PRec: Pointer); function TzRecordList.Get(const Index: Integer): P; begin - Result := P(nil); if (Index > -1) and (Index < FCount) then begin Result := PointerToP(FList.Items[Index]); From 3a6bd456a09eae2a9986cfef70dbed8e074d0154 Mon Sep 17 00:00:00 2001 From: pyscripter Date: Sun, 8 Sep 2024 14:19:22 +0300 Subject: [PATCH 4/4] Fix 10.4+ packages --- Packages/Delphi 10_4+/zControls_D.dpk | 3 ++- Packages/Delphi 10_4+/zControls_R.dpk | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Packages/Delphi 10_4+/zControls_D.dpk b/Packages/Delphi 10_4+/zControls_D.dpk index f08ed30..ae57439 100644 --- a/Packages/Delphi 10_4+/zControls_D.dpk +++ b/Packages/Delphi 10_4+/zControls_D.dpk @@ -25,6 +25,7 @@ package zControls_D; {$IMAGEBASE $400000} {$DEFINE DEBUG} {$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'zControls'} {$LIBSUFFIX AUTO} {$DESIGNONLY} {$IMPLICITBUILD ON} @@ -35,7 +36,7 @@ requires zControls_R; contains - zControlsReg in '..\Source\zControlsReg.pas'; + zControlsReg in '..\..\Source\zControlsReg.pas'; end. diff --git a/Packages/Delphi 10_4+/zControls_R.dpk b/Packages/Delphi 10_4+/zControls_R.dpk index 43ee4ee..c586889 100644 --- a/Packages/Delphi 10_4+/zControls_R.dpk +++ b/Packages/Delphi 10_4+/zControls_R.dpk @@ -25,6 +25,7 @@ package zControls_R; {$IMAGEBASE $400000} {$DEFINE DEBUG} {$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'zControls - Run-time Package'} {$LIBSUFFIX AUTO} {$RUNONLY} {$IMPLICITBUILD ON}