Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Code/DDevExtensions/Bin/Changes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version: 2.89
=============
- Added: TDataModule.PixelsPerInch property remover (Delphi 11 and newer)

Version: 2.88
=============
- Added: Support for Delphi 11.0 Alexandria
Expand Down
3 changes: 2 additions & 1 deletion Code/DDevExtensions/D_D110/DDevExtensions.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ uses
FrmReloadFiles in '..\Source\Editor\FrmReloadFiles.pas' {FormReloadFiles},
DocModuleHandler in '..\Source\Editor\DocModuleHandler.pas',
CodeInsightHandling in '..\Source\Editor\CodeInsightHandling.pas',
DisableAlphaSortClassCompletion in '..\Source\DSUFeatures\DisableAlphaSortClassCompletion.pas';
DisableAlphaSortClassCompletion in '..\Source\DSUFeatures\DisableAlphaSortClassCompletion.pas',
RemovePixelsPerInchProperty in '..\Source\FormDesignerHelpers\RemovePixelsPerInchProperty.pas';

var
AboutBoxServices: IOTAAboutBoxServices = nil;
Expand Down
724 changes: 724 additions & 0 deletions Code/DDevExtensions/D_D110/DDevExtensions.dproj

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Code/DDevExtensions/Source/DelphiExtension.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
{$DEFINE COMPILER105_UP}
{$DEFINE DELPHI2007_UP}
{$IFEND}
{$IF CompilerVersion >= 35}
{$DEFINE COMPILER110_UP}
{$IFEND}
{$ENDIF}

