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

#include <ProximOpenProgramCmd.hh>

Inheritance diagram for ProximOpenProgramCmd:
Inheritance graph
Collaboration diagram for ProximOpenProgramCmd:
Collaboration graph

Public Member Functions

 ProximOpenProgramCmd ()
 
virtual ~ProximOpenProgramCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual ProximOpenProgramCmdcreate () const
 
virtual std::string icon () const
 
virtual bool isEnabled ()
 
virtual std::string shortName () 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 opening program files in the Proxim.

Displays a file dialog for choosing the program file to open.

Definition at line 43 of file ProximOpenProgramCmd.hh.

Constructor & Destructor Documentation

◆ ProximOpenProgramCmd()

ProximOpenProgramCmd::ProximOpenProgramCmd ( )

The Constructor.

Definition at line 46 of file ProximOpenProgramCmd.cc.

Referenced by create().

◆ ~ProximOpenProgramCmd()

ProximOpenProgramCmd::~ProximOpenProgramCmd ( )
virtual

The Destructor.

Definition at line 54 of file ProximOpenProgramCmd.cc.

54  {
55 }

Member Function Documentation

◆ create()

ProximOpenProgramCmd * ProximOpenProgramCmd::create ( ) const
virtual

Creates and returns a new instance of this command.

Returns
Newly created instance of this command.

Implements GUICommand.

Definition at line 111 of file ProximOpenProgramCmd.cc.

111  {
112  return new ProximOpenProgramCmd();
113 }

References ProximOpenProgramCmd().

Here is the call graph for this function:

◆ Do()

bool ProximOpenProgramCmd::Do ( )
virtual

Executes the command.

Implements GUICommand.

Definition at line 62 of file ProximOpenProgramCmd.cc.

62  {
63  assert(parentWindow() != NULL);
64 
65  wxString wildcard = _T("TPEF Program Files (*.tpf, *.tpef)|*.tpf;*.tpef");
66  wildcard.Append(_T("|All files|*"));
67  wxFileDialog dialog(
68  parentWindow(), _T("Choose a file."), _T(""), _T(""),
69  wildcard, wxOPEN);
70 
71  if (dialog.ShowModal() == wxID_CANCEL) {
72  return false;
73  }
74 
75  std::string command;
76  std::string file = WxConversion::toString(dialog.GetPath());
77 
78  command = ProximConstants::SCL_LOAD_PROGRAM + " \"" + file + "\"";
79  wxGetApp().simulation()->lineReader().input(command);
80 
81  return true;
82 }

References assert, GUICommand::parentWindow(), ProximConstants::SCL_LOAD_PROGRAM, and WxConversion::toString().

Here is the call graph for this function:

◆ icon()

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

Returns full path to the command icon file.

Returns
Full path to the command icon file.

Implements GUICommand.

Definition at line 91 of file ProximOpenProgramCmd.cc.

91  {
92  return "open_program.png";
93 }

◆ id()

int ProximOpenProgramCmd::id ( ) const
virtual

Returns ID of this command.

Implements GUICommand.

Definition at line 100 of file ProximOpenProgramCmd.cc.

100  {
102 }

References ProximConstants::COMMAND_OPEN_PROGRAM.

◆ isEnabled()

bool ProximOpenProgramCmd::isEnabled ( )
virtual

Returns true if the command is enabled, false otherwise.

Returns
Always true.

Implements GUICommand.

Definition at line 122 of file ProximOpenProgramCmd.cc.

122  {
123  return true;
124 }

◆ shortName()

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

Returns shortened name of the command for toolbar button text.

Returns
Short version of the command name.

Reimplemented from GUICommand.

Definition at line 133 of file ProximOpenProgramCmd.cc.

133  {
134  return "Program";
135 }

The documentation for this class was generated from the following files:
ProximOpenProgramCmd::ProximOpenProgramCmd
ProximOpenProgramCmd()
Definition: ProximOpenProgramCmd.cc:46
ProximConstants::COMMAND_OPEN_PROGRAM
@ COMMAND_OPEN_PROGRAM
Definition: ProximConstants.hh:52
ProximConstants::COMMAND_NAME_OPEN_PROGRAM
static const std::string COMMAND_NAME_OPEN_PROGRAM
Name of the open program command.
Definition: ProximConstants.hh:104
assert
#define assert(condition)
Definition: Application.hh:86
GUICommand::GUICommand
GUICommand(std::string name, wxWindow *parent)
Definition: GUICommand.cc:42
ProximConstants::SCL_LOAD_PROGRAM
static const std::string SCL_LOAD_PROGRAM
Command for loading a new program in the simulator.
Definition: ProximConstants.hh:145
WxConversion::toString
static std::string toString(const wxString &source)
GUICommand::parentWindow
wxWindow * parentWindow() const
Definition: GUICommand.cc:75