IDE: Show current widgetset type in Project options/Config and Target. Issue #26931.

git-svn-id: trunk@46718 -
This commit is contained in:
juha 2014-10-30 19:49:09 +00:00
parent b3f6a86aec
commit 485bb1b4d6
6 changed files with 53 additions and 73 deletions

View File

@ -193,13 +193,13 @@ object CompilerConfigTargetFrame: TCompilerConfigTargetFrame
end end
end end
object LCLWidgetTypeLabel: TLabel object LCLWidgetTypeLabel: TLabel
AnchorSideTop.Control = grbTargetOptions AnchorSideTop.Control = CurrentWidgetTypeLabel
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 3 Left = 16
Height = 15 Height = 20
Top = 292 Top = 350
Width = 122 Width = 140
BorderSpacing.Top = 8 BorderSpacing.Top = 3
Caption = 'LCLWidgetTypeLabel' Caption = 'LCLWidgetTypeLabel'
Font.Color = clBlue Font.Color = clBlue
ParentColor = False ParentColor = False
@ -208,4 +208,15 @@ object CompilerConfigTargetFrame: TCompilerConfigTargetFrame
OnMouseEnter = LCLWidgetTypeLabelMouseEnter OnMouseEnter = LCLWidgetTypeLabelMouseEnter
OnMouseLeave = LCLWidgetTypeLabelMouseLeave OnMouseLeave = LCLWidgetTypeLabelMouseLeave
end end
object CurrentWidgetTypeLabel: TLabel
AnchorSideTop.Control = grbTargetOptions
AnchorSideTop.Side = asrBottom
Left = 3
Height = 20
Top = 327
Width = 165
BorderSpacing.Top = 9
Caption = 'CurrentWidgetTypeLabel'
ParentColor = False
end
end end

View File

