aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/gncal-day-view.c
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@nuclecu.unam.mx>1999-02-01 02:30:56 +0800
committerArturo Espinosa <unammx@src.gnome.org>1999-02-01 02:30:56 +0800
commit54441921320b97f80231beabcbc337382ecca6bf (patch)
treebba57c837a08bf5eaf0882ff793d54173fa4b326 /calendar/gui/gncal-day-view.c
parent2d126d6634af26d7a4db216fe8c9922932b8f1f2 (diff)
downloadgsoc2013-evolution-54441921320b97f80231beabcbc337382ecca6bf.tar
gsoc2013-evolution-54441921320b97f80231beabcbc337382ecca6bf.tar.gz
gsoc2013-evolution-54441921320b97f80231beabcbc337382ecca6bf.tar.bz2
gsoc2013-evolution-54441921320b97f80231beabcbc337382ecca6bf.tar.lz
gsoc2013-evolution-54441921320b97f80231beabcbc337382ecca6bf.tar.xz
gsoc2013-evolution-54441921320b97f80231beabcbc337382ecca6bf.tar.zst
gsoc2013-evolution-54441921320b97f80231beabcbc337382ecca6bf.zip
Improve this draw routine. Now it can split the text in lines and fit as
1999-01-30 Miguel de Icaza <miguel@nuclecu.unam.mx> * view-utils.c (view_utils_draw_events): Improve this draw routine. Now it can split the text in lines and fit as many events as possible. (nicetime): Return strings without spaces at the beginning. * gncal-day-view.c (gncal_day_view_expose): Move clip-clear operation here. svn path=/trunk/; revision=637
Diffstat (limited to 'calendar/gui/gncal-day-view.c')
-rw-r--r--calendar/gui/gncal-day-view.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/calendar/gui/gncal-day-view.c b/calendar/gui/gncal-day-view.c
index 85d61292f1..1fc59c6fef 100644
--- a/calendar/gui/gncal-day-view.c
+++ b/calendar/gui/gncal-day-view.c
@@ -250,6 +250,7 @@ gncal_day_view_expose (GtkWidget *widget, GdkEventExpose *event)
GdkRectangle rect, dest;
GdkFont *font;
int str_width;
+ GdkGC *gc;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GNCAL_IS_DAY_VIEW (widget), FALSE);
@@ -258,6 +259,7 @@ gncal_day_view_expose (GtkWidget *widget, GdkEventExpose *event)
if (!GTK_WIDGET_DRAWABLE (widget))
return FALSE;
+ gc = widget->style->fg_gc [GTK_STATE_NORMAL];
dview = GNCAL_DAY_VIEW (widget);
x1 = widget->style->klass->xthickness;
@@ -300,18 +302,16 @@ gncal_day_view_expose (GtkWidget *widget, GdkEventExpose *event)
dest.width -= 2 * TEXT_BORDER;
dest.height -= 2 * TEXT_BORDER;
- gdk_gc_set_clip_rectangle (widget->style->fg_gc[GTK_STATE_NORMAL], &dest);
+ gdk_gc_set_clip_rectangle (gc, &dest);
str_width = gdk_string_width (font, dview->day_str);
- gdk_draw_string (widget->window,
- font,
- widget->style->fg_gc[GTK_STATE_NORMAL],
+ gdk_draw_string (widget->window, font, gc,
dest.x + (dest.width - str_width) / 2,
dest.y + font->ascent,
dview->day_str);
- gdk_gc_set_clip_rectangle (widget->style->fg_gc[GTK_STATE_NORMAL], NULL);
+ gdk_gc_set_clip_rectangle (gc, NULL);
}
/* Division line */
@@ -325,21 +325,25 @@ gncal_day_view_expose (GtkWidget *widget, GdkEventExpose *event)
/* Text */
- rect.x = x1 + TEXT_BORDER;
- rect.y = y1 + 3 * TEXT_BORDER + font->ascent + font->descent + widget->style->klass->ythickness;
- rect.width = width - 2 * TEXT_BORDER;
- rect.height = height - (rect.y - y1) - TEXT_BORDER;
-
- if (gdk_rectangle_intersect (&rect, &event->area, &dest))
- view_utils_draw_events (widget,
- widget->window,
- widget->style->fg_gc[GTK_STATE_NORMAL],
- &rect,
- VIEW_UTILS_DRAW_END | VIEW_UTILS_DRAW_SPLIT,
- dview->events,
- dview->lower,
- dview->upper);
+ if (dview->events != NULL){
+ rect.x = x1 + TEXT_BORDER;
+ rect.y = y1 + 3 * TEXT_BORDER +
+ font->ascent + font->descent +
+ widget->style->klass->ythickness;
+ rect.width = width - 2 * TEXT_BORDER;
+ rect.height = height - (rect.y - y1) - TEXT_BORDER;
+
+ if (gdk_rectangle_intersect (&rect, &event->area, &dest))
+ view_utils_draw_events (
+ widget, widget->window, gc,
+ &rect,
+ VIEW_UTILS_DRAW_END | VIEW_UTILS_DRAW_SPLIT,
+ dview->events,
+ dview->lower,
+ dview->upper);
+ }
+ gdk_gc_set_clip_rectangle (gc, NULL);
return FALSE;
}