Hugintrunk
0.1
|
A history for Command, provides undo/redo functionality. More...
#include <CommandHistory.h>
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 PanoCommand * | getLastCommand () const |
return the last PanoCommand More... | |
Private Attributes | |
std::vector< PanoCommand * > | commands |
size_t | nextCmd |
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.
PanoCommand::CommandHistory::CommandHistory | ( | ) |
ctor.
Definition at line 38 of file CommandHistory.cpp.
|
virtual |
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
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().
|
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().
|
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().
|
private |
Definition at line 95 of file CommandHistory.h.
Referenced by addCommand(), canRedo(), clear(), clearRedoQueue(), getLastCommand(), getLastCommandName(), redo(), undo(), and ~CommandHistory().
|
private |
Definition at line 96 of file CommandHistory.h.
Referenced by addCommand(), canRedo(), canUndo(), clear(), clearRedoQueue(), getLastCommand(), getLastCommandName(), redo(), and undo().