@ -29,7 +29,7 @@ interface
uses uses
Classes, SysUtils, strutils, FileUtil, Controls, Dialogs, Graphics, StdCtrls, Classes, SysUtils, strutils, FileUtil, Controls, Dialogs, Graphics, StdCtrls,
LCLProc, DefineTemplates, IDEOptionsIntf, LCLProc, DefineTemplates, IDEOptionsIntf, MacroIntf,
IDEDialogs, CompilerOptions, LazarusIDEStrConsts, IDEDialogs, CompilerOptions, LazarusIDEStrConsts,
TransferMacros, PackageDefs, Project, compiler_parsing_options; TransferMacros, PackageDefs, Project, compiler_parsing_options;
@ -45,6 +45,7 @@ type
grbTargetOptions: TGroupBox; grbTargetOptions: TGroupBox;
grbConfigFile: TGroupBox; grbConfigFile: TGroupBox;
grbTargetPlatform: TGroupBox; grbTargetPlatform: TGroupBox;
CurrentWidgetTypeLabel: TLabel;
lblTargetCPU: TLabel; lblTargetCPU: TLabel;
lblTargetOS: TLabel; lblTargetOS: TLabel;
lblTargetProc: TLabel; lblTargetProc: TLabel;
@ -69,6 +70,7 @@ type
destructor Destroy; override; destructor Destroy; override;
function Check: Boolean; override; function Check: Boolean; override;
function GetTitle: string; override; function GetTitle: string; override;
procedure UpdateWidgetSet(AValue: string = '');
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override; procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
procedure ReadSettings(AOptions: TAbstractIDEOptions); override; procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
procedure WriteSettings(AOptions: TAbstractIDEOptions); override; procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
@ -187,42 +189,46 @@ begin
Result := dlgConfigAndTarget; Result := dlgConfigAndTarget;
end; end;
procedure TCompilerConfigTargetFrame.UpdateByTargetOS(aTargetOS: string); procedure TCompilerConfigTargetFrame.UpdateWidgetSet(AValue: string);
//var DbgMsg: String; // Use the value if it is given. Otherwise read IDE macro LCLWidgetType's value.
// This can be called from ModeMatrix with a new value before it is saved.
begin
if AValue = '' then begin
AValue := '$(LCLWidgetType)';
if not IDEMacros.SubstituteMacros(AValue) then
AValue := '';
end;
CurrentWidgetTypeLabel.Caption := Format(lisCurrentLCLWidgetSet, [AValue]);
end;
procedure TCompilerConfigTargetFrame.UpdateByTargetOS(aTargetOS: string);
begin begin
//DbgMsg := '';
if aTargetOS = '' then if aTargetOS = '' then
begin begin
aTargetOS := '$(TargetOS)'; aTargetOS := '$(TargetOS)';
if not GlobalMacroList.SubstituteStr(aTargetOS) then if not GlobalMacroList.SubstituteStr(aTargetOS) then
raise Exception.CreateFmt('Cannot substitute macro "%s".', [aTargetOS]); raise Exception.CreateFmt('Cannot substitute macro "%s".', [aTargetOS]);
//DbgMsg := ' (got by using $(TargetOS) macro)';
end; end;
//DebugLn(['TCompilerConfigTargetFrame.UpdateTargetSpecific: TargetOS=',aTargetOS,DbgMsg]);
// Now hide/show the whole GroupBox because there is only one setting. // Now hide/show the whole GroupBox because there is only one setting.
grbTargetOptions.Visible := AnsiStartsText('Win', aTargetOS); grbTargetOptions.Visible := AnsiStartsText('Win', aTargetOS);
if grbTargetOptions.Visible then if grbTargetOptions.Visible then
LCLWidgetTypeLabel.AnchorSideTop.Control := grbTargetOptions CurrentWidgetTypeLabel.AnchorSideTop.Control := grbTargetOptions
else else
LCLWidgetTypeLabel.AnchorSideTop.Control := grbTargetPlatform; CurrentWidgetTypeLabel.AnchorSideTop.Control := grbTargetPlatform;
end; end;
procedure TCompilerConfigTargetFrame.UpdateByTargetCPU(aTargetCPU: string); procedure TCompilerConfigTargetFrame.UpdateByTargetCPU(aTargetCPU: string);
var var
//DbgMsg: String;
ParsingFrame: TCompilerParsingOptionsFrame; ParsingFrame: TCompilerParsingOptionsFrame;
sl: TStringList; sl: TStringList;
i: Integer; i: Integer;
begin begin
//DbgMsg := '';
if aTargetCPU = '' then if aTargetCPU = '' then
begin begin
aTargetCPU := '$(TargetCPU)'; aTargetCPU := '$(TargetCPU)';
if not GlobalMacroList.SubstituteStr(aTargetCPU) then if not GlobalMacroList.SubstituteStr(aTargetCPU) then
raise Exception.CreateFmt('Cannot substitute macro "%s".', [aTargetCPU]); raise Exception.CreateFmt('Cannot substitute macro "%s".', [aTargetCPU]);
//DbgMsg := ' (got by using $(TargetCPU) macro)';
end; end;
//DebugLn(['TCompilerConfigTargetFrame.UpdateTargetProcessorList: TargetCPU=',aTargetCPU,DbgMsg]);
// Update selection list for target processor // Update selection list for target processor
sl:=TStringList.Create; sl:=TStringList.Create;
@ -245,7 +251,6 @@ var
s: ShortString; s: ShortString;
begin begin
FDialog := ADialog; FDialog := ADialog;
// Config // Config
grbConfigFile.Caption := dlgConfigFiles; grbConfigFile.Caption := dlgConfigFiles;
chkConfigFile.Caption := dlgUseFpcCfg + ' ('+lisIfNotChecked+' -n)'; chkConfigFile.Caption := dlgUseFpcCfg + ' ('+lisIfNotChecked+' -n)';
@ -273,12 +278,14 @@ begin
ItemIndex := 0; ItemIndex := 0;
end; end;
// Target CPU
lblTargetProc.Caption := dlgTargetProc+' (-Cp)'; lblTargetProc.Caption := dlgTargetProc+' (-Cp)';
LCLWidgetTypeLabel.Caption := lisSelectAnotherLCLWidgetSetMacroLCLWidgetType; // Target-specific options
// Target options
grbTargetOptions.Caption := dlgTargetSpecificOptions; grbTargetOptions.Caption := dlgTargetSpecificOptions;
chkWin32GraphicApp.Caption := dlgWin32GUIApp + ' (-WG)'; chkWin32GraphicApp.Caption := dlgWin32GUIApp + ' (-WG)';
// WidgetSet
UpdateWidgetSet;
LCLWidgetTypeLabel.Caption := lisSelectAnotherLCLWidgetSet;
end; end;
procedure TCompilerConfigTargetFrame.ReadSettings(AOptions: TAbstractIDEOptions); procedure TCompilerConfigTargetFrame.ReadSettings(AOptions: TAbstractIDEOptions);
@ -303,6 +310,7 @@ begin
TargetCPUComboBox.ItemIndex := 0; TargetCPUComboBox.ItemIndex := 0;
TargetCPUComboBox.Text := 'default'; TargetCPUComboBox.Text := 'default';
TargetProcComboBox.Text := 'default'; TargetProcComboBox.Text := 'default';
CurrentWidgetTypeLabel.Visible:=false;
LCLWidgetTypeLabel.Visible:=false; LCLWidgetTypeLabel.Visible:=false;
end else begin end else begin
grbTargetPlatform.Visible:=true; grbTargetPlatform.Visible:=true;
@ -321,6 +329,7 @@ begin
UpdateByTargetOS(TargetOS); UpdateByTargetOS(TargetOS);
TargetProcComboBox.Text := ProcessorToCaption(TargetProcessor); TargetProcComboBox.Text := ProcessorToCaption(TargetProcessor);
PkgDep:=(AOptions as TProjectCompilerOptions).LazProject.FindDependencyByName('LCL'); PkgDep:=(AOptions as TProjectCompilerOptions).LazProject.FindDependencyByName('LCL');
CurrentWidgetTypeLabel.Visible:=Assigned(PkgDep);
LCLWidgetTypeLabel.Visible:=Assigned(PkgDep); LCLWidgetTypeLabel.Visible:=Assigned(PkgDep);
end; end;
chkWin32GraphicApp.Checked := Win32GraphicApp; chkWin32GraphicApp.Checked := Win32GraphicApp;

