Преглед на файлове

Tweaks based on Jordan's feedback.

Martijn Laan преди 6 години
родител
ревизия
7762ca369b
променени са 7 файла, в които са добавени 48 реда и са изтрити 38 реда
  1. 7 6
      Files/Default.isl
  2. 7 6
      Files/Languages/Dutch.isl
  3. 8 6
      Projects/Main.pas
  4. 7 6
      Projects/MsgIDs.pas
  5. 1 1
      Projects/ScriptFunc_R.pas
  6. 15 10
      Projects/TaskDialog.pas
  7. 3 3
      whatsnew.htm

+ 7 - 6
Files/Default.isl

@@ -66,12 +66,13 @@ UninstallAppRunningError=Uninstall has detected that %1 is currently running.%n%
 
 ; *** Startup questions
 PrivilegesRequiredOverrideInstruction=Choose install mode
-PrivilegesRequiredOverrideContent1=This program can be installed for all users (recommended, but requires administrative privileges), or for yourself only.
-PrivilegesRequiredOverrideContent1WithQuestion=%1%n%nInstall for all users?
-PrivilegesRequiredOverrideConfirm1=Install for all users%nThe program will be available for all users on this computer.
-PrivilegesRequiredOverrideContent2=This program can be installed for yourself only (recommended), or for all users (requires administrative privileges).
-PrivilegesRequiredOverrideContent2WithQuestion=%1%n%nInstall for yourself only?
-PrivilegesRequiredOverrideConfirm2=Install for myself only%nThe program will be available for yourself only.
+PrivilegesRequiredOverrideTaskDialogText1=This program can be installed for all users (requires administrative privileges), or for you only.
+PrivilegesRequiredOverrideMsgBoxText1=This program can be installed for all users (recommended, but requires administrative privileges), or for you only.%n%nInstall for all users?
+PrivilegesRequiredOverrideTaskDialogText2=This program can be installed for you only, or for all users (requires administrative privileges).
+PrivilegesRequiredOverrideMsgBoxText2=This program can be installed for you only (recommended), or for all users (requires administrative privileges).%n%nInstall for you only?
+PrivilegesRequiredOverrideAllUsers=Install for all users
+PrivilegesRequiredOverrideCurrentUser=Install for me only
+PrivilegesRequiredOverrideRecommended=%1 (recommended)
 
 ; *** Misc. errors
 ErrorCreatingDir=Setup was unable to create the directory "%1"

+ 7 - 6
Files/Languages/Dutch.isl

@@ -49,12 +49,13 @@ UninstallAppRunningError=Het verwijderprogramma heeft vastgesteld dat %1 op dit
 
 ; *** Startup questions
 PrivilegesRequiredOverrideInstruction=Kies installatie modus
-PrivilegesRequiredOverrideContent1=Dit programma kan geïnstalleerd worden voor alle gebruikers (aanbevolen, maar vereist aanmelding als een systeembeheerder), of voor uzelf alleen.
-PrivilegesRequiredOverrideContent1WithQuestion=%1%n%nWilt u voor alle gebruikers installeren?
-PrivilegesRequiredOverrideConfirm1=Installeer voor alle gebruikers%nHet programma zal beschikbaar zijn voor alle gebruikers op deze computer.
-PrivilegesRequiredOverrideContent2=Dit programma kan geïnstalleerd worden voor uzelf alleen (aanbevolen), of voor alle gebruikers (vereist aanmelding als een systeembeheerder).
-PrivilegesRequiredOverrideContent2WithQuestion=%1%n%nWilt u voor uzelf alleen installeren?
-PrivilegesRequiredOverrideConfirm2=Installeer voor mijzelf alleen%nHet programma zal beschikbaar zijn voor uzelf alleen.
+PrivilegesRequiredOverrideTaskDialogText1=Dit programma kan geïnstalleerd worden voor alle gebruikers (vereist aanmelding als een systeembeheerder), of voor u alleen.
+PrivilegesRequiredOverrideMsgBoxText1=Dit programma kan geïnstalleerd worden voor alle gebruikers (aanbevolen, maar vereist aanmelding als een systeembeheerder), of voor u alleen.%n%nWilt u voor alle gebruikers installeren?
+PrivilegesRequiredOverrideTaskDialogText2=Dit programma kan geïnstalleerd worden voor u alleen, of voor alle gebruikers (vereist aanmelding als een systeembeheerder).
+PrivilegesRequiredOverrideMsgBoxText2=Dit programma kan geïnstalleerd worden voor u alleen (aanbevolen), of voor alle gebruikers (vereist aanmelding als een systeembeheerder).%n%nWilt u voor u alleen installeren?
+PrivilegesRequiredOverrideAllUsers=Installeer voor alle gebruikers
+PrivilegesRequiredOverrideCurrentUser=Installeer voor mij alleen
+PrivilegesRequiredOverrideRecommended=%1 (aanbevolen)
 
 ; *** Misc. errors
 ErrorCreatingDir=Setup kan de map "%1" niet maken

