Browse Source

Introduce true objects for WizardForm so they can be evaluated. Was actually like this a long time ago. Think it was removed to be able to show a nicer internal error on early access but I rather be able to evaluate the objects.

Martijn Laan 6 years ago
parent
commit
ee5b9113f1
4 changed files with 20 additions and 4 deletions
  1. 5 3
      Projects/ScriptClasses_C.pas
  2. 9 1
      Projects/ScriptClasses_R.pas
  3. 4 0
      Projects/ScriptRunner.pas
  4. 2 0
      whatsnew.htm

+ 5 - 3
Projects/ScriptClasses_C.pas

@@ -2,13 +2,11 @@ unit ScriptClasses_C;
 
 
 {
 {
   Inno Setup
   Inno Setup
-  Copyright (C) 1997-2011 Jordan Russell
+  Copyright (C) 1997-2019 Jordan Russell
   Portions by Martijn Laan
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
   For conditions of distribution and use, see LICENSE.TXT.
 
 
   Script support classes (compile time)
   Script support classes (compile time)
-
-  $Id: ScriptClasses_C.pas,v 1.69 2012/02/05 18:59:23 mlaan Exp $
 }
 }
 
 
 interface
 interface
@@ -652,6 +650,10 @@ begin
   RegisterOutputProgressWizardPage_C(Cl);
   RegisterOutputProgressWizardPage_C(Cl);
 
 
   RegisterHandCursor_C(Cl);
   RegisterHandCursor_C(Cl);
+  
+  AddImportedClassVariable(Cl, 'WizardForm', 'TWizardForm');
+  AddImportedClassVariable(Cl, 'MainForm', 'TMainForm');
+  AddImportedClassVariable(Cl, 'UninstallProgressForm', 'TUninstallProgressForm');
 end;
 end;
 
 
 end.
 end.

+ 9 - 1
Projects/ScriptClasses_R.pas

