Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Gambas class file
- Private listaEstadosUndo As New State[] 'lista de undo deshacer
- Private listaEstadosRedo As New State[] 'lista de rehacer
- '---------------------------------------------------------
- 'UNDO
- '---------------------------------------------------------
- Public Sub addMementoUndo(s As State)
- listaEstadosUndo.Add(s)
- End
- Public Sub addMementoRedo(s As State)
- listaEstadosRedo.Add(s)
- End
- Public Function getMementoUndo() As State
- 'devuelve y borra el ultimo estado de la lista...
- Dim s As State
- If listaEstadosUndo.count > 0 Then
- s = listaEstadosUndo.Pop()
- addMementoRedo(s)
- Return s
- Else
- Return Null
- Endif
- End
- Public Function getEstadosGuardadosUndo() As Integer
- Return listaEstadosUndo.Count
- End
- Public Sub BorrarEstadosUndo()
- listaEstadosUndo.Clear()
- End
- '-------------------------------------------------------
- 'REDO
- '-------------------------------------------------------
- Public Function getMementoRedo() As State
- 'devuelve y borra el ultimo estado de la lista...
- Dim s As State
- If listaEstadosRedo.Count > 0 Then
- s = listaEstadosRedo.Pop()
- addMementoUndo(s)
- Return s
- Else
- Return Null
- Endif
- End
- Public Function getEstadosGuardadosRedo() As Integer
- Return listaEstadosRedo.Count
- End
- Public Sub BorrarEstadosRedo()
- listaEstadosRedo.Clear()
- End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement