Convert uses of XKeycodeToKeysym (deprecated) to XkbKeycodeToKeysym
[oweals/cde.git] / cde / lib / DtMrm / DtMrm.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 libraries 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  *                   Common Desktop Environment
25  *
26  * (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
27  * (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
28  * (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
29  * (c) Copyright 1993, 1994, 1995 Novell, Inc.
30  * (c) Copyright 1995 Digital Equipment Corp.
31  * (c) Copyright 1995 Fujitsu Limited
32  * (c) Copyright 1995 Hitachi, Ltd.
33  *                                                                 
34  *
35  *                   RESTRICTED RIGHTS LEGEND                              
36  *
37  * Use, duplication, or disclosure by the U.S. Government is subject to
38  * restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
39  * Technical Data and Computer Software clause in DFARS 252.227-7013.  Rights
40  * for non-DOD U.S. Government Departments and Agencies are as set forth in
41  * FAR 52.227-19(c)(1,2).
42  * 
43  * Hewlett-Packard Company, 3000 Hanover Street, Palo Alto, CA 94304 U.S.A.
44  * International Business Machines Corp., Route 100, Somers, NY 10589 U.S.A. 
45  * Sun Microsystems, Inc., 2550 Garcia Avenue, Mountain View, CA 94043 U.S.A.
46  * Novell, Inc., 190 River Road, Summit, NJ 07901 U.S.A.
47  * Digital Equipment Corp., 111 Powdermill Road, Maynard, MA 01754, U.S.A.
48  * Fujitsu Limited, 1015, Kamikodanaka Nakahara-Ku, Kawasaki 211, Japan
49  * Hitachi, Ltd., 6, Kanda Surugadai 4-Chome, Chiyoda-ku, Tokyo 101, Japan
50  */
51 /*                                                                      *
52  * (c) Copyright 1996 Hewlett-Packard Company                           *
53  * (c) Copyright 1996 International Business Machines Corp.             *
54  * (c) Copyright 1996 Sun Microsystems, Inc.                            *
55  * (c) Copyright 1996 Novell, Inc.                                      *
56  * (c) Copyright 1989, 1990, 1996 Digital Equipment Corporation.        *
57  * (c) Copyright 1996 FUJITSU LIMITED.                                  *
58  * (c) Copyright 1996 Hitachi.                                          *
59  */
60 #ifdef REV_INFO
61 #ifndef lint
62 static char rcsid[] = "$TOG: DtMrm.c /main/4 1999/10/14 13:35:44 mgreess $"
63 #endif
64 #endif
65
66 /*
67  *++
68  *  FACILITY:
69  *
70  *      UIL Resource Manager (URM):
71  *
72  *  ABSTRACT:
73  *
74  *      This contains only the top-level routine DtMrmIntialize. It can be 
75  *      modified as needed to add or remove widgets being initialized for
76  *      URM facilities. This routine is normally accessible to
77  *      and used by an application at runtime to access URM facilities.
78  *
79  *--
80  */
81
82
83 /*
84  *
85  *  INCLUDE FILES
86  *
87  */
88 #if defined(__hpux)
89 #include <sys/param.h>
90 #endif
91
92 #include <X11/IntrinsicP.h>
93 #include <Xm/Xm.h>
94 #include <Mrm/MrmPublic.h>
95
96 #include <Dt/Editor.h>
97 #include <Dt/EditorP.h>
98 #include <Dt/Help.h>
99 #include <Dt/HelpP.h>
100 #include <Dt/HelpDialog.h>
101 #include <Dt/HelpDialogP.h>
102 #include <Dt/HelpQuickD.h>
103 #include <Dt/HelpQuickDP.h>
104 #include <Dt/MenuButton.h>
105 #include <Dt/MenuButtonP.h>
106 #include <Dt/Mrm.h>
107 #include <Dt/Print.h>
108 #include <Dt/PrintSetupBP.h>
109 #include <Dt/PrintSetupBP.h>
110 #include <Dt/Term.h>
111 /* work around conflict with <Xm/TextP.h> */
112 #ifdef PreUnder
113 #undef PreUnder
114 #endif
115 #include <Dt/TermP.h>
116
117 /********    Conditionally defined macros for thread_safe DtTerm ******/
118 #ifdef XTHREADS
119 #define _MrmProcessLock() XtProcessLock()
120 #define _MrmProcessUnlock() XtProcessUnlock()
121 #else /* XTHREADS */
122 #define _MrmProcessLock()
123 #define _MrmProcessUnlock()
124 #endif /* XTHREADS */
125
126 /*
127  *
128  *  TABLE OF CONTENTS
129  *
130  *      DtMrmInitialize                 Initialize URM internals before use
131  *
132  */
133
134 /*
135  * The following flag is set to indicate successful URM initialization
136  */
137 static  Boolean urm__initialize_complete = FALSE;
138
139 \f
140 void DtMrmInitialize (void)
141
142 /*
143  *++
144  *  PROCEDURE DESCRIPTION:
145  *
146  *      DtMrmInitialize must be called in order to prepare an application to
147  *      use URM widget fetching facilities for CDE Dt widgets.  It is 
148  *      analogous to the MrmInitialize routine for Motif widgets.
149  *
150  *      DtMrmInitialize initializes the internal data
151  *      structures (creating the mapping from class codes to the creation
152  *      routine for each builtin widget class) which URM needs in order to 
153  *      successfully perform type conversion on arguments, and successfully 
154  *      access widget creation facilities. DtMrmInitialize must be called before
155  *      any widgets are created, whether by URM's fetch mechanisms or directly
156  *      by the application. It may be called before or after XtInitialize, and
157  *      multiple calls after the first one are benign (no-ops).
158  *
159  *  FORMAL PARAMETERS:
160  *
161  *  IMPLICIT INPUTS:
162  *
163  *  IMPLICIT OUTPUTS:
164  *
165  *  FUNCTION VALUE:
166  *
167  *  SIDE EFFECTS:
168  *
169  *--
170  */
171
172 {
173     _MrmProcessLock();
174     /*
175      * Initialize only once
176      */
177     if (urm__initialize_complete) 
178     {
179         _MrmProcessUnlock();
180         return;
181     }
182  
183     /*
184      * Initialize the class descriptors for all the known widgets.
185      */
186     MrmRegisterClass(
187                 0, NULL,
188                 "DtCreateEditor", DtCreateEditor,
189                 (WidgetClass) &dtEditorClassRec
190                 );
191
192     MrmRegisterClass(
193                 0, NULL,
194                 "DtCreateHelpDialog", DtCreateHelpDialog,
195                 (WidgetClass) &dtHelpDialogWidgetClassRec
196                 );
197
198     MrmRegisterClass(
199                 0, NULL,
200                 "DtCreateHelpQuickDialog", DtCreateHelpQuickDialog,
201                 (WidgetClass) &dtHelpQuickDialogWidgetClassRec
202                 );
203
204     MrmRegisterClass(
205                 0, NULL,
206                 "DtCreateMenuButton", DtCreateMenuButton,
207                 (WidgetClass) &dtMenuButtonClassRec
208                 );
209
210     MrmRegisterClass(
211                 0, NULL,
212                 "DtCreatePrintSetupBox", DtCreatePrintSetupBox,
213                 (WidgetClass) &dtPrintSetupBoxClassRec
214                 );
215
216     MrmRegisterClass(
217                 0, NULL,
218                 "DtCreatePrintSetupDialog", DtCreatePrintSetupDialog,
219                 (WidgetClass) &dtPrintSetupBoxClassRec
220                 );
221
222     MrmRegisterClass(
223                 0, NULL,
224                 "DtCreateTerm", DtCreateTerm,
225                 (WidgetClass) &dtTermClassRec
226                 );
227
228     /*
229      * Initialization complete
230      */
231     urm__initialize_complete = TRUE;
232     _MrmProcessUnlock();
233     return;
234 }