Path: ../lib/fox/undolist.rb
Modified: Wed Feb 05 18:30:45 CST 2003

This is a "pure Ruby" implementation of the FXUndoList and FXCommand classes from the standard FOX distribution. Since those classes are independent of the rest of FOX this is a simpler (and probably more efficient) approach than trying to wrap the original C++ classes.

Notes (by Jeroen, lifted from FXUndoList.cpp):

  • When a command is undone, it's moved to the redo list.
  • When a command is redone, it's moved back to the undo list.
  • Whenever adding a new command, the redo list is deleted.
  • At any time, you can trim down the undo list down to a given maximum size or a given number of undo records. This should keep the memory overhead within sensible bounds.
  • To keep track of when we get back to an "unmodified" state, a mark can be set. The mark is basically a counter which is incremented with every undo record added, and decremented when undoing a command. When we get back to 0, we are back to the unmodified state.

    If, after setting the mark, we have called FXUndoList#undo, then the mark can be reached by calling FXUndoList#redo.

    If the marked position is in the redo-list, then adding a new undo record will cause the redo-list to be deleted, and the marked position will become unreachable.

    The marked state may also become unreachable when the undo list is trimmed.

  • You can call also kill the redo list without adding a new command to the undo list, although this may cause the marked position to become unreachable.
  • We measure the size of the undo-records in the undo-list; when the records are moved to the redo-list, they usually contain different information!
Required files
fox    fox/responder   
Classes and Modules
Module Fox
  ::Class Fox::FX4Splitter
  ::Class Fox::FXAccelTable
  ::Class Fox::FXApp
  ::Class Fox::FXArc
  ::Class Fox::FXArrowButton
  ::Class Fox::FXBMPIcon
  ::Class Fox::FXBMPImage
  ::Class Fox::FXBitmap
  ::Class Fox::FXButton
  ::Class Fox::FXCURCursor
  ::Class Fox::FXCalendar
  ::Class Fox::FXCanvas
  ::Class Fox::FXCheckButton
  ::Class Fox::FXColorBar
  ::Class Fox::FXColorDialog
  ::Class Fox::FXColorSelector
  ::Class Fox::FXColorWell
  ::Class Fox::FXColorWheel
  ::Class Fox::FXComboBox
  ::Class Fox::FXCommand
  ::Class Fox::FXComposite
  ::Class Fox::FXCursor
  ::Class Fox::FXDC
  ::Class Fox::FXDCWindow
  ::Class Fox::FXDataTarget
  ::Class Fox::FXDebugTarget
  ::Class Fox::FXDelegator
  ::Class Fox::FXDialogBox
  ::Class Fox::FXDict
  ::Class Fox::FXDrawable
  ::Class Fox::FXEvent
  ::Class Fox::FXFont
  ::Class Fox::FXFontDesc
  ::Class Fox::FXFrame
  ::Class Fox::FXGIFIcon
  ::Class Fox::FXGLCanvas
  ::Class Fox::FXGLCone
  ::Class Fox::FXGLCube
  ::Class Fox::FXGLCylinder
  ::Class Fox::FXGLGroup
  ::Class Fox::FXGLLine
  ::Class Fox::FXGLPoint
  ::Class Fox::FXGLSphere
  ::Class Fox::FXGLVisual
  ::Class Fox::FXGroupBox
  ::Class Fox::FXHiliteStyle
  ::Class Fox::FXHorizontalFrame
  ::Class Fox::FXIcon
  ::Class Fox::FXIconItem
  ::Class Fox::FXIconList
  ::Class Fox::FXId
  ::Class Fox::FXImage
  ::Class Fox::FXLabel
  ::Class Fox::FXList
  ::Class Fox::FXListItem
  ::Class Fox::FXMainWindow
  ::Class Fox::FXMatrix
  ::Class Fox::FXMenuButton
  ::Class Fox::FXMenuCaption
  ::Class Fox::FXMenuCascade
  ::Class Fox::FXMenuCommand
  ::Class Fox::FXMenuPane
  ::Class Fox::FXMenuSeparator
  ::Class Fox::FXMenuTitle
  ::Class Fox::FXMenubar
  ::Class Fox::FXObject
  ::Class Fox::FXPacker
  ::Class Fox::FXPoint
  ::Class Fox::FXPseudoTarget
  ::Class Fox::FXRadioButton
  ::Class Fox::FXRange
  ::Class Fox::FXRecentFiles
  ::Class Fox::FXRectangle
  ::Class Fox::FXRegistry
  ::Class Fox::FXScrollArea
  ::Class Fox::FXSegment
  ::Class Fox::FXSettings
  ::Class Fox::FXShell
  ::Class Fox::FXSize
  ::Class Fox::FXTable
  ::Class Fox::FXTableItem
  ::Class Fox::FXTablePos
  ::Class Fox::FXTableRange
  ::Class Fox::FXText
  ::Class Fox::FXTextField
  ::Class Fox::FXToggleButton
  ::Class Fox::FXToolbar
  ::Class Fox::FXToolbarGrip
  ::Class Fox::FXToolbarShell
  ::Class Fox::FXTooltip
  ::Class Fox::FXTopWindow
  ::Class Fox::FXTreeItem
  ::Class Fox::FXTreeList
  ::Class Fox::FXUndoList
  ::Class Fox::FXVerticalFrame
  ::Class Fox::FXWindow