1 /*---------------------------------------------------------------------------- 2 -- 3 -- Module: xtmSchedPriv 4 -- 5 -- Project: Xdiary 6 -- System: xtm - X Desktop Calendar 7 -- Subsystem: <> 8 -- Function block: <> 9 -- 10 -- Description: 11 -- Private data for the xtmSchedule module(s). 12 -- 13 -- Filename: xtmSchedPriv.h 14 -- 15 -- Authors: Roger Larsson, Ulrika Bornetun 16 -- Creation date: 1992-04-04 17 -- 18 -- 19 -- (C) Copyright Ulrika Bornetun, Roger Larsson (1995) 20 -- All rights reserved 21 -- 22 -- Permission to use, copy, modify, and distribute this software and its 23 -- documentation for any purpose and without fee is hereby granted, 24 -- provided that the above copyright notice appear in all copies. Ulrika 25 -- Bornetun and Roger Larsson make no representations about the usability 26 -- of this software for any purpose. It is provided "as is" without express 27 -- or implied warranty. 28 ----------------------------------------------------------------------------*/ 29 30 /* SCCS module identifier. */ 31 /* SCCSID = @(#) Module: xtmSchedPriv.h, Version: 1.1, Date: 95/02/18 15:52:45 */ 32 33 34 /* Only include this module once. */ 35 #ifndef define_xtmSchedPriv_h 36 # define define_xtmSchedPriv_h 37 38 39 /*---------------------------------------------------------------------------- 40 -- Include files 41 ----------------------------------------------------------------------------*/ 42 43 #include "TimDate.h" 44 45 #include "xtmGlobal.h" 46 #include "xtmDbFilter.h" 47 #include "xtmDbInclude.h" 48 #include "xtmDbTools.h" 49 #include "xtmEditEntry.h" 50 #include "xtmNavCal.h" 51 #include "xtmOpenView.h" 52 #include "xtmPlan.h" 53 #include "xtmPrEntries.h" 54 #include "xtmRemote.h" 55 #include "xtmSelHidden.h" 56 #include "xtmShowToDo.h" 57 #include "xtmSchedMain.h" 58 59 60 /*---------------------------------------------------------------------------- 61 -- Macro definitions 62 ----------------------------------------------------------------------------*/ 63 64 /* Internal animation flags. */ 65 #define ANI_MOVE_COPY (1<<0) 66 #define ANI_NEW_ENTRY (1<<1) 67 #define ANI_NEW_DURATION (1<<2) 68 #define ANI_NEW_ENTRY (1<<1) 69 70 #define ANI_NOTE (1<<6) 71 #define ANI_ENTRY (1<<7) 72 #define ANI_TIME (1<<8) 73 74 #define ANI_FIXED (1<<10) 75 #define ANI_RUBBERBAND (1<<11) 76 #define ANI_FIXED_HEIGHT (1<<12) 77 #define ANI_FIXED_WIDTH (1<<13) 78 #define ANI_PICK_DAY (1<<14) 79 80 #define ANI_STARTED (1<<16) 81 82 83 /*---------------------------------------------------------------------------- 84 -- Type declarations 85 ----------------------------------------------------------------------------*/ 86 87 /* The different scale values. */ 88 typedef enum { 89 SCHED_DISP_DAYS, 90 SCHED_DAY_WIDTH 91 } SCHED_SCALE_TYPE; 92 93 /* States for the entry cache. */ 94 typedef enum { 95 IS_CACHED, 96 IS_EMPTY, 97 IS_NEW, 98 IS_USED 99 } CACHE_STATE; 100 101 102 /* Forward declaration. */ 103 typedef struct sched_rec *SCHED_REC_REF; 104 105 /* Callback when the animation ends. */ 106 typedef void ( *ANIMATION_ACTION_CB ) ( SCHED_REC_REF, XEvent * ); 107 108 /* Callback when for entry popup menu. */ 109 typedef void ( *ENTRY_POPUP_CB ) ( Widget, SCHED_REC_REF, XEvent * ); 110 111 112 /* Record to use when we do animation. */ 113 typedef struct { 114 115 /* Are we doing animation? */ 116 Boolean animate_on; 117 118 /* Display the time when we move the entry? */ 119 Boolean display_time; 120 121 /* Flags for the animation. */ 122 UINT32 flags; 123 124 /* Positions for the rectangle to move. */ 125 int start_x; 126 int start_y; 127 int end_x; 128 int end_y; 129 int width; 130 int height; 131 132 /* Grid to use when doing animation. */ 133 float grid_minutes; 134 135 /* Animation widgets. */ 136 Widget animateW; 137 Widget aniEntryW; 138 Widget aniNoteW; 139 Widget aniTimeW; 140 141 /* Things to do when the animation ends. */ 142 ANIMATION_ACTION_CB actionCB; 143 144 /* Start and entry time of entry while moving around. */ 145 TIM_TIME_REF start_date; 146 TIM_TIME_REF start_time; 147 int duration; 148 149 TIM_TIME_REF old_start_date; 150 TIM_TIME_REF old_start_time; 151 int old_duration; 152 153 } ANIMATE_REC, *ANIMATE_REC_REF; 154 155 156 /* Information about one entry in the schedule. */ 157 typedef struct { 158 Boolean found; 159 Boolean selected; 160 int duration; 161 int uid; 162 UINT32 flags; 163 UINT32 id; 164 char db_name[ XTM_GL_MAX_CAL_NAME + 1 ]; 165 char *entry_text; 166 Widget noteW; 167 Widget appW; 168 Widget appMarkW; 169 CACHE_STATE cache_state; 170 TIM_TIME_REF date_stamp; 171 TIM_TIME_REF time_stamp; 172 XTM_DB_ENTRY_TYPE type; 173 XTM_DB_ENTRY_CATEGORY category; 174 } ENTRY_INFO, *ENTRY_INFO_REF; 175 176 177 /* Cache for entries in the schedule. */ 178 typedef struct { 179 int max_used; 180 ENTRY_INFO_REF *used; 181 } ENTRY_CACHE, *ENTRY_CACHE_REF; 182 183 184 /* Basic data structure for the XDschedule appliaction. */ 185 typedef struct sched_rec { 186 187 /* Force update of the schedule. */ 188 Boolean force_update; 189 190 /* Counter to use when removing/creating widgets. */ 191 int counter; 192 193 /* Selected day. */ 194 int day_selected; 195 196 /* Delta in minutes between time ticks. */ 197 int entry_delta; 198 int old_entry_delta; 199 200 /* Number of days to display in the schedule. */ 201 int show_no_days; 202 203 /* Various flags to use. */ 204 UINT32 flags; 205 206 /* Id to use for update functions. */ 207 UINT32 update_id; 208 209 /* We are working on this database. */ 210 char db_name[ XTM_GL_MAX_CAL_NAME + 1 ]; 211 212 /* Name of database to use at startup. */ 213 char *startup_db; 214 215 /* Width of a single day name in header. */ 216 Dimension day_width; 217 218 /* Height of the time label. */ 219 Dimension time_label_height; 220 221 /* Height of a single line in the time label. */ 222 Dimension time_line_height; 223 224 /* Original background color for unselected entry. */ 225 Pixel entry_saved_bg; 226 227 /* Animation pixmaps. */ 228 int tick_pixmap_index; 229 Pixmap tick_pixmap[ 7 ]; 230 231 /* Popup widget (and callback to call) in the day view. */ 232 Widget entry_popupW; 233 Widget entry_text_popupW; 234 ENTRY_POPUP_CB entryAnimateHookCB; 235 236 /* Save a selected entry here. */ 237 Widget selected_widget; 238 239 /* Schedule window. */ 240 Widget scheduleW; 241 242 /* Animation data. */ 243 ANIMATE_REC_REF animate_ref; 244 245 /* Cache for entries. */ 246 ENTRY_CACHE_REF entry_cache_ref; 247 248 /* Display schedule from this date. */ 249 TIM_TIME_REF schedule_start; 250 TIM_TIME_REF old_schedule_start; 251 252 /* Display schedule to this date. */ 253 TIM_TIME_REF schedule_stop; 254 TIM_TIME_REF old_schedule_stop; 255 256 /* Start display at this time. */ 257 TIM_TIME_REF entry_start; 258 TIM_TIME_REF old_entry_start; 259 260 /* Stop display at this time. */ 261 TIM_TIME_REF entry_stop; 262 TIM_TIME_REF old_entry_stop; 263 264 /* Include handle. */ 265 XTM_DI_HANDLE include_handle; 266 267 /* Filter record. */ 268 XTM_DM_FILTER_REC filter_rec; 269 270 /* Appointment editor reference. */ 271 XTM_ED_HANDLE editor_handle; 272 273 /* Filter handle. */ 274 XTM_FI_HANDLE filter_handle; 275 276 /* Select hidden entries. */ 277 XTM_SH_HANDLE sel_hide_handle; 278 279 /* Application wide resources. */ 280 XTM_GL_BASE_DATA_REF appl_data_ref; 281 282 /* Calendar reference. */ 283 XTM_NC_HANDLE nav_cal_handle; 284 285 /* Open view handle. */ 286 XTM_OV_HANDLE open_handle; 287 288 /* Planner handle. */ 289 XTM_PL_HANDLE planner_handle; 290 291 /* Printer reference. */ 292 XTM_PR_HANDLE pr_handle; 293 294 /* Remote up/download. */ 295 XTM_RT_HANDLE remote_handle; 296 297 /* Summary reference. */ 298 XTM_SD_HANDLE show_handle; 299 300 /* Callback to inform our creator of specific actions. */ 301 void *user_data; 302 XTM_SM_ACTION_CB actionCB; 303 304 } SCHED_REC; 305 306 307 /*---------------------------------------------------------------------------- 308 -- Global definitions 309 ----------------------------------------------------------------------------*/ 310 311 312 /*---------------------------------------------------------------------------- 313 -- Function prototypes 314 ----------------------------------------------------------------------------*/ 315 316 317 #endif 318