~cairo-dock-team/cairo-dock-plug-ins/plug-ins

« back to all changes in this revision

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

  • Committer: Matthieu Baerts
  • Date: 2014-10-19 00:26:10 UTC
  • Revision ID: matttbe@gmail.com-20141019002610-ulf26s9b4c4rw10r
We just switched from BZR to Git.
Follow us on Github: https://github.com/Cairo-Dock

Note: we will only use Github to manage our source code and all pull requests.
Please continue to report your bugs/ideas/messages on our forum or Launchpad! 

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 <string.h>
21
 
#include <cairo-dock.h>
22
 
 
23
 
#include "applet-struct.h"
24
 
#include "applet-config.h"
25
 
 
26
 
 
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
29
 
        int i,j;
30
 
        for (i = 0; i < CD_ANIMATIONS_NB_EFFECTS; i ++)
31
 
        {
32
 
                myConfig.iEffectsOnMouseOver[i] = -1;
33
 
        }
34
 
        for (j = 0; j < CAIRO_DOCK_NB_GROUPS; j += 2)
35
 
        {
36
 
                for (i = 0; i < CD_ANIMATIONS_NB_EFFECTS; i ++)
37
 
                {
38
 
                        myConfig.iEffectsOnClick[j][i] = -1;
39
 
                }
40
 
        }
41
 
        
42
 
        CD_CONFIG_GET_INTEGER_LIST ("Global", "hover effects", CD_ANIMATIONS_NB_EFFECTS, (int *)myConfig.iEffectsOnMouseOver);
43
 
        
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);
48
 
        
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");
52
 
        
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);
58
 
        for (i=0; i<4; i++)
59
 
                myConfig.pMeshColor[i] = pMeshColor[i];
60
 
        
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");
66
 
        
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");
71
 
        gdouble pColor[4];
72
 
        double col[4] = {1.,1.,1.,1.};
73
 
        CD_CONFIG_GET_COLOR_RGB_WITH_DEFAULT ("Spot", "spot-color", pColor, col);
74
 
        for (i=0; i<3; i++)
75
 
                myConfig.pSpotColor[i] = pColor[i];
76
 
        CD_CONFIG_GET_COLOR_RGBA_WITH_DEFAULT ("Spot", "halo-color", pColor, col);
77
 
        for (i=0; i<4; i++)
78
 
                myConfig.pHaloColor[i] = pColor[i];
79
 
        CD_CONFIG_GET_COLOR_RGB ("Spot", "color1", pColor);
80
 
        for (i=0; i<3; i++)
81
 
                myConfig.pRaysColor1[i] = pColor[i];
82
 
        CD_CONFIG_GET_COLOR_RGB ("Spot", "color2", pColor);
83
 
        for (i=0; i<3; i++)
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");
89
 
        
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");
94
 
        
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");
99
 
        
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");
104
 
        
105
 
        myConfig.iBlinkDuration = CD_CONFIG_GET_INTEGER ("Blink", "duration");
106
 
        myConfig.bContinue[CD_ANIMATIONS_BLINK] = CD_CONFIG_GET_BOOLEAN ("Blink", "continue");
107
 
        
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
112
 
        
113
 
CD_APPLET_GET_CONFIG_END
114
 
 
115
 
 
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
122
 
 
123
 
 
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);
136
 
        
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