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

#include <EditMachineCmd.hh>

Inheritance diagram for EditMachineCmd:
Inheritance graph
Collaboration diagram for EditMachineCmd:
Collaboration graph

Public Member Functions

 EditMachineCmd ()
 
virtual ~EditMachineCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual EditMachineCmdcreate () 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

Definition at line 39 of file EditMachineCmd.hh.

Constructor & Destructor Documentation

◆ EditMachineCmd()

EditMachineCmd::EditMachineCmd ( )

The Constructor.

Definition at line 47 of file EditMachineCmd.cc.

Referenced by create().

◆ ~EditMachineCmd()

EditMachineCmd::~EditMachineCmd ( )
virtual

The Destructor.

Definition at line 55 of file EditMachineCmd.cc.

55  {
56 
57 }

Member Function Documentation

◆ create()

EditMachineCmd * EditMachineCmd::create ( ) const
virtual

Creates and returns a new instance of this command.

Returns
A new instance of this command.

Implements GUICommand.

Definition at line 105 of file EditMachineCmd.cc.

105  {
106  return new EditMachineCmd();
107 }

References EditMachineCmd().

Here is the call graph for this function:

◆ Do()

bool EditMachineCmd::Do ( )
virtual

Executes the command.

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

Implements GUICommand.

Definition at line 66 of file EditMachineCmd.cc.

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

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

Here is the call graph for this function:

◆ icon()

std::string EditMachineCmd::icon ( ) const
virtual

Returns path to the command's icon file.

Returns
path to the command's icon file.

Reimplemented from EditorCommand.

Definition at line 116 of file EditMachineCmd.cc.

116  {
118 }

References ProDeConstants::CMD_ICON_EDIT_MACHINE.

◆ id()

int EditMachineCmd::id ( ) const
virtual

Returns id of this command.

Returns
Id of this command.

Implements GUICommand.

Definition at line 94 of file EditMachineCmd.cc.

94  {
96 }

References ProDeConstants::COMMAND_EDIT_MACHINE.

◆ isEnabled()

bool EditMachineCmd::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 140 of file EditMachineCmd.cc.

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

◆ shortName()

std::string EditMachineCmd::shortName ( ) const
virtual

Returns short version of the command name.

Returns
Short version of the command name.

Reimplemented from GUICommand.

Definition at line 127 of file EditMachineCmd.cc.

127  {
129 }

References ProDeConstants::CMD_SNAME_EDIT_MACHINE.


The documentation for this class was generated from the following files:
MachineDialog
Definition: MachineDialog.hh:48
ProDeConstants::CMD_ICON_EDIT_MACHINE
static const std::string CMD_ICON_EDIT_MACHINE
Icon location for the "Processor Configurations" command.
Definition: ProDeConstants.hh:346
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
ProDeConstants::CMD_SNAME_EDIT_MACHINE
static const std::string CMD_SNAME_EDIT_MACHINE
Command name for the "Processor Configurations" command.
Definition: ProDeConstants.hh:235
ProDeConstants::COMMAND_EDIT_MACHINE
@ COMMAND_EDIT_MACHINE
Definition: ProDeConstants.hh:445
ProDeConstants::CMD_NAME_EDIT_MACHINE
static const std::string CMD_NAME_EDIT_MACHINE
Command name for the "Processor configurations" command.
Definition: ProDeConstants.hh:153
EditorCommand::view
wxView * view() const
Definition: EditorCommand.cc:76
Model::popFromStack
void popFromStack(bool modified=false)
Definition: Model.cc:195
MDFDocument
Definition: MDFDocument.hh:51
Model
Definition: Model.hh:50
EditMachineCmd::EditMachineCmd
EditMachineCmd()
Definition: EditMachineCmd.cc:47
GUICommand::parentWindow
wxWindow * parentWindow() const
Definition: GUICommand.cc:75
Model::getMachine
TTAMachine::Machine * getMachine()
Definition: Model.cc:88