2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 3
10
* of the License, or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
/*********************************************************************************
22
This file is a part of the cairo-dock program,
23
released under the terms of the GNU General Public License.
25
Written by Fabrice Rey (for any bug report, please mail me to fabounet@users.berlios.de)
27
*********************************************************************************/
30
#include <cairo-dock.h>
32
#include "applet-struct.h"
33
#include "applet-decorator-3Dplane.h"
35
#define DIALOG_REFLECT_SIZE 50
36
#define DIALOG_INCLINATION 60.
39
void cd_decorator_set_frame_size_3Dplane (CairoDialog *pDialog)
41
double fInclination = tan (DIALOG_INCLINATION/180.*G_PI);
42
double fFrameHeight = 10 + MIN (MAX (pDialog->iIconSize, pDialog->iTextHeight), DIALOG_REFLECT_SIZE);
43
double fRadius = MIN (myConfig.iPlaneRadius, fFrameHeight/2);
44
double fLineWidth = myConfig.iPlaneLineWidth;
46
int iMargin = cairo_dock_calculate_extra_width_for_trapeze (fFrameHeight, fInclination, fRadius, fLineWidth)/2;
47
pDialog->iRightMargin = iMargin;
48
pDialog->iLeftMargin = iMargin;
49
pDialog->iTopMargin = 0;
50
pDialog->iBottomMargin = fFrameHeight - 10;
51
pDialog->iMinBottomGap = 10;
52
pDialog->iMinFrameWidth = 30; // valeur au pif.
54
pDialog->fReflectAlpha = .4;
58
void cd_decorator_draw_decorations_3Dplane (cairo_t *pCairoContext, CairoDialog *pDialog)
60
double fInclination = tan (DIALOG_INCLINATION/180.*G_PI);
61
double fReflectHeight = MIN (MAX (pDialog->iIconSize, pDialog->iTextHeight), DIALOG_REFLECT_SIZE);
62
double fFrameHeight = 10 + fReflectHeight;
63
double fRadius = MIN (myConfig.iPlaneRadius, fFrameHeight/2);
64
double fLineWidth = myConfig.iPlaneLineWidth;
65
int sens = (pDialog->bDirectionUp ? 1 : -1);
66
double fFrameWidth = pDialog->iBubbleWidth;
67
double fOffsetX = pDialog->iLeftMargin;
68
double fOffsetY = pDialog->iTopMargin + pDialog->iBubbleHeight - 10;
70
cairo_dock_draw_frame (pCairoContext, fRadius, fLineWidth, fFrameWidth, fFrameHeight, fOffsetX, fOffsetY, sens, fInclination, pDialog->bIsHorizontal);
72
cairo_set_source_rgba (pCairoContext, myConfig.fPlaneColor[0], myConfig.fPlaneColor[1], myConfig.fPlaneColor[2], myConfig.fPlaneColor[3]);
73
cairo_fill_preserve (pCairoContext);
75
cairo_set_line_width (pCairoContext, 1.);
76
cairo_set_source_rgba (pCairoContext, myConfig.fPlaneLineColor[0], myConfig.fPlaneLineColor[1], myConfig.fPlaneLineColor[2], myConfig.fPlaneLineColor[3]);
77
cairo_stroke (pCairoContext);
79
cairo_rectangle (pCairoContext,
82
pDialog->iBubbleWidth,
83
pDialog->iBubbleHeight);
84
cairo_set_source_rgba (pCairoContext, myDialogs.fDialogColor[0], myDialogs.fDialogColor[1], myDialogs.fDialogColor[2], myDialogs.fDialogColor[3]);
85
cairo_fill (pCairoContext);
89
void cd_decorator_register_3Dplane (void)
91
CairoDialogDecorator *pDecorator = g_new (CairoDialogDecorator, 1);
92
pDecorator->set_size = cd_decorator_set_frame_size_3Dplane;
93
pDecorator->render = cd_decorator_draw_decorations_3Dplane;
94
pDecorator->render_opengl = NULL;
95
pDecorator->cDisplayedName = D_ (MY_APPLET_DECORATOR_3DPLANE_NAME);
96
cairo_dock_register_dialog_decorator (MY_APPLET_DECORATOR_3DPLANE_NAME, pDecorator);