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

« back to all changes in this revision

Viewing changes to dock-rendering/src/rendering-3D-plane.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 <math.h>
21
 
#include <string.h>
22
 
#include <stdio.h>
23
 
#include <stdlib.h>
24
 
 
25
 
#include <gtk/gtk.h>
26
 
 
27
 
#include <cairo.h>
28
 
 
29
 
#include "rendering-commons.h"
30
 
#include "rendering-3D-plane.h"
31
 
 
32
 
extern int iVanishingPointY;
33
 
 
34
 
extern cairo_surface_t *my_pFlatSeparatorSurface[2];
35
 
 
36
 
#define _define_parameters(hi, h0, H, l, r, gamma, h, w, dw)\
37
 
        double hi = /**myIconsParam.fReflectSize*/pDock->iIconSize * myIconsParam.fReflectHeightRatio * pDock->container.fRatio + myDocksParam.iFrameMargin;\
38
 
        double h0 = pDock->iMaxIconHeight/** * pDock->container.fRatio*/;\
39
 
        double H = iVanishingPointY;\
40
 
        double l = myDocksParam.iDockLineWidth;\
41
 
        double r = MIN (myDocksParam.iDockRadius, (hi + h0) / 2);\
42
 
        double gamma = 0, h, w, dw = 0
43
 
 
44
 
static void cd_rendering_calculate_max_dock_size_3D_plane (CairoDock *pDock)
45
 
{
46
 
        cairo_dock_calculate_icons_positions_at_rest_linear (pDock->icons, pDock->fFlatDockWidth);
47
 
        
48
 
        //pDock->iMaxDockHeight = (int) ((1 + myIconsParam.fAmplitude) * pDock->iMaxIconHeight + myIconsParam.fReflectSize * pDock->container.fRatio) + myIconsParam.iLabelSize + myDocksParam.iDockLineWidth + myDocksParam.iFrameMargin;
49
 
        
50
 
        _define_parameters (hi, h0, H, l, r, gamma, h, w, dw);
51
 
        double h0max = (1 + myIconsParam.fAmplitude) * pDock->iMaxIconHeight * pDock->container.fRatio + MAX ((pDock->container.bIsHorizontal ? myIconsParam.iLabelSize : 0), myDocksParam.iFrameMargin + myDocksParam.iDockLineWidth);
52
 
        pDock->iMaxDockHeight = (int) (hi + h0max + l);
53
 
        
54
 
        // 1ere estimation.
55
 
        // w
56
 
        w = ceil (cairo_dock_calculate_max_dock_width (pDock, pDock->fFlatDockWidth, 1., 2 * dw));  // pDock->iMaxDockWidth
57
 
        // -> gamma
58
 
        gamma = w / 2 / H;
59
 
        // -> h
60
 
        h = hi + h0 / (1 + gamma);  // en fait, sqrt (1 + gamma * gamma), mais on simplifie pour diminuer l'ordre de 2. pDock->iDecorationsHeight
61
 
        // -> dw
62
 
        dw = h * gamma + 0*r + (l+(r==0)*2)*sqrt(1+gamma*gamma);  // en fait, h*gamma + r*(1-sin)/cos, or (1-sin)/cos <= 1, on majore pour simplifier. on aurait r + gamma * (h - 2 * r) si on utilisait des cercles au lieu de courbes de Bezier.
63
 
        
64
 
        r = MIN (myDocksParam.iDockRadius, h / 2);
65
 
        dw = r + gamma * (h - r) + (l+(r==0)*2)*sqrt(1+gamma*gamma);  // h-2r si on utilisait des cercles au lieu de courbes de Bezier.
66
 
        //g_print ("r:%.1f, h:%.1f => dw=%.1f (%.1f)\n", r, h, dw, h * gamma + 0*r + (l+(r==0)*2)*sqrt(1+gamma*gamma));
67
 
        
68
 
        /*double Ws = w+2*dw;
69
 
        double W = Ws - 2 * (r + (l+(r==0)*2)*sqrt(1+gamma*gamma));
70
 
        double a = H + hi;
71
 
        double b = H + hi + h0 - W / 2;
72
 
        double c = - W / 2;
73
 
        double g = (-b + sqrt (b * b - 4 * a * c)) / 2  / a;
74
 
        cd_debug ("gamma : %f (=) %f", gamma, g);*/
75
 
        
76
 
        int iMaxDockWidth = ceil (cairo_dock_calculate_max_dock_width (pDock, pDock->fFlatDockWidth, 1., 2 * dw));  // on pourra optimiser, ce qui nous interesse ici c'est les fXMin/fXMax.
77
 
        pDock->iMaxDockWidth = iMaxDockWidth;
78
 
        pDock->iOffsetForExtend = 0;
79
 
        double Ws = cairo_dock_get_max_authorized_dock_width (pDock);
80
 
        ///if (cairo_dock_is_extended_dock (pDock) && w + 2 * dw < Ws)  // alors on etend.
81
 
        if (pDock->iRefCount == 0)
82
 
        {
83
 
                if (pDock->iMaxDockWidth < Ws)  // alors on etend.
84
 
                {
85
 
                        pDock->iOffsetForExtend = (Ws - pDock->iMaxDockWidth) / 2;
86
 
                        double extra = Ws - w;
87
 
                        pDock->iMaxDockWidth = ceil (cairo_dock_calculate_max_dock_width (pDock, pDock->fFlatDockWidth, 1., extra));  // on pourra optimiser, ce qui nous interesse ici c'est les fXMin/fXMax.
88
 
                        double W = Ws - 2 * (r + (l+(r==0)*2)*sqrt(1+gamma*gamma));
89
 
                        double a = H + hi;
90
 
                        double b = H + hi + h0 - W / 2;
91
 
                        double c = - W / 2;
92
 
                        gamma = (-b + sqrt (b * b - 4 * a * c)) / 2  / a;
93
 
                        //g_print ("mode etendu : pDock->iMaxDockWidth : %d, gamma = %f\n", pDock->iMaxDockWidth, gamma);
94
 
                        h = hi + h0 / (1 + gamma);
95
 
                }
96
 
        }
97
 
        pDock->iDecorationsHeight = h;
98
 
        //g_print ("h : %.2f -> %d\n", h, pDock->iDecorationsHeight);
99
 
        
100
 
        pDock->iDecorationsWidth = pDock->iMaxDockWidth;
101
 
        
102
 
        // taille min.
103
 
        double fRatio = (pDock->iRefCount == 0 && pDock->iVisibility == CAIRO_DOCK_VISI_RESERVE ? 1. : pDock->container.fRatio);  // prevent the dock from resizing itself and all the maximized windows each time an icon is removed/inserted.
104
 
        pDock->iMinDockHeight = myDocksParam.iDockLineWidth + myDocksParam.iFrameMargin + /**myIconsParam.fReflectSize*/pDock->iIconSize * myIconsParam.fReflectHeightRatio * fRatio + pDock->iMaxIconHeight * fRatio;
105
 
        
106
 
        //double gamma_min = pDock->fFlatDockWidth / 2 / H;
107
 
        //double dw_min = h * gamma_min + r + (l+(r==0)*2)*sqrt(1+gamma_min*gamma_min);
108
 
        //cairo_dock_calculate_extra_width_for_trapeze (pDock->iDecorationsHeight, fInclination, myDocksParam.iDockRadius, myDocksParam.iDockLineWidth);
109
 
        
110
 
        // on charge les separateurs plat.
111
 
        //g_print ("%d / %d\n", myIconsParam.iSeparatorType, myIconsParam.iSeparatorType);
112
 
        if (myIconsParam.iSeparatorType == CAIRO_DOCK_FLAT_SEPARATOR)
113
 
        {
114
 
                cd_rendering_load_flat_separator (CAIRO_CONTAINER (g_pMainDock));
115
 
        }
116
 
        
117
 
        pDock->iMinDockWidth = MAX (1, pDock->fFlatDockWidth);  // fFlatDockWidth peut etre meme negatif avec un dock vide.
118
 
        
119
 
        pDock->iActiveWidth = iMaxDockWidth;
120
 
        pDock->iActiveHeight = pDock->iMaxDockHeight;
121
 
        if (! pDock->container.bIsHorizontal)
122
 
                pDock->iMaxDockHeight += 8*myIconsParam.iLabelSize;  // vertical dock, add some padding to draw the labels.     
123
 
}
124
 
 
125
 
