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

#include <EditAddressSpacesCmd.hh>

Inheritance diagram for EditAddressSpacesCmd:
Inheritance graph
Collaboration diagram for EditAddressSpacesCmd:
Collaboration graph

Public Member Functions

 EditAddressSpacesCmd ()
 
virtual ~EditAddressSpacesCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual EditAddressSpacesCmdcreate () const
 
virtual std::string icon () const
 
virtual std::string shortName () 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
 
void setParentWindow (wxWindow *view)
 
wxWindow * parentWindow () const
 
std::string name () const
 

Detailed Description

wxCommand for editing address spaces.

Definition at line 40 of file EditAddressSpacesCmd.hh.

Constructor & Destructor Documentation

◆ EditAddressSpacesCmd()

EditAddressSpacesCmd::EditAddressSpacesCmd ( )

The Constructor.

Definition at line 52 of file EditAddressSpacesCmd.cc.

Referenced by create().

◆ ~EditAddressSpacesCmd()

EditAddressSpacesCmd::~EditAddressSpacesCmd ( )
virtual

The Destructor.

Definition at line 60 of file EditAddressSpacesCmd.cc.

60 {}

Member Function Documentation

◆ create()

EditAddressSpacesCmd * EditAddressSpacesCmd::create ( ) const
virtual

Creates and returns a new instance of this command.

Implements GUICommand.

Definition at line 105 of file EditAddressSpacesCmd.cc.

105  {
106  return new EditAddressSpacesCmd();
107 }

References EditAddressSpacesCmd().

Here is the call graph for this function:

◆ Do()

bool EditAddressSpacesCmd::Do ( )
virtual

Executes the command.

Returns
True, if the command was succesfully executed, false otherwise.

Implements GUICommand.

Definition at line 69 of file EditAddressSpacesCmd.cc.

69  {
70 
71  assert(parentWindow() != NULL);
72  assert(view() != NULL);
73 
74  Model* model = dynamic_cast<MDFDocument*>(
75  view()->GetDocument())->getModel();
76 
77  model->pushToStack();
78 
79  AddressSpacesDialog dialog(parentWindow(), model->getMachine());
80 
81  if (dialog.ShowModal() == wxID_OK) {
82  model->notifyObservers();
83  return true;
84  } else {
85  // Cancel button was pressed, address spaces are not modified.
86  model->popFromStack();
87  return false;
88  }
89 }

References assert, Model::getMachine(), Model::notifyObservers(), GUICommand::parentWindow(), Model::popFromStack(), Model::pushToStack(), and EditorCommand::view().

Here is the call graph for this function:

◆ icon()

string EditAddressSpacesCmd::icon ( ) const
virtual

Returns path to the command's icon file.

Reimplemented from EditorCommand.

Definition at line 115 of file EditAddressSpacesCmd.cc.

115  {
117 }

References ProDeConstants::CMD_ICON_EDIT_ADDRESS_SPACES.

◆ id()

int EditAddressSpacesCmd::id ( ) const
virtual

Returns id of this command.

Implements GUICommand.

Definition at line 96 of file EditAddressSpacesCmd.cc.

References ProDeConstants::COMMAND_EDIT_ADDRESS_SPACES.

◆ isEnabled()

bool EditAddressSpacesCmd::isEnabled ( )
virtual

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

This command is executable when a document is open.

Returns
True, if a document is open.

Reimplemented from EditorCommand.

Definition at line 137 of file EditAddressSpacesCmd.cc.

137  {
138  wxDocManager* manager = wxGetApp().docManager();
139  if (manager->GetCurrentView() != NULL) {
140  return true;
141  }
142  return false;
143 }

◆ shortName()

string EditAddressSpacesCmd::shortName ( ) const
virtual

Returns short version of the command name.

Reimplemented from GUICommand.

Definition at line 124 of file EditAddressSpacesCmd.cc.

124  {
126 }

References ProDeConstants::CMD_SNAME_EDIT_ADDRESS_SPACES.


The documentation for this class was generated from the following files:
ProDeConstants::CMD_NAME_EDIT_ADDRESS_SPACES
static const std::string CMD_NAME_EDIT_ADDRESS_SPACES
Command name for the "Edit Address Space" command.
Definition: ProDeConstants.hh:137
ProDeConstants::COMMAND_EDIT_ADDRESS_SPACES
@ COMMAND_EDIT_ADDRESS_SPACES
Definition: ProDeConstants.hh:440
ProDeConstants::CMD_SNAME_EDIT_ADDRESS_SPACES
static const std::string CMD_SNAME_EDIT_ADDRESS_SPACES
Command name for the "Edit Address Space" command.
Definition: ProDeConstants.hh:229
Model::pushToStack
void pushToStack()
Definition: Model.cc:167
EditorCommand::EditorCommand
EditorCommand(std::string name, wxWindow *parent=NULL)
Definition: EditorCommand.cc:42
Model::notifyObservers
void notifyObservers(bool modified=true)
Definition: Model.cc:152
assert
#define assert(condition)
Definition: Application.hh:86
AddressSpacesDialog
Definition: AddressSpacesDialog.hh:48
EditorCommand::view
wxView * view() const
Definition: EditorCommand.cc:76
Model::popFromStack
void popFromStack(bool modified=false)
Definition: Model.cc:195
EditAddressSpacesCmd::EditAddressSpacesCmd
EditAddressSpacesCmd()
Definition: EditAddressSpacesCmd.cc:52
MDFDocument
Definition: MDFDocument.hh:51
Model
Definition: Model.hh:50
GUICommand::parentWindow
wxWindow * parentWindow() const
Definition: GUICommand.cc:75
Model::getMachine
TTAMachine::Machine * getMachine()
Definition: Model.cc:88
ProDeConstants::CMD_ICON_EDIT_ADDRESS_SPACES
static const std::string CMD_ICON_EDIT_ADDRESS_SPACES
Icon location for the "Edit Address Space" command.
Definition: ProDeConstants.hh:338