From c84cbe3ffbacdd322a13b4e1563da97f4ae2696b Mon Sep 17 00:00:00 2001 From: mattias Date: Thu, 31 Aug 2006 18:33:13 +0000 Subject: [PATCH] Thintwindow: using the same function to calculate the size and for painting, bug #1680 git-svn-id: trunk@9774 - --- components/printers/unix/udlgselectprinter.pp | 2 +- lcl/include/hintwindow.inc | 22 +++++-------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/components/printers/unix/udlgselectprinter.pp b/components/printers/unix/udlgselectprinter.pp index 52d753255f..c9eb73cdd1 100644 --- a/components/printers/unix/udlgselectprinter.pp +++ b/components/printers/unix/udlgselectprinter.pp @@ -42,7 +42,7 @@ interface uses Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, Buttons, ExtCtrls, Spin, MaskEdit, ComCtrls, LCLType, - Printers, OsPrinters in '../osprinters.pas', CUPSDyn; + Printers, OsPrinters, CUPSDyn; type diff --git a/lcl/include/hintwindow.inc b/lcl/include/hintwindow.inc index 4c6b4f2a40..bf20ff2ec8 100644 --- a/lcl/include/hintwindow.inc +++ b/lcl/include/hintwindow.inc @@ -83,23 +83,11 @@ begin ARect := ClientRect; Canvas.Brush.Color := Color; Canvas.Pen.Width := 1; - //debugln('THintWindow.Paint A ',dbgs(ARect)); DrawEdge(Canvas.Handle, ARect, BDR_RAISEDOUTER, BF_RECT); InflateRect(ARect,-2*HintBorderWidth,-2*HintBorderWidth); - //debugln('THintWindow.Paint B ',dbgs(ARect)); - with TS do - begin - Alignment := taCenter; - Layout := tlCenter; - SingleLine := false; - Clipping := true; - ExpandTabs := true; - ShowPrefix := false; - WordBreak := true; - Opaque := false; - SystemFont := false; - end; - Canvas.TextRect(ARect, ARect.Left, ARect.Top, Caption, TS); + DrawText(Canvas.GetUpdatedHandle([csFontValid]), + PChar(Caption), Length(Caption), ARect, + DT_NOPREFIX or DT_CENTER or DT_VCENTER or DT_WORDBREAK); end; procedure THintWindow.ActivateHint(ARect: TRect; const AHint: String); @@ -138,10 +126,10 @@ end; function THintWindow.CalcHintRect(MaxWidth: Integer; const AHint: String; AData: Pointer): TRect; begin - Result := Rect(0,0, MaxWidth, ClientHeight); + Result := Rect(0,0, MaxWidth, Screen.Height-4*HintBorderWidth); if AHint='' then exit; DrawText(Canvas.GetUpdatedHandle([csFontValid]), PChar(AHint), Length(AHint), - Result, DT_CalcRect or DT_NOPREFIX); + Result, DT_CalcRect or DT_NOPREFIX or DT_WORDBREAK); inc(Result.Right,4*HintBorderWidth); inc(Result.Bottom,4*HintBorderWidth); //debugln('THintWindow.CalcHintRect Result=',dbgs(Result));