RVRuler and VCL styles

General TRichView support forum. Please post your questions here
Post Reply
Martian
Posts: 95
Joined: Sun Apr 03, 2011 7:32 pm

RVRuler and VCL styles

Post by Martian »

Hi there,
Looks like RVRules doesn't support VCL styles.
What is the best way to assign correct style colors to it?
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: RVRuler and VCL styles

Post by Sergey Tkachenko »

The ruler support VCL style colors. I do not think that more complete VCL style support is possible.
ruler-skin.png
ruler-skin.png (53.55 KiB) Viewed 28290 times
Martian
Posts: 95
Joined: Sun Apr 03, 2011 7:32 pm

Re: RVRuler and VCL styles

Post by Martian »

Glossy.png
Glossy.png (9.06 KiB) Viewed 28262 times
Emerald.png
Emerald.png (6.34 KiB) Viewed 28262 times
Coral.png
Coral.png (7.35 KiB) Viewed 28262 times
CobaltXEMedia.png
CobaltXEMedia.png (9.21 KiB) Viewed 28262 times
carbon.png
carbon.png (8.04 KiB) Viewed 28262 times
Martian
Posts: 95
Joined: Sun Apr 03, 2011 7:32 pm

Re: RVRuler and VCL styles

Post by Martian »

Windows10Dark.png
Windows10Dark.png (6.02 KiB) Viewed 28262 times
TabletDark.png
TabletDark.png (6.66 KiB) Viewed 28262 times
Radiant.png
Radiant.png (6.78 KiB) Viewed 28262 times
OnyxBlue.png
OnyxBlue.png (13.73 KiB) Viewed 28262 times
Jet.png
Jet.png (7.9 KiB) Viewed 28262 times
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: RVRuler and VCL styles

Post by Sergey Tkachenko »

1) Which version of TRichView do you use?
2) What's the value of Ruler.RulerColor property?
Martian
Posts: 95
Joined: Sun Apr 03, 2011 7:32 pm

Re: RVRuler and VCL styles

Post by Martian »

1) 18.3
2) clWindow
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: RVRuler and VCL styles

Post by Sergey Tkachenko »

VCL skins are completely supported if Ruler.SkinType = stNoSkin.
Your ruler has SkinType <> stNoSkin.

There is a way to improve skin supports in this mode.
In RVRulerBase.pas, change the procedure UpdateRulerColors:

Code: Select all

procedure TCustomRuler.UpdateRulerColors;
Begin
  If FSkinType = stNoSkin then
    Exit;
  Move(DefRulerColors, FRulerColors, 40);
  If ColorToRGB(GetSysColor(RulerColor)) <> clWhite then
    ColorizeColorsAlter(FRulerColors, GetSysColor(RulerColor))
  Else If FSkinType = stSkin2 then
    ColorizeColorsAlter(FRulerColors, $00C0C0C0);
  SaturationColors(FRulerColors, FRulSaturation);
end;
Make this procedure public in TCustomRuler. Call it when the application starts and after each change of VCL theme.
But look at this code. In skin modes, the ruler has a predefined set of gray colors that can be shaded using RulerColor, and only in stSkin1 mode.

After the change I suggested, the ruler look betters in dark themes. But still not very good in inverted (light on dark) color themes.
If this shading is OK for you, you can improve the result by assigning inverted font color for inverted themes:

Code: Select all

uses Themes, RVFuncs;

procedure TForm3.btnSkinClick(Sender: TObject);
begin
  RVA_ChooseStyle;
  RVRuler1.UpdateRulerColors;
  if RV_GetLuminance(StyleServices.GetSystemColor(clWindowText)) >
    RV_GetLuminance(StyleServices.GetSystemColor(clWindow)) then
    RVRuler1.Font.Color := not StyleServices.GetSystemColor(clWindowText) and $FFFFFF
  else
    RVRuler1.Font.Color := clWindowText;
end;
But the best solution is to assign RVRuler.SkinType = stNoSkin in these themes.
Post Reply