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

#include <EditImmediateSlotsCmd.hh>

Inheritance diagram for EditImmediateSlotsCmd:
Inheritance graph
Collaboration diagram for EditImmediateSlotsCmd:
Collaboration graph

Public Member Functions

 EditImmediateSlotsCmd ()
 
virtual ~EditImmediateSlotsCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual EditImmediateSlotsCmdcreate () 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 machine's immediate slots.

Definition at line 41 of file EditImmediateSlotsCmd.hh.

Constructor & Destructor Documentation

◆ EditImmediateSlotsCmd()

EditImmediateSlotsCmd::EditImmediateSlotsCmd ( )

The Constructor.

Definition at line 48 of file EditImmediateSlotsCmd.cc.

Referenced by create().

◆ ~EditImmediateSlotsCmd()

EditImmediateSlotsCmd::~EditImmediateSlotsCmd ( )
virtual

The Destructor.

Definition at line 56 of file EditImmediateSlotsCmd.cc.

56 {}

Member Function Documentation

◆ create()

EditImmediateSlotsCmd * EditImmediateSlotsCmd::create ( ) const
virtual

Creates and returns a new instance of this command.

Implements GUICommand.

Definition at line 102 of file EditImmediateSlotsCmd.cc.

102  {
103  return new EditImmediateSlotsCmd();
104 }

References EditImmediateSlotsCmd().

Here is the call graph for this function:

◆ Do()

bool EditImmediateSlotsCmd::Do ( )
virtual

Executes the command.

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

Implements GUICommand.

Definition at line 65 of file EditImmediateSlotsCmd.cc.

65  {
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  ImmediateSlotDialog dialog(parentWindow(), model->getMachine());
76 
77  if (dialog.ShowModal() == wxID_OK) {
78  model->notifyObservers();
79  return true;
80  } else {
81  // Cancel button was pressed, immediate slot modifications are
82  // cancelled.
83  model->popFromStack();
84  return false;
85  }
86 }

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 EditImmediateSlotsCmd::icon ( ) const
virtual

Returns path to the command's icon file.

Reimplemented from EditorCommand.

Definition at line 112 of file EditImmediateSlotsCmd.cc.

112  {
114 }

References ProDeConstants::CMD_ICON_DEFAULT.

◆ id()

int EditImmediateSlotsCmd::id ( ) const
virtual

Returns id of this command.

Implements GUICommand.

Definition at line 93 of file EditImmediateSlotsCmd.cc.

References ProDeConstants::COMMAND_EDIT_IMMEDIATE_SLOTS.

◆ isEnabled()

bool EditImmediateSlotsCmd::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 134 of file EditImmediateSlotsCmd.cc.

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

◆ shortName()

string EditImmediateSlotsCmd::shortName ( ) const
virtual

Returns short version of the command name.

Reimplemented from GUICommand.

Definition at line 121 of file EditImmediateSlotsCmd.cc.

121  {
123 }

References ProDeConstants::CMD_SNAME_EDIT_IMMEDIATE_SLOTS.


The documentation for this class was generated from the following files:
ProDeConstants::CMD_NAME_EDIT_IMMEDIATE_SLOTS
static const std::string CMD_NAME_EDIT_IMMEDIATE_SLOTS
Command name for the "Edit Immediate Slots" command.
Definition: ProDeConstants.hh:143
EditImmediateSlotsCmd::EditImmediateSlotsCmd
EditImmediateSlotsCmd()
Definition: EditImmediateSlotsCmd.cc:48
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_IMMEDIATE_SLOTS
@ COMMAND_EDIT_IMMEDIATE_SLOTS
Definition: ProDeConstants.hh:443
MDFDocument
Definition: MDFDocument.hh:51
ProDeConstants::CMD_ICON_DEFAULT
static const std::string CMD_ICON_DEFAULT
Icon path for default icon of commands.
Definition: ProDeConstants.hh:286
Model
Definition: Model.hh:50
ImmediateSlotDialog
Definition: ImmediateSlotDialog.hh:47
ProDeConstants::CMD_SNAME_EDIT_IMMEDIATE_SLOTS
static const std::string CMD_SNAME_EDIT_IMMEDIATE_SLOTS
Command name for the "Edit Immediate slots" command.
Definition: ProDeConstants.hh:237
GUICommand::parentWindow
wxWindow * parentWindow() const
Definition: GUICommand.cc:75
Model::getMachine
TTAMachine::Machine * getMachine()
Definition: Model.cc:88