|
|
@ -307,7 +307,7 @@ struct _GtkTextPendingScroll
|
|
|
|
double yalign;
|
|
|
|
double yalign;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SELECT_CHARACTERS,
|
|
|
|
SELECT_CHARACTERS,
|
|
|
|
SELECT_WORDS,
|
|
|
|
SELECT_WORDS,
|
|
|
@ -749,7 +749,7 @@ gtk_text_view_drop_scroll_motion (GtkDropControllerMotion *motion,
|
|
|
|
GdkRectangle target_rect;
|
|
|
|
GdkRectangle target_rect;
|
|
|
|
|
|
|
|
|
|
|
|
target_rect = priv->text_window->allocation;
|
|
|
|
target_rect = priv->text_window->allocation;
|
|
|
|
|
|
|
|
|
|
|
|
if (x < target_rect.x ||
|
|
|
|
if (x < target_rect.x ||
|
|
|
|
y < target_rect.y ||
|
|
|
|
y < target_rect.y ||
|
|
|
|
x > (target_rect.x + target_rect.width) ||
|
|
|
|
x > (target_rect.x + target_rect.width) ||
|
|
|
@ -1078,7 +1078,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
|
|
|
P_("Whether Tab will result in a tab character being entered"),
|
|
|
|
P_("Whether Tab will result in a tab character being entered"),
|
|
|
|
TRUE,
|
|
|
|
TRUE,
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* GtkTextView:im-module:
|
|
|
|
* GtkTextView:im-module:
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -1201,16 +1201,16 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
|
|
|
* - <kbd>Ctrl</kbd>-<kbd>PgUp</kbd>, <kbd>Ctrl</kbd>-<kbd>PgDn</kbd>
|
|
|
|
* - <kbd>Ctrl</kbd>-<kbd>PgUp</kbd>, <kbd>Ctrl</kbd>-<kbd>PgDn</kbd>
|
|
|
|
* move horizontally by pages
|
|
|
|
* move horizontally by pages
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
signals[MOVE_CURSOR] =
|
|
|
|
signals[MOVE_CURSOR] =
|
|
|
|
g_signal_new (I_("move-cursor"),
|
|
|
|
g_signal_new (I_("move-cursor"),
|
|
|
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
|
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
|
|
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
|
|
|
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
|
|
|
G_STRUCT_OFFSET (GtkTextViewClass, move_cursor),
|
|
|
|
G_STRUCT_OFFSET (GtkTextViewClass, move_cursor),
|
|
|
|
NULL, NULL,
|
|
|
|
NULL, NULL,
|
|
|
|
_gtk_marshal_VOID__ENUM_INT_BOOLEAN,
|
|
|
|
_gtk_marshal_VOID__ENUM_INT_BOOLEAN,
|
|
|
|
G_TYPE_NONE, 3,
|
|
|
|
G_TYPE_NONE, 3,
|
|
|
|
GTK_TYPE_MOVEMENT_STEP,
|
|
|
|
GTK_TYPE_MOVEMENT_STEP,
|
|
|
|
G_TYPE_INT,
|
|
|
|
G_TYPE_INT,
|
|
|
|
G_TYPE_BOOLEAN);
|
|
|
|
G_TYPE_BOOLEAN);
|
|
|
|
g_signal_set_va_marshaller (signals[MOVE_CURSOR],
|
|
|
|
g_signal_set_va_marshaller (signals[MOVE_CURSOR],
|
|
|
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
|
|
G_OBJECT_CLASS_TYPE (gobject_class),
|
|
|
@ -1574,7 +1574,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* GtkTextView|selection.delete:
|
|
|
|
* GtkTextView|selection.delete:
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Deletes the current selection.
|
|
|
|
* Deletes the current selection.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
gtk_widget_class_install_action (widget_class, "selection.delete", NULL,
|
|
|
|
gtk_widget_class_install_action (widget_class, "selection.delete", NULL,
|
|
|
|
gtk_text_view_activate_selection_delete);
|
|
|
|
gtk_text_view_activate_selection_delete);
|
|
|
@ -1612,7 +1612,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* GtkTextView|menu.popup:
|
|
|
|
* GtkTextView|menu.popup:
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Opens the context menu.
|
|
|
|
* Opens the context menu.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_text_view_popup_menu);
|
|
|
|
gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_text_view_popup_menu);
|
|
|
|
|
|
|
|
|
|
|
@ -1635,79 +1635,79 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Right, 0,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Right, 0,
|
|
|
|
GTK_MOVEMENT_VISUAL_POSITIONS, 1);
|
|
|
|
GTK_MOVEMENT_VISUAL_POSITIONS, 1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Left, 0,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Left, 0,
|
|
|
|
GTK_MOVEMENT_VISUAL_POSITIONS, -1);
|
|
|
|
GTK_MOVEMENT_VISUAL_POSITIONS, -1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Left, 0,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Left, 0,
|
|
|
|
GTK_MOVEMENT_VISUAL_POSITIONS, -1);
|
|
|
|
GTK_MOVEMENT_VISUAL_POSITIONS, -1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Right, GDK_CONTROL_MASK,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Right, GDK_CONTROL_MASK,
|
|
|
|
GTK_MOVEMENT_WORDS, 1);
|
|
|
|
GTK_MOVEMENT_WORDS, 1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Right, GDK_CONTROL_MASK,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Right, GDK_CONTROL_MASK,
|
|
|
|
GTK_MOVEMENT_WORDS, 1);
|
|
|
|
GTK_MOVEMENT_WORDS, 1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Left, GDK_CONTROL_MASK,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Left, GDK_CONTROL_MASK,
|
|
|
|
GTK_MOVEMENT_WORDS, -1);
|
|
|
|
GTK_MOVEMENT_WORDS, -1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Left, GDK_CONTROL_MASK,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Left, GDK_CONTROL_MASK,
|
|
|
|
GTK_MOVEMENT_WORDS, -1);
|
|
|
|
GTK_MOVEMENT_WORDS, -1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Up, 0,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Up, 0,
|
|
|
|
GTK_MOVEMENT_DISPLAY_LINES, -1);
|
|
|
|
GTK_MOVEMENT_DISPLAY_LINES, -1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Up, 0,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Up, 0,
|
|
|
|
GTK_MOVEMENT_DISPLAY_LINES, -1);
|
|
|
|
GTK_MOVEMENT_DISPLAY_LINES, -1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Down, 0,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Down, 0,
|
|
|
|
GTK_MOVEMENT_DISPLAY_LINES, 1);
|
|
|
|
GTK_MOVEMENT_DISPLAY_LINES, 1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Down, 0,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Down, 0,
|
|
|
|
GTK_MOVEMENT_DISPLAY_LINES, 1);
|
|
|
|
GTK_MOVEMENT_DISPLAY_LINES, 1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Up, GDK_CONTROL_MASK,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Up, GDK_CONTROL_MASK,
|
|
|
|
GTK_MOVEMENT_PARAGRAPHS, -1);
|
|
|
|
GTK_MOVEMENT_PARAGRAPHS, -1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Up, GDK_CONTROL_MASK,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Up, GDK_CONTROL_MASK,
|
|
|
|
GTK_MOVEMENT_PARAGRAPHS, -1);
|
|
|
|
GTK_MOVEMENT_PARAGRAPHS, -1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Down, GDK_CONTROL_MASK,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Down, GDK_CONTROL_MASK,
|
|
|
|
GTK_MOVEMENT_PARAGRAPHS, 1);
|
|
|
|
GTK_MOVEMENT_PARAGRAPHS, 1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Down, GDK_CONTROL_MASK,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Down, GDK_CONTROL_MASK,
|
|
|
|
GTK_MOVEMENT_PARAGRAPHS, 1);
|
|
|
|
GTK_MOVEMENT_PARAGRAPHS, 1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Home, 0,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Home, 0,
|
|
|
|
GTK_MOVEMENT_DISPLAY_LINE_ENDS, -1);
|
|
|
|
GTK_MOVEMENT_DISPLAY_LINE_ENDS, -1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Home, 0,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Home, 0,
|
|
|
|
GTK_MOVEMENT_DISPLAY_LINE_ENDS, -1);
|
|
|
|
GTK_MOVEMENT_DISPLAY_LINE_ENDS, -1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_End, 0,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_End, 0,
|
|
|
|
GTK_MOVEMENT_DISPLAY_LINE_ENDS, 1);
|
|
|
|
GTK_MOVEMENT_DISPLAY_LINE_ENDS, 1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_End, 0,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_End, 0,
|
|
|
|
GTK_MOVEMENT_DISPLAY_LINE_ENDS, 1);
|
|
|
|
GTK_MOVEMENT_DISPLAY_LINE_ENDS, 1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Home, GDK_CONTROL_MASK,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Home, GDK_CONTROL_MASK,
|
|
|
|
GTK_MOVEMENT_BUFFER_ENDS, -1);
|
|
|
|
GTK_MOVEMENT_BUFFER_ENDS, -1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Home, GDK_CONTROL_MASK,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Home, GDK_CONTROL_MASK,
|
|
|
|
GTK_MOVEMENT_BUFFER_ENDS, -1);
|
|
|
|
GTK_MOVEMENT_BUFFER_ENDS, -1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_End, GDK_CONTROL_MASK,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_End, GDK_CONTROL_MASK,
|
|
|
|
GTK_MOVEMENT_BUFFER_ENDS, 1);
|
|
|
|
GTK_MOVEMENT_BUFFER_ENDS, 1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_End, GDK_CONTROL_MASK,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_End, GDK_CONTROL_MASK,
|
|
|
|
GTK_MOVEMENT_BUFFER_ENDS, 1);
|
|
|
|
GTK_MOVEMENT_BUFFER_ENDS, 1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Page_Up, 0,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Page_Up, 0,
|
|
|
|
GTK_MOVEMENT_PAGES, -1);
|
|
|
|
GTK_MOVEMENT_PAGES, -1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Page_Up, 0,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Page_Up, 0,
|
|
|
|
GTK_MOVEMENT_PAGES, -1);
|
|
|
|
GTK_MOVEMENT_PAGES, -1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Page_Down, 0,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Page_Down, 0,
|
|
|
|
GTK_MOVEMENT_PAGES, 1);
|
|
|
|
GTK_MOVEMENT_PAGES, 1);
|
|
|
|
|
|
|
|
|
|
|
@ -1719,7 +1719,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Page_Up, GDK_CONTROL_MASK,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_KP_Page_Up, GDK_CONTROL_MASK,
|
|
|
|
GTK_MOVEMENT_HORIZONTAL_PAGES, -1);
|
|
|
|
GTK_MOVEMENT_HORIZONTAL_PAGES, -1);
|
|
|
|
|
|
|
|
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Page_Down, GDK_CONTROL_MASK,
|
|
|
|
add_move_binding (widget_class, GDK_KEY_Page_Down, GDK_CONTROL_MASK,
|
|
|
|
GTK_MOVEMENT_HORIZONTAL_PAGES, 1);
|
|
|
|
GTK_MOVEMENT_HORIZONTAL_PAGES, 1);
|
|
|
|
|
|
|
|
|
|
|
@ -1736,7 +1736,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
|
|
|
GDK_KEY_slash, GDK_CONTROL_MASK,
|
|
|
|
GDK_KEY_slash, GDK_CONTROL_MASK,
|
|
|
|
"select-all",
|
|
|
|
"select-all",
|
|
|
|
"(b)", TRUE);
|
|
|
|
"(b)", TRUE);
|
|
|
|
|
|
|
|
|
|
|
|
/* Unselect all */
|
|
|
|
/* Unselect all */
|
|
|
|
gtk_widget_class_add_binding_signal (widget_class,
|
|
|
|
gtk_widget_class_add_binding_signal (widget_class,
|
|
|
|
GDK_KEY_backslash, GDK_CONTROL_MASK,
|
|
|
|
GDK_KEY_backslash, GDK_CONTROL_MASK,
|
|
|
@ -1758,7 +1758,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
|
|
|
GDK_KEY_KP_Delete, 0,
|
|
|
|
GDK_KEY_KP_Delete, 0,
|
|
|
|
"delete-from-cursor",
|
|
|
|
"delete-from-cursor",
|
|
|
|
"(ii)", GTK_DELETE_CHARS, 1);
|
|
|
|
"(ii)", GTK_DELETE_CHARS, 1);
|
|
|
|
|
|
|
|
|
|
|
|
gtk_widget_class_add_binding_signal (widget_class,
|
|
|
|
gtk_widget_class_add_binding_signal (widget_class,
|
|
|
|
GDK_KEY_BackSpace, 0,
|
|
|
|
GDK_KEY_BackSpace, 0,
|
|
|
|
"backspace",
|
|
|
|
"backspace",
|
|
|
@ -1779,7 +1779,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
|
|
|
GDK_KEY_KP_Delete, GDK_CONTROL_MASK,
|
|
|
|
GDK_KEY_KP_Delete, GDK_CONTROL_MASK,
|
|
|
|
"delete-from-cursor",
|
|
|
|
"delete-from-cursor",
|
|
|
|
"(ii)", GTK_DELETE_WORD_ENDS, 1);
|
|
|
|
"(ii)", GTK_DELETE_WORD_ENDS, 1);
|
|
|
|
|
|
|
|
|
|
|
|
gtk_widget_class_add_binding_signal (widget_class,
|
|
|
|
gtk_widget_class_add_binding_signal (widget_class,
|
|
|
|
GDK_KEY_BackSpace, GDK_CONTROL_MASK,
|
|
|
|
GDK_KEY_BackSpace, GDK_CONTROL_MASK,
|
|
|
|
"delete-from-cursor",
|
|
|
|
"delete-from-cursor",
|
|
|
@ -1887,7 +1887,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
|
|
|
GDK_KEY_KP_Tab, GDK_CONTROL_MASK,
|
|
|
|
GDK_KEY_KP_Tab, GDK_CONTROL_MASK,
|
|
|
|
"move-focus",
|
|
|
|
"move-focus",
|
|
|
|
"(i)", GTK_DIR_TAB_FORWARD);
|
|
|
|
"(i)", GTK_DIR_TAB_FORWARD);
|
|
|
|
|
|
|
|
|
|
|
|
gtk_widget_class_add_binding_signal (widget_class,
|
|
|
|
gtk_widget_class_add_binding_signal (widget_class,
|
|
|
|
GDK_KEY_Tab, GDK_SHIFT_MASK | GDK_CONTROL_MASK,
|
|
|
|
GDK_KEY_Tab, GDK_SHIFT_MASK | GDK_CONTROL_MASK,
|
|
|
|
"move-focus",
|
|
|
|
"move-focus",
|
|
|
@ -2251,7 +2251,7 @@ gtk_text_view_set_buffer (GtkTextView *text_view,
|
|
|
|
g_object_unref (old_buffer);
|
|
|
|
g_object_unref (old_buffer);
|
|
|
|
|
|
|
|
|
|
|
|
g_object_notify (G_OBJECT (text_view), "buffer");
|
|
|
|
g_object_notify (G_OBJECT (text_view), "buffer");
|
|
|
|
|
|
|
|
|
|
|
|
if (gtk_widget_get_visible (GTK_WIDGET (text_view)))
|
|
|
|
if (gtk_widget_get_visible (GTK_WIDGET (text_view)))
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (text_view));
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (text_view));
|
|
|
|
|
|
|
|
|
|
|
@ -2426,7 +2426,7 @@ gtk_text_view_get_iter_location (GtkTextView *text_view,
|
|
|
|
g_return_if_fail (gtk_text_iter_get_buffer (iter) == get_buffer (text_view));
|
|
|
|
g_return_if_fail (gtk_text_iter_get_buffer (iter) == get_buffer (text_view));
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_view_ensure_layout (text_view);
|
|
|
|
gtk_text_view_ensure_layout (text_view);
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_layout_get_iter_location (text_view->priv->layout, iter, location);
|
|
|
|
gtk_text_layout_get_iter_location (text_view->priv->layout, iter, location);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2453,7 +2453,7 @@ gtk_text_view_get_line_yrange (GtkTextView *text_view,
|
|
|
|
g_return_if_fail (gtk_text_iter_get_buffer (iter) == get_buffer (text_view));
|
|
|
|
g_return_if_fail (gtk_text_iter_get_buffer (iter) == get_buffer (text_view));
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_view_ensure_layout (text_view);
|
|
|
|
gtk_text_view_ensure_layout (text_view);
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_layout_get_line_yrange (text_view->priv->layout,
|
|
|
|
gtk_text_layout_get_line_yrange (text_view->priv->layout,
|
|
|
|
iter,
|
|
|
|
iter,
|
|
|
|
y,
|
|
|
|
y,
|
|
|
@ -2484,7 +2484,7 @@ gtk_text_view_get_line_at_y (GtkTextView *text_view,
|
|
|
|
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
|
|
|
|
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_view_ensure_layout (text_view);
|
|
|
|
gtk_text_view_ensure_layout (text_view);
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_layout_get_line_at_y (text_view->priv->layout,
|
|
|
|
gtk_text_layout_get_line_at_y (text_view->priv->layout,
|
|
|
|
target_iter,
|
|
|
|
target_iter,
|
|
|
|
y,
|
|
|
|
y,
|
|
|
@ -2536,17 +2536,17 @@ _gtk_text_view_scroll_to_iter (GtkTextView *text_view,
|
|
|
|
* from flush_scroll in this function? I think it wasn't done before
|
|
|
|
* from flush_scroll in this function? I think it wasn't done before
|
|
|
|
* because changed_handler was screwed up, but I could be wrong.
|
|
|
|
* because changed_handler was screwed up, but I could be wrong.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), FALSE);
|
|
|
|
g_return_val_if_fail (iter != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (iter != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (within_margin >= 0.0 && within_margin < 0.5, FALSE);
|
|
|
|
g_return_val_if_fail (within_margin >= 0.0 && within_margin < 0.5, FALSE);
|
|
|
|
g_return_val_if_fail (xalign >= 0.0 && xalign <= 1.0, FALSE);
|
|
|
|
g_return_val_if_fail (xalign >= 0.0 && xalign <= 1.0, FALSE);
|
|
|
|
g_return_val_if_fail (yalign >= 0.0 && yalign <= 1.0, FALSE);
|
|
|
|
g_return_val_if_fail (yalign >= 0.0 && yalign <= 1.0, FALSE);
|
|
|
|
|
|
|
|
|
|
|
|
widget = GTK_WIDGET (text_view);
|
|
|
|
widget = GTK_WIDGET (text_view);
|
|
|
|
|
|
|
|
|
|
|
|
DV(g_print(G_STRLOC"\n"));
|
|
|
|
DV(g_print(G_STRLOC"\n"));
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_layout_get_iter_location (priv->layout,
|
|
|
|
gtk_text_layout_get_iter_location (priv->layout,
|
|
|
|
iter,
|
|
|
|
iter,
|
|
|
|
&cursor);
|
|
|
|
&cursor);
|
|
|
@ -2703,7 +2703,7 @@ _gtk_text_view_scroll_to_iter (GtkTextView *text_view,
|
|
|
|
retval = (screen.y != screen_dest.y) || (screen.x != screen_dest.x);
|
|
|
|
retval = (screen.y != screen_dest.y) || (screen.x != screen_dest.x);
|
|
|
|
|
|
|
|
|
|
|
|
DV(g_print (">%s ("G_STRLOC")\n", retval ? "Actually scrolled" : "Didn't end up scrolling"));
|
|
|
|
DV(g_print (">%s ("G_STRLOC")\n", retval ? "Actually scrolled" : "Didn't end up scrolling"));
|
|
|
|
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2784,14 +2784,14 @@ gtk_text_view_queue_scroll (GtkTextView *text_view,
|
|
|
|
GtkTextPendingScroll *scroll;
|
|
|
|
GtkTextPendingScroll *scroll;
|
|
|
|
|
|
|
|
|
|
|
|
DV(g_print(G_STRLOC"\n"));
|
|
|
|
DV(g_print(G_STRLOC"\n"));
|
|
|
|
|
|
|
|
|
|
|
|
scroll = g_slice_new (GtkTextPendingScroll);
|
|
|
|
scroll = g_slice_new (GtkTextPendingScroll);
|
|
|
|
|
|
|
|
|
|
|
|
scroll->within_margin = within_margin;
|
|
|
|
scroll->within_margin = within_margin;
|
|
|
|
scroll->use_align = use_align;
|
|
|
|
scroll->use_align = use_align;
|
|
|
|
scroll->xalign = xalign;
|
|
|
|
scroll->xalign = xalign;
|
|
|
|
scroll->yalign = yalign;
|
|
|
|
scroll->yalign = yalign;
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, mark);
|
|
|
|
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, mark);
|
|
|
|
|
|
|
|
|
|
|
|
scroll->mark = gtk_text_buffer_create_mark (get_buffer (text_view),
|
|
|
|
scroll->mark = gtk_text_buffer_create_mark (get_buffer (text_view),
|
|
|
@ -2800,7 +2800,7 @@ gtk_text_view_queue_scroll (GtkTextView *text_view,
|
|
|
|
gtk_text_mark_get_left_gravity (mark));
|
|
|
|
gtk_text_mark_get_left_gravity (mark));
|
|
|
|
|
|
|
|
|
|
|
|
g_object_ref (scroll->mark);
|
|
|
|
g_object_ref (scroll->mark);
|
|
|
|
|
|
|
|
|
|
|
|
cancel_pending_scroll (text_view);
|
|
|
|
cancel_pending_scroll (text_view);
|
|
|
|
|
|
|
|
|
|
|
|
text_view->priv->pending_scroll = scroll;
|
|
|
|
text_view->priv->pending_scroll = scroll;
|
|
|
@ -2816,9 +2816,9 @@ gtk_text_view_flush_scroll (GtkTextView *text_view)
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
|
|
|
|
widget = GTK_WIDGET (text_view);
|
|
|
|
widget = GTK_WIDGET (text_view);
|
|
|
|
|
|
|
|
|
|
|
|
DV(g_print(G_STRLOC"\n"));
|
|
|
|
DV(g_print(G_STRLOC"\n"));
|
|
|
|
|
|
|
|
|
|
|
|
if (text_view->priv->pending_scroll == NULL)
|
|
|
|
if (text_view->priv->pending_scroll == NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DV (g_print ("in flush scroll, no pending scroll\n"));
|
|
|
|
DV (g_print ("in flush scroll, no pending scroll\n"));
|
|
|
@ -2829,7 +2829,7 @@ gtk_text_view_flush_scroll (GtkTextView *text_view)
|
|
|
|
|
|
|
|
|
|
|
|
/* avoid recursion */
|
|
|
|
/* avoid recursion */
|
|
|
|
text_view->priv->pending_scroll = NULL;
|
|
|
|
text_view->priv->pending_scroll = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, scroll->mark);
|
|
|
|
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, scroll->mark);
|
|
|
|
|
|
|
|
|
|
|
|
/* Validate area around the scroll destination, so the adjustment
|
|
|
|
/* Validate area around the scroll destination, so the adjustment
|
|
|
@ -2849,7 +2849,7 @@ gtk_text_view_flush_scroll (GtkTextView *text_view)
|
|
|
|
|
|
|
|
|
|
|
|
/* Ensure we have updated width/height */
|
|
|
|
/* Ensure we have updated width/height */
|
|
|
|
gtk_text_view_update_adjustments (text_view);
|
|
|
|
gtk_text_view_update_adjustments (text_view);
|
|
|
|
|
|
|
|
|
|
|
|
retval = _gtk_text_view_scroll_to_iter (text_view,
|
|
|
|
retval = _gtk_text_view_scroll_to_iter (text_view,
|
|
|
|
&iter,
|
|
|
|
&iter,
|
|
|
|
scroll->within_margin,
|
|
|
|
scroll->within_margin,
|
|
|
@ -2896,7 +2896,7 @@ static void
|
|
|
|
gtk_text_view_update_layout_width (GtkTextView *text_view)
|
|
|
|
gtk_text_view_update_layout_width (GtkTextView *text_view)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DV(g_print(">Updating layout width ("G_STRLOC")\n"));
|
|
|
|
DV(g_print(">Updating layout width ("G_STRLOC")\n"));
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_view_ensure_layout (text_view);
|
|
|
|
gtk_text_view_ensure_layout (text_view);
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_layout_set_screen_width (text_view->priv->layout,
|
|
|
|
gtk_text_layout_set_screen_width (text_view->priv->layout,
|
|
|
@ -2910,12 +2910,12 @@ gtk_text_view_update_im_spot_location (GtkTextView *text_view)
|
|
|
|
|
|
|
|
|
|
|
|
if (text_view->priv->layout == NULL)
|
|
|
|
if (text_view->priv->layout == NULL)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_view_get_cursor_locations (text_view, NULL, &area, NULL);
|
|
|
|
gtk_text_view_get_cursor_locations (text_view, NULL, &area, NULL);
|
|
|
|
|
|
|
|
|
|
|
|
area.x -= text_view->priv->xoffset;
|
|
|
|
area.x -= text_view->priv->xoffset;
|
|
|
|
area.y -= text_view->priv->yoffset;
|
|
|
|
area.y -= text_view->priv->yoffset;
|
|
|
|
|
|
|
|
|
|
|
|
/* Width returned by Pango indicates direction of cursor,
|
|
|
|
/* Width returned by Pango indicates direction of cursor,
|
|
|
|
* by its sign more than the size of cursor.
|
|
|
|
* by its sign more than the size of cursor.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -2996,7 +2996,7 @@ gtk_text_view_scroll_to_mark (GtkTextView *text_view,
|
|
|
|
gboolean use_align,
|
|
|
|
gboolean use_align,
|
|
|
|
double xalign,
|
|
|
|
double xalign,
|
|
|
|
double yalign)
|
|
|
|
double yalign)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
|
|
|
|
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
|
|
|
|
g_return_if_fail (GTK_IS_TEXT_MARK (mark));
|
|
|
|
g_return_if_fail (GTK_IS_TEXT_MARK (mark));
|
|
|
|
g_return_if_fail (within_margin >= 0.0 && within_margin < 0.5);
|
|
|
|
g_return_if_fail (within_margin >= 0.0 && within_margin < 0.5);
|
|
|
@ -3962,12 +3962,12 @@ gtk_text_view_finalize (GObject *object)
|
|
|
|
g_assert (priv->top_child == NULL);
|
|
|
|
g_assert (priv->top_child == NULL);
|
|
|
|
g_assert (priv->bottom_child == NULL);
|
|
|
|
g_assert (priv->bottom_child == NULL);
|
|
|
|
g_assert (priv->center_child == NULL);
|
|
|
|
g_assert (priv->center_child == NULL);
|
|
|
|
|
|
|
|
|
|
|
|
cancel_pending_scroll (text_view);
|
|
|
|
cancel_pending_scroll (text_view);
|
|
|
|
|
|
|
|
|
|
|
|
if (priv->tabs)
|
|
|
|
if (priv->tabs)
|
|
|
|
pango_tab_array_free (priv->tabs);
|
|
|
|
pango_tab_array_free (priv->tabs);
|
|
|
|
|
|
|
|
|
|
|
|
if (priv->hadjustment)
|
|
|
|
if (priv->hadjustment)
|
|
|
|
g_object_unref (priv->hadjustment);
|
|
|
|
g_object_unref (priv->hadjustment);
|
|
|
|
if (priv->vadjustment)
|
|
|
|
if (priv->vadjustment)
|
|
|
@ -4018,7 +4018,7 @@ gtk_text_view_set_property (GObject *object,
|
|
|
|
case PROP_WRAP_MODE:
|
|
|
|
case PROP_WRAP_MODE:
|
|
|
|
gtk_text_view_set_wrap_mode (text_view, g_value_get_enum (value));
|
|
|
|
gtk_text_view_set_wrap_mode (text_view, g_value_get_enum (value));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case PROP_JUSTIFICATION:
|
|
|
|
case PROP_JUSTIFICATION:
|
|
|
|
gtk_text_view_set_justification (text_view, g_value_get_enum (value));
|
|
|
|
gtk_text_view_set_justification (text_view, g_value_get_enum (value));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -4062,7 +4062,7 @@ gtk_text_view_set_property (GObject *object,
|
|
|
|
case PROP_ACCEPTS_TAB:
|
|
|
|
case PROP_ACCEPTS_TAB:
|
|
|
|
gtk_text_view_set_accepts_tab (text_view, g_value_get_boolean (value));
|
|
|
|
gtk_text_view_set_accepts_tab (text_view, g_value_get_boolean (value));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case PROP_IM_MODULE:
|
|
|
|
case PROP_IM_MODULE:
|
|
|
|
g_free (priv->im_module);
|
|
|
|
g_free (priv->im_module);
|
|
|
|
priv->im_module = g_value_dup_string (value);
|
|
|
|
priv->im_module = g_value_dup_string (value);
|
|
|
@ -4147,7 +4147,7 @@ gtk_text_view_get_property (GObject *object,
|
|
|
|
case PROP_EDITABLE:
|
|
|
|
case PROP_EDITABLE:
|
|
|
|
g_value_set_boolean (value, priv->editable);
|
|
|
|
g_value_set_boolean (value, priv->editable);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case PROP_WRAP_MODE:
|
|
|
|
case PROP_WRAP_MODE:
|
|
|
|
g_value_set_enum (value, priv->wrap_mode);
|
|
|
|
g_value_set_enum (value, priv->wrap_mode);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -4195,7 +4195,7 @@ gtk_text_view_get_property (GObject *object,
|
|
|
|
case PROP_ACCEPTS_TAB:
|
|
|
|
case PROP_ACCEPTS_TAB:
|
|
|
|
g_value_set_boolean (value, priv->accepts_tab);
|
|
|
|
g_value_set_boolean (value, priv->accepts_tab);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case PROP_IM_MODULE:
|
|
|
|
case PROP_IM_MODULE:
|
|
|
|
g_value_set_string (value, priv->im_module);
|
|
|
|
g_value_set_string (value, priv->im_module);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -4333,7 +4333,7 @@ gtk_text_view_compute_child_allocation (GtkTextView *text_view,
|
|
|
|
int buffer_y;
|
|
|
|
int buffer_y;
|
|
|
|
GtkTextIter iter;
|
|
|
|
GtkTextIter iter;
|
|
|
|
GtkRequisition req;
|
|
|
|
GtkRequisition req;
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_buffer_get_iter_at_child_anchor (get_buffer (text_view),
|
|
|
|
gtk_text_buffer_get_iter_at_child_anchor (get_buffer (text_view),
|
|
|
|
&iter,
|
|
|
|
&iter,
|
|
|
|
vc->anchor);
|
|
|
|
vc->anchor);
|
|
|
@ -4358,7 +4358,7 @@ gtk_text_view_update_child_allocation (GtkTextView *text_view,
|
|
|
|
GtkAllocation allocation;
|
|
|
|
GtkAllocation allocation;
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_view_compute_child_allocation (text_view, vc, &allocation);
|
|
|
|
gtk_text_view_compute_child_allocation (text_view, vc, &allocation);
|
|
|
|
|
|
|
|
|
|
|
|
gtk_widget_size_allocate (vc->widget, &allocation, -1);
|
|
|
|
gtk_widget_size_allocate (vc->widget, &allocation, -1);
|
|
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#if 0
|
|
|
@ -4379,7 +4379,7 @@ gtk_anchored_child_allocated (GtkTextLayout *layout,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AnchoredChild *vc = NULL;
|
|
|
|
AnchoredChild *vc = NULL;
|
|
|
|
GtkTextView *text_view = data;
|
|
|
|
GtkTextView *text_view = data;
|
|
|
|
|
|
|
|
|
|
|
|
/* x,y is the position of the child from the top of the line, and
|
|
|
|
/* x,y is the position of the child from the top of the line, and
|
|
|
|
* from the left of the buffer. We have to translate that into text
|
|
|
|
* from the left of the buffer. We have to translate that into text
|
|
|
|
* window coordinates, then size_allocate the child.
|
|
|
|
* window coordinates, then size_allocate the child.
|
|
|
@ -4390,7 +4390,7 @@ gtk_anchored_child_allocated (GtkTextLayout *layout,
|
|
|
|
g_assert (vc != NULL);
|
|
|
|
g_assert (vc != NULL);
|
|
|
|
|
|
|
|
|
|
|
|
DV (g_print ("child allocated at %d,%d\n", x, y));
|
|
|
|
DV (g_print ("child allocated at %d,%d\n", x, y));
|
|
|
|
|
|
|
|
|
|
|
|
vc->from_left_of_buffer = x;
|
|
|
|
vc->from_left_of_buffer = x;
|
|
|
|
vc->from_top_of_line = y;
|
|
|
|
vc->from_top_of_line = y;
|
|
|
|
|
|
|
|
|
|
|
@ -4409,6 +4409,8 @@ gtk_text_view_allocate_children (GtkTextView *text_view)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const AnchoredChild *child = iter->data;
|
|
|
|
const AnchoredChild *child = iter->data;
|
|
|
|
GtkTextIter child_loc;
|
|
|
|
GtkTextIter child_loc;
|
|
|
|
|
|
|
|
GtkRequisition child_req;
|
|
|
|
|
|
|
|
GtkAllocation allocation;
|
|
|
|
|
|
|
|
|
|
|
|
/* We need to force-validate the regions containing children. */
|
|
|
|
/* We need to force-validate the regions containing children. */
|
|
|
|
gtk_text_buffer_get_iter_at_child_anchor (get_buffer (text_view),
|
|
|
|
gtk_text_buffer_get_iter_at_child_anchor (get_buffer (text_view),
|
|
|
@ -4417,10 +4419,10 @@ gtk_text_view_allocate_children (GtkTextView *text_view)
|
|
|
|
|
|
|
|
|
|
|
|
/* Since anchored children are only ever allocated from
|
|
|
|
/* Since anchored children are only ever allocated from
|
|
|
|
* gtk_text_layout_get_line_display() we have to make sure
|
|
|
|
* gtk_text_layout_get_line_display() we have to make sure
|
|
|
|
* that the display line caching in the layout doesn't
|
|
|
|
* that the display line caching in the layout doesn't
|
|
|
|
* get in the way. Invalidating the layout around the anchor
|
|
|
|
* get in the way. Invalidating the layout around the anchor
|
|
|
|
* achieves this.
|
|
|
|
* achieves this.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
if (_gtk_widget_get_alloc_needed (child->widget))
|
|
|
|
if (_gtk_widget_get_alloc_needed (child->widget))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GtkTextIter end = child_loc;
|
|
|
|
GtkTextIter end = child_loc;
|
|
|
@ -4429,6 +4431,15 @@ gtk_text_view_allocate_children (GtkTextView *text_view)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_layout_validate_yrange (priv->layout, &child_loc, 0, 1);
|
|
|
|
gtk_text_layout_validate_yrange (priv->layout, &child_loc, 0, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gtk_widget_get_preferred_size (child->widget, &child_req, NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
allocation.x = - child_req.width;
|
|
|
|
|
|
|
|
allocation.y = - child_req.height;
|
|
|
|
|
|
|
|
allocation.width = child_req.width;
|
|
|
|
|
|
|
|
allocation.height = child_req.height;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gtk_widget_size_allocate (child->widget, &allocation, -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -4559,7 +4570,7 @@ gtk_text_view_size_allocate (GtkWidget *widget,
|
|
|
|
GtkWidget *chooser;
|
|
|
|
GtkWidget *chooser;
|
|
|
|
PangoLayout *layout;
|
|
|
|
PangoLayout *layout;
|
|
|
|
guint mru_size;
|
|
|
|
guint mru_size;
|
|
|
|
|
|
|
|
|
|
|
|
text_view = GTK_TEXT_VIEW (widget);
|
|
|
|
text_view = GTK_TEXT_VIEW (widget);
|
|
|
|
priv = text_view->priv;
|
|
|
|
priv = text_view->priv;
|
|
|
|
|
|
|
|
|
|
|
@ -4633,7 +4644,7 @@ gtk_text_view_size_allocate (GtkWidget *widget,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_view_update_layout_width (text_view);
|
|
|
|
gtk_text_view_update_layout_width (text_view);
|
|
|
|
|
|
|
|
|
|
|
|
/* Note that this will do some layout validation */
|
|
|
|
/* Note that this will do some layout validation */
|
|
|
|
gtk_text_view_allocate_children (text_view);
|
|
|
|
gtk_text_view_allocate_children (text_view);
|
|
|
|
|
|
|
|
|
|
|
@ -4655,7 +4666,7 @@ gtk_text_view_size_allocate (GtkWidget *widget,
|
|
|
|
|
|
|
|
|
|
|
|
/* The GTK resize loop processes all the pending exposes right
|
|
|
|
/* The GTK resize loop processes all the pending exposes right
|
|
|
|
* after doing the resize stuff, so the idle sizer won't have a
|
|
|
|
* after doing the resize stuff, so the idle sizer won't have a
|
|
|
|
* chance to run. So we do the work here.
|
|
|
|
* chance to run. So we do the work here.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
gtk_text_view_flush_first_validate (text_view);
|
|
|
|
gtk_text_view_flush_first_validate (text_view);
|
|
|
|
|
|
|
|
|
|
|
@ -4695,9 +4706,9 @@ gtk_text_view_validate_onscreen (GtkTextView *text_view)
|
|
|
|
|
|
|
|
|
|
|
|
widget = GTK_WIDGET (text_view);
|
|
|
|
widget = GTK_WIDGET (text_view);
|
|
|
|
priv = text_view->priv;
|
|
|
|
priv = text_view->priv;
|
|
|
|
|
|
|
|
|
|
|
|
DV(g_print(">Validating onscreen ("G_STRLOC")\n"));
|
|
|
|
DV(g_print(">Validating onscreen ("G_STRLOC")\n"));
|
|
|
|
|
|
|
|
|
|
|
|
if (SCREEN_HEIGHT (widget) > 0)
|
|
|
|
if (SCREEN_HEIGHT (widget) > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GtkTextIter first_para;
|
|
|
|
GtkTextIter first_para;
|
|
|
@ -4718,7 +4729,7 @@ gtk_text_view_validate_onscreen (GtkTextView *text_view)
|
|
|
|
priv->onscreen_validated = TRUE;
|
|
|
|
priv->onscreen_validated = TRUE;
|
|
|
|
|
|
|
|
|
|
|
|
DV(g_print(">Done validating onscreen, onscreen_validated = TRUE ("G_STRLOC")\n"));
|
|
|
|
DV(g_print(">Done validating onscreen, onscreen_validated = TRUE ("G_STRLOC")\n"));
|
|
|
|
|
|
|
|
|
|
|
|
/* This can have the odd side effect of triggering a scroll, which should
|
|
|
|
/* This can have the odd side effect of triggering a scroll, which should
|
|
|
|
* flip "onscreen_validated" back to FALSE, but should also get us
|
|
|
|
* flip "onscreen_validated" back to FALSE, but should also get us
|
|
|
|
* back into this function to turn it on again.
|
|
|
|
* back into this function to turn it on again.
|
|
|
@ -4743,7 +4754,7 @@ gtk_text_view_flush_first_validate (GtkTextView *text_view)
|
|
|
|
DV (g_print ("removing first validate in %s\n", G_STRLOC));
|
|
|
|
DV (g_print ("removing first validate in %s\n", G_STRLOC));
|
|
|
|
g_source_remove (priv->first_validate_idle);
|
|
|
|
g_source_remove (priv->first_validate_idle);
|
|
|
|
priv->first_validate_idle = 0;
|
|
|
|
priv->first_validate_idle = 0;
|
|
|
|
|
|
|
|
|
|
|
|
/* be sure we have up-to-date screen size set on the
|
|
|
|
/* be sure we have up-to-date screen size set on the
|
|
|
|
* layout.
|
|
|
|
* layout.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -4767,9 +4778,9 @@ gtk_text_view_flush_first_validate (GtkTextView *text_view)
|
|
|
|
if (!gtk_text_view_flush_scroll (text_view) ||
|
|
|
|
if (!gtk_text_view_flush_scroll (text_view) ||
|
|
|
|
!priv->onscreen_validated)
|
|
|
|
!priv->onscreen_validated)
|
|
|
|
gtk_text_view_validate_onscreen (text_view);
|
|
|
|
gtk_text_view_validate_onscreen (text_view);
|
|
|
|
|
|
|
|
|
|
|
|
DV(g_print(">Leaving first validate idle ("G_STRLOC")\n"));
|
|
|
|
DV(g_print(">Leaving first validate idle ("G_STRLOC")\n"));
|
|
|
|
|
|
|
|
|
|
|
|
g_assert (priv->onscreen_validated);
|
|
|
|
g_assert (priv->onscreen_validated);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -4782,11 +4793,11 @@ first_validate_callback (gpointer data)
|
|
|
|
/* Note that some of this code is duplicated at the end of size_allocate,
|
|
|
|
/* Note that some of this code is duplicated at the end of size_allocate,
|
|
|
|
* keep in sync with that.
|
|
|
|
* keep in sync with that.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
DV(g_print(G_STRLOC"\n"));
|
|
|
|
DV(g_print(G_STRLOC"\n"));
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_view_flush_first_validate (text_view);
|
|
|
|
gtk_text_view_flush_first_validate (text_view);
|
|
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -4797,11 +4808,11 @@ incremental_validate_callback (gpointer data)
|
|
|
|
gboolean result = TRUE;
|
|
|
|
gboolean result = TRUE;
|
|
|
|
|
|
|
|
|
|
|
|
DV(g_print(G_STRLOC"\n"));
|
|
|
|
DV(g_print(G_STRLOC"\n"));
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_layout_validate (text_view->priv->layout, 2000);
|
|
|
|
gtk_text_layout_validate (text_view->priv->layout, 2000);
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_view_update_adjustments (text_view);
|
|
|
|
gtk_text_view_update_adjustments (text_view);
|
|
|
|
|
|
|
|
|
|
|
|
if (gtk_text_layout_is_valid (text_view->priv->layout))
|
|
|
|
if (gtk_text_layout_is_valid (text_view->priv->layout))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
text_view->priv->incremental_validate_idle = 0;
|
|
|
|
text_view->priv->incremental_validate_idle = 0;
|
|
|
@ -4824,7 +4835,7 @@ gtk_text_view_invalidate (GtkTextView *text_view)
|
|
|
|
/* We'll invalidate when the layout is created */
|
|
|
|
/* We'll invalidate when the layout is created */
|
|
|
|
if (priv->layout == NULL)
|
|
|
|
if (priv->layout == NULL)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if (!priv->first_validate_idle)
|
|
|
|
if (!priv->first_validate_idle)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
priv->first_validate_idle = g_idle_add_full (GTK_PRIORITY_RESIZE - 2, first_validate_callback, text_view, NULL);
|
|
|
|
priv->first_validate_idle = g_idle_add_full (GTK_PRIORITY_RESIZE - 2, first_validate_callback, text_view, NULL);
|
|
|
@ -4832,7 +4843,7 @@ gtk_text_view_invalidate (GtkTextView *text_view)
|
|
|
|
DV (g_print (G_STRLOC": adding first validate idle %d\n",
|
|
|
|
DV (g_print (G_STRLOC": adding first validate idle %d\n",
|
|
|
|
priv->first_validate_idle));
|
|
|
|
priv->first_validate_idle));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!priv->incremental_validate_idle)
|
|
|
|
if (!priv->incremental_validate_idle)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
priv->incremental_validate_idle = g_idle_add_full (GTK_TEXT_VIEW_PRIORITY_VALIDATE, incremental_validate_callback, text_view, NULL);
|
|
|
|
priv->incremental_validate_idle = g_idle_add_full (GTK_TEXT_VIEW_PRIORITY_VALIDATE, incremental_validate_callback, text_view, NULL);
|
|
|
@ -4864,11 +4875,11 @@ changed_handler (GtkTextLayout *layout,
|
|
|
|
GtkTextView *text_view;
|
|
|
|
GtkTextView *text_view;
|
|
|
|
GtkTextViewPrivate *priv;
|
|
|
|
GtkTextViewPrivate *priv;
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
|
|
|
|
|
|
|
text_view = GTK_TEXT_VIEW (data);
|
|
|
|
text_view = GTK_TEXT_VIEW (data);
|
|
|
|
priv = text_view->priv;
|
|
|
|
priv = text_view->priv;
|
|
|
|
widget = GTK_WIDGET (data);
|
|
|
|
widget = GTK_WIDGET (data);
|
|
|
|
|
|
|
|
|
|
|
|
DV(g_print(">Lines Validated ("G_STRLOC")\n"));
|
|
|
|
DV(g_print(">Lines Validated ("G_STRLOC")\n"));
|
|
|
|
|
|
|
|
|
|
|
|
if (gtk_widget_get_realized (widget))
|
|
|
|
if (gtk_widget_get_realized (widget))
|
|
|
@ -4884,7 +4895,7 @@ changed_handler (GtkTextLayout *layout,
|
|
|
|
GtkTextIter first;
|
|
|
|
GtkTextIter first;
|
|
|
|
int new_first_para_top;
|
|
|
|
int new_first_para_top;
|
|
|
|
int old_first_para_top;
|
|
|
|
int old_first_para_top;
|
|
|
|
|
|
|
|
|
|
|
|
/* If the bottom of the old area was above the top of the
|
|
|
|
/* If the bottom of the old area was above the top of the
|
|
|
|
* screen, we need to scroll to keep the current top of the
|
|
|
|
* screen, we need to scroll to keep the current top of the
|
|
|
|
* screen in place. Remember that first_para_pixels is the
|
|
|
|
* screen in place. Remember that first_para_pixels is the
|
|
|
@ -4904,7 +4915,7 @@ changed_handler (GtkTextLayout *layout,
|
|
|
|
if (new_first_para_top != old_first_para_top)
|
|
|
|
if (new_first_para_top != old_first_para_top)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
priv->yoffset += new_first_para_top - old_first_para_top;
|
|
|
|
priv->yoffset += new_first_para_top - old_first_para_top;
|
|
|
|
|
|
|
|
|
|
|
|
gtk_adjustment_set_value (text_view->priv->vadjustment, priv->yoffset);
|
|
|
|
gtk_adjustment_set_value (text_view->priv->vadjustment, priv->yoffset);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -5785,7 +5796,7 @@ gtk_text_view_paint (GtkWidget *widget,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GtkTextView *text_view;
|
|
|
|
GtkTextView *text_view;
|
|
|
|
GtkTextViewPrivate *priv;
|
|
|
|
GtkTextViewPrivate *priv;
|
|
|
|
|
|
|
|
|
|
|
|
text_view = GTK_TEXT_VIEW (widget);
|
|
|
|
text_view = GTK_TEXT_VIEW (widget);
|
|
|
|
priv = text_view->priv;
|
|
|
|
priv = text_view->priv;
|
|
|
|
|
|
|
|
|
|
|
@ -5902,7 +5913,7 @@ gtk_text_view_snapshot (GtkWidget *widget,
|
|
|
|
|
|
|
|
|
|
|
|
DV(g_print (">Exposed ("G_STRLOC")\n"));
|
|
|
|
DV(g_print (">Exposed ("G_STRLOC")\n"));
|
|
|
|
|
|
|
|
|
|
|
|
draw_text (widget, snapshot);
|
|
|
|
draw_text (widget, snapshot);
|
|
|
|
|
|
|
|
|
|
|
|
snapshot_text_view_child (widget, priv->left_child, snapshot);
|
|
|
|
snapshot_text_view_child (widget, priv->left_child, snapshot);
|
|
|
|
snapshot_text_view_child (widget, priv->right_child, snapshot);
|
|
|
|
snapshot_text_view_child (widget, priv->right_child, snapshot);
|
|
|
@ -5910,9 +5921,6 @@ gtk_text_view_snapshot (GtkWidget *widget,
|
|
|
|
snapshot_text_view_child (widget, priv->bottom_child, snapshot);
|
|
|
|
snapshot_text_view_child (widget, priv->bottom_child, snapshot);
|
|
|
|
snapshot_text_view_child (widget, priv->center_child, snapshot);
|
|
|
|
snapshot_text_view_child (widget, priv->center_child, snapshot);
|
|
|
|
|
|
|
|
|
|
|
|
/* Propagate exposes to all unanchored children.
|
|
|
|
|
|
|
|
* Anchored children are handled in gtk_text_view_paint().
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (iter = priv->anchored_children.head; iter; iter = iter->next)
|
|
|
|
for (iter = priv->anchored_children.head; iter; iter = iter->next)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const AnchoredChild *vc = iter->data;
|
|
|
|
const AnchoredChild *vc = iter->data;
|
|
|
@ -6000,10 +6008,10 @@ cursor_blinks (GtkTextView *text_view)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GtkTextMark *insert;
|
|
|
|
GtkTextMark *insert;
|
|
|
|
GtkTextIter iter;
|
|
|
|
GtkTextIter iter;
|
|
|
|
|
|
|
|
|
|
|
|
insert = gtk_text_buffer_get_insert (get_buffer (text_view));
|
|
|
|
insert = gtk_text_buffer_get_insert (get_buffer (text_view));
|
|
|
|
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, insert);
|
|
|
|
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, insert);
|
|
|
|
|
|
|
|
|
|
|
|
if (gtk_text_iter_editable (&iter, text_view->priv->editable))
|
|
|
|
if (gtk_text_iter_editable (&iter, text_view->priv->editable))
|
|
|
|
return blink;
|
|
|
|
return blink;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -6297,7 +6305,7 @@ gtk_text_view_move_cursor (GtkTextView *text_view,
|
|
|
|
GtkScrollStep scroll_step;
|
|
|
|
GtkScrollStep scroll_step;
|
|
|
|
double old_xpos, old_ypos;
|
|
|
|
double old_xpos, old_ypos;
|
|
|
|
|
|
|
|
|
|
|
|
switch (step)
|
|
|
|
switch (step)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case GTK_MOVEMENT_VISUAL_POSITIONS:
|
|
|
|
case GTK_MOVEMENT_VISUAL_POSITIONS:
|
|
|
|
leave_direction = count > 0 ? GTK_DIR_RIGHT : GTK_DIR_LEFT;
|
|
|
|
leave_direction = count > 0 ? GTK_DIR_RIGHT : GTK_DIR_LEFT;
|
|
|
@ -6308,7 +6316,7 @@ gtk_text_view_move_cursor (GtkTextView *text_view,
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case GTK_MOVEMENT_DISPLAY_LINE_ENDS:
|
|
|
|
case GTK_MOVEMENT_DISPLAY_LINE_ENDS:
|
|
|
|
scroll_step = GTK_SCROLL_HORIZONTAL_ENDS;
|
|
|
|
scroll_step = GTK_SCROLL_HORIZONTAL_ENDS;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case GTK_MOVEMENT_DISPLAY_LINES:
|
|
|
|
case GTK_MOVEMENT_DISPLAY_LINES:
|
|
|
|
leave_direction = count > 0 ? GTK_DIR_DOWN : GTK_DIR_UP;
|
|
|
|
leave_direction = count > 0 ? GTK_DIR_DOWN : GTK_DIR_UP;
|
|
|
|
G_GNUC_FALLTHROUGH;
|
|
|
|
G_GNUC_FALLTHROUGH;
|
|
|
@ -6420,7 +6428,7 @@ gtk_text_view_move_cursor (GtkTextView *text_view,
|
|
|
|
|
|
|
|
|
|
|
|
if (count < 0)
|
|
|
|
if (count < 0)
|
|
|
|
gtk_text_iter_backward_visible_word_starts (&newplace, -count);
|
|
|
|
gtk_text_iter_backward_visible_word_starts (&newplace, -count);
|
|
|
|
else if (count > 0)
|
|
|
|
else if (count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!gtk_text_iter_forward_visible_word_ends (&newplace, count))
|
|
|
|
if (!gtk_text_iter_forward_visible_word_ends (&newplace, count))
|
|
|
|
gtk_text_iter_forward_to_line_end (&newplace);
|
|
|
|
gtk_text_iter_forward_to_line_end (&newplace);
|
|
|
@ -6496,7 +6504,7 @@ gtk_text_view_move_cursor (GtkTextView *text_view,
|
|
|
|
else if (count < 0)
|
|
|
|
else if (count < 0)
|
|
|
|
gtk_text_buffer_get_iter_at_offset (get_buffer (text_view), &newplace, 0);
|
|
|
|
gtk_text_buffer_get_iter_at_offset (get_buffer (text_view), &newplace, 0);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case GTK_MOVEMENT_PAGES:
|
|
|
|
case GTK_MOVEMENT_PAGES:
|
|
|
|
case GTK_MOVEMENT_HORIZONTAL_PAGES:
|
|
|
|
case GTK_MOVEMENT_HORIZONTAL_PAGES:
|
|
|
|
/* We handle these cases above and return early from them. */
|
|
|
|
/* We handle these cases above and return early from them. */
|
|
|
@ -6505,7 +6513,7 @@ gtk_text_view_move_cursor (GtkTextView *text_view,
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* call move_cursor() even if the cursor hasn't moved, since it
|
|
|
|
/* call move_cursor() even if the cursor hasn't moved, since it
|
|
|
|
cancels the selection
|
|
|
|
cancels the selection
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
move_cursor (text_view, &newplace, extend_selection);
|
|
|
|
move_cursor (text_view, &newplace, extend_selection);
|
|
|
@ -6539,8 +6547,8 @@ gtk_text_view_move_viewport (GtkTextView *text_view,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GtkAdjustment *adjustment;
|
|
|
|
GtkAdjustment *adjustment;
|
|
|
|
double increment;
|
|
|
|
double increment;
|
|
|
|
|
|
|
|
|
|
|
|
switch (step)
|
|
|
|
switch (step)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case GTK_SCROLL_STEPS:
|
|
|
|
case GTK_SCROLL_STEPS:
|
|
|
|
case GTK_SCROLL_PAGES:
|
|
|
|
case GTK_SCROLL_PAGES:
|
|
|
@ -6557,7 +6565,7 @@ gtk_text_view_move_viewport (GtkTextView *text_view,
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (step)
|
|
|
|
switch (step)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case GTK_SCROLL_STEPS:
|
|
|
|
case GTK_SCROLL_STEPS:
|
|
|
|
case GTK_SCROLL_HORIZONTAL_STEPS:
|
|
|
|
case GTK_SCROLL_HORIZONTAL_STEPS:
|
|
|
@ -6609,7 +6617,7 @@ gtk_text_view_scroll_pages (GtkTextView *text_view,
|
|
|
|
priv = text_view->priv;
|
|
|
|
priv = text_view->priv;
|
|
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (priv->vadjustment != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (priv->vadjustment != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
|
|
adjustment = priv->vadjustment;
|
|
|
|
adjustment = priv->vadjustment;
|
|
|
|
|
|
|
|
|
|
|
|
insert_mark = gtk_text_buffer_get_insert (get_buffer (text_view));
|
|
|
|
insert_mark = gtk_text_buffer_get_insert (get_buffer (text_view));
|
|
|
@ -6674,7 +6682,7 @@ gtk_text_view_scroll_pages (GtkTextView *text_view,
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_view_set_virtual_cursor_pos (text_view, cursor_x_pos, cursor_y_pos);
|
|
|
|
gtk_text_view_set_virtual_cursor_pos (text_view, cursor_x_pos, cursor_y_pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Adjust to have the cursor _entirely_ onscreen, move_mark_onscreen
|
|
|
|
/* Adjust to have the cursor _entirely_ onscreen, move_mark_onscreen
|
|
|
|
* only guarantees 1 pixel onscreen.
|
|
|
|
* only guarantees 1 pixel onscreen.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -6760,7 +6768,7 @@ gtk_text_view_scroll_hpages (GtkTextView *text_view,
|
|
|
|
* back to get the end of the line onscreen.
|
|
|
|
* back to get the end of the line onscreen.
|
|
|
|
* http://bugzilla.gnome.org/show_bug.cgi?id=68963
|
|
|
|
* http://bugzilla.gnome.org/show_bug.cgi?id=68963
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* Adjust to have the cursor _entirely_ onscreen, move_mark_onscreen
|
|
|
|
/* Adjust to have the cursor _entirely_ onscreen, move_mark_onscreen
|
|
|
|
* only guarantees 1 pixel onscreen.
|
|
|
|
* only guarantees 1 pixel onscreen.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -6993,7 +7001,7 @@ static void
|
|
|
|
gtk_text_view_cut_clipboard (GtkTextView *text_view)
|
|
|
|
gtk_text_view_cut_clipboard (GtkTextView *text_view)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GdkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view));
|
|
|
|
GdkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view));
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_buffer_cut_clipboard (get_buffer (text_view),
|
|
|
|
gtk_text_buffer_cut_clipboard (get_buffer (text_view),
|
|
|
|
clipboard,
|
|
|
|
clipboard,
|
|
|
|
text_view->priv->editable);
|
|
|
|
text_view->priv->editable);
|
|
|
@ -7007,7 +7015,7 @@ static void
|
|
|
|
gtk_text_view_copy_clipboard (GtkTextView *text_view)
|
|
|
|
gtk_text_view_copy_clipboard (GtkTextView *text_view)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GdkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view));
|
|
|
|
GdkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view));
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_buffer_copy_clipboard (get_buffer (text_view), clipboard);
|
|
|
|
gtk_text_buffer_copy_clipboard (get_buffer (text_view), clipboard);
|
|
|
|
|
|
|
|
|
|
|
|
/* on copy do not scroll, we are already onscreen */
|
|
|
|
/* on copy do not scroll, we are already onscreen */
|
|
|
@ -7017,7 +7025,7 @@ static void
|
|
|
|
gtk_text_view_paste_clipboard (GtkTextView *text_view)
|
|
|
|
gtk_text_view_paste_clipboard (GtkTextView *text_view)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GdkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view));
|
|
|
|
GdkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view));
|
|
|
|
|
|
|
|
|
|
|
|
text_view->priv->scroll_after_paste = TRUE;
|
|
|
|
text_view->priv->scroll_after_paste = TRUE;
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_buffer_paste_clipboard (get_buffer (text_view),
|
|
|
|
gtk_text_buffer_paste_clipboard (get_buffer (text_view),
|
|
|
@ -7204,7 +7212,7 @@ selection_scan_timeout (gpointer data)
|
|
|
|
|
|
|
|
|
|
|
|
text_view = GTK_TEXT_VIEW (data);
|
|
|
|
text_view = GTK_TEXT_VIEW (data);
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_view_scroll_mark_onscreen (text_view,
|
|
|
|
gtk_text_view_scroll_mark_onscreen (text_view,
|
|
|
|
gtk_text_buffer_get_insert (get_buffer (text_view)));
|
|
|
|
gtk_text_buffer_get_insert (get_buffer (text_view)));
|
|
|
|
|
|
|
|
|
|
|
|
return TRUE; /* remain installed. */
|
|
|
|
return TRUE; /* remain installed. */
|
|
|
@ -7610,7 +7618,7 @@ gtk_text_view_start_selection_drag (GtkTextView *text_view,
|
|
|
|
* cursor however be inside the selection (this happens on triple click) then we
|
|
|
|
* cursor however be inside the selection (this happens on triple click) then we
|
|
|
|
* move the side which was last moved (current insert mark) */
|
|
|
|
* move the side which was last moved (current insert mark) */
|
|
|
|
if (gtk_text_iter_compare (&cursor, &old_start) <= 0 ||
|
|
|
|
if (gtk_text_iter_compare (&cursor, &old_start) <= 0 ||
|
|
|
|
(gtk_text_iter_compare (&cursor, &old_end) < 0 &&
|
|
|
|
(gtk_text_iter_compare (&cursor, &old_end) < 0 &&
|
|
|
|
gtk_text_iter_compare (&old_ins, &old_bound) <= 0))
|
|
|
|
gtk_text_iter_compare (&old_ins, &old_bound) <= 0))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bound = old_end;
|
|
|
|
bound = old_end;
|
|
|
@ -7848,7 +7856,7 @@ gtk_text_view_ensure_layout (GtkTextView *text_view)
|
|
|
|
PangoContext *ltr_context, *rtl_context;
|
|
|
|
PangoContext *ltr_context, *rtl_context;
|
|
|
|
|
|
|
|
|
|
|
|
DV(g_print(G_STRLOC"\n"));
|
|
|
|
DV(g_print(G_STRLOC"\n"));
|
|
|
|
|
|
|
|
|
|
|
|
priv->layout = gtk_text_layout_new ();
|
|
|
|
priv->layout = gtk_text_layout_new ();
|
|
|
|
|
|
|
|
|
|
|
|
g_signal_connect (priv->layout,
|
|
|
|
g_signal_connect (priv->layout,
|
|
|
@ -7865,7 +7873,7 @@ gtk_text_view_ensure_layout (GtkTextView *text_view)
|
|
|
|
"allocate-child",
|
|
|
|
"allocate-child",
|
|
|
|
G_CALLBACK (gtk_anchored_child_allocated),
|
|
|
|
G_CALLBACK (gtk_anchored_child_allocated),
|
|
|
|
text_view);
|
|
|
|
text_view);
|
|
|
|
|
|
|
|
|
|
|
|
if (get_buffer (text_view))
|
|
|
|
if (get_buffer (text_view))
|
|
|
|
gtk_text_layout_set_buffer (priv->layout, get_buffer (text_view));
|
|
|
|
gtk_text_layout_set_buffer (priv->layout, get_buffer (text_view));
|
|
|
|
|
|
|
|
|
|
|
@ -7930,7 +7938,7 @@ GtkTextAttributes*
|
|
|
|
gtk_text_view_get_default_attributes (GtkTextView *text_view)
|
|
|
|
gtk_text_view_get_default_attributes (GtkTextView *text_view)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), NULL);
|
|
|
|
g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), NULL);
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_view_ensure_layout (text_view);
|
|
|
|
gtk_text_view_ensure_layout (text_view);
|
|
|
|
|
|
|
|
|
|
|
|
return gtk_text_attributes_copy (text_view->priv->layout->default_style);
|
|
|
|
return gtk_text_attributes_copy (text_view->priv->layout->default_style);
|
|
|
@ -8136,7 +8144,7 @@ gtk_text_view_drag_motion (GtkDropTarget *dest,
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_layout_get_iter_at_pixel (priv->layout,
|
|
|
|
gtk_text_layout_get_iter_at_pixel (priv->layout,
|
|
|
|
&newplace,
|
|
|
|
&newplace,
|
|
|
|
bx, by);
|
|
|
|
bx, by);
|
|
|
|
|
|
|
|
|
|
|
|
if (gtk_text_buffer_get_selection_bounds (get_buffer (text_view),
|
|
|
|
if (gtk_text_buffer_get_selection_bounds (get_buffer (text_view),
|
|
|
|
&start, &end) &&
|
|
|
|
&start, &end) &&
|
|
|
@ -8146,7 +8154,7 @@ gtk_text_view_drag_motion (GtkDropTarget *dest,
|
|
|
|
/* We're inside the selection. */
|
|
|
|
/* We're inside the selection. */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
can_accept = gtk_text_iter_can_insert (&newplace, priv->editable);
|
|
|
|
can_accept = gtk_text_iter_can_insert (&newplace, priv->editable);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -8334,13 +8342,13 @@ gtk_text_view_value_changed (GtkAdjustment *adjustment,
|
|
|
|
/* Note that we oddly call this function with adjustment == NULL
|
|
|
|
/* Note that we oddly call this function with adjustment == NULL
|
|
|
|
* sometimes
|
|
|
|
* sometimes
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
priv->onscreen_validated = FALSE;
|
|
|
|
priv->onscreen_validated = FALSE;
|
|
|
|
|
|
|
|
|
|
|
|
DV(g_print(">Scroll offset changed %s/%g, onscreen_validated = FALSE ("G_STRLOC")\n",
|
|
|
|
DV(g_print(">Scroll offset changed %s/%g, onscreen_validated = FALSE ("G_STRLOC")\n",
|
|
|
|
adjustment == priv->hadjustment ? "hadjustment" : adjustment == priv->vadjustment ? "vadjustment" : "none",
|
|
|
|
adjustment == priv->hadjustment ? "hadjustment" : adjustment == priv->vadjustment ? "vadjustment" : "none",
|
|
|
|
adjustment ? gtk_adjustment_get_value (adjustment) : 0.0));
|
|
|
|
adjustment ? gtk_adjustment_get_value (adjustment) : 0.0));
|
|
|
|
|
|
|
|
|
|
|
|
if (adjustment == priv->hadjustment)
|
|
|
|
if (adjustment == priv->hadjustment)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dx = priv->xoffset - (int)gtk_adjustment_get_value (adjustment);
|
|
|
|
dx = priv->xoffset - (int)gtk_adjustment_get_value (adjustment);
|
|
|
@ -8360,7 +8368,7 @@ gtk_text_view_value_changed (GtkAdjustment *adjustment,
|
|
|
|
priv->first_para_pixels = gtk_adjustment_get_value (adjustment) - line_top;
|
|
|
|
priv->first_para_pixels = gtk_adjustment_get_value (adjustment) - line_top;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (dx != 0 || dy != 0)
|
|
|
|
if (dx != 0 || dy != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (gtk_widget_get_realized (GTK_WIDGET (text_view)))
|
|
|
|
if (gtk_widget_get_realized (GTK_WIDGET (text_view)))
|
|
|
@ -8376,7 +8384,7 @@ gtk_text_view_value_changed (GtkAdjustment *adjustment,
|
|
|
|
* first_validate_idle shouldn't have anything to do.
|
|
|
|
* first_validate_idle shouldn't have anything to do.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
gtk_text_view_update_layout_width (text_view);
|
|
|
|
gtk_text_view_update_layout_width (text_view);
|
|
|
|
|
|
|
|
|
|
|
|
/* We also update the IM spot location here, since the IM context
|
|
|
|
/* We also update the IM spot location here, since the IM context
|
|
|
|
* might do something that leads to validation.
|
|
|
|
* might do something that leads to validation.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -8388,7 +8396,7 @@ gtk_text_view_value_changed (GtkAdjustment *adjustment,
|
|
|
|
* that, or shouldn't be.
|
|
|
|
* that, or shouldn't be.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
gtk_text_view_validate_onscreen (text_view);
|
|
|
|
gtk_text_view_validate_onscreen (text_view);
|
|
|
|
|
|
|
|
|
|
|
|
/* If this got installed, get rid of it, it's just a waste of time. */
|
|
|
|
/* If this got installed, get rid of it, it's just a waste of time. */
|
|
|
|
if (priv->first_validate_idle != 0)
|
|
|
|
if (priv->first_validate_idle != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -8740,12 +8748,12 @@ gtk_text_view_select_all (GtkWidget *widget,
|
|
|
|
GtkTextIter start_iter, end_iter, insert;
|
|
|
|
GtkTextIter start_iter, end_iter, insert;
|
|
|
|
|
|
|
|
|
|
|
|
buffer = text_view->priv->buffer;
|
|
|
|
buffer = text_view->priv->buffer;
|
|
|
|
if (select)
|
|
|
|
if (select)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
gtk_text_buffer_get_bounds (buffer, &start_iter, &end_iter);
|
|
|
|
gtk_text_buffer_get_bounds (buffer, &start_iter, &end_iter);
|
|
|
|
gtk_text_buffer_select_range (buffer, &start_iter, &end_iter);
|
|
|
|
gtk_text_buffer_select_range (buffer, &start_iter, &end_iter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
gtk_text_buffer_get_iter_at_mark (buffer, &insert,
|
|
|
|
gtk_text_buffer_get_iter_at_mark (buffer, &insert,
|
|
|
|
gtk_text_buffer_get_insert (buffer));
|
|
|
|
gtk_text_buffer_get_insert (buffer));
|
|
|
@ -9499,7 +9507,7 @@ anchored_child_new (GtkWidget *child,
|
|
|
|
g_object_set_qdata (G_OBJECT (child), quark_text_view_child, vc);
|
|
|
|
g_object_set_qdata (G_OBJECT (child), quark_text_view_child, vc);
|
|
|
|
|
|
|
|
|
|
|
|
gtk_text_child_anchor_register_child (anchor, child, layout);
|
|
|
|
gtk_text_child_anchor_register_child (anchor, child, layout);
|
|
|
|
|
|
|
|
|
|
|
|
return vc;
|
|
|
|
return vc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|