From 3913650b87d57e80244362beda2dc0142d2a9919 Mon Sep 17 00:00:00 2001 From: juha Date: Fri, 18 Nov 2016 16:26:28 +0000 Subject: [PATCH] IDE: Add manifest options for Name/Description. Issue #30953, patch from AlexeyT. git-svn-id: trunk@53381 - --- ide/frames/project_application_options.lfm | 36 +++++++++++++++------- ide/frames/project_application_options.pas | 21 +++++++++++++ ide/lazarusidestrconsts.pas | 1 + ide/w32manifest.pas | 33 ++++++++++++++++++-- 4 files changed, 78 insertions(+), 13 deletions(-) diff --git a/ide/frames/project_application_options.lfm b/ide/frames/project_application_options.lfm index 698b42e000..1b193a63a2 100644 --- a/ide/frames/project_application_options.lfm +++ b/ide/frames/project_application_options.lfm @@ -1,21 +1,21 @@ object ProjectApplicationOptionsFrame: TProjectApplicationOptionsFrame Left = 0 - Height = 477 + Height = 550 Top = 0 Width = 487 - ClientHeight = 477 + ClientHeight = 550 ClientWidth = 487 TabOrder = 0 DesignLeft = 392 DesignTop = 251 object AppSettingsGroupBox: TGroupBox Left = 0 - Height = 469 + Height = 501 Top = 0 Width = 487 Align = alTop Caption = 'AppSettingsGroupBox' - ClientHeight = 450 + ClientHeight = 482 ClientWidth = 483 TabOrder = 0 object TitleLabel: TLabel @@ -73,12 +73,12 @@ object ProjectApplicationOptionsFrame: TProjectApplicationOptionsFrame AnchorSideTop.Side = asrBottom Left = 6 Height = 24 - Top = 381 + Top = 413 Width = 191 BorderSpacing.Left = 6 BorderSpacing.Top = 3 Caption = 'UseAppBundleCheckBox' - TabOrder = 11 + TabOrder = 12 end object UseXPManifestCheckBox: TCheckBox AnchorSideLeft.Control = AppSettingsGroupBox @@ -247,11 +247,11 @@ object ProjectApplicationOptionsFrame: TProjectApplicationOptionsFrame ParentFont = False end object DarwinDividerBevel: TDividerBevel - AnchorSideTop.Control = UIAccessCheckBox + AnchorSideTop.Control = TextFieldButton AnchorSideTop.Side = asrBottom - Left = 6 + Left = 8 Height = 17 - Top = 361 + Top = 393 Width = 471 Caption = 'For Darwin' Anchors = [akTop, akLeft, akRight] @@ -265,14 +265,14 @@ object ProjectApplicationOptionsFrame: TProjectApplicationOptionsFrame AnchorSideTop.Side = asrBottom Left = 27 Height = 29 - Top = 411 + Top = 443 Width = 177 AutoSize = True BorderSpacing.Left = 21 BorderSpacing.Top = 6 Caption = 'CreateAppBundleButton' OnClick = CreateAppBundleButtonClick - TabOrder = 12 + TabOrder = 13 end object DpiAwareLabel: TLabel AnchorSideLeft.Control = UseXPManifestCheckBox @@ -305,6 +305,20 @@ object ProjectApplicationOptionsFrame: TProjectApplicationOptionsFrame 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 + AutoSize = True + BorderSpacing.Top = 3 + Caption = 'TextFieldButton' + OnClick = TextFieldButtonClick + TabOrder = 11 + end end object OpenPictureDialog1: TOpenPictureDialog left = 385 diff --git a/ide/frames/project_application_options.pas b/ide/frames/project_application_options.pas index def6c4806e..60c86ed012 100644 --- a/ide/frames/project_application_options.pas +++ b/ide/frames/project_application_options.pas @@ -16,6 +16,7 @@ type TProjectApplicationOptionsFrame = class(TAbstractIDEOptionsEditor) AppSettingsGroupBox: TGroupBox; + TextFieldButton: TButton; CreateAppBundleButton: TBitBtn; DefaultIconButton: TButton; DpiAwareLabel: TLabel; @@ -46,6 +47,7 @@ type procedure IconTrackChange(Sender: TObject); procedure LoadIconButtonClick(Sender: TObject); procedure SaveIconButtonClick(Sender: TObject); + procedure TextFieldButtonClick(Sender: TObject); procedure UseXPManifestCheckBoxChange(Sender: TObject); private FProject: TProject; @@ -171,6 +173,22 @@ begin 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; @@ -178,6 +196,7 @@ begin ExecutionLevelLabel.Enabled := UseXPManifestCheckBox.Checked; ExecutionLevelComboBox.Enabled := UseXPManifestCheckBox.Checked; UIAccessCheckBox.Enabled := UseXPManifestCheckBox.Checked; + TextFieldButton.Enabled := UseXPManifestCheckBox.Checked; end; procedure TProjectApplicationOptionsFrame.SetIconFromStream(Value: TStream); @@ -236,6 +255,7 @@ begin for DpiLevel in TXPManifestDpiAware do DpiAwareComboBox.Items.Add(DpiLevelNames[DpiLevel] + ' (' + ManifestDpiAwareValues[DpiLevel] + ')'); UIAccessCheckBox.Caption := dlgPOUIAccess; + TextFieldButton.Caption := dlgPOTextFields; // Darwin specific, Application Bundle DarwinDividerBevel.Caption := lisForDarwin; @@ -281,6 +301,7 @@ begin ExecutionLevelLabel.Enabled := UseXPManifestCheckBox.Checked; ExecutionLevelComboBox.Enabled := UseXPManifestCheckBox.Checked; UIAccessCheckBox.Enabled := UseXPManifestCheckBox.Checked; + TextFieldButton.Enabled := UseXPManifestCheckBox.Checked; AStream := TProjectIcon(ProjResources[TProjectIcon]).GetStream; try SetIconFromStream(AStream); diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 2fd64c93bd..d48577426f 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -2554,6 +2554,7 @@ resourcestring dlgPODpiAwarenessOldOffNewPerMonitor = 'Vista-8: off, 8.1+: per monitor'; dlgPODpiAwarenessOldOnNewPerMonitor = 'Vista-8: on, 8.1+: per monitor'; dlgPOUIAccess = 'UI Access (uiAccess)'; + dlgPOTextFields = 'Text fields'; dlgPOAsInvoker = 'as invoker (asInvoker)'; dlgPOHighestAvailable = 'highest available (highestAvailable)'; dlgPORequireAdministrator = 'require administrator (requireAdministrator)'; diff --git a/ide/w32manifest.pas b/ide/w32manifest.pas index ca257f36f3..4340b2f35e 100644 --- a/ide/w32manifest.pas +++ b/ide/w32manifest.pas @@ -64,10 +64,14 @@ type FDpiAware: TXPManifestDpiAware; FUIAccess: Boolean; FUseManifest: boolean; + FTextName: string; + FTextDesc: string; procedure SetDpiAware(AValue: TXPManifestDpiAware); procedure SetExecutionLevel(AValue: TXPManifestExecutionLevel); procedure SetUIAccess(AValue: Boolean); procedure SetUseManifest(const AValue: boolean); + procedure SetTextName(const AValue: string); + procedure SetTextDesc(const AValue: string); public constructor Create; override; function UpdateResources(AResources: TAbstractProjectResources; const {%H-}MainFilename: string): Boolean; override; @@ -78,6 +82,8 @@ type property DpiAware: TXPManifestDpiAware read FDpiAware write SetDpiAware; property ExecutionLevel: TXPManifestExecutionLevel read FExecutionLevel write SetExecutionLevel; property UIAccess: Boolean read FUIAccess write SetUIAccess; + property TextName: string read FTextName write SetTextName; + property TextDesc: string read FTextDesc write SetTextDesc; end; const @@ -100,8 +106,8 @@ const sManifestFileData: String = ''#$D#$A+ ''#$D#$A+ - ' '#$D#$A+ - ' Your application description here.'#$D#$A+ + ' '#$D#$A+ + ' %s'#$D#$A+ ' '#$D#$A+ ' '#$D#$A+ ' '#$D#$A+ @@ -170,6 +176,20 @@ begin Modified := True; end; +procedure TProjectXPManifest.SetTextDesc(const AValue: string); +begin + if FTextDesc = AValue then Exit; + FTextDesc := AValue; + Modified := True; +end; + +procedure TProjectXPManifest.SetTextName(const AValue: string); +begin + if FTextName = AValue then Exit; + FTextName := AValue; + Modified := True; +end; + procedure TProjectXPManifest.SetUIAccess(AValue: Boolean); begin if FUIAccess = AValue then Exit; @@ -185,6 +205,8 @@ begin DpiAware := xmdaFalse; ExecutionLevel := xmelAsInvoker; UIAccess := False; + TextName := 'CompanyName.ProductName.AppName'; + TextDesc := 'Your application description.'; end; function TProjectXPManifest.UpdateResources(AResources: TAbstractProjectResources; @@ -203,6 +225,8 @@ begin RType.Free; //no longer needed RName.Free; ManifestFileData := Format(sManifestFileData, [ + TextName, + TextDesc, ExecutionLevelToStr[ExecutionLevel], BoolToStr(UIAccess, 'true', 'false'), ManifestDpiAwareValues[DpiAware]]); @@ -218,6 +242,8 @@ begin TXMLConfig(AConfig).SetDeleteValue(Path+'General/XPManifest/DpiAware/Value', ManifestDpiAwareValues[DpiAware], ManifestDpiAwareValues[xmdaFalse]); TXMLConfig(AConfig).SetDeleteValue(Path+'General/XPManifest/ExecutionLevel/Value', ExecutionLevelToStr[ExecutionLevel], ExecutionLevelToStr[xmelAsInvoker]); TXMLConfig(AConfig).SetDeleteValue(Path+'General/XPManifest/UIAccess/Value', UIAccess, False); + TXMLConfig(AConfig).SetDeleteValue(Path+'General/XPManifest/TextName/Value', TextName, ''); + TXMLConfig(AConfig).SetDeleteValue(Path+'General/XPManifest/TextDesc/Value', TextDesc, ''); end; procedure TProjectXPManifest.ReadFromProjectFile(AConfig: TObject; @@ -242,7 +268,10 @@ begin ExecutionLevel := TXPManifestExecutionLevel(Cfg.GetValue(Path+'General/XPManifest/ExecutionLevel/Value', 0)) else ExecutionLevel := StrToXPManifestExecutionLevel(Cfg.GetValue(Path+'General/XPManifest/ExecutionLevel/Value', '')); + UIAccess := Cfg.GetValue(Path+'General/XPManifest/UIAccess/Value', False); + TextName := Cfg.GetValue(Path+'General/XPManifest/TextName/Value', TextName); + TextDesc := Cfg.GetValue(Path+'General/XPManifest/TextDesc/Value', TextDesc); end; initialization