Sfoglia il codice sorgente

Add 'Reopen All Tabs' menu items + update whatsnew.

Martijn Laan 1 anno fa
parent
commit
3cb57029cf
3 ha cambiato i file con 35 aggiunte e 5 eliminazioni
  1. 8 0
      Projects/CompForm.dfm
  2. 25 4
      Projects/CompForm.pas
  3. 2 1
      whatsnew.htm

+ 8 - 0
Projects/CompForm.dfm

@@ -538,6 +538,10 @@ object CompileForm: TCompileForm
       object VReopenTab: TMenuItem
         Caption = 'Reopen Tab'
       end
+      object VReopenTabs: TMenuItem
+        Caption = 'Reopen All Tabs'
+        OnClick = VReopenTabsClick
+      end
       object N20: TMenuItem
         Caption = '-'
       end
@@ -4329,5 +4333,9 @@ object CompileForm: TCompileForm
     object VReopenTab2: TMenuItem
       Caption = 'Reopen Tab'
     end
+    object VReopenTabs2: TMenuItem
+      Caption = 'Reopen All Tabs'
+      OnClick = VReopenTabsClick
+    end
   end
 end

+ 25 - 4
Projects/CompForm.pas

@@ -213,9 +213,11 @@ type
     TFilesDesigner: TMenuItem;
     VCloseTab: TMenuItem;
     VReopenTab: TMenuItem;
+    VReopenTabs: TMenuItem;
     MemosTabSetPopupMenu: TPopupMenu;
     VCloseTab2: TMenuItem;
     VReopenTab2: TMenuItem;
+    VReopenTabs2: TMenuItem;
     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
     procedure FExitClick(Sender: TObject);
     procedure FOpenMainFileClick(Sender: TObject);
@@ -318,6 +320,7 @@ type
     procedure TFilesDesignerClick(Sender: TObject);
     procedure VCloseTabClick(Sender: TObject);
     procedure VReopenTabClick(Sender: TObject);
+    procedure VReopenTabsClick(Sender: TObject);
     procedure MemosTabSetPopup(Sender: TObject);
     procedure MemosTabSetOnCloseButtonClick(Sender: TObject);
   private
@@ -455,6 +458,7 @@ type
     procedure ParseDebugInfo(DebugInfo: Pointer);
     procedure ReadMRUMainFilesList;
     procedure ReadMRUParametersList;
+    procedure ReopenTabOrTabs(const HiddenFileIndex: Integer);
     procedure ResetAllMemosLineState;
     procedure StartProcess;
     function SaveFile(const AMemo: TCompScintFileEdit; const SaveAs: Boolean): Boolean;
@@ -2290,6 +2294,7 @@ begin
   VReopenTab.Visible := MemosTabSet.Visible and (FHiddenFiles.Count > 0);
   if VReopenTab.Visible then
     UpdateReopenTabMenu(VReopenTab);
+  VReopenTabs.Visible := VReopenTab.Visible;
   VHide.Checked := not StatusPanel.Visible;
   VCompilerOutput.Checked := StatusPanel.Visible and (OutputTabSet.TabIndex = tiCompilerOutput);
   VDebugOutput.Checked := StatusPanel.Visible and (OutputTabSet.TabIndex = tiDebugOutput);
@@ -2336,12 +2341,17 @@ begin
   VPreviousTabClick(Self);
 end;
 
-procedure TCompileForm.VReopenTabClick(Sender: TObject);
+procedure TCompileForm.ReopenTabOrTabs(const HiddenFileIndex: Integer);
 begin
-  var MenuItem := Sender as TMenuItem;
+  var ReopenFilename: String;
+  if HiddenFileIndex >= 0 then begin
+    ReopenFilename := FHiddenFiles[HiddenFileIndex];
+    FHiddenFiles.Delete(HiddenFileIndex);
+  end else begin
+    ReopenFilename := FHiddenFiles[0];
+    FHiddenFiles.Clear;
+  end;
 
-  var ReopenFilename := FHiddenFiles[MenuItem.Tag];
-  FHiddenFiles.Delete(MenuItem.Tag);
   UpdatePreprocMemos;
   SaveKnownIncludedAndHiddenFiles(FMainMemo.Filename);
 
@@ -2354,6 +2364,16 @@ begin
   end;
 end;
 
+procedure TCompileForm.VReopenTabClick(Sender: TObject);
+begin
+  ReopenTabOrTabs((Sender as TMenuItem).Tag);
+end;
+
+procedure TCompileForm.VReopenTabsClick(Sender: TObject);
+begin
+  ReopenTabOrTabs(-1);
+end;
+
 procedure TCompileForm.SyncZoom;
 var
   Memo: TCompScintEdit;
@@ -2720,6 +2740,7 @@ begin
   VReopenTab2.Visible := FHiddenFiles.Count > 0;
   if VReopenTab2.Visible then
     UpdateReopenTabMenu(VReopenTab2);
+  VReopenTabs2.Visible := VReopenTab2.Visible;
 end;
 
 procedure TCompileForm.MemosTabSetClick(Sender: TObject);

+ 2 - 1
whatsnew.htm

@@ -50,7 +50,8 @@ For conditions of distribution and use, see <a href="https://jrsoftware.org/file
   <li>Compiler IDE changes:
   <ul>
   <li>The Compiler IDE now opens up to 20 #include files in tabs, instead of up to 10.</li>
-  <li>Added new <i>Close Tab (Ctrl+F4)</i> and  <i>Reopen Tab</i> menu items to the <i>View</i> menu, also available by right clicking the tab bar.</li>
+  <li>Added new <i>Close Tab (Ctrl+F4)</i>, <i>Reopen Tab</i>, and  <i>Reopen All Tabs</i> menu items to the <i>View</i> menu, also available by right clicking the tab bar.</li>
+  <li>Selected and closeable tabs now show a close button.</li>
   <li>Added new <i>[Files] Entries Designer</i> menu item to the <i>Tools</i> menu to design and insert extra entries to the [Files] section.</li>
   </ul>
   </li>