Parcourir la source

Merge branch 'updatepanel'

Martijn Laan il y a 1 an
Parent
commit
ff827c9d4c

+ 1 - 0
Projects/Bin/synch-isfiles.bat

@@ -13,6 +13,7 @@ copy ..\..\Files\islzma.dll
 copy ..\..\Files\islzma*.exe
 copy ..\..\Files\ISetup.chm
 copy ..\..\Files\ISetup-dark.chm
+copy ..\..\whatsnew.htm
 
 echo - Synching files done
 

+ 55 - 7
Projects/Src/IDE.MainForm.dfm

@@ -2,7 +2,7 @@ object MainForm: TMainForm
   Left = 206
   Top = 97
   Caption = '*'
-  ClientHeight = 265
+  ClientHeight = 306
   ClientWidth = 361
   Color = clBtnFace
   Font.Charset = DEFAULT_CHARSET
@@ -28,13 +28,13 @@ object MainForm: TMainForm
   end
   object BodyPanel: TPanel
     Left = 0
-    Top = 51
+    Top = 92
     Width = 361
     Height = 194
     Align = alClient
     BevelOuter = bvNone
     FullRepaint = False
-    TabOrder = 0
+    TabOrder = 3
     object SplitPanel: TPanel
       Left = 0
       Top = 86
@@ -136,7 +136,7 @@ object MainForm: TMainForm
   end
   object StatusBar: TStatusBar
     Left = 0
-    Top = 245
+    Top = 286
     Width = 361
     Height = 20
     Panels = <
@@ -187,7 +187,7 @@ object MainForm: TMainForm
     Height = 29
     Align = alTop
     BevelOuter = bvNone
-    TabOrder = 2
+    TabOrder = 0
     object ToolBar: TToolBar
       AlignWithMargins = True
       Left = 7
@@ -342,7 +342,7 @@ object MainForm: TMainForm
   end
   object MemosTabSet: TNewTabSet
     Left = 0
-    Top = 30
+    Top = 71
     Width = 361
     Height = 21
     Align = alTop
@@ -353,6 +353,54 @@ object MainForm: TMainForm
     OnClick = MemosTabSetClick
     OnCloseButtonClick = MemosTabSetOnCloseButtonClick
   end
+  object UpdatePanel: TPanel
+    Left = 0
+    Top = 30
+    Width = 361
+    Height = 41
+    Align = alTop
+    BevelOuter = bvNone
+    TabOrder = 1
+    object UpdatePanelClosePaintBox: TPaintBox
+      AlignWithMargins = True
+      Left = 330
+      Top = 10
+      Width = 21
+      Height = 21
+      Margins.Top = 10
+      Margins.Right = 10
+      Margins.Bottom = 10
+      Align = alRight
+      OnClick = UpdatePanelClosePaintBoxClick
+      OnPaint = UpdatePanelClosePaintBoxPaint
+    end
+    object UpdatePanelDonateImage: TImage
+      AlignWithMargins = True
+      Left = 303
+      Top = 10
+      Width = 21
+      Height = 21
+      Cursor = crHandPoint
+      Margins.Top = 10
+      Margins.Bottom = 10
+      Align = alRight
+      Center = True
+      ParentShowHint = False
+      ShowHint = True
+      OnClick = UpdatePanelDonateImageClick
+    end
+    object UpdateLinkLabel: TLinkLabel
+      Left = 13
+      Top = 13
+      Width = 363
+      Height = 17
+      Caption = 
+        'Your version of Inno Setup has been updated. Click <a  id="whats' +
+        'new">here</a> to see what'#39's new.'
+      TabOrder = 0
+      OnLinkClick = UpdateLinkLabelLinkClick
+    end
+  end
   object MainMenu1: TMainMenu
     AutoHotkeys = maManual
     AutoLineReduction = maManual
@@ -835,7 +883,7 @@ object MainForm: TMainForm
       Caption = '&Help'
       OnClick = SimpleMenuClick
       object HDonate: TMenuItem
-        Caption = 'D&onate - Thank you!'
+        Caption = '&Support Inno Setup - Thank you!'
         OnClick = HDonateClick
       end
       object N21: TMenuItem

+ 86 - 4
Projects/Src/IDE.MainForm.pas

@@ -251,6 +251,10 @@ type
     EFoldLine: TMenuItem;
     EUnfoldLine: TMenuItem;
     EFindRegEx: TMenuItem;
+    UpdatePanel: TPanel;
+    UpdateLinkLabel: TLinkLabel;
+    UpdatePanelClosePaintBox: TPaintBox;
+    UpdatePanelDonateImage: TImage;
     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
     procedure FExitClick(Sender: TObject);
     procedure FOpenMainFileClick(Sender: TObject);
@@ -373,6 +377,11 @@ type
     procedure EBraceMatchClick(Sender: TObject);
     procedure EFoldOrUnfoldLineClick(Sender: TObject);
     procedure EFindRegExClick(Sender: TObject);
