瀏覽代碼

Added new special-purpose HelpTextNote message that can be used to specify one or more lines of text that are added to the list of parameters in the summary shown when passing /HELP on the command line.

Martijn Laan 7 年之前
父節點
當前提交
5a97667282
共有 10 個文件被更改,包括 100 次插入74 次删除
  1. 1 0
      Files/Default.isl
  2. 8 1
      Files/Languages/Setup/Default.iss
  3. 5 1
      Files/Languages/Setup/Italian.iss
  4. 8 1
      ISHelp/isetup.xml
  5. 1 1
      Projects/Compile.pas
  6. 2 1
      Projects/MsgIDs.pas
  7. 68 66
      Projects/SetupLdr.dpr
  8. 1 1
      Projects/Struct.pas
  9. 1 1
      setup.iss
  10. 5 1
      whatsnew.htm

+ 1 - 0
Files/Default.isl

@@ -42,6 +42,7 @@ ErrorTitle=Error
 SetupLdrStartupMessage=This will install %1. Do you wish to continue?
 LdrCannotCreateTemp=Unable to create a temporary file. Setup aborted
 LdrCannotExecTemp=Unable to execute file in the temporary directory. Setup aborted
+HelpTextNote=
 
 ; *** Startup error messages
 LastErrorMessage=%1.%n%nError %2: %3

+ 8 - 1
Files/Languages/Setup/Default.iss

@@ -1,9 +1,16 @@
-; *** Inno Setup installer messages ***
+; *** Inno Setup version 5.7.0+ English installer messages ***
 ;
 ; Note: When translating this text, do not add periods (.) to the end of
 ; messages that didn't have them already, because on those messages Inno
 ; Setup adds the periods automatically (appending a period would result in
 ; two periods being displayed).
+;
+; Also note: Before translating this text, make sure to prefix all messages
+; with your language's internal name followed by a period. See Italian.iss
+; for an example.
+
+[Messages]
+HelpTextNote=/PORTABLE=1%nEnable portable mode.
 
 [CustomMessages]
 ISPPTitle=Inno Setup Preprocessor

+ 5 - 1
Files/Languages/Setup/Italian.iss

@@ -1,10 +1,14 @@
-; *** Inno Setup Italian installer messages ***
+; *** Inno Setup version 5.7.0+ Italian installer messages ***
 ;
 ; Note: When translating this text, do not add periods (.) to the end of
 ; messages that didn't have them already, because on those messages Inno
 ; Setup adds the periods automatically (appending a period would result in
 ; two periods being displayed).
 ;
+; Also note: Before translating this text, make sure to prefix all messages
+; with your language's internal name followed by a period. See Italian.iss
+; for an example.
+;
 ; Italian.isl - Last Update: 19.06.2018  by bovirus ([email protected])
 ;
 ; Translator name:   bovirus

+ 8 - 1
ISHelp/isetup.xml

@@ -2108,13 +2108,20 @@ en.ButtonNext=&Forward >
 
 <heading>Special-purpose IDs</heading>
 
-<p>The special-purpose <a name="BeveledLabel"><tt>BeveledLabel</tt></a> message can be used to specify a line of text that is shown in the lower left corner of the wizard window and uninstaller window. The following is an example:</p>
+<p>The <a name="BeveledLabel"><tt>BeveledLabel</tt></a> message can be used to specify a line of text that is shown in the lower left corner of the wizard window and uninstaller window. The following is an example:</p>
 
 <precode>
 [Messages]
 BeveledLabel=Inno Setup
 </precode>
 
+<p>The <tt>HelpTextNote</tt> message can be used to specify one or more lines of text that are added to the list of parameters in the summary shown when passing <link topic="setupcmdline" anchor="HELP">/HELP</link> on the command line. The following is an example:</p>
+
+<precode>
+[Messages]
+HelpTextNote=/PORTABLE=1%nEnable portable mode.
+</precode>
+
 </body>
 </topic>
 

+ 1 - 1
Projects/Compile.pas

