Răsfoiți Sursa

Various tweaks.

Martijn Laan 5 ani în urmă
părinte
comite
9d565381d8

+ 2 - 0
ISHelp/isetup.xml

@@ -3663,6 +3663,8 @@ Keep the default set of selected tasks, but deselect the "desktopicon" task:<br/
 
 <li>Cristoph Nahr: Code for the .NET version detection (6.0.4).</li>
 
+<li>leserg73: Code for the Compiler IDE's MessageBox Designer (6.1.0).<li>
+
 </ul>
 
 </body>

+ 1 - 1
Projects/CompForm.dfm

@@ -585,7 +585,7 @@ object CompileForm: TCompileForm
         OnClick = TGenerateGUIDClick
       end
       object TInsertMsgBox: TMenuItem
-        Caption = 'Insert MsgBox...'
+        Caption = '&MessageBox Designer...'
         ShortCut = 24653
         OnClick = TInsertMsgBoxClick
       end

+ 4 - 5
Projects/CompForm.pas

@@ -481,7 +481,7 @@ uses
   PathFunc, CmnFunc, CmnFunc2, FileClass, CompMsgs, TmSchema, BrowseFunc,
   HtmlHelpFunc, TaskbarProgressFunc,
   {$IFDEF STATICCOMPILER} Compile, {$ENDIF}
-  CompOptions, CompStartup, CompWizard, CompSignTools, CompTypes, CompInputQueryCombo, MessageBoxInsert;
+  CompOptions, CompStartup, CompWizard, CompSignTools, CompTypes, CompInputQueryCombo, CompMessageBoxDesigner;
 
 {$R *.DFM}
 
@@ -2643,12 +2643,11 @@ begin
   MsgBoxForm := TMBDForm.Create(Application);
   MSGTextInsert := TStringList.Create;
   try
-    if MsgBoxForm.ShowModal <> mrOK then
-      Exit;
-    Memo.SelText := MSGTextInsert.GetText;
+    if MsgBoxForm.ShowModal = mrOk then
+      Memo.SelText := MSGTextInsert.GetText;
   finally
-    MsgBoxForm.Free;
     MSGTextInsert.Free;
+    MsgBoxForm.Free;
   end;
 end;
 

+ 20 - 17
Projects/MessageBoxInsert.dfm → Projects/CompMessageBoxDesigner.dfm

@@ -9,10 +9,10 @@ object MBDForm: TMBDForm
   Font.Charset = DEFAULT_CHARSET
   Font.Color = clWindowText
   Font.Height = -11
-  Font.Name = 'Tahoma'
+  Font.Name = 'MS Sans Serif'
   Font.Style = []
   OldCreateOrder = False