+ 8 - 6
Projects/Main.pas

@@ -2973,9 +2973,10 @@ begin
             Afterwards we need to tell the respawned Setup about the user choice (and avoid it asking agin). Will use the
             command line parameter for this. Allowing proMsgBox forces allowing proCommandLine, so we can count on the parameter to work. }
           if SetupHeader.PrivilegesRequired = prLowest then begin
-            case TaskDialogMsgBox(SetupMessages[msgPrivilegesRequiredOverrideInstruction], SetupMessages[msgPrivilegesRequiredOverrideContent2],
-                   FmtSetupMessage(msgPrivilegesRequiredOverrideContent2WithQuestion, [SetupMessages[msgPrivilegesRequiredOverrideContent2]]),
-                   SetupMessages[msgSetupAppTitle], mbInformation, MB_YESNOCANCEL, [SetupMessages[msgPrivilegesRequiredOverrideConfirm2], SetupMessages[msgPrivilegesRequiredOverrideConfirm1]], IDNO, False) of
+            case TaskDialogMsgBox('MAINICON', SetupMessages[msgPrivilegesRequiredOverrideInstruction],
+                   SetupMessages[msgPrivilegesRequiredOverrideTaskDialogText2], SetupMessages[msgPrivilegesRequiredOverrideMsgBoxText2],
+                   SetupMessages[msgSetupAppTitle], mbInformation, MB_YESNOCANCEL,
+                   [FmtSetupMessage(msgPrivilegesRequiredOverrideRecommended, [SetupMessages[msgPrivilegesRequiredOverrideCurrentUser]]), SetupMessages[msgPrivilegesRequiredOverrideAllUsers]], IDNO, False) of
               IDYES:
                 ExtraRespawnParam := '/CURRENTUSER';
               IDNO:
@@ -2987,9 +2988,10 @@ begin
                 Abort;
               end;
           end else begin
-            case TaskDialogMsgBox(SetupMessages[msgPrivilegesRequiredOverrideInstruction], SetupMessages[msgPrivilegesRequiredOverrideContent1],
-                   FmtSetupMessage(msgPrivilegesRequiredOverrideContent2WithQuestion, [SetupMessages[msgPrivilegesRequiredOverrideContent2]]),
-                   SetupMessages[msgSetupAppTitle], mbInformation, MB_YESNOCANCEL, [SetupMessages[msgPrivilegesRequiredOverrideConfirm1], SetupMessages[msgPrivilegesRequiredOverrideConfirm2]], IDYES, False) of
+            case TaskDialogMsgBox('MAINICON', SetupMessages[msgPrivilegesRequiredOverrideInstruction],
+                   SetupMessages[msgPrivilegesRequiredOverrideTaskDialogText1], SetupMessages[msgPrivilegesRequiredOverrideMsgBoxText1],
+                   SetupMessages[msgSetupAppTitle], mbInformation, MB_YESNOCANCEL,
+                   [FmtSetupMessage(msgPrivilegesRequiredOverrideRecommended, [SetupMessages[msgPrivilegesRequiredOverrideAllUsers]]), SetupMessages[msgPrivilegesRequiredOverrideCurrentUser]], IDYES, False) of
               IDYES:
                 ExtraRespawnParam := '/ALLUSERS';
               IDNO:

