Re: [glade--]Glademm and pixmaps also custom widgets

Christopher David wrote:

Hi Chris,

sorry for answering this late, I'd been ill and tried several times to more deeply understand your message.

I first want to thank everyone who helped me get glademm to work on my Linux machine. However, now that I've gotten my test projects to compile, I've been having an issue with pixmaps. The first issue was with custom pixmaps. When I attempted to compile a program with pixmaps I converted from JPEG, the make would generate the following error:

gtk2.0/glademm1.1.3 supports embedding jpeg images directly into the program. (in compressed form, it's unpacked at run time). Why don't you use this feature?

In file included from
../pixmaps/ChrisDavid.xpm:2: syntax error before `[' token In constructor `GameSetup2_glade::GameSetup2_glade()': `Chris' undeclared (first use this function) (Each undeclared identifier is reported only once for
  each function it appears in.) `manage' undeclared (first use this function)
cc1plus: `<declaration error>' is not a function,
/usr/include/sigc++-1.0/sigc++/object.h:143: conflict with `template<class T>
  T* SigC::manage(T*)'   in call to `manage'

Perhaps preceding manage by Gtk:: might help, can you please send me the preamble (first 5 lines) of your .xpm, so I can give more clued advices, I was unable to guess your problem ;-)

make[2]: *** [GameSetup2_glade.o] Error 1
make[2]: Leaving directory `/home/Virtual/cs_205/gui_12/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/Virtual/cs_205/gui_12'
make: *** [all] Error 2

At first I thought it was the fact that the pixmap files had a space in it, so I changed the file names, setup the project with a new name in a new folder, and tried again, but still the same message. I then used a pixmap that came with a program on my Linux machine and it compiled fine. However, when attempting to execute the program, the image does not appear and I get this message:

Gdk---WARNING **: Couldn't create pixmap out of file '../pixmaps/edit.xpm' - using internal default

it tries to load the image at run time - AFAIK embedding images is the default for recent glademms, but if it can't find the file, it can't embed it ... do you really want runtime loading? (I prefer embedded images)

I heard of having to use "make install" when using gnome support and such, but I ran make and make install and I still get the same message. Again, I tried a new project but I still get the same message. I tried manually copying the pixmap folder to the the bin directory where the project was installed, still no such luck. Is there anyway to get this to work, pixmaps or pictures in general are a big thing for this project. Is there another widget to use, like GTK Image (and how to use it or where I can find out how to use it)?

There is a PIXMAP_DIR or so, try to look with strace for the path it searches. I usually never load images at run time (too easy to mess up the directory structure).

Another, less pressing matter is custom widgets. To be specific, I am trying to design a widget that is basically a giant grid. Ideally, I want to be able to place objects on the grid, or shade parts of the grid, by clicking on the different squares. However, I need to store the data based on what I do or put on the grid (for now I'll probably be using a multimap from STL). Is there any place I can find out where I can make the widget, so it will return grid coordinates in callbacks based on clicks, and modify each square individually and so forth. I could make a table, but it I have a 40x40 table, I'd need callbacks for each individual square in the table, which is 1600 squares. Hence, one object that returns grid coordinates is a lot easier. I had also wanted to modify grid lines by changing color or thickness at runtime also, but I may just ditch that as that would be too complicated. IF someone could point me in the right direction here as well, I would be greatly appreciative. Thank you so much for all your help so far.

Give GnomeCanvas or FooCanvas a try (FooCanvasmm was created two weeks ago). It sounds like this is the widget you are looking for (gnumeric, gcompris are examples of programs which use this widget). Usually I attach pointer to my data structures to the set_data interface of my widgets (using smart pointers and other magic (data destroy callbacks, I don't remember the exact name, it's a separate argument to set_data)).


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]