← Back to team overview

kicad-developers team mailing list archive

Re: Drawing a schematic component in simple canvas/bitmap ?

 

Le 16/02/2014 22:11, Henner Zeller a écrit :
> Hi,
> In an attempt to have the new component chooser provide a little
> pre-view of the schematic component in question, I am looking for a
> simple way to draw a component in a canvas. Or even simpler: get a
> bitmap out of it.
> 
> It looks like the EDA_DRAW_PANEL would be the candidate to use here
> (being a simple wxScrolledWindow and stuff), however, it somehow is
> tightly coupled with an EDA_DRAW_FRAME that I don't have available in
> that dialog. So it looks like it is more complicated than I initially
> hoped for, or I am just know knowledegable enough in KiCad source and
> wxWidgets yet to find a simple solution for this without untangeling
> these dependencies too much (which I don't want to right now to not
> interfere with current refactoring approaches).
> 
> Is there a way, or should I wait for the refactoring dust to settle ?
> 
> -h

Have a look at the pin editor dialog: it shows the current edited pin
(roughly what you want to do)

See:
DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
This is a starting point.

You could have to make a minor change in void
LIB_COMPONENT::Draw(EDA_DRAW_PANEL* aPanel,...) and perhaps some ::Draw
functions used by LIB_COMPONENT::Draw to accept a NULL pointer
for aPanel. (most of time, aPanel is used to know the drawing area and
clip drawing primitives, which is not needed here, and many draw
functions currently accept a NULL pointer).

-- 
Jean-Pierre CHARRAS


References