View File

@ -38,7 +38,7 @@ uses
Classes, SysUtils, types, LazLogger, LazUTF8, Controls, Graphics, ComCtrls, Classes, SysUtils, types, LazLogger, LazUTF8, Controls, Graphics, ComCtrls,
Menus, LCLProc, IDEOptionsIntf, IDEImagesIntf, CompOptsIntf, EnvironmentOpts, Menus, LCLProc, IDEOptionsIntf, IDEImagesIntf, CompOptsIntf, EnvironmentOpts,
PackageSystem, PackageDefs, Project, LazarusIDEStrConsts, TransferMacros, PackageSystem, PackageDefs, Project, LazarusIDEStrConsts, TransferMacros,
ModeMatrixOpts, ModeMatrixCtrl; ModeMatrixOpts, ModeMatrixCtrl, compiler_config_target;
type type
@ -84,6 +84,7 @@ type
procedure OnAddMacroMenuItemClick(Sender: TObject); procedure OnAddMacroMenuItemClick(Sender: TObject);
procedure OnAddLCLWidgetTypeClick(Sender: TObject); procedure OnAddLCLWidgetTypeClick(Sender: TObject);
private private
FDialog: TAbstractOptionsEditorDialog;
FErrorColor: TColor; FErrorColor: TColor;
FGrid: TGroupedMatrixControl; FGrid: TGroupedMatrixControl;
FGroupIDE: TGroupedMatrixGroup; FGroupIDE: TGroupedMatrixGroup;
@ -484,12 +485,17 @@ end;
procedure TCompOptModeMatrixFrame.OnAddLCLWidgetTypeClick(Sender: TObject); procedure TCompOptModeMatrixFrame.OnAddLCLWidgetTypeClick(Sender: TObject);
var var
TargetFrame: TCompilerConfigTargetFrame;
ValueMenuItem: TMenuItem; ValueMenuItem: TMenuItem;
Value: String; Value: String;
begin begin
ValueMenuItem:=Sender as TMenuItem; ValueMenuItem:=Sender as TMenuItem;
Value:=GetCaptionValue(ValueMenuItem.Caption,fCaptionPatternMacroValue); Value:=GetCaptionValue(ValueMenuItem.Caption,fCaptionPatternMacroValue);
CreateNewOption(BuildMatrixOptionTypeCaption(bmotIDEMacro),'LCLWidgetType:='+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));
Assert(Assigned(TargetFrame));
TargetFrame.UpdateWidgetSet(Value);
end; end;
procedure TCompOptModeMatrixFrame.BMMNewCustomOptionMenuItemClick(Sender: TObject); procedure TCompOptModeMatrixFrame.BMMNewCustomOptionMenuItemClick(Sender: TObject);
@ -1171,7 +1177,7 @@ end;
procedure TCompOptModeMatrixFrame.Setup(ADialog: TAbstractOptionsEditorDialog); procedure TCompOptModeMatrixFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
begin begin
//debugln(['TCompOptModeMatrix.Setup ',DbgSName(ADialog)]); FDialog := ADialog;
end; end;
class function TCompOptModeMatrixFrame.SupportedOptionsClass: TAbstractIDEOptionsClass; class function TCompOptModeMatrixFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;

