fix this to be sane

2000-12-04  Havoc Pennington  <hp@redhat.com>

	* gtk/gtkpaned.c (gtk_paned_expose): fix this to be sane

	* gtk/gtkvpaned.c (gtk_vpaned_expose): Add an expose handler

	* gtk/gtkhpaned.c (gtk_hpaned_expose): Add an expose handler

	* gtk/gtknotebook.c (gtk_notebook_draw_tab): put in a temporary
	hack to avoid infinite loops (queue draw instead of draw) -
	Owen has more appropriate fixes in a branch he'll check in later.

	* gtk/gtktextiter.c (gtk_text_iter_ends_line): handle paragraph
	separator, CR, and CRLF as line ends

	* gtk/gtktextbtree.c (gtk_text_btree_insert): on insertion, break
	into lines using pango_find_paragraph_boundary(); other bits of
	the widget are still going to be broken if the boundary isn't '\n'
	though
This commit is contained in:
Havoc Pennington 2000-12-04 23:04:17 +00:00 committed by Havoc Pennington
parent d77144614b
commit 9365d0d7dc
20 changed files with 450 additions and 155 deletions

View File

@ -1,3 +1,23 @@
2000-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtkpaned.c (gtk_paned_expose): fix this to be sane
* gtk/gtkvpaned.c (gtk_vpaned_expose): Add an expose handler
* gtk/gtkhpaned.c (gtk_hpaned_expose): Add an expose handler
* gtk/gtknotebook.c (gtk_notebook_draw_tab): put in a temporary
hack to avoid infinite loops (queue draw instead of draw) -
Owen has more appropriate fixes in a branch he'll check in later.
* gtk/gtktextiter.c (gtk_text_iter_ends_line): handle paragraph
separator, CR, and CRLF as line ends
* gtk/gtktextbtree.c (gtk_text_btree_insert): on insertion, break
into lines using pango_find_paragraph_boundary(); other bits of
the widget are still going to be broken if the boundary isn't '\n'
though
2000-12-04 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkfont-fb.c (gdk_text_width): Divide size by 2, not

View File

@ -1,3 +1,23 @@
2000-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtkpaned.c (gtk_paned_expose): fix this to be sane
* gtk/gtkvpaned.c (gtk_vpaned_expose): Add an expose handler
* gtk/gtkhpaned.c (gtk_hpaned_expose): Add an expose handler
* gtk/gtknotebook.c (gtk_notebook_draw_tab): put in a temporary
hack to avoid infinite loops (queue draw instead of draw) -
Owen has more appropriate fixes in a branch he'll check in later.
* gtk/gtktextiter.c (gtk_text_iter_ends_line): handle paragraph
separator, CR, and CRLF as line ends
* gtk/gtktextbtree.c (gtk_text_btree_insert): on insertion, break
into lines using pango_find_paragraph_boundary(); other bits of
the widget are still going to be broken if the boundary isn't '\n'
though
2000-12-04 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkfont-fb.c (gdk_text_width): Divide size by 2, not

View File

@ -1,3 +1,23 @@
2000-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtkpaned.c (gtk_paned_expose): fix this to be sane
* gtk/gtkvpaned.c (gtk_vpaned_expose): Add an expose handler
* gtk/gtkhpaned.c (gtk_hpaned_expose): Add an expose handler
* gtk/gtknotebook.c (gtk_notebook_draw_tab): put in a temporary
hack to avoid infinite loops (queue draw instead of draw) -
Owen has more appropriate fixes in a branch he'll check in later.
* gtk/gtktextiter.c (gtk_text_iter_ends_line): handle paragraph
separator, CR, and CRLF as line ends
* gtk/gtktextbtree.c (gtk_text_btree_insert): on insertion, break
into lines using pango_find_paragraph_boundary(); other bits of
the widget are still going to be broken if the boundary isn't '\n'
though
2000-12-04 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkfont-fb.c (gdk_text_width): Divide size by 2, not

