OpenASIP
2.0
|
#include <EditPart.hh>
Public Member Functions | |
EditPart () | |
virtual | ~EditPart () |
void | putGarbage (std::set< EditPart * > &trashbag) |
EditPart * | parent () const |
void | setParent (EditPart *parent) |
TTAMachine::MachinePart * | model () const |
void | setModel (TTAMachine::MachinePart *model) |
Figure * | figure () const |
void | setFigure (Figure *figure) |
EditPart * | find (wxPoint point) |
EditPart * | find (const TTAMachine::MachinePart *model) |
EditPart * | findNearest (wxPoint point, const EditPart *exclude=NULL) |
int | findInRange (wxPoint point, float radius, std::vector< EditPart * > &found) |
bool | hasEditPartRecursive (const EditPart *part) const |
bool | selectable () const |
bool | selected () const |
void | setSelectable (bool selectable) |
void | setSelected (bool select) |
void | installEditPolicy (EditPolicy *editpolicy) |
void | addChild (EditPart *child) |
int | childCount () const |
EditPart * | child (unsigned int index) const |
ComponentCommand * | performRequest (Request *request) const |
bool | canHandle (Request *request) const |
Protected Attributes | |
EditPart * | parent_ |
Parent of this EditPart. More... | |
Figure * | figure_ |
Figure of this EditPart. More... | |
TTAMachine::MachinePart * | model_ |
Machine component corresponding to this EditPart. More... | |
bool | selectable_ |
Tells whether the EditPart is selectable or not. More... | |
bool | selected_ |
Tells whether the EditPart is selected or not. More... | |
bool | garbageCollected_ |
Helper member to prevent improper deletion. More... | |
std::vector< EditPolicy * > | editPolicies_ |
List of supported EditPolicies. More... | |
std::vector< EditPart * > | children_ |
List of children EditParts. More... | |
Private Member Functions | |
EditPart & | operator= (EditPart &old) |
Assignment not allowed. More... | |
EditPart (EditPart &old) | |
Copying not allowed. More... | |
Static Private Member Functions | |
static float | distance (wxPoint p, wxRect r) |
Connects a model object to a graphical object on the canvas.
An EditPart receives Requests generated by user actions and converts them to possible changes in the model (Commands) using its EditPolicies. EditParts can contain other EditParts as children. Every EditPart has a Figure.
Definition at line 60 of file EditPart.hh.
EditPart::EditPart | ( | ) |
|
virtual |
The Destructor.
Definition at line 72 of file EditPart.cc.
References assert, editPolicies_, figure_, and garbageCollected_.
|
private |
Copying not allowed.
void EditPart::addChild | ( | EditPart * | child | ) |
Adds an EditPart as a child.
child | The new child to be added. |
Definition at line 260 of file EditPart.cc.
References Figure::addChild(), assert, child(), children_, ContainerTools::containsValue(), figure(), and figure_.
Referenced by UnitPortFactory::addSocket(), MachineEditPartFactory::createBiDirBridge(), SegmentFactory::createEditPart(), BusFactory::createEditPart(), FUFactory::createEditPart(), IUFactory::createEditPart(), RFFactory::createEditPart(), GCUFactory::createEditPart(), MachineEditPartFactory::createEditPart(), MachineEditPartFactory::getBusChains(), MachineEditPartFactory::getSockets(), and MachineEditPartFactory::getUnits().
bool EditPart::canHandle | ( | Request * | request | ) | const |
Tells whether this EditPart can handle a certain type of Request.
request | The Request to be asked if it can be handled. |
Definition at line 316 of file EditPart.cc.
References editPolicies_.
Referenced by CopyComponentCmd::isEnabled(), CutComponentCmd::isEnabled(), DeleteComponentCmd::isEnabled(), ModifyComponentCmd::isEnabled(), ConnectTool::leftClick(), ProximMachineCanvasTool::onMouseEvent(), SelectTool::onMouseEvent(), ConnectTool::onMouseEvent(), ProximMachineStateWindow::onSimulationStop(), and ConnectTool::updateStatusline().
EditPart* EditPart::child | ( | unsigned int | index | ) | const |
Referenced by addChild(), DeleteBridgeCmd::Do(), and ModifyBridgeCmd::Do().
int EditPart::childCount | ( | ) | const |
Referenced by UnitPortFactory::createEditPart(), DeleteBridgeCmd::Do(), and ModifyBridgeCmd::Do().
|
staticprivate |
Calculates distance between a point and a rectangle.
p | Position. |
r | Rectangle. |
Definition at line 335 of file EditPart.cc.
Referenced by findInRange(), and findNearest().
Figure* EditPart::figure | ( | ) | const |
Referenced by addChild(), MachineCanvas::addMove(), MachineCanvas::clearHighlights(), ConnectTool::figure(), findNearest(), MachineCanvas::getFigureSize(), MachineCanvas::highlight(), SelectTool::leftClick(), MachineCanvas::OnDraw(), ConnectionEditPart::setSource(), ConnectionEditPart::setTarget(), and MachineCanvas::updateMachine().
EditPart * EditPart::find | ( | const TTAMachine::MachinePart * | model | ) |
Finds an EditPart which corresponds given machine component.
model | Machine component to find. |
Definition at line 134 of file EditPart.cc.
References children_, model(), and model_.
EditPart * EditPart::find | ( | wxPoint | point | ) |
Finds an EditPart whose Figure is located in the given point.
point | Point in which to find an EditPart. |
Definition at line 102 of file EditPart.cc.
References children_, figure_, selectable_, and Figure::virtualBounds().
Referenced by MachineCanvas::findEditPart(), and MachineCanvas::highlight().
int EditPart::findInRange | ( | wxPoint | point, |
float | radius, | ||
std::vector< EditPart * > & | found | ||
) |
Recursively looks for selectable EditParts including self that are in range around given coordinates.
point | Position for the search. |
radius | Search range. |
found | Found EditParts are collected to this. |
Definition at line 219 of file EditPart.cc.
References children_, distance(), figure_, selectable_, and Figure::virtualBounds().
Referenced by MachineCanvas::findEditPartsInRange().
Finds an EditPart whose Figure is nearest to the given point or first found EditPart whose figure contains the given point.
point | Point in which to find the nearest EditPart. |
exclude | An EditPart which is not included in the search. |
Definition at line 162 of file EditPart.cc.
References assert, children_, distance(), figure(), figure_, selectable(), selectable_, and Figure::virtualBounds().
bool EditPart::hasEditPartRecursive | ( | const EditPart * | part | ) | const |
Looks for given EditPart recursively.
part | EditPart to look up. |
Definition at line 274 of file EditPart.cc.
References children_.
Referenced by MachineCanvas::hasEditPart().
void EditPart::installEditPolicy | ( | EditPolicy * | editpolicy | ) |
Installs a new EditPolicy.
editpolicy | The EditPolicy to be installed. |
Definition at line 247 of file EditPart.cc.
References editPolicies_, EditPolicy::host(), and EditPolicy::setHost().
Referenced by MachineEditPartFactory::createBiDirBridge(), UnitPortFactory::createEditPart(), BusFactory::createEditPart(), GCUFactory::createEditPart(), RFFactory::createEditPart(), FUFactory::createEditPart(), IUFactory::createEditPart(), SegmentFactory::createEditPart(), BridgeFactory::createEditPart(), and SocketFactory::createEditPart().
TTAMachine::MachinePart* EditPart::model | ( | ) | const |
Referenced by ProximPortEditPolicy::canHandle(), ProDePortEditPolicy::canHandle(), ProDeSocketEditPolicy::canHandle(), ProDeSegmentEditPolicy::canHandle(), MachineEditPartFactory::createBiDirBridge(), ProDeSegmentEditPolicy::createConnectCmd(), ProDePortEditPolicy::createConnectCmd(), ProDeSocketEditPolicy::createConnectCmd(), DeleteFUCmd::Do(), DeleteRFCmd::Do(), DeleteSocketCmd::Do(), DeleteBusCmd::Do(), DeleteGCUCmd::Do(), DeleteIUCmd::Do(), ModifyBusCmd::Do(), ModifyFUCmd::Do(), DeletePortCmd::Do(), ModifyGCUCmd::Do(), DeleteSegmentCmd::Do(), ModifyIUCmd::Do(), CopyComponent::Do(), ModifyRFCmd::Do(), ModifySocketCmd::Do(), ModifyFUPortCmd::Do(), ModifyIUPortCmd::Do(), ModifyRFPortCmd::Do(), DeleteBridgeCmd::Do(), ProximSetMachineWinStatusCmd::Do(), ModifySRPortCmd::Do(), ProximShowRegistersCmd::Do(), ProximShowPortsCmd::Do(), ModifyBridgeCmd::Do(), ConnectTool::figure(), find(), ProximSocketEditPolicy::getCommand(), ProximFUEditPolicy::getCommand(), ProximIUEditPolicy::getCommand(), ProximRFEditPolicy::getCommand(), ProximBusEditPolicy::getCommand(), ProximPortEditPolicy::getCommand(), ProDeSocketEditPolicy::getCommand(), ProDeSegmentEditPolicy::getCommand(), ProDeBusEditPolicy::getCommand(), ProDeFUEditPolicy::getCommand(), ProDePortEditPolicy::getCommand(), ProDeBridgeEditPolicy::getCommand(), ProDeIUEditPolicy::getCommand(), ProDeGCUEditPolicy::getCommand(), ProDeRFEditPolicy::getCommand(), ProximMachineStateWindow::onSimulationStop(), and MachineCanvas::select().
EditPart* EditPart::parent | ( | ) | const |
Referenced by ProDeSegmentEditPolicy::getCommand(), and MachineCanvas::select().
ComponentCommand * EditPart::performRequest | ( | Request * | request | ) | const |
If an EditPolicy supporting the given Request is installed to this EditPart, a corresponding Command will be returned or NULL if no EditPolicies supporting the Request is found.
request | The Request to be performed. |
Definition at line 297 of file EditPart.cc.
References editPolicies_.
Referenced by CopyComponentCmd::Do(), CutComponentCmd::Do(), DeleteComponentCmd::Do(), ModifyComponentCmd::Do(), ConnectTool::leftClick(), ProximMachineCanvasTool::onMouseEvent(), SelectTool::onMouseEvent(), ProximMachineStateWindow::onSimulationStop(), and ConnectTool::updateStatusline().
void EditPart::putGarbage | ( | std::set< EditPart * > & | trashbag | ) |
Puts all children and this EditPart to the trashbag.
trashbag | The trashbag. |
Definition at line 87 of file EditPart.cc.
References children_, and garbageCollected_.
Referenced by RootEditPart::collectTrash().
bool EditPart::selectable | ( | ) | const |
Referenced by findNearest(), and SelectTool::leftClick().
bool EditPart::selected | ( | ) | const |
void EditPart::setFigure | ( | Figure * | figure | ) |
Referenced by MachineEditPartFactory::createBiDirBridge(), SocketPortConnFactory::createConnection(), SocketBusConnFactory::createConnection(), BridgeFactory::createEditPart(), GCUFactory::createEditPart(), UnitPortFactory::createEditPart(), RFFactory::createEditPart(), BusFactory::createEditPart(), IUFactory::createEditPart(), FUFactory::createEditPart(), SegmentFactory::createEditPart(), SocketFactory::createEditPart(), MachineEditPartFactory::createEditPart(), MachineEditPartFactory::getBusChains(), MachineEditPartFactory::getSockets(), and MachineEditPartFactory::getUnits().
void EditPart::setModel | ( | TTAMachine::MachinePart * | model | ) |
Referenced by MachineEditPartFactory::createBiDirBridge(), UnitPortFactory::createEditPart(), BusFactory::createEditPart(), SegmentFactory::createEditPart(), GCUFactory::createEditPart(), RFFactory::createEditPart(), FUFactory::createEditPart(), IUFactory::createEditPart(), BridgeFactory::createEditPart(), SocketFactory::createEditPart(), and ModifyBridgeCmd::Do().
void EditPart::setParent | ( | EditPart * | parent | ) |
Referenced by BusFactory::createEditPart().
void EditPart::setSelectable | ( | bool | selectable | ) |
Referenced by MachineEditPartFactory::createBiDirBridge(), UnitPortFactory::createEditPart(), BusFactory::createEditPart(), RFFactory::createEditPart(), FUFactory::createEditPart(), IUFactory::createEditPart(), GCUFactory::createEditPart(), BridgeFactory::createEditPart(), and SocketFactory::createEditPart().
void EditPart::setSelected | ( | bool | select | ) |
Referenced by MachineCanvas::clearSelection(), and MachineCanvas::select().
|
protected |
List of children EditParts.
Definition at line 107 of file EditPart.hh.
Referenced by addChild(), find(), findInRange(), findNearest(), hasEditPartRecursive(), and putGarbage().
|
protected |
List of supported EditPolicies.
Definition at line 105 of file EditPart.hh.
Referenced by canHandle(), installEditPolicy(), performRequest(), and ~EditPart().
|
protected |
Definition at line 93 of file EditPart.hh.
Referenced by addChild(), find(), findInRange(), findNearest(), ConnectionEditPart::setSource(), ConnectionEditPart::setTarget(), and ~EditPart().
|
protected |
Helper member to prevent improper deletion.
Definition at line 102 of file EditPart.hh.
Referenced by RootEditPart::collectTrash(), putGarbage(), RootEditPart::setContents(), and ~EditPart().
|
protected |
Machine component corresponding to this EditPart.
Definition at line 95 of file EditPart.hh.
Referenced by find().
|
protected |
Parent of this EditPart.
Definition at line 91 of file EditPart.hh.
|
protected |
Tells whether the EditPart is selectable or not.
Definition at line 97 of file EditPart.hh.
Referenced by find(), findInRange(), and findNearest().
|
protected |
Tells whether the EditPart is selected or not.
Definition at line 99 of file EditPart.hh.