jvcllaz: Make TJvWizard high-dpi aware.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6997 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2019-06-03 22:27:04 +00:00
parent 793dbc12ab
commit 77e6fbbd04
6 changed files with 475 additions and 112 deletions

View File

@ -1,13 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="12"/> <Version Value="10"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<General> <General>
<Flags>
<CompatibilityMode Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="JvWizardDemo"/> <Title Value="JvWizardDemo"/>
<Scaled Value="True"/> <Scaled Value="True"/>
<ResourceType Value="res"/> <ResourceType Value="res"/>
@ -22,11 +20,11 @@
</BuildModes> </BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions> </PublishOptions>
<RunParams> <RunParams>
<FormatVersion Value="2"/> <local>
<Modes Count="0"/> <FormatVersion Value="1"/>
</local>
</RunParams> </RunParams>
<RequiredPackages Count="2"> <RequiredPackages Count="2">
<Item1> <Item1>

View File

@ -7,7 +7,7 @@ object Form1: TForm1
Caption = 'JvWizard demo' Caption = 'JvWizard demo'
ClientHeight = 317 ClientHeight = 317
ClientWidth = 596 ClientWidth = 596
LCLVersion = '2.1.0.0' LCLVersion = '1.8.4.0'
object JvWizard1: TJvWizard object JvWizard1: TJvWizard
Left = 0 Left = 0
Height = 317 Height = 317
@ -49,9 +49,9 @@ object Form1: TForm1
Header.Title.Anchors = [akTop, akLeft, akRight] Header.Title.Anchors = [akTop, akLeft, akRight]
Header.Title.Font.Height = -16 Header.Title.Font.Height = -16
Header.Title.Font.Style = [fsBold] Header.Title.Font.Style = [fsBold]
Header.Subtitle.Color = clNone Header.SubTitle.Color = clNone
Header.Subtitle.Text = 'This is the JvWizard demo for Lazarus' Header.SubTitle.Text = 'This is the JvWizard demo for Lazarus'
Header.Subtitle.Anchors = [akTop, akLeft, akRight, akBottom] Header.SubTitle.Anchors = [akTop, akLeft, akRight, akBottom]
VisibleButtons = [bkNext, bkCancel] VisibleButtons = [bkNext, bkCancel]
Caption = 'JvWizardWelcomePage1' Caption = 'JvWizardWelcomePage1'
WaterMark.Image.Picture.Data = { WaterMark.Image.Picture.Data = {
@ -1909,9 +1909,9 @@ object Form1: TForm1
Header.Title.Anchors = [akTop, akLeft, akRight] Header.Title.Anchors = [akTop, akLeft, akRight]
Header.Title.Font.Height = -16 Header.Title.Font.Height = -16
Header.Title.Font.Style = [fsBold] Header.Title.Font.Style = [fsBold]
Header.Subtitle.Color = clNone Header.SubTitle.Color = clNone
Header.Subtitle.Text = 'An edit control was added to page 1.' Header.SubTitle.Text = 'An edit control was added to page 1.'
Header.Subtitle.Anchors = [akTop, akLeft, akRight, akBottom] Header.SubTitle.Anchors = [akTop, akLeft, akRight, akBottom]
VisibleButtons = [bkStart, bkBack, bkNext, bkCancel] VisibleButtons = [bkStart, bkBack, bkNext, bkCancel]
Caption = 'JvWizardInteriorPage1' Caption = 'JvWizardInteriorPage1'
object Label2: TLabel object Label2: TLabel
@ -1938,9 +1938,9 @@ object Form1: TForm1
Header.Title.Anchors = [akTop, akLeft, akRight] Header.Title.Anchors = [akTop, akLeft, akRight]
Header.Title.Font.Height = -16 Header.Title.Font.Height = -16
Header.Title.Font.Style = [fsBold] Header.Title.Font.Style = [fsBold]
Header.Subtitle.Color = clNone Header.SubTitle.Color = clNone
Header.Subtitle.Text = 'A checkbox and a radiobutton were added to page 2.' Header.SubTitle.Text = 'A checkbox and a radiobutton were added to page 2.'
Header.Subtitle.Anchors = [akTop, akLeft, akRight, akBottom] Header.SubTitle.Anchors = [akTop, akLeft, akRight, akBottom]
VisibleButtons = [bkStart, bkBack, bkNext, bkCancel] VisibleButtons = [bkStart, bkBack, bkNext, bkCancel]
Caption = 'JvWizardInteriorPage2' Caption = 'JvWizardInteriorPage2'
object CheckBox1: TCheckBox object CheckBox1: TCheckBox
@ -1967,9 +1967,9 @@ object Form1: TForm1
Header.Title.Anchors = [akTop, akLeft, akRight] Header.Title.Anchors = [akTop, akLeft, akRight]
Header.Title.Font.Height = -16 Header.Title.Font.Height = -16
Header.Title.Font.Style = [fsBold] Header.Title.Font.Style = [fsBold]
Header.Subtitle.Color = clNone Header.SubTitle.Color = clNone
Header.Subtitle.Text = 'A listbox was added to page 3.' Header.SubTitle.Text = 'A listbox was added to page 3.'
Header.Subtitle.Anchors = [akTop, akLeft, akRight, akBottom] Header.SubTitle.Anchors = [akTop, akLeft, akRight, akBottom]
VisibleButtons = [bkStart, bkBack, bkNext, bkCancel] VisibleButtons = [bkStart, bkBack, bkNext, bkCancel]
Caption = 'JvWizardInteriorPage3' Caption = 'JvWizardInteriorPage3'
object ListBox1: TListBox object ListBox1: TListBox
@ -1995,9 +1995,9 @@ object Form1: TForm1
Header.Title.Anchors = [akTop, akLeft, akRight] Header.Title.Anchors = [akTop, akLeft, akRight]
Header.Title.Font.Height = -16 Header.Title.Font.Height = -16
Header.Title.Font.Style = [fsBold] Header.Title.Font.Style = [fsBold]
Header.Subtitle.Color = clNone Header.SubTitle.Color = clNone
Header.Subtitle.Text = 'This completes this little demo.' Header.SubTitle.Text = 'This completes this little demo.'
Header.Subtitle.Anchors = [akTop, akLeft, akRight, akBottom] Header.SubTitle.Anchors = [akTop, akLeft, akRight, akBottom]
VisibleButtons = [bkStart, bkBack, bkFinish, bkCancel] VisibleButtons = [bkStart, bkBack, bkFinish, bkCancel]
Caption = 'JvWizardInteriorPage4' Caption = 'JvWizardInteriorPage4'
object Label3: TLabel object Label3: TLabel

View File

@ -348,6 +348,23 @@ type
const const
bkAllButtons = [bkStart, bkLast, bkBack, bkFinish, bkNext, bkCancel, bkHelp]; 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 type
TJvWizardAlign = alTop..alRight; TJvWizardAlign = alTop..alRight;
TJvWizardLeftRight = alLeft..alRight; TJvWizardLeftRight = alLeft..alRight;
@ -502,6 +519,8 @@ type
FAnchors: TAnchors; FAnchors: TAnchors;
FIndent: Integer; FIndent: Integer;
FFont: TFont; FFont: TFont;
function IsAnchorPlacementStored: Boolean;
function IsIndentStored: Boolean;
procedure SetText(const Value: string); procedure SetText(const Value: string);
procedure SetAlignment(Value: TAlignment); procedure SetAlignment(Value: TAlignment);
procedure SetAnchors(Value: TAnchors); procedure SetAnchors(Value: TAnchors);
@ -524,12 +543,18 @@ type
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
procedure PaintTo(ACanvas: TCanvas; var ARect: TRect); override; procedure PaintTo(ACanvas: TCanvas; var ARect: TRect); override;
published published
property Text: string read FText write SetText; property Text: string
property Anchors: TAnchors read FAnchors write SetAnchors default [akLeft, akTop]; read FText write SetText;
property AnchorPlacement: Integer read FAnchorPlacement write SetAnchorPlacement default 4; property Anchors: TAnchors
property Indent: Integer read FIndent write SetIndent default 0; read FAnchors write SetAnchors default [akLeft, akTop];
property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify; property AnchorPlacement: Integer
property Font: TFont read FFont write SetFont; 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; end;
TJvWizardPageObject = class(TJvWizardGraphicObject) TJvWizardPageObject = class(TJvWizardGraphicObject)
@ -553,6 +578,8 @@ type
FImageOffset: Integer; FImageOffset: Integer;
FImageAlignment: TJvWizardImageLeftRight; FImageAlignment: TJvWizardImageLeftRight;
FShowDivider: Boolean; FShowDivider: Boolean;
function IsHeightStored: Boolean;
function IsImageOffsetStored: Boolean;
procedure SetHeight(Value: Integer); procedure SetHeight(Value: Integer);
procedure SetImageIndex(Value: Integer); procedure SetImageIndex(Value: Integer);
procedure SetImageOffset(Value: Integer); procedure SetImageOffset(Value: Integer);
@ -574,12 +601,12 @@ type
procedure PaintTo(ACanvas: TCanvas; var ARect: TRect); override; procedure PaintTo(ACanvas: TCanvas; var ARect: TRect); override;
published published
property ImageIndex: Integer read FImageIndex write SetImageIndex default -1; 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 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 ParentFont: Boolean read FParentFont write SetParentFont default True;
property Title: TJvWizardPageTitle read FTitle write SetTitle; 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 ShowDivider: Boolean read FShowDivider write SetShowDivider default True;
property Color default clWindow; property Color default clWindow;
property Visible; property Visible;
@ -596,6 +623,8 @@ type
procedure SetBorderWidth(Value: Integer); procedure SetBorderWidth(Value: Integer);
procedure SetAlign(Value: TJvWizardLeftRight); procedure SetAlign(Value: TJvWizardLeftRight);
procedure ImageChanged(Sender: TObject); procedure ImageChanged(Sender: TObject);
function IsBorderWidthStored: Boolean;
function IsWidthStored: Boolean;
protected protected
procedure VisibleChanged; override; procedure VisibleChanged; override;
public public
@ -604,9 +633,11 @@ type
procedure PaintTo(ACanvas: TCanvas; var ARect: TRect); override; procedure PaintTo(ACanvas: TCanvas; var ARect: TRect); override;
published published
property Align: TJvWizardLeftRight read FAlign write SetAlign default alLeft; 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 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 Color default clActiveCaption;
property Visible; property Visible;
end; end;
@ -615,12 +646,14 @@ type
TJvWizardPagePanel = class(TJvWizardPageObject) TJvWizardPagePanel = class(TJvWizardPageObject)
private private
FBorderWidth: Word; FBorderWidth: Word;
function IsBorderWidthStored: Boolean;
procedure SetBorderWidth(Value: Word); procedure SetBorderWidth(Value: Word);
public public
constructor Create; override; constructor Create; override;
procedure PaintTo(ACanvas: TCanvas; var ARect: TRect); override; procedure PaintTo(ACanvas: TCanvas; var ARect: TRect); override;
published published
property BorderWidth: Word read FBorderWidth write SetBorderWidth default 7; property BorderWidth: Word
read FBorderWidth write SetBorderWidth stored IsBorderWidthStored;
property Color default clBtnFace; property Color default clBtnFace;
property Visible default False; property Visible default False;
end; end;
@ -681,6 +714,14 @@ type
procedure Done; virtual; procedure Done; virtual;
{ called just before the page is hidden. Page: To page } { called just before the page is hidden. Page: To page }
procedure ExitPage(const ToPage: TJvWizardCustomPage); virtual; // renamed from Exit() to ExitPage 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 public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -725,6 +766,8 @@ type
FWaterMark: TJvWizardWaterMark; FWaterMark: TJvWizardWaterMark;
protected protected
procedure AdjustClientRect(var Rect: TRect); override; procedure AdjustClientRect(var Rect: TRect); override;
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double); override;
procedure DrawPage(ACanvas: TCanvas; var ARect: TRect); override; procedure DrawPage(ACanvas: TCanvas; var ARect: TRect); override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
@ -772,6 +815,7 @@ type
FOnActivePageChanged: TNotifyEvent; FOnActivePageChanged: TNotifyEvent;
FOnActivePageChanging: TJvWizardChangingPageEvent; FOnActivePageChanging: TJvWizardChangingPageEvent;
FHeaderImages: TCustomImageList; FHeaderImages: TCustomImageList;
FHeaderImagesWidth: Integer;
FImageChangeLink: TChangeLink; FImageChangeLink: TChangeLink;
FAutoHideButtonBar: Boolean; FAutoHideButtonBar: Boolean;
FDefaultButtons: Boolean; FDefaultButtons: Boolean;
@ -784,6 +828,9 @@ type
procedure SetButtonBarHeight(Value: Integer); procedure SetButtonBarHeight(Value: Integer);
procedure SetActivePage(Page: TJvWizardCustomPage); procedure SetActivePage(Page: TJvWizardCustomPage);
procedure SetHeaderImages(Value: TCustomImageList); procedure SetHeaderImages(Value: TCustomImageList);
{$IF LCL_FullVersion >= 1090000}
procedure SetHeaderImagesWidth(Value: Integer);
{$IFEND}
function GetButtonClick(Index: Integer): TNotifyEvent; function GetButtonClick(Index: Integer): TNotifyEvent;
procedure SetButtonClick(Index: Integer; const Value: TNotifyEvent); procedure SetButtonClick(Index: Integer; const Value: TNotifyEvent);
procedure ImageListChange(Sender: TObject); procedure ImageListChange(Sender: TObject);
@ -851,6 +898,9 @@ type
property ShowDivider: Boolean read FShowDivider write SetShowDivider default True; property ShowDivider: Boolean read FShowDivider write SetShowDivider default True;
property ShowRouteMap: Boolean read GetShowRouteMap write SetShowRouteMap; property ShowRouteMap: Boolean read GetShowRouteMap write SetShowRouteMap;
property HeaderImages: TCustomImageList read FHeaderImages write SetHeaderImages; 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 OnSelectFirstPage: TJvWizardSelectPageEvent read FOnSelectFirstPage write FOnSelectFirstPage;
property OnSelectLastPage: TJvWizardSelectPageEvent read FOnSelectLastPage write FOnSelectLastPage; property OnSelectLastPage: TJvWizardSelectPageEvent read FOnSelectLastPage write FOnSelectLastPage;
property OnSelectNextPage: TJvWizardSelectPageEvent read FOnSelectNextPage write FOnSelectNextPage; property OnSelectNextPage: TJvWizardSelectPageEvent read FOnSelectNextPage write FOnSelectNextPage;
@ -1290,7 +1340,7 @@ begin
FAlign := alLeft; FAlign := alLeft;
inherited Align := alLeft; inherited Align := alLeft;
TabStop := False; TabStop := False;
Width := 145; Width := DEFAULT_WIZARD_ROUTECONTROL_WIDTH;
Visible := True; Visible := True;
FPages := TList.Create; FPages := TList.Create;
DoubleBuffered := True; DoubleBuffered := True;
@ -1639,8 +1689,8 @@ end;
constructor TJvWizardPageTitle.Create; constructor TJvWizardPageTitle.Create;
begin begin
inherited Create; inherited Create;
FAnchorPlacement := 4; FAnchorPlacement := DEFAULT_WIZARD_PAGETITLE_ANCHORPLACEMENT;
FIndent := 0; FIndent := DEFAULT_WIZARD_PAGETITLE_INDENT;
FAnchors := [akLeft, akTop]; FAnchors := [akLeft, akTop];
FAlignment := taLeftJustify; FAlignment := taLeftJustify;
FFont := TFont.Create; FFont := TFont.Create;
@ -1672,6 +1722,14 @@ begin
Filer.DefineProperty('Text', nil, @WriteText, FText = ''); Filer.DefineProperty('Text', nil, @WriteText, FText = '');
end; 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); procedure TJvWizardPageTitle.SetWizardPageHeader(Value: TJvWizardPageHeader);
begin begin
if FWizardPageHeader <> Value then if FWizardPageHeader <> Value then
@ -1818,6 +1876,11 @@ begin
DoChange; DoChange;
end; end;
function TJvWizardPageTitle.IsIndentStored: Boolean;
begin
Result := FIndent <> WizardPageHeader.WizardPage.Scale96ToFont(FIndent);
end;
procedure TJvWizardPageTitle.Assign(Source: TPersistent); procedure TJvWizardPageTitle.Assign(Source: TPersistent);
begin begin
if Source is TJvWizardPageTitle then if Source is TJvWizardPageTitle then
@ -1861,7 +1924,7 @@ constructor TJvWizardPageHeader.Create;
begin begin
inherited Create; inherited Create;
Color := clWindow; Color := clWindow;
FHeight := 70; FHeight := DEFAULT_WIZARD_PAGEHEADER_HEIGHT; // will be scaled by page
FParentFont := True; FParentFont := True;
{ Set up Title } { Set up Title }
FTitle := TJvWizardPageTitle.Create; FTitle := TJvWizardPageTitle.Create;
@ -1874,7 +1937,7 @@ begin
FSubtitle.FAnchors := [akLeft, akTop, akRight, akBottom]; FSubtitle.FAnchors := [akLeft, akTop, akRight, akBottom];
FSubtitle.FText := RsSubtitle; FSubtitle.FText := RsSubtitle;
FImageAlignment := iaRight; FImageAlignment := iaRight;
FImageOffset := 0; FImageOffset := DEFAULT_WIZARD_PAGEHEADER_IMAGEOFFSET; // will be scaled by page
FImageIndex := -1; FImageIndex := -1;
FShowDivider := True; FShowDivider := True;
end; end;
@ -1939,11 +2002,34 @@ end;
function TJvWizardPageHeader.GetImageRect(const AImages: TCustomImageList; function TJvWizardPageHeader.GetImageRect(const AImages: TCustomImageList;
var ARect: TRect): TRect; var ARect: TRect): TRect;
var
{$IF LCL_FullVersion >= 1090000}
imgres: TScaledImageListResolution;
ppi: Integer;
f: Double;
{$IFEND}
w, h: Integer;
delta: Integer;
begin begin
Result := Bounds(ARect.Left, ARect.Top, AImages.Width, AImages.Height); {$IF LCL_FullVersion >= 1090000}
OffsetRect(Result, 0, ((ARect.Bottom - ARect.Top) - AImages.Height) div 2); 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 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 if FImageAlignment = iaLeft then
begin begin
@ -1963,6 +2049,16 @@ begin
end; end;
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); procedure TJvWizardPageHeader.SetSubtitle(const Value: TJvWizardPageTitle);
begin begin
FSubtitle.Assign(Value); FSubtitle.Assign(Value);
@ -2052,8 +2148,8 @@ begin
inherited Create; inherited Create;
FAlign := alLeft; FAlign := alLeft;
Color := clActiveCaption; Color := clActiveCaption;
FWidth := 164; FWidth := DEFAULT_WIZARD_WATERMARK_WIDTH;
FBorderWidth := 1; FBorderWidth := DEFAULT_WIZARD_WATERMARK_BORDERWIDTH;
FImage := TJvWizardImage.Create; FImage := TJvWizardImage.Create;
FImage.OnChange := @ImageChanged; FImage.OnChange := @ImageChanged;
end; end;
@ -2121,12 +2217,37 @@ begin
FImage.PaintTo(ACanvas, R); FImage.PaintTo(ACanvas, R);
end; end;
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); procedure TJvWizardWaterMark.ImageChanged(Sender: TObject);
begin begin
DoChange; DoChange;
end; 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; procedure TJvWizardWaterMark.VisibleChanged;
begin begin
inherited VisibleChanged; inherited VisibleChanged;
@ -2139,11 +2260,16 @@ end;
constructor TJvWizardPagePanel.Create; constructor TJvWizardPagePanel.Create;
begin begin
inherited Create; inherited Create;
FBorderWidth := 7; FBorderWidth := DEFAULT_WIZARD_PAGEPANEL_BORDERWIDTH;;
Color := clBtnFace; Color := clBtnFace;
Visible := False; Visible := False;
end; end;
function TJvWizardPagePanel.IsBorderWidthStored: Boolean;
begin
Result := FBorderWidth <> WizardPage.Scale96ToFont(DEFAULT_WIZARD_PAGEPANEL_BORDERWIDTH);
end;
procedure TJvWizardPagePanel.PaintTo(ACanvas: TCanvas; var ARect: TRect); procedure TJvWizardPagePanel.PaintTo(ACanvas: TCanvas; var ARect: TRect);
begin begin
if Visible and (FBorderWidth > 0) then if Visible and (FBorderWidth > 0) then
@ -2183,9 +2309,16 @@ begin
Color := clBtnFace; Color := clBtnFace;
FHeader := TJvWizardPageHeader.Create; FHeader := TJvWizardPageHeader.Create;
FHeader.WizardPage := Self; 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 := TJvWizardImage.Create;
FImage.OnChange := @ImageChanged; FImage.OnChange := @ImageChanged;
FPanel := TJvWizardPagePanel.Create; FPanel := TJvWizardPagePanel.Create;
FPanel.BorderWidth := Scale96ToFont(DEFAULT_WIZARD_PAGEPANEL_BORDERWIDTH);
FPanel.WizardPage := Self; FPanel.WizardPage := Self;
{ try to avoid screen flicker, it paints its image { try to avoid screen flicker, it paints its image
into memory, then move image memory to the screen at once. } into memory, then move image memory to the screen at once. }
@ -2440,12 +2573,57 @@ begin
Header.Title := Value; Header.Title := Value;
end; 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 } =============================================== //=== { TJvWizardWelcomePage } ===============================================
constructor TJvWizardWelcomePage.Create(AOwner: TComponent); constructor TJvWizardWelcomePage.Create(AOwner: TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
FWaterMark := TJvWizardWaterMark.Create; FWaterMark := TJvWizardWaterMark.Create;
FWaterMark.Width := Scale96ToFont(DEFAULT_WIZARD_WATERMARK_WIDTH);
FWaterMark.BorderWidth := Scale96ToFont(DEFAULT_WIZARD_WATERMARK_BORDERWIDTH);
FWaterMark.WizardPage := Self; FWaterMark.WizardPage := Self;
FHeader.FTitle.FText := RsWelcome; FHeader.FTitle.FText := RsWelcome;
// welcome pages don't have dividers by default // welcome pages don't have dividers by default
@ -2471,6 +2649,19 @@ begin
end; end;
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); procedure TJvWizardWelcomePage.DrawPage(ACanvas: TCanvas; var ARect: TRect);
begin begin
FWaterMark.PaintTo(ACanvas, ARect); FWaterMark.PaintTo(ACanvas, ARect);
@ -2922,6 +3113,15 @@ begin
FActivePage.Invalidate; FActivePage.Invalidate;
end; 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; function TJvWizard.GetButtonClick(Index: Integer): TNotifyEvent;
begin begin
if FNavigateButtons[TJvWizardButtonKind(Index)].Control <> nil then if FNavigateButtons[TJvWizardButtonKind(Index)].Control <> nil then
@ -3034,6 +3234,10 @@ var
end; end;
end; end;
const
cDELTA = 2;
var
delta: Integer;
begin begin
if Parent = nil then if Parent = nil then
Exit; Exit;
@ -3050,25 +3254,26 @@ begin
Exclude(AButtonSet, bkFinish); Exclude(AButtonSet, bkFinish);
end; end;
end; end;
ATop := ClientRect.Bottom - FButtonBarHeight + CalculateButtonPlacement + 2; delta := Scale96ToForm(cDELTA);
ATop := ClientRect.Bottom - FButtonBarHeight + CalculateButtonPlacement + delta;
{ Position left side buttons } { Position left side buttons }
ALeft := ClientRect.Left + CalculateButtonPlacement; ALeft := ClientRect.Left + CalculateButtonPlacement;
LocateButton(bkHelp, CalculateButtonPlacement + 2); LocateButton(bkHelp, CalculateButtonPlacement + delta);
LocateButton(bkStart, 1); LocateButton(bkStart, 1);
LocateButton(bkLast, 0); LocateButton(bkLast, 0);
{ Position right side buttons } { Position right side buttons }
ALeft := ClientRect.Right - CalculateButtonPlacement; ALeft := ClientRect.Right - CalculateButtonPlacement;
if [bkNext, bkFinish] * AButtonSet = [bkNext, bkFinish] then if [bkNext, bkFinish] * AButtonSet = [bkNext, bkFinish] then
begin begin
LocateButton(bkCancel, -1); LocateButton(bkCancel, -delta div 2);
LocateButton(bkFinish, -CalculateButtonPlacement - 2); LocateButton(bkFinish, -CalculateButtonPlacement - delta);
end end
else else
begin begin
LocateButton(bkCancel, -CalculateButtonPlacement - 2); LocateButton(bkCancel, -CalculateButtonPlacement - delta);
LocateButton(bkFinish, -1); LocateButton(bkFinish, -delta div 2);
end; end;
LocateButton(bkNext, -2); LocateButton(bkNext, -delta);
LocateButton(bkBack, 0); LocateButton(bkBack, 0);
end end
else // Hide all buttons else // Hide all buttons
@ -3179,4 +3384,20 @@ begin
FNavigateButtons[TJvWizardButtonKind(Index)] := Value; FNavigateButtons[TJvWizardButtonKind(Index)] := Value;
end; 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. end.

