aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/e-table/ChangeLog4
-rw-r--r--widgets/e-table/e-cell-text.c18
-rw-r--r--widgets/e-table/e-cell-text.h5
-rw-r--r--widgets/e-table/e-table-item.c2
-rw-r--r--widgets/table/e-cell-text.c18
-rw-r--r--widgets/table/e-cell-text.h5
-rw-r--r--widgets/table/e-table-item.c2
7 files changed, 46 insertions, 8 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 431d77976f..972775ee52 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,5 +1,9 @@
2000-06-01 Christopher James Lahey <clahey@helixcode.com>
+ * e-table-item.c: Copy and paste error.
+
+2000-06-01 Christopher James Lahey <clahey@helixcode.com>
+
* e-table-group-container.c, e-table-group-leaf.c,
e-table-group.c, e-table-group.h, e-table-item.c, e-table.c,
e-table.h: Added e_table_get_selected_view_row.
diff --git a/widgets/e-table/e-cell-text.c b/widgets/e-table/e-cell-text.c
index a354efde13..d7ef682fde 100644
--- a/widgets/e-table/e-cell-text.c
+++ b/widgets/e-table/e-cell-text.c
@@ -73,6 +73,7 @@ enum {
ARG_ELLIPSIS,
ARG_STRIKEOUT_COLUMN,
ARG_BOLD_COLUMN,
+ ARG_TEXT_FILTER,
};
@@ -1045,7 +1046,13 @@ ect_height (ECellView *ecell_view, int model_col, int view_col, int row)
GdkFont *font;
font = text_view->font;
- return (font->ascent + font->descent) * number_of_lines(e_table_model_value_at (ecell_view->e_table_model, model_col, row)) + TEXT_PAD;
+ if (text_view->filter) {
+ char *string = text_view->filter(e_table_model_value_at (ecell_view->e_table_model, model_col, row));
+ int value = (font->ascent + font->descent) * number_of_lines(string) + TEXT_PAD;
+ g_free(string);
+ return value;
+ } else
+ return (font->ascent + font->descent) * number_of_lines(e_table_model_value_at (ecell_view->e_table_model, model_col, row)) + TEXT_PAD;
}
/*
@@ -1055,7 +1062,7 @@ static void *
ect_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
{
ECellTextView *text_view = (ECellTextView *) ecell_view;
- const char *str = e_table_model_value_at (ecell_view->e_table_model, model_col, row);
+ char *str;
CellEdit *edit;
edit = g_new (CellEdit, 1);
@@ -1096,7 +1103,12 @@ ect_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
edit->pointer_in = FALSE;
edit->default_cursor_shown = TRUE;
- edit->old_text = g_strdup (str);
+ if (ect->filter) {
+ str = ect->filter(e_table_model_value_at (ecell_view->e_table_model, model_col, row));
+ edit->old_text = str;
+ } else {
+ edit->old_text = g_strdup (str);
+ }
edit->cell.text = g_strdup (str);
#if 0
diff --git a/widgets/e-table/e-cell-text.h b/widgets/e-table/e-cell-text.h
index dc8d8300bf..59b6558157 100644
--- a/widgets/e-table/e-cell-text.h
+++ b/widgets/e-table/e-cell-text.h
@@ -27,6 +27,9 @@
#include <libgnomeui/gnome-canvas.h>
#include "e-cell.h"
+/* Should return a malloced object. */
+typedef char *(*ECellTextFilter) (void *);
+
#define E_CELL_TEXT_TYPE (e_cell_text_get_type ())
#define E_CELL_TEXT(o) (GTK_CHECK_CAST ((o), E_CELL_TEXT_TYPE, ECellText))
#define E_CELL_TEXT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TEXT_TYPE, ECellTextClass))
@@ -50,6 +53,8 @@ typedef struct {
int strikeout_column;
int bold_column;
+
+ ECellTextFilter *filter;
} ECellText;
typedef struct {
diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c
index 1a10363fcc..90fcfdb7b1 100644
--- a/widgets/e-table/e-table-item.c
+++ b/widgets/e-table/e-table-item.c
@@ -1410,7 +1410,7 @@ eti_class_init (GtkObjectClass *object_class)
GTK_ARG_READABLE, ARG_HEIGHT);
gtk_object_add_arg_type ("ETableItem::has_cursor", GTK_TYPE_BOOL,
GTK_ARG_READWRITE, ARG_HAS_CURSOR);
- gtk_object_add_arg_type ("ETableItem::has_cursor", GTK_TYPE_INT,
+ gtk_object_add_arg_type ("ETableItem::cursor_row", GTK_TYPE_INT,
GTK_ARG_READABLE, ARG_CURSOR_ROW);
eti_signals [ROW_SELECTION] =
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index a354efde13..d7ef682fde 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -73,6 +73,7 @@ enum {
ARG_ELLIPSIS,
ARG_STRIKEOUT_COLUMN,
ARG_BOLD_COLUMN,
+ ARG_TEXT_FILTER,
};
@@ -1045,7 +1046,13 @@ ect_height (ECellView *ecell_view, int model_col, int view_col, int row)
GdkFont *font;
font = text_view->font;
- return (font->ascent + font->descent) * number_of_lines(e_table_model_value_at (ecell_view->e_table_model, model_col, row)) + TEXT_PAD;
+ if (text_view->filter) {
+ char *string = text_view->filter(e_table_model_value_at (ecell_view->e_table_model, model_col, row));
+ int value = (font->ascent + font->descent) * number_of_lines(string) + TEXT_PAD;
+ g_free(string);
+ return value;
+ } else
+ return (font->ascent + font->descent) * number_of_lines(e_table_model_value_at (ecell_view->e_table_model, model_col, row)) + TEXT_PAD;
}
/*
@@ -1055,7 +1062,7 @@ static void *
ect_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
{
ECellTextView *text_view = (ECellTextView *) ecell_view;
- const char *str = e_table_model_value_at (ecell_view->e_table_model, model_col, row);
+ char *str;
CellEdit *edit;
edit = g_new (CellEdit, 1);
@@ -1096,7 +1103,12 @@ ect_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
edit->pointer_in = FALSE;
edit->default_cursor_shown = TRUE;
- edit->old_text = g_strdup (str);
+ if (ect->filter) {
+ str = ect->filter(e_table_model_value_at (ecell_view->e_table_model, model_col, row));
+ edit->old_text = str;
+ } else {
+ edit->old_text = g_strdup (str);
+ }
edit->cell.text = g_strdup (str);
#if 0
diff --git a/widgets/table/e-cell-text.h b/widgets/table/e-cell-text.h
index dc8d8300bf..59b6558157 100644
--- a/widgets/table/e-cell-text.h
+++ b/widgets/table/e-cell-text.h
@@ -27,6 +27,9 @@
#include <libgnomeui/gnome-canvas.h>
#include "e-cell.h"
+/* Should return a malloced object. */
+typedef char *(*ECellTextFilter) (void *);
+
#define E_CELL_TEXT_TYPE (e_cell_text_get_type ())
#define E_CELL_TEXT(o) (GTK_CHECK_CAST ((o), E_CELL_TEXT_TYPE, ECellText))
#define E_CELL_TEXT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TEXT_TYPE, ECellTextClass))
@@ -50,6 +53,8 @@ typedef struct {
int strikeout_column;
int bold_column;
+
+ ECellTextFilter *filter;
} ECellText;
typedef struct {
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 1a10363fcc..90fcfdb7b1 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -1410,7 +1410,7 @@ eti_class_init (GtkObjectClass *object_class)
GTK_ARG_READABLE, ARG_HEIGHT);
gtk_object_add_arg_type ("ETableItem::has_cursor", GTK_TYPE_BOOL,
GTK_ARG_READWRITE, ARG_HAS_CURSOR);
- gtk_object_add_arg_type ("ETableItem::has_cursor", GTK_TYPE_INT,
+ gtk_object_add_arg_type ("ETableItem::cursor_row", GTK_TYPE_INT,
GTK_ARG_READABLE, ARG_CURSOR_ROW);
eti_signals [ROW_SELECTION] =