~ubuntu-branches/ubuntu/saucy/cairo-dock-plug-ins/saucy

« back to all changes in this revision

Viewing changes to dock-rendering/src/rendering-config.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2009-08-26 21:07:39 UTC
  • Revision ID: james.westby@ubuntu.com-20090826210739-gyjuuqezrzuluao4
Tags: upstream-2.0.8.1
ImportĀ upstreamĀ versionĀ 2.0.8.1

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
/******************************************************************************
 
21
 
 
22
This file is a part of the cairo-dock program, 
 
23
released under the terms of the GNU General Public License.
 
24
 
 
25
Written by Fabrice Rey (for any bug report, please mail me to fabounet@users.berlios.de)
 
26
 
 
27
******************************************************************************/
 
28
#include <math.h>
 
29
#include <cairo-dock.h>
 
30
 
 
31
#include "rendering-struct.h"
 
32
#include "rendering-commons.h"
 
33
#include "rendering-config.h"
 
34
#include "rendering-rainbow.h"
 
35
 
 
36
extern int iVanishingPointY;double my_fRainbowColor[4];
 
37
double my_fRainbowLineColor[4];
 
38
extern CDSpeparatorType my_iDrawSeparator3D;
 
39
extern GLuint my_iFlatSeparatorTexture;
 
40
 
 
41
extern double my_fInclinationOnHorizon;
 
42
extern double my_fForegroundRatio;
 
43
extern double my_iGapOnEllipse;
 
44
extern gboolean my_bRotateIconsOnEllipse;
 
45
extern double my_fScrollAcceleration;
 
46
extern double my_fScrollSpeed;
 
47
 
 
48
extern double my_fParabolePower;
 
49
extern double my_fParaboleFactor;
 
50
extern double my_fSeparatorColor[4];
 
51
 
 
52
extern double my_fParaboleCurvature;
 
53
extern double my_fParaboleRatio;
 
54
extern double my_fParaboleMagnitude;
 
55
extern int my_iParaboleTextGap;
 
56
extern gboolean my_bDrawTextWhileUnfolding;
 
57
 
 
58
extern cairo_surface_t *my_pFlatSeparatorSurface[2];
 
59
 
 
60
extern int my_iSpaceBetweenRows;
 
61
extern int my_iSpaceBetweenIcons;
 
62
extern double my_fRainbowMagnitude;
 
63
extern int my_iRainbowNbIconsMin;
 
64
extern double my_fRainbowConeOffset;
 
65
extern double my_fRainbowColor[4];
 
66
extern double my_fRainbowLineColor[4];
 
67
 
 
68
/*extern gint     my_diapo_iconGapX;
 
69
extern gint     my_diapo_iconGapY;
 
70
extern gdouble  my_diapo_fScaleMax;
 
71
extern gint     my_diapo_sinW;
 
72
extern gboolean my_diapo_lineaire;
 
73
extern gboolean  my_diapo_wide_grid;
 
74
extern gboolean  my_diapo_text_only_on_pointed;
 
75
 
 
76
extern gdouble  my_diapo_color_frame_start[4];
 
77
extern gdouble  my_diapo_color_frame_stop[4];
 
78
extern gboolean my_diapo_fade2bottom;
 
79
extern gboolean my_diapo_fade2right;
 
80
extern guint    my_diapo_arrowWidth;
 
81
extern guint    my_diapo_arrowHeight;
 
82
extern gdouble  my_diapo_arrowShift;
 
83
extern guint    my_diapo_lineWidth;
 
84
extern guint    my_diapo_radius;
 
85
extern gdouble  my_diapo_color_border_line[4];
 
86
extern gboolean my_diapo_draw_background;
 
87
extern gboolean my_diapo_display_all_icons;*/
 
88
 
 
89
extern gint     my_diapo_simple_iconGapX;
 
90
extern gint     my_diapo_simple_iconGapY;
 
91
extern gdouble  my_diapo_simple_fScaleMax;
 
92
extern gint     my_diapo_simple_sinW;
 
93
extern gboolean my_diapo_simple_lineaire;
 
94
extern gboolean  my_diapo_simple_wide_grid;
 
95
//extern gboolean  my_diapo_simple_text_only_on_pointed;
 
96
extern gdouble  my_diapo_simple_color_frame_start[4];
 
97
extern gdouble  my_diapo_simple_color_frame_stop[4];
 
