aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Meeks <mmeeks@src.gnome.org>2000-03-28 05:28:57 +0800
committerMichael Meeks <mmeeks@src.gnome.org>2000-03-28 05:28:57 +0800
commite3219d0bb2d2b1baac480b95b57bfeacf8afa777 (patch)
tree47e9a95538584675b1418ee143dbc5a3ecb9f75b
parentf4f97585105ad09ea539905f6b430e55d5a7cfbb (diff)
downloadgsoc2013-evolution-e3219d0bb2d2b1baac480b95b57bfeacf8afa777.tar
gsoc2013-evolution-e3219d0bb2d2b1baac480b95b57bfeacf8afa777.tar.gz
gsoc2013-evolution-e3219d0bb2d2b1baac480b95b57bfeacf8afa777.tar.bz2
gsoc2013-evolution-e3219d0bb2d2b1baac480b95b57bfeacf8afa777.tar.lz
gsoc2013-evolution-e3219d0bb2d2b1baac480b95b57bfeacf8afa777.tar.xz
gsoc2013-evolution-e3219d0bb2d2b1baac480b95b57bfeacf8afa777.tar.zst
gsoc2013-evolution-e3219d0bb2d2b1baac480b95b57bfeacf8afa777.zip
Fix nasty rendering bugs,
Implement bbox calcs for e-tabel-item Clean style lots svn path=/trunk/; revision=2194
-rw-r--r--widgets/e-table/ChangeLog8
-rw-r--r--widgets/e-table/e-table-example-1.c23
-rw-r--r--widgets/e-table/e-table-group-container.c286
-rw-r--r--widgets/e-table/e-table-item.c95
-rw-r--r--widgets/e-table/e-table.c167
-rw-r--r--widgets/e-table/e-table.h2
-rw-r--r--widgets/table/e-table-example-1.c23
-rw-r--r--widgets/table/e-table-group-container.c286
-rw-r--r--widgets/table/e-table-item.c95
-rw-r--r--widgets/table/e-table.c167
-rw-r--r--widgets/table/e-table.h2
11 files changed, 614 insertions, 540 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 585f3cd3ee..bba0fad29c 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,3 +1,11 @@
+2000-03-27 Michael Meeks <michael@helixcode.com>
+
+ * e-table-item.c (eti_update): try and fix the convoluted logic.
+ (eti_bounds): Implement; should fix the re-draw bugs.
+
+ * e-table-group-container.c: kill many redundant prototypes,
+ stylistic cleans.
+
2000-03-26 Matias Mutchinick <matias@seul.org>
* e-cell-toggle.c (etog_draw): Removed extra code that computed
diff --git a/widgets/e-table/e-table-example-1.c b/widgets/e-table/e-table-example-1.c
index 413fde3aba..c1abc70c93 100644
--- a/widgets/e-table/e-table-example-1.c
+++ b/widgets/e-table/e-table-example-1.c
@@ -77,7 +77,7 @@ The headers will be hard coded, as will be the example data.
<grouping> <leaf column=\"1\" ascending=\"1\"/> </grouping> \
</ETableSpecification>"
-char *headers[COLS] = {
+char *headers [COLS] = {
"Email",
"Full Name",
"Address",
@@ -91,7 +91,7 @@ char *headers[COLS] = {
3 Phone
*/
-char *table_data[ROWS][COLS];
+char *table_data [ROWS] [COLS];
/*
* ETableSimple callbacks
@@ -119,15 +119,15 @@ my_row_count (ETableModel *etc, void *data)
static void *
my_value_at (ETableModel *etc, int col, int row, void *data)
{
- return (void *) table_data [row][col];
+ return (void *) table_data [row] [col];
}
/* This function sets the value at a particular point in our ETableModel. */
static void
my_set_value_at (ETableModel *etc, int col, int row, const void *val, void *data)
{
- g_free (table_data [row][col]);
- table_data [row][col] = g_strdup (val);
+ g_free (table_data [row] [col]);
+ table_data [row] [col] = g_strdup (val);
}
/* This function returns whether a particular cell is editable. */
@@ -141,14 +141,14 @@ my_is_cell_editable (ETableModel *etc, int col, int row, void *data)
static void *
my_duplicate_value (ETableModel *etc, int col, const void *value, void *data)
{
- return g_strdup(value);
+ return g_strdup (value);
}
/* This function frees the value passed to it. */
static void
my_free_value (ETableModel *etc, int col, void *value, void *data)
{
- g_free(value);
+ g_free (value);
}
/* This function is for when the model is unfrozen. This can mostly
@@ -160,7 +160,7 @@ my_thaw (ETableModel *etc, void *data)
/* We create a window containing our new table. */
static void
-create_table()
+create_table (void)
{
GtkWidget *e_table, *window, *frame;
ECell *cell_left_just;
@@ -170,9 +170,8 @@ create_table()
/* First we fill in the simple data. */
for ( i = 0; i < ROWS; i++ ) {
- for ( j = 0; j < COLS; j++ ) {
- table_data[i][j] = g_strdup("");
- }
+ for ( j = 0; j < COLS; j++ )
+ table_data [i] [j] = g_strdup ("");
}
/* Next we create our model. This uses the functions we defined
earlier. */
@@ -201,7 +200,7 @@ create_table()
/* Next we create a column object for each view column and add
them to the header. We don't create a column object for
the importance column since it will not be shown. */
- for (i = 0; i < COLS; i++){
+ for (i = 0; i < COLS; i++) {
/* Create the column. */
ETableCol *ecol = e_table_col_new (
i, headers [i],
diff --git a/widgets/e-table/e-table-group-container.c b/widgets/e-table/e-table-group-container.c
index ebe832c29f..c69dbcd93a 100644
--- a/widgets/e-table/e-table-group-container.c
+++ b/widgets/e-table/e-table-group-container.c
@@ -5,7 +5,7 @@
* Author:
* Miguel de Icaza (miguel@gnu.org()
*
- * Copyright 1999, Helix Code, Inc.
+ * Copyright 1999, 2000 Helix Code, Inc.
*/
#include <config.h>
@@ -36,20 +36,6 @@ enum {
ARG_FROZEN
};
-static void etgc_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void etgc_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-
-static int etgc_event (GnomeCanvasItem *item, GdkEvent *event);
-static void etgc_realize (GnomeCanvasItem *item);
-static void etgc_unrealize (GnomeCanvasItem *item);
-
-static void etgc_add (ETableGroup *etg, gint row);
-static gboolean etgc_remove (ETableGroup *etg, gint row);
-static void etgc_increment (ETableGroup *etg, gint position, gint amount);
-static void etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col);
-
-static void etgc_reflow (GnomeCanvasItem *item, gint flags);
-
typedef struct {
ETableGroup *child;
void *key;
@@ -59,14 +45,17 @@ typedef struct {
} ETableGroupContainerChildNode;
static void
-e_table_group_container_child_node_free(ETableGroupContainer *etgc, ETableGroupContainerChildNode *child_node)
+e_table_group_container_child_node_free(ETableGroupContainer *etgc,
+ ETableGroupContainerChildNode *child_node)
{
- ETableGroup *etg = E_TABLE_GROUP(etgc);
+ ETableGroup *etg = E_TABLE_GROUP (etgc);
ETableGroup *child = child_node->child;
- gtk_object_destroy(GTK_OBJECT(child));
- e_table_model_free_value(etg->model, etgc->ecol->col_idx, child_node->key);
- gtk_object_destroy(GTK_OBJECT(child_node->text));
- gtk_object_destroy(GTK_OBJECT(child_node->rect));
+
+ gtk_object_destroy (GTK_OBJECT (child));
+ e_table_model_free_value (etg->model, etgc->ecol->col_idx,
+ child_node->key);
+ gtk_object_destroy (GTK_OBJECT (child_node->text));
+ gtk_object_destroy (GTK_OBJECT (child_node->rect));
}
static void
@@ -74,13 +63,16 @@ e_table_group_container_list_free(ETableGroupContainer *etgc)
{
ETableGroupContainerChildNode *child_node;
GList *list;
- if ( etgc->idle )
- g_source_remove( etgc->idle );
- for ( list = etgc->children; list; list = g_list_next(list) ) {
+
+ if (etgc->idle)
+ g_source_remove (etgc->idle);
+
+ for (list = etgc->children; list; list = g_list_next (list)) {
child_node = (ETableGroupContainerChildNode *) list->data;
- e_table_group_container_child_node_free(etgc, child_node);
+ e_table_group_container_child_node_free (etgc, child_node);
}
- g_list_free(etgc->children);
+
+ g_list_free (etgc->children);
}
static void
@@ -213,7 +205,7 @@ e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContaine
etgc->font = gdk_font_load ("lucidasans-10");
if (!etgc->font){
- etgc->font = GTK_WIDGET(GNOME_CANVAS_ITEM(etgc)->canvas)->style->font;
+ etgc->font = GTK_WIDGET (GNOME_CANVAS_ITEM (etgc)->canvas)->style->font;
gdk_font_ref (etgc->font);
}
@@ -257,9 +249,10 @@ e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContaine
}
ETableGroup *
-e_table_group_container_new (GnomeCanvasGroup *parent, ETableHeader *full_header,
- ETableHeader *header,
- ETableModel *model, ETableCol *ecol, int ascending, xmlNode *child_rules)
+e_table_group_container_new (GnomeCanvasGroup *parent, ETableHeader *full_header,
+ ETableHeader *header,
+ ETableModel *model, ETableCol *ecol,
+ int ascending, xmlNode *child_rules)
{
ETableGroupContainer *etgc;
@@ -378,9 +371,9 @@ etgc_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags
GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->update (item, affine, clip_path, flags);
- if ( etgc->need_resize ) {
+ if (etgc->need_resize) {
- if (!etgc->transparent){
+ if (!etgc->transparent) {
int current_width, current_height;
etgc_dim (etgc, &current_width, &current_height);
@@ -420,48 +413,52 @@ etgc_event (GnomeCanvasItem *item, GdkEvent *event)
event->key.keyval == GDK_KP_Tab ||
event->key.keyval == GDK_ISO_Left_Tab) {
change_focus = TRUE;
- use_col = TRUE;
- start_col = (event->key.state & GDK_SHIFT_MASK) ? -1 : 0;
- direction = (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START;
+ use_col = TRUE;
+ start_col = (event->key.state & GDK_SHIFT_MASK) ? -1 : 0;
+ direction = (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START;
} else if (event->key.keyval == GDK_Left ||
event->key.keyval == GDK_KP_Left) {
change_focus = TRUE;
- use_col = TRUE;
- start_col = -1;
- direction = E_FOCUS_END;
+ use_col = TRUE;
+ start_col = -1;
+ direction = E_FOCUS_END;
} else if (event->key.keyval == GDK_Right ||
event->key.keyval == GDK_KP_Right) {
change_focus = TRUE;
- use_col = TRUE;
+ use_col = TRUE;
start_col = 0;
direction = E_FOCUS_START;
} else if (event->key.keyval == GDK_Down ||
event->key.keyval == GDK_KP_Down) {
change_focus = TRUE;
- use_col = FALSE;
- direction = E_FOCUS_START;
+ use_col = FALSE;
+ direction = E_FOCUS_START;
} else if (event->key.keyval == GDK_Up ||
event->key.keyval == GDK_KP_Up) {
change_focus = TRUE;
- use_col = FALSE;
- direction = E_FOCUS_END;
+ use_col = FALSE;
+ direction = E_FOCUS_END;
} else if (event->key.keyval == GDK_Return ||
event->key.keyval == GDK_KP_Enter) {
change_focus = TRUE;
- use_col = FALSE;
- direction = E_FOCUS_START;
+ use_col = FALSE;
+ direction = E_FOCUS_START;
}
if ( change_focus ) {
GList *list;
for (list = etgc->children; list; list = list->next) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- ETableGroup *child = child_node->child;
- if (e_table_group_get_focus(child)) {
- old_col = e_table_group_get_focus_column(child);
- if ( old_col == -1 )
+ ETableGroupContainerChildNode *child_node;
+ ETableGroup *child;
+
+ child_node = (ETableGroupContainerChildNode *)list->data;
+ child = child_node->child;
+
+ if (e_table_group_get_focus (child)) {
+ old_col = e_table_group_get_focus_column (child);
+ if (old_col == -1)
old_col = 0;
- if ( start_col == -1 )
- start_col = e_table_header_count(e_table_group_get_header(child)) - 1;
+ if (start_col == -1)
+ start_col = e_table_header_count (e_table_group_get_header(child)) - 1;
if (direction == E_FOCUS_END)
list = list->prev;
@@ -472,10 +469,9 @@ etgc_event (GnomeCanvasItem *item, GdkEvent *event)
child_node = (ETableGroupContainerChildNode *)list->data;
child = child_node->child;
if (use_col)
- e_table_group_set_focus(child, direction, start_col);
- else {
- e_table_group_set_focus(child, direction, old_col);
- }
+ e_table_group_set_focus (child, direction, start_col);
+ else
+ e_table_group_set_focus (child, direction, old_col);
return 1;
} else {
return 0;
@@ -487,9 +483,9 @@ etgc_event (GnomeCanvasItem *item, GdkEvent *event)
default:
return_val = FALSE;
}
- if ( return_val == FALSE ) {
- if ( GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->event )
- return GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->event(item, event);
+ if (return_val == FALSE) {
+ if (GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->event)
+ return GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->event (item, event);
}
return return_val;
@@ -501,12 +497,12 @@ etgc_realize (GnomeCanvasItem *item)
{
ETableGroupContainer *etgc;
- if (GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->realize)
- (* GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->realize) (item);
+ if (GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->realize)
+ (* GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->realize) (item);
etgc = E_TABLE_GROUP_CONTAINER (item);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etgc));
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc));
}
/* Unrealize handler for the etgc item */
@@ -517,28 +513,34 @@ etgc_unrealize (GnomeCanvasItem *item)
etgc = E_TABLE_GROUP_CONTAINER (item);
- if (GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->unrealize)
- (* GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->unrealize) (item);
+ if (GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->unrealize)
+ (* GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->unrealize) (item);
}
static void
compute_text (ETableGroupContainer *etgc, ETableGroupContainerChildNode *child_node)
{
/* FIXME : What a hack, eh? */
- gchar *text = g_strdup_printf("%s : %s (%d item%s)", etgc->ecol->text, (gchar *)child_node->key, (gint) child_node->count, child_node->count == 1 ? "" : "s" );
- gnome_canvas_item_set(child_node->text,
- "text", text,
- NULL);
- g_free(text);
+ gchar *text = g_strdup_printf ("%s : %s (%d item%s)",
+ etgc->ecol->text,
+ (gchar *)child_node->key,
+ (gint) child_node->count,
+ child_node->count == 1 ? "" : "s" );
+ gnome_canvas_item_set (child_node->text,
+ "text", text,
+ NULL);
+ g_free (text);
}
static void
-child_row_selection (ETableGroup *etg, int row, gboolean selected, ETableGroupContainer *etgc)
+child_row_selection (ETableGroup *etg, int row, gboolean selected,
+ ETableGroupContainer *etgc)
{
- e_table_group_row_selection(E_TABLE_GROUP(etgc), row, selected);
+ e_table_group_row_selection (E_TABLE_GROUP (etgc), row, selected);
}
-static void etgc_add (ETableGroup *etg, gint row)
+static void
+etgc_add (ETableGroup *etg, gint row)
{
ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
void *val = e_table_model_value_at (etg->model, etgc->ecol->col_idx, row);
@@ -551,88 +553,98 @@ static void etgc_add (ETableGroup *etg, gint row)
int comp_val;
child_node = (ETableGroupContainerChildNode *)(list->data);
comp_val = (*comp)(child_node->key, val);
- if ( comp_val == 0 ) {
+ if (comp_val == 0) {
child = child_node->child;
child_node->count ++;
- e_table_group_add(child, row);
- compute_text(etgc, child_node);
+ e_table_group_add (child, row);
+ compute_text (etgc, child_node);
return;
}
- if ( (comp_val > 0 && etgc->ascending) ||
- (comp_val < 0 && (!etgc->ascending)) )
+ if ((comp_val > 0 && etgc->ascending) ||
+ (comp_val < 0 && (!etgc->ascending)))
break;
}
- child_node = g_new(ETableGroupContainerChildNode, 1);
- child_node->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etgc),
- gnome_canvas_rect_get_type (),
- "fill_color", "grey70",
- "outline_color", "grey50",
- NULL);
- child_node->text = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etgc),
- e_text_get_type(),
- "font_gdk", etgc->font,
- "anchor", GTK_ANCHOR_SW,
- "x", (double) 0,
- "y", (double) 0,
- "fill_color", "black",
- NULL);
- child = e_table_group_new(GNOME_CANVAS_GROUP(etgc), etg->full_header, etg->header, etg->model, etgc->child_rules);
- gtk_signal_connect(GTK_OBJECT(child), "row_selection",
- GTK_SIGNAL_FUNC(child_row_selection), etgc);
+ child_node = g_new (ETableGroupContainerChildNode, 1);
+ child_node->rect = gnome_canvas_item_new (GNOME_CANVAS_GROUP (etgc),
+ gnome_canvas_rect_get_type (),
+ "fill_color", "grey70",
+ "outline_color", "grey50",
+ NULL);
+ child_node->text = gnome_canvas_item_new (GNOME_CANVAS_GROUP (etgc),
+ e_text_get_type (),
+ "font_gdk", etgc->font,
+ "anchor", GTK_ANCHOR_SW,
+ "x", (double) 0,
+ "y", (double) 0,
+ "fill_color", "black",
+ NULL);
+ child = e_table_group_new (GNOME_CANVAS_GROUP (etgc), etg->full_header,
+ etg->header, etg->model, etgc->child_rules);
+ gtk_signal_connect (GTK_OBJECT (child), "row_selection",
+ GTK_SIGNAL_FUNC (child_row_selection), etgc);
child_node->child = child;
- child_node->key = e_table_model_duplicate_value(etg->model, etgc->ecol->col_idx, val);
+ child_node->key = e_table_model_duplicate_value (etg->model, etgc->ecol->col_idx, val);
child_node->count = 1;
- e_table_group_add(child, row);
- if ( list ) {
- etgc->children = g_list_insert(etgc->children, child_node, i);
- }
+ e_table_group_add (child, row);
+
+ if (list)
+ etgc->children = g_list_insert (etgc->children, child_node, i);
else
- etgc->children = g_list_append(etgc->children, child_node);
- compute_text(etgc, child_node);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etgc));
+ etgc->children = g_list_append (etgc->children, child_node);
+
+ compute_text (etgc, child_node);
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc));
}
-static gboolean etgc_remove (ETableGroup *etg, gint row)
+static gboolean
+etgc_remove (ETableGroup *etg, gint row)
{
ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
- GList *list = etgc->children;
- for ( ; list; list = g_list_next(list) ) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *) list->data;
- ETableGroup *child = child_node->child;
- if ( e_table_group_remove(child, row) ) {
+ GList *list;
+
+ for (list = etgc->children ; list; list = g_list_next (list)) {
+ ETableGroupContainerChildNode *child_node = list->data;
+ ETableGroup *child = child_node->child;
+
+ if (e_table_group_remove (child, row)) {
child_node->count --;
- if ( child_node->count == 0 ) {
- e_table_group_container_child_node_free(etgc, child_node);
- etgc->children = g_list_remove(etgc->children, child_node);
- g_free(child_node);
- } else {
- compute_text(etgc, child_node);
- }
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etgc));
+ if (child_node->count == 0) {
+ e_table_group_container_child_node_free (etgc, child_node);
+ etgc->children = g_list_remove (etgc->children, child_node);
+ g_free (child_node);
+ } else
+ compute_text (etgc, child_node);
+
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc));
+
return TRUE;
}
}
return FALSE;
}
-static void etgc_increment (ETableGroup *etg, gint position, gint amount)
+static void
+etgc_increment (ETableGroup *etg, gint position, gint amount)
{
ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
GList *list = etgc->children;
- for ( ; list; list = g_list_next(list) ) {
- e_table_group_increment(((ETableGroupContainerChildNode *)list->data)->child, position, amount);
- }
+
+ for (list = etgc->children ; list; list = g_list_next (list))
+ e_table_group_increment (((ETableGroupContainerChildNode *)list->data)->child,
+ position, amount);
}
-static void etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col)
+static void
+etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col)
{
ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
if (etgc->children) {
- if (direction == E_FOCUS_END) {
- e_table_group_set_focus(((ETableGroupContainerChildNode *)g_list_last(etgc->children)->data)->child, direction, view_col);
- } else {
- e_table_group_set_focus(((ETableGroupContainerChildNode *)etgc->children->data)->child, direction, view_col);
- }
+ if (direction == E_FOCUS_END)
+ e_table_group_set_focus (((ETableGroupContainerChildNode *)g_list_last (etgc->children)->data)->child,
+ direction, view_col);
+ else
+ e_table_group_set_focus (((ETableGroupContainerChildNode *)etgc->children->data)->child,
+ direction, view_col);
}
}
@@ -776,15 +788,6 @@ etgc_class_init (GtkObjectClass *object_class)
}
static void
-etgc_init (GtkObject *object)
-{
- ETableGroupContainer *container = E_TABLE_GROUP_CONTAINER(object);
- container->children = FALSE;
-
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(object), etgc_reflow);
-}
-
-static void
etgc_reflow (GnomeCanvasItem *item, gint flags)
{
ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(item);
@@ -850,4 +853,17 @@ etgc_reflow (GnomeCanvasItem *item, gint flags)
etgc->idle = 0;
}
+static void
+etgc_init (GtkObject *object)
+{
+ ETableGroupContainer *container = E_TABLE_GROUP_CONTAINER(object);
+ container->children = FALSE;
+
+ e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(object), etgc_reflow);
+}
+
E_MAKE_TYPE (e_table_group_container, "ETableGroupContainer", ETableGroupContainer, etgc_class_init, etgc_init, PARENT_TYPE);
+
+
+
+
diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c
index 0df506cfae..6b467a84c7 100644
--- a/widgets/e-table/e-table-item.c
+++ b/widgets/e-table/e-table-item.c
@@ -97,9 +97,9 @@ eti_attach_cell_views (ETableItem *eti)
}
eti->needs_compute_height = 1;
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(eti));
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
eti->needs_redraw = 1;
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti));
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
}
/*
@@ -137,17 +137,40 @@ eti_detach_cell_views (ETableItem *eti)
static void
eti_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2)
{
+ double i2c [6];
+ ArtPoint c1, c2, i1, i2;
+ ETableItem *eti = E_TABLE_ITEM (item);
+
+ /* Wrong BBox's are the source of redraw nightmares */
+
+ gnome_canvas_item_i2c_affine (GNOME_CANVAS_ITEM (eti), i2c);
+
+ i1.x = eti->x1;
+ i1.y = eti->y1;
+ i2.x = eti->x1 + eti->width;
+ i2.y = eti->y1 + eti->height;
+ art_affine_point (&c1, &i1, i2c);
+ art_affine_point (&c2, &i2, i2c);
+
+ *x1 = c1.x;
+ *y1 = c1.y;
+ *x2 = c2.x + 1;
+ *y2 = c2.y + 1;
}
static void
eti_reflow (GnomeCanvasItem *item, gint flags)
{
ETableItem *eti = E_TABLE_ITEM (item);
- if ( eti->needs_compute_height ) {
+
+ if (eti->needs_compute_height) {
int new_height = eti_get_height (eti);
- if ( new_height != eti->height ) {
+
+ if (new_height != eti->height) {
eti->height = new_height;
- e_canvas_item_request_parent_reflow(GNOME_CANVAS_ITEM(eti));
+ e_canvas_item_request_parent_reflow (GNOME_CANVAS_ITEM (eti));
+ eti->needs_redraw = 1;
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
}
eti->needs_compute_height = 0;
}
@@ -159,37 +182,28 @@ eti_reflow (GnomeCanvasItem *item, gint flags)
static void
eti_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
{
- double i2c [6];
- ArtPoint c1, c2, i1, i2;
+ ArtPoint o1, o2;
ETableItem *eti = E_TABLE_ITEM (item);
if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)
(*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)(item, affine, clip_path, flags);
-
- gnome_canvas_item_i2c_affine (item, i2c);
- i1.x = eti->x1;
- i1.y = eti->y1;
- i2.x = eti->x1 + eti->width;
- i2.y = eti->y1 + eti->height;
- art_affine_point (&c1, &i1, i2c);
- art_affine_point (&c2, &i2, i2c);
+
+ o1.x = item->x1;
+ o1.y = item->y1;
+ o2.x = item->x2;
+ o2.y = item->y2;
eti_bounds (item, &item->x1, &item->y1, &item->x2, &item->y2);
- if ( item->x1 != c1.x ||
- item->y1 != c1.y ||
- item->x2 != c2.x + 1 ||
- item->y2 != c2.y + 1 )
- {
- gnome_canvas_request_redraw(item->canvas, item->x1, item->y1, item->x2, item->y2);
- item->x1 = c1.x;
- item->y1 = c1.y;
- item->x2 = c2.x + 1;
- item->y2 = c2.y + 1;
- eti->needs_redraw = 1;
- }
- if ( eti->needs_redraw ) {
- gnome_canvas_request_redraw(item->canvas, 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)
+ eti->needs_redraw = 1;
+
+ if (eti->needs_redraw) {
+ gnome_canvas_request_redraw (item->canvas, item->x1, item->y1,
+ item->x2, item->y2);
eti->needs_redraw = 0;
}
}
@@ -338,14 +352,13 @@ eti_table_model_changed (ETableModel *table_model, ETableItem *eti)
{
eti->rows = e_table_model_row_count (eti->table_model);
- if (eti->focused_row > eti->rows - 1) {
+ if (eti->focused_row > eti->rows - 1)
eti->focused_row = eti->rows - 1;
- }
eti->needs_compute_height = 1;
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(eti));
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
eti->needs_redraw = 1;
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti));
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
}
/* Unused. */
@@ -409,7 +422,7 @@ eti_request_region_redraw (ETableItem *eti,
static void
eti_table_model_row_changed (ETableModel *table_model, int row, ETableItem *eti)
{
- if (eti->renderers_can_change_size){
+ if (eti->renderers_can_change_size) {
eti_table_model_changed (table_model, eti);
return;
}
@@ -454,7 +467,7 @@ eti_add_table_model (ETableItem *eti, ETableModel *table_model)
GTK_OBJECT (table_model), "model_row_changed",
GTK_SIGNAL_FUNC (eti_table_model_row_changed), eti);
- if (eti->header){
+ if (eti->header) {
eti_detach_cell_views (eti);
eti_attach_cell_views (eti);
}
@@ -466,7 +479,7 @@ static void
eti_header_dim_changed (ETableHeader *eth, int col, ETableItem *eti)
{
eti->needs_redraw = 1;
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti));
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
}
static void
@@ -486,13 +499,13 @@ eti_header_structure_changed (ETableHeader *eth, ETableItem *eti)
eti_attach_cell_views (eti);
eti_realize_cell_views (eti);
} else {
- if (eti->table_model){
+ if (eti->table_model) {
eti_detach_cell_views (eti);
eti_attach_cell_views (eti);
}
}
eti->needs_redraw = 1;
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti));
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
}
static void
@@ -611,7 +624,7 @@ eti_init (GnomeCanvasItem *item)
eti->needs_redraw = 0;
eti->needs_compute_height = 0;
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(eti), eti_reflow);
+ e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM (eti), eti_reflow);
}
#define gray50_width 2
@@ -658,9 +671,9 @@ eti_realize (GnomeCanvasItem *item)
eti_realize_cell_views (eti);
eti->needs_compute_height = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(eti));
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
eti->needs_redraw = 1;
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti));
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
}
static void
diff --git a/widgets/e-table/e-table.c b/widgets/e-table/e-table.c
index 2a2458adbd..70efe582ba 100644
--- a/widgets/e-table/e-table.c
+++ b/widgets/e-table/e-table.c
@@ -130,9 +130,8 @@ static void
sort_info_changed (ETableSortInfo *info, ETable *et)
{
et->need_rebuild = TRUE;
- if ( !et->rebuild_idle_id ) {
- et->rebuild_idle_id = g_idle_add(changed_idle, et);
- }
+ if (!et->rebuild_idle_id)
+ et->rebuild_idle_id = g_idle_add (changed_idle, et);
}
static void
@@ -144,20 +143,20 @@ e_table_setup_header (ETable *e_table)
gtk_widget_show (GTK_WIDGET (e_table->header_canvas));
- root = xmlDocGetRootElement(e_table->specification);
- grouping = e_xml_get_child_by_name(root, "grouping");
+ root = xmlDocGetRootElement (e_table->specification);
+ grouping = e_xml_get_child_by_name (root, "grouping");
- e_table->sort_info = e_table_sort_info_new();
+ e_table->sort_info = e_table_sort_info_new ();
- gtk_object_ref(GTK_OBJECT(e_table->sort_info));
- gtk_object_sink(GTK_OBJECT(e_table->sort_info));
+ gtk_object_ref (GTK_OBJECT (e_table->sort_info));
+ gtk_object_sink (GTK_OBJECT (e_table->sort_info));
- gtk_object_set(GTK_OBJECT(e_table->sort_info),
- "grouping", grouping,
- NULL);
+ gtk_object_set (GTK_OBJECT (e_table->sort_info),
+ "grouping", grouping,
+ NULL);
e_table->sort_info_change_id =
- gtk_signal_connect (GTK_OBJECT(e_table->sort_info), "sort_info_changed",
+ gtk_signal_connect (GTK_OBJECT (e_table->sort_info), "sort_info_changed",
GTK_SIGNAL_FUNC (sort_info_changed), e_table);
e_table->header_item = gnome_canvas_item_new (
@@ -576,42 +575,46 @@ e_table_canvas_new (ETable *e_table)
#endif
static void
-table_canvas_size_allocate (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);
+
+ 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, MAX(height, alloc->height));
+ 0, 0, alloc->width, MAX (height, alloc->height));
width = alloc->width;
- gtk_object_set(GTK_OBJECT(e_table->group),
- "width", width,
- NULL);
+ gtk_object_set (GTK_OBJECT (e_table->group),
+ "width", width,
+ NULL);
}
static void
table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table)
{
- table_canvas_size_allocate (GTK_WIDGET(canvas), &(GTK_WIDGET(canvas)->allocation), e_table);
+ table_canvas_size_allocate (GTK_WIDGET (canvas),
+ &(GTK_WIDGET (canvas)->allocation),
+ e_table);
}
static void
change_row (gpointer key, gpointer value, gpointer data)
{
- ETable *et = E_TABLE(data);
- gint row = GPOINTER_TO_INT(key);
- if ( e_table_group_remove(et->group, row) ) {
- e_table_group_add(et->group, row);
- }
+ ETable *et = E_TABLE (data);
+ gint row = GPOINTER_TO_INT (key);
+
+ if (e_table_group_remove (et->group, row))
+ e_table_group_add (et->group, row);
}
static void
group_row_selection (ETableGroup *etg, int row, gboolean selected, ETable *et)
{
- gtk_signal_emit (GTK_OBJECT(et),
+ gtk_signal_emit (GTK_OBJECT (et),
et_signals [ROW_SELECTION],
row, selected);
}
@@ -619,30 +622,33 @@ group_row_selection (ETableGroup *etg, int row, gboolean selected, ETable *et)
static gboolean
changed_idle (gpointer data)
{
- ETable *et = E_TABLE(data);
- if ( et->need_rebuild ) {
- gtk_object_destroy( GTK_OBJECT(et->group ) );
- et->group = e_table_group_new(GNOME_CANVAS_GROUP(et->table_canvas->root),
- et->full_header,
- et->header,
- et->model,
- e_xml_get_child_by_name(xmlDocGetRootElement(et->specification), "grouping")->childs);
- gtk_signal_connect(GTK_OBJECT(et->group), "row_selection",
- GTK_SIGNAL_FUNC(group_row_selection), et);
- e_table_fill_table(et, et->model);
+ ETable *et = E_TABLE (data);
+
+ if (et->need_rebuild) {
+ gtk_object_destroy (GTK_OBJECT (et->group));
+ et->group = e_table_group_new (GNOME_CANVAS_GROUP (et->table_canvas->root),
+ et->full_header,
+ et->header,
+ et->model,
+ e_xml_get_child_by_name (xmlDocGetRootElement (et->specification),
+ "grouping")->childs);
+ gtk_signal_connect (GTK_OBJECT (et->group), "row_selection",
+ GTK_SIGNAL_FUNC (group_row_selection), et);
+ e_table_fill_table (et, et->model);
- gtk_object_set(GTK_OBJECT(et->group),
- "width", (double) GTK_WIDGET(et->table_canvas)->allocation.width,
- NULL);
- } else if (et->need_row_changes) {
- g_hash_table_foreach(et->row_changes_list, change_row, et);
- }
+ gtk_object_set (GTK_OBJECT (et->group),
+ "width", (double) GTK_WIDGET (et->table_canvas)->allocation.width,
+ NULL);
+ } else if (et->need_row_changes)
+ g_hash_table_foreach (et->row_changes_list, change_row, et);
+
et->need_rebuild = 0;
et->need_row_changes = 0;
if (et->row_changes_list)
- g_hash_table_destroy(et->row_changes_list);
+ g_hash_table_destroy (et->row_changes_list);
et->row_changes_list = NULL;
et->rebuild_idle_id = 0;
+
return FALSE;
}
@@ -650,38 +656,39 @@ static void
et_table_model_changed (ETableModel *model, ETable *et)
{
et->need_rebuild = TRUE;
- if ( !et->rebuild_idle_id ) {
- et->rebuild_idle_id = g_idle_add(changed_idle, et);
- }
+ if (!et->rebuild_idle_id)
+ et->rebuild_idle_id = g_idle_add (changed_idle, et);
}
static void
et_table_row_changed (ETableModel *table_model, int row, ETable *et)
{
- if ( !et->need_rebuild ) {
+ if (!et->need_rebuild) {
if (!et->need_row_changes) {
et->need_row_changes = 1;
et->row_changes_list = g_hash_table_new (g_direct_hash, g_direct_equal);
}
- if (!g_hash_table_lookup(et->row_changes_list, GINT_TO_POINTER(row))) {
- g_hash_table_insert(et->row_changes_list, GINT_TO_POINTER(row), GINT_TO_POINTER(row + 1));
+ if (!g_hash_table_lookup (et->row_changes_list, GINT_TO_POINTER (row))) {
+ g_hash_table_insert (et->row_changes_list, GINT_TO_POINTER (row),
+ GINT_TO_POINTER (row + 1));
}
}
- if ( !et->rebuild_idle_id ) {
+
+ if ( !et->rebuild_idle_id )
et->rebuild_idle_id = g_idle_add(changed_idle, et);
- }
}
static void
et_table_cell_changed (ETableModel *table_model, int view_col, int row, ETable *et)
{
- et_table_row_changed(table_model, row, et);
+ et_table_row_changed (table_model, row, et);
}
static void
-e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *header, ETableModel *model, xmlNode *xml_grouping)
+e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *header,
+ ETableModel *model, xmlNode *xml_grouping)
{
- e_table->table_canvas = GNOME_CANVAS(e_canvas_new ());
+ e_table->table_canvas = GNOME_CANVAS (e_canvas_new ());
gtk_signal_connect (
GTK_OBJECT (e_table->table_canvas), "size_allocate",
GTK_SIGNAL_FUNC (table_canvas_size_allocate), e_table);
@@ -691,11 +698,11 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h
gtk_widget_show (GTK_WIDGET (e_table->table_canvas));
- e_table->group = e_table_group_new(GNOME_CANVAS_GROUP(e_table->table_canvas->root),
- full_header,
- header,
- model,
- xml_grouping->childs);
+ e_table->group = e_table_group_new (GNOME_CANVAS_GROUP (e_table->table_canvas->root),
+ full_header,
+ header,
+ model,
+ xml_grouping->childs);
gtk_signal_connect(GTK_OBJECT(e_table->group), "row_selection",
GTK_SIGNAL_FUNC(group_row_selection), e_table);
@@ -715,23 +722,21 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h
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);
+ int count, 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);
}
static void
et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
- xmlDoc *xmlSpec)
+ xmlDoc *xmlSpec)
{
xmlNode *xmlRoot;
xmlNode *xmlColumns;
@@ -760,18 +765,18 @@ et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
e_table_setup_table (e_table, full_header, e_table->header, etm, xmlGrouping);
e_table_fill_table (e_table, etm);
- vbox = gtk_vbox_new(FALSE, 0);
+ vbox = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET (e_table->header_canvas), FALSE, FALSE, 0 );
- gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET (e_table->table_canvas), TRUE, TRUE, 0 );
+ gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (e_table->header_canvas), FALSE, FALSE, 0 );
+ gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (e_table->table_canvas), TRUE, TRUE, 0 );
- gtk_widget_show(vbox);
+ gtk_widget_show (vbox);
- gtk_box_pack_start( GTK_BOX(e_table), vbox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (e_table), vbox, TRUE, TRUE, 0);
- vscrollbar = gtk_vscrollbar_new(gtk_layout_get_vadjustment(GTK_LAYOUT(e_table->table_canvas)));
+ vscrollbar = gtk_vscrollbar_new (gtk_layout_get_vadjustment (GTK_LAYOUT (e_table->table_canvas)));
gtk_widget_show (vscrollbar);
- gtk_box_pack_start( GTK_BOX(e_table), vscrollbar, FALSE, FALSE, 0 );
+ gtk_box_pack_start (GTK_BOX (e_table), vscrollbar, FALSE, FALSE, 0 );
gtk_widget_pop_colormap ();
gtk_widget_pop_visual ();
diff --git a/widgets/e-table/e-table.h b/widgets/e-table/e-table.h
index 8d7fda340e..ecdeec1e83 100644
--- a/widgets/e-table/e-table.h
+++ b/widgets/e-table/e-table.h
@@ -73,4 +73,4 @@ void e_table_save_specification (ETable *e_table, gchar *filename);
END_GNOME_DECLS
- #endif /* _E_TABLE_H_ */
+#endif /* _E_TABLE_H_ */
diff --git a/widgets/table/e-table-example-1.c b/widgets/table/e-table-example-1.c
index 413fde3aba..c1abc70c93 100644
--- a/widgets/table/e-table-example-1.c
+++ b/widgets/table/e-table-example-1.c
@@ -77,7 +77,7 @@ The headers will be hard coded, as will be the example data.
<grouping> <leaf column=\"1\" ascending=\"1\"/> </grouping> \
</ETableSpecification>"
-char *headers[COLS] = {
+char *headers [COLS] = {
"Email",
"Full Name",
"Address",
@@ -91,7 +91,7 @@ char *headers[COLS] = {
3 Phone
*/
-char *table_data[ROWS][COLS];
+char *table_data [ROWS] [COLS];
/*
* ETableSimple callbacks
@@ -119,15 +119,15 @@ my_row_count (ETableModel *etc, void *data)
static void *
my_value_at (ETableModel *etc, int col, int row, void *data)
{
- return (void *) table_data [row][col];
+ return (void *) table_data [row] [col];
}
/* This function sets the value at a particular point in our ETableModel. */
static void
my_set_value_at (ETableModel *etc, int col, int row, const void *val, void *data)
{
- g_free (table_data [row][col]);
- table_data [row][col] = g_strdup (val);
+ g_free (table_data [row] [col]);
+ table_data [row] [col] = g_strdup (val);
}
/* This function returns whether a particular cell is editable. */
@@ -141,14 +141,14 @@ my_is_cell_editable (ETableModel *etc, int col, int row, void *data)
static void *
my_duplicate_value (ETableModel *etc, int col, const void *value, void *data)
{
- return g_strdup(value);
+ return g_strdup (value);
}
/* This function frees the value passed to it. */
static void
my_free_value (ETableModel *etc, int col, void *value, void *data)
{
- g_free(value);
+ g_free (value);
}
/* This function is for when the model is unfrozen. This can mostly
@@ -160,7 +160,7 @@ my_thaw (ETableModel *etc, void *data)
/* We create a window containing our new table. */
static void
-create_table()
+create_table (void)
{
GtkWidget *e_table, *window, *frame;
ECell *cell_left_just;
@@ -170,9 +170,8 @@ create_table()
/* First we fill in the simple data. */
for ( i = 0; i < ROWS; i++ ) {
- for ( j = 0; j < COLS; j++ ) {
- table_data[i][j] = g_strdup("");
- }
+ for ( j = 0; j < COLS; j++ )
+ table_data [i] [j] = g_strdup ("");
}
/* Next we create our model. This uses the functions we defined
earlier. */
@@ -201,7 +200,7 @@ create_table()
/* Next we create a column object for each view column and add
them to the header. We don't create a column object for
the importance column since it will not be shown. */
- for (i = 0; i < COLS; i++){
+ for (i = 0; i < COLS; i++) {
/* Create the column. */
ETableCol *ecol = e_table_col_new (
i, headers [i],
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c
index ebe832c29f..c69dbcd93a 100644
--- a/widgets/table/e-table-group-container.c
+++ b/widgets/table/e-table-group-container.c
@@ -5,7 +5,7 @@
* Author:
* Miguel de Icaza (miguel@gnu.org()
*
- * Copyright 1999, Helix Code, Inc.
+ * Copyright 1999, 2000 Helix Code, Inc.
*/
#include <config.h>
@@ -36,20 +36,6 @@ enum {
ARG_FROZEN
};
-static void etgc_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void etgc_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-
-static int etgc_event (GnomeCanvasItem *item, GdkEvent *event);
-static void etgc_realize (GnomeCanvasItem *item);
-static void etgc_unrealize (GnomeCanvasItem *item);
-
-static void etgc_add (ETableGroup *etg, gint row);
-static gboolean etgc_remove (ETableGroup *etg, gint row);
-static void etgc_increment (ETableGroup *etg, gint position, gint amount);
-static void etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col);
-
-static void etgc_reflow (GnomeCanvasItem *item, gint flags);
-
typedef struct {
ETableGroup *child;
void *key;
@@ -59,14 +45,17 @@ typedef struct {
} ETableGroupContainerChildNode;
static void
-e_table_group_container_child_node_free(ETableGroupContainer *etgc, ETableGroupContainerChildNode *child_node)
+e_table_group_container_child_node_free(ETableGroupContainer *etgc,
+ ETableGroupContainerChildNode *child_node)
{
- ETableGroup *etg = E_TABLE_GROUP(etgc);
+ ETableGroup *etg = E_TABLE_GROUP (etgc);
ETableGroup *child = child_node->child;
- gtk_object_destroy(GTK_OBJECT(child));
- e_table_model_free_value(etg->model, etgc->ecol->col_idx, child_node->key);
- gtk_object_destroy(GTK_OBJECT(child_node->text));
- gtk_object_destroy(GTK_OBJECT(child_node->rect));
+
+ gtk_object_destroy (GTK_OBJECT (child));
+ e_table_model_free_value (etg->model, etgc->ecol->col_idx,
+ child_node->key);
+ gtk_object_destroy (GTK_OBJECT (child_node->text));
+ gtk_object_destroy (GTK_OBJECT (child_node->rect));
}
static void
@@ -74,13 +63,16 @@ e_table_group_container_list_free(ETableGroupContainer *etgc)
{
ETableGroupContainerChildNode *child_node;
GList *list;
- if ( etgc->idle )
- g_source_remove( etgc->idle );
- for ( list = etgc->children; list; list = g_list_next(list) ) {
+
+ if (etgc->idle)
+ g_source_remove (etgc->idle);
+
+ for (list = etgc->children; list; list = g_list_next (list)) {
child_node = (ETableGroupContainerChildNode *) list->data;
- e_table_group_container_child_node_free(etgc, child_node);
+ e_table_group_container_child_node_free (etgc, child_node);
}
- g_list_free(etgc->children);
+
+ g_list_free (etgc->children);
}
static void
@@ -213,7 +205,7 @@ e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContaine
etgc->font = gdk_font_load ("lucidasans-10");
if (!etgc->font){
- etgc->font = GTK_WIDGET(GNOME_CANVAS_ITEM(etgc)->canvas)->style->font;
+ etgc->font = GTK_WIDGET (GNOME_CANVAS_ITEM (etgc)->canvas)->style->font;
gdk_font_ref (etgc->font);
}
@@ -257,9 +249,10 @@ e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContaine
}
ETableGroup *
-e_table_group_container_new (GnomeCanvasGroup *parent, ETableHeader *full_header,
- ETableHeader *header,
- ETableModel *model, ETableCol *ecol, int ascending, xmlNode *child_rules)
+e_table_group_container_new (GnomeCanvasGroup *parent, ETableHeader *full_header,
+ ETableHeader *header,
+ ETableModel *model, ETableCol *ecol,
+ int ascending, xmlNode *child_rules)
{
ETableGroupContainer *etgc;
@@ -378,9 +371,9 @@ etgc_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags
GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->update (item, affine, clip_path, flags);
- if ( etgc->need_resize ) {
+ if (etgc->need_resize) {
- if (!etgc->transparent){
+ if (!etgc->transparent) {
int current_width, current_height;
etgc_dim (etgc, &current_width, &current_height);
@@ -420,48 +413,52 @@ etgc_event (GnomeCanvasItem *item, GdkEvent *event)
event->key.keyval == GDK_KP_Tab ||
event->key.keyval == GDK_ISO_Left_Tab) {
change_focus = TRUE;
- use_col = TRUE;
- start_col = (event->key.state & GDK_SHIFT_MASK) ? -1 : 0;
- direction = (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START;
+ use_col = TRUE;
+ start_col = (event->key.state & GDK_SHIFT_MASK) ? -1 : 0;
+ direction = (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START;
} else if (event->key.keyval == GDK_Left ||
event->key.keyval == GDK_KP_Left) {
change_focus = TRUE;
- use_col = TRUE;
- start_col = -1;
- direction = E_FOCUS_END;
+ use_col = TRUE;
+ start_col = -1;
+ direction = E_FOCUS_END;
} else if (event->key.keyval == GDK_Right ||
event->key.keyval == GDK_KP_Right) {
change_focus = TRUE;
- use_col = TRUE;
+ use_col = TRUE;
start_col = 0;
direction = E_FOCUS_START;
} else if (event->key.keyval == GDK_Down ||
event->key.keyval == GDK_KP_Down) {
change_focus = TRUE;
- use_col = FALSE;
- direction = E_FOCUS_START;
+ use_col = FALSE;
+ direction = E_FOCUS_START;
} else if (event->key.keyval == GDK_Up ||
event->key.keyval == GDK_KP_Up) {
change_focus = TRUE;
- use_col = FALSE;
- direction = E_FOCUS_END;
+ use_col = FALSE;
+ direction = E_FOCUS_END;
} else if (event->key.keyval == GDK_Return ||
event->key.keyval == GDK_KP_Enter) {
change_focus = TRUE;
- use_col = FALSE;
- direction = E_FOCUS_START;
+ use_col = FALSE;
+ direction = E_FOCUS_START;
}
if ( change_focus ) {
GList *list;
for (list = etgc->children; list; list = list->next) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- ETableGroup *child = child_node->child;
- if (e_table_group_get_focus(child)) {
- old_col = e_table_group_get_focus_column(child);
- if ( old_col == -1 )
+ ETableGroupContainerChildNode *child_node;
+ ETableGroup *child;
+
+ child_node = (ETableGroupContainerChildNode *)list->data;
+ child = child_node->child;
+
+ if (e_table_group_get_focus (child)) {
+ old_col = e_table_group_get_focus_column (child);
+ if (old_col == -1)
old_col = 0;
- if ( start_col == -1 )
- start_col = e_table_header_count(e_table_group_get_header(child)) - 1;
+ if (start_col == -1)
+ start_col = e_table_header_count (e_table_group_get_header(child)) - 1;
if (direction == E_FOCUS_END)
list = list->prev;
@@ -472,10 +469,9 @@ etgc_event (GnomeCanvasItem *item, GdkEvent *event)
child_node = (ETableGroupContainerChildNode *)list->data;
child = child_node->child;
if (use_col)
- e_table_group_set_focus(child, direction, start_col);
- else {
- e_table_group_set_focus(child, direction, old_col);
- }
+ e_table_group_set_focus (child, direction, start_col);
+ else
+ e_table_group_set_focus (child, direction, old_col);
return 1;
} else {
return 0;
@@ -487,9 +483,9 @@ etgc_event (GnomeCanvasItem *item, GdkEvent *event)
default:
return_val = FALSE;
}
- if ( return_val == FALSE ) {
- if ( GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->event )
- return GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->event(item, event);
+ if (return_val == FALSE) {
+ if (GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->event)
+ return GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->event (item, event);
}
return return_val;
@@ -501,12 +497,12 @@ etgc_realize (GnomeCanvasItem *item)
{
ETableGroupContainer *etgc;
- if (GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->realize)
- (* GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->realize) (item);
+ if (GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->realize)
+ (* GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->realize) (item);
etgc = E_TABLE_GROUP_CONTAINER (item);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etgc));
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc));
}
/* Unrealize handler for the etgc item */
@@ -517,28 +513,34 @@ etgc_unrealize (GnomeCanvasItem *item)
etgc = E_TABLE_GROUP_CONTAINER (item);
- if (GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->unrealize)
- (* GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->unrealize) (item);
+ if (GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->unrealize)
+ (* GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->unrealize) (item);
}
static void
compute_text (ETableGroupContainer *etgc, ETableGroupContainerChildNode *child_node)
{
/* FIXME : What a hack, eh? */
- gchar *text = g_strdup_printf("%s : %s (%d item%s)", etgc->ecol->text, (gchar *)child_node->key, (gint) child_node->count, child_node->count == 1 ? "" : "s" );
- gnome_canvas_item_set(child_node->text,
- "text", text,
- NULL);
- g_free(text);
+ gchar *text = g_strdup_printf ("%s : %s (%d item%s)",
+ etgc->ecol->text,
+ (gchar *)child_node->key,
+ (gint) child_node->count,
+ child_node->count == 1 ? "" : "s" );
+ gnome_canvas_item_set (child_node->text,
+ "text", text,
+ NULL);
+ g_free (text);
}
static void
-child_row_selection (ETableGroup *etg, int row, gboolean selected, ETableGroupContainer *etgc)
+child_row_selection (ETableGroup *etg, int row, gboolean selected,
+ ETableGroupContainer *etgc)
{
- e_table_group_row_selection(E_TABLE_GROUP(etgc), row, selected);
+ e_table_group_row_selection (E_TABLE_GROUP (etgc), row, selected);
}
-static void etgc_add (ETableGroup *etg, gint row)
+static void
+etgc_add (ETableGroup *etg, gint row)
{
ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
void *val = e_table_model_value_at (etg->model, etgc->ecol->col_idx, row);
@@ -551,88 +553,98 @@ static void etgc_add (ETableGroup *etg, gint row)
int comp_val;
child_node = (ETableGroupContainerChildNode *)(list->data);
comp_val = (*comp)(child_node->key, val);
- if ( comp_val == 0 ) {
+ if (comp_val == 0) {
child = child_node->child;
child_node->count ++;
- e_table_group_add(child, row);
- compute_text(etgc, child_node);
+ e_table_group_add (child, row);
+ compute_text (etgc, child_node);
return;
}
- if ( (comp_val > 0 && etgc->ascending) ||
- (comp_val < 0 && (!etgc->ascending)) )
+ if ((comp_val > 0 && etgc->ascending) ||
+ (comp_val < 0 && (!etgc->ascending)))
break;
}
- child_node = g_new(ETableGroupContainerChildNode, 1);
- child_node->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etgc),
- gnome_canvas_rect_get_type (),
- "fill_color", "grey70",
- "outline_color", "grey50",
- NULL);
- child_node->text = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etgc),
- e_text_get_type(),
- "font_gdk", etgc->font,
- "anchor", GTK_ANCHOR_SW,
- "x", (double) 0,
- "y", (double) 0,
- "fill_color", "black",
- NULL);
- child = e_table_group_new(GNOME_CANVAS_GROUP(etgc), etg->full_header, etg->header, etg->model, etgc->child_rules);
- gtk_signal_connect(GTK_OBJECT(child), "row_selection",
- GTK_SIGNAL_FUNC(child_row_selection), etgc);
+ child_node = g_new (ETableGroupContainerChildNode, 1);
+ child_node->rect = gnome_canvas_item_new (GNOME_CANVAS_GROUP (etgc),
+ gnome_canvas_rect_get_type (),
+ "fill_color", "grey70",
+ "outline_color", "grey50",
+ NULL);
+ child_node->text = gnome_canvas_item_new (GNOME_CANVAS_GROUP (etgc),
+ e_text_get_type (),
+ "font_gdk", etgc->font,
+ "anchor", GTK_ANCHOR_SW,
+ "x", (double) 0,
+ "y", (double) 0,
+ "fill_color", "black",
+ NULL);
+ child = e_table_group_new (GNOME_CANVAS_GROUP (etgc), etg->full_header,
+ etg->header, etg->model, etgc->child_rules);
+ gtk_signal_connect (GTK_OBJECT (child), "row_selection",
+ GTK_SIGNAL_FUNC (child_row_selection), etgc);
child_node->child = child;
- child_node->key = e_table_model_duplicate_value(etg->model, etgc->ecol->col_idx, val);
+ child_node->key = e_table_model_duplicate_value (etg->model, etgc->ecol->col_idx, val);
child_node->count = 1;
- e_table_group_add(child, row);
- if ( list ) {
- etgc->children = g_list_insert(etgc->children, child_node, i);
- }
+ e_table_group_add (child, row);
+
+ if (list)
+ etgc->children = g_list_insert (etgc->children, child_node, i);
else
- etgc->children = g_list_append(etgc->children, child_node);
- compute_text(etgc, child_node);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etgc));
+ etgc->children = g_list_append (etgc->children, child_node);
+
+ compute_text (etgc, child_node);
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc));
}
-static gboolean etgc_remove (ETableGroup *etg, gint row)
+static gboolean
+etgc_remove (ETableGroup *etg, gint row)
{
ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
- GList *list = etgc->children;
- for ( ; list; list = g_list_next(list) ) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *) list->data;
- ETableGroup *child = child_node->child;
- if ( e_table_group_remove(child, row) ) {
+ GList *list;
+
+ for (list = etgc->children ; list; list = g_list_next (list)) {
+ ETableGroupContainerChildNode *child_node = list->data;
+ ETableGroup *child = child_node->child;
+
+ if (e_table_group_remove (child, row)) {
child_node->count --;
- if ( child_node->count == 0 ) {
- e_table_group_container_child_node_free(etgc, child_node);
- etgc->children = g_list_remove(etgc->children, child_node);
- g_free(child_node);
- } else {
- compute_text(etgc, child_node);
- }
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etgc));
+ if (child_node->count == 0) {
+ e_table_group_container_child_node_free (etgc, child_node);
+ etgc->children = g_list_remove (etgc->children, child_node);
+ g_free (child_node);
+ } else
+ compute_text (etgc, child_node);
+
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc));
+
return TRUE;
}
}
return FALSE;
}
-static void etgc_increment (ETableGroup *etg, gint position, gint amount)
+static void
+etgc_increment (ETableGroup *etg, gint position, gint amount)
{
ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
GList *list = etgc->children;
- for ( ; list; list = g_list_next(list) ) {
- e_table_group_increment(((ETableGroupContainerChildNode *)list->data)->child, position, amount);
- }
+
+ for (list = etgc->children ; list; list = g_list_next (list))
+ e_table_group_increment (((ETableGroupContainerChildNode *)list->data)->child,
+ position, amount);
}
-static void etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col)
+static void
+etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col)
{
ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
if (etgc->children) {
- if (direction == E_FOCUS_END) {
- e_table_group_set_focus(((ETableGroupContainerChildNode *)g_list_last(etgc->children)->data)->child, direction, view_col);
- } else {
- e_table_group_set_focus(((ETableGroupContainerChildNode *)etgc->children->data)->child, direction, view_col);
- }
+ if (direction == E_FOCUS_END)
+ e_table_group_set_focus (((ETableGroupContainerChildNode *)g_list_last (etgc->children)->data)->child,
+ direction, view_col);
+ else
+ e_table_group_set_focus (((ETableGroupContainerChildNode *)etgc->children->data)->child,
+ direction, view_col);
}
}
@@ -776,15 +788,6 @@ etgc_class_init (GtkObjectClass *object_class)
}
static void
-etgc_init (GtkObject *object)
-{
- ETableGroupContainer *container = E_TABLE_GROUP_CONTAINER(object);
- container->children = FALSE;
-
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(object), etgc_reflow);
-}
-
-static void
etgc_reflow (GnomeCanvasItem *item, gint flags)
{
ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(item);
@@ -850,4 +853,17 @@ etgc_reflow (GnomeCanvasItem *item, gint flags)
etgc->idle = 0;
}
+static void
+etgc_init (GtkObject *object)
+{
+ ETableGroupContainer *container = E_TABLE_GROUP_CONTAINER(object);
+ container->children = FALSE;
+
+ e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(object), etgc_reflow);
+}
+
E_MAKE_TYPE (e_table_group_container, "ETableGroupContainer", ETableGroupContainer, etgc_class_init, etgc_init, PARENT_TYPE);
+
+
+
+
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 0df506cfae..6b467a84c7 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -97,9 +97,9 @@ eti_attach_cell_views (ETableItem *eti)
}
eti->needs_compute_height = 1;
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(eti));
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
eti->needs_redraw = 1;
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti));
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
}
/*
@@ -137,17 +137,40 @@ eti_detach_cell_views (ETableItem *eti)
static void
eti_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2)
{
+ double i2c [6];
+ ArtPoint c1, c2, i1, i2;
+ ETableItem *eti = E_TABLE_ITEM (item);
+
+ /* Wrong BBox's are the source of redraw nightmares */
+
+ gnome_canvas_item_i2c_affine (GNOME_CANVAS_ITEM (eti), i2c);
+
+ i1.x = eti->x1;
+ i1.y = eti->y1;
+ i2.x = eti->x1 + eti->width;
+ i2.y = eti->y1 + eti->height;
+ art_affine_point (&c1, &i1, i2c);
+ art_affine_point (&c2, &i2, i2c);
+
+ *x1 = c1.x;
+ *y1 = c1.y;
+ *x2 = c2.x + 1;
+ *y2 = c2.y + 1;
}
static void
eti_reflow (GnomeCanvasItem *item, gint flags)
{
ETableItem *eti = E_TABLE_ITEM (item);
- if ( eti->needs_compute_height ) {
+
+ if (eti->needs_compute_height) {
int new_height = eti_get_height (eti);
- if ( new_height != eti->height ) {
+
+ if (new_height != eti->height) {
eti->height = new_height;
- e_canvas_item_request_parent_reflow(GNOME_CANVAS_ITEM(eti));
+ e_canvas_item_request_parent_reflow (GNOME_CANVAS_ITEM (eti));
+ eti->needs_redraw = 1;
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
}
eti->needs_compute_height = 0;
}
@@ -159,37 +182,28 @@ eti_reflow (GnomeCanvasItem *item, gint flags)
static void
eti_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
{
- double i2c [6];
- ArtPoint c1, c2, i1, i2;
+ ArtPoint o1, o2;
ETableItem *eti = E_TABLE_ITEM (item);
if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)
(*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)(item, affine, clip_path, flags);
-
- gnome_canvas_item_i2c_affine (item, i2c);
- i1.x = eti->x1;
- i1.y = eti->y1;
- i2.x = eti->x1 + eti->width;
- i2.y = eti->y1 + eti->height;
- art_affine_point (&c1, &i1, i2c);
- art_affine_point (&c2, &i2, i2c);
+
+ o1.x = item->x1;
+ o1.y = item->y1;
+ o2.x = item->x2;
+ o2.y = item->y2;
eti_bounds (item, &item->x1, &item->y1, &item->x2, &item->y2);
- if ( item->x1 != c1.x ||
- item->y1 != c1.y ||
- item->x2 != c2.x + 1 ||
- item->y2 != c2.y + 1 )
- {
- gnome_canvas_request_redraw(item->canvas, item->x1, item->y1, item->x2, item->y2);
- item->x1 = c1.x;
- item->y1 = c1.y;
- item->x2 = c2.x + 1;
- item->y2 = c2.y + 1;
- eti->needs_redraw = 1;
- }
- if ( eti->needs_redraw ) {
- gnome_canvas_request_redraw(item->canvas, 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)
+ eti->needs_redraw = 1;
+
+ if (eti->needs_redraw) {
+ gnome_canvas_request_redraw (item->canvas, item->x1, item->y1,
+ item->x2, item->y2);
eti->needs_redraw = 0;
}
}
@@ -338,14 +352,13 @@ eti_table_model_changed (ETableModel *table_model, ETableItem *eti)
{
eti->rows = e_table_model_row_count (eti->table_model);
- if (eti->focused_row > eti->rows - 1) {
+ if (eti->focused_row > eti->rows - 1)
eti->focused_row = eti->rows - 1;
- }
eti->needs_compute_height = 1;
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(eti));
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
eti->needs_redraw = 1;
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti));
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
}
/* Unused. */
@@ -409,7 +422,7 @@ eti_request_region_redraw (ETableItem *eti,
static void
eti_table_model_row_changed (ETableModel *table_model, int row, ETableItem *eti)
{
- if (eti->renderers_can_change_size){
+ if (eti->renderers_can_change_size) {
eti_table_model_changed (table_model, eti);
return;
}
@@ -454,7 +467,7 @@ eti_add_table_model (ETableItem *eti, ETableModel *table_model)
GTK_OBJECT (table_model), "model_row_changed",
GTK_SIGNAL_FUNC (eti_table_model_row_changed), eti);
- if (eti->header){
+ if (eti->header) {
eti_detach_cell_views (eti);
eti_attach_cell_views (eti);
}
@@ -466,7 +479,7 @@ static void
eti_header_dim_changed (ETableHeader *eth, int col, ETableItem *eti)
{
eti->needs_redraw = 1;
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti));
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
}
static void
@@ -486,13 +499,13 @@ eti_header_structure_changed (ETableHeader *eth, ETableItem *eti)
eti_attach_cell_views (eti);
eti_realize_cell_views (eti);
} else {
- if (eti->table_model){
+ if (eti->table_model) {
eti_detach_cell_views (eti);
eti_attach_cell_views (eti);
}
}
eti->needs_redraw = 1;
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti));
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
}
static void
@@ -611,7 +624,7 @@ eti_init (GnomeCanvasItem *item)
eti->needs_redraw = 0;
eti->needs_compute_height = 0;
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(eti), eti_reflow);
+ e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM (eti), eti_reflow);
}
#define gray50_width 2
@@ -658,9 +671,9 @@ eti_realize (GnomeCanvasItem *item)
eti_realize_cell_views (eti);
eti->needs_compute_height = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(eti));
+ e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
eti->needs_redraw = 1;
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti));
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
}
static void
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 2a2458adbd..70efe582ba 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -130,9 +130,8 @@ static void
sort_info_changed (ETableSortInfo *info, ETable *et)
{
et->need_rebuild = TRUE;
- if ( !et->rebuild_idle_id ) {
- et->rebuild_idle_id = g_idle_add(changed_idle, et);
- }
+ if (!et->rebuild_idle_id)
+ et->rebuild_idle_id = g_idle_add (changed_idle, et);
}
static void
@@ -144,20 +143,20 @@ e_table_setup_header (ETable *e_table)
gtk_widget_show (GTK_WIDGET (e_table->header_canvas));
- root = xmlDocGetRootElement(e_table->specification);
- grouping = e_xml_get_child_by_name(root, "grouping");
+ root = xmlDocGetRootElement (e_table->specification);
+ grouping = e_xml_get_child_by_name (root, "grouping");
- e_table->sort_info = e_table_sort_info_new();
+ e_table->sort_info = e_table_sort_info_new ();
- gtk_object_ref(GTK_OBJECT(e_table->sort_info));
- gtk_object_sink(GTK_OBJECT(e_table->sort_info));
+ gtk_object_ref (GTK_OBJECT (e_table->sort_info));
+ gtk_object_sink (GTK_OBJECT (e_table->sort_info));
- gtk_object_set(GTK_OBJECT(e_table->sort_info),
- "grouping", grouping,
- NULL);
+ gtk_object_set (GTK_OBJECT (e_table->sort_info),
+ "grouping", grouping,
+ NULL);
e_table->sort_info_change_id =
- gtk_signal_connect (GTK_OBJECT(e_table->sort_info), "sort_info_changed",
+ gtk_signal_connect (GTK_OBJECT (e_table->sort_info), "sort_info_changed",
GTK_SIGNAL_FUNC (sort_info_changed), e_table);
e_table->header_item = gnome_canvas_item_new (
@@ -576,42 +575,46 @@ e_table_canvas_new (ETable *e_table)
#endif
static void
-table_canvas_size_allocate (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);
+
+ 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, MAX(height, alloc->height));
+ 0, 0, alloc->width, MAX (height, alloc->height));
width = alloc->width;
- gtk_object_set(GTK_OBJECT(e_table->group),
- "width", width,
- NULL);
+ gtk_object_set (GTK_OBJECT (e_table->group),
+ "width", width,
+ NULL);
}
static void
table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table)
{
- table_canvas_size_allocate (GTK_WIDGET(canvas), &(GTK_WIDGET(canvas)->allocation), e_table);
+ table_canvas_size_allocate (GTK_WIDGET (canvas),
+ &(GTK_WIDGET (canvas)->allocation),
+ e_table);
}
static void
change_row (gpointer key, gpointer value, gpointer data)
{
- ETable *et = E_TABLE(data);
- gint row = GPOINTER_TO_INT(key);
- if ( e_table_group_remove(et->group, row) ) {
- e_table_group_add(et->group, row);
- }
+ ETable *et = E_TABLE (data);
+ gint row = GPOINTER_TO_INT (key);
+
+ if (e_table_group_remove (et->group, row))
+ e_table_group_add (et->group, row);
}
static void
group_row_selection (ETableGroup *etg, int row, gboolean selected, ETable *et)
{
- gtk_signal_emit (GTK_OBJECT(et),
+ gtk_signal_emit (GTK_OBJECT (et),
et_signals [ROW_SELECTION],
row, selected);
}
@@ -619,30 +622,33 @@ group_row_selection (ETableGroup *etg, int row, gboolean selected, ETable *et)
static gboolean
changed_idle (gpointer data)
{
- ETable *et = E_TABLE(data);
- if ( et->need_rebuild ) {
- gtk_object_destroy( GTK_OBJECT(et->group ) );
- et->group = e_table_group_new(GNOME_CANVAS_GROUP(et->table_canvas->root),
- et->full_header,
- et->header,
- et->model,
- e_xml_get_child_by_name(xmlDocGetRootElement(et->specification), "grouping")->childs);
- gtk_signal_connect(GTK_OBJECT(et->group), "row_selection",
- GTK_SIGNAL_FUNC(group_row_selection), et);
- e_table_fill_table(et, et->model);
+ ETable *et = E_TABLE (data);
+
+ if (et->need_rebuild) {
+ gtk_object_destroy (GTK_OBJECT (et->group));
+ et->group = e_table_group_new (GNOME_CANVAS_GROUP (et->table_canvas->root),
+ et->full_header,
+ et->header,
+ et->model,
+ e_xml_get_child_by_name (xmlDocGetRootElement (et->specification),
+ "grouping")->childs);
+ gtk_signal_connect (GTK_OBJECT (et->group), "row_selection",
+ GTK_SIGNAL_FUNC (group_row_selection), et);
+ e_table_fill_table (et, et->model);
- gtk_object_set(GTK_OBJECT(et->group),
- "width", (double) GTK_WIDGET(et->table_canvas)->allocation.width,
- NULL);
- } else if (et->need_row_changes) {
- g_hash_table_foreach(et->row_changes_list, change_row, et);
- }
+ gtk_object_set (GTK_OBJECT (et->group),
+ "width", (double) GTK_WIDGET (et->table_canvas)->allocation.width,
+ NULL);
+ } else if (et->need_row_changes)
+ g_hash_table_foreach (et->row_changes_list, change_row, et);
+
et->need_rebuild = 0;
et->need_row_changes = 0;
if (et->row_changes_list)
- g_hash_table_destroy(et->row_changes_list);
+ g_hash_table_destroy (et->row_changes_list);
et->row_changes_list = NULL;
et->rebuild_idle_id = 0;
+
return FALSE;
}
@@ -650,38 +656,39 @@ static void
et_table_model_changed (ETableModel *model, ETable *et)
{
et->need_rebuild = TRUE;
- if ( !et->rebuild_idle_id ) {
- et->rebuild_idle_id = g_idle_add(changed_idle, et);
- }
+ if (!et->rebuild_idle_id)
+ et->rebuild_idle_id = g_idle_add (changed_idle, et);
}
static void
et_table_row_changed (ETableModel *table_model, int row, ETable *et)
{
- if ( !et->need_rebuild ) {
+ if (!et->need_rebuild) {
if (!et->need_row_changes) {
et->need_row_changes = 1;
et->row_changes_list = g_hash_table_new (g_direct_hash, g_direct_equal);
}
- if (!g_hash_table_lookup(et->row_changes_list, GINT_TO_POINTER(row))) {
- g_hash_table_insert(et->row_changes_list, GINT_TO_POINTER(row), GINT_TO_POINTER(row + 1));
+ if (!g_hash_table_lookup (et->row_changes_list, GINT_TO_POINTER (row))) {
+ g_hash_table_insert (et->row_changes_list, GINT_TO_POINTER (row),
+ GINT_TO_POINTER (row + 1));
}
}
- if ( !et->rebuild_idle_id ) {
+
+ if ( !et->rebuild_idle_id )
et->rebuild_idle_id = g_idle_add(changed_idle, et);
- }
}
static void
et_table_cell_changed (ETableModel *table_model, int view_col, int row, ETable *et)
{
- et_table_row_changed(table_model, row, et);
+ et_table_row_changed (table_model, row, et);
}
static void
-e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *header, ETableModel *model, xmlNode *xml_grouping)
+e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *header,
+ ETableModel *model, xmlNode *xml_grouping)
{
- e_table->table_canvas = GNOME_CANVAS(e_canvas_new ());
+ e_table->table_canvas = GNOME_CANVAS (e_canvas_new ());
gtk_signal_connect (
GTK_OBJECT (e_table->table_canvas), "size_allocate",
GTK_SIGNAL_FUNC (table_canvas_size_allocate), e_table);
@@ -691,11 +698,11 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h
gtk_widget_show (GTK_WIDGET (e_table->table_canvas));
- e_table->group = e_table_group_new(GNOME_CANVAS_GROUP(e_table->table_canvas->root),
- full_header,
- header,
- model,
- xml_grouping->childs);
+ e_table->group = e_table_group_new (GNOME_CANVAS_GROUP (e_table->table_canvas->root),
+ full_header,
+ header,
+ model,
+ xml_grouping->childs);
gtk_signal_connect(GTK_OBJECT(e_table->group), "row_selection",
GTK_SIGNAL_FUNC(group_row_selection), e_table);
@@ -715,23 +722,21 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h
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);
+ int count, 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);
}
static void
et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
- xmlDoc *xmlSpec)
+ xmlDoc *xmlSpec)
{
xmlNode *xmlRoot;
xmlNode *xmlColumns;
@@ -760,18 +765,18 @@ et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
e_table_setup_table (e_table, full_header, e_table->header, etm, xmlGrouping);
e_table_fill_table (e_table, etm);
- vbox = gtk_vbox_new(FALSE, 0);
+ vbox = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET (e_table->header_canvas), FALSE, FALSE, 0 );
- gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET (e_table->table_canvas), TRUE, TRUE, 0 );
+ gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (e_table->header_canvas), FALSE, FALSE, 0 );
+ gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (e_table->table_canvas), TRUE, TRUE, 0 );
- gtk_widget_show(vbox);
+ gtk_widget_show (vbox);
- gtk_box_pack_start( GTK_BOX(e_table), vbox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (e_table), vbox, TRUE, TRUE, 0);
- vscrollbar = gtk_vscrollbar_new(gtk_layout_get_vadjustment(GTK_LAYOUT(e_table->table_canvas)));
+ vscrollbar = gtk_vscrollbar_new (gtk_layout_get_vadjustment (GTK_LAYOUT (e_table->table_canvas)));
gtk_widget_show (vscrollbar);
- gtk_box_pack_start( GTK_BOX(e_table), vscrollbar, FALSE, FALSE, 0 );
+ gtk_box_pack_start (GTK_BOX (e_table), vscrollbar, FALSE, FALSE, 0 );
gtk_widget_pop_colormap ();
gtk_widget_pop_visual ();
diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h
index 8d7fda340e..ecdeec1e83 100644
--- a/widgets/table/e-table.h
+++ b/widgets/table/e-table.h
@@ -73,4 +73,4 @@ void e_table_save_specification (ETable *e_table, gchar *filename);
END_GNOME_DECLS
- #endif /* _E_TABLE_H_ */
+#endif /* _E_TABLE_H_ */