View File

@ -36,7 +36,8 @@ unit JvWizardRouteMapList;
interface interface
uses uses
Types, SysUtils, Classes, Graphics, Controls, Forms, LMessages, LCLIntf, LCLType, LMessages, LCLIntf, LCLType, LCLVersion,
Types, SysUtils, Classes, Graphics, Controls, Forms,
JvTypes, JvJVCLUtils, JvWizard; JvTypes, JvJVCLUtils, JvWizard;
type type
@ -87,6 +88,12 @@ type
procedure SetActiveFontOptions(const Value: TJvTrackFontOptions); procedure SetActiveFontOptions(const Value: TJvTrackFontOptions);
procedure SetHotTrackFontOptions(const Value: TJvTrackFontOptions); procedure SetHotTrackFontOptions(const Value: TJvTrackFontOptions);
function IsHotTrackFontStored: Boolean; function IsHotTrackFontStored: Boolean;
function IsCurvatureStored: Boolean;
function IsHorzOffsetStored: Boolean;
function IsHotTrackBorderStored: Boolean;
function IsItemHeightStored: Boolean;
function IsTextOffsetStored: Boolean;
function IsVertOffsetStored: Boolean;
protected protected
procedure DrawPageItem(ACanvas: TCanvas; ARect: TRect; MousePos: TPoint; APageIndex: Integer); virtual; procedure DrawPageItem(ACanvas: TCanvas; ARect: TRect; MousePos: TPoint; APageIndex: Integer); virtual;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
@ -97,6 +104,14 @@ type
procedure CMFontChanged(var Msg: TLMessage); message CM_FONTCHANGED; procedure CMFontChanged(var Msg: TLMessage); message CM_FONTCHANGED;
procedure CursorChanged; procedure CursorChanged;
procedure FontChanged; reintroduce; 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 public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -107,13 +122,12 @@ type
property Alignment: TAlignment read FAlignment write SetAlignment default taCenter; property Alignment: TAlignment read FAlignment write SetAlignment default taCenter;
property Clickable: Boolean read FClickable write FClickable default True; property Clickable: Boolean read FClickable write FClickable default True;
property Color default $00C08000; 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 Font;
property HorzOffset: Integer read FHorzOffset write SetHorzOffset default 8; property HorzOffset: Integer read FHorzOffset write SetHorzOffset stored IsHorzOffsetStored;
property HotTrackBorder: Integer read FHotTrackBorder write FHotTrackBorder default 2; property HotTrackBorder: Integer read FHotTrackBorder write FHotTrackBorder stored IsHotTrackBorderStored;
property HotTrackCursor: TCursor read FHotTrackCursor write FHotTrackCursor default crHandPoint; property HotTrackCursor: TCursor read FHotTrackCursor write FHotTrackCursor default crHandPoint;
property HotTrack: Boolean read FHotTrack write FHotTrack default True; property HotTrack: Boolean read FHotTrack write FHotTrack default True;
property HotTrackFont: TFont read FHotTrackFont write SetHotTrackFont stored IsHotTrackFontStored; property HotTrackFont: TFont read FHotTrackFont write SetHotTrackFont stored IsHotTrackFontStored;
property HotTrackFontOptions: TJvTrackFontOptions read FHotTrackFontOptions write SetHotTrackFontOptions default property HotTrackFontOptions: TJvTrackFontOptions read FHotTrackFontOptions write SetHotTrackFontOptions default
DefaultTrackFontOptions; DefaultTrackFontOptions;
@ -122,12 +136,12 @@ type
property IncludeDisabled: Boolean read FIncludeDisabled write SetIncludeDisabled default False; property IncludeDisabled: Boolean read FIncludeDisabled write SetIncludeDisabled default False;
property BorderColor: TColor read FBorderColor write SetBorderColor default clNavy; property BorderColor: TColor read FBorderColor write SetBorderColor default clNavy;
property ItemColor: TColor read FItemColor write SetItemColor default clCream; 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 ItemText: TRouteMapListItemText read FItemText write SetItemText default itCaption;
property Rounded: Boolean read FRounded write SetRounded default False; property Rounded: Boolean read FRounded write SetRounded default False;
property ShowImages: Boolean read FShowImages write SetShowImages default False; property ShowImages: Boolean read FShowImages write SetShowImages default False;
property TextOffset: Integer read FTextOffset write SetTextOffset default 8; property TextOffset: Integer read FTextOffset write SetTextOffset stored IsTextOffsetStored;
property VertOffset: Integer read FVertOffset write SetVertOffset default 8; property VertOffset: Integer read FVertOffset write SetVertOffset stored IsVertOffsetStored;
property OnDrawItem: TJvWizardDrawRouteMapListItem read FOnDrawItem write FOnDrawItem; property OnDrawItem: TJvWizardDrawRouteMapListItem read FOnDrawItem write FOnDrawItem;
end; end;
@ -147,18 +161,18 @@ begin
FHotTrackFontOptions := DefaultTrackFontOptions; FHotTrackFontOptions := DefaultTrackFontOptions;
Color := $00C08000; Color := $00C08000;
FHotTrackCursor := crHandPoint; FHotTrackCursor := crHandPoint;
FVertOffset := 8; FVertOffset := Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_OFFSET);
FHorzOffset := 8; FHorzOffset := Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_OFFSET);
FItemHeight := 25; FItemHeight := Scale96toFont(DEFAULT_WIZARD_ROUTEMAP_ITEMHEIGHT);
FClickable := True; FClickable := True;
FAlignment := taCenter; FAlignment := taCenter;
FTextOffset := 8; FTextOffset := Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_OFFSET);
FBorderColor := clNavy; FBorderColor := clNavy;
FItemColor := clCream; FItemColor := clCream;
FItemText := itCaption; FItemText := itCaption;
FHotTrack := True; FHotTrack := True;
FCurvature := 9; FCurvature := Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_CURVATURE);
FHotTrackBorder := 2; FHotTrackBorder := Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_HOTTRACKBORDER);
FTextOnly := False; FTextOnly := False;
end; end;
@ -268,7 +282,10 @@ var
AOrigRect: TRect; AOrigRect: TRect;
BkColor: TColor; BkColor: TColor;
S: string; S: string;
w4: Integer;
begin begin
w4 := Scale96ToFont(4);
ACanvas.Lock; ACanvas.Lock;
try try
AOrigRect := ARect; AOrigRect := ARect;
@ -313,20 +330,21 @@ begin
case Alignment of case Alignment of
taLeftJustify: taLeftJustify:
begin begin
Wizard.HeaderImages.Draw(ACanvas, ARect.Left + 4, ARect.Top + ATop, Pages[APageIndex].Header.ImageIndex, Pages[APageIndex].Enabled); Wizard.HeaderImages.Draw(ACanvas, ARect.Left + w4, ARect.Top + ATop,
Inc(ARect.Left, Wizard.HeaderImages.Width + 4); Pages[APageIndex].Header.ImageIndex, Pages[APageIndex].Enabled);
Inc(ARect.Left, Wizard.HeaderImages.Width + w4);
end; end;
taRightJustify: taRightJustify:
begin 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); Pages[APageIndex].Header.ImageIndex, Pages[APageIndex].Enabled);
Dec(ARect.Right, Wizard.HeaderImages.Width + 4); Dec(ARect.Right, Wizard.HeaderImages.Width + w4);
end; end;
taCenter: taCenter:
begin begin
ALeft := ((ARect.Right - ARect.Left) - Wizard.HeaderImages.Width) div 2; ALeft := ((ARect.Right - ARect.Left) - Wizard.HeaderImages.Width) div 2;
Inc(ARect.Top, 4); Inc(ARect.Top, w4);
Wizard.HeaderImages.Draw(ACanvas, ARect.Left + ALeft, ARect.Top + 8, Wizard.HeaderImages.Draw(ACanvas, ARect.Left + ALeft, ARect.Top + w4 + w4,
Pages[APageIndex].Header.ImageIndex, Pages[APageIndex].Enabled); Pages[APageIndex].Header.ImageIndex, Pages[APageIndex].Enabled);
Inc(ARect.Top, Wizard.HeaderImages.Height); Inc(ARect.Top, Wizard.HeaderImages.Height);
// if ItemText = itSubtitle then // if ItemText = itSubtitle then
@ -561,4 +579,71 @@ begin
Result := IsHotTrackFontDfmStored(HotTrackFont, Font, HotTrackFontOptions); Result := IsHotTrackFontDfmStored(HotTrackFont, Font, HotTrackFontOptions);
end; 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. end.

