diff options
author | nobody <nobody@localhost> | 2003-04-02 01:15:53 +0800 |
---|---|---|
committer | nobody <nobody@localhost> | 2003-04-02 01:15:53 +0800 |
commit | 2e5b2bbb530b642dda56b332cfd93810ac415098 (patch) | |
tree | e2b63c11a404a5dd99d407c989c8846fd0d5379d /widgets/misc | |
parent | 5cda225087bfdc66e19edb703689e8af655e171c (diff) | |
download | gsoc2013-evolution-2e5b2bbb530b642dda56b332cfd93810ac415098.tar gsoc2013-evolution-2e5b2bbb530b642dda56b332cfd93810ac415098.tar.gz gsoc2013-evolution-2e5b2bbb530b642dda56b332cfd93810ac415098.tar.bz2 gsoc2013-evolution-2e5b2bbb530b642dda56b332cfd93810ac415098.tar.lz gsoc2013-evolution-2e5b2bbb530b642dda56b332cfd93810ac415098.tar.xz gsoc2013-evolution-2e5b2bbb530b642dda56b332cfd93810ac415098.tar.zst gsoc2013-evolution-2e5b2bbb530b642dda56b332cfd93810ac415098.zip |
This commit was manufactured by cvs2svn to create tagEVOLUTION_1_2_4
'EVOLUTION_1_2_4'.
svn path=/tags/EVOLUTION_1_2_4/; revision=20614
Diffstat (limited to 'widgets/misc')
49 files changed, 187 insertions, 11465 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index b86d9c8943..b2b9325d1a 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,396 +1,17 @@ -2003-03-30 Hans Petter Jansson <hpj@ximian.com> +2003-01-24 Kjartan Maraas <kmaraas@gnome.org> - * e-calendar-item.c (e_calendar_item_destroy): Handle multiple - destroys. - -2003-03-28 JP Rosevear <jpr@ximian.com> - - * e-search-bar.c (clear_search): set the sub item to the default - as well - -2003-03-25 Dan Winship <danw@ximian.com> - - * e-calendar.c: #include gtkarrow.h - * e-combo-button.c: Likewise - - * e-charset-picker.c: Update for e_notice move - -2003-03-19 Jeffrey Stedfast <fejj@ximian.com> - - * e-filter-bar.c: Updated to use GtkDialog instead of - GnomeDialog. Also fixed bug #39550 while I was at it. - -2003-03-10 Rodney Dawes <dobey@ximian.com> - - * e-calendar.c: Use GtkArrow instead of pixmaps - * e-combo-button.c: Use GtkArrow instead of pixmaps - * e-filter-bar.c: gtk_window_set_policy () is deprecated - * e-url-entry.c: Load the icon in a pixbuf instead of GdkPixmap + * *.h: Remove #include <config.h>. Should be in .c files only. -2003-03-06 Ettore Perazzoli <ettore@ximian.com> - - * e-url-entry.c (destroy): Removed unused variable. - -2003-03-06 Ettore Perazzoli <ettore@ximian.com> - - * e-dropdown-button.c (menu_deactivate_cb): Removed debugging - spew. - -2003-02-27 Chris Toshok <toshok@ximian.com> - - * e-url-entry.c (destroy): guard this so we don't try to free priv - multiple times. - -2003-02-25 Dan Winship <danw@ximian.com> - - * e-map.c (e_map_destroy): Use - g_signal_handlers_disconnect_by_func since - gtk_signal_disconnect_by_data doesn't seem to work right. - (e_map_set_scroll_adjustments): Likewise. - -2003-02-25 Jeffrey Stedfast <fejj@ximian.com> - - * e-dateedit.c (on_date_popup_date_selected): Same as below. - - * e-cell-date-edit.c (e_cell_date_edit_on_ok_clicked): Also - updated to use the new GDate API from glib 2.0 - - * test-calendar.c (on_selection_changed): Fixed to use glib 2.0's - GDate API. - - * e-calendar-item.c (e_calendar_item_get_week_number): Port to - glib 2.0's GDate API. - (e_calendar_item_set_selection): Same. - - * e-search-bar.c (append_xml_menu_item): Use - g_string_append_printf instead of g_string_sprintfa since the - latter is now deprecated. - (setup_bonobo_menus): Same. - - * e-filter-bar.c (do_advanced): Use gtk_window_set_resizable() - - * e-charset-picker.c: Fixes to make it build cleanly with - -DG_DISABLE_DEPRECATED - (add_charset): Escape _'s so we don't get underline weirdness due - to GtkLabel thinking the _ means to underline the next char. - (e_charset_picker_bonobo_ui_populate): Same here. - -2003-02-20 Dan Winship <danw@ximian.com> - - * Makefile.am: Make libemiscwidgets and libefilterbar dynamic - libraries instead of static so they can be portably linked into - the shlib components - -2003-02-05 Dan Winship <danw@ximian.com> - - * Makefile.am (INCLUDES): Define MAP_DIR in terms of $(imagesdir). - (widgetsincludedir): Define in terms of $(privincludedir) - -2003-02-02 Hans Petter Jansson <hpj@ximian.com> - - * e-calendar-item.[ch]: Use Pango to draw. - (e_calendar_item_class_init): Add font_desc and week_number_font_desc - args. - (e_calendar_item_get_arg): Ditto. - (e_calendar_item_set_arg): Ditto. - (e_calendar_item_draw_month): Use Pango. - (e_calendar_item_draw_day_numbers): Ditto. - - * e-calendar.c: Use Pango to draw. Specify just the size of the small - font to use, instead of all aspects of it. - (e_calendar_init): Produce the small font description and pass it to - the ECalendarItem. - -2003-02-01 Hans Petter Jansson <hpj@ximian.com> - - * e-dateedit.c (create_children): Don't request combo boxes that are - 0 pixels tall. - (position_date_popup): Make this work when the button doesn't have - its own window. - -2003-01-26 Chris Toshok <toshok@ximian.com> - - * e-clipped-label.c (e_clipped_label_new): init the layout to - NULL. - -2003-01-23 Ettore Perazzoli <ettore@ximian.com> - - * e-title-bar.c (e_title_bar_construct): Make the label bold using - the new args to e_clipped_label_new(). - - * e-clipped-label.c (build_layout): Honor ->font_size and ->layout - in the newly created PangoLayout. - (e_clipped_label_new): New args font_weight, font_size. - (e_clipped_label_size_request): Removed unused variables. - (e_clipped_label_expose): Likewise. - (e_clipped_label_expose): Likewise. - (e_clipped_label_set_text): Likewise. - (e_clipped_label_recalc_chars_displayed): Likewise. - - * e-clipped-label.h (struct _EClippedLabel): Add font_size, layout - members. - -2003-01-22 Ettore Perazzoli <ettore@ximian.com> +2002-11-26 Ettore Perazzoli <ettore@ximian.com> - * Makefile.am (widgetsincludedir): Version using $(BASE_VERSION). + * e-multi-config-dialog.c (impl_destroy): Unref the + list_e_table_model. -2003-01-14 Ettore Perazzoli <ettore@ximian.com> +2002-11-04 JP Rosevear <jpr@ximian.com> - * e-multi-config-dialog.c (init): Change dialog from - OK/Apply/Cancel to Apply/Close/OK to be closer to the HIG. - -2003-01-14 Ettore Perazzoli <ettore@ximian.com> - - * Makefile.am (widgetsinclude_HEADERS): Ooops, remove - e-bonobo-widget.h. - (libemiscwidgets_a_SOURCES): Likewise, remove e-bonobo-widget.c. - -2003-01-14 Ettore Perazzoli <ettore@ximian.com> - - * Makefile.am (EXTRA_DIST): e-util-marshal.list, not - e-book-marshal.list. - (widgetsinclude_HEADERS): Add e-bonobo-widget.h. - (libemiscwidgets_a_SOURCES): Add e-bonobo-widget.c. - -2003-01-08 Ettore Perazzoli <ettore@ximian.com> - - * Makefile.am: Images are now in $(datadir)/evolution/images - instead of $(datadir)/images/evolution. - -2002-12-10 Not Zed <NotZed@Ximian.com> - - * e-multi-config-dialog.c (impl_response): Removed the - g_assert_not_reached(). If you hit the close button on your - window it would abort, treat same as close. - -2002-12-09 Chris Toshok <toshok@ximian.com> - - * e-clipped-label.[ch]: rework this to be faster and deal more - correctly with the ellipsis. - -2002-12-03 Not Zed <NotZed@Ximian.com> - - * e-search-bar.c (impl_dispose): dispose can be run multiple times - too ... bloody gobject crap. - -2002-11-27 Not Zed <NotZed@Ximian.com> - - * e-charset-picker.c: Add include of gnome-dialog.h - - * *.[ch]: ran fix.sh script over everything. - -2002-11-26 Not Zed <NotZed@Ximian.com> - - * e-combo-button.c (impl_button_press_event): Dont grab_add - anymore on the button, gtk_button is changed in gtk2 not to do - this anymore. - -2002-11-15 Chris Toshok <toshok@ximian.com> - - * e-clipped-label.c (build_layout): new function, build pango - layout for string. - (e_clipped_label_size_request): pango-ize this, make the size - requested dependent on the label. - (e_clipped_label_expose): pango-ize this. - (e_clipped_label_recalc_chars_displayed): pango-ize this. - -2002-11-14 Ettore Perazzoli <ettore@ximian.com> - - * e-clipped-label.c (e_clipped_label_finalize): New. - (e_clipped_label_destroy): Removed. - - * e-title-bar.c (destroy): Removed. - (impl_finalize): New. - (class_init): Install GObject::finalize handler instead of - GtkObject::destroy handler. - -2002-11-14 Ettore Perazzoli <ettore@ximian.com> - - * e-filter-bar.c: Changed to use g_object_*() and g_signal_*() - functions instead of gtk_object_*() and gtk_signal_*(). - (destroy): Removed. - (dispose): New. - (class_init): Install GObject::dispose handler instead of - GtkObject::destroy handler. - -2002-11-11 Chris Toshok <toshok@ximian.com> - - * e-dateedit.[ch]: port to GObject. - -2002-11-11 Ettore Perazzoli <ettore@ximian.com> - - * e-multi-config-dialog.c (init): Use GObject functions instead of - GtkObject throughout. - -2002-11-11 Ettore Perazzoli <ettore@ximian.com> - - * e-multi-config-dialog.c (impl_destroy): Removed. - (impl_finalize): New. - (class_init): Override GObject::finalize, not GtkObject::destroy. - - * e-config-page.c (impl_destroy): Removed. - (impl_finalize): New. - (class_init): Override GObject::finalize, not GtkObject::destroy. - - * e-multi-config-dialog.c: Converted to a GtkDialog subclass - [instead of GnomeDialog]. - -2002-11-07 JP Rosevear <jpr@ximian.com> - - * e-filter-bar.c: include gnome-dialog.h - -2002-11-06 Chris Toshok <toshok@ximian.com> - - * .cvsignore: ignore the generated marshal source. - - * Makefile.am: add marshal stuff. - - * e-util-marshal.list: marshaller list. - - * e-search-bar.[ch]: gobjectify this. - -2002-11-04 Ettore Perazzoli <ettore@ximian.com> - - * e-combo-button.c (impl_expose_event): Use - gtk_container_propagate_expose(). - -2002-11-01 Ettore Perazzoli <ettore@ximian.com> - - * test-title-bar.c: #include <libgnomeui/gnome-ui-init.h> instead - of <libgnomeui/gnome-init.h>. - (main): Use a GtkLabel, not a GtkText. - - * test-dropdown-button.c: #include <libgnomeui/gnome-ui-init.h> - instead of <libgnomeui/gnome-init.h>, and - <libgnomeui/gnome-stock-icons.h> instead of - <libgnomeui/gnome-stock.h>. - - * test-dateedit.c: #include <libgnomeui/gnome-ui-init.h> instead - of <libgnomeui/gnome-init.h>. - (main): Use gnome_program_init(). - - * test-calendar.c: #include <libgnomeui/gnome-ui-init.h>. - - * e-url-entry.c (button_clicked_cb): Pass NULL as the error arg to - gnome_url_show(). - - * e-title-bar.c (class_init): GTK2-ified. Use GTK_TYPE_POINTER - instead of GTK_TYPE_GDK_EVENT. - - * e-search-bar.c: Removed #include <libgnome/gnome-defs.h>. - #include <string.h>. - (class_init): GTK2-ified. - (e_search_bar_set_menu): Use GTK_OBJECT_GET_CLASS. - (e_search_bar_set_option): Likewise. - - * e-messagebox.c (e_message_box_class_init): Updated to put - finalize in GObjectClass intead of GtkObjectClass. - (e_message_box_finalize): Likewise. - (e_message_box_construct): Just check if pixmap is NULL, instead - of pixmap->pixmap. - - * e-messagebox.h: No {BEGIN,END}_GNOME_DECLS. - (e_message_box_get_type): Fix prototype, should return GtkType - instead of guint. - - * e-map.c: Removed e_map_signals, which was unused. - (e_map_finalize): Update for the fact that finalize is now in - GObjectClass. - (e_map_class_init): Likewise. Also GTK2-ify. - (e_map_draw): Removed. - (load_map_background): Pass NULL as the gdk_pixbuf_new_from_file() - error arg. - - * e-dropdown-button.c (menu_position_cb): Added arg push_in. - - * e-dateedit.c (e_date_edit_class_init): GTK2-ified. - (e_date_edit_show_date_popup): Constify local variable. - (e_date_edit_check_date_changed): Likewise. - (e_date_edit_check_time_changed): Likewise. - (e_date_edit_check_date_changed): Likewise. - (field_set_to_none): Constify arg text. - (e_date_edit_parse_date): Constify arg date_text. - (e_date_edit_parse_time): Constify arg time_text. - - * e-dateedit.h: No {BEGIN,END}_GNOME_DECLS. - - * e-combo-button.c (menu_position_func): New arg push_in. - (impl_draw): Removed. - (class_init): GTK2-ified. - (init): style->xthickness instead of style->klass->xthickness. - - * e-config-page.c (class_init): GTK2-ified. - - * e-clipped-label.c (e_clipped_label_size_request): Use - gtk_style_get_font(). - (e_clipped_label_recalc_chars_displayed): Likewise. - (e_clipped_label_expose): Likewise. - - * e-charset-picker.c: No #include <libgnome/gnome-defs.h> or - <libgnome/gnome-i18n.h> or <libgnome/gnome-stock.h>. Also no - <gal/gunicode.h>. On the other hand, #include <gtk/gtkvbox.h>. - (e_charset_picker_new): Make locale_charset const. - (e_charset_picker_bonobo_ui_populate): Make locale_charset const. - - * e-cell-percent.c: #include <stdio.h> for sscanf(). - - * e-cell-percent.h: Removed BEGIN_GNOME_DECLS, END_GNOME_DECLS. - - * e-cell-percent.c: Do not #include <libgnomeui/gnome-stock.h>. - - * e-cell-date-edit.c: Do not #include <libgnomeui/gnome-stock.h>. - Added a bunch of #includes for GTK stuff. - (e_cell_date_edit_on_ok_clicked): Constified variable. - - * e-calendar-item.c: Do not #include <libgnome/gnome-defs.h>. - (e_calendar_item_class_init): Use GTK_TYPE_POINTER instead of - GTK_TYPE_GDK_POINTER. - (e_calendar_item_class_init): GTK_CLASS_TYPE() instead of - object_class->type. - (e_calendar_item_class_init): No gtk_object_class_add_signals(). - (e_calendar_item_update): style->[xy]thickness instead of - style->klass->[xy]thickness. - (e_calendar_item_draw): Likewise. - (e_calendar_item_draw_month): Likewise. - (e_calendar_item_draw_month): Likewise. - (e_calendar_item_recalc_sizes): Likewise. - (e_calendar_item_convert_position_to_day): Likewise. - (e_calendar_item_update): Use gtk_style_get_font(). - (e_calendar_item_draw_month): Likewise. - (e_calendar_item_draw_day_numbers): Likewise. - (e_calendar_item_convert_position_to_day): Likewise. - (e_calendar_item_recalc_sizes): Likewise. - (e_calendar_item_signal_emission_idle_cb): Removed check for - GTK_OBJECT_DESTROY. - (e_calendar_item_position_menu): Add push_in arg. - - * e-calendar.c (e_calendar_draw): Remove. - (e_calendar_size_request): style->[xy]thickness instead of - style->klass->[xy]thickness. - (e_calendar_size_allocate): Likewise. - (e_calendar_get_border_size): Likewise. - (e_calendar_size_allocate): Get font from style with - gtk_style_get_font(). - - * e-calendar-item.h: #include <libgnomecanvas/gnome-canvas.h> - instead of <libgnomeui/gnome-canvas.h>. - * e-calendar.c: Likewise for - <libgnomecanvas/gnome-canvas-widget.h>. - - * Makefile.am: Don't compile e-bonobo-widget.c, e-bonobo-widget.h. - [Unused right now, so we can avoid porting until, and if, they are - needed.] - - * e-filter-bar.c: Do not #include <libgnome/gnome-defs.h>. Do not - #include <libgnomeui/gnome-stock.h>. #include <gtk/gtksignal.h>. - Also remove gal #includes. - (do_advanced): Add some GTK_SIGNAL_FUNC() casts. - (menubar_activated): Likewise. - (menubar_activated): Likewise. - -2002-10-30 Ettore Perazzoli <ettore@ximian.com> - - * e-map.h: Do not #include <libgnome/gnome-defs.h>. + * e-calendar-item.c (e_calendar_item_ensure_days_visible): set the + year when testing end date stuff, don't reset the end month if we + couldn't fit the days in the next month 2002-10-28 Jeffrey Stedfast <fejj@ximian.com> diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c index ee25c8f3bd..c308552a04 100644 --- a/widgets/misc/e-calendar-item.c +++ b/widgets/misc/e-calendar-item.c @@ -25,10 +25,7 @@ * ECalendarItem - canvas item displaying a calendar. */ - -#ifdef HAVE_CONFIG_H #include <config.h> -#endif #include "e-calendar-item.h" @@ -40,6 +37,7 @@ #include <gtk/gtkmenuitem.h> #include <gtk/gtklabel.h> #include <gtk/gtksignal.h> +#include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> #include <gal/util/e-util.h> @@ -216,7 +214,6 @@ static void e_calendar_item_on_menu_item_activate(GtkWidget *menuitem, static void e_calendar_item_position_menu (GtkMenu *menu, gint *x, gint *y, - gboolean *push_in, gpointer user_data); static void e_calendar_item_date_range_changed (ECalendarItem *calitem); static void e_calendar_item_queue_signal_emission (ECalendarItem *calitem); @@ -232,9 +229,7 @@ enum { ARG_X2, ARG_Y2, ARG_FONT, - ARG_FONT_DESC, ARG_WEEK_NUMBER_FONT, - ARG_WEEK_NUMBER_FONT_DESC, ARG_ROW_HEIGHT, ARG_COLUMN_WIDTH, ARG_MINIMUM_ROWS, @@ -272,7 +267,7 @@ e_calendar_item_class_init (ECalendarItemClass *class) GtkObjectClass *object_class; GnomeCanvasItemClass *item_class; - parent_class = g_type_class_ref(gnome_canvas_item_get_type()); + parent_class = gtk_type_class (gnome_canvas_item_get_type()); object_class = (GtkObjectClass *) class; item_class = (GnomeCanvasItemClass *) class; @@ -296,17 +291,11 @@ e_calendar_item_class_init (ECalendarItemClass *class) GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_Y2); gtk_object_add_arg_type ("ECalendarItem::font", - GTK_TYPE_POINTER, GTK_ARG_READWRITE, + GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE, ARG_FONT); - gtk_object_add_arg_type ("ECalendarItem::font_desc", - GTK_TYPE_POINTER, GTK_ARG_READWRITE, - ARG_FONT_DESC); gtk_object_add_arg_type ("ECalendarItem::week_number_font", - GTK_TYPE_POINTER, GTK_ARG_READWRITE, + GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE, ARG_WEEK_NUMBER_FONT); - gtk_object_add_arg_type ("ECalendarItem::week_number_font_desc", - GTK_TYPE_POINTER, GTK_ARG_READWRITE, - ARG_WEEK_NUMBER_FONT_DESC); gtk_object_add_arg_type ("ECalendarItem::row_height", GTK_TYPE_INT, GTK_ARG_READABLE, ARG_ROW_HEIGHT); @@ -350,18 +339,22 @@ e_calendar_item_class_init (ECalendarItemClass *class) e_calendar_item_signals[DATE_RANGE_CHANGED] = gtk_signal_new ("date_range_changed", GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - G_STRUCT_OFFSET (ECalendarItemClass, date_range_changed), + object_class->type, + GTK_SIGNAL_OFFSET (ECalendarItemClass, date_range_changed), gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0); e_calendar_item_signals[SELECTION_CHANGED] = gtk_signal_new ("selection_changed", GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - G_STRUCT_OFFSET (ECalendarItemClass, selection_changed), + object_class->type, + GTK_SIGNAL_OFFSET (ECalendarItemClass, selection_changed), gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, e_calendar_item_signals, + LAST_SIGNAL); + + object_class->destroy = e_calendar_item_destroy; object_class->get_arg = e_calendar_item_get_arg; object_class->set_arg = e_calendar_item_set_arg; @@ -447,24 +440,17 @@ e_calendar_item_destroy (GtkObject *o) e_calendar_item_set_style_callback (calitem, NULL, NULL, NULL); e_calendar_item_set_get_time_callback (calitem, NULL, NULL, NULL); - if (calitem->styles) { - g_free (calitem->styles); - calitem->styles = NULL; - } + g_free (calitem->styles); if (calitem->signal_emission_idle_id != 0) { g_source_remove (calitem->signal_emission_idle_id); calitem->signal_emission_idle_id = 0; } - if (calitem->old_font) { + if (calitem->old_font) gdk_font_unref (calitem->old_font); - calitem->old_font = NULL; - } - if (calitem->old_week_number_font) { + if (calitem->old_week_number_font) gdk_font_unref (calitem->old_week_number_font); - calitem->old_week_number_font = NULL; - } if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (o); @@ -502,15 +488,9 @@ e_calendar_item_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) case ARG_FONT: GTK_VALUE_BOXED (*arg) = calitem->font; break; - case ARG_FONT_DESC: - GTK_VALUE_BOXED (*arg) = calitem->font_desc; - break; case ARG_WEEK_NUMBER_FONT: GTK_VALUE_BOXED (*arg) = calitem->week_number_font; break; - case ARG_WEEK_NUMBER_FONT_DESC: - GTK_VALUE_BOXED (*arg) = calitem->week_number_font_desc; - break; case ARG_ROW_HEIGHT: e_calendar_item_recalc_sizes (calitem); GTK_VALUE_INT (*arg) = calitem->min_month_height; @@ -564,7 +544,6 @@ e_calendar_item_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) GnomeCanvasItem *item; ECalendarItem *calitem; GdkFont *font; - PangoFontDescription *font_desc; gboolean need_update = FALSE; gdouble dvalue; gint ivalue; @@ -623,13 +602,6 @@ e_calendar_item_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) need_update = TRUE; } break; - case ARG_FONT_DESC: - font_desc = GTK_VALUE_BOXED (*arg); - if (calitem->font_desc) - pango_font_description_free (calitem->font_desc); - calitem->font_desc = pango_font_description_copy (font_desc); - need_update = TRUE; - break; case ARG_WEEK_NUMBER_FONT: font = GTK_VALUE_BOXED (*arg); if (calitem->week_number_font != font) { @@ -641,13 +613,6 @@ e_calendar_item_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) need_update = TRUE; } break; - case ARG_WEEK_NUMBER_FONT_DESC: - font_desc = GTK_VALUE_BOXED (*arg); - if (calitem->week_number_font_desc) - pango_font_description_free (calitem->week_number_font_desc); - calitem->week_number_font_desc = pango_font_description_copy (font_desc); - need_update = TRUE; - break; case ARG_MINIMUM_ROWS: ivalue = GTK_VALUE_INT (*arg); ivalue = MAX (1, ivalue); @@ -772,11 +737,8 @@ e_calendar_item_unrealize (GnomeCanvasItem *item) colormap = gtk_widget_get_colormap (GTK_WIDGET (item->canvas)); - for (i = 0; i < E_CALENDAR_ITEM_COLOR_LAST; i++) { - /* FIXME: gdk_colors_free expects gulong* here but the pixel value in GdkColor - is guint32. GDK bug? */ - gdk_colors_free (colormap, (gulong *) &calitem->colors[i].pixel, 1, 0); - } + for (i = 0; i < E_CALENDAR_ITEM_COLOR_LAST; i++) + gdk_colors_free (colormap, &calitem->colors[i].pixel, 1, 0); if (GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize) (* GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize) (item); @@ -817,8 +779,8 @@ e_calendar_item_update (GnomeCanvasItem *item, calitem = E_CALENDAR_ITEM (item); style = GTK_WIDGET (item->canvas)->style; - xthickness = style->xthickness; - ythickness = style->ythickness; + xthickness = style->klass->xthickness; + ythickness = style->klass->ythickness; item->x1 = calitem->x1; item->y1 = calitem->y1; @@ -869,7 +831,7 @@ e_calendar_item_update (GnomeCanvasItem *item, font = calitem->font; if (!font) - font = gtk_style_get_font (style); + font = style->font; char_height = font->ascent + font->descent; calitem->month_width = calitem->min_month_width; @@ -949,10 +911,10 @@ e_calendar_item_draw (GnomeCanvasItem *canvas_item, style = GTK_WIDGET (canvas_item->canvas)->style; font = calitem->font; if (!font) - font = gtk_style_get_font (style); + font = style->font; char_height = font->ascent + font->descent; - xthickness = style->xthickness; - ythickness = style->ythickness; + xthickness = style->klass->xthickness; + ythickness = style->klass->ythickness; base_gc = style->base_gc[GTK_STATE_NORMAL]; bg_gc = style->bg_gc[GTK_STATE_NORMAL]; @@ -1028,7 +990,6 @@ e_calendar_item_draw_month (ECalendarItem *calitem, GtkWidget *widget; GtkStyle *style; GdkFont *font; - PangoFontDescription *font_desc; GdkGC *fg_gc; struct tm tmp_tm; GdkRectangle clip_rect; @@ -1039,7 +1000,6 @@ e_calendar_item_draw_month (ECalendarItem *calitem, gint day, day_index, cells_x, cells_y, min_cell_width, text_width; gint clip_width, clip_height; gchar buffer[64]; - PangoLayout *layout; #if 0 g_print ("In e_calendar_item_draw_month: %i,%i %ix%i row:%i col:%i\n", @@ -1050,15 +1010,11 @@ e_calendar_item_draw_month (ECalendarItem *calitem, style = widget->style; font = calitem->font; if (!font) - font = gtk_style_get_font (style); - font_desc = calitem->font_desc; - if (!font_desc) - font_desc = style->font_desc; + font = style->font; char_height = font->ascent + font->descent; - xthickness = style->xthickness; - ythickness = style->ythickness; + xthickness = style->klass->xthickness; + ythickness = style->klass->ythickness; fg_gc = style->fg_gc[GTK_STATE_NORMAL]; - layout = gtk_widget_create_pango_layout (widget, NULL); /* Calculate the top-left position of the entire month display. */ month_x = item->x1 + xthickness + calitem->x_offset @@ -1091,7 +1047,7 @@ e_calendar_item_draw_month (ECalendarItem *calitem, else max_x -= E_CALENDAR_ITEM_XPAD_AFTER_MONTH_NAME; - text_y = month_y + style->ythickness + text_y = month_y + style->klass->ythickness + E_CALENDAR_ITEM_YPAD_ABOVE_MONTH_NAME; clip_rect.x = month_x + min_x; clip_rect.x = MAX (0, clip_rect.x); @@ -1119,12 +1075,8 @@ e_calendar_item_draw_month (ECalendarItem *calitem, text_x = (calitem->month_width - text_width) / 2; text_x = MAX (min_x, text_x); - pango_layout_set_font_description (layout, font_desc); - pango_layout_set_text (layout, buffer, -1); - gdk_draw_layout (drawable, fg_gc, - month_x + text_x, - text_y, - layout); + gdk_draw_string (drawable, font, fg_gc, + month_x + text_x, text_y + font->ascent, buffer); } /* Set the clip rectangle for the main month display. */ @@ -1163,15 +1115,12 @@ e_calendar_item_draw_month (ECalendarItem *calitem, + E_CALENDAR_ITEM_YPAD_BELOW_DAY_LETTERS + 1 + E_CALENDAR_ITEM_YPAD_ABOVE_CELLS; + text_y += font->ascent; day_index = calitem->week_start_day; - pango_layout_set_font_description (layout, font_desc); for (day = 0; day < 7; day++) { - pango_layout_set_text (layout, &calitem->days [day_index], 1); - gdk_draw_layout (drawable, fg_gc, - text_x - calitem->day_widths [day_index], - text_y, - layout); - + gdk_draw_text (drawable, font, fg_gc, + text_x - calitem->day_widths[day_index], text_y, + &calitem->days[day_index], 1); text_x += calitem->cell_width; day_index++; if (day_index == 7) @@ -1200,7 +1149,6 @@ e_calendar_item_draw_month (ECalendarItem *calitem, } gdk_gc_set_clip_rectangle (fg_gc, NULL); - g_object_unref (layout); } @@ -1221,7 +1169,6 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem, GtkWidget *widget; GtkStyle *style; GdkFont *font, *wkfont; - PangoFontDescription *font_desc, *wkfont_desc; GdkGC *fg_gc; GdkColor *bg_color, *fg_color, *box_color; struct tm today_tm; @@ -1237,23 +1184,16 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem, gint today_year, today_month, today_mday, month_offset; gchar buffer[2]; gint day_style = 0; - PangoLayout *layout; item = GNOME_CANVAS_ITEM (calitem); widget = GTK_WIDGET (item->canvas); style = widget->style; font = calitem->font; if (!font) - font = gtk_style_get_font (style); - font_desc = calitem->font_desc; - if (!font_desc) - font_desc = style->font_desc; + font = style->font; wkfont = calitem->week_number_font; if (!wkfont) wkfont = font; - wkfont_desc = calitem->week_number_font_desc; - if (!wkfont_desc) - wkfont_desc = font_desc; fg_gc = style->fg_gc[GTK_STATE_NORMAL]; char_height = font->ascent + font->descent; @@ -1261,8 +1201,6 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem, + E_CALENDAR_ITEM_MIN_CELL_XPAD; min_cell_height = char_height + E_CALENDAR_ITEM_MIN_CELL_YPAD; - layout = gtk_widget_create_pango_layout (widget, NULL); - /* Calculate the number of days in the previous, current, and next months. */ years[0] = years[1] = years[2] = year; @@ -1346,13 +1284,9 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem, gdk_gc_set_foreground (fg_gc, &style->fg[GTK_STATE_NORMAL]); - - pango_layout_set_font_description (layout, wkfont_desc); - pango_layout_set_text (layout, buffer, num_chars); - gdk_draw_layout (drawable, fg_gc, - text_x, - text_y, - layout); + gdk_draw_text (drawable, wkfont, fg_gc, + text_x, text_y + font->ascent, + buffer, num_chars); } for (dcol = 0; dcol < 7; dcol++) { @@ -1455,20 +1389,17 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem, &style->fg[GTK_STATE_NORMAL]); } - pango_layout_set_font_description (layout, font_desc); - pango_layout_set_text (layout, buffer, num_chars); - gdk_draw_layout (drawable, fg_gc, - day_x, - day_y, - layout); - + gdk_draw_text (drawable, font, fg_gc, + day_x, + day_y + font->ascent, + buffer, num_chars); /* We use a stupid technique for bold. Just draw it again 1 pixel to the left. */ if (bold) - gdk_draw_layout (drawable, fg_gc, - day_x - 1, - day_y, - layout); + gdk_draw_text (drawable, font, fg_gc, + day_x - 1, + day_y + font->ascent, + buffer, num_chars); } /* See if we've reached the end of a month. */ @@ -1497,8 +1428,6 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem, /* Reset the foreground color. */ gdk_gc_set_foreground (fg_gc, &style->fg[GTK_STATE_NORMAL]); - - g_object_unref (layout); } @@ -1508,38 +1437,37 @@ e_calendar_item_get_week_number (ECalendarItem *calitem, gint month, gint year) { - GDate date; - guint weekday, yearday; - int offset, week_num; - + GDate tmp_date; + gint weekday, yearday, offset, week_num; + /* FIXME: check what happens at year boundaries. */ - - g_date_clear (&date, 1); - g_date_set_dmy (&date, day, month + 1, year); - - /* This results in a value of 0 (Monday) - 6 (Sunday). (or -1 on error - oops!!) */ - weekday = g_date_get_weekday (&date) - 1; - + + g_date_clear (&tmp_date, 1); + g_date_set_dmy (&tmp_date, day, month + 1, year); + + /* This results in a value of 0 (Monday) - 6 (Sunday). */ + weekday = g_date_weekday (&tmp_date) - 1; + /* Calculate the offset from the start of the week. */ offset = (calitem->week_start_day + 7 - weekday) % 7; - + /* Calculate the day of the year, from 0 to 365. */ - yearday = g_date_get_day_of_year (&date) - 1; - + yearday = g_date_day_of_year (&tmp_date) - 1; + /* If the week starts on or after 29th December, it is week 1 of the next year, since there are 4 days in the next year. */ - g_date_subtract_days (&date, offset); - if (g_date_get_month (&date) == 12 && g_date_get_day (&date) >= 29) + g_date_subtract_days (&tmp_date, offset); + if (g_date_month (&tmp_date) == 12 && g_date_day (&tmp_date) >= 29) return 1; - + /* Calculate the week number, from 0. */ week_num = (yearday - offset) / 7; - + /* If the first week starts on or after Jan 5th, then we need to add 1 since the previous week will really be the first week. */ if ((yearday - offset) % 7 >= 4) week_num++; - + /* Add 1 so week numbers are from 1 to 53. */ return week_num + 1; } @@ -1602,7 +1530,7 @@ e_calendar_item_recalc_sizes (ECalendarItem *calitem) font = calitem->font; if (!font) - font = gtk_style_get_font (style); + font = style->font; wkfont = calitem->week_number_font; if (!wkfont) wkfont = font; @@ -1660,7 +1588,7 @@ e_calendar_item_recalc_sizes (ECalendarItem *calitem) + E_CALENDAR_ITEM_XPAD_AFTER_WEEK_NUMBERS + 1; } - calitem->min_month_height = style->ythickness * 2 + calitem->min_month_height = style->klass->ythickness * 2 + E_CALENDAR_ITEM_YPAD_ABOVE_MONTH_NAME + char_height + E_CALENDAR_ITEM_YPAD_BELOW_MONTH_NAME + 1 + E_CALENDAR_ITEM_YPAD_ABOVE_DAY_LETTERS @@ -2039,9 +1967,9 @@ e_calendar_item_convert_position_to_day (ECalendarItem *calitem, item = GNOME_CANVAS_ITEM (calitem); widget = GTK_WIDGET (item->canvas); style = widget->style; - char_height = gtk_style_get_font (style)->ascent + gtk_style_get_font (style)->descent; - xthickness = style->xthickness; - ythickness = style->ythickness; + char_height = style->font->ascent + style->font->descent; + xthickness = style->klass->xthickness; + ythickness = style->klass->ythickness; *entire_week = FALSE; @@ -2694,16 +2622,16 @@ e_calendar_item_set_selection (ECalendarItem *calitem, if (end_date == NULL) end_date = start_date; - + g_return_if_fail (g_date_compare (start_date, end_date) <= 0); - - start_year = g_date_get_year (start_date); - start_month = g_date_get_month (start_date) - 1; - start_day = g_date_get_day (start_date); - end_year = g_date_get_year (end_date); - end_month = g_date_get_month (end_date) - 1; - end_day = g_date_get_day (end_date); - + + start_year = g_date_year (start_date); + start_month = g_date_month (start_date) - 1; + start_day = g_date_day (start_date); + end_year = g_date_year (end_date); + end_month = g_date_month (end_date) - 1; + end_day = g_date_day (end_date); + need_update = e_calendar_item_ensure_days_visible (calitem, start_year, start_month, @@ -2780,6 +2708,7 @@ e_calendar_item_ensure_days_visible (ECalendarItem *calitem, /* First we see if the end of the selection will fit in the leftover days of the month after the last one shown. */ + calitem->year = end_year; calitem->month += (months_shown - 1); e_calendar_item_normalize_date (calitem, &calitem->year, &calitem->month); @@ -2795,8 +2724,6 @@ e_calendar_item_ensure_days_visible (ECalendarItem *calitem, calitem->year = end_year; calitem->month = end_month - months_shown + 1; - } else { - calitem->month -= (months_shown - 1); } e_calendar_item_normalize_date (calitem, &calitem->year, @@ -2856,9 +2783,9 @@ e_calendar_item_show_popup_menu (ECalendarItem *calitem, submenu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu); - g_object_set_data(G_OBJECT(submenu), "year", + gtk_object_set_data (GTK_OBJECT (submenu), "year", GINT_TO_POINTER (year)); - g_object_set_data(G_OBJECT(submenu), "month_offset", + gtk_object_set_data (GTK_OBJECT (submenu), "month_offset", GINT_TO_POINTER (month_offset)); for (month = 0; month < 12; month++) { @@ -2879,17 +2806,17 @@ e_calendar_item_show_popup_menu (ECalendarItem *calitem, gtk_widget_show (label); gtk_container_add (GTK_CONTAINER (menuitem), label); - g_object_set_data(G_OBJECT(menuitem), "month", + gtk_object_set_data (GTK_OBJECT (menuitem), "month", GINT_TO_POINTER (month)); - g_signal_connect((menuitem), "activate", - G_CALLBACK (e_calendar_item_on_menu_item_activate), calitem); + gtk_signal_connect (GTK_OBJECT (menuitem), "activate", + GTK_SIGNAL_FUNC (e_calendar_item_on_menu_item_activate), calitem); } } /* Run the menu modal so we can destroy it after. */ - g_signal_connect((menu), "deactivate", - G_CALLBACK (gtk_main_quit), NULL); + gtk_signal_connect (GTK_OBJECT (menu), "deactivate", + GTK_SIGNAL_FUNC (gtk_main_quit), NULL); gtk_menu_popup (GTK_MENU (menu), NULL, NULL, e_calendar_item_position_menu, calitem, event->button, event->time); @@ -2906,9 +2833,9 @@ e_calendar_item_on_menu_item_activate (GtkWidget *menuitem, { gint year, month_offset, month; - year = GPOINTER_TO_INT (g_object_get_data(G_OBJECT(menuitem->parent), "year")); - month_offset = GPOINTER_TO_INT (g_object_get_data(G_OBJECT(menuitem->parent), "month_offset")); - month = GPOINTER_TO_INT (g_object_get_data(G_OBJECT(menuitem), "month")); + year = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menuitem->parent), "year")); + month_offset = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menuitem->parent), "month_offset")); + month = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menuitem), "month")); month -= month_offset; e_calendar_item_normalize_date (calitem, &year, &month); @@ -2920,7 +2847,6 @@ static void e_calendar_item_position_menu (GtkMenu *menu, gint *x, gint *y, - gboolean *push_in, gpointer user_data) { GtkRequisition requisition; @@ -2991,7 +2917,7 @@ e_calendar_item_signal_emission_idle_cb (gpointer data) /* We ref the calitem & check in case it gets destroyed, since we were getting a free memory write here. */ - g_object_ref((calitem)); + gtk_object_ref (GTK_OBJECT (calitem)); if (calitem->date_range_changed) { calitem->date_range_changed = FALSE; @@ -2999,13 +2925,15 @@ e_calendar_item_signal_emission_idle_cb (gpointer data) e_calendar_item_signals[DATE_RANGE_CHANGED]); } - if (calitem->selection_changed) { + if (GTK_OBJECT_DESTROYED (calitem)) { + g_warning ("e_calendar_item_signal_emission_idle_cb: item destroyed"); + } else if (calitem->selection_changed) { calitem->selection_changed = FALSE; gtk_signal_emit (GTK_OBJECT (calitem), e_calendar_item_signals[SELECTION_CHANGED]); } - g_object_unref((calitem)); + gtk_object_unref (GTK_OBJECT (calitem)); GDK_THREADS_LEAVE (); return FALSE; diff --git a/widgets/misc/e-canvas-background.c b/widgets/misc/e-canvas-background.c deleted file mode 100644 index d2d68d180f..0000000000 --- a/widgets/misc/e-canvas-background.c +++ /dev/null @@ -1,495 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-canvas-background.c - background color for canvas. - * Copyright 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <config.h> - -#include "e-canvas-background.h" - -#include <math.h> -#include <stdio.h> -#include <gtk/gtksignal.h> -#include <gdk/gdkkeysyms.h> -#include "gal/widgets/e-hsv-utils.h" -#include "gal/widgets/e-canvas.h" -#include "gal/widgets/e-canvas-utils.h" -#include "gal/util/e-util.h" -#include "gal/util/e-i18n.h" -#include <string.h> - -#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type () - -#define d(x) - -struct _ECanvasBackgroundPrivate { - guint rgba; /* Fill color, RGBA */ - GdkColor color; /* Fill color */ - GdkBitmap *stipple; /* Stipple for fill */ - GdkGC *gc; /* GC for filling */ - double x1; - double x2; - double y1; - double y2; - - guint needs_redraw : 1; -}; - -static GnomeCanvasItemClass *parent_class; - -enum { - PROP_0, - PROP_FILL_COLOR, - PROP_FILL_COLOR_GDK, - PROP_FILL_COLOR_RGBA, - PROP_FILL_STIPPLE, - PROP_X1, - PROP_X2, - PROP_Y1, - PROP_Y2, -}; - -static void -get_color(ECanvasBackground *ecb) -{ - GnomeCanvasItem *item = GNOME_CANVAS_ITEM (ecb); - ecb->priv->color.pixel = gnome_canvas_get_color_pixel (item->canvas, - GNOME_CANVAS_COLOR (ecb->priv->color.red >> 8, - ecb->priv->color.green>> 8, - ecb->priv->color.blue>> 8)); -} - -static void -ecb_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) -{ - double i2c [6]; - ArtPoint c1, c2, i1, i2; - ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item); - - /* Wrong BBox's are the source of redraw nightmares */ - - gnome_canvas_item_i2c_affine (GNOME_CANVAS_ITEM (ecb), i2c); - - i1.x = ecb->priv->x1; - i1.y = ecb->priv->y1; - i2.x = ecb->priv->x2; - i2.y = ecb->priv->y2; - art_affine_point (&c1, &i1, i2c); - art_affine_point (&c2, &i2, i2c); - - if (ecb->priv->x1 < 0) - c1.x = -(double)UINT_MAX; - - if (ecb->priv->y1 < 0) - c1.y = -(double)UINT_MAX; - - if (ecb->priv->x2 < 0) - c2.x = (double)UINT_MAX; - - if (ecb->priv->y2 < 0) - c2.y = (double)UINT_MAX; - - *x1 = c1.x; - *y1 = c1.y; - *x2 = c2.x + 1; - *y2 = c2.y + 1; -} - -/* - * GnomeCanvasItem::update method - */ -static void -ecb_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) -{ - ArtPoint o1, o2; - ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item); - - if (GNOME_CANVAS_ITEM_CLASS (parent_class)->update) - GNOME_CANVAS_ITEM_CLASS (parent_class)->update (item, affine, clip_path, flags); - - o1.x = item->x1; - o1.y = item->y1; - o2.x = item->x2; - o2.y = item->y2; - - ecb_bounds (item, &item->x1, &item->y1, &item->x2, &item->y2); - if (item->x1 != o1.x || - item->y1 != o1.y || - item->x2 != o2.x || - item->y2 != o2.y) { - gnome_canvas_request_redraw (item->canvas, o1.x, o1.y, o2.x, o2.y); - ecb->priv->needs_redraw = 1; - } - - if (ecb->priv->needs_redraw) { - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, - item->x2, item->y2); - ecb->priv->needs_redraw = 0; - } -} - -/* Sets the stipple pattern for the text */ -static void -set_stipple (ECanvasBackground *ecb, GdkBitmap *stipple, int use_value) -{ - if (use_value) { - if (ecb->priv->stipple) - gdk_bitmap_unref (ecb->priv->stipple); - - ecb->priv->stipple = stipple; - if (stipple) - gdk_bitmap_ref (stipple); - } - - if (ecb->priv->gc) { - if (stipple) { - gdk_gc_set_stipple (ecb->priv->gc, stipple); - gdk_gc_set_fill (ecb->priv->gc, GDK_STIPPLED); - } else - gdk_gc_set_fill (ecb->priv->gc, GDK_SOLID); - } -} - -static void -ecb_dispose (GObject *object) -{ - ECanvasBackground *ecb = E_CANVAS_BACKGROUND (object); - - if (ecb->priv) { - if (ecb->priv->stipple) - gdk_bitmap_unref (ecb->priv->stipple); - ecb->priv->stipple = NULL; - - g_free (ecb->priv); - ecb->priv = NULL; - } - - if (G_OBJECT_CLASS (parent_class)->dispose) - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -ecb_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - GnomeCanvasItem *item; - ECanvasBackground *ecb; - - GdkColor color = { 0, 0, 0, 0, }; - GdkColor *pcolor; - gboolean color_changed = FALSE; - - item = GNOME_CANVAS_ITEM (object); - ecb = E_CANVAS_BACKGROUND (object); - - switch (prop_id){ - case PROP_FILL_COLOR: - if (g_value_get_string (value)) - gdk_color_parse (g_value_get_string (value), &color); - - ecb->priv->rgba = ((color.red & 0xff00) << 16 | - (color.green & 0xff00) << 8 | - (color.blue & 0xff00) | - 0xff); - color_changed = TRUE; - break; - - case PROP_FILL_COLOR_GDK: - pcolor = g_value_get_pointer (value); - if (pcolor) { - color = *pcolor; - } - - ecb->priv->rgba = ((color.red & 0xff00) << 16 | - (color.green & 0xff00) << 8 | - (color.blue & 0xff00) | - 0xff); - color_changed = TRUE; - break; - - case PROP_FILL_COLOR_RGBA: - ecb->priv->rgba = g_value_get_uint (value); - color.red = ((ecb->priv->rgba >> 24) & 0xff) * 0x101; - color.green = ((ecb->priv->rgba >> 16) & 0xff) * 0x101; - color.blue = ((ecb->priv->rgba >> 8) & 0xff) * 0x101; - color_changed = TRUE; - break; - - case PROP_FILL_STIPPLE: - set_stipple (ecb, g_value_get_object (value), TRUE); - break; - - case PROP_X1: - ecb->priv->x1 = g_value_get_double (value); - break; - case PROP_X2: - ecb->priv->x2 = g_value_get_double (value); - break; - case PROP_Y1: - ecb->priv->y1 = g_value_get_double (value); - break; - case PROP_Y2: - ecb->priv->y2 = g_value_get_double (value); - break; - } - - if (color_changed) { - ecb->priv->color = color; - - if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(item)) { - get_color (ecb); - if (!item->canvas->aa) { - gdk_gc_set_foreground (ecb->priv->gc, &ecb->priv->color); - } - } - } - - ecb->priv->needs_redraw = 1; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ecb)); -} - -static void -ecb_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - GnomeCanvasItem *item; - ECanvasBackground *ecb; - - item = GNOME_CANVAS_ITEM (object); - ecb = E_CANVAS_BACKGROUND (object); - - switch (prop_id){ - case PROP_FILL_COLOR_GDK: - g_value_set_pointer (value, gdk_color_copy (&ecb->priv->color)); - break; - case PROP_FILL_COLOR_RGBA: - g_value_set_uint (value, ecb->priv->rgba); - break; - case PROP_FILL_STIPPLE: - g_value_set_object (value, ecb->priv->stipple); - break; - case PROP_X1: - g_value_set_double (value, ecb->priv->x1); - break; - case PROP_X2: - g_value_set_double (value, ecb->priv->x2); - break; - case PROP_Y1: - g_value_set_double (value, ecb->priv->y1); - break; - case PROP_Y2: - g_value_set_double (value, ecb->priv->y2); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -ecb_init (GnomeCanvasItem *item) -{ - ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item); - - ecb->priv = g_new (ECanvasBackgroundPrivate, 1); - - ecb->priv->color.pixel = 0; - ecb->priv->color.red = 0; - ecb->priv->color.green = 0; - ecb->priv->color.blue = 0; - ecb->priv->stipple = NULL; - ecb->priv->gc = NULL; - ecb->priv->x1 = -1.0; - ecb->priv->x2 = -1.0; - ecb->priv->y1 = -1.0; - ecb->priv->y2 = -1.0; -} - -static void -ecb_realize (GnomeCanvasItem *item) -{ - ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item); - - if (GNOME_CANVAS_ITEM_CLASS (parent_class)->realize) - GNOME_CANVAS_ITEM_CLASS (parent_class)->realize (item); - - ecb->priv->gc = gdk_gc_new (item->canvas->layout.bin_window); - get_color (ecb); - if (!item->canvas->aa) - gdk_gc_set_foreground (ecb->priv->gc, &ecb->priv->color); - - set_stipple (ecb, NULL, FALSE); - - ecb->priv->needs_redraw = 1; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (ecb)); -} - -static void -ecb_unrealize (GnomeCanvasItem *item) -{ - ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item); - - gdk_gc_unref (ecb->priv->gc); - ecb->priv->gc = NULL; - - if (GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize) - GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize (item); -} - -static void -ecb_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height) -{ - ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item); - int x1, x2, y1, y2; - double i2c [6]; - ArtPoint upper_left, lower_right, ecb_base_point; - - /* - * Find out our real position after grouping - */ - gnome_canvas_item_i2c_affine (item, i2c); - ecb_base_point.x = ecb->priv->x1; - ecb_base_point.y = ecb->priv->y1; - art_affine_point (&upper_left, &ecb_base_point, i2c); - - ecb_base_point.x = ecb->priv->x2; - ecb_base_point.y = ecb->priv->y2; - art_affine_point (&lower_right, &ecb_base_point, i2c); - - x1 = 0; - y1 = 0; - x2 = width; - y2 = height; - if (ecb->priv->x1 >= 0 && upper_left.x > x1) - x1 = upper_left.x; - if (ecb->priv->y1 >= 0 && upper_left.y > y1) - y1 = upper_left.y; - if (ecb->priv->x2 >= 0 && lower_right.x < x2) - x2 = lower_right.x; - if (ecb->priv->y2 >= 0 && lower_right.y < y2) - y2 = lower_right.y; - - gdk_draw_rectangle (drawable, ecb->priv->gc, TRUE, - x1, y1, x2 - x1, y2 - y1); -} - -static double -ecb_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item) -{ - ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item); - - if (ecb->priv->x1 >= 0 && ecb->priv->x1 > x) - return 1.0; - if (ecb->priv->x2 >= 0 && ecb->priv->x2 < x) - return 1.0; - if (ecb->priv->y1 >= 0 && ecb->priv->y1 > y) - return 1.0; - if (ecb->priv->y2 >= 0 && ecb->priv->y2 < y) - return 1.0; - *actual_item = item; - - return 0.0; -} - -static void -ecb_class_init (GObjectClass *object_class) -{ - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; - - parent_class = g_type_class_ref (PARENT_OBJECT_TYPE); - - object_class->dispose = ecb_dispose; - object_class->set_property = ecb_set_property; - object_class->get_property = ecb_get_property; - - item_class->update = ecb_update; - item_class->realize = ecb_realize; - item_class->unrealize = ecb_unrealize; - item_class->draw = ecb_draw; - item_class->point = ecb_point; - - g_object_class_install_property (object_class, PROP_FILL_COLOR, - g_param_spec_string ("fill_color", - _( "Fill color" ), - _( "Fill color" ), - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_FILL_COLOR_GDK, - g_param_spec_pointer ("fill_color_gdk", - _( "GDK fill color" ), - _( "GDK fill color" ), - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_FILL_COLOR_RGBA, - g_param_spec_uint ("fill_color_rgba", - _( "GDK fill color" ), - _( "GDK fill color" ), - 0, G_MAXUINT, 0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_FILL_STIPPLE, - g_param_spec_object ("fill_stipple", - _( "Fill stipple" ), - _( "FIll stipple" ), - GDK_TYPE_WINDOW, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_X1, - g_param_spec_double ("x1", - _( "X1" ), - _( "X1" ), - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_X2, - g_param_spec_double ("x2", - _( "X2" ), - _( "X2" ), - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_Y1, - g_param_spec_double ("y1", - _( "Y1" ), - _( "Y1" ), - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_Y2, - g_param_spec_double ("y2", - _( "Y2" ), - _( "Y2" ), - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); -} - -E_MAKE_TYPE (e_canvas_background, - "ECanvasBackground", - ECanvasBackground, - ecb_class_init, - ecb_init, - PARENT_OBJECT_TYPE) diff --git a/widgets/misc/e-canvas-background.h b/widgets/misc/e-canvas-background.h deleted file mode 100644 index 4a8e3294fb..0000000000 --- a/widgets/misc/e-canvas-background.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-canvas-background.h - background color for canvas. - * Copyright 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef E_CANVAS_BACKGROUND_H -#define E_CANVAS_BACKGROUND_H - -#include <libgnomecanvas/gnome-canvas.h> - -G_BEGIN_DECLS - -/* - * name type read/write description - * ------------------------------------------------------------------------------------------ - * fill_color string W X color specification for fill color, - * or NULL pointer for no color (transparent) - * fill_color_gdk GdkColor* RW Allocated GdkColor for fill - * fill_stipple GdkBitmap* RW Stipple pattern for fill - * x1 double RW Coordinates for edges of background rectangle - * x2 double RW Default is all of them = -1. - * y1 double RW Which means that the entire space is shown. - * y2 double RW If you need the rectangle to have negative coordinates, use an affine. - */ - - -#define E_CANVAS_BACKGROUND_TYPE (e_canvas_background_get_type ()) -#define E_CANVAS_BACKGROUND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_CANVAS_BACKGROUND_TYPE, ECanvasBackground)) -#define E_CANVAS_BACKGROUND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_CANVAS_BACKGROUND_TYPE, ECanvasBackgroundClass)) -#define E_IS_CANVAS_BACKGROUND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_CANVAS_BACKGROUND_TYPE)) -#define E_IS_CANVAS_BACKGROUND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_CANVAS_BACKGROUND_TYPE)) - -typedef struct _ECanvasBackground ECanvasBackground; -typedef struct _ECanvasBackgroundClass ECanvasBackgroundClass; -typedef struct _ECanvasBackgroundPrivate ECanvasBackgroundPrivate; - -struct _ECanvasBackground { - GnomeCanvasItem item; - - ECanvasBackgroundPrivate *priv; -}; - -struct _ECanvasBackgroundClass { - GnomeCanvasItemClass parent_class; -}; - - -/* Standard Gtk function */ -GtkType e_canvas_background_get_type (void); - -G_END_DECLS - -#endif diff --git a/widgets/misc/e-canvas-utils.c b/widgets/misc/e-canvas-utils.c deleted file mode 100644 index 629804a2d7..0000000000 --- a/widgets/misc/e-canvas-utils.c +++ /dev/null @@ -1,171 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-canvas-utils.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include "e-canvas-utils.h" - -void -e_canvas_item_move_absolute (GnomeCanvasItem *item, double dx, double dy) -{ - double translate[6]; - - g_return_if_fail (item != NULL); - g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); - - art_affine_translate (translate, dx, dy); - - gnome_canvas_item_affine_absolute (item, translate); -} - -static double -compute_offset(int top, int bottom, int page_top, int page_bottom) -{ - int size = bottom - top; - int offset = 0; - - if (top <= page_top && bottom >= page_bottom) - return 0; - - if (bottom > page_bottom) - offset = (bottom - page_bottom); - if (top < page_top + offset) - offset = (top - page_top); - - if (top <= page_top + offset && bottom >= page_bottom + offset) - return offset; - - if (top < page_top + size * 3 / 2 + offset) - offset = top - (page_top + size * 3 / 2); - if (bottom > page_bottom - size * 3 / 2 + offset) - offset = bottom - (page_bottom - size * 3 / 2); - if (top < page_top + size * 3 / 2 + offset) - offset = top - ((page_top + page_bottom - (bottom - top)) / 2); - - return offset; -} - - -static void -e_canvas_show_area (GnomeCanvas *canvas, double x1, double y1, double x2, double y2) -{ - GtkAdjustment *h, *v; - int dx = 0, dy = 0; - - g_return_if_fail (canvas != NULL); - g_return_if_fail (GNOME_IS_CANVAS (canvas)); - - h = gtk_layout_get_hadjustment(GTK_LAYOUT(canvas)); - dx = compute_offset(x1, x2, h->value, h->value + h->page_size); - if (dx) - gtk_adjustment_set_value(h, CLAMP(h->value + dx, h->lower, h->upper - h->page_size)); - - v = gtk_layout_get_vadjustment(GTK_LAYOUT(canvas)); - dy = compute_offset(y1, y2, v->value, v->value + v->page_size); - if (dy) - gtk_adjustment_set_value(v, CLAMP(v->value + dy, v->lower, v->upper - v->page_size)); -} - -void -e_canvas_item_show_area (GnomeCanvasItem *item, double x1, double y1, double x2, double y2) -{ - g_return_if_fail (item != NULL); - g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); - - gnome_canvas_item_i2w(item, &x1, &y1); - gnome_canvas_item_i2w(item, &x2, &y2); - - e_canvas_show_area(item->canvas, x1, y1, x2, y2); -} - - -static gboolean -e_canvas_area_shown (GnomeCanvas *canvas, double x1, double y1, double x2, double y2) -{ - GtkAdjustment *h, *v; - int dx = 0, dy = 0; - - g_return_val_if_fail (canvas != NULL, FALSE); - g_return_val_if_fail (GNOME_IS_CANVAS (canvas), FALSE); - - h = gtk_layout_get_hadjustment(GTK_LAYOUT(canvas)); - dx = compute_offset(x1, x2, h->value, h->value + h->page_size); - if (CLAMP(h->value + dx, h->lower, h->upper - h->page_size) - h->value != 0) - return FALSE; - - v = gtk_layout_get_vadjustment(GTK_LAYOUT(canvas)); - dy = compute_offset(y1, y2, v->value, v->value + v->page_size); - if (CLAMP(v->value + dy, v->lower, v->upper - v->page_size) - v->value != 0) - return FALSE; - return TRUE; -} - -gboolean -e_canvas_item_area_shown (GnomeCanvasItem *item, double x1, double y1, double x2, double y2) -{ - g_return_val_if_fail (item != NULL, FALSE); - g_return_val_if_fail (GNOME_IS_CANVAS_ITEM (item), FALSE); - - gnome_canvas_item_i2w(item, &x1, &y1); - gnome_canvas_item_i2w(item, &x2, &y2); - - return e_canvas_area_shown(item->canvas, x1, y1, x2, y2); -} - -typedef struct { - double x1; - double y1; - double x2; - double y2; - GnomeCanvas *canvas; -} DoubsAndCanvas; - -static gboolean -show_area_timeout (gpointer data) -{ - DoubsAndCanvas *dac = data; - - e_canvas_show_area(dac->canvas, dac->x1, dac->y1, dac->x2, dac->y2); - g_object_unref (dac->canvas); - g_free(dac); - return FALSE; -} - -void -e_canvas_item_show_area_delayed (GnomeCanvasItem *item, double x1, double y1, double x2, double y2, gint delay) -{ - DoubsAndCanvas *dac; - - g_return_if_fail (item != NULL); - g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); - - gnome_canvas_item_i2w(item, &x1, &y1); - gnome_canvas_item_i2w(item, &x2, &y2); - - dac = g_new(DoubsAndCanvas, 1); - dac->x1 = x1; - dac->y1 = y1; - dac->x2 = x2; - dac->y2 = y2; - dac->canvas = item->canvas; - g_object_ref (item->canvas); - g_timeout_add(delay, show_area_timeout, dac); -} diff --git a/widgets/misc/e-canvas-utils.h b/widgets/misc/e-canvas-utils.h deleted file mode 100644 index 5b1a329140..0000000000 --- a/widgets/misc/e-canvas-utils.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef __E_CANVAS_UTILS__ -#define __E_CANVAS_UTILS__ - -#include <libgnomecanvas/gnome-canvas.h> - -G_BEGIN_DECLS - -void e_canvas_item_move_absolute (GnomeCanvasItem *item, - double dx, - double dy); -void e_canvas_item_show_area (GnomeCanvasItem *item, - double x1, - double y1, - double x2, - double y2); -void e_canvas_item_show_area_delayed (GnomeCanvasItem *item, - double x1, - double y1, - double x2, - double y2, - gint delay); -/* Returns TRUE if the area is already shown on the screen (including - spacing.) This is equivelent to returning FALSE iff show_area - would do anything. */ -gboolean e_canvas_item_area_shown (GnomeCanvasItem *item, - double x1, - double y1, - double x2, - double y2); - -G_END_DECLS - -#endif /* __E_CANVAS_UTILS__ */ diff --git a/widgets/misc/e-canvas-vbox.c b/widgets/misc/e-canvas-vbox.c deleted file mode 100644 index 354da5d872..0000000000 --- a/widgets/misc/e-canvas-vbox.c +++ /dev/null @@ -1,381 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-canvas-vbox.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <config.h> -#include <math.h> -#include <gdk/gdkkeysyms.h> -#include <gtk/gtksignal.h> -#include "e-canvas-vbox.h" -#include "e-canvas-utils.h" -#include "e-canvas.h" -#include "gal/util/e-util.h" -#include "gal/util/e-i18n.h" - -static void e_canvas_vbox_init (ECanvasVbox *CanvasVbox); -static void e_canvas_vbox_class_init (ECanvasVboxClass *klass); -static void e_canvas_vbox_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void e_canvas_vbox_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void e_canvas_vbox_dispose (GObject *object); - -static gint e_canvas_vbox_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_canvas_vbox_realize (GnomeCanvasItem *item); - -static void e_canvas_vbox_reflow (GnomeCanvasItem *item, int flags); - -static void e_canvas_vbox_real_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item); -static void e_canvas_vbox_real_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item); -static void e_canvas_vbox_resize_children (GnomeCanvasItem *item); - -#define PARENT_TYPE GNOME_TYPE_CANVAS_GROUP -static GnomeCanvasGroupClass *parent_class = NULL; - -/* The arguments we take */ -enum { - PROP_0, - PROP_WIDTH, - PROP_MINIMUM_WIDTH, - PROP_HEIGHT, - PROP_SPACING -}; - -E_MAKE_TYPE (e_canvas_vbox, - "ECanvasVbox", - ECanvasVbox, - e_canvas_vbox_class_init, - e_canvas_vbox_init, - PARENT_TYPE) - -static void -e_canvas_vbox_class_init (ECanvasVboxClass *klass) -{ - GObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GObjectClass*) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = g_type_class_ref (PARENT_TYPE); - - klass->add_item = e_canvas_vbox_real_add_item; - klass->add_item_start = e_canvas_vbox_real_add_item_start; - - object_class->set_property = e_canvas_vbox_set_property; - object_class->get_property = e_canvas_vbox_get_property; - object_class->dispose = e_canvas_vbox_dispose; - - /* GnomeCanvasItem method overrides */ - item_class->event = e_canvas_vbox_event; - item_class->realize = e_canvas_vbox_realize; - - g_object_class_install_property (object_class, PROP_WIDTH, - g_param_spec_double ("width", - _( "Width" ), - _( "Width" ), - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - g_object_class_install_property (object_class, PROP_MINIMUM_WIDTH, - g_param_spec_double ("minimum_width", - _( "Minimum width" ), - _( "Minimum Width" ), - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - g_object_class_install_property (object_class, PROP_HEIGHT, - g_param_spec_double ("height", - _( "Height" ), - _( "Height" ), - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READABLE)); - g_object_class_install_property (object_class, PROP_SPACING, - g_param_spec_double ("spacing", - _( "Spacing" ), - _( "Spacing" ), - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); -} - -static void -e_canvas_vbox_init (ECanvasVbox *vbox) -{ - vbox->items = NULL; - - vbox->width = 10; - vbox->minimum_width = 10; - vbox->height = 10; - vbox->spacing = 0; - - e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(vbox), e_canvas_vbox_reflow); -} - -static void -e_canvas_vbox_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - GnomeCanvasItem *item; - ECanvasVbox *e_canvas_vbox; - - item = GNOME_CANVAS_ITEM (object); - e_canvas_vbox = E_CANVAS_VBOX (object); - - switch (prop_id){ - case PROP_WIDTH: - case PROP_MINIMUM_WIDTH: - e_canvas_vbox->minimum_width = g_value_get_double (value); - e_canvas_vbox_resize_children(item); - e_canvas_item_request_reflow(item); - break; - case PROP_SPACING: - e_canvas_vbox->spacing = g_value_get_double (value); - e_canvas_item_request_reflow(item); - break; - } -} - -static void -e_canvas_vbox_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - ECanvasVbox *e_canvas_vbox; - - e_canvas_vbox = E_CANVAS_VBOX (object); - - switch (prop_id) { - case PROP_WIDTH: - g_value_set_double (value, e_canvas_vbox->width); - break; - case PROP_MINIMUM_WIDTH: - g_value_set_double (value, e_canvas_vbox->minimum_width); - break; - case PROP_HEIGHT: - g_value_set_double (value, e_canvas_vbox->height); - break; - case PROP_SPACING: - g_value_set_double (value, e_canvas_vbox->spacing); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -/* Used from g_list_foreach(); disconnects from an item's signals */ -static void -disconnect_item_cb (gpointer data, gpointer user_data) -{ - ECanvasVbox *vbox; - GnomeCanvasItem *item; - - vbox = E_CANVAS_VBOX (user_data); - - item = GNOME_CANVAS_ITEM (data); - g_signal_handlers_disconnect_matched (item, - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, - vbox); -} - -static void -e_canvas_vbox_dispose (GObject *object) -{ - ECanvasVbox *vbox = E_CANVAS_VBOX(object); - - if (vbox->items) { - g_list_foreach(vbox->items, disconnect_item_cb, vbox); - g_list_free(vbox->items); - vbox->items = NULL; - } - - G_OBJECT_CLASS(parent_class)->dispose (object); -} - -static gint -e_canvas_vbox_event (GnomeCanvasItem *item, GdkEvent *event) -{ - gint return_val = TRUE; - - switch (event->type) { - case GDK_KEY_PRESS: - switch (event->key.keyval) { - case GDK_Left: - case GDK_KP_Left: - case GDK_Right: - case GDK_KP_Right: - case GDK_Down: - case GDK_KP_Down: - case GDK_Up: - case GDK_KP_Up: - case GDK_Return: - case GDK_KP_Enter: - return_val = TRUE; - break; - default: - return_val = FALSE; - break; - } - break; - default: - return_val = FALSE; - break; - } - if (!return_val) { - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event) - return GNOME_CANVAS_ITEM_CLASS (parent_class)->event (item, event); - } - return return_val; - -} - -static void -e_canvas_vbox_realize (GnomeCanvasItem *item) -{ - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item); - - e_canvas_vbox_resize_children(item); - e_canvas_item_request_reflow(item); -} - -static void -e_canvas_vbox_remove_item (gpointer data, GObject *where_object_was) -{ - ECanvasVbox *vbox = data; - vbox->items = g_list_remove(vbox->items, where_object_was); -} - -static void -e_canvas_vbox_real_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item) -{ - e_canvas_vbox->items = g_list_append(e_canvas_vbox->items, item); - g_object_weak_ref (G_OBJECT (item), - e_canvas_vbox_remove_item, e_canvas_vbox); - if ( GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED ) { - gnome_canvas_item_set(item, - "width", (double) e_canvas_vbox->minimum_width, - NULL); - e_canvas_item_request_reflow(item); - } -} - - -static void -e_canvas_vbox_real_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item) -{ - e_canvas_vbox->items = g_list_prepend(e_canvas_vbox->items, item); - g_object_weak_ref (G_OBJECT (item), - e_canvas_vbox_remove_item, e_canvas_vbox); - if ( GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED ) { - gnome_canvas_item_set(item, - "width", (double) e_canvas_vbox->minimum_width, - NULL); - e_canvas_item_request_reflow(item); - } -} - -static void -e_canvas_vbox_resize_children (GnomeCanvasItem *item) -{ - GList *list; - ECanvasVbox *e_canvas_vbox; - - e_canvas_vbox = E_CANVAS_VBOX (item); - for ( list = e_canvas_vbox->items; list; list = list->next ) { - GnomeCanvasItem *child = GNOME_CANVAS_ITEM(list->data); - gnome_canvas_item_set(child, - "width", (double) e_canvas_vbox->minimum_width, - NULL); - } -} - -static void -e_canvas_vbox_reflow( GnomeCanvasItem *item, int flags ) -{ - ECanvasVbox *e_canvas_vbox = E_CANVAS_VBOX(item); - if ( GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED ) { - - gdouble old_height; - gdouble running_height; - gdouble old_width; - gdouble max_width; - - old_width = e_canvas_vbox->width; - max_width = e_canvas_vbox->minimum_width; - - old_height = e_canvas_vbox->height; - running_height = 0; - - if (e_canvas_vbox->items == NULL) { - } else { - GList *list; - gdouble item_height; - gdouble item_width; - - list = e_canvas_vbox->items; - g_object_get (list->data, - "height", &item_height, - "width", &item_width, - NULL); - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data), - (double) 0, - (double) running_height); - running_height += item_height; - if (max_width < item_width) - max_width = item_width; - list = g_list_next(list); - - for( ; list; list = g_list_next(list)) { - running_height += e_canvas_vbox->spacing; - - g_object_get (list->data, - "height", &item_height, - "width", &item_width, - NULL); - - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data), - (double) 0, - (double) running_height); - - running_height += item_height; - if (max_width < item_width) - max_width = item_width; - } - - } - e_canvas_vbox->height = running_height; - e_canvas_vbox->width = max_width; - if (old_height != e_canvas_vbox->height || - old_width != e_canvas_vbox->width) - e_canvas_item_request_parent_reflow(item); - } -} - -void -e_canvas_vbox_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item) -{ - if (E_CANVAS_VBOX_CLASS(GTK_OBJECT_GET_CLASS(e_canvas_vbox))->add_item) - (E_CANVAS_VBOX_CLASS(GTK_OBJECT_GET_CLASS(e_canvas_vbox))->add_item) (e_canvas_vbox, item); -} - -void -e_canvas_vbox_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item) -{ - if (E_CANVAS_VBOX_CLASS(GTK_OBJECT_GET_CLASS(e_canvas_vbox))->add_item_start) - (E_CANVAS_VBOX_CLASS(GTK_OBJECT_GET_CLASS(e_canvas_vbox))->add_item_start) (e_canvas_vbox, item); -} - diff --git a/widgets/misc/e-canvas-vbox.h b/widgets/misc/e-canvas-vbox.h deleted file mode 100644 index 7d80e7c056..0000000000 --- a/widgets/misc/e-canvas-vbox.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-canvas-vbox.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef __E_CANVAS_VBOX_H__ -#define __E_CANVAS_VBOX_H__ - -#include <gtk/gtktypeutils.h> -#include <libgnomecanvas/gnome-canvas.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* ECanvasVbox - A canvas item container. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * width double RW width of the CanvasVbox - * height double R height of the CanvasVbox - * spacing double RW Spacing between items. - */ - -#define E_CANVAS_VBOX_TYPE (e_canvas_vbox_get_type ()) -#define E_CANVAS_VBOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_CANVAS_VBOX_TYPE, ECanvasVbox)) -#define E_CANVAS_VBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_CANVAS_VBOX_TYPE, ECanvasVboxClass)) -#define E_IS_CANVAS_VBOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_CANVAS_VBOX_TYPE)) -#define E_IS_CANVAS_VBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_CANVAS_VBOX_TYPE)) - - -typedef struct _ECanvasVbox ECanvasVbox; -typedef struct _ECanvasVboxClass ECanvasVboxClass; - -struct _ECanvasVbox -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - GList *items; /* Of type GnomeCanvasItem */ - - double width; - double minimum_width; - double height; - double spacing; -}; - -struct _ECanvasVboxClass -{ - GnomeCanvasGroupClass parent_class; - - /* Virtual methods. */ - void (* add_item) (ECanvasVbox *CanvasVbox, GnomeCanvasItem *item); - void (* add_item_start) (ECanvasVbox *CanvasVbox, GnomeCanvasItem *item); -}; - -/* - * To be added to a CanvasVbox, an item must have the argument "width" as - * a Read/Write argument and "height" as a Read Only argument. It - * should also do an ECanvas parent CanvasVbox request if its size - * changes. - */ -void e_canvas_vbox_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item); -void e_canvas_vbox_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item); -GtkType e_canvas_vbox_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CANVAS_VBOX_H__ */ diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c deleted file mode 100644 index 1bbeef9a28..0000000000 --- a/widgets/misc/e-canvas.c +++ /dev/null @@ -1,1164 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-canvas.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <gtk/gtksignal.h> -#include "e-canvas.h" -#include "gal/util/e-util.h" -#include <X11/Xlib.h> -#include <gtk/gtkmain.h> - -static void e_canvas_init (ECanvas *card); -static void e_canvas_dispose (GObject *object); -static void e_canvas_class_init (ECanvasClass *klass); -static void e_canvas_realize (GtkWidget *widget); -static void e_canvas_unrealize (GtkWidget *widget); -static gint e_canvas_key (GtkWidget *widget, - GdkEventKey *event); -static gint e_canvas_button (GtkWidget *widget, - GdkEventButton *event); - -static gint e_canvas_visibility (GtkWidget *widget, - GdkEventVisibility *event, - ECanvas *canvas); - -static gint e_canvas_focus_in (GtkWidget *widget, - GdkEventFocus *event); -static gint e_canvas_focus_out (GtkWidget *widget, - GdkEventFocus *event); - -static void e_canvas_style_set (GtkWidget *widget, - GtkStyle *previous_style); - -static int emit_event (GnomeCanvas *canvas, GdkEvent *event); - -#define PARENT_TYPE GNOME_TYPE_CANVAS -static GnomeCanvasClass *parent_class = NULL; - -#define d(x) - -enum { - REFLOW, - LAST_SIGNAL -}; - -static guint e_canvas_signals [LAST_SIGNAL] = { 0, }; - -E_MAKE_TYPE (e_canvas, - "ECanvas", - ECanvas, - e_canvas_class_init, - e_canvas_init, - PARENT_TYPE) - -static void -e_canvas_class_init (ECanvasClass *klass) -{ - GObjectClass *object_class; - GnomeCanvasClass *canvas_class; - GtkWidgetClass *widget_class; - - object_class = (GObjectClass*) klass; - canvas_class = (GnomeCanvasClass *) klass; - widget_class = (GtkWidgetClass *) klass; - - parent_class = g_type_class_ref (PARENT_TYPE); - - object_class->dispose = e_canvas_dispose; - - widget_class->key_press_event = e_canvas_key; - widget_class->key_release_event = e_canvas_key; - widget_class->button_press_event = e_canvas_button; - widget_class->button_release_event = e_canvas_button; - widget_class->focus_in_event = e_canvas_focus_in; - widget_class->focus_out_event = e_canvas_focus_out; - widget_class->style_set = e_canvas_style_set; - widget_class->realize = e_canvas_realize; - widget_class->unrealize = e_canvas_unrealize; - - klass->reflow = NULL; - - e_canvas_signals [REFLOW] = - g_signal_new ("reflow", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ECanvasClass, reflow), - NULL, NULL, - e_marshal_NONE__NONE, - G_TYPE_NONE, 0); -} - -static void -e_canvas_init (ECanvas *canvas) -{ - canvas->selection = NULL; - canvas->cursor = NULL; -#ifdef GAL_GDK_IM - canvas->ic = NULL; - canvas->ic_attr = NULL; -#endif - canvas->tooltip_window = NULL; -} - -static void -e_canvas_dispose (GObject *object) -{ - ECanvas *canvas = E_CANVAS(object); - - if (canvas->idle_id) - g_source_remove(canvas->idle_id); - canvas->idle_id = 0; - - if (canvas->grab_cancelled_check_id) - g_source_remove (canvas->grab_cancelled_check_id); - canvas->grab_cancelled_check_id = 0; - - if (canvas->toplevel) { - if (canvas->visibility_notify_id) - g_signal_handler_disconnect (canvas->toplevel, - canvas->visibility_notify_id); - canvas->visibility_notify_id = 0; - - g_object_unref (canvas->toplevel); - canvas->toplevel = NULL; - } - - e_canvas_hide_tooltip(canvas); - - if ((G_OBJECT_CLASS (parent_class))->dispose) - (*(G_OBJECT_CLASS (parent_class))->dispose) (object); -} - -GtkWidget * -e_canvas_new () -{ - return GTK_WIDGET (g_object_new (E_CANVAS_TYPE, NULL)); -} - - -/* Emits an event for an item in the canvas, be it the current item, grabbed - * item, or focused item, as appropriate. - */ -static int -emit_event (GnomeCanvas *canvas, GdkEvent *event) -{ - GdkEvent *ev; - gint finished; - GnomeCanvasItem *item; - GnomeCanvasItem *parent; - guint mask; - - /* Choose where we send the event */ - - item = canvas->current_item; - - if (canvas->focused_item - && ((event->type == GDK_KEY_PRESS) || (event->type == GDK_KEY_RELEASE) || (event->type == GDK_FOCUS_CHANGE))) - item = canvas->focused_item; - - if (canvas->grabbed_item) - item = canvas->grabbed_item; - - /* Perform checks for grabbed items */ - - if (canvas->grabbed_item) { - switch (event->type) { - case GDK_ENTER_NOTIFY: - mask = GDK_ENTER_NOTIFY_MASK; - break; - - case GDK_LEAVE_NOTIFY: - mask = GDK_LEAVE_NOTIFY_MASK; - break; - - case GDK_MOTION_NOTIFY: - mask = GDK_POINTER_MOTION_MASK; - break; - - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - mask = GDK_BUTTON_PRESS_MASK; - break; - - case GDK_BUTTON_RELEASE: - mask = GDK_BUTTON_RELEASE_MASK; - break; - - case GDK_KEY_PRESS: - mask = GDK_KEY_PRESS_MASK; - break; - - case GDK_KEY_RELEASE: - mask = GDK_KEY_RELEASE_MASK; - break; - - default: - mask = 0; - break; - } - - if (!(mask & canvas->grabbed_event_mask)) - return FALSE; - } - - /* Convert to world coordinates -- we have two cases because of diferent - * offsets of the fields in the event structures. - */ - - ev = gdk_event_copy (event); - - switch (ev->type) { - case GDK_ENTER_NOTIFY: - case GDK_LEAVE_NOTIFY: - gnome_canvas_window_to_world (canvas, - ev->crossing.x, ev->crossing.y, - &ev->crossing.x, &ev->crossing.y); - break; - - case GDK_MOTION_NOTIFY: - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - gnome_canvas_window_to_world (canvas, - ev->motion.x, ev->motion.y, - &ev->motion.x, &ev->motion.y); - break; - - default: - break; - } - - /* The event is propagated up the hierarchy (for if someone connected to - * a group instead of a leaf event), and emission is stopped if a - * handler returns TRUE, just like for GtkWidget events. - */ - - finished = FALSE; - - while (item && !finished) { - g_object_ref (item); - - g_signal_emit_by_name (item, "event", ev, &finished); - - parent = item->parent; - g_object_unref (item); - - item = parent; - } - - gdk_event_free (ev); - - return finished; -} - -/* Key event handler for the canvas */ -static gint -e_canvas_key (GtkWidget *widget, GdkEventKey *event) -{ - GnomeCanvas *canvas; - GdkEvent full_event; - - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - canvas = GNOME_CANVAS (widget); - - full_event.key = *event; - - return emit_event (canvas, &full_event); -} - - -/* This routine invokes the point method of the item. The argument x, y should - * be in the parent's item-relative coordinate system. This routine applies the - * inverse of the item's transform, maintaining the affine invariant. - */ -#define HACKISH_AFFINE - -static double -gnome_canvas_item_invoke_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item) -{ -#ifdef HACKISH_AFFINE - double i2w[6], w2c[6], i2c[6], c2i[6]; - ArtPoint c, i; -#endif - -#ifdef HACKISH_AFFINE - gnome_canvas_item_i2w_affine (item, i2w); - gnome_canvas_w2c_affine (item->canvas, w2c); - art_affine_multiply (i2c, i2w, w2c); - art_affine_invert (c2i, i2c); - c.x = cx; - c.y = cy; - art_affine_point (&i, &c, c2i); - x = i.x; - y = i.y; -#endif - - return (* GNOME_CANVAS_ITEM_CLASS (GTK_OBJECT_GET_CLASS (item))->point) ( - item, x, y, cx, cy, actual_item); -} - -/* Re-picks the current item in the canvas, based on the event's coordinates. - * Also emits enter/leave events for items as appropriate. - */ -#define DISPLAY_X1(canvas) (GNOME_CANVAS (canvas)->layout.xoffset) -#define DISPLAY_Y1(canvas) (GNOME_CANVAS (canvas)->layout.yoffset) -static int -pick_current_item (GnomeCanvas *canvas, GdkEvent *event) -{ - int button_down; - double x, y; - int cx, cy; - int retval; - - retval = FALSE; - - /* If a button is down, we'll perform enter and leave events on the - * current item, but not enter on any other item. This is more or less - * like X pointer grabbing for canvas items. - */ - button_down = canvas->state & (GDK_BUTTON1_MASK - | GDK_BUTTON2_MASK - | GDK_BUTTON3_MASK - | GDK_BUTTON4_MASK - | GDK_BUTTON5_MASK); - d(g_print ("%s:%d: button_down = %s\n", __FUNCTION__, __LINE__, button_down ? "TRUE" : "FALSE")); - if (!button_down) - canvas->left_grabbed_item = FALSE; - - /* Save the event in the canvas. This is used to synthesize enter and - * leave events in case the current item changes. It is also used to - * re-pick the current item if the current one gets deleted. Also, - * synthesize an enter event. - */ - if (event != &canvas->pick_event) { - if ((event->type == GDK_MOTION_NOTIFY) || (event->type == GDK_BUTTON_RELEASE)) { - /* these fields have the same offsets in both types of events */ - - canvas->pick_event.crossing.type = GDK_ENTER_NOTIFY; - canvas->pick_event.crossing.window = event->motion.window; - canvas->pick_event.crossing.send_event = event->motion.send_event; - canvas->pick_event.crossing.subwindow = NULL; - canvas->pick_event.crossing.x = event->motion.x; - canvas->pick_event.crossing.y = event->motion.y; - canvas->pick_event.crossing.mode = GDK_CROSSING_NORMAL; - canvas->pick_event.crossing.detail = GDK_NOTIFY_NONLINEAR; - canvas->pick_event.crossing.focus = FALSE; - canvas->pick_event.crossing.state = event->motion.state; - - /* these fields don't have the same offsets in both types of events */ - - if (event->type == GDK_MOTION_NOTIFY) { - canvas->pick_event.crossing.x_root = event->motion.x_root; - canvas->pick_event.crossing.y_root = event->motion.y_root; - } else { - canvas->pick_event.crossing.x_root = event->button.x_root; - canvas->pick_event.crossing.y_root = event->button.y_root; - } - } else - canvas->pick_event = *event; - } - - /* Don't do anything else if this is a recursive call */ - - if (canvas->in_repick) - return retval; - - /* LeaveNotify means that there is no current item, so we don't look for one */ - - if (canvas->pick_event.type != GDK_LEAVE_NOTIFY) { - /* these fields don't have the same offsets in both types of events */ - - if (canvas->pick_event.type == GDK_ENTER_NOTIFY) { - x = canvas->pick_event.crossing.x + canvas->scroll_x1 - canvas->zoom_xofs; - y = canvas->pick_event.crossing.y + canvas->scroll_y1 - canvas->zoom_yofs; - } else { - x = canvas->pick_event.motion.x + canvas->scroll_x1 - canvas->zoom_xofs; - y = canvas->pick_event.motion.y + canvas->scroll_y1 - canvas->zoom_yofs; - } - - /* canvas pixel coords */ - - cx = (int) (x + 0.5); - cy = (int) (y + 0.5); - - /* world coords */ - - x = canvas->scroll_x1 + x / canvas->pixels_per_unit; - y = canvas->scroll_y1 + y / canvas->pixels_per_unit; - - /* find the closest item */ - - if (canvas->root->object.flags & GNOME_CANVAS_ITEM_VISIBLE) - gnome_canvas_item_invoke_point (canvas->root, x, y, cx, cy, - &canvas->new_current_item); - else - canvas->new_current_item = NULL; - } else - canvas->new_current_item = NULL; - - if ((canvas->new_current_item == canvas->current_item) && !canvas->left_grabbed_item) - return retval; /* current item did not change */ - - /* Synthesize events for old and new current items */ - - if ((canvas->new_current_item != canvas->current_item) - && (canvas->current_item != NULL) - && !canvas->left_grabbed_item) { - GdkEvent new_event; - GnomeCanvasItem *item; - - item = canvas->current_item; - - new_event = canvas->pick_event; - new_event.type = GDK_LEAVE_NOTIFY; - - new_event.crossing.detail = GDK_NOTIFY_ANCESTOR; - new_event.crossing.subwindow = NULL; - canvas->in_repick = TRUE; - retval = emit_event (canvas, &new_event); - canvas->in_repick = FALSE; - } - - /* new_current_item may have been set to NULL during the call to emit_event() above */ - - if ((canvas->new_current_item != canvas->current_item) && button_down) { - canvas->left_grabbed_item = TRUE; - return retval; - } - - /* Handle the rest of cases */ - - canvas->left_grabbed_item = FALSE; - canvas->current_item = canvas->new_current_item; - - if (canvas->current_item != NULL) { - GdkEvent new_event; - - new_event = canvas->pick_event; - new_event.type = GDK_ENTER_NOTIFY; - new_event.crossing.detail = GDK_NOTIFY_ANCESTOR; - new_event.crossing.subwindow = NULL; - retval = emit_event (canvas, &new_event); - } - - return retval; -} - -/* Button event handler for the canvas */ -static gint -e_canvas_button (GtkWidget *widget, GdkEventButton *event) -{ - GnomeCanvas *canvas; - int mask; - int retval; - - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - retval = FALSE; - - canvas = GNOME_CANVAS (widget); - - d(g_print ("button %d, event type %d, grabbed=%p, current=%p\n", - event->button, - event->type, - canvas->grabbed_item, - canvas->current_item)); - - /* dispatch normally regardless of the event's window if an item has - has a pointer grab in effect */ - if (!canvas->grabbed_item && event->window != canvas->layout.bin_window) - return retval; - - switch (event->button) { - case 1: - mask = GDK_BUTTON1_MASK; - break; - case 2: - mask = GDK_BUTTON2_MASK; - break; - case 3: - mask = GDK_BUTTON3_MASK; - break; - case 4: - mask = GDK_BUTTON4_MASK; - break; - case 5: - mask = GDK_BUTTON5_MASK; - break; - default: - mask = 0; - } - - switch (event->type) { - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - /* Pick the current item as if the button were not pressed, and - * then process the event. - */ - canvas->state = event->state; - pick_current_item (canvas, (GdkEvent *) event); - canvas->state ^= mask; - retval = emit_event (canvas, (GdkEvent *) event); - break; - - case GDK_BUTTON_RELEASE: - /* Process the event as if the button were pressed, then repick - * after the button has been released - */ - canvas->state = event->state; - retval = emit_event (canvas, (GdkEvent *) event); - event->state ^= mask; - canvas->state = event->state; - pick_current_item (canvas, (GdkEvent *) event); - event->state ^= mask; - break; - - default: - g_assert_not_reached (); - } - - return retval; -} - -/* Key event handler for the canvas */ -static gint -e_canvas_visibility (GtkWidget *widget, GdkEventVisibility *event, ECanvas *canvas) -{ - if (! canvas->visibility_first) { - e_canvas_hide_tooltip(canvas); - } - canvas->visibility_first = FALSE; - - return FALSE; -} - - -/** - * e_canvas_item_grab_focus: - * @item: A canvas item. - * @widget_too: Whether or not to grab the widget-level focus too - * - * Makes the specified item take the keyboard focus, so all keyboard - * events will be sent to it. If the canvas widget itself did not have - * the focus and @widget_too is %TRUE, it grabs that focus as well. - **/ -void -e_canvas_item_grab_focus (GnomeCanvasItem *item, gboolean widget_too) -{ - GnomeCanvasItem *focused_item; - GdkEvent ev; - - g_return_if_fail (item != NULL); - g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); - g_return_if_fail (GTK_WIDGET_CAN_FOCUS (GTK_WIDGET (item->canvas))); - - focused_item = item->canvas->focused_item; - - if (focused_item) { - ev.focus_change.type = GDK_FOCUS_CHANGE; - ev.focus_change.window = GTK_LAYOUT (item->canvas)->bin_window; - ev.focus_change.send_event = FALSE; - ev.focus_change.in = FALSE; - - emit_event (item->canvas, &ev); - } - - item->canvas->focused_item = item; - - if (widget_too && !GTK_WIDGET_HAS_FOCUS (GTK_WIDGET(item->canvas))) { - gtk_widget_grab_focus (GTK_WIDGET (item->canvas)); - } - - if (item) { - ev.focus_change.type = GDK_FOCUS_CHANGE; - ev.focus_change.window = GTK_LAYOUT (item->canvas)->bin_window; - ev.focus_change.send_event = FALSE; - ev.focus_change.in = TRUE; - - emit_event (item->canvas, &ev); - } -} - -/* Focus in handler for the canvas */ -static gint -e_canvas_focus_in (GtkWidget *widget, GdkEventFocus *event) -{ - GnomeCanvas *canvas; - ECanvas *ecanvas; - GdkEvent full_event; - - canvas = GNOME_CANVAS (widget); - ecanvas = E_CANVAS (widget); - - GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); - -#ifdef GAL_GDK_IM - if (ecanvas->ic) - gdk_im_begin (ecanvas->ic, canvas->layout.bin_window); -#endif - - if (canvas->focused_item) { - full_event.focus_change = *event; - return emit_event (canvas, &full_event); - } else { - return FALSE; - } -} - -/* Focus out handler for the canvas */ -static gint -e_canvas_focus_out (GtkWidget *widget, GdkEventFocus *event) -{ - GnomeCanvas *canvas; - ECanvas *ecanvas; - GdkEvent full_event; - - canvas = GNOME_CANVAS (widget); - ecanvas = E_CANVAS (widget); - - GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); - -#ifdef GAL_GDK_IM - if (ecanvas->ic) - gdk_im_end (); -#endif - - if (canvas->focused_item) { - full_event.focus_change = *event; - return emit_event (canvas, &full_event); - } else { - return FALSE; - } -} - -static void -ec_style_set_recursive (GnomeCanvasItem *item, GtkStyle *previous_style) -{ - guint signal_id = g_signal_lookup ("style_set", G_OBJECT_TYPE (item)); - if (signal_id >= 1) { - GSignalQuery query; - g_signal_query (signal_id, &query); - if (query.return_type == GTK_TYPE_NONE && query.n_params == 1 && query.param_types[0] == GTK_TYPE_STYLE) { - g_signal_emit (item, signal_id, 0, previous_style); - } - } - - if (GNOME_IS_CANVAS_GROUP (item) ) { - GList *items = GNOME_CANVAS_GROUP (item)->item_list; - for (; items; items = items->next) - ec_style_set_recursive (items->data, previous_style); - } -} - -static void -e_canvas_style_set (GtkWidget *widget, GtkStyle *previous_style) -{ - ec_style_set_recursive (GNOME_CANVAS_ITEM (gnome_canvas_root (GNOME_CANVAS (widget))), previous_style); -} - - -static void -e_canvas_realize (GtkWidget *widget) -{ -#ifdef GAL_GDK_IM - gint width, height; - ECanvas *ecanvas = E_CANVAS (widget); -#endif - - if (GTK_WIDGET_CLASS (parent_class)->realize) - (* GTK_WIDGET_CLASS (parent_class)->realize) (widget); - - gdk_window_set_back_pixmap (GTK_LAYOUT (widget)->bin_window, NULL, FALSE); - -#ifdef GAL_GDK_IM - if (gdk_im_ready () && (ecanvas->ic_attr = gdk_ic_attr_new ()) != NULL) { - GdkEventMask mask; - GdkICAttr *attr = ecanvas->ic_attr; - GdkICAttributesType attrmask = GDK_IC_ALL_REQ; - GdkIMStyle style; - GdkIMStyle supported_style = GDK_IM_PREEDIT_NONE | - GDK_IM_PREEDIT_NOTHING | - GDK_IM_PREEDIT_POSITION | - GDK_IM_STATUS_NONE | - GDK_IM_STATUS_NOTHING; - - if(widget->style && widget->style->font->type != GDK_FONT_FONTSET) - supported_style &= ~GDK_IM_PREEDIT_POSITION; - - attr->style = style = gdk_im_decide_style (supported_style); - attr->client_window = ecanvas->parent.layout.bin_window; - - switch (style & GDK_IM_PREEDIT_MASK) - { - case GDK_IM_PREEDIT_POSITION: - if (widget->style && widget->style->font->type != GDK_FONT_FONTSET) - { - g_warning ("over-the-spot style requires fontset"); - break; - } - - gdk_window_get_size (attr->client_window, &width, &height); - height = widget->style->font->ascent + - widget->style->font->descent; - - attrmask |= GDK_IC_PREEDIT_POSITION_REQ; - attr->spot_location.x = 0; - attr->spot_location.y = height; - attr->preedit_area.x = 0; - attr->preedit_area.y = 0; - attr->preedit_area.width = width; - attr->preedit_area.height = height; - attr->preedit_fontset = widget->style->font; - - break; - } - - ecanvas->ic = gdk_ic_new (attr, attrmask); - if (ecanvas->ic != NULL) { - mask = gdk_window_get_events (attr->client_window); - mask |= gdk_ic_get_events (ecanvas->ic); - gdk_window_set_events (attr->client_window, mask); - - if (GTK_WIDGET_HAS_FOCUS (widget)) - gdk_im_begin (ecanvas->ic, attr->client_window); - } else - g_warning ("Can't create input context."); - } -#endif -} - -static void -e_canvas_unrealize (GtkWidget *widget) -{ - ECanvas * ecanvas = E_CANVAS (widget); - - if (ecanvas->idle_id) { - g_source_remove(ecanvas->idle_id); - ecanvas->idle_id = 0; - } - -#ifdef GAL_GDK_IM - if (ecanvas->ic) { - gdk_ic_destroy (ecanvas->ic); - ecanvas->ic = NULL; - } - if (ecanvas->ic_attr) { - gdk_ic_attr_destroy (ecanvas->ic_attr); - ecanvas->ic_attr = NULL; - } -#endif - if (GTK_WIDGET_CLASS (parent_class)->unrealize) - (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); -} - -static void -e_canvas_item_invoke_reflow (GnomeCanvasItem *item, int flags) -{ - GnomeCanvasGroup *group; - GList *list; - GnomeCanvasItem *child; - - if (GNOME_IS_CANVAS_GROUP (item)) { - group = GNOME_CANVAS_GROUP (item); - for (list = group->item_list; list; list = list->next) { - child = GNOME_CANVAS_ITEM (list->data); - if (child->object.flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW) - e_canvas_item_invoke_reflow (child, flags); - } - } - - if (item->object.flags & E_CANVAS_ITEM_NEEDS_REFLOW) { - ECanvasItemReflowFunc func; - func = (ECanvasItemReflowFunc) - g_object_get_data (G_OBJECT (item), - "ECanvasItem::reflow_callback"); - if (func) - func (item, flags); - } - - item->object.flags &= ~E_CANVAS_ITEM_NEEDS_REFLOW; - item->object.flags &= ~E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW; -} - -static void -do_reflow (ECanvas *canvas) -{ - if (GNOME_CANVAS(canvas)->root->object.flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW) - e_canvas_item_invoke_reflow (GNOME_CANVAS(canvas)->root, 0); -} - -/* Idle handler for the e-canvas. It deals with pending reflows. */ -static gint -idle_handler (gpointer data) -{ - ECanvas *canvas; - - GDK_THREADS_ENTER(); - - canvas = E_CANVAS (data); - do_reflow (canvas); - - /* Reset idle id */ - canvas->idle_id = 0; - - g_signal_emit (canvas, - e_canvas_signals [REFLOW], 0); - - GDK_THREADS_LEAVE(); - - return FALSE; -} - -/* Convenience function to add an idle handler to a canvas */ -static void -add_idle (ECanvas *canvas) -{ - if (canvas->idle_id != 0) - return; - - canvas->idle_id = g_idle_add_full (G_PRIORITY_HIGH_IDLE, idle_handler, (gpointer) canvas, NULL); -} - -static void -e_canvas_item_descendent_needs_reflow (GnomeCanvasItem *item) -{ - if (item->object.flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW) - return; - - item->object.flags |= E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW; - if (item->parent) - e_canvas_item_descendent_needs_reflow(item->parent); -} - -void -e_canvas_item_request_reflow (GnomeCanvasItem *item) -{ - if (item->object.flags & GNOME_CANVAS_ITEM_REALIZED) { - item->object.flags |= E_CANVAS_ITEM_NEEDS_REFLOW; - e_canvas_item_descendent_needs_reflow(item); - add_idle(E_CANVAS(item->canvas)); - } -} - -void -e_canvas_item_request_parent_reflow (GnomeCanvasItem *item) -{ - g_return_if_fail(item != NULL); - g_return_if_fail(GNOME_IS_CANVAS_ITEM(item)); - e_canvas_item_request_reflow(item->parent); -} - -void -e_canvas_item_set_reflow_callback (GnomeCanvasItem *item, ECanvasItemReflowFunc func) -{ - g_object_set_data(G_OBJECT(item), "ECanvasItem::reflow_callback", (gpointer) func); -} - - -void -e_canvas_item_set_selection_callback (GnomeCanvasItem *item, ECanvasItemSelectionFunc func) -{ - g_object_set_data(G_OBJECT(item), "ECanvasItem::selection_callback", (gpointer) func); -} - -void -e_canvas_item_set_selection_compare_callback (GnomeCanvasItem *item, ECanvasItemSelectionCompareFunc func) -{ - g_object_set_data(G_OBJECT(item), "ECanvasItem::selection_compare_callback", (gpointer) func); -} - -void -e_canvas_item_set_cursor (GnomeCanvasItem *item, gpointer id) -{ - GList *list; - int flags; - ECanvas *canvas; - ECanvasSelectionInfo *info; - ECanvasItemSelectionFunc func; - - g_return_if_fail(item != NULL); - g_return_if_fail(GNOME_IS_CANVAS_ITEM(item)); - g_return_if_fail(item->canvas != NULL); - g_return_if_fail(E_IS_CANVAS(item->canvas)); - - canvas = E_CANVAS(item->canvas); - flags = E_CANVAS_ITEM_SELECTION_DELETE_DATA; - - for (list = canvas->selection; list; list = g_list_next(list)) { - info = list->data; - - func = (ECanvasItemSelectionFunc)g_object_get_data(G_OBJECT(info->item), - "ECanvasItem::selection_callback"); - if (func) - func(info->item, flags, info->id); - g_message ("ECANVAS: free info (2): item %p, id %p", - info->item, info->id); - g_object_unref (info->item); - g_free(info); - } - g_list_free(canvas->selection); - - canvas->selection = NULL; - - gnome_canvas_item_grab_focus(item); - - info = g_new(ECanvasSelectionInfo, 1); - info->item = item; - g_object_ref (info->item); - info->id = id; - g_message ("ECANVAS: new info item %p, id %p", item, id); - - flags = E_CANVAS_ITEM_SELECTION_SELECT | E_CANVAS_ITEM_SELECTION_CURSOR; - func = (ECanvasItemSelectionFunc)g_object_get_data(G_OBJECT(item), - "ECanvasItem::selection_callback"); - if (func) - func(item, flags, id); - - canvas->selection = g_list_prepend(canvas->selection, info); - canvas->cursor = info; -} - -void -e_canvas_item_set_cursor_end (GnomeCanvasItem *item, gpointer id) -{ -} - -void -e_canvas_item_add_selection (GnomeCanvasItem *item, gpointer id) -{ - int flags; - ECanvas *canvas; - ECanvasSelectionInfo *info; - ECanvasItemSelectionFunc func; - GList *list; - - g_return_if_fail(item != NULL); - g_return_if_fail(GNOME_IS_CANVAS_ITEM(item)); - g_return_if_fail(item->canvas != NULL); - g_return_if_fail(E_IS_CANVAS(item->canvas)); - - flags = E_CANVAS_ITEM_SELECTION_SELECT; - canvas = E_CANVAS(item->canvas); - - if (canvas->cursor) { - func = (ECanvasItemSelectionFunc)g_object_get_data(G_OBJECT(canvas->cursor->item), - "ECanvasItem::selection_callback"); - if (func) - func(canvas->cursor->item, flags, canvas->cursor->id); - } - - gnome_canvas_item_grab_focus(item); - - flags = E_CANVAS_ITEM_SELECTION_SELECT | E_CANVAS_ITEM_SELECTION_CURSOR; - - for (list = canvas->selection; list; list = g_list_next(list)) { - ECanvasSelectionInfo *search; - search = list->data; - - if (search->item == item) { - ECanvasItemSelectionCompareFunc compare_func; - compare_func = (ECanvasItemSelectionCompareFunc)g_object_get_data(G_OBJECT(search->item), - "ECanvasItem::selection_compare_callback"); - - if (compare_func(search->item, search->id, id, 0) == 0) { - canvas->cursor = search; - func = (ECanvasItemSelectionFunc)g_object_get_data(G_OBJECT(item), - "ECanvasItem::selection_callback"); - if (func) - func(item, flags, search->id); - return; - } - } - } - - info = g_new(ECanvasSelectionInfo, 1); - info->item = item; - g_object_ref (info->item); - info->id = id; - g_message ("ECANVAS: new info (2): item %p, id %p", item, id); - - func = (ECanvasItemSelectionFunc)g_object_get_data(G_OBJECT(item), - "ECanvasItem::selection_callback"); - if (func) - func(item, flags, id); - - canvas->selection = g_list_prepend(canvas->selection, info); - canvas->cursor = info; -} - -void -e_canvas_item_remove_selection (GnomeCanvasItem *item, gpointer id) -{ - int flags; - ECanvas *canvas; - ECanvasSelectionInfo *info; - GList *list; - - g_return_if_fail(item != NULL); - g_return_if_fail(GNOME_IS_CANVAS_ITEM(item)); - g_return_if_fail(item->canvas != NULL); - g_return_if_fail(E_IS_CANVAS(item->canvas)); - - flags = E_CANVAS_ITEM_SELECTION_DELETE_DATA; - canvas = E_CANVAS(item->canvas); - - for (list = canvas->selection; list; list = g_list_next(list)) { - info = list->data; - - if (info->item == item) { - ECanvasItemSelectionCompareFunc compare_func; - compare_func = (ECanvasItemSelectionCompareFunc)g_object_get_data(G_OBJECT(info->item), - "ECanvasItem::selection_compare_callback"); - - if (compare_func(info->item, info->id, id, 0) == 0) { - ECanvasItemSelectionFunc func; - func = (ECanvasItemSelectionFunc) g_object_get_data(G_OBJECT(info->item), - "ECanvasItem::selection_callback"); - if (func) - func(info->item, flags, info->id); - canvas->selection = g_list_remove_link(canvas->selection, list); - - if (canvas->cursor == info) - canvas->cursor = NULL; - - g_message ("ECANVAS: removing info: item %p, info %p", - info->item, info->id); - g_object_unref (info->item); - g_free(info); - g_list_free_1(list); - break; - } - } - } -} - -void e_canvas_popup_tooltip (ECanvas *canvas, GtkWidget *widget, int x, int y) -{ - if (canvas->tooltip_window && canvas->tooltip_window != widget) { - e_canvas_hide_tooltip(canvas); - } - canvas->tooltip_window = widget; - canvas->visibility_first = TRUE; - if (canvas->toplevel == NULL) { - canvas->toplevel = gtk_widget_get_toplevel (GTK_WIDGET(canvas)); - if (canvas->toplevel) { - gtk_widget_add_events(canvas->toplevel, GDK_VISIBILITY_NOTIFY_MASK); - g_object_ref (canvas->toplevel); - canvas->visibility_notify_id = - g_signal_connect (canvas->toplevel, "visibility_notify_event", - G_CALLBACK (e_canvas_visibility), canvas); - } - } - gtk_widget_set_uposition (widget, x, y); - gtk_widget_show (widget); -} - -void e_canvas_hide_tooltip (ECanvas *canvas) -{ - if (canvas->tooltip_window) { - gtk_widget_destroy (canvas->tooltip_window); - canvas->tooltip_window = NULL; - } -} - - -static gboolean -grab_cancelled_check (gpointer data) -{ - ECanvas *canvas = data; - - if (GNOME_CANVAS (canvas)->grabbed_item == NULL) { - canvas->grab_cancelled_cb = NULL; - canvas->grab_cancelled_check_id = 0; - canvas->grab_cancelled_time = 0; - canvas->grab_cancelled_data = NULL; - return FALSE; - } - - if (gtk_grab_get_current ()) { - gnome_canvas_item_ungrab(GNOME_CANVAS (canvas)->grabbed_item, canvas->grab_cancelled_time); - if (canvas->grab_cancelled_cb) { - canvas->grab_cancelled_cb (canvas, - GNOME_CANVAS (canvas)->grabbed_item, - canvas->grab_cancelled_data); - } - canvas->grab_cancelled_cb = NULL; - canvas->grab_cancelled_check_id = 0; - canvas->grab_cancelled_time = 0; - canvas->grab_cancelled_data = NULL; - return FALSE; - } - return TRUE; -} - -int -e_canvas_item_grab (ECanvas *canvas, - GnomeCanvasItem *item, - guint event_mask, - GdkCursor *cursor, - guint32 etime, - ECanvasItemGrabCancelled cancelled_cb, - gpointer cancelled_data) -{ - if (gtk_grab_get_current ()) { - return AlreadyGrabbed; - } else { - int ret_val = gnome_canvas_item_grab (item, event_mask, cursor, etime); - if (ret_val == GrabSuccess) { - canvas->grab_cancelled_cb = cancelled_cb; - canvas->grab_cancelled_check_id = - g_timeout_add_full (G_PRIORITY_LOW, - 100, - grab_cancelled_check, - canvas, - NULL); - canvas->grab_cancelled_time = etime; - canvas->grab_cancelled_data = cancelled_data; - } - - return ret_val; - } -} - -void -e_canvas_item_ungrab (ECanvas *canvas, - GnomeCanvasItem *item, - guint32 etime) -{ - if (canvas->grab_cancelled_check_id) { - g_source_remove (canvas->grab_cancelled_check_id); - canvas->grab_cancelled_cb = NULL; - canvas->grab_cancelled_check_id = 0; - canvas->grab_cancelled_time = 0; - canvas->grab_cancelled_data = NULL; - gnome_canvas_item_ungrab (item, etime); - } -} diff --git a/widgets/misc/e-canvas.h b/widgets/misc/e-canvas.h deleted file mode 100644 index 5cdcc4ab90..0000000000 --- a/widgets/misc/e-canvas.h +++ /dev/null @@ -1,158 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-canvas.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef __E_CANVAS_H__ -#define __E_CANVAS_H__ - -#include <libgnomecanvas/gnome-canvas.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* ECanvas - A class derived from canvas for the purpose of adding - * evolution specific canvas hacks. - */ - -#define E_CANVAS_TYPE (e_canvas_get_type ()) -#define E_CANVAS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_CANVAS_TYPE, ECanvas)) -#define E_CANVAS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_CANVAS_TYPE, ECanvasClass)) -#define E_IS_CANVAS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_CANVAS_TYPE)) -#define E_IS_CANVAS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_CANVAS_TYPE)) - -typedef void (*ECanvasItemReflowFunc) (GnomeCanvasItem *item, - gint flags); - -typedef void (*ECanvasItemSelectionFunc) (GnomeCanvasItem *item, - gint flags, - gpointer user_data); -/* Returns the same as strcmp does. */ -typedef gint (*ECanvasItemSelectionCompareFunc) (GnomeCanvasItem *item, - gpointer data1, - gpointer data2, - gint flags); - - -typedef struct _ECanvas ECanvas; -typedef struct _ECanvasClass ECanvasClass; - -/* Object flags for items */ -enum { - E_CANVAS_ITEM_NEEDS_REFLOW = 1 << 13, - E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW = 1 << 14 -}; - -enum { - E_CANVAS_ITEM_SELECTION_SELECT = 1 << 0, /* TRUE = select. FALSE = unselect. */ - E_CANVAS_ITEM_SELECTION_CURSOR = 1 << 1, /* TRUE = has become cursor. FALSE = not cursor. */ - E_CANVAS_ITEM_SELECTION_DELETE_DATA = 1 << 2 -}; - -typedef struct { - GnomeCanvasItem *item; - gpointer id; -} ECanvasSelectionInfo; - -typedef void (*ECanvasItemGrabCancelled) (ECanvas *canvas, GnomeCanvasItem *item, gpointer data); - -struct _ECanvas -{ - GnomeCanvas parent; - - int idle_id; - GList *selection; - ECanvasSelectionInfo *cursor; - - GtkWidget *tooltip_window; - int visibility_notify_id; - GtkWidget *toplevel; - guint visibility_first : 1; -#ifdef GAL_GDK_IM - /* Input context for dead key support */ - GdkIC *ic; - GdkICAttr *ic_attr; -#endif - - ECanvasItemGrabCancelled grab_cancelled_cb; - guint grab_cancelled_check_id; - guint32 grab_cancelled_time; - gpointer grab_cancelled_data; -}; - -struct _ECanvasClass -{ - GnomeCanvasClass parent_class; - void (* reflow) (ECanvas *canvas); -}; - - -GtkType e_canvas_get_type (void); -GtkWidget *e_canvas_new (void); - -/* Used to send all of the keystroke events to a specific item as well as - * GDK_FOCUS_CHANGE events. - */ -void e_canvas_item_grab_focus (GnomeCanvasItem *item, - gboolean widget_too); -void e_canvas_item_request_reflow (GnomeCanvasItem *item); -void e_canvas_item_request_parent_reflow (GnomeCanvasItem *item); -void e_canvas_item_set_reflow_callback (GnomeCanvasItem *item, - ECanvasItemReflowFunc func); -void e_canvas_item_set_selection_callback (GnomeCanvasItem *item, - ECanvasItemSelectionFunc func); -void e_canvas_item_set_selection_compare_callback (GnomeCanvasItem *item, - ECanvasItemSelectionCompareFunc func); -void e_canvas_item_set_cursor (GnomeCanvasItem *item, - gpointer id); -void e_canvas_item_add_selection (GnomeCanvasItem *item, - gpointer id); -void e_canvas_item_remove_selection (GnomeCanvasItem *item, - gpointer id); - -int e_canvas_item_grab (ECanvas *canvas, - GnomeCanvasItem *item, - guint event_mask, - GdkCursor *cursor, - guint32 etime, - ECanvasItemGrabCancelled cancelled, - gpointer cancelled_data); -void e_canvas_item_ungrab (ECanvas *canvas, - GnomeCanvasItem *item, - guint32 etime); - -/* Not implemented yet. */ -void e_canvas_item_set_cursor_end (GnomeCanvasItem *item, - gpointer id); -void e_canvas_popup_tooltip (ECanvas *canvas, - GtkWidget *widget, - int x, - int y); -void e_canvas_hide_tooltip (ECanvas *canvas); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CANVAS_H__ */ diff --git a/widgets/misc/e-colors.c b/widgets/misc/e-colors.c deleted file mode 100644 index 3f16437bee..0000000000 --- a/widgets/misc/e-colors.c +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-colors.c - General color allocation utilities - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Miguel de Icaza (miguel@kernel.org) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -/* We keep our own color context, as the color allocation might take - * place before things are realized. - */ - -#include <config.h> -#include <gtk/gtkwidget.h> -#include "e-colors.h" - -GdkColor e_white, e_dark_gray, e_black; - -gulong -e_color_alloc (gushort red, gushort green, gushort blue) -{ - e_color_init (); - - red >>= 8; - green >>= 8; - blue >>= 8; - return gdk_rgb_xpixel_from_rgb ( - ((red & 0xff) << 16) | ((green & 0xff) << 8) | - (blue & 0xff)); -} - -void -e_color_alloc_gdk (GtkWidget *widget, GdkColor *c) -{ - GdkColormap *map; - - e_color_init (); - - if (widget) - map = gtk_widget_get_colormap (widget); - else /* FIXME: multi depth broken ? */ - map = gtk_widget_get_default_colormap (); - - gdk_rgb_find_color (map, c); -} - -void -e_color_alloc_name (GtkWidget *widget, const char *name, GdkColor *c) -{ - GdkColormap *map; - - e_color_init (); - - gdk_color_parse (name, c); - - if (widget) - map = gtk_widget_get_colormap (widget); - else /* FIXME: multi depth broken ? */ - map = gtk_widget_get_default_colormap (); - - gdk_rgb_find_color (map, c); -} - -void -e_color_init (void) -{ - static gboolean e_color_inited = FALSE; - - /* It's surprisingly easy to end up calling this twice. Survive. */ - if (e_color_inited) - return; - - e_color_inited = TRUE; - - /* Allocate the default colors */ - e_white.red = 65535; - e_white.green = 65535; - e_white.blue = 65535; - e_color_alloc_gdk (NULL, &e_white); - - e_black.red = 0; - e_black.green = 0; - e_black.blue = 0; - e_color_alloc_gdk (NULL, &e_black); - - e_color_alloc_name (NULL, "gray20", &e_dark_gray); -} - diff --git a/widgets/misc/e-colors.h b/widgets/misc/e-colors.h deleted file mode 100644 index 596fd2b0a5..0000000000 --- a/widgets/misc/e-colors.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-colors.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Miguel de Icaza (miguel@kernel.org) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef GNOME_APP_LIBS_COLOR_H -#define GNOME_APP_LIBS_COLOR_H - -#include <glib.h> -#include <gdk/gdk.h> -#include <gtk/gtkwidget.h> - -G_BEGIN_DECLS - -void e_color_init (void); - -/* Return the pixel value for the given red, green and blue */ -gulong e_color_alloc (gushort red, gushort green, gushort blue); -void e_color_alloc_name (GtkWidget *widget, const char *name, GdkColor *color); -void e_color_alloc_gdk (GtkWidget *widget, GdkColor *color); - -extern GdkColor e_white, e_dark_gray, e_black; - -G_END_DECLS - -#endif /* GNOME_APP_LIBS_COLOR_H */ diff --git a/widgets/misc/e-combo-button.h b/widgets/misc/e-combo-button.h index fa4dcc65a2..b71494b46e 100644 --- a/widgets/misc/e-combo-button.h +++ b/widgets/misc/e-combo-button.h @@ -23,10 +23,6 @@ #ifndef _E_COMBO_BUTTON_H_ #define _E_COMBO_BUTTON_H_ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - #include <gtk/gtkbutton.h> #include <gtk/gtkmenu.h> @@ -38,10 +34,10 @@ extern "C" { #endif /* __cplusplus */ #define E_TYPE_COMBO_BUTTON (e_combo_button_get_type ()) -#define E_COMBO_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_COMBO_BUTTON, EComboButton)) -#define E_COMBO_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_COMBO_BUTTON, EComboButtonClass)) -#define E_IS_COMBO_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_COMBO_BUTTON)) -#define E_IS_COMBO_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_COMBO_BUTTON)) +#define E_COMBO_BUTTON(obj) (GTK_CHECK_CAST ((obj), E_TYPE_COMBO_BUTTON, EComboButton)) +#define E_COMBO_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_COMBO_BUTTON, EComboButtonClass)) +#define E_IS_COMBO_BUTTON(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_COMBO_BUTTON)) +#define E_IS_COMBO_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_COMBO_BUTTON)) typedef struct _EComboButton EComboButton; diff --git a/widgets/misc/e-config-page.h b/widgets/misc/e-config-page.h index 4862f8b1b5..12e8d9e73d 100644 --- a/widgets/misc/e-config-page.h +++ b/widgets/misc/e-config-page.h @@ -23,10 +23,6 @@ #ifndef _E_CONFIG_PAGE_H_ #define _E_CONFIG_PAGE_H_ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - #include <gnome.h> #ifdef __cplusplus @@ -35,10 +31,10 @@ extern "C" { #endif /* __cplusplus */ #define E_TYPE_CONFIG_PAGE (e_config_page_get_type ()) -#define E_CONFIG_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CONFIG_PAGE, EConfigPage)) -#define E_CONFIG_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CONFIG_PAGE, EConfigPageClass)) -#define E_IS_CONFIG_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CONFIG_PAGE)) -#define E_IS_CONFIG_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_CONFIG_PAGE)) +#define E_CONFIG_PAGE(obj) (GTK_CHECK_CAST ((obj), E_TYPE_CONFIG_PAGE, EConfigPage)) +#define E_CONFIG_PAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_CONFIG_PAGE, EConfigPageClass)) +#define E_IS_CONFIG_PAGE(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_CONFIG_PAGE)) +#define E_IS_CONFIG_PAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_CONFIG_PAGE)) typedef struct _EConfigPage EConfigPage; diff --git a/widgets/misc/e-cursors.c b/widgets/misc/e-cursors.c deleted file mode 100644 index 3b44ab809e..0000000000 --- a/widgets/misc/e-cursors.c +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-cursors.c - cursor handling for gnumeric - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Miguel de Icaza (miguel@gnu.org) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <config.h> - -#include "e-cursors.h" - -#include "e-colors.h" -#include "pixmaps/cursor_cross.xpm" -#include "pixmaps/cursor_zoom_in.xpm" -#include "pixmaps/cursor_zoom_out.xpm" -#include "pixmaps/cursor_hand_open.xpm" -#include "pixmaps/cursor_hand_closed.xpm" -#include <stdio.h> - -#define GDK_INTERNAL_CURSOR -1 - -typedef struct { - GdkCursor *cursor; - int hot_x, hot_y; - char **xpm; -} CursorDef; - -static CursorDef cursors [] = { - { NULL, 17, 17, cursor_cross_xpm }, - { NULL, GDK_INTERNAL_CURSOR, GDK_CROSSHAIR, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_ARROW, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_FLEUR, NULL }, - { NULL, 24, 24, cursor_zoom_in_xpm }, - { NULL, 24, 24, cursor_zoom_out_xpm }, - { NULL, GDK_INTERNAL_CURSOR, GDK_SB_H_DOUBLE_ARROW, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_SB_V_DOUBLE_ARROW, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_SIZING, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_SIZING, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_HAND2, NULL }, - { NULL, 10, 10, cursor_hand_open_xpm }, - { NULL, 10, 10, cursor_hand_closed_xpm }, - { NULL, GDK_INTERNAL_CURSOR, GDK_XTERM, NULL }, - { NULL, 0, 0, NULL } -}; - - -static void -create_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, gchar **xpm) -{ - int height, width, colors; - char pixmap_buffer [(32 * 32)/8]; - char mask_buffer [(32 * 32)/8]; - int x, y, pix, yofs; - int transparent_color, black_color; - - sscanf (xpm [0], "%d %d %d %d", &height, &width, &colors, &pix); - - g_assert (height == 32); - g_assert (width == 32); - g_assert (colors <= 3); - - transparent_color = ' '; - black_color = '.'; - - yofs = colors + 1; - for (y = 0; y < 32; y++){ - for (x = 0; x < 32;){ - char value = 0, maskv = 0; - - for (pix = 0; pix < 8; pix++, x++){ - if (xpm [y + yofs][x] != transparent_color){ - maskv |= 1 << pix; - - /* - * Invert the colours here because it seems - * to workaround a bug the Matrox G100 Xserver? - * We reverse the foreground & background in the next - * routine to compensate. - */ - if (xpm [y + yofs][x] == black_color){ - value |= 1 << pix; - } - } - } - pixmap_buffer [(y * 4 + x/8)-1] = value; - mask_buffer [(y * 4 + x/8)-1] = maskv; - } - } - *bitmap = gdk_bitmap_create_from_data (NULL, pixmap_buffer, 32, 32); - *mask = gdk_bitmap_create_from_data (NULL, mask_buffer, 32, 32); -} - -void -e_cursors_init (void) -{ - int i; - - e_color_init (); - - for (i = 0; cursors [i].hot_x; i++){ - GdkBitmap *bitmap, *mask; - - if (cursors [i].hot_x < 0) - cursors [i].cursor = gdk_cursor_new (cursors [i].hot_y); - else { - create_bitmap_and_mask_from_xpm (&bitmap, &mask, cursors [i].xpm); - - /* The foreground and background colours are reversed. - * See comment above for explanation. - */ - cursors [i].cursor = - gdk_cursor_new_from_pixmap ( - bitmap, mask, - &e_black, &e_white, - cursors [i].hot_x, - cursors [i].hot_y); - } - } - - g_assert (i == E_CURSOR_NUM_CURSORS); -} - -void -e_cursors_shutdown (void) -{ - int i; - - for (i = 0; cursors [i].hot_x; i++) - gdk_cursor_destroy (cursors [i].cursor); -} - - -/* Returns a cursor given its type */ -GdkCursor * -e_cursor_get (ECursorType type) -{ - g_return_val_if_fail (type >= 0 && type < E_CURSOR_NUM_CURSORS, NULL); - - return cursors [type].cursor; -} diff --git a/widgets/misc/e-cursors.h b/widgets/misc/e-cursors.h deleted file mode 100644 index 8e751b659d..0000000000 --- a/widgets/misc/e-cursors.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-cursors.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Miguel de Icaza (miguel@gnu.org) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef GNOME_APP_LIB_CURSORS_H -#define GNOME_APP_LIB_CURSORS_H - -#include <gdk/gdk.h> - -G_BEGIN_DECLS - -typedef enum { - E_CURSOR_FAT_CROSS, - E_CURSOR_THIN_CROSS, - E_CURSOR_ARROW, - E_CURSOR_MOVE, - E_CURSOR_ZOOM_IN, - E_CURSOR_ZOOM_OUT, - E_CURSOR_SIZE_X, - E_CURSOR_SIZE_Y, - E_CURSOR_SIZE_TL, - E_CURSOR_SIZE_TR, - E_CURSOR_PRESS, - E_CURSOR_HAND_OPEN, - E_CURSOR_HAND_CLOSED, - E_CURSOR_XTERM, - E_CURSOR_NUM_CURSORS -} ECursorType; - -void e_cursors_init (void); -void e_cursors_shutdown (void); - -#define e_cursor_set(win, c) \ -G_STMT_START { \ - if (win) \ - gdk_window_set_cursor (win, e_cursor_get (c)); \ -} G_STMT_END - -#define e_cursor_set_widget(w, c) \ -G_STMT_START { \ - if (GTK_WIDGET (w)->window) \ - gdk_window_set_cursor (GTK_WIDGET (w)->window, e_cursor_get (c)); \ -} G_STMT_END - -GdkCursor *e_cursor_get (ECursorType type); - -G_END_DECLS - -#endif /* GNOME_APP_LIB_CURSORS_H */ diff --git a/widgets/misc/e-dropdown-button.h b/widgets/misc/e-dropdown-button.h index f0e6257b0f..2823704060 100644 --- a/widgets/misc/e-dropdown-button.h +++ b/widgets/misc/e-dropdown-button.h @@ -23,10 +23,6 @@ #ifndef _E_DROPDOWN_BUTTON_H_ #define _E_DROPDOWN_BUTTON_H_ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - #include <gtk/gtktogglebutton.h> #include <gtk/gtkmenu.h> @@ -36,10 +32,10 @@ extern "C" { #endif /* __cplusplus */ #define E_TYPE_DROPDOWN_BUTTON (e_dropdown_button_get_type ()) -#define E_DROPDOWN_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_DROPDOWN_BUTTON, EDropdownButton)) -#define E_DROPDOWN_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_DROPDOWN_BUTTON, EDropdownButtonClass)) -#define E_IS_DROPDOWN_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_DROPDOWN_BUTTON)) -#define E_IS_DROPDOWN_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_DROPDOWN_BUTTON)) +#define E_DROPDOWN_BUTTON(obj) (GTK_CHECK_CAST ((obj), E_TYPE_DROPDOWN_BUTTON, EDropdownButton)) +#define E_DROPDOWN_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_DROPDOWN_BUTTON, EDropdownButtonClass)) +#define E_IS_DROPDOWN_BUTTON(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_DROPDOWN_BUTTON)) +#define E_IS_DROPDOWN_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_DROPDOWN_BUTTON)) typedef struct _EDropdownButton EDropdownButton; diff --git a/widgets/misc/e-gui-utils.c b/widgets/misc/e-gui-utils.c deleted file mode 100644 index 59c499e4c1..0000000000 --- a/widgets/misc/e-gui-utils.c +++ /dev/null @@ -1,232 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-gui-utils.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Miguel de Icaza <miguel@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "e-gui-utils.h" - -#include <gtk/gtkentry.h> -#include <gtk/gtksignal.h> -#include <gdk-pixbuf/gdk-pixbuf.h> -#include <libgnomecanvas/gnome-canvas-pixbuf.h> - -void -e_auto_kill_popup_menu_on_selection_done (GtkMenu *menu) -{ - g_return_if_fail (GTK_IS_MENU (menu)); - - g_signal_connect (menu, "selection_done", G_CALLBACK (gtk_widget_destroy), menu); -} - -void -e_popup_menu (GtkMenu *menu, GdkEvent *event) -{ - g_return_if_fail (GTK_IS_MENU (menu)); - - e_auto_kill_popup_menu_on_selection_done (menu); - - if (event->type == GDK_KEY_PRESS) - gtk_menu_popup (menu, NULL, NULL, 0, NULL, 0, event->key.time); - else if ((event->type == GDK_BUTTON_PRESS) || - (event->type == GDK_BUTTON_RELEASE) || - (event->type == GDK_2BUTTON_PRESS) || - (event->type == GDK_3BUTTON_PRESS)){ - gtk_menu_popup (menu, NULL, NULL, 0, NULL, event->button.button, event->button.time); - } else - gtk_menu_popup (menu, NULL, NULL, 0, NULL, 0, GDK_CURRENT_TIME); -} - -typedef struct { - GtkCallback callback; - gpointer closure; -} CallbackClosure; - -static void -e_container_foreach_leaf_callback(GtkWidget *widget, CallbackClosure *callback_closure) -{ - if (GTK_IS_CONTAINER(widget)) { - e_container_foreach_leaf(GTK_CONTAINER(widget), callback_closure->callback, callback_closure->closure); - } else { - (*callback_closure->callback) (widget, callback_closure->closure); - } -} - -void -e_container_foreach_leaf(GtkContainer *container, - GtkCallback callback, - gpointer closure) -{ - CallbackClosure callback_closure; - callback_closure.callback = callback; - callback_closure.closure = closure; - gtk_container_foreach(container, (GtkCallback) e_container_foreach_leaf_callback, &callback_closure); -} - -static void -e_container_change_tab_order_destroy_notify(gpointer data) -{ - GList *list = data; - g_list_foreach(list, (GFunc) g_object_unref, NULL); - g_list_free(list); -} - - -static gint -e_container_change_tab_order_callback(GtkContainer *container, - GtkDirectionType direction, - GList *children) -{ - GtkWidget *focus_child; - GtkWidget *child; - - if (direction != GTK_DIR_TAB_FORWARD && - direction != GTK_DIR_TAB_BACKWARD) - return FALSE; - - focus_child = container->focus_child; - - if (focus_child == NULL) - return FALSE; - - if (direction == GTK_DIR_TAB_BACKWARD) { - children = g_list_last(children); - } - - while (children) { - child = children->data; - if (direction == GTK_DIR_TAB_FORWARD) - children = children->next; - else - children = children->prev; - - if (!child) - continue; - - if (focus_child) { - if (focus_child == child) { - focus_child = NULL; - - if (GTK_WIDGET_DRAWABLE (child) && - GTK_IS_CONTAINER (child) && - !GTK_WIDGET_HAS_FOCUS (child)) - if (gtk_widget_child_focus (GTK_WIDGET (child), direction)) { - g_signal_stop_emission_by_name (container, "focus"); - return TRUE; - } - } - } - else if (GTK_WIDGET_DRAWABLE (child)) { - if (GTK_IS_CONTAINER (child)) { - if (gtk_widget_child_focus (GTK_WIDGET (child), direction)) { - g_signal_stop_emission_by_name (container, "focus"); - return TRUE; - } - } - else if (GTK_WIDGET_CAN_FOCUS (child)) { - gtk_widget_grab_focus (child); - g_signal_stop_emission_by_name (container, "focus"); - return TRUE; - } - } - } - - return FALSE; -} - -gint -e_container_change_tab_order(GtkContainer *container, GList *widgets) -{ - GList *list; - list = g_list_copy(widgets); - g_list_foreach(list, (GFunc) g_object_ref, NULL); - return gtk_signal_connect_full(GTK_OBJECT(container), "focus", - GTK_SIGNAL_FUNC(e_container_change_tab_order_callback), - NULL, list, - e_container_change_tab_order_destroy_notify, - FALSE, FALSE); -} - -struct widgetandint { - GtkWidget *widget; - int count; -}; - -static void -nth_entry_callback(GtkWidget *widget, struct widgetandint *data) -{ - if (GTK_IS_ENTRY(widget)) { - if (data->count > 1) { - data->count --; - data->widget = widget; - } else if (data->count == 1) { - data->count --; - data->widget = NULL; - gtk_widget_grab_focus(widget); - } - } -} - -void -e_container_focus_nth_entry(GtkContainer *container, int n) -{ - struct widgetandint data; - data.widget = NULL; - data.count = n; - e_container_foreach_leaf(container, (GtkCallback) nth_entry_callback, &data); - if (data.widget) - gtk_widget_grab_focus(data.widget); -} - -gboolean -e_glade_xml_connect_widget (GladeXML *gui, char *name, char *signal, GCallback cb, gpointer closure) -{ - GtkWidget *widget; - - widget = glade_xml_get_widget (gui, name); - - if (widget) { - g_signal_connect (widget, signal, - cb, closure); - return TRUE; - } - - return FALSE; -} - -gboolean -e_glade_xml_set_sensitive (GladeXML *gui, char *name, gboolean sensitive) -{ - GtkWidget *widget; - - widget = glade_xml_get_widget (gui, name); - - if (widget) { - gtk_widget_set_sensitive (widget, sensitive); - return TRUE; - } - - return FALSE; -} diff --git a/widgets/misc/e-gui-utils.h b/widgets/misc/e-gui-utils.h deleted file mode 100644 index c52e233714..0000000000 --- a/widgets/misc/e-gui-utils.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-gui-utils.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Miguel de Icaza <miguel@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef GAL_GUI_UTILS_H -#define GAL_GUI_UTILS_H - -#include <gtk/gtkmenu.h> -#include <gtk/gtkwindow.h> - -#include <glade/glade-xml.h> - -G_BEGIN_DECLS - -void e_popup_menu (GtkMenu *menu, - GdkEvent *event); -void e_auto_kill_popup_menu_on_selection_done (GtkMenu *menu); - -void e_container_foreach_leaf (GtkContainer *container, - GtkCallback callback, - gpointer closure); -void e_container_focus_nth_entry (GtkContainer *container, - int n); -gint e_container_change_tab_order (GtkContainer *container, - GList *widgets); - -/* Returns TRUE on success. */ -gboolean e_glade_xml_connect_widget (GladeXML *gui, - char *name, - char *signal, - GtkSignalFunc cb, - gpointer closure); -gboolean e_glade_xml_set_sensitive (GladeXML *gui, - char *name, - gboolean sensitive); - -G_END_DECLS - -#endif /* GAL_GUI_UTILS_H */ diff --git a/widgets/misc/e-hsv-utils.c b/widgets/misc/e-hsv-utils.c deleted file mode 100644 index a5007b9b83..0000000000 --- a/widgets/misc/e-hsv-utils.c +++ /dev/null @@ -1,178 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-hsv-utils.c - utilites for manipulating colours in HSV space - * Copyright (C) 1995-2001 Seth Nickell, Peter Mattis, Spencer Kimball and Josh MacDonald - * - * Authors: - * Seth Nickell <seth@eazel.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <config.h> - -#include "e-hsv-utils.h" - -/* tweak_hsv is a really tweaky function. it modifies its first argument, which - should be the colour you want tweaked. delta_h, delta_s and delta_v specify - how much you want their respective channels modified (and in what direction). - if it can't do the specified modification, it does it in the oppositon direction */ -void -e_hsv_tweak (GdkColor *colour, gdouble delta_h, gdouble delta_s, gdouble delta_v) -{ - gdouble h, s, v, r, g, b; - - r = colour->red / 65535.0f; - g = colour->green / 65535.0f; - b = colour->blue / 65535.0f; - - e_rgb_to_hsv (r, g, b, &h, &s, &v); - - if (h + delta_h < 0) { - h -= delta_h; - } else { - h += delta_h; - } - - if (s + delta_s < 0) { - s -= delta_s; - } else { - s += delta_s; - } - - if (v + delta_v < 0) { - v -= delta_v; - } else { - v += delta_v; - } - - e_hsv_to_rgb (h, s, v, &r, &g, &b); - - colour->red = r * 65535.0f; - colour->green = g * 65535.0f; - colour->blue = b * 65535.0f; -} - -/* Copy n' Paste code from the GTK+ colour selector (gtkcolorsel.c) */ -/* Originally lifted, I suspect, from "Foley, van Dam" */ -void -e_hsv_to_rgb (gdouble h, gdouble s, gdouble v, - gdouble *r, gdouble *g, gdouble *b) -{ - gint i; - gdouble f, w, q, t; - - if (s == 0.0) - s = 0.000001; - - if (h == -1.0) - { - *r = v; - *g = v; - *b = v; - } - else - { - if (h == 360.0) - h = 0.0; - h = h / 60.0; - i = (gint) h; - f = h - i; - w = v * (1.0 - s); - q = v * (1.0 - (s * f)); - t = v * (1.0 - (s * (1.0 - f))); - - switch (i) - { - case 0: - *r = v; - *g = t; - *b = w; - break; - case 1: - *r = q; - *g = v; - *b = w; - break; - case 2: - *r = w; - *g = v; - *b = t; - break; - case 3: - *r = w; - *g = q; - *b = v; - break; - case 4: - *r = t; - *g = w; - *b = v; - break; - case 5: - *r = v; - *g = w; - *b = q; - break; - } - } -} - -void -e_rgb_to_hsv (gdouble r, gdouble g, gdouble b, - gdouble *h, gdouble *s, gdouble *v) -{ - double max, min, delta; - - max = r; - if (g > max) - max = g; - if (b > max) - max = b; - - min = r; - if (g < min) - min = g; - if (b < min) - min = b; - - *v = max; - - if (max != 0.0) - *s = (max - min) / max; - else - *s = 0.0; - - if (*s == 0.0) - *h = -1.0; - else - { - delta = max - min; - - if (r == max) - *h = (g - b) / delta; - else if (g == max) - *h = 2.0 + (b - r) / delta; - else if (b == max) - *h = 4.0 + (r - g) / delta; - - *h = *h * 60.0; - - if (*h < 0.0) - *h = *h + 360; - } -} - - diff --git a/widgets/misc/e-hsv-utils.h b/widgets/misc/e-hsv-utils.h deleted file mode 100644 index bbde282697..0000000000 --- a/widgets/misc/e-hsv-utils.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-hsv-utils.h - utilites for manipulating colours in HSV space - * Copyright (C) 1995-2001 Seth Nickell, Peter Mattis, Spencer Kimball and Josh MacDonald - * - * Authors: - * Seth Nickell <seth@eazel.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _E_HSV_UTILS_H_ -#define _E_HSV_UTILS_H_ - -#include <gdk/gdk.h> - -G_BEGIN_DECLS - -void e_hsv_to_rgb (gdouble h, - gdouble s, - gdouble v, - gdouble *r, - gdouble *g, - gdouble *b); - -void e_rgb_to_hsv (gdouble r, - gdouble g, - gdouble b, - gdouble *h, - gdouble *s, - gdouble *v); - -void e_hsv_tweak (GdkColor *colour, - gdouble delta_h, - gdouble delta_s, - gdouble delta_v); - -G_END_DECLS - -#endif /* _E_HSV_UTILS_H_ */ diff --git a/widgets/misc/e-multi-config-dialog.c b/widgets/misc/e-multi-config-dialog.c index 5411cd1413..847789c70c 100644 --- a/widgets/misc/e-multi-config-dialog.c +++ b/widgets/misc/e-multi-config-dialog.c @@ -37,8 +37,8 @@ #include <gdk-pixbuf/gdk-pixbuf.h> -#define PARENT_TYPE gtk_dialog_get_type () -static GtkDialogClass *parent_class = NULL; +#define PARENT_TYPE gnome_dialog_get_type () +static GnomeDialogClass *parent_class = NULL; #define SWITCH_PAGE_INTERVAL 250 @@ -93,11 +93,11 @@ update_buttons (EMultiConfigDialog *dialog) priv = dialog->priv; if (priv->num_unapplied > 0) { - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE); - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_APPLY, TRUE); + gnome_dialog_set_sensitive (GNOME_DIALOG (dialog), 0, TRUE); /* OK */ + gnome_dialog_set_sensitive (GNOME_DIALOG (dialog), 1, TRUE); /* Apply */ } else { - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE); - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_APPLY, FALSE); + gnome_dialog_set_sensitive (GNOME_DIALOG (dialog), 0, FALSE); /* OK */ + gnome_dialog_set_sensitive (GNOME_DIALOG (dialog), 1, FALSE); /* Apply */ } } @@ -175,7 +175,7 @@ set_page_timeout_callback (void *data) static void do_close (EMultiConfigDialog *dialog) { - gtk_widget_destroy (GTK_WIDGET (dialog)); + gnome_dialog_close (GNOME_DIALOG (dialog)); } static void @@ -231,10 +231,10 @@ table_cursor_change_callback (ETable *etable, } -/* GObject methods. */ +/* GtkObject methods. */ static void -impl_finalize (GObject *object) +impl_destroy (GtkObject *object) { EMultiConfigDialog *dialog; EMultiConfigDialogPrivate *priv; @@ -245,19 +245,22 @@ impl_finalize (GObject *object) if (priv->set_page_timeout_id != 0) g_source_remove (priv->set_page_timeout_id); + if (priv->list_e_table_model != NULL) + gtk_object_unref (GTK_OBJECT (priv->list_e_table_model)); + g_slist_free (priv->pages); g_free (priv); - (* G_OBJECT_CLASS (parent_class)->finalize) (object); + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } -/* GtkDialog methods. */ +/* GnomeDialog methods. */ static void -impl_response (GtkDialog *dialog, - int response_id) +impl_clicked (GnomeDialog *dialog, + int button_number) { EMultiConfigDialog *multi_config_dialog; EMultiConfigDialogPrivate *priv; @@ -265,36 +268,37 @@ impl_response (GtkDialog *dialog, multi_config_dialog = E_MULTI_CONFIG_DIALOG (dialog); priv = multi_config_dialog->priv; - switch (response_id) { - case GTK_RESPONSE_OK: + switch (button_number) { + case 0: /* OK */ do_ok (multi_config_dialog); break; - case GTK_RESPONSE_APPLY: + case 1: /* Apply */ do_apply (multi_config_dialog); break; - case GTK_RESPONSE_CLOSE: - default: + case 2: /* Close */ do_close (multi_config_dialog); break; + default: + g_assert_not_reached (); } } -/* GObject ctors. */ +/* GTK+ ctors. */ static void class_init (EMultiConfigDialogClass *class) { - GObjectClass *object_class; - GtkDialogClass *dialog_class; + GnomeDialogClass *dialog_class; + GtkObjectClass *object_class; - object_class = G_OBJECT_CLASS (class); - object_class->finalize = impl_finalize; + object_class = GTK_OBJECT_CLASS (class); + object_class->destroy = impl_destroy; - dialog_class = GTK_DIALOG_CLASS (class); - dialog_class->response = impl_response; + dialog_class = GNOME_DIALOG_CLASS (class); + dialog_class->clicked = impl_clicked; - parent_class = g_type_class_ref (PARENT_TYPE); + parent_class = gtk_type_class (PARENT_TYPE); } #define RGB_COLOR(color) (((color).red & 0xff00) << 8 | \ @@ -327,7 +331,7 @@ fill_in_pixbufs (EMultiConfigDialog *dialog, int row) 1, colors[i], colors[i]); e_table_model_set_value_at (dialog->priv->list_e_table_model, i + 2, row, pixbuf); - g_object_unref(pixbuf); + gdk_pixbuf_unref(pixbuf); } } @@ -357,7 +361,7 @@ init (EMultiConfigDialog *multi_config_dialog) { EMultiConfigDialogPrivate *priv; ETableModel *list_e_table_model; - GtkWidget *dialog_vbox; + GtkWidget *gnome_dialog_vbox; GtkWidget *hbox; GtkWidget *notebook; GtkWidget *list_e_table; @@ -367,38 +371,40 @@ init (EMultiConfigDialog *multi_config_dialog) ECell *vbox; hbox = gtk_hbox_new (FALSE, 2); - dialog_vbox = GTK_DIALOG (multi_config_dialog)->vbox; - gtk_container_add (GTK_CONTAINER (dialog_vbox), hbox); + gnome_dialog_vbox = GNOME_DIALOG (multi_config_dialog)->vbox; + gtk_container_add (GTK_CONTAINER (gnome_dialog_vbox), hbox); list_e_table_model = e_table_memory_store_new (columns); vbox = e_cell_vbox_new (); pixbuf = e_cell_pixbuf_new(); - g_object_set (G_OBJECT (pixbuf), - "focused_column", 2, - "selected_column", 3, - "unselected_column", 4, - NULL); + gtk_object_set (GTK_OBJECT (pixbuf), + "focused_column", 2, + "selected_column", 3, + "unselected_column", 4, + NULL); e_cell_vbox_append (E_CELL_VBOX (vbox), pixbuf, 1); - g_object_unref (pixbuf); + gtk_object_unref (GTK_OBJECT (pixbuf)); text = e_cell_text_new (NULL, GTK_JUSTIFY_CENTER); e_cell_vbox_append (E_CELL_VBOX (vbox), text, 0); - g_object_unref (text); + gtk_object_unref (GTK_OBJECT (text)); extras = e_table_extras_new (); e_table_extras_add_cell (extras, "vbox", vbox); list_e_table = e_table_scrolled_new (list_e_table_model, extras, list_e_table_spec, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (list_e_table), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - g_signal_connect (e_table_scrolled_get_table (E_TABLE_SCROLLED (list_e_table)), - "cursor_change", G_CALLBACK (table_cursor_change_callback), multi_config_dialog); + e_scroll_frame_set_policy (E_SCROLL_FRAME (list_e_table), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table (E_TABLE_SCROLLED (list_e_table))), + "cursor_change", GTK_SIGNAL_FUNC (table_cursor_change_callback), + multi_config_dialog); - g_signal_connect (e_table_scrolled_get_table (E_TABLE_SCROLLED (list_e_table))->table_canvas, - "realize", G_CALLBACK (canvas_realize), multi_config_dialog); + gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table (E_TABLE_SCROLLED (list_e_table))->table_canvas), + "realize", GTK_SIGNAL_FUNC (canvas_realize), + multi_config_dialog); - g_object_unref (extras); + gtk_object_unref (GTK_OBJECT (extras)); gtk_box_pack_start (GTK_BOX (hbox), list_e_table, FALSE, TRUE, 0); @@ -411,13 +417,12 @@ init (EMultiConfigDialog *multi_config_dialog) gtk_widget_show (notebook); gtk_widget_show (list_e_table); - gtk_dialog_add_buttons (GTK_DIALOG (multi_config_dialog), - GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, - GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, - GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); - gtk_dialog_set_default_response (GTK_DIALOG (multi_config_dialog), GTK_RESPONSE_OK); - + gnome_dialog_append_buttons (GNOME_DIALOG (multi_config_dialog), + GNOME_STOCK_BUTTON_OK, + GNOME_STOCK_BUTTON_APPLY, + GNOME_STOCK_BUTTON_CLOSE, + NULL); + gnome_dialog_set_default (GNOME_DIALOG (multi_config_dialog), 0); gtk_window_set_policy (GTK_WINDOW (multi_config_dialog), FALSE /* allow_shrink */, @@ -489,7 +494,8 @@ e_multi_config_dialog_add_page (EMultiConfigDialog *dialog, if (! e_config_page_is_applied (page_widget)) priv->num_unapplied ++; - g_signal_connect (page_widget, "changed", G_CALLBACK (page_changed_callback), dialog); + gtk_signal_connect (GTK_OBJECT (page_widget), "changed", + GTK_SIGNAL_FUNC (page_changed_callback), dialog); update_buttons (dialog); } diff --git a/widgets/misc/e-multi-config-dialog.h b/widgets/misc/e-multi-config-dialog.h index 0a4c32d7a4..6d78897917 100644 --- a/widgets/misc/e-multi-config-dialog.h +++ b/widgets/misc/e-multi-config-dialog.h @@ -23,13 +23,10 @@ #ifndef _E_MULTI_CONFIG_DIALOG_H_ #define _E_MULTI_CONFIG_DIALOG_H_ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - #include "e-config-page.h" -#include <gtk/gtkdialog.h> +#include <gtk/gtkwindow.h> + #include <gdk-pixbuf/gdk-pixbuf.h> #ifdef __cplusplus @@ -38,10 +35,10 @@ extern "C" { #endif /* __cplusplus */ #define E_TYPE_MULTI_CONFIG_DIALOG (e_multi_config_dialog_get_type ()) -#define E_MULTI_CONFIG_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_MULTI_CONFIG_DIALOG, EMultiConfigDialog)) -#define E_MULTI_CONFIG_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_MULTI_CONFIG_DIALOG, EMultiConfigDialogClass)) -#define E_IS_MULTI_CONFIG_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_MULTI_CONFIG_DIALOG)) -#define E_IS_MULTI_CONFIG_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_MULTI_CONFIG_DIALOG)) +#define E_MULTI_CONFIG_DIALOG(obj) (GTK_CHECK_CAST ((obj), E_TYPE_MULTI_CONFIG_DIALOG, EMultiConfigDialog)) +#define E_MULTI_CONFIG_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_MULTI_CONFIG_DIALOG, EMultiConfigDialogClass)) +#define E_IS_MULTI_CONFIG_DIALOG(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_MULTI_CONFIG_DIALOG)) +#define E_IS_MULTI_CONFIG_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_MULTI_CONFIG_DIALOG)) typedef struct _EMultiConfigDialog EMultiConfigDialog; @@ -49,13 +46,13 @@ typedef struct _EMultiConfigDialogPrivate EMultiConfigDialogPrivate; typedef struct _EMultiConfigDialogClass EMultiConfigDialogClass; struct _EMultiConfigDialog { - GtkDialog parent; + GnomeDialog parent; EMultiConfigDialogPrivate *priv; }; struct _EMultiConfigDialogClass { - GtkDialogClass parent_class; + GnomeDialogClass parent_class; }; diff --git a/widgets/misc/e-popup-menu.c b/widgets/misc/e-popup-menu.c deleted file mode 100644 index 8607cd1b01..0000000000 --- a/widgets/misc/e-popup-menu.c +++ /dev/null @@ -1,240 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-popup-menu.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Miguel de Icaza <miguel@ximian.com> - * Jody Goldberg (jgoldberg@home.com) - * Jeffrey Stedfast <fejj@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <config.h> -#include <string.h> -#include <gtk/gtkimage.h> -#include <gdk/gdkkeysyms.h> -#include <gtk/gtkaccellabel.h> -#include <gtk/gtklabel.h> -#include <gtk/gtkmenuitem.h> -#include <gtk/gtkcheckmenuitem.h> -#include <gtk/gtkradiomenuitem.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkimagemenuitem.h> - -#include "e-popup-menu.h" -#include "e-gui-utils.h" - -#include <gal/util/e-i18n.h> - -/* - * Creates an item with an optional icon - */ -static void -make_item (GtkMenu *menu, GtkMenuItem *item, const char *name, GtkWidget *pixmap) -{ - GtkWidget *label; - - if (*name == '\0') - return; - - /* - * Ugh. This needs to go into Gtk+ - */ - label = gtk_label_new_with_mnemonic (name); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_widget_show (label); - - gtk_container_add (GTK_CONTAINER (item), label); - - if (pixmap && GTK_IS_IMAGE_MENU_ITEM (item)){ - gtk_widget_show (pixmap); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), pixmap); - } -} - -GtkMenu * -e_popup_menu_create (EPopupMenu *menu_list, - guint32 disable_mask, - guint32 hide_mask, - void *default_closure) -{ - return e_popup_menu_create_with_domain (menu_list, - disable_mask, - hide_mask, - default_closure, - NULL); -} - - -GtkMenu * -e_popup_menu_create_with_domain (EPopupMenu *menu_list, - guint32 disable_mask, - guint32 hide_mask, - void *default_closure, - const char *domain) -{ - GtkMenu *menu = GTK_MENU (gtk_menu_new ()); - GSList *group = NULL; - gboolean last_item_separator = TRUE; - int last_non_separator = -1; - int i; - - for (i = 0; menu_list[i].name; i++) { - if (strcmp ("", menu_list[i].name) && !(menu_list [i].disable_mask & hide_mask)) { - last_non_separator = i; - } - } - - for (i = 0; i <= last_non_separator; i++) { - gboolean separator; - - separator = !strcmp ("", menu_list[i].name); - - if ((!(separator && last_item_separator)) && !(menu_list [i].disable_mask & hide_mask)) { - GtkWidget *item = NULL; - - if (!separator) { - if (menu_list[i].is_toggle) - item = gtk_check_menu_item_new (); - else if (menu_list[i].is_radio) - item = gtk_radio_menu_item_new (group); - else - item = menu_list[i].pixmap_widget ? gtk_image_menu_item_new () : gtk_menu_item_new (); - if (menu_list[i].is_toggle || menu_list[i].is_radio) - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), menu_list[i].is_active); - if (menu_list[i].is_radio) - group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item)); - - make_item (menu, GTK_MENU_ITEM (item), dgettext(domain, menu_list[i].name), menu_list[i].pixmap_widget); - } else { - item = gtk_menu_item_new (); - } - - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - - if (!menu_list[i].submenu) { - if (menu_list[i].fn) - g_signal_connect (item, "activate", - G_CALLBACK (menu_list[i].fn), - menu_list[i].use_custom_closure ? menu_list[i].closure : default_closure); - } else { - /* submenu */ - GtkMenu *submenu; - - submenu = e_popup_menu_create (menu_list[i].submenu, disable_mask, hide_mask, - default_closure); - - gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), GTK_WIDGET (submenu)); - } - - if (menu_list[i].disable_mask & disable_mask) - gtk_widget_set_sensitive (item, FALSE); - - gtk_widget_show (item); - - last_item_separator = separator; - } - } - - return menu; -} - -void -e_popup_menu_run (EPopupMenu *menu_list, GdkEvent *event, guint32 disable_mask, guint32 hide_mask, void *default_closure) -{ - GtkMenu *menu; - - g_return_if_fail (menu_list != NULL); - g_return_if_fail (event != NULL); - - menu = e_popup_menu_create (menu_list, disable_mask, hide_mask, default_closure); - - e_popup_menu (menu, event); -} - -void -e_popup_menu_copy_1 (EPopupMenu *destination, - const EPopupMenu *source) -{ - destination->name = g_strdup (source->name); - destination->pixname = g_strdup (source->pixname); - destination->fn = source->fn; - destination->submenu = e_popup_menu_copy (source->submenu); - destination->disable_mask = source->disable_mask; - - destination->pixmap_widget = source->pixmap_widget; - if (destination->pixmap_widget) - g_object_ref (destination->pixmap_widget); - destination->closure = source->closure; - - destination->is_toggle = source->is_toggle; - destination->is_radio = source->is_radio; - destination->is_active = source->is_active; - - destination->use_custom_closure = source->use_custom_closure; -} - -void -e_popup_menu_free_1 (EPopupMenu *menu_item) -{ - g_free (menu_item->name); - g_free (menu_item->pixname); - e_popup_menu_free (menu_item->submenu); - - if (menu_item->pixmap_widget) - g_object_unref (menu_item->pixmap_widget); -} - -EPopupMenu * -e_popup_menu_copy (const EPopupMenu *menu_list) -{ - int i; - EPopupMenu *ret_val; - - if (menu_list == NULL) - return NULL; - - for (i = 0; menu_list[i].name; i++) { - /* Intentionally empty */ - } - - ret_val = g_new (EPopupMenu, i + 1); - - for (i = 0; menu_list[i].name; i++) { - e_popup_menu_copy_1 (ret_val + i, menu_list + i); - } - - /* Copy the terminator */ - e_popup_menu_copy_1 (ret_val + i, menu_list + i); - - return ret_val; -} - -void -e_popup_menu_free (EPopupMenu *menu_list) -{ - int i; - - if (menu_list == NULL) - return; - - for (i = 0; menu_list[i].name; i++) { - e_popup_menu_free_1 (menu_list + i); - } - g_free (menu_list); -} - diff --git a/widgets/misc/e-popup-menu.h b/widgets/misc/e-popup-menu.h deleted file mode 100644 index 7289ab5c86..0000000000 --- a/widgets/misc/e-popup-menu.h +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-popup-menu.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Miguel de Icaza <miguel@ximian.com> - * Jody Goldberg (jgoldberg@home.com) - * Jeffrey Stedfast <fejj@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef E_POPUP_MENU_H -#define E_POPUP_MENU_H - -#include <gtk/gtkmenu.h> -#include <gtk/gtkwidget.h> - -G_BEGIN_DECLS - -#define E_POPUP_SEPARATOR { "", NULL, (NULL), NULL, 0 } -#define E_POPUP_TERMINATOR { NULL, NULL, (NULL), NULL, 0 } - - -/* In the following, CC = custom closure */ - -#define E_POPUP_ITEM(name,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 0, 0, 0, 0 } -#define E_POPUP_ITEM_CC(name,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), NULL, (closure), 0, 0, 0, 1 } -#define E_POPUP_SUBMENU(name,submenu,disable_mask) { (name), NULL, NULL, (submenu), (disable_mask), NULL, NULL, 0, 0, 0, 0 } - -#define E_POPUP_PIXMAP_ITEM(name,pixmap,fn,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, NULL, 0, 0, 0, 0 } -#define E_POPUP_PIXMAP_ITEM_CC(name,pixmap,fn,closure,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, (closure), 0, 0, 0, 1 } -#define E_POPUP_PIXMAP_SUBMENU(name,pixmap,submenu,disable_mask) { (name), (pixmap), NULL, (submenu), (disable_mask), NULL, NULL, 0, 0, 0, 0 } - -#define E_POPUP_PIXMAP_WIDGET_ITEM(name,pixmap_widget,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), NULL, 0, 0, 0, 0 } -#define E_POPUP_PIXMAP_WIDGET_ITEM_CC(name,pixmap_widget,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), (closure), 0, 0, 0, 1 } -#define E_POPUP_PIXMAP_WIDGET_SUBMENU(name,pixmap_widget,submenu,disable_mask) { (name), NULL, NULL, (submenu), (disable_mask), (pixmap_widget), NULL, 0, 0, 0, 0 } - - -#define E_POPUP_TOGGLE_ITEM(name,fn,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 1, 0, value, 0 } -#define E_POPUP_TOGGLE_ITEM_CC(name,fn,closure,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, (closure), 1, 0, value, 1 } - -#define E_POPUP_SEPARATOR { "", NULL, (NULL), NULL, 0 } -#define E_POPUP_TERMINATOR { NULL, NULL, (NULL), NULL, 0 } - - -/* In the following, CC = custom closure */ - -#define E_POPUP_ITEM(name,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 0, 0, 0, 0 } -#define E_POPUP_ITEM_CC(name,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), NULL, (closure), 0, 0, 0, 1 } -#define E_POPUP_SUBMENU(name,submenu,disable_mask) { (name), NULL, NULL, (submenu), (disable_mask), NULL, NULL, 0, 0, 0, 0 } - -#define E_POPUP_PIXMAP_ITEM(name,pixmap,fn,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, NULL, 0, 0, 0, 0 } -#define E_POPUP_PIXMAP_ITEM_CC(name,pixmap,fn,closure,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, (closure), 0, 0, 0, 1 } -#define E_POPUP_PIXMAP_SUBMENU(name,pixmap,submenu,disable_mask) { (name), (pixmap), NULL, (submenu), (disable_mask), NULL, NULL, 0, 0, 0, 0 } - -#define E_POPUP_PIXMAP_WIDGET_ITEM(name,pixmap_widget,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), NULL, 0, 0, 0, 0 } -#define E_POPUP_PIXMAP_WIDGET_ITEM_CC(name,pixmap_widget,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), (closure), 0, 0, 0, 1 } -#define E_POPUP_PIXMAP_WIDGET_SUBMENU(name,pixmap_widget,submenu,disable_mask) { (name), NULL, NULL, (submenu), (disable_mask), (pixmap_widget), NULL, 0, 0, 0, 0 } - - -#define E_POPUP_TOGGLE_ITEM(name,fn,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 1, 0, value, 0 } -#define E_POPUP_TOGGLE_ITEM_CC(name,fn,closure,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, (closure), 1, 0, value, 1 } - -#define E_POPUP_TOGGLE_PIXMAP_ITEM(name,pixmap,fn,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, NULL, 1, 0, value, 0 } -#define E_POPUP_TOGGLE_PIXMAP_ITEM_CC(name,pixmap,fn,closure,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, (closure), 1, 0, value, 1 } - -#define E_POPUP_TOGGLE_PIXMAP_WIDGET_ITEM(name,pixmap_widget,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), NULL, 1, 0, value, 0 } -#define E_POPUP_TOGGLE_PIXMAP_WIDGET_ITEM_CC(name,pixmap_widget,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), (closure), 1, 0, value, 1 } - - -#define E_POPUP_RADIO_ITEM(name,fn,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 0, 1, value, 0 } -#define E_POPUP_RADIO_ITEM_CC(name,fn,closure,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, (closure), 0, 1, value, 1 } - -#define E_POPUP_RADIO_PIXMAP_ITEM(name,pixmap,fn,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, NULL, 0, 1, value, 0 } -#define E_POPUP_RADIO_PIXMAP_ITEM_CC(name,pixmap,fn,closure,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, (closure), 0, 1, value, 1 } - -#define E_POPUP_RADIO_PIXMAP_WIDGET_ITEM(name,pixmap_widget,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), NULL, 0, 1, value, 0 } -#define E_POPUP_RADIO_PIXMAP_WIDGET_ITEM_CC(name,pixmap_widget,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), (closure), 0, 1, value, 1 } - - -typedef struct _EPopupMenu EPopupMenu; - -struct _EPopupMenu { - char *name; - char *pixname; - GtkSignalFunc fn; - - EPopupMenu *submenu; - guint32 disable_mask; - - /* Added post 0.19 */ - GtkWidget *pixmap_widget; - void *closure; - - guint is_toggle : 1; - guint is_radio : 1; - guint is_active : 1; - - guint use_custom_closure : 1; -}; - -GtkMenu *e_popup_menu_create (EPopupMenu *menu_list, - guint32 disable_mask, - guint32 hide_mask, - void *default_closure); -GtkMenu *e_popup_menu_create_with_domain (EPopupMenu *menu_list, - guint32 disable_mask, - guint32 hide_mask, - void *default_closure, - const char *domain); -void e_popup_menu_run (EPopupMenu *menu_list, - GdkEvent *event, - guint32 disable_mask, - guint32 hide_mask, - void *default_closure); - -/* Doesn't copy or free the memory. Just the contents. */ -void e_popup_menu_copy_1 (EPopupMenu *destination, - const EPopupMenu *menu_item); -void e_popup_menu_free_1 (EPopupMenu *menu_item); - -/* Copies or frees the entire structure. */ -EPopupMenu *e_popup_menu_copy (const EPopupMenu *menu_item); -void e_popup_menu_free (EPopupMenu *menu_item); - -G_END_DECLS - -#endif /* E_POPUP_MENU_H */ diff --git a/widgets/misc/e-printable.c b/widgets/misc/e-printable.c deleted file mode 100644 index 534f153823..0000000000 --- a/widgets/misc/e-printable.c +++ /dev/null @@ -1,209 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-printable.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <config.h> -#include <gtk/gtksignal.h> -#include "gal/util/e-util.h" -#include "e-printable.h" - -#define EP_CLASS(e) ((EPrintableClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE GTK_TYPE_OBJECT - - -static GtkObjectClass *e_printable_parent_class; - -enum { - PRINT_PAGE, - DATA_LEFT, - RESET, - HEIGHT, - WILL_FIT, - LAST_SIGNAL -}; - -static guint e_printable_signals [LAST_SIGNAL] = { 0, }; - -static void -e_printable_class_init (GtkObjectClass *object_class) -{ - EPrintableClass *klass = E_PRINTABLE_CLASS(object_class); - e_printable_parent_class = g_type_class_ref (PARENT_TYPE); - - e_printable_signals [PRINT_PAGE] = - g_signal_new ("print_page", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EPrintableClass, print_page), - NULL, NULL, - e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOLEAN, - G_TYPE_NONE, 4, G_TYPE_OBJECT, G_TYPE_DOUBLE, - G_TYPE_DOUBLE, G_TYPE_BOOLEAN); - - e_printable_signals [DATA_LEFT] = - g_signal_new ("data_left", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EPrintableClass, data_left), - NULL, NULL, - e_marshal_BOOLEAN__NONE, - G_TYPE_BOOLEAN, 0, G_TYPE_NONE); - - e_printable_signals [RESET] = - g_signal_new ("reset", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EPrintableClass, reset), - NULL, NULL, - e_marshal_NONE__NONE, - G_TYPE_NONE, 0, G_TYPE_NONE); - - e_printable_signals [HEIGHT] = - g_signal_new ("height", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EPrintableClass, height), - NULL, NULL, - e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOLEAN, - G_TYPE_DOUBLE, 4, G_TYPE_OBJECT, G_TYPE_DOUBLE, - G_TYPE_DOUBLE, G_TYPE_BOOLEAN); - - e_printable_signals [WILL_FIT] = - g_signal_new ("will_fit", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EPrintableClass, will_fit), - NULL, NULL, - e_marshal_BOOLEAN__OBJECT_DOUBLE_DOUBLE_BOOLEAN, - G_TYPE_BOOLEAN, 4, G_TYPE_OBJECT, G_TYPE_DOUBLE, - G_TYPE_DOUBLE, G_TYPE_BOOLEAN); - - klass->print_page = NULL; - klass->data_left = NULL; - klass->reset = NULL; - klass->height = NULL; - klass->will_fit = NULL; -} - - -E_MAKE_TYPE (e_printable, - "EPrintable", - EPrintable, - e_printable_class_init, - NULL, - PARENT_TYPE) - -EPrintable * -e_printable_new(void) -{ - return E_PRINTABLE(g_object_new(E_PRINTABLE_TYPE, NULL)); -} - -void -e_printable_print_page (EPrintable *e_printable, - GnomePrintContext *context, - gdouble width, - gdouble height, - gboolean quantized) -{ - g_return_if_fail (e_printable != NULL); - g_return_if_fail (E_IS_PRINTABLE (e_printable)); - - g_signal_emit (e_printable, - e_printable_signals [PRINT_PAGE], 0, - context, - width, - height, - quantized); -} - -gboolean -e_printable_data_left (EPrintable *e_printable) -{ - gboolean ret_val; - - g_return_val_if_fail (e_printable != NULL, FALSE); - g_return_val_if_fail (E_IS_PRINTABLE (e_printable), FALSE); - - g_signal_emit (e_printable, - e_printable_signals [DATA_LEFT], 0, - &ret_val); - - return ret_val; -} - -void -e_printable_reset (EPrintable *e_printable) -{ - g_return_if_fail (e_printable != NULL); - g_return_if_fail (E_IS_PRINTABLE (e_printable)); - - g_signal_emit (e_printable, - e_printable_signals [RESET], 0); -} - -gdouble -e_printable_height (EPrintable *e_printable, - GnomePrintContext *context, - gdouble width, - gdouble max_height, - gboolean quantized) -{ - gdouble ret_val; - - g_return_val_if_fail (e_printable != NULL, -1); - g_return_val_if_fail (E_IS_PRINTABLE (e_printable), -1); - - g_signal_emit (e_printable, - e_printable_signals [HEIGHT], 0, - context, - width, - max_height, - quantized, - &ret_val); - - return ret_val; -} - -gboolean -e_printable_will_fit (EPrintable *e_printable, - GnomePrintContext *context, - gdouble width, - gdouble max_height, - gboolean quantized) -{ - gboolean ret_val; - - g_return_val_if_fail (e_printable != NULL, -1); - g_return_val_if_fail (E_IS_PRINTABLE (e_printable), -1); - - g_signal_emit (e_printable, - e_printable_signals [WILL_FIT], 0, - context, - width, - max_height, - quantized, - &ret_val); - - return ret_val; -} diff --git a/widgets/misc/e-printable.h b/widgets/misc/e-printable.h deleted file mode 100644 index 0c665f89c2..0000000000 --- a/widgets/misc/e-printable.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-printable.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _E_PRINTABLE_H_ -#define _E_PRINTABLE_H_ - -#include <gtk/gtkobject.h> -#include <libgnomeprint/gnome-print.h> - -G_BEGIN_DECLS - -#define E_PRINTABLE_TYPE (e_printable_get_type ()) -#define E_PRINTABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_PRINTABLE_TYPE, EPrintable)) -#define E_PRINTABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_PRINTABLE_TYPE, EPrintableClass)) -#define E_IS_PRINTABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_PRINTABLE_TYPE)) -#define E_IS_PRINTABLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_PRINTABLE_TYPE)) - -typedef struct { - GtkObject base; -} EPrintable; - -typedef struct { - GtkObjectClass parent_class; - - /* - * Signals - */ - - void (*print_page) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble height, gboolean quantized); - gboolean (*data_left) (EPrintable *etm); - void (*reset) (EPrintable *etm); - gdouble (*height) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble max_height, gboolean quantized); - - /* e_printable_will_fit (ep, ...) should be equal in value to - * (e_printable_print_page (ep, ...), - * !e_printable_data_left(ep)) except that the latter has the - * side effect of doing the printing and advancing the - * position of the printable. - */ - - gboolean (*will_fit) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble max_height, gboolean quantized); -} EPrintableClass; - -GtkType e_printable_get_type (void); - -EPrintable *e_printable_new (void); - -/* - * Routines for emitting signals on the e_table */ -void e_printable_print_page (EPrintable *e_printable, - GnomePrintContext *context, - gdouble width, - gdouble height, - gboolean quantized); -gboolean e_printable_data_left (EPrintable *e_printable); -void e_printable_reset (EPrintable *e_printable); -gdouble e_printable_height (EPrintable *e_printable, - GnomePrintContext *context, - gdouble width, - gdouble max_height, - gboolean quantized); -gboolean e_printable_will_fit (EPrintable *e_printable, - GnomePrintContext *context, - gdouble width, - gdouble max_height, - gboolean quantized); - -G_END_DECLS - -#endif /* _E_PRINTABLE_H_ */ diff --git a/widgets/misc/e-reflow-model.c b/widgets/misc/e-reflow-model.c deleted file mode 100644 index 33a5498df5..0000000000 --- a/widgets/misc/e-reflow-model.c +++ /dev/null @@ -1,355 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-reflow-model.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <config.h> -#include "e-reflow-model.h" -#include "gal/util/e-util.h" - -#define PARENT_TYPE G_TYPE_OBJECT - -#define d(x) - -d(static gint depth = 0;) - - -static GObjectClass *e_reflow_model_parent_class; - -enum { - MODEL_CHANGED, - COMPARISON_CHANGED, - MODEL_ITEMS_INSERTED, - MODEL_ITEM_CHANGED, - MODEL_ITEM_REMOVED, - LAST_SIGNAL -}; - -static guint e_reflow_model_signals [LAST_SIGNAL] = { 0, }; - -/** - * e_reflow_model_set_width: - * @e_reflow_model: The e-reflow-model to operate on - * @width: The new value for the width of each item. - */ -void -e_reflow_model_set_width (EReflowModel *e_reflow_model, int width) -{ - g_return_if_fail (e_reflow_model != NULL); - g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model)); - - E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->set_width (e_reflow_model, width); -} - -/** - * e_reflow_model_count: - * @e_reflow_model: The e-reflow-model to operate on - * - * Returns: the number of items in the reflow model. - */ -int -e_reflow_model_count (EReflowModel *e_reflow_model) -{ - g_return_val_if_fail (e_reflow_model != NULL, 0); - g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), 0); - - return E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->count (e_reflow_model); -} - -/** - * e_reflow_model_height: - * @e_reflow_model: The e-reflow-model to operate on - * @n: The item number to get the height of. - * @parent: The parent GnomeCanvasItem. - * - * Returns: the height of the nth item. - */ -int -e_reflow_model_height (EReflowModel *e_reflow_model, int n, GnomeCanvasGroup *parent) -{ - g_return_val_if_fail (e_reflow_model != NULL, 0); - g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), 0); - - return E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->height (e_reflow_model, n, parent); -} - -/** - * e_reflow_model_incarnate: - * @e_reflow_model: The e-reflow-model to operate on - * @n: The item to create. - * @parent: The parent GnomeCanvasItem to create a child of. - * - * Create a GnomeCanvasItem to represent the nth piece of data. - * - * Returns: the new GnomeCanvasItem. - */ -GnomeCanvasItem * -e_reflow_model_incarnate (EReflowModel *e_reflow_model, int n, GnomeCanvasGroup *parent) -{ - g_return_val_if_fail (e_reflow_model != NULL, NULL); - g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), NULL); - - return E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->incarnate (e_reflow_model, n, parent); -} - -/** - * e_reflow_model_compare: - * @e_reflow_model: The e-reflow-model to operate on - * @n1: The first item to compare - * @n2: The second item to compare - * - * Compares item n1 and item n2 to see which should come first. - * - * Returns: strcmp like semantics for the comparison value. - */ -int -e_reflow_model_compare (EReflowModel *e_reflow_model, int n1, int n2) -{ -#if 0 - g_return_val_if_fail (e_reflow_model != NULL, 0); - g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), 0); -#endif - - return E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->compare (e_reflow_model, n1, n2); -} - -/** - * e_reflow_model_reincarnate: - * @e_reflow_model: The e-reflow-model to operate on - * @n: The item to create. - * @item: The item to reuse. - * - * Update item to represent the nth piece of data. - */ -void -e_reflow_model_reincarnate (EReflowModel *e_reflow_model, int n, GnomeCanvasItem *item) -{ - g_return_if_fail (e_reflow_model != NULL); - g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model)); - - E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->reincarnate (e_reflow_model, n, item); -} - -static void -e_reflow_model_class_init (GObjectClass *object_class) -{ - EReflowModelClass *klass = E_REFLOW_MODEL_CLASS(object_class); - e_reflow_model_parent_class = g_type_class_ref (PARENT_TYPE); - - e_reflow_model_signals [MODEL_CHANGED] = - g_signal_new ("model_changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EReflowModelClass, model_changed), - NULL, NULL, - e_marshal_NONE__NONE, - G_TYPE_NONE, 0); - - e_reflow_model_signals [COMPARISON_CHANGED] = - g_signal_new ("comparison_changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EReflowModelClass, comparison_changed), - NULL, NULL, - e_marshal_NONE__NONE, - G_TYPE_NONE, 0); - - e_reflow_model_signals [MODEL_ITEMS_INSERTED] = - g_signal_new ("model_items_inserted", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EReflowModelClass, model_items_inserted), - NULL, NULL, - e_marshal_NONE__INT_INT, - G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); - - e_reflow_model_signals [MODEL_ITEM_CHANGED] = - g_signal_new ("model_item_changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EReflowModelClass, model_item_changed), - NULL, NULL, - e_marshal_NONE__INT, - G_TYPE_NONE, 1, G_TYPE_INT); - - e_reflow_model_signals [MODEL_ITEM_REMOVED] = - g_signal_new ("model_item_removed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EReflowModelClass, model_item_removed), - NULL, NULL, - e_marshal_NONE__INT, - G_TYPE_NONE, 1, G_TYPE_INT); - - klass->set_width = NULL; - klass->count = NULL; - klass->height = NULL; - klass->incarnate = NULL; - klass->reincarnate = NULL; - - klass->model_changed = NULL; - klass->comparison_changed = NULL; - klass->model_items_inserted = NULL; - klass->model_item_removed = NULL; - klass->model_item_changed = NULL; -} - -static void -e_reflow_model_init (GObject *object) -{ -} - -E_MAKE_TYPE(e_reflow_model, "EReflowModel", EReflowModel, - e_reflow_model_class_init, e_reflow_model_init, PARENT_TYPE) - -#if d(!)0 -static void -print_tabs (void) -{ - int i; - for (i = 0; i < depth; i++) - g_print("\t"); -} -#endif - -/** - * e_reflow_model_changed: - * @e_reflow_model: the reflow model to notify of the change - * - * Use this function to notify any views of this reflow model that - * the contents of the reflow model have changed. This will emit - * the signal "model_changed" on the @e_reflow_model object. - * - * It is preferable to use the e_reflow_model_item_changed() signal to - * notify of smaller changes than to invalidate the entire model, as - * the views might have ways of caching the information they render - * from the model. - */ -void -e_reflow_model_changed (EReflowModel *e_reflow_model) -{ - g_return_if_fail (e_reflow_model != NULL); - g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model)); - - d(print_tabs()); - d(g_print("Emitting model_changed on model 0x%p.\n", e_reflow_model)); - d(depth++); - g_signal_emit (e_reflow_model, - e_reflow_model_signals [MODEL_CHANGED], 0); - d(depth--); -} - -/** - * e_reflow_model_comparison_changed: - * @e_reflow_model: the reflow model to notify of the change - * - * Use this function to notify any views of this reflow model that the - * sorting has changed. The actual contents of the items hasn't, so - * there's no need to re-query the model for the heights of the - * individual items. - */ -void -e_reflow_model_comparison_changed (EReflowModel *e_reflow_model) -{ - g_return_if_fail (e_reflow_model != NULL); - g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model)); - - d(print_tabs()); - d(g_print("Emitting comparison_changed on model 0x%p.\n", e_reflow_model)); - d(depth++); - g_signal_emit (e_reflow_model, - e_reflow_model_signals [COMPARISON_CHANGED], 0); - d(depth--); -} - -/** - * e_reflow_model_items_inserted: - * @e_reflow_model: The model changed. - * @position: The position the items were insert in. - * @count: The number of items inserted. - * - * Use this function to notify any views of the reflow model that a number of items have been inserted. - **/ -void -e_reflow_model_items_inserted (EReflowModel *e_reflow_model, int position, int count) -{ - g_return_if_fail (e_reflow_model != NULL); - g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model)); - - d(print_tabs()); - d(g_print("Emitting items_inserted on model 0x%p, position=%d, count=%d.\n", e_reflow_model, position, count)); - d(depth++); - g_signal_emit (e_reflow_model, - e_reflow_model_signals [MODEL_ITEMS_INSERTED], 0, - position, count); - d(depth--); -} - -/** - * e_reflow_model_item_removed: - * @e_reflow_model: The model changed. - * @n: The position from which the items were removed. - * - * Use this function to notify any views of the reflow model that an - * item has been removed. - **/ -void -e_reflow_model_item_removed (EReflowModel *e_reflow_model, - int n) -{ - g_return_if_fail (e_reflow_model != NULL); - g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model)); - - d(print_tabs()); - d(g_print("Emitting item_removed on model 0x%p, n=%d.\n", e_reflow_model, n)); - d(depth++); - g_signal_emit (e_reflow_model, - e_reflow_model_signals [MODEL_ITEM_REMOVED], 0, - n); - d(depth--); -} - - -/** - * e_reflow_model_item_changed: - * @e_reflow_model: the reflow model to notify of the change - * @item: the item that was changed in the model. - * - * Use this function to notify any views of the reflow model that the - * contents of item @item have changed in model such that the height - * has changed or the item needs to be reincarnated. This function - * will emit the "model_item_changed" signal on the @e_reflow_model - * object - */ -void -e_reflow_model_item_changed (EReflowModel *e_reflow_model, int n) -{ - g_return_if_fail (e_reflow_model != NULL); - g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model)); - - d(print_tabs()); - d(g_print("Emitting item_changed on model 0x%p, n=%d.\n", e_reflow_model, n)); - d(depth++); - g_signal_emit (e_reflow_model, - e_reflow_model_signals [MODEL_ITEM_CHANGED], 0, - n); - d(depth--); -} diff --git a/widgets/misc/e-reflow-model.h b/widgets/misc/e-reflow-model.h deleted file mode 100644 index 25731b2af5..0000000000 --- a/widgets/misc/e-reflow-model.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-reflow-model.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _E_REFLOW_MODEL_H_ -#define _E_REFLOW_MODEL_H_ - -#include <glib-object.h> -#include <libgnomecanvas/gnome-canvas.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define E_REFLOW_MODEL_TYPE (e_reflow_model_get_type ()) -#define E_REFLOW_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_REFLOW_MODEL_TYPE, EReflowModel)) -#define E_REFLOW_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_REFLOW_MODEL_TYPE, EReflowModelClass)) -#define E_IS_REFLOW_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_REFLOW_MODEL_TYPE)) -#define E_IS_REFLOW_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_REFLOW_MODEL_TYPE)) -#define E_REFLOW_MODEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_REFLOW_MODEL_TYPE, EReflowModelClass)) - -typedef struct { - GObject base; -} EReflowModel; - -typedef struct { - GObjectClass parent_class; - - /* - * Virtual methods - */ - void (*set_width) (EReflowModel *etm, int width); - - int (*count) (EReflowModel *etm); - int (*height) (EReflowModel *etm, int n, GnomeCanvasGroup *parent); - GnomeCanvasItem *(*incarnate) (EReflowModel *etm, int n, GnomeCanvasGroup *parent); - int (*compare) (EReflowModel *etm, int n1, int n2); - void (*reincarnate) (EReflowModel *etm, int n, GnomeCanvasItem *item); - - /* - * Signals - */ - - /* - * These all come after the change has been made. - * Major structural changes: model_changed - * Changes to the sorting of elements: comparison_changed - * Changes only in an item: item_changed - */ - void (*model_changed) (EReflowModel *etm); - void (*comparison_changed) (EReflowModel *etm); - void (*model_items_inserted) (EReflowModel *etm, int position, int count); - void (*model_item_removed) (EReflowModel *etm, int position); - void (*model_item_changed) (EReflowModel *etm, int n); -} EReflowModelClass; - -GType e_reflow_model_get_type (void); - -/**/ -void e_reflow_model_set_width (EReflowModel *e_reflow_model, - int width); -int e_reflow_model_count (EReflowModel *e_reflow_model); -int e_reflow_model_height (EReflowModel *e_reflow_model, - int n, - GnomeCanvasGroup *parent); -GnomeCanvasItem *e_reflow_model_incarnate (EReflowModel *e_reflow_model, - int n, - GnomeCanvasGroup *parent); -int e_reflow_model_compare (EReflowModel *e_reflow_model, - int n1, - int n2); -void e_reflow_model_reincarnate (EReflowModel *e_reflow_model, - int n, - GnomeCanvasItem *item); - -/* - * Routines for emitting signals on the e_reflow - */ -void e_reflow_model_changed (EReflowModel *e_reflow_model); -void e_reflow_model_comparison_changed (EReflowModel *e_reflow_model); -void e_reflow_model_items_inserted (EReflowModel *e_reflow_model, - int position, - int count); -void e_reflow_model_item_removed (EReflowModel *e_reflow_model, - int n); -void e_reflow_model_item_changed (EReflowModel *e_reflow_model, - int n); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_REFLOW_MODEL_H_ */ diff --git a/widgets/misc/e-reflow.c b/widgets/misc/e-reflow.c deleted file mode 100644 index e0eae3d6f3..0000000000 --- a/widgets/misc/e-reflow.c +++ /dev/null @@ -1,1501 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-reflow.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <config.h> - -#include "e-reflow.h" - -#include <math.h> -#include <gdk/gdkkeysyms.h> -#include "e-canvas-utils.h" -#include "e-canvas.h" -#include "gal/e-text/e-text.h" -#include "gal/util/e-util.h" -#include "gal/util/e-i18n.h" -#include "gal/widgets/e-unicode.h" -#include <gtk/gtksignal.h> -#include "e-selection-model-simple.h" - -#include <string.h> - -static gboolean e_reflow_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_reflow_realize (GnomeCanvasItem *item); -static void e_reflow_unrealize (GnomeCanvasItem *item); -static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); -static void e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags); -static double e_reflow_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, GnomeCanvasItem **actual_item); -static void e_reflow_reflow (GnomeCanvasItem *item, int flags); -static void set_empty(EReflow *reflow); - -static void e_reflow_resize_children (GnomeCanvasItem *item); - -#define E_REFLOW_DIVIDER_WIDTH 2 -#define E_REFLOW_BORDER_WIDTH 7 -#define E_REFLOW_FULL_GUTTER (E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH * 2) - -#define PARENT_TYPE GNOME_TYPE_CANVAS_GROUP -static GnomeCanvasGroupClass *parent_class = NULL; - -/* The arguments we take */ -enum { - PROP_0, - PROP_MINIMUM_WIDTH, - PROP_WIDTH, - PROP_HEIGHT, - PROP_EMPTY_MESSAGE, - PROP_MODEL, - PROP_COLUMN_WIDTH -}; - -enum { - SELECTION_EVENT, - COLUMN_WIDTH_CHANGED, - LAST_SIGNAL -}; - -static guint signals [LAST_SIGNAL] = {0, }; - -static gint -er_compare (int i1, int i2, gpointer user_data) -{ - EReflow *reflow = user_data; - return e_reflow_model_compare (reflow->model, i1, i2); -} - -static gint -e_reflow_pick_line (EReflow *reflow, double x) -{ - x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - x /= reflow->column_width + E_REFLOW_FULL_GUTTER; - return x; -} - -static int -er_find_item (EReflow *reflow, GnomeCanvasItem *item) -{ - int i; - for (i = 0; i < reflow->count; i++) { - if (reflow->items[i] == item) - return i; - } - return -1; -} - -static void -e_reflow_resize_children (GnomeCanvasItem *item) -{ - EReflow *reflow; - int i; - int count; - - reflow = E_REFLOW (item); - - count = reflow->count; - for (i = 0; i < count; i++) { - if (reflow->items[i]) - gnome_canvas_item_set(reflow->items[i], - "width", (double) reflow->column_width, - NULL); - } -} - -static inline void -e_reflow_update_selection_row (EReflow *reflow, int row) -{ - if (reflow->items[row]) { - g_object_set(reflow->items[row], - "selected", e_selection_model_is_row_selected(E_SELECTION_MODEL(reflow->selection), row), - NULL); - } else if (e_selection_model_is_row_selected (E_SELECTION_MODEL (reflow->selection), row)) { - reflow->items[row] = e_reflow_model_incarnate (reflow->model, row, GNOME_CANVAS_GROUP (reflow)); - g_object_set (reflow->items[row], - "selected", e_selection_model_is_row_selected(E_SELECTION_MODEL(reflow->selection), row), - "width", (double) reflow->column_width, - NULL); - } -} - -static void -e_reflow_update_selection (EReflow *reflow) -{ - int i; - int count; - - count = reflow->count; - for (i = 0; i < count; i++) { - e_reflow_update_selection_row (reflow, i); - } -} - -static void -selection_changed (ESelectionModel *selection, EReflow *reflow) -{ - e_reflow_update_selection (reflow); -} - -static void -selection_row_changed (ESelectionModel *selection, int row, EReflow *reflow) -{ - e_reflow_update_selection_row (reflow, row); -} - -static void -cursor_changed (ESelectionModel *selection, int row, int col, EReflow *reflow) -{ - int count = reflow->count; - int old_cursor = reflow->cursor_row; - - if (old_cursor < count && old_cursor >= 0) { - if (reflow->items[old_cursor]) { - g_object_set (reflow->items[old_cursor], - "has_cursor", FALSE, - NULL); - } - } - - reflow->cursor_row = row; - - if (row < count && row >= 0) { - if (reflow->items[row]) { - g_object_set (reflow->items[row], - "has_cursor", TRUE, - NULL); - } else { - reflow->items[row] = e_reflow_model_incarnate (reflow->model, row, GNOME_CANVAS_GROUP (reflow)); - g_object_set (reflow->items[row], - "has_cursor", TRUE, - "width", (double) reflow->column_width, - NULL); - } - } -} - -static void -incarnate (EReflow *reflow) -{ - int column_width; - int first_column; - int last_column; - int first_cell; - int last_cell; - int i; - GtkAdjustment *adjustment = gtk_layout_get_hadjustment (GTK_LAYOUT (GNOME_CANVAS_ITEM (reflow)->canvas)); - - column_width = reflow->column_width; - - first_column = adjustment->value - 1 + E_REFLOW_BORDER_WIDTH; - first_column /= column_width + E_REFLOW_FULL_GUTTER; - - last_column = adjustment->value + adjustment->page_size + 1 - E_REFLOW_BORDER_WIDTH - E_REFLOW_DIVIDER_WIDTH; - last_column /= column_width + E_REFLOW_FULL_GUTTER; - last_column ++; - - if (first_column >= 0 && first_column < reflow->column_count) - first_cell = reflow->columns[first_column]; - else - first_cell = 0; - - if (last_column >= 0 && last_column < reflow->column_count) - last_cell = reflow->columns[last_column]; - else - last_cell = reflow->count; - - for (i = first_cell; i < last_cell; i++) { - int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i); - if (reflow->items[unsorted] == NULL) { - if (reflow->model) { - reflow->items[unsorted] = e_reflow_model_incarnate (reflow->model, unsorted, GNOME_CANVAS_GROUP (reflow)); - g_object_set (reflow->items[unsorted], - "selected", e_selection_model_is_row_selected(E_SELECTION_MODEL(reflow->selection), unsorted), - "width", (double) reflow->column_width, - NULL); - } - } - } - reflow->incarnate_idle_id = 0; -} - -static gboolean -invoke_incarnate (gpointer user_data) -{ - EReflow *reflow = user_data; - incarnate (reflow); - return FALSE; -} - -static void -queue_incarnate (EReflow *reflow) -{ - if (reflow->incarnate_idle_id == 0) - reflow->incarnate_idle_id = - g_idle_add_full (25, invoke_incarnate, reflow, NULL); -} - -static void -reflow_columns (EReflow *reflow) -{ - GSList *list; - int count; - int start; - int i; - int column_count, column_start; - double running_height; - - if (reflow->reflow_from_column <= 1) { - start = 0; - column_count = 1; - column_start = 0; - } - else { - /* we start one column before the earliest new entry, - so we can handle the case where the new entry is - inserted at the start of the column */ - column_start = reflow->reflow_from_column - 1; - start = reflow->columns[column_start]; - column_count = column_start + 1; - } - - list = NULL; - - running_height = E_REFLOW_BORDER_WIDTH; - - count = reflow->count - start; - for (i = start; i < count; i++) { - int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i); - if (i != 0 && running_height + reflow->heights[unsorted] + E_REFLOW_BORDER_WIDTH > reflow->height) { - list = g_slist_prepend (list, GINT_TO_POINTER(i)); - column_count ++; - running_height = E_REFLOW_BORDER_WIDTH * 2 + reflow->heights[unsorted]; - } else - running_height += reflow->heights[unsorted] + E_REFLOW_BORDER_WIDTH; - } - - reflow->column_count = column_count; - reflow->columns = g_renew (int, reflow->columns, column_count); - column_count --; - - for (; column_count > column_start; column_count--) { - GSList *to_free; - reflow->columns[column_count] = GPOINTER_TO_INT(list->data); - to_free = list; - list = list->next; - g_slist_free_1 (to_free); - } - reflow->columns[column_start] = start; - - queue_incarnate (reflow); - - reflow->need_reflow_columns = FALSE; - reflow->reflow_from_column = -1; -} - -static void -item_changed (EReflowModel *model, int i, EReflow *reflow) -{ - if (i < 0 || i >= reflow->count) - return; - - reflow->heights[i] = e_reflow_model_height (reflow->model, i, GNOME_CANVAS_GROUP (reflow)); - if (reflow->items[i] != NULL) - e_reflow_model_reincarnate (model, i, reflow->items[i]); - e_sorter_array_clean (reflow->sorter); - reflow->reflow_from_column = -1; - reflow->need_reflow_columns = TRUE; - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow)); -} - -static void -item_removed (EReflowModel *model, int i, EReflow *reflow) -{ - int c; - int sorted; - - if (i < 0 || i >= reflow->count) - return; - - if (reflow->items[i]) - gtk_object_destroy (GTK_OBJECT (reflow->items[i])); - - memmove (reflow->heights + i, reflow->heights + i + 1, (reflow->count - i - 1) * sizeof (int)); - memmove (reflow->items + i, reflow->items + i + 1, (reflow->count - i - 1) * sizeof (GnomeCanvasItem *)); - - reflow->count --; - - sorted = e_sorter_model_to_sorted (E_SORTER (reflow->sorter), i); - for (c = reflow->column_count - 1; c >= 0; c--) { - int start_of_column = reflow->columns[c]; - - if (start_of_column <= sorted) { - if (reflow->reflow_from_column == -1 - || reflow->reflow_from_column > c) { - reflow->reflow_from_column = c; - } - break; - } - } - - reflow->need_reflow_columns = TRUE; - set_empty (reflow); - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow)); - - e_sorter_array_set_count (reflow->sorter, reflow->count); - - e_selection_model_simple_delete_rows (E_SELECTION_MODEL_SIMPLE (reflow->selection), i, 1); -} - -static void -items_inserted (EReflowModel *model, int position, int count, EReflow *reflow) -{ - int i, c; - int oldcount; - int lowest_column; - - if (position < 0 || position > reflow->count) - return; - - oldcount = reflow->count; - - reflow->count += count; - - if (reflow->count > reflow->allocated_count) { - while (reflow->count > reflow->allocated_count) - reflow->allocated_count += 256; - reflow->heights = g_renew (int, reflow->heights, reflow->allocated_count); - reflow->items = g_renew (GnomeCanvasItem *, reflow->items, reflow->allocated_count); - } - memmove (reflow->heights + position + count, reflow->heights + position, (reflow->count - position - count) * sizeof (int)); - memmove (reflow->items + position + count, reflow->items + position, (reflow->count - position - count) * sizeof (GnomeCanvasItem *)); - for (i = position; i < position + count; i++) { - reflow->items[i] = 0; - reflow->heights[i] = e_reflow_model_height (reflow->model, i, GNOME_CANVAS_GROUP (reflow)); - } - - e_selection_model_simple_set_row_count (E_SELECTION_MODEL_SIMPLE (reflow->selection), reflow->count); - if (position == oldcount) - e_sorter_array_append (reflow->sorter, count); - else - e_sorter_array_set_count (reflow->sorter, reflow->count); - - for (i = position; i < position + count; i ++) { - int sorted = e_sorter_model_to_sorted (E_SORTER (reflow->sorter), i); - int c; - - for (c = reflow->column_count - 1; c >= 0; c--) { - int start_of_column = reflow->columns[c]; - - if (start_of_column <= sorted) { - if (reflow->reflow_from_column == -1 - || reflow->reflow_from_column > c) { - reflow->reflow_from_column = c; - } - break; - } - } - } - - reflow->need_reflow_columns = TRUE; - set_empty (reflow); - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow)); -} - -static void -model_changed (EReflowModel *model, EReflow *reflow) -{ - int i; - int count; - int oldcount; - - count = reflow->count; - oldcount = count; - - for (i = 0; i < count; i++) { - if (reflow->items[i]) - gtk_object_destroy (GTK_OBJECT (reflow->items[i])); - } - g_free (reflow->items); - g_free (reflow->heights); - reflow->count = e_reflow_model_count (model); - reflow->allocated_count = reflow->count; - reflow->items = g_new (GnomeCanvasItem *, reflow->count); - reflow->heights = g_new (int, reflow->count); - - count = reflow->count; - for (i = 0; i < count; i++) { - reflow->items[i] = 0; - reflow->heights[i] = e_reflow_model_height (reflow->model, i, GNOME_CANVAS_GROUP (reflow)); - } - - e_selection_model_simple_set_row_count (E_SELECTION_MODEL_SIMPLE (reflow->selection), count); - e_sorter_array_set_count (reflow->sorter, reflow->count); - - reflow->need_reflow_columns = TRUE; - if (oldcount > reflow->count) - reflow_columns (reflow); - set_empty (reflow); - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow)); -} - -static void -comparison_changed (EReflowModel *model, EReflow *reflow) -{ - e_sorter_array_clean (reflow->sorter); - reflow->reflow_from_column = -1; - reflow->need_reflow_columns = TRUE; - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow)); -} - -static void -set_empty(EReflow *reflow) -{ - if (reflow->count == 0) { - if (reflow->empty_text) { - if (reflow->empty_message) { - gnome_canvas_item_set(reflow->empty_text, - "width", reflow->minimum_width, - "text", reflow->empty_message, - NULL); - e_canvas_item_move_absolute(reflow->empty_text, - reflow->minimum_width / 2, - 0); - } else { - gtk_object_destroy(GTK_OBJECT(reflow->empty_text)); - reflow->empty_text = NULL; - } - } else { - if (reflow->empty_message) { - reflow->empty_text = - gnome_canvas_item_new(GNOME_CANVAS_GROUP(reflow), - e_text_get_type(), - "anchor", GTK_ANCHOR_N, - "width", reflow->minimum_width, - "clip", TRUE, - "use_ellipsis", TRUE, - "fill_color", "black", - "justification", GTK_JUSTIFY_CENTER, - "text", reflow->empty_message, - "draw_background", FALSE, - NULL); - e_canvas_item_move_absolute(reflow->empty_text, - reflow->minimum_width / 2, - 0); - } - } - } else { - if (reflow->empty_text) { - gtk_object_destroy(GTK_OBJECT(reflow->empty_text)); - reflow->empty_text = NULL; - } - } -} - -static void -disconnect_model (EReflow *reflow) -{ - if (reflow->model == NULL) - return; - - g_signal_handler_disconnect (reflow->model, - reflow->model_changed_id); - g_signal_handler_disconnect (reflow->model, - reflow->comparison_changed_id); - g_signal_handler_disconnect (reflow->model, - reflow->model_items_inserted_id); - g_signal_handler_disconnect (reflow->model, - reflow->model_item_removed_id); - g_signal_handler_disconnect (reflow->model, - reflow->model_item_changed_id); - g_object_unref (reflow->model); - - reflow->model_changed_id = 0; - reflow->comparison_changed_id = 0; - reflow->model_items_inserted_id = 0; - reflow->model_item_removed_id = 0; - reflow->model_item_changed_id = 0; - reflow->model = NULL; -} - -static void -disconnect_selection (EReflow *reflow) -{ - if (reflow->selection == NULL) - return; - - g_signal_handler_disconnect (reflow->selection, - reflow->selection_changed_id); - g_signal_handler_disconnect (reflow->selection, - reflow->selection_row_changed_id); - g_signal_handler_disconnect (reflow->selection, - reflow->cursor_changed_id); - g_object_unref (reflow->selection); - - reflow->selection_changed_id = 0; - reflow->selection_row_changed_id = 0; - reflow->cursor_changed_id = 0; - reflow->selection = NULL; -} - -static void -connect_model (EReflow *reflow, EReflowModel *model) -{ - if (reflow->model != NULL) - disconnect_model (reflow); - - if (model == NULL) - return; - - reflow->model = model; - g_object_ref (reflow->model); - reflow->model_changed_id = - g_signal_connect (reflow->model, "model_changed", - G_CALLBACK (model_changed), reflow); - reflow->comparison_changed_id = - g_signal_connect (reflow->model, "comparison_changed", - G_CALLBACK (comparison_changed), reflow); - reflow->model_items_inserted_id = - g_signal_connect (reflow->model, "model_items_inserted", - G_CALLBACK (items_inserted), reflow); - reflow->model_item_removed_id = - g_signal_connect (reflow->model, "model_item_removed", - G_CALLBACK (item_removed), reflow); - reflow->model_item_changed_id = - g_signal_connect (reflow->model, "model_item_changed", - G_CALLBACK (item_changed), reflow); - model_changed (model, reflow); -} - -static void -adjustment_changed (GtkAdjustment *adjustment, EReflow *reflow) -{ - queue_incarnate (reflow); -} - -static void -disconnect_adjustment (EReflow *reflow) -{ - if (reflow->adjustment == NULL) - return; - - g_signal_handler_disconnect (reflow->adjustment, - reflow->adjustment_changed_id); - g_signal_handler_disconnect (reflow->adjustment, - reflow->adjustment_value_changed_id); - - g_object_unref (reflow->adjustment); - - reflow->adjustment_changed_id = 0; - reflow->adjustment_value_changed_id = 0; - reflow->adjustment = NULL; -} - -static void -connect_adjustment (EReflow *reflow, GtkAdjustment *adjustment) -{ - if (reflow->adjustment != NULL) - disconnect_adjustment (reflow); - - if (adjustment == NULL) - return; - - reflow->adjustment = adjustment; - reflow->adjustment_changed_id = - g_signal_connect (adjustment, "changed", - G_CALLBACK (adjustment_changed), reflow); - reflow->adjustment_value_changed_id = - g_signal_connect (adjustment, "value_changed", - G_CALLBACK (adjustment_changed), reflow); - g_object_ref (adjustment); -} - -#if 0 -static void -set_scroll_adjustments (GtkLayout *layout, GtkAdjustment *hadj, GtkAdjustment *vadj, EReflow *reflow) -{ - connect_adjustment (reflow, hadj); -} - -static void -connect_set_adjustment (EReflow *reflow) -{ - reflow->set_scroll_adjustments_id = - g_signal_connect (GNOME_CANVAS_ITEM (reflow)->canvas, - "set_scroll_adjustments", - G_CALLBACK (set_scroll_adjustments), reflow); -} -#endif - -static void -disconnect_set_adjustment (EReflow *reflow) -{ - if (reflow->set_scroll_adjustments_id != 0) { - g_signal_handler_disconnect (GNOME_CANVAS_ITEM (reflow)->canvas, - reflow->set_scroll_adjustments_id); - reflow->set_scroll_adjustments_id = 0; - } -} - -static void -column_width_changed (EReflow *reflow) -{ - g_signal_emit (reflow, signals[COLUMN_WIDTH_CHANGED], 0, reflow->column_width); -} - - - - -/* Virtual functions */ -static void -e_reflow_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - GnomeCanvasItem *item; - EReflow *reflow; - - item = GNOME_CANVAS_ITEM (object); - reflow = E_REFLOW (object); - - switch (prop_id){ - case PROP_HEIGHT: - reflow->height = g_value_get_double (value); - reflow->need_reflow_columns = TRUE; - e_canvas_item_request_reflow(item); - break; - case PROP_MINIMUM_WIDTH: - reflow->minimum_width = g_value_get_double (value); - if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(object)) - set_empty(reflow); - e_canvas_item_request_reflow(item); - break; - case PROP_EMPTY_MESSAGE: - g_free(reflow->empty_message); - reflow->empty_message = g_strdup(g_value_get_string (value)); - if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(object)) - set_empty(reflow); - break; - case PROP_MODEL: - connect_model (reflow, (EReflowModel *) g_value_get_object (value)); - break; - case PROP_COLUMN_WIDTH: - if (reflow->column_width != g_value_get_double (value)) { - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - double old_width = reflow->column_width; - - reflow->column_width = g_value_get_double (value); - adjustment->step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2; - adjustment->page_increment = adjustment->page_size - adjustment->step_increment; - gtk_adjustment_changed(adjustment); - e_reflow_resize_children(item); - e_canvas_item_request_reflow(item); - - reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - - if (old_width != reflow->column_width) - column_width_changed (reflow); - } - break; - } -} - -static void -e_reflow_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - EReflow *reflow; - - reflow = E_REFLOW (object); - - switch (prop_id) { - case PROP_MINIMUM_WIDTH: - g_value_set_double (value, reflow->minimum_width); - break; - case PROP_WIDTH: - g_value_set_double (value, reflow->width); - break; - case PROP_HEIGHT: - g_value_set_double (value, reflow->height); - break; - case PROP_EMPTY_MESSAGE: - g_value_set_string (value, g_strdup(reflow->empty_message)); - break; - case PROP_MODEL: - g_value_set_object (value, reflow->model); - break; - case PROP_COLUMN_WIDTH: - g_value_set_double (value, reflow->column_width); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_reflow_dispose (GObject *object) -{ - EReflow *reflow = E_REFLOW(object); - - g_free (reflow->items); - g_free (reflow->heights); - g_free (reflow->columns); - - reflow->items = NULL; - reflow->heights = NULL; - reflow->columns = NULL; - reflow->count = 0; - reflow->allocated_count = 0; - - if (reflow->incarnate_idle_id) - g_source_remove (reflow->incarnate_idle_id); - reflow->incarnate_idle_id = 0; - - disconnect_model (reflow); - disconnect_selection (reflow); - - g_free(reflow->empty_message); - reflow->empty_message = NULL; - - G_OBJECT_CLASS(parent_class)->dispose (object); -} - -static void -e_reflow_realize (GnomeCanvasItem *item) -{ - EReflow *reflow; - GnomeCanvasGroup *group; - GtkAdjustment *adjustment; - int count; - int i; - - reflow = E_REFLOW (item); - group = GNOME_CANVAS_GROUP (item); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item); - - reflow->arrow_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW); - reflow->default_cursor = gdk_cursor_new (GDK_LEFT_PTR); - - count = reflow->count; - for(i = 0; i < count; i++) { - if (reflow->items[i]) - gnome_canvas_item_set(reflow->items[i], - "width", reflow->column_width, - NULL); - } - - set_empty(reflow); - - reflow->need_reflow_columns = TRUE; - e_canvas_item_request_reflow(item); - - adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - -#if 0 - connect_set_adjustment (reflow); -#endif - connect_adjustment (reflow, adjustment); - - adjustment->step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2; - adjustment->page_increment = adjustment->page_size - adjustment->step_increment; - gtk_adjustment_changed(adjustment); - - if (!item->canvas->aa) { - } -} - -static void -e_reflow_unrealize (GnomeCanvasItem *item) -{ - EReflow *reflow; - - reflow = E_REFLOW (item); - - if (!item->canvas->aa) { - } - - gdk_cursor_destroy (reflow->arrow_cursor); - gdk_cursor_destroy (reflow->default_cursor); - reflow->arrow_cursor = NULL; - reflow->default_cursor = NULL; - - g_free (reflow->columns); - reflow->columns = NULL; - - disconnect_set_adjustment (reflow); - disconnect_adjustment (reflow); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item); -} - -static gboolean -e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EReflow *reflow; - int return_val = FALSE; - - reflow = E_REFLOW (item); - - switch( event->type ) - { - case GDK_KEY_PRESS: - return_val = e_selection_model_key_press(reflow->selection, (GdkEventKey *) event); - break; -#if 0 - if (event->key.keyval == GDK_Tab || - event->key.keyval == GDK_KP_Tab || - event->key.keyval == GDK_ISO_Left_Tab) { - int i; - int count; - count = reflow->count; - for (i = 0; i < count; i++) { - int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i); - GnomeCanvasItem *item = reflow->items[unsorted]; - EFocus has_focus; - if (item) { - g_object_get(item, - "has_focus", &has_focus, - NULL); - if (has_focus) { - if (event->key.state & GDK_SHIFT_MASK) { - if (i == 0) - return 0; - i--; - } else { - if (i == count - 1) - return 0; - i++; - } - - unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i); - if (reflow->items[unsorted] == NULL) { - reflow->items[unsorted] = e_reflow_model_incarnate (reflow->model, unsorted, GNOME_CANVAS_GROUP (reflow)); - } - - item = reflow->items[unsorted]; - gnome_canvas_item_set(item, - "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START, - NULL); - return 1; - } - } - } - } -#endif - break; - case GDK_BUTTON_PRESS: - switch(event->button.button) - { - case 1: - { - GdkEventButton *button = (GdkEventButton *) event; - double n_x, max_x; - n_x = button->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER)); - - max_x = E_REFLOW_BORDER_WIDTH; - max_x += (reflow->column_width + E_REFLOW_FULL_GUTTER) * reflow->column_count; - if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > button->x ) { - reflow->which_column_dragged = e_reflow_pick_line(reflow, button->x); - reflow->start_x = reflow->which_column_dragged * (reflow->column_width + E_REFLOW_FULL_GUTTER) - E_REFLOW_DIVIDER_WIDTH / 2; - reflow->temp_column_width = reflow->column_width; - reflow->column_drag = TRUE; - - gnome_canvas_item_grab (item, - GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, - reflow->arrow_cursor, - button->time); - - reflow->previous_temp_column_width = -1; - reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - return TRUE; - } - } - break; - case 4: - { - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - gdouble new_value = adjustment->value; - new_value -= adjustment->step_increment; - gtk_adjustment_set_value(adjustment, new_value); - } - break; - case 5: - { - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - gdouble new_value = adjustment->value; - new_value += adjustment->step_increment; - if ( new_value > adjustment->upper - adjustment->page_size ) - new_value = adjustment->upper - adjustment->page_size; - gtk_adjustment_set_value(adjustment, new_value); - } - break; - } - break; - case GDK_BUTTON_RELEASE: - if (reflow->column_drag) { - gdouble old_width = reflow->column_width; - GdkEventButton *button = (GdkEventButton *) event; - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - reflow->temp_column_width = reflow->column_width + - (button->x - reflow->start_x)/(reflow->which_column_dragged - e_reflow_pick_line(reflow, adjustment->value)); - if ( reflow->temp_column_width < 50 ) - reflow->temp_column_width = 50; - reflow->column_drag = FALSE; - if ( old_width != reflow->temp_column_width ) { - gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(reflow, adjustment->value) * (reflow->temp_column_width - reflow->column_width)); - reflow->column_width = reflow->temp_column_width; - adjustment->step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2; - adjustment->page_increment = adjustment->page_size - adjustment->step_increment; - gtk_adjustment_changed(adjustment); - e_reflow_resize_children(item); - e_canvas_item_request_reflow(item); - gnome_canvas_request_redraw(item->canvas, 0, 0, reflow->width, reflow->height); - column_width_changed (reflow); - } - reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - gnome_canvas_item_ungrab (item, button->time); - return TRUE; - } - break; - case GDK_MOTION_NOTIFY: - if (reflow->column_drag) { - double old_width = reflow->temp_column_width; - GdkEventMotion *motion = (GdkEventMotion *) event; - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - reflow->temp_column_width = reflow->column_width + - (motion->x - reflow->start_x)/(reflow->which_column_dragged - e_reflow_pick_line(reflow, adjustment->value)); - if (reflow->temp_column_width < 50) - reflow->temp_column_width = 50; - if (old_width != reflow->temp_column_width) { - reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - } - return TRUE; - } else { - GdkEventMotion *motion = (GdkEventMotion *) event; - double n_x, max_x; - - n_x = motion->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER)); - - max_x = E_REFLOW_BORDER_WIDTH; - max_x += (reflow->column_width + E_REFLOW_FULL_GUTTER) * reflow->column_count; - - if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > motion->x) { - if ( reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->arrow_cursor); - reflow->default_cursor_shown = FALSE; - } - } else - if ( ! reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->default_cursor); - reflow->default_cursor_shown = TRUE; - } - - } - break; - case GDK_ENTER_NOTIFY: - if (!reflow->column_drag) { - GdkEventCrossing *crossing = (GdkEventCrossing *) event; - double n_x, max_x; - n_x = crossing->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER)); - - max_x = E_REFLOW_BORDER_WIDTH; - max_x += (reflow->column_width + E_REFLOW_FULL_GUTTER) * reflow->column_count; - if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > crossing->x) { - if ( reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->arrow_cursor); - reflow->default_cursor_shown = FALSE; - } - } - } - break; - case GDK_LEAVE_NOTIFY: - if (!reflow->column_drag) { - GdkEventCrossing *crossing = (GdkEventCrossing *) event; - double n_x; - n_x = crossing->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( !( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) ) { - if ( ! reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->default_cursor); - reflow->default_cursor_shown = TRUE; - } - } - } - break; - default: - break; - } - if (return_val) - return return_val; - else if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event) - return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event); - else - return FALSE; -} - -static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) -{ - int x_rect, y_rect, width_rect, height_rect; - gdouble running_width; - EReflow *reflow = E_REFLOW(item); - int i; - double column_width; - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw) - GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height); - column_width = reflow->column_width; - running_width = E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - x_rect = running_width; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - /* Compute first column to draw. */ - i = x; - i /= column_width + E_REFLOW_FULL_GUTTER; - running_width += i * (column_width + E_REFLOW_FULL_GUTTER); - - for ( ; i < reflow->column_count; i++) { - if ( running_width > x + width ) - break; - x_rect = running_width; - gtk_paint_flat_box(GTK_WIDGET(item->canvas)->style, - drawable, - GTK_STATE_ACTIVE, - GTK_SHADOW_NONE, - NULL, - GTK_WIDGET(item->canvas), - "reflow", - x_rect - x, - y_rect - y, - width_rect, - height_rect); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - if (reflow->column_drag) { - int start_line = e_reflow_pick_line(reflow, - gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value); - i = x - start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width = start_line * (column_width + E_REFLOW_FULL_GUTTER); - column_width = reflow->temp_column_width; - running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER); - i += start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - x_rect = running_width; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - /* Compute first column to draw. */ - i /= column_width + E_REFLOW_FULL_GUTTER; - running_width += i * (column_width + E_REFLOW_FULL_GUTTER); - - for ( ; i < reflow->column_count; i++) { - if ( running_width > x + width ) - break; - x_rect = running_width; - gdk_draw_rectangle(drawable, - GTK_WIDGET(item->canvas)->style->fg_gc[GTK_STATE_NORMAL], - TRUE, - x_rect - x, - y_rect - y, - width_rect - 1, - height_rect - 1); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - } -} - -static void -e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags) -{ - EReflow *reflow; - double x0, x1, y0, y1; - - reflow = E_REFLOW (item); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->update) - GNOME_CANVAS_ITEM_CLASS(parent_class)->update (item, affine, clip_path, flags); - - x0 = item->x1; - y0 = item->y1; - x1 = item->x2; - y1 = item->y2; - if ( x1 < x0 + reflow->width ) - x1 = x0 + reflow->width; - if ( y1 < y0 + reflow->height ) - y1 = y0 + reflow->height; - item->x2 = x1; - item->y2 = y1; - - if (reflow->need_height_update) { - x0 = item->x1; - y0 = item->y1; - x1 = item->x2; - y1 = item->y2; - if ( x0 > 0 ) - x0 = 0; - if ( y0 > 0 ) - y0 = 0; - if ( x1 < E_REFLOW(item)->width ) - x1 = E_REFLOW(item)->width; - if ( x1 < E_REFLOW(item)->height ) - x1 = E_REFLOW(item)->height; - - gnome_canvas_request_redraw(item->canvas, x0, y0, x1, y1); - reflow->need_height_update = FALSE; - } else if (reflow->need_column_resize) { - int x_rect, y_rect, width_rect, height_rect; - int start_line = e_reflow_pick_line(reflow, - gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value); - gdouble running_width; - int i; - double column_width; - - if ( reflow->previous_temp_column_width != -1 ) { - running_width = start_line * (reflow->column_width + E_REFLOW_FULL_GUTTER); - column_width = reflow->previous_temp_column_width; - running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - for ( i = 0; i < reflow->column_count; i++) { - x_rect = running_width; - gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - } - - if ( reflow->temp_column_width != -1 ) { - running_width = start_line * (reflow->column_width + E_REFLOW_FULL_GUTTER); - column_width = reflow->temp_column_width; - running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - for ( i = 0; i < reflow->column_count; i++) { - x_rect = running_width; - gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - } - - reflow->previous_temp_column_width = reflow->temp_column_width; - reflow->need_column_resize = FALSE; - } -} - -static double -e_reflow_point (GnomeCanvasItem *item, - double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item) -{ - double distance = 1; - - *actual_item = NULL; - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->point) - distance = GNOME_CANVAS_ITEM_CLASS(parent_class)->point (item, x, y, cx, cy, actual_item); - if ((int) (distance * item->canvas->pixels_per_unit + 0.5) <= item->canvas->close_enough && *actual_item) - return distance; - - *actual_item = item; - return 0; -#if 0 - if (y >= E_REFLOW_BORDER_WIDTH && y <= reflow->height - E_REFLOW_BORDER_WIDTH) { - float n_x; - n_x = x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x, (reflow->column_width + E_REFLOW_FULL_GUTTER)); - if (n_x < E_REFLOW_FULL_GUTTER) { - *actual_item = item; - return 0; - } - } - return distance; -#endif -} - -static void -e_reflow_reflow( GnomeCanvasItem *item, int flags ) -{ - EReflow *reflow = E_REFLOW(item); - gdouble old_width; - gdouble running_width; - gdouble running_height; - int next_column; - int i; - - if (! (GTK_OBJECT_FLAGS (reflow) & GNOME_CANVAS_ITEM_REALIZED)) - return; - - if (reflow->need_reflow_columns) { - reflow_columns (reflow); - } - - old_width = reflow->width; - - running_width = E_REFLOW_BORDER_WIDTH; - running_height = E_REFLOW_BORDER_WIDTH; - - next_column = 1; - - for (i = 0; i < reflow->count; i++) { - int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i); - if (next_column < reflow->column_count && i == reflow->columns[next_column]) { - running_height = E_REFLOW_BORDER_WIDTH; - running_width += reflow->column_width + E_REFLOW_FULL_GUTTER; - next_column ++; - } - - if (unsorted >= 0 && reflow->items[unsorted]) { - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(reflow->items[unsorted]), - (double) running_width, - (double) running_height); - running_height += reflow->heights[unsorted] + E_REFLOW_BORDER_WIDTH; - } - } - reflow->width = running_width + reflow->column_width + E_REFLOW_BORDER_WIDTH; - if ( reflow->width < reflow->minimum_width ) - reflow->width = reflow->minimum_width; - if (old_width != reflow->width) - e_canvas_item_request_parent_reflow(item); -} - -static int -e_reflow_selection_event_real (EReflow *reflow, GnomeCanvasItem *item, GdkEvent *event) -{ - int row; - int return_val = TRUE; - switch (event->type) { - case GDK_BUTTON_PRESS: - switch (event->button.button) { - case 1: /* Fall through. */ - case 2: - row = er_find_item (reflow, item); - if (event->button.button == 1) { - reflow->maybe_did_something = - e_selection_model_maybe_do_something(reflow->selection, row, 0, event->button.state); - reflow->maybe_in_drag = TRUE; - } else { - e_selection_model_do_something(reflow->selection, row, 0, event->button.state); - } - break; - case 3: - row = er_find_item (reflow, item); - e_selection_model_right_click_down(reflow->selection, row, 0, 0); - break; - default: - return_val = FALSE; - break; - } - break; - case GDK_BUTTON_RELEASE: - if (event->button.button == 1) { - if (reflow->maybe_in_drag) { - reflow->maybe_in_drag = FALSE; - if (!reflow->maybe_did_something) { - row = er_find_item (reflow, item); - e_selection_model_do_something(reflow->selection, row, 0, event->button.state); - } - } - } - break; - case GDK_KEY_PRESS: - return_val = e_selection_model_key_press(reflow->selection, (GdkEventKey *) event); - break; - default: - return_val = FALSE; - break; - } - - return return_val; -} - -static void -e_reflow_class_init (EReflowClass *klass) -{ - GObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GObjectClass*) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = g_type_class_ref (PARENT_TYPE); - - object_class->set_property = e_reflow_set_property; - object_class->get_property = e_reflow_get_property; - object_class->dispose = e_reflow_dispose; - - /* GnomeCanvasItem method overrides */ - item_class->event = e_reflow_event; - item_class->realize = e_reflow_realize; - item_class->unrealize = e_reflow_unrealize; - item_class->draw = e_reflow_draw; - item_class->update = e_reflow_update; - item_class->point = e_reflow_point; - - klass->selection_event = e_reflow_selection_event_real; - klass->column_width_changed = NULL; - - g_object_class_install_property (object_class, PROP_MINIMUM_WIDTH, - g_param_spec_double ("minimum_width", - _( "Minimum width" ), - _( "Minimum Width" ), - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_WIDTH, - g_param_spec_double ("width", - _( "Width" ), - _( "Width" ), - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READABLE)); - - - g_object_class_install_property (object_class, PROP_HEIGHT, - g_param_spec_double ("height", - _( "Height" ), - _( "Height" ), - 0.0, G_MAXDOUBLE, 0.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EMPTY_MESSAGE, - g_param_spec_string ("empty_message", - _( "Empty message" ), - _( "Empty message" ), - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_MODEL, - g_param_spec_object ("model", - _( "Reflow model" ), - _( "Reflow model" ), - E_REFLOW_MODEL_TYPE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_COLUMN_WIDTH, - g_param_spec_double ("column_width", - _( "Column width" ), - _( "Column width" ), - 0.0, G_MAXDOUBLE, 150.0, - G_PARAM_READWRITE)); - - signals [SELECTION_EVENT] = - g_signal_new ("selection_event", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EReflowClass, selection_event), - NULL, NULL, - e_marshal_INT__OBJECT_BOXED, - G_TYPE_INT, 2, G_TYPE_OBJECT, - GDK_TYPE_EVENT); - - signals [COLUMN_WIDTH_CHANGED] = - g_signal_new ("column_width_changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EReflowClass, column_width_changed), - NULL, NULL, - e_marshal_NONE__DOUBLE, - G_TYPE_NONE, 1, G_TYPE_DOUBLE); -} - -static void -e_reflow_init (EReflow *reflow) -{ - reflow->model = NULL; - reflow->items = NULL; - reflow->heights = NULL; - reflow->count = 0; - - reflow->columns = NULL; - reflow->column_count = 0; - - reflow->empty_text = NULL; - reflow->empty_message = NULL; - - reflow->minimum_width = 10; - reflow->width = 10; - reflow->height = 10; - - reflow->column_width = 150; - - reflow->column_drag = FALSE; - - reflow->need_height_update = FALSE; - reflow->need_column_resize = FALSE; - reflow->need_reflow_columns = FALSE; - - reflow->maybe_did_something = FALSE; - reflow->maybe_in_drag = FALSE; - - reflow->default_cursor_shown = TRUE; - reflow->arrow_cursor = NULL; - reflow->default_cursor = NULL; - - reflow->cursor_row = -1; - - reflow->incarnate_idle_id = 0; - reflow->set_scroll_adjustments_id = 0; - - reflow->selection = E_SELECTION_MODEL (e_selection_model_simple_new()); - reflow->sorter = e_sorter_array_new (er_compare, reflow); - - g_object_set (reflow->selection, - "sorter", reflow->sorter, - NULL); - - reflow->selection_changed_id = - g_signal_connect(reflow->selection, "selection_changed", - G_CALLBACK (selection_changed), reflow); - reflow->selection_row_changed_id = - g_signal_connect(reflow->selection, "selection_row_changed", - G_CALLBACK (selection_row_changed), reflow); - reflow->cursor_changed_id = - g_signal_connect(reflow->selection, "cursor_changed", - G_CALLBACK (cursor_changed), reflow); - - e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(reflow), e_reflow_reflow); -} - -E_MAKE_TYPE (e_reflow, - "EReflow", - EReflow, - e_reflow_class_init, - e_reflow_init, - PARENT_TYPE) diff --git a/widgets/misc/e-reflow.h b/widgets/misc/e-reflow.h deleted file mode 100644 index b92643a935..0000000000 --- a/widgets/misc/e-reflow.h +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-reflow.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef __E_REFLOW_H__ -#define __E_REFLOW_H__ - -#include <libgnomecanvas/gnome-canvas.h> -#include <gal/widgets/e-reflow-model.h> -#include <gal/widgets/e-selection-model.h> -#include <gal/util/e-sorter-array.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EReflow - A canvas item container. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * minimum_width double RW minimum width of the reflow. width >= minimum_width - * width double R width of the reflow - * height double RW height of the reflow - */ - -#define E_REFLOW_TYPE (e_reflow_get_type ()) -#define E_REFLOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_REFLOW_TYPE, EReflow)) -#define E_REFLOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_REFLOW_TYPE, EReflowClass)) -#define E_IS_REFLOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_REFLOW_TYPE)) -#define E_IS_REFLOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_REFLOW_TYPE)) - - -typedef struct EReflowPriv EReflowPriv; - -typedef struct _EReflow EReflow; -typedef struct _EReflowClass EReflowClass; - -struct _EReflow -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - EReflowModel *model; - guint model_changed_id; - guint comparison_changed_id; - guint model_items_inserted_id; - guint model_item_removed_id; - guint model_item_changed_id; - - ESelectionModel *selection; - guint selection_changed_id; - guint selection_row_changed_id; - guint cursor_changed_id; - ESorterArray *sorter; - - GtkAdjustment *adjustment; - guint adjustment_changed_id; - guint adjustment_value_changed_id; - guint set_scroll_adjustments_id; - - int *heights; - GnomeCanvasItem **items; - int count; - int allocated_count; - - int *columns; - gint column_count; /* Number of columnns */ - - GnomeCanvasItem *empty_text; - gchar *empty_message; - - double minimum_width; - double width; - double height; - - double column_width; - - int incarnate_idle_id; - - /* These are all for when the column is being dragged. */ - gdouble start_x; - gint which_column_dragged; - double temp_column_width; - double previous_temp_column_width; - - int cursor_row; - - int reflow_from_column; - - guint column_drag : 1; - - guint need_height_update : 1; - guint need_column_resize : 1; - guint need_reflow_columns : 1; - - guint default_cursor_shown : 1; - - guint maybe_did_something : 1; - guint maybe_in_drag : 1; - GdkCursor *arrow_cursor; - GdkCursor *default_cursor; -}; - -struct _EReflowClass -{ - GnomeCanvasGroupClass parent_class; - - int (*selection_event) (EReflow *reflow, GnomeCanvasItem *item, GdkEvent *event); - void (*column_width_changed) (EReflow *reflow, double width); -}; - -/* - * To be added to a reflow, an item must have the argument "width" as - * a Read/Write argument and "height" as a Read Only argument. It - * should also do an ECanvas parent reflow request if its size - * changes. - */ -GtkType e_reflow_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_REFLOW_H__ */ diff --git a/widgets/misc/e-selection-model-array.c b/widgets/misc/e-selection-model-array.c deleted file mode 100644 index e6e96702a3..0000000000 --- a/widgets/misc/e-selection-model-array.c +++ /dev/null @@ -1,557 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-selection-model-array.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <config.h> -#include <gtk/gtksignal.h> -#include "e-selection-model-array.h" -#include "gal/util/e-i18n.h" -#include "gal/util/e-util.h" - -#define PARENT_TYPE e_selection_model_get_type () - -static ESelectionModelClass *parent_class; - -enum { - PROP_0, - PROP_CURSOR_ROW, - PROP_CURSOR_COL -}; - -void -e_selection_model_array_confirm_row_count(ESelectionModelArray *esma) -{ - if (esma->eba == NULL) { - int row_count = e_selection_model_array_get_row_count(esma); - esma->eba = e_bit_array_new(row_count); - esma->selected_row = -1; - esma->selected_range_end = -1; - } -} - -/* FIXME: Should this deal with moving the selection if it's in single mode? */ -void -e_selection_model_array_delete_rows(ESelectionModelArray *esma, int row, int count) -{ - if (esma->eba) { - if (E_SELECTION_MODEL(esma)->mode == GTK_SELECTION_SINGLE) - e_bit_array_delete_single_mode(esma->eba, row, count); - else - e_bit_array_delete(esma->eba, row, count); - - if (esma->cursor_row > row + count) - esma->cursor_row -= count; - else if (esma->cursor_row > row) - esma->cursor_row = row; - - if (esma->cursor_row >= e_bit_array_bit_count (esma->eba)) { - esma->cursor_row = e_bit_array_bit_count (esma->eba) - 1; - } else if (esma->cursor_row < 0) { - esma->cursor_row = -1; - } - if (esma->cursor_row >= 0) - e_bit_array_change_one_row(esma->eba, esma->cursor_row, TRUE); - - esma->selected_row = -1; - esma->selected_range_end = -1; - e_selection_model_selection_changed(E_SELECTION_MODEL(esma)); - e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), esma->cursor_row, esma->cursor_col); - } -} - -void -e_selection_model_array_insert_rows(ESelectionModelArray *esma, int row, int count) -{ - if (esma->eba) { - e_bit_array_insert(esma->eba, row, count); - - if (esma->cursor_row >= row) - esma->cursor_row += count; - - esma->selected_row = -1; - esma->selected_range_end = -1; - e_selection_model_selection_changed(E_SELECTION_MODEL(esma)); - e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), esma->cursor_row, esma->cursor_col); - } -} - -void -e_selection_model_array_move_row(ESelectionModelArray *esma, int old_row, int new_row) -{ - ESelectionModel *esm = E_SELECTION_MODEL(esma); - - if (esma->eba) { - gboolean selected = e_bit_array_value_at(esma->eba, old_row); - gboolean cursor = (esma->cursor_row == old_row); - - if (old_row < esma->cursor_row && esma->cursor_row < new_row) - esma->cursor_row --; - else if (new_row < esma->cursor_row && esma->cursor_row < old_row) - esma->cursor_row ++; - - e_bit_array_move_row(esma->eba, old_row, new_row); - - if (selected) { - if (esm->mode == GTK_SELECTION_SINGLE) - e_bit_array_select_single_row (esma->eba, new_row); - else - e_bit_array_change_one_row(esma->eba, new_row, TRUE); - } - if (cursor) { - esma->cursor_row = new_row; - } - esma->selected_row = -1; - esma->selected_range_end = -1; - e_selection_model_selection_changed(esm); - e_selection_model_cursor_changed(esm, esma->cursor_row, esma->cursor_col); - } -} - -static void -esma_dispose (GObject *object) -{ - ESelectionModelArray *esma; - - esma = E_SELECTION_MODEL_ARRAY (object); - - if (esma->eba) { - g_object_unref (esma->eba); - esma->eba = NULL; - } - - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); -} - -static void -esma_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY (object); - - switch (prop_id){ - case PROP_CURSOR_ROW: - g_value_set_int (value, esma->cursor_row); - break; - - case PROP_CURSOR_COL: - g_value_set_int (value, esma->cursor_col); - break; - } -} - -static void -esma_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - ESelectionModel *esm = E_SELECTION_MODEL (object); - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY (object); - - switch (prop_id){ - case PROP_CURSOR_ROW: - e_selection_model_do_something(esm, g_value_get_int (value), esma->cursor_col, 0); - break; - - case PROP_CURSOR_COL: - e_selection_model_do_something(esm, esma->cursor_row, g_value_get_int(value), 0); - break; - } -} - -/** - * e_selection_model_is_row_selected - * @selection: #ESelectionModel to check - * @n: The row to check - * - * This routine calculates whether the given row is selected. - * - * Returns: %TRUE if the given row is selected - */ -static gboolean -esma_is_row_selected (ESelectionModel *selection, - gint n) -{ - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection); - if (esma->eba) - return e_bit_array_value_at(esma->eba, n); - else - return FALSE; -} - -/** - * e_selection_model_foreach - * @selection: #ESelectionModel to traverse - * @callback: The callback function to call back. - * @closure: The closure - * - * This routine calls the given callback function once for each - * selected row, passing closure as the closure. - */ -static void -esma_foreach (ESelectionModel *selection, - EForeachFunc callback, - gpointer closure) -{ - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection); - if (esma->eba) - e_bit_array_foreach(esma->eba, callback, closure); -} - -/** - * e_selection_model_clear - * @selection: #ESelectionModel to clear - * - * This routine clears the selection to no rows selected. - */ -static void -esma_clear(ESelectionModel *selection) -{ - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection); - if (esma->eba) { - g_object_unref(esma->eba); - esma->eba = NULL; - } - esma->cursor_row = -1; - esma->cursor_col = -1; - esma->selected_row = -1; - esma->selected_range_end = -1; - e_selection_model_selection_changed(E_SELECTION_MODEL(esma)); - e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), -1, -1); -} - -#define PART(x,n) (((x) & (0x01010101 << n)) >> n) -#define SECTION(x, n) (((x) >> (n * 8)) & 0xff) - -/** - * e_selection_model_selected_count - * @selection: #ESelectionModel to count - * - * This routine calculates the number of rows selected. - * - * Returns: The number of rows selected in the given model. - */ -static gint -esma_selected_count (ESelectionModel *selection) -{ - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection); - if (esma->eba) - return e_bit_array_selected_count(esma->eba); - else - return 0; -} - -/** - * e_selection_model_select_all - * @selection: #ESelectionModel to select all - * - * This routine selects all the rows in the given - * #ESelectionModel. - */ -static void -esma_select_all (ESelectionModel *selection) -{ - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection); - - e_selection_model_array_confirm_row_count(esma); - - e_bit_array_select_all(esma->eba); - - esma->cursor_col = 0; - esma->cursor_row = 0; - esma->selection_start_row = 0; - esma->selected_row = -1; - esma->selected_range_end = -1; - e_selection_model_selection_changed(E_SELECTION_MODEL(esma)); - e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), 0, 0); -} - -/** - * e_selection_model_invert_selection - * @selection: #ESelectionModel to invert - * - * This routine inverts all the rows in the given - * #ESelectionModel. - */ -static void -esma_invert_selection (ESelectionModel *selection) -{ - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection); - - e_selection_model_array_confirm_row_count(esma); - - e_bit_array_invert_selection(esma->eba); - - esma->cursor_col = -1; - esma->cursor_row = -1; - esma->selection_start_row = 0; - esma->selected_row = -1; - esma->selected_range_end = -1; - e_selection_model_selection_changed(E_SELECTION_MODEL(esma)); - e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), -1, -1); -} - -static int -esma_row_count (ESelectionModel *selection) -{ - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection); - e_selection_model_array_confirm_row_count(esma); - return e_bit_array_bit_count(esma->eba); -} - -static void -esma_change_one_row(ESelectionModel *selection, int row, gboolean grow) -{ - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection); - e_selection_model_array_confirm_row_count(esma); - e_bit_array_change_one_row(esma->eba, row, grow); -} - -static void -esma_change_cursor (ESelectionModel *selection, int row, int col) -{ - ESelectionModelArray *esma; - - g_return_if_fail(selection != NULL); - g_return_if_fail(E_IS_SELECTION_MODEL(selection)); - - esma = E_SELECTION_MODEL_ARRAY(selection); - - esma->cursor_row = row; - esma->cursor_col = col; -} - -static void -esma_change_range(ESelectionModel *selection, int start, int end, gboolean grow) -{ - int i; - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection); - if (start != end) { - if (selection->sorter && e_sorter_needs_sorting(selection->sorter)) { - for ( i = start; i < end; i++) { - e_bit_array_change_one_row(esma->eba, e_sorter_sorted_to_model(selection->sorter, i), grow); - } - } else { - e_selection_model_array_confirm_row_count(esma); - e_bit_array_change_range(esma->eba, start, end, grow); - } - } -} - -static int -esma_cursor_row (ESelectionModel *selection) -{ - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection); - return esma->cursor_row; -} - -static int -esma_cursor_col (ESelectionModel *selection) -{ - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection); - return esma->cursor_col; -} - -static void -esma_real_select_single_row (ESelectionModel *selection, int row) -{ - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection); - - e_selection_model_array_confirm_row_count(esma); - - e_bit_array_select_single_row(esma->eba, row); - - esma->selection_start_row = row; - esma->selected_row = row; - esma->selected_range_end = row; -} - -static void -esma_select_single_row (ESelectionModel *selection, int row) -{ - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection); - int selected_row = esma->selected_row; - esma_real_select_single_row (selection, row); - - if (selected_row != -1 && esma->eba && selected_row < e_bit_array_bit_count (esma->eba)) { - if (selected_row != row) { - e_selection_model_selection_row_changed(selection, selected_row); - e_selection_model_selection_row_changed(selection, row); - } - } else { - e_selection_model_selection_changed(selection); - } -} - -static void -esma_toggle_single_row (ESelectionModel *selection, int row) -{ - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection); - - e_selection_model_array_confirm_row_count(esma); - e_bit_array_toggle_single_row(esma->eba, row); - - esma->selection_start_row = row; - esma->selected_row = -1; - esma->selected_range_end = -1; - e_selection_model_selection_row_changed(E_SELECTION_MODEL(esma), row); -} - -static void -esma_real_move_selection_end (ESelectionModel *selection, int row) -{ - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection); - int old_start; - int old_end; - int new_start; - int new_end; - if (selection->sorter && e_sorter_needs_sorting(selection->sorter)) { - old_start = MIN (e_sorter_model_to_sorted(selection->sorter, esma->selection_start_row), - e_sorter_model_to_sorted(selection->sorter, esma->cursor_row)); - old_end = MAX (e_sorter_model_to_sorted(selection->sorter, esma->selection_start_row), - e_sorter_model_to_sorted(selection->sorter, esma->cursor_row)) + 1; - new_start = MIN (e_sorter_model_to_sorted(selection->sorter, esma->selection_start_row), - e_sorter_model_to_sorted(selection->sorter, row)); - new_end = MAX (e_sorter_model_to_sorted(selection->sorter, esma->selection_start_row), - e_sorter_model_to_sorted(selection->sorter, row)) + 1; - } else { - old_start = MIN (esma->selection_start_row, esma->cursor_row); - old_end = MAX (esma->selection_start_row, esma->cursor_row) + 1; - new_start = MIN (esma->selection_start_row, row); - new_end = MAX (esma->selection_start_row, row) + 1; - } - /* This wouldn't work nearly so smoothly if one end of the selection weren't held in place. */ - if (old_start < new_start) - esma_change_range(selection, old_start, new_start, FALSE); - if (new_start < old_start) - esma_change_range(selection, new_start, old_start, TRUE); - if (old_end < new_end) - esma_change_range(selection, old_end, new_end, TRUE); - if (new_end < old_end) - esma_change_range(selection, new_end, old_end, FALSE); - esma->selected_row = -1; - esma->selected_range_end = -1; -} - -static void -esma_move_selection_end (ESelectionModel *selection, int row) -{ - esma_real_move_selection_end (selection, row); - e_selection_model_selection_changed(selection); -} - -static void -esma_set_selection_end (ESelectionModel *selection, int row) -{ - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection); - int selected_range_end = esma->selected_range_end; - int view_row = e_sorter_model_to_sorted(selection->sorter, row); - - esma_real_select_single_row(selection, esma->selection_start_row); - esma->cursor_row = esma->selection_start_row; - esma_real_move_selection_end(selection, row); - - esma->selected_range_end = view_row; - if (selected_range_end != -1 && view_row != -1) { - if (selected_range_end == view_row - 1 || - selected_range_end == view_row + 1) { - e_selection_model_selection_row_changed(selection, selected_range_end); - e_selection_model_selection_row_changed(selection, view_row); - } - } - e_selection_model_selection_changed(selection); -} - -int -e_selection_model_array_get_row_count (ESelectionModelArray *esma) -{ - g_return_val_if_fail(esma != NULL, 0); - g_return_val_if_fail(E_IS_SELECTION_MODEL_ARRAY(esma), 0); - - if (E_SELECTION_MODEL_ARRAY_GET_CLASS(esma)->get_row_count) - return E_SELECTION_MODEL_ARRAY_GET_CLASS(esma)->get_row_count (esma); - else - return 0; -} - - -static void -e_selection_model_array_init (ESelectionModelArray *esma) -{ - esma->eba = NULL; - esma->selection_start_row = 0; - esma->cursor_row = -1; - esma->cursor_col = -1; - - esma->selected_row = -1; - esma->selected_range_end = -1; -} - -static void -e_selection_model_array_class_init (ESelectionModelArrayClass *klass) -{ - GObjectClass *object_class; - ESelectionModelClass *esm_class; - - parent_class = g_type_class_ref (PARENT_TYPE); - - object_class = G_OBJECT_CLASS(klass); - esm_class = E_SELECTION_MODEL_CLASS(klass); - - object_class->dispose = esma_dispose; - object_class->get_property = esma_get_property; - object_class->set_property = esma_set_property; - - esm_class->is_row_selected = esma_is_row_selected ; - esm_class->foreach = esma_foreach ; - esm_class->clear = esma_clear ; - esm_class->selected_count = esma_selected_count ; - esm_class->select_all = esma_select_all ; - esm_class->invert_selection = esma_invert_selection ; - esm_class->row_count = esma_row_count ; - - esm_class->change_one_row = esma_change_one_row ; - esm_class->change_cursor = esma_change_cursor ; - esm_class->cursor_row = esma_cursor_row ; - esm_class->cursor_col = esma_cursor_col ; - - esm_class->select_single_row = esma_select_single_row ; - esm_class->toggle_single_row = esma_toggle_single_row ; - esm_class->move_selection_end = esma_move_selection_end ; - esm_class->set_selection_end = esma_set_selection_end ; - - klass->get_row_count = NULL ; - - g_object_class_install_property (object_class, PROP_CURSOR_ROW, - g_param_spec_int ("cursor_row", - _("Cursor Row"), - /*_( */"XXX blurb" /*)*/, - 0, G_MAXINT, 0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_CURSOR_COL, - g_param_spec_int ("cursor_col", - _("Cursor Column"), - /*_( */"XXX blurb" /*)*/, - 0, G_MAXINT, 0, - G_PARAM_READWRITE)); -} - -E_MAKE_TYPE(e_selection_model_array, "ESelectionModelArray", ESelectionModelArray, - e_selection_model_array_class_init, e_selection_model_array_init, PARENT_TYPE) diff --git a/widgets/misc/e-selection-model-array.h b/widgets/misc/e-selection-model-array.h deleted file mode 100644 index a533030f92..0000000000 --- a/widgets/misc/e-selection-model-array.h +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-selection-model-array.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _E_SELECTION_MODEL_ARRAY_H_ -#define _E_SELECTION_MODEL_ARRAY_H_ - -#include <gtk/gtkobject.h> -#include <gal/widgets/e-selection-model.h> -#include <gal/util/e-bit-array.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define E_SELECTION_MODEL_ARRAY_TYPE (e_selection_model_array_get_type ()) -#define E_SELECTION_MODEL_ARRAY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_SELECTION_MODEL_ARRAY_TYPE, ESelectionModelArray)) -#define E_SELECTION_MODEL_ARRAY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_ARRAY_TYPE, ESelectionModelArrayClass)) -#define E_IS_SELECTION_MODEL_ARRAY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_SELECTION_MODEL_ARRAY_TYPE)) -#define E_IS_SELECTION_MODEL_ARRAY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_ARRAY_TYPE)) -#define E_SELECTION_MODEL_ARRAY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_SELECTION_MODEL_ARRAY_TYPE, ESelectionModelArrayClass)) - -typedef struct { - ESelectionModel base; - - EBitArray *eba; - - gint cursor_row; - gint cursor_col; - gint selection_start_row; - - guint model_changed_id; - guint model_row_inserted_id, model_row_deleted_id; - - /* Anything other than -1 means that the selection is a single - * row. This being -1 does not impart any information. */ - gint selected_row; - /* Anything other than -1 means that the selection is a all - * rows between selection_start_path and cursor_path where - * selected_range_end is the rwo number of cursor_path. This - * being -1 does not impart any information. */ - gint selected_range_end; - - guint frozen : 1; - guint selection_model_changed : 1; - guint group_info_changed : 1; -} ESelectionModelArray; - -typedef struct { - ESelectionModelClass parent_class; - - gint (*get_row_count) (ESelectionModelArray *selection); -} ESelectionModelArrayClass; - -GType e_selection_model_array_get_type (void); - -/* Protected Functions */ -void e_selection_model_array_insert_rows (ESelectionModelArray *esm, - int row, - int count); -void e_selection_model_array_delete_rows (ESelectionModelArray *esm, - int row, - int count); -void e_selection_model_array_move_row (ESelectionModelArray *esm, - int old_row, - int new_row); -void e_selection_model_array_confirm_row_count (ESelectionModelArray *esm); - -/* Protected Virtual Function */ -gint e_selection_model_array_get_row_count (ESelectionModelArray *esm); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* _E_SELECTION_MODEL_ARRAY_H_ */ diff --git a/widgets/misc/e-selection-model-simple.c b/widgets/misc/e-selection-model-simple.c deleted file mode 100644 index 51a0d86623..0000000000 --- a/widgets/misc/e-selection-model-simple.c +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-selection-model-simple.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <config.h> -#include <gal/util/e-util.h> -#include "e-selection-model-array.h" -#include "e-selection-model-simple.h" - -#define PARENT_TYPE e_selection_model_array_get_type () - -static ESelectionModelArray *parent_class; - -static gint esms_get_row_count (ESelectionModelArray *esma); - -static void -e_selection_model_simple_init (ESelectionModelSimple *selection) -{ - selection->row_count = 0; -} - -static void -e_selection_model_simple_class_init (ESelectionModelSimpleClass *klass) -{ - ESelectionModelArrayClass *esma_class; - - parent_class = g_type_class_ref (PARENT_TYPE); - - esma_class = E_SELECTION_MODEL_ARRAY_CLASS(klass); - - esma_class->get_row_count = esms_get_row_count; -} - -E_MAKE_TYPE(e_selection_model_simple, "ESelectionModelSimple", ESelectionModelSimple, - e_selection_model_simple_class_init, e_selection_model_simple_init, PARENT_TYPE) - -/** - * e_selection_model_simple_new - * - * This routine creates a new #ESelectionModelSimple. - * - * Returns: The new #ESelectionModelSimple. - */ -ESelectionModelSimple * -e_selection_model_simple_new (void) -{ - return g_object_new (E_SELECTION_MODEL_SIMPLE_TYPE, NULL); -} - -void -e_selection_model_simple_set_row_count (ESelectionModelSimple *esms, - int row_count) -{ - if (esms->row_count != row_count) { - ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(esms); - if (esma->eba) - g_object_unref(esma->eba); - esma->eba = NULL; - esma->selected_row = -1; - esma->selected_range_end = -1; - } - esms->row_count = row_count; -} - -static gint -esms_get_row_count (ESelectionModelArray *esma) -{ - ESelectionModelSimple *esms = E_SELECTION_MODEL_SIMPLE(esma); - - return esms->row_count; -} - -void e_selection_model_simple_insert_rows (ESelectionModelSimple *esms, - int row, - int count) -{ - esms->row_count += count; - e_selection_model_array_insert_rows (E_SELECTION_MODEL_ARRAY(esms), row, count); -} - -void -e_selection_model_simple_delete_rows (ESelectionModelSimple *esms, - int row, - int count) -{ - esms->row_count -= count; - e_selection_model_array_delete_rows (E_SELECTION_MODEL_ARRAY(esms), row, count); -} - -void -e_selection_model_simple_move_row (ESelectionModelSimple *esms, - int old_row, - int new_row) -{ - e_selection_model_array_move_row (E_SELECTION_MODEL_ARRAY(esms), old_row, new_row); -} diff --git a/widgets/misc/e-selection-model-simple.h b/widgets/misc/e-selection-model-simple.h deleted file mode 100644 index 6b4f84b4f9..0000000000 --- a/widgets/misc/e-selection-model-simple.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-selection-model-simple.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _E_SELECTION_MODEL_SIMPLE_H_ -#define _E_SELECTION_MODEL_SIMPLE_H_ - -#include <gal/widgets/e-selection-model-array.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define E_SELECTION_MODEL_SIMPLE_TYPE (e_selection_model_simple_get_type ()) -#define E_SELECTION_MODEL_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_SELECTION_MODEL_SIMPLE_TYPE, ESelectionModelSimple)) -#define E_SELECTION_MODEL_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_SIMPLE_TYPE, ESelectionModelSimpleClass)) -#define E_IS_SELECTION_MODEL_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_SELECTION_MODEL_SIMPLE_TYPE)) -#define E_IS_SELECTION_MODEL_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_SIMPLE_TYPE)) - -typedef struct { - ESelectionModelArray parent; - - int row_count; -} ESelectionModelSimple; - -typedef struct { - ESelectionModelArrayClass parent_class; -} ESelectionModelSimpleClass; - -GType e_selection_model_simple_get_type (void); -ESelectionModelSimple *e_selection_model_simple_new (void); - -void e_selection_model_simple_insert_rows (ESelectionModelSimple *esms, - int row, - int count); -void e_selection_model_simple_delete_rows (ESelectionModelSimple *esms, - int row, - int count); -void e_selection_model_simple_move_row (ESelectionModelSimple *esms, - int old_row, - int new_row); - -void e_selection_model_simple_set_row_count (ESelectionModelSimple *selection, - int row_count); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_SELECTION_MODEL_SIMPLE_H_ */ - diff --git a/widgets/misc/e-selection-model.c b/widgets/misc/e-selection-model.c deleted file mode 100644 index 991fc78490..0000000000 --- a/widgets/misc/e-selection-model.c +++ /dev/null @@ -1,689 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-selection-model.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <config.h> -#include <gdk/gdkkeysyms.h> -#include "e-selection-model.h" -#include "gal/util/e-i18n.h" -#include "gal/util/e-util.h" - -#define PARENT_TYPE G_TYPE_OBJECT - -static GObjectClass *e_selection_model_parent_class; - -enum { - CURSOR_CHANGED, - CURSOR_ACTIVATED, - SELECTION_CHANGED, - SELECTION_ROW_CHANGED, - LAST_SIGNAL -}; - -static guint e_selection_model_signals [LAST_SIGNAL] = { 0, }; - -enum { - PROP_0, - PROP_SORTER, - PROP_SELECTION_MODE, - PROP_CURSOR_MODE -}; - -inline static void -add_sorter(ESelectionModel *esm, ESorter *sorter) -{ - esm->sorter = sorter; - if (sorter) { - g_object_ref (sorter); - } -} - -inline static void -drop_sorter(ESelectionModel *esm) -{ - if (esm->sorter) { - g_object_unref (esm->sorter); - } - esm->sorter = NULL; -} - -static void -esm_dispose (GObject *object) -{ - ESelectionModel *esm; - - esm = E_SELECTION_MODEL (object); - - drop_sorter(esm); - - if (e_selection_model_parent_class->dispose) - (* e_selection_model_parent_class->dispose) (object); -} - -static void -esm_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - ESelectionModel *esm = E_SELECTION_MODEL (object); - - switch (prop_id){ - case PROP_SORTER: - g_value_set_object (value, esm->sorter); - break; - - case PROP_SELECTION_MODE: - g_value_set_int (value, esm->mode); - break; - - case PROP_CURSOR_MODE: - g_value_set_int (value, esm->cursor_mode); - break; - } -} - -static void -esm_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - ESelectionModel *esm = E_SELECTION_MODEL (object); - - switch (prop_id){ - case PROP_SORTER: - drop_sorter(esm); - add_sorter(esm, g_value_get_object (value) ? E_SORTER(g_value_get_object(value)) : NULL); - break; - - case PROP_SELECTION_MODE: - esm->mode = g_value_get_int (value); - if (esm->mode == GTK_SELECTION_SINGLE) { - int cursor_row = e_selection_model_cursor_row(esm); - int cursor_col = e_selection_model_cursor_col(esm); - e_selection_model_do_something(esm, cursor_row, cursor_col, 0); - } - break; - - case PROP_CURSOR_MODE: - esm->cursor_mode = g_value_get_int (value); - break; - } -} - -static void -e_selection_model_init (ESelectionModel *selection) -{ - selection->mode = GTK_SELECTION_MULTIPLE; - selection->cursor_mode = E_CURSOR_SIMPLE; - selection->old_selection = -1; -} - -static void -e_selection_model_class_init (ESelectionModelClass *klass) -{ - GObjectClass *object_class; - - e_selection_model_parent_class = g_type_class_ref (PARENT_TYPE); - - object_class = G_OBJECT_CLASS(klass); - - object_class->dispose = esm_dispose; - object_class->get_property = esm_get_property; - object_class->set_property = esm_set_property; - - e_selection_model_signals [CURSOR_CHANGED] = - g_signal_new ("cursor_changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ESelectionModelClass, cursor_changed), - NULL, NULL, - e_marshal_NONE__INT_INT, - G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); - - e_selection_model_signals [CURSOR_ACTIVATED] = - g_signal_new ("cursor_activated", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ESelectionModelClass, cursor_activated), - NULL, NULL, - e_marshal_NONE__INT_INT, - G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); - - e_selection_model_signals [SELECTION_CHANGED] = - g_signal_new ("selection_changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ESelectionModelClass, selection_changed), - NULL, NULL, - e_marshal_NONE__NONE, - G_TYPE_NONE, 0); - - e_selection_model_signals [SELECTION_ROW_CHANGED] = - g_signal_new ("selection_row_changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ESelectionModelClass, selection_row_changed), - NULL, NULL, - e_marshal_NONE__INT, - G_TYPE_NONE, 1, G_TYPE_INT); - - klass->cursor_changed = NULL; - klass->cursor_activated = NULL; - klass->selection_changed = NULL; - klass->selection_row_changed = NULL; - - klass->is_row_selected = NULL; - klass->foreach = NULL; - klass->clear = NULL; - klass->selected_count = NULL; - klass->select_all = NULL; - klass->invert_selection = NULL; - klass->row_count = NULL; - - klass->change_one_row = NULL; - klass->change_cursor = NULL; - klass->cursor_row = NULL; - klass->cursor_col = NULL; - - klass->select_single_row = NULL; - klass->toggle_single_row = NULL; - klass->move_selection_end = NULL; - klass->set_selection_end = NULL; - - g_object_class_install_property (object_class, PROP_SORTER, - g_param_spec_object ("sorter", - _("Sorter"), - /*_( */"XXX blurb" /*)*/, - E_SORTER_TYPE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_SELECTION_MODE, - g_param_spec_int ("selection_mode", - _("Selection Mode"), - /*_( */"XXX blurb" /*)*/, - GTK_SELECTION_NONE, GTK_SELECTION_MULTIPLE, - GTK_SELECTION_SINGLE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_CURSOR_MODE, - g_param_spec_int ("cursor_mode", - _("Cursor Mode"), - /*_( */"XXX blurb" /*)*/, - E_CURSOR_LINE, E_CURSOR_SPREADSHEET, - E_CURSOR_LINE, - G_PARAM_READWRITE)); -} - -E_MAKE_TYPE(e_selection_model, "ESelectionModel", ESelectionModel, - e_selection_model_class_init, e_selection_model_init, PARENT_TYPE) - -/** - * e_selection_model_is_row_selected - * @selection: #ESelectionModel to check - * @n: The row to check - * - * This routine calculates whether the given row is selected. - * - * Returns: %TRUE if the given row is selected - */ -gboolean -e_selection_model_is_row_selected (ESelectionModel *selection, - gint n) -{ - if (E_SELECTION_MODEL_GET_CLASS(selection)->is_row_selected) - return E_SELECTION_MODEL_GET_CLASS(selection)->is_row_selected (selection, n); - else - return FALSE; -} - -/** - * e_selection_model_foreach - * @selection: #ESelectionModel to traverse - * @callback: The callback function to call back. - * @closure: The closure - * - * This routine calls the given callback function once for each - * selected row, passing closure as the closure. - */ -void -e_selection_model_foreach (ESelectionModel *selection, - EForeachFunc callback, - gpointer closure) -{ - if (E_SELECTION_MODEL_GET_CLASS(selection)->foreach) - E_SELECTION_MODEL_GET_CLASS(selection)->foreach (selection, callback, closure); -} - -/** - * e_selection_model_clear - * @selection: #ESelectionModel to clear - * - * This routine clears the selection to no rows selected. - */ -void -e_selection_model_clear(ESelectionModel *selection) -{ - if (E_SELECTION_MODEL_GET_CLASS(selection)->clear) - E_SELECTION_MODEL_GET_CLASS(selection)->clear (selection); -} - -/** - * e_selection_model_selected_count - * @selection: #ESelectionModel to count - * - * This routine calculates the number of rows selected. - * - * Returns: The number of rows selected in the given model. - */ -gint -e_selection_model_selected_count (ESelectionModel *selection) -{ - if (E_SELECTION_MODEL_GET_CLASS(selection)->selected_count) - return E_SELECTION_MODEL_GET_CLASS(selection)->selected_count (selection); - else - return 0; -} - -/** - * e_selection_model_select_all - * @selection: #ESelectionModel to select all - * - * This routine selects all the rows in the given - * #ESelectionModel. - */ -void -e_selection_model_select_all (ESelectionModel *selection) -{ - if (E_SELECTION_MODEL_GET_CLASS(selection)->select_all) - E_SELECTION_MODEL_GET_CLASS(selection)->select_all (selection); -} - -/** - * e_selection_model_invert_selection - * @selection: #ESelectionModel to invert - * - * This routine inverts all the rows in the given - * #ESelectionModel. - */ -void -e_selection_model_invert_selection (ESelectionModel *selection) -{ - if (E_SELECTION_MODEL_GET_CLASS(selection)->invert_selection) - E_SELECTION_MODEL_GET_CLASS(selection)->invert_selection (selection); -} - -int -e_selection_model_row_count (ESelectionModel *selection) -{ - if (E_SELECTION_MODEL_GET_CLASS(selection)->row_count) - return E_SELECTION_MODEL_GET_CLASS(selection)->row_count (selection); - else - return 0; -} - -void -e_selection_model_change_one_row(ESelectionModel *selection, int row, gboolean grow) -{ - if (E_SELECTION_MODEL_GET_CLASS(selection)->change_one_row) - E_SELECTION_MODEL_GET_CLASS(selection)->change_one_row (selection, row, grow); -} - -void -e_selection_model_change_cursor (ESelectionModel *selection, int row, int col) -{ - if (E_SELECTION_MODEL_GET_CLASS(selection)->change_cursor) - E_SELECTION_MODEL_GET_CLASS(selection)->change_cursor (selection, row, col); -} - -int -e_selection_model_cursor_row (ESelectionModel *selection) -{ - if (E_SELECTION_MODEL_GET_CLASS(selection)->cursor_row) - return E_SELECTION_MODEL_GET_CLASS(selection)->cursor_row (selection); - else - return -1; -} - -int -e_selection_model_cursor_col (ESelectionModel *selection) -{ - if (E_SELECTION_MODEL_GET_CLASS(selection)->cursor_col) - return E_SELECTION_MODEL_GET_CLASS(selection)->cursor_col (selection); - else - return -1; -} - -void -e_selection_model_select_single_row (ESelectionModel *selection, int row) -{ - if (E_SELECTION_MODEL_GET_CLASS(selection)->select_single_row) - E_SELECTION_MODEL_GET_CLASS(selection)->select_single_row (selection, row); -} - -void -e_selection_model_toggle_single_row (ESelectionModel *selection, int row) -{ - if (E_SELECTION_MODEL_GET_CLASS(selection)->toggle_single_row) - E_SELECTION_MODEL_GET_CLASS(selection)->toggle_single_row (selection, row); -} - -void -e_selection_model_move_selection_end (ESelectionModel *selection, int row) -{ - if (E_SELECTION_MODEL_GET_CLASS(selection)->move_selection_end) - E_SELECTION_MODEL_GET_CLASS(selection)->move_selection_end (selection, row); -} - -void -e_selection_model_set_selection_end (ESelectionModel *selection, int row) -{ - if (E_SELECTION_MODEL_GET_CLASS(selection)->set_selection_end) - E_SELECTION_MODEL_GET_CLASS(selection)->set_selection_end (selection, row); -} - -/** - * e_selection_model_do_something - * @selection: #ESelectionModel to do something to. - * @row: The row to do something in. - * @col: The col to do something in. - * @state: The state in which to do something. - * - * This routine does whatever is appropriate as if the user clicked - * the mouse in the given row and column. - */ -void -e_selection_model_do_something (ESelectionModel *selection, - guint row, - guint col, - GdkModifierType state) -{ - gint shift_p = state & GDK_SHIFT_MASK; - gint ctrl_p = state & GDK_CONTROL_MASK; - int row_count; - - selection->old_selection = -1; - - if (row == -1 && col != -1) - row = 0; - if (col == -1 && row != -1) - col = 0; - - row_count = e_selection_model_row_count(selection); - if (row_count >= 0 && row < row_count) { - switch (selection->mode) { - case GTK_SELECTION_SINGLE: - e_selection_model_select_single_row (selection, row); - break; - case GTK_SELECTION_BROWSE: - case GTK_SELECTION_MULTIPLE: - if (shift_p) { - e_selection_model_set_selection_end (selection, row); - } else { - if (ctrl_p) { - e_selection_model_toggle_single_row (selection, row); - } else { - e_selection_model_select_single_row (selection, row); - } - } - break; - default: - g_assert_not_reached (); - break; - } - e_selection_model_change_cursor(selection, row, col); - g_signal_emit(selection, - e_selection_model_signals[CURSOR_CHANGED], 0, - row, col); - g_signal_emit(selection, - e_selection_model_signals[CURSOR_ACTIVATED], 0, - row, col); - } -} - -/** - * e_selection_model_maybe_do_something - * @selection: #ESelectionModel to do something to. - * @row: The row to do something in. - * @col: The col to do something in. - * @state: The state in which to do something. - * - * If this row is selected, this routine just moves the cursor row and - * column. Otherwise, it does the same thing as - * e_selection_model_do_something(). This is for being used on - * right clicks and other events where if the user hit the selection, - * they don't want it to change. - */ -gboolean -e_selection_model_maybe_do_something (ESelectionModel *selection, - guint row, - guint col, - GdkModifierType state) -{ - selection->old_selection = -1; - - if (e_selection_model_is_row_selected(selection, row)) { - e_selection_model_change_cursor(selection, row, col); - g_signal_emit(selection, - e_selection_model_signals[CURSOR_CHANGED], 0, - row, col); - return FALSE; - } else { - e_selection_model_do_something(selection, row, col, state); - return TRUE; - } -} - -void -e_selection_model_right_click_down (ESelectionModel *selection, - guint row, - guint col, - GdkModifierType state) -{ - if (selection->mode == GTK_SELECTION_SINGLE) { - selection->old_selection = e_selection_model_cursor_row (selection); - e_selection_model_select_single_row (selection, row); - } else { - e_selection_model_maybe_do_something (selection, row, col, state); - } -} - -void -e_selection_model_right_click_up (ESelectionModel *selection) -{ - if (selection->mode == GTK_SELECTION_SINGLE && selection->old_selection != -1) { - e_selection_model_select_single_row (selection, selection->old_selection); - } -} - -void -e_selection_model_select_as_key_press (ESelectionModel *selection, - guint row, - guint col, - GdkModifierType state) -{ - int cursor_activated = TRUE; - - gint shift_p = state & GDK_SHIFT_MASK; - gint ctrl_p = state & GDK_CONTROL_MASK; - - selection->old_selection = -1; - - switch (selection->mode) { - case GTK_SELECTION_BROWSE: - case GTK_SELECTION_MULTIPLE: - if (shift_p) { - e_selection_model_set_selection_end (selection, row); - } else if (!ctrl_p) { - e_selection_model_select_single_row (selection, row); - } else - cursor_activated = FALSE; - break; - case GTK_SELECTION_SINGLE: - e_selection_model_select_single_row (selection, row); - break; - default: - g_assert_not_reached (); - break; - } - if (row != -1) { - e_selection_model_change_cursor(selection, row, col); - g_signal_emit(selection, - e_selection_model_signals[CURSOR_CHANGED], 0, - row, col); - if (cursor_activated) - g_signal_emit(selection, - e_selection_model_signals[CURSOR_ACTIVATED], 0, - row, col); - } -} - -static gint -move_selection (ESelectionModel *selection, - gboolean up, - GdkModifierType state) -{ - int row = e_selection_model_cursor_row(selection); - int col = e_selection_model_cursor_col(selection); - int row_count; - - row = e_sorter_model_to_sorted(selection->sorter, row); - if (up) - row--; - else - row++; - if (row < 0) - row = 0; - row_count = e_selection_model_row_count(selection); - if (row >= row_count) - row = row_count - 1; - row = e_sorter_sorted_to_model(selection->sorter, row); - - e_selection_model_select_as_key_press (selection, row, col, state); - return TRUE; -} - -/** - * e_selection_model_key_press - * @selection: #ESelectionModel to affect. - * @key: The event. - * - * This routine does whatever is appropriate as if the user pressed - * the given key. - * - * Returns: %TRUE if the #ESelectionModel used the key. - */ -gint -e_selection_model_key_press (ESelectionModel *selection, - GdkEventKey *key) -{ - selection->old_selection = -1; - - switch (key->keyval) { - case GDK_Up: - case GDK_KP_Up: - return move_selection(selection, TRUE, key->state); - break; - case GDK_Down: - case GDK_KP_Down: - return move_selection(selection, FALSE, key->state); - break; - case GDK_space: - case GDK_KP_Space: - if (selection->mode != GTK_SELECTION_SINGLE) { - int row = e_selection_model_cursor_row(selection); - int col = e_selection_model_cursor_col(selection); - e_selection_model_toggle_single_row (selection, row); - g_signal_emit(selection, - e_selection_model_signals[CURSOR_ACTIVATED], 0, - row, col); - return TRUE; - } - break; - case GDK_Return: - case GDK_KP_Enter: - if (selection->mode != GTK_SELECTION_SINGLE) { - int row = e_selection_model_cursor_row(selection); - int col = e_selection_model_cursor_col(selection); - e_selection_model_select_single_row (selection, row); - g_signal_emit(selection, - e_selection_model_signals[CURSOR_ACTIVATED], 0, - row, col); - return TRUE; - } - break; - case GDK_Home: - case GDK_KP_Home: - if (selection->cursor_mode == E_CURSOR_LINE) { - int row = 0; - int cursor_col = e_selection_model_cursor_col(selection); - - row = e_sorter_sorted_to_model(selection->sorter, row); - e_selection_model_select_as_key_press (selection, row, cursor_col, key->state); - return TRUE; - } - break; - case GDK_End: - case GDK_KP_End: - if (selection->cursor_mode == E_CURSOR_LINE) { - int row = e_selection_model_row_count(selection) - 1; - int cursor_col = e_selection_model_cursor_col(selection); - - row = e_sorter_sorted_to_model(selection->sorter, row); - e_selection_model_select_as_key_press (selection, row, cursor_col, key->state); - return TRUE; - } - break; - } - return FALSE; -} - -void -e_selection_model_cursor_changed (ESelectionModel *selection, - int row, - int col) -{ - g_signal_emit(selection, - e_selection_model_signals[CURSOR_CHANGED], 0, - row, col); -} - -void -e_selection_model_cursor_activated (ESelectionModel *selection, - int row, - int col) -{ - g_signal_emit(selection, - e_selection_model_signals[CURSOR_ACTIVATED], 0, - row, col); -} - -void -e_selection_model_selection_changed (ESelectionModel *selection) -{ - g_signal_emit(selection, - e_selection_model_signals[SELECTION_CHANGED], 0); -} - -void -e_selection_model_selection_row_changed (ESelectionModel *selection, - int row) -{ - g_signal_emit(selection, - e_selection_model_signals[SELECTION_ROW_CHANGED], 0, - row); -} diff --git a/widgets/misc/e-selection-model.h b/widgets/misc/e-selection-model.h deleted file mode 100644 index a78bdfd9c3..0000000000 --- a/widgets/misc/e-selection-model.h +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-selection-model.h - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Chris Lahey <clahey@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _E_SELECTION_MODEL_H_ -#define _E_SELECTION_MODEL_H_ - -#include <gtk/gtkobject.h> -#include <gal/util/e-sorter.h> -#include <gdk/gdkevents.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define E_SELECTION_MODEL_TYPE (e_selection_model_get_type ()) -#define E_SELECTION_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_SELECTION_MODEL_TYPE, ESelectionModel)) -#define E_SELECTION_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_TYPE, ESelectionModelClass)) -#define E_IS_SELECTION_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_SELECTION_MODEL_TYPE)) -#define E_IS_SELECTION_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_TYPE)) -#define E_SELECTION_MODEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_SELECTION_MODEL_TYPE, ESelectionModelClass)) - -#ifndef _E_FOREACH_FUNC_H_ -#define _E_FOREACH_FUNC_H_ -typedef void (*EForeachFunc) (int model_row, - gpointer closure); -#endif - -/* list selection modes */ -typedef enum { - E_CURSOR_LINE, - E_CURSOR_SIMPLE, - E_CURSOR_SPREADSHEET -} ECursorMode; - -typedef struct { - GObject base; - - ESorter *sorter; - - GtkSelectionMode mode; - ECursorMode cursor_mode; - - int old_selection; -} ESelectionModel; - -typedef struct { - GObjectClass parent_class; - - /* Virtual methods */ - gboolean (*is_row_selected) (ESelectionModel *esm, int row); - void (*foreach) (ESelectionModel *esm, EForeachFunc callback, gpointer closure); - void (*clear) (ESelectionModel *esm); - gint (*selected_count) (ESelectionModel *esm); - void (*select_all) (ESelectionModel *esm); - void (*invert_selection) (ESelectionModel *esm); - int (*row_count) (ESelectionModel *esm); - - /* Protected virtual methods. */ - void (*change_one_row) (ESelectionModel *esm, int row, gboolean on); - void (*change_cursor) (ESelectionModel *esm, int row, int col); - int (*cursor_row) (ESelectionModel *esm); - int (*cursor_col) (ESelectionModel *esm); - - void (*select_single_row) (ESelectionModel *selection, int row); - void (*toggle_single_row) (ESelectionModel *selection, int row); - void (*move_selection_end) (ESelectionModel *selection, int row); - void (*set_selection_end) (ESelectionModel *selection, int row); - - /* - * Signals - */ - - void (*cursor_changed) (ESelectionModel *esm, int row, int col); - void (*cursor_activated) (ESelectionModel *esm, int row, int col); - void (*selection_row_changed) (ESelectionModel *esm, int row); - void (*selection_changed) (ESelectionModel *esm); - -} ESelectionModelClass; - - -GType e_selection_model_get_type (void); -void e_selection_model_do_something (ESelectionModel *esm, - guint row, - guint col, - GdkModifierType state); -gboolean e_selection_model_maybe_do_something (ESelectionModel *esm, - guint row, - guint col, - GdkModifierType state); -void e_selection_model_right_click_down (ESelectionModel *selection, - guint row, - guint col, - GdkModifierType state); -void e_selection_model_right_click_up (ESelectionModel *selection); -gint e_selection_model_key_press (ESelectionModel *esm, - GdkEventKey *key); -void e_selection_model_select_as_key_press (ESelectionModel *esm, - guint row, - guint col, - GdkModifierType state); - -/* Virtual functions */ -gboolean e_selection_model_is_row_selected (ESelectionModel *esm, - gint n); -void e_selection_model_foreach (ESelectionModel *esm, - EForeachFunc callback, - gpointer closure); -void e_selection_model_clear (ESelectionModel *esm); -gint e_selection_model_selected_count (ESelectionModel *esm); -void e_selection_model_select_all (ESelectionModel *esm); -void e_selection_model_invert_selection (ESelectionModel *esm); -int e_selection_model_row_count (ESelectionModel *esm); - - -/* Private virtual Functions */ -void e_selection_model_change_one_row (ESelectionModel *esm, - int row, - gboolean on); -void e_selection_model_change_cursor (ESelectionModel *esm, - int row, - int col); -int e_selection_model_cursor_row (ESelectionModel *esm); -int e_selection_model_cursor_col (ESelectionModel *esm); -void e_selection_model_select_single_row (ESelectionModel *selection, - int row); -void e_selection_model_toggle_single_row (ESelectionModel *selection, - int row); -void e_selection_model_move_selection_end (ESelectionModel *selection, - int row); -void e_selection_model_set_selection_end (ESelectionModel *selection, - int row); - -/* Signals */ -void e_selection_model_cursor_changed (ESelectionModel *selection, - int row, - int col); -void e_selection_model_cursor_activated (ESelectionModel *selection, - int row, - int col); -void e_selection_model_selection_row_changed (ESelectionModel *selection, - int row); -void e_selection_model_selection_changed (ESelectionModel *selection); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* _E_SELECTION_MODEL_H_ */ - diff --git a/widgets/misc/e-title-bar.h b/widgets/misc/e-title-bar.h index 32c4f2b262..07b99213e4 100644 --- a/widgets/misc/e-title-bar.h +++ b/widgets/misc/e-title-bar.h @@ -23,10 +23,6 @@ #ifndef __E_TITLE_BAR_H__ #define __E_TITLE_BAR_H__ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - #include <gtk/gtkframe.h> #ifdef __cplusplus @@ -35,10 +31,10 @@ extern "C" { #endif /* __cplusplus */ #define E_TYPE_TITLE_BAR (e_title_bar_get_type ()) -#define E_TITLE_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TITLE_BAR, ETitleBar)) -#define E_TITLE_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_TITLE_BAR, ETitleBarClass)) -#define E_IS_TITLE_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TITLE_BAR)) -#define E_IS_TITLE_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_TITLE_BAR)) +#define E_TITLE_BAR(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TITLE_BAR, ETitleBar)) +#define E_TITLE_BAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TITLE_BAR, ETitleBarClass)) +#define E_IS_TITLE_BAR(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TITLE_BAR)) +#define E_IS_TITLE_BAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_TITLE_BAR)) enum _ETitleBarButtonMode { diff --git a/widgets/misc/e-unicode.c b/widgets/misc/e-unicode.c deleted file mode 100644 index fb81db1798..0000000000 --- a/widgets/misc/e-unicode.c +++ /dev/null @@ -1,2272 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-unicode.c - utf-8 support functions for gal - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Lauris Kaplinski <lauris@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -/* - * TODO: Break simple ligatures in e_utf8_strstrcasedecomp - */ - -#include <config.h> - -#include "e-unicode.h" - -#include "gal/util/e-i18n.h" -#include <ctype.h> -#include <string.h> -#include <stdio.h> -#include <iconv.h> -#include <gdk/gdk.h> -#include <gdk/gdkx.h> -#include <gdk/gdkkeysyms.h> -#include <gtk/gtkmenuitem.h> -#include "e-font.h" -#include <libxml/xmlmemory.h> -#include <stdlib.h> -#include "gal/util/e-iconv.h" - -#ifdef HAVE_ALLOCA_H -#include <alloca.h> -#endif - -#define d(x) x - -#define FONT_TESTING -#define MAX_DECOMP 8 - -static gint e_canonical_decomposition (gunichar ch, gunichar * buf); -static gunichar e_stripped_char (gunichar ch); - -#ifndef NO_WARNINGS -#warning FIXME: this has not been ported fully yet - non ASCII people beware. -#endif - -/* - * This my favourite - * - * strstr doing case insensitive, decomposing search - * - * Lauris - */ - -const gchar * -e_utf8_strstrcasedecomp (const gchar *haystack, const gchar *needle) -{ - gunichar *nuni; - gunichar unival; - gint nlen; - const guchar *o, *p; - - if (haystack == NULL) return NULL; - if (needle == NULL) return NULL; - if (strlen (needle) == 0) return haystack; - if (strlen (haystack) == 0) return NULL; - - nuni = alloca (sizeof (gunichar) * strlen (needle)); - - nlen = 0; - for (p = e_unicode_get_utf8 (needle, &unival); p && unival; p = e_unicode_get_utf8 (p, &unival)) { - gint sc; - sc = e_stripped_char (unival); - if (sc) { - nuni[nlen++] = sc; - } - } - /* NULL means there was illegal utf-8 sequence */ - if (!p) return NULL; - /* If everything is correct, we have decomposed, lowercase, stripped needle */ - if (nlen < 1) return haystack; - - o = haystack; - for (p = e_unicode_get_utf8 (o, &unival); p && unival; p = e_unicode_get_utf8 (p, &unival)) { - gint sc; - sc = e_stripped_char (unival); - if (sc) { - /* We have valid stripped char */ - if (sc == nuni[0]) { - const gchar *q = p; - gint npos = 1; - while (npos < nlen) { - q = e_unicode_get_utf8 (q, &unival); - if (!q || !unival) return NULL; - sc = e_stripped_char (unival); - if ((!sc) || (sc != nuni[npos])) break; - npos++; - } - if (npos == nlen) { - return o; - } - } - } - o = p; - } - - return NULL; -} - -const gchar * -e_utf8_strstrcase (const gchar *haystack, const gchar *needle) -{ - gunichar *nuni; - gunichar unival; - gint nlen; - const guchar *o, *p; - - if (haystack == NULL) return NULL; - if (needle == NULL) return NULL; - if (strlen (needle) == 0) return haystack; - if (strlen (haystack) == 0) return NULL; - - nuni = alloca (sizeof (gunichar) * strlen (needle)); - - nlen = 0; - for (p = e_unicode_get_utf8 (needle, &unival); p && unival; p = e_unicode_get_utf8 (p, &unival)) { - nuni[nlen++] = g_unichar_tolower (unival); - } - /* NULL means there was illegal utf-8 sequence */ - if (!p) return NULL; - - o = haystack; - for (p = e_unicode_get_utf8 (o, &unival); p && unival; p = e_unicode_get_utf8 (p, &unival)) { - gint sc; - sc = g_unichar_tolower (unival); - /* We have valid stripped char */ - if (sc == nuni[0]) { - const gchar *q = p; - gint npos = 1; - while (npos < nlen) { - q = e_unicode_get_utf8 (q, &unival); - if (!q || !unival) return NULL; - sc = g_unichar_tolower (unival); - if (sc != nuni[npos]) break; - npos++; - } - if (npos == nlen) { - return o; - } - } - o = p; - } - - return NULL; -} - -#if 0 -const gchar * -e_utf8_strstrcase (const gchar *haystack, const gchar *needle) -{ - gchar *p; - gunichar *huni, *nuni; - gunichar unival; - gint hlen, nlen, hp, np; - - if (haystack == NULL) return NULL; - if (needle == NULL) return NULL; - if (strlen (needle) == 0) return haystack; - - huni = alloca (sizeof (gunichar) * strlen (haystack)); - - for (hlen = 0, p = e_unicode_get_utf8 (haystack, &unival); p && unival; hlen++, p = e_unicode_get_utf8 (p, &unival)) { - huni[hlen] = g_unichar_tolower (unival); - } - - if (!p) return NULL; - if (hlen == 0) return NULL; - - nuni = alloca (sizeof (gunichar) * strlen (needle)); - - for (nlen = 0, p = e_unicode_get_utf8 (needle, &unival); p && unival; nlen++, p = e_unicode_get_utf8 (p, &unival)) { - nuni[nlen] = g_unichar_tolower (unival); - } - - if (!p) return NULL; - if (nlen == 0) return NULL; - - if (hlen < nlen) return NULL; - - for (hp = 0; hp <= hlen - nlen; hp++) { - for (np = 0; np < nlen; np++) { - if (huni[hp + np] != nuni[np]) break; - } - if (np == nlen) return haystack + unicode_offset_to_index (haystack, hp); - } - - return NULL; -} -#endif - -gchar * -e_utf8_from_gtk_event_key (GtkWidget *widget, guint keyval, const gchar *string) -{ - gint unival; - gchar *utf; - gint unilen; - - if (keyval == GDK_VoidSymbol) { - utf = e_utf8_from_locale_string (string); - } else { - unival = gdk_keyval_to_unicode (keyval); - - if (unival < ' ') return NULL; - - utf = g_new (gchar, 7); - - unilen = e_unichar_to_utf8 (unival, utf); - - utf[unilen] = '\0'; - } - - return utf; -} - -gchar * -e_utf8_from_iconv_string_sized (iconv_t ic, const gchar *string, gint bytes) -{ - char *new, *ob; - const char *ib; - size_t ibl, obl; - - if (!string) return NULL; - - if (ic == (iconv_t) -1) { - gint i; - /* iso-8859-1 */ - ib = (char *) string; - new = ob = g_new (unsigned char, bytes * 2 + 1); - for (i = 0; i < (bytes); i ++) { - ob += e_unichar_to_utf8 (ib[i], ob); - } - *ob = '\0'; - return new; - } - - ib = string; - ibl = bytes; - new = ob = g_new (gchar, ibl * 6 + 1); - obl = ibl * 6; - - while (ibl > 0) { - e_iconv (ic, &ib, &ibl, &ob, &obl); - if (ibl > 0) { - gint len; - if ((*ib & 0x80) == 0x00) len = 1; - else if ((*ib &0xe0) == 0xc0) len = 2; - else if ((*ib &0xf0) == 0xe0) len = 3; - else if ((*ib &0xf8) == 0xf0) len = 4; - else { - g_warning ("Invalid UTF-8 sequence"); - break; - } - ib += len; - ibl = bytes - (ib - string); - if (ibl > bytes) ibl = 0; - *ob++ = '_'; - obl--; - } - } - - *ob = '\0'; - - return new; -} - -gchar * -e_utf8_from_iconv_string (iconv_t ic, const gchar *string) -{ - if (!string) return NULL; - return e_utf8_from_iconv_string_sized (ic, string, strlen (string)); -} - -gchar * -e_utf8_to_iconv_string_sized (iconv_t ic, const gchar *string, gint bytes) -{ - char *new, *ob; - const char *ib; - size_t ibl, obl; - - if (!string) return NULL; - - if (ic == (iconv_t) -1) { - gint len; - const gchar *u; - gunichar uc; - - new = g_new (unsigned char, bytes * 4 + 1); - u = string; - len = 0; - - while ((u) && (u - string < bytes)) { - u = e_unicode_get_utf8 (u, &uc); - new[len++] = uc & 0xff; - } - new[len] = '\0'; - return new; - } - - ib = string; - ibl = bytes; - new = ob = g_new (char, ibl * 4 + 4); - obl = ibl * 4; - - while (ibl > 0) { - e_iconv (ic, &ib, &ibl, &ob, &obl); - if (ibl > 0) { - gint len; - if ((*ib & 0x80) == 0x00) len = 1; - else if ((*ib &0xe0) == 0xc0) len = 2; - else if ((*ib &0xf0) == 0xe0) len = 3; - else if ((*ib &0xf8) == 0xf0) len = 4; - else { - g_warning ("Invalid UTF-8 sequence"); - break; - } - ib += len; - ibl = bytes - (ib - string); - if (ibl > bytes) ibl = 0; - - /* FIXME: this is wrong... what if the destination charset is 16 or 32 bit? */ - *ob++ = '_'; - obl--; - } - } - - /* Make sure to terminate with plenty of padding */ - memset (ob, 0, 4); - - return new; -} - -gchar * -e_utf8_to_iconv_string (iconv_t ic, const gchar *string) -{ - if (!string) return NULL; - return e_utf8_to_iconv_string_sized (ic, string, strlen (string)); -} - -gchar * -e_utf8_from_charset_string_sized (const gchar *charset, const gchar *string, gint bytes) -{ - iconv_t ic; - char *ret; - - if (!string) return NULL; - - ic = e_iconv_open("utf-8", charset); - ret = e_utf8_from_iconv_string_sized (ic, string, bytes); - e_iconv_close(ic); - - return ret; -} - -gchar * -e_utf8_from_charset_string (const gchar *charset, const gchar *string) -{ - if (!string) return NULL; - return e_utf8_from_charset_string_sized (charset, string, strlen (string)); -} - -gchar * -e_utf8_to_charset_string_sized (const gchar *charset, const gchar *string, gint bytes) -{ - iconv_t ic; - char *ret; - - if (!string) return NULL; - - ic = e_iconv_open(charset, "utf-8"); - ret = e_utf8_to_iconv_string_sized (ic, string, bytes); - e_iconv_close(ic); - - return ret; -} - -gchar * -e_utf8_to_charset_string (const gchar *charset, const gchar *string) -{ - if (!string) return NULL; - return e_utf8_to_charset_string_sized (charset, string, strlen (string)); -} - -gchar * -e_utf8_from_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes) -{ - iconv_t ic; - char *new, *ob; - const char *ib; - size_t ibl, obl; - - g_return_val_if_fail (widget != NULL, NULL); - g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); - - if (!string) return NULL; - - g_return_val_if_fail (widget, NULL); - - ic = e_iconv_from_gdk_font (gtk_style_get_font (widget->style)); - if (ic == (iconv_t) -1) { - XFontStruct *xfs; - /* If iconv is missing we assume either iso-10646 or iso-8859-1 */ - xfs = GDK_FONT_XFONT (gtk_style_get_font (widget->style)); - if (gtk_style_get_font (widget->style)->type == GDK_FONT_FONTSET || ((xfs->min_byte1 != 0) || (xfs->max_byte1 != 0))) { - gint i; - const guchar *ib; - guchar * ob, * new; - /* iso-10646 */ - ib = string; - new = ob = g_new (unsigned char, bytes * 6 + 1); - for (i = 0; i < (bytes - 1); i += 2) { - ob += e_unichar_to_utf8 (ib[i] * 256 + ib[i + 1], ob); - } - *ob = '\0'; - return new; - } else { - gint i; - /* iso-8859-1 */ - ib = (char *) string; - new = ob = g_new (unsigned char, bytes * 2 + 1); - for (i = 0; i < (bytes); i ++) { - ob += e_unichar_to_utf8 (ib[i], ob); - } - *ob = '\0'; - return new; - } - } - - ib = string; - ibl = bytes; - new = ob = g_new (gchar, ibl * 6 + 1); - obl = ibl * 6; - - while (ibl > 0) { - e_iconv (ic, &ib, &ibl, &ob, &obl); - if (ibl > 0) { - gint len; - if ((*ib & 0x80) == 0x00) len = 1; - else if ((*ib &0xe0) == 0xc0) len = 2; - else if ((*ib &0xf0) == 0xe0) len = 3; - else if ((*ib &0xf8) == 0xf0) len = 4; - else { - g_warning ("Invalid UTF-8 sequence"); - break; - } - ib += len; - ibl = bytes - (ib - string); - if (ibl > bytes) ibl = 0; - *ob++ = '_'; - obl--; - } - } - - *ob = '\0'; - - e_iconv_close(ic); - - return new; -} - -gchar * -e_utf8_from_gtk_string (GtkWidget *widget, const gchar *string) -{ - if (!string) return NULL; - return e_utf8_from_gtk_string_sized (widget, string, strlen (string)); -} - -gchar * -e_utf8_to_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes) -{ - iconv_t ic; - char *new, *ob; - const char *ib; - size_t ibl, obl; - - if (!string) return NULL; - - g_return_val_if_fail (widget, NULL); - - gtk_widget_ensure_style (widget); - ic = e_iconv_to_gdk_font (gtk_style_get_font (widget->style)); - if (ic == (iconv_t) -1) { - XFontStruct *xfs; - gboolean twobyte; - gint len; - const gchar *u; - gunichar uc; - /* If iconv is missing we assume either iso-10646 or iso-8859-1 */ - xfs = GDK_FONT_XFONT (gtk_style_get_font (widget->style)); - twobyte = (gtk_style_get_font (widget->style)->type == GDK_FONT_FONTSET || ((xfs->min_byte1 != 0) || (xfs->max_byte1 != 0))); - - new = g_new (unsigned char, bytes * 4 + 2); - u = string; - len = 0; - - while ((u) && (u - string < bytes)) { - u = e_unicode_get_utf8 (u, &uc); - if (twobyte) { - new[len++] = (uc & 0xff00) >> 8; - } - new[len++] = uc & 0xff; - } - - new[len++] = '\0'; - if (twobyte) - new[len] = '\0'; - - return new; - } - - ib = string; - ibl = bytes; - new = ob = g_new (gchar, ibl * 4 + 4); - obl = ibl * 4; - - while (ibl > 0) { - e_iconv (ic, &ib, &ibl, &ob, &obl); - if (ibl > 0) { - gint len; - if ((*ib & 0x80) == 0x00) len = 1; - else if ((*ib &0xe0) == 0xc0) len = 2; - else if ((*ib &0xf0) == 0xe0) len = 3; - else if ((*ib &0xf8) == 0xf0) len = 4; - else { - g_warning ("Invalid UTF-8 sequence"); - break; - } - ib += len; - ibl = bytes - (ib - string); - if (ibl > bytes) ibl = 0; - *ob++ = '_'; - obl--; - } - } - - /* Make sure to terminate with plenty of padding */ - memset (ob, 0, 4); - - e_iconv_close(ic); - - return new; -} - -gchar * -e_utf8_to_gtk_string (GtkWidget *widget, const gchar *string) -{ - if (!string) return NULL; - return e_utf8_to_gtk_string_sized (widget, string, strlen (string)); -} - -gchar * -e_utf8_from_locale_string_sized (const gchar *string, gint bytes) -{ - iconv_t ic; - char *ret; - - if (!string) return NULL; - - ic = e_iconv_open("utf-8", e_iconv_locale_charset()); - ret = e_utf8_from_iconv_string_sized (ic, string, bytes); - e_iconv_close(ic); - - return ret; -} - -gchar * -e_utf8_from_locale_string (const gchar *string) -{ - if (!string) return NULL; - return e_utf8_from_locale_string_sized (string, strlen (string)); -} - -gchar * -e_utf8_to_locale_string_sized (const gchar *string, gint bytes) -{ - iconv_t ic; - char *ret; - - if (!string) return NULL; - - ic = e_iconv_open(e_iconv_locale_charset(), "utf-8"); - ret = e_utf8_to_iconv_string_sized (ic, string, bytes); - e_iconv_close(ic); - - return ret; -} - -gchar * -e_utf8_to_locale_string (const gchar *string) -{ - if (!string) return NULL; - return e_utf8_to_locale_string_sized (string, strlen (string)); -} - -gboolean -e_utf8_is_ascii (const gchar *string) -{ - char c; - - g_return_val_if_fail (string != NULL, FALSE); - - for (; (c = *string); string++) { - if (c & 0x80) - return FALSE; - } - - return TRUE; -} - -gchar * -e_utf8_gtk_entry_get_text (GtkEntry *entry) -{ - return g_strdup (gtk_entry_get_text (entry)); -} - -gchar * -e_utf8_gtk_editable_get_text (GtkEditable *editable) -{ - return gtk_editable_get_chars (editable, 0, -1); -} - -gchar * -e_utf8_gtk_editable_get_chars (GtkEditable *editable, gint start, gint end) -{ - return gtk_editable_get_chars (editable, start, end); -} - -void -e_utf8_gtk_editable_insert_text (GtkEditable *editable, const gchar *text, gint length, gint *position) -{ - gtk_editable_insert_text (editable, text, length, position); -} - -void -e_utf8_gtk_editable_set_text (GtkEditable *editable, const gchar *text) -{ - int position; - - gtk_editable_delete_text(editable, 0, -1); - gtk_editable_insert_text (editable, text, strlen (text), &position); -} - -void -e_utf8_gtk_entry_set_text (GtkEntry *entry, const gchar *text) -{ - if (!text) - gtk_entry_set_text(entry, ""); - else - gtk_entry_set_text (entry, text); -} - -GtkWidget * -e_utf8_gtk_menu_item_new_with_label (GtkMenu *menu, const gchar *label) -{ - GtkWidget *w; - gchar *s; - - if (!label) return NULL; - - s = e_utf8_to_gtk_string ((GtkWidget *) menu, label); - w = gtk_menu_item_new_with_label (s); - - g_free (s); - - return w; -} - -void -e_utf8_gtk_clist_set_text (GtkCList *clist, gint row, gint col, const gchar *text) -{ - gchar *s; - - if (!text) return; - - s = e_utf8_to_gtk_string ((GtkWidget *) clist, text); - gtk_clist_set_text (clist, row, col, s); - - if (s) g_free (s); -} - -gint -e_utf8_gtk_clist_append (GtkCList *clist, gchar *text[]) -{ - gint row, i; - gchar **v; - - if (!text) return 0; - - v = g_new (gchar *, clist->columns); - for (i = 0; i < clist->columns; i++) - v[i] = e_utf8_to_gtk_string ((GtkWidget *) clist, text[i]); - - row = gtk_clist_append (clist, v); - - for (i = 0; i < clist->columns; i++) - if (v[i]) g_free (v[i]); - - return row; -} - -/* - * Translate \U+XXXX\ sequences to utf8 chars - */ - -gchar * -e_utf8_xml1_decode (const gchar *text) -{ - const guchar *c; - guchar *u, *d; - int len, s; - - g_return_val_if_fail (text != NULL, NULL); - - len = strlen (text)+1; - /* len * 2 is absolute maximum */ - u = d = g_malloc (len * 2); - - c = text; - s = 0; - while (s < len) { - if ((s <= (len - 8)) && - (c[s ] == '\\') && - (c[s + 1] == 'U' ) && - (c[s + 2] == '+' ) && - isxdigit (c[s + 3]) && - isxdigit (c[s + 4]) && - isxdigit (c[s + 5]) && - isxdigit (c[s + 6]) && - (c[s + 7] == '\\')) { - /* Valid \U+XXXX\ sequence */ - unsigned int unival; - unival = strtol (c + s + 3, NULL, 16); - d += e_unichar_to_utf8 (unival, d); - s += 8; - } else if (c[s] > 127) { - /* fixme: We assume iso-8859-1 currently */ - d += e_unichar_to_utf8 (c[s], d); - s += 1; - } else { - *d++ = c[s++]; - } - } - *d++ = '\0'; - u = g_realloc (u, (d - u)); - - return u; -} - -gchar * -e_utf8_xml1_encode (const gchar *text) -{ - guchar *u, *d, *c; - int unival; - int len; - - g_return_val_if_fail (text != NULL, NULL); - - len = 0; - for (u = e_unicode_get_utf8 (text, &unival); u && unival; u = e_unicode_get_utf8 (u, &unival)) { - if ((unival >= 0x80) || (unival == '\\')) { - len += 8; - } else { - len += 1; - } - } - d = c = g_new (guchar, len + 1); - - for (u = e_unicode_get_utf8 (text, &unival); u && unival; u = e_unicode_get_utf8 (u, &unival)) { - if ((unival >= 0x80) || (unival == '\\')) { - *c++ = '\\'; - *c++ = 'U'; - *c++ = '+'; - c += sprintf (c, "%04x", unival); - *c++ = '\\'; - } else { - *c++ = unival; - } - } - *c = '\0'; - - return d; -} - -/** - * e_unichar_to_utf8: - * @c: a ISO10646 character code - * @outbuf: output buffer, must have at least 6 bytes of space. - * If %NULL, the length will be computed and returned - * and nothing will be written to @out. - * - * Convert a single character to utf8 - * - * Return value: number of bytes written - **/ - -gint -e_unichar_to_utf8 (gint c, gchar *outbuf) -{ - size_t len = 0; - int first; - int i; - - if (c < 0x80) - { - first = 0; - len = 1; - } - else if (c < 0x800) - { - first = 0xc0; - len = 2; - } - else if (c < 0x10000) - { - first = 0xe0; - len = 3; - } - else if (c < 0x200000) - { - first = 0xf0; - len = 4; - } - else if (c < 0x4000000) - { - first = 0xf8; - len = 5; - } - else - { - first = 0xfc; - len = 6; - } - - if (outbuf) - { - for (i = len - 1; i > 0; --i) - { - outbuf[i] = (c & 0x3f) | 0x80; - c >>= 6; - } - outbuf[0] = c | first; - } - - return len; -} - -gchar * -e_unicode_get_utf8 (const gchar *text, gunichar *out) -{ - *out = g_utf8_get_char (text); - return (*out == (gunichar)-1) ? NULL : g_utf8_next_char (text); -} - -/* - * Canonical decomposition - * - * It is copied here from libunicode, because we do not want malloc - * - */ - -typedef struct -{ - unsigned short ch; - unsigned char *expansion; -} e_decomposition; - -static e_decomposition e_decomp_table[] = -{ - { 0x00c0, "\x00\x41\x03\x00\0" }, - { 0x00c1, "\x00\x41\x03\x01\0" }, - { 0x00c2, "\x00\x41\x03\x02\0" }, - { 0x00c3, "\x00\x41\x03\x03\0" }, - { 0x00c4, "\x00\x41\x03\x08\0" }, - { 0x00c5, "\x00\x41\x03\x0a\0" }, - { 0x00c7, "\x00\x43\x03\x27\0" }, - { 0x00c8, "\x00\x45\x03\x00\0" }, - { 0x00c9, "\x00\x45\x03\x01\0" }, - { 0x00ca, "\x00\x45\x03\x02\0" }, - { 0x00cb, "\x00\x45\x03\x08\0" }, - { 0x00cc, "\x00\x49\x03\x00\0" }, - { 0x00cd, "\x00\x49\x03\x01\0" }, - { 0x00ce, "\x00\x49\x03\x02\0" }, - { 0x00cf, "\x00\x49\x03\x08\0" }, - { 0x00d1, "\x00\x4e\x03\x03\0" }, - { 0x00d2, "\x00\x4f\x03\x00\0" }, - { 0x00d3, "\x00\x4f\x03\x01\0" }, - { 0x00d4, "\x00\x4f\x03\x02\0" }, - { 0x00d5, "\x00\x4f\x03\x03\0" }, - { 0x00d6, "\x00\x4f\x03\x08\0" }, - { 0x00d9, "\x00\x55\x03\x00\0" }, - { 0x00da, "\x00\x55\x03\x01\0" }, - { 0x00db, "\x00\x55\x03\x02\0" }, - { 0x00dc, "\x00\x55\x03\x08\0" }, - { 0x00dd, "\x00\x59\x03\x01\0" }, - { 0x00e0, "\x00\x61\x03\x00\0" }, - { 0x00e1, "\x00\x61\x03\x01\0" }, - { 0x00e2, "\x00\x61\x03\x02\0" }, - { 0x00e3, "\x00\x61\x03\x03\0" }, - { 0x00e4, "\x00\x61\x03\x08\0" }, - { 0x00e5, "\x00\x61\x03\x0a\0" }, - { 0x00e7, "\x00\x63\x03\x27\0" }, - { 0x00e8, "\x00\x65\x03\x00\0" }, - { 0x00e9, "\x00\x65\x03\x01\0" }, - { 0x00ea, "\x00\x65\x03\x02\0" }, - { 0x00eb, "\x00\x65\x03\x08\0" }, - { 0x00ec, "\x00\x69\x03\x00\0" }, - { 0x00ed, "\x00\x69\x03\x01\0" }, - { 0x00ee, "\x00\x69\x03\x02\0" }, - { 0x00ef, "\x00\x69\x03\x08\0" }, - { 0x00f1, "\x00\x6e\x03\x03\0" }, - { 0x00f2, "\x00\x6f\x03\x00\0" }, - { 0x00f3, "\x00\x6f\x03\x01\0" }, - { 0x00f4, "\x00\x6f\x03\x02\0" }, - { 0x00f5, "\x00\x6f\x03\x03\0" }, - { 0x00f6, "\x00\x6f\x03\x08\0" }, - { 0x00f9, "\x00\x75\x03\x00\0" }, - { 0x00fa, "\x00\x75\x03\x01\0" }, - { 0x00fb, "\x00\x75\x03\x02\0" }, - { 0x00fc, "\x00\x75\x03\x08\0" }, - { 0x00fd, "\x00\x79\x03\x01\0" }, - { 0x00ff, "\x00\x79\x03\x08\0" }, - { 0x0100, "\x00\x41\x03\x04\0" }, - { 0x0101, "\x00\x61\x03\x04\0" }, - { 0x0102, "\x00\x41\x03\x06\0" }, - { 0x0103, "\x00\x61\x03\x06\0" }, - { 0x0104, "\x00\x41\x03\x28\0" }, - { 0x0105, "\x00\x61\x03\x28\0" }, - { 0x0106, "\x00\x43\x03\x01\0" }, - { 0x0107, "\x00\x63\x03\x01\0" }, - { 0x0108, "\x00\x43\x03\x02\0" }, - { 0x0109, "\x00\x63\x03\x02\0" }, - { 0x010a, "\x00\x43\x03\x07\0" }, - { 0x010b, "\x00\x63\x03\x07\0" }, - { 0x010c, "\x00\x43\x03\x0c\0" }, - { 0x010d, "\x00\x63\x03\x0c\0" }, - { 0x010e, "\x00\x44\x03\x0c\0" }, - { 0x010f, "\x00\x64\x03\x0c\0" }, - { 0x0112, "\x00\x45\x03\x04\0" }, - { 0x0113, "\x00\x65\x03\x04\0" }, - { 0x0114, "\x00\x45\x03\x06\0" }, - { 0x0115, "\x00\x65\x03\x06\0" }, - { 0x0116, "\x00\x45\x03\x07\0" }, - { 0x0117, "\x00\x65\x03\x07\0" }, - { 0x0118, "\x00\x45\x03\x28\0" }, - { 0x0119, "\x00\x65\x03\x28\0" }, - { 0x011a, "\x00\x45\x03\x0c\0" }, - { 0x011b, "\x00\x65\x03\x0c\0" }, - { 0x011c, "\x00\x47\x03\x02\0" }, - { 0x011d, "\x00\x67\x03\x02\0" }, - { 0x011e, "\x00\x47\x03\x06\0" }, - { 0x011f, "\x00\x67\x03\x06\0" }, - { 0x0120, "\x00\x47\x03\x07\0" }, - { 0x0121, "\x00\x67\x03\x07\0" }, - { 0x0122, "\x00\x47\x03\x27\0" }, - { 0x0123, "\x00\x67\x03\x27\0" }, - { 0x0124, "\x00\x48\x03\x02\0" }, - { 0x0125, "\x00\x68\x03\x02\0" }, - { 0x0128, "\x00\x49\x03\x03\0" }, - { 0x0129, "\x00\x69\x03\x03\0" }, - { 0x012a, "\x00\x49\x03\x04\0" }, - { 0x012b, "\x00\x69\x03\x04\0" }, - { 0x012c, "\x00\x49\x03\x06\0" }, - { 0x012d, "\x00\x69\x03\x06\0" }, - { 0x012e, "\x00\x49\x03\x28\0" }, - { 0x012f, "\x00\x69\x03\x28\0" }, - { 0x0130, "\x00\x49\x03\x07\0" }, - { 0x0134, "\x00\x4a\x03\x02\0" }, - { 0x0135, "\x00\x6a\x03\x02\0" }, - { 0x0136, "\x00\x4b\x03\x27\0" }, - { 0x0137, "\x00\x6b\x03\x27\0" }, - { 0x0139, "\x00\x4c\x03\x01\0" }, - { 0x013a, "\x00\x6c\x03\x01\0" }, - { 0x013b, "\x00\x4c\x03\x27\0" }, - { 0x013c, "\x00\x6c\x03\x27\0" }, - { 0x013d, "\x00\x4c\x03\x0c\0" }, - { 0x013e, "\x00\x6c\x03\x0c\0" }, - { 0x0143, "\x00\x4e\x03\x01\0" }, - { 0x0144, "\x00\x6e\x03\x01\0" }, - { 0x0145, "\x00\x4e\x03\x27\0" }, - { 0x0146, "\x00\x6e\x03\x27\0" }, - { 0x0147, "\x00\x4e\x03\x0c\0" }, - { 0x0148, "\x00\x6e\x03\x0c\0" }, - { 0x014c, "\x00\x4f\x03\x04\0" }, - { 0x014d, "\x00\x6f\x03\x04\0" }, - { 0x014e, "\x00\x4f\x03\x06\0" }, - { 0x014f, "\x00\x6f\x03\x06\0" }, - { 0x0150, "\x00\x4f\x03\x0b\0" }, - { 0x0151, "\x00\x6f\x03\x0b\0" }, - { 0x0154, "\x00\x52\x03\x01\0" }, - { 0x0155, "\x00\x72\x03\x01\0" }, - { 0x0156, "\x00\x52\x03\x27\0" }, - { 0x0157, "\x00\x72\x03\x27\0" }, - { 0x0158, "\x00\x52\x03\x0c\0" }, - { 0x0159, "\x00\x72\x03\x0c\0" }, - { 0x015a, "\x00\x53\x03\x01\0" }, - { 0x015b, "\x00\x73\x03\x01\0" }, - { 0x015c, "\x00\x53\x03\x02\0" }, - { 0x015d, "\x00\x73\x03\x02\0" }, - { 0x015e, "\x00\x53\x03\x27\0" }, - { 0x015f, "\x00\x73\x03\x27\0" }, - { 0x0160, "\x00\x53\x03\x0c\0" }, - { 0x0161, "\x00\x73\x03\x0c\0" }, - { 0x0162, "\x00\x54\x03\x27\0" }, - { 0x0163, "\x00\x74\x03\x27\0" }, - { 0x0164, "\x00\x54\x03\x0c\0" }, - { 0x0165, "\x00\x74\x03\x0c\0" }, - { 0x0168, "\x00\x55\x03\x03\0" }, - { 0x0169, "\x00\x75\x03\x03\0" }, - { 0x016a, "\x00\x55\x03\x04\0" }, - { 0x016b, "\x00\x75\x03\x04\0" }, - { 0x016c, "\x00\x55\x03\x06\0" }, - { 0x016d, "\x00\x75\x03\x06\0" }, - { 0x016e, "\x00\x55\x03\x0a\0" }, - { 0x016f, "\x00\x75\x03\x0a\0" }, - { 0x0170, "\x00\x55\x03\x0b\0" }, - { 0x0171, "\x00\x75\x03\x0b\0" }, - { 0x0172, "\x00\x55\x03\x28\0" }, - { 0x0173, "\x00\x75\x03\x28\0" }, - { 0x0174, "\x00\x57\x03\x02\0" }, - { 0x0175, "\x00\x77\x03\x02\0" }, - { 0x0176, "\x00\x59\x03\x02\0" }, - { 0x0177, "\x00\x79\x03\x02\0" }, - { 0x0178, "\x00\x59\x03\x08\0" }, - { 0x0179, "\x00\x5a\x03\x01\0" }, - { 0x017a, "\x00\x7a\x03\x01\0" }, - { 0x017b, "\x00\x5a\x03\x07\0" }, - { 0x017c, "\x00\x7a\x03\x07\0" }, - { 0x017d, "\x00\x5a\x03\x0c\0" }, - { 0x017e, "\x00\x7a\x03\x0c\0" }, - { 0x01a0, "\x00\x4f\x03\x1b\0" }, - { 0x01a1, "\x00\x6f\x03\x1b\0" }, - { 0x01af, "\x00\x55\x03\x1b\0" }, - { 0x01b0, "\x00\x75\x03\x1b\0" }, - { 0x01cd, "\x00\x41\x03\x0c\0" }, - { 0x01ce, "\x00\x61\x03\x0c\0" }, - { 0x01cf, "\x00\x49\x03\x0c\0" }, - { 0x01d0, "\x00\x69\x03\x0c\0" }, - { 0x01d1, "\x00\x4f\x03\x0c\0" }, - { 0x01d2, "\x00\x6f\x03\x0c\0" }, - { 0x01d3, "\x00\x55\x03\x0c\0" }, - { 0x01d4, "\x00\x75\x03\x0c\0" }, - { 0x01d5, "\x00\x55\x03\x08\x03\x04\0" }, - { 0x01d6, "\x00\x75\x03\x08\x03\x04\0" }, - { 0x01d7, "\x00\x55\x03\x08\x03\x01\0" }, - { 0x01d8, "\x00\x75\x03\x08\x03\x01\0" }, - { 0x01d9, "\x00\x55\x03\x08\x03\x0c\0" }, - { 0x01da, "\x00\x75\x03\x08\x03\x0c\0" }, - { 0x01db, "\x00\x55\x03\x08\x03\x00\0" }, - { 0x01dc, "\x00\x75\x03\x08\x03\x00\0" }, - { 0x01de, "\x00\x41\x03\x08\x03\x04\0" }, - { 0x01df, "\x00\x61\x03\x08\x03\x04\0" }, - { 0x01e0, "\x00\x41\x03\x07\x03\x04\0" }, - { 0x01e1, "\x00\x61\x03\x07\x03\x04\0" }, - { 0x01e2, "\x00\xc6\x03\x04\0" }, - { 0x01e3, "\x00\xe6\x03\x04\0" }, - { 0x01e6, "\x00\x47\x03\x0c\0" }, - { 0x01e7, "\x00\x67\x03\x0c\0" }, - { 0x01e8, "\x00\x4b\x03\x0c\0" }, - { 0x01e9, "\x00\x6b\x03\x0c\0" }, - { 0x01ea, "\x00\x4f\x03\x28\0" }, - { 0x01eb, "\x00\x6f\x03\x28\0" }, - { 0x01ec, "\x00\x4f\x03\x28\x03\x04\0" }, - { 0x01ed, "\x00\x6f\x03\x28\x03\x04\0" }, - { 0x01ee, "\x01\xb7\x03\x0c\0" }, - { 0x01ef, "\x02\x92\x03\x0c\0" }, - { 0x01f0, "\x00\x6a\x03\x0c\0" }, - { 0x01f4, "\x00\x47\x03\x01\0" }, - { 0x01f5, "\x00\x67\x03\x01\0" }, - { 0x01fa, "\x00\x41\x03\x0a\x03\x01\0" }, - { 0x01fb, "\x00\x61\x03\x0a\x03\x01\0" }, - { 0x01fc, "\x00\xc6\x03\x01\0" }, - { 0x01fd, "\x00\xe6\x03\x01\0" }, - { 0x01fe, "\x00\xd8\x03\x01\0" }, - { 0x01ff, "\x00\xf8\x03\x01\0" }, - { 0x0200, "\x00\x41\x03\x0f\0" }, - { 0x0201, "\x00\x61\x03\x0f\0" }, - { 0x0202, "\x00\x41\x03\x11\0" }, - { 0x0203, "\x00\x61\x03\x11\0" }, - { 0x0204, "\x00\x45\x03\x0f\0" }, - { 0x0205, "\x00\x65\x03\x0f\0" }, - { 0x0206, "\x00\x45\x03\x11\0" }, - { 0x0207, "\x00\x65\x03\x11\0" }, - { 0x0208, "\x00\x49\x03\x0f\0" }, - { 0x0209, "\x00\x69\x03\x0f\0" }, - { 0x020a, "\x00\x49\x03\x11\0" }, - { 0x020b, "\x00\x69\x03\x11\0" }, - { 0x020c, "\x00\x4f\x03\x0f\0" }, - { 0x020d, "\x00\x6f\x03\x0f\0" }, - { 0x020e, "\x00\x4f\x03\x11\0" }, - { 0x020f, "\x00\x6f\x03\x11\0" }, - { 0x0210, "\x00\x52\x03\x0f\0" }, - { 0x0211, "\x00\x72\x03\x0f\0" }, - { 0x0212, "\x00\x52\x03\x11\0" }, - { 0x0213, "\x00\x72\x03\x11\0" }, - { 0x0214, "\x00\x55\x03\x0f\0" }, - { 0x0215, "\x00\x75\x03\x0f\0" }, - { 0x0216, "\x00\x55\x03\x11\0" }, - { 0x0217, "\x00\x75\x03\x11\0" }, - { 0x0340, "\x03\x00\0" }, - { 0x0341, "\x03\x01\0" }, - { 0x0343, "\x03\x13\0" }, - { 0x0344, "\x03\x08\x03\x01\0" }, - { 0x0374, "\x02\xb9\0" }, - { 0x037e, "\x00\x3b\0" }, - { 0x0385, "\x00\xa8\x03\x01\0" }, - { 0x0386, "\x03\x91\x03\x01\0" }, - { 0x0387, "\x00\xb7\0" }, - { 0x0388, "\x03\x95\x03\x01\0" }, - { 0x0389, "\x03\x97\x03\x01\0" }, - { 0x038a, "\x03\x99\x03\x01\0" }, - { 0x038c, "\x03\x9f\x03\x01\0" }, - { 0x038e, "\x03\xa5\x03\x01\0" }, - { 0x038f, "\x03\xa9\x03\x01\0" }, - { 0x0390, "\x03\xb9\x03\x08\x03\x01\0" }, - { 0x03aa, "\x03\x99\x03\x08\0" }, - { 0x03ab, "\x03\xa5\x03\x08\0" }, - { 0x03ac, "\x03\xb1\x03\x01\0" }, - { 0x03ad, "\x03\xb5\x03\x01\0" }, - { 0x03ae, "\x03\xb7\x03\x01\0" }, - { 0x03af, "\x03\xb9\x03\x01\0" }, - { 0x03b0, "\x03\xc5\x03\x08\x03\x01\0" }, - { 0x03ca, "\x03\xb9\x03\x08\0" }, - { 0x03cb, "\x03\xc5\x03\x08\0" }, - { 0x03cc, "\x03\xbf\x03\x01\0" }, - { 0x03cd, "\x03\xc5\x03\x01\0" }, - { 0x03ce, "\x03\xc9\x03\x01\0" }, - { 0x03d3, "\x03\xd2\x03\x01\0" }, - { 0x03d4, "\x03\xd2\x03\x08\0" }, - { 0x0401, "\x04\x15\x03\x08\0" }, - { 0x0403, "\x04\x13\x03\x01\0" }, - { 0x0407, "\x04\x06\x03\x08\0" }, - { 0x040c, "\x04\x1a\x03\x01\0" }, - { 0x040e, "\x04\x23\x03\x06\0" }, - { 0x0419, "\x04\x18\x03\x06\0" }, - { 0x0439, "\x04\x38\x03\x06\0" }, - { 0x0451, "\x04\x35\x03\x08\0" }, - { 0x0453, "\x04\x33\x03\x01\0" }, - { 0x0457, "\x04\x56\x03\x08\0" }, - { 0x045c, "\x04\x3a\x03\x01\0" }, - { 0x045e, "\x04\x43\x03\x06\0" }, - { 0x0476, "\x04\x74\x03\x0f\0" }, - { 0x0477, "\x04\x75\x03\x0f\0" }, - { 0x04c1, "\x04\x16\x03\x06\0" }, - { 0x04c2, "\x04\x36\x03\x06\0" }, - { 0x04d0, "\x04\x10\x03\x06\0" }, - { 0x04d1, "\x04\x30\x03\x06\0" }, - { 0x04d2, "\x04\x10\x03\x08\0" }, - { 0x04d3, "\x04\x30\x03\x08\0" }, - { 0x04d6, "\x04\x15\x03\x06\0" }, - { 0x04d7, "\x04\x35\x03\x06\0" }, - { 0x04da, "\x04\xd8\x03\x08\0" }, - { 0x04db, "\x04\xd9\x03\x08\0" }, - { 0x04dc, "\x04\x16\x03\x08\0" }, - { 0x04dd, "\x04\x36\x03\x08\0" }, - { 0x04de, "\x04\x17\x03\x08\0" }, - { 0x04df, "\x04\x37\x03\x08\0" }, - { 0x04e2, "\x04\x18\x03\x04\0" }, - { 0x04e3, "\x04\x38\x03\x04\0" }, - { 0x04e4, "\x04\x18\x03\x08\0" }, - { 0x04e5, "\x04\x38\x03\x08\0" }, - { 0x04e6, "\x04\x1e\x03\x08\0" }, - { 0x04e7, "\x04\x3e\x03\x08\0" }, - { 0x04ea, "\x04\xe8\x03\x08\0" }, - { 0x04eb, "\x04\xe9\x03\x08\0" }, - { 0x04ee, "\x04\x23\x03\x04\0" }, - { 0x04ef, "\x04\x43\x03\x04\0" }, - { 0x04f0, "\x04\x23\x03\x08\0" }, - { 0x04f1, "\x04\x43\x03\x08\0" }, - { 0x04f2, "\x04\x23\x03\x0b\0" }, - { 0x04f3, "\x04\x43\x03\x0b\0" }, - { 0x04f4, "\x04\x27\x03\x08\0" }, - { 0x04f5, "\x04\x47\x03\x08\0" }, - { 0x04f8, "\x04\x2b\x03\x08\0" }, - { 0x04f9, "\x04\x4b\x03\x08\0" }, - { 0x0929, "\x09\x28\x09\x3c\0" }, - { 0x0931, "\x09\x30\x09\x3c\0" }, - { 0x0934, "\x09\x33\x09\x3c\0" }, - { 0x0958, "\x09\x15\x09\x3c\0" }, - { 0x0959, "\x09\x16\x09\x3c\0" }, - { 0x095a, "\x09\x17\x09\x3c\0" }, - { 0x095b, "\x09\x1c\x09\x3c\0" }, - { 0x095c, "\x09\x21\x09\x3c\0" }, - { 0x095d, "\x09\x22\x09\x3c\0" }, - { 0x095e, "\x09\x2b\x09\x3c\0" }, - { 0x095f, "\x09\x2f\x09\x3c\0" }, - { 0x09b0, "\x09\xac\x09\xbc\0" }, - { 0x09cb, "\x09\xc7\x09\xbe\0" }, - { 0x09cc, "\x09\xc7\x09\xd7\0" }, - { 0x09dc, "\x09\xa1\x09\xbc\0" }, - { 0x09dd, "\x09\xa2\x09\xbc\0" }, - { 0x09df, "\x09\xaf\x09\xbc\0" }, - { 0x0a59, "\x0a\x16\x0a\x3c\0" }, - { 0x0a5a, "\x0a\x17\x0a\x3c\0" }, - { 0x0a5b, "\x0a\x1c\x0a\x3c\0" }, - { 0x0a5c, "\x0a\x21\x0a\x3c\0" }, - { 0x0a5e, "\x0a\x2b\x0a\x3c\0" }, - { 0x0b48, "\x0b\x47\x0b\x56\0" }, - { 0x0b4b, "\x0b\x47\x0b\x3e\0" }, - { 0x0b4c, "\x0b\x47\x0b\x57\0" }, - { 0x0b5c, "\x0b\x21\x0b\x3c\0" }, - { 0x0b5d, "\x0b\x22\x0b\x3c\0" }, - { 0x0b5f, "\x0b\x2f\x0b\x3c\0" }, - { 0x0b94, "\x0b\x92\x0b\xd7\0" }, - { 0x0bca, "\x0b\xc6\x0b\xbe\0" }, - { 0x0bcb, "\x0b\xc7\x0b\xbe\0" }, - { 0x0bcc, "\x0b\xc6\x0b\xd7\0" }, - { 0x0c48, "\x0c\x46\x0c\x56\0" }, - { 0x0cc0, "\x0c\xbf\x0c\xd5\0" }, - { 0x0cc7, "\x0c\xc6\x0c\xd5\0" }, - { 0x0cc8, "\x0c\xc6\x0c\xd6\0" }, - { 0x0cca, "\x0c\xc6\x0c\xc2\0" }, - { 0x0ccb, "\x0c\xc6\x0c\xc2\x0c\xd5\0" }, - { 0x0d4a, "\x0d\x46\x0d\x3e\0" }, - { 0x0d4b, "\x0d\x47\x0d\x3e\0" }, - { 0x0d4c, "\x0d\x46\x0d\x57\0" }, - { 0x0e33, "\x0e\x4d\x0e\x32\0" }, - { 0x0eb3, "\x0e\xcd\x0e\xb2\0" }, - { 0x0f43, "\x0f\x42\x0f\xb7\0" }, - { 0x0f4d, "\x0f\x4c\x0f\xb7\0" }, - { 0x0f52, "\x0f\x51\x0f\xb7\0" }, - { 0x0f57, "\x0f\x56\x0f\xb7\0" }, - { 0x0f5c, "\x0f\x5b\x0f\xb7\0" }, - { 0x0f69, "\x0f\x40\x0f\xb5\0" }, - { 0x0f73, "\x0f\x71\x0f\x72\0" }, - { 0x0f75, "\x0f\x71\x0f\x74\0" }, - { 0x0f76, "\x0f\xb2\x0f\x80\0" }, - { 0x0f78, "\x0f\xb3\x0f\x80\0" }, - { 0x0f81, "\x0f\x71\x0f\x80\0" }, - { 0x0f93, "\x0f\x92\x0f\xb7\0" }, - { 0x0f9d, "\x0f\x9c\x0f\xb7\0" }, - { 0x0fa2, "\x0f\xa1\x0f\xb7\0" }, - { 0x0fa7, "\x0f\xa6\x0f\xb7\0" }, - { 0x0fac, "\x0f\xab\x0f\xb7\0" }, - { 0x0fb9, "\x0f\x90\x0f\xb5\0" }, - { 0x1e00, "\x00\x41\x03\x25\0" }, - { 0x1e01, "\x00\x61\x03\x25\0" }, - { 0x1e02, "\x00\x42\x03\x07\0" }, - { 0x1e03, "\x00\x62\x03\x07\0" }, - { 0x1e04, "\x00\x42\x03\x23\0" }, - { 0x1e05, "\x00\x62\x03\x23\0" }, - { 0x1e06, "\x00\x42\x03\x31\0" }, - { 0x1e07, "\x00\x62\x03\x31\0" }, - { 0x1e08, "\x00\x43\x03\x27\x03\x01\0" }, - { 0x1e09, "\x00\x63\x03\x27\x03\x01\0" }, - { 0x1e0a, "\x00\x44\x03\x07\0" }, - { 0x1e0b, "\x00\x64\x03\x07\0" }, - { 0x1e0c, "\x00\x44\x03\x23\0" }, - { 0x1e0d, "\x00\x64\x03\x23\0" }, - { 0x1e0e, "\x00\x44\x03\x31\0" }, - { 0x1e0f, "\x00\x64\x03\x31\0" }, - { 0x1e10, "\x00\x44\x03\x27\0" }, - { 0x1e11, "\x00\x64\x03\x27\0" }, - { 0x1e12, "\x00\x44\x03\x2d\0" }, - { 0x1e13, "\x00\x64\x03\x2d\0" }, - { 0x1e14, "\x00\x45\x03\x04\x03\x00\0" }, - { 0x1e15, "\x00\x65\x03\x04\x03\x00\0" }, - { 0x1e16, "\x00\x45\x03\x04\x03\x01\0" }, - { 0x1e17, "\x00\x65\x03\x04\x03\x01\0" }, - { 0x1e18, "\x00\x45\x03\x2d\0" }, - { 0x1e19, "\x00\x65\x03\x2d\0" }, - { 0x1e1a, "\x00\x45\x03\x30\0" }, - { 0x1e1b, "\x00\x65\x03\x30\0" }, - { 0x1e1c, "\x00\x45\x03\x27\x03\x06\0" }, - { 0x1e1d, "\x00\x65\x03\x27\x03\x06\0" }, - { 0x1e1e, "\x00\x46\x03\x07\0" }, - { 0x1e1f, "\x00\x66\x03\x07\0" }, - { 0x1e20, "\x00\x47\x03\x04\0" }, - { 0x1e21, "\x00\x67\x03\x04\0" }, - { 0x1e22, "\x00\x48\x03\x07\0" }, - { 0x1e23, "\x00\x68\x03\x07\0" }, - { 0x1e24, "\x00\x48\x03\x23\0" }, - { 0x1e25, "\x00\x68\x03\x23\0" }, - { 0x1e26, "\x00\x48\x03\x08\0" }, - { 0x1e27, "\x00\x68\x03\x08\0" }, - { 0x1e28, "\x00\x48\x03\x27\0" }, - { 0x1e29, "\x00\x68\x03\x27\0" }, - { 0x1e2a, "\x00\x48\x03\x2e\0" }, - { 0x1e2b, "\x00\x68\x03\x2e\0" }, - { 0x1e2c, "\x00\x49\x03\x30\0" }, - { 0x1e2d, "\x00\x69\x03\x30\0" }, - { 0x1e2e, "\x00\x49\x03\x08\x03\x01\0" }, - { 0x1e2f, "\x00\x69\x03\x08\x03\x01\0" }, - { 0x1e30, "\x00\x4b\x03\x01\0" }, - { 0x1e31, "\x00\x6b\x03\x01\0" }, - { 0x1e32, "\x00\x4b\x03\x23\0" }, - { 0x1e33, "\x00\x6b\x03\x23\0" }, - { 0x1e34, "\x00\x4b\x03\x31\0" }, - { 0x1e35, "\x00\x6b\x03\x31\0" }, - { 0x1e36, "\x00\x4c\x03\x23\0" }, - { 0x1e37, "\x00\x6c\x03\x23\0" }, - { 0x1e38, "\x00\x4c\x03\x23\x03\x04\0" }, - { 0x1e39, "\x00\x6c\x03\x23\x03\x04\0" }, - { 0x1e3a, "\x00\x4c\x03\x31\0" }, - { 0x1e3b, "\x00\x6c\x03\x31\0" }, - { 0x1e3c, "\x00\x4c\x03\x2d\0" }, - { 0x1e3d, "\x00\x6c\x03\x2d\0" }, - { 0x1e3e, "\x00\x4d\x03\x01\0" }, - { 0x1e3f, "\x00\x6d\x03\x01\0" }, - { 0x1e40, "\x00\x4d\x03\x07\0" }, - { 0x1e41, "\x00\x6d\x03\x07\0" }, - { 0x1e42, "\x00\x4d\x03\x23\0" }, - { 0x1e43, "\x00\x6d\x03\x23\0" }, - { 0x1e44, "\x00\x4e\x03\x07\0" }, - { 0x1e45, "\x00\x6e\x03\x07\0" }, - { 0x1e46, "\x00\x4e\x03\x23\0" }, - { 0x1e47, "\x00\x6e\x03\x23\0" }, - { 0x1e48, "\x00\x4e\x03\x31\0" }, - { 0x1e49, "\x00\x6e\x03\x31\0" }, - { 0x1e4a, "\x00\x4e\x03\x2d\0" }, - { 0x1e4b, "\x00\x6e\x03\x2d\0" }, - { 0x1e4c, "\x00\x4f\x03\x03\x03\x01\0" }, - { 0x1e4d, "\x00\x6f\x03\x03\x03\x01\0" }, - { 0x1e4e, "\x00\x4f\x03\x03\x03\x08\0" }, - { 0x1e4f, "\x00\x6f\x03\x03\x03\x08\0" }, - { 0x1e50, "\x00\x4f\x03\x04\x03\x00\0" }, - { 0x1e51, "\x00\x6f\x03\x04\x03\x00\0" }, - { 0x1e52, "\x00\x4f\x03\x04\x03\x01\0" }, - { 0x1e53, "\x00\x6f\x03\x04\x03\x01\0" }, - { 0x1e54, "\x00\x50\x03\x01\0" }, - { 0x1e55, "\x00\x70\x03\x01\0" }, - { 0x1e56, "\x00\x50\x03\x07\0" }, - { 0x1e57, "\x00\x70\x03\x07\0" }, - { 0x1e58, "\x00\x52\x03\x07\0" }, - { 0x1e59, "\x00\x72\x03\x07\0" }, - { 0x1e5a, "\x00\x52\x03\x23\0" }, - { 0x1e5b, "\x00\x72\x03\x23\0" }, - { 0x1e5c, "\x00\x52\x03\x23\x03\x04\0" }, - { 0x1e5d, "\x00\x72\x03\x23\x03\x04\0" }, - { 0x1e5e, "\x00\x52\x03\x31\0" }, - { 0x1e5f, "\x00\x72\x03\x31\0" }, - { 0x1e60, "\x00\x53\x03\x07\0" }, - { 0x1e61, "\x00\x73\x03\x07\0" }, - { 0x1e62, "\x00\x53\x03\x23\0" }, - { 0x1e63, "\x00\x73\x03\x23\0" }, - { 0x1e64, "\x00\x53\x03\x01\x03\x07\0" }, - { 0x1e65, "\x00\x73\x03\x01\x03\x07\0" }, - { 0x1e66, "\x00\x53\x03\x0c\x03\x07\0" }, - { 0x1e67, "\x00\x73\x03\x0c\x03\x07\0" }, - { 0x1e68, "\x00\x53\x03\x23\x03\x07\0" }, - { 0x1e69, "\x00\x73\x03\x23\x03\x07\0" }, - { 0x1e6a, "\x00\x54\x03\x07\0" }, - { 0x1e6b, "\x00\x74\x03\x07\0" }, - { 0x1e6c, "\x00\x54\x03\x23\0" }, - { 0x1e6d, "\x00\x74\x03\x23\0" }, - { 0x1e6e, "\x00\x54\x03\x31\0" }, - { 0x1e6f, "\x00\x74\x03\x31\0" }, - { 0x1e70, "\x00\x54\x03\x2d\0" }, - { 0x1e71, "\x00\x74\x03\x2d\0" }, - { 0x1e72, "\x00\x55\x03\x24\0" }, - { 0x1e73, "\x00\x75\x03\x24\0" }, - { 0x1e74, "\x00\x55\x03\x30\0" }, - { 0x1e75, "\x00\x75\x03\x30\0" }, - { 0x1e76, "\x00\x55\x03\x2d\0" }, - { 0x1e77, "\x00\x75\x03\x2d\0" }, - { 0x1e78, "\x00\x55\x03\x03\x03\x01\0" }, - { 0x1e79, "\x00\x75\x03\x03\x03\x01\0" }, - { 0x1e7a, "\x00\x55\x03\x04\x03\x08\0" }, - { 0x1e7b, "\x00\x75\x03\x04\x03\x08\0" }, - { 0x1e7c, "\x00\x56\x03\x03\0" }, - { 0x1e7d, "\x00\x76\x03\x03\0" }, - { 0x1e7e, "\x00\x56\x03\x23\0" }, - { 0x1e7f, "\x00\x76\x03\x23\0" }, - { 0x1e80, "\x00\x57\x03\x00\0" }, - { 0x1e81, "\x00\x77\x03\x00\0" }, - { 0x1e82, "\x00\x57\x03\x01\0" }, - { 0x1e83, "\x00\x77\x03\x01\0" }, - { 0x1e84, "\x00\x57\x03\x08\0" }, - { 0x1e85, "\x00\x77\x03\x08\0" }, - { 0x1e86, "\x00\x57\x03\x07\0" }, - { 0x1e87, "\x00\x77\x03\x07\0" }, - { 0x1e88, "\x00\x57\x03\x23\0" }, - { 0x1e89, "\x00\x77\x03\x23\0" }, - { 0x1e8a, "\x00\x58\x03\x07\0" }, - { 0x1e8b, "\x00\x78\x03\x07\0" }, - { 0x1e8c, "\x00\x58\x03\x08\0" }, - { 0x1e8d, "\x00\x78\x03\x08\0" }, - { 0x1e8e, "\x00\x59\x03\x07\0" }, - { 0x1e8f, "\x00\x79\x03\x07\0" }, - { 0x1e90, "\x00\x5a\x03\x02\0" }, - { 0x1e91, "\x00\x7a\x03\x02\0" }, - { 0x1e92, "\x00\x5a\x03\x23\0" }, - { 0x1e93, "\x00\x7a\x03\x23\0" }, - { 0x1e94, "\x00\x5a\x03\x31\0" }, - { 0x1e95, "\x00\x7a\x03\x31\0" }, - { 0x1e96, "\x00\x68\x03\x31\0" }, - { 0x1e97, "\x00\x74\x03\x08\0" }, - { 0x1e98, "\x00\x77\x03\x0a\0" }, - { 0x1e99, "\x00\x79\x03\x0a\0" }, - { 0x1e9b, "\x01\x7f\x03\x07\0" }, - { 0x1ea0, "\x00\x41\x03\x23\0" }, - { 0x1ea1, "\x00\x61\x03\x23\0" }, - { 0x1ea2, "\x00\x41\x03\x09\0" }, - { 0x1ea3, "\x00\x61\x03\x09\0" }, - { 0x1ea4, "\x00\x41\x03\x02\x03\x01\0" }, - { 0x1ea5, "\x00\x61\x03\x02\x03\x01\0" }, - { 0x1ea6, "\x00\x41\x03\x02\x03\x00\0" }, - { 0x1ea7, "\x00\x61\x03\x02\x03\x00\0" }, - { 0x1ea8, "\x00\x41\x03\x02\x03\x09\0" }, - { 0x1ea9, "\x00\x61\x03\x02\x03\x09\0" }, - { 0x1eaa, "\x00\x41\x03\x02\x03\x03\0" }, - { 0x1eab, "\x00\x61\x03\x02\x03\x03\0" }, - { 0x1eac, "\x00\x41\x03\x23\x03\x02\0" }, - { 0x1ead, "\x00\x61\x03\x23\x03\x02\0" }, - { 0x1eae, "\x00\x41\x03\x06\x03\x01\0" }, - { 0x1eaf, "\x00\x61\x03\x06\x03\x01\0" }, - { 0x1eb0, "\x00\x41\x03\x06\x03\x00\0" }, - { 0x1eb1, "\x00\x61\x03\x06\x03\x00\0" }, - { 0x1eb2, "\x00\x41\x03\x06\x03\x09\0" }, - { 0x1eb3, "\x00\x61\x03\x06\x03\x09\0" }, - { 0x1eb4, "\x00\x41\x03\x06\x03\x03\0" }, - { 0x1eb5, "\x00\x61\x03\x06\x03\x03\0" }, - { 0x1eb6, "\x00\x41\x03\x23\x03\x06\0" }, - { 0x1eb7, "\x00\x61\x03\x23\x03\x06\0" }, - { 0x1eb8, "\x00\x45\x03\x23\0" }, - { 0x1eb9, "\x00\x65\x03\x23\0" }, - { 0x1eba, "\x00\x45\x03\x09\0" }, - { 0x1ebb, "\x00\x65\x03\x09\0" }, - { 0x1ebc, "\x00\x45\x03\x03\0" }, - { 0x1ebd, "\x00\x65\x03\x03\0" }, - { 0x1ebe, "\x00\x45\x03\x02\x03\x01\0" }, - { 0x1ebf, "\x00\x65\x03\x02\x03\x01\0" }, - { 0x1ec0, "\x00\x45\x03\x02\x03\x00\0" }, - { 0x1ec1, "\x00\x65\x03\x02\x03\x00\0" }, - { 0x1ec2, "\x00\x45\x03\x02\x03\x09\0" }, - { 0x1ec3, "\x00\x65\x03\x02\x03\x09\0" }, - { 0x1ec4, "\x00\x45\x03\x02\x03\x03\0" }, - { 0x1ec5, "\x00\x65\x03\x02\x03\x03\0" }, - { 0x1ec6, "\x00\x45\x03\x23\x03\x02\0" }, - { 0x1ec7, "\x00\x65\x03\x23\x03\x02\0" }, - { 0x1ec8, "\x00\x49\x03\x09\0" }, - { 0x1ec9, "\x00\x69\x03\x09\0" }, - { 0x1eca, "\x00\x49\x03\x23\0" }, - { 0x1ecb, "\x00\x69\x03\x23\0" }, - { 0x1ecc, "\x00\x4f\x03\x23\0" }, - { 0x1ecd, "\x00\x6f\x03\x23\0" }, - { 0x1ece, "\x00\x4f\x03\x09\0" }, - { 0x1ecf, "\x00\x6f\x03\x09\0" }, - { 0x1ed0, "\x00\x4f\x03\x02\x03\x01\0" }, - { 0x1ed1, "\x00\x6f\x03\x02\x03\x01\0" }, - { 0x1ed2, "\x00\x4f\x03\x02\x03\x00\0" }, - { 0x1ed3, "\x00\x6f\x03\x02\x03\x00\0" }, - { 0x1ed4, "\x00\x4f\x03\x02\x03\x09\0" }, - { 0x1ed5, "\x00\x6f\x03\x02\x03\x09\0" }, - { 0x1ed6, "\x00\x4f\x03\x02\x03\x03\0" }, - { 0x1ed7, "\x00\x6f\x03\x02\x03\x03\0" }, - { 0x1ed8, "\x00\x4f\x03\x23\x03\x02\0" }, - { 0x1ed9, "\x00\x6f\x03\x23\x03\x02\0" }, - { 0x1eda, "\x00\x4f\x03\x1b\x03\x01\0" }, - { 0x1edb, "\x00\x6f\x03\x1b\x03\x01\0" }, - { 0x1edc, "\x00\x4f\x03\x1b\x03\x00\0" }, - { 0x1edd, "\x00\x6f\x03\x1b\x03\x00\0" }, - { 0x1ede, "\x00\x4f\x03\x1b\x03\x09\0" }, - { 0x1edf, "\x00\x6f\x03\x1b\x03\x09\0" }, - { 0x1ee0, "\x00\x4f\x03\x1b\x03\x03\0" }, - { 0x1ee1, "\x00\x6f\x03\x1b\x03\x03\0" }, - { 0x1ee2, "\x00\x4f\x03\x1b\x03\x23\0" }, - { 0x1ee3, "\x00\x6f\x03\x1b\x03\x23\0" }, - { 0x1ee4, "\x00\x55\x03\x23\0" }, - { 0x1ee5, "\x00\x75\x03\x23\0" }, - { 0x1ee6, "\x00\x55\x03\x09\0" }, - { 0x1ee7, "\x00\x75\x03\x09\0" }, - { 0x1ee8, "\x00\x55\x03\x1b\x03\x01\0" }, - { 0x1ee9, "\x00\x75\x03\x1b\x03\x01\0" }, - { 0x1eea, "\x00\x55\x03\x1b\x03\x00\0" }, - { 0x1eeb, "\x00\x75\x03\x1b\x03\x00\0" }, - { 0x1eec, "\x00\x55\x03\x1b\x03\x09\0" }, - { 0x1eed, "\x00\x75\x03\x1b\x03\x09\0" }, - { 0x1eee, "\x00\x55\x03\x1b\x03\x03\0" }, - { 0x1eef, "\x00\x75\x03\x1b\x03\x03\0" }, - { 0x1ef0, "\x00\x55\x03\x1b\x03\x23\0" }, - { 0x1ef1, "\x00\x75\x03\x1b\x03\x23\0" }, - { 0x1ef2, "\x00\x59\x03\x00\0" }, - { 0x1ef3, "\x00\x79\x03\x00\0" }, - { 0x1ef4, "\x00\x59\x03\x23\0" }, - { 0x1ef5, "\x00\x79\x03\x23\0" }, - { 0x1ef6, "\x00\x59\x03\x09\0" }, - { 0x1ef7, "\x00\x79\x03\x09\0" }, - { 0x1ef8, "\x00\x59\x03\x03\0" }, - { 0x1ef9, "\x00\x79\x03\x03\0" }, - { 0x1f00, "\x03\xb1\x03\x13\0" }, - { 0x1f01, "\x03\xb1\x03\x14\0" }, - { 0x1f02, "\x03\xb1\x03\x13\x03\x00\0" }, - { 0x1f03, "\x03\xb1\x03\x14\x03\x00\0" }, - { 0x1f04, "\x03\xb1\x03\x13\x03\x01\0" }, - { 0x1f05, "\x03\xb1\x03\x14\x03\x01\0" }, - { 0x1f06, "\x03\xb1\x03\x13\x03\x42\0" }, - { 0x1f07, "\x03\xb1\x03\x14\x03\x42\0" }, - { 0x1f08, "\x03\x91\x03\x13\0" }, - { 0x1f09, "\x03\x91\x03\x14\0" }, - { 0x1f0a, "\x03\x91\x03\x13\x03\x00\0" }, - { 0x1f0b, "\x03\x91\x03\x14\x03\x00\0" }, - { 0x1f0c, "\x03\x91\x03\x13\x03\x01\0" }, - { 0x1f0d, "\x03\x91\x03\x14\x03\x01\0" }, - { 0x1f0e, "\x03\x91\x03\x13\x03\x42\0" }, - { 0x1f0f, "\x03\x91\x03\x14\x03\x42\0" }, - { 0x1f10, "\x03\xb5\x03\x13\0" }, - { 0x1f11, "\x03\xb5\x03\x14\0" }, - { 0x1f12, "\x03\xb5\x03\x13\x03\x00\0" }, - { 0x1f13, "\x03\xb5\x03\x14\x03\x00\0" }, - { 0x1f14, "\x03\xb5\x03\x13\x03\x01\0" }, - { 0x1f15, "\x03\xb5\x03\x14\x03\x01\0" }, - { 0x1f18, "\x03\x95\x03\x13\0" }, - { 0x1f19, "\x03\x95\x03\x14\0" }, - { 0x1f1a, "\x03\x95\x03\x13\x03\x00\0" }, - { 0x1f1b, "\x03\x95\x03\x14\x03\x00\0" }, - { 0x1f1c, "\x03\x95\x03\x13\x03\x01\0" }, - { 0x1f1d, "\x03\x95\x03\x14\x03\x01\0" }, - { 0x1f20, "\x03\xb7\x03\x13\0" }, - { 0x1f21, "\x03\xb7\x03\x14\0" }, - { 0x1f22, "\x03\xb7\x03\x13\x03\x00\0" }, - { 0x1f23, "\x03\xb7\x03\x14\x03\x00\0" }, - { 0x1f24, "\x03\xb7\x03\x13\x03\x01\0" }, - { 0x1f25, "\x03\xb7\x03\x14\x03\x01\0" }, - { 0x1f26, "\x03\xb7\x03\x13\x03\x42\0" }, - { 0x1f27, "\x03\xb7\x03\x14\x03\x42\0" }, - { 0x1f28, "\x03\x97\x03\x13\0" }, - { 0x1f29, "\x03\x97\x03\x14\0" }, - { 0x1f2a, "\x03\x97\x03\x13\x03\x00\0" }, - { 0x1f2b, "\x03\x97\x03\x14\x03\x00\0" }, - { 0x1f2c, "\x03\x97\x03\x13\x03\x01\0" }, - { 0x1f2d, "\x03\x97\x03\x14\x03\x01\0" }, - { 0x1f2e, "\x03\x97\x03\x13\x03\x42\0" }, - { 0x1f2f, "\x03\x97\x03\x14\x03\x42\0" }, - { 0x1f30, "\x03\xb9\x03\x13\0" }, - { 0x1f31, "\x03\xb9\x03\x14\0" }, - { 0x1f32, "\x03\xb9\x03\x13\x03\x00\0" }, - { 0x1f33, "\x03\xb9\x03\x14\x03\x00\0" }, - { 0x1f34, "\x03\xb9\x03\x13\x03\x01\0" }, - { 0x1f35, "\x03\xb9\x03\x14\x03\x01\0" }, - { 0x1f36, "\x03\xb9\x03\x13\x03\x42\0" }, - { 0x1f37, "\x03\xb9\x03\x14\x03\x42\0" }, - { 0x1f38, "\x03\x99\x03\x13\0" }, - { 0x1f39, "\x03\x99\x03\x14\0" }, - { 0x1f3a, "\x03\x99\x03\x13\x03\x00\0" }, - { 0x1f3b, "\x03\x99\x03\x14\x03\x00\0" }, - { 0x1f3c, "\x03\x99\x03\x13\x03\x01\0" }, - { 0x1f3d, "\x03\x99\x03\x14\x03\x01\0" }, - { 0x1f3e, "\x03\x99\x03\x13\x03\x42\0" }, - { 0x1f3f, "\x03\x99\x03\x14\x03\x42\0" }, - { 0x1f40, "\x03\xbf\x03\x13\0" }, - { 0x1f41, "\x03\xbf\x03\x14\0" }, - { 0x1f42, "\x03\xbf\x03\x13\x03\x00\0" }, - { 0x1f43, "\x03\xbf\x03\x14\x03\x00\0" }, - { 0x1f44, "\x03\xbf\x03\x13\x03\x01\0" }, - { 0x1f45, "\x03\xbf\x03\x14\x03\x01\0" }, - { 0x1f48, "\x03\x9f\x03\x13\0" }, - { 0x1f49, "\x03\x9f\x03\x14\0" }, - { 0x1f4a, "\x03\x9f\x03\x13\x03\x00\0" }, - { 0x1f4b, "\x03\x9f\x03\x14\x03\x00\0" }, - { 0x1f4c, "\x03\x9f\x03\x13\x03\x01\0" }, - { 0x1f4d, "\x03\x9f\x03\x14\x03\x01\0" }, - { 0x1f50, "\x03\xc5\x03\x13\0" }, - { 0x1f51, "\x03\xc5\x03\x14\0" }, - { 0x1f52, "\x03\xc5\x03\x13\x03\x00\0" }, - { 0x1f53, "\x03\xc5\x03\x14\x03\x00\0" }, - { 0x1f54, "\x03\xc5\x03\x13\x03\x01\0" }, - { 0x1f55, "\x03\xc5\x03\x14\x03\x01\0" }, - { 0x1f56, "\x03\xc5\x03\x13\x03\x42\0" }, - { 0x1f57, "\x03\xc5\x03\x14\x03\x42\0" }, - { 0x1f59, "\x03\xa5\x03\x14\0" }, - { 0x1f5b, "\x03\xa5\x03\x14\x03\x00\0" }, - { 0x1f5d, "\x03\xa5\x03\x14\x03\x01\0" }, - { 0x1f5f, "\x03\xa5\x03\x14\x03\x42\0" }, - { 0x1f60, "\x03\xc9\x03\x13\0" }, - { 0x1f61, "\x03\xc9\x03\x14\0" }, - { 0x1f62, "\x03\xc9\x03\x13\x03\x00\0" }, - { 0x1f63, "\x03\xc9\x03\x14\x03\x00\0" }, - { 0x1f64, "\x03\xc9\x03\x13\x03\x01\0" }, - { 0x1f65, "\x03\xc9\x03\x14\x03\x01\0" }, - { 0x1f66, "\x03\xc9\x03\x13\x03\x42\0" }, - { 0x1f67, "\x03\xc9\x03\x14\x03\x42\0" }, - { 0x1f68, "\x03\xa9\x03\x13\0" }, - { 0x1f69, "\x03\xa9\x03\x14\0" }, - { 0x1f6a, "\x03\xa9\x03\x13\x03\x00\0" }, - { 0x1f6b, "\x03\xa9\x03\x14\x03\x00\0" }, - { 0x1f6c, "\x03\xa9\x03\x13\x03\x01\0" }, - { 0x1f6d, "\x03\xa9\x03\x14\x03\x01\0" }, - { 0x1f6e, "\x03\xa9\x03\x13\x03\x42\0" }, - { 0x1f6f, "\x03\xa9\x03\x14\x03\x42\0" }, - { 0x1f70, "\x03\xb1\x03\x00\0" }, - { 0x1f71, "\x03\xb1\x03\x01\0" }, - { 0x1f72, "\x03\xb5\x03\x00\0" }, - { 0x1f73, "\x03\xb5\x03\x01\0" }, - { 0x1f74, "\x03\xb7\x03\x00\0" }, - { 0x1f75, "\x03\xb7\x03\x01\0" }, - { 0x1f76, "\x03\xb9\x03\x00\0" }, - { 0x1f77, "\x03\xb9\x03\x01\0" }, - { 0x1f78, "\x03\xbf\x03\x00\0" }, - { 0x1f79, "\x03\xbf\x03\x01\0" }, - { 0x1f7a, "\x03\xc5\x03\x00\0" }, - { 0x1f7b, "\x03\xc5\x03\x01\0" }, - { 0x1f7c, "\x03\xc9\x03\x00\0" }, - { 0x1f7d, "\x03\xc9\x03\x01\0" }, - { 0x1f80, "\x03\xb1\x03\x13\x03\x45\0" }, - { 0x1f81, "\x03\xb1\x03\x14\x03\x45\0" }, - { 0x1f82, "\x03\xb1\x03\x13\x03\x00\x03\x45\0" }, - { 0x1f83, "\x03\xb1\x03\x14\x03\x00\x03\x45\0" }, - { 0x1f84, "\x03\xb1\x03\x13\x03\x01\x03\x45\0" }, - { 0x1f85, "\x03\xb1\x03\x14\x03\x01\x03\x45\0" }, - { 0x1f86, "\x03\xb1\x03\x13\x03\x42\x03\x45\0" }, - { 0x1f87, "\x03\xb1\x03\x14\x03\x42\x03\x45\0" }, - { 0x1f88, "\x03\x91\x03\x13\x03\x45\0" }, - { 0x1f89, "\x03\x91\x03\x14\x03\x45\0" }, - { 0x1f8a, "\x03\x91\x03\x13\x03\x00\x03\x45\0" }, - { 0x1f8b, "\x03\x91\x03\x14\x03\x00\x03\x45\0" }, - { 0x1f8c, "\x03\x91\x03\x13\x03\x01\x03\x45\0" }, - { 0x1f8d, "\x03\x91\x03\x14\x03\x01\x03\x45\0" }, - { 0x1f8e, "\x03\x91\x03\x13\x03\x42\x03\x45\0" }, - { 0x1f8f, "\x03\x91\x03\x14\x03\x42\x03\x45\0" }, - { 0x1f90, "\x03\xb7\x03\x13\x03\x45\0" }, - { 0x1f91, "\x03\xb7\x03\x14\x03\x45\0" }, - { 0x1f92, "\x03\xb7\x03\x13\x03\x00\x03\x45\0" }, - { 0x1f93, "\x03\xb7\x03\x14\x03\x00\x03\x45\0" }, - { 0x1f94, "\x03\xb7\x03\x13\x03\x01\x03\x45\0" }, - { 0x1f95, "\x03\xb7\x03\x14\x03\x01\x03\x45\0" }, - { 0x1f96, "\x03\xb7\x03\x13\x03\x42\x03\x45\0" }, - { 0x1f97, "\x03\xb7\x03\x14\x03\x42\x03\x45\0" }, - { 0x1f98, "\x03\x97\x03\x13\x03\x45\0" }, - { 0x1f99, "\x03\x97\x03\x14\x03\x45\0" }, - { 0x1f9a, "\x03\x97\x03\x13\x03\x00\x03\x45\0" }, - { 0x1f9b, "\x03\x97\x03\x14\x03\x00\x03\x45\0" }, - { 0x1f9c, "\x03\x97\x03\x13\x03\x01\x03\x45\0" }, - { 0x1f9d, "\x03\x97\x03\x14\x03\x01\x03\x45\0" }, - { 0x1f9e, "\x03\x97\x03\x13\x03\x42\x03\x45\0" }, - { 0x1f9f, "\x03\x97\x03\x14\x03\x42\x03\x45\0" }, - { 0x1fa0, "\x03\xc9\x03\x13\x03\x45\0" }, - { 0x1fa1, "\x03\xc9\x03\x14\x03\x45\0" }, - { 0x1fa2, "\x03\xc9\x03\x13\x03\x00\x03\x45\0" }, - { 0x1fa3, "\x03\xc9\x03\x14\x03\x00\x03\x45\0" }, - { 0x1fa4, "\x03\xc9\x03\x13\x03\x01\x03\x45\0" }, - { 0x1fa5, "\x03\xc9\x03\x14\x03\x01\x03\x45\0" }, - { 0x1fa6, "\x03\xc9\x03\x13\x03\x42\x03\x45\0" }, - { 0x1fa7, "\x03\xc9\x03\x14\x03\x42\x03\x45\0" }, - { 0x1fa8, "\x03\xa9\x03\x13\x03\x45\0" }, - { 0x1fa9, "\x03\xa9\x03\x14\x03\x45\0" }, - { 0x1faa, "\x03\xa9\x03\x13\x03\x00\x03\x45\0" }, - { 0x1fab, "\x03\xa9\x03\x14\x03\x00\x03\x45\0" }, - { 0x1fac, "\x03\xa9\x03\x13\x03\x01\x03\x45\0" }, - { 0x1fad, "\x03\xa9\x03\x14\x03\x01\x03\x45\0" }, - { 0x1fae, "\x03\xa9\x03\x13\x03\x42\x03\x45\0" }, - { 0x1faf, "\x03\xa9\x03\x14\x03\x42\x03\x45\0" }, - { 0x1fb0, "\x03\xb1\x03\x06\0" }, - { 0x1fb1, "\x03\xb1\x03\x04\0" }, - { 0x1fb2, "\x03\xb1\x03\x00\x03\x45\0" }, - { 0x1fb3, "\x03\xb1\x03\x45\0" }, - { 0x1fb4, "\x03\xb1\x03\x01\x03\x45\0" }, - { 0x1fb6, "\x03\xb1\x03\x42\0" }, - { 0x1fb7, "\x03\xb1\x03\x42\x03\x45\0" }, - { 0x1fb8, "\x03\x91\x03\x06\0" }, - { 0x1fb9, "\x03\x91\x03\x04\0" }, - { 0x1fba, "\x03\x91\x03\x00\0" }, - { 0x1fbb, "\x03\x91\x03\x01\0" }, - { 0x1fbc, "\x03\x91\x03\x45\0" }, - { 0x1fbe, "\x03\xb9\0" }, - { 0x1fc1, "\x00\xa8\x03\x42\0" }, - { 0x1fc2, "\x03\xb7\x03\x00\x03\x45\0" }, - { 0x1fc3, "\x03\xb7\x03\x45\0" }, - { 0x1fc4, "\x03\xb7\x03\x01\x03\x45\0" }, - { 0x1fc6, "\x03\xb7\x03\x42\0" }, - { 0x1fc7, "\x03\xb7\x03\x42\x03\x45\0" }, - { 0x1fc8, "\x03\x95\x03\x00\0" }, - { 0x1fc9, "\x03\x95\x03\x01\0" }, - { 0x1fca, "\x03\x97\x03\x00\0" }, - { 0x1fcb, "\x03\x97\x03\x01\0" }, - { 0x1fcc, "\x03\x97\x03\x45\0" }, - { 0x1fcd, "\x1f\xbf\x03\x00\0" }, - { 0x1fce, "\x1f\xbf\x03\x01\0" }, - { 0x1fcf, "\x1f\xbf\x03\x42\0" }, - { 0x1fd0, "\x03\xb9\x03\x06\0" }, - { 0x1fd1, "\x03\xb9\x03\x04\0" }, - { 0x1fd2, "\x03\xb9\x03\x08\x03\x00\0" }, - { 0x1fd3, "\x03\xb9\x03\x08\x03\x01\0" }, - { 0x1fd6, "\x03\xb9\x03\x42\0" }, - { 0x1fd7, "\x03\xb9\x03\x08\x03\x42\0" }, - { 0x1fd8, "\x03\x99\x03\x06\0" }, - { 0x1fd9, "\x03\x99\x03\x04\0" }, - { 0x1fda, "\x03\x99\x03\x00\0" }, - { 0x1fdb, "\x03\x99\x03\x01\0" }, - { 0x1fdd, "\x1f\xfe\x03\x00\0" }, - { 0x1fde, "\x1f\xfe\x03\x01\0" }, - { 0x1fdf, "\x1f\xfe\x03\x42\0" }, - { 0x1fe0, "\x03\xc5\x03\x06\0" }, - { 0x1fe1, "\x03\xc5\x03\x04\0" }, - { 0x1fe2, "\x03\xc5\x03\x08\x03\x00\0" }, - { 0x1fe3, "\x03\xc5\x03\x08\x03\x01\0" }, - { 0x1fe4, "\x03\xc1\x03\x13\0" }, - { 0x1fe5, "\x03\xc1\x03\x14\0" }, - { 0x1fe6, "\x03\xc5\x03\x42\0" }, - { 0x1fe7, "\x03\xc5\x03\x08\x03\x42\0" }, - { 0x1fe8, "\x03\xa5\x03\x06\0" }, - { 0x1fe9, "\x03\xa5\x03\x04\0" }, - { 0x1fea, "\x03\xa5\x03\x00\0" }, - { 0x1feb, "\x03\xa5\x03\x01\0" }, - { 0x1fec, "\x03\xa1\x03\x14\0" }, - { 0x1fed, "\x00\xa8\x03\x00\0" }, - { 0x1fee, "\x00\xa8\x03\x01\0" }, - { 0x1fef, "\x00\x60\0" }, - { 0x1ff2, "\x03\xc9\x03\x00\x03\x45\0" }, - { 0x1ff3, "\x03\xc9\x03\x45\0" }, - { 0x1ff4, "\x03\xc9\x03\x01\x03\x45\0" }, - { 0x1ff6, "\x03\xc9\x03\x42\0" }, - { 0x1ff7, "\x03\xc9\x03\x42\x03\x45\0" }, - { 0x1ff8, "\x03\x9f\x03\x00\0" }, - { 0x1ff9, "\x03\x9f\x03\x01\0" }, - { 0x1ffa, "\x03\xa9\x03\x00\0" }, - { 0x1ffb, "\x03\xa9\x03\x01\0" }, - { 0x1ffc, "\x03\xa9\x03\x45\0" }, - { 0x1ffd, "\x00\xb4\0" }, - { 0x2000, "\x20\x02\0" }, - { 0x2001, "\x20\x03\0" }, - { 0x2126, "\x03\xa9\0" }, - { 0x212a, "\x00\x4b\0" }, - { 0x212b, "\x00\x41\x03\x0a\0" }, - { 0x2204, "\x22\x03\x03\x38\0" }, - { 0x2209, "\x22\x08\x03\x38\0" }, - { 0x220c, "\x22\x0b\x03\x38\0" }, - { 0x2224, "\x22\x23\x03\x38\0" }, - { 0x2226, "\x22\x25\x03\x38\0" }, - { 0x2241, "\x00\x7e\x03\x38\0" }, - { 0x2244, "\x22\x43\x03\x38\0" }, - { 0x2247, "\x22\x45\x03\x38\0" }, - { 0x2249, "\x22\x48\x03\x38\0" }, - { 0x2260, "\x00\x3d\x03\x38\0" }, - { 0x2262, "\x22\x61\x03\x38\0" }, - { 0x226d, "\x22\x4d\x03\x38\0" }, - { 0x226e, "\x00\x3c\x03\x38\0" }, - { 0x226f, "\x00\x3e\x03\x38\0" }, - { 0x2270, "\x22\x64\x03\x38\0" }, - { 0x2271, "\x22\x65\x03\x38\0" }, - { 0x2274, "\x22\x72\x03\x38\0" }, - { 0x2275, "\x22\x73\x03\x38\0" }, - { 0x2278, "\x22\x76\x03\x38\0" }, - { 0x2279, "\x22\x77\x03\x38\0" }, - { 0x2280, "\x22\x7a\x03\x38\0" }, - { 0x2281, "\x22\x7b\x03\x38\0" }, - { 0x2284, "\x22\x82\x03\x38\0" }, - { 0x2285, "\x22\x83\x03\x38\0" }, - { 0x2288, "\x22\x86\x03\x38\0" }, - { 0x2289, "\x22\x87\x03\x38\0" }, - { 0x22ac, "\x22\xa2\x03\x38\0" }, - { 0x22ad, "\x22\xa8\x03\x38\0" }, - { 0x22ae, "\x22\xa9\x03\x38\0" }, - { 0x22af, "\x22\xab\x03\x38\0" }, - { 0x22e0, "\x22\x7c\x03\x38\0" }, - { 0x22e1, "\x22\x7d\x03\x38\0" }, - { 0x22e2, "\x22\x91\x03\x38\0" }, - { 0x22e3, "\x22\x92\x03\x38\0" }, - { 0x22ea, "\x22\xb2\x03\x38\0" }, - { 0x22eb, "\x22\xb3\x03\x38\0" }, - { 0x22ec, "\x22\xb4\x03\x38\0" }, - { 0x22ed, "\x22\xb5\x03\x38\0" }, - { 0x2329, "\x30\x08\0" }, - { 0x232a, "\x30\x09\0" }, - { 0x304c, "\x30\x4b\x30\x99\0" }, - { 0x304e, "\x30\x4d\x30\x99\0" }, - { 0x3050, "\x30\x4f\x30\x99\0" }, - { 0x3052, "\x30\x51\x30\x99\0" }, - { 0x3054, "\x30\x53\x30\x99\0" }, - { 0x3056, "\x30\x55\x30\x99\0" }, - { 0x3058, "\x30\x57\x30\x99\0" }, - { 0x305a, "\x30\x59\x30\x99\0" }, - { 0x305c, "\x30\x5b\x30\x99\0" }, - { 0x305e, "\x30\x5d\x30\x99\0" }, - { 0x3060, "\x30\x5f\x30\x99\0" }, - { 0x3062, "\x30\x61\x30\x99\0" }, - { 0x3065, "\x30\x64\x30\x99\0" }, - { 0x3067, "\x30\x66\x30\x99\0" }, - { 0x3069, "\x30\x68\x30\x99\0" }, - { 0x3070, "\x30\x6f\x30\x99\0" }, - { 0x3071, "\x30\x6f\x30\x9a\0" }, - { 0x3073, "\x30\x72\x30\x99\0" }, - { 0x3074, "\x30\x72\x30\x9a\0" }, - { 0x3076, "\x30\x75\x30\x99\0" }, - { 0x3077, "\x30\x75\x30\x9a\0" }, - { 0x3079, "\x30\x78\x30\x99\0" }, - { 0x307a, "\x30\x78\x30\x9a\0" }, - { 0x307c, "\x30\x7b\x30\x99\0" }, - { 0x307d, "\x30\x7b\x30\x9a\0" }, - { 0x3094, "\x30\x46\x30\x99\0" }, - { 0x309e, "\x30\x9d\x30\x99\0" }, - { 0x30ac, "\x30\xab\x30\x99\0" }, - { 0x30ae, "\x30\xad\x30\x99\0" }, - { 0x30b0, "\x30\xaf\x30\x99\0" }, - { 0x30b2, "\x30\xb1\x30\x99\0" }, - { 0x30b4, "\x30\xb3\x30\x99\0" }, - { 0x30b6, "\x30\xb5\x30\x99\0" }, - { 0x30b8, "\x30\xb7\x30\x99\0" }, - { 0x30ba, "\x30\xb9\x30\x99\0" }, - { 0x30bc, "\x30\xbb\x30\x99\0" }, - { 0x30be, "\x30\xbd\x30\x99\0" }, - { 0x30c0, "\x30\xbf\x30\x99\0" }, - { 0x30c2, "\x30\xc1\x30\x99\0" }, - { 0x30c5, "\x30\xc4\x30\x99\0" }, - { 0x30c7, "\x30\xc6\x30\x99\0" }, - { 0x30c9, "\x30\xc8\x30\x99\0" }, - { 0x30d0, "\x30\xcf\x30\x99\0" }, - { 0x30d1, "\x30\xcf\x30\x9a\0" }, - { 0x30d3, "\x30\xd2\x30\x99\0" }, - { 0x30d4, "\x30\xd2\x30\x9a\0" }, - { 0x30d6, "\x30\xd5\x30\x99\0" }, - { 0x30d7, "\x30\xd5\x30\x9a\0" }, - { 0x30d9, "\x30\xd8\x30\x99\0" }, - { 0x30da, "\x30\xd8\x30\x9a\0" }, - { 0x30dc, "\x30\xdb\x30\x99\0" }, - { 0x30dd, "\x30\xdb\x30\x9a\0" }, - { 0x30f4, "\x30\xa6\x30\x99\0" }, - { 0x30f7, "\x30\xef\x30\x99\0" }, - { 0x30f8, "\x30\xf0\x30\x99\0" }, - { 0x30f9, "\x30\xf1\x30\x99\0" }, - { 0x30fa, "\x30\xf2\x30\x99\0" }, - { 0x30fe, "\x30\xfd\x30\x99\0" }, - { 0xf900, "\x8c\x48\0" }, - { 0xf901, "\x66\xf4\0" }, - { 0xf902, "\x8e\xca\0" }, - { 0xf903, "\x8c\xc8\0" }, - { 0xf904, "\x6e\xd1\0" }, - { 0xf905, "\x4e\x32\0" }, - { 0xf906, "\x53\xe5\0" }, - { 0xf907, "\x9f\x9c\0" }, - { 0xf908, "\x9f\x9c\0" }, - { 0xf909, "\x59\x51\0" }, - { 0xf90a, "\x91\xd1\0" }, - { 0xf90b, "\x55\x87\0" }, - { 0xf90c, "\x59\x48\0" }, - { 0xf90d, "\x61\xf6\0" }, - { 0xf90e, "\x76\x69\0" }, - { 0xf90f, "\x7f\x85\0" }, - { 0xf910, "\x86\x3f\0" }, - { 0xf911, "\x87\xba\0" }, - { 0xf912, "\x88\xf8\0" }, - { 0xf913, "\x90\x8f\0" }, - { 0xf914, "\x6a\x02\0" }, - { 0xf915, "\x6d\x1b\0" }, - { 0xf916, "\x70\xd9\0" }, - { 0xf917, "\x73\xde\0" }, - { 0xf918, "\x84\x3d\0" }, - { 0xf919, "\x91\x6a\0" }, - { 0xf91a, "\x99\xf1\0" }, - { 0xf91b, "\x4e\x82\0" }, - { 0xf91c, "\x53\x75\0" }, - { 0xf91d, "\x6b\x04\0" }, - { 0xf91e, "\x72\x1b\0" }, - { 0xf91f, "\x86\x2d\0" }, - { 0xf920, "\x9e\x1e\0" }, - { 0xf921, "\x5d\x50\0" }, - { 0xf922, "\x6f\xeb\0" }, - { 0xf923, "\x85\xcd\0" }, - { 0xf924, "\x89\x64\0" }, - { 0xf925, "\x62\xc9\0" }, - { 0xf926, "\x81\xd8\0" }, - { 0xf927, "\x88\x1f\0" }, - { 0xf928, "\x5e\xca\0" }, - { 0xf929, "\x67\x17\0" }, - { 0xf92a, "\x6d\x6a\0" }, - { 0xf92b, "\x72\xfc\0" }, - { 0xf92c, "\x90\xce\0" }, - { 0xf92d, "\x4f\x86\0" }, - { 0xf92e, "\x51\xb7\0" }, - { 0xf92f, "\x52\xde\0" }, - { 0xf930, "\x64\xc4\0" }, - { 0xf931, "\x6a\xd3\0" }, - { 0xf932, "\x72\x10\0" }, - { 0xf933, "\x76\xe7\0" }, - { 0xf934, "\x80\x01\0" }, - { 0xf935, "\x86\x06\0" }, - { 0xf936, "\x86\x5c\0" }, - { 0xf937, "\x8d\xef\0" }, - { 0xf938, "\x97\x32\0" }, - { 0xf939, "\x9b\x6f\0" }, - { 0xf93a, "\x9d\xfa\0" }, - { 0xf93b, "\x78\x8c\0" }, - { 0xf93c, "\x79\x7f\0" }, - { 0xf93d, "\x7d\xa0\0" }, - { 0xf93e, "\x83\xc9\0" }, - { 0xf93f, "\x93\x04\0" }, - { 0xf940, "\x9e\x7f\0" }, - { 0xf941, "\x8a\xd6\0" }, - { 0xf942, "\x58\xdf\0" }, - { 0xf943, "\x5f\x04\0" }, - { 0xf944, "\x7c\x60\0" }, - { 0xf945, "\x80\x7e\0" }, - { 0xf946, "\x72\x62\0" }, - { 0xf947, "\x78\xca\0" }, - { 0xf948, "\x8c\xc2\0" }, - { 0xf949, "\x96\xf7\0" }, - { 0xf94a, "\x58\xd8\0" }, - { 0xf94b, "\x5c\x62\0" }, - { 0xf94c, "\x6a\x13\0" }, - { 0xf94d, "\x6d\xda\0" }, - { 0xf94e, "\x6f\x0f\0" }, - { 0xf94f, "\x7d\x2f\0" }, - { 0xf950, "\x7e\x37\0" }, - { 0xf951, "\x96\xfb\0" }, - { 0xf952, "\x52\xd2\0" }, - { 0xf953, "\x80\x8b\0" }, - { 0xf954, "\x51\xdc\0" }, - { 0xf955, "\x51\xcc\0" }, - { 0xf956, "\x7a\x1c\0" }, - { 0xf957, "\x7d\xbe\0" }, - { 0xf958, "\x83\xf1\0" }, - { 0xf959, "\x96\x75\0" }, - { 0xf95a, "\x8b\x80\0" }, - { 0xf95b, "\x62\xcf\0" }, - { 0xf95c, "\x6a\x02\0" }, - { 0xf95d, "\x8a\xfe\0" }, - { 0xf95e, "\x4e\x39\0" }, - { 0xf95f, "\x5b\xe7\0" }, - { 0xf960, "\x60\x12\0" }, - { 0xf961, "\x73\x87\0" }, - { 0xf962, "\x75\x70\0" }, - { 0xf963, "\x53\x17\0" }, - { 0xf964, "\x78\xfb\0" }, - { 0xf965, "\x4f\xbf\0" }, - { 0xf966, "\x5f\xa9\0" }, - { 0xf967, "\x4e\x0d\0" }, - { 0xf968, "\x6c\xcc\0" }, - { 0xf969, "\x65\x78\0" }, - { 0xf96a, "\x7d\x22\0" }, - { 0xf96b, "\x53\xc3\0" }, - { 0xf96c, "\x58\x5e\0" }, - { 0xf96d, "\x77\x01\0" }, - { 0xf96e, "\x84\x49\0" }, - { 0xf96f, "\x8a\xaa\0" }, - { 0xf970, "\x6b\xba\0" }, - { 0xf971, "\x8f\xb0\0" }, - { 0xf972, "\x6c\x88\0" }, - { 0xf973, "\x62\xfe\0" }, - { 0xf974, "\x82\xe5\0" }, - { 0xf975, "\x63\xa0\0" }, - { 0xf976, "\x75\x65\0" }, - { 0xf977, "\x4e\xae\0" }, - { 0xf978, "\x51\x69\0" }, - { 0xf979, "\x51\xc9\0" }, - { 0xf97a, "\x68\x81\0" }, - { 0xf97b, "\x7c\xe7\0" }, - { 0xf97c, "\x82\x6f\0" }, - { 0xf97d, "\x8a\xd2\0" }, - { 0xf97e, "\x91\xcf\0" }, - { 0xf97f, "\x52\xf5\0" }, - { 0xf980, "\x54\x42\0" }, - { 0xf981, "\x59\x73\0" }, - { 0xf982, "\x5e\xec\0" }, - { 0xf983, "\x65\xc5\0" }, - { 0xf984, "\x6f\xfe\0" }, - { 0xf985, "\x79\x2a\0" }, - { 0xf986, "\x95\xad\0" }, - { 0xf987, "\x9a\x6a\0" }, - { 0xf988, "\x9e\x97\0" }, - { 0xf989, "\x9e\xce\0" }, - { 0xf98a, "\x52\x9b\0" }, - { 0xf98b, "\x66\xc6\0" }, - { 0xf98c, "\x6b\x77\0" }, - { 0xf98d, "\x8f\x62\0" }, - { 0xf98e, "\x5e\x74\0" }, - { 0xf98f, "\x61\x90\0" }, - { 0xf990, "\x62\x00\0" }, - { 0xf991, "\x64\x9a\0" }, - { 0xf992, "\x6f\x23\0" }, - { 0xf993, "\x71\x49\0" }, - { 0xf994, "\x74\x89\0" }, - { 0xf995, "\x79\xca\0" }, - { 0xf996, "\x7d\xf4\0" }, - { 0xf997, "\x80\x6f\0" }, - { 0xf998, "\x8f\x26\0" }, - { 0xf999, "\x84\xee\0" }, - { 0xf99a, "\x90\x23\0" }, - { 0xf99b, "\x93\x4a\0" }, - { 0xf99c, "\x52\x17\0" }, - { 0xf99d, "\x52\xa3\0" }, - { 0xf99e, "\x54\xbd\0" }, - { 0xf99f, "\x70\xc8\0" }, - { 0xf9a0, "\x88\xc2\0" }, - { 0xf9a1, "\x8a\xaa\0" }, - { 0xf9a2, "\x5e\xc9\0" }, - { 0xf9a3, "\x5f\xf5\0" }, - { 0xf9a4, "\x63\x7b\0" }, - { 0xf9a5, "\x6b\xae\0" }, - { 0xf9a6, "\x7c\x3e\0" }, - { 0xf9a7, "\x73\x75\0" }, - { 0xf9a8, "\x4e\xe4\0" }, - { 0xf9a9, "\x56\xf9\0" }, - { 0xf9aa, "\x5b\xe7\0" }, - { 0xf9ab, "\x5d\xba\0" }, - { 0xf9ac, "\x60\x1c\0" }, - { 0xf9ad, "\x73\xb2\0" }, - { 0xf9ae, "\x74\x69\0" }, - { 0xf9af, "\x7f\x9a\0" }, - { 0xf9b0, "\x80\x46\0" }, - { 0xf9b1, "\x92\x34\0" }, - { 0xf9b2, "\x96\xf6\0" }, - { 0xf9b3, "\x97\x48\0" }, - { 0xf9b4, "\x98\x18\0" }, - { 0xf9b5, "\x4f\x8b\0" }, - { 0xf9b6, "\x79\xae\0" }, - { 0xf9b7, "\x91\xb4\0" }, - { 0xf9b8, "\x96\xb8\0" }, - { 0xf9b9, "\x60\xe1\0" }, - { 0xf9ba, "\x4e\x86\0" }, - { 0xf9bb, "\x50\xda\0" }, - { 0xf9bc, "\x5b\xee\0" }, - { 0xf9bd, "\x5c\x3f\0" }, - { 0xf9be, "\x65\x99\0" }, - { 0xf9bf, "\x6a\x02\0" }, - { 0xf9c0, "\x71\xce\0" }, - { 0xf9c1, "\x76\x42\0" }, - { 0xf9c2, "\x84\xfc\0" }, - { 0xf9c3, "\x90\x7c\0" }, - { 0xf9c4, "\x9f\x8d\0" }, - { 0xf9c5, "\x66\x88\0" }, - { 0xf9c6, "\x96\x2e\0" }, - { 0xf9c7, "\x52\x89\0" }, - { 0xf9c8, "\x67\x7b\0" }, - { 0xf9c9, "\x67\xf3\0" }, - { 0xf9ca, "\x6d\x41\0" }, - { 0xf9cb, "\x6e\x9c\0" }, - { 0xf9cc, "\x74\x09\0" }, - { 0xf9cd, "\x75\x59\0" }, - { 0xf9ce, "\x78\x6b\0" }, - { 0xf9cf, "\x7d\x10\0" }, - { 0xf9d0, "\x98\x5e\0" }, - { 0xf9d1, "\x51\x6d\0" }, - { 0xf9d2, "\x62\x2e\0" }, - { 0xf9d3, "\x96\x78\0" }, - { 0xf9d4, "\x50\x2b\0" }, - { 0xf9d5, "\x5d\x19\0" }, - { 0xf9d6, "\x6d\xea\0" }, - { 0xf9d7, "\x8f\x2a\0" }, - { 0xf9d8, "\x5f\x8b\0" }, - { 0xf9d9, "\x61\x44\0" }, - { 0xf9da, "\x68\x17\0" }, - { 0xf9db, "\x73\x87\0" }, - { 0xf9dc, "\x96\x86\0" }, - { 0xf9dd, "\x52\x29\0" }, - { 0xf9de, "\x54\x0f\0" }, - { 0xf9df, "\x5c\x65\0" }, - { 0xf9e0, "\x66\x13\0" }, - { 0xf9e1, "\x67\x4e\0" }, - { 0xf9e2, "\x68\xa8\0" }, - { 0xf9e3, "\x6c\xe5\0" }, - { 0xf9e4, "\x74\x06\0" }, - { 0xf9e5, "\x75\xe2\0" }, - { 0xf9e6, "\x7f\x79\0" }, - { 0xf9e7, "\x88\xcf\0" }, - { 0xf9e8, "\x88\xe1\0" }, - { 0xf9e9, "\x91\xcc\0" }, - { 0xf9ea, "\x96\xe2\0" }, - { 0xf9eb, "\x53\x3f\0" }, - { 0xf9ec, "\x6e\xba\0" }, - { 0xf9ed, "\x54\x1d\0" }, - { 0xf9ee, "\x71\xd0\0" }, - { 0xf9ef, "\x74\x98\0" }, - { 0xf9f0, "\x85\xfa\0" }, - { 0xf9f1, "\x96\xa3\0" }, - { 0xf9f2, "\x9c\x57\0" }, - { 0xf9f3, "\x9e\x9f\0" }, - { 0xf9f4, "\x67\x97\0" }, - { 0xf9f5, "\x6d\xcb\0" }, - { 0xf9f6, "\x81\xe8\0" }, - { 0xf9f7, "\x7a\xcb\0" }, - { 0xf9f8, "\x7b\x20\0" }, - { 0xf9f9, "\x7c\x92\0" }, - { 0xf9fa, "\x72\xc0\0" }, - { 0xf9fb, "\x70\x99\0" }, - { 0xf9fc, "\x8b\x58\0" }, - { 0xf9fd, "\x4e\xc0\0" }, - { 0xf9fe, "\x83\x36\0" }, - { 0xf9ff, "\x52\x3a\0" }, - { 0xfa00, "\x52\x07\0" }, - { 0xfa01, "\x5e\xa6\0" }, - { 0xfa02, "\x62\xd3\0" }, - { 0xfa03, "\x7c\xd6\0" }, - { 0xfa04, "\x5b\x85\0" }, - { 0xfa05, "\x6d\x1e\0" }, - { 0xfa06, "\x66\xb4\0" }, - { 0xfa07, "\x8f\x3b\0" }, - { 0xfa08, "\x88\x4c\0" }, - { 0xfa09, "\x96\x4d\0" }, - { 0xfa0a, "\x89\x8b\0" }, - { 0xfa0b, "\x5e\xd3\0" }, - { 0xfa0c, "\x51\x40\0" }, - { 0xfa0d, "\x55\xc0\0" }, - { 0xfa10, "\x58\x5a\0" }, - { 0xfa12, "\x66\x74\0" }, - { 0xfa15, "\x51\xde\0" }, - { 0xfa16, "\x73\x2a\0" }, - { 0xfa17, "\x76\xca\0" }, - { 0xfa18, "\x79\x3c\0" }, - { 0xfa19, "\x79\x5e\0" }, - { 0xfa1a, "\x79\x65\0" }, - { 0xfa1b, "\x79\x8f\0" }, - { 0xfa1c, "\x97\x56\0" }, - { 0xfa1d, "\x7c\xbe\0" }, - { 0xfa1e, "\x7f\xbd\0" }, - { 0xfa20, "\x86\x12\0" }, - { 0xfa22, "\x8a\xf8\0" }, - { 0xfa25, "\x90\x38\0" }, - { 0xfa26, "\x90\xfd\0" }, - { 0xfa2a, "\x98\xef\0" }, - { 0xfa2b, "\x98\xfc\0" }, - { 0xfa2c, "\x99\x28\0" }, - { 0xfa2d, "\x9d\xb4\0" }, - { 0xfb1f, "\x05\xf2\x05\xb7\0" }, - { 0xfb2a, "\x05\xe9\x05\xc1\0" }, - { 0xfb2b, "\x05\xe9\x05\xc2\0" }, - { 0xfb2c, "\x05\xe9\x05\xbc\x05\xc1\0" }, - { 0xfb2d, "\x05\xe9\x05\xbc\x05\xc2\0" }, - { 0xfb2e, "\x05\xd0\x05\xb7\0" }, - { 0xfb2f, "\x05\xd0\x05\xb8\0" }, - { 0xfb30, "\x05\xd0\x05\xbc\0" }, - { 0xfb31, "\x05\xd1\x05\xbc\0" }, - { 0xfb32, "\x05\xd2\x05\xbc\0" }, - { 0xfb33, "\x05\xd3\x05\xbc\0" }, - { 0xfb34, "\x05\xd4\x05\xbc\0" }, - { 0xfb35, "\x05\xd5\x05\xbc\0" }, - { 0xfb36, "\x05\xd6\x05\xbc\0" }, - { 0xfb38, "\x05\xd8\x05\xbc\0" }, - { 0xfb39, "\x05\xd9\x05\xbc\0" }, - { 0xfb3a, "\x05\xda\x05\xbc\0" }, - { 0xfb3b, "\x05\xdb\x05\xbc\0" }, - { 0xfb3c, "\x05\xdc\x05\xbc\0" }, - { 0xfb3e, "\x05\xde\x05\xbc\0" }, - { 0xfb40, "\x05\xe0\x05\xbc\0" }, - { 0xfb41, "\x05\xe1\x05\xbc\0" }, - { 0xfb43, "\x05\xe3\x05\xbc\0" }, - { 0xfb44, "\x05\xe4\x05\xbc\0" }, - { 0xfb46, "\x05\xe6\x05\xbc\0" }, - { 0xfb47, "\x05\xe7\x05\xbc\0" }, - { 0xfb48, "\x05\xe8\x05\xbc\0" }, - { 0xfb49, "\x05\xe9\x05\xbc\0" }, - { 0xfb4a, "\x05\xea\x05\xbc\0" }, - { 0xfb4b, "\x05\xd5\x05\xb9\0" }, - { 0xfb4c, "\x05\xd1\x05\xbf\0" }, - { 0xfb4d, "\x05\xdb\x05\xbf\0" }, - { 0xfb4e, "\x05\xe4\x05\xbf\0" } -}; - -/* - * WARNING! - * - * NO BUFFER CHECKING AHEAD! - * - */ - -static gint -e_canonical_decomposition (gunichar ch, gunichar * buf) -{ - gint len = 0; - - if (ch <= 0xffff) - { - int start = 0; - int end = sizeof (e_decomp_table) / sizeof (e_decomp_table[0]); - while (start != end) - { - int half = (start + end) / 2; - if (ch == e_decomp_table[half].ch) { - /* Found it. */ - int i; - /* We store as a double-nul terminated string. */ - for (len = 0; (e_decomp_table[half].expansion[len] || e_decomp_table[half].expansion[len + 1]); len += 2) ; - - /* We've counted twice as many bytes as there are - characters. */ - len /= 2; - - for (i = 0; i < len; i ++) { - buf[i] = (e_decomp_table[half].expansion[2 * i] << 8) | e_decomp_table[half].expansion[2 * i + 1]; - } - break; - } else if (ch > e_decomp_table[half].ch) { - if (start == half) break; - start = half; - } else { - if (end == half) break; - end = half; - } - } - } - - if (len == 0) - { - /* Not in our table. */ - *buf = ch; - len = 1; - } - - /* Supposedly following the Unicode 2.1.9 table means that the - decompositions come out in canonical order. I haven't tested - this, but we rely on it here. */ - return len; -} - -static gunichar -e_stripped_char (gunichar ch) -{ - gunichar decomp[MAX_DECOMP]; - GUnicodeType utype; - gint dlen; - - utype = g_unichar_type (ch); - - switch (utype) { - case G_UNICODE_CONTROL: - case G_UNICODE_FORMAT: - case G_UNICODE_UNASSIGNED: - case G_UNICODE_COMBINING_MARK: - /* Ignore those */ - return 0; - break; - default: - /* Convert to lowercase, fall through */ - ch = g_unichar_tolower (ch); - case G_UNICODE_LOWERCASE_LETTER: - dlen = e_canonical_decomposition (ch, decomp); - if (dlen > 0) return *decomp; - break; - } - - return 0; -} - -gchar * -e_xml_get_translated_utf8_string_prop_by_name (const xmlNode *parent, const xmlChar *prop_name) -{ - xmlChar *prop; - gchar *ret_val = NULL; - gchar *combined_name; - - g_return_val_if_fail (parent != NULL, 0); - g_return_val_if_fail (prop_name != NULL, 0); - - prop = xmlGetProp ((xmlNode *) parent, prop_name); - if (prop != NULL) { - ret_val = g_strdup (prop); - xmlFree (prop); - return ret_val; - } - - combined_name = g_strdup_printf("_%s", prop_name); - prop = xmlGetProp ((xmlNode *) parent, combined_name); - if (prop != NULL) { - ret_val = g_strdup (gettext (prop)); - xmlFree (prop); - } - g_free(combined_name); - - return ret_val; -} diff --git a/widgets/misc/e-unicode.h b/widgets/misc/e-unicode.h deleted file mode 100644 index 0a3b3ccafe..0000000000 --- a/widgets/misc/e-unicode.h +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-unicode.h - utf-8 support functions for gal - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * Lauris Kaplinski <lauris@ximian.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _E_UNICODE_H_ -#define _E_UNICODE_H_ - -#include <sys/types.h> -#include <glib.h> -#include <gtk/gtkclist.h> -#include <gtk/gtkentry.h> -#include <gtk/gtkmenu.h> -#include <gtk/gtkwidget.h> -#include <libxml/tree.h> -#include <iconv.h> - -G_BEGIN_DECLS - -#define G_UTF8_IN_GAL - -/* - * UTF-8 searching implementations - * - * e_utf8_strstrcase - case insensitive search - * e_utf8_strstrcasedecomp - case insensitive and decompositing search (i.e. accented - * letters are treated equal to their base letters, explicit accent marks (unicode - * not ascii/iso ones) are ignored). - */ - -const gchar *e_utf8_strstrcase (const gchar *haystack, - const gchar *needle); -const gchar *e_utf8_strstrcasedecomp (const gchar *haystack, - const gchar *needle); -gchar *e_utf8_from_gtk_event_key (GtkWidget *widget, - guint keyval, - const gchar *string); -gchar *e_utf8_from_iconv_string (iconv_t ic, - const gchar *string); -gchar *e_utf8_from_iconv_string_sized (iconv_t ic, - const gchar *string, - gint bytes); -gchar *e_utf8_to_iconv_string (iconv_t ic, - const gchar *string); -gchar *e_utf8_to_iconv_string_sized (iconv_t ic, - const gchar *string, - gint bytes); -gchar *e_utf8_from_charset_string (const gchar *charset, - const gchar *string); -gchar *e_utf8_from_charset_string_sized (const gchar *charset, - const gchar *string, - gint bytes); -gchar *e_utf8_to_charset_string (const gchar *charset, - const gchar *string); -gchar *e_utf8_to_charset_string_sized (const gchar *charset, - const gchar *string, - gint bytes); -gchar *e_utf8_from_gtk_string (GtkWidget *widget, - const gchar *string); -gchar *e_utf8_from_gtk_string_sized (GtkWidget *widget, - const gchar *string, - gint bytes); -gchar *e_utf8_to_gtk_string (GtkWidget *widget, - const gchar *string); -gchar *e_utf8_to_gtk_string_sized (GtkWidget *widget, - const gchar *string, - gint bytes); -gchar *e_utf8_from_locale_string (const gchar *string); -gchar *e_utf8_from_locale_string_sized (const gchar *string, - gint bytes); -gchar *e_utf8_to_locale_string (const gchar *string); -gchar *e_utf8_to_locale_string_sized (const gchar *string, - gint bytes); -gboolean e_utf8_is_ascii (const gchar *string); -/* - * These are simple wrappers that save us some typing - */ - -/* NB! This return newly allocated string, not const as gtk+ one */ -gchar *e_utf8_gtk_entry_get_text (GtkEntry *entry); -void e_utf8_gtk_entry_set_text (GtkEntry *entry, - const gchar *text); -gchar *e_utf8_gtk_editable_get_text (GtkEditable *editable); -void e_utf8_gtk_editable_set_text (GtkEditable *editable, - const gchar *text); -gchar *e_utf8_gtk_editable_get_chars (GtkEditable *editable, - gint start, - gint end); -void e_utf8_gtk_editable_insert_text (GtkEditable *editable, - const gchar *text, - gint length, - gint *position); -GtkWidget *e_utf8_gtk_menu_item_new_with_label (GtkMenu *menu, - const gchar *label); -void e_utf8_gtk_clist_set_text (GtkCList *clist, - gint row, - gint col, - const gchar *text); -gint e_utf8_gtk_clist_append (GtkCList *clist, - gchar *text[]); -gchar *e_utf8_xml1_decode (const gchar *text); -gchar *e_utf8_xml1_encode (const gchar *text); -gint e_unichar_to_utf8 (gint c, - gchar *outbuf); -gchar *e_unicode_get_utf8 (const gchar *text, - gunichar *out); -guint32 gdk_keyval_to_unicode (guint keysym); -gchar *e_xml_get_translated_utf8_string_prop_by_name (const xmlNode *parent, - const xmlChar *prop_name); - -G_END_DECLS - -#endif - - diff --git a/widgets/misc/e-url-entry.h b/widgets/misc/e-url-entry.h index 3cf98d7b8c..93b2ff28c0 100644 --- a/widgets/misc/e-url-entry.h +++ b/widgets/misc/e-url-entry.h @@ -24,10 +24,6 @@ #ifndef _E_URL_ENTRY_H_ #define _E_URL_ENTRY_H_ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - #include <gtk/gtk.h> #ifdef __cplusplus @@ -36,10 +32,10 @@ extern "C" { #endif /* __cplusplus */ #define E_TYPE_URL_ENTRY (e_url_entry_get_type ()) -#define E_URL_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_URL_ENTRY, EUrlEntry)) -#define E_URL_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_URL_ENTRY, EUrlEntryClass)) -#define E_IS_URL_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_URL_ENTRY)) -#define E_IS_URL_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_URL_ENTRY)) +#define E_URL_ENTRY(obj) (GTK_CHECK_CAST ((obj), E_TYPE_URL_ENTRY, EUrlEntry)) +#define E_URL_ENTRY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_URL_ENTRY, EUrlEntryClass)) +#define E_IS_URL_ENTRY(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_URL_ENTRY)) +#define E_IS_URL_ENTRY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_URL_ENTRY)) typedef struct _EUrlEntry EUrlEntry; diff --git a/widgets/misc/gal-categories.glade b/widgets/misc/gal-categories.glade deleted file mode 100644 index 98286545b3..0000000000 --- a/widgets/misc/gal-categories.glade +++ /dev/null @@ -1,168 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd" > - -<glade-interface> - <widget class="GtkDialog" id="categories"> - <property name="visible">no</property> - <property name="title" translatable="yes">categories</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="modal">no</property> - <property name="allow_shrink">no</property> - <property name="allow_grow">yes</property> - <property name="window-position">GTK_WIN_POS_NONE</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox1"> - <property name="homogeneous">no</property> - <property name="spacing">8</property> - <property name="visible">yes</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area1"> - <property name="layout_style">GTK_BUTTONBOX_END</property> - <property name="spacing">8</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkButton" id="button3"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="visible">yes</property> - <property name="label">gtk-ok</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button4"> - <property name="can_default">yes</property> - <property name="can_focus">yes</property> - <property name="visible">yes</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">yes</property> - <property name="use_underline">yes</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">no</property> - <property name="fill">yes</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table-categories"> - <property name="homogeneous">no</property> - <property name="row_spacing">0</property> - <property name="column_spacing">0</property> - <property name="n-rows">5</property> - <property name="n-columns">1</property> - <property name="visible">yes</property> - - <child> - <widget class="GtkEntry" id="entry-categories"> - <property name="can_focus">yes</property> - <property name="editable">yes</property> - <property name="text" translatable="yes"></property> - <property name="max-length">0</property> - <property name="visibility">yes</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-header"> - <property name="label" translatable="yes">Item(s) belong to these _categories:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">entry-categories</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label2"> - <property name="label" translatable="yes">_Available Categories:</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">no</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="visible">yes</property> - <property name="use_underline">yes</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="button-ecmld"> - <property name="can_focus">yes</property> - <property name="label" translatable="yes">Edit Master Category List...</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="visible">yes</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="x_padding">0</property> - <property name="y_padding">0</property> - <property name="x_options">expand|fill</property> - <property name="y_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">4</property> - <property name="expand">yes</property> - <property name="fill">yes</property> - </packing> - </child> - </widget> -</glade-interface> diff --git a/widgets/misc/pixmaps/.cvsignore b/widgets/misc/pixmaps/.cvsignore deleted file mode 100644 index 3dda72986f..0000000000 --- a/widgets/misc/pixmaps/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile.in -Makefile diff --git a/widgets/misc/pixmaps/cursor_cross.xpm b/widgets/misc/pixmaps/cursor_cross.xpm deleted file mode 100644 index cf9d0aca33..0000000000 --- a/widgets/misc/pixmaps/cursor_cross.xpm +++ /dev/null @@ -1,38 +0,0 @@ -/* XPM */ -static char * cursor_cross_xpm[] = { -"32 32 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ....... ", -" .+++++.. ", -" .+++++.. ", -" .+++++.. ", -" .+++++.. ", -" ......+++++...... ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" ......+++++....... ", -" .....+++++....... ", -" .+++++.. ", -" .+++++.. ", -" .+++++.. ", -" ........ ", -" ....... ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/pixmaps/cursor_hand_closed.xpm b/widgets/misc/pixmaps/cursor_hand_closed.xpm deleted file mode 100644 index 61a6de4b88..0000000000 --- a/widgets/misc/pixmaps/cursor_hand_closed.xpm +++ /dev/null @@ -1,38 +0,0 @@ -/* XPM */ -static char * cursor_hand_closed_xpm[] = { -"32 32 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" ", -" ", -" ", -" ", -" .. ", -" ..++... ", -" .+++++++.. ", -" .+++++++++. ", -" ...+++++++++. ", -" .++.+++++++++. ", -" .++++++++++++. ", -" .+++++++++++. ", -" .++++++++++. ", -" .+++++++++. ", -" .+++++++. ", -" .++++++. ", -" .++++++. ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/pixmaps/cursor_hand_open.xpm b/widgets/misc/pixmaps/cursor_hand_open.xpm deleted file mode 100644 index 048acc8054..0000000000 --- a/widgets/misc/pixmaps/cursor_hand_open.xpm +++ /dev/null @@ -1,38 +0,0 @@ -/* XPM */ -static char * cursor_hand_open_xpm[] = { -"32 32 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" ", -" .. ", -" .. .++... ", -" .++..++.++. ", -" .++..++.++. . ", -" .++.++.++..+. ", -" .++.++.++.++. ", -" .. .+++++++.++. ", -" .++..++++++++++. ", -" .+++.+++++++++. ", -" .++++++++++++. ", -" .+++++++++++. ", -" .++++++++++. ", -" .+++++++++. ", -" .+++++++. ", -" .++++++. ", -" .++++++. ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/pixmaps/cursor_zoom_in.xpm b/widgets/misc/pixmaps/cursor_zoom_in.xpm deleted file mode 100644 index 1caf9e3e2a..0000000000 --- a/widgets/misc/pixmaps/cursor_zoom_in.xpm +++ /dev/null @@ -1,37 +0,0 @@ -/* XPM */ -static char * cursor_zoom_in_xpm[] = { -"32 32 2 1", -" c None", -". c #000000", -" ", -" ", -" ", -" ", -" ", -" ", -" ...... ", -" .. .. ", -" .. .. ", -" . . ", -" . ... . ", -" . ... . ", -" . ....... . ", -" . ....... . ", -" . ... . ", -" . ... .. ", -" .. . . ", -" .. . . . ", -" ........ . . ", -" ..... . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . ", -" . . ", -" .. ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/pixmaps/cursor_zoom_out.xpm b/widgets/misc/pixmaps/cursor_zoom_out.xpm deleted file mode 100644 index af1b698521..0000000000 --- a/widgets/misc/pixmaps/cursor_zoom_out.xpm +++ /dev/null @@ -1,37 +0,0 @@ -/* XPM */ -static char * cursor_zoom_out_xpm[] = { -"32 32 2 1", -" c None", -". c #000000", -" ", -" ", -" ", -" ", -" ", -" ", -" ...... ", -" .. .. ", -" .. .. ", -" . . ", -" . . ", -" . . ", -" . ....... . ", -" . ....... . ", -" . . ", -" . .. ", -" .. . . ", -" .. . . . ", -" ........ . . ", -" ..... . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . ", -" . . ", -" .. ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/test-color.c b/widgets/misc/test-color.c deleted file mode 100644 index 364e0644de..0000000000 --- a/widgets/misc/test-color.c +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * test-color.c - * Copyright 2000, 2001, Ximian, Inc. - * - * Authors: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License, version 2, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <config.h> -#include <gal/util/e-i18n.h> -#include <gnome.h> -#include "widget-color-combo.h" -#include "color-palette.h" -#include "e-colors.h" -#include "pixmaps/cursor_hand_open.xpm" - -/* To compile (from src/widgets): - -gcc -I.. -I../.. -L. -Wall -o tester tester.c ../color.c `gnome-config --cflags --libs gnome gnomeui` -lwidgets - -*/ - -gint -main ( gint argc, gchar* argv[] ) -{ - GtkWidget * dialog; - GtkWidget * T; - ColorGroup *cg; - - gnome_program_init ("tester", "1.0", - LIBGNOMEUI_MODULE, - argc, argv, NULL); - - dialog = gnome_dialog_new ("TESTER", GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, NULL); - - cg = color_group_fetch ("fore_color_group", dialog); - T = color_palette_new ("Color Palette", NULL, cg); - - gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ), - T, TRUE, TRUE, 5); - gtk_widget_show_all (T); - - cg = color_group_fetch ("fore_color_group", dialog); - T = color_combo_new ( - gdk_pixbuf_new_from_xpm_data ((char const **)cursor_hand_open_xpm), - _("Automatic"), &e_black, cg); - gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ), - T, TRUE, TRUE, 5); - gtk_widget_show_all (T); - - cg = color_group_fetch ("back_color_group", dialog); - T = color_combo_new ( - gdk_pixbuf_new_from_xpm_data ((char const **)cursor_hand_open_xpm), - _("Automatic"), &e_black, cg); - gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ), - T, TRUE, TRUE, 5); - gtk_widget_show_all (T); - - gnome_dialog_run_and_close ( GNOME_DIALOG (dialog) ); - return 0; -} |