View File

@ -83,22 +83,6 @@ object CompilerPathOptionsFrame: TCompilerPathOptionsFrame
Caption = 'DebugPathLabel' Caption = 'DebugPathLabel'
ParentColor = False ParentColor = False
end end
object LCLWidgetTypeLabel: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = DebugPathEdit
AnchorSideTop.Side = asrBottom
Left = 0
Height = 15
Top = 343
Width = 122
Caption = 'LCLWidgetTypeLabel'
Font.Color = clBlue
ParentColor = False
ParentFont = False
OnClick = LCLWidgetTypeLabelClick
OnMouseEnter = LCLWidgetTypeLabelMouseEnter
OnMouseLeave = LCLWidgetTypeLabelMouseLeave
end
object OtherUnitsEdit: TEdit object OtherUnitsEdit: TEdit
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = OtherUnitsLabel AnchorSideTop.Control = OtherUnitsLabel

View File

@ -19,7 +19,6 @@ type
DebugPathLabel: TLabel; DebugPathLabel: TLabel;
IncludeFilesEdit: TEdit; IncludeFilesEdit: TEdit;
IncludeFilesLabel: TLabel; IncludeFilesLabel: TLabel;
LCLWidgetTypeLabel: TLabel;
LibrariesEdit: TEdit; LibrariesEdit: TEdit;
LibrariesLabel: TLabel; LibrariesLabel: TLabel;
OtherSourcesEdit: TEdit; OtherSourcesEdit: TEdit;
@ -31,9 +30,6 @@ type
ProjTargetFileLabel: TLabel; ProjTargetFileLabel: TLabel;
UnitOutputDirEdit: TEdit; UnitOutputDirEdit: TEdit;
UnitOutputDirLabel: TLabel; UnitOutputDirLabel: TLabel;
procedure LCLWidgetTypeLabelClick(Sender: TObject);
procedure LCLWidgetTypeLabelMouseEnter(Sender: TObject);
procedure LCLWidgetTypeLabelMouseLeave(Sender: TObject);
procedure ProjTargetFileEditChange(Sender: TObject); procedure ProjTargetFileEditChange(Sender: TObject);
private private
FDialog: TAbstractOptionsEditorDialog; FDialog: TAbstractOptionsEditorDialog;
@ -289,25 +285,6 @@ begin
UpdateTargetFileLabel; UpdateTargetFileLabel;
end; end;
procedure TCompilerPathOptionsFrame.LCLWidgetTypeLabelClick(Sender: TObject);
begin
// Make sure the "Additions And Overrides" page is visible, then move there.
FDialog.ResetFilter;
FDialog.OpenEditor(GroupCompiler,CompilerOptionsAdditionsAndOverrides);
end;
procedure TCompilerPathOptionsFrame.LCLWidgetTypeLabelMouseEnter(Sender: TObject);
begin
(Sender as TLabel).Font.Underline := True;
(Sender as TLabel).Font.Color := clRed;
end;
procedure TCompilerPathOptionsFrame.LCLWidgetTypeLabelMouseLeave(Sender: TObject);
begin
(Sender as TLabel).Font.Underline := False;
(Sender as TLabel).Font.Color := clBlue;
end;
function TCompilerPathOptionsFrame.CheckSearchPath(const Context, ExpandedPath: string; function TCompilerPathOptionsFrame.CheckSearchPath(const Context, ExpandedPath: string;
Level: TCheckCompileOptionsMsgLvl): boolean; Level: TCheckCompileOptionsMsgLvl): boolean;
var var
@ -735,8 +712,6 @@ begin
{------------------------------------------------------------} {------------------------------------------------------------}
LCLWidgetTypeLabel.Caption := lisSelectAnotherLCLWidgetSetMacroLCLWidgetType;
// register special buttons in the dialog itself // register special buttons in the dialog itself
btnShowOptions := CreateButton(dlgCOShowOptions); btnShowOptions := CreateButton(dlgCOShowOptions);
btnShowOptions.LoadGlyphFromResourceName(HInstance, 'menu_compiler_options'); btnShowOptions.LoadGlyphFromResourceName(HInstance, 'menu_compiler_options');
@ -771,7 +746,6 @@ end;
procedure TCompilerPathOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); procedure TCompilerPathOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
var var
ProjOpts: TProjectCompilerOptions; ProjOpts: TProjectCompilerOptions;
PkgDep: TPkgDependency;
begin begin
if not (AOptions is TBaseCompilerOptions) then exit; if not (AOptions is TBaseCompilerOptions) then exit;
FCompilerOpts := TBaseCompilerOptions(AOptions); FCompilerOpts := TBaseCompilerOptions(AOptions);
@ -785,15 +759,12 @@ begin
ProjTargetFileEdit.Text:=ProjOpts.TargetFilename; ProjTargetFileEdit.Text:=ProjOpts.TargetFilename;
ProjTargetApplyConventionsCheckBox.Checked:=ProjOpts.TargetFilenameApplyConventions; ProjTargetApplyConventionsCheckBox.Checked:=ProjOpts.TargetFilenameApplyConventions;
ProjTargetApplyConventionsCheckBox.Visible:=true; ProjTargetApplyConventionsCheckBox.Visible:=true;
PkgDep:=ProjOpts.LazProject.FindDependencyByName('LCL');
LCLWidgetTypeLabel.Visible:=Assigned(PkgDep);
UpdateTargetFileLabel; UpdateTargetFileLabel;
end else begin end else begin
FHasProjectCompilerOpts:=False; FHasProjectCompilerOpts:=False;
ProjTargetFileEdit.Visible:=false; ProjTargetFileEdit.Visible:=false;
ProjTargetFileLabel.Visible:=false; ProjTargetFileLabel.Visible:=false;
ProjTargetApplyConventionsCheckBox.Visible:=false; ProjTargetApplyConventionsCheckBox.Visible:=false;
LCLWidgetTypeLabel.Visible:=false;
end; end;
OtherUnitsEdit.Text := FCompilerOpts.OtherUnitFiles; OtherUnitsEdit.Text := FCompilerOpts.OtherUnitFiles;