View File

@ -1,3 +1,23 @@
2000-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtkpaned.c (gtk_paned_expose): fix this to be sane
* gtk/gtkvpaned.c (gtk_vpaned_expose): Add an expose handler
* gtk/gtkhpaned.c (gtk_hpaned_expose): Add an expose handler
* gtk/gtknotebook.c (gtk_notebook_draw_tab): put in a temporary
hack to avoid infinite loops (queue draw instead of draw) -
Owen has more appropriate fixes in a branch he'll check in later.
* gtk/gtktextiter.c (gtk_text_iter_ends_line): handle paragraph
separator, CR, and CRLF as line ends
* gtk/gtktextbtree.c (gtk_text_btree_insert): on insertion, break
into lines using pango_find_paragraph_boundary(); other bits of
the widget are still going to be broken if the boundary isn't '\n'
though
2000-12-04 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkfont-fb.c (gdk_text_width): Divide size by 2, not

View File

@ -1,3 +1,23 @@
2000-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtkpaned.c (gtk_paned_expose): fix this to be sane
* gtk/gtkvpaned.c (gtk_vpaned_expose): Add an expose handler
* gtk/gtkhpaned.c (gtk_hpaned_expose): Add an expose handler
* gtk/gtknotebook.c (gtk_notebook_draw_tab): put in a temporary
hack to avoid infinite loops (queue draw instead of draw) -
Owen has more appropriate fixes in a branch he'll check in later.
* gtk/gtktextiter.c (gtk_text_iter_ends_line): handle paragraph
separator, CR, and CRLF as line ends
* gtk/gtktextbtree.c (gtk_text_btree_insert): on insertion, break
into lines using pango_find_paragraph_boundary(); other bits of
the widget are still going to be broken if the boundary isn't '\n'
though
2000-12-04 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkfont-fb.c (gdk_text_width): Divide size by 2, not

View File

@ -1,3 +1,23 @@
2000-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtkpaned.c (gtk_paned_expose): fix this to be sane
* gtk/gtkvpaned.c (gtk_vpaned_expose): Add an expose handler
* gtk/gtkhpaned.c (gtk_hpaned_expose): Add an expose handler
* gtk/gtknotebook.c (gtk_notebook_draw_tab): put in a temporary
hack to avoid infinite loops (queue draw instead of draw) -
Owen has more appropriate fixes in a branch he'll check in later.
* gtk/gtktextiter.c (gtk_text_iter_ends_line): handle paragraph
separator, CR, and CRLF as line ends
* gtk/gtktextbtree.c (gtk_text_btree_insert): on insertion, break
into lines using pango_find_paragraph_boundary(); other bits of
the widget are still going to be broken if the boundary isn't '\n'
though
2000-12-04 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkfont-fb.c (gdk_text_width): Divide size by 2, not

View File

@ -1,3 +1,23 @@
2000-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtkpaned.c (gtk_paned_expose): fix this to be sane
* gtk/gtkvpaned.c (gtk_vpaned_expose): Add an expose handler
* gtk/gtkhpaned.c (gtk_hpaned_expose): Add an expose handler
* gtk/gtknotebook.c (gtk_notebook_draw_tab): put in a temporary
hack to avoid infinite loops (queue draw instead of draw) -
Owen has more appropriate fixes in a branch he'll check in later.
* gtk/gtktextiter.c (gtk_text_iter_ends_line): handle paragraph
separator, CR, and CRLF as line ends
* gtk/gtktextbtree.c (gtk_text_btree_insert): on insertion, break
into lines using pango_find_paragraph_boundary(); other bits of
the widget are still going to be broken if the boundary isn't '\n'
though
2000-12-04 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkfont-fb.c (gdk_text_width): Divide size by 2, not

View File

