Hi Mike,
On 01/26/2015 12:23 PM, Mike Gibson wrote:
> Hi All,
>
> We're trying to implement editing ability with wxArt2d, without using the
> a2dEditorFrame, because
> we want the editor to be a part of our application, not our whole
> application. We're currently
> attempting to get a2dStToolContr working, but are not sure if that is the
> correct solution. We
> want the user to be able to select tools and draw shapes on the canvas, and
> then we need to be
> able to get information about the shapes from the canvas.
>
There is a switch in wxArt2D called WXART2D_USE_EDITOR if you disable that, the
whole wxdocview
framework is not needed anymore, so you will have an a2dDrawing with
a2dDrawingPart, and in there
the tools etc.
I think that is what you want/need. And is also simpler to understand.
a2dEditorFrame is more a redirect frame.
sample_canvas_simple should in the new compile come close to what you need.
> Current problems with a2dStToolContr:
> - we are unable to switch tools. Whatever is pushed last is the only tool
> available. Have tried
> enabling a given tool and marking the "disable all others" flag, but this has
> no effect. Have
> tried disabling the only
The idea is not to push all required tools.
Only push one tool, and pop the one that is already there.
void a2dCanvasCommandProcessor::OnPushToolMenu( wxCommandEvent& event )
Has a lot of examples of that. In fact a2dCanvasCommandProcessor has many
prepared menu to do things.
The oneshot tool pushing might also be something you like. It pops/ends itself
after one drawing action.
So why this pushing?? When you draw a polygon, and want to zoom in while
drawing, this become the
way to do it. a2dMasterTagGroups3 is also something to consider (there are
more types of master tools).
A mastertools organizes how your editor works (pushing and popping tools in a
certain predefined
fashion).
a2dMasterTagGroups3 is typical used for connected objects (with wires etc.).
> other tool that has been pushed to the tool control, this also doesn't work.
Right, use as I suggest and as in the samples.
- we cannot change from the default fill of black. Have tried to
SetDrawMode(a2dWIREFRAME) but this
also doesn't do anything.
Wire frame is only for objects, better leaf the default drawing style for the
moment.
void a2dDrawingPart::SetBackgroundFill( const a2dFill& backgroundfill )
If I add, in MyFrame the next, it does work:
m_canvas->GetDrawingPart()->SetBackgroundFill( a2dFill( wxColour( 100, 17,
155 ) ) );
>
>
> We've noticed that some editor examples came with wxArt2d, but have also
> noticed that they call
> functions that don't exist. The code is incorrect and does not work.
That helps a lot? They don't compile? Where is the sample?
>
> Also the documentation for the editor classes is incomplete, with large
> chunks missing, and
> sometimes function prototype comments do not actually match the function
> prototype.
Yes this type of project with in general one active developer, is not perfect
:-(
But you can help! :-) Also some pay to get it done, the rest is hobby.
Anyway, I do mind, but the situation is like this. But be assured, wxArt2D is
used in some very nice
applications, and can do lot, the learning curve is therefore steep.
>
>
> All of this makes it very difficult to use the editing capabilities, and we
> need a good solid
> example. The initialization code follows (note: cnvsCamera is the a2dCanvas*)
>
> void MyFrame::SetupEditor(void)
> {
>
> // Link an editor to the a2dCanvas.
> m_ToolControl = new a2dStToolContr(cnvsCamera->GetCanvasView(), this);
>
>
> m_RectDraw = new a2dDrawRectangleTool(m_ToolControl);
> m_RectDraw->SetName(_T("Square"));
> m_PolyDraw = new a2dDrawPolygonLTool(m_ToolControl);
> m_PolyDraw->SetName(_T("poly"));
> m_ToolControl->PushTool(m_RectDraw);
> m_ToolControl->PushTool(m_PolyDraw);
>
> m_ToolControl->EnableTool(m_RectDraw, true);
>
> m_ToolControl->DisableTool(m_PolyDraw);
> m_ToolControl->SetDrawMode(a2dWIREFRAME);
>
>
> }PushTool
>
> In this example, the result is that the editor tries to draw polygons with a
> black background.
I suggest you start with the sample I mentioned, and work your way up from
there.
Feel free to ask question while busy with that.
All beginning is hard ;-)
Regards,
Klaas
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Wxart2d-users_dev mailing list
Wxart2d-users_dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxart2d-users_dev