Well I tried to make my own tool

///////////////////////////////////////////////////////////////////////////////
void PutPinTool::OnMouseEvent(wxMouseEvent& event)
{
    if (!m_active)
    {
        event.Skip();
        return;
    }
    GetCanvasView()->SetCursor(m_toolcursor);

    int x = event.GetX();
    int y = event.GetY();

    //to world coordinates to do hit test in world coordinates
    double xw,yw;
    MouseToToolWorld( x, y, xw, yw );

    if (event.LeftDown())
    {
     a2dGetCmdh()->SetLastXyEntry( m_xwprev, m_ywprev );

     EnterBusyMode();
     // add the pin connections in an undoable way
     GetCanvasCommandProcessor()->Submit(
         new a2dCommand_NewPin( a2dCommand_NewPin::Args().x(x).y(y)));
     FinishBusyMode();
    }
    else
     event.Skip();
 }
///////////////////////////////////////////////////////////////////////////


But it crash when it add the pin
int the a2dCommand_NewPin::Do()
when it does a
a2dCanvasDocument* doc = GetCanvasCmp()->CheckCanvasDocument();

and

a2dCanvasDocument* a2dCentralCanvasCommandProcessor::CheckCanvasDocument()
{
    return wxDynamicCast( m_currentDocument, a2dCanvasDocument );
}

my canvas is a canvasSim which doesn't derive from ad2Canvas that's
why it fails ??

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Wxart2d-users_dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wxart2d-users_dev

Reply via email to