| 1 |
{%MainUnit castlepropedits.pas} |
| 2 |
{ |
| 3 |
Copyright 2022-2022 Michalis Kamburelis. |
| 4 |
|
| 5 |
This file is part of "Castle Game Engine". |
| 6 |
|
| 7 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 8 |
included in this distribution, for details about the copyright. |
| 9 |
|
| 10 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
|
| 14 |
---------------------------------------------------------------------------- |
| 15 |
} |
| 16 |
|
| 17 |
type |
| 18 |
{ Editor for TCastleTransform. } |
| 19 |
TCastleTransformComponentEditor = class(TComponentEditor) |
| 20 |
public |
| 21 |
function GetVerbCount: Integer; override; |
| 22 |
function GetVerb(Index: Integer): string; override; |
| 23 |
procedure ExecuteVerb(Index: Integer); override; |
| 24 |
end; |
| 25 |
|
| 26 |
function TCastleTransformComponentEditor.GetVerbCount: Integer; |
| 27 |
begin |
| 28 |
Result := (inherited GetVerbCount) + 1; |
| 29 |
end; |
| 30 |
|
| 31 |
function TCastleTransformComponentEditor.GetVerb(Index: Integer): string; |
| 32 |
var |
| 33 |
InheritedCount: Integer; |
| 34 |
begin |
| 35 |
InheritedCount := inherited GetVerbCount; |
| 36 |
if Index < InheritedCount then |
| 37 |
Result := inherited GetVerb(Index) |
| 38 |
else |
| 39 |
if Index = InheritedCount then |
| 40 |
begin |
| 41 |
Result := 'Reset Transformation'; |
| 42 |
end else |
| 43 |
Result := ''; |
| 44 |
end; |
| 45 |
|
| 46 |
procedure TCastleTransformComponentEditor.ExecuteVerb(Index: Integer); |
| 47 |
var |
| 48 |
InheritedCount: Integer; |
| 49 |
begin |
| 50 |
InheritedCount := inherited GetVerbCount; |
| 51 |
if Index < InheritedCount then |
| 52 |
inherited ExecuteVerb(Index) |
| 53 |
else |
| 54 |
if Index = InheritedCount then |
| 55 |
begin |
| 56 |
(Component as TCastleTransform).Identity; |
| 57 |
GetDesigner.Modified; |
| 58 |
end else |
| 59 |
WritelnWarning('TCastleTransformComponentEditor.ExecuteVerb invalid verb index: %d', [Index]); |
| 60 |
end; |