IDE: Show Widgetset display name instead of dir name in selection list for project. Issue #40040, patch by theo222.

This commit is contained in:
Juha 2022-12-18 09:49:15 +02:00
parent 43d7f20349
commit c45dfb7a56
2 changed files with 21 additions and 8 deletions

View File

@ -35,18 +35,13 @@ unit Compiler_ModeMatrix;
interface
uses
//Classes, SysUtils, types, LazLoggerBase, LazUTF8, Controls, Graphics, ComCtrls,
//Menus, LCLProc, IDEOptionsIntf, IDEImagesIntf, CompOptsIntf, EnvironmentOpts,
//PackageSystem, PackageDefs, Project, LazarusIDEStrConsts, TransferMacros,
//ModeMatrixOpts, ModeMatrixCtrl, compiler_config_target;
Classes, SysUtils, types,
// LazUtils
LazLoggerBase, LazUTF8,
// LCL
LCLProc, Controls, Graphics, ComCtrls, Menus,
LCLPlatformDef, Controls, Graphics, ComCtrls, Menus,
// IdeIntf
IDEOptionsIntf, IDEOptEditorIntf, IDEImagesIntf, CompOptsIntf,
KeywordFuncLists,
IDEOptionsIntf, IDEOptEditorIntf, IDEImagesIntf, CompOptsIntf, KeywordFuncLists,
// IDE
EnvironmentOpts, PackageSystem, PackageDefs, Project, LazarusIDEStrConsts,
TransferMacros, ModeMatrixOpts, ModeMatrixCtrl, compiler_config_target;
@ -514,6 +509,7 @@ var
begin
ValueMenuItem:=Sender as TMenuItem;
Value:=GetCaptionValue(ValueMenuItem.Caption,fCaptionPatternMacroValue);
Value:=DisplayNameToDirName(Value);
CreateNewOption(BuildMatrixOptionTypeCaption(bmotIDEMacro),'LCLWidgetType:='+Value);
// Update LCLWidgetType to Config and Target page. ToDo: update also when deleting or changing.
TargetFrame := TCompilerConfigTargetFrame(FDialog.FindEditor(TCompilerConfigTargetFrame));
@ -618,7 +614,7 @@ begin
if i=ParentMenu.Items.Count then
ParentMenu.Items.Add(TMenuItem.Create(Self));
ValueMI:=ParentMenu.Items[i];
ValueMI.Caption:=Format(fCaptionPatternMacroValue,[Mcr.Values[i]]);
ValueMI.Caption:=Format(fCaptionPatternMacroValue,[DirNameToDisplayName(Mcr.Values[i])]);
ValueMI.OnClick:=@OnAddLCLWidgetTypeClick;
end;
end;

View File

@ -39,6 +39,8 @@ type
TLCLPlatforms = set of TLCLPlatform;
function DirNameToLCLPlatform(const ADirName: string): TLCLPlatform;
function DirNameToDisplayName(const ADirName: string): String;
function DisplayNameToDirName(const ADisplayName: String): String;
function GetBuildLCLWidgetType: TLCLPlatform;
const
@ -106,6 +108,21 @@ begin
Result:=lpGtk2;
end;
function DirNameToDisplayName(const ADirName: string): String;
begin
Result:=LCLPlatformDisplayNames[DirNameToLCLPlatform(ADirName)];
end;
function DisplayNameToDirName(const ADisplayName: String): String;
var
PlatForm: TLCLPlatform;
begin
for PlatForm:=Low(TLCLPlatform) to High(TLCLPlatform) do
if CompareText(ADisplayName,LCLPlatformDisplayNames[PlatForm])=0 then
exit(LCLPlatformDirNames[PlatForm]);
Result:='gtk2';
end;
function GetBuildLCLWidgetType: TLCLPlatform;
begin
Result:=BuildLCLWidgetType;