IDE: A new dialog for manifest options. Issue #30977, patch from AlexeyT.

git-svn-id: trunk@53418 -
This commit is contained in:
juha 2016-11-22 15:59:00 +00:00
parent 1780042136
commit a2d289acd6
6 changed files with 289 additions and 152 deletions

2
.gitattributes vendored
View File

@ -6280,6 +6280,8 @@ ide/mainbase.pas svneol=native#text/pascal
ide/mainintf.pas svneol=native#text/pascal
ide/makeresstrdlg.lfm svneol=native#text/plain
ide/makeresstrdlg.pas svneol=native#text/pascal
ide/manifestdialog.lfm svneol=native#text/plain
ide/manifestdialog.pas svneol=native#text/pascal
ide/miscoptions.pas svneol=native#text/pascal
ide/modematrixopts.pas svneol=native#text/plain
ide/mouseactiondialog.lfm svneol=native#text/plain

View File

@ -1,21 +1,21 @@
object ProjectApplicationOptionsFrame: TProjectApplicationOptionsFrame
Left = 0
Height = 550
Height = 462
Top = 0
Width = 487
ClientHeight = 550
ClientHeight = 462
ClientWidth = 487
TabOrder = 0
DesignLeft = 392
DesignTop = 251
object AppSettingsGroupBox: TGroupBox
Left = 0
Height = 501
Height = 413
Top = 0
Width = 487
Align = alTop
Caption = 'AppSettingsGroupBox'
ClientHeight = 482
ClientHeight = 394
ClientWidth = 483
TabOrder = 0
object TitleLabel: TLabel
@ -73,12 +73,12 @@ object ProjectApplicationOptionsFrame: TProjectApplicationOptionsFrame
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 413
Top = 321
Width = 191
BorderSpacing.Left = 6
BorderSpacing.Top = 3
Caption = 'UseAppBundleCheckBox'
TabOrder = 12
TabOrder = 9
end
object UseXPManifestCheckBox: TCheckBox
AnchorSideLeft.Control = AppSettingsGroupBox
@ -192,43 +192,6 @@ object ProjectApplicationOptionsFrame: TProjectApplicationOptionsFrame
Anchors = [akTop, akLeft, akRight]
TabOrder = 2
end
object UIAccessCheckBox: TCheckBox
AnchorSideTop.Control = ExecutionLevelComboBox
AnchorSideTop.Side = asrBottom
Left = 27
Height = 24
Top = 331
Width = 152
BorderSpacing.Top = 3
Caption = 'UIAccessCheckBox'
TabOrder = 10
end
object ExecutionLevelComboBox: TComboBox
AnchorSideLeft.Control = DpiAwareComboBox
AnchorSideTop.Control = DpiAwareComboBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = DpiAwareComboBox
AnchorSideRight.Side = asrBottom
Left = 195
Height = 31
Top = 297
Width = 282
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 3
ItemHeight = 0
Style = csDropDownList
TabOrder = 9
end
object ExecutionLevelLabel: TLabel
AnchorSideTop.Control = ExecutionLevelComboBox
AnchorSideTop.Side = asrCenter
Left = 27
Height = 17
Top = 304
Width = 138
Caption = 'ExecutionLevelLabel'
ParentColor = False
end
object DefaultIconButton: TButton
AnchorSideLeft.Control = LoadIconButton
AnchorSideTop.Control = LoadIconButton
@ -260,11 +223,11 @@ object ProjectApplicationOptionsFrame: TProjectApplicationOptionsFrame
ParentFont = False
end
object DarwinDividerBevel: TDividerBevel
AnchorSideTop.Control = TextFieldButton
AnchorSideTop.Control = ManifestButton
AnchorSideTop.Side = asrBottom
Left = 8
Height = 17
Top = 393
Top = 301
Width = 471
Caption = 'For Darwin'
Anchors = [akTop, akLeft, akRight]
@ -278,59 +241,29 @@ object ProjectApplicationOptionsFrame: TProjectApplicationOptionsFrame
AnchorSideTop.Side = asrBottom
Left = 27
Height = 29
Top = 443
Top = 351
Width = 177
AutoSize = True
BorderSpacing.Left = 21
BorderSpacing.Top = 6
Caption = 'CreateAppBundleButton'
OnClick = CreateAppBundleButtonClick
TabOrder = 13
TabOrder = 10
end
object DpiAwareLabel: TLabel
object ManifestButton: TButton
AnchorSideLeft.Control = UseXPManifestCheckBox
AnchorSideTop.Control = DpiAwareComboBox
AnchorSideTop.Side = asrCenter
Left = 27
Height = 17
Top = 270
Width = 103
BorderSpacing.Left = 21
BorderSpacing.Top = 3
Caption = 'DpiAwareLabel'
ParentColor = False
end
object DpiAwareComboBox: TComboBox
AnchorSideLeft.Control = ExecutionLevelLabel
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = UseXPManifestCheckBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = TitleEdit
AnchorSideRight.Side = asrBottom
Left = 195
Height = 31
Top = 263
Width = 282
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 30
BorderSpacing.Top = 3
ItemHeight = 0
Style = csDropDownList
TabOrder = 8
end
object TextFieldButton: TButton
AnchorSideLeft.Control = UIAccessCheckBox
AnchorSideTop.Control = UIAccessCheckBox
AnchorSideTop.Side = asrBottom
Left = 27
Height = 29
Top = 358
Width = 120
Top = 266
Width = 118
AutoSize = True
BorderSpacing.Top = 3
Caption = 'TextFieldButton'
OnClick = TextFieldButtonClick
TabOrder = 11
BorderSpacing.Left = 21
BorderSpacing.Top = 6
Caption = 'ManifestButton'
OnClick = ManifestButtonClick
TabOrder = 8
end
end
object OpenPictureDialog1: TOpenPictureDialog

