mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 09:56:12 +02:00
IDE: Make object inspector use the new HintManager class.
git-svn-id: trunk@45829 -
This commit is contained in:
parent
a4ee0ab208
commit
f6cd1a888f
@ -152,9 +152,11 @@ type
|
|||||||
FFlags: TIDEHTMLControlFlags;
|
FFlags: TIDEHTMLControlFlags;
|
||||||
FOrigMousePos: TPoint;
|
FOrigMousePos: TPoint;
|
||||||
// These will be passed to HintWindow.
|
// These will be passed to HintWindow.
|
||||||
FWindowName: string;
|
FAutoHide: Boolean;
|
||||||
FHideInterval: Integer;
|
FHideInterval: Integer;
|
||||||
|
FWindowName: string;
|
||||||
function HtmlHelpProvider: TAbstractIDEHTMLProvider;
|
function HtmlHelpProvider: TAbstractIDEHTMLProvider;
|
||||||
|
procedure SetAutoHide(AValue: Boolean);
|
||||||
procedure SetHideInterval(AValue: Integer);
|
procedure SetHideInterval(AValue: Integer);
|
||||||
procedure SetWindowName(AValue: string);
|
procedure SetWindowName(AValue: string);
|
||||||
protected
|
protected
|
||||||
@ -170,6 +172,7 @@ type
|
|||||||
public
|
public
|
||||||
property BaseURL: string read FBaseURL write FBaseURL;
|
property BaseURL: string read FBaseURL write FBaseURL;
|
||||||
property Flags: TIDEHTMLControlFlags read FFlags write FFlags;
|
property Flags: TIDEHTMLControlFlags read FFlags write FFlags;
|
||||||
|
property AutoHide: Boolean read FAutoHide write SetAutoHide;
|
||||||
property HideInterval: Integer read FHideInterval write SetHideInterval;
|
property HideInterval: Integer read FHideInterval write SetHideInterval;
|
||||||
property WindowName: string read FWindowName write SetWindowName;
|
property WindowName: string read FWindowName write SetWindowName;
|
||||||
end;
|
end;
|
||||||
@ -271,9 +274,10 @@ begin
|
|||||||
if FHintWindow = nil then
|
if FHintWindow = nil then
|
||||||
begin
|
begin
|
||||||
FHintWindow := FHintWindowClass.Create(Nil);
|
FHintWindow := FHintWindowClass.Create(Nil);
|
||||||
|
FHintWindow.AutoHide := FAutoHide;
|
||||||
|
FHintWindow.HideInterval := FHideInterval;
|
||||||
if FWindowName <> '' then
|
if FWindowName <> '' then
|
||||||
FHintWindow.Name := FWindowName;
|
FHintWindow.Name := FWindowName;
|
||||||
FHintWindow.HideInterval := FHideInterval;
|
|
||||||
end;
|
end;
|
||||||
Result := FHintWindow;
|
Result := FHintWindow;
|
||||||
end;
|
end;
|
||||||
@ -289,7 +293,7 @@ var
|
|||||||
begin
|
begin
|
||||||
if FHtmlHelpProvider = nil then
|
if FHtmlHelpProvider = nil then
|
||||||
begin
|
begin
|
||||||
//Include(FFlags, ihcScrollable); // Debug (memo control does not work)
|
//Include(FFlags, ihcScrollable); // Debug (memo hint control does not work)
|
||||||
HelpControl := CreateIDEHTMLControl(HintWindow, FHtmlHelpProvider, FFlags);
|
HelpControl := CreateIDEHTMLControl(HintWindow, FHtmlHelpProvider, FFlags);
|
||||||
HelpControl.Parent := HintWindow;
|
HelpControl.Parent := HintWindow;
|
||||||
HelpControl.Align := alClient;
|
HelpControl.Align := alClient;
|
||||||
@ -345,6 +349,14 @@ end;
|
|||||||
|
|
||||||
// Setters
|
// Setters
|
||||||
|
|
||||||
|
procedure THintWindowManager.SetAutoHide(AValue: Boolean);
|
||||||
|
begin
|
||||||
|
if FAutoHide = AValue then Exit;
|
||||||
|
FAutoHide := AValue;
|
||||||
|
if Assigned(FHintWindow) then
|
||||||
|
FHintWindow.AutoHide := FAutoHide;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure THintWindowManager.SetHideInterval(AValue: Integer);
|
procedure THintWindowManager.SetHideInterval(AValue: Integer);
|
||||||
begin
|
begin
|
||||||
if FHideInterval = AValue then Exit;
|
if FHideInterval = AValue then Exit;
|
||||||
|
@ -36,8 +36,8 @@ uses
|
|||||||
LCLType, LCLIntf, Controls, ComCtrls, ExtCtrls, LMessages, LResources,
|
LCLType, LCLIntf, Controls, ComCtrls, ExtCtrls, LMessages, LResources,
|
||||||
LazConfigStorage, Menus, Dialogs, Themes, TreeFilterEdit, ObjInspStrConsts,
|
LazConfigStorage, Menus, Dialogs, Themes, TreeFilterEdit, ObjInspStrConsts,
|
||||||
PropEdits, GraphPropEdits, ListViewPropEdit, ImageListEditor,
|
PropEdits, GraphPropEdits, ListViewPropEdit, ImageListEditor,
|
||||||
ComponentTreeView, ComponentEditors, IDEImagesIntf, OIFavoriteProperties,
|
ComponentTreeView, ComponentEditors, IDEImagesIntf, IDEHelpIntf,
|
||||||
PropEditUtils;
|
OIFavoriteProperties, PropEditUtils;
|
||||||
|
|
||||||
const
|
const
|
||||||
OIOptionsFileVersion = 3;
|
OIOptionsFileVersion = 3;
|
||||||
@ -297,7 +297,7 @@ type
|
|||||||
|
|
||||||
// hint stuff
|
// hint stuff
|
||||||
FHintTimer: TTimer;
|
FHintTimer: TTimer;
|
||||||
FHintWindow: THintWindow;
|
FHintManager: THintWindowManager;
|
||||||
FHintIndex: integer;
|
FHintIndex: integer;
|
||||||
FShowingLongHint: boolean; // last hint was activated by the hinttimer
|
FShowingLongHint: boolean; // last hint was activated by the hinttimer
|
||||||
|
|
||||||
@ -856,8 +856,7 @@ end;
|
|||||||
{ TOICustomPropertyGrid }
|
{ TOICustomPropertyGrid }
|
||||||
|
|
||||||
constructor TOICustomPropertyGrid.CreateWithParams(AnOwner:TComponent;
|
constructor TOICustomPropertyGrid.CreateWithParams(AnOwner:TComponent;
|
||||||
APropertyEditorHook:TPropertyEditorHook; TypeFilter:TTypeKinds;
|
APropertyEditorHook:TPropertyEditorHook; TypeFilter:TTypeKinds; DefItemHeight: integer);
|
||||||
DefItemHeight: integer);
|
|
||||||
var
|
var
|
||||||
Details: TThemedElementDetails;
|
Details: TThemedElementDetails;
|
||||||
begin
|
begin
|
||||||
@ -988,6 +987,7 @@ begin
|
|||||||
Parent:=Self;
|
Parent:=Self;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
FHintManager := THintWindowManager.Create(TOIHintWindow);
|
||||||
FActiveRowBmp := CreateBitmapFromResourceName(HInstance, 'pg_active_row');
|
FActiveRowBmp := CreateBitmapFromResourceName(HInstance, 'pg_active_row');
|
||||||
|
|
||||||
if DefItemHeight<3 then
|
if DefItemHeight<3 then
|
||||||
@ -996,10 +996,59 @@ begin
|
|||||||
FDefaultItemHeight:=DefItemHeight;
|
FDefaultItemHeight:=DefItemHeight;
|
||||||
|
|
||||||
BuildPropertyList;
|
BuildPropertyList;
|
||||||
|
|
||||||
Application.AddOnUserInputHandler(@OnUserInput,true);
|
Application.AddOnUserInputHandler(@OnUserInput,true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
constructor TOICustomPropertyGrid.Create(TheOwner: TComponent);
|
||||||
|
begin
|
||||||
|
CreateWithParams(TheOwner,nil,AllTypeKinds,25);
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TOICustomPropertyGrid.Destroy;
|
||||||
|
var
|
||||||
|
a: integer;
|
||||||
|
begin
|
||||||
|
SetIdleEvent(false);
|
||||||
|
Application.RemoveOnUserInputHandler(@OnUserInput);
|
||||||
|
FItemIndex := -1;
|
||||||
|
for a := 0 to FRows.Count - 1 do
|
||||||
|
Rows[a].Free;
|
||||||
|
FreeAndNil(FRows);
|
||||||
|
FreeAndNil(FSelection);
|
||||||
|
FreeAndNil(FNotificationComponents);
|
||||||
|
FreeAndNil(FValueFont);
|
||||||
|
FreeAndNil(FDefaultValueFont);
|
||||||
|
FreeAndNil(FNameFont);
|
||||||
|
FreeAndNil(FHighlightFont);
|
||||||
|
FreeAndNil(FExpandedProperties);
|
||||||
|
FreeAndNil(FHintTimer);
|
||||||
|
FreeAndNil(FHintManager);
|
||||||
|
FreeAndNil(FNewComboBoxItems);
|
||||||
|
FreeAndNil(FActiveRowBmp);
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TOICustomPropertyGrid.InitHints: boolean;
|
||||||
|
begin
|
||||||
|
if not ShowHint then exit(false);
|
||||||
|
|
||||||
|
Result := true;
|
||||||
|
if FHintTimer = nil then
|
||||||
|
begin
|
||||||
|
FHintIndex := -1;
|
||||||
|
FShowingLongHint := False;
|
||||||
|
FHintTimer := TTimer.Create(nil);
|
||||||
|
FHintTimer.Interval := 500;
|
||||||
|
FHintTimer.Enabled := False;
|
||||||
|
FHintTimer.OnTimer := @HintTimer;
|
||||||
|
|
||||||
|
TOIHintWindow(FHintManager.HintWindow).OnMouseDown := @HintMouseDown;
|
||||||
|
FHintManager.WindowName := 'This_is_a_hint_window';
|
||||||
|
FHintManager.HideInterval := 4000;
|
||||||
|
FHintManager.AutoHide := True;
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TOICustomPropertyGrid.UpdateScrollBar;
|
procedure TOICustomPropertyGrid.UpdateScrollBar;
|
||||||
var
|
var
|
||||||
ScrollInfo: TScrollInfo;
|
ScrollInfo: TScrollInfo;
|
||||||
@ -1133,54 +1182,6 @@ begin
|
|||||||
Message.Result := 1;
|
Message.Result := 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TOICustomPropertyGrid.Destroy;
|
|
||||||
var
|
|
||||||
a: integer;
|
|
||||||
begin
|
|
||||||
SetIdleEvent(false);
|
|
||||||
Application.RemoveOnUserInputHandler(@OnUserInput);
|
|
||||||
FItemIndex := -1;
|
|
||||||
for a := 0 to FRows.Count - 1 do
|
|
||||||
Rows[a].Free;
|
|
||||||
FreeAndNil(FRows);
|
|
||||||
FreeAndNil(FSelection);
|
|
||||||
FreeAndNil(FNotificationComponents);
|
|
||||||
FreeAndNil(FValueFont);
|
|
||||||
FreeAndNil(FDefaultValueFont);
|
|
||||||
FreeAndNil(FNameFont);
|
|
||||||
FreeAndNil(FHighlightFont);
|
|
||||||
FreeAndNil(FExpandedProperties);
|
|
||||||
FreeAndNil(FHintTimer);
|
|
||||||
FreeAndNil(FHintWindow);
|
|
||||||
FreeAndNil(FNewComboBoxItems);
|
|
||||||
FreeAndNil(FActiveRowBmp);
|
|
||||||
inherited Destroy;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TOICustomPropertyGrid.InitHints: boolean;
|
|
||||||
begin
|
|
||||||
if not ShowHint then exit(false);
|
|
||||||
|
|
||||||
Result := true;
|
|
||||||
if FHintTimer = nil then
|
|
||||||
begin
|
|
||||||
FHintIndex := -1;
|
|
||||||
FShowingLongHint := False;
|
|
||||||
FHintTimer := TTimer.Create(nil);
|
|
||||||
FHintTimer.Interval := 500;
|
|
||||||
FHintTimer.Enabled := False;
|
|
||||||
FHintTimer.OnTimer := @HintTimer;
|
|
||||||
|
|
||||||
FHintWindow := TOIHintWindow.Create(Self);
|
|
||||||
|
|
||||||
TOIHintWindow(FHintWindow).OnMouseDown := @HintMouseDown;
|
|
||||||
FHIntWindow.Visible := False;
|
|
||||||
FHintWindow.Caption := 'This is a hint window'+LineEnding+'Neat huh?';
|
|
||||||
FHintWindow.HideInterval := 4000;
|
|
||||||
FHintWindow.AutoHide := True;
|
|
||||||
end
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TOICustomPropertyGrid.IsCurrentEditorAvailable: Boolean;
|
function TOICustomPropertyGrid.IsCurrentEditorAvailable: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := (FCurrentEdit <> nil) and InRange(FItemIndex, 0, FRows.Count - 1);
|
Result := (FCurrentEdit <> nil) and InRange(FItemIndex, 0, FRows.Count - 1);
|
||||||
@ -2156,13 +2157,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOICustomPropertyGrid.MouseMove(Shift:TShiftState; X,Y:integer);
|
procedure TOICustomPropertyGrid.MouseMove(Shift:TShiftState; X,Y:integer);
|
||||||
|
var
|
||||||
|
TheHint: String;
|
||||||
|
|
||||||
|
procedure DoShow(pt: TPoint); inline;
|
||||||
|
begin
|
||||||
|
FHintManager.ShowHint(ClientToScreen(pt), TheHint);
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
SplitDistance:integer;
|
SplitDistance:integer;
|
||||||
Index: Integer;
|
Index, Brd: Integer;
|
||||||
fPropRow: TOIPropertyGridRow;
|
fPropRow: TOIPropertyGridRow;
|
||||||
fHint: String;
|
|
||||||
fpoint: TPoint;
|
|
||||||
fHintRect: TRect;
|
|
||||||
begin
|
begin
|
||||||
inherited MouseMove(Shift,X,Y);
|
inherited MouseMove(Shift,X,Y);
|
||||||
SplitDistance:=X-SplitterX;
|
SplitDistance:=X-SplitterX;
|
||||||
@ -2173,8 +2179,7 @@ begin
|
|||||||
EndDragSplitter;
|
EndDragSplitter;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else
|
else begin
|
||||||
begin
|
|
||||||
if (abs(SplitDistance)<=2) then begin
|
if (abs(SplitDistance)<=2) then begin
|
||||||
Cursor:=crHSplit;
|
Cursor:=crHSplit;
|
||||||
end else begin
|
end else begin
|
||||||
@ -2189,46 +2194,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// to check if the property text fits in its box, if not show a hint
|
// to check if the property text fits in its box, if not show a hint
|
||||||
if ShowHint then
|
if not (ShowHint and InitHints) then Exit;
|
||||||
|
Index := MouseToIndex(y,false);
|
||||||
|
if (Index = -1) or FShowingLongHint
|
||||||
|
or ( FHintManager.HintIsVisible and (Index = FHintIndex) ) then Exit;
|
||||||
|
FHintIndex:=Index;
|
||||||
|
fPropRow := GetRow(Index);
|
||||||
|
if X < SplitterX then
|
||||||
begin
|
begin
|
||||||
Index := MouseToIndex(y,false);
|
// Mouse is over property name...
|
||||||
if (Index > -1)
|
TheHint := fPropRow.Name;
|
||||||
and (not FShowingLongHint)
|
Brd := BorderWidth + GetTreeIconX(Index) + Indent;
|
||||||
and ((FHintWindow=nil) or (not FHintWindow.Visible) or (Index<>FHintIndex))
|
if (Canvas.TextWidth(TheHint) + Brd) >= SplitterX then
|
||||||
then begin
|
DoShow(Point(Brd, fPropRow.Top-TopY-1));
|
||||||
FHintIndex:=Index;
|
end
|
||||||
FShowingLongHint:=false;
|
else begin
|
||||||
fPropRow := GetRow(Index);
|
// Mouse is over property value...
|
||||||
if X < SplitterX then
|
TheHint := fPropRow.LastPaintedValue;
|
||||||
begin
|
if length(TheHint) > 100 then
|
||||||
// Mouse is over property name...
|
TheHint := copy(TheHint, 1, 100) + '...';
|
||||||
fHint := fPropRow.Name;
|
if Canvas.TextWidth(TheHint) > (ClientWidth - BorderWidth - SplitterX) then
|
||||||
if InitHints
|
DoShow(Point(SplitterX, fPropRow.Top-TopY-1));
|
||||||
and ((Canvas.TextWidth(fHint) + BorderWidth + GetTreeIconX(Index) + Indent) >= SplitterX) then
|
|
||||||
begin
|
|
||||||
fHintRect := FHintWindow.CalcHintRect(0,fHint,nil);
|
|
||||||
fPoint := ClientToScreen(Point(BorderWidth+GetTreeIconX(Index)+Indent,
|
|
||||||
fPropRow.Top - TopY-1));
|
|
||||||
MoveRect(fHintRect,fPoint.x,fPoint.y);
|
|
||||||
FHintWindow.ActivateHint(fHintRect,fHint);
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
// Mouse is over property value...
|
|
||||||
fHint := fPropRow.LastPaintedValue;
|
|
||||||
if length(fHint) > 100 then
|
|
||||||
fHint := copy(fHint, 1, 100) + '...';
|
|
||||||
if InitHints
|
|
||||||
and (Canvas.TextWidth(fHint) > (ClientWidth - BorderWidth - SplitterX)) then
|
|
||||||
begin
|
|
||||||
fHintRect := FHintWindow.CalcHintRect(0,fHint,nil);
|
|
||||||
fpoint := ClientToScreen(Point(SplitterX, fPropRow.Top - TopY - 1));
|
|
||||||
MoveRect(fHintRect, fPoint.x, fPoint.y);
|
|
||||||
FHintWindow.ActivateHint(fHintRect, fHint);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -2247,9 +2233,7 @@ begin
|
|||||||
inherited KeyDown(Key, Shift);
|
inherited KeyDown(Key, Shift);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOICustomPropertyGrid.HandleStandardKeys(
|
procedure TOICustomPropertyGrid.HandleStandardKeys(var Key: Word; Shift: TShiftState);
|
||||||
var Key: Word; Shift: TShiftState);
|
|
||||||
|
|
||||||
var
|
var
|
||||||
Handled: Boolean;
|
Handled: Boolean;
|
||||||
|
|
||||||
@ -2402,8 +2386,7 @@ begin
|
|||||||
FKeySearchText := '';
|
FKeySearchText := '';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TOICustomPropertyGrid.EditorFilter(
|
function TOICustomPropertyGrid.EditorFilter(const AEditor: TPropertyEditor): Boolean;
|
||||||
const AEditor: TPropertyEditor): Boolean;
|
|
||||||
begin
|
begin
|
||||||
Result := IsInteresting(AEditor, FFilter);
|
Result := IsInteresting(AEditor, FFilter);
|
||||||
if Result and Assigned(OnEditorFilter) then
|
if Result and Assigned(OnEditorFilter) then
|
||||||
@ -2427,11 +2410,6 @@ begin
|
|||||||
OnSelectionChange(Self);
|
OnSelectionChange(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TOICustomPropertyGrid.Create(TheOwner: TComponent);
|
|
||||||
begin
|
|
||||||
CreateWithParams(TheOwner,nil,AllTypeKinds,25);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TOICustomPropertyGrid.OnUserInput(Sender: TObject; Msg: Cardinal);
|
procedure TOICustomPropertyGrid.OnUserInput(Sender: TObject; Msg: Cardinal);
|
||||||
begin
|
begin
|
||||||
ResetHintTimer;
|
ResetHintTimer;
|
||||||
@ -2442,8 +2420,10 @@ procedure TOICustomPropertyGrid.HintMouseDown(Sender: TObject;
|
|||||||
var
|
var
|
||||||
pos: TPoint;
|
pos: TPoint;
|
||||||
begin
|
begin
|
||||||
pos := ScreenToClient(FHintWindow.ClientToScreen(Point(X, Y)));
|
if FHintManager.HintIsVisible then begin
|
||||||
MouseDown(Button, Shift, pos.X, pos.Y);
|
pos := ScreenToClient(FHintManager.HintWindow.ClientToScreen(Point(X, Y)));
|
||||||
|
MouseDown(Button, Shift, pos.X, pos.Y);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOICustomPropertyGrid.EndDragSplitter;
|
procedure TOICustomPropertyGrid.EndDragSplitter;
|
||||||
@ -3236,11 +3216,31 @@ end;
|
|||||||
|
|
||||||
procedure TOICustomPropertyGrid.HintTimer(Sender: TObject);
|
procedure TOICustomPropertyGrid.HintTimer(Sender: TObject);
|
||||||
var
|
var
|
||||||
HintRect : TRect;
|
|
||||||
AHint : String;
|
|
||||||
Position : TPoint;
|
Position : TPoint;
|
||||||
Index: integer;
|
Index: integer;
|
||||||
PointedRow:TOIpropertyGridRow;
|
PointedRow: TOIpropertyGridRow;
|
||||||
|
|
||||||
|
procedure HintByHandler;
|
||||||
|
var
|
||||||
|
AHint: String;
|
||||||
|
HintRect : TRect;
|
||||||
|
begin
|
||||||
|
if OnPropertyHint(Self, PointedRow, Position, FHintManager.HintWindow, HintRect, AHint)
|
||||||
|
then begin
|
||||||
|
FHintIndex := Index;
|
||||||
|
FShowingLongHint := True;
|
||||||
|
FHintManager.ShowHint(Position, AHint);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure HintByEditor(AHint: String);
|
||||||
|
begin
|
||||||
|
FHintIndex := Index;
|
||||||
|
FShowingLongHint := True;
|
||||||
|
FHintManager.ShowHint(Position, AHint);
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
Window: TWinControl;
|
Window: TWinControl;
|
||||||
HintType: TPropEditHint;
|
HintType: TPropEditHint;
|
||||||
ClientPosition: TPoint;
|
ClientPosition: TPoint;
|
||||||
@ -3250,62 +3250,31 @@ begin
|
|||||||
if (not InitHints) then exit;
|
if (not InitHints) then exit;
|
||||||
|
|
||||||
Position := Mouse.CursorPos;
|
Position := Mouse.CursorPos;
|
||||||
|
|
||||||
Window := FindLCLWindow(Position);
|
Window := FindLCLWindow(Position);
|
||||||
if not Assigned(Window) then Exit;
|
If (Window = Nil) or ((Window <> Self) and not IsParentOf(Window)) then exit;
|
||||||
If (Window <> Self) and (not IsParentOf(Window)) then exit;
|
|
||||||
|
|
||||||
ClientPosition := ScreenToClient(Position);
|
ClientPosition := ScreenToClient(Position);
|
||||||
if ((ClientPosition.X <=0) or (ClientPosition.X >= Width) or
|
if ((ClientPosition.X <=0) or (ClientPosition.X >= Width) or
|
||||||
(ClientPosition.Y <= 0) or (ClientPosition.Y >= Height)) then
|
(ClientPosition.Y <= 0) or (ClientPosition.Y >= Height)) then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
AHint := '';
|
|
||||||
Index := MouseToIndex(ClientPosition.Y, False);
|
Index := MouseToIndex(ClientPosition.Y, False);
|
||||||
if (Index >= 0) and (Index < FRows.Count) then
|
if (Index < 0) or (Index >= FRows.Count) then Exit;
|
||||||
begin
|
PointedRow := Rows[Index];
|
||||||
//IconX:=GetTreeIconX(Index);
|
if (PointedRow = Nil) or (PointedRow.Editor = Nil)
|
||||||
PointedRow := Rows[Index];
|
or (Index = ItemIndex) then Exit; // Don't show hint for the selected property.
|
||||||
if Assigned(PointedRow) and Assigned(PointedRow.Editor) then
|
|
||||||
begin
|
|
||||||
if Index <> ItemIndex then
|
|
||||||
begin
|
|
||||||
HintType := GetHintTypeAt(Index,Position.X);
|
|
||||||
if (HintType = pehName) and Assigned(OnPropertyHint) then
|
|
||||||
begin
|
|
||||||
if OnPropertyHint(Self, PointedRow, Position, FHintWindow, HintRect, AHint)
|
|
||||||
then begin
|
|
||||||
FHintIndex := Index;
|
|
||||||
FShowingLongHint := True;
|
|
||||||
//DebugLn(['TOICustomPropertyGrid.HintTimer ',dbgs(HintRect),' ',AHint,' ',dbgs(Position)]);
|
|
||||||
FHintWindow.ActivateHint(HintRect, AHint);
|
|
||||||
end;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
AHint := PointedRow.Editor.GetHint(HintType, Position.X, Position.Y);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
if AHint = '' then Exit;
|
HintType := GetHintTypeAt(Index, Position.X);
|
||||||
FHintIndex := Index;
|
if (HintType = pehName) and Assigned(OnPropertyHint) then
|
||||||
FShowingLongHint := True;
|
HintByHandler
|
||||||
HintRect := FHintWindow.CalcHintRect(0, AHint, nil); //no maxwidth
|
else
|
||||||
HintRect.Left := Position.X + 10;
|
HintByEditor(PointedRow.Editor.GetHint(HintType, Position.X, Position.Y));
|
||||||
HintRect.Top := Position.Y + 10;
|
|
||||||
HintRect.Right := HintRect.Left + HintRect.Right + 3;
|
|
||||||
HintRect.Bottom := HintRect.Top + HintRect.Bottom + 3;
|
|
||||||
//DebugLn(['TOICustomPropertyGrid.HintTimer ',dbgs(Rect),' ',AHint,' ',dbgs(Position)]);
|
|
||||||
|
|
||||||
FHintWindow.ActivateHint(HintRect, AHint);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOICustomPropertyGrid.ResetHintTimer;
|
procedure TOICustomPropertyGrid.ResetHintTimer;
|
||||||
begin
|
begin
|
||||||
if FHintWindow = nil then exit;
|
|
||||||
|
|
||||||
HideHint;
|
HideHint;
|
||||||
|
if FHintTimer = Nil then Exit;
|
||||||
FHintTimer.Enabled := False;
|
FHintTimer.Enabled := False;
|
||||||
if RowCount > 0 then
|
if RowCount > 0 then
|
||||||
FHintTimer.Enabled := not FDragging;
|
FHintTimer.Enabled := not FDragging;
|
||||||
@ -3313,12 +3282,9 @@ end;
|
|||||||
|
|
||||||
procedure TOICustomPropertyGrid.HideHint;
|
procedure TOICustomPropertyGrid.HideHint;
|
||||||
begin
|
begin
|
||||||
if FHintWindow = nil then Exit;
|
|
||||||
FHintIndex := -1;
|
FHintIndex := -1;
|
||||||
FShowingLongHint := False;
|
FShowingLongHint := False;
|
||||||
FHintWindow.Visible := False;
|
FHintManager.HideHint;
|
||||||
Assert(FHintWindow.ControlCount <= 1,
|
|
||||||
'TOICustomPropertyGrid.HideHint: FHintWindow.ControlCount = '+IntToStr(FHintWindow.ControlCount));
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOICustomPropertyGrid.ValueControlMouseDown(Sender : TObject;
|
procedure TOICustomPropertyGrid.ValueControlMouseDown(Sender : TObject;
|
||||||
|
@ -224,7 +224,7 @@ type
|
|||||||
procedure ShowHelpForIDEControl(Sender: TControl); override;
|
procedure ShowHelpForIDEControl(Sender: TControl); override;
|
||||||
function CreateHint(aHintWindow: THintWindow; ScreenPos: TPoint;
|
function CreateHint(aHintWindow: THintWindow; ScreenPos: TPoint;
|
||||||
const BaseURL: string; var TheHint: string; out HintWinRect: TRect): boolean;
|
const BaseURL: string; var TheHint: string; out HintWinRect: TRect): boolean;
|
||||||
override; deprecated;
|
override; deprecated 'Use THintWindowManager class instead';
|
||||||
function GetHintForSourcePosition(const ExpandedFilename: string;
|
function GetHintForSourcePosition(const ExpandedFilename: string;
|
||||||
const CodePos: TPoint; out BaseURL, HTMLHint: string;
|
const CodePos: TPoint; out BaseURL, HTMLHint: string;
|
||||||
Flags: TIDEHelpManagerCreateHintFlags = []): TShowHelpResult; override;
|
Flags: TIDEHelpManagerCreateHintFlags = []): TShowHelpResult; override;
|
||||||
@ -1689,12 +1689,6 @@ var
|
|||||||
ms: TMemoryStream;
|
ms: TMemoryStream;
|
||||||
NewWidth, NewHeight: integer;
|
NewWidth, NewHeight: integer;
|
||||||
begin
|
begin
|
||||||
// This test is needed because each editor SourceNotebook have their own HintWindow.
|
|
||||||
// ToDo: Make HintWindow common to all SourceNotebooks.
|
|
||||||
if aHintWindow <> FHintWindow then begin
|
|
||||||
FHtmlHelpProvider := nil;
|
|
||||||
FHintWindow := aHintWindow;
|
|
||||||
end;
|
|
||||||
if CompareText(copy(TheHint,1,6),'<HTML>')=0 then begin // Text is HTML
|
if CompareText(copy(TheHint,1,6),'<HTML>')=0 then begin // Text is HTML
|
||||||
ms:=TMemoryStream.Create;
|
ms:=TMemoryStream.Create;
|
||||||
try
|
try
|
||||||
@ -1812,6 +1806,9 @@ function TIDEHintWindowManager.SenderIsHintControl(Sender: TObject): Boolean;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
if Assigned(FHintWindow) then
|
||||||
|
Assert(FHintWindow.ControlCount < 2,
|
||||||
|
'SenderIsHintControl: ControlCount = ' + IntToStr(FHintWindow.ControlCount));
|
||||||
Result := Assigned(Sender) and Assigned(FHintWindow) and IsHintControl(FHintWindow);
|
Result := Assigned(Sender) and Assigned(FHintWindow) and IsHintControl(FHintWindow);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
19
ide/main.pp
19
ide/main.pp
@ -1824,25 +1824,18 @@ begin
|
|||||||
Result:=false;
|
Result:=false;
|
||||||
AHint:='';
|
AHint:='';
|
||||||
HintWinRect:=Rect(0,0,0,0);
|
HintWinRect:=Rect(0,0,0,0);
|
||||||
if ObjectInspector1=nil then exit;
|
if (ObjectInspector1=nil) or not BeginCodeTools then exit;
|
||||||
if not BeginCodeTools then exit;
|
Result:=FindDeclarationOfOIProperty(ObjectInspector1,PointedRow,Code,Caret,NewTopLine)
|
||||||
if FindDeclarationOfOIProperty(ObjectInspector1,PointedRow,Code,Caret,NewTopLine)
|
and (TIDEHelpManager(HelpBoss).GetHintForSourcePosition(Code.Filename,Caret,
|
||||||
then begin
|
BaseURL,aHint)=shrSuccess);
|
||||||
if TIDEHelpManager(HelpBoss).GetHintForSourcePosition(Code.Filename,
|
|
||||||
Caret,BaseURL,aHint)=shrSuccess
|
|
||||||
then begin
|
|
||||||
Result:=HelpBoss.CreateHint(aHintWindow,ScreenPos,BaseURL,aHint,HintWinRect);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.OIOnUpdateRestricted(Sender: TObject);
|
procedure TMainIDE.OIOnUpdateRestricted(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if Sender = nil then Sender := ObjectInspector1;
|
if Sender = nil then
|
||||||
|
Sender := ObjectInspector1;
|
||||||
if Sender is TObjectInspectorDlg then
|
if Sender is TObjectInspectorDlg then
|
||||||
begin
|
|
||||||
(Sender as TObjectInspectorDlg).RestrictedProps := GetRestrictedProperties;
|
(Sender as TObjectInspectorDlg).RestrictedProps := GetRestrictedProperties;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.OnPropHookGetMethodName(const Method: TMethod;
|
function TMainIDE.OnPropHookGetMethodName(const Method: TMethod;
|
||||||
|
Loading…
Reference in New Issue
Block a user