Debian Codegraph @

sys/machine.cpp

raw symbols SCIP
1 /* machine.cpp
2 *
3 * Copyright (C) 1992-2005,2011-2013,2015,2016,2019-2021 Paul Boersma
4 *
5 * This code is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
9 *
10 * This code is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this work. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include "machine.h"
20 #include "melder.h"
21
22 #define LookAndFeel_MOTIF 0
23 #define LookAndFeel_SGI 1
24 #define LookAndFeel_CDE 2
25 #define LookAndFeel_SOLARIS 3
26 #define LookAndFeel_HP 4
27 #define LookAndFeel_SUN4 5
28 #define LookAndFeel_MAC 6
29 #define LookAndFeel_WIN32 7
30 #define LookAndFeel_LINUX 8
31 #define LookAndFeel_COCOA 9
32 #define LookAndFeel_CHROME 10
33
34 static int lookAndFeel;
35
36 int Machine_getMenuBarTop () {
37 static int tops [] = {
38 0, // Motif
39 0, // SGI
40 0, // CDE
41 0, // Solaris
42 0, // HP
43 0, // Sun4
44 0, // Mac
45 0, // Win32
46 0, // Linux
47 0, // Cocoa
48 30, // Chrome
49 };
50 return tops [lookAndFeel];
51 }
52
53 int Machine_getMenuBarBottom () {
54 static int bottoms [] = {
55 26, // Motif
56 24, // SGI
57 28, // CDE
58 26, // Solaris
59 26, // HP
60 26, // Sun4
61 36, // Mac
62 0, // Win32
63 30, // Linux
64 36, // Cocoa
65 60, // Chrome
66 };
67 return bottoms [lookAndFeel];
68 }
69
70 int Machine_getTitleBarHeight () {
71 static int heights [] = { /* Mostly copied from menu-bar height. */
72 26, // Motif
73 24, // SGI
74 28, // CDE
75 26, // Solaris
76 26, // HP
77 26, // Sun4
78 22, // Mac
79 20, // Win32
80 30, // Linux
81 22, // Cocoa
82 30, // Chrome
83 };
84 return heights [lookAndFeel];
85 }
86
87 int Machine_getScrollBarWidth () {
88 static int widths [] = {
89 22, // Motif
90 22, // SGI
91 22, // CDE
92 22, // Solaris
93 22, // HP
94 22, // Sun4
95 16, // Mac
96 17, // Win32
97 18, // Linux
98 16, // Cocoa
99 24, // Chrome
100 };
101 return widths [lookAndFeel];
102 }
103
104 int Machine_getTextHeight () {
105 static int heights [] = {
106 29, // Motif
107 29, // SGI
108 25, // CDE
109 29, // Solaris
110 29, // HP
111 29, // Sun4
112 22, // Mac
113 20, // Win32
114 25, // Linux
115 23, // Cocoa
116 31, // Chrome
117 };
118 return heights [lookAndFeel];
119 }
120
121 int Machine_getButtonHeight () {
122 static int heights [] = {
123 20, // Motif
124 20, // SGI
125 20, // CDE
126 20, // Solaris
127 20, // HP
128 20, // Sun4
129 20, // Mac
130 20, // Win32
131 30, // Linux
132 20, // Cocoa
133 40, // Chrome
134 };
135 return heights [lookAndFeel];
136 }
137
138 void Machine_initLookAndFeel (int argc, char **argv) {
139 /*
140 Determining the appropriate look-and-feel: the default depends on the client machine.
141 */
142 #if defined (macintosh)
143 lookAndFeel = LookAndFeel_COCOA;
144 return;
145 #elif defined (_WIN32)
146 lookAndFeel = LookAndFeel_WIN32;
147 return;
148 #elif defined (linux)
149 #if defined (chrome)
150 lookAndFeel = LookAndFeel_CHROME;
151 #else
152 lookAndFeel = LookAndFeel_LINUX;
153 #endif
154 #endif
155
156 /*
157 Command line may override the look-and-feel.
158 */
159 if (argc > 1) {
160 if (strequ (argv [1], "-sgi")) lookAndFeel = LookAndFeel_SGI;
161 else if (strequ (argv [1], "-motif")) lookAndFeel = LookAndFeel_MOTIF;
162 else if (strequ (argv [1], "-cde")) lookAndFeel = LookAndFeel_CDE;
163 else if (strequ (argv [1], "-solaris")) lookAndFeel = LookAndFeel_SOLARIS;
164 else if (strequ (argv [1], "-hp")) lookAndFeel = LookAndFeel_HP;
165 else if (strequ (argv [1], "-sun4")) lookAndFeel = LookAndFeel_SUN4;
166 else if (strequ (argv [1], "-mac")) lookAndFeel = LookAndFeel_MAC;
167 else if (strequ (argv [1], "-win32")) lookAndFeel = LookAndFeel_WIN32;
168 else if (strequ (argv [1], "-linux")) lookAndFeel = LookAndFeel_LINUX;
169 else if (strequ (argv [1], "-cocoa")) lookAndFeel = LookAndFeel_COCOA;
170 else if (strequ (argv [1], "-chrome")) lookAndFeel = LookAndFeel_CHROME;
171 }
172 }
173
174 /* End of file machine.cpp */