From 77e6fbbd041f34bbc66dee528cff51936e6b601b Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Mon, 3 Jun 2019 22:27:04 +0000 Subject: [PATCH] jvcllaz: Make TJvWizard high-dpi aware. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6997 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../examples/JvWizard/JvWizardDemo.lpi | 12 +- .../jvcllaz/examples/JvWizard/uformmain.lfm | 32 +- components/jvcllaz/run/JvWizard/jvwizard.pas | 281 ++++++++++++++++-- .../run/JvWizard/jvwizardroutemaplist.pas | 125 ++++++-- .../run/JvWizard/jvwizardroutemapnodes.pas | 95 ++++-- .../run/JvWizard/jvwizardroutemapsteps.pas | 42 ++- 6 files changed, 475 insertions(+), 112 deletions(-) diff --git a/components/jvcllaz/examples/JvWizard/JvWizardDemo.lpi b/components/jvcllaz/examples/JvWizard/JvWizardDemo.lpi index 1028539c0..0244d5d13 100644 --- a/components/jvcllaz/examples/JvWizard/JvWizardDemo.lpi +++ b/components/jvcllaz/examples/JvWizard/JvWizardDemo.lpi @@ -1,13 +1,11 @@ - + - - - + <Scaled Value="True"/> <ResourceType Value="res"/> @@ -22,11 +20,11 @@ </BuildModes> <PublishOptions> <Version Value="2"/> - <UseFileFilters Value="True"/> </PublishOptions> <RunParams> - <FormatVersion Value="2"/> - <Modes Count="0"/> + <local> + <FormatVersion Value="1"/> + </local> </RunParams> <RequiredPackages Count="2"> <Item1> diff --git a/components/jvcllaz/examples/JvWizard/uformmain.lfm b/components/jvcllaz/examples/JvWizard/uformmain.lfm index 9b40275ba..d86f580bb 100644 --- a/components/jvcllaz/examples/JvWizard/uformmain.lfm +++ b/components/jvcllaz/examples/JvWizard/uformmain.lfm @@ -7,7 +7,7 @@ object Form1: TForm1 Caption = 'JvWizard demo' ClientHeight = 317 ClientWidth = 596 - LCLVersion = '2.1.0.0' + LCLVersion = '1.8.4.0' object JvWizard1: TJvWizard Left = 0 Height = 317 @@ -49,9 +49,9 @@ object Form1: TForm1 Header.Title.Anchors = [akTop, akLeft, akRight] Header.Title.Font.Height = -16 Header.Title.Font.Style = [fsBold] - Header.Subtitle.Color = clNone - Header.Subtitle.Text = 'This is the JvWizard demo for Lazarus' - Header.Subtitle.Anchors = [akTop, akLeft, akRight, akBottom] + Header.SubTitle.Color = clNone + Header.SubTitle.Text = 'This is the JvWizard demo for Lazarus' + Header.SubTitle.Anchors = [akTop, akLeft, akRight, akBottom] VisibleButtons = [bkNext, bkCancel] Caption = 'JvWizardWelcomePage1' WaterMark.Image.Picture.Data = { @@ -1909,9 +1909,9 @@ object Form1: TForm1 Header.Title.Anchors = [akTop, akLeft, akRight] Header.Title.Font.Height = -16 Header.Title.Font.Style = [fsBold] - Header.Subtitle.Color = clNone - Header.Subtitle.Text = 'An edit control was added to page 1.' - Header.Subtitle.Anchors = [akTop, akLeft, akRight, akBottom] + Header.SubTitle.Color = clNone + Header.SubTitle.Text = 'An edit control was added to page 1.' + Header.SubTitle.Anchors = [akTop, akLeft, akRight, akBottom] VisibleButtons = [bkStart, bkBack, bkNext, bkCancel] Caption = 'JvWizardInteriorPage1' object Label2: TLabel @@ -1938,9 +1938,9 @@ object Form1: TForm1 Header.Title.Anchors = [akTop, akLeft, akRight] Header.Title.Font.Height = -16 Header.Title.Font.Style = [fsBold] - Header.Subtitle.Color = clNone - Header.Subtitle.Text = 'A checkbox and a radiobutton were added to page 2.' - Header.Subtitle.Anchors = [akTop, akLeft, akRight, akBottom] + Header.SubTitle.Color = clNone + Header.SubTitle.Text = 'A checkbox and a radiobutton were added to page 2.' + Header.SubTitle.Anchors = [akTop, akLeft, akRight, akBottom] VisibleButtons = [bkStart, bkBack, bkNext, bkCancel] Caption = 'JvWizardInteriorPage2' object CheckBox1: TCheckBox @@ -1967,9 +1967,9 @@ object Form1: TForm1 Header.Title.Anchors = [akTop, akLeft, akRight] Header.Title.Font.Height = -16 Header.Title.Font.Style = [fsBold] - Header.Subtitle.Color = clNone - Header.Subtitle.Text = 'A listbox was added to page 3.' - Header.Subtitle.Anchors = [akTop, akLeft, akRight, akBottom] + Header.SubTitle.Color = clNone + Header.SubTitle.Text = 'A listbox was added to page 3.' + Header.SubTitle.Anchors = [akTop, akLeft, akRight, akBottom] VisibleButtons = [bkStart, bkBack, bkNext, bkCancel] Caption = 'JvWizardInteriorPage3' object ListBox1: TListBox @@ -1995,9 +1995,9 @@ object Form1: TForm1 Header.Title.Anchors = [akTop, akLeft, akRight] Header.Title.Font.Height = -16 Header.Title.Font.Style = [fsBold] - Header.Subtitle.Color = clNone - Header.Subtitle.Text = 'This completes this little demo.' - Header.Subtitle.Anchors = [akTop, akLeft, akRight, akBottom] + Header.SubTitle.Color = clNone + Header.SubTitle.Text = 'This completes this little demo.' + Header.SubTitle.Anchors = [akTop, akLeft, akRight, akBottom] VisibleButtons = [bkStart, bkBack, bkFinish, bkCancel] Caption = 'JvWizardInteriorPage4' object Label3: TLabel diff --git a/components/jvcllaz/run/JvWizard/jvwizard.pas b/components/jvcllaz/run/JvWizard/jvwizard.pas index 501a84fca..e94d76ab5 100644 --- a/components/jvcllaz/run/JvWizard/jvwizard.pas +++ b/components/jvcllaz/run/JvWizard/jvwizard.pas @@ -348,6 +348,23 @@ type const bkAllButtons = [bkStart, bkLast, bkBack, bkFinish, bkNext, bkCancel, bkHelp]; + DEFAULT_WIZARD_ROUTECONTROL_WIDTH = 145; + DEFAULT_WIZARD_WATERMARK_WIDTH = 164; + DEFAULT_WIZARD_WATERMARK_BORDERWIDTH = 1; + DEFAULT_WIZARD_PAGEHEADER_HEIGHT = 64; + DEFAULT_WIZARD_PAGEHEADER_IMAGEOFFSET = 0; + DEFAULT_WIZARD_PAGEPANEL_BORDERWIDTH = 7; + DEFAULT_WIZARD_PAGETITLE_INDENT = 0; + DEFAULT_WIZARD_PAGETITLE_ANCHORPLACEMENT = 4; + + DEFAULT_WIZARD_ROUTEMAP_CURVATURE = 9; + DEFAULT_WIZARD_ROUTEMAP_OFFSET = 8; + DEFAULT_WIZARD_ROUTEMAP_HOTTRACKBORDER = 2; + DEFAULT_WIZARD_ROUTEMAP_ITEMHEIGHT = 25; + DEFAULT_WIZARD_ROUTEMAP_NODES_INDENT = 8; + DEFAULT_WIZARD_ROUTEMAP_NODES_ITEMHEIGHT = 20; + DEFAULT_WIZARD_ROUTEMAP_STEPS_INDENT = 5; + type TJvWizardAlign = alTop..alRight; TJvWizardLeftRight = alLeft..alRight; @@ -502,6 +519,8 @@ type FAnchors: TAnchors; FIndent: Integer; FFont: TFont; + function IsAnchorPlacementStored: Boolean; + function IsIndentStored: Boolean; procedure SetText(const Value: string); procedure SetAlignment(Value: TAlignment); procedure SetAnchors(Value: TAnchors); @@ -524,12 +543,18 @@ type procedure Assign(Source: TPersistent); override; procedure PaintTo(ACanvas: TCanvas; var ARect: TRect); override; published - property Text: string read FText write SetText; - property Anchors: TAnchors read FAnchors write SetAnchors default [akLeft, akTop]; - property AnchorPlacement: Integer read FAnchorPlacement write SetAnchorPlacement default 4; - property Indent: Integer read FIndent write SetIndent default 0; - property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify; - property Font: TFont read FFont write SetFont; + property Text: string + read FText write SetText; + property Anchors: TAnchors + read FAnchors write SetAnchors default [akLeft, akTop]; + property AnchorPlacement: Integer + read FAnchorPlacement write SetAnchorPlacement stored IsAnchorPlacementStored; + property Indent: Integer + read FIndent write SetIndent stored IsIndentStored; + property Alignment: TAlignment + read FAlignment write SetAlignment default taLeftJustify; + property Font: TFont + read FFont write SetFont; end; TJvWizardPageObject = class(TJvWizardGraphicObject) @@ -553,6 +578,8 @@ type FImageOffset: Integer; FImageAlignment: TJvWizardImageLeftRight; FShowDivider: Boolean; + function IsHeightStored: Boolean; + function IsImageOffsetStored: Boolean; procedure SetHeight(Value: Integer); procedure SetImageIndex(Value: Integer); procedure SetImageOffset(Value: Integer); @@ -574,12 +601,12 @@ type procedure PaintTo(ACanvas: TCanvas; var ARect: TRect); override; published property ImageIndex: Integer read FImageIndex write SetImageIndex default -1; - property ImageOffset: Integer read FImageOffset write SetImageOffset default 0; + property ImageOffset: Integer read FImageOffset write SetImageOffset stored IsImageOffsetStored; property ImageAlignment: TJvWizardImageLeftRight read FImageAlignment write SetImageAlignment default iaRight; - property Height: Integer read FHeight write SetHeight default 70; + property Height: Integer read FHeight write SetHeight stored IsHeightStored; property ParentFont: Boolean read FParentFont write SetParentFont default True; property Title: TJvWizardPageTitle read FTitle write SetTitle; - property Subtitle: TJvWizardPageTitle read FSubtitle write SetSubtitle; + property SubTitle: TJvWizardPageTitle read FSubtitle write SetSubtitle; property ShowDivider: Boolean read FShowDivider write SetShowDivider default True; property Color default clWindow; property Visible; @@ -596,6 +623,8 @@ type procedure SetBorderWidth(Value: Integer); procedure SetAlign(Value: TJvWizardLeftRight); procedure ImageChanged(Sender: TObject); + function IsBorderWidthStored: Boolean; + function IsWidthStored: Boolean; protected procedure VisibleChanged; override; public @@ -604,9 +633,11 @@ type procedure PaintTo(ACanvas: TCanvas; var ARect: TRect); override; published property Align: TJvWizardLeftRight read FAlign write SetAlign default alLeft; - property BorderWidth: Integer read FBorderWidth write SetBorderWidth default 1; + property BorderWidth: Integer + read FBorderWidth write SetBorderWidth stored IsBorderWidthStored; property Image: TJvWizardImage read FImage write FImage; - property Width: Integer read FWidth write SetWidth default 164; + property Width: Integer + read FWidth write SetWidth stored IsWidthStored; property Color default clActiveCaption; property Visible; end; @@ -615,12 +646,14 @@ type TJvWizardPagePanel = class(TJvWizardPageObject) private FBorderWidth: Word; + function IsBorderWidthStored: Boolean; procedure SetBorderWidth(Value: Word); public constructor Create; override; procedure PaintTo(ACanvas: TCanvas; var ARect: TRect); override; published - property BorderWidth: Word read FBorderWidth write SetBorderWidth default 7; + property BorderWidth: Word + read FBorderWidth write SetBorderWidth stored IsBorderWidthStored; property Color default clBtnFace; property Visible default False; end; @@ -681,6 +714,14 @@ type procedure Done; virtual; { called just before the page is hidden. Page: To page } procedure ExitPage(const ToPage: TJvWizardCustomPage); virtual; // renamed from Exit() to ExitPage + { adaption of dimensions to screen dpi } + procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy; + const AXProportion, AYProportion: Double); override; + {$IF LCL_FullVersion >= 1080100} + procedure ScaleFontsPPI(const AToPPI: Integer; const AProportion: Double); override; + {$ELSEIF LCL_FullVersion >= 1080000} + procedure ScaleFontsPPI(const AProportion: Double); override; + {$ENDIF} public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -725,6 +766,8 @@ type FWaterMark: TJvWizardWaterMark; protected procedure AdjustClientRect(var Rect: TRect); override; + procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy; + const AXProportion, AYProportion: Double); override; procedure DrawPage(ACanvas: TCanvas; var ARect: TRect); override; public constructor Create(AOwner: TComponent); override; @@ -772,6 +815,7 @@ type FOnActivePageChanged: TNotifyEvent; FOnActivePageChanging: TJvWizardChangingPageEvent; FHeaderImages: TCustomImageList; + FHeaderImagesWidth: Integer; FImageChangeLink: TChangeLink; FAutoHideButtonBar: Boolean; FDefaultButtons: Boolean; @@ -784,6 +828,9 @@ type procedure SetButtonBarHeight(Value: Integer); procedure SetActivePage(Page: TJvWizardCustomPage); procedure SetHeaderImages(Value: TCustomImageList); + {$IF LCL_FullVersion >= 1090000} + procedure SetHeaderImagesWidth(Value: Integer); + {$IFEND} function GetButtonClick(Index: Integer): TNotifyEvent; procedure SetButtonClick(Index: Integer; const Value: TNotifyEvent); procedure ImageListChange(Sender: TObject); @@ -851,6 +898,9 @@ type property ShowDivider: Boolean read FShowDivider write SetShowDivider default True; property ShowRouteMap: Boolean read GetShowRouteMap write SetShowRouteMap; property HeaderImages: TCustomImageList read FHeaderImages write SetHeaderImages; + {$IF LCL_FullVersion >= 1090000} + property HeaderImagesWidth: Integer read FHeaderImagesWidth write SetHeaderImagesWidth default 0; + {$IFEND} property OnSelectFirstPage: TJvWizardSelectPageEvent read FOnSelectFirstPage write FOnSelectFirstPage; property OnSelectLastPage: TJvWizardSelectPageEvent read FOnSelectLastPage write FOnSelectLastPage; property OnSelectNextPage: TJvWizardSelectPageEvent read FOnSelectNextPage write FOnSelectNextPage; @@ -1290,7 +1340,7 @@ begin FAlign := alLeft; inherited Align := alLeft; TabStop := False; - Width := 145; + Width := DEFAULT_WIZARD_ROUTECONTROL_WIDTH; Visible := True; FPages := TList.Create; DoubleBuffered := True; @@ -1639,8 +1689,8 @@ end; constructor TJvWizardPageTitle.Create; begin inherited Create; - FAnchorPlacement := 4; - FIndent := 0; + FAnchorPlacement := DEFAULT_WIZARD_PAGETITLE_ANCHORPLACEMENT; + FIndent := DEFAULT_WIZARD_PAGETITLE_INDENT; FAnchors := [akLeft, akTop]; FAlignment := taLeftJustify; FFont := TFont.Create; @@ -1672,6 +1722,14 @@ begin Filer.DefineProperty('Text', nil, @WriteText, FText = ''); end; +function TJvWizardPageTitle.IsAnchorPlacementStored: Boolean; +var + ap: Integer; +begin + ap := WizardPageHeader.WizardPage.Scale96ToFont(DEFAULT_WIZARD_PAGETITLE_ANCHORPLACEMENT); + Result := FAnchorPlacement <> ap; +end; + procedure TJvWizardPageTitle.SetWizardPageHeader(Value: TJvWizardPageHeader); begin if FWizardPageHeader <> Value then @@ -1818,6 +1876,11 @@ begin DoChange; end; +function TJvWizardPageTitle.IsIndentStored: Boolean; +begin + Result := FIndent <> WizardPageHeader.WizardPage.Scale96ToFont(FIndent); +end; + procedure TJvWizardPageTitle.Assign(Source: TPersistent); begin if Source is TJvWizardPageTitle then @@ -1861,7 +1924,7 @@ constructor TJvWizardPageHeader.Create; begin inherited Create; Color := clWindow; - FHeight := 70; + FHeight := DEFAULT_WIZARD_PAGEHEADER_HEIGHT; // will be scaled by page FParentFont := True; { Set up Title } FTitle := TJvWizardPageTitle.Create; @@ -1874,7 +1937,7 @@ begin FSubtitle.FAnchors := [akLeft, akTop, akRight, akBottom]; FSubtitle.FText := RsSubtitle; FImageAlignment := iaRight; - FImageOffset := 0; + FImageOffset := DEFAULT_WIZARD_PAGEHEADER_IMAGEOFFSET; // will be scaled by page FImageIndex := -1; FShowDivider := True; end; @@ -1939,11 +2002,34 @@ end; function TJvWizardPageHeader.GetImageRect(const AImages: TCustomImageList; var ARect: TRect): TRect; +var +{$IF LCL_FullVersion >= 1090000} + imgres: TScaledImageListResolution; + ppi: Integer; + f: Double; +{$IFEND} + w, h: Integer; + delta: Integer; begin - Result := Bounds(ARect.Left, ARect.Top, AImages.Width, AImages.Height); - OffsetRect(Result, 0, ((ARect.Bottom - ARect.Top) - AImages.Height) div 2); + {$IF LCL_FullVersion >= 1090000} + ppi := WizardPage.Font.PixelsPerInch; + f := WizardPage.GetCanvasScaleFactor; + if AImages = WizardPage.Wizard.HeaderImages then + w := WizardPage.Wizard.HeaderImagesWidth + else w := 0; + imgres := AImages.ResolutionForPPI[w, ppi, f]; + h := imgRes.Height; + w := imgRes.Width; + {$ELSE} + h := AImages.Height; + w := AImages.Width; + {$IFEND} + delta := WizardPage.Scale96ToFont(4); + + Result := Bounds(ARect.Left, ARect.Top, w, h); + OffsetRect(Result, 0, ((ARect.Bottom - ARect.Top) - h) div 2); if FImageAlignment = iaRight then - OffsetRect(Result, ARect.Right - ARect.Left - AImages.Width - 4, 0); + OffsetRect(Result, ARect.Right - ARect.Left - w - delta, 0); if FImageAlignment = iaLeft then begin @@ -1963,6 +2049,16 @@ begin end; end; +function TJvWizardPageHeader.IsHeightStored: Boolean; +begin + Result := FHeight <> WizardPage.Scale96ToFont(DEFAULT_WIZARD_PAGEHEADER_HEIGHT); +end; + +function TJvWizardPageHeader.IsImageOffsetStored: Boolean; +begin + Result := FImageOffset <> WizardPage.Scale96ToFont(DEFAULT_WIZARD_PAGEHEADER_IMAGEOFFSET); +end; + procedure TJvWizardPageHeader.SetSubtitle(const Value: TJvWizardPageTitle); begin FSubtitle.Assign(Value); @@ -2052,8 +2148,8 @@ begin inherited Create; FAlign := alLeft; Color := clActiveCaption; - FWidth := 164; - FBorderWidth := 1; + FWidth := DEFAULT_WIZARD_WATERMARK_WIDTH; + FBorderWidth := DEFAULT_WIZARD_WATERMARK_BORDERWIDTH; FImage := TJvWizardImage.Create; FImage.OnChange := @ImageChanged; end; @@ -2121,12 +2217,37 @@ begin FImage.PaintTo(ACanvas, R); end; end; + (* +procedure TJvWizardWaterMark.DoAutoAdjustLayout( + const AMode: TLayoutAdjustmentPolicy; const AXProportion, AYProportion: Double); +begin + inherited; + if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then + begin + BeginUpdate; + try + FWidth := Round(FWidth * AXProportion); + finally + EndUpdate; + end; + end; +end;*) procedure TJvWizardWaterMark.ImageChanged(Sender: TObject); begin DoChange; end; +function TJvWizardWaterMark.IsBorderWidthStored: Boolean; +begin + Result := FBorderWidth <> WizardPage.Scale96ToFont(DEFAULT_WIZARD_WATERMARK_BORDERWIDTH); +end; + +function TJvWizardWaterMark.IsWidthStored: Boolean; +begin + Result := FWidth <> WizardPage.Scale96ToFont(DEFAULT_WIZARD_WATERMARK_WIDTH); +end; + procedure TJvWizardWaterMark.VisibleChanged; begin inherited VisibleChanged; @@ -2139,11 +2260,16 @@ end; constructor TJvWizardPagePanel.Create; begin inherited Create; - FBorderWidth := 7; + FBorderWidth := DEFAULT_WIZARD_PAGEPANEL_BORDERWIDTH;; Color := clBtnFace; Visible := False; end; +function TJvWizardPagePanel.IsBorderWidthStored: Boolean; +begin + Result := FBorderWidth <> WizardPage.Scale96ToFont(DEFAULT_WIZARD_PAGEPANEL_BORDERWIDTH); +end; + procedure TJvWizardPagePanel.PaintTo(ACanvas: TCanvas; var ARect: TRect); begin if Visible and (FBorderWidth > 0) then @@ -2183,9 +2309,16 @@ begin Color := clBtnFace; FHeader := TJvWizardPageHeader.Create; FHeader.WizardPage := Self; + FHeader.Height := Scale96ToFont(DEFAULT_WIZARD_PAGEHEADER_HEIGHT); + FHeader.ImageOffset := Scale96ToFont(DEFAULT_WIZARD_PAGEHEADER_IMAGEOFFSET); + Title.AnchorPlacement := Scale96ToFont(DEFAULT_WIZARD_PAGETITLE_ANCHORPLACEMENT); + Title.Indent := Scale96ToFont(DEFAULT_WIZARD_PAGETITLE_INDENT); + SubTitle.AnchorPlacement := Scale96ToFont(DEFAULT_WIZARD_PAGETITLE_ANCHORPLACEMENT); + SubTitle.Indent := Scale96ToFont(DEFAULT_WIZARD_PAGETITLE_INDENT); FImage := TJvWizardImage.Create; FImage.OnChange := @ImageChanged; FPanel := TJvWizardPagePanel.Create; + FPanel.BorderWidth := Scale96ToFont(DEFAULT_WIZARD_PAGEPANEL_BORDERWIDTH); FPanel.WizardPage := Self; { try to avoid screen flicker, it paints its image into memory, then move image memory to the screen at once. } @@ -2440,12 +2573,57 @@ begin Header.Title := Value; end; +procedure TJvWizardCustomPage.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy; + const AXProportion, AYProportion: Double); +begin + inherited; + if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then + begin + if FHeader.IsHeightStored then + FHeader.Height := Round(FHeader.Height * AYProportion); + if FHeader.IsImageOffsetStored then + FHeader.ImageOffset := Round(FHeader.ImageOffset * AXProportion); + + if Title.IsIndentStored then + Title.Indent := Round(Title.Indent * AXProportion); + if Title.IsAnchorPlacementStored then + Title.AnchorPlacement := Round(Title.AnchorPlacement * AXProportion); + + if SubTitle.IsIndentStored then + SubTitle.Indent := Round(SubTitle.Indent * AXProportion); + if SubTitle.IsAnchorPlacementStored then + SubTitle.AnchorPlacement := Round(SubTitle.AnchorPlacement * AXProportion); + + if FPanel.IsBorderWidthStored then + FPanel.BorderWidth := Round(FPanel.BorderWidth * AXProportion); + end; +end; + +{$IF LCL_FullVersion >= 1080100} +procedure TJvWizardCustomPage.ScaleFontsPPI(const AToPPI: Integer; + const AProportion: Double); +begin + inherited; + DoScaleFontPPI(Title.Font, AToPPI, AProportion); + DoScaleFontPPI(SubTitle.Font, AToPPI, AProportion); +end; +{$ELSEIF LCL_FullVersion >= 1080000} +procedure TJvWizardCustomPage.ScaleFontsPPI(const AProportion: Double); +begin + inherited; + DoScaleFontPPI(Title.Font, AProportion); + DoScaleFontPPI(SubTitle.Font, AProportion); +end; +{$ENDIF} + //=== { TJvWizardWelcomePage } =============================================== constructor TJvWizardWelcomePage.Create(AOwner: TComponent); begin inherited Create(AOwner); FWaterMark := TJvWizardWaterMark.Create; + FWaterMark.Width := Scale96ToFont(DEFAULT_WIZARD_WATERMARK_WIDTH); + FWaterMark.BorderWidth := Scale96ToFont(DEFAULT_WIZARD_WATERMARK_BORDERWIDTH); FWaterMark.WizardPage := Self; FHeader.FTitle.FText := RsWelcome; // welcome pages don't have dividers by default @@ -2471,6 +2649,19 @@ begin end; end; +procedure TJvWizardWelcomePage.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy; + const AXProportion, AYProportion: Double); +begin + inherited; + if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then + begin + if FWaterMark.IsWidthStored then + FWatermark.Width := Round(FWatermark.Width * AXProportion); + if FWaterMark.IsBorderWidthStored then + FWatermark.BorderWidth := Round(FWaterMark.BorderWidth * AXProportion); + end; +end; + procedure TJvWizardWelcomePage.DrawPage(ACanvas: TCanvas; var ARect: TRect); begin FWaterMark.PaintTo(ACanvas, ARect); @@ -2922,6 +3113,15 @@ begin FActivePage.Invalidate; end; +{$IF LCL_FullVersion >= 1090000} +procedure TJvWizard.SetHeaderImagesWidth(Value: Integer); +begin + if FHeaderImagesWidth <> Value then begin + FHeaderImagesWidth := Value; + end; +end; +{$IFEND} + function TJvWizard.GetButtonClick(Index: Integer): TNotifyEvent; begin if FNavigateButtons[TJvWizardButtonKind(Index)].Control <> nil then @@ -3034,6 +3234,10 @@ var end; end; +const + cDELTA = 2; +var + delta: Integer; begin if Parent = nil then Exit; @@ -3050,25 +3254,26 @@ begin Exclude(AButtonSet, bkFinish); end; end; - ATop := ClientRect.Bottom - FButtonBarHeight + CalculateButtonPlacement + 2; + delta := Scale96ToForm(cDELTA); + ATop := ClientRect.Bottom - FButtonBarHeight + CalculateButtonPlacement + delta; { Position left side buttons } ALeft := ClientRect.Left + CalculateButtonPlacement; - LocateButton(bkHelp, CalculateButtonPlacement + 2); + LocateButton(bkHelp, CalculateButtonPlacement + delta); LocateButton(bkStart, 1); LocateButton(bkLast, 0); { Position right side buttons } ALeft := ClientRect.Right - CalculateButtonPlacement; if [bkNext, bkFinish] * AButtonSet = [bkNext, bkFinish] then begin - LocateButton(bkCancel, -1); - LocateButton(bkFinish, -CalculateButtonPlacement - 2); + LocateButton(bkCancel, -delta div 2); + LocateButton(bkFinish, -CalculateButtonPlacement - delta); end else begin - LocateButton(bkCancel, -CalculateButtonPlacement - 2); - LocateButton(bkFinish, -1); + LocateButton(bkCancel, -CalculateButtonPlacement - delta); + LocateButton(bkFinish, -delta div 2); end; - LocateButton(bkNext, -2); + LocateButton(bkNext, -delta); LocateButton(bkBack, 0); end else // Hide all buttons @@ -3179,4 +3384,20 @@ begin FNavigateButtons[TJvWizardButtonKind(Index)] := Value; end; +(* +procedure TJvWizard.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy; + const AXProportion, AYProportion: Double); +begin + inherited; + if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then + begin + BeginUpdate; + try + finally + EndUpdate; + end; + end; +end; + *) + end. diff --git a/components/jvcllaz/run/JvWizard/jvwizardroutemaplist.pas b/components/jvcllaz/run/JvWizard/jvwizardroutemaplist.pas index 8857e06e0..54a655809 100644 --- a/components/jvcllaz/run/JvWizard/jvwizardroutemaplist.pas +++ b/components/jvcllaz/run/JvWizard/jvwizardroutemaplist.pas @@ -36,7 +36,8 @@ unit JvWizardRouteMapList; interface uses - Types, SysUtils, Classes, Graphics, Controls, Forms, LMessages, LCLIntf, LCLType, + LMessages, LCLIntf, LCLType, LCLVersion, + Types, SysUtils, Classes, Graphics, Controls, Forms, JvTypes, JvJVCLUtils, JvWizard; type @@ -87,6 +88,12 @@ type procedure SetActiveFontOptions(const Value: TJvTrackFontOptions); procedure SetHotTrackFontOptions(const Value: TJvTrackFontOptions); function IsHotTrackFontStored: Boolean; + function IsCurvatureStored: Boolean; + function IsHorzOffsetStored: Boolean; + function IsHotTrackBorderStored: Boolean; + function IsItemHeightStored: Boolean; + function IsTextOffsetStored: Boolean; + function IsVertOffsetStored: Boolean; protected procedure DrawPageItem(ACanvas: TCanvas; ARect: TRect; MousePos: TPoint; APageIndex: Integer); virtual; procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; @@ -97,6 +104,14 @@ type procedure CMFontChanged(var Msg: TLMessage); message CM_FONTCHANGED; procedure CursorChanged; procedure FontChanged; reintroduce; + { High-DPI } + procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy; + const AXProportion, AYProportion: Double); override; + {$IF LCL_FullVersion >= 1080100} + procedure ScaleFontsPPI(const AToPPI: Integer; const AProportion: Double); override; + {$ELSEIF LCL_FullVersion >= 1080000} + procedure ScaleFontsPPI(const AProportion: Double); override; + {$ENDIF} public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -107,13 +122,12 @@ type property Alignment: TAlignment read FAlignment write SetAlignment default taCenter; property Clickable: Boolean read FClickable write FClickable default True; property Color default $00C08000; - property Curvature: Integer read FCurvature write SetCurvature default 9; + property Curvature: Integer read FCurvature write SetCurvature stored IsCurvatureStored; property Font; - property HorzOffset: Integer read FHorzOffset write SetHorzOffset default 8; - property HotTrackBorder: Integer read FHotTrackBorder write FHotTrackBorder default 2; + property HorzOffset: Integer read FHorzOffset write SetHorzOffset stored IsHorzOffsetStored; + property HotTrackBorder: Integer read FHotTrackBorder write FHotTrackBorder stored IsHotTrackBorderStored; property HotTrackCursor: TCursor read FHotTrackCursor write FHotTrackCursor default crHandPoint; property HotTrack: Boolean read FHotTrack write FHotTrack default True; - property HotTrackFont: TFont read FHotTrackFont write SetHotTrackFont stored IsHotTrackFontStored; property HotTrackFontOptions: TJvTrackFontOptions read FHotTrackFontOptions write SetHotTrackFontOptions default DefaultTrackFontOptions; @@ -122,12 +136,12 @@ type property IncludeDisabled: Boolean read FIncludeDisabled write SetIncludeDisabled default False; property BorderColor: TColor read FBorderColor write SetBorderColor default clNavy; property ItemColor: TColor read FItemColor write SetItemColor default clCream; - property ItemHeight: Integer read FItemHeight write SetItemHeight default 25; + property ItemHeight: Integer read FItemHeight write SetItemHeight stored IsItemHeightStored; property ItemText: TRouteMapListItemText read FItemText write SetItemText default itCaption; property Rounded: Boolean read FRounded write SetRounded default False; property ShowImages: Boolean read FShowImages write SetShowImages default False; - property TextOffset: Integer read FTextOffset write SetTextOffset default 8; - property VertOffset: Integer read FVertOffset write SetVertOffset default 8; + property TextOffset: Integer read FTextOffset write SetTextOffset stored IsTextOffsetStored; + property VertOffset: Integer read FVertOffset write SetVertOffset stored IsVertOffsetStored; property OnDrawItem: TJvWizardDrawRouteMapListItem read FOnDrawItem write FOnDrawItem; end; @@ -147,18 +161,18 @@ begin FHotTrackFontOptions := DefaultTrackFontOptions; Color := $00C08000; FHotTrackCursor := crHandPoint; - FVertOffset := 8; - FHorzOffset := 8; - FItemHeight := 25; + FVertOffset := Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_OFFSET); + FHorzOffset := Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_OFFSET); + FItemHeight := Scale96toFont(DEFAULT_WIZARD_ROUTEMAP_ITEMHEIGHT); FClickable := True; FAlignment := taCenter; - FTextOffset := 8; + FTextOffset := Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_OFFSET); FBorderColor := clNavy; FItemColor := clCream; FItemText := itCaption; FHotTrack := True; - FCurvature := 9; - FHotTrackBorder := 2; + FCurvature := Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_CURVATURE); + FHotTrackBorder := Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_HOTTRACKBORDER); FTextOnly := False; end; @@ -268,7 +282,10 @@ var AOrigRect: TRect; BkColor: TColor; S: string; + w4: Integer; begin + w4 := Scale96ToFont(4); + ACanvas.Lock; try AOrigRect := ARect; @@ -313,20 +330,21 @@ begin case Alignment of taLeftJustify: begin - Wizard.HeaderImages.Draw(ACanvas, ARect.Left + 4, ARect.Top + ATop, Pages[APageIndex].Header.ImageIndex, Pages[APageIndex].Enabled); - Inc(ARect.Left, Wizard.HeaderImages.Width + 4); + Wizard.HeaderImages.Draw(ACanvas, ARect.Left + w4, ARect.Top + ATop, + Pages[APageIndex].Header.ImageIndex, Pages[APageIndex].Enabled); + Inc(ARect.Left, Wizard.HeaderImages.Width + w4); end; taRightJustify: begin - Wizard.HeaderImages.Draw(ACanvas, ARect.Right - Wizard.HeaderImages.Width - 4, ARect.Top + ATop, + Wizard.HeaderImages.Draw(ACanvas, ARect.Right - Wizard.HeaderImages.Width - w4, ARect.Top + ATop, Pages[APageIndex].Header.ImageIndex, Pages[APageIndex].Enabled); - Dec(ARect.Right, Wizard.HeaderImages.Width + 4); + Dec(ARect.Right, Wizard.HeaderImages.Width + w4); end; taCenter: begin ALeft := ((ARect.Right - ARect.Left) - Wizard.HeaderImages.Width) div 2; - Inc(ARect.Top, 4); - Wizard.HeaderImages.Draw(ACanvas, ARect.Left + ALeft, ARect.Top + 8, + Inc(ARect.Top, w4); + Wizard.HeaderImages.Draw(ACanvas, ARect.Left + ALeft, ARect.Top + w4 + w4, Pages[APageIndex].Header.ImageIndex, Pages[APageIndex].Enabled); Inc(ARect.Top, Wizard.HeaderImages.Height); // if ItemText = itSubtitle then @@ -561,4 +579,71 @@ begin Result := IsHotTrackFontDfmStored(HotTrackFont, Font, HotTrackFontOptions); end; +function TJvWizardRouteMapList.IsCurvatureStored: Boolean; +begin + Result := FCurvature <> Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_CURVATURE); +end; + +function TJvWizardRouteMapList.IsHorzOffsetStored: Boolean; +begin + Result := FHorzOffset <> Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_OFFSET); +end; + +function TJvWizardRouteMapList.IsHotTrackBorderStored: Boolean; +begin + Result := FHotTrackBorder <> Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_HOTTRACKBORDER); +end; + +function TJvWizardRouteMapList.IsItemHeightStored: Boolean; +begin + Result := FItemHeight <> Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_ITEMHEIGHT); +end; + +function TJvWizardRouteMapList.IsTextOffsetStored: Boolean; +begin + Result := FTextOffset <> Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_OFFSET); +end; + +function TJvWizardRouteMapList.IsVertOffsetStored: Boolean; +begin + Result := FVertOffset <> Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_OFFSET); +end; + +procedure TJvWizardRouteMapList.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy; + const AXProportion, AYProportion: Double); +begin + inherited; + if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then + begin + if IsCurvatureStored then + FCurvature := Round(FCurvature * AXProportion); + if IsHorzOffsetStored then + FHorzOffset := Round(FHorzOffset * AXProportion); + if IsHotTrackBorderStored then + FHotTrackBorder := Round(FHotTrackBorder * AXProportion); + if IsItemHeightStored then + FItemHeight := Round(FItemHeight * AYProportion); + if IsTextOffsetStored then + FTextOffset := Round(FHorzOffset * AYProportion); + if IsVertOffsetStored then + FVertOffset := Round(FHorzOffset * AYProportion); + end; +end; + +{$IF LCL_FullVersion >= 1080100} +procedure TJvWizardRouteMapList.ScaleFontsPPI(const AToPPI: Integer; + const AProportion: Double); +begin + inherited; + DoScaleFontPPI(ActiveFont, AToPPI, AProportion); + DoScaleFontPPI(HotTrackFont, AToPPI, AProportion); +end; +{$ELSEIF LCL_FullVersion >= 1080000} +procedure TJvWizardRouteMapList.ScaleFontsPPI(const AProportion: Double); +begin + DoScaleFontPPI(ActiveFont, AProportion); + DoScaleFontPPI(HotTrackFont, AProportion); +end; +{$ENDIF} + end. diff --git a/components/jvcllaz/run/JvWizard/jvwizardroutemapnodes.pas b/components/jvcllaz/run/JvWizard/jvwizardroutemapnodes.pas index 8302b5005..677a3e12f 100644 --- a/components/jvcllaz/run/JvWizard/jvwizardroutemapnodes.pas +++ b/components/jvcllaz/run/JvWizard/jvwizardroutemapnodes.pas @@ -44,7 +44,7 @@ unit JvWizardRouteMapNodes; interface uses - Graphics, Classes, LCLIntf, LCLType, + Graphics, Classes, Controls, LCLIntf, LCLType, JvWizard; type @@ -79,24 +79,28 @@ type FNodeColors: TJvWizardRouteMapNodeColors; FIndent: Integer; FAllowClickableNodes: Boolean; + function IsIndentStored: Boolean; + function IsItemHeightStored: Boolean; procedure SetItemHeight(Value: Integer); procedure SetUsePageTitle(Value: Boolean); procedure SetIndent(Value: Integer); procedure SetAllowClickableNodes(const Value: Boolean); protected + procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy; + const AXProportion, AYProportion: Double); override; function PageAtPos(Pt: TPoint): TJvWizardCustomPage; override; procedure Paint; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; published - property ItemHeight: Integer read FItemHeight write SetItemHeight default 20; property AllowClickableNodes: Boolean read FAllowClickableNodes write SetAllowClickableNodes default True; // ss 10/14/2003 property Align; property Color default clBackground; property Font; property Image; - property Indent: Integer read FIndent write SetIndent default 8; + property Indent: Integer read FIndent write SetIndent stored IsIndentStored; + property ItemHeight: Integer read FItemHeight write SetItemHeight stored IsItemHeightStored; property NodeColors: TJvWizardRouteMapNodeColors read FNodeColors write FNodeColors; property UsePageTitle: Boolean read FUsePageTitle write SetUsePageTitle default True; property OnDisplaying; @@ -163,11 +167,11 @@ end; constructor TJvWizardRouteMapNodes.Create(AOwner: TComponent); begin inherited Create(AOwner); - FItemHeight := 20; + FItemHeight := Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_NODES_ITEMHEIGHT); Color := clBackground; Font.Color := clWhite; FUsePageTitle := True; - FIndent := 8; + FIndent := Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_NODES_INDENT); FAllowClickableNodes := True; // ss 10/14/2003 FNodeColors := TJvWizardRouteMapNodeColors.Create(Self); end; @@ -178,6 +182,29 @@ begin inherited Destroy; end; +procedure TJvWizardRouteMapNodes.DoAutoAdjustLayout( + const AMode: TLayoutAdjustmentPolicy; const AXProportion, AYProportion: Double); +begin + inherited; + if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then + begin + if IsIndentStored then + FIndent := Round(FIndent * AXProportion); + if IsItemHeightStored then + FItemHeight := Round(FItemHeight * AYProportion); + end; +end; + +function TJvWizardRouteMapNodes.IsIndentStored: Boolean; +begin + Result := FIndent <> Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_NODES_INDENT); +end; + +function TJvWizardRouteMapNodes.IsItemHeightStored: Boolean; +begin + Result := FItemHeight <> Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_NODES_ITEMHEIGHT); +end; + function TJvWizardRouteMapNodes.PageAtPos(Pt: TPoint): TJvWizardCustomPage; var I, Count: Integer; @@ -218,7 +245,13 @@ var AColor: TColor; AFont: TFont; IsFirstPage, IsLastPage: Boolean; + w6, w12, w18, w20: Integer; begin + w6 := Scale96ToFont(6); + w12 := Scale96ToFont(12); + w18 := Scale96ToFont(18); + w20 := Scale96ToFont(20); + ARect := ClientRect; with Canvas do begin @@ -269,17 +302,17 @@ begin ATextRect := ARect; if not (IsFirstPage or IsLastPage) then - ATextRect.Left := ATextRect.Left + 18; + ATextRect.Left := ATextRect.Left + w18; NodeRect := ATextRect; - NodeRect.Right := NodeRect.Left + 12; - NodeRect.Top := NodeRect.Top + Trunc((FItemHeight - 12) / 2); - NodeRect.Bottom := NodeRect.Top + 12; + NodeRect.Right := NodeRect.Left + w12; + NodeRect.Top := NodeRect.Top + Trunc((FItemHeight - w12) / 2); + NodeRect.Bottom := NodeRect.Top + w12; if not (IsFirstPage or IsLastPage) then - ATextRect.Left := ATextRect.Left + 20 + ATextRect.Left := ATextRect.Left + w20 else - ATextRect.Left := ATextRect.Left + 18 + 20; + ATextRect.Left := ATextRect.Left + w18 + w20; try Pen.Color := FNodeColors.Line; @@ -299,35 +332,35 @@ begin Brush.Color := FNodeColors.Line; if IsFirstPage or IsLastPage then begin - MoveTo(NodeRect.Right, NodeRect.Top + 5); - LineTo(NodeRect.Right + 13, NodeRect.Top + 5); - MoveTo(NodeRect.Right, NodeRect.Top + 6); - LineTo(NodeRect.Right + 13, NodeRect.Top + 6); + MoveTo(NodeRect.Right, NodeRect.Top + w6-1); + LineTo(NodeRect.Right + w12+1, NodeRect.Top + w6-1); + MoveTo(NodeRect.Right, NodeRect.Top + w6); + LineTo(NodeRect.Right + w12+1, NodeRect.Top + w6); if IsFirstPage then begin - MoveTo(NodeRect.Right + 11, NodeRect.Top + 6); - LineTo(NodeRect.Right + 11, ATextRect.Bottom); - MoveTo(NodeRect.Right + 12, NodeRect.Top + 6); - LineTo(NodeRect.Right + 12, ATextRect.Bottom); + MoveTo(NodeRect.Right + w12-1, NodeRect.Top + w6); + LineTo(NodeRect.Right + w12-1, ATextRect.Bottom); + MoveTo(NodeRect.Right + w12, NodeRect.Top + w6); + LineTo(NodeRect.Right + w12, ATextRect.Bottom); end else begin - MoveTo(NodeRect.Right + 11, NodeRect.Top + 5); - LineTo(NodeRect.Right + 11, ATextRect.Top); - MoveTo(NodeRect.Right + 12, NodeRect.Top + 5); - LineTo(NodeRect.Right + 12, ATextRect.Top); + MoveTo(NodeRect.Right + w12-1, NodeRect.Top + w6-1); + LineTo(NodeRect.Right + w12-1, ATextRect.Top); + MoveTo(NodeRect.Right + w12, NodeRect.Top + w6-1); + LineTo(NodeRect.Right + w12, ATextRect.Top); end; end else begin - MoveTo(NodeRect.Left + 5, NodeRect.Top); - LineTo(NodeRect.Left + 5, ATextRect.Top - 1); - MoveTo(NodeRect.Left + 6, NodeRect.Top); - LineTo(NodeRect.Left + 6, ATextRect.Top - 1); - MoveTo(NodeRect.Left + 5, NodeRect.Bottom); - LineTo(NodeRect.Left + 5, ATextRect.Bottom + 1); - MoveTo(NodeRect.Left + 6, NodeRect.Bottom); - LineTo(NodeRect.Left + 6, ATextRect.Bottom + 1); + MoveTo(NodeRect.Left + w6-1, NodeRect.Top); + LineTo(NodeRect.Left + w6-1, ATextRect.Top - 1); + MoveTo(NodeRect.Left + w6, NodeRect.Top); + LineTo(NodeRect.Left + w6, ATextRect.Top - 1); + MoveTo(NodeRect.Left + w6-1, NodeRect.Bottom); + LineTo(NodeRect.Left + w6-1, ATextRect.Bottom + 1); + MoveTo(NodeRect.Left + w6, NodeRect.Bottom); + LineTo(NodeRect.Left + w6, ATextRect.Bottom + 1); end; Brush.Color := AColor; diff --git a/components/jvcllaz/run/JvWizard/jvwizardroutemapsteps.pas b/components/jvcllaz/run/JvWizard/jvwizardroutemapsteps.pas index 9d8fa88d8..e32ad8288 100644 --- a/components/jvcllaz/run/JvWizard/jvwizardroutemapsteps.pas +++ b/components/jvcllaz/run/JvWizard/jvwizardroutemapsteps.pas @@ -50,11 +50,13 @@ type FShowNavigators: Boolean; FShowNavigation: Boolean; FMultiline: Boolean; + FArrowSize: Integer; function GetActiveStepRect: TRect; function GetPreviousStepRect: TRect; function GetNextStepRect: TRect; function GetPreviousArrowRect: TRect; function GetNextArrowRect: TRect; + function IsIndentStored: Boolean; procedure SetIndent(const Value: Integer); procedure SetNextStepText(const Value: string); procedure SetActiveStepFormat(const Value: string); @@ -69,6 +71,8 @@ type procedure SetShowNavigation(const Value: Boolean); procedure SetMultiline(const Value: Boolean); protected + procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy; + const AXProportion, AYProportion: Double); override; procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; function PageAtPos(Pt: TPoint): TJvWizardCustomPage; override; procedure Paint; override; @@ -78,7 +82,7 @@ type property Color default clBackground; property Font; property Image; - property Indent: Integer read FIndent write SetIndent default 5; + property Indent: Integer read FIndent write SetIndent stored IsIndentStored; property PreviousStepText: string read FPreviousStepText write SetPreviousStepText stored StorePreviousStepText; property ActiveStepFormat: string read FActiveStepFormat write SetActiveStepFormat stored StoreActiveStepFormat; property Multiline: Boolean read FMultiline write SetMultiline default False; @@ -93,10 +97,14 @@ implementation uses JvResources; +const + cArrowSize = 16; + constructor TJvWizardRouteMapSteps.Create(AOwner: TComponent); begin inherited Create(AOwner); - FIndent := 5; + FIndent := Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_STEPS_INDENT); + FArrowSize := Scale96ToFont(cArrowSize); Color := clBackground; Font.Color := clWhite; FPreviousStepText := RsBackTo; @@ -138,6 +146,19 @@ begin end; end; +procedure TJvWizardRouteMapSteps.DoAutoAdjustLayout( + const AMode: TLayoutAdjustmentPolicy; const AXProportion, AYProportion: Double); +begin + inherited; + if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then + begin + if IsIndentStored then + FIndent := Round(FIndent * AXProportion); + if FArrowSize <> Scale96ToFont(cArrowSize) then + FArrowSize := Round(cArrowSize * AXProportion); + end; +end; + function TJvWizardRouteMapSteps.GetActiveStepRect: TRect; begin Result := Rect(Left + FIndent, (ClientHeight div 2 - Canvas.TextHeight('Wq')), @@ -146,14 +167,14 @@ end; function TJvWizardRouteMapSteps.GetNextArrowRect: TRect; begin - Result := Rect(Left + FIndent, Height - Indent - 32, Left + FIndent + 16, - (Height - FIndent) - 16); + Result := Rect(Left + FIndent, Height - Indent - 2*FArrowSize, Left + FIndent + FArrowSize, + (Height - FIndent) - FArrowSize); end; function TJvWizardRouteMapSteps.GetNextStepRect: TRect; begin - Result := Rect(Left + FIndent, Height - FIndent - 32, Width, - Height - FIndent - 32 + Canvas.TextHeight('Wq')); + Result := Rect(Left + FIndent, Height - FIndent - 2*FArrowSize, Width, + Height - FIndent - 2*FArrowSize + Canvas.TextHeight('Wq')); end; function TJvWizardRouteMapSteps.DetectPageCount(out ActivePageIndex: Integer): Integer; @@ -176,8 +197,8 @@ end; function TJvWizardRouteMapSteps.GetPreviousArrowRect: TRect; begin - Result := Rect(Left + FIndent, Top + FIndent, Left + FIndent + 16, - Top + FIndent + 16); + Result := Rect(Left + FIndent, Top + FIndent, Left + FIndent + FArrowSize, + Top + FIndent + FArrowSize); end; function TJvWizardRouteMapSteps.GetPreviousStepRect: TRect; @@ -186,6 +207,11 @@ begin Top + FIndent + Canvas.TextHeight('Wq')); end; +function TJvWizardRouteMapSteps.IsIndentStored: Boolean; +begin + Result := FIndent <> Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_STEPS_INDENT); +end; + procedure TJvWizardRouteMapSteps.MouseMove(Shift: TShiftState; X, Y: Integer); var Pt: TPoint;