static void cd_rendering_calculate_construction_parameters_3D_plane (Icon *icon, double fOffsetX, double fReflectionOffsetY)
126
 
{
127
 
        icon->fDrawX = icon->fX + fOffsetX;
128
 
        icon->fDrawY = icon->fY + fReflectionOffsetY;
129
 
        icon->fWidthFactor = 1.;
130
 
        icon->fHeightFactor = 1.;
131
 
        ///icon->fDeltaYReflection = 0.;
132
 
        icon->fOrientation = 0.;
133
 
        //if (icon->fDrawX >= 0 && icon->fDrawX + icon->fWidth * icon->fScale <= iWidth)
134
 
        {
135
 
                icon->fAlpha = 1;
136
 
        }
137
 
        /*else
138
 
        {
139
 
                icon->fAlpha = .25;
140
 
        }*/
141
 
}
142
 
 
143
 
 
144
 
static void cd_rendering_make_3D_separator (Icon *icon, cairo_t *pCairoContext, CairoDock *pDock, gboolean bIncludeEdges, gboolean bBackGround)
145
 
{
146
 
        double hi = /**myIconsParam.fReflectSize*/pDock->iIconSize * myIconsParam.fReflectHeightRatio * pDock->container.fRatio + myDocksParam.iFrameMargin;
147
 
        hi = (pDock->container.bDirectionUp ? pDock->container.iHeight - (icon->fDrawY + icon->fHeight * icon->fScale) : icon->fDrawY);
148
 
        double fLeftInclination = (icon->fDrawX - pDock->container.iWidth / 2) / iVanishingPointY;
149
 
        double fRightInclination = (icon->fDrawX + icon->fWidth * icon->fScale - pDock->container.iWidth / 2) / iVanishingPointY;
150
 
        
151
 
        double fHeight, fBigWidth, fLittleWidth;
152
 
        if (bIncludeEdges)
153
 
        {
154
 
                fHeight = (bBackGround ? pDock->iDecorationsHeight - hi : hi) + 2*myDocksParam.iDockLineWidth;
155
 
                fBigWidth = fabs (fRightInclination - fLeftInclination) * (bBackGround ? iVanishingPointY : iVanishingPointY + fHeight);
156
 
                fLittleWidth = fabs (fRightInclination - fLeftInclination) * (bBackGround ? iVanishingPointY - fHeight : iVanishingPointY);
157
 
        }
158
 
        else
159
 
        {
160
 
                fHeight = pDock->iDecorationsHeight - myDocksParam.iDockLineWidth;
161
 
                fBigWidth = fabs (fRightInclination - fLeftInclination) * (iVanishingPointY + hi);
162
 
                fLittleWidth = fabs (fRightInclination - fLeftInclination) * (iVanishingPointY + hi - fHeight);
163
 
        }
164
 
        double fDeltaXLeft = fHeight * fLeftInclination;
165
 
        double fDeltaXRight = fHeight * fRightInclination;
166
 
        //g_print ("fBigWidth : %.2f ; fLittleWidth : %.2f\n", fBigWidth, fLittleWidth);
167
 
        
168
 
        double fDockOffsetX, fDockOffsetY;
169
 
        if (bIncludeEdges)
170
 
        {
171
 
                fDockOffsetX = icon->fDrawX - (bBackGround ? fHeight * fLeftInclination : 0);
172
 
                fDockOffsetY = pDock->container.iHeight - fHeight - (bBackGround ? myDocksParam.iDockLineWidth + hi : -.5*myDocksParam.iDockLineWidth);
173
 
        }
174
 
        else
175
 
        {
176
 
                fDockOffsetX = icon->fDrawX - (fHeight - hi) * fLeftInclination;
177
 
                fDockOffsetY = pDock->container.iHeight - fHeight - myDocksParam.iDockLineWidth;
178
 
        }       
179
 
        
180
 
        cairo_translate (pCairoContext, fDockOffsetX, fDockOffsetY);  // coin haut gauche.
181
 
        cairo_move_to (pCairoContext, 0, 0);  // coin haut gauche.
182
 
        
183
 
        cairo_rel_line_to (pCairoContext, fLittleWidth, 0);
184
 
        cairo_rel_line_to (pCairoContext, fDeltaXRight, fHeight);
185
 
        cairo_rel_line_to (pCairoContext, - fBigWidth, 0);
186
 
        cairo_rel_line_to (pCairoContext, - fDeltaXLeft, - fHeight);
187
 
        
188
 
        if (myIconsParam.iSeparatorType == CAIRO_DOCK_FLAT_SEPARATOR)
189
 
        {
190
 
                cairo_clip (pCairoContext);
191
 
                cairo_translate (pCairoContext, MIN (0, (fHeight + hi) * fLeftInclination), 0);
192
 
                cairo_scale (pCairoContext, (fLittleWidth + MAX (fabs (fDeltaXRight), fabs (fDeltaXLeft)))/1, 1.);
193
 
                cairo_set_source_surface (pCairoContext, my_pFlatSeparatorSurface[CAIRO_DOCK_HORIZONTAL], 0, 0);
194
 
        }
195
 
}
196
 
 
197
 
static void cd_rendering_draw_3D_separator_edge (Icon *icon, cairo_t *pCairoContext, CairoDock *pDock, gboolean bBackGround)
198
 
{
199
 
        double hi = /**myIconsParam.fReflectSize*/pDock->iIconSize * myIconsParam.fReflectHeightRatio * pDock->container.fRatio + myDocksParam.iFrameMargin;
200
 
        hi = (pDock->container.bDirectionUp ? pDock->container.iHeight - (icon->fDrawY + icon->fHeight * icon->fScale) : icon->fDrawY);
201
 
        double fLeftInclination = (icon->fDrawX - pDock->container.iWidth / 2) / iVanishingPointY;
202
 
        double fRightInclination = (icon->fDrawX + icon->fWidth * icon->fScale - pDock->container.iWidth / 2) / iVanishingPointY;
203
 
        
204
 
        double fHeight, fLittleWidth;
205
 
        fHeight = (bBackGround ? pDock->iDecorationsHeight - hi - 0.5*myDocksParam.iDockLineWidth : hi + 1.5*myDocksParam.iDockLineWidth);
206
 
        //fBigWidth = fabs (fRightInclination - fLeftInclination) * (bBackGround ? iVanishingPointY : iVanishingPointY + fHeight);
207
 
        fLittleWidth = fabs (fRightInclination - fLeftInclination) * (bBackGround ? iVanishingPointY - fHeight : iVanishingPointY);
208
 
        
209
 
        double fDeltaXLeft = fHeight * fLeftInclination;
210
 
        double fDeltaXRight = fHeight * fRightInclination;
211
 
        //g_print ("fBigWidth : %.2f ; fLittleWidth : %.2f\n", fBigWidth, fLittleWidth);
212
 
        
213
 
        double fDockOffsetX, fDockOffsetY;
214
 
        fDockOffsetY =  (bBackGround ? 2.*myDocksParam.iDockLineWidth : - 1.0*myDocksParam.iDockLineWidth);
215
 
        
216
 
        fDockOffsetX = (bBackGround ? .5*myDocksParam.iDockLineWidth * fLeftInclination + 1.*fLeftInclination : - 0.5 * myDocksParam.iDockLineWidth * fLeftInclination);
217
 
        //fDockOffsetX = -.5*myDocksParam.iDockLineWidth;
218
 
        
219
 
        
220
 
        cairo_translate (pCairoContext, fDockOffsetX, fDockOffsetY);  // coin haut droit.
221
 
        
222
 
        cairo_move_to (pCairoContext, fLittleWidth, 0);
223
 
        cairo_rel_line_to (pCairoContext, fDeltaXRight, fHeight);
224
 
        
225
 
        cairo_move_to (pCairoContext, 0, 0);
226
 
        cairo_rel_line_to (pCairoContext, fDeltaXLeft, fHeight);
227
 
}
228
 
 
229
 
 
230
 
static void cd_rendering_draw_3D_separator (Icon *icon, cairo_t *pCairoContext, CairoDock *pDock, gboolean bHorizontal, gboolean bBackGround)
231
 
{
232
 
        if (pDock->container.bIsHorizontal)
233
 
        {
234
 
                if (! pDock->container.bDirectionUp)
235
 
                {
236
 
                        cairo_translate (pCairoContext, 0., pDock->container.iHeight);
237
 
                        cairo_scale (pCairoContext, 1., -1.);
238
 
                }
239
 
        }
240
 
        else
241
 
        {
242
 
                cairo_translate (pCairoContext, pDock->container.iHeight/2, pDock->container.iWidth/2);
243
 
                cairo_rotate (pCairoContext, G_PI/2);
244
 
                cairo_translate (pCairoContext, -pDock->container.iWidth/2, -pDock->container.iHeight/2);
245
 
                if (pDock->container.bDirectionUp)
246
 
                {
247
 
                        cairo_translate (pCairoContext, 0., pDock->container.iHeight);
248
 
                        cairo_scale (pCairoContext, 1., -1.);
249
 
                }
250
 
        }
251
 
        cd_rendering_make_3D_separator (icon, pCairoContext, pDock, (myIconsParam.iSeparatorType == CAIRO_DOCK_PHYSICAL_SEPARATOR), bBackGround);
252
 
        
253
 
        if (myIconsParam.iSeparatorType == CAIRO_DOCK_PHYSICAL_SEPARATOR)
254
 
        {
255
 
                cairo_set_operator (pCairoContext, CAIRO_OPERATOR_DEST_OUT);
256
 
                cairo_set_source_rgba (pCairoContext, 0.0, 0.0, 0.0, 1.0);
257
 
                cairo_fill (pCairoContext);
258
 
                
259
 
                if (myDocksParam.iDockLineWidth != 0)
260
 
                {
261
 
                        cd_rendering_draw_3D_separator_edge (icon, pCairoContext, pDock, bBackGround);
262
 
                        
263
 
                        cairo_set_operator (pCairoContext, CAIRO_OPERATOR_OVER);
264
 
                        cairo_set_line_width (pCairoContext, myDocksParam.iDockLineWidth);
265
 
                        if (myDocksParam.bUseDefaultColors)
266
 
                                gldi_style_colors_set_line_color (pCairoContext);
267
 
                        else
268
 
                                gldi_color_set_cairo (pCairoContext, &myDocksParam.fLineColor);
269
 
                        cairo_stroke (pCairoContext);
270
 
                }
271
 
        }
272
 
        else
273
 
        {
274
 
                ///cairo_fill (pCairoContext);
275
 
                cairo_paint (pCairoContext);
276
 
        }
277
 
}
278
 
 
279
 
 
280
 
static void cd_rendering_render_3D_plane (cairo_t *pCairoContext, CairoDock *pDock)
281
 
{
282
 
        _define_parameters (hi, h0, H, l, r, gamma, h, w, dw);
283
 
        h = pDock->iDecorationsHeight;
284
 
        if (h < 2 * r)
285
 
                r = h / 2;
286
 
        
287
 
        //\____________________ On definit la position du cadre.
288
 
        double dx, dy;  // position du coin haut gauche du cadre.
289
 
        if (cairo_dock_is_extended_dock (pDock))  // mode panel etendu.
290
 
        {
291
 
                double Ws = pDock->container.iWidth;
292
 
                gamma = Ws / 2 / H;
293
 
                double W = Ws - 2 * (r + (l+(r==0)*2)*sqrt(1+gamma*gamma));
294
 
                double a = H + hi;
295
 
                double b = H + hi + h0 - W / 2;
296
 
                double c = - W / 2;
297
 
                gamma = (-b + sqrt (b * b - 4 * a * c)) / 2  / a;
298
 
                h = hi + h0 / (1 + gamma);
299
 
                //g_print ("h : %.2f (=) %d\n", h, pDock->iDecorationsHeight);
300
 
                w = 2 * H * gamma;
301
 
                dw = (Ws - w) / 2;
302
 
                //g_print ("dw : %.2f (=) %.2f\n", dw, h * gamma + r + (l+(r==0)*2)*sqrt(1+gamma*gamma));
303
 
                dx = dw;
304
 
        }
305
 
        else
306
 
        {
307
 
                w = cairo_dock_get_current_dock_width_linear (pDock);
308
 
                gamma = w / 2 / H;
309
 
                dw = h * gamma + r + (l+(r==0)*2)*sqrt(1+gamma*gamma);
310
 
                h = pDock->iDecorationsHeight;
311
 
                Icon *pFirstIcon = cairo_dock_get_first_icon (pDock->icons);
312
 
                dx = (pFirstIcon != NULL ? pFirstIcon->fX - 0*myDocksParam.iFrameMargin : r);
313
 
                dx += (pDock->iOffsetForExtend * (pDock->fAlign - .5) * 2);
314
 
        }
315
 
        
316
 
        int sens;
317
 
        if (pDock->container.bDirectionUp)
318
 
        {
319
 
                sens = 1;
320
 
                dy = pDock->container.iHeight - pDock->iDecorationsHeight - 1.5 * l;
321
 
        }
322
 
        else
323
 
        {
324
 
                sens = -1;
325
 
                dy = pDock->iDecorationsHeight + 1.5 * l;
326
 
        }
327
 
        
328
 
        //\____________________ On trace le cadre.
329
 
        cairo_save (pCairoContext);
330
 
        
331
 
        double fDeltaXTrapeze = cairo_dock_draw_frame (pCairoContext, r, l, w, pDock->iDecorationsHeight, dx, dy, sens, gamma, pDock->container.bIsHorizontal, myDocksParam.bRoundedBottomCorner);
332
 
        
333
 
        //\____________________ On dessine les decorations dedans.
334
 
        dy = (pDock->container.bDirectionUp ? pDock->container.iHeight - pDock->iDecorationsHeight - l : l);
335
 
        cairo_dock_render_decorations_in_frame (pCairoContext, pDock, dy, dx-fDeltaXTrapeze, w+2*fDeltaXTrapeze);
336
 
        
337
 
        //\____________________ On dessine le cadre.
338
 
        if (l > 0)
339
 
        {
340
 
                cairo_set_line_width (pCairoContext, l);
341
 
                if (myDocksParam.bUseDefaultColors)
342
 
                        gldi_style_colors_set_line_color (pCairoContext);
343
 
                else
344
 
                        gldi_color_set_cairo (pCairoContext, &myDocksParam.fLineColor);
345
 
                cairo_stroke (pCairoContext);
346
 
        }
347
 
        else
348
 
                cairo_new_path (pCairoContext);
349
 
        
350
 
        /// donner un effet d'epaisseur => chaud du slip avec les separateurs physiques !
351
 
        
352
 
        
353
 
        cairo_restore (pCairoContext);
354
 
        
355
 
        //\____________________ On dessine la ficelle qui les joint.
356
 
        if (myIconsParam.iStringLineWidth > 0)
357
 
                cairo_dock_draw_string (pCairoContext, pDock, myIconsParam.iStringLineWidth, FALSE, (myIconsParam.iSeparatorType == CAIRO_DOCK_FLAT_SEPARATOR || myIconsParam.iSeparatorType == CAIRO_DOCK_PHYSICAL_SEPARATOR));
358
 
        
359
 
        //\____________________ On dessine les icones et les etiquettes, en tenant compte de l'ordre pour dessiner celles en arriere-plan avant celles en avant-plan.
360
 
        GList *pFirstDrawnElement = cairo_dock_get_first_drawn_element_linear (pDock->icons);
361
 
        if (pFirstDrawnElement == NULL)
362
 
                return;
363
 
                
364
 
        double fDockMagnitude = cairo_dock_calculate_magnitude (pDock->iMagnitudeIndex);
365
 
        
366
 
        Icon *icon;
367
 
        GList *ic = pFirstDrawnElement;
368
 
        if (myIconsParam.iSeparatorType == CAIRO_DOCK_FLAT_SEPARATOR || myIconsParam.iSeparatorType == CAIRO_DOCK_PHYSICAL_SEPARATOR)
369
 
        {
370
 
                cairo_set_line_cap (pCairoContext, CAIRO_LINE_CAP_SQUARE);
371
 
                do
372
 
                {
373
 
                        icon = ic->data;
374
 
                        
375
 
                        if (icon->cFileName == NULL && CAIRO_DOCK_ICON_TYPE_IS_SEPARATOR (icon))
376
 
                        {
377
 
                                cairo_save (pCairoContext);
378
 
                                cd_rendering_draw_3D_separator (icon, pCairoContext, pDock, pDock->container.bIsHorizontal, TRUE);
379
 
                                cairo_restore (pCairoContext);
380
 
                        }
381
 
                        
382
 
                        ic = cairo_dock_get_next_element (ic, pDock->icons);
383
 
                } while (ic != pFirstDrawnElement);
384
 
                
385
 
                do
386
 
                {
387
 
                        icon = ic->data;
388
 
                        
389
 
                        if (icon->cFileName != NULL || ! CAIRO_DOCK_ICON_TYPE_IS_SEPARATOR (icon))
390
 
                        {
391
 
                                cairo_save (pCairoContext);
392
 
                                cairo_dock_render_one_icon (icon, pDock, pCairoContext, fDockMagnitude, TRUE);
393
 
                                cairo_restore (pCairoContext);
394
 
                        }
395
 
                        
396
 
                        ic = cairo_dock_get_next_element (ic, pDock->icons);
397
 
                } while (ic != pFirstDrawnElement);
398
 
                
399
 
                if (myIconsParam.iSeparatorType == CAIRO_DOCK_PHYSICAL_SEPARATOR)
400
 
                {
401
 
                        do
402
 
                        {
403
 
                                icon = ic->data;
404
 
                                
405
 
                                if (icon->cFileName == NULL && CAIRO_DOCK_ICON_TYPE_IS_SEPARATOR (icon))
406
 
                                {
407
 
                                        cairo_save (pCairoContext);
408
 
                                        cd_rendering_draw_3D_separator (icon, pCairoContext, pDock, pDock->container.bIsHorizontal, FALSE);
409
 
                                        cairo_restore (pCairoContext);
410
 
                                }
411
 
                                
412
 
                                ic = cairo_dock_get_next_element (ic, pDock->icons);
413
 
                        } while (ic != pFirstDrawnElement);
414
 
                }
415
 
        }
416
 
        else
417
 
        {
418
 
                do
419
 
                {
420
 
                        icon = ic->data;
421
 
                        
422
 
                        cairo_save (pCairoContext);
423
 
                        cairo_dock_render_one_icon (icon, pDock, pCairoContext, fDockMagnitude, TRUE);
424
 
                        cairo_restore (pCairoContext);
425
 
                        
426
 
                        ic = cairo_dock_get_next_element (ic, pDock->icons);
427
 
                } while (ic != pFirstDrawnElement);
428
 
        }
429
 
}
430
 
 
431
 
static gboolean _cd_separator_is_impacted (Icon *icon, CairoDock *pDock, double fXMin, double fXMax, gboolean bBackGround, gboolean bIncludeEdges)
432
 
{
433
 
        double hi = /**myIconsParam.fReflectSize*/pDock->iIconSize * myIconsParam.fReflectHeightRatio * pDock->container.fRatio + myDocksParam.iFrameMargin;
434
 
        hi = (pDock->container.bDirectionUp ? pDock->container.iHeight - (icon->fDrawY + icon->fHeight * icon->fScale) : icon->fDrawY);
435
 
        double fLeftInclination = fabs (icon->fDrawX - pDock->container.iWidth / 2) / iVanishingPointY;
436
 
        double fRightInclination = fabs (icon->fDrawX + icon->fWidth * icon->fScale - pDock->container.iWidth / 2) / iVanishingPointY;
437
 
        
438
 
        double fHeight;
439
 
        if (bIncludeEdges)
440
 
        {
441
 
                fHeight = (bBackGround ? pDock->iDecorationsHeight - hi : hi) + (bIncludeEdges ? myDocksParam.iDockLineWidth : 0);
442
 
                //fBigWidth = fabs (fRightInclination - fLeftInclination) * (bBackGround ? iVanishingPointY : iVanishingPointY + fHeight);
443
 
                //fLittleWidth = fabs (fRightInclination - fLeftInclination) * (bBackGround ? iVanishingPointY - fHeight : iVanishingPointY);
444
 
        }
445
 
        else
446
 
        {
447
 
                fHeight = pDock->iDecorationsHeight;
448
 
                //fBigWidth = fabs (fRightInclination - fLeftInclination) * (iVanishingPointY + fHeight);
449
 
                //fLittleWidth = fabs (fRightInclination - fLeftInclination) * (iVanishingPointY - fHeight);
450
 
        }
451
 
        //double fDeltaXLeft = fHeight * fLeftInclination;
452
 
        //double fDeltaXRight = fHeight * fRightInclination;
453
 
        //double fDeltaX = MAX (fDeltaXLeft, fDeltaXRight);
454
 
        //g_print ("fBigWidth : %.2f ; fLittleWidth : %.2f\n", fBigWidth, fLittleWidth);
455
 
 
456
 
        /*
457
 
        int sens;
458
 
        double fDockOffsetX, fDockOffsetY;
459
 
        if (pDock->container.bDirectionUp)
460
 
        {
461
 
                sens = 1;
462
 
                if (bIncludeEdges)
463
 
                        fDockOffsetY =  pDock->container.iHeight - fHeight - (bBackGround ? myDocksParam.iDockLineWidth + hi : 0);
464
 
                else
465
 
                        fDockOffsetY =  pDock->container.iHeight - fHeight;
466
 
        }
467
 
        else
468
 
        {
469
 
                sens = -1;
470
 
                if (bIncludeEdges)
471
 
                        fDockOffsetY = fHeight + (bBackGround ? myDocksParam.iDockLineWidth + hi : 0);
472
 
                else
473
 
                        fDockOffsetY = fHeight;
474
 
        }
475
 
        
476
 
        if (bIncludeEdges)
477
 
                        fDockOffsetX = icon->fDrawX - (bBackGround ? fHeight * fLeftInclination : 0);
478
 
                else
479
 
                        fDockOffsetX = icon->fDrawX - (fHeight - hi) * fLeftInclination;
480
 
        */
481
 
        double fXLeft, fXRight;
482
 
        if (icon->fDrawX + icon->fWidth * icon->fScale / 2 > pDock->container.iWidth / 2)  // on est a droite.
483
 
        {
484
 
                if (bIncludeEdges)
485
 
                {
486
 
                        if (bBackGround)
487
 
                        {
488
 
                                fXLeft = icon->fDrawX - fHeight * fLeftInclination;
489
 
                                fXRight = icon->fDrawX + icon->fWidth * icon->fScale;
490
 
                        }
491
 
                        else
492
 
                        {
493
 
                                fXLeft = icon->fDrawX;
494
 
                                fXRight = icon->fDrawX + icon->fWidth * icon->fScale + fHeight * fRightInclination;
495
 
                        }
496
 
                }
497
 
                else
498
 
                {
499
 
                        fXLeft = icon->fDrawX - (fHeight - hi) * fLeftInclination;
500
 
                        fXRight = icon->fDrawX + icon->fWidth * icon->fScale + hi * fRightInclination;
501
 
                }
502
 
        }
503
 
        else  // a gauche.
504
 
        {
505
 
                if (bIncludeEdges)
506
 
                {
507
 
                        if (bBackGround)
508
 
                        {
509
 
                                fXLeft = icon->fDrawX;
510
 
                                fXRight = icon->fDrawX + icon->fWidth * icon->fScale + fHeight * fRightInclination;
511
 
                        }
512
 
                        else
513
 
                        {
514
 
                                fXLeft = icon->fDrawX - fHeight * fLeftInclination;
515
 
                                fXRight = icon->fDrawX + icon->fWidth * icon->fScale;
516
 
                        }
517
 
                }
518
 
                else
519
 
                {
520
 
                        fXLeft = icon->fDrawX - hi * fLeftInclination;
521
 
                        fXRight = icon->fDrawX + icon->fWidth * icon->fScale +(fHeight - hi) * fRightInclination;
522
 
                }
523
 
        }
524
 
        
525
 
        return (fXLeft <= fXMax && floor (fXRight) > fXMin);
526
 
}
527
 
 
528
 
static void cd_rendering_render_optimized_3D_plane (cairo_t *pCairoContext, CairoDock *pDock, GdkRectangle *pArea)
529
 
