GRASS Programmer's Manual
6.4.3(2013)-r
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Macros
Pages
driver/init.c
Go to the documentation of this file.
1
2
/****************************************************************************
3
*
4
* MODULE: driver
5
* AUTHOR(S): Glynn Clements <glynn gclements.plus.com> (original contributor)
6
* Huidae Cho <grass4u gmail.com>
7
* PURPOSE:
8
* COPYRIGHT: (C) 2006-2006 by the GRASS Development Team
9
*
10
* This program is free software under the GNU General Public
11
* License (>=v2). Read the file COPYING that comes with GRASS
12
* for details.
13
*
14
*****************************************************************************/
15
#include <grass/config.h>
16
17
#include <stdio.h>
18
#include <stdlib.h>
19
20
#include <grass/gis.h>
21
#include <grass/freetypecap.h>
22
#include "
driverlib.h
"
23
#include "
driver.h
"
24
#include "
pad.h
"
25
26
const
struct
driver
*
driver
;
27
28
struct
GFONT_CAP *
ftcap
;
29
30
int
NCOLORS
;
31
32
int
screen_left
;
33
int
screen_right
;
34
int
screen_bottom
;
35
int
screen_top
;
36
37
int
cur_x
;
38
int
cur_y
;
39
40
double
text_size_x
;
41
double
text_size_y
;
42
double
text_rotation
;
43
44
int
mouse_button
[3] = { 1, 2, 3 };
45
46
int
LIB_init
(
const
struct
driver *drv,
int
argc,
char
**argv)
47
{
48
const
char
*p;
49
50
driver = drv;
51
ftcap
=
parse_freetypecap
();
52
53
/* initialize graphics */
54
55
p =
getenv
(
"GRASS_WIDTH"
);
56
screen_left
= 0;
57
screen_right
= (p && atoi(p)) ? atoi(p) :
DEF_WIDTH
;
58
59
p =
getenv
(
"GRASS_HEIGHT"
);
60
screen_top
= 0;
61
screen_bottom
= (p && atoi(p)) ? atoi(p) :
DEF_HEIGHT
;
62
63
/* read mouse button setting */
64
if
((p =
getenv
(
"GRASS_MOUSE_BUTTON"
))) {
65
int
i;
66
67
for
(i = 0; i < 3 && p[i]; i++) {
68
if
(p[i] <
'1'
|| p[i] >
'3'
)
69
break
;
70
}
71
if
(i == 3 && p[0] != p[1] && p[1] != p[2] && p[0] != p[2]) {
72
for
(i = 0; i < 3; i++)
73
mouse_button
[i] = p[i] -
'0'
;
74
}
75
}
76
77
if
(
COM_Graph_set
(argc, argv) < 0)
78
exit(1);
79
80
/* initialize the pads */
81
create_pad
(
""
);
/* scratch pad */
82
83
return
0;
84
}
lib
driver
init.c
Generated on Thu Sep 26 2013 09:48:03 for GRASS Programmer's Manual by
1.8.4