Skip to content

Commit

Permalink
IDE.MainForm: Stop the Delphi IDE (11.3) from adding Explicit* proper…
Browse files Browse the repository at this point in the history
…ties to the .dfm file.
  • Loading branch information
jordanrussell authored Nov 20, 2024
1 parent 49bc894 commit f3eea5e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions Projects/Src/IDE.MainForm.dfm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
object MainForm: TMainForm
Left = 206
Top = 97
BorderStyle = bsNone
Caption = '*'
ClientHeight = 306
ClientWidth = 361
Expand Down
24 changes: 24 additions & 0 deletions Projects/Src/IDE.MainForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ TMainForm = class(TUIStateForm)
function FindSetupDirectiveValue(const DirectiveName: String;
DefaultValue: Boolean): Boolean; overload;
function FromCurrentPPI(const XY: Integer): Integer;
function GetBorderStyle: TFormBorderStyle;
procedure Go(AStepMode: TStepMode);
procedure HideError;
procedure InitializeFindText(Dlg: TFindDialog);
Expand Down Expand Up @@ -583,6 +584,7 @@ TMainForm = class(TUIStateForm)
procedure ResetAllMemosLineState;
procedure StartProcess;
function SaveFile(const AMemo: TIDEScintFileEdit; const SaveAs: Boolean): Boolean;
procedure SetBorderStyle(Value: TFormBorderStyle);
procedure SetErrorLine(const AMemo: TIDEScintFileEdit; const ALine: Integer);
procedure SetStatusPanelVisible(const AVisible: Boolean);
procedure SetStepLine(const AMemo: TIDEScintFileEdit; ALine: Integer);
Expand Down Expand Up @@ -656,6 +658,8 @@ TMainForm = class(TUIStateForm)
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function IsShortCut(var Message: TWMKey): Boolean; override;
published
property BorderStyle: TFormBorderStyle read GetBorderStyle write SetBorderStyle;
end;

var
Expand Down Expand Up @@ -1145,6 +1149,26 @@ destructor TMainForm.Destroy;
inherited;
end;

function TMainForm.GetBorderStyle: TFormBorderStyle;
begin
Result := inherited BorderStyle;
end;

procedure TMainForm.SetBorderStyle(Value: TFormBorderStyle);
begin
{ Hack: To stop the Delphi IDE from adding Explicit* properties to the .dfm
file every time the unit is saved, we set BorderStyle=bsNone on the form.
At run-time, ignore that setting so that BorderStyle stays at the default
value, bsSizeable.
It would be simpler to change BorderStyle from bsNone to bsSizeable in the
form's constructor, but it doesn't quite work: when a form's handle is
created while BorderStyle=bsNone, Position=poDefault behaves like
poDefaultPosOnly (see TCustomForm.CreateParams). }

if Value <> bsNone then
inherited BorderStyle := Value;
end;

class procedure TMainForm.AppOnException(Sender: TObject; E: Exception);
begin
AppMessageBox(PChar(AddPeriod(E.Message)), SCompilerFormCaption,
Expand Down

0 comments on commit f3eea5e

Please sign in to comment.