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

#include <EditBusOrderCmd.hh>

Inheritance diagram for EditBusOrderCmd:
Inheritance graph
Collaboration diagram for EditBusOrderCmd:
Collaboration graph

Public Member Functions

 EditBusOrderCmd ()
 
virtual ~EditBusOrderCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual EditBusOrderCmdcreate () const
 
virtual bool isEnabled ()
 
virtual std::string shortName () const
 
- Public Member Functions inherited from EditorCommand
 EditorCommand (std::string name, wxWindow *parent=NULL)
 
virtual ~EditorCommand ()
 
void setView (wxView *view)
 
wxView * view () const
 
virtual std::string icon () 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

Command for editing order of transport buses in a machine.

Definition at line 41 of file EditBusOrderCmd.hh.

Constructor & Destructor Documentation

◆ EditBusOrderCmd()

EditBusOrderCmd::EditBusOrderCmd ( )

The Constructor.

Definition at line 50 of file EditBusOrderCmd.cc.

Referenced by create().

◆ ~EditBusOrderCmd()

EditBusOrderCmd::~EditBusOrderCmd ( )
virtual

The Destructor.

Definition at line 58 of file EditBusOrderCmd.cc.

58 {}

Member Function Documentation

◆ create()

EditBusOrderCmd * EditBusOrderCmd::create ( ) const
virtual

Creates and returns a new instance of this command.

Implements GUICommand.

Definition at line 103 of file EditBusOrderCmd.cc.

103  {
104  return new EditBusOrderCmd();
105 }

References EditBusOrderCmd().

Here is the call graph for this function:

◆ Do()

bool EditBusOrderCmd::Do ( )
virtual

Executes the command.

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

Implements GUICommand.

Definition at line 67 of file EditBusOrderCmd.cc.

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

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

Here is the call graph for this function:

◆ id()

int EditBusOrderCmd::id ( ) const
virtual

Returns id of this command.

Implements GUICommand.

Definition at line 94 of file EditBusOrderCmd.cc.

94  {
96 }

References ProDeConstants::COMMAND_EDIT_BUS_ORDER.

◆ isEnabled()

bool EditBusOrderCmd::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 125 of file EditBusOrderCmd.cc.

125  {
126  wxDocManager* manager = wxGetApp().docManager();
127  if (manager->GetCurrentView() != NULL) {
128  return true;
129  }
130  return false;
131 }

◆ shortName()

string EditBusOrderCmd::shortName ( ) const
virtual

Returns short version of the command name.

Reimplemented from GUICommand.

Definition at line 112 of file EditBusOrderCmd.cc.

112  {
114 }

References ProDeConstants::CMD_SNAME_EDIT_ADDRESS_SPACES.


The documentation for this class was generated from the following files:
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
EditorCommand::view
wxView * view() const
Definition: EditorCommand.cc:76
Model::popFromStack
void popFromStack(bool modified=false)
Definition: Model.cc:195
ProDeConstants::COMMAND_EDIT_BUS_ORDER
@ COMMAND_EDIT_BUS_ORDER
Definition: ProDeConstants.hh:444
MDFDocument
Definition: MDFDocument.hh:51
ProDeBusOrderDialog
Definition: ProDeBusOrderDialog.hh:48
Model
Definition: Model.hh:50
EditBusOrderCmd::EditBusOrderCmd
EditBusOrderCmd()
Definition: EditBusOrderCmd.cc:50
ProDeConstants::CMD_NAME_EDIT_BUS_ORDER
static const std::string CMD_NAME_EDIT_BUS_ORDER
Command name for the "Edit Bus Order" command.
Definition: ProDeConstants.hh:145
GUICommand::parentWindow
wxWindow * parentWindow() const
Definition: GUICommand.cc:75
Model::getMachine
TTAMachine::Machine * getMachine()
Definition: Model.cc:88