+ 7 - 6
Projects/MsgIDs.pas

@@ -147,12 +147,13 @@ type
     msgPreparingDesc,
     msgPreviousInstallNotCompleted,
     msgPrivilegesRequiredOverrideInstruction,
-    msgPrivilegesRequiredOverrideContent1,
-    msgPrivilegesRequiredOverrideContent1WithQuestion,
-    msgPrivilegesRequiredOverrideConfirm1,
-    msgPrivilegesRequiredOverrideContent2,
-    msgPrivilegesRequiredOverrideContent2WithQuestion,
-    msgPrivilegesRequiredOverrideConfirm2,
+    msgPrivilegesRequiredOverrideTaskDialogText1,
+    msgPrivilegesRequiredOverrideMsgBoxText1,
+    msgPrivilegesRequiredOverrideTaskDialogText2,
+    msgPrivilegesRequiredOverrideMsgBoxText2,
+    msgPrivilegesRequiredOverrideAllUsers,
+    msgPrivilegesRequiredOverrideCurrentUser,
+    msgPrivilegesRequiredOverrideRecommended,
     msgReadyLabel1,
     msgReadyLabel2a,
     msgReadyLabel2b,

+ 1 - 1
Projects/ScriptFunc_R.pas

@@ -1535,7 +1535,7 @@ begin
     SetLength(ButtonLabels, N);
     for I := 0 to N-1 do
       ButtonLabels[I] := VNGetString(PSGetArrayField(Arr, I));
-    Stack.SetInt(PStart, TaskDialogMsgBox(Stack.GetString(PStart-1), Stack.GetString(PStart-2), Stack.GetString(PStart-3), GetMsgBoxCaption, TMsgBoxType(Stack.GetInt(PStart-4)), Stack.GetInt(PStart-5), ButtonLabels, Stack.GetInt(PStart-7), Stack.GetBool(PStart-8)));
+    Stack.SetInt(PStart, TaskDialogMsgBox('', Stack.GetString(PStart-1), Stack.GetString(PStart-2), Stack.GetString(PStart-3), GetMsgBoxCaption, TMsgBoxType(Stack.GetInt(PStart-4)), Stack.GetInt(PStart-5), ButtonLabels, Stack.GetInt(PStart-7), Stack.GetBool(PStart-8)));
   end else
     Result := False;
 end;

+ 15 - 10
Projects/TaskDialog.pas

@@ -14,7 +14,7 @@ interface
 uses
   CmnFunc;
 
-function TaskDialogMsgBox(const Instruction, TaskDialogText, MsgBoxText, Caption: String; const Typ: TMsgBoxType; const Buttons: Cardinal; const ButtonLabels: array of String; const ShieldButton: Integer; const ForceMsgBox: Boolean): Integer;
+function TaskDialogMsgBox(const Icon, Instruction, TaskDialogText, MsgBoxText, Caption: String; const Typ: TMsgBoxType; const Buttons: Cardinal; const ButtonLabels: array of String; const ShieldButton: Integer; const ForceMsgBox: Boolean): Integer;
 
 implementation
 
