Laurent Veilleux wrote:
> GetCanvasCommandProcessor()->Submit(
> new a2dCommand_NewPin( a2dCommand_NewPin::Args().x(x).y(y)));
GetCanvasCommandProcessor() is what?
a2dCanvasCommandProcessor* a2dBaseTool::GetCanvasCommandProcessor()
{
if ( !GetCanvasDocument() )
return NULL;
return GetCanvasDocument()->GetCanvasCommandProcessor();
}
So it is the command processor from the view its document.
> But it crash when it add the pin
> int the a2dCommand_NewPin::Do()
But this is a command meant for the a2dCentralCanvasCommandProcessor which is
not belonging to a document.
This is when you issue a command from a menu, e.g. compare with FileOpen(),
which is a command, and results into a
document, but of course there is no document yet, and therefore also the
document command processor makes not sence.
So a central command processor is used for that. But as soon as the document is
there, and you want to add object to it,
and be able to undo it (sperate for each open document), you must use the
command processor from the docuemnt.
You need something like this, for the GetCanvasCommandProcessor().
GetCanvasCommandProcessor()->Submit( new a2dCommand_AddObject(
pin->GetParent(), pin ), true );
And maybe later:
GetCanvasCommandProcessor()->Submit( new a2dCommand_ConnectPins( drawPin, pin
), true );
See a2dDrawWirePolylineLTool.
--
Unclassified
-------------------------------------------------------------------------
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