ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to undo & Redo with ImageEnVect1

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
niko Posted - May 17 2013 : 03:59:07
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
3   L A T E S T    R E P L I E S    (Newest First)
w2m Posted - Mar 21 2014 : 15:35:15
I have never had a need to do this (so I have not tested this) but you can try setting the undo mode:
TIEVUndoMode

Declaration
TIEVUndoMode = (ieumSeparated, ieumShared);

Description
Value ieumShared activates the unique Undo/Redo system for image processing and vectorial objects.

ieumSeparated separates image processing and vectorial undo/redo systems.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Custom ImageEn Development
sviluppo Posted - Mar 21 2014 : 04:05:09
Using the TImageEnVect component, how can I undo to work is if I edit the image and if I insert or delete objects? Do I have to use two separate undo?
w2m Posted - May 17 2013 : 05:52:26
You have to SaveUndo before making a change with ImageEnVect1.Proc...

You have to call ObjSaveUndo before making a change to an object.

To undo a ImageEnVect1.Proc... you need to call ImageEnVect1.Undo;

To undo a change to an object you need to call ImageEnVect1.ObjUndo.

Read the help file for more details.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html