~jroose/cairo-dock-plug-ins/Messaging-Menu-alaric-devel

« back to all changes in this revision

Viewing changes to Animated-icons/src/applet-notifications.c

  • Committer: jroose at gmail
  • Date: 2010-11-18 14:43:40 UTC
  • Revision ID: jroose@gmail.com-20101118144340-qvrs0rmanr5lr1mj
Messaging-Menu

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
* This file is a part of the Cairo-Dock project
 
3
*
 
4
* Copyright : (C) see the 'copyright' file.
 
5
* E-mail    : see the 'copyright' file.
 
6
*
 
7
* This program is free software; you can redistribute it and/or
 
8
* modify it under the terms of the GNU General Public License
 
9
* as published by the Free Software Foundation; either version 3
 
10
* of the License, or (at your option) any later version.
 
11
*
 
12
* This program is distributed in the hope that it will be useful,
 
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
* GNU General Public License for more details.
 
16
* You should have received a copy of the GNU General Public License
 
17
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
*/
 
19
 
 
20
#include <stdlib.h>
 
21
#include <string.h>
 
22
#include <math.h>
 
23
 
 
24
#include "applet-rotation.h"
 
25
#include "applet-spot.h"
 
26
#include "applet-struct.h"
 
27
#include "applet-rays.h"
 
28
#include "applet-wobbly.h"
 
29
#include "applet-mesh-factory.h"
 
30
#include "applet-wave.h"
 
31
#include "applet-pulse.h"
 
32
#include "applet-bounce.h"
 
33
#include "applet-blink.h"
 
34
#include "applet-unfold.h"
 
35
#include "applet-notifications.h"
 
36
 
 
37
#define _REFLECT_FADE_NB_STEP 12
 
38
 
 
39
#define _set_new_data(icon) \
 
40
        CDAnimationData *pData = CD_APPLET_GET_MY_ICON_DATA (pIcon);\
 
41
        if (pData == NULL) {\
 
42
                pData = g_new0 (CDAnimationData, 1);\
 
43
                CD_APPLET_SET_MY_ICON_DATA (pIcon, pData); }\
 
44
        else {\
 
45
                pData->fRadiusFactor = 0;\
 
46
                pData->bIsWobblying = FALSE;\
 
47
                pData->bIsWaving = FALSE;\
 
48
                pData->fPulseAlpha = 0;\
 
49
                pData->bIsBouncing = FALSE;\
 
50
                pData->bIsBlinking = FALSE;\
 
51
                pData->iNumRound = 0;\
 
52
                pData->bIsUnfolding = FALSE; }
 
53
 
 
54
static void _cd_animations_start (gpointer pUserData, Icon *pIcon, CairoDock *pDock, CDAnimationsEffects *pAnimations, gboolean *bStartAnimation)
 