-  Position = poMainFormCenter
+  Position = poScreenCenter
   OnCreate = FormCreate
   DesignSize = (
     548
@@ -22,9 +22,9 @@ object MBDForm: TMBDForm
   object TaskInstructionLabel: TNewStaticText
     Left = 18
     Top = 14
-    Width = 57
+    Width = 50
     Height = 14
-    Caption = 'Instruction:'
+    Caption = 'Instruction'
     TabOrder = 11
   end
   object TaskInstructionText: TEdit
@@ -38,9 +38,9 @@ object MBDForm: TMBDForm
   object TaskMesssageLabel: TNewStaticText
     Left = 18
     Top = 40
-    Width = 52
+    Width = 49
     Height = 14
-    Caption = 'Messsage:'
+    Caption = 'Messsage'
     TabOrder = 12
   end
   object TaskMesssageText: TEdit
@@ -54,9 +54,9 @@ object MBDForm: TMBDForm
   object Button1Label: TNewStaticText
     Left = 18
     Top = 66
-    Width = 68
+    Width = 62
     Height = 14
-    Caption = 'Text Button1:'
+    Caption = 'Text Button1'
     TabOrder = 13
   end
   object Button1Text: TEdit
@@ -69,9 +69,9 @@ object MBDForm: TMBDForm
   object Button2Label: TNewStaticText
     Left = 258
     Top = 67
-    Width = 68
+    Width = 62
     Height = 14
-    Caption = 'Text Button2:'
+    Caption = 'Text Button2'
     TabOrder = 14
   end
   object Button2Text: TEdit
@@ -101,6 +101,7 @@ object MBDForm: TMBDForm
       Anchors = [akLeft, akTop, akRight, akBottom]
       ScrollBars = ssVertical
       TabOrder = 0
+      OnKeyPress = MSGTextKeyPress
     end
   end
   object GroupBox6: TGroupBox
@@ -152,15 +153,15 @@ object MBDForm: TMBDForm
     object NewStaticText1: TNewStaticText
       Left = 14
       Top = 26
-      Width = 75
+      Width = 68
       Height = 14
-      Caption = 'Default button:'
+      Caption = 'Default button'
       TabOrder = 3
     end
     object NewEdit1: TEdit
-      Left = 95
+      Left = 97
       Top = 22
-      Width = 23
+      Width = 21
       Height = 21
       Alignment = taRightJustify
       NumbersOnly = True
@@ -181,9 +182,9 @@ object MBDForm: TMBDForm
       OnChanging = UpDown1Changing
     end
     object cb_MB_SETFOREGROUND: TCheckBox
-      Left = 146
+      Left = 140
       Top = 24
-      Width = 128
+      Width = 135
       Height = 17
       Caption = 'MB_SETFOREGROUND'
       TabOrder = 2
@@ -693,7 +694,7 @@ object MBDForm: TMBDForm
       Width = 80
       Height = 25
       Anchors = [akLeft, akBottom]
-      Caption = 'Preview'
+      Caption = '&Preview'
       TabOrder = 0
       OnClick = MBDButtonPreviewClick
     end
@@ -704,6 +705,7 @@ object MBDForm: TMBDForm
       Height = 25
       Anchors = [akRight, akBottom]
       Caption = 'OK'
+      Default = True
       ModalResult = 1
       TabOrder = 1
       OnClick = MBDButtonOKClick
@@ -714,6 +716,7 @@ object MBDForm: TMBDForm
       Width = 75
       Height = 25
       Anchors = [akRight, akBottom]
+      Cancel = True
       Caption = 'Cancel'
       ModalResult = 2
       TabOrder = 2

+ 23 - 17
Projects/MessageBoxInsert.pas → Projects/CompMessageBoxDesigner.pas

@@ -1,4 +1,15 @@
-unit MessageBoxInsert;
+unit CompMessageBoxDesigner;
+
+{
+  Inno Setup
+  Copyright (C) 1997-2020 Jordan Russell
+  Portions by Martijn Laan
+  For conditions of distribution and use, see LICENSE.TXT.
+
+  MessageBox Designer form
+  
+  Originally contributed by leserg73
+}
 
 interface
 
@@ -91,6 +102,7 @@ type
     procedure rb_IDABORTClick(Sender: TObject);
     procedure MBDButtonOKClick(Sender: TObject);
     procedure cb_SuppressibleClick(Sender: TObject);
+    procedure MSGTextKeyPress(Sender: TObject; var Key: Char);
   private
     procedure CreateScriptMSG;
   public
@@ -106,21 +118,12 @@ uses
 
 procedure TMBDForm.FormCreate(Sender: TObject);
 begin
-  cb_Suppressible.Checked := False;
-  rb_mbInformation.Checked := True;
-  rbMB_OK.Checked := True;
-  MSGText.Lines.Clear;
+  InitFormFont(Self);
+
+  cb_Suppressible.Checked := True;
   MSGText.Lines[MSGText.CaretPos.Y] := '<Enter your text here...>';
   MSGText.SelStart := MSGText.Perform(EM_LINEINDEX, 0, 0);
   MSGText.SelLength := Length(MSGText.Lines[0]);
-  cb_IDOK.Checked := False;
-  cb_IDCANCEL.Checked := False;
-  cb_IDABORT.Checked := False;
-  cb_IDRETRY.Checked := False;
-  cb_IDIGNORE.Checked := False;
-  cb_IDYES.Checked := False;
-  cb_IDNO.Checked := False;
-  cb_IDOK.Enabled := False;
   cb_IDCANCEL.Enabled := False;
   cb_IDABORT.Enabled := False;
   cb_IDRETRY.Enabled := False;
@@ -138,10 +141,6 @@ begin
   Button2Text.Visible := False;
   Button1Label.Visible := False;
   Button2Label.Visible := False;
-  TaskInstructionText.Text := '';
-  TaskMesssageText.Text := '';
-  Button1Text.Text := '';
-  Button2Text.Text := '';
 end;
 
 procedure TMBDForm.rbMB_OKClick(Sender: TObject);
@@ -840,7 +839,14 @@ begin
                       ButtonLabelsArray,
                       ShieldFlag);
   end;
