aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/e-table/ChangeLog5
-rw-r--r--widgets/e-table/e-table-group-container.c2
-rw-r--r--widgets/e-table/e-table-header-item.c22
-rw-r--r--widgets/e-table/e-table-header-item.h2
-rw-r--r--widgets/table/e-table-group-container.c2
-rw-r--r--widgets/table/e-table-header-item.c22
-rw-r--r--widgets/table/e-table-header-item.h2
7 files changed, 47 insertions, 10 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 42f01d3863..c4c99971e9 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,5 +1,10 @@
2000-03-06 Christopher James Lahey <clahey@helixcode.com>
+ * e-table-header-item.c, e-table-header-item.h: Made it so that
+ columns would be properly indented.
+
+2000-03-06 Christopher James Lahey <clahey@helixcode.com>
+
* e-table-sorted-variable.c: Have identical values get sorted by
their actual row.
diff --git a/widgets/e-table/e-table-group-container.c b/widgets/e-table/e-table-group-container.c
index 589b59c976..f9ecaf4377 100644
--- a/widgets/e-table/e-table-group-container.c
+++ b/widgets/e-table/e-table-group-container.c
@@ -213,8 +213,8 @@ e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContaine
etgc->ascending = ascending;
etgc->font = gdk_font_load ("lucidasans-10");
+ etgc->open = TRUE;
#if 0
- etgc->open = open;
etgc->transparent = transparent;
etgc_dim (etgc, &etgc->width, &etgc->height);
diff --git a/widgets/e-table/e-table-header-item.c b/widgets/e-table/e-table-header-item.c
index 82637a8a82..b8fe005753 100644
--- a/widgets/e-table/e-table-header-item.c
+++ b/widgets/e-table/e-table-header-item.c
@@ -29,6 +29,8 @@
#define MIN_ARROW_SIZE 10
+#define GROUP_INDENT 10
+
/* Defines the tolerance for proximity of the column division to the cursor position */
#define TOLERANCE 2
@@ -131,7 +133,7 @@ ethi_drop_table_header (ETableHeaderItem *ethi)
static void
structure_changed (ETableHeader *header, ETableHeaderItem *ethi)
{
- ethi->width = e_table_header_total_width (header);
+ ethi->width = e_table_header_total_width (header) + ethi->group_indent_width;
ethi_update (GNOME_CANVAS_ITEM (ethi), NULL, NULL, 0);
}
@@ -139,7 +141,7 @@ structure_changed (ETableHeader *header, ETableHeaderItem *ethi)
static void
dimension_changed (ETableHeader *header, int col, ETableHeaderItem *ethi)
{
- ethi->width = e_table_header_total_width (header);
+ ethi->width = e_table_header_total_width (header) + ethi->group_indent_width;
ethi_update (GNOME_CANVAS_ITEM (ethi), NULL, NULL, 0);
}
@@ -149,7 +151,7 @@ ethi_add_table_header (ETableHeaderItem *ethi, ETableHeader *header)
{
ethi->eth = header;
gtk_object_ref (GTK_OBJECT (ethi->eth));
- ethi->width = e_table_header_total_width (header);
+ ethi->width = e_table_header_total_width (header) + ethi->group_indent_width;
ethi->structure_change_id = gtk_signal_connect (
GTK_OBJECT (header), "structure_change",
@@ -204,6 +206,8 @@ ethi_find_col_by_x (ETableHeaderItem *ethi, int x)
if (x < x1)
return -1;
+
+ x1 += ethi->group_indent_width;
for (col = 0; col < cols; col++){
ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
@@ -252,6 +256,9 @@ ethi_add_drop_marker (ETableHeaderItem *ethi, int col)
x = e_table_header_col_diff (ethi->eth, 0, col);
+ if ( col > 0 )
+ x += ethi->group_indent_width;
+
points->coords [0] = ethi->x1 + x - 5;
points->coords [1] = ethi->y1;
points->coords [2] = points->coords [0] + 10;
@@ -574,6 +581,7 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
int col;
GHashTable *arrows = g_hash_table_new(NULL, NULL);
xmlNode *node;
+ gint group_indent = 0;
#if 0
printf ("My coords are: %g %g %g %g\n",
@@ -586,6 +594,7 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
"grouping", &grouping,
NULL);
for (node = grouping->childs; node && strcmp(node->name, "leaf"); node = node->childs) {
+ group_indent ++;
g_hash_table_insert(arrows,
(gpointer) e_xml_get_integer_prop_by_name(node, "column"),
(gpointer) (e_xml_get_integer_prop_by_name(node, "ascending") ?
@@ -600,7 +609,10 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
E_TABLE_COL_ARROW_UP));
}
+ ethi->group_indent_width = group_indent * GROUP_INDENT;
+ ethi->width = e_table_header_total_width (ethi->eth) + ethi->group_indent_width;
x1 = x2 = ethi->x1;
+ x2 += ethi->group_indent_width;
for (col = 0; col < cols; col++, x1 = x2){
ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
int col_width;
@@ -622,7 +634,7 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
draw_button (ethi, ecol, drawable, gc,
GTK_WIDGET (canvas)->style,
- x1 - x, ethi->y1 - y, col_width, ethi->height,
+ x1 - x, ethi->y1 - y, x2 - x1, ethi->height,
(ETableColArrow) g_hash_table_lookup(arrows, (gpointer) ecol->col_idx) );
}
g_hash_table_destroy(arrows);
@@ -994,6 +1006,8 @@ ethi_init (GnomeCanvasItem *item)
ethi->drag_mark = -1;
ethi->sort_info = NULL;
+
+ ethi->group_indent_width = 0;
}
GtkType
diff --git a/widgets/e-table/e-table-header-item.h b/widgets/e-table/e-table-header-item.h
index cc3cf8e4f6..32d87025d6 100644
--- a/widgets/e-table/e-table-header-item.h
+++ b/widgets/e-table/e-table-header-item.h
@@ -33,6 +33,8 @@ typedef struct {
GtkObject *resize_guide;
+ int group_indent_width;
+
/*
* Ids
*/
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c
index 589b59c976..f9ecaf4377 100644
--- a/widgets/table/e-table-group-container.c
+++ b/widgets/table/e-table-group-container.c
@@ -213,8 +213,8 @@ e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContaine
etgc->ascending = ascending;
etgc->font = gdk_font_load ("lucidasans-10");
+ etgc->open = TRUE;
#if 0
- etgc->open = open;
etgc->transparent = transparent;
etgc_dim (etgc, &etgc->width, &etgc->height);
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index 82637a8a82..b8fe005753 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -29,6 +29,8 @@
#define MIN_ARROW_SIZE 10
+#define GROUP_INDENT 10
+
/* Defines the tolerance for proximity of the column division to the cursor position */
#define TOLERANCE 2
@@ -131,7 +133,7 @@ ethi_drop_table_header (ETableHeaderItem *ethi)
static void
structure_changed (ETableHeader *header, ETableHeaderItem *ethi)
{
- ethi->width = e_table_header_total_width (header);
+ ethi->width = e_table_header_total_width (header) + ethi->group_indent_width;
ethi_update (GNOME_CANVAS_ITEM (ethi), NULL, NULL, 0);
}
@@ -139,7 +141,7 @@ structure_changed (ETableHeader *header, ETableHeaderItem *ethi)
static void
dimension_changed (ETableHeader *header, int col, ETableHeaderItem *ethi)
{
- ethi->width = e_table_header_total_width (header);
+ ethi->width = e_table_header_total_width (header) + ethi->group_indent_width;
ethi_update (GNOME_CANVAS_ITEM (ethi), NULL, NULL, 0);
}
@@ -149,7 +151,7 @@ ethi_add_table_header (ETableHeaderItem *ethi, ETableHeader *header)
{
ethi->eth = header;
gtk_object_ref (GTK_OBJECT (ethi->eth));
- ethi->width = e_table_header_total_width (header);
+ ethi->width = e_table_header_total_width (header) + ethi->group_indent_width;
ethi->structure_change_id = gtk_signal_connect (
GTK_OBJECT (header), "structure_change",
@@ -204,6 +206,8 @@ ethi_find_col_by_x (ETableHeaderItem *ethi, int x)
if (x < x1)
return -1;
+
+ x1 += ethi->group_indent_width;
for (col = 0; col < cols; col++){
ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
@@ -252,6 +256,9 @@ ethi_add_drop_marker (ETableHeaderItem *ethi, int col)
x = e_table_header_col_diff (ethi->eth, 0, col);
+ if ( col > 0 )
+ x += ethi->group_indent_width;
+
points->coords [0] = ethi->x1 + x - 5;
points->coords [1] = ethi->y1;
points->coords [2] = points->coords [0] + 10;
@@ -574,6 +581,7 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
int col;
GHashTable *arrows = g_hash_table_new(NULL, NULL);
xmlNode *node;
+ gint group_indent = 0;
#if 0
printf ("My coords are: %g %g %g %g\n",
@@ -586,6 +594,7 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
"grouping", &grouping,
NULL);
for (node = grouping->childs; node && strcmp(node->name, "leaf"); node = node->childs) {
+ group_indent ++;
g_hash_table_insert(arrows,
(gpointer) e_xml_get_integer_prop_by_name(node, "column"),
(gpointer) (e_xml_get_integer_prop_by_name(node, "ascending") ?
@@ -600,7 +609,10 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
E_TABLE_COL_ARROW_UP));
}
+ ethi->group_indent_width = group_indent * GROUP_INDENT;
+ ethi->width = e_table_header_total_width (ethi->eth) + ethi->group_indent_width;
x1 = x2 = ethi->x1;
+ x2 += ethi->group_indent_width;
for (col = 0; col < cols; col++, x1 = x2){
ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
int col_width;
@@ -622,7 +634,7 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
draw_button (ethi, ecol, drawable, gc,
GTK_WIDGET (canvas)->style,
- x1 - x, ethi->y1 - y, col_width, ethi->height,
+ x1 - x, ethi->y1 - y, x2 - x1, ethi->height,
(ETableColArrow) g_hash_table_lookup(arrows, (gpointer) ecol->col_idx) );
}
g_hash_table_destroy(arrows);
@@ -994,6 +1006,8 @@ ethi_init (GnomeCanvasItem *item)
ethi->drag_mark = -1;
ethi->sort_info = NULL;
+
+ ethi->group_indent_width = 0;
}
GtkType
diff --git a/widgets/table/e-table-header-item.h b/widgets/table/e-table-header-item.h
index cc3cf8e4f6..32d87025d6 100644
--- a/widgets/table/e-table-header-item.h
+++ b/widgets/table/e-table-header-item.h
@@ -33,6 +33,8 @@ typedef struct {
GtkObject *resize_guide;
+ int group_indent_width;
+
/*
* Ids
*/