1 /** 2 * This file is a part of the Cairo-Dock project 3 * 4 * Copyright : (C) see the 'copyright' file. 5 * E-mail : see the 'copyright' file. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 3 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 21 #ifndef __CD_CLOCK_STRUCT__ 22 #define __CD_CLOCK_STRUCT__ 23 24 #include <cairo-dock.h> 25 #include <time.h> 26 27 //Frame de fond pour chaque partie de l'heure 28 typedef struct { 29 int iWidth; 30 int iHeight; 31 int iXOffset; 32 int iYOffset; 33 cairo_surface_t *pFrameSurface; 34 } ClockDigitalFrame; 35 36 //Texte de l'heure. 37 typedef struct { 38 int iXOffset; 39 int iYOffset; 40 cairo_surface_t *pTextSurface; 41 } ClockDigitalText; 42 43 //Mode digital de l'horloge, contient tout ce dont on a besoin 44 //Surfaces et paramètres X/Y/W/H 45 typedef struct { 46 ClockDigitalFrame pFrame[4]; 47 ClockDigitalText pText[4]; 48 gboolean bSecondCapable; 49 int iFrameSpacing; 50 int i12modeWidth; 51 int i12modeHeight; 52 int i12modeXOffset; 53 int i12modeYOffset; 54 int i12modeFrame; 55 } ClockDigital; 56 57 typedef enum _LayerElement 58 { 59 CLOCK_DROP_SHADOW = 0, 60 CLOCK_FACE, 61 CLOCK_MARKS, 62 CLOCK_HOUR_HAND_SHADOW, 63 CLOCK_MINUTE_HAND_SHADOW, 64 CLOCK_SECOND_HAND_SHADOW, 65 CLOCK_HOUR_HAND, 66 CLOCK_MINUTE_HAND, 67 CLOCK_SECOND_HAND, 68 CLOCK_FACE_SHADOW, 69 CLOCK_GLASS, 70 CLOCK_FRAME, 71 CLOCK_ELEMENTS 72 } LayerElement; 73 74 typedef enum _SurfaceKind 75 { 76 KIND_BACKGROUND = 0, 77 KIND_FOREGROUND, 78 KIND_HOUR, 79 KIND_MINUTE, 80 KIND_SECOND, 81 } SurfaceKind; 82 83 84 typedef struct { 85 gint iHour; 86 gint iMinute; 87 gint iDayOfWeek; 88 gint iDayOfMonth; 89 gchar *cMessage; 90 gchar *cCommand; 91 } CDClockAlarm; 92 93 typedef enum _CDClockTaskFrequency 94 { 95 CD_TASK_DONT_REPEAT = 0, 96 CD_TASK_EACH_MONTH, 97 CD_TASK_EACH_YEAR, 98 CD_TASK_NB_FREQUENCIES 99 } CDClockTaskFrequency; 100 101 typedef struct { 102 // definition 103 gchar *cID; 104 guint iDay; // 1-31 105 guint iMonth; // 0-11 106 guint iYear; // par exemple 2010 107 gchar *cTitle; 108 gchar *cText; 109 gboolean bActive; // = not done. 110 gchar *cTags; // ',' separated 111 guint iHour; 112 guint iMinute; 113 CDClockTaskFrequency iFrequency; 114 GList *pSubTaskList; 115 // private data 116 GldiModuleInstance *pApplet; 117 gboolean b1DayWarning; 118 gboolean b15mnWarning; 119 gboolean bFirstWarning; 120 gint iWarningDelay; // en minutes. 121 guint iSidWarning; 122 CairoDialog *pWarningDialog; 123 gboolean bAcknowledged; 124 } CDClockTask; 125 126 typedef struct { 127 void (*init) (GldiModuleInstance *myApplet); 128 void (*stop) (GldiModuleInstance *myApplet); 129 GList * (*get_tasks) (GldiModuleInstance *myApplet); 130 gboolean (*create_task) (CDClockTask *pTask, GldiModuleInstance *myApplet); 131 gboolean (*delete_task) (CDClockTask *pTask, GldiModuleInstance *myApplet); 132 gboolean (*update_task) (CDClockTask *pTask, GldiModuleInstance *myApplet); 133 gpointer pData; 134 } CDClockTaskBackend; 135 136 typedef enum _CDClockTextLayout 137 { 138 CD_TEXT_LAYOUT_AUTO = 0, 139 CD_TEXT_LAYOUT_1_LINE, 140 CD_TEXT_LAYOUT_2_LINES 141 } CDClockTextLayout; 142 143 struct _AppletConfig { 144 CairoDockInfoDisplay iShowDate; 145 gboolean bShowSeconds; 146 gboolean bOldStyle; 147 gboolean b24Mode; 148 CDClockTextLayout iPreferedTextLayout; 149 gboolean bUseDefaultColors; 150 double fOutlineColor[4]; 151 gint iOutlineWidth; 152 double fDateColor[3]; 153 gchar *cThemePath; 154 gchar *cNumericBackgroundImage; 155 GPtrArray *pAlarms; 156 gchar *cSetupTimeCommand; 157 /*gchar *cFont; 158 double fTextColor[4]; 159 gint iWeight; 160 gint iStyle;*/ 161 gboolean bOutlined; 162 gdouble fTextRatio; 163 gchar *cLocation; 164 gchar *cDigital; 165 gint iSmoothAnimationDuration; 166 gboolean bSetName; 167 gboolean bNormalDate; 168 gchar *cTaskMgrName; 169 GldiTextDescription textDescription; 170 } ; 171 172 struct _AppletData { 173 cairo_surface_t *pBackgroundSurface; 174 cairo_surface_t *pForegroundSurface; 175 RsvgDimensionData DimensionData; 176 RsvgDimensionData needleDimension; 177 gint iNeedleRealWidth, iNeedleRealHeight; 178 gdouble iNeedleOffsetX, iNeedleOffsetY; 179 gdouble fNeedleScale; 180 RsvgHandle *pSvgHandles[CLOCK_ELEMENTS]; 181 guint iSidUpdateClock; 182 GPid iAlarmPID; 183 gchar *cSystemLocation; 184 gint iLastCheckedMinute, iLastCheckedDay, iLastCheckedMonth, iLastCheckedYear; 185 struct tm currentTime; 186 187 cairo_surface_t *pNumericBgSurface; 188 ClockDigital pDigitalClock; 189 guint iTextLayout; 190 gdouble fDpi; 191 192 GLuint iBgTexture, iFgTexture, iHourNeedleTexture, iMinuteNeedleTexture, iSecondNeedleTexture, iDateTexture; 193 gint iNeedleWidth, iNeedleHeight; 194 gint iDateWidth, iDateHeight; 195 gint iSmoothAnimationStep; 196 197 GList *pTasks; 198 CairoDialog *pCalendarDialog; 199 GtkWidget *pTaskWindow; 200 GHashTable *pBackends; 201 CDClockTaskBackend *pBackend; 202 GtkListStore *pModel; 203 guint iButtonPressTime; 204 CDClockTask *pNextTask; 205 CDClockTask *pNextAnniversary; 206 gboolean bTaskCheckedOnce; 207 GList *pMissedTasks; 208 209 GtkWidget *pLocationEntry; 210 DBusGProxy *pProxyResuming; 211 } ; 212 213 #endif 214 215