IDE: removed designer method hack

git-svn-id: trunk@23063 -
This commit is contained in:
mattias 2009-12-10 11:23:56 +00:00
parent af265e5363
commit 4be10ae220
6 changed files with 1 additions and 47 deletions

View File

@ -2,7 +2,7 @@
This source is only used to compile and install the package.
}
unit CodeTools;
unit codetools;
interface

View File

@ -958,9 +958,7 @@ begin
DestroyDriver:=false;
Writer := CreateLRSWriter(BinCompStream,DestroyDriver);
try
{$IFNDEF DisableFakeMethods}
Writer.OnWriteMethodProperty:=@BaseFormEditor1.WriteMethodPropertyEvent;
{$ENDIF}
Writer.Root:=FLookupRoot;
Writer.WriteComponent(CurComponent);
finally

View File

@ -1365,12 +1365,7 @@ function TJITComponentList.CreateNewMethod(JITComponent: TComponent;
const AName: ShortString): TMethod;
var
OldCode: Pointer;
{$IFNDEF DisableFakeMethods}
JITMethod: TJITMethod;
{$ELSE}
CodeTemplate, NewCode: Pointer;
CodeSize: integer;
{$ENDIF}
begin
{$IFDEF VerboseJITForms}
debugln('TJITComponentList.CreateNewMethod ',JITComponent.Name,':',JITComponent.Name,' Method=',AName);
@ -1389,19 +1384,9 @@ begin
Result.Code:=OldCode;
exit;
end;
{$IFNDEF DisableFakeMethods}
// create a TJITMethod
JITMethod:=JITMethods.Add(JITComponent.ClassType,AName);
Result:=JITMethod.Method;
{$ELSE}
CodeTemplate:=MethodAddress('DoNothing');
CodeSize:=100; // !!! what is the real codesize of DoNothing? !!!
GetMem(NewCode,CodeSize);
Move(CodeTemplate^,NewCode^,CodeSize);
DoAddNewMethod(JITComponent.ClassType,AName,NewCode);
Result.Data:=JITComponent;
Result.Code:=NewCode;
{$ENDIF}
end;
procedure TJITComponentList.Notification(AComponent: TComponent;
@ -1700,24 +1685,11 @@ end;
}
procedure TJITComponentList.ReaderFindMethod(Reader: TReader;
const FindMethodName: Ansistring; var Address: Pointer; var Error: Boolean);
{$IFDEF DisableFakeMethods}
var NewMethod: TMethod;
{$ENDIF}
begin
{$IFDEF IDE_DEBUG}
debugln('[TJITComponentList.ReaderFindMethod] A "'+FindMethodName+'" Address=',DbgS(Address));
{$ENDIF}
{$IFNDEF DisableFakeMethods}
RaiseGDBException('TJITComponentList.ReaderFindMethod this event should never be called -> this is a bug in TReader, or misuse of TReader.OnFindMethod');
{$ELSE}
if Address=nil then begin
// there is no method in the ancestor class with this name
// => add a JIT method with this name to the JITForm
NewMethod:=CreateNewMethod(FCurReadJITComponent,FindMethodName);
Address:=NewMethod.Code;
Error:=false;
end;
{$ENDIF}
end;
procedure TJITComponentList.ReaderPropertyNotFound(Reader: TReader;
@ -1733,14 +1705,11 @@ end;
procedure TJITComponentList.ReaderSetMethodProperty(Reader: TReader;
Instance: TPersistent; PropInfo: PPropInfo; const TheMethodName: string;
var Handled: boolean);
{$IFNDEF DisableFakeMethods}
var
Method: TMethod;
JITMethod: TJITMethod;
CurLookupRoot: TPersistent;
{$ENDIF}
begin
{$IFNDEF DisableFakeMethods}
//debugln('TJITComponentList.ReaderSetMethodProperty ',DbgSName(Instance),' LookupRoot=',DbgSName(Reader.LookupRoot),' ',PropInfo^.Name,':=',TheMethodName);
Method.Code:=FCurReadJITComponent.MethodAddress(TheMethodName);
if Method.Code<>nil then begin
@ -1768,7 +1737,6 @@ begin
SetMethodProp(Instance, PropInfo, Method);
Handled:=true;
{$ENDIF}
end;
procedure TJITComponentList.ReaderSetName(Reader: TReader;

View File

@ -1381,12 +1381,9 @@ end;
procedure TCustomFormEditor.WriteMethodPropertyEvent(Writer: TWriter;
Instance: TPersistent; PropInfo: PPropInfo;
const MethodValue, DefMethodValue: TMethod; var Handled: boolean);
{$IFNDEF DisableFakeMethods}
var
CurName: String;
{$ENDIF}
begin
{$IFNDEF DisableFakeMethods}
Handled:=true;
//DebugLn(['TCustomFormEditor.WriteMethodPropertyEvent ',GlobalDesignHook.GetMethodName(MethodValue,nil)]);
@ -1405,7 +1402,6 @@ begin
CurName:='';
Writer.Driver.WriteMethodName(CurName);
Writer.Driver.EndProperty;
{$ENDIF}
end;
function TCustomFormEditor.SaveUnitComponentToBinStream(AnUnitInfo: TUnitInfo;
@ -1436,9 +1432,7 @@ begin
try
BinCompStream.Position:=0;
Writer:=CreateLRSWriter(BinCompStream,DestroyDriver);
{$IFNDEF DisableFakeMethods}
Writer.OnWriteMethodProperty:=@WriteMethodPropertyEvent;
{$ENDIF}
Writer.OnFindAncestor:=@WriterFindAncestor;
AncestorUnit:=AnUnitInfo.FindAncestorUnit;
Ancestor:=nil;

View File

@ -28,10 +28,6 @@
{ $DEFINE IDE_DEBUG}
{$IFDEF VER2_0}
{$DEFINE DisableFakeMethods}
{$ENDIF}
{$DEFINE VerboseIDEMultiForm}
{off $apptype console}

View File

@ -4848,9 +4848,7 @@ begin
end;
if HasI18N then
Grubber:=TLRTGrubber.Create(Writer);
{$IFNDEF DisableFakeMethods}
Writer.OnWriteMethodProperty:=@FormEditor1.WriteMethodPropertyEvent;
{$ENDIF}
//DebugLn(['TMainIDE.DoSaveUnitComponent AncestorInstance=',dbgsName(AncestorInstance)]);
Writer.OnFindAncestor:=@FormEditor1.WriterFindAncestor;
AncestorUnit:=AnUnitInfo.FindAncestorUnit;