View File

@ -8,7 +8,8 @@ uses
Classes, SysUtils, LCLProc, FileUtil, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls, Buttons, ComCtrls, ExtDlgs, Math, LCLType, IDEOptionsIntf,
LazIDEIntf, IDEDialogs, DividerBevel, Project, LazarusIDEStrConsts,
EnvironmentOpts, ApplicationBundle, ProjectIcon, W32Manifest, CompilerOptions;
EnvironmentOpts, ApplicationBundle, ProjectIcon, W32Manifest, CompilerOptions,
ManifestDialog;
type
@ -16,22 +17,17 @@ type
TProjectApplicationOptionsFrame = class(TAbstractIDEOptionsEditor)
AppSettingsGroupBox: TGroupBox;
TextFieldButton: TButton;
ManifestButton: TButton;
CreateAppBundleButton: TBitBtn;
DefaultIconButton: TButton;
DpiAwareLabel: TLabel;
DpiAwareComboBox: TComboBox;
WindowsDividerBevel: TDividerBevel;
DarwinDividerBevel: TDividerBevel;
UIAccessCheckBox: TCheckBox;
ExecutionLevelComboBox: TComboBox;
ClearIconButton: TBitBtn;
IconImage: TImage;
IconLabel: TLabel;
IconPanel: TPanel;
IconTrack: TTrackBar;
IconTrackLabel: TLabel;
ExecutionLevelLabel: TLabel;
LoadIconButton: TBitBtn;
OpenPictureDialog1: TOpenPictureDialog;
SaveIconButton: TBitBtn;
@ -46,8 +42,8 @@ type
procedure IconImagePictureChanged(Sender: TObject);
procedure IconTrackChange(Sender: TObject);
procedure LoadIconButtonClick(Sender: TObject);
procedure ManifestButtonClick(Sender: TObject);
procedure SaveIconButtonClick(Sender: TObject);
procedure TextFieldButtonClick(Sender: TObject);
procedure UseXPManifestCheckBoxChange(Sender: TObject);
private
FProject: TProject;
@ -66,13 +62,6 @@ implementation
{$R *.lfm}
const
ExecutionLevelToCaption: array[TXPManifestExecutionLevel] of PString = (
{ xmelAsInvoker } @dlgPOAsInvoker,
{ xmelHighestAvailable } @dlgPOHighestAvailable,
{ xmelRequireAdministrator } @dlgPORequireAdministrator
);
function CreateProjectApplicationBundle(AProject: TProject): string;
// returns target file name
var
@ -167,36 +156,41 @@ begin
end;
end;
procedure TProjectApplicationOptionsFrame.ManifestButtonClick(Sender: TObject);
var
Man: TProjectXPManifest;
Form: TManifestForm;
begin
Man:= FProject.ProjResources.XPManifest;
Form:= TManifestForm.Create(Self);
try
Form.DpiAwareComboBox.ItemIndex := Ord(Man.DpiAware);
Form.ExecutionLevelComboBox.ItemIndex := Ord(Man.ExecutionLevel);
Form.UIAccessCheckBox.Checked := Man.UIAccess;
Form.NameEdit.Text := Man.TextName;
Form.DescEdit.Text := Man.TextDesc;
if Form.ShowModal=mrOk then
begin
Man.DpiAware := TXPManifestDpiAware(Form.DpiAwareComboBox.ItemIndex);
Man.ExecutionLevel := TXPManifestExecutionLevel(Form.ExecutionLevelComboBox.ItemIndex);
Man.UIAccess := Form.UIAccessCheckBox.Checked;
Man.TextName := Form.NameEdit.Text;
Man.TextDesc := Form.DescEdit.Text;
end;
finally
Form.Free;
end;
end;
procedure TProjectApplicationOptionsFrame.SaveIconButtonClick(Sender: TObject);
begin
if SavePictureDialog1.Execute then
IconImage.Picture.SaveToFile(SavePictureDialog1.FileName);
end;
procedure TProjectApplicationOptionsFrame.TextFieldButtonClick(Sender: TObject);
var
Caps, Values: array[0..1] of string;
begin
Caps[0] := lisName;
Caps[1] := lisCodeHelpDescrTag;
Values[0] := FProject.ProjResources.XPManifest.TextName;
Values[1] := FProject.ProjResources.XPManifest.TextDesc;
if InputQuery(TextFieldButton.Caption, Caps, Values) then
begin
FProject.ProjResources.XPManifest.TextName := Values[0];
FProject.ProjResources.XPManifest.TextDesc := Values[1];
end;
end;
procedure TProjectApplicationOptionsFrame.UseXPManifestCheckBoxChange(Sender: TObject);
begin
DpiAwareLabel.Enabled := UseXPManifestCheckBox.Checked;
DpiAwareComboBox.Enabled := UseXPManifestCheckBox.Checked;
ExecutionLevelLabel.Enabled := UseXPManifestCheckBox.Checked;
ExecutionLevelComboBox.Enabled := UseXPManifestCheckBox.Checked;
UIAccessCheckBox.Enabled := UseXPManifestCheckBox.Checked;
TextFieldButton.Enabled := UseXPManifestCheckBox.Checked;
ManifestButton.Enabled := UseXPManifestCheckBox.Checked;
end;
procedure TProjectApplicationOptionsFrame.SetIconFromStream(Value: TStream);
@ -228,10 +222,6 @@ begin
end;
procedure TProjectApplicationOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
var
ExecutionLevel: TXPManifestExecutionLevel;
DpiLevel: TXPManifestDpiAware;
DpiLevelNames: array[TXPManifestDpiAware] of string;
begin
AppSettingsGroupBox.Caption := dlgApplicationSettings;
TitleLabel.Caption := dlgPOTitle;
@ -242,20 +232,8 @@ begin
// Windows specific, Manifest
WindowsDividerBevel.Caption := lisForWindows;
UseXPManifestCheckBox.Caption := dlgPOUseManifest;
DpiAwareLabel.Caption := dlgPODpiAwareness;
DpiLevelNames[xmdaFalse] := dlgPODpiAwarenessOff;
DpiLevelNames[xmdaTrue] := dlgPODpiAwarenessOn;
DpiLevelNames[xmdaPerMonitor] := dlgPODpiAwarenessOldOffNewPerMonitor;
DpiLevelNames[xmdaTruePM] := dlgPODpiAwarenessOldOnNewPerMonitor;
ExecutionLevelLabel.Caption := dlgPOExecutionLevel;
for ExecutionLevel in TXPManifestExecutionLevel do
ExecutionLevelComboBox.Items.Add(ExecutionLevelToCaption[ExecutionLevel]^);
for DpiLevel in TXPManifestDpiAware do
DpiAwareComboBox.Items.Add(DpiLevelNames[DpiLevel] + ' (' + ManifestDpiAwareValues[DpiLevel] + ')');
UIAccessCheckBox.Caption := dlgPOUIAccess;
TextFieldButton.Caption := dlgPOTextFields;
ManifestButton.Caption := dlgPOManifestOptions;
UseXPManifestCheckBoxChange(nil);
// Darwin specific, Application Bundle
DarwinDividerBevel.Caption := lisForDarwin;
@ -292,16 +270,7 @@ begin
with ProjResources.XPManifest do
begin
UseXPManifestCheckBox.Checked := UseManifest;
DpiAwareComboBox.ItemIndex := Ord(DpiAware);
ExecutionLevelComboBox.ItemIndex := Ord(ExecutionLevel);
UIAccessCheckBox.Checked := UIAccess;
end;
DpiAwareLabel.Enabled := UseXPManifestCheckBox.Checked;
DpiAwareComboBox.Enabled := UseXPManifestCheckBox.Checked;
ExecutionLevelLabel.Enabled := UseXPManifestCheckBox.Checked;
ExecutionLevelComboBox.Enabled := UseXPManifestCheckBox.Checked;
UIAccessCheckBox.Enabled := UseXPManifestCheckBox.Checked;
TextFieldButton.Enabled := UseXPManifestCheckBox.Checked;
AStream := TProjectIcon(ProjResources[TProjectIcon]).GetStream;
try
SetIconFromStream(AStream);
@ -332,9 +301,6 @@ begin
with ProjResources.XPManifest do
begin
UseManifest := UseXPManifestCheckBox.Checked;
DpiAware := TXPManifestDpiAware(DpiAwareComboBox.ItemIndex);
ExecutionLevel := TXPManifestExecutionLevel(ExecutionLevelComboBox.ItemIndex);
UIAccess := UIAccessCheckBox.Checked;
end;
end;
end;

