~ubuntu-branches/ubuntu/quantal/cairo-dock-plug-ins/quantal-201208191523

« back to all changes in this revision

Viewing changes to dock-rendering/src/rendering-diapo-simple.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-10 00:05:57 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100810000557-pfxoz5w7hbyclcqh
Tags: 2.2.0~0beta4-0ubuntu1
* New Upstream Version (LP: #614625)
* Fixed a few bugs on LP:
 - LP: #483963: Dustbin applet does not display trashes on all volumes
 - LP: #485159: Some apps have problem with Systray
 - LP: #500677: ~/.xsession-errors is too much used by CD
 - LP: #500979: Shortcuts: the order gets messed up
 - LP: #521531: Mail: crashes on Maildir
 - LP: #519915: GTG: create a new applet to control GTG
 - LP: #526138: GMenu doesn't handle desktop file exec strings properly
 - LP: #531317: CMake: Added an error if the prefix of 'cairo-dock-plugins'
                 is not the same 'cairo-dock-core'
 - LP: #531319: CMake: check the version of 'cairo-dock' when building
                 'cairo-dock-plugins'
 - LP: #537115: Click at the position where icon lavel was, the icon
                 and dock still receive the event
 - LP: #537943: Terminal applet shortkey behaviour
 - LP: #538637: Trash applet doesn't create .trashinfo files on XFCE
 - More details on the 'ChangeLog' file
* debian/rules:
 - Autotools has been replaced by CMake
 - cdbs is now used.
* debian/copyright:
 - Updated with the new applets
* debian/control:
 - Autotools has been replaced by CMake
 - Added libcurl4-gnutls-dev, libindicator-dev, libdbusmenu-glib-dev
   libido-0.1-dev, libical-dev, libdbusmenu-gtk-dev as Build-deps
 - Bump Standard-Version to 3.9.1
 - Wget is required for dnd2share applet
 - Added the exact realease for 'cairo-dock-dev' in order to prevent any
    build error if this package is not already available (thx to didrocks)
* debian/cairo-dock-plug-ins*.install:
 - All sonames are now installed into lib32 or lib64 (lib*)

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
extern gdouble  my_diapo_simple_color_frame_stop[4];
40
40
extern gboolean my_diapo_simple_fade2bottom;
41
41
extern gboolean my_diapo_simple_fade2right;
42
 
extern guint    my_diapo_simple_arrowWidth;
43
 
extern guint    my_diapo_simple_arrowHeight;
 
42
extern gint    my_diapo_simple_arrowWidth;
 
43
extern gint    my_diapo_simple_arrowHeight;
44
44
extern gdouble  my_diapo_simple_arrowShift;
45
 
extern guint    my_diapo_simple_lineWidth;
46
 
extern guint    my_diapo_simple_radius;
 
45
extern gint    my_diapo_simple_lineWidth;
 
46
extern gint    my_diapo_simple_radius;
47
47
extern gdouble  my_diapo_simple_color_border_line[4];
48
48
extern gboolean my_diapo_simple_draw_background;
49
 
extern gboolean my_diapo_simple_display_all_icons;
50
 
 
51
 
const  gint X_BORDER_SPACE = 40;
52
 
const  gint ARROW_TIP = 10;  // pour gerer la pointe de la fleche.
53
 
 
 
49
extern gboolean my_diapo_simple_display_all_labels;
 
50
 
 
51
extern gdouble  my_diapo_simple_color_scrollbar_line[4];
 
52
extern gdouble  my_diapo_simple_color_scrollbar_inside[4];
 
53
extern gdouble  my_diapo_simple_color_grip[4];
 
54
 
 
55
const gint X_BORDER_SPACE = 40;  // espace laisse de chaque cote pour eviter de sortir trop facilement (et pour laisser de la place pour les etiquettes).
 
56
const gint ARROW_TIP = 5;  // pour gerer la pointe de la fleche.
 
57
const double fArrowHeight = 14, fScrollbarWidth = 10, fScrollbarArrowGap = 4;
 
58
const double fScrollbarIconGap = 10;
54
59
/// On considere qu'on a my_diapo_simple_iconGapX entre chaque icone horizontalement, et my_diapo_simple_iconGapX/2 entre les icones et les bords (pour aerer un peu plus le dessin). Idem verticalement. X_BORDER_SPACE est la pour empecher que les icones debordent de la fenetre au zoom.
55
60
 
 
61
typedef struct {
 
62
        gint nRowsX;
 
63
        gint nRowsY;
 
64
        gint iDeltaHeight;  // hauteur scrollable, en pixels
 
65
        gint iScrollOffset;  // hauteur scrollee, en pixels, positive.
 
66
        gboolean bDraggingScrollbar;  // si le clic est couramment enfonce sur la scrollbar.
 
67
        guint iSidPressEvent;  // sid du clic
 
68
        guint iSidReleaseEvent;  // sid du relachement du clic
 
69
        gint iClickY;  // hauteur ou on a clique, en coordonnees fenetre
 
70
        gint iClickOffset;  // hauteur scrollee au moment du clic
 
71
        } CDSlideData;
 
72
 
 
73
static void cd_rendering_render_diapo_simple (cairo_t *pCairoContext, CairoDock *pDock);
56
74
 
57
75
// Fonctions utiles pour transformer l'index de la liste en couple (x,y) sur la grille et inversement.
58
76
static inline void _get_gridXY_from_index (guint nRowsX, guint index, guint* gridX, guint* gridY)
87
105
        return count;
88
106
}
89
107
 
90
 
 
91
 
void cd_rendering_calculate_max_dock_size_diapo_simple (CairoDock *pDock)
92
 