{$I ..\jedi\jedi.inc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ inherited FrameOptionPageFormDesigner: TFrameOptionPageFormDesigner
Width = 372
Height = 175
ParentFont = False
PixelsPerInch = 96
inherited pnlClient: TPanel
Width = 372
Height = 126
Expand All @@ -27,17 +28,25 @@ inherited FrameOptionPageFormDesigner: TFrameOptionPageFormDesigner
Top = 54
Width = 313
Height = 17
Caption = 'Do not store the Explicit* properties into the DFM'
Caption = 'Don'#39't store the Explicit* properties into the DFM'
TabOrder = 2
end
object chkRemovePixelsPerInchProperties: TCheckBox
Left = 24
Top = 77
Width = 321
Height = 17
Caption = 'Don'#39't store "TDataModule.PixelsPerInch* property in DFM'
TabOrder = 3
end
end
inherited pnlDescription: TPanel
Width = 372
inherited bvlSplitter: TBevel
Width = 372
end
inherited lblDescription: TLabel
Width = 212
Width = 234
Caption = 'Configure the form designer enhancements.'
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ TFormDesigner = class(TPluginConfig)
FActive: Boolean;
FLabelMargin: Boolean;
FRemoveExplicitProperty: Boolean;
FRemovePixelsPerInchProperty: Boolean;
procedure SetActive(const Value: Boolean);
procedure SetLabelMargin(const Value: Boolean);
procedure SetRemoveExplicitProperty(const Value: Boolean);
procedure SetRemovePixelsPerInchProperty(const Value: Boolean);
protected
function GetOptionPages: TTreePage; override;
procedure Init; override;
Expand All @@ -37,12 +39,14 @@ TFormDesigner = class(TPluginConfig)
property Active: Boolean read FActive write SetActive;
property LabelMargin: Boolean read FLabelMargin write SetLabelMargin;
property RemoveExplicitProperty: Boolean read FRemoveExplicitProperty write SetRemoveExplicitProperty;
property RemovePixelsPerInchProperty : Boolean read FRemovePixelsPerInchProperty write SetRemovePixelsPerInchProperty;
end;

TFrameOptionPageFormDesigner = class(TFrameBase, ITreePageComponent)
cbxActive: TCheckBox;
cbxLabelMargin: TCheckBox;
chkRemoveExplicitProperties: TCheckBox;
chkRemovePixelsPerInchProperties: TCheckBox;
procedure cbxActiveClick(Sender: TObject);
private
{ Private-Deklarationen }
Expand All @@ -65,7 +69,11 @@ procedure InitPlugin(Unload: Boolean);
implementation

uses
Main, LabelMarginHelper, RemoveExplicitProperty;
Main, LabelMarginHelper,
{$IFDEF COMPILER110_UP}
RemovePixelsPerInchProperty,
{$ENDIF COMPILER110_UP}
RemoveExplicitProperty;

{$R *.dfm}

Expand All @@ -90,6 +98,11 @@ procedure TFrameOptionPageFormDesigner.cbxActiveClick(Sender: TObject);
begin
cbxLabelMargin.Enabled := cbxActive.Checked;
chkRemoveExplicitProperties.Enabled := cbxActive.Checked;
{$IFDEF COMPILER110_UP}
chkRemoveExplicitProperties.Enabled := cbxActive.Checked;
{$ELSE}
chkRemoveExplicitProperties.Enabled := False;
{$ENDIF COMPILER110_UP}
end;

procedure TFrameOptionPageFormDesigner.SetUserData(UserData: TObject);
Expand All @@ -102,14 +115,20 @@ procedure TFrameOptionPageFormDesigner.LoadData;
cbxActive.Checked := FFormDesigner.Active;
cbxLabelMargin.Checked := FFormDesigner.LabelMargin;
chkRemoveExplicitProperties.Checked := FFormDesigner.RemoveExplicitProperty;

chkRemovePixelsPerInchProperties.Checked := FFormDesigner.RemovePixelsPerInchProperty;
{$IFDEF COMPILER110_UP}
chkRemoveExplicitProperties.Enabled := cbxActive.Checked;
{$ELSE}
chkRemoveExplicitProperties.Enabled := False;
{$ENDIF COMPILER110_UP}
cbxActiveClick(cbxActive);
end;

procedure TFrameOptionPageFormDesigner.SaveData;
begin
FFormDesigner.LabelMargin := cbxLabelMargin.Checked;
FFormDesigner.RemoveExplicitProperty := chkRemoveExplicitProperties.Checked;
FFormDesigner.RemovePixelsPerInchProperty := chkRemovePixelsPerInchProperties.Checked;

FFormDesigner.Active := cbxActive.Checked;
FFormDesigner.Save;
Expand Down Expand Up @@ -141,6 +160,7 @@ procedure TFormDesigner.Init;
inherited Init;
LabelMargin := True;
RemoveExplicitProperty := False;
RemovePixelsPerInchProperty := False;
Active := True;
end;

Expand Down Expand Up @@ -173,11 +193,24 @@ procedure TFormDesigner.SetRemoveExplicitProperty(const Value: Boolean);
end;
end;

procedure TFormDesigner.SetRemovePixelsPerInchProperty(const Value: Boolean);
begin
if Value <> FRemovePixelsPerInchProperty then
begin
FRemovePixelsPerInchProperty := Value;
if Active then
UpdateHooks;
end;;
end;

procedure TFormDesigner.UpdateHooks;
begin
{$IFDEF INCLUDE_FORMDESIGNER}
SetLabelMarginActive(Active and LabelMargin);
SetRemoveExplicitPropertyActive(Active and RemoveExplicitProperty);
{$IFDEF COMPILER110_UP}
SetRemovePixelsPerInchPropertyActive(Active and RemovePixelsPerInchProperty);
{$ENDIF COMPILER110_UP}
{$ENDIF INCLUDE_FORMDESIGNER}
end;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// * Copyright: �2021 Fred Schetterer

unit RemovePixelsPerInchProperty;

{$I ..\DelphiExtension.inc}

interface

uses
SysUtils, Classes, Forms, Controls, IDEHooks, Hooking;


procedure SetRemovePixelsPerInchPropertyActive(Active: Boolean);

implementation

uses
// CodeSiteLogging,
IDEUtils;

var
HookTControl_DefineProperties: TRedirectCode;

type
/// <summary>
/// Access to Private Parts
/// </summary>
TDataModuleHelper = class helper for TDataModule
procedure DefineProperties2(Filer: TFiler);
end;

type
TOpenDataModule = class(TDataModule);

var
IsActive: Boolean;

procedure SetRemovePixelsPerInchPropertyActive(Active: Boolean);
begin
if Active <> IsActive then
begin
IsActive := Active;
if Active then
CodeRedirect(@TOpenDataModule.DefineProperties, @TDataModule.DefineProperties2, HookTControl_DefineProperties)
else
UnhookFunction(HookTControl_DefineProperties);
end;
end;

procedure TDataModuleHelper.DefineProperties2(Filer: TFiler);
var
Ancestor: TDataModule;

function DoWriteWidth: Boolean;
begin
Result := True;
if Ancestor <> nil then
Result := DesignSize.X <> Ancestor.DesignSize.X;
end;

function DoWriteHorizontalOffset: Boolean;
begin
if Ancestor <> nil then
Result := DesignOffset.X <> Ancestor.DesignOffset.X else
Result := DesignOffset.X <> 0;
end;

function DoWriteVerticalOffset: Boolean;
begin
if Ancestor <> nil then
Result := DesignOffset.Y <> Ancestor.DesignOffset.Y else
Result := DesignOffset.Y <> 0;
end;

function DoWriteHeight: Boolean;
begin
Result := True;
if Ancestor <> nil then Result := DesignSize.Y <> Ancestor.DesignSize.Y;
end;

begin
{$If Declared(TCodeSiteLogger)}
CodeSite.Send('DefineProperties');
{$IfEnd}

Ancestor := TDataModule(Filer.Ancestor);
with self do begin // access to private parts
Filer.DefineProperty('Height', ReadHeight, WriteHeight, DoWriteHeight);
Filer.DefineProperty('HorizontalOffset', ReadHorizontalOffset,
WriteHorizontalOffset, DoWriteHorizontalOffset);
Filer.DefineProperty('VerticalOffset', ReadVerticalOffset,
WriteVerticalOffset, DoWriteVerticalOffset);
Filer.DefineProperty('Width', ReadWidth, WriteWidth, DoWriteWidth);
Filer.DefineProperty('OldCreateOrder', IgnoreIdent, nil, False);
// We need to read if it exists else it Errors, but never write it..
Filer.DefineProperty('PixelsPerInch', ReadPixelsPerInch, WritePixelsPerInch, (csReading in ComponentState));
end;

{$IF CompilerVersion > 35}
Check if anything changed in System.Classes.TDataModule.DefineProperties
{$IFEND}
end;

end.
2 changes: 1 addition & 1 deletion Code/DDevExtensions/Source/version.inc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VersionNumber = '2.88';
VersionNumber = '2.89';
2 changes: 1 addition & 1 deletion Code/DDevExtensions/Version.rc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ BEGIN
VALUE "FileDescription", "DDevExtensions"
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", "DDevExtensions"
VALUE "LegalCopyright", "(C) 2006-2020 Andreas Hausladen"
VALUE "LegalCopyright", "(C) 2006-2021 Andreas Hausladen"
VALUE "LegalTrademarks1", ""
VALUE "LegalTrademarks2", ""
VALUE "OriginalFilename", ""
Expand Down
Binary file modified Code/DDevExtensions/Version.res
Binary file not shown.
2 changes: 1 addition & 1 deletion Code/DDevExtensions/version.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@SET majorversion=2
@SET minorversion=87
@SET minorversion=89
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Start the InstallDDevExtensions.exe and press the <Uninstall> button.
- Increment Build Number only when building the project (default: on) [2010 only]
- Set TLabel.Margins.Bottom to zero (default: on)
- Remove Explicit* properties (default: off)
- Remove TDataModule.PixelsPerInch property (default: off) [Delphi 11]
- Component Selector (default: off, no hotkey)
- Disable “Source has been modified. Rebuild?” (default: on)
- Auto-save editor files after successful compile (default: off)
Expand Down