Selaa lähdekoodia

dark theme for pen preview

Johann 6 vuotta sitten
vanhempi
commit
c6eea926e7
2 muutettua tiedostoa jossa 7 lisäystä ja 3 poistoa
  1. 2 0
      lazpaint/lazpaintmainform.pas
  2. 5 3
      lazpaint/maintoolbar.inc

+ 2 - 0
lazpaint/lazpaintmainform.pas

@@ -888,6 +888,7 @@ begin
   m.Apply;
   FLayout.Menu := m;
   FLayout.DarkTheme := m.DarkTheme;
+  DarkThemeInstance.Apply(Panel_PenWidthPreview, m.DarkTheme);
 end;
 
 function TFMain.GetToolManager: TToolManager;
@@ -3534,6 +3535,7 @@ begin
   if LAyout.DarkTheme<>AValue then
   begin
     Layout.DarkTheme := AValue;
+    DarkThemeInstance.Apply(Panel_PenWidthPreview, AValue);
     Invalidate;
     UpdateToolImage(true);
   end;

+ 5 - 3
lazpaint/maintoolbar.inc

@@ -1244,11 +1244,13 @@ end;
 procedure TFMain.PaintBox_PenPreviewPaint(Sender: TObject);
 var bmp: TBGRABitmap;
     x,y,t: integer;
+    c: TBGRAPixel;
     m: single;
     bi: TLazPaintBrush;
     visualSize: single;
 begin
-  bmp := TBGRABitmap.Create(PaintBox_PenPreview.Width,PaintBox_PenPreview.Height,ColorToBGRA(ColorToRGB(clBtnFace)));
+  bmp := TBGRABitmap.Create(PaintBox_PenPreview.Width,PaintBox_PenPreview.Height,Panel_PenWidthPreview.Color);
+  if DarkTheme then c := clLightText else c := clBtnText;
   x := round(PaintBox_PenPreview.Width/2);
   y := round(PaintBox_PenPreview.Height/2);
   if Assigned(Zoom) then visualSize := ToolManager.ToolPenWidth * Zoom.Factor else visualSize := ToolManager.ToolPenWidth;
@@ -1259,10 +1261,10 @@ begin
       with bi do
       begin
         Size := visualSize;
-        bi.Put(bmp, x,y,ColorToBGRA(ColorToRGB(clBtnText)));
+        bi.Put(bmp, x,y,c);
       end;
   end else
-    bmp.FillEllipseAntialias(x,y,visualSize/2,visualSize/2,ColorToBGRA(ColorToRGB(clBtnText)));
+    bmp.FillEllipseAntialias(x,y,visualSize/2,visualSize/2,c);
   t := ImageList16.Width;
   m := t/10;
   x := 0;