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

#include <ToggleUnitDetailsCmd.hh>

Inheritance diagram for ToggleUnitDetailsCmd:
Inheritance graph
Collaboration diagram for ToggleUnitDetailsCmd:
Collaboration graph

Public Member Functions

 ToggleUnitDetailsCmd ()
 
virtual ~ToggleUnitDetailsCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual ToggleUnitDetailsCmdcreate () const
 
virtual std::string shortName () const
 
virtual bool isEnabled ()
 
virtual bool isChecked () const
 
- Public Member Functions inherited from EditorCommand
 EditorCommand (std::string name, wxWindow *parent=NULL)
 
virtual ~EditorCommand ()
 
void setView (wxView *view)
 
wxView * view () const
 
virtual std::string icon () const
 
- Public Member Functions inherited from GUICommand
 GUICommand (std::string name, wxWindow *parent)
 
virtual ~GUICommand ()
 
void setParentWindow (wxWindow *view)
 
wxWindow * parentWindow () const
 
std::string name () const
 

Detailed Description

EditorCommand for toggling unit info string visibility in the canvas.

Definition at line 41 of file ToggleUnitDetailsCmd.hh.

Constructor & Destructor Documentation

◆ ToggleUnitDetailsCmd()

ToggleUnitDetailsCmd::ToggleUnitDetailsCmd ( )

The Constructor.

Definition at line 48 of file ToggleUnitDetailsCmd.cc.

Referenced by create().

◆ ~ToggleUnitDetailsCmd()

ToggleUnitDetailsCmd::~ToggleUnitDetailsCmd ( )
virtual

The Destructor.

Definition at line 57 of file ToggleUnitDetailsCmd.cc.

57  {
58 }

Member Function Documentation

◆ create()

ToggleUnitDetailsCmd * ToggleUnitDetailsCmd::create ( ) const
virtual

Creates and returns a new instance of this command.

Returns
Newly created instance of this command.

Implements GUICommand.

Definition at line 116 of file ToggleUnitDetailsCmd.cc.

116  {
117  return new ToggleUnitDetailsCmd();
118 }

References ToggleUnitDetailsCmd().

Here is the call graph for this function:

◆ Do()

bool ToggleUnitDetailsCmd::Do ( )
virtual

Executes the command.

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

Implements GUICommand.

Definition at line 66 of file ToggleUnitDetailsCmd.cc.

66  {
67  MDFView* mView = dynamic_cast<MDFView*>(view());
68  MachineCanvas* canvas = mView->canvas();
69  OptionValue& option = canvas->options().optionValue(
71  option.setBoolValue(!option.isFlagOn());
72  canvas->updateMachine();
73  return true;
74 }

References MDFView::canvas(), OptionValue::isFlagOn(), MachineCanvas::options(), Options::optionValue(), OptionValue::setBoolValue(), MachineCanvasOptions::SHOW_UNIT_INFO_STRING, MachineCanvas::updateMachine(), and EditorCommand::view().

Here is the call graph for this function:

◆ id()

int ToggleUnitDetailsCmd::id ( ) const
virtual

Returns id of this command.

Returns
ID for this command to be used in menus and toolbars.

Implements GUICommand.

Definition at line 105 of file ToggleUnitDetailsCmd.cc.

105  {
107 }

References ProDeConstants::COMMAND_TOGGLE_UNIT_DETAILS.

◆ isChecked()

bool ToggleUnitDetailsCmd::isChecked ( ) const
virtual

Returns state of the check-item related to this command.

Returns
true, if the command check item is checked.

Reimplemented from GUICommand.

Definition at line 83 of file ToggleUnitDetailsCmd.cc.

83  {
84  MDFView* mView = dynamic_cast<MDFView*>(view());
85  if (mView == NULL) {
86  return false;
87  }
88  MachineCanvas* canvas = mView->canvas();
89  if (canvas == NULL) {
90  return false;
91  }
92  OptionValue& option = canvas->options().optionValue(
94  return option.isFlagOn();
95 }

References MDFView::canvas(), OptionValue::isFlagOn(), MachineCanvas::options(), Options::optionValue(), MachineCanvasOptions::SHOW_UNIT_INFO_STRING, and EditorCommand::view().

Here is the call graph for this function:

◆ isEnabled()

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

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

◆ shortName()

string ToggleUnitDetailsCmd::shortName ( ) const
virtual

Returns short version of the command name.

Returns
Short name of the command to be used in the toolbar.

Reimplemented from GUICommand.

Definition at line 127 of file ToggleUnitDetailsCmd.cc.

127  {
129 }

References ProDeConstants::CMD_SNAME_TOGGLE_UNIT_DETAILS.


The documentation for this class was generated from the following files:
MachineCanvas
Definition: MachineCanvas.hh:64
ProDeConstants::CMD_SNAME_TOGGLE_UNIT_DETAILS
static const std::string CMD_SNAME_TOGGLE_UNIT_DETAILS
Command name for the "Toggle Unit Details" command.
Definition: ProDeConstants.hh:280
MDFView::canvas
MachineCanvas * canvas() const
Definition: MDFView.cc:229
Options::optionValue
OptionValue & optionValue(const string &name, int index=0)
Definition: Options.cc:115
EditorCommand::EditorCommand
EditorCommand(std::string name, wxWindow *parent=NULL)
Definition: EditorCommand.cc:42
MachineCanvasOptions::SHOW_UNIT_INFO_STRING
static const std::string SHOW_UNIT_INFO_STRING
Option name for the unit info string visibility flag.
Definition: MachineCanvasOptions.hh:48
ToggleUnitDetailsCmd::ToggleUnitDetailsCmd
ToggleUnitDetailsCmd()
Definition: ToggleUnitDetailsCmd.cc:48
OptionValue::isFlagOn
virtual bool isFlagOn() const
Definition: OptionValue.cc:166
EditorCommand::view
wxView * view() const
Definition: EditorCommand.cc:76
MachineCanvas::updateMachine
void updateMachine()
Definition: MachineCanvas.cc:345
ProDeConstants::COMMAND_TOGGLE_UNIT_DETAILS
@ COMMAND_TOGGLE_UNIT_DETAILS
Definition: ProDeConstants.hh:452
MachineCanvas::options
MachineCanvasOptions & options()
Definition: MachineCanvas.cc:681
OptionValue
Definition: OptionValue.hh:51
OptionValue::setBoolValue
virtual void setBoolValue(bool)
Definition: OptionValue.cc:106
ProDeConstants::CMD_NAME_TOGGLE_UNIT_DETAILS
static const std::string CMD_NAME_TOGGLE_UNIT_DETAILS
Command name for the "Toggle Unit details" command.
Definition: ProDeConstants.hh:166
MDFView
Definition: MDFView.hh:59