Re: About Gtk+ for Windows
Hello everyone, I am glad to know that there is someone working on the implementation of GTK+ for the MS environment. Needless to say, GTK+ has left its infancy in the UNIX world and is moving strongly into the MS world. This momentum must not be lost and volunteers are needed to maintain the the releases for Win32 more up-to-date. I understand that this requires, more then time and will, the necessary skills. Obviously this skills do not exist in abundance, however, with the help of Cedric and Murray the learning curve will not be so overwhelmingly steep. I am a Gtkmm-win32 user and would like to offer my help in what ever necessary, please feel free to contact me regarding this matter at your earliest convenient. Thank you On Thu, Apr 17, 2008 at 7:51 AM, Igor Gorbounov [EMAIL PROTECTED] wrote: Murray Cumming wrote: [...] Does this mean that there is no GTK+ 2.12 that we can use? There is gtk-2.12-9-win32 since yesterday on http://sourceforge.net/projects/gladewin32 but no gtkmm-2.12... on http://ftp.gnome.org/pub/gnome/binaries/win32/gtkmm yet. Igor Gorbounov ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list -- Happiness has many doors, and when one of them closes another opens, yet we spent so much time looking at the one that is shut that we don't see the one that just opened. ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Text location with pango
When drawing to a drawing area 1024x768 pixels using Pango and Cairo, I am having trouble getting the text centered within the whole window and changing the font size. I am trying to center it with: pangoLayout - set_alignment(Pango::ALIGN_CENTER); which centers it to the width of the longest line in the layout, not the whole width. set_width(1024) or any other number results in half of thext being off the left hand side of the window I have been using set_size() on the FontDescription, but his makes no change, although the font does change when set_family() is used. And help/suggestion would be appreciated Toby Roworth -- Sent by Toby Roworth ([EMAIL PROTECTED]) This message is intended for the named reciepients only, and should not be forwarded without permission The conents of this message may be Toby Roworth ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Finding the .glade file
Am Sat, 05 Apr 2008 16:23:15 +0100 schrieb Joe: Hi. I am not sure exactly how to go about pointing my program at the glade file when the program is installed. I most likely need environment variables but I have no idea how to do this. I have written the application using the anjuta IDE, and the .glade seems to install into /usr/share/appname, however I cannot be certain this is the same for all distributions. Hello, I use that code to load my .glade files: It enabled you to load from the prefix path, and some local path or included in the binary. Very useful for development or distribution as binary package (e.g. on win32). #ifdef GLADE_HEADER_COMPILE #include app_glade.h #else #define APP_GLADE_FILE app.glade #endif Glib::RefPtrGnome::Glade::Xml createGlade (const Glib::ustring root, const Glib::ustring domain) { #ifdef GLADE_HEADER_COMPILE return Gnome::Glade::Xml::create_from_buffer( pogo_glade_data, pogo_glade_data_size, root, domain); #else return Gnome::Glade::Xml::create( searchGladeFile (APP_GLADE_FILE), root, domain); #endif } const std::string searchGladeFile (const std::string glade_file) { vector string name_vector; name_vector.push_back (glade_file); name_vector.push_back (../ + glade_file); name_vector.push_back (src/ + glade_file); // TODO: src dir variable... name_vector.push_back (string (PACKAGE_DATA_DIR) + /glade/ + glade_file); return searchFile (name_vector); } const std::string searchFile (std::vector std::string name_vector) { struct stat buf; for (unsigned int i = 0; i name_vector.size (); i++) { string try_name = name_vector[i]; bool found = !(stat (try_name.c_str (), buf)); if (found) { return try_name; } } return ; } Your application needs to be based on autotools stuff to get that working. Use this macro: dnl Check for option to enable glade_h AC_MSG_CHECKING(whether to enable glade header compile) AC_ARG_ENABLE(glade_header_compile, [ --enable-glade_header_compile=[no/yes]enables to compile the glade file into the executable (default=no)],, enable_glade_header_compile=no) if [ ! test x$enable_glade_header_compile != xyes]; then AC_DEFINE(GLADE_HEADER_COMPILE, 1, [Define to enable to compile the glade header]) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi And this in autogen.sh: perl src/bin2hex.pl src/app.glade 1 app_glade_data src/app_glade.h I modified the bin2hex.pl from the original author to get it working for my special use case. The modified code follows below: # bin2hex.pl by Chami.com # http://www.chami.com/tips/ # # number of characters per line $chars_per_line = 15; # - # language id # # 0 = Perl (default) # 1 = C / C++ # 2 = Pascal / Delphi # $lang = $ARGV[1]; $argc = $#ARGV + 1; if ($argc == 3) { $array_name = $ARGV[2]; } else { $array_name = bin_data; } $rem_begin = begin binary data:; $rem_end= end binary data.; # initialize for Perl strings # by default $_var = # $rem_begin\n. \$bin_data = # %d\n; $_begin = \; $_end = \;\n; $_break = \.\n\; $_format= \\x%02X; $_separator = ; $_comment = # $rem_end ; $_size = # size = %d - size of binary data in bytes; # C / C++ if(1 == $lang) { $_var = /* $rem_begin */\n. char . $array_name . [] = . /* %d */\n; $_begin = {; $_end = };\n; $_break = \n; $_format= 0x%02X; $_separator = ,; $_comment = /* $rem_end */; $_size = unsigned int . $array_name . _size = %d; /* size of binary data in bytes */; } elsif(2 == $lang) { $_var = { $rem_begin }\n. const bin_data : . array [1..%d] of . byte = \n; $_begin = (; $_end = );\n; $_break = \n; $_format= \$%02X; $_separator = ,; $_comment = { $rem_end }; $_size = {size = %d bytes }; } if(open(F, .$ARGV[0])) { binmode(F); $s = ''; $i = 0; $count = 0; $first = 1; $s .= $_begin; while(!eof(F)) { if($i = $chars_per_line) { $s .= $_break; $i = 0; } if(!$first) { $s .= $_separator; } $s .= sprintf( $_format, ord(getc(F))); ++$i; ++$count; $first = 0; } $s .= $_end; $s .= sprintf $_comment; $s .= \n\n; $s .= sprintf $_size, $count; $s .= \n\n; $s = \n.sprintf($_var, $count).$s; print $s; close( F ); } else { print bin2hex.pl by Chami.com\n. \n. usage:\n. perl bin2hex.pl binary file. language id [array_name]\n. \n. binary file : path to the . binary file\n. language id : 0 = Perl, . 1 = C/C++/Java, . 2 = Pascal/Delphi\n. array_name : name of the array or 'bin_data' as fallback . \n; } So you're also able to include the .glade file into your
Re: Glib::Dispatcher and data transfer into main loop
Am Sat, 19 Apr 2008 20:53:23 +0200 schrieb Ludwig Hähne: Hi Andreas, Andreas Volz wrote on 19.04.2008 17:37: Any ideas how to solve that problem? I've seen no way to give data to the dispatchSignal() call. So I need a member variable to transfer data from the thread called function to the dispatched function. I could think of a queue that saves all the incoming data from the thread for later use in the dispatched function. Do you think that's the best way to do it? Any other ideas? A queue protected with a (exception-safe) Mutex and a dispatcher is what I did in these cases: | Glib::Dispatcher dispatcher; | Glib::Mutex logMutex; | std::queue... pipe; Producer thread: | Glib::Mutex::Lock lock(logMutex); | pipe.push(ent); | lock.release(); | dispatcher.emit(); Consumer (main) thread: | Glib::Mutex::Lock lock(logMutex); | assert(pipe.empty() == false); | Entity ent = pipe.front(); | pipe.pop(); | return ent; That's like what I thought of. It works for me. Thanks. regards Andreas ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Glib::Dispatcher and data transfer into main loop
Am Sat, 19 Apr 2008 20:33:43 +0200 schrieb klaus triendl: Andreas Volz schrieb: Hello, I'm using a Glib::Dispatcher to dispatch data from a thread into my main loop. This is my code: [snip] Any ideas how to solve that problem? I've seen no way to give data to the dispatchSignal() call. So I need a member variable to transfer data from the thread called function to the dispatched function. I could think of a queue that saves all the incoming data from the thread for later use in the dispatched function. Do you think that's the best way to do it? Any other ideas? Did you see my post a few days ago about interthread communication with sigx? The library would solve exactly your problem (and it does indeed put the incoming data into a message queue). cMan could create a signal to which other threads can connect. The signal can have any number of parameters (up to sigc's arity). Very interesting! The sigx library seems to be very young. Is it yet tested on win32? regards Andreas ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list