Debian Codegraph @

lib/database/src/so/nodes/SoFontStyle.c++

raw symbols SCIP
1 /*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37 /*
38 * Copyright (C) 1995-96 Silicon Graphics, Inc.
39 *
40 _______________________________________________________________________
41 ______________ S I L I C O N G R A P H I C S I N C . ____________
42 |
43 | SoFontStyle implementation.
44 |
45 | Author(s) : Chris Marrin
46 |
47 ______________ S I L I C O N G R A P H I C S I N C . ____________
48 _______________________________________________________________________
49 */
50
51 #include <assert.h>
52
53 #include <Inventor/actions/SoAction.h>cxx . . $ `<file>/lib/database/include/Inventor/actions/SoAction.h`/
54 #include <Inventor/actions/SoCallbackAction.h>cxx . . $ `<file>/lib/database/include/Inventor/actions/SoCallbackAction.h`/
55 #include <Inventor/actions/SoGLRenderAction.h>cxx . . $ `<file>/lib/database/include/Inventor/actions/SoGLRenderAction.h`/
56 #include <Inventor/actions/SoGetBoundingBoxAction.h>cxx . . $ `<file>/lib/database/include/Inventor/actions/SoGetBoundingBoxAction.h`/
57 #include <Inventor/actions/SoPickAction.h>cxx . . $ `<file>/lib/database/include/Inventor/actions/SoPickAction.h`/
58 #include <Inventor/elements/SoFontNameElement.h>cxx . . $ `<file>/lib/database/include/Inventor/elements/SoFontNameElement.h`/
59 #include <Inventor/elements/SoFontSizeElement.h>cxx . . $ `<file>/lib/database/include/Inventor/elements/SoFontSizeElement.h`/
60 #include <Inventor/elements/SoOverrideElement.h>cxx . . $ `<file>/lib/database/include/Inventor/elements/SoOverrideElement.h`/
61 #include <Inventor/nodes/SoFontStyle.h>cxx . . $ `<file>/lib/database/include/Inventor/nodes/SoFontStyle.h`/
62
63 SO_NODE_SOURCEcxx . . $ `lib/database/include/Inventor/nodes/SoSubNode.h:241:9`!(SoFontStyle);
64
65 const char *SoFontStylecxx . . $ SoFontStyle#::fontListcxx . . $ SoFontStyle#fontList.[][4] =
66 {
67 { "Utopia-Regular", "Utopia-Bold",
68 "Utopia-Italic", "Utopia-BoldItalic" },
69 { "Helvetica", "Helvetica-Bold",
70 "Helvetica-Oblique", "Helvetica-BoldOblique" },
71 { "Courier", "Courier-Bold",
72 "Courier-Oblique", "Courier-BoldOblique" },
73 };
74
75 ////////////////////////////////////////////////////////////////////////
76 //
77 // Constructor
78 //
79 SoFontStylecxx . . $ SoFontStyle#::SoFontStylecxx . . $ SoFontStyle#SoFontStyle(49f6e7a06ebc5aa8).()
80 //
81 ////////////////////////////////////////////////////////////////////////
82 {
83 SO_NODE_CONSTRUCTORcxx . . $ `lib/database/include/Inventor/nodes/SoSubNode.h:309:9`!(SoFontStyle);
84 SO_NODE_ADD_FIELDcxx . . $ `lib/database/include/Inventor/nodes/SoSubNode.h:346:9`!(family, (SERIF));
85 SO_NODE_ADD_FIELDcxx . . $ `lib/database/include/Inventor/nodes/SoSubNode.h:346:9`!(style, (NONE));
86
87 // Set up static info for enumerated type field
88 SO_NODE_DEFINE_ENUM_VALUEcxx . . $ `lib/database/include/Inventor/nodes/SoSubNode.h:378:9`!(Family, SERIF);
89 SO_NODE_DEFINE_ENUM_VALUEcxx . . $ `lib/database/include/Inventor/nodes/SoSubNode.h:378:9`!(Family, SANS);
90 SO_NODE_DEFINE_ENUM_VALUEcxx . . $ `lib/database/include/Inventor/nodes/SoSubNode.h:378:9`!(Family, TYPEWRITER);
91
92 SO_NODE_DEFINE_ENUM_VALUEcxx . . $ `lib/database/include/Inventor/nodes/SoSubNode.h:378:9`!(Style, NONE);
93 SO_NODE_DEFINE_ENUM_VALUEcxx . . $ `lib/database/include/Inventor/nodes/SoSubNode.h:378:9`!(Style, BOLD);
94 SO_NODE_DEFINE_ENUM_VALUEcxx . . $ `lib/database/include/Inventor/nodes/SoSubNode.h:378:9`!(Style, ITALIC);
95
96 // Set up info in enumerated type field
97 SO_NODE_SET_SF_ENUM_TYPEcxx . . $ `lib/database/include/Inventor/fields/SoSFEnum.h:155:9`!(family, Family);
98 SO_NODE_SET_SF_ENUM_TYPEcxx . . $ `lib/database/include/Inventor/fields/SoSFEnum.h:155:9`!(style, Style);
99
100 isBuiltIncxx . . $ SoFieldContainer#isBuiltIn. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!;
101 }
102
103 ////////////////////////////////////////////////////////////////////////
104 //
105 // Destructor
106 //
107 SoFontStylecxx . . $ SoFontStyle#::~cxx . . $ SoFontStyle#`~SoFontStyle`(49f6e7a06ebc5aa8).SoFontStylecxx . . $ SoFontStyle#()
108 //
109 ////////////////////////////////////////////////////////////////////////
110 {
111 }
112
113 ////////////////////////////////////////////////////////////////////////
114 //
115 // Description:
116 // Gets the font name based on the family and style
117 //
118 // Use: protected
119
120 SbStringcxx . . $ SbString#
121 SoFontStylecxx . . $ SoFontStyle#::getFontNamecxx . . $ SoFontStyle#getFontName(b0b86cd5fee73d77).()
122 //
123 ////////////////////////////////////////////////////////////////////////
124 {
125 int f = familycxx . . $ SoFontStyle#family..getValuecxx . . $ SoSFEnum#getValue(455f465bc33b4cdf).();
126 int s = stylecxx . . $ SoFontStyle#style..getValuecxx . . $ SoSFEnum#getValue(455f465bc33b4cdf).();
127
128 if (familycxx . . $ SoFontStyle#family..isIgnoredcxx . . $ SoField#isIgnored(455f465bc33b4cdf).()) f = SERIFcxx . . $ SoFontStyle#SERIF.;
129 if (stylecxx . . $ SoFontStyle#style..isIgnoredcxx . . $ SoField#isIgnored(455f465bc33b4cdf).()) s = NONEcxx . . $ SoFontStyle#NONE.;
130
131 if (f < 0 || f > 2) f = 0;
132 if (s < 0 || s > 3) s = 0;
133
134 returncxx . . $ SbString#SbString(40cb438959dbb26f). fontListcxx . . $ SbString#SbString(85c52e162fed56f9).[f][s];
135 }
136
137 ////////////////////////////////////////////////////////////////////////
138 //
139 // Description:
140 // Handles actions
141 //
142 // Use: extender
143
144 void
145 SoFontStylecxx . . $ SoFontStyle#::doActioncxx . . $ SoFontStyle#doAction(967167263c8a77b7).(SoActioncxx . . $ SoAction# *action)
146 //
147 ////////////////////////////////////////////////////////////////////////
148 {
149 SoStatecxx . . $ SoState# *state = action->getStatecxx . . $ SoAction#getState(5c8eb8fe6550a03).();
150
151 // set font to the given font style
152 if ((!familycxx . . $ SoFontStyle#family..isIgnoredcxx . . $ SoField#isIgnored(455f465bc33b4cdf).() || !stylecxx . . $ SoFontStyle#style..isIgnoredcxx . . $ SoField#isIgnored(455f465bc33b4cdf).())
153 && !SoOverrideElementcxx . . $ SoOverrideElement#::getFontNameOverridecxx . . $ SoOverrideElement#getFontNameOverride(fec557bbb5044c9b).(state)
154 ) {
155
156 SbStringcxx . . $ SbString# font = getFontNamecxx . . $ SbString#SbString(40cb438959dbb26f).();
157
158 if (isOverridecxx . . $ SoNode#isOverride(455f465bc33b4cdf).()) {
159 SoOverrideElementcxx . . $ SoOverrideElement#::setFontNameOverridecxx . . $ SoOverrideElement#setFontNameOverride(2ed35df5b93ae4e2).(state, this, TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!);
160 }
161 SoFontNameElementcxx . . $ SoFontNameElement#::setcxx . . $ SoFontNameElement#set(bc810e8c60216df9).(state, this, fontcxx . . $ SbName#SbName(85c52e162fed56f9)..getStringcxx . . $ SbString#getString(a9f41ea0e82d88cf).());
162 }
163
164 if (! sizecxx . . $ SoFont#size..isIgnoredcxx . . $ SoField#isIgnored(455f465bc33b4cdf).()
165 && ! SoOverrideElementcxx . . $ SoOverrideElement#::getFontSizeOverridecxx . . $ SoOverrideElement#getFontSizeOverride(fec557bbb5044c9b).(state)
166 ) {
167 if (isOverridecxx . . $ SoNode#isOverride(455f465bc33b4cdf).()) {
168 SoOverrideElementcxx . . $ SoOverrideElement#::setFontSizeOverridecxx . . $ SoOverrideElement#setFontSizeOverride(2ed35df5b93ae4e2).(state, this, TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!);
169 }
170 SoFontSizeElementcxx . . $ SoFontSizeElement#::setcxx . . $ SoFontSizeElement#set(c0b31446defd93d0).(state, this, sizecxx . . $ SoFont#size..getValuecxx . . $ SoSFFloat#getValue(5036dfe8d4170af2).());
171 }
172 }
173
174 ////////////////////////////////////////////////////////////////////////
175 //
176 // Description:
177 // Does callback action thing.
178 //
179 // Use: extender
180
181 void
182 SoFontStylecxx . . $ SoFontStyle#::callbackcxx . . $ SoFontStyle#callback(425635c2081b81c8).(SoCallbackActioncxx . . $ SoCallbackAction# *action)
183 //
184 ////////////////////////////////////////////////////////////////////////
185 {
186 SoFontStylecxx . . $ SoFontStyle#::doActioncxx . . $ SoFontStyle#doAction(967167263c8a77b7).(action);
187 }
188
189 ////////////////////////////////////////////////////////////////////////
190 //
191 // Description:
192 // Does GL render action.
193 //
194 // Use: extender
195
196 void
197 SoFontStylecxx . . $ SoFontStyle#::GLRendercxx . . $ SoFontStyle#GLRender(5c806c737f468e18).(SoGLRenderActioncxx . . $ SoGLRenderAction# *action)
198 //
199 ////////////////////////////////////////////////////////////////////////
200 {
201 SoFontStylecxx . . $ SoFontStyle#::doActioncxx . . $ SoFontStyle#doAction(967167263c8a77b7).(action);
202 }
203
204 ////////////////////////////////////////////////////////////////////////
205 //
206 // Description:
207 // Does pick action...
208 //
209 // Use: extender
210
211 void
212 SoFontStylecxx . . $ SoFontStyle#::pickcxx . . $ SoFontStyle#pick(7b4c6871cb3411ea).(SoPickActioncxx . . $ SoPickAction# *action)
213 //
214 ////////////////////////////////////////////////////////////////////////
215 {
216 SoFontStylecxx . . $ SoFontStyle#::doActioncxx . . $ SoFontStyle#doAction(967167263c8a77b7).(action);
217 }
218
219 ////////////////////////////////////////////////////////////////////////
220 //
221 // Description:
222 // Does get bounding box action...
223 //
224 // Use: extender
225
226 void
227 SoFontStylecxx . . $ SoFontStyle#::getBoundingBoxcxx . . $ SoFontStyle#getBoundingBox(dd7d7d7c2dd56aae).(SoGetBoundingBoxActioncxx . . $ SoGetBoundingBoxAction# *action)
228 //
229 ////////////////////////////////////////////////////////////////////////
230 {
231 SoFontStylecxx . . $ SoFontStyle#::doActioncxx . . $ SoFontStyle#doAction(967167263c8a77b7).(action);
232 }