aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@nuclecu.unam.mx>1998-08-26 09:48:53 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-08-26 09:48:53 +0800
commit5d410b8d4330ea687579595b681ad91090136ea3 (patch)
treef4edecbabca9c184a42c69fda320dfa0982ad900 /calendar
parentf6f316d74484178f136664bdf5380e3ed567ae49 (diff)
downloadgsoc2013-evolution-5d410b8d4330ea687579595b681ad91090136ea3.tar
gsoc2013-evolution-5d410b8d4330ea687579595b681ad91090136ea3.tar.gz
gsoc2013-evolution-5d410b8d4330ea687579595b681ad91090136ea3.tar.bz2
gsoc2013-evolution-5d410b8d4330ea687579595b681ad91090136ea3.tar.lz
gsoc2013-evolution-5d410b8d4330ea687579595b681ad91090136ea3.tar.xz
gsoc2013-evolution-5d410b8d4330ea687579595b681ad91090136ea3.tar.zst
gsoc2013-evolution-5d410b8d4330ea687579595b681ad91090136ea3.zip
Set the heading color of the month item.
1998-08-25 Federico Mena Quintero <federico@nuclecu.unam.mx> * goto.c (create_days): Set the heading color of the month item. * main.c: Use GNOME_STOCK_PIXMAP_JUMP_TO, now that it exists, instead of goto.xpm. Also, removed goto.xpm from cvs. * gnome-month-item.h (struct _GnomeMonthItem): Added fields for the heading and day number fonts. Added fields for heading and day number label colors. * gnome-month-item.c (gnome_month_item_class_init): ARG_DAY_NAMES should be write-only. Also, added arguments for heading and day number fonts. Added arguments for heading and day number colors. svn path=/trunk/; revision=339
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog15
-rw-r--r--calendar/Makefile.am1
-rw-r--r--calendar/gnome-month-item.c199
-rw-r--r--calendar/gnome-month-item.h19
-rw-r--r--calendar/goto.c1
-rw-r--r--calendar/goto.xpm68
-rw-r--r--calendar/gui/Makefile.am1
-rw-r--r--calendar/gui/gnome-month-item.c199
-rw-r--r--calendar/gui/gnome-month-item.h19
-rw-r--r--calendar/gui/goto.c1
-rw-r--r--calendar/gui/main.c9
-rw-r--r--calendar/gui/month-view.c4
-rw-r--r--calendar/main.c9
-rw-r--r--calendar/month-view.c4
14 files changed, 449 insertions, 100 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 8854d69ab8..f0efda99f5 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,18 @@
+1998-08-25 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * goto.c (create_days): Set the heading color of the month item.
+
+ * main.c: Use GNOME_STOCK_PIXMAP_JUMP_TO, now that it exists,
+ instead of goto.xpm. Also, removed goto.xpm from cvs.
+
+ * gnome-month-item.h (struct _GnomeMonthItem): Added fields for
+ the heading and day number fonts. Added fields for heading and
+ day number label colors.
+
+ * gnome-month-item.c (gnome_month_item_class_init): ARG_DAY_NAMES
+ should be write-only. Also, added arguments for heading and day
+ number fonts. Added arguments for heading and day number colors.
+
1998-08-24 Federico Mena Quintero <federico@nuclecu.unam.mx>
* prop.c (build_two_radio_group): Doh. Set the state of the radio
diff --git a/calendar/Makefile.am b/calendar/Makefile.am
index 069609f38b..993cdf58b7 100644
--- a/calendar/Makefile.am
+++ b/calendar/Makefile.am
@@ -65,7 +65,6 @@ EXTRA_DIST = \
topic.dat \
gnome-cal.html \
bell.xpm \
- goto.xpm \
recur.xpm
diff --git a/calendar/gnome-month-item.c b/calendar/gnome-month-item.c
index 045a32d59d..308207f5a1 100644
--- a/calendar/gnome-month-item.c
+++ b/calendar/gnome-month-item.c
@@ -55,7 +55,15 @@ enum {
ARG_HEADING_HEIGHT,
ARG_HEADING_ANCHOR,
ARG_DAY_ANCHOR,
- ARG_START_ON_MONDAY
+ ARG_START_ON_MONDAY,
+ ARG_HEAD_FONT,
+ ARG_HEAD_FONT_GDK,
+ ARG_DAY_FONT,
+ ARG_DAY_FONT_GDK,
+ ARG_HEAD_COLOR,
+ ARG_HEAD_COLOR_GDK,
+ ARG_DAY_COLOR,
+ ARG_DAY_COLOR_GDK
};
@@ -115,13 +123,21 @@ gnome_month_item_class_init (GnomeMonthItemClass *class)
gtk_object_add_arg_type ("GnomeMonthItem::width", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_WIDTH);
gtk_object_add_arg_type ("GnomeMonthItem::height", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEIGHT);
gtk_object_add_arg_type ("GnomeMonthItem::anchor", GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_ANCHOR);
- gtk_object_add_arg_type ("GnomeMonthItem::head_padding", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEAD_PADDING);
+ gtk_object_add_arg_type ("GnomeMonthItem::heading_padding", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEAD_PADDING);
gtk_object_add_arg_type ("GnomeMonthItem::day_padding", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_DAY_PADDING);
- gtk_object_add_arg_type ("GnomeMonthItem::day_names", GTK_TYPE_POINTER, GTK_ARG_READABLE, ARG_DAY_NAMES);
+ gtk_object_add_arg_type ("GnomeMonthItem::day_names", GTK_TYPE_POINTER, GTK_ARG_WRITABLE, ARG_DAY_NAMES);
gtk_object_add_arg_type ("GnomeMonthItem::heading_height", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEADING_HEIGHT);
gtk_object_add_arg_type ("GnomeMonthItem::heading_anchor", GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_HEADING_ANCHOR);
gtk_object_add_arg_type ("GnomeMonthItem::day_anchor", GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_DAY_ANCHOR);
gtk_object_add_arg_type ("GnomeMonthItem::start_on_monday", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_START_ON_MONDAY);
+ gtk_object_add_arg_type ("GnomeMonthItem::heading_font", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_HEAD_FONT);
+ gtk_object_add_arg_type ("GnomeMonthItem::heading_font_gdk", GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE, ARG_HEAD_FONT_GDK);
+ gtk_object_add_arg_type ("GnomeMonthItem::day_font", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_DAY_FONT);
+ gtk_object_add_arg_type ("GnomeMonthItem::day_font_gdk", GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE, ARG_DAY_FONT_GDK);
+ gtk_object_add_arg_type ("GnomeMonthItem::heading_color", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_HEAD_COLOR);
+ gtk_object_add_arg_type ("GnomeMonthItem::heading_color_gdk", GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_HEAD_COLOR_GDK);
+ gtk_object_add_arg_type ("GnomeMonthItem::day_color", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_DAY_COLOR);
+ gtk_object_add_arg_type ("GnomeMonthItem::day_color_gdk", GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_DAY_COLOR_GDK);
object_class->destroy = gnome_month_item_destroy;
object_class->set_arg = gnome_month_item_set_arg;
@@ -274,6 +290,33 @@ reshape (GnomeMonthItem *mitem)
reshape_days (mitem);
}
+/* Sets the font for all the day headings */
+static void
+set_head_font (GnomeMonthItem *mitem)
+{
+ int i;
+
+ for (i = 0; i < 7; i++)
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i],
+ "font_gdk", mitem->head_font,
+ NULL);
+}
+
+/* Sets the color for all the day headings */
+static void
+set_head_color (GnomeMonthItem *mitem)
+{
+ int i;
+ GdkColor color;
+
+ color.pixel = mitem->head_pixel;
+
+ for (i = 0; i < 7; i++)
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i],
+ "fill_color_gdk", &color,
+ NULL);
+}
+
/* Creates the items for the day name headings */
static void
create_headings (GnomeMonthItem *mitem)
@@ -300,10 +343,11 @@ create_headings (GnomeMonthItem *mitem)
mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i] =
gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[GNOME_MONTH_ITEM_HEAD_GROUP + i]),
gnome_canvas_text_get_type (),
- "fill_color", "white",
- "font", "-adobe-helvetica-medium-r-normal--10-*-72-72-p-*-iso8859-1",
NULL);
}
+
+ set_head_font (mitem);
+ set_head_color (mitem);
}
/* Returns the number of leap years since year 1 up to (but not including) the specified year */
@@ -437,6 +481,33 @@ set_days (GnomeMonthItem *mitem)
NULL);
}
+/* Sets the font for all the day numbers */
+static void
+set_day_font (GnomeMonthItem *mitem)
+{
+ int i;
+
+ for (i = 0; i < 42; i++)
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
+ "font_gdk", mitem->day_font,
+ NULL);
+}
+
+/* Sets the color for all the day numbers */
+static void
+set_day_color (GnomeMonthItem *mitem)
+{
+ int i;
+ GdkColor color;
+
+ color.pixel = mitem->day_pixel;
+
+ for (i = 0; i < 42; i++)
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
+ "fill_color_gdk", &color,
+ NULL);
+}
+
/* Creates the items for the days */
static void
create_days (GnomeMonthItem *mitem)
@@ -464,11 +535,11 @@ create_days (GnomeMonthItem *mitem)
mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i] =
gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[GNOME_MONTH_ITEM_DAY_GROUP + i]),
gnome_canvas_text_get_type (),
- "fill_color", "black",
- "font", "-adobe-helvetica-medium-r-normal--10-*-72-72-p-*-iso8859-1",
NULL);
}
+ set_day_font (mitem);
+ set_day_color (mitem);
set_days (mitem);
}
@@ -531,6 +602,20 @@ gnome_month_item_init (GnomeMonthItem *mitem)
mitem->head_height = 14.0;
mitem->head_anchor = GTK_ANCHOR_CENTER;
mitem->day_anchor = GTK_ANCHOR_CENTER;
+
+ /* Load the default fonts */
+
+ mitem->head_font = gdk_font_load ("-*-helvetica-medium-r-normal--10-*-*-*-p-*-iso8859-1");
+ if (!mitem->head_font) {
+ mitem->head_font = gdk_font_load ("fixed");
+ g_assert (mitem->head_font != NULL);
+ }
+
+ mitem->day_font = gdk_font_load ("-adobe-helvetica-medium-r-normal--10-*-72-72-p-*-iso8859-1");
+ if (!mitem->day_font) {
+ mitem->day_font = gdk_font_load ("fixed");
+ g_assert (mitem->day_font != NULL);
+ }
}
GnomeCanvasItem *
@@ -553,9 +638,17 @@ gnome_month_item_new (GnomeCanvasGroup *parent)
void
gnome_month_item_construct (GnomeMonthItem *mitem)
{
+ GdkColor color;
+
g_return_if_fail (mitem != NULL);
g_return_if_fail (GNOME_IS_MONTH_ITEM (mitem));
+ gnome_canvas_get_color (GNOME_CANVAS_ITEM (mitem)->canvas, "#d6d6d6d6d6d6", &color);
+ mitem->head_pixel = color.pixel;
+
+ gnome_canvas_get_color (GNOME_CANVAS_ITEM (mitem)->canvas, "black", &color);
+ mitem->day_pixel = color.pixel;
+
create_items (mitem);
}
@@ -648,6 +741,7 @@ gnome_month_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
GnomeMonthItem *mitem;
char **day_names;
int i;
+ GdkColor color;
mitem = GNOME_MONTH_ITEM (object);
@@ -740,6 +834,74 @@ gnome_month_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
set_days (mitem);
break;
+ case ARG_HEAD_FONT:
+ gdk_font_unref (mitem->head_font);
+
+ mitem->head_font = gdk_font_load (GTK_VALUE_STRING (*arg));
+ if (!mitem->head_font) {
+ mitem->head_font = gdk_font_load ("fixed");
+ g_assert (mitem->head_font != NULL);
+ }
+
+ set_head_font (mitem);
+ break;
+
+ case ARG_HEAD_FONT_GDK:
+ gdk_font_unref (mitem->head_font);
+
+ mitem->head_font = GTK_VALUE_BOXED (*arg);
+ gdk_font_ref (mitem->head_font);
+ set_head_font (mitem);
+ break;
+
+ case ARG_DAY_FONT:
+ gdk_font_unref (mitem->day_font);
+
+ mitem->day_font = gdk_font_load (GTK_VALUE_STRING (*arg));
+ if (!mitem->day_font) {
+ mitem->day_font = gdk_font_load ("fixed");
+ g_assert (mitem->day_font != NULL);
+ }
+
+ set_day_font (mitem);
+ break;
+
+ case ARG_DAY_FONT_GDK:
+ gdk_font_unref (mitem->day_font);
+
+ mitem->day_font = GTK_VALUE_BOXED (*arg);
+ gdk_font_ref (mitem->day_font);
+ set_day_font (mitem);
+ break;
+
+ case ARG_HEAD_COLOR:
+ if (gnome_canvas_get_color (GNOME_CANVAS_ITEM (mitem)->canvas, GTK_VALUE_STRING (*arg), &color))
+ mitem->head_pixel = color.pixel;
+ else
+ mitem->head_pixel = 0;
+
+ set_head_color (mitem);
+ break;
+
+ case ARG_HEAD_COLOR_GDK:
+ mitem->head_pixel = ((GdkColor *) GTK_VALUE_BOXED (*arg))->pixel;
+ set_head_color (mitem);
+ break;
+
+ case ARG_DAY_COLOR:
+ if (gnome_canvas_get_color (GNOME_CANVAS_ITEM (mitem)->canvas, GTK_VALUE_STRING (*arg), &color))
+ mitem->day_pixel = color.pixel;
+ else
+ mitem->day_pixel = 0;
+
+ set_day_color (mitem);
+ break;
+
+ case ARG_DAY_COLOR_GDK:
+ mitem->day_pixel = ((GdkColor *) GTK_VALUE_BOXED (*arg))->pixel;
+ set_day_color (mitem);
+ break;
+
default:
break;
}
@@ -749,6 +911,7 @@ static void
gnome_month_item_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
GnomeMonthItem *mitem;
+ GdkColor *color;
mitem = GNOME_MONTH_ITEM (object);
@@ -805,6 +968,28 @@ gnome_month_item_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
GTK_VALUE_BOOL (*arg) = mitem->start_on_monday;
break;
+ case ARG_HEAD_FONT_GDK:
+ GTK_VALUE_BOXED (*arg) = mitem->head_font;
+ break;
+
+ case ARG_DAY_FONT_GDK:
+ GTK_VALUE_BOXED (*arg) = mitem->day_font;
+ break;
+
+ case ARG_HEAD_COLOR_GDK:
+ color = g_new (GdkColor, 1);
+ color->pixel = mitem->head_pixel;
+ gdk_color_context_query_color (GNOME_CANVAS_ITEM (mitem)->canvas->cc, color);
+ GTK_VALUE_BOXED (*arg) = color;
+ break;
+
+ case ARG_DAY_COLOR_GDK:
+ color = g_new (GdkColor, 1);
+ color->pixel = mitem->day_pixel;
+ gdk_color_context_query_color (GNOME_CANVAS_ITEM (mitem)->canvas->cc, color);
+ GTK_VALUE_BOXED (*arg) = color;
+ break;
+
default:
arg->type = GTK_TYPE_INVALID;
break;
diff --git a/calendar/gnome-month-item.h b/calendar/gnome-month-item.h
index 03ba0c84a7..405fda3702 100644
--- a/calendar/gnome-month-item.h
+++ b/calendar/gnome-month-item.h
@@ -59,13 +59,21 @@ typedef enum {
* width double RW Width of calendar in canvas units
* height double RW Height of calendar in canvas units
* anchor GtkAnchorType RW Anchor side for calendar
- * head_padding double RW Padding inside heading boxes
+ * heading_padding double RW Padding inside heading boxes
* day_padding double RW Padding inside day boxes
- * day_names char ** R Array of strings corresponding to the day names (sun-sat)
+ * day_names char ** W Array of strings corresponding to the day names (sun-sat)
* heading_height double RW Height of headings bar in canvas units
* heading_anchor GtkAnchorType RW Anchor side for headings inside heading boxes
* day_anchor GtkAnchorType RW Anchor side for day numbers inside day boxes
* start_on_monday boolean RW Specifies whether the week starts on Monday or Sunday
+ * heading_font string W X logical font descriptor for the headings
+ * heading_font_gdk GdkFont * RW Pointer to GdkFont for the headings
+ * day_font string W X logical font descriptor for the day numbers
+ * day_font_gdk GdkFont * RW Pointer to GdkFont for the day numbers
+ * heading_color string W X color specification for heading labels
+ * heading_color_gdk GdkColor * RW Pointer to an allocated GdkColor for heading labels
+ * day_color string W X color specification for day number labels
+ * day_color_gdk GdkColor * RW Pointer to an allocated GdkColor for day number labels
*/
#define GNOME_TYPE_MONTH_ITEM (gnome_month_item_get_type ())
@@ -95,12 +103,17 @@ struct _GnomeMonthItem {
double head_height; /* Height of the headings row */
GtkAnchorType head_anchor; /* Anchor side for the heading labels */
-
GtkAnchorType day_anchor; /* Anchor side for the day number labels */
GnomeCanvasItem **items; /* All the items that make up the calendar */
int day_numbers[42]; /* The numbers of the days */
+ GdkFont *head_font; /* Font for the headings */
+ GdkFont *day_font; /* Font for the day numbers */
+
+ gulong head_pixel; /* Color for heading labels */
+ gulong day_pixel; /* Color for day number labels */
+
int start_on_monday : 1; /* Start the week on Monday? If false, then start from Sunday */
};
diff --git a/calendar/goto.c b/calendar/goto.c
index db95fe0b27..c3ac3a157e 100644
--- a/calendar/goto.c
+++ b/calendar/goto.c
@@ -234,6 +234,7 @@ create_days (GtkWidget *dialog, GnomeCalendar *gcal, int day, int month, int yea
"month", month,
"year", year,
"start_on_monday", week_starts_on_monday,
+ "heading_color", "white",
NULL);
highlight_current_day (GNOME_MONTH_ITEM (mitem));
diff --git a/calendar/goto.xpm b/calendar/goto.xpm
deleted file mode 100644
index c7173b4388..0000000000
--- a/calendar/goto.xpm
+++ /dev/null
@@ -1,68 +0,0 @@
-/* XPM */
-static char * goto_xpm[] = {
-"24 24 41 1",
-" c None",
-". c #212121",
-"+ c #EAD4CB",
-"@ c #E3C5BA",
-"# c #DBB4A4",
-"$ c #EEDED7",
-"% c #FAF7F5",
-"& c #F2E5E1",
-"* c #D2AC99",
-"= c #000000",
-"- c #8D9E7C",
-"; c #CDD9C2",
-"> c #DEE6D7",
-", c #DAE2D1",
-"' c #9BAD89",
-") c #B79382",
-"! c #707D63",
-"~ c #B4C6A2",
-"{ c #ACC098",
-"] c #636E57",
-"^ c #AB8A7A",
-"/ c #E4E9DD",
-"( c #657158",
-"_ c #C49F8D",
-": c #C3D1B5",
-"< c #808F70",
-"[ c #4C5442",
-"} c #58634E",
-"| c #E6EBE0",
-"1 c #D4DDC9",
-"2 c #CAD7BE",
-"3 c #90A17F",
-"4 c #5F6A53",
-"5 c #535C49",
-"6 c #E9EDE4",
-"7 c #616D56",
-"8 c #A8BC95",
-"9 c #7C8B6E",
-"0 c #4C5443",
-"a c #B6C2AA",
-"b c #5E6953",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ... ",
-" ..+@#.. ",
-" .$%&@*. ",
-" =======+#**. ",
-" =-;>,'=###). ",
-" =!~{]=##*^. ",
-" ==/;{(]=#*_. ",
-" ==/;:{<[}=)).. ",
-" =|12{{34=5=.. ",
-" =6{{{7= == ",
-" =>890= ",
-" =a]= ",
-" =b= ",
-" = ",
-" ",
-" ",
-" ",
-" "};
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 069609f38b..993cdf58b7 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -65,7 +65,6 @@ EXTRA_DIST = \
topic.dat \
gnome-cal.html \
bell.xpm \
- goto.xpm \
recur.xpm
diff --git a/calendar/gui/gnome-month-item.c b/calendar/gui/gnome-month-item.c
index 045a32d59d..308207f5a1 100644
--- a/calendar/gui/gnome-month-item.c
+++ b/calendar/gui/gnome-month-item.c
@@ -55,7 +55,15 @@ enum {
ARG_HEADING_HEIGHT,
ARG_HEADING_ANCHOR,
ARG_DAY_ANCHOR,
- ARG_START_ON_MONDAY
+ ARG_START_ON_MONDAY,
+ ARG_HEAD_FONT,
+ ARG_HEAD_FONT_GDK,
+ ARG_DAY_FONT,
+ ARG_DAY_FONT_GDK,
+ ARG_HEAD_COLOR,
+ ARG_HEAD_COLOR_GDK,
+ ARG_DAY_COLOR,
+ ARG_DAY_COLOR_GDK
};
@@ -115,13 +123,21 @@ gnome_month_item_class_init (GnomeMonthItemClass *class)
gtk_object_add_arg_type ("GnomeMonthItem::width", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_WIDTH);
gtk_object_add_arg_type ("GnomeMonthItem::height", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEIGHT);
gtk_object_add_arg_type ("GnomeMonthItem::anchor", GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_ANCHOR);
- gtk_object_add_arg_type ("GnomeMonthItem::head_padding", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEAD_PADDING);
+ gtk_object_add_arg_type ("GnomeMonthItem::heading_padding", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEAD_PADDING);
gtk_object_add_arg_type ("GnomeMonthItem::day_padding", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_DAY_PADDING);
- gtk_object_add_arg_type ("GnomeMonthItem::day_names", GTK_TYPE_POINTER, GTK_ARG_READABLE, ARG_DAY_NAMES);
+ gtk_object_add_arg_type ("GnomeMonthItem::day_names", GTK_TYPE_POINTER, GTK_ARG_WRITABLE, ARG_DAY_NAMES);
gtk_object_add_arg_type ("GnomeMonthItem::heading_height", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEADING_HEIGHT);
gtk_object_add_arg_type ("GnomeMonthItem::heading_anchor", GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_HEADING_ANCHOR);
gtk_object_add_arg_type ("GnomeMonthItem::day_anchor", GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_DAY_ANCHOR);
gtk_object_add_arg_type ("GnomeMonthItem::start_on_monday", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_START_ON_MONDAY);
+ gtk_object_add_arg_type ("GnomeMonthItem::heading_font", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_HEAD_FONT);
+ gtk_object_add_arg_type ("GnomeMonthItem::heading_font_gdk", GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE, ARG_HEAD_FONT_GDK);
+ gtk_object_add_arg_type ("GnomeMonthItem::day_font", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_DAY_FONT);
+ gtk_object_add_arg_type ("GnomeMonthItem::day_font_gdk", GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE, ARG_DAY_FONT_GDK);
+ gtk_object_add_arg_type ("GnomeMonthItem::heading_color", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_HEAD_COLOR);
+ gtk_object_add_arg_type ("GnomeMonthItem::heading_color_gdk", GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_HEAD_COLOR_GDK);
+ gtk_object_add_arg_type ("GnomeMonthItem::day_color", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_DAY_COLOR);
+ gtk_object_add_arg_type ("GnomeMonthItem::day_color_gdk", GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_DAY_COLOR_GDK);
object_class->destroy = gnome_month_item_destroy;
object_class->set_arg = gnome_month_item_set_arg;
@@ -274,6 +290,33 @@ reshape (GnomeMonthItem *mitem)
reshape_days (mitem);
}
+/* Sets the font for all the day headings */
+static void
+set_head_font (GnomeMonthItem *mitem)
+{
+ int i;
+
+ for (i = 0; i < 7; i++)
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i],
+ "font_gdk", mitem->head_font,
+ NULL);
+}
+
+/* Sets the color for all the day headings */
+static void
+set_head_color (GnomeMonthItem *mitem)
+{
+ int i;
+ GdkColor color;
+
+ color.pixel = mitem->head_pixel;
+
+ for (i = 0; i < 7; i++)
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i],
+ "fill_color_gdk", &color,
+ NULL);
+}
+
/* Creates the items for the day name headings */
static void
create_headings (GnomeMonthItem *mitem)
@@ -300,10 +343,11 @@ create_headings (GnomeMonthItem *mitem)
mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i] =
gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[GNOME_MONTH_ITEM_HEAD_GROUP + i]),
gnome_canvas_text_get_type (),
- "fill_color", "white",
- "font", "-adobe-helvetica-medium-r-normal--10-*-72-72-p-*-iso8859-1",
NULL);
}
+
+ set_head_font (mitem);
+ set_head_color (mitem);
}
/* Returns the number of leap years since year 1 up to (but not including) the specified year */
@@ -437,6 +481,33 @@ set_days (GnomeMonthItem *mitem)
NULL);
}
+/* Sets the font for all the day numbers */
+static void
+set_day_font (GnomeMonthItem *mitem)
+{
+ int i;
+
+ for (i = 0; i < 42; i++)
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
+ "font_gdk", mitem->day_font,
+ NULL);
+}
+
+/* Sets the color for all the day numbers */
+static void
+set_day_color (GnomeMonthItem *mitem)
+{
+ int i;
+ GdkColor color;
+
+ color.pixel = mitem->day_pixel;
+
+ for (i = 0; i < 42; i++)
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
+ "fill_color_gdk", &color,
+ NULL);
+}
+
/* Creates the items for the days */
static void
create_days (GnomeMonthItem *mitem)
@@ -464,11 +535,11 @@ create_days (GnomeMonthItem *mitem)
mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i] =
gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[GNOME_MONTH_ITEM_DAY_GROUP + i]),
gnome_canvas_text_get_type (),
- "fill_color", "black",
- "font", "-adobe-helvetica-medium-r-normal--10-*-72-72-p-*-iso8859-1",
NULL);
}
+ set_day_font (mitem);
+ set_day_color (mitem);
set_days (mitem);
}
@@ -531,6 +602,20 @@ gnome_month_item_init (GnomeMonthItem *mitem)
mitem->head_height = 14.0;
mitem->head_anchor = GTK_ANCHOR_CENTER;
mitem->day_anchor = GTK_ANCHOR_CENTER;
+
+ /* Load the default fonts */
+
+ mitem->head_font = gdk_font_load ("-*-helvetica-medium-r-normal--10-*-*-*-p-*-iso8859-1");
+ if (!mitem->head_font) {
+ mitem->head_font = gdk_font_load ("fixed");
+ g_assert (mitem->head_font != NULL);
+ }
+
+ mitem->day_font = gdk_font_load ("-adobe-helvetica-medium-r-normal--10-*-72-72-p-*-iso8859-1");
+ if (!mitem->day_font) {
+ mitem->day_font = gdk_font_load ("fixed");
+ g_assert (mitem->day_font != NULL);
+ }
}
GnomeCanvasItem *
@@ -553,9 +638,17 @@ gnome_month_item_new (GnomeCanvasGroup *parent)
void
gnome_month_item_construct (GnomeMonthItem *mitem)
{
+ GdkColor color;
+
g_return_if_fail (mitem != NULL);
g_return_if_fail (GNOME_IS_MONTH_ITEM (mitem));
+ gnome_canvas_get_color (GNOME_CANVAS_ITEM (mitem)->canvas, "#d6d6d6d6d6d6", &color);
+ mitem->head_pixel = color.pixel;
+
+ gnome_canvas_get_color (GNOME_CANVAS_ITEM (mitem)->canvas, "black", &color);
+ mitem->day_pixel = color.pixel;
+
create_items (mitem);
}
@@ -648,6 +741,7 @@ gnome_month_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
GnomeMonthItem *mitem;
char **day_names;
int i;
+ GdkColor color;
mitem = GNOME_MONTH_ITEM (object);
@@ -740,6 +834,74 @@ gnome_month_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
set_days (mitem);
break;
+ case ARG_HEAD_FONT:
+ gdk_font_unref (mitem->head_font);
+
+ mitem->head_font = gdk_font_load (GTK_VALUE_STRING (*arg));
+ if (!mitem->head_font) {
+ mitem->head_font = gdk_font_load ("fixed");
+ g_assert (mitem->head_font != NULL);
+ }
+
+ set_head_font (mitem);
+ break;
+
+ case ARG_HEAD_FONT_GDK:
+ gdk_font_unref (mitem->head_font);
+
+ mitem->head_font = GTK_VALUE_BOXED (*arg);
+ gdk_font_ref (mitem->head_font);
+ set_head_font (mitem);
+ break;
+
+ case ARG_DAY_FONT:
+ gdk_font_unref (mitem->day_font);
+
+ mitem->day_font = gdk_font_load (GTK_VALUE_STRING (*arg));
+ if (!mitem->day_font) {
+ mitem->day_font = gdk_font_load ("fixed");
+ g_assert (mitem->day_font != NULL);
+ }
+
+ set_day_font (mitem);
+ break;
+
+ case ARG_DAY_FONT_GDK:
+ gdk_font_unref (mitem->day_font);
+
+ mitem->day_font = GTK_VALUE_BOXED (*arg);
+ gdk_font_ref (mitem->day_font);
+ set_day_font (mitem);
+ break;
+
+ case ARG_HEAD_COLOR:
+ if (gnome_canvas_get_color (GNOME_CANVAS_ITEM (mitem)->canvas, GTK_VALUE_STRING (*arg), &color))
+ mitem->head_pixel = color.pixel;
+ else
+ mitem->head_pixel = 0;
+
+ set_head_color (mitem);
+ break;
+
+ case ARG_HEAD_COLOR_GDK:
+ mitem->head_pixel = ((GdkColor *) GTK_VALUE_BOXED (*arg))->pixel;
+ set_head_color (mitem);
+ break;
+
+ case ARG_DAY_COLOR:
+ if (gnome_canvas_get_color (GNOME_CANVAS_ITEM (mitem)->canvas, GTK_VALUE_STRING (*arg), &color))
+ mitem->day_pixel = color.pixel;
+ else
+ mitem->day_pixel = 0;
+
+ set_day_color (mitem);
+ break;
+
+ case ARG_DAY_COLOR_GDK:
+ mitem->day_pixel = ((GdkColor *) GTK_VALUE_BOXED (*arg))->pixel;
+ set_day_color (mitem);
+ break;
+
default:
break;
}
@@ -749,6 +911,7 @@ static void
gnome_month_item_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
GnomeMonthItem *mitem;
+ GdkColor *color;
mitem = GNOME_MONTH_ITEM (object);
@@ -805,6 +968,28 @@ gnome_month_item_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
GTK_VALUE_BOOL (*arg) = mitem->start_on_monday;
break;
+ case ARG_HEAD_FONT_GDK:
+ GTK_VALUE_BOXED (*arg) = mitem->head_font;
+ break;
+
+ case ARG_DAY_FONT_GDK:
+ GTK_VALUE_BOXED (*arg) = mitem->day_font;
+ break;
+
+ case ARG_HEAD_COLOR_GDK:
+ color = g_new (GdkColor, 1);
+ color->pixel = mitem->head_pixel;
+ gdk_color_context_query_color (GNOME_CANVAS_ITEM (mitem)->canvas->cc, color);
+ GTK_VALUE_BOXED (*arg) = color;
+ break;
+
+ case ARG_DAY_COLOR_GDK:
+ color = g_new (GdkColor, 1);
+ color->pixel = mitem->day_pixel;
+ gdk_color_context_query_color (GNOME_CANVAS_ITEM (mitem)->canvas->cc, color);
+ GTK_VALUE_BOXED (*arg) = color;
+ break;
+
default:
arg->type = GTK_TYPE_INVALID;
break;
diff --git a/calendar/gui/gnome-month-item.h b/calendar/gui/gnome-month-item.h
index 03ba0c84a7..405fda3702 100644
--- a/calendar/gui/gnome-month-item.h
+++ b/calendar/gui/gnome-month-item.h
@@ -59,13 +59,21 @@ typedef enum {
* width double RW Width of calendar in canvas units
* height double RW Height of calendar in canvas units
* anchor GtkAnchorType RW Anchor side for calendar
- * head_padding double RW Padding inside heading boxes
+ * heading_padding double RW Padding inside heading boxes
* day_padding double RW Padding inside day boxes
- * day_names char ** R Array of strings corresponding to the day names (sun-sat)
+ * day_names char ** W Array of strings corresponding to the day names (sun-sat)
* heading_height double RW Height of headings bar in canvas units
* heading_anchor GtkAnchorType RW Anchor side for headings inside heading boxes
* day_anchor GtkAnchorType RW Anchor side for day numbers inside day boxes
* start_on_monday boolean RW Specifies whether the week starts on Monday or Sunday
+ * heading_font string W X logical font descriptor for the headings
+ * heading_font_gdk GdkFont * RW Pointer to GdkFont for the headings
+ * day_font string W X logical font descriptor for the day numbers
+ * day_font_gdk GdkFont * RW Pointer to GdkFont for the day numbers
+ * heading_color string W X color specification for heading labels
+ * heading_color_gdk GdkColor * RW Pointer to an allocated GdkColor for heading labels
+ * day_color string W X color specification for day number labels
+ * day_color_gdk GdkColor * RW Pointer to an allocated GdkColor for day number labels
*/
#define GNOME_TYPE_MONTH_ITEM (gnome_month_item_get_type ())
@@ -95,12 +103,17 @@ struct _GnomeMonthItem {
double head_height; /* Height of the headings row */
GtkAnchorType head_anchor; /* Anchor side for the heading labels */
-
GtkAnchorType day_anchor; /* Anchor side for the day number labels */
GnomeCanvasItem **items; /* All the items that make up the calendar */
int day_numbers[42]; /* The numbers of the days */
+ GdkFont *head_font; /* Font for the headings */
+ GdkFont *day_font; /* Font for the day numbers */
+
+ gulong head_pixel; /* Color for heading labels */
+ gulong day_pixel; /* Color for day number labels */
+
int start_on_monday : 1; /* Start the week on Monday? If false, then start from Sunday */
};
diff --git a/calendar/gui/goto.c b/calendar/gui/goto.c
index db95fe0b27..c3ac3a157e 100644
--- a/calendar/gui/goto.c
+++ b/calendar/gui/goto.c
@@ -234,6 +234,7 @@ create_days (GtkWidget *dialog, GnomeCalendar *gcal, int day, int month, int yea
"month", month,
"year", year,
"start_on_monday", week_starts_on_monday,
+ "heading_color", "white",
NULL);
highlight_current_day (GNOME_MONTH_ITEM (mitem));
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index 92b55b8172..066aac783c 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -19,10 +19,11 @@
#include "gnome-cal.h"
#include "main.h"
#include "timeutil.h"
-#include "goto.xpm"
+
#define COOKIE_USER_HOME_DIR ((char *) -1)
+
/* The username, used to set the `owner' field of the event */
char *user_name;
@@ -363,13 +364,13 @@ static GnomeUIInfo gnome_toolbar [] = {
GNOMEUIINFO_SEPARATOR,
- GNOMEUIINFO_ITEM_STOCK (N_("Prev"), N_("Go back in time"), previous_clicked, GNOME_STOCK_MENU_BACK),
+ GNOMEUIINFO_ITEM_STOCK (N_("Prev"), N_("Go back in time"), previous_clicked, GNOME_STOCK_PIXMAP_BACK),
GNOMEUIINFO_ITEM_STOCK (N_("Today"), N_("Go to present time"), today_clicked, GNOME_STOCK_PIXMAP_HOME),
- GNOMEUIINFO_ITEM_STOCK (N_("Next"), N_("Go forward in time"), next_clicked, GNOME_STOCK_MENU_FORWARD),
+ GNOMEUIINFO_ITEM_STOCK (N_("Next"), N_("Go forward in time"), next_clicked, GNOME_STOCK_PIXMAP_FORWARD),
GNOMEUIINFO_SEPARATOR,
- GNOMEUIINFO_ITEM (N_("Go to"), N_("Go to a specific date"), goto_clicked, goto_xpm),
+ GNOMEUIINFO_ITEM_STOCK (N_("Go to"), N_("Go to a specific date"), goto_clicked, GNOME_STOCK_PIXMAP_JUMP_TO),
GNOMEUIINFO_END
};
diff --git a/calendar/gui/month-view.c b/calendar/gui/month-view.c
index 0abc717366..01d4391b25 100644
--- a/calendar/gui/month-view.c
+++ b/calendar/gui/month-view.c
@@ -78,10 +78,12 @@ month_view_init (MonthView *mv)
mv->mitem = gnome_month_item_new (GNOME_CANVAS_GROUP (mv->canvas.root));
gnome_canvas_item_set (mv->mitem,
"x", 0.0,
- "y", 0.0,
"anchor", GTK_ANCHOR_NW,
"day_anchor", GTK_ANCHOR_NE,
"start_on_monday", week_starts_on_monday,
+ "heading_height", 18.0,
+ "heading_font", "-*-helvetica-bold-r-normal--12-*-*-*-*-*-iso8859-1",
+ "day_font", "-*-helvetica-bold-r-normal--14-*-*-*-*-*-iso8859-1",
NULL);
}
diff --git a/calendar/main.c b/calendar/main.c
index 92b55b8172..066aac783c 100644
--- a/calendar/main.c
+++ b/calendar/main.c
@@ -19,10 +19,11 @@
#include "gnome-cal.h"
#include "main.h"
#include "timeutil.h"
-#include "goto.xpm"
+
#define COOKIE_USER_HOME_DIR ((char *) -1)
+
/* The username, used to set the `owner' field of the event */
char *user_name;
@@ -363,13 +364,13 @@ static GnomeUIInfo gnome_toolbar [] = {
GNOMEUIINFO_SEPARATOR,
- GNOMEUIINFO_ITEM_STOCK (N_("Prev"), N_("Go back in time"), previous_clicked, GNOME_STOCK_MENU_BACK),
+ GNOMEUIINFO_ITEM_STOCK (N_("Prev"), N_("Go back in time"), previous_clicked, GNOME_STOCK_PIXMAP_BACK),
GNOMEUIINFO_ITEM_STOCK (N_("Today"), N_("Go to present time"), today_clicked, GNOME_STOCK_PIXMAP_HOME),
- GNOMEUIINFO_ITEM_STOCK (N_("Next"), N_("Go forward in time"), next_clicked, GNOME_STOCK_MENU_FORWARD),
+ GNOMEUIINFO_ITEM_STOCK (N_("Next"), N_("Go forward in time"), next_clicked, GNOME_STOCK_PIXMAP_FORWARD),
GNOMEUIINFO_SEPARATOR,
- GNOMEUIINFO_ITEM (N_("Go to"), N_("Go to a specific date"), goto_clicked, goto_xpm),
+ GNOMEUIINFO_ITEM_STOCK (N_("Go to"), N_("Go to a specific date"), goto_clicked, GNOME_STOCK_PIXMAP_JUMP_TO),
GNOMEUIINFO_END
};
diff --git a/calendar/month-view.c b/calendar/month-view.c
index 0abc717366..01d4391b25 100644
--- a/calendar/month-view.c
+++ b/calendar/month-view.c
@@ -78,10 +78,12 @@ month_view_init (MonthView *mv)
mv->mitem = gnome_month_item_new (GNOME_CANVAS_GROUP (mv->canvas.root));
gnome_canvas_item_set (mv->mitem,
"x", 0.0,
- "y", 0.0,
"anchor", GTK_ANCHOR_NW,
"day_anchor", GTK_ANCHOR_NE,
"start_on_monday", week_starts_on_monday,
+ "heading_height", 18.0,
+ "heading_font", "-*-helvetica-bold-r-normal--12-*-*-*-*-*-iso8859-1",
+ "day_font", "-*-helvetica-bold-r-normal--14-*-*-*-*-*-iso8859-1",
NULL);
}