+    procedure UpdateLinkLabelLinkClick(Sender: TObject; const Link: string;
+      LinkType: TSysLinkType);
+    procedure UpdatePanelClosePaintBoxPaint(Sender: TObject);
+    procedure UpdatePanelClosePaintBoxClick(Sender: TObject);
+    procedure UpdatePanelDonateImageClick(Sender: TObject);
   private
     { Private declarations }
     FMemos: TList<TIDEScintEdit>;                      { FMemos[0] is the main memo and FMemos[1] the preprocessor output memo - also see MemosTabSet comment above }
@@ -584,6 +593,7 @@ type
     procedure UpdateEditModePanel;
     procedure UpdatePreprocMemos;
     procedure UpdateLineMarkers(const AMemo: TIDEScintFileEdit; const Line: Integer);
+    procedure UpdateImages;
     procedure UpdateMarginsAndAutoCompleteIcons;
     procedure UpdateMarginsAndSquigglyAndCaretWidths;
     procedure UpdateMemosTabSetVisibility;
@@ -827,6 +837,11 @@ constructor TMainForm.Create(AOwner: TComponent);
         if Memo <> FMainMemo then
           Memo.Font := FMainMemo.Font;
 
+      { UpdatePanel visibility }
+      var KnownVersion := Cardinal(Ini.ReadInteger('Options', 'KnownVersion', 0));
+      UpdatePanel.Visible := KnownVersion < FCompilerVersion.BinVersion;
+      UpdateBevel1Visibility;
+
       { Debug options }
       FOptions.ShowCaretPosition := Ini.ReadBool('Options', 'ShowCaretPosition', False);
       if FOptions.ShowCaretPosition then