55
{
 
56
        _set_new_data (pIcon);
 
57
        
 
58
        gboolean bUseOpenGL = CAIRO_DOCK_CONTAINER_IS_OPENGL (CAIRO_CONTAINER (pDock));
 
59
        double dt = (bUseOpenGL ? mySystem.iGLAnimationDeltaT : mySystem.iCairoAnimationDeltaT);
 
60
        
 
61
        int i;
 
62
        for (i = 0; i < CD_ANIMATIONS_NB_EFFECTS; i ++)
 
63
        {
 
64
                switch (pAnimations[i])
 
65
                {
 
66
                        case CD_ANIMATIONS_BOUNCE :
 
67
                                cd_animations_init_bounce (pDock, pData, dt);
 
68
                                *bStartAnimation = TRUE;
 
69
                        break;
 
70
                        
 
71
                        case CD_ANIMATIONS_ROTATE :
 
72
                                cd_animations_init_rotation (pData, dt, bUseOpenGL);
 
73
                                *bStartAnimation = TRUE;
 
74
                        break;
 
75
                        
 
76
                        case CD_ANIMATIONS_BLINK :
 
77
                                cd_animations_init_blink (pData, dt);
 
78
                                *bStartAnimation = TRUE;
 
79
                        break;
 
80
                        
 
81
                        case CD_ANIMATIONS_PULSE :
 
82
                                cd_animations_init_pulse (pData, dt);
 
83
                                *bStartAnimation = TRUE;
 
84
                        break;
 
85
                        
 
86
                        case CD_ANIMATIONS_WOBBLY :
 
87
                                cd_animations_init_wobbly (pData, bUseOpenGL);
 
88
                                *bStartAnimation = TRUE;
 
89
                        break;
 
90
                        
 
91
                        case CD_ANIMATIONS_WAVE :
 
92
                                if (! bUseOpenGL)
 
93
                                        break ;
 
94
                                cd_animations_init_wave (pData);
 
95
                                *bStartAnimation = TRUE;
 
96
                        break;
 
97
                        
 
98
                        case CD_ANIMATIONS_SPOT :
 
99
                                if (! bUseOpenGL)
 
100
                                        break ;
 
101
                                cd_animations_init_spot (pIcon, pDock, pData, dt);
 
102
                                *bStartAnimation = TRUE;
 
103
                        break;
 
104
                        
 
105
                        default :
 
106
                                i = CD_ANIMATIONS_NB_EFFECTS - 1;
 
107
                        break;
 
108
                }
 
109
        }
 
110
        if (pData->fRadiusFactor == 0)
 
111
                pData->fIconOffsetY = 0;
 
112
}
 
113
 
 
114
gboolean cd_animations_on_enter (gpointer pUserData, Icon *pIcon, CairoDock *pDock, gboolean *bStartAnimation)
 
115
{
 
116
        if (pIcon->bStatic || ! CAIRO_DOCK_CONTAINER_IS_OPENGL (CAIRO_CONTAINER (pDock)) || pIcon->iAnimationState > CAIRO_DOCK_STATE_MOUSE_HOVERED)
 
117
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
118
        
 
119
        if (pIcon->pSubDock && pIcon->iSubdockViewType == 3 && !myAccessibility.bShowSubDockOnClick)
 
120
        {
 
121
                //cd_animations_free_data (pUserData, pIcon);
 
122
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
123
        }
 
124
        
 
125
        _cd_animations_start (pUserData, pIcon, pDock, myConfig.iEffectsOnMouseOver, bStartAnimation);
 
126
        
 
127
        if (bStartAnimation)
 
128
        {
 
129
                CDAnimationData *pData = CD_APPLET_GET_MY_ICON_DATA (pIcon);
 
130
                pData->iNumRound = 0;
 
131
                cairo_dock_mark_icon_as_hovered_by_mouse (pIcon);
 
132
        }
 
133
        return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
134
}
 
135
 
 
136
gboolean cd_animations_on_click (gpointer pUserData, Icon *pIcon, CairoDock *pDock, gint iButtonState)
 
137
{
 
138
        if (! CAIRO_DOCK_IS_DOCK (pDock) || pIcon->iAnimationState > CAIRO_DOCK_STATE_CLICKED)
 
139
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
140
        
 
141
        if (pIcon->pSubDock && pIcon->iSubdockViewType == 3)
 
142
        {
 
143
                CDAnimationData *pData = CD_APPLET_GET_MY_ICON_DATA (pIcon);
 
144
                if (pData && ! pData->bIsUnfolding)
 
145
                        cd_animations_free_data (pUserData, pIcon);  // on arrete l'animation en cours.
 
146
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
147
        }
 
148
        
 
149
        CairoDockIconType iType = cairo_dock_get_icon_type (pIcon);
 
150
        if (iType == CAIRO_DOCK_LAUNCHER && CAIRO_DOCK_IS_APPLI (pIcon) && ! (iButtonState & GDK_SHIFT_MASK))
 
151
                iType = CAIRO_DOCK_APPLI;
 
152
        /**if (iType == CAIRO_DOCK_APPLI && CAIRO_DOCK_IS_LAUNCHER (pIcon) && iButtonState & GDK_SHIFT_MASK)
 
153
                iType = CAIRO_DOCK_LAUNCHER;*/
 
154
        
 
155
        gboolean bStartAnimation = FALSE;
 
156
        _cd_animations_start (pUserData, pIcon, pDock, myConfig.iEffectsOnClick[iType], &bStartAnimation);
 
157
        if (bStartAnimation)
 
158
        {
 
159
                CDAnimationData *pData = CD_APPLET_GET_MY_ICON_DATA (pIcon);
 
160
                pData->iNumRound = myConfig.iNbRoundsOnClick[iType] - 1;
 
161
                cairo_dock_mark_icon_as_clicked (pIcon);
 
162
        }
 
163
        return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
164
}
 
