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..ae57439 --- /dev/null +++ b/Packages/Delphi 10_4+/zControls_D.dpk @@ -0,0 +1,42 @@ +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} +{$DESCRIPTION 'zControls'} +{$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 0000000..7435995 Binary files /dev/null and b/Packages/Delphi 10_4+/zControls_D.res differ diff --git a/Packages/Delphi 10_4+/zControls_R.dpk b/Packages/Delphi 10_4+/zControls_R.dpk new file mode 100644 index 0000000..c586889 --- /dev/null +++ b/Packages/Delphi 10_4+/zControls_R.dpk @@ -0,0 +1,52 @@ +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} +{$DESCRIPTION 'zControls - Run-time Package'} +{$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 0000000..7435995 Binary files /dev/null and b/Packages/Delphi 10_4+/zControls_R.res differ 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; 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]);