@@ -7293,7 +7293,7 @@ begin
     for J := Low(LangData.Messages) to High(LangData.Messages) do
       if not LangData.MessagesDefined[J] then begin
         { Use the message from Default.isl }
-        if J <> msgTranslatorNote then
+        if not (J in [msgHelpTextNote, msgTranslatorNote]) then
           WarningsList.Add(Format(SCompilerMessagesMissingMessageWarning,
             [Copy(GetEnumName(TypeInfo(TSetupMessageID), Ord(J)), 4, Maxint),
              PSetupLanguageEntry(LanguageEntries[I]).Name]));

+ 2 - 1
Projects/MsgIDs.pas

@@ -108,6 +108,7 @@ type
     msgFinishedRestartMessage, 
     msgFullInstallation,
     msgGroupNameTooLong,
+    msgHelpTextNote,
     msgIncorrectPassword,
     msgInfoAfterClickLabel,
     msgInfoAfterLabel,
@@ -237,7 +238,7 @@ type
     msgWizardUninstalling,
     msgWizardUserInfo,
     msgYesRadio);
-
+    
 implementation
 
 end.

+ 68 - 66
Projects/SetupLdr.dpr

@@ -279,7 +279,7 @@ begin
     SetupCorruptError;
 end;
 
-procedure ShowHelp;
+procedure ShowHelp(const CustomNote: String);
 const
   SNewLine = #13#10;
 var
@@ -337,6 +337,7 @@ begin
           'Like the /TASKS parameter, except the specified tasks will be merged with the set of tasks that would have otherwise been selected by default.' + SNewLine +
           '/PASSWORD=password' + SNewLine +
           'Specifies the password to use.' + SNewLine +
+          CustomNote +
           SNewLine +
           'For more detailed information, please visit http://www.jrsoftware.org/ishelp/index.php?topic=setupcmdline';
 
@@ -363,11 +364,6 @@ begin
 
     ProcessCommandLine;
     
-    if InitShowHelp then begin
-      ShowHelp;
-      Halt(0);
-    end;
-
     SelfFilename := NewParamStr(0);
     SourceF := TFile.Create(SelfFilename, fdOpenExisting, faRead, fsRead);
     try
@@ -402,82 +398,88 @@ begin
         on ECompressDataError do
           SetupCorruptError;
       end;
-
+      
       ActivateDefaultLanguage;
 
-      { Show the startup prompt. If this is enabled, SetupHeader.AppName won't
-        have constants. }
-      if not(shDisableStartupPrompt in SetupHeader.Options) and
-         not InitDisableStartupPrompt and
-         (MessageBox(0, PChar(FmtSetupMessage1(msgSetupLdrStartupMessage, SetupHeader.AppName)),
-           PChar(SetupMessages[msgSetupAppTitle]), MB_YESNO or MB_ICONQUESTION) <> IDYES) then begin
-        SetupLdrExitCode := ecCancelledBeforeInstall;
-        Abort;
-      end;
+      if InitShowHelp then begin
+        { Show the command line help. }
+        ShowHelp(SetupMessages[msgHelpTextNote]);
+        SetupLdrExitCode := 0;
+      end else begin
+        { Show the startup prompt. If this is enabled, SetupHeader.AppName won't
+          have constants. }
+        if not(shDisableStartupPrompt in SetupHeader.Options) and
+           not InitDisableStartupPrompt and
+           (MessageBox(0, PChar(FmtSetupMessage1(msgSetupLdrStartupMessage, SetupHeader.AppName)),
+             PChar(SetupMessages[msgSetupAppTitle]), MB_YESNO or MB_ICONQUESTION) <> IDYES) then begin
+          SetupLdrExitCode := ecCancelledBeforeInstall;
+          Abort;
+        end;
 
