|
NCBI Home IEB Home C Toolkit docs C++ Toolkit source browser C Toolkit source browser (2) |
NCBI C Toolkit Cross ReferenceC/cn3d/cn3dentr.c |
source navigation diff markup identifier search freetext search file search |
1 /* $Id: cn3dentr.c,v 6.11 2000/01/06 00:04:42 lewisg Exp $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information (NCBI)
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government do not place any restriction on its use or reproduction.
13 * We would, however, appreciate having the NCBI and the author cited in
14 * any work or product based on this material
15 *
16 * Although all reasonable efforts have been taken to ensure the accuracy
17 * and reliability of the software and data, the NLM and the U.S.
18 * Government do not and cannot warrant the performance or results that
19 * may be obtained by using this software or data. The NLM and the U.S.
20 * Government disclaim all warranties, express or implied, including
21 * warranties of performance, merchantability or fitness for any particular
22 * purpose.
23 *
24 * ===========================================================================
25 *
26 * Author: Christopher Hogue, Denis Vakatov
27 *
28 * Version Creation Date: 1/31/96
29 *
30 * File Description: Entrez entry point for Cn3D
31 *
32 * Modifications:
33 * --------------------------------------------------------------------------
34 * $Log: cn3dentr.c,v $
35 * Revision 6.11 2000/01/06 00:04:42 lewisg
36 * selection bug fixes, update message outbound, animation APIs moved to vibrant
37 *
38 * Revision 6.10 2000/01/04 15:55:50 lewisg
39 * don't hang on disconnected network and fix memory leak/hang at exit
40 *
41 * Revision 6.9 1999/10/29 14:15:27 thiessen
42 * ran all Cn3D source through GNU Indent to prettify
43 *
44 * Revision 6.8 1999/10/15 20:56:38 lewisg
45 * append DDV_ColorGlobal as userdata. free memory when cn3d terminates.
46 *
47 * Revision 6.7 1999/10/05 23:18:19 lewisg
48 * add ddv and udv to cn3d with memory management
49 *
50 * Revision 6.6 1999/04/06 20:05:53 lewisg
51 * more opengl
52 *
53 * Revision 6.5 1999/01/20 18:21:18 ywang
54 * include salmedia.h due to the move around of MediaInfo from cn3dmsg.h to the new created salmedia.h
55 *
56 * Revision 6.4 1999/01/14 19:07:16 kans
57 * network availability is configurable
58 *
59 * Revision 6.3 1998/11/24 17:01:01 kans
60 * put render/label/view/model controls in separate window
61 *
62 * Revision 6.2 1998/05/29 22:12:59 kans
63 * needed to include cn3dmsg.h
64 *
65 * Revision 6.1 1998/05/28 22:05:59 ywang
66 * maintain highlight upon rendering switch when salsa is on
67 *
68 * Revision 6.0 1997/08/25 18:13:28 madden
69 * Revision changed to 6.0
70 *
71 * Revision 1.2 1997/07/29 21:17:07 vakatov
72 * [WIN32,DLL] Made Cn3D's stubbed functions be DLL-exportable
73 *
74 * Revision 1.1 1997/03/20 16:24:02 vakatov
75 * Initial revision
76 *
77 *
78 * ==========================================================================
79 */
80
81 #include <cn3dmain.h>
82 #include <cn3dentr.h>
83 #include <cn3dmsg.h>
84 #include <salmedia.h>
85 #include <cn3dshim.h>
86 #include <accentr.h>
87
88
89 /* QUERY data and callbacks
90 */
91
92 static IteM Cn3D_query;
93 static BeepHook Cn3D_query_callback;
94 static WindoW Cn3D_query_window;
95
96 static void Cn3D_ItemQueryCB(IteM i)
97 {
98 if (Cn3D_query_callback)
99 (*Cn3D_query_callback) ();
100 }
101
102
103 /* CLOSE callbacks
104 */
105
106 extern void Cn3D_HideCtrl(WindoW w);
107 static void Cn3D_MyClose(WindoW www)
108 {
109 if (Cn3D_query_window && !Visible(Cn3D_query_window)) {
110 ClearStructures();
111 ClearSequences();
112 QuitProgram();
113 } else {
114 #ifdef _OPENGL
115 if (OGL_IsPlaying(Cn3D_ColorData.OGL_Data))
116 OGL_StopPlaying(Cn3D_ColorData.OGL_Data);
117 #else
118 if (IsPlaying3D())
119 StopPlaying3D();
120 #endif
121 ClearStructures();
122 ClearSequences();
123 Hide(www);
124 Cn3D_HideCtrl(NULL);
125 }
126 }
127
128 static void Cn3D_OnCloseCB(WindoW w)
129 {
130 Cn3D_MyClose(w);
131 }
132
133 static void Cn3D_ItemCloseCB(IteM i)
134 {
135 WindoW w = GetObjectExtra(i);
136 Cn3D_MyClose(w);
137 }
138
139
140 /* QUIT callback
141 */
142
143 static void Cn3D_ItemQuitCB(IteM i)
144 {
145 ClearStructures();
146 ClearSequences();
147 QuitProgram();
148 }
149
150
151
152 /* Set Query callback and data
153 */
154
155 NLM_EXTERN void LIBCALL Cn3D_SetQueryCallback(BeepHook queryFunc,
156 VoidPtr queryWindow)
157 {
158 Enable(Cn3D_query);
159 Cn3D_query_callback = queryFunc;
160 Cn3D_query_window = (WindoW) queryWindow;
161 }
162
163
164 /* Attach CN3D to Entrez
165 */
166
167 NLM_EXTERN Handle LIBCALL Cn3DWin_Entrez(ItmActnProc netconfig,
168 Boolean usingEntrez)
169 {
170 MenU menu = NULL;
171 WindoW www;
172
173 if(!EntrezIsInited()) return NULL;
174
175 Cn3D_ColorData.UseEntrez = usingEntrez;
176 Cn3D_ColorData.EntrezOn = TRUE; /* assume entrez is inited */
177 www =
178 Cn3DWin(Cn3D_OnCloseCB, &menu, netconfig, FALSE);
179
180 SetObjectExtra(CommandItem(menu, "Close/C", Cn3D_ItemCloseCB), www,
181 NULL);
182
183 SeparatorItem(menu);
184
185 Cn3D_query =
186 CommandItem(menu, "Entrez Query Window...", Cn3D_ItemQueryCB);
187 Disable(Cn3D_query);
188
189 CommandItem(menu, "Quit Entrez/Q", Cn3D_ItemQuitCB);
190
191 return (Handle) www;
192 }
193 |
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more information. |