mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-27 03:07:17 +01:00
Object Inspector: Remember last active property. Issue #29510, patch from Balázs Székely.
git-svn-id: trunk@51440 -
This commit is contained in:
parent
d89ec8e399
commit
915691f819
@ -721,6 +721,7 @@ type
|
|||||||
FEnableHookGetSelection: boolean;
|
FEnableHookGetSelection: boolean;
|
||||||
FInSelection: Boolean;
|
FInSelection: Boolean;
|
||||||
FOnAutoShow: TNotifyEvent;
|
FOnAutoShow: TNotifyEvent;
|
||||||
|
FLastActiveRowName: String;
|
||||||
function GetComponentPanelHeight: integer;
|
function GetComponentPanelHeight: integer;
|
||||||
function GetInfoBoxHeight: integer;
|
function GetInfoBoxHeight: integer;
|
||||||
procedure SetEnableHookGetSelection(AValue: boolean);
|
procedure SetEnableHookGetSelection(AValue: boolean);
|
||||||
@ -805,6 +806,7 @@ type
|
|||||||
property ShowInfoBox: Boolean read FShowInfoBox write SetShowInfoBox;
|
property ShowInfoBox: Boolean read FShowInfoBox write SetShowInfoBox;
|
||||||
property ShowRestricted: Boolean read FShowRestricted write SetShowRestricted;
|
property ShowRestricted: Boolean read FShowRestricted write SetShowRestricted;
|
||||||
property ShowStatusBar: Boolean read FShowStatusBar write SetShowStatusBar;
|
property ShowStatusBar: Boolean read FShowStatusBar write SetShowStatusBar;
|
||||||
|
property LastActiveRowName: string read FLastActiveRowName;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -4737,8 +4739,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TObjectInspectorDlg.OnGridSelectionChange(Sender: TObject);
|
procedure TObjectInspectorDlg.OnGridSelectionChange(Sender: TObject);
|
||||||
|
var
|
||||||
|
Row: TOIPropertyGridRow;
|
||||||
begin
|
begin
|
||||||
if Assigned(FOnSelectionChange) then FOnSelectionChange(Self);
|
Row := GetActivePropertyRow;
|
||||||
|
if Assigned(Row) then
|
||||||
|
FLastActiveRowName := Row.Name;
|
||||||
|
if Assigned(FOnSelectionChange) then
|
||||||
|
FOnSelectionChange(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TObjectInspectorDlg.OnGridPropertyHint(Sender: TObject;
|
function TObjectInspectorDlg.OnGridPropertyHint(Sender: TObject;
|
||||||
|
|||||||
64
ide/main.pp
64
ide/main.pp
@ -399,6 +399,7 @@ type
|
|||||||
procedure ToolBarOptionsClick(Sender: TObject);
|
procedure ToolBarOptionsClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
fBuilder: TLazarusBuilder;
|
fBuilder: TLazarusBuilder;
|
||||||
|
fOIActivateLastRow: Boolean;
|
||||||
function DoBuildLazarusSub(Flags: TBuildLazarusFlags): TModalResult;
|
function DoBuildLazarusSub(Flags: TBuildLazarusFlags): TModalResult;
|
||||||
procedure ProjectOptionsHelper(AFilter: array of TAbstractIDEOptionsClass);
|
procedure ProjectOptionsHelper(AFilter: array of TAbstractIDEOptionsClass);
|
||||||
// Global IDE events
|
// Global IDE events
|
||||||
@ -646,7 +647,6 @@ type
|
|||||||
FFixingGlobalComponentLock: integer;
|
FFixingGlobalComponentLock: integer;
|
||||||
OldCompilerFilename, OldLanguage: String;
|
OldCompilerFilename, OldLanguage: String;
|
||||||
OIChangedTimer: TIdleTimer;
|
OIChangedTimer: TIdleTimer;
|
||||||
|
|
||||||
procedure DoDropFilesAsync(Data: PtrInt);
|
procedure DoDropFilesAsync(Data: PtrInt);
|
||||||
procedure RenameInheritedMethods(AnUnitInfo: TUnitInfo; List: TStrings);
|
procedure RenameInheritedMethods(AnUnitInfo: TUnitInfo; List: TStrings);
|
||||||
function OIHelpProvider: TAbstractIDEHTMLProvider;
|
function OIHelpProvider: TAbstractIDEHTMLProvider;
|
||||||
@ -8596,24 +8596,13 @@ end;
|
|||||||
|
|
||||||
procedure TMainIDE.OnDesignerComponentAdded(Sender: TObject;
|
procedure TMainIDE.OnDesignerComponentAdded(Sender: TObject;
|
||||||
AComponent: TComponent; ARegisteredComponent: TRegisteredComponent);
|
AComponent: TComponent; ARegisteredComponent: TRegisteredComponent);
|
||||||
var
|
|
||||||
Grid: TOICustomPropertyGrid;
|
|
||||||
Row: TOIPropertyGridRow;
|
|
||||||
begin
|
begin
|
||||||
TComponentPalette(IDEComponentPalette).DoAfterComponentAdded(TDesigner(Sender).LookupRoot,
|
TComponentPalette(IDEComponentPalette).DoAfterComponentAdded(TDesigner(Sender).LookupRoot,
|
||||||
AComponent, ARegisteredComponent);
|
AComponent, ARegisteredComponent);
|
||||||
if EnvironmentOptions.CreateComponentFocusNameProperty
|
if (ObjectInspector1 <> nil) then
|
||||||
and (ObjectInspector1<>nil) then begin
|
begin
|
||||||
if (ObjectInspector1.ShowFavorites) and (EnvironmentOptions.SwitchToFavoritesOITab) then
|
fOIActivateLastRow := True;
|
||||||
Grid:=ObjectInspector1.FavoriteGrid
|
OIChangedTimer.AutoEnabled := True;
|
||||||
else
|
|
||||||
Grid:=ObjectInspector1.PropertyGrid;
|
|
||||||
ObjectInspector1.ActivateGrid(Grid);
|
|
||||||
Row:=Grid.GetRowByPath('Name');
|
|
||||||
if Row<>nil then begin
|
|
||||||
Grid.ItemIndex:=Row.Index;
|
|
||||||
ObjectInspector1.FocusGrid(Grid);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -11825,7 +11814,8 @@ end;
|
|||||||
procedure TMainIDE.OIChangedTimerTimer(Sender: TObject);
|
procedure TMainIDE.OIChangedTimerTimer(Sender: TObject);
|
||||||
var
|
var
|
||||||
OI: TObjectInspectorDlg;
|
OI: TObjectInspectorDlg;
|
||||||
ARow: TOIPropertyGridRow;
|
Row: TOIPropertyGridRow;
|
||||||
|
Grid: TOICustomPropertyGrid;
|
||||||
Code: TCodeBuffer;
|
Code: TCodeBuffer;
|
||||||
Caret: TPoint;
|
Caret: TPoint;
|
||||||
i: integer;
|
i: integer;
|
||||||
@ -11839,17 +11829,37 @@ begin
|
|||||||
OIChangedTimer.AutoEnabled:=false;
|
OIChangedTimer.AutoEnabled:=false;
|
||||||
OIChangedTimer.Enabled:=false;
|
OIChangedTimer.Enabled:=false;
|
||||||
|
|
||||||
|
// Select again the last grid / property after a new component was added
|
||||||
|
if fOIActivateLastRow then
|
||||||
|
begin
|
||||||
|
fOIActivateLastRow := False;
|
||||||
|
if EnvironmentOptions.CreateComponentFocusNameProperty then
|
||||||
|
begin
|
||||||
|
if (OI.ShowFavorites) and (EnvironmentOptions.SwitchToFavoritesOITab) then
|
||||||
|
Grid := OI.FavoriteGrid
|
||||||
|
else
|
||||||
|
Grid := OI.PropertyGrid;
|
||||||
|
Row := Grid.GetRowByPath('Name');
|
||||||
|
end
|
||||||
|
else begin //focus to the last active property(row)
|
||||||
|
Grid := OI.PropertyGrid;
|
||||||
|
Row := Grid.GetRowByPath(OI.LastActiveRowName);
|
||||||
|
end;
|
||||||
|
if Row <> nil then
|
||||||
|
begin
|
||||||
|
OI.ActivateGrid(Grid);
|
||||||
|
OI.FocusGrid(Grid);
|
||||||
|
Grid.ItemIndex := Row.Index;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Row := OI.GetActivePropertyRow;
|
||||||
|
|
||||||
|
// Get help text for this property
|
||||||
if not BeginCodeTools or not OI.ShowInfoBox then
|
if not BeginCodeTools or not OI.ShowInfoBox then
|
||||||
Exit;
|
Exit;
|
||||||
|
if (Row <> nil)
|
||||||
HtmlHint := '';
|
and FindDeclarationOfOIProperty(OI, Row, Code, Caret, i) then
|
||||||
BaseURL := '';
|
|
||||||
PropDetails := '';
|
|
||||||
|
|
||||||
ARow := OI.GetActivePropertyRow;
|
|
||||||
|
|
||||||
if (ARow <> nil)
|
|
||||||
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, PropDetails, CacheWasUsed) <> chprSuccess then
|
BaseURL, HtmlHint, PropDetails, CacheWasUsed) <> chprSuccess then
|
||||||
@ -11860,6 +11870,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Update InfoPanel contents with the help text
|
||||||
if OI.InfoPanel.ControlCount > 0 then
|
if OI.InfoPanel.ControlCount > 0 then
|
||||||
OI.InfoPanel.Controls[0].Visible := HtmlHint <> '';
|
OI.InfoPanel.Controls[0].Visible := HtmlHint <> '';
|
||||||
if HtmlHint <> '' then
|
if HtmlHint <> '' then
|
||||||
@ -11872,6 +11883,7 @@ begin
|
|||||||
Stream.Free;
|
Stream.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Property details always starts with "published property". Get rid of it.
|
// Property details always starts with "published property". Get rid of it.
|
||||||
i:=Pos(' ', PropDetails);
|
i:=Pos(' ', PropDetails);
|
||||||
if i>0 then begin
|
if i>0 then begin
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user