From 12ae2ed3c84fee404b3859989a4815236ba820fb Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Fri, 12 Jan 2018 11:07:34 +0000 Subject: [PATCH] tvplanit: Fix compilation with Laz trunk (Hi-DPI issue). Release as v1.0.8. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6129 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/tvplanit/laz_visualplanit.lpk | 2 +- .../tvplanit/laz_visualplanit_design.lpk | 2 +- components/tvplanit/laz_visualplanit_zeos.lpk | 2 +- .../tvplanit/laz_visualplanit_zeos_design.lpk | 2 +- components/tvplanit/source/vpconst.pas | 5 ++++- components/tvplanit/source/vpcontactgrid.pas | 13 ++++++++++-- components/tvplanit/source/vpdayview.pas | 16 ++++++++++++++- components/tvplanit/source/vpmonthview.pas | 20 +++++++++++++++++-- components/tvplanit/source/vptasklist.pas | 13 ++++++++++-- components/tvplanit/source/vpweekview.pas | 16 +++++++++++++-- 10 files changed, 77 insertions(+), 14 deletions(-) diff --git a/components/tvplanit/laz_visualplanit.lpk b/components/tvplanit/laz_visualplanit.lpk index 2ef879764..3d9f4b33b 100644 --- a/components/tvplanit/laz_visualplanit.lpk +++ b/components/tvplanit/laz_visualplanit.lpk @@ -31,7 +31,7 @@ The Initial Developer of the Original Code is TurboPower Software. Portions created by TurboPower Software Inc. are Copyright (C) 2002 TurboPower Software Inc. All Rights Reserved. Contributor(s): "/> - + diff --git a/components/tvplanit/laz_visualplanit_design.lpk b/components/tvplanit/laz_visualplanit_design.lpk index 5878f5703..9e015f63b 100644 --- a/components/tvplanit/laz_visualplanit_design.lpk +++ b/components/tvplanit/laz_visualplanit_design.lpk @@ -27,7 +27,7 @@ The Initial Developer of the Original Code is TurboPower Software. Portions created by TurboPower Software Inc. are Copyright (C) 2002 TurboPower Software Inc. All Rights Reserved. Contributor(s): "/> - + diff --git a/components/tvplanit/laz_visualplanit_zeos.lpk b/components/tvplanit/laz_visualplanit_zeos.lpk index 1f0789096..5b2ea4be9 100644 --- a/components/tvplanit/laz_visualplanit_zeos.lpk +++ b/components/tvplanit/laz_visualplanit_zeos.lpk @@ -18,7 +18,7 @@ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. "/> - + diff --git a/components/tvplanit/laz_visualplanit_zeos_design.lpk b/components/tvplanit/laz_visualplanit_zeos_design.lpk index 976b7c334..608771bbd 100644 --- a/components/tvplanit/laz_visualplanit_zeos_design.lpk +++ b/components/tvplanit/laz_visualplanit_zeos_design.lpk @@ -14,7 +14,7 @@ - + diff --git a/components/tvplanit/source/vpconst.pas b/components/tvplanit/source/vpconst.pas index bae4733a0..89f00b849 100644 --- a/components/tvplanit/source/vpconst.pas +++ b/components/tvplanit/source/vpconst.pas @@ -271,11 +271,14 @@ const MAX_HINT_WIDTH = 400; {$IFDEF LCL} + {$IF LCL_FULLVERSION >= 1080100} + VP_LCL_SCALING = 2; + {$ELSE} {$IF LCL_FULLVERSION >= 1080000} VP_LCL_SCALING = 1; {$ELSE} VP_LCL_SCALING = 0; - {$ENDIF} + {$ENDIF}{$ENDIF} {$ELSE} VL_LCL_SCALING := 0; {$ENDIF} diff --git a/components/tvplanit/source/vpcontactgrid.pas b/components/tvplanit/source/vpcontactgrid.pas index 03bd62b7b..c19dc7a27 100644 --- a/components/tvplanit/source/vpcontactgrid.pas +++ b/components/tvplanit/source/vpcontactgrid.pas @@ -195,7 +195,9 @@ type procedure EditContact; procedure EndEdit(Sender: TObject); procedure InitializeDefaultPopup; - {$IF VP_LCL_SCALING = 1} + {$IF VP_LCL_SCALING = 2} + procedure ScaleFontsPPI(const AToPPI: Integer; const AProportion: Double); override; + {$ELSEIF VP_LCL_SCALING = 1} procedure ScaleFontsPPI(const AProportion: Double); override; {$ENDIF} @@ -1749,7 +1751,14 @@ begin Invalidate; end; -{$IF VP_LCL_SCALING=1} +{$IF VP_LCL_SCALING = 2} +procedure TVpContactGrid.ScaleFontsPPI(const AToPPI: Integer; + const AProportion: Double); +begin + inherited; + DoScaleFontPPI(ContactHeadAttributes.Font, AToPPI, AProportion); +end; +{$ELSEIF VP_LCL_SCALING = 1} procedure TVpContactGrid.ScaleFontsPPI(const AProportion: Double); begin inherited; diff --git a/components/tvplanit/source/vpdayview.pas b/components/tvplanit/source/vpdayview.pas index 6b6710478..736a9506c 100644 --- a/components/tvplanit/source/vpdayview.pas +++ b/components/tvplanit/source/vpdayview.pas @@ -389,9 +389,13 @@ type procedure EndEdit(Sender: TObject); procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure SetTimeIntervals(UseGran: TVpGranularity); + {$IF VP_LCL_SCALING = 2} + procedure ScaleFontsPPI(const AToPPI: Integer; const AProportion: Double); override; + {$ELSE} {$IF VP_LCL_SCALING = 1} procedure ScaleFontsPPI(const AProportion: Double); override; {$ENDIF} + {$ENDIF} { message handlers } procedure VpDayViewInit(var Msg: {$IFDEF DELPHI}TMessage{$ELSE}TLMessage{$ENDIF}); message Vp_DayViewInit; @@ -2576,7 +2580,17 @@ begin SetVScrollPos; end; -{$IF VP_LCL_SCALING = 1} +{$IF VP_LCL_SCALING = 2} +procedure TVpDayView.ScaleFontsPPI(const AToPPI: Integer; + const AProportion: Double); +begin + inherited; + DoScaleFontPPI(AllDayEventAttributes.Font, AToPPI, AProportion); + DoScaleFontPPI(HeadAttributes.Font, AToPPI, AProportion); + DoScaleFontPPI(RowHeadAttributes.HourFont, AToPPI, AProportion); + DoScaleFontPPI(RowHeadAttributes.MinuteFont, AToPPI, AProportion); +end; +{$ELSEIF VP_LCL_SCALING = 1} procedure TVpDayView.ScaleFontsPPI(const AProportion: Double); begin inherited; diff --git a/components/tvplanit/source/vpmonthview.pas b/components/tvplanit/source/vpmonthview.pas index dddb568c1..68a906604 100644 --- a/components/tvplanit/source/vpmonthview.pas +++ b/components/tvplanit/source/vpmonthview.pas @@ -233,9 +233,12 @@ type procedure MouseMove(Shift: TShiftState; X,Y: Integer); override; procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; procedure Paint; override; - {$IF VP_LCL_SCALING = 1} + {$IF VP_LCL_SCALING = 2} + procedure ScaleFontsPPI(const AToPPI: Integer; const AProportion: Double); override; + {$ELSEIF VP_LCL_SCALING = 1} procedure ScaleFontsPPI(const AProportion: Double); override; {$ENDIF} + { drag and drop } procedure DoEndDrag(Target: TObject; X, Y: Integer); override; procedure DoStartDrag(var DragObject: TDragObject); override; @@ -1533,7 +1536,20 @@ begin end; end; -{$IF VP_LCL_SCALING = 1} + +{$IF VP_LCL_SCALING = 2} +procedure TVpMonthView.ScaleFontsPPI(const AToPPI: Integer; + const AProportion: Double); +begin + inherited; + DoScaleFontPPI(DayHeadAttributes.Font, AToPPI, AProportion); + DoScaleFontPPI(EventFont, AToPPI, AProportion); + DoScaleFontPPI(HeadAttributes.Font, AToPPI, AProportion); + DoScaleFontPPI(HolidayAttributes.Font, AToPPI, AProportion); + DoScaleFontPPI(TodayAttributes.Font, AToPPI, AProportion); + DoScaleFontPPI(WeekendAttributes.Font, AToPPI, AProportion); +end; +{$ELSEIF VP_LCL_SCALING = 1} procedure TVpMonthView.ScaleFontsPPI(const AProportion: Double); begin inherited; diff --git a/components/tvplanit/source/vptasklist.pas b/components/tvplanit/source/vptasklist.pas index 6a07fc591..54e6e2f76 100644 --- a/components/tvplanit/source/vptasklist.pas +++ b/components/tvplanit/source/vptasklist.pas @@ -189,7 +189,9 @@ type procedure EditTask; procedure EndEdit(Sender: TObject); procedure KeyDown(var Key: Word; Shift: TShiftState); override; - {$IF VP_LCL_SCALING = 1} + {$IF VP_LCL_SCALING = 2} + procedure ScaleFontsPPI(const AToPPI: Integer; const AProportion: Double); override; + {$ELSEIF VP_LCL_SCALING = 1} procedure ScaleFontsPPI(const AProportion: Double); override; {$ENDIF} @@ -1248,7 +1250,14 @@ begin end; end; -{$IF VP_LCL_SCALING=1} +{$IF VP_LCL_SCALING = 2} +procedure TVpTaskList.ScaleFontsPPI(const AToPPI: Integer; + const AProportion: Double); +begin + inherited; + DoScaleFontPPI(TaskHeadAttributes.Font, AToPPI, AProportion); +end; +{$ELSEIF VP_LCL_SCALING = 1} procedure TVpTaskList.ScaleFontsPPI(const AProportion: Double); begin inherited; diff --git a/components/tvplanit/source/vpweekview.pas b/components/tvplanit/source/vpweekview.pas index 34e49d873..1b6f455cb 100644 --- a/components/tvplanit/source/vpweekview.pas +++ b/components/tvplanit/source/vpweekview.pas @@ -223,7 +223,9 @@ type procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X,Y: Integer); override; procedure Paint; override; - {$IF VP_LCL_SCALING = 1} + {$IF VP_LCL_SCALING = 2} + procedure ScaleFontsPPI(const AToPPI: Integer; const AProportion: Double); override; + {$ELSEIF VP_LCL_SCALING = 1} procedure ScaleFontsPPI(const AProportion: Double); override; {$ENDIF} @@ -1734,7 +1736,17 @@ begin end; end; -{$IF VP_LCL_SCALING = 1} +{$IF VP_LCL_SCALING = 2} +procedure TVpWeekView.ScaleFontsPPI(const AToPPI: Integer; + const AProportion: Double); +begin + inherited; + DoScaleFontPPI(AllDayEventAttributes.Font, AToPPI, AProportion); + DoScaleFontPPI(DayHeadAttributes.Font, AToPPI, AProportion); + DoScaleFontPPI(EventFont, AToPPI, AProportion); + DoScaleFontPPI(HeadAttributes.Font, AToPPI, AProportion); +end; +{$ELSEIF VP_LCL_SCALING = 1} procedure TVpWeekView.ScaleFontsPPI(const AProportion: Double); begin inherited;