~ubuntu-branches/ubuntu/breezy/garlic/breezy

« back to all changes in this revision

Viewing changes to hide.c

  • Committer: Bazaar Package Importer
  • Author(s): zhaoway
  • Date: 2001-04-24 07:09:13 UTC
  • Revision ID: james.westby@ubuntu.com-20010424070913-uzpupnwdfhmliebz
Tags: upstream-1.1
ImportĀ upstreamĀ versionĀ 1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2000 Damir Zucic */
 
2
 
 
3
/*=============================================================================
 
4
 
 
5
                                hide.c
 
6
 
 
7
Purpose:
 
8
        Execute hide command: hide the selected atoms, i.e. set hiddenF to
 
9
        one for selected atoms.  Only the  caught  complexes  are treated.
 
10
        For atoms which are not selected visibility status is not changed.
 
11
 
 
12
Input:
 
13
        (1) Pointer to MolComplexS structure, with macromol. complexes.
 
14
        (2) The number of macromolecular complexes.
 
15
        (3) Pointer to RuntimeS structure, with some runtime data.
 
16
        (4) Pointer to ConfigS structure, with configuration data.
 
17
        (5) Pointer to GUIS structure, with GUI data.
 
18
        (6) Pointer to NearestAtomS structure.
 
19
        (7) The number of pixels in the main window free area.
 
20
        (8) Pointer to refreshI.
 
21
 
 
22
Output:
 
23
        (1) The hiddenF set for each atom in each caught complex.
 
24
        (2) Return value.
 
25
 
 
26
Return value:
 
27
        (1) The command code.
 
28
 
 
29
========includes:============================================================*/
 
30
 
 
31
#include <stdio.h>
 
32
 
 
33
#include <X11/Xlib.h>
 
34
#include <X11/Xutil.h>
 
35
#include <X11/Xos.h>
 
36
#include <X11/Xatom.h>
 
37
 
 
38
#include "defines.h"
 
39
#include "commands.h"
 
40
#include "typedefs.h"
 
41
 
 
42
/*======function prototypes:=================================================*/
 
43
 
 
44
int             HideBackbone_ (MolComplexS *, int);
 
45
size_t          MainRefresh_ (MolComplexS *, int,
 
46
                              RuntimeS *, ConfigS *, GUIS *,
 
47
                              NearestAtomS *, size_t, unsigned int);
 
48
int             ControlRefresh_ (MolComplexS *, ConfigS *, GUIS *);
 
49
 
 
50
/*======execute hide command:================================================*/
 
51
 
 
52
int Hide_ (MolComplexS *mol_complexSP, int mol_complexesN,
 
53
           RuntimeS *runtimeSP,
 
54
           ConfigS *configSP, GUIS *guiSP,
 
55
           NearestAtomS *nearest_atomSP, size_t pixelsN,
 
56
           unsigned int *refreshIP)
 
57
{
 
58
int             mol_complexI;
 
59
MolComplexS     *curr_mol_complexSP;
 
60
size_t          atomsN, atomI;
 
61
AtomS           *curr_atomSP;
 
62
 
 
63
/* Check every macromolecular complex: */
 
64
for (mol_complexI = 0; mol_complexI < mol_complexesN; mol_complexI++)
 
65
        {
 
66
        /** Pointer to the current macromolecular complex: **/
 
67
        curr_mol_complexSP = mol_complexSP + mol_complexI;
 
68
 
 
69
        /** Check is the current macromolecular complex caught: **/
 
70
        if (curr_mol_complexSP->catchF == 0) continue;
 
71
 
 
72
        /** Number of atoms in a macromolecular complex: **/
 
73
        atomsN = curr_mol_complexSP->atomsN;
 
74
        if (atomsN == 0) continue;
 
75
 
 
76
        /** Scan all atoms in the current complex: **/
 
77
        for (atomI = 0; atomI < atomsN; atomI++)
 
78
                {
 
79
                /** Pointer to the current atom: **/
 
80
                curr_atomSP = curr_mol_complexSP->atomSP + atomI;
 
81
 
 
82
                /** Check the selection flag; hide selected atoms: **/
 
83
                if (curr_atomSP->selectedF) curr_atomSP->hiddenF = 1;
 
84
                }
 
85
        }
 
86
 
 
87
/* Hide backbone (update hiddenF for each selected CA atom): */
 
88
HideBackbone_ (mol_complexSP, mol_complexesN);
 
89
 
 
90
/* Refresh the main window: */
 
91
(*refreshIP)++;
 
92
MainRefresh_ (mol_complexSP, mol_complexesN, runtimeSP, configSP, guiSP,
 
93
              nearest_atomSP, pixelsN, *refreshIP);
 
94
 
 
95
/* Refresh the control window: */
 
96
ControlRefresh_ (mol_complexSP + runtimeSP->default_complexI, configSP, guiSP);
 
97
 
 
98
/* Return the command code: */
 
99
return COMMAND_HIDE;
 
100
}
 
101
 
 
102
/*===========================================================================*/
 
103
 
 
104