{
93
 
        // On calcule la configuration de la grille
 
108
const double sr = .5;  // screen ratio
 
109
 
 
110
static void _set_scroll (CairoDock *pDock, int iOffsetY)
 
111
{
 
112
        //g_print ("%s (%d)\n", __func__, iOffsetY);
 
113
        CDSlideData *pData = pDock->pRendererData;
 
114
        g_return_if_fail (pData != NULL);
 
115
        
 
116
        pData->iScrollOffset = MAX (0, MIN (iOffsetY, pData->iDeltaHeight));
 
117
        cairo_dock_calculate_dock_icons (pDock);
 
118
        gtk_widget_queue_draw (pDock->container.pWidget);
 
119
}
 
120
static gboolean _add_scroll (CairoDock *pDock, int iDeltaOffsetY)
 
121
{
 
122
        //g_print ("%s (%d)\n", __func__, iDeltaOffsetY);
 
123
        CDSlideData *pData = pDock->pRendererData;
 
124
        g_return_val_if_fail (pData != NULL, FALSE);
 
125
        
 
126
        if (iDeltaOffsetY < 0)
 
127
        {
 
128
                if (pData->iScrollOffset <= 0)
 
129
                        return FALSE;
 
130
        }
 
131
        else
 
132
        {
 
133
                if (pData->iScrollOffset >= pData->iDeltaHeight)
 
134
                        return FALSE;
 
135
        }
 
136
        _set_scroll (pDock, pData->iScrollOffset + iDeltaOffsetY);
 
137
        return TRUE;
 
138
}
 
139
 
 
140
static gboolean _cd_slide_on_scroll (gpointer data, Icon *pClickedIcon, CairoDock *pDock, int iDirection)
 
141
{
 
142
        CDSlideData *pData = pDock->pRendererData;
 
143
        g_return_val_if_fail (pData != NULL, CAIRO_DOCK_LET_PASS_NOTIFICATION);
 
144
        if (pData->iDeltaHeight == 0)
 
145
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
146
        
 
147
        gboolean bScrolled = _add_scroll (pDock, iDirection == 1 ? pDock->iMaxIconHeight : - pDock->iMaxIconHeight);
 
148
        return (bScrolled ? CAIRO_DOCK_INTERCEPT_NOTIFICATION : CAIRO_DOCK_LET_PASS_NOTIFICATION);
 
149
}
 
150
static gboolean _cd_slide_on_click (gpointer data, Icon *pClickedIcon, CairoDock *pDock, guint iButtonState)
 
151
{
 
152
        CDSlideData *pData = pDock->pRendererData;
 
153
        g_return_val_if_fail (pData != NULL, CAIRO_DOCK_LET_PASS_NOTIFICATION);
 
154
        if (pData->iDeltaHeight == 0)
 
155
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
156
        if (pData->bDraggingScrollbar)
 
157
                return CAIRO_DOCK_INTERCEPT_NOTIFICATION;
 
158
        else
 
159
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
160
}
 
161
gboolean _cd_slide_on_press_button (GtkWidget* pWidget, GdkEventButton* pButton, CairoDock *pDock)
 
162
{
 
163
        CDSlideData *pData = pDock->pRendererData;
 
164
        g_return_val_if_fail (pData != NULL, FALSE);
 
165
        if (pData->iDeltaHeight == 0)
 
166
                return FALSE;
 
167
        
 
168
        if (pButton->type == GDK_BUTTON_PRESS && pButton->button == 1)
 
169
        {
 
170
                double x_arrow = pDock->iMaxDockWidth - X_BORDER_SPACE - fScrollbarWidth;
 
171
                if (pButton->x > x_arrow)  // on a clique dans la zone de scroll.
 
172
                {
 
173
                        //g_print ("click (y=%d, scroll=%d)\n", (int) pButton->y, pData->iScrollOffset);
 
174
                        
 
175
                        // on regarde sur quoi on clic.
 
176
                        double y_arrow_top, y_arrow_bottom;
 
177
                        if (pDock->container.bDirectionUp)
 
178
                        {
 
179
                                y_arrow_bottom = pDock->iMaxDockHeight - (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth);
 
180
                                y_arrow_top = my_diapo_simple_lineWidth;
 
181
                        }
 
182
                        else
 
183
                        {
 
184
                                y_arrow_bottom = pDock->iMaxDockHeight - my_diapo_simple_lineWidth;
 
185
                                y_arrow_top = my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth;
 
186
                        }
 
187
                        if (pButton->y > y_arrow_top - fScrollbarArrowGap/2 && pButton->y < y_arrow_top + fArrowHeight + fScrollbarArrowGap/2)  // bouton haut
 
188
                        {
 
189
                                _set_scroll (pDock, 0);
 
190
                        }
 
191
                        else if (pButton->y < y_arrow_bottom + fScrollbarArrowGap/2 && pButton->y > y_arrow_bottom - fArrowHeight - fScrollbarArrowGap/2)  // bouton bas
 
192
                        {
 
193
                                _set_scroll (pDock, pData->iDeltaHeight);
 
194
                        }
 
195
                        else  // scrollbar
 
196
                        {
 
197
                                pData->bDraggingScrollbar = TRUE;
 
198
                                pData->iClickY = pButton->y;
 
199
                                pData->iClickOffset = pData->iScrollOffset;
 
200
                        }
 
201
                }
 
202
        }
 
203
        else if (GDK_BUTTON_RELEASE)
 
204
        {
 
205
                //g_print ("release\n");
 
206
                pData->bDraggingScrollbar = FALSE;
 
207
        }
 
208
        return FALSE;
 
209
}
 
210
static gboolean _cd_slide_on_mouse_moved (gpointer data, CairoDock *pDock, gboolean *bStartAnimation)
 
211
{
 
212
        CDSlideData *pData = pDock->pRendererData;
 
213
        g_return_val_if_fail (pData != NULL, CAIRO_DOCK_LET_PASS_NOTIFICATION);
 
214
        if (pData->iDeltaHeight == 0)
 
215
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
216
        
 
217
        if (pData->bDraggingScrollbar)
 
218
        {
 
219
                //g_print ("scroll on motion (y=%d)\n", pDock->container.iMouseY);
 
220
                
 
221
                double y_arrow_top, y_arrow_bottom;
 
222
                if (pDock->container.bDirectionUp)
 
223
                {
 
224
                        y_arrow_bottom = my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth;
 
225
                        y_arrow_top = pDock->iMaxDockHeight - my_diapo_simple_lineWidth;
 
226
                }
 
227
                else
 
228
                {
 
229
                        y_arrow_top = pDock->iMaxDockHeight - (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth);
 
230
                        y_arrow_bottom = my_diapo_simple_lineWidth;
 
231
                }
 
232
                double fFrameHeight = pDock->iMaxDockHeight- (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth);  // hauteur du cadre avec les rayons et sans la pointe.
 
233
                double fGripHeight = fFrameHeight / (fFrameHeight + pData->iDeltaHeight) * (y_arrow_top - y_arrow_bottom - 2*(fArrowHeight+fScrollbarArrowGap));
 
234
                double ygrip = (double) pData->iScrollOffset / pData->iDeltaHeight * (y_arrow_top - y_arrow_bottom - 2*(fArrowHeight+fScrollbarArrowGap) - fGripHeight);
 
235
                
 
236
                int delta = pDock->container.iMouseY - pData->iClickY;
 
237
                _set_scroll (pDock, (pData->iClickOffset + (double)delta / (y_arrow_top - y_arrow_bottom - 2*(fArrowHeight+fScrollbarArrowGap) - fGripHeight) * pData->iDeltaHeight));
 
238
        }
 
239
        return CAIRO_DOCK_INTERCEPT_NOTIFICATION;
 
240
}
 
241
gboolean cd_slide_on_leave (gpointer data, CairoDock *pDock, gboolean *bStartAnimation)
 
242
{
 
243
        CDSlideData *pData = pDock->pRendererData;
 
244
        //g_return_val_if_fail (pData != NULL, CAIRO_DOCK_LET_PASS_NOTIFICATION);
 
245
        if (pData == NULL || ! pDock->pRenderer || pDock->pRenderer->render != cd_rendering_render_diapo_simple)  // pas nous
 
246
                return CAIRO_DOCK_LET_PASS_NOTIFICATION;
 
247
        
 
248
        //g_print (" LEAVE (%d)\n", pData->bDraggingScrollbar);
 
249
        
 
250
        return (pData->bDraggingScrollbar ? CAIRO_DOCK_INTERCEPT_NOTIFICATION : CAIRO_DOCK_LET_PASS_NOTIFICATION);
 
251
}
 
252
static void cd_rendering_calculate_max_dock_size_diapo_simple (CairoDock *pDock)
 
253
{
 
254
        // On calcule la configuration de la grille sans contrainte.
94
255
        guint nRowsX = 0;  // nb colonnes.
95
256
        guint nRowsY = 0;  // nb lignes.
96
257
        guint nIcones = 0;  // nb icones.
 
258
        int iDeltaHeight = 0;  // hauteur ne pouvant rentrer dans le dock.
 
259
        int iMaxIconWidth = 0;
97
260
        nIcones = _cd_rendering_diapo_simple_guess_grid(pDock->icons, &nRowsX, &nRowsY);
98
261
        
99
 
        // On calcule la taille de l'affichage
 
262
        // On calcule la taille de l'affichage avec contrainte taille ecran.
100
263
        if(nIcones != 0)
101
264
        {
102
 
                int iMaxIconWidth = ((Icon*)pDock->icons->data)->fWidth;  // approximation un peu bof.
 
265
                // on calcule la largeur avec contrainte, ce qui donne aussi le nombre de lignes.
 
266
                iMaxIconWidth = ((Icon*)pDock->icons->data)->fWidth;  // approximation un peu bof.
103
267
                pDock->iMaxDockWidth = nRowsX * (iMaxIconWidth + my_diapo_simple_iconGapX) + 2*X_BORDER_SPACE;
104
 
                pDock->iMaxDockHeight = (nRowsY - 1) * (pDock->iMaxIconHeight + my_diapo_simple_iconGapY) +  // les icones
105
 
                        pDock->iMaxIconHeight * my_diapo_simple_fScaleMax +  // les icones des bords zooment
 
268
                int iMaxWidth = sr * g_desktopGeometry.iXScreenWidth[pDock->container.bIsHorizontal];
 
269
                if (pDock->iMaxDockWidth > iMaxWidth)
 
270
                {
 
271
                        nRowsX = (iMaxWidth - 2*X_BORDER_SPACE) / (iMaxIconWidth + my_diapo_simple_iconGapX);
 
272
                        nRowsY = ceil((double) nIcones / nRowsX);
 
273
                        pDock->iMaxDockWidth = nRowsX * (iMaxIconWidth + my_diapo_simple_iconGapX) + 2*X_BORDER_SPACE;
 
274
                        //g_print ("%d -> %d\n", iMaxWidth, pDock->iMaxDockWidth);
 
275
                }
 
276
                
 
277
                // on calcule la hauteur avec contrainte, ce qui donne aussi la marge de defilement.
 
278
                pDock->iMaxDockHeight = (nRowsY - 1) * (pDock->iMaxIconHeight * pDock->container.fRatio + my_diapo_simple_iconGapY) +  // les icones
 
279
                        pDock->iMaxIconHeight * pDock->container.fRatio * my_diapo_simple_fScaleMax +  // les icones des bords zooment
106
280
                        myLabels.iLabelSize +  // le texte des icones de la 1ere ligne
107
281
                        my_diapo_simple_lineWidth + // les demi-lignes du haut et du bas
108
282
                        my_diapo_simple_arrowHeight + ARROW_TIP;  // la fleche etendue
 
283
                int iMaxHeight = MIN (pDock->iMaxDockWidth, sr * g_desktopGeometry.iXScreenHeight[pDock->container.bIsHorizontal]);
 
284
                if (pDock->iMaxDockHeight > iMaxHeight)
 
285
                {
 
286
                        nRowsY = (iMaxHeight - (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth + myLabels.iLabelSize + pDock->iMaxIconHeight * pDock->container.fRatio * my_diapo_simple_fScaleMax)) / (pDock->iMaxIconHeight * pDock->container.fRatio + my_diapo_simple_iconGapY);
 
287
                        int iMaxDockHeight0 = pDock->iMaxDockHeight;
 
288
                        pDock->iMaxDockHeight = (nRowsY - 1) * (pDock->iMaxIconHeight * pDock->container.fRatio + my_diapo_simple_iconGapY) +
 
289
                                pDock->iMaxIconHeight * pDock->container.fRatio * my_diapo_simple_fScaleMax +
 
290
                                myLabels.iLabelSize +
 
291
                                my_diapo_simple_lineWidth +
 
292
                                my_diapo_simple_arrowHeight + ARROW_TIP;
 
293
                        iDeltaHeight = iMaxDockHeight0 - pDock->iMaxDockHeight;
 
294
                        //g_print ("%d -> %d\n", iMaxHeight, pDock->iMaxDockHeight);
 
295
                }
 
296
                
109
297
                pDock->iMinDockWidth = pDock->iMaxDockWidth - 2*X_BORDER_SPACE;
110
298
                pDock->iMinDockHeight = pDock->iMaxDockHeight;
111
299
        }
122
310
        // On affecte ca aussi au cas ou.
123
311
        pDock->fFlatDockWidth = pDock->iMaxDockWidth;
124
312
        pDock->fMagnitudeMax = my_diapo_simple_fScaleMax / (1+g_fAmplitude);
125
 
}
126
 
 
127
 
 
128
 
void cd_rendering_render_diapo_simple (cairo_t *pCairoContext, CairoDock *pDock)
129
 
{
 
313
        
 
314
        CDSlideData *pData = pDock->pRendererData;
 
315
        if (pData == NULL)
 
316
        {
 
317
                pData = g_new0 (CDSlideData, 1);
 
318
                pDock->pRendererData = pData;
 
319
                cairo_dock_register_notification_on_container (CAIRO_CONTAINER (pDock), CAIRO_DOCK_SCROLL_ICON, (CairoDockNotificationFunc) _cd_slide_on_scroll, CAIRO_DOCK_RUN_AFTER, NULL);
 
320
                cairo_dock_register_notification_on_container (CAIRO_CONTAINER (pDock), CAIRO_DOCK_CLICK_ICON, (CairoDockNotificationFunc) _cd_slide_on_click, CAIRO_DOCK_RUN_FIRST, NULL);
 
321
                cairo_dock_register_notification_on_container (CAIRO_CONTAINER (pDock), CAIRO_DOCK_MOUSE_MOVED, (CairoDockNotificationFunc) _cd_slide_on_mouse_moved, CAIRO_DOCK_RUN_AFTER, NULL);
 
322
                pData->iSidPressEvent = g_signal_connect (G_OBJECT (pDock->container.pWidget),
 
323
                        "button-press-event",
 
324
                        G_CALLBACK (_cd_slide_on_press_button),
 
325
                        pDock);  // car les notification de clic en provenance du dock sont emises lors du relachement du bouton.
 
326
                pData->iSidReleaseEvent = g_signal_connect (G_OBJECT (pDock->container.pWidget),
 
327
                        "button-release-event",
 
328
                        G_CALLBACK (_cd_slide_on_press_button),
 
329
                        pDock);
 
330
        }
 
331
        pData->nRowsX = nRowsX;
 
332
        pData->nRowsY = nRowsY;
 
333
        pData->iDeltaHeight = iDeltaHeight;
 
334
        if (iDeltaHeight != 0)
 
335
        {
 
336
                int iScrollMargin = iMaxIconWidth * (my_diapo_simple_fScaleMax - 1) / 2
 
337
                        + fScrollbarIconGap
 
338
                        + fScrollbarWidth;  // donc a droite on a : derniere icone en taille max + demi-gapx + + gab + scrollbar + X_BORDER_SPACE
 
339
                pDock->iMaxDockWidth += iScrollMargin;
 
340
        }
 
341
}
 
342
 
 
343
 
 
344
 
 
345
//////////////////////////////////////////////////////////////////////////////////////// Methodes de dessin :
 
346
 
 
347
static void cairo_dock_draw_frame_horizontal_for_diapo_simple (cairo_t *pCairoContext, CairoDock *pDock)
 
348
{
 
349
        const gdouble arrow_dec = 2;
 
350
        gdouble fFrameWidth  = pDock->iMaxDockWidth - 2 * X_BORDER_SPACE - 0 * my_diapo_simple_radius;
 
351
        gdouble fFrameHeight = pDock->iMaxDockHeight - (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth);
 
352
        gdouble fDockOffsetX = X_BORDER_SPACE + 0*my_diapo_simple_radius;
 
353
        gdouble fDockOffsetY = (pDock->container.bDirectionUp ? .5*my_diapo_simple_lineWidth : my_diapo_simple_arrowHeight + ARROW_TIP);
 
354
        
 
355
        cairo_move_to (pCairoContext, fDockOffsetX, fDockOffsetY);
 
356
 
 
357
        //HautGauche -> HautDroit
 
358
        if(pDock->container.bDirectionUp)
 
359
        {
 
360
                cairo_rel_line_to (pCairoContext, fFrameWidth, 0);
 
361
        }
 
362
        else
 
363
        {
 
364
                //On fait la fleche
 
365
                cairo_rel_line_to (pCairoContext,  (fFrameWidth/2 - my_diapo_simple_arrowWidth/2 - my_diapo_simple_arrowShift * fFrameWidth), 0);                //     _
 
366
                cairo_rel_line_to (pCairoContext, + my_diapo_simple_arrowWidth/2 + my_diapo_simple_arrowShift * fFrameWidth - my_diapo_simple_arrowShift * fFrameWidth / arrow_dec,  -my_diapo_simple_arrowHeight);       //  \.
 
367
                cairo_rel_line_to (pCairoContext, + my_diapo_simple_arrowWidth/2 - my_diapo_simple_arrowShift * fFrameWidth + my_diapo_simple_arrowShift * fFrameWidth / arrow_dec, +my_diapo_simple_arrowHeight);        //    /
 
368
                cairo_rel_line_to (pCairoContext, (fFrameWidth/2 - my_diapo_simple_arrowWidth/2 + my_diapo_simple_arrowShift * fFrameWidth) , 0);               // _
 
369
        }
 
370
        //\_________________ Coin haut droit.
 
371
        cairo_rel_curve_to (pCairoContext,
 
372
                0, 0,
 
373
                my_diapo_simple_radius, 0,
 
374
                my_diapo_simple_radius, my_diapo_simple_radius );
 
375
        
 
376
        //HautDroit -> BasDroit
 
377
        cairo_rel_line_to (pCairoContext, 0, fFrameHeight + my_diapo_simple_lineWidth - my_diapo_simple_radius *  2 );
 
378
        //\_________________ Coin bas droit.
 
379
        cairo_rel_curve_to (pCairoContext,
 
380
                0, 0,
 
381
                0 , my_diapo_simple_radius,
 
382
                -my_diapo_simple_radius , my_diapo_simple_radius);
 
383
        
 
384
        //BasDroit -> BasGauche
 
385
        if(!pDock->container.bDirectionUp)
 
386
        {
 
387
                cairo_rel_line_to (pCairoContext, - fFrameWidth , 0);
 
388
        }
 
389
        else
 
390
        {
 
391
                //On fait la fleche
 
392
                cairo_rel_line_to (pCairoContext, - (fFrameWidth/2 - my_diapo_simple_arrowWidth/2 - my_diapo_simple_arrowShift * fFrameWidth), 0);                //     _
 
393
                cairo_rel_line_to (pCairoContext, - my_diapo_simple_arrowWidth/2 - my_diapo_simple_arrowShift * fFrameWidth + my_diapo_simple_arrowShift * fFrameWidth / arrow_dec, my_diapo_simple_arrowHeight);        //    /     
 
394
                cairo_rel_line_to (pCairoContext, - my_diapo_simple_arrowWidth/2 + my_diapo_simple_arrowShift * fFrameWidth - my_diapo_simple_arrowShift * fFrameWidth / arrow_dec, -my_diapo_simple_arrowHeight);       //  \. 
 
395
                cairo_rel_line_to (pCairoContext, - (fFrameWidth/2 - my_diapo_simple_arrowWidth/2 + my_diapo_simple_arrowShift * fFrameWidth) , 0);               // _      
 
396
        }
 
397
        //\_________________ Coin bas gauche.
 
398
        cairo_rel_curve_to (pCairoContext,
 
399
                0, 0,
 
400
                -my_diapo_simple_radius, 0,
 
401
                -my_diapo_simple_radius, -my_diapo_simple_radius);
 
402
        
 
403
        //BasGauche -> HautGauche
 
404
        cairo_rel_line_to (pCairoContext, 0, - fFrameHeight - my_diapo_simple_lineWidth + my_diapo_simple_radius * 2);
 
405
        //\_________________ Coin haut gauche.
 
406
        cairo_rel_curve_to (pCairoContext,
 
407
                0, 0,
 
408
                0 , -my_diapo_simple_radius ,
 
409
                my_diapo_simple_radius, -my_diapo_simple_radius);
 
410
 
 
411
}
 
412
static void cairo_dock_draw_frame_vertical_for_diapo_simple (cairo_t *pCairoContext, CairoDock *pDock)
 
413
{
 
414
        const gdouble arrow_dec = 2;
 
415
        gdouble fFrameWidth  = pDock->iMaxDockWidth - 2 * X_BORDER_SPACE - 2 * my_diapo_simple_radius;
 
416
        gdouble fFrameHeight = pDock->iMaxDockHeight - (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth);
 
417
        gdouble fDockOffsetX = X_BORDER_SPACE + my_diapo_simple_radius;
 
418
        gdouble fDockOffsetY = (pDock->container.bDirectionUp ? .5*my_diapo_simple_lineWidth : my_diapo_simple_arrowHeight + ARROW_TIP);
 
419
        
 
420
        cairo_move_to (pCairoContext, fDockOffsetY, fDockOffsetX);
 
421
 
 
422
        if(pDock->container.bDirectionUp)
 
423
        {
 
424
                cairo_rel_line_to (pCairoContext, 0, fFrameWidth);
 
425
        }
 
426
        else
 
427
        {
 
428
                cairo_rel_line_to (pCairoContext,0,(fFrameWidth/2 - my_diapo_simple_arrowWidth/2 - my_diapo_simple_arrowShift * fFrameWidth));                //     _
 
429
                cairo_rel_line_to (pCairoContext, -my_diapo_simple_arrowHeight, my_diapo_simple_arrowWidth/2 + my_diapo_simple_arrowShift * fFrameWidth - my_diapo_simple_arrowShift * fFrameWidth / arrow_dec);       //  \. 
 
430
                cairo_rel_line_to (pCairoContext, my_diapo_simple_arrowHeight, + my_diapo_simple_arrowWidth/2 - my_diapo_simple_arrowShift * fFrameWidth + my_diapo_simple_arrowShift * fFrameWidth / arrow_dec);        //    /     
 
431
                cairo_rel_line_to (pCairoContext,0,(fFrameWidth/2 - my_diapo_simple_arrowWidth/2 + my_diapo_simple_arrowShift * fFrameWidth));               // _     
 
432
        }
 
433
        //\_________________ Coin haut droit.
 
434
        cairo_rel_curve_to (pCairoContext,
 
435
                0, 0,
 
436
                0, my_diapo_simple_radius,
 
437
                my_diapo_simple_radius, my_diapo_simple_radius);
 
438
        cairo_rel_line_to (pCairoContext, fFrameHeight + my_diapo_simple_lineWidth - my_diapo_simple_radius * 2, 0);
 
439
        //\_________________ Coin bas droit.
 
440
        cairo_rel_curve_to (pCairoContext,
 
441
                        0, 0,
 
442
                        my_diapo_simple_radius, 0,
 
443
                        my_diapo_simple_radius, -my_diapo_simple_radius);
 
444
        if(!pDock->container.bDirectionUp)
 
445
        {
 
446
                cairo_rel_line_to (pCairoContext, 0, - fFrameWidth);
 
447
        }
 
448
        else
 
449
        {
 
450
                //On fait la fleche
 
451
                cairo_rel_line_to (pCairoContext, 0, - (fFrameWidth/2 - my_diapo_simple_arrowWidth/2 - my_diapo_simple_arrowShift * fFrameWidth));                 //     _
 
452
                cairo_rel_line_to (pCairoContext,  my_diapo_simple_arrowHeight, - my_diapo_simple_arrowWidth/2 - my_diapo_simple_arrowShift * fFrameWidth + my_diapo_simple_arrowShift * fFrameWidth / arrow_dec);        //    /     
 
453
                cairo_rel_line_to (pCairoContext, -my_diapo_simple_arrowHeight, - my_diapo_simple_arrowWidth/2 + my_diapo_simple_arrowShift * fFrameWidth - my_diapo_simple_arrowShift * fFrameWidth / arrow_dec );       //  \. 
 
454
                cairo_rel_line_to (pCairoContext, 0, - (fFrameWidth/2 - my_diapo_simple_arrowWidth/2 + my_diapo_simple_arrowShift * fFrameWidth));                 // _      
 
455
        }
 
456
        
 
457
        //\_________________ Coin bas gauche.
 
458
        cairo_rel_curve_to (pCairoContext,
 
459
                0, 0,
 
460
                0, -my_diapo_simple_radius,
 
461
                -my_diapo_simple_radius, -my_diapo_simple_radius);
 
462
        cairo_rel_line_to (pCairoContext, - fFrameHeight - my_diapo_simple_lineWidth + my_diapo_simple_radius * 2, 0);
 
463
        //\_________________ Coin haut gauche.
 
464
        cairo_rel_curve_to (pCairoContext,
 
465
                0, 0,
 
466
                -my_diapo_simple_radius, 0,
 
467
                -my_diapo_simple_radius, my_diapo_simple_radius);
 
468
}
 
469
static void cairo_dock_draw_frame_for_diapo_simple (cairo_t *pCairoContext, CairoDock *pDock)
 
470
{
 
471
        if (pDock->container.bIsHorizontal)
 
472
                cairo_dock_draw_frame_horizontal_for_diapo_simple (pCairoContext, pDock);
 
473
        else
 
474
                cairo_dock_draw_frame_vertical_for_diapo_simple (pCairoContext, pDock);
 
475
}
 
476
 
 
477
static void cairo_dock_render_decorations_in_frame_for_diapo_simple (cairo_t *pCairoContext, CairoDock *pDock, double fAlpha)
 
478
{
 
479
        // On se fait un beau pattern degrade :
 
480
        cairo_pattern_t *mon_super_pattern;
 
481
        mon_super_pattern = cairo_pattern_create_linear (0.0,
 
482
                0.0,
 
483
                my_diapo_simple_fade2right  ? pDock->iMaxDockWidth  : 0.0, // Y'aurait surement des calculs complexes à faire mais 
 
484
                my_diapo_simple_fade2bottom ? pDock->iMaxDockHeight : 0.0);     //  a quelques pixels près pour un dégradé : OSEF !
 
485
                        
 
486
        cairo_pattern_add_color_stop_rgba (mon_super_pattern, 0, 
 
487
                my_diapo_simple_color_frame_start[0],
 
488
                my_diapo_simple_color_frame_start[1],
 
489
                my_diapo_simple_color_frame_start[2],
 
490
                my_diapo_simple_color_frame_start[3] * fAlpha);  // transparent -> opaque au depliage.
 
491
                
 
492
        cairo_pattern_add_color_stop_rgba (mon_super_pattern, 1, 
 
493
                my_diapo_simple_color_frame_stop[0],
 
494
                my_diapo_simple_color_frame_stop[1],
 
495
                my_diapo_simple_color_frame_stop[2],
 
496
                my_diapo_simple_color_frame_stop[3] * fAlpha);
 
497
        cairo_set_source (pCairoContext, mon_super_pattern);
 
498
        
 
499
        //On remplit le contexte en le préservant -> pourquoi ?  ----> parce qu'on va tracer le contour plus tard ;-)
 
500
        cairo_fill_preserve (pCairoContext);
 
501
        cairo_pattern_destroy (mon_super_pattern);
 
502
}
 
503
 
 
504
static void cd_rendering_render_diapo_simple (cairo_t *pCairoContext, CairoDock *pDock)
 
505
{
 
506
        double fAlpha = (pDock->fFoldingFactor < .3 ? (.3 - pDock->fFoldingFactor) / .3 : 0.);  // apparition du cadre de 0.3 a 0
130
507
        if (my_diapo_simple_draw_background)
131
508
        {
132
509
                //\____________________ On trace le cadre.
134
511
                cairo_dock_draw_frame_for_diapo_simple (pCairoContext, pDock);
135
512
                
136
513
                //\____________________ On dessine les decorations dedans.
137
 
                double fAlpha = (pDock->fFoldingFactor < .3 ? (.3 - pDock->fFoldingFactor) / .3 : 0.);  // apparition du cadre de 0.3 a 0
138
514
                cairo_dock_render_decorations_in_frame_for_diapo_simple (pCairoContext, pDock, fAlpha);
139
515
 
140
516
                //\____________________ On dessine le cadre.
161
537
        if (myIcons.iStringLineWidth > 0)
162
538
                cairo_dock_draw_string (pCairoContext, pDock, myIcons.iStringLineWidth, TRUE, TRUE);
163
539
        
 
540
        //\____________________ On dessine les barres de defilement.
 
541
        CDSlideData *pData = pDock->pRendererData;
 
542
        if (pData != NULL && pData->iDeltaHeight != 0)
 
543
        {
 
544
                cairo_save (pCairoContext);
 
545
                cairo_set_line_width (pCairoContext, 2.);
 
546
                
 
547
                double x_arrow = pDock->iMaxDockWidth - X_BORDER_SPACE - fScrollbarWidth/2;  // pointe de la fleche.
 
548
                double y_arrow_top, y_arrow_bottom;
 
549
                if (pDock->container.bDirectionUp)
 
550
                {
 
551
                        y_arrow_bottom = pDock->iMaxDockHeight - (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth);
 
552
                        y_arrow_top = my_diapo_simple_lineWidth;
 
553
                }
 
554
                else
 
555
                {
 
556
                        y_arrow_top = my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth;
 
557
                        y_arrow_bottom = pDock->iMaxDockHeight - my_diapo_simple_lineWidth;
 
558
                }
 
559
                if (pData->iScrollOffset != 0)  // fleche vers le haut.
 
560
                {
 
561
                        cairo_move_to (pCairoContext, x_arrow, y_arrow_top);
 
562
                        cairo_rel_line_to (pCairoContext, fScrollbarWidth/2, fArrowHeight);
 
563
                        cairo_rel_line_to (pCairoContext, -fScrollbarWidth, 0.);
 
564
                        cairo_close_path (pCairoContext);
 
565
                        
 
566
                        cairo_set_source_rgba (pCairoContext, my_diapo_simple_color_scrollbar_inside[0], my_diapo_simple_color_scrollbar_inside[1], my_diapo_simple_color_scrollbar_inside[2], my_diapo_simple_color_scrollbar_inside[3] * fAlpha);
 
567
                        cairo_fill_preserve (pCairoContext);
 
568
                        
 
569
                        cairo_set_source_rgba (pCairoContext, my_diapo_simple_color_scrollbar_line[0], my_diapo_simple_color_scrollbar_line[1], my_diapo_simple_color_scrollbar_line[2], my_diapo_simple_color_scrollbar_line[3] * fAlpha);
 
570
                        cairo_stroke (pCairoContext);
 
571
                }
 
572
                if (pData->iScrollOffset != pData->iDeltaHeight)  // fleche vers le bas.
 
573
                {
 
574
                        cairo_move_to (pCairoContext, x_arrow, y_arrow_bottom);
 
575
                        cairo_rel_line_to (pCairoContext, fScrollbarWidth/2, - fArrowHeight);
 
576
                        cairo_rel_line_to (pCairoContext, -fScrollbarWidth, 0.);
 
577
                        cairo_close_path (pCairoContext);
 
578
                        
 
579
                        cairo_set_source_rgba (pCairoContext, my_diapo_simple_color_scrollbar_inside[0], my_diapo_simple_color_scrollbar_inside[1], my_diapo_simple_color_scrollbar_inside[2], my_diapo_simple_color_scrollbar_inside[3] * fAlpha);
 
580
                        cairo_fill_preserve (pCairoContext);
 
581
                        
 
582
                        cairo_set_source_rgba (pCairoContext, my_diapo_simple_color_scrollbar_line[0], my_diapo_simple_color_scrollbar_line[1], my_diapo_simple_color_scrollbar_line[2], my_diapo_simple_color_scrollbar_line[3] * fAlpha);
 
583
                        cairo_stroke (pCairoContext);
 
584
                }
 
585
                // scrollbar outline
 
586
                cairo_move_to (pCairoContext, x_arrow - fScrollbarWidth/2, y_arrow_top + fArrowHeight + fScrollbarArrowGap);
 
587
                cairo_rel_line_to (pCairoContext, fScrollbarWidth, 0.);
 
588
                cairo_rel_line_to (pCairoContext, 0., y_arrow_bottom - y_arrow_top - 2*(fArrowHeight+fScrollbarArrowGap));
 
589
                cairo_rel_line_to (pCairoContext, -fScrollbarWidth, 0.);
 
590
                cairo_close_path (pCairoContext);
 
591
                
 
592
                cairo_set_source_rgba (pCairoContext, my_diapo_simple_color_scrollbar_inside[0], my_diapo_simple_color_scrollbar_inside[1], my_diapo_simple_color_scrollbar_inside[2], my_diapo_simple_color_scrollbar_inside[3] * fAlpha);
 
593
                cairo_fill_preserve (pCairoContext);
 
594
                
 
595
                cairo_set_source_rgba (pCairoContext, my_diapo_simple_color_scrollbar_line[0], my_diapo_simple_color_scrollbar_line[1], my_diapo_simple_color_scrollbar_line[2], my_diapo_simple_color_scrollbar_line[3] * fAlpha);
 
596
                cairo_stroke (pCairoContext);
 
597
                // grip
 
598
                double fFrameHeight = pDock->iMaxDockHeight - (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth);  // hauteur du cadre avec les rayons et sans la pointe.
 
599
                double fGripHeight = fFrameHeight / (fFrameHeight + pData->iDeltaHeight) * (y_arrow_bottom - y_arrow_top - 2*(fArrowHeight+fScrollbarArrowGap));
 
600
                double ygrip = (double) pData->iScrollOffset / pData->iDeltaHeight * (y_arrow_bottom - y_arrow_top - 2*(fArrowHeight+fScrollbarArrowGap) - fGripHeight);
 
601
                cairo_set_source_rgba (pCairoContext, my_diapo_simple_color_grip[0], my_diapo_simple_color_grip[1], my_diapo_simple_color_grip[2], my_diapo_simple_color_grip[3] * fAlpha);
 
602
                cairo_move_to (pCairoContext, x_arrow - fScrollbarWidth/2 + 1, y_arrow_top + fArrowHeight + fScrollbarArrowGap + ygrip);
 
603
                cairo_rel_line_to (pCairoContext, fScrollbarWidth - 2, 0.);
 
604
                cairo_rel_line_to (pCairoContext, 0., fGripHeight);
 
605
                cairo_rel_line_to (pCairoContext, - (fScrollbarWidth - 2), 0.);
 
606
                cairo_fill (pCairoContext);
 
607
                
 
608
                cairo_restore (pCairoContext);
 
609
        }
 
610
        
164
611
        //\____________________ On dessine les icones avec leurs etiquettes.
165
612
        // on determine la 1ere icone a tracer : l'icone suivant l'icone pointee.
166
613
        GList *pFirstDrawnElement = cairo_dock_get_first_drawn_element_linear (pDock->icons);
167
614
        if (pFirstDrawnElement == NULL)
168
615
                return;
169
616
        
 
617
        //clip pour le scroll
 
618
        if (pData != NULL && pData->iDeltaHeight != 0) // on fait un clip pour les icones qui debordent.
 
619
        {
 
620
                int h = my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth;
 
621
                if (pDock->container.bIsHorizontal)
 
622
                {
 
623
                        cairo_rectangle (pCairoContext,
 
624
                                0.,
 
625
                                (pDock->container.bDirectionUp ? my_diapo_simple_lineWidth : h),  // top left corner.
 
626
                                pDock->container.iWidth,
 
627
                                pDock->container.iHeight - h);
 
628
                        cairo_clip (pCairoContext);
 
629
                }  // sinon clip inutile.
 
630
        }
 
631
        
170
632
        // on dessine les icones, l'icone pointee en dernier.
171
633
        Icon *icon;
172
634
        GList *ic = pFirstDrawnElement;
173
635
        do
174
636
        {
175
637
                icon = ic->data;
 
638
                if (CAIRO_DOCK_ICON_TYPE_IS_SEPARATOR (icon))
 
639
                        continue;
176
640
                
177
641
                if (icon->bPointed)
178
642
                {
180
644
                }
181
645
                
182
646
                cairo_save (pCairoContext);
 
647
                /// faire un clip si scroll != 0 ...
183
648
                cairo_dock_render_one_icon (icon, pDock, pCairoContext, 1., FALSE);
184
649
                cairo_restore (pCairoContext);
185
650
                
186
651
//////////////////////////////////////////////////////////////////////////////////////// On affiche le texte !
187
652
                gdouble zoom;
188
 
                if(icon->pTextBuffer != NULL && (my_diapo_simple_display_all_icons || icon->bPointed))
 
653
                if(icon->pTextBuffer != NULL && (my_diapo_simple_display_all_labels || icon->bPointed))
189
654
                {
190
655
                        double fAlpha = (pDock->fFoldingFactor > .5 ? (1 - pDock->fFoldingFactor) / .5 : 1.);
191
656
                        cairo_save (pCairoContext);
281
746
 
282
747
 
283
748
 
284
 
static Icon* _cd_rendering_calculate_icons_for_diapo_simple (CairoDock *pDock, guint nRowsX, guint nRowsY, gint Mx, gint My)
 
749
static Icon* _cd_rendering_calculate_icons_for_diapo_simple (CairoDock *pDock, gint nRowsX, gint nRowsY, gint Mx, gint My)
285
750
{
 
751
        double fScrollOffset = 0.;
 
752
        CDSlideData *pData = pDock->pRendererData;
 
753
        if (pData != NULL)
 
754
                fScrollOffset = (pDock->container.bDirectionUp ? - pData->iScrollOffset : pData->iScrollOffset);
 
755
        
286
756
        // On calcule la position de base pour toutes les icones
287
 
        int iOffsetY = .5 * pDock->iMaxIconHeight * (my_diapo_simple_fScaleMax - 1) +  // les icones de la 1ere ligne zooment
 
757
        int iOffsetY = .5 * pDock->iMaxIconHeight * pDock->container.fRatio * (my_diapo_simple_fScaleMax - 1) +  // les icones de la 1ere ligne zooment
288
758
                myLabels.iLabelSize +  // le texte des icones de la 1ere ligne
289
 
                .5 * my_diapo_simple_lineWidth;  // demi-ligne du haut;
 
759
                .5 * my_diapo_simple_lineWidth +  // demi-ligne du haut;
 
760
                fScrollOffset;
290
761
        
291
762
        double fFoldingX = (pDock->fFoldingFactor > .2 ? (pDock->fFoldingFactor - .2) / .8 : 0.);  // placement de 1 a 0.2
292
763
        double fFoldingY = (pDock->fFoldingFactor > .5 ? (pDock->fFoldingFactor - .5) / .5 : 0.);  // placement de 1 a 0.5
305
776
                if (pDock->container.bDirectionUp)
306
777
                        icon->fY = iOffsetY + (icon->fHeight + my_diapo_simple_iconGapY) * y;
307
778
                else
308
 
                        icon->fY = pDock->container.iHeight - iOffsetY - icon->fHeight - (nRowsY - 1 - y) * (icon->fHeight + my_diapo_simple_iconGapY);  // la ligne du haut quand le dock est en bas, reste en haut quand le dock est en haut.
 
779
                        icon->fY = pDock->container.iHeight - iOffsetY - icon->fHeight - (nRowsY - 1 - y) * (icon->fHeight + my_diapo_simple_iconGapY) + (my_diapo_simple_arrowHeight + ARROW_TIP);  // la ligne du haut quand le dock est en bas, reste en haut quand le dock est en haut.
309
780
                
310
781
                // on en deduit le zoom par rapport a la position de la souris.
311
782
                gdouble distanceE = sqrt ((icon->fX + icon->fWidth/2 - Mx) * (icon->fX + icon->fWidth/2 - Mx) + (icon->fY + icon->fHeight/2 - My) * (icon->fY + icon->fHeight/2 - My));
335
806
                icon->fDrawY = icon->fDrawY + (pDock->container.bDirectionUp ?
336
807
                        pDock->container.iHeight - (my_diapo_simple_arrowHeight + ARROW_TIP + icon->fDrawY) :
337
808
                        - icon->fDrawY) * fFoldingY;
338
 
                
339
809
                icon->fAlpha = (pDock->fFoldingFactor > .7 ? (1 - pDock->fFoldingFactor) / (1 - .7) : 1.);  // apparition de 1 a 0.7
340
810
                
341
811
                // On regarde si l'icone est pointee, si oui elle est un peu plus visible que les autres.
378
848
}
379
849
Icon *cd_rendering_calculate_icons_diapo_simple (CairoDock *pDock)
380
850
{
 
851
        if (pDock->icons == NULL)
 
852
                return NULL;
 
853
        
381
854
        // On calcule la configuration de la grille
382
 
        guint nRowsX = 0;
383
 
        guint nRowsY = 0;
384
 
        guint nIcones = 0;
385
 
        nIcones = _cd_rendering_diapo_simple_guess_grid (pDock->icons, &nRowsX, &nRowsY);
 
855
        gint nRowsX = 0;
 
856
        gint nRowsY = 0;
 
857
        gint nIcones = 0;
 
858
        ///nIcones = _cd_rendering_diapo_simple_guess_grid (pDock->icons, &nRowsX, &nRowsY);
 
859
        
 
860
        CDSlideData *pData = pDock->pRendererData;
 
861
        g_return_val_if_fail (pData != NULL, NULL);
 
862
        nRowsX = pData->nRowsX;
 
863
        nRowsY = pData->nRowsY;
 
864
        /*int iMaxIconWidth = ((Icon*)pDock->icons->data)->fWidth;  // approximation un peu bof.
 
865
        nRowsX = (pDock->iMaxDockWidth - 2*X_BORDER_SPACE) / (iMaxIconWidth + my_diapo_simple_iconGapX);
 
866
        nRowsY = (pDock->iMaxDockHeight - (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth + myLabels.iLabelSize + pDock->iMaxIconHeight * pDock->container.fRatio * my_diapo_simple_fScaleMax)) / (pDock->iMaxIconHeight * pDock->container.fRatio + my_diapo_simple_iconGapY);*/
386
867
        
387
868
        // On calcule les parametres des icones
388
869
        Icon *pPointedIcon = _cd_rendering_calculate_icons_for_diapo_simple (pDock, nRowsX, nRowsY, pDock->container.iMouseX, pDock->container.iMouseY);
395
876
}
396
877
 
397
878
 
398
 
void cd_rendering_register_diapo_simple_renderer (const gchar *cRendererName)
399
 
{
400
 
//////////////////////////////////////////////////////////////////////////////////////// On definit le renderer :
401
 
        CairoDockRenderer *pRenderer = g_new0 (CairoDockRenderer, 1);                                           //Nouvelle structure    
402
 
        pRenderer->cReadmeFilePath = g_strdup_printf ("%s/readme-diapo-simple-view", MY_APPLET_SHARE_DATA_DIR);        //On affecte le readme
403
 
        pRenderer->cPreviewFilePath = g_strdup_printf ("%s/preview-diapo-simple.jpg", MY_APPLET_SHARE_DATA_DIR);       // la preview
404
 
        pRenderer->compute_size = cd_rendering_calculate_max_dock_size_diapo_simple;                        //La fonction qui défini les bornes     
405
 
        pRenderer->calculate_icons = cd_rendering_calculate_icons_diapo_simple;                                        //qui calcule les param des icones      
406
 
        pRenderer->render = cd_rendering_render_diapo_simple;                                                          //qui initie le calcul du rendu         
407
 
        pRenderer->render_optimized = NULL;//cd_rendering_render_diapo_simple_optimized;                                      //pareil en mieux                       
408
 
        pRenderer->set_subdock_position = cairo_dock_set_subdock_position_linear;                               // ?                                    
409
 
        pRenderer->render_opengl = cd_rendering_render_diapo_simple_opengl;
410
 
        
411
 
        pRenderer->bUseReflect = FALSE;                                                                         // On dit non au reflections
412
 
        pRenderer->cDisplayedName = D_ (cRendererName);
413
 
        
414
 
        cairo_dock_register_renderer (cRendererName, pRenderer);                                    //Puis on signale l'existence de notre rendu
415
 
}
416
 
 
417
 
 
418
 
//////////////////////////////////////////////////////////////////////////////////////// Methodes de dessin :
419
 
 
420
 
static void cairo_dock_draw_frame_horizontal_for_diapo_simple (cairo_t *pCairoContext, CairoDock *pDock)
421
 
{
422
 
        const gdouble arrow_dec = 2;
423
 
        gdouble fFrameWidth  = pDock->iMaxDockWidth - 2 * X_BORDER_SPACE;
424
 
        gdouble fFrameHeight = pDock->iMaxDockHeight - (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth);
425
 
        gdouble fDockOffsetX = X_BORDER_SPACE;
426
 
        gdouble fDockOffsetY = (pDock->container.bDirectionUp ? .5*my_diapo_simple_lineWidth : my_diapo_simple_arrowHeight + ARROW_TIP);
427
 
        
428
 
        cairo_move_to (pCairoContext, fDockOffsetX, fDockOffsetY);
429
 
 
430
 
        //HautGauche -> HautDroit
431
 
        if(pDock->container.bDirectionUp)
432
 
        {
433
 
                cairo_rel_line_to (pCairoContext, fFrameWidth, 0);
434
 
        }
435
 
        else
436
 
        {
437
 
                //On fait la fleche
438
 
                cairo_rel_line_to (pCairoContext,  (fFrameWidth/2 - my_diapo_simple_arrowWidth/2 - my_diapo_simple_arrowShift * fFrameWidth), 0);                //     _
439
 
                cairo_rel_line_to (pCairoContext, + my_diapo_simple_arrowWidth/2 + my_diapo_simple_arrowShift * fFrameWidth - my_diapo_simple_arrowShift * fFrameWidth / arrow_dec,  -my_diapo_simple_arrowHeight);       //  \.
440
 
                cairo_rel_line_to (pCairoContext, + my_diapo_simple_arrowWidth/2 - my_diapo_simple_arrowShift * fFrameWidth + my_diapo_simple_arrowShift * fFrameWidth / arrow_dec, +my_diapo_simple_arrowHeight);        //    /
441
 
                cairo_rel_line_to (pCairoContext, (fFrameWidth/2 - my_diapo_simple_arrowWidth/2 + my_diapo_simple_arrowShift * fFrameWidth) , 0);               // _
442
 
        }
443
 
        //\_________________ Coin haut droit.
444
 
        cairo_rel_curve_to (pCairoContext,
445
 
                0, 0,
446
 
                my_diapo_simple_radius, 0,
447
 
                my_diapo_simple_radius, my_diapo_simple_radius );
448
 
        
449
 
        //HautDroit -> BasDroit
450
 
        cairo_rel_line_to (pCairoContext, 0, fFrameHeight + my_diapo_simple_lineWidth - my_diapo_simple_radius *  2 );
451
 
        //\_________________ Coin bas droit.
452
 
        cairo_rel_curve_to (pCairoContext,
453
 
                0, 0,
454
 
                0 , my_diapo_simple_radius,
455
 
                -my_diapo_simple_radius , my_diapo_simple_radius);
456
 
        
457
 
        //BasDroit -> BasGauche
458
 
        if(!pDock->container.bDirectionUp)
459
 
        {
460
 
                cairo_rel_line_to (pCairoContext, - fFrameWidth , 0);
461
 
        }
462
 
        else
463
 
        {
464
 
                //On fait la fleche
465
 
                cairo_rel_line_to (pCairoContext, - (fFrameWidth/2 - my_diapo_simple_arrowWidth/2 - my_diapo_simple_arrowShift * fFrameWidth), 0);                //     _
466
 
                cairo_rel_line_to (pCairoContext, - my_diapo_simple_arrowWidth/2 - my_diapo_simple_arrowShift * fFrameWidth + my_diapo_simple_arrowShift * fFrameWidth / arrow_dec, my_diapo_simple_arrowHeight);        //    /     
467
 
                cairo_rel_line_to (pCairoContext, - my_diapo_simple_arrowWidth/2 + my_diapo_simple_arrowShift * fFrameWidth - my_diapo_simple_arrowShift * fFrameWidth / arrow_dec, -my_diapo_simple_arrowHeight);       //  \. 
468
 
                cairo_rel_line_to (pCairoContext, - (fFrameWidth/2 - my_diapo_simple_arrowWidth/2 + my_diapo_simple_arrowShift * fFrameWidth) , 0);               // _      
469
 
        }
470
 
        //\_________________ Coin bas gauche.
471
 
        cairo_rel_curve_to (pCairoContext,
472
 
                0, 0,
473
 
                -my_diapo_simple_radius, 0,
474
 
                -my_diapo_simple_radius, -my_diapo_simple_radius);
475
 
        
476
 
        //BasGauche -> HautGauche
477
 
        cairo_rel_line_to (pCairoContext, 0, - fFrameHeight - my_diapo_simple_lineWidth + my_diapo_simple_radius * 2);
478
 
        //\_________________ Coin haut gauche.
479
 
        cairo_rel_curve_to (pCairoContext,
480
 
                0, 0,
481
 
                0 , -my_diapo_simple_radius ,
482
 
                my_diapo_simple_radius, -my_diapo_simple_radius);
483
 
 
484
 
}
485
 
static void cairo_dock_draw_frame_vertical_for_diapo_simple (cairo_t *pCairoContext, CairoDock *pDock)
486
 
{
487
 
        const gdouble arrow_dec = 2;
488
 
        gdouble fFrameWidth  = pDock->iMaxDockWidth - 2 * X_BORDER_SPACE;
489
 
        gdouble fFrameHeight = pDock->iMaxDockHeight - (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth);
490
 
        gdouble fDockOffsetX = X_BORDER_SPACE;
491
 
        gdouble fDockOffsetY = (pDock->container.bDirectionUp ? .5*my_diapo_simple_lineWidth : my_diapo_simple_arrowHeight + ARROW_TIP);
492
 
        
493
 
        cairo_move_to (pCairoContext, fDockOffsetY, fDockOffsetX);
494
 
 
495
 
        if(pDock->container.bDirectionUp)
496
 
        {
497
 
                cairo_rel_line_to (pCairoContext, 0, fFrameWidth);
498
 
        }
499
 
        else
500
 
        {
501
 
                cairo_rel_line_to (pCairoContext,0,(fFrameWidth/2 - my_diapo_simple_arrowWidth/2 - my_diapo_simple_arrowShift * fFrameWidth));                //     _
502
 
                cairo_rel_line_to (pCairoContext, -my_diapo_simple_arrowHeight, my_diapo_simple_arrowWidth/2 + my_diapo_simple_arrowShift * fFrameWidth - my_diapo_simple_arrowShift * fFrameWidth / arrow_dec);       //  \. 
503
 
                cairo_rel_line_to (pCairoContext, my_diapo_simple_arrowHeight, + my_diapo_simple_arrowWidth/2 - my_diapo_simple_arrowShift * fFrameWidth + my_diapo_simple_arrowShift * fFrameWidth / arrow_dec);        //    /     
504
 
                cairo_rel_line_to (pCairoContext,0,(fFrameWidth/2 - my_diapo_simple_arrowWidth/2 + my_diapo_simple_arrowShift * fFrameWidth));               // _     
505
 
        }
506
 
        //\_________________ Coin haut droit.
507
 
        cairo_rel_curve_to (pCairoContext,
508
 
                0, 0,
509
 
                0, my_diapo_simple_radius,
510
 
                my_diapo_simple_radius, my_diapo_simple_radius);
511
 
        cairo_rel_line_to (pCairoContext, fFrameHeight + my_diapo_simple_lineWidth - my_diapo_simple_radius * 2, 0);
512
 
        //\_________________ Coin bas droit.
513
 
        cairo_rel_curve_to (pCairoContext,
514
 
                        0, 0,
515
 
                        my_diapo_simple_radius, 0,
516
 
                        my_diapo_simple_radius, -my_diapo_simple_radius);
517
 
        if(!pDock->container.bDirectionUp)
518
 
        {
519
 
                cairo_rel_line_to (pCairoContext, 0, - fFrameWidth);
520
 
        }
521
 
        else
522
 
        {
523
 
                //On fait la fleche
524
 
                cairo_rel_line_to (pCairoContext, 0, - (fFrameWidth/2 - my_diapo_simple_arrowWidth/2 - my_diapo_simple_arrowShift * fFrameWidth));                 //     _
525
 
                cairo_rel_line_to (pCairoContext,  my_diapo_simple_arrowHeight, - my_diapo_simple_arrowWidth/2 - my_diapo_simple_arrowShift * fFrameWidth + my_diapo_simple_arrowShift * fFrameWidth / arrow_dec);        //    /     
526
 
                cairo_rel_line_to (pCairoContext, -my_diapo_simple_arrowHeight, - my_diapo_simple_arrowWidth/2 + my_diapo_simple_arrowShift * fFrameWidth - my_diapo_simple_arrowShift * fFrameWidth / arrow_dec );       //  \. 
527
 
                cairo_rel_line_to (pCairoContext, 0, - (fFrameWidth/2 - my_diapo_simple_arrowWidth/2 + my_diapo_simple_arrowShift * fFrameWidth));                 // _      
528
 
        }
529
 
        
530
 
        //\_________________ Coin bas gauche.
531
 
        cairo_rel_curve_to (pCairoContext,
532
 
                0, 0,
533
 
                0, -my_diapo_simple_radius,
534
 
                -my_diapo_simple_radius, -my_diapo_simple_radius);
535
 
        cairo_rel_line_to (pCairoContext, - fFrameHeight - my_diapo_simple_lineWidth + my_diapo_simple_radius * 2, 0);
536
 
        //\_________________ Coin haut gauche.
537
 
        cairo_rel_curve_to (pCairoContext,
538
 
                0, 0,
539
 
                -my_diapo_simple_radius, 0,
540
 
                -my_diapo_simple_radius, my_diapo_simple_radius);
541
 
}
542
 
void cairo_dock_draw_frame_for_diapo_simple (cairo_t *pCairoContext, CairoDock *pDock)
543
 
{
544
 
        if (pDock->container.bIsHorizontal)
545
 
                cairo_dock_draw_frame_horizontal_for_diapo_simple (pCairoContext, pDock);
546
 
        else
547
 
                cairo_dock_draw_frame_vertical_for_diapo_simple (pCairoContext, pDock);
548
 
}
549
 
 
550
 
 
551
 
 
552
 
void cairo_dock_render_decorations_in_frame_for_diapo_simple (cairo_t *pCairoContext, CairoDock *pDock, double fAlpha)
553
 
{
554
 
        // On se fait un beau pattern degrade :
555
 
        cairo_pattern_t *mon_super_pattern;
556
 
        mon_super_pattern = cairo_pattern_create_linear (0.0,
557
 
                0.0,
558
 
                my_diapo_simple_fade2right  ? pDock->iMaxDockWidth  : 0.0, // Y'aurait surement des calculs complexes à faire mais 
559
 
                my_diapo_simple_fade2bottom ? pDock->iMaxDockHeight : 0.0);     //  a quelques pixels près pour un dégradé : OSEF !
560
 
                        
561
 
        cairo_pattern_add_color_stop_rgba (mon_super_pattern, 0, 
562
 
                my_diapo_simple_color_frame_start[0],
563
 
                my_diapo_simple_color_frame_start[1],
564
 
                my_diapo_simple_color_frame_start[2],
565
 
                my_diapo_simple_color_frame_start[3] * fAlpha);  // transparent -> opaque au depliage.
566
 
                
567
 
        cairo_pattern_add_color_stop_rgba (mon_super_pattern, 1, 
568
 
                my_diapo_simple_color_frame_stop[0],
569
 
                my_diapo_simple_color_frame_stop[1],
570
 
                my_diapo_simple_color_frame_stop[2],
571
 
                my_diapo_simple_color_frame_stop[3] * fAlpha);
572
 
        cairo_set_source (pCairoContext, mon_super_pattern);
573
 
        
574
 
        //On remplit le contexte en le préservant -> pourquoi ?  ----> parce qu'on va tracer le contour plus tard ;-)
575
 
        cairo_fill_preserve (pCairoContext);
576
 
        cairo_pattern_destroy (mon_super_pattern);
577
 
}
578
 
 
579
 
 
580
 
void cd_rendering_render_diapo_simple_opengl (CairoDock *pDock)
581
 
{
 
879
 
 
880
static const double a = 2.5;  // definit combien la fleche est penchee.
 
881
 
 
882
#define RADIAN (G_PI / 180.0)  // Conversion Radian/Degres
 
883
#define DELTA_ROUND_DEGREE 5
 
884
#define TIP_OFFSET_FACTOR 2.
 
885
#define _recopy_prev_color(pColorTab, i) memcpy (&pColorTab[4*i], &pColorTab[4*(i-1)], 4*sizeof (GLfloat));
 
886
#define _copy_color(pColorTab, i, fAlpha, c) do { \
 
887
        pColorTab[4*i]   = c[0];\
 
888
        pColorTab[4*i+1] = c[1];\
 
889
        pColorTab[4*i+2] = c[2];\
 
890
        pColorTab[4*i+3] = c[3] * fAlpha; } while (0)
 
891
/*#define _copy_mean_color(pColorTab, i, fAlpha, c1, c2, f) do { \
 
892
        pColorTab[4*i]   = c1[0]*f + c2[0]*(1-f);\
 
893
        pColorTab[4*i+1] = c1[1]*f + c2[1]*(1-f);\
 
894
        pColorTab[4*i+2] = c1[2]*f + c2[2]*(1-f);\
 
895
        pColorTab[4*i+3] = (c1[3]*f + c2[3]*(1-f)) * fAlpha; } while (0)*/
 
896
static void cd_add_arrow_to_path (CairoDockGLPath *pPath, double fFrameWidth)
 
897
{
 
898
        double w = fFrameWidth / 2;
 
899
        double aw = my_diapo_simple_arrowWidth/2;
 
900
        double ah = my_diapo_simple_arrowHeight;
 
901
        double xa = my_diapo_simple_arrowShift * (w - aw);  // abscisse de l'extremite de la pointe.
 
902
        
 
903
        cairo_dock_gl_path_rel_line_to (pPath, w + xa - aw, 0.);  // pointe.
 
904
        cairo_dock_gl_path_rel_line_to (pPath, aw, -ah);
 
905
        cairo_dock_gl_path_rel_line_to (pPath, aw, ah);
 
906
}
 
907
static CairoDockGLPath *cd_generate_frame_path_without_arrow (double fFrameWidth, double fTotalHeight, double fRadius)
 
908
{
 
909
        static CairoDockGLPath *pPath = NULL;
 
910
        double fTotalWidth = fFrameWidth + 2 * fRadius;
 
911
        double fFrameHeight = MAX (0, fTotalHeight - 2 * fRadius);
 
912
        double w = fFrameWidth / 2;
 
913
        double h = fFrameHeight / 2;
 
914
        double r = fRadius;
 
915
        
 
916
        int iNbPoins1Round = 90/DELTA_ROUND_DEGREE;
 
917
        if (pPath == NULL)
 
918
                pPath = cairo_dock_new_gl_path ((iNbPoins1Round+1)*4+1+3, w, -h-r, fTotalWidth, fTotalHeight);  // on commence au coin haut droit pour avoir une bonne triangulation du polygone, et en raisonnant par rapport au centre du rectangle.
 
919
        else
 
920
                cairo_dock_gl_path_move_to (pPath, w, -h-r);
 
921
        
 
922
        cairo_dock_gl_path_arc (pPath, iNbPoins1Round,  w, -h, r, -G_PI/2, +G_PI/2);  // coin bas droit.
 
923
        
 
924
        cairo_dock_gl_path_arc (pPath, iNbPoins1Round, w, h, r, 0.,     +G_PI/2);  // coin haut droit.
 
925
        
 
926
        cairo_dock_gl_path_arc (pPath, iNbPoins1Round, -w,  h, r, G_PI/2,  +G_PI/2);  // coin haut gauche.
 
927
        
 
928
        cairo_dock_gl_path_arc (pPath, iNbPoins1Round, -w, -h, r, G_PI,    +G_PI/2);  // coin bas gauche.
 
929
        
 
930
        return pPath;
 
931
}
 
932
 
 
933
static CairoDockGLPath *cd_generate_arrow_path (double fFrameWidth, double fTotalHeight)
 
934
{
 
935
        static CairoDockGLPath *pPath = NULL;
 
936
        double w = fFrameWidth / 2;
 
937
        
 
938
        double aw = my_diapo_simple_arrowWidth/2;
 
939
        double ah = my_diapo_simple_arrowHeight;
 
940
        double xa = my_diapo_simple_arrowShift * (w - aw);  // abscisse de l'extremite de la pointe.
 
941
        
 
942
        if (pPath == NULL)
 
943
                pPath = cairo_dock_new_gl_path (3, xa - aw, -fTotalHeight/2, 0., 0.);
 
944
        else
 
945
                cairo_dock_gl_path_move_to (pPath, xa - aw, -fTotalHeight/2);
 
946
        
 
947
        cairo_dock_gl_path_rel_line_to (pPath, aw, -ah);
 
948
        cairo_dock_gl_path_rel_line_to (pPath, aw, ah);
 
949
        
 
950
        return pPath;
 
951
}
 
952
 
 
953
static const GLfloat *cd_generate_color_tab (double fAlpha, GLfloat *pMiddleBottomColor)
 
954
{
 
955
        static GLfloat *pColorTab = NULL;
 
956
        int iNbPoins1Round = 90/DELTA_ROUND_DEGREE;
 
957
        if (pColorTab == NULL)
 
958
                pColorTab = g_new (GLfloat, ((iNbPoins1Round+1)*4+1) * 4);
 
959
        
 
960
        double *pTopRightColor, *pTopLeftColor, *pBottomLeftColor, *pBottomRightColor;
 
961
        double pMeanColor[4] = {(my_diapo_simple_color_frame_start[0] + my_diapo_simple_color_frame_stop[0])/2,
 
962
                (my_diapo_simple_color_frame_start[1] + my_diapo_simple_color_frame_stop[1])/2,
 
963
                (my_diapo_simple_color_frame_start[2] + my_diapo_simple_color_frame_stop[2])/2,
 
964
                (my_diapo_simple_color_frame_start[3] + my_diapo_simple_color_frame_stop[3])/2};
 
965
        pTopLeftColor = my_diapo_simple_color_frame_start;
 
966
        if (my_diapo_simple_fade2bottom || my_diapo_simple_fade2right)
 
967
        {
 
968
                pBottomRightColor = my_diapo_simple_color_frame_stop;
 
969
                if (my_diapo_simple_fade2bottom && my_diapo_simple_fade2right)
 
970
                {
 
971
                        pBottomLeftColor = pMeanColor;
 
972
                        pTopRightColor = pMeanColor;
 
973
                }
 
974
                else if (my_diapo_simple_fade2bottom)
 
975
                {
 
976
                        pBottomLeftColor = my_diapo_simple_color_frame_stop;
 
977
                        pTopRightColor = my_diapo_simple_color_frame_start;
 
978
                }
 
979
                else
 
980
                {
 
981
                        pBottomLeftColor = my_diapo_simple_color_frame_start;
 
982
                        pTopRightColor = my_diapo_simple_color_frame_stop;
 
983
                }
 
984
        }
 
985
        else
 
986
        {
 
987
                pBottomRightColor = my_diapo_simple_color_frame_start;
 
988
                pBottomLeftColor = my_diapo_simple_color_frame_start;
 
989
                pTopRightColor = my_diapo_simple_color_frame_start;
 
990
        }
 
991
        
 
992
        pMiddleBottomColor[0] = (pBottomRightColor[0] + pBottomLeftColor[0])/2;
 
993
        pMiddleBottomColor[1] = (pBottomRightColor[1] + pBottomLeftColor[1])/2;
 
994
        pMiddleBottomColor[2] = (pBottomRightColor[2] + pBottomLeftColor[2])/2;
 
995
        pMiddleBottomColor[3] = (pBottomRightColor[3] + pBottomLeftColor[3])/2;
 
996
        
 
997
        int i=0, j;
 
998
        _copy_color (pColorTab, i, fAlpha, pBottomRightColor);
 
999
        i ++;
 
1000
        
 
1001
        for (j = 0; j < iNbPoins1Round; j ++, i ++)  // coin bas droit.
 
1002
        {
 
1003
                _copy_color (pColorTab, i, fAlpha, pBottomRightColor);
 
1004
        }
 
1005
        
 
1006
        for (j = 0; j < iNbPoins1Round; j ++, i ++)  // coin haut droit.
 
1007
        {
 
1008
                _copy_color (pColorTab, i, fAlpha, pTopRightColor);
 
1009
        }
 
1010
        
 
1011
        for (j = 0; j < iNbPoins1Round; j ++, i ++)  // coin haut gauche.
 
1012
        {
 
1013
                _copy_color (pColorTab, i, fAlpha, pTopLeftColor);
 
1014
        }
 
1015
        
 
1016
        for (j = 0; j < iNbPoins1Round; j ++, i ++)  // coin bas gauche.
 
1017
        {
 
1018
                _copy_color (pColorTab, i, fAlpha, pBottomLeftColor);
 
1019
        }
 
1020
        
 
1021
        return pColorTab;
 
1022
}
 
1023
 
 
1024
static void cd_rendering_render_diapo_simple_opengl (CairoDock *pDock)
 
1025
{
 
1026
        static CairoDockGLPath *pScrollPath = NULL;
 
1027
        
582
1028
        //\____________________ On initialise le cadre.
583
1029
        int iNbVertex;
584
1030
        GLfloat *pColorTab, *pVertexTab;
585
1031
        
586
1032
        double fRadius = my_diapo_simple_radius;
587
1033
        double fFrameWidth  = pDock->iMaxDockWidth - 2*X_BORDER_SPACE;  // longueur du trait horizontal.
588
 
        double fFrameHeight = pDock->iMaxDockHeight- (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth);  // hauteur du cadre avec les rayons et sans la pointe.
 
1034
        double fFrameHeight = pDock->iMaxDockHeight - (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth);  // hauteur du cadre avec les rayons et sans la pointe.
589
1035
        double fDockOffsetX, fDockOffsetY;
590
 
        if (pDock->container.bIsHorizontal)
591
 
        {
592
 
                fDockOffsetX = X_BORDER_SPACE;
593
 
                fDockOffsetY = (!pDock->container.bDirectionUp ? .5*my_diapo_simple_lineWidth : my_diapo_simple_arrowHeight+ARROW_TIP);
594
 
                fFrameWidth  = pDock->iMaxDockWidth - 2*X_BORDER_SPACE;  // longueur du trait horizontal.
595
 
                fFrameHeight = pDock->iMaxDockHeight- (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth);  // hauteur du cadre avec les rayons et sans la pointe.
596
 
        }
597
 
        else
598
 
        {
599
 
                fDockOffsetY = X_BORDER_SPACE;
600
 
                fDockOffsetX = (pDock->container.bDirectionUp ? .5*my_diapo_simple_lineWidth : my_diapo_simple_arrowHeight+ARROW_TIP);
601
 
                fFrameHeight = pDock->iMaxDockWidth - 2*X_BORDER_SPACE;  // longueur du trait horizontal.
602
 
                fFrameWidth = pDock->iMaxDockHeight- (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth);  // hauteur du cadre avec les rayons et sans la pointe.
603
 
        }
604
 
        
605
 
        
606
 
        if (my_diapo_simple_draw_background)  // On remplit le cadre en 2 temps (avec des polygones convexes).
607
 
        {
608
 
                glPushMatrix ();
609
 
                glTranslatef ((int) (fDockOffsetX + fFrameWidth/2), (int) (fDockOffsetY + fFrameHeight/2), -100);  // (int) -pDock->iMaxIconHeight * (1 + myIcons.fAmplitude) + 1
610
 
                glScalef (fFrameWidth, fFrameHeight, 1.);
611
 
                
612
 
                glEnable (GL_BLEND); // On active le blend
613
 
                glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
614
 
                _cairo_dock_set_blend_alpha ();
615
 
                
616
 
                double fAlpha = (pDock->fFoldingFactor < .3 ? (.3 - pDock->fFoldingFactor) / .3 : 0.);  // apparition du cadre de 0.3 a 0
617
 
                
618
 
                glPolygonMode (GL_FRONT, GL_FILL);
619
 
                glEnableClientState (GL_VERTEX_ARRAY);
 
1036
        
 
1037
        fDockOffsetX = X_BORDER_SPACE;
 
1038
        fDockOffsetY = my_diapo_simple_arrowHeight+ARROW_TIP;
 
1039
        ///fFrameWidth  = pDock->iMaxDockWidth - 2*X_BORDER_SPACE;  // longueur du trait horizontal.
 
1040
        ///fFrameHeight = pDock->iMaxDockHeight- (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth);  // hauteur du cadre avec les rayons et sans la pointe.
 
1041
        
 
1042
        //\_____________ On genere les coordonnees du contour.
 
1043
        CairoDockGLPath *pFramePath = cd_generate_frame_path_without_arrow (fFrameWidth, fFrameHeight, fRadius);
 
1044
        
 
1045
        //\_____________ On remplit avec le fond.
 
1046
        glPushMatrix ();
 
1047
        double fAlpha = (pDock->fFoldingFactor < .3 ? (.3 - pDock->fFoldingFactor) / .3 : 0.);  // apparition du cadre de 0.3 a 0
 
1048
        cairo_dock_set_container_orientation_opengl (CAIRO_CONTAINER (pDock));
 
1049
        glTranslatef (fDockOffsetX + (fFrameWidth)/2,
 
1050
                fDockOffsetY + fFrameHeight/2,
 
1051
                0.);
 
1052
        _cairo_dock_set_blend_alpha ();
 
1053
        
 
1054
        if (my_diapo_simple_draw_background)
 
1055
        {
 
1056
                // le cadre sans la pointe.
 
1057
                GLfloat pBottomMiddleColor[4];
 
1058
                const GLfloat *pColorTab = cd_generate_color_tab (fAlpha, pBottomMiddleColor);
620
1059
                glEnableClientState (GL_COLOR_ARRAY);
621
 
                
622
 
                //\____________________ On remplit le cadre sans la fleche.
623
 
                pVertexTab = cd_rendering_generate_path_for_diapo_simple_opengl_without_arrow (pDock, fAlpha, &pColorTab, &iNbVertex);
624
 
                
625
 
                //glVertexPointer (_CAIRO_DOCK_PATH_DIM, GL_FLOAT, 0, pVertexTab);
626
 
                _cairo_dock_set_vertex_pointer (pVertexTab);
627
1060
                glColorPointer (4, GL_FLOAT, 0, pColorTab);
628
 
                glDrawArrays (GL_POLYGON, 0, iNbVertex);
629
 
                
 
1061
                cairo_dock_fill_gl_path (pFramePath, 0);
630
1062
                glDisableClientState (GL_COLOR_ARRAY);
631
1063
                
632
 
                //\____________________ On remplit la fleche.
633
 
                GLfloat color[4];
634
 
                pVertexTab = cd_rendering_generate_arrow_path_for_diapo_simple_opengl (pDock, fAlpha, color);
635
 
                glColor4fv (color);
636
 
                
637
 
                //glVertexPointer (_CAIRO_DOCK_PATH_DIM, GL_FLOAT, 0, pVertexTab);
638
 
                _cairo_dock_set_vertex_pointer (pVertexTab);
639
 
                glDrawArrays (GL_POLYGON, 0, 4);
640
 
                
641
 
                glDisableClientState (GL_VERTEX_ARRAY);
642
 
                
643
 
                //\____________________ On genere et trace le contour du cadre complet (avec la fleche).
644
 
                if (my_diapo_simple_lineWidth != 0 && my_diapo_simple_color_border_line[3] != 0 && fAlpha != 0)
645
 
                {
646
 
                        pVertexTab = cd_rendering_generate_path_for_diapo_simple_opengl (pDock, &iNbVertex);
647
 
                        
648
 
                        //glVertexPointer (_CAIRO_DOCK_PATH_DIM, GL_FLOAT, 0, pVertexTab);
649
 
                        _cairo_dock_set_vertex_pointer (pVertexTab);
650
 
                        double frame_alpha = my_diapo_simple_color_border_line[3];
651
 
                        my_diapo_simple_color_border_line[3] *= fAlpha;
652
 
                        cairo_dock_draw_current_path_opengl (my_diapo_simple_lineWidth, my_diapo_simple_color_border_line, iNbVertex);
653
 
                        my_diapo_simple_color_border_line[3] = frame_alpha;
654
 
                }
 
1064
                // la pointe.
 
1065
                CairoDockGLPath *pArrowPath = cd_generate_arrow_path (fFrameWidth, fFrameHeight);
 
1066
                glColor4f (pBottomMiddleColor[0], pBottomMiddleColor[1], pBottomMiddleColor[2], pBottomMiddleColor[3] * fAlpha);
 
1067
                cairo_dock_fill_gl_path (pArrowPath, 0);
 
1068
        }
 
1069
        
 
1070
        //\_____________ On trace le contour.
 
1071
        if (my_diapo_simple_lineWidth != 0 && my_diapo_simple_color_border_line[3] != 0 && fAlpha != 0)
 
1072
        {
 
1073
                cd_add_arrow_to_path (pFramePath, fFrameWidth);
 
1074
                glLineWidth (my_diapo_simple_lineWidth);
 
1075
                glColor4f (my_diapo_simple_color_border_line[0], my_diapo_simple_color_border_line[1], my_diapo_simple_color_border_line[2], my_diapo_simple_color_border_line[3] * fAlpha);
 
1076
                cairo_dock_stroke_gl_path (pFramePath, TRUE);
 
1077
        }
 
1078
        glPopMatrix ();
 
1079
        _cairo_dock_set_blend_over ();
 
1080
        
 
1081
        //\____________________ On dessine les barres de defilement.
 
1082
        CDSlideData *pData = pDock->pRendererData;
 
1083
        if (pData != NULL && pData->iDeltaHeight != 0)
 
1084
        {
 
1085
                glPushMatrix ();
 
1086
                if (pScrollPath == NULL)
 
1087
                        pScrollPath = cairo_dock_new_gl_path (4, 0., 0., 0, 0);  // des triangles ou des rectangles => 4 points max.
 
1088
                glLineWidth (2.);
 
1089
                
 
1090
                double x_arrow = pDock->iMaxDockWidth - X_BORDER_SPACE - fScrollbarWidth/2;  // pointe de la fleche.
 
1091
                double y_arrow_top, y_arrow_bottom;
 
1092
                if (pDock->container.bDirectionUp)
 
1093
                {
 
1094
                        y_arrow_bottom = my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth;
 
1095
                        y_arrow_top = pDock->iMaxDockHeight - my_diapo_simple_lineWidth;
 
1096
                }
 
1097
                else
 
1098
                {
 
1099
                        y_arrow_top = pDock->iMaxDockHeight - (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth);
 
1100
                        y_arrow_bottom = my_diapo_simple_lineWidth;
 
1101
                }
 
1102
                if (pData->iScrollOffset != 0)  // fleche vers le haut.
 
1103
                {
 
1104
                        cairo_dock_gl_path_move_to (pScrollPath, x_arrow, y_arrow_top);
 
1105
                        cairo_dock_gl_path_rel_line_to (pScrollPath, fScrollbarWidth/2, -fArrowHeight);
 
1106
                        cairo_dock_gl_path_rel_line_to (pScrollPath, -fScrollbarWidth, 0.);
 
1107
                        
 
1108
                        glColor4f (my_diapo_simple_color_scrollbar_inside[0], my_diapo_simple_color_scrollbar_inside[1], my_diapo_simple_color_scrollbar_inside[2], my_diapo_simple_color_scrollbar_inside[3] * fAlpha);
 
1109
                        cairo_dock_fill_gl_path (pScrollPath, 0);
 
1110
                        
 
1111
                        glColor4f (my_diapo_simple_color_scrollbar_line[0], my_diapo_simple_color_scrollbar_line[1], my_diapo_simple_color_scrollbar_line[2], my_diapo_simple_color_scrollbar_line[3] * fAlpha);
 
1112
                        cairo_dock_stroke_gl_path (pScrollPath, TRUE);  // TRUE <=> close
 
1113
                }
 
1114
                if (pData->iScrollOffset != pData->iDeltaHeight)  // fleche vers le bas.
 
1115
                {
 
1116
                        cairo_dock_gl_path_move_to (pScrollPath, x_arrow, y_arrow_bottom);
 
1117
                        cairo_dock_gl_path_rel_line_to (pScrollPath, fScrollbarWidth/2, fArrowHeight);
 
1118
                        cairo_dock_gl_path_rel_line_to (pScrollPath, -fScrollbarWidth, 0.);
 
1119
                        
 
1120
                        glColor4f (my_diapo_simple_color_scrollbar_inside[0], my_diapo_simple_color_scrollbar_inside[1], my_diapo_simple_color_scrollbar_inside[2], my_diapo_simple_color_scrollbar_inside[3] * fAlpha);
 
1121
                        cairo_dock_fill_gl_path (pScrollPath, 0);
 
1122
                        
 
1123
                        glColor4f (my_diapo_simple_color_scrollbar_line[0], my_diapo_simple_color_scrollbar_line[1], my_diapo_simple_color_scrollbar_line[2], my_diapo_simple_color_scrollbar_line[3] * fAlpha);
 
1124
                        cairo_dock_stroke_gl_path (pScrollPath, TRUE);  // TRUE <=> close
 
1125
                }
 
1126
                
 
1127
                // scrollbar outline
 
1128
                cairo_dock_gl_path_move_to (pScrollPath, x_arrow - fScrollbarWidth/2, y_arrow_bottom + fArrowHeight + fScrollbarArrowGap);
 
1129
                cairo_dock_gl_path_rel_line_to (pScrollPath, fScrollbarWidth, 0.);
 
1130
                cairo_dock_gl_path_rel_line_to (pScrollPath, 0., y_arrow_top - y_arrow_bottom - 2*(fArrowHeight+fScrollbarArrowGap));
 
1131
                cairo_dock_gl_path_rel_line_to (pScrollPath, -fScrollbarWidth, 0.);
 
1132
                
 
1133
                glColor4f (my_diapo_simple_color_scrollbar_inside[0], my_diapo_simple_color_scrollbar_inside[1], my_diapo_simple_color_scrollbar_inside[2], my_diapo_simple_color_scrollbar_inside[3] * fAlpha);
 
1134
                cairo_dock_fill_gl_path (pScrollPath, 0);
 
1135
                
 
1136
                glColor4f (my_diapo_simple_color_scrollbar_line[0], my_diapo_simple_color_scrollbar_line[1], my_diapo_simple_color_scrollbar_line[2], my_diapo_simple_color_scrollbar_line[3] * fAlpha);
 
1137
                cairo_dock_stroke_gl_path (pScrollPath, TRUE);
 
1138
                
 
1139
                // grip
 
1140
                double fGripHeight = fFrameHeight / (fFrameHeight + pData->iDeltaHeight) * (y_arrow_top - y_arrow_bottom - 2*(fArrowHeight+fScrollbarArrowGap));
 
1141
                double ygrip = (double) pData->iScrollOffset / pData->iDeltaHeight * (y_arrow_top - y_arrow_bottom - 2*(fArrowHeight+fScrollbarArrowGap) - fGripHeight);
 
1142
                glColor4f (my_diapo_simple_color_grip[0], my_diapo_simple_color_grip[1], my_diapo_simple_color_grip[2], my_diapo_simple_color_grip[3] * fAlpha);
 
1143
                cairo_dock_gl_path_move_to (pScrollPath, x_arrow - fScrollbarWidth/2, y_arrow_top - (fArrowHeight+fScrollbarArrowGap) - ygrip);
 
1144
                cairo_dock_gl_path_rel_line_to (pScrollPath, fScrollbarWidth, 0.);
 
1145
                cairo_dock_gl_path_rel_line_to (pScrollPath, 0., - fGripHeight);
 
1146
                cairo_dock_gl_path_rel_line_to (pScrollPath, -fScrollbarWidth, 0.);
 
1147
                cairo_dock_fill_gl_path (pScrollPath, 0);
655
1148
                
656
1149
                glPopMatrix ();
657
1150
        }
659
1152
        if (pDock->icons == NULL)
660
1153
                return ;
661
1154
        
662
 
        _cairo_dock_set_blend_over ();
663
 
                
664
1155
        //\____________________ On dessine la ficelle.
665
1156
        if (myIcons.iStringLineWidth > 0)
666
1157
                cairo_dock_draw_string_opengl (pDock, myIcons.iStringLineWidth, FALSE, FALSE);
672
1163
                return;
673
1164
        
674
1165
        // on dessine les icones, l'icone pointee en dernier.
 
1166
        if (pData != NULL && pData->iDeltaHeight != 0) // on fait un clip pour les icones qui debordent.
 
1167
        {
 
1168
                int h = my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth;
 
1169
                if (pDock->container.bIsHorizontal)
 
1170
                {
 
1171
                        glEnable (GL_SCISSOR_TEST);
 
1172
                        glScissor (0,
 
1173
                                (pDock->container.bDirectionUp ? h : 0),  // lower left corner of the scissor box.
 
1174
                                pDock->container.iWidth,
 
1175
                                pDock->container.iHeight - h);
 
1176
                }  // sinon clip inutile.
 
1177
        }
 
1178
        
675
1179
        Icon *icon;
676
1180
        GList *ic = pFirstDrawnElement;
677
1181
        do
678
1182
        {
679
1183
                icon = ic->data;
 
1184
                if (CAIRO_DOCK_ICON_TYPE_IS_SEPARATOR (icon))
 
1185
                        continue;
680
1186
                
681
1187
                cairo_dock_render_one_icon_opengl (icon, pDock, 1., FALSE);
682
1188
                
683
 
                if(icon->iLabelTexture != 0 && (my_diapo_simple_display_all_icons || icon->bPointed))
 
1189
                if (icon->iLabelTexture != 0 && (my_diapo_simple_display_all_labels || icon->bPointed))
684
1190
                {
685
1191
                        glPushMatrix ();
686
 
                        cairo_dock_translate_on_icon_opengl (icon, CAIRO_CONTAINER (pDock), 1.);
687
1192
                        
688
1193
                        double fAlpha = (pDock->fFoldingFactor > .5 ? (1 - pDock->fFoldingFactor) / .5 : 1.);  // apparition du texte de 1 a 0.5
 
1194
                        
 
1195
                        double dx = .5 * (icon->iTextWidth & 1);  // on decale la texture pour la coller sur la grille des coordonnees entieres.
 
1196
                        double dy = .5 * (icon->iTextHeight & 1);
 
1197
                        double u0 = 0., u1 = 1.;
689
1198
                        double fOffsetX = 0.;
690
 
                        if (icon->fDrawX + icon->fWidth * icon->fScale/2 - icon->iTextWidth/2 < 0)
691
 
                                fOffsetX = icon->iTextWidth/2 - (icon->fDrawX + icon->fWidth * icon->fScale/2);
692
 
                        else if (icon->fDrawX + icon->fWidth * icon->fScale/2 + icon->iTextWidth/2 > pDock->container.iWidth)
693
 
                                fOffsetX = pDock->container.iWidth - (icon->fDrawX + icon->fWidth * icon->fScale/2 + icon->iTextWidth/2);
694
 
                        
695
 
                        glTranslatef (floor (fOffsetX) + .5 * (icon->iTextWidth & 1),
696
 
                                floor ((pDock->container.bDirectionUp ? 1:-1) * (icon->fHeight * icon->fScale/2 + myLabels.iLabelSize - icon->iTextHeight / 2)) + .5 * (icon->iTextWidth & 1),
697
 
                                0.);
698
 
                        
699
 
                        if (icon->iTextWidth > icon->fWidth * icon->fScale + my_diapo_simple_iconGapX && ! icon->bPointed)
 
1199
                        if (pDock->container.bIsHorizontal)
700
1200
                        {
701
 
                                _cairo_dock_enable_texture ();
702
 
                                _cairo_dock_set_blend_alpha ();
703
 
                                _cairo_dock_set_alpha (fAlpha * icon->fScale / my_diapo_simple_fScaleMax);
704
 
                                glBindTexture (GL_TEXTURE_2D, icon->iLabelTexture);
705
 
                                
706
 
                                double w = icon->fWidth * icon->fScale + my_diapo_simple_iconGapX;
707
 
                                double h = icon->iTextHeight;
708
 
                                _cairo_dock_apply_current_texture_portion_at_size_with_offset (0., 0., w/icon->iTextWidth, 1.,
709
 
                                        w, h, 0., 0.);
710
 
                                
711
 
                                _cairo_dock_disable_texture ();
 
1201
                                if (icon->bPointed)
 
1202
                                {
 
1203
                                        _cairo_dock_set_alpha (fAlpha);
 
1204
                                        if (icon->fDrawX + icon->fWidth/2 + icon->iTextWidth/2 > pDock->container.iWidth)
 
1205
                                                fOffsetX = pDock->container.iWidth - (icon->fDrawX + icon->fWidth/2 + icon->iTextWidth/2);
 
1206
                                        if (icon->fDrawX + icon->fWidth/2 - icon->iTextWidth/2 < 0)
 
1207
                                                fOffsetX = icon->iTextWidth/2 - (icon->fDrawX + icon->fWidth/2);
 
1208
                                }
 
1209
                                else
 
1210
                                {
 
1211
                                        _cairo_dock_set_alpha (fAlpha * icon->fScale / my_diapo_simple_fScaleMax);
 
1212
                                        if (icon->iTextWidth > icon->fWidth + 2 * myLabels.iLabelSize)
 
1213
                                        {
 
1214
                                                fOffsetX = 0.;
 
1215
                                                u1 = (double) (icon->fWidth + 2 * myLabels.iLabelSize) / icon->iTextWidth;
 
1216
                                        }
 
1217
                                }
 
1218
                                
 
1219
                                glTranslatef (ceil (icon->fDrawX + icon->fScale * icon->fWidth/2 + fOffsetX) + dx,
 
1220
                                        ceil (pDock->container.iHeight - icon->fDrawY + icon->iTextHeight / 2) + dy,
 
1221
                                        0.);
712
1222
                        }
713
1223
                        else
714
1224
                        {
715
 
                                cairo_dock_draw_texture_with_alpha (icon->iLabelTexture,
716
 
                                        icon->iTextWidth,
717
 
                                        icon->iTextHeight,
718
 
                                        fAlpha * icon->fScale / my_diapo_simple_fScaleMax);
 
1225
                                if (icon->bPointed)
 
1226
                                {
 
1227
                                        _cairo_dock_set_alpha (fAlpha);
 
1228
                                        if (icon->fDrawY + icon->fHeight/2 + icon->iTextWidth/2 > pDock->container.iHeight)
 
1229
                                                fOffsetX = pDock->container.iHeight - (icon->fDrawY + icon->fHeight/2 + icon->iTextWidth/2);
 
1230
                                        if (icon->fDrawY + icon->fHeight/2 - icon->iTextWidth/2 < 0)
 
1231
                                                fOffsetX = icon->iTextWidth/2 - (icon->fDrawY + icon->fHeight/2);
 
1232
                                }
 
1233
                                else
 
1234
                                {
 
1235
                                        _cairo_dock_set_alpha (fAlpha * icon->fScale / my_diapo_simple_fScaleMax);
 
1236
                                        if (icon->iTextWidth > icon->fWidth + 2 * myLabels.iLabelSize)
 
1237
                                        {
 
1238
                                                fOffsetX = 0.;
 
1239
                                                u1 = (double) (icon->fWidth + 2 * myLabels.iLabelSize) / icon->iTextWidth;
 
1240
                                        }
 
1241
                                }
 
1242
                                
 
1243
                                glTranslatef (ceil (icon->fDrawY + icon->fScale * icon->fHeight/2 + fOffsetX / 2) + dx,
 
1244
                                        ceil (pDock->container.iWidth - icon->fDrawX + icon->iTextHeight / 2) + dy,
 
1245
                                        0.);
719
1246
                        }
 
1247
                        _cairo_dock_enable_texture ();
 
1248
                        _cairo_dock_set_blend_alpha ();
 
1249
                        glBindTexture (GL_TEXTURE_2D, icon->iLabelTexture);
 
1250
                        _cairo_dock_apply_current_texture_portion_at_size_with_offset (u0, 0.,
 
1251
                                u1 - u0, 1.,
 
1252
                                icon->iTextWidth * (u1 - u0), icon->iTextHeight,
 
1253
                                0., 0.);
 
1254
                        _cairo_dock_disable_texture ();
 
1255
                        _cairo_dock_set_alpha (1.);
 
1256
                        
720
1257
                        glPopMatrix ();
721
1258
                }
722
1259
                
723
1260
                ic = cairo_dock_get_next_element (ic, pDock->icons);
724
1261
        }
725
1262
        while (ic != pFirstDrawnElement);
726
 
}
727
 
 
728
 
 
729
 
static const double a = 2.5;  // definit combien la fleche est penchee.
730
 
 
731
 
#define RADIAN (G_PI / 180.0)  // Conversion Radian/Degres
732
 
#define DELTA_ROUND_DEGREE 5
733
 
#define TIP_OFFSET_FACTOR 2.
734
 
#define _recopy_prev_color(pColorTab, i) memcpy (&pColorTab[4*i], &pColorTab[4*(i-1)], 4*sizeof (GLfloat));
735
 
#define _copy_color(pColorTab, i, fAlpha, c) do { \
736
 
        pColorTab[4*i]   = c[0];\
737
 
        pColorTab[4*i+1] = c[1];\
738
 
        pColorTab[4*i+2] = c[2];\
739
 
        pColorTab[4*i+3] = c[3] * fAlpha; } while (0)
740
 
/*#define _copy_mean_color(pColorTab, i, fAlpha, c1, c2, f) do { \
741
 
        pColorTab[4*i]   = c1[0]*f + c2[0]*(1-f);\
742
 
        pColorTab[4*i+1] = c1[1]*f + c2[1]*(1-f);\
743
 
        pColorTab[4*i+2] = c1[2]*f + c2[2]*(1-f);\
744
 
        pColorTab[4*i+3] = (c1[3]*f + c2[3]*(1-f)) * fAlpha; } while (0)*/
745
 
GLfloat *cd_rendering_generate_path_for_diapo_simple_opengl (CairoDock *pDock, int *iNbPoints)
746
 
{
747
 
        //static GLfloat pVertexTab[((90/DELTA_ROUND_DEGREE+1)*4+1+3)*3];  // +3 pour la pointe.
748
 
        _cairo_dock_define_static_vertex_tab ((90/DELTA_ROUND_DEGREE+1)*4+1+3);  // +3 pour la pointe.
749
 
        double fRadius = my_diapo_simple_radius;
750
 
        double fFrameWidth  = pDock->iMaxDockWidth - 2*X_BORDER_SPACE - 2*fRadius;  // longueur du trait horizontal.
751
 
        double fFrameHeight = pDock->iMaxDockHeight- (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth);  // hauteur du cadre avec les rayons et sans la pointe.
752
 
        
753
 
        const gdouble arrow_dec = 2;
754
 
        double fTotalWidth = fFrameWidth + 2 * fRadius;
755
 
        double w = fFrameWidth / fTotalWidth / 2;
756
 
        double h = MAX (0, fFrameHeight - 2 * fRadius) / fFrameHeight / 2;
757
 
        double rw = fRadius / fTotalWidth;
758
 
        double rh = fRadius / fFrameHeight;
759
 
        int i=0, t;
760
 
        int iPrecision = DELTA_ROUND_DEGREE;
761
 
        double x,y;  // 1ere coordonnee de la pointe.
762
 
        
763
 
        for (t = 0;t <= 90;t += iPrecision, i++) // cote haut droit.
764
 
        {
765
 
                _cairo_dock_set_vertex_xy (i,
766
 
                        w + rw * cos (t*RADIAN),
767
 
                        h + rh * sin (t*RADIAN));
768
 
        }
769
 
        if (!pDock->container.bDirectionUp && pDock->container.bIsHorizontal)  // dessin de la pointe vers le haut.
770
 
        {
771
 
                x = 0. + my_diapo_simple_arrowShift * (fFrameWidth/2 - my_diapo_simple_arrowWidth/2)/fTotalWidth + my_diapo_simple_arrowWidth/2/fTotalWidth;
772
 
                y = h + rh;
773
 
                _cairo_dock_set_vertex_xy (i,
774
 
                        x,
775
 
                        y);
776
 
                i ++;
777
 
                _cairo_dock_set_vertex_xy (i,
778
 
                        x - my_diapo_simple_arrowWidth/2 * (1 + a * my_diapo_simple_arrowShift)/fTotalWidth,
779
 
                        y + my_diapo_simple_arrowHeight/fFrameHeight);
780
 
                i ++;
781
 
                _cairo_dock_set_vertex_xy (i,
782
 
                        x - my_diapo_simple_arrowWidth/fTotalWidth,
783
 
                        y);
784
 
                i ++;
785
 
        }
786
 
        for (t = 90;t <= 180;t += iPrecision, i++) // haut gauche.
787
 
        {
788
 
                _cairo_dock_set_vertex_xy (i,
789
 
                        -w + rw * cos (t*RADIAN),
790
 
                        h + rh * sin (t*RADIAN));
791
 
        }
792
 
        if (!pDock->container.bDirectionUp && !pDock->container.bIsHorizontal)  // dessin de la pointe vers la gauche.
793
 
        {
794
 
                x = -w - rw;
795
 
                y = 0. + my_diapo_simple_arrowShift * (fFrameHeight/2 - fRadius - my_diapo_simple_arrowWidth/2)/fFrameHeight + my_diapo_simple_arrowWidth/2/fFrameHeight;
796
 
                _cairo_dock_set_vertex_xy (i,
797
 
                        x,
798
 
                        y);
799
 
                i ++;
800
 
                _cairo_dock_set_vertex_xy (i,
801
 
                        x - my_diapo_simple_arrowHeight/fFrameHeight,
802
 
                        y - my_diapo_simple_arrowWidth/2 * (1 + a * my_diapo_simple_arrowShift)/fFrameHeight);
803
 
                i ++;
804
 
                _cairo_dock_set_vertex_xy (i,
805
 
                        x,
806
 
                        y - my_diapo_simple_arrowWidth/fFrameHeight);
807
 
                i ++;
808
 
        }
809
 
        for (t = 180;t <= 270;t += iPrecision, i++) // bas gauche.
810
 
        {
811
 
                _cairo_dock_set_vertex_xy (i,
812
 
                        -w + rw * cos (t*RADIAN),
813
 
                        -h + rh * sin (t*RADIAN));
814
 
        }
815
 
        if (pDock->container.bDirectionUp && pDock->container.bIsHorizontal)  // dessin de la pointe vers le bas.
816
 
        {
817
 
                x = 0. + my_diapo_simple_arrowShift * (fFrameWidth/2 - my_diapo_simple_arrowWidth/2)/fTotalWidth - my_diapo_simple_arrowWidth/2/fTotalWidth;
818
 
                y = - h - rh;
819
 
                _cairo_dock_set_vertex_xy (i,
820
 
                        x,
821
 
                        y);
822
 
                i ++;
823
 
                _cairo_dock_set_vertex_xy (i,
824
 
                        x + my_diapo_simple_arrowWidth/2 * (1 - a * my_diapo_simple_arrowShift)/fTotalWidth,
825
 
                        y - my_diapo_simple_arrowHeight/fFrameHeight);
826
 
                i ++;
827
 
                _cairo_dock_set_vertex_xy (i,
828
 
                        x + my_diapo_simple_arrowWidth/fTotalWidth,
829
 
                        y);
830
 
                i ++;
831
 
        }
832
 
        for (t = 270;t <= 360;t += iPrecision, i++) // bas droit.
833
 
        {
834
 
                _cairo_dock_set_vertex_xy (i,
835
 
                        w + rw * cos (t*RADIAN),
836
 
                        -h + rh * sin (t*RADIAN));
837
 
        }
838
 
        if (pDock->container.bDirectionUp && !pDock->container.bIsHorizontal)  // dessin de la pointe vers la droite.
839
 
        {
840
 
                x = w + rw;
841
 
                y = 0. + my_diapo_simple_arrowShift * (fFrameHeight/2 - fRadius - my_diapo_simple_arrowWidth/2)/fFrameHeight - my_diapo_simple_arrowWidth/2/fFrameHeight;
842
 
                _cairo_dock_set_vertex_xy (i,
843
 
                        x,
844
 
                        y);
845
 
                i ++;
846
 
                _cairo_dock_set_vertex_xy (i,
847
 
                        x + my_diapo_simple_arrowHeight/fFrameHeight,
848
 
                        y + my_diapo_simple_arrowWidth/2 * (1 - a * my_diapo_simple_arrowShift)/fFrameHeight);
849
 
                i ++;
850
 
                _cairo_dock_set_vertex_xy (i,
851
 
                        x,
852
 
                        y + my_diapo_simple_arrowWidth/fFrameHeight);
853
 
                i ++;
854
 
        }
855
 
        _cairo_dock_close_path(i);
856
 
        
857
 
        *iNbPoints = i+1;
858
 
        _cairo_dock_return_vertex_tab ();
859
 
}
860
 
 
861
 
GLfloat *cd_rendering_generate_path_for_diapo_simple_opengl_without_arrow (CairoDock *pDock, double fAlpha, GLfloat **colors, int *iNbPoints)
862
 
{
863
 
        //static GLfloat pVertexTab[((90/DELTA_ROUND_DEGREE+1)*4+1+3)*3];  // +3 pour la pointe.
864
 
        _cairo_dock_define_static_vertex_tab ((90/DELTA_ROUND_DEGREE+1)*4+1+3);  // +3 pour la pointe.
865
 
        static GLfloat pColorTab[((90/DELTA_ROUND_DEGREE+1)*4+1+3)*4];  // +3 pour la pointe.
866
 
        double fRadius = my_diapo_simple_radius;
867
 
        double fFrameWidth  = pDock->iMaxDockWidth - 2*X_BORDER_SPACE - 2*fRadius;  // longueur du trait horizontal.
868
 
        double fFrameHeight = pDock->iMaxDockHeight- (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth);  // hauteur du cadre avec les rayons et sans la pointe.
869
 
        
870
 
        const gdouble arrow_dec = 2;
871
 
        double fTotalWidth = fFrameWidth + 2 * fRadius;
872
 
        double w = fFrameWidth / fTotalWidth / 2;
873
 
        double h = MAX (0, fFrameHeight - 2 * fRadius) / fFrameHeight / 2;
874
 
        double rw = fRadius / fTotalWidth;
875
 
        double rh = fRadius / fFrameHeight;
876
 
        int i=0, t;
877
 
        int iPrecision = DELTA_ROUND_DEGREE;
878
 
        
879
 
        double *pTopRightColor, *pTopLeftColor, *pBottomLeftColor, *pBottomRightColor;
880
 
        double pMeanColor[4] = {(my_diapo_simple_color_frame_start[0] + my_diapo_simple_color_frame_stop[0])/2,
881
 
                (my_diapo_simple_color_frame_start[1] + my_diapo_simple_color_frame_stop[1])/2,
882
 
                (my_diapo_simple_color_frame_start[2] + my_diapo_simple_color_frame_stop[2])/2,
883
 
                (my_diapo_simple_color_frame_start[3] + my_diapo_simple_color_frame_stop[3])/2};
884
 
        pTopLeftColor = my_diapo_simple_color_frame_start;
885
 
        if (my_diapo_simple_fade2bottom || my_diapo_simple_fade2right)
886
 
        {
887
 
                pBottomRightColor = my_diapo_simple_color_frame_stop;
888
 
                if (my_diapo_simple_fade2bottom && my_diapo_simple_fade2right)
889
 
                {
890
 
                        pBottomLeftColor = pMeanColor;
891
 
                        pTopRightColor = pMeanColor;
892
 
                }
893
 
                else if (my_diapo_simple_fade2bottom)
894
 
                {
895
 
                        pBottomLeftColor = my_diapo_simple_color_frame_stop;
896
 
                        pTopRightColor = my_diapo_simple_color_frame_start;
897
 
                }
898
 
                else
899
 
                {
900
 
                        pBottomLeftColor = my_diapo_simple_color_frame_start;
901
 
                        pTopRightColor = my_diapo_simple_color_frame_stop;
902
 
                }
903
 
        }
904
 
        else
905
 
        {
906
 
                pBottomRightColor = my_diapo_simple_color_frame_start;
907
 
                pBottomLeftColor = my_diapo_simple_color_frame_start;
908
 
                pTopRightColor = my_diapo_simple_color_frame_start;
909
 
        }
910
 
        
911
 
        for (t = 0;t <= 90;t += iPrecision, i++) // cote haut droit.
912
 
        {
913
 
                _cairo_dock_set_vertex_xy (i,
914
 
                        w + rw * cos (t*RADIAN),
915
 
                        h + rh * sin (t*RADIAN));
916
 
                //pVertexTab[3*i] = w + rw * cos (t*RADIAN);
917
 
                //pVertexTab[3*i+1] = h + rh * sin (t*RADIAN);
918
 
                _copy_color (pColorTab, i, fAlpha, pTopRightColor);
919
 
        }
920
 
        for (t = 90;t <= 180;t += iPrecision, i++) // haut gauche.
921
 
        {
922
 
                _cairo_dock_set_vertex_xy (i,
923
 
                        -w + rw * cos (t*RADIAN),
924
 
                        h + rh * sin (t*RADIAN));
925
 
                //pVertexTab[3*i] = -w + rw * cos (t*RADIAN);
926
 
                //pVertexTab[3*i+1] = h + rh * sin (t*RADIAN);
927
 
                _copy_color (pColorTab, i, fAlpha, pTopLeftColor);
928
 
        }
929
 
        for (t = 180;t <= 270;t += iPrecision, i++) // bas gauche.
930
 
        {
931
 
                _cairo_dock_set_vertex_xy (i,
932
 
                        -w + rw * cos (t*RADIAN),
933
 
                        -h + rh * sin (t*RADIAN));
934
 
                //pVertexTab[3*i] = -w + rw * cos (t*RADIAN);
935
 
                //pVertexTab[3*i+1] = -h + rh * sin (t*RADIAN);
936
 
                _copy_color (pColorTab, i, fAlpha, pBottomLeftColor);
937
 
        }
938
 
        for (t = 270;t <= 360;t += iPrecision, i++) // bas droit.
939
 
        {
940
 
                _cairo_dock_set_vertex_xy (i,
941
 
                        w + rw * cos (t*RADIAN),
942
 
                        -h + rh * sin (t*RADIAN));
943
 
                //pVertexTab[3*i] = w + rw * cos (t*RADIAN);
944
 
                //pVertexTab[3*i+1] = -h + rh * sin (t*RADIAN);
945
 
                _copy_color (pColorTab, i, fAlpha, pBottomRightColor);
946
 
        }
947
 
        _cairo_dock_close_path(i);
948
 
        //pVertexTab[3*i] = w + rw;  // on boucle.
949
 
        //pVertexTab[3*i+1] = h;
950
 
        memcpy (&pColorTab[4*i], &pColorTab[0], 4*sizeof (GLfloat));
951
 
        
952
 
        *iNbPoints = i+1;
953
 
        *colors = pColorTab;
954
 
        _cairo_dock_return_vertex_tab ();
955
 
}
956
 
 
957
 
#define _set_arrow_color(c1, c2, f, fAlpha, colors) do {\
958
 
        colors[0] = c1[0] * (f) + c2[0] * (1 - (f));\
959
 
        colors[1] = c1[1] * (f) + c2[1] * (1 - (f));\
960
 
        colors[2] = c1[2] * (f) + c2[2] * (1 - (f));\
961
 
        colors[3] = (c1[3] * (f) + c2[3] * (1 - (f))) * fAlpha; } while (0)
962
 
GLfloat *cd_rendering_generate_arrow_path_for_diapo_simple_opengl (CairoDock *pDock, double fAlpha, GLfloat *color)
963
 
{
964
 
        //static GLfloat pVertexTab[((90/DELTA_ROUND_DEGREE+1)*4+1+3)*3];  // +3 pour la pointe.
965
 
        _cairo_dock_define_static_vertex_tab ((90/DELTA_ROUND_DEGREE+1)*4+1+3);  // +3 pour la pointe.
966
 
        double fRadius = my_diapo_simple_radius;
967
 
        double fFrameWidth  = pDock->iMaxDockWidth - 2*X_BORDER_SPACE - 2*fRadius;  // longueur du trait horizontal.
968
 
        double fFrameHeight = pDock->iMaxDockHeight- (my_diapo_simple_arrowHeight + ARROW_TIP + my_diapo_simple_lineWidth);  // hauteur du cadre avec les rayons et sans la pointe.
969
 
        
970
 
        const gdouble arrow_dec = 2;
971
 
        double fTotalWidth = fFrameWidth + 2 * fRadius;
972
 
        double w = fFrameWidth / fTotalWidth / 2;
973
 
        double h = MAX (0, fFrameHeight - 2 * fRadius) / fFrameHeight / 2;
974
 
        double rw = fRadius / fTotalWidth;
975
 
        double rh = fRadius / fFrameHeight;
976
 
        int i=0, t;
977
 
        int iPrecision = DELTA_ROUND_DEGREE;
978
 
        
979
 
        double *pTopRightColor, *pTopLeftColor, *pBottomLeftColor, *pBottomRightColor;
980
 
        double pMeanColor[4] = {(my_diapo_simple_color_frame_start[0] + my_diapo_simple_color_frame_stop[0])/2,
981
 
                (my_diapo_simple_color_frame_start[1] + my_diapo_simple_color_frame_stop[1])/2,
982
 
                (my_diapo_simple_color_frame_start[2] + my_diapo_simple_color_frame_stop[2])/2,
983
 
                (my_diapo_simple_color_frame_start[3] + my_diapo_simple_color_frame_stop[3])/2};
984
 
        pTopLeftColor = my_diapo_simple_color_frame_start;
985
 
        if (my_diapo_simple_fade2bottom || my_diapo_simple_fade2right)
986
 
        {
987
 
                pBottomRightColor = my_diapo_simple_color_frame_stop;
988
 
                if (my_diapo_simple_fade2bottom && my_diapo_simple_fade2right)
989
 
                {
990
 
                        pBottomLeftColor = pMeanColor;
991
 
                        pTopRightColor = pMeanColor;
992
 
                }
993
 
                else if (my_diapo_simple_fade2bottom)
994
 
                {
995
 
                        pBottomLeftColor = my_diapo_simple_color_frame_stop;
996
 
                        pTopRightColor = my_diapo_simple_color_frame_start;
997
 
                }
998
 
                else
999
 
                {
1000
 
                        pBottomLeftColor = my_diapo_simple_color_frame_start;
1001
 
                        pTopRightColor = my_diapo_simple_color_frame_stop;
1002
 
                }
1003
 
        }
1004
 
        else
1005
 
        {
1006
 
                pBottomRightColor = my_diapo_simple_color_frame_start;
1007
 
                pBottomLeftColor = my_diapo_simple_color_frame_start;
1008
 
                pTopRightColor = my_diapo_simple_color_frame_start;
1009
 
        }
1010
 
        
1011
 
        double x,y;  // 1ere coordonnee de la pointe.
1012
 
        if (!pDock->container.bDirectionUp && pDock->container.bIsHorizontal)  // dessin de la pointe vers le haut.
1013
 
        {
1014
 
                x = 0. + my_diapo_simple_arrowShift * (fFrameWidth/2 - my_diapo_simple_arrowWidth/2)/fTotalWidth + my_diapo_simple_arrowWidth/2/fTotalWidth;
1015
 
                y = h + rh;
1016
 
                _cairo_dock_set_vertex_xy (i,
1017
 
                        x,
1018
 
                        y);
1019
 
                i ++;
1020
 
                _cairo_dock_set_vertex_xy (i,
1021
 
                        x - my_diapo_simple_arrowWidth/2 * (1 + a * my_diapo_simple_arrowShift)/fTotalWidth,
1022
 
                        y + my_diapo_simple_arrowHeight/fFrameHeight);
1023
 
                i ++;
1024
 
                _cairo_dock_set_vertex_xy (i,
1025
 
                        x - my_diapo_simple_arrowWidth/fTotalWidth,
1026
 
                        y);
1027
 
                i ++;
1028
 
                _set_arrow_color (pTopRightColor, pTopLeftColor, .5+my_diapo_simple_arrowShift/2, fAlpha, color);
1029
 
        }
1030
 
        else if (!pDock->container.bDirectionUp && !pDock->container.bIsHorizontal)  // dessin de la pointe vers la gauche.
1031
 
        {
1032
 
                x = -w - rw;
1033
 
                y = 0. + my_diapo_simple_arrowShift * (fFrameHeight/2 - fRadius - my_diapo_simple_arrowWidth/2)/fFrameHeight + my_diapo_simple_arrowWidth/2/fFrameHeight;
1034
 
                _cairo_dock_set_vertex_xy (i,
1035
 
                        x,
1036
 
                        y);
1037
 
                i ++;
1038
 
                _cairo_dock_set_vertex_xy (i,
1039
 
                        x - my_diapo_simple_arrowHeight/fFrameHeight,
1040
 
                        y - my_diapo_simple_arrowWidth/2 * (1 + a * my_diapo_simple_arrowShift)/fFrameHeight);
1041
 
                i ++;
1042
 
                _cairo_dock_set_vertex_xy (i,
1043
 
                        x,
1044
 
                        y - my_diapo_simple_arrowWidth/fFrameHeight);
1045
 
                i ++;
1046
 
                _set_arrow_color (pTopLeftColor, pBottomLeftColor, .5+my_diapo_simple_arrowShift/2, fAlpha, color);
1047
 
        }
1048
 
        else if (pDock->container.bDirectionUp && pDock->container.bIsHorizontal)  // dessin de la pointe vers le bas.
1049
 
        {
1050
 
                x = 0. + my_diapo_simple_arrowShift * (fFrameWidth/2 - my_diapo_simple_arrowWidth/2)/fTotalWidth - my_diapo_simple_arrowWidth/2/fTotalWidth;
1051
 
                y = - h - rh;
1052
 
                _cairo_dock_set_vertex_xy (i,
1053
 
                        x,
1054
 
                        y);
1055
 
                i ++;
1056
 
                _cairo_dock_set_vertex_xy (i,
1057
 
                        x + my_diapo_simple_arrowWidth/2 * (1 - a * my_diapo_simple_arrowShift)/fTotalWidth,
1058
 
                        y - my_diapo_simple_arrowHeight/fFrameHeight);
1059
 
                i ++;
1060
 
                _cairo_dock_set_vertex_xy (i,
1061
 
                        x + my_diapo_simple_arrowWidth/fTotalWidth,
1062
 
                        y);
1063
 
                i ++;
1064
 
                _set_arrow_color (pBottomRightColor, pBottomLeftColor, .5+my_diapo_simple_arrowShift/2, fAlpha, color);
1065
 
        }
1066
 
        else if (pDock->container.bDirectionUp && !pDock->container.bIsHorizontal)  // dessin de la pointe vers la droite.
1067
 
        {
1068
 
                x = w + rw;
1069
 
                y = 0. + my_diapo_simple_arrowShift * (fFrameHeight/2 - fRadius - my_diapo_simple_arrowWidth/2)/fFrameHeight - my_diapo_simple_arrowWidth/2/fFrameHeight;
1070
 
                _cairo_dock_set_vertex_xy (i,
1071
 
                        x,
1072
 
                        y);
1073
 
                i ++;
1074
 
                _cairo_dock_set_vertex_xy (i,
1075
 
                        x + my_diapo_simple_arrowHeight/fFrameHeight,
1076
 
                        y + my_diapo_simple_arrowWidth/2 * (1 - a * my_diapo_simple_arrowShift)/fFrameHeight);
1077
 
                i ++;
1078
 
                _cairo_dock_set_vertex_xy (i,
1079
 
                        x,
1080
 
                        y + my_diapo_simple_arrowWidth/fFrameHeight);
1081
 
                i ++;
1082
 
                _set_arrow_color (pTopRightColor, pBottomRightColor, .5+my_diapo_simple_arrowShift/2, fAlpha, color);
1083
 
        }
1084
 
        _cairo_dock_close_path (i);  // on boucle.
1085
 
        _cairo_dock_return_vertex_tab ();
 
1263
        glDisable (GL_SCISSOR_TEST);
 
1264
}
 
1265
 
 
1266
 
 
1267
void cd_rendering_free_slide_data (CairoDock *pDock)
 
1268
{
 
1269
        CDSlideData *pData = pDock->pRendererData;
 
1270
        if (pData != NULL)
 
1271
        {
 
1272
                cairo_dock_remove_notification_func_on_container (CAIRO_CONTAINER (pDock), CAIRO_DOCK_SCROLL_ICON, (CairoDockNotificationFunc) _cd_slide_on_scroll, NULL);
 
1273
                cairo_dock_remove_notification_func_on_container (CAIRO_CONTAINER (pDock), CAIRO_DOCK_CLICK_ICON, (CairoDockNotificationFunc) _cd_slide_on_click, NULL);
 
1274
                cairo_dock_remove_notification_func_on_container (CAIRO_CONTAINER (pDock), CAIRO_DOCK_MOUSE_MOVED, (CairoDockNotificationFunc) _cd_slide_on_mouse_moved, NULL);
 
1275
                g_signal_handler_disconnect (pDock->container.pWidget, pData->iSidPressEvent);
 
1276
                g_signal_handler_disconnect (pDock->container.pWidget, pData->iSidReleaseEvent);
 
1277
                
 
1278
                g_free (pData);
 
1279
                pDock->pRendererData = NULL;
 
1280
        }
 
1281
}
 
1282
 
 
1283
void cd_rendering_register_diapo_simple_renderer (const gchar *cRendererName)
 
1284
{
 
1285
//////////////////////////////////////////////////////////////////////////////////////// On definit le renderer :
 
1286
        CairoDockRenderer *pRenderer = g_new0 (CairoDockRenderer, 1);                                           //Nouvelle structure    
 
1287
        pRenderer->cReadmeFilePath = g_strdup_printf ("%s/readme-diapo-simple-view", MY_APPLET_SHARE_DATA_DIR);        //On affecte le readme
 
1288
        pRenderer->cPreviewFilePath = g_strdup_printf ("%s/preview-diapo-simple.jpg", MY_APPLET_SHARE_DATA_DIR);       // la preview
 
1289
        pRenderer->compute_size = cd_rendering_calculate_max_dock_size_diapo_simple;                        //La fonction qui défini les bornes     
 
1290
        pRenderer->calculate_icons = cd_rendering_calculate_icons_diapo_simple;                                        //qui calcule les param des icones      
 
1291
        pRenderer->render = cd_rendering_render_diapo_simple;                                                          //qui initie le calcul du rendu         
 
1292
        pRenderer->render_optimized = NULL;//cd_rendering_render_diapo_simple_optimized;                                      //pareil en mieux                       
 
1293
        pRenderer->set_subdock_position = cairo_dock_set_subdock_position_linear;                               // ?                                    
 
1294
        pRenderer->render_opengl = cd_rendering_render_diapo_simple_opengl;
 
1295
        
 
1296
        pRenderer->free_data = cd_rendering_free_slide_data;
 
1297
        
 
1298
        
 
1299
        pRenderer->bUseReflect = FALSE;                                                                         // On dit non au reflections
 
1300
        pRenderer->cDisplayedName = D_ (cRendererName);
 
1301
        
 
1302
        cairo_dock_register_renderer (cRendererName, pRenderer);                                    //Puis on signale l'existence de notre rendu
1086
1303
}