aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--widgets/text/e-text-model-test.c8
-rw-r--r--widgets/text/e-text-model-uri.c231
-rw-r--r--widgets/text/e-text-model.c51
-rw-r--r--widgets/text/e-text-model.h5
-rw-r--r--widgets/text/e-text.c97
-rw-r--r--widgets/text/e-text.h4
6 files changed, 63 insertions, 333 deletions
diff --git a/widgets/text/e-text-model-test.c b/widgets/text/e-text-model-test.c
index 8f528efce1..0c758cd4ba 100644
--- a/widgets/text/e-text-model-test.c
+++ b/widgets/text/e-text-model-test.c
@@ -38,9 +38,7 @@ main (int argc, gchar **argv)
gnome_init ("ETextModelTest", "0.0", argc, argv);
model = e_text_model_uri_new ();
- e_text_model_set_text (model, "My favorite website is http://www.ximian.com. My next favorite is www.assbarn.com.");
-
- describe_model (model);
+ e_text_model_set_text (model, "My favorite website is http://www.ximian.com. My next favorite is http://www.gnome.org.");
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@@ -54,9 +52,9 @@ main (int argc, gchar **argv)
e_text_get_type (),
"model", model,
"font", "-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1",
- "anchor", GTK_ANCHOR_NORTH_WEST,
+ "anchor", GTK_ANCHOR_SOUTH_WEST,
"line_wrap", TRUE,
- "width", 300.0,
+ "width", 150.0,
"editable", TRUE,
NULL);
diff --git a/widgets/text/e-text-model-uri.c b/widgets/text/e-text-model-uri.c
index b769d0b70a..bd8dbb18e8 100644
--- a/widgets/text/e-text-model-uri.c
+++ b/widgets/text/e-text-model-uri.c
@@ -9,21 +9,15 @@
#include <config.h>
#include <ctype.h>
-#include <sys/types.h>
-#include <regex.h>
#include "e-text-model-uri.h"
static void e_text_model_uri_class_init (ETextModelURIClass *class);
static void e_text_model_uri_init (ETextModelURI *model);
static void e_text_model_uri_destroy (GtkObject *object);
-static void objectify_uris (ETextModelURI *model, gint position);
+static void objectify_uris (ETextModelURI *model);
static void e_text_model_uri_set_text (ETextModel *model, gchar *text);
-static void e_text_model_uri_insert (ETextModel *model, gint position, gchar *text);
-static void e_text_model_uri_insert_length (ETextModel *model, gint position, gchar *text, gint length);
-static void e_text_model_uri_delete (ETextModel *model, gint position, gint length);
-
static const gchar *e_text_model_uri_get_nth_object (ETextModel *model, gint);
static void e_text_model_uri_activate_nth_object (ETextModel *model, gint);
@@ -66,10 +60,6 @@ e_text_model_uri_class_init (ETextModelURIClass *klass)
object_class->destroy = e_text_model_uri_destroy;
model_class->set_text = e_text_model_uri_set_text;
- model_class->insert = e_text_model_uri_insert;
- model_class->insert_length = e_text_model_uri_insert_length;
- model_class->delete = e_text_model_uri_delete;
-
model_class->get_nth_obj = e_text_model_uri_get_nth_object;
model_class->activate_nth_obj = e_text_model_uri_activate_nth_object;
}
@@ -88,169 +78,66 @@ e_text_model_uri_destroy (GtkObject *object)
}
-/* URL regexps taken from gnome-terminal */
-static const gchar *url_regexs[3] = {
- "(((news|telnet|nttp|file|http|ftp|https)://)|(www|ftp))[-A-Za-z0-9\\.]+(:[0-9]*)?/[-A-Za-z0-9_\\$\\.\\+\\!\\*\\(\\),;:@&=\\?/~\\#\\%]*[^]'\\.}>\\) ,\\\"]",
- "(((news|telnet|nttp|file|http|ftp|https)://)|(www|ftp))[-A-Za-z0-9\\.]+[-A-Za-z0-9](:[0-9]*)?",
- "mailto:[A-Za-z0-9_]+@[-A-Za-z0-9_]+\\.[-A-Za-z0-9\\.]+[-A-Za-z0-9]"
-};
-
-static void
-objectify_uris (ETextModelURI *model_uri, gint position)
+static gchar *
+extract_uri (gchar **in_str)
{
- static gboolean initialized = FALSE;
- static regex_t re_full, re_part, re_mail;
+ gchar *s = *in_str;
+ if (strncmp (s, "http://", 7) == 0) {
+ gint periods=0;
+ gchar *uri;
- ETextModel *model = E_TEXT_MODEL (model_uri);
- regmatch_t match;
- GList *uris = NULL, *iter;
- gint i, j, offset, last, len, objN;
- gchar *in_str, *new_str;
- gint new_position = position, pos_adjust=0;
-
- if (model->text == NULL)
- return;
-
- if (!initialized) {
-
- if (regcomp (&re_full, url_regexs[0], REG_EXTENDED))
- g_error ("Regex compile failed: %s", url_regexs[0]);
- if (regcomp (&re_part, url_regexs[1], REG_EXTENDED))
- g_error ("Regex compile failed: %s", url_regexs[1]);
- if (regcomp (&re_mail, url_regexs[2], REG_EXTENDED))
- g_error ("Regex compile failed: %s", url_regexs[2]);
+ s += 7;
+ while (*s && (isalnum((gint) *s) || (*s == '.' && periods < 2))) {
+ if (*s == '.')
+ ++periods;
+ ++s;
+ }
- initialized = TRUE;
- }
+ uri = g_strndup (*in_str, s - *in_str);
+ *in_str = s;
+ return uri;
- /*** Expand objects in string, keeping track of position shifts ***/
-
- objN = e_text_model_object_count (model);
- if (objN == 0)
- in_str = g_strdup (model->text);
- else {
- gchar *src, *dest;
-
- /* Calculate length of expanded string. */
- len = strlen (model->text) - objN;
- for (i=0; i<objN; ++i)
- len += strlen (e_text_model_get_nth_object (model, i));
-
- in_str = g_new0 (gchar, len+1);
-
- src = model->text;
- dest = in_str;
- i = 0; /* object numbers */
- j = 0; /* string position */
- while (*src) {
- if (*src == '\1') {
- const gchar *src_obj;
-
- src_obj = e_text_model_get_nth_object (model, i);
-
- if (j < position)
- new_position += strlen (src_obj)-1;
-
- if (src_obj) {
- while (*src_obj) {
- *dest = *src_obj;
- ++dest;
- ++src_obj;
- }
- }
-
- ++src;
- ++i;
- ++j;
-
- } else {
-
- *dest = *src;
- ++src;
- ++dest;
- ++j;
- }
- }
+ } else {
+ *in_str = s+1;
+ return NULL;
}
+}
- len = strlen (in_str);
- new_str = g_new0 (gchar, len+1);
+static void
+objectify_uris (ETextModelURI *model_uri)
+{
+ ETextModel *model = E_TEXT_MODEL (model_uri);
+ gchar *new_text;
+ gchar *src, *dest;
+ GList *uris = NULL;
- offset = 0;
- j = 0;
- last = 0;
- while (offset < len
- && (regexec (&re_full, in_str+offset, 1, &match, 0) == 0
- || regexec (&re_part, in_str+offset, 1, &match, 0) == 0
- || regexec (&re_mail, in_str+offset, 1, &match, 0) == 0)) {
+ if (model->text == NULL)
+ return;
- gchar *uri_txt;
+ new_text = g_new0 (gchar, strlen (model->text)+1);
- if (offset+match.rm_so <= new_position
- && new_position <= offset+match.rm_eo) {
-
- /* We don't do transformations that straddle our cursor. */
- new_str[j] = in_str[offset];
- ++j;
- ++offset;
+ src = model->text;
+ dest = new_text;
+ while (*src) {
+ gchar *uri_str;
+ gchar *next = src;
+ if ( (uri_str = extract_uri (&next)) ) {
+ uris = g_list_append (uris, uri_str);
+ *dest = '\1';
} else {
-
- for (i=offset; i<offset+match.rm_so; ++i) {
- new_str[j] = in_str[i];
- ++j;
- }
-
- new_str[j] = '\1';
- ++j;
-
- uri_txt = g_strndup (in_str+offset+match.rm_so,
- match.rm_eo - match.rm_so);
- uris = g_list_append (uris, uri_txt);
-
- if (offset+match.rm_so < new_position)
- pos_adjust += match.rm_eo - match.rm_so - 1;
-
- offset += match.rm_eo;
+ *dest = *src;
}
- }
- new_position -= pos_adjust;
-
- /* Copy the last bit over. */
- while (offset < len) {
- new_str[j] = in_str[offset];
- ++j;
- ++offset;
+ ++dest;
+ src = next;
}
-#if 0
- for (i=0; i<strlen(new_str); ++i) {
- if (i == new_position)
- putchar ('#');
- if (new_str[i] == '\1')
- g_print ("[\1]");
- else
- putchar (new_str[i]);
- }
- putchar ('\n');
-#endif
+ g_free (model->text);
+ model->text = new_text;
- for (iter = model_uri->uris; iter != NULL; iter = g_list_next (iter))
- g_free (iter->data);
- g_list_free (model_uri->uris);
+ /* Leaking old list */
model_uri->uris = uris;
-
- g_free (in_str);
-
- if (E_TEXT_MODEL_CLASS(parent_class)->set_text)
- E_TEXT_MODEL_CLASS(parent_class)->set_text (model, new_str);
-
- g_free (new_str);
-
-
- if (new_position != position)
- e_text_model_suggest_position (model, new_position);
}
static void
@@ -259,35 +146,7 @@ e_text_model_uri_set_text (ETextModel *model, gchar *text)
if (E_TEXT_MODEL_CLASS(parent_class)->set_text)
E_TEXT_MODEL_CLASS(parent_class)->set_text (model, text);
- objectify_uris (E_TEXT_MODEL_URI (model), 0);
-}
-
-static void
-e_text_model_uri_insert (ETextModel *model, gint position, gchar *text)
-{
- if (E_TEXT_MODEL_CLASS(parent_class)->insert)
- E_TEXT_MODEL_CLASS(parent_class)->insert (model, position, text);
-
- objectify_uris (E_TEXT_MODEL_URI (model), position + strlen (text));
-}
-
-static void
-e_text_model_uri_insert_length (ETextModel *model, gint position, gchar *text, gint length)
-{
-
- if (E_TEXT_MODEL_CLASS(parent_class)->insert_length)
- E_TEXT_MODEL_CLASS(parent_class)->insert_length (model, position, text, length);
-
- objectify_uris (E_TEXT_MODEL_URI (model), position + length);
-}
-
-static void
-e_text_model_uri_delete (ETextModel *model, gint position, gint length)
-{
- if (E_TEXT_MODEL_CLASS(parent_class)->delete)
- E_TEXT_MODEL_CLASS(parent_class)->delete (model, position, length);
-
- objectify_uris (E_TEXT_MODEL_URI (model), position);
+ objectify_uris (E_TEXT_MODEL_URI (model));
}
static const gchar *
diff --git a/widgets/text/e-text-model.c b/widgets/text/e-text-model.c
index bbd442b46c..acd08ecb04 100644
--- a/widgets/text/e-text-model.c
+++ b/widgets/text/e-text-model.c
@@ -22,7 +22,6 @@
enum {
E_TEXT_MODEL_CHANGED,
- E_TEXT_MODEL_POSITION,
E_TEXT_MODEL_LAST_SIGNAL
};
@@ -34,9 +33,9 @@ static void e_text_model_destroy (GtkObject *object);
static gchar *e_text_model_real_get_text(ETextModel *model);
static void e_text_model_real_set_text(ETextModel *model, gchar *text);
-static void e_text_model_real_insert(ETextModel *model, gint position, gchar *text);
-static void e_text_model_real_insert_length(ETextModel *model, gint position, gchar *text, gint length);
-static void e_text_model_real_delete(ETextModel *model, gint position, gint length);
+static void e_text_model_real_insert(ETextModel *model, gint postion, gchar *text);
+static void e_text_model_real_insert_length(ETextModel *model, gint postion, gchar *text, gint length);
+static void e_text_model_real_delete(ETextModel *model, gint postion, gint length);
static gint e_text_model_real_object_count(ETextModel *model);
static const gchar *e_text_model_real_get_nth_object(ETextModel *model, gint n);
@@ -96,14 +95,6 @@ e_text_model_class_init (ETextModelClass *klass)
GTK_SIGNAL_OFFSET (ETextModelClass, changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
-
- e_text_model_signals[E_TEXT_MODEL_POSITION] =
- gtk_signal_new ("position",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETextModelClass, position),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
gtk_object_class_add_signals (object_class, e_text_model_signals, E_TEXT_MODEL_LAST_SIGNAL);
@@ -166,42 +157,26 @@ e_text_model_real_set_text(ETextModel *model, gchar *text)
static void
e_text_model_real_insert(ETextModel *model, gint position, gchar *text)
{
- gchar *temp;
-
- g_return_if_fail (0<= position && position <= strlen (model->text));
-
- temp = g_strdup_printf("%.*s%s%s", position, model->text, text, model->text + position);
-
+ gchar *temp = g_strdup_printf("%.*s%s%s", position, model->text, text, model->text + position);
if (model->text)
g_free(model->text);
model->text = temp;
e_text_model_changed(model);
-
- e_text_model_suggest_position (model, position + strlen(text));
}
static void
e_text_model_real_insert_length(ETextModel *model, gint position, gchar *text, gint length)
{
- gchar *temp;
-
- g_return_if_fail (0 <= position && position <= strlen (model->text));
-
- temp = g_strdup_printf("%.*s%.*s%s", position, model->text, length, text, model->text + position);
-
+ gchar *temp = g_strdup_printf("%.*s%.*s%s", position, model->text, length, text, model->text + position);
if (model->text)
g_free(model->text);
model->text = temp;
e_text_model_changed(model);
-
- e_text_model_suggest_position (model, position + length);
}
static void
e_text_model_real_delete(ETextModel *model, gint position, gint length)
{
- g_return_if_fail (0 <= position && position <= strlen (model->text));
-
memmove(model->text + position, model->text + position + length, strlen(model->text + position + length) + 1);
e_text_model_changed(model);
}
@@ -296,17 +271,6 @@ e_text_model_delete(ETextModel *model, gint position, gint length)
E_TEXT_MODEL_CLASS(GTK_OBJECT(model)->klass)->delete(model, position, length);
}
-void
-e_text_model_suggest_position(ETextModel *model, gint position)
-{
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_TEXT_MODEL (model));
- g_return_if_fail (0 <= position);
- g_return_if_fail (position <= strlen (model->text));
-
- gtk_signal_emit (GTK_OBJECT (model), e_text_model_signals[E_TEXT_MODEL_POSITION], position);
-}
-
gint
e_text_model_object_count(ETextModel *model)
{
@@ -366,10 +330,11 @@ e_text_model_strdup_expanded_text(ETextModel *model)
len -= N; /* Subtract out the \1s that signify the objects. */
for (i=0; i<N; ++i)
- len += strlen (e_text_model_get_nth_object (model, i));
+ len += strlen (e_text_model_get_nth_object (model ,i));
+
/* Next, allocate and build the expanded string. */
- expanded = g_new0 (gchar, len+2);
+ expanded = g_new0 (gchar, len+1);
src = model->text;
dest = expanded;
diff --git a/widgets/text/e-text-model.h b/widgets/text/e-text-model.h
index b8029c0e9e..7006b24eca 100644
--- a/widgets/text/e-text-model.h
+++ b/widgets/text/e-text-model.h
@@ -43,8 +43,7 @@ struct _ETextModelClass {
GtkObjectClass parent_class;
/* Signal */
- void (* changed) (ETextModel *model);
- void (* position) (ETextModel *model, gint position);
+ void (* changed) (ETextModel *model);
/* Virtual methods */
char *(* get_text) (ETextModel *model);
@@ -69,8 +68,6 @@ void e_text_model_insert(ETextModel *model, gint position, gchar *text);
void e_text_model_insert_length(ETextModel *model, gint position, gchar *text, gint length);
void e_text_model_delete(ETextModel *model, gint position, gint length);
-void e_text_model_suggest_position(ETextModel *model, gint position);
-
gint e_text_model_object_count(ETextModel *model);
const gchar *e_text_model_get_nth_object(ETextModel *model, gint n);
void e_text_model_activate_nth_object(ETextModel *model, gint n);
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index 1427a078ca..fbbe77dc0d 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -128,7 +128,6 @@ static void e_text_get_selection(EText *text, GdkAtom selection, guint32 time);
static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, guchar *data, gint length);
static void e_text_text_model_changed(ETextModel *model, EText *text);
-static void e_text_text_model_position(ETextModel *model, gint position, EText *text);
static void _get_tep(EText *text);
@@ -332,11 +331,6 @@ e_text_init (EText *text)
"changed",
GTK_SIGNAL_FUNC(e_text_text_model_changed),
text);
- text->model_position_signal_id =
- gtk_signal_connect(GTK_OBJECT(text->model),
- "position",
- GTK_SIGNAL_FUNC(e_text_text_model_position),
- text);
text->anchor = GTK_ANCHOR_CENTER;
text->justification = GTK_JUSTIFY_LEFT;
@@ -393,8 +387,6 @@ e_text_init (EText *text)
text->dbl_timeout = 0;
text->tpl_timeout = 0;
- text->rgba_object = 0x0000ffff;
-
text->draw_background = FALSE;
e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(text), e_text_reflow);
@@ -414,9 +406,6 @@ e_text_destroy (GtkObject *object)
if (text->model_changed_signal_id)
gtk_signal_disconnect(GTK_OBJECT(text->model),
text->model_changed_signal_id);
- if (text->model_position_signal_id)
- gtk_signal_disconnect(GTK_OBJECT(text->model),
- text->model_position_signal_id);
if (text->model)
gtk_object_unref(GTK_OBJECT(text->model));
@@ -476,48 +465,16 @@ e_text_destroy (GtkObject *object)
}
static void
-fix_selection (EText *text)
-{
- gint len = strlen (text->text);
-
- if (text->selection_start > len) {
- text->selection_start = len;
- }
- if (text->selection_end > len) {
- text->selection_end = len;
- }
-}
-
-static void
e_text_text_model_changed (ETextModel *model, EText *text)
{
- gint len;
-
text->text = e_text_model_get_text(model);
- len = strlen (text->text);
-
- fix_selection (text);
-
e_text_free_lines(text);
gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_CHANGED]);
- text->needs_redraw = 1;
text->needs_split_into_lines = 1;
e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(text));
}
static void
-e_text_text_model_position (ETextModel *model, gint position, EText *text)
-{
- /*
- For now, something very simple. We can worry about things
- like preserving a multi-char selection later.
- */
-
- text->selection_start = position;
- text->selection_end = position;
-}
-
-static void
get_bounds_item_relative (EText *text, double *px1, double *py1, double *px2, double *py2)
{
GnomeCanvasItem *item;
@@ -841,9 +798,6 @@ text_width_with_objects (ETextModel *model, gint object_num,
gchar *c;
gint width = 0;
- if (text == NULL)
- return 0;
-
while (*text && numbytes > 0) {
c = text;
@@ -895,14 +849,11 @@ static void
text_draw_with_objects (ETextModel *model, gint object_num,
GdkDrawable *drawable,
EFont *font, EFontStyle style,
- GdkGC *gc, GdkGC *obj_gc,
+ GdkGC *gc,
gint x, gint y,
gchar *text, gint numbytes)
{
gchar *c;
-
- if (text == NULL)
- return;
while (*text && numbytes > 0) {
@@ -920,20 +871,16 @@ text_draw_with_objects (ETextModel *model, gint object_num,
const gchar *obj_str;
gint start_x = x;
gint len;
-
- if (obj_gc == NULL)
- obj_gc = gc;
-
g_assert (object_num < e_text_model_object_count (model));
obj_str = e_text_model_get_nth_object (model, object_num);
len = strlen (obj_str);
- e_font_draw_utf8_text (drawable, font, style, obj_gc, x, y, obj_str, len);
+ e_font_draw_utf8_text (drawable, font, style, gc, x, y, obj_str, len);
x += e_font_utf8_text_width (font, style, obj_str, len);
/* We underline our objects. */
- gdk_draw_line (drawable, obj_gc, start_x, y+1, x, y+1);
+ gdk_draw_line (drawable, gc, start_x, y+1, x, y+1);
++object_num;
++c;
@@ -1222,9 +1169,6 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
if ( text->model_changed_signal_id )
gtk_signal_disconnect(GTK_OBJECT(text->model),
text->model_changed_signal_id);
- if ( text->model_position_signal_id )
- gtk_signal_disconnect(GTK_OBJECT(text->model),
- text->model_position_signal_id);
gtk_object_unref(GTK_OBJECT(text->model));
text->model = E_TEXT_MODEL(GTK_VALUE_OBJECT (*arg));
gtk_object_ref(GTK_OBJECT(text->model));
@@ -1234,11 +1178,6 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
"changed",
GTK_SIGNAL_FUNC(e_text_text_model_changed),
text);
- text->model_position_signal_id =
- gtk_signal_connect(GTK_OBJECT(text->model),
- "position",
- GTK_SIGNAL_FUNC(e_text_text_model_position),
- text);
e_text_free_lines(text);
@@ -1834,7 +1773,7 @@ e_text_realize (GnomeCanvasItem *item)
(* parent_class->realize) (item);
text->gc = gdk_gc_new (item->canvas->layout.bin_window);
-
+
text->i_cursor = gdk_cursor_new (GDK_XTERM);
text->default_cursor = gdk_cursor_new (GDK_LEFT_PTR);
if (text->font == NULL) {
@@ -2009,16 +1948,6 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
canvas = GNOME_CANVAS_ITEM(text)->canvas;
fg_gc = GTK_WIDGET(canvas)->style->fg_gc[text->has_selection ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE];
-
- if (text->rgba_object && text->gc_object == NULL && text->gc) {
- GdkColor c;
- c.pixel = gnome_canvas_get_color_pixel (item->canvas, text->rgba_object);
-
- text->gc_object = gdk_gc_new (item->canvas->layout.bin_window);
- gdk_gc_copy (text->gc_object, text->gc);
- gdk_gc_set_foreground (text->gc_object, &c);
- }
-
if (text->draw_borders || text->draw_background) {
gdouble thisx = item->x1 - x;
@@ -2142,7 +2071,6 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
drawable,
text->font, E_FONT_PLAIN,
text->gc,
- text->gc_object,
xpos - x,
ypos - y,
lines->text,
@@ -2151,7 +2079,6 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
drawable,
text->font, E_FONT_PLAIN,
fg_gc,
- text->gc_object,
xpos - x + text_width_with_objects (text->model, lines->first_obj,
text->font, E_FONT_PLAIN,
lines->text,
@@ -2163,7 +2090,6 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
drawable,
text->font, E_FONT_PLAIN,
text->gc,
- text->gc_object,
xpos - x + text_width_with_objects (text->model, lines->first_obj,
text->font, E_FONT_PLAIN,
lines->text,
@@ -2176,7 +2102,6 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
drawable,
text->font, E_FONT_PLAIN,
text->gc,
- text->gc_object,
xpos - x,
ypos - y,
lines->text,
@@ -2203,7 +2128,6 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
drawable,
text->font, E_FONT_PLAIN,
text->gc,
- text->gc_object,
xpos - x,
ypos - y,
lines->text,
@@ -2220,7 +2144,6 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
drawable,
text->font, E_FONT_PLAIN,
text->gc,
- text->gc_object,
xpos - x,
ypos - y,
lines->text,
@@ -3374,8 +3297,6 @@ _delete_selection(EText *text)
e_text_model_delete(text->model, text->selection_end, text->selection_start - text->selection_end);
text->selection_start = text->selection_end;
}
-
- fix_selection (text);
}
static void
@@ -3384,13 +3305,8 @@ _insert(EText *text, char *string, int value)
if (value > 0) {
e_text_model_insert_length(text->model, text->selection_start, string, value);
- /*
- text->selection_start += value;
- text->selection_end = text->selection_start;
- */
-
- fix_selection (text);
-
+ text->selection_start += value;
+ text->selection_end = text->selection_start;
}
}
@@ -3399,7 +3315,6 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
{
EText *text = E_TEXT(data);
int sel_start, sel_end;
-
switch (command->action) {
case E_TEP_MOVE:
text->selection_start = _get_position(text, command);
diff --git a/widgets/text/e-text.h b/widgets/text/e-text.h
index 568402417c..5a1e843b7d 100644
--- a/widgets/text/e-text.h
+++ b/widgets/text/e-text.h
@@ -110,7 +110,6 @@ struct _EText {
ETextModel *model;
gint model_changed_signal_id;
- gint model_position_signal_id;
char *text; /* Text to display */
gpointer lines; /* Text split into lines (private field) */
@@ -211,9 +210,6 @@ struct _EText {
gint dbl_timeout; /* Double click timeout */
gint tpl_timeout; /* Triple click timeout */
-
- guint32 rgba_object; /* RGBA color for objects */
- GdkGC *gc_object; /* GC for drawing objects */
};
struct _ETextClass {