mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-05 02:58:09 +01:00
IDE: Change logic updating Application.Title and .Scaled in main source. Don't delete them when user option is off. Check for LCL app.
git-svn-id: trunk@62669 -
This commit is contained in:
parent
5f31268a52
commit
7d6d05a0bf
@ -305,7 +305,10 @@ begin
|
|||||||
with FProject do
|
with FProject do
|
||||||
begin
|
begin
|
||||||
TitleEdit.Text := Title;
|
TitleEdit.Text := Title;
|
||||||
UseLCLScalingCheckBox.Checked := Scaled;
|
if TProjectIDEOptions(AOptions).LclApp then
|
||||||
|
UseLCLScalingCheckBox.Checked := Scaled
|
||||||
|
else
|
||||||
|
UseLCLScalingCheckBox.Enabled := False; // Disable for a console program.
|
||||||
UseAppBundleCheckBox.Checked := UseAppBundle;
|
UseAppBundleCheckBox.Checked := UseAppBundle;
|
||||||
// Manifest
|
// Manifest
|
||||||
with ProjResources.XPManifest do
|
with ProjResources.XPManifest do
|
||||||
|
|||||||
@ -63,11 +63,12 @@ begin
|
|||||||
MainUnitIsPascalSourceCheckBox.Hint := lisMainUnitIsPascalSourceHint;
|
MainUnitIsPascalSourceCheckBox.Hint := lisMainUnitIsPascalSourceHint;
|
||||||
MainUnitHasUsesSectionForAllUnitsCheckBox.Caption := lisMainUnitHasUsesSectionContainingAllUnitsOfProject;
|
MainUnitHasUsesSectionForAllUnitsCheckBox.Caption := lisMainUnitHasUsesSectionContainingAllUnitsOfProject;
|
||||||
MainUnitHasUsesSectionForAllUnitsCheckBox.Hint := lisNewUnitsAreAddedToUsesSections;
|
MainUnitHasUsesSectionForAllUnitsCheckBox.Hint := lisNewUnitsAreAddedToUsesSections;
|
||||||
MainUnitHasCreateFormStatementsCheckBox.Caption := lisMainUnitHasApplicationCreateFormStatements;
|
MainUnitHasCreateFormStatementsCheckBox.Caption := lisUpdateApplicationCreateForm;
|
||||||
MainUnitHasCreateFormStatementsCheckBox.Hint := lisUsedForAutoCreatedForms;
|
MainUnitHasCreateFormStatementsCheckBox.Hint := lisUsedForAutoCreatedForms;
|
||||||
MainUnitHasTitleStatementCheckBox.Caption := lisMainUnitHasApplicationTitleStatement;
|
MainUnitHasTitleStatementCheckBox.Caption := lisUpdateApplicationTitleStatement;
|
||||||
MainUnitHasTitleStatementCheckBox.Hint := lisIdeMaintainsTheTitleInMainUnit;
|
MainUnitHasTitleStatementCheckBox.Hint := lisIdeMaintainsTheTitleInMainUnit;
|
||||||
MainUnitHasScaledStatementCheckBox.Caption := lisMainUnitHasApplicationScaledStatement;
|
MainUnitHasScaledStatementCheckBox.Caption := lisUpdateApplicationScaledStatement;
|
||||||
|
|
||||||
MainUnitHasScaledStatementCheckBox.Hint := lisIdeMaintainsScaledInMainUnit;
|
MainUnitHasScaledStatementCheckBox.Hint := lisIdeMaintainsScaledInMainUnit;
|
||||||
CompatibilityModeCheckBox.Caption := lisLPICompatibilityModeCheckBox;
|
CompatibilityModeCheckBox.Caption := lisLPICompatibilityModeCheckBox;
|
||||||
CompatibilityModeCheckBox.Hint := lisLPICompatibilityModeCheckBoxHint;
|
CompatibilityModeCheckBox.Hint := lisLPICompatibilityModeCheckBoxHint;
|
||||||
@ -96,9 +97,16 @@ begin
|
|||||||
begin
|
begin
|
||||||
MainUnitIsPascalSourceCheckBox.Checked := (pfMainUnitIsPascalSource in Flags);
|
MainUnitIsPascalSourceCheckBox.Checked := (pfMainUnitIsPascalSource in Flags);
|
||||||
MainUnitHasUsesSectionForAllUnitsCheckBox.Checked := (pfMainUnitHasUsesSectionForAllUnits in Flags);
|
MainUnitHasUsesSectionForAllUnitsCheckBox.Checked := (pfMainUnitHasUsesSectionForAllUnits in Flags);
|
||||||
MainUnitHasCreateFormStatementsCheckBox.Checked := (pfMainUnitHasCreateFormStatements in Flags);
|
if TProjectIDEOptions(AOptions).LclApp then begin
|
||||||
MainUnitHasTitleStatementCheckBox.Checked := (pfMainUnitHasTitleStatement in Flags);
|
MainUnitHasCreateFormStatementsCheckBox.Checked := (pfMainUnitHasCreateFormStatements in Flags);
|
||||||
MainUnitHasScaledStatementCheckBox.Checked := (pfMainUnitHasScaledStatement in Flags);
|
MainUnitHasTitleStatementCheckBox.Checked := (pfMainUnitHasTitleStatement in Flags);
|
||||||
|
MainUnitHasScaledStatementCheckBox.Checked := (pfMainUnitHasScaledStatement in Flags);
|
||||||
|
end
|
||||||
|
else begin // Disable these for a console program.
|
||||||
|
MainUnitHasCreateFormStatementsCheckBox.Enabled := False;
|
||||||
|
MainUnitHasTitleStatementCheckBox.Enabled := False;
|
||||||
|
MainUnitHasScaledStatementCheckBox.Enabled := False;
|
||||||
|
end;
|
||||||
CompatibilityModeCheckBox.Checked := (pfCompatibilityMode in Flags);
|
CompatibilityModeCheckBox.Checked := (pfCompatibilityMode in Flags);
|
||||||
RunnableCheckBox.Checked := (pfRunnable in Flags);
|
RunnableCheckBox.Checked := (pfRunnable in Flags);
|
||||||
UseDesignTimePkgsCheckBox.Checked := (pfUseDesignTimePackages in Flags);
|
UseDesignTimePkgsCheckBox.Checked := (pfUseDesignTimePackages in Flags);
|
||||||
|
|||||||
@ -2755,11 +2755,11 @@ resourcestring
|
|||||||
lisMainUnitIsPascalSourceHint = 'Assume Pascal even if it does not end with .pas/.pp suffix.';
|
lisMainUnitIsPascalSourceHint = 'Assume Pascal even if it does not end with .pas/.pp suffix.';
|
||||||
lisMainUnitHasUsesSectionContainingAllUnitsOfProject = 'Main unit has Uses '
|
lisMainUnitHasUsesSectionContainingAllUnitsOfProject = 'Main unit has Uses '
|
||||||
+'section containing all units of project';
|
+'section containing all units of project';
|
||||||
lisMainUnitHasApplicationCreateFormStatements = 'Main unit has Application.CreateForm statements';
|
lisUpdateApplicationCreateForm = 'Update Application.CreateForm statements in main unit';
|
||||||
lisUsedForAutoCreatedForms = 'Used for auto-created forms.';
|
lisUsedForAutoCreatedForms = 'Used for auto-created forms.';
|
||||||
lisMainUnitHasApplicationTitleStatement = 'Main unit has Application.Title statement';
|
lisUpdateApplicationTitleStatement = 'Update Application.Title statement in main unit';
|
||||||
lisIdeMaintainsTheTitleInMainUnit = 'The IDE maintains the title in main unit.';
|
lisIdeMaintainsTheTitleInMainUnit = 'The IDE maintains the title in main unit.';
|
||||||
lisMainUnitHasApplicationScaledStatement = 'Main unit has Application.Scaled statement';
|
lisUpdateApplicationScaledStatement = 'Update Application.Scaled statement in main unit';
|
||||||
lisIdeMaintainsScaledInMainUnit = 'The IDE maintains Application.Scaled (Hi-DPI) in main unit.';
|
lisIdeMaintainsScaledInMainUnit = 'The IDE maintains Application.Scaled (Hi-DPI) in main unit.';
|
||||||
lisLPICompatibilityModeCheckBox = 'Maximize compatibility of project files (LPI and LPS)';
|
lisLPICompatibilityModeCheckBox = 'Maximize compatibility of project files (LPI and LPS)';
|
||||||
lisLPICompatibilityModeCheckBoxHint = 'Check this if you want to open your project in legacy (2.0 and older) Lazarus versions.';
|
lisLPICompatibilityModeCheckBoxHint = 'Check this if you want to open your project in legacy (2.0 and older) Lazarus versions.';
|
||||||
|
|||||||
40
ide/main.pp
40
ide/main.pp
@ -5212,32 +5212,29 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.ProjectOptionsBeforeRead(Sender: TObject);
|
procedure TMainIDE.ProjectOptionsBeforeRead(Sender: TObject);
|
||||||
var
|
//var
|
||||||
ActiveSrcEdit: TSourceEditor;
|
// ActiveSrcEdit: TSourceEditor;
|
||||||
ActiveUnitInfo: TUnitInfo;
|
// ActiveUnitInfo: TUnitInfo;
|
||||||
AProject: TProject;
|
|
||||||
begin
|
begin
|
||||||
//debugln(['TMainIDE.DoProjectOptionsBeforeRead ',DbgSName(Sender)]);
|
//DebugLn(['TMainIDE.DoProjectOptionsBeforeRead ',DbgSName(Sender)]);
|
||||||
if not (Sender is TProjectIDEOptions) then exit;
|
if not (Sender is TProjectIDEOptions) then exit;
|
||||||
ActiveSrcEdit:=nil;
|
Assert(Assigned(TProjectIDEOptions(Sender).Project), 'TMainIDE.ProjectOptionsBeforeRead: Project=Nil.');
|
||||||
BeginCodeTool(ActiveSrcEdit, ActiveUnitInfo, []);
|
//ActiveSrcEdit:=nil;
|
||||||
AProject:=TProjectIDEOptions(Sender).Project;
|
//BeginCodeTool(ActiveSrcEdit, ActiveUnitInfo, []);
|
||||||
AProject.BackupSession;
|
Project1.BackupSession;
|
||||||
AProject.BackupBuildModes;
|
Project1.BackupBuildModes;
|
||||||
AProject.UpdateExecutableType;
|
Project1.UpdateExecutableType;
|
||||||
AProject.UseAsDefault := False;
|
Project1.UseAsDefault := False;
|
||||||
|
TProjectIDEOptions(Sender).CheckLclApp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.ProjectOptionsAfterWrite(Sender: TObject; Restore: boolean);
|
procedure TMainIDE.ProjectOptionsAfterWrite(Sender: TObject; Restore: boolean);
|
||||||
var
|
var
|
||||||
aProject: TProject;
|
|
||||||
aFilename: String;
|
aFilename: String;
|
||||||
begin
|
begin
|
||||||
//debugln(['TMainIDE.ProjectOptionsAfterWrite ',DbgSName(Sender),' Restore=',Restore]);
|
//debugln(['TMainIDE.ProjectOptionsAfterWrite ',DbgSName(Sender),' Restore=',Restore]);
|
||||||
if not (Sender is TProjectIDEOptions) then exit;
|
if not (Sender is TProjectIDEOptions) then exit;
|
||||||
aProject:=TProjectIDEOptions(Sender).Project;
|
Assert(Assigned(TProjectIDEOptions(Sender).Project), 'TMainIDE.ProjectOptionsAfterWrite: Project=Nil.');
|
||||||
Assert(Assigned(aProject), 'TMainIDE.ProjectOptionsAfterWrite: Project=Nil.');
|
|
||||||
Assert(aProject=Project1, 'TMainIDE.ProjectOptionsAfterWrite: Project<>Project1.');
|
|
||||||
if Restore then
|
if Restore then
|
||||||
begin
|
begin
|
||||||
Project1.RestoreBuildModes;
|
Project1.RestoreBuildModes;
|
||||||
@ -5246,9 +5243,12 @@ begin
|
|||||||
else begin
|
else begin
|
||||||
if Project1.MainUnitID >= 0 then
|
if Project1.MainUnitID >= 0 then
|
||||||
begin
|
begin
|
||||||
UpdateAppTitleInSource;
|
if TProjectIDEOptions(Sender).LclApp then
|
||||||
UpdateAppScaledInSource;
|
begin
|
||||||
UpdateAppAutoCreateForms;
|
UpdateAppTitleInSource;
|
||||||
|
UpdateAppScaledInSource;
|
||||||
|
UpdateAppAutoCreateForms;
|
||||||
|
end;
|
||||||
Project1.AutoAddOutputDirToIncPath; // extend include path
|
Project1.AutoAddOutputDirToIncPath; // extend include path
|
||||||
if Project1.ProjResources.Modified then
|
if Project1.ProjResources.Modified then
|
||||||
if not Project1.ProjResources.Regenerate(Project1.MainFilename, True, False, '') then
|
if not Project1.ProjResources.Regenerate(Project1.MainFilename, True, False, '') then
|
||||||
@ -6414,7 +6414,7 @@ begin
|
|||||||
{$pop}
|
{$pop}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoSaveProject(Flags: TSaveFlags):TModalResult;
|
function TMainIDE.DoSaveProject(Flags: TSaveFlags): TModalResult;
|
||||||
begin
|
begin
|
||||||
Result:=SaveProject(Flags);
|
Result:=SaveProject(Flags);
|
||||||
end;
|
end;
|
||||||
|
|||||||
@ -52,7 +52,7 @@ uses
|
|||||||
LCLProc, Forms, Controls, Dialogs,
|
LCLProc, Forms, Controls, Dialogs,
|
||||||
// CodeTools
|
// CodeTools
|
||||||
CodeToolsConfig, ExprEval, DefineTemplates, BasicCodeTools, CodeToolsCfgScript,
|
CodeToolsConfig, ExprEval, DefineTemplates, BasicCodeTools, CodeToolsCfgScript,
|
||||||
LinkScanner, CodeToolManager, CodeCache, FileProcs,
|
LinkScanner, CodeToolManager, CodeCache, CodeTree, FileProcs,
|
||||||
// LazUtils
|
// LazUtils
|
||||||
FPCAdds, LazUtilities, FileUtil, LazFileUtils, LazFileCache, LazMethodList,
|
FPCAdds, LazUtilities, FileUtil, LazFileUtils, LazFileCache, LazMethodList,
|
||||||
LazLoggerBase, LazUTF8, Laz2_XMLCfg, Maps,
|
LazLoggerBase, LazUTF8, Laz2_XMLCfg, Maps,
|
||||||
@ -676,13 +676,16 @@ type
|
|||||||
TProjectIDEOptions = class(TAbstractIDEProjectOptions)
|
TProjectIDEOptions = class(TAbstractIDEProjectOptions)
|
||||||
private
|
private
|
||||||
FProject: TProject;
|
FProject: TProject;
|
||||||
|
FLclApp: Boolean;
|
||||||
public
|
public
|
||||||
constructor Create(AProject: TProject);
|
constructor Create(AProject: TProject);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function GetProject: TLazProject; override;
|
function GetProject: TLazProject; override;
|
||||||
|
function CheckLclApp: Boolean;
|
||||||
class function GetInstance: TAbstractIDEOptions; override;
|
class function GetInstance: TAbstractIDEOptions; override;
|
||||||
class function GetGroupCaption: string; override;
|
class function GetGroupCaption: string; override;
|
||||||
property Project: TProject read FProject;
|
property Project: TProject read FProject;
|
||||||
|
property LclApp: Boolean read FLclApp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TProject }
|
{ TProject }
|
||||||
@ -885,10 +888,10 @@ type
|
|||||||
function NeedsDefineTemplates: boolean;
|
function NeedsDefineTemplates: boolean;
|
||||||
procedure BeginRevertUnit(AnUnitInfo: TUnitInfo);
|
procedure BeginRevertUnit(AnUnitInfo: TUnitInfo);
|
||||||
procedure EndRevertUnit(AnUnitInfo: TUnitInfo);
|
procedure EndRevertUnit(AnUnitInfo: TUnitInfo);
|
||||||
|
function IsLclApplication: Boolean;
|
||||||
function IsReverting(AnUnitInfo: TUnitInfo): boolean;
|
function IsReverting(AnUnitInfo: TUnitInfo): boolean;
|
||||||
|
|
||||||
// load/save
|
|
||||||
function IsVirtual: boolean; override;
|
function IsVirtual: boolean; override;
|
||||||
|
// load/save
|
||||||
function SomethingModified(CheckData, CheckSession: boolean; Verbose: boolean = false): boolean;
|
function SomethingModified(CheckData, CheckSession: boolean; Verbose: boolean = false): boolean;
|
||||||
function SomeDataModified(Verbose: boolean = false): boolean;
|
function SomeDataModified(Verbose: boolean = false): boolean;
|
||||||
function SomeSessionModified(Verbose: boolean = false): boolean;
|
function SomeSessionModified(Verbose: boolean = false): boolean;
|
||||||
@ -2658,7 +2661,13 @@ end;
|
|||||||
|
|
||||||
function TProjectIDEOptions.GetProject: TLazProject;
|
function TProjectIDEOptions.GetProject: TLazProject;
|
||||||
begin
|
begin
|
||||||
Result:=FProject;
|
Result := FProject;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TProjectIDEOptions.CheckLclApp: Boolean;
|
||||||
|
begin
|
||||||
|
FLclApp := FProject.IsLclApplication;
|
||||||
|
Result := FLclApp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TProjectIDEOptions.GetInstance: TAbstractIDEOptions;
|
class function TProjectIDEOptions.GetInstance: TAbstractIDEOptions;
|
||||||
@ -4139,6 +4148,31 @@ begin
|
|||||||
Result:=CodeBuf.Filename;
|
Result:=CodeBuf.Filename;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TProject.IsLclApplication: Boolean;
|
||||||
|
var
|
||||||
|
CodeTool: TCodeTool;
|
||||||
|
UsesNode: TCodeTreeNode;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
// LCL dependency must be there.
|
||||||
|
if FindDependencyByName('LCL') = Nil then Exit;
|
||||||
|
//DebugLn(['IsLclApplication: Found LCL dependency.']);
|
||||||
|
try
|
||||||
|
// Check is uses section has "Forms" unit.
|
||||||
|
if not CodeToolBoss.InitCurCodeTool(MainUnitInfo.Source) then Exit;
|
||||||
|
CodeTool := CodeToolBoss.CurCodeTool;
|
||||||
|
CodeTool.BuildTree(lsrMainUsesSectionEnd);
|
||||||
|
UsesNode := CodeTool.FindMainUsesNode;
|
||||||
|
if UsesNode = Nil then Exit;
|
||||||
|
//DebugLn(['IsLclApplication: Found "uses" node.']);
|
||||||
|
if CodeTool.FindNameInUsesSection(UsesNode, 'forms') = Nil then Exit;
|
||||||
|
//DebugLn(['IsLclApplication: Found "Forms" unit.']);
|
||||||
|
Result := True;
|
||||||
|
except
|
||||||
|
DebugLn(['IsLclApplication: Codetools could not parse the source.']);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TProject.IsVirtual: boolean;
|
function TProject.IsVirtual: boolean;
|
||||||
begin
|
begin
|
||||||
Result:=((MainUnitID>=0) and MainUnitInfo.IsVirtual)
|
Result:=((MainUnitID>=0) and MainUnitInfo.IsVirtual)
|
||||||
|
|||||||
@ -45,7 +45,7 @@ uses
|
|||||||
// LazUtils
|
// LazUtils
|
||||||
LazFileUtils, LazUTF8, Laz2_XMLCfg,
|
LazFileUtils, LazUTF8, Laz2_XMLCfg,
|
||||||
// IdeIntf
|
// IdeIntf
|
||||||
ProjectIntf, LazIDEIntf,
|
ProjectIntf,
|
||||||
// IDE
|
// IDE
|
||||||
PublishModule;
|
PublishModule;
|
||||||
|
|
||||||
|
|||||||
@ -4314,73 +4314,51 @@ end;
|
|||||||
|
|
||||||
function UpdateAppTitleInSource: Boolean;
|
function UpdateAppTitleInSource: Boolean;
|
||||||
var
|
var
|
||||||
TitleStat, ProjTitle: String;
|
TitleProject, ErrMsg: String;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
TitleStat := '';
|
if not (pfMainUnitHasTitleStatement in Project1.Flags) then Exit;
|
||||||
CodeToolBoss.GetApplicationTitleStatement(Project1.MainUnitInfo.Source, TitleStat);
|
TitleProject := Project1.GetTitle;
|
||||||
ProjTitle:=Project1.GetTitle;
|
//DebugLn(['UpdateAppTitleInSource: Project title=',TitleProject,', Default=',Project1.GetDefaultTitle]);
|
||||||
//DebugLn(['UpdateAppTitleInSource: Project title=',ProjTitle,
|
if (TitleProject <> Project1.GetDefaultTitle) then
|
||||||
// ', Default=',Project1.GetDefaultTitle,', Title Statement=',TitleStat]);
|
begin // Add or update Title statement.
|
||||||
if pfMainUnitHasTitleStatement in Project1.Flags then
|
//DebugLn(['UpdateAppTitleInSource: Setting Title to ',TitleProject]);
|
||||||
begin // Add Title statement if not there already.
|
Result := CodeToolBoss.SetApplicationTitleStatement(Project1.MainUnitInfo.Source, TitleProject);
|
||||||
if ((TitleStat = '') or (TitleStat = ProjTitle)) and Project1.TitleIsDefault then
|
ErrMsg := lisUnableToChangeProjectTitleInSource; // Used in case of error.
|
||||||
Exit;
|
|
||||||
//DebugLn(['UpdateAppTitleInSource: Setting Title to ',ProjTitle]);
|
|
||||||
if not CodeToolBoss.SetApplicationTitleStatement(Project1.MainUnitInfo.Source, ProjTitle) then
|
|
||||||
begin
|
|
||||||
IDEMessageDialog(lisProjOptsError,
|
|
||||||
Format(lisUnableToChangeProjectTitleInSource, [LineEnding, CodeToolBoss.ErrorMessage]),
|
|
||||||
mtWarning, [mbOk]);
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end
|
end
|
||||||
else begin // Remove Title statement if it is there.
|
else begin // Remove Title statement if it's not needed.
|
||||||
if TitleStat <> ProjTitle then
|
|
||||||
Exit;
|
|
||||||
//DebugLn(['UpdateAppTitleInSource: Removing Title']);
|
//DebugLn(['UpdateAppTitleInSource: Removing Title']);
|
||||||
if not CodeToolBoss.RemoveApplicationTitleStatement(Project1.MainUnitInfo.Source) then
|
Result := CodeToolBoss.RemoveApplicationTitleStatement(Project1.MainUnitInfo.Source);
|
||||||
begin
|
ErrMsg := lisUnableToRemoveProjectTitleFromSource;
|
||||||
IDEMessageDialog(lisProjOptsError,
|
|
||||||
Format(lisUnableToRemoveProjectTitleFromSource, [LineEnding, CodeToolBoss.ErrorMessage]),
|
|
||||||
mtWarning, [mbOk]);
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
if not Result then
|
||||||
|
IDEMessageDialog(lisProjOptsError,
|
||||||
|
Format(ErrMsg, [LineEnding, CodeToolBoss.ErrorMessage]),
|
||||||
|
mtWarning, [mbOk]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function UpdateAppScaledInSource: Boolean;
|
function UpdateAppScaledInSource: Boolean;
|
||||||
var
|
var
|
||||||
ScaledStat, ProjScaled: Boolean;
|
ErrMsg: String;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
ScaledStat := False;
|
if not (pfMainUnitHasScaledStatement in Project1.Flags) then Exit;
|
||||||
CodeToolBoss.GetApplicationScaledStatement(Project1.MainUnitInfo.Source, ScaledStat);
|
//DebugLn(['UpdateAppScaledInSource: Project Scaled=',Project1.Scaled]);
|
||||||
ProjScaled:=Project1.Scaled;
|
if Project1.Scaled then
|
||||||
//DebugLn(['UpdateAppScaledInSource: Project Scaled=',ProjScaled,', Scaled Statement=',ScaledStat]);
|
begin // Add or update Scaled statement.
|
||||||
if pfMainUnitHasScaledStatement in Project1.Flags then
|
//DebugLn(['UpdateAppScaledInSource: Setting Scaled to ',Project1.Scaled]);
|
||||||
begin // Add Scaled statement if not there already.
|
Result := CodeToolBoss.SetApplicationScaledStatement(Project1.MainUnitInfo.Source, Project1.Scaled);
|
||||||
if ScaledStat = ProjScaled then
|
ErrMsg := lisUnableToChangeProjectScaledInSource; // Used in case of error.
|
||||||
Exit;
|
|
||||||
//DebugLn(['UpdateAppScaledInSource: Setting Scaled to ',ProjScaled]);
|
|
||||||
if not CodeToolBoss.SetApplicationScaledStatement(Project1.MainUnitInfo.Source, ProjScaled) then
|
|
||||||
begin
|
|
||||||
IDEMessageDialog(lisProjOptsError,
|
|
||||||
Format(lisUnableToChangeProjectScaledInSource, [LineEnding, CodeToolBoss.ErrorMessage]),
|
|
||||||
mtWarning, [mbOk]);
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end
|
end
|
||||||
else begin // Remove Scaled statement if it is there.
|
else begin // Remove Scaled statement if it's not needed.
|
||||||
//DebugLn(['UpdateAppScaledInSource: Removing Scaled']);
|
//DebugLn(['UpdateAppScaledInSource: Removing Scaled']);
|
||||||
if not CodeToolBoss.RemoveApplicationScaledStatement(Project1.MainUnitInfo.Source) then
|
Result := CodeToolBoss.RemoveApplicationScaledStatement(Project1.MainUnitInfo.Source);
|
||||||
begin
|
ErrMsg := lisUnableToRemoveProjectScaledFromSource;
|
||||||
IDEMessageDialog(lisProjOptsError,
|
|
||||||
Format(lisUnableToRemoveProjectScaledFromSource, [LineEnding, CodeToolBoss.ErrorMessage]),
|
|
||||||
mtWarning, [mbOk]);
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
if not Result then
|
||||||
|
IDEMessageDialog(lisProjOptsError,
|
||||||
|
Format(ErrMsg, [LineEnding, CodeToolBoss.ErrorMessage]),
|
||||||
|
mtWarning, [mbOk]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function UpdateAppAutoCreateForms: boolean;
|
function UpdateAppAutoCreateForms: boolean;
|
||||||
@ -4389,11 +4367,9 @@ var
|
|||||||
OldList: TStrings;
|
OldList: TStrings;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
if not (pfMainUnitHasCreateFormStatements in Project1.Flags) then
|
if not (pfMainUnitHasCreateFormStatements in Project1.Flags) then Exit;
|
||||||
Exit;
|
|
||||||
OldList := Project1.GetAutoCreatedFormsList;
|
OldList := Project1.GetAutoCreatedFormsList;
|
||||||
if OldList = nil then
|
if OldList = nil then Exit;
|
||||||
Exit;
|
|
||||||
try
|
try
|
||||||
if OldList.Count = Project1.TmpAutoCreatedForms.Count then
|
if OldList.Count = Project1.TmpAutoCreatedForms.Count then
|
||||||
begin
|
begin
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user