mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-21 00:39:10 +02:00
fix ActionListEditor showing, to work with r25457 #811e84764c changes
git-svn-id: trunk@25612 -
This commit is contained in:
parent
f9e656e9a1
commit
f31baf8b4e
@ -150,7 +150,6 @@ type
|
|||||||
private
|
private
|
||||||
FActionList: TActionList;
|
FActionList: TActionList;
|
||||||
FDesigner: TComponentEditorDesigner;
|
FDesigner: TComponentEditorDesigner;
|
||||||
FComponentEditor: TActionListComponentEditor;
|
|
||||||
procedure ResultStdActProc(const Category: string; ActionClass: TBasicActionClass;
|
procedure ResultStdActProc(const Category: string; ActionClass: TBasicActionClass;
|
||||||
ActionProperty: TActStdPropItem; LastItem: Boolean);
|
ActionProperty: TActStdPropItem; LastItem: Boolean);
|
||||||
public
|
public
|
||||||
@ -160,7 +159,6 @@ type
|
|||||||
procedure FillCategories;
|
procedure FillCategories;
|
||||||
procedure FillActionByCategory(iIndex: Integer);
|
procedure FillActionByCategory(iIndex: Integer);
|
||||||
property Designer:TComponentEditorDesigner read FDesigner write FDesigner;
|
property Designer:TComponentEditorDesigner read FDesigner write FDesigner;
|
||||||
property ComponentEditor: TActionListComponentEditor write FComponentEditor;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TActionListComponentEditor }
|
{ TActionListComponentEditor }
|
||||||
@ -169,8 +167,6 @@ type
|
|||||||
private
|
private
|
||||||
FActionList: TActionList;
|
FActionList: TActionList;
|
||||||
FDesigner: TComponentEditorDesigner;
|
FDesigner: TComponentEditorDesigner;
|
||||||
FActionListEditorForm: TActionListEditor;
|
|
||||||
fWindowClosed: Boolean;
|
|
||||||
protected
|
protected
|
||||||
public
|
public
|
||||||
constructor Create(AComponent: TComponent;
|
constructor Create(AComponent: TComponent;
|
||||||
@ -181,7 +177,6 @@ type
|
|||||||
function GetVerbCount: Integer; override;
|
function GetVerbCount: Integer; override;
|
||||||
function GetVerb(Index: Integer): string; override;
|
function GetVerb(Index: Integer): string; override;
|
||||||
procedure ExecuteVerb(Index: Integer); override;
|
procedure ExecuteVerb(Index: Integer); override;
|
||||||
procedure EditorWindowClose;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Action Registration }
|
{ Action Registration }
|
||||||
@ -260,6 +255,49 @@ function CreateAction(TheOwner: TComponent;
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
var
|
||||||
|
EditorForms : TList = nil;
|
||||||
|
|
||||||
|
procedure InitFormsList;
|
||||||
|
begin
|
||||||
|
EditorForms:=TList.Create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure ReleaseFormsList;
|
||||||
|
begin
|
||||||
|
EditorForms.Free;
|
||||||
|
EditorForms:=nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure AddActionEditor(Editor: TActionListEditor);
|
||||||
|
begin
|
||||||
|
if Assigned(EditorForms) and (EditorForms.IndexOf(Editor)<0) then
|
||||||
|
EditorForms.Add(Editor);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure ReleaseActionEditor(Editor: TActionListEditor);
|
||||||
|
var
|
||||||
|
i : Integer;
|
||||||
|
begin
|
||||||
|
if not Assigned(EditorForms) then Exit;
|
||||||
|
i:=EditorForms.IndexOf(Editor);
|
||||||
|
if i>=0 then EditorForms.Delete(i);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function FindActionEditor(AList: TActionList): TActionListEditor;
|
||||||
|
var
|
||||||
|
i : Integer;
|
||||||
|
begin
|
||||||
|
for i:=0 to EditorForms.Count-1 do begin
|
||||||
|
if TActionListEditor(EditorForms[i]).FActionList=AList then begin
|
||||||
|
Result:=TActionListEditor(EditorForms[i]);
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Result:=nil
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
procedure RegisterActions(const ACategory: string;
|
procedure RegisterActions(const ACategory: string;
|
||||||
@ -853,13 +891,17 @@ begin
|
|||||||
GlobalDesignHook.AddHandlerComponentRenamed(@OnComponentRenamed);
|
GlobalDesignHook.AddHandlerComponentRenamed(@OnComponentRenamed);
|
||||||
GlobalDesignHook.AddHandlerSetSelection(@OnComponentSelection);
|
GlobalDesignHook.AddHandlerSetSelection(@OnComponentSelection);
|
||||||
GlobalDesignHook.AddHandlerRefreshPropertyValues(@OnRefreshPropertyValues);
|
GlobalDesignHook.AddHandlerRefreshPropertyValues(@OnRefreshPropertyValues);
|
||||||
|
|
||||||
|
AddActionEditor(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TActionListEditor.Destroy;
|
destructor TActionListEditor.Destroy;
|
||||||
begin
|
begin
|
||||||
if Assigned(GlobalDesignHook)
|
if Assigned(GlobalDesignHook)
|
||||||
then GlobalDesignHook.RemoveAllHandlersForObject(Self);
|
then GlobalDesignHook.RemoveAllHandlersForObject(Self);
|
||||||
FComponentEditor.EditorWindowClose;
|
|
||||||
|
ReleaseActionEditor(Self);
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -982,44 +1024,36 @@ end;
|
|||||||
|
|
||||||
{ TActionListComponentEditor }
|
{ TActionListComponentEditor }
|
||||||
|
|
||||||
procedure TActionListComponentEditor.EditorWindowClose;
|
|
||||||
begin
|
|
||||||
fWindowClosed := True;
|
|
||||||
end;
|
|
||||||
|
|
||||||
constructor TActionListComponentEditor.Create(AComponent: TComponent;
|
constructor TActionListComponentEditor.Create(AComponent: TComponent;
|
||||||
ADesigner: TComponentEditorDesigner);
|
ADesigner: TComponentEditorDesigner);
|
||||||
begin
|
begin
|
||||||
inherited Create(AComponent, ADesigner);
|
inherited Create(AComponent, ADesigner);
|
||||||
FDesigner := ADesigner;
|
FDesigner := ADesigner;
|
||||||
fWindowClosed := True;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TActionListComponentEditor.Destroy;
|
destructor TActionListComponentEditor.Destroy;
|
||||||
begin
|
begin
|
||||||
if not fWindowClosed
|
|
||||||
then FreeThenNil(FActionListEditorForm);
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TActionListComponentEditor.Edit;
|
procedure TActionListComponentEditor.Edit;
|
||||||
var
|
var
|
||||||
AActionList: TActionList;
|
AActionList: TActionList;
|
||||||
|
AEditor: TActionListEditor;
|
||||||
begin
|
begin
|
||||||
AActionList := GetComponent as TActionList;
|
AActionList := GetComponent as TActionList;
|
||||||
if AActionList = nil
|
if AActionList = nil
|
||||||
then raise Exception.Create('TActionListComponentEditor.Edit AActionList=nil');
|
then raise Exception.Create('TActionListComponentEditor.Edit AActionList=nil');
|
||||||
if fWindowClosed then begin
|
AEditor:=FindActionEditor(AActionList);
|
||||||
FActionListEditorForm := TActionListEditor.Create(Application);
|
if not Assigned(AEditor) then begin
|
||||||
fWindowClosed := False;
|
AEditor:=TActionListEditor.Create(Application);
|
||||||
end;
|
with AEditor do begin
|
||||||
with FActionListEditorForm do begin
|
lstActionName.ItemIndex := -1;
|
||||||
lstActionName.ItemIndex := -1;
|
Designer := Self.FDesigner;
|
||||||
Designer := Self.FDesigner;
|
SetActionList(AActionList);
|
||||||
SetActionList(AActionList);
|
end;
|
||||||
ComponentEditor := Self;
|
|
||||||
ShowOnTop;
|
|
||||||
end;
|
end;
|
||||||
|
AEditor.ShowOnTop;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TActionListComponentEditor.GetVerbCount: Integer;
|
function TActionListComponentEditor.GetVerbCount: Integer;
|
||||||
@ -1334,8 +1368,10 @@ initialization
|
|||||||
RegisterComponentEditor(TActionList,TActionListComponentEditor);
|
RegisterComponentEditor(TActionList,TActionListComponentEditor);
|
||||||
RegisterStandardActions;
|
RegisterStandardActions;
|
||||||
RegisterPropertyEditor(TypeInfo(string), TContainedAction, 'Category', TActionCategoryProperty);
|
RegisterPropertyEditor(TypeInfo(string), TContainedAction, 'Category', TActionCategoryProperty);
|
||||||
|
InitFormsList;
|
||||||
|
|
||||||
finalization
|
finalization
|
||||||
|
ReleaseFormsList;
|
||||||
RegisteredActions.Free;
|
RegisteredActions.Free;
|
||||||
RegisteredActions := nil;
|
RegisteredActions := nil;
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user