98
extern gboolean my_diapo_simple_fade2bottom;
 
99
extern gboolean my_diapo_simple_fade2right;
 
100
extern guint    my_diapo_simple_arrowWidth;
 
101
extern guint    my_diapo_simple_arrowHeight;
 
102
extern gdouble  my_diapo_simple_arrowShift;
 
103
extern guint    my_diapo_simple_lineWidth;
 
104
extern guint    my_diapo_simple_radius;
 
105
extern gdouble  my_diapo_simple_color_border_line[4];
 
106
extern gboolean my_diapo_simple_draw_background;
 
107
extern gboolean my_diapo_simple_display_all_icons;
 
108
 
 
109
extern gdouble my_fCurveCurvature;
 
110
extern gint my_iCurveAmplitude;
 
111
extern CDSpeparatorType my_curve_iDrawSeparator3D;
 
112
 
 
113
 
 
114
CD_APPLET_GET_CONFIG_BEGIN
 
115
        iVanishingPointY = cairo_dock_get_integer_key_value (pKeyFile, "Inclinated Plane", "vanishing point y", &bFlushConfFileNeeded, 0, NULL, NULL);
 
116
        my_iDrawSeparator3D = cairo_dock_get_integer_key_value (pKeyFile, "Inclinated Plane", "draw separator", &bFlushConfFileNeeded, 0, NULL, NULL);
 
117
        double couleur[4] = {0.9,0.9,1.0,1.0};
 
118
        cairo_dock_get_double_list_key_value (pKeyFile, "Inclinated Plane", "separator color", &bFlushConfFileNeeded, my_fSeparatorColor, 4, couleur, NULL, NULL);
 
119
 
 
120
 
 
121
        double fInclinationAngle  = cairo_dock_get_double_key_value (pKeyFile, "Caroussel", "inclination", &bFlushConfFileNeeded, 35, NULL, NULL);
 
122
        my_fInclinationOnHorizon = tan (fInclinationAngle * G_PI / 180.);
 
123
        my_iGapOnEllipse = cairo_dock_get_double_key_value (pKeyFile, "Caroussel", "gap on ellipse", &bFlushConfFileNeeded, 10, NULL, NULL);
 
124
        my_bRotateIconsOnEllipse = ! cairo_dock_get_boolean_key_value (pKeyFile, "Caroussel", "show face", &bFlushConfFileNeeded, FALSE, NULL, NULL);
 
125
        my_fForegroundRatio = cairo_dock_get_double_key_value (pKeyFile, "Caroussel", "foreground ratio", &bFlushConfFileNeeded, .5, NULL, NULL);
 
126
        my_fScrollSpeed = cairo_dock_get_double_key_value (pKeyFile, "Caroussel", "scroll speed", &bFlushConfFileNeeded, 10., NULL, NULL);
 
127
        my_fScrollAcceleration = cairo_dock_get_double_key_value (pKeyFile, "Caroussel", "scroll accel", &bFlushConfFileNeeded, .9, NULL, NULL);
 
128
        
 
129
        my_fParaboleCurvature = cairo_dock_get_double_key_value (pKeyFile, "Parabolic", "curvature", &bFlushConfFileNeeded, .5, NULL, NULL);
 
130
        my_fParaboleRatio = cairo_dock_get_double_key_value (pKeyFile, "Parabolic", "ratio", &bFlushConfFileNeeded, 5, NULL, NULL);
 
131
        my_fParaboleMagnitude = cairo_dock_get_double_key_value (pKeyFile, "Parabolic", "wave magnitude", &bFlushConfFileNeeded, .2, NULL, NULL);
 
132
        my_iParaboleTextGap = cairo_dock_get_integer_key_value (pKeyFile, "Parabolic", "text gap", &bFlushConfFileNeeded, 3, NULL, NULL);
 
133
        my_bDrawTextWhileUnfolding = cairo_dock_get_boolean_key_value (pKeyFile, "Parabolic", "draw text", &bFlushConfFileNeeded, TRUE, NULL, NULL);
 
134
        
 
135
        
 
136
        my_iSpaceBetweenRows = cairo_dock_get_integer_key_value (pKeyFile, "Rainbow", "space between rows", &bFlushConfFileNeeded, 10, NULL, NULL);
 
