IDE: New project description for an application with UTF8 RTL support.

git-svn-id: trunk@47571 -
This commit is contained in:
juha 2015-01-31 09:53:56 +00:00
parent 4a4651ad58
commit 74d2ec821a
4 changed files with 41 additions and 2 deletions

View File

@ -32,6 +32,7 @@ const
ProjDescGroupName = 'Project';
ProjDescNameApplication = 'Application';
ProjDescNameUtf8Application = 'UTF-8 Application';
ProjDescNameSimpleProgram = 'Simple Program';
ProjDescNameProgram = 'Program';
ProjDescNameConsoleApplication = 'Console application';

View File

@ -2326,6 +2326,7 @@ resourcestring
dlgProjectOptions = 'Project Options';
dlgProjectOptionsFor = 'Options for Project: %s';
dlgPOApplication = 'Application';
dlgPOUtf8Application = 'UTF-8 Application';
dlgPOFroms = 'Forms';
dlgPOResources = 'Resources';
rsResourceFileName = 'File name';
@ -4646,6 +4647,8 @@ resourcestring
lisApplicationProgramDescriptor = 'A graphical Free Pascal application using'
+' the cross-platform LCL library for its GUI.';
lisUtf8ApplicationProgramDescriptor = 'A graphical application for FPC 3.0 and higher using'
+' the cross-platform LCL library for its GUI and mapping FPC default String to UTF-8 encoding.';
lisSimpleProgramProgramDescriptor = 'A most simple Free Pascal command line program.';
lisProgramProgramDescriptor = 'A Free Pascal command line program with some useful settings added.';
lisConsoleApplicationProgramDescriptor = 'A Free Pascal command line program using'

View File

@ -2564,6 +2564,7 @@ begin
// project descriptors
LazProjectDescriptors:=TLazProjectDescriptors.Create;
RegisterProjectDescriptor(TProjectApplicationDescriptor.Create);
RegisterProjectDescriptor(TProjectUtf8ApplicationDescriptor.Create);
RegisterProjectDescriptor(TProjectSimpleProgramDescriptor.Create);
RegisterProjectDescriptor(TProjectProgramDescriptor.Create);
RegisterProjectDescriptor(TProjectConsoleApplicationDescriptor.Create);

View File

@ -315,6 +315,14 @@ type
function CreateStartFiles({%H-}AProject: TLazProject): TModalResult; override;
end;
TProjectUtf8ApplicationDescriptor = class(TProjectApplicationDescriptor)
public
constructor Create; override;
function GetLocalizedName: string; override;
function GetLocalizedDescription: string; override;
function InitProject(AProject: TLazProject): TModalResult; override;
end;
{ TProjectSimpleProgramDescriptor }
TProjectSimpleProgramDescriptor = class(TProjectDescriptor)
@ -1261,8 +1269,7 @@ begin
Result := GetLocalizedName + LineEnding+LineEnding + lisApplicationProgramDescriptor;
end;
function TProjectApplicationDescriptor.InitProject(
AProject: TLazProject): TModalResult;
function TProjectApplicationDescriptor.InitProject(AProject: TLazProject): TModalResult;
var
NewSource: String;
MainFile: TLazProjectFile;
@ -1312,6 +1319,33 @@ begin
[nfIsPartOfProject,nfOpenInEditor,nfCreateDefaultSrc]);
end;
{ TProjectUtf8ApplicationDescriptor }
constructor TProjectUtf8ApplicationDescriptor.Create;
begin
inherited Create;
Name:=ProjDescNameUtf8Application;
end;
function TProjectUtf8ApplicationDescriptor.GetLocalizedName: string;
begin
Result:=dlgPOUtf8Application;
end;
function TProjectUtf8ApplicationDescriptor.GetLocalizedDescription: string;
begin
Result := GetLocalizedName + LineEnding+LineEnding + lisUtf8ApplicationProgramDescriptor;
end;
function TProjectUtf8ApplicationDescriptor.InitProject(AProject: TLazProject): TModalResult;
begin
Result := inherited InitProject(AProject);
Assert(AProject.LazCompilerOptions.CustomOptions='',
'TProjectUtf8ApplicationDescriptor.InitProject: CustomOptions<>''');
AProject.LazCompilerOptions.CustomOptions := '-dEnableUTF8RTL' + LineEnding
+ '-FcUTF8' + LineEnding;
end;
{ TProjectSimpleProgramDescriptor }
constructor TProjectSimpleProgramDescriptor.Create;