IDE: show property's class, name and type in OI StatusBar.

git-svn-id: trunk@41380 -
This commit is contained in:
juha 2013-05-24 08:23:49 +00:00
parent fe0b0eb344
commit 154590fc1b
7 changed files with 29 additions and 21 deletions

View File

@ -21,7 +21,6 @@ object ObjectInspectorDlg: TObjectInspectorDlg
item item
Width = 50 Width = 50
end> end>
SimplePanel = False
end end
object AvailPersistentComboBox: TComboBox object AvailPersistentComboBox: TComboBox
Left = 0 Left = 0

View File

@ -3893,7 +3893,6 @@ begin
FComponentEditor := nil; FComponentEditor := nil;
Caption := oisObjectInspector; Caption := oisObjectInspector;
StatusBar.SimpleText := oisAll;
FilterLabel.Caption := oisBtnComponents; FilterLabel.Caption := oisBtnComponents;
MainPopupMenu.Images := IDEImages.Images_16; MainPopupMenu.Images := IDEImages.Images_16;

View File

@ -20,7 +20,6 @@ resourcestring
// Object Inspector // Object Inspector
oisObjectInspector = 'Object Inspector'; oisObjectInspector = 'Object Inspector';
oisAll = 'All';
oisError = 'Error'; oisError = 'Error';
oisItemsSelected = '%u items selected'; oisItemsSelected = '%u items selected';

View File