165
 
 
166
gboolean cd_animations_on_request (gpointer pUserData, Icon *pIcon, CairoDock *pDock, const gchar *cAnimation, gint iNbRounds)
 
167
{
 
168
        if (cAnimation == NULL || pIcon == NULL || pIcon->iAnimationState > CAIRO_DOCK_STATE_CLICKED)
 
169
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
170
        
 
171
        CDAnimationsEffects anim[2] = {0, -1};
 
172
        if (strcmp (cAnimation, "default") == 0)
 
173
        {
 
174
                CairoDockIconType iType = cairo_dock_get_icon_type (pIcon);
 
175
                anim[0] =  myConfig.iEffectsOnClick[iType][0];
 
176
        }
 
177
        else
 
178
        {
 
179
                int iAnimationID = cairo_dock_get_animation_id (cAnimation);
 
180
                if (iAnimationID == myData.iAnimationID[CD_ANIMATIONS_BOUNCE])
 
181
                        anim[0] = CD_ANIMATIONS_BOUNCE;
 
182
                else if (iAnimationID == myData.iAnimationID[CD_ANIMATIONS_ROTATE])
 
183
                        anim[0] = CD_ANIMATIONS_ROTATE;
 
184
                else if (iAnimationID == myData.iAnimationID[CD_ANIMATIONS_BLINK])
 
185
                        anim[0] = CD_ANIMATIONS_BLINK;
 
186
                else if (iAnimationID == myData.iAnimationID[CD_ANIMATIONS_PULSE])
 
187
                        anim[0] = CD_ANIMATIONS_PULSE;
 
188
                else if (iAnimationID == myData.iAnimationID[CD_ANIMATIONS_WOBBLY])
 
189
                        anim[0] = CD_ANIMATIONS_WOBBLY;
 
190
                else if (iAnimationID == myData.iAnimationID[CD_ANIMATIONS_WAVE])
 
191
                        anim[0] = CD_ANIMATIONS_WAVE;
 
192
                else if (iAnimationID == myData.iAnimationID[CD_ANIMATIONS_SPOT])
 
193
                        anim[0] = CD_ANIMATIONS_SPOT;
 
194
                else
 
195
                        return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
196
        }
 
197
        
 
198
        gboolean bStartAnimation = FALSE;
 
199
        _cd_animations_start (pUserData, pIcon, pDock, anim, &bStartAnimation);
 
200
        
 
201
        if (bStartAnimation)
 
202
        {
 
203
                CDAnimationData *pData = CD_APPLET_GET_MY_ICON_DATA (pIcon);
 
204
                pData->iNumRound = iNbRounds - 1;
 
205
                cairo_dock_mark_icon_as_hovered_by_mouse (pIcon);
 
206
        }
 
207
        return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
208
}
 
209
 
 
210
 
 
211
static void _cd_animations_render_rays (Icon *pIcon, CairoDock *pDock, CDAnimationData *pData, int iDepth)
 
