From de704a7b4576df4f84ed859c7d3337cce0f89e57 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Thu, 3 Sep 1998 05:33:07 +0000 Subject: Today: we can now configure the colors for the monthly items, courtesy of Today: we can now configure the colors for the monthly items, courtesy of the canvas and GnomeColorPicker. Look at the preferences dialog, it is kind of nice. There are still some bugs to be fixed, nothing major. 1998-09-03 Federico Mena Quintero * prop.c (create_colors_page): We can now configure the colors of the monthly calendars! Wheeeeee! There are still some nits to be fixed, which are listed in the TODO file. (build_color_spec): New function to build color specifications. (parse_color_spec): New function to parse color specifications. * mark.c: Modified all functions to use the configured colors. * goto.c: Likewise. * main.c (colors_changed): New function that notifies all calendars that colors have changed. * gnome-cal.c (gnome_calendar_colors_changed): New function that notifies all the views that the colors have changed. * month-view.c (month_view_colors_changed): New function that notifies the month view that colors have changed. * year-view.c (year_view_colors_changed): New function that notifies the year view that colors have changed. * gnome-month-item.h (struct _GnomeMonthItem): Added fields for outline and day box colors. * gnome-month-item.c (gnome_month_item_set_arg): Added outline_color, outline_color_gdk, day_box_color, and day_box_color_gdk arguments to month items. These are convenient to quickly set the colors of the month item. (gnome_month_item_get_arg): Likewise. * main.[ch]: Added a global array of structures for color preferences. svn path=/trunk/; revision=360 --- calendar/main.h | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'calendar/main.h') diff --git a/calendar/main.h b/calendar/main.h index 6f22f946f9..5cd0d1c5c4 100644 --- a/calendar/main.h +++ b/calendar/main.h @@ -1,13 +1,36 @@ #ifndef MAIN_H #define MAIN_H -/* Global preferences */ +/* Calendar preferences */ extern int day_begin, day_end; extern char *user_name; extern int am_pm_flag; extern int week_starts_on_monday; +/* This enum and the following array define the color preferences */ + +enum { + COLOR_PROP_OUTLINE_COLOR, /* Color of calendar outline */ + COLOR_PROP_HEADING_COLOR, /* Color for headings */ + COLOR_PROP_EMPTY_DAY_BG, /* Background color for empty days */ + COLOR_PROP_MARK_DAY_BG, /* Background color for days with appointments */ + COLOR_PROP_PRELIGHT_DAY_BG, /* Background color for prelighted day */ + COLOR_PROP_DAY_FG, /* Color for day numbers */ + COLOR_PROP_CURRENT_DAY_FG, /* Color for current day's number */ + COLOR_PROP_LAST /* Number of color properties */ +}; + +struct color_prop { + int r; /* Values are in [0, 65535] */ + int g; + int b; + char *label; /* Label for properties dialog */ + char *key; /* Key for gnome_config */ +}; + +extern struct color_prop color_props[]; + /* Creates and runs the preferences dialog box */ void properties (void); @@ -16,7 +39,22 @@ void properties (void); */ void time_format_changed (void); +/* Asks for all the month items' colors to be reset */ +void colors_changed (void); + /* Creates and runs the Go-to date dialog */ void goto_dialog (GnomeCalendar *gcal); +/* Returns a pointer to a statically-allocated string with a representation of the specified color. + * Values must be in [0, 65535]. + */ +char *build_color_spec (int r, int g, int b); + +/* Parses a color specification of the form "#%04x%04x%04x" and returns the color components. */ +void parse_color_spec (char *spec, int *r, int *g, int *b); + +/* Calls build_color_spec() for the color in the specified property number */ +char *color_spec_from_prop (int propnum); + + #endif -- cgit