137
        my_iSpaceBetweenIcons = cairo_dock_get_integer_key_value (pKeyFile, "Rainbow", "space between icons", &bFlushConfFileNeeded, 8, NULL, NULL);
 
138
        my_fRainbowMagnitude = cairo_dock_get_double_key_value (pKeyFile, "Rainbow", "wave magnitude", &bFlushConfFileNeeded, .3, NULL, NULL);
 
139
        my_iRainbowNbIconsMin = cairo_dock_get_integer_key_value (pKeyFile, "Rainbow", "nb icons min", &bFlushConfFileNeeded, 3, NULL, NULL);
 
140
        my_fRainbowConeOffset = G_PI * (1 - cairo_dock_get_double_key_value (pKeyFile, "Rainbow", "cone", &bFlushConfFileNeeded, 130, NULL, NULL) / 180) / 2;
 
141
        if (my_fRainbowConeOffset < 0) my_fRainbowConeOffset = 0;
 
142
        if (my_fRainbowConeOffset > G_PI/2) my_fRainbowConeOffset = G_PI/2;
 
143
        double bow_couleur[4] = {0.7,0.9,1.0,0.5};
 
144
        cairo_dock_get_double_list_key_value (pKeyFile, "Rainbow", "bow color", &bFlushConfFileNeeded, my_fRainbowColor, 4, bow_couleur, NULL, NULL);
 
145
        double line_couleur[4] = {0.5,1.0,0.9,0.6};
 
146
        cairo_dock_get_double_list_key_value (pKeyFile, "Rainbow", "line color", &bFlushConfFileNeeded, my_fRainbowLineColor, 4, line_couleur, NULL, NULL);
 
147
        
 
148
        
 
149
        /*my_diapo_iconGapX             = cairo_dock_get_integer_key_value (pKeyFile, "Slide", "iconGapX",             &bFlushConfFileNeeded,     5, NULL, NULL);
 
150
        my_diapo_iconGapY             = cairo_dock_get_integer_key_value (pKeyFile, "Slide", "iconGapY",             &bFlushConfFileNeeded,    10, NULL, NULL);
 
151
        my_diapo_fScaleMax            = cairo_dock_get_double_key_value  (pKeyFile, "Slide", "fScaleMax",            &bFlushConfFileNeeded,    2., NULL, NULL);
 
152
        my_diapo_sinW                 = cairo_dock_get_integer_key_value (pKeyFile, "Slide", "sinW",                 &bFlushConfFileNeeded,   300, NULL, NULL);
 
153
        my_diapo_lineaire             = cairo_dock_get_boolean_key_value (pKeyFile, "Slide", "lineaire",             &bFlushConfFileNeeded, FALSE, NULL, NULL);
 
154
        my_diapo_wide_grid            = cairo_dock_get_boolean_key_value (pKeyFile, "Slide", "wide_grid",            &bFlushConfFileNeeded, FALSE, NULL, NULL);        
 
155
        my_diapo_text_only_on_pointed = cairo_dock_get_boolean_key_value (pKeyFile, "Slide", "text_only_on_pointed", &bFlushConfFileNeeded, FALSE, NULL, NULL);
 
156
        
 
157
        gdouble color_frame_start[4] = {0.0, 0.0, 0.0, 1.0};
 
158
        cairo_dock_get_double_list_key_value (pKeyFile, "Slide", "color_frame_start", &bFlushConfFileNeeded, my_diapo_color_frame_start, 4, color_frame_start, NULL, NULL);
 
159
        gdouble color_frame_stop[4]  = {0.3, 0.3, 0.3, 0.6};
 
160
        cairo_dock_get_double_list_key_value (pKeyFile, "Slide", "color_frame_stop", &bFlushConfFileNeeded, my_diapo_color_frame_stop, 4, color_frame_stop, NULL, NULL);
 
161
        gdouble color_border_line[4] = {1., 1., 1., 0.5};
 
162
        cairo_dock_get_double_list_key_value (pKeyFile, "Slide", "color_border_line", &bFlushConfFileNeeded, my_diapo_color_border_line, 4, color_border_line, NULL, NULL);
 
163
        
 
164
        my_diapo_fade2bottom = cairo_dock_get_boolean_key_value (pKeyFile, "Slide", "fade2bottom", &bFlushConfFileNeeded, TRUE, NULL, NULL);
 
165
        my_diapo_fade2right  = cairo_dock_get_boolean_key_value (pKeyFile, "Slide", "fade2right",  &bFlushConfFileNeeded, TRUE, NULL, NULL);
 
166
        my_diapo_arrowWidth  = cairo_dock_get_integer_key_value (pKeyFile, "Slide", "arrowWidth",  &bFlushConfFileNeeded, 40,   NULL, NULL);
 
167
        my_diapo_arrowHeight = cairo_dock_get_integer_key_value (pKeyFile, "Slide", "arrowHeight", &bFlushConfFileNeeded, 40,   NULL, NULL);
 
168
        my_diapo_arrowShift  = cairo_dock_get_double_key_value  (pKeyFile, "Slide", "arrowShift",  &bFlushConfFileNeeded, 30,   NULL, NULL) / 100;
 
169
        my_diapo_lineWidth   = cairo_dock_get_integer_key_value (pKeyFile, "Slide", "lineWidth",   &bFlushConfFileNeeded, 5,    NULL, NULL);
 
170
        my_diapo_radius      = cairo_dock_get_integer_key_value (pKeyFile, "Slide", "radius",      &bFlushConfFileNeeded, 15,   NULL, NULL);
 
171
        my_diapo_draw_background = cairo_dock_get_boolean_key_value (pKeyFile, "Slide", "draw_background",  &bFlushConfFileNeeded, TRUE, NULL, NULL);
 
172
        my_diapo_display_all_icons = cairo_dock_get_boolean_key_value (pKeyFile, "Slide", "display_all_icons",  &bFlushConfFileNeeded, FALSE, NULL, NULL);*/
 
