mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 12:40:33 +02:00
ide: add Attributes to version info
git-svn-id: trunk@43235 -
This commit is contained in:
parent
87d90e960c
commit
87855fd53e
@ -1,23 +1,28 @@
|
||||
object ProjectVersionInfoOptionsFrame: TProjectVersionInfoOptionsFrame
|
||||
Left = 0
|
||||
Height = 364
|
||||
Height = 428
|
||||
Top = 0
|
||||
Width = 594
|
||||
ClientHeight = 364
|
||||
ClientHeight = 428
|
||||
ClientWidth = 594
|
||||
TabOrder = 0
|
||||
DesignLeft = 273
|
||||
DesignTop = 145
|
||||
object VersionInfoGroupBox: TGroupBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = UseVersionInfoCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 101
|
||||
Top = 27
|
||||
Height = 102
|
||||
Top = 25
|
||||
Width = 594
|
||||
Align = alTop
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Version Numbering'
|
||||
ClientHeight = 85
|
||||
ClientHeight = 84
|
||||
ClientWidth = 590
|
||||
TabOrder = 1
|
||||
object MajorVersionLabel: TLabel
|
||||
@ -26,7 +31,7 @@ object ProjectVersionInfoOptionsFrame: TProjectVersionInfoOptionsFrame
|
||||
Left = 6
|
||||
Height = 15
|
||||
Top = 6
|
||||
Width = 70
|
||||
Width = 75
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Bottom = 3
|
||||
@ -41,7 +46,7 @@ object ProjectVersionInfoOptionsFrame: TProjectVersionInfoOptionsFrame
|
||||
Left = 131
|
||||
Height = 15
|
||||
Top = 6
|
||||
Width = 70
|
||||
Width = 76
|
||||
BorderSpacing.Left = 55
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Bottom = 3
|
||||
@ -56,7 +61,7 @@ object ProjectVersionInfoOptionsFrame: TProjectVersionInfoOptionsFrame
|
||||
Left = 256
|
||||
Height = 15
|
||||
Top = 6
|
||||
Width = 45
|
||||
Width = 47
|
||||
BorderSpacing.Left = 55
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Bottom = 3
|
||||
@ -71,7 +76,7 @@ object ProjectVersionInfoOptionsFrame: TProjectVersionInfoOptionsFrame
|
||||
Left = 381
|
||||
Height = 15
|
||||
Top = 6
|
||||
Width = 29
|
||||
Width = 30
|
||||
BorderSpacing.Left = 55
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Bottom = 3
|
||||
@ -84,7 +89,7 @@ object ProjectVersionInfoOptionsFrame: TProjectVersionInfoOptionsFrame
|
||||
AnchorSideTop.Control = MajorVersionLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 22
|
||||
Height = 23
|
||||
Top = 24
|
||||
Width = 70
|
||||
MaxValue = 65535
|
||||
@ -95,7 +100,7 @@ object ProjectVersionInfoOptionsFrame: TProjectVersionInfoOptionsFrame
|
||||
AnchorSideTop.Control = MinorVersionLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 131
|
||||
Height = 22
|
||||
Height = 23
|
||||
Top = 24
|
||||
Width = 70
|
||||
MaxValue = 65535
|
||||
@ -106,7 +111,7 @@ object ProjectVersionInfoOptionsFrame: TProjectVersionInfoOptionsFrame
|
||||
AnchorSideTop.Control = RevisionLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 256
|
||||
Height = 22
|
||||
Height = 23
|
||||
Top = 24
|
||||
Width = 70
|
||||
MaxValue = 65535
|
||||
@ -117,9 +122,9 @@ object ProjectVersionInfoOptionsFrame: TProjectVersionInfoOptionsFrame
|
||||
AnchorSideTop.Control = MajorVersionSpinEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 58
|
||||
Width = 164
|
||||
Height = 19
|
||||
Top = 59
|
||||
Width = 170
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Automatically increase Build'
|
||||
@ -130,7 +135,7 @@ object ProjectVersionInfoOptionsFrame: TProjectVersionInfoOptionsFrame
|
||||
AnchorSideTop.Control = BuildLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 381
|
||||
Height = 22
|
||||
Height = 23
|
||||
Top = 24
|
||||
Width = 70
|
||||
MaxValue = 65535
|
||||
@ -138,26 +143,38 @@ object ProjectVersionInfoOptionsFrame: TProjectVersionInfoOptionsFrame
|
||||
end
|
||||
end
|
||||
object UseVersionInfoCheckBox: TCheckBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 21
|
||||
Height = 19
|
||||
Top = 0
|
||||
Width = 594
|
||||
Align = alTop
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
Caption = 'Include Version Info in executable'
|
||||
OnChange = UseVersionInfoCheckBoxChange
|
||||
TabOrder = 0
|
||||
end
|
||||
object LanguageSettingsGroupBox: TGroupBox
|
||||
Left = 0
|
||||
Height = 75
|
||||
Top = 134
|
||||
Width = 594
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
AnchorSideLeft.Control = AttributesGroupBox
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = VersionInfoGroupBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = AttributesGroupBox
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 239
|
||||
Height = 131
|
||||
Top = 133
|
||||
Width = 355
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Language Options'
|
||||
ClientHeight = 59
|
||||
ClientWidth = 590
|
||||
ClientHeight = 113
|
||||
ClientWidth = 351
|
||||
TabOrder = 2
|
||||
object LanguageSelectionLabel: TLabel
|
||||
AnchorSideLeft.Control = LanguageSettingsGroupBox
|
||||
@ -165,18 +182,18 @@ object ProjectVersionInfoOptionsFrame: TProjectVersionInfoOptionsFrame
|
||||
Left = 6
|
||||
Height = 15
|
||||
Top = 6
|
||||
Width = 101
|
||||
Width = 106
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Language Selection:'
|
||||
ParentColor = False
|
||||
end
|
||||
object CharacterSetLabel: TLabel
|
||||
AnchorSideLeft.Control = LanguageSelectionComboBox
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = LanguageSettingsGroupBox
|
||||
Left = 260
|
||||
AnchorSideLeft.Control = LanguageSettingsGroupBox
|
||||
AnchorSideTop.Control = LanguageSelectionComboBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 15
|
||||
Top = 6
|
||||
Top = 56
|
||||
Width = 73
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Character Set:'
|
||||
@ -186,48 +203,61 @@ object ProjectVersionInfoOptionsFrame: TProjectVersionInfoOptionsFrame
|
||||
AnchorSideLeft.Control = LanguageSelectionLabel
|
||||
AnchorSideTop.Control = LanguageSelectionLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = LanguageSettingsGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 26
|
||||
Height = 23
|
||||
Top = 27
|
||||
Width = 248
|
||||
Width = 339
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 2
|
||||
BorderSpacing.Right = 6
|
||||
BorderSpacing.Bottom = 6
|
||||
ItemHeight = 0
|
||||
ItemHeight = 15
|
||||
Style = csDropDownList
|
||||
TabOrder = 0
|
||||
end
|
||||
object CharacterSetComboBox: TComboBox
|
||||
AnchorSideLeft.Control = CharacterSetLabel
|
||||
AnchorSideTop.Control = LanguageSelectionComboBox
|
||||
AnchorSideTop.Control = CharacterSetLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = LanguageSettingsGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 260
|
||||
Height = 26
|
||||
Top = 27
|
||||
Width = 324
|
||||
Left = 6
|
||||
Height = 23
|
||||
Top = 77
|
||||
Width = 339
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 2
|
||||
BorderSpacing.Right = 6
|
||||
BorderSpacing.Bottom = 6
|
||||
ItemHeight = 0
|
||||
ItemHeight = 15
|
||||
Style = csDropDownList
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
object OtherInfoGroupBox: TGroupBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = LanguageSettingsGroupBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 149
|
||||
Top = 215
|
||||
Height = 158
|
||||
Top = 270
|
||||
Width = 594
|
||||
Align = alClient
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Other Info'
|
||||
ClientHeight = 133
|
||||
ClientHeight = 140
|
||||
ClientWidth = 590
|
||||
TabOrder = 3
|
||||
object StringInfo: TStringGrid
|
||||
Left = 6
|
||||
Height = 121
|
||||
Height = 128
|
||||
Top = 6
|
||||
Width = 578
|
||||
Align = alClient
|
||||
@ -256,4 +286,29 @@ object ProjectVersionInfoOptionsFrame: TProjectVersionInfoOptionsFrame
|
||||
)
|
||||
end
|
||||
end
|
||||
object AttributesGroupBox: TGroupBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = VersionInfoGroupBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = LanguageSettingsGroupBox
|
||||
Left = 0
|
||||
Height = 131
|
||||
Top = 133
|
||||
Width = 233
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'AttributesGroupBox'
|
||||
ClientHeight = 113
|
||||
ClientWidth = 229
|
||||
TabOrder = 4
|
||||
object clbAttributes: TCheckListBox
|
||||
Left = 0
|
||||
Height = 113
|
||||
Top = 0
|
||||
Width = 229
|
||||
Align = alClient
|
||||
ItemHeight = 0
|
||||
OnClickCheck = clbAttributesClickCheck
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -5,9 +5,9 @@ unit project_versioninfo_options;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, Spin, Buttons, Grids, Project, IDEOptionsIntf, LazarusIDEStrConsts,
|
||||
W32VersionInfo;
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||
Spin, Buttons, Grids, CheckLst, LCLProc,
|
||||
Project, IDEOptionsIntf, LazarusIDEStrConsts, W32VersionInfo;
|
||||
|
||||
type
|
||||
|
||||
@ -19,6 +19,8 @@ type
|
||||
BuildSpinEdit: TSpinEdit;
|
||||
CharacterSetComboBox: TComboBox;
|
||||
CharacterSetLabel: TLabel;
|
||||
clbAttributes: TCheckListBox;
|
||||
AttributesGroupBox: TGroupBox;
|
||||
LanguageSelectionComboBox: TComboBox;
|
||||
LanguageSelectionLabel: TLabel;
|
||||
LanguageSettingsGroupBox: TGroupBox;
|
||||
@ -32,10 +34,13 @@ type
|
||||
VersionInfoGroupBox: TGroupBox;
|
||||
MajorVersionLabel: TLabel;
|
||||
MajorVersionSpinEdit: TSpinEdit;
|
||||
procedure clbAttributesClickCheck(Sender: TObject);
|
||||
procedure UseVersionInfoCheckBoxChange(Sender: TObject);
|
||||
private
|
||||
FVersionInfo: TProjectVersionInfo;
|
||||
procedure EnableVersionInfo(UseVersionInfo: boolean);
|
||||
procedure AddKey(AKey: String);
|
||||
procedure DeleteKey(AKey: String);
|
||||
public
|
||||
function GetTitle: string; override;
|
||||
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
|
||||
@ -79,11 +84,44 @@ begin
|
||||
EnableVersionInfo(UseVersionInfoCheckBox.Checked);
|
||||
end;
|
||||
|
||||
procedure TProjectVersionInfoOptionsFrame.clbAttributesClickCheck(Sender: TObject);
|
||||
begin
|
||||
if clbAttributes.Checked[Ord(pvaPrivateBuild)] then
|
||||
DeleteKey('PrivateBuild')
|
||||
else
|
||||
AddKey('PrivateBuild');
|
||||
if clbAttributes.Checked[Ord(pvaSpecialBuild)] then
|
||||
DeleteKey('SpecialBuild')
|
||||
else
|
||||
AddKey('SpecialBuild');
|
||||
end;
|
||||
|
||||
procedure TProjectVersionInfoOptionsFrame.EnableVersionInfo(UseVersionInfo: boolean);
|
||||
begin
|
||||
VersionInfoGroupBox.Enabled := UseVersionInfo;
|
||||
LanguageSettingsGroupBox.Enabled := UseVersionInfo;
|
||||
OtherInfoGroupBox.Enabled := UseVersionInfo;
|
||||
AttributesGroupBox.Enabled := UseVersionInfo;
|
||||
end;
|
||||
|
||||
procedure TProjectVersionInfoOptionsFrame.AddKey(AKey: String);
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
for I := StringInfo.RowCount - 1 downto 1 do
|
||||
if UTF8LowerCase(StringInfo.Cells[0, I]) = UTF8LowerCase(AKey) then
|
||||
StringInfo.DeleteRow(I);
|
||||
end;
|
||||
|
||||
procedure TProjectVersionInfoOptionsFrame.DeleteKey(AKey: String);
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
for I := 0 to StringInfo.RowCount - 1 do
|
||||
if UTF8LowerCase(StringInfo.Cells[0, I]) = UTF8LowerCase(AKey) then
|
||||
Exit;
|
||||
StringInfo.RowCount := StringInfo.RowCount + 1;
|
||||
StringInfo.Cells[0, StringInfo.RowCount - 1] := AKey;
|
||||
end;
|
||||
|
||||
function TProjectVersionInfoOptionsFrame.GetTitle: string;
|
||||
@ -94,6 +132,7 @@ end;
|
||||
procedure TProjectVersionInfoOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
||||
var
|
||||
Items: TStringList;
|
||||
Attr: TProjectVersionAttribute;
|
||||
begin
|
||||
UseVersionInfoCheckBox.Caption := rsIncludeVersionInfoInExecutable;
|
||||
VersionInfoGroupBox.Caption := rsVersionNumbering;
|
||||
@ -108,6 +147,9 @@ begin
|
||||
OtherInfoGroupBox.Caption := rsOtherInfo;
|
||||
StringInfo.Cells[0, 0] := lisKey;
|
||||
StringInfo.Cells[0, 1] := lisValue;
|
||||
AttributesGroupBox.Caption := rsAttributes;
|
||||
for Attr := Low(TProjectVersionAttribute) to High(TProjectVersionAttribute) do
|
||||
clbAttributes.AddItem(ProjectVersionAttributeToStr[Attr], nil);
|
||||
// fill comboboxes
|
||||
Items := TStringList.Create;
|
||||
try
|
||||
@ -126,8 +168,9 @@ end;
|
||||
procedure TProjectVersionInfoOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
var
|
||||
i: integer;
|
||||
Attr: TProjectVersionAttribute;
|
||||
begin
|
||||
FVersionInfo := TProjectVersionInfo((AOptions as TProject).ProjResources[TProjectVersionInfo]);
|
||||
FVersionInfo := (AOptions as TProject).ProjResources.VersionInfo;
|
||||
|
||||
UseVersionInfoCheckBox.Checked := FVersionInfo.UseVersionInfo;
|
||||
MajorVersionSpinEdit.Value := FVersionInfo.MajorVersionNr;
|
||||
@ -149,6 +192,10 @@ begin
|
||||
i := CharacterSetComboBox.Items.IndexOf(MSCharacterSets[i]);
|
||||
CharacterSetComboBox.ItemIndex := i;
|
||||
|
||||
// read attributes
|
||||
for Attr in FVersionInfo.Attributes do
|
||||
clbAttributes.Checked[Ord(Attr)] := True;
|
||||
|
||||
// read string info
|
||||
StringInfo.RowCount := FVersionInfo.StringTable.Count + 1;
|
||||
for i := 0 to FVersionInfo.StringTable.Count - 1 do
|
||||
@ -163,8 +210,9 @@ var
|
||||
VersionInfo: TProjectVersionInfo;
|
||||
i: integer;
|
||||
t: TProjectVersionStringTable;
|
||||
attrs: TProjectVersionAttributes;
|
||||
begin
|
||||
VersionInfo := TProjectVersionInfo((AOptions as TProject).ProjResources[TProjectVersionInfo]);
|
||||
VersionInfo := (AOptions as TProject).ProjResources.VersionInfo;
|
||||
VersionInfo.UseVersionInfo := UseVersionInfoCheckBox.Checked;
|
||||
VersionInfo.AutoIncrementBuild := AutomaticallyIncreaseBuildCheckBox.Checked;
|
||||
VersionInfo.MajorVersionNr := MajorVersionSpinEdit.Value;
|
||||
@ -173,8 +221,14 @@ begin
|
||||
VersionInfo.BuildNr := BuildSpinEdit.Value;
|
||||
VersionInfo.HexLang := MSLanguageToHex(LanguageSelectionComboBox.Text);
|
||||
VersionInfo.HexCharSet := MSCharacterSetToHex(CharacterSetComboBox.Text);
|
||||
// write attributes
|
||||
attrs := [];
|
||||
for i := 0 to clbAttributes.Count - 1 do
|
||||
if clbAttributes.Checked[i] then
|
||||
include(attrs, TProjectVersionAttribute(i));
|
||||
VersionInfo.Attributes := attrs;
|
||||
// write string info
|
||||
t:=TProjectVersionStringTable.Create('01234567');
|
||||
t := TProjectVersionStringTable.Create('01234567');
|
||||
try
|
||||
for i := 1 to StringInfo.RowCount - 1 do
|
||||
t[StringInfo.Cells[0, i]] := StringInfo.Cells[1, i];
|
||||
|
@ -455,6 +455,7 @@
|
||||
<Filename Value="frames/project_versioninfo_options.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="ProjectVersionInfoOptionsFrame"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Frame"/>
|
||||
<UnitName Value="project_versioninfo_options"/>
|
||||
</Unit55>
|
||||
|
@ -2308,6 +2308,7 @@ resourcestring
|
||||
rsLanguageSelection = 'Language selection:';
|
||||
rsCharacterSet = 'Character set:';
|
||||
rsOtherInfo = 'Other info';
|
||||
rsAttributes = 'Attributes';
|
||||
dlgPOSaveSession = 'Session';
|
||||
dlgApplicationSettings = 'Application settings';
|
||||
dlgPOTitle = 'Title:';
|
||||
|
@ -37,9 +37,10 @@ unit W32VersionInfo;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Process, LCLProc, Controls, Forms, FileUtil, laz2_DOM,
|
||||
Classes, SysUtils, Process, LCLProc, Controls, Forms, FileUtil, TypInfo, laz2_DOM,
|
||||
Laz2_XMLCfg, CodeToolManager, LazConf, IDEProcs, ProjectIntf, CompOptsIntf,
|
||||
ProjectResourcesIntf, resource, versionresource, versiontypes, TransferMacros;
|
||||
ProjectResourcesIntf, resource, versionresource, versiontypes, versionconsts,
|
||||
TransferMacros;
|
||||
|
||||
type
|
||||
|
||||
@ -68,10 +69,20 @@ type
|
||||
property OnModified: TNotifyEvent read FOnModified write FOnModified;
|
||||
end;
|
||||
|
||||
TProjectVersionAttribute = (
|
||||
pvaDebug,
|
||||
pvaPreRelease,
|
||||
pvaPatched,
|
||||
pvaPrivateBuild,
|
||||
pvaSpecialBuild
|
||||
);
|
||||
TProjectVersionAttributes = set of TProjectVersionAttribute;
|
||||
|
||||
{ TProjectVersionInfo }
|
||||
|
||||
TProjectVersionInfo = class(TAbstractProjectResource)
|
||||
private
|
||||
FAttributes: TProjectVersionAttributes;
|
||||
FAutoIncrementBuild: boolean;
|
||||
FHexCharSet: string;
|
||||
FHexLang: string;
|
||||
@ -83,6 +94,7 @@ type
|
||||
function GetHexLanguages: TStringList;
|
||||
function GetLanguages: TStringList;
|
||||
function GetVersion(AIndex: integer): integer;
|
||||
procedure SetAttributes(AValue: TProjectVersionAttributes);
|
||||
procedure SetAutoIncrementBuild(const AValue: boolean);
|
||||
procedure SetFileVersionFromVersion;
|
||||
procedure SetHexCharSet(const AValue: string);
|
||||
@ -90,6 +102,7 @@ type
|
||||
procedure SetUseVersionInfo(const AValue: boolean);
|
||||
procedure SetVersion(AIndex: integer; const AValue: integer);
|
||||
function ExtractProductVersion: TFileProductVersion;
|
||||
function GetFileFlags: LongWord;
|
||||
function BuildFileVersionString: String;
|
||||
procedure DoModified(Sender: TObject);
|
||||
public
|
||||
@ -111,6 +124,7 @@ type
|
||||
property RevisionNr: integer index 2 read GetVersion write SetVersion;
|
||||
property BuildNr: integer index 3 read GetVersion write SetVersion;
|
||||
|
||||
property Attributes: TProjectVersionAttributes read FAttributes write SetAttributes;
|
||||
property HexLang: string read FHexLang write SetHexLang;
|
||||
property HexCharSet: string read FHexCharSet write SetHexCharSet;
|
||||
|
||||
@ -132,6 +146,14 @@ const
|
||||
DefaultLanguage = '0409'; // U.S. English
|
||||
DefaultCharSet = '04E4'; // Multilingual
|
||||
|
||||
ProjectVersionAttributeToStr: array[TProjectVersionAttribute] of String = (
|
||||
{ pvaDebug } 'Debug',
|
||||
{ pvaPreRelease } 'Pre-release',
|
||||
{ pvaPatched } 'Patched',
|
||||
{ pvaPrivateBuild } 'Private build',
|
||||
{ pvaSpecialBuild } 'Special build'
|
||||
);
|
||||
|
||||
implementation
|
||||
|
||||
var
|
||||
@ -371,6 +393,7 @@ begin
|
||||
//it's always RT_VERSION and 1 respectively
|
||||
ARes.FixedInfo.FileVersion := FVersion;
|
||||
ARes.FixedInfo.ProductVersion := ExtractProductVersion;
|
||||
ARes.FixedInfo.FileFlags := GetFileFlags;
|
||||
|
||||
lang := HexLang;
|
||||
if lang = '' then
|
||||
@ -382,7 +405,8 @@ begin
|
||||
SetFileVersionFromVersion;
|
||||
|
||||
st := TVersionStringTable.Create(lang + charset);
|
||||
for i := 0 to FStringTable.Count - 1 do Begin
|
||||
for i := 0 to FStringTable.Count - 1 do
|
||||
begin
|
||||
VersionValue := FStringTable.ValuesByIndex[i];
|
||||
GlobalMacroList.SubstituteStr(VersionValue);
|
||||
st.Add(Utf8ToAnsi(FStringTable.Keys[i]), Utf8ToAnsi(VersionValue));
|
||||
@ -401,6 +425,7 @@ var
|
||||
i: integer;
|
||||
Key: string;
|
||||
DefaultValue: String;
|
||||
attr: TProjectVersionAttribute;
|
||||
begin
|
||||
with TXMLConfig(AConfig) do
|
||||
begin
|
||||
@ -414,6 +439,11 @@ begin
|
||||
SetDeleteValue(Path + 'VersionInfo/Language/Value', HexLang, DefaultLanguage);
|
||||
SetDeleteValue(Path + 'VersionInfo/CharSet/Value', HexCharSet, DefaultCharset);
|
||||
|
||||
// write attributes
|
||||
DeletePath(Path + 'VersionInfo/Attributes');
|
||||
for attr in Attributes do
|
||||
SetDeleteValue(Path + 'VersionInfo/Attributes/' + GetEnumName(TypeInfo(attr), Ord(attr)), True, False);
|
||||
|
||||
// write string info
|
||||
DeletePath(Path + 'VersionInfo/StringTable');
|
||||
for i := 0 to StringTable.Count - 1 do begin
|
||||
@ -432,6 +462,7 @@ procedure TProjectVersionInfo.ReadFromProjectFile(AConfig: TObject; Path: string
|
||||
var
|
||||
i: integer;
|
||||
Node: TDomNode;
|
||||
attrs: TProjectVersionAttributes;
|
||||
begin
|
||||
with TXMLConfig(AConfig) do
|
||||
begin
|
||||
@ -450,6 +481,18 @@ begin
|
||||
HexLang := GetValue(Path + 'VersionInfo/Language/Value', DefaultLanguage);
|
||||
HexCharSet := GetValue(Path + 'VersionInfo/CharSet/Value', DefaultCharset);
|
||||
|
||||
// read attributes
|
||||
attrs := [];
|
||||
Node := FindNode(Path + 'VersionInfo/Attributes', False);
|
||||
if Assigned(Node) then
|
||||
begin
|
||||
for i := 0 to Node.Attributes.Length - 1 do
|
||||
if StrToBoolDef(Node.Attributes[i].NodeValue, False) then
|
||||
include(attrs, TProjectVersionAttribute(GetEnumValue(TypeInfo(TProjectVersionAttribute), Node.Attributes[i].NodeName)));
|
||||
end;
|
||||
Attributes := attrs;
|
||||
|
||||
|
||||
// read string info
|
||||
Node := FindNode(Path + 'VersionInfo/StringTable', False);
|
||||
if Assigned(Node) then
|
||||
@ -507,6 +550,14 @@ begin
|
||||
Result := FVersion[AIndex];
|
||||
end;
|
||||
|
||||
procedure TProjectVersionInfo.SetAttributes(AValue: TProjectVersionAttributes);
|
||||
begin
|
||||
if FAttributes = AValue then
|
||||
Exit;
|
||||
FAttributes := AValue;
|
||||
Modified := True;
|
||||
end;
|
||||
|
||||
procedure TProjectVersionInfo.SetAutoIncrementBuild(const AValue: boolean);
|
||||
begin
|
||||
if FAutoIncrementBuild = AValue then
|
||||
@ -575,6 +626,24 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TProjectVersionInfo.GetFileFlags: LongWord;
|
||||
const
|
||||
AttributeToFileFlags: array[TProjectVersionAttribute] of LongWord = (
|
||||
{ pvaDebug } VS_FF_DEBUG,
|
||||
{ pvaPreRelease } VS_FF_PRERELEASE,
|
||||
{ pvaPatched } VS_FF_PATCHED,
|
||||
{ pvaPrivateBuild } VS_FF_PRIVATEBUILD,
|
||||
{ pvaSpecialBuild } VS_FF_SPECIALBUILD
|
||||
);
|
||||
|
||||
var
|
||||
Attribute: TProjectVersionAttribute;
|
||||
begin
|
||||
Result := 0;
|
||||
for Attribute in Attributes do
|
||||
Result := Result or AttributeToFileFlags[Attribute];
|
||||
end;
|
||||
|
||||
function TProjectVersionInfo.BuildFileVersionString: String;
|
||||
begin
|
||||
Result := Format('%d.%d.%d.%d', [MajorVersionNr, MinorVersionNr, RevisionNr, BuildNr]);
|
||||
@ -588,6 +657,7 @@ end;
|
||||
constructor TProjectVersionInfo.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
FAttributes := [];
|
||||
FStringTable := TProjectVersionStringTable.Create('00000000');
|
||||
FStringTable.OnModified := @DoModified;
|
||||
HexLang:=DefaultLanguage;
|
||||
|
Loading…
Reference in New Issue
Block a user