|
15 | 15 | interface |
16 | 16 |
|
17 | 17 | uses |
| 18 | + System.SysUtils, |
18 | 19 | Vcl.Graphics, Vcl.Themes, |
19 | 20 | uAnalyserTypes; |
20 | 21 |
|
| 22 | +type |
| 23 | + TStyleServicesProvider = reference to function: TCustomStyleServices; |
| 24 | + |
| 25 | +var |
| 26 | + // Global Hook fuer Color-Auflösung. IDE-Plugin setzt das auf eine |
| 27 | + // Funktion die IOTAIDEThemingServices.StyleServices liefert. |
| 28 | + // Standalone laesst's nil — ActiveStyleServices faellt dann auf die |
| 29 | + // VCL-globale Vcl.Themes.StyleServices zurueck. |
| 30 | + StyleServicesProvider: TStyleServicesProvider = nil; |
| 31 | + |
| 32 | +// Liefert die aktive TCustomStyleServices. Im IDE-Plugin-Kontext via |
| 33 | +// StyleServicesProvider die IDE-spezifische (folgt IDE-Theme). |
| 34 | +// Sonst die VCL-globale (folgt TStyleManager.ActiveStyle). |
| 35 | +function ActiveStyleServices: TCustomStyleServices; |
| 36 | + |
21 | 37 | // Saturierte Akzentfarbe fuer eine Severity. Wird verwendet: |
22 | 38 | // * 3px-Indikatorleiste am linken Zellenrand |
23 | 39 | // * Akzent-Schriftfarben fuer "Vorher"/"Nachher"-Labels |
@@ -48,6 +64,15 @@ implementation |
48 | 64 | Winapi.Windows, |
49 | 65 | uAnalyserPalette; |
50 | 66 |
|
| 67 | +function ActiveStyleServices: TCustomStyleServices; |
| 68 | +begin |
| 69 | + Result := nil; |
| 70 | + if Assigned(StyleServicesProvider) then |
| 71 | + Result := StyleServicesProvider(); |
| 72 | + if not Assigned(Result) then |
| 73 | + Result := Vcl.Themes.StyleServices; |
| 74 | +end; |
| 75 | + |
51 | 76 | function SeverityAccent(Severity: TFindingSeverity): TColor; |
52 | 77 | begin |
53 | 78 | case Severity of |
@@ -81,7 +106,10 @@ function BlendColor(Base, Accent: TColor; Ratio: Single): TColor; |
81 | 106 | function SeverityBg(Severity: TFindingSeverity; |
82 | 107 | ABase: TColor): TColor; |
83 | 108 | begin |
84 | | - Result := SeverityBg(Severity, ABase, StyleServices); |
| 109 | + // Default-Pfad: via ActiveStyleServices — im IDE-Plugin liefert das die |
| 110 | + // IDE-StyleServices via StyleServicesProvider, im Standalone die VCL- |
| 111 | + // globale. |
| 112 | + Result := SeverityBg(Severity, ABase, ActiveStyleServices); |
85 | 113 | end; |
86 | 114 |
|
87 | 115 | function SeverityBg(Severity: TFindingSeverity; |
|
0 commit comments