View File

@ -44,7 +44,7 @@ unit JvWizardRouteMapNodes;
interface interface
uses uses
Graphics, Classes, LCLIntf, LCLType, Graphics, Classes, Controls, LCLIntf, LCLType,
JvWizard; JvWizard;
type type
@ -79,24 +79,28 @@ type
FNodeColors: TJvWizardRouteMapNodeColors; FNodeColors: TJvWizardRouteMapNodeColors;
FIndent: Integer; FIndent: Integer;
FAllowClickableNodes: Boolean; FAllowClickableNodes: Boolean;
function IsIndentStored: Boolean;
function IsItemHeightStored: Boolean;
procedure SetItemHeight(Value: Integer); procedure SetItemHeight(Value: Integer);
procedure SetUsePageTitle(Value: Boolean); procedure SetUsePageTitle(Value: Boolean);
procedure SetIndent(Value: Integer); procedure SetIndent(Value: Integer);
procedure SetAllowClickableNodes(const Value: Boolean); procedure SetAllowClickableNodes(const Value: Boolean);
protected protected
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double); override;
function PageAtPos(Pt: TPoint): TJvWizardCustomPage; override; function PageAtPos(Pt: TPoint): TJvWizardCustomPage; override;
procedure Paint; override; procedure Paint; override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
published published
property ItemHeight: Integer read FItemHeight write SetItemHeight default 20;
property AllowClickableNodes: Boolean read FAllowClickableNodes write SetAllowClickableNodes default True; // ss 10/14/2003 property AllowClickableNodes: Boolean read FAllowClickableNodes write SetAllowClickableNodes default True; // ss 10/14/2003
property Align; property Align;
property Color default clBackground; property Color default clBackground;
property Font; property Font;
property Image; 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 NodeColors: TJvWizardRouteMapNodeColors read FNodeColors write FNodeColors;
property UsePageTitle: Boolean read FUsePageTitle write SetUsePageTitle default True; property UsePageTitle: Boolean read FUsePageTitle write SetUsePageTitle default True;
property OnDisplaying; property OnDisplaying;
@ -163,11 +167,11 @@ end;
constructor TJvWizardRouteMapNodes.Create(AOwner: TComponent); constructor TJvWizardRouteMapNodes.Create(AOwner: TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
FItemHeight := 20; FItemHeight := Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_NODES_ITEMHEIGHT);
Color := clBackground; Color := clBackground;
Font.Color := clWhite; Font.Color := clWhite;
FUsePageTitle := True; FUsePageTitle := True;
FIndent := 8; FIndent := Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_NODES_INDENT);
FAllowClickableNodes := True; // ss 10/14/2003 FAllowClickableNodes := True; // ss 10/14/2003
FNodeColors := TJvWizardRouteMapNodeColors.Create(Self); FNodeColors := TJvWizardRouteMapNodeColors.Create(Self);
end; end;
@ -178,6 +182,29 @@ begin
inherited Destroy; inherited Destroy;
end; 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; function TJvWizardRouteMapNodes.PageAtPos(Pt: TPoint): TJvWizardCustomPage;
var var
I, Count: Integer; I, Count: Integer;
@ -218,7 +245,13 @@ var
AColor: TColor; AColor: TColor;
AFont: TFont; AFont: TFont;
IsFirstPage, IsLastPage: Boolean; IsFirstPage, IsLastPage: Boolean;
w6, w12, w18, w20: Integer;
begin begin
w6 := Scale96ToFont(6);
w12 := Scale96ToFont(12);
w18 := Scale96ToFont(18);
w20 := Scale96ToFont(20);
ARect := ClientRect; ARect := ClientRect;
with Canvas do with Canvas do
begin begin
@ -269,17 +302,17 @@ begin
ATextRect := ARect; ATextRect := ARect;
if not (IsFirstPage or IsLastPage) then if not (IsFirstPage or IsLastPage) then
ATextRect.Left := ATextRect.Left + 18; ATextRect.Left := ATextRect.Left + w18;
NodeRect := ATextRect; NodeRect := ATextRect;
NodeRect.Right := NodeRect.Left + 12; NodeRect.Right := NodeRect.Left + w12;
NodeRect.Top := NodeRect.Top + Trunc((FItemHeight - 12) / 2); NodeRect.Top := NodeRect.Top + Trunc((FItemHeight - w12) / 2);
NodeRect.Bottom := NodeRect.Top + 12; NodeRect.Bottom := NodeRect.Top + w12;
if not (IsFirstPage or IsLastPage) then if not (IsFirstPage or IsLastPage) then
ATextRect.Left := ATextRect.Left + 20 ATextRect.Left := ATextRect.Left + w20
else else
ATextRect.Left := ATextRect.Left + 18 + 20; ATextRect.Left := ATextRect.Left + w18 + w20;
try try
Pen.Color := FNodeColors.Line; Pen.Color := FNodeColors.Line;
@ -299,35 +332,35 @@ begin
Brush.Color := FNodeColors.Line; Brush.Color := FNodeColors.Line;
if IsFirstPage or IsLastPage then if IsFirstPage or IsLastPage then
begin begin
MoveTo(NodeRect.Right, NodeRect.Top + 5); MoveTo(NodeRect.Right, NodeRect.Top + w6-1);
LineTo(NodeRect.Right + 13, NodeRect.Top + 5); LineTo(NodeRect.Right + w12+1, NodeRect.Top + w6-1);
MoveTo(NodeRect.Right, NodeRect.Top + 6); MoveTo(NodeRect.Right, NodeRect.Top + w6);
LineTo(NodeRect.Right + 13, NodeRect.Top + 6); LineTo(NodeRect.Right + w12+1, NodeRect.Top + w6);
if IsFirstPage then if IsFirstPage then
begin begin
MoveTo(NodeRect.Right + 11, NodeRect.Top + 6); MoveTo(NodeRect.Right + w12-1, NodeRect.Top + w6);
LineTo(NodeRect.Right + 11, ATextRect.Bottom); LineTo(NodeRect.Right + w12-1, ATextRect.Bottom);
MoveTo(NodeRect.Right + 12, NodeRect.Top + 6); MoveTo(NodeRect.Right + w12, NodeRect.Top + w6);
LineTo(NodeRect.Right + 12, ATextRect.Bottom); LineTo(NodeRect.Right + w12, ATextRect.Bottom);
end end
else else
begin begin
MoveTo(NodeRect.Right + 11, NodeRect.Top + 5); MoveTo(NodeRect.Right + w12-1, NodeRect.Top + w6-1);
LineTo(NodeRect.Right + 11, ATextRect.Top); LineTo(NodeRect.Right + w12-1, ATextRect.Top);
MoveTo(NodeRect.Right + 12, NodeRect.Top + 5); MoveTo(NodeRect.Right + w12, NodeRect.Top + w6-1);
LineTo(NodeRect.Right + 12, ATextRect.Top); LineTo(NodeRect.Right + w12, ATextRect.Top);
end; end;
end end
else else
begin begin
MoveTo(NodeRect.Left + 5, NodeRect.Top); MoveTo(NodeRect.Left + w6-1, NodeRect.Top);
LineTo(NodeRect.Left + 5, ATextRect.Top - 1); LineTo(NodeRect.Left + w6-1, ATextRect.Top - 1);
MoveTo(NodeRect.Left + 6, NodeRect.Top); MoveTo(NodeRect.Left + w6, NodeRect.Top);
LineTo(NodeRect.Left + 6, ATextRect.Top - 1); LineTo(NodeRect.Left + w6, ATextRect.Top - 1);
MoveTo(NodeRect.Left + 5, NodeRect.Bottom); MoveTo(NodeRect.Left + w6-1, NodeRect.Bottom);
LineTo(NodeRect.Left + 5, ATextRect.Bottom + 1); LineTo(NodeRect.Left + w6-1, ATextRect.Bottom + 1);
MoveTo(NodeRect.Left + 6, NodeRect.Bottom); MoveTo(NodeRect.Left + w6, NodeRect.Bottom);
LineTo(NodeRect.Left + 6, ATextRect.Bottom + 1); LineTo(NodeRect.Left + w6, ATextRect.Bottom + 1);
end; end;
Brush.Color := AColor; Brush.Color := AColor;

