From 7a3d5c7a3fd51e5ae258c6fdadcff0d3db29b3e4 Mon Sep 17 00:00:00 2001 From: ondrej Date: Sat, 20 May 2017 20:30:08 +0000 Subject: [PATCH] IdeIntf: OI: use DefaultValueFont and ValueFont also for editors and hint window; draw default value in editor combobox with italic style. git-svn-id: trunk@55025 - --- components/ideintf/idehelpintf.pas | 11 ++++++--- components/ideintf/objectinspector.pp | 32 +++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/components/ideintf/idehelpintf.pas b/components/ideintf/idehelpintf.pas index ff4fa5591f..0224a758a8 100644 --- a/components/ideintf/idehelpintf.pas +++ b/components/ideintf/idehelpintf.pas @@ -18,7 +18,7 @@ interface uses Classes, SysUtils, types, LCLProc, Forms, Controls, HelpIntfs, LazHelpIntf, - LMessages, LCLType, TextTools; + LMessages, LCLType, TextTools, Graphics; type { THelpDBIRegExprMessage @@ -189,7 +189,8 @@ type constructor Create; overload; destructor Destroy; override; function HintIsVisible: boolean; - function ShowHint(ScreenPos: TPoint; TheHint: string; const MouseOffset: Boolean = True): boolean; + function ShowHint(ScreenPos: TPoint; TheHint: string; const MouseOffset: Boolean = True; + HintFont: TFont = nil): boolean; procedure HideHint; procedure HideIfVisible; public @@ -361,7 +362,7 @@ begin end; function THintWindowManager.ShowHint(ScreenPos: TPoint; TheHint: string; - const MouseOffset: Boolean): boolean; + const MouseOffset: Boolean; HintFont: TFont): boolean; var ms: TMemoryStream; NewWidth, NewHeight: integer; @@ -370,6 +371,8 @@ var var HintWinRect: TRect; begin + if HintFont<>nil then + HintTextWindow.Font := HintFont; HintWinRect := HintTextWindow.CalcHintRect(Screen.Width, TheHint, Nil); HintTextWindow.HintRect := HintWinRect; // Adds borders. if MouseOffset then @@ -381,6 +384,8 @@ var procedure DoHtml; begin + if HintFont<>nil then + HintRenderWindow.Font := HintFont; HtmlHelpProvider.BaseURL:=FBaseURL; ms:=TMemoryStream.Create; try diff --git a/components/ideintf/objectinspector.pp b/components/ideintf/objectinspector.pp index 1b9203bc1a..8e1898c397 100644 --- a/components/ideintf/objectinspector.pp +++ b/components/ideintf/objectinspector.pp @@ -1863,7 +1863,7 @@ begin else if paPickList in EditorAttributes then ValueComboBox.Style:=csDropDownList // text field should be readonly else - ValueComboBox.Style:=csDropDown; + ValueComboBox.Style:=csOwnerDrawFixed; ValueComboBox.MaxLength:=NewRow.Editor.GetEditLimit; ValueComboBox.Sorted:=paSortList in NewRow.Editor.GetAttributes; ValueComboBox.Enabled:=not NewRow.IsReadOnly; @@ -1893,6 +1893,10 @@ begin else FCurrentEdit.Color:=FValueDifferBackgrndColor; end; + if NewRow.Editor.IsNotDefaultValue then + FCurrentEdit.Font:=FValueFont + else + FCurrentEdit.Font:=FDefaultValueFont; FCurrentEdit.Visible:=true; if (FDragging=false) and FCurrentEdit.Showing and FCurrentEdit.Enabled and (not NewRow.IsReadOnly) and CanFocus and (Column=oipgcValue) @@ -2376,13 +2380,23 @@ end; procedure TOICustomPropertyGrid.MouseMove(Shift:TShiftState; X,Y:integer); var TheHint: String; + HintType: TPropEditHint; fPropRow: TOIPropertyGridRow; procedure DoShow(pt: TPoint); inline; + var + HintFont: TFont; begin if WidgetSet.GetLCLCapability(lcTransparentWindow)=LCL_CAPABILITY_NO then Inc(pt.Y, fPropRow.Height); - FHintManager.ShowHint(ClientToScreen(pt), TheHint, False); + if HintType<>pehValue then + HintFont := Screen.HintFont + else + if fPropRow.Editor.IsNotDefaultValue then + HintFont:=FValueFont + else + HintFont:=FDefaultValueFont; + FHintManager.ShowHint(ClientToScreen(pt), TheHint, False, HintFont); if FHintManager.CurHintWindow<>nil then FHintManager.CurHintWindow.OnMouseLeave := @HintMouseLeave; end; @@ -2390,7 +2404,6 @@ var var SplitDistance:integer; Index, TextLeft: Integer; - HintType: TPropEditHint; begin inherited MouseMove(Shift,X,Y); SplitDistance:=X-SplitterX; @@ -3298,6 +3311,14 @@ begin end else if FCurrentEdit=ValueCheckBox then SetCheckboxState(NewValue); + + if (FItemIndex>=0) and (FItemIndex