212
{
 
213
        glPushMatrix ();
 
214
        if (pDock->container.bIsHorizontal)
 
215
                glTranslatef (0., - pIcon->fHeight * pIcon->fScale/2, 0.);
 
216
        else
 
217
                glTranslatef (- pIcon->fHeight * pIcon->fScale/2, 0., 0.);
 
218
        
 
219
        if (! pDock->container.bIsHorizontal)
 
220
                glRotatef (-90, 0., 0., 1.);
 
221
        
 
222
        if (pData->pRaysSystem != NULL)
 
223
        {
 
224
                cairo_dock_render_particles_full (pData->pRaysSystem, iDepth);
 
225
        }
 
226
 
 
227
        glPopMatrix ();
 
228
}
 
229
gboolean cd_animations_post_render_icon (gpointer pUserData, Icon *pIcon, CairoDock *pDock, gboolean *bHasBeenRendered, cairo_t *pCairoContext)
 
230
{
 
231
        CDAnimationData *pData = CD_APPLET_GET_MY_ICON_DATA (pIcon);
 
232
        if (pData == NULL || pData->bIsUnfolding)
 
233
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
234
        
 
235
        if (pData->bIsBouncing)
 
236
        {
 
237
                if (pCairoContext != NULL)
 
238
                        cd_animations_draw_bounce_cairo (pIcon, pDock, pData, pCairoContext, -1);
 
239
                else
 
240
                        cd_animations_draw_bounce_icon (pIcon, pDock, pData, -1);
 
241
        }
 
242
        
 
243
        if (pData->bIsBlinking)
 
244
        {
 
245
                cd_animations_draw_blink_icon (pIcon, pDock, pData, -1);
 
246
        }
 
247
        
 
248
        if (pData->fRadiusFactor != 0)
 
249
        {
 
250
                if (pDock->container.bIsHorizontal)
 
251
                        glTranslatef (0., - pData->fIconOffsetY * (pDock->container.bDirectionUp ? 1 : -1), 0.);
 
252
                else
 
253
                        glTranslatef (- pData->fIconOffsetY * (pDock->container.bDirectionUp ? -1 : 1), 0., 0.);
 
254
                if (pData->pRaysSystem != NULL)
 
255
                        _cd_animations_render_rays (pIcon, pDock, pData, 1);
 
256
                
 
257
                cd_animation_render_spot_front (pIcon, pDock, pData->fRadiusFactor);
 
258
                if (pData->fHaloRotationAngle > 90 && pData->fHaloRotationAngle < 270)
 
259
                        cd_animation_render_halo (pIcon, pDock, pData->fRadiusFactor, pData->fHaloRotationAngle);
 
260
        }
 
261
        return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
262
}
 
263
 
 
264
gboolean cd_animations_render_icon (gpointer pUserData, Icon *pIcon, CairoDock *pDock, gboolean *bHasBeenRendered, cairo_t *pCairoContext)
 
