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 21 #ifndef __CD_APPLET_STRUCT__ 22 #define __CD_APPLET_STRUCT__ 23 24 #include <cairo-dock.h> 25 26 typedef enum { 27 CD_ICON_EFFECT_FIRE=0, 28 CD_ICON_EFFECT_STARS, 29 CD_ICON_EFFECT_RAIN, 30 CD_ICON_EFFECT_SNOW, 31 CD_ICON_EFFECT_SAND, 32 CD_ICON_EFFECT_FIREWORK, 33 CD_ICON_EFFECT_NB_EFFECTS 34 } CDIconEffectsEnum; 35 36 typedef struct _CDFirework CDFirework; 37 38 typedef struct _CDIconEffect CDIconEffect; 39 40 typedef struct _CDIconEffectData CDIconEffectData; 41 42 43 44 45 //\___________ structure containing the applet's configuration parameters. 46 struct _AppletConfig { 47 gint iFireDuration; 48 gboolean bContinueFire; 49 gdouble pFireColor1[3]; 50 gdouble pFireColor2[3]; 51 gboolean bMysticalFire; 52 gint iNbFireParticles; 53 gint iFireParticleSize; 54 gdouble fFireParticleSpeed; 55 gboolean bFireLuminance; 56 57 gint iStarDuration; 58 gboolean bContinueStar; 59 gdouble pStarColor1[3]; 60 gdouble pStarColor2[3]; 61 gboolean bMysticalStars; 62 gint iNbStarParticles; 63 gint iStarParticleSize; 64 65 gint iSnowDuration; 66 gboolean bContinueSnow; 67 gdouble pSnowColor1[3]; 68 gdouble pSnowColor2[3]; 69 gint iNbSnowParticles; 70 gint iSnowParticleSize; 71 gdouble fSnowParticleSpeed; 72 73 gint iRainDuration; 74 gboolean bContinueRain; 75 gdouble pRainColor1[3]; 76 gdouble pRainColor2[3]; 77 gint iNbRainParticles; 78 gint iRainParticleSize; 79 gdouble fRainParticleSpeed; 80 81 gint iStormDuration; 82 gboolean bContinueStorm; 83 gdouble pStormColor1[3]; 84 gdouble pStormColor2[3]; 85 gint iNbStormParticles; 86 gint iStormParticleSize; 87 88 gint iFireworkDuration; 89 gboolean bContinueFirework; 90 gdouble pFireworkColor[3]; 91 gboolean bFireworkRandomColors; 92 gint iNbFireworkParticles; 93 gint iFireworkParticleSize; 94 gboolean bFireworkLuminance; 95 gint iNbFireworks; 96 gboolean bFireworkShoot; 97 gdouble fFireworkFriction; 98 gdouble fFireworkRadius; 99 100 gboolean bBackGround; 101 CDIconEffectsEnum iEffectsUsed[CD_ICON_EFFECT_NB_EFFECTS]; 102 CDIconEffectsEnum iEffectsOnClick[CAIRO_DOCK_NB_GROUPS][CD_ICON_EFFECT_NB_EFFECTS]; 103 gboolean bRotateEffects; 104 gboolean bOpeningAnimation; 105 } ; 106 107 //\___________ other structures. 108 struct _CDFirework { 109 gdouble x_expl, y_expl; 110 gdouble r_expl; 111 gdouble v_expl; 112 gdouble t_expl; 113 gdouble x_sol; 114 gdouble vx_decol; 115 gdouble vy_decol; 116 gdouble xf, yf; 117 gdouble r; 118 gdouble t; 119 CairoParticleSystem *pParticleSystem; 120 } ; 121 122 typedef gboolean (*CDIconEffectInit) (Icon *pIcon, CairoDock *pDock, double dt, CDIconEffectData *pData); 123 typedef gboolean (*CDIconEffectUpdate) (Icon *pIcon, CairoDock *pDock, gboolean bWillContinue, CDIconEffectData *pData); 124 typedef void (*CDIconEffectRender) (CDIconEffectData *pData); 125 typedef void (*CDIconEffectFree) (CDIconEffectData *pData); 126 127 struct _CDIconEffect { 128 gint iDuration; 129 gboolean bRepeat; 130 CDIconEffectInit init; 131 CDIconEffectUpdate update; 132 CDIconEffectRender render; 133 CDIconEffectRender post_render; 134 CDIconEffectFree free; 135 } ; 136 137 struct _CDIconEffectData { 138 CairoParticleSystem *pFireSystem; 139 CairoParticleSystem *pStarSystem; 140 CairoParticleSystem *pSnowSystem; 141 CairoParticleSystem *pRainSystem; 142 CairoParticleSystem *pStormSystem; 143 CDFirework *pFireworks; 144 gint iNbFireworks; 145 gint iNumRound; 146 gint iRequestTime; 147 gdouble fAreaWidth, fAreaHeight, fBottomGap; 148 CDIconEffect *pCurrentEffects[CD_ICON_EFFECT_NB_EFFECTS]; 149 //gpointer pEffectsData[CD_ICON_EFFECT_NB_EFFECTS]; 150 } ; 151 152 153 //\___________ structure containing the applet's data, like surfaces, dialogs, results of calculus, etc. 154 struct _AppletData { 155 GLuint iFireTexture; 156 GLuint iStarTexture; 157 GLuint iSnowTexture; 158 GLuint iRainTexture; 159 gint iAnimationID[CD_ICON_EFFECT_NB_EFFECTS]; 160 CDIconEffect pEffects[CD_ICON_EFFECT_NB_EFFECTS]; 161 } ; 162 163 #endif 164