View File

@ -50,11 +50,13 @@ type
FShowNavigators: Boolean; FShowNavigators: Boolean;
FShowNavigation: Boolean; FShowNavigation: Boolean;
FMultiline: Boolean; FMultiline: Boolean;
FArrowSize: Integer;
function GetActiveStepRect: TRect; function GetActiveStepRect: TRect;
function GetPreviousStepRect: TRect; function GetPreviousStepRect: TRect;
function GetNextStepRect: TRect; function GetNextStepRect: TRect;
function GetPreviousArrowRect: TRect; function GetPreviousArrowRect: TRect;
function GetNextArrowRect: TRect; function GetNextArrowRect: TRect;
function IsIndentStored: Boolean;
procedure SetIndent(const Value: Integer); procedure SetIndent(const Value: Integer);
procedure SetNextStepText(const Value: string); procedure SetNextStepText(const Value: string);
procedure SetActiveStepFormat(const Value: string); procedure SetActiveStepFormat(const Value: string);
@ -69,6 +71,8 @@ type
procedure SetShowNavigation(const Value: Boolean); procedure SetShowNavigation(const Value: Boolean);
procedure SetMultiline(const Value: Boolean); procedure SetMultiline(const Value: Boolean);
protected protected
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
function PageAtPos(Pt: TPoint): TJvWizardCustomPage; override; function PageAtPos(Pt: TPoint): TJvWizardCustomPage; override;
procedure Paint; override; procedure Paint; override;
@ -78,7 +82,7 @@ type
property Color default clBackground; property Color default clBackground;
property Font; property Font;
property Image; 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 PreviousStepText: string read FPreviousStepText write SetPreviousStepText stored StorePreviousStepText;
property ActiveStepFormat: string read FActiveStepFormat write SetActiveStepFormat stored StoreActiveStepFormat; property ActiveStepFormat: string read FActiveStepFormat write SetActiveStepFormat stored StoreActiveStepFormat;
property Multiline: Boolean read FMultiline write SetMultiline default False; property Multiline: Boolean read FMultiline write SetMultiline default False;
@ -93,10 +97,14 @@ implementation
uses uses
JvResources; JvResources;
const
cArrowSize = 16;
constructor TJvWizardRouteMapSteps.Create(AOwner: TComponent); constructor TJvWizardRouteMapSteps.Create(AOwner: TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
FIndent := 5; FIndent := Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_STEPS_INDENT);
FArrowSize := Scale96ToFont(cArrowSize);
Color := clBackground; Color := clBackground;
Font.Color := clWhite; Font.Color := clWhite;
FPreviousStepText := RsBackTo; FPreviousStepText := RsBackTo;
@ -138,6 +146,19 @@ begin
end; end;
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; function TJvWizardRouteMapSteps.GetActiveStepRect: TRect;
begin begin
Result := Rect(Left + FIndent, (ClientHeight div 2 - Canvas.TextHeight('Wq')), Result := Rect(Left + FIndent, (ClientHeight div 2 - Canvas.TextHeight('Wq')),
@ -146,14 +167,14 @@ end;
function TJvWizardRouteMapSteps.GetNextArrowRect: TRect; function TJvWizardRouteMapSteps.GetNextArrowRect: TRect;
begin begin
Result := Rect(Left + FIndent, Height - Indent - 32, Left + FIndent + 16, Result := Rect(Left + FIndent, Height - Indent - 2*FArrowSize, Left + FIndent + FArrowSize,
(Height - FIndent) - 16); (Height - FIndent) - FArrowSize);
end; end;
function TJvWizardRouteMapSteps.GetNextStepRect: TRect; function TJvWizardRouteMapSteps.GetNextStepRect: TRect;
begin begin
Result := Rect(Left + FIndent, Height - FIndent - 32, Width, Result := Rect(Left + FIndent, Height - FIndent - 2*FArrowSize, Width,
Height - FIndent - 32 + Canvas.TextHeight('Wq')); Height - FIndent - 2*FArrowSize + Canvas.TextHeight('Wq'));
end; end;
function TJvWizardRouteMapSteps.DetectPageCount(out ActivePageIndex: Integer): Integer; function TJvWizardRouteMapSteps.DetectPageCount(out ActivePageIndex: Integer): Integer;
@ -176,8 +197,8 @@ end;
function TJvWizardRouteMapSteps.GetPreviousArrowRect: TRect; function TJvWizardRouteMapSteps.GetPreviousArrowRect: TRect;
begin begin
Result := Rect(Left + FIndent, Top + FIndent, Left + FIndent + 16, Result := Rect(Left + FIndent, Top + FIndent, Left + FIndent + FArrowSize,
Top + FIndent + 16); Top + FIndent + FArrowSize);
end; end;
function TJvWizardRouteMapSteps.GetPreviousStepRect: TRect; function TJvWizardRouteMapSteps.GetPreviousStepRect: TRect;
@ -186,6 +207,11 @@ begin
Top + FIndent + Canvas.TextHeight('Wq')); Top + FIndent + Canvas.TextHeight('Wq'));
end; end;
function TJvWizardRouteMapSteps.IsIndentStored: Boolean;
begin
Result := FIndent <> Scale96ToFont(DEFAULT_WIZARD_ROUTEMAP_STEPS_INDENT);
end;
procedure TJvWizardRouteMapSteps.MouseMove(Shift: TShiftState; X, Y: Integer); procedure TJvWizardRouteMapSteps.MouseMove(Shift: TShiftState; X, Y: Integer);
var var
Pt: TPoint; Pt: TPoint;