Explorar el Código

Make the panel clickable + fix issue with panel update after options change, code was in wrong place.

Martijn Laan hace 1 año
padre
commit
3689f577fd
Se han modificado 3 ficheros con 23 adiciones y 3 borrados
  1. 1 0
      Projects/CompForm.dfm
  2. 21 2
      Projects/CompForm.pas
  3. 1 1
      whatsnew.htm

+ 1 - 0
Projects/CompForm.dfm

@@ -177,6 +177,7 @@ object CompileForm: TCompileForm
         Bevel = pbNone
         Bevel = pbNone
         Width = 50
         Width = 50
       end>
       end>
+    OnClick = StatusBarClick
     OnDrawPanel = StatusBarDrawPanel
     OnDrawPanel = StatusBarDrawPanel
     OnResize = StatusBarResize
     OnResize = StatusBarResize
   end
   end

+ 21 - 2
Projects/CompForm.pas

@@ -323,6 +323,7 @@ type
     procedure VReopenTabsClick(Sender: TObject);
     procedure VReopenTabsClick(Sender: TObject);
     procedure MemosTabSetPopup(Sender: TObject);
     procedure MemosTabSetPopup(Sender: TObject);
     procedure MemosTabSetOnCloseButtonClick(Sender: TObject);
     procedure MemosTabSetOnCloseButtonClick(Sender: TObject);
+    procedure StatusBarClick(Sender: TObject);
   private
   private
     { Private declarations }
     { Private declarations }
     FMemos: TList<TCompScintEdit>;                      { FMemos[0] is the main memo and FMemos[1] the preprocessor output memo - also see MemosTabSet comment above }
     FMemos: TList<TCompScintEdit>;                      { FMemos[0] is the main memo and FMemos[1] the preprocessor output memo - also see MemosTabSet comment above }
@@ -688,7 +689,6 @@ constructor TCompileForm.Create(AOwner: TComponent);
       end;
       end;
       SyncEditorOptions;
       SyncEditorOptions;
       UpdateNewMainFileButtons;
       UpdateNewMainFileButtons;
-      UpdateHiddenFilesPanel;
       UpdateTheme;
       UpdateTheme;
 
 
       { Window state }
       { Window state }
@@ -3173,6 +3173,7 @@ begin
     
     
     UpdateCaption;
     UpdateCaption;
     UpdatePreprocMemos;
     UpdatePreprocMemos;
+    UpdateHiddenFilesPanel;
     for Memo in FMemos do begin
     for Memo in FMemos do begin
       { Move caret to start of line to ensure it doesn't end up in the middle
       { Move caret to start of line to ensure it doesn't end up in the middle
         of a double-byte character if the code page changes from SBCS to DBCS }
         of a double-byte character if the code page changes from SBCS to DBCS }
@@ -3344,7 +3345,7 @@ end;
 
 
 procedure TCompileForm.UpdateHiddenFilesPanel;
 procedure TCompileForm.UpdateHiddenFilesPanel;
 begin
 begin
-  if FOptions.OpenIncludedFiles and (FHiddenFiles.Count > 0) then begin
+  if MemosTabSet.Visible and (FHiddenFiles.Count > 0) then begin
     StatusBar.Panels[spHiddenFilesCount].Text := Format('Tabs closed: %d', [FHiddenFiles.Count]);
     StatusBar.Panels[spHiddenFilesCount].Text := Format('Tabs closed: %d', [FHiddenFiles.Count]);
   end else
   end else
     StatusBar.Panels[spHiddenFilesCount].Text := '';
     StatusBar.Panels[spHiddenFilesCount].Text := '';
@@ -4955,6 +4956,24 @@ begin
   end;
   end;
 end;
 end;
 
 
+procedure TCompileForm.StatusBarClick(Sender: TObject);
+begin
+  if MemosTabSet.Visible and (FHiddenFiles.Count > 0) then begin
+    var Point := SmallPointToPoint(TSmallPoint(DWORD(GetMessagePos)));
+    var X := StatusBar.ScreenToClient(Point).X;
+    var W := 0;
+    for var I := 0 to StatusBar.Panels.Count-1 do begin
+      Inc(W, StatusBar.Panels[I].Width);
+      if X < W then begin
+        if I = spHiddenFilesCount then
+          MemosTabSetPopupMenu.Popup(Point.X, Point.Y);
+        Break;
+      end else if I = spHiddenFilesCount then
+        Break;
+    end;
+  end;
+end;
+
 procedure TCompileForm.StatusBarDrawPanel(StatusBar: TStatusBar;
 procedure TCompileForm.StatusBarDrawPanel(StatusBar: TStatusBar;
   Panel: TStatusPanel; const Rect: TRect);
   Panel: TStatusPanel; const Rect: TRect);
 var
 var

+ 1 - 1
whatsnew.htm

@@ -51,7 +51,7 @@ For conditions of distribution and use, see <a href="https://jrsoftware.org/file
   <ul>
   <ul>
   <li>The Compiler IDE now opens up to 20 #include files in tabs, instead of up to 10.</li>
   <li>The Compiler IDE now opens up to 20 #include files in tabs, instead of up to 10.</li>
   <li>Tabs for #include files can now be closed: 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. Additionally the tab for a selected #include file now shows a close button.</li>
   <li>Tabs for #include files can now be closed: 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. Additionally the tab for a selected #include file now shows a close button.</li>
-  <li>Added a panel to the Status Bar showing the amount of closed tabs if there are any.</li>
+  <li>Added a clickable panel to the Status Bar showing the amount of closed tabs if there are any.</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>
   <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>
   </ul>
   </li>
   </li>