7fd59977 |
1 | /*********************************************************************** |
2 | |
3 | FONCTION : |
4 | ---------- |
5 | File OpenGl_textheight : |
6 | |
7 | |
8 | REMARQUES: |
9 | ---------- |
10 | |
11 | |
12 | HISTORIQUE DES MODIFICATIONS : |
13 | -------------------------------- |
14 | xx-xx-xx : xxx ; Creation. |
15 | 20-02-96 : FMN ; Suppression code inutile: |
16 | 01-04-96 : CAL ; Integration MINSK portage WNT |
17 | 26-04-96 : FMN ; Correction warning de compilation. |
18 | 20-11-97 : CAL ; RererereMerge avec le source de portage. |
19 | 17-12-96 : FMN ; Warning de compilation. |
20 | |
21 | ************************************************************************/ |
22 | |
23 | #define BUC60821 //GG 12/02/01 allow tu use the nearest font size. |
24 | |
25 | /*----------------------------------------------------------------------*/ |
26 | /* |
27 | * Includes |
28 | */ |
29 | |
30 | #include <OpenGl_tgl_all.hxx> |
31 | |
32 | #include <stddef.h> |
33 | #include <stdio.h> |
34 | |
35 | #include <OpenGl_cmn_varargs.hxx> |
36 | #include <OpenGl_telem_attri.hxx> |
37 | #include <OpenGl_tsm.hxx> |
38 | #include <OpenGl_telem.hxx> |
39 | #include <OpenGl_telem_inquire.hxx> |
40 | #include <OpenGl_tgl_tox.hxx> |
41 | #include <OpenGl_Memory.hxx> |
42 | |
43 | |
44 | /*----------------------------------------------------------------------*/ |
45 | /* |
46 | * Fonctions statiques |
47 | */ |
48 | |
49 | static TStatus TextHeightDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); |
50 | static TStatus TextHeightAdd( TSM_ELEM_DATA, Tint, cmn_key* ); |
51 | static TStatus TextHeightDelete( TSM_ELEM_DATA, Tint, cmn_key* ); |
52 | static TStatus TextHeightPrint( TSM_ELEM_DATA, Tint, cmn_key* ); |
53 | static TStatus TextHeightInquire( TSM_ELEM_DATA, Tint, cmn_key* ); |
54 | |
55 | /*----------------------------------------------------------------------*/ |
56 | static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = |
57 | { |
58 | TextHeightDisplay, /* PickTraverse */ |
59 | TextHeightDisplay, |
60 | TextHeightAdd, |
61 | TextHeightDelete, |
62 | TextHeightPrint, |
63 | TextHeightInquire |
64 | }; |
65 | |
66 | |
67 | /*----------------------------------------------------------------------*/ |
68 | MtblPtr |
69 | TelTextHeightInitClass( TelType *el ) |
70 | { |
71 | *el = TelTextHeight; |
72 | return MtdTbl; |
73 | } |
74 | |
75 | /*----------------------------------------------------------------------*/ |
76 | static TStatus |
77 | TextHeightAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) |
78 | { |
79 | Tfloat *data = new Tfloat(); |
80 | if( !data ) |
81 | return TFailure; |
82 | |
83 | #ifdef BUC60821 |
84 | *data = k[0]->data.fdata; |
85 | #else /*BUC60821*/ |
86 | #ifndef WNT |
87 | { |
88 | Tint d_wdth, d_hght; |
89 | call_tox_getscreen( &d_wdth, &d_hght ); |
90 | *data = k[0]->data.fdata * d_hght; |
91 | } |
92 | #else |
93 | *data = k[0]->data.fdata; |
94 | #endif /* WNT */ |
95 | #endif /* BUC60821 */ |
96 | |
97 | ((tsm_elem_data)(d.pdata))->pdata = data; |
98 | |
99 | return TSuccess; |
100 | } |
101 | |
102 | |
103 | /*----------------------------------------------------------------------*/ |
104 | static TStatus |
105 | TextHeightDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) |
106 | { |
107 | CMN_KEY key; |
108 | |
109 | key.id = TelTextHeight; |
110 | key.data.fdata = *(Tfloat*)(data.pdata); |
111 | TsmSetAttri( 1, &key ); |
112 | |
113 | return TSuccess; |
114 | } |
115 | |
116 | |
117 | /*----------------------------------------------------------------------*/ |
118 | static TStatus |
119 | TextHeightDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) |
120 | { |
121 | if (data.pdata) |
122 | delete data.pdata; |
123 | return TSuccess; |
124 | } |
125 | |
126 | |
127 | /*----------------------------------------------------------------------*/ |
128 | static TStatus |
129 | TextHeightPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) |
130 | { |
131 | fprintf( stdout, "TelTextHeight. Value = %g\n", *(Tfloat *)(data.pdata)); |
132 | fprintf( stdout, "\n" ); |
133 | |
134 | return TSuccess; |
135 | } |
136 | |
137 | |
138 | /*----------------------------------------------------------------------*/ |
139 | static TStatus |
140 | TextHeightInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) |
141 | { |
142 | Tint i; |
143 | Tfloat *f = (Tfloat*)data.pdata; |
144 | |
145 | for( i = 0; i < n; i++ ) |
146 | { |
147 | switch( k[i]->id ) |
148 | { |
149 | case INQ_GET_SIZE_ID: |
150 | { |
151 | k[i]->data.ldata = sizeof( Tint ); |
152 | break; |
153 | } |
154 | case INQ_GET_CONTENT_ID: |
155 | { |
156 | TEL_INQ_CONTENT *c; |
157 | Teldata *w; |
158 | |
159 | c = (TEL_INQ_CONTENT *)k[i]->data.pdata; |
160 | w = c->data; |
161 | c->act_size = 0; |
162 | w->fdata = *f; |
163 | break; |
164 | } |
165 | } |
166 | } |
167 | |
168 | return TSuccess; |
169 | } |
170 | /*----------------------------------------------------------------------*/ |