toolbar bitmap

Discussion about CodeLite development process and patches
cenix
CodeLite Enthusiast
Posts: 20
Joined: Wed Sep 24, 2008 9:49 pm

toolbar bitmap

Post by cenix »

I'm trying to extend a particular toolbar with some convenience function. This function combines several existing functions into one.
All is going well, however when I come to create the bitmap for the toolbar, I get the following assert:

Code: Select all

ASSERT INFO:
../src/gtk/tbargtk.cpp(404): assert "bitmap.Ok()" failed in DoInsertTool(): invalid bitmap for wxToolBar icon

BACKTRACE:
[1] wxToolBar::DoInsertTool(unsigned int, wxToolBarToolBase*)
[2] wxToolBarBase::InsertTool(unsigned int, wxToolBarToolBase*)
[3] wxToolBarBase::InsertTool(unsigned int, int, wxString const&, wxBitmap const&, wxBitmap const&, wxItemKind, wxString const&, wxString const&, wxObject*)
[4] wxToolBarBase::DoAddTool(int, wxString const&, wxBitmap const&, wxBitmap const&, wxItemKind, wxString const&, wxString const&, wxObject*, int, int)
[5] wxToolBarBase::AddTool(int, wxString const&, wxBitmap const&, wxBitmap const&, wxItemKind, wxString const&, wxString const&, wxObject*) /usr/include/wx-2.8/wx/tbarbase.h:261
[6] wxToolBarBase::AddTool(int, wxString const&, wxBitmap const&, wxString const&, wxItemKind) /usr/include/wx-2.8/wx/tbarbase.h:270
[7] Frame::CreateToolbars24() /home/cenix/Programming/codelite/codelite/LiteEditor/frame.cpp:849
[8] Frame::CreateGUIControls() /home/cenix/Programming/codelite/codelite/LiteEditor/frame.cpp:681
[9] Frame() /home/cenix/Programming/codelite/codelite/LiteEditor/frame.cpp:439
[10] Frame::Initialize(bool) /home/cenix/Programming/codelite/codelite/LiteEditor/frame.cpp:508
[11] App::OnInit() /home/cenix/Programming/codelite/codelite/LiteEditor/app.cpp:312
I have modified the resources.xrc file to include the new bitmap and made the correct AddTool() call. It compiles fine.
If I replace the call to point to another existing bitmap wxXmlResource::Get()->LoadBitmap(wxT("<bitmap id>")) all goes fine.

This implies that my bitmap is not correct, however when I make a copy of an existing bitmap and use that one, it also fails(!).

I must be forgetting something (or else don't see correctly what is going wrong).
How to proceed?
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: toolbar bitmap

Post by eranif »

I suspect that you did not compile the resources.xrc file, did you?

to compile it you need to run this command (you should cd to /home/cenix/Programming/codelite/codelite/LiteEditor/)

Code: Select all

wxrc -c -v -o resources.cpp resources.xrc
the above command will generate new resources.cpp file from the xrc - now your bitmap should be OK.

If you dont have wxrc installed on your machine, you should install it like this:

Code: Select all

sudp apt-get install wx-common
Eran
Make sure you have read the HOW TO POST thread
cenix
CodeLite Enthusiast
Posts: 20
Joined: Wed Sep 24, 2008 9:49 pm

Re: toolbar bitmap

Post by cenix »

See, I knew I forgot something ;)

Only thing I now encounter is its long processing time. Its running for about 20 minutes now and the file is 23810 lines long, but the file isn't completed yet (at least missing some values and the closing };
So I guess something is not quite right yet.

Ah well, have to go now, will try further tomorrow.
cenix
CodeLite Enthusiast
Posts: 20
Joined: Wed Sep 24, 2008 9:49 pm

Re: toolbar bitmap

Post by cenix »

Still no luck :(

I can wait forever for wxrc to complete. If I try to compile a binary file (xrs), I get a segfault, so I'm not sure it wxrc is fully broken or only for binary compiles. Damnit.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: toolbar bitmap

Post by eranif »

cenix wrote:I can wait forever for wxrc to complete.
Which OS?

Here, on my Kbuntu 8.04,64bit, running this command:

Code: Select all

wxrc -c -v -o resources.cpp resources.xrc 
takes less than 10 secs.

If it still fails, you can try other methods of embedding your images like load them directly from file.

try re-installing wx-common

Eran
Make sure you have read the HOW TO POST thread
cenix
CodeLite Enthusiast
Posts: 20
Joined: Wed Sep 24, 2008 9:49 pm

Re: toolbar bitmap

Post by cenix »

I tried reinstalling wx-common, but with the same result.

Code: Select all

<snip>
adding     res/error.png...
adding     res/page_white_text_modified.png...
adding     res/page_white_text_ok.png...
adding     res/error.png...
adding     res/folder_modified.png...
adding     res/folder_ok.png...
adding     res/error.png...
creating C++ source file /home/cenix/Programming/codelite/trunk/LiteEditor/resources.cpp...
And at that moment, wxrc keeps eating CPU.
Maybe I'll try to embed imaged directly from file.
Post Reply