Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
PanoCommand::CommandHistory Class Reference

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

#include <CommandHistory.h>

Inheritance diagram for PanoCommand::CommandHistory:
Inheritance graph

Public Member Functions

 CommandHistory ()
 ctor. More...
 
virtual ~CommandHistory ()
 dtor. More...
 
void clear ()
 Erases all the undo/redo history. More...
 
void clearRedoQueue ()
 clear all commands in the redo queue More...
 
void addCommand (PanoCommand *command, bool execute=true)
 Adds a command to the history. More...
 
virtual void undo ()
 Undoes the last action. More...
 
virtual void redo ()
 Redoes the last undone action. More...
 
bool canUndo () const
 Return true iff there is a command to undo. More...
 
bool canRedo () const
 Return true iff there is a command to redo. More...
 
std::string getLastCommandName () const
 returns the name of the last command More...
 
const PanoCommandgetLastCommand () const
 return the last PanoCommand More...
 

Private Attributes

std::vector< PanoCommand * > 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 38 of file CommandHistory.h.

Constructor & Destructor Documentation

PanoCommand::CommandHistory::CommandHistory ( )

ctor.

Definition at line 38 of file CommandHistory.cpp.

PanoCommand::CommandHistory::~CommandHistory ( )
virtual

dtor.

Definition at line 43 of file CommandHistory.cpp.

References commands.

Member Function Documentation

