Hi,

Can you give me an example of using the rectangle to determine when the 
creation of the rectangle is complete? What I mean is, with the code you sent 
me, I get an "object added" event when the user clicks the mouse the first time 
to indicate the first of the rectangle's corners. What I need is the 2nd click 
which completes the rectangle. Basically, I want to be able to show the 
dimensions of the rectangle once it has been completed.

[Klaas] I think you need to make your own derived rectangle, o achieve that, 
and also a the tool to draw it.
         Don't know right now if there is an event to intercept exactly at that 
moment.


Also, I see that when a rectangle is resized, that I get 4 
a2dCommandProcessorEvent "SetProperty" events, and 4 a2dDrawingEvents.
Is there a way to see what property is set?

{Klaas] Very likely generated from here indirectly (see stack at that point):

void a2dRect::OnHandleEvent( a2dHandleMouseEvent& event )

             else if ( event.GetMouseEvent().LeftUp() )
             {
                         a2dCommandProcessor* cmd = 
m_root->GetCommandProcessor();
                 a2dCommandGroup* commandgroup = cmd->CommandGroupBegin( wxT( 
"rectangle edit" ) );
                 cmd->Submit( new a2dCommand_SetCanvasProperty( original, 
PROPID_TransformMatrix, m_lworld ) );
                 cmd->Submit( new a2dCommand_SetCanvasProperty( original, 
PROPID_Width, m_width ) );
                 cmd->Submit( new a2dCommand_SetCanvasProperty( original, 
PROPID_Height, m_height ) );
                 cmd->Submit( new a2dCommand_SetCanvasProperty( original, 
PROPID_Radius, m_radius ) );
                 cmd->CommandGroupEnd( commandgroup );
             }

So when editing is finished, you could test for that in:

void a2dDrawing::OnDoEvent( a2dCommandProcessorEvent& event )
{
     if ( event.GetCommand()->Modifies() )
         Modify( true );
}

There the event says the command is a2dCommand_SetCanvasProperty and gives you 
a pointer to it, which has a pointer the m_property and m_id, and from the 
m_id, you can find the name.
>From the m_property you can find also the m_value.
So yes, you can see much at that stage.


I had previously emailed you about restricting the rectangle so that the user 
cannot do skew and rotate, but now I see that a "reshape" has been added. How 
do we block that?

[Klaas]
Did add a property for that now, also rectangle tool, can now work with a 
template object. See single2 example on how to use it.

If I make my own rectangle class, do I need to make my own rectangle tool class 
so that the editor knows to use my rectangles instead of the a2dRect?

[Klaas]
Now not anymore, because of the template object, but must be derived from 
a2dRect.

I've tried to find a lot of these answers in the documentation, but I have been 
unsuccessful. Is there somewhere in the documentation that covers which events 
each class handles and emits?

[Klaas] not enough if any. So really need to read the source.

I myself love this one, you can easily find what event are generated where, by 
setting a break point when needed. And look at the stack.

#if wxUSE_EXCEPTIONS
void
MyApp::HandleEvent(wxEvtHandler *handler,
                               wxEventFunction func,
                               wxEvent& event) const
{
     // by default, simply call the handler
     (handler->*func)(event);
}
#endif

At last, I could add a signal to be emitted at the right moment.
For instance search for these, in the code, such a signal I could add when 
finishing an action in a tool.

const a2dSignal a2dStTool::sig_toolComEventAddObject = wxNewId();
const a2dSignal a2dStTool::sig_toolComEventSetEditObject = wxNewId();


Regards,

Klaas

  


------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
_______________________________________________
Wxart2d-users_dev mailing list
Wxart2d-users_dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxart2d-users_dev

Reply via email to