CommandHistory Class Reference

A history for Command, provides undo/redo functionality. More...

#include <CommandHistory.h>

Inheritance diagram for CommandHistory:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 CommandHistory ()
 ctor.
virtual ~CommandHistory ()
 dtor.
void clear ()
 Erases all the undo/redo history.
void addCommand (Command *command, bool execute=true)
 Adds a command to the history.
virtual void undo ()
 Undoes the last action.
virtual void redo ()
 Redoes the last undone action.
bool canUndo ()
 Return true iff there is a command to undo.
bool canRedo ()
 Return true iff there is a command to redo.

Private Attributes

std::vector< Command * > commands
size_t nextCmd

Detailed Description

A history for Command, provides undo/redo functionality.

To use this, all modifications to the model have to be done through commands that are executed with addCommand();

Definition at line 34 of file CommandHistory.h.


Constructor & Destructor Documentation

CommandHistory::CommandHistory (  ) 

ctor.

Definition at line 36 of file CommandHistory.cpp.

CommandHistory::~CommandHistory (  )  [virtual]

dtor.

Definition at line 41 of file CommandHistory.cpp.

References commands.


Member Function Documentation

void CommandHistory::addCommand ( Command command,
bool  execute = true 
)

Adds a command to the history.

Call this for each command you create. Unless you set execute to false, this will also execute the command. This means, most of the application's code will look like

    MyCommand * cmd = new MyCommand(...);
    m_historyCommand.addCommand( cmd );

Ownership of command is transfered to CommandHistory

Definition at line 63 of file CommandHistory.cpp.

References commands, DEBUG_FATAL, AppBase::Command< StringType >::execute(), and nextCmd.

Referenced by MainFrame::AddImages(), MaskEditorPanel::AddMask(), ImageVariableDialog::ApplyNewVariables(), PanoPanel::BlenderChanged(), ImagesPanel::CPGenerate(), CPEditorPanel::CreateNewPoint(), CPListFrame::DeleteSelected(), PanoPanel::DoCalcFOV(), PanoPanel::DoCalcOptimalROI(), PanoPanel::DoCalcOptimalWidth(), PanoPanel::FileFormatChanged(), CPEditorPanel::FineTuneSelectedPoint(), PanoPanel::HDRFileFormatChanged(), PanoPanel::HeightChanged(), PanoPanel::HFOVChanged(), NonaOptionsDialog::InterpolatorChanged(), MainFrame::LoadProjectFile(), PreviewCropTool::MouseButtonEvent(), DragTool::MouseButtonEvent(), PreviewPanel::mousePressLMBEvent(), PreviewPanel::mousePressRMBEvent(), MainFrame::OnAddImages(), MainFrame::OnAddTimeImages(), MainFrame::OnApplyTemplate(), GLPreviewFrame::OnAutocrop(), PanoPanel::OnBlenderOptions(), CPEditorPanel::OnCelesteButton(), PreviewFrame::OnCenterHorizontally(), GLPreviewFrame::OnCenterHorizontally(), ImageToogleButtonEventHandler::OnChange(), PreviewFrame::OnChangeDisplayedImgs(), PreviewFrame::OnChangeFOV(), GLPreviewFrame::OnChangeFOV(), ImagesTreeCtrl::OnChar(), CPEditorPanel::OnCPEvent(), GLPreviewFrame::OnCreate(), ImagesPanel::OnCropFactorChanged(), GLPreviewFrame::OnCropFactorChanged(), PreviewFrame::OnDecreaseExposure(), GLPreviewFrame::OnDecreaseExposure(), PreviewFrame::OnDefaultExposure(), GLPreviewFrame::OnDefaultExposure(), CPEditorPanel::OnDeleteButton(), PanoDropTarget::OnDropFiles(), ImagesTreeCtrl::OnEndDrag(), ImagesTreeCtrl::OnEndEdit(), ImagesTreeCtrl::OnExecuteOperation(), GLPreviewFrame::OnExposureChanged(), MainFrame::OnFineTuneAll(), PreviewFrame::OnFitPano(), GLPreviewFrame::OnFitPano(), ImagesPanel::OnFocalLengthChanged(), GLPreviewFrame::OnFocalLengthChanged(), PanoPanel::OnFusionOptions(), PanoPanel::OnHDRMergeOptions(), PanoPanel::OnHDRTIFFCompression(), GLPreviewFrame::OnHFOVChanged(), PreviewFrame::OnIncreaseExposure(), GLPreviewFrame::OnIncreaseExposure(), huginApp::OnInit(), PanoPanel::OnJPEGQualityText(), CPEditorPanel::OnKey(), ImagesTreeCtrl::OnLeftDown(), ImagesPanel::OnLensTypeChanged(), GLPreviewFrame::OnLensTypeChanged(), GLPreviewFrame::OnLoadImages(), MaskEditorPanel::OnMaskDelete(), MaskEditorPanel::OnMaskLoad(), MaskEditorPanel::OnMaskPaste(), MaskEditorPanel::OnMaskTypeChange(), ImagesPanel::OnMaxEvDiffChanged(), MainFrame::OnMergeProject(), ImagesPanel::OnMinimumOverlapChanged(), MainFrame::OnNewProject(), PanoPanel::OnNormalTIFFCompression(), PreviewFrame::OnNumTransform(), GLPreviewFrame::OnNumTransform(), ImagesPanel::OnOptimizerSwitchChanged(), PreviewFrame::OnOutputChoice(), PanoPanel::OnOutputFilesChanged(), ImagesPanel::OnPhotometricOptimizerSwitchChanged(), PreviewFrame::OnProjectionChoice(), GLPreviewFrame::OnProjectionChoice(), GLPreviewFrame::OnProjParameterChanged(), PreviewFrame::OnProjParameterReset(), GLPreviewFrame::OnProjParameterReset(), PanoPanel::OnRemapperOptions(), MainFrame::OnRemoveCPinMasks(), OptimizePhotometricPanel::OnReset(), OptimizePanel::OnReset(), GLPreviewFrame::OnResetCrop(), GLPreviewFrame::OnROIChanged(), NonaOptionsDialog::OnSaveCropped(), PreviewFrame::OnShowAll(), GLPreviewFrame::OnShowAll(), PreviewFrame::OnShowNone(), GLPreviewFrame::OnShowNone(), GLPreviewFrame::OnStackAutocrop(), PreviewFrame::OnStraighten(), GLPreviewFrame::OnStraighten(), PreviewFrame::OnTextCtrlChanged(), CPEditorPanel::OnTextPointChange(), GLPreviewFrame::OnVFOVChanged(), ImagesPanel::panoramaChanged(), PanoPanel::ProjectionChanged(), PanoPanel::RemapperChanged(), GLPreviewFrame::ResetTranslationPlaneParameters(), PanoPanel::ROIChanged(), MainFrame::RunAssistant(), ImagesTreeCtrl::SelectAllParameters(), MainFrame::SetGuiLevel(), ImagesTreeCtrl::UnLinkImageVariables(), MaskEditorPanel::UpdateCrop(), GLPreviewFrame::UpdateGlobalWhiteBalance(), MaskEditorPanel::UpdateMask(), PanoPanel::VFOVChanged(), and PanoPanel::WidthChanged().

