Browse Source

Added new Next Tab and Previous Tab menu items to the View menu.
Also properly disable Generate GUID and the MsgBox designer for the preprocessor memo.

Martijn Laan 5 years ago
parent
commit
c61ddb62dd
3 changed files with 52 additions and 0 deletions
  1. 14 0
      Projects/CompForm.dfm
  2. 37 0
      Projects/CompForm.pas
  3. 1 0
      whatsnew.htm

+ 14 - 0
Projects/CompForm.dfm

@@ -468,6 +468,19 @@ object CompileForm: TCompileForm
       object N11: TMenuItem
         Caption = '-'
       end
+      object VNextTab: TMenuItem
+        Caption = '&Next Tab'
+        ShortCut = 16393
+        OnClick = VNextTabClick
+      end
+      object VPreviousTab: TMenuItem
+        Caption = '&Previous Tab'
+        ShortCut = 24585
+        OnClick = VPreviousTabClick
+      end
+      object N20: TMenuItem
+        Caption = '-'
+      end
       object VCompilerOutput: TMenuItem
         Caption = '&Compiler Output'
         RadioItem = True
@@ -597,6 +610,7 @@ object CompileForm: TCompileForm
     end
     object TMenu: TMenuItem
       Caption = '&Tools'
+      OnClick = TMenuClick
       object TAddRemovePrograms: TMenuItem
         Caption = '&Add/Remove Programs'
         OnClick = TAddRemoveProgramsClick

+ 37 - 0
Projects/CompForm.pas

@@ -186,6 +186,9 @@ type
     MemosTabSet: TNewTabSet; { First tab is the main memo, last tab is the preprocessor output memo }
     FSaveAll: TMenuItem;
     RStepOut: TMenuItem;
+    VNextTab: TMenuItem;
+    VPreviousTab: TMenuItem;
+    N20: TMenuItem;
     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
     procedure FExitClick(Sender: TObject);
     procedure FOpenMainFileClick(Sender: TObject);
@@ -274,6 +277,9 @@ type
     procedure MemosTabSetClick(Sender: TObject);
     procedure FSaveAllClick(Sender: TObject);
     procedure RStepOutClick(Sender: TObject);
+    procedure TMenuClick(Sender: TObject);
+    procedure VNextTabClick(Sender: TObject);
+    procedure VPreviousTabClick(Sender: TObject);
   private
     { Private declarations }
     FMemos: TList<TCompScintEdit>;                      { FMemos[0] is the main memo and FMemos[1] the preprocessor output memo - also see MemosTabSet comment above }
@@ -1833,12 +1839,34 @@ begin
   VZoomReset.Enabled := (FActiveMemo.Zoom <> 0);
   VToolbar.Checked := Toolbar.Visible;
   VStatusBar.Checked := StatusBar.Visible;
+  VNextTab.Enabled := MemosTabSet.Visible and (MemosTabSet.Tabs.Count > 1);
+  VPreviousTab.Enabled := VNextTab.Enabled;
   VHide.Checked := not StatusPanel.Visible;
   VCompilerOutput.Checked := StatusPanel.Visible and (OutputTabSet.TabIndex = tiCompilerOutput);
   VDebugOutput.Checked := StatusPanel.Visible and (OutputTabSet.TabIndex = tiDebugOutput);
   VDebugCallStack.Checked := StatusPanel.Visible and (OutputTabSet.TabIndex = tiDebugCallStack);
 end;
 
+procedure TCompileForm.VNextTabClick(Sender: TObject);
+var
+  NewTabIndex: Integer;
+begin
+  NewTabIndex := MemosTabSet.TabIndex+1;
+  if NewTabIndex >= MemosTabSet.Tabs.Count then
+    NewTabIndex := 0;
+  MemosTabSet.TabIndex := NewTabIndex;
+end;
+
+procedure TCompileForm.VPreviousTabClick(Sender: TObject);
+var
+  NewTabIndex: Integer;
+begin
+  NewTabIndex := MemosTabSet.TabIndex-1;
+  if NewTabIndex < 0 then
+    NewTabIndex := MemosTabSet.Tabs.Count-1;
+  MemosTabSet.TabIndex := NewTabIndex;
+end;
+
 procedure TCompileForm.SyncZoom;
 var
   Memo: TCompScintEdit;
@@ -2351,6 +2379,15 @@ begin
   end;
 end;
 
+procedure TCompileForm.TMenuClick(Sender: TObject);
+var
+  MemoIsReadOnly: Boolean;
+begin
+  MemoIsReadOnly := FActiveMemo.ReadOnly;
+  TGenerateGUID.Enabled := not MemoIsReadOnly;
+  TInsertMsgBox.Enabled := not MemoIsReadOnly;
+end;
+
 procedure TCompileForm.TAddRemoveProgramsClick(Sender: TObject);
 begin
   StartAddRemovePrograms;

+ 1 - 0
whatsnew.htm

@@ -45,6 +45,7 @@ For conditions of distribution and use, see <a href="https://jrsoftware.org/file
   <li>If the script uses Inno Setup Preprocessor (ISPP) functionality, the Compiler IDE now automatically <a href="https://i.imgur.com/IVI2nk3.png">shows the preprocessor output</a> in a tab so you can check it. This can be turned off in the options.</li>
   <li>The Compiler IDE now automatically opens (up to 10) <tt>#include</tt> files in tabs which allow you to <a href="https://i.imgur.com/iDrhOSs.png">edit and debug</a> these files from within the Compiler IDE. The list of <tt>#include</tt> files is updated after opening a new main file and after each compilation. This can be turned off in the options. If the option is not turned off, a new <i>Save All</i> menu item is added to the <i>File</i> menu.</li>
   <li>If <tt>#include</tt> files are modified since last compile, the script is now automatically re-compiled before running it. This works even if the option to automatically open <tt>#include</tt> files is turned off.</li>
+  <li>Added new <i>Next Tab</i> and <i>Previous Tab</i> menu items to the <i>View</i> menu.</li>
   <li>Added new topic to the help file explaining the various <a href="https://jrsoftware.org/ishelp/index.php?topic=scriptdebug">integrated debugger menu items</a> in the <i>Run</i> menu which can be used to debug your [Code] section.</li>
   <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 <i>Tools</i> menu to design and insert <tt>MsgBox</tt> or <tt>TaskDialogMsgBox</tt> calls for the [Code] section.</li>