OpenASIP  2.0
Public Member Functions | List of all members
UndoCmd Class Reference

#include <UndoCmd.hh>

Inheritance diagram for UndoCmd:
Inheritance graph
Collaboration diagram for UndoCmd:
Collaboration graph

Public Member Functions

 UndoCmd ()
 
virtual ~UndoCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual UndoCmdcreate () const
 
virtual std::string icon () const
 
virtual bool isEnabled ()
 
- Public Member Functions inherited from EditorCommand
 EditorCommand (std::string name, wxWindow *parent=NULL)
 
virtual ~EditorCommand ()
 
void setView (wxView *view)
 
wxView * view () const
 
- Public Member Functions inherited from GUICommand
 GUICommand (std::string name, wxWindow *parent)
 
virtual ~GUICommand ()
 
virtual bool isChecked () const
 
virtual std::string shortName () const
 
void setParentWindow (wxWindow *view)
 
wxWindow * parentWindow () const
 
std::string name () const
 

Detailed Description

EditorCommand for undoing modifications to the machine.

Definition at line 41 of file UndoCmd.hh.

Constructor & Destructor Documentation

◆ UndoCmd()

UndoCmd::UndoCmd ( )

The Constructor.

Definition at line 44 of file UndoCmd.cc.

44  :
46 
47 }

Referenced by create().

◆ ~UndoCmd()

UndoCmd::~UndoCmd ( )
virtual

The Destructor.

Definition at line 53 of file UndoCmd.cc.

53 {}

Member Function Documentation

◆ create()

UndoCmd * UndoCmd::create ( ) const
virtual

Creates and returns a new instance of this command.

Returns
Newly created instance of this command.

Implements GUICommand.

Definition at line 85 of file UndoCmd.cc.

85  {
86  return new UndoCmd();
87 }

References UndoCmd().

Here is the call graph for this function:

◆ Do()

bool UndoCmd::Do ( )
virtual

Executes the command.

Returns
Always false.

Implements GUICommand.

Definition at line 62 of file UndoCmd.cc.

62  {
63  dynamic_cast<MDFDocument*>(view()->GetDocument())->getModel()->undo();
64  return false;
65 }

References EditorCommand::view().

Here is the call graph for this function:

◆ icon()

string UndoCmd::icon ( ) const
virtual

Returns path to the command's icon file.

Returns
Full path to the command's icon file.

Reimplemented from EditorCommand.

Definition at line 97 of file UndoCmd.cc.

97  {
99 }

References ProDeConstants::CMD_ICON_UNDO.

◆ id()

int UndoCmd::id ( ) const
virtual

Returns id of this command.

Returns
ID for this command to be used in menus and toolbars.

Implements GUICommand.

Definition at line 74 of file UndoCmd.cc.

74  {
76 }

References ProDeConstants::COMMAND_UNDO.

◆ isEnabled()

bool UndoCmd::isEnabled ( )
virtual

Returns true when the command is executable, false when not.

This command is executable when the model's undo stack is not empty.

Returns
True, if the model's undo stack is not empty.

Reimplemented from EditorCommand.

Definition at line 110 of file UndoCmd.cc.

110  {
111 
112  wxDocManager* manager = wxGetApp().docManager();
113 
114  wxView* view = manager->GetCurrentView();
115  if (view == NULL) {
116  return false;
117  }
118 
119  Model* model =
120  dynamic_cast<MDFDocument*>(view->GetDocument())->getModel();
121 
122  if (model != NULL && model->canUndo()) {
123  return true;
124  }
125  return false;
126 }

References Model::canUndo(), and EditorCommand::view().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
ProDeConstants::COMMAND_UNDO
@ COMMAND_UNDO
Definition: ProDeConstants.hh:433
Model::canUndo
bool canUndo()
Definition: Model.cc:213
EditorCommand::EditorCommand
EditorCommand(std::string name, wxWindow *parent=NULL)
Definition: EditorCommand.cc:42
EditorCommand::view
wxView * view() const
Definition: EditorCommand.cc:76
ProDeConstants::CMD_ICON_UNDO
static const std::string CMD_ICON_UNDO
Icon location for the "Undo" command.
Definition: ProDeConstants.hh:306
MDFDocument
Definition: MDFDocument.hh:51
ProDeConstants::CMD_NAME_UNDO
static const std::string CMD_NAME_UNDO
Command name for the "Undo" command.
Definition: ProDeConstants.hh:122
Model
Definition: Model.hh:50
UndoCmd::UndoCmd
UndoCmd()
Definition: UndoCmd.cc:44