diff options
Diffstat (limited to 'widgets/misc')
40 files changed, 0 insertions, 10516 deletions
diff --git a/widgets/misc/e-canvas-background.c b/widgets/misc/e-canvas-background.c deleted file mode 100644 index 0e57feff4e..0000000000 --- a/widgets/misc/e-canvas-background.c +++ /dev/null @@ -1,496 +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_boxed (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_boxed (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_boxed ("fill_color_gdk", - _( "GDK fill color" ), - _( "GDK fill color" ), - GDK_TYPE_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 8be100fb4a..0000000000 --- a/widgets/misc/e-canvas.c +++ /dev/null @@ -1,1096 +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> -#include <gtk/gtkimmulticontext.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; - canvas->im_context = gtk_im_multicontext_new (); - 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; - } - - if (canvas->im_context) { - g_object_unref (canvas->im_context); - canvas->im_context = 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); - - gtk_im_context_focus_in (ecanvas->im_context); - - 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); - - gtk_im_context_focus_out (ecanvas->im_context); - - 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) -{ - ECanvas *ecanvas = E_CANVAS (widget); - - 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); - - gtk_im_context_set_client_window (ecanvas->im_context, widget->window); -} - -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; - } - - gtk_im_context_set_client_window (ecanvas->im_context, widget->window); - - 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 092833430b..0000000000 --- a/widgets/misc/e-canvas.h +++ /dev/null @@ -1,157 +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 <gtk/gtkimcontext.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; - - /* Input context for dead key support */ - GtkIMContext *im_context; - - 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-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-gui-utils.c b/widgets/misc/e-gui-utils.c deleted file mode 100644 index 886fb3d7ca..0000000000 --- a/widgets/misc/e-gui-utils.c +++ /dev/null @@ -1,238 +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) { - 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-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 cacf3848ba..0000000000 --- a/widgets/misc/e-reflow.c +++ /dev/null @@ -1,1506 +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; - - if (reflow->sorter) { - g_object_unref (reflow->sorter); - reflow->sorter = 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-unicode.c b/widgets/misc/e-unicode.c deleted file mode 100644 index d7bd33caa7..0000000000 --- a/widgets/misc/e-unicode.c +++ /dev/null @@ -1,2055 +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 <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_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); -} - -/* - * 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 12c9ef3aa2..0000000000 --- a/widgets/misc/e-unicode.h +++ /dev/null @@ -1,115 +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_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); -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/gal-categories.glade b/widgets/misc/gal-categories.glade deleted file mode 100644 index 1ecb302f42..0000000000 --- a/widgets/misc/gal-categories.glade +++ /dev/null @@ -1,166 +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="border_width">6</property> - <property name="title" translatable="yes">categories</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="has_separator">True</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area1"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - - <child> - <widget class="GtkButton" id="button3"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">0</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button4"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">0</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table-categories"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="n_rows">5</property> - <property name="n_columns">1</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkEntry" id="entry-categories"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</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="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label-header"> - <property name="visible">True</property> - <property name="label" translatable="yes">Item(s) belong to these _categories:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</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> - </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_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Available Categories:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</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_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="button-ecmld"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Edit Master Category List...</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</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="y_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </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; -} |