View File

@ -2548,6 +2548,7 @@ resourcestring
dlgPOUseAppBundle = 'Use Application Bundle for running and debugging';
dlgPOCreateAppBundle = 'Create Application Bundle';
dlgPOUseManifest = 'Use manifest resource (and enable themes)';
dlgPOManifestOptions = 'Manifest options';
dlgPODpiAwareness = 'DPI awareness';
dlgPODpiAwarenessOff = 'off';
dlgPODpiAwarenessOn = 'on';

149
ide/manifestdialog.lfm Normal file
View File

@ -0,0 +1,149 @@
object ManifestForm: TManifestForm
Left = 554
Height = 212
Top = 512
Width = 568
BorderIcons = [biSystemMenu]
BorderStyle = bsDialog
Caption = 'Manifest'
ClientHeight = 212
ClientWidth = 568
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '1.7'
object DpiAwareLabel: TLabel
AnchorSideTop.Control = DpiAwareComboBox
AnchorSideTop.Side = asrCenter
Left = 8
Height = 17
Top = 15
Width = 103
BorderSpacing.Left = 21
BorderSpacing.Top = 3
Caption = 'DpiAwareLabel'
ParentColor = False
end
object DpiAwareComboBox: TComboBox
AnchorSideLeft.Control = ExecutionLevelLabel
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 176
Height = 31
Top = 8
Width = 381
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 30
BorderSpacing.Top = 3
ItemHeight = 0
Style = csDropDownList
TabOrder = 0
end
object ExecutionLevelLabel: TLabel
AnchorSideTop.Control = ExecutionLevelComboBox
AnchorSideTop.Side = asrCenter
Left = 8
Height = 17
Top = 49
Width = 138
Caption = 'ExecutionLevelLabel'
ParentColor = False
end
object ExecutionLevelComboBox: TComboBox
AnchorSideLeft.Control = DpiAwareComboBox
AnchorSideTop.Control = DpiAwareComboBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = DpiAwareComboBox
AnchorSideRight.Side = asrBottom
Left = 176
Height = 31
Top = 42
Width = 381
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 3
ItemHeight = 0
Style = csDropDownList
TabOrder = 1
end
object UIAccessCheckBox: TCheckBox
AnchorSideTop.Control = ExecutionLevelComboBox
AnchorSideTop.Side = asrBottom
Left = 8
Height = 24
Top = 76
Width = 152
BorderSpacing.Top = 3
Caption = 'UIAccessCheckBox'
TabOrder = 2
end
object ButtonPanel1: TButtonPanel
Left = 6
Height = 29
Top = 177
Width = 556
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton'
HelpButton.DefaultCaption = True
HelpButton.OnClick = HelpButtonClick
CloseButton.Name = 'CloseButton'
CloseButton.DefaultCaption = True
CancelButton.Name = 'CancelButton'
CancelButton.DefaultCaption = True
TabOrder = 5
ShowButtons = [pbOK, pbCancel, pbHelp]
ShowBevel = False
end
object NameLabel: TLabel
AnchorSideLeft.Control = DpiAwareLabel
AnchorSideTop.Control = NameEdit
AnchorSideTop.Side = asrCenter
Left = 8
Height = 17
Top = 108
Width = 77
BorderSpacing.Top = 3
Caption = 'NameLabel'
ParentColor = False
end
object NameEdit: TEdit
AnchorSideLeft.Control = DpiAwareComboBox
AnchorSideTop.Control = UIAccessCheckBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = DpiAwareComboBox
AnchorSideRight.Side = asrBottom
Left = 176
Height = 27
Top = 103
Width = 381
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 3
TabOrder = 3
end
object DescLabel: TLabel
AnchorSideLeft.Control = DpiAwareLabel
AnchorSideTop.Control = DescEdit
AnchorSideTop.Side = asrCenter
Left = 8
Height = 17
Top = 138
Width = 69
BorderSpacing.Top = 3
Caption = 'DescLabel'
ParentColor = False
end
object DescEdit: TEdit
AnchorSideLeft.Control = NameEdit
AnchorSideTop.Control = NameEdit
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = NameEdit
AnchorSideRight.Side = asrBottom
Left = 176
Height = 27
Top = 133
Width = 381
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 3
TabOrder = 4
end
end