{
530
 
        //g_print ("%s ((%d;%d) x (%d;%d) / (%dx%d))\n", __func__, pArea->x, pArea->y, pArea->width, pArea->height, pDock->container.iWidth, pDock->container.iHeight);
531
 
        double fLineWidth = myDocksParam.iDockLineWidth;
532
 
        double fMargin = myDocksParam.iFrameMargin;
533
 
        int iHeight = pDock->container.iHeight;
534
 
        
535
 
        //\____________________ On dessine les decorations du fond sur la portion de fenetre.
536
 
        cairo_save (pCairoContext);
537
 
        
538
 
        double fDockOffsetX, fDockOffsetY;
539
 
        if (pDock->container.bIsHorizontal)
540
 
        {
541
 
                fDockOffsetX = pArea->x;
542
 
                fDockOffsetY = (pDock->container.bDirectionUp ? iHeight - pDock->iDecorationsHeight - fLineWidth : fLineWidth);
543
 
        }
544
 
        else
545
 
        {
546
 
                fDockOffsetX = (pDock->container.bDirectionUp ? iHeight - pDock->iDecorationsHeight - fLineWidth : fLineWidth);
547
 
                fDockOffsetY = pArea->y;
548
 
        }
549
 
        
550
 
        //cairo_move_to (pCairoContext, fDockOffsetX, fDockOffsetY);
551
 
        if (pDock->container.bIsHorizontal)
552
 
                cairo_rectangle (pCairoContext, fDockOffsetX, fDockOffsetY, pArea->width, pDock->iDecorationsHeight);
553
 
        else
554
 
                cairo_rectangle (pCairoContext, fDockOffsetX, fDockOffsetY, pDock->iDecorationsHeight, pArea->height);
555
 
        
556
 
        double fRadius = MIN (myDocksParam.iDockRadius, (pDock->iDecorationsHeight + myDocksParam.iDockLineWidth) / 2 - 1);
557
 
        double fDeltaXTrapeze=0.;
558
 
        double fOffsetX;
559
 
        if (cairo_dock_is_extended_dock (pDock))  // mode panel etendu.
560
 
        {
561
 
                fOffsetX = fRadius + fLineWidth / 2;
562
 
        }
563
 
        else
564
 
        {
565
 
                Icon *pFirstIcon = cairo_dock_get_first_icon (pDock->icons);
566
 
                fOffsetX = (pFirstIcon != NULL ? pFirstIcon->fX - fMargin : fRadius + fLineWidth / 2);
567
 
        }
568
 
        double fDockWidth = cairo_dock_get_current_dock_width_linear (pDock);
569
 
        if (pDock->backgroundBuffer.pSurface != NULL)
570
 
        {
571
 
                double fInclinationOnHorizon = (fDockWidth / 2) / iVanishingPointY;
572
 
                double fRadius = myDocksParam.iDockRadius;
573
 
                if (2*fRadius > pDock->iDecorationsHeight + fLineWidth)
574
 
                        fRadius = (pDock->iDecorationsHeight + fLineWidth) / 2 - 1;
575
 
                double fDeltaXForLoop = fInclinationOnHorizon * (pDock->iDecorationsHeight + fLineWidth - (/**myDocksParam.bRoundedBottomCorner*/TRUE ? 2 : 1) * fRadius);
576
 
                
577
 
                double cosa = 1. / sqrt (1 + fInclinationOnHorizon * fInclinationOnHorizon);
578
 
                fDeltaXTrapeze = fDeltaXForLoop + fRadius * cosa;
579
 
                
580
 
                double sina = cosa * fInclinationOnHorizon;
581
 
                fDeltaXTrapeze = fInclinationOnHorizon * (pDock->iDecorationsHeight - (FALSE ? 2 : 1-sina) * fRadius) + fRadius * (FALSE ? 1 : cosa);
582
 
        }
583
 
        cairo_dock_render_decorations_in_frame (pCairoContext, pDock, pDock->container.bIsHorizontal ? fDockOffsetY : fDockOffsetX, fOffsetX-fDeltaXTrapeze, fDockWidth+2*fDeltaXTrapeze);
584
 
        
585
 
        
586
 
        //\____________________ On dessine la partie du cadre qui va bien.
587
 
        cairo_new_path (pCairoContext);
588
 
        cairo_set_line_width (pCairoContext, fLineWidth);
589
 
        if (myDocksParam.bUseDefaultColors)
590
 
                gldi_style_colors_set_line_color (pCairoContext);
591
 
        else
592
 
                gldi_color_set_cairo (pCairoContext, &myDocksParam.fLineColor);
593
 
        if (pDock->container.bIsHorizontal)
594
 
        {
595
 
                cairo_move_to (pCairoContext, fDockOffsetX, fDockOffsetY - 0.5*fLineWidth);
596
 
                cairo_rel_line_to (pCairoContext, pArea->width, 0);
597
 
                cairo_stroke (pCairoContext);
598
 
                
599
 
                cairo_new_path (pCairoContext);
600
 
                cairo_move_to (pCairoContext, fDockOffsetX, (pDock->container.bDirectionUp ? iHeight - 0.5*fLineWidth : pDock->iDecorationsHeight + 1.5 * fLineWidth));
601
 
                cairo_rel_line_to (pCairoContext, pArea->width, 0);
602
 
        }
603
 
        else
604
 
        {
605
 
                cairo_move_to (pCairoContext, fDockOffsetX - .5*fLineWidth, fDockOffsetY);
606
 
                cairo_rel_line_to (pCairoContext, 0, pArea->height);
607
 
                cairo_stroke (pCairoContext);
608
 
                
609
 
                cairo_new_path (pCairoContext);
610
 
                cairo_move_to (pCairoContext, (pDock->container.bDirectionUp ? iHeight - fLineWidth / 2 : pDock->iDecorationsHeight + 1.5 * fLineWidth), fDockOffsetY);
611
 
                cairo_rel_line_to (pCairoContext, 0, pArea->height);
612
 
        }
613
 
        cairo_stroke (pCairoContext);
614
 
        
615
 
        cairo_restore (pCairoContext);
616
 
        
617
 
        //\____________________ On dessine les icones impactees.
618
 
        GList *pFirstDrawnElement = pDock->icons;
619
 
        if (pFirstDrawnElement != NULL)
620
 
        {
621
 
                double fXMin = (pDock->container.bIsHorizontal ? pArea->x : pArea->y), fXMax = (pDock->container.bIsHorizontal ? pArea->x + pArea->width : pArea->y + pArea->height);
622
 
                double fDockMagnitude = cairo_dock_calculate_magnitude (pDock->iMagnitudeIndex);
623
 
                double fXLeft, fXRight;
624
 
                Icon *icon;
625
 
                GList *ic = pFirstDrawnElement;
626
 
                
627
 
                if (myIconsParam.iSeparatorType == CAIRO_DOCK_FLAT_SEPARATOR || myIconsParam.iSeparatorType == CAIRO_DOCK_PHYSICAL_SEPARATOR)
628
 
                {
629
 
                        cairo_set_line_cap (pCairoContext, CAIRO_LINE_CAP_SQUARE);
630
 
                        do
631
 
                        {
632
 
                                icon = ic->data;
633
 
                                
634
 
                                if (CAIRO_DOCK_ICON_TYPE_IS_SEPARATOR (icon) && icon->cFileName == NULL)
635
 
                                {
636
 
                                        if (_cd_separator_is_impacted (icon, pDock, fXMin, fXMax, TRUE, (myIconsParam.iSeparatorType == CAIRO_DOCK_PHYSICAL_SEPARATOR)))
637
 
                                        {
638
 
                                                cairo_save (pCairoContext);
639
 
                                                cd_rendering_draw_3D_separator (icon, pCairoContext, pDock, pDock->container.bIsHorizontal, TRUE);
640
 
                                                cairo_restore (pCairoContext);
641
 
                                        }
642
 
                                }
643
 
                                
644
 
                                ic = cairo_dock_get_next_element (ic, pDock->icons);
645
 
                        } while (ic != pFirstDrawnElement);
646
 
                        
647
 
                        do
648
 
                        {
649
 
                                icon = ic->data;
650
 
                                if (! CAIRO_DOCK_ICON_TYPE_IS_SEPARATOR (icon) || icon->cFileName != NULL)
651
 
                                {
652
 
                                        fXLeft = icon->fDrawX + icon->fScale + 1;
653
 
                                        fXRight = icon->fDrawX + (icon->fWidth - 1) * icon->fScale * icon->fWidthFactor - 1;
654
 
                                        
655
 
                                        if (fXLeft <= fXMax && floor (fXRight) > fXMin)
656
 
                                        {
657
 
                                                //if (icon->fDrawX >= 0 && icon->fDrawX + icon->fWidth * icon->fScale <= pDock->container.iWidth)
658
 
                                                        icon->fAlpha = 1;
659
 
                                                //else
660
 
                                                //      icon->fAlpha = .25;
661
 
                                                
662
 
                                                cairo_save (pCairoContext);
663
 
                                                cairo_dock_render_one_icon (icon, pDock, pCairoContext, fDockMagnitude, TRUE);
664
 
                                                cairo_restore (pCairoContext);
665
 
                                        }
666
 
                                }
667
 
                                ic = cairo_dock_get_next_element (ic, pDock->icons);
668
 
                        } while (ic != pFirstDrawnElement);
669
 
                        
670
 
                        if (myIconsParam.iSeparatorType == CAIRO_DOCK_PHYSICAL_SEPARATOR)
671
 
                        {
672
 
                                do
673
 
                                {
674
 
                                        icon = ic->data;
675
 
                                        
676
 
                                        if (CAIRO_DOCK_ICON_TYPE_IS_SEPARATOR (icon) && icon->cFileName == NULL)
677
 
                                        {
678
 
                                                if (_cd_separator_is_impacted (icon, pDock, fXMin, fXMax, FALSE, (myIconsParam.iSeparatorType == CAIRO_DOCK_PHYSICAL_SEPARATOR)))
679
 
                                                {
680
 
                                                        cairo_save (pCairoContext);
681
 
                                                        cd_rendering_draw_3D_separator (icon, pCairoContext, pDock, pDock->container.bIsHorizontal, FALSE);
682
 
                                                        cairo_restore (pCairoContext);
683
 
                                                }
684
 
                                        }
685
 
                                        
686
 
                                        ic = cairo_dock_get_next_element (ic, pDock->icons);
687
 
                                } while (ic != pFirstDrawnElement);
688
 
                        }
689
 
                }
690
 
                else
691
 
                {
692
 
                        do
693
 
                        {
694
 
                                icon = ic->data;
695
 
                                fXLeft = icon->fDrawX + icon->fScale + 1;
696
 
                                fXRight = icon->fDrawX + (icon->fWidth - 1) * icon->fScale * icon->fWidthFactor - 1;
697
 
                                
698
 
                                if (fXLeft <= fXMax && floor (fXRight) > fXMin)
699
 
                                {
700
 
                                        //if (icon->fDrawX >= 0 && icon->fDrawX + icon->fWidth * icon->fScale <= pDock->container.iWidth)
701
 
                                                icon->fAlpha = 1;
702
 
                                        //else
703
 
                                        //      icon->fAlpha = .25;
704
 
                                        
705
 
                                        cairo_save (pCairoContext);
706
 
                                        cairo_dock_render_one_icon (icon, pDock, pCairoContext, fDockMagnitude, TRUE);
707
 
                                        cairo_restore (pCairoContext);
708
 
                                }
709
 
                                ic = cairo_dock_get_next_element (ic, pDock->icons);
710
 
                        } while (ic != pFirstDrawnElement);
711
 
                }
712
 
        }
713
 
}
714
 
 
715
 
 
716
 
