diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-02-24 14:51:23 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-02-24 14:51:23 +0800 |
commit | 7699b8996aa2d9ae3fea0e94981637c98e89a273 (patch) | |
tree | f4321790cd8c8619babfac9e2d4f38ca621d7e2d /widgets/table/e-table.c | |
parent | 6b338ae8ecd1332f574e33620e0765a16aab03a3 (diff) | |
download | gsoc2013-evolution-7699b8996aa2d9ae3fea0e94981637c98e89a273.tar gsoc2013-evolution-7699b8996aa2d9ae3fea0e94981637c98e89a273.tar.gz gsoc2013-evolution-7699b8996aa2d9ae3fea0e94981637c98e89a273.tar.bz2 gsoc2013-evolution-7699b8996aa2d9ae3fea0e94981637c98e89a273.tar.lz gsoc2013-evolution-7699b8996aa2d9ae3fea0e94981637c98e89a273.tar.xz gsoc2013-evolution-7699b8996aa2d9ae3fea0e94981637c98e89a273.tar.zst gsoc2013-evolution-7699b8996aa2d9ae3fea0e94981637c98e89a273.zip |
This were moved to widgets/e-text/ a while ago but never removed. They
2000-02-24 Christopher James Lahey <clahey@helixcode.com>
* widgets/e-text.c, widgets/e-text.h, e-text-event-processor.c,
e-text-event-processor.h, e-text-event-processor-emacs-like.c,
e-text-event-processor-emacs-like.h,
e-text-event-processor-types.h: This were moved to widgets/e-text/
a while ago but never removed. They have now been removed.
* widgets/e-text/e-text.c, widgets/e-text/e-text.h: Removed some
warnings from this file. Made tooltips disappear when you're
finished with them.
* widgets/e-minicard/test-reflow.c,
widgets/e-minicard/test-minicard.c,
widgets/e-minicard/test-minicard-label.c: Commented out unused
about_callback functions.
* widgets/e-minicard/e-reflow.c: Made e-reflow pass an EFocus to
its e-minicard children.
* widgets/e-minicard/e-minicard.c: Made e-minicard take and return
an EFocus for its "has_focus" argument. This makes shift-tab work properly.
* widgets/e-minicard/e-minicard-label.c: Made e-minicard-label take and return
an EFocus for its "has_focus" argument. Made the font that
e-minicard-label uses only be allocated once.
* e-util/e-canvas-utils.h: Fixed the comment at the top and added
#ifndef __E_CANVAS_UTILS__.
* e-util/Makefile.am: Added e-xml-utils.c and
e-xml-utils.h.
* e-util/e-xml-utils.h, e-util/e-xml-utils.c: Added files for some
xml utilities.
* e-util/e-util.h: Added type EFocus which describes which
direction the focus will be coming from.
in mail:
2000-02-24 Christopher James Lahey <clahey@helixcode.com>
* message-list.c: Changed this to not use the "x" and "y"
arguments to e-table-item.
in widgets/e-table:
2000-02-24 Christopher James Lahey <clahey@helixcode.com>
* e-table-subset-variable.c, e-table-subset-variable.h: A new
model which is a subset, but you can add and remove rows.
* test-table.c: Added a thaw method for use with the
e-table-subset (emits model_changed.) Adapted to the changes to
e_table_item. Properly parse headers. Adapted to the changes to
e_table, including creating example xml spec data.
* test-cols.c, test-check.c: Added a thaw method for use with the
e-table-subset (emits model_changed.) Adapted to the changes to
e_table_item.
* e-table.c, e-table.h: Reworked e-table to use the ETable
grouping system. The only difference for the interface is that
instead of passing in a column_spec and a grouping_spec, you pass
in a single string that is an xml format that includes both pieces
of information.
* e-table-subset.h: Added rules for emacs to do correct
indentation.
* e-table-subset.c: Implemented freezing. No signals are emitted
while frozen and "model_changed" is emitted when thawed.
* e-table-sorted.h: ETableSortedClass has ETableSubset as its
parent object instead of ETableSubsetClass. Fixed this.
* e-table-simple.c, e-table-simple.h: Implemented the thaw method.
Use of simple now requires an extra argument (the thaw method.)
* e-table-model.h, e-table-model.c: Added e_table_model_freeze and
e_table_model_thaw.
* e-table-item.h, e-table-item.c: Reworked this a bit to make it
provide some things the new group system needed and to make
inter-item keyboard focus work. Changed the external interface
only in the list of arguments it recognizes and signals it emits.
Instead of "x" and "y", you have to use
e_canvas_item_move_absolute and instead of emitting a
"height_changed" signal, it emits a "resize" signal. There's new
"has_focus", "width", and "height" arguments and a function to get
the currently focused column.
* e-table-header-item.c: Got rid of some warnings here. Changed
the
* e-table-group-leaf.h, e-table-group-leaf.c,
e-table-group-container.h, e-table-group-container.c: New types to
make e_table_group work properly.
* e-table-group.h, e-table-group.c: Completely reworked e-table
grouping. e-table-group now uses a hierarchical structure.
* e-cell.h: Added e_cell_print. This doesn't work yet.
* e-cell.c: Made e_cell_realize exist. (It was improperly named
e_cell_view_realize in the .c.)
* e-cell-text.c: Made the blinking cursor disappear properly.
* check-filled.xpm, check-empty.xpm: Made these const char *[]
instead of char *[] to avoid compiler warnings.
* Makefile.am: Added e-table-group-container.c,
e-table-group-container.h, e-table-group-leaf.c,
e-table-group-leaf.h, e-table-subset-variable.c,
e-table-subset-variable.h.
svn path=/trunk/; revision=1915
Diffstat (limited to 'widgets/table/e-table.c')
-rw-r--r-- | widgets/table/e-table.c | 115 |
1 files changed, 87 insertions, 28 deletions
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 46531113e4..551ef52227 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -1,5 +1,6 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * E-table-view.c: A graphical view of a Table. + * E-table.c: A graphical view of a Table. * * Author: * Miguel de Icaza (miguel@gnu.org) @@ -16,7 +17,9 @@ #include <stdio.h> #include <libgnomeui/gnome-canvas.h> #include <gtk/gtksignal.h> +#include <gnome-xml/parser.h> #include "e-util/e-util.h" +#include "e-util/e-xml-utils.h" #include "e-table.h" #include "e-table-header-item.h" #include "e-table-subset.h" @@ -40,8 +43,6 @@ et_destroy (GtkObject *object) gtk_object_unref (GTK_OBJECT (et->full_header)); gtk_object_unref (GTK_OBJECT (et->header)); - g_free (et->group_spec); - (*e_table_parent_class->destroy)(object); } @@ -56,19 +57,16 @@ e_table_init (GtkObject *object) } static ETableHeader * -e_table_make_header (ETable *e_table, ETableHeader *full_header, const char *cols) +e_table_make_header (ETable *e_table, ETableHeader *full_header, xmlNode *xmlColumns) { ETableHeader *nh; - char *copy = alloca (strlen (cols) + 1); - char *p, *state; + xmlNode *column; const int max_cols = e_table_header_count (full_header); nh = e_table_header_new (); - strcpy (copy, cols); - while ((p = strtok_r (copy, ",", &state)) != NULL){ - int col = atoi (p); + for (column = xmlColumns->childs; column; column = column->next) { + int col = atoi (column->childs->content); - copy = NULL; if (col >= max_cols) continue; @@ -113,6 +111,7 @@ e_table_setup_header (ETable *e_table) } +#if 0 typedef struct { void *value; GArray *array; @@ -201,7 +200,7 @@ e_table_make_subtables (ETableModel *model, GArray *groups) return (ETableModel **) tables; } - +#endif typedef struct _Node Node; struct _Node { @@ -212,7 +211,7 @@ struct _Node { guint is_leaf:1; }; - +#if 0 static Node * leaf_new (GnomeCanvasItem *table_item, ETableModel *table_model, Node *parent) { @@ -335,8 +334,9 @@ e_table_create_nodes (ETable *e_table, ETableModel *model, ETableHeader *header, groups = e_table_create_groups (model, key_col, ecol->compare); tables = e_table_make_subtables (e_table->model, groups); e_table_destroy_groups (groups); - - group_item = e_table_group_new (root, ecol, TRUE, parent == NULL); + group_item = gnome_canvas_item_new (root, + e_table_group_get_type(), + "columns", ecol, TRUE, parent == NULL); group = node_new (group_item, model, parent); for (i = 0; tables [i] != NULL; i++){ @@ -347,8 +347,9 @@ e_table_create_nodes (ETable *e_table, ETableModel *model, ETableHeader *header, GnomeCanvasItem *item_leaf_header; Node *leaf_header; + /* FIXME *//* item_leaf_header = e_table_group_new ( - GNOME_CANVAS_GROUP (group_item), ecol, TRUE, FALSE); + GNOME_CANVAS_GROUP (group_item), ecol, TRUE, FALSE);*/ leaf_header = node_new (item_leaf_header, tables [i], group); e_table_create_leaf (e_table, tables [i], leaf_header); @@ -424,6 +425,14 @@ static GnomeCanvasClass *e_table_canvas_parent_class; static void e_table_canvas_realize (GtkWidget *widget) { +#if 0 + GnomeCanvasItem *group_item; + + group_item = gnome_canvas_item_new (root, + e_table_group_get_type(), + "header", E_TABLE, TRUE, parent == NULL); + + ETableCanvas *e_table_canvas = (ETableCanvas *) widget; ETable *e_table = e_table_canvas->e_table; int *groups; @@ -433,6 +442,8 @@ e_table_canvas_realize (GtkWidget *widget) groups = group_spec_to_desc (e_table->group_spec); + + leaf = e_table_create_nodes ( e_table, e_table->model, e_table->header, GNOME_CANVAS_GROUP (e_table->root), 0, groups); @@ -440,6 +451,7 @@ e_table_canvas_realize (GtkWidget *widget) if (groups) g_free (groups); +#endif } static void @@ -496,33 +508,75 @@ e_table_canvas_new (ETable *e_table) return GNOME_CANVAS (e_table_canvas); } +#endif static void -table_canvas_size_alocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_table) +table_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_table) { + gdouble height; + gdouble width; + gtk_object_get(GTK_OBJECT(e_table->group), + "height", &height, + NULL); gnome_canvas_set_scroll_region ( GNOME_CANVAS (e_table->table_canvas), - 0, 0, alloc->width, alloc->height); + 0, 0, alloc->width, MAX(height, alloc->height)); + width = alloc->width; + gtk_object_set(GTK_OBJECT(e_table->group), + "width", width, + NULL); } static void -e_table_setup_table (ETable *e_table) +e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *header, ETableModel *model, xmlNode *xml_grouping) { - e_table->table_canvas = e_table_canvas_new (e_table); + e_table->table_canvas = GNOME_CANVAS(gnome_canvas_new ()); gtk_signal_connect ( GTK_OBJECT (e_table->table_canvas), "size_allocate", - GTK_SIGNAL_FUNC (table_canvas_size_alocate), e_table); + GTK_SIGNAL_FUNC (table_canvas_size_allocate), e_table); gtk_widget_show (GTK_WIDGET (e_table->table_canvas)); gtk_table_attach ( GTK_TABLE (e_table), GTK_WIDGET (e_table->table_canvas), 0, 1, 1, 2, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); + + e_table->group = e_table_group_new(GNOME_CANVAS_GROUP(e_table->table_canvas->root), + full_header, + header, + model, + xml_grouping->childs); + +} + +static void +e_table_fill_table (ETable *e_table, ETableModel *model) +{ + int count; + int i; + count = e_table_model_row_count(model); + gtk_object_set(GTK_OBJECT(e_table->group), + "frozen", TRUE, + NULL); + for ( i = 0; i < count; i++ ) { + e_table_group_add(e_table->group, i); + } + gtk_object_set(GTK_OBJECT(e_table->group), + "frozen", FALSE, + NULL); } void e_table_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm, - const char *cols_spec, const char *group_spec) + const char *spec) { + xmlDoc *xmlSpec; + xmlNode *xmlRoot; + xmlNode *xmlColumns; + xmlNode *xmlGrouping; + + char *copy; + copy = g_strdup(spec); + GTK_TABLE (e_table)->homogeneous = FALSE; gtk_table_resize (GTK_TABLE (e_table), 1, 2); @@ -532,24 +586,29 @@ e_table_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm, e_table->model = etm; gtk_object_ref (GTK_OBJECT (etm)); + + xmlSpec = xmlParseMemory(copy, strlen(copy) + 1); + e_table->specification = xmlSpec; - e_table->header = e_table_make_header (e_table, full_header, cols_spec); + xmlRoot = xmlDocGetRootElement(xmlSpec); + xmlColumns = e_xml_get_child_by_name(xmlRoot, "columns-shown"); + xmlGrouping = e_xml_get_child_by_name(xmlRoot, "grouping"); + + e_table->header = e_table_make_header (e_table, full_header, xmlColumns); e_table_setup_header (e_table); - e_table_setup_table (e_table); - - e_table->group_spec = g_strdup (group_spec); - + e_table_setup_table (e_table, full_header, e_table->header, etm, xmlGrouping); + e_table_fill_table (e_table, etm); } GtkWidget * -e_table_new (ETableHeader *full_header, ETableModel *etm, const char *cols_spec, const char *group_spec) +e_table_new (ETableHeader *full_header, ETableModel *etm, const char *spec) { ETable *e_table; e_table = gtk_type_new (e_table_get_type ()); - e_table_construct (e_table, full_header, etm, cols_spec, group_spec); + e_table_construct (e_table, full_header, etm, spec); return (GtkWidget *) e_table; } |