86
ide/manifestdialog.pas Normal file
View File

@ -0,0 +1,86 @@
unit ManifestDialog;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ButtonPanel, LazarusIDEStrConsts, W32Manifest, LCLIntf;
type
{ TManifestForm }
TManifestForm = class(TForm)
ButtonPanel1: TButtonPanel;
DpiAwareComboBox: TComboBox;
DpiAwareLabel: TLabel;
DescEdit: TEdit;
DescLabel: TLabel;
NameEdit: TEdit;
ExecutionLevelComboBox: TComboBox;
ExecutionLevelLabel: TLabel;
NameLabel: TLabel;
UIAccessCheckBox: TCheckBox;
procedure FormCreate(Sender: TObject);
procedure HelpButtonClick(Sender: TObject);
private
public
end;
var
ManifestForm: TManifestForm;
implementation
{$R *.lfm}
{ TManifestForm }
procedure TManifestForm.FormCreate(Sender: TObject);
var
DpiLevel: TXPManifestDpiAware;
DpiLevelNames: array[TXPManifestDpiAware] of string;
ExecLevel: TXPManifestExecutionLevel;
ExecLevelNames: array[TXPManifestExecutionLevel] of string;
begin
Caption := dlgPOManifestOptions;
DpiLevelNames[xmdaFalse] := dlgPODpiAwarenessOff;
DpiLevelNames[xmdaTrue] := dlgPODpiAwarenessOn;
DpiLevelNames[xmdaPerMonitor] := dlgPODpiAwarenessOldOffNewPerMonitor;
DpiLevelNames[xmdaTruePM] := dlgPODpiAwarenessOldOnNewPerMonitor;
ExecLevelNames[xmelAsInvoker] := dlgPOAsInvoker;
ExecLevelNames[xmelHighestAvailable] := dlgPOHighestAvailable;
ExecLevelNames[xmelRequireAdministrator] := dlgPORequireAdministrator;
DpiAwareLabel.Caption := dlgPODpiAwareness;
ExecutionLevelLabel.Caption := dlgPOExecutionLevel;
UIAccessCheckBox.Caption := dlgPOUIAccess;
NameLabel.Caption := lisName;
DescLabel.Caption := lisCodeHelpDescrTag;
ExecutionLevelComboBox.Items.Clear;
for ExecLevel in TXPManifestExecutionLevel do
ExecutionLevelComboBox.Items.Add(ExecLevelNames[ExecLevel]);
DpiAwareComboBox.Items.Clear;
for DpiLevel in TXPManifestDpiAware do
DpiAwareComboBox.Items.Add(DpiLevelNames[DpiLevel] + ' (' + ManifestDpiAwareValues[DpiLevel] + ')');
ButtonPanel1.OKButton.Caption := lisOk;
ButtonPanel1.CancelButton.Caption := lisCancel;
ButtonPanel1.HelpButton.Caption := lisHelp;
end;
procedure TManifestForm.HelpButtonClick(Sender: TObject);
begin
OpenURL('http://wiki.lazarus.freepascal.org/IDE_Window:__Project_Options');
end;
end.