diff options
author | Federico Mena Quintero <federico@nuclecu.unam.mx> | 1998-09-04 08:43:06 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1998-09-04 08:43:06 +0800 |
commit | 84fa00e42a593a4e4e64866090df30c9d7c066b9 (patch) | |
tree | 2c5c5f1566aad424cdc537f55cf08d8c7e3bea1d /calendar/gui/mark.c | |
parent | de704a7b4576df4f84ed859c7d3337cce0f89e57 (diff) | |
download | gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.tar gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.tar.gz gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.tar.bz2 gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.tar.lz gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.tar.xz gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.tar.zst gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.zip |
Finished with the properties dialog. You can jump to days from the year
Finished with the properties dialog. You can jump to days from the year view
now. I'm off to rewrite gnome-popupmenu and friends.
1998-09-03 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gncal-full-day.c (gncal_full_day_forall): Updated foreach ->
forall from Gtk changes, bleah.
* year-view.c (day_event): New function to handle events from
days. Jumps to the day that is clicked.
* main.c: Use a watch cursor while the previous/today/next
functions are doing their job.
* mark.c (month_item_prepare_prelight): New public utility
function to prepare a month item for prelighting. It will store
the proper prelight information and attach the appropriate signals.
(mark_current_day): Make the current day bold as well (useful for
color-blind people, I guess).
* prop.c (set_current_day): Reset the date in the sample calendar
and mark the current day.
(fake_mark_days): Mark fake events in the sample calendar.
* year-view.c (year_view_set): Use the general prelighting engine.
* goto.c (day_event): Just process button presses, as prelighting
is done behind the scenes now.
(update): Use the general prelighting engine.
* prop.c (create_colors_page): We can now configure the colors of
svn path=/trunk/; revision=361
Diffstat (limited to 'calendar/gui/mark.c')
-rw-r--r-- | calendar/gui/mark.c | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/calendar/gui/mark.c b/calendar/gui/mark.c index 6aab8b1b74..f3725bb7e5 100644 --- a/calendar/gui/mark.c +++ b/calendar/gui/mark.c @@ -61,6 +61,7 @@ mark_current_day (GnomeMonthItem *mitem) item = gnome_month_item_num2child (mitem, GNOME_MONTH_ITEM_DAY_LABEL + day_index); gnome_canvas_item_set (item, "fill_color", color_spec_from_prop (COLOR_PROP_CURRENT_DAY_FG), + "font", CURRENT_DAY_FONT, NULL); } } @@ -115,4 +116,121 @@ unmark_month_item (GnomeMonthItem *mitem) gnome_canvas_item_set (GNOME_CANVAS_ITEM (mitem), "day_color", color_spec_from_prop (COLOR_PROP_DAY_FG), NULL); + + gnome_canvas_item_set (GNOME_CANVAS_ITEM (mitem), + "day_font", NORMAL_DAY_FONT, + NULL); +} + +/* Frees the prelight information in the month item when it is destroyed */ +static void +free_prelight_info (GtkObject *object, gpointer data) +{ + g_free (gtk_object_get_data (object, "prelight_info")); +} + +/* Handles EnterNotify and LeaveNotify events from the month item's day groups, and performs + * appropriate prelighting. + */ +static gint +day_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data) +{ + GnomeCanvasItem *mitem; + GnomeCanvasItem *box; + int child_num, day; + gulong *day_pixels; + GetPrelightColorFunc func; + gpointer func_data; + char *spec; + GdkColor color; + + mitem = data; + child_num = gnome_month_item_child2num (GNOME_MONTH_ITEM (mitem), item); + day = gnome_month_item_num2day (GNOME_MONTH_ITEM (mitem), child_num); + + if (day == 0) + return FALSE; /* it was a day outside the month's range */ + + child_num -= GNOME_MONTH_ITEM_DAY_GROUP; + box = gnome_month_item_num2child (GNOME_MONTH_ITEM (mitem), GNOME_MONTH_ITEM_DAY_BOX + child_num); + + day_pixels = gtk_object_get_data (GTK_OBJECT (mitem), "prelight_info_pixels"); + func = gtk_object_get_data (GTK_OBJECT (mitem), "prelight_info_func"); + func_data = gtk_object_get_data (GTK_OBJECT (mitem), "prelight_info_data"); + + switch (event->type) { + case GDK_ENTER_NOTIFY: + spec = (* func) (func_data); + gnome_canvas_item_set (box, + "fill_color", spec, + NULL); + break; + + case GDK_LEAVE_NOTIFY: + color.pixel = day_pixels[child_num]; + gnome_canvas_item_set (box, + "fill_color_gdk", &color, + NULL); + break; + + default: + break; + } + + return FALSE; +} + +void +month_item_prepare_prelight (GnomeMonthItem *mitem, GetPrelightColorFunc func, gpointer func_data) +{ + gulong *day_pixels; + GnomeCanvasItem *day_group; + GnomeCanvasItem *box; + GtkArg arg; + GdkColor *color; + int i; + + day_pixels = gtk_object_get_data (GTK_OBJECT (mitem), "prelight_info_pixels"); + + /* Set up the buffer for day background colors and attach it to the month item, if necessary */ + + if (!day_pixels) { + /* Create the buffer and attach it */ + + day_pixels = g_new (gulong, 42); + gtk_object_set_data (GTK_OBJECT (mitem), "prelight_info_pixels", day_pixels); + gtk_object_set_data (GTK_OBJECT (mitem), "prelight_info_func", func); + gtk_object_set_data (GTK_OBJECT (mitem), "prelight_info_data", func_data); + gtk_signal_connect (GTK_OBJECT (mitem), "destroy", + (GtkSignalFunc) free_prelight_info, + NULL); + + /* Connect the appropriate signals to perform prelighting */ + + for (i = 0; i < 42; i++) { + day_group = gnome_month_item_num2child (GNOME_MONTH_ITEM (mitem), GNOME_MONTH_ITEM_DAY_GROUP + i); + gtk_signal_connect (GTK_OBJECT (day_group), "event", + (GtkSignalFunc) day_event, + mitem); + } + } + + /* Fetch the background colors from the day boxes and store them in the prelight info */ + + for (i = 0; i < 42; i++) { + box = gnome_month_item_num2child (mitem, GNOME_MONTH_ITEM_DAY_BOX + i); + + arg.name = "fill_color_gdk"; + gtk_object_getv (GTK_OBJECT (box), 1, &arg); + + color = GTK_VALUE_BOXED (arg); + day_pixels[i] = color->pixel; + g_free (color); + } +} + +char * +default_prelight_func (gpointer data) +{ + return color_spec_from_prop (COLOR_PROP_PRELIGHT_DAY_BG); } |