1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
|
/* machine.cpp
*
* Copyright (C) 1992-2011 Paul Boersma
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* pb 2002/03/07 GPL
* pb 2004/06/17 Machine_getMainWindowMenuBarHeight ()
* pb 2011/05/15 C++
*/
#include "machine.h"
#include "melder.h"
#define LookAndFeel_MOTIF 0
#define LookAndFeel_SGI 1
#define LookAndFeel_CDE 2
#define LookAndFeel_SOLARIS 3
#define LookAndFeel_HP 4
#define LookAndFeel_SUN4 5
#define LookAndFeel_MAC 6
#define LookAndFeel_WIN32 7
#define LookAndFeel_LINUX 8
static int lookAndFeel;
int Machine_getMenuBarHeight (void) {
static int heights [] = {
26, /* Motif */
24, /* SGI */
28, /* CDE */
26, /* Solaris */
26, /* HP */
26, /* Sun4 */
36, /* Mac */
0, /* Win32 */
30 /* Linux */
};
return heights [lookAndFeel];
}
int Machine_getMainWindowMenuBarHeight (void) {
#ifdef macintoshXXX
return 0;
#else
return Machine_getMenuBarHeight ();
#endif
}
int Machine_getTitleBarHeight (void) {
static int heights [] = { /* Mostly copied from menu-bar height. */
26, /* Motif */
24, /* SGI */
28, /* CDE */
26, /* Solaris */
26, /* HP */
26, /* Sun4 */
22, /* Mac */
20, /* Win32 */
30 /* Linux */
};
return heights [lookAndFeel];
}
int Machine_getScrollBarWidth (void) {
static int widths [] = {
22, /* Motif */
22, /* SGI */
22, /* CDE */
22, /* Solaris */
22, /* HP */
22, /* Sun4 */
16, /* Mac */
17, /* Win32 */
18 /* Linux */
};
return widths [lookAndFeel];
}
int Machine_getTextHeight (void) {
static int heights [] = {
29, /* Motif */
29, /* SGI */
25, /* CDE */
29, /* Solaris */
29, /* HP */
29, /* Sun4 */
22, /* Mac */
20, /* Win32 */
29 /* Linux */
};
return heights [lookAndFeel];
}
void Machine_initLookAndFeel (unsigned int argc, char **argv) {
/*
* Determining the appropriate look-and-feel: the default depends on the client machine.
*/
#if defined (macintosh)
lookAndFeel = LookAndFeel_MAC;
return;
#elif defined (_WIN32)
lookAndFeel = LookAndFeel_WIN32;
return;
#elif defined (linux)
lookAndFeel = LookAndFeel_LINUX;
#endif
/*
* Command line may override the look-and-feel.
*/
if (argc > 1) {
if (strequ (argv [1], "-sgi")) lookAndFeel = LookAndFeel_SGI;
else if (strequ (argv [1], "-motif")) lookAndFeel = LookAndFeel_MOTIF;
else if (strequ (argv [1], "-cde")) lookAndFeel = LookAndFeel_CDE;
else if (strequ (argv [1], "-solaris")) lookAndFeel = LookAndFeel_SOLARIS;
else if (strequ (argv [1], "-hp")) lookAndFeel = LookAndFeel_HP;
else if (strequ (argv [1], "-sun4")) lookAndFeel = LookAndFeel_SUN4;
else if (strequ (argv [1], "-mac")) lookAndFeel = LookAndFeel_MAC;
else if (strequ (argv [1], "-linux")) lookAndFeel = LookAndFeel_LINUX;
}
}
/* End of file machine.cpp */
|