// 对于TextBuffer的Modify处理这里是关键,使之能对文本的改变做出响应
static gint undo_connect_signal(GtkTextBuffer *buffer)
{
g_signal_connect(G_OBJECT(buffer), "delete-range",
G_CALLBACK(cb_delete_range), buffer);
g_signal_connect_after(G_OBJECT(buffer), "insert-text",
G_CALLBACK(cb_insert_text), buffer);
return
g_signal_connect(G_OBJECT(buffer), "modified-changed",
G_CALLBACK(cb_modified_changed), NULL);
}
// 还有:
static void undo_check_step_modif(GtkTextBuffer *buffer)
{
if (g_list_length(undo_list) == step_modif) {
g_signal_handlers_block_by_func(G_OBJECT(buffer), G_CALLBACK(cb_modified_changed), NULL);
gtk_text_buffer_set_modified(buffer, FALSE);
g_signal_handlers_unblock_by_func(G_OBJECT(buffer), G_CALLBACK(cb_modified_changed), NULL);
set_main_window_title_with_asterisk(FALSE);
}
}
continue...
2007-01-08
Gtk.TextBuffer undo
Posted by Davy Hawk at 1/08/2007 08:12:00 PM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment