mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-25 21:07:24 +01: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);
|
PutExitInfoBuilder(lisInfoBuildError);
|
||||||
exit;
|
exit;
|
||||||
end;
|
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
|
end else
|
||||||
VersionInfo:=nil;
|
VersionInfo:=nil;
|
||||||
|
|
||||||
|
|||||||
@ -47,6 +47,7 @@ type
|
|||||||
FModified: boolean;
|
FModified: boolean;
|
||||||
rcFileName: string;
|
rcFileName: string;
|
||||||
icoFileName: string;
|
icoFileName: string;
|
||||||
|
lrsFileName: string;
|
||||||
FOnModified: TNotifyEvent;
|
FOnModified: TNotifyEvent;
|
||||||
procedure SetIconText(const AValue: String);
|
procedure SetIconText(const AValue: String);
|
||||||
procedure SetFileNames(const MainFilename: string);
|
procedure SetFileNames(const MainFilename: string);
|
||||||
@ -61,8 +62,10 @@ type
|
|||||||
procedure SetStream(AStream: TStream);
|
procedure SetStream(AStream: TStream);
|
||||||
|
|
||||||
function CreateRCFile(const MainFilename, TargetOS: string): TModalResult;
|
function CreateRCFile(const MainFilename, TargetOS: string): TModalResult;
|
||||||
|
function CreateLRSFile(const MainFilename, TargetOS: string): TModalResult;
|
||||||
function CreateIconFile: Boolean;
|
function CreateIconFile: Boolean;
|
||||||
function CreateResource: Boolean;
|
function CreateResource: Boolean;
|
||||||
|
function CreateLazarusResource: Boolean;
|
||||||
function UpdateMainSourceFile(const AFilename: string): TModalResult;
|
function UpdateMainSourceFile(const AFilename: string): TModalResult;
|
||||||
|
|
||||||
property IconText: String read FIconText write SetIconText;
|
property IconText: String read FIconText write SetIconText;
|
||||||
@ -127,7 +130,6 @@ end;
|
|||||||
-----------------------------------------------------------------------------}
|
-----------------------------------------------------------------------------}
|
||||||
function TProjectIcon.CreateRCFile(const MainFilename, TargetOS: string): TModalResult;
|
function TProjectIcon.CreateRCFile(const MainFilename, TargetOS: string): TModalResult;
|
||||||
begin
|
begin
|
||||||
// in future we will compile manifest from rc, but now we just add our template
|
|
||||||
Result := mrOk;
|
Result := mrOk;
|
||||||
SetFileNames(MainFilename);
|
SetFileNames(MainFilename);
|
||||||
if ((TargetOS = 'win32') or (TargetOS = 'wince')) and (IconText <> '') then
|
if ((TargetOS = 'win32') or (TargetOS = 'wince')) and (IconText <> '') then
|
||||||
@ -137,6 +139,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
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;
|
function TProjectIcon.CreateIconFile: Boolean;
|
||||||
var
|
var
|
||||||
FileStream, AStream: TStream;
|
FileStream, AStream: TStream;
|
||||||
@ -176,6 +189,23 @@ begin
|
|||||||
end;
|
end;
|
||||||
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
|
TProjectIcon UpdateMainSourceFile
|
||||||
-----------------------------------------------------------------------------}
|
-----------------------------------------------------------------------------}
|
||||||
@ -227,6 +257,7 @@ procedure TProjectIcon.SetFileNames(const MainFilename: string);
|
|||||||
begin
|
begin
|
||||||
rcFileName := ExtractFilePath(MainFilename) + 'icon.rc';
|
rcFileName := ExtractFilePath(MainFilename) + 'icon.rc';
|
||||||
icoFileName := ExtractFilePath(MainFilename) + 'icon.ico';
|
icoFileName := ExtractFilePath(MainFilename) + 'icon.ico';
|
||||||
|
lrsFileName := ExtractFilePath(MainFilename) + 'icon.lrs';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TProjectIcon.Create;
|
constructor TProjectIcon.Create;
|
||||||
|
|||||||
@ -41,7 +41,7 @@ uses
|
|||||||
FileUtil, IDEContextHelpEdit, EnvironmentOpts,
|
FileUtil, IDEContextHelpEdit, EnvironmentOpts,
|
||||||
IDEWindowIntf, IDEImagesIntf, ProjectIntf, IDEDialogs,
|
IDEWindowIntf, IDEImagesIntf, ProjectIntf, IDEDialogs,
|
||||||
IDEOptionDefs, LazarusIDEStrConsts, Project, IDEProcs, W32VersionInfo,
|
IDEOptionDefs, LazarusIDEStrConsts, Project, IDEProcs, W32VersionInfo,
|
||||||
VersionInfoAdditionalInfo, W32Manifest, ApplicationBundle, ExtDlgs, base64;
|
VersionInfoAdditionalInfo, W32Manifest, ApplicationBundle, ExtDlgs;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user