@@ -52,6 +52,7 @@ begin
         Config.dwFlags := Config.dwFlags or TDF_RTL_LAYOUT;
       { If the application window isn't currently visible, show the task dialog
         with no owner window so it'll get a taskbar button } 
+      Config.hInstance := HInstance;
       if IsIconic(Application.Handle) or
          (GetWindowLong(Application.Handle, GWL_STYLE) and WS_VISIBLE = 0) or
          (GetWindowLong(Application.Handle, GWL_EXSTYLE) and WS_EX_TOOLWINDOW <> 0) then
@@ -101,19 +102,23 @@ begin
     Result := False;
 end;
 
-function TaskDialogMsgBox(const Instruction, TaskDialogText, MsgBoxText, Caption: String; const Typ: TMsgBoxType; const Buttons: Cardinal; const ButtonLabels: array of String; const ShieldButton: Integer; const ForceMsgBox: Boolean): Integer;
+function TaskDialogMsgBox(const Icon, Instruction, TaskDialogText, MsgBoxText, Caption: String; const Typ: TMsgBoxType; const Buttons: Cardinal; const ButtonLabels: array of String; const ShieldButton: Integer; const ForceMsgBox: Boolean): Integer;
 var
-  Icon: PChar;
+  IconP: PChar;
   TDCommonButtons: Cardinal;
   NButtonLabelsAvailable: Integer;
   ButtonIDs: array of Integer;
 begin
-  case Typ of
-    mbInformation: Icon := TD_INFORMATION_ICON;
-    mbError: Icon := TD_WARNING_ICON;
-    mbCriticalError: Icon := TD_ERROR_ICON;
-  else
-    Icon := nil; { No other TD_ constant available, MS recommends to use no icon for questions now and the old icon should only be used for help entries }
+  if Icon <> '' then
+    IconP := PChar(Icon)
+  else begin
+    case Typ of
+      mbInformation: IconP := TD_INFORMATION_ICON;
+      mbError: IconP := TD_WARNING_ICON;
+      mbCriticalError: IconP := TD_ERROR_ICON;
+    else
+      IconP := nil; { No other TD_ constant available, MS recommends to use no icon for questions now and the old icon should only be used for help entries }
+    end;
   end;
   NButtonLabelsAvailable := Length(ButtonLabels);
   case Buttons of
@@ -161,7 +166,7 @@ begin
     InternalError('TaskDialogMsgBox: Invalid ButtonLabels');
   if ForceMsgBox or
      not DoTaskDialog(Application.Handle, PChar(Instruction), PChar(TaskDialogText),
-           GetMessageBoxCaption(PChar(Caption), Typ), Icon, TDCommonButtons, ButtonLabels, ButtonIDs, ShieldButton,
+           GetMessageBoxCaption(PChar(Caption), Typ), IconP, TDCommonButtons, ButtonLabels, ButtonIDs, ShieldButton,
            GetMessageBoxRightToLeft, IfThen(Typ = mbCriticalError, MB_ICONSTOP, 0), Result) then
     Result := MsgBox(MsgBoxText, IfThen(Instruction <> '', Instruction, Caption), Typ, Buttons);
 end;

+ 3 - 3
whatsnew.htm

@@ -56,7 +56,7 @@ For conditions of distribution and use, see <a href="http://www.jrsoftware.org/f
   <li>Added new [Setup] section directive: <tt>PrivilegesRequiredOverridesAllowed</tt>, which can be set to one or more overrides which allow the end user to override the script's default <tt>PrivilegesRequired</tt> setting. The following overrides are supported: <tt>commandline</tt> and <tt>msgbox</tt>.</li>
   <ul>
     <li>If override <tt>commandline</tt> is allowed then Setup will support two additional command line parameters to override the script's default <tt>PrivilegesRequired</tt> setting: /ALLUSERS and /CURRENTUSER.</li>
-    <li>If override <tt>msgbox</tt> is allowed then Setup will ask the user to choose the install mode based on the script's default <tt>PrivilegesRequired</tt> setting (<a href="https://i.imgur.com/YoYvRh0.png">example</a> if <tt>PrivilegesRequired</tt> is set to <tt>admin</tt>). Allowing <tt>msgbox</tt> automatically allows <tt>commandline</tt> and when one of the command line parameters is used then Setup will not ask the user.</li>
+    <li>If override <tt>msgbox</tt> is allowed then Setup will ask the user to choose the install mode based on the script's default <tt>PrivilegesRequired</tt> setting (<a href="https://i.imgur.com/9tjXjmg.png">example</a> if <tt>PrivilegesRequired</tt> is set to <tt>admin</tt>). Allowing <tt>msgbox</tt> automatically allows <tt>commandline</tt> and when one of the command line parameters is used then Setup will not ask the user.</li>
   </ul>
   <li>Inno Setup's own installer now supports both administrative and non administrative mode and allows the <tt>commandline</tt> override.</li>
 </ul>
@@ -83,7 +83,7 @@ For conditions of distribution and use, see <a href="http://www.jrsoftware.org/f
 <li>Pascal Scripting changes:
 <ul>
   <li>Using event attributes it is now possible to have multiple implementations of the same event function in your script. This is especially useful in included scripts implementing an event function to avoid conflicts with the main script. See the help file for more information and the <i>CodeExample1.iss</i> example script for an example.</li>
-  <li>Added new <tt>TaskDialogMsgBox</tt> support function which shows a task dialog if supported by the system and a regular message box otherwise. See the help file for more information and the <i>CodeClasses.iss</i> example script for an example.</li>
+  <li>Added new <tt>TaskDialogMsgBox</tt> support function which shows a task dialog if supported by the system and a regular message box otherwise (<a href="https://i.imgur.com/hU4RQP2.png">example</a>). See the help file for more information and the <i>CodeClasses.iss</i> example script for an example.</li>
   <li>[Setup] section directives <tt>ChangesAssociations</tt> and <tt>ChangesEnvironment</tt> may now be set to a boolean expression, which may contain calls to check functions.</li>
   <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. This message defaults to an empty string so make sure to provide a non-empty default for all languages from your main script if you want to use it.</li>
   <li>Added new <tt>SameStr</tt> and <tt>SameText</tt> support functions.</li>
@@ -109,7 +109,7 @@ For conditions of distribution and use, see <a href="http://www.jrsoftware.org/f
 
 <p>Some messages have been added in this version:<!-- (<a href="https://github.com/jrsoftware/issrc/commit/b0cd1a0177b818e36734026c67dc24f01ad6a0d0">View differences in Default.isl</a>).--></p>
 <ul>
-  <li><b>New messages:</b> PrivilegesRequiredOverrideInstruction, PrivilegesRequiredOverrideContent1, PrivilegesRequiredOverrideContent1WithQuestion, PrivilegesRequiredOverrideConfirm1, PrivilegesRequiredOverrideContent2, PrivilegesRequiredOverrideContent2WithQuestion, PrivilegesRequiredOverrideConfirm2, UninstallDisplayNameMark, UninstallDisplayNameMarks, UninstallDisplayNameMark32Bit, UninstallDisplayNameMark64Bit, UninstallDisplayNameMarkAllUsers, UninstallDisplayNameCurrentUser.</li>
+  <li><b>New messages:</b> PrivilegesRequiredOverrideInstruction, PrivilegesRequiredOverrideTaskDialogText1, PrivilegesRequiredOverrideMsgBoxText1, PrivilegesRequiredOverrideTaskDialogText2, PrivilegesRequiredOverrideMsgBoxText2, PrivilegesRequiredOverrideAllUsers, PrivilegesRequiredOverrideCurrentUser, PrivilegesRequiredOverrideRecommended, UninstallDisplayNameMark, UninstallDisplayNameMarks, UninstallDisplayNameMark32Bit, UninstallDisplayNameMark64Bit, UninstallDisplayNameMarkAllUsers, UninstallDisplayNameCurrentUser.</li>
 </ul>
 
 <p>Note: Only the official English and Dutch (Netherlands) translations have been updated for these changes at this moment. See the <a href="http://www.jrsoftware.org/files/istrans/">Inno Setup Translations</a> page for more information.</p>