Add a :cursor-position property. (#334412, Yevgen Muntyan) `
2006-05-09 Matthias Clasen <mclasen@redhat.com> * gtk/gtktextbuffer.c (gtk_text_buffer_class_init): Add a :cursor-position property. (#334412, Yevgen Muntyan) `
This commit is contained in:
parent
7f371df51a
commit
b44fcd55dd
@ -1,5 +1,8 @@
|
|||||||
2006-05-09 Matthias Clasen <mclasen@redhat.com>
|
2006-05-09 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): Add a :cursor-position
|
||||||
|
property. (#334412, Yevgen Muntyan)
|
||||||
|
|
||||||
* gtk/gtk.symbols:
|
* gtk/gtk.symbols:
|
||||||
* gtk/gtkmessagedialog.[hc]: Add an image property. (#337306, Alex Graveley)
|
* gtk/gtkmessagedialog.[hc]: Add an image property. (#337306, Alex Graveley)
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
2006-05-09 Matthias Clasen <mclasen@redhat.com>
|
2006-05-09 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): Add a :cursor-position
|
||||||
|
property. (#334412, Yevgen Muntyan)
|
||||||
|
|
||||||
* gtk/gtk.symbols:
|
* gtk/gtk.symbols:
|
||||||
* gtk/gtkmessagedialog.[hc]: Add an image property. (#337306, Alex Graveley)
|
* gtk/gtkmessagedialog.[hc]: Add an image property. (#337306, Alex Graveley)
|
||||||
|
|
||||||
|
@ -95,6 +95,7 @@ enum {
|
|||||||
/* Normal */
|
/* Normal */
|
||||||
PROP_TEXT,
|
PROP_TEXT,
|
||||||
PROP_HAS_SELECTION,
|
PROP_HAS_SELECTION,
|
||||||
|
PROP_CURSOR_POSITION,
|
||||||
PROP_COPY_TARGET_LIST,
|
PROP_COPY_TARGET_LIST,
|
||||||
PROP_PASTE_TARGET_LIST
|
PROP_PASTE_TARGET_LIST
|
||||||
};
|
};
|
||||||
@ -213,6 +214,22 @@ gtk_text_buffer_class_init (GtkTextBufferClass *klass)
|
|||||||
FALSE,
|
FALSE,
|
||||||
GTK_PARAM_READABLE));
|
GTK_PARAM_READABLE));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkTextBuffer:cursor-position:
|
||||||
|
*
|
||||||
|
* The position of the insert mark (as offset from the beginning of the buffer).
|
||||||
|
* It is useful for getting notified when the cursor moves.
|
||||||
|
*
|
||||||
|
* Since: 2.10
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_CURSOR_POSITION,
|
||||||
|
g_param_spec_int ("cursor-position",
|
||||||
|
P_("Cursor position"),
|
||||||
|
P_("The position of the insert mark (as offset from the beginning of the buffer)"),
|
||||||
|
0, G_MAXINT, 0,
|
||||||
|
GTK_PARAM_READABLE));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkTextBuffer:copy-target-list:
|
* GtkTextBuffer:copy-target-list:
|
||||||
*
|
*
|
||||||
@ -467,6 +484,7 @@ gtk_text_buffer_get_property (GObject *object,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkTextBuffer *text_buffer;
|
GtkTextBuffer *text_buffer;
|
||||||
|
GtkTextIter iter;
|
||||||
|
|
||||||
text_buffer = GTK_TEXT_BUFFER (object);
|
text_buffer = GTK_TEXT_BUFFER (object);
|
||||||
|
|
||||||
@ -493,6 +511,12 @@ gtk_text_buffer_get_property (GObject *object,
|
|||||||
g_value_set_boolean (value, text_buffer->has_selection);
|
g_value_set_boolean (value, text_buffer->has_selection);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_CURSOR_POSITION:
|
||||||
|
gtk_text_buffer_get_iter_at_mark (text_buffer, &iter,
|
||||||
|
gtk_text_buffer_get_insert (text_buffer));
|
||||||
|
g_value_set_int (value, gtk_text_iter_get_offset (&iter));
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_COPY_TARGET_LIST:
|
case PROP_COPY_TARGET_LIST:
|
||||||
g_value_set_boxed (value, gtk_text_buffer_get_copy_target_list (text_buffer));
|
g_value_set_boxed (value, gtk_text_buffer_get_copy_target_list (text_buffer));
|
||||||
break;
|
break;
|
||||||
@ -655,6 +679,7 @@ gtk_text_buffer_real_insert_text (GtkTextBuffer *buffer,
|
|||||||
_gtk_text_btree_insert (iter, text, len);
|
_gtk_text_btree_insert (iter, text, len);
|
||||||
|
|
||||||
g_signal_emit (buffer, signals[CHANGED], 0);
|
g_signal_emit (buffer, signals[CHANGED], 0);
|
||||||
|
g_object_notify (G_OBJECT (buffer), "cursor-position");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1373,6 +1398,7 @@ gtk_text_buffer_real_delete_range (GtkTextBuffer *buffer,
|
|||||||
update_selection_clipboards (buffer);
|
update_selection_clipboards (buffer);
|
||||||
|
|
||||||
g_signal_emit (buffer, signals[CHANGED], 0);
|
g_signal_emit (buffer, signals[CHANGED], 0);
|
||||||
|
g_object_notify (G_OBJECT (buffer), "cursor-position");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -2272,8 +2298,11 @@ gtk_text_buffer_real_mark_set (GtkTextBuffer *buffer,
|
|||||||
const GtkTextIter *iter,
|
const GtkTextIter *iter,
|
||||||
GtkTextMark *mark)
|
GtkTextMark *mark)
|
||||||
{
|
{
|
||||||
if (mark == gtk_text_buffer_get_insert (buffer) ||
|
GtkTextMark *insert;
|
||||||
mark == gtk_text_buffer_get_selection_bound (buffer))
|
|
||||||
|
insert = gtk_text_buffer_get_insert (buffer);
|
||||||
|
|
||||||
|
if (mark == insert || mark == gtk_text_buffer_get_selection_bound (buffer))
|
||||||
{
|
{
|
||||||
gboolean has_selection;
|
gboolean has_selection;
|
||||||
|
|
||||||
@ -2287,6 +2316,9 @@ gtk_text_buffer_real_mark_set (GtkTextBuffer *buffer,
|
|||||||
g_object_notify (G_OBJECT (buffer), "has-selection");
|
g_object_notify (G_OBJECT (buffer), "has-selection");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mark == insert)
|
||||||
|
g_object_notify (G_OBJECT (buffer), "cursor-position");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user