265
{
 
266
        CDAnimationData *pData = CD_APPLET_GET_MY_ICON_DATA (pIcon);
 
267
        if (pData == NULL)
 
268
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
269
        
 
270
        if (pData->bIsUnfolding && pIcon->pSubDock)
 
271
        {
 
272
                if (pCairoContext != NULL)
 
273
                        cd_animations_draw_unfolding_icon_cairo (pIcon, pDock, pData, pCairoContext);
 
274
                else
 
275
                        cd_animations_draw_unfolding_icon (pIcon, pDock, pData);
 
276
                *bHasBeenRendered = TRUE;
 
277
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
278
        }
 
279
        
 
280
        gboolean bHasBeenPulsed = FALSE;
 
281
        if (*bHasBeenRendered)
 
282
        {
 
283
                if (pData->fPulseAlpha != 0)
 
284
                {
 
285
                        if (pCairoContext != NULL)
 
286
                                cd_animations_draw_pulse_cairo (pIcon, pDock, pData, pCairoContext);
 
287
                        else
 
288
                                cd_animations_draw_pulse_icon (pIcon, pDock, pData);
 
289
                }
 
290
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
291
        }
 
292
        
 
293
        if (pData->bIsBlinking)
 
294
        {
 
295
                cd_animations_draw_blink_icon (pIcon, pDock, pData, 1);
 
296
        }
 
297
        
 
298
        if (pData->fRadiusFactor != 0)
 
299
        {
 
300
                cd_animation_render_spot (pIcon, pDock, pData->fRadiusFactor);
 
301
                if (pData->fHaloRotationAngle <= 90 || pData->fHaloRotationAngle >= 270)
 
302
                        cd_animation_render_halo (pIcon, pDock, pData->fRadiusFactor, pData->fHaloRotationAngle);
 
303
                
 
304
                if (pData->pRaysSystem != NULL)
 
305
                        _cd_animations_render_rays (pIcon, pDock, pData, 1);
 
306
                
 
307
                if (pDock->container.bIsHorizontal)
 
308
                        glTranslatef (0., pData->fIconOffsetY * (pDock->container.bDirectionUp ? 1 : -1), 0.);
 
309
                else
 
310
                        glTranslatef (pData->fIconOffsetY * (pDock->container.bDirectionUp ? -1 : 1), 0., 0.);
 
311
        }
 
312
        
 
313
        if (pData->bIsBouncing)
 
314
        {
 
315
                if (pCairoContext != NULL)
 
316
                        cd_animations_draw_bounce_cairo (pIcon, pDock, pData, pCairoContext, 1);
 
317
                else
 
318
                        cd_animations_draw_bounce_icon (pIcon, pDock, pData, 1);
 
319
        }
 
320
        
 
321
        if (pData->bIsWobblying)
 
322
        {
 
323
                if (pCairoContext != NULL)
 
324
                        cd_animations_draw_wobbly_cairo (pIcon, pDock, pData, pCairoContext);
 
325
                else
 
326
                        cd_animations_draw_wobbly_icon (pIcon, pDock, pData);
 
327
                *bHasBeenRendered = TRUE;
 
328
        }
 
329
        else if (pData->bIsWaving)
 
330
        {
 
331
                cd_animations_draw_wave_icon (pIcon, pDock, pData);
 
332
                *bHasBeenRendered = TRUE;
 
333
        }
 
334
        else if (pData->fRotationSpeed != 0)
 
335
        {
 
336
                if (pCairoContext != NULL)
 
337
                        cd_animations_draw_rotating_cairo (pIcon, pDock, pData, pCairoContext);
 
338
                else
 
339
                {
 
340
                        cd_animations_draw_rotating_icon (pIcon, pDock, pData);
 
341
                        bHasBeenPulsed = myConfig.bPulseSameShape;
 
342
                }
 
343
                *bHasBeenRendered = TRUE;
 
344
        }
 
345
        
 
346
        if (pData->fPulseAlpha != 0 && ! bHasBeenPulsed)
 
347
        {
 
348
                if (pCairoContext != NULL)
 
349
                        cd_animations_draw_pulse_cairo (pIcon, pDock, pData, pCairoContext);
 
350
                else
 
351
                        cd_animations_draw_pulse_icon (pIcon, pDock, pData);
 
352
        }
 
353
        
 
354
        return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
355
}
 
356
 
 
357
 
 
358
#define _will_continue(bRepeat) ((pData->iNumRound > 0) || (pIcon->iAnimationState == CAIRO_DOCK_STATE_MOUSE_HOVERED && bRepeat && pIcon->bPointed && pDock->container.bInside))
 
359
gboolean cd_animations_update_icon (gpointer pUserData, Icon *pIcon, CairoDock *pDock, gboolean *bContinueAnimation)
 
