mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 14:49:48 +02:00
IDE+object inspector: shwoing code help hints for properties
git-svn-id: trunk@17478 -
This commit is contained in:
parent
7c665e0d4c
commit
04b8a93513
@ -74,6 +74,7 @@ function FindDeclarationOfOIProperty(AnInspector: TObjectInspectorDlg;
|
|||||||
Row: TOIPropertyGridRow; out Code: TCodeBuffer; out Caret: TPoint;
|
Row: TOIPropertyGridRow; out Code: TCodeBuffer; out Caret: TPoint;
|
||||||
out NewTopLine: integer): Boolean;
|
out NewTopLine: integer): Boolean;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
function CreateDefaultOIFavouriteProperties: TOIFavouriteProperties;
|
function CreateDefaultOIFavouriteProperties: TOIFavouriteProperties;
|
||||||
|
@ -163,6 +163,9 @@ type
|
|||||||
var ErrMsg: string): TShowHelpResult; override;
|
var ErrMsg: string): TShowHelpResult; override;
|
||||||
procedure ShowHelpForMessage(Line: integer); override;
|
procedure ShowHelpForMessage(Line: integer); override;
|
||||||
procedure ShowHelpForObjectInspector(Sender: TObject); override;
|
procedure ShowHelpForObjectInspector(Sender: TObject); override;
|
||||||
|
function CreateHint(aHintWindow: THintWindow; ScreenPos: TPoint;
|
||||||
|
const BaseURL: string; var TheHint: string;
|
||||||
|
out HintWinRect: TRect): boolean; override;
|
||||||
function GetHintForSourcePosition(const ExpandedFilename: string;
|
function GetHintForSourcePosition(const ExpandedFilename: string;
|
||||||
const CodePos: TPoint;
|
const CodePos: TPoint;
|
||||||
out BaseURL, HTMLHint: string): TShowHelpResult;
|
out BaseURL, HTMLHint: string): TShowHelpResult;
|
||||||
@ -1245,6 +1248,50 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TIDEHelpManager.CreateHint(aHintWindow: THintWindow; ScreenPos: TPoint;
|
||||||
|
const BaseURL: string; var TheHint: string; out HintWinRect: TRect): boolean;
|
||||||
|
var
|
||||||
|
IsHTML: Boolean;
|
||||||
|
Provider: TAbstractIDEHTMLProvider;
|
||||||
|
HTMLControl: TControl;
|
||||||
|
ms: TMemoryStream;
|
||||||
|
NewWidth, NewHeight: integer;
|
||||||
|
begin
|
||||||
|
IsHTML:=SysUtils.CompareText(copy(TheHint,1,6),'<HTML>')=0;
|
||||||
|
|
||||||
|
if aHintWindow.ControlCount>0 then begin
|
||||||
|
aHintWindow.Controls[0].Free;
|
||||||
|
end;
|
||||||
|
if IsHTML then begin
|
||||||
|
Provider:=nil;
|
||||||
|
HTMLControl:=CreateIDEHTMLControl(aHintWindow,Provider);
|
||||||
|
Provider.BaseURL:=BaseURL;
|
||||||
|
HTMLControl.Parent:=aHintWindow;
|
||||||
|
HTMLControl.Align:=alClient;
|
||||||
|
ms:=TMemoryStream.Create;
|
||||||
|
try
|
||||||
|
if TheHint<>'' then
|
||||||
|
ms.Write(TheHint[1],length(TheHint));
|
||||||
|
ms.Position:=0;
|
||||||
|
Provider.ControlIntf.SetHTMLContent(ms);
|
||||||
|
finally
|
||||||
|
ms.Free;
|
||||||
|
end;
|
||||||
|
Provider.ControlIntf.GetPreferredControlSize(NewWidth,NewHeight);
|
||||||
|
if NewWidth<=0 then
|
||||||
|
NewWidth:=500;
|
||||||
|
if NewHeight<=0 then
|
||||||
|
NewHeight:=200;
|
||||||
|
HintWinRect := Rect(0,0,NewWidth,NewHeight);
|
||||||
|
TheHint:='';
|
||||||
|
end else begin
|
||||||
|
HintWinRect := aHintWindow.CalcHintRect(Screen.Width, TheHint, nil);
|
||||||
|
end;
|
||||||
|
OffsetRect(HintWinRect, ScreenPos.X, ScreenPos.Y+30);
|
||||||
|
|
||||||
|
Result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
function TIDEHelpManager.GetHintForSourcePosition(const ExpandedFilename: string;
|
function TIDEHelpManager.GetHintForSourcePosition(const ExpandedFilename: string;
|
||||||
const CodePos: TPoint; out BaseURL, HTMLHint: string): TShowHelpResult;
|
const CodePos: TPoint; out BaseURL, HTMLHint: string): TShowHelpResult;
|
||||||
var
|
var
|
||||||
|
83
ide/main.pp
83
ide/main.pp
@ -75,7 +75,7 @@ uses
|
|||||||
// lcl
|
// lcl
|
||||||
LCLProc, LCLMemManager, LCLType, LCLIntf, LConvEncoding, LMessages,
|
LCLProc, LCLMemManager, LCLType, LCLIntf, LConvEncoding, LMessages,
|
||||||
LResources, StdCtrls, Forms, Buttons, Menus, FileUtil, Controls, GraphType,
|
LResources, StdCtrls, Forms, Buttons, Menus, FileUtil, Controls, GraphType,
|
||||||
Graphics, ExtCtrls, Dialogs, InterfaceBase, LDockCtrl,
|
HelpIntfs, Graphics, ExtCtrls, Dialogs, InterfaceBase, LDockCtrl,
|
||||||
// codetools
|
// codetools
|
||||||
LinkScanner, BasicCodeTools, AVL_Tree, Laz_XMLCfg,
|
LinkScanner, BasicCodeTools, AVL_Tree, Laz_XMLCfg,
|
||||||
CodeToolsStructs, CodeToolManager, CodeCache, DefineTemplates,
|
CodeToolsStructs, CodeToolManager, CodeCache, DefineTemplates,
|
||||||
@ -83,8 +83,8 @@ uses
|
|||||||
SynEditKeyCmds,
|
SynEditKeyCmds,
|
||||||
// IDE interface
|
// IDE interface
|
||||||
AllIDEIntf, BaseIDEIntf, ObjectInspector, PropEdits, MacroIntf, IDECommands,
|
AllIDEIntf, BaseIDEIntf, ObjectInspector, PropEdits, MacroIntf, IDECommands,
|
||||||
SrcEditorIntf, NewItemIntf, IDEExternToolIntf, IDEMsgIntf, PackageIntf,
|
SrcEditorIntf, NewItemIntf, IDEExternToolIntf, IDEMsgIntf,
|
||||||
ProjectIntf, MenuIntf, LazIDEIntf, IDEDialogs,
|
PackageIntf, ProjectIntf, MenuIntf, LazIDEIntf, IDEDialogs,
|
||||||
// protocol
|
// protocol
|
||||||
IDEProtocol,
|
IDEProtocol,
|
||||||
// compile
|
// compile
|
||||||
@ -390,8 +390,11 @@ type
|
|||||||
procedure OIOnAddToFavourites(Sender: TObject);
|
procedure OIOnAddToFavourites(Sender: TObject);
|
||||||
procedure OIOnRemoveFromFavourites(Sender: TObject);
|
procedure OIOnRemoveFromFavourites(Sender: TObject);
|
||||||
procedure OIOnFindDeclarationOfProperty(Sender: TObject);
|
procedure OIOnFindDeclarationOfProperty(Sender: TObject);
|
||||||
procedure OIOnUpdateRestricted(Sender: TObject);
|
|
||||||
procedure OIOnSelectionChange(Sender: TObject);
|
procedure OIOnSelectionChange(Sender: TObject);
|
||||||
|
function OIOnPropertyHint(Sender: TObject; PointedRow: TOIPropertyGridRow;
|
||||||
|
ScreenPos: TPoint; aHintWindow: THintWindow;
|
||||||
|
out HintWinRect: TRect; out AHint: string): boolean;
|
||||||
|
procedure OIOnUpdateRestricted(Sender: TObject);
|
||||||
function OnPropHookGetMethodName(const Method: TMethod;
|
function OnPropHookGetMethodName(const Method: TMethod;
|
||||||
PropOwner: TObject): String;
|
PropOwner: TObject): String;
|
||||||
procedure OnPropHookGetMethods(TypeData: PTypeData; Proc:TGetStringProc);
|
procedure OnPropHookGetMethods(TypeData: PTypeData; Proc:TGetStringProc);
|
||||||
@ -1380,6 +1383,34 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainIDE.OIOnSelectionChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
// handled by property hook
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TMainIDE.OIOnPropertyHint(Sender: TObject;
|
||||||
|
PointedRow: TOIPropertyGridRow; ScreenPos: TPoint; aHintWindow: THintWindow;
|
||||||
|
out HintWinRect: TRect; out AHint: string): boolean;
|
||||||
|
var
|
||||||
|
Code: TCodeBuffer;
|
||||||
|
Caret: TPoint;
|
||||||
|
NewTopLine: integer;
|
||||||
|
BaseURL: string;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
AHint:='';
|
||||||
|
HintWinRect:=Rect(0,0,0,0);
|
||||||
|
if not BeginCodeTools then exit;
|
||||||
|
if FindDeclarationOfOIProperty(ObjectInspector1,PointedRow,Code,Caret,NewTopLine)
|
||||||
|
then begin
|
||||||
|
if TIDEHelpManager(HelpBoss).GetHintForSourcePosition(Code.Filename,
|
||||||
|
Caret,BaseURL,aHint)=shrSuccess
|
||||||
|
then begin
|
||||||
|
Result:=HelpBoss.CreateHint(aHintWindow,ScreenPos,BaseURL,aHint,HintWinRect);
|
||||||
|
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;
|
||||||
@ -1389,49 +1420,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.OIOnSelectionChange(Sender: TObject);
|
|
||||||
var
|
|
||||||
OI: TObjectInspectorDlg absolute Sender;
|
|
||||||
Row: TOIPropertyGridRow;
|
|
||||||
Code: TCodeBuffer;
|
|
||||||
Caret: TPoint;
|
|
||||||
NewTopLine: integer;
|
|
||||||
BaseURL, HTMLHint: String;
|
|
||||||
CacheWasUsed: Boolean;
|
|
||||||
Stream: TStringStream;
|
|
||||||
begin
|
|
||||||
if (Sender is TObjectInspectorDlg) then
|
|
||||||
begin
|
|
||||||
if OI.ShowInfoBox then
|
|
||||||
begin
|
|
||||||
Row := OI.GetActivePropertyRow;
|
|
||||||
Stream := nil;
|
|
||||||
if (Row <> nil) and FindDeclarationOfOIProperty(OI, Row, Code, Caret, NewTopLine) then
|
|
||||||
begin
|
|
||||||
if CodeHelpBoss.GetHTMLHint(Code, Caret.X, Caret.Y, True, BaseURL, HTMLHint, CacheWasUsed) = chprSuccess then
|
|
||||||
begin
|
|
||||||
FOIHelpProvider.BaseURL := BaseURL;
|
|
||||||
Stream := TStringStream.Create(HTMLHint);
|
|
||||||
try
|
|
||||||
FOIHelpProvider.ControlIntf.SetHTMLContent(Stream);
|
|
||||||
finally
|
|
||||||
Stream.Free;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
if Stream = nil then
|
|
||||||
begin
|
|
||||||
Stream := TStringStream.Create('');
|
|
||||||
try
|
|
||||||
FOIHelpProvider.ControlIntf.SetHTMLContent(Stream);
|
|
||||||
finally
|
|
||||||
Stream.Free;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TMainIDE.OnPropHookGetMethodName(const Method: TMethod;
|
function TMainIDE.OnPropHookGetMethodName(const Method: TMethod;
|
||||||
PropOwner: TObject): String;
|
PropOwner: TObject): String;
|
||||||
var
|
var
|
||||||
@ -1694,6 +1682,7 @@ begin
|
|||||||
ObjectInspector1.OnShowOptions:=@OIOnShowOptions;
|
ObjectInspector1.OnShowOptions:=@OIOnShowOptions;
|
||||||
ObjectInspector1.OnViewRestricted:=@OIOnViewRestricted;
|
ObjectInspector1.OnViewRestricted:=@OIOnViewRestricted;
|
||||||
ObjectInspector1.OnSelectionChange:=@OIOnSelectionChange;
|
ObjectInspector1.OnSelectionChange:=@OIOnSelectionChange;
|
||||||
|
ObjectInspector1.OnPropertyHint:=@OIOnPropertyHint;
|
||||||
ObjectInspector1.OnDestroy:=@OIOnDestroy;
|
ObjectInspector1.OnDestroy:=@OIOnDestroy;
|
||||||
HelpControl := CreateIDEHTMLControl(ObjectInspector1, FOIHelpProvider);
|
HelpControl := CreateIDEHTMLControl(ObjectInspector1, FOIHelpProvider);
|
||||||
HelpControl.Parent := ObjectInspector1.InfoPanel;
|
HelpControl.Parent := ObjectInspector1.InfoPanel;
|
||||||
|
@ -5089,51 +5089,16 @@ procedure TSourceNotebook.ActivateHint(const ScreenPos: TPoint;
|
|||||||
const BaseURL, TheHint: string);
|
const BaseURL, TheHint: string);
|
||||||
var
|
var
|
||||||
HintWinRect: TRect;
|
HintWinRect: TRect;
|
||||||
IsHTML: Boolean;
|
AHint: String;
|
||||||
Provider: TAbstractIDEHTMLProvider;
|
|
||||||
HTMLControl: TControl;
|
|
||||||
ms: TMemoryStream;
|
|
||||||
NewWidth, NewHeight: integer;
|
|
||||||
begin
|
begin
|
||||||
if csDestroying in ComponentState then exit;
|
if csDestroying in ComponentState then exit;
|
||||||
if FHintWindow<>nil then
|
if FHintWindow<>nil then
|
||||||
FHintWindow.Visible:=false;
|
FHintWindow.Visible:=false;
|
||||||
if FHintWindow=nil then
|
if FHintWindow=nil then
|
||||||
FHintWindow:=THintWindow.Create(Self);
|
FHintWindow:=THintWindow.Create(Self);
|
||||||
IsHTML:=SysUtils.CompareText(copy(TheHint,1,6),'<HTML>')=0;
|
AHint:=TheHint;
|
||||||
//DebugLn(['TSourceNotebook.ActivateHint IsHTML=',IsHTML,' TheHint=',TheHint]);
|
if LazarusHelp.CreateHint(FHintWindow,ScreenPos,BaseURL,AHint,HintWinRect) then
|
||||||
if FHintWindow.ControlCount>0 then begin
|
FHintWindow.ActivateHint(HintWinRect,aHint);
|
||||||
//DebugLn(['TSourceNotebook.ActivateHint ',dbgsName(FHintWindow.Controls[0])]);
|
|
||||||
FHintWindow.Controls[0].Free;
|
|
||||||
end;
|
|
||||||
if IsHTML then begin
|
|
||||||
Provider:=nil;
|
|
||||||
HTMLControl:=CreateIDEHTMLControl(FHintWindow,Provider);
|
|
||||||
Provider.BaseURL:=BaseURL;
|
|
||||||
HTMLControl.Parent:=FHintWindow;
|
|
||||||
HTMLControl.Align:=alClient;
|
|
||||||
ms:=TMemoryStream.Create;
|
|
||||||
try
|
|
||||||
if TheHint<>'' then
|
|
||||||
ms.Write(TheHint[1],length(TheHint));
|
|
||||||
ms.Position:=0;
|
|
||||||
Provider.ControlIntf.SetHTMLContent(ms);
|
|
||||||
finally
|
|
||||||
ms.Free;
|
|
||||||
end;
|
|
||||||
Provider.ControlIntf.GetPreferredControlSize(NewWidth,NewHeight);
|
|
||||||
if NewWidth<=0 then
|
|
||||||
NewWidth:=500;
|
|
||||||
if NewHeight<=0 then
|
|
||||||
NewHeight:=200;
|
|
||||||
HintWinRect := Rect(0,0,NewWidth,NewHeight);
|
|
||||||
OffsetRect(HintWinRect, ScreenPos.X, ScreenPos.Y+30);
|
|
||||||
FHintWindow.ActivateHint(HintWinRect,'');
|
|
||||||
end else begin
|
|
||||||
HintWinRect := FHintWindow.CalcHintRect(Screen.Width, TheHint, nil);
|
|
||||||
OffsetRect(HintWinRect, ScreenPos.X, ScreenPos.Y+30);
|
|
||||||
FHintWindow.ActivateHint(HintWinRect,TheHint);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceNotebook.HideHint;
|
procedure TSourceNotebook.HideHint;
|
||||||
|
@ -23,7 +23,8 @@ unit IDEHelpIntf;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, LCLProc, Controls, HelpIntfs, LazHelpIntf, TextTools;
|
Classes, SysUtils, LCLProc, Forms, Controls, HelpIntfs, LazHelpIntf,
|
||||||
|
TextTools;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ THelpDBIRegExprMessage
|
{ THelpDBIRegExprMessage
|
||||||
@ -61,6 +62,9 @@ type
|
|||||||
var ErrMsg: string): TShowHelpResult; virtual; abstract;
|
var ErrMsg: string): TShowHelpResult; virtual; abstract;
|
||||||
procedure ShowHelpForMessage(Line: integer); virtual; abstract;
|
procedure ShowHelpForMessage(Line: integer); virtual; abstract;
|
||||||
procedure ShowHelpForObjectInspector(Sender: TObject); virtual; abstract;
|
procedure ShowHelpForObjectInspector(Sender: TObject); virtual; abstract;
|
||||||
|
function CreateHint(aHintWindow: THintWindow; ScreenPos: TPoint;
|
||||||
|
const BaseURL: string; var TheHint: string;
|
||||||
|
out HintWinRect: TRect): boolean; virtual; abstract;
|
||||||
|
|
||||||
function ConvertSourcePosToPascalHelpContext(const CaretPos: TPoint;
|
function ConvertSourcePosToPascalHelpContext(const CaretPos: TPoint;
|
||||||
const Filename: string): TPascalHelpContextList; virtual; abstract;
|
const Filename: string): TPascalHelpContextList; virtual; abstract;
|
||||||
|
@ -35,8 +35,13 @@ unit ObjectInspector;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
InterfaceBase, Forms, SysUtils, Buttons, Types, Classes, Graphics, GraphType,
|
// IMPORTANT: the object inspector is a tool and can be used in other programs
|
||||||
StdCtrls, LCLType, LCLIntf, LCLProc, Controls, ComCtrls, ExtCtrls, TypInfo,
|
// too. Don't put Lazarus IDE specific things here.
|
||||||
|
// FCL
|
||||||
|
SysUtils, Types, Classes, TypInfo,
|
||||||
|
// LCL
|
||||||
|
InterfaceBase, Forms, Buttons, Graphics, GraphType,
|
||||||
|
StdCtrls, LCLType, LCLIntf, LCLProc, Controls, ComCtrls, ExtCtrls,
|
||||||
LMessages, LResources, LazConfigStorage, Menus, Dialogs, Themes,
|
LMessages, LResources, LazConfigStorage, Menus, Dialogs, Themes,
|
||||||
ObjInspStrConsts,
|
ObjInspStrConsts,
|
||||||
PropEdits, GraphPropEdits, ListViewPropEdit, ImageListEditor,
|
PropEdits, GraphPropEdits, ListViewPropEdit, ImageListEditor,
|
||||||
@ -323,6 +328,11 @@ type
|
|||||||
oiqeShowValue
|
oiqeShowValue
|
||||||
);
|
);
|
||||||
|
|
||||||
|
TOIPropertyHint = function(Sender: TObject; PointedRow: TOIPropertyGridRow;
|
||||||
|
ScreenPos: TPoint; aHintWindow: THintWindow;
|
||||||
|
out HintWinRect: TRect; out AHint: string
|
||||||
|
): boolean of object;
|
||||||
|
|
||||||
TOICustomPropertyGrid = class(TCustomControl)
|
TOICustomPropertyGrid = class(TCustomControl)
|
||||||
private
|
private
|
||||||
FBackgroundColor: TColor;
|
FBackgroundColor: TColor;
|
||||||
@ -332,6 +342,7 @@ type
|
|||||||
FHighlightColor: TColor;
|
FHighlightColor: TColor;
|
||||||
FLayout: TOILayout;
|
FLayout: TOILayout;
|
||||||
FOnOIKeyDown: TKeyEvent;
|
FOnOIKeyDown: TKeyEvent;
|
||||||
|
FOnPropertyHint: TOIPropertyHint;
|
||||||
FOnSelectionChange: TNotifyEvent;
|
FOnSelectionChange: TNotifyEvent;
|
||||||
FReferencesColor: TColor;
|
FReferencesColor: TColor;
|
||||||
FRowSpacing: integer;
|
FRowSpacing: integer;
|
||||||
@ -537,6 +548,7 @@ type
|
|||||||
property OnModified: TNotifyEvent read FOnModified write FOnModified;
|
property OnModified: TNotifyEvent read FOnModified write FOnModified;
|
||||||
property OnOIKeyDown: TKeyEvent read FOnOIKeyDown write FOnOIKeyDown;
|
property OnOIKeyDown: TKeyEvent read FOnOIKeyDown write FOnOIKeyDown;
|
||||||
property OnSelectionChange: TNotifyEvent read FOnSelectionChange write FOnSelectionChange;
|
property OnSelectionChange: TNotifyEvent read FOnSelectionChange write FOnSelectionChange;
|
||||||
|
property OnPropertyHint: TOIPropertyHint read FOnPropertyHint write FOnPropertyHint;
|
||||||
property PrefferedSplitterX: integer read FPreferredSplitterX
|
property PrefferedSplitterX: integer read FPreferredSplitterX
|
||||||
write FPreferredSplitterX default 100;
|
write FPreferredSplitterX default 100;
|
||||||
property PropertyEditorHook: TPropertyEditorHook read FPropertyEditorHook
|
property PropertyEditorHook: TPropertyEditorHook read FPropertyEditorHook
|
||||||
@ -690,6 +702,7 @@ type
|
|||||||
FAutoShow: Boolean;
|
FAutoShow: Boolean;
|
||||||
FFavourites: TOIFavouriteProperties;
|
FFavourites: TOIFavouriteProperties;
|
||||||
FInfoBoxHeight: integer;
|
FInfoBoxHeight: integer;
|
||||||
|
FOnPropertyHint: TOIPropertyHint;
|
||||||
FOnSelectionChange: TNotifyEvent;
|
FOnSelectionChange: TNotifyEvent;
|
||||||
FRestricted: TOIRestrictedProperties;
|
FRestricted: TOIRestrictedProperties;
|
||||||
FOnAddToFavourites: TNotifyEvent;
|
FOnAddToFavourites: TNotifyEvent;
|
||||||
@ -737,6 +750,9 @@ type
|
|||||||
procedure HookLookupRootChange;
|
procedure HookLookupRootChange;
|
||||||
procedure OnGridModified(Sender: TObject);
|
procedure OnGridModified(Sender: TObject);
|
||||||
procedure OnGridSelectionChange(Sender: TObject);
|
procedure OnGridSelectionChange(Sender: TObject);
|
||||||
|
function OnGridPropertyHint(Sender: TObject; PointedRow: TOIPropertyGridRow;
|
||||||
|
ScreenPos: TPoint; aHintWindow: THintWindow;
|
||||||
|
out HintWinRect: TRect; out AHint: string): boolean;
|
||||||
procedure SetAvailComboBoxText;
|
procedure SetAvailComboBoxText;
|
||||||
procedure HookGetSelection(const ASelection: TPersistentSelectionList);
|
procedure HookGetSelection(const ASelection: TPersistentSelectionList);
|
||||||
procedure HookSetSelection(const ASelection: TPersistentSelectionList);
|
procedure HookSetSelection(const ASelection: TPersistentSelectionList);
|
||||||
@ -772,6 +788,7 @@ type
|
|||||||
read FPropertyEditorHook write SetPropertyEditorHook;
|
read FPropertyEditorHook write SetPropertyEditorHook;
|
||||||
property OnModified: TNotifyEvent read FOnModified write FOnModified;
|
property OnModified: TNotifyEvent read FOnModified write FOnModified;
|
||||||
property OnSelectionChange: TNotifyEvent read FOnSelectionChange write FOnSelectionChange;
|
property OnSelectionChange: TNotifyEvent read FOnSelectionChange write FOnSelectionChange;
|
||||||
|
property OnPropertyHint: TOIPropertyHint read FOnPropertyHint write FOnPropertyHint;
|
||||||
property OnShowOptions: TNotifyEvent read FOnShowOptions
|
property OnShowOptions: TNotifyEvent read FOnShowOptions
|
||||||
write SetOnShowOptions;
|
write SetOnShowOptions;
|
||||||
property OnRemainingKeyUp: TKeyEvent read FOnRemainingKeyUp
|
property OnRemainingKeyUp: TKeyEvent read FOnRemainingKeyUp
|
||||||
@ -1950,7 +1967,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Result:=pehNone;
|
Result:=pehNone;
|
||||||
if (RowIndex<0) or (RowIndex>=RowCount) then exit;
|
if (RowIndex<0) or (RowIndex>=RowCount) then exit;
|
||||||
if SplitterX>=X then begin
|
if SplitterX<=X then begin
|
||||||
if (FCurrentButton<>nil)
|
if (FCurrentButton<>nil)
|
||||||
and (FCurrentButton.Left<=X) then
|
and (FCurrentButton.Left<=X) then
|
||||||
Result:=pehEditButton
|
Result:=pehEditButton
|
||||||
@ -2981,10 +2998,18 @@ begin
|
|||||||
Begin
|
Begin
|
||||||
if Assigned(PointedRow.Editor) then begin
|
if Assigned(PointedRow.Editor) then begin
|
||||||
HintType := GetHintTypeAt(Index,Position.X);
|
HintType := GetHintTypeAt(Index,Position.X);
|
||||||
|
if (HintType = pehName) and Assigned(OnPropertyHint) then begin
|
||||||
|
if OnPropertyHint(Self,PointedRow,Position,FHintWindow,Rect,AHint) then
|
||||||
|
begin
|
||||||
|
FHintWindow.ActivateHint(Rect,AHint);
|
||||||
|
end;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
AHint := PointedRow.Editor.GetHint(HintType,Position.X,Position.Y);
|
AHint := PointedRow.Editor.GetHint(HintType,Position.X,Position.Y);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if AHint = '' then Exit;
|
if AHint = '' then Exit;
|
||||||
Rect := FHintWindow.CalcHintRect(0,AHint,nil); //no maxwidth
|
Rect := FHintWindow.CalcHintRect(0,AHint,nil); //no maxwidth
|
||||||
Position := Mouse.CursorPos;
|
Position := Mouse.CursorPos;
|
||||||
@ -4321,6 +4346,15 @@ begin
|
|||||||
if Assigned(FOnSelectionChange) then OnSelectionChange(Self);
|
if Assigned(FOnSelectionChange) then OnSelectionChange(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TObjectInspectorDlg.OnGridPropertyHint(Sender: TObject;
|
||||||
|
PointedRow: TOIPropertyGridRow; ScreenPos: TPoint; aHintWindow: THintWindow;
|
||||||
|
out HintWinRect: TRect; out AHint: string): boolean;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
if Assigned(FOnPropertyHint) then
|
||||||
|
Result:=FOnPropertyHint(Sender,PointedRow,ScreenPos,aHintWindow,HintWinRect,AHint);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TObjectInspectorDlg.SetAvailComboBoxText;
|
procedure TObjectInspectorDlg.SetAvailComboBoxText;
|
||||||
begin
|
begin
|
||||||
case FSelection.Count of
|
case FSelection.Count of
|
||||||
@ -4623,6 +4657,7 @@ begin
|
|||||||
PopupMenu:=MainPopupMenu;
|
PopupMenu:=MainPopupMenu;
|
||||||
OnModified:=@OnGridModified;
|
OnModified:=@OnGridModified;
|
||||||
OnSelectionChange:=@OnGridSelectionChange;
|
OnSelectionChange:=@OnGridSelectionChange;
|
||||||
|
OnPropertyHint:=@OnGridPropertyHint;
|
||||||
OnOIKeyDown:=@OnGridKeyDown;
|
OnOIKeyDown:=@OnGridKeyDown;
|
||||||
OnKeyUp:=@OnGridKeyUp;
|
OnKeyUp:=@OnGridKeyUp;
|
||||||
OnDblClick:=@OnGridDblClick;
|
OnDblClick:=@OnGridDblClick;
|
||||||
@ -4640,6 +4675,7 @@ begin
|
|||||||
PopupMenu:=MainPopupMenu;
|
PopupMenu:=MainPopupMenu;
|
||||||
OnModified:=@OnGridModified;
|
OnModified:=@OnGridModified;
|
||||||
OnSelectionChange:=@OnGridSelectionChange;
|
OnSelectionChange:=@OnGridSelectionChange;
|
||||||
|
OnPropertyHint:=@OnGridPropertyHint;
|
||||||
OnOIKeyDown:=@OnGridKeyDown;
|
OnOIKeyDown:=@OnGridKeyDown;
|
||||||
OnKeyUp:=@OnGridKeyUp;
|
OnKeyUp:=@OnGridKeyUp;
|
||||||
OnDblClick:=@OnGridDblClick;
|
OnDblClick:=@OnGridDblClick;
|
||||||
@ -4661,6 +4697,7 @@ begin
|
|||||||
PopupMenu:=MainPopupMenu;
|
PopupMenu:=MainPopupMenu;
|
||||||
OnModified:=@OnGridModified;
|
OnModified:=@OnGridModified;
|
||||||
OnSelectionChange:=@OnGridSelectionChange;
|
OnSelectionChange:=@OnGridSelectionChange;
|
||||||
|
OnPropertyHint:=@OnGridPropertyHint;
|
||||||
OnOIKeyDown:=@OnGridKeyDown;
|
OnOIKeyDown:=@OnGridKeyDown;
|
||||||
OnKeyUp:=@OnGridKeyUp;
|
OnKeyUp:=@OnGridKeyUp;
|
||||||
OnDblClick:=@OnGridDblClick;
|
OnDblClick:=@OnGridDblClick;
|
||||||
@ -4682,6 +4719,7 @@ begin
|
|||||||
PopupMenu:=MainPopupMenu;
|
PopupMenu:=MainPopupMenu;
|
||||||
OnModified:=@OnGridModified;
|
OnModified:=@OnGridModified;
|
||||||
OnSelectionChange:=@OnGridSelectionChange;
|
OnSelectionChange:=@OnGridSelectionChange;
|
||||||
|
OnPropertyHint:=@OnGridPropertyHint;
|
||||||
OnOIKeyDown:=@OnGridKeyDown;
|
OnOIKeyDown:=@OnGridKeyDown;
|
||||||
OnKeyUp:=@OnGridKeyUp;
|
OnKeyUp:=@OnGridKeyUp;
|
||||||
OnDblClick:=@OnGridDblClick;
|
OnDblClick:=@OnGridDblClick;
|
||||||
|
Loading…
Reference in New Issue
Block a user