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

48 :
50
51}
static const std::string CMD_NAME_TOGGLE_UNIT_DETAILS
Command name for the "Toggle Unit details" command.

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}
wxView * view() const
MachineCanvas * canvas() const
Definition MDFView.cc:229
static const std::string SHOW_UNIT_INFO_STRING
Option name for the unit info string visibility flag.
MachineCanvasOptions & options()
virtual void setBoolValue(bool)
virtual bool isFlagOn() const
OptionValue & optionValue(const string &name, int index=0)
Definition Options.cc:115

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.

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}
static const std::string CMD_SNAME_TOGGLE_UNIT_DETAILS
Command name for the "Toggle Unit Details" command.

References ProDeConstants::CMD_SNAME_TOGGLE_UNIT_DETAILS.


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