Reading system gui.prefs

7 posts / 0 new
Last post
trixie
trixie's picture
Offline
Last seen: 5 months 12 hours ago
Joined: 2011-02-03 13:58
Reading system gui.prefs

Could anyone possibly share a piece of code for reading the system gui.prefs? I specifically need to obtain the "System requester opening position" and "Evenly sized system requester buttons" settings from the Options tab in GUI preferences. Any help greatly appreciated!

salass00
salass00's picture
Offline
Last seen: 1 year 1 month ago
Joined: 2011-02-03 11:27
Re: Reading system gui.prefs

Don't try to interpret the gui.prefs file directly.

If you have to know the settings for some reason you should use GetGUIAttrs() instead.

The tags GUIA_EvenRequesterButtons and GUIA_RequestersPosition should get you the information you want.

trixie
trixie's picture
Offline
Last seen: 5 months 12 hours ago
Joined: 2011-02-03 13:58
Re: Reading system gui.prefs

@salass00

Oh great, I didn't know there was a function; you never stop learning. Thanks very much!

If you have to know the settings for some reason

I do, I'm developing a BOOPSI class that had better respect these particular system-wide GUI settings.

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

trixie
trixie's picture
Offline
Last seen: 5 months 12 hours ago
Joined: 2011-02-03 13:58
Re: Reading system gui.prefs

@salass00

There, however, seems to be a problem.

The GetGuiAttrs() autodoc specifically says that you can use a NULL DrawInfo parameter in this function to obtain "the global GUI preferences of Intuition". But when I do

  1. uint32 reqPosition, evenButtons;
  2.  
  3. IIntuition->GetGUIAttrs(NULL, NULL,
  4. GUIA_RequestersPosition, &reqPosition,
  5. GUIA_EvenRequesterButtons, &evenButtons,
  6. TAG_DONE);

both values are always 0, regardless of what I have set in the system GUI prefs editor. I need to LockPubScreen() the default public screen, then GetScreenDrawInfo() from it, and pass it to GetGUIAttrs() to obtain proper values. A workaround, but far from what the autodoc says.

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

salass00
salass00's picture
Offline
Last seen: 1 year 1 month ago
Joined: 2011-02-03 11:27
Re: Reading system gui.prefs

GUI settings can be set on a per-screen basis by the user so you should always supply a DrawInfo if possible.

I would also suggest obtaining the values only as and when they are needed, like in your equivalent of RM_OPENREQ if you're doing a requester class.

xenic
xenic's picture
Offline
Last seen: 1 year 11 months ago
Joined: 2011-05-07 04:52
Re: Reading system gui.prefs

Maybe the global GUI prefs or the default pubscreen prefs are not the best ones to use anyway. There are utilities that let the user change the default public screen. There are also Workbench replacement systems (like Dopus5) that might not be honoring the global GUI prefs. As salass00 points out, GUI prefs can be set on a per-screen basis. You might want to consider getting and using the DrawInfo for the screen that your class will be used on. That way the GUI settings for your class will be constistant with system requesters opening on that screen. You may need to experiment with various screens (default pubscreen, Workbench screen, current screen) to determine which is best.

As usual, something that seems simple at first can get complicated :-)

X1000 - OS 4.1FE

trixie
trixie's picture
Offline
Last seen: 5 months 12 hours ago
Joined: 2011-02-03 13:58
Re: Reading system gui.prefs

@salass00

I would also suggest obtaining the values only as and when they are needed, like in your equivalent of RM_OPENREQ if you're doing a requester class.

Done!

@xenic

You might want to consider getting and using the DrawInfo for the screen that your class will be used on.

Done! Thank you both for your suggestions.

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

Log in or register to post comments