mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-01-04 14:51:31 +01:00
fixed calling CreateFormEditor
git-svn-id: trunk@7863 -
This commit is contained in:
parent
f8cf04723c
commit
4a15b32072
@ -22,6 +22,10 @@ program bitbutton;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
{$IFDEF Win32}
|
||||
{$APPTYPE GUI}
|
||||
{$ENDIF}
|
||||
|
||||
uses
|
||||
interfaces, forms, bitbtnform;
|
||||
|
||||
|
||||
@ -31,8 +31,8 @@ unit FormEditor;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, CustomFormEditor, Controls, Forms, Buttons, SysUtils, Graphics,
|
||||
ObjectInspector, Designer, IDECommands, FormEditingIntf;
|
||||
Classes, LCLProc, Controls, Forms, Buttons, SysUtils, Graphics,
|
||||
ObjectInspector, Designer, IDECommands, FormEditingIntf, CustomFormEditor;
|
||||
|
||||
type
|
||||
|
||||
@ -47,7 +47,7 @@ type
|
||||
end;
|
||||
|
||||
var
|
||||
FormEditor1: TFormEditor;
|
||||
FormEditor1: TFormEditor = nil;
|
||||
|
||||
procedure CreateFormEditor;
|
||||
procedure FreeFormEditor;
|
||||
@ -57,13 +57,16 @@ implementation
|
||||
|
||||
procedure CreateFormEditor;
|
||||
begin
|
||||
FormEditor1 := TFormEditor.Create;
|
||||
FormEditingHook := FormEditor1;
|
||||
IDECmdScopeDesignerOnly.AddWindowClass(TDesignerIDECommandForm);
|
||||
if FormEditor1=nil then begin
|
||||
FormEditor1 := TFormEditor.Create;
|
||||
FormEditingHook := FormEditor1;
|
||||
IDECmdScopeDesignerOnly.AddWindowClass(TDesignerIDECommandForm);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure FreeFormEditor;
|
||||
begin
|
||||
if FormEditor1=nil then exit;
|
||||
FormEditingHook:=nil;
|
||||
FormEditor1.Free;
|
||||
FormEditor1:=nil;
|
||||
|
||||
@ -2756,18 +2756,21 @@ var
|
||||
begin
|
||||
Result:=nil;
|
||||
if Key.Key1=VK_UNKNOWN then exit;
|
||||
for a:=0 to FRelations.Count-1 do with Relations[a] do begin
|
||||
if (Category.Scope<>nil)
|
||||
and (not Category.Scope.HasIDEWindowClass(IDEWindowClass)) then continue;
|
||||
if ((ShortcutA.Key1=Key.Key1) and (ShortcutA.Shift1=Key.Shift1) and
|
||||
(ShortcutA.Key2=Key.Key2) and (ShortcutA.Shift2=Key.Shift2))
|
||||
or ((ShortcutB.Key1=Key.Key1) and (ShortcutB.Shift1=Key.Shift1) and
|
||||
(ShortcutB.Key2=Key.Key2) and (ShortcutB.Shift2=Key.Shift2)) then
|
||||
begin
|
||||
Result:=Relations[a];
|
||||
exit;
|
||||
for a:=0 to FRelations.Count-1 do
|
||||
with Relations[a] do begin
|
||||
//if Command=ecDesignerSelectParent then
|
||||
// debugln('TKeyCommandRelationList.Find A ',Category.Scope.Name,' ',dbgsName(IDEWindowClass),' ',dbgs(IDECmdScopeDesignerOnly.IDEWindowClassCount),' ',dbgsName(IDECmdScopeDesignerOnly.IDEWindowClasses[0]));
|
||||
if (Category.Scope<>nil)
|
||||
and (not Category.Scope.HasIDEWindowClass(IDEWindowClass)) then continue;
|
||||
if ((ShortcutA.Key1=Key.Key1) and (ShortcutA.Shift1=Key.Shift1) and
|
||||
(ShortcutA.Key2=Key.Key2) and (ShortcutA.Shift2=Key.Shift2))
|
||||
or ((ShortcutB.Key1=Key.Key1) and (ShortcutB.Shift1=Key.Shift1) and
|
||||
(ShortcutB.Key2=Key.Key2) and (ShortcutB.Shift2=Key.Shift2)) then
|
||||
begin
|
||||
Result:=Relations[a];
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TKeyCommandRelationList.FindIDECommand(ACommand: word
|
||||
|
||||
@ -1422,7 +1422,7 @@ end;
|
||||
|
||||
procedure TMainIDE.SetupFormEditor;
|
||||
begin
|
||||
FormEditor1 := TFormEditor.Create;
|
||||
CreateFormEditor;
|
||||
FormEditor1.Obj_Inspector := ObjectInspector1;
|
||||
end;
|
||||
|
||||
@ -3410,8 +3410,6 @@ begin
|
||||
CodeToolBoss.CreateFile(ChangeFileExt(NewUnitInfo.Filename,'.lfm'));
|
||||
|
||||
// clear formeditor
|
||||
if not Assigned(FormEditor1) then
|
||||
FormEditor1 := TFormEditor.Create;
|
||||
FormEditor1.ClearSelection;
|
||||
|
||||
// Figure out where we want to put the new form
|
||||
@ -4424,8 +4422,6 @@ begin
|
||||
TxtLFMStream.Free;
|
||||
end;
|
||||
if ComponentLoadingOk then begin
|
||||
if not Assigned(FormEditor1) then
|
||||
FormEditor1 := TFormEditor.Create;
|
||||
if not (ofProjectLoading in Flags) then FormEditor1.ClearSelection;
|
||||
|
||||
// create JIT component
|
||||
|
||||
@ -60,7 +60,7 @@ type
|
||||
function GetCategories(Index: integer): TIDECommandCategory;
|
||||
function GetIDEWindowClasses(Index: integer): TCustomFormClass;
|
||||
public
|
||||
constructor Create;
|
||||
constructor Create(const TheName: string);
|
||||
destructor Destroy; override;
|
||||
procedure AddWindowClass(AWindowClass: TCustomFormClass);
|
||||
procedure RemoveWindowClass(AWindowClass: TCustomFormClass);
|
||||
@ -369,7 +369,7 @@ end;
|
||||
|
||||
function RegisterIDECommandScope(const Name: string): TIDECommandScope;
|
||||
begin
|
||||
Result:=TIDECommandScope.Create;
|
||||
Result:=TIDECommandScope.Create(Name);
|
||||
IDECommandScopes.Add(Result);
|
||||
end;
|
||||
|
||||
@ -585,8 +585,9 @@ begin
|
||||
Result:=TCustomFormClass(FIDEWindowClasses[Index]);
|
||||
end;
|
||||
|
||||
constructor TIDECommandScope.Create;
|
||||
constructor TIDECommandScope.Create(const TheName: string);
|
||||
begin
|
||||
FName:=TheName;
|
||||
FIDEWindowClasses:=TFPList.Create;
|
||||
FCategories:=TFPList.Create;
|
||||
end;
|
||||
@ -630,10 +631,11 @@ var
|
||||
i: Integer;
|
||||
begin
|
||||
if AWindowClass<>nil then begin
|
||||
for i:=0 to FIDEWindowClasses.Count-1 do
|
||||
for i:=0 to FIDEWindowClasses.Count-1 do begin
|
||||
if (FIDEWindowClasses[i]=nil)
|
||||
or AWindowClass.InheritsFrom(TCustomFormClass(FIDEWindowClasses[i])) then
|
||||
exit(true);
|
||||
end;
|
||||
end else begin
|
||||
if FIDEWindowClasses.IndexOf(nil)>=0 then
|
||||
exit(true);
|
||||
|
||||
16
lcl/forms.pp
16
lcl/forms.pp
@ -1370,22 +1370,8 @@ end;
|
||||
|
||||
function InitResourceComponent(Instance: TComponent;
|
||||
RootAncestor: TClass):Boolean;
|
||||
//var LocalizedLoading: Boolean;
|
||||
begin
|
||||
//GlobalNameSpace.BeginWrite; // hold lock across all ancestor loads (performance)
|
||||
try
|
||||
//LocalizedLoading:=(Instance.ComponentState * [csInline,csLoading])=[];
|
||||
//if LocalizedLoading then BeginGlobalLoading; // push new loadlist onto stack
|
||||
try
|
||||
Result:=InitLazResourceComponent(Instance,RootAncestor);
|
||||
//Result:=InitComponent(Instance.ClassType);
|
||||
//if LocalizedLoading then NotifyGlobalLoading; // call Loaded
|
||||
finally
|
||||
//if LocalizedLoading then EndGlobalLoading; // pop loadlist off stack
|
||||
end;
|
||||
finally
|
||||
//GlobalNameSpace.EndWrite;
|
||||
end;
|
||||
Result:=InitLazResourceComponent(Instance,RootAncestor);
|
||||
end;
|
||||
|
||||
function FindRootDesigner(AComponent: TComponent): TIDesigner;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user