static Icon *cd_rendering_calculate_icons_3D_plane (CairoDock *pDock)
717
 
{
718
 
        Icon *pPointedIcon = cairo_dock_apply_wave_effect_linear (pDock);
719
 
        
720
 
        //\____________________ On calcule les position/etirements/alpha des icones.
721
 
        double fReflectionOffsetY = (pDock->container.bDirectionUp ? -1 : 1) * /**myIconsParam.fReflectSize*/pDock->iIconSize * myIconsParam.fReflectHeightRatio * pDock->container.fRatio;
722
 
        double offsetx = pDock->iOffsetForExtend * (pDock->fAlign - .5) * 2;
723
 
        Icon* icon;
724
 
        GList* ic;
725
 
        for (ic = pDock->icons; ic != NULL; ic = ic->next)
726
 
        {
727
 
                icon = ic->data;
728
 
                cd_rendering_calculate_construction_parameters_3D_plane (icon, offsetx, fReflectionOffsetY);
729
 
        }
730
 
        
731
 
        cairo_dock_check_if_mouse_inside_linear (pDock);
732
 
        
733
 
        cairo_dock_check_can_drop_linear (pDock);
734
 
        
735
 
        return pPointedIcon;
736
 
}
737
 
 
738
 
 
739
 
 
740
 
static void cd_rendering_render_3D_plane_opengl (CairoDock *pDock)
741
 
