diff options
-rw-r--r-- | calendar/ChangeLog | 34 | ||||
-rw-r--r-- | calendar/gui/e-day-view-top-item.c | 29 | ||||
-rw-r--r-- | calendar/gui/e-day-view.c | 68 | ||||
-rw-r--r-- | calendar/gui/e-week-view.c | 8 |
4 files changed, 89 insertions, 50 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index ea31eb26c6..b15c83f3ec 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,37 @@ +2003-01-26 Hans Petter Jansson <hpj@ximian.com> + + Make clicks, drags and resizes work, and pangoize remaining strings. + Fix EText placement. + + * gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event): + Use Pango. + + * gui/e-day-view.c (e_day_view_on_top_canvas_button_press): + Don't add scroll offset, it's already factored in. + (e_day_view_on_main_canvas_button_press): Ditto. + (e_day_view_on_top_canvas_motion): Ditto. + (e_day_view_on_main_canvas_motion): Ditto. + (e_day_view_reshape_long_event): Don't set the "font_gdk" property. + Its non-existence will prevent the other properties from being set as + well. + (e_day_view_reshape_day_event): Ditto. + (e_day_view_update_top_canvas_drag): Ditto. + (e_day_view_start_editing_event): ETextEventProcessor is a GObject + now. So use g_signal_stuff. + (e_day_view_check_auto_scroll): Factor out scroll offset before + checking the pointer's position relative to widget. + (e_day_view_auto_scroll_handler): Don't freeze the canvas when + scrolling - it will fail to update the canvas. If this is not + intended behaviour, it's a bug in the canvas, I think. + (e_day_view_on_main_canvas_drag_motion): Factor in the scroll offset + before checking for auto-scroll, since the function requires this. + + * gui/e-week-view.c (e_week_view_reshape_event_span): Don't set the + "font_gdk" property. Its non-existence will prevent the other + properties from being set as well. + (e_week_view_start_editing_event): ETextEventProcessor is a GObject + now. So use g_signal_stuff. + 2003-01-25 Hans Petter Jansson <hpj@ximian.com> Mainly making all views use PangoLayouts for text. When drawing a diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c index 0f7ce66124..973d326d8f 100644 --- a/calendar/gui/e-day-view-top-item.c +++ b/calendar/gui/e-day-view-top-item.c @@ -353,6 +353,7 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem, gboolean draw_start_triangle, draw_end_triangle; GdkRectangle clip_rect; GSList *categories_list, *elem; + PangoLayout *layout; day_view = dvtitem->day_view; @@ -482,16 +483,13 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem, if (display_hour < 10) time_x += day_view->digit_width; - gdk_draw_string (drawable, font, fg_gc, + layout = gtk_widget_create_pango_layout (GTK_WIDGET (day_view), buffer); + gdk_draw_layout (drawable, fg_gc, time_x, - item_y + E_DAY_VIEW_LONG_EVENT_BORDER_HEIGHT - + E_DAY_VIEW_LONG_EVENT_Y_PAD - + font->ascent - y, -#if 0 - buffer); -#else - "FIXME text"); -#endif + item_y + E_DAY_VIEW_LONG_EVENT_BORDER_HEIGHT + + E_DAY_VIEW_LONG_EVENT_Y_PAD - y, + layout); + g_object_unref (layout); gdk_gc_set_clip_rectangle (fg_gc, NULL); @@ -528,15 +526,12 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem, if (display_hour < 10) time_x += day_view->digit_width; - gdk_draw_string (drawable, font, fg_gc, + layout = gtk_widget_create_pango_layout (GTK_WIDGET (day_view), buffer); + gdk_draw_layout (drawable, fg_gc, time_x, - item_y + E_DAY_VIEW_LONG_EVENT_Y_PAD - + font->ascent + 1 - y, -#if 0 - buffer); -#else - "FIXME text"); -#endif + item_y + E_DAY_VIEW_LONG_EVENT_Y_PAD + 1 - y, + layout); + g_object_unref (layout); max_icon_x -= time_width + E_DAY_VIEW_LONG_EVENT_TIME_X_PAD; } diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index ea293d7e2c..da70dd248f 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -2989,7 +2989,7 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget, GdkEventButton *event, EDayView *day_view) { - gint event_x, event_y, scroll_x, scroll_y, day, event_num; + gint event_x, event_y, day, event_num; EDayViewPosition pos; /* Convert the coords to the main canvas window, or return if the @@ -2999,12 +2999,6 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget, &event_x, &event_y)) return FALSE; - /* The top canvas doesn't scroll, but just in case. */ - gnome_canvas_get_scroll_offsets (GNOME_CANVAS (widget), - &scroll_x, &scroll_y); - event_x += scroll_x; - event_y += scroll_y; - pos = e_day_view_convert_position_in_top_canvas (day_view, event_x, event_y, &day, &event_num); @@ -3112,7 +3106,7 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget, GdkEventButton *event, EDayView *day_view) { - gint event_x, event_y, scroll_x, scroll_y, row, day, event_num; + gint event_x, event_y, row, day, event_num; EDayViewPosition pos; #if 0 @@ -3138,11 +3132,6 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget, &event_x, &event_y)) return FALSE; - gnome_canvas_get_scroll_offsets (GNOME_CANVAS (widget), - &scroll_x, &scroll_y); - event_x += scroll_x; - event_y += scroll_y; - /* Find out where the mouse is. */ pos = e_day_view_convert_position_in_main_canvas (day_view, event_x, event_y, @@ -4396,7 +4385,7 @@ e_day_view_on_top_canvas_motion (GtkWidget *widget, { EDayViewEvent *event = NULL; EDayViewPosition pos; - gint event_x, event_y, scroll_x, scroll_y, canvas_x, canvas_y; + gint event_x, event_y, canvas_x, canvas_y; gint day, event_num; GdkCursor *cursor; @@ -4411,11 +4400,8 @@ e_day_view_on_top_canvas_motion (GtkWidget *widget, &event_x, &event_y)) return FALSE; - /* The top canvas doesn't scroll, but just in case. */ - gnome_canvas_get_scroll_offsets (GNOME_CANVAS (widget), - &scroll_x, &scroll_y); - canvas_x = event_x + scroll_x; - canvas_y = event_y + scroll_y; + canvas_x = event_x; + canvas_y = event_y; pos = e_day_view_convert_position_in_top_canvas (day_view, canvas_x, canvas_y, @@ -4496,7 +4482,7 @@ e_day_view_on_main_canvas_motion (GtkWidget *widget, { EDayViewEvent *event = NULL; EDayViewPosition pos; - gint event_x, event_y, scroll_x, scroll_y, canvas_x, canvas_y; + gint event_x, event_y, canvas_x, canvas_y; gint row, day, event_num; GdkCursor *cursor; @@ -4511,10 +4497,8 @@ e_day_view_on_main_canvas_motion (GtkWidget *widget, &event_x, &event_y)) return FALSE; - gnome_canvas_get_scroll_offsets (GNOME_CANVAS (widget), - &scroll_x, &scroll_y); - canvas_x = event_x + scroll_x; - canvas_y = event_y + scroll_y; + canvas_x = event_x; + canvas_y = event_y; pos = e_day_view_convert_position_in_main_canvas (day_view, canvas_x, canvas_y, @@ -5225,7 +5209,9 @@ e_day_view_reshape_long_event (EDayView *day_view, event->canvas_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (day_view->top_canvas)->root), e_text_get_type (), +#if 0 "font_gdk", font, +#endif "anchor", GTK_ANCHOR_NW, "clip", TRUE, "max_lines", 1, @@ -5383,7 +5369,9 @@ e_day_view_reshape_day_event (EDayView *day_view, event->canvas_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (day_view->main_canvas)->root), e_text_get_type (), +#if 0 "font_gdk", font, +#endif "anchor", GTK_ANCHOR_NW, "line_wrap", TRUE, "editable", TRUE, @@ -5999,13 +5987,13 @@ e_day_view_start_editing_event (EDayView *day_view, if (event_processor) { command.action = E_TEP_MOVE; command.position = E_TEP_END_OF_BUFFER; - gtk_signal_emit_by_name (GTK_OBJECT (event_processor), - "command", &command); + g_signal_emit_by_name (event_processor, + "command", &command); } } -/* This stops the current edit. If accept is TRUE the event summary is update, +/* This stops the current edit. If accept is TRUE the event summary is updated, else the edit is cancelled. */ static void e_day_view_stop_editing_event (EDayView *day_view) @@ -6317,6 +6305,14 @@ e_day_view_check_auto_scroll (EDayView *day_view, gint event_x, gint event_y) { + gint scroll_x, scroll_y; + + gnome_canvas_get_scroll_offsets (GNOME_CANVAS (day_view->main_canvas), + &scroll_x, &scroll_y); + + event_x -= scroll_x; + event_y -= scroll_y; + day_view->last_mouse_x = event_x; day_view->last_mouse_y = event_y; @@ -6386,12 +6382,19 @@ e_day_view_auto_scroll_handler (gpointer data) if (new_scroll_y != scroll_y) { /* NOTE: This reduces flicker, but only works if we don't use canvas items which have X windows. */ + + /* FIXME: Since GNOME 2.0 we can't do this, since the canvas + * won't update when its's thawed. Is this a bug or should we + * really be doing something else? Investigate. */ +#if 0 gtk_layout_freeze (GTK_LAYOUT (day_view->main_canvas)); +#endif gnome_canvas_scroll_to (GNOME_CANVAS (day_view->main_canvas), scroll_x, new_scroll_y); - +#if 0 gtk_layout_thaw (GTK_LAYOUT (day_view->main_canvas)); +#endif } canvas_x = day_view->last_mouse_x + scroll_x; @@ -6622,6 +6625,10 @@ e_day_view_convert_position_in_main_canvas (EDayView *day_view, gint day, row, col, event_num; gint item_x, item_y, item_w, item_h; +#if 0 + g_print ("e_day_view_convert_position_in_main_canvas: (%d, %d)\n", x, y); +#endif + *day_return = -1; *row_return = -1; if (event_num_return) @@ -6814,7 +6821,9 @@ e_day_view_update_top_canvas_drag (EDayView *day_view, font = gtk_style_get_font (gtk_widget_get_style (GTK_WIDGET (day_view))); gnome_canvas_item_set (day_view->drag_long_event_item, +#if 0 "font_gdk", font, +#endif "clip_width", item_w - (E_DAY_VIEW_LONG_EVENT_BORDER_WIDTH + E_DAY_VIEW_LONG_EVENT_X_PAD) * 2, "clip_height", item_h - (E_DAY_VIEW_LONG_EVENT_BORDER_HEIGHT + E_DAY_VIEW_LONG_EVENT_Y_PAD) * 2, NULL); @@ -6864,13 +6873,14 @@ e_day_view_on_main_canvas_drag_motion (GtkWidget *widget, gnome_canvas_get_scroll_offsets (GNOME_CANVAS (widget), &scroll_x, &scroll_y); + day_view->drag_event_x = x + scroll_x; day_view->drag_event_y = y + scroll_y; e_day_view_reshape_main_canvas_drag_item (day_view); e_day_view_reshape_main_canvas_resize_bars (day_view); - e_day_view_check_auto_scroll (day_view, x, y); + e_day_view_check_auto_scroll (day_view, day_view->drag_event_x, day_view->drag_event_y); return TRUE; } diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index e92dbab6a7..a5c8f3b656 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -2723,12 +2723,12 @@ e_week_view_reshape_event_span (EWeekView *week_view, span->text_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (week_view->main_canvas)->root), e_text_get_type (), +#if 0 "font_gdk", font, +#endif "anchor", GTK_ANCHOR_NW, "clip", TRUE, -#if 0 "max_lines", 1, -#endif "editable", TRUE, "text", text.value ? text.value : "", "use_ellipsis", TRUE, @@ -2963,8 +2963,8 @@ e_week_view_start_editing_event (EWeekView *week_view, if (event_processor) { command.action = E_TEP_MOVE; command.position = E_TEP_END_OF_BUFFER; - gtk_signal_emit_by_name (GTK_OBJECT (event_processor), - "command", &command); + g_signal_emit_by_name (event_processor, + "command", &command); } } |