-      { Create a temporary directory, and extract the embedded setup program
-        there }
-      Randomize;
-      TempDir := CreateTempDir;
-      S := AddBackslash(TempDir) + PathChangeExt(PathExtractName(SelfFilename), '.tmp');
-      TempFile := S;  { assign only if string was successfully constructed }
+        { Create a temporary directory, and extract the embedded setup program
+          there }
+        Randomize;
+        TempDir := CreateTempDir;
+        S := AddBackslash(TempDir) + PathChangeExt(PathExtractName(SelfFilename), '.tmp');
+        TempFile := S;  { assign only if string was successfully constructed }
 
-      SourceF.Seek(OffsetTable.OffsetEXE);
+        SourceF.Seek(OffsetTable.OffsetEXE);
 
-      try
-        P := nil;
-        DestF := TFile.Create(TempFile, fdCreateAlways, faWrite, fsNone);
         try
-          GetMem(P, OffsetTable.UncompressedSizeEXE);
-          FillChar(P^, OffsetTable.UncompressedSizeEXE, 0);
+          P := nil;
+          DestF := TFile.Create(TempFile, fdCreateAlways, faWrite, fsNone);
           try
-            Reader := TCompressedBlockReader.Create(SourceF, TLZMA1SmallDecompressor);
+            GetMem(P, OffsetTable.UncompressedSizeEXE);
+            FillChar(P^, OffsetTable.UncompressedSizeEXE, 0);
             try
-              Reader.Read(P^, OffsetTable.UncompressedSizeEXE);
-            finally
-              Reader.Free;
+              Reader := TCompressedBlockReader.Create(SourceF, TLZMA1SmallDecompressor);
+              try
+                Reader.Read(P^, OffsetTable.UncompressedSizeEXE);
+              finally
+                Reader.Free;
+              end;
+            except
+              on ECompressDataError do
+                SetupCorruptError;
             end;
-          except
-            on ECompressDataError do
+            TransformCallInstructions(P^, OffsetTable.UncompressedSizeEXE, False, 0);
+            if GetCRC32(P^, OffsetTable.UncompressedSizeEXE) <> OffsetTable.CRCEXE then
               SetupCorruptError;
+            { Preallocate the bytes to avoid file system fragmentation }
+            DestF.Seek(OffsetTable.UncompressedSizeEXE);
+            DestF.Truncate;
+            DestF.Seek(0);
+            DestF.WriteBuffer(P^, OffsetTable.UncompressedSizeEXE);
+          finally
+            FreeMem(P);
+            DestF.Free;
+          end;
+        except
+          on E: EFileError do begin
+            SetLastError(E.ErrorCode);
+            RaiseLastError(msgLdrCannotCreateTemp);
           end;
-          TransformCallInstructions(P^, OffsetTable.UncompressedSizeEXE, False, 0);
-          if GetCRC32(P^, OffsetTable.UncompressedSizeEXE) <> OffsetTable.CRCEXE then
-            SetupCorruptError;
-          { Preallocate the bytes to avoid file system fragmentation }
-          DestF.Seek(OffsetTable.UncompressedSizeEXE);
-          DestF.Truncate;
-          DestF.Seek(0);
-          DestF.WriteBuffer(P^, OffsetTable.UncompressedSizeEXE);
-        finally
-          FreeMem(P);
-          DestF.Free;
-        end;
-      except
-        on E: EFileError do begin
-          SetLastError(E.ErrorCode);
-          RaiseLastError(msgLdrCannotCreateTemp);
         end;
-      end;
 
-      FreeAndNil(SourceF);
+        FreeAndNil(SourceF);
 
-      { Create SetupLdrWnd, which is used by Setup to communicate with
-        SetupLdr }
-      SetupLdrWnd := CreateWindowEx(0, 'STATIC', 'InnoSetupLdrWindow', 0,
-        0, 0, 0, 0, HWND_DESKTOP, 0, HInstance, nil);
-      Longint(OrigWndProc) := SetWindowLong(SetupLdrWnd, GWL_WNDPROC,
-        Longint(@SetupLdrWndProc));
+        { Create SetupLdrWnd, which is used by Setup to communicate with
+          SetupLdr }
+        SetupLdrWnd := CreateWindowEx(0, 'STATIC', 'InnoSetupLdrWindow', 0,
+          0, 0, 0, 0, HWND_DESKTOP, 0, HInstance, nil);
+        Longint(OrigWndProc) := SetWindowLong(SetupLdrWnd, GWL_WNDPROC,
+          Longint(@SetupLdrWndProc));
 
