mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 13:20:21 +02:00
IDE: fixed searchresultsviw crash when docked
git-svn-id: trunk@65008 -
This commit is contained in:
parent
b8816924f3
commit
6a460513ac
@ -293,7 +293,7 @@ begin
|
|||||||
Files:=TStringList.Create;
|
Files:=TStringList.Create;
|
||||||
Files.Add(DeclCode.Filename);
|
Files.Add(DeclCode.Filename);
|
||||||
if CompareFilenames(DeclCode.Filename,StartSrcCode.Filename)<>0 then
|
if CompareFilenames(DeclCode.Filename,StartSrcCode.Filename)<>0 then
|
||||||
Files.Add(DeclCode.Filename);
|
Files.Add(StartSrcCode.Filename);
|
||||||
|
|
||||||
Options:=MiscellaneousOptions.FindRenameIdentifierOptions;
|
Options:=MiscellaneousOptions.FindRenameIdentifierOptions;
|
||||||
|
|
||||||
|
@ -129,6 +129,12 @@ type
|
|||||||
function ItemsAsStrings: TStrings;
|
function ItemsAsStrings: TStrings;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TSVCloseButtonsState = (
|
||||||
|
svcbNone,
|
||||||
|
svcbEnable,
|
||||||
|
svcbDisable
|
||||||
|
);
|
||||||
|
|
||||||
{ TSearchResultsView }
|
{ TSearchResultsView }
|
||||||
|
|
||||||
TSearchResultsView = class(TForm)
|
TSearchResultsView = class(TForm)
|
||||||
@ -201,6 +207,7 @@ type
|
|||||||
type
|
type
|
||||||
TOnSide = (osLeft, osOthers, osRight); { Handling of multi tab closure }
|
TOnSide = (osLeft, osOthers, osRight); { Handling of multi tab closure }
|
||||||
private
|
private
|
||||||
|
FAsyncUpdateCloseButtons: TSVCloseButtonsState;
|
||||||
FMaxItems: integer;
|
FMaxItems: integer;
|
||||||
FFocusTreeViewInOnChange: Boolean;
|
FFocusTreeViewInOnChange: Boolean;
|
||||||
FFocusTreeViewInEndUpdate: Boolean;
|
FFocusTreeViewInEndUpdate: Boolean;
|
||||||
@ -211,6 +218,7 @@ type
|
|||||||
function BeautifyPageName(const APageName: string): string;
|
function BeautifyPageName(const APageName: string): string;
|
||||||
function GetPageIndex(const APageName: string): integer;
|
function GetPageIndex(const APageName: string): integer;
|
||||||
function GetTreeView(APageIndex: integer): TLazSearchResultTV;
|
function GetTreeView(APageIndex: integer): TLazSearchResultTV;
|
||||||
|
procedure SetAsyncUpdateCloseButtons(const AValue: TSVCloseButtonsState);
|
||||||
procedure SetItems(Index: Integer; Value: TStrings);
|
procedure SetItems(Index: Integer; Value: TStrings);
|
||||||
function GetItems(Index: integer): TStrings;
|
function GetItems(Index: integer): TStrings;
|
||||||
procedure SetMaxItems(const AValue: integer);
|
procedure SetMaxItems(const AValue: integer);
|
||||||
@ -219,10 +227,12 @@ type
|
|||||||
procedure ClosePageOnSides(aOnSide : TOnSide);
|
procedure ClosePageOnSides(aOnSide : TOnSide);
|
||||||
procedure ClosePageBegin;
|
procedure ClosePageBegin;
|
||||||
procedure ClosePageEnd;
|
procedure ClosePageEnd;
|
||||||
procedure UpdateCloseButtons(aEnable : boolean);
|
procedure DoAsyncUpdateCloseButtons(Data: PtrInt);
|
||||||
protected
|
protected
|
||||||
procedure Loaded; override;
|
procedure Loaded; override;
|
||||||
procedure ActivateControl(aWinControl: TWinControl);
|
procedure ActivateControl(aWinControl: TWinControl);
|
||||||
|
procedure UpdateShowing; override;
|
||||||
|
property AsyncUpdateCloseButtons: TSVCloseButtonsState read FAsyncUpdateCloseButtons write SetAsyncUpdateCloseButtons;
|
||||||
public
|
public
|
||||||
function AddSearch(const ResultsName: string;
|
function AddSearch(const ResultsName: string;
|
||||||
const SearchText: string;
|
const SearchText: string;
|
||||||
@ -360,7 +370,6 @@ begin
|
|||||||
actCloseOthers.ImageIndex := IDEImages.LoadImage('tab_close_LR');
|
actCloseOthers.ImageIndex := IDEImages.LoadImage('tab_close_LR');
|
||||||
actCloseRight.ImageIndex := IDEImages.LoadImage('tab_close_R');
|
actCloseRight.ImageIndex := IDEImages.LoadImage('tab_close_R');
|
||||||
actCloseAll.ImageIndex := IDEImages.LoadImage('tab_close_All');
|
actCloseAll.ImageIndex := IDEImages.LoadImage('tab_close_All');
|
||||||
UpdateCloseButtons(False);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSearchResultsView.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
procedure TSearchResultsView.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||||
@ -474,7 +483,10 @@ end;
|
|||||||
|
|
||||||
procedure TSearchResultsView.ResultsNoteBookResize(Sender: TObject);
|
procedure TSearchResultsView.ResultsNoteBookResize(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
UpdateCloseButtons(ResultsNoteBook.PageCount>0);
|
if ResultsNoteBook.PageCount>0 then
|
||||||
|
AsyncUpdateCloseButtons:=svcbEnable
|
||||||
|
else
|
||||||
|
AsyncUpdateCloseButtons:=svcbDisable;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Handling of tabs closure. Only tabs on pages at the level of active page in
|
{ Handling of tabs closure. Only tabs on pages at the level of active page in
|
||||||
@ -807,7 +819,7 @@ begin
|
|||||||
if ResultsNoteBook.PageCount = 0 then
|
if ResultsNoteBook.PageCount = 0 then
|
||||||
Close
|
Close
|
||||||
else
|
else
|
||||||
UpdateCloseButtons(True);
|
AsyncUpdateCloseButtons:=svcbEnable;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{Sets the Items from the treeview on the currently selected page in the TNoteBook}
|
{Sets the Items from the treeview on the currently selected page in the TNoteBook}
|
||||||
@ -862,7 +874,7 @@ begin
|
|||||||
ClosePageButton.Enabled := state;
|
ClosePageButton.Enabled := state;
|
||||||
SearchInListEdit.Enabled := state;
|
SearchInListEdit.Enabled := state;
|
||||||
if state then
|
if state then
|
||||||
UpdateCloseButtons(state);
|
AsyncUpdateCloseButtons:=svcbEnable;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Returns a list of all pages (visible tabs) on the same line of Tabs as the ActivaPage }
|
{ Returns a list of all pages (visible tabs) on the same line of Tabs as the ActivaPage }
|
||||||
@ -914,15 +926,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSearchResultsView.UpdateCloseButtons(aEnable: boolean);
|
procedure TSearchResultsView.DoAsyncUpdateCloseButtons(Data: PtrInt);
|
||||||
var
|
var
|
||||||
lPageList: TFPlist = nil;
|
lPageList: TFPlist = nil;
|
||||||
lActiveIx: integer = -1;
|
lActiveIx: integer = -1;
|
||||||
|
aEnable: Boolean;
|
||||||
begin
|
begin
|
||||||
if FClosingTabs then
|
if FClosingTabs then
|
||||||
exit;
|
exit;
|
||||||
Application.ProcessMessages; { UI must be up to date before searching candidate tabs }
|
if FAsyncUpdateCloseButtons=svcbNone then exit;
|
||||||
|
FAsyncUpdateCloseButtons:=svcbNone;
|
||||||
|
|
||||||
|
aEnable:=FAsyncUpdateCloseButtons=svcbEnable;
|
||||||
if aEnable and (ResultsNoteBook.PageCount>0) then begin
|
if aEnable and (ResultsNoteBook.PageCount>0) then begin
|
||||||
lPageList := GetPagesOnActiveLine;
|
lPageList := GetPagesOnActiveLine;
|
||||||
if Assigned(lPageList) and (lPageList.Count>0) then
|
if Assigned(lPageList) and (lPageList.Count>0) then
|
||||||
@ -1076,6 +1091,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSearchResultsView.UpdateShowing;
|
||||||
|
begin
|
||||||
|
inherited UpdateShowing;
|
||||||
|
AsyncUpdateCloseButtons:=svcbDisable;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSearchResultsView.TreeViewAdvancedCustomDrawItem(
|
procedure TSearchResultsView.TreeViewAdvancedCustomDrawItem(
|
||||||
Sender: TCustomTreeView; Node: TTreeNode; State: TCustomDrawState;
|
Sender: TCustomTreeView; Node: TTreeNode; State: TCustomDrawState;
|
||||||
Stage: TCustomDrawStage; var PaintImages, DefaultDraw: Boolean);
|
Stage: TCustomDrawStage; var PaintImages, DefaultDraw: Boolean);
|
||||||
@ -1264,6 +1285,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSearchResultsView.SetAsyncUpdateCloseButtons(const AValue: TSVCloseButtonsState);
|
||||||
|
var
|
||||||
|
Old: TSVCloseButtonsState;
|
||||||
|
begin
|
||||||
|
if FAsyncUpdateCloseButtons=AValue then Exit;
|
||||||
|
Old:=FAsyncUpdateCloseButtons;
|
||||||
|
FAsyncUpdateCloseButtons:=AValue;
|
||||||
|
if Old=svcbNone then
|
||||||
|
Application.QueueAsyncCall(@DoAsyncUpdateCloseButtons,0);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLazSearchResultTV.SetSkipped(const AValue: integer);
|
procedure TLazSearchResultTV.SetSkipped(const AValue: integer);
|
||||||
var
|
var
|
||||||
SrcList: TStrings;
|
SrcList: TStrings;
|
||||||
|
Loading…
Reference in New Issue
Block a user