After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 593167 - Support Windows in gimp_get_default_unit()
Support Windows in gimp_get_default_unit()
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Tools
2.8.0
Other Windows
: Normal minor
: 2.8
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2009-08-26 13:55 UTC by strata_ranger
Modified: 2013-03-30 14:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Bugfix of the bug 593167 (1.55 KB, patch)
2013-03-18 10:08 UTC, Petr Kubizňák
none Details | Review

Description strata_ranger 2009-08-26 13:55:29 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.
Comment 1 Val P. 2010-05-14 20:11:44 UTC
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.
Comment 2 strata_ranger 2012-04-16 14:57:14 UTC
Still occuring as of 2.8.0-RC1 .
Comment 3 Max Mustermann 2012-09-03 19:09:22 UTC
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.
Comment 4 Petr Kubizňák 2013-02-19 09:27:27 UTC
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?
Comment 5 Michael Natterer 2013-02-21 22:36:42 UTC
If defaults to the default measurement for the language, what language
have you set?
Comment 6 Michael Natterer 2013-02-21 22:38:51 UTC
Well, actually, it only does that if _NL_MEASUREMENT_MEASUREMENT
is available, please check if that is the case on the windows
builds.
Comment 7 Petr Kubizňák 2013-02-22 11:17:07 UTC
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.
Comment 8 Michael Natterer 2013-02-22 12:23:39 UTC
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.
Comment 9 Petr Kubizňák 2013-02-25 09:49:22 UTC
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.
Comment 10 Michael Natterer 2013-02-25 15:32:09 UTC
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.
Comment 11 Petr Kubizňák 2013-03-17 21:31:47 UTC
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).
Comment 12 Michael Natterer 2013-03-18 00:49:23 UTC
Thanks a lot, can you simply attach the patch here please? Multiple git
remotes kill my brain.
Comment 13 Petr Kubizňák 2013-03-18 10:08:52 UTC
Created attachment 239110 [details] [review]
Bugfix of the bug 593167

Sure, here's the patch.
Comment 14 Michael Natterer 2013-03-18 12:11:41 UTC
Thanks :) That looks right even tho I have no clue about the windows API.

Will take care of having this tested and pushed.
Comment 15 Mike Henning (drawoc) 2013-03-30 14:23:28 UTC
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).