Răsfoiți Sursa

When hint contained long unbreakable text, it did not fit into hint window

Source commit: 9f4e97f1d374c50c54aec5cce91c8cae0eb55825
Martin Prikryl 4 ani în urmă
părinte
comite
e633c39d68
1 a modificat fișierele cu 7 adăugiri și 4 ștergeri
  1. 7 4
      source/windows/GUITools.cpp

+ 7 - 4
source/windows/GUITools.cpp

@@ -1884,10 +1884,13 @@ TRect __fastcall TScreenTipHintWindow::CalcHintRect(int MaxWidth, const UnicodeS
 
   const int ScreenTipTextOnlyWidth = ScaleByTextHeight(HintControl, cScreenTipTextOnlyWidth);
 
-  if (!LongHint.IsEmpty())
+  int LongHintMargin = 0; // shut up
+  bool HasLongHint = !LongHint.IsEmpty();
+  if (HasLongHint)
   {
     // double-margin on the right
-    MaxWidth = ScreenTipTextOnlyWidth - (3 * Margin);
+    LongHintMargin = (3 * Margin);
+    MaxWidth = ScreenTipTextOnlyWidth - LongHintMargin;
   }
 
   // Multi line short hints can be twice as wide, to not break the individual lines unless really necessary.
@@ -1914,7 +1917,7 @@ TRect __fastcall TScreenTipHintWindow::CalcHintRect(int MaxWidth, const UnicodeS
 
   TRect Result;
 
-  if (LongHint.IsEmpty())
+  if (!HasLongHint)
   {
     Result = ShortRect;
 
@@ -1935,7 +1938,7 @@ TRect __fastcall TScreenTipHintWindow::CalcHintRect(int MaxWidth, const UnicodeS
     TRect LongRect(0, 0, MaxWidth - LongIndentation, 0);
     CalcHintTextRect(this, Canvas, LongRect, LongHint);
 
-    Result.Right = ScreenTipTextOnlyWidth;
+    Result.Right = Max(ScreenTipTextOnlyWidth, LongRect.Right + LongIndentation + LongHintMargin);
     Result.Bottom = Margin + ShortRect.Height() + (Margin / 3 * 5) + LongRect.Height() + Margin;
   }