View File

@ -5460,8 +5460,7 @@ resourcestring
lisCheckTheTargetOSCPULCLWidgetTypeMaybeYouHaveToReco = '%s Check the ' lisCheckTheTargetOSCPULCLWidgetTypeMaybeYouHaveToReco = '%s Check the '
+'target (OS, CPU, LCL widget type). Maybe you have to recompile the ' +'target (OS, CPU, LCL widget type). Maybe you have to recompile the '
+'package for this target or set another target for the project.'; +'package for this target or set another target for the project.';
lisMaybeYouHaveToRecompileThePackage = '%s Maybe you have to recompile the ' lisMaybeYouHaveToRecompileThePackage = '%s Maybe you have to recompile the package.';
+'package.';
lisDuplicatePpuFilesDeleteOneOrMakeSureAllSearchPaths = 'Duplicate ppu ' lisDuplicatePpuFilesDeleteOneOrMakeSureAllSearchPaths = 'Duplicate ppu '
+'files. Delete one or make sure all search paths have correct order (' +'files. Delete one or make sure all search paths have correct order ('
+'Hint: FPC uses last path first).'; +'Hint: FPC uses last path first).';
@ -5470,8 +5469,8 @@ resourcestring
+'uses last path first).'; +'uses last path first).';
lisPEMissingFilesOfPackage = 'Missing files of package %s'; lisPEMissingFilesOfPackage = 'Missing files of package %s';
lisPENoFilesMissingAllFilesExist = 'No files missing. All files exist.'; lisPENoFilesMissingAllFilesExist = 'No files missing. All files exist.';
lisSelectAnotherLCLWidgetSetMacroLCLWidgetType = 'Select another LCL widget ' lisCurrentLCLWidgetSet = 'Current LCL widgetset: "%s"';
+'set (macro LCLWidgetType)'; lisSelectAnotherLCLWidgetSet = 'Select another LCL widgetset (macro LCLWidgetType)';
lisEndlessLoopInMacros = 'Endless loop in macros'; lisEndlessLoopInMacros = 'Endless loop in macros';
// Uses Unit dialog // Uses Unit dialog