From ea478cd4034f1a7d650eb6d43ef3181ae4da337f Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Tue, 15 May 2018 19:47:29 +0000 Subject: [PATCH] tvplanit: Avoid truncation of VpDayView's NavBtns if no Header height if no Datastore is assigned. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6416 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/tvplanit/source/vpdayview.pas | 7 +++++++ components/tvplanit/source/vpdayviewpainter.pas | 1 + components/tvplanit/source/vpmisc.pas | 4 ++-- components/tvplanit/source/vpxparsr.pas | 7 +++---- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/components/tvplanit/source/vpdayview.pas b/components/tvplanit/source/vpdayview.pas index 36b417a61..6efc00e60 100644 --- a/components/tvplanit/source/vpdayview.pas +++ b/components/tvplanit/source/vpdayview.pas @@ -1475,6 +1475,7 @@ end; function TVpDayView.dvCalcColHeadHeight(Scale: Extended): Integer; var TextHeight: Integer; + glyphHeights: Integer; begin Canvas.Font.Assign(FHeadAttr.Font); Canvas.Font.Size := ScaleY(Canvas.Font.Size, DesignTimeDPI); @@ -1484,6 +1485,12 @@ begin else TextHeight := Canvas.TextHeight(TallShortChars) + TextMargin * 2; Result := Round(TextHeight * Scale); + + if Assigned(dvTodayBtn.Glyph) then begin + glyphHeights := dvDayUpBtn.Glyph.Height + dvTodayBtn.Glyph.Height + 6; + if Result < glyphHeights then Result := glyphHeights; + end; + dvColHeadHeight := Result; end; {=====} diff --git a/components/tvplanit/source/vpdayviewpainter.pas b/components/tvplanit/source/vpdayviewpainter.pas index e444b59fc..53e5344bc 100644 --- a/components/tvplanit/source/vpdayviewpainter.pas +++ b/components/tvplanit/source/vpdayviewpainter.pas @@ -1124,6 +1124,7 @@ begin dvTodayBtn.Visible := FShowNavButtons; dvWeekUpBtn.Visible := FShowNavButtons; dvWeekDownBtn.Visible := FShowNavButtons; + { Calculate width of buttons } dvTodayBtn.Height := trunc(RealColHeadHeight div 2); dvTodayBtn.Width := RealRowHeadWidth; diff --git a/components/tvplanit/source/vpmisc.pas b/components/tvplanit/source/vpmisc.pas index 93c2a05d5..165258aab 100644 --- a/components/tvplanit/source/vpmisc.pas +++ b/components/tvplanit/source/vpmisc.pas @@ -79,7 +79,7 @@ function AssembleCSZ(AContact: TVpContact; AType: Integer; AFormat: String): Str procedure ParseName(Contact: TVpContact; const Value: string); { parses the name into it's elements and updates the contact } -procedure ParseCSZ(Str: string; var City, State, Zip: string); +procedure ParseCSZ(Str: string; out City, State, Zip: string); { parses the string and returns the city, state and zip parameters } {$IFDEF DELPHI} @@ -296,7 +296,7 @@ begin end; {=====} -procedure ParseCSZ(Str: string; var City, State, Zip: string); +procedure ParseCSZ(Str: string; out City, State, Zip: string); var num: integer; begin diff --git a/components/tvplanit/source/vpxparsr.pas b/components/tvplanit/source/vpxparsr.pas index 16191fc6a..94d595f4b 100644 --- a/components/tvplanit/source/vpxparsr.pas +++ b/components/tvplanit/source/vpxparsr.pas @@ -162,7 +162,7 @@ type procedure PushDocument; procedure PushString(const sVal: DOMString); function ReadChar(const UpdatePos: Boolean): DOMChar; - procedure ReadExternalIds(bInNotation: Boolean; var sIds: StringIds); + procedure ReadExternalIds(bInNotation: Boolean; out sIds: StringIds); function ReadLiteral(wFlags: Integer; var HasEntRef: Boolean): DOMString; function ReadNameToken(aValFirst: Boolean): DOMString; procedure Require(const S: array of Longint); @@ -1604,7 +1604,7 @@ end; {--------} procedure TVpParser.ParseUntil(const S : array of Longint); var - TempStr : AnsiString; + TempStr : AnsiString = ''; TempChar : AnsiChar; i : Integer; Found : Boolean; @@ -1753,8 +1753,7 @@ begin FFilter.SkipChar; end; {--------} -procedure TVpParser.ReadExternalIds(bInNotation : Boolean; - var sIds : StringIds); +procedure TVpParser.ReadExternalIds(bInNotation : Boolean; out sIds: StringIds); var HasEntRef : Boolean; TempChar : DOMChar;