Draw the focus, and leave space to do so.
2000-09-25 Havoc Pennington <hp@redhat.com> * gtk/gtktextview.c: Draw the focus, and leave space to do so. * gtk/gtktexttypes.c: Remove Latin1 conversion stuff * gtk/gtktextbtree.c (gtk_text_btree_node_remove_data): Fix a bug when removing node data, we didn't properly re-splice the linked list after removing the data. * gtk/gtktextview.c (gtk_text_view_key_press_event): Pass through GDK_Tab as literal tab, Ctrl-Tab to tab to focus widget * gtk/gtktextbuffer.c (selection_received): fix g_convert usage * gtk/gtktextlayout.c (set_para_values): Set tab array for the layout from the GtkTextTag. * gtk/gtktexttypes.h: delete tab and search cruft, remove g_convert() in favor of GLib version * gtk/gtktexttypes.c: remove tab implementation from here, move to Pango * gtk/gtktexttag.h, gtk/gtktexttag.c: Implement tab stuff using new PangoTabArray from Pango * gtk/gtktexttag.c (gtk_text_attributes_fill_from_tags): Remove unused border_width stuff
This commit is contained in:
committed by
Havoc Pennington
parent
f235c3cb5c
commit
9bec105a66
30
ChangeLog
30
ChangeLog
@ -1,3 +1,33 @@
|
|||||||
|
2000-09-25 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktextview.c: Draw the focus, and leave space to do so.
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.c: Remove Latin1 conversion stuff
|
||||||
|
|
||||||
|
* gtk/gtktextbtree.c (gtk_text_btree_node_remove_data):
|
||||||
|
Fix a bug when removing node data, we didn't properly
|
||||||
|
re-splice the linked list after removing the data.
|
||||||
|
|
||||||
|
* gtk/gtktextview.c (gtk_text_view_key_press_event): Pass through
|
||||||
|
GDK_Tab as literal tab, Ctrl-Tab to tab to focus widget
|
||||||
|
|
||||||
|
* gtk/gtktextbuffer.c (selection_received): fix g_convert usage
|
||||||
|
|
||||||
|
* gtk/gtktextlayout.c (set_para_values): Set tab array
|
||||||
|
for the layout from the GtkTextTag.
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.h: delete tab and search cruft,
|
||||||
|
remove g_convert() in favor of GLib version
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.c: remove tab implementation from here,
|
||||||
|
move to Pango
|
||||||
|
|
||||||
|
* gtk/gtktexttag.h, gtk/gtktexttag.c: Implement
|
||||||
|
tab stuff using new PangoTabArray from Pango
|
||||||
|
|
||||||
|
* gtk/gtktexttag.c (gtk_text_attributes_fill_from_tags): Remove
|
||||||
|
unused border_width stuff
|
||||||
|
|
||||||
Thu Sep 14 12:21:12 2000 Owen Taylor <otaylor@redhat.com>
|
Thu Sep 14 12:21:12 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktexttypes.[ch]: Remove g_convert (moved to
|
* gtk/gtktexttypes.[ch]: Remove g_convert (moved to
|
||||||
|
|||||||
@ -1,3 +1,33 @@
|
|||||||
|
2000-09-25 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktextview.c: Draw the focus, and leave space to do so.
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.c: Remove Latin1 conversion stuff
|
||||||
|
|
||||||
|
* gtk/gtktextbtree.c (gtk_text_btree_node_remove_data):
|
||||||
|
Fix a bug when removing node data, we didn't properly
|
||||||
|
re-splice the linked list after removing the data.
|
||||||
|
|
||||||
|
* gtk/gtktextview.c (gtk_text_view_key_press_event): Pass through
|
||||||
|
GDK_Tab as literal tab, Ctrl-Tab to tab to focus widget
|
||||||
|
|
||||||
|
* gtk/gtktextbuffer.c (selection_received): fix g_convert usage
|
||||||
|
|
||||||
|
* gtk/gtktextlayout.c (set_para_values): Set tab array
|
||||||
|
for the layout from the GtkTextTag.
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.h: delete tab and search cruft,
|
||||||
|
remove g_convert() in favor of GLib version
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.c: remove tab implementation from here,
|
||||||
|
move to Pango
|
||||||
|
|
||||||
|
* gtk/gtktexttag.h, gtk/gtktexttag.c: Implement
|
||||||
|
tab stuff using new PangoTabArray from Pango
|
||||||
|
|
||||||
|
* gtk/gtktexttag.c (gtk_text_attributes_fill_from_tags): Remove
|
||||||
|
unused border_width stuff
|
||||||
|
|
||||||
Thu Sep 14 12:21:12 2000 Owen Taylor <otaylor@redhat.com>
|
Thu Sep 14 12:21:12 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktexttypes.[ch]: Remove g_convert (moved to
|
* gtk/gtktexttypes.[ch]: Remove g_convert (moved to
|
||||||
|
|||||||
@ -1,3 +1,33 @@
|
|||||||
|
2000-09-25 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktextview.c: Draw the focus, and leave space to do so.
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.c: Remove Latin1 conversion stuff
|
||||||
|
|
||||||
|
* gtk/gtktextbtree.c (gtk_text_btree_node_remove_data):
|
||||||
|
Fix a bug when removing node data, we didn't properly
|
||||||
|
re-splice the linked list after removing the data.
|
||||||
|
|
||||||
|
* gtk/gtktextview.c (gtk_text_view_key_press_event): Pass through
|
||||||
|
GDK_Tab as literal tab, Ctrl-Tab to tab to focus widget
|
||||||
|
|
||||||
|
* gtk/gtktextbuffer.c (selection_received): fix g_convert usage
|
||||||
|
|
||||||
|
* gtk/gtktextlayout.c (set_para_values): Set tab array
|
||||||
|
for the layout from the GtkTextTag.
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.h: delete tab and search cruft,
|
||||||
|
remove g_convert() in favor of GLib version
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.c: remove tab implementation from here,
|
||||||
|
move to Pango
|
||||||
|
|
||||||
|
* gtk/gtktexttag.h, gtk/gtktexttag.c: Implement
|
||||||
|
tab stuff using new PangoTabArray from Pango
|
||||||
|
|
||||||
|
* gtk/gtktexttag.c (gtk_text_attributes_fill_from_tags): Remove
|
||||||
|
unused border_width stuff
|
||||||
|
|
||||||
Thu Sep 14 12:21:12 2000 Owen Taylor <otaylor@redhat.com>
|
Thu Sep 14 12:21:12 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktexttypes.[ch]: Remove g_convert (moved to
|
* gtk/gtktexttypes.[ch]: Remove g_convert (moved to
|
||||||
|
|||||||
@ -1,3 +1,33 @@
|
|||||||
|
2000-09-25 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktextview.c: Draw the focus, and leave space to do so.
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.c: Remove Latin1 conversion stuff
|
||||||
|
|
||||||
|
* gtk/gtktextbtree.c (gtk_text_btree_node_remove_data):
|
||||||
|
Fix a bug when removing node data, we didn't properly
|
||||||
|
re-splice the linked list after removing the data.
|
||||||
|
|
||||||
|
* gtk/gtktextview.c (gtk_text_view_key_press_event): Pass through
|
||||||
|
GDK_Tab as literal tab, Ctrl-Tab to tab to focus widget
|
||||||
|
|
||||||
|
* gtk/gtktextbuffer.c (selection_received): fix g_convert usage
|
||||||
|
|
||||||
|
* gtk/gtktextlayout.c (set_para_values): Set tab array
|
||||||
|
for the layout from the GtkTextTag.
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.h: delete tab and search cruft,
|
||||||
|
remove g_convert() in favor of GLib version
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.c: remove tab implementation from here,
|
||||||
|
move to Pango
|
||||||
|
|
||||||
|
* gtk/gtktexttag.h, gtk/gtktexttag.c: Implement
|
||||||
|
tab stuff using new PangoTabArray from Pango
|
||||||
|
|
||||||
|
* gtk/gtktexttag.c (gtk_text_attributes_fill_from_tags): Remove
|
||||||
|
unused border_width stuff
|
||||||
|
|
||||||
Thu Sep 14 12:21:12 2000 Owen Taylor <otaylor@redhat.com>
|
Thu Sep 14 12:21:12 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktexttypes.[ch]: Remove g_convert (moved to
|
* gtk/gtktexttypes.[ch]: Remove g_convert (moved to
|
||||||
|
|||||||
@ -1,3 +1,33 @@
|
|||||||
|
2000-09-25 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktextview.c: Draw the focus, and leave space to do so.
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.c: Remove Latin1 conversion stuff
|
||||||
|
|
||||||
|
* gtk/gtktextbtree.c (gtk_text_btree_node_remove_data):
|
||||||
|
Fix a bug when removing node data, we didn't properly
|
||||||
|
re-splice the linked list after removing the data.
|
||||||
|
|
||||||
|
* gtk/gtktextview.c (gtk_text_view_key_press_event): Pass through
|
||||||
|
GDK_Tab as literal tab, Ctrl-Tab to tab to focus widget
|
||||||
|
|
||||||
|
* gtk/gtktextbuffer.c (selection_received): fix g_convert usage
|
||||||
|
|
||||||
|
* gtk/gtktextlayout.c (set_para_values): Set tab array
|
||||||
|
for the layout from the GtkTextTag.
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.h: delete tab and search cruft,
|
||||||
|
remove g_convert() in favor of GLib version
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.c: remove tab implementation from here,
|
||||||
|
move to Pango
|
||||||
|
|
||||||
|
* gtk/gtktexttag.h, gtk/gtktexttag.c: Implement
|
||||||
|
tab stuff using new PangoTabArray from Pango
|
||||||
|
|
||||||
|
* gtk/gtktexttag.c (gtk_text_attributes_fill_from_tags): Remove
|
||||||
|
unused border_width stuff
|
||||||
|
|
||||||
Thu Sep 14 12:21:12 2000 Owen Taylor <otaylor@redhat.com>
|
Thu Sep 14 12:21:12 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktexttypes.[ch]: Remove g_convert (moved to
|
* gtk/gtktexttypes.[ch]: Remove g_convert (moved to
|
||||||
|
|||||||
@ -1,3 +1,33 @@
|
|||||||
|
2000-09-25 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktextview.c: Draw the focus, and leave space to do so.
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.c: Remove Latin1 conversion stuff
|
||||||
|
|
||||||
|
* gtk/gtktextbtree.c (gtk_text_btree_node_remove_data):
|
||||||
|
Fix a bug when removing node data, we didn't properly
|
||||||
|
re-splice the linked list after removing the data.
|
||||||
|
|
||||||
|
* gtk/gtktextview.c (gtk_text_view_key_press_event): Pass through
|
||||||
|
GDK_Tab as literal tab, Ctrl-Tab to tab to focus widget
|
||||||
|
|
||||||
|
* gtk/gtktextbuffer.c (selection_received): fix g_convert usage
|
||||||
|
|
||||||
|
* gtk/gtktextlayout.c (set_para_values): Set tab array
|
||||||
|
for the layout from the GtkTextTag.
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.h: delete tab and search cruft,
|
||||||
|
remove g_convert() in favor of GLib version
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.c: remove tab implementation from here,
|
||||||
|
move to Pango
|
||||||
|
|
||||||
|
* gtk/gtktexttag.h, gtk/gtktexttag.c: Implement
|
||||||
|
tab stuff using new PangoTabArray from Pango
|
||||||
|
|
||||||
|
* gtk/gtktexttag.c (gtk_text_attributes_fill_from_tags): Remove
|
||||||
|
unused border_width stuff
|
||||||
|
|
||||||
Thu Sep 14 12:21:12 2000 Owen Taylor <otaylor@redhat.com>
|
Thu Sep 14 12:21:12 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktexttypes.[ch]: Remove g_convert (moved to
|
* gtk/gtktexttypes.[ch]: Remove g_convert (moved to
|
||||||
|
|||||||
@ -1,3 +1,33 @@
|
|||||||
|
2000-09-25 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktextview.c: Draw the focus, and leave space to do so.
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.c: Remove Latin1 conversion stuff
|
||||||
|
|
||||||
|
* gtk/gtktextbtree.c (gtk_text_btree_node_remove_data):
|
||||||
|
Fix a bug when removing node data, we didn't properly
|
||||||
|
re-splice the linked list after removing the data.
|
||||||
|
|
||||||
|
* gtk/gtktextview.c (gtk_text_view_key_press_event): Pass through
|
||||||
|
GDK_Tab as literal tab, Ctrl-Tab to tab to focus widget
|
||||||
|
|
||||||
|
* gtk/gtktextbuffer.c (selection_received): fix g_convert usage
|
||||||
|
|
||||||
|
* gtk/gtktextlayout.c (set_para_values): Set tab array
|
||||||
|
for the layout from the GtkTextTag.
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.h: delete tab and search cruft,
|
||||||
|
remove g_convert() in favor of GLib version
|
||||||
|
|
||||||
|
* gtk/gtktexttypes.c: remove tab implementation from here,
|
||||||
|
move to Pango
|
||||||
|
|
||||||
|
* gtk/gtktexttag.h, gtk/gtktexttag.c: Implement
|
||||||
|
tab stuff using new PangoTabArray from Pango
|
||||||
|
|
||||||
|
* gtk/gtktexttag.c (gtk_text_attributes_fill_from_tags): Remove
|
||||||
|
unused border_width stuff
|
||||||
|
|
||||||
Thu Sep 14 12:21:12 2000 Owen Taylor <otaylor@redhat.com>
|
Thu Sep 14 12:21:12 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktexttypes.[ch]: Remove g_convert (moved to
|
* gtk/gtktexttypes.[ch]: Remove g_convert (moved to
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
|
<!-- ##### SECTION ./tmpl/from-drawables.sgml:Title ##### -->
|
||||||
|
Drawables to Pixbufs
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### USER_FUNCTION GdkPixbufLastUnref ##### -->
|
<!-- ##### USER_FUNCTION GdkPixbufLastUnref ##### -->
|
||||||
<para>
|
<para>
|
||||||
A function of this type can be used to override the default
|
A function of this type can be used to override the default
|
||||||
@ -15,10 +19,6 @@
|
|||||||
@pixbuf: The pixbuf that is losing its last reference.
|
@pixbuf: The pixbuf that is losing its last reference.
|
||||||
@data: User closure data.
|
@data: User closure data.
|
||||||
|
|
||||||
<!-- ##### SECTION ./tmpl/from-drawables.sgml:Title ##### -->
|
|
||||||
Drawables to Pixbufs
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### ARG GnomeCanvasPixbuf:height_pixels ##### -->
|
<!-- ##### ARG GnomeCanvasPixbuf:height_pixels ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
|||||||
@ -4724,6 +4724,7 @@ gtk_text_btree_node_remove_data(GtkTextBTreeNode *node, gpointer view_id)
|
|||||||
if (nd->view_id == view_id)
|
if (nd->view_id == view_id)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
prev = nd;
|
||||||
nd = nd->next;
|
nd = nd->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1412,9 +1412,8 @@ clipboard_received (GtkClipboard *clipboard,
|
|||||||
else
|
else
|
||||||
; /* FIXME Delete selected chars and give up X selection */
|
; /* FIXME Delete selected chars and give up X selection */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if (request_data->interactive)
|
if (request_data->interactive)
|
||||||
gtk_text_buffer_insert_interactive (buffer, &insert_point,
|
gtk_text_buffer_insert_interactive (buffer, &insert_point,
|
||||||
str, -1, request_data->default_editable);
|
str, -1, request_data->default_editable);
|
||||||
|
|||||||
@ -1039,6 +1039,9 @@ set_para_values (GtkTextLayout *layout,
|
|||||||
pango_layout_set_alignment (display->layout, pango_align);
|
pango_layout_set_alignment (display->layout, pango_align);
|
||||||
pango_layout_set_spacing (display->layout, style->pixels_inside_wrap * PANGO_SCALE);
|
pango_layout_set_spacing (display->layout, style->pixels_inside_wrap * PANGO_SCALE);
|
||||||
|
|
||||||
|
if (style->tabs)
|
||||||
|
pango_layout_set_tabs (display->layout, style->tabs);
|
||||||
|
|
||||||
display->top_margin = style->pixels_above_lines;
|
display->top_margin = style->pixels_above_lines;
|
||||||
display->height = style->pixels_above_lines + style->pixels_below_lines;
|
display->height = style->pixels_above_lines + style->pixels_below_lines;
|
||||||
display->bottom_margin = style->pixels_below_lines;
|
display->bottom_margin = style->pixels_below_lines;
|
||||||
|
|||||||
@ -46,6 +46,14 @@ struct _GtkTextLayout
|
|||||||
gint width;
|
gint width;
|
||||||
gint height;
|
gint height;
|
||||||
|
|
||||||
|
/* Pixel offsets from the left and from the top to be used when we
|
||||||
|
* draw; these allow us to create left/top margins. We don't need
|
||||||
|
* anything special for bottom/right margins, because those don't
|
||||||
|
* affect drawing.
|
||||||
|
*/
|
||||||
|
/* gint left_edge; */
|
||||||
|
/* gint top_edge; */
|
||||||
|
|
||||||
GtkTextBuffer *buffer;
|
GtkTextBuffer *buffer;
|
||||||
|
|
||||||
/* Default style used if no tags override it */
|
/* Default style used if no tags override it */
|
||||||
|
|||||||
@ -55,6 +55,7 @@
|
|||||||
#include "gtkmain.h"
|
#include "gtkmain.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
EVENT,
|
EVENT,
|
||||||
@ -90,6 +91,7 @@ enum {
|
|||||||
ARG_OFFSET,
|
ARG_OFFSET,
|
||||||
ARG_BG_FULL_HEIGHT,
|
ARG_BG_FULL_HEIGHT,
|
||||||
ARG_LANGUAGE,
|
ARG_LANGUAGE,
|
||||||
|
ARG_TABS,
|
||||||
|
|
||||||
/* Whether-a-style-arg-is-set args */
|
/* Whether-a-style-arg-is-set args */
|
||||||
ARG_BACKGROUND_SET,
|
ARG_BACKGROUND_SET,
|
||||||
@ -113,6 +115,7 @@ enum {
|
|||||||
ARG_OFFSET_SET,
|
ARG_OFFSET_SET,
|
||||||
ARG_BG_FULL_HEIGHT_SET,
|
ARG_BG_FULL_HEIGHT_SET,
|
||||||
ARG_LANGUAGE_SET,
|
ARG_LANGUAGE_SET,
|
||||||
|
ARG_TABS_SET,
|
||||||
|
|
||||||
LAST_ARG
|
LAST_ARG
|
||||||
};
|
};
|
||||||
@ -218,6 +221,8 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
|
|||||||
GTK_ARG_READWRITE, ARG_UNDERLINE);
|
GTK_ARG_READWRITE, ARG_UNDERLINE);
|
||||||
gtk_object_add_arg_type ("GtkTextTag::wrap_mode", GTK_TYPE_ENUM,
|
gtk_object_add_arg_type ("GtkTextTag::wrap_mode", GTK_TYPE_ENUM,
|
||||||
GTK_ARG_READWRITE, ARG_WRAP_MODE);
|
GTK_ARG_READWRITE, ARG_WRAP_MODE);
|
||||||
|
gtk_object_add_arg_type ("GtkTextTag::tabs", GTK_TYPE_POINTER,
|
||||||
|
GTK_ARG_READWRITE, ARG_TABS);
|
||||||
|
|
||||||
/* Style args are set or not */
|
/* Style args are set or not */
|
||||||
gtk_object_add_arg_type ("GtkTextTag::background_set", GTK_TYPE_BOOL,
|
gtk_object_add_arg_type ("GtkTextTag::background_set", GTK_TYPE_BOOL,
|
||||||
@ -262,6 +267,9 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
|
|||||||
GTK_ARG_READWRITE, ARG_UNDERLINE_SET);
|
GTK_ARG_READWRITE, ARG_UNDERLINE_SET);
|
||||||
gtk_object_add_arg_type ("GtkTextTag::wrap_mode_set", GTK_TYPE_BOOL,
|
gtk_object_add_arg_type ("GtkTextTag::wrap_mode_set", GTK_TYPE_BOOL,
|
||||||
GTK_ARG_READWRITE, ARG_WRAP_MODE_SET);
|
GTK_ARG_READWRITE, ARG_WRAP_MODE_SET);
|
||||||
|
gtk_object_add_arg_type ("GtkTextTag::tabs_set", GTK_TYPE_BOOL,
|
||||||
|
GTK_ARG_READWRITE, ARG_TABS_SET);
|
||||||
|
|
||||||
|
|
||||||
signals[EVENT] =
|
signals[EVENT] =
|
||||||
gtk_signal_new ("event",
|
gtk_signal_new ("event",
|
||||||
@ -580,6 +588,18 @@ gtk_text_tag_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
|
|||||||
tkxt_tag->language_set = TRUE;
|
tkxt_tag->language_set = TRUE;
|
||||||
tkxt_tag->values->language = g_strdup (GTK_VALUE_STRING(*arg));
|
tkxt_tag->values->language = g_strdup (GTK_VALUE_STRING(*arg));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ARG_TABS:
|
||||||
|
tkxt_tag->tabs_set = TRUE;
|
||||||
|
|
||||||
|
if (tkxt_tag->values->tabs)
|
||||||
|
pango_tab_array_free (tkxt_tag->values->tabs);
|
||||||
|
|
||||||
|
tkxt_tag->values->tabs =
|
||||||
|
pango_tab_array_copy (GTK_VALUE_POINTER (*arg));
|
||||||
|
|
||||||
|
size_changed = TRUE;
|
||||||
|
break;
|
||||||
|
|
||||||
/* Whether the value should be used... */
|
/* Whether the value should be used... */
|
||||||
|
|
||||||
@ -671,6 +691,11 @@ gtk_text_tag_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
|
|||||||
tkxt_tag->language_set = GTK_VALUE_BOOL(*arg);
|
tkxt_tag->language_set = GTK_VALUE_BOOL(*arg);
|
||||||
size_changed = TRUE;
|
size_changed = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ARG_TABS_SET:
|
||||||
|
tkxt_tag->tabs_set = GTK_VALUE_BOOL (*arg);
|
||||||
|
size_changed = TRUE;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached();
|
g_assert_not_reached();
|
||||||
@ -800,6 +825,11 @@ gtk_text_tag_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
|
|||||||
case ARG_LANGUAGE:
|
case ARG_LANGUAGE:
|
||||||
GTK_VALUE_STRING(*arg) = g_strdup (tag->values->language);
|
GTK_VALUE_STRING(*arg) = g_strdup (tag->values->language);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ARG_TABS:
|
||||||
|
GTK_VALUE_POINTER (*arg) = tag->values->tabs ?
|
||||||
|
pango_tab_array_copy (tag->values->tabs) : NULL;
|
||||||
|
break;
|
||||||
|
|
||||||
case ARG_BACKGROUND_SET:
|
case ARG_BACKGROUND_SET:
|
||||||
case ARG_BACKGROUND_GDK_SET:
|
case ARG_BACKGROUND_GDK_SET:
|
||||||
@ -878,6 +908,10 @@ gtk_text_tag_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
|
|||||||
case ARG_LANGUAGE_SET:
|
case ARG_LANGUAGE_SET:
|
||||||
GTK_VALUE_BOOL(*arg) = tag->language_set;
|
GTK_VALUE_BOOL(*arg) = tag->language_set;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ARG_TABS_SET:
|
||||||
|
GTK_VALUE_BOOL (*arg) = tag->tabs_set;
|
||||||
|
break;
|
||||||
|
|
||||||
case ARG_BACKGROUND:
|
case ARG_BACKGROUND:
|
||||||
case ARG_FOREGROUND:
|
case ARG_FOREGROUND:
|
||||||
@ -1050,7 +1084,7 @@ gtk_text_attributes_new(void)
|
|||||||
|
|
||||||
void
|
void
|
||||||
gtk_text_attributes_copy(GtkTextAttributes *src,
|
gtk_text_attributes_copy(GtkTextAttributes *src,
|
||||||
GtkTextAttributes *dest)
|
GtkTextAttributes *dest)
|
||||||
{
|
{
|
||||||
guint orig_refcount;
|
guint orig_refcount;
|
||||||
|
|
||||||
@ -1067,9 +1101,6 @@ gtk_text_attributes_copy(GtkTextAttributes *src,
|
|||||||
if (src->appearance.fg_stipple)
|
if (src->appearance.fg_stipple)
|
||||||
gdk_bitmap_ref(src->appearance.fg_stipple);
|
gdk_bitmap_ref(src->appearance.fg_stipple);
|
||||||
|
|
||||||
if (src->tab_array)
|
|
||||||
gtk_text_view_tab_array_ref(src->tab_array);
|
|
||||||
|
|
||||||
/* Remove refs */
|
/* Remove refs */
|
||||||
|
|
||||||
if (dest->appearance.bg_stipple)
|
if (dest->appearance.bg_stipple)
|
||||||
@ -1078,15 +1109,16 @@ gtk_text_attributes_copy(GtkTextAttributes *src,
|
|||||||
if (dest->appearance.fg_stipple)
|
if (dest->appearance.fg_stipple)
|
||||||
gdk_bitmap_unref(dest->appearance.fg_stipple);
|
gdk_bitmap_unref(dest->appearance.fg_stipple);
|
||||||
|
|
||||||
if (dest->tab_array)
|
|
||||||
gtk_text_view_tab_array_unref(dest->tab_array);
|
|
||||||
|
|
||||||
/* Copy */
|
/* Copy */
|
||||||
orig_refcount = dest->refcount;
|
orig_refcount = dest->refcount;
|
||||||
|
|
||||||
*dest = *src;
|
*dest = *src;
|
||||||
|
|
||||||
dest->font_desc = pango_font_description_copy (src->font_desc);
|
dest->font_desc = pango_font_description_copy (src->font_desc);
|
||||||
|
|
||||||
|
if (src->tabs)
|
||||||
|
dest->tabs = pango_tab_array_copy (src->tabs);
|
||||||
|
|
||||||
dest->language = g_strdup (src->language);
|
dest->language = g_strdup (src->language);
|
||||||
|
|
||||||
dest->refcount = orig_refcount;
|
dest->refcount = orig_refcount;
|
||||||
@ -1122,8 +1154,8 @@ gtk_text_attributes_unref(GtkTextAttributes *values)
|
|||||||
if (values->appearance.fg_stipple)
|
if (values->appearance.fg_stipple)
|
||||||
gdk_bitmap_unref(values->appearance.fg_stipple);
|
gdk_bitmap_unref(values->appearance.fg_stipple);
|
||||||
|
|
||||||
if (values->tab_array)
|
if (values->tabs)
|
||||||
gtk_text_view_tab_array_unref(values->tab_array);
|
pango_tab_array_free (values->tabs);
|
||||||
|
|
||||||
if (values->language)
|
if (values->language)
|
||||||
g_free (values->language);
|
g_free (values->language);
|
||||||
@ -1197,10 +1229,7 @@ gtk_text_attributes_fill_from_tags(GtkTextAttributes *dest,
|
|||||||
dest->appearance.bg_color = vals->appearance.bg_color;
|
dest->appearance.bg_color = vals->appearance.bg_color;
|
||||||
|
|
||||||
dest->appearance.draw_bg = TRUE;
|
dest->appearance.draw_bg = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag->border_width_set)
|
|
||||||
dest->border_width = vals->border_width;
|
|
||||||
|
|
||||||
if (tag->relief_set)
|
if (tag->relief_set)
|
||||||
dest->relief = vals->relief;
|
dest->relief = vals->relief;
|
||||||
@ -1260,12 +1289,11 @@ gtk_text_attributes_fill_from_tags(GtkTextAttributes *dest,
|
|||||||
if (tag->pixels_inside_wrap_set)
|
if (tag->pixels_inside_wrap_set)
|
||||||
dest->pixels_inside_wrap = vals->pixels_inside_wrap;
|
dest->pixels_inside_wrap = vals->pixels_inside_wrap;
|
||||||
|
|
||||||
if (tag->tab_array_set)
|
if (tag->tabs_set)
|
||||||
{
|
{
|
||||||
gtk_text_view_tab_array_ref(vals->tab_array);
|
if (dest->tabs)
|
||||||
if (dest->tab_array)
|
pango_tab_array_free (dest->tabs);
|
||||||
gtk_text_view_tab_array_unref(dest->tab_array);
|
dest->tabs = pango_tab_array_copy (vals->tabs);
|
||||||
dest->tab_array = vals->tab_array;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag->wrap_mode_set)
|
if (tag->wrap_mode_set)
|
||||||
|
|||||||
@ -11,9 +11,9 @@ extern "C" {
|
|||||||
typedef struct _GtkTextIter GtkTextIter;
|
typedef struct _GtkTextIter GtkTextIter;
|
||||||
typedef struct _GtkTextBTreeNode GtkTextBTreeNode;
|
typedef struct _GtkTextBTreeNode GtkTextBTreeNode;
|
||||||
typedef struct _GtkTextTagTable GtkTextTagTable;
|
typedef struct _GtkTextTagTable GtkTextTagTable;
|
||||||
typedef struct _GtkTextTabArray GtkTextTabArray;
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum
|
||||||
|
{
|
||||||
GTK_WRAPMODE_NONE,
|
GTK_WRAPMODE_NONE,
|
||||||
GTK_WRAPMODE_CHAR,
|
GTK_WRAPMODE_CHAR,
|
||||||
GTK_WRAPMODE_WORD
|
GTK_WRAPMODE_WORD
|
||||||
@ -54,11 +54,10 @@ struct _GtkTextTag {
|
|||||||
|
|
||||||
GtkTextAttributes *values;
|
GtkTextAttributes *values;
|
||||||
|
|
||||||
/*
|
/* Flags for whether a given value is set; if a value is unset, then
|
||||||
Flags for whether a given value is set; if a value is unset, then
|
* this tag does not affect it.
|
||||||
this tag does not affect it. */
|
*/
|
||||||
guint bg_color_set : 1;
|
guint bg_color_set : 1;
|
||||||
guint border_width_set : 1;
|
|
||||||
guint relief_set : 1;
|
guint relief_set : 1;
|
||||||
guint bg_stipple_set : 1;
|
guint bg_stipple_set : 1;
|
||||||
guint fg_color_set : 1;
|
guint fg_color_set : 1;
|
||||||
@ -73,7 +72,7 @@ struct _GtkTextTag {
|
|||||||
guint pixels_above_lines_set : 1;
|
guint pixels_above_lines_set : 1;
|
||||||
guint pixels_below_lines_set : 1;
|
guint pixels_below_lines_set : 1;
|
||||||
guint pixels_inside_wrap_set : 1;
|
guint pixels_inside_wrap_set : 1;
|
||||||
guint tab_array_set : 1;
|
guint tabs_set : 1;
|
||||||
guint underline_set : 1;
|
guint underline_set : 1;
|
||||||
guint wrap_mode_set : 1;
|
guint wrap_mode_set : 1;
|
||||||
guint bg_full_height_set : 1;
|
guint bg_full_height_set : 1;
|
||||||
@ -123,7 +122,8 @@ struct _GtkTextAppearance
|
|||||||
/* Whether to use background-related values; this is irrelevant for
|
/* Whether to use background-related values; this is irrelevant for
|
||||||
* the values struct when in a tag, but is used for the composite
|
* the values struct when in a tag, but is used for the composite
|
||||||
* values struct; it's true if any of the tags being composited
|
* values struct; it's true if any of the tags being composited
|
||||||
* had background stuff set. */
|
* had background stuff set.
|
||||||
|
*/
|
||||||
guint draw_bg : 1;
|
guint draw_bg : 1;
|
||||||
|
|
||||||
/* This is only used when we are actually laying out and rendering
|
/* This is only used when we are actually laying out and rendering
|
||||||
@ -139,7 +139,6 @@ struct _GtkTextAttributes
|
|||||||
|
|
||||||
GtkTextAppearance appearance;
|
GtkTextAppearance appearance;
|
||||||
|
|
||||||
gint border_width;
|
|
||||||
GtkShadowType relief;
|
GtkShadowType relief;
|
||||||
GtkJustification justify;
|
GtkJustification justify;
|
||||||
GtkTextDirection direction;
|
GtkTextDirection direction;
|
||||||
@ -163,7 +162,7 @@ struct _GtkTextAttributes
|
|||||||
|
|
||||||
gint pixels_inside_wrap;
|
gint pixels_inside_wrap;
|
||||||
|
|
||||||
GtkTextTabArray *tab_array;
|
PangoTabArray *tabs;
|
||||||
|
|
||||||
GtkWrapMode wrap_mode; /* How to handle wrap-around for this tag.
|
GtkWrapMode wrap_mode; /* How to handle wrap-around for this tag.
|
||||||
* Must be GTK_WRAPMODE_CHAR,
|
* Must be GTK_WRAPMODE_CHAR,
|
||||||
@ -176,7 +175,8 @@ struct _GtkTextAttributes
|
|||||||
guint invisible : 1;
|
guint invisible : 1;
|
||||||
|
|
||||||
/* Background is fit to full line height rather than
|
/* Background is fit to full line height rather than
|
||||||
* baseline +/- ascent/descent (font height) */
|
* baseline +/- ascent/descent (font height)
|
||||||
|
*/
|
||||||
guint bg_full_height : 1;
|
guint bg_full_height : 1;
|
||||||
|
|
||||||
/* can edit this text */
|
/* can edit this text */
|
||||||
@ -197,7 +197,6 @@ void gtk_text_attributes_copy (GtkTextAttributes *src,
|
|||||||
void gtk_text_attributes_unref (GtkTextAttributes *values);
|
void gtk_text_attributes_unref (GtkTextAttributes *values);
|
||||||
void gtk_text_attributes_ref (GtkTextAttributes *values);
|
void gtk_text_attributes_ref (GtkTextAttributes *values);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|||||||
@ -1,47 +1,5 @@
|
|||||||
#include "gtktexttypes.h"
|
#include "gtktexttypes.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Tab array
|
|
||||||
*/
|
|
||||||
|
|
||||||
GtkTextTabArray*
|
|
||||||
gtk_text_view_tab_array_new(guint size)
|
|
||||||
{
|
|
||||||
GtkTextTabArray *array;
|
|
||||||
|
|
||||||
array = g_new0(GtkTextTabArray, 1);
|
|
||||||
|
|
||||||
array->refcount = 1;
|
|
||||||
array->numTabs = size;
|
|
||||||
array->tabs = g_new0(GtkTextTab, size);
|
|
||||||
|
|
||||||
return array;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gtk_text_view_tab_array_ref(GtkTextTabArray *tab_array)
|
|
||||||
{
|
|
||||||
g_return_if_fail(tab_array != NULL);
|
|
||||||
|
|
||||||
tab_array->refcount += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gtk_text_view_tab_array_unref(GtkTextTabArray *tab_array)
|
|
||||||
{
|
|
||||||
g_return_if_fail(tab_array != NULL);
|
|
||||||
g_return_if_fail(tab_array->refcount > 0);
|
|
||||||
|
|
||||||
tab_array->refcount -= 1;
|
|
||||||
|
|
||||||
if (tab_array->refcount == 0)
|
|
||||||
{
|
|
||||||
g_free(tab_array->tabs);
|
|
||||||
g_free(tab_array);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* These are used to represent embedded non-character objects
|
/* These are used to represent embedded non-character objects
|
||||||
* if you return a string representation of a text buffer
|
* if you return a string representation of a text buffer
|
||||||
*/
|
*/
|
||||||
@ -59,4 +17,3 @@ gtk_text_byte_begins_utf8_char(const gchar *byte)
|
|||||||
{
|
{
|
||||||
return inline_byte_begins_utf8_char(byte);
|
return inline_byte_begins_utf8_char(byte);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,83 +15,8 @@ typedef struct _GtkTextCounter GtkTextCounter;
|
|||||||
typedef struct _GtkTextLineSegment GtkTextLineSegment;
|
typedef struct _GtkTextLineSegment GtkTextLineSegment;
|
||||||
typedef struct _GtkTextLineSegmentClass GtkTextLineSegmentClass;
|
typedef struct _GtkTextLineSegmentClass GtkTextLineSegmentClass;
|
||||||
typedef struct _GtkTextToggleBody GtkTextToggleBody;
|
typedef struct _GtkTextToggleBody GtkTextToggleBody;
|
||||||
typedef struct _GtkTextViewSearch GtkTextViewSearch;
|
|
||||||
typedef struct _GtkTextTab GtkTextTab;
|
|
||||||
typedef struct _GtkTextViewStyle GtkTextViewStyle;
|
|
||||||
typedef struct _GtkTextMarkBody GtkTextMarkBody;
|
typedef struct _GtkTextMarkBody GtkTextMarkBody;
|
||||||
|
|
||||||
/*
|
|
||||||
* Search
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The data structure below is used for searching a B-tree for transitions
|
|
||||||
* on a single tag (or for all tag transitions). No code outside of
|
|
||||||
* tkTextBTree.c should ever modify any of the fields in these structures,
|
|
||||||
* but it's OK to use them for read-only information.
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct _GtkTextViewSearch {
|
|
||||||
GtkTextBTree *tree;
|
|
||||||
|
|
||||||
GtkTextIter curIndex; /* Position of last tag transition
|
|
||||||
* returned by gtk_text_btree_next_tag, or
|
|
||||||
* index of start of segment
|
|
||||||
* containing starting position for
|
|
||||||
* search if gtk_text_btree_next_tag hasn't
|
|
||||||
* been called yet, or same as
|
|
||||||
* stopIndex if search is over. */
|
|
||||||
|
|
||||||
GtkTextLineSegment *segPtr; /* Actual tag segment returned
|
|
||||||
by last call to
|
|
||||||
gtk_text_btree_next_tag,
|
|
||||||
or NULL if
|
|
||||||
gtk_text_btree_next_tag
|
|
||||||
hasn't returned anything
|
|
||||||
yet. */
|
|
||||||
|
|
||||||
GtkTextLineSegment *lastPtr; /* Stop search before just before
|
|
||||||
* considering this segment. */
|
|
||||||
GtkTextTag *tag; /* Tag to search for (or tag found, if
|
|
||||||
* allTags is non-zero). */
|
|
||||||
int linesLeft; /* Lines left to search (including
|
|
||||||
* curIndex and stopIndex). When
|
|
||||||
* this becomes <= 0 the search is
|
|
||||||
* over. */
|
|
||||||
int allTags; /* Non-zero means ignore tag check:
|
|
||||||
* search for transitions on all
|
|
||||||
* tags. */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The following data structure describes a single tab stop.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
GTK_TEXT_TAB_LEFT,
|
|
||||||
GTK_TEXT_TAB_RIGHT,
|
|
||||||
GTK_TEXT_TAB_CENTER,
|
|
||||||
GTK_TEXT_TAB_NUMERIC
|
|
||||||
} GtkTextTabAlign;
|
|
||||||
|
|
||||||
struct _GtkTextTab {
|
|
||||||
int location; /* Offset in pixels of this tab stop
|
|
||||||
* from the left margin (lmargin2) of
|
|
||||||
* the text. */
|
|
||||||
GtkTextTabAlign alignment; /* Where the tab stop appears relative
|
|
||||||
* to the text. */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GtkTextTabArray {
|
|
||||||
guint refcount;
|
|
||||||
int numTabs; /* Number of tab stops. */
|
|
||||||
GtkTextTab *tabs;
|
|
||||||
};
|
|
||||||
|
|
||||||
GtkTextTabArray *gtk_text_view_tab_array_new (guint size);
|
|
||||||
void gtk_text_view_tab_array_ref (GtkTextTabArray *tab_array);
|
|
||||||
void gtk_text_view_tab_array_unref (GtkTextTabArray *tab_array);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Declarations for variables shared among the text-related files:
|
* Declarations for variables shared among the text-related files:
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -62,6 +62,15 @@
|
|||||||
#include "gtktexttypes.h"
|
#include "gtktexttypes.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#define FOCUS_RECT_WIDTH 10
|
||||||
|
#if 0
|
||||||
|
#define SCREEN_WIDTH(widget) (MAX (GTK_WIDGET(widget)->allocation.width - FOCUS_RECT_WIDTH*2, 0))
|
||||||
|
#define SCREEN_HEIGHT(widget) (MAX (GTK_WIDGET(widget)->allocation.height - FOCUS_RECT_WIDTH*2, 0))
|
||||||
|
#else
|
||||||
|
#define SCREEN_WIDTH(widget) GTK_WIDGET(widget)->allocation.width
|
||||||
|
#define SCREEN_HEIGHT(widget) GTK_WIDGET(widget)->allocation.height
|
||||||
|
#endif
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MOVE,
|
MOVE,
|
||||||
SET_ANCHOR,
|
SET_ANCHOR,
|
||||||
@ -127,6 +136,7 @@ static void gtk_text_view_draw (GtkWidget *widget,
|
|||||||
GdkRectangle *area);
|
GdkRectangle *area);
|
||||||
static gint gtk_text_view_expose_event (GtkWidget *widget,
|
static gint gtk_text_view_expose_event (GtkWidget *widget,
|
||||||
GdkEventExpose *expose);
|
GdkEventExpose *expose);
|
||||||
|
static void gtk_text_view_draw_focus (GtkWidget *widget);
|
||||||
|
|
||||||
|
|
||||||
/* Source side drag signals */
|
/* Source side drag signals */
|
||||||
@ -189,9 +199,9 @@ static void gtk_text_view_validate_onscreen (GtkTextView *text_vi
|
|||||||
static void gtk_text_view_get_first_para_iter (GtkTextView *text_view,
|
static void gtk_text_view_get_first_para_iter (GtkTextView *text_view,
|
||||||
GtkTextIter *iter);
|
GtkTextIter *iter);
|
||||||
static void gtk_text_view_scroll_calc_now (GtkTextView *text_view);
|
static void gtk_text_view_scroll_calc_now (GtkTextView *text_view);
|
||||||
static void gtk_text_view_set_values_from_style (GtkTextView *text_view,
|
static void gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
|
||||||
GtkTextAttributes *values,
|
GtkTextAttributes *values,
|
||||||
GtkStyle *style);
|
GtkStyle *style);
|
||||||
static void gtk_text_view_ensure_layout (GtkTextView *text_view);
|
static void gtk_text_view_ensure_layout (GtkTextView *text_view);
|
||||||
static void gtk_text_view_destroy_layout (GtkTextView *text_view);
|
static void gtk_text_view_destroy_layout (GtkTextView *text_view);
|
||||||
static void gtk_text_view_start_selection_drag (GtkTextView *text_view,
|
static void gtk_text_view_start_selection_drag (GtkTextView *text_view,
|
||||||
@ -205,8 +215,8 @@ static void gtk_text_view_start_selection_dnd (GtkTextView *text_vi
|
|||||||
static void gtk_text_view_start_cursor_blink (GtkTextView *text_view);
|
static void gtk_text_view_start_cursor_blink (GtkTextView *text_view);
|
||||||
static void gtk_text_view_stop_cursor_blink (GtkTextView *text_view);
|
static void gtk_text_view_stop_cursor_blink (GtkTextView *text_view);
|
||||||
|
|
||||||
static void gtk_text_view_value_changed (GtkAdjustment *adj,
|
static void gtk_text_view_value_changed (GtkAdjustment *adj,
|
||||||
GtkTextView *view);
|
GtkTextView *view);
|
||||||
static void gtk_text_view_commit_handler (GtkIMContext *context,
|
static void gtk_text_view_commit_handler (GtkIMContext *context,
|
||||||
const gchar *str,
|
const gchar *str,
|
||||||
GtkTextView *text_view);
|
GtkTextView *text_view);
|
||||||
@ -571,7 +581,8 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
|||||||
widget_class->motion_notify_event = gtk_text_view_motion_event;
|
widget_class->motion_notify_event = gtk_text_view_motion_event;
|
||||||
widget_class->expose_event = gtk_text_view_expose_event;
|
widget_class->expose_event = gtk_text_view_expose_event;
|
||||||
widget_class->draw = gtk_text_view_draw;
|
widget_class->draw = gtk_text_view_draw;
|
||||||
|
widget_class->draw_focus = gtk_text_view_draw_focus;
|
||||||
|
|
||||||
widget_class->drag_begin = gtk_text_view_drag_begin;
|
widget_class->drag_begin = gtk_text_view_drag_begin;
|
||||||
widget_class->drag_end = gtk_text_view_drag_end;
|
widget_class->drag_end = gtk_text_view_drag_end;
|
||||||
widget_class->drag_data_get = gtk_text_view_drag_data_get;
|
widget_class->drag_data_get = gtk_text_view_drag_data_get;
|
||||||
@ -783,8 +794,8 @@ gtk_text_view_scroll_to_mark_adjusted (GtkTextView *text_view,
|
|||||||
|
|
||||||
screen.x = current_x_scroll;
|
screen.x = current_x_scroll;
|
||||||
screen.y = current_y_scroll;
|
screen.y = current_y_scroll;
|
||||||
screen.width = widget->allocation.width;
|
screen.width = SCREEN_WIDTH (widget);
|
||||||
screen.height = widget->allocation.height;
|
screen.height = SCREEN_HEIGHT (widget);
|
||||||
|
|
||||||
{
|
{
|
||||||
/* Clamp margin so it's not too large. */
|
/* Clamp margin so it's not too large. */
|
||||||
@ -921,8 +932,8 @@ gtk_text_view_get_visible_rect (GtkTextView *text_view,
|
|||||||
{
|
{
|
||||||
visible_rect->x = text_view->xoffset;
|
visible_rect->x = text_view->xoffset;
|
||||||
visible_rect->y = text_view->yoffset;
|
visible_rect->y = text_view->yoffset;
|
||||||
visible_rect->width = widget->allocation.width;
|
visible_rect->width = SCREEN_WIDTH (widget);
|
||||||
visible_rect->height = widget->allocation.height;
|
visible_rect->height = SCREEN_HEIGHT (widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1174,14 +1185,14 @@ gtk_text_view_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
gtk_text_view_ensure_layout (text_view);
|
gtk_text_view_ensure_layout (text_view);
|
||||||
gtk_text_layout_set_screen_width (text_view->layout,
|
gtk_text_layout_set_screen_width (text_view->layout,
|
||||||
GTK_WIDGET (text_view)->allocation.width);
|
SCREEN_WIDTH (text_view));
|
||||||
|
|
||||||
gtk_text_view_validate_onscreen (text_view);
|
gtk_text_view_validate_onscreen (text_view);
|
||||||
gtk_text_view_scroll_calc_now (text_view);
|
gtk_text_view_scroll_calc_now (text_view);
|
||||||
|
|
||||||
/* Now adjust the value of the adjustment to keep the cursor at the same place in
|
/* Now adjust the value of the adjustment to keep the cursor at the
|
||||||
* the buffer
|
* same place in the buffer
|
||||||
*/
|
*/
|
||||||
gtk_text_view_get_first_para_iter (text_view, &first_para);
|
gtk_text_view_get_first_para_iter (text_view, &first_para);
|
||||||
gtk_text_layout_get_line_yrange (text_view->layout, &first_para, &y, NULL);
|
gtk_text_layout_get_line_yrange (text_view->layout, &first_para, &y, NULL);
|
||||||
|
|
||||||
@ -1201,16 +1212,18 @@ gtk_text_view_size_allocate (GtkWidget *widget,
|
|||||||
yoffset_changed = TRUE;
|
yoffset_changed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
text_view->hadjustment->page_size = allocation->width;
|
text_view->hadjustment->page_size = SCREEN_WIDTH (text_view);
|
||||||
text_view->hadjustment->page_increment = allocation->width / 2;
|
text_view->hadjustment->page_increment = SCREEN_WIDTH (text_view) / 2;
|
||||||
text_view->hadjustment->lower = 0;
|
text_view->hadjustment->lower = 0;
|
||||||
text_view->hadjustment->upper = MAX (allocation->width, text_view->width);
|
text_view->hadjustment->upper = MAX (SCREEN_WIDTH (text_view),
|
||||||
|
text_view->width);
|
||||||
gtk_signal_emit_by_name (GTK_OBJECT (text_view->hadjustment), "changed");
|
gtk_signal_emit_by_name (GTK_OBJECT (text_view->hadjustment), "changed");
|
||||||
|
|
||||||
text_view->vadjustment->page_size = allocation->height;
|
text_view->vadjustment->page_size = SCREEN_HEIGHT (text_view);
|
||||||
text_view->vadjustment->page_increment = allocation->height / 2;
|
text_view->vadjustment->page_increment = SCREEN_HEIGHT (text_view) / 2;
|
||||||
text_view->vadjustment->lower = 0;
|
text_view->vadjustment->lower = 0;
|
||||||
text_view->vadjustment->upper = MAX (allocation->height, text_view->height);
|
text_view->vadjustment->upper = MAX (SCREEN_HEIGHT (text_view),
|
||||||
|
text_view->height);
|
||||||
gtk_signal_emit_by_name (GTK_OBJECT (text_view->vadjustment), "changed");
|
gtk_signal_emit_by_name (GTK_OBJECT (text_view->vadjustment), "changed");
|
||||||
|
|
||||||
if (yoffset_changed)
|
if (yoffset_changed)
|
||||||
@ -1230,13 +1243,15 @@ gtk_text_view_validate_onscreen (GtkTextView *text_view)
|
|||||||
{
|
{
|
||||||
GtkWidget *widget = GTK_WIDGET (text_view);
|
GtkWidget *widget = GTK_WIDGET (text_view);
|
||||||
|
|
||||||
if (widget->allocation.height > 0)
|
if (SCREEN_HEIGHT (widget) > 0)
|
||||||
{
|
{
|
||||||
GtkTextIter first_para;
|
GtkTextIter first_para;
|
||||||
gtk_text_view_get_first_para_iter (text_view, &first_para);
|
gtk_text_view_get_first_para_iter (text_view, &first_para);
|
||||||
gtk_text_layout_validate_yrange (text_view->layout,
|
gtk_text_layout_validate_yrange (text_view->layout,
|
||||||
&first_para,
|
&first_para,
|
||||||
0, text_view->first_para_pixels + widget->allocation.height);
|
0,
|
||||||
|
text_view->first_para_pixels +
|
||||||
|
SCREEN_HEIGHT (widget));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1434,7 +1449,7 @@ gtk_text_view_style_set (GtkWidget *widget,
|
|||||||
gdk_window_set_background (text_view->bin_window,
|
gdk_window_set_background (text_view->bin_window,
|
||||||
&widget->style->base[GTK_WIDGET_STATE (widget)]);
|
&widget->style->base[GTK_WIDGET_STATE (widget)]);
|
||||||
|
|
||||||
gtk_text_view_set_values_from_style (text_view, text_view->layout->default_style, widget->style);
|
gtk_text_view_set_attributes_from_style (text_view, text_view->layout->default_style, widget->style);
|
||||||
gtk_text_layout_default_style_changed (text_view->layout);
|
gtk_text_layout_default_style_changed (text_view->layout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1606,6 +1621,17 @@ gtk_text_view_key_press_event (GtkWidget *widget, GdkEventKey *event)
|
|||||||
0);
|
0);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
/* Pass through Tab as literal tab, unless Control is held down */
|
||||||
|
else if (event->keyval == GDK_Tab && !(event->state & GDK_CONTROL_MASK))
|
||||||
|
{
|
||||||
|
gtk_text_buffer_insert_interactive_at_cursor (text_view->buffer, "\t", 1,
|
||||||
|
text_view->editable);
|
||||||
|
gtk_text_view_scroll_to_mark (text_view,
|
||||||
|
gtk_text_buffer_get_mark (text_view->buffer,
|
||||||
|
"insert"),
|
||||||
|
0);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -1702,7 +1728,8 @@ gtk_text_view_focus_in_event (GtkWidget *widget, GdkEventFocus *event)
|
|||||||
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
|
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
|
||||||
|
|
||||||
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
|
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
|
||||||
|
gtk_widget_draw_focus (widget);
|
||||||
|
|
||||||
if (text_view->cursor_visible && text_view->layout)
|
if (text_view->cursor_visible && text_view->layout)
|
||||||
{
|
{
|
||||||
gtk_text_layout_set_cursor_visible (text_view->layout, TRUE);
|
gtk_text_layout_set_cursor_visible (text_view->layout, TRUE);
|
||||||
@ -1720,7 +1747,8 @@ gtk_text_view_focus_out_event (GtkWidget *widget, GdkEventFocus *event)
|
|||||||
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
|
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
|
||||||
|
|
||||||
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
|
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
|
||||||
|
gtk_widget_draw_focus (widget);
|
||||||
|
|
||||||
if (text_view->cursor_visible && text_view->layout)
|
if (text_view->cursor_visible && text_view->layout)
|
||||||
{
|
{
|
||||||
gtk_text_layout_set_cursor_visible (text_view->layout, FALSE);
|
gtk_text_layout_set_cursor_visible (text_view->layout, FALSE);
|
||||||
@ -1761,7 +1789,8 @@ gtk_text_view_paint (GtkWidget *widget, GdkRectangle *area)
|
|||||||
gtk_text_layout_draw (text_view->layout,
|
gtk_text_layout_draw (text_view->layout,
|
||||||
widget,
|
widget,
|
||||||
text_view->bin_window,
|
text_view->bin_window,
|
||||||
text_view->xoffset, text_view->yoffset,
|
text_view->xoffset,
|
||||||
|
text_view->yoffset,
|
||||||
area->x, area->y,
|
area->x, area->y,
|
||||||
area->width, area->height);
|
area->width, area->height);
|
||||||
}
|
}
|
||||||
@ -1781,6 +1810,23 @@ gtk_text_view_expose_event (GtkWidget *widget, GdkEventExpose *event)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_text_view_draw_focus (GtkWidget *widget)
|
||||||
|
{
|
||||||
|
if (GTK_WIDGET_DRAWABLE (widget))
|
||||||
|
{
|
||||||
|
if (GTK_WIDGET_HAS_FOCUS (widget))
|
||||||
|
{
|
||||||
|
|
||||||
|
gtk_paint_focus (widget->style, widget->window,
|
||||||
|
NULL, widget, "textview",
|
||||||
|
0, 0,
|
||||||
|
widget->allocation.width - 1,
|
||||||
|
widget->allocation.height - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Blink!
|
* Blink!
|
||||||
*/
|
*/
|
||||||
@ -1987,10 +2033,10 @@ gtk_text_view_scroll_pages (GtkTextView *text_view,
|
|||||||
|
|
||||||
gtk_text_layout_validate_yrange (text_view->layout, &anchor, y0, y1);
|
gtk_text_layout_validate_yrange (text_view->layout, &anchor, y0, y1);
|
||||||
|
|
||||||
|
|
||||||
gtk_text_view_get_virtual_cursor_pos (text_view, &cursor_x_pos, &cursor_y_pos);
|
gtk_text_view_get_virtual_cursor_pos (text_view, &cursor_x_pos, &cursor_y_pos);
|
||||||
|
|
||||||
newval = adj->value;
|
newval = adj->value;
|
||||||
|
|
||||||
newval += count * adj->page_increment;
|
newval += count * adj->page_increment;
|
||||||
|
|
||||||
cursor_y_pos += newval - adj->value;
|
cursor_y_pos += newval - adj->value;
|
||||||
@ -2222,9 +2268,9 @@ move_insert_to_pointer_and_scroll (GtkTextView *text_view, gboolean partial_scro
|
|||||||
in case you want to do a continuous slow scroll. */
|
in case you want to do a continuous slow scroll. */
|
||||||
#define SLOW_SCROLL_TH 7
|
#define SLOW_SCROLL_TH 7
|
||||||
if (x >= (0 - SLOW_SCROLL_TH) &&
|
if (x >= (0 - SLOW_SCROLL_TH) &&
|
||||||
x < (GTK_WIDGET (text_view)->allocation.width + SLOW_SCROLL_TH) &&
|
x < (SCREEN_WIDTH (text_view) + SLOW_SCROLL_TH) &&
|
||||||
y >= (0 - SLOW_SCROLL_TH) &&
|
y >= (0 - SLOW_SCROLL_TH) &&
|
||||||
y < (GTK_WIDGET (text_view)->allocation.height + SLOW_SCROLL_TH))
|
y < (SCREEN_HEIGHT (text_view) + SLOW_SCROLL_TH))
|
||||||
{
|
{
|
||||||
adjust = 0;
|
adjust = 0;
|
||||||
in_threshold = TRUE;
|
in_threshold = TRUE;
|
||||||
@ -2394,13 +2440,12 @@ static void
|
|||||||
gtk_text_view_scroll_calc_now (GtkTextView *text_view)
|
gtk_text_view_scroll_calc_now (GtkTextView *text_view)
|
||||||
{
|
{
|
||||||
gint width = 0, height = 0;
|
gint width = 0, height = 0;
|
||||||
GtkWidget *widget = GTK_WIDGET (text_view);
|
|
||||||
|
|
||||||
gtk_text_view_ensure_layout (text_view);
|
gtk_text_view_ensure_layout (text_view);
|
||||||
|
|
||||||
|
|
||||||
gtk_text_layout_set_screen_width (text_view->layout,
|
gtk_text_layout_set_screen_width (text_view->layout,
|
||||||
widget->allocation.width);
|
SCREEN_WIDTH (text_view));
|
||||||
|
|
||||||
gtk_text_layout_get_size (text_view->layout, &width, &height);
|
gtk_text_layout_get_size (text_view->layout, &width, &height);
|
||||||
|
|
||||||
@ -2427,9 +2472,9 @@ gtk_text_view_scroll_calc_now (GtkTextView *text_view)
|
|||||||
text_view->height = height;
|
text_view->height = height;
|
||||||
|
|
||||||
gtk_text_view_set_adjustment_upper (get_hadjustment (text_view),
|
gtk_text_view_set_adjustment_upper (get_hadjustment (text_view),
|
||||||
MAX (widget->allocation.width, width));
|
MAX (SCREEN_WIDTH (text_view), width));
|
||||||
gtk_text_view_set_adjustment_upper (get_vadjustment (text_view),
|
gtk_text_view_set_adjustment_upper (get_vadjustment (text_view),
|
||||||
MAX (widget->allocation.height, height));
|
MAX (SCREEN_HEIGHT (text_view), height));
|
||||||
|
|
||||||
/* hadj/vadj exist since we called get_hadjustment/get_vadjustment above */
|
/* hadj/vadj exist since we called get_hadjustment/get_vadjustment above */
|
||||||
|
|
||||||
@ -2437,21 +2482,21 @@ gtk_text_view_scroll_calc_now (GtkTextView *text_view)
|
|||||||
our allocation minus one step, and a step is
|
our allocation minus one step, and a step is
|
||||||
1/10 of our allocation. */
|
1/10 of our allocation. */
|
||||||
text_view->hadjustment->step_increment =
|
text_view->hadjustment->step_increment =
|
||||||
GTK_WIDGET (text_view)->allocation.width/10.0;
|
SCREEN_WIDTH (text_view) / 10.0;
|
||||||
text_view->hadjustment->page_increment =
|
text_view->hadjustment->page_increment =
|
||||||
GTK_WIDGET (text_view)->allocation.width *0.9;
|
SCREEN_WIDTH (text_view) * 0.9;
|
||||||
|
|
||||||
text_view->vadjustment->step_increment =
|
text_view->vadjustment->step_increment =
|
||||||
GTK_WIDGET (text_view)->allocation.height/10.0;
|
SCREEN_HEIGHT (text_view) / 10.0;
|
||||||
text_view->vadjustment->page_increment =
|
text_view->vadjustment->page_increment =
|
||||||
GTK_WIDGET (text_view)->allocation.height *0.9;
|
SCREEN_HEIGHT (text_view) * 0.9;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_text_view_set_values_from_style (GtkTextView *text_view,
|
gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
|
||||||
GtkTextAttributes *values,
|
GtkTextAttributes *values,
|
||||||
GtkStyle *style)
|
GtkStyle *style)
|
||||||
{
|
{
|
||||||
values->appearance.bg_color = style->base[GTK_STATE_NORMAL];
|
values->appearance.bg_color = style->base[GTK_STATE_NORMAL];
|
||||||
values->appearance.fg_color = style->fg[GTK_STATE_NORMAL];
|
values->appearance.fg_color = style->fg[GTK_STATE_NORMAL];
|
||||||
@ -2507,7 +2552,8 @@ gtk_text_view_ensure_layout (GtkTextView *text_view)
|
|||||||
style = gtk_text_attributes_new ();
|
style = gtk_text_attributes_new ();
|
||||||
|
|
||||||
gtk_widget_ensure_style (widget);
|
gtk_widget_ensure_style (widget);
|
||||||
gtk_text_view_set_values_from_style (text_view, style, widget->style);
|
gtk_text_view_set_attributes_from_style (text_view,
|
||||||
|
style, widget->style);
|
||||||
|
|
||||||
style->pixels_above_lines = 2;
|
style->pixels_above_lines = 2;
|
||||||
style->pixels_below_lines = 2;
|
style->pixels_below_lines = 2;
|
||||||
@ -2691,7 +2737,7 @@ gtk_text_view_drag_motion (GtkWidget *widget,
|
|||||||
the selection. */
|
the selection. */
|
||||||
gint margin;
|
gint margin;
|
||||||
|
|
||||||
margin = MIN (widget->allocation.width, widget->allocation.height);
|
margin = MIN (SCREEN_WIDTH (widget), SCREEN_HEIGHT (widget));
|
||||||
margin /= 5;
|
margin /= 5;
|
||||||
|
|
||||||
gtk_text_view_scroll_to_mark_adjusted (text_view,
|
gtk_text_view_scroll_to_mark_adjusted (text_view,
|
||||||
@ -2752,6 +2798,7 @@ gtk_text_view_drag_data_received (GtkWidget *widget,
|
|||||||
drag_target_mark);
|
drag_target_mark);
|
||||||
|
|
||||||
str = gtk_selection_data_get_text (selection_data);
|
str = gtk_selection_data_get_text (selection_data);
|
||||||
|
|
||||||
if (str)
|
if (str)
|
||||||
{
|
{
|
||||||
gtk_text_buffer_insert_interactive (text_view->buffer,
|
gtk_text_buffer_insert_interactive (text_view->buffer,
|
||||||
|
|||||||
@ -88,7 +88,7 @@ struct _GtkTextViewClass {
|
|||||||
void (* paste_clipboard) (GtkTextView *text_view);
|
void (* paste_clipboard) (GtkTextView *text_view);
|
||||||
/* overwrite */
|
/* overwrite */
|
||||||
void (* toggle_overwrite) (GtkTextView *text_view);
|
void (* toggle_overwrite) (GtkTextView *text_view);
|
||||||
void (*set_scroll_adjustments) (GtkTextView *text_view,
|
void (* set_scroll_adjustments) (GtkTextView *text_view,
|
||||||
GtkAdjustment *hadjustment,
|
GtkAdjustment *hadjustment,
|
||||||
GtkAdjustment *vadjustment);
|
GtkAdjustment *vadjustment);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -22,6 +22,7 @@ struct _Buffer
|
|||||||
gint untitled_serial;
|
gint untitled_serial;
|
||||||
GtkTextTag *not_editable_tag;
|
GtkTextTag *not_editable_tag;
|
||||||
GtkTextTag *found_text_tag;
|
GtkTextTag *found_text_tag;
|
||||||
|
GtkTextTag *custom_tabs_tag;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _View
|
struct _View
|
||||||
@ -895,6 +896,34 @@ do_apply_editable (gpointer callback_data,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
do_apply_tabs (gpointer callback_data,
|
||||||
|
guint callback_action,
|
||||||
|
GtkWidget *widget)
|
||||||
|
{
|
||||||
|
View *view = view_from_widget (widget);
|
||||||
|
GtkTextIter start;
|
||||||
|
GtkTextIter end;
|
||||||
|
|
||||||
|
if (gtk_text_buffer_get_selection_bounds (view->buffer->buffer,
|
||||||
|
&start, &end))
|
||||||
|
{
|
||||||
|
if (callback_action)
|
||||||
|
{
|
||||||
|
gtk_text_buffer_remove_tag (view->buffer->buffer,
|
||||||
|
view->buffer->custom_tabs_tag,
|
||||||
|
&start, &end);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_text_buffer_apply_tag (view->buffer->buffer,
|
||||||
|
view->buffer->custom_tabs_tag,
|
||||||
|
&start, &end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_response_callback (GtkWidget *dialog, gint response_id, gpointer data)
|
dialog_response_callback (GtkWidget *dialog, gint response_id, gpointer data)
|
||||||
{
|
{
|
||||||
@ -1033,6 +1062,8 @@ static GtkItemFactoryEntry menu_items[] =
|
|||||||
{ "/_Attributes", NULL, 0, 0, "<Branch>" },
|
{ "/_Attributes", NULL, 0, 0, "<Branch>" },
|
||||||
{ "/Attributes/Editable", NULL, do_apply_editable, TRUE, NULL },
|
{ "/Attributes/Editable", NULL, do_apply_editable, TRUE, NULL },
|
||||||
{ "/Attributes/Not editable", NULL, do_apply_editable, FALSE, NULL },
|
{ "/Attributes/Not editable", NULL, do_apply_editable, FALSE, NULL },
|
||||||
|
{ "/Attributes/Custom tabs", NULL, do_apply_tabs, FALSE, NULL },
|
||||||
|
{ "/Attributes/Default tabs", NULL, do_apply_tabs, TRUE, NULL },
|
||||||
{ "/_Test", NULL, 0, 0, "<Branch>" },
|
{ "/_Test", NULL, 0, 0, "<Branch>" },
|
||||||
{ "/Test/_Example", NULL, do_example, 0, NULL },
|
{ "/Test/_Example", NULL, do_example, 0, NULL },
|
||||||
};
|
};
|
||||||
@ -1187,7 +1218,8 @@ static Buffer *
|
|||||||
create_buffer (void)
|
create_buffer (void)
|
||||||
{
|
{
|
||||||
Buffer *buffer;
|
Buffer *buffer;
|
||||||
|
PangoTabArray *tabs;
|
||||||
|
|
||||||
buffer = g_new (Buffer, 1);
|
buffer = g_new (Buffer, 1);
|
||||||
|
|
||||||
buffer->buffer = gtk_text_buffer_new (NULL);
|
buffer->buffer = gtk_text_buffer_new (NULL);
|
||||||
@ -1206,6 +1238,20 @@ create_buffer (void)
|
|||||||
buffer->found_text_tag = gtk_text_buffer_create_tag (buffer->buffer, NULL);
|
buffer->found_text_tag = gtk_text_buffer_create_tag (buffer->buffer, NULL);
|
||||||
gtk_object_set (GTK_OBJECT (buffer->found_text_tag),
|
gtk_object_set (GTK_OBJECT (buffer->found_text_tag),
|
||||||
"foreground", "red", NULL);
|
"foreground", "red", NULL);
|
||||||
|
|
||||||
|
tabs = pango_tab_array_new_with_defaults (4,
|
||||||
|
TRUE,
|
||||||
|
PANGO_TAB_LEFT, 10,
|
||||||
|
PANGO_TAB_LEFT, 30,
|
||||||
|
PANGO_TAB_LEFT, 60,
|
||||||
|
PANGO_TAB_LEFT, 120);
|
||||||
|
|
||||||
|
buffer->custom_tabs_tag = gtk_text_buffer_create_tag (buffer->buffer, NULL);
|
||||||
|
gtk_object_set (GTK_OBJECT (buffer->custom_tabs_tag),
|
||||||
|
"tabs", tabs,
|
||||||
|
"foreground", "green", NULL);
|
||||||
|
|
||||||
|
pango_tab_array_free (tabs);
|
||||||
|
|
||||||
buffers = g_slist_prepend (buffers, buffer);
|
buffers = g_slist_prepend (buffers, buffer);
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,7 @@ struct _Buffer
|
|||||||
gint untitled_serial;
|
gint untitled_serial;
|
||||||
GtkTextTag *not_editable_tag;
|
GtkTextTag *not_editable_tag;
|
||||||
GtkTextTag *found_text_tag;
|
GtkTextTag *found_text_tag;
|
||||||
|
GtkTextTag *custom_tabs_tag;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _View
|
struct _View
|
||||||
@ -895,6 +896,34 @@ do_apply_editable (gpointer callback_data,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
do_apply_tabs (gpointer callback_data,
|
||||||
|
guint callback_action,
|
||||||
|
GtkWidget *widget)
|
||||||
|
{
|
||||||
|
View *view = view_from_widget (widget);
|
||||||
|
GtkTextIter start;
|
||||||
|
GtkTextIter end;
|
||||||
|
|
||||||
|
if (gtk_text_buffer_get_selection_bounds (view->buffer->buffer,
|
||||||
|
&start, &end))
|
||||||
|
{
|
||||||
|
if (callback_action)
|
||||||
|
{
|
||||||
|
gtk_text_buffer_remove_tag (view->buffer->buffer,
|
||||||
|
view->buffer->custom_tabs_tag,
|
||||||
|
&start, &end);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_text_buffer_apply_tag (view->buffer->buffer,
|
||||||
|
view->buffer->custom_tabs_tag,
|
||||||
|
&start, &end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_response_callback (GtkWidget *dialog, gint response_id, gpointer data)
|
dialog_response_callback (GtkWidget *dialog, gint response_id, gpointer data)
|
||||||
{
|
{
|
||||||
@ -1033,6 +1062,8 @@ static GtkItemFactoryEntry menu_items[] =
|
|||||||
{ "/_Attributes", NULL, 0, 0, "<Branch>" },
|
{ "/_Attributes", NULL, 0, 0, "<Branch>" },
|
||||||
{ "/Attributes/Editable", NULL, do_apply_editable, TRUE, NULL },
|
{ "/Attributes/Editable", NULL, do_apply_editable, TRUE, NULL },
|
||||||
{ "/Attributes/Not editable", NULL, do_apply_editable, FALSE, NULL },
|
{ "/Attributes/Not editable", NULL, do_apply_editable, FALSE, NULL },
|
||||||
|
{ "/Attributes/Custom tabs", NULL, do_apply_tabs, FALSE, NULL },
|
||||||
|
{ "/Attributes/Default tabs", NULL, do_apply_tabs, TRUE, NULL },
|
||||||
{ "/_Test", NULL, 0, 0, "<Branch>" },
|
{ "/_Test", NULL, 0, 0, "<Branch>" },
|
||||||
{ "/Test/_Example", NULL, do_example, 0, NULL },
|
{ "/Test/_Example", NULL, do_example, 0, NULL },
|
||||||
};
|
};
|
||||||
@ -1187,7 +1218,8 @@ static Buffer *
|
|||||||
create_buffer (void)
|
create_buffer (void)
|
||||||
{
|
{
|
||||||
Buffer *buffer;
|
Buffer *buffer;
|
||||||
|
PangoTabArray *tabs;
|
||||||
|
|
||||||
buffer = g_new (Buffer, 1);
|
buffer = g_new (Buffer, 1);
|
||||||
|
|
||||||
buffer->buffer = gtk_text_buffer_new (NULL);
|
buffer->buffer = gtk_text_buffer_new (NULL);
|
||||||
@ -1206,6 +1238,20 @@ create_buffer (void)
|
|||||||
buffer->found_text_tag = gtk_text_buffer_create_tag (buffer->buffer, NULL);
|
buffer->found_text_tag = gtk_text_buffer_create_tag (buffer->buffer, NULL);
|
||||||
gtk_object_set (GTK_OBJECT (buffer->found_text_tag),
|
gtk_object_set (GTK_OBJECT (buffer->found_text_tag),
|
||||||
"foreground", "red", NULL);
|
"foreground", "red", NULL);
|
||||||
|
|
||||||
|
tabs = pango_tab_array_new_with_defaults (4,
|
||||||
|
TRUE,
|
||||||
|
PANGO_TAB_LEFT, 10,
|
||||||
|
PANGO_TAB_LEFT, 30,
|
||||||
|
PANGO_TAB_LEFT, 60,
|
||||||
|
PANGO_TAB_LEFT, 120);
|
||||||
|
|
||||||
|
buffer->custom_tabs_tag = gtk_text_buffer_create_tag (buffer->buffer, NULL);
|
||||||
|
gtk_object_set (GTK_OBJECT (buffer->custom_tabs_tag),
|
||||||
|
"tabs", tabs,
|
||||||
|
"foreground", "green", NULL);
|
||||||
|
|
||||||
|
pango_tab_array_free (tabs);
|
||||||
|
|
||||||
buffers = g_slist_prepend (buffers, buffer);
|
buffers = g_slist_prepend (buffers, buffer);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user