void PanoCommand::CommandHistory::addCommand ( PanoCommand 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 73 of file CommandHistory.cpp.

References clearRedoQueue(), commands, DEBUG_FATAL, and nextCmd.

Referenced by MainFrame::AddImages(), PreviewEditCPTool::AddLineCP(), MaskEditorPanel::AddMask(), ImageVariableDialog::ApplyNewVariables(), PanoPanel::BlenderChanged(), CPEditorPanel::CreateNewPoint(), CPListCtrl::DeleteSelected(), PanoPanel::DoCalcFOV(), PanoPanel::DoCalcOptimalROI(), PanoPanel::DoCalcOptimalWidth(), PanoPanel::FileFormatChanged(), CPEditorPanel::FineTuneSelectedPoint(), PanoPanel::HDRFileFormatChanged(), PanoPanel::HeightChanged(), PanoPanel::HFOVChanged(), Papywizard::ImportPapywizardFile(), GLPreviewFrame::LoadImages(), MainFrame::LoadProjectFile(), PreviewCropTool::MouseButtonEvent(), DragTool::MouseButtonEvent(), PreviewPanel::mousePressLMBEvent(), PreviewPanel::mousePressRMBEvent(), ImagesTreeCtrl::OnActivateImage(), MainFrame::OnAddImages(), MainFrame::OnAddTimeImages(), MainFrame::OnApplyTemplate(), GLPreviewFrame::OnAutocrop(), GLPreviewFrame::OnAutocropOutside(), PanoPanel::OnBlenderOptions(), CPEditorPanel::OnCelesteButton(), PreviewFrame::OnCenterHorizontally(), GLPreviewFrame::OnCenterHorizontally(), ImageToogleButtonEventHandler::OnChange(), PreviewFrame::OnChangeDisplayedImgs(), PreviewFrame::OnChangeFOV(), GLPreviewFrame::OnChangeFOV(), ImagesTreeCtrl::OnChar(), CPEditorPanel::OnCleanCPButton(), CPEditorPanel::OnCPEvent(), GLPreviewFrame::OnCreate(), GLPreviewFrame::OnCreateCP(), ImagesPanel::OnCropFactorChanged(), ImagesTreeCtrl::OnDeactivateImage(), PreviewFrame::OnDecreaseExposure(), GLPreviewFrame::OnDecreaseExposure(), PreviewFrame::OnDefaultExposure(), GLPreviewFrame::OnDefaultExposure(), CPEditorPanel::OnDeleteButton(), PanoDropTarget::OnDropFiles(), PanoPanel::OnEdgeFillChanged(), PanoPanel::OnEdgeFillOptions(), ImagesTreeCtrl::OnEndEdit(), ImagesTreeCtrl::OnExecuteOperation(), GLPreviewFrame::OnExposureChanged(), MainFrame::OnFineTuneAll(), PreviewFrame::OnFitPano(), GLPreviewFrame::OnFitPano(), ImagesPanel::OnFocalLengthChanged(), PanoPanel::OnFusionOptions(), PanoPanel::OnHDRMergeOptions(), PanoPanel::OnHDRTIFFCompression(), GLPreviewFrame::OnHFOVChanged(), PreviewFrame::OnIncreaseExposure(), GLPreviewFrame::OnIncreaseExposure(), huginApp::OnInit(), PanoPanel::OnJPEGQualityText(), CPEditorPanel::OnKey(), ImagesTreeCtrl::OnLeftUp(), ImagesPanel::OnLensTypeChanged(), MainFrame::OnLoadingFailed(), 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(), GLPreviewFrame::OnRangeCompressionChanged(), PreviewFrame::OnRangeCompressionDecrease(), GLPreviewFrame::OnRangeCompressionDecrease(), PreviewFrame::OnRangeCompressionIncrease(), GLPreviewFrame::OnRangeCompressionIncrease(), PanoPanel::OnRemapperOptions(), GLPreviewFrame::OnRemoveCP(), MainFrame::OnRemoveCPinMasks(), OptimizePhotometricPanel::OnReset(), OptimizePanel::OnReset(), GLPreviewFrame::OnResetCrop(), GLPreviewFrame::OnROIChanged(), GLPreviewFrame::OnSetCropAspect(), 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(), ImagesPanel::RunCPGenerator(), OptimizePhotometricPanel::runOptimizer(), OptimizePanel::runOptimizer(), ImagesTreeCtrl::SelectAllParameters(), MainFrame::SetGuiLevel(), ImagesTreeCtrl::UnLinkImageVariables(), MaskEditorPanel::UpdateCrop(), GLPreviewFrame::UpdateGlobalWhiteBalance(), MaskEditorPanel::UpdateMask(), PanoPanel::VFOVChanged(), and PanoPanel::WidthChanged().

bool PanoCommand::CommandHistory::canRedo ( ) const

Return true iff there is a command to redo.

Definition at line 159 of file CommandHistory.cpp.

References commands, and nextCmd.

Referenced by MainFrame::panoramaChanged().

bool PanoCommand::CommandHistory::canUndo ( ) const

Return true iff there is a command to undo.

Definition at line 154 of file CommandHistory.cpp.

References nextCmd.

Referenced by getLastCommand(), getLastCommandName(), and MainFrame::panoramaChanged().

void PanoCommand::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 52 of file CommandHistory.cpp.

References commands, and nextCmd.

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

void PanoCommand::CommandHistory::clearRedoQueue ( )

clear all commands in the redo queue

Definition at line 63 of file CommandHistory.cpp.

References commands, and nextCmd.

Referenced by addCommand(), and MainFrame::LoadProjectFile().

const PanoCommand * PanoCommand::CommandHistory::getLastCommand ( ) const

return the last PanoCommand

Definition at line 173 of file CommandHistory.cpp.

References canUndo(), commands, and nextCmd.

Referenced by MainFrame::LoadProjectFile().

std::string PanoCommand::CommandHistory::getLastCommandName ( ) const

returns the name of the last command

Definition at line 164 of file CommandHistory.cpp.

References canUndo(), commands, and nextCmd.

Referenced by MainFrame::panoramaChanged(), and GLPreviewFrame::panoramaChanged().

void PanoCommand::CommandHistory::redo ( )
virtual

Redoes the last undone action.

Definition at line 129 of file CommandHistory.cpp.

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

Referenced by MainFrame::OnRedo().

void PanoCommand::CommandHistory::undo ( )
virtual

Undoes the last action.

Definition at line 100 of file CommandHistory.cpp.

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

Referenced by MainFrame::LoadProjectFile(), and MainFrame::OnUndo().

Member Data Documentation

std::vector<PanoCommand*> PanoCommand::CommandHistory::commands
private
size_t PanoCommand::CommandHistory::nextCmd
private

The documentation for this class was generated from the following files: