0022792: Globally defined symbol PI conflicts with VTK definition (Intel compiler)
[occt.git] / src / OpenGl / OpenGl_tox.cxx
CommitLineData
7fd59977 1
2#ifndef WNT
3/***********************************************************************
4
5FONCTION :
6----------
7File OpenGl_tox :
8
9
10REMARQUES:
11----------
12
13
14HISTORIQUE DES MODIFICATIONS :
15--------------------------------
16xx-xx-xx : xxx ; Creation.
1720-02-96 : FMN ; Suppression code inutile:
18on ne garde que :
19- call_tox_open_display()
20- call_tox_getscreen(Tint *d_wdth, Tint *d_hght)
2101-04-96 : CAL ; Integration MINSK portage WNT
2220-11-97 : CAL ; RererereMerge avec le source de portage.
2312-02-01 : GG ; BUC60821 Add getpitchsize() function
2427-03-02 : GG ; RIC120202 Add new function call_tox_set_display
25
26************************************************************************/
27
28/*----------------------------------------------------------------------*/
29/*
30* Includes
31*/
32
33#include <stdio.h>
34
35#include <X11/Xlib.h>
36#include <X11/Xutil.h>
37
38#include <InterfaceGraphic_Aspect.hxx>
39
40#include <OpenGl_tgl_all.hxx>
41#include <OpenGl_txgl.hxx>
42#include <OpenGl_tgl_tox.hxx>
43#include <OpenGl_tgl_util.hxx>
44
45/*----------------------------------------------------------------------*/
46/*
47* Variables globales
48*/
49
50Display * call_thedisplay; /* display pointer; defined in tgl/tox */
51
52/*----------------------------------------------------------------------*/
53/*
54*Fonctions externes
55*/
56
57/*----------------------------------------------------------------------*/
58
59Tint
60call_tox_open_display (void)
61{
62 char synchro[132];
63
64 if (call_thedisplay == NULL)
65 /*
66 * display_name
67 * Specifies the hardware display name, which determines the
68 * display and communications domain to be used.
69 * On a POSIX system, if the display_name is NULL, it defaults
70 * to the value of the DISPLAY environment variable.
71 */
72 call_thedisplay = XOpenDisplay ((char*) NULL);
73
74 if (call_thedisplay != NULL)
75 if (call_util_osd_getenv ("CALL_SYNCHRO_X", synchro, 132))
76 XSynchronize (call_thedisplay, 1);
77 else
78 XSynchronize (call_thedisplay, 0);
79 else
80 fprintf (stderr, "Cannot connect to X server %s\n",
81 XDisplayName ((char*) NULL));
82
83 return (call_thedisplay == NULL);
84}
85
86/*RIC120302*/
87Tint
88call_tox_set_display (void *vdisplay)
89{
90 Display *pdisplay = (Display*) vdisplay;
91 char synchro[132];
92
93 if ( pdisplay ) {
94 call_thedisplay = pdisplay;
95
96 if (call_util_osd_getenv ("CALL_SYNCHRO_X", synchro, 132))
97 XSynchronize (call_thedisplay, 1);
98 else
99 XSynchronize (call_thedisplay, 0);
100 } else {
101 fprintf (stderr, "Cannot connect to X server %s\n",
102 XDisplayName ((char*) NULL));
103 }
104 return (call_thedisplay != NULL);
105}
106/*RIC120302*/
107
108/*----------------------------------------------------------------------*/
109
110void
111call_tox_getscreen( Tint *d_wdth, Tint *d_hght )
112{
113 *d_wdth = DisplayWidth( call_thedisplay, DefaultScreen(call_thedisplay) );
114 *d_hght = DisplayHeight( call_thedisplay, DefaultScreen(call_thedisplay) );
115 return;
116}
117
118/*----------------------------------------------------------------------*/
119
120Tfloat
121call_tox_getpitchsize( )
122{
123 static float pitch_size = 0.;
124
125 if( pitch_size == 0. ) {
126 int width = DisplayWidth( call_thedisplay, DefaultScreen(call_thedisplay) );
127 int height = DisplayHeight( call_thedisplay, DefaultScreen(call_thedisplay) );
128 int mmwidth = DisplayWidthMM( call_thedisplay, DefaultScreen(call_thedisplay) );
129 int mmheight = DisplayHeightMM( call_thedisplay, DefaultScreen(call_thedisplay) );
130 pitch_size = ((float)mmwidth/width + (float)mmheight/height)/2.;
131 }
132
133 return pitch_size;
134}
135
136/*----------------------------------------------------------------------*/
137#else
138# include <windows.h>
139# include <OpenGl_tgl_all.hxx>
140# include <OpenGl_txgl.hxx>
141
142DISPLAY* call_thedisplay = "DISPLAY"; /* Dummy for Windows NT */
143
144Tint
145call_tox_open_display ( void )
146{
147 return 1;
148}
149
150/*RIC120302*/
151Tint
152call_tox_set_display ( void* vdisplay)
153{
154 return 1;
155}
156/*RIC120302*/
157
158void
159call_tox_getscreen ( Tint *d_wdth, Tint *d_hght )
160{
161 *d_wdth = GetSystemMetrics(SM_CXSCREEN);
162 *d_hght = GetSystemMetrics(SM_CYSCREEN);
163 return;
164}
165
166#endif /* WNT */