0022792: Globally defined symbol PI conflicts with VTK definition (Intel compiler)
[occt.git] / src / OpenGl / OpenGl_textcolsubtitle.cxx
CommitLineData
7fd59977 1/***********************************************************************
2
3FONCTION :
4----------
5File OpenGl_textcolsubtitle :
6
7
8REMARQUES:
9----------
10
11
12HISTORIQUE DES MODIFICATIONS :
13--------------------------------
1430-11-98 : FMN ; Creation.
15
16************************************************************************/
17
18/*----------------------------------------------------------------------*/
19/*
20* Includes
21*/
22
23
24#include <OpenGl_tgl_all.hxx>
25
26#include <stddef.h>
27#include <stdio.h>
28
29#include <OpenGl_cmn_varargs.hxx>
30#include <OpenGl_telem_attri.hxx>
31#include <OpenGl_tsm.hxx>
32#include <OpenGl_telem.hxx>
33#include <OpenGl_telem_inquire.hxx>
34#include <OpenGl_Memory.hxx>
35
36/*----------------------------------------------------------------------*/
37/*
38* Fonctions statiques
39*/
40
41static TStatus TextColourSubTitleDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
42static TStatus TextColourSubTitleAdd( TSM_ELEM_DATA, Tint, cmn_key* );
43static TStatus TextColourSubTitleDelete( TSM_ELEM_DATA, Tint, cmn_key* );
44static TStatus TextColourSubTitlePrint( TSM_ELEM_DATA, Tint, cmn_key* );
45static TStatus TextColourSubTitleInquire( TSM_ELEM_DATA, Tint, cmn_key* );
46
47/*----------------------------------------------------------------------*/
48
49static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
50{
51 0, /* PickTraverse */
52 TextColourSubTitleDisplay,
53 TextColourSubTitleAdd,
54 TextColourSubTitleDelete,
55 TextColourSubTitlePrint,
56 TextColourSubTitleInquire
57};
58
59
60/*----------------------------------------------------------------------*/
61
62MtblPtr
63TelTextColourSubTitleInitClass( TelType *el )
64{
65 *el = TelTextColourSubTitle;
66 return MtdTbl;
67}
68
69/*----------------------------------------------------------------------*/
70
71static TStatus
72TextColourSubTitleAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
73{
74 tel_colour data = new TEL_COLOUR();
75 //cmn_memreserve( data, 1, 0 );
76 if( !data )
77 return TFailure;
78
79 *data = *(tel_colour)(k[0]->data.pdata);
80
81 ((tsm_elem_data)(d.pdata))->pdata = data;
82
83 return TSuccess;
84}
85
86
87/*----------------------------------------------------------------------*/
88
89static TStatus
90TextColourSubTitleDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
91{
92 tel_colour d;
93 CMN_KEY key;
94
95 d = (tel_colour)data.pdata;
96
97 key.id = TelTextColourSubTitle;
98 key.data.pdata = d;
99 TsmSetAttri( 1, &key );
100
101 return TSuccess;
102}
103
104
105/*----------------------------------------------------------------------*/
106
107static TStatus
108TextColourSubTitleDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
109{
110 //cmn_freemem( data.pdata );
111 if (data.pdata)
112 delete data.pdata;
113 return TSuccess;
114}
115
116/*----------------------------------------------------------------------*/
117
118static TStatus
119TextColourSubTitlePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
120{
121 tel_colour p;
122
123 p = (tel_colour)data.pdata;
124
125 fprintf( stdout, "TelTextColourSubTitle. R = %g, G = %g, B = %g\n",
126 p->rgb[0], p->rgb[1], p->rgb[2] );
127 fprintf( stdout, "\n" );
128
129 return TSuccess;
130}
131
132/*----------------------------------------------------------------------*/
133
134static TStatus
135TextColourSubTitleInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
136{
137 Tint i;
138 tel_colour col;
139
140 col = (tel_colour)data.pdata;
141
142 for( i = 0; i < n; i++ )
143 {
144 switch( k[i]->id )
145 {
146 case INQ_GET_SIZE_ID:
147 {
148 k[i]->data.ldata = sizeof( Tint );
149 break;
150 }
151 case INQ_GET_CONTENT_ID:
152 {
153 TEL_INQ_CONTENT *c;
154 Teldata *w;
155
156 c = (tel_inq_content)k[i]->data.pdata;
157 w = c->data;
158 c->act_size = 0;
159
160 w->gnl_colour.rgb[0] = col->rgb[0];
161 w->gnl_colour.rgb[1] = col->rgb[1];
162 w->gnl_colour.rgb[2] = col->rgb[2];
163 break;
164 }
165 }
166 }
167
168 return TSuccess;
169}
170
171/*----------------------------------------------------------------------*/