void hdPolyLineHandle::invokeStart(hdMouseEvent &event, hdDrawingView *view)
{
	if(event.RightDown())
	{
		((hdPolyLineFigure *) getOwner())->removePointAt(view->getIdx(), indx);
		view->notifyChanged();
	}
}
void hdCanvasMenuTool::mouseDown(hdMouseEvent &event)
{
	//Linux hack for bug
	int x = event.GetPosition().x, y = event.GetPosition().y;
	setAnchorCoords(x, y);

	if(event.RightDown())
	{
		wxMenu menu;
		event.getView()->setCanvasMenuTool(this);
		createViewMenu(event.getView(), menu);
		event.getView()->connectPopUpMenu(menu);
		hdPoint p = event.GetPosition();
		event.getView()->CalcScrolledPosition(p.x, p.y, &p.x, &p.y);
		event.getView()->PopupMenu(&menu, p);
		return;
	}

	defaultTool->mouseDown(event);
}
void hdMenuTool::mouseDown(hdMouseEvent &event)
{
    //Linux hack for bug
    int x = event.GetPosition().x, y = event.GetPosition().y;
    setAnchorCoords(x, y);

    if(menuFigure->menuEnabled() && event.RightDown())
    {
        wxMenu menu;
        event.getView()->setMenuToolFigure(menuFigure);
        menuFigure->createMenu(menu);
        event.getView()->connectPopUpMenu(menu);
        hdPoint p = event.GetPosition();
        event.getView()->CalcScrolledPosition(p.x, p.y, &p.x, &p.y);
        event.getView()->PopupMenu(&menu, p);
        return;
    }

    getDefaultTool()->mouseDown(event);
}
void hdSimpleTextTool::mouseDown(hdMouseEvent &event)
{
	setAnchorCoords(event.GetPosition().x, event.GetPosition().y);

	// Right click to get the contextual menu
	if(txtFigure->menuEnabled() && event.RightDown())
	{
		wxMenu menu;
		event.getView()->setSimpleTextToolFigure(txtFigure, true);
		txtFigure->createMenu(menu);
		event.getView()->connectPopUpMenu(menu);
		hdPoint p = event.GetPosition();
		event.getView()->CalcScrolledPosition(p.x, p.y, &p.x, &p.y);
		event.getView()->PopupMenu(&menu, p);
		return;
	}

	// Double click to rename an object
	if(event.LeftDClick())
	{
		if(withoutDialog)
		{
			event.getView()->setSimpleTextToolFigure(txtFigure);
			showEdit = true;
			event.getView()->getSimpleTextToolEdit()->ChangeValue(txtFigure->getText()); //Same as SetValue but don't generated wxEVT_COMMAND_TEXT_UPDATED event
			calculateSizeEntry(event.getView());
			event.getView()->getSimpleTextToolEdit()->SetFocus();
			event.getView()->getSimpleTextToolEdit()->Show();
			event.getView()->getOkTxt()->Show();
			event.getView()->getCancelTxt()->Show();
		}
		else
		{
			callDialog(event.getView());
		}
		return;
	}
	getDefaultTool()->mouseDown(event);
}