fpvectorial: Now BLOCK and INSERT already started to work together

git-svn-id: trunk@39025 -
This commit is contained in:
sekelsenmat 2012-10-09 14:50:23 +00:00
parent 1ce12a8760
commit c74a28fe63

View File

@ -491,15 +491,21 @@ type
function GetNextEntity: TvEntity; function GetNextEntity: TvEntity;
procedure AddEntity(AEntity: TvEntity); procedure AddEntity(AEntity: TvEntity);
procedure Clear; procedure Clear;
//
// Never add a Render() procedure to TvBlock, because blocks are invisible!
end; end;
{@@ {@@
A "Insert" inserts a block into the drawing in the specified position A "Insert" inserts a block into the drawing in the specified position
} }
{ TvInsert }
TvInsert = class(TvEntity) TvInsert = class(TvEntity)
public public
Block: TvBlock; // The block to be inserted Block: TvBlock; // The block to be inserted
procedure Render(ADest: TFPCustomCanvas; ADestX: Integer = 0;
ADestY: Integer = 0; AMulX: Double = 1.0; AMulY: Double = 1.0); override;
end; end;
{ TvVectorialDocument } { TvVectorialDocument }
@ -2255,6 +2261,31 @@ begin
FElements.Clear; FElements.Clear;
end; end;
{ TvInsert }
procedure TvInsert.Render(ADest: TFPCustomCanvas; ADestX: Integer;
ADestY: Integer; AMulX: Double; AMulY: Double);
var
lEntity: TvEntity;
begin
inherited Render(ADest, ADestX, ADestY, AMulX, AMulY);
if Block = nil then Exit;
lEntity := Block.GetFirstEntity();
while lEntity <> nil do
begin
// Alter the position of the elements to consider the positioning of the BLOCK and of the INSERT
lEntity.X := lEntity.X + Block.X + X;
lEntity.Y := lEntity.Y + Block.Y + Y;
// Render
lEntity.Render(ADest, ADestX, ADestY, AMulX, AMuly);
// Change them back
lEntity.X := lEntity.X - Block.X - X;
lEntity.Y := lEntity.Y - Block.Y - Y;
lEntity := Block.GetNextEntity();
end;
end;
{ TvVectorialPage } { TvVectorialPage }
procedure TvVectorialPage.ClearTmpPath; procedure TvVectorialPage.ClearTmpPath;