jvcllaz: Beginning to make JvTimeFrame components and demo high-dpi aware. Still issues.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7121 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2019-08-12 20:20:24 +00:00
parent 3f05a976dc
commit 2916968451
2 changed files with 234 additions and 36 deletions

View File

@ -16,15 +16,14 @@ object MainForm: TMainForm
OnShow = FormShow OnShow = FormShow
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '2.1.0.0' LCLVersion = '2.1.0.0'
Scaled = False
object PageControl1: TPageControl object PageControl1: TPageControl
Left = 0 Left = 0
Height = 515 Height = 515
Top = 73 Top = 73
Width = 477 Width = 477
ActivePage = pgMonths ActivePage = pgDays
Align = alClient Align = alClient
TabIndex = 2 TabIndex = 0
TabOrder = 0 TabOrder = 0
OnChange = PageControl1Change OnChange = PageControl1Change
object pgDays: TTabSheet object pgDays: TTabSheet
@ -982,6 +981,7 @@ object MainForm: TMainForm
top = 136 top = 136
end end
object StateImageList: TImageList object StateImageList: TImageList
Scaled = True
left = 112 left = 112
top = 248 top = 248
Bitmap = { Bitmap = {
@ -1261,6 +1261,7 @@ object MainForm: TMainForm
top = 384 top = 384
end end
object ImageList: TImageList object ImageList: TImageList
Scaled = True
left = 112 left = 112
top = 192 top = 192
Bitmap = { Bitmap = {

View File

@ -58,21 +58,25 @@ unit JvTFDays;
interface interface
uses uses
LCLIntf, LCLType, LMessages, Types, LCLIntf, LCLType, LMessages, LCLVersion, Types,
SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ImgList, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ImgList,
JvTFManager, JvTFSparseMatrix, JvTFUtils; JvTFManager, JvTFSparseMatrix, JvTFUtils;
const const
AbsMinColWidth = 5; // AbsMinColWidth = 5;
SizingThreshold = 5; SizingThreshold = 5;
gcUndef = -3; gcUndef = -3;
gcGroupHdr = -2; gcGroupHdr = -2;
gcHdr = -1; gcHdr = -1;
DEFAULT_APPT_BAR_WIDTH = 5;
DEFAULT_BLOCK_HDR_WIDTH = 50;
DEFAULT_COL_HDR_HEIGHT = 28; DEFAULT_COL_HDR_HEIGHT = 28;
DEFAULT_DEF_COL_WIDTH = 100; DEFAULT_DEF_COL_WIDTH = 100;
DEFAULT_GRAB_HANDLES_HEIGHT = 6;
DEFAULT_GRANULARITY = 30; DEFAULT_GRANULARITY = 30;
DEFAULT_GROUP_HDR_HEIGHT = 28; DEFAULT_GROUP_HDR_HEIGHT = 28;
DEFAULT_MIN_COL_WIDTH = 5;
DEFAULT_MIN_ROW_HEIGHT = 12; DEFAULT_MIN_ROW_HEIGHT = 12;
DEFAULT_PRIMETIME_COLOR = $00C4FFFF; DEFAULT_PRIMETIME_COLOR = $00C4FFFF;
DEFAULT_ROW_HDR_WIDTH = 60; DEFAULT_ROW_HDR_WIDTH = 60;
@ -438,6 +442,7 @@ type
FDataDivColor: TColor; FDataDivColor: TColor;
FSnapMove: Boolean; FSnapMove: Boolean;
FDrawOffTime: Boolean; FDrawOffTime: Boolean;
function IsStoredBlockHdrWidth: Boolean;
procedure SetBlockGran(Value: Integer); procedure SetBlockGran(Value: Integer);
procedure SetDayStart(Value: TTime); procedure SetDayStart(Value: TTime);
procedure SetBlockHdrAttr(Value: TJvTFDaysHdrAttr); procedure SetBlockHdrAttr(Value: TJvTFDaysHdrAttr);
@ -450,12 +455,14 @@ type
constructor Create(ADaysControl: TJvTFDays); constructor Create(ADaysControl: TJvTFDays);
destructor Destroy; override; destructor Destroy; override;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
procedure AutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double); virtual;
property DaysControl: TJvTFDays read FDaysControl; property DaysControl: TJvTFDays read FDaysControl;
procedure Change; procedure Change;
published published
property BlockGran: Integer read FBlockGran write SetBlockGran default 60; property BlockGran: Integer read FBlockGran write SetBlockGran default 60;
property BlockHdrAttr: TJvTFDaysHdrAttr read FBlockHdrAttr write SetBlockHdrAttr; property BlockHdrAttr: TJvTFDaysHdrAttr read FBlockHdrAttr write SetBlockHdrAttr;
property BlockHdrWidth: Integer read FBlockHdrWidth write SetBlockHdrWidth default 50; property BlockHdrWidth: Integer read FBlockHdrWidth write SetBlockHdrWidth stored IsStoredBlockHdrWidth;
property DataDivColor: TColor read FDataDivColor write SetDataDivColor default clBlack; property DataDivColor: TColor read FDataDivColor write SetDataDivColor default clBlack;
property DayStart: TTime read FDayStart write SetDayStart; property DayStart: TTime read FDayStart write SetDayStart;
property DrawOffTime: Boolean read FDrawOffTime write SetDrawOffTime default True; property DrawOffTime: Boolean read FDrawOffTime write SetDrawOffTime default True;
@ -641,6 +648,7 @@ type
FWidth: Integer; FWidth: Integer;
FTimeStampStyle: TJvTFTimeStampStyle; FTimeStampStyle: TJvTFTimeStampStyle;
FTimeStampColor: TColor; FTimeStampColor: TColor;
function IsStoredWidth: Boolean;
procedure SetColor(Value: TColor); procedure SetColor(Value: TColor);
procedure SetVisible(Value: Boolean); procedure SetVisible(Value: Boolean);
procedure SetWidth(Value: Integer); procedure SetWidth(Value: Integer);
@ -652,9 +660,11 @@ type
public public
constructor Create(AApptGrid: TJvTFDays); constructor Create(AApptGrid: TJvTFDays);
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
procedure AutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double); virtual;
published published
property Color: TColor read FColor write SetColor default clBlue; property Color: TColor read FColor write SetColor default clBlue;
property Width: Integer read FWidth write SetWidth default 5; property Width: Integer read FWidth write SetWidth stored IsStoredWidth;
property Visible: Boolean read FVisible write SetVisible default True; property Visible: Boolean read FVisible write SetVisible default True;
property TimeStampStyle: TJvTFTimeStampStyle read FTimeStampStyle property TimeStampStyle: TJvTFTimeStampStyle read FTimeStampStyle
write SetTFTimeStampStyle default tssBlock; write SetTFTimeStampStyle default tssBlock;
@ -720,6 +730,7 @@ type
FColor: TColor; FColor: TColor;
FHeight: Integer; FHeight: Integer;
FStyle: TJvTFGrabStyle; FStyle: TJvTFGrabStyle;
function IsStoredHeight: Boolean;
procedure SetColor(Value: TColor); procedure SetColor(Value: TColor);
procedure SetHeight(Value: Integer); procedure SetHeight(Value: Integer);
procedure SetStyle(Value: TJvTFGrabStyle); procedure SetStyle(Value: TJvTFGrabStyle);
@ -730,8 +741,10 @@ type
public public
constructor Create(AApptGrid: TJvTFDays); constructor Create(AApptGrid: TJvTFDays);
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
procedure AutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double); virtual;
published published
property Height: Integer read FHeight write SetHeight default 6; property Height: Integer read FHeight write SetHeight stored IsStoredHeight;
property Color: TColor read FColor write SetColor default clBlue; property Color: TColor read FColor write SetColor default clBlue;
end; end;
@ -958,6 +971,15 @@ type
procedure SetDitheredBackground(const Value: Boolean); procedure SetDitheredBackground(const Value: Boolean);
procedure SetShowFocus(const Value: Boolean); procedure SetShowFocus(const Value: Boolean);
{$ENDIF Jv_TIMEBLOCKS} {$ENDIF Jv_TIMEBLOCKS}
function IsStoredColHdrHeight: Boolean;
function IsStoredDefColWidth: Boolean;
function IsStoredGroupHdrHeight: Boolean;
function IsStoredMinColWidth: Boolean;
function IsStoredMinRowHeight: Boolean;
function IsStoredRowHdrWidth: Boolean;
function IsStoredRowHeight: Boolean;
protected protected
FState: TJvTFDaysState; FState: TJvTFDaysState;
FHint: TJvTFHint; FHint: TJvTFHint;
@ -1159,6 +1181,13 @@ type
{ Lazarus } { Lazarus }
class function GetControlClassDefaultSize: TSize; override; class function GetControlClassDefaultSize: TSize; override;
{$IF LCL_FullVersion >= 1080000}
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double); override;
procedure ScaleFontsPPI({$IF LCL_FullVersion >= 1080100}const AToPPI: Integer;{$IFEND}
const AProportion: Double); override;
{$IFEND}
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -1293,21 +1322,21 @@ type
// grid layout properties // grid layout properties
property AutoSizeCols: Boolean read FAutoSizeCols write SetAutoSizeCols default True; property AutoSizeCols: Boolean read FAutoSizeCols write SetAutoSizeCols default True;
property Granularity: Integer read FGranularity write SetGranularity default DEFAULT_GRANULARITY; property Granularity: Integer read FGranularity write SetGranularity default DEFAULT_GRANULARITY;
property ColHdrHeight: Integer read FColHdrHeight write SetColHdrHeight default DEFAULT_COL_HDR_HEIGHT; property ColHdrHeight: Integer read FColHdrHeight write SetColHdrHeight stored IsStoredColHdrHeight; //default DEFAULT_COL_HDR_HEIGHT;
property Cols: TJvTFDaysCols read FCols write SetCols; property Cols: TJvTFDaysCols read FCols write SetCols;
property DefColWidth: Integer read FDefColWidth write FDefColWidth default DEFAULT_DEF_COL_WIDTH; property DefColWidth: Integer read FDefColWidth write FDefColWidth stored IsStoredDefColWidth; //default DEFAULT_DEF_COL_WIDTH;
property MinColWidth: Integer read FMinColWidth write SetMinColWidth default AbsMinColWidth; property MinColWidth: Integer read FMinColWidth write SetMinColWidth stored IsStoredMinColWidth; //default AbsMinColWidth;
property MinRowHeight: Integer read FMinRowHeight write SetMinRowHeight default DEFAULT_MIN_ROW_HEIGHT; property MinRowHeight: Integer read FMinRowHeight write SetMinRowHeight stored IsStoredMinRowHeight; //default DEFAULT_MIN_ROW_HEIGHT;
property Options: TJvTFDaysOptions read FOptions write SetOptions property Options: TJvTFDaysOptions read FOptions write SetOptions
default [agoSizeCols, agoSizeRows, agoSizeColHdr, agoSizeRowHdr, default [agoSizeCols, agoSizeRows, agoSizeColHdr, agoSizeRowHdr,
agoSizeAppt, agoMoveAppt, agoEditing, agoShowPics, agoSizeAppt, agoMoveAppt, agoEditing, agoShowPics,
agoShowText, agoShowApptHints, agoQuickEntry, agoShowSelHint]; agoShowText, agoShowApptHints, agoQuickEntry, agoShowSelHint];
property RowHdrWidth: Integer read FRowHdrWidth write SetRowHdrWidth default DEFAULT_ROW_HDR_WIDTH; property RowHdrWidth: Integer read FRowHdrWidth write SetRowHdrWidth stored IsStoredRowHdrWidth; //default DEFAULT_ROW_HDR_WIDTH;
property RowHeight: Integer read FRowHeight write SetRowHeight default DEFAULT_ROW_HEIGHT; property RowHeight: Integer read FRowHeight write SetRowHeight stored IsStoredRowHeight; //default DEFAULT_ROW_HEIGHT;
property ShowFocus:Boolean read FShowFocus write SetShowFocus default True; property ShowFocus:Boolean read FShowFocus write SetShowFocus default True;
property Template: TJvTFDaysTemplate read FTemplate write FTemplate; property Template: TJvTFDaysTemplate read FTemplate write FTemplate;
property Grouping: TJvTFDaysGrouping read FGrouping write SetGrouping; property Grouping: TJvTFDaysGrouping read FGrouping write SetGrouping;
property GroupHdrHeight: Integer read FGroupHdrHeight write SetGroupHdrHeight default DEFAULT_GROUP_HDR_HEIGHT; property GroupHdrHeight: Integer read FGroupHdrHeight write SetGroupHdrHeight stored IsStoredGroupHdrHeight; //default DEFAULT_GROUP_HDR_HEIGHT;
property GridStartTime: TTime read FGridStartTime write SetGridStartTime; property GridStartTime: TTime read FGridStartTime write SetGridStartTime;
property GridEndTime: TTime read FGridEndTime write SetGridEndTime; property GridEndTime: TTime read FGridEndTime write SetGridEndTime;
@ -1756,7 +1785,7 @@ type
implementation implementation
uses uses
FPCanvas, Math, FPCanvas,
JvResources; JvResources;
//Type //Type
@ -2779,9 +2808,11 @@ end;
procedure TJvTFDaysCol.SetWidth(Value: Integer); procedure TJvTFDaysCol.SetWidth(Value: Integer);
var var
ApptGrid: TJvTFDays; ApptGrid: TJvTFDays;
absMinColWidth: Integer;
begin begin
if Value < AbsMinColWidth then absMinColWidth := TJvTFDaysCols(Collection).ApptGrid.Scale96ToForm(DEFAULT_MIN_COL_WIDTH);
Value := AbsMinColWidth; if Value < absMinColWidth then
Value := absMinColWidth;
if Assigned(ColCollection.ApptGrid) then if Assigned(ColCollection.ApptGrid) then
if Value > ColCollection.ApptGrid.GetDataWidth then if Value > ColCollection.ApptGrid.GetDataWidth then
@ -3744,12 +3775,22 @@ begin
inherited Create; inherited Create;
FApptGrid := AApptGrid; FApptGrid := AApptGrid;
FColor := clBlue; FColor := clBlue;
FWidth := 5; FWidth := DEFAULT_APPT_BAR_WIDTH; // will be scaled by ApptGrid
FVisible := True; FVisible := True;
FTimeStampStyle := tssBlock; FTimeStampStyle := tssBlock;
FTimeStampColor := clBlue; FTimeStampColor := clBlue;
end; end;
procedure TJvTFDaysApptBar.AutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double);
begin
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
begin
if not IsStoredWidth then
FWidth := round(FWidth * AXProportion);
end;
end;
procedure TJvTFDaysApptBar.SetColor(Value: TColor); procedure TJvTFDaysApptBar.SetColor(Value: TColor);
begin begin
if FColor <> Value then if FColor <> Value then
@ -3801,6 +3842,11 @@ begin
inherited Assign(Source); inherited Assign(Source);
end; end;
function TJvTFDaysApptBar.IsStoredWidth: Boolean;
begin
Result := FWidth <> FApptGrid.Scale96ToFont(DEFAULT_APPT_BAR_WIDTH);
end;
procedure TJvTFDaysApptBar.SetTimeStampColor(Value: TColor); procedure TJvTFDaysApptBar.SetTimeStampColor(Value: TColor);
begin begin
if FTimeStampColor <> Value then if FTimeStampColor <> Value then
@ -4000,7 +4046,23 @@ begin
FApptGrid := AApptGrid; FApptGrid := AApptGrid;
FStyle := gsFlat; FStyle := gsFlat;
FColor := clBlue; FColor := clBlue;
FHeight := 6; FHeight := DEFAULT_GRAB_HANDLES_HEIGHT; // will be scaled by ApptGrid
end;
procedure TJvTFDaysGrabHandles.AutoAdjustLayout(
const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double);
begin
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
begin
if not IsStoredHeight then
FHeight := round(FHeight * AYProportion);
end;
end;
function TJvTFDaysGrabHandles.IsStoredHeight: Boolean;
begin
Result := FHeight <> FApptGrid.Scale96ToFont(DEFAULT_GRAB_HANDLES_HEIGHT);
end; end;
procedure TJvTFDaysGrabHandles.SetColor(Value: TColor); procedure TJvTFDaysGrabHandles.SetColor(Value: TColor);
@ -4074,20 +4136,20 @@ begin
//set property defaults //set property defaults
// FBorderStyle := bsSingle; // FBorderStyle := bsSingle;
FColHdrHeight := DEFAULT_COL_HDR_HEIGHT; FColHdrHeight := Scale96ToFont(DEFAULT_COL_HDR_HEIGHT);
FGroupHdrHeight := DEFAULT_GROUP_HDR_HEIGHT; FGroupHdrHeight := Scale96ToFont(DEFAULT_GROUP_HDR_HEIGHT);
FRowHdrWidth := DEFAULT_ROW_HDR_WIDTH; FRowHdrWidth := Scale96ToFont(DEFAULT_ROW_HDR_WIDTH);
FRowHeight := DEFAULT_ROW_HEIGHT; FRowHeight := Scale96ToFont(DEFAULT_ROW_HEIGHT);
FGranularity := DEFAULT_GRANULARITY; FGranularity := DEFAULT_GRANULARITY;
FTopRow := 0; FTopRow := 0;
FFocusedRow := -1; FFocusedRow := -1;
FMinColWidth := AbsMinColWidth; FMinColWidth := Scale96ToFont(DEFAULT_MIN_COL_WIDTH);
FLeftCol := -1; FLeftCol := -1;
FFocusedCol := -1; FFocusedCol := -1;
FDefColWidth := DEFAULT_DEF_COL_WIDTH; FDefColWidth := Scale96ToFont(DEFAULT_DEF_COL_WIDTH);
FVisibleScrollBars := []; FVisibleScrollBars := [];
FAutoSizeCols := True; FAutoSizeCols := True;
FMinRowHeight := DEFAULT_MIN_ROW_HEIGHT; FMinRowHeight := Scale96ToFont(DEFAULT_MIN_ROW_HEIGHT);
ParentColor := False; ParentColor := False;
Color := clSilver; Color := clSilver;
FOptions := [agoSizeCols, agoSizeRows, agoSizeColHdr, agoSizeRowHdr, FOptions := [agoSizeCols, agoSizeRows, agoSizeColHdr, agoSizeRowHdr,
@ -4168,6 +4230,7 @@ begin
FSelCellAttr := TJvTFSelCellAttr.Create(Self); FSelCellAttr := TJvTFSelCellAttr.Create(Self);
FApptBar := TJvTFDaysApptBar.Create(Self); FApptBar := TJvTFDaysApptBar.Create(Self);
FApptBar.Width := Scale96ToFont(DEFAULT_APPT_BAR_WIDTH);
FCols := TJvTFDaysCols.Create(Self); FCols := TJvTFDaysCols.Create(Self);
@ -4193,6 +4256,7 @@ begin
FTemplate := TJvTFDaysTemplate.Create(Self); FTemplate := TJvTFDaysTemplate.Create(Self);
FGrabHandles := TJvTFDaysGrabHandles.Create(Self); FGrabHandles := TJvTFDaysGrabHandles.Create(Self);
FGrabHandles.Height := Scale96ToFont(DEFAULT_GRAB_HANDLES_HEIGHT);
FHintProps := TJvTFHintProps.Create(Self); FHintProps := TJvTFHintProps.Create(Self);
//FHint := TJvTFHint.Create(Self); //FHint := TJvTFHint.Create(Self);
@ -4255,6 +4319,80 @@ begin
inherited; inherited;
end; } end; }
{$IF LCL_FullVersion >= 1080000}
procedure TJvTFDays.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double);
begin
inherited;
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
begin
if not IsStoredColHdrHeight then
FColHdrHeight := round(FColHdrHeight * AYProportion);
if not IsStoredDefColWidth then
FDefColWidth := round(FDefColWidth * AXProportion);
if not IsStoredGroupHdrHeight then
FGroupHdrHeight := round(FGroupHdrHeight * AYProportion);
if not IsStoredMinColWidth then
FMinColWidth := round(FMinColWidth * AXProportion);
if not IsStoredMinRowHeight then
FMinRowHeight := round(FMinRowHeight * AYProportion);
if not IsStoredRowHdrWidth then
FRowHdrWidth := round(FRowHdrWidth * AXProportion);
if not IsStoredRowHeight then
FRowHeight := round(FRowHeight * AYProportion);
FApptBar.AutoAdjustLayout(AMode, AXProportion, AYProportion);
FGrabHandles.AutoAdjustLayout(AMode, AXProportion, AYProportion);
(*
{$IFDEF Jv_TIMEBLOCKS}
FWeekendFillPic.Height := 16;
FWeekendFillPic.Width := 16;
{$ENDIF Jv_TIMEBLOCKS}
*)
end;
end;
{$IFEND}
{$IF LCL_FullVersion >= 1080100}
procedure TJvTFDays.ScaleFontsPPI(const AToPPI: Integer; const AProportion: Double);
begin
inherited;
DoScaleFontPPI(ApptAttr.Font, AToPPI, AProportion);
DoScaleFontPPI(FancyRowHdrAttr.MajorFont, AToPPI, AProportion);
DoScaleFontPPI(FancyRowHdrAttr.MinorFont, AToPPI, AProportion);
DoScaleFontPPI(GroupHdrAttr.Font, AToPPI, AProportion);
DoScaleFontPPI(HdrAttr.Font, AToPPI, AProportion);
DoScaleFontPPI(SelApptAttr.Font, AToPPI, AProportion);
DoScaleFontPPI(SelFancyRowHdrAttr.MajorFont, AToPPI, AProportion);
DoScaleFontPPI(SelFancyRowHdrAttr.MinorFont, AToPPI, AProportion);
DoScaleFontPPI(SelGroupHdrAttr.Font, AToPPI, AProportion);
DoScaleFontPPI(SelHdrAttr.Font, AToPPI, AProportion);
DoScaleFontPPI(TimeBlockProps.BlockHdrAttr.Font, AToPPI, AProportion);
DoScaleFontPPI(TimeBlockProps.SelBlockHdrAttr.Font, AToPPI, AProportion);
end;
{$ELSEIF LCL_FullVersion >= 1080000}
procedure TJvTFDays.ScaleFontsPPI(const AProportion: Double);
begin
inherited;
DoScaleFontPPI(ApptAttr.Font, AProportion);
DoScaleFontPPI(FancyRowHdrAttr.MajorFont, AProportion);
DoScaleFontPPI(FancyRowHdrAttr.MinorFont, AProportion);
DoScaleFontPPI(GroupHdrAttr.Font, AProportion);
DoScaleFontPPI(HdrAttr.Font, AProportion);
DoScaleFontPPI(SelApptAttr.Font, AProportion);
DoScaleFontPPI(SelFancyRowHdrAttr.MajorFont, AProportion);
DoScaleFontPPI(SelFancyRowHdrAttr.MinorFont, AProportion);
DoScaleFontPPI(SelGroupHdrAttr.Font, AProportion);
DoScaleFontPPI(SelHdrAttr.Font, AProportion);
DoScaleFontPPI(TimeBlockProps.BlockHdrAttr.Font, AProportion);
DoScaleFontPPI(TimeBlockProps.SelBlockHdrAttr.Font, AProportion);
end;
{$IFEND}
procedure TJvTFDays.WMGetDlgCode(var Msg: TLMGetDlgCode); procedure TJvTFDays.WMGetDlgCode(var Msg: TLMGetDlgCode);
begin begin
Msg.Result := DLGC_WANTALLKEYS or DLGC_WANTARROWS; Msg.Result := DLGC_WANTALLKEYS or DLGC_WANTARROWS;
@ -4498,6 +4636,11 @@ begin
end; end;
end; end;
function TJvTFDays.IsStoredColHdrHeight: Boolean;
begin
Result := FColHdrHeight <> Scale96ToFont(DEFAULT_COL_HDR_HEIGHT);
end;
procedure TJvTFDays.SetRowHdrWidth(Value: Integer); procedure TJvTFDays.SetRowHdrWidth(Value: Integer);
begin begin
if Value > RectWidth(GetAdjClientRect) then if Value > RectWidth(GetAdjClientRect) then
@ -4522,6 +4665,11 @@ begin
end; end;
end; end;
function TJvTFDays.IsStoredRowHdrWidth: Boolean;
begin
Result := FRowHdrWidth <> Scale96ToFont(DEFAULT_ROW_HDR_WIDTH);
end;
procedure TJvTFDays.SetRowHeight(Value: Integer); procedure TJvTFDays.SetRowHeight(Value: Integer);
var var
MaxRowHeight: Integer; MaxRowHeight: Integer;
@ -4550,10 +4698,18 @@ begin
end; end;
end; end;
procedure TJvTFDays.SetMinRowHeight(Value: Integer); function TJvTFDays.IsStoredRowHeight: Boolean;
begin begin
if Value < AbsMinColWidth then Result := FRowHeight <> Scale96ToFont(DEFAULT_ROW_HEIGHT);
Value := AbsMinColWidth; end;
procedure TJvTFDays.SetMinRowHeight(Value: Integer);
var
absMinColWidth: Integer;
begin
absMinColWidth := Scale96ToFont(DEFAULT_MIN_COL_WIDTH);
if Value < absMinColWidth then
Value := absMinColWidth;
if Value <> FMinRowHeight then if Value <> FMinRowHeight then
begin begin
@ -4563,10 +4719,18 @@ begin
end; end;
end; end;
procedure TJvTFDays.SetMinColWidth(Value: Integer); function TJvTFDays.IsStoredMinRowHeight: Boolean;
begin begin
if Value < AbsMinColWidth then Result := FMinRowHeight <> Scale96ToFont(DEFAULT_MIN_ROW_HEIGHT);
Value := AbsMinColWidth; end;
procedure TJvTFDays.SetMinColWidth(Value: Integer);
var
absMinColWidth: Integer;
begin
absMinColWidth := Scale96ToFont(DEFAULT_MIN_COL_WIDTH);
if Value < absMinColWidth then
Value := absMinColWidth;
if Value <> FMinColWidth then if Value <> FMinColWidth then
begin begin
@ -4576,6 +4740,16 @@ begin
end; end;
end; end;
function TJvTFDays.IsStoredMinColWidth: Boolean;
begin
Result := FMinColWidth <> Scale96ToFont(DEFAULT_MIN_COL_WIDTH);
end;
function TJvTFDays.IsStoredDefColWidth: Boolean;
begin
Result := FDefColWidth <> Scale96ToFont(DEFAULT_DEF_COL_WIDTH);
end;
procedure TJvTFDays.SetAutoSizeCols(Value: Boolean); procedure TJvTFDays.SetAutoSizeCols(Value: Boolean);
begin begin
if Value <> FAutoSizeCols then if Value <> FAutoSizeCols then
@ -10596,6 +10770,11 @@ begin
end; end;
end; end;
function TJvTFDays.IsStoredGroupHdrHeight: Boolean;
begin
Result := FGroupHdrHeight <> Scale96ToFont(DEFAULT_GROUP_HDR_HEIGHT);
end;
procedure TJvTFDays.DrawGroupHdrs(ACanvas: TCanvas); procedure TJvTFDays.DrawGroupHdrs(ACanvas: TCanvas);
var var
CurrGroup: string; CurrGroup: string;
@ -13686,10 +13865,13 @@ begin
end; end;
procedure TJvTFDaysPrinter.SetMinColWidth(Value: Integer); procedure TJvTFDaysPrinter.SetMinColWidth(Value: Integer);
var
absMinColWidth: Integer;
begin begin
SetPropertyCheck; SetPropertyCheck;
if Value < AbsMinColWidth then absMinColWidth := DEFAULT_MIN_COL_WIDTH;
Value := AbsMinColWidth; if Value < absMinColWidth then
Value := absMinColWidth;
FMinColWidth := Value; FMinColWidth := Value;
end; end;
@ -14385,7 +14567,7 @@ begin
inherited Create; inherited Create;
FBlockGran := 60; FBlockGran := 60;
FDaysControl := ADaysControl; FDaysControl := ADaysControl;
FBlockHdrWidth := 50; FBlockHdrWidth := DEFAULT_BLOCK_HDR_WIDTH; // will be scaled by FDaysControl
FBlockHdrAttr := TJvTFDaysHdrAttr.Create(DaysControl); FBlockHdrAttr := TJvTFDaysHdrAttr.Create(DaysControl);
FSelBlockHdrAttr := TJvTFDaysHdrAttr.Create(DaysControl); FSelBlockHdrAttr := TJvTFDaysHdrAttr.Create(DaysControl);
FOffTimeColor := clGray; FOffTimeColor := clGray;
@ -14426,12 +14608,27 @@ begin
inherited Assign(Source); inherited Assign(Source);
end; end;
procedure TJvTFDaysBlockProps.AutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double);
begin
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
begin
if not IsStoredBlockHdrWidth then
FBlockHdrWidth := round(FBlockHdrWidth * AXProportion);
end;
end;
procedure TJvTFDaysBlockProps.Change; procedure TJvTFDaysBlockProps.Change;
begin begin
if Assigned(DaysControl) then if Assigned(DaysControl) then
DaysControl.Invalidate; DaysControl.Invalidate;
end; end;
function TJvTFDaysBlockProps.IsStoredBlockHdrWidth: Boolean;
begin
Result := FBlockHdrWidth <> FDaysControl.Scale96ToFont(DEFAULT_BLOCK_HDR_WIDTH);
end;
procedure TJvTFDaysBlockProps.SetBlockGran(Value: Integer); procedure TJvTFDaysBlockProps.SetBlockGran(Value: Integer);
begin begin
if csLoading in DaysControl.ComponentState then if csLoading in DaysControl.ComponentState then