2024-08-04 10:25:42 +02:00
|
|
|
unit IDE.StartupForm;
|
2011-10-06 20:53:09 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
Inno Setup
|
2024-04-27 16:38:08 +02:00
|
|
|
Copyright (C) 1997-2024 Jordan Russell
|
2011-10-06 20:53:09 +02:00
|
|
|
Portions by Martijn Laan
|
|
|
|
For conditions of distribution and use, see LICENSE.TXT.
|
|
|
|
|
2020-08-12 19:54:31 +02:00
|
|
|
Compiler IDE Startup form
|
2011-10-06 20:53:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
2024-08-05 20:52:57 +02:00
|
|
|
UIStateForm, StdCtrls, ExtCtrls;
|
2011-10-06 20:53:09 +02:00
|
|
|
|
|
|
|
type
|
|
|
|
TStartupFormResult = (srNone, srEmpty, srWizard, srOpenFile, srOpenDialog,
|
|
|
|
srOpenDialogExamples);
|
|
|
|
|
|
|
|
TStartupForm = class(TUIStateForm)
|
|
|
|
OKButton: TButton;
|
|
|
|
CancelButton: TButton;
|
|
|
|
GroupBox1: TGroupBox;
|
|
|
|
GroupBox2: TGroupBox;
|
|
|
|
EmptyRadioButton: TRadioButton;
|
|
|
|
WizardRadioButton: TRadioButton;
|
|
|
|
OpenRadioButton: TRadioButton;
|
|
|
|
OpenListBox: TListBox;
|
|
|
|
StartupCheck: TCheckBox;
|
|
|
|
NewImage: TImage;
|
|
|
|
OpenImage: TImage;
|
2020-06-28 07:18:33 +02:00
|
|
|
DonateImage: TImage;
|
|
|
|
MailingListImage: TImage;
|
2011-10-06 20:53:09 +02:00
|
|
|
procedure RadioButtonClick(Sender: TObject);
|
|
|
|
procedure FormCreate(Sender: TObject);
|
|
|
|
procedure DblClick_(Sender: TObject);
|
|
|
|
procedure OpenListBoxClick(Sender: TObject);
|
|
|
|
procedure OKButtonClick(Sender: TObject);
|
2019-01-03 18:46:38 +01:00
|
|
|
procedure FormAfterMonitorDpiChanged(Sender: TObject; OldDPI,
|
|
|
|
NewDPI: Integer);
|
2020-06-28 07:18:33 +02:00
|
|
|
procedure DonateImageClick(Sender: TObject);
|
|
|
|
procedure MailingListImageClick(Sender: TObject);
|
2011-10-06 20:53:09 +02:00
|
|
|
private
|
|
|
|
FResult: TStartupFormResult;
|
2020-08-12 20:44:51 +02:00
|
|
|
FResultMainFileName: TFileName;
|
2020-07-07 18:39:30 +02:00
|
|
|
procedure SetMRUFilesList(const MRUFilesList: TStringList);
|
2019-01-03 18:46:38 +01:00
|
|
|
procedure UpdateImages;
|
2020-01-02 21:36:47 +01:00
|
|
|
protected
|
|
|
|
procedure CreateWnd; override;
|
|
|
|
procedure CreateParams(var Params: TCreateParams); override;
|
2011-10-06 20:53:09 +02:00
|
|
|
public
|
2020-07-07 18:39:30 +02:00
|
|
|
property MRUFilesList: TStringList write SetMRUFilesList;
|
2011-10-06 20:53:09 +02:00
|
|
|
property Result: TStartupFormResult read FResult;
|
2020-08-12 20:44:51 +02:00
|
|
|
property ResultMainFileName: TFileName read FResultMainFileName;
|
2011-10-06 20:53:09 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
uses
|
2024-08-09 08:43:14 +02:00
|
|
|
IDE.Messages, Shared.CommonFunc.Vcl, Shared.CommonFunc, IDE.HelperFunc,
|
|
|
|
IDE.MainForm, IDE.ImagesModule, ComCtrls;
|
2011-10-06 20:53:09 +02:00
|
|
|
|
|
|
|
{$R *.DFM}
|
|
|
|
|
2020-07-07 18:39:30 +02:00
|
|
|
procedure TStartupForm.SetMRUFilesList(const MRUFilesList: TStringList);
|
2011-10-06 20:53:09 +02:00
|
|
|
begin
|
2020-07-09 10:01:28 +02:00
|
|
|
OpenListBox.Items.AddStrings(MRUFilesList);
|
2011-10-06 20:53:09 +02:00
|
|
|
UpdateHorizontalExtent(OpenListBox);
|
|
|
|
end;
|
|
|
|
|
2019-01-03 18:46:38 +01:00
|
|
|
procedure TStartupForm.UpdateImages;
|
|
|
|
|
2021-04-02 15:40:25 +02:00
|
|
|
function GetImage(const Button: TToolButton; const WH: Integer): TWICImage;
|
2019-01-03 18:46:38 +01:00
|
|
|
begin
|
2024-08-09 08:43:14 +02:00
|
|
|
Result := ImagesModule.LightToolBarImageCollection.GetSourceImage(Button.ImageIndex, WH, WH)
|
2019-01-03 18:46:38 +01:00
|
|
|
end;
|
|
|
|
|
|
|
|
begin
|
2024-08-12 17:34:14 +02:00
|
|
|
{ After a DPI change the button's Width and Height isn't yet updated, so calculate it ourselves }
|
2024-04-27 16:38:08 +02:00
|
|
|
var WH := MulDiv(16, CurrentPPI, 96);
|
2024-08-06 18:36:53 +02:00
|
|
|
NewImage.Picture.Graphic:= GetImage(MainForm.NewMainFileButton, WH);
|
|
|
|
OpenImage.Picture.Graphic := GetImage(MainForm.OpenMainFileButton, WH);
|
2019-01-03 18:46:38 +01:00
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TStartupForm.FormAfterMonitorDpiChanged(Sender: TObject; OldDPI,
|
|
|
|
NewDPI: Integer);
|
|
|
|
begin
|
|
|
|
UpdateImages;
|
|
|
|
end;
|
|
|
|
|
2011-10-06 20:53:09 +02:00
|
|
|
procedure TStartupForm.FormCreate(Sender: TObject);
|
|
|
|
begin
|
|
|
|
FResult := srNone;
|
|
|
|
|
|
|
|
InitFormFont(Self);
|
|
|
|
|
2024-08-12 17:34:14 +02:00
|
|
|
DonateImage.Hint := MainForm.UpdatePanelDonateImage.Hint;
|
|
|
|
|
2019-01-03 18:46:38 +01:00
|
|
|
UpdateImages;
|
2018-12-30 16:26:24 +01:00
|
|
|
|
2011-10-06 20:53:09 +02:00
|
|
|
OpenListBox.Items.Add(SCompilerExampleScripts);
|
|
|
|
OpenListBox.Items.Add(SCompilerMoreFiles);
|
|
|
|
OpenListBox.ItemIndex := 0;
|
|
|
|
UpdateHorizontalExtent(OpenListBox);
|
|
|
|
ActiveControl := OpenRadioButton;
|
|
|
|
end;
|
|
|
|
|
2020-01-02 21:36:47 +01:00
|
|
|
{ This and CreateParams make bsSizeable (which has an unwanted icon) look like bsDialog, see:
|
|
|
|
https://stackoverflow.com/questions/32096482/delphi-resizable-bsdialog-form/32098633 }
|
|
|
|
procedure TStartupForm.CreateWnd;
|
|
|
|
begin
|
|
|
|
inherited;
|
|
|
|
SendMessage(Handle, WM_SETICON, ICON_BIG, 0);
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TStartupForm.CreateParams(var Params: TCreateParams);
|
|
|
|
begin
|
|
|
|
inherited CreateParams(Params);
|
|
|
|
Params.ExStyle := Params.ExStyle or WS_EX_DLGMODALFRAME or WS_EX_WINDOWEDGE;
|
|
|
|
end;
|
|
|
|
|
2011-10-06 20:53:09 +02:00
|
|
|
procedure TStartupForm.RadioButtonClick(Sender: TObject);
|
|
|
|
begin
|
|
|
|
EmptyRadioButton.Checked := Sender = EmptyRadioButton;
|
|
|
|
WizardRadioButton.Checked := Sender = WizardRadioButton;
|
|
|
|
OpenRadioButton.Checked := Sender = OpenRadioButton;
|
|
|
|
if Sender = OpenRadioButton then begin
|
|
|
|
if OpenListBox.ItemIndex = -1 then
|
|
|
|
OpenListBox.ItemIndex := 0;
|
|
|
|
end
|
|
|
|
else
|
|
|
|
OpenListBox.ItemIndex := -1;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TStartupForm.DblClick_(Sender: TObject);
|
|
|
|
begin
|
|
|
|
if OkButton.Enabled then
|
|
|
|
OkButton.Click;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TStartupForm.OpenListBoxClick(Sender: TObject);
|
|
|
|
begin
|
|
|
|
OpenRadioButton.Checked := True;
|
|
|
|
end;
|
|
|
|
|
2020-06-28 07:18:33 +02:00
|
|
|
procedure TStartupForm.DonateImageClick(Sender: TObject);
|
|
|
|
begin
|
|
|
|
OpenDonateSite;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TStartupForm.MailingListImageClick(Sender: TObject);
|
|
|
|
begin
|
|
|
|
OpenMailingListSite;
|
|
|
|
end;
|
|
|
|
|
2011-10-06 20:53:09 +02:00
|
|
|
procedure TStartupForm.OKButtonClick(Sender: TObject);
|
|
|
|
begin
|
|
|
|
if EmptyRadioButton.Checked then
|
|
|
|
FResult := srEmpty
|
|
|
|
else if WizardRadioButton.Checked then
|
|
|
|
FResult := srWizard
|
|
|
|
else { if OpenRadioButton.Checked then } begin
|
|
|
|
if OpenListBox.ItemIndex = 0 then
|
|
|
|
FResult := srOpenDialogExamples
|
|
|
|
else if OpenListBox.ItemIndex > 1 then begin
|
|
|
|
FResult := srOpenFile;
|
2020-08-12 20:44:51 +02:00
|
|
|
FResultMainFileName := OpenListBox.Items[OpenListBox.ItemIndex];
|
2011-10-06 20:53:09 +02:00
|
|
|
end else
|
|
|
|
FResult := srOpenDialog;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|