-      { Now execute Setup. Use the exit code it returns as our exit code. }
-      ExecAndWait(TempFile, Format('/SL5="$%x,%d,%d,',
-        [SetupLdrWnd, OffsetTable.Offset0, OffsetTable.Offset1]) +
-        SelfFilename + '" ' + GetCmdTail, SetupLdrExitCode);
+        { Now execute Setup. Use the exit code it returns as our exit code. }
+        ExecAndWait(TempFile, Format('/SL5="$%x,%d,%d,',
+          [SetupLdrWnd, OffsetTable.Offset0, OffsetTable.Offset1]) +
+          SelfFilename + '" ' + GetCmdTail, SetupLdrExitCode);
 
-      { Synchronize our active language with Setup's, in case we need to
-        display any messages below } 
-      if PendingNewLanguage <> -1 then
-        SetActiveLanguage(PendingNewLanguage);
+        { Synchronize our active language with Setup's, in case we need to
+          display any messages below } 
+        if PendingNewLanguage <> -1 then
+          SetActiveLanguage(PendingNewLanguage);
+      end;
     finally
       SourceF.Free;
       if TempFile <> '' then

+ 1 - 1
Projects/Struct.pas

@@ -36,7 +36,7 @@ const
   SetupID: TSetupID = 'Inno Setup Setup Data (5.6.0)'{$IFDEF UNICODE}+' (u)'{$ENDIF};
   UninstallLogID: array[Boolean] of TUninstallLogID =
     ('Inno Setup Uninstall Log (b)', 'Inno Setup Uninstall Log (b) 64-bit');
-  MessagesHdrID: TMessagesHdrID = 'Inno Setup Messages (5.5.3)'{$IFDEF UNICODE}+' (u)'{$ENDIF};
+  MessagesHdrID: TMessagesHdrID = 'Inno Setup Messages (5.7.0)'{$IFDEF UNICODE}+' (u)'{$ENDIF};
   MessagesLangOptionsID: TMessagesLangOptionsID = '!mlo!001';
   ZLIBID: TCompID = 'zlb'#26;
   DiskSliceID: TDiskSliceID = 'idska32'#26;

+ 1 - 1
setup.iss

@@ -87,7 +87,7 @@ SignedUninstaller=yes
 Name: english; MessagesFile: "files\Default.isl"
 ; Generate [Languages] entries for all official translations
 #expr FindFiles("files\Languages\", "isl", 0)
-; #include any translations for [CustomMessages] (includes the default custom messages)
+; Include translations of messages used by this script (includes the default messages)
 #expr FindFiles("files\Languages\Setup\", "iss", 1)
 
 [Messages]

+ 5 - 1
whatsnew.htm

@@ -29,7 +29,11 @@ For conditions of distribution and use, see <a href="http://www.jrsoftware.org/f
 <p><a name="5.6.2"></a><span class="ver">5.6.2 </span><span class="date">(?)</span></p>
 <ul>
 <li>Added new [Setup] section directive: <tt>VersionInfoOriginalFileName</tt>, which sets the original filename version value.</li>
-<li>Pascal Scripting changes: Added new <tt>SameStr</tt> and <tt>SameText</tt> support functions.</li>
+<li>Pascal Scripting changes:
+<ul>
+  <li>Added new special-purpose <i>HelpTextNote</i> message that can be used to specify one or more lines of text that are added to the list of parameters in the summary shown when passing /HELP on the command line.</li>
+  <li>Added new <tt>SameStr</tt> and <tt>SameText</tt> support functions.</li>
+</ul>
 <li>Inno Setup Preprocessor (ISPP) changes:
 <ul>
    <li>Added new predefined variable <tt>NewLine</tt>.</li>