zamtmn / metadarkstyle

76 stars 24 forks source link

"Unit Dependencies" window contains white components with graphs #23

Closed flowCRANE closed 1 year ago

flowCRANE commented 1 year ago

This is Lazarus 2.2.6, MetaDarkStyle package installed from the latest sources. Open the Unit Dependencies window and select the Projects and packages tab — both graph controls are white, instead of dark:

image

What is interesting, the graph control in the window Package Graph has dark style applied:

image

zamtmn commented 1 year ago

I checked for lazarus on linux with dark qt. There is also a white background. Most likely that it is set in Lazarus, this is not a problem of our package

flowCRANE commented 1 year ago

Ok, I found the reason — the default background color for the TLvlGraphControl is clWhite and both of these graph controls in the Unit dependencies window are createn from the code level (I don't know why). To fix this problem, it is enough to add one line with setting the ParentColor to True.

To do this, open Lazarus\ide\unitdependencies.pp file and go to the following method of the form:

procedure TUnitDependenciesWindow.SetupGroupsTabSheet;
begin
  GroupsTabSheet.Caption:=lisUDProjectsAndPackages;

  GroupsLvlGraph:=TLvlGraphControl.Create(Self);
  with GroupsLvlGraph do
  begin
    Name:='GroupsLvlGraph';
    Caption:='';
    Align:=alTop;
    Height:=200;
    NodeStyle.GapBottom:=5;
    Parent:=GroupsTabSheet;
    Options := Options + [lgoMinimizeEdgeLens];
    OnSelectionChanged:=@GroupsLvlGraphSelectionChanged;
    Images:=IDEImages.Images_16;
    PopupMenu := GraphPopupMenu;
    ParentColor := True; // <--------------------------- here
  end;

  GroupsSplitter.Top:=GroupsLvlGraph.Height;

  UnitsLvlGraph:=TLvlGraphControl.Create(Self);
  with UnitsLvlGraph do
  begin
    Name:='UnitsLvlGraph';
    Caption:='';
    Align:=alClient;
    NodeStyle.GapBottom:=5;
    Parent:=UnitGraphPanel;
    Options := Options + [lgoMinimizeEdgeLens];
    OnSelectionChanged:=@UnitsLvlGraphSelectionChanged;
    OnMouseDown:=@UnitsLvlGraphMouseDown;
    Images:=IDEImages.Images_16;
    PopupMenu := GraphPopupMenu;
    ParentColor := True; // <--------------------------- here
  end;
end;

So yes, this is not the problem with the MetaDarkStyle package. :)