1 | /* |
---|
2 | A* ------------------------------------------------------------------- |
---|
3 | B* This file contains source code for the PyMOL computer program |
---|
4 | C* copyright 1998-2000 by Warrn Lyford Delano of DeLano Scientific. |
---|
5 | D* ------------------------------------------------------------------- |
---|
6 | E* It is unlawful to modify or remove this copyright notice. |
---|
7 | F* ------------------------------------------------------------------- |
---|
8 | G* Please see the accompanying LICENSE file for further information. |
---|
9 | H* ------------------------------------------------------------------- |
---|
10 | I* Additional authors of this source file include: |
---|
11 | -* |
---|
12 | -* |
---|
13 | -* |
---|
14 | Z* ------------------------------------------------------------------- |
---|
15 | */ |
---|
16 | |
---|
17 | #include "os_std.h" |
---|
18 | #include "os_gl.h" |
---|
19 | |
---|
20 | #include "MemoryDebug.h" |
---|
21 | |
---|
22 | #include "Base.h" |
---|
23 | |
---|
24 | #include "OVContext.h" |
---|
25 | |
---|
26 | #include "MemoryDebug.h" |
---|
27 | #include "MemoryCache.h" |
---|
28 | #include "Err.h" |
---|
29 | #include "Util.h" |
---|
30 | #include "Selector.h" |
---|
31 | #include "Color.h" |
---|
32 | #include "Ortho.h" |
---|
33 | #include "Scene.h" |
---|
34 | #include "PyMOLObject.h" |
---|
35 | #include "Executive.h" |
---|
36 | #include "Word.h" |
---|
37 | #include "RepMesh.h" |
---|
38 | #include "ObjectMolecule.h" |
---|
39 | #include "Control.h" |
---|
40 | #include "Sphere.h" |
---|
41 | #include "Setting.h" |
---|
42 | #include "Ray.h" |
---|
43 | #include "Util.h" |
---|
44 | #include "Movie.h" |
---|
45 | #include "P.h" |
---|
46 | #include "Editor.h" |
---|
47 | #include "SculptCache.h" |
---|
48 | #include "Isosurf.h" |
---|
49 | #include "Tetsurf.h" |
---|
50 | #include "PConv.h" |
---|
51 | #include "VFont.h" |
---|
52 | #include "Wizard.h" |
---|
53 | #include "Text.h" |
---|
54 | #include "Character.h" |
---|
55 | #include "Seq.h" |
---|
56 | #include "Seeker.h" |
---|
57 | #include "Texture.h" |
---|
58 | #include "TestPyMOL.h" |
---|
59 | #include "TypeFace.h" |
---|
60 | #include "PlugIOManager.h" |
---|
61 | |
---|
62 | #include "PyMOL.h" |
---|
63 | #include "PyMOLGlobals.h" |
---|
64 | #include "PyMOLOptions.h" |
---|
65 | |
---|
66 | #ifndef _PYMOL_NOPY |
---|
67 | PyMOLGlobals *TempPyMOLGlobals = NULL; |
---|
68 | #endif |
---|
69 | |
---|
70 | /* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */ |
---|
71 | #ifndef _PYMOL_NOPY |
---|
72 | #ifdef _MACPYMOL_XCODE |
---|
73 | extern int *MacPyMOLReady; |
---|
74 | extern CPyMOLOptions *MacPyMOLOption; |
---|
75 | #endif |
---|
76 | #endif |
---|
77 | /* END PROPRIETARY CODE SEGMENT */ |
---|
78 | |
---|
79 | #ifdef _MACPYMOL_XCODE |
---|
80 | /* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */ |
---|
81 | #define PYMOL_API_LOCK if((I->PythonInitStage)&&PLockAPIAsGlut(I->G,true)) { |
---|
82 | #define PYMOL_API_UNLOCK PUnlockAPIAsGlut(I->G); } |
---|
83 | #define PYMOL_API_UNLOCK_NO_FLUSH PUnlockAPIAsGlutNoFlush(I->G); } |
---|
84 | /* END PROPRIETARY CODE SEGMENT */ |
---|
85 | #else |
---|
86 | #define PYMOL_API_LOCK { |
---|
87 | #define PYMOL_API_UNLOCK } |
---|
88 | #define PYMOL_API_UNLOCK_NO_FLUSH } |
---|
89 | #endif |
---|
90 | |
---|
91 | #define IDLE_AND_READY 10 |
---|
92 | |
---|
93 | typedef struct _CPyMOL { |
---|
94 | PyMOLGlobals *G; |
---|
95 | int FakeDragFlag; |
---|
96 | int RedisplayFlag; |
---|
97 | int PassiveFlag; |
---|
98 | int SwapFlag; |
---|
99 | int BusyFlag; |
---|
100 | int InterruptFlag; |
---|
101 | int ReshapeFlag; |
---|
102 | int ClickReadyFlag; |
---|
103 | ObjectNameType ClickedObject; |
---|
104 | int ClickedIndex, ClickedButton, ClickedModifiers, ClickedX, ClickedY; |
---|
105 | int ImageRequestedFlag,ImageReadyFlag; |
---|
106 | int DraggedFlag; |
---|
107 | int Reshape[PYMOL_RESHAPE_SIZE]; |
---|
108 | int Progress[PYMOL_PROGRESS_SIZE]; |
---|
109 | int ProgressChanged; |
---|
110 | int IdleAndReady; |
---|
111 | int ExpireCount; |
---|
112 | PyMOLSwapBuffersFn *SwapFn; |
---|
113 | |
---|
114 | /* Python stuff */ |
---|
115 | #ifndef _PYMOL_NOPY |
---|
116 | int PythonInitStage; |
---|
117 | #endif |
---|
118 | /* dynamically mapped string constants */ |
---|
119 | |
---|
120 | OVLexicon *Lex; |
---|
121 | ov_word lex_pdb, lex_mol2, lex_mol, lex_sdf, lex_xplor, lex_ccp4; |
---|
122 | ov_word lex_string, lex_filename, lex_raw; |
---|
123 | |
---|
124 | OVOneToOne *Rep; |
---|
125 | ov_word lex_everything, lex_sticks, lex_spheres, lex_surface; |
---|
126 | ov_word lex_labels, lex_nb_spheres, lex_cartoon, lex_ribbon; |
---|
127 | ov_word lex_lines, lex_mesh, lex_dots, lex_dashes, lex_nonbonded; |
---|
128 | ov_word lex_cell, lex_cgo, lex_callback, lex_extent, lex_slice; |
---|
129 | |
---|
130 | OVOneToOne *Clip; |
---|
131 | ov_word lex_near, lex_far, lex_move, lex_slab, lex_atoms; |
---|
132 | |
---|
133 | OVOneToOne *Reinit; |
---|
134 | ov_word lex_settings; |
---|
135 | |
---|
136 | OVOneToOne *SelectList; |
---|
137 | ov_word lex_index, lex_id, lex_rank; |
---|
138 | |
---|
139 | OVOneToOne *Setting; |
---|
140 | ov_word lex_bonding_vdw_cutoff; |
---|
141 | ov_word lex_min_mesh_spacing; |
---|
142 | ov_word lex_dot_density; |
---|
143 | ov_word lex_dot_mode; |
---|
144 | ov_word lex_solvent_radius; |
---|
145 | ov_word lex_sel_counter; |
---|
146 | ov_word lex_bg_rgb; |
---|
147 | ov_word lex_ambient; |
---|
148 | ov_word lex_direct; |
---|
149 | ov_word lex_reflect; |
---|
150 | ov_word lex_light; |
---|
151 | ov_word lex_power; |
---|
152 | ov_word lex_antialias; |
---|
153 | ov_word lex_cavity_cull; |
---|
154 | ov_word lex_gl_ambient; |
---|
155 | ov_word lex_single_image; |
---|
156 | ov_word lex_movie_delay; |
---|
157 | ov_word lex_ribbon_power; |
---|
158 | ov_word lex_ribbon_power_b; |
---|
159 | ov_word lex_ribbon_sampling; |
---|
160 | ov_word lex_ribbon_radius; |
---|
161 | ov_word lex_stick_radius; |
---|
162 | ov_word lex_hash_max; |
---|
163 | ov_word lex_ortho; |
---|
164 | ov_word lex_spec_reflect; |
---|
165 | ov_word lex_spec_power; |
---|
166 | ov_word lex_sweep_angle; |
---|
167 | ov_word lex_sweep_speed; |
---|
168 | ov_word lex_dot_hydrogens; |
---|
169 | ov_word lex_dot_radius; |
---|
170 | ov_word lex_ray_trace_frames; |
---|
171 | ov_word lex_cache_frames; |
---|
172 | ov_word lex_trim_dots; |
---|
173 | ov_word lex_cull_spheres; |
---|
174 | ov_word lex_test1; |
---|
175 | ov_word lex_test2; |
---|
176 | ov_word lex_surface_best; |
---|
177 | ov_word lex_surface_normal; |
---|
178 | ov_word lex_surface_quality; |
---|
179 | ov_word lex_surface_proximity; |
---|
180 | ov_word lex_normal_workaround; |
---|
181 | ov_word lex_stereo_angle; |
---|
182 | ov_word lex_stereo_shift; |
---|
183 | ov_word lex_line_smooth; |
---|
184 | ov_word lex_line_width; |
---|
185 | ov_word lex_half_bonds; |
---|
186 | ov_word lex_stick_quality; |
---|
187 | ov_word lex_stick_overlap; |
---|
188 | ov_word lex_stick_nub; |
---|
189 | ov_word lex_all_states; |
---|
190 | ov_word lex_pickable; |
---|
191 | ov_word lex_auto_show_lines; |
---|
192 | ov_word lex_idle_delay; |
---|
193 | ov_word lex_no_idle; |
---|
194 | ov_word lex_fast_idle; |
---|
195 | ov_word lex_slow_idle; |
---|
196 | ov_word lex_rock_delay; |
---|
197 | ov_word lex_dist_counter; |
---|
198 | ov_word lex_dash_length; |
---|
199 | ov_word lex_dash_gap; |
---|
200 | ov_word lex_auto_zoom; |
---|
201 | ov_word lex_overlay; |
---|
202 | ov_word lex_text; |
---|
203 | ov_word lex_button_mode; |
---|
204 | ov_word lex_valence; |
---|
205 | ov_word lex_nonbonded_size; |
---|
206 | ov_word lex_label_color; |
---|
207 | ov_word lex_ray_trace_fog; |
---|
208 | ov_word lex_spheroid_scale; |
---|
209 | ov_word lex_ray_trace_fog_start; |
---|
210 | ov_word lex_spheroid_smooth; |
---|
211 | ov_word lex_spheroid_fill; |
---|
212 | ov_word lex_auto_show_nonbonded; |
---|
213 | ov_word lex_cache_display; |
---|
214 | ov_word lex_mesh_radius; |
---|
215 | ov_word lex_backface_cull; |
---|
216 | ov_word lex_gamma; |
---|
217 | ov_word lex_dot_width; |
---|
218 | ov_word lex_auto_show_selections; |
---|
219 | ov_word lex_auto_hide_selections; |
---|
220 | ov_word lex_selection_width; |
---|
221 | ov_word lex_selection_overlay; |
---|
222 | ov_word lex_static_singletons; |
---|
223 | ov_word lex_max_triangles; |
---|
224 | ov_word lex_depth_cue; |
---|
225 | ov_word lex_specular; |
---|
226 | ov_word lex_shininess; |
---|
227 | ov_word lex_sphere_quality; |
---|
228 | ov_word lex_fog; |
---|
229 | ov_word lex_isomesh_auto_state; |
---|
230 | ov_word lex_mesh_width; |
---|
231 | ov_word lex_cartoon_sampling; |
---|
232 | ov_word lex_cartoon_loop_radius; |
---|
233 | ov_word lex_cartoon_loop_quality; |
---|
234 | ov_word lex_cartoon_power; |
---|
235 | ov_word lex_cartoon_power_b; |
---|
236 | ov_word lex_cartoon_rect_length; |
---|
237 | ov_word lex_cartoon_rect_width; |
---|
238 | ov_word lex_internal_gui_width; |
---|
239 | ov_word lex_internal_gui; |
---|
240 | ov_word lex_cartoon_oval_length; |
---|
241 | ov_word lex_cartoon_oval_width; |
---|
242 | ov_word lex_cartoon_oval_quality; |
---|
243 | ov_word lex_cartoon_tube_radius; |
---|
244 | ov_word lex_cartoon_tube_quality; |
---|
245 | ov_word lex_cartoon_debug; |
---|
246 | ov_word lex_ribbon_width; |
---|
247 | ov_word lex_dash_width; |
---|
248 | ov_word lex_dash_radius; |
---|
249 | ov_word lex_cgo_ray_width_scale; |
---|
250 | ov_word lex_line_radius; |
---|
251 | ov_word lex_cartoon_round_helices; |
---|
252 | ov_word lex_cartoon_refine_normals; |
---|
253 | ov_word lex_cartoon_flat_sheets; |
---|
254 | ov_word lex_cartoon_smooth_loops; |
---|
255 | ov_word lex_cartoon_dumbbell_length; |
---|
256 | ov_word lex_cartoon_dumbbell_width; |
---|
257 | ov_word lex_cartoon_dumbbell_radius; |
---|
258 | ov_word lex_cartoon_fancy_helices; |
---|
259 | ov_word lex_cartoon_fancy_sheets; |
---|
260 | ov_word lex_ignore_pdb_segi; |
---|
261 | ov_word lex_ribbon_throw; |
---|
262 | ov_word lex_cartoon_throw; |
---|
263 | ov_word lex_cartoon_refine; |
---|
264 | ov_word lex_cartoon_refine_tips; |
---|
265 | ov_word lex_cartoon_discrete_colors; |
---|
266 | ov_word lex_normalize_ccp4_maps; |
---|
267 | ov_word lex_surface_poor; |
---|
268 | ov_word lex_internal_feedback; |
---|
269 | ov_word lex_cgo_line_width; |
---|
270 | ov_word lex_cgo_line_radius; |
---|
271 | ov_word lex_logging; |
---|
272 | ov_word lex_robust_logs; |
---|
273 | ov_word lex_log_box_selections; |
---|
274 | ov_word lex_log_conformations; |
---|
275 | ov_word lex_valence_size; |
---|
276 | ov_word lex_surface_miserable; |
---|
277 | ov_word lex_ray_opaque_background; |
---|
278 | ov_word lex_transparency; |
---|
279 | ov_word lex_ray_texture; |
---|
280 | ov_word lex_ray_texture_settings; |
---|
281 | ov_word lex_suspend_updates; |
---|
282 | ov_word lex_full_screen; |
---|
283 | ov_word lex_surface_mode; |
---|
284 | ov_word lex_surface_color; |
---|
285 | ov_word lex_mesh_mode; |
---|
286 | ov_word lex_mesh_color; |
---|
287 | ov_word lex_auto_indicate_flags; |
---|
288 | ov_word lex_surface_debug; |
---|
289 | ov_word lex_ray_improve_shadows; |
---|
290 | ov_word lex_smooth_color_triangle; |
---|
291 | ov_word lex_ray_default_renderer; |
---|
292 | ov_word lex_field_of_view; |
---|
293 | ov_word lex_reflect_power; |
---|
294 | ov_word lex_preserve_chempy_ids; |
---|
295 | ov_word lex_sphere_scale; |
---|
296 | ov_word lex_two_sided_lighting; |
---|
297 | ov_word lex_secondary_structure; |
---|
298 | ov_word lex_auto_remove_hydrogens; |
---|
299 | ov_word lex_raise_exceptions; |
---|
300 | ov_word lex_stop_on_exceptions; |
---|
301 | ov_word lex_sculpting; |
---|
302 | ov_word lex_auto_sculpt; |
---|
303 | ov_word lex_sculpt_vdw_scale; |
---|
304 | ov_word lex_sculpt_vdw_scale14; |
---|
305 | ov_word lex_sculpt_vdw_weight; |
---|
306 | ov_word lex_sculpt_vdw_weight14; |
---|
307 | ov_word lex_sculpt_bond_weight; |
---|
308 | ov_word lex_sculpt_angl_weight; |
---|
309 | ov_word lex_sculpt_pyra_weight; |
---|
310 | ov_word lex_sculpt_plan_weight; |
---|
311 | ov_word lex_sculpting_cycles; |
---|
312 | ov_word lex_sphere_transparency; |
---|
313 | ov_word lex_sphere_color; |
---|
314 | ov_word lex_sculpt_field_mask; |
---|
315 | ov_word lex_sculpt_hb_overlap; |
---|
316 | ov_word lex_sculpt_hb_overlap_base; |
---|
317 | ov_word lex_legacy_vdw_radii; |
---|
318 | ov_word lex_sculpt_memory; |
---|
319 | ov_word lex_connect_mode; |
---|
320 | ov_word lex_cartoon_cylindrical_helices; |
---|
321 | ov_word lex_cartoon_helix_radius; |
---|
322 | ov_word lex_connect_cutoff; |
---|
323 | ov_word lex_save_pdb_ss; |
---|
324 | ov_word lex_sculpt_line_weight; |
---|
325 | ov_word lex_fit_iterations; |
---|
326 | ov_word lex_fit_tolerance; |
---|
327 | ov_word lex_batch_prefix; |
---|
328 | ov_word lex_stereo_mode; |
---|
329 | ov_word lex_cgo_sphere_quality; |
---|
330 | ov_word lex_pdb_literal_names; |
---|
331 | ov_word lex_wrap_output; |
---|
332 | ov_word lex_fog_start; |
---|
333 | ov_word lex_state; |
---|
334 | ov_word lex_frame; |
---|
335 | ov_word lex_ray_shadows; |
---|
336 | ov_word lex_ribbon_trace_atoms; |
---|
337 | ov_word lex_security; |
---|
338 | ov_word lex_stick_transparency; |
---|
339 | ov_word lex_ray_transparency_shadows; |
---|
340 | ov_word lex_session_version_check; |
---|
341 | ov_word lex_ray_transparency_specular; |
---|
342 | ov_word lex_stereo_double_pump_mono; |
---|
343 | ov_word lex_sphere_solvent; |
---|
344 | ov_word lex_mesh_quality; |
---|
345 | ov_word lex_mesh_solvent; |
---|
346 | ov_word lex_dot_solvent; |
---|
347 | ov_word lex_ray_shadow_fudge; |
---|
348 | ov_word lex_ray_triangle_fudge; |
---|
349 | ov_word lex_debug_pick; |
---|
350 | ov_word lex_dot_color; |
---|
351 | ov_word lex_mouse_limit; |
---|
352 | ov_word lex_mouse_scale; |
---|
353 | ov_word lex_transparency_mode; |
---|
354 | ov_word lex_clamp_colors; |
---|
355 | ov_word lex_pymol_space_max_red; |
---|
356 | ov_word lex_pymol_space_max_green; |
---|
357 | ov_word lex_pymol_space_max_blue; |
---|
358 | ov_word lex_pymol_space_min_factor; |
---|
359 | ov_word lex_roving_origin; |
---|
360 | ov_word lex_roving_lines; |
---|
361 | ov_word lex_roving_sticks; |
---|
362 | ov_word lex_roving_spheres; |
---|
363 | ov_word lex_roving_labels; |
---|
364 | ov_word lex_roving_delay; |
---|
365 | ov_word lex_roving_selection; |
---|
366 | ov_word lex_roving_byres; |
---|
367 | ov_word lex_roving_ribbon; |
---|
368 | ov_word lex_roving_cartoon; |
---|
369 | ov_word lex_roving_polar_contacts; |
---|
370 | ov_word lex_roving_polar_cutoff; |
---|
371 | ov_word lex_roving_nonbonded; |
---|
372 | ov_word lex_float_labels; |
---|
373 | ov_word lex_roving_detail; |
---|
374 | ov_word lex_roving_nb_spheres; |
---|
375 | ov_word lex_ribbon_color; |
---|
376 | ov_word lex_cartoon_color; |
---|
377 | ov_word lex_ribbon_smooth; |
---|
378 | ov_word lex_auto_color; |
---|
379 | ov_word lex_auto_color_next; |
---|
380 | ov_word lex_ray_interior_color; |
---|
381 | ov_word lex_cartoon_highlight_color; |
---|
382 | ov_word lex_coulomb_units_factor; |
---|
383 | ov_word lex_coulomb_dielectric; |
---|
384 | ov_word lex_ray_interior_shadows; |
---|
385 | ov_word lex_ray_interior_texture; |
---|
386 | |
---|
387 | ov_word lex_roving_map1_name; |
---|
388 | ov_word lex_roving_map2_name; |
---|
389 | ov_word lex_roving_map3_name; |
---|
390 | |
---|
391 | ov_word lex_roving_map1_level; |
---|
392 | ov_word lex_roving_map2_level; |
---|
393 | ov_word lex_roving_map3_level; |
---|
394 | |
---|
395 | ov_word lex_roving_isomesh; |
---|
396 | ov_word lex_roving_isosurface; |
---|
397 | ov_word lex_scenes_changed; |
---|
398 | |
---|
399 | ov_word lex_gaussian_b_adjust; |
---|
400 | ov_word lex_pdb_standard_order; |
---|
401 | |
---|
402 | ov_word lex_cartoon_smooth_first; |
---|
403 | ov_word lex_cartoon_smooth_last; |
---|
404 | ov_word lex_cartoon_smooth_cycles; |
---|
405 | ov_word lex_cartoon_flat_cycles; |
---|
406 | |
---|
407 | ov_word lex_max_threads; |
---|
408 | ov_word lex_show_progress; |
---|
409 | ov_word lex_use_display_lists; |
---|
410 | ov_word lex_cache_memory; |
---|
411 | ov_word lex_simplify_display_lists; |
---|
412 | ov_word lex_retain_order; |
---|
413 | ov_word lex_pdb_hetatm_sort; |
---|
414 | ov_word lex_pdb_use_ter_records; |
---|
415 | ov_word lex_cartoon_trace_atoms; |
---|
416 | ov_word lex_ray_oversample_cutoff; |
---|
417 | ov_word lex_gaussian_resolution; |
---|
418 | ov_word lex_gaussian_b_floor; |
---|
419 | ov_word lex_sculpt_nb_interval; |
---|
420 | ov_word lex_sculpt_tors_weight; |
---|
421 | ov_word lex_sculpt_tors_tolerance; |
---|
422 | ov_word lex_stick_ball; |
---|
423 | ov_word lex_stick_ball_ratio; |
---|
424 | ov_word lex_stick_fixed_radius; |
---|
425 | ov_word lex_cartoon_transparency; |
---|
426 | ov_word lex_dash_round_ends; |
---|
427 | ov_word lex_h_bond_max_angle; |
---|
428 | ov_word lex_h_bond_cutoff_center; |
---|
429 | ov_word lex_h_bond_cutoff_edge; |
---|
430 | ov_word lex_h_bond_power_a; |
---|
431 | ov_word lex_h_bond_power_b; |
---|
432 | ov_word lex_h_bond_cone; |
---|
433 | |
---|
434 | ov_word lex_ss_helix_psi_target; |
---|
435 | ov_word lex_ss_helix_psi_include; |
---|
436 | ov_word lex_ss_helix_psi_exclude; |
---|
437 | |
---|
438 | ov_word lex_ss_helix_phi_target; |
---|
439 | ov_word lex_ss_helix_phi_include; |
---|
440 | ov_word lex_ss_helix_phi_exclude; |
---|
441 | |
---|
442 | ov_word lex_ss_strand_psi_target; |
---|
443 | ov_word lex_ss_strand_psi_include; |
---|
444 | ov_word lex_ss_strand_psi_exclude; |
---|
445 | |
---|
446 | ov_word lex_ss_strand_phi_target; |
---|
447 | ov_word lex_ss_strand_phi_include; |
---|
448 | ov_word lex_ss_strand_phi_exclude; |
---|
449 | ov_word lex_movie_loop; |
---|
450 | |
---|
451 | ov_word lex_pdb_retain_ids; |
---|
452 | ov_word lex_pdb_no_end_record; |
---|
453 | ov_word lex_cgo_dot_width; |
---|
454 | ov_word lex_cgo_dot_radius; |
---|
455 | ov_word lex_defer_updates; |
---|
456 | ov_word lex_normalize_o_maps; |
---|
457 | ov_word lex_swap_dsn6_bytes; |
---|
458 | ov_word lex_pdb_insertions_go_first; |
---|
459 | ov_word lex_roving_origin_z; |
---|
460 | ov_word lex_roving_origin_z_cushion; |
---|
461 | ov_word lex_specular_intensity; |
---|
462 | ov_word lex_overlay_lines; |
---|
463 | ov_word lex_ray_transparency_spec_cut; |
---|
464 | ov_word lex_internal_prompt; |
---|
465 | ov_word lex_normalize_grd_maps; |
---|
466 | ov_word lex_ray_blend_colors; |
---|
467 | ov_word lex_ray_blend_red; |
---|
468 | ov_word lex_ray_blend_green; |
---|
469 | ov_word lex_ray_blend_blue; |
---|
470 | ov_word lex_png_screen_gamma; |
---|
471 | ov_word lex_png_file_gamma; |
---|
472 | ov_word lex_editor_label_fragments; |
---|
473 | ov_word lex_internal_gui_control_size; |
---|
474 | ov_word lex_auto_dss; |
---|
475 | ov_word lex_transparency_picking_mode; |
---|
476 | ov_word lex_virtual_trackball; |
---|
477 | ov_word lex_pdb_reformat_names_mode; |
---|
478 | ov_word lex_ray_pixel_scale; |
---|
479 | ov_word lex_label_font_id; |
---|
480 | ov_word lex_pdb_conect_all; |
---|
481 | ov_word lex_button_mode_name; |
---|
482 | ov_word lex_surface_type; |
---|
483 | ov_word lex_dot_normals; |
---|
484 | ov_word lex_session_migration; |
---|
485 | ov_word lex_mesh_normals; |
---|
486 | ov_word lex_mesh_type; |
---|
487 | ov_word lex_dot_lighting; |
---|
488 | ov_word lex_mesh_lighting; |
---|
489 | ov_word lex_surface_solvent; |
---|
490 | ov_word lex_triangle_max_passes; |
---|
491 | ov_word lex_ray_interior_reflect; |
---|
492 | ov_word lex_internal_gui_mode; |
---|
493 | ov_word lex_surface_carve_selection; |
---|
494 | ov_word lex_surface_carve_state; |
---|
495 | ov_word lex_surface_carve_cutoff; |
---|
496 | ov_word lex_surface_clear_selection; |
---|
497 | ov_word lex_surface_clear_state; |
---|
498 | ov_word lex_surface_clear_cutoff; |
---|
499 | ov_word lex_surface_trim_cutoff; |
---|
500 | ov_word lex_surface_trim_factor; |
---|
501 | ov_word lex_ray_max_passes; |
---|
502 | ov_word lex_active_selections; |
---|
503 | ov_word lex_ray_transparency_contrast; |
---|
504 | ov_word lex_seq_view; |
---|
505 | ov_word lex_mouse_selection_mode; |
---|
506 | ov_word lex_seq_view_label_spacing; |
---|
507 | ov_word lex_seq_view_label_start; |
---|
508 | ov_word lex_seq_view_format; |
---|
509 | ov_word lex_seq_view_location; |
---|
510 | ov_word lex_seq_view_overlay; |
---|
511 | ov_word lex_auto_classify_atoms; |
---|
512 | ov_word lex_cartoon_nucleic_acid_mode; |
---|
513 | ov_word lex_seq_view_color; |
---|
514 | ov_word lex_seq_view_label_mode; |
---|
515 | ov_word lex_surface_ramp_above_mode; |
---|
516 | ov_word lex_stereo; |
---|
517 | ov_word lex_wizard_prompt_mode; |
---|
518 | ov_word lex_coulomb_cutoff; |
---|
519 | ov_word lex_slice_track_camera; |
---|
520 | ov_word lex_slice_height_scale; |
---|
521 | ov_word lex_slice_height_map; |
---|
522 | ov_word lex_slice_grid; |
---|
523 | ov_word lex_slice_dynamic_grid; |
---|
524 | ov_word lex_slice_dynamic_grid_resolution; |
---|
525 | ov_word lex_pdb_insure_orthogonal; |
---|
526 | ov_word lex_ray_direct_shade; |
---|
527 | ov_word lex_stick_color; |
---|
528 | ov_word lex_cartoon_putty_radius; |
---|
529 | ov_word lex_cartoon_putty_quality; |
---|
530 | ov_word lex_cartoon_putty_scale_min; |
---|
531 | ov_word lex_cartoon_putty_scale_max; |
---|
532 | ov_word lex_cartoon_putty_scale_power; |
---|
533 | ov_word lex_cartoon_putty_range; |
---|
534 | ov_word lex_cartoon_side_chain_helper; |
---|
535 | ov_word lex_surface_optimize_subsets; |
---|
536 | ov_word lex_multiplex; |
---|
537 | ov_word lex_texture_fonts; |
---|
538 | ov_word lex_pqr_workarounds; |
---|
539 | ov_word lex_animation; |
---|
540 | ov_word lex_animation_duration; |
---|
541 | ov_word lex_scene_animation; |
---|
542 | ov_word lex_line_stick_helper; |
---|
543 | ov_word lex_ray_orthoscopic; |
---|
544 | ov_word lex_ribbon_side_chain_helper; |
---|
545 | ov_word lex_selection_width_max; |
---|
546 | ov_word lex_selection_width_scale; |
---|
547 | ov_word lex_scene_current_name; |
---|
548 | ov_word lex_presentation; |
---|
549 | ov_word lex_presentation_mode; |
---|
550 | ov_word lex_pdb_truncate_residue_name; |
---|
551 | ov_word lex_scene_loop; |
---|
552 | ov_word lex_sweep_mode; |
---|
553 | ov_word lex_sweep_phase; |
---|
554 | ov_word lex_scene_restart_movie_delay; |
---|
555 | ov_word lex_mouse_restart_movie_delay; |
---|
556 | ov_word lex_angle_size; |
---|
557 | ov_word lex_angle_label_position; |
---|
558 | ov_word lex_dihedral_size; |
---|
559 | ov_word lex_dihedral_label_position; |
---|
560 | ov_word lex_defer_builds_mode; |
---|
561 | ov_word lex_seq_view_discrete_by_state; |
---|
562 | ov_word lex_scene_animation_duration; |
---|
563 | ov_word lex_wildcard; |
---|
564 | ov_word lex_atom_name_wildcard; |
---|
565 | ov_word lex_ignore_case; |
---|
566 | ov_word lex_presentation_auto_quit; |
---|
567 | ov_word lex_editor_auto_dihedral; |
---|
568 | ov_word lex_presentation_auto_start; |
---|
569 | ov_word lex_validate_object_names; |
---|
570 | /* ov_word lex_ray_pixel_scale_limit;*/ |
---|
571 | ov_word lex_auto_show_spheres; |
---|
572 | ov_word lex_sphere_mode; |
---|
573 | ov_word lex_sphere_point_max_size; |
---|
574 | ov_word lex_sphere_point_size; |
---|
575 | ov_word lex_pdb_honor_model_number; |
---|
576 | ov_word lex_rank_assisted_sorts; |
---|
577 | ov_word lex_ribbon_nucleic_acid_mode; |
---|
578 | ov_word lex_cartoon_ring_mode; |
---|
579 | ov_word lex_cartoon_ring_width; |
---|
580 | ov_word lex_cartoon_ring_color; |
---|
581 | ov_word lex_cartoon_ring_finder; |
---|
582 | ov_word lex_cartoon_tube_cap; |
---|
583 | ov_word lex_cartoon_loop_cap; |
---|
584 | ov_word lex_nvidia_bugs; |
---|
585 | ov_word lex_image_dots_per_inch; |
---|
586 | ov_word lex_opaque_background; |
---|
587 | ov_word lex_draw_frames; |
---|
588 | ov_word lex_show_alpha_checker; |
---|
589 | ov_word lex_matrix_mode; |
---|
590 | ov_word lex_editor_auto_origin; |
---|
591 | ov_word lex_session_file; |
---|
592 | ov_word lex_cgo_transparency; |
---|
593 | ov_word lex_legacy_mouse_zoom; |
---|
594 | ov_word lex_auto_number_selections; |
---|
595 | ov_word lex_sculpt_vdw_vis_mode; |
---|
596 | ov_word lex_sculpt_vdw_vis_min; |
---|
597 | ov_word lex_sculpt_vdw_vis_mid; |
---|
598 | ov_word lex_sculpt_vdw_vis_max; |
---|
599 | ov_word lex_cartoon_ladder_mode; |
---|
600 | ov_word lex_cartoon_ladder_radius; |
---|
601 | ov_word lex_cartoon_ladder_color; |
---|
602 | ov_word lex_cartoon_nucleic_acid_color; |
---|
603 | ov_word lex_cartoon_ring_transparency; |
---|
604 | ov_word lex_label_size; |
---|
605 | ov_word lex_spec_direct; |
---|
606 | ov_word lex_light_count; |
---|
607 | ov_word lex_light2; |
---|
608 | ov_word lex_light3; |
---|
609 | ov_word lex_hide_underscore_names; |
---|
610 | ov_word lex_selection_round_points; |
---|
611 | ov_word lex_distance_exclusion; |
---|
612 | ov_word lex_h_bond_exclusion; |
---|
613 | ov_word lex_label_shadow_mode; |
---|
614 | ov_word lex_light4; |
---|
615 | ov_word lex_light5; |
---|
616 | ov_word lex_light6; |
---|
617 | ov_word lex_light7; |
---|
618 | ov_word lex_label_outline_color; |
---|
619 | ov_word lex_ray_trace_mode; |
---|
620 | ov_word lex_ray_trace_gain; |
---|
621 | ov_word lex_selection_visible_only; |
---|
622 | ov_word lex_label_position; |
---|
623 | ov_word lex_ray_trace_depth_factor; |
---|
624 | ov_word lex_ray_trace_slope_factor; |
---|
625 | ov_word lex_ray_trace_disco_factor; |
---|
626 | ov_word lex_ray_shadow_decay_factor; |
---|
627 | ov_word lex_ray_interior_mode; |
---|
628 | ov_word lex_ray_legacy_lighting; |
---|
629 | ov_word lex_sculpt_auto_center; |
---|
630 | ov_word lex_pdb_discrete_chains; |
---|
631 | ov_word lex_pdb_unbond_cations; |
---|
632 | ov_word lex_sculpt_tri_scale; |
---|
633 | ov_word lex_sculpt_tri_weight; |
---|
634 | ov_word lex_sculpt_tri_min; |
---|
635 | ov_word lex_sculpt_tri_max; |
---|
636 | ov_word lex_sculpt_tri_mode; |
---|
637 | ov_word lex_pdb_echo_tags; |
---|
638 | ov_word lex_connect_bonded; |
---|
639 | ov_word lex_spec_direct_power; |
---|
640 | ov_word lex_light8; |
---|
641 | ov_word lex_light9; |
---|
642 | ov_word lex_ray_shadow_decay_range; |
---|
643 | ov_word lex_spec_count; |
---|
644 | ov_word lex_sculpt_min_scale; |
---|
645 | ov_word lex_sculpt_min_weight; |
---|
646 | ov_word lex_sculpt_min_min; |
---|
647 | ov_word lex_sculpt_min_max; |
---|
648 | ov_word lex_sculpt_max_scale; |
---|
649 | ov_word lex_sculpt_max_weight; |
---|
650 | ov_word lex_sculpt_max_min; |
---|
651 | ov_word lex_sculpt_max_max; |
---|
652 | ov_word lex_surface_circumscribe; |
---|
653 | ov_word lex_sculpt_avd_weight; |
---|
654 | ov_word lex_sculpt_avd_gap; |
---|
655 | ov_word lex_sculpt_avd_range; |
---|
656 | ov_word lex_sculpt_avd_excl; |
---|
657 | ov_word lex_async_builds; |
---|
658 | ov_word lex_fetch_path; |
---|
659 | ov_word lex_cartoon_ring_radius; |
---|
660 | ov_word lex_ray_color_ramps; |
---|
661 | ov_word lex_ray_hint_camera; |
---|
662 | ov_word lex_ray_hint_shadow; |
---|
663 | ov_word lex_stick_valence_scale; |
---|
664 | ov_word lex_seq_view_alignment; |
---|
665 | ov_word lex_seq_view_unaligned_mode; |
---|
666 | ov_word lex_seq_view_unaligned_color; |
---|
667 | ov_word lex_seq_view_fill_char; |
---|
668 | ov_word lex_seq_view_fill_color; |
---|
669 | ov_word lex_seq_view_label_color; |
---|
670 | ov_word lex_surface_carve_normal_cutoff; |
---|
671 | ov_word lex_trace_atoms_mode; |
---|
672 | ov_word lex_session_changed; |
---|
673 | ov_word lex_ray_clip_shadows; |
---|
674 | ov_word lex_mouse_wheel_scale; |
---|
675 | ov_word lex_nonbonded_transparency; |
---|
676 | ov_word lex_ray_spec_local; |
---|
677 | ov_word lex_line_color; |
---|
678 | ov_word lex_ray_label_specular; |
---|
679 | ov_word lex_mesh_skip; |
---|
680 | ov_word lex_label_digits; |
---|
681 | ov_word lex_label_distance_digits; |
---|
682 | ov_word lex_label_angle_digits; |
---|
683 | ov_word lex_label_dihedral_digits; |
---|
684 | ov_word lex_surface_negative_visible; |
---|
685 | ov_word lex_surface_negative_color; |
---|
686 | ov_word lex_mesh_negative_visible; |
---|
687 | ov_word lex_mesh_negative_color; |
---|
688 | ov_word lex_auto_group; |
---|
689 | ov_word lex_group_auto_mode; |
---|
690 | ov_word lex_group_full_member_names; |
---|
691 | ov_word lex_gradient_max_length; |
---|
692 | ov_word lex_gradient_min_length; |
---|
693 | ov_word lex_gradient_min_slope; |
---|
694 | ov_word lex_gradient_normal_min_dot; |
---|
695 | ov_word lex_gradient_step_size; |
---|
696 | ov_word lex_gradient_spacing; |
---|
697 | ov_word lex_gradient_symmetry; |
---|
698 | ov_word lex_ray_trace_color; |
---|
699 | ov_word lex_group_arrow_prefix; |
---|
700 | ov_word lex_suppress_hidden; |
---|
701 | ov_word lex_session_compression; |
---|
702 | ov_word lex_movie_fps; |
---|
703 | ov_word lex_ray_transparency_oblique; |
---|
704 | ov_word lex_ray_trace_trans_cutoff; |
---|
705 | ov_word lex_ray_trace_persist_cutoff; |
---|
706 | ov_word lex_ray_transparency_oblique_power; |
---|
707 | ov_word lex_ray_scatter; |
---|
708 | ov_word lex_h_bond_from_proton; |
---|
709 | } _CPyMOL; |
---|
710 | |
---|
711 | /* convenience functions -- inline */ |
---|
712 | |
---|
713 | #ifdef _PYMOL_INLINE |
---|
714 | #define CC_INLINE __inline__ |
---|
715 | #else |
---|
716 | #define CC_INLINE |
---|
717 | #endif |
---|
718 | |
---|
719 | CC_INLINE static PyMOLstatus get_status_ok(int ok) |
---|
720 | { |
---|
721 | if(ok) |
---|
722 | return PyMOLstatus_SUCCESS; |
---|
723 | else |
---|
724 | return PyMOLstatus_FAILURE; |
---|
725 | } |
---|
726 | |
---|
727 | CC_INLINE static PyMOLreturn_status return_status_ok(int ok) |
---|
728 | { |
---|
729 | PyMOLreturn_status result; |
---|
730 | result.status = get_status_ok(ok); |
---|
731 | return result; |
---|
732 | } |
---|
733 | |
---|
734 | CC_INLINE static PyMOLreturn_status return_status(int status) |
---|
735 | { |
---|
736 | PyMOLreturn_status result; |
---|
737 | result.status = status; |
---|
738 | return result; |
---|
739 | } |
---|
740 | |
---|
741 | static OVstatus PyMOL_InitAPI(CPyMOL *I) |
---|
742 | { |
---|
743 | OVContext *C = I->G->Context; |
---|
744 | OVreturn_word result; |
---|
745 | I->Lex = OVLexicon_New(C->heap); |
---|
746 | if(!I->Lex) |
---|
747 | return_OVstatus_FAILURE; |
---|
748 | |
---|
749 | /* the following preprocessor macros may require GNU's cpp or VC++ |
---|
750 | we'll see... */ |
---|
751 | |
---|
752 | #define LEX(ARG) \ |
---|
753 | if(!OVreturn_IS_OK( (result= OVLexicon_GetFromCString(I->Lex,#ARG)))) \ |
---|
754 | return_OVstatus_FAILURE \ |
---|
755 | else \ |
---|
756 | I -> lex_ ## ARG = result.word; |
---|
757 | |
---|
758 | LEX(pdb); |
---|
759 | LEX(sdf); |
---|
760 | LEX(mol); |
---|
761 | LEX(mol2); |
---|
762 | LEX(xplor); |
---|
763 | LEX(ccp4); |
---|
764 | |
---|
765 | LEX(string); |
---|
766 | LEX(filename); |
---|
767 | LEX(raw); |
---|
768 | |
---|
769 | /* string constants that are accepted on input */ |
---|
770 | |
---|
771 | #define LEX_REP(NAME,CODE) LEX(NAME) \ |
---|
772 | if(!OVreturn_IS_OK( OVOneToOne_Set(I->Rep,I->lex_ ## NAME, CODE))) \ |
---|
773 | return_OVstatus_FAILURE; |
---|
774 | |
---|
775 | I->Rep = OVOneToOne_New(C->heap); |
---|
776 | if(!I->Rep) |
---|
777 | return_OVstatus_FAILURE; |
---|
778 | |
---|
779 | LEX_REP(everything,-1); |
---|
780 | LEX_REP(sticks,0); |
---|
781 | LEX_REP(spheres,1); |
---|
782 | LEX_REP(surface,2); |
---|
783 | LEX_REP(labels,3); |
---|
784 | LEX_REP(nb_spheres,4); |
---|
785 | LEX_REP(cartoon,5); |
---|
786 | LEX_REP(ribbon,6); |
---|
787 | LEX_REP(lines,7); |
---|
788 | LEX_REP(mesh,8); |
---|
789 | LEX_REP(dots,9); |
---|
790 | LEX_REP(dashes,10); |
---|
791 | LEX_REP(nonbonded,11); |
---|
792 | LEX_REP(cell,12); |
---|
793 | LEX_REP(cgo,13); |
---|
794 | LEX_REP(callback,14); |
---|
795 | LEX_REP(extent,15); |
---|
796 | LEX_REP(slice,16); |
---|
797 | |
---|
798 | /* workaround for unexplained bug with nested macro on VC6 */ |
---|
799 | |
---|
800 | #define LEX_CLIP(NAME,CODE) {if(!OVreturn_IS_OK( (result= OVLexicon_GetFromCString(I->Lex,#NAME)))) \ |
---|
801 | return_OVstatus_FAILURE \ |
---|
802 | else \ |
---|
803 | I -> lex_ ## NAME = result.word;} \ |
---|
804 | if(!OVreturn_IS_OK( OVOneToOne_Set(I->Clip,I->lex_ ## NAME, CODE))) \ |
---|
805 | return_OVstatus_FAILURE; |
---|
806 | |
---|
807 | I->Clip = OVOneToOne_New(C->heap); |
---|
808 | if(!I->Clip) |
---|
809 | return_OVstatus_FAILURE; |
---|
810 | |
---|
811 | LEX_CLIP(near,0); |
---|
812 | LEX_CLIP(far,1); |
---|
813 | LEX_CLIP(move,2); |
---|
814 | LEX_CLIP(slab,3); |
---|
815 | LEX_CLIP(atoms,4); |
---|
816 | |
---|
817 | #define LEX_REINIT(NAME,CODE) {if(!OVreturn_IS_OK( (result= OVLexicon_GetFromCString(I->Lex,#NAME)))) \ |
---|
818 | return_OVstatus_FAILURE \ |
---|
819 | else \ |
---|
820 | I -> lex_ ## NAME = result.word;} \ |
---|
821 | if(!OVreturn_IS_OK( OVOneToOne_Set(I->Reinit,I->lex_ ## NAME, CODE))) \ |
---|
822 | return_OVstatus_FAILURE; |
---|
823 | |
---|
824 | I->Reinit = OVOneToOne_New(C->heap); |
---|
825 | if(!I->Reinit) |
---|
826 | return_OVstatus_FAILURE; |
---|
827 | |
---|
828 | if(!OVreturn_IS_OK( OVOneToOne_Set(I->Reinit,I->lex_everything, 0))) return_OVstatus_FAILURE; |
---|
829 | LEX_REINIT(settings,1); |
---|
830 | |
---|
831 | #define LEX_SELLIST(NAME,CODE) {if(!OVreturn_IS_OK( (result= OVLexicon_GetFromCString(I->Lex,#NAME)))) \ |
---|
832 | return_OVstatus_FAILURE \ |
---|
833 | else \ |
---|
834 | I -> lex_ ## NAME = result.word;} \ |
---|
835 | if(!OVreturn_IS_OK( OVOneToOne_Set(I->SelectList,I->lex_ ## NAME, CODE))) \ |
---|
836 | return_OVstatus_FAILURE; |
---|
837 | |
---|
838 | I->SelectList = OVOneToOne_New(C->heap); |
---|
839 | if(!I->SelectList) |
---|
840 | return_OVstatus_FAILURE; |
---|
841 | |
---|
842 | LEX_SELLIST(index,0); |
---|
843 | LEX_SELLIST(id,1); |
---|
844 | LEX_SELLIST(rank,2); |
---|
845 | |
---|
846 | I->Setting = OVOneToOne_New(C->heap); |
---|
847 | if(!I->Setting) |
---|
848 | return_OVstatus_FAILURE; |
---|
849 | |
---|
850 | #define LEX_SETTING(NAME,CODE) LEX(NAME) \ |
---|
851 | if(!OVreturn_IS_OK( OVOneToOne_Set(I->Setting,I->lex_ ## NAME, CODE))) \ |
---|
852 | return_OVstatus_FAILURE; |
---|
853 | |
---|
854 | LEX_SETTING(bonding_vdw_cutoff, 0); |
---|
855 | LEX_SETTING(min_mesh_spacing, 1); |
---|
856 | LEX_SETTING(dot_density, 2); |
---|
857 | LEX_SETTING(dot_mode, 3); |
---|
858 | LEX_SETTING(solvent_radius, 4); |
---|
859 | LEX_SETTING(sel_counter, 5); |
---|
860 | LEX_SETTING(bg_rgb, 6); |
---|
861 | LEX_SETTING(ambient, 7); |
---|
862 | LEX_SETTING(direct, 8); |
---|
863 | LEX_SETTING(reflect, 9); |
---|
864 | LEX_SETTING(light, 10); |
---|
865 | LEX_SETTING(power, 11); |
---|
866 | LEX_SETTING(antialias, 12); |
---|
867 | LEX_SETTING(cavity_cull, 13); |
---|
868 | LEX_SETTING(gl_ambient, 14); |
---|
869 | LEX_SETTING(single_image, 15); |
---|
870 | LEX_SETTING(movie_delay, 16); |
---|
871 | LEX_SETTING(ribbon_power, 17); |
---|
872 | LEX_SETTING(ribbon_power_b, 18); |
---|
873 | LEX_SETTING(ribbon_sampling, 19); |
---|
874 | LEX_SETTING(ribbon_radius, 20); |
---|
875 | LEX_SETTING(stick_radius, 21); |
---|
876 | LEX_SETTING(hash_max, 22); |
---|
877 | LEX_SETTING(ortho, 23); |
---|
878 | LEX_SETTING(spec_reflect, 24); |
---|
879 | LEX_SETTING(spec_power, 25); |
---|
880 | LEX_SETTING(sweep_angle, 26); |
---|
881 | LEX_SETTING(sweep_speed, 27); |
---|
882 | LEX_SETTING(dot_hydrogens, 28); |
---|
883 | LEX_SETTING(dot_radius, 29); |
---|
884 | LEX_SETTING(ray_trace_frames, 30); |
---|
885 | LEX_SETTING(cache_frames, 31); |
---|
886 | LEX_SETTING(trim_dots, 32); |
---|
887 | LEX_SETTING(cull_spheres, 33); |
---|
888 | LEX_SETTING(test1, 34); |
---|
889 | LEX_SETTING(test2, 35); |
---|
890 | LEX_SETTING(surface_best, 36); |
---|
891 | LEX_SETTING(surface_normal, 37); |
---|
892 | LEX_SETTING(surface_quality, 38); |
---|
893 | LEX_SETTING(surface_proximity, 39); |
---|
894 | LEX_SETTING(normal_workaround, 40); |
---|
895 | LEX_SETTING(stereo_angle, 41); |
---|
896 | LEX_SETTING(stereo_shift, 42); |
---|
897 | LEX_SETTING(line_smooth, 43); |
---|
898 | LEX_SETTING(line_width, 44); |
---|
899 | LEX_SETTING(half_bonds, 45); |
---|
900 | LEX_SETTING(stick_quality, 46); |
---|
901 | LEX_SETTING(stick_overlap, 47); |
---|
902 | LEX_SETTING(stick_nub, 48); |
---|
903 | LEX_SETTING(all_states, 49); |
---|
904 | LEX_SETTING(pickable, 50); |
---|
905 | LEX_SETTING(auto_show_lines, 51); |
---|
906 | LEX_SETTING(idle_delay, 52); |
---|
907 | LEX_SETTING(no_idle, 53); |
---|
908 | LEX_SETTING(fast_idle, 54); |
---|
909 | LEX_SETTING(slow_idle, 55); |
---|
910 | LEX_SETTING(rock_delay, 56); |
---|
911 | LEX_SETTING(dist_counter, 57); |
---|
912 | LEX_SETTING(dash_length, 58); |
---|
913 | LEX_SETTING(dash_gap, 59); |
---|
914 | LEX_SETTING(auto_zoom, 60); |
---|
915 | LEX_SETTING(overlay, 61); |
---|
916 | LEX_SETTING(text, 62); |
---|
917 | LEX_SETTING(button_mode, 63); |
---|
918 | LEX_SETTING(valence, 64); |
---|
919 | LEX_SETTING(nonbonded_size, 65); |
---|
920 | LEX_SETTING(label_color, 66); |
---|
921 | LEX_SETTING(ray_trace_fog, 67); |
---|
922 | LEX_SETTING(spheroid_scale, 68); |
---|
923 | LEX_SETTING(ray_trace_fog_start, 69); |
---|
924 | LEX_SETTING(spheroid_smooth, 70); |
---|
925 | LEX_SETTING(spheroid_fill, 71); |
---|
926 | LEX_SETTING(auto_show_nonbonded, 72); |
---|
927 | LEX_SETTING(cache_display, 73); |
---|
928 | LEX_SETTING(mesh_radius, 74); |
---|
929 | LEX_SETTING(backface_cull, 75); |
---|
930 | LEX_SETTING(gamma, 76); |
---|
931 | LEX_SETTING(dot_width, 77); |
---|
932 | LEX_SETTING(auto_show_selections, 78); |
---|
933 | LEX_SETTING(auto_hide_selections, 79); |
---|
934 | LEX_SETTING(selection_width, 80); |
---|
935 | LEX_SETTING(selection_overlay, 81); |
---|
936 | LEX_SETTING(static_singletons, 82); |
---|
937 | LEX_SETTING(max_triangles, 83); |
---|
938 | LEX_SETTING(depth_cue, 84); |
---|
939 | LEX_SETTING(specular, 85); |
---|
940 | LEX_SETTING(shininess, 86); |
---|
941 | LEX_SETTING(sphere_quality, 87); |
---|
942 | LEX_SETTING(fog, 88); |
---|
943 | LEX_SETTING(isomesh_auto_state, 89); |
---|
944 | LEX_SETTING(mesh_width, 90); |
---|
945 | LEX_SETTING(cartoon_sampling, 91); |
---|
946 | LEX_SETTING(cartoon_loop_radius, 92); |
---|
947 | LEX_SETTING(cartoon_loop_quality, 93); |
---|
948 | LEX_SETTING(cartoon_power, 94); |
---|
949 | LEX_SETTING(cartoon_power_b, 95); |
---|
950 | LEX_SETTING(cartoon_rect_length, 96); |
---|
951 | LEX_SETTING(cartoon_rect_width, 97); |
---|
952 | LEX_SETTING(internal_gui_width, 98); |
---|
953 | LEX_SETTING(internal_gui, 99); |
---|
954 | LEX_SETTING(cartoon_oval_length, 100); |
---|
955 | LEX_SETTING(cartoon_oval_width, 101); |
---|
956 | LEX_SETTING(cartoon_oval_quality, 102); |
---|
957 | LEX_SETTING(cartoon_tube_radius, 103); |
---|
958 | LEX_SETTING(cartoon_tube_quality, 104); |
---|
959 | LEX_SETTING(cartoon_debug, 105); |
---|
960 | LEX_SETTING(ribbon_width, 106); |
---|
961 | LEX_SETTING(dash_width, 107); |
---|
962 | LEX_SETTING(dash_radius, 108); |
---|
963 | LEX_SETTING(cgo_ray_width_scale, 109); |
---|
964 | LEX_SETTING(line_radius, 110); |
---|
965 | LEX_SETTING(cartoon_round_helices, 111); |
---|
966 | LEX_SETTING(cartoon_refine_normals, 112); |
---|
967 | LEX_SETTING(cartoon_flat_sheets, 113); |
---|
968 | LEX_SETTING(cartoon_smooth_loops, 114); |
---|
969 | LEX_SETTING(cartoon_dumbbell_length, 115); |
---|
970 | LEX_SETTING(cartoon_dumbbell_width, 116); |
---|
971 | LEX_SETTING(cartoon_dumbbell_radius, 117); |
---|
972 | LEX_SETTING(cartoon_fancy_helices, 118); |
---|
973 | LEX_SETTING(cartoon_fancy_sheets, 119); |
---|
974 | LEX_SETTING(ignore_pdb_segi, 120); |
---|
975 | LEX_SETTING(ribbon_throw, 121); |
---|
976 | LEX_SETTING(cartoon_throw, 122); |
---|
977 | LEX_SETTING(cartoon_refine, 123); |
---|
978 | LEX_SETTING(cartoon_refine_tips, 124); |
---|
979 | LEX_SETTING(cartoon_discrete_colors, 125); |
---|
980 | LEX_SETTING(normalize_ccp4_maps, 126); |
---|
981 | LEX_SETTING(surface_poor, 127); |
---|
982 | LEX_SETTING(internal_feedback, 128); |
---|
983 | LEX_SETTING(cgo_line_width, 129); |
---|
984 | LEX_SETTING(cgo_line_radius, 130); |
---|
985 | LEX_SETTING(logging, 131); |
---|
986 | LEX_SETTING(robust_logs, 132); |
---|
987 | LEX_SETTING(log_box_selections, 133); |
---|
988 | LEX_SETTING(log_conformations, 134); |
---|
989 | LEX_SETTING(valence_size, 135); |
---|
990 | LEX_SETTING(surface_miserable, 136); |
---|
991 | LEX_SETTING(ray_opaque_background, 137); |
---|
992 | LEX_SETTING(transparency, 138); |
---|
993 | LEX_SETTING(ray_texture, 139); |
---|
994 | LEX_SETTING(ray_texture_settings, 140); |
---|
995 | LEX_SETTING(suspend_updates, 141); |
---|
996 | LEX_SETTING(full_screen, 142); |
---|
997 | LEX_SETTING(surface_mode, 143); |
---|
998 | LEX_SETTING(surface_color, 144); |
---|
999 | LEX_SETTING(mesh_mode, 145); |
---|
1000 | LEX_SETTING(mesh_color, 146); |
---|
1001 | LEX_SETTING(auto_indicate_flags, 147); |
---|
1002 | LEX_SETTING(surface_debug, 148); |
---|
1003 | LEX_SETTING(ray_improve_shadows, 149); |
---|
1004 | LEX_SETTING(smooth_color_triangle, 150); |
---|
1005 | LEX_SETTING(ray_default_renderer, 151); |
---|
1006 | LEX_SETTING(field_of_view, 152); |
---|
1007 | LEX_SETTING(reflect_power, 153); |
---|
1008 | LEX_SETTING(preserve_chempy_ids, 154); |
---|
1009 | LEX_SETTING(sphere_scale, 155); |
---|
1010 | LEX_SETTING(two_sided_lighting, 156); |
---|
1011 | LEX_SETTING(secondary_structure, 157); |
---|
1012 | LEX_SETTING(auto_remove_hydrogens, 158); |
---|
1013 | LEX_SETTING(raise_exceptions, 159); |
---|
1014 | LEX_SETTING(stop_on_exceptions, 160); |
---|
1015 | LEX_SETTING(sculpting, 161); |
---|
1016 | LEX_SETTING(auto_sculpt, 162); |
---|
1017 | LEX_SETTING(sculpt_vdw_scale, 163); |
---|
1018 | LEX_SETTING(sculpt_vdw_scale14, 164); |
---|
1019 | LEX_SETTING(sculpt_vdw_weight, 165); |
---|
1020 | LEX_SETTING(sculpt_vdw_weight14, 166); |
---|
1021 | LEX_SETTING(sculpt_bond_weight, 167); |
---|
1022 | LEX_SETTING(sculpt_angl_weight, 168); |
---|
1023 | LEX_SETTING(sculpt_pyra_weight, 169); |
---|
1024 | LEX_SETTING(sculpt_plan_weight, 170); |
---|
1025 | LEX_SETTING(sculpting_cycles, 171); |
---|
1026 | LEX_SETTING(sphere_transparency, 172); |
---|
1027 | LEX_SETTING(sphere_color, 173); |
---|
1028 | LEX_SETTING(sculpt_field_mask, 174); |
---|
1029 | LEX_SETTING(sculpt_hb_overlap, 175); |
---|
1030 | LEX_SETTING(sculpt_hb_overlap_base, 176); |
---|
1031 | LEX_SETTING(legacy_vdw_radii, 177); |
---|
1032 | LEX_SETTING(sculpt_memory, 178); |
---|
1033 | LEX_SETTING(connect_mode, 179); |
---|
1034 | LEX_SETTING(cartoon_cylindrical_helices, 180); |
---|
1035 | LEX_SETTING(cartoon_helix_radius, 181); |
---|
1036 | LEX_SETTING(connect_cutoff, 182); |
---|
1037 | LEX_SETTING(save_pdb_ss, 183); |
---|
1038 | LEX_SETTING(sculpt_line_weight, 184); |
---|
1039 | LEX_SETTING(fit_iterations, 185); |
---|
1040 | LEX_SETTING(fit_tolerance, 186); |
---|
1041 | LEX_SETTING(batch_prefix, 187); |
---|
1042 | LEX_SETTING(stereo_mode, 188); |
---|
1043 | LEX_SETTING(cgo_sphere_quality, 189); |
---|
1044 | LEX_SETTING(pdb_literal_names, 190); |
---|
1045 | LEX_SETTING(wrap_output, 191); |
---|
1046 | LEX_SETTING(fog_start, 192); |
---|
1047 | LEX_SETTING(state, 193); |
---|
1048 | LEX_SETTING(frame, 194); |
---|
1049 | LEX_SETTING(ray_shadows, 195); |
---|
1050 | LEX_SETTING(ribbon_trace_atoms, 196); |
---|
1051 | LEX_SETTING(security, 197); |
---|
1052 | LEX_SETTING(stick_transparency, 198); |
---|
1053 | LEX_SETTING(ray_transparency_shadows, 199); |
---|
1054 | LEX_SETTING(session_version_check, 200); |
---|
1055 | LEX_SETTING(ray_transparency_specular, 201); |
---|
1056 | LEX_SETTING(stereo_double_pump_mono, 202); |
---|
1057 | LEX_SETTING(sphere_solvent, 203); |
---|
1058 | LEX_SETTING(mesh_quality, 204); |
---|
1059 | LEX_SETTING(mesh_solvent, 205); |
---|
1060 | LEX_SETTING(dot_solvent, 206); |
---|
1061 | LEX_SETTING(ray_shadow_fudge, 207); |
---|
1062 | LEX_SETTING(ray_triangle_fudge, 208); |
---|
1063 | LEX_SETTING(debug_pick, 209); |
---|
1064 | LEX_SETTING(dot_color, 210); |
---|
1065 | LEX_SETTING(mouse_limit, 211); |
---|
1066 | LEX_SETTING(mouse_scale, 212); |
---|
1067 | LEX_SETTING(transparency_mode, 213); |
---|
1068 | LEX_SETTING(clamp_colors, 214); |
---|
1069 | LEX_SETTING(pymol_space_max_red, 215); |
---|
1070 | LEX_SETTING(pymol_space_max_green, 216); |
---|
1071 | LEX_SETTING(pymol_space_max_blue, 217); |
---|
1072 | LEX_SETTING(pymol_space_min_factor, 218); |
---|
1073 | LEX_SETTING(roving_origin, 219); |
---|
1074 | LEX_SETTING(roving_lines, 220); |
---|
1075 | LEX_SETTING(roving_sticks, 221); |
---|
1076 | LEX_SETTING(roving_spheres, 222); |
---|
1077 | LEX_SETTING(roving_labels, 223); |
---|
1078 | LEX_SETTING(roving_delay, 224); |
---|
1079 | LEX_SETTING(roving_selection, 225); |
---|
1080 | LEX_SETTING(roving_byres, 226); |
---|
1081 | LEX_SETTING(roving_ribbon, 227); |
---|
1082 | LEX_SETTING(roving_cartoon, 228); |
---|
1083 | LEX_SETTING(roving_polar_contacts, 229); |
---|
1084 | LEX_SETTING(roving_polar_cutoff, 230); |
---|
1085 | LEX_SETTING(roving_nonbonded, 231); |
---|
1086 | LEX_SETTING(float_labels, 232); |
---|
1087 | LEX_SETTING(roving_detail, 233); |
---|
1088 | LEX_SETTING(roving_nb_spheres, 234); |
---|
1089 | LEX_SETTING(ribbon_color, 235); |
---|
1090 | LEX_SETTING(cartoon_color, 236); |
---|
1091 | LEX_SETTING(ribbon_smooth, 237); |
---|
1092 | LEX_SETTING(auto_color, 238); |
---|
1093 | LEX_SETTING(auto_color_next, 239); |
---|
1094 | LEX_SETTING(ray_interior_color, 240); |
---|
1095 | LEX_SETTING(cartoon_highlight_color, 241); |
---|
1096 | LEX_SETTING(coulomb_units_factor, 242); |
---|
1097 | LEX_SETTING(coulomb_dielectric, 243); |
---|
1098 | LEX_SETTING(ray_interior_shadows, 244); |
---|
1099 | LEX_SETTING(ray_interior_texture, 245); |
---|
1100 | |
---|
1101 | LEX_SETTING(roving_map1_name, 246); |
---|
1102 | LEX_SETTING(roving_map2_name, 247); |
---|
1103 | LEX_SETTING(roving_map3_name, 248); |
---|
1104 | |
---|
1105 | LEX_SETTING(roving_map1_level, 249); |
---|
1106 | LEX_SETTING(roving_map2_level, 250); |
---|
1107 | LEX_SETTING(roving_map3_level, 251); |
---|
1108 | |
---|
1109 | LEX_SETTING(roving_isomesh, 252); |
---|
1110 | LEX_SETTING(roving_isosurface, 253); |
---|
1111 | LEX_SETTING(scenes_changed, 254); |
---|
1112 | |
---|
1113 | LEX_SETTING(gaussian_b_adjust, 255); |
---|
1114 | LEX_SETTING(pdb_standard_order, 256); |
---|
1115 | |
---|
1116 | LEX_SETTING(cartoon_smooth_first, 257); |
---|
1117 | LEX_SETTING(cartoon_smooth_last, 258); |
---|
1118 | LEX_SETTING(cartoon_smooth_cycles, 259); |
---|
1119 | LEX_SETTING(cartoon_flat_cycles, 260); |
---|
1120 | |
---|
1121 | LEX_SETTING(max_threads, 261); |
---|
1122 | LEX_SETTING(show_progress, 262); |
---|
1123 | LEX_SETTING(use_display_lists, 263); |
---|
1124 | LEX_SETTING(cache_memory, 264); |
---|
1125 | LEX_SETTING(simplify_display_lists, 265); |
---|
1126 | LEX_SETTING(retain_order, 266); |
---|
1127 | LEX_SETTING(pdb_hetatm_sort, 267); |
---|
1128 | LEX_SETTING(pdb_use_ter_records, 268); |
---|
1129 | LEX_SETTING(cartoon_trace_atoms, 269); |
---|
1130 | LEX_SETTING(ray_oversample_cutoff, 270); |
---|
1131 | LEX_SETTING(gaussian_resolution, 271); |
---|
1132 | LEX_SETTING(gaussian_b_floor, 272); |
---|
1133 | LEX_SETTING(sculpt_nb_interval, 273); |
---|
1134 | LEX_SETTING(sculpt_tors_weight, 274); |
---|
1135 | LEX_SETTING(sculpt_tors_tolerance, 275); |
---|
1136 | LEX_SETTING(stick_ball, 276); |
---|
1137 | LEX_SETTING(stick_ball_ratio, 277); |
---|
1138 | LEX_SETTING(stick_fixed_radius, 278); |
---|
1139 | LEX_SETTING(cartoon_transparency, 279); |
---|
1140 | LEX_SETTING(dash_round_ends, 280); |
---|
1141 | LEX_SETTING(h_bond_max_angle, 281); |
---|
1142 | LEX_SETTING(h_bond_cutoff_center, 282); |
---|
1143 | LEX_SETTING(h_bond_cutoff_edge, 283); |
---|
1144 | LEX_SETTING(h_bond_power_a, 284); |
---|
1145 | LEX_SETTING(h_bond_power_b, 285); |
---|
1146 | LEX_SETTING(h_bond_cone, 286); |
---|
1147 | |
---|
1148 | LEX_SETTING(ss_helix_psi_target, 287); |
---|
1149 | LEX_SETTING(ss_helix_psi_include, 288); |
---|
1150 | LEX_SETTING(ss_helix_psi_exclude, 289); |
---|
1151 | |
---|
1152 | LEX_SETTING(ss_helix_phi_target, 290); |
---|
1153 | LEX_SETTING(ss_helix_phi_include, 291); |
---|
1154 | LEX_SETTING(ss_helix_phi_exclude, 292); |
---|
1155 | |
---|
1156 | LEX_SETTING(ss_strand_psi_target, 293); |
---|
1157 | LEX_SETTING(ss_strand_psi_include, 294); |
---|
1158 | LEX_SETTING(ss_strand_psi_exclude, 295); |
---|
1159 | |
---|
1160 | LEX_SETTING(ss_strand_phi_target, 296); |
---|
1161 | LEX_SETTING(ss_strand_phi_include, 297); |
---|
1162 | LEX_SETTING(ss_strand_phi_exclude, 298); |
---|
1163 | LEX_SETTING(movie_loop, 299); |
---|
1164 | |
---|
1165 | LEX_SETTING(pdb_retain_ids, 300); |
---|
1166 | LEX_SETTING(pdb_no_end_record, 301); |
---|
1167 | LEX_SETTING(cgo_dot_width, 302); |
---|
1168 | LEX_SETTING(cgo_dot_radius, 303); |
---|
1169 | LEX_SETTING(defer_updates, 304); |
---|
1170 | LEX_SETTING(normalize_o_maps, 305); |
---|
1171 | LEX_SETTING(swap_dsn6_bytes, 306); |
---|
1172 | LEX_SETTING(pdb_insertions_go_first, 307); |
---|
1173 | LEX_SETTING(roving_origin_z, 308); |
---|
1174 | LEX_SETTING(roving_origin_z_cushion, 309); |
---|
1175 | LEX_SETTING(specular_intensity, 310); |
---|
1176 | LEX_SETTING(overlay_lines, 311); |
---|
1177 | LEX_SETTING(ray_transparency_spec_cut, 312); |
---|
1178 | LEX_SETTING(internal_prompt, 313); |
---|
1179 | LEX_SETTING(normalize_grd_maps, 314); |
---|
1180 | LEX_SETTING(ray_blend_colors, 315); |
---|
1181 | LEX_SETTING(ray_blend_red, 316); |
---|
1182 | LEX_SETTING(ray_blend_green, 317); |
---|
1183 | LEX_SETTING(ray_blend_blue, 318); |
---|
1184 | LEX_SETTING(png_screen_gamma, 319); |
---|
1185 | LEX_SETTING(png_file_gamma, 320); |
---|
1186 | LEX_SETTING(editor_label_fragments, 321); |
---|
1187 | LEX_SETTING(internal_gui_control_size, 322); |
---|
1188 | LEX_SETTING(auto_dss, 323); |
---|
1189 | LEX_SETTING(transparency_picking_mode, 324); |
---|
1190 | LEX_SETTING(virtual_trackball, 325); |
---|
1191 | LEX_SETTING(pdb_reformat_names_mode, 326); |
---|
1192 | LEX_SETTING(ray_pixel_scale, 327); |
---|
1193 | LEX_SETTING(label_font_id, 328); |
---|
1194 | LEX_SETTING(pdb_conect_all, 329); |
---|
1195 | LEX_SETTING(button_mode_name, 330); |
---|
1196 | LEX_SETTING(surface_type, 331); |
---|
1197 | LEX_SETTING(dot_normals, 332); |
---|
1198 | LEX_SETTING(session_migration, 333); |
---|
1199 | LEX_SETTING(mesh_normals, 334); |
---|
1200 | LEX_SETTING(mesh_type, 335); |
---|
1201 | LEX_SETTING(dot_lighting, 336); |
---|
1202 | LEX_SETTING(mesh_lighting, 337); |
---|
1203 | LEX_SETTING(surface_solvent, 338); |
---|
1204 | LEX_SETTING(triangle_max_passes, 339); |
---|
1205 | LEX_SETTING(ray_interior_reflect, 340); |
---|
1206 | LEX_SETTING(internal_gui_mode, 341); |
---|
1207 | LEX_SETTING(surface_carve_selection, 342); |
---|
1208 | LEX_SETTING(surface_carve_state, 343); |
---|
1209 | LEX_SETTING(surface_carve_cutoff, 344); |
---|
1210 | LEX_SETTING(surface_clear_selection, 345); |
---|
1211 | LEX_SETTING(surface_clear_state, 346); |
---|
1212 | LEX_SETTING(surface_clear_cutoff, 347); |
---|
1213 | LEX_SETTING(surface_trim_cutoff, 348); |
---|
1214 | LEX_SETTING(surface_trim_factor, 349); |
---|
1215 | LEX_SETTING(ray_max_passes, 350); |
---|
1216 | LEX_SETTING(active_selections, 351); |
---|
1217 | LEX_SETTING(ray_transparency_contrast, 352); |
---|
1218 | LEX_SETTING(seq_view, 353); |
---|
1219 | LEX_SETTING(mouse_selection_mode, 354); |
---|
1220 | LEX_SETTING(seq_view_label_spacing, 355); |
---|
1221 | LEX_SETTING(seq_view_label_start, 356); |
---|
1222 | LEX_SETTING(seq_view_format, 357); |
---|
1223 | LEX_SETTING(seq_view_location, 358); |
---|
1224 | LEX_SETTING(seq_view_overlay, 359); |
---|
1225 | LEX_SETTING(auto_classify_atoms, 360); |
---|
1226 | LEX_SETTING(cartoon_nucleic_acid_mode, 361); |
---|
1227 | LEX_SETTING(seq_view_color, 362); |
---|
1228 | LEX_SETTING(seq_view_label_mode, 363); |
---|
1229 | LEX_SETTING(surface_ramp_above_mode, 364); |
---|
1230 | LEX_SETTING(stereo, 365); |
---|
1231 | LEX_SETTING(wizard_prompt_mode, 366); |
---|
1232 | LEX_SETTING(coulomb_cutoff, 367); |
---|
1233 | LEX_SETTING(slice_track_camera, 368); |
---|
1234 | LEX_SETTING(slice_height_scale, 369); |
---|
1235 | LEX_SETTING(slice_height_map, 370); |
---|
1236 | LEX_SETTING(slice_grid, 371); |
---|
1237 | LEX_SETTING(slice_dynamic_grid, 372); |
---|
1238 | LEX_SETTING(slice_dynamic_grid_resolution, 373); |
---|
1239 | LEX_SETTING(pdb_insure_orthogonal, 374); |
---|
1240 | LEX_SETTING(ray_direct_shade, 375); |
---|
1241 | LEX_SETTING(stick_color, 376); |
---|
1242 | LEX_SETTING(cartoon_putty_radius, 377); |
---|
1243 | LEX_SETTING(cartoon_putty_quality, 378); |
---|
1244 | LEX_SETTING(cartoon_putty_scale_min, 379); |
---|
1245 | LEX_SETTING(cartoon_putty_scale_max, 380); |
---|
1246 | LEX_SETTING(cartoon_putty_scale_power, 381); |
---|
1247 | LEX_SETTING(cartoon_putty_range, 382); |
---|
1248 | LEX_SETTING(cartoon_side_chain_helper, 383); |
---|
1249 | LEX_SETTING(surface_optimize_subsets, 384); |
---|
1250 | LEX_SETTING(multiplex, 385); |
---|
1251 | LEX_SETTING(texture_fonts, 386); |
---|
1252 | LEX_SETTING(pqr_workarounds, 387); |
---|
1253 | LEX_SETTING(animation, 388); |
---|
1254 | LEX_SETTING(animation_duration, 389); |
---|
1255 | LEX_SETTING(scene_animation, 390); |
---|
1256 | LEX_SETTING(line_stick_helper, 391); |
---|
1257 | LEX_SETTING(ray_orthoscopic, 392); |
---|
1258 | LEX_SETTING(ribbon_side_chain_helper, 393); |
---|
1259 | LEX_SETTING(selection_width_max, 394); |
---|
1260 | LEX_SETTING(selection_width_scale, 395); |
---|
1261 | LEX_SETTING(scene_current_name, 396); |
---|
1262 | LEX_SETTING(presentation, 397); |
---|
1263 | LEX_SETTING(presentation_mode, 398); |
---|
1264 | LEX_SETTING(pdb_truncate_residue_name, 399); |
---|
1265 | LEX_SETTING(scene_loop, 400); |
---|
1266 | LEX_SETTING(sweep_mode, 401); |
---|
1267 | LEX_SETTING(sweep_phase, 402); |
---|
1268 | LEX_SETTING(scene_restart_movie_delay, 403); |
---|
1269 | LEX_SETTING(mouse_restart_movie_delay, 404); |
---|
1270 | LEX_SETTING(angle_size, 405); |
---|
1271 | LEX_SETTING(angle_label_position, 406); |
---|
1272 | LEX_SETTING(dihedral_size, 407); |
---|
1273 | LEX_SETTING(dihedral_label_position, 408); |
---|
1274 | LEX_SETTING(defer_builds_mode, 409); |
---|
1275 | LEX_SETTING(seq_view_discrete_by_state, 410); |
---|
1276 | LEX_SETTING(scene_animation_duration, 411); |
---|
1277 | LEX_SETTING(wildcard,412); |
---|
1278 | LEX_SETTING(atom_name_wildcard,413); |
---|
1279 | LEX_SETTING(ignore_case,414); |
---|
1280 | LEX_SETTING(presentation_auto_quit,415); |
---|
1281 | LEX_SETTING(editor_auto_dihedral,416); |
---|
1282 | LEX_SETTING(presentation_auto_start,417); |
---|
1283 | LEX_SETTING(validate_object_names,418); |
---|
1284 | /* LEX_SETTING(ray_pixel_scale_limit, 419);*/ |
---|
1285 | LEX_SETTING(auto_show_spheres, 420); |
---|
1286 | LEX_SETTING(sphere_mode, 421); |
---|
1287 | LEX_SETTING(sphere_point_max_size, 422); |
---|
1288 | LEX_SETTING(sphere_point_size, 423); |
---|
1289 | LEX_SETTING(pdb_honor_model_number, 424); |
---|
1290 | LEX_SETTING(rank_assisted_sorts, 425); |
---|
1291 | LEX_SETTING(ribbon_nucleic_acid_mode, 426); |
---|
1292 | LEX_SETTING(cartoon_ring_mode, 427); |
---|
1293 | LEX_SETTING(cartoon_ring_width, 428); |
---|
1294 | LEX_SETTING(cartoon_ring_color, 429); |
---|
1295 | LEX_SETTING(cartoon_ring_finder, 430); |
---|
1296 | LEX_SETTING(cartoon_tube_cap, 431); |
---|
1297 | LEX_SETTING(cartoon_loop_cap, 432); |
---|
1298 | LEX_SETTING(nvidia_bugs, 433); |
---|
1299 | LEX_SETTING(image_dots_per_inch, 434); |
---|
1300 | LEX_SETTING(opaque_background, 435); |
---|
1301 | LEX_SETTING(draw_frames, 436); |
---|
1302 | LEX_SETTING(show_alpha_checker, 437); |
---|
1303 | LEX_SETTING(matrix_mode, 438); |
---|
1304 | LEX_SETTING(editor_auto_origin, 439); |
---|
1305 | LEX_SETTING(session_file, 440); |
---|
1306 | LEX_SETTING(cgo_transparency, 441); |
---|
1307 | LEX_SETTING(legacy_mouse_zoom, 442); |
---|
1308 | LEX_SETTING(auto_number_selections, 443); |
---|
1309 | LEX_SETTING(sculpt_vdw_vis_mode, 444); |
---|
1310 | LEX_SETTING(sculpt_vdw_vis_min, 445); |
---|
1311 | LEX_SETTING(sculpt_vdw_vis_mid, 446); |
---|
1312 | LEX_SETTING(sculpt_vdw_vis_max, 447); |
---|
1313 | LEX_SETTING(cartoon_ladder_mode, 448); |
---|
1314 | LEX_SETTING(cartoon_ladder_radius, 449); |
---|
1315 | LEX_SETTING(cartoon_ladder_color, 450); |
---|
1316 | LEX_SETTING(cartoon_nucleic_acid_color, 451); |
---|
1317 | LEX_SETTING(cartoon_ring_transparency, 452); |
---|
1318 | LEX_SETTING(label_size, 453); |
---|
1319 | LEX_SETTING(spec_direct, 454); |
---|
1320 | LEX_SETTING(light_count, 455); |
---|
1321 | LEX_SETTING(light2, 456); |
---|
1322 | LEX_SETTING(light3, 457); |
---|
1323 | LEX_SETTING(hide_underscore_names, 458); |
---|
1324 | LEX_SETTING(selection_round_points, 459); |
---|
1325 | LEX_SETTING(distance_exclusion, 460); |
---|
1326 | LEX_SETTING(h_bond_exclusion, 461); |
---|
1327 | LEX_SETTING(label_shadow_mode, 462); |
---|
1328 | LEX_SETTING(light4, 463); |
---|
1329 | LEX_SETTING(light5, 464); |
---|
1330 | LEX_SETTING(light6, 465); |
---|
1331 | LEX_SETTING(light7, 466); |
---|
1332 | LEX_SETTING(label_outline_color, 467); |
---|
1333 | LEX_SETTING(ray_trace_mode,468); |
---|
1334 | LEX_SETTING(ray_trace_gain,469); |
---|
1335 | LEX_SETTING(selection_visible_only,470); |
---|
1336 | LEX_SETTING(label_position,471); |
---|
1337 | LEX_SETTING(ray_trace_depth_factor,472); |
---|
1338 | LEX_SETTING(ray_trace_slope_factor,473); |
---|
1339 | LEX_SETTING(ray_trace_disco_factor,474); |
---|
1340 | LEX_SETTING(ray_shadow_decay_factor, 475); |
---|
1341 | LEX_SETTING(ray_interior_mode, 476); |
---|
1342 | LEX_SETTING(ray_legacy_lighting, 477); |
---|
1343 | LEX_SETTING(sculpt_auto_center, 478); |
---|
1344 | LEX_SETTING(pdb_discrete_chains, 479); |
---|
1345 | LEX_SETTING(pdb_unbond_cations, 480); |
---|
1346 | LEX_SETTING(sculpt_tri_scale, 481); |
---|
1347 | LEX_SETTING(sculpt_tri_weight, 482); |
---|
1348 | LEX_SETTING(sculpt_tri_min, 483); |
---|
1349 | LEX_SETTING(sculpt_tri_max, 484); |
---|
1350 | LEX_SETTING(sculpt_tri_mode, 485); |
---|
1351 | LEX_SETTING(pdb_echo_tags, 486); |
---|
1352 | LEX_SETTING(connect_bonded, 487); |
---|
1353 | LEX_SETTING(spec_direct_power, 488); |
---|
1354 | LEX_SETTING(light8, 489); |
---|
1355 | LEX_SETTING(light9, 490); |
---|
1356 | LEX_SETTING(ray_shadow_decay_range, 491); |
---|
1357 | LEX_SETTING(spec_count, 492); |
---|
1358 | LEX_SETTING(sculpt_min_scale, 493); |
---|
1359 | LEX_SETTING(sculpt_min_weight, 494); |
---|
1360 | LEX_SETTING(sculpt_min_min, 495); |
---|
1361 | LEX_SETTING(sculpt_min_max, 496); |
---|
1362 | LEX_SETTING(sculpt_max_scale, 497); |
---|
1363 | LEX_SETTING(sculpt_max_weight, 498); |
---|
1364 | LEX_SETTING(sculpt_max_min, 499); |
---|
1365 | LEX_SETTING(sculpt_max_max, 500); |
---|
1366 | LEX_SETTING(surface_circumscribe, 501); |
---|
1367 | LEX_SETTING(sculpt_avd_weight, 502); |
---|
1368 | LEX_SETTING(sculpt_avd_gap, 503); |
---|
1369 | LEX_SETTING(sculpt_avd_range, 504); |
---|
1370 | LEX_SETTING(sculpt_avd_excl, 505); |
---|
1371 | LEX_SETTING(async_builds, 506); |
---|
1372 | LEX_SETTING(fetch_path, 507); |
---|
1373 | LEX_SETTING(cartoon_ring_radius, 508); |
---|
1374 | LEX_SETTING(ray_color_ramps,509); |
---|
1375 | LEX_SETTING(ray_hint_camera,510); |
---|
1376 | LEX_SETTING(ray_hint_shadow,511); |
---|
1377 | LEX_SETTING(stick_valence_scale,512); |
---|
1378 | LEX_SETTING(seq_view_alignment,513); |
---|
1379 | LEX_SETTING(seq_view_unaligned_mode,514); |
---|
1380 | LEX_SETTING(seq_view_unaligned_color,515); |
---|
1381 | LEX_SETTING(seq_view_fill_char,516); |
---|
1382 | LEX_SETTING(seq_view_fill_color,517); |
---|
1383 | LEX_SETTING(seq_view_label_color,518); |
---|
1384 | LEX_SETTING(surface_carve_normal_cutoff,519); |
---|
1385 | LEX_SETTING(trace_atoms_mode,520); |
---|
1386 | LEX_SETTING(session_changed,521); |
---|
1387 | LEX_SETTING(ray_clip_shadows,522); |
---|
1388 | LEX_SETTING(mouse_wheel_scale,523); |
---|
1389 | LEX_SETTING(nonbonded_transparency,524); |
---|
1390 | LEX_SETTING(ray_spec_local,525); |
---|
1391 | LEX_SETTING(line_color,526); |
---|
1392 | LEX_SETTING(ray_label_specular, 527); |
---|
1393 | LEX_SETTING(mesh_skip,528); |
---|
1394 | LEX_SETTING(label_digits,529); |
---|
1395 | LEX_SETTING(label_distance_digits,530); |
---|
1396 | LEX_SETTING(label_angle_digits,531); |
---|
1397 | LEX_SETTING(label_dihedral_digits,532); |
---|
1398 | LEX_SETTING(surface_negative_visible,533); |
---|
1399 | LEX_SETTING(surface_negative_color, 534); |
---|
1400 | LEX_SETTING(mesh_negative_visible,535); |
---|
1401 | LEX_SETTING(mesh_negative_color, 536); |
---|
1402 | LEX_SETTING(group_auto_mode, 537); |
---|
1403 | LEX_SETTING(group_full_member_names, 538); |
---|
1404 | LEX_SETTING(gradient_max_length,539); |
---|
1405 | LEX_SETTING(gradient_min_length,540); |
---|
1406 | LEX_SETTING(gradient_min_slope,541); |
---|
1407 | LEX_SETTING(gradient_normal_min_dot,542); |
---|
1408 | LEX_SETTING(gradient_step_size,543); |
---|
1409 | LEX_SETTING(gradient_spacing,544); |
---|
1410 | LEX_SETTING(gradient_symmetry,545); |
---|
1411 | LEX_SETTING(ray_trace_color,546); |
---|
1412 | LEX_SETTING(group_arrow_prefix,547); |
---|
1413 | LEX_SETTING(suppress_hidden,548); |
---|
1414 | LEX_SETTING(session_compression,549); |
---|
1415 | LEX_SETTING(movie_fps,550); |
---|
1416 | LEX_SETTING(ray_transparency_oblique,551); |
---|
1417 | LEX_SETTING(ray_trace_trans_cutoff,552); |
---|
1418 | LEX_SETTING(ray_trace_persist_cutoff,553); |
---|
1419 | LEX_SETTING(ray_transparency_oblique_power,554); |
---|
1420 | LEX_SETTING(ray_scatter,555); |
---|
1421 | LEX_SETTING(h_bond_from_proton,556); |
---|
1422 | |
---|
1423 | return_OVstatus_SUCCESS; |
---|
1424 | } |
---|
1425 | |
---|
1426 | int PyMOL_NewG3DStream(CPyMOL *I,int **array_ptr) |
---|
1427 | { |
---|
1428 | int *return_vla = ExecutiveGetG3d(I->G); |
---|
1429 | int result = OVstatus_FAILURE; |
---|
1430 | if(return_vla) { |
---|
1431 | result = VLAGetSize(return_vla)*(sizeof(G3dPrimitive)/sizeof(int)); |
---|
1432 | } |
---|
1433 | if(array_ptr) |
---|
1434 | *array_ptr = return_vla; |
---|
1435 | return result; |
---|
1436 | } |
---|
1437 | |
---|
1438 | int PyMOL_DelG3DStream(CPyMOL *I,int *array_ptr) |
---|
1439 | { |
---|
1440 | VLAFreeP(array_ptr); |
---|
1441 | return OVstatus_SUCCESS; |
---|
1442 | } |
---|
1443 | |
---|
1444 | |
---|
1445 | static OVstatus PyMOL_PurgeAPI(CPyMOL *I) |
---|
1446 | { |
---|
1447 | OVOneToOne_DEL_AUTO_NULL(I->Setting); |
---|
1448 | OVOneToOne_DEL_AUTO_NULL(I->Clip); |
---|
1449 | OVOneToOne_DEL_AUTO_NULL(I->SelectList); |
---|
1450 | OVOneToOne_DEL_AUTO_NULL(I->Reinit); |
---|
1451 | OVOneToOne_DEL_AUTO_NULL(I->Rep); |
---|
1452 | OVLexicon_DEL_AUTO_NULL(I->Lex); |
---|
1453 | return_OVstatus_SUCCESS; |
---|
1454 | } |
---|
1455 | |
---|
1456 | int PyMOL_FreeResultArray(CPyMOL *I,void *array) |
---|
1457 | { |
---|
1458 | if(array) { |
---|
1459 | VLAFreeP(array); |
---|
1460 | return PyMOLstatus_SUCCESS; |
---|
1461 | } else { |
---|
1462 | return PyMOLstatus_FAILURE; |
---|
1463 | } |
---|
1464 | } |
---|
1465 | |
---|
1466 | PyMOLreturn_status PyMOL_CmdDraw(CPyMOL *I,int width, int height, |
---|
1467 | int antialias, int quiet) |
---|
1468 | { |
---|
1469 | PyMOLreturn_status result; |
---|
1470 | PYMOL_API_LOCK |
---|
1471 | result.status = get_status_ok(ExecutiveDrawCmd(I->G,width,height,antialias,quiet)); |
---|
1472 | I->ImageRequestedFlag = true; |
---|
1473 | I->ImageReadyFlag = false; |
---|
1474 | PYMOL_API_UNLOCK |
---|
1475 | return result; |
---|
1476 | } |
---|
1477 | |
---|
1478 | PyMOLreturn_status PyMOL_CmdRay(CPyMOL *I,int width, int height,int antialias, |
---|
1479 | float angle, float shift,int renderer, int defer, int quiet) |
---|
1480 | { |
---|
1481 | PyMOLreturn_status result; |
---|
1482 | PYMOL_API_LOCK |
---|
1483 | |
---|
1484 | if(renderer<0) renderer=SettingGetGlobal_i(I->G,cSetting_ray_default_renderer); |
---|
1485 | SceneInvalidateCopy(I->G,true); |
---|
1486 | result.status = get_status_ok(ExecutiveRay(I->G,width,height,renderer,angle,shift,quiet,defer,antialias)); |
---|
1487 | if(defer) { |
---|
1488 | I->ImageRequestedFlag = true; |
---|
1489 | I->ImageReadyFlag = false; |
---|
1490 | } else { |
---|
1491 | I->ImageRequestedFlag = false; |
---|
1492 | if(SceneHasImage(I->G)) { |
---|
1493 | I->ImageReadyFlag = true; |
---|
1494 | } else { |
---|
1495 | I->ImageReadyFlag = false; |
---|
1496 | } |
---|
1497 | } |
---|
1498 | PYMOL_API_UNLOCK |
---|
1499 | return result; |
---|
1500 | } |
---|
1501 | |
---|
1502 | PyMOLreturn_status PyMOL_CmdSetView(CPyMOL *I, float *view, int view_len, |
---|
1503 | float animate, int quiet) |
---|
1504 | { |
---|
1505 | PyMOLreturn_status result; |
---|
1506 | SceneViewType tmp; |
---|
1507 | PYMOL_API_LOCK |
---|
1508 | if(view_len>=18) { |
---|
1509 | int a; |
---|
1510 | UtilZeroMem(tmp,sizeof(tmp)); |
---|
1511 | tmp[15]=1.0F; |
---|
1512 | for(a=0;a<3;a++) { |
---|
1513 | tmp[a]=view[a]; |
---|
1514 | tmp[a+4]=view[a+3]; |
---|
1515 | tmp[a+8]=view[a+6]; |
---|
1516 | tmp[a+16]=view[a+9]; |
---|
1517 | tmp[a+19]=view[a+12]; |
---|
1518 | tmp[a+22]=view[a+15]; |
---|
1519 | } |
---|
1520 | SceneSetView(I->G,tmp,quiet,animate,0); /* TO DO -- add hand to the API */ |
---|
1521 | result.status = get_status_ok(true); |
---|
1522 | } else { |
---|
1523 | result.status = get_status_ok(false); |
---|
1524 | } |
---|
1525 | PYMOL_API_UNLOCK |
---|
1526 | return result; |
---|
1527 | } |
---|
1528 | |
---|
1529 | PyMOLreturn_float_array PyMOL_CmdGetView(CPyMOL *I,int quiet) |
---|
1530 | { |
---|
1531 | PyMOLreturn_float_array result; |
---|
1532 | SceneViewType tmp; |
---|
1533 | PYMOL_API_LOCK |
---|
1534 | result.size = 18; |
---|
1535 | result.array = VLAlloc(float,result.size); |
---|
1536 | if(result.array) { |
---|
1537 | int a; |
---|
1538 | SceneGetView(I->G,tmp); |
---|
1539 | for(a=0;a<3;a++) { |
---|
1540 | result.array[a]=tmp[a]; |
---|
1541 | result.array[a+3]=tmp[a+4]; |
---|
1542 | result.array[a+6]=tmp[a+8]; |
---|
1543 | result.array[a+9]=tmp[a+16]; |
---|
1544 | result.array[a+12]=tmp[a+19]; |
---|
1545 | result.array[a+15]=tmp[a+22]; |
---|
1546 | } |
---|
1547 | result.status = get_status_ok(true); |
---|
1548 | } else { |
---|
1549 | result.status = get_status_ok(false); |
---|
1550 | } |
---|
1551 | PYMOL_API_UNLOCK |
---|
1552 | return result; |
---|
1553 | } |
---|
1554 | |
---|
1555 | PyMOLreturn_float_array PyMOL_CmdAlign(CPyMOL *I, char *source, char *target, float cutoff, |
---|
1556 | int cycles, float gap, float extend, int max_gap, |
---|
1557 | char *object, char *matrix, int source_state, int target_state, |
---|
1558 | int quiet, int max_skip, int transform, int reset) |
---|
1559 | { |
---|
1560 | PyMOLreturn_float_array result; |
---|
1561 | |
---|
1562 | PYMOL_API_LOCK |
---|
1563 | OrthoLineType s2="",s3=""; |
---|
1564 | int ok = false; |
---|
1565 | ExecutiveRMSInfo rms_info; |
---|
1566 | result.size = 7; |
---|
1567 | result.array = VLAlloc(float,result.size); |
---|
1568 | if(!result.array) { |
---|
1569 | ok=false; |
---|
1570 | } else { |
---|
1571 | ok = ((SelectorGetTmp(I->G,source,s2)>=0) && |
---|
1572 | (SelectorGetTmp(I->G,target,s3)>=0)); |
---|
1573 | if(ok) { |
---|
1574 | ok = ExecutiveAlign(I->G,s2,s3,matrix,gap,extend,max_gap, |
---|
1575 | max_skip,cutoff,cycles,quiet,object, |
---|
1576 | source_state-1, target_state-1, |
---|
1577 | &rms_info,transform,reset); |
---|
1578 | if(ok) { |
---|
1579 | result.array[0] = rms_info.final_rms; |
---|
1580 | result.array[1] = rms_info.final_n_atom; |
---|
1581 | result.array[2] = rms_info.n_cycles_run; |
---|
1582 | result.array[3] = rms_info.initial_rms; |
---|
1583 | result.array[4] = rms_info.initial_n_atom; |
---|
1584 | result.array[5] = rms_info.raw_alignment_score; |
---|
1585 | result.array[6] = rms_info.n_residues_aligned; |
---|
1586 | } |
---|
1587 | } |
---|
1588 | } |
---|
1589 | SelectorFreeTmp(I->G,s2); |
---|
1590 | SelectorFreeTmp(I->G,s3); |
---|
1591 | result.status = get_status_ok(ok); |
---|
1592 | if(!ok) { |
---|
1593 | VLAFreeP(result.array); |
---|
1594 | } |
---|
1595 | PYMOL_API_UNLOCK |
---|
1596 | |
---|
1597 | return result; |
---|
1598 | } |
---|
1599 | |
---|
1600 | PyMOLreturn_status PyMOL_CmdDelete(CPyMOL *I,char *name,int quiet) |
---|
1601 | { |
---|
1602 | PYMOL_API_LOCK |
---|
1603 | ExecutiveDelete(I->G, name); |
---|
1604 | PYMOL_API_UNLOCK |
---|
1605 | return return_status_ok(true); /* TO DO: return a real result */ |
---|
1606 | } |
---|
1607 | |
---|
1608 | PyMOLreturn_status PyMOL_CmdZoom(CPyMOL *I,char *selection, float buffer, |
---|
1609 | int state, int complete, float animate, int quiet) |
---|
1610 | { |
---|
1611 | int ok=false; |
---|
1612 | PYMOL_API_LOCK |
---|
1613 | ok = ExecutiveWindowZoom(I->G, selection, buffer, state-1, |
---|
1614 | complete, animate, quiet); |
---|
1615 | PYMOL_API_UNLOCK |
---|
1616 | return return_status_ok(ok); |
---|
1617 | } |
---|
1618 | |
---|
1619 | PyMOLreturn_status PyMOL_CmdOrient(CPyMOL *I,char *selection, float buffer, |
---|
1620 | int state, int complete, float animate, int quiet) |
---|
1621 | { |
---|
1622 | int ok=true; |
---|
1623 | PYMOL_API_LOCK |
---|
1624 | double m[16]; |
---|
1625 | OrthoLineType s1; |
---|
1626 | SelectorGetTmp(I->G,selection,s1); |
---|
1627 | if(ExecutiveGetMoment(I->G,s1,m,state)) |
---|
1628 | ExecutiveOrient(I->G,s1,m,state-1,animate,complete,buffer,quiet); /* TODO STATUS */ |
---|
1629 | else |
---|
1630 | ok=false; |
---|
1631 | SelectorFreeTmp(I->G,s1); |
---|
1632 | PYMOL_API_UNLOCK |
---|
1633 | return return_status_ok(ok); |
---|
1634 | } |
---|
1635 | |
---|
1636 | PyMOLreturn_status PyMOL_CmdCenter(CPyMOL *I,char *selection, int state, int origin, float animate, int quiet) |
---|
1637 | { |
---|
1638 | int ok = false; |
---|
1639 | PYMOL_API_LOCK |
---|
1640 | ok = ExecutiveCenter(I->G,selection,state-1,origin,animate,NULL,quiet); |
---|
1641 | PYMOL_API_UNLOCK |
---|
1642 | return return_status_ok(ok); |
---|
1643 | } |
---|
1644 | |
---|
1645 | |
---|
1646 | PyMOLreturn_status PyMOL_CmdOrigin(CPyMOL *I,char *selection, int state, int quiet) |
---|
1647 | { |
---|
1648 | int ok=true; |
---|
1649 | PYMOL_API_LOCK |
---|
1650 | OrthoLineType s1; |
---|
1651 | float v[3] = { 0.0F, 0.0F, 0.0F }; |
---|
1652 | SelectorGetTmp(I->G,selection,s1); |
---|
1653 | ok = ExecutiveOrigin(I->G,s1,true,"",v,state-1); /* TODO STATUS */ |
---|
1654 | SelectorFreeTmp(I->G,s1); |
---|
1655 | PYMOL_API_UNLOCK |
---|
1656 | return return_status_ok(ok); |
---|
1657 | } |
---|
1658 | |
---|
1659 | PyMOLreturn_status PyMOL_CmdOriginAt(CPyMOL *I,float x, float y, float z, int quiet) |
---|
1660 | { |
---|
1661 | int ok=true; |
---|
1662 | PYMOL_API_LOCK |
---|
1663 | float v[3]; |
---|
1664 | v[0]=x;v[1]=y;v[2]=z; |
---|
1665 | ok = ExecutiveOrigin(I->G,"",true,"",v,0); /* TODO STATUS */ |
---|
1666 | PYMOL_API_UNLOCK |
---|
1667 | return return_status_ok(ok); |
---|
1668 | } |
---|
1669 | |
---|
1670 | static OVreturn_word get_rep_id(CPyMOL *I,char *representation) |
---|
1671 | { |
---|
1672 | OVreturn_word result; |
---|
1673 | |
---|
1674 | if(!OVreturn_IS_OK( (result = OVLexicon_BorrowFromCString(I->Lex,representation)))) |
---|
1675 | return result; |
---|
1676 | return OVOneToOne_GetForward(I->Rep,result.word); |
---|
1677 | } |
---|
1678 | |
---|
1679 | static OVreturn_word get_setting_id(CPyMOL *I,char *setting) |
---|
1680 | { |
---|
1681 | OVreturn_word result; |
---|
1682 | if(!OVreturn_IS_OK( (result = OVLexicon_BorrowFromCString(I->Lex,setting)))) |
---|
1683 | return result; |
---|
1684 | return OVOneToOne_GetForward(I->Setting,result.word); |
---|
1685 | } |
---|
1686 | |
---|
1687 | static OVreturn_word get_clip_id(CPyMOL *I,char *clip) |
---|
1688 | { |
---|
1689 | OVreturn_word result; |
---|
1690 | if(!OVreturn_IS_OK( (result = OVLexicon_BorrowFromCString(I->Lex,clip)))) |
---|
1691 | return result; |
---|
1692 | return OVOneToOne_GetForward(I->Clip,result.word); |
---|
1693 | } |
---|
1694 | |
---|
1695 | static OVreturn_word get_reinit_id(CPyMOL *I,char *reinit) |
---|
1696 | { |
---|
1697 | OVreturn_word result; |
---|
1698 | if(!OVreturn_IS_OK( (result = OVLexicon_BorrowFromCString(I->Lex,reinit)))) |
---|
1699 | return result; |
---|
1700 | return OVOneToOne_GetForward(I->Reinit,result.word); |
---|
1701 | } |
---|
1702 | |
---|
1703 | static OVreturn_word get_select_list_mode(CPyMOL *I,char *mode) |
---|
1704 | { |
---|
1705 | OVreturn_word result; |
---|
1706 | if(!OVreturn_IS_OK( (result = OVLexicon_BorrowFromCString(I->Lex,mode)))) |
---|
1707 | return result; |
---|
1708 | return OVOneToOne_GetForward(I->SelectList,result.word); |
---|
1709 | } |
---|
1710 | |
---|
1711 | PyMOLreturn_status PyMOL_CmdClip(CPyMOL *I,char *mode, float amount, char *selection, int state, int quiet) |
---|
1712 | { |
---|
1713 | int ok=true; |
---|
1714 | PYMOL_API_LOCK |
---|
1715 | OrthoLineType s1; |
---|
1716 | OVreturn_word clip_id; |
---|
1717 | if(OVreturn_IS_OK( (clip_id= get_clip_id(I,mode)))) { |
---|
1718 | SelectorGetTmp(I->G,selection,s1); |
---|
1719 | SceneClip(I->G,clip_id.word,amount,s1,state-1); |
---|
1720 | SelectorFreeTmp(I->G,s1); |
---|
1721 | } |
---|
1722 | PYMOL_API_UNLOCK |
---|
1723 | return return_status_ok(ok); |
---|
1724 | } |
---|
1725 | |
---|
1726 | PyMOLreturn_status PyMOL_CmdLabel(CPyMOL *I,char *selection, char *text, int quiet) |
---|
1727 | { |
---|
1728 | int ok; |
---|
1729 | PYMOL_API_LOCK |
---|
1730 | OrthoLineType s1; |
---|
1731 | SelectorGetTmp(I->G,selection,s1); |
---|
1732 | ok = ExecutiveLabel(I->G,s1,text,quiet,0); |
---|
1733 | SelectorFreeTmp(I->G,s1); |
---|
1734 | PYMOL_API_UNLOCK |
---|
1735 | return return_status_ok(ok); |
---|
1736 | } |
---|
1737 | |
---|
1738 | PyMOLreturn_status PyMOL_CmdSelect(CPyMOL *I,char *name, char *selection, int quiet) |
---|
1739 | { |
---|
1740 | int ok; |
---|
1741 | PYMOL_API_LOCK |
---|
1742 | ok = SelectorCreate(I->G,name,selection,NULL,quiet,NULL); |
---|
1743 | PYMOL_API_UNLOCK |
---|
1744 | return return_status_ok(ok); |
---|
1745 | } |
---|
1746 | |
---|
1747 | PyMOLreturn_status PyMOL_CmdSelectList(CPyMOL *I,char *name, char *object, int *list, int list_len, int state, char *mode, int quiet) |
---|
1748 | { |
---|
1749 | PyMOLreturn_status result = { PyMOLstatus_FAILURE }; |
---|
1750 | PYMOL_API_LOCK |
---|
1751 | OVreturn_word mode_id; |
---|
1752 | if(OVreturn_IS_OK( (mode_id= get_select_list_mode(I,mode)))) { |
---|
1753 | result.status = ExecutiveSelectList(I->G,name, object, list, list_len, state-1, mode_id.word, quiet); |
---|
1754 | } |
---|
1755 | PYMOL_API_UNLOCK |
---|
1756 | return result; |
---|
1757 | } |
---|
1758 | |
---|
1759 | PyMOLreturn_status PyMOL_CmdShow(CPyMOL *I,char *representation, char *selection, int quiet) |
---|
1760 | { |
---|
1761 | int ok=true; |
---|
1762 | PYMOL_API_LOCK |
---|
1763 | OrthoLineType s1; |
---|
1764 | OVreturn_word rep_id; |
---|
1765 | if(OVreturn_IS_OK( (rep_id= get_rep_id(I,representation)))) { |
---|
1766 | SelectorGetTmp(I->G,selection,s1); |
---|
1767 | ExecutiveSetRepVisib(I->G,s1,rep_id.word,true); |
---|
1768 | SelectorFreeTmp(I->G,s1); |
---|
1769 | } else { |
---|
1770 | ok=false; |
---|
1771 | } |
---|
1772 | PYMOL_API_UNLOCK |
---|
1773 | return return_status_ok(ok); |
---|
1774 | } |
---|
1775 | |
---|
1776 | PyMOLreturn_status PyMOL_CmdHide(CPyMOL *I,char *representation, char *selection, int quiet) |
---|
1777 | { |
---|
1778 | int ok=true; |
---|
1779 | PYMOL_API_LOCK |
---|
1780 | OrthoLineType s1; |
---|
1781 | OVreturn_word rep_id; |
---|
1782 | if(OVreturn_IS_OK( (rep_id = get_rep_id(I,representation)))) { |
---|
1783 | SelectorGetTmp(I->G,selection,s1); |
---|
1784 | ExecutiveSetRepVisib(I->G,s1,rep_id.word,false); |
---|
1785 | SelectorFreeTmp(I->G,s1); |
---|
1786 | } else { |
---|
1787 | ok=false; |
---|
1788 | } |
---|
1789 | PYMOL_API_UNLOCK |
---|
1790 | return return_status_ok(ok); |
---|
1791 | } |
---|
1792 | |
---|
1793 | PyMOLreturn_status PyMOL_CmdEnable(CPyMOL *I,char *name,int quiet) |
---|
1794 | { |
---|
1795 | int ok = false; |
---|
1796 | PYMOL_API_LOCK |
---|
1797 | if(name[0]=='(') { |
---|
1798 | OrthoLineType s1; |
---|
1799 | ok = (SelectorGetTmp(I->G,name,s1)>=0); |
---|
1800 | if(ok) ok = ExecutiveSetOnOffBySele(I->G,s1,true); |
---|
1801 | SelectorFreeTmp(I->G,s1); |
---|
1802 | } |
---|
1803 | ok = ExecutiveSetObjVisib(I->G,name,true); |
---|
1804 | PYMOL_API_UNLOCK |
---|
1805 | return return_status_ok(ok); |
---|
1806 | } |
---|
1807 | |
---|
1808 | PyMOLreturn_status PyMOL_CmdDisable(CPyMOL *I,char *name,int quiet) |
---|
1809 | { |
---|
1810 | int ok = false; |
---|
1811 | PYMOL_API_LOCK |
---|
1812 | if(name[0]=='(') { |
---|
1813 | OrthoLineType s1; |
---|
1814 | ok = (SelectorGetTmp(I->G,name,s1)>=0); |
---|
1815 | if(ok) ok = ExecutiveSetOnOffBySele(I->G,s1,false); |
---|
1816 | SelectorFreeTmp(I->G,s1); |
---|
1817 | } else { |
---|
1818 | ok = ExecutiveSetObjVisib(I->G,name,false); |
---|
1819 | } |
---|
1820 | PYMOL_API_UNLOCK |
---|
1821 | return return_status_ok(ok); |
---|
1822 | } |
---|
1823 | |
---|
1824 | PyMOLreturn_status PyMOL_CmdSet(CPyMOL *I,char *setting, char *value, char *selection, int state, int quiet, int side_effects) |
---|
1825 | { |
---|
1826 | int ok=true; |
---|
1827 | PYMOL_API_LOCK |
---|
1828 | OVreturn_word setting_id; |
---|
1829 | if(OVreturn_IS_OK( (setting_id = get_setting_id(I,setting)))) { |
---|
1830 | ExecutiveSetSettingFromString(I->G, setting_id.word, value, selection, |
---|
1831 | state-1, quiet, side_effects); |
---|
1832 | } |
---|
1833 | PYMOL_API_UNLOCK |
---|
1834 | return return_status_ok(ok); |
---|
1835 | } |
---|
1836 | |
---|
1837 | PyMOLreturn_status PyMOL_CmdColor(CPyMOL *I,char *color, char *selection, int flags, int quiet) |
---|
1838 | { |
---|
1839 | int ok=true; |
---|
1840 | PYMOL_API_LOCK |
---|
1841 | OrthoLineType s1 = ""; |
---|
1842 | |
---|
1843 | SelectorGetTmp(I->G,selection,s1); |
---|
1844 | ok = ExecutiveColor(I->G,s1,color,flags,quiet); |
---|
1845 | SelectorFreeTmp(I->G,s1); |
---|
1846 | PYMOL_API_UNLOCK |
---|
1847 | return return_status_ok(ok); |
---|
1848 | } |
---|
1849 | |
---|
1850 | PyMOLreturn_status PyMOL_CmdReinitialize(CPyMOL *I,char *what, char *object_name) |
---|
1851 | { |
---|
1852 | int ok = true; |
---|
1853 | OVreturn_word what_id; |
---|
1854 | PYMOL_API_LOCK |
---|
1855 | if(OVreturn_IS_OK( (what_id= get_reinit_id(I,what)))) { |
---|
1856 | ok = ExecutiveReinitialize(I->G,what_id.word,object_name); |
---|
1857 | } |
---|
1858 | PYMOL_API_UNLOCK |
---|
1859 | return return_status_ok(ok); |
---|
1860 | } |
---|
1861 | |
---|
1862 | PyMOLreturn_float PyMOL_CmdGetDistance(CPyMOL *I, |
---|
1863 | char *selection1, |
---|
1864 | char *selection2, |
---|
1865 | int state, |
---|
1866 | int quiet) |
---|
1867 | { |
---|
1868 | int ok=true; |
---|
1869 | OrthoLineType s1="",s2=""; |
---|
1870 | PyMOLreturn_float result; |
---|
1871 | PYMOL_API_LOCK |
---|
1872 | |
---|
1873 | if(ok) ok = (SelectorGetTmp(I->G,selection1,s1)>=0); |
---|
1874 | if(ok) ok = (SelectorGetTmp(I->G,selection2,s2)>=0); |
---|
1875 | |
---|
1876 | if(ok) { |
---|
1877 | ok = ExecutiveGetDistance(I->G,s1,s2,&result.value,state); |
---|
1878 | result.status = get_status_ok(ok); |
---|
1879 | } else { |
---|
1880 | result.status = PyMOLstatus_FAILURE; |
---|
1881 | result.value = -1.0F; |
---|
1882 | } |
---|
1883 | PYMOL_API_UNLOCK |
---|
1884 | SelectorFreeTmp(I->G,s1); |
---|
1885 | SelectorFreeTmp(I->G,s2); |
---|
1886 | return result; |
---|
1887 | } |
---|
1888 | |
---|
1889 | PyMOLreturn_float PyMOL_CmdDistance(CPyMOL *I, |
---|
1890 | char *name, |
---|
1891 | char *selection1, |
---|
1892 | char *selection2, |
---|
1893 | int mode, |
---|
1894 | float cutoff, |
---|
1895 | int label, |
---|
1896 | int reset, |
---|
1897 | int zoom, |
---|
1898 | int state, |
---|
1899 | int quiet) |
---|
1900 | { |
---|
1901 | int ok=true; |
---|
1902 | OrthoLineType s1="",s2=""; |
---|
1903 | PyMOLreturn_float result; |
---|
1904 | PYMOL_API_LOCK |
---|
1905 | |
---|
1906 | if(ok) ok = (SelectorGetTmp(I->G,selection1,s1)>=0); |
---|
1907 | if(ok) ok = (SelectorGetTmp(I->G,selection2,s2)>=0); |
---|
1908 | |
---|
1909 | if(ok) { |
---|
1910 | ok = ExecutiveDist(I->G,&result.value,name,s1,s2, |
---|
1911 | mode,cutoff,label,quiet,reset,state,zoom); |
---|
1912 | result.status = get_status_ok(ok); |
---|
1913 | } else { |
---|
1914 | result.status = PyMOLstatus_FAILURE; |
---|
1915 | result.value = -1.0F; |
---|
1916 | } |
---|
1917 | PYMOL_API_UNLOCK |
---|
1918 | SelectorFreeTmp(I->G,s1); |
---|
1919 | SelectorFreeTmp(I->G,s2); |
---|
1920 | return result; |
---|
1921 | } |
---|
1922 | |
---|
1923 | PyMOLreturn_float PyMOL_CmdGetAngle(CPyMOL *I, |
---|
1924 | char *selection1, |
---|
1925 | char *selection2, |
---|
1926 | char *selection3, |
---|
1927 | int state, |
---|
1928 | int quiet) |
---|
1929 | { |
---|
1930 | int ok=true; |
---|
1931 | OrthoLineType s1="",s2="",s3=""; |
---|
1932 | PyMOLreturn_float result; |
---|
1933 | PYMOL_API_LOCK |
---|
1934 | |
---|
1935 | if(ok) ok = (SelectorGetTmp(I->G,selection1,s1)>=0); |
---|
1936 | if(ok) ok = (SelectorGetTmp(I->G,selection2,s2)>=0); |
---|
1937 | if(ok) ok = (SelectorGetTmp(I->G,selection3,s3)>=0); |
---|
1938 | |
---|
1939 | if(ok) { |
---|
1940 | ok = ExecutiveGetAngle(I->G,s1,s2,s3,&result.value,state); |
---|
1941 | result.status = get_status_ok(ok); |
---|
1942 | } else { |
---|
1943 | result.status = PyMOLstatus_FAILURE; |
---|
1944 | result.value = 0.0F; |
---|
1945 | } |
---|
1946 | PYMOL_API_UNLOCK |
---|
1947 | SelectorFreeTmp(I->G,s1); |
---|
1948 | SelectorFreeTmp(I->G,s2); |
---|
1949 | SelectorFreeTmp(I->G,s3); |
---|
1950 | return result; |
---|
1951 | } |
---|
1952 | |
---|
1953 | PyMOLreturn_float PyMOL_CmdAngle(CPyMOL *I, |
---|
1954 | char *name, |
---|
1955 | char *selection1, |
---|
1956 | char *selection2, |
---|
1957 | char *selection3, |
---|
1958 | int mode, |
---|
1959 | int label, |
---|
1960 | int reset, |
---|
1961 | int zoom, |
---|
1962 | int state, |
---|
1963 | int quiet) |
---|
1964 | { |
---|
1965 | int ok=true; |
---|
1966 | OrthoLineType s1="",s2="",s3=""; |
---|
1967 | PyMOLreturn_float result; |
---|
1968 | PYMOL_API_LOCK |
---|
1969 | |
---|
1970 | if(ok) ok = (SelectorGetTmp(I->G,selection1,s1)>=0); |
---|
1971 | if(ok) ok = (SelectorGetTmp(I->G,selection2,s2)>=0); |
---|
1972 | if(ok) ok = (SelectorGetTmp(I->G,selection3,s3)>=0); |
---|
1973 | |
---|
1974 | if(ok) { |
---|
1975 | ok = ExecutiveAngle(I->G,&result.value,name,s1,s2,s3, |
---|
1976 | mode,label,reset,zoom,quiet,state); |
---|
1977 | result.status = get_status_ok(ok); |
---|
1978 | } else { |
---|
1979 | result.status = PyMOLstatus_FAILURE; |
---|
1980 | result.value = -1.0F; |
---|
1981 | } |
---|
1982 | PYMOL_API_UNLOCK |
---|
1983 | SelectorFreeTmp(I->G,s1); |
---|
1984 | SelectorFreeTmp(I->G,s2); |
---|
1985 | SelectorFreeTmp(I->G,s3); |
---|
1986 | return result; |
---|
1987 | } |
---|
1988 | |
---|
1989 | |
---|
1990 | PyMOLreturn_float PyMOL_CmdGetDihedral(CPyMOL *I, |
---|
1991 | char *selection1, |
---|
1992 | char *selection2, |
---|
1993 | char *selection3, |
---|
1994 | char *selection4, |
---|
1995 | int state, |
---|
1996 | int quiet) |
---|
1997 | { |
---|
1998 | int ok=true; |
---|
1999 | OrthoLineType s1="",s2="",s3="",s4=""; |
---|
2000 | PyMOLreturn_float result; |
---|
2001 | PYMOL_API_LOCK |
---|
2002 | |
---|
2003 | if(ok) ok = (SelectorGetTmp(I->G,selection1,s1)>=0); |
---|
2004 | if(ok) ok = (SelectorGetTmp(I->G,selection2,s2)>=0); |
---|
2005 | if(ok) ok = (SelectorGetTmp(I->G,selection3,s3)>=0); |
---|
2006 | if(ok) ok = (SelectorGetTmp(I->G,selection4,s4)>=0); |
---|
2007 | |
---|
2008 | if(ok) { |
---|
2009 | ok = ExecutiveGetDihe(I->G,s1,s2,s3,s4,&result.value,state); |
---|
2010 | result.status = get_status_ok(ok); |
---|
2011 | } else { |
---|
2012 | result.status = PyMOLstatus_FAILURE; |
---|
2013 | result.value = 0.0F; |
---|
2014 | } |
---|
2015 | PYMOL_API_UNLOCK |
---|
2016 | SelectorFreeTmp(I->G,s1); |
---|
2017 | SelectorFreeTmp(I->G,s2); |
---|
2018 | SelectorFreeTmp(I->G,s3); |
---|
2019 | SelectorFreeTmp(I->G,s4); |
---|
2020 | return result; |
---|
2021 | } |
---|
2022 | |
---|
2023 | PyMOLreturn_float PyMOL_CmdDihedral(CPyMOL *I, |
---|
2024 | char *name, |
---|
2025 | char *selection1, |
---|
2026 | char *selection2, |
---|
2027 | char *selection3, |
---|
2028 | char *selection4, |
---|
2029 | int mode, |
---|
2030 | int label, |
---|
2031 | int reset, |
---|
2032 | int zoom, |
---|
2033 | int state, |
---|
2034 | int quiet) |
---|
2035 | { |
---|
2036 | int ok=true; |
---|
2037 | OrthoLineType s1="",s2="",s3="",s4=""; |
---|
2038 | PyMOLreturn_float result; |
---|
2039 | PYMOL_API_LOCK |
---|
2040 | |
---|
2041 | if(ok) ok = (SelectorGetTmp(I->G,selection1,s1)>=0); |
---|
2042 | if(ok) ok = (SelectorGetTmp(I->G,selection2,s2)>=0); |
---|
2043 | if(ok) ok = (SelectorGetTmp(I->G,selection3,s3)>=0); |
---|
2044 | if(ok) ok = (SelectorGetTmp(I->G,selection4,s4)>=0); |
---|
2045 | |
---|
2046 | if(ok) { |
---|
2047 | ok = ExecutiveDihedral(I->G,&result.value,name,s1,s2,s3,s4, |
---|
2048 | mode,label,reset,zoom,quiet,state); |
---|
2049 | result.status = get_status_ok(ok); |
---|
2050 | } else { |
---|
2051 | result.status = PyMOLstatus_FAILURE; |
---|
2052 | result.value = -1.0F; |
---|
2053 | } |
---|
2054 | PYMOL_API_UNLOCK |
---|
2055 | SelectorFreeTmp(I->G,s1); |
---|
2056 | SelectorFreeTmp(I->G,s2); |
---|
2057 | SelectorFreeTmp(I->G,s3); |
---|
2058 | SelectorFreeTmp(I->G,s4); |
---|
2059 | return result; |
---|
2060 | } |
---|
2061 | |
---|
2062 | static PyMOLreturn_status Loader(CPyMOL *I,char *content, char *content_type, |
---|
2063 | int content_length, char *content_format, |
---|
2064 | char *object_name, int state, |
---|
2065 | int discrete, int finish, |
---|
2066 | int quiet, int multiplex, int zoom) |
---|
2067 | { |
---|
2068 | OVreturn_word result; |
---|
2069 | int type_code = 0; |
---|
2070 | int format_code = 0; |
---|
2071 | int ok = true; |
---|
2072 | WordType obj_name; |
---|
2073 | |
---|
2074 | if(!OVreturn_IS_OK( (result= OVLexicon_BorrowFromCString(I->Lex,content_type)))) |
---|
2075 | ok = false; |
---|
2076 | else |
---|
2077 | type_code = result.word; |
---|
2078 | |
---|
2079 | if(ok) { |
---|
2080 | if(!OVreturn_IS_OK( (result= OVLexicon_BorrowFromCString(I->Lex,content_format)))) |
---|
2081 | ok = false; |
---|
2082 | else |
---|
2083 | format_code = result.word; |
---|
2084 | } |
---|
2085 | |
---|
2086 | if(ok) { |
---|
2087 | if((type_code != I->lex_filename) && |
---|
2088 | (type_code != I->lex_string) && |
---|
2089 | (type_code != I->lex_raw) && |
---|
2090 | (type_code != I->lex_cgo)) { |
---|
2091 | |
---|
2092 | ok = false; |
---|
2093 | } |
---|
2094 | } |
---|
2095 | if(ok) { |
---|
2096 | |
---|
2097 | /* handling of multiplex option */ |
---|
2098 | |
---|
2099 | if(multiplex==-2) /* use setting default value */ |
---|
2100 | multiplex = SettingGetGlobal_i(I->G,cSetting_multiplex); |
---|
2101 | if(multiplex<0) /* default behavior is not to multiplex */ |
---|
2102 | multiplex = 0; |
---|
2103 | |
---|
2104 | /* handing of discete option */ |
---|
2105 | |
---|
2106 | if(discrete<0) {/* use default discrete behavior for the file format |
---|
2107 | * this will be the case for MOL2 and SDF */ |
---|
2108 | if(multiplex==1) /* if also multiplexing, then default discrete |
---|
2109 | * behavior is not load as discrete objects */ |
---|
2110 | discrete=0; |
---|
2111 | else |
---|
2112 | discrete=1; /* otherwise, allow discrete to be the default */ |
---|
2113 | } |
---|
2114 | |
---|
2115 | { /* if object_name is blank and content is a filename, then |
---|
2116 | compute the object_name from the file prefix */ |
---|
2117 | if((!object_name[0])&&(type_code == I->lex_filename)) { |
---|
2118 | char *start, *stop; |
---|
2119 | stop = start = content + strlen(content)-1; |
---|
2120 | while(start>content) { /* known path separators */ |
---|
2121 | if((start[-1]==':')|| |
---|
2122 | (start[-1]=='\'')|| |
---|
2123 | (start[-1]=='/')) |
---|
2124 | break; |
---|
2125 | start--; |
---|
2126 | } |
---|
2127 | while(stop>start) { |
---|
2128 | if(*stop=='.') |
---|
2129 | break; |
---|
2130 | stop--; |
---|
2131 | } |
---|
2132 | if(stop==start) |
---|
2133 | stop = content + strlen(content); |
---|
2134 | if((stop-start) >=sizeof(WordType)) |
---|
2135 | stop = start+sizeof(WordType)-1; |
---|
2136 | { |
---|
2137 | char *p,*q; |
---|
2138 | p=start; |
---|
2139 | q=obj_name; |
---|
2140 | while(p<stop) { |
---|
2141 | *(q++)=*(p++); |
---|
2142 | } |
---|
2143 | *q=0; |
---|
2144 | object_name = obj_name; |
---|
2145 | } |
---|
2146 | } |
---|
2147 | } |
---|
2148 | { |
---|
2149 | int pymol_content_type = cLoadTypeUnknown; |
---|
2150 | CObject *existing_object = NULL; |
---|
2151 | |
---|
2152 | /* convert text format strings into integral load types */ |
---|
2153 | |
---|
2154 | if(format_code == I->lex_pdb) { |
---|
2155 | if((type_code == I->lex_raw) ||(type_code == I->lex_string)) |
---|
2156 | pymol_content_type = cLoadTypePDBStr; |
---|
2157 | else if( type_code == I->lex_filename) |
---|
2158 | pymol_content_type = cLoadTypePDB; |
---|
2159 | } else if(format_code == I->lex_mol2) { |
---|
2160 | if((type_code == I->lex_raw) || (type_code == I->lex_string)) |
---|
2161 | pymol_content_type = cLoadTypeMOL2Str; |
---|
2162 | else if( type_code == I->lex_filename) |
---|
2163 | pymol_content_type = cLoadTypeMOL2; |
---|
2164 | } else if(format_code == I->lex_mol) { |
---|
2165 | if((type_code == I->lex_raw) || (type_code == I->lex_string)) |
---|
2166 | pymol_content_type = cLoadTypeMOLStr; |
---|
2167 | else if( type_code == I->lex_filename) |
---|
2168 | pymol_content_type = cLoadTypeMOL; |
---|
2169 | } else if(format_code == I->lex_sdf) { |
---|
2170 | if((type_code == I->lex_raw) || (type_code == I->lex_string)) |
---|
2171 | pymol_content_type = cLoadTypeSDF2Str; |
---|
2172 | else if( type_code == I->lex_filename) |
---|
2173 | pymol_content_type = cLoadTypeSDF2; |
---|
2174 | } else if(format_code == I->lex_ccp4) { |
---|
2175 | if((type_code == I->lex_raw) || (type_code == I->lex_string)) |
---|
2176 | pymol_content_type = cLoadTypeCCP4Str; |
---|
2177 | } else if(format_code == I->lex_xplor) { |
---|
2178 | if((type_code == I->lex_raw) || (type_code == I->lex_string)) |
---|
2179 | pymol_content_type = cLoadTypeXPLORStr; |
---|
2180 | } else if(format_code == I->lex_cgo) { |
---|
2181 | if(type_code == I->lex_cgo) { |
---|
2182 | pymol_content_type = cLoadTypeCGO; |
---|
2183 | } |
---|
2184 | } |
---|
2185 | |
---|
2186 | if(pymol_content_type != cLoadTypeUnknown) { |
---|
2187 | existing_object = ExecutiveGetExistingCompatible(I->G, |
---|
2188 | object_name, |
---|
2189 | pymol_content_type); |
---|
2190 | } |
---|
2191 | |
---|
2192 | /* measure the length if it wasn't provided */ |
---|
2193 | |
---|
2194 | if(content_length<0) { |
---|
2195 | if(type_code == I->lex_string) |
---|
2196 | content_length = strlen(content); |
---|
2197 | } |
---|
2198 | |
---|
2199 | switch(pymol_content_type) { |
---|
2200 | case cLoadTypePDB: |
---|
2201 | case cLoadTypePDBStr: |
---|
2202 | case cLoadTypeMOL: |
---|
2203 | case cLoadTypeMOLStr: |
---|
2204 | case cLoadTypeMOL2: |
---|
2205 | case cLoadTypeMOL2Str: |
---|
2206 | case cLoadTypeSDF2: |
---|
2207 | case cLoadTypeSDF2Str: |
---|
2208 | case cLoadTypeXPLORMap: |
---|
2209 | case cLoadTypeXPLORStr: |
---|
2210 | case cLoadTypeCCP4Map: |
---|
2211 | case cLoadTypeCCP4Str: |
---|
2212 | case cLoadTypeCGO: |
---|
2213 | ok = ExecutiveLoad(I->G, existing_object, |
---|
2214 | content, content_length, |
---|
2215 | pymol_content_type, |
---|
2216 | object_name, |
---|
2217 | state-1, zoom, |
---|
2218 | discrete, finish, |
---|
2219 | multiplex, quiet, NULL); |
---|
2220 | break; |
---|
2221 | default: |
---|
2222 | ok=false; |
---|
2223 | break; |
---|
2224 | } |
---|
2225 | } |
---|
2226 | } |
---|
2227 | return return_status_ok(ok); |
---|
2228 | } |
---|
2229 | |
---|
2230 | PyMOLreturn_status PyMOL_CmdLoad(CPyMOL *I,char *content, |
---|
2231 | char *content_type, |
---|
2232 | char *content_format, |
---|
2233 | char *object_name, int state, |
---|
2234 | int discrete, int finish, |
---|
2235 | int quiet, int multiplex, int zoom) |
---|
2236 | { |
---|
2237 | PyMOLreturn_status status; |
---|
2238 | PYMOL_API_LOCK |
---|
2239 | status = Loader(I,content, content_type, -1, content_format, object_name, |
---|
2240 | state, discrete, finish, quiet, multiplex, zoom); |
---|
2241 | PYMOL_API_UNLOCK |
---|
2242 | return status; |
---|
2243 | } |
---|
2244 | |
---|
2245 | PyMOLreturn_status PyMOL_CmdLoadRaw(CPyMOL *I,char *content, |
---|
2246 | int content_length, |
---|
2247 | char *content_format, |
---|
2248 | char *object_name, int state, |
---|
2249 | int discrete, int finish, |
---|
2250 | int quiet, int multiplex, int zoom) |
---|
2251 | { |
---|
2252 | PyMOLreturn_status status; |
---|
2253 | PYMOL_API_LOCK |
---|
2254 | status = Loader(I,content, "raw", content_length, content_format, |
---|
2255 | object_name, state, discrete, finish, quiet, multiplex, zoom); |
---|
2256 | PYMOL_API_UNLOCK |
---|
2257 | return status; |
---|
2258 | } |
---|
2259 | |
---|
2260 | PyMOLreturn_status PyMOL_CmdLoadCGO(CPyMOL *I,float *content, |
---|
2261 | int content_length, |
---|
2262 | char *object_name, int state, |
---|
2263 | int quiet, int zoom) |
---|
2264 | { |
---|
2265 | PyMOLreturn_status status; |
---|
2266 | PYMOL_API_LOCK |
---|
2267 | status = Loader(I, (char*)content, "cgo", content_length, "cgo", |
---|
2268 | object_name, state, 0, 1, quiet, 0, zoom); |
---|
2269 | PYMOL_API_UNLOCK |
---|
2270 | return status; |
---|
2271 | } |
---|
2272 | |
---|
2273 | static const CPyMOLOptions Defaults = { |
---|
2274 | true, /* pmgui */ |
---|
2275 | #ifndef _PYMOL_NOPY |
---|
2276 | true, /* internal_gui*/ |
---|
2277 | #else |
---|
2278 | false, |
---|
2279 | #endif |
---|
2280 | #ifndef _PYMOL_NOPY |
---|
2281 | true, /* show_splash */ |
---|
2282 | #else |
---|
2283 | false, |
---|
2284 | #endif |
---|
2285 | #ifndef _PYMOL_NOPY |
---|
2286 | 1, /* internal_feedback */ |
---|
2287 | #else |
---|
2288 | 0, |
---|
2289 | #endif |
---|
2290 | true, /* security */ |
---|
2291 | false, /* game mode */ |
---|
2292 | 0, /* force_stereo */ |
---|
2293 | 640, /* winX */ |
---|
2294 | 480, /* winY */ |
---|
2295 | false, /* blue_line */ |
---|
2296 | 0, /* winPX */ |
---|
2297 | 175, /* winPY */ |
---|
2298 | true, /* external_gui */ |
---|
2299 | true, /* siginthand */ |
---|
2300 | false, /* reuse helper */ |
---|
2301 | false, /* auto reinitialize */ |
---|
2302 | false, /* keep thread alive */ |
---|
2303 | false, /* quiet */ |
---|
2304 | false, /* incentive product */ |
---|
2305 | "", /* after_load_script */ |
---|
2306 | 0, /* multisample */ |
---|
2307 | 1, /* window_visible */ |
---|
2308 | 0, /* read_stdin */ |
---|
2309 | 0, /* presentation */ |
---|
2310 | 0, /* defer builds mode */ |
---|
2311 | 0, /* full screen mode */ |
---|
2312 | -1, /* sphere mode */ |
---|
2313 | 0, /* stereo capable */ |
---|
2314 | 0, /* passive stereo */ |
---|
2315 | -1, /* zoom mode */ |
---|
2316 | }; |
---|
2317 | |
---|
2318 | CPyMOLOptions *PyMOLOptions_New(void) |
---|
2319 | { |
---|
2320 | CPyMOLOptions *result = NULL; |
---|
2321 | result = Calloc(CPyMOLOptions,1); |
---|
2322 | if(result) |
---|
2323 | *result = Defaults; |
---|
2324 | return result; |
---|
2325 | } |
---|
2326 | |
---|
2327 | #ifndef _PYMOL_NOPY |
---|
2328 | static void init_python(int argc, char *argv[]) |
---|
2329 | { |
---|
2330 | Py_Initialize(); |
---|
2331 | if(argv) { |
---|
2332 | PySys_SetArgv(argc,argv); |
---|
2333 | } |
---|
2334 | |
---|
2335 | /* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */ |
---|
2336 | #ifdef _MACPYMOL_XCODE |
---|
2337 | /* there appears to be a bug or a race collection in the garbage |
---|
2338 | collector of the Python version that ships with Mac OS -- |
---|
2339 | better to potentially leak a little RAM than crash unexpectedly |
---|
2340 | in a _PyObject_GC_Del call. |
---|
2341 | BTW: PyMOL doesn't itself need the GC, but end-user code |
---|
2342 | might. */ |
---|
2343 | PyRun_SimpleString("import gc"); |
---|
2344 | PyRun_SimpleString("gc.disable()"); |
---|
2345 | #endif |
---|
2346 | /* END PROPRIETARY CODE SEGMENT */ |
---|
2347 | |
---|
2348 | PyEval_InitThreads(); |
---|
2349 | |
---|
2350 | #ifdef _PYMOL_OWN_INTERP |
---|
2351 | { /* NOTE this doesn't work 'cause we can't unpack code in restricted environments! */ |
---|
2352 | |
---|
2353 | /* get us a brand new interpreter, independent of any other */ |
---|
2354 | |
---|
2355 | PyThreadState *tstate = Py_NewInterpreter(); |
---|
2356 | |
---|
2357 | /* now release the first interpreter and use the second */ |
---|
2358 | PyThreadState_Swap(tstate); |
---|
2359 | } |
---|
2360 | #endif |
---|
2361 | |
---|
2362 | PyUnicode_SetDefaultEncoding("utf-8"); /* is this safe & legal? */ |
---|
2363 | PyRun_SimpleString("import sys"); |
---|
2364 | PyRun_SimpleString("import os"); |
---|
2365 | PyRun_SimpleString("sys.path.insert(0,os.environ['PYMOL_PATH']+'/modules')"); |
---|
2366 | |
---|
2367 | /* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */ |
---|
2368 | #ifdef _MACPYMOL_XCODE |
---|
2369 | { /* add an architecture-dependent search path for platform-specific binary modules |
---|
2370 | here we're cheating by using endianness instead of figuring out how to get the |
---|
2371 | true architecture from OS X */ |
---|
2372 | unsigned int val = 0x01020304; |
---|
2373 | unsigned int *i_ptr=&val; |
---|
2374 | char *c_ptr = (char*)i_ptr; |
---|
2375 | if(*c_ptr==0x01) { |
---|
2376 | PyRun_SimpleString("sys.path.insert(0,os.environ['PYMOL_PATH']+'/modules/ppc')"); |
---|
2377 | } else { |
---|
2378 | PyRun_SimpleString("sys.path.insert(0,os.environ['PYMOL_PATH']+'/modules/i386')"); |
---|
2379 | } |
---|
2380 | } |
---|
2381 | #endif |
---|
2382 | /* END PROPRIETARY CODE SEGMENT */ |
---|
2383 | |
---|
2384 | PyRun_SimpleString("import __main__"); |
---|
2385 | { |
---|
2386 | PyObject *P_main = PyImport_AddModule("__main__"); |
---|
2387 | if(!P_main) printf("PyMOL can't find '__main__'\n"); |
---|
2388 | |
---|
2389 | /* set up a dry run through 'import pymol' */ |
---|
2390 | |
---|
2391 | PyObject_SetAttrString(P_main,"pymol_launch",PyInt_FromLong(3)); |
---|
2392 | } |
---|
2393 | |
---|
2394 | /* initiate PyMOL dry run to create __main__.pymol */ |
---|
2395 | |
---|
2396 | PyRun_SimpleString("import pymol"); |
---|
2397 | |
---|
2398 | /* parse arguments */ |
---|
2399 | |
---|
2400 | PyRun_SimpleString("pymol.invocation.parse_args(sys.argv)"); |
---|
2401 | |
---|
2402 | } |
---|
2403 | |
---|
2404 | CPyMOLOptions *PyMOLOptions_NewWithPython(int argc, char *argv[]) |
---|
2405 | { |
---|
2406 | CPyMOLOptions *result = PyMOLOptions_New(); |
---|
2407 | |
---|
2408 | /* use Python to parse options based on the command line */ |
---|
2409 | |
---|
2410 | init_python(argc,argv); |
---|
2411 | PGetOptions(result); |
---|
2412 | return result; |
---|
2413 | } |
---|
2414 | #endif |
---|
2415 | |
---|
2416 | void PyMOLOptions_Free(CPyMOLOptions *options) |
---|
2417 | { |
---|
2418 | FreeP(options); |
---|
2419 | } |
---|
2420 | |
---|
2421 | void PyMOL_ResetProgress(CPyMOL *I) |
---|
2422 | { |
---|
2423 | I->ProgressChanged = true; |
---|
2424 | UtilZeroMem(I->Progress, sizeof(int)*6); |
---|
2425 | } |
---|
2426 | |
---|
2427 | void PyMOL_SetProgress(CPyMOL *I,int offset, int current, int range) |
---|
2428 | { |
---|
2429 | switch(offset) { |
---|
2430 | case PYMOL_PROGRESS_SLOW: |
---|
2431 | case PYMOL_PROGRESS_MED: |
---|
2432 | case PYMOL_PROGRESS_FAST: |
---|
2433 | if(current!=I->Progress[offset]) { |
---|
2434 | I->Progress[offset] = current; |
---|
2435 | I->ProgressChanged = true; |
---|
2436 | } |
---|
2437 | if(range!=I->Progress[offset+1]) { |
---|
2438 | I->Progress[offset+1] = range; |
---|
2439 | I->ProgressChanged = true; |
---|
2440 | } |
---|
2441 | } |
---|
2442 | } |
---|
2443 | |
---|
2444 | int PyMOL_GetProgress(CPyMOL *I,int *progress,int reset) |
---|
2445 | { |
---|
2446 | int a; |
---|
2447 | int result = I->ProgressChanged; |
---|
2448 | for(a=0;a<PYMOL_PROGRESS_SIZE;a++) { |
---|
2449 | progress[a] = I->Progress[a]; |
---|
2450 | } |
---|
2451 | if(reset) |
---|
2452 | I->ProgressChanged=false; |
---|
2453 | return result; |
---|
2454 | } |
---|
2455 | |
---|
2456 | int PyMOL_GetProgressChanged(CPyMOL *I,int reset) |
---|
2457 | { |
---|
2458 | int result = I->ProgressChanged; |
---|
2459 | if(reset) |
---|
2460 | I->ProgressChanged=false; |
---|
2461 | return result; |
---|
2462 | } |
---|
2463 | |
---|
2464 | static CPyMOL *_PyMOL_New(void) |
---|
2465 | { |
---|
2466 | CPyMOL *result = NULL; |
---|
2467 | |
---|
2468 | /* allocate global container */ |
---|
2469 | |
---|
2470 | if( (result = Calloc(CPyMOL,1)) ) { /* all values initialized to zero */ |
---|
2471 | |
---|
2472 | if( (result->G = Calloc(PyMOLGlobals,1)) ) { |
---|
2473 | |
---|
2474 | result->G->PyMOL = result; /* store the instance pointer */ |
---|
2475 | |
---|
2476 | result->BusyFlag = false; |
---|
2477 | result->InterruptFlag = false; |
---|
2478 | PyMOL_ResetProgress(result); |
---|
2479 | |
---|
2480 | #ifndef _PYMOL_NOPY |
---|
2481 | /* temporary global pointer for the transition period */ |
---|
2482 | TempPyMOLGlobals=result->G; |
---|
2483 | #endif |
---|
2484 | |
---|
2485 | /* continue initialization */ |
---|
2486 | |
---|
2487 | } else { |
---|
2488 | FreeP(result); |
---|
2489 | } |
---|
2490 | } |
---|
2491 | return result; |
---|
2492 | } |
---|
2493 | |
---|
2494 | static void _PyMOL_Config(CPyMOL *I) |
---|
2495 | { |
---|
2496 | I->G->HaveGUI = I->G->Option->pmgui; |
---|
2497 | I->G->Security = I->G->Option->security; |
---|
2498 | } |
---|
2499 | |
---|
2500 | CPyMOL *PyMOL_New(void) |
---|
2501 | { |
---|
2502 | CPyMOL *result = _PyMOL_New(); |
---|
2503 | if(result && result->G) { |
---|
2504 | result->G->Option = Calloc(CPyMOLOptions,1); |
---|
2505 | if(result->G->Option) |
---|
2506 | (*result->G->Option) = Defaults; |
---|
2507 | _PyMOL_Config(result); |
---|
2508 | } |
---|
2509 | return result; |
---|
2510 | } |
---|
2511 | |
---|
2512 | CPyMOL *PyMOL_NewWithOptions(CPyMOLOptions *option) |
---|
2513 | { |
---|
2514 | CPyMOL *result = _PyMOL_New(); |
---|
2515 | if(result && result->G) { |
---|
2516 | result->G->Option = Calloc(CPyMOLOptions,1); |
---|
2517 | if(result->G->Option) |
---|
2518 | *(result->G->Option) = *option; |
---|
2519 | _PyMOL_Config(result); |
---|
2520 | } |
---|
2521 | result->G->StereoCapable = option->stereo_capable; |
---|
2522 | return result; |
---|
2523 | } |
---|
2524 | |
---|
2525 | |
---|
2526 | |
---|
2527 | void PyMOL_Start(CPyMOL *I) |
---|
2528 | { |
---|
2529 | PyMOLGlobals *G=I->G; |
---|
2530 | |
---|
2531 | G->Context = OVContext_New(); |
---|
2532 | G->Lexicon = OVLexicon_New(G->Context->heap); |
---|
2533 | |
---|
2534 | if(OVreturn_IS_ERROR(PyMOL_InitAPI(I))) { |
---|
2535 | printf("ERROR: PyMOL internal C API initialization failed.\n"); |
---|
2536 | } |
---|
2537 | |
---|
2538 | MemoryCacheInit(G); |
---|
2539 | FeedbackInit(G,G->Option->quiet); |
---|
2540 | WordInit(G); |
---|
2541 | UtilInit(G); |
---|
2542 | ColorInit(G); |
---|
2543 | CGORendererInit(G); |
---|
2544 | SettingInitGlobal(G,true,true); |
---|
2545 | SettingSetGlobal_i(G,cSetting_internal_gui,G->Option->internal_gui); |
---|
2546 | SettingSetGlobal_i(G,cSetting_internal_feedback,G->Option->internal_feedback); |
---|
2547 | TextureInit(G); |
---|
2548 | TypeInit(G); |
---|
2549 | TextInit(G); |
---|
2550 | CharacterInit(G); |
---|
2551 | PlugIOManagerInit(G); |
---|
2552 | SphereInit(G); |
---|
2553 | OrthoInit(G,G->Option->show_splash); |
---|
2554 | WizardInit(G); /* must come after ortho */ |
---|
2555 | SceneInit(G); |
---|
2556 | MovieInit(G); |
---|
2557 | SelectorInit(G); |
---|
2558 | SeqInit(G); |
---|
2559 | SeekerInit(G); |
---|
2560 | ButModeInit(G); |
---|
2561 | ControlInit(G); |
---|
2562 | AtomInfoInit(G); |
---|
2563 | SculptCacheInit(G); |
---|
2564 | VFontInit(G); |
---|
2565 | ExecutiveInit(G); |
---|
2566 | IsosurfInit(G); |
---|
2567 | TetsurfInit(G); |
---|
2568 | EditorInit(G); |
---|
2569 | |
---|
2570 | #ifdef TRACKER_UNIT_TEST |
---|
2571 | TrackerUnitTest(G); |
---|
2572 | #endif |
---|
2573 | |
---|
2574 | /* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */ |
---|
2575 | #ifdef _MACPYMOL_XCODE |
---|
2576 | SettingSetGlobal_b(G,cSetting_stereo_double_pump_mono, true); |
---|
2577 | if(G->Option->stereo_capable) { |
---|
2578 | SettingSetGlobal_i(G,cSetting_stereo_mode, 1); |
---|
2579 | } |
---|
2580 | /* SettingSetGlobal_i(G,cSetting_show_progress, 0); */ |
---|
2581 | #endif |
---|
2582 | /* END PROPRIETARY CODE SEGMENT */ |
---|
2583 | |
---|
2584 | I->RedisplayFlag = true; |
---|
2585 | G->Ready = true; |
---|
2586 | } |
---|
2587 | |
---|
2588 | #ifndef _PYMOL_NOPY |
---|
2589 | |
---|
2590 | /* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */ |
---|
2591 | #ifdef _MACPYMOL_XCODE |
---|
2592 | void init_cmd(void); |
---|
2593 | void initExtensionClass(void); |
---|
2594 | void initsglite(void); |
---|
2595 | void init_champ(void); |
---|
2596 | #endif |
---|
2597 | /* END PROPRIETARY CODE SEGMENT */ |
---|
2598 | |
---|
2599 | void PyMOL_StartWithPython(CPyMOL *I) |
---|
2600 | { |
---|
2601 | PyMOL_Start(I); |
---|
2602 | |
---|
2603 | { |
---|
2604 | PyObject *P_main = PyImport_AddModule("__main__"); |
---|
2605 | if(!P_main) printf("PyMOL can't find '__main__'\n"); |
---|
2606 | |
---|
2607 | /* set up for embedded-style launch */ |
---|
2608 | PyObject_SetAttrString(P_main,"pymol_launch",PyInt_FromLong(5)); |
---|
2609 | } |
---|
2610 | |
---|
2611 | /* initialize our embedded C modules */ |
---|
2612 | |
---|
2613 | /* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */ |
---|
2614 | #ifdef _MACPYMOL_XCODE |
---|
2615 | init_cmd(); |
---|
2616 | initExtensionClass(); |
---|
2617 | initsglite(); |
---|
2618 | init_champ(); |
---|
2619 | #endif |
---|
2620 | /* END PROPRIETARY CODE SEGMENT */ |
---|
2621 | |
---|
2622 | /* launch pymol's Python subsystems */ |
---|
2623 | |
---|
2624 | PyRun_SimpleString("import sys;reload(sys.modules['pymol'])"); |
---|
2625 | |
---|
2626 | /* now locate all the C to Python function hooks and objects we need */ |
---|
2627 | |
---|
2628 | #ifdef _MACPYMOL_XCODE |
---|
2629 | PInit(I->G,true); |
---|
2630 | #else |
---|
2631 | PInit(I->G,false); |
---|
2632 | #endif |
---|
2633 | |
---|
2634 | /* and begin the initialization sequence */ |
---|
2635 | |
---|
2636 | I->PythonInitStage = 1; |
---|
2637 | |
---|
2638 | /* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */ |
---|
2639 | #ifdef _MACPYMOL_XCODE |
---|
2640 | MacPyMOLOption = I->G->Option; |
---|
2641 | MacPyMOLReady = &I->G->Ready; |
---|
2642 | #endif |
---|
2643 | /* END PROPRIETARY CODE SEGMENT */ |
---|
2644 | } |
---|
2645 | #endif |
---|
2646 | |
---|
2647 | void PyMOL_Stop(CPyMOL *I) |
---|
2648 | { |
---|
2649 | PyMOLGlobals *G=I->G; |
---|
2650 | G->Terminating=true; |
---|
2651 | TetsurfFree(G); |
---|
2652 | IsosurfFree(G); |
---|
2653 | WizardFree(G); |
---|
2654 | SceneCleanupStereo(G); |
---|
2655 | EditorFree(G); |
---|
2656 | ExecutiveFree(G); |
---|
2657 | VFontFree(G); |
---|
2658 | SculptCacheFree(G); |
---|
2659 | AtomInfoFree(G); |
---|
2660 | ButModeFree(G); |
---|
2661 | ControlFree(G); |
---|
2662 | SeekerFree(G); |
---|
2663 | SeqFree(G); |
---|
2664 | SelectorFree(G); |
---|
2665 | MovieFree(G); |
---|
2666 | SceneFree(G); |
---|
2667 | OrthoFree(G); |
---|
2668 | SettingFreeGlobal(G); |
---|
2669 | CharacterFree(G); |
---|
2670 | TextFree(G); |
---|
2671 | TypeFree(G); |
---|
2672 | TextureFree(G); |
---|
2673 | SphereFree(G); |
---|
2674 | PlugIOManagerFree(G); |
---|
2675 | PFree(); |
---|
2676 | CGORendererFree(G); |
---|
2677 | ColorFree(G); |
---|
2678 | UtilFree(G); |
---|
2679 | WordFree(G); |
---|
2680 | FeedbackFree(G); |
---|
2681 | MemoryCacheDone(G); |
---|
2682 | |
---|
2683 | PyMOL_PurgeAPI(I); |
---|
2684 | /* printf("%d \n", OVLexicon_GetNActive(G->Lexicon));*/ |
---|
2685 | OVLexicon_Del(G->Lexicon); |
---|
2686 | OVContext_Del(G->Context); |
---|
2687 | #ifndef _PYMOL_NOPY |
---|
2688 | FreeP(G->P_inst); |
---|
2689 | #endif |
---|
2690 | |
---|
2691 | } |
---|
2692 | |
---|
2693 | |
---|
2694 | |
---|
2695 | void PyMOL_Free(CPyMOL *I) |
---|
2696 | { |
---|
2697 | PYMOL_API_LOCK |
---|
2698 | /* take PyMOL down gracefully */ |
---|
2699 | PyMOLOptions_Free(I->G->Option); |
---|
2700 | FreeP(I->G); |
---|
2701 | #ifndef _PYMOL_NOPY |
---|
2702 | #ifdef _PYMOL_OWN_INTERP |
---|
2703 | if(I->PythonInitStage) { /* shut down this interpreter gracefully, then free the GIL for others to use */ |
---|
2704 | PBlock(G); |
---|
2705 | { /* should this be moved into a PDestroy?() to clear out the thread record too? */ |
---|
2706 | PyThreadState *tstate = PyEval_SaveThread(); |
---|
2707 | PyEval_AcquireThread(tstate); |
---|
2708 | Py_EndInterpreter(tstate); |
---|
2709 | PyEval_ReleaseLock(); |
---|
2710 | } |
---|
2711 | } |
---|
2712 | #endif |
---|
2713 | #endif |
---|
2714 | FreeP(I); |
---|
2715 | return; |
---|
2716 | PYMOL_API_UNLOCK; |
---|
2717 | } |
---|
2718 | |
---|
2719 | struct _PyMOLGlobals *PyMOL_GetGlobals(CPyMOL *I) |
---|
2720 | { |
---|
2721 | return I->G; |
---|
2722 | } |
---|
2723 | |
---|
2724 | struct _PyMOLGlobals **PyMOL_GetGlobalsHandle(CPyMOL *I) |
---|
2725 | { |
---|
2726 | return &(I->G); |
---|
2727 | } |
---|
2728 | |
---|
2729 | void PyMOL_Draw(CPyMOL *I) |
---|
2730 | { |
---|
2731 | PYMOL_API_LOCK |
---|
2732 | |
---|
2733 | PyMOLGlobals *G = I->G; |
---|
2734 | |
---|
2735 | if(I->DraggedFlag) { |
---|
2736 | if(ControlIdling(I->G)) { |
---|
2737 | ExecutiveSculptIterateAll(I->G); |
---|
2738 | } |
---|
2739 | I->DraggedFlag = false; |
---|
2740 | } |
---|
2741 | if(G->HaveGUI) { |
---|
2742 | |
---|
2743 | PyMOL_PushValidContext(I); |
---|
2744 | |
---|
2745 | /* get us into a well defined GL state */ |
---|
2746 | |
---|
2747 | /*glMatrixMode(GL_PROJECTION); |
---|
2748 | glLoadIdentity(); |
---|
2749 | glMatrixMode(GL_MODELVIEW); |
---|
2750 | glLoadIdentity();*/ |
---|
2751 | |
---|
2752 | glDisable(GL_ALPHA_TEST); |
---|
2753 | glDisable(GL_AUTO_NORMAL); |
---|
2754 | glDisable(GL_BLEND); |
---|
2755 | glDisable(GL_COLOR_LOGIC_OP); |
---|
2756 | glDisable(GL_COLOR_MATERIAL); |
---|
2757 | glDisable(GL_CULL_FACE); |
---|
2758 | |
---|
2759 | glDisable(GL_DEPTH_TEST); |
---|
2760 | glDisable(GL_DITHER); |
---|
2761 | glDisable(GL_FOG); |
---|
2762 | glDisable(GL_LIGHTING); |
---|
2763 | glDisable(GL_LIGHT0); |
---|
2764 | glDisable(GL_LIGHT1); |
---|
2765 | glDisable(GL_LINE_SMOOTH); |
---|
2766 | glDisable(GL_NORMALIZE); |
---|
2767 | glDisable(GL_POLYGON_SMOOTH); |
---|
2768 | |
---|
2769 | /* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */ |
---|
2770 | #ifdef _MACPYMOL_XCODE |
---|
2771 | { /* on a mac, this can change if we've switched contexts...*/ |
---|
2772 | GLboolean state; |
---|
2773 | glGetBooleanv(GL_STEREO, &state); |
---|
2774 | G->StereoCapable = (int) state; |
---|
2775 | } |
---|
2776 | #endif |
---|
2777 | /* END PROPRIETARY CODE SEGMENT */ |
---|
2778 | |
---|
2779 | } |
---|
2780 | |
---|
2781 | I->RedisplayFlag = false; |
---|
2782 | |
---|
2783 | OrthoBusyPrime(G); |
---|
2784 | ExecutiveDrawNow(G); |
---|
2785 | |
---|
2786 | if(I->ImageRequestedFlag) { |
---|
2787 | if(SceneHasImage(G)) { |
---|
2788 | I->ImageReadyFlag = true; |
---|
2789 | I->ImageRequestedFlag = false; |
---|
2790 | { |
---|
2791 | int w, h; |
---|
2792 | SceneGetImageSize(I->G,&w,&h); |
---|
2793 | } |
---|
2794 | |
---|
2795 | } else { |
---|
2796 | I->ImageReadyFlag = false; |
---|
2797 | } |
---|
2798 | } else if(I->ImageReadyFlag) { |
---|
2799 | if(!SceneHasImage(G)) |
---|
2800 | I->ImageReadyFlag = false; |
---|
2801 | } |
---|
2802 | |
---|
2803 | if(G->HaveGUI) PyMOL_PopValidContext(I); |
---|
2804 | |
---|
2805 | PYMOL_API_UNLOCK |
---|
2806 | |
---|
2807 | } |
---|
2808 | |
---|
2809 | void PyMOL_Key(CPyMOL *I,unsigned char k, int x, int y, int modifiers) |
---|
2810 | { |
---|
2811 | PYMOL_API_LOCK |
---|
2812 | |
---|
2813 | PyMOLGlobals *G = I->G; |
---|
2814 | |
---|
2815 | if(!WizardDoKey(G,k,x,y,modifiers)) |
---|
2816 | OrthoKey(G,k,x,y,modifiers); |
---|
2817 | PYMOL_API_UNLOCK |
---|
2818 | } |
---|
2819 | |
---|
2820 | |
---|
2821 | void PyMOL_Special(CPyMOL *I,int k, int x, int y, int modifiers) |
---|
2822 | { |
---|
2823 | PYMOL_API_LOCK |
---|
2824 | |
---|
2825 | PyMOLGlobals *G = I->G; |
---|
2826 | |
---|
2827 | int grabbed = false; |
---|
2828 | char buffer[255]; |
---|
2829 | |
---|
2830 | if(!grabbed) |
---|
2831 | grabbed = WizardDoKey(G,(unsigned char)k,x,y,modifiers); |
---|
2832 | |
---|
2833 | switch(k) { |
---|
2834 | case P_GLUT_KEY_UP: |
---|
2835 | case P_GLUT_KEY_DOWN: |
---|
2836 | grabbed=1; |
---|
2837 | OrthoSpecial(G,k,x,y,modifiers); |
---|
2838 | break; |
---|
2839 | case P_GLUT_KEY_LEFT: |
---|
2840 | case P_GLUT_KEY_RIGHT: |
---|
2841 | if(OrthoArrowsGrabbed(G)) { |
---|
2842 | grabbed=1; |
---|
2843 | OrthoSpecial(G,k,x,y,modifiers); |
---|
2844 | } |
---|
2845 | break; |
---|
2846 | } |
---|
2847 | |
---|
2848 | if(!grabbed) { |
---|
2849 | sprintf(buffer,"_special %d,%d,%d,%d",k,x,y,modifiers); |
---|
2850 | PLog(G,buffer,cPLog_pml); |
---|
2851 | PParse(G,buffer); |
---|
2852 | PFlush(G); |
---|
2853 | } |
---|
2854 | PYMOL_API_UNLOCK |
---|
2855 | } |
---|
2856 | |
---|
2857 | void PyMOL_Reshape(CPyMOL *I,int width, int height, int force) |
---|
2858 | { |
---|
2859 | PYMOL_API_LOCK |
---|
2860 | PyMOLGlobals *G = I->G; |
---|
2861 | |
---|
2862 | |
---|
2863 | G->Option->winX = width; |
---|
2864 | G->Option->winY = height; |
---|
2865 | |
---|
2866 | OrthoReshape(G,width,height,force); |
---|
2867 | PYMOL_API_UNLOCK |
---|
2868 | } |
---|
2869 | |
---|
2870 | int PyMOL_Idle(CPyMOL *I) |
---|
2871 | { |
---|
2872 | |
---|
2873 | int did_work = false; |
---|
2874 | PYMOL_API_LOCK |
---|
2875 | |
---|
2876 | PyMOLGlobals *G = I->G; |
---|
2877 | |
---|
2878 | I->DraggedFlag = false; |
---|
2879 | if(I->IdleAndReady<IDLE_AND_READY) { |
---|
2880 | I->IdleAndReady++; |
---|
2881 | } |
---|
2882 | if(I->FakeDragFlag==1) { |
---|
2883 | I->FakeDragFlag = false; |
---|
2884 | OrthoFakeDrag(G); |
---|
2885 | did_work = true; |
---|
2886 | } |
---|
2887 | |
---|
2888 | if(ControlIdling(G)) { |
---|
2889 | ExecutiveSculptIterateAll(G); |
---|
2890 | did_work = true; |
---|
2891 | } |
---|
2892 | |
---|
2893 | SceneIdle(G); |
---|
2894 | |
---|
2895 | if(SceneRovingCheckDirty(G)) { |
---|
2896 | SceneRovingUpdate(G); |
---|
2897 | did_work = true; |
---|
2898 | } |
---|
2899 | |
---|
2900 | PFlush(G); |
---|
2901 | |
---|
2902 | #ifndef _PYMOL_NOPY |
---|
2903 | if(I->PythonInitStage>0) { |
---|
2904 | if(I->PythonInitStage<2) { |
---|
2905 | I->PythonInitStage++; |
---|
2906 | } else { |
---|
2907 | I->PythonInitStage=-1; |
---|
2908 | PBlock(G); |
---|
2909 | |
---|
2910 | /* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */ |
---|
2911 | #ifdef _MACPYMOL_XCODE |
---|
2912 | /* restore working directory if asked to */ |
---|
2913 | PRunStringModule(G,"if os.environ.has_key('PYMOL_WD'): os.chdir(os.environ['PYMOL_WD'])"); |
---|
2914 | PRunStringModule(G,"launch_gui()"); |
---|
2915 | #endif |
---|
2916 | /* END PROPRIETARY CODE SEGMENT */ |
---|
2917 | PRunStringInstance(G,"adapt_to_hardware()"); |
---|
2918 | PRunStringInstance(G,"exec_deferred()"); |
---|
2919 | PUnblock(G); |
---|
2920 | PFlush(G); |
---|
2921 | } |
---|
2922 | } |
---|
2923 | #endif |
---|
2924 | |
---|
2925 | PYMOL_API_UNLOCK_NO_FLUSH |
---|
2926 | |
---|
2927 | return did_work; |
---|
2928 | } |
---|
2929 | |
---|
2930 | void PyMOL_ExpireIfIdle(CPyMOL *I) |
---|
2931 | { |
---|
2932 | PYMOL_API_LOCK |
---|
2933 | |
---|
2934 | PyMOLGlobals *G = I->G; |
---|
2935 | int final_init_done = true; |
---|
2936 | #ifndef _PYMOL_NOPY |
---|
2937 | final_init_done = (I->PythonInitStage==-1); |
---|
2938 | #endif |
---|
2939 | |
---|
2940 | if(!G->HaveGUI) { |
---|
2941 | if(final_init_done) { |
---|
2942 | if(!OrthoCommandWaiting(G)) { |
---|
2943 | if((!G->Option->keep_thread_alive)&& |
---|
2944 | (!G->Option->read_stdin)) { |
---|
2945 | I->ExpireCount++; |
---|
2946 | if(I->ExpireCount==10) { |
---|
2947 | PParse(G,"_quit"); |
---|
2948 | } |
---|
2949 | } |
---|
2950 | } |
---|
2951 | } |
---|
2952 | } |
---|
2953 | PYMOL_API_UNLOCK; |
---|
2954 | } |
---|
2955 | |
---|
2956 | void PyMOL_NeedFakeDrag(CPyMOL *I) |
---|
2957 | { |
---|
2958 | I->FakeDragFlag = true; |
---|
2959 | } |
---|
2960 | |
---|
2961 | void PyMOL_NeedRedisplay(CPyMOL *I) |
---|
2962 | { |
---|
2963 | I->RedisplayFlag = true; |
---|
2964 | } |
---|
2965 | |
---|
2966 | void PyMOL_NeedSwap(CPyMOL *I) |
---|
2967 | { |
---|
2968 | I->SwapFlag = true; |
---|
2969 | } |
---|
2970 | |
---|
2971 | void PyMOL_NeedReshape(CPyMOL *I,int mode, int x, int y, int width, int height) |
---|
2972 | { |
---|
2973 | PyMOLGlobals *G = I->G; |
---|
2974 | if(width<0) { |
---|
2975 | int h; |
---|
2976 | BlockGetSize(SceneGetBlock(G),&width,&h); |
---|
2977 | if(SettingGetGlobal_b(G,cSetting_internal_gui)) |
---|
2978 | width+=SettingGetGlobal_i(G,cSetting_internal_gui_width); |
---|
2979 | } |
---|
2980 | |
---|
2981 | /* if height is negative, force a reshape based on the current height */ |
---|
2982 | |
---|
2983 | if(height<0) { |
---|
2984 | int w; |
---|
2985 | int internal_feedback; |
---|
2986 | BlockGetSize(SceneGetBlock(G),&w,&height); |
---|
2987 | internal_feedback = (int)SettingGet(G,cSetting_internal_feedback); |
---|
2988 | if(internal_feedback) |
---|
2989 | height+=(internal_feedback-1)*cOrthoLineHeight+cOrthoBottomSceneMargin; |
---|
2990 | if(SettingGetGlobal_b(G,cSetting_seq_view)&&!SettingGetGlobal_b(G,cSetting_seq_view_overlay)) |
---|
2991 | height+=SeqGetHeight(G); |
---|
2992 | } |
---|
2993 | |
---|
2994 | if(G->HaveGUI) { |
---|
2995 | I->ReshapeFlag = true; |
---|
2996 | I->Reshape[0] = mode; |
---|
2997 | I->Reshape[1] = x; |
---|
2998 | I->Reshape[2] = y; |
---|
2999 | I->Reshape[3] = width; |
---|
3000 | I->Reshape[4] = height; |
---|
3001 | PyMOL_NeedRedisplay(I); |
---|
3002 | } else { |
---|
3003 | /* if no gui, then force immediate reshape */ |
---|
3004 | PyMOLGlobals *G = I->G; |
---|
3005 | |
---|
3006 | G->Option->winX = width; |
---|
3007 | G->Option->winY = height; |
---|
3008 | |
---|
3009 | OrthoReshape(G,width,height,true); |
---|
3010 | } |
---|
3011 | } |
---|
3012 | |
---|
3013 | int PyMOL_GetIdleAndReady(CPyMOL *I) |
---|
3014 | { |
---|
3015 | return (I->IdleAndReady==IDLE_AND_READY); |
---|
3016 | } |
---|
3017 | |
---|
3018 | int PyMOL_GetReshape(CPyMOL *I) |
---|
3019 | { |
---|
3020 | return I->ReshapeFlag; |
---|
3021 | } |
---|
3022 | |
---|
3023 | PyMOLreturn_int_array PyMOL_GetReshapeInfo(CPyMOL *I,int reset) |
---|
3024 | { |
---|
3025 | PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, PYMOL_RESHAPE_SIZE, NULL }; |
---|
3026 | if(reset) |
---|
3027 | I->ReshapeFlag = false; |
---|
3028 | result.array = VLAlloc(int,PYMOL_RESHAPE_SIZE); |
---|
3029 | if(!result.array) { |
---|
3030 | result.status = PyMOLstatus_FAILURE; |
---|
3031 | } else { |
---|
3032 | int a; |
---|
3033 | for(a=0;a<PYMOL_RESHAPE_SIZE;a++) |
---|
3034 | result.array[a] = I->Reshape[a]; |
---|
3035 | } |
---|
3036 | |
---|
3037 | return result; |
---|
3038 | } |
---|
3039 | |
---|
3040 | void PyMOL_SetPassive(CPyMOL *I,int onOff) |
---|
3041 | { |
---|
3042 | I->PassiveFlag = onOff; |
---|
3043 | } |
---|
3044 | |
---|
3045 | void PyMOL_SetClickReady(CPyMOL *I, char *name, int index, int button, int mod,int x,int y) |
---|
3046 | { |
---|
3047 | |
---|
3048 | if(name && name[0] && (index>=0)) { |
---|
3049 | I->ClickReadyFlag = true; |
---|
3050 | strcpy(I->ClickedObject,name); |
---|
3051 | I->ClickedIndex = index; |
---|
3052 | I->ClickedButton = button; |
---|
3053 | I->ClickedModifiers = mod; |
---|
3054 | I->ClickedX = x; |
---|
3055 | I->ClickedY = y; |
---|
3056 | } else { |
---|
3057 | I->ClickedObject[0] = 0; |
---|
3058 | I->ClickReadyFlag = true; |
---|
3059 | I->ClickedX = x; |
---|
3060 | I->ClickedY = y; |
---|
3061 | I->ClickedIndex = index; |
---|
3062 | I->ClickedButton = button; |
---|
3063 | I->ClickedModifiers = mod; |
---|
3064 | } |
---|
3065 | } |
---|
3066 | |
---|
3067 | int PyMOL_GetClickReady(CPyMOL *I, int reset) |
---|
3068 | { |
---|
3069 | int result = I->ClickReadyFlag; |
---|
3070 | if(reset) { |
---|
3071 | I->ClickReadyFlag = false; |
---|
3072 | } |
---|
3073 | return result; |
---|
3074 | } |
---|
3075 | |
---|
3076 | char *PyMOL_GetClickString(CPyMOL *I,int reset) |
---|
3077 | { |
---|
3078 | char *result = NULL; |
---|
3079 | PYMOL_API_LOCK |
---|
3080 | int ready = I->ClickReadyFlag; |
---|
3081 | if(reset) |
---|
3082 | I->ClickReadyFlag = false; |
---|
3083 | if(ready) { |
---|
3084 | result = Alloc(char, OrthoLineLength+1); |
---|
3085 | if(result) { |
---|
3086 | WordType butstr="left", modstr=""; |
---|
3087 | result[0]=0; |
---|
3088 | switch(I->ClickedButton) { |
---|
3089 | case P_GLUT_SINGLE_LEFT: |
---|
3090 | strcpy(butstr,"single_left"); |
---|
3091 | break; |
---|
3092 | case P_GLUT_SINGLE_MIDDLE: |
---|
3093 | strcpy(butstr,"single_middle"); |
---|
3094 | break; |
---|
3095 | case P_GLUT_SINGLE_RIGHT: |
---|
3096 | strcpy(butstr,"single_right"); |
---|
3097 | break; |
---|
3098 | case P_GLUT_DOUBLE_LEFT: |
---|
3099 | strcpy(butstr,"double_left"); |
---|
3100 | break; |
---|
3101 | case P_GLUT_DOUBLE_MIDDLE: |
---|
3102 | strcpy(butstr,"double_middle"); |
---|
3103 | break; |
---|
3104 | case P_GLUT_DOUBLE_RIGHT: |
---|
3105 | strcpy(butstr,"double_right"); |
---|
3106 | break; |
---|
3107 | } |
---|
3108 | if(cOrthoCTRL & I->ClickedModifiers) { |
---|
3109 | if(modstr[0]) strcat(modstr," "); |
---|
3110 | strcat(modstr,"ctrl"); |
---|
3111 | } |
---|
3112 | if(cOrthoALT & I->ClickedModifiers) { |
---|
3113 | if(modstr[0]) strcat(modstr," "); |
---|
3114 | strcat(modstr,"alt"); |
---|
3115 | } |
---|
3116 | if(cOrthoSHIFT & I->ClickedModifiers) { |
---|
3117 | if(modstr[0]) strcat(modstr," "); |
---|
3118 | strcat(modstr,"shift"); |
---|
3119 | } |
---|
3120 | if(!I->ClickedObject[0]) { |
---|
3121 | sprintf(result, |
---|
3122 | "type=none\nclick=%s\nmod_keys=%s\nx=%d\ny=%d\n", |
---|
3123 | butstr, |
---|
3124 | modstr, |
---|
3125 | I->ClickedX, |
---|
3126 | I->ClickedY); |
---|
3127 | } else { |
---|
3128 | ObjectMolecule *obj = ExecutiveFindObjectMoleculeByName(I->G,I->ClickedObject); |
---|
3129 | if(obj && (I->ClickedIndex < obj->NAtom)) { |
---|
3130 | AtomInfoType *ai = obj->AtomInfo + I->ClickedIndex; |
---|
3131 | sprintf(result, |
---|
3132 | "type=object:molecule\nobject=%s\nindex=%d\nrank=%d\nid=%d\nsegi=%s\nchain=%s\nresn=%s\nresi=%s\nname=%s\nalt=%s\nclick=%s\nmod_keys=%s\nx=%d\ny=%d\n", |
---|
3133 | I->ClickedObject, |
---|
3134 | I->ClickedIndex+1, |
---|
3135 | ai->rank, |
---|
3136 | ai->id, |
---|
3137 | ai->segi, |
---|
3138 | ai->chain, |
---|
3139 | ai->resn, |
---|
3140 | ai->resi, |
---|
3141 | ai->name, |
---|
3142 | ai->alt, |
---|
3143 | butstr, |
---|
3144 | modstr, |
---|
3145 | I->ClickedX, |
---|
3146 | I->ClickedY); |
---|
3147 | } |
---|
3148 | } |
---|
3149 | } |
---|
3150 | } |
---|
3151 | PYMOL_API_UNLOCK |
---|
3152 | return(result); |
---|
3153 | } |
---|
3154 | |
---|
3155 | int PyMOL_GetImageReady(CPyMOL *I, int reset) |
---|
3156 | { |
---|
3157 | int result = I->ImageReadyFlag; |
---|
3158 | if(reset) { |
---|
3159 | I->ImageReadyFlag = false; |
---|
3160 | } |
---|
3161 | return result; |
---|
3162 | } |
---|
3163 | |
---|
3164 | PyMOLreturn_int_array PyMOL_GetImageInfo(CPyMOL *I) |
---|
3165 | { |
---|
3166 | PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 2, NULL }; |
---|
3167 | PYMOL_API_LOCK |
---|
3168 | result.array = VLAlloc(int,2); |
---|
3169 | if(!result.array) { |
---|
3170 | result.status = PyMOLstatus_FAILURE; |
---|
3171 | } else { |
---|
3172 | SceneGetImageSize(I->G,result.array,result.array+1); |
---|
3173 | } |
---|
3174 | PYMOL_API_UNLOCK |
---|
3175 | return result; |
---|
3176 | } |
---|
3177 | |
---|
3178 | int PyMOL_GetImageData(CPyMOL *I, |
---|
3179 | int width, int height, |
---|
3180 | int row_bytes, void *buffer, |
---|
3181 | int mode, int reset) |
---|
3182 | { |
---|
3183 | int ok=true; |
---|
3184 | PYMOL_API_LOCK |
---|
3185 | if(reset) |
---|
3186 | I->ImageReadyFlag=false; |
---|
3187 | ok = SceneCopyExternal(I->G,width, height, row_bytes,(unsigned char *)buffer,mode); |
---|
3188 | PYMOL_API_UNLOCK |
---|
3189 | return get_status_ok(ok); |
---|
3190 | } |
---|
3191 | |
---|
3192 | int PyMOL_FreeResultString(CPyMOL *I,char *st) |
---|
3193 | { |
---|
3194 | PYMOL_API_LOCK |
---|
3195 | FreeP(st); |
---|
3196 | PYMOL_API_UNLOCK |
---|
3197 | return get_status_ok((st!=NULL)); |
---|
3198 | } |
---|
3199 | |
---|
3200 | int PyMOL_GetRedisplay(CPyMOL *I, int reset) |
---|
3201 | { |
---|
3202 | int result = I->RedisplayFlag; |
---|
3203 | |
---|
3204 | PYMOL_API_LOCK |
---|
3205 | PyMOLGlobals *G = I->G; |
---|
3206 | |
---|
3207 | if(result) { |
---|
3208 | if(SettingGet_b(G,NULL,NULL,cSetting_defer_updates)) { |
---|
3209 | result = false; |
---|
3210 | } else { |
---|
3211 | if(reset) |
---|
3212 | I->RedisplayFlag = false; |
---|
3213 | } |
---|
3214 | } |
---|
3215 | PYMOL_API_UNLOCK_NO_FLUSH |
---|
3216 | return result; |
---|
3217 | } |
---|
3218 | |
---|
3219 | int PyMOL_GetPassive(CPyMOL *I, int reset) |
---|
3220 | {/* lock intentionally omitted */ |
---|
3221 | int result = I->PassiveFlag; |
---|
3222 | if(reset) |
---|
3223 | I->PassiveFlag = false; |
---|
3224 | return result; |
---|
3225 | } |
---|
3226 | |
---|
3227 | int PyMOL_GetSwap(CPyMOL *I, int reset) |
---|
3228 | {/* lock intentionally omitted */ |
---|
3229 | int result = I->SwapFlag; |
---|
3230 | if(reset) |
---|
3231 | I->SwapFlag = false; |
---|
3232 | return result; |
---|
3233 | } |
---|
3234 | |
---|
3235 | int PyMOL_GetBusy(CPyMOL *I, int reset) |
---|
3236 | {/* lock intentionally omitted */ |
---|
3237 | int result = I->BusyFlag; |
---|
3238 | if(reset) |
---|
3239 | PyMOL_SetBusy(I,false); |
---|
3240 | return result; |
---|
3241 | } |
---|
3242 | |
---|
3243 | |
---|
3244 | void PyMOL_SetBusy(CPyMOL *I, int value) |
---|
3245 | {/* lock intentionally omitted */ |
---|
3246 | if(!I->BusyFlag) |
---|
3247 | /* if we weren't busy before, then reset the progress indicators */ |
---|
3248 | PyMOL_ResetProgress(I); |
---|
3249 | |
---|
3250 | I->BusyFlag = value; |
---|
3251 | |
---|
3252 | if(!I->BusyFlag) /* reset the interrupt flag once we're done being busy */ |
---|
3253 | PyMOL_SetInterrupt(I,false); |
---|
3254 | } |
---|
3255 | |
---|
3256 | int PyMOL_GetInterrupt(CPyMOL *I, int reset) |
---|
3257 | { /* lock intentionally omitted */ |
---|
3258 | int result = I->InterruptFlag; |
---|
3259 | |
---|
3260 | if(reset) |
---|
3261 | PyMOL_SetInterrupt(I,false); |
---|
3262 | |
---|
3263 | return result; |
---|
3264 | } |
---|
3265 | |
---|
3266 | void PyMOL_SetInterrupt(CPyMOL *I, int value) |
---|
3267 | {/* lock intentionally omitted */ |
---|
3268 | I->InterruptFlag = value; |
---|
3269 | } |
---|
3270 | |
---|
3271 | |
---|
3272 | void PyMOL_Drag(CPyMOL *I,int x, int y, int modifiers) |
---|
3273 | { |
---|
3274 | PYMOL_API_LOCK |
---|
3275 | OrthoDrag(I->G,x,y,modifiers); |
---|
3276 | I->DraggedFlag = true; |
---|
3277 | PYMOL_API_UNLOCK |
---|
3278 | } |
---|
3279 | |
---|
3280 | void PyMOL_Button(CPyMOL *I,int button, int state,int x, int y, int modifiers) |
---|
3281 | { |
---|
3282 | PYMOL_API_LOCK |
---|
3283 | OrthoButton(I->G,button,state,x,y,modifiers); |
---|
3284 | PYMOL_API_UNLOCK |
---|
3285 | } |
---|
3286 | |
---|
3287 | void PyMOL_SetSwapBuffersFn(CPyMOL *I, PyMOLSwapBuffersFn *fn) |
---|
3288 | { |
---|
3289 | I->SwapFn = fn; |
---|
3290 | } |
---|
3291 | |
---|
3292 | void PyMOL_SwapBuffers(CPyMOL *I) |
---|
3293 | { |
---|
3294 | if(I->SwapFn && I->G->ValidContext) { |
---|
3295 | I->SwapFn(); |
---|
3296 | I->SwapFlag = false; |
---|
3297 | } else { |
---|
3298 | I->SwapFlag = true; |
---|
3299 | } |
---|
3300 | } |
---|
3301 | |
---|
3302 | void PyMOL_RunTest(CPyMOL *I, int group, int test) |
---|
3303 | { |
---|
3304 | PYMOL_API_LOCK |
---|
3305 | TestPyMOLRun(I->G, group, test); |
---|
3306 | PYMOL_API_UNLOCK |
---|
3307 | } |
---|
3308 | |
---|
3309 | void PyMOL_PushValidContext(CPyMOL *I) |
---|
3310 | { |
---|
3311 | if(I && I->G) |
---|
3312 | I->G->ValidContext++; |
---|
3313 | } |
---|
3314 | void PyMOL_PopValidContext(CPyMOL *I) |
---|
3315 | { |
---|
3316 | if(I && I->G && (I->G->ValidContext>0)) |
---|
3317 | I->G->ValidContext--; |
---|
3318 | } |
---|
3319 | |
---|
3320 | void PyMOL_SetDefaultMouse(CPyMOL *I) |
---|
3321 | { |
---|
3322 | PYMOL_API_LOCK |
---|
3323 | PyMOLGlobals *G = I->G; |
---|
3324 | |
---|
3325 | ButModeSet(G,cButModeLeftNone,cButModeRotXYZ); |
---|
3326 | ButModeSet(G,cButModeMiddleNone,cButModeTransXY); |
---|
3327 | ButModeSet(G,cButModeRightNone,cButModeTransZ); |
---|
3328 | |
---|
3329 | ButModeSet(G,cButModeLeftShft,cButModePotentialClick); |
---|
3330 | ButModeSet(G,cButModeMiddleShft,cButModePotentialClick); |
---|
3331 | ButModeSet(G,cButModeRightShft,cButModeClipNF); |
---|
3332 | |
---|
3333 | ButModeSet(G,cButModeLeftCtrl,cButModePotentialClick); |
---|
3334 | ButModeSet(G,cButModeMiddleCtrl,cButModePotentialClick); |
---|
3335 | ButModeSet(G,cButModeRightCtrl,cButModePotentialClick); |
---|
3336 | |
---|
3337 | ButModeSet(G,cButModeLeftCtSh,cButModePotentialClick); |
---|
3338 | ButModeSet(G,cButModeMiddleCtSh,cButModePotentialClick); |
---|
3339 | ButModeSet(G,cButModeRightCtSh,cButModePotentialClick); |
---|
3340 | |
---|
3341 | ButModeSet(G,cButModeWheelNone,cButModeScaleSlab); |
---|
3342 | ButModeSet(G,cButModeWheelShft,cButModeMoveSlab); |
---|
3343 | ButModeSet(G,cButModeWheelCtrl,cButModeMoveSlabAndZoom); |
---|
3344 | ButModeSet(G,cButModeWheelCtSh,cButModeTransZ); |
---|
3345 | |
---|
3346 | ButModeSet(G,cButModeMiddleCtSh,cButModeOrigAt); |
---|
3347 | |
---|
3348 | ButModeSet(G,cButModeLeftSingle,cButModeSimpleClick); |
---|
3349 | ButModeSet(G,cButModeMiddleSingle,cButModeCent); |
---|
3350 | ButModeSet(G,cButModeRightSingle,cButModeSimpleClick); |
---|
3351 | |
---|
3352 | ButModeSet(G,cButModeLeftDouble,cButModeSimpleClick); |
---|
3353 | ButModeSet(G,cButModeRightDouble,cButModeSimpleClick); |
---|
3354 | |
---|
3355 | { |
---|
3356 | int a; |
---|
3357 | for(a=cButModeLeftShftDouble;a<=cButModeRightCtrlAltShftSingle;a++) { |
---|
3358 | ButModeSet(G,a,cButModeSimpleClick); |
---|
3359 | } |
---|
3360 | for(a=cButModeLeftAlt;a<=cButModeRightCtrlAltShft;a++) { |
---|
3361 | ButModeSet(G,a,cButModePotentialClick); |
---|
3362 | } |
---|
3363 | |
---|
3364 | } |
---|
3365 | G->Feedback->Mask[FB_Scene] &= ~(FB_Results); /* suppress click messages */ |
---|
3366 | PYMOL_API_UNLOCK |
---|
3367 | } |
---|
3368 | |
---|