2002-11-05 22:58:28 +00:00
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
/* GdkPixbuf library - Progressive loader object
1999-10-26 03:42:14 +00:00
*
* Copyright ( C ) 1999 The Free Software Foundation
*
* Authors : Mark Crichton < crichton @ gimp . org >
* Miguel de Icaza < miguel @ gnu . org >
* Federico Mena - Quintero < federico @ gimp . org >
* Jonathan Blandford < jrb @ redhat . com >
*
* This library is free software ; you can redistribute it and / or
2000-07-26 11:33:08 +00:00
* modify it under the terms of the GNU Lesser General Public
1999-10-26 03:42:14 +00:00
* License as published by the Free Software Foundation ; either
* version 2 of the License , or ( at your option ) any later version .
*
* This library is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
2000-07-26 11:33:08 +00:00
* Lesser General Public License for more details .
1999-10-26 03:42:14 +00:00
*
2000-07-26 11:33:08 +00:00
* You should have received a copy of the GNU Lesser General Public
1999-10-26 03:42:14 +00:00
* License along with this library ; if not , write to the
* Free Software Foundation , Inc . , 59 Temple Place - Suite 330 ,
* Boston , MA 02111 - 1307 , USA .
*/
2000-07-14 20:25:22 +00:00
# include <string.h>
2000-04-11 07:03:25 +00:00
# include "gdk-pixbuf-private.h"
2002-10-03 22:39:51 +00:00
# include "gdk-pixbuf-animation.h"
1999-11-23 20:03:14 +00:00
# include "gdk-pixbuf-io.h"
2002-10-03 22:39:51 +00:00
# include "gdk-pixbuf-loader.h"
Add built marshaller files to support GdkPixbufLoader signals
2001-01-22 Havoc Pennington <hp@redhat.com>
* Makefile.am: Add built marshaller files to support
GdkPixbufLoader signals
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
module location, rather than acting as a fallback, because we are
using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.
* gdk-pixbuf.h: include gdk-pixbuf-loader.h
* gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
from gtk, and add error to close(), because stop_load may do
parsing of the image.
* pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file
* io-*.c: make individual operations static, and add fill_vtable
functions which are exported. Fix the collection of type warnings
that surfaced, including a number of functions that didn't
properly take a GError and some that weren't
const-correct. Involved adding error handling for a few loaders.
* gdk-pixbuf-io.h: Add error reporting to stop_load function
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
a function that fills in the GdkPixbufModule vtable, instead of
looking up all the image functions individually; this means we
can get type safety within modules for the loader functions.
Also it means you don't have to keep the statically compiled and
GModule versions in sync.
* test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()
* make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()
* gdk-pixbuf.h: nuke gdk_pixbuf_init()
* gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
() here
* gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
g_type_init() here
2001-01-22 Havoc Pennington <hp@redhat.com>
* demos/testanimation.c: fix to reflect gdk-pixbuf changes
* demos/testpixbuf.c: fix to reflect gdk-pixbuf changes
* gtk/gdk-pixbuf-loader.c, gtk/gdk-pixbuf-loader.h:
Remove, move back to gdk-pixbuf
* gtk/gtktextiter.c, gtk/gtktextiter.h: add sentence equivalents
to all the word functions
* gtk/gtktextview.c (gtk_text_view_start_cursor_blink): return
before doing anything on NULL layout or if we don't have the focus
* gtk/testtext.c (fill_example_buffer): "justification"
* gtk/gtktexttag.h, gtk/gtktexttag.c: change the tag attribute
to be called "justification" not "justify"
* demos/gtk-demo/textview.c (create_tags): "justification"
* gtk/gtktextlayout.c (set_para_values): Handle char-wise wrapping
2001-01-22 23:09:48 +00:00
# include "gdk-pixbuf-marshal.h"
1999-10-26 03:42:14 +00:00
1999-10-26 23:19:49 +00:00
enum {
2002-11-05 22:58:28 +00:00
SIZE_PREPARED ,
AREA_PREPARED ,
AREA_UPDATED ,
CLOSED ,
LAST_SIGNAL
1999-10-26 23:19:49 +00:00
} ;
1999-10-26 03:42:14 +00:00
static void gdk_pixbuf_loader_class_init ( GdkPixbufLoaderClass * klass ) ;
static void gdk_pixbuf_loader_init ( GdkPixbufLoader * loader ) ;
2000-06-21 20:47:22 +00:00
static void gdk_pixbuf_loader_finalize ( GObject * loader ) ;
1999-10-26 03:42:14 +00:00
2000-06-24 22:32:05 +00:00
static gpointer parent_class = NULL ;
static guint pixbuf_loader_signals [ LAST_SIGNAL ] = { 0 } ;
1999-10-27 17:31:07 +00:00
1999-10-26 23:19:49 +00:00
1999-10-26 03:42:14 +00:00
/* Internal data */
1999-11-02 16:10:25 +00:00
# define LOADER_HEADER_SIZE 128
2000-06-24 22:32:05 +00:00
typedef struct
{
2002-11-05 22:58:28 +00:00
GdkPixbufAnimation * animation ;
gboolean closed ;
guchar header_buf [ LOADER_HEADER_SIZE ] ;
gint header_buf_offset ;
GdkPixbufModule * image_module ;
gpointer context ;
gint width ;
gint height ;
gboolean size_fixed ;
gboolean needs_scale ;
1999-10-27 17:31:07 +00:00
} GdkPixbufLoaderPrivate ;
1999-10-26 23:19:49 +00:00
1999-10-27 17:31:07 +00:00
/**
* gdk_pixbuf_loader_get_type :
2000-01-07 18:29:13 +00:00
* @ void :
*
2002-04-03 18:17:14 +00:00
* Registers the # GdkPixbufLoader class if necessary , and returns the type ID
1999-10-27 17:31:07 +00:00
* associated to it .
2000-01-07 18:29:13 +00:00
*
1999-11-04 21:52:08 +00:00
* Return value : The type ID of the # GdkPixbufLoader class .
1999-10-27 17:31:07 +00:00
* */
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
GType
1999-10-26 03:42:14 +00:00
gdk_pixbuf_loader_get_type ( void )
{
2002-11-05 22:58:28 +00:00
static GType loader_type = 0 ;
if ( ! loader_type )
{
static const GTypeInfo loader_info = {
sizeof ( GdkPixbufLoaderClass ) ,
( GBaseInitFunc ) NULL ,
( GBaseFinalizeFunc ) NULL ,
( GClassInitFunc ) gdk_pixbuf_loader_class_init ,
NULL , /* class_finalize */
NULL , /* class_data */
sizeof ( GdkPixbufLoader ) ,
0 , /* n_preallocs */
( GInstanceInitFunc ) gdk_pixbuf_loader_init
} ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
loader_type = g_type_register_static ( G_TYPE_OBJECT ,
" GdkPixbufLoader " ,
& loader_info ,
0 ) ;
}
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
return loader_type ;
1999-10-26 03:42:14 +00:00
}
static void
1999-10-27 17:31:07 +00:00
gdk_pixbuf_loader_class_init ( GdkPixbufLoaderClass * class )
1999-10-26 03:42:14 +00:00
{
2002-11-05 22:58:28 +00:00
GObjectClass * object_class ;
object_class = ( GObjectClass * ) class ;
parent_class = g_type_class_peek_parent ( class ) ;
object_class - > finalize = gdk_pixbuf_loader_finalize ;
pixbuf_loader_signals [ SIZE_PREPARED ] =
g_signal_new ( " size_prepared " ,
G_TYPE_FROM_CLASS ( object_class ) ,
G_SIGNAL_RUN_LAST ,
G_STRUCT_OFFSET ( GdkPixbufLoaderClass , size_prepared ) ,
NULL , NULL ,
gdk_pixbuf_marshal_VOID__INT_INT ,
G_TYPE_NONE , 2 ,
G_TYPE_INT ,
G_TYPE_INT ) ;
pixbuf_loader_signals [ AREA_PREPARED ] =
g_signal_new ( " area_prepared " ,
G_TYPE_FROM_CLASS ( object_class ) ,
G_SIGNAL_RUN_LAST ,
G_STRUCT_OFFSET ( GdkPixbufLoaderClass , area_prepared ) ,
NULL , NULL ,
gdk_pixbuf_marshal_VOID__VOID ,
G_TYPE_NONE , 0 ) ;
pixbuf_loader_signals [ AREA_UPDATED ] =
g_signal_new ( " area_updated " ,
G_TYPE_FROM_CLASS ( object_class ) ,
G_SIGNAL_RUN_LAST ,
G_STRUCT_OFFSET ( GdkPixbufLoaderClass , area_updated ) ,
NULL , NULL ,
gdk_pixbuf_marshal_VOID__INT_INT_INT_INT ,
G_TYPE_NONE , 4 ,
G_TYPE_INT ,
G_TYPE_INT ,
G_TYPE_INT ,
G_TYPE_INT ) ;
pixbuf_loader_signals [ CLOSED ] =
g_signal_new ( " closed " ,
G_TYPE_FROM_CLASS ( object_class ) ,
G_SIGNAL_RUN_LAST ,
G_STRUCT_OFFSET ( GdkPixbufLoaderClass , closed ) ,
NULL , NULL ,
gdk_pixbuf_marshal_VOID__VOID ,
G_TYPE_NONE , 0 ) ;
1999-10-26 03:42:14 +00:00
}
static void
gdk_pixbuf_loader_init ( GdkPixbufLoader * loader )
{
2002-11-05 22:58:28 +00:00
GdkPixbufLoaderPrivate * priv ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
priv = g_new0 ( GdkPixbufLoaderPrivate , 1 ) ;
loader - > priv = priv ;
1999-10-26 03:42:14 +00:00
}
static void
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
gdk_pixbuf_loader_finalize ( GObject * object )
1999-10-26 03:42:14 +00:00
{
2002-11-05 22:58:28 +00:00
GdkPixbufLoader * loader ;
GdkPixbufLoaderPrivate * priv = NULL ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
loader = GDK_PIXBUF_LOADER ( object ) ;
priv = loader - > priv ;
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
2002-11-05 22:58:28 +00:00
if ( ! priv - > closed )
g_warning ( " GdkPixbufLoader finalized without calling gdk_pixbuf_loader_close() - this is not allowed. You must explicitly end the data stream to the loader before dropping the last reference. " ) ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
if ( priv - > animation )
g_object_unref ( priv - > animation ) ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
g_free ( priv ) ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
G_OBJECT_CLASS ( parent_class ) - > finalize ( object ) ;
1999-10-26 03:42:14 +00:00
}
2002-07-06 23:10:46 +00:00
/**
* gdk_pixbuf_loader_set_size :
* @ loader : A pixbuf loader .
* @ width : The desired width of the image being loaded .
* @ height : The desired height of the image being loaded .
*
* Causes the image to be scaled while it is loaded . The desired
* image size can be determined relative to the original size of
* the image by calling gdk_pixbuf_loader_set_size ( ) from a
* signal handler for the : : size_prepared signal .
*
* Attempts to set the desired image size are ignored after the
* emission of the : : size_prepared signal .
2002-11-28 00:33:17 +00:00
*
* Since : 2.2
2002-07-06 23:10:46 +00:00
*/
void
gdk_pixbuf_loader_set_size ( GdkPixbufLoader * loader ,
gint width ,
gint height )
{
2002-11-05 22:58:28 +00:00
GdkPixbufLoaderPrivate * priv = GDK_PIXBUF_LOADER ( loader ) - > priv ;
g_return_if_fail ( width > 0 & & height > 0 ) ;
if ( ! priv - > size_fixed )
{
priv - > width = width ;
priv - > height = height ;
}
2002-07-06 23:10:46 +00:00
}
static void
gdk_pixbuf_loader_size_func ( gint * width , gint * height , gpointer loader )
{
2002-11-05 22:58:28 +00:00
GdkPixbufLoaderPrivate * priv = GDK_PIXBUF_LOADER ( loader ) - > priv ;
2002-07-06 23:10:46 +00:00
2002-11-05 22:58:28 +00:00
/* allow calling gdk_pixbuf_loader_set_size() before the signal */
if ( priv - > width = = 0 & & priv - > height = = 0 )
{
priv - > width = * width ;
priv - > height = * height ;
}
2002-07-06 23:10:46 +00:00
2002-11-05 22:58:28 +00:00
g_signal_emit ( loader , pixbuf_loader_signals [ SIZE_PREPARED ] , 0 , * width , * height ) ;
priv - > size_fixed = TRUE ;
2002-07-06 23:10:46 +00:00
2002-11-05 22:58:28 +00:00
* width = priv - > width ;
* height = priv - > height ;
2002-07-06 23:10:46 +00:00
}
1999-10-26 23:19:49 +00:00
static void
2001-05-07 15:58:47 +00:00
gdk_pixbuf_loader_prepare ( GdkPixbuf * pixbuf ,
GdkPixbufAnimation * anim ,
gpointer loader )
1999-10-26 23:19:49 +00:00
{
2002-11-05 22:58:28 +00:00
GdkPixbufLoaderPrivate * priv = GDK_PIXBUF_LOADER ( loader ) - > priv ;
g_return_if_fail ( pixbuf ! = NULL ) ;
if ( ! priv - > size_fixed )
{
/* Defend against lazy loaders which don't call size_func */
gint width = gdk_pixbuf_get_width ( pixbuf ) ;
gint height = gdk_pixbuf_get_height ( pixbuf ) ;
gdk_pixbuf_loader_size_func ( & width , & height , loader ) ;
}
priv - > needs_scale = FALSE ;
if ( priv - > width > 0 & & priv - > height > 0 & &
( priv - > width ! = gdk_pixbuf_get_width ( pixbuf ) | |
priv - > height ! = gdk_pixbuf_get_height ( pixbuf ) ) )
priv - > needs_scale = TRUE ;
if ( anim )
g_object_ref ( anim ) ;
else
anim = gdk_pixbuf_non_anim_new ( pixbuf ) ;
priv - > animation = anim ;
if ( ! priv - > needs_scale )
g_signal_emit ( loader , pixbuf_loader_signals [ AREA_PREPARED ] , 0 ) ;
1999-10-26 23:19:49 +00:00
}
1999-11-04 18:18:07 +00:00
static void
2000-06-24 22:32:05 +00:00
gdk_pixbuf_loader_update ( GdkPixbuf * pixbuf ,
2001-05-07 15:58:47 +00:00
gint x ,
gint y ,
gint width ,
gint height ,
2000-06-24 22:32:05 +00:00
gpointer loader )
1999-11-04 18:18:07 +00:00
{
2002-11-05 22:58:28 +00:00
GdkPixbufLoaderPrivate * priv = GDK_PIXBUF_LOADER ( loader ) - > priv ;
if ( ! priv - > needs_scale )
g_signal_emit ( loader ,
pixbuf_loader_signals [ AREA_UPDATED ] ,
0 ,
x , y ,
/* sanity check in here. Defend against an errant loader */
MIN ( width , gdk_pixbuf_animation_get_width ( priv - > animation ) ) ,
MIN ( height , gdk_pixbuf_animation_get_height ( priv - > animation ) ) ) ;
2000-01-07 18:29:13 +00:00
}
2000-06-24 22:32:05 +00:00
static gint
2000-10-18 18:42:54 +00:00
gdk_pixbuf_loader_load_module ( GdkPixbufLoader * loader ,
const char * image_type ,
GError * * error )
1999-11-02 16:10:25 +00:00
{
2002-11-05 22:58:28 +00:00
GdkPixbufLoaderPrivate * priv = loader - > priv ;
if ( image_type )
{
priv - > image_module = _gdk_pixbuf_get_named_module ( image_type ,
error ) ;
}
else
{
priv - > image_module = _gdk_pixbuf_get_module ( priv - > header_buf ,
priv - > header_buf_offset ,
NULL ,
error ) ;
}
if ( priv - > image_module = = NULL )
return 0 ;
if ( priv - > image_module - > module = = NULL )
if ( ! _gdk_pixbuf_load_module ( priv - > image_module , error ) )
return 0 ;
if ( priv - > image_module - > module = = NULL )
return 0 ;
if ( ( priv - > image_module - > begin_load = = NULL ) | |
( priv - > image_module - > stop_load = = NULL ) | |
( priv - > image_module - > load_increment = = NULL ) )
{
g_set_error ( error ,
GDK_PIXBUF_ERROR ,
GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION ,
_ ( " Incremental loading of image type '%s' is not supported " ) ,
priv - > image_module - > module_name ) ;
return 0 ;
}
priv - > context = priv - > image_module - > begin_load ( gdk_pixbuf_loader_size_func ,
gdk_pixbuf_loader_prepare ,
gdk_pixbuf_loader_update ,
loader ,
error ) ;
if ( priv - > context = = NULL )
{
/* Defense against broken loaders; DO NOT take this as a GError
* example
*/
if ( error & & * error = = NULL )
{
g_warning ( " Bug! loader '%s' didn't set an error on failure " ,
priv - > image_module - > module_name ) ;
g_set_error ( error ,
GDK_PIXBUF_ERROR ,
GDK_PIXBUF_ERROR_FAILED ,
_ ( " Internal error: Image loader module '%s' "
" failed to begin loading an image, but didn't "
" give a reason for the failure " ) ,
priv - > image_module - > module_name ) ;
}
2000-10-18 18:42:54 +00:00
2002-11-05 22:58:28 +00:00
return 0 ;
}
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
if ( priv - > header_buf_offset
& & priv - > image_module - > load_increment ( priv - > context , priv - > header_buf , priv - > header_buf_offset , error ) )
return priv - > header_buf_offset ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
return 0 ;
1999-11-02 16:10:25 +00:00
}
static int
2000-06-24 22:32:05 +00:00
gdk_pixbuf_loader_eat_header_write ( GdkPixbufLoader * loader ,
const guchar * buf ,
2000-10-18 18:42:54 +00:00
gsize count ,
GError * * error )
1999-11-02 16:10:25 +00:00
{
2002-11-05 22:58:28 +00:00
gint n_bytes ;
GdkPixbufLoaderPrivate * priv = loader - > priv ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
n_bytes = MIN ( LOADER_HEADER_SIZE - priv - > header_buf_offset , count ) ;
memcpy ( priv - > header_buf + priv - > header_buf_offset , buf , n_bytes ) ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
priv - > header_buf_offset + = n_bytes ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
if ( priv - > header_buf_offset > = LOADER_HEADER_SIZE )
{
if ( gdk_pixbuf_loader_load_module ( loader , NULL , error ) = = 0 )
return 0 ;
}
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
return n_bytes ;
1999-11-02 16:10:25 +00:00
}
1999-10-26 03:42:14 +00:00
/**
* gdk_pixbuf_loader_write :
1999-10-27 17:31:07 +00:00
* @ loader : A pixbuf loader .
1999-11-10 22:48:46 +00:00
* @ buf : Pointer to image data .
* @ count : Length of the @ buf buffer in bytes .
2000-10-18 18:42:54 +00:00
* @ error : return location for errors
1999-10-26 20:43:39 +00:00
*
2000-10-18 18:42:54 +00:00
* This will cause a pixbuf loader to parse the next @ count bytes of
2001-12-12 22:11:37 +00:00
* an image . It will return % TRUE if the data was loaded successfully ,
* and % FALSE if an error occurred . In the latter case , the loader
* will be closed , and will not accept further writes . If % FALSE is
2000-10-18 18:42:54 +00:00
* returned , @ error will be set to an error from the # GDK_PIXBUF_ERROR
Add built marshaller files to support GdkPixbufLoader signals
2001-01-22 Havoc Pennington <hp@redhat.com>
* Makefile.am: Add built marshaller files to support
GdkPixbufLoader signals
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
module location, rather than acting as a fallback, because we are
using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.
* gdk-pixbuf.h: include gdk-pixbuf-loader.h
* gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
from gtk, and add error to close(), because stop_load may do
parsing of the image.
* pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file
* io-*.c: make individual operations static, and add fill_vtable
functions which are exported. Fix the collection of type warnings
that surfaced, including a number of functions that didn't
properly take a GError and some that weren't
const-correct. Involved adding error handling for a few loaders.
* gdk-pixbuf-io.h: Add error reporting to stop_load function
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
a function that fills in the GdkPixbufModule vtable, instead of
looking up all the image functions individually; this means we
can get type safety within modules for the loader functions.
Also it means you don't have to keep the statically compiled and
GModule versions in sync.
* test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()
* make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()
* gdk-pixbuf.h: nuke gdk_pixbuf_init()
* gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
() here
* gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
g_type_init() here
2001-01-22 Havoc Pennington <hp@redhat.com>
* demos/testanimation.c: fix to reflect gdk-pixbuf changes
* demos/testpixbuf.c: fix to reflect gdk-pixbuf changes
* gtk/gdk-pixbuf-loader.c, gtk/gdk-pixbuf-loader.h:
Remove, move back to gdk-pixbuf
* gtk/gtktextiter.c, gtk/gtktextiter.h: add sentence equivalents
to all the word functions
* gtk/gtktextview.c (gtk_text_view_start_cursor_blink): return
before doing anything on NULL layout or if we don't have the focus
* gtk/testtext.c (fill_example_buffer): "justification"
* gtk/gtktexttag.h, gtk/gtktexttag.c: change the tag attribute
to be called "justification" not "justify"
* demos/gtk-demo/textview.c (create_tags): "justification"
* gtk/gtktextlayout.c (set_para_values): Handle char-wise wrapping
2001-01-22 23:09:48 +00:00
* or # G_FILE_ERROR domains .
1999-10-26 20:43:39 +00:00
*
2001-12-12 22:11:37 +00:00
* Return value : % TRUE if the write was successful , or % FALSE if the loader
1999-11-10 22:48:46 +00:00
* cannot parse the buffer .
1999-10-26 03:42:14 +00:00
* */
gboolean
2000-06-24 22:32:05 +00:00
gdk_pixbuf_loader_write ( GdkPixbufLoader * loader ,
const guchar * buf ,
2000-10-18 18:42:54 +00:00
gsize count ,
GError * * error )
1999-10-26 03:42:14 +00:00
{
2002-11-05 22:58:28 +00:00
GdkPixbufLoaderPrivate * priv ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
g_return_val_if_fail ( loader ! = NULL , FALSE ) ;
g_return_val_if_fail ( GDK_IS_PIXBUF_LOADER ( loader ) , FALSE ) ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
g_return_val_if_fail ( buf ! = NULL , FALSE ) ;
g_return_val_if_fail ( count > = 0 , FALSE ) ;
2003-04-24 18:51:07 +00:00
g_return_val_if_fail ( error = = NULL | | * error = = NULL , FALSE ) ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
priv = loader - > priv ;
2001-06-01 23:05:46 +00:00
2002-11-05 22:58:28 +00:00
/* we expect it's not to be closed */
g_return_val_if_fail ( priv - > closed = = FALSE , FALSE ) ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
if ( priv - > image_module = = NULL )
{
gint eaten ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
eaten = gdk_pixbuf_loader_eat_header_write ( loader , buf , count , error ) ;
if ( eaten < = 0 )
return FALSE ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
count - = eaten ;
buf + = eaten ;
}
if ( count > 0 & & priv - > image_module - > load_increment )
{
gboolean retval ;
retval = priv - > image_module - > load_increment ( priv - > context , buf , count ,
error ) ;
if ( ! retval & & error & & * error = = NULL )
{
/* Fix up busted image loader */
g_warning ( " Bug! loader '%s' didn't set an error on failure " ,
priv - > image_module - > module_name ) ;
g_set_error ( error ,
GDK_PIXBUF_ERROR ,
GDK_PIXBUF_ERROR_FAILED ,
_ ( " Internal error: Image loader module '%s' "
" failed to begin loading an image, but didn't "
" give a reason for the failure " ) ,
priv - > image_module - > module_name ) ;
}
return retval ;
}
2000-10-18 18:42:54 +00:00
2002-11-05 22:58:28 +00:00
return TRUE ;
1999-10-26 03:42:14 +00:00
}
2000-07-28 00:09:36 +00:00
/**
* gdk_pixbuf_loader_new :
*
* Creates a new pixbuf loader object .
*
* Return value : A newly - created pixbuf loader .
* */
GdkPixbufLoader *
gdk_pixbuf_loader_new ( void )
{
2002-11-05 22:58:28 +00:00
return g_object_new ( GDK_TYPE_PIXBUF_LOADER , NULL ) ;
2000-07-28 00:09:36 +00:00
}
/**
* gdk_pixbuf_loader_new_with_type :
2001-02-18 04:08:30 +00:00
* @ image_type : name of the image format to be loaded with the image
* @ error : return location for an allocated # GError , or % NULL to ignore errors
2000-07-28 00:09:36 +00:00
*
2001-02-18 04:08:30 +00:00
* Creates a new pixbuf loader object that always attempts to parse
* image data as if it were an image of type @ image_type , instead of
* identifying the type automatically . Useful if you want an error if
* the image isn ' t the expected type , for loading image formats
* that can ' t be reliably identified by looking at the data , or if
* the user manually forces a specific type .
2000-07-28 00:09:36 +00:00
*
* Return value : A newly - created pixbuf loader .
* */
GdkPixbufLoader *
2000-10-18 18:42:54 +00:00
gdk_pixbuf_loader_new_with_type ( const char * image_type ,
GError * * error )
2000-07-28 00:09:36 +00:00
{
2002-11-05 22:58:28 +00:00
GdkPixbufLoader * retval ;
GError * tmp ;
2003-04-24 18:51:07 +00:00
g_return_val_if_fail ( error = = NULL | | * error = = NULL , NULL ) ;
2000-10-18 18:42:54 +00:00
2002-11-05 22:58:28 +00:00
retval = g_object_new ( GDK_TYPE_PIXBUF_LOADER , NULL ) ;
2000-07-28 00:09:36 +00:00
2002-11-05 22:58:28 +00:00
tmp = NULL ;
2003-04-24 18:51:07 +00:00
gdk_pixbuf_loader_load_module ( retval , image_type , & tmp ) ;
2002-11-05 22:58:28 +00:00
if ( tmp ! = NULL )
{
g_propagate_error ( error , tmp ) ;
g_object_unref ( retval ) ;
return NULL ;
}
2000-07-28 00:09:36 +00:00
2002-11-05 22:58:28 +00:00
return retval ;
2000-07-28 00:09:36 +00:00
}
2003-06-22 19:08:12 +00:00
/**
* gdk_pixbuf_loader_new_with_mime_type :
* @ mime_type : the mime type to be loaded
* @ error : return location for an allocated # GError , or % NULL to ignore errors
*
* Creates a new pixbuf loader object that always attempts to parse
* image data as if it were an image of mime type @ mime_type , instead of
* identifying the type automatically . Useful if you want an error if
* the image isn ' t the expected mime type , for loading image formats
* that can ' t be reliably identified by looking at the data , or if
* the user manually forces a specific mime type .
*
* Return value : A newly - created pixbuf loader .
* Since : 2.4
* */
GdkPixbufLoader *
gdk_pixbuf_loader_new_with_mime_type ( const char * mime_type ,
GError * * error )
{
const char * image_type = NULL ;
char * * mimes ;
GdkPixbufLoader * retval ;
GError * tmp ;
GSList * formats ;
GdkPixbufFormat * info ;
int i , j , length ;
formats = gdk_pixbuf_get_formats ( ) ;
length = g_slist_length ( formats ) ;
for ( i = 0 ; i < length & & image_type = = NULL ; i + + ) {
info = ( GdkPixbufFormat * ) g_slist_nth_data ( formats , i ) ;
mimes = info - > mime_types ;
for ( j = 0 ; mimes [ j ] ! = NULL ; j + + )
if ( g_ascii_strcasecmp ( mimes [ i ] , mime_type ) ) {
image_type = info - > name ;
break ;
}
}
g_slist_free ( formats ) ;
retval = g_object_new ( GDK_TYPE_PIXBUF_LOADER , NULL ) ;
tmp = NULL ;
gdk_pixbuf_loader_load_module ( retval , image_type , & tmp ) ;
if ( tmp ! = NULL )
{
g_propagate_error ( error , tmp ) ;
g_object_unref ( retval ) ;
return NULL ;
}
return retval ;
}
1999-10-26 03:42:14 +00:00
/**
* gdk_pixbuf_loader_get_pixbuf :
1999-10-27 17:31:07 +00:00
* @ loader : A pixbuf loader .
1999-10-26 20:43:39 +00:00
*
2001-12-12 22:11:37 +00:00
* Queries the # GdkPixbuf that a pixbuf loader is currently creating .
2001-11-03 18:49:43 +00:00
* In general it only makes sense to call this function after the
2000-10-09 17:22:20 +00:00
* " area_prepared " signal has been emitted by the loader ; this means
* that enough data has been read to know the size of the image that
* will be allocated . If the loader has not received enough data via
2001-05-07 15:58:47 +00:00
* gdk_pixbuf_loader_write ( ) , then this function returns % NULL . The
2000-10-09 17:22:20 +00:00
* returned pixbuf will be the same in all future calls to the loader ,
2001-11-03 18:49:43 +00:00
* so simply calling g_object_ref ( ) should be sufficient to continue
2000-10-09 17:22:20 +00:00
* using it . Additionally , if the loader is an animation , it will
2001-05-07 15:58:47 +00:00
* return the " static image " of the animation
* ( see gdk_pixbuf_animation_get_static_image ( ) ) .
2000-10-09 17:22:20 +00:00
*
2001-05-07 15:58:47 +00:00
* Return value : The # GdkPixbuf that the loader is creating , or % NULL if not
1999-11-10 22:48:46 +00:00
* enough data has been read to determine how to create the image buffer .
1999-10-26 03:42:14 +00:00
* */
GdkPixbuf *
gdk_pixbuf_loader_get_pixbuf ( GdkPixbufLoader * loader )
{
2002-11-05 22:58:28 +00:00
GdkPixbufLoaderPrivate * priv ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
g_return_val_if_fail ( loader ! = NULL , NULL ) ;
g_return_val_if_fail ( GDK_IS_PIXBUF_LOADER ( loader ) , NULL ) ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
priv = loader - > priv ;
2000-10-09 17:22:20 +00:00
2002-11-05 22:58:28 +00:00
if ( priv - > animation )
return gdk_pixbuf_animation_get_static_image ( priv - > animation ) ;
else
return NULL ;
1999-10-26 03:42:14 +00:00
}
1999-12-17 21:42:47 +00:00
/**
* gdk_pixbuf_loader_get_animation :
* @ loader : A pixbuf loader
2000-01-07 18:29:13 +00:00
*
2001-12-12 22:11:37 +00:00
* Queries the # GdkPixbufAnimation that a pixbuf loader is currently creating .
More precise documentation about underscores and mnemonics. (#66380)
* gtk/gtklabel.c (gtk_label_new_with_mnemonic),
gtk/gtkbutton.c (gtk_button_new_with_mnemonic): More precise
documentation about underscores and mnemonics. (#66380)
* gtk/gtktextiter.c (gtk_text_iter_backward_word_starts): Fix
cyclic reference in docs.
* gtk/gtklabel.c (gtk_label_set_justify): Correct documentation
of default value. (#65402)
* gtk/gtkmain.c (gtk_set_locale, gtk_disable_set_locale):
Markup fixes.
* gdk-pixbuf-io.c, gdk-pixbuf-animation.c, gdk-pixbuf-data.c,
gdk-pixbuf-loader.c, gdk-pixbuf-scale.c, gdk-pixbuf-util.c,
gdk-pixdata.c: Markup fixes.
* gtk/text_widget.sgml: More precise wording. (#63388)
* gtk/tmpl/gtksignal.sgml (GTK_SIGNAL_OFFSET): Add docs.
* gtk/resources.sgml: Fix markup of mail URLs.
* gtk/tmpl/gtkpaned.sgml, gtk/tmpl/gtkobject.sgml: Markup fixes.
* gtk/tmpl/gtktoolbar.sgml (gtk_toolbar_{prepend,append}_element):
Expand documentation. (#60471)
* gtk/tmpl/gtkmain.sgml: Remove misleading information about
gtk_set_locale(). (#65758)
2001-12-20 23:09:29 +00:00
* In general it only makes sense to call this function after the " area_prepared "
2001-05-07 15:58:47 +00:00
* signal has been emitted by the loader . If the loader doesn ' t have enough
2001-12-12 22:11:37 +00:00
* bytes yet ( hasn ' t emitted the " area_prepared " signal ) this function will
* return % NULL .
2000-01-07 18:29:13 +00:00
*
2001-12-12 22:11:37 +00:00
* Return value : The # GdkPixbufAnimation that the loader is loading , or % NULL if
1999-12-17 21:42:47 +00:00
not enough data has been read to determine the information .
2000-06-24 22:32:05 +00:00
* */
1999-12-17 21:42:47 +00:00
GdkPixbufAnimation *
gdk_pixbuf_loader_get_animation ( GdkPixbufLoader * loader )
{
2002-11-05 22:58:28 +00:00
GdkPixbufLoaderPrivate * priv ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
g_return_val_if_fail ( loader ! = NULL , NULL ) ;
g_return_val_if_fail ( GDK_IS_PIXBUF_LOADER ( loader ) , NULL ) ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
priv = loader - > priv ;
2000-06-24 22:32:05 +00:00
2002-11-05 22:58:28 +00:00
return priv - > animation ;
1999-12-17 21:42:47 +00:00
}
1999-10-26 03:42:14 +00:00
/**
* gdk_pixbuf_loader_close :
1999-10-27 17:31:07 +00:00
* @ loader : A pixbuf loader .
Add built marshaller files to support GdkPixbufLoader signals
2001-01-22 Havoc Pennington <hp@redhat.com>
* Makefile.am: Add built marshaller files to support
GdkPixbufLoader signals
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
module location, rather than acting as a fallback, because we are
using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.
* gdk-pixbuf.h: include gdk-pixbuf-loader.h
* gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
from gtk, and add error to close(), because stop_load may do
parsing of the image.
* pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file
* io-*.c: make individual operations static, and add fill_vtable
functions which are exported. Fix the collection of type warnings
that surfaced, including a number of functions that didn't
properly take a GError and some that weren't
const-correct. Involved adding error handling for a few loaders.
* gdk-pixbuf-io.h: Add error reporting to stop_load function
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
a function that fills in the GdkPixbufModule vtable, instead of
looking up all the image functions individually; this means we
can get type safety within modules for the loader functions.
Also it means you don't have to keep the statically compiled and
GModule versions in sync.
* test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()
* make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()
* gdk-pixbuf.h: nuke gdk_pixbuf_init()
* gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
() here
* gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
g_type_init() here
2001-01-22 Havoc Pennington <hp@redhat.com>
* demos/testanimation.c: fix to reflect gdk-pixbuf changes
* demos/testpixbuf.c: fix to reflect gdk-pixbuf changes
* gtk/gdk-pixbuf-loader.c, gtk/gdk-pixbuf-loader.h:
Remove, move back to gdk-pixbuf
* gtk/gtktextiter.c, gtk/gtktextiter.h: add sentence equivalents
to all the word functions
* gtk/gtktextview.c (gtk_text_view_start_cursor_blink): return
before doing anything on NULL layout or if we don't have the focus
* gtk/testtext.c (fill_example_buffer): "justification"
* gtk/gtktexttag.h, gtk/gtktexttag.c: change the tag attribute
to be called "justification" not "justify"
* demos/gtk-demo/textview.c (create_tags): "justification"
* gtk/gtktextlayout.c (set_para_values): Handle char-wise wrapping
2001-01-22 23:09:48 +00:00
* @ error : return location for a # GError , or % NULL to ignore errors
*
* Informs a pixbuf loader that no further writes with
* gdk_pixbuf_loader_write ( ) will occur , so that it can free its
* internal loading structures . Also , tries to parse any data that
* hasn ' t yet been parsed ; if the remaining data is partial or
2001-12-12 22:11:37 +00:00
* corrupt , an error will be returned . If % FALSE is returned , @ error
Add built marshaller files to support GdkPixbufLoader signals
2001-01-22 Havoc Pennington <hp@redhat.com>
* Makefile.am: Add built marshaller files to support
GdkPixbufLoader signals
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
module location, rather than acting as a fallback, because we are
using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.
* gdk-pixbuf.h: include gdk-pixbuf-loader.h
* gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
from gtk, and add error to close(), because stop_load may do
parsing of the image.
* pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file
* io-*.c: make individual operations static, and add fill_vtable
functions which are exported. Fix the collection of type warnings
that surfaced, including a number of functions that didn't
properly take a GError and some that weren't
const-correct. Involved adding error handling for a few loaders.
* gdk-pixbuf-io.h: Add error reporting to stop_load function
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
a function that fills in the GdkPixbufModule vtable, instead of
looking up all the image functions individually; this means we
can get type safety within modules for the loader functions.
Also it means you don't have to keep the statically compiled and
GModule versions in sync.
* test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()
* make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()
* gdk-pixbuf.h: nuke gdk_pixbuf_init()
* gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
() here
* gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
g_type_init() here
2001-01-22 Havoc Pennington <hp@redhat.com>
* demos/testanimation.c: fix to reflect gdk-pixbuf changes
* demos/testpixbuf.c: fix to reflect gdk-pixbuf changes
* gtk/gdk-pixbuf-loader.c, gtk/gdk-pixbuf-loader.h:
Remove, move back to gdk-pixbuf
* gtk/gtktextiter.c, gtk/gtktextiter.h: add sentence equivalents
to all the word functions
* gtk/gtktextview.c (gtk_text_view_start_cursor_blink): return
before doing anything on NULL layout or if we don't have the focus
* gtk/testtext.c (fill_example_buffer): "justification"
* gtk/gtktexttag.h, gtk/gtktexttag.c: change the tag attribute
to be called "justification" not "justify"
* demos/gtk-demo/textview.c (create_tags): "justification"
* gtk/gtktextlayout.c (set_para_values): Handle char-wise wrapping
2001-01-22 23:09:48 +00:00
* will be set to an error from the # GDK_PIXBUF_ERROR or # G_FILE_ERROR
* domains . If you ' re just cancelling a load rather than expecting it
* to be finished , passing % NULL for @ error to ignore it is
* reasonable .
1999-10-26 03:42:14 +00:00
*
Add built marshaller files to support GdkPixbufLoader signals
2001-01-22 Havoc Pennington <hp@redhat.com>
* Makefile.am: Add built marshaller files to support
GdkPixbufLoader signals
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
module location, rather than acting as a fallback, because we are
using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.
* gdk-pixbuf.h: include gdk-pixbuf-loader.h
* gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
from gtk, and add error to close(), because stop_load may do
parsing of the image.
* pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file
* io-*.c: make individual operations static, and add fill_vtable
functions which are exported. Fix the collection of type warnings
that surfaced, including a number of functions that didn't
properly take a GError and some that weren't
const-correct. Involved adding error handling for a few loaders.
* gdk-pixbuf-io.h: Add error reporting to stop_load function
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
a function that fills in the GdkPixbufModule vtable, instead of
looking up all the image functions individually; this means we
can get type safety within modules for the loader functions.
Also it means you don't have to keep the statically compiled and
GModule versions in sync.
* test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()
* make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()
* gdk-pixbuf.h: nuke gdk_pixbuf_init()
* gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
() here
* gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
g_type_init() here
2001-01-22 Havoc Pennington <hp@redhat.com>
* demos/testanimation.c: fix to reflect gdk-pixbuf changes
* demos/testpixbuf.c: fix to reflect gdk-pixbuf changes
* gtk/gdk-pixbuf-loader.c, gtk/gdk-pixbuf-loader.h:
Remove, move back to gdk-pixbuf
* gtk/gtktextiter.c, gtk/gtktextiter.h: add sentence equivalents
to all the word functions
* gtk/gtktextview.c (gtk_text_view_start_cursor_blink): return
before doing anything on NULL layout or if we don't have the focus
* gtk/testtext.c (fill_example_buffer): "justification"
* gtk/gtktexttag.h, gtk/gtktexttag.c: change the tag attribute
to be called "justification" not "justify"
* demos/gtk-demo/textview.c (create_tags): "justification"
* gtk/gtktextlayout.c (set_para_values): Handle char-wise wrapping
2001-01-22 23:09:48 +00:00
* Returns : % TRUE if all image data written so far was successfully
passed out via the update_area signal
1999-10-26 03:42:14 +00:00
* */
Add built marshaller files to support GdkPixbufLoader signals
2001-01-22 Havoc Pennington <hp@redhat.com>
* Makefile.am: Add built marshaller files to support
GdkPixbufLoader signals
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
module location, rather than acting as a fallback, because we are
using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.
* gdk-pixbuf.h: include gdk-pixbuf-loader.h
* gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
from gtk, and add error to close(), because stop_load may do
parsing of the image.
* pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file
* io-*.c: make individual operations static, and add fill_vtable
functions which are exported. Fix the collection of type warnings
that surfaced, including a number of functions that didn't
properly take a GError and some that weren't
const-correct. Involved adding error handling for a few loaders.
* gdk-pixbuf-io.h: Add error reporting to stop_load function
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
a function that fills in the GdkPixbufModule vtable, instead of
looking up all the image functions individually; this means we
can get type safety within modules for the loader functions.
Also it means you don't have to keep the statically compiled and
GModule versions in sync.
* test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()
* make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()
* gdk-pixbuf.h: nuke gdk_pixbuf_init()
* gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
() here
* gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
g_type_init() here
2001-01-22 Havoc Pennington <hp@redhat.com>
* demos/testanimation.c: fix to reflect gdk-pixbuf changes
* demos/testpixbuf.c: fix to reflect gdk-pixbuf changes
* gtk/gdk-pixbuf-loader.c, gtk/gdk-pixbuf-loader.h:
Remove, move back to gdk-pixbuf
* gtk/gtktextiter.c, gtk/gtktextiter.h: add sentence equivalents
to all the word functions
* gtk/gtktextview.c (gtk_text_view_start_cursor_blink): return
before doing anything on NULL layout or if we don't have the focus
* gtk/testtext.c (fill_example_buffer): "justification"
* gtk/gtktexttag.h, gtk/gtktexttag.c: change the tag attribute
to be called "justification" not "justify"
* demos/gtk-demo/textview.c (create_tags): "justification"
* gtk/gtktextlayout.c (set_para_values): Handle char-wise wrapping
2001-01-22 23:09:48 +00:00
gboolean
gdk_pixbuf_loader_close ( GdkPixbufLoader * loader ,
GError * * error )
1999-10-26 03:42:14 +00:00
{
2002-11-05 22:58:28 +00:00
GdkPixbufLoaderPrivate * priv ;
gboolean retval = TRUE ;
g_return_val_if_fail ( loader ! = NULL , TRUE ) ;
g_return_val_if_fail ( GDK_IS_PIXBUF_LOADER ( loader ) , TRUE ) ;
2003-04-24 18:51:07 +00:00
g_return_val_if_fail ( error = = NULL | | * error = = NULL , TRUE ) ;
2002-11-05 22:58:28 +00:00
priv = loader - > priv ;
/* we expect it's not closed */
g_return_val_if_fail ( priv - > closed = = FALSE , TRUE ) ;
/* We have less the 128 bytes in the image. Flush it, and keep going. */
if ( priv - > image_module = = NULL )
{
GError * tmp = NULL ;
gdk_pixbuf_loader_load_module ( loader , NULL , & tmp ) ;
if ( tmp ! = NULL )
{
g_propagate_error ( error , tmp ) ;
retval = FALSE ;
}
}
if ( priv - > image_module & & priv - > image_module - > stop_load & & priv - > context )
{
if ( ! priv - > image_module - > stop_load ( priv - > context , error ) )
retval = FALSE ;
}
priv - > closed = TRUE ;
if ( priv - > needs_scale )
{
GdkPixbuf * tmp , * pixbuf ;
tmp = gdk_pixbuf_animation_get_static_image ( priv - > animation ) ;
g_object_ref ( tmp ) ;
pixbuf = gdk_pixbuf_new ( GDK_COLORSPACE_RGB , tmp - > has_alpha , 8 , priv - > width , priv - > height ) ;
g_object_unref ( priv - > animation ) ;
priv - > animation = gdk_pixbuf_non_anim_new ( pixbuf ) ;
g_object_unref ( pixbuf ) ;
g_signal_emit ( loader , pixbuf_loader_signals [ AREA_PREPARED ] , 0 ) ;
gdk_pixbuf_scale ( tmp , pixbuf , 0 , 0 , priv - > width , priv - > height , 0 , 0 ,
( double ) priv - > width / tmp - > width ,
( double ) priv - > height / tmp - > height ,
GDK_INTERP_BILINEAR ) ;
g_object_unref ( tmp ) ;
g_signal_emit ( loader , pixbuf_loader_signals [ AREA_UPDATED ] , 0 ,
0 , 0 , priv - > width , priv - > height ) ;
}
g_signal_emit ( loader , pixbuf_loader_signals [ CLOSED ] , 0 ) ;
return retval ;
1999-10-26 03:42:14 +00:00
}
2001-08-30 07:23:32 +00:00
2002-10-03 22:39:51 +00:00
/**
* gdk_pixbuf_loader_get_format :
* @ loader : A pixbuf loader .
*
* Obtains the available information about the format of the
* currently loading image file .
*
* Returns : A # GdkPixbufFormat or % NULL . The return value is owned
* by GdkPixbuf and should not be freed .
2002-11-28 00:33:17 +00:00
*
* Since : 2.2
2002-10-03 22:39:51 +00:00
*/
GdkPixbufFormat *
gdk_pixbuf_loader_get_format ( GdkPixbufLoader * loader )
{
2002-11-05 22:58:28 +00:00
GdkPixbufLoaderPrivate * priv ;
2002-10-03 22:39:51 +00:00
2002-11-05 22:58:28 +00:00
g_return_val_if_fail ( loader ! = NULL , NULL ) ;
g_return_val_if_fail ( GDK_IS_PIXBUF_LOADER ( loader ) , NULL ) ;
2002-10-03 22:39:51 +00:00
2002-11-05 22:58:28 +00:00
priv = loader - > priv ;
2001-08-30 07:23:32 +00:00
2002-11-05 22:58:28 +00:00
if ( priv - > image_module )
return _gdk_pixbuf_get_format ( priv - > image_module ) ;
else
return NULL ;
2002-10-03 22:39:51 +00:00
}
2002-07-06 23:10:46 +00:00