mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-17 08:09:26 +02:00
ide: further project icon changes
- create LRS icon file - remove base64 dependency from project options git-svn-id: trunk@16904 -
This commit is contained in:
parent
f0843b4de1
commit
ca68a99f0a
11
ide/main.pp
11
ide/main.pp
@ -9321,6 +9321,17 @@ begin
|
||||
PutExitInfoBuilder(lisInfoBuildError);
|
||||
exit;
|
||||
end;
|
||||
|
||||
Result := Project1.ProjectIcon.CreateLRSFile(Project1.MainFileName,
|
||||
MainBuildBoss.GetTargetOS(true));
|
||||
for i := 1 to Project1.ProjectIcon.Messages.Count do
|
||||
MessagesView.AddMsg(Format(Project1.ProjectIcon.Messages[i - 1],
|
||||
['"', Project1.ShortDescription, '"']), '' ,-1);
|
||||
if Result <> mrOk then
|
||||
begin
|
||||
PutExitInfoBuilder(lisInfoBuildError);
|
||||
exit;
|
||||
end;
|
||||
end else
|
||||
VersionInfo:=nil;
|
||||
|
||||
|
@ -47,6 +47,7 @@ type
|
||||
FModified: boolean;
|
||||
rcFileName: string;
|
||||
icoFileName: string;
|
||||
lrsFileName: string;
|
||||
FOnModified: TNotifyEvent;
|
||||
procedure SetIconText(const AValue: String);
|
||||
procedure SetFileNames(const MainFilename: string);
|
||||
@ -61,8 +62,10 @@ type
|
||||
procedure SetStream(AStream: TStream);
|
||||
|
||||
function CreateRCFile(const MainFilename, TargetOS: string): TModalResult;
|
||||
function CreateLRSFile(const MainFilename, TargetOS: string): TModalResult;
|
||||
function CreateIconFile: Boolean;
|
||||
function CreateResource: Boolean;
|
||||
function CreateLazarusResource: Boolean;
|
||||
function UpdateMainSourceFile(const AFilename: string): TModalResult;
|
||||
|
||||
property IconText: String read FIconText write SetIconText;
|
||||
@ -127,7 +130,6 @@ end;
|
||||
-----------------------------------------------------------------------------}
|
||||
function TProjectIcon.CreateRCFile(const MainFilename, TargetOS: string): TModalResult;
|
||||
begin
|
||||
// in future we will compile manifest from rc, but now we just add our template
|
||||
Result := mrOk;
|
||||
SetFileNames(MainFilename);
|
||||
if ((TargetOS = 'win32') or (TargetOS = 'wince')) and (IconText <> '') then
|
||||
@ -137,6 +139,17 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TProjectIcon.CreateLRSFile(const MainFilename, TargetOS: string): TModalResult;
|
||||
begin
|
||||
Result := mrOk;
|
||||
SetFileNames(MainFilename);
|
||||
if (IconText <> '') then
|
||||
begin
|
||||
if not CreateLazarusResource then
|
||||
Result := mrCancel;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TProjectIcon.CreateIconFile: Boolean;
|
||||
var
|
||||
FileStream, AStream: TStream;
|
||||
@ -176,6 +189,23 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TProjectIcon.CreateLazarusResource: Boolean;
|
||||
var
|
||||
ASource, ATarget: TStream;
|
||||
begin
|
||||
Result := False;
|
||||
ASource := GetStream;
|
||||
ATarget := nil;
|
||||
try
|
||||
ATarget := TFileStream.Create(UTF8ToSys(lrsFileName), fmCreate);
|
||||
BinaryToLazarusResourceCode(ASource, ATarget, 'MAINICON', 'ICO');
|
||||
Result := True;
|
||||
finally
|
||||
ATarget.Free;
|
||||
end;
|
||||
ASource.Free;
|
||||
end;
|
||||
|
||||
{-----------------------------------------------------------------------------
|
||||
TProjectIcon UpdateMainSourceFile
|
||||
-----------------------------------------------------------------------------}
|
||||
@ -227,6 +257,7 @@ procedure TProjectIcon.SetFileNames(const MainFilename: string);
|
||||
begin
|
||||
rcFileName := ExtractFilePath(MainFilename) + 'icon.rc';
|
||||
icoFileName := ExtractFilePath(MainFilename) + 'icon.ico';
|
||||
lrsFileName := ExtractFilePath(MainFilename) + 'icon.lrs';
|
||||
end;
|
||||
|
||||
constructor TProjectIcon.Create;
|
||||
|
@ -41,7 +41,7 @@ uses
|
||||
FileUtil, IDEContextHelpEdit, EnvironmentOpts,
|
||||
IDEWindowIntf, IDEImagesIntf, ProjectIntf, IDEDialogs,
|
||||
IDEOptionDefs, LazarusIDEStrConsts, Project, IDEProcs, W32VersionInfo,
|
||||
VersionInfoAdditionalInfo, W32Manifest, ApplicationBundle, ExtDlgs, base64;
|
||||
VersionInfoAdditionalInfo, W32Manifest, ApplicationBundle, ExtDlgs;
|
||||
|
||||
type
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user