@ -94,19 +94,6 @@ Creating a pixbuf from image data that is already in memory.
@Returns:
<!-- ##### FUNCTION gdk_pixbuf_new_subpixbuf ##### -->
<para>
</para>
@src_pixbuf:
@src_x:
@src_y:
@width:
@height:
@Returns:
<!-- ##### FUNCTION gdk_pixbuf_copy ##### -->
<para>

View File

@ -130,3 +130,77 @@ Application-driven progressive image loading.
@loader:
<!-- ##### SIGNAL GdkPixbufLoader::area-updated ##### -->
<para>
This signal is emitted when a significant area of the image being
loaded has been updated. Normally it means that a complete
scanline has been read in, but it could be a different area as
well. Applications can use this signal to know when to repaint
areas of an image that is being loaded.
</para>
@gdkpixbufloader: the object which received the signal.
@arg1:
@arg2:
@arg3:
@arg4:
<!-- # Unused Parameters # -->
@loader: Loader which emitted the signal.
@x: X offset of upper-left corner of the updated area.
@y: Y offset of upper-left corner of the updated area.
@width: Width of updated area.
@height: Height of updated area.
<!-- ##### SIGNAL GdkPixbufLoader::area-prepared ##### -->
<para>
This signal is emitted when the pixbuf loader has been fed the
initial amount of data that is required to figure out the size and
format of the image that it will create. After this signal is
emitted, applications can call gdk_pixbuf_loader_get_pixbuf() to
fetch the partially-loaded pixbuf.
</para>
@gdkpixbufloader: the object which received the signal.
<!-- # Unused Parameters # -->
@loader: Loader which emitted the signal.
<!-- ##### SIGNAL GdkPixbufLoader::frame-done ##### -->
<para>
This signal is emitted when a frame is done loading. It will be
emitted for each frame in an animation data stream.
</para>
@gdkpixbufloader: the object which received the signal.
@arg1:
<!-- # Unused Parameters # -->
@loader: Loader which emitted the signal.
@frame: Frame which just completed loading.
<!-- ##### SIGNAL GdkPixbufLoader::animation-done ##### -->
<para>
This signal is emitted when an animation is done loading.
</para>
@gdkpixbufloader: the object which received the signal.
<!-- # Unused Parameters # -->
@loader: Loader which emitted the signal.
<!-- ##### SIGNAL GdkPixbufLoader::closed ##### -->
<para>
This signal is emitted when gdk_pixbuf_loader_close() is called.
It can be used by different parts of an application to receive
notification when an image loader is closed by the code that
drives it.
</para>
@gdkpixbufloader: the object which received the signal.
<!-- # Unused Parameters # -->
@loader: Loader which emitted the signal.
<!--
Local variables:
mode: sgml
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
End:
-->

View File

