From 5cd755bc7d1779f92bbce5abd3eed0eeb684fce0 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Wed, 24 Oct 2001 18:22:29 +0000 Subject: track the spacer vbox (e_meeting_time_selector_style_set): make sure the 2001-10-24 JP Rosevear * gui/e-meeting-time-sel.c (e_meeting_time_selector_construct): track the spacer vbox (e_meeting_time_selector_style_set): make sure the rows are the correct size for the style * gui/e-meeting-time-sel-item.c (e_meeting_time_selector_item_paint_day_top): slight adjustments to where the text is drawn * gui/e-meeting-time-sel.h: new member * gui/e-meeting-model.c (build_etable): ensure uniform row height * conduits/todo/todo-conduit.c (comp_from_remote_record): mark status as completed in appropriate places and don't overwrite legitimate percentages and such svn path=/trunk/; revision=13989 --- calendar/gui/e-meeting-model.c | 1 + calendar/gui/e-meeting-time-sel-item.c | 12 ++--- calendar/gui/e-meeting-time-sel.c | 84 ++++++++++++++++++++++++++++++---- calendar/gui/e-meeting-time-sel.h | 3 +- 4 files changed, 85 insertions(+), 15 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c index f787896801..24e8913431 100644 --- a/calendar/gui/e-meeting-model.c +++ b/calendar/gui/e-meeting-model.c @@ -740,6 +740,7 @@ build_etable (ETableModel *model, const gchar *spec_file, const gchar *state_fil etable = e_table_scrolled_new_from_spec_file (model, extras, spec_file, NULL); real_table = e_table_scrolled_get_table (E_TABLE_SCROLLED (etable)); + gtk_object_set (GTK_OBJECT (real_table), "uniform_row_height", TRUE, NULL); e_table_load_state (real_table, state_file); #if 0 diff --git a/calendar/gui/e-meeting-time-sel-item.c b/calendar/gui/e-meeting-time-sel-item.c index 9b6db87208..a16ed6fe52 100644 --- a/calendar/gui/e-meeting-time-sel-item.c +++ b/calendar/gui/e-meeting-time-sel-item.c @@ -488,22 +488,22 @@ e_meeting_time_selector_item_paint_day_top (EMeetingTimeSelectorItem *mts_item, clip_rect.height = mts->row_height - 2; gdk_gc_set_clip_rectangle (gc, &clip_rect); gdk_draw_string (drawable, font, gc, - x + 4, 4 + font->ascent - scroll_y, buffer); + x + 2, 4 + font->ascent - scroll_y, buffer); gdk_gc_set_clip_rectangle (gc, NULL); /* Draw the hours. */ hour = mts->first_hour_shown; - hour_x = x; + hour_x = x + 2; hour_y = mts->row_height + 4 + font->ascent - scroll_y; while (hour < mts->last_hour_shown) { if (calendar_config_get_24_hour_format ()) gdk_draw_string (drawable, font, gc, - hour_x - (mts->hour_widths[hour] / 2), - hour_y, EMeetingTimeSelectorHours[hour]); + hour_x, hour_y, + EMeetingTimeSelectorHours[hour]); else gdk_draw_string (drawable, font, gc, - hour_x - (mts->hour_widths[hour] / 2), - hour_y, EMeetingTimeSelectorHours12[hour]); + hour_x, hour_y, + EMeetingTimeSelectorHours12[hour]); hour += mts->zoomed_out ? 3 : 1; hour_x += mts->col_width; diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c index 3e293b2bcd..ebfb05857b 100644 --- a/calendar/gui/e-meeting-time-sel.c +++ b/calendar/gui/e-meeting-time-sel.c @@ -55,10 +55,13 @@ #include #include +#include #include #include #include #include +#include +#include #include #include "component-factory.h" @@ -109,6 +112,8 @@ static void e_meeting_time_selector_autopick_menu_detacher (GtkWidget *widget, GtkMenu *menu); static void e_meeting_time_selector_realize (GtkWidget *widget); static void e_meeting_time_selector_unrealize (GtkWidget *widget); +static void e_meeting_time_selector_style_set (GtkWidget *widget, + GtkStyle *previous_style); static gint e_meeting_time_selector_expose_event (GtkWidget *widget, GdkEventExpose *event); static void e_meeting_time_selector_draw (GtkWidget *widget, @@ -178,7 +183,7 @@ static EMeetingFreeBusyPeriod* e_meeting_time_selector_find_time_clash (EMeeting static void e_meeting_time_selector_recalc_grid (EMeetingTimeSelector *mts); static void e_meeting_time_selector_recalc_date_format (EMeetingTimeSelector *mts); static void e_meeting_time_selector_save_position (EMeetingTimeSelector *mts, - EMeetingTime*mtstime); + EMeetingTime *mtstime); static void e_meeting_time_selector_restore_position (EMeetingTimeSelector *mts, EMeetingTime*mtstime); static void e_meeting_time_selector_on_start_time_changed (GtkWidget *widget, @@ -242,6 +247,7 @@ e_meeting_time_selector_class_init (EMeetingTimeSelectorClass * klass) widget_class->realize = e_meeting_time_selector_realize; widget_class->unrealize = e_meeting_time_selector_unrealize; + widget_class->style_set = e_meeting_time_selector_style_set; widget_class->expose_event = e_meeting_time_selector_expose_event; widget_class->draw = e_meeting_time_selector_draw; } @@ -271,7 +277,7 @@ void e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingModel *emm) { GtkWidget *hbox, *vbox, *separator, *button, *label, *table; - GtkWidget *alignment, *child_hbox, *child_vbox, *arrow, *menuitem; + GtkWidget *alignment, *child_hbox, *arrow, *menuitem; GSList *group; GdkVisual *visual; GdkColormap *colormap; @@ -313,10 +319,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingModel *em vbox, 0, 1, 0, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (vbox); - child_vbox = gtk_vbox_new (FALSE, 0); - gtk_widget_set_usize (child_vbox, 1, mts->row_height * 2 - 6); - gtk_box_pack_start (GTK_BOX (vbox), child_vbox, FALSE, FALSE, 0); - gtk_widget_show (child_vbox); + mts->attendees_vbox_spacer = gtk_vbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), mts->attendees_vbox_spacer, FALSE, FALSE, 0); + gtk_widget_show (mts->attendees_vbox_spacer); mts->attendees_vbox = gtk_vbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), mts->attendees_vbox, TRUE, TRUE, 0); @@ -344,7 +349,7 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingModel *em gtk_box_pack_start (GTK_BOX (mts->attendees_vbox), mts->etable, TRUE, TRUE, 2); gtk_widget_show (mts->etable); g_free (filename); - + /* The free/busy information */ mts->display_top = gnome_canvas_new (); gtk_widget_set_usize (mts->display_top, -1, mts->row_height * 3); @@ -824,7 +829,6 @@ static void e_meeting_time_selector_destroy (GtkObject *object) { EMeetingTimeSelector *mts; - ETable *real_table; mts = E_MEETING_TIME_SELECTOR (object); @@ -866,6 +870,70 @@ e_meeting_time_selector_unrealize (GtkWidget *widget) (*GTK_WIDGET_CLASS (parent_class)->unrealize)(widget); } +static void +e_meeting_time_selector_style_set (GtkWidget *widget, + GtkStyle *previous_style) +{ + EMeetingTimeSelector *mts; + EMeetingTime saved_time; + ETable *real_table; + ETableHeader *eth; + GdkFont *font; + EFont *efont; + int hour, max_hour_width; + int numcols, col; + int maxheight; + + if (GTK_WIDGET_CLASS (parent_class)->style_set) + (*GTK_WIDGET_CLASS (parent_class)->style_set)(widget, previous_style); + + mts = E_MEETING_TIME_SELECTOR (widget); + font = widget->style->font; + efont = e_font_from_gdk_font (font); + + /* Calculate the widths of the hour strings in the style's font. */ + max_hour_width = 0; + for (hour = 0; hour < 24; hour++) { + if (calendar_config_get_24_hour_format ()) + mts->hour_widths[hour] = gdk_string_width (font, EMeetingTimeSelectorHours[hour]); + else + mts->hour_widths[hour] = gdk_string_width (font, EMeetingTimeSelectorHours12[hour]); + max_hour_width = MAX (max_hour_width, mts->hour_widths[hour]); + } + + /* FIXME the 5 is for the padding etable adds on */ + mts->row_height = e_font_height (efont) + 5; + mts->col_width = max_hour_width + 6; + + e_font_unref (efont); + + e_meeting_time_selector_save_position (mts, &saved_time); + e_meeting_time_selector_recalc_grid (mts); + e_meeting_time_selector_restore_position (mts, &saved_time); + + gtk_widget_set_usize (mts->display_top, -1, mts->row_height * 3); + + /* Calculate header height */ + real_table = e_table_scrolled_get_table (E_TABLE_SCROLLED (mts->etable)); + eth = real_table->full_header; + numcols = e_table_header_count (eth); + maxheight = 0; + for (col = 0; col < numcols; col++) { + ETableCol *ecol = e_table_header_get_column (eth, col); + int height; + + height = e_table_header_compute_height (ecol, widget->style, font); + + if (height > maxheight) + maxheight = height; + } + /* FIXME the 5 is for the padding etable adds on */ + gtk_widget_set_usize (mts->attendees_vbox_spacer, 1, mts->row_height * 3 - maxheight - 5); + + GTK_LAYOUT (mts->display_main)->hadjustment->step_increment = mts->col_width; + GTK_LAYOUT (mts->display_main)->vadjustment->step_increment = mts->row_height; +} + /* This draws a shadow around the top display and main display. */ static gint e_meeting_time_selector_expose_event (GtkWidget *widget, diff --git a/calendar/gui/e-meeting-time-sel.h b/calendar/gui/e-meeting-time-sel.h index 5d9911d24a..1e31d899ea 100644 --- a/calendar/gui/e-meeting-time-sel.h +++ b/calendar/gui/e-meeting-time-sel.h @@ -119,7 +119,8 @@ struct _EMeetingTimeSelector title bar packed at the end. Extra widgets can be added here with PACK_START if necessary. */ GtkWidget *attendees_vbox; - + GtkWidget *attendees_vbox_spacer; + /* The etable and model */ EMeetingModel *model; GtkWidget *etable; -- cgit v1.2.3