@@ -857,6 +872,7 @@ constructor TMainForm.Create(AOwner: TComponent);
       { Note: Don't call UpdateStatusPanelHeight here since it clips to the
         current form height, which hasn't been finalized yet }
 
+      { StatusPanel height }
       StatusPanel.Height := ToCurrentPPI(Ini.ReadInteger('State', 'StatusPanelHeight',
         (10 * FromCurrentPPI(DebugOutputList.ItemHeight) + 4) + FromCurrentPPI(OutputTabSet.Height)));
     finally
@@ -921,6 +937,13 @@ begin
   FTheme := TTheme.Create;
   InitFormThemeInit(FTheme);
 
+  ToolBarPanel.ParentBackground := False;
+  UpdatePanel.ParentBackground := False;
+  UpdatePanel.Color := $add6ad; //MGreen, 6 tints lightened using color-hex.com - also OK for dark mode
+  UpdatePanelDonateImage.Hint := RemoveAccelChar(HDonate.Caption);
+
+  UpdateImages;
+
   FMemos := TList<TIDEScintEdit>.Create;
   FMainMemo := InitializeMainMemo(TIDEScintFileEdit.Create(Self), PopupMenu);
   FMemos.Add(FMainMemo);
@@ -1093,8 +1116,9 @@ end;
 procedure TMainForm.FormAfterMonitorDpiChanged(Sender: TObject; OldDPI,
   NewDPI: Integer);
 begin
-  UpdateMarginsAndSquigglyAndCaretWidths;
+  UpdateImages;
   UpdateMarginsAndAutoCompleteIcons;
+  UpdateMarginsAndSquigglyAndCaretWidths;
   UpdateOutputTabSetListsItemHeightAndDebugTimeWidth;
   UpdateStatusPanelHeight(StatusPanel.Height);
 end;
@@ -3847,6 +3871,16 @@ begin
   end;
 end;
 
+procedure TMainForm.UpdateImages;
+{ Should be called at startup and after DPI changes }
+begin
+  var WH := MulDiv(16, CurrentPPI, 96);
+  var Images := ImagesModule.LightToolBarImageCollection;
+
+  var Image := Images.GetSourceImage(Images.GetIndexByName('heart-filled'), WH, WH);
+  UpdatePanelDonateImage.Picture.Graphic:= Image;
+end;
+
 procedure TMainForm.UpdateOutputTabSetListsItemHeightAndDebugTimeWidth;
 { Should be called at startup and after DPI changes }
 begin
@@ -6113,7 +6147,6 @@ begin
 
   InitFormTheme(Self);
   ToolbarPanel.Color := FTheme.Colors[tcToolBack];
-  ToolBarPanel.ParentBackground := False;
 
   if FTheme.Dark then begin
     ThemedToolbarVirtualImageList.ImageCollection := ImagesModule.DarkToolBarImageCollection;
@@ -7461,6 +7494,53 @@ begin
     AMemo.AddMarker(Line, mlmBreakpointBad);
 end;
 
+procedure TMainForm.UpdateLinkLabelLinkClick(Sender: TObject;
+  const Link: string; LinkType: TSysLinkType);
+begin
+  if (LinkType = sltID) and (Link = 'whatsnew') then begin
+    HWhatsNew.Click;
+    UpdatePanelClosePaintBoxClick(Sender);
+  end;
+end;
+
+procedure TMainForm.UpdatePanelClosePaintBoxClick(Sender: TObject);
+begin
+  var Ini := TConfigIniFile.Create;
+  try
+    Ini.WriteInteger('Options', 'KnownVersion', FCompilerVersion.BinVersion);
+  finally
+    Ini.Free;
+  end;
+  UpdatePanel.Visible := False;
+  UpdateBevel1Visibility;
+end;
+
+procedure TMainForm.UpdatePanelDonateImageClick(Sender: TObject);
+begin
+  HDonate.Click;
+end;
+
+procedure TMainForm.UpdatePanelClosePaintBoxPaint(Sender: TObject);
+const
+  MENU_SYSTEMCLOSE = 17;
+  MSYSC_NORMAL = 1;
+begin
+  var Canvas := UpdatePanelClosePaintBox.Canvas;
+  var R := TRect.Create(0, 0, UpdatePanelClosePaintBox.Width, UpdatePanelClosePaintBox.Height);
+  if FMenuThemeData <> 0 then begin
+    var Offset := MulDiv(1, CurrentPPI, 96);
+    Inc(R.Left, Offset);
+    DrawThemeBackground(FMenuThemeData, Canvas.Handle, MENU_SYSTEMCLOSE, MSYSC_NORMAL, R, nil);
+  end else begin
+    InflateRect(R, -MulDiv(6, CurrentPPI, 96), -MulDiv(6, CurrentPPI, 96));
+    Canvas.Pen.Color := Canvas.Font.Color;
+    Canvas.MoveTo(R.Left, R.Top);
+    Canvas.LineTo(R.Right, R.Bottom);
+    Canvas.MoveTo(R.Left, R.Bottom-1);
+    Canvas.LineTo(R.Right, R.Top-1);
+  end;
+end;
+
 procedure TMainForm.UpdateAllMemoLineMarkers(const AMemo: TIDEScintFileEdit);
 begin
   for var Line := 0 to AMemo.Lines.Count-1 do
@@ -7476,8 +7556,10 @@ end;
 
 procedure TMainForm.UpdateBevel1Visibility;
 begin
-  { Bevel1 is the line between the toolbar and the memo when there's no tabset }
-  Bevel1.Visible := (FTheme.Colors[tcMarginBack] = ToolBarPanel.Color) and not MemosTabSet.Visible;
+  { Bevel1 is the line between the toolbar and the memo when there's nothing in
+    between and they have the same color }
+  Bevel1.Visible := (FTheme.Colors[tcMarginBack] = ToolBarPanel.Color) and
+                    not UpdatePanel.Visible and not MemosTabSet.Visible;
 end;
 
 function TMainForm.ToCurrentPPI(const XY: Integer): Integer;

+ 0 - 2
Projects/Src/IDE.StartupForm.dfm

@@ -11,14 +11,12 @@ object StartupForm: TStartupForm
   Font.Height = -11
   Font.Name = 'MS Sans Serif'
   Font.Style = []
-  OldCreateOrder = True
   Position = poScreenCenter
   OnAfterMonitorDpiChanged = FormAfterMonitorDpiChanged
   OnCreate = FormCreate
   DesignSize = (
     579
     419)
-  PixelsPerInch = 96
   TextHeight = 13
   object DonateImage: TImage
     Left = 8

+ 3 - 1
Projects/Src/IDE.StartupForm.pas

@@ -78,7 +78,7 @@ procedure TStartupForm.UpdateImages;
   end;
 
 begin
- { After a DPI change the button's Width and Height isn't yet updated, so calculate it ourselves }
+  { After a DPI change the button's Width and Height isn't yet updated, so calculate it ourselves }
   var WH := MulDiv(16, CurrentPPI, 96);
   NewImage.Picture.Graphic:= GetImage(MainForm.NewMainFileButton, WH);
   OpenImage.Picture.Graphic := GetImage(MainForm.OpenMainFileButton, WH);
@@ -96,6 +96,8 @@ begin
 
   InitFormFont(Self);
 
+  DonateImage.Hint := MainForm.UpdatePanelDonateImage.Hint;
+
   UpdateImages;
 
   OpenListBox.Items.Add(SCompilerExampleScripts);

+ 1 - 0
whatsnew.htm

@@ -77,6 +77,7 @@ For conditions of distribution and use, see <a href="files/is/license.txt">LICEN
   <li>Added shortcuts to select a tab (Ctrl+1 through Ctrl+9).</li>
   <li>Added shortcut to the <i>Options</i> menu item in the <i>Tools</i> menu (Ctrl+,).</li>
   <li>Removed the length limitation when entering a Sign Tool command and increased control height.</li>
+  <li>Added a banner which is displayed to each user after each update and links to this revision history.</li>
 </ul>
 <p><span class="head2">Other changes</span></p>
 <ul>