Re: New to gnome-print, but stumbled on something I find odd
Aaron Ballman <[email protected]>
| Newsgroups | gmane.comp.gnome.print |
|---|---|
| Message-ID | <a06010204bbfbd1ac466c@[10.10.10.116]> |
>To explain what is happening: the value with key >GNOME_PRINT_KEY_PAPER_WIDTH may in fact contain a string such as 8in or >8cm. When you are asking for a double you get 8 independent from the >unit. When the user changes the preferred unit that does not change the >values stored since if the user changes back you want the exact value >the user entered not just some approximation. Thanks for the explanation, this makes perfect sense to me. :-) I am still running into a stumbling block though. So I made a GnomePrintUnit using new and I call gnome_print_config_get_length on what I'm interested in, but I guess I am stuck trying to figure out a decent way to convert this unit into Points. It looks like (from reading the header file, since that's the only documentation I've really found on the topic) there should be a way to convert from one unit type to another. I can do the conversion myself by hand, but why reinvent the wheel? ;-) Here is the code I am using currently (val is a const guchar * and mCurrentConfig is a valid GnomePrintConfig object): gdouble first = 0.0; GnomePrintUnit *unit = new GnomePrintUnit; // Get the double value that we want along with the units it is expressed in gnome_print_config_get_length( mCurrentConfig, val, &first, &unit ); Here's where I get stuck. Do I need to look at unit->abbr and compare it to "mm", "in", etc and then do the conversion by hand. Or is there some trick I can do by using unit->unittobase to convert automatically from one type to another? Ideally, I just want all my return values in pixels (so it'd be resolution-dependant), but I can live with them all being in Points as well. Any suggestions would be very appreciated. Also, if you know of a decent place for documentation that google hasn't yielded me yet, that would help me out immensely. Thanks! ~Aaron -- Handy UNIX Commands: sudo grep -e "My mind" -H -r / mv /mnt/fuji /mnt/everest mv "Ignorance" /dev/null