void hdSelectionTool::mouseDown(hdMouseEvent &event) { hdITool::mouseDown(event); hdDrawingView *view = event.getView(); int x = event.GetPosition().x, y = event.GetPosition().y; hdIHandle *handle = view->findHandle(view->getIdx(), x, y); if(handle) { setDelegateTool(view, new hdHandleTrackerTool(view, handle)); } else { hdIFigure *figure = view->getDrawing()->findFigure(view->getIdx(), x, y); if(figure) { view->getDrawing()->bringToFront(figure); setDelegateTool(event.getView(), figure->CreateFigureTool(view, new hdDragTrackerTool(view, figure))); } else { setDelegateTool(event.getView(), new hdCanvasMenuTool(view, new hdSelectAreaTool(view)) ); } } hdITool *delegateTool = getDelegateTool(); if (delegateTool) delegateTool->mouseDown(event); }
void wxhdSelectionTool::mouseDown(wxhdMouseEvent& event) { wxhdITool::mouseDown(event); wxhdDrawingView *view=getDrawingEditor()->view(); int x=event.GetPosition().x, y=event.GetPosition().y; wxhdIHandle *handle = view->findHandle(x,y); if(handle) { setDelegateTool(new wxhdHandleTrackerTool(getDrawingEditor(),handle)); } else { wxhdIFigure *figure = view->getDrawing()->findFigure(x,y); if(figure) { view->getDrawing()->bringToFront(figure); setDelegateTool(figure->CreateFigureTool(getDrawingEditor(),new wxhdDragTrackerTool(getDrawingEditor(),figure))); } else { setDelegateTool( new wxhdCanvasMenuTool(getDrawingEditor(),new wxhdSelectAreaTool(getDrawingEditor())) ); } } wxhdITool *delegateTool = getDelegateTool(); if (delegateTool) delegateTool->mouseDown(event); }
void wxhdCompositeFigureTool::mouseDown(wxhdMouseEvent& event) { int x=event.GetPosition().x, y=event.GetPosition().y; wxhdCompositeFigure *cfigure = (wxhdCompositeFigure*) getFigure(); wxhdIFigure *figure = cfigure->findFigure(x,y); if(figure) { setDelegateTool(figure->CreateFigureTool(getDrawingEditor(),getDefaultTool())); } else { setDelegateTool(getDefaultTool()); } if(delegateTool) { delegateTool->mouseDown(event); } }