2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
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.
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/>.
21
#include <cairo-dock.h>
23
#include "applet-struct.h"
24
#include "applet-config.h"
27
//\_________________ Here you have to get all your parameters from the conf file. Use the macros CD_CONFIG_GET_BOOLEAN, CD_CONFIG_GET_INTEGER, CD_CONFIG_GET_STRING, etc. myConfig has been reseted to 0 at this point. This function is called at the beginning of init and reload.
28
CD_APPLET_GET_CONFIG_BEGIN
30
for (i = 0; i < CD_ANIMATIONS_NB_EFFECTS; i ++)
32
myConfig.iEffectsOnMouseOver[i] = -1;
34
for (j = 0; j < CAIRO_DOCK_NB_GROUPS; j += 2)
36
for (i = 0; i < CD_ANIMATIONS_NB_EFFECTS; i ++)
38
myConfig.iEffectsOnClick[j][i] = -1;
42
CD_CONFIG_GET_INTEGER_LIST ("Global", "hover effects", CD_ANIMATIONS_NB_EFFECTS, (int *)myConfig.iEffectsOnMouseOver);
44
CD_CONFIG_GET_INTEGER_LIST ("Global", "click launchers", CD_ANIMATIONS_NB_EFFECTS,
45
(int *)myConfig.iEffectsOnClick[CAIRO_DOCK_LAUNCHER]);
46
myConfig.iNbRoundsOnClick[CAIRO_DOCK_LAUNCHER] = CD_CONFIG_GET_INTEGER ("Global", "nb rounds launchers");
47
myConfig.bOpeningAnimation = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Global", "opening animation", TRUE);
49
CD_CONFIG_GET_INTEGER_LIST ("Global", "click applis", CD_ANIMATIONS_NB_EFFECTS,
50
(int *)myConfig.iEffectsOnClick[CAIRO_DOCK_APPLI]);
51
myConfig.iNbRoundsOnClick[CAIRO_DOCK_APPLI] = CD_CONFIG_GET_INTEGER ("Global", "nb rounds applis");
53
myConfig.iRotationDuration = CD_CONFIG_GET_INTEGER ("Rotation", "duration");
54
myConfig.bContinue[CD_ANIMATIONS_ROTATE] = CD_CONFIG_GET_BOOLEAN ("Rotation", "continue");
55
myConfig.iMeshType = CD_CONFIG_GET_INTEGER ("Rotation", "mesh");
56
gdouble pMeshColor[4];
57
CD_CONFIG_GET_COLOR_RGBA ("Rotation", "color", pMeshColor);
59
myConfig.pMeshColor[i] = pMeshColor[i];
61
myConfig.bContinue[CD_ANIMATIONS_WOBBLY] = FALSE;
62
myConfig.iInitialStrecth = CD_CONFIG_GET_INTEGER ("Wobbly", "stretch");
63
myConfig.fSpringConstant = CD_CONFIG_GET_DOUBLE ("Wobbly", "spring cst");
64
myConfig.fFriction = CD_CONFIG_GET_DOUBLE ("Wobbly", "friction");
65
myConfig.iNbGridNodes = CD_CONFIG_GET_INTEGER ("Wobbly", "grid nodes");
67
myConfig.iSpotDuration = CD_CONFIG_GET_INTEGER ("Spot", "duration");
68
myConfig.bContinue[CD_ANIMATIONS_SPOT] = CD_CONFIG_GET_BOOLEAN ("Spot", "continue");
69
myConfig.cSpotImage = CD_CONFIG_GET_STRING ("Spot", "spot image");
70
myConfig.cSpotFrontImage = CD_CONFIG_GET_STRING ("Spot", "spot front image");
72
double col[4] = {1.,1.,1.,1.};
73
CD_CONFIG_GET_COLOR_RGB_WITH_DEFAULT ("Spot", "spot-color", pColor, col);
75
myConfig.pSpotColor[i] = pColor[i];
76
CD_CONFIG_GET_COLOR_RGBA_WITH_DEFAULT ("Spot", "halo-color", pColor, col);
78
myConfig.pHaloColor[i] = pColor[i];
79
CD_CONFIG_GET_COLOR_RGB ("Spot", "color1", pColor);
81
myConfig.pRaysColor1[i] = pColor[i];
82
CD_CONFIG_GET_COLOR_RGB ("Spot", "color2", pColor);
84
myConfig.pRaysColor2[i] = pColor[i];
85
myConfig.bMysticalRays = CD_CONFIG_GET_BOOLEAN ("Spot", "mystical");
86
myConfig.iNbRaysParticles = CD_CONFIG_GET_INTEGER ("Spot", "nb part");
87
myConfig.iRaysParticleSize = CD_CONFIG_GET_INTEGER ("Spot", "part size");
88
myConfig.fRaysParticleSpeed = CD_CONFIG_GET_DOUBLE ("Spot", "part speed");
90
myConfig.iWaveDuration = CD_CONFIG_GET_INTEGER ("Wave", "duration");
91
myConfig.bContinue[CD_ANIMATIONS_WAVE] = CD_CONFIG_GET_BOOLEAN ("Wave", "continue");
92
myConfig.fWaveWidth = CD_CONFIG_GET_DOUBLE ("Wave", "width");
93
myConfig.fWaveAmplitude = CD_CONFIG_GET_DOUBLE ("Wave", "amplitude");
95
myConfig.iPulseDuration = CD_CONFIG_GET_INTEGER ("Pulse", "duration");
96
myConfig.bContinue[CD_ANIMATIONS_PULSE] = CD_CONFIG_GET_BOOLEAN ("Pulse", "continue");
97
myConfig.fPulseZoom = CD_CONFIG_GET_DOUBLE ("Pulse", "zoom");
98
myConfig.bPulseSameShape = CD_CONFIG_GET_BOOLEAN ("Pulse", "same shape");
100
myConfig.iBounceDuration = CD_CONFIG_GET_INTEGER ("Bounce", "duration");
101
myConfig.bContinue[CD_ANIMATIONS_BOUNCE] = CD_CONFIG_GET_BOOLEAN ("Bounce", "continue");
102
myConfig.fBounceResize = CD_CONFIG_GET_DOUBLE ("Bounce", "resize");
103
myConfig.fBounceFlatten = CD_CONFIG_GET_DOUBLE ("Bounce", "flatten");
105
myConfig.iBlinkDuration = CD_CONFIG_GET_INTEGER ("Blink", "duration");
106
myConfig.bContinue[CD_ANIMATIONS_BLINK] = CD_CONFIG_GET_BOOLEAN ("Blink", "continue");
108
myConfig.iBusyDuration = CD_CONFIG_GET_INTEGER_WITH_DEFAULT ("Busy", "duration", 800);
109
myConfig.bContinue[CD_ANIMATIONS_BUSY] = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT ("Busy", "continue", TRUE);
110
myConfig.cBusyImage = CD_CONFIG_GET_STRING ("Busy", "image");
111
myConfig.fBusySize = CD_CONFIG_GET_DOUBLE_WITH_DEFAULT ("Busy", "size", .5); // relatively to the size of the icon
113
CD_APPLET_GET_CONFIG_END
116
//\_________________ Here you have to free all ressources allocated for myConfig. This one will be reseted to 0 at the end of this function. This function is called right before you get the applet's config, and when your applet is stopped, in the end.
117
CD_APPLET_RESET_CONFIG_BEGIN
118
g_free (myConfig.cSpotImage);
119
g_free (myConfig.cSpotFrontImage);
120
g_free (myConfig.cBusyImage);
121
CD_APPLET_RESET_CONFIG_END
124
//\_________________ Here you have to free all ressources allocated for myData. This one will be reseted to 0 at the end of this function. This function is called when your applet is stopped, in the very end.
125
CD_APPLET_RESET_DATA_BEGIN
126
if (myData.iChromeTexture != 0)
127
glDeleteTextures (1, &myData.iChromeTexture);
128
if (myData.iSpotTexture != 0)
129
glDeleteTextures (1, &myData.iSpotTexture);
130
if (myData.iHaloTexture != 0)
131
glDeleteTextures (1, &myData.iHaloTexture);
132
if (myData.iSpotFrontTexture != 0)
133
glDeleteTextures (1, &myData.iSpotFrontTexture);
134
if (myData.iRaysTexture != 0)
135
glDeleteTextures (1, &myData.iRaysTexture);
137
if (myData.iCallList[CD_SQUARE_MESH] != 0)
138
glDeleteLists (myData.iCallList[CD_SQUARE_MESH], 1);
139
if (myData.iCallList[CD_CUBE_MESH] != 0)
140
glDeleteLists (myData.iCallList[CD_CUBE_MESH], 1);
141
if (myData.iCallList[CD_CAPSULE_MESH] != 0)
142
glDeleteLists (myData.iCallList[CD_CAPSULE_MESH], 1);
143
CD_APPLET_RESET_DATA_END