← Back to team overview

kicad-developers team mailing list archive

Re: KiCad new look - new icons and new buttons

 

> There could be a gotcha in my plan regarding static constructors running before
> wxWidgets is set up.  But maybe that will not bite us.
>
>
> A quick test of this can be done by trying it manually, that is linking a hand
> written bitmap file along with the MakeBitmap function.


that test was done, and we got bit:



$ pcbnew/pcbnew

(process:2954): GLib-GObject-CRITICAL **:
/build/buildd/glib2.0-2.24.1/gobject/gtype.c:2706: You forgot to call g_type_init()

(process:2954): GLib-CRITICAL **: g_once_init_leave: assertion
`initialization_value != 0' failed

(process:2954): GLib-GObject-CRITICAL **: g_object_new: assertion
`G_TYPE_IS_OBJECT (object_type)' failed


in main() has not run yet, and wxWidgets is not up to speed yet.  A clear path
to success can be had by constructing the bitmaps as we need them, similar to
how we do it now. 


    wxBitmap( rotate_neg_X_xpm )

can become

    Bitmap( rotate_neg_X_xpm )


Let's introduce struct BITMAP_DEF:


rotate_neg_X_xpm becomes a BITMAP_DEF:

struct BITMAP_DEF
{
    unsigned char* png;
    int            pngByteCount;
};


The header file, bitmaps.h, would then simply include:

----------------------------------------------------------------------------

wxBitmap MakeBitmap( const unsigned char* aPNG, int aByteCount );

wxBitmap Bitmap( const BITMAP_DEF& aBM )
{
    return MakeBitmap( aBM.png, aBM.pngByteCount );
}

extern BITMAP_DEF rotate_neg_X_bitmap;
extern BITMAP_DEF other_bitmap;
:
:

---------------------------------------------------------------------------

We still get the linker to pull in only what we need, and all the automation
still applies.


Dick





References