OpenIndiana and Solaris port
[oweals/cde.git] / cde / programs / dtinfo / dtinfo / src / Basic / NodeDisplayDataTml.C
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /*
24  * $XConsortium: NodeDisplayDataTml.cc /main/3 1996/06/11 16:20:36 cde-hal $
25  *
26  * Copyright (c) 1992 HaL Computer Systems, Inc.  All rights reserved.
27  * UNPUBLISHED -- rights reserved under the Copyright Laws of the United
28  * States.  Use of a copyright notice is precautionary only and does not
29  * imply publication or disclosure.
30  * 
31  * This software contains confidential information and trade secrets of HaL
32  * Computer Systems, Inc.  Use, disclosure, or reproduction is prohibited
33  * without the prior express written permission of HaL Computer Systems, Inc.
34  * 
35  *                         RESTRICTED RIGHTS LEGEND
36  * Use, duplication, or disclosure by the Government is subject to
37  * restrictions as set forth in subparagraph (c)(l)(ii) of the Rights in
38  * Technical Data and Computer Software clause at DFARS 252.227-7013.
39  *                        HaL Computer Systems, Inc.
40  *                  1315 Dell Avenue, Campbell, CA  95008
41  * 
42  */
43
44 #define C_NodeDisplayData
45 #define L_Basic
46
47 #define C_NodeMgr
48 #define C_NodeParser
49 #define L_Managers
50
51 #define C_NodeObject
52 #define L_Odb
53
54 #include "Prelude.h"
55
56 #include <tml/tml_objects.hxx>
57
58
59 // /////////////////////////////////////////////////////////////////
60 // the_model - return the model, creating if necessary
61 // /////////////////////////////////////////////////////////////////
62
63 model &
64 NodeDisplayData::the_model()
65 {
66 #ifdef BOGUS
67   // MUST start counting at 1!! DJB 
68   static u_int next_serial = 1;
69   if (f_model == NULL)
70     {
71       f_model = f_node_object.node_manager().node_parser().load (f_node_object);
72       f_model_serial = next_serial++;
73     }
74
75   // NOTE: error checking required
76
77   return (*f_model);
78 #endif
79   return (*f_model);
80 }
81
82 // /////////////////////////////////////////////////////////////////
83 // not_displayed
84 // /////////////////////////////////////////////////////////////////
85
86 // FYI: this function could easily be extended to implement a model cache.
87
88 void
89 NodeDisplayData::not_displayed()
90 {
91   return;  //  commented out to test code below
92   // NOTE: Return for now - improves performance, but uses more memory.
93   // If you remove the return statement above you MUST tell me
94   // or user marks will break!!  DJB 10/28/92
95 #if 0
96   delete f_model;
97   f_model = NULL;
98   f_locator_table.remove_all (TRUE);
99
100   graphics_mgr().remove(f_node_object);
101 #endif
102 }
103
104
105 // /////////////////////////////////////////////////////////////////
106 // class destructor
107 // /////////////////////////////////////////////////////////////////
108
109 NodeDisplayData::~NodeDisplayData()
110 {
111 #ifdef BOGUS
112   printf ("~~~ NodeDisplayData Destructed ~~~\n");
113   delete f_model;
114   f_locator_table.remove_all (TRUE);
115
116   ON_DEBUG(cerr << f_node_object.locator() << endl);
117
118   graphics_mgr().remove(f_node_object);
119 #endif
120 }
121
122
123 // /////////////////////////////////////////////////////////////////
124 // update_fonts
125 // /////////////////////////////////////////////////////////////////
126
127 void
128 NodeDisplayData::update_fonts(unsigned int serial_number)
129 {
130 #ifdef BOGUS
131   // NOTE: f_font_serial number could be way less than serial_number 
132   // as this could have been on the history list with no node displayed,
133   // therefore f_font_serial would not have been updated
134   // during other font changes, as the update_fonts is done only to visible
135   // nodes
136
137   assert(f_font_serial <= serial_number);
138
139   //  see if we have already dealt with this model
140   if (f_font_serial == serial_number)
141     return ;
142
143   f_font_serial = serial_number ;
144
145   if (f_model)
146     f_model->update_fonts();
147 #endif
148 }