360
{
 
361
        CDAnimationData *pData = CD_APPLET_GET_MY_ICON_DATA (pIcon);
 
362
        if (pData == NULL)
 
363
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
364
        gboolean bUseOpenGL = CAIRO_DOCK_CONTAINER_IS_OPENGL (CAIRO_CONTAINER (pDock));
 
365
        double dt = (bUseOpenGL ? mySystem.iGLAnimationDeltaT : mySystem.iCairoAnimationDeltaT);
 
366
        
 
367
        if (pData->bIsUnfolding)
 
368
        {
 
369
                if (pIcon->pSubDock->fFoldingFactor == 1 || pIcon->pSubDock == NULL || pIcon->pSubDock->icons == NULL)  // fin du pliage.
 
370
                        pData->bIsUnfolding = FALSE;
 
371
                else
 
372
                        *bContinueAnimation = TRUE;
 
373
                cairo_dock_redraw_container (CAIRO_CONTAINER (pDock));  // un peu bourrin ...
 
374
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
375
        }
 
376
        
 
377
        if (pData->bIsWobblying)
 
378
        {
 
379
                if (bUseOpenGL)
 
380
                        pData->bIsWobblying = cd_animations_update_wobbly (pDock, pData, dt, _will_continue (myConfig.bContinueWobbly));
 
381
                else
 
382
                        pData->bIsWobblying = cd_animations_update_wobbly_cairo (pIcon, pDock, pData, _will_continue (myConfig.bContinueWobbly));
 
383
                
 
384
                if (! pData->bIsWobblying && _will_continue (myConfig.bContinueWobbly))
 
385
                {
 
386
                        pData->iNumRound --;
 
387
                        cd_animations_init_wobbly (pData, bUseOpenGL);
 
388
                }
 
389
                if (pData->bIsWobblying)
 
390
                {
 
391
                        pData->iReflectShadeCount = 0;
 
392
                        *bContinueAnimation = TRUE;
 
393
                }
 
394
                else if (bUseOpenGL)
 
395
                        pData->iReflectShadeCount = _REFLECT_FADE_NB_STEP;
 
396
        }
 
397
        if (! pData->bIsWobblying && pData->bIsWaving)
 
398
        {
 
399
                pData->bIsWaving = cd_animations_update_wave (pDock, pData, dt);
 
400
                if (! pData->bIsWaving && _will_continue (myConfig.bContinueWave))
 
401
                {
 
402
                        pData->iNumRound --;
 
403
                        pData->bIsWaving = TRUE;
 
404
                        pData->fWavePosition = - myConfig.fWaveWidth / 2;
 
405
                }
 
406
                if (pData->bIsWaving)
 
407
                {
 
408
                        pData->iReflectShadeCount = 0;
 
409
                        *bContinueAnimation = TRUE;
 
410
                }
 
411
                else if (bUseOpenGL)
 
412
                        pData->iReflectShadeCount = _REFLECT_FADE_NB_STEP;
 
413
        }
 
414
        if (! pData->bIsWobblying && ! pData->bIsWaving && pData->fRotationSpeed != 0)
 
415
        {
 
416
                cd_animations_update_rotating (pIcon, pDock, pData, bUseOpenGL, _will_continue (myConfig.bContinueRotation));
 
417
                if (pData->fRotationAngle < 360)
 
418
                {
 
419
                        pData->iReflectShadeCount = 0;
 
420
                        *bContinueAnimation = TRUE;
 
421
                }
 
422
                else
 
423
                {
 
424
                        if (_will_continue (myConfig.bContinueRotation))
 
425
                        {
 
426
                                pData->fRotationAngle -= 360;
 
427
                                pData->iNumRound --;
 
428
                                pData->iReflectShadeCount = 0;
 
429
                                *bContinueAnimation = TRUE;
 
430
                        }
 
431
                        else
 
432
                        {
 
433
                                pData->fRotationAngle = 0;
 
434
                                pData->fRotationSpeed = 0;
 
435
                                if (bUseOpenGL)
 
436
                                        pData->iReflectShadeCount = _REFLECT_FADE_NB_STEP;
 
437
                        }
 
438
                }
 
439
        }
 
440
        
 
441
        if (pData->iReflectShadeCount != 0)
 
442
        {
 
443
                pData->iReflectShadeCount --;
 
444
                pIcon->fReflectShading = (double) pData->iReflectShadeCount / _REFLECT_FADE_NB_STEP;
 
445
                if (pData->iReflectShadeCount != 0)
 
446
                        *bContinueAnimation = TRUE;
 
447
        }
 
448
        
 
449
        if (pData->fRadiusFactor != 0)
 
450
        {
 
451
                gboolean bContinueSpot = cd_animations_update_spot (pIcon, pDock, pData, dt, _will_continue (myConfig.bContinueSpot));
 
452
                if (bContinueSpot)  // l'animation doit continuer, qu'on ait passe un tour ou pas.
 
453
                        *bContinueAnimation = TRUE;
 
454
                if (pData->fHaloRotationAngle > 360)  // un tour est passe.
 
455
                {
 
456
                        pData->fHaloRotationAngle -= 360;
 
457
                        if (pData->iNumRound > 0)
 
458
                        {
 
459
                                pData->iNumRound --;
 
460
                        }
 
461
                }
 
462
        }
 
463
        
 
464
        if (pData->fPulseAlpha != 0)
 
465
        {
 
466
                gboolean bContinuePulse = cd_animations_update_pulse (pIcon, pDock, pData, bUseOpenGL);
 
467
                if (bContinuePulse)
 
468
                        *bContinueAnimation = TRUE;
 
469
                else if (_will_continue (myConfig.bContinuePulse))
 
470
                {
 
471
                        pData->iNumRound --;
 
472
                        cd_animations_init_pulse (pData, dt);
 
473
                        *bContinueAnimation = TRUE;
 
474
                }
 
475
        }
 
476
        
 
477
        if (pData->bIsBouncing)
 
478
        {
 
479
                pData->bIsBouncing = cd_animations_update_bounce (pIcon, pDock, pData, dt, bUseOpenGL, _will_continue (myConfig.bContinueBounce));
 
480
                if (! pData->bIsBouncing && _will_continue (myConfig.bContinueBounce))
 
481
                {
 
482
                        pData->iNumRound --;
 
483
                        cd_animations_init_bounce (pDock, pData, dt);
 
484
                }
 
485
                if (pData->bIsBouncing)
 
486
                        *bContinueAnimation = TRUE;
 
487
        }
 
488
        
 
489
        if (pData->bIsBlinking)
 
490
        {
 
491
                pData->bIsBlinking = cd_animations_update_blink (pIcon, pDock, pData, dt, bUseOpenGL);
 
492
                if (! pData->bIsBlinking && _will_continue (myConfig.bContinueBlink))
 
493
                {
 
494
                        pData->iNumRound --;
 
495
                        cd_animations_init_blink (pData, dt);
 
496
                }
 
497
                if (pData->bIsBlinking)
 
498
                        *bContinueAnimation = TRUE;
 
499
        }
 
500
        
 
501
        return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
502
}
 