173
        
 
174
        
 
175
        my_diapo_simple_iconGapX             = cairo_dock_get_integer_key_value (pKeyFile, "SimpleSlide", "simple_iconGapX",             &bFlushConfFileNeeded,    20, NULL, NULL);
 
176
        my_diapo_simple_iconGapY             = cairo_dock_get_integer_key_value (pKeyFile, "SimpleSlide", "simple_iconGapY",             &bFlushConfFileNeeded,    30, NULL, NULL);
 
177
        my_diapo_simple_fScaleMax            = cairo_dock_get_double_key_value  (pKeyFile, "SimpleSlide", "simple_fScaleMax",            &bFlushConfFileNeeded,   2.5, NULL, NULL);
 
178
        my_diapo_simple_sinW                 = cairo_dock_get_integer_key_value (pKeyFile, "SimpleSlide", "simple_sinW",                 &bFlushConfFileNeeded,   200, NULL, NULL);
 
179
        my_diapo_simple_lineaire             = cairo_dock_get_boolean_key_value (pKeyFile, "SimpleSlide", "simple_lineaire",             &bFlushConfFileNeeded, FALSE, NULL, NULL);
 
180
        my_diapo_simple_wide_grid            = cairo_dock_get_boolean_key_value (pKeyFile, "SimpleSlide", "simple_wide_grid",            &bFlushConfFileNeeded, FALSE, NULL, NULL);
 
181
        //my_diapo_simple_text_only_on_pointed = cairo_dock_get_boolean_key_value (pKeyFile, "SimpleSlide", "simple_text_only_on_pointed", &bFlushConfFileNeeded, FALSE, NULL, NULL);
 
182
        
 
183
        gdouble color_frame_start_[4] = {0.0, 0.0, 0.0, 1.0};
 
184
        cairo_dock_get_double_list_key_value (pKeyFile, "SimpleSlide", "simple_color_frame_start", &bFlushConfFileNeeded, my_diapo_simple_color_frame_start, 4, color_frame_start_, NULL, NULL);
 
185
        gdouble color_frame_stop_[4]  = {0.3, 0.3, 0.3, 0.6};
 
186
        cairo_dock_get_double_list_key_value (pKeyFile, "SimpleSlide", "simple_color_frame_stop", &bFlushConfFileNeeded, my_diapo_simple_color_frame_stop, 4, color_frame_stop_, NULL, NULL);
 
187
        gdouble color_border_line_[4] = {1., 1., 1., 0.5};
 
188
        cairo_dock_get_double_list_key_value (pKeyFile, "SimpleSlide", "simple_color_border_line", &bFlushConfFileNeeded, my_diapo_simple_color_border_line, 4, color_border_line_, NULL, NULL);
 
