mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-12 17:09:51 +02:00
* Some optimizations from Luiz Americo (bug ID 23022)
git-svn-id: trunk@22586 -
This commit is contained in:
parent
61fecf4562
commit
4f7ac968d9
@ -64,7 +64,7 @@ Type
|
|||||||
Procedure ViewChangedHandler(Sender : TObject); virtual;
|
Procedure ViewChangedHandler(Sender : TObject); virtual;
|
||||||
// Check if APropertyName is published property of AObject.
|
// Check if APropertyName is published property of AObject.
|
||||||
// Only performed if both parameters are not empty.
|
// Only performed if both parameters are not empty.
|
||||||
procedure CheckPropertyName(AObject: TObject; APropertyName: String);
|
procedure CheckPropertyName(AObject: TObject; const APropertyName: String);
|
||||||
// If all CheckObjectSubject and Active are true, call ObjectToView.
|
// If all CheckObjectSubject and Active are true, call ObjectToView.
|
||||||
Procedure MaybeObjectToView;
|
Procedure MaybeObjectToView;
|
||||||
// If all CheckObjectSubject and Active are true, call ViewToObject.
|
// If all CheckObjectSubject and Active are true, call ViewToObject.
|
||||||
@ -137,7 +137,6 @@ Type
|
|||||||
procedure SetComponent(const AValue: TComponent);
|
procedure SetComponent(const AValue: TComponent);
|
||||||
Public
|
Public
|
||||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||||
Procedure ViewChangedHandler(Sender : TObject); override;
|
|
||||||
Published
|
Published
|
||||||
// General component which can be set in Object Inspector
|
// General component which can be set in Object Inspector
|
||||||
Property ViewComponent : TComponent Read FViewComponent Write SetComponent;
|
Property ViewComponent : TComponent Read FViewComponent Write SetComponent;
|
||||||
@ -353,7 +352,7 @@ Type
|
|||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
// If APropName is empty or APropInfo is Nil, a composite mediator will be searched.
|
// If APropName is empty or APropInfo is Nil, a composite mediator will be searched.
|
||||||
function FindDefFor(ASubject: TObject; AGui: TComponent): TMediatorDef; overload;
|
function FindDefFor(ASubject: TObject; AGui: TComponent): TMediatorDef; overload;
|
||||||
function FindDefFor(ASubject: TObject; AGui: TComponent; APropName: string): TMediatorDef; overload;
|
function FindDefFor(ASubject: TObject; AGui: TComponent; const APropName: string): TMediatorDef; overload;
|
||||||
function FindDefFor(ASubject: TObject; AGui: TComponent; APropInfo: PPropInfo): TMediatorDef; overload;
|
function FindDefFor(ASubject: TObject; AGui: TComponent; APropInfo: PPropInfo): TMediatorDef; overload;
|
||||||
function RegisterMediator(MediatorClass: TMediatorClass; MinSubjectClass: TClass): TMediatorDef; overload;
|
function RegisterMediator(MediatorClass: TMediatorClass; MinSubjectClass: TClass): TMediatorDef; overload;
|
||||||
function RegisterMediator(MediatorClass: TMediatorClass; MinSubjectClass: TClass; PropertyName: string): TMediatorDef; overload;
|
function RegisterMediator(MediatorClass: TMediatorClass; MinSubjectClass: TClass; PropertyName: string): TMediatorDef; overload;
|
||||||
@ -365,7 +364,7 @@ Type
|
|||||||
|
|
||||||
function MediatorManager: TMediatorManager;
|
function MediatorManager: TMediatorManager;
|
||||||
Procedure MediatorError(Sender : TObject; Const Msg : String); overload;
|
Procedure MediatorError(Sender : TObject; Const Msg : String); overload;
|
||||||
Procedure MediatorError(Sender : TObject; Fmt : String; Args : Array of const); overload;
|
Procedure MediatorError(Sender : TObject; Const Fmt : String; Args : Array of const); overload;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -400,7 +399,7 @@ begin
|
|||||||
Err:=Msg
|
Err:=Msg
|
||||||
else If Sender is TBaseMediator then
|
else If Sender is TBaseMediator then
|
||||||
begin
|
begin
|
||||||
M:=Sender as TBaseMediator;
|
M:=TBaseMediator(Sender);
|
||||||
V:=M.View;
|
V:=M.View;
|
||||||
S:=M.Subject;
|
S:=M.Subject;
|
||||||
CN:='';
|
CN:='';
|
||||||
@ -429,7 +428,7 @@ begin
|
|||||||
Raise EMediator.Create(Err);
|
Raise EMediator.Create(Err);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure MediatorError(Sender : TObject; Fmt : String; Args : Array of const); overload;
|
Procedure MediatorError(Sender : TObject; const Fmt : String; Args : Array of const); overload;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
MediatorError(Sender,Format(Fmt,Args));
|
MediatorError(Sender,Format(Fmt,Args));
|
||||||
@ -582,7 +581,7 @@ begin
|
|||||||
ValueListChanged;
|
ValueListChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBaseMediator.CheckPropertyName(AObject : TObject; APropertyName : String);
|
procedure TBaseMediator.CheckPropertyName(AObject : TObject; const APropertyName : String);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
If Assigned(AObject) and (APropertyName<>'') then
|
If Assigned(AObject) and (APropertyName<>'') then
|
||||||
@ -808,11 +807,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TComponentMediator.ViewChangedHandler(Sender: TObject);
|
|
||||||
begin
|
|
||||||
inherited ViewChangedHandler(Sender);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TMediatorDef }
|
{ TMediatorDef }
|
||||||
|
|
||||||
function TMediatorDef.Handles(ASubject: TObject; AGui: TComponent; APropInfo: PPropInfo): Boolean;
|
function TMediatorDef.Handles(ASubject: TObject; AGui: TComponent; APropInfo: PPropInfo): Boolean;
|
||||||
@ -910,7 +904,7 @@ begin
|
|||||||
Result := FindDefFor(ASubject, AGUI, PPropInfo(nil));
|
Result := FindDefFor(ASubject, AGUI, PPropInfo(nil));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMediatorManager.FindDefFor(ASubject: TObject; AGui: TComponent; APropName: string): TMediatorDef;
|
function TMediatorManager.FindDefFor(ASubject: TObject; AGui: TComponent; const APropName: string): TMediatorDef;
|
||||||
var
|
var
|
||||||
propinfo: PPropInfo;
|
propinfo: PPropInfo;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user