Added more batch functionality, including the CALL GOTO and SHIFT
[wine] / windows / sysmetrics.c
1 /*
2  * System metrics functions
3  *
4  * Copyright 1994 Alexandre Julliard
5  *
6  */
7
8 #include <stdio.h>
9
10 #include "wine/winuser16.h"
11 #include "winbase.h"
12 #include "winuser.h"
13 #include "monitor.h"
14 #include "options.h"
15 #include "tweak.h"
16
17 static short sysMetrics[SM_CMETRICS+1];
18
19 /***********************************************************************
20  *           SYSMETRICS_Init
21  *
22  * Initialisation of the system metrics array.
23  *
24  * Differences in return values between 3.1 and 95 apps under Win95 (FIXME ?):
25  * SM_CXVSCROLL        x+1      x       Fixed May 24, 1999 - Ronald B. Cemer
26  * SM_CYHSCROLL        x+1      x       Fixed May 24, 1999 - Ronald B. Cemer
27  * SM_CXDLGFRAME       x-1      x       Already fixed
28  * SM_CYDLGFRAME       x-1      x       Already fixed
29  * SM_CYCAPTION        x+1      x       Fixed May 24, 1999 - Ronald B. Cemer
30  * SM_CYMENU           x-1      x       Already fixed
31  * SM_CYFULLSCREEN     x-1      x
32  * 
33  * (collides with TWEAK_WineLook sometimes,
34  * so changing anything might be difficult) 
35  */
36 void SYSMETRICS_Init(void)
37 {
38     sysMetrics[SM_CXCURSOR] = 32;
39     sysMetrics[SM_CYCURSOR] = 32;
40     sysMetrics[SM_CXSCREEN] = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
41     sysMetrics[SM_CYSCREEN] =  MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
42     if (TWEAK_WineLook > WIN31_LOOK)
43         sysMetrics[SM_CXVSCROLL] =
44             PROFILE_GetWineIniInt("Tweak.Layout", "ScrollBarWidth", 16);
45     else
46         sysMetrics[SM_CXVSCROLL] =
47             PROFILE_GetWineIniInt("Tweak.Layout", "ScrollBarWidth", 17);
48     sysMetrics[SM_CYHSCROLL] = sysMetrics[SM_CXVSCROLL];
49     if (TWEAK_WineLook > WIN31_LOOK)
50         sysMetrics[SM_CYCAPTION] =
51             PROFILE_GetWineIniInt("Tweak.Layout", "CaptionHeight", 19);
52     else
53         sysMetrics[SM_CYCAPTION] =
54             PROFILE_GetWineIniInt("Tweak.Layout", "CaptionHeight", 20);
55     sysMetrics[SM_CXBORDER] = 1;
56     sysMetrics[SM_CYBORDER] = sysMetrics[SM_CXBORDER];
57     sysMetrics[SM_CXDLGFRAME] =
58         PROFILE_GetWineIniInt("Tweak.Layout", "DialogFrameWidth",
59                               (TWEAK_WineLook > WIN31_LOOK) ? 3 : 4);
60     sysMetrics[SM_CYDLGFRAME] = sysMetrics[SM_CXDLGFRAME];
61     sysMetrics[SM_CYVTHUMB] = sysMetrics[SM_CXVSCROLL] - 1;
62     sysMetrics[SM_CXHTHUMB] = sysMetrics[SM_CYVTHUMB];
63     sysMetrics[SM_CXICON] = 32;
64     sysMetrics[SM_CYICON] = 32;
65     if (TWEAK_WineLook > WIN31_LOOK)
66         sysMetrics[SM_CYMENU] =
67             PROFILE_GetWineIniInt("Tweak.Layout", "MenuHeight", 19);
68     else
69         sysMetrics[SM_CYMENU] =
70             PROFILE_GetWineIniInt("Tweak.Layout", "MenuHeight", 18);
71     sysMetrics[SM_CXFULLSCREEN] = sysMetrics[SM_CXSCREEN];
72     sysMetrics[SM_CYFULLSCREEN] =
73         sysMetrics[SM_CYSCREEN] - sysMetrics[SM_CYCAPTION];
74     sysMetrics[SM_CYKANJIWINDOW] = 0;
75     sysMetrics[SM_MOUSEPRESENT] = 1;
76     sysMetrics[SM_CYVSCROLL] = sysMetrics[SM_CYVTHUMB];
77     sysMetrics[SM_CXHSCROLL] = sysMetrics[SM_CXHTHUMB];
78     sysMetrics[SM_DEBUG] = 0;
79
80     /* FIXME: The following should look for the registry key to see if the
81        buttons should be swapped. */
82     sysMetrics[SM_SWAPBUTTON] = 0;
83
84     sysMetrics[SM_RESERVED1] = 0;
85     sysMetrics[SM_RESERVED2] = 0;
86     sysMetrics[SM_RESERVED3] = 0;
87     sysMetrics[SM_RESERVED4] = 0;
88
89     /* FIXME: The following two are calculated, but how? */
90     sysMetrics[SM_CXMIN] = (TWEAK_WineLook > WIN31_LOOK) ? 112 : 100;
91     sysMetrics[SM_CYMIN] = (TWEAK_WineLook > WIN31_LOOK) ? 27 : 28;
92
93     sysMetrics[SM_CXSIZE] = sysMetrics[SM_CYCAPTION] - 2;
94     sysMetrics[SM_CYSIZE] = sysMetrics[SM_CXSIZE];
95     sysMetrics[SM_CXFRAME] = GetProfileIntA("Windows", "BorderWidth", 4);
96     sysMetrics[SM_CYFRAME] = sysMetrics[SM_CXFRAME];
97     sysMetrics[SM_CXMINTRACK] = sysMetrics[SM_CXMIN];
98     sysMetrics[SM_CYMINTRACK] = sysMetrics[SM_CYMIN];
99     sysMetrics[SM_CXDOUBLECLK] =
100         (GetProfileIntA("Windows", "DoubleClickWidth", 4) + 1) & ~1;
101     sysMetrics[SM_CYDOUBLECLK] =
102         (GetProfileIntA("Windows","DoubleClickHeight", 4) + 1) & ~1;
103     sysMetrics[SM_CXICONSPACING] =
104         GetProfileIntA("Desktop","IconSpacing", 75);
105     sysMetrics[SM_CYICONSPACING] =
106         GetProfileIntA("Desktop", "IconVerticalSpacing", 75);
107     sysMetrics[SM_MENUDROPALIGNMENT] =
108         GetProfileIntA("Windows", "MenuDropAlignment", 0);
109     sysMetrics[SM_PENWINDOWS] = 0;
110     sysMetrics[SM_DBCSENABLED] = 0;
111
112     /* FIXME: Need to query X for the following */
113     sysMetrics[SM_CMOUSEBUTTONS] = 3;
114
115     sysMetrics[SM_SECURE] = 0;
116     sysMetrics[SM_CXEDGE] = sysMetrics[SM_CXBORDER] + 1;
117     sysMetrics[SM_CYEDGE] = sysMetrics[SM_CXEDGE];
118     sysMetrics[SM_CXMINSPACING] = 160;
119     sysMetrics[SM_CYMINSPACING] = 24;
120     sysMetrics[SM_CXSMICON] =
121         sysMetrics[SM_CYSIZE] - (sysMetrics[SM_CYSIZE] % 2) - 2;
122     sysMetrics[SM_CYSMICON] = sysMetrics[SM_CXSMICON];
123     sysMetrics[SM_CYSMCAPTION] = 16;
124     sysMetrics[SM_CXSMSIZE] = 15;
125     sysMetrics[SM_CYSMSIZE] = sysMetrics[SM_CXSMSIZE];
126     sysMetrics[SM_CXMENUSIZE] = sysMetrics[SM_CYMENU];
127     sysMetrics[SM_CYMENUSIZE] = sysMetrics[SM_CXMENUSIZE];
128
129     /* FIXME: What do these mean? */
130     sysMetrics[SM_ARRANGE] = 8;
131     sysMetrics[SM_CXMINIMIZED] = 160;
132     sysMetrics[SM_CYMINIMIZED] = 24;
133
134     /* FIXME: How do I calculate these? */
135     sysMetrics[SM_CXMAXTRACK] = 
136         sysMetrics[SM_CXSCREEN] + 4 + 2 * sysMetrics[SM_CXFRAME];
137     sysMetrics[SM_CYMAXTRACK] =
138         sysMetrics[SM_CYSCREEN] + 4 + 2 * sysMetrics[SM_CYFRAME];
139     sysMetrics[SM_CXMAXIMIZED] =
140         sysMetrics[SM_CXSCREEN] + 2 * sysMetrics[SM_CXFRAME];
141     sysMetrics[SM_CYMAXIMIZED] =
142         sysMetrics[SM_CYSCREEN] - 45;
143     sysMetrics[SM_NETWORK] = 3;
144
145     /* For the following: 0 = ok, 1 = failsafe, 2 = failsafe + network */
146     sysMetrics[SM_CLEANBOOT] = 0;
147
148     sysMetrics[SM_CXDRAG] = 2;
149     sysMetrics[SM_CYDRAG] = 2;
150     sysMetrics[SM_SHOWSOUNDS] = 0;
151     sysMetrics[SM_CXMENUCHECK] = 2;
152     sysMetrics[SM_CYMENUCHECK] = 2;
153
154     /* FIXME: Should check the type of processor for the following */
155     sysMetrics[SM_SLOWMACHINE] = 0;
156
157     /* FIXME: Should perform a check */
158     sysMetrics[SM_MIDEASTENABLED] = 0;
159
160     sysMetrics[SM_MOUSEWHEELPRESENT] = 0;
161     
162     sysMetrics[SM_CXVIRTUALSCREEN] = sysMetrics[SM_CXSCREEN];
163     sysMetrics[SM_CYVIRTUALSCREEN] = sysMetrics[SM_CYSCREEN];
164     sysMetrics[SM_XVIRTUALSCREEN] = 0;
165     sysMetrics[SM_YVIRTUALSCREEN] = 0;
166     sysMetrics[SM_CMONITORS] = 1;
167     sysMetrics[SM_SAMEDISPLAYFORMAT] = 1;
168     sysMetrics[SM_CMETRICS] = SM_CMETRICS;
169 }
170
171
172 /***********************************************************************
173  *           GetSystemMetrics16    (USER.179)
174  */
175 INT16 WINAPI GetSystemMetrics16( INT16 index )
176 {
177     return (INT16)GetSystemMetrics(index);
178 }
179
180
181 /***********************************************************************
182  *           GetSystemMetrics32    (USER32.292)
183  */
184 INT WINAPI GetSystemMetrics( INT index )
185 {
186     if ((index < 0) || (index > SM_CMETRICS)) return 0;
187     else return sysMetrics[index];    
188 }