mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 17:18:25 +02:00
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 -
This commit is contained in:
parent
c1f4cfb81a
commit
7a3d5c7a3f
@ -18,7 +18,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, types, LCLProc, Forms, Controls, HelpIntfs, LazHelpIntf,
|
Classes, SysUtils, types, LCLProc, Forms, Controls, HelpIntfs, LazHelpIntf,
|
||||||
LMessages, LCLType, TextTools;
|
LMessages, LCLType, TextTools, Graphics;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ THelpDBIRegExprMessage
|
{ THelpDBIRegExprMessage
|
||||||
@ -189,7 +189,8 @@ type
|
|||||||
constructor Create; overload;
|
constructor Create; overload;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function HintIsVisible: boolean;
|
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 HideHint;
|
||||||
procedure HideIfVisible;
|
procedure HideIfVisible;
|
||||||
public
|
public
|
||||||
@ -361,7 +362,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function THintWindowManager.ShowHint(ScreenPos: TPoint; TheHint: string;
|
function THintWindowManager.ShowHint(ScreenPos: TPoint; TheHint: string;
|
||||||
const MouseOffset: Boolean): boolean;
|
const MouseOffset: Boolean; HintFont: TFont): boolean;
|
||||||
var
|
var
|
||||||
ms: TMemoryStream;
|
ms: TMemoryStream;
|
||||||
NewWidth, NewHeight: integer;
|
NewWidth, NewHeight: integer;
|
||||||
@ -370,6 +371,8 @@ var
|
|||||||
var
|
var
|
||||||
HintWinRect: TRect;
|
HintWinRect: TRect;
|
||||||
begin
|
begin
|
||||||
|
if HintFont<>nil then
|
||||||
|
HintTextWindow.Font := HintFont;
|
||||||
HintWinRect := HintTextWindow.CalcHintRect(Screen.Width, TheHint, Nil);
|
HintWinRect := HintTextWindow.CalcHintRect(Screen.Width, TheHint, Nil);
|
||||||
HintTextWindow.HintRect := HintWinRect; // Adds borders.
|
HintTextWindow.HintRect := HintWinRect; // Adds borders.
|
||||||
if MouseOffset then
|
if MouseOffset then
|
||||||
@ -381,6 +384,8 @@ var
|
|||||||
|
|
||||||
procedure DoHtml;
|
procedure DoHtml;
|
||||||
begin
|
begin
|
||||||
|
if HintFont<>nil then
|
||||||
|
HintRenderWindow.Font := HintFont;
|
||||||
HtmlHelpProvider.BaseURL:=FBaseURL;
|
HtmlHelpProvider.BaseURL:=FBaseURL;
|
||||||
ms:=TMemoryStream.Create;
|
ms:=TMemoryStream.Create;
|
||||||
try
|
try
|
||||||
|
@ -1863,7 +1863,7 @@ begin
|
|||||||
else if paPickList in EditorAttributes then
|
else if paPickList in EditorAttributes then
|
||||||
ValueComboBox.Style:=csDropDownList // text field should be readonly
|
ValueComboBox.Style:=csDropDownList // text field should be readonly
|
||||||
else
|
else
|
||||||
ValueComboBox.Style:=csDropDown;
|
ValueComboBox.Style:=csOwnerDrawFixed;
|
||||||
ValueComboBox.MaxLength:=NewRow.Editor.GetEditLimit;
|
ValueComboBox.MaxLength:=NewRow.Editor.GetEditLimit;
|
||||||
ValueComboBox.Sorted:=paSortList in NewRow.Editor.GetAttributes;
|
ValueComboBox.Sorted:=paSortList in NewRow.Editor.GetAttributes;
|
||||||
ValueComboBox.Enabled:=not NewRow.IsReadOnly;
|
ValueComboBox.Enabled:=not NewRow.IsReadOnly;
|
||||||
@ -1893,6 +1893,10 @@ begin
|
|||||||
else
|
else
|
||||||
FCurrentEdit.Color:=FValueDifferBackgrndColor;
|
FCurrentEdit.Color:=FValueDifferBackgrndColor;
|
||||||
end;
|
end;
|
||||||
|
if NewRow.Editor.IsNotDefaultValue then
|
||||||
|
FCurrentEdit.Font:=FValueFont
|
||||||
|
else
|
||||||
|
FCurrentEdit.Font:=FDefaultValueFont;
|
||||||
FCurrentEdit.Visible:=true;
|
FCurrentEdit.Visible:=true;
|
||||||
if (FDragging=false) and FCurrentEdit.Showing and FCurrentEdit.Enabled
|
if (FDragging=false) and FCurrentEdit.Showing and FCurrentEdit.Enabled
|
||||||
and (not NewRow.IsReadOnly) and CanFocus and (Column=oipgcValue)
|
and (not NewRow.IsReadOnly) and CanFocus and (Column=oipgcValue)
|
||||||
@ -2376,13 +2380,23 @@ end;
|
|||||||
procedure TOICustomPropertyGrid.MouseMove(Shift:TShiftState; X,Y:integer);
|
procedure TOICustomPropertyGrid.MouseMove(Shift:TShiftState; X,Y:integer);
|
||||||
var
|
var
|
||||||
TheHint: String;
|
TheHint: String;
|
||||||
|
HintType: TPropEditHint;
|
||||||
fPropRow: TOIPropertyGridRow;
|
fPropRow: TOIPropertyGridRow;
|
||||||
|
|
||||||
procedure DoShow(pt: TPoint); inline;
|
procedure DoShow(pt: TPoint); inline;
|
||||||
|
var
|
||||||
|
HintFont: TFont;
|
||||||
begin
|
begin
|
||||||
if WidgetSet.GetLCLCapability(lcTransparentWindow)=LCL_CAPABILITY_NO then
|
if WidgetSet.GetLCLCapability(lcTransparentWindow)=LCL_CAPABILITY_NO then
|
||||||
Inc(pt.Y, fPropRow.Height);
|
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
|
if FHintManager.CurHintWindow<>nil then
|
||||||
FHintManager.CurHintWindow.OnMouseLeave := @HintMouseLeave;
|
FHintManager.CurHintWindow.OnMouseLeave := @HintMouseLeave;
|
||||||
end;
|
end;
|
||||||
@ -2390,7 +2404,6 @@ var
|
|||||||
var
|
var
|
||||||
SplitDistance:integer;
|
SplitDistance:integer;
|
||||||
Index, TextLeft: Integer;
|
Index, TextLeft: Integer;
|
||||||
HintType: TPropEditHint;
|
|
||||||
begin
|
begin
|
||||||
inherited MouseMove(Shift,X,Y);
|
inherited MouseMove(Shift,X,Y);
|
||||||
SplitDistance:=X-SplitterX;
|
SplitDistance:=X-SplitterX;
|
||||||
@ -3298,6 +3311,14 @@ begin
|
|||||||
end
|
end
|
||||||
else if FCurrentEdit=ValueCheckBox then
|
else if FCurrentEdit=ValueCheckBox then
|
||||||
SetCheckboxState(NewValue);
|
SetCheckboxState(NewValue);
|
||||||
|
|
||||||
|
if (FItemIndex>=0) and (FItemIndex<RowCount) and Assigned(FCurrentEdit) then
|
||||||
|
begin
|
||||||
|
if Rows[FItemIndex].Editor.IsNotDefaultValue then
|
||||||
|
FCurrentEdit.Font:=FValueFont
|
||||||
|
else
|
||||||
|
FCurrentEdit.Font:=FDefaultValueFont;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOICustomPropertyGrid.SetDrawHorzGridLines(const AValue: Boolean);
|
procedure TOICustomPropertyGrid.SetDrawHorzGridLines(const AValue: Boolean);
|
||||||
@ -3441,6 +3462,9 @@ begin
|
|||||||
Font.Color:=Pen.Color;
|
Font.Color:=Pen.Color;
|
||||||
FillRect(ARect);
|
FillRect(ARect);
|
||||||
end;
|
end;
|
||||||
|
ValueComboBox.Canvas.Font.Assign(FDefaultValueFont);
|
||||||
|
if CurRow.Editor.HasDefaultValue and (ItemValue = CurRow.Editor.GetDefaultValue) then
|
||||||
|
ValueComboBox.Canvas.Font.Style := ValueComboBox.Canvas.Font.Style + [fsItalic];
|
||||||
CurRow.Editor.ListDrawValue(ItemValue,Index,ValueComboBox.Canvas,ARect,AState);
|
CurRow.Editor.ListDrawValue(ItemValue,Index,ValueComboBox.Canvas,ARect,AState);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -3505,7 +3529,7 @@ begin
|
|||||||
else
|
else
|
||||||
AHint := PointedRow.Editor.GetHint(HintType, Position.X, Position.Y);
|
AHint := PointedRow.Editor.GetHint(HintType, Position.X, Position.Y);
|
||||||
// Show hint if all is well.
|
// Show hint if all is well.
|
||||||
if OkToShow and FHintManager.ShowHint(Position, AHint) then begin
|
if OkToShow and FHintManager.ShowHint(Position, AHint, True, Screen.HintFont) then begin
|
||||||
FHintIndex := Index;
|
FHintIndex := Index;
|
||||||
FHintType := HintType;
|
FHintType := HintType;
|
||||||
FShowingLongHint := True;
|
FShowingLongHint := True;
|
||||||
|
Loading…
Reference in New Issue
Block a user