ImageEn, unit imageenproc

TImageEnProc.Redo

TImageEnProc.Redo


Declaration

procedure Redo(AutoUndo: Boolean = False);


Description

Replaces the current image with the last image in the Redo stack.

Parameter Description
AutoUndo Set to true for automatic undo support. Saves the current state (before redo) to the undo stack (i.e. SaveUndo is called) and removes this entry from the Redo stack (i.e. ClearRedo is called)

Note: AutoUndo should always be set to true if you support multiple undo (i.e. UndoLimit > 1 )




Demo

Demo  Demos\ImageEditing\UndoRedo\UndoRedo.dpr


Example

// Multiple Undo/Redo Example

procedure TForm1.FormCreate(Sender: TObject);
begin
  ImageEnView1.Proc.UndoLimit := 20; // 20 levels of undo
end;

procedure TForm1.ImageEnView1ImageChange(Sender: TObject);
begin
  // When image changes update our menu items
  UpdateMenu();
end;

procedure TForm1.Undo1Click(Sender: TObject);
begin
  // Undo (with automatic saving of redo)
  ImageEnView1.Proc.Undo( True );
  UpdateMenu();
end;

procedure TForm1.Redo1Click(Sender: TObject);
begin
  // Redo (with automatic saving of undo)
  ImageEnView1.Proc.Redo( True );
  UpdateMenu();
end;

procedure TForm1.UpdateMenu();
begin
  // Undo menu
  Undo1.Enabled := ImageEnView1.Proc.CanUndo;
  if ImageEnView1.Proc.CanUndo then
    Undo1.Caption := 'Undo ' + ImageEnView1.Proc.UndoCaptions[0]
  else
    Undo1.Caption := 'Undo';

  // Redo menu
  Redo1.Enabled := ImageEnView1.Proc.CanRedo;
  if ImageEnView1.Proc.CanRedo then
    Redo1.Caption := 'Redo ' + ImageEnView1.Proc.RedoCaptions[0]
  else
    Redo1.Caption := 'Redo';
end;


Compatibility Information

In v6.2.1 and older versions, the AutoUndo parameter was unavailable. Set to False to maintain v6.2.1 functionality


See Also

Public Property  CanRedo
Public Method  ClearAllRedo
Public Method  ClearRedo
Public Method  ClearRedoAt
Public Method  GetUndoInfo
Public Method  RedoAt
Public Property  RedoCaptions
Public Property  RedoCount
Public Method  SaveRedo
Public Method  Undo