GNOME Bugzilla – Bug 593167
Support Windows in gimp_get_default_unit()
Last modified: 2013-03-30 14:32:00 UTC
When you select the "Print Size" command from the Image Menu, the units of measure for the "Width/Height" boxes always default to millimeters, not inches, and I am not finding any user preferences controlling this. It also resets to "millimeters" every time the command is accessed regardless of whatever it was left at the previous time you used the command. This is confusing for two reasons: 1 - Different behavior than GIMP 2.4 (default measure used to be "inches"). 2 - The default measure for the "Resolution" controls is still dots-per-Inch. I also notice that under "Edit > Units..." the Inches entry shows a Factor of 1.00, implying that it should still be the default unit of measure. Steps to reproduce: 1 - Select "Image > Print Size..." from any convenient image. Select "Inches" as a unit of measure. 2 - Hit OK, then repeat. Image size is still displayed in millimeters. Related: - Same or similar bug affects the "Image Settings" tab of the 2.6 win32 Print plug-in. Suggested: - Add a user preference to set their preferred unit-of-measure with.
This is also proliferated into the Image Properties dialog and the print size there is also in milimeters even when all other settings are in inches. I have found no way to change that display.
Still occuring as of 2.8.0-RC1 .
Reproduction with GIMP 2.8.2 on Win7, 32 bit: Confirming the behaviour for Image/Print size.... File/Print.../Image Settings: works well here. After confirming the Print... dialog with OK, the new measure unit is still selected the next time.
Confirming the behaviour under Linux (Fedora 17, GIMP 2.8.2). I might be interested in fixing this bug as a part of my semester project. My task is to pick an easy bug in any open source project (and since I use GIMP often, I'd like to pick GIMP), fix it and get confirmation about it from the developers. I have quite rich programming experience in C, I know git a bit, I just don't have experience with open-source programming. Can you please advice whether this is an easy bug to be fixed by an "open-source" beginner?
If defaults to the default measurement for the language, what language have you set?
Well, actually, it only does that if _NL_MEASUREMENT_MEASUREMENT is available, please check if that is the case on the windows builds.
I don't think it is connected with user's language. I tried it on several configurations: Tested configurations: * WIN_XP (system language: Czech): - GIMP 2.8.2, system language - GIMP 2.8.2, Czech - GIMP 2.8.2, English (en_us) - GIMP 2.8.2, English (en_gb) * Fedora 17 (system language: EN_US): - GIMP 2.8.2, system language - GIMP 2.8.4, system language The result is always the same - it defaults to mm and resets each time the Print size settings window is opened.
That's because the function that figures the unit has no support for windows and always returns mm. It's gimp_get_default_unit(), and needs to be ported.
So I see two things to be done: 1. Port gimp_get_default_unit() for Win, 2. keep the user's settings DURING the session. Is this all right? I guess keeping the settings ACROSS sessions is not a wanted feature..? I might try to do both 1. and 2.
1. would be good enough to fix this bug because we have a more general bug open to remember dialog settings in one session, I just don't find it currently.
I've finished the bugfix and pushed it to git@github.com:ymanCZ/gimp.git, branch port-default-unit. Can you please git-fetch? Testing performed: Successfully compiled by gcc, i686-w64-mingw32-gcc and x86_64-w64-mingw32-gcc. Tested successfully under Fedora 17 (no change) and Wine (under Fedora 17; works correctly). Due to problems with running The GIMP under Windows itself (probably something wrong with the libraries), the functionality was successfully tested at least as a standalone mini-application under Windows XP 32bit (32bit app) and Windows 7 64bit (both 32bit and 64bit app).
Thanks a lot, can you simply attach the patch here please? Multiple git remotes kill my brain.
Created attachment 239110 [details] [review] Bugfix of the bug 593167 Sure, here's the patch.
Thanks :) That looks right even tho I have no clue about the windows API. Will take care of having this tested and pushed.
Tested, confirmed, pushed. commit 194ef70d7446a627c274135c54498d3092c9b356 Author: Petr Kubiznak <kubiznak.petr@gmail.com> Date: Sun Mar 17 21:33:17 2013 +0100 Bug 593167 - Support Windows in gimp_get_default_unit() Function gimp_get_default_unit ported for Windows using standard GetLocaleInfo() function (from windows.h).