@ -1,3 +1,7 @@
<!-- ##### SECTION ./tmpl/from-drawables.sgml:Title ##### -->
Drawables to Pixbufs
<!-- ##### USER_FUNCTION GdkPixbufLastUnref ##### -->
<para>
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.
@data: User closure data.
<!-- ##### SECTION ./tmpl/from-drawables.sgml:Title ##### -->
Drawables to Pixbufs
<!-- ##### ARG GnomeCanvasPixbuf:height_pixels ##### -->
<para>
@ -65,34 +65,6 @@ End:
</para>
<!-- ##### SIGNAL GdkPixbufLoader::animation-done ##### -->
<para>
This signal is emitted when an animation is done loading.
</para>
@gdkpixbufloader: the object which received the signal.
@loader: Loader which emitted the signal.
<!-- ##### SIGNAL GdkPixbufLoader::area-updated ##### -->
<para>
This signal is emitted when a significant area of the image being
loaded has been updated. Normally it means that a complete
scanline has been read in, but it could be a different area as
well. Applications can use this signal to know when to repaint
areas of an image that is being loaded.
</para>
@gdkpixbufloader: the object which received the signal.
@arg1:
@arg2:
@arg3:
@arg4:
@loader: Loader which emitted the signal.
@x: X offset of upper-left corner of the updated area.
@y: Y offset of upper-left corner of the updated area.
@width: Width of updated area.
@height: Height of updated area.
<!-- ##### FUNCTION gdk_pixbuf_render_to_drawable ##### -->
<para>
@ -150,17 +122,6 @@ End:
</para>
<!-- ##### SIGNAL GdkPixbufLoader::frame-done ##### -->
<para>
This signal is emitted when a frame is done loading. It will be
emitted for each frame in an animation data stream.
</para>
@gdkpixbufloader: the object which received the signal.
@arg1:
@loader: Loader which emitted the signal.
@frame: Frame which just completed loading.
<!-- ##### SECTION ./tmpl/xlib-init.sgml:Short_Description ##### -->
Initializing the &gdk-pixbuf; Xlib library.
@ -194,24 +155,6 @@ Initializing the &gdk-pixbuf; Xlib library.
</para>
<!-- ##### SIGNAL GdkPixbufLoader::closed ##### -->
<para>
This signal is emitted when gdk_pixbuf_loader_close() is called.
It can be used by different parts of an application to receive
notification when an image loader is closed by the code that
drives it.
</para>
@gdkpixbufloader: the object which received the signal.
@loader: Loader which emitted the signal.
<!--
Local variables:
mode: sgml
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
End:
-->
<!-- ##### ARG GnomeCanvasPixbuf:y_in_pixels ##### -->
<para>
Works in the same way as the <link
@ -452,17 +395,17 @@ Rendering a pixbuf to a GDK drawable.
Getting parts of an X drawable's image data into a pixbuf.
<!-- ##### SIGNAL GdkPixbufLoader::area-prepared ##### -->
<para>
This signal is emitted when the pixbuf loader has been fed the
initial amount of data that is required to figure out the size and
format of the image that it will create. After this signal is
emitted, applications can call gdk_pixbuf_loader_get_pixbuf() to
fetch the partially-loaded pixbuf.
</para>
<!-- ##### FUNCTION gdk_pixbuf_new_subpixbuf ##### -->
<para>
@gdkpixbufloader: the object which received the signal.
@loader: Loader which emitted the signal.
</para>
@src_pixbuf:
@src_x:
@src_y:
@width:
@height:
@Returns:
<!-- ##### SECTION ./tmpl/xlib-rgb.sgml:Title ##### -->
XlibRGB
@ -484,18 +427,18 @@ XlibRGB
</para>
<!-- ##### SECTION ./tmpl/from-drawables.sgml:See_Also ##### -->
<para>
gdk_image_get().
</para>
<!-- ##### SECTION ./tmpl/xlib-from-drawables.sgml:See_Also ##### -->
<para>
</para>
<!-- ##### SECTION ./tmpl/from-drawables.sgml:See_Also ##### -->
<para>
gdk_image_get().
</para>
<!-- ##### STRUCT GdkPixbufAnimationClass ##### -->
<para>

View File

@ -163,6 +163,15 @@ onto the predefined valuator types that GTK+ understands.
@axes: an array of GdkAxisUse. This length of this array
must match the number of axes for the device.
<!-- ##### STRUCT GdkSpan ##### -->
<para>
</para>
@x:
@y:
@width:
<!-- ##### FUNCTION gdk_input_set_source ##### -->
<para>
Sets the source type for a device.
@ -171,6 +180,20 @@ Sets the source type for a device.
@deviceid: the device to configure
@source: the new source type.
<!-- ##### FUNCTION gdk_region_spans_intersect_foreach ##### -->
<para>
Intersects a set of spans with a region and call a user specified
function for each resulting spanline. This function is a lot more effective
if the spans are sorted.
</para>
@region: The region to intersect against.
@spans: Array of spans to intersect.
@n_spans: Number of spans.
@sorted: True if the spans are sorted in increasing y order.
@function: The function to call for each intersected spanline.
@data: Opaque user data passed to function.
<!-- ##### SECTION ./tmpl/gdkregion.sgml:Title ##### -->
Points, Rectangles and Regions
@ -184,6 +207,14 @@ Returns the intersection of two regions.
@source2: a #GdkRegion.
@Returns: the intersection of @source1 and @source2.
<!-- ##### USER_FUNCTION GdkSpanFunc ##### -->
<para>
</para>
@span: The intersected part of the span.
@data: Opaque data passed by user.
<!-- ##### FUNCTION gdk_input_set_mode ##### -->
<para>
Enables or disables a device, and determines how the

View File

@ -266,36 +266,3 @@ Returns the union of a region and a rectangle.
@source2:
<!-- ##### STRUCT GdkSpan ##### -->
<para>
</para>
@x:
@y:
@width:
<!-- ##### USER_FUNCTION GdkSpanFunc ##### -->
<para>
</para>
@span: The intersected part of the span.
@data: Opaque data passed by user.
<!-- ##### FUNCTION gdk_region_spans_intersect_foreach ##### -->
<para>
Intersects a set of spans with a region and call a user specified
function for each resulting spanline. This function is a lot more effective
if the spans are sorted.
</para>
@region: The region to intersect against.
@spans: Array of spans to intersect.
@n_spans: Number of spans.
@sorted: True if the spans are sorted in increasing y order.
@function: The function to call for each intersected spanline.
@data: Opaque user data passed to function.

View File

@ -279,6 +279,8 @@ struct _GdkEventKey
guint keyval;
gint length;
gchar *string;
guint16 hardware_keycode;
guint8 keyboard_group;
};
struct _GdkEventCrossing

View File

@ -64,6 +64,7 @@ extern "C" {
/* Type definitions for the basic structures.
*/
typedef struct _GdkKeyInfo GdkKeyInfo;
typedef struct _GdkPoint GdkPoint;
typedef struct _GdkRectangle GdkRectangle;
typedef struct _GdkSegment GdkSegment;
@ -163,6 +164,16 @@ typedef void (*GdkInputFunction) (gpointer data,
typedef void (*GdkDestroyNotify) (gpointer data);
/* GdkKeyInfo is a description of a the hardware key and state that
* can be mapped to some keysym.
*/
struct _GdkKeyInfo
{
guint keycode;
gint group;
gint level;
};
struct _GdkPoint
{
gint x;

View File

@ -32,6 +32,8 @@ static void gtk_hpaned_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_hpaned_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static gint gtk_hpaned_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_hpaned_xor_line (GtkPaned *paned);
static gboolean gtk_hpaned_button_press (GtkWidget *widget,
GdkEventButton *event);
@ -40,6 +42,8 @@ static gboolean gtk_hpaned_button_release (GtkWidget *widget,
static gboolean gtk_hpaned_motion (GtkWidget *widget,
GdkEventMotion *event);
static gpointer parent_class;
GtkType
gtk_hpaned_get_type (void)
{
@ -70,10 +74,13 @@ gtk_hpaned_class_init (GtkHPanedClass *class)
{
GtkWidgetClass *widget_class;
parent_class = gtk_type_class (GTK_TYPE_PANED);
widget_class = (GtkWidgetClass *) class;
widget_class->size_request = gtk_hpaned_size_request;
widget_class->size_allocate = gtk_hpaned_size_allocate;
widget_class->expose_event = gtk_hpaned_expose;
widget_class->button_press_event = gtk_hpaned_button_press;
widget_class->button_release_event = gtk_hpaned_button_release;
widget_class->motion_notify_event = gtk_hpaned_motion;
@ -221,6 +228,48 @@ gtk_hpaned_size_allocate (GtkWidget *widget,
}
}
static gint
gtk_hpaned_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkPaned *paned;
guint16 border_width;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_PANED (widget), FALSE);
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
{
paned = GTK_PANED (widget);
border_width = GTK_CONTAINER (paned)->border_width;
if (event->window == widget->window)
{
gdk_window_clear_area (widget->window,
event->area.x, event->area.y,
event->area.width,
event->area.height);
/* Chain up to draw children */
GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
}
else if (event->window == paned->handle)
{
gtk_paint_handle (widget->style,
paned->handle,
GTK_STATE_NORMAL,
GTK_SHADOW_NONE,
&event->area,
widget,
"paned",
0, 0, -1, -1,
GTK_ORIENTATION_VERTICAL);
}
}
return FALSE;
}
static void
gtk_hpaned_xor_line (GtkPaned *paned)
{

View File

@ -2340,8 +2340,22 @@ gtk_notebook_draw_tab (GtkNotebook *notebook,
page->tab_label->allocation.width + 1,
page->tab_label->allocation.height + 1);
}
if (gtk_widget_intersect (page->tab_label, area, &child_area))
gtk_widget_draw (page->tab_label, &child_area);
if (gtk_widget_intersect (page->tab_label, area, &child_area) &&
GTK_WIDGET_DRAWABLE (page->tab_label))
{
GdkEventExpose expose_event;
/* This is a lame hack since all this code needs rewriting anyhow */
expose_event.window = page->tab_label->window;
expose_event.area = child_area;
expose_event.send_event = TRUE;
expose_event.type = GDK_EXPOSE;
expose_event.count = 0;
gtk_widget_event (page->tab_label,
(GdkEvent*)&expose_event);
}
}
}

View File

@ -295,6 +295,8 @@ gtk_paned_unrealize (GtkWidget *widget)
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
}
static gint
gtk_paned_expose (GtkWidget *widget,
GdkEventExpose *event)
@ -310,16 +312,10 @@ gtk_paned_expose (GtkWidget *widget,
{
paned = GTK_PANED (widget);
if (event->window == paned->handle)
{
child_event = *event;
event->area.x += paned->handle_xpos;
event->area.y += paned->handle_ypos;
gtk_widget_draw (widget, &event->area);
}
else
if (event->window != paned->handle)
{
child_event = *event;
if (paned->child1 &&
GTK_WIDGET_NO_WINDOW (paned->child1) &&
gtk_widget_intersect (paned->child1, &event->area, &child_event.area))

View File

@ -924,12 +924,15 @@ gtk_text_btree_insert (GtkTextIter *iter,
* added to this line). */
GtkTextLineSegment *seg;
GtkTextLine *newline;
int chunkSize; /* # characters in current chunk. */
guint sol; /* start of line */
guint eol; /* Pointer to character just after last
* one in current chunk. */
int chunk_len; /* # characters in current chunk. */
gint sol; /* start of line */
gint eol; /* Pointer to character just after last
* one in current chunk.
*/
gint delim; /* index of paragraph delimiter */
int line_count_delta; /* Counts change to total number of
* lines in file. */
* lines in file.
*/
int char_count_delta; /* change to number of chars */
GtkTextBTree *tree;
@ -968,17 +971,14 @@ gtk_text_btree_insert (GtkTextIter *iter,
char_count_delta = 0;
while (eol < len)
{
for (; eol < len; eol++)
{
if (text[eol] == '\n')
{
eol++;
break;
}
}
chunkSize = eol - sol;
pango_find_paragraph_boundary (text + sol,
len - sol,
&delim,
&eol);
seg = _gtk_char_segment_new (&text[sol], chunkSize);
chunk_len = eol - sol;
seg = _gtk_char_segment_new (&text[sol], chunk_len);
char_count_delta += seg->char_count;
@ -993,10 +993,9 @@ gtk_text_btree_insert (GtkTextIter *iter,
cur_seg->next = seg;
}
if (text[eol-1] != '\n')
{
break;
}
if (delim == eol)
/* chunk didn't end with a paragraph separator */
break;
/*
* The chunk ended with a newline, so create a new GtkTextLine
@ -6703,7 +6702,7 @@ gtk_text_btree_spew_line_short (GtkTextLine *line, int indent)
s = str;
while (*s)
{
if (*s == '\n')
if (*s == '\n' || *s == '\r')
*s = '\\';
++s;
}

View File

@ -1326,18 +1326,49 @@ gtk_text_iter_starts_line (const GtkTextIter *iter)
* gtk_text_iter_ends_line:
* @iter: an iterator
*
* Returns TRUE if @iter points to a newline character.
* Returns TRUE if @iter points to the start of the paragraph delimiter
* characters for a line (delimiters will be either a newline, a
* carriage return, a carriage return followed by a newline, or a
* Unicode paragraph separator character). Note that an iterator pointing
* to the \n of a \r\n pair will not be counted as the end of a line,
* the line ends before the \r.
*
* Return value: whether @iter is at the end of a line
**/
gboolean
gtk_text_iter_ends_line (const GtkTextIter *iter)
{
GtkTextRealIter *real;
gunichar wc;
g_return_val_if_fail (iter != NULL, FALSE);
real = gtk_text_iter_make_real (iter);
check_invariants (iter);
return gtk_text_iter_get_char (iter) == '\n';
/* Only one character has type G_UNICODE_PARAGRAPH_SEPARATOR in
* Unicode 3.0; update this if that changes.
*/
#define PARAGRAPH_SEPARATOR 0x2029
wc = gtk_text_iter_get_char (iter);
if (wc == '\r' || wc == PARAGRAPH_SEPARATOR)
return TRUE;
else if (wc == '\n')
{
/* need to determine if a \r precedes the \n, in which case
* we aren't the end of the line
*/
GtkTextIter tmp = *iter;
if (!gtk_text_iter_prev_char (&tmp))
return FALSE;
return gtk_text_iter_get_char (&tmp) != '\r';
}
else
return FALSE;
}
/**

View File

@ -32,6 +32,8 @@ static void gtk_vpaned_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_vpaned_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static gint gtk_vpaned_expose (GtkWidget *widget,
GdkEventExpose *expose);
static void gtk_vpaned_xor_line (GtkPaned *paned);
static gboolean gtk_vpaned_button_press (GtkWidget *widget,
GdkEventButton *event);
@ -40,6 +42,8 @@ static gboolean gtk_vpaned_button_release (GtkWidget *widget,
static gboolean gtk_vpaned_motion (GtkWidget *widget,
GdkEventMotion *event);
static gpointer parent_class;
GtkType
gtk_vpaned_get_type (void)
{
@ -70,10 +74,13 @@ gtk_vpaned_class_init (GtkVPanedClass *class)
{
GtkWidgetClass *widget_class;
parent_class = gtk_type_class (GTK_TYPE_PANED);
widget_class = (GtkWidgetClass *) class;
widget_class->size_request = gtk_vpaned_size_request;
widget_class->size_allocate = gtk_vpaned_size_allocate;
widget_class->expose_event = gtk_vpaned_expose;
widget_class->button_press_event = gtk_vpaned_button_press;
widget_class->button_release_event = gtk_vpaned_button_release;
widget_class->motion_notify_event = gtk_vpaned_motion;
@ -221,6 +228,50 @@ gtk_vpaned_size_allocate (GtkWidget *widget,
}
}
static gint
gtk_vpaned_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkPaned *paned;
guint16 border_width;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_PANED (widget), FALSE);
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
{
paned = GTK_PANED (widget);
border_width = GTK_CONTAINER (paned)->border_width;
if (event->window == widget->window)
{
gdk_window_clear_area (widget->window,
event->area.x, event->area.y,
event->area.width,
event->area.height);
/* Chain up to draw children */
GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
}
else if (event->window == paned->handle)
{
gtk_paint_handle (widget->style,
paned->handle,
GTK_STATE_NORMAL,
GTK_SHADOW_NONE,
&event->area,
widget,
"paned",
0, 0, -1, -1,
GTK_ORIENTATION_HORIZONTAL);
}
}
return FALSE;
}
static void
gtk_vpaned_xor_line (GtkPaned *paned)
{