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

#include <EditOTAFormatsCmd.hh>

Inheritance diagram for EditOTAFormatsCmd:
Inheritance graph
Collaboration diagram for EditOTAFormatsCmd:
Collaboration graph

Public Member Functions

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

Command for editing OTAFormats.

Opens a OTAFormatListDialog which lists OTAFormats in the machine.

Definition at line 43 of file EditOTAFormatsCmd.hh.

Constructor & Destructor Documentation

◆ EditOTAFormatsCmd()

EditOTAFormatsCmd::EditOTAFormatsCmd ( )

The Constructor.

Definition at line 51 of file EditOTAFormatsCmd.cc.

Referenced by create().

◆ ~EditOTAFormatsCmd()

EditOTAFormatsCmd::~EditOTAFormatsCmd ( )
virtual

The Destructor.

Definition at line 57 of file EditOTAFormatsCmd.cc.

57 {}

Member Function Documentation

◆ create()

EditOTAFormatsCmd * EditOTAFormatsCmd::create ( ) const
virtual

Creates and returns a new instance of this command.

Returns
A new instance of this command.

Implements GUICommand.

Definition at line 102 of file EditOTAFormatsCmd.cc.

102  {
103  return new EditOTAFormatsCmd();
104 }

References EditOTAFormatsCmd().

Here is the call graph for this function:

◆ Do()

bool EditOTAFormatsCmd::Do ( )
virtual

Executes the command.

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

Implements GUICommand.

Definition at line 65 of file EditOTAFormatsCmd.cc.

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

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 EditOTAFormatsCmd::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 112 of file EditOTAFormatsCmd.cc.

112  {
114 }

References ProDeConstants::CMD_ICON_EDIT_OTA_FORMATS.

◆ id()

int EditOTAFormatsCmd::id ( ) const
virtual

Returns id of this command.

Returns
Id of this command.

Implements GUICommand.

Definition at line 92 of file EditOTAFormatsCmd.cc.

92  {
94 }

References ProDeConstants::COMMAND_EDIT_OTA_FORMATS.

◆ isEnabled()

bool EditOTAFormatsCmd::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 EditOTAFormatsCmd.cc.

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

◆ shortName()

string EditOTAFormatsCmd::shortName ( ) const
virtual

Returns short version of the command name.

Returns
Short version of the command name.

Reimplemented from GUICommand.

Definition at line 122 of file EditOTAFormatsCmd.cc.

122  {
124 }

References ProDeConstants::CMD_SNAME_EDIT_OTA_FORMATS.


The documentation for this class was generated from the following files:
ProDeConstants::COMMAND_EDIT_OTA_FORMATS
@ COMMAND_EDIT_OTA_FORMATS
Definition: ProDeConstants.hh:442
EditOTAFormatsCmd::EditOTAFormatsCmd
EditOTAFormatsCmd()
Definition: EditOTAFormatsCmd.cc:51
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
OTAFormatListDialog
Definition: OTAFormatListDialog.hh:44
EditorCommand::view
wxView * view() const
Definition: EditorCommand.cc:76
ProDeConstants::CMD_NAME_EDIT_OTA_FORMATS
static const std::string CMD_NAME_EDIT_OTA_FORMATS
Command name for the "Edit OTA Formats" command.
Definition: ProDeConstants.hh:141
ProDeConstants::CMD_ICON_EDIT_OTA_FORMATS
static const std::string CMD_ICON_EDIT_OTA_FORMATS
Icon location for the "Edit OTA Formats" command.
Definition: ProDeConstants.hh:342
Model::popFromStack
void popFromStack(bool modified=false)
Definition: Model.cc:195
MDFDocument
Definition: MDFDocument.hh:51
Model
Definition: Model.hh:50
ProDeConstants::CMD_SNAME_EDIT_OTA_FORMATS
static const std::string CMD_SNAME_EDIT_OTA_FORMATS
Command name for the "Edit Templates" command.
Definition: ProDeConstants.hh:233
GUICommand::parentWindow
wxWindow * parentWindow() const
Definition: GUICommand.cc:75
Model::getMachine
TTAMachine::Machine * getMachine()
Definition: Model.cc:88