503
 
 
504
 
 
505
gboolean cd_animations_unfold_subdock (gpointer pUserData, Icon *pIcon)  // called on start (un)folding.
 
506
{
 
507
        if (pIcon == NULL || pIcon->iSubdockViewType != 3)
 
508
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
509
        
 
510
        CairoDock *pDock = cairo_dock_search_dock_from_name (pIcon->cParentDockName);
 
511
        if (pDock != NULL)
 
512
        {
 
513
                _set_new_data (pIcon);
 
514
                pData->bIsUnfolding = TRUE;
 
515
                cairo_dock_launch_animation (CAIRO_CONTAINER (pDock));
 
516
        }
 
517
        
 
518
        return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
519
}
 
520
 
 
521
 
 
522
gboolean cd_animations_free_data (gpointer pUserData, Icon *pIcon)
 
523
{
 
524
        CDAnimationData *pData = CD_APPLET_GET_MY_ICON_DATA (pIcon);
 
525
        if (pData == NULL)
 
526
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
527
        
 
528
        cairo_dock_free_particle_system (pData->pRaysSystem);
 
529
        
 
530
        pIcon->fReflectShading = 0.;
 
531
        pIcon->fDeltaYReflection = 0.;
 
532
        
 
533
        g_free (pData);
 
534
        CD_APPLET_SET_MY_ICON_DATA (pIcon, NULL);
 
535
        return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
536
}