~ubuntu-branches/ubuntu/precise/evolution/precise

« back to all changes in this revision

Viewing changes to calendar/gui/e-day-view.h

  • Committer: Package Import Robot
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2011-09-08 09:38:57 UTC
  • mfrom: (1.1.84 upstream)
  • Revision ID: package-import@ubuntu.com-20110908093857-6lfl04ke2ns3kx2o
Tags: 3.1.91-0ubuntu1
* New upstream release. (LP: #843769)
* debian/control: bump e-d-s Build-Depends to 3.1.91. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 */
39
39
 
40
40
/* The maximum number of days shown. We use the week view for anything more
41
 
   than about 9 days. */
 
41
 * than about 9 days. */
42
42
#define E_DAY_VIEW_MAX_DAYS             10
43
43
 
44
44
/* This is used as a special code to signify a long event instead of the day
45
 
   of a normal event. */
 
45
 * of a normal event. */
46
46
#define E_DAY_VIEW_LONG_EVENT           E_DAY_VIEW_MAX_DAYS
47
47
 
48
48
/* The maximum number of columns of appointments within a day in multi-day
49
 
   view. */
 
49
 * view. */
50
50
#define E_DAY_VIEW_MULTI_DAY_MAX_COLUMNS 6
51
51
 
52
52
/* minimum width of the event in one-day view in pixels */
53
53
#define E_DAY_VIEW_MIN_DAY_COL_WIDTH    60
54
54
 
55
55
/* The width of the gap between appointments. This should be at least
56
 
   E_DAY_VIEW_BAR_WIDTH, since in the top canvas we use this space to draw
57
 
   the triangle to represent continuing events. */
 
56
 * E_DAY_VIEW_BAR_WIDTH, since in the top canvas we use this space to draw
 
57
 * the triangle to represent continuing events. */
58
58
#define E_DAY_VIEW_GAP_WIDTH            7
59
59
 
60
60
/* The width of the bars down the left of each column and appointment.
61
 
   This includes the borders on each side of it. */
 
61
 * This includes the borders on each side of it. */
62
62
#define E_DAY_VIEW_BAR_WIDTH            7
63
63
 
64
64
/* The height of the horizontal bar above & beneath the selected event.
65
 
   This includes the borders on the top and bottom. */
 
65
 * This includes the borders on the top and bottom. */
66
66
#define E_DAY_VIEW_BAR_HEIGHT           6
67
67
 
68
68
/* The size of the reminder & recurrence icons, and padding around them. */
97
97
#define E_DAY_VIEW_TOP_CANVAS_Y_GAP     2
98
98
 
99
99
/* These are used to get/set the working days in the week. The bit-flags are
100
 
   combined together. The bits must be from 0 (Sun) to 6 (Sat) to match the
101
 
   day values used by localtime etc. */
 
100
 * combined together. The bits must be from 0 (Sun) to 6 (Sat) to match the
 
101
 * day values used by localtime etc. */
102
102
typedef enum
103
103
{
104
104
        E_DAY_VIEW_SUNDAY       = 1 << 0,
111
111
} EDayViewDays;
112
112
 
113
113
/* These are used to specify the type of an appointment. They match those
114
 
   used in EMeetingTimeSelector. */
 
114
 * used in EMeetingTimeSelector. */
115
115
typedef enum
116
116
{
117
117
        E_DAY_VIEW_BUSY_TENTATIVE       = 0,
122
122
} EDayViewBusyType;
123
123
 
124
124
/* This is used to specify the format used when displaying the dates.
125
 
   The full format is like 'Thursday 12 September'. The abbreviated format is
126
 
   like 'Thu 12 Sep'. The no weekday format is like '12 Sep'. The short format
127
 
   is like '12'. The actual format used is determined in
128
 
   e_day_view_recalc_cell_sizes (), once we know the font being used. */
 
125
 * The full format is like 'Thursday 12 September'. The abbreviated format is
 
126
 * like 'Thu 12 Sep'. The no weekday format is like '12 Sep'. The short format
 
127
 * is like '12'. The actual format used is determined in
 
128
 * e_day_view_recalc_cell_sizes (), once we know the font being used. */
129
129
typedef enum
130
130
{
131
131
        E_DAY_VIEW_DATE_FULL,
172
172
        E_CALENDAR_VIEW_EVENT_FIELDS
173
173
 
174
174
        /* For events in the main canvas, this contains the start column.
175
 
           For long events in the top canvas, this is its row. */
 
175
         * For long events in the top canvas, this is its row. */
176
176
        guint8 start_row_or_col;
177
177
 
178
178
        /* For events in the main canvas, this is the number of columns that
179
 
           it covers. For long events this is set to 1 if the event is shown.
180
 
           For both types of events this is set to 0 if the event is not shown,
181
 
           i.e. it couldn't fit into the display. Currently long events are
182
 
           always shown as we just increase the height of the top canvas. */
 
179
         * it covers. For long events this is set to 1 if the event is shown.
 
180
         * For both types of events this is set to 0 if the event is not shown,
 
181
         * i.e. it couldn't fit into the display. Currently long events are
 
182
         * always shown as we just increase the height of the top canvas. */
183
183
        guint8 num_columns;
184
184
};
185
185
 
243
243
        gboolean work_week_view;
244
244
 
245
245
        /* The number of days we are showing. Usually 1 or 5, but can be up
246
 
           to E_DAY_VIEW_MAX_DAYS, e.g. when the user selects a range of
247
 
           days in the date navigator. */
 
246
         * to E_DAY_VIEW_MAX_DAYS, e.g. when the user selects a range of
 
247
         * days in the date navigator. */
248
248
        gint days_shown;
249
249
 
250
250
        /* The start of each day & an extra element to hold the last time. */
255
255
        GArray *events[E_DAY_VIEW_MAX_DAYS];
256
256
 
257
257
        /* These are set to FALSE whenever an event in the corresponding array
258
 
           is changed. Any function that needs the events sorted calls
259
 
           e_day_view_ensure_events_sorted (). */
 
258
         * is changed. Any function that needs the events sorted calls
 
259
         * e_day_view_ensure_events_sorted (). */
260
260
        gboolean long_events_sorted;
261
261
        gboolean events_sorted[E_DAY_VIEW_MAX_DAYS];
262
262
 
265
265
        gboolean need_layout[E_DAY_VIEW_MAX_DAYS];
266
266
 
267
267
        /* This is TRUE if we need to reshape the canvas items, but a full
268
 
           layout is not necessary. */
 
268
         * layout is not necessary. */
269
269
        gboolean long_events_need_reshape;
270
270
        gboolean need_reshape[E_DAY_VIEW_MAX_DAYS];
271
271
 
273
273
        gint layout_timeout_id;
274
274
 
275
275
        /* The number of rows needed, depending on the times shown and the
276
 
           minutes per row. */
 
276
         * minutes per row. */
277
277
        gint rows;
278
278
 
279
279
        /* The height of each row. */
286
286
        gint top_row_height;
287
287
 
288
288
        /* The first and last times shown in the display. The last time isn't
289
 
           included in the range. Default is 0:00-24:00 */
 
289
         * included in the range. Default is 0:00-24:00 */
290
290
        gint first_hour_shown;
291
291
        gint first_minute_shown;
292
292
        gint last_hour_shown;
304
304
        gboolean show_event_end_times;
305
305
 
306
306
        /* This is set to TRUE when the widget is created, so it scrolls to
307
 
           the start of the working day when first shown. */
 
307
         * the start of the working day when first shown. */
308
308
        gboolean scroll_to_work_day;
309
309
 
310
310
        /* This is the width & offset of each of the day columns in the
311
 
           display. */
 
311
         * display. */
312
312
        gint day_widths[E_DAY_VIEW_MAX_DAYS];
313
313
        gint day_offsets[E_DAY_VIEW_MAX_DAYS + 1];
314
314
 
315
315
        /* An array holding the number of columns in each row, in each day.
316
 
           Note that there are a maximum of 12 * 24 rows (when a row is 5 mins)
317
 
           but we don't always have that many rows. */
 
316
         * Note that there are a maximum of 12 * 24 rows (when a row is 5 mins)
 
317
         * but we don't always have that many rows. */
318
318
        guint8 cols_per_row[E_DAY_VIEW_MAX_DAYS][12 * 24];
319
319
        /* The maximum number of columns from all rows in cols_per_row */
320
320
        gint max_cols;
330
330
        EDayViewDateFormat date_format;
331
331
 
332
332
        /* These are the longest month & weekday names in the current font.
333
 
           Months are 0 to 11. Weekdays are 0 (Sun) to 6 (Sat). */
 
333
         * Months are 0 to 11. Weekdays are 0 (Sun) to 6 (Sat). */
334
334
        gint longest_month_name;
335
335
        gint longest_abbreviated_month_name;
336
336
        gint longest_weekday_name;
337
337
        gint longest_abbreviated_weekday_name;
338
338
 
339
339
        /* The large font used to display the hours. I don't think we need a
340
 
           fontset since we only display numbers. */
 
340
         * fontset since we only display numbers. */
341
341
        PangoFontDescription *large_font_desc;
342
342
        PangoFontDescription *small_font_desc;
343
343
 
375
375
        gint editing_event_num;
376
376
 
377
377
        /* This is a GnomeCanvasRect which is placed around an item while it
378
 
           is being resized, so we can raise it above all other EText items. */
 
378
         * is being resized, so we can raise it above all other EText items. */
379
379
        GnomeCanvasItem *resize_long_event_rect_item;
380
380
        GnomeCanvasItem *resize_rect_item;
381
381
        GnomeCanvasItem *resize_bar_item;
385
385
        gint popup_event_num;
386
386
 
387
387
        /* The currently selected region. If selection_start_day is -1 there is
388
 
           no current selection. If start_row or end_row is -1 then the
389
 
           selection is in the top canvas. */
 
388
         * no current selection. If start_row or end_row is -1 then the
 
389
         * selection is in the top canvas. */
390
390
        gint selection_start_day;
391
391
        gint selection_end_day;
392
392
        gint selection_start_row;
393
393
        gint selection_end_row;
394
394
 
395
395
        /* This is TRUE if the selection is currently being dragged using the
396
 
           mouse. */
 
396
         * mouse. */
397
397
        gboolean selection_is_being_dragged;
398
398
 
399
399
        /* This specifies which end of the selection is being dragged. */
400
400
        EDayViewDragPosition selection_drag_pos;
401
401
 
402
402
        /* This is TRUE if the selection is in the top canvas only (i.e. if the
403
 
           last motion event was in the top canvas). */
 
403
         * last motion event was in the top canvas). */