bool CommandHistory::canRedo (  ) 

Return true iff there is a command to redo.

Definition at line 141 of file CommandHistory.cpp.

References commands, and nextCmd.

Referenced by MainFrame::panoramaChanged().

bool CommandHistory::canUndo (  ) 

Return true iff there is a command to undo.

Definition at line 136 of file CommandHistory.cpp.

References nextCmd.

Referenced by MainFrame::panoramaChanged().

void CommandHistory::clear (  ) 

Erases all the undo/redo history.

Use this when reloading the data, for instance, since this invalidates all the commands.

Definition at line 50 of file CommandHistory.cpp.

References commands, and nextCmd.

Referenced by MainFrame::LoadProjectFile(), huginApp::OnInit(), and MainFrame::OnNewProject().

void CommandHistory::redo (  )  [virtual]

Redoes the last undone action.

Definition at line 116 of file CommandHistory.cpp.

References commands, DEBUG_DEBUG, DEBUG_ERROR, HUGIN_SMART_UNDO, and nextCmd.

Referenced by MainFrame::OnRedo().

void CommandHistory::undo (  )  [virtual]

Undoes the last action.

Definition at line 91 of file CommandHistory.cpp.

References commands, DEBUG_DEBUG, DEBUG_ERROR, HUGIN_SMART_UNDO, and nextCmd.

Referenced by MainFrame::OnUndo().


Member Data Documentation

std::vector<Command*> CommandHistory::commands [private]

Definition at line 82 of file CommandHistory.h.

Referenced by addCommand(), canRedo(), clear(), redo(), undo(), and ~CommandHistory().

size_t CommandHistory::nextCmd [private]

Definition at line 83 of file CommandHistory.h.

Referenced by addCommand(), canRedo(), canUndo(), clear(), redo(), and undo().


The documentation for this class was generated from the following files:
Generated on 26 Nov 2014 for Hugintrunk by  doxygen 1.4.7