// Set events once a presentation is added to the project // (after creating an empty presentation or opening a XUK file.) private void SetPresentationEvents(urakawa.Presentation presentation) { urakawa.undo.UndoRedoManager undo = presentation.getUndoRedoManager(); undo.commandDone += new EventHandler <urakawa.events.undo.DoneEventArgs>(project_commandDone); undo.commandUnDone += new EventHandler <urakawa.events.undo.UnDoneEventArgs>(project_commandUnDone); undo.commandReDone += new EventHandler <urakawa.events.undo.ReDoneEventArgs>(project_commandReDone); }
/// <summary> /// Undo the last change. /// </summary> public void Undo() { urakawa.undo.UndoRedoManager undo = getPresentation(0).getUndoRedoManager(); if (undo.canUndo()) { undo.undo(); } }
/// <summary> /// Redo the last undone change. /// </summary> public void Redo() { urakawa.undo.UndoRedoManager redo = getPresentation(0).getUndoRedoManager(); if (redo.canRedo()) { redo.redo(); } }
void project_changed(object sender, urakawa.events.DataModelChangedEventArgs e) { if (Project != null && Project.Initialized) { Text = string.Format("Bobi{0}", Project.HasChanges ? "*" : ""); this.file_SaveMenuItem.Enabled = Project.HasChanges; // Undo and redo displays the command that can be un/redone urakawa.undo.UndoRedoManager undo = Project.getPresentation(0).getUndoRedoManager(); this.edit_UndoMenuItem.Enabled = undo.canUndo(); this.edit_UndoMenuItem.Text = string.Format("&Undo{0}", this.edit_UndoMenuItem.Enabled ? " " + undo.getUndoShortDescription() : ""); this.edit_RedoMenuItem.Enabled = Project.getPresentation(0).getUndoRedoManager().canRedo(); this.edit_RedoMenuItem.Text = string.Format("&Redo{0}", this.edit_RedoMenuItem.Enabled ? " " + undo.getRedoShortDescription() : ""); this.edit_SelectAllMenuItem.Enabled = Project.NumberOfTracks > 0; this.edit_SelectNothingMenuItem.Enabled = this.projectView.Selection != null; } }