404
404
        gboolean selection_in_top_canvas;
405
405
 
406
406
        /* The last mouse position, relative to the main canvas window.
407
 
           Used when auto-scrolling to update the selection. */
 
407
         * Used when auto-scrolling to update the selection. */
408
408
        gint last_mouse_x;
409
409
        gint last_mouse_y;
410
410
 
428
428
        gchar *last_edited_comp_string;
429
429
 
430
430
        /* This is the event the mouse button was pressed on. If the button
431
 
           is released we start editing it, but if the mouse is dragged we set
432
 
           this to -1. */
 
431
         * is released we start editing it, but if the mouse is dragged we set
 
432
         * this to -1. */
433
433
        gint pressed_event_day;
434
434
        gint pressed_event_num;
435
435
 
436
436
        /* These are used when dragging events. If drag_event_day is not -1 we
437
 
           know that we are dragging one of the EDayView events around. */
 
437
         * know that we are dragging one of the EDayView events around. */
438
438
        gint drag_event_day;
439
439
        gint drag_event_num;
440
440
 
443
443
        gint drag_event_y;
444
444
 
445
445
        /* The offset of the mouse from the top of the event, in rows.
446
 
           In the top canvas this is the offset from the left, in days. */
 
446
         * In the top canvas this is the offset from the left, in days. */
447
447
        gint drag_event_offset;
448
448
 
449
449
        /* The last day & row dragged to, so we know when we need to update
450
 
           the dragged event's position. */
 
450
         * the dragged event's position. */
451
451
        gint drag_last_day;
452
452
        gint drag_last_row;
453
453
 
454
454
        /* This is a GnomeCanvasRect which is placed around an item while it
455
 
           is being resized, so we can raise it above all other EText items. */
 
455
         * is being resized, so we can raise it above all other EText items. */
456
456
        GnomeCanvasItem *drag_long_event_rect_item;
457
457
        GnomeCanvasItem *drag_long_event_item;
458
458
        GnomeCanvasItem *drag_rect_item;
466
466
        gint pm_string_width;
467
467
 
468
468
        /* remember last selected interval when click and restore on double click,
469
 
           if we double clicked inside that interval. */
 
469
         * if we double clicked inside that interval. */
470
470
        guint32 bc_event_time;
471
471
        time_t before_click_dtstart;
472
472
        time_t before_click_dtend;
483
483
ECalendarView *    e_day_view_new                       (ECalModel *model);
484
484
 
485
485
/* Whether we are displaying a work-week, in which case the display always
486
 
   starts on the first day of the working week. */
 
486
 * starts on the first day of the working week. */
487
487
gboolean   e_day_view_get_work_week_view        (EDayView       *day_view);
488
488
void       e_day_view_set_work_week_view        (EDayView       *day_view,
489
489
                                                 gboolean        work_week_view);
490
490
 
491
491
/* The number of days shown in the EDayView, from 1 to 7. This is normally
492
 
   either 1 or 5 (for the Work-Week view). */
 
492
 * either 1 or 5 (for the Work-Week view). */
493
493
gint       e_day_view_get_days_shown            (EDayView       *day_view);
494
494
void       e_day_view_set_days_shown            (EDayView       *day_view,
495
495
                                                 gint            days_shown);
496
496
 
497
497
/* This specifies the working days in the week. The value is a bitwise
498
 
   combination of day flags. Defaults to Mon-Fri. */
 
498
 * combination of day flags. Defaults to Mon-Fri. */
499
499
EDayViewDays e_day_view_get_working_days        (EDayView       *day_view);
500
500
void       e_day_view_set_working_days          (EDayView       *day_view,
501
501
                                                 EDayViewDays    days);
502
502
 
503
503
/* Whether we display the Marcus Bains Line in the main canvas and time
504
 
   canvas. */
 
504
 * canvas. */
505
505
void       e_day_view_marcus_bains_update       (EDayView *day_view);
506
506
gboolean   e_day_view_marcus_bains_get_show_line (EDayView *day_view);
507
507
void       e_day_view_marcus_bains_set_show_line (EDayView *day_view,