2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
8 #include <proto/exec.h>
9 #include <exec/types.h>
10 #include <exec/memory.h>
11 #include <aros/libcall.h>
12 #include <proto/graphics.h>
14 #include "layers_intern.h"
15 #include "basicfuncs.h"
17 /*****************************************************************************
20 #include <proto/layers.h>
21 AROS_LH2(LONG
, ChangeLayerVisibility
,
24 AROS_LHA(struct Layer
*, l
, A0
),
25 AROS_LHA(int , visible
, D0
),
28 struct LayersBase
*, LayersBase
, 41, Layers
)
31 Makes the given layer visible or invisible.
32 If it is a simple refresh layer it will loose all its
33 cliprects and therefore rendering will go into the void.
37 visible - TRUE or FALSE
40 TRUE - layer was changed to new state
41 FALSE - layer could not be changed to new state
44 This is an AROS private function, providing support
45 for showing/hiding windows in intuition.
57 *****************************************************************************/
61 struct Layer
* _l
, * lparent
;
65 if (l
->visible
== visible
)
68 LockLayers(l
->LayerInfo
);
75 * Make the layer visible
76 * Back up all layers behind this layer.
82 if (IS_VISIBLE(_l
) && DO_OVERLAP(&l
->visibleshape
->bounds
, &_l
->shape
->bounds
))
83 _BackupPartsOfLayer(_l
, l
->visibleshape
, 0, FALSE
, LayersBase
);
85 ClearRegionRegion(l
->visibleshape
, _l
->VisibleRegion
);
89 if (IS_VISIBLE(_l
) || (NULL
== lparent
->parent
))
92 lparent
= lparent
->parent
;
98 * For the layer to become visible I must recalculate its
99 * visible area. Search the first visible layer in front of
100 * it and used that one's VisbleRegion minus its visibleshape.
102 ClearRegion(l
->VisibleRegion
);
109 * It's like the top layer since all others are invisible
111 SetRegion(l
->LayerInfo
->check_lp
->shape
, &r
);
117 SetRegion(_l
->VisibleRegion
, &r
);
118 ClearRegionRegion(_l
->visibleshape
, &r
);
127 * Let me show the layer in its full beauty...
129 _ShowPartsOfLayer(l
, &r
, LayersBase
);
131 if (IS_SIMPLEREFRESH(l
))
134 * Add the whole visible area of the layer to the
135 * damage list since for those kind of layers
136 * nothing was backed up.
138 SetRegion(l
->shape
, l
->DamageList
);
139 AndRegionRegion(l
->VisibleRegion
, l
->DamageList
);
141 * Since the Damagelist is relative to the layer I have to make
142 * some adjustments to the coordinates here.
144 _TranslateRect(&l
->DamageList
->bounds
,
147 l
->Flags
|= LAYERREFRESH
;
153 * Make the layer invisible
155 struct Region clearr
;
158 l
->Flags
&= ~LAYERREFRESH
;
159 ClearRegion(l
->DamageList
);
161 SetRegion(l
->VisibleRegion
, &r
);
163 SetRegion(l
->visibleshape
, &clearr
);
164 _BackupPartsOfLayer(l
, &clearr
, 0, FALSE
, LayersBase
);
167 * Walk through all the layers behind this layer and
168 * make them (more) visible...
174 if (IS_VISIBLE(_l
) && DO_OVERLAP(&l
->visibleshape
->bounds
, &_l
->visibleshape
->bounds
))
176 ClearRegion(_l
->VisibleRegion
);
177 _ShowPartsOfLayer(_l
, &r
, LayersBase
);
180 SetRegion(&r
, _l
->VisibleRegion
);
182 if (IS_VISIBLE(_l
) || IS_ROOTLAYER(_l
))
183 AndRegionRegion(_l
->VisibleRegion
, &clearr
);
187 if (IS_VISIBLE(_l
) || (NULL
== lparent
->parent
))
190 lparent
= lparent
->parent
;
194 * Take the shape of the current layer out of
195 * the visible region that will be applied to the
196 * layer behind this one.
199 ClearRegionRegion(_l
->visibleshape
, &r
);
204 if (!IS_EMPTYREGION(&clearr
))
207 (IS_SIMPLEREFRESH(lparent
) || IS_ROOTLAYER(lparent
)))
208 _BackFillRegion(lparent
, &clearr
, FALSE
, LayersBase
);
212 ClearRegion(&clearr
);
216 UnlockLayers(l
->LayerInfo
);
221 } /* ChangeLayerVisibility */