+end;
 
+procedure TMBDForm.MSGTextKeyPress(Sender: TObject; var Key: Char);
+begin
+	if Key = #27 then begin
+  	MBDButtonCancel.Click;
+    Key := #0;
+  end;
 end;
 
 procedure TMBDForm.CreateScriptMSG;

+ 1 - 1
Projects/Compil32.dpr

@@ -40,7 +40,7 @@ uses
   ScintEdit in '..\Components\ScintEdit.pas',
   ScintStylerInnoSetup in '..\Components\ScintStylerInnoSetup.pas',
   ModernColors in '..\Components\ModernColors.pas',
-  MessageBoxInsert in 'MessageBoxInsert.pas' {MBDForm};
+  CompMessageBoxDesigner in 'CompMessageBoxDesigner.pas' {MBDForm};
 
 {$R *.res}
 {$R Compil32.manifest.res}

+ 1 - 1
Projects/Compil32.dproj

@@ -80,7 +80,7 @@
 			<DCCReference Include="CompInputQueryCombo.pas">
 				<Form>InputQueryCombo</Form>
 			</DCCReference>
-			<DCCReference Include="MessageBoxInsert.pas">
+			<DCCReference Include="CompMessageBoxDesigner.pas">
 				<Form>MBDForm</Form>
 			</DCCReference>
 			<DCCReference Include="..\Components\ScintInt.pas"/>

+ 2 - 1
whatsnew.htm

@@ -43,6 +43,7 @@ For conditions of distribution and use, see <a href="https://jrsoftware.org/file
 <p>Various improvements have been made to the Compiler IDE:</p>
 <ul>
   <li><a href="https://i.imgur.com/wHoJ3FG.png">Improved highlighting</a> for the [CustomMessages] and [Messages] sections.</li>
+  <li>Added new <a href="https://i.imgur.com/c9wGM3M.png">MessageBox Designer</a> menu item to the Tools menu to design and insert MsgBox or TaskDialogMsgBox calls for the [Code] section.</li>
   <li>Added buttons to the Welcome dialog to <a href="https://jrsoftware.org/isdonate.php">Donate</a> to support Inno Setup (Thank you!) and to <a href="https://jrsoftware.org/ismail.php">Subscribe</a> to the Inno Setup Mailing List to be notified by e-mail of new Inno Setup releases.</li>
   <li>The Run Parameters dialog now shows a list of most recently used parameters.</li>
 </ul>
@@ -77,7 +78,7 @@ For conditions of distribution and use, see <a href="https://jrsoftware.org/file
   <li>Minor tweaks.</li>
 </ul>
 
-<p>Contributions via <a href="https://github.com/jrsoftware/issrc" target="_blank">GitHub</a>: Thanks to Gavin Lambert for their contributions.</p>
+<p>Contributions via <a href="https://github.com/jrsoftware/issrc" target="_blank">GitHub</a>: <b>Thanks to Gavin Lambert and leserg73 for their contributions.</b></p>
 
 <p><a href="https://jrsoftware.org/files/is6.0-whatsnew.htm">Inno Setup 6.0 Revision History</a></p >