189
        
 
190
        my_diapo_simple_fade2bottom = cairo_dock_get_boolean_key_value (pKeyFile, "SimpleSlide", "simple_fade2bottom", &bFlushConfFileNeeded, TRUE, NULL, NULL);
 
191
        my_diapo_simple_fade2right  = cairo_dock_get_boolean_key_value (pKeyFile, "SimpleSlide", "simple_fade2right",  &bFlushConfFileNeeded, TRUE, NULL, NULL);
 
192
        my_diapo_simple_arrowWidth  = cairo_dock_get_integer_key_value (pKeyFile, "SimpleSlide", "simple_arrowWidth",  &bFlushConfFileNeeded, 40,   NULL, NULL);
 
193
        my_diapo_simple_arrowHeight = cairo_dock_get_integer_key_value (pKeyFile, "SimpleSlide", "simple_arrowHeight", &bFlushConfFileNeeded, 40,   NULL, NULL);
 
194
        my_diapo_simple_arrowShift  = cairo_dock_get_double_key_value (pKeyFile, "SimpleSlide", "simple_arrowShift",  &bFlushConfFileNeeded, 30,   NULL, NULL) / 100.;
 
195
        my_diapo_simple_lineWidth   = cairo_dock_get_integer_key_value (pKeyFile, "SimpleSlide", "simple_lineWidth",   &bFlushConfFileNeeded, 5,    NULL, NULL);
 
196
        my_diapo_simple_radius      = cairo_dock_get_integer_key_value (pKeyFile, "SimpleSlide", "simple_radius",      &bFlushConfFileNeeded, 15,   NULL, NULL);
 
197
        my_diapo_simple_draw_background = cairo_dock_get_boolean_key_value (pKeyFile, "SimpleSlide", "simple_draw_background",  &bFlushConfFileNeeded, TRUE, NULL, NULL);
 
198
        my_diapo_simple_display_all_icons = cairo_dock_get_boolean_key_value (pKeyFile, "SimpleSlide", "simple_display_all_icons",  &bFlushConfFileNeeded, FALSE, NULL, NULL);
 
199
        
 
200
        
 
201
        my_fCurveCurvature = (double) cairo_dock_get_integer_key_value (pKeyFile, "Curve", "curvature", &bFlushConfFileNeeded, 50, NULL, NULL) / 100.;
 
202
        my_iCurveAmplitude = cairo_dock_get_integer_key_value (pKeyFile, "Curve", "amplitude", &bFlushConfFileNeeded, 20, NULL, NULL);
 
203
        my_curve_iDrawSeparator3D = cairo_dock_get_integer_key_value (pKeyFile, "Curve", "draw curve separator", &bFlushConfFileNeeded, 0, NULL, NULL);
 
204
        
 
205
        if (g_key_file_has_group (pKeyFile, "Slide"))
 
206
        {
 
207
                g_key_file_remove_group (pKeyFile, "Slide", NULL);
 
208
                bFlushConfFileNeeded = TRUE;
 
209
        }
 
210
        
 
211
        cd_rendering_reload_rainbow_buffers ();
 
212
CD_APPLET_GET_CONFIG_END
 
213
 
 
214
 
 
215
CD_APPLET_RESET_CONFIG_BEGIN
 
216
        
 
217
CD_APPLET_RESET_CONFIG_END
 
218
 
 
219
 
 
220
CD_APPLET_RESET_DATA_BEGIN
 
221
        if (my_pFlatSeparatorSurface[0] != NULL)
 
222
        {
 
223
                cairo_surface_destroy (my_pFlatSeparatorSurface[CAIRO_DOCK_HORIZONTAL]);
 
224
                my_pFlatSeparatorSurface[CAIRO_DOCK_HORIZONTAL] = NULL;
 
225
                cairo_surface_destroy (my_pFlatSeparatorSurface[CAIRO_DOCK_VERTICAL]);
 
226
                my_pFlatSeparatorSurface[CAIRO_DOCK_VERTICAL] = NULL;
 
227
        }
 
228
        
 
229
        if (my_iFlatSeparatorTexture != 0)
 
230
        {
 
231
                glDeleteTextures (1, &my_iFlatSeparatorTexture);
 
232
                my_iFlatSeparatorTexture = 0;
 
233
        }
 
234
CD_APPLET_RESET_DATA_END
 
235