@@ -2,7 +2,7 @@ unit ScriptClasses_R;
 
 
 {
 {
   Inno Setup
   Inno Setup
-  Copyright (C) 1997-2018 Jordan Russell
+  Copyright (C) 1997-2019 Jordan Russell
   Portions by Martijn Laan
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
   For conditions of distribution and use, see LICENSE.TXT.
 
 
@@ -17,6 +17,7 @@ uses
   uPSRuntime;
   uPSRuntime;
 
 
 function ScriptClassesLibraryRegister_R(ScriptInterpreter: TPSExec): TPSRuntimeClassImporter;
 function ScriptClassesLibraryRegister_R(ScriptInterpreter: TPSExec): TPSRuntimeClassImporter;
+procedure ScriptClassesLibraryUpdateVars(ScriptInterpreter: TIFPSExec);
 
 
 implementation
 implementation
 
 
@@ -624,4 +625,11 @@ begin
   Result := Cl;
   Result := Cl;
 end;
 end;
 
 
+procedure ScriptClassesLibraryUpdateVars(ScriptInterpreter: TIFPSExec);
+begin
+  SetVariantToClass(ScriptInterpreter.GetVarNo(ScriptInterpreter.GetVar('WIZARDFORM')), WizardForm);
+  SetVariantToClass(ScriptInterpreter.GetVarNo(ScriptInterpreter.GetVar('MAINFORM')), MainForm);
+  SetVariantToClass(ScriptInterpreter.GetVarNo(ScriptInterpreter.GetVar('UNINSTALLPROGRESSFORM')), UninstallProgressForm);
+end;
+
 end.
 end.

+ 4 - 0
Projects/ScriptRunner.pas

@@ -432,6 +432,7 @@ begin
   ProcNos := TPSList.Create;
   ProcNos := TPSList.Create;
   try
   try
     if GetProcNos(Name, CheckNamingAttribute, ProcNos) <> 0 then begin
     if GetProcNos(Name, CheckNamingAttribute, ProcNos) <> 0 then begin
+      ScriptClassesLibraryUpdateVars(FPSExec);
       for I := 0 to ProcNos.Count-1 do begin
       for I := 0 to ProcNos.Count-1 do begin
         Params := TPSList.Create();
         Params := TPSList.Create();
         try
         try
@@ -476,6 +477,7 @@ begin
          ((BreakCondition = bcNone) and (ProcNos.Count > 1)) then
          ((BreakCondition = bcNone) and (ProcNos.Count > 1)) then
         ShowError('Internal error: InternalRunBooleanFunction: invalid BreakCondition');
         ShowError('Internal error: InternalRunBooleanFunction: invalid BreakCondition');
       Result := True; { Silence compiler }
       Result := True; { Silence compiler }
+      ScriptClassesLibraryUpdateVars(FPSExec);
       for I := 0 to ProcNos.Count-1 do begin
       for I := 0 to ProcNos.Count-1 do begin
         Params := TPSList.Create();
         Params := TPSList.Create();
         try
         try
@@ -526,6 +528,7 @@ begin
          ((BreakCondition = bcNone) and (ProcNos.Count > 1)) then
          ((BreakCondition = bcNone) and (ProcNos.Count > 1)) then
         ShowError('Internal error: InternalRunIntegerFunction: invalid BreakCondition');
         ShowError('Internal error: InternalRunIntegerFunction: invalid BreakCondition');
       Result := 0; { Silence compiler }
       Result := 0; { Silence compiler }
+      ScriptClassesLibraryUpdateVars(FPSExec);
       for I := 0 to ProcNos.Count-1 do begin
       for I := 0 to ProcNos.Count-1 do begin
         Params := TPSList.Create();
         Params := TPSList.Create();
         try
         try
@@ -575,6 +578,7 @@ begin
          ((BreakCondition = bcNone) and (ProcNos.Count > 1)) then
          ((BreakCondition = bcNone) and (ProcNos.Count > 1)) then
         ShowError('Internal error: InternalRunStringFunction: invalid BreakCondition');
         ShowError('Internal error: InternalRunStringFunction: invalid BreakCondition');
       Result := ''; { Silence compiler }
       Result := ''; { Silence compiler }
+      ScriptClassesLibraryUpdateVars(FPSExec);
       for I := 0 to ProcNos.Count-1 do begin
       for I := 0 to ProcNos.Count-1 do begin
         Params := TPSList.Create();
         Params := TPSList.Create();
         try
         try

+ 2 - 0
whatsnew.htm

@@ -127,6 +127,8 @@ For conditions of distribution and use, see <a href="http://www.jrsoftware.org/f
     <li>Added new <tt>TaskDialogMsgBox</tt> and <tt>SuppressibleTaskDialogMsgBox</tt> support functions which display 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>Added new <tt>TaskDialogMsgBox</tt> and <tt>SuppressibleTaskDialogMsgBox</tt> support functions which display 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>Added new <tt>CreateCallback</tt> support function which allows you to perform direct callbacks from DLL functions (like Windows API functions) to functions in your script. See the help file and the <i>CodeDll.iss</i> example script for an example.</li>
     <li>Added new <tt>CreateCallback</tt> support function which allows you to perform direct callbacks from DLL functions (like Windows API functions) to functions in your script. See the help file and the <i>CodeDll.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>[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>Many properties which did not support mouseover evaluation from the Compiler IDE now do.</li>
+    <li>To enable mouseover evaluation of their properties from the Compiler IDE, support objects <tt>MainForm</tt>, <tt>WizardForm</tt>, and <tt>UninstallProgressForm</tt> no longer raise an internal error if you try to access them before the forms are created. To get the old behaviour use new support functions <tt>GetMainForm</tt>, <tt>GetWizardForm</tt>, and <tt>GetUninstallProgressForm</tt> instead.</li>
     <li>Added new <tt>BevelKind</tt> property to the <tt>TPanel</tt> support class and new <tt>BevelKind</tt> and <tt>BorderStyle</tt> properties to the <tt>TRichEditViewer</tt> support class, allowing you to enable a flatter interface for a more modern look. See the <i>CodeClasses.iss</i> example script for an example.</li>
     <li>Added new <tt>BevelKind</tt> property to the <tt>TPanel</tt> support class and new <tt>BevelKind</tt> and <tt>BorderStyle</tt> properties to the <tt>TRichEditViewer</tt> support class, allowing you to enable a flatter interface for a more modern look. See the <i>CodeClasses.iss</i> example script for an example.</li>
     <li>Added new <tt>SameStr</tt> and <tt>SameText</tt> support functions.</li>
     <li>Added new <tt>SameStr</tt> and <tt>SameText</tt> support functions.</li>
     <li>Renamed the <tt>IsAdminLoggedOn</tt> support function to <tt>IsAdmin</tt>. The old name is still supported, but it is recommended to update your scripts to the new name and the compiler will issue a warning if you don't. Also consider using <tt>IsAdminInstallMode</tt> instead.</li>
     <li>Renamed the <tt>IsAdminLoggedOn</tt> support function to <tt>IsAdmin</tt>. The old name is still supported, but it is recommended to update your scripts to the new name and the compiler will issue a warning if you don't. Also consider using <tt>IsAdminInstallMode</tt> instead.</li>