5 #include <X11/Xlocale.h>
7 _WINGsConfiguration WINGsConfiguration
;
9 #define SYSTEM_FONT "Trebuchet MS,sans serif"
10 #define BOLD_SYSTEM_FONT "Trebuchet MS,sans serif:bold"
11 #define DEFAULT_FONT_SIZE 12
13 #define FLOPPY_PATH "/floppy"
15 static unsigned getButtonWithName(const char *name
, unsigned defaultButton
)
17 if (strncmp(name
, "Button", 6) == 0 && strlen(name
) == 7) {
37 void W_ReadConfigurations(void)
39 WMUserDefaults
*defaults
;
42 memset(&WINGsConfiguration
, 0, sizeof(_WINGsConfiguration
));
44 defaults
= WMGetStandardUserDefaults();
51 WINGsConfiguration
.systemFont
= WMGetUDStringForKey(defaults
, "SystemFont");
53 WINGsConfiguration
.boldSystemFont
= WMGetUDStringForKey(defaults
, "BoldSystemFont");
55 val
= WMGetUDObjectForKey(defaults
, "AntialiasedText");
56 if (val
&& WMIsPLString(val
) && WMGetFromPLString(val
)) {
58 WINGsConfiguration
.antialiasedText
=
59 WMGetUDBoolForKey(defaults
, "AntialiasedText");
62 WINGsConfiguration
.doubleClickDelay
= WMGetUDIntegerForKey(defaults
, "DoubleClickTime");
64 WINGsConfiguration
.floppyPath
= WMGetUDStringForKey(defaults
, "FloppyPath");
66 buttonName
= WMGetUDStringForKey(defaults
, "MouseWheelUp");
68 button
= getButtonWithName(buttonName
, Button4
);
73 WINGsConfiguration
.mouseWheelUp
= button
;
75 buttonName
= WMGetUDStringForKey(defaults
, "MouseWheelDown");
77 button
= getButtonWithName(buttonName
, Button5
);
82 WINGsConfiguration
.mouseWheelDown
= button
;
84 if (WINGsConfiguration
.mouseWheelDown
== WINGsConfiguration
.mouseWheelUp
) {
85 WINGsConfiguration
.mouseWheelUp
= Button4
;
86 WINGsConfiguration
.mouseWheelDown
= Button5
;
89 WINGsConfiguration
.defaultFontSize
= WMGetUDIntegerForKey(defaults
, "DefaultFontSize");
92 if (!WINGsConfiguration
.systemFont
) {
93 WINGsConfiguration
.systemFont
= SYSTEM_FONT
;
95 if (!WINGsConfiguration
.boldSystemFont
) {
96 WINGsConfiguration
.boldSystemFont
= BOLD_SYSTEM_FONT
;
98 if (WINGsConfiguration
.defaultFontSize
== 0) {
99 WINGsConfiguration
.defaultFontSize
= DEFAULT_FONT_SIZE
;
102 WINGsConfiguration
.antialiasedText
= True
;
104 if (!WINGsConfiguration
.floppyPath
) {
105 WINGsConfiguration
.floppyPath
= FLOPPY_PATH
;
107 if (WINGsConfiguration
.doubleClickDelay
== 0) {
108 WINGsConfiguration
.doubleClickDelay
= 250;
110 if (WINGsConfiguration
.mouseWheelUp
== 0) {
111 WINGsConfiguration
.mouseWheelUp
= Button4
;
113 if (WINGsConfiguration
.mouseWheelDown
== 0) {
114 WINGsConfiguration
.mouseWheelDown
= Button5
;
119 unsigned W_getconf_mouseWheelUp(void)
121 return WINGsConfiguration
.mouseWheelUp
;
124 unsigned W_getconf_mouseWheelDown(void)
126 return WINGsConfiguration
.mouseWheelDown
;
129 void W_setconf_doubleClickDelay(int value
)
131 WINGsConfiguration
.doubleClickDelay
= value
;