How to execute UNDO and REDO with delphi component ImageEnVect?
Can anyone tell me where I'm wrong or can tell me a way to develop it?
Here is the code I used:
// ---------------------------------------------------------
procedure TForm1.btnLineaClick(Sender: TObject);
begin
if Assigned ( ImageEnView1.IEBitmap ) then
if btnLinea.Down then
ImageEnView1.Cursor := 1783
else
ImageEnView1.Cursor := 1785;
ImageEnView1.MouseInteractVt := ImageEnView1.MouseInteractVt+ [miPutLine];
end;
// ----------------------------------------------------------------procedure TForm1.btnRettangoloClick(Sender: TObject);
begin
if Assigned ( ImageEnView1.IEBitmap ) then
if btnRettangolo.Down then
ImageEnView1.Cursor := 1783
else
ImageEnView1.Cursor := 1785;
ImageEnView1.MouseInteractVt := ImageEnView1.MouseInteractVt+ [miPutBox];
end;
// ----------------------------------------------------------------
procedure TForm1.btnSelezionaClick(Sender: TObject);
begin
if Assigned ( ImageEnView1.IEBitmap ) then
begin
//ImageEnView1.CopyObjectsToBack;
ImageEnView1.RemoveAllObjects;
ImageEnView1.Cursor := crDefault;
ImageEnView1.MouseInteract := [miSelectmagicWand];
ImageEnView1.MagicWandMode := iewExclusive;
//ImageEnView1.Proc.SaveUndo(ieuObject);
end;
end;
// -----------------------------------------------------------
procedure TForm1.ImageEnView1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if btnRettangolo.Down then
begin
btnRettangoloClick(Sender);
end
else if btnLinea.Down then
begin
btnLineaClick(Sender);
end
else if btnEllisse.Down then
begin
btnEllisseClick(Sender);
end;
ImageEnView1.Proc.ClearAllRedo;
end;
// ----------------------------------------------------------------
procedure TForm1.Annulla1Click(Sender: TObject); // Annulla
begin
Showmessage ('Lista UNDO: '+IntToStr (ImageEnView1.proc.undocount));
with ImageEnView1.proc do
begin
SaveRedo(ieuObject);
Undo;
ClearUndo;
end;
Showmessage ('Lista UNDO: '+IntToStr (ImageEnView1.proc.undocount));
end;
// -------------------------------------------------------------
procedure TForm1.btnColoraClick(Sender: TObject);
begin
if Assigned ( ImageENView1.IEBitmap ) then
begin
if ColorDialog1.Execute then
begin
ImageEnView1.MouseInteract := [];
if ImageEnView1.Focused then
begin
//ImageEnVect1.Proc.CastColor(imageEnVect1.CurrentLayer.ConvXScr2Bmp ( X ), ImageEnVect1.CurrentLayer.ConvYScr2Bmp ( Y ), CreateRGB(175,200,51), 0);
ImageEnView1.Proc.Fill(ColorDialog1.Color);
//ImageEnVect1.Proc.SaveUndo(ieuImage);
ImageEnView1.DeSelect;
end
else
begin
ShowMessage ('Selezionare area da colorare!');
end;
end;
end;
end;
Niko