Browse Source

--- Merging r19703 into '.':
U packages/chm/src/chmbase.pas
U packages/chm/src/chmfilewriter.pas
U packages/chm/src/chmwriter.pas
U packages/chm/src/chmcmd.lpr

# revisions: 19703
------------------------------------------------------------------------
r19703 | marco | 2011-11-29 13:46:12 +0100 (Tue, 29 Nov 2011) | 2 lines
Changed paths:
M /trunk/packages/chm/src/chmbase.pas
M /trunk/packages/chm/src/chmcmd.lpr
M /trunk/packages/chm/src/chmfilewriter.pas
M /trunk/packages/chm/src/chmwriter.pas

* Improve CHM versioning, now that a compiler is added. Main chm version is in chmbase

------------------------------------------------------------------------

git-svn-id: branches/fixes_2_6@19704 -

marco 13 years ago
parent
commit
f26430172c

+ 3 - 0
packages/chm/src/chmbase.pas

@@ -26,6 +26,9 @@ interface
 
 uses
   Classes, SysUtils;
+
+const 
+  CHMPackageVersion = '2.6.0'; // to be put in readme
   
 type
   {$PACKRECORDS C}

+ 4 - 1
packages/chm/src/chmcmd.lpr

@@ -25,6 +25,9 @@ program chmcmd;
 uses
   Classes, Sysutils, chmfilewriter, GetOpts;
 
+Const 
+  CHMCMDVersion = '2.6.0';
+
 Procedure Usage;
 
 begin
@@ -41,7 +44,6 @@ begin
   Halt(1);
 end;
 
-
 var
   theopts : array[1..6] of TOption;
 
@@ -117,6 +119,7 @@ var
 begin
   ishhp:=uppercase(extractfileext(name))='.HHP';
   Project := TChmProject.Create;
+  Project.ReadMeMessage:='Compiled by CHMCmd '+CHMCMDVersion;
   if ishhp then
     begin
       xmlname:=changefileext(name,'.hhp.xml');

+ 4 - 2
packages/chm/src/chmfilewriter.pas

@@ -61,7 +61,8 @@ type
     fAllowedExtensions: TStringList;
     fTotalFileList : TAvlTree;
     FSpareString   : TStringIndex;
-    FBasePath       : String;     // location of the .hhp file. Needed to resolve relative paths
+    FBasePath      : String;     // location of the .hhp file. Needed to resolve relative paths
+    FReadmeMessage : String;     // readme message
   protected
     function GetData(const DataName: String; out PathInChm: String; out FileName: String; var Stream: TStream): Boolean;
     procedure LastFileAdded(Sender: TObject);
@@ -101,6 +102,7 @@ type
     property OnError   : TChmErrorCB read FOnError write FOnError;
     property DefaultWindow : String read FDefaultWindow write FDefaultWindow;
     property ScanHtmlContents  : Boolean read fScanHtmlContents write fScanHtmlContents;
+    property ReadmeMessage : String read FReadmeMessage write FReadmeMessage;
     property AllowedExtensions : TStringList read FAllowedExtensions;
   end;
 
@@ -1052,7 +1054,7 @@ begin
   Writer.HasBinaryIndex := MakeBinaryIndex;
   Writer.IndexName := IndexFileName;
   Writer.TocName   := TableOfContentsFileName;
-
+  Writer.ReadmeMessage := ReadmeMessage;
   for i:=0 to files.count-1 do
     begin
       nd:=TChmContextNode(files.objects[i]);

+ 5 - 1
packages/chm/src/chmwriter.pas

@@ -78,6 +78,7 @@ Type
     HeaderSuffix: TITSFHeaderSuffix; //contains the offset of CONTENTSection0 from zero
     HeaderSection0: TITSPHeaderPrefix;
     HeaderSection1: TITSPHeader; // DirectoryListings header
+    FReadmeMessage : String;
     // DirectoryListings
     // CONTENT Section 0 (section 1 is contained in section 0)
     // EOF
@@ -125,6 +126,7 @@ Type
     property OnLastFile: TNotifyEvent read FOnLastFile write FOnLastFile;
     property OutStream: TStream read FOutStream;
     property TempRawStream: TStream read FTempStream write SetTempRawStream;
+    property ReadmeMessage : String read fReadmeMessage write fReadmeMessage;
     //property LocaleID: dword read ITSFHeader.LanguageID write ITSFHeader.LanguageID;
   end;
 
@@ -525,7 +527,7 @@ begin
 end;
 
 procedure TITSFWriter.WriteREADMEFile;
-const DISCLAIMER_STR = 'This archive was not made by the MS HTML Help Workshop(r)(tm) program.';
+const DISCLAIMER_STR = 'This archive was not made by the MS HTML Help Workshop(r)(tm) program, but by Free Pascal''s chm package '+chmpackageversion+'.'#13#10;
 var
   Entry: TFileEntryRec;
 begin
@@ -533,6 +535,8 @@ begin
   Entry.Compressed := False;
   Entry.DecompressedOffset := FSection0.Position;
   FSection0.Write(DISCLAIMER_STR, SizeOf(DISCLAIMER_STR));
+  if length(FReadmeMessage)>0 then
+    FSection0.Write(FReadmeMessage[1], length(FReadmeMessage));
   Entry.DecompressedSize := FSection0.Position - Entry.DecompressedOffset;
   Entry.Path := '/';
   Entry.Name := '_#_README_#_'; //try to use a name that won't conflict with normal names