{
742
 
        //\_____________ On definit notre cadre.
743
 
        _define_parameters (hi, h0, H, l, r, gamma, h, w, dw);
744
 
        h = pDock->iDecorationsHeight;
745
 
        if (h < 2 * r)
746
 
                r = h / 2;
747
 
        
748
 
        double dx, dy;
749
 
        if (cairo_dock_is_extended_dock (pDock))  // mode panel etendu.
750
 
        {
751
 
                double Ws = pDock->container.iWidth;
752
 
                double W = Ws - 2 * r;
753
 
                double a = H + hi;
754
 
                double b = H + hi + h0 - W / 2;
755
 
                double c = - W / 2;
756
 
                gamma = (-b + sqrt (b * b - 4 * a * c)) / 2  / a;
757
 
                h = hi + h0 / (1 + gamma);
758
 
                //g_print ("h : %.2f (=) %d\n", h, pDock->iDecorationsHeight);
759
 
                w = 2 * H * gamma;
760
 
                dw = (Ws - w) / 2;
761
 
                //g_print ("dw : %.2f (=) %.2f\n", dw, h * gamma + r + (l+(r==0)*2)*sqrt(1+gamma*gamma));
762
 
                dx = dw;
763
 
        }
764
 
        else
765
 
        {
766
 
                w = cairo_dock_get_current_dock_width_linear (pDock);
767
 
                gamma = w / 2 / H;
768
 
                dw = h * gamma + r + (l+(r==0)*2)*sqrt(1+gamma*gamma);
769
 
                h = pDock->iDecorationsHeight;
770
 
                Icon *pFirstIcon = cairo_dock_get_first_icon (pDock->icons);
771
 
                dx = (pFirstIcon != NULL ? pFirstIcon->fX - myDocksParam.iFrameMargin : r);
772
 
                dx += (pDock->iOffsetForExtend * (pDock->fAlign - .5) * 2);
773
 
        }
774
 
        
775
 
        //\_____________ On genere les coordonnees du contour.
776
 
        double fDeltaXTrapeze;
777
 
        const CairoDockGLPath *pFramePath = cairo_dock_generate_trapeze_path (w - (/**myDocksParam.bRoundedBottomCorner*/TRUE ? 0 : 2*l/gamma), h+l, r, myDocksParam.bRoundedBottomCorner, gamma, &fDeltaXTrapeze);
778
 
        dx = dx - fDeltaXTrapeze;
779
 
        dy = pDock->iDecorationsHeight + 1.5*l;
780
 
        
781
 
        //\_____________ On remplit avec le fond.
782
 
        glPushMatrix ();
783
 
        cairo_dock_set_container_orientation_opengl (CAIRO_CONTAINER (pDock));
784
 
        glTranslatef (dx + (w+2*fDeltaXTrapeze)/2,
785
 
                dy - h/2,
786
 
                0.);
787
 
        
788
 
        cairo_dock_fill_gl_path (pFramePath, pDock->backgroundBuffer.iTexture);
789
 
        
790
 
        //\_____________ On trace le contour.
791
 
        if (l != 0)
792
 
        {
793
 
                glLineWidth (l);
794
 
                if (myDocksParam.bUseDefaultColors)
795
 
                        gldi_style_colors_set_line_color (NULL);
796
 
                else
797
 
                        gldi_color_set_opengl (&myDocksParam.fLineColor);
798
 
                _cairo_dock_set_blend_alpha ();
799
 
                cairo_dock_stroke_gl_path (pFramePath, TRUE);
800
 
        }
801
 
        glPopMatrix ();
802
 
        
803
 
        //\____________________ On dessine la ficelle qui les joint.
804
 
        if (myIconsParam.iStringLineWidth > 0)
805
 
                cairo_dock_draw_string_opengl (pDock, myIconsParam.iStringLineWidth, FALSE, (myIconsParam.iSeparatorType == CAIRO_DOCK_FLAT_SEPARATOR || myIconsParam.iSeparatorType == CAIRO_DOCK_PHYSICAL_SEPARATOR));
806
 
        
807
 
        //\____________________ On dessine les icones et les etiquettes, en tenant compte de l'ordre pour dessiner celles en arriere-plan avant celles en avant-plan.
808
 
        GList *pFirstDrawnElement = cairo_dock_get_first_drawn_element_linear (pDock->icons);
809
 
        if (pFirstDrawnElement == NULL)
810
 
                return;
811
 
                
812
 
        double fDockMagnitude = cairo_dock_calculate_magnitude (pDock->iMagnitudeIndex);
813
 
        Icon *icon;
814
 
        GList *ic = pFirstDrawnElement;
815
 
        
816
 
        ///glLoadIdentity ();
817
 
        if (myIconsParam.iSeparatorType == CAIRO_DOCK_FLAT_SEPARATOR || myIconsParam.iSeparatorType == CAIRO_DOCK_PHYSICAL_SEPARATOR)
818
 
        {
819
 
                do
820
 
                {
821
 
                        icon = ic->data;
822
 
                        
823
 
                        if (icon->cFileName == NULL && CAIRO_DOCK_ICON_TYPE_IS_SEPARATOR (icon))
824
 
                        {
825
 
                                glPushMatrix ();
826
 
                                if (myIconsParam.iSeparatorType == CAIRO_DOCK_FLAT_SEPARATOR)
827
 
                                        cd_rendering_draw_flat_separator_opengl (icon, pDock);
828
 
                                else
829
 
                                        cd_rendering_draw_physical_separator_opengl (icon, pDock, TRUE, NULL, NULL);
830
 
                                glPopMatrix ();
831
 
                        }
832
 
                        
833
 
                        ic = cairo_dock_get_next_element (ic, pDock->icons);
834
 
                } while (ic != pFirstDrawnElement);
835
 
                
836
 
                do
837
 
                {
838
 
                        icon = ic->data;
839
 
                        
840
 
                        if (icon->cFileName != NULL || ! CAIRO_DOCK_ICON_TYPE_IS_SEPARATOR (icon))
841
 
                        {
842
 
                                glPushMatrix ();
843
 
                                cairo_dock_render_one_icon_opengl (icon, pDock, fDockMagnitude, TRUE);
844
 
                                glPopMatrix ();
845
 
                        }
846
 
                        
847
 
                        ic = cairo_dock_get_next_element (ic, pDock->icons);
848
 
                } while (ic != pFirstDrawnElement);
849
 
                
850
 
                if (myIconsParam.iSeparatorType == CAIRO_DOCK_PHYSICAL_SEPARATOR)
851
 
                {
852
 
                        do
853
 
                        {
854
 
                                icon = ic->data;
855
 
                                
856
 
                                if (icon->cFileName == NULL && CAIRO_DOCK_ICON_TYPE_IS_SEPARATOR (icon))
857
 
                                {
858
 
                                        glPushMatrix ();
859
 
                                        cd_rendering_draw_physical_separator_opengl (icon, pDock, FALSE, NULL, NULL);
860
 
                                        glPopMatrix ();
861
 
                                }
862
 
                                
863
 
                                ic = cairo_dock_get_next_element (ic, pDock->icons);
864
 
                        } while (ic != pFirstDrawnElement);
865
 
                }
866
 
        }
867
 
        else
868
 
        {
869
 
                do
870
 
                {
871
 
                        icon = ic->data;
872
 
                        
873
 
                        glPushMatrix ();
874
 
                        cairo_dock_render_one_icon_opengl (icon, pDock, fDockMagnitude, TRUE);
875
 
                        glPopMatrix ();
876
 
                        
877
 
                        ic = cairo_dock_get_next_element (ic, pDock->icons);
878
 
                } while (ic != pFirstDrawnElement);
879
 
        }
880
 
}
881
 
 
882
 
 
883
 
void cd_rendering_register_3D_plane_renderer (const gchar *cRendererName)
884
 
{
885
 
        CairoDockRenderer *pRenderer = g_new0 (CairoDockRenderer, 1);
886
 
        // interface
887
 
        pRenderer->compute_size = cd_rendering_calculate_max_dock_size_3D_plane;
888
 
        pRenderer->calculate_icons = cd_rendering_calculate_icons_3D_plane;
889
 
        pRenderer->render = cd_rendering_render_3D_plane;
890
 
        pRenderer->render_optimized = cd_rendering_render_optimized_3D_plane;
891
 
        pRenderer->render_opengl = cd_rendering_render_3D_plane_opengl;
892
 
        pRenderer->set_subdock_position = cairo_dock_set_subdock_position_linear;
893
 
        // parametres
894
 
        pRenderer->bUseReflect = TRUE;
895
 
        pRenderer->cDisplayedName = D_ (cRendererName);
896
 
        pRenderer->cReadmeFilePath = g_strdup (MY_APPLET_SHARE_DATA_DIR"/readme-3D-plane-view");
897
 
        pRenderer->cPreviewFilePath = g_strdup (MY_APPLET_SHARE_DATA_DIR"/preview-3D-plane.jpg");
898
 
        
899
 
        cairo_dock_register_renderer (cRendererName, pRenderer);
900
 
}