tvplanit: Fix LCLScaling in TVpLEDLabel and TVpClock. Some refactoring.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8474 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-09-11 22:34:04 +00:00
parent bf1712ff85
commit 91dc676e62
6 changed files with 258 additions and 195 deletions

View File

@ -9,6 +9,7 @@
</Flags>
<SessionStorage Value="InProjectDir"/>
<Title Value="project1"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
</General>

View File

@ -14,6 +14,7 @@ uses
begin
RequireDerivedFormResource := True;
Application.Scaled:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;

View File

@ -1,13 +1,14 @@
object Form1: TForm1
Left = 320
Left = 142
Height = 292
Top = 160
Width = 457
Top = 71
Width = 459
Caption = 'TvPlanit Gadgets demo'
ClientHeight = 292
ClientWidth = 457
ClientWidth = 459
Font.Color = clWindowText
OnShow = FormShow
LCLVersion = '2.3.0.0'
object VpClock: TVpClock
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Panel1
@ -51,14 +52,13 @@ object Form1: TForm1
object BtnStartStop: TButton
AnchorSideLeft.Control = RgClockMode
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = RgClockMode
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = RgClockMode
AnchorSideBottom.Side = asrBottom
Left = 342
Height = 25
Top = 190
Top = 168
Width = 80
Anchors = [akLeft]
AutoSize = True
BorderSpacing.Left = 16
Caption = 'Start'
@ -118,7 +118,7 @@ object Form1: TForm1
AnchorSideBottom.Control = BtnStartStop
Left = 342
Height = 19
Top = 159
Top = 137
Width = 98
Anchors = [akLeft, akBottom]
BorderSpacing.Top = 4
@ -180,7 +180,7 @@ object Form1: TForm1
AnchorSideBottom.Control = BtnStartStop
Left = 342
Height = 19
Top = 159
Top = 137
Width = 85
Anchors = [akLeft, akBottom]
BorderSpacing.Top = 12
@ -238,7 +238,7 @@ object Form1: TForm1
AnchorSideRight.Side = asrBottom
Left = 342
Height = 25
Top = 217
Top = 195
Width = 80
AutoSize = True
BorderSpacing.Top = 2

View File

@ -110,18 +110,18 @@ procedure TForm1.CbNewClockFaceChange(Sender: TObject);
begin
if CbNewClockFace.Checked then begin
VpClock.AnalogOptions.ClockFace.LoadFromFile('clockface.bmp');
VpClock.AnalogOptions.HourHandWidth := 2;
VpClock.AnalogOptions.MinuteHandWidth := 2;
VpClock.AnalogOptions.SecondHandWidth := 1;
VpClock.Width := 100;
VpClock.Height := 100;
VpClock.AnalogOptions.HourHandWidth := Scale96ToFont(2);
VpClock.AnalogOptions.MinuteHandWidth := Scale96ToFont(2);
VpClock.AnalogOptions.SecondHandWidth := Scale96ToFont(1);
VpClock.Width := Scale96ToFont(100);
VpClock.Height := Scale96ToFont(100);
end else begin
VpClock.AnalogOptions.ClockFace := nil;
VpClock.AnalogOptions.HourHandWidth := 4;
VpClock.AnalogOptions.MinuteHandWidth := 3;
VpClock.AnalogOptions.SecondHandWidth := 1;
VpClock.Width := 200;
VpClock.Height := 200;
VpClock.AnalogOptions.HourHandWidth := Scale96ToFont(4);
VpClock.AnalogOptions.MinuteHandWidth := Scale96ToFont(3);
VpClock.AnalogOptions.SecondHandWidth := Scale96ToFont(1);
VpClock.Width := Scale96ToFont(200);
VpClock.Height := Scale96ToFont(200);
end;
VpClock.AnalogOptions.DrawMarks := not CbNewClockFace.Checked;
if RgDisplayMode.ItemIndex = ord(dmAnalog) then
@ -190,10 +190,9 @@ begin
dmAnalog:
CbNewClockFaceChange(nil);
dmDigital:
begin
VpClock.Width := 136;
VpClock.Height := 30;
end;
;
// The clock is not freely sizeable in digital display mode
// VpClock.SetBounds(VpClock.Left, VpClock.Left, Scale96ToForm(136), Scale96ToForm(30));
end;
CbMilitaryTime.Visible := VpClock.DisplayMode = dmDigital;
CbNewClockface.Visible := VpClock.DisplayMode = dmAnalog;