You've already forked lazarus-ccr
jvcllaz: Make TJvThumbView high-dpi aware. Provide FileDlgFilter property editor for TJvThumbView.Filter.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7296 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -57,6 +57,8 @@ begin
|
|||||||
RegisterComponentEditor(TJvCustomOutlookBar, TJvOutlookBarEditor);
|
RegisterComponentEditor(TJvCustomOutlookBar, TJvOutlookBarEditor);
|
||||||
|
|
||||||
// Thumbnails
|
// Thumbnails
|
||||||
|
RegisterPropertyEditor(TypeInfo(String), TJvThumbView,
|
||||||
|
'Filter', TFileDlgFilterProperty);
|
||||||
RegisterPropertyToSkip(TJvThumbnail, 'ClientWidth', 'Redundant', '');
|
RegisterPropertyToSkip(TJvThumbnail, 'ClientWidth', 'Redundant', '');
|
||||||
RegisterPropertyToSkip(TJvThumbnail, 'ClientHeight', 'Redundant', '');
|
RegisterPropertyToSkip(TJvThumbnail, 'ClientHeight', 'Redundant', '');
|
||||||
|
|
||||||
|
@ -154,8 +154,7 @@ type
|
|||||||
|
|
||||||
TJvBaseThumbnail = class(TPanel) //JvExPanel)
|
TJvBaseThumbnail = class(TPanel) //JvExPanel)
|
||||||
protected
|
protected
|
||||||
{ wp removed
|
{ function DoEraseBackground(Canvas: TCanvas; Param: LPARAM): Boolean; override; }
|
||||||
function DoEraseBackground(Canvas: TCanvas; Param: LPARAM): Boolean; override; }
|
|
||||||
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
|
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
|
||||||
X, Y: Integer); override;
|
X, Y: Integer); override;
|
||||||
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
|
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
|
||||||
|
@ -56,7 +56,7 @@ uses
|
|||||||
{$IFDEF UNIX}
|
{$IFDEF UNIX}
|
||||||
baseunix,
|
baseunix,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
LCLIntf, LCLType, LMessages, Types,
|
LCLIntf, LCLType, LCLVersion, LMessages, Types,
|
||||||
Classes, Controls, ExtCtrls, SysUtils, Graphics, Forms,
|
Classes, Controls, ExtCtrls, SysUtils, Graphics, Forms,
|
||||||
JvThumbImage, JvBaseThumbnail, Dialogs;
|
JvThumbImage, JvBaseThumbnail, Dialogs;
|
||||||
|
|
||||||
@ -149,6 +149,17 @@ type
|
|||||||
procedure UpdateTitlePanelHeight;
|
procedure UpdateTitlePanelHeight;
|
||||||
procedure WMPaint(var Msg: TLMPaint); message LM_PAINT;
|
procedure WMPaint(var Msg: TLMPaint); message LM_PAINT;
|
||||||
|
|
||||||
|
{ LCL Scaling }
|
||||||
|
protected
|
||||||
|
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||||
|
const AXProportion, AYProportion: Double); override;
|
||||||
|
public
|
||||||
|
procedure ScaleFontsPPI({$IF LCL_FullVersion >= 1080100}const AToPPI: Integer;{$IFEND}
|
||||||
|
const AProportion: Double); override;
|
||||||
|
{$IF LCL_FullVersion >= 2010000}
|
||||||
|
procedure FixDesignFontsPPI(const ADesignTimePPI: Integer); override;
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -746,5 +757,36 @@ begin
|
|||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ LCL scaling routines }
|
||||||
|
|
||||||
|
procedure TJvThumbnail.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||||
|
const AXProportion, AYProportion: Double);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
|
||||||
|
begin
|
||||||
|
FMargin := round(FMargin * AXProportion);
|
||||||
|
FHShadowOffset := round(FHShadowOffset * AXProportion);
|
||||||
|
FVShadowOffset := round(FVShadowOffset * AYProportion);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{$IF LCL_FullVersion >= 2010000}
|
||||||
|
procedure TJvThumbnail.FixDesignFontsPPI(const ADesignTimePPI: Integer);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
DoFixDesignFontPPI(FTitleFont, ADesignTimePPI);
|
||||||
|
end;
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
|
procedure TJvThumbnail.ScaleFontsPPI(
|
||||||
|
{$IF LCL_FullVersion >= 1080100}const AToPPI: Integer;{$IFEND}
|
||||||
|
const AProportion: Double);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
DoScaleFontPPI(FTitleFont, AToPPI, AProportion);
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ type
|
|||||||
FThumbBevelOuter: TPanelBevel;
|
FThumbBevelOuter: TPanelBevel;
|
||||||
FThumbBorderStyle: TBorderStyle;
|
FThumbBorderStyle: TBorderStyle;
|
||||||
FThumbColor: TColor;
|
FThumbColor: TColor;
|
||||||
FThumbGap: Byte;
|
FThumbGap: Integer;
|
||||||
FThumbList: TJvThumbList;
|
FThumbList: TJvThumbList;
|
||||||
FThumbSize: TPoint;
|
FThumbSize: TPoint;
|
||||||
FThumbTitleBevelInner: TPanelBevel;
|
FThumbTitleBevelInner: TPanelBevel;
|
||||||
@ -130,7 +130,7 @@ type
|
|||||||
procedure SetThumbBevelOuter(const AValue: TPanelBevel);
|
procedure SetThumbBevelOuter(const AValue: TPanelBevel);
|
||||||
procedure SetThumbBorderStyle(const AValue: TBorderStyle);
|
procedure SetThumbBorderStyle(const AValue: TBorderStyle);
|
||||||
procedure SetThumbColor(const AValue: TColor);
|
procedure SetThumbColor(const AValue: TColor);
|
||||||
procedure SetThumbGap(Sp: Byte);
|
procedure SetThumbGap(Sp: Integer);
|
||||||
procedure SetThumbTitleColor(const AValue: TColor);
|
procedure SetThumbTitleColor(const AValue: TColor);
|
||||||
procedure SetThumbTitleBevelInner(const AValue: TPanelBevel);
|
procedure SetThumbTitleBevelInner(const AValue: TPanelBevel);
|
||||||
procedure SetThumbTitleBevelOuter(const AValue: TPanelBevel);
|
procedure SetThumbTitleBevelOuter(const AValue: TPanelBevel);
|
||||||
@ -142,6 +142,8 @@ type
|
|||||||
|
|
||||||
protected
|
protected
|
||||||
procedure CreateHandle; override;
|
procedure CreateHandle; override;
|
||||||
|
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
|
||||||
|
const AXProportion, AYProportion: Double); override;
|
||||||
(*********** NOT CONVERTED **
|
(*********** NOT CONVERTED **
|
||||||
procedure GetDlgCode(var Code: TDlgCodes); override;
|
procedure GetDlgCode(var Code: TDlgCodes); override;
|
||||||
*****)
|
*****)
|
||||||
@ -182,8 +184,8 @@ type
|
|||||||
property Count: Word read GetCount default 0;
|
property Count: Word read GetCount default 0;
|
||||||
property Directory: string read FDirectory write SetDirectory;
|
property Directory: string read FDirectory write SetDirectory;
|
||||||
property Filter: string read FFilter write FFilter;
|
property Filter: string read FFilter write FFilter;
|
||||||
property MaxHeight: Longint read GetMaxHeight write SetMaxHeight;
|
property MaxHeight: Longint read GetMaxHeight write SetMaxHeight default 200;
|
||||||
property MaxWidth: Longint read GetMaxWidth write SetMaxWidth;
|
property MaxWidth: Longint read GetMaxWidth write SetMaxWidth default 200;
|
||||||
property MinMemory: Boolean read FMinMemory write FMinMemory default true;
|
property MinMemory: Boolean read FMinMemory write FMinMemory default true;
|
||||||
property ScrollMode: TScrollMode read FScrollMode write SetScrollMode default smHorizontal;
|
property ScrollMode: TScrollMode read FScrollMode write SetScrollMode default smHorizontal;
|
||||||
property Selected: Longint read FSelected write SetSelected default -1;
|
property Selected: Longint read FSelected write SetSelected default -1;
|
||||||
@ -200,7 +202,7 @@ type
|
|||||||
read FThumbBorderStyle write SetThumbBorderStyle default bsNone;
|
read FThumbBorderStyle write SetThumbBorderStyle default bsNone;
|
||||||
property ThumbColor: TColor
|
property ThumbColor: TColor
|
||||||
read FThumbColor write SetThumbColor default clDefault;
|
read FThumbColor write SetThumbColor default clDefault;
|
||||||
property ThumbGap: Byte
|
property ThumbGap: Integer
|
||||||
read FThumbGap write SetThumbGap default 4;
|
read FThumbGap write SetThumbGap default 4;
|
||||||
property ThumbTitleBevelInner: TPanelBevel
|
property ThumbTitleBevelInner: TPanelBevel
|
||||||
read FThumbTitleBevelInner write SetThumbTitleBevelInner default bvNone;
|
read FThumbTitleBevelInner write SetThumbTitleBevelInner default bvNone;
|
||||||
@ -308,6 +310,7 @@ var
|
|||||||
Thb: TJvThumbnail;
|
Thb: TJvThumbnail;
|
||||||
begin
|
begin
|
||||||
Thb := TJvThumbnail.Create(Self);
|
Thb := TJvThumbnail.Create(Self);
|
||||||
|
Thb.AutoAdjustlayout(lapAutoAdjustForDPI, 96, Font.PixelsPerInch, 0, 0);
|
||||||
if Assigned(FOnGetTitle) then
|
if Assigned(FOnGetTitle) then
|
||||||
begin
|
begin
|
||||||
ThumbnailTitle := ExtractFilename(AFile);
|
ThumbnailTitle := ExtractFilename(AFile);
|
||||||
@ -446,9 +449,6 @@ procedure TJvThumbView.CalculateMaxX;
|
|||||||
var
|
var
|
||||||
A: Longint;
|
A: Longint;
|
||||||
begin
|
begin
|
||||||
if not HandleAllocated then
|
|
||||||
exit;
|
|
||||||
|
|
||||||
case FScrollMode of
|
case FScrollMode of
|
||||||
smVertical:
|
smVertical:
|
||||||
A := (Width - 20) div (FThumbSize.X + FThumbGap);
|
A := (Width - 20) div (FThumbSize.X + FThumbGap);
|
||||||
@ -456,8 +456,8 @@ begin
|
|||||||
A := (Height - 20) div (FThumbSize.Y + FThumbGap);
|
A := (Height - 20) div (FThumbSize.Y + FThumbGap);
|
||||||
smBoth:
|
smBoth:
|
||||||
A := JkCeil(Sqrt(FThumbList.Count));
|
A := JkCeil(Sqrt(FThumbList.Count));
|
||||||
else
|
else
|
||||||
A := 1;
|
A := 1;
|
||||||
end;
|
end;
|
||||||
if A < 1 then
|
if A < 1 then
|
||||||
A := 1;
|
A := 1;
|
||||||
@ -590,6 +590,19 @@ begin
|
|||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TJvThumbView.DoAutoAdjustLayout(
|
||||||
|
const AMode: TLayoutAdjustmentPolicy;
|
||||||
|
const AXProportion, AYProportion: Double);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
|
||||||
|
begin
|
||||||
|
FMaxSize.X := round(FMaxSize.X * AXProportion);
|
||||||
|
FMaxSize.Y := round(FMaxSize.Y * AYProportion);
|
||||||
|
FThumbGap := round(FThumbGap * AXProportion);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TJvThumbView.DoInvalidImage(Sender: TObject; const FileName: string);
|
procedure TJvThumbView.DoInvalidImage(Sender: TObject; const FileName: string);
|
||||||
begin
|
begin
|
||||||
if Assigned(FOnInvalidImage) then
|
if Assigned(FOnInvalidImage) then
|
||||||
@ -925,8 +938,11 @@ end;
|
|||||||
|
|
||||||
procedure TJvThumbView.Resize;
|
procedure TJvThumbView.Resize;
|
||||||
begin
|
begin
|
||||||
CalculateMaxX;
|
if HandleAllocated then
|
||||||
Reposition(0);
|
begin
|
||||||
|
CalculateMaxX;
|
||||||
|
Reposition(0);
|
||||||
|
end;
|
||||||
inherited Resize;
|
inherited Resize;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1266,7 +1282,7 @@ begin
|
|||||||
FThumbList.Thumbnail[i].Color := FThumbColor;
|
FThumbList.Thumbnail[i].Color := FThumbColor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TJvThumbView.SetThumbGap(Sp: Byte);
|
procedure TJvThumbView.SetThumbGap(Sp: Integer);
|
||||||
begin
|
begin
|
||||||
case FAlignView of
|
case FAlignView of
|
||||||
vtNormal, vtCenter:
|
vtNormal, vtCenter:
|
||||||
|
Reference in New Issue
Block a user