@ -308,7 +308,7 @@ type
out Chain: TCodeHelpElementChain; out Chain: TCodeHelpElementChain;
out CacheWasUsed: boolean): TCodeHelpParseResult; out CacheWasUsed: boolean): TCodeHelpParseResult;
function GetHTMLHint(Code: TCodeBuffer; X, Y: integer; Options: TCodeHelpHintOptions; function GetHTMLHint(Code: TCodeBuffer; X, Y: integer; Options: TCodeHelpHintOptions;
out BaseURL, HTMLHint: string; out BaseURL, HTMLHint, PropDetails: string;
out CacheWasUsed: boolean): TCodeHelpParseResult; out CacheWasUsed: boolean): TCodeHelpParseResult;
function GetHTMLHintForNode(CTTool: TFindDeclarationTool; CTNode: TCodeTreeNode; function GetHTMLHintForNode(CTTool: TFindDeclarationTool; CTNode: TCodeTreeNode;
XYPos: TCodeXYPosition; Options: TCodeHelpHintOptions; XYPos: TCodeXYPosition; Options: TCodeHelpHintOptions;
@ -2401,18 +2401,20 @@ begin
end; end;
function TCodeHelpManager.GetHTMLHint(Code: TCodeBuffer; X, Y: integer; function TCodeHelpManager.GetHTMLHint(Code: TCodeBuffer; X, Y: integer;
Options: TCodeHelpHintOptions; out BaseURL, HTMLHint: string; Options: TCodeHelpHintOptions;
out BaseURL, HTMLHint, PropDetails: string;
out CacheWasUsed: boolean): TCodeHelpParseResult; out CacheWasUsed: boolean): TCodeHelpParseResult;
var var
CursorPos: TCodeXYPosition; CursorPos: TCodeXYPosition;
CTTool: TFindDeclarationTool; CTTool: TFindDeclarationTool;
CTNode: TCodeTreeNode; CTNode: TCodeTreeNode;
XYPos: TCodeXYPosition; XYPos: TCodeXYPosition;
aTopLine: integer; TopLine: integer;
begin begin
Result:=chprFailed; Result:=chprFailed;
BaseURL:='lazdoc://'; BaseURL:='lazdoc://';
HTMLHint:=''; HTMLHint:='';
PropDetails:='';
CacheWasUsed:=true; CacheWasUsed:=true;
CursorPos.X:=X; CursorPos.X:=X;
@ -2422,8 +2424,7 @@ begin
try try
// find declaration // find declaration
if not CodeToolBoss.CurCodeTool.FindDeclaration(CursorPos, if not CodeToolBoss.CurCodeTool.FindDeclaration(CursorPos,
DefaultFindSmartHintFlags+[fsfSearchSourceName], DefaultFindSmartHintFlags+[fsfSearchSourceName],CTTool,CTNode,XYPos,TopLine)
CTTool,CTNode,XYPos,aTopLine)
then then
exit; exit;
if (CTNode=nil) then begin if (CTNode=nil) then begin
@ -2431,9 +2432,9 @@ begin
debugln(['TCodeHelpManager.GetHTMLHint not a declaration']); debugln(['TCodeHelpManager.GetHTMLHint not a declaration']);
exit; exit;
end; end;
Result:=GetHTMLHintForNode(CTTool,CTNode,XYPos,Options,BaseURL,HTMLHint,CacheWasUsed);
Result:=GetHTMLHintForNode(CTTool,CTNode,XYPos,Options,BaseURL,HTMLHint, // Property details are like "published property TType.PropName:Integer"
CacheWasUsed); PropDetails:=CTTool.GetSmartHint(CTNode,XYPos,false);
except except
on E: ECodeToolError do begin on E: ECodeToolError do begin
//debugln(['TCodeHelpManager.GetHTMLHint ECodeToolError: ',E.Message]); //debugln(['TCodeHelpManager.GetHTMLHint ECodeToolError: ',E.Message]);
@ -2447,8 +2448,7 @@ end;
function TCodeHelpManager.GetHTMLHintForNode(CTTool: TFindDeclarationTool; function TCodeHelpManager.GetHTMLHintForNode(CTTool: TFindDeclarationTool;
CTNode: TCodeTreeNode; XYPos: TCodeXYPosition; Options: TCodeHelpHintOptions; CTNode: TCodeTreeNode; XYPos: TCodeXYPosition; Options: TCodeHelpHintOptions;
out BaseURL, HTMLHint: string; out CacheWasUsed: boolean out BaseURL, HTMLHint: string; out CacheWasUsed: boolean): TCodeHelpParseResult;
): TCodeHelpParseResult;
var var
aTopLine: integer; aTopLine: integer;
ListOfPCodeXYPosition: TFPList; ListOfPCodeXYPosition: TFPList;

View File

@ -96,7 +96,7 @@ var
HelpResult: TCodeHelpParseResult; HelpResult: TCodeHelpParseResult;
Caret: TCodeXYPosition; Caret: TCodeXYPosition;
CleanPos: LongInt; CleanPos: LongInt;
BaseDir: String; BaseDir, PropDetails: String;
begin begin
FBaseURL:=''; FBaseURL:='';
FHTMLHint:=''; FHTMLHint:='';
@ -159,7 +159,7 @@ begin
//DebugLn(['TFPDocHintProvider.DoUpdateHint ',Item.Identifier,' ',Item.Tool.MainFilename,' ',Caret.Code.Filename,' ',Caret.X,',',Caret.Y]); //DebugLn(['TFPDocHintProvider.DoUpdateHint ',Item.Identifier,' ',Item.Tool.MainFilename,' ',Caret.Code.Filename,' ',Caret.X,',',Caret.Y]);
HelpResult:=CodeHelpBoss.GetHTMLHint(Caret.Code,Caret.X,Caret.Y, HelpResult:=CodeHelpBoss.GetHTMLHint(Caret.Code,Caret.X,Caret.Y,
[chhoDeclarationHeader], [chhoDeclarationHeader],
FBaseURL,FHTMLHint,CacheWasUsed); FBaseURL,FHTMLHint,PropDetails,CacheWasUsed);
if HelpResult<>chprSuccess then begin if HelpResult<>chprSuccess then begin
DebugLn(['TFPDocHintProvider.DoUpdateHint FAILED Identifier=',Item.Identifier]); DebugLn(['TFPDocHintProvider.DoUpdateHint FAILED Identifier=',Item.Identifier]);
exit; exit;

View File

@ -1674,6 +1674,7 @@ var
Code: TCodeBuffer; Code: TCodeBuffer;
CacheWasUsed: boolean; CacheWasUsed: boolean;
HintFlags: TCodeHelpHintOptions; HintFlags: TCodeHelpHintOptions;
PropDetails: string;
begin begin
BaseURL:=''; BaseURL:='';
HTMLHint:=''; HTMLHint:='';
@ -1684,7 +1685,7 @@ begin
if ihmchAddFocusHint in Flags then if ihmchAddFocusHint in Flags then
Include(HintFlags,chhoShowFocusHint); Include(HintFlags,chhoShowFocusHint);
if CodeHelpBoss.GetHTMLHint(Code,CodePos.X,CodePos.Y, if CodeHelpBoss.GetHTMLHint(Code,CodePos.X,CodePos.Y,
HintFlags,BaseURL,HTMLHint,CacheWasUsed)=chprSuccess HintFlags,BaseURL,HTMLHint,PropDetails,CacheWasUsed)=chprSuccess
then then
exit(shrSuccess); exit(shrSuccess);
Result:=shrHelpNotFound; Result:=shrHelpNotFound;

View File

@ -59,7 +59,7 @@ uses
MemCheck, MemCheck,
{$ENDIF} {$ENDIF}
// fpc packages // fpc packages
Math, Classes, SysUtils, Process, AsyncProcess, TypInfo, types, AVL_Tree, Math, Classes, SysUtils, Process, AsyncProcess, TypInfo, types, strutils, AVL_Tree,
// lazutils // lazutils
LazUTF8, Laz2_XMLCfg, AvgLvlTree, LazUTF8, Laz2_XMLCfg, AvgLvlTree,
// lcl // lcl
@ -12591,8 +12591,8 @@ var
ARow: TOIPropertyGridRow; ARow: TOIPropertyGridRow;
Code: TCodeBuffer; Code: TCodeBuffer;
Caret: TPoint; Caret: TPoint;
NewTopLine: integer; i: integer;
HtmlHint, BaseURL: string; HtmlHint, BaseURL, PropDetails: string;
CacheWasUsed: Boolean; CacheWasUsed: Boolean;
Stream: TStringStream; Stream: TStringStream;
begin begin
@ -12607,17 +12607,19 @@ begin
HtmlHint := ''; HtmlHint := '';
BaseURL := ''; BaseURL := '';
PropDetails := '';
ARow := OI.GetActivePropertyRow; ARow := OI.GetActivePropertyRow;
if (ARow <> nil) if (ARow <> nil)
and FindDeclarationOfOIProperty(OI, ARow, Code, Caret, NewTopLine) then and FindDeclarationOfOIProperty(OI, ARow, Code, Caret, i) then
begin begin
if CodeHelpBoss.GetHTMLHint(Code, Caret.X, Caret.Y, [], if CodeHelpBoss.GetHTMLHint(Code, Caret.X, Caret.Y, [],
BaseURL, HtmlHint, CacheWasUsed) <> chprSuccess then BaseURL, HtmlHint, PropDetails, CacheWasUsed) <> chprSuccess then
begin begin
HtmlHint := ''; HtmlHint := '';
BaseURL := ''; BaseURL := '';
PropDetails := '';
end; end;
end; end;
@ -12633,6 +12635,14 @@ begin
Stream.Free; Stream.Free;
end; end;
end; end;
// Property details always starts with "published property". Get rid of it.
i:=Pos(' ', PropDetails);
if i>0 then begin
i:=PosEx(' ', PropDetails, i+1);
if i>0 then
PropDetails:=Copy(PropDetails, i+1, Length(PropDetails));
end;
OI.StatusBar.SimpleText:=PropDetails; // Show in OI StatusBar
end; end;
procedure TMainIDE.mnuFileClicked(Sender: TObject); procedure TMainIDE.mnuFileClicked(Sender: TObject);