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
object LCLWidgetTypeLabel: TLabel
AnchorSideTop.Control = grbTargetOptions
AnchorSideTop.Control = CurrentWidgetTypeLabel
AnchorSideTop.Side = asrBottom
Left = 3
Height = 15
Top = 292
Width = 122
BorderSpacing.Top = 8
Left = 16
Height = 20
Top = 350
Width = 140
BorderSpacing.Top = 3
Caption = 'LCLWidgetTypeLabel'
Font.Color = clBlue
ParentColor = False
@ -208,4 +208,15 @@ object CompilerConfigTargetFrame: TCompilerConfigTargetFrame
OnMouseEnter = LCLWidgetTypeLabelMouseEnter
OnMouseLeave = LCLWidgetTypeLabelMouseLeave
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

View File

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

View File

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

View File

@ -83,22 +83,6 @@ object CompilerPathOptionsFrame: TCompilerPathOptionsFrame
Caption = 'DebugPathLabel'
ParentColor = False
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
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = OtherUnitsLabel

View File

@ -19,7 +19,6 @@ type
DebugPathLabel: TLabel;
IncludeFilesEdit: TEdit;
IncludeFilesLabel: TLabel;
LCLWidgetTypeLabel: TLabel;
LibrariesEdit: TEdit;
LibrariesLabel: TLabel;
OtherSourcesEdit: TEdit;
@ -31,9 +30,6 @@ type
ProjTargetFileLabel: TLabel;
UnitOutputDirEdit: TEdit;
UnitOutputDirLabel: TLabel;
procedure LCLWidgetTypeLabelClick(Sender: TObject);
procedure LCLWidgetTypeLabelMouseEnter(Sender: TObject);
procedure LCLWidgetTypeLabelMouseLeave(Sender: TObject);
procedure ProjTargetFileEditChange(Sender: TObject);
private
FDialog: TAbstractOptionsEditorDialog;
@ -289,25 +285,6 @@ begin
UpdateTargetFileLabel;
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;
Level: TCheckCompileOptionsMsgLvl): boolean;
var
@ -735,8 +712,6 @@ begin
{------------------------------------------------------------}
LCLWidgetTypeLabel.Caption := lisSelectAnotherLCLWidgetSetMacroLCLWidgetType;
// register special buttons in the dialog itself
btnShowOptions := CreateButton(dlgCOShowOptions);
btnShowOptions.LoadGlyphFromResourceName(HInstance, 'menu_compiler_options');
@ -771,7 +746,6 @@ end;
procedure TCompilerPathOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
var
ProjOpts: TProjectCompilerOptions;
PkgDep: TPkgDependency;
begin
if not (AOptions is TBaseCompilerOptions) then exit;
FCompilerOpts := TBaseCompilerOptions(AOptions);
@ -785,15 +759,12 @@ begin
ProjTargetFileEdit.Text:=ProjOpts.TargetFilename;
ProjTargetApplyConventionsCheckBox.Checked:=ProjOpts.TargetFilenameApplyConventions;
ProjTargetApplyConventionsCheckBox.Visible:=true;
PkgDep:=ProjOpts.LazProject.FindDependencyByName('LCL');
LCLWidgetTypeLabel.Visible:=Assigned(PkgDep);
UpdateTargetFileLabel;
end else begin
FHasProjectCompilerOpts:=False;
ProjTargetFileEdit.Visible:=false;
ProjTargetFileLabel.Visible:=false;
ProjTargetApplyConventionsCheckBox.Visible:=false;
LCLWidgetTypeLabel.Visible:=false;
end;
OtherUnitsEdit.Text := FCompilerOpts.OtherUnitFiles;

View File

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