OpenASIP 2.2
Loading...
Searching...
No Matches
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.

47 :
49}
static const std::string CMD_NAME_EDIT_MACHINE
Command name for the "Processor configurations" command.

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}
#define assert(condition)
wxView * view() const
wxWindow * parentWindow() const
Definition GUICommand.cc:75
Definition Model.hh:50
void pushToStack()
Definition Model.cc:167
void notifyObservers(bool modified=true)
Definition Model.cc:152
void popFromStack(bool modified=false)
Definition Model.cc:195
TTAMachine::Machine * getMachine()
Definition Model.cc:88

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}
static const std::string CMD_ICON_EDIT_MACHINE
Icon location for the "Processor Configurations" command.

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.

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}
static const std::string CMD_SNAME_EDIT_MACHINE
Command name for the "Processor Configurations" command.

References ProDeConstants::CMD_SNAME_EDIT_MACHINE.


The documentation for this class was generated from the following files: