You've already forked lazarus-ccr
jvcllaz: Improve High-DPI behavior of JvTMTimeline demo.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6618 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
Binary file not shown.
After Width: | Height: | Size: 202 B |
Binary file not shown.
After Width: | Height: | Size: 225 B |
Binary file not shown.
After Width: | Height: | Size: 142 B |
Binary file not shown.
After Width: | Height: | Size: 154 B |
Binary file not shown.
After Width: | Height: | Size: 142 B |
Binary file not shown.
After Width: | Height: | Size: 154 B |
@ -0,0 +1,6 @@
|
||||
jvcustomoutlookbardownarrow.png
|
||||
jvcustomoutlookbardownarrow_150.png
|
||||
jvcustomoutlookbardownarrow_200.png
|
||||
jvcustomoutlookbaruparrow.png
|
||||
jvcustomoutlookbaruparrow_150.png
|
||||
jvcustomoutlookbaruparrow_200.png
|
@ -0,0 +1,9 @@
|
||||
jvcustomtmtimelinemilestonelarge.png
|
||||
jvcustomtmtimelinemilestonelarge_150.png
|
||||
jvcustomtmtimelinemilestonelarge_200.png
|
||||
jvcustomtmtimelinescrollleft.png
|
||||
jvcustomtmtimelinescrollleft_150.png
|
||||
jvcustomtmtimelinescrollleft_200.png
|
||||
jvcustomtmtimelinescrollright.png
|
||||
jvcustomtmtimelinescrollright_150.png
|
||||
jvcustomtmtimelinescrollright_200.png
|
@ -1,2 +1,2 @@
|
||||
lazres ../../../resource/jvtmtimeline.res jvcustomtmtimelinescrollleft.png jvcustomtmtimelinescrollright.png jvcustomtmtimelinemilestonelarge.png
|
||||
lazres ../../../resource/jvoutlookbar.res jvcustomoutlookbardownarrow.png jvcustomoutlookbardownarrow_150.png jvcustomoutlookbardownarrow_200.png jvcustomoutlookbaruparrow.png jvcustomoutlookbaruparrow_150.png jvcustomoutlookbaruparrow_200.png
|
||||
lazres ../../../resource/jvtmtimeline.res @jvtmtimeline.txt
|
||||
lazres ../../../resource/jvoutlookbar.res @jvoutlookbar.txt
|
||||
|
@ -508,7 +508,7 @@ uses
|
||||
JvThemes,
|
||||
JvConsts, JvJVCLUtils;
|
||||
|
||||
{$R ..\..\resource\JvOutlookBar.res}
|
||||
{$R ..\..\resource\jvoutlookbar.res}
|
||||
|
||||
type
|
||||
THackOutlookBar = class(TJvCustomOutlookBar);
|
||||
@ -612,6 +612,16 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function HighDpi_Suffix: String;
|
||||
begin
|
||||
Result := '';
|
||||
if Screen.SystemFont.PixelsPerInch >= 168 then
|
||||
Result := Result + '_200'
|
||||
else
|
||||
if Screen.SystemFont.PixelsPerInch >= 120 then
|
||||
Result := Result + '_150';
|
||||
end;
|
||||
|
||||
|
||||
//=== { TJvOutlookBarEdit } ==================================================
|
||||
|
||||
@ -2050,12 +2060,7 @@ begin
|
||||
if (UpButton.Glyph.Width = 0) then begin
|
||||
png := TPortableNetworkGraphic.Create;
|
||||
try
|
||||
resName := 'jvcustomoutlookbaruparrow';
|
||||
if Screen.SystemFont.PixelsPerInch > 130 then
|
||||
resName := resName + '_200'
|
||||
else
|
||||
if Screen.SystemFont.PixelsPerInch > 105 then
|
||||
resName := resName + '_150';
|
||||
resName := 'jvcustomoutlookbaruparrow' + HighDPI_Suffix;
|
||||
png.LoadFromResourceName(HInstance, resName);
|
||||
UpButton.Glyph.Assign(png);
|
||||
finally
|
||||
@ -2071,11 +2076,7 @@ begin
|
||||
DownButton.SetBounds(ClientWidth - w - margin, R.Bottom - margin - h, w, h);
|
||||
png := TPortableNetworkGraphic.Create;
|
||||
try
|
||||
resName := 'jvcustomoutlookbardownarrow';
|
||||
if Screen.SystemFont.PixelsPerInch > 130 then
|
||||
resName := resName + '_200'
|
||||
else if Screen.SystemFont.PixelsPerInch > 105 then
|
||||
resName := resName + '_150';
|
||||
resName := 'jvcustomoutlookbardownarrow' + HighDPI_Suffix;
|
||||
png.LoadFromResourceName(HInstance, resName);
|
||||
DownButton.Glyph.Assign(png);
|
||||
finally
|
||||
|
@ -342,6 +342,15 @@ uses
|
||||
const
|
||||
cMagic = 'Jv.TMTIMELINE1';
|
||||
|
||||
function HighDpi_Suffix: String;
|
||||
begin
|
||||
Result := '';
|
||||
if Screen.SystemFont.PixelsPerInch >= 168 then
|
||||
Result := Result + '_200'
|
||||
else
|
||||
if Screen.SystemFont.PixelsPerInch >= 120 then
|
||||
Result := Result + '_150';
|
||||
end;
|
||||
|
||||
//=== { TJvTLSelFrame } ======================================================
|
||||
|
||||
@ -402,6 +411,7 @@ end;
|
||||
constructor TJvCustomTMTimeline.Create(AOwner: TComponent);
|
||||
var
|
||||
png: TPortableNetworkGraphic;
|
||||
resname: String;
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
DoubleBuffered := True;
|
||||
@ -452,7 +462,8 @@ begin
|
||||
Layout := blGlyphTop;
|
||||
png := TPortableNetworkGraphic.Create;
|
||||
try
|
||||
png.LoadFromResourceName(HInstance, 'jvcustomtmtimelinescrollleft');
|
||||
resName := 'jvcustomtmtimelinescrollleft' + HighDPI_Suffix;
|
||||
png.LoadFromResourceName(HInstance, resname);
|
||||
Glyph.Assign(png);
|
||||
finally
|
||||
png.Free;
|
||||
@ -473,7 +484,8 @@ begin
|
||||
Layout := blGlyphTop;
|
||||
png := TPortableNetworkGraphic.Create;
|
||||
try
|
||||
png.LoadFromResourceName(HInstance, 'jvcustomtmtimelinescrollright');
|
||||
resname := 'jvcustomtmtimelinescrollright' + HighDPI_Suffix;
|
||||
png.LoadFromResourceName(HInstance, resname);
|
||||
Glyph.Assign(png);
|
||||
finally
|
||||
png.Free;
|
||||
@ -594,7 +606,7 @@ end;
|
||||
function TJvCustomTMTimeline.GetRectForDate(ADate: TDate): TRect;
|
||||
begin
|
||||
// all rects are the same size...
|
||||
Result := Classes.Rect(0, 0, DayWidth, ClientHeight + 1);
|
||||
Result := Classes.Rect(0, 0, DayWidth + 1, ClientHeight + 1);
|
||||
// ...but we must move the entire rect to the correct date
|
||||
OffsetRect(Result, Trunc(ADate - Self.Date) * DayWidth, 0);
|
||||
// ...and finally compensate for the inital offset
|
||||
@ -621,6 +633,7 @@ var
|
||||
png: TPortableNetworkGraphic;
|
||||
R: TRect;
|
||||
x, y: Integer;
|
||||
resname: String;
|
||||
begin
|
||||
Tmp := ACanvas.Brush.Color;
|
||||
try
|
||||
@ -631,7 +644,8 @@ begin
|
||||
if ShowTodayIcon then begin
|
||||
png := TPortableNetworkGraphic.Create;
|
||||
try
|
||||
png.LoadFromResourceName(HInstance, 'jvcustomtmtimelinemilestonelarge');
|
||||
resname := 'jvcustomtmtimelinemilestonelarge' + HighDpi_Suffix;
|
||||
png.LoadFromResourceName(HInstance, resname);
|
||||
x := (ARect.Left + ARect.Right - png.Width) div 2;
|
||||
y := ARect.Top + CanvasMaxTextHeight(ACanvas) + 4;
|
||||
R := Classes.Rect(x, y, x + png.Width, y + png.Height);
|
||||
|
Reference in New Issue
Block a user