diff options
author | Damon Chaplin <damon@helixcode.com> | 2000-10-12 02:19:16 +0800 |
---|---|---|
committer | Damon Chaplin <damon@src.gnome.org> | 2000-10-12 02:19:16 +0800 |
commit | 322c0cad7043d9b4b10b7dc71cec028ad00834d9 (patch) | |
tree | afbb90d10c30799fa790d9384c543e71a768854c /calendar/gui/e-week-view.c | |
parent | c865d05f0f66f61975c69ae7acb4bc8878d3e47b (diff) | |
download | gsoc2013-evolution-322c0cad7043d9b4b10b7dc71cec028ad00834d9.tar gsoc2013-evolution-322c0cad7043d9b4b10b7dc71cec028ad00834d9.tar.gz gsoc2013-evolution-322c0cad7043d9b4b10b7dc71cec028ad00834d9.tar.bz2 gsoc2013-evolution-322c0cad7043d9b4b10b7dc71cec028ad00834d9.tar.lz gsoc2013-evolution-322c0cad7043d9b4b10b7dc71cec028ad00834d9.tar.xz gsoc2013-evolution-322c0cad7043d9b4b10b7dc71cec028ad00834d9.tar.zst gsoc2013-evolution-322c0cad7043d9b4b10b7dc71cec028ad00834d9.zip |
call calendar_config_write_on_exit() to write out some special config
2000-10-11 Damon Chaplin <damon@helixcode.com>
* gui/main.c (main): call calendar_config_write_on_exit() to write
out some special config settings (as the mail component does).
* gui/calendar-commands.c (properties_cmd): changed to use the new
preferences dialog.
(update_all_config_settings): new function to iterate over all the
calendars and update the config settings.
* gui/dialogs/cal-prefs-dialog.glade: preferences dialog.
* gui/dialogs/cal-prefs-dialog.[hc]: new files for the preferences
dialog.
* gui/calendar-config.[hc]: new files to handle loading/saving config
settings.
* cal-util/cal-recur.c: fixed bug in YEARLY when no filters were set,
plus minor changes.
* cal-util/test-recur.c: updated.
* gui/e-day-view-time-item.c:
* gui/popup-menu.c: update to #include <gal/widgets/e-gui-utils.h>
* gui/component-factory.c (owner_set_cb): called calendar_config_init.
(owner_set_cb):
(owner_unset_cb): updated the prototypes.
* gui/main.c (main): added call to calendar_config_write_on_exit().
* gui/component-factory.h:
* gui/component-factory.c (owner_set_cb): added global evolution_dir
just like the mail component, so we know we to store config stuff.
svn path=/trunk/; revision=5856
Diffstat (limited to 'calendar/gui/e-week-view.c')
-rw-r--r-- | calendar/gui/e-week-view.c | 132 |
1 files changed, 68 insertions, 64 deletions
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 33071fa4c9..ab38f92c1a 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -564,63 +564,14 @@ static void e_week_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { EWeekView *week_view; - gint width, height, time_width; gdouble old_x2, old_y2, new_x2, new_y2; - GdkFont *font; week_view = E_WEEK_VIEW (widget); - font = widget->style->font; (*GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation); e_week_view_recalc_cell_sizes (week_view); - /* Calculate the number of rows of events in each cell, for the large - cells and the compressed weekend cells. */ - if (week_view->multi_week_view) { - week_view->events_y_offset = E_WEEK_VIEW_DATE_T_PAD - + font->ascent + font->descent - + E_WEEK_VIEW_DATE_B_PAD; - } else { - week_view->events_y_offset = E_WEEK_VIEW_DATE_T_PAD - + font->ascent + font->descent - + E_WEEK_VIEW_DATE_LINE_T_PAD + 1 - + E_WEEK_VIEW_DATE_LINE_B_PAD; - } - - height = week_view->row_heights[0]; - week_view->rows_per_cell = (height * 2 - week_view->events_y_offset) - / (week_view->row_height + E_WEEK_VIEW_EVENT_Y_SPACING); - week_view->rows_per_cell = MIN (week_view->rows_per_cell, - E_WEEK_VIEW_MAX_ROWS_PER_CELL); - - week_view->rows_per_compressed_cell = - (height - week_view->events_y_offset) - / (week_view->row_height + E_WEEK_VIEW_EVENT_Y_SPACING); - week_view->rows_per_compressed_cell = MIN (week_view->rows_per_compressed_cell, - E_WEEK_VIEW_MAX_ROWS_PER_CELL); - - /* Determine which time format to use, based on the width of the cells. - We only allow the time to take up about half of the width. */ - width = week_view->col_widths[0]; - - week_view->time_format = E_WEEK_VIEW_TIME_NONE; - if (week_view->use_small_font && week_view->small_font) { - time_width = week_view->digit_width * 2 - + week_view->small_digit_width * 2; - if (width / 2 > time_width * 2 + week_view->space_width) - week_view->time_format = E_WEEK_VIEW_TIME_BOTH_SMALL_MIN; - else if (width / 2 > time_width) - week_view->time_format = E_WEEK_VIEW_TIME_START_SMALL_MIN; - } else { - time_width = week_view->digit_width * 4 - + week_view->colon_width; - if (width / 2 > time_width * 2 + week_view->space_width) - week_view->time_format = E_WEEK_VIEW_TIME_BOTH; - else if (width / 2 > time_width) - week_view->time_format = E_WEEK_VIEW_TIME_START; - } - /* Set the scroll region of the top canvas to its allocated size. */ gnome_canvas_get_scroll_region (GNOME_CANVAS (week_view->titles_canvas), NULL, NULL, &old_x2, &old_y2); @@ -652,8 +603,11 @@ e_week_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation) static void e_week_view_recalc_cell_sizes (EWeekView *week_view) { - gfloat width, height, offset; + gfloat canvas_width, canvas_height, offset; gint row, col; + GtkWidget *widget; + GdkFont *font; + gint width, height, time_width; if (week_view->multi_week_view) { week_view->rows = week_view->weeks_shown * 2; @@ -668,12 +622,12 @@ e_week_view_recalc_cell_sizes (EWeekView *week_view) number of columns, to make it easy to get the column widths. We also add one to the width so that the right border of the last column is off the edge of the displayed area. */ - width = week_view->main_canvas->allocation.width + 1; - width /= week_view->columns; + canvas_width = week_view->main_canvas->allocation.width + 1; + canvas_width /= week_view->columns; offset = 0; for (col = 0; col <= week_view->columns; col++) { week_view->col_offsets[col] = floor (offset + 0.5); - offset += width; + offset += canvas_width; } /* Calculate the cell widths based on the offsets. */ @@ -683,12 +637,12 @@ e_week_view_recalc_cell_sizes (EWeekView *week_view) } /* Now do the same for the row heights. */ - height = week_view->main_canvas->allocation.height + 1; - height /= week_view->rows; + canvas_height = week_view->main_canvas->allocation.height + 1; + canvas_height /= week_view->rows; offset = 0; for (row = 0; row <= week_view->rows; row++) { week_view->row_offsets[row] = floor (offset + 0.5); - offset += height; + offset += canvas_height; } /* Calculate the cell heights based on the offsets. */ @@ -696,6 +650,60 @@ e_week_view_recalc_cell_sizes (EWeekView *week_view) week_view->row_heights[row] = week_view->row_offsets[row + 1] - week_view->row_offsets[row]; } + + + /* If the font hasn't been set yet just return. */ + widget = GTK_WIDGET (week_view); + if (!widget->style || ! widget->style->font) + return; + + font = widget->style->font; + + /* Calculate the number of rows of events in each cell, for the large + cells and the compressed weekend cells. */ + if (week_view->multi_week_view) { + week_view->events_y_offset = E_WEEK_VIEW_DATE_T_PAD + + font->ascent + font->descent + + E_WEEK_VIEW_DATE_B_PAD; + } else { + week_view->events_y_offset = E_WEEK_VIEW_DATE_T_PAD + + font->ascent + font->descent + + E_WEEK_VIEW_DATE_LINE_T_PAD + 1 + + E_WEEK_VIEW_DATE_LINE_B_PAD; + } + + height = week_view->row_heights[0]; + week_view->rows_per_cell = (height * 2 - week_view->events_y_offset) + / (week_view->row_height + E_WEEK_VIEW_EVENT_Y_SPACING); + week_view->rows_per_cell = MIN (week_view->rows_per_cell, + E_WEEK_VIEW_MAX_ROWS_PER_CELL); + + week_view->rows_per_compressed_cell = + (height - week_view->events_y_offset) + / (week_view->row_height + E_WEEK_VIEW_EVENT_Y_SPACING); + week_view->rows_per_compressed_cell = MIN (week_view->rows_per_compressed_cell, + E_WEEK_VIEW_MAX_ROWS_PER_CELL); + + /* Determine which time format to use, based on the width of the cells. + We only allow the time to take up about half of the width. */ + width = week_view->col_widths[0]; + + week_view->time_format = E_WEEK_VIEW_TIME_NONE; + if (week_view->use_small_font && week_view->small_font) { + time_width = week_view->digit_width * 2 + + week_view->small_digit_width * 2; + if (width / 2 > time_width * 2 + week_view->space_width) + week_view->time_format = E_WEEK_VIEW_TIME_BOTH_SMALL_MIN; + else if (width / 2 > time_width) + week_view->time_format = E_WEEK_VIEW_TIME_START_SMALL_MIN; + } else { + time_width = week_view->digit_width * 4 + + week_view->colon_width; + if (width / 2 > time_width * 2 + week_view->space_width) + week_view->time_format = E_WEEK_VIEW_TIME_BOTH; + else if (width / 2 > time_width) + week_view->time_format = E_WEEK_VIEW_TIME_START; + } } @@ -1175,10 +1183,6 @@ e_week_view_recalc_day_starts (EWeekView *week_view, tmp_time = lower; week_view->day_starts[0] = tmp_time; for (day = 1; day <= num_days; day++) { - /* FIXME: There is a bug in time_add_day(). */ -#if 0 - g_print ("Day:%i - %s\n", day, ctime (&tmp_time)); -#endif tmp_time = time_add_day (tmp_time, 1); week_view->day_starts[day] = tmp_time; } @@ -1297,7 +1301,9 @@ e_week_view_set_compress_weekend (EWeekView *week_view, if (!week_view->multi_week_view) return; - /* FIXME: Need to update layout. */ + e_week_view_recalc_cell_sizes (week_view); + week_view->events_need_reshape = TRUE; + e_week_view_check_layout (week_view); } @@ -1567,7 +1573,7 @@ e_week_view_on_button_press (GtkWidget *widget, { gint x, y, day; -#if 1 +#if 0 g_print ("In e_week_view_on_button_press\n"); #endif @@ -1589,8 +1595,6 @@ e_week_view_on_button_press (GtkWidget *widget, if (week_view->pressed_event_num != -1) return FALSE; - g_print ("In e_week_view_on_button_press 2\n"); - /* Convert the mouse position to a week & day. */ x = event->x; y = event->y; |