OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ProximMachineCanvasTool Class Reference

#include <ProximMachineCanvasTool.hh>

Inheritance diagram for ProximMachineCanvasTool:
Inheritance graph
Collaboration diagram for ProximMachineCanvasTool:
Collaboration graph

Public Member Functions

 ProximMachineCanvasTool (MachineCanvas *canvas)
 
virtual ~ProximMachineCanvasTool ()
 
virtual void activate ()
 
virtual void deactivate ()
 
virtual void onMouseEvent (wxMouseEvent &event, wxDC &dc)
 
- Public Member Functions inherited from MachineCanvasTool
virtual ~MachineCanvasTool ()
 
virtual Figurefigure ()
 

Private Member Functions

void popupMenu (int x, int y)
 

Private Attributes

MachineCanvascanvas_
 MachineCanvas where the tools is used.
 

Additional Inherited Members

- Protected Member Functions inherited from MachineCanvasTool
 MachineCanvasTool (MachineCanvas *canvas)
 
- Protected Attributes inherited from MachineCanvasTool
MachineCanvascanvas_
 Machine canvas where the tool is used.
 

Detailed Description

MachineCanvasTool for Proxim MachineWindow.

Definition at line 45 of file ProximMachineCanvasTool.hh.

Constructor & Destructor Documentation

◆ ProximMachineCanvasTool()

ProximMachineCanvasTool::ProximMachineCanvasTool ( MachineCanvas canvas)

The Constructor.

Parameters
canvasMachineCanvas where the tool is used.

Definition at line 52 of file ProximMachineCanvasTool.cc.

52 :
53 MachineCanvasTool(canvas),
54 canvas_(canvas) {
55
56}
MachineCanvas * canvas_
MachineCanvas where the tools is used.

◆ ~ProximMachineCanvasTool()

ProximMachineCanvasTool::~ProximMachineCanvasTool ( )
virtual

The Destructor.

Definition at line 62 of file ProximMachineCanvasTool.cc.

62 {
63}

Member Function Documentation

◆ activate()

void ProximMachineCanvasTool::activate ( )
virtual

Called when the tool is activated.

Implements MachineCanvasTool.

Definition at line 155 of file ProximMachineCanvasTool.cc.

155 {
156 // do nothing
157}

◆ deactivate()

void ProximMachineCanvasTool::deactivate ( )
virtual

Called when the tool is deactivated.

Implements MachineCanvasTool.

Definition at line 164 of file ProximMachineCanvasTool.cc.

164 {
165 // do nothing
166}

◆ onMouseEvent()

void ProximMachineCanvasTool::onMouseEvent ( wxMouseEvent &  event,
wxDC &  dc 
)
virtual

Handles mouse events on the canvas.

Implements MachineCanvasTool.

Definition at line 70 of file ProximMachineCanvasTool.cc.

70 {
71
72 // Get event position and translate "raw" coordinates to logical ones.
73 wxPoint position = event.GetPosition();
74 int x = position.x;
75 int y = position.y;
76 long logicalX = dc.DeviceToLogicalX(position.x);
77 long logicalY = dc.DeviceToLogicalY(position.y);
78
79 // Check if there is an EditPart at the cursor position.
80 EditPart* part = canvas_->findEditPart(logicalX, logicalY);
81
82
84 if (part != NULL && part->canHandle(&request)) {
85 ComponentCommand* command = part->performRequest(&request);
86 command->Do();
87 delete command;
88 } else {
90 }
91
92 if (event.LeftDClick()) {
94 if (part != NULL && part->canHandle(&request)) {
95 ComponentCommand* command = part->performRequest(&request);
96 command->setParentWindow(wxGetApp().GetTopWindow());
97 command->Do();
98 delete command;
99 }
100 }
101
102 if (event.LeftDown()) {
105 Request statusRequest(Request::DETAILS_REQUEST);
106 if (part != NULL && part->canHandle(&statusRequest)) {
107 canvas_->select(part);
108 ComponentCommand* command = part->performRequest(&statusRequest);
109 command->Do();
110 delete command;
111 }
112 }
113
114 if (event.RightDown()) {
115 popupMenu(x, y);
116 }
117}
virtual bool Do()=0
void setParentWindow(wxWindow *window)
bool canHandle(Request *request) const
Definition EditPart.cc:316
ComponentCommand * performRequest(Request *request) const
Definition EditPart.cc:297
void select(EditPart *part)
EditPart * findEditPart(int x, int y)
void setStatusText(std::string status)
static ProximMachineStateWindow * machineStateWindow()
@ DETAILS_REQUEST
Detailed info request.
Definition Request.hh:53
@ STATUS_REQUEST
Status request.
Definition Request.hh:52
@ MODIFY_REQUEST
Modfify request.
Definition Request.hh:48

References EditPart::canHandle(), canvas_, ProximMachineStateWindow::clearDetails(), MachineCanvas::clearSelection(), Request::DETAILS_REQUEST, ComponentCommand::Do(), MachineCanvas::findEditPart(), ProximToolbox::machineStateWindow(), Request::MODIFY_REQUEST, EditPart::performRequest(), popupMenu(), MachineCanvas::select(), ComponentCommand::setParentWindow(), ProximMachineStateWindow::setStatusText(), and Request::STATUS_REQUEST.

Here is the call graph for this function:

◆ popupMenu()

void ProximMachineCanvasTool::popupMenu ( int  x,
int  y 
)
private

Pops a menu at the given position.

Parameters
xX-coordinate of the popup location.
yY-coordinate of the popup location.

Definition at line 127 of file ProximMachineCanvasTool.cc.

127 {
128 wxMenu* popupMenu = new wxMenu();
129 popupMenu->Append(
131 popupMenu->Append(
133 popupMenu->AppendSeparator();
134 popupMenu->AppendCheckItem(
136 _T("Display Unit Info"));
137 popupMenu->AppendSeparator();
138 popupMenu->AppendCheckItem(
140 popupMenu->AppendCheckItem(
142 _T("Display utilizations"));
143
144 popupMenu->AppendSeparator();
145 popupMenu->Append(
146 ProximMachineStateWindow::COMMAND_EXPORT, _T("Export figure..."));
147
148 canvas_->PopupMenu(popupMenu, wxPoint(x, y));
149}

References canvas_, ProximMachineStateWindow::COMMAND_EXPORT, ProximMachineStateWindow::COMMAND_TOGGLE_MOVES, ProximMachineStateWindow::COMMAND_TOGGLE_UNIT_INFO, ProximMachineStateWindow::COMMAND_TOGGLE_UTILIZATIONS, ProximMachineStateWindow::COMMAND_ZOOM_IN, ProximMachineStateWindow::COMMAND_ZOOM_OUT, and popupMenu().

Referenced by onMouseEvent(), and popupMenu().

Here is the call graph for this function:

Member Data Documentation

◆ canvas_

MachineCanvas* ProximMachineCanvasTool::canvas_
private

MachineCanvas where the tools is used.

Definition at line 56 of file ProximMachineCanvasTool.hh.

Referenced by onMouseEvent(), and popupMenu().


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