Prechádzať zdrojové kódy

Allow VCL to style buttons. The VCL style actually looks better and this also makes it work on old versions.

The current state is now:

- Compil32's dialogs are all dark now, regardless of Windows dark mode.

- Windows' dialogs are also all dark now, except for TaskDialog. The list of dialogs is: Open File, Save File, Browse For Folder, Find, Replace, and Choose Font. TaskDialog is todo although I don't know how.

- Some are only partially dark if Compil32 is in dark mode but Windows is not. This seems acceptable to me. So not a todo.

- Some of dialogs still have some non-dark controls, even if Windows is in dark mode.

  - This applies to Windows' dialogs: Browse For Folder, Find, Replace, and Choose Font. However, it's not a large amount on non-darkness and seems acceptable to me. So not a todo.

  - It also applies to TNewChecklistbox in the wizard: bits of it are dark but not everything. Looking at that is a todo.

  - The images in the wizard are a todo.

All of the above applies to Windows 11. Todo count: 3.

On Windows 7 and other old versions the following things are not dark: Open File, Save File, the title bar, and the main form's scrollbars. The rest looks same as on Windows 11.

I suppose this means that when TNewChecklistbox is done and TNewProgressBar also, it has become possible to add style support to Setup as well.
Martijn Laan 2 mesiacov pred
rodič
commit
9b97c1a47d
2 zmenil súbory, kde vykonal 2 pridanie a 18 odobranie
  1. 1 17
      Projects/Src/IDE.HelperFunc.pas
  2. 1 1
      whatsnew.htm

+ 1 - 17
Projects/Src/IDE.HelperFunc.pas

@@ -109,8 +109,7 @@ begin
 end;
 
 procedure SetControlWindowTheme(const WinControl: TWinControl; const Dark: Boolean);
-{ Can be used for buttons to give them the native dark look and for memos and listboxes to give
-  them a native dark scrollbar }
+{ Can be used for memos and listboxes to switch them to (or from) a native dark scrollbar }
 begin
   if UseThemes then begin
     WinControl.StyleName := 'Windows';
@@ -133,19 +132,6 @@ function InitFormTheme(const Form: TForm): Boolean;
 { Assumes forms other then MainForm call this function only once during creation, and assumes they
   don't need any styling if the theme is non dark. Always styles MainForm. Returns True if it did
   style, False otherwise. }
-
-  procedure InitWinControlTheme(const ParentControl: TWinControl);
-  begin
-    for var I := 0 to ParentControl.ControlCount-1 do begin
-      const Control = ParentControl.Controls[I];
-      if Control is TButton then
-        SetControlWindowTheme(Control as TButton, FormTheme.Dark);
-
-      if Control is TWinControl then
-        InitWinControlTheme(Control as TWinControl);
-    end;
-  end;
-
 begin
   Result := (Form = MainForm) or FormTheme.Dark;
   if Result then begin
@@ -160,8 +146,6 @@ begin
       var value: BOOL := FormTheme.Dark;
       DwmSetWindowAttribute(Form.Handle, DWMWA_USE_IMMERSIVE_DARK_MODE, @value, SizeOf(value));
     end;
-
-    InitWinControlTheme(Form);
   end;
 end;
 

+ 1 - 1
whatsnew.htm

@@ -199,7 +199,7 @@ Source: "https://jrsoftware.org/download.php/iscrypt.dll?dontcount=1"; DestName:
     <ul>
       <li>The <i>Find in Files</i> result list will now update its line numbers when you add or delete lines.</li>
       <li>The <i>Highlight occurrences of current word</i> option (which is disabled by default) no longer highlights a section's directive names, parameter names, or Pascal keywords. The <i>Highlight occurrences of current selection</i> option (which is enabled by default) still does.</li>
-      <li>Added dark mode support to the status bar on all versions of Windows.</li>
+      <li>Improved dark mode support.</li>
     </ul>
   </li>
   <li><tt>[Files]</tt> section parameter <tt>Excludes</tt> can now be combined with the <tt>external</tt> flag.</li>