Compare commits
142 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1839240c72 | |||
| 1b51476458 | |||
| c4b632e781 | |||
| 48d8ec36d5 | |||
| 9ce7ba8df8 | |||
| 719f258bc6 | |||
| 31fa339113 | |||
| 26b2cbe5ae | |||
| fccaf53bfb | |||
| f43ab0c41d | |||
| b9d4205044 | |||
| 8596f7edc5 | |||
| 386ae20970 | |||
| 014e275b3a | |||
| cab7ca49d5 | |||
| 438e6357b7 | |||
| 9595c55184 | |||
| 5ef1e2e970 | |||
| 29b11b554d | |||
| 88286d32af | |||
| ac9090ed10 | |||
| 2e71702a7a | |||
| 0e164d5fca | |||
| 2aff269cbd | |||
| 8e8917d7b8 | |||
| acc8e78c2d | |||
| 8a836c07cf | |||
| ea71f02aca | |||
| e6abb4709f | |||
| 0f038c9e32 | |||
| 24fa8a64bc | |||
| fec650eb38 | |||
| 375ed31443 | |||
| e097e863d6 | |||
| 57dd3ef80f | |||
| 4481ff0cef | |||
| 1f149b3a8d | |||
| 33dc3d6d4c | |||
| ec60eb1baf | |||
| 6b4e76ede6 | |||
| a77a3d135d | |||
| 16814166ba | |||
| aee1e50166 | |||
| ff8a24c85a | |||
| 3d9b6e2435 | |||
| 157dc8922f | |||
| 9f4c947028 | |||
| 4fe58c01f9 | |||
| affbc828b3 | |||
| c1592ab52b | |||
| a61a5ffe80 | |||
| cf1a251f35 | |||
| 37ac7d593e | |||
| a106984b7f | |||
| 33e7c9bce3 | |||
| 829ed02435 | |||
| daaae930ad | |||
| 6efaa8c725 | |||
| 848cff384e | |||
| d96d7ada5a | |||
| ddd6248ae3 | |||
| 58df98f92a | |||
| 74fbc5d9ea | |||
| e9c20fac4c | |||
| 133ab96180 | |||
| 8a680eb75c | |||
| f77b679fe4 | |||
| 2907d515b2 | |||
| 57c0bee7b3 | |||
| 31828be9c4 | |||
| c502b23fc7 | |||
| e7550f1c9c | |||
| 0152e0d6e2 | |||
| cf9537d74d | |||
| 06aed52437 | |||
| a6e85956d2 | |||
| b14b577d59 | |||
| 8822298930 | |||
| 8098546227 | |||
| 4238d406e9 | |||
| 43c05caef2 | |||
| c773e6e0bc | |||
| a4fa9b8aa9 | |||
| 07b1e46225 | |||
| d71b916716 | |||
| 8b0589f009 | |||
| 0cc2a00dc9 | |||
| 2cc21d52cd | |||
| 146313a3d2 | |||
| 10ba4fd066 | |||
| 3f98a849c7 | |||
| 6301e32f2a | |||
| 6c5b4c65c2 | |||
| e99b78cdea | |||
| 407a379189 | |||
| ec1e8f1f5d | |||
| 960906e1e2 | |||
| 35226a7be5 | |||
| 7ed05e22e5 | |||
| b8c691e6b2 | |||
| ac67157049 | |||
| 5a4e1abbfc | |||
| 2468916bcc | |||
| 25472c7578 | |||
| 06884f05ff | |||
| de9fb93157 | |||
| 6ab2659931 | |||
| 160e3574ac | |||
| e809560d6a | |||
| a629fd7f84 | |||
| 117b2eca5c | |||
| e8fa46be45 | |||
| f9d3bbdaaf | |||
| 160809ca7b | |||
| 1af201e9bb | |||
| e97e6e632e | |||
| 713b36cedb | |||
| b128983b58 | |||
| 61c009c800 | |||
| 8891244084 | |||
| bcc0607e69 | |||
| dd60f7b998 | |||
| d9c46655cc | |||
| 6654a22891 | |||
| 2444c80ff7 | |||
| 811cd0c124 | |||
| 92b4a139ba | |||
| 79d6346057 | |||
| 7ef740e03d | |||
| 1dcb67c8f3 | |||
| bddd4ca943 | |||
| 797d345446 | |||
| c8a2382b65 | |||
| ab1deac87f | |||
| d0f73034cf | |||
| 97f2c2b7bb | |||
| 9bf3a0be0c | |||
| 37cfb7d74b | |||
| 95a9052d56 | |||
| ff99eb7cc1 | |||
| ef03cb5287 | |||
| 196d48435e |
+1464
File diff suppressed because it is too large
Load Diff
+1464
File diff suppressed because it is too large
Load Diff
+1464
File diff suppressed because it is too large
Load Diff
+1464
File diff suppressed because it is too large
Load Diff
+1464
File diff suppressed because it is too large
Load Diff
+1464
File diff suppressed because it is too large
Load Diff
@@ -7,8 +7,8 @@ you got this package.
|
||||
Simple install procedure
|
||||
========================
|
||||
|
||||
% gzip -cd gtk+-1.2.5.tar.gz | tar xvf - # unpack the sources
|
||||
% cd gtk+-1.2.5 # change to the toplevel directory
|
||||
% gzip -cd gtk+-1.2.7.tar.gz | tar xvf - # unpack the sources
|
||||
% cd gtk+-1.2.7 # change to the toplevel directory
|
||||
% ./configure # run the `configure' script
|
||||
% make # build GTK
|
||||
[ Become root if necessary ]
|
||||
@@ -118,7 +118,7 @@ You can compile GTK+ against a copy of GLIB that you have not
|
||||
yet installed. To do this, give the --with-glib=DIR options
|
||||
to ./configure. For instance:
|
||||
|
||||
./configure --with-glib=../glib-1.2.5
|
||||
./configure --with-glib=../glib-1.2.7
|
||||
|
||||
This, however, will not work if you built GLIB with different
|
||||
source and build directories.
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ EXTRA_DIST = \
|
||||
examples/buttons/buttons.c \
|
||||
examples/buttons/info.xpm \
|
||||
examples/calendar/Makefile \
|
||||
examples/calendar/gcalendar.c \
|
||||
examples/calendar/calendar.c \
|
||||
examples/clist/Makefile \
|
||||
examples/clist/clist.c \
|
||||
examples/entry/Makefile \
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
General Information
|
||||
===================
|
||||
|
||||
This is GTK+ version 1.2.0. GTK+, which stands for the Gimp ToolKit,
|
||||
This is GTK+ version 1.2.7. GTK+, which stands for the Gimp ToolKit,
|
||||
is a library for creating graphical user interfaces for the X Window
|
||||
System. It is designed to be small, efficient, and flexible. GTK+ is
|
||||
written in C with a very object-oriented approach.
|
||||
@@ -37,9 +37,9 @@ version number. This should be separated by a blank
|
||||
line from the actual headers.
|
||||
|
||||
Package: gtk+
|
||||
Version: 1.2.0
|
||||
Version: 1.2.7
|
||||
|
||||
[ Please substitute 1.2.0 with the version of GTK+ that
|
||||
[ Please substitute 1.2.7 with the version of GTK+ that
|
||||
you have installed ]
|
||||
|
||||
Then describe the bug. Include:
|
||||
@@ -82,7 +82,7 @@ From: yourname@your.address.org
|
||||
Subject: handlebox test in testgtk is misnamed.
|
||||
|
||||
Package: gtk+
|
||||
Version: 1.2.0
|
||||
Version: 1.2.7
|
||||
|
||||
When I run gtk/testgtk, the button "handle box"
|
||||
is misnamed. There are multiple handle boxes in
|
||||
|
||||
+154
@@ -0,0 +1,154 @@
|
||||
Gtk port to nano-X
|
||||
|
||||
STATUS
|
||||
|
||||
Once upon a time I got a few apps working, then started merging
|
||||
the new features added by Owen (32 bit sizes for windows and buffering).
|
||||
Since then I haven't found the time to work on it:-/
|
||||
|
||||
|
||||
TODO
|
||||
|
||||
Finish internal window manager abstraction or add proper support in nano-X.
|
||||
Fix event polling.
|
||||
Implement GdkImage, GdkRgb stuff.
|
||||
Put generic region code in generic gdk and/or use the region code from nano-X.
|
||||
Fix ugly automake stuff for make dist.
|
||||
|
||||
TODO in nano-X
|
||||
|
||||
We need to be able to clip and change the background of windows at runtime
|
||||
for apps to not look so ugly!
|
||||
Fonts: wait for better nano-X font implementation.
|
||||
Properties on windows.
|
||||
|
||||
|
||||
If you want to work on this port or get additional informnation, get in
|
||||
touch with me.
|
||||
To get the beast to compile you also need to apply the patch below
|
||||
(any auto* wizard here?): the issue of having two gtk libraries in the
|
||||
system needs to be addressed too, maybe use libgtk-x11-1.4.so and
|
||||
libgtk-nanox-1.4.so ...
|
||||
|
||||
Paolo Molaro
|
||||
lupus@linuxcare.com
|
||||
|
||||
|
||||
Index: acconfig.h
|
||||
===================================================================
|
||||
RCS file: /cvs/gnome/gtk+/acconfig.h,v
|
||||
retrieving revision 1.16
|
||||
diff -u -r1.16 acconfig.h
|
||||
--- acconfig.h 1999/03/20 00:52:29 1.16
|
||||
+++ acconfig.h 2000/05/06 11:52:38
|
||||
@@ -49,6 +49,8 @@
|
||||
/* Most machines will be happy with int or void. IRIX requires '...' */
|
||||
#undef SIGNAL_ARG_TYPE
|
||||
|
||||
+#undef USE_NANOX
|
||||
+
|
||||
/* #undef PACKAGE */
|
||||
/* #undef VERSION */
|
||||
|
||||
Index: configure.in
|
||||
===================================================================
|
||||
RCS file: /cvs/gnome/gtk+/configure.in,v
|
||||
retrieving revision 1.142
|
||||
diff -u -r1.142 configure.in
|
||||
--- configure.in 2000/05/04 00:29:46 1.142
|
||||
+++ configure.in 2000/05/06 11:52:38
|
||||
@@ -99,6 +99,8 @@
|
||||
AC_ARG_WITH(locale, [ --with-locale=LOCALE locale name you want to use ])
|
||||
|
||||
AC_ARG_WITH(xinput, [ --with-xinput=[no/gxi/xfree] support XInput ])
|
||||
+AC_ARG_ENABLE(nanox, [ --enable-nanox use nano-X instead of X11 [default=no]],
|
||||
+ , enable_nanox="no")
|
||||
|
||||
if test "x$enable_debug" = "xyes"; then
|
||||
test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
|
||||
@@ -322,6 +324,8 @@
|
||||
saved_cflags="$CFLAGS"
|
||||
saved_ldflags="$LDFLAGS"
|
||||
|
||||
+if text "x$enable_nanox" = "xno"; then
|
||||
+
|
||||
CFLAGS="$CFLAGS $X_CFLAGS"
|
||||
LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
|
||||
|
||||
@@ -465,6 +469,13 @@
|
||||
GTK_LOCALE_FLAGS="-DX_LOCALE"
|
||||
fi
|
||||
|
||||
+else
|
||||
+AC_CHECK_LIB(nano-X, GrOpen)
|
||||
+LIBS="-lnano-X $LIBS"
|
||||
+ AC_DEFINE(USE_NANOX)
|
||||
+AM_CONDITIONAL(USE_NANOX, test x$enable_nanox = xyes)
|
||||
+fi # if enable_nanox
|
||||
+
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
|
||||
@@ -602,8 +613,13 @@
|
||||
esac
|
||||
],[
|
||||
# Currently we always use X11 on those systems where we run configure...
|
||||
+if test x$enable_nanox = xno; then
|
||||
gdk_windowing='
|
||||
#define GDK_WINDOWING_X11'
|
||||
+else
|
||||
+gdk_windowing='
|
||||
+#define GDK_WINDOWING_NANOX'
|
||||
+fi
|
||||
if test x$gdk_wchar_h = xyes; then
|
||||
gdk_wc='
|
||||
#define GDK_HAVE_WCHAR_H 1'
|
||||
@@ -629,6 +645,7 @@
|
||||
docs/Makefile
|
||||
gdk/Makefile
|
||||
gdk/x11/Makefile
|
||||
+gdk/nanox/Makefile
|
||||
gdk/win32/Makefile
|
||||
gtk/Makefile
|
||||
gtk/gtkfeatures.h
|
||||
Index: gdk/Makefile.am
|
||||
===================================================================
|
||||
RCS file: /cvs/gnome/gtk+/gdk/Makefile.am,v
|
||||
retrieving revision 1.41
|
||||
diff -u -r1.41 Makefile.am
|
||||
--- gdk/Makefile.am 2000/04/05 04:11:10 1.41
|
||||
+++ gdk/Makefile.am 2000/05/06 11:52:38
|
||||
@@ -1,6 +1,10 @@
|
||||
## Makefile.am for gtk+/gdk
|
||||
|
||||
+if USE_NANOX
|
||||
+SUBDIRS=win32 nanox
|
||||
+else
|
||||
SUBDIRS=x11 win32
|
||||
+endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
gdkconfig.h.win32 \
|
||||
@@ -36,8 +40,13 @@
|
||||
-lm \
|
||||
@STRIP_END@
|
||||
|
||||
+if USE_NANOX
|
||||
libgdk_la_LIBADD = \
|
||||
+ nanox/libgdk-nanox.la
|
||||
+else
|
||||
+libgdk_la_LIBADD = \
|
||||
x11/libgdk-x11.la
|
||||
+endif
|
||||
|
||||
#
|
||||
# setup source file variables
|
||||
@@ -138,3 +147,8 @@
|
||||
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
||||
+
|
||||
+noinst_PROGRAMS = simple
|
||||
+simple_DEPENDENCIES = libgdk.la simple.c
|
||||
+simple_LDADD = libgdk.la
|
||||
+
|
||||
+14
-8
@@ -3,12 +3,18 @@ correct as the Unix/X11 version. For more information about the Win32
|
||||
port, see http://www.gimp.org/tml/gimp/win32/ or
|
||||
http://www.iki.fi/tml/gimp/win32/ .
|
||||
|
||||
The current (CVS) version of the Win32 backend is *not* as stable as it
|
||||
was before the no-flicker branch was merged. A zipfile with that
|
||||
version is available from http://www.gimp.org/win32/. That should be
|
||||
use by "production" code until this CVS version is usable. (But note,
|
||||
the Win32 backend has never been claimed to be "production quality".)
|
||||
|
||||
To build GTk+ on Win32, you need either the Microsoft compiler and
|
||||
tools, or gcc-2.95 or later running under cygwin-b20.1 or
|
||||
later. Compile in gdk\win32 and gtk with `nmake -f makefile.msc` or
|
||||
`make -f makefile.cygwin`. Before doing a install, check the BIN
|
||||
definition in gdk\win32\makefile.msc (or makefile.cygwin) and
|
||||
gtk\makefile.msc (or makefile.cygwin).
|
||||
tools, or gcc-2.95 or later. The mingw setup of gcc is preferred, but
|
||||
you can run gcc also under cygwin-b20.1 or later. Compile in
|
||||
gdk\win32, gdk and gtk with `nmake -f makefile.msc` or `make -f
|
||||
makefile.cygwin`. The name makefile.cygwin is misleading, it should
|
||||
really be called makefile.mingw.
|
||||
|
||||
See the README.win32 file in the GLib distribution for instructions
|
||||
how to build with gcc.
|
||||
@@ -34,6 +40,6 @@ config.h.win32 file, and remove references to the gnu-intl library
|
||||
from the makefiles.
|
||||
|
||||
Note that while the GNU gettext package is under the GPL, the "intl"
|
||||
part of it as distributed with GNU libc is under the LGPL (like GTk+
|
||||
or GLib). We want the LGPL one, even if they are the same, more or
|
||||
less.
|
||||
part of it which is distributed with GNU libc is under the LGPL (like
|
||||
GTk+ or GLib). We want the LGPL one, even if they are the same, more
|
||||
or less.
|
||||
|
||||
@@ -185,7 +185,7 @@ DND
|
||||
|
||||
- Use a cursor instead of an ICON when over Motif windows,
|
||||
to get rid of the current junk that Motif leaves because
|
||||
of it's XCopyArea stupidity for doing highlighting.
|
||||
of its XCopyArea stupidity for doing highlighting.
|
||||
|
||||
- Add a GTK_DRAG_VERIFY target flag and a "drag_data_verify"
|
||||
signal so that apps can easily check if a, say,
|
||||
|
||||
@@ -0,0 +1,739 @@
|
||||
<!-- This is used to generate the online TODO list for GTK+ using
|
||||
the script docs/make-todo. Whenever a change to this file is
|
||||
committed to CVS,the file is run through make-todo and the online
|
||||
version updated. If you modify this file, you should check for
|
||||
parse errors by running:
|
||||
|
||||
$ docs/make-todo TODO.xml > /dev/null
|
||||
|
||||
before committing, or you may screw up the online version -->
|
||||
<todo logourl="gtk-logo-rgb.gif">
|
||||
<title>GTK+ TODO list</title>
|
||||
<section>
|
||||
<title>GDK</title>
|
||||
|
||||
<entry size="medium" status="70%" target="1.4">
|
||||
<title>Add backing store support</title>
|
||||
<description>
|
||||
<p>
|
||||
GTK+'s drawing model involves clearing to a background, and
|
||||
then drawing widgets on top of this. Without having
|
||||
backing-store support, this results in flickering in various
|
||||
situations. Backing store cannot be added widget-by-widget,
|
||||
because the drawing in a particular window is not confined
|
||||
to a single widget. Instead it needs to be added per GDK
|
||||
window.
|
||||
</p>
|
||||
<p>
|
||||
The way this is done is by having
|
||||
<tt>gdk_window_begin_paint()</tt>
|
||||
and <tt>gdk_window_end_paint()</tt> functions that
|
||||
redirect all drawing to a particular window to an offscreen
|
||||
pixmap, and then copy that offscreen pixmap back onto the
|
||||
screen when the paint operation is done. The implementation
|
||||
of this is mostly complete in the <tt>gtk-no-flicker</tt> branch of
|
||||
GTK+.
|
||||
</p>
|
||||
</description>
|
||||
<url>http://www.gtk.org/~otaylor/gtk/1.4/gdk-drawing.html</url>
|
||||
<contact>Owen Taylor <otaylor@redhat.com></contact>
|
||||
</entry>
|
||||
|
||||
<entry size="medium" status="70%" target="1.4">
|
||||
<title>32 Bit Coordinates</title>
|
||||
<description>
|
||||
<p>
|
||||
GTK+-1.2 and earlier share X's limitation on the
|
||||
size of coordinates and restrict all dimensions
|
||||
to 16 bit quantities. By clever use of X it is
|
||||
possible to lift this restriction and present a
|
||||
full 32-bit space to the user.
|
||||
</p>
|
||||
<p>
|
||||
There are some difficulties with performance in this
|
||||
approach - mostly because scrolling can involve mapping and
|
||||
unmapping lots of widgets, but in general, current
|
||||
trials in this area seem to work pretty well.
|
||||
</p>
|
||||
</description>
|
||||
<url>http://www.gtk.org/~otaylor/gtk/1.4/gdk-drawing.html</url>
|
||||
<contact>Owen Taylor <otaylor@redhat.com></contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="0%" target="1.4">
|
||||
<title>Customizable double-click timeout</title>
|
||||
<description>
|
||||
<p>
|
||||
The current fixed double-click timeout in GTK+
|
||||
is too small for some users. This needs to be
|
||||
customizable
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
<bugs>#3958</bugs>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="0%" target="1.4">
|
||||
<title>Make color handling more convenient</title>
|
||||
<description>
|
||||
<p>
|
||||
Add some color convenience functions; such as a way to get an
|
||||
allocated GdkColor from GdkRGB, and export functions from gtkstyle.c
|
||||
that lighten/darken a given color, and set a color from HSV in
|
||||
addition to RGB. Also, consider having static variables that contain
|
||||
preallocated common colors (gdk_blue, gdk_red, etc.), the problem
|
||||
being colormap issues.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="0%" target="1.4">
|
||||
<title>Cursors</title>
|
||||
<description>
|
||||
<p>
|
||||
Two tasks: 1) move the cursors in the cursor font that people actually
|
||||
care about to the top of the gdkcursor.h header file, and put a nice
|
||||
list of the 15 cursors people actually care about in the docs 2) if
|
||||
the cursor font lacks some commonly-useful cursors (like magnifying
|
||||
glass), add these cursors to gdkcursor.h and then emulate them in
|
||||
gdk_cursor_new by transparently creating the cursor from a bitmap.
|
||||
The list of Qt cursors is worth http://doc.trolltech.com/qcursor.html
|
||||
looking at for this task.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="medium" status="0%" target="1.4">
|
||||
<title>Make GdkRGB work on any visual</title>
|
||||
<description>
|
||||
<p>
|
||||
GdkRGB should be able to render to an arbitrary visual
|
||||
(i.e. the visual shouldn't be fixed at gdk_rgb_init()
|
||||
time). This will break gdk_rgb_gc_set_foreground() and
|
||||
friends, though.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
</section> <!-- GDK -->
|
||||
|
||||
<section>
|
||||
<title>Internationalization</title>
|
||||
|
||||
<entry size="big" status="70%" target="1.4">
|
||||
<title>Integrate Pango</title>
|
||||
<description>
|
||||
<p>
|
||||
The purpose of the Pango project is to provide a system for
|
||||
layout and rendering of internationalized text. It handles
|
||||
most of the issues necessary to
|
||||
</p>
|
||||
</description>
|
||||
<url>http://www.pango.org</url>
|
||||
<contact>gtk-i18n-list@redhat.com</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="medium" status="80%" target="1.4">
|
||||
<title>Switch to using UTF-8</title>
|
||||
<description>
|
||||
<p>
|
||||
This is closely related to Pango integration. Pango deals
|
||||
with all strings in terms of UTF-8; by switching GTK+ over
|
||||
to UTF-8 we make it considerably simpler for developers to
|
||||
support multiple languages properly while still retaining
|
||||
a large degree of compatibility with existing programs.
|
||||
</p>
|
||||
<p>
|
||||
Some work has already been done on this as part of the Win32
|
||||
port, since the Win32 port is currently using UTF-8 for all
|
||||
strings. In general, this should be an easy job; the hardest
|
||||
parts are places like GtkFileSelection, cut and paste, and
|
||||
input method support where there is interaction between GTK+
|
||||
and the operating system.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-i18n-list@redhat.com</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="40%" target="1.4">
|
||||
<title>Rewrite Input Method Support</title>
|
||||
<description>
|
||||
<p>
|
||||
Support for Input Methods is GTK+-1.2 is done via XIM, with
|
||||
supported styles being over-the-spot and the root-window
|
||||
styles. However, the over-the-spot style is not going to
|
||||
work well with the Pango integration, since it relies on the
|
||||
text rendering in the program being done in the standard
|
||||
Xlib style, so it will be necessary to also support
|
||||
on-the-spot input. On-the-spot input is done by supplying a
|
||||
set of callbacks that are invoked by the input methods.
|
||||
</p>
|
||||
<p>
|
||||
GTK+-1.4 will have a new system with loadable input method
|
||||
modules. These modules can either be implemented using XIM,
|
||||
or written from scratch.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-i18n-list@redhat.com</contact>
|
||||
</entry>
|
||||
</section> <!-- i18n -->
|
||||
|
||||
<section>
|
||||
<title>GTK+ Core</title>
|
||||
|
||||
<entry size="big" status="5%" target="1.4">
|
||||
<title>GLib based object and type system</title>
|
||||
<description>
|
||||
<p>
|
||||
The GTK+ object system is already in use in quite a few different
|
||||
non-GUI applications; it would be desirable for these uses
|
||||
to have the object and type systems separated from the GUI portions
|
||||
of GTK+ and be generalized for non-GUI usage.
|
||||
</p>
|
||||
</description>
|
||||
<contact>Tim Janik <timj@gtk.org></contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="1%" target="1.4">
|
||||
<title>Overall callback improvements</title>
|
||||
<description>
|
||||
<p>
|
||||
The GTK+ type and signal systems need significant improvements to
|
||||
allow signal creation with default handlers from language bindings
|
||||
and to aid language bindings in deriving new objects.
|
||||
One aspect of this is the Closure support, recently suggested by
|
||||
Karl Nelson <kenelson@ece.ucdavis.edu>, but this also
|
||||
requires a GLib based type and parameter system (ties in with
|
||||
"GLib based object and type system").
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="0%" target="1.4">
|
||||
<title>State change notification</title>
|
||||
<description>
|
||||
<p>
|
||||
GTK+ objects emit various types of signals, some to perform
|
||||
arbitrary actions, some to allow customization from user code,
|
||||
and some signals are emitted to notify of certain changes
|
||||
of an object. For the latter, what really is required is a
|
||||
gneneric signal that can be used to monitor *any* kind of object
|
||||
changes. For that, all object changes need to be routed through
|
||||
a central point (otherwise the signal emissions are spread all
|
||||
over the object implementation), i.e. an object argument setter.
|
||||
The state change notification signal doesn't need to be emitted
|
||||
syncronously, in fact, it's probably most effective to always
|
||||
emit this asynchronously, so subsequent changes are accumulated.
|
||||
</p>
|
||||
</description>
|
||||
<contact>Tim Janik <timj@gtk.org></contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="5%" target="1.4">
|
||||
<title>Widget as sensitivity/grab state machine</title>
|
||||
<description>
|
||||
<p>
|
||||
Maintenance of pointer and keybnoard grabs is currently very
|
||||
tedious and error-prone, most widget's cook up their own stuff
|
||||
in this regard.
|
||||
By moving the general concept of "Grabs" to the GTK+ level as
|
||||
a widget state, and providing a new signal for alterations of
|
||||
a widget's state ("visible", "visible+insensitive",
|
||||
"visible+grab", "hidden", "hidden+insensitive", etc.), things
|
||||
can be unified and more stabelize. A couple of bugs, such as
|
||||
insensitive widgets still holding a grab, or buttons that
|
||||
still think they are depressed when hidden, will be squeezed
|
||||
automatically with that.
|
||||
</p>
|
||||
</description>
|
||||
<contact>Tim Janik <timj@gtk.org></contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="0%" target="1.4">
|
||||
<title>Allow argument customization</title>
|
||||
<description>
|
||||
<p>
|
||||
Many types of object arguments (expander style in the CList,
|
||||
default padding in button boxes, etc), conceptually go with
|
||||
the theme, or as user preferences; they should not be set by
|
||||
a particular program.
|
||||
</p>
|
||||
<p>
|
||||
There needs to be a mechanism for themes to be able to
|
||||
control these arguments from the RC file.
|
||||
</p>
|
||||
</description>
|
||||
</entry>
|
||||
|
||||
<entry size="medium" status="0%" target="1.4">
|
||||
<title>Allow global customization</title>
|
||||
<description>
|
||||
<p>
|
||||
There are a number of global parameters in GTK+ and GDK that should be
|
||||
customizable by the user, such as the double-click timeout,
|
||||
or whether widgets should be backing-stored by default.
|
||||
</p>
|
||||
<p>
|
||||
If we had argument customization from an RC file, it might
|
||||
be possible to do this simply with a global object with
|
||||
arguments for the various global parameters that was
|
||||
customized in the same fashion as object arguments.
|
||||
</p>
|
||||
</description>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="0%" target="1.4">
|
||||
<title>Gtk+ Modules installation directory</title>
|
||||
<description>
|
||||
<p>
|
||||
Gtk+ needs to support an extra lib/ directory, to search
|
||||
for dynamically loadable modules, it also needs to support
|
||||
an environment variable to specify module search paths.
|
||||
This has quite some cross-platform issues with the GModule
|
||||
code (especially on AIX).
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
|
||||
<entry size="small" status="0%" target="1.4">
|
||||
<title>Convenient widget setup</title>
|
||||
<description>
|
||||
<p>
|
||||
Make it simpler to set all the basic attributes of a widget. Might
|
||||
want set_tooltip(), set_accel(), set_color(FOREGROUND, color),
|
||||
set_min_size() (usize does this, but needs a rename), set_whatsthis(),
|
||||
etc. set_accel() may not work for all widgets, may need a convenience
|
||||
API for button and label accelerators specifically.
|
||||
</p>
|
||||
<p>
|
||||
The idea is that it should be easy, out of the box, to set up a widget
|
||||
with all the nice touches and features the widget really should
|
||||
have. Users shouldn't need to do their own convenience functions for
|
||||
this.
|
||||
</p>
|
||||
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="medium" status="0%" target="> 1.4">
|
||||
<title>Make selections/clipboard more convenient</title>
|
||||
<description>
|
||||
<p>
|
||||
Make GtkSelectionData more like the MIME blobs in Swing and Qt.
|
||||
Consider a GtkClipboard object to simplify cut-and-paste handling.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
|
||||
<entry size="small" status="50%" target="1.4">
|
||||
<title>Stock label/icon system</title>
|
||||
<description>
|
||||
<p>
|
||||
A system like GnomeStock for getting a standard labels/icons
|
||||
for menus and toolbars. Should be extensible by themes, and
|
||||
by libgnomeui. Some work already done on this.
|
||||
</p>
|
||||
</description>
|
||||
<contact>hp@redhat.com</contact>
|
||||
</entry>
|
||||
|
||||
|
||||
<entry size="big" status="0%" target="> 1.4">
|
||||
<title>Session Management</title>
|
||||
<description>
|
||||
<p>
|
||||
Look in to session management. Consider whether to use
|
||||
X11R6 SM, or some custom spec shared with KDE. Create
|
||||
GTK+ API for this.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="0%" target="> 1.4">
|
||||
<title>Online help enhancements</title>
|
||||
<description>
|
||||
<p>
|
||||
Look at a small "What's This" popup widget,
|
||||
and a What's This system in general (this part
|
||||
could maybe be done for 1.4). A more difficult, probably
|
||||
a post-1.4 task, is to integrate a very simple little
|
||||
help browser gizmo into GTK.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
|
||||
<entry size="medium" status="0%" target="1.4">
|
||||
<title>GUI-editable means of user configuration</title>
|
||||
<description>
|
||||
<p>
|
||||
Need to be able to set double click time, whether cursors
|
||||
blink, etc., from a control panel type of deal.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
</section> <!-- Core -->
|
||||
|
||||
<section>
|
||||
<title>GTK+ Widgets</title>
|
||||
|
||||
<entry size="small" status="50%" target="1.4">
|
||||
<title>Make GtkFrame use a label</title>
|
||||
<description>
|
||||
<p>
|
||||
The title of a frame should simply be another child widget
|
||||
which, by default, holds a label widget. This will important
|
||||
with Pango where proper text behavior will be more complex to
|
||||
implement, but is also useful for certain user-interface
|
||||
designs. (It can be useful, for example, to put a checkbutton
|
||||
in that slot.)
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="75%" target="1.4">
|
||||
<title>Replace GtkText Widget</title>
|
||||
<description>
|
||||
<p>
|
||||
The GtkText widget is badly in need of replacement, since it
|
||||
is buggy and insufficiently feature rich. This is being done
|
||||
using Havoc Pennington's port of the Tk Text widget.
|
||||
</p>
|
||||
<p>
|
||||
As part of this job <a href="http://www.pango.org">Pango</a>
|
||||
support is being added to the replacement. The structure of
|
||||
the Tk text widget port is suited to this as it works
|
||||
paragraph-by-paragraph, and Pango works at a sub-paragraph
|
||||
scale. The main remaining tasks here are to implement
|
||||
incremental reflow to make performance acceptable and to
|
||||
implement embedded pixmaps and widgets.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="0%" target="1.4">
|
||||
<title>Improve Radio/Checkbutton Look</title>
|
||||
<description>
|
||||
<p>
|
||||
The default look for the radio and checkbuttons is both
|
||||
unattractive and not friendly to the user . Motif did not
|
||||
get this one right, and we should not keep on following the
|
||||
Motif look. The right thing here is probably to copy the
|
||||
Windows appearance for these controls fairly closely. This
|
||||
will fit in with well with the rest of the GTK+ look.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="0%" target="1.4">
|
||||
<title>Improve Submenu Navigation</title>
|
||||
<description>
|
||||
<p>
|
||||
Navigating through a deep menu tree in GTK+ is currently
|
||||
quite tricky, because as soon as one leaves a menu item,
|
||||
the submenu disappears. The way that the Macintosh is
|
||||
reputed to handle this is that to pop down the current
|
||||
submenu, you have to leave the triangle defined by the
|
||||
upper left hand corner of the menu item and right
|
||||
side of the submenu.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="0%" target="1.4 ?">
|
||||
<title>Improve Spinbutton Look</title>
|
||||
<description>
|
||||
<p>
|
||||
Spinbuttons currently appear to have lumpy boundaries,
|
||||
because sides of the arrows aren't at an angle that
|
||||
meshes well with the pixel grid. However, fixing this
|
||||
would require making the spinbuttons narrower and
|
||||
harder to hit. This points out a general problem with
|
||||
the spinbutton (and the arrows on the scrollbars) - the
|
||||
target area for clicks actually the bounding box of the
|
||||
arrows, but the user thinks that they must click on the
|
||||
arrows themselves. It would probably be more friendly
|
||||
to use a square button with an arrow drawn on top instead
|
||||
of a arrow-shaped button, the approach taken by most other
|
||||
windowing systems.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="90%" target="1.4">
|
||||
<title>Supply horizontable/vertical wrapping boxes</title>
|
||||
<description>
|
||||
<p>
|
||||
An often requested feature are wrapping containers, at this
|
||||
point, gimp's development version already uses such widgets:
|
||||
horizontable/vertical wrap boxes, that need to go into 1.4
|
||||
proper at some point.
|
||||
</p>
|
||||
</description>
|
||||
<contact>Tim Janik <timj@gtk.org></contact>
|
||||
</entry>
|
||||
|
||||
<entry size="medium" status="90%" target="1.4">
|
||||
<title>Improved generic combo support</title>
|
||||
<description>
|
||||
<p>
|
||||
Gtk+'s combo box has several drawbacks in design and
|
||||
implementation. An new attempt at providing the combo box
|
||||
functionality with improved flexibility has been made with
|
||||
the GtkClueHunter widget, sitting in the CVS module "gle".
|
||||
</p>
|
||||
</description>
|
||||
<contact>Tim Janik <timj@gtk.org></contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="0%" target="> 1.4">
|
||||
<title>Add unified set of List/Tree/Grid widgets</title>
|
||||
<description>
|
||||
<p>
|
||||
Currently, GTK+ has a large number of list and tree widgets
|
||||
(GtkList, GtkTree, GtkCList, GtkCTree), none of which are
|
||||
ideal. The GtkList and GtkTree widgets perform badly on large
|
||||
number of items. (GtkTree widget is also quite buggy.) GtkCList
|
||||
and GtkCTree mostly solve the size problem, but are quite
|
||||
complex and, despite that, not very flexible. They are limited to
|
||||
displaying pixmaps and text, and can neither support arbitrary
|
||||
widgets nor custom drawing functions.
|
||||
</p>
|
||||
<p>
|
||||
In addition to list and tree widgets, a closely related need
|
||||
is a sheet widget that displays a (possibly editable) 2-D grid.
|
||||
It would be desirable to have a complete set of widgets that
|
||||
could be presented as the one-true-solution for these needs.
|
||||
Model/View techniques could be used effectively to increase
|
||||
both the simplicity and power of the interfaces.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="0%" target="1.4">
|
||||
<title>GtkPixbuf</title>
|
||||
<description>
|
||||
<p>
|
||||
gdk-pixbuf is moving to become a GTK+ dependency, a new image-display
|
||||
widget is thus needed.
|
||||
</p>
|
||||
</description>
|
||||
<contact>hp@redhat.com</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="0%" target="1.4">
|
||||
<title>Attempt to fix GtkStatusbar</title>
|
||||
<description>
|
||||
<p>
|
||||
GtkStatusbar is too inconvenient to use.
|
||||
The only non-breakage-inducing fix we could
|
||||
come up with is to permit 0 as a context ID, so you
|
||||
don't have to use gtk_statusbar_get_context_id().
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="95%" target="1.4">
|
||||
<title>Decruft GtkProgress, GtkProgressbar</title>
|
||||
<description>
|
||||
<p>UPDATE: this is done, just need to apply the patch.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This interface is just a disaster of overcomplexity;
|
||||
it should pretty much just be set_percentage(),
|
||||
pulse() (to move during activity mode), and set_text().
|
||||
There's no reason that there are two objects, should
|
||||
just be one interface. Almost all the functions
|
||||
that currently exist should be deprecated.
|
||||
</p>
|
||||
</description>
|
||||
<contact>hp@redhat.com</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="0%" target="1.4">
|
||||
<title>Entry validation hooks</title>
|
||||
<description>
|
||||
<p>
|
||||
Simple hooks for validation in a GtkEntry. Pretty much just a
|
||||
"validate" callback which takes a string (current entry contents) and
|
||||
returns either VALID, INVALID, or COULDBEVALID. Then the
|
||||
GtkEntry calls this function if it's set, and does the appropriate
|
||||
UI things. GTK should come with validators for int and float,
|
||||
see GtkSpinButton where these are already implemented.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="0%" target="> 1.4">
|
||||
<title>pseudo-MDI Widget</title>
|
||||
<description>
|
||||
<p>
|
||||
Add a widget that lets you rearrange various views (similar to many
|
||||
IDEs, like Visual SlickEdit or JBuilder). Basically there should be a
|
||||
central slot and 4 slots around the sides; each slot holds one or more
|
||||
views. If two views are dropped in the same slot, then a notebook is
|
||||
created displaying both views. If a view is dropped outside the
|
||||
application window, it becomes a standalone window. It should be
|
||||
possible to restrict whether a view can be dropped on the sides,
|
||||
horizontal/vertical sides only, in the central content area, or in
|
||||
any of those places.
|
||||
</p>
|
||||
<p>
|
||||
(Havoc has a proposed interface for this, mail hp@redhat.com)
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="medium" status="0%" target="> 1.4">
|
||||
<title>Icon List Widget</title>
|
||||
<description>
|
||||
<p>
|
||||
A simple icon list widget, suitable for creating a file selector or
|
||||
the like.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="medium" status="0%" target="> 1.4">
|
||||
<title>Dock widget</title>
|
||||
<description>
|
||||
<p>
|
||||
Add a widget like GnomeDock (perhaps based on GnomeDock)
|
||||
that allows people to put rearrangeable toolbars, menubars, etc.
|
||||
around a central content area. The widget should have hooks for
|
||||
saving the current positions of the various docked bars.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="0%" target="> 1.4">
|
||||
<title>Canvas widget</title>
|
||||
<description>
|
||||
<p>
|
||||
Figure out how to get GnomeCanvas or a derived work into GTK+ itself.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="medium" status="0%" target="1.4">
|
||||
<title>Menu scroll</title>
|
||||
<description>
|
||||
<p>
|
||||
When menus are bigger than the screen, allow scrolling
|
||||
as on the Mac.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="medium" status="0%" target="1.4">
|
||||
<title>Toolbar/menubar wrap</title>
|
||||
<description>
|
||||
<p>
|
||||
When toolbars and menubars are too wide, do some sort of
|
||||
wrapping or drop-down deal. (See Windows/Mac apps for examples.)
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="0%" target="1.4">
|
||||
<title>Blink cursor in GtkEntry</title>
|
||||
<description>
|
||||
<p>
|
||||
Make the cursor optionally blink in GtkEntry. Beware, the entry code
|
||||
is somewhat in flux; mail Owen and ask.
|
||||
</p>
|
||||
</description>
|
||||
<contact>otaylor@redhat.com</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="100%" target="1.4">
|
||||
<title>Don't highlight first menu item when menus come up</title>
|
||||
<description>
|
||||
<p>
|
||||
Keep GtkMenu from prelighting the first menu item.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="95%" target="1.4">
|
||||
<title>Integrate new color selector</title>
|
||||
<description>
|
||||
<p>
|
||||
There's a new color selector in CVS (module gnome-colorsel),
|
||||
it needs to be folded in to GTK and any remaining issues resolved.
|
||||
(This new selector is API-compatible with the old one, and
|
||||
still called GtkColorSelector).
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="medium" status="0%" target="1.4">
|
||||
<title>Write new font selector</title>
|
||||
<description>
|
||||
<p>
|
||||
Pango introduces a new font handling system,
|
||||
replacing the XLFD system. Need a font selector for this.
|
||||
The XLFD selector should probably remain, for apps where
|
||||
it makes sense (like gnome-terminal probably).
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="0%" target="1.4">
|
||||
<title>Stack Widget</title>
|
||||
<description>
|
||||
<p>
|
||||
Jonathan has a widget like a tabless/frameless notebook, used for
|
||||
something like the GNOME control center where you want to toggle which
|
||||
widget is visible to the user. Needs to be cleaned up and considered
|
||||
for GTK.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org, jrb@redhat.com</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="0%" target="1.4">
|
||||
<title>Clean up GtkNotebook</title>
|
||||
<description>
|
||||
<p>
|
||||
GtkNotebook currently breaks GTK invariants about
|
||||
mapping/visibility/etc., needs fixing.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
</entry>
|
||||
|
||||
</section> <!-- GTK+ -->
|
||||
</todo>
|
||||
|
||||
+12
-5
@@ -34,7 +34,7 @@ LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
|
||||
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
|
||||
DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
|
||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|
||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
|
||||
# Reload cache, that may have been modified by ltconfig
|
||||
@@ -66,6 +66,11 @@ AC_REQUIRE([AC_PROG_NM])dnl
|
||||
AC_REQUIRE([AC_PROG_LN_S])dnl
|
||||
dnl
|
||||
|
||||
case "$target" in
|
||||
NONE) lt_target="$host" ;;
|
||||
*) lt_target="$target" ;;
|
||||
esac
|
||||
|
||||
# Check for any special flags to pass to ltconfig.
|
||||
libtool_flags="--cache-file=$cache_file"
|
||||
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
|
||||
@@ -84,7 +89,7 @@ test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
|
||||
|
||||
# Some flags need to be propagated to the compiler or linker for good
|
||||
# libtool support.
|
||||
case "$host" in
|
||||
case "$lt_target" in
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
|
||||
@@ -300,7 +305,6 @@ else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_SUBST(LD)
|
||||
AC_PROG_LD_GNU
|
||||
])
|
||||
|
||||
@@ -346,14 +350,13 @@ else
|
||||
fi])
|
||||
NM="$ac_cv_path_NM"
|
||||
AC_MSG_RESULT([$NM])
|
||||
AC_SUBST(NM)
|
||||
])
|
||||
|
||||
# AC_CHECK_LIBM - check for math library
|
||||
AC_DEFUN(AC_CHECK_LIBM,
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
LIBM=
|
||||
case "$host" in
|
||||
case "$lt_target" in
|
||||
*-*-beos* | *-*-cygwin*)
|
||||
# These system don't have libm
|
||||
;;
|
||||
@@ -487,6 +490,10 @@ AC_DEFUN(AM_GTK_WITH_NLS,
|
||||
gt_cv_func_dgettext_libintl=no)])
|
||||
fi
|
||||
|
||||
if test "$gt_cv_func_dgettext_libintl" = "yes"; then
|
||||
LIBS="$LIBS -lintl";
|
||||
fi
|
||||
|
||||
if test "$gt_cv_func_dgettext_libc" = "yes" \
|
||||
|| test "$gt_cv_func_dgettext_libintl" = "yes"; then
|
||||
AC_DEFINE(HAVE_GETTEXT)
|
||||
|
||||
Vendored
+64
-30
@@ -24,7 +24,7 @@
|
||||
|
||||
# Written by Per Bothner <bothner@cygnus.com>.
|
||||
# The master version of this file is at the FSF in /home/gd/gnu/lib.
|
||||
# Please send patches to the Autoconf mailing list <autoconf@gnu.org>.
|
||||
# Please send patches to <autoconf-patches@gnu.org>.
|
||||
#
|
||||
# This script attempts to guess a canonical system name similar to
|
||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||
@@ -156,6 +156,9 @@ EOF
|
||||
wgrisc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:OS/390:*:*)
|
||||
echo i370-ibm-openedition
|
||||
exit 0 ;;
|
||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||
exit 0;;
|
||||
@@ -328,15 +331,18 @@ EOF
|
||||
AViiON:dgux:*:*)
|
||||
# DG/UX returns AViiON for all architectures
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
|
||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
|
||||
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
|
||||
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110]
|
||||
then
|
||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
|
||||
[ ${TARGET_BINARY_INTERFACE}x = x ]
|
||||
then
|
||||
echo m88k-dg-dgux${UNAME_RELEASE}
|
||||
else
|
||||
else
|
||||
echo m88k-dg-dguxbcs${UNAME_RELEASE}
|
||||
fi
|
||||
else
|
||||
echo i586-dg-dgux${UNAME_RELEASE}
|
||||
fi
|
||||
else echo i586-dg-dgux${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
||||
echo m88k-dolphin-sysv3
|
||||
@@ -453,7 +459,7 @@ EOF
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
($CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
|
||||
(CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
|
||||
rm -f $dummy.c $dummy
|
||||
esac
|
||||
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
|
||||
@@ -550,7 +556,7 @@ EOF
|
||||
echo t90-cray-unicos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
CRAY*T3E:*:*:*)
|
||||
echo t3e-cray-unicosmk${UNAME_RELEASE}
|
||||
echo alpha-cray-unicosmk${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
CRAY-2:*:*:*)
|
||||
echo cray2-cray-unicos
|
||||
@@ -588,7 +594,7 @@ EOF
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
exit 0 ;;
|
||||
*:NetBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
|
||||
exit 0 ;;
|
||||
*:OpenBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
@@ -618,12 +624,6 @@ EOF
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
exit 0 ;;
|
||||
*:Linux:*:*)
|
||||
# uname on the ARM produces all sorts of strangeness, and we need to
|
||||
# filter it out.
|
||||
case "$UNAME_MACHINE" in
|
||||
armv*) UNAME_MACHINE=$UNAME_MACHINE ;;
|
||||
arm* | sa110*) UNAME_MACHINE="arm" ;;
|
||||
esac
|
||||
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
# first see if it will tell us. cd to the root directory to prevent
|
||||
@@ -636,11 +636,38 @@ EOF
|
||||
s/ .*//
|
||||
p'`
|
||||
case "$ld_supported_emulations" in
|
||||
i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
|
||||
i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
|
||||
sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
|
||||
armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
|
||||
m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
|
||||
*ia64)
|
||||
echo "${UNAME_MACHINE}-unknown-linux"
|
||||
exit 0
|
||||
;;
|
||||
i?86linux)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
|
||||
exit 0
|
||||
;;
|
||||
i?86coff)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
|
||||
exit 0
|
||||
;;
|
||||
sparclinux)
|
||||
echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
|
||||
exit 0
|
||||
;;
|
||||
armlinux)
|
||||
echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
|
||||
exit 0
|
||||
;;
|
||||
elf32arm*)
|
||||
echo "${UNAME_MACHINE}-unknown-linux-gnu"
|
||||
exit 0
|
||||
;;
|
||||
armelf_linux*)
|
||||
echo "${UNAME_MACHINE}-unknown-linux-gnu"
|
||||
exit 0
|
||||
;;
|
||||
m68klinux)
|
||||
echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
|
||||
exit 0
|
||||
;;
|
||||
elf32ppc)
|
||||
# Determine Lib Version
|
||||
cat >$dummy.c <<EOF
|
||||
@@ -670,7 +697,9 @@ EOF
|
||||
fi
|
||||
fi
|
||||
rm -f $dummy.c $dummy
|
||||
echo powerpc-unknown-linux-gnu${LIBC} ; exit 0 ;;
|
||||
echo powerpc-unknown-linux-gnu${LIBC}
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "${UNAME_MACHINE}" = "alpha" ; then
|
||||
@@ -797,19 +826,21 @@ EOF
|
||||
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
|
||||
exit 0 ;;
|
||||
i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
|
||||
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
|
||||
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
|
||||
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
|
||||
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
|
||||
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
|
||||
fi
|
||||
exit 0 ;;
|
||||
i?86:*:5:7*)
|
||||
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
|
||||
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
|
||||
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) && UNAME_MACHINE=i586
|
||||
(/bin/uname -X|egrep '^Machine.*Pent.*II' >/dev/null) && UNAME_MACHINE=i686
|
||||
(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) && UNAME_MACHINE=i585
|
||||
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE}
|
||||
# Fixed at (any) Pentium or better
|
||||
UNAME_MACHINE=i586
|
||||
if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
|
||||
echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
i?86:*:3.2:*)
|
||||
if test -f /usr/options/cb.name; then
|
||||
@@ -943,6 +974,9 @@ EOF
|
||||
*:Rhapsody:*:*)
|
||||
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:QNX:*:4*)
|
||||
echo i386-qnx-qnx${UNAME_VERSION}
|
||||
exit 0 ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
|
||||
Vendored
+31
-14
@@ -105,7 +105,7 @@ case $os in
|
||||
-scout)
|
||||
;;
|
||||
-wrs)
|
||||
os=vxworks
|
||||
os=-vxworks
|
||||
basic_machine=$1
|
||||
;;
|
||||
-hiux*)
|
||||
@@ -156,13 +156,17 @@ case $os in
|
||||
-psos*)
|
||||
os=-psos
|
||||
;;
|
||||
-mint | -mint[0-9]*)
|
||||
basic_machine=m68k-atari
|
||||
os=-mint
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode aliases for certain CPU-COMPANY combinations.
|
||||
case $basic_machine in
|
||||
# Recognize the basic CPU types without company name.
|
||||
# Some are omitted here because they have special meanings below.
|
||||
tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
|
||||
tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
|
||||
| arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
|
||||
| 580 | i960 | h8300 \
|
||||
| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
|
||||
@@ -171,12 +175,12 @@ case $basic_machine in
|
||||
| 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \
|
||||
| mips64orion | mips64orionel | mipstx39 | mipstx39el \
|
||||
| mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
|
||||
| mips64vr5000 | miprs64vr5000el \
|
||||
| mips64vr5000 | miprs64vr5000el | mcore \
|
||||
| sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
|
||||
| thumb | d10v)
|
||||
| thumb | d10v | fr30)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65)
|
||||
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl)
|
||||
;;
|
||||
|
||||
# We use `pc' rather than `unknown'
|
||||
@@ -191,7 +195,8 @@ case $basic_machine in
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
|
||||
# FIXME: clean up the formatting here.
|
||||
vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
|
||||
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
|
||||
| power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
|
||||
@@ -204,10 +209,10 @@ case $basic_machine in
|
||||
| sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-* \
|
||||
| mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| mipstx39-* | mipstx39el-* | mcore-* \
|
||||
| f301-* | armv*-* | t3e-* \
|
||||
| m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
|
||||
| thumb-* | v850-* | d30v-* | tic30-* | c30-* )
|
||||
| thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* )
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
@@ -425,7 +430,6 @@ case $basic_machine in
|
||||
;;
|
||||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i[34567]86v32)
|
||||
@@ -460,6 +464,9 @@ case $basic_machine in
|
||||
basic_machine=i386-unknown
|
||||
os=-mingw32
|
||||
;;
|
||||
i386-qnx | qnx)
|
||||
basic_machine=i386-qnx
|
||||
;;
|
||||
iris | iris4d)
|
||||
basic_machine=mips-sgi
|
||||
case $os in
|
||||
@@ -488,7 +495,7 @@ case $basic_machine in
|
||||
miniframe)
|
||||
basic_machine=m68000-convergent
|
||||
;;
|
||||
*mint | *MiNT)
|
||||
*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
|
||||
basic_machine=m68k-atari
|
||||
os=-mint
|
||||
;;
|
||||
@@ -514,6 +521,10 @@ case $basic_machine in
|
||||
basic_machine=i386-unknown
|
||||
os=-msdos
|
||||
;;
|
||||
mvs)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
@@ -523,7 +534,7 @@ case $basic_machine in
|
||||
os=-netbsd
|
||||
;;
|
||||
netwinder)
|
||||
basic_machine=armv4l-corel
|
||||
basic_machine=armv4l-rebel
|
||||
os=-linux
|
||||
;;
|
||||
news | news700 | news800 | news900)
|
||||
@@ -907,7 +918,7 @@ case $os in
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -rhapsody* | -openstep* | -oskit*)
|
||||
| -interix* | -uwin* | -rhapsody* | -opened* | -openstep* | -oskit*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
|
||||
@@ -926,6 +937,9 @@ case $os in
|
||||
-sunos6*)
|
||||
os=`echo $os | sed -e 's|sunos6|solaris3|'`
|
||||
;;
|
||||
-opened*)
|
||||
os=-openedition
|
||||
;;
|
||||
-osfrose*)
|
||||
os=-osfrose
|
||||
;;
|
||||
@@ -963,6 +977,9 @@ case $os in
|
||||
-oss*)
|
||||
os=-sysv3
|
||||
;;
|
||||
-qnx)
|
||||
os=-qnx4
|
||||
;;
|
||||
-svr4)
|
||||
os=-sysv4
|
||||
;;
|
||||
@@ -1012,7 +1029,7 @@ case $basic_machine in
|
||||
*-acorn)
|
||||
os=-riscix1.2
|
||||
;;
|
||||
arm*-corel)
|
||||
arm*-rebel)
|
||||
os=-linux
|
||||
;;
|
||||
arm*-semi)
|
||||
@@ -1186,7 +1203,7 @@ case $basic_machine in
|
||||
-genix*)
|
||||
vendor=ns
|
||||
;;
|
||||
-mvs*)
|
||||
-mvs* | -opened*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
|
||||
+8
-6
@@ -171,17 +171,19 @@ AC_MSG_CHECKING(whether make is GNU Make)
|
||||
STRIP_BEGIN=
|
||||
STRIP_END=
|
||||
if $ac_make --version 2>/dev/null | grep '^GNU Make ' >/dev/null ; then
|
||||
STRIP_BEGIN='$(strip'
|
||||
STRIP_BEGIN='$(strip $(STRIP_DUMMY)'
|
||||
STRIP_END=')'
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
STRIP_DUMMY=
|
||||
AC_SUBST(STRIP_DUMMY)
|
||||
AC_SUBST(STRIP_BEGIN)
|
||||
AC_SUBST(STRIP_END)
|
||||
|
||||
# i18n stuff
|
||||
ALL_LINGUAS="ca cs da de el es et eu fi fr ga gl hr hu it ja ko lt nl no pl pt pt_BR ru sk sl sv tr uk wa zh_TW.Big5 zh_CN.GB2312"
|
||||
ALL_LINGUAS="ca cs da de el es et eu fi fr ga gl hr hu it ja ko lt nl no pl pt pt_BR ro ru sk sl sv tr uk wa zh_TW.Big5 zh_CN.GB2312"
|
||||
AM_GTK_GNU_GETTEXT
|
||||
LIBS="$LIBS $INTLLIBS"
|
||||
|
||||
@@ -250,16 +252,16 @@ fi
|
||||
if test x$with_glib = x ; then
|
||||
# Look for separately installed glib
|
||||
|
||||
AM_PATH_GLIB(1.3.0,,
|
||||
AM_PATH_GLIB(1.3.1,,
|
||||
AC_MSG_ERROR([
|
||||
*** GLIB 1.3.0 or better is required. The latest version of GLIB
|
||||
*** is always available from ftp://ftp.gtk.org/.]),
|
||||
gmodule gthread)
|
||||
gobject gmodule gthread)
|
||||
|
||||
# we do not want to make all gtk progs to link to thread libraries.
|
||||
glib_cflags=`$GLIB_CONFIG glib gmodule --cflags`
|
||||
glib_cflags=`$GLIB_CONFIG glib gobject gmodule --cflags`
|
||||
glib_thread_cflags="$GLIB_CFLAGS"
|
||||
glib_libs=`$GLIB_CONFIG glib gmodule --libs`
|
||||
glib_libs=`$GLIB_CONFIG glib gobject gmodule --libs`
|
||||
glib_thread_libs="$GLIB_LIBS"
|
||||
GLIB_LIBS="$glib_libs"
|
||||
GLIB_DEPLIBS="$glib_libs"
|
||||
|
||||
+39
-26
@@ -19,12 +19,12 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
#include "gdk-pixbuf-loader.h"
|
||||
|
||||
typedef struct {
|
||||
@@ -201,22 +201,17 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
|
||||
|
||||
pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
|
||||
|
||||
if (!pixbuf->art_pixbuf) {
|
||||
g_warning ("art_pixbuf is NULL in expose_func!!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (pixbuf->art_pixbuf->has_alpha) {
|
||||
if (gdk_pixbuf_get_has_alpha (pixbuf)) {
|
||||
gdk_draw_rgb_32_image (drawing_area->window,
|
||||
drawing_area->style->black_gc,
|
||||
event->area.x, event->area.y,
|
||||
event->area.width,
|
||||
event->area.height,
|
||||
GDK_RGB_DITHER_MAX,
|
||||
pixbuf->art_pixbuf->pixels
|
||||
+ (event->area.y * pixbuf->art_pixbuf->rowstride)
|
||||
+ (event->area.x * pixbuf->art_pixbuf->n_channels),
|
||||
pixbuf->art_pixbuf->rowstride);
|
||||
gdk_pixbuf_get_pixels (pixbuf)
|
||||
+ (event->area.y * gdk_pixbuf_get_rowstride (pixbuf))
|
||||
+ (event->area.x * gdk_pixbuf_get_n_channels (pixbuf)),
|
||||
gdk_pixbuf_get_rowstride (pixbuf));
|
||||
} else {
|
||||
gdk_draw_rgb_image (drawing_area->window,
|
||||
drawing_area->style->white_gc,
|
||||
@@ -224,10 +219,10 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
|
||||
event->area.width,
|
||||
event->area.height,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
pixbuf->art_pixbuf->pixels
|
||||
+ (event->area.y * pixbuf->art_pixbuf->rowstride)
|
||||
+ (event->area.x * pixbuf->art_pixbuf->n_channels),
|
||||
pixbuf->art_pixbuf->rowstride);
|
||||
gdk_pixbuf_get_pixels (pixbuf)
|
||||
+ (event->area.y * gdk_pixbuf_get_rowstride (pixbuf))
|
||||
+ (event->area.x * gdk_pixbuf_get_n_channels (pixbuf)),
|
||||
gdk_pixbuf_get_rowstride (pixbuf));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,11 +233,9 @@ config_func (GtkWidget *drawing_area, GdkEventConfigure *event, gpointer data)
|
||||
|
||||
pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
|
||||
|
||||
g_print("X:%d Y:%d\n", event->width, event->height);
|
||||
|
||||
#if 0
|
||||
if (((event->width) != (pixbuf->art_pixbuf->width)) ||
|
||||
((event->height) != (pixbuf->art_pixbuf->height)))
|
||||
if (((event->width) != gdk_pixbuf_get_width (pixbuf)) ||
|
||||
((event->height) != gdk_pixbuf_get_height (pixbuf)))
|
||||
gdk_pixbuf_scale(pixbuf, event->width, event->height);
|
||||
#endif
|
||||
}
|
||||
@@ -257,8 +250,8 @@ new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
|
||||
GtkWidget *drawing_area;
|
||||
gint w, h;
|
||||
|
||||
w = pixbuf->art_pixbuf->width;
|
||||
h = pixbuf->art_pixbuf->height;
|
||||
w = gdk_pixbuf_get_width (pixbuf);
|
||||
h = gdk_pixbuf_get_height (pixbuf);
|
||||
|
||||
window = gtk_widget_new (gtk_window_get_type (),
|
||||
"GtkObject::user_data", NULL,
|
||||
@@ -308,6 +301,7 @@ new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
|
||||
return window;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
static gint
|
||||
update_timeout(gpointer data)
|
||||
@@ -369,6 +363,8 @@ progressive_updated_callback(GdkPixbufLoader* loader, guint x, guint y, guint wi
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int readlen = 4096;
|
||||
|
||||
int
|
||||
@@ -378,7 +374,6 @@ main (int argc, char **argv)
|
||||
int found_valid = FALSE;
|
||||
|
||||
GdkPixbufAnimation *animation;
|
||||
GdkPixbufLoader *pixbuf_loader;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
@@ -411,14 +406,31 @@ main (int argc, char **argv)
|
||||
return 0;
|
||||
} else {
|
||||
for (i = 1; i < argc; i++) {
|
||||
|
||||
animation = gdk_pixbuf_animation_new_from_file (argv[i]);
|
||||
|
||||
if (animation) {
|
||||
gint i = 0;
|
||||
GList *listptr;
|
||||
for (listptr = animation->frames; listptr; listptr = listptr->next){
|
||||
g_print ("in a frame\n");
|
||||
new_testrgb_window (((GdkPixbufFrame *)listptr->data)->pixbuf, "File");
|
||||
for (listptr = gdk_pixbuf_animation_get_frames (animation);
|
||||
listptr;
|
||||
listptr = listptr->next) {
|
||||
GdkPixbufFrame *frame;
|
||||
GdkPixbuf *pixbuf;
|
||||
gchar *title;
|
||||
|
||||
frame = listptr->data;
|
||||
pixbuf = gdk_pixbuf_frame_get_pixbuf (frame);
|
||||
|
||||
title = g_strdup_printf ("Frame %d", i);
|
||||
g_print ("Frame %d x:%d y:%d width:%d height:%d\n",
|
||||
i,
|
||||
gdk_pixbuf_frame_get_x_offset (frame),
|
||||
gdk_pixbuf_frame_get_y_offset (frame),
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf));
|
||||
new_testrgb_window (pixbuf, title);
|
||||
g_free (title);
|
||||
i++;
|
||||
}
|
||||
found_valid = TRUE;
|
||||
}
|
||||
@@ -427,6 +439,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
GtkWidget* rgb_window = NULL;
|
||||
ProgressFileStatus status;
|
||||
GdkPixbufLoader *pixbuf_loader;
|
||||
|
||||
pixbuf_loader = gdk_pixbuf_loader_new ();
|
||||
status.loader = pixbuf_loader;
|
||||
|
||||
+12
-12
@@ -15,7 +15,7 @@ int expose_cb(GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
|
||||
|
||||
pixbuf = (GdkPixbuf *) gtk_object_get_data(GTK_OBJECT(drawing_area),
|
||||
"pixbuf");
|
||||
if(pixbuf->art_pixbuf->has_alpha)
|
||||
if(gdk_pixbuf_get_has_alpha (pixbuf))
|
||||
{
|
||||
gdk_draw_rgb_32_image(drawing_area->window,
|
||||
drawing_area->style->black_gc,
|
||||
@@ -23,10 +23,10 @@ int expose_cb(GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
|
||||
evt->area.width,
|
||||
evt->area.height,
|
||||
GDK_RGB_DITHER_MAX,
|
||||
pixbuf->art_pixbuf->pixels +
|
||||
(evt->area.y * pixbuf->art_pixbuf->rowstride) +
|
||||
(evt->area.x * pixbuf->art_pixbuf->n_channels),
|
||||
pixbuf->art_pixbuf->rowstride);
|
||||
gdk_pixbuf_get_pixels (pixbuf) +
|
||||
(evt->area.y * gdk_pixbuf_get_rowstride (pixbuf)) +
|
||||
(evt->area.x * gdk_pixbuf_get_n_channels (pixbuf)),
|
||||
gdk_pixbuf_get_rowstride (pixbuf));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -36,10 +36,10 @@ int expose_cb(GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
|
||||
evt->area.width,
|
||||
evt->area.height,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
pixbuf->art_pixbuf->pixels +
|
||||
(evt->area.y * pixbuf->art_pixbuf->rowstride) +
|
||||
(evt->area.x * pixbuf->art_pixbuf->n_channels),
|
||||
pixbuf->art_pixbuf->rowstride);
|
||||
gdk_pixbuf_get_pixels (pixbuf) +
|
||||
(evt->area.y * gdk_pixbuf_get_rowstride (pixbuf)) +
|
||||
(evt->area.x * gdk_pixbuf_get_n_channels (pixbuf)),
|
||||
gdk_pixbuf_get_rowstride (pixbuf));
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ int configure_cb(GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
|
||||
"pixbuf");
|
||||
|
||||
g_print("X:%d Y:%d\n", evt->width, evt->height);
|
||||
if(evt->width != pixbuf->art_pixbuf->width || evt->height != pixbuf->art_pixbuf->height)
|
||||
if(evt->width != gdk_pixbuf_get_width (pixbuf) || evt->height != gdk_pixbuf_get_height (pixbuf))
|
||||
{
|
||||
GdkWindow *root;
|
||||
GdkPixbuf *new_pixbuf;
|
||||
@@ -97,8 +97,8 @@ int main(int argc, char **argv)
|
||||
|
||||
drawing_area = gtk_drawing_area_new();
|
||||
gtk_drawing_area_size(GTK_DRAWING_AREA(drawing_area),
|
||||
pixbuf->art_pixbuf->width,
|
||||
pixbuf->art_pixbuf->height);
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf));
|
||||
gtk_signal_connect(GTK_OBJECT(drawing_area), "expose_event",
|
||||
GTK_SIGNAL_FUNC(expose_cb), NULL);
|
||||
|
||||
|
||||
+17
-17
@@ -3,15 +3,15 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
ArtFilterLevel filter_level = ART_FILTER_BILINEAR;
|
||||
GdkInterpType interp_type = GDK_INTERP_BILINEAR;
|
||||
int overall_alpha = 255;
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkWidget *darea;
|
||||
|
||||
void
|
||||
set_filter_level (GtkWidget *widget, gpointer data)
|
||||
set_interp_type (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
filter_level = GPOINTER_TO_UINT (data);
|
||||
interp_type = GPOINTER_TO_UINT (data);
|
||||
gtk_widget_queue_draw (darea);
|
||||
}
|
||||
|
||||
@@ -32,14 +32,14 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
|
||||
gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
|
||||
|
||||
dest = gdk_pixbuf_new (ART_PIX_RGB, FALSE, 8, event->area.width, event->area.height);
|
||||
dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, event->area.width, event->area.height);
|
||||
|
||||
gdk_pixbuf_composite_color (pixbuf, dest,
|
||||
0, 0, event->area.width, event->area.height,
|
||||
-event->area.x, -event->area.y,
|
||||
(double) widget->allocation.width / pixbuf->art_pixbuf->width,
|
||||
(double) widget->allocation.height / pixbuf->art_pixbuf->height,
|
||||
filter_level, overall_alpha,
|
||||
(double) widget->allocation.width / gdk_pixbuf_get_width (pixbuf),
|
||||
(double) widget->allocation.height / gdk_pixbuf_get_height (pixbuf),
|
||||
interp_type, overall_alpha,
|
||||
event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555);
|
||||
|
||||
gdk_pixbuf_render_to_drawable (dest, widget->window, widget->style->fg_gc[GTK_STATE_NORMAL],
|
||||
@@ -87,28 +87,28 @@ main(int argc, char **argv)
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("NEAREST");
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
GTK_SIGNAL_FUNC (set_filter_level),
|
||||
GUINT_TO_POINTER (ART_FILTER_NEAREST));
|
||||
GTK_SIGNAL_FUNC (set_interp_type),
|
||||
GUINT_TO_POINTER (GDK_INTERP_NEAREST));
|
||||
gtk_widget_show (menuitem);
|
||||
gtk_container_add (GTK_CONTAINER (menu), menuitem);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("BILINEAR");
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
GTK_SIGNAL_FUNC (set_filter_level),
|
||||
GUINT_TO_POINTER (ART_FILTER_BILINEAR));
|
||||
GTK_SIGNAL_FUNC (set_interp_type),
|
||||
GUINT_TO_POINTER (GDK_INTERP_BILINEAR));
|
||||
gtk_widget_show (menuitem);
|
||||
gtk_container_add (GTK_CONTAINER (menu), menuitem);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("TILES");
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
GTK_SIGNAL_FUNC (set_filter_level),
|
||||
GUINT_TO_POINTER (ART_FILTER_TILES));
|
||||
GTK_SIGNAL_FUNC (set_interp_type),
|
||||
GUINT_TO_POINTER (GDK_INTERP_TILES));
|
||||
gtk_container_add (GTK_CONTAINER (menu), menuitem);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("HYPER");
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
GTK_SIGNAL_FUNC (set_filter_level),
|
||||
GUINT_TO_POINTER (ART_FILTER_HYPER));
|
||||
GTK_SIGNAL_FUNC (set_interp_type),
|
||||
GUINT_TO_POINTER (GDK_INTERP_HYPER));
|
||||
gtk_container_add (GTK_CONTAINER (menu), menuitem);
|
||||
|
||||
optionmenu = gtk_option_menu_new ();
|
||||
@@ -145,8 +145,8 @@ main(int argc, char **argv)
|
||||
GTK_SIGNAL_FUNC (expose_cb), NULL);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window),
|
||||
pixbuf->art_pixbuf->width,
|
||||
scratch_requisition.height + pixbuf->art_pixbuf->height);
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
scratch_requisition.height + gdk_pixbuf_get_height (pixbuf));
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
|
||||
+15
-22
@@ -1,4 +1,3 @@
|
||||
|
||||
/* testpixbuf -- test program for gdk-pixbuf code
|
||||
* Copyright (C) 1999 Mark Crichton, Larry Ewing
|
||||
*
|
||||
@@ -19,12 +18,12 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
#include "gdk-pixbuf-loader.h"
|
||||
|
||||
typedef struct {
|
||||
@@ -34,7 +33,6 @@ typedef struct {
|
||||
guchar *buf;
|
||||
guint timeout;
|
||||
guint readlen;
|
||||
|
||||
} ProgressFileStatus;
|
||||
|
||||
|
||||
@@ -321,22 +319,17 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
|
||||
|
||||
pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
|
||||
|
||||
if (!pixbuf->art_pixbuf) {
|
||||
g_warning ("art_pixbuf is NULL in expose_func!!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (pixbuf->art_pixbuf->has_alpha) {
|
||||
if (gdk_pixbuf_get_has_alpha (pixbuf)) {
|
||||
gdk_draw_rgb_32_image (drawing_area->window,
|
||||
drawing_area->style->black_gc,
|
||||
event->area.x, event->area.y,
|
||||
event->area.width,
|
||||
event->area.height,
|
||||
GDK_RGB_DITHER_MAX,
|
||||
pixbuf->art_pixbuf->pixels
|
||||
+ (event->area.y * pixbuf->art_pixbuf->rowstride)
|
||||
+ (event->area.x * pixbuf->art_pixbuf->n_channels),
|
||||
pixbuf->art_pixbuf->rowstride);
|
||||
gdk_pixbuf_get_pixels (pixbuf)
|
||||
+ (event->area.y * gdk_pixbuf_get_rowstride (pixbuf))
|
||||
+ (event->area.x * gdk_pixbuf_get_n_channels (pixbuf)),
|
||||
gdk_pixbuf_get_rowstride (pixbuf));
|
||||
} else {
|
||||
gdk_draw_rgb_image (drawing_area->window,
|
||||
drawing_area->style->white_gc,
|
||||
@@ -344,10 +337,10 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
|
||||
event->area.width,
|
||||
event->area.height,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
pixbuf->art_pixbuf->pixels
|
||||
+ (event->area.y * pixbuf->art_pixbuf->rowstride)
|
||||
+ (event->area.x * pixbuf->art_pixbuf->n_channels),
|
||||
pixbuf->art_pixbuf->rowstride);
|
||||
gdk_pixbuf_get_pixels (pixbuf)
|
||||
+ (event->area.y * gdk_pixbuf_get_rowstride (pixbuf))
|
||||
+ (event->area.x * gdk_pixbuf_get_n_channels (pixbuf)),
|
||||
gdk_pixbuf_get_rowstride (pixbuf));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,8 +354,8 @@ config_func (GtkWidget *drawing_area, GdkEventConfigure *event, gpointer data)
|
||||
g_print("X:%d Y:%d\n", event->width, event->height);
|
||||
|
||||
#if 0
|
||||
if (((event->width) != (pixbuf->art_pixbuf->width)) ||
|
||||
((event->height) != (pixbuf->art_pixbuf->height)))
|
||||
if (((event->width) != gdk_pixbuf_get_width (pixbuf)) ||
|
||||
((event->height) != gdk_pixbuf_get_height (pixbuf)))
|
||||
gdk_pixbuf_scale(pixbuf, event->width, event->height);
|
||||
#endif
|
||||
}
|
||||
@@ -377,8 +370,8 @@ new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
|
||||
GtkWidget *drawing_area;
|
||||
gint w, h;
|
||||
|
||||
w = pixbuf->art_pixbuf->width;
|
||||
h = pixbuf->art_pixbuf->height;
|
||||
w = gdk_pixbuf_get_width (pixbuf);
|
||||
h = gdk_pixbuf_get_height (pixbuf);
|
||||
|
||||
window = gtk_widget_new (gtk_window_get_type (),
|
||||
"GtkObject::user_data", NULL,
|
||||
@@ -529,7 +522,7 @@ main (int argc, char **argv)
|
||||
if (argc == 1) {
|
||||
const gchar*** xpmp;
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_data ((guchar *) default_image, ART_PIX_RGB, FALSE,
|
||||
pixbuf = gdk_pixbuf_new_from_data (default_image, GDK_COLORSPACE_RGB, FALSE, 8,
|
||||
DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_WIDTH * 3,
|
||||
NULL, NULL);
|
||||
new_testrgb_window (pixbuf, NULL);
|
||||
|
||||
+100
-3
@@ -1,11 +1,108 @@
|
||||
Incompatible Changes from GTK+-1.2 to GTK+-1.4:
|
||||
|
||||
- The gdk_time* functions have been removed. This functionality
|
||||
* The gdk_time* functions have been removed. This functionality
|
||||
has been unused since the main loop was moved into GLib
|
||||
prior to 1.2.
|
||||
|
||||
- The signature for GtkPrintFunc (used for gtk_item_factory_dump_items)
|
||||
* The signature for GtkPrintFunc (used for gtk_item_factory_dump_items)
|
||||
has been changed to take a 'const gchar *' instead of 'gchar *', to
|
||||
match what we do for glib, and other similar cases.
|
||||
|
||||
- The detail arguments in the GtkStyleClass structure are now 'const gchar *'.
|
||||
* The detail arguments in the GtkStyleClass structure are now 'const gchar *'.
|
||||
|
||||
* gtk_paned_set_gutter_size() has been removed, since the small handle tab
|
||||
has been changed to include the entire area previously occupied by
|
||||
the gutter.
|
||||
|
||||
* GDK no longer selects OwnerGrabButtonMask for button presses. This means
|
||||
that the automatic grab that occurs when the user presses a button
|
||||
will have owner_events = FALSE, so all events are redirected to the
|
||||
grab window, even events that would normally go to other windows of the
|
||||
window's owner.
|
||||
|
||||
* GtkColorSelectionDialog has now been moved into it's own set of files,
|
||||
gtkcolorseldialog.c and gtkcolorseldialog.h.
|
||||
|
||||
* gtk_widget_shape_combine_mask() now keeps a reference count on the
|
||||
mask pixmap that is passed in.
|
||||
|
||||
* Type system changes:
|
||||
- GTK_TYPE_OBJECT is not a fundamental type anymore. Type checks of the
|
||||
style (GTK_FUNDAMENTAL_TYPE (some_type) == GTK_TYPE_OBJECT)
|
||||
will not work anymore. As a replacement, (GTK_TYPE_IS_OBJECT (some_type))
|
||||
can be used now.
|
||||
- The following types vanished: GTK_TYPE_ARGS, GTK_TYPE_CALLBACK,
|
||||
GTK_TYPE_C_CALLBACK, GTK_TYPE_FOREIGN. The corresponding GtkArg
|
||||
fields and field access macros are also gone.
|
||||
- The following type aliases vanished: GTK_TYPE_FLAT_FIRST,
|
||||
GTK_TYPE_FLAT_LAST, GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST.
|
||||
- The type macros GTK_TYPE_MAKE() and GTK_TYPE_SEQNO() vanished, use of
|
||||
GTK_FUNDAMENTAL_TYPE() is discouraged. Instead, the corresponding GType
|
||||
API should be used: G_TYPE_FUNDAMENTAL(), G_TYPE_DERIVE_ID(),
|
||||
G_TYPE_BRANCH_SEQNO(). Note that the GLib type system doesn't build new
|
||||
type ids based on a global incremental sequential number anymore, but
|
||||
numbers new type ids sequentially per fundamental type branch.
|
||||
- The following type functions vanished/were replaced:
|
||||
Old Function Replacement
|
||||
gtk_type_query() - being investigated -
|
||||
gtk_type_set_varargs_type() -
|
||||
gtk_type_get_varargs_type() -
|
||||
gtk_type_check_object_cast() g_type_check_instance_cast()
|
||||
gtk_type_check_class_cast() g_type_check_class_cast()
|
||||
gtk_type_describe_tree() -
|
||||
gtk_type_describe_heritage() -
|
||||
gtk_type_free() -
|
||||
gtk_type_children_types() g_type_children()
|
||||
gtk_type_set_chunk_alloc() GTypeInfo.n_preallocs
|
||||
gtk_type_register_enum() g_enum_register_static()
|
||||
gtk_type_register_flags() g_flags_register_static()
|
||||
gtk_type_parent_class() g_type_parent() / g_type_class_peek_parent()
|
||||
Use of g_type_class_ref() / g_type_class_unref() and g_type_class_peek()
|
||||
is recommended over usage of gtk_type_class().
|
||||
Use of g_type_register_static() / g_type_register_dynamic() is recommended
|
||||
over usage of gtk_type_unique().
|
||||
|
||||
* Object system changes:
|
||||
GtkObject derives from GObject, so is not the basic object type anymore.
|
||||
This imposes the following source incompatible changes:
|
||||
- GtkObject has no klass field anymore, an object's class can be retrived
|
||||
with the object's coresponding GTK_<OBJECT>_GET_CLASS (object) macro.
|
||||
- GtkObjectClass has no type field anymore, a class's type can be retrived
|
||||
with the GTK_CLASS_TYPE (class) macro.
|
||||
- GtkObjectClass does not introduce the finalize() and shutdown() methods
|
||||
anymore. While shutdown() is intended for GTK+ internal use only, finalize()
|
||||
is required by a variety of object implementations. GObjectClass.finalize
|
||||
should be overriden here, e.g.:
|
||||
static void gtk_label_finalize (GObject *gobject)
|
||||
{
|
||||
GtkLabel *label = GTK_LABEL (gobject);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
static void gtk_label_class_init (GtkLabelClass *class)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
|
||||
|
||||
gobject_class->finalize = gtk_label_finalize;
|
||||
}
|
||||
|
||||
- the GtkObject::destroy signal can now be emitted multiple times on an object.
|
||||
::destroy implementations should check that make sure that they take this
|
||||
into account, by checking to make sure that resources are there before
|
||||
freeing them. For example:
|
||||
if (object->foo_data)
|
||||
{
|
||||
g_free (object->foo_data);
|
||||
object->foo_data = NULL;
|
||||
}
|
||||
|
||||
Also, ::destroy implementations have to release object references that
|
||||
the object holds. Code in finalize implementations such as:
|
||||
if (object->adjustment)
|
||||
{
|
||||
gtk_object_unref (object->adjustment);
|
||||
object->adjustment = NULL;
|
||||
}
|
||||
have to be moved into the ::destroy implementations. The reason for doing
|
||||
this is that all object reference cycles should be broken at destruction
|
||||
time.
|
||||
|
||||
@@ -0,0 +1,338 @@
|
||||
|
||||
The overall syntax is:
|
||||
|
||||
(type-of-thing-being-defined name-used-to-refer-to-this-thing
|
||||
(attribute-name attribute-value-depending-on-the-attribute)
|
||||
(attribute-name attribute-value-depending-on-the-attribute)
|
||||
(attribute-name attribute-value-depending-on-the-attribute))
|
||||
|
||||
Some definitions can have a c-declaration field that gives the C code
|
||||
we parsed to arrive at the definition. The c-declaration is a quoted
|
||||
string because it can contain parentheses and such.
|
||||
|
||||
Defined types and their attributes:
|
||||
|
||||
===
|
||||
(module module-name
|
||||
(submodule-of module-name)) ;; submodule is optional
|
||||
|
||||
Ex: (module Gtk)
|
||||
Ex: (module Rgb
|
||||
(submodule-of Gdk))
|
||||
|
||||
modules are later referred to with a list of module names, like
|
||||
(Gdk Rgb) or (Gtk)
|
||||
|
||||
Object and boxed type definitions automatically create a submodule.
|
||||
For example, GtkCList creates the module (module CList (submodule-of
|
||||
(Gtk))) which is referred to as module (Gtk CList).
|
||||
|
||||
===
|
||||
|
||||
(type
|
||||
(alias some-unique-identifier)
|
||||
(in-module module-name) ;; optional, gchar* is not in a module
|
||||
(gtk-type-id gtk-type-system-id) ;; optional, absent if this is not
|
||||
;; in the type system
|
||||
(is-parametric boolean) ;; optional default to #f
|
||||
(in-c-name name-of-symbol-in-C)
|
||||
(out-c-name name-of-symbol-in-C)
|
||||
(inout-c-name name-of-symbol-in-C))
|
||||
|
||||
Ex: (type
|
||||
(alias string)
|
||||
(gtk-type-id GTK_TYPE_STRING)
|
||||
(in-c-name "const gchar*")
|
||||
(out-c-name "gchar**") ;; actually I'm not sure how strings work out/inout
|
||||
(inout-c-name "gchar*"))
|
||||
|
||||
(type
|
||||
(alias list)
|
||||
(gtk-type-id GTK_TYPE_POINTER)
|
||||
(is-parametric #t)
|
||||
(in-c-name "GList*")
|
||||
(out-c-name "GList**")
|
||||
(inout-c-name "GList**"))
|
||||
|
||||
|
||||
;; This one would be implied by the (object) def for GtkWidget I
|
||||
;; think - (type) is only required for types that are not implied
|
||||
;; by other definitions, such as int/boolean/etc.
|
||||
|
||||
(type
|
||||
(alias GtkWidget)
|
||||
(in-module (Gtk))
|
||||
(gtk-type-id GTK_TYPE_WIDGET)
|
||||
(in-c-name "GtkWidget*")
|
||||
(inout-c-name "GtkWidget*")
|
||||
(out-c-name "GtkWidget**"))
|
||||
|
||||
"Type" bindings are automatically assumed for objects, boxed types,
|
||||
etc. as defined below.
|
||||
|
||||
The alias field is used to refer to the type later on.
|
||||
|
||||
Whenever a type alias can be used, it is also possible to use the
|
||||
keyword "native", which implies that the type in question is too
|
||||
C-specific to represent. Then a c-declaration will typically be
|
||||
available for use.
|
||||
|
||||
C types containing [] or () are function pointers or arrays. For
|
||||
arrays that don't specify a size, we just treat them as pointers. For
|
||||
function pointers, we need special (type) syntax/attributes of some
|
||||
kind, but since there basically aren't any of these right now in the
|
||||
libs we care about we can just ignore them. For arrays that specify a
|
||||
size ditto, you would handle them by adding an (array-size) attribute
|
||||
or something or using the "native" keyword and skipping the (type)
|
||||
stuff.
|
||||
|
||||
===
|
||||
(object object-name
|
||||
(in-module module-name-list)
|
||||
(parent object-name optional-module-name-if-different)
|
||||
(abstract boolean-is-abstract-class) ;; omit for default of #f
|
||||
(c-name name-of-the-object-in-C)
|
||||
(field (type-and-name type-alias-of-struct-field name-of-struct-field)
|
||||
(access read-or-write-or-readwrite)))
|
||||
|
||||
|
||||
Ex: (object Widget
|
||||
(in-module (Gtk))
|
||||
(parent Object) ;; could say (parent Object (Gtk))
|
||||
(abstract #t)
|
||||
(c-name GtkWidget)
|
||||
(field (type-and-name GdkWindow* window) (access read)))
|
||||
|
||||
An "object" declaration automatically implies the type definition:
|
||||
|
||||
(type
|
||||
(alias concat-module-elements-and-object-name)
|
||||
(in-c-name pointer-to-c-name)
|
||||
(out-c-name pointer-to-pointer-to-c-name)
|
||||
(inout-c-name pointer-to-c-name))
|
||||
|
||||
Ex:
|
||||
(type (alias GtkWidget)
|
||||
(in-c-name GtkWidget*)
|
||||
(out-c-name GtkWidget**)
|
||||
(inout-c-name GtkWidget*))
|
||||
|
||||
It also implies a module that is the name broken into parts:
|
||||
(module CTree
|
||||
(submodule-of Gtk))
|
||||
|
||||
===
|
||||
|
||||
(function function-name
|
||||
(in-module module-name-list) ;; "static methods" go in their
|
||||
;; object's module
|
||||
(is-constructor-of object-type-alias) ;; optional, marks a constructor
|
||||
(c-name function-name)
|
||||
(return-type return-value-type) ;; defaults to void
|
||||
(caller-owns-return boolean-value) ;; defaults to #f
|
||||
(can-return-null boolean-value) ;; defaults to #t
|
||||
(parameter in-or-out-or-inout
|
||||
(type-and-name parameter-type-alias parameter-name)
|
||||
(type-parameter name-of-contained-type) ;; optional, requires parametric type
|
||||
(c-declaration "c-type-and-name")) ;; c-declaration only required
|
||||
;; if the type alias is "native"
|
||||
(varargs #t) ;; has varargs at the end
|
||||
)
|
||||
|
||||
Ex:
|
||||
(function init
|
||||
(in-module (Gdk Rgb)
|
||||
(c-name gdk_rgb_init)))
|
||||
|
||||
Ex:
|
||||
(function new
|
||||
(in-module (Gdk Rgb Cmap))
|
||||
(is-constructor-of GdkRgbCmap)
|
||||
(c-name gdk_rgb_cmap_new)
|
||||
(return-type GdkRgbCmap)
|
||||
(caller-owns-return #t) ;; perhaps this could be implied by is-constructor-of
|
||||
(parameter in (type-and-name array-of-guint32 colors))
|
||||
(parameter in (type-and-name gint n_colors)))
|
||||
|
||||
Ex:
|
||||
(function config_set_set_handler
|
||||
(in-module (Gnome))
|
||||
(c-name gnome_config_set_set_handler)
|
||||
(parameter in (type-and-name native func)
|
||||
(c-declaration "void (*func)(void*)"))
|
||||
(parameter in (type-and-name gpointer data)))
|
||||
|
||||
===
|
||||
(method method-name
|
||||
(of-object object-name module-name)
|
||||
;; retval/arg attributes as for (function), but with first parameter
|
||||
;; omitted for non-constructors
|
||||
)
|
||||
|
||||
Ex:
|
||||
(method set_text
|
||||
(of-object Label (Gtk))
|
||||
(parameter (type-and-name const-gchar* str)))
|
||||
|
||||
===
|
||||
(object-argument arg-name
|
||||
(of-object object-we-are-an-argument-of optional-objects-module)
|
||||
(type-id argument-type) ;; GTK_TYPE_OBJECT etc.
|
||||
;; flags all default to #f
|
||||
(readable bool-value)
|
||||
(writeable bool-value)
|
||||
(construct-only bool-value))
|
||||
|
||||
Ex:
|
||||
(object-argument label
|
||||
(of-object Label (Gtk))
|
||||
(type GTK_TYPE_STRING)
|
||||
(readable #t)
|
||||
(writeable #t))
|
||||
|
||||
===
|
||||
(signal signal-name
|
||||
(run-action bool-value)
|
||||
(run-first bool-value)
|
||||
(run-last bool-value)
|
||||
(of-object object-we-are-a-signal-of optional-objects-module)
|
||||
;; return value and parameters as for a function, omitting the object
|
||||
;; and user data parameters
|
||||
|
||||
;; what other properties matter for a signal?
|
||||
)
|
||||
|
||||
Ex:
|
||||
(signal select_row
|
||||
(of-object CList (Gtk))
|
||||
(run-first #t)
|
||||
;; return type defaults to void
|
||||
(parameter in (type-and-name gint row))
|
||||
(parameter in (type-and-name gint column))
|
||||
(parameter in (type-and-name GdkEvent* event)))
|
||||
|
||||
===
|
||||
(enum enum-name
|
||||
(in-module modname)
|
||||
(c-name name-in-c)
|
||||
(value (nick value-name-noprefixes-hyphen-lowercase) (c-name value-c-name)))
|
||||
|
||||
Ex:
|
||||
|
||||
(enum DirectionType
|
||||
(in-module Gtk)
|
||||
(c-name GtkDirectionType)
|
||||
(value (nick tab-forward) (c-name GTK_DIR_TAB_FORWARD))
|
||||
(value (nick tab-backward) (c-name GTK_DIR_TAB_BACKWARD))
|
||||
(value (nick up) (c-name GTK_DIR_UP))
|
||||
(value (nick down) (c-name GTK_DIR_DOWN))
|
||||
(value (nick left) (c-name GTK_DIR_LEFT))
|
||||
(value (nick right) (c-name GTK_DIR_RIGHT)))
|
||||
|
||||
(enum Pos
|
||||
(in-module (Gtk CTree))
|
||||
(c-name GtkCTreePos)
|
||||
(value (nick before) (c-name GTK_CTREE_POS_BEFORE))
|
||||
(value (nick as-child) (c-name GTK_CTREE_POS_AS_CHILD))
|
||||
(value (nick after) (c-name GTK_CTREE_POS_AFTER)))
|
||||
|
||||
===
|
||||
(flags) is just like enum, but some bindings may wrap enums and flags differently.
|
||||
|
||||
===
|
||||
|
||||
(boxed boxed-name
|
||||
(in-module modname)
|
||||
(c-name c-name)
|
||||
(ref-func func-to-increase-refcount)
|
||||
(copy-func func-to-copy)
|
||||
(release-func func-to-destroy-or-decrement-refcount)
|
||||
(field (type-and-name type-alias-of-struct-field name-of-struct-field) (access access-rule)))
|
||||
|
||||
It is never OK to use memcpy() to copy a boxed type, or use
|
||||
malloc()/free() to alloc/free one.
|
||||
|
||||
Ex:
|
||||
|
||||
(boxed Pixmap
|
||||
(in-module (Gdk))
|
||||
(c-name GdkPixmap)
|
||||
(ref-func pixmap_ref)
|
||||
(release-func pixmap_unref))
|
||||
|
||||
An "object" declaration automatically implies the type definition:
|
||||
|
||||
(type
|
||||
(alias concat-module-elements-and-boxed-name)
|
||||
(in-c-name pointer-to-c-name)
|
||||
(out-c-name pointer-to-pointer-to-c-name)
|
||||
(inout-c-name pointer-to-c-name))
|
||||
|
||||
Ex:
|
||||
(type (alias GdkPixmap)
|
||||
(in-c-name GdkPixmap*)
|
||||
(out-c-name GdkPixmap**)
|
||||
(inout-c-name GdkPixmap*))
|
||||
|
||||
|
||||
===
|
||||
|
||||
(struct struct-name
|
||||
(in-module modname)
|
||||
(c-name c-name)
|
||||
(field (type-and-name type-alias-of-struct-field name-of-struct-field) (access access-rule)))
|
||||
|
||||
Unlike a boxed type, a struct type can be copied with memcpy() and
|
||||
allocated on the stack or with g_malloc().
|
||||
|
||||
Ex:
|
||||
(struct Rectangle
|
||||
(in-module (Gdk))
|
||||
(c-name GdkRectangle)
|
||||
(field (type-and-name gint16 x) (access readwrite))
|
||||
(field (type-and-name gint16 y) (access readwrite))
|
||||
(field (type-and-name guint16 width) (access readwrite))
|
||||
(field (type-and-name guint16 height) (access readwrite)))
|
||||
|
||||
Implies GdkRectangle type alias:
|
||||
|
||||
(type (alias GdkRectangle)
|
||||
(in-c-name GdkRectangle*)
|
||||
(out-c-name GdkRectangle*) ;; note - not the same as boxed types
|
||||
(inout-c-name GdkRectangle*))
|
||||
|
||||
===
|
||||
|
||||
(user-function name
|
||||
(in-module module)
|
||||
(c-name c-typedef-name)
|
||||
;; return-type and parameters as for (function)
|
||||
)
|
||||
|
||||
Ex:
|
||||
|
||||
(user-function PrintFunc
|
||||
(in-module (Gtk))
|
||||
(parameter in (type-and-name gpointer func_data))
|
||||
(parameter in (type-and-name gchar* str)))
|
||||
|
||||
===
|
||||
|
||||
(typedef new-name
|
||||
(in-module module)
|
||||
(c-name c-full-name)
|
||||
(orig-type alias-of-orig-type))
|
||||
|
||||
Ex:
|
||||
|
||||
(typedef Type
|
||||
(in-module (Gtk))
|
||||
(c-name GtkType)
|
||||
(orig-type guint))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.6">
|
||||
<TITLE>GTK+ FAQ</TITLE>
|
||||
<LINK HREF="gtkfaq-es-1.html" REL=next>
|
||||
|
||||
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<A HREF="gtkfaq-es-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
<HR NOSHADE>
|
||||
<H1>GTK+ FAQ</H1>
|
||||
|
||||
|
||||
<H2>Nathan Froyd, Tony Gale, Shawn T. Amundson.</H2>Seis de Julio de 1998
|
||||
<P><HR NOSHADE>
|
||||
<EM>La intención de este documento es dar respuesta a las preguntas
|
||||
realizadas con más frecuencia por parte de los programadores que utilizan GTK+ o simplemente por personas que desean utilizar GTK+. </EM>
|
||||
<HR NOSHADE>
|
||||
<P>
|
||||
<H2><A NAME="toc1">1.</A> <A HREF="gtkfaq-es-1.html">Información General</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.1">1.1 Autores</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.2">1.2 ¿Qué es GTK+?</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.3">1.3 ¿Qué es el + en GTK+?</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.4">1.4 ¿La G en GTK+ significa General, Gimp, o GNU?</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.5">1.5 ¿Dónde está la documentación para GTK?</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.6">1.6 ¿Hay alguna lista de correo (o archivo de lista de correo) para GTK+?</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.7">1.7 ¿La lista gtk-list no ha tenido tráfico alguno por días,</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.8">1.8 Cómo conseguir ayuda con GTK+</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.9">1.9 Cómo reportar errores en GTK+</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.10">1.10 ¿Qué aplicaciones se han escrito con GTK+?</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.11">1.11 Estoy buscando una aplicación que escribir en GTK+. ¿Qué tal un cliente IRC?</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc2">2.</A> <A HREF="gtkfaq-es-2.html">Cómo encontrar, configurar, instalar y comprobar GTK+</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="gtkfaq-es-2.html#ss2.1">2.1 ¿Qué necesito para correr GTK+?</A>
|
||||
<LI><A HREF="gtkfaq-es-2.html#ss2.2">2.2 ¿Dónde puedo conseguir GTK+?</A>
|
||||
<LI><A HREF="gtkfaq-es-2.html#ss2.3">2.3 ¿Cómo configuro/compilo GTK+?</A>
|
||||
<LI><A HREF="gtkfaq-es-2.html#ss2.4">2.4 Cuando compilo GTK+ obtengo un error como: <CODE>make: file `Makefile' line 456: Syntax error</CODE></A>
|
||||
<LI><A HREF="gtkfaq-es-2.html#ss2.5">2.5 ¡He compilado e instalado GTK+, pero no puedo lograr que los programas se enlacen con él!</A>
|
||||
<LI><A HREF="gtkfaq-es-2.html#ss2.6">2.6 Cuando compilo programas con GTK+, obtengo mensajes de error del compilador diciendo que no es capaz de encontrar <CODE>"glibconfig.h"</CODE>.</A>
|
||||
<LI><A HREF="gtkfaq-es-2.html#ss2.7">2.7 Cuando instalo El GIMP, configure reporta que no puede encontrar GTK.</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc3">3.</A> <A HREF="gtkfaq-es-3.html">Desarrollo de GTK+</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="gtkfaq-es-3.html#ss3.1">3.1 ¿Qué es esta cosa CVS de la cual todo el mundo habla, y cómo puedo acceder a ella?</A>
|
||||
<LI><A HREF="gtkfaq-es-3.html#ss3.2">3.2 ¿Cómo puedo contribuír a GTK+?</A>
|
||||
<LI><A HREF="gtkfaq-es-3.html#ss3.3">3.3 ¿Cómo averiguo si mi parche fue aplicado, y si no, por qué no?</A>
|
||||
<LI><A HREF="gtkfaq-es-3.html#ss3.4">3.4 ¿Cuál es la política sobre la incorporación de nuevos <EM>widgets</EM> en la librería?</A>
|
||||
<LI><A HREF="gtkfaq-es-3.html#ss3.5">3.5 ¿Hay alguien trabajando en atamientos para otros lenguajes distintos a C?</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc4">4.</A> <A HREF="gtkfaq-es-4.html">Desarrollo con GTK+</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.1">4.1 ¿Cómo empiezo?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.2">4.2 ¿Qué <EM>widgets</EM> existen en GTK?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.3">4.3 ¿GTK+ es seguro ante múltiples hilos?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.4">4.4 ¿Cómo puedo prevenir el redibujar y reacomodar tamaños mientras cambio múltiples <EM>widgets</EM>?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.5">4.5 ¿Cómo atrapo un evento de doble tecleo (en un <EM>widget</EM> de lista, por ejemplo)?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.6">4.6 ¿Cómo puedo averiguar cuál es la selección de un GtkList?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.7">4.7 ¿Acaso es posible desplegar un texto que se recorte para que quepa dentro del lugar que tenga asignado?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.8">4.8 ¿Por qué el contenido de un botón no se mueve al presionar el botón? Aquí les envío un parche para que funcione de esa forma...</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.9">4.9 ¿Cómo puedo definir una línea de separación como en un menú?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.10">4.10 ¿Cómo puedo darle justificación a la derecha a un menú, como Help, cuando utilizo MenuFactory?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.11">4.11 ¿Cómo hago mi ventana modal? / ¿Cómo hago una sóla ventana activa?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.12">4.12 ¿Por qué mi <EM>widget</EM> (ej. progressbar) no se actualiza?</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc5">5.</A> <A HREF="gtkfaq-es-5.html">Acerca de gdk</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="gtkfaq-es-5.html#ss5.1">5.1 ¿Qué es gdk?</A>
|
||||
<LI><A HREF="gtkfaq-es-5.html#ss5.2">5.2 ¿Cómo utilizo la asignación de colores?</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc6">6.</A> <A HREF="gtkfaq-es-6.html">Acerca de glib</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="gtkfaq-es-6.html#ss6.1">6.1 ¿Qué es glib?</A>
|
||||
<LI><A HREF="gtkfaq-es-6.html#ss6.2">6.2 ¿Por qué utilizar g_print, g_malloc, g_strdup y funciones compañeras de glib?</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc7">7.</A> <A HREF="gtkfaq-es-7.html">Contribuciones al GTK+ FAQ, Mantenedores y Copyright</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="gtkfaq-es-7.html#ss7.1">7.1 Nota del Traductor</A>
|
||||
</UL>
|
||||
<HR NOSHADE>
|
||||
<A HREF="gtkfaq-es-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -0,0 +1,192 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.6">
|
||||
<TITLE>GTK+ FAQ: Información General</TITLE>
|
||||
<LINK HREF="gtkfaq-es-2.html" REL=next>
|
||||
|
||||
<LINK HREF="gtkfaq-es.html#toc1" REL=contents>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<A HREF="gtkfaq-es-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="gtkfaq-es.html#toc1">Contents</A>
|
||||
<HR NOSHADE>
|
||||
<H2><A NAME="s1">1. Información General</A></H2>
|
||||
|
||||
<H2><A NAME="ss1.1">1.1 Autores</A>
|
||||
</H2>
|
||||
|
||||
<P>Los autores de GTK+ son:
|
||||
<P>
|
||||
<UL>
|
||||
<LI>Peter Mattis (petm@xcf.berkeley.edu)</LI>
|
||||
<LI>Spencer Kimball (spencer@xcf.berkeley.edu)</LI>
|
||||
<LI>Josh MacDonald (jmacd@xcf.berkeley.edu)</LI>
|
||||
</UL>
|
||||
|
||||
GTK+ se ditribuye bajo la licencia de Librería Pública General de GNU
|
||||
<P>
|
||||
<H2><A NAME="ss1.2">1.2 ¿Qué es GTK+?</A>
|
||||
</H2>
|
||||
|
||||
<P>GTK+ es un pequeño y eficiente conjunto de <EM>widgets</EM>, diseñados
|
||||
con un aspecto y sentir general a Motif. Contiene <EM>widgets</EM> comúnes
|
||||
y algúnos <EM>widgets</EM> más complejos como una selección de
|
||||
archivos, y <EM>widgets</EM> de selección de colores.
|
||||
<P>GTK+ proporciona algunas características únicas. (No tengo conocimiento
|
||||
de otra librería de <EM>widge>
|
||||
<HR><H3>Transfer interrupted!</H3>
|
||||
enos).
|
||||
Por ejemplo, un botón no contiene una etiqueta, contiene un <EM>widget</EM>
|
||||
hijo, que en muchas instancias será una etiqueta. Sin embargo, el
|
||||
<EM>widget</EM> hijo también puede ser un <EM>pixmap</EM> (mapa de pixels),
|
||||
imagén o cualquier combinación posible que desee el programador. Toda la
|
||||
librería es así de flexible.
|
||||
<P>
|
||||
<H2><A NAME="ss1.3">1.3 ¿Qué es el + en GTK+?</A>
|
||||
</H2>
|
||||
|
||||
<P>Peter Mattis informó a la lista de correo gtk:
|
||||
<BLOCKQUOTE>
|
||||
"Escribí originalmente gtk el cual incluía tres librerías,
|
||||
libglib, libgdk y libgtk. Era caracterizado por una jerarquía de
|
||||
<EM>widget</EM> plana. O sea, no podías derivar un nuevo
|
||||
<EM>widget</EM> de uno ya existente. Contenía un mecanismo de
|
||||
<EM>callback</EM> (llamada) más estándar en lugar del mecanismo
|
||||
de señales ahora presente en gtk+. El + fue agregado para distinguir
|
||||
entre la versión original de gtk y la nueva versión. Pueden pensar
|
||||
en ello como una ampliación al gtk original que agrega características
|
||||
orientadas o objetos."
|
||||
</BLOCKQUOTE>
|
||||
<P>
|
||||
<H2><A NAME="ss1.4">1.4 ¿La G en GTK+ significa General, Gimp, o GNU?</A>
|
||||
</H2>
|
||||
|
||||
<P>Peter Mattis informó a la lista de correo gtk:
|
||||
<BLOCKQUOTE>
|
||||
"Pienso que la última vez que Spencer y yo hablamos al respecto nos
|
||||
decidimos por GTK = Gimp ToolKit. Pero no estoy seguro. Sin embargo,
|
||||
definitivamente no es GNU."
|
||||
</BLOCKQUOTE>
|
||||
<P>
|
||||
<H2><A NAME="ss1.5">1.5 ¿Dónde está la documentación para GTK?</A>
|
||||
</H2>
|
||||
|
||||
<P>
|
||||
En el directorio doc/ de la distribución de GTK+ encontrarás
|
||||
el material de referencia para GTK y GDK, este FAQ y el tutor de GTK.
|
||||
<P>Adicionalmente, puedes encontrar enlaces a versiones HTML de estos
|
||||
documentos al ir a
|
||||
<A HREF="http://www.gtk.org/">http://www.gtk.org/</A>.
|
||||
<P>El Tutor y el FAQ también se pueden encontrar en
|
||||
<A HREF="http://www.geocities.com/ResearchTriangle/Lab/4299/">http://www.geocities.com/ResearchTriangle/Lab/4299/</A>.
|
||||
<P>
|
||||
<H2><A NAME="ss1.6">1.6 ¿Hay alguna lista de correo (o archivo de lista de correo) para GTK+?</A>
|
||||
</H2>
|
||||
|
||||
<P>Hay dos listas de correo:
|
||||
<UL>
|
||||
<LI>Una lista de correo para la discusión del desarrollo de aplicaciones
|
||||
basadas en GTK se hospeda en gtk-app-devel-list@redhat.com. Para suscribirse
|
||||
envíe un correo electrónico a
|
||||
<A HREF="mailto:gtk-app-devel-list-request@redhat.com">gtk-app-devel-list-request@redhat.com</A> con <EM>subscribe</EM> en el
|
||||
campo <B>subject</B>.
|
||||
<P>
|
||||
</LI>
|
||||
<LI>Una lista de correo para la discusión del desarrollo de GTK se hospeda
|
||||
en gtk-list@redhat.com. Para suscribirse envíe un correo electrónico
|
||||
a
|
||||
<A HREF="mailto:gtk-list-request@redhat.com">gtk-list-request@redhat.com</A> con <EM>subscribe</EM>
|
||||
en el campo <B>subject</B>.
|
||||
<P>Un archivo escudriñable de la lista de correo puede ser encontrado en
|
||||
<A HREF="http://archive.redhat.com/gtk-list">http://archive.redhat.com/gtk-list</A></LI>
|
||||
</UL>
|
||||
<H2><A NAME="ss1.7">1.7 ¿La lista gtk-list no ha tenido tráfico alguno por días,</A>
|
||||
está muerta?</H2>
|
||||
|
||||
<P>No, todos están ocupados codificando.
|
||||
<P>
|
||||
<H2><A NAME="ss1.8">1.8 Cómo conseguir ayuda con GTK+</A>
|
||||
</H2>
|
||||
|
||||
<P>Primero, asegúrate que tu pregunta no esté respondida en la
|
||||
documentación, este FAQ o el tutor. ¿Hecho? ¿Estás seguro de que
|
||||
lo has hecho, verdad? En ese caso, el mejor lugar para hacer preguntas es
|
||||
la lista de correo de GTK+.
|
||||
<P>
|
||||
<H2><A NAME="ss1.9">1.9 Cómo reportar errores en GTK+</A>
|
||||
</H2>
|
||||
|
||||
<P>Los reportes de errores se deben enviar a la lista de correo de GTK+.
|
||||
<P>
|
||||
<H2><A NAME="ss1.10">1.10 ¿Qué aplicaciones se han escrito con GTK+?</A>
|
||||
</H2>
|
||||
|
||||
<P>Algunas aplicaciones que utilizan GTK+ son:
|
||||
<UL>
|
||||
<LI>GIMP (
|
||||
<A HREF="http://www.XCF.Berkeley.EDU/~gimp/">http://www.XCF.Berkeley.EDU/~gimp/</A> ),
|
||||
un programa de manipulación de imágenes</LI>
|
||||
<LI>Gsumi (
|
||||
<A HREF="http://www.msc.cornell.edu/~otaylor/gsumi/gsumi.html">http://www.msc.cornell.edu/~otaylor/gsumi/gsumi.html</A>),
|
||||
un divertido programa para rayar en blanco y negro con soporte para
|
||||
XInput.</LI>
|
||||
<LI>GUBI (
|
||||
<A HREF="http://www.SoftHome.net/pub/users/timj/gubi/index.htm">http://www.SoftHome.net/pub/users/timj/gubi/index.htm</A>),
|
||||
un constructor de interface de usuario</LI>
|
||||
<LI>Gzilla (
|
||||
<A HREF="http://www.levien.com/gzilla/">http://www.levien.com/gzilla/</A>),
|
||||
un navegador del web</LI>
|
||||
<LI>SANE (
|
||||
<A HREF="http://www.azstarnet.com/~axplinux/sane/">http://www.azstarnet.com/~axplinux/sane/</A> ),
|
||||
una interface universal para <EM>scanner</EM></LI>
|
||||
<LI>XQF (
|
||||
<A HREF="http://www.botik.ru/~roma/quake/">http://www.botik.ru/~roma/quake/</A>),
|
||||
un lanzador y navegador de servidores de QuakeWorld/Quake2</LI>
|
||||
<LI>ElectricEyes (
|
||||
<A HREF="http://www.labs.redhat.com/ee.shtml">http://www.labs.redhat.com/ee.shtml</A>),
|
||||
un visor de imágenes que se dirige a ser un reemplazo libre de xv</LI>
|
||||
<LI>GPK - the General Proxy Kit (
|
||||
<A HREF="http://www.humanfactor.com/gpk/">http://www.humanfactor.com/gpk/</A>),
|
||||
una librería agregable que permite accesso seguro a GTK+
|
||||
ante múltiples hilos</LI>
|
||||
<LI>GCK - the General Convenience Kit (
|
||||
<A HREF="http://www.ii.uib.no/~tomb/gck.html">http://www.ii.uib.no/~tomb/gck.html</A>),
|
||||
funciones misceláneas cuya intención es facilitar el manejo de
|
||||
colores, construcción de IU (interfaces de usuario), operaciones
|
||||
vectoriales, y funciones matemáticas</LI>
|
||||
<LI>GDK Imlib (
|
||||
<A HREF="http://www.labs.redhat.com/imlib/">http://www.labs.redhat.com/imlib/</A>),
|
||||
una librería de manipulación y carga rápida de imágenes para
|
||||
GDK </LI>
|
||||
</UL>
|
||||
<P>Adicionalmente a lo de arriba, el proyecto GNOME
|
||||
(
|
||||
<A HREF="http://www.gnome.org">http://www.gnome.org</A>)
|
||||
utiliza GTK+ para construír un escritorio libre para Linux. Muchos más
|
||||
programas pueden ser encontrados ahí.
|
||||
<P>
|
||||
<H2><A NAME="ss1.11">1.11 Estoy buscando una aplicación que escribir en GTK+. ¿Qué tal un cliente IRC?</A>
|
||||
</H2>
|
||||
|
||||
<P>
|
||||
<P>Pregunte en gtk-list para sugerencias. Actualmente hay por lo menos cuatro
|
||||
clientes IRC endesarrollo.
|
||||
<P>
|
||||
<UL>
|
||||
<LI>girc. (Incluído con GNOME)</LI>
|
||||
<LI>Bezerk (
|
||||
<A HREF="http://www.gtk.org/~trog/">http://www.gtk.org/~trog/</A>)</LI>
|
||||
<LI>gsirc. (¿Localización?)</LI>
|
||||
<LI>Gnirc. (
|
||||
<A HREF="http://www.imaginet.fr/~dramboz/gnirc">http://www.imaginet.fr/~dramboz/gnirc</A>)</LI>
|
||||
</UL>
|
||||
<P>
|
||||
<P>
|
||||
<HR NOSHADE>
|
||||
<A HREF="gtkfaq-es-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="gtkfaq-es.html#toc1">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -0,0 +1,195 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.6">
|
||||
<TITLE>GTK+ FAQ: Cómo encontrar, configurar, instalar y comprobar GTK+</TITLE>
|
||||
<LINK HREF="gtkfaq-es-3.html" REL=next>
|
||||
<LINK HREF="gtkfaq-es-1.html" REL=previous>
|
||||
<LINK HREF="gtkfaq-es.html#toc2" REL=contents>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<A HREF="gtkfaq-es-3.html">Next</A>
|
||||
<A HREF="gtkfaq-es-1.html">Previous</A>
|
||||
<A HREF="gtkfaq-es.html#toc2">Contents</A>
|
||||
<HR NOSHADE>
|
||||
<H2><A NAME="s2">2. Cómo encontrar, configurar, instalar y comprobar GTK+</A></H2>
|
||||
|
||||
<H2><A NAME="ss2.1">2.1 ¿Qué necesito para correr GTK+?</A>
|
||||
</H2>
|
||||
|
||||
<P>Para compilar GTK+, todo lo que necesita es un compilador de C (gcc) y
|
||||
el Sistema X Windows y librerías asociadas en su sistema.
|
||||
<P>
|
||||
<H2><A NAME="ss2.2">2.2 ¿Dónde puedo conseguir GTK+?</A>
|
||||
</H2>
|
||||
|
||||
<P>El sitio canónico es:
|
||||
<PRE>
|
||||
ftp://ftp.gtk.org/pub/gtk
|
||||
</PRE>
|
||||
|
||||
Por supuesto, cualquier espejo de ftp.gtk.org debe tener las últimas
|
||||
versiones también.
|
||||
<P>
|
||||
<H2><A NAME="ss2.3">2.3 ¿Cómo configuro/compilo GTK+?</A>
|
||||
</H2>
|
||||
|
||||
<P>Por lo general, todo lo que necesita es emititir los comandos:
|
||||
<PRE>
|
||||
./configure
|
||||
make
|
||||
</PRE>
|
||||
|
||||
en el directorio gtk+-version/.
|
||||
<P>
|
||||
<H2><A NAME="ss2.4">2.4 Cuando compilo GTK+ obtengo un error como: <CODE>make: file `Makefile' line 456: Syntax error</CODE></A>
|
||||
</H2>
|
||||
|
||||
<P>Asegúrese de que utiliza GNU make (verifique con <CODE>make -v</CODE>). Hay
|
||||
varias versiones extrañas y maravillosas de make por ahí, y no todas
|
||||
manejan los <EM>Makefiles</EM> generados automáticamente.
|
||||
<P>
|
||||
<P>
|
||||
<H2><A NAME="ss2.5">2.5 ¡He compilado e instalado GTK+, pero no puedo lograr que los programas se enlacen con él!</A>
|
||||
</H2>
|
||||
|
||||
<P>Este problema se encuentra comúnmente cuando las librerías GTK+ no pueden
|
||||
ser localizadas o tienen la versión incorrecta. Generalmente, el compilador
|
||||
se quejará de un 'unresolved symbol' (símbolo no resuelto). Hay dos cosas
|
||||
que necesita verificar:
|
||||
<P>
|
||||
<UL>
|
||||
<LI>Asegúrese de que las librerías pueden ser encontradas. Usted desea editar
|
||||
/etc/ld.so.conf para incluír los directorios que contienen las librerías
|
||||
GTK, de manera que luzca como:
|
||||
<PRE>
|
||||
/usr/X11R6/lib
|
||||
/usr/local/lib
|
||||
</PRE>
|
||||
|
||||
Luego necesita correr /sbin/ldconfig como root. Puede encontrar que directorio
|
||||
utiliza GTK al ejecutar
|
||||
<PRE>
|
||||
gtk-config --libs
|
||||
</PRE>
|
||||
|
||||
|
||||
Si su sitema no utiliza ld.so para encontrar librerías (como Solaris),
|
||||
entonces tendrá que utilizar la variable de ambiente LD_LIBRARY_PATH
|
||||
(o compilar el camino en su programa, lo cual no voy a cubrir aquí). Así
|
||||
que, con un shell tipo Bourne usted puede hacer (si sus librerías GTK
|
||||
están en /usr/local/lib):
|
||||
<PRE>
|
||||
export LD_LIBRARY_PATH=/usr/local/lib
|
||||
</PRE>
|
||||
|
||||
y en un csh, usted puede hacer:
|
||||
<PRE>
|
||||
setenv LD_LIBRARY_PATH /usr/local/lib
|
||||
</PRE>
|
||||
|
||||
</LI>
|
||||
<LI>Asegúrese de que el enlazador está ha encontrado el conjunto correcto de
|
||||
librerías. Si tiene una distribución de Linux que instala GTK+ (ej.
|
||||
RedHat 5.0) entonces esta versión anterior puede ser utilizada. Ahora
|
||||
(asumiendo que tiene un sistema RedHat), emita el comando
|
||||
<PRE>
|
||||
rpm -e gtk gtk-devel
|
||||
</PRE>
|
||||
|
||||
También puede querer remover los paquetes que dependen de gtk (rpm le
|
||||
dirá cuáles son). Si no tiene un sistema Linux RedHat, verifique
|
||||
para estar seguro que ni
|
||||
<PRE>
|
||||
/usr/lib
|
||||
</PRE>
|
||||
ni
|
||||
<PRE>
|
||||
/usr/local/lib
|
||||
</PRE>
|
||||
|
||||
contengan alguna de las librerías libgtk, libgdk, libglib, or libgck.
|
||||
Si existen, elimínelas (y cualquier archivo <EM>include</EM>, como
|
||||
/usr/include/gtk y /usr/include/gdk) y reinstale gtk+.</LI>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="ss2.6">2.6 Cuando compilo programas con GTK+, obtengo mensajes de error del compilador diciendo que no es capaz de encontrar <CODE>"glibconfig.h"</CODE>.</A>
|
||||
</H2>
|
||||
|
||||
<P>El archivo de encabezado "glibconfig.h" se movió al directorio
|
||||
$exec_prefix/lib/glib/include/. $exec_prefix es el directorio que fue
|
||||
especificado al dar la bandera --exec-prefix a ./configure cuando se
|
||||
compiló GTK+. Va por omisión a $prefix, (especificado con --prefix),
|
||||
que en su lugar va por omisión a /usr/local/.
|
||||
<P>Ésto se hizo asi porque "glibconfig.h" incluye información
|
||||
dependiente de la arquitectura, y el resto de los archivos <EM>include</EM>
|
||||
se colocan en $prefix/include, el cual puede ser compartido entre distintas
|
||||
arquitecturas.
|
||||
<P>GTK+ incluye un guión para el intérprete de comandos,
|
||||
<CODE>gtk-config</CODE>, el cual hace fácil
|
||||
encontrar los caminos correctos de inclusión. El tutor de GTK+ incluye
|
||||
un ejemplo de como utilizar <CODE>gtk-config</CODE> para una compilación simple
|
||||
desde la línea de comandos. Para información sobre configuraciones más
|
||||
complicadas, vea el archivo docs/gtk-config.txt en la distribución de GTK+.
|
||||
<P>Si está intentando compilar un programa viejo, puede bordear el problema
|
||||
al configurarlo con una línea de comando como:
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
CPPFLAGS="-I/usr/local/include/glib/include" ./configure
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
<P>para intérpretes de comandos compatibles con Bourne como bash, o para
|
||||
variantes csh:
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
setenv CPPFLAGS "-I/usr/local/include/glib/include"
|
||||
./configure
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
<P>(Sustituya el valor apropiado de $exec_prefix para /usr/local.)
|
||||
<P>
|
||||
<H2><A NAME="ss2.7">2.7 Cuando instalo El GIMP, configure reporta que no puede encontrar GTK.</A>
|
||||
</H2>
|
||||
|
||||
<P>Hay varias razones comúnes para esto:
|
||||
<UL>
|
||||
<LI>Usted tiene una versión vieja de GTK instalada en algún lugar.
|
||||
RedHat 5.0, por ejemplo, instala una copia anterior de GTK que no funcinará
|
||||
con las últimas veriones de GIMP. Debe eliminar esta copia vieja, pero
|
||||
observe que en el caso de RedHat 5.0 esto dañará las aplicaciones
|
||||
<CODE>control-panel</CODE>.
|
||||
<P>
|
||||
</LI>
|
||||
<LI><CODE>gtk-config</CODE> (u otro componente de GTK) no se encuentra en el camino
|
||||
(<EM>path</EM>),
|
||||
o hay una versión vieja en su sistema. Teclee:
|
||||
<PRE>
|
||||
gtk-config --version
|
||||
</PRE>
|
||||
|
||||
para verificar ambos casos. Ésto debe devolver un valor de por lo menos
|
||||
0.99.8 para que las cosas funcionen correctamente con GIMP 0.99.23. Si
|
||||
devuelve un valor distinto a lo que usted espera, entonces tiene una versión
|
||||
vieja de GTK en su sistema.
|
||||
<P>
|
||||
</LI>
|
||||
<LI>El guión ./configure no puede encontrar las librerías GTK. Como
|
||||
./configure compila varios programas de prueba, necesita poder encontrar las
|
||||
librerías GTK. Revise la pregunta anterior para obtener más ayuda al
|
||||
respecto.</LI>
|
||||
</UL>
|
||||
<P>Si nada de lo anterior ayuda, entonces revise config.log, el cual es
|
||||
generado por ./configure cuando corre. Al final estará la última
|
||||
acción tomada antes de fallar. Si es una sección de código fuente,
|
||||
copie el código fuente a un archivo y compilelo con la línea
|
||||
jústamente arriba de él en config.log. Si la compilación tiene
|
||||
éxito, intente ejecutarlo.
|
||||
<P>
|
||||
<HR NOSHADE>
|
||||
<A HREF="gtkfaq-es-3.html">Next</A>
|
||||
<A HREF="gtkfaq-es-1.html">Previous</A>
|
||||
<A HREF="gtkfaq-es.html#toc2">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -0,0 +1,198 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.6">
|
||||
<TITLE>GTK+ FAQ: Desarrollo de GTK+</TITLE>
|
||||
<LINK HREF="gtkfaq-es-4.html" REL=next>
|
||||
<LINK HREF="gtkfaq-es-2.html" REL=previous>
|
||||
<LINK HREF="gtkfaq-es.html#toc3" REL=contents>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<A HREF="gtkfaq-es-4.html">Next</A>
|
||||
<A HREF="gtkfaq-es-2.html">Previous</A>
|
||||
<A HREF="gtkfaq-es.html#toc3">Contents</A>
|
||||
<HR NOSHADE>
|
||||
<H2><A NAME="s3">3. Desarrollo de GTK+</A></H2>
|
||||
|
||||
<H2><A NAME="ss3.1">3.1 ¿Qué es esta cosa CVS de la cual todo el mundo habla, y cómo puedo acceder a ella?</A>
|
||||
</H2>
|
||||
|
||||
<P>CVS es el Concurrent Version System (Sistema de Versión Concurrente) y es
|
||||
un medio muy popular de control de versión para proyectos de software.
|
||||
Está diseñado para permitir que múltiples autores puedan operar de
|
||||
manera simultánea en el mismo árbol fuente. Este árbol fuente es
|
||||
mantenido centralizadamente, pero cada desarrollador tiene una réplica local
|
||||
de este repositorio en el cual hacen sus cambios.
|
||||
<P>Los desarrolladores de GTK+ utilizan un repositorio CVS para almacenar la
|
||||
copia maestra de la actual versión en desarrollo de GTK+. Como tal,
|
||||
la gente que desea contribuír con parches a GTK+ deben generarlos para la
|
||||
versión del CVS. La gente normal debe utilizar los paquetes liberados.
|
||||
<P>El conjunto de herramientas CVS está disponible como paquetes RPM en los
|
||||
sitios usuales de RedHat. La última versión está disponible en
|
||||
<A HREF="http://download.cyclic.com/pub/"><http://download.cyclic.com/pub/></A><P>Cualquiera puede bajar la última versión CVS de GTK+ utilizando
|
||||
acceso anónimo con los siguientes pasos:
|
||||
<UL>
|
||||
<LI> En un descendiente del intérprete de comandos bourne (ej. bash)
|
||||
teclee:
|
||||
<PRE>
|
||||
export CVSROOT=':pserver:anonymous@anoncvs.gimp.org:/debian/home/gnomecvs'
|
||||
</PRE>
|
||||
</LI>
|
||||
<LI>Luego, la primera vez que el árbol fuente se retira, se necesita
|
||||
un <EM>login</EM> cvs.
|
||||
<PRE>
|
||||
cvs login
|
||||
</PRE>
|
||||
|
||||
Ésto hará que se le solicite una clave de acceso. No hay clave de
|
||||
acceso para cvs.gimp.org, así que solo ingrese un retorno de carro.</LI>
|
||||
<LI>Para conseguir el árbol y colocarlo en un subdirectorio de su
|
||||
directorio de trabajo actual, emita el comando:
|
||||
<PRE>
|
||||
cvs -z3 get gtk+
|
||||
</PRE>
|
||||
|
||||
|
||||
Observe que con el árbol GTK+ 1.1, glib se ha movido a un módulo CVS
|
||||
separado, de manera que si no tiene glib instalado necesitará conseguirlo
|
||||
igualmente:
|
||||
<PRE>
|
||||
cvs -z3 get glib
|
||||
</PRE>
|
||||
|
||||
</LI>
|
||||
</UL>
|
||||
<H2><A NAME="ss3.2">3.2 ¿Cómo puedo contribuír a GTK+?</A>
|
||||
</H2>
|
||||
|
||||
<P>Es simple. Si algo no funciona en un programa como usted piensa que debería,
|
||||
revise la documentación para asegurarse de que no ha pasado algo por alto.
|
||||
Si es un verdadero error o característica perdida, rastréelo en el
|
||||
fuente de GTK+, cámbielo, y entonces genere un parche en la forma de un
|
||||
'diff de contexto'. Esto puede hacerse utilizando un comando como
|
||||
<CODE>diff -ru <oldfile> <newfile></CODE>. Entonces envíe el archivo
|
||||
de parche a:
|
||||
<PRE>
|
||||
ftp://ftp.gtk.org/incoming
|
||||
</PRE>
|
||||
|
||||
junto a un archivo README. ¡Asegúrese de seguir las convenciones de
|
||||
asignación de nombres o su parche será borrado! Los archivos deben ser
|
||||
de esta forma:
|
||||
<PRE>
|
||||
gtk-<username>-<date yymmdd-n>.patch.gz
|
||||
gtk-<username>-<date yymmdd-n>.patch.README
|
||||
</PRE>
|
||||
|
||||
La "n" en la fecha indica un número único (empezando de 0)
|
||||
de parches que subió ese día. Debe ser 0, a menos que envíe más de
|
||||
un parche en el mismo día.
|
||||
<P>Example:
|
||||
<PRE>
|
||||
gtk-gale-982701-0.patch.gz
|
||||
gtk-gale-982701-0.patch.README
|
||||
</PRE>
|
||||
|
||||
Una vez que usted envía <EM>lo que sea</EM>, envíe el README a
|
||||
ftp-admin@gtk.org
|
||||
<P>
|
||||
<H2><A NAME="ss3.3">3.3 ¿Cómo averiguo si mi parche fue aplicado, y si no, por qué no?</A>
|
||||
</H2>
|
||||
|
||||
<P>Los parches enviados se mandarán a
|
||||
<CODE>ftp://ftp.gtk.org/pub/gtk/patches</CODE>
|
||||
donde uno del equipo de desarrollo de GTK+ los recogerá. Si son aplicados,
|
||||
serán movidos a <CODE>/pub/gtk/patches/old</CODE>.
|
||||
<P>Los parches que no son aplicados, por cualquier razón, se mandarán a
|
||||
<CODE>/pub/gtk/patches/unapplied</CODE> o <CODE>/pub/gtk/patches/outdated</CODE>.
|
||||
En este punto puede preguntar en la lista de correo <CODE>gtk-list</CODE> el porqué
|
||||
su parche no fué aplicado. Hay muchas razones posibles por las cuales un
|
||||
parche no se aplica, pasando desde que no se puede aplicar limpiamente, hasta
|
||||
que no es correcto. No se rinda si no logró que su parche se aplicase a la
|
||||
primera.
|
||||
<P>
|
||||
<H2><A NAME="ss3.4">3.4 ¿Cuál es la política sobre la incorporación de nuevos <EM>widgets</EM> en la librería?</A>
|
||||
</H2>
|
||||
|
||||
<P>Esto corresponde a los autores, de manera que tendrá que preguntarles
|
||||
al terminar su <EM>widget</EM>. Como una guía general, los <EM>widgets</EM>
|
||||
que por lo general son útiles, funcionan, y no son una desgracia al conjunto
|
||||
de <EM>widgets</EM> serán incluídos con mucho gusto.
|
||||
<P>
|
||||
<H2><A NAME="ss3.5">3.5 ¿Hay alguien trabajando en atamientos para otros lenguajes distintos a C?</A>
|
||||
</H2>
|
||||
|
||||
<P>Sí. Existe
|
||||
<UL>
|
||||
<LI>una envoltura de C++ para GTK+ llamada gtk--. Puede encontrar el su
|
||||
página hogar en:
|
||||
<A HREF="http://www.cs.tut.fi/~p150650/gtk/gtk--.html">http://www.cs.tut.fi/~p150650/gtk/gtk--.html</A>.
|
||||
El sitio FTP es
|
||||
<A HREF="ftp://ftp.gtk.org/pub/gtk/gtk--">ftp://ftp.gtk.org/pub/gtk/gtk--</A>.
|
||||
<P>
|
||||
<P>
|
||||
</LI>
|
||||
<LI>Hay dos ataduras para Objective-C en desarrollo:
|
||||
|
||||
<UL>
|
||||
<LI>El paquete elegido por el
|
||||
<A HREF="http://www.gnome.org/">proyecto GNOME</A> es obgtk. Objgtk se basa en la clase Object y es
|
||||
mantenido por
|
||||
<A HREF="mailto:sopwith@cuc.edu">Elliot Lee</A>.
|
||||
Aparentemente, objgtk se está aceptando como el atamiento `estándar'
|
||||
de Objective-C para GTK+.
|
||||
</LI>
|
||||
<LI> Si usted está más inclinado al
|
||||
<A HREF="http://www.gnustep.org/">proyecto GNUstep</A>,
|
||||
puede que quiera revisar GTKKit por
|
||||
<A HREF="mailto:helge@mdlink.de">Helge Heß</A>.
|
||||
La intención es crear un atamiento GTK+ utilizando FoundationKit.
|
||||
GTKKit incluye linduras como escribir un archivo con una plantilla tipo
|
||||
XML para construír una interface GTK+.
|
||||
</LI>
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
</LI>
|
||||
<LI>Atamientos Perl
|
||||
<A HREF="ftp://ftp.gtk.org/pub/gtk/perl">ftp://ftp.gtk.org/pub/gtk/perl</A>
|
||||
<P>
|
||||
</LI>
|
||||
<LI>Atamientos Guile. La página hogar se encuentra en
|
||||
<A HREF="http://www.ping.de/sites/zagadka/guile-gtk">http://www.ping.de/sites/zagadka/guile-gtk</A>.
|
||||
Por cierto, Guile es la implantación del Proyecto GNU de Scheme R4RS (el
|
||||
estándar). Si le gusta Scheme, querrá darle un vistazo a éste.
|
||||
<P>
|
||||
<P>
|
||||
</LI>
|
||||
<LI>David Monniaux informa:
|
||||
<BLOCKQUOTE>
|
||||
He empezado un sistema de atamiento gtk-O'Caml. Las bases del sistema,
|
||||
incluyendo <EM>callbacks</EM>, funcionan bien.
|
||||
|
||||
El desarrollo actual se encuentra en
|
||||
<A HREF="http://www.ens-lyon.fr/~dmonniau/arcs">http://www.ens-lyon.fr/~dmonniau/arcs</A></BLOCKQUOTE>
|
||||
|
||||
</LI>
|
||||
<LI>Se han hecho varios atamientos para python:
|
||||
<P>
|
||||
<UL>
|
||||
<LI>pygtk se encuentra en
|
||||
<A HREF="http://www.daa.com.au/~james/pygtk">http://www.daa.com.au/~james/pygtk</A> y
|
||||
<A HREF="ftp://ftp.gtk.org/pub/gtk/python">ftp://ftp.gtk.org/pub/gtk/python</A></LI>
|
||||
<LI>python-gtk se encuentra en
|
||||
<A HREF="http://www.ucalgary.ca/~nascheme/python-gtk">http://www.ucalgary.ca/~nascheme/python-gtk</A></LI>
|
||||
</UL>
|
||||
<P>
|
||||
</LI>
|
||||
<LI>Hay un <EM>widget</EM> disponible para GTK+. Agárrelo en
|
||||
<A HREF="http://www.sakuranet.or.jp/~aozasa/shige/doc/comp/gtk/gtkGL/files-en.html">http://www.sakuranet.or.jp/~aozasa/shige/doc/comp/gtk/gtkGL/files-en.html</A>
|
||||
</LI>
|
||||
</UL>
|
||||
<P>
|
||||
<HR NOSHADE>
|
||||
<A HREF="gtkfaq-es-4.html">Next</A>
|
||||
<A HREF="gtkfaq-es-2.html">Previous</A>
|
||||
<A HREF="gtkfaq-es.html#toc3">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -0,0 +1,435 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.6">
|
||||
<TITLE>GTK+ FAQ: Desarrollo con GTK+</TITLE>
|
||||
<LINK HREF="gtkfaq-es-5.html" REL=next>
|
||||
<LINK HREF="gtkfaq-es-3.html" REL=previous>
|
||||
<LINK HREF="gtkfaq-es.html#toc4" REL=contents>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<A HREF="gtkfaq-es-5.html">Next</A>
|
||||
<A HREF="gtkfaq-es-3.html">Previous</A>
|
||||
<A HREF="gtkfaq-es.html#toc4">Contents</A>
|
||||
<HR NOSHADE>
|
||||
<H2><A NAME="s4">4. Desarrollo con GTK+</A></H2>
|
||||
|
||||
<H2><A NAME="ss4.1">4.1 ¿Cómo empiezo?</A>
|
||||
</H2>
|
||||
|
||||
<P>Después de que ha instalado GTK+, hay un par de cosas que pueden
|
||||
facilitarle el desarrollo de aplicaciones con él. Está el Tutor de
|
||||
GTK+
|
||||
<A HREF="http://www.gtk.org/tutorial/"><http://www.gtk.org/tutorial/></A>, el cual está en desarrollo
|
||||
activo. Este tutorial le introducirá en la escritura de aplicaciones
|
||||
utilizando C.
|
||||
<P>El Tutor no contiene (todavía) información sobre todos los
|
||||
<EM>widgets</EM> que existen en GTK+. Para código de ejemplo sobre la
|
||||
utilización básica de todos los <EM>widgets</EM> de GTK+, debe ver
|
||||
el archivo gtk/testgtk.c (y archivos fuentes asociados) en la distribución
|
||||
GTK+. Ver estos ejemplos le dará una buena base sobre lo que pueden hacer
|
||||
los <EM>widgets</EM>.
|
||||
<P>
|
||||
<H2><A NAME="ss4.2">4.2 ¿Qué <EM>widgets</EM> existen en GTK?</A>
|
||||
</H2>
|
||||
|
||||
<P>El Tutor de GTK+ lista los siguientes <EM>widgets</EM>:
|
||||
<PRE>
|
||||
GtkObject
|
||||
+GtkData
|
||||
| +GtkAdjustment
|
||||
| `GtkTooltips
|
||||
`GtkWidget
|
||||
+GtkContainer
|
||||
| +GtkBin
|
||||
| | +GtkAlignment
|
||||
| | +GtkEventBox
|
||||
| | +GtkFrame
|
||||
| | | `GtkAspectFrame
|
||||
| | +GtkHandleBox
|
||||
| | +GtkItem
|
||||
| | | +GtkListItem
|
||||
| | | +GtkMenuItem
|
||||
| | | | `GtkCheckMenuItem
|
||||
| | | | `GtkRadioMenuItem
|
||||
| | | `GtkTreeItem
|
||||
| | +GtkViewport
|
||||
| | `GtkWindow
|
||||
| | +GtkColorSelectionDialog
|
||||
| | +GtkDialog
|
||||
| | | `GtkInputDialog
|
||||
| | `GtkFileSelection
|
||||
| +GtkBox
|
||||
| | +GtkButtonBox
|
||||
| | | +GtkHButtonBox
|
||||
| | | `GtkVButtonBox
|
||||
| | +GtkHBox
|
||||
| | | +GtkCombo
|
||||
| | | `GtkStatusbar
|
||||
| | `GtkVBox
|
||||
| | +GtkColorSelection
|
||||
| | `GtkGammaCurve
|
||||
| +GtkButton
|
||||
| | +GtkOptionMenu
|
||||
| | `GtkToggleButton
|
||||
| | `GtkCheckButton
|
||||
| | `GtkRadioButton
|
||||
| +GtkCList
|
||||
| `GtkCTree
|
||||
| +GtkFixed
|
||||
| +GtkList
|
||||
| +GtkMenuShell
|
||||
| | +GtkMenuBar
|
||||
| | `GtkMenu
|
||||
| +GtkNotebook
|
||||
| +GtkPaned
|
||||
| | +GtkHPaned
|
||||
| | `GtkVPaned
|
||||
| +GtkScrolledWindow
|
||||
| +GtkTable
|
||||
| +GtkToolbar
|
||||
| `GtkTree
|
||||
+GtkDrawingArea
|
||||
| `GtkCurve
|
||||
+GtkEditable
|
||||
| +GtkEntry
|
||||
| | `GtkSpinButton
|
||||
| `GtkText
|
||||
+GtkMisc
|
||||
| +GtkArrow
|
||||
| +GtkImage
|
||||
| +GtkLabel
|
||||
| | `GtkTipsQuery
|
||||
| `GtkPixmap
|
||||
+GtkPreview
|
||||
+GtkProgressBar
|
||||
+GtkRange
|
||||
| +GtkScale
|
||||
| | +GtkHScale
|
||||
| | `GtkVScale
|
||||
| `GtkScrollbar
|
||||
| +GtkHScrollbar
|
||||
| `GtkVScrollbar
|
||||
+GtkRuler
|
||||
| +GtkHRuler
|
||||
| `GtkVRuler
|
||||
`GtkSeparator
|
||||
+GtkHSeparator
|
||||
`GtkVSeparator
|
||||
</PRE>
|
||||
<P>
|
||||
<H2><A NAME="ss4.3">4.3 ¿GTK+ es seguro ante múltiples hilos?</A>
|
||||
</H2>
|
||||
|
||||
<P>Aunque GTK+, como la mayoría de los juegos de herramientas para X,
|
||||
no es seguro ante múltiples hilos, esto no prohibe el desarrollo de
|
||||
aplicaciones con múltiples hilos con GTK+.
|
||||
<P>Rob Browning (rlb@cs.utexas.edu) describe técnicas de hilamiento
|
||||
que pueden utilizarse con GTK+ (levemente modificado):
|
||||
<P>Básicamente existen dos enfoques principales, el primero es sencillo,
|
||||
y el segundo complicado. En el primero, simplemente hay que asegurarse
|
||||
de que todas las interacciones de GTK+ (o X) se manejan por un, y solo un,
|
||||
hilo. Cualquier otro hilo que desee dibujar algo tiene que notificarlo de
|
||||
alguna manera al hilo "GTK+", y dejarlo que maneje el trabajo real.
|
||||
<P>El segundo enfoque le permite llamar funciones de GTK+ (o X) desde cualquier
|
||||
hilo, pero requiere sincronización cuidadosa. La idea básica es crear
|
||||
una exclusión mutua de protección para X, de manera que nadie haga
|
||||
llamadas X sin primero adquirir esta exclusión mutua.
|
||||
<P>Observe que se trata de un pequeño esfuerzo, pero que le permitirá ser
|
||||
potencialmente más eficiente que un GTK+ completamente seguro ante
|
||||
múltiples hilos. Usted decide la granularidad del bloqueo de hilos.
|
||||
También debe asegurarse que el hilo que llama a gtk_main mantiene la
|
||||
cerradura cuando llama a gtk_main.
|
||||
<P>Lo siguiente por lo que hay que preocuparse ya que se tenía agarrada
|
||||
la exclusión mutua global cuando se entró a gtk_main, es que todos
|
||||
los <EM>callbacks</EM> también la tendrán. Esto significa que el
|
||||
<EM>callback</EM> debe soltarla si va a llamar a cualquier otro código
|
||||
que pueda readquirirla. De otra manera obtendrá un bloqueo mortal.
|
||||
También hay que tener agarrada la exclusión mutua cuando finalmente
|
||||
regresa del <EM>callback</EM>.
|
||||
<P>Para permitir a otros hilos, además del que llama a gtk_main, tener
|
||||
acceso a la exclusión mutua, necesitamos registrar una función de
|
||||
trabajo con GTK que nos permita liberar la exclusión mutua
|
||||
periódicamente.
|
||||
<P>¿Por qué GTK+ no puede ser seguro ante múltiples hilos de
|
||||
manera nativa?
|
||||
<P>Complejidad, sobrecarga, y mano de obra. La proporción de programas
|
||||
con hilos es todavía razonablemente pequeña, y conseguir seguridad
|
||||
ante hilos es muy difícil y le quita tiempo valioso al trabajo
|
||||
principal de obtener una buena librería gráfica terminada. Sería
|
||||
muy agradable que GTK+ fuera seguro ante hilos "al sacarlo de la caja",
|
||||
pero no es práctico ahora mismo, y haría a GTK+ sustancialmente menos
|
||||
eficiente si no se maneja cuidadosamente.
|
||||
<P>De cualquier manera, no es una prioridad esencial ya que existen remedios
|
||||
relativamente buenos.
|
||||
<P>
|
||||
<H2><A NAME="ss4.4">4.4 ¿Cómo puedo prevenir el redibujar y reacomodar tamaños mientras cambio múltiples <EM>widgets</EM>?</A>
|
||||
</H2>
|
||||
|
||||
<P>
|
||||
Utilize gtk_container_disable_resize y gtk_container_enable_resize alrededor
|
||||
del código donde quiere cambiar varias cosas. Esto resultará en mayor
|
||||
velocidad ya que prevendrá tener que darle el tamaño otra vez a la
|
||||
jerarquía de <EM>widget</EM> por completo.
|
||||
<P>
|
||||
<H2><A NAME="ss4.5">4.5 ¿Cómo atrapo un evento de doble tecleo (en un <EM>widget</EM> de lista, por ejemplo)?</A>
|
||||
</H2>
|
||||
|
||||
<P>Tim Janik escribió a la lista gtk-list (ligeramente modificado):
|
||||
<P>Defina un manejador de señal:
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
gint
|
||||
signal_handler_event(GtkWiget *widget, GdkEvenButton *event, gpointer func_data)
|
||||
{
|
||||
if (GTK_IS_LIST_ITEM(widget) &&
|
||||
(event->type==GDK_2BUTTON_PRESS ||
|
||||
event->type==GDK_3BUTTON_PRESS) ) {
|
||||
printf("I feel %s clicked on button %d\",
|
||||
event->type==GDK_2BUTTON_PRESS ? "double" : "triple",
|
||||
event->button);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
<P>Y conecte el manejador a su objeto:
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
{
|
||||
/* lista, asuntos de inicializacion de articulos de lista */
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(list_item),
|
||||
"button_press_event",
|
||||
GTK_SIGNAL_FUNC(signal_handler_event),
|
||||
NULL);
|
||||
|
||||
/* y/o */
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(list_item),
|
||||
"button_release_event",
|
||||
GTK_SIGNAL_FUNC(signal_handler_event),
|
||||
NULL);
|
||||
|
||||
/* algo mas */
|
||||
}
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
<P>y, Owen Taylor escribió:
|
||||
<P>Observe que se recibirá la pulsación del botón de antemano, y
|
||||
si está haciendo esto para un botón, también obtendrá una señal
|
||||
de "tecleado" para el botón. (Esto es cierto para cualquier juego de
|
||||
herramientas, ya que las computadoras no son buenas para leer la mente de
|
||||
cada quien.)
|
||||
<P>
|
||||
<H2><A NAME="ss4.6">4.6 ¿Cómo puedo averiguar cuál es la selección de un GtkList?</A>
|
||||
</H2>
|
||||
|
||||
<P>
|
||||
<P>Consiga la selección con algo como esto:
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
GList *sel;
|
||||
sel = GTK_LIST(list)->selection;
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
<P>Así es como GList está definido (sacado de glist.h):
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
typedef struct _GList GList;
|
||||
|
||||
struct _GList
|
||||
{
|
||||
gpointer data;
|
||||
GList *next;
|
||||
GList *prev;
|
||||
};
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
<P>Una estructura GList es simplemente una estructura para listas doblemente
|
||||
enlazadas. Existen varias funciones g_list_*() para modificar una lista
|
||||
enlazada en glib.h. Sin embargo, la selección GTK_LIST(MyGtkList)->selection
|
||||
es mantenida por las funciones gtk_list_*() y no deben ser modificadas.
|
||||
<P>El selection_mode del GtkList determina las facilidades de selección de un
|
||||
GtkList y por lo tanto los contenidos de GTK_LIST(AnyGtkList)->selection:
|
||||
<P>
|
||||
<PRE>
|
||||
selection_mode GTK_LIST()->selection contents
|
||||
------------------------------------------------------
|
||||
|
||||
GTK_SELECTION_SINGLE) la selección es NULL
|
||||
o contiene un puntero GList*
|
||||
para un artículo seleccionado individualmente
|
||||
|
||||
GTK_SELECTION_BROWSE) la selección es NULL si la lista
|
||||
no contiene widgets, de otra manera
|
||||
contiene un puntero GList*
|
||||
para una estructura GList.
|
||||
GTK_SELECTION_MULTIPLE) la selección es NULL si no se seleccionan
|
||||
listitems para un apuntador GList*
|
||||
para el primer artículo seleccionado. Eso en
|
||||
su lugar apunta a una estructura GList para el
|
||||
segundo artículo seleccionado y continúa
|
||||
|
||||
GTK_SELECTION_EXTENDED) la selección es NULL.
|
||||
</PRE>
|
||||
<P>El campo data de la estructura GList GTK_LIST(MyGtkList)->selection apunta
|
||||
al primer GtkListItem que es seleccionado. De manera que si quiere determinar
|
||||
cuales listitems están seleccionados debe hacer esto:
|
||||
<P>Durante la in>
|
||||
<HR><H3>Transfer interrupted!</H3>
|
||||
>
|
||||
{
|
||||
gchar *list_items[]={
|
||||
"Item0",
|
||||
"Item1",
|
||||
"foo",
|
||||
"last Item",
|
||||
};
|
||||
guint nlist_items=sizeof(list_items)/sizeof(list_items[0]);
|
||||
GtkWidget *list_item;
|
||||
guint i;
|
||||
|
||||
list=gtk_list_new();
|
||||
gtk_list_set_selection_mode(GTK_LIST(list), GTK_SELECTION_MULTIPLE);
|
||||
gtk_container_add(GTK_CONTAINER(AnyGtkContainer), list);
|
||||
gtk_widget_show (list);
|
||||
|
||||
for (i = 0; i < nlist_items; i++)
|
||||
{
|
||||
list_item=gtk_list_item_new_with_label(list_items[i]);
|
||||
gtk_object_set_user_data(GTK_OBJECT(list_item), (gpointer)i);
|
||||
gtk_container_add(GTK_CONTAINER(list), list_item);
|
||||
gtk_widget_show(list_item);
|
||||
}
|
||||
}
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
<P>Para tener conocimiento de la inicialización:
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
{
|
||||
GList *items;
|
||||
|
||||
items=GTK_LIST(list)->selection;
|
||||
|
||||
printf("Selected Items: ");
|
||||
while (items) {
|
||||
if (GTK_IS_LIST_ITEM(items->data))
|
||||
printf("%d ", (guint)
|
||||
gtk_object_get_user_data(items->data));
|
||||
items=items->next;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
<H2><A NAME="ss4.7">4.7 ¿Acaso es posible desplegar un texto que se recorte para que quepa dentro del lugar que tenga asignado?</A>
|
||||
</H2>
|
||||
|
||||
<P>El comportamiento de GTK+ (sin recorte) es una consecuencia de sus intentos
|
||||
para conservar recursos de X. Los <EM>widgets</EM> etiqueta (entre otros) no
|
||||
tienen su propia ventana X - simplemente dibujan su contenido en la ventana
|
||||
de su padre. Aunque sería posible hacer que ocurran recortes al establecer
|
||||
la máscara de recorte antes de dibujar el texto, esto podría causar una
|
||||
penalización substancial en el rendimiento.
|
||||
<P>Es posible que, a largo plazo, la mejor solución a tales problemas sea
|
||||
simplemente cambiar gtk para que le de ventanas X a las etiquetas. Un remedio
|
||||
a corto plazo es poner el <EM>widget</EM> de etiqueta dentro de otro
|
||||
<EM>widget</EM> que sí obtiene su propia ventana - un candidato posible puede ser el <EM>widget</EM> <EM>viewport</EM>.
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
viewport = gtk_viewport (NULL, NULL);
|
||||
gtk_widget_set_usize (viewport, 50, 25);
|
||||
gtk_viewport_set_shadow_type (GTK_VIEWPORT(viewport), GTK_SHADOW_NONE);
|
||||
gtk_widget_show(viewport);
|
||||
|
||||
label = gtk_label ("a really long label that won't fit");
|
||||
gtk_container_add (GTK_CONTAINER(viewport), label);
|
||||
gtk_widget_show (label);
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
<P>Si estuviera haciendo esto para un montón de <EM>widgets</EM>, querrá
|
||||
copiar gtkviewport.c y arrancar la funcionalidad de sombra y ajuste (tal vez
|
||||
quiera llamarlo GtkClipper).
|
||||
<P>
|
||||
<H2><A NAME="ss4.8">4.8 ¿Por qué el contenido de un botón no se mueve al presionar el botón? Aquí les envío un parche para que funcione de esa forma...</A>
|
||||
</H2>
|
||||
|
||||
<P>De: Peter Mattis
|
||||
<P>La razón por la cuál los botones no mueven a su hijo abajo y a la derecha
|
||||
cuando son presionados es porque no me parece que eso es lo que ocurre
|
||||
visualmente. Mi visión de los botonos es que los miras de manera recta.
|
||||
O sea, la interface de usuario tiende sobre un plano y tú estás sobre
|
||||
él observándolo de manera recta. Cuando un botón es presionado se
|
||||
mueve directamente lejos de tí. Para ser absolutamente correcto supongo
|
||||
que el hijo debería encojerse un poquito. Pero no veo por qué el hijo
|
||||
debería moverse abajo y a la izquierda. Recurda, el hijo se supone que
|
||||
está pegado a la superficie del botón. No es bueno que luzca como si
|
||||
el hijo se resbala sobre la superficie del botón.
|
||||
<P>En una nota más práctica, ya implanté esto una vez y determiné
|
||||
que no se veía bien y lo quité.
|
||||
<P>
|
||||
<H2><A NAME="ss4.9">4.9 ¿Cómo puedo definir una línea de separación como en un menú?</A>
|
||||
</H2>
|
||||
|
||||
<P>Revise el
|
||||
<A HREF="http://www.gtk.org/tutorial/">Tutor</A> para información sobre como crear menús.
|
||||
<P>Sin embargo, para crear una línea de separación en un menú,
|
||||
simplemente inserte un artículo de menú vacío:
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
menuitem = gtk_menu_item_new();
|
||||
gtk_menu_append(GTK_MENU(menu), menuitem);
|
||||
gtk_widget_show(menuitem);
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
<P>
|
||||
<H2><A NAME="ss4.10">4.10 ¿Cómo puedo darle justificación a la derecha a un menú, como Help, cuando utilizo MenuFactory?</A>
|
||||
</H2>
|
||||
|
||||
<P>Utilice algo como lo que sigue:
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
menu_path = gtk_menu_factory_find (factory, "<MyApp>/Help");
|
||||
gtk_menu_item_right_justify(menu_path->widget);
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
<H2><A NAME="ss4.11">4.11 ¿Cómo hago mi ventana modal? / ¿Cómo hago una sóla ventana activa?</A>
|
||||
</H2>
|
||||
|
||||
<P>Después de haber creado su ventana, haga gtk_grab_add(my_window). Y
|
||||
después de cerrar la ventana haga gtk_grab_remove(my_window).
|
||||
<P>
|
||||
<H2><A NAME="ss4.12">4.12 ¿Por qué mi <EM>widget</EM> (ej. progressbar) no se actualiza?</A>
|
||||
</H2>
|
||||
|
||||
<P>
|
||||
<P>Probablemente usted está haciendo todos los cambios dentro de una función
|
||||
sin devolver el control a gtk_main. La mayoría de las actualizaciones de
|
||||
dibujo se colocan simplemente en una cola, la cual es procesada dentro de
|
||||
gtk_main. Puede forzar que se procese la cola de dibujado utilizando algo como:
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
while (gtk_events_pending())
|
||||
gtk_main_iteration();
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
<P>dentro de la función que cambia el <EM>widget</EM>.
|
||||
<P>Lo que el fragmento anterior hace es correr todos los eventos pendientes y
|
||||
funciones ociosas de alta prioridad, luego regresa de inmediato (el dibujado
|
||||
se realiza en una función ociosa de alta prioridad).
|
||||
<P>
|
||||
<HR NOSHADE>
|
||||
<A HREF="gtkfaq-es-5.html">Next</A>
|
||||
<A HREF="gtkfaq-es-3.html">Previous</A>
|
||||
<A HREF="gtkfaq-es.html#toc4">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -0,0 +1,92 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.6">
|
||||
<TITLE>GTK+ FAQ: Acerca de gdk</TITLE>
|
||||
<LINK HREF="gtkfaq-es-6.html" REL=next>
|
||||
<LINK HREF="gtkfaq-es-4.html" REL=previous>
|
||||
<LINK HREF="gtkfaq-es.html#toc5" REL=contents>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<A HREF="gtkfaq-es-6.html">Next</A>
|
||||
<A HREF="gtkfaq-es-4.html">Previous</A>
|
||||
<A HREF="gtkfaq-es.html#toc5">Contents</A>
|
||||
<HR NOSHADE>
|
||||
<H2><A NAME="s5">5. Acerca de gdk</A></H2>
|
||||
|
||||
<H2><A NAME="ss5.1">5.1 ¿Qué es gdk?</A>
|
||||
</H2>
|
||||
|
||||
<P>gdk es básicamente una envoltura alrededor de las llamadas a funciones
|
||||
Xlib. Si estás familiarizado con Xlib, muchas de las funciones en gdk
|
||||
requerirán poco o ningún tiempo para acostumbrarse.
|
||||
Todas las funciones están escritas para proporcionar una manera fácil de
|
||||
acceder a las funciones Xlib en una manera un poco más intuitiva.
|
||||
Adicionalmente, ya que gdk utiliza glib (vea abajo), será más portable
|
||||
y seguro de utilizar en
|
||||
múltiples plataformas.
|
||||
<P>
|
||||
<P>
|
||||
<H2><A NAME="ss5.2">5.2 ¿Cómo utilizo la asignación de colores?</A>
|
||||
</H2>
|
||||
|
||||
<P>Una de las cosas agradables de GDK es que está basado sobre Xlib; esto
|
||||
también es un problema, especialmente en el área de administración
|
||||
de colores. Si usted quiere utilizar color en su programa (dibujando un
|
||||
rectángulo o algo por el estilo, su código debe lucir algo así:
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
{
|
||||
GdkColor *color;
|
||||
int width, height;
|
||||
GtkWidget *widget;
|
||||
GdkGC *gc;
|
||||
|
||||
...
|
||||
|
||||
/* primero, cree un GC (contexto grafico) en el cual dibujar */
|
||||
gc = gdk_gc_new(widget->window);
|
||||
|
||||
/* encuentre las dimensiones correctas para el rectangulo */
|
||||
gdk_window_get_size(widget->window, &width, &height);
|
||||
|
||||
/* el color que queremos utilizar */
|
||||
color = (GdkColor *)malloc(sizeof(GdkColor));
|
||||
|
||||
/* rojo, verde y azul son valores pasados, indicando el trio RGB
|
||||
* del color que queremos dibujar. Note que los valores de los componentes
|
||||
* RGB dentro de GdkColor son tomados de 0 a 65535, no de 0 a 255.
|
||||
*/
|
||||
color->red = red * (65535/255);
|
||||
color->green = green * (65535/255);
|
||||
color->blue = blue * (65535/255);
|
||||
|
||||
/* el valor de pixel indica el indice en el mapa de colores del color.
|
||||
* simplemente es una combinacion de los valores RGB colocados anteriormente
|
||||
*/
|
||||
color->pixel = (gulong)(red*65536 + green*256 + blue);
|
||||
|
||||
/* Sin embargo, el valor de pixel es solo valido en dispositivos de 24-bit
|
||||
* (color verdadero). Por lo tanto, esta llamada es requerida para que GDK
|
||||
* y X puedan darnos el color mas cercano disponible en el mapa de colores
|
||||
*/
|
||||
gdk_color_alloc(gtk_widget_get_colormap(widget), color);
|
||||
|
||||
/* colocar la parte delantera a nuestro color */
|
||||
gdk_gc_set_foreground(gc, color);
|
||||
|
||||
/* dibujar el rectangulo*/
|
||||
gdk_draw_rectangle(widget->window, gc, 1, 0, 0, width, height);
|
||||
|
||||
...
|
||||
}
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
<P>
|
||||
<HR NOSHADE>
|
||||
<A HREF="gtkfaq-es-6.html">Next</A>
|
||||
<A HREF="gtkfaq-es-4.html">Previous</A>
|
||||
<A HREF="gtkfaq-es.html#toc5">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -0,0 +1,64 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.6">
|
||||
<TITLE>GTK+ FAQ: Acerca de glib</TITLE>
|
||||
<LINK HREF="gtkfaq-es-7.html" REL=next>
|
||||
<LINK HREF="gtkfaq-es-5.html" REL=previous>
|
||||
<LINK HREF="gtkfaq-es.html#toc6" REL=contents>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<A HREF="gtkfaq-es-7.html">Next</A>
|
||||
<A HREF="gtkfaq-es-5.html">Previous</A>
|
||||
<A HREF="gtkfaq-es.html#toc6">Contents</A>
|
||||
<HR NOSHADE>
|
||||
<H2><A NAME="s6">6. Acerca de glib</A></H2>
|
||||
|
||||
<H2><A NAME="ss6.1">6.1 ¿Qué es glib?</A>
|
||||
</H2>
|
||||
|
||||
<P>glib es una librería de funciones y definiciones útiles disponibles
|
||||
para ser utilizadas cuando se crean aplicaciones GDK y GTK. Proporciona
|
||||
reemplazos para algunas funciones estándar de libc, como malloc, las
|
||||
cuales tienen errores en algunos sistemas.
|
||||
<P>También proporciona rutinas para manejar:
|
||||
<UL>
|
||||
<LI>Listas Doblemente Enlazadas</LI>
|
||||
<LI>Listas con Enlace Sencillo</LI>
|
||||
<LI>Cronómetros</LI>
|
||||
<LI>Manipulación de cadenas</LI>
|
||||
<LI>Un Analizador Léxico</LI>
|
||||
<LI>Funciones de Error</LI>
|
||||
</UL>
|
||||
<P>
|
||||
<P>
|
||||
<H2><A NAME="ss6.2">6.2 ¿Por qué utilizar g_print, g_malloc, g_strdup y funciones compañeras de glib?</A>
|
||||
</H2>
|
||||
|
||||
<P>Gracias a Tim Janik que escribió a gtk-list: (ligeramente modificado)
|
||||
<BLOCKQUOTE>
|
||||
Con respecto a g_malloc(), g_free() y hermanos, estas funciones son más
|
||||
seguras que sus equivalentes en libc. Por ejemplo, g_free() solo regresa si
|
||||
se llama con NULL. También, si se define USE_DMALLOC, la definición para
|
||||
estas funciones cambia (en glib.h) para utilizar MALLOC(), FREE() etc... Si
|
||||
MEM_PROFILE o MEM_CHECK se definen, hay incluso pequeñas estadísticas
|
||||
realizadas las cuales cuentan los tamaños de los bloques (mostrado por
|
||||
g_mem_profile() / g_mem_check()).
|
||||
<P>Considerando el hecho de que glib provee una interface para salvar espacio en
|
||||
pedazos de memoria si se tiene varios bloques que son siempre del mismo
|
||||
tamaño y para marcarlos ALLOC_ONLY si es necesario, es sencillo crear
|
||||
una pequeña envoltura para salvar (revisable para errores) alrededor del
|
||||
malloc/free normal asimismo - igual que gdk cubre Xlib. ;)
|
||||
<P>Utilizar g_error() y g_warning() dentro de aplicaciones como GIMP las cuales
|
||||
utilizan gtk por completo incluso da la oportunidad de hacer saltar una ventana
|
||||
que muestre los mensajes dentro de una ventana gtk con tu propio handler
|
||||
(utilizando g_set_error_handler()) con el mismo estilo que gtk_print()
|
||||
(dentro de gtkmain.c).
|
||||
</BLOCKQUOTE>
|
||||
<P>
|
||||
<HR NOSHADE>
|
||||
<A HREF="gtkfaq-es-7.html">Next</A>
|
||||
<A HREF="gtkfaq-es-5.html">Previous</A>
|
||||
<A HREF="gtkfaq-es.html#toc6">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -0,0 +1,80 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.6">
|
||||
<TITLE>GTK+ FAQ: Contribuciones al GTK+ FAQ, Mantenedores y Copyright</TITLE>
|
||||
<LINK HREF="gtkfaq-es-6.html" REL=previous>
|
||||
<LINK HREF="gtkfaq-es.html#toc7" REL=contents>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
Next
|
||||
<A HREF="gtkfaq-es-6.html">Previous</A>
|
||||
<A HREF="gtkfaq-es.html#toc7">Contents</A>
|
||||
<HR NOSHADE>
|
||||
<H2><A NAME="s7">7. Contribuciones al GTK+ FAQ, Mantenedores y Copyright</A></H2>
|
||||
|
||||
<P>Si desea hacer una contribución al FAQ, envíe a alguno de nosotros
|
||||
un mensaje por correo electrónico con el texto exacto que cree que
|
||||
debería ser incluído (pregunta y respuesta). ¡Con su ayuda, este
|
||||
documento puede crecer y llegar a ser más útil!
|
||||
<P>Este documento es mantenido por Nathan Froyd
|
||||
<A HREF="mailto:maestrox@geocities.com"><maestrox@geocities.com></A>
|
||||
y Tony Gale
|
||||
<A HREF="mailto:gale@gimp.org"><gale@gimp.org></A>.
|
||||
Este FAQ fue creado por Shawn T. Amundson
|
||||
<A HREF="mailto:amundson@gimp.org"><amundson@gimp.org></A> quien continúa dando soporte.
|
||||
<P>El GTK+ FAQ está registrado Copyright (C) 1997, 1998 por Shawn T. Amundson,
|
||||
Nathan Froyd y tony Gale.
|
||||
<P>Se otorga permiso para hacer y distribuír copias textuales de este manual
|
||||
siempre y cuando la información de copyright y este permiso se preserven en
|
||||
todas las copias.
|
||||
<P>Se otorga permiso para copiar y distribuir versiones modificados de este
|
||||
documento bajo las condiciones para copiado textual, siempre y cuando esta
|
||||
noticia de copyright se incluya exáctamente como en el original, y
|
||||
que el trabajo resultante en su totalidad sea distribuído bajo los
|
||||
términos de una noticia de permiso idéntica a esta.
|
||||
<P>Se otorga permiso para copiar y distribuír traducciones de este documento
|
||||
a otro lenguaje, bajo las condiciones anteriores de versiones modificadas.
|
||||
<P>Si tiene intenciones de incorporar este documento en un trabajo publicado,
|
||||
por favor contacte a uno de los mantenedores, y nos aseguraremos de que
|
||||
obtenga la información más actual posible.
|
||||
<P>No hay garantía de que este documento logre su propósito. Este documento
|
||||
se proporciona simplemente como un recurso libre. Como tal, los autores y
|
||||
mantenedores de la información proporcionada en él no pueden dar
|
||||
garantía alguna de que la información es precisa.
|
||||
<P>
|
||||
<H2><A NAME="ss7.1">7.1 Nota del Traductor</A>
|
||||
</H2>
|
||||
|
||||
<P>Esta traducción fue realizada por
|
||||
<A HREF="http://www.talisman.com.pa">Ramsés Morales</A>.
|
||||
He intentado hacer
|
||||
la mejor adaptación posible de los términos técnicos, si tiene
|
||||
alguna sugerencia o mejora a estos términos y mi español, o alguna
|
||||
duda por causa de mi traducción, no dude en comunicármelo a
|
||||
<A HREF="mailto:ramses@computer.org"><ramses@computer.org></A><P>Gracias a
|
||||
<A HREF="mailto: e98cuenc@criens.u-psud.fr">Joaquín Cuenca</A> por todas sus sugerencias para mejorar la
|
||||
traducción, fueron de gran ayuda.
|
||||
<P>--------------------------------------
|
||||
<P>The GTK+ FAQ is Copyright (C) 1997,1998 by Shawn T. Amundson, Nathan Froyd and Tony Gale.
|
||||
<P>Permission is granted to make and distribute verbatim copies of this manual provided the
|
||||
copyright notice and this permission notice are preserved on all copies.
|
||||
<P>Permission is granted to copy and distribute modified versions of this document under the conditions
|
||||
for verbatim copying, provided that this copyright notice is included exactly as in the original,
|
||||
and that the entire resulting derived work is distributed under the terms of a permission
|
||||
notice identical to this one.
|
||||
<P>Permission is granted to copy and distribute translations of this document into another language,
|
||||
under the above conditions for modified versions.
|
||||
<P>If you are intending to incorporate this document into a published work, please contact one of
|
||||
the maintainers, and we will make an effort to ensure that you have the most up to date
|
||||
information available.
|
||||
<P>There is no guarentee that this document lives up to its intended
|
||||
purpose. This is simply provided as a free resource. As such,
|
||||
the authors and maintainers of the information provided within can
|
||||
not make any guarentee that the information is even accurate.
|
||||
<HR NOSHADE>
|
||||
Next
|
||||
<A HREF="gtkfaq-es-6.html">Previous</A>
|
||||
<A HREF="gtkfaq-es.html#toc7">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -0,0 +1,103 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.6">
|
||||
<TITLE>GTK+ FAQ</TITLE>
|
||||
<LINK HREF="gtkfaq-es-1.html" REL=next>
|
||||
|
||||
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<A HREF="gtkfaq-es-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
<HR NOSHADE>
|
||||
<H1>GTK+ FAQ</H1>
|
||||
|
||||
|
||||
<H2>Nathan Froyd, Tony Gale, Shawn T. Amundson.</H2>Seis de Julio de 1998
|
||||
<P><HR NOSHADE>
|
||||
<EM>La intención de este documento es dar respuesta a las preguntas
|
||||
realizadas con más frecuencia por parte de los programadores que utilizan GTK+ o simplemente por personas que desean utilizar GTK+. </EM>
|
||||
<HR NOSHADE>
|
||||
<P>
|
||||
<H2><A NAME="toc1">1.</A> <A HREF="gtkfaq-es-1.html">Información General</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.1">1.1 Autores</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.2">1.2 ¿Qué es GTK+?</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.3">1.3 ¿Qué es el + en GTK+?</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.4">1.4 ¿La G en GTK+ significa General, Gimp, o GNU?</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.5">1.5 ¿Dónde está la documentación para GTK?</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.6">1.6 ¿Hay alguna lista de correo (o archivo de lista de correo) para GTK+?</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.7">1.7 ¿La lista gtk-list no ha tenido tráfico alguno por días,</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.8">1.8 Cómo conseguir ayuda con GTK+</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.9">1.9 Cómo reportar errores en GTK+</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.10">1.10 ¿Qué aplicaciones se han escrito con GTK+?</A>
|
||||
<LI><A HREF="gtkfaq-es-1.html#ss1.11">1.11 Estoy buscando una aplicación que escribir en GTK+. ¿Qué tal un cliente IRC?</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc2">2.</A> <A HREF="gtkfaq-es-2.html">Cómo encontrar, configurar, instalar y comprobar GTK+</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="gtkfaq-es-2.html#ss2.1">2.1 ¿Qué necesito para correr GTK+?</A>
|
||||
<LI><A HREF="gtkfaq-es-2.html#ss2.2">2.2 ¿Dónde puedo conseguir GTK+?</A>
|
||||
<LI><A HREF="gtkfaq-es-2.html#ss2.3">2.3 ¿Cómo configuro/compilo GTK+?</A>
|
||||
<LI><A HREF="gtkfaq-es-2.html#ss2.4">2.4 Cuando compilo GTK+ obtengo un error como: <CODE>make: file `Makefile' line 456: Syntax error</CODE></A>
|
||||
<LI><A HREF="gtkfaq-es-2.html#ss2.5">2.5 ¡He compilado e instalado GTK+, pero no puedo lograr que los programas se enlacen con él!</A>
|
||||
<LI><A HREF="gtkfaq-es-2.html#ss2.6">2.6 Cuando compilo programas con GTK+, obtengo mensajes de error del compilador diciendo que no es capaz de encontrar <CODE>"glibconfig.h"</CODE>.</A>
|
||||
<LI><A HREF="gtkfaq-es-2.html#ss2.7">2.7 Cuando instalo El GIMP, configure reporta que no puede encontrar GTK.</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc3">3.</A> <A HREF="gtkfaq-es-3.html">Desarrollo de GTK+</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="gtkfaq-es-3.html#ss3.1">3.1 ¿Qué es esta cosa CVS de la cual todo el mundo habla, y cómo puedo acceder a ella?</A>
|
||||
<LI><A HREF="gtkfaq-es-3.html#ss3.2">3.2 ¿Cómo puedo contribuír a GTK+?</A>
|
||||
<LI><A HREF="gtkfaq-es-3.html#ss3.3">3.3 ¿Cómo averiguo si mi parche fue aplicado, y si no, por qué no?</A>
|
||||
<LI><A HREF="gtkfaq-es-3.html#ss3.4">3.4 ¿Cuál es la política sobre la incorporación de nuevos <EM>widgets</EM> en la librería?</A>
|
||||
<LI><A HREF="gtkfaq-es-3.html#ss3.5">3.5 ¿Hay alguien trabajando en atamientos para otros lenguajes distintos a C?</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc4">4.</A> <A HREF="gtkfaq-es-4.html">Desarrollo con GTK+</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.1">4.1 ¿Cómo empiezo?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.2">4.2 ¿Qué <EM>widgets</EM> existen en GTK?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.3">4.3 ¿GTK+ es seguro ante múltiples hilos?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.4">4.4 ¿Cómo puedo prevenir el redibujar y reacomodar tamaños mientras cambio múltiples <EM>widgets</EM>?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.5">4.5 ¿Cómo atrapo un evento de doble tecleo (en un <EM>widget</EM> de lista, por ejemplo)?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.6">4.6 ¿Cómo puedo averiguar cuál es la selección de un GtkList?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.7">4.7 ¿Acaso es posible desplegar un texto que se recorte para que quepa dentro del lugar que tenga asignado?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.8">4.8 ¿Por qué el contenido de un botón no se mueve al presionar el botón? Aquí les envío un parche para que funcione de esa forma...</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.9">4.9 ¿Cómo puedo definir una línea de separación como en un menú?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.10">4.10 ¿Cómo puedo darle justificación a la derecha a un menú, como Help, cuando utilizo MenuFactory?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.11">4.11 ¿Cómo hago mi ventana modal? / ¿Cómo hago una sóla ventana activa?</A>
|
||||
<LI><A HREF="gtkfaq-es-4.html#ss4.12">4.12 ¿Por qué mi <EM>widget</EM> (ej. progressbar) no se actualiza?</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc5">5.</A> <A HREF="gtkfaq-es-5.html">Acerca de gdk</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="gtkfaq-es-5.html#ss5.1">5.1 ¿Qué es gdk?</A>
|
||||
<LI><A HREF="gtkfaq-es-5.html#ss5.2">5.2 ¿Cómo utilizo la asignación de colores?</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc6">6.</A> <A HREF="gtkfaq-es-6.html">Acerca de glib</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="gtkfaq-es-6.html#ss6.1">6.1 ¿Qué es glib?</A>
|
||||
<LI><A HREF="gtkfaq-es-6.html#ss6.2">6.2 ¿Por qué utilizar g_print, g_malloc, g_strdup y funciones compañeras de glib?</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc7">7.</A> <A HREF="gtkfaq-es-7.html">Contribuciones al GTK+ FAQ, Mantenedores y Copyright</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="gtkfaq-es-7.html#ss7.1">7.1 Nota del Traductor</A>
|
||||
</UL>
|
||||
<HR NOSHADE>
|
||||
<A HREF="gtkfaq-es-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
</BODY>
|
||||
</HTML>
|
||||
+576
-203
File diff suppressed because it is too large
Load Diff
+5
-5
@@ -79,7 +79,7 @@ approved by Peter Mattis.
|
||||
This is edition @value{edition} of the GTK documentation,
|
||||
@w{@value{update-date}}.
|
||||
@end ifinfo
|
||||
@c FIXME: Do a introduction to the GTK?
|
||||
@c FIXME: Do an introduction to the GTK?
|
||||
|
||||
@menu
|
||||
* Copying:: Your rights.
|
||||
@@ -288,7 +288,7 @@ form that is easier to parse. Tools for generating bindings of Gtk to
|
||||
other languages can read these declarations and---because all the
|
||||
important details are defined---automatically generate the bulk of the
|
||||
needed glue code. It is also possible to feed these declarations into a
|
||||
running application (a interface builder, say) and thus make it aware of
|
||||
running application (an interface builder, say) and thus make it aware of
|
||||
new widgets and functions without recompiling anything.
|
||||
|
||||
The run-time side of the type system is also somewhat introspective.
|
||||
@@ -320,7 +320,7 @@ inherit these rules from their fundamental type. For example,
|
||||
derive from @samp{GtkObject} and so the rules for @samp{GtkObject} apply
|
||||
to all widgets as well.
|
||||
|
||||
This derivation defines a type hierachy, but this hierachy is not
|
||||
This derivation defines a type hierarchy, but this hierarchy is not
|
||||
completely general. You can't derive from @samp{int} for example, and
|
||||
you can only have one level of derivation from @samp{enum}. The
|
||||
fundamental type @samp{GtkObject}, however, is the basis for the large
|
||||
@@ -382,7 +382,7 @@ to a fundamental type and thus there is no name for it.
|
||||
|
||||
@deftp {Data type} GtkType
|
||||
The type @code{GtkType} holds the run-time representation of a type. It
|
||||
is a integer of a certain size. The follwing macros are defined to
|
||||
is an integer of a certain size. The follwing macros are defined to
|
||||
access the basic properties of a @code{GtkType}:
|
||||
|
||||
@deftypefn {Macro} {unsigned int} GTK_TYPE_SEQNO (GtkType type)
|
||||
@@ -461,7 +461,7 @@ always return @code{NULL}.
|
||||
@item
|
||||
The @code{class_init_func} and @code{base_class_init_func} fields are
|
||||
callbacks which are used by the type mechanism to initialize class
|
||||
specific fields. The single argument these function taks is a pointer to
|
||||
specific fields. The single argument these functions take is a pointer to
|
||||
a class structure. When you do not need one or both of them, set the
|
||||
corresponding field to @code{NULL}. The @code{class_init_func} will be
|
||||
called at most once, right after the class structure of size
|
||||
|
||||
+604
-12
@@ -11,7 +11,7 @@ Tony Gale <tt><htmlurl url="mailto:gale@gtk.org"
|
||||
name="<gale@gtk.org>"></tt>,
|
||||
Ian Main <tt><htmlurl url="mailto:imain@gtk.org"
|
||||
name="<imain@gtk.org>"></tt>
|
||||
<date>November 13th, 1999
|
||||
<date>February 23rd, 2000
|
||||
<abstract>
|
||||
This is a tutorial on how to use GTK (the GIMP Toolkit) through its C
|
||||
interface.
|
||||
@@ -33,7 +33,7 @@ open software, free software, or even commercial non-free software
|
||||
using GTK without having to spend anything for licenses or royalties.
|
||||
|
||||
It's called the GIMP toolkit because it was originally written for
|
||||
developing the General Image Manipulation Program (GIMP), but GTK has
|
||||
developing the GNU Image Manipulation Program (GIMP), but GTK has
|
||||
now been used in a large number of software projects, including the
|
||||
GNU Network Object Model Environment (GNOME) project. GTK is built on
|
||||
top of GDK (GIMP Drawing Kit) which is basically a wrapper around the
|
||||
@@ -839,15 +839,31 @@ So, by passing in the widget you wish to remove the handler from, and
|
||||
the tag returned by one of the signal_connect functions, you can
|
||||
disconnect a signal handler.
|
||||
|
||||
Another function to remove all the signal handers from an object is:
|
||||
You can also temporarily disable signal handlers with the
|
||||
gtk_signal_handler_block() and gtk_signal_handler_unblock() family of
|
||||
functions.
|
||||
|
||||
<tscreen><verb>
|
||||
void gtk_signal_handlers_destroy( GtkObject *object );
|
||||
</verb></tscreen>
|
||||
void gtk_signal_handler_block( GtkObject *object,
|
||||
guint handler_id );
|
||||
|
||||
This call is fairly self explanatory. It simply removes all the
|
||||
current signal handlers from the object passed in as the first
|
||||
argument.
|
||||
void gtk_signal_handler_block_by_func( GtkObject *object,
|
||||
GtkSignalFunc func,
|
||||
gpointer data );
|
||||
|
||||
void gtk_signal_handler_block_by_data( GtkObject *object,
|
||||
gpointer data );
|
||||
|
||||
void gtk_signal_handler_unblock( GtkObject *object,
|
||||
guint handler_id );
|
||||
|
||||
void gtk_signal_handler_unblock_by_func( GtkObject *object,
|
||||
GtkSignalFunc func,
|
||||
gpointer data );
|
||||
|
||||
void gtk_signal_handler_unblock_by_data( GtkObject *object,
|
||||
gpointer data);
|
||||
</verb></tscreen>
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>An Upgraded Hello World
|
||||
@@ -4842,6 +4858,7 @@ The following code is an example of using an Entry widget.
|
||||
<tscreen><verb>
|
||||
/* example-start entry entry.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
void enter_callback( GtkWidget *widget,
|
||||
@@ -5170,6 +5187,7 @@ It's example time again.
|
||||
<tscreen><verb>
|
||||
/* example-start spinbutton spinbutton.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static GtkWidget *spinner1;
|
||||
@@ -5565,6 +5583,578 @@ gtk_combo_set_item_string(GtkCombo *combo, GtkItem *item, const gchar
|
||||
appropriate Item. Frankly, I have no idea how to do that.
|
||||
-->
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1> Calendar
|
||||
<p>
|
||||
The Calendar widget is an effective way to display and retrieve
|
||||
monthly date related information. It is a very simple widget to create
|
||||
and work with.
|
||||
|
||||
Creating a GtkCalendar widget is a simple as:
|
||||
|
||||
<tscreen><verb>
|
||||
GtkWidget *gtk_calendar_new();
|
||||
</verb></tscreen>
|
||||
|
||||
There might be times where you need to change a lot of information
|
||||
within this widget and the following functions allow you to make
|
||||
multiple change to a Calendar widget without the user seeing multiple
|
||||
on-screen updates.
|
||||
|
||||
<tscreen><verb>
|
||||
void gtk_calendar_freeze( GtkCalendar *Calendar );
|
||||
|
||||
void gtk_calendar_thaw ( GtkCalendar *Calendar );
|
||||
</verb></tscreen>
|
||||
|
||||
They work just like the freeze/thaw functions of every other
|
||||
widget.
|
||||
|
||||
The Calendar widget has a few options that allow you to change the way
|
||||
the widget both looks and operates by using the function
|
||||
|
||||
<tscreen><verb>
|
||||
void gtk_calendar_display_options( GtkCalendar *calendar,
|
||||
GtkCalendarDisplayOptions flags );
|
||||
</verb></tscreen>
|
||||
|
||||
The <tt/flags/ argument can be formed by combining either of the
|
||||
following five options using the logical bitwise OR (|) operation:
|
||||
<itemize>
|
||||
<item> GTK_CALENDAR_SHOW_HEADING - this option specifies that
|
||||
the month and year should be shown when drawing the calendar.
|
||||
<item> GTK_CALENDAR_SHOW_DAY_NAMES - this option specifies that the
|
||||
three letter descriptions should be displayed for each day (eg
|
||||
MON,TUE...).
|
||||
|
||||
<item> GTK_CALENDAR_NO_MONTH_CHANGE - this option states that the user
|
||||
should not and can not change the currently displayed month. This can
|
||||
be good if you only need to display a particular month such as if you
|
||||
are displaying 12 calendar widgets for every month in a particular
|
||||
year.
|
||||
|
||||
<item> GTK_CALENDAR_SHOW_WEEK_NUMBERS - this option specifies that the
|
||||
number for each week should be displayed down the left side of the
|
||||
calendar. (eg. Jan 1 = Week 1,Dec 31 = Week 52).
|
||||
|
||||
<item> GTK_CALENDAR_WEEK_START_MONDAY - this option states that the
|
||||
calander week will start on Monday instead of Sunday which is the
|
||||
default. This only affects the order in which days are displayed from
|
||||
left to right.
|
||||
</itemize>
|
||||
|
||||
The following functions are used to set the the currently displayed
|
||||
date:
|
||||
<tscreen><verb>
|
||||
gint gtk_calendar_select_month( GtkCalendar *calendar,
|
||||
guint month,
|
||||
guint year );
|
||||
|
||||
void gtk_calendar_select_day( GtkCalendar *calendar,
|
||||
guint day );
|
||||
</verb></tscreen>
|
||||
|
||||
The return value from <tt/gtk_calendar_select_month()/ is a boolean
|
||||
value indicating whether the selection was successful.
|
||||
|
||||
With <tt/gtk_calendar_select_day()/ the specified day number is
|
||||
selected within the current month, if that is possible. A
|
||||
<tt/day/ value of 0 will deselect any current selection.
|
||||
|
||||
In addition to having a day selected, any number of days in the month
|
||||
may be "marked". A marked day is highlighted within the calendar
|
||||
display. The following functions are provided to manipulate marked
|
||||
days:
|
||||
|
||||
<tscreen><verb>
|
||||
gint gtk_calendar_mark_day( GtkCalendar *calendar,
|
||||
guint day);
|
||||
|
||||
gint gtk_calendar_unmark_day( GtkCalendar *calendar,
|
||||
guint day);
|
||||
|
||||
void gtk_calendar_clear_marks( GtkCalendar *calendar);
|
||||
</verb></tscreen>
|
||||
|
||||
The currently marked days are stored within an array within the
|
||||
GtkCalendar structure. This array is 31 elements long so to test
|
||||
whether a particular day is currently marked, you need to access the
|
||||
corresponding element of the array (don't forget in C that array
|
||||
elements are numbered 0 to n-1). For example:
|
||||
|
||||
<tscreen><verb>
|
||||
GtkCalendar *calendar;
|
||||
calendar = gtk_calendar_new();
|
||||
|
||||
...
|
||||
|
||||
/* Is day 7 marked? */
|
||||
if (calendar->marked_date[7-1])
|
||||
/* day is marked */
|
||||
</verb></tscreen>
|
||||
|
||||
Note that marks are persistent across month and year changes.
|
||||
|
||||
The final Calendar widget function is used to retrieve the currently
|
||||
selected date, month and/or year.
|
||||
|
||||
<tscreen><verb>
|
||||
void gtk_calendar_get_date( GtkCalendar *calendar,
|
||||
guint *year,
|
||||
guint *month,
|
||||
guint *day );
|
||||
</verb></tscreen>
|
||||
|
||||
This function requires you to pass the addresses of <tt/guint/
|
||||
variables, into which the result will be placed. Passing <tt/NULL/ as
|
||||
a value will result in the corresponding value not being returned.
|
||||
|
||||
The Calendar widget can generate a number of signals indicating date
|
||||
selection and change. The names of these signals are self explanatory,
|
||||
and are:
|
||||
|
||||
<itemize>
|
||||
<item> <tt/month_changed/
|
||||
<item> <tt/day_selected/
|
||||
<item> <tt/day_selected_double_click/
|
||||
<item> <tt/prev_month/
|
||||
<item> <tt/next_month/
|
||||
<item> <tt/prev_year/
|
||||
<item> <tt/next_year/
|
||||
</itemize>
|
||||
|
||||
That just leaves us with the need to put all of this together into
|
||||
example code.
|
||||
|
||||
<tscreen><verb>
|
||||
/* example-start calendar calendar.c */
|
||||
/*
|
||||
* Copyright (C) 1998 Cesar Miquel, Shawn T. Amundson, Mattias Grönlund
|
||||
* Copyright (C) 2000 Tony Gale
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#define DEF_PAD 10
|
||||
#define DEF_PAD_SMALL 5
|
||||
|
||||
#define TM_YEAR_BASE 1900
|
||||
|
||||
typedef struct _CalendarData {
|
||||
GtkWidget *flag_checkboxes[5];
|
||||
gboolean settings[5];
|
||||
gchar *font;
|
||||
GtkWidget *font_dialog;
|
||||
GtkWidget *window;
|
||||
GtkWidget *prev2_sig;
|
||||
GtkWidget *prev_sig;
|
||||
GtkWidget *last_sig;
|
||||
GtkWidget *month;
|
||||
} CalendarData;
|
||||
|
||||
enum {
|
||||
calendar_show_header,
|
||||
calendar_show_days,
|
||||
calendar_month_change,
|
||||
calendar_show_week,
|
||||
calendar_monday_first
|
||||
};
|
||||
|
||||
/*
|
||||
* GtkCalendar
|
||||
*/
|
||||
|
||||
void calendar_date_to_string( CalendarData *data,
|
||||
char *buffer,
|
||||
gint buff_len )
|
||||
{
|
||||
struct tm tm;
|
||||
time_t time;
|
||||
|
||||
memset (&tm, 0, sizeof (tm));
|
||||
gtk_calendar_get_date (GTK_CALENDAR(data->window),
|
||||
&tm.tm_year, &tm.tm_mon, &tm.tm_mday);
|
||||
tm.tm_year -= TM_YEAR_BASE;
|
||||
time = mktime(&tm);
|
||||
strftime (buffer, buff_len-1, "%x", gmtime(&time));
|
||||
}
|
||||
|
||||
void calendar_set_signal_strings( char *sig_str,
|
||||
CalendarData *data)
|
||||
{
|
||||
gchar *prev_sig;
|
||||
|
||||
gtk_label_get (GTK_LABEL (data->prev_sig), &prev_sig);
|
||||
gtk_label_set (GTK_LABEL (data->prev2_sig), prev_sig);
|
||||
|
||||
gtk_label_get (GTK_LABEL (data->last_sig), &prev_sig);
|
||||
gtk_label_set (GTK_LABEL (data->prev_sig), prev_sig);
|
||||
gtk_label_set (GTK_LABEL (data->last_sig), sig_str);
|
||||
}
|
||||
|
||||
void calendar_month_changed( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "month_changed: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+15, 256-15);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_day_selected( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "day_selected: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+14, 256-14);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_day_selected_double_click( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
struct tm tm;
|
||||
char buffer[256] = "day_selected_double_click: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+27, 256-27);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
|
||||
memset (&tm, 0, sizeof (tm));
|
||||
gtk_calendar_get_date (GTK_CALENDAR(data->window),
|
||||
&tm.tm_year, &tm.tm_mon, &tm.tm_mday);
|
||||
tm.tm_year -= TM_YEAR_BASE;
|
||||
|
||||
if(GTK_CALENDAR(data->window)->marked_date[tm.tm_mday-1] == 0) {
|
||||
gtk_calendar_mark_day(GTK_CALENDAR(data->window),tm.tm_mday);
|
||||
} else {
|
||||
gtk_calendar_unmark_day(GTK_CALENDAR(data->window),tm.tm_mday);
|
||||
}
|
||||
}
|
||||
|
||||
void calendar_prev_month( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "prev_month: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+12, 256-12);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_next_month( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "next_month: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+12, 256-12);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_prev_year( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "prev_year: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+11, 256-11);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_next_year( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "next_year: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+11, 256-11);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
|
||||
void calendar_set_flags( CalendarData *calendar )
|
||||
{
|
||||
gint i;
|
||||
gint options=0;
|
||||
for (i=0;i<5;i++)
|
||||
if (calendar->settings[i])
|
||||
{
|
||||
options=options + (1<<i);
|
||||
}
|
||||
if (calendar->window)
|
||||
gtk_calendar_display_options (GTK_CALENDAR (calendar->window), options);
|
||||
}
|
||||
|
||||
void calendar_toggle_flag( GtkWidget *toggle,
|
||||
CalendarData *calendar )
|
||||
{
|
||||
gint i;
|
||||
gint j;
|
||||
j=0;
|
||||
for (i=0; i<5; i++)
|
||||
if (calendar->flag_checkboxes[i] == toggle)
|
||||
j = i;
|
||||
|
||||
calendar->settings[j]=!calendar->settings[j];
|
||||
calendar_set_flags(calendar);
|
||||
|
||||
}
|
||||
|
||||
void calendar_font_selection_ok( GtkWidget *button,
|
||||
CalendarData *calendar )
|
||||
{
|
||||
GtkStyle *style;
|
||||
GdkFont *font;
|
||||
|
||||
calendar->font = gtk_font_selection_dialog_get_font_name(
|
||||
GTK_FONT_SELECTION_DIALOG (calendar->font_dialog));
|
||||
if (calendar->window)
|
||||
{
|
||||
font = gtk_font_selection_dialog_get_font(GTK_FONT_SELECTION_DIALOG(calendar->font_dialog));
|
||||
if (font)
|
||||
{
|
||||
style = gtk_style_copy (gtk_widget_get_style (calendar->window));
|
||||
gdk_font_unref (style->font);
|
||||
style->font = font;
|
||||
gdk_font_ref (style->font);
|
||||
gtk_widget_set_style (calendar->window, style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void calendar_select_font( GtkWidget *button,
|
||||
CalendarData *calendar )
|
||||
{
|
||||
GtkWidget *window;
|
||||
|
||||
if (!calendar->font_dialog) {
|
||||
window = gtk_font_selection_dialog_new ("Font Selection Dialog");
|
||||
g_return_if_fail(GTK_IS_FONT_SELECTION_DIALOG(window));
|
||||
calendar->font_dialog = window;
|
||||
|
||||
gtk_window_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
|
||||
&calendar->font_dialog);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->ok_button),
|
||||
"clicked", GTK_SIGNAL_FUNC(calendar_font_selection_ok),
|
||||
calendar);
|
||||
gtk_signal_connect_object (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->cancel_button),
|
||||
"clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
GTK_OBJECT (calendar->font_dialog));
|
||||
}
|
||||
window=calendar->font_dialog;
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
}
|
||||
|
||||
void create_calendar()
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox, *vbox2, *vbox3;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *hbbox;
|
||||
GtkWidget *calendar;
|
||||
GtkWidget *toggle;
|
||||
GtkWidget *button;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *separator;
|
||||
GtkWidget *label;
|
||||
GtkWidget *bbox;
|
||||
static CalendarData calendar_data;
|
||||
gint i;
|
||||
|
||||
struct {
|
||||
char *label;
|
||||
} flags[] =
|
||||
{
|
||||
{ "Show Heading" },
|
||||
{ "Show Day Names" },
|
||||
{ "No Month Change" },
|
||||
{ "Show Week Numbers" },
|
||||
{ "Week Start Monday" }
|
||||
};
|
||||
|
||||
|
||||
calendar_data.window = NULL;
|
||||
calendar_data.font = NULL;
|
||||
calendar_data.font_dialog = NULL;
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
calendar_data.settings[i]=0;
|
||||
}
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(window), "GtkCalendar Example");
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 5);
|
||||
gtk_signal_connect(GTK_OBJECT(window), "destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_main_quit),
|
||||
NULL);
|
||||
gtk_signal_connect(GTK_OBJECT(window), "delete-event",
|
||||
GTK_SIGNAL_FUNC(gtk_false),
|
||||
NULL);
|
||||
|
||||
gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, TRUE);
|
||||
|
||||
vbox = gtk_vbox_new(FALSE, DEF_PAD);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
/*
|
||||
* The top part of the window, Calendar, flags and fontsel.
|
||||
*/
|
||||
|
||||
hbox = gtk_hbox_new(FALSE, DEF_PAD);
|
||||
gtk_box_pack_start (GTK_BOX(vbox), hbox, TRUE, TRUE, DEF_PAD);
|
||||
hbbox = gtk_hbutton_box_new();
|
||||
gtk_box_pack_start(GTK_BOX(hbox), hbbox, FALSE, FALSE, DEF_PAD);
|
||||
gtk_button_box_set_layout(GTK_BUTTON_BOX(hbbox), GTK_BUTTONBOX_SPREAD);
|
||||
gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbbox), 5);
|
||||
|
||||
/* Calendar widget */
|
||||
frame = gtk_frame_new("Calendar");
|
||||
gtk_box_pack_start(GTK_BOX(hbbox), frame, FALSE, TRUE, DEF_PAD);
|
||||
calendar=gtk_calendar_new();
|
||||
calendar_data.window = calendar;
|
||||
calendar_set_flags(&calendar_data);
|
||||
gtk_calendar_mark_day ( GTK_CALENDAR(calendar), 19);
|
||||
gtk_container_add( GTK_CONTAINER( frame), calendar);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "month_changed",
|
||||
GTK_SIGNAL_FUNC (calendar_month_changed),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "day_selected",
|
||||
GTK_SIGNAL_FUNC (calendar_day_selected),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "day_selected_double_click",
|
||||
GTK_SIGNAL_FUNC (calendar_day_selected_double_click),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "prev_month",
|
||||
GTK_SIGNAL_FUNC (calendar_prev_month),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "next_month",
|
||||
GTK_SIGNAL_FUNC (calendar_next_month),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "prev_year",
|
||||
GTK_SIGNAL_FUNC (calendar_prev_year),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "next_year",
|
||||
GTK_SIGNAL_FUNC (calendar_next_year),
|
||||
&calendar_data);
|
||||
|
||||
|
||||
separator = gtk_vseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), separator, FALSE, TRUE, 0);
|
||||
|
||||
vbox2 = gtk_vbox_new(FALSE, DEF_PAD);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, DEF_PAD);
|
||||
|
||||
/* Build the Right frame with the flags in */
|
||||
|
||||
frame = gtk_frame_new("Flags");
|
||||
gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, DEF_PAD);
|
||||
vbox3 = gtk_vbox_new(TRUE, DEF_PAD_SMALL);
|
||||
gtk_container_add(GTK_CONTAINER(frame), vbox3);
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
toggle = gtk_check_button_new_with_label(flags[i].label);
|
||||
gtk_signal_connect (GTK_OBJECT (toggle),
|
||||
"toggled",
|
||||
GTK_SIGNAL_FUNC(calendar_toggle_flag),
|
||||
&calendar_data);
|
||||
gtk_box_pack_start (GTK_BOX (vbox3), toggle, TRUE, TRUE, 0);
|
||||
calendar_data.flag_checkboxes[i]=toggle;
|
||||
}
|
||||
/* Build the right font-button */
|
||||
button = gtk_button_new_with_label("Font...");
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
GTK_SIGNAL_FUNC(calendar_select_font),
|
||||
&calendar_data);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
||||
|
||||
/*
|
||||
* Build the Signal-event part.
|
||||
*/
|
||||
|
||||
frame = gtk_frame_new("Signal events");
|
||||
gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, DEF_PAD);
|
||||
|
||||
vbox2 = gtk_vbox_new(TRUE, DEF_PAD_SMALL);
|
||||
gtk_container_add(GTK_CONTAINER(frame), vbox2);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
|
||||
label = gtk_label_new ("Signal:");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
calendar_data.last_sig = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.last_sig, FALSE, TRUE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
|
||||
label = gtk_label_new ("Previous signal:");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
calendar_data.prev_sig = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.prev_sig, FALSE, TRUE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
|
||||
label = gtk_label_new ("Second previous signal:");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
calendar_data.prev2_sig = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.prev2_sig, FALSE, TRUE, 0);
|
||||
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
|
||||
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
|
||||
|
||||
button = gtk_button_new_with_label ("Close");
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
|
||||
gtk_widget_show_all(window);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
gtk_set_locale ();
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
create_calendar();
|
||||
|
||||
gtk_main();
|
||||
|
||||
return(0);
|
||||
}
|
||||
/* example-end */
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1> Color Selection
|
||||
<p>
|
||||
@@ -6064,7 +6654,7 @@ the <ref id="sec_ProgressBar" name="Progress Bar"> widget.
|
||||
<sect1> Fixed Container
|
||||
<p>
|
||||
The Fixed container allows you to place widgets at a fixed position
|
||||
within it's window, relative to it's upper left hand corner. The
|
||||
within its window, relative to its upper left hand corner. The
|
||||
position of the widgets can be changed dynamically.
|
||||
|
||||
There are only three functions associated with the fixed widget:
|
||||
@@ -6505,6 +7095,7 @@ window.
|
||||
<tscreen><verb>
|
||||
/* example-start paned paned.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Create the list of "messages" */
|
||||
@@ -6751,6 +7342,7 @@ new to you.
|
||||
<tscreen><verb>
|
||||
/* example-start scrolledwin scrolledwin.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
void destroy( GtkWidget *widget,
|
||||
@@ -7630,6 +8222,7 @@ backward manner, and exit the program.
|
||||
<tscreen><verb>
|
||||
/* example-start notebook notebook.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* This function rotates the position of the tabs */
|
||||
@@ -9550,6 +10143,7 @@ That should about do it. Let's take a look at an example to help clarify.
|
||||
<tscreen><verb>
|
||||
/* example-start menu menu.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static gint button_press (GtkWidget *, GdkEvent *);
|
||||
@@ -10258,9 +10852,6 @@ When you do come to understand all the functions of a new undocumented
|
||||
widget, please consider writing a tutorial on it so others may benefit
|
||||
from your time.
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1> Calendar
|
||||
<p>
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1> CTree
|
||||
<p>
|
||||
@@ -16709,6 +17300,7 @@ gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||
<sect2> dial_test.c
|
||||
<p>
|
||||
<tscreen><verb>
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkdial.h"
|
||||
|
||||
|
||||
Executable
+17638
File diff suppressed because it is too large
Load Diff
+576
-203
File diff suppressed because it is too large
Load Diff
Executable
+350
@@ -0,0 +1,350 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import xmllib;
|
||||
import sys;
|
||||
import string
|
||||
import re
|
||||
|
||||
def html_subst(s):
|
||||
if s.group(1) != None:
|
||||
return s.group(0)
|
||||
elif s.group(2) != None:
|
||||
return '<a href="' + s.group(0) + '">' + s.group(0) + '</a>'
|
||||
elif s.group(3) != None:
|
||||
return '<a href="mailto:' + s.group(0) + '">' + s.group(0) + '</a>'
|
||||
|
||||
def htmlify(str):
|
||||
return re.sub ("(<[^>]*>)|(http://[~.:/\w-]+)|([\w._!-]+@[\w_-]+).[\w_-]+", html_subst, str)
|
||||
|
||||
def bug_subst(s):
|
||||
if s.group(1) != None:
|
||||
return s.group(0)
|
||||
else:
|
||||
n = s.group(2)
|
||||
return '<a href="http://bugs.gnome.org/db/%s/%s.html">#%s</a>' % (n[0:2], n, n)
|
||||
|
||||
def bugify(str):
|
||||
str = re.sub ("(<[^>]*>)|#(\d+)", bug_subst, str)
|
||||
return htmlify(str)
|
||||
|
||||
def make_id(str):
|
||||
return re.sub ("[^a-z]","-", string.lower(str))
|
||||
|
||||
class ParseError (Exception):
|
||||
pass
|
||||
|
||||
class Entry:
|
||||
def __init__(self):
|
||||
self.description = None
|
||||
self.title = None
|
||||
self.url = None
|
||||
self.contact = None
|
||||
self.bugs = None
|
||||
|
||||
def set_size(self, size):
|
||||
size = string.lower(size)
|
||||
if size == "small":
|
||||
self.size = "Small"
|
||||
elif size == "medium":
|
||||
self.size = "Medium"
|
||||
elif size == "big":
|
||||
self.size = "Big"
|
||||
else:
|
||||
raise ParseError, 'size must be "small", "medium", or "big"'
|
||||
|
||||
def output(self):
|
||||
if self.size == "Big":
|
||||
bgcolor = "#88bb88"
|
||||
elif self.size == "Medium":
|
||||
bgcolor = "#b4d4b4"
|
||||
else:
|
||||
bgcolor = "#d0e0d0"
|
||||
|
||||
print '''<table cellspacing="0" cellpadding="2" width="97%%" border="0" bgcolor="#000000">
|
||||
<tbody><tr><td colspan=2>
|
||||
<table cellspacing="0" cellpadding="5" width="100%%" border="0" bgcolor="#ffffff">
|
||||
<tbody>
|
||||
<tr bgcolor="%s">
|
||||
<td align="left"><font size="+1">%s</font></font></td>
|
||||
<td align="left" width="20%%"><b>Size</b>: %s</td>
|
||||
<td align="center" width="20%%"><b>Status</b>: %s</td>
|
||||
<td align="right" width="20%%"><b>Target Version</b>: %s</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=4>
|
||||
%s
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>''' % (bgcolor, self.title, self.size, self.status, self.target, htmlify(self.description))
|
||||
|
||||
if self.url != None:
|
||||
print '''<tr><td width="0"><b>More Info</b>:</td>
|
||||
<td>%s</td>
|
||||
</tr>''' % htmlify (self.url)
|
||||
|
||||
if self.bugs != None:
|
||||
print '''<tr><td width="0"><b>Bug Reports</b>:</td>
|
||||
<td>%s</td>
|
||||
</tr>''' % bugify (self.bugs)
|
||||
|
||||
if self.contact != None:
|
||||
print '''<tr><td width="0"><b>Contact</b>:</td>
|
||||
<td>%s</td>
|
||||
</tr>''' % htmlify (self.contact)
|
||||
|
||||
print '''</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
</td></tr></tbody></table>
|
||||
'''
|
||||
|
||||
class Section:
|
||||
def __init__(self):
|
||||
self.title = None
|
||||
self.entries = []
|
||||
|
||||
def output(self):
|
||||
|
||||
print '<h2><a name="%s">%s</a></h2>' % (make_id(self.title), self.title)
|
||||
|
||||
first = 1
|
||||
for entry in self.entries:
|
||||
if not first:
|
||||
print "<br>"
|
||||
first = 0
|
||||
entry.output()
|
||||
|
||||
class TodoParser (xmllib.XMLParser):
|
||||
def __init__(self):
|
||||
xmllib.XMLParser.__init__(self)
|
||||
|
||||
self.in_todo = 0
|
||||
self.in_data = 0
|
||||
self.data = ""
|
||||
self.section = None
|
||||
self.entry = None
|
||||
self.logourl = None
|
||||
self.title = None
|
||||
self.sections = []
|
||||
|
||||
self.entitydefs = {}
|
||||
|
||||
def start_todo(self,attributes):
|
||||
if self.in_todo:
|
||||
raise ParseError, "<todo> tags may not be nested"
|
||||
if attributes.has_key ("logourl"):
|
||||
self.logourl = attributes["logourl"]
|
||||
self.in_todo = 1
|
||||
|
||||
def end_todo(self):
|
||||
self.in_todo = 0
|
||||
|
||||
def start_section(self,attributes):
|
||||
if self.section:
|
||||
raise ParseError, "<section> tags may not be nested"
|
||||
|
||||
self.section = Section()
|
||||
|
||||
def end_section(self):
|
||||
if self.section.title == None:
|
||||
raise ParseError, "<section> requires <title>"
|
||||
|
||||
self.sections.append(self.section)
|
||||
self.section = None
|
||||
|
||||
def start_title(self,attributes):
|
||||
if not self.in_todo:
|
||||
raise ParseError, "<title> tag must be in <todo>, <section> or <entry>"
|
||||
if self.in_data:
|
||||
raise ParseError, "Unexpected <title> tag in content"
|
||||
self.in_data = 1
|
||||
|
||||
def end_title(self):
|
||||
self.in_data = 0
|
||||
if self.entry:
|
||||
self.entry.title = self.data
|
||||
elif self.section:
|
||||
self.section.title = self.data
|
||||
else:
|
||||
self.title = self.data
|
||||
self.data = ""
|
||||
|
||||
def start_description(self,attributes):
|
||||
if not self.entry:
|
||||
raise ParseError, "<description> tag must be in <entry>"
|
||||
if self.in_data:
|
||||
raise ParseError, "Unexpected <description> tag in content"
|
||||
self.in_data = 1
|
||||
|
||||
def end_description(self):
|
||||
self.in_data = 0
|
||||
self.entry.description = self.data
|
||||
self.data = ""
|
||||
|
||||
def start_url(self,attributes):
|
||||
if not self.entry:
|
||||
raise ParseError, "<url> tag must be in <entry>"
|
||||
if self.in_data:
|
||||
raise ParseError, "Unexpected <url> tag in content"
|
||||
self.in_data = 1
|
||||
|
||||
def end_url(self):
|
||||
self.in_data = 0
|
||||
self.entry.url = self.data
|
||||
self.data = ""
|
||||
|
||||
def start_contact(self,attributes):
|
||||
if not self.entry:
|
||||
raise ParseError, "<contact> tag must be in <contact>"
|
||||
if self.in_data:
|
||||
raise ParseError, "Unexpected <contact> tag in content"
|
||||
self.in_data = 1
|
||||
|
||||
def end_contact(self):
|
||||
self.in_data = 0
|
||||
self.entry.contact = self.data
|
||||
self.data = ""
|
||||
|
||||
def start_bugs(self,attributes):
|
||||
if not self.entry:
|
||||
raise ParseError, "<bugs> tag must be in <bugs>"
|
||||
if self.in_data:
|
||||
raise ParseError, "Unexpected <bugs> tag in content"
|
||||
self.in_data = 1
|
||||
|
||||
def end_bugs(self):
|
||||
self.in_data = 0
|
||||
self.entry.bugs = self.data
|
||||
self.data = ""
|
||||
|
||||
def start_entry(self,attributes):
|
||||
if not self.section:
|
||||
raise ParseError, "<entry> tag must be in <section>"
|
||||
if self.entry:
|
||||
raise ParseError, "<entry> tags may not be nested"
|
||||
|
||||
self.entry = Entry()
|
||||
|
||||
if not attributes.has_key("size"):
|
||||
raise ParseError, '"size" attribute required for entry'
|
||||
self.entry.set_size(attributes["size"])
|
||||
|
||||
if not attributes.has_key("status"):
|
||||
raise ParseError, '"status" attribute (completion percentage) required for entry'
|
||||
self.entry.status=attributes["status"]
|
||||
|
||||
if not attributes.has_key("target"):
|
||||
raise ParseError, '"target" attribute (target version) required for entry'
|
||||
self.entry.target=attributes["target"]
|
||||
|
||||
def end_entry(self):
|
||||
if self.entry.title == None:
|
||||
raise ParseError, "<entry> requires <title>"
|
||||
|
||||
if self.entry.description == None:
|
||||
raise ParseError, "<entry> requires <description>"
|
||||
|
||||
self.section.entries.append(self.entry)
|
||||
self.entry = None
|
||||
|
||||
def handle_data(self,data):
|
||||
if self.in_data:
|
||||
self.data = self.data + data
|
||||
|
||||
def unknown_starttag(self,tag,attributes):
|
||||
if not self.in_data:
|
||||
raise ParseError, "Unexpected start tag: " + tag
|
||||
else:
|
||||
self.data = self.data + "<" + tag
|
||||
for (key,val) in attributes.items():
|
||||
self.data = self.data + ' %s="%s"' % (key,val)
|
||||
self.data = self.data + ">"
|
||||
|
||||
def unknown_endtag(self,tag):
|
||||
if not self.in_data:
|
||||
raise ParseError, "Unexpected end tag: " + tag
|
||||
else:
|
||||
self.data = self.data + "</%s>" % tag
|
||||
|
||||
def syntax_error(self, err):
|
||||
if re.match("reference to unknown entity", err):
|
||||
pass
|
||||
else:
|
||||
xmllib.XMLParser.syntax_error (self, err)
|
||||
|
||||
def unknown_entityref(self,ref):
|
||||
if not self.in_data:
|
||||
raise ParseError, "Unknown entity &" + ref + ";"
|
||||
else:
|
||||
self.data = self.data + "&" + ref + ";"
|
||||
|
||||
file = open(sys.argv[1])
|
||||
parser = TodoParser()
|
||||
|
||||
lineno = 1
|
||||
while 1:
|
||||
line = file.readline()
|
||||
if line == "":
|
||||
break
|
||||
|
||||
try:
|
||||
parser.feed(line)
|
||||
except ParseError, err:
|
||||
sys.stderr.write("Parse error at line " + `lineno` + ": " + err.__str__() + "\n")
|
||||
sys.exit(1)
|
||||
except RuntimeError, err:
|
||||
sys.stderr.write(err.__str__() + "\n")
|
||||
sys.exit(1)
|
||||
|
||||
lineno = lineno + 1
|
||||
|
||||
parser.close()
|
||||
if parser.title == None:
|
||||
sys.stderr.write ("<todo> Document must have a <title>\n")
|
||||
sys.exit (1)
|
||||
|
||||
print '''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>%s</title>
|
||||
</head>
|
||||
<body bgcolor="#ffffff">
|
||||
<table width="100%%" cellspacing="0" cellpadding="0" border="0">
|
||||
<tbody>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<h1>%s</h1>''' % (parser.title, parser.title)
|
||||
|
||||
|
||||
for section in parser.sections:
|
||||
ntasks = len(section.entries)
|
||||
id = make_id (section.title)
|
||||
if ntasks == 1:
|
||||
print '<a href="#%s">%s</a> (1 item)<br>' % (id,section.title)
|
||||
else:
|
||||
print '<a href="#%s">%s</a> (%d items)<br>' % (id,section.title,ntasks)
|
||||
|
||||
print '''
|
||||
</td>'''
|
||||
if parser.logourl != None:
|
||||
print ''' <td align="right">
|
||||
<img src="%s" alt="Logo"></img>
|
||||
</td>''' % parser.logourl
|
||||
print '''
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
'''
|
||||
|
||||
first = 1
|
||||
for section in parser.sections:
|
||||
if not first:
|
||||
print "<br><br>"
|
||||
first = 0
|
||||
section.output()
|
||||
|
||||
print '''</body>
|
||||
</html>'''
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ functions that follow these conventions:
|
||||
GtkObjects also provide the following functions:
|
||||
|
||||
*_destroy: Render an object `unusable', but as long as there are
|
||||
references to it, it's allocated memory will not be freed.
|
||||
references to it, its allocated memory will not be freed.
|
||||
*_sink: Clear a GtkObjects `floating' state and decrement the
|
||||
reference count by 1.
|
||||
|
||||
@@ -248,7 +248,7 @@ widget, it needs to hold a reference to it.
|
||||
Example code sequences that require reference wraps:
|
||||
|
||||
/* gtk_container_remove() will unparent the child and therefore
|
||||
* cause it's reference count to be decremented by one.
|
||||
* cause its reference count to be decremented by one.
|
||||
*/
|
||||
gtk_widget_ref (widget);
|
||||
gtk_container_remove (container, widget);
|
||||
|
||||
@@ -1,3 +1,48 @@
|
||||
2000-04-22 Damon Chaplin <damon@helixcode.com>
|
||||
|
||||
* gtk/tmpl/gtkenums.sgml: update from Lee Mallabone
|
||||
<lee0@callnetuk.com>
|
||||
|
||||
2000-04-09 Damon Chaplin <damon@helixcode.com>
|
||||
|
||||
* gtk/tmpl/gtkmain.sgml: update from Torsten Landschoff
|
||||
<t.landschoff@gmx.net>
|
||||
|
||||
* gdk/tmpl/input_methods.sgml:
|
||||
* gdk/tmpl/general.sgml: fixed typos.
|
||||
|
||||
Tue Mar 14 14:17:46 2000 Raph Levien <raph@acm.org>
|
||||
|
||||
* gdk/tmpl/rgb.sgml: Better explanation of gdk_rgb_set_min_colors.
|
||||
Thanks to Stric for spotting it.
|
||||
|
||||
2000-03-07 Damon Chaplin <damon@helixcode.com>
|
||||
|
||||
* gtk/tmpl/gtkclist.sgml: fix to gtk_clist_set_reorderable(). It
|
||||
reorders rows, not columns. From Guy Harris <gharris@flashcom.net>.
|
||||
|
||||
2000-02-29 Damon Chaplin <damon@helixcode.com>
|
||||
|
||||
* gtk/tmpl/gtkmenuitem.sgml: minor fix from Nicolas GEORGE
|
||||
<nicolas.george@ens.fr>.
|
||||
|
||||
2000-02-28 Damon Chaplin <damon@helixcode.com>
|
||||
|
||||
* gtk/tmpl/gtkradiomenuitem.sgml:
|
||||
* gtk/tmpl/gtkmenuitem.sgml:
|
||||
* gtk/tmpl/gtknotebook.sgml: new menu item sections and minor update to
|
||||
notebook section from Nicolas GEORGE <nicolas.george@ens.fr>.
|
||||
|
||||
2000-02-18 Damon Chaplin <damon@helixcode.com>
|
||||
|
||||
* gtk/tmpl/gtktooltips.sgml: patch from
|
||||
David Benson <daveb@idealab.com> to note that gtk_tooltips_set_colors()
|
||||
does not work.
|
||||
|
||||
2000-02-09 Damon Chaplin <damon@helixcode.com>
|
||||
|
||||
* gdk/tmpl/input_methods.sgml: minor fix.
|
||||
|
||||
2000-02-03 Damon Chaplin <damon@karuna.freeserve.co.uk>
|
||||
|
||||
* gdk/gdk-sections.txt: rearranged a bit.
|
||||
|
||||
@@ -38,7 +38,13 @@ gdk_pixbuf_doc_DATA = \
|
||||
gdk-pixbuf-decl.txt \
|
||||
gdk-pixbuf-sections.txt
|
||||
|
||||
EXTRA_DIST = $(gdk_pixbuf_doc_DATA)
|
||||
content_files = \
|
||||
compiling.sgml \
|
||||
gdk-pixbuf.sgml
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(gdk_pixbuf_doc_DATA) \
|
||||
$(content_files)
|
||||
|
||||
if ENABLE_GTK_DOC
|
||||
gdk-pixbuf.html: html/book1.html
|
||||
@@ -47,7 +53,7 @@ else
|
||||
gdk-pixbuf.html:
|
||||
endif
|
||||
|
||||
html/book1.html: sgml/gdk-pixbuf-doc.bottom
|
||||
html/book1.html: sgml/gdk-pixbuf-doc.bottom $(content_files)
|
||||
$(MAKE) html
|
||||
|
||||
sgml/gdk-pixbuf-doc.bottom: $(tmpl_sources)
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
<appendix id="compiling">
|
||||
<title>Compiling the <application>gdk-pixbuf</application>
|
||||
library</title>
|
||||
|
||||
<para>
|
||||
This appendix describes the special options you can use while
|
||||
compiling the <application>gdk-pixbuf</application> library.
|
||||
</para>
|
||||
|
||||
<sect1 id="building">
|
||||
<title>Building the Library</title>
|
||||
<para>
|
||||
The <application>gdk-pixbuf</application> library uses the
|
||||
standard GNU build system, using
|
||||
<application>autoconf</application> for package configuration
|
||||
and resolving portability issues,
|
||||
<application>automake</application> for building makefiles
|
||||
that comply with the GNU Coding Standards, and
|
||||
<application>libtool</application> for building shared
|
||||
libraries on multiple platforms. The normal sequence for
|
||||
compiling and installing the
|
||||
<application>gdk-pixbuf</application> library is thus:
|
||||
|
||||
<literallayout>
|
||||
<userinput>./configure</userinput>
|
||||
<userinput>make</userinput>
|
||||
<userinput>make install</userinput>
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The standard options provided by <application>GNU
|
||||
autoconf</application> may be passed to the
|
||||
<command>configure</command> script. Please see the
|
||||
<application>autoconf</application> documentation or run
|
||||
<command>./configure --help</command> for information about
|
||||
the standard options.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="extra-configuration-options">
|
||||
<title>Extra Configuration Options</title>
|
||||
|
||||
<para>
|
||||
In addition to the normal options, the
|
||||
<command>configure</command> script in the
|
||||
<application>gdk-pixbuf</application> library supports these
|
||||
additional arguments:
|
||||
|
||||
<cmdsynopsis>
|
||||
<command>configure</command>
|
||||
|
||||
<group>
|
||||
<arg>--disable-modules</arg>
|
||||
<arg>--enable-modules</arg>
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<arg>--disable-gtk-doc</arg>
|
||||
<arg>--enable-gtk-doc</arg>
|
||||
</group>
|
||||
</cmdsynopsis>
|
||||
</para>
|
||||
|
||||
<formalpara>
|
||||
<title><systemitem>--disable-modules</systemitem> and
|
||||
<systemitem>--enable-modules</systemitem></title>
|
||||
|
||||
<para>
|
||||
Normally <application>gdk-pixbuf</application> will try to
|
||||
build the image file format loaders as little shared
|
||||
libraries that are loaded on demand. The
|
||||
<systemitem>--disable-modules</systemitem> argument
|
||||
indicates that they should all be built statically into the
|
||||
<application>gdk-pixbuf</application> library instead. This
|
||||
is useful for people who need to produce statically-linked
|
||||
binaries. If neither
|
||||
<systemitem>--disable-modules</systemitem> nor
|
||||
<systemitem>--enable-modules</systemitem> is specified, then
|
||||
the <command>configure</command> script will try to
|
||||
auto-detect whether shared modules work on your system.
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
<formalpara>
|
||||
<title><systemitem>--disable-gtk-doc</systemitem> and
|
||||
<systemitem>--enable-gtk-doc</systemitem></title>
|
||||
|
||||
<para>
|
||||
By default the <command>configure</command> script will try
|
||||
to auto-detect whether the
|
||||
<application>gtk-doc</application> package is installed. If
|
||||
it is, then it will use it to extract and build the
|
||||
documentation for the <application>gdk-pixbuf</application>
|
||||
library. These options can be used to explicitly control
|
||||
whether gtk-doc should be used or not. If it is not used,
|
||||
the distributed, pre-generated HTML files will be installed
|
||||
instead of building them on your machine.
|
||||
</para>
|
||||
</formalpara>
|
||||
</sect1>
|
||||
</appendix>
|
||||
|
||||
<!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("gdk-pixbuf.sgml" "book" "book" "")
|
||||
End:
|
||||
-->
|
||||
@@ -125,103 +125,31 @@ GdkPixbufLoader *loader
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbufLoader *loader
|
||||
</FUNCTION>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbuf</NAME>
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufFrame</NAME>
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufAnimation</NAME>
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbuf</NAME>
|
||||
struct GdkPixbuf {
|
||||
/* Reference count */
|
||||
int ref_count;
|
||||
|
||||
/* Libart pixbuf */
|
||||
ArtPixBuf *art_pixbuf;
|
||||
};
|
||||
</STRUCT>
|
||||
<ENUM>
|
||||
<NAME>GdkPixbufFrameAction</NAME>
|
||||
<NAME>GdkColorspace</NAME>
|
||||
typedef enum {
|
||||
GDK_PIXBUF_FRAME_RETAIN,
|
||||
GDK_PIXBUF_FRAME_DISPOSE,
|
||||
GDK_PIXBUF_FRAME_REVERT
|
||||
} GdkPixbufFrameAction;
|
||||
GDK_COLORSPACE_RGB
|
||||
} GdkColorspace;
|
||||
</ENUM>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbuf</NAME>
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufFrame</NAME>
|
||||
struct GdkPixbufFrame {
|
||||
/* The pixbuf with this frame's image data */
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
/* Offsets for overlaying onto the animation's area */
|
||||
int x_offset;
|
||||
int y_offset;
|
||||
|
||||
/* Frame duration in ms */
|
||||
int delay_time;
|
||||
|
||||
/* Overlay mode */
|
||||
GdkPixbufFrameAction action;
|
||||
};
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufAnimation</NAME>
|
||||
struct GdkPixbufAnimation {
|
||||
/* Reference count */
|
||||
int ref_count;
|
||||
|
||||
/* Number of frames */
|
||||
int n_frames;
|
||||
|
||||
/* List of GdkPixbufFrame structures */
|
||||
GList *frames;
|
||||
};
|
||||
</STRUCT>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_format</NAME>
|
||||
<RETURNS>ArtPixFormat </RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_n_channels</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_has_alpha</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_bits_per_sample</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_pixels</NAME>
|
||||
<RETURNS>guchar *</RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_width</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_height</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_rowstride</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<USER_FUNCTION>
|
||||
<NAME>GdkPixbufDestroyNotify</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
guchar *pixels, gpointer data
|
||||
</USER_FUNCTION>
|
||||
<USER_FUNCTION>
|
||||
<NAME>GdkPixbufLastUnref</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf, gpointer data
|
||||
</USER_FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_ref</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
@@ -233,14 +161,64 @@ GdkPixbuf *pixbuf
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_new_from_art_pixbuf</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
ArtPixBuf *art_pixbuf
|
||||
<NAME>gdk_pixbuf_set_last_unref_handler</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf,GdkPixbufLastUnref last_unref_fn,gpointer last_unref_fn_data
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_finalize</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_colorspace</NAME>
|
||||
<RETURNS>GdkColorspace </RETURNS>
|
||||
const GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_n_channels</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
const GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_has_alpha</NAME>
|
||||
<RETURNS>gboolean </RETURNS>
|
||||
const GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_bits_per_sample</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
const GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_pixels</NAME>
|
||||
<RETURNS>guchar *</RETURNS>
|
||||
const GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_width</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
const GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_height</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
const GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_rowstride</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
const GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_new</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
ArtPixFormat format, gboolean has_alpha, int bits_per_sample,int width, int height
|
||||
GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample,int width, int height
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_copy</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
const GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_new_from_file</NAME>
|
||||
@@ -250,7 +228,7 @@ const char *filename
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_new_from_data</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
guchar *data,ArtPixFormat format,gboolean has_alpha,int width, int height,int rowstride,ArtDestroyNotify dfunc,gpointer dfunc_data
|
||||
const guchar *data,GdkColorspace colorspace,gboolean has_alpha,int bits_per_sample,int width, int height,int rowstride,GdkPixbufDestroyNotify destroy_fn,gpointer destroy_fn_data
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_new_from_xpm_data</NAME>
|
||||
@@ -260,7 +238,12 @@ const char **data
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_add_alpha</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
GdkPixbuf *pixbuf, gboolean substitute_color,guchar r, guchar g, guchar b
|
||||
const GdkPixbuf *pixbuf, gboolean substitute_color,guchar r, guchar g, guchar b
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_copy_area</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
const GdkPixbuf *src_pixbuf,int src_x, int src_y,int width, int height,GdkPixbuf *dest_pixbuf,int dest_x, int dest_y
|
||||
</FUNCTION>
|
||||
<ENUM>
|
||||
<NAME>GdkPixbufAlphaMode</NAME>
|
||||
@@ -294,40 +277,52 @@ GdkPixbuf *pixbuf,GdkPixmap **pixmap_return, GdkBitmap **mask_return,int alpha_t
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
GdkPixbuf *dest,GdkDrawable *src, GdkColormap *cmap,int src_x, int src_y,int dest_x, int dest_y,int width, int height
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_copy_area</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *src_pixbuf,int src_x, int src_y,int width, int height,GdkPixbuf *dest_pixbuf,int dest_x, int dest_y
|
||||
</FUNCTION>
|
||||
<ENUM>
|
||||
<NAME>GdkInterpType</NAME>
|
||||
typedef enum {
|
||||
GDK_INTERP_NEAREST,
|
||||
GDK_INTERP_TILES,
|
||||
GDK_INTERP_BILINEAR,
|
||||
GDK_INTERP_HYPER
|
||||
} GdkInterpType;
|
||||
</ENUM>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_scale</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *src,GdkPixbuf *dest,int dest_x,int dest_y,int dest_width,int dest_height,double offset_x,double offset_y,double scale_x,double scale_y,ArtFilterLevel filter_level
|
||||
const GdkPixbuf *src,GdkPixbuf *dest,int dest_x,int dest_y,int dest_width,int dest_height,double offset_x,double offset_y,double scale_x,double scale_y,GdkInterpType interp_type
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_composite</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *src,GdkPixbuf *dest,int dest_x,int dest_y,int dest_width,int dest_height,double offset_x,double offset_y,double scale_x,double scale_y,ArtFilterLevel filter_level,int overall_alpha
|
||||
const GdkPixbuf *src,GdkPixbuf *dest,int dest_x,int dest_y,int dest_width,int dest_height,double offset_x,double offset_y,double scale_x,double scale_y,GdkInterpType interp_type,int overall_alpha
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_composite_color</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *src,GdkPixbuf *dest,int dest_x,int dest_y,int dest_width,int dest_height,double offset_x,double offset_y,double scale_x,double scale_y,ArtFilterLevel filter_level,int overall_alpha,int check_x,int check_y,int check_size,art_u32 color1,art_u32 color2
|
||||
const GdkPixbuf *src,GdkPixbuf *dest,int dest_x,int dest_y,int dest_width,int dest_height,double offset_x,double offset_y,double scale_x,double scale_y,GdkInterpType interp_type,int overall_alpha,int check_x,int check_y,int check_size,guint32 color1,guint32 color2
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_scale_simple</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
GdkPixbuf *src,int dest_width,int dest_height,ArtFilterLevel filter_level
|
||||
const GdkPixbuf *src,int dest_width,int dest_height,GdkInterpType interp_type
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_composite_color_simple</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
GdkPixbuf *src,int dest_width,int dest_height,ArtFilterLevel filter_level,int overall_alpha,int check_size,art_u32 color1,art_u32 color2
|
||||
const GdkPixbuf *src,int dest_width,int dest_height,GdkInterpType interp_type,int overall_alpha,int check_size,guint32 color1,guint32 color2
|
||||
</FUNCTION>
|
||||
<ENUM>
|
||||
<NAME>GdkPixbufFrameAction</NAME>
|
||||
typedef enum {
|
||||
GDK_PIXBUF_FRAME_RETAIN,
|
||||
GDK_PIXBUF_FRAME_DISPOSE,
|
||||
GDK_PIXBUF_FRAME_REVERT
|
||||
} GdkPixbufFrameAction;
|
||||
</ENUM>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_animation_new_from_file</NAME>
|
||||
<RETURNS>GdkPixbufAnimation *</RETURNS>
|
||||
const char *filename
|
||||
const char *filename
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_animation_ref</NAME>
|
||||
@@ -340,6 +335,51 @@ GdkPixbufAnimation *animation
|
||||
GdkPixbufAnimation *animation
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_animation_get_width</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
GdkPixbufAnimation *animation
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_animation_get_height</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
GdkPixbufAnimation *animation
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_animation_get_frames</NAME>
|
||||
<RETURNS>GList *</RETURNS>
|
||||
GdkPixbufAnimation *animation
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_animation_get_num_frames</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
GdkPixbufAnimation *animation
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_frame_get_pixbuf</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
GdkPixbufFrame *frame
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_frame_get_x_offset</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
GdkPixbufFrame *frame
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_frame_get_y_offset</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
GdkPixbufFrame *frame
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_frame_get_delay_time</NAME>
|
||||
<RETURNS>int </RETURNS>
|
||||
GdkPixbufFrame *frame
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_frame_get_action</NAME>
|
||||
<RETURNS>GdkPixbufFrameAction </RETURNS>
|
||||
GdkPixbufFrame *frame
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_preinit</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
gpointer app, gpointer modinfo
|
||||
@@ -398,7 +438,7 @@ void
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GDK_PIXBUF_MINOR</NAME>
|
||||
#define GDK_PIXBUF_MINOR (4)
|
||||
#define GDK_PIXBUF_MINOR (7)
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GDK_PIXBUF_MICRO</NAME>
|
||||
@@ -406,9 +446,82 @@ void
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GDK_PIXBUF_VERSION</NAME>
|
||||
#define GDK_PIXBUF_VERSION "0.4.0"
|
||||
#define GDK_PIXBUF_VERSION "0.7.0"
|
||||
</MACRO>
|
||||
<VARIABLE>
|
||||
<NAME>gdk_pixbuf_version</NAME>
|
||||
extern const char *gdk_pixbuf_version;
|
||||
</VARIABLE>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbuf</NAME>
|
||||
struct GdkPixbuf {
|
||||
/* Reference count */
|
||||
int ref_count;
|
||||
|
||||
/* Color space */
|
||||
GdkColorspace colorspace;
|
||||
|
||||
/* Number of channels, alpha included */
|
||||
int n_channels;
|
||||
|
||||
/* Bits per channel */
|
||||
int bits_per_sample;
|
||||
|
||||
/* Size */
|
||||
int width, height;
|
||||
|
||||
/* Offset between rows */
|
||||
int rowstride;
|
||||
|
||||
/* The pixel array */
|
||||
guchar *pixels;
|
||||
|
||||
/* Destroy notification function; it is supposed to free the pixel array */
|
||||
GdkPixbufDestroyNotify destroy_fn;
|
||||
|
||||
/* User data for the destroy notification function */
|
||||
gpointer destroy_fn_data;
|
||||
|
||||
/* Last unref handler, determines whether the pixbuf should be finalized */
|
||||
GdkPixbufLastUnref last_unref_fn;
|
||||
|
||||
/* User data for the last unref handler */
|
||||
gpointer last_unref_fn_data;
|
||||
|
||||
/* Do we have an alpha channel? */
|
||||
guint has_alpha : 1;
|
||||
};
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufFrame</NAME>
|
||||
struct GdkPixbufFrame {
|
||||
/* The pixbuf with this frame's image data */
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
/* Offsets for overlaying onto the animation's area */
|
||||
int x_offset;
|
||||
int y_offset;
|
||||
|
||||
/* Frame duration in ms */
|
||||
int delay_time;
|
||||
|
||||
/* Overlay mode */
|
||||
GdkPixbufFrameAction action;
|
||||
};
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufAnimation</NAME>
|
||||
struct GdkPixbufAnimation {
|
||||
/* Reference count */
|
||||
int ref_count;
|
||||
|
||||
/* Number of frames */
|
||||
int n_frames;
|
||||
|
||||
/* List of GdkPixbufFrame structures */
|
||||
GList *frames;
|
||||
|
||||
/* bounding box size */
|
||||
int width, height;
|
||||
};
|
||||
</STRUCT>
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
<SECTION>
|
||||
<FILE>gdk-pixbuf</FILE>
|
||||
GdkColorspace
|
||||
GdkPixbuf
|
||||
gdk_pixbuf_get_format
|
||||
gdk_pixbuf_get_colorspace
|
||||
gdk_pixbuf_get_n_channels
|
||||
gdk_pixbuf_get_has_alpha
|
||||
gdk_pixbuf_get_bits_per_sample
|
||||
@@ -15,8 +16,12 @@ gdk_pixbuf_get_rowstride
|
||||
|
||||
<SECTION>
|
||||
<FILE>refcounting</FILE>
|
||||
GdkPixbufDestroyNotify
|
||||
GdkPixbufLastUnref
|
||||
gdk_pixbuf_ref
|
||||
gdk_pixbuf_unref
|
||||
gdk_pixbuf_set_last_unref_handler
|
||||
gdk_pixbuf_finalize
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -26,10 +31,10 @@ gdk_pixbuf_new_from_file
|
||||
|
||||
<SECTION>
|
||||
<FILE>creating</FILE>
|
||||
gdk_pixbuf_new_from_art_pixbuf
|
||||
gdk_pixbuf_new
|
||||
gdk_pixbuf_new_from_data
|
||||
gdk_pixbuf_new_from_xpm_data
|
||||
gdk_pixbuf_copy
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -60,10 +65,20 @@ GdkPixbufAnimation
|
||||
gdk_pixbuf_animation_new_from_file
|
||||
gdk_pixbuf_animation_ref
|
||||
gdk_pixbuf_animation_unref
|
||||
gdk_pixbuf_animation_get_frames
|
||||
gdk_pixbuf_animation_get_width
|
||||
gdk_pixbuf_animation_get_num_frames
|
||||
gdk_pixbuf_animation_get_height
|
||||
gdk_pixbuf_frame_get_pixbuf
|
||||
gdk_pixbuf_frame_get_action
|
||||
gdk_pixbuf_frame_get_y_offset
|
||||
gdk_pixbuf_frame_get_delay_time
|
||||
gdk_pixbuf_frame_get_x_offset
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>scaling</FILE>
|
||||
GdkInterpType
|
||||
gdk_pixbuf_scale
|
||||
gdk_pixbuf_composite
|
||||
gdk_pixbuf_composite_color
|
||||
|
||||
@@ -10,11 +10,12 @@
|
||||
<!entity gdk-pixbuf-animation SYSTEM "sgml/animation.sgml">
|
||||
<!entity GdkPixbufLoader SYSTEM "sgml/gdk-pixbuf-loader.sgml">
|
||||
<!entity GnomeCanvasPixbuf SYSTEM "sgml/gnome-canvas-pixbuf.sgml">
|
||||
<!entity Compiling SYSTEM "compiling.sgml">
|
||||
]>
|
||||
|
||||
<book>
|
||||
<bookinfo>
|
||||
<title>The GdkPixbuf Library</title>
|
||||
<title>The <application>gdk-pixbuf</application> Library</title>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
@@ -40,8 +41,9 @@
|
||||
<partintro>
|
||||
<para>
|
||||
This part presents the class and function reference for the
|
||||
GdkPixbuf library. Classes are described together with their
|
||||
methods; individual functions are grouped by functional group.
|
||||
<application>gdk-pixbuf</application> library. Classes are
|
||||
described together with their methods; individual functions
|
||||
are grouped by functional group.
|
||||
</para>
|
||||
</partintro>
|
||||
|
||||
@@ -57,4 +59,6 @@
|
||||
&GdkPixbufLoader;
|
||||
&GnomeCanvasPixbuf;
|
||||
</reference>
|
||||
|
||||
&Compiling;
|
||||
</book>
|
||||
|
||||
@@ -18,6 +18,7 @@ GdkPixbufLoader *gdkpixbufloader
|
||||
<NAME>GdkPixbufLoader::frame-done</NAME>
|
||||
<RETURNS>void</RETURNS>
|
||||
GdkPixbufLoader *gdkpixbufloader
|
||||
gpointer arg1
|
||||
</SIGNAL>
|
||||
|
||||
<SIGNAL>
|
||||
|
||||
@@ -6,11 +6,12 @@ Animations as multi-frame structures.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The GdkPixbuf library provides a simple mechanism to load and
|
||||
represent animations, primarily animated GIF files. Animations
|
||||
are represented as lists of #GdkPixbufFrame structures. Each
|
||||
frame structure contains a #GdkPixbuf structure and information
|
||||
about the frame's overlay mode and duration.
|
||||
The <application>gdk-pixbuf</application> library provides a
|
||||
simple mechanism to load and represent animations, primarily
|
||||
animated GIF files. Animations are represented as lists of
|
||||
#GdkPixbufFrame structures. Each frame structure contains a
|
||||
#GdkPixbuf structure and information about the frame's overlay
|
||||
mode and duration.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
@@ -21,18 +22,19 @@ Animations as multi-frame structures.
|
||||
<!-- ##### ENUM GdkPixbufFrameAction ##### -->
|
||||
<para>
|
||||
Each animation frame can have several things happen to it when the
|
||||
next frame is displayed. The #GdkPixbufFrameAction determines this.
|
||||
If a frame as marked as #GDK_PIXBUF_FRAME_RETAIN, then the image
|
||||
will remain displayed, and will be potentially occluded by the next
|
||||
frame. If it is marked as #GDK_PIXBUF_FRAME_DISPOSE, then the
|
||||
animation is reverted to the setting before the frame was shown. If
|
||||
it is marked as #GDK_PIXBUF_FRAME_REVERT, then the animation is
|
||||
reverted to the first image before continuing.
|
||||
next frame is displayed. The #GdkPixbufFrameAction determines
|
||||
this. These are essentially the overlay modes supported by GIF
|
||||
animations.
|
||||
</para>
|
||||
|
||||
@GDK_PIXBUF_FRAME_RETAIN:
|
||||
@GDK_PIXBUF_FRAME_DISPOSE:
|
||||
@GDK_PIXBUF_FRAME_REVERT:
|
||||
@GDK_PIXBUF_FRAME_RETAIN: The previous image should remain displayed,
|
||||
and will potentially be occluded by the new frame.
|
||||
|
||||
@GDK_PIXBUF_FRAME_DISPOSE: The animation will be reverted to the state
|
||||
before the frame was shown.
|
||||
|
||||
@GDK_PIXBUF_FRAME_REVERT: The animation will be reverted to the first
|
||||
frame.
|
||||
|
||||
<!-- ##### STRUCT GdkPixbufFrame ##### -->
|
||||
<para>
|
||||
@@ -42,22 +44,12 @@ Animations as multi-frame structures.
|
||||
action.
|
||||
</para>
|
||||
|
||||
@pixbuf: The frame's image contents.
|
||||
@x_offset: X offset of the frame inside the animation's bounding box.
|
||||
@y_offset: Y offset of the frame inside the animation's bounding box.
|
||||
@delay_time: Duration of the frame in milliseconds.
|
||||
@action: Overlay mode.
|
||||
|
||||
<!-- ##### STRUCT GdkPixbufAnimation ##### -->
|
||||
<para>
|
||||
This structure describes an animation, which is represented as a
|
||||
list of #GdkPixbufFrame structures.
|
||||
</para>
|
||||
|
||||
@ref_count: Reference count.
|
||||
@n_frames: Number of frames in the animation.
|
||||
@frames: List of #GdkPixbufFrame structures.
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_animation_new_from_file ##### -->
|
||||
<para>
|
||||
|
||||
@@ -81,11 +73,92 @@ Animations as multi-frame structures.
|
||||
|
||||
</para>
|
||||
|
||||
@animation: <!--
|
||||
@animation:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_animation_get_frames ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@animation:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_animation_get_width ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@animation:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_animation_get_num_frames ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@animation:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_animation_get_height ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@animation:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_frame_get_pixbuf ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@frame:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_frame_get_action ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@frame:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_frame_get_y_offset ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@frame:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_frame_get_delay_time ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@frame:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_frame_get_x_offset ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@frame:
|
||||
@Returns:
|
||||
|
||||
<!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
|
||||
|
||||
@@ -6,21 +6,15 @@ Creating a pixbuf from image data that is already in memory.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The most basic way to create a pixbuf is to wrap an existing
|
||||
#ArtPixBuf structure with a #GdkPixbuf to add reference counting
|
||||
capabilities to it. The gdk_pixbuf_new_from_art_pixbuf() performs
|
||||
this operation.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
As a convenience, you can use the gdk_pixbuf_new_from_data()
|
||||
function to wrap an existing data buffer with a #GdkPixbuf. You
|
||||
need to specify the destroy notification function that will be
|
||||
called when the data buffer needs to be freed; this will happen
|
||||
when the pixbuf's reference count drops to zero and thus the
|
||||
#ArtPixBuf needs to be destroyed. If you have a chunk of static
|
||||
data compiled into your application, you can pass in #NULL as the
|
||||
destroy notification function so that the data will not be freed.
|
||||
The most basic way to create a pixbuf is to wrap an existing pixel
|
||||
buffer with a #GdkPixbuf structure. You can use the
|
||||
gdk_pixbuf_new_from_data() function to do this You need to specify
|
||||
the destroy notification function that will be called when the
|
||||
data buffer needs to be freed; this will happen when a #GdkPixbuf
|
||||
is finalized by the reference counting functions If you have a
|
||||
chunk of static data compiled into your application, you can pass
|
||||
in #NULL as the destroy notification function so that the data
|
||||
will not be freed.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -37,26 +31,24 @@ Creating a pixbuf from image data that is already in memory.
|
||||
function to create a pixbuf from inline XPM image data.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#ArtPixBuf
|
||||
You can also copy an existing pixbuf with the gdk_pixbuf_copy()
|
||||
function. This is not the same as just doing a gdk_pixbuf_ref()
|
||||
on the old pixbuf; the copy function will actually duplicate the
|
||||
pixel data in memory and create a new #GdkPixbuf structure for it.
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_new_from_art_pixbuf ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@art_pixbuf:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
gdk_pixbuf_finalize().
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@format:
|
||||
@colorspace:
|
||||
@has_alpha:
|
||||
@bits_per_sample:
|
||||
@width:
|
||||
@@ -70,13 +62,14 @@ Creating a pixbuf from image data that is already in memory.
|
||||
</para>
|
||||
|
||||
@data:
|
||||
@format:
|
||||
@colorspace:
|
||||
@has_alpha:
|
||||
@bits_per_sample:
|
||||
@width:
|
||||
@height:
|
||||
@rowstride:
|
||||
@dfunc:
|
||||
@dfunc_data:
|
||||
@destroy_fn:
|
||||
@destroy_fn_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
@@ -86,7 +79,18 @@ Creating a pixbuf from image data that is already in memory.
|
||||
</para>
|
||||
|
||||
@data:
|
||||
@Returns: <!--
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_copy ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@Returns:
|
||||
|
||||
<!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
|
||||
@@ -6,11 +6,12 @@ Loading a pixbuf from a file.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The GdkPixbuf library provides a simple mechanism for loading an
|
||||
image from a file in synchronous fashion. This means that the
|
||||
library takes control of the application while the file is being
|
||||
loaded; from the user's point of view, the application will block
|
||||
until the image is done loading.
|
||||
The <application>gdk-pixbuf</application> library provides a
|
||||
simple mechanism for loading an image from a file in synchronous
|
||||
fashion. This means that the library takes control of the
|
||||
application while the file is being loaded; from the user's point
|
||||
of view, the application will block until the image is done
|
||||
loading.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -22,7 +23,7 @@ Loading a pixbuf from a file.
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GdkPixbufLoader
|
||||
#GdkPixbufLoader.
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_new_from_file ##### -->
|
||||
@@ -31,7 +32,8 @@ Loading a pixbuf from a file.
|
||||
</para>
|
||||
|
||||
@filename:
|
||||
@Returns: <!--
|
||||
@Returns:
|
||||
<!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
|
||||
@@ -15,7 +15,7 @@ Getting parts of a drawable's image data into a pixbuf.
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GdkPixbuf, gdk_image_get()
|
||||
gdk_image_get().
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_from_drawable ##### -->
|
||||
@@ -32,7 +32,8 @@ Getting parts of a drawable's image data into a pixbuf.
|
||||
@dest_y:
|
||||
@width:
|
||||
@height:
|
||||
@Returns: <!--
|
||||
@Returns:
|
||||
<!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
|
||||
@@ -8,51 +8,65 @@ Application-driven progressive image loading.
|
||||
<para>
|
||||
#GdkPixbufLoader provides a way for applications to drive the
|
||||
process of loading an image, by letting them send the image data
|
||||
directly. Applications can use this functionality instead of
|
||||
directly to the loader instead of having the loader read the data
|
||||
from a file. Applications can use this functionality instead of
|
||||
gdk_pixbuf_new_from_file() when they need to parse image data in
|
||||
small chunks. For example, it should be used when reading an image
|
||||
from a (potentially) slow network connection, or when loading an
|
||||
extremely large file.
|
||||
small chunks. For example, it should be used when reading an
|
||||
image from a (potentially) slow network connection, or when
|
||||
loading an extremely large file.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To use #GdkPixbufLoader to load an image, just create a new one, and
|
||||
call gdk_pixbuf_loader_write() to send the data to it. When done,
|
||||
gdk_pixbuf_loader_close() should be called to end the stream and
|
||||
finalize everything. The loader will emit two important signals
|
||||
throughout the process. The first, #"area_prepared", will be called
|
||||
as soon as the image has enough information to determine the size of
|
||||
the image to be used. It will pass a @GdkPixbuf in. If you want to
|
||||
use it, you can simply ref it. In addition, no actual information
|
||||
will be passed in yet, so the pixbuf can be safely filled with any
|
||||
temporary graphics (or an initial color) as needed. You can also
|
||||
call the gdk_pixbuf_loader_get_pixbuf() once this signal has been
|
||||
emitted and get the same pixbuf.
|
||||
To use #GdkPixbufLoader to load an image, just create a new one,
|
||||
and call gdk_pixbuf_loader_write() to send the data to it. When
|
||||
done, gdk_pixbuf_loader_close() should be called to end the stream
|
||||
and finalize everything. The loader will emit two important
|
||||
signals throughout the process. The first, "<link
|
||||
linkend="GdkPixbufLoader-area-prepared">area_prepared</link>",
|
||||
will be called as soon as the image has enough information to
|
||||
determine the size of the image to be used. It will pass a
|
||||
@GdkPixbuf in. If you want to use it, you can simply ref it. In
|
||||
addition, no actual information will be passed in yet, so the
|
||||
pixbuf can be safely filled with any temporary graphics (or an
|
||||
initial color) as needed. You can also call the
|
||||
gdk_pixbuf_loader_get_pixbuf() once this signal has been emitted
|
||||
and get the same pixbuf.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The other signal, #"area_updated" gets called every
|
||||
time a region is updated. This way you can update a partially
|
||||
completed image. Note that you do not know anything about the
|
||||
completeness of an image from the area updated. For example, in an
|
||||
interlaced image, you need to make several passes before the image
|
||||
is done loading.
|
||||
The other signal, "<link
|
||||
linkend="GdkPixbufLoader-area-updated">area_updated</link>" gets
|
||||
called every time a region is updated. This way you can update a
|
||||
partially completed image. Note that you do not know anything
|
||||
about the completeness of an image from the area updated. For
|
||||
example, in an interlaced image, you need to make several passes
|
||||
before the image is done loading.
|
||||
</para>
|
||||
|
||||
<refsect2>
|
||||
<title>Loading an animation</title>
|
||||
<title>Loading an animation</title>
|
||||
|
||||
<para>
|
||||
Loading an animation is a little more complex then loading an
|
||||
image. In addition to the above signals, there is also a
|
||||
#"frame_done" signal, as well as an #"animation_done" signal. The
|
||||
first lets the application know that it is dealing with an
|
||||
animation, instead of a static image. It also passes a
|
||||
#GdkPixbufFrame in the signal. As before, if you want to keep the
|
||||
frame, you need to ref it. Once the first #"frame_done" signal
|
||||
image. In addition to the above signals, there is also a "<link
|
||||
linkend="GdkPixbufLoader-frame-done">frame_done</link>" signal,
|
||||
as well as an "<link
|
||||
linkend="GdkPixbufLoader-animation-done">animation_done</link>"
|
||||
signal. The first lets the application know that it is dealing
|
||||
with an animation, instead of a static image. It also passes a
|
||||
#GdkPixbufFrame in the signal. As before, if you want to keep
|
||||
the frame, you need to ref it. Once the first "<link
|
||||
linkend="GdkPixbufLoader-frame-done">frame_done</link>" signal
|
||||
has been emitted, you can call gdk_pixbuf_loader_get_animation()
|
||||
to get the #GdkPixbufAnimation struct. Each subsequent frame goes
|
||||
through a similar lifecycle. For example #"area_prepared" is
|
||||
re-emitted. Then #"area_updated" is emitted as many times as
|
||||
necessary. Finally, #"animation_done" is emitted as soon as all
|
||||
frames are done.
|
||||
</para>
|
||||
to get the #GdkPixbufAnimation struct. Each subsequent frame
|
||||
goes through a similar lifecycle. For example "<link
|
||||
linkend="GdkPixbufLoader-area-prepared">area_prepared</link>" is
|
||||
re-emitted. Then "<link
|
||||
linkend="GdkPixbufLoader-area-updated">area_updated</link>" is
|
||||
emitted as many times as necessary. Finally, "<link
|
||||
linkend="GdkPixbufLoader-animation-done">animation_done</link>"
|
||||
is emitted as soon as all frames are done.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
@@ -122,12 +136,6 @@ Application-driven progressive image loading.
|
||||
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.
|
||||
@@ -143,23 +151,23 @@ Application-driven progressive image loading.
|
||||
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>
|
||||
<para>
|
||||
This signal is emitted when a frame is done loading. It will be
|
||||
emitted for each frame in an animation data stream.
|
||||
</para>
|
||||
|
||||
</para>
|
||||
|
||||
@gdkpixbufloader: the object which received the signal.
|
||||
@loader: Loader which emitted the signal.
|
||||
@frame: Frame which just completed loading.
|
||||
|
||||
<!-- ##### SIGNAL GdkPixbufLoader::animation-done ##### -->
|
||||
<para>
|
||||
<para>
|
||||
This signal is emitted when an animation is done loading.
|
||||
</para>
|
||||
|
||||
</para>
|
||||
|
||||
@gdkpixbufloader: the object which received the signal.
|
||||
@loader: Loader which emitted the signal.
|
||||
|
||||
<!-- ##### SIGNAL GdkPixbufLoader::closed ##### -->
|
||||
<para>
|
||||
@@ -169,8 +177,6 @@ Application-driven progressive image loading.
|
||||
drives it.
|
||||
</para>
|
||||
|
||||
@gdkpixbufloader: the object which received the signal.
|
||||
<!-- # Unused Parameters # -->
|
||||
@loader: Loader which emitted the signal.
|
||||
|
||||
<!--
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
<!-- ##### SECTION ./tmpl/gdk-pixbuf-io.sgml:See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_load_module ##### -->
|
||||
<para>
|
||||
|
||||
@@ -15,12 +9,6 @@
|
||||
|
||||
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:height_pixels ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### STRUCT GdkPixbufModule ##### -->
|
||||
<para>
|
||||
|
||||
@@ -35,6 +23,52 @@
|
||||
@stop_load:
|
||||
@load_increment:
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:x_set ##### -->
|
||||
<para>
|
||||
Determines whether the <link
|
||||
linkend="GnomeCanvasPixbuf--x">x</link> argument is used to
|
||||
translate the pixbuf from its logical origin in item-relative
|
||||
coordinates.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### USER_FUNCTION ModulePreparedNotifyFunc ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@user_data:
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_module ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### SECTION ./tmpl/gdk-pixbuf-io.sgml:See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_new_from_art_pixbuf ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@art_pixbuf:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:height_pixels ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:y_pixels ##### -->
|
||||
<para>
|
||||
|
||||
@@ -63,15 +97,6 @@
|
||||
gdk-pixbuf-io
|
||||
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:x_set ##### -->
|
||||
<para>
|
||||
Determines whether the <link
|
||||
linkend="GnomeCanvasPixbuf--x">x</link> argument is used to
|
||||
translate the pixbuf from its logical origin in item-relative
|
||||
coordinates.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:y_set ##### -->
|
||||
<para>
|
||||
Determines whether the <link
|
||||
@@ -83,27 +108,18 @@ gdk-pixbuf-io
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### USER_FUNCTION ModulePreparedNotifyFunc ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@user_data:
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:x_pixels ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_module ##### -->
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_format ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
@size:
|
||||
@pixbuf:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:width_pixels ##### -->
|
||||
|
||||
@@ -8,28 +8,32 @@ Information that describes an image.
|
||||
|
||||
<para>
|
||||
The <structname>GdkPixbuf</structname> structure contains
|
||||
information that describes an image in memory. It is actually a
|
||||
simple wrapper that adds reference counting capabilities to an
|
||||
#ArtPixBuf structure.
|
||||
information that describes an image in memory.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#ArtPixBuf
|
||||
</para>
|
||||
|
||||
<!-- ##### ENUM GdkColorspace ##### -->
|
||||
<para>
|
||||
This enumeration defines the color spaces that are supported by
|
||||
the <application>gdk-pixbuf</application> library. Currently only
|
||||
RGB is supported.
|
||||
</para>
|
||||
|
||||
@GDK_COLORSPACE_RGB: Indicates a red/green/blue additive color space.
|
||||
|
||||
<!-- ##### STRUCT GdkPixbuf ##### -->
|
||||
<para>
|
||||
This is the main structure in the GdkPixbuf library. This
|
||||
structure adds reference counting capabilities to an #ArtPixBuf
|
||||
structure.
|
||||
This is the main structure in the
|
||||
<application>gdk-pixbuf</application> library. It is used to
|
||||
represent images. It contains information about the image's pixel
|
||||
data, its color space, bits per sample, width and height, and the
|
||||
rowstride or number of bytes between rows.
|
||||
</para>
|
||||
|
||||
@ref_count: Reference count.
|
||||
@art_pixbuf: An #ArtPixBuf that actually contains the description of
|
||||
the image data.
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_format ##### -->
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_colorspace ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
@@ -98,11 +102,11 @@ the image data.
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@Returns: <!--
|
||||
@Returns:
|
||||
|
||||
<!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
|
||||
|
||||
@@ -217,8 +217,8 @@ Canvas item to display #GdkPixbuf images.
|
||||
Determines whether the <link
|
||||
linkend="GnomeCanvasPixbuf--width">width</link> argument is taken
|
||||
into account when scaling the pixbuf item. If this argument is
|
||||
%FALSE, then the width value of the pixbuf's #ArtPixBuf will be
|
||||
used instead. This argument is %FALSE by default.
|
||||
%FALSE, then the width value of the pixbuf will be used instead.
|
||||
This argument is %FALSE by default.
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GnomeCanvasPixbuf:width_in_pixels ##### -->
|
||||
@@ -299,4 +299,3 @@ mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Reference Counting
|
||||
Reference Counting and Memory Mangement
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Functions to perform reference counting on a #GdkPixbuf.
|
||||
|
||||
Functions to perform reference counting and memory management on a
|
||||
#GdkPixbuf.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
@@ -15,11 +17,75 @@ Functions to perform reference counting on a #GdkPixbuf.
|
||||
#GdkPixbuf structures start with a reference count of one.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<emphasis>Finalizing</emphasis> a pixbuf means to free its pixel
|
||||
data and to free the #GdkPixbuf structure itself. Most of the
|
||||
library functions that create #GdkPixbuf structures create the
|
||||
pixel data by themselves and define the way it should be freed;
|
||||
you do not need to worry about those. The only function that lets
|
||||
you specify how to free the pixel data is
|
||||
gdk_pixbuf_new_from_data(). Since you pass it a pre-allocated
|
||||
pixel buffer, you must also specify a way to free that data. This
|
||||
is done with a function of type #GdkPixbufDestroyNotify. When a
|
||||
pixbuf created with gdk_pixbuf_new_from_data() is finalized, your
|
||||
destroy notification function will be called, and it is its
|
||||
responsibility to free the pixel array.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
As an extension to traditional reference counting, #GdkPixbuf
|
||||
structures support defining a handler for the last unref
|
||||
operation. If gdk_pixbuf_unref() is called on a #GdkPixbuf
|
||||
structure that has a reference count of 1, i.e. its last
|
||||
reference, then the pixbuf's last unref handler function will be
|
||||
called. It is up to this function to determine whether to
|
||||
finalize the pixbuf using gdk_pixbuf_finalize() or to just
|
||||
continue execution. This can be used to implement a pixbuf cache
|
||||
efficiently; please see the programmer's documentation for
|
||||
details.
|
||||
</para>
|
||||
|
||||
<!-- FIXME: link the last sentence above to the relevant section of
|
||||
the programmer's docs.
|
||||
-->
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GdkPixbuf, #ArtPixBuf
|
||||
#GdkPixbuf, gdk_pixbuf_new_from_data().
|
||||
</para>
|
||||
|
||||
<!-- ##### USER_FUNCTION GdkPixbufDestroyNotify ##### -->
|
||||
<para>
|
||||
A function of this type is responsible for freeing the pixel array
|
||||
of a pixbuf. The gdk_pixbuf_new_from_data() function lets you
|
||||
pass in a pre-allocated pixel array so that a pixbuf can be
|
||||
created from it; in this case you will need to pass in a function
|
||||
of #GdkPixbufDestroyNotify so that the pixel data can be freed
|
||||
when the pixbuf is finalized.
|
||||
</para>
|
||||
|
||||
@pixels: The pixel array of the pixbuf that is being finalized.
|
||||
@data: User closure data.
|
||||
|
||||
|
||||
<!-- ##### USER_FUNCTION GdkPixbufLastUnref ##### -->
|
||||
<para>
|
||||
A function of this type can be used to override the default
|
||||
operation when a pixbuf loses its last reference, i.e. when
|
||||
gdk_pixbuf_unref() is called on a #GdkPixbuf structure that has a
|
||||
reference count of 1. This function should determine whether to
|
||||
finalize the pixbuf by calling gdk_pixbuf_finalize(), or whether
|
||||
to just resume normal execution. The last unref handler for a
|
||||
#GdkPixbuf can be set using the
|
||||
gdk_pixbuf_set_last_unref_handler() function. By default, pixbufs
|
||||
will be finalized automatically if no last unref handler has been
|
||||
defined.
|
||||
</para>
|
||||
|
||||
@pixbuf: The pixbuf that is losing its last reference.
|
||||
@data: User closure data.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_ref ##### -->
|
||||
<para>
|
||||
|
||||
@@ -34,11 +100,29 @@ Functions to perform reference counting on a #GdkPixbuf.
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf: <!--
|
||||
@pixbuf:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_set_last_unref_handler ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@last_unref_fn:
|
||||
@last_unref_fn_data:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_finalize ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
|
||||
<!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
|
||||
|
||||
@@ -6,18 +6,19 @@ Rendering a pixbuf to a GDK drawable.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The GdkPixbuf library provides several convenience functions to
|
||||
render pixbufs to GDK drawables. It uses the GdkRGB to render the
|
||||
image data.
|
||||
The <application>gdk-pixbuf</application> library provides several
|
||||
convenience functions to render pixbufs to GDK drawables. It uses
|
||||
the GdkRGB to render the image data.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
At this point there is not a standard alpha channel extension for
|
||||
the X Window System, so it is not possible to use full opacity
|
||||
information when painting images to arbitrary drawables. The
|
||||
GdkPixbuf convenience functions will threshold the opacity
|
||||
information to create a bi-level clipping mask (black and white),
|
||||
and use that to draw the image onto a drawable.
|
||||
<application>gdk-pixbuf</application> convenience functions will
|
||||
threshold the opacity information to create a bi-level clipping
|
||||
mask (black and white), and use that to draw the image onto a
|
||||
drawable.
|
||||
</para>
|
||||
|
||||
<important>
|
||||
@@ -104,13 +105,7 @@ In the future it will do full alpha compositing.
|
||||
@dest_y:
|
||||
@width:
|
||||
@height:
|
||||
@alpha_threshold: <!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
@alpha_threshold:
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_render_pixmap_and_mask ##### -->
|
||||
<para>
|
||||
@@ -123,3 +118,9 @@ End:
|
||||
@alpha_threshold:
|
||||
|
||||
|
||||
<!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
@@ -5,34 +5,37 @@ Scaling
|
||||
Scaling pixbufs and scaling and compositing pixbufs
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
gdk-pixbuf contains functions to scale pixbufs, to scale pixbufs and
|
||||
composite against an existing image, and to scale pixbufs and
|
||||
composite against a solid color or checkerboard. (Compositing a
|
||||
checkerboard is a common way to show an image with an alpha-channel in
|
||||
image-viewing and editing software.)
|
||||
</para>
|
||||
<para>
|
||||
Since the full-featured functions (gdk_pixbuf_scale(),
|
||||
gdk_pixbuf_composite(), and gdk_pixbuf_composite_color()) are
|
||||
rather complex to use and have many arguments, two simple
|
||||
convenience functions are provided, gdk_pixbuf_scale_simple()
|
||||
and gdk_pixbuf_composite_color_simple() which create a
|
||||
new pixbuf of a given size, scale an original image to fit,
|
||||
and then return the new pixmap.
|
||||
</para>
|
||||
<para>
|
||||
The <application>gdk-pixbuf</application> contains functions to
|
||||
scale pixbufs, to scale pixbufs and composite against an existing
|
||||
image, and to scale pixbufs and composite against a solid color or
|
||||
checkerboard. Compositing a checkerboard is a common way to show
|
||||
an image with an alpha channel in image-viewing and editing
|
||||
software.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The following example demonstrates handling an expose event by
|
||||
rendering the appropriate area of a source image (which is scaled to
|
||||
fit the widget) onto the widget's window. The source image is
|
||||
rendered against a checkerboard, which provides a visual
|
||||
representation of the alpha channel if the image has one. If the image
|
||||
doesn't have an alpha channel, calling gdk_pixbuf_composite_color()
|
||||
function has exactly the same effect as calling gdk_pixbuf_scale().
|
||||
</para>
|
||||
<para>
|
||||
Since the full-featured functions (gdk_pixbuf_scale(),
|
||||
gdk_pixbuf_composite(), and gdk_pixbuf_composite_color()) are
|
||||
rather complex to use and have many arguments, two simple
|
||||
convenience functions are provided, gdk_pixbuf_scale_simple() and
|
||||
gdk_pixbuf_composite_color_simple() which create a new pixbuf of a
|
||||
given size, scale an original image to fit, and then return the
|
||||
new pixmap.
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
<para>
|
||||
The following example demonstrates handling an expose event by
|
||||
rendering the appropriate area of a source image (which is scaled
|
||||
to fit the widget) onto the widget's window. The source image is
|
||||
rendered against a checkerboard, which provides a visual
|
||||
representation of the alpha channel if the image has one. If the
|
||||
image doesn't have an alpha channel, calling
|
||||
gdk_pixbuf_composite_color() function has exactly the same effect
|
||||
as calling gdk_pixbuf_scale().
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
gboolean
|
||||
expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
{
|
||||
@@ -40,15 +43,15 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
|
||||
gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
|
||||
|
||||
dest = gdk_pixbuf_new (ART_PIX_RGB, FALSE, 8, event->area.width, event->area.height);
|
||||
dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, event->area.width, event->area.height);
|
||||
|
||||
gdk_pixbuf_composite_color (pixbuf, dest,
|
||||
0, 0, event->area.width, event->area.height,
|
||||
-event->area.x, -event->area.y,
|
||||
(double) widget->allocation.width / pixbuf->art_pixbuf->width,
|
||||
(double) widget->allocation.height / pixbuf->art_pixbuf->height,
|
||||
filter_level, 255,
|
||||
event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555);
|
||||
(double) widget->allocation.width / gdk_pixbuf_get_width (pixbuf),
|
||||
(double) widget->allocation.height / gdk_pixbuf_get_height (pixbuf),
|
||||
GDK_INTERP_BILINEAR, 255,
|
||||
event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555);
|
||||
|
||||
gdk_pixbuf_render_to_drawable (dest, widget->window, widget->style->fg_gc[GTK_STATE_NORMAL],
|
||||
0, 0, event->area.x, event->area.y,
|
||||
@@ -59,12 +62,45 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
</programlisting>
|
||||
</programlisting>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
<para>
|
||||
GdkRGB
|
||||
</para>
|
||||
|
||||
</para>
|
||||
<!-- ##### ENUM GdkInterpType ##### -->
|
||||
<para>
|
||||
This enumeration describes the different interpolation modes that
|
||||
can be used with the scaling functions.
|
||||
|
||||
<note>
|
||||
<para>
|
||||
Cubic filtering is missing from the list; hyperbolic
|
||||
interpolation is just as fast and results in higher quality.
|
||||
</para>
|
||||
</note>
|
||||
</para>
|
||||
|
||||
@GDK_INTERP_NEAREST: Nearest neighbor sampling; this is the fastest
|
||||
and lowest quality mode.
|
||||
|
||||
@GDK_INTERP_TILES: This is an accurate simulation of the PostScript
|
||||
image operator without any interpolation enabled. Each pixel is
|
||||
rendered as a tiny parallelogram of solid color, the edges of which
|
||||
are implemented with antialiasing. It resembles nearest neighbor for
|
||||
enlargement, and bilinear for reduction.
|
||||
|
||||
@GDK_INTERP_BILINEAR: Bilinear interpolation. For enlargement, it is
|
||||
equivalent to point-sampling the ideal bilinear-interpolated image.
|
||||
For reduction, it is equivalent to laying down small tiles and
|
||||
integrating over the coverage area.
|
||||
|
||||
@GDK_INTERP_HYPER: This is the slowest and highest quality
|
||||
reconstruction function. It is derived from the hyperbolic filters in
|
||||
Wolberg's "Digital Image Warping", and is formally defined as the
|
||||
hyperbolic-filter sampling the ideal hyperbolic-filter interpolated
|
||||
image (the filter is designed to be idempotent for 1:1 pixel mapping).
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_scale ##### -->
|
||||
<para>
|
||||
@@ -81,7 +117,7 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
@offset_y:
|
||||
@scale_x:
|
||||
@scale_y:
|
||||
@filter_level:
|
||||
@interp_type:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_composite ##### -->
|
||||
@@ -99,7 +135,7 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
@offset_y:
|
||||
@scale_x:
|
||||
@scale_y:
|
||||
@filter_level:
|
||||
@interp_type:
|
||||
@overall_alpha:
|
||||
|
||||
|
||||
@@ -118,7 +154,7 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
@offset_y:
|
||||
@scale_x:
|
||||
@scale_y:
|
||||
@filter_level:
|
||||
@interp_type:
|
||||
@overall_alpha:
|
||||
@check_x:
|
||||
@check_y:
|
||||
@@ -135,7 +171,7 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
@src:
|
||||
@dest_width:
|
||||
@dest_height:
|
||||
@filter_level:
|
||||
@interp_type:
|
||||
@Returns:
|
||||
|
||||
|
||||
@@ -147,16 +183,17 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
@src:
|
||||
@dest_width:
|
||||
@dest_height:
|
||||
@filter_level:
|
||||
@interp_type:
|
||||
@overall_alpha:
|
||||
@check_size:
|
||||
@color1:
|
||||
@color2:
|
||||
@Returns: <!--
|
||||
@Returns:
|
||||
|
||||
|
||||
<!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
|
||||
|
||||
@@ -27,13 +27,7 @@ Utility and miscellaneous convenience functions.
|
||||
@r:
|
||||
@g:
|
||||
@b:
|
||||
@Returns: <!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
@Returns:
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_copy_area ##### -->
|
||||
<para>
|
||||
@@ -50,3 +44,9 @@ End:
|
||||
@dest_y:
|
||||
|
||||
|
||||
<!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
||||
End:
|
||||
-->
|
||||
|
||||
@@ -246,7 +246,7 @@ This overrides any previous keyboard grab by this client.
|
||||
@owner_events: if FALSE then all keyboard events are reported with respect to
|
||||
@window. If TRUE then keyboard events for this application are reported as
|
||||
normal, but keyboard events outside this application are reported with respect
|
||||
to @window. Both key press and key release events are alwasy reported,
|
||||
to @window. Both key press and key release events are always reported,
|
||||
independant of the event mask set by the application.
|
||||
@time: a timestamp from a #GdkEvent, or #GDK_CURRENT_TIME if no timestamp is
|
||||
available.
|
||||
|
||||
@@ -94,7 +94,7 @@ pre-edit flags and the status flags.
|
||||
</para>
|
||||
<para>
|
||||
The pre-edit flags specify how pre-editing data is displayed.
|
||||
For example, this could display the text being typed in in the phonetic
|
||||
For example, this could display the text being typed in the phonetic
|
||||
alphabet before it is composed and inserted as an ideograph.
|
||||
</para>
|
||||
<para>
|
||||
@@ -193,12 +193,12 @@ styles is returned.
|
||||
|
||||
<!-- ##### FUNCTION gdk_im_begin ##### -->
|
||||
<para>
|
||||
Starts editing, using the given #GdkInputContext and #GdkWindow.
|
||||
Starts editing, using the given input context and #GdkWindow.
|
||||
This should be called when the widget receives the input focus, typically in
|
||||
the widget's focus_in_event method.
|
||||
</para>
|
||||
|
||||
@ic: a #GdkInputContext.
|
||||
@ic: a #GdkIC.
|
||||
@window: the #GdkWindow which will be receiving the key press events.
|
||||
|
||||
|
||||
|
||||
@@ -58,11 +58,15 @@ gdk_rgb_set_min_colors (). The default is 5x5x5 (125). If a colorcube
|
||||
of this size or larger can be allocated in the default colormap, then
|
||||
that's done. Otherwise, GdkRgb creates its own private colormap.
|
||||
Setting it to 0 means that it always tries to use the default
|
||||
colormap, and setting it to 256 means that it always creates a private
|
||||
one. Note, however, that setting it to 0 doesn't let you get away with
|
||||
ignoring the colormap and visual - a colormap is always created in
|
||||
grayscale and direct color modes, and the visual is changed in cases
|
||||
where a "better" visual than the default is available.
|
||||
colormap, and setting it to 216 means that it always creates a private
|
||||
one if it cannot allocate the 6x6x6 colormap in the default. If you
|
||||
always want a private colormap (to avoid consuming too many colormap
|
||||
entries for other apps, say), you can use gdk_rgb_set_install(TRUE).
|
||||
Setting the value greater than 216 exercises a bug in older versions
|
||||
of GdkRgb. Note, however, that setting it to 0 doesn't let you get
|
||||
away with ignoring the colormap and visual - a colormap is always
|
||||
created in grayscale and direct color modes, and the visual is changed
|
||||
in cases where a "better" visual than the default is available.
|
||||
</para>
|
||||
|
||||
<example>
|
||||
|
||||
@@ -1111,7 +1111,7 @@ aspect of the #GtkCList widget.
|
||||
|
||||
<!-- ##### FUNCTION gtk_clist_set_reorderable ##### -->
|
||||
<para>
|
||||
Sets whether the CList's columns are re-orderable.
|
||||
Sets whether the CList's rows are re-orderable using drag-and-drop.
|
||||
</para>
|
||||
|
||||
@clist: The #GtkCList to affect.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Standard Enumerations
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
|
||||
Public enumerated types used throughout GTK+.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
@@ -26,43 +26,54 @@ Standard Enumerations
|
||||
|
||||
<!-- ##### ENUM GtkArrowType ##### -->
|
||||
<para>
|
||||
|
||||
Used to indicate the direction in which a #GtkArrow should point.
|
||||
</para>
|
||||
|
||||
@GTK_ARROW_UP:
|
||||
@GTK_ARROW_DOWN:
|
||||
@GTK_ARROW_LEFT:
|
||||
@GTK_ARROW_RIGHT:
|
||||
@GTK_ARROW_UP: Represents an upward pointing arrow.
|
||||
@GTK_ARROW_DOWN: Represents a downward pointing arrow.
|
||||
@GTK_ARROW_LEFT: Represents a left pointing arrow.
|
||||
@GTK_ARROW_RIGHT: Represents a right pointing arrow.
|
||||
|
||||
<!-- ##### ENUM GtkAttachOptions ##### -->
|
||||
<para>
|
||||
|
||||
Denotes the expansion properties that a widget will have when it (or it's
|
||||
parent) is resized.
|
||||
</para>
|
||||
|
||||
@GTK_EXPAND:
|
||||
@GTK_SHRINK:
|
||||
@GTK_FILL:
|
||||
@GTK_EXPAND: the widget should expand to take up any extra space in its
|
||||
container that has been allocated.
|
||||
@GTK_SHRINK: the widget should shrink as and when possible.
|
||||
@GTK_FILL: the widget should fill the space allocated to it.
|
||||
|
||||
<!-- ##### ENUM GtkButtonBoxStyle ##### -->
|
||||
<para>
|
||||
|
||||
Used to dictate the style that a #GtkButtonBox uses to layout the buttons it
|
||||
contains. (See also: #GtkVButtonBox and #GtkHButtonBox).
|
||||
</para>
|
||||
|
||||
@GTK_BUTTONBOX_DEFAULT_STYLE:
|
||||
@GTK_BUTTONBOX_SPREAD:
|
||||
@GTK_BUTTONBOX_EDGE:
|
||||
@GTK_BUTTONBOX_START:
|
||||
@GTK_BUTTONBOX_END:
|
||||
@GTK_BUTTONBOX_DEFAULT_STYLE: Default packing.
|
||||
@GTK_BUTTONBOX_SPREAD: Buttons are evenly spread across the ButtonBox.
|
||||
@GTK_BUTTONBOX_EDGE: Buttons are placed at the edges of the ButtonBox.
|
||||
@GTK_BUTTONBOX_START: Buttons are grouped towards the start of box, (on the
|
||||
left for a HBox, or the top for a VBox).
|
||||
@GTK_BUTTONBOX_END: Buttons are grouped towards the end of a box, (on the
|
||||
right for a HBox, or the bottom for a VBox).
|
||||
|
||||
<!-- ##### ENUM GtkCornerType ##### -->
|
||||
<para>
|
||||
|
||||
Specifies which corner a child widget should be placed in when packed into
|
||||
a #GtkScrolledWindow. This is effectively the opposite of where the scroll
|
||||
bars are placed.
|
||||
</para>
|
||||
|
||||
@GTK_CORNER_TOP_LEFT:
|
||||
@GTK_CORNER_BOTTOM_LEFT:
|
||||
@GTK_CORNER_TOP_RIGHT:
|
||||
@GTK_CORNER_BOTTOM_RIGHT:
|
||||
@GTK_CORNER_TOP_LEFT: Place the scrollbars on the right and bottom of the
|
||||
widget (default behaviour).
|
||||
@GTK_CORNER_BOTTOM_LEFT: Place the scrollbars on the top and right of the
|
||||
widget.
|
||||
@GTK_CORNER_TOP_RIGHT: Place the scrollbars on the left and bottom of the
|
||||
widget.
|
||||
@GTK_CORNER_BOTTOM_RIGHT: Place the scrollbars on the top and left of the
|
||||
widget.
|
||||
|
||||
<!-- ##### ENUM GtkCurveType ##### -->
|
||||
<para>
|
||||
@@ -87,13 +98,14 @@ Standard Enumerations
|
||||
|
||||
<!-- ##### ENUM GtkJustification ##### -->
|
||||
<para>
|
||||
|
||||
Used for justifying the text inside a #GtkLabel widget. (See also
|
||||
#GtkAlignment).
|
||||
</para>
|
||||
|
||||
@GTK_JUSTIFY_LEFT:
|
||||
@GTK_JUSTIFY_RIGHT:
|
||||
@GTK_JUSTIFY_CENTER:
|
||||
@GTK_JUSTIFY_FILL:
|
||||
@GTK_JUSTIFY_LEFT: The text is placed at the left edge of the label.
|
||||
@GTK_JUSTIFY_RIGHT: The text is placed at the right edge of the label.
|
||||
@GTK_JUSTIFY_CENTER: The text is placed in the center of the label.
|
||||
@GTK_JUSTIFY_FILL: The text is placed is distributed across the label.
|
||||
|
||||
<!-- ##### ENUM GtkMatchType ##### -->
|
||||
<para>
|
||||
@@ -126,10 +138,11 @@ Standard Enumerations
|
||||
|
||||
<!-- ##### ENUM GtkPackType ##### -->
|
||||
<para>
|
||||
|
||||
Used for packing widgets into #GtkBox widgets. (See also: #GtkVBox,
|
||||
#GtkHBox, and #GtkButtonBox).
|
||||
</para>
|
||||
|
||||
@GTK_PACK_START:
|
||||
@GTK_PACK_START: The
|
||||
@GTK_PACK_END:
|
||||
|
||||
<!-- ##### ENUM GtkPathPriorityType ##### -->
|
||||
@@ -155,12 +168,13 @@ Standard Enumerations
|
||||
|
||||
<!-- ##### ENUM GtkPolicyType ##### -->
|
||||
<para>
|
||||
|
||||
Determines when a scroll bar will be visible.
|
||||
</para>
|
||||
|
||||
@GTK_POLICY_ALWAYS:
|
||||
@GTK_POLICY_AUTOMATIC:
|
||||
@GTK_POLICY_NEVER:
|
||||
@GTK_POLICY_ALWAYS: The scrollbar is always visible.
|
||||
@GTK_POLICY_AUTOMATIC: The scrollbar will appear and disappear as necessary. For example,
|
||||
when all of a #GtkCList can not be seen.
|
||||
@GTK_POLICY_NEVER: The scrollbar will never appear.
|
||||
|
||||
<!-- ##### ENUM GtkPositionType ##### -->
|
||||
<para>
|
||||
@@ -176,26 +190,10 @@ Standard Enumerations
|
||||
<para>
|
||||
An enumeration which describes whether a preview
|
||||
contains grayscale or red-green-blue data.
|
||||
|
||||
<informaltable pgwide=1 frame="none" role="enum">
|
||||
<tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*">
|
||||
<tbody>
|
||||
|
||||
<row>
|
||||
<entry>GTK_PREVIEW_COLOR</entry>
|
||||
<entry>the preview contains red-green-blue data.</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>GTK_PREVIEW_GRAYSCALE</entry>
|
||||
<entry>The preview contains grayscale data.</entry>
|
||||
</row>
|
||||
|
||||
</tbody></tgroup></informaltable>
|
||||
</para>
|
||||
|
||||
@GTK_PREVIEW_COLOR:
|
||||
@GTK_PREVIEW_GRAYSCALE:
|
||||
@GTK_PREVIEW_COLOR: the preview contains red-green-blue data.
|
||||
@GTK_PREVIEW_GRAYSCALE: The preview contains grayscale data.
|
||||
|
||||
<!-- ##### ENUM GtkReliefStyle ##### -->
|
||||
<para>
|
||||
@@ -239,32 +237,34 @@ contains grayscale or red-green-blue data.
|
||||
|
||||
<!-- ##### ENUM GtkShadowType ##### -->
|
||||
<para>
|
||||
|
||||
Used to change the appearance of an outline typically provided by a #GtkFrame.
|
||||
</para>
|
||||
|
||||
@GTK_SHADOW_NONE:
|
||||
@GTK_SHADOW_IN:
|
||||
@GTK_SHADOW_OUT:
|
||||
@GTK_SHADOW_ETCHED_IN:
|
||||
@GTK_SHADOW_NONE: No outline.
|
||||
@GTK_SHADOW_IN: The outline is bevelled inwards.
|
||||
@GTK_SHADOW_OUT: The outline is bevelled outwards like a button.
|
||||
@GTK_SHADOW_ETCHED_IN: The outline itself is an inward bevel, but the frame
|
||||
does
|
||||
@GTK_SHADOW_ETCHED_OUT:
|
||||
|
||||
<!-- ##### ENUM GtkStateType ##### -->
|
||||
<para>
|
||||
|
||||
This type indicates the current state of a widget.
|
||||
</para>
|
||||
|
||||
@GTK_STATE_NORMAL:
|
||||
@GTK_STATE_ACTIVE:
|
||||
@GTK_STATE_PRELIGHT:
|
||||
@GTK_STATE_NORMAL: The state during normal operation.
|
||||
@GTK_STATE_ACTIVE: The widget is currently active, such as a
|
||||
@GTK_STATE_PRELIGHT: The mouse pointer is over the widget.
|
||||
@GTK_STATE_SELECTED:
|
||||
@GTK_STATE_INSENSITIVE:
|
||||
@GTK_STATE_INSENSITIVE: The state of the widget can not be altered by the
|
||||
user. Its appearance will usually indicate this.
|
||||
|
||||
<!-- ##### ENUM GtkSubmenuDirection ##### -->
|
||||
<para>
|
||||
|
||||
Indicates the direction a sub-menu will appear.
|
||||
</para>
|
||||
|
||||
@GTK_DIRECTION_LEFT:
|
||||
@GTK_DIRECTION_LEFT: A sub-menu will appear
|
||||
@GTK_DIRECTION_RIGHT:
|
||||
|
||||
<!-- ##### ENUM GtkSubmenuPlacement ##### -->
|
||||
@@ -277,12 +277,12 @@ contains grayscale or red-green-blue data.
|
||||
|
||||
<!-- ##### ENUM GtkToolbarStyle ##### -->
|
||||
<para>
|
||||
|
||||
Used to customize the appearance of a #GtkToolbar.
|
||||
</para>
|
||||
|
||||
@GTK_TOOLBAR_ICONS:
|
||||
@GTK_TOOLBAR_TEXT:
|
||||
@GTK_TOOLBAR_BOTH:
|
||||
@GTK_TOOLBAR_ICONS: Buttons should display only icons in the toolbar.
|
||||
@GTK_TOOLBAR_TEXT: Buttons should display only text labels in the toolbar.
|
||||
@GTK_TOOLBAR_BOTH: Buttons should display text and icons in the toolbar.
|
||||
|
||||
<!-- ##### ENUM GtkTroughType ##### -->
|
||||
<para>
|
||||
@@ -314,27 +314,33 @@ contains grayscale or red-green-blue data.
|
||||
|
||||
<!-- ##### ENUM GtkWindowPosition ##### -->
|
||||
<para>
|
||||
|
||||
Window placement can be influenced using this enumeration.
|
||||
</para>
|
||||
|
||||
@GTK_WIN_POS_NONE:
|
||||
@GTK_WIN_POS_CENTER:
|
||||
@GTK_WIN_POS_MOUSE:
|
||||
@GTK_WIN_POS_NONE: No influence is made on placement.
|
||||
@GTK_WIN_POS_CENTER: Windows should be placed in the center of the screen.
|
||||
@GTK_WIN_POS_MOUSE: Windows should be placed at the current mouse position.
|
||||
|
||||
<!-- ##### ENUM GtkWindowType ##### -->
|
||||
<para>
|
||||
|
||||
A #GtkWindow can be of these types. A toplevel window has standard window
|
||||
decorations by default. A dialog may have fewer decorations and obey a
|
||||
different placement policy. A popup window will have no decorations.
|
||||
</para>
|
||||
<para>
|
||||
It should be noted that such decorations can often be over-ridden by modern
|
||||
window managers.
|
||||
</para>
|
||||
|
||||
@GTK_WINDOW_TOPLEVEL:
|
||||
@GTK_WINDOW_DIALOG:
|
||||
@GTK_WINDOW_POPUP:
|
||||
@GTK_WINDOW_TOPLEVEL: A window for a typical application.
|
||||
@GTK_WINDOW_DIALOG: A window for transient messages and dialogs.
|
||||
@GTK_WINDOW_POPUP: A window for popups.
|
||||
|
||||
<!-- ##### ENUM GtkSortType ##### -->
|
||||
<para>
|
||||
|
||||
Determines the direction of a sort.
|
||||
</para>
|
||||
|
||||
@GTK_SORT_ASCENDING:
|
||||
@GTK_SORT_DESCENDING:
|
||||
@GTK_SORT_ASCENDING: Sorting is in ascending order.
|
||||
@GTK_SORT_DESCENDING: Sorting is in descending order.
|
||||
|
||||
|
||||
@@ -2,55 +2,68 @@
|
||||
GtkListItem
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
|
||||
an item in a #GtkList.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The #GtkListItem widget is used for each item in a #GtkList.
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term>#GtkList</term>
|
||||
<listitem><para>the parent list widget.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### STRUCT GtkListItem ##### -->
|
||||
<para>
|
||||
|
||||
The #GtkListItem struct contains private data only, and should
|
||||
only be accessed using the functions below.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_list_item_new ##### -->
|
||||
<para>
|
||||
|
||||
Creates a new #GtkListitem.
|
||||
</para>
|
||||
|
||||
@Returns:
|
||||
@Returns: a new #GtkListItem.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_list_item_new_with_label ##### -->
|
||||
<para>
|
||||
|
||||
Creates a new #GtkListItem with a child label containing the given string.
|
||||
</para>
|
||||
|
||||
@label:
|
||||
@Returns:
|
||||
@label: the string to use for the child label.
|
||||
@Returns: a new #GtkListItem with a child #GtkLabel with the text set to
|
||||
@label.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_list_item_select ##### -->
|
||||
<para>
|
||||
|
||||
Selects the item, by emitting the item's "select" signal.
|
||||
Depending on the selection mode of the list, this may cause other items to
|
||||
be deselected.
|
||||
</para>
|
||||
|
||||
@list_item:
|
||||
@list_item: a #GtkListItem.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_list_item_deselect ##### -->
|
||||
<para>
|
||||
|
||||
Deselects the item, by emitting the item's "deselect" signal.
|
||||
</para>
|
||||
|
||||
@list_item:
|
||||
@list_item: a #GtkListItem.
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GtkListItem::toggle-focus-row ##### -->
|
||||
|
||||
@@ -11,7 +11,7 @@ have control over the program flow all the time this does not apply to
|
||||
applications written using GTK. Instead you set up some objects and
|
||||
register some functions (<quote>callbacks</quote>) to be called whenever
|
||||
some event occurs and give control to the GTK mainloop (e.g. by calling
|
||||
<function>gtk_main</function>).
|
||||
gtk_main).
|
||||
</para>
|
||||
|
||||
<example>
|
||||
@@ -143,58 +143,123 @@ and invoke timeouts etc. while doing some time intensive computation.
|
||||
|
||||
<!-- ##### FUNCTION gtk_main ##### -->
|
||||
<para>
|
||||
|
||||
Runs the main loop until gtk_main_quit() is called. You can nest calls to
|
||||
gtk_main. In that case gtk_main_quit() will make the innerst invocation
|
||||
of the main loop return.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_main_level ##### -->
|
||||
<para>
|
||||
|
||||
Ask for the current nesting level of the main loop. This can be useful
|
||||
when calling gtk_quit_add.
|
||||
</para>
|
||||
|
||||
@Returns:
|
||||
@Returns: the nesting level of the current invocation of the main loop.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_main_quit ##### -->
|
||||
<para>
|
||||
|
||||
Makes the innermost invocation of the main loop return when it regains
|
||||
control.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_main_iteration ##### -->
|
||||
<para>
|
||||
|
||||
Runs a single iteration of the mainloop. If no events are waiting to be
|
||||
processed GTK+ will block until the next event is noticed. If you don't
|
||||
want to block look at gtk_main_iteration_do or check if any events are
|
||||
pending with gtk_events_pending first.
|
||||
</para>
|
||||
|
||||
@Returns:
|
||||
@Returns: %TRUE if gtk_main_quit has been called for the innermost mainloop.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_main_iteration_do ##### -->
|
||||
<para>
|
||||
|
||||
Run a single iteration of the mainloop. If no events are available either
|
||||
return or block dependend on the value of @blocking.
|
||||
</para>
|
||||
|
||||
@blocking:
|
||||
@Returns:
|
||||
@blocking: %TRUE if you want GTK+ to block if no events are pending.
|
||||
@Returns: %TRUE if gtk_main_quit has been called for the innermost mainloop.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_main_do_event ##### -->
|
||||
<para>
|
||||
|
||||
Process a single GDK event. This is public only to allow filtering of events
|
||||
between GDK and GTK. You will not usually need to call this function directly.
|
||||
</para>
|
||||
<para>
|
||||
While you should not call this function directly, you might want to know
|
||||
how exactly events are handled. So here is what this function does with
|
||||
the event:
|
||||
</para>
|
||||
|
||||
@event:
|
||||
<orderedlist>
|
||||
<listitem><para>
|
||||
Compress enter/leave notify events. If the event passed build an
|
||||
enter/leave pair together with the next event (peeked from Gdk)
|
||||
both events are thrown away. This is to avoid a backlog of (de-)highlighting
|
||||
widgets crossed by the pointer.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Find the widget which got the event. If the widget can't be determined
|
||||
the event is thrown away unless it belongs to a INCR transaction. In that
|
||||
case it is passed to gtk_selection_incr_event.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Then the event is passed on a stack so you can query the currently handled
|
||||
event with gtk_get_current_event.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
The event is sent to a widget. If a grab is active all events for
|
||||
widgets that are not in the contained in the grab widget are sent to the
|
||||
latter with a few exceptions:
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
Deletion and destruction events are still sent to the event widget for
|
||||
obvious reasons.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Events which directly relate to the visual representation of the event
|
||||
widget.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Leave events are delivered to the event widget if there was an enter
|
||||
event delivered to it before without the paired leave event.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Drag events are not redirected because it is unclear what the semantics
|
||||
of that would be.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
Another point of interest might be that all keypresses are first passed
|
||||
through the key snooper functions if there are any. Read the description
|
||||
of gtk_key_snooper_install() if you need this feature.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
After finishing the delivery the event is popped from the event stack.
|
||||
</para></listitem>
|
||||
</orderedlist>
|
||||
|
||||
@event: An event to process (normally) passed by Gdk.
|
||||
|
||||
|
||||
<!-- ##### USER_FUNCTION GtkModuleInitFunc ##### -->
|
||||
<para>
|
||||
|
||||
Each GTK+ module must have a function gtk_module_init with this prototype.
|
||||
This function is called after loading the module with the argc and argv
|
||||
cleaned from any arguments that GTK+ handles itself.
|
||||
</para>
|
||||
|
||||
@argc:
|
||||
@argv:
|
||||
@argc: Pointer to the number of arguments remaining after gtk_init.
|
||||
@argv: Points to the argument vector.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_true ##### -->
|
||||
@@ -250,137 +315,170 @@ but always returns %FALSE.
|
||||
|
||||
<!-- ##### FUNCTION gtk_grab_add ##### -->
|
||||
<para>
|
||||
|
||||
Makes %widget the current grabbed widget. This means that interaction with
|
||||
other widgets in the same application is blocked and mouse as well as
|
||||
keyboard events are delivered to this %widget.
|
||||
</para>
|
||||
|
||||
@widget:
|
||||
@widget: The widget that grabs keyboard and pointer events.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_grab_get_current ##### -->
|
||||
<para>
|
||||
|
||||
Queries the current grab.
|
||||
</para>
|
||||
|
||||
@Returns:
|
||||
@Returns: The widget which currently has the grab or %NULL if no grab is active.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_grab_remove ##### -->
|
||||
<para>
|
||||
|
||||
Remove the grab from the given widget. You have to pair calls to gtk_grab_add
|
||||
and gtk_grab_remove.
|
||||
</para>
|
||||
|
||||
@widget:
|
||||
@widget: The widget which gives up the grab.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_init_add ##### -->
|
||||
<para>
|
||||
|
||||
Register a function to be called when the mainloop is started.
|
||||
</para>
|
||||
|
||||
@function:
|
||||
@data:
|
||||
@function: Function to invoke when gtk_main is called next.
|
||||
@data: Data to pass to that function.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_quit_add_destroy ##### -->
|
||||
<para>
|
||||
|
||||
Trigger destruction of %object in case the mainloop at level %main_level
|
||||
is quit.
|
||||
</para>
|
||||
|
||||
@main_level:
|
||||
@object:
|
||||
@main_level: Level of the mainloop which shall trigger the destruction.
|
||||
@object: Object to be destroyed.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_quit_add ##### -->
|
||||
<para>
|
||||
|
||||
Registers a function to be called when an instance of the mainloop is left.
|
||||
</para>
|
||||
|
||||
@main_level:
|
||||
@function:
|
||||
@data:
|
||||
@Returns:
|
||||
@main_level: Level at which termination the function shall be called. You
|
||||
can pass 0 here to have the function run at the termination of the current
|
||||
mainloop.
|
||||
@function: The function to call. This should return 0 to be removed from the
|
||||
list of quit handlers. Otherwise the function might be called again.
|
||||
@data: Pointer to pass when calling %function.
|
||||
@Returns: A handle for this quit handler (you need this for gtk_quit_remove())
|
||||
or 0 if you passed a NULL pointer in %function.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_quit_add_full ##### -->
|
||||
<para>
|
||||
|
||||
Registers a function to be called when an instance of the mainloop is left.
|
||||
In comparison to gtk_quit_add() this function adds the possibility to
|
||||
pass a marshaller and a function to be called when the quit handler is freed.
|
||||
</para>
|
||||
<para>
|
||||
The former can be used to run interpreted code instead of a compiled function
|
||||
while the latter can be used to free the information stored in %data (while
|
||||
you can do this in %function as well)... So this function will mostly be
|
||||
used by GTK+ wrappers for languages other than C.
|
||||
</para>
|
||||
|
||||
@main_level:
|
||||
@function:
|
||||
@marshal:
|
||||
@data:
|
||||
@destroy:
|
||||
@Returns:
|
||||
@main_level: Level at which termination the function shall be called. You
|
||||
can pass 0 here to have the function run at the termination of the current
|
||||
mainloop.
|
||||
@function: The function to call. This should return 0 to be removed from the
|
||||
list of quit handlers. Otherwise the function might be called again.
|
||||
@marshal: The marshaller to be used. If this is non-NULL, %function is
|
||||
ignored.
|
||||
@data: Pointer to pass when calling %function.
|
||||
@destroy: Function to call to destruct %data. Gets %data as argument.
|
||||
@Returns: A handle for this quit handler (you need this for gtk_quit_remove())
|
||||
or 0 if you passed a NULL pointer in %function.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_quit_remove ##### -->
|
||||
<para>
|
||||
|
||||
Remove a quit handler by it's identifier.
|
||||
</para>
|
||||
|
||||
@quit_handler_id:
|
||||
@quit_handler_id: Identifier for the handler returned when installing it.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_quit_remove_by_data ##### -->
|
||||
<para>
|
||||
|
||||
Remove a quit handler identified by it's %data field.
|
||||
</para>
|
||||
|
||||
@data:
|
||||
@data: The pointer passed as %data to gtk_quit_add() or gtk_quit_add_full().
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_timeout_add_full ##### -->
|
||||
<para>
|
||||
|
||||
Registers a function to be called periodically. The function will be called
|
||||
repeatedly after %interval milliseconds until it returns %FALSE at which
|
||||
point the timeout is destroyed and will not be called again.
|
||||
</para>
|
||||
|
||||
@interval:
|
||||
@function:
|
||||
@marshal:
|
||||
@data:
|
||||
@destroy:
|
||||
@Returns:
|
||||
@interval: The time between calls to the function, in milliseconds
|
||||
(1/1000ths of a second.)
|
||||
@function: The function to call periodically.
|
||||
@marshal: The marshaller to use instead of the function (if non-NULL).
|
||||
@data: The data to pass to the function.
|
||||
@destroy: Function to call when the timeout is destroyed or NULL.
|
||||
@Returns: A unique id for the event source.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_timeout_add ##### -->
|
||||
<para>
|
||||
|
||||
Registers a function to be called periodically. The function will be called
|
||||
repeatedly after %interval milliseconds until it returns %FALSE at which
|
||||
point the timeout is destroyed and will not be called again.
|
||||
</para>
|
||||
|
||||
@interval:
|
||||
@function:
|
||||
@data:
|
||||
@Returns:
|
||||
@interval: The time between calls to the function, in milliseconds
|
||||
(1/1000ths of a second.)
|
||||
@function: The function to call periodically.
|
||||
@data: The data to pass to the function.
|
||||
@Returns: A unique id for the event source.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_timeout_remove ##### -->
|
||||
<para>
|
||||
|
||||
Removes the given timeout destroying all information about it.
|
||||
</para>
|
||||
|
||||
@timeout_handler_id:
|
||||
@timeout_handler_id: The identifier returned when installing the timeout.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_idle_add ##### -->
|
||||
<para>
|
||||
|
||||
Causes the mainloop to call the given function whenever no events with
|
||||
higher priority are to be processed. The default priority is
|
||||
GTK_PRIORITY_DEFAULT, which is rather low.
|
||||
</para>
|
||||
|
||||
@function:
|
||||
@data:
|
||||
@Returns:
|
||||
@function: The function to call.
|
||||
@data: The information to pass to the function.
|
||||
@Returns: a unique handle for this registration.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_idle_add_priority ##### -->
|
||||
<para>
|
||||
|
||||
Like gtk_idle_add() this function allows you to have a function called
|
||||
when the event loop is idle. The difference is that you can give a
|
||||
priority different from GTK_PRIORITY_DEFAULT to the idle function.
|
||||
</para>
|
||||
|
||||
@priority:
|
||||
@function:
|
||||
@data:
|
||||
@Returns:
|
||||
@priority: The priority which should not be above G_PRIORITY_HIGH_IDLE.
|
||||
Note that you will interfere with GTK if you use a priority above
|
||||
GTK_PRIORITY_RESIZE.
|
||||
@function: The function to call.
|
||||
@data: Data to pass to that function.
|
||||
@Returns: A unique id for the event source.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_idle_add_full ##### -->
|
||||
@@ -398,18 +496,18 @@ but always returns %FALSE.
|
||||
|
||||
<!-- ##### FUNCTION gtk_idle_remove ##### -->
|
||||
<para>
|
||||
|
||||
Removes the idle function with the given id.
|
||||
</para>
|
||||
|
||||
@idle_handler_id:
|
||||
@idle_handler_id: Identifies the idle function to remove.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_idle_remove_by_data ##### -->
|
||||
<para>
|
||||
|
||||
Removes the idle function identified by the user data.
|
||||
</para>
|
||||
|
||||
@data:
|
||||
@data: remove the idle function which was registered with this user data.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_input_add_full ##### -->
|
||||
@@ -436,42 +534,58 @@ but always returns %FALSE.
|
||||
|
||||
<!-- ##### MACRO GTK_PRIORITY_REDRAW ##### -->
|
||||
<para>
|
||||
|
||||
Use this priority for redrawing related stuff. It is used internally by
|
||||
GTK+ to do pending redraws. This priority is lower than %GTK_PRIORITY_RESIZE
|
||||
to avoid redrawing a widget just before resizing (and therefore redrawing
|
||||
it again).
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GTK_PRIORITY_RESIZE ##### -->
|
||||
<para>
|
||||
|
||||
Use this priority for resizing related stuff. It is used internally by
|
||||
GTK+ to compute the sizes of widgets. This priority is higher than
|
||||
%GTK_PRIORITY_REDRAW to avoid resizing a widget which was just redrawn.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GTK_PRIORITY_HIGH ##### -->
|
||||
<para>
|
||||
|
||||
Use this for high priority timeouts. This priority is never used inside
|
||||
GTK+ so everything running at this priority will be running before anything
|
||||
inside the toolkit.
|
||||
<note><para>
|
||||
This macro is deprecated. You should use G_PRIORITY_HIGH instead.
|
||||
</para></note>
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GTK_PRIORITY_INTERNAL ##### -->
|
||||
<para>
|
||||
|
||||
This priority is for GTK+ internal stuff. Don't use it in your applications.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GTK_PRIORITY_DEFAULT ##### -->
|
||||
<para>
|
||||
|
||||
Default priority for idle functions.
|
||||
<note><para>
|
||||
This macro is deprecated. You should use G_PRIORITY_DEFAULT_IDLE instead.
|
||||
</para></note>
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GTK_PRIORITY_LOW ##### -->
|
||||
<para>
|
||||
|
||||
Priority for very unimportant background tasks.
|
||||
<note><para>
|
||||
This macro is deprecated. You should use G_PRIORITY_LOW instead.
|
||||
</para></note>
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
@@ -2,16 +2,35 @@
|
||||
GtkMenuItem
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
|
||||
the widget used for item in menus
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
|
||||
The #GtkMenuItem widget and the derived widgets are the only valid
|
||||
childs for menus. Their function is to correctly handle highlighting,
|
||||
alignment, events and submenus.
|
||||
</para>
|
||||
<para>
|
||||
As it derives from #GtkBin it can hold any valid child widget, altough
|
||||
only a few are really useful.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>#GtkBin</term>
|
||||
<listitem><para>for how to handle the child.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>#GtkItem</term>
|
||||
<listitem><para>is the abstract class for all sorts of items.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>#GtkMenuShell</term>
|
||||
<listitem><para>is always the parent of #GtkMenuItem.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
|
||||
<!-- ##### STRUCT GtkMenuItem ##### -->
|
||||
@@ -19,102 +38,113 @@ GtkMenuItem
|
||||
|
||||
</para>
|
||||
|
||||
@item: the parent class object
|
||||
@submenu: the submenu attached to this item; read only
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_item_new ##### -->
|
||||
<para>
|
||||
|
||||
Creates a new #GtkMenuItem.
|
||||
</para>
|
||||
|
||||
@Returns:
|
||||
@Returns: the newly created #GtkMenuItem
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_item_new_with_label ##### -->
|
||||
<para>
|
||||
|
||||
Creates a new #GtkMenuItem whose child is a simple #GtlLabel.
|
||||
</para>
|
||||
|
||||
@label:
|
||||
@Returns:
|
||||
@label: the text for the label
|
||||
@Returns: the newly created #GtkMenuItem
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_item_set_submenu ##### -->
|
||||
<para>
|
||||
|
||||
Sets the widget submenu, or changes it.
|
||||
</para>
|
||||
|
||||
@menu_item:
|
||||
@submenu:
|
||||
@menu_item: the menu item widget
|
||||
@submenu: the submenu
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_item_remove_submenu ##### -->
|
||||
<para>
|
||||
|
||||
Removes the widget's submenu.
|
||||
</para>
|
||||
|
||||
@menu_item:
|
||||
@menu_item: the menu item widget
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_item_set_placement ##### -->
|
||||
<para>
|
||||
|
||||
Specifies the placement of the submenu around the menu item. The placement
|
||||
is usually #GTK_LEFT_RIGHT for menu items in a popup menu and
|
||||
#GTK_TOP_BOTTOM in menu bars.
|
||||
</para>
|
||||
<para>
|
||||
This function is useless in usual applications.
|
||||
</para>
|
||||
|
||||
@menu_item:
|
||||
@placement:
|
||||
@menu_item: the menu item
|
||||
@placement: the submenu placement
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_item_configure ##### -->
|
||||
<para>
|
||||
|
||||
Sets whether the menu item should show a submenu indicator, which is a right
|
||||
arrow.
|
||||
</para>
|
||||
|
||||
@menu_item:
|
||||
@show_toggle_indicator:
|
||||
@show_submenu_indicator:
|
||||
@menu_item: the menu item
|
||||
@show_toggle_indicator: unused
|
||||
@show_submenu_indicator: whether to show the arrow or not
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_item_select ##### -->
|
||||
<para>
|
||||
|
||||
Emits the "select" signal on the given item. Behaves exactly like
|
||||
#gtk_item_select.
|
||||
</para>
|
||||
|
||||
@menu_item:
|
||||
@menu_item: the menu item
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_item_deselect ##### -->
|
||||
<para>
|
||||
|
||||
Emits the "deselect" signal on the given item. Behaves exactly like
|
||||
#gtk_item_deselect.
|
||||
</para>
|
||||
|
||||
@menu_item:
|
||||
@menu_item: the menu item
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_item_activate ##### -->
|
||||
<para>
|
||||
|
||||
Emits the "activate" signal on the given item
|
||||
</para>
|
||||
|
||||
@menu_item:
|
||||
@menu_item: the menu item
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_menu_item_right_justify ##### -->
|
||||
<para>
|
||||
|
||||
Sets the menu item to be right-justified. Only useful for menu bars.
|
||||
</para>
|
||||
|
||||
@menu_item:
|
||||
@menu_item: the menu item
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GtkMenuItem::activate ##### -->
|
||||
<para>
|
||||
|
||||
Emitted when the item is activated.
|
||||
</para>
|
||||
|
||||
@menuitem: the object which received the signal.
|
||||
|
||||
<!-- ##### SIGNAL GtkMenuItem::activate-item ##### -->
|
||||
<para>
|
||||
|
||||
Emitted when the item is activated, but also if the menu item has a
|
||||
submenu. For normal applications, the relevant signal is "activate".
|
||||
</para>
|
||||
|
||||
@menuitem: the object which received the signal.
|
||||
|
||||
@@ -172,7 +172,7 @@ ignored.
|
||||
|
||||
<!-- ##### MACRO gtk_notebook_current_page ##### -->
|
||||
<para>
|
||||
??? I don't see such a macro in gtknotebook.h (v1.2.3).
|
||||
Compatibility macro; in gtkcompat.h.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
@@ -2,58 +2,91 @@
|
||||
GtkRadioMenuItem
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
|
||||
A choice from multiple check menu items.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
|
||||
A radio menu item is a check menu item that belongs to a group. At each
|
||||
instant exactly one of the radio menu items from a group is selected.
|
||||
</para>
|
||||
<para>
|
||||
The correct way to create a group of radio menu items is aproximativly
|
||||
this:
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>How to create a group of radio menu items.</title>
|
||||
<programlisting>
|
||||
GList *group = NULL;
|
||||
GtkWidget *item;
|
||||
gint i;
|
||||
|
||||
for(i = 0; i < 5; i++)
|
||||
{
|
||||
item = gtk_radio_menu_item_new_with_label (group, "This is an example");
|
||||
group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
|
||||
if (i == 1)
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE);
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>#GtkMenuItem</term>
|
||||
<listitem><para>because a radio menu item is a menu item.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>#GtkCheckItem</term>
|
||||
<listitem><para>to know how to handle the check.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
|
||||
<!-- ##### STRUCT GtkRadioMenuItem ##### -->
|
||||
<para>
|
||||
|
||||
The structure contains only provate data that must be accessed through
|
||||
the interface functions.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_radio_menu_item_new ##### -->
|
||||
<para>
|
||||
|
||||
Creates a new #GtkRadioMenuItem.
|
||||
</para>
|
||||
|
||||
@group:
|
||||
@Returns:
|
||||
@group: the group to wich the radio menu item is to be attached
|
||||
@Returns: the newly created radio menu item
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_radio_menu_item_new_with_label ##### -->
|
||||
<para>
|
||||
|
||||
Creates a new #GtkRadioMenuItem whose child is a simple #GtlLabel.
|
||||
</para>
|
||||
|
||||
@group:
|
||||
@label:
|
||||
@Returns:
|
||||
@group: the group to wich the radio menu item is to be attached
|
||||
@label: the text for the label
|
||||
@Returns: the newly created radio menu item
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_radio_menu_item_group ##### -->
|
||||
<para>
|
||||
|
||||
Returns the group to which the radio menu item belongs, as a #GList of
|
||||
#GtkRadioMenuItem. The list belongs to GTK+ and should not be freed.
|
||||
</para>
|
||||
|
||||
@radio_menu_item:
|
||||
@Returns:
|
||||
@radio_menu_item: the radio menu item
|
||||
@Returns: its group
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_radio_menu_item_set_group ##### -->
|
||||
<para>
|
||||
|
||||
Sets the group of a radio menu item, or changes it.
|
||||
</para>
|
||||
|
||||
@radio_menu_item:
|
||||
@group:
|
||||
@radio_menu_item: the radio menu item
|
||||
@group: the new group
|
||||
|
||||
|
||||
|
||||
@@ -17,8 +17,16 @@ The length of time the user must keep the mouse over a widget before the tip is
|
||||
<para>
|
||||
To assign a tip to a particular #GtkWidget, gtk_tooltips_set_tip() is used.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
The default appearance of all tooltips in a program is determined by the current gtk theme that the user has selected. To change the tooltip appearance manually, use gtk_tooltips_set_colors(). Again, this is per group of tooltips.
|
||||
Tooltips can only be set on widgets which have their own X window.
|
||||
To check if a widget has its own window use 'GTK_WIDGET_NO_WINDOW (widget)'.
|
||||
To add a tooltip to a widget that doesn't have its own window, place the
|
||||
widget inside a #GtkEventBox and add a tooltip to that instead.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
The default appearance of all tooltips in a program is determined by the current gtk theme that the user has selected.
|
||||
</para>
|
||||
<para>
|
||||
Information about the tooltip (if any) associated with an arbitrary widget can be retrieved using gtk_tooltips_data_get().
|
||||
@@ -140,7 +148,8 @@ Adds a tooltip containing the message @tip_text to the specified #GtkWidget.
|
||||
|
||||
<!-- ##### FUNCTION gtk_tooltips_set_colors ##### -->
|
||||
<para>
|
||||
Changes the foreground and background colors of a #GtkTooltips.
|
||||
This function is unimplemented because tooltip colors are instead
|
||||
determined by the theme.
|
||||
</para>
|
||||
|
||||
@tooltips: a #GtkTooltip
|
||||
|
||||
@@ -68,13 +68,82 @@ GtkWindow
|
||||
|
||||
<!-- ##### FUNCTION gtk_window_set_policy ##### -->
|
||||
<para>
|
||||
|
||||
Changes how a toplevel window deals with its size request and user resize
|
||||
attempts. There are really only two reasonable ways to call this function:
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, FALSE)</literal>
|
||||
means that the window is user-resizable.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, TRUE)</literal>
|
||||
means that the window's size is program-controlled, and should simply match
|
||||
the current size request of the window's children.
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
The first policy is the default, that is, by default windows are designed to
|
||||
be resized by users.
|
||||
</para>
|
||||
|
||||
@window:
|
||||
@allow_shrink:
|
||||
@allow_grow:
|
||||
@auto_shrink:
|
||||
<para>
|
||||
The basic ugly truth of this function is that it should be simply:
|
||||
<programlisting>
|
||||
void gtk_window_set_user_resizeable(GtkWidget* window, gboolean setting);
|
||||
</programlisting>
|
||||
So, pretend it is like that, and only use the two policies mentioned above.
|
||||
GTK+ 1.4 may replace gtk_window_set_policy() with a nicer function like
|
||||
gtk_window_set_user_resizeable().
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If set to TRUE, the @allow_grow parameter allows the user to expand the window
|
||||
beyond the size request of its child widgets. If @allow_grow is TRUE, be sure to
|
||||
check that your child widgets work properly as the window is resized.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A toplevel window will always change size to ensure its child widgets receive
|
||||
their requested size. This means that if you add child widgets, the toplevel
|
||||
window will expand to contain them. However, normally the toplevel will not
|
||||
shrink to fit the size request of its children if it's too large; the
|
||||
@auto_shrink parameter causes the window to shrink when child widgets have too
|
||||
much space. @auto_shrink is normally used with the second of the two window
|
||||
policies mentioned above. That is, set @auto_shrink to TRUE if you want the
|
||||
window to have a fixed, always-optimal size determined by your program.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Note that @auto_shrink doesn't do anything if @allow_shrink and @allow_grow are
|
||||
both set to FALSE.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Neither of the two suggested window policies set the @allow_shrink paramter to
|
||||
TRUE. If @allow_shrink is TRUE, the user can shrink the window so that its
|
||||
children do not receive their full size request; this is basically a bad thing,
|
||||
because most widgets will look wrong if this happens. Furthermore GTK+ has a
|
||||
tendency to re-expand the window if size is recalculated for any reason. The
|
||||
upshot is that @allow_shrink should always be set to FALSE.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Sometimes when you think you want to use @allow_shrink, the real problem is that
|
||||
some specific child widget is requesting too much space, so the user can't
|
||||
shrink the window sufficiently. Perhaps you are calling gtk_widget_set_usize()
|
||||
on a child widget, and forcing its size request to be too large. Instead of
|
||||
setting the child's usize, consider using gtk_window_set_default_size() so that
|
||||
the child gets a larger allocation than it requests.
|
||||
</para>
|
||||
|
||||
@window: the window
|
||||
@allow_shrink: whether the user can shrink the window below its size request
|
||||
@allow_grow: whether the user can grow the window larger than its size request
|
||||
@auto_shrink: whether the window automatically snaps back to its size request if
|
||||
it's larger
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_window_add_accel_group ##### -->
|
||||
|
||||
+2
-2
@@ -88,13 +88,13 @@ GtkWidget::style_set
|
||||
Flag indications:
|
||||
|
||||
!GTK_RC_STYLE && !GTK_USER_STYLE:
|
||||
The widget has it's default style set, no rc lookup has been
|
||||
The widget has its default style set, no rc lookup has been
|
||||
performed, the widget has not been size requested yet and is
|
||||
therefore not yet realized.
|
||||
|
||||
GTK_USER_STYLE:
|
||||
GTK_RC_STYLE is not set.
|
||||
The widget has a user style assigned, and it's default style has been
|
||||
The widget has a user style assigned, and its default style has been
|
||||
saved.
|
||||
|
||||
GTK_RC_STYLE:
|
||||
|
||||
@@ -398,7 +398,7 @@ according the the tab continuation of the previous line.
|
||||
Exposure and drawing:
|
||||
|
||||
Exposure is handled from the EXPOSE_TEXT function. It assumes that
|
||||
the LINE_START_CACHE and all it's parameters are accurate and simply
|
||||
the LINE_START_CACHE and all its parameters are accurate and simply
|
||||
exposes any line which is in the exposure region. It calls the
|
||||
CLEAR_AREA function to clear the background and/or lay down a pixmap
|
||||
background. The text widget has a scrollable pixmap background, which
|
||||
|
||||
+604
-12
@@ -11,7 +11,7 @@ Tony Gale <tt><htmlurl url="mailto:gale@gtk.org"
|
||||
name="<gale@gtk.org>"></tt>,
|
||||
Ian Main <tt><htmlurl url="mailto:imain@gtk.org"
|
||||
name="<imain@gtk.org>"></tt>
|
||||
<date>November 13th, 1999
|
||||
<date>February 23rd, 2000
|
||||
<abstract>
|
||||
This is a tutorial on how to use GTK (the GIMP Toolkit) through its C
|
||||
interface.
|
||||
@@ -33,7 +33,7 @@ open software, free software, or even commercial non-free software
|
||||
using GTK without having to spend anything for licenses or royalties.
|
||||
|
||||
It's called the GIMP toolkit because it was originally written for
|
||||
developing the General Image Manipulation Program (GIMP), but GTK has
|
||||
developing the GNU Image Manipulation Program (GIMP), but GTK has
|
||||
now been used in a large number of software projects, including the
|
||||
GNU Network Object Model Environment (GNOME) project. GTK is built on
|
||||
top of GDK (GIMP Drawing Kit) which is basically a wrapper around the
|
||||
@@ -839,15 +839,31 @@ So, by passing in the widget you wish to remove the handler from, and
|
||||
the tag returned by one of the signal_connect functions, you can
|
||||
disconnect a signal handler.
|
||||
|
||||
Another function to remove all the signal handers from an object is:
|
||||
You can also temporarily disable signal handlers with the
|
||||
gtk_signal_handler_block() and gtk_signal_handler_unblock() family of
|
||||
functions.
|
||||
|
||||
<tscreen><verb>
|
||||
void gtk_signal_handlers_destroy( GtkObject *object );
|
||||
</verb></tscreen>
|
||||
void gtk_signal_handler_block( GtkObject *object,
|
||||
guint handler_id );
|
||||
|
||||
This call is fairly self explanatory. It simply removes all the
|
||||
current signal handlers from the object passed in as the first
|
||||
argument.
|
||||
void gtk_signal_handler_block_by_func( GtkObject *object,
|
||||
GtkSignalFunc func,
|
||||
gpointer data );
|
||||
|
||||
void gtk_signal_handler_block_by_data( GtkObject *object,
|
||||
gpointer data );
|
||||
|
||||
void gtk_signal_handler_unblock( GtkObject *object,
|
||||
guint handler_id );
|
||||
|
||||
void gtk_signal_handler_unblock_by_func( GtkObject *object,
|
||||
GtkSignalFunc func,
|
||||
gpointer data );
|
||||
|
||||
void gtk_signal_handler_unblock_by_data( GtkObject *object,
|
||||
gpointer data);
|
||||
</verb></tscreen>
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1>An Upgraded Hello World
|
||||
@@ -4842,6 +4858,7 @@ The following code is an example of using an Entry widget.
|
||||
<tscreen><verb>
|
||||
/* example-start entry entry.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
void enter_callback( GtkWidget *widget,
|
||||
@@ -5170,6 +5187,7 @@ It's example time again.
|
||||
<tscreen><verb>
|
||||
/* example-start spinbutton spinbutton.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static GtkWidget *spinner1;
|
||||
@@ -5565,6 +5583,578 @@ gtk_combo_set_item_string(GtkCombo *combo, GtkItem *item, const gchar
|
||||
appropriate Item. Frankly, I have no idea how to do that.
|
||||
-->
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1> Calendar
|
||||
<p>
|
||||
The Calendar widget is an effective way to display and retrieve
|
||||
monthly date related information. It is a very simple widget to create
|
||||
and work with.
|
||||
|
||||
Creating a GtkCalendar widget is a simple as:
|
||||
|
||||
<tscreen><verb>
|
||||
GtkWidget *gtk_calendar_new();
|
||||
</verb></tscreen>
|
||||
|
||||
There might be times where you need to change a lot of information
|
||||
within this widget and the following functions allow you to make
|
||||
multiple change to a Calendar widget without the user seeing multiple
|
||||
on-screen updates.
|
||||
|
||||
<tscreen><verb>
|
||||
void gtk_calendar_freeze( GtkCalendar *Calendar );
|
||||
|
||||
void gtk_calendar_thaw ( GtkCalendar *Calendar );
|
||||
</verb></tscreen>
|
||||
|
||||
They work just like the freeze/thaw functions of every other
|
||||
widget.
|
||||
|
||||
The Calendar widget has a few options that allow you to change the way
|
||||
the widget both looks and operates by using the function
|
||||
|
||||
<tscreen><verb>
|
||||
void gtk_calendar_display_options( GtkCalendar *calendar,
|
||||
GtkCalendarDisplayOptions flags );
|
||||
</verb></tscreen>
|
||||
|
||||
The <tt/flags/ argument can be formed by combining either of the
|
||||
following five options using the logical bitwise OR (|) operation:
|
||||
<itemize>
|
||||
<item> GTK_CALENDAR_SHOW_HEADING - this option specifies that
|
||||
the month and year should be shown when drawing the calendar.
|
||||
<item> GTK_CALENDAR_SHOW_DAY_NAMES - this option specifies that the
|
||||
three letter descriptions should be displayed for each day (eg
|
||||
MON,TUE...).
|
||||
|
||||
<item> GTK_CALENDAR_NO_MONTH_CHANGE - this option states that the user
|
||||
should not and can not change the currently displayed month. This can
|
||||
be good if you only need to display a particular month such as if you
|
||||
are displaying 12 calendar widgets for every month in a particular
|
||||
year.
|
||||
|
||||
<item> GTK_CALENDAR_SHOW_WEEK_NUMBERS - this option specifies that the
|
||||
number for each week should be displayed down the left side of the
|
||||
calendar. (eg. Jan 1 = Week 1,Dec 31 = Week 52).
|
||||
|
||||
<item> GTK_CALENDAR_WEEK_START_MONDAY - this option states that the
|
||||
calander week will start on Monday instead of Sunday which is the
|
||||
default. This only affects the order in which days are displayed from
|
||||
left to right.
|
||||
</itemize>
|
||||
|
||||
The following functions are used to set the the currently displayed
|
||||
date:
|
||||
<tscreen><verb>
|
||||
gint gtk_calendar_select_month( GtkCalendar *calendar,
|
||||
guint month,
|
||||
guint year );
|
||||
|
||||
void gtk_calendar_select_day( GtkCalendar *calendar,
|
||||
guint day );
|
||||
</verb></tscreen>
|
||||
|
||||
The return value from <tt/gtk_calendar_select_month()/ is a boolean
|
||||
value indicating whether the selection was successful.
|
||||
|
||||
With <tt/gtk_calendar_select_day()/ the specified day number is
|
||||
selected within the current month, if that is possible. A
|
||||
<tt/day/ value of 0 will deselect any current selection.
|
||||
|
||||
In addition to having a day selected, any number of days in the month
|
||||
may be "marked". A marked day is highlighted within the calendar
|
||||
display. The following functions are provided to manipulate marked
|
||||
days:
|
||||
|
||||
<tscreen><verb>
|
||||
gint gtk_calendar_mark_day( GtkCalendar *calendar,
|
||||
guint day);
|
||||
|
||||
gint gtk_calendar_unmark_day( GtkCalendar *calendar,
|
||||
guint day);
|
||||
|
||||
void gtk_calendar_clear_marks( GtkCalendar *calendar);
|
||||
</verb></tscreen>
|
||||
|
||||
The currently marked days are stored within an array within the
|
||||
GtkCalendar structure. This array is 31 elements long so to test
|
||||
whether a particular day is currently marked, you need to access the
|
||||
corresponding element of the array (don't forget in C that array
|
||||
elements are numbered 0 to n-1). For example:
|
||||
|
||||
<tscreen><verb>
|
||||
GtkCalendar *calendar;
|
||||
calendar = gtk_calendar_new();
|
||||
|
||||
...
|
||||
|
||||
/* Is day 7 marked? */
|
||||
if (calendar->marked_date[7-1])
|
||||
/* day is marked */
|
||||
</verb></tscreen>
|
||||
|
||||
Note that marks are persistent across month and year changes.
|
||||
|
||||
The final Calendar widget function is used to retrieve the currently
|
||||
selected date, month and/or year.
|
||||
|
||||
<tscreen><verb>
|
||||
void gtk_calendar_get_date( GtkCalendar *calendar,
|
||||
guint *year,
|
||||
guint *month,
|
||||
guint *day );
|
||||
</verb></tscreen>
|
||||
|
||||
This function requires you to pass the addresses of <tt/guint/
|
||||
variables, into which the result will be placed. Passing <tt/NULL/ as
|
||||
a value will result in the corresponding value not being returned.
|
||||
|
||||
The Calendar widget can generate a number of signals indicating date
|
||||
selection and change. The names of these signals are self explanatory,
|
||||
and are:
|
||||
|
||||
<itemize>
|
||||
<item> <tt/month_changed/
|
||||
<item> <tt/day_selected/
|
||||
<item> <tt/day_selected_double_click/
|
||||
<item> <tt/prev_month/
|
||||
<item> <tt/next_month/
|
||||
<item> <tt/prev_year/
|
||||
<item> <tt/next_year/
|
||||
</itemize>
|
||||
|
||||
That just leaves us with the need to put all of this together into
|
||||
example code.
|
||||
|
||||
<tscreen><verb>
|
||||
/* example-start calendar calendar.c */
|
||||
/*
|
||||
* Copyright (C) 1998 Cesar Miquel, Shawn T. Amundson, Mattias Grönlund
|
||||
* Copyright (C) 2000 Tony Gale
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#define DEF_PAD 10
|
||||
#define DEF_PAD_SMALL 5
|
||||
|
||||
#define TM_YEAR_BASE 1900
|
||||
|
||||
typedef struct _CalendarData {
|
||||
GtkWidget *flag_checkboxes[5];
|
||||
gboolean settings[5];
|
||||
gchar *font;
|
||||
GtkWidget *font_dialog;
|
||||
GtkWidget *window;
|
||||
GtkWidget *prev2_sig;
|
||||
GtkWidget *prev_sig;
|
||||
GtkWidget *last_sig;
|
||||
GtkWidget *month;
|
||||
} CalendarData;
|
||||
|
||||
enum {
|
||||
calendar_show_header,
|
||||
calendar_show_days,
|
||||
calendar_month_change,
|
||||
calendar_show_week,
|
||||
calendar_monday_first
|
||||
};
|
||||
|
||||
/*
|
||||
* GtkCalendar
|
||||
*/
|
||||
|
||||
void calendar_date_to_string( CalendarData *data,
|
||||
char *buffer,
|
||||
gint buff_len )
|
||||
{
|
||||
struct tm tm;
|
||||
time_t time;
|
||||
|
||||
memset (&tm, 0, sizeof (tm));
|
||||
gtk_calendar_get_date (GTK_CALENDAR(data->window),
|
||||
&tm.tm_year, &tm.tm_mon, &tm.tm_mday);
|
||||
tm.tm_year -= TM_YEAR_BASE;
|
||||
time = mktime(&tm);
|
||||
strftime (buffer, buff_len-1, "%x", gmtime(&time));
|
||||
}
|
||||
|
||||
void calendar_set_signal_strings( char *sig_str,
|
||||
CalendarData *data)
|
||||
{
|
||||
gchar *prev_sig;
|
||||
|
||||
gtk_label_get (GTK_LABEL (data->prev_sig), &prev_sig);
|
||||
gtk_label_set (GTK_LABEL (data->prev2_sig), prev_sig);
|
||||
|
||||
gtk_label_get (GTK_LABEL (data->last_sig), &prev_sig);
|
||||
gtk_label_set (GTK_LABEL (data->prev_sig), prev_sig);
|
||||
gtk_label_set (GTK_LABEL (data->last_sig), sig_str);
|
||||
}
|
||||
|
||||
void calendar_month_changed( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "month_changed: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+15, 256-15);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_day_selected( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "day_selected: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+14, 256-14);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_day_selected_double_click( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
struct tm tm;
|
||||
char buffer[256] = "day_selected_double_click: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+27, 256-27);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
|
||||
memset (&tm, 0, sizeof (tm));
|
||||
gtk_calendar_get_date (GTK_CALENDAR(data->window),
|
||||
&tm.tm_year, &tm.tm_mon, &tm.tm_mday);
|
||||
tm.tm_year -= TM_YEAR_BASE;
|
||||
|
||||
if(GTK_CALENDAR(data->window)->marked_date[tm.tm_mday-1] == 0) {
|
||||
gtk_calendar_mark_day(GTK_CALENDAR(data->window),tm.tm_mday);
|
||||
} else {
|
||||
gtk_calendar_unmark_day(GTK_CALENDAR(data->window),tm.tm_mday);
|
||||
}
|
||||
}
|
||||
|
||||
void calendar_prev_month( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "prev_month: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+12, 256-12);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_next_month( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "next_month: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+12, 256-12);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_prev_year( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "prev_year: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+11, 256-11);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_next_year( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "next_year: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+11, 256-11);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
|
||||
void calendar_set_flags( CalendarData *calendar )
|
||||
{
|
||||
gint i;
|
||||
gint options=0;
|
||||
for (i=0;i<5;i++)
|
||||
if (calendar->settings[i])
|
||||
{
|
||||
options=options + (1<<i);
|
||||
}
|
||||
if (calendar->window)
|
||||
gtk_calendar_display_options (GTK_CALENDAR (calendar->window), options);
|
||||
}
|
||||
|
||||
void calendar_toggle_flag( GtkWidget *toggle,
|
||||
CalendarData *calendar )
|
||||
{
|
||||
gint i;
|
||||
gint j;
|
||||
j=0;
|
||||
for (i=0; i<5; i++)
|
||||
if (calendar->flag_checkboxes[i] == toggle)
|
||||
j = i;
|
||||
|
||||
calendar->settings[j]=!calendar->settings[j];
|
||||
calendar_set_flags(calendar);
|
||||
|
||||
}
|
||||
|
||||
void calendar_font_selection_ok( GtkWidget *button,
|
||||
CalendarData *calendar )
|
||||
{
|
||||
GtkStyle *style;
|
||||
GdkFont *font;
|
||||
|
||||
calendar->font = gtk_font_selection_dialog_get_font_name(
|
||||
GTK_FONT_SELECTION_DIALOG (calendar->font_dialog));
|
||||
if (calendar->window)
|
||||
{
|
||||
font = gtk_font_selection_dialog_get_font(GTK_FONT_SELECTION_DIALOG(calendar->font_dialog));
|
||||
if (font)
|
||||
{
|
||||
style = gtk_style_copy (gtk_widget_get_style (calendar->window));
|
||||
gdk_font_unref (style->font);
|
||||
style->font = font;
|
||||
gdk_font_ref (style->font);
|
||||
gtk_widget_set_style (calendar->window, style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void calendar_select_font( GtkWidget *button,
|
||||
CalendarData *calendar )
|
||||
{
|
||||
GtkWidget *window;
|
||||
|
||||
if (!calendar->font_dialog) {
|
||||
window = gtk_font_selection_dialog_new ("Font Selection Dialog");
|
||||
g_return_if_fail(GTK_IS_FONT_SELECTION_DIALOG(window));
|
||||
calendar->font_dialog = window;
|
||||
|
||||
gtk_window_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
|
||||
&calendar->font_dialog);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->ok_button),
|
||||
"clicked", GTK_SIGNAL_FUNC(calendar_font_selection_ok),
|
||||
calendar);
|
||||
gtk_signal_connect_object (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->cancel_button),
|
||||
"clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
GTK_OBJECT (calendar->font_dialog));
|
||||
}
|
||||
window=calendar->font_dialog;
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
}
|
||||
|
||||
void create_calendar()
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox, *vbox2, *vbox3;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *hbbox;
|
||||
GtkWidget *calendar;
|
||||
GtkWidget *toggle;
|
||||
GtkWidget *button;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *separator;
|
||||
GtkWidget *label;
|
||||
GtkWidget *bbox;
|
||||
static CalendarData calendar_data;
|
||||
gint i;
|
||||
|
||||
struct {
|
||||
char *label;
|
||||
} flags[] =
|
||||
{
|
||||
{ "Show Heading" },
|
||||
{ "Show Day Names" },
|
||||
{ "No Month Change" },
|
||||
{ "Show Week Numbers" },
|
||||
{ "Week Start Monday" }
|
||||
};
|
||||
|
||||
|
||||
calendar_data.window = NULL;
|
||||
calendar_data.font = NULL;
|
||||
calendar_data.font_dialog = NULL;
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
calendar_data.settings[i]=0;
|
||||
}
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(window), "GtkCalendar Example");
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 5);
|
||||
gtk_signal_connect(GTK_OBJECT(window), "destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_main_quit),
|
||||
NULL);
|
||||
gtk_signal_connect(GTK_OBJECT(window), "delete-event",
|
||||
GTK_SIGNAL_FUNC(gtk_false),
|
||||
NULL);
|
||||
|
||||
gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, TRUE);
|
||||
|
||||
vbox = gtk_vbox_new(FALSE, DEF_PAD);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
/*
|
||||
* The top part of the window, Calendar, flags and fontsel.
|
||||
*/
|
||||
|
||||
hbox = gtk_hbox_new(FALSE, DEF_PAD);
|
||||
gtk_box_pack_start (GTK_BOX(vbox), hbox, TRUE, TRUE, DEF_PAD);
|
||||
hbbox = gtk_hbutton_box_new();
|
||||
gtk_box_pack_start(GTK_BOX(hbox), hbbox, FALSE, FALSE, DEF_PAD);
|
||||
gtk_button_box_set_layout(GTK_BUTTON_BOX(hbbox), GTK_BUTTONBOX_SPREAD);
|
||||
gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbbox), 5);
|
||||
|
||||
/* Calendar widget */
|
||||
frame = gtk_frame_new("Calendar");
|
||||
gtk_box_pack_start(GTK_BOX(hbbox), frame, FALSE, TRUE, DEF_PAD);
|
||||
calendar=gtk_calendar_new();
|
||||
calendar_data.window = calendar;
|
||||
calendar_set_flags(&calendar_data);
|
||||
gtk_calendar_mark_day ( GTK_CALENDAR(calendar), 19);
|
||||
gtk_container_add( GTK_CONTAINER( frame), calendar);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "month_changed",
|
||||
GTK_SIGNAL_FUNC (calendar_month_changed),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "day_selected",
|
||||
GTK_SIGNAL_FUNC (calendar_day_selected),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "day_selected_double_click",
|
||||
GTK_SIGNAL_FUNC (calendar_day_selected_double_click),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "prev_month",
|
||||
GTK_SIGNAL_FUNC (calendar_prev_month),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "next_month",
|
||||
GTK_SIGNAL_FUNC (calendar_next_month),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "prev_year",
|
||||
GTK_SIGNAL_FUNC (calendar_prev_year),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "next_year",
|
||||
GTK_SIGNAL_FUNC (calendar_next_year),
|
||||
&calendar_data);
|
||||
|
||||
|
||||
separator = gtk_vseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), separator, FALSE, TRUE, 0);
|
||||
|
||||
vbox2 = gtk_vbox_new(FALSE, DEF_PAD);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, DEF_PAD);
|
||||
|
||||
/* Build the Right frame with the flags in */
|
||||
|
||||
frame = gtk_frame_new("Flags");
|
||||
gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, DEF_PAD);
|
||||
vbox3 = gtk_vbox_new(TRUE, DEF_PAD_SMALL);
|
||||
gtk_container_add(GTK_CONTAINER(frame), vbox3);
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
toggle = gtk_check_button_new_with_label(flags[i].label);
|
||||
gtk_signal_connect (GTK_OBJECT (toggle),
|
||||
"toggled",
|
||||
GTK_SIGNAL_FUNC(calendar_toggle_flag),
|
||||
&calendar_data);
|
||||
gtk_box_pack_start (GTK_BOX (vbox3), toggle, TRUE, TRUE, 0);
|
||||
calendar_data.flag_checkboxes[i]=toggle;
|
||||
}
|
||||
/* Build the right font-button */
|
||||
button = gtk_button_new_with_label("Font...");
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
GTK_SIGNAL_FUNC(calendar_select_font),
|
||||
&calendar_data);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
||||
|
||||
/*
|
||||
* Build the Signal-event part.
|
||||
*/
|
||||
|
||||
frame = gtk_frame_new("Signal events");
|
||||
gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, DEF_PAD);
|
||||
|
||||
vbox2 = gtk_vbox_new(TRUE, DEF_PAD_SMALL);
|
||||
gtk_container_add(GTK_CONTAINER(frame), vbox2);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
|
||||
label = gtk_label_new ("Signal:");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
calendar_data.last_sig = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.last_sig, FALSE, TRUE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
|
||||
label = gtk_label_new ("Previous signal:");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
calendar_data.prev_sig = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.prev_sig, FALSE, TRUE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
|
||||
label = gtk_label_new ("Second previous signal:");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
calendar_data.prev2_sig = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.prev2_sig, FALSE, TRUE, 0);
|
||||
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
|
||||
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
|
||||
|
||||
button = gtk_button_new_with_label ("Close");
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
|
||||
gtk_widget_show_all(window);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
gtk_set_locale ();
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
create_calendar();
|
||||
|
||||
gtk_main();
|
||||
|
||||
return(0);
|
||||
}
|
||||
/* example-end */
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1> Color Selection
|
||||
<p>
|
||||
@@ -6064,7 +6654,7 @@ the <ref id="sec_ProgressBar" name="Progress Bar"> widget.
|
||||
<sect1> Fixed Container
|
||||
<p>
|
||||
The Fixed container allows you to place widgets at a fixed position
|
||||
within it's window, relative to it's upper left hand corner. The
|
||||
within its window, relative to its upper left hand corner. The
|
||||
position of the widgets can be changed dynamically.
|
||||
|
||||
There are only three functions associated with the fixed widget:
|
||||
@@ -6505,6 +7095,7 @@ window.
|
||||
<tscreen><verb>
|
||||
/* example-start paned paned.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Create the list of "messages" */
|
||||
@@ -6751,6 +7342,7 @@ new to you.
|
||||
<tscreen><verb>
|
||||
/* example-start scrolledwin scrolledwin.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
void destroy( GtkWidget *widget,
|
||||
@@ -7630,6 +8222,7 @@ backward manner, and exit the program.
|
||||
<tscreen><verb>
|
||||
/* example-start notebook notebook.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* This function rotates the position of the tabs */
|
||||
@@ -9550,6 +10143,7 @@ That should about do it. Let's take a look at an example to help clarify.
|
||||
<tscreen><verb>
|
||||
/* example-start menu menu.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static gint button_press (GtkWidget *, GdkEvent *);
|
||||
@@ -10258,9 +10852,6 @@ When you do come to understand all the functions of a new undocumented
|
||||
widget, please consider writing a tutorial on it so others may benefit
|
||||
from your time.
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1> Calendar
|
||||
<p>
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
<sect1> CTree
|
||||
<p>
|
||||
@@ -16709,6 +17300,7 @@ gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||
<sect2> dial_test.c
|
||||
<p>
|
||||
<tscreen><verb>
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkdial.h"
|
||||
|
||||
|
||||
Executable
+17638
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
gcalendar: gcalendar.c
|
||||
$(CC) `gtk-config --cflags` gcalendar.c -o gcalendar `gtk-config --libs`
|
||||
calendar: calendar.c
|
||||
$(CC) `gtk-config --cflags` calendar.c -o calendar `gtk-config --libs`
|
||||
|
||||
clean:
|
||||
rm -f gcalendar
|
||||
rm -f calendar
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/* G Calendar
|
||||
/* example-start calendar calendar.c */
|
||||
/*
|
||||
* Copyright (C) 1998 Cesar Miquel, Shawn T. Amundson, Mattias Grönlund
|
||||
* Copyright (C) 2000 Tony Gale
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -26,84 +28,18 @@
|
||||
|
||||
#define TM_YEAR_BASE 1900
|
||||
|
||||
|
||||
typedef struct _CalendarData {
|
||||
GtkWidget *flag_checkboxes[5];
|
||||
gboolean settings[5];
|
||||
gchar *font;
|
||||
GtkWidget *font_dialog;
|
||||
GtkWidget *window;
|
||||
GtkWidget *selected;
|
||||
GtkWidget *selected_double_click;
|
||||
GtkWidget *prev2_sig;
|
||||
GtkWidget *prev_sig;
|
||||
GtkWidget *last_sig;
|
||||
GtkWidget *month;
|
||||
} CalendarData;
|
||||
|
||||
void create_calendar();
|
||||
gint delete_event(GtkWidget *widget, GdkEvent *event, gpointer data);
|
||||
void destroy (GtkWidget *widget, gpointer data);
|
||||
void day_selected_double_click (GtkWidget *widget, gpointer data);
|
||||
int main(int argc, char *argv[]);
|
||||
void calendar_month_changed (GtkWidget *widget, CalendarData *data);
|
||||
void calendar_day_selected (GtkWidget *widget, CalendarData *data);
|
||||
void calendar_day_selected_double_click (GtkWidget *widget, CalendarData *data);
|
||||
|
||||
|
||||
void calendar_set_flags(CalendarData *calendar);
|
||||
void calendar_toggle_flag(GtkWidget * toggle, CalendarData *calendar);
|
||||
void calendar_font_selection_ok(GtkWidget * button, CalendarData *calendar);
|
||||
void calendar_font_selection_destroy(GtkWidget * button, GtkWidget widget);
|
||||
void calendar_select_font(GtkWidget * button, CalendarData *calendar);
|
||||
void calendar_create_window_destroy(GtkWidget * ignore, CalendarData *calendar);
|
||||
void calendar_create_window(GtkWidget * ignored, CalendarData * calendar);
|
||||
void calendar_window_destroy(GtkWidget * ignore, CalendarData *calendar);
|
||||
void create_calendar();
|
||||
|
||||
/*
|
||||
* GtkCalendar
|
||||
*/
|
||||
|
||||
void
|
||||
calendar_month_changed (GtkWidget *widget, CalendarData *data)
|
||||
{
|
||||
char buffer[256];
|
||||
struct tm tm;
|
||||
time_t time;
|
||||
memset (&tm, 0, sizeof (tm));
|
||||
gtk_calendar_get_date (GTK_CALENDAR(data->window), &tm.tm_year, &tm.tm_mon, &tm.tm_mday);
|
||||
tm.tm_year -= TM_YEAR_BASE;
|
||||
time = mktime(&tm);
|
||||
strftime (buffer, 255, "%x", gmtime(&time));
|
||||
gtk_label_set (GTK_LABEL (data->month), buffer);
|
||||
}
|
||||
|
||||
void
|
||||
calendar_day_selected (GtkWidget *widget, CalendarData *data)
|
||||
{
|
||||
char buffer[256];
|
||||
struct tm tm;
|
||||
time_t time;
|
||||
memset (&tm, 0, sizeof (tm));
|
||||
gtk_calendar_get_date (GTK_CALENDAR(data->window), &tm.tm_year, &tm.tm_mon, &tm.tm_mday);
|
||||
tm.tm_year -= TM_YEAR_BASE;
|
||||
time = mktime(&tm);
|
||||
strftime (buffer, 255, "%x", gmtime(&time));
|
||||
gtk_label_set (GTK_LABEL (data->selected), buffer);
|
||||
}
|
||||
|
||||
void
|
||||
calendar_day_selected_double_click (GtkWidget *widget, CalendarData *data)
|
||||
{
|
||||
char buffer[256];
|
||||
struct tm tm;
|
||||
time_t time;
|
||||
memset (&tm, 0, sizeof (tm));
|
||||
gtk_calendar_get_date (GTK_CALENDAR(data->window), &tm.tm_year, &tm.tm_mon, &tm.tm_mday);
|
||||
tm.tm_year -= TM_YEAR_BASE;
|
||||
time = mktime(&tm);
|
||||
strftime (buffer, 255, "%x", gmtime(&time));
|
||||
gtk_label_set (GTK_LABEL (data->selected_double_click), buffer);
|
||||
}
|
||||
|
||||
enum {
|
||||
calendar_show_header,
|
||||
calendar_show_days,
|
||||
@@ -112,8 +48,115 @@ enum {
|
||||
calendar_monday_first
|
||||
};
|
||||
|
||||
void
|
||||
calendar_set_flags(CalendarData *calendar)
|
||||
/*
|
||||
* GtkCalendar
|
||||
*/
|
||||
|
||||
void calendar_date_to_string( CalendarData *data,
|
||||
char *buffer,
|
||||
gint buff_len )
|
||||
{
|
||||
struct tm tm;
|
||||
time_t time;
|
||||
|
||||
memset (&tm, 0, sizeof (tm));
|
||||
gtk_calendar_get_date (GTK_CALENDAR(data->window),
|
||||
&tm.tm_year, &tm.tm_mon, &tm.tm_mday);
|
||||
tm.tm_year -= TM_YEAR_BASE;
|
||||
time = mktime(&tm);
|
||||
strftime (buffer, buff_len-1, "%x", gmtime(&time));
|
||||
}
|
||||
|
||||
void calendar_set_signal_strings( char *sig_str,
|
||||
CalendarData *data)
|
||||
{
|
||||
gchar *prev_sig;
|
||||
|
||||
gtk_label_get (GTK_LABEL (data->prev_sig), &prev_sig);
|
||||
gtk_label_set (GTK_LABEL (data->prev2_sig), prev_sig);
|
||||
|
||||
gtk_label_get (GTK_LABEL (data->last_sig), &prev_sig);
|
||||
gtk_label_set (GTK_LABEL (data->prev_sig), prev_sig);
|
||||
gtk_label_set (GTK_LABEL (data->last_sig), sig_str);
|
||||
}
|
||||
|
||||
void calendar_month_changed( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "month_changed: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+15, 256-15);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_day_selected( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "day_selected: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+14, 256-14);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_day_selected_double_click( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
struct tm tm;
|
||||
char buffer[256] = "day_selected_double_click: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+27, 256-27);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
|
||||
memset (&tm, 0, sizeof (tm));
|
||||
gtk_calendar_get_date (GTK_CALENDAR(data->window),
|
||||
&tm.tm_year, &tm.tm_mon, &tm.tm_mday);
|
||||
tm.tm_year -= TM_YEAR_BASE;
|
||||
|
||||
if(GTK_CALENDAR(data->window)->marked_date[tm.tm_mday-1] == 0) {
|
||||
gtk_calendar_mark_day(GTK_CALENDAR(data->window),tm.tm_mday);
|
||||
} else {
|
||||
gtk_calendar_unmark_day(GTK_CALENDAR(data->window),tm.tm_mday);
|
||||
}
|
||||
}
|
||||
|
||||
void calendar_prev_month( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "prev_month: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+12, 256-12);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_next_month( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "next_month: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+12, 256-12);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_prev_year( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "prev_year: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+11, 256-11);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_next_year( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "next_year: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+11, 256-11);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
|
||||
void calendar_set_flags( CalendarData *calendar )
|
||||
{
|
||||
gint i;
|
||||
gint options=0;
|
||||
@@ -126,8 +169,8 @@ calendar_set_flags(CalendarData *calendar)
|
||||
gtk_calendar_display_options (GTK_CALENDAR (calendar->window), options);
|
||||
}
|
||||
|
||||
void
|
||||
calendar_toggle_flag(GtkWidget * toggle, CalendarData *calendar)
|
||||
void calendar_toggle_flag( GtkWidget *toggle,
|
||||
CalendarData *calendar )
|
||||
{
|
||||
gint i;
|
||||
gint j;
|
||||
@@ -140,13 +183,15 @@ calendar_toggle_flag(GtkWidget * toggle, CalendarData *calendar)
|
||||
calendar_set_flags(calendar);
|
||||
|
||||
}
|
||||
void
|
||||
calendar_font_selection_ok(GtkWidget * button, CalendarData *calendar)
|
||||
|
||||
void calendar_font_selection_ok( GtkWidget *button,
|
||||
CalendarData *calendar )
|
||||
{
|
||||
GtkStyle *style;
|
||||
GdkFont *font;
|
||||
|
||||
calendar->font = gtk_font_selection_dialog_get_font_name (GTK_FONT_SELECTION_DIALOG (calendar->font_dialog));
|
||||
calendar->font = gtk_font_selection_dialog_get_font_name(
|
||||
GTK_FONT_SELECTION_DIALOG (calendar->font_dialog));
|
||||
if (calendar->window)
|
||||
{
|
||||
font = gtk_font_selection_dialog_get_font(GTK_FONT_SELECTION_DIALOG(calendar->font_dialog));
|
||||
@@ -161,8 +206,8 @@ calendar_font_selection_ok(GtkWidget * button, CalendarData *calendar)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
calendar_select_font(GtkWidget * button, CalendarData *calendar)
|
||||
void calendar_select_font( GtkWidget *button,
|
||||
CalendarData *calendar )
|
||||
{
|
||||
GtkWidget *window;
|
||||
|
||||
@@ -193,8 +238,7 @@ calendar_select_font(GtkWidget * button, CalendarData *calendar)
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
create_calendar()
|
||||
void create_calendar()
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox, *vbox2, *vbox3;
|
||||
@@ -231,6 +275,7 @@ create_calendar()
|
||||
}
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(window), "GtkCalendar Example");
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 5);
|
||||
gtk_signal_connect(GTK_OBJECT(window), "destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_main_quit),
|
||||
@@ -257,7 +302,7 @@ create_calendar()
|
||||
|
||||
/* Calendar widget */
|
||||
frame = gtk_frame_new("Calendar");
|
||||
gtk_box_pack_start(GTK_BOX(hbbox), frame, TRUE, TRUE, DEF_PAD);
|
||||
gtk_box_pack_start(GTK_BOX(hbbox), frame, FALSE, TRUE, DEF_PAD);
|
||||
calendar=gtk_calendar_new();
|
||||
calendar_data.window = calendar;
|
||||
calendar_set_flags(&calendar_data);
|
||||
@@ -272,6 +317,18 @@ create_calendar()
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "day_selected_double_click",
|
||||
GTK_SIGNAL_FUNC (calendar_day_selected_double_click),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "prev_month",
|
||||
GTK_SIGNAL_FUNC (calendar_prev_month),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "next_month",
|
||||
GTK_SIGNAL_FUNC (calendar_next_month),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "prev_year",
|
||||
GTK_SIGNAL_FUNC (calendar_prev_year),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "next_year",
|
||||
GTK_SIGNAL_FUNC (calendar_next_year),
|
||||
&calendar_data);
|
||||
|
||||
|
||||
separator = gtk_vseparator_new ();
|
||||
@@ -311,30 +368,31 @@ create_calendar()
|
||||
|
||||
frame = gtk_frame_new("Signal events");
|
||||
gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, DEF_PAD);
|
||||
|
||||
vbox2 = gtk_vbox_new(TRUE, DEF_PAD_SMALL);
|
||||
gtk_container_add(GTK_CONTAINER(frame), vbox2);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
hbox = gtk_hbox_new (FALSE, 3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
|
||||
label = gtk_label_new ("Day selected:");
|
||||
label = gtk_label_new ("Signal:");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
calendar_data.selected = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.selected, FALSE, TRUE, 0);
|
||||
calendar_data.last_sig = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.last_sig, FALSE, TRUE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
hbox = gtk_hbox_new (FALSE, 3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
|
||||
label = gtk_label_new ("Day selected double click:");
|
||||
label = gtk_label_new ("Previous signal:");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
calendar_data.selected_double_click = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.selected_double_click, FALSE, TRUE, 0);
|
||||
calendar_data.prev_sig = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.prev_sig, FALSE, TRUE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
hbox = gtk_hbox_new (FALSE, 3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
|
||||
label = gtk_label_new ("Month change:");
|
||||
label = gtk_label_new ("Second previous signal:");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
calendar_data.month = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.month, FALSE, TRUE, 0);
|
||||
|
||||
calendar_data.prev2_sig = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.prev2_sig, FALSE, TRUE, 0);
|
||||
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
|
||||
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
|
||||
@@ -351,12 +409,16 @@ create_calendar()
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
int main(int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
gtk_set_locale ();
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
create_calendar();
|
||||
gtk_main ();
|
||||
return 0;
|
||||
|
||||
gtk_main();
|
||||
|
||||
return(0);
|
||||
}
|
||||
/* example-end */
|
||||
@@ -5,7 +5,9 @@ Makefile
|
||||
.libs
|
||||
*.la
|
||||
*.lo
|
||||
test-gdk-pixbuf
|
||||
testpixbuf
|
||||
testpixbuf-drawable
|
||||
testpixbuf-scale
|
||||
testanimation
|
||||
gdk-pixbuf-features.h
|
||||
|
||||
@@ -1,3 +1,450 @@
|
||||
2000-05-22 Federico Mena Quintero <federico@helixcode.com>
|
||||
|
||||
* configure.in: Bumped version number to 0.8.0.
|
||||
|
||||
* doc/Makefile.am (content_files): The toplevel gdk-pixbuf.sgml
|
||||
file was not being distributed.
|
||||
|
||||
* gdk-pixbuf/pixops/Makefile.am (EXTRA_DIST): Added DETAILS.
|
||||
|
||||
2000-05-09 Darin Adler <darin@eazel.com>
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-drawable.c: (rgb565lsb), (rgb565msb),
|
||||
(rgb565alsb), (rgb565amsb), (rgb555lsb), (rgb555msb), (rgb555alsb),
|
||||
(rgb555amsb), (convert_real_slow): Change all conversion from 16-bit
|
||||
formats to 32-bit formats to re-use the high bits of the color values
|
||||
so that white maps to full white.
|
||||
|
||||
Fri May 5 12:16:32 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk-pixbuf/pixops/DETAILS: Add beginnings of file with
|
||||
detailed information about the structure and algorithms
|
||||
of pixops so people can fix it instead of breaking it.
|
||||
|
||||
2000-05-04 Darin Adler <darin@eazel.com>
|
||||
|
||||
* gdk-pixbuf/pixops/pixops.c: (pixops_composite_nearest),
|
||||
(composite_pixel), (composite_line):
|
||||
* gdk-pixbuf/test-gdk-pixbuf.c: (simple_composite_test_one_type):
|
||||
Now that Owen explained the algorithm, I think I implemented it
|
||||
right for the cases where the destination pixbuf is not opaque.
|
||||
The test does seem to confirm it.
|
||||
|
||||
2000-05-04 Darin Adler <darin@eazel.com>
|
||||
|
||||
* gdk-pixbuf/.cvsignore:
|
||||
* gdk-pixbuf/Makefile.am:
|
||||
* gdk-pixbuf/test-gdk-pixbuf.c (store_pixel), (fill_with_pixel),
|
||||
(load_pixel), (simple_composite_test_one),
|
||||
(simple_composite_test_one_type), (simple_composite_test), (main):
|
||||
Added some tests of composite to highlight problems in the old
|
||||
implementation. These tests run without any user interaction.
|
||||
Just do "make check".
|
||||
|
||||
* gdk-pixbuf/pixops/pixops.c (pixops_composite_nearest),
|
||||
(composite_pixel), (composite_line): Fix composite to do a textbook
|
||||
"A over B" composite. This was clearly the intent, and it was easy
|
||||
to fix the code to do it. (Note to those that read my earlier tries
|
||||
at a patch; this version fixes typos that were present in all
|
||||
my patch attempts. I checked the final version by adding more tests.)
|
||||
|
||||
2000-04-22 05:27:43 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk-pixbuf/pixops/pixops.c (pixops_scale_nearest): Properly
|
||||
offset y coordinate accordining to render_y0.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-scale.c: Properly handle nonzero
|
||||
dest_x, dest_y.
|
||||
|
||||
2000-04-22 James Henstridge <james@daa.com.au>
|
||||
|
||||
* gdk-pixbuf.spec.in (%files): moved %{prefix}/bin/* from the main
|
||||
package to the devel package. The only file installed in bin is
|
||||
gdk-pixbuf-config, which belongs in -devel. This should allow having
|
||||
multiple versions of the main gdk-pixbuf package installed.
|
||||
|
||||
2000-04-17 Karl Eichwalder <ke@suse.de>
|
||||
|
||||
* gdk-pixbuf/Makefile.am (INCLUDES): Add $(GNOME_CFLAGS).
|
||||
Reported by Jens Finke.
|
||||
|
||||
2000-04-14 Tomasz K³opczko <kloczek@pld.org.pl>
|
||||
|
||||
* gdk-pixbuf/pixops/makefile.am: $(LIBART_CFLAGS) replaced by
|
||||
$(GTK_CFLAGS) - now gdk-pixbuf compiles correctly.
|
||||
|
||||
2000-04-13 James Henstridge <james@daa.com.au>
|
||||
|
||||
* configure.in: when performing the configure check to see if
|
||||
gmodule works, set CFLAGS to GLIB_CFLAGS and LIBS to GLIB_LIBS,
|
||||
rather than the other way round. Also, call AC_MSG_RESULT in the
|
||||
even that dynamic modules were not supported.
|
||||
|
||||
2000-04-12 Federico Mena Quintero <federico@helixcode.com>
|
||||
|
||||
This comes from an excellent idea by Tim Janik (timj@gtk.org) to
|
||||
hook to the last unref operation.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_set_last_unref_handler): New
|
||||
function to set the last unref handler for a pixbuf.
|
||||
(gdk_pixbuf_finalize): New function to actually finalize a pixbuf.
|
||||
It calls the pixbuf's destroy notification function and frees the
|
||||
GdkPixbuf structure itself.
|
||||
(gdk_pixbuf_unref): Use the last unref function of the pixbuf if
|
||||
available.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-private.h (struct _GdkPixbuf): New fields
|
||||
for the last unref handler and its user data.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Use
|
||||
g_new0() to allocate the pixbuf.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init):
|
||||
Fixed the call to gtk_signal_new() for the "frame_done" signal; it
|
||||
was not specifying the `frame' argument.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-animation.c
|
||||
(gdk_pixbuf_animation_get_width): Fixed docstring.
|
||||
(gdk_pixbuf_animation_get_height): Likewise.
|
||||
(gdk_pixbuf_animation_get_num_frames): Likewise.
|
||||
(gdk_pixbuf_animation_get_frames): Likewise.
|
||||
|
||||
* doc/gdk-pixbuf-sections.txt: Updated with the new functions and
|
||||
types.
|
||||
|
||||
* doc/tmpl/gdk-pixbuf.sgml: Added the description for GdkColorspace.
|
||||
|
||||
* doc/tmpl/scaling.sgml: Added the description for GdkInterpType.
|
||||
|
||||
* doc/tmpl/refcounting.sgml: Updated with the information about
|
||||
the last unref handler.
|
||||
|
||||
* doc/tmpl/*.sgml: Markup tweaks.
|
||||
|
||||
* gdk-pixbuf/Makefile.am (libgnomecanvaspixbuf_la_LDFLAGS): Sigh,
|
||||
update the libtool version number for libgnomecanvaspixbuf as
|
||||
well.
|
||||
(libpixbufloader_*_la_LDFLAGS): The loaders need to be versioned
|
||||
as well, or the old ones won't work with the new stuff. Also,
|
||||
renamed the modules as follows.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_load_module): Now the
|
||||
modules are called "libpixbufloader-<format>.so" instead of
|
||||
"libpixbuf-<format>.so". They needed renaming so that the new
|
||||
loaders won't overwrite the old ones; even with the versioning
|
||||
stuff, the new .so symlink to the .so.1.0.0 would overwrite the
|
||||
old real .so file.
|
||||
|
||||
2000-04-12 Paolo Molaro <lupus@debian.org>
|
||||
|
||||
* .cvsignore, src/.cvsignore: shut up cvs.
|
||||
|
||||
2000-04-11 Federico Mena Quintero <federico@helixcode.com>
|
||||
|
||||
Most of this patch is based on a patch by Havoc Pennington
|
||||
(hp@redhat.com) to make GdkPixbuf's structures opaque and to
|
||||
remove the libart dependency.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf.h: Removed the public structures.
|
||||
(GdkColorspace): New enum that for now only contains
|
||||
GDK_COLORSPACE_RGB.
|
||||
(GdkPixbufDestroyNotify): New type for the pixbuf's pixels destroy
|
||||
notification function.
|
||||
(GdkInterpType): New num with interpolation types.
|
||||
|
||||
* *.[ch]: Replace the libart stuff with our own stuff.
|
||||
|
||||
* pixops/*.[ch]: Likewise.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-private.h: New file with the private
|
||||
declarations of the GdkPixbuf structures.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_new_from_art_pixbuf):
|
||||
Removed function.
|
||||
(gdk_pixbuf_get_format): Constify.
|
||||
(gdk_pixbuf_get_n_channels): Constify.
|
||||
(gdk_pixbuf_get_has_alpha): Constify.
|
||||
(gdk_pixbuf_get_bits_per_sample): Constify.
|
||||
(gdk_pixbuf_get_pixels): Constify.
|
||||
(gdk_pixbuf_get_width): Constify.
|
||||
(gdk_pixbuf_get_height): Constify.
|
||||
(gdk_pixbuf_get_rowstride): Constify.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_copy): New function to copy
|
||||
a pixbuf.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Added a
|
||||
bits_per_sample argument; currently only 8 bits per sample are
|
||||
supported.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_pixbuf):
|
||||
New accessor.
|
||||
(gdk_pixbuf_frame_get_x_offset): New accessor.
|
||||
(gdk_pixbuf_frame_get_y_offset): New accessor.
|
||||
(gdk_pixbuf_frame_get_delay_time): New accessor.
|
||||
(gdk_pixbuf_frame_get_action): New accessor.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-render.c
|
||||
(gdk_pixbuf_render_pixmap_and_mask): Instead of returning a solid
|
||||
mask rectangle for pixbufs without an alpha channel, set the
|
||||
*mask_return to NULL.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-util.c (gdk_pixbuf_add_alpha): Constify.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-scale.c: Fix includes.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-scale.c (gdk_pixbuf_scale): Added some
|
||||
preconditions. Maybe we should also check for the colorspace,
|
||||
bits per pixel, and such.
|
||||
(gdk_pixbuf_composite): Likewise.
|
||||
(gdk_pixbuf_composite_color): Likewise.
|
||||
(gdk_pixbuf_scale_simple): Likewise, and fail gracefully if we
|
||||
cannot allocate the new pixbuf.
|
||||
(gdk_pixbuf_composite_color_simple): Likewise.
|
||||
|
||||
* gdk-pixbuf/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_render):
|
||||
Use art_rgb_rgba_affine() or art_rgb_affine() since we no longer
|
||||
have an ArtPixBuf.
|
||||
|
||||
* gdk-pixbuf/io-bmp.c: Fix includes.
|
||||
|
||||
* gdk-pixbuf/pixops/pixops.c (pixops_scale_nearest): Fixed cast in
|
||||
an lvalue.
|
||||
|
||||
* TODO: Populated.
|
||||
|
||||
* configure.in: Removed checks for libart.
|
||||
|
||||
* gdk-pixbuf/Makefile.am: Removed references to libart.
|
||||
(noinst_HEADERS): Added gdk-pixbuf-private.h.
|
||||
|
||||
* gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_LDFLAGS): Incremented
|
||||
the version number of the libtool library to indicate that this
|
||||
definitely is not compatible with the old usage. I know you love
|
||||
me. I know you do.
|
||||
|
||||
* configure.in: Bumped version number to 0.7.0.
|
||||
|
||||
* README: Updated.
|
||||
|
||||
* gdk-pixbuf-config.in (--libs): We no longer require libart.
|
||||
|
||||
* DEPENDS.libgdk_pixbuf: We no longer depend on libart.
|
||||
|
||||
* gdk-pixbuf.spec.in: Updated, but I don't guarantee anything.
|
||||
|
||||
2000-04-06 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gdk-pixbuf/testanimation.c (main): add more info to the
|
||||
testanimation frames.
|
||||
|
||||
2000-04-04 Ettore Perazzoli <ettore@helixcode.com>
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-animation.c
|
||||
(gdk_pixbuf_animation_get_width): New accessor function.
|
||||
(gdk_pixbuf_animation_get_height): New accessor function.
|
||||
(gdk_pixbuf_animation_get_num_frames): New accessor function.
|
||||
(gdk_pixbuf_animation_get_frames): New accessor function.
|
||||
|
||||
2000-04-01 Federico Mena Quintero <federico@helixcode.com>
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf.c: Reverted Mark's change. The refcount
|
||||
is private information, and the art_pixbuf will go away soon.
|
||||
|
||||
2000-03-31 Mark Crichton <crichton@gimp.org>
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf.c: Added gdk_pixbuf_get_refcount
|
||||
and gdk_pixbuf_get_artpixbuf accessor functions.
|
||||
|
||||
2000-03-29 Federico Mena Quintero <federico@helixcode.com>
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_get_has_alpha): Return
|
||||
gboolean instead of int.
|
||||
|
||||
2000-03-29 Radek Doulik <rodo@helixcode.com>
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-animation.c
|
||||
(gdk_pixbuf_animation_new_from_file): same as below
|
||||
|
||||
* gdk-pixbuf/io-gif.c (gif_get_lzw): added update of width and
|
||||
height in GdkPixbufAnimation
|
||||
|
||||
2000-03-28 Radek Doulik <rodo@helixcode.com>
|
||||
|
||||
* gdk-pixbuf/io-gif.c (gif_get_lzw): test also for
|
||||
context->frame_done_func and context->anim_done_func to make
|
||||
progressive animation loading work
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done):
|
||||
added priv->pixbuf = NULL as pixbuf is now in frame (and to make
|
||||
gdk_pixbuf_loader_prepare happy)
|
||||
(gdk_pixbuf_loader_frame_done): update animation bbox
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf.h: added bbox size (width, height) to
|
||||
_GdkPixbufAnimation
|
||||
|
||||
2000-03-27 Radek Doulik <rodo@helixcode.com>
|
||||
|
||||
* gdk-pixbuf/io-gif.c (gif_get_lzw): use frame_len and frame_width
|
||||
instead of width and height
|
||||
|
||||
2000-03-27 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk-pixbuf/pixops/pixops.c: Fix problem with
|
||||
precendence of >> and & which was keeping composite_color
|
||||
from working with non-gray images.
|
||||
|
||||
2000-03-08 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gdk-pixbuf/io-gif.c (gdk_pixbuf__gif_image_load): free the context.
|
||||
(gdk_pixbuf__gif_image_load_animation): free the context.
|
||||
|
||||
2000-03-06 Arjan van de Ven <arjan@fenrus.demon.nl>
|
||||
|
||||
* gdk-pixbuf/io-bmp.c: Fixed to pointer-bugs and a
|
||||
mis-interpretation of the Microsoft documentation. Now
|
||||
it can load .BMP files that are not generated by The Gimp
|
||||
as well.
|
||||
|
||||
2000-03-01 Mark Crichton <crichton@gimp.org>
|
||||
|
||||
* configure.in: Added BUILD_CANVAS_ITEM stuff to (finally)
|
||||
fix the last auto* build bug (where we have libart, but no
|
||||
gnome-libs)
|
||||
|
||||
* gdk-pixbuf/Makefile.am: Same.
|
||||
|
||||
2000-02-28 Matt Wilson <msw@redhat.com>
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-drawable.c: s/unsigned long/guint32/g,
|
||||
s/unsigned short/guint16/g, s/unsigned char/guint8/g
|
||||
|
||||
2000-02-26 Federico Mena Quintero <federico@helixcode.com>
|
||||
|
||||
* README: We don't require libgif/ungif nor libXpm.
|
||||
|
||||
* NEWS: This was outdated, so updated it.
|
||||
|
||||
2000-02-25 Federico Mena Quintero <federico@helixcode.com>
|
||||
|
||||
* gdk-pixbuf.m4: Use the correct name for
|
||||
gdk-pixbuf/gdk-pixbuf.h. Thanks to Jacob Berkman for pointing
|
||||
this out.
|
||||
|
||||
2000-02-21 Federico Mena Quintero <federico@helixcode.com>
|
||||
|
||||
* configure.in (GDK_PIXBUF_MINOR): Bumped version number to 0.6.0.
|
||||
|
||||
* doc/compiling.sgml: New appendix documenting the gdk-pixbuf
|
||||
library's particular options to configure.in.
|
||||
|
||||
* doc/gdk-pixbuf.sgml: Include compiling.sgml appendix via an
|
||||
entity.
|
||||
|
||||
* doc/Makefile.am (gdk-pixbuf.html): Added compiling.sgml.
|
||||
|
||||
* gdk-pixbuf/io-ico.c (gdk_pixbuf__ico_image_load_increment):
|
||||
Fixed typo in prototype name.
|
||||
|
||||
* configure.in: Changed duplicated AC_MSG_CHECKING message to
|
||||
something more meaningful; now it is "checking whether dynamic
|
||||
modules work".
|
||||
|
||||
* gdk-pixbuf/pixops/Makefile.am (noinst_PROGRAMS): Do not install
|
||||
the timescale program.
|
||||
|
||||
Integrated Miguel de Icaza's <miguel@gnu.org> patch for optionally
|
||||
creating a single static library with all the image format modules
|
||||
in it.
|
||||
|
||||
2000-02-20 Miguel de Icaza <miguel@gnu.org>
|
||||
|
||||
* gdk-pixbuf/io-xpm.c (gdk_pixbuf__xpm_image_load): Add prefix.
|
||||
(gdk_pixbuf__xpm_image_load_xpm_data): Add prefix.
|
||||
|
||||
* gdk-pixbuf/io-tiff.c (gdk_pixbuf__tiff_image_load_real): Add prefix.
|
||||
(gdk_pixbuf__tiff_image_stop_load): Add prefix.
|
||||
(gdk_pixbuf__tiff_image_load_increment): Add prefix.
|
||||
(gdk_pixbuf__tiff_image_load): Add prefix.
|
||||
(gdk_pixbuf__tiff_image_stop_load): Update invocation.
|
||||
(gdk_pixbuf__tiff_image_begin_load): Add prefix.
|
||||
|
||||
* gdk-pixbuf/io-ras.c (gdk_pixbuf__ras_image_load): Add prefix.
|
||||
(gdk_pixbuf__ras_image_load): Updated invocation.
|
||||
(gdk_pixbuf__ras_image_begin_load): Add prefix.
|
||||
(gdk_pixbuf__ras_image_stop_load): Add prefix.
|
||||
(gdk_pixbuf__ras_image_load_increment): Add prefix.
|
||||
|
||||
* gdk-pixbuf/io-pnm.c (gdk_pixbuf__pnm_image_begin_load): Add prefix.
|
||||
(gdk_pixbuf__pnm_image_stop_load): Add prefix.
|
||||
(gdk_pixbuf__pnm_image_load_increment): Add prefix
|
||||
(gdk_pixbuf__pnm_image_load): Add prefix.
|
||||
|
||||
* gdk-pixbuf/io-jpeg.c (gdk_pixbuf__jpeg_image_load): Add prefix.
|
||||
(gdk_pixbuf__jpeg_image_load_increment): Add prefix.
|
||||
(gdk_pixbuf__jpeg_image_begin_load): Add prefix.
|
||||
(gdk_pixbuf__jpeg_image_stop_load): Add prefix.
|
||||
|
||||
* gdk-pixbuf/io-ico.c (gdk_pixbuf__ico_image_load): Add prefix.
|
||||
(gdk_pixbuf__ico_image_load): update invocation.
|
||||
(gdk_pixbuf__ico_image_load_increment): Add prefix.
|
||||
(gdk_pixbuf__ico_image_load): update invocation.
|
||||
(gdk_pixbuf__ico_image_begin_load): Add prefix.
|
||||
(gdk_pixbuf__ico_image_load): update invocation.
|
||||
(gdk_pixbuf__ico_image_stop_load): Add prefix.
|
||||
|
||||
* gdk-pixbuf/io-gif.c (gdk_pixbuf__gif_image_load_animation): Add prefix.
|
||||
(gdk_pixbuf__gif_image_load): Add prefix.
|
||||
(gdk_pixbuf__gif_image_begin_load): Add prefix.
|
||||
(gdk_pixbuf__gif_image_load_increment): Add prefix.
|
||||
(gdk_pixbuf__gif_image_load_animation): Add prefix.
|
||||
(gdk_pixbuf__gif_image_stop_load): Add prefix.
|
||||
|
||||
* gdk-pixbuf/io-bmp.c (gdk_pixbuf__bmp_image_load): Add prefix.
|
||||
(gdk_pixbuf__bmp_image_load): Rename function called.
|
||||
(gdk_pixbuf__bmp_image_load_increment): Add prefix
|
||||
|
||||
* gdk-pixbuf/io-png.c (gdk_pixbuf__png_image_load): Add prefix.
|
||||
(gdk_pixbuf__png_image_begin_load): Add prefix.
|
||||
(gdk_pixbuf__png_image_stop_load): Add prefix.
|
||||
(gdk_pixbuf__png_image_load_increment): Add prefix.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-io.c (file_formats): Make this static.
|
||||
(gdk_pixbuf_load_module): Load the shared library entry points
|
||||
using a "gdk_pixbuf__$module_name" prefix.
|
||||
(pixbuf_module_symbol): Wrapper routine that uses the module
|
||||
prefix for the modules to load the information.
|
||||
|
||||
* configure.in (GDK_PIXBUF_VERSION): New option --disable-modules
|
||||
lets the user specify that gdk-pixbuf should link all image loader
|
||||
code into the library instaed of creating shared library modules.
|
||||
|
||||
(dynworks): Renamed the automake conditional DYNAMIC_MODULES_WORK
|
||||
to BUILD_DYNAMIC_MODULES.
|
||||
|
||||
2000-02-19 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gdk-pixbuf/io-gif.c (new_context): fix case where initial
|
||||
colormap entry is Transparent.
|
||||
|
||||
2000-02-19 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk-pixbuf/pixops/pixops.c (scale_pixel): Fix error in
|
||||
scale factors for non-alpha case.
|
||||
|
||||
2000-02-14 Mark Crichton <crichton@gimp.org>
|
||||
|
||||
* gdk-pixbuf/io-xpm.c (xpm_extract_color): Added check for "g" color type.
|
||||
Imlib/libXpm handle this, but we didn't.
|
||||
|
||||
2000-02-14 Darin Adler <darin@eazel.com>
|
||||
|
||||
* gdk-pixbuf/testpixbuf.c: Remove now-unnecessary cast.
|
||||
* .cvsignore: gdk-pixbuf/.cvsignore: More to ignore.
|
||||
|
||||
2000-02-14 Elliot Lee <sopwith@redhat.com>
|
||||
* gdk-pixbuf/gdk-pixbuf.h, gdk-pixbuf/gdk-pixbuf-data.c: Make passed-in argument 'const'.
|
||||
|
||||
2000-02-04 Michael Meeks <mmeeks@gnu.org>
|
||||
|
||||
* gdk-pixbuf/io-gif.c (struct _GifContext): add x,y_offset.
|
||||
|
||||
+118
-92
@@ -1,49 +1,114 @@
|
||||
SUBDIRS = pixops
|
||||
|
||||
if INSIDE_GNOME_LIBS
|
||||
if BUILD_CANVAS_ITEM
|
||||
CANVAS_PIXBUF_LIB = libgnomecanvaspixbuf.la
|
||||
CANVAS_PIXBUF_HEADERFILES=gnome-canvas-pixbuf.h
|
||||
libgnomecanvaspixbuf_la_SOURCES = gnome-canvas-pixbuf.c
|
||||
EXTRA_GNOME_LIBS = $(GNOME_LIBS)
|
||||
else
|
||||
CANVAS_PIXBUF_LIB =
|
||||
CANVAS_PIXBUF_HEADERFILES =
|
||||
EXTRA_GNOME_LIBS =
|
||||
else
|
||||
CANVAS_PIXBUF_LIB = libgnomecanvaspixbuf.la
|
||||
CANVAS_PIXBUF_HEADERFILES=gnome-canvas-pixbuf.h
|
||||
EXTRA_GNOME_LIBS = $(GNOME_LIBS)
|
||||
endif
|
||||
|
||||
lib_LTLIBRARIES = \
|
||||
libgdk_pixbuf.la \
|
||||
$(CANVAS_PIXBUF_LIB)
|
||||
|
||||
libgnomecanvaspixbuf_la_SOURCES = gnome-canvas-pixbuf.c
|
||||
libgnomecanvaspixbuf_la_LDFLAGS = $(EXTRA_GNOME_LIBS)
|
||||
libgnomecanvaspixbuf_la_LDFLAGS = -version-info 1:0:0 $(EXTRA_GNOME_LIBS)
|
||||
|
||||
libexecdir = $(libdir)/gdk-pixbuf/loaders
|
||||
|
||||
#
|
||||
# The PNG plugin.
|
||||
#
|
||||
libpixbufloader_png_la_SOURCES = io-png.c
|
||||
libpixbufloader_png_la_LDFLAGS = -version-info 1:0:0 -module
|
||||
libpixbufloader_png_la_LIBADD = $(LIBPNG)
|
||||
|
||||
#
|
||||
# The JPEG loader
|
||||
#
|
||||
libpixbufloader_jpeg_la_SOURCES = io-jpeg.c
|
||||
libpixbufloader_jpeg_la_LDFLAGS = -version-info 1:0:0 -module
|
||||
libpixbufloader_jpeg_la_LIBADD = $(LIBJPEG)
|
||||
|
||||
#
|
||||
# The XPM loader
|
||||
#
|
||||
libpixbufloader_xpm_la_SOURCES = io-xpm.c
|
||||
libpixbufloader_xpm_la_LDFLAGS = -version-info 1:0:0 -module
|
||||
libpixbufloader_xpm_la_LIBADD =
|
||||
|
||||
#
|
||||
# The GIF loader
|
||||
#
|
||||
libpixbufloader_gif_la_SOURCES = io-gif.c
|
||||
libpixbufloader_gif_la_LDFLAGS = -version-info 1:0:0 -module
|
||||
libpixbufloader_gif_la_LIBADD =
|
||||
|
||||
#
|
||||
# The ICO loader
|
||||
#
|
||||
libpixbufloader_ico_la_SOURCES = io-ico.c
|
||||
libpixbufloader_ico_la_LDFLAGS = -version-info 1:0:0 -module
|
||||
libpixbufloader_ico_la_LIBADD =
|
||||
|
||||
#
|
||||
# The RAS loader
|
||||
#
|
||||
libpixbufloader_ras_la_SOURCES = io-ras.c
|
||||
libpixbufloader_ras_la_LDFLAGS = -version-info 1:0:0 -module
|
||||
libpixbufloader_ras_la_LIBADD =
|
||||
|
||||
#
|
||||
# The TIFF loader
|
||||
#
|
||||
libpixbufloader_tiff_la_SOURCES = io-tiff.c
|
||||
libpixbufloader_tiff_la_LDFLAGS = -version-info 1:0:0 -module
|
||||
libpixbufloader_tiff_la_LIBADD = $(LIBTIFF)
|
||||
|
||||
#
|
||||
# The PNM loader
|
||||
#
|
||||
libpixbufloader_pnm_la_SOURCES = io-pnm.c
|
||||
libpixbufloader_pnm_la_LDFLAGS = -version-info 1:0:0 -module
|
||||
libpixbufloader_pnm_la_LIBADD =
|
||||
|
||||
#
|
||||
# The BMP loader
|
||||
#
|
||||
libpixbufloader_bmp_la_SOURCES = io-bmp.c
|
||||
libpixbufloader_bmp_la_LDFLAGS = -version-info 1:0:0 -module
|
||||
libpixbufloader_bmp_la_LIBADD =
|
||||
|
||||
if HAVE_PNG
|
||||
PNG_LIB = libpixbuf-png.la
|
||||
PNG_LIB = libpixbufloader-png.la
|
||||
endif
|
||||
|
||||
if HAVE_JPEG
|
||||
JPEG_LIB = libpixbuf-jpeg.la
|
||||
JPEG_LIB = libpixbufloader-jpeg.la
|
||||
endif
|
||||
|
||||
GIF_LIB = libpixbuf-gif.la
|
||||
GIF_LIB = libpixbufloader-gif.la
|
||||
|
||||
ICO_LIB = libpixbuf-ico.la
|
||||
ICO_LIB = libpixbufloader-ico.la
|
||||
|
||||
RAS_LIB = libpixbuf-ras.la
|
||||
RAS_LIB = libpixbufloader-ras.la
|
||||
|
||||
if HAVE_TIFF
|
||||
TIFF_LIB = libpixbuf-tiff.la
|
||||
TIFF_LIB = libpixbufloader-tiff.la
|
||||
endif
|
||||
|
||||
XPM_LIB = libpixbuf-xpm.la
|
||||
XPM_LIB = libpixbufloader-xpm.la
|
||||
|
||||
PNM_LIB = libpixbuf-pnm.la
|
||||
PNM_LIB = libpixbufloader-pnm.la
|
||||
|
||||
BMP_LIB = libpixbuf-bmp.la
|
||||
BMP_LIB = libpixbufloader-bmp.la
|
||||
|
||||
libexec_LTLIBRARIES = \
|
||||
if BUILD_DYNAMIC_MODULES
|
||||
|
||||
libexec_LTLIBRARIES = \
|
||||
$(PNG_LIB) \
|
||||
$(JPEG_LIB) \
|
||||
$(GIF_LIB) \
|
||||
@@ -54,31 +119,53 @@ libexec_LTLIBRARIES = \
|
||||
$(PNM_LIB) \
|
||||
$(BMP_LIB)
|
||||
|
||||
noinst_PROGRAMS = testpixbuf testpixbuf-drawable testanimation testpixbuf-scale
|
||||
|
||||
extra_sources =
|
||||
|
||||
else
|
||||
libexec_LTLIBRARIES =
|
||||
|
||||
extra_sources = $(libpixbufloader_png_la_SOURCES) \
|
||||
$(libpixbufloader_jpeg_la_SOURCES) \
|
||||
$(libpixbufloader_xpm_la_SOURCES) \
|
||||
$(libpixbufloader_gif_la_SOURCES) \
|
||||
$(libpixbufloader_ico_la_SOURCES) \
|
||||
$(libpixbufloader_ras_la_SOURCES) \
|
||||
$(libpixbufloader_tiff_la_SOURCES) \
|
||||
$(libpixbufloader_pnm_la_SOURCES) \
|
||||
$(libpixbufloader_bmp_la_SOURCES)
|
||||
|
||||
builtin_libraries =
|
||||
endif
|
||||
|
||||
noinst_PROGRAMS = test-gdk-pixbuf testpixbuf testpixbuf-drawable testanimation testpixbuf-scale
|
||||
TESTS = test-gdk-pixbuf
|
||||
|
||||
DEPS = libgdk_pixbuf.la
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_builddir) \
|
||||
-I$(top_srcdir)/gdk-pixbuf \
|
||||
-I$(top_builddir)/gdk-pixbuf \
|
||||
$(GLIB_CFLAGS) $(LIBART_CFLAGS) $(GTK_CFLAGS)
|
||||
$(GLIB_CFLAGS) $(GTK_CFLAGS) $(GNOME_CFLAGS)
|
||||
AM_CPPFLAGS = "-DPIXBUF_LIBDIR=\"$(libexecdir)\""
|
||||
|
||||
LDADDS = libgdk_pixbuf.la $(LIBART_LIBS) $(GLIB_LIBS) $(GTK_LIBS)
|
||||
LDADDS = libgdk_pixbuf.la $(GLIB_LIBS) $(GTK_LIBS) $(STATIC_LIB_DEPS)
|
||||
|
||||
if INSIDE_GNOME_LIBS
|
||||
testpixbuf_LDADD = $(LDADDS) $(LIBART_LIBS) -lgmodule
|
||||
test_gdk_pixbuf_LDADD = $(LDADDS) -lgmodule
|
||||
testpixbuf_LDADD = $(LDADDS) -lgmodule
|
||||
testpixbuf_drawable_LDADD = $(LDADDS)
|
||||
testpixbuf_scale_LDADD = $(LDADDS)
|
||||
testanimation_LDADD = $(LDADDS) $(LIBART_LIBS) -lgmodule
|
||||
testanimation_LDADD = $(LDADDS) -lgmodule
|
||||
else
|
||||
testpixbuf_LDADD = $(LDADDS) $(LIBART_LIBS) $(GNOME_LIBS) -lgmodule
|
||||
test_gdk_pixbuf_LDADD = $(LDADDS) $(GNOME_LIBS) -lgmodule
|
||||
testpixbuf_LDADD = $(LDADDS) $(GNOME_LIBS) -lgmodule
|
||||
testpixbuf_drawable_LDADD = $(LDADDS) $(GNOME_LIBS)
|
||||
testpixbuf_scale_LDADD = $(LDADDS) $(GNOME_LIBS)
|
||||
testanimation_LDADD = $(LDADDS) $(LIBART_LIBS) $(GNOME_LIBS) -lgmodule
|
||||
testanimation_LDADD = $(LDADDS) $(GNOME_LIBS) -lgmodule
|
||||
endif
|
||||
|
||||
|
||||
GDK_PIXBUF_LIBS = $(LIBART_LIBS) $(GLIB_LIBS) $(GTK_LIBS)
|
||||
GDK_PIXBUF_LIBS = $(GLIB_LIBS) $(GTK_LIBS)
|
||||
|
||||
#
|
||||
# The GdkPixBuf library
|
||||
@@ -95,9 +182,10 @@ libgdk_pixbuf_la_SOURCES = \
|
||||
gdk-pixbuf-loader.c \
|
||||
gdk-pixbuf-render.c \
|
||||
gdk-pixbuf-scale.c \
|
||||
gdk-pixbuf-util.c
|
||||
gdk-pixbuf-util.c \
|
||||
$(extra_sources)
|
||||
|
||||
libgdk_pixbuf_la_LDFLAGS = -version-info 1:0:0 $(LIBART_LIBS) $(GLIB_LIBS) $(GTK_LIBS)
|
||||
libgdk_pixbuf_la_LDFLAGS = -version-info 2:0:0 $(GLIB_LIBS) $(GTK_LIBS)
|
||||
libgdk_pixbuf_la_LIBADD = pixops/libpixops.la
|
||||
|
||||
libgdk_pixbufinclude_HEADERS = \
|
||||
@@ -106,68 +194,6 @@ libgdk_pixbufinclude_HEADERS = \
|
||||
gdk-pixbuf-features.h \
|
||||
$(CANVAS_PIXBUF_HEADERFILES)
|
||||
|
||||
noinst_HEADERS = \
|
||||
gdk-pixbuf-io.h
|
||||
|
||||
#
|
||||
# The PNG plugin.
|
||||
#
|
||||
libpixbuf_png_la_SOURCES = io-png.c
|
||||
libpixbuf_png_la_LDFLAGS = -avoid-version -module
|
||||
libpixbuf_png_la_LIBADD = $(LIBPNG)
|
||||
|
||||
#
|
||||
# The JPEG loader
|
||||
#
|
||||
libpixbuf_jpeg_la_SOURCES = io-jpeg.c
|
||||
libpixbuf_jpeg_la_LDFLAGS = -avoid-version -module
|
||||
libpixbuf_jpeg_la_LIBADD = $(LIBJPEG)
|
||||
|
||||
#
|
||||
# The XPM loader
|
||||
#
|
||||
libpixbuf_xpm_la_SOURCES = io-xpm.c
|
||||
libpixbuf_xpm_la_LDFLAGS = -avoid-version -module
|
||||
libpixbuf_xpm_la_LIBADD =
|
||||
|
||||
#
|
||||
# The GIF loader
|
||||
#
|
||||
libpixbuf_gif_la_SOURCES = io-gif.c
|
||||
libpixbuf_gif_la_LDFLAGS = -avoid-version -module
|
||||
libpixbuf_gif_la_LIBADD =
|
||||
|
||||
#
|
||||
# The ICO loader
|
||||
#
|
||||
libpixbuf_ico_la_SOURCES = io-ico.c
|
||||
libpixbuf_ico_la_LDFLAGS = -avoid-version -module
|
||||
libpixbuf_ico_la_LIBADD =
|
||||
|
||||
#
|
||||
# The RAS loader
|
||||
#
|
||||
libpixbuf_ras_la_SOURCES = io-ras.c
|
||||
libpixbuf_ras_la_LDFLAGS = -avoid-version -module
|
||||
libpixbuf_ras_la_LIBADD =
|
||||
|
||||
#
|
||||
# The TIFF loader
|
||||
#
|
||||
libpixbuf_tiff_la_SOURCES = io-tiff.c
|
||||
libpixbuf_tiff_la_LDFLAGS = -avoid-version -module
|
||||
libpixbuf_tiff_la_LIBADD = $(LIBTIFF)
|
||||
|
||||
#
|
||||
# The PNM loader
|
||||
#
|
||||
libpixbuf_pnm_la_SOURCES = io-pnm.c
|
||||
libpixbuf_pnm_la_LDFLAGS = -avoid-version -module
|
||||
libpixbuf_pnm_la_LIBADD =
|
||||
|
||||
#
|
||||
# The BMP loader
|
||||
#
|
||||
libpixbuf_bmp_la_SOURCES = io-bmp.c
|
||||
libpixbuf_bmp_la_LDFLAGS = -avoid-version -module
|
||||
libpixbuf_bmp_la_LIBADD =
|
||||
noinst_HEADERS = \
|
||||
gdk-pixbuf-io.h \
|
||||
gdk-pixbuf-private.h
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "gdk-pixbuf-io.h"
|
||||
#include "gdk-pixbuf-private.h"
|
||||
|
||||
|
||||
|
||||
@@ -102,6 +103,8 @@ gdk_pixbuf_animation_new_from_file (const char *filename)
|
||||
animation->ref_count = 1;
|
||||
animation->n_frames = 1;
|
||||
animation->frames = g_list_prepend (NULL, frame);
|
||||
animation->width = gdk_pixbuf_get_width (pixbuf);
|
||||
animation->height = gdk_pixbuf_get_height (pixbuf);
|
||||
} else {
|
||||
fseek (f, 0, SEEK_SET);
|
||||
animation = (* image_module->load_animation) (f);
|
||||
@@ -160,3 +163,150 @@ gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation)
|
||||
g_free (animation);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_animation_get_width:
|
||||
* @animation: An animation.
|
||||
*
|
||||
* Queries the width of the bounding box of a pixbuf animation.
|
||||
*
|
||||
* Return value: Width of the bounding box of the animation.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_animation_get_width (GdkPixbufAnimation *animation)
|
||||
{
|
||||
g_return_val_if_fail (animation != NULL, -1);
|
||||
|
||||
return animation->width;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_animation_get_height:
|
||||
* @animation: An animation.
|
||||
*
|
||||
* Queries the height of the bounding box of a pixbuf animation.
|
||||
*
|
||||
* Return value: Height of the bounding box of the animation.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_animation_get_height (GdkPixbufAnimation *animation)
|
||||
{
|
||||
g_return_val_if_fail (animation != NULL, -1);
|
||||
|
||||
return animation->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_animation_get_num_frames:
|
||||
* @animation: An animation.
|
||||
*
|
||||
* Queries the number of frames in a pixbuf animation.
|
||||
*
|
||||
* Return value: Number of frames in the animation.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_animation_get_num_frames (GdkPixbufAnimation *animation)
|
||||
{
|
||||
g_return_val_if_fail (animation != NULL, -1);
|
||||
|
||||
return animation->n_frames;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_animation_get_frames:
|
||||
* @animation: An animation.
|
||||
*
|
||||
* Queries the list of frames of an animation.
|
||||
*
|
||||
* Return value: List of frames in the animation; this is a #GList of
|
||||
* #GdkPixbufFrame structures.
|
||||
**/
|
||||
GList *
|
||||
gdk_pixbuf_animation_get_frames (GdkPixbufAnimation *animation)
|
||||
{
|
||||
g_return_val_if_fail (animation != NULL, NULL);
|
||||
|
||||
return animation->frames;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_frame_get_pixbuf:
|
||||
* @frame: A pixbuf animation frame.
|
||||
*
|
||||
* Queries the pixbuf of an animation frame.
|
||||
*
|
||||
* Return value: A pixbuf.
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_frame_get_pixbuf (GdkPixbufFrame *frame)
|
||||
{
|
||||
g_return_val_if_fail (frame != NULL, NULL);
|
||||
|
||||
return frame->pixbuf;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_frame_get_x_offset:
|
||||
* @frame: A pixbuf animation frame.
|
||||
*
|
||||
* Queries the X offset of an animation frame.
|
||||
*
|
||||
* Return value: X offset from the top left corner of the animation.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_frame_get_x_offset (GdkPixbufFrame *frame)
|
||||
{
|
||||
g_return_val_if_fail (frame != NULL, -1);
|
||||
|
||||
return frame->x_offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_frame_get_y_offset:
|
||||
* @frame: A pixbuf animation frame.
|
||||
*
|
||||
* Queries the Y offset of an animation frame.
|
||||
*
|
||||
* Return value: Y offset from the top left corner of the animation.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_frame_get_y_offset (GdkPixbufFrame *frame)
|
||||
{
|
||||
g_return_val_if_fail (frame != NULL, -1);
|
||||
|
||||
return frame->y_offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_frame_get_delay_time:
|
||||
* @frame: A pixbuf animation frame.
|
||||
*
|
||||
* Queries the delay time in milliseconds of an animation frame.
|
||||
*
|
||||
* Return value: Delay time in milliseconds.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_frame_get_delay_time (GdkPixbufFrame *frame)
|
||||
{
|
||||
g_return_val_if_fail (frame != NULL, -1);
|
||||
|
||||
return frame->delay_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_frame_get_action:
|
||||
* @frame: A pixbuf animation frame.
|
||||
*
|
||||
* Queries the overlay action of an animation frame.
|
||||
*
|
||||
* Return value: Overlay action for this frame.
|
||||
**/
|
||||
GdkPixbufFrameAction
|
||||
gdk_pixbuf_frame_get_action (GdkPixbufFrame *frame)
|
||||
{
|
||||
g_return_val_if_fail (frame != NULL, GDK_PIXBUF_FRAME_RETAIN);
|
||||
|
||||
return frame->action;
|
||||
}
|
||||
|
||||
@@ -22,48 +22,56 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-private.h"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_new_from_data:
|
||||
* @data: Image data in 8-bit/sample packed format.
|
||||
* @format: Color format used for the data.
|
||||
* @colorspace: Colorspace for the image data.
|
||||
* @has_alpha: Whether the data has an opacity channel.
|
||||
* @bits_per_sample: Number of bits per sample.
|
||||
* @width: Width of the image in pixels.
|
||||
* @height: Height of the image in pixels.
|
||||
* @rowstride: Distance in bytes between rows.
|
||||
* @dfunc: Function used to free the data when the pixbuf's reference count
|
||||
* @destroy_fn: Function used to free the data when the pixbuf's reference count
|
||||
* drops to zero, or NULL if the data should not be freed.
|
||||
* @dfunc_data: Closure data to pass to the destroy notification function.
|
||||
* @destroy_fn_data: Closure data to pass to the destroy notification function.
|
||||
*
|
||||
* Creates a new #GdkPixbuf out of in-memory RGB data.
|
||||
* Creates a new #GdkPixbuf out of in-memory image data. Currently only RGB
|
||||
* images with 8 bits per sample are supported.
|
||||
*
|
||||
* Return value: A newly-created #GdkPixbuf structure with a reference count of
|
||||
* 1.
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_new_from_data (guchar *data, ArtPixFormat format, gboolean has_alpha,
|
||||
int width, int height, int rowstride,
|
||||
ArtDestroyNotify dfunc, gpointer dfunc_data)
|
||||
gdk_pixbuf_new_from_data (const guchar *data, GdkColorspace colorspace, gboolean has_alpha,
|
||||
int bits_per_sample, int width, int height, int rowstride,
|
||||
GdkPixbufDestroyNotify destroy_fn, gpointer destroy_fn_data)
|
||||
{
|
||||
ArtPixBuf *art_pixbuf;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
/* Only 8-bit/sample RGB buffers are supported for now */
|
||||
|
||||
g_return_val_if_fail (data != NULL, NULL);
|
||||
g_return_val_if_fail (format == ART_PIX_RGB, NULL);
|
||||
g_return_val_if_fail (colorspace == GDK_COLORSPACE_RGB, NULL);
|
||||
g_return_val_if_fail (bits_per_sample == 8, NULL);
|
||||
g_return_val_if_fail (width > 0, NULL);
|
||||
g_return_val_if_fail (height > 0, NULL);
|
||||
|
||||
if (has_alpha)
|
||||
art_pixbuf = art_pixbuf_new_rgba_dnotify (data, width, height, rowstride,
|
||||
dfunc_data, dfunc);
|
||||
else
|
||||
art_pixbuf = art_pixbuf_new_rgb_dnotify (data, width, height, rowstride,
|
||||
dfunc_data, dfunc);
|
||||
pixbuf = g_new0 (GdkPixbuf, 1);
|
||||
pixbuf->ref_count = 1;
|
||||
pixbuf->colorspace = colorspace;
|
||||
pixbuf->n_channels = has_alpha ? 4 : 3;
|
||||
pixbuf->bits_per_sample = bits_per_sample;
|
||||
pixbuf->has_alpha = has_alpha ? TRUE : FALSE;
|
||||
pixbuf->width = width;
|
||||
pixbuf->height = height;
|
||||
pixbuf->rowstride = rowstride;
|
||||
pixbuf->pixels = (guchar *) data;
|
||||
pixbuf->destroy_fn = destroy_fn;
|
||||
pixbuf->destroy_fn_data = destroy_fn_data;
|
||||
|
||||
g_assert (art_pixbuf != NULL);
|
||||
|
||||
return gdk_pixbuf_new_from_art_pixbuf (art_pixbuf);
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
+151
-10
@@ -24,6 +24,7 @@
|
||||
#include <config.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include "gdk-pixbuf-private.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
|
||||
@@ -166,8 +167,7 @@ pixbuf_check_bmp (guchar *buffer, int size)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
GdkPixbufModule file_formats [] = {
|
||||
static GdkPixbufModule file_formats [] = {
|
||||
{ "png", pixbuf_check_png, NULL, NULL, NULL, NULL, NULL, NULL },
|
||||
{ "jpeg", pixbuf_check_jpeg, NULL, NULL, NULL, NULL, NULL, NULL },
|
||||
{ "tiff", pixbuf_check_tiff, NULL, NULL, NULL, NULL, NULL, NULL },
|
||||
@@ -181,6 +181,18 @@ GdkPixbufModule file_formats [] = {
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
#ifdef USE_GMODULE
|
||||
static gboolean
|
||||
pixbuf_module_symbol (GModule *module, const char *module_name, const char *symbol_name, gpointer *symbol)
|
||||
{
|
||||
char *full_symbol_name = g_strconcat ("gdk_pixbuf__", module_name, "_", symbol_name, NULL);
|
||||
gboolean return_value;
|
||||
|
||||
return_value = g_module_symbol (module, full_symbol_name, symbol);
|
||||
g_free (full_symbol_name);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/* actually load the image handler - gdk_pixbuf_get_module only get a */
|
||||
/* reference to the module to load, it doesn't actually load it */
|
||||
@@ -192,10 +204,13 @@ gdk_pixbuf_load_module (GdkPixbufModule *image_module)
|
||||
char *path;
|
||||
GModule *module;
|
||||
gpointer load_sym;
|
||||
|
||||
char *name;
|
||||
|
||||
g_return_if_fail (image_module->module == NULL);
|
||||
|
||||
module_name = g_strconcat ("pixbuf-", image_module->module_name, NULL);
|
||||
name = image_module->module_name;
|
||||
|
||||
module_name = g_strconcat ("pixbufloader-", name, NULL);
|
||||
path = g_module_build_path (PIXBUF_LIBDIR, module_name);
|
||||
|
||||
module = g_module_open (path, G_MODULE_BIND_LAZY);
|
||||
@@ -220,24 +235,150 @@ gdk_pixbuf_load_module (GdkPixbufModule *image_module)
|
||||
|
||||
image_module->module = module;
|
||||
|
||||
if (g_module_symbol (module, "image_load", &load_sym))
|
||||
if (pixbuf_module_symbol (module, name, "image_load", &load_sym))
|
||||
image_module->load = load_sym;
|
||||
|
||||
if (g_module_symbol (module, "image_load_xpm_data", &load_sym))
|
||||
if (pixbuf_module_symbol (module, name, "image_load_xpm_data", &load_sym))
|
||||
image_module->load_xpm_data = load_sym;
|
||||
|
||||
if (g_module_symbol (module, "image_begin_load", &load_sym))
|
||||
if (pixbuf_module_symbol (module, name, "image_begin_load", &load_sym))
|
||||
image_module->begin_load = load_sym;
|
||||
|
||||
if (g_module_symbol (module, "image_stop_load", &load_sym))
|
||||
if (pixbuf_module_symbol (module, name, "image_stop_load", &load_sym))
|
||||
image_module->stop_load = load_sym;
|
||||
|
||||
if (g_module_symbol (module, "image_load_increment", &load_sym))
|
||||
if (pixbuf_module_symbol (module, name, "image_load_increment", &load_sym))
|
||||
image_module->load_increment = load_sym;
|
||||
|
||||
if (g_module_symbol (module, "image_load_animation", &load_sym))
|
||||
if (pixbuf_module_symbol (module, name, "image_load_animation", &load_sym))
|
||||
image_module->load_animation = load_sym;
|
||||
}
|
||||
#else
|
||||
|
||||
#define mname(type,fn) gdk_pixbuf__ ## type ## _image_ ##fn
|
||||
#define m_load(type) extern GdkPixbuf * mname(type,load) (FILE *f);
|
||||
#define m_load_xpm_data(type) extern GdkPixbuf * mname(type,load_xpm_data) (const char **data);
|
||||
#define m_begin_load(type) \
|
||||
extern gpointer mname(type,begin_load) (ModulePreparedNotifyFunc prepare_func, \
|
||||
ModuleUpdatedNotifyFunc update_func, \
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,\
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,\
|
||||
gpointer user_data);
|
||||
#define m_stop_load(type) extern void mname(type,stop_load) (gpointer context);
|
||||
#define m_load_increment(type) extern gboolean mname(type,load_increment) (gpointer context, const guchar *buf, guint size);
|
||||
#define m_load_animation(type) extern GdkPixbufAnimation * mname(type,load_animation) (FILE *f);
|
||||
|
||||
m_load (png);
|
||||
m_begin_load (png);
|
||||
m_load_increment (png);
|
||||
m_stop_load (png);
|
||||
m_load (bmp);
|
||||
m_begin_load (bmp);
|
||||
m_load_increment (bmp);
|
||||
m_stop_load (bmp);
|
||||
m_load (gif);
|
||||
m_begin_load (gif);
|
||||
m_load_increment (gif);
|
||||
m_stop_load (gif);
|
||||
m_load_animation (gif);
|
||||
m_load (ico);
|
||||
m_begin_load (ico);
|
||||
m_load_increment (ico);
|
||||
m_stop_load (ico);
|
||||
m_load (jpeg);
|
||||
m_begin_load (jpeg);
|
||||
m_load_increment (jpeg);
|
||||
m_stop_load (jpeg);
|
||||
m_load (pnm);
|
||||
m_begin_load (pnm);
|
||||
m_load_increment (pnm);
|
||||
m_stop_load (pnm);
|
||||
m_load (ras);
|
||||
m_begin_load (ras);
|
||||
m_load_increment (ras);
|
||||
m_stop_load (ras);
|
||||
m_load (tiff);
|
||||
m_begin_load (tiff);
|
||||
m_load_increment (tiff);
|
||||
m_stop_load (tiff);
|
||||
m_load (xpm);
|
||||
m_load_xpm_data (xpm);
|
||||
|
||||
void
|
||||
gdk_pixbuf_load_module (GdkPixbufModule *image_module)
|
||||
{
|
||||
image_module->module = (void *) 1;
|
||||
|
||||
if (strcmp (image_module->module_name, "png") == 0){
|
||||
image_module->load = mname (png,load);
|
||||
image_module->begin_load = mname (png,begin_load);
|
||||
image_module->load_increment = mname (png,load_increment);
|
||||
image_module->stop_load = mname (png,stop_load);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp (image_module->module_name, "bmp") == 0){
|
||||
image_module->load = mname (bmp,load);
|
||||
image_module->begin_load = mname (bmp,begin_load);
|
||||
image_module->load_increment = mname (bmp,load_increment);
|
||||
image_module->stop_load = mname (bmp,stop_load);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp (image_module->module_name, "gif") == 0){
|
||||
image_module->load = mname (gif,load);
|
||||
image_module->begin_load = mname (gif,begin_load);
|
||||
image_module->load_increment = mname (gif,load_increment);
|
||||
image_module->stop_load = mname (gif,stop_load);
|
||||
image_module->load_animation = mname (gif,load_animation);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp (image_module->module_name, "ico") == 0){
|
||||
image_module->load = mname (ico,load);
|
||||
image_module->begin_load = mname (ico,begin_load);
|
||||
image_module->load_increment = mname (ico,load_increment);
|
||||
image_module->stop_load = mname (ico,stop_load);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp (image_module->module_name, "jpeg") == 0){
|
||||
image_module->load = mname (jpeg,load);
|
||||
image_module->begin_load = mname (jpeg,begin_load);
|
||||
image_module->load_increment = mname (jpeg,load_increment);
|
||||
image_module->stop_load = mname (jpeg,stop_load);
|
||||
return;
|
||||
}
|
||||
if (strcmp (image_module->module_name, "pnm") == 0){
|
||||
image_module->load = mname (pnm,load);
|
||||
image_module->begin_load = mname (pnm,begin_load);
|
||||
image_module->load_increment = mname (pnm,load_increment);
|
||||
image_module->stop_load = mname (pnm,stop_load);
|
||||
return;
|
||||
}
|
||||
if (strcmp (image_module->module_name, "ras") == 0){
|
||||
image_module->load = mname (ras,load);
|
||||
image_module->begin_load = mname (ras,begin_load);
|
||||
image_module->load_increment = mname (ras,load_increment);
|
||||
image_module->stop_load = mname (ras,stop_load);
|
||||
return;
|
||||
}
|
||||
if (strcmp (image_module->module_name, "tiff") == 0){
|
||||
image_module->load = mname (tiff,load);
|
||||
image_module->begin_load = mname (tiff,begin_load);
|
||||
image_module->load_increment = mname (tiff,load_increment);
|
||||
image_module->stop_load = mname (tiff,stop_load);
|
||||
return;
|
||||
}
|
||||
if (strcmp (image_module->module_name, "xpm") == 0){
|
||||
image_module->load = mname (xpm,load);
|
||||
image_module->load_xpm_data = mname (xpm,load_xpm_data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <gtk/gtksignal.h>
|
||||
#include "gdk-pixbuf-private.h"
|
||||
#include "gdk-pixbuf-loader.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
@@ -155,8 +156,9 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
|
||||
GTK_RUN_LAST,
|
||||
parent_class->type,
|
||||
GTK_SIGNAL_OFFSET (GdkPixbufLoaderClass, frame_done),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
gtk_marshal_NONE__POINTER,
|
||||
GTK_TYPE_NONE, 1,
|
||||
GTK_TYPE_POINTER);
|
||||
|
||||
pixbuf_loader_signals[ANIMATION_DONE] =
|
||||
gtk_signal_new ("animation_done",
|
||||
@@ -263,10 +265,27 @@ gdk_pixbuf_loader_frame_done (GdkPixbufFrame *frame, gpointer loader)
|
||||
|
||||
priv = GDK_PIXBUF_LOADER (loader)->private;
|
||||
|
||||
priv->pixbuf = NULL;
|
||||
|
||||
if (priv->animation == NULL) {
|
||||
priv->animation = g_new0 (GdkPixbufAnimation, 1);
|
||||
priv->animation->n_frames = 0;
|
||||
priv->animation->ref_count = 1;
|
||||
priv->animation->width = gdk_pixbuf_get_width (frame->pixbuf);
|
||||
priv->animation->height = gdk_pixbuf_get_height (frame->pixbuf);
|
||||
} else {
|
||||
int w, h;
|
||||
|
||||
/* update bbox size */
|
||||
w = gdk_pixbuf_get_width (frame->pixbuf);
|
||||
h = gdk_pixbuf_get_height (frame->pixbuf);
|
||||
|
||||
if (w > priv->animation->width) {
|
||||
priv->animation->width = h;
|
||||
}
|
||||
if (h > priv->animation->height) {
|
||||
priv->animation->height = h;
|
||||
}
|
||||
}
|
||||
|
||||
priv->animation->frames = g_list_append (priv->animation->frames, frame);
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
/* GdkPixbuf library - Private declarations
|
||||
*
|
||||
* 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>
|
||||
* Havoc Pennington <hp@redhat.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef GDK_PIXBUF_PRIVATE_H
|
||||
#define GDK_PIXBUF_PRIVATE_H
|
||||
|
||||
#include "gdk-pixbuf.h"
|
||||
|
||||
|
||||
|
||||
/* Private part of the GdkPixbuf structure */
|
||||
struct _GdkPixbuf {
|
||||
/* Reference count */
|
||||
int ref_count;
|
||||
|
||||
/* Color space */
|
||||
GdkColorspace colorspace;
|
||||
|
||||
/* Number of channels, alpha included */
|
||||
int n_channels;
|
||||
|
||||
/* Bits per channel */
|
||||
int bits_per_sample;
|
||||
|
||||
/* Size */
|
||||
int width, height;
|
||||
|
||||
/* Offset between rows */
|
||||
int rowstride;
|
||||
|
||||
/* The pixel array */
|
||||
guchar *pixels;
|
||||
|
||||
/* Destroy notification function; it is supposed to free the pixel array */
|
||||
GdkPixbufDestroyNotify destroy_fn;
|
||||
|
||||
/* User data for the destroy notification function */
|
||||
gpointer destroy_fn_data;
|
||||
|
||||
/* Last unref handler, determines whether the pixbuf should be finalized */
|
||||
GdkPixbufLastUnref last_unref_fn;
|
||||
|
||||
/* User data for the last unref handler */
|
||||
gpointer last_unref_fn_data;
|
||||
|
||||
/* Do we have an alpha channel? */
|
||||
guint has_alpha : 1;
|
||||
};
|
||||
|
||||
/* Private part of the GdkPixbufFrame structure */
|
||||
struct _GdkPixbufFrame {
|
||||
/* The pixbuf with this frame's image data */
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
/* Offsets for overlaying onto the animation's area */
|
||||
int x_offset;
|
||||
int y_offset;
|
||||
|
||||
/* Frame duration in ms */
|
||||
int delay_time;
|
||||
|
||||
/* Overlay mode */
|
||||
GdkPixbufFrameAction action;
|
||||
};
|
||||
|
||||
/* Private part of the GdkPixbufAnimation structure */
|
||||
struct _GdkPixbufAnimation {
|
||||
/* Reference count */
|
||||
int ref_count;
|
||||
|
||||
/* Number of frames */
|
||||
int n_frames;
|
||||
|
||||
/* List of GdkPixbufFrame structures */
|
||||
GList *frames;
|
||||
|
||||
/* bounding box size */
|
||||
int width, height;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
+109
-47
@@ -1,6 +1,31 @@
|
||||
#include "gdk-pixbuf.h"
|
||||
/* GdkPixbuf library - Scaling and compositing functions
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Author: Owen Taylor <otaylor@redhat.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <math.h>
|
||||
#include "gdk-pixbuf-private.h"
|
||||
#include "pixops/pixops.h"
|
||||
#include "math.h"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_scale:
|
||||
@@ -14,7 +39,7 @@
|
||||
* @offset_y: the offset in the Y direction (currently rounded to an integer)
|
||||
* @scale_x: the scale factor in the X direction
|
||||
* @scale_y: the scale factor in the Y direction
|
||||
* @filter_level: the filter quality for the transformation.
|
||||
* @interp_type: the interpolation type for the transformation.
|
||||
*
|
||||
* Transforms the image by source image by scaling by @scale_x and @scale_y then
|
||||
* translating by @offset_x and @offset_y, then renders the rectangle
|
||||
@@ -32,17 +57,23 @@ gdk_pixbuf_scale (const GdkPixbuf *src,
|
||||
double offset_y,
|
||||
double scale_x,
|
||||
double scale_y,
|
||||
ArtFilterLevel filter_level)
|
||||
GdkInterpType interp_type)
|
||||
{
|
||||
g_return_if_fail (src != NULL);
|
||||
g_return_if_fail (dest != NULL);
|
||||
g_return_if_fail (dest_x >= 0 && dest_x + dest_width <= dest->width);
|
||||
g_return_if_fail (dest_y >= 0 && dest_y + dest_height <= dest->height);
|
||||
|
||||
offset_x = floor (offset_x + 0.5);
|
||||
offset_y = floor (offset_y + 0.5);
|
||||
|
||||
pixops_scale (dest->art_pixbuf->pixels + dest_y * dest->art_pixbuf->rowstride + dest_x * dest->art_pixbuf->n_channels,
|
||||
-offset_x, -offset_y, dest_width - offset_x, dest_height - offset_y,
|
||||
dest->art_pixbuf->rowstride, dest->art_pixbuf->n_channels, dest->art_pixbuf->has_alpha,
|
||||
src->art_pixbuf->pixels, src->art_pixbuf->width, src->art_pixbuf->height,
|
||||
src->art_pixbuf->rowstride, src->art_pixbuf->n_channels, src->art_pixbuf->has_alpha,
|
||||
scale_x, scale_y, filter_level);
|
||||
pixops_scale (dest->pixels + dest_y * dest->rowstride + dest_x * dest->n_channels,
|
||||
dest_x - offset_x, dest_y - offset_y,
|
||||
dest_x + dest_width - offset_x, dest_y + dest_height - offset_y,
|
||||
dest->rowstride, dest->n_channels, dest->has_alpha,
|
||||
src->pixels, src->width, src->height,
|
||||
src->rowstride, src->n_channels, src->has_alpha,
|
||||
scale_x, scale_y, interp_type);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,7 +88,7 @@ gdk_pixbuf_scale (const GdkPixbuf *src,
|
||||
* @offset_y: the offset in the Y direction (currently rounded to an integer)
|
||||
* @scale_x: the scale factor in the X direction
|
||||
* @scale_y: the scale factor in the Y direction
|
||||
* @filter_level: the filter quality for the transformation.
|
||||
* @interp_type: the interpolation type for the transformation.
|
||||
* @overall_alpha: overall alpha for source image (0..255)
|
||||
*
|
||||
* Transforms the image by source image by scaling by @scale_x and @scale_y then
|
||||
@@ -76,17 +107,24 @@ gdk_pixbuf_composite (const GdkPixbuf *src,
|
||||
double offset_y,
|
||||
double scale_x,
|
||||
double scale_y,
|
||||
ArtFilterLevel filter_level,
|
||||
GdkInterpType interp_type,
|
||||
int overall_alpha)
|
||||
{
|
||||
g_return_if_fail (src != NULL);
|
||||
g_return_if_fail (dest != NULL);
|
||||
g_return_if_fail (dest_x >= 0 && dest_x + dest_width <= dest->width);
|
||||
g_return_if_fail (dest_y >= 0 && dest_y + dest_height <= dest->height);
|
||||
g_return_if_fail (overall_alpha >= 0 && overall_alpha <= 255);
|
||||
|
||||
offset_x = floor (offset_x + 0.5);
|
||||
offset_y = floor (offset_y + 0.5);
|
||||
pixops_composite (dest->art_pixbuf->pixels + dest_y * dest->art_pixbuf->rowstride + dest_x * dest->art_pixbuf->n_channels,
|
||||
-offset_x, -offset_y, dest_width - offset_x, dest_height - offset_y,
|
||||
dest->art_pixbuf->rowstride, dest->art_pixbuf->n_channels, dest->art_pixbuf->has_alpha,
|
||||
src->art_pixbuf->pixels, src->art_pixbuf->width, src->art_pixbuf->height,
|
||||
src->art_pixbuf->rowstride, src->art_pixbuf->n_channels, src->art_pixbuf->has_alpha,
|
||||
scale_x, scale_y, filter_level, overall_alpha);
|
||||
pixops_composite (dest->pixels + dest_y * dest->rowstride + dest_x * dest->n_channels,
|
||||
dest_x - offset_x, dest_y - offset_y,
|
||||
dest_x + dest_width - offset_x, dest_y + dest_height - offset_y,
|
||||
dest->rowstride, dest->n_channels, dest->has_alpha,
|
||||
src->pixels, src->width, src->height,
|
||||
src->rowstride, src->n_channels, src->has_alpha,
|
||||
scale_x, scale_y, interp_type, overall_alpha);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,7 +139,7 @@ gdk_pixbuf_composite (const GdkPixbuf *src,
|
||||
* @offset_y: the offset in the Y direction (currently rounded to an integer)
|
||||
* @scale_x: the scale factor in the X direction
|
||||
* @scale_y: the scale factor in the Y direction
|
||||
* @filter_level: the filter quality for the transformation.
|
||||
* @interp_type: the interpolation type for the transformation.
|
||||
* @overall_alpha: overall alpha for source image (0..255)
|
||||
* @check_x: the X offset for the checkboard (origin of checkboard is at -@check_x, -@check_y)
|
||||
* @check_y: the Y offset for the checkboard
|
||||
@@ -126,23 +164,31 @@ gdk_pixbuf_composite_color (const GdkPixbuf *src,
|
||||
double offset_y,
|
||||
double scale_x,
|
||||
double scale_y,
|
||||
ArtFilterLevel filter_level,
|
||||
GdkInterpType interp_type,
|
||||
int overall_alpha,
|
||||
int check_x,
|
||||
int check_y,
|
||||
int check_size,
|
||||
art_u32 color1,
|
||||
art_u32 color2)
|
||||
guint32 color1,
|
||||
guint32 color2)
|
||||
{
|
||||
g_return_if_fail (src != NULL);
|
||||
g_return_if_fail (dest != NULL);
|
||||
g_return_if_fail (dest_x >= 0 && dest_x + dest_width <= dest->width);
|
||||
g_return_if_fail (dest_y >= 0 && dest_y + dest_height <= dest->height);
|
||||
g_return_if_fail (overall_alpha >= 0 && overall_alpha <= 255);
|
||||
|
||||
offset_x = floor (offset_x + 0.5);
|
||||
offset_y = floor (offset_y + 0.5);
|
||||
|
||||
pixops_composite_color (dest->art_pixbuf->pixels + dest_y * dest->art_pixbuf->rowstride + dest_x * dest->art_pixbuf->n_channels,
|
||||
-offset_x, -offset_y, dest_width - offset_x, dest_height - offset_y,
|
||||
dest->art_pixbuf->rowstride, dest->art_pixbuf->n_channels, dest->art_pixbuf->has_alpha,
|
||||
src->art_pixbuf->pixels, src->art_pixbuf->width, src->art_pixbuf->height,
|
||||
src->art_pixbuf->rowstride, src->art_pixbuf->n_channels, src->art_pixbuf->has_alpha,
|
||||
scale_x, scale_y, filter_level, overall_alpha, check_x, check_y, check_size, color1, color2);
|
||||
pixops_composite_color (dest->pixels + dest_y * dest->rowstride + dest_x * dest->n_channels,
|
||||
dest_x - offset_x, dest_y - offset_y,
|
||||
dest_x + dest_width - offset_x, dest_y + dest_height - offset_y,
|
||||
dest->rowstride, dest->n_channels, dest->has_alpha,
|
||||
src->pixels, src->width, src->height,
|
||||
src->rowstride, src->n_channels, src->has_alpha,
|
||||
scale_x, scale_y, interp_type, overall_alpha, check_x, check_y,
|
||||
check_size, color1, color2);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,25 +196,34 @@ gdk_pixbuf_composite_color (const GdkPixbuf *src,
|
||||
* @src: a #GdkPixbuf
|
||||
* @dest_width: the width of destination image
|
||||
* @dest_height: the height of destination image
|
||||
* @filter_level: the filter quality for the transformation.
|
||||
* @interp_type: the interpolation type for the transformation.
|
||||
*
|
||||
* Scale the #GdkPixbuf @src to @dest_width x @dest_height and render the result into
|
||||
* a new #GdkPixbuf.
|
||||
*
|
||||
* Return value: the new #GdkPixbuf
|
||||
* Return value: the new #GdkPixbuf, or NULL if not enough memory could be
|
||||
* allocated for it.
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_scale_simple (const GdkPixbuf *src,
|
||||
int dest_width,
|
||||
int dest_height,
|
||||
ArtFilterLevel filter_level)
|
||||
GdkInterpType interp_type)
|
||||
{
|
||||
GdkPixbuf *dest = gdk_pixbuf_new (ART_PIX_RGB, src->art_pixbuf->has_alpha, 8, dest_width, dest_height);
|
||||
GdkPixbuf *dest;
|
||||
|
||||
g_return_val_if_fail (src != NULL, NULL);
|
||||
g_return_val_if_fail (dest_width > 0, NULL);
|
||||
g_return_val_if_fail (dest_height > 0, NULL);
|
||||
|
||||
dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, src->has_alpha, 8, dest_width, dest_height);
|
||||
if (!dest)
|
||||
return NULL;
|
||||
|
||||
gdk_pixbuf_scale (src, dest, 0, 0, dest_width, dest_height, 0, 0,
|
||||
(double)dest_width / src->art_pixbuf->width,
|
||||
(double)dest_height / src->art_pixbuf->height,
|
||||
filter_level);
|
||||
(double) dest_width / src->width,
|
||||
(double) dest_height / src->height,
|
||||
interp_type);
|
||||
|
||||
return dest;
|
||||
}
|
||||
@@ -178,7 +233,7 @@ gdk_pixbuf_scale_simple (const GdkPixbuf *src,
|
||||
* @src: a #GdkPixbuf
|
||||
* @dest_width: the width of destination image
|
||||
* @dest_height: the height of destination image
|
||||
* @filter_level: the filter quality for the transformation.
|
||||
* @interp_type: the interpolation type for the transformation.
|
||||
* @overall_alpha: overall alpha for source image (0..255)
|
||||
* @check_size: the size of checks in the checkboard (must be a power of two)
|
||||
* @color1: the color of check at upper left
|
||||
@@ -188,27 +243,34 @@ gdk_pixbuf_scale_simple (const GdkPixbuf *src,
|
||||
* a checkboard of colors @color1 and @color2 and render the result into
|
||||
* a new #GdkPixbuf.
|
||||
*
|
||||
* Return value: the new #GdkPixbuf
|
||||
* Return value: the new #GdkPixbuf, or NULL if not enough memory could be
|
||||
* allocated for it.
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,
|
||||
int dest_width,
|
||||
int dest_height,
|
||||
ArtFilterLevel filter_level,
|
||||
GdkInterpType interp_type,
|
||||
int overall_alpha,
|
||||
int check_size,
|
||||
art_u32 color1,
|
||||
art_u32 color2)
|
||||
guint32 color1,
|
||||
guint32 color2)
|
||||
{
|
||||
GdkPixbuf *dest = gdk_pixbuf_new (ART_PIX_RGB, src->art_pixbuf->has_alpha, 8, dest_width, dest_height);
|
||||
GdkPixbuf *dest;
|
||||
|
||||
g_return_val_if_fail (src != NULL, NULL);
|
||||
g_return_val_if_fail (dest_width > 0, NULL);
|
||||
g_return_val_if_fail (dest_height > 0, NULL);
|
||||
g_return_val_if_fail (overall_alpha >= 0 && overall_alpha <= 255, NULL);
|
||||
|
||||
dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, src->has_alpha, 8, dest_width, dest_height);
|
||||
if (!dest)
|
||||
return NULL;
|
||||
|
||||
gdk_pixbuf_composite_color (src, dest, 0, 0, dest_width, dest_height, 0, 0,
|
||||
(double)dest_width / src->art_pixbuf->width,
|
||||
(double)dest_height / src->art_pixbuf->height,
|
||||
filter_level, overall_alpha, 0, 0, check_size, color1, color2);
|
||||
(double) dest_width / src->width,
|
||||
(double) dest_height / src->height,
|
||||
interp_type, overall_alpha, 0, 0, check_size, color1, color2);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-private.h"
|
||||
|
||||
|
||||
|
||||
@@ -45,42 +45,37 @@
|
||||
* Return value: A newly-created pixbuf with a reference count of 1.
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_add_alpha (GdkPixbuf *pixbuf, gboolean substitute_color, guchar r, guchar g, guchar b)
|
||||
gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf,
|
||||
gboolean substitute_color, guchar r, guchar g, guchar b)
|
||||
{
|
||||
ArtPixBuf *apb;
|
||||
ArtPixBuf *new_apb;
|
||||
GdkPixbuf *new_pixbuf;
|
||||
int x, y;
|
||||
|
||||
g_return_val_if_fail (pixbuf != NULL, NULL);
|
||||
g_return_val_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB, NULL);
|
||||
g_return_val_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4, NULL);
|
||||
g_return_val_if_fail (pixbuf->bits_per_sample == 8, NULL);
|
||||
|
||||
apb = pixbuf->art_pixbuf;
|
||||
g_return_val_if_fail (apb->format == ART_PIX_RGB, NULL);
|
||||
g_return_val_if_fail (apb->n_channels == 3 || apb->n_channels == 4, NULL);
|
||||
g_return_val_if_fail (apb->bits_per_sample == 8, NULL);
|
||||
|
||||
if (apb->has_alpha) {
|
||||
new_apb = art_pixbuf_duplicate (apb);
|
||||
if (!new_apb)
|
||||
if (pixbuf->has_alpha) {
|
||||
new_pixbuf = gdk_pixbuf_copy (pixbuf);
|
||||
if (!new_pixbuf)
|
||||
return NULL;
|
||||
|
||||
return gdk_pixbuf_new_from_art_pixbuf (new_apb);
|
||||
return new_pixbuf;
|
||||
}
|
||||
|
||||
new_pixbuf = gdk_pixbuf_new (ART_PIX_RGB, TRUE, 8, apb->width, apb->height);
|
||||
new_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, pixbuf->width, pixbuf->height);
|
||||
if (!new_pixbuf)
|
||||
return NULL;
|
||||
|
||||
new_apb = new_pixbuf->art_pixbuf;
|
||||
|
||||
for (y = 0; y < apb->height; y++) {
|
||||
for (y = 0; y < pixbuf->height; y++) {
|
||||
guchar *src, *dest;
|
||||
guchar tr, tg, tb;
|
||||
|
||||
src = apb->pixels + y * apb->rowstride;
|
||||
dest = new_apb->pixels + y * new_apb->rowstride;
|
||||
src = pixbuf->pixels + y * pixbuf->rowstride;
|
||||
dest = new_pixbuf->pixels + y * new_pixbuf->rowstride;
|
||||
|
||||
for (x = 0; x < apb->width; x++) {
|
||||
for (x = 0; x < pixbuf->width; x++) {
|
||||
tr = *dest++ = *src++;
|
||||
tg = *dest++ = *src++;
|
||||
tb = *dest++ = *src++;
|
||||
@@ -116,20 +111,14 @@ gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,
|
||||
GdkPixbuf *dest_pixbuf,
|
||||
int dest_x, int dest_y)
|
||||
{
|
||||
const ArtPixBuf *src_apb;
|
||||
ArtPixBuf *dest_apb;
|
||||
|
||||
g_return_if_fail (src_pixbuf != NULL);
|
||||
g_return_if_fail (dest_pixbuf != NULL);
|
||||
|
||||
src_apb = src_pixbuf->art_pixbuf;
|
||||
dest_apb = dest_pixbuf->art_pixbuf;
|
||||
g_return_if_fail (src_x >= 0 && src_x + width <= src_pixbuf->width);
|
||||
g_return_if_fail (src_y >= 0 && src_y + height <= src_pixbuf->height);
|
||||
|
||||
g_return_if_fail (src_x >= 0 && src_x + width <= src_apb->width);
|
||||
g_return_if_fail (src_y >= 0 && src_y + height <= src_apb->height);
|
||||
|
||||
g_return_if_fail (dest_x >= 0 && dest_x + width <= dest_apb->width);
|
||||
g_return_if_fail (dest_y >= 0 && dest_y + height <= dest_apb->height);
|
||||
g_return_if_fail (dest_x >= 0 && dest_x + width <= dest_pixbuf->width);
|
||||
g_return_if_fail (dest_y >= 0 && dest_y + height <= dest_pixbuf->height);
|
||||
|
||||
/* This will perform format conversions automatically */
|
||||
|
||||
@@ -140,5 +129,5 @@ gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,
|
||||
(double) (dest_x - src_x),
|
||||
(double) (dest_y - src_y),
|
||||
1.0, 1.0,
|
||||
ART_FILTER_NEAREST);
|
||||
GDK_INTERP_NEAREST);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
/* FIXME FIXME FIXME
|
||||
*
|
||||
* This file is not being used. The gdk_pixbuf_scale() here is not useful
|
||||
* anymore, since we have the new functions in gdk-pixbuf-scale.c.
|
||||
*
|
||||
* The rotation function needs to be implemented without libart if it is
|
||||
* to go inside the GdkPixbuf library.
|
||||
*/
|
||||
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_scale (const GdkPixbuf *pixbuf, gint w, gint h)
|
||||
{
|
||||
art_u8 *pixels;
|
||||
guchar *pixels;
|
||||
gint rowstride;
|
||||
double affine[6];
|
||||
ArtAlphaGamma *alphagamma;
|
||||
@@ -12,10 +21,10 @@ gdk_pixbuf_scale (const GdkPixbuf *pixbuf, gint w, gint h)
|
||||
|
||||
affine[1] = affine[2] = affine[4] = affine[5] = 0;
|
||||
|
||||
affine[0] = w / (double)(pixbuf->art_pixbuf->width);
|
||||
affine[3] = h / (double)(pixbuf->art_pixbuf->height);
|
||||
affine[0] = w / (double)(pixbuf->width);
|
||||
affine[3] = h / (double)(pixbuf->height);
|
||||
|
||||
/* rowstride = w * pixbuf->art_pixbuf->n_channels; */
|
||||
/* rowstride = w * pixbuf->n_channels; */
|
||||
rowstride = w * 3;
|
||||
|
||||
pixels = art_alloc (h * rowstride);
|
||||
|
||||
+133
-81
@@ -24,12 +24,9 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <math.h>
|
||||
#include <libart_lgpl/art_misc.h>
|
||||
#include <libart_lgpl/art_affine.h>
|
||||
#include <libart_lgpl/art_pixbuf.h>
|
||||
#include <libart_lgpl/art_rgb_pixbuf_affine.h>
|
||||
#include <libart_lgpl/art_alphagamma.h>
|
||||
#include <stdlib.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-private.h"
|
||||
|
||||
|
||||
|
||||
@@ -58,8 +55,11 @@ gdk_pixbuf_ref (GdkPixbuf *pixbuf)
|
||||
* gdk_pixbuf_unref:
|
||||
* @pixbuf: A pixbuf.
|
||||
*
|
||||
* Removes a reference from a pixbuf. It will be destroyed when the reference
|
||||
* count drops to zero.
|
||||
* Removes a reference from a pixbuf. If this is the last reference for the
|
||||
* @pixbuf, then its last unref handler function will be called; if no handler
|
||||
* has been defined, then the pixbuf will be finalized.
|
||||
*
|
||||
* See also: gdk_pixbuf_set_last_unref_handler().
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_unref (GdkPixbuf *pixbuf)
|
||||
@@ -67,56 +67,72 @@ gdk_pixbuf_unref (GdkPixbuf *pixbuf)
|
||||
g_return_if_fail (pixbuf != NULL);
|
||||
g_return_if_fail (pixbuf->ref_count > 0);
|
||||
|
||||
pixbuf->ref_count--;
|
||||
|
||||
if (pixbuf->ref_count == 0) {
|
||||
art_pixbuf_free (pixbuf->art_pixbuf);
|
||||
pixbuf->art_pixbuf = NULL;
|
||||
g_free (pixbuf);
|
||||
}
|
||||
if (pixbuf->ref_count > 1)
|
||||
pixbuf->ref_count--;
|
||||
else if (pixbuf->last_unref_fn)
|
||||
(* pixbuf->last_unref_fn) (pixbuf, pixbuf->last_unref_fn_data);
|
||||
else
|
||||
gdk_pixbuf_finalize (pixbuf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Wrap a libart pixbuf */
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_new_from_art_pixbuf:
|
||||
* @art_pixbuf: A libart pixbuf.
|
||||
* gdk_pixbuf_set_last_unref_handler:
|
||||
* @pixbuf: A pixbuf.
|
||||
* @last_unref_fn: Handler function for the last unref.
|
||||
* @last_unref_fn_data: Closure data to pass to the last unref handler function.
|
||||
*
|
||||
* Sets the handler function for the @pixbuf's last unref handler. When
|
||||
* gdk_pixbuf_unref() is called on this pixbuf and it has a reference count of
|
||||
* 1, i.e. its last reference, then the last unref handler will be called. This
|
||||
* function should determine whether to finalize the pixbuf or just continue.
|
||||
* If it wishes to finalize the pixbuf, it should do so by calling
|
||||
* gdk_pixbuf_finalize().
|
||||
*
|
||||
* Creates a #GdkPixbuf by wrapping a libart pixbuf.
|
||||
*
|
||||
* Return value: A newly-created #GdkPixbuf structure with a reference count of
|
||||
* 1.
|
||||
* See also: gdk_pixbuf_finalize().
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_new_from_art_pixbuf (ArtPixBuf *art_pixbuf)
|
||||
void
|
||||
gdk_pixbuf_set_last_unref_handler (GdkPixbuf *pixbuf, GdkPixbufLastUnref last_unref_fn,
|
||||
gpointer last_unref_fn_data)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
g_return_if_fail (pixbuf != NULL);
|
||||
|
||||
g_return_val_if_fail (art_pixbuf != NULL, NULL);
|
||||
|
||||
pixbuf = g_new (GdkPixbuf, 1);
|
||||
pixbuf->ref_count = 1;
|
||||
pixbuf->art_pixbuf = art_pixbuf;
|
||||
|
||||
return pixbuf;
|
||||
pixbuf->last_unref_fn = last_unref_fn;
|
||||
pixbuf->last_unref_fn_data = last_unref_fn_data;
|
||||
}
|
||||
|
||||
/* Destroy notification function for gdk_pixbuf_new() */
|
||||
static void
|
||||
free_buffer (gpointer user_data, gpointer data)
|
||||
/**
|
||||
* gdk_pixbuf_finalize:
|
||||
* @pixbuf: A pixbuf with a reference count of 1.
|
||||
*
|
||||
* Finalizes a pixbuf by calling its destroy notification function to free the
|
||||
* pixel data and freeing the pixbuf itself. This function is meant to be
|
||||
* called only from within a #GdkPixbufLastUnref handler function, and the
|
||||
* specified @pixbuf must have a reference count of 1, i.e. its last reference.
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_finalize (GdkPixbuf *pixbuf)
|
||||
{
|
||||
free (data);
|
||||
g_return_if_fail (pixbuf != NULL);
|
||||
g_return_if_fail (pixbuf->ref_count == 1);
|
||||
|
||||
if (pixbuf->destroy_fn)
|
||||
(* pixbuf->destroy_fn) (pixbuf->pixels, pixbuf->destroy_fn_data);
|
||||
|
||||
g_free (pixbuf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Create an empty pixbuf */
|
||||
/* Used as the destroy notification function for gdk_pixbuf_new() */
|
||||
static void
|
||||
free_buffer (guchar *pixels, gpointer data)
|
||||
{
|
||||
free (pixels);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_new:
|
||||
* @format: Image format.
|
||||
* @colorspace: Color space for image.
|
||||
* @has_alpha: Whether the image should have transparency information.
|
||||
* @bits_per_sample: Number of bits per color sample.
|
||||
* @width: Width of image in pixels.
|
||||
@@ -124,20 +140,20 @@ free_buffer (gpointer user_data, gpointer data)
|
||||
*
|
||||
* Creates a new #GdkPixbuf structure and allocates a buffer for it. The buffer
|
||||
* has an optimal rowstride. Note that the buffer is not cleared; you will have
|
||||
* to fill it completely.
|
||||
* to fill it completely yourself.
|
||||
*
|
||||
* Return value: A newly-created #GdkPixbuf with a reference count of 1, or NULL
|
||||
* if not enough memory could be allocated for the image buffer.
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_new (ArtPixFormat format, gboolean has_alpha, int bits_per_sample,
|
||||
gdk_pixbuf_new (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample,
|
||||
int width, int height)
|
||||
{
|
||||
guchar *buf;
|
||||
int channels;
|
||||
int rowstride;
|
||||
|
||||
g_return_val_if_fail (format == ART_PIX_RGB, NULL);
|
||||
g_return_val_if_fail (colorspace == GDK_COLORSPACE_RGB, NULL);
|
||||
g_return_val_if_fail (bits_per_sample == 8, NULL);
|
||||
g_return_val_if_fail (width > 0, NULL);
|
||||
g_return_val_if_fail (height > 0, NULL);
|
||||
@@ -151,29 +167,70 @@ gdk_pixbuf_new (ArtPixFormat format, gboolean has_alpha, int bits_per_sample,
|
||||
if (!buf)
|
||||
return NULL;
|
||||
|
||||
return gdk_pixbuf_new_from_data (buf, format, has_alpha, width, height, rowstride,
|
||||
return gdk_pixbuf_new_from_data (buf, colorspace, has_alpha, bits_per_sample,
|
||||
width, height, rowstride,
|
||||
free_buffer, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_copy:
|
||||
* @pixbuf: A pixbuf.
|
||||
*
|
||||
* Creates a new #GdkPixbuf with a copy of the information in the specified
|
||||
* @pixbuf.
|
||||
*
|
||||
* Return value: A newly-created pixbuf with a reference count of 1, or NULL if
|
||||
* not enough memory could be allocated.
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_copy (const GdkPixbuf *pixbuf)
|
||||
{
|
||||
guchar *buf;
|
||||
int size;
|
||||
|
||||
g_return_val_if_fail (pixbuf != NULL, NULL);
|
||||
|
||||
/* Calculate a semi-exact size. Here we copy with full rowstrides;
|
||||
* maybe we should copy each row individually with the minimum
|
||||
* rowstride?
|
||||
*/
|
||||
|
||||
size = ((pixbuf->height - 1) * pixbuf->rowstride +
|
||||
pixbuf->width * ((pixbuf->n_channels * pixbuf->bits_per_sample + 7) / 8));
|
||||
|
||||
buf = malloc (size * sizeof (guchar));
|
||||
if (!buf)
|
||||
return NULL;
|
||||
|
||||
memcpy (buf, pixbuf->pixels, size);
|
||||
|
||||
return gdk_pixbuf_new_from_data (buf,
|
||||
pixbuf->colorspace, pixbuf->has_alpha,
|
||||
pixbuf->bits_per_sample,
|
||||
pixbuf->width, pixbuf->height,
|
||||
pixbuf->rowstride,
|
||||
free_buffer,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Convenience functions */
|
||||
/* Accessors */
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_get_format:
|
||||
* gdk_pixbuf_get_colorspace:
|
||||
* @pixbuf: A pixbuf.
|
||||
*
|
||||
* Queries the image format (color model) of a pixbuf.
|
||||
* Queries the color space of a pixbuf.
|
||||
*
|
||||
* Return value: Image format.
|
||||
* Return value: Color space.
|
||||
**/
|
||||
ArtPixFormat
|
||||
gdk_pixbuf_get_format (GdkPixbuf *pixbuf)
|
||||
GdkColorspace
|
||||
gdk_pixbuf_get_colorspace (const GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_val_if_fail (pixbuf != NULL, ART_PIX_RGB);
|
||||
g_assert (pixbuf->art_pixbuf != NULL);
|
||||
g_return_val_if_fail (pixbuf != NULL, GDK_COLORSPACE_RGB);
|
||||
|
||||
return pixbuf->art_pixbuf->format;
|
||||
return pixbuf->colorspace;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -185,12 +242,11 @@ gdk_pixbuf_get_format (GdkPixbuf *pixbuf)
|
||||
* Return value: Number of channels.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_get_n_channels (GdkPixbuf *pixbuf)
|
||||
gdk_pixbuf_get_n_channels (const GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_val_if_fail (pixbuf != NULL, -1);
|
||||
g_assert (pixbuf->art_pixbuf != NULL);
|
||||
|
||||
return pixbuf->art_pixbuf->n_channels;
|
||||
return pixbuf->n_channels;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -201,13 +257,12 @@ gdk_pixbuf_get_n_channels (GdkPixbuf *pixbuf)
|
||||
*
|
||||
* Return value: TRUE if it has an alpha channel, FALSE otherwise.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_get_has_alpha (GdkPixbuf *pixbuf)
|
||||
gboolean
|
||||
gdk_pixbuf_get_has_alpha (const GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_val_if_fail (pixbuf != NULL, -1);
|
||||
g_assert (pixbuf->art_pixbuf != NULL);
|
||||
|
||||
return pixbuf->art_pixbuf->has_alpha;
|
||||
return pixbuf->has_alpha ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -219,12 +274,11 @@ gdk_pixbuf_get_has_alpha (GdkPixbuf *pixbuf)
|
||||
* Return value: Number of bits per color sample.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_get_bits_per_sample (GdkPixbuf *pixbuf)
|
||||
gdk_pixbuf_get_bits_per_sample (const GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_val_if_fail (pixbuf != NULL, -1);
|
||||
g_assert (pixbuf->art_pixbuf != NULL);
|
||||
|
||||
return pixbuf->art_pixbuf->bits_per_sample;
|
||||
return pixbuf->bits_per_sample;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -236,12 +290,11 @@ gdk_pixbuf_get_bits_per_sample (GdkPixbuf *pixbuf)
|
||||
* Return value: A pointer to the pixbuf's pixel data.
|
||||
**/
|
||||
guchar *
|
||||
gdk_pixbuf_get_pixels (GdkPixbuf *pixbuf)
|
||||
gdk_pixbuf_get_pixels (const GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_val_if_fail (pixbuf != NULL, NULL);
|
||||
g_assert (pixbuf->art_pixbuf != NULL);
|
||||
|
||||
return pixbuf->art_pixbuf->pixels;
|
||||
return pixbuf->pixels;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -253,12 +306,11 @@ gdk_pixbuf_get_pixels (GdkPixbuf *pixbuf)
|
||||
* Return value: Width in pixels.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_get_width (GdkPixbuf *pixbuf)
|
||||
gdk_pixbuf_get_width (const GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_val_if_fail (pixbuf != NULL, -1);
|
||||
g_assert (pixbuf->art_pixbuf != NULL);
|
||||
|
||||
return pixbuf->art_pixbuf->width;
|
||||
return pixbuf->width;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -270,44 +322,44 @@ gdk_pixbuf_get_width (GdkPixbuf *pixbuf)
|
||||
* Return value: Height in pixels.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_get_height (GdkPixbuf *pixbuf)
|
||||
gdk_pixbuf_get_height (const GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_val_if_fail (pixbuf != NULL, -1);
|
||||
g_assert (pixbuf->art_pixbuf != NULL);
|
||||
|
||||
return pixbuf->art_pixbuf->height;
|
||||
return pixbuf->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_get_rowstride:
|
||||
* @pixbuf: A pixbuf.
|
||||
*
|
||||
* Queries the rowstride of a pixbuf, or the number of bytes between rows.
|
||||
* Queries the rowstride of a pixbuf, which is the number of bytes between rows.
|
||||
*
|
||||
* Return value: Number of bytes between rows.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_get_rowstride (GdkPixbuf *pixbuf)
|
||||
gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf)
|
||||
{
|
||||
g_return_val_if_fail (pixbuf != NULL, -1);
|
||||
g_assert (pixbuf->art_pixbuf != NULL);
|
||||
|
||||
return pixbuf->art_pixbuf->rowstride;
|
||||
return pixbuf->rowstride;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* General initialization hooks */
|
||||
const guint gdk_pixbuf_major_version=GDK_PIXBUF_MAJOR,
|
||||
gdk_pixbuf_minor_version=GDK_PIXBUF_MINOR,
|
||||
gdk_pixbuf_micro_version=GDK_PIXBUF_MICRO;
|
||||
const guint gdk_pixbuf_major_version = GDK_PIXBUF_MAJOR;
|
||||
const guint gdk_pixbuf_minor_version = GDK_PIXBUF_MINOR;
|
||||
const guint gdk_pixbuf_micro_version = GDK_PIXBUF_MICRO;
|
||||
|
||||
const char *gdk_pixbuf_version = GDK_PIXBUF_VERSION;
|
||||
|
||||
void
|
||||
gdk_pixbuf_preinit(gpointer app, gpointer modinfo)
|
||||
gdk_pixbuf_preinit (gpointer app, gpointer modinfo)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
gdk_pixbuf_postinit(gpointer app, gpointer modinfo)
|
||||
gdk_pixbuf_postinit (gpointer app, gpointer modinfo)
|
||||
{
|
||||
}
|
||||
|
||||
+106
-90
@@ -5,6 +5,7 @@
|
||||
* Authors: Mark Crichton <crichton@gimp.org>
|
||||
* Miguel de Icaza <miguel@gnu.org>
|
||||
* Federico Mena-Quintero <federico@gimp.org>
|
||||
* Havoc Pennington <hp@redhat.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
@@ -25,9 +26,6 @@
|
||||
#ifndef GDK_PIXBUF_H
|
||||
#define GDK_PIXBUF_H
|
||||
|
||||
#include <libart_lgpl/art_misc.h>
|
||||
#include <libart_lgpl/art_pixbuf.h>
|
||||
#include <libart_lgpl/art_filterlevel.h>
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -36,95 +34,86 @@ extern "C" {
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf-features.h>
|
||||
|
||||
/* GdkPixbuf structures */
|
||||
|
||||
|
||||
/* Color spaces; right now only RGB is supported */
|
||||
typedef enum {
|
||||
GDK_COLORSPACE_RGB
|
||||
} GdkColorspace;
|
||||
|
||||
/* All of these are opaque structures */
|
||||
typedef struct _GdkPixbuf GdkPixbuf;
|
||||
typedef struct _GdkPixbufFrame GdkPixbufFrame;
|
||||
typedef struct _GdkPixbufAnimation GdkPixbufAnimation;
|
||||
|
||||
struct _GdkPixbuf {
|
||||
/* Reference count */
|
||||
int ref_count;
|
||||
/* Handler that must free the pixel array */
|
||||
typedef void (* GdkPixbufDestroyNotify) (guchar *pixels, gpointer data);
|
||||
|
||||
/* Libart pixbuf */
|
||||
ArtPixBuf *art_pixbuf;
|
||||
};
|
||||
|
||||
/* GIF-like animation overlay modes for frames */
|
||||
typedef enum {
|
||||
GDK_PIXBUF_FRAME_RETAIN,
|
||||
GDK_PIXBUF_FRAME_DISPOSE,
|
||||
GDK_PIXBUF_FRAME_REVERT
|
||||
} GdkPixbufFrameAction;
|
||||
|
||||
struct _GdkPixbufFrame {
|
||||
/* The pixbuf with this frame's image data */
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
/* Offsets for overlaying onto the animation's area */
|
||||
int x_offset;
|
||||
int y_offset;
|
||||
|
||||
/* Frame duration in ms */
|
||||
int delay_time;
|
||||
|
||||
/* Overlay mode */
|
||||
GdkPixbufFrameAction action;
|
||||
};
|
||||
|
||||
struct _GdkPixbufAnimation {
|
||||
/* Reference count */
|
||||
int ref_count;
|
||||
|
||||
/* Number of frames */
|
||||
int n_frames;
|
||||
|
||||
/* List of GdkPixbufFrame structures */
|
||||
GList *frames;
|
||||
};
|
||||
/* Handler for the last unref operation */
|
||||
typedef void (* GdkPixbufLastUnref) (GdkPixbuf *pixbuf, gpointer data);
|
||||
|
||||
|
||||
|
||||
/* Convenience functions */
|
||||
|
||||
ArtPixFormat gdk_pixbuf_get_format (GdkPixbuf *pixbuf);
|
||||
int gdk_pixbuf_get_n_channels (GdkPixbuf *pixbuf);
|
||||
int gdk_pixbuf_get_has_alpha (GdkPixbuf *pixbuf);
|
||||
int gdk_pixbuf_get_bits_per_sample (GdkPixbuf *pixbuf);
|
||||
guchar *gdk_pixbuf_get_pixels (GdkPixbuf *pixbuf);
|
||||
int gdk_pixbuf_get_width (GdkPixbuf *pixbuf);
|
||||
int gdk_pixbuf_get_height (GdkPixbuf *pixbuf);
|
||||
int gdk_pixbuf_get_rowstride (GdkPixbuf *pixbuf);
|
||||
|
||||
/* Reference counting */
|
||||
|
||||
GdkPixbuf *gdk_pixbuf_ref (GdkPixbuf *pixbuf);
|
||||
void gdk_pixbuf_unref (GdkPixbuf *pixbuf);
|
||||
GdkPixbuf *gdk_pixbuf_ref (GdkPixbuf *pixbuf);
|
||||
void gdk_pixbuf_unref (GdkPixbuf *pixbuf);
|
||||
|
||||
/* Wrap a libart pixbuf */
|
||||
GdkPixbuf *gdk_pixbuf_new_from_art_pixbuf (ArtPixBuf *art_pixbuf);
|
||||
void gdk_pixbuf_set_last_unref_handler (GdkPixbuf *pixbuf,
|
||||
GdkPixbufLastUnref last_unref_fn,
|
||||
gpointer last_unref_fn_data);
|
||||
|
||||
void gdk_pixbuf_finalize (GdkPixbuf *pixbuf);
|
||||
|
||||
/* GdkPixbuf accessors */
|
||||
|
||||
GdkColorspace gdk_pixbuf_get_colorspace (const GdkPixbuf *pixbuf);
|
||||
int gdk_pixbuf_get_n_channels (const GdkPixbuf *pixbuf);
|
||||
gboolean gdk_pixbuf_get_has_alpha (const GdkPixbuf *pixbuf);
|
||||
int gdk_pixbuf_get_bits_per_sample (const GdkPixbuf *pixbuf);
|
||||
guchar *gdk_pixbuf_get_pixels (const GdkPixbuf *pixbuf);
|
||||
int gdk_pixbuf_get_width (const GdkPixbuf *pixbuf);
|
||||
int gdk_pixbuf_get_height (const GdkPixbuf *pixbuf);
|
||||
int gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf);
|
||||
|
||||
|
||||
|
||||
/* Create a blank pixbuf with an optimal rowstride and a new buffer */
|
||||
GdkPixbuf *gdk_pixbuf_new (ArtPixFormat format, gboolean has_alpha, int bits_per_sample,
|
||||
GdkPixbuf *gdk_pixbuf_new (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample,
|
||||
int width, int height);
|
||||
|
||||
/* Copy a pixbuf */
|
||||
|
||||
GdkPixbuf *gdk_pixbuf_copy (const GdkPixbuf *pixbuf);
|
||||
|
||||
/* Simple loading */
|
||||
|
||||
GdkPixbuf *gdk_pixbuf_new_from_file (const char *filename);
|
||||
|
||||
GdkPixbuf *gdk_pixbuf_new_from_data (guchar *data,
|
||||
ArtPixFormat format,
|
||||
GdkPixbuf *gdk_pixbuf_new_from_data (const guchar *data,
|
||||
GdkColorspace colorspace,
|
||||
gboolean has_alpha,
|
||||
int bits_per_sample,
|
||||
int width, int height,
|
||||
int rowstride,
|
||||
ArtDestroyNotify dfunc,
|
||||
gpointer dfunc_data);
|
||||
GdkPixbufDestroyNotify destroy_fn,
|
||||
gpointer destroy_fn_data);
|
||||
|
||||
GdkPixbuf *gdk_pixbuf_new_from_xpm_data (const char **data);
|
||||
|
||||
/* Adding an alpha channel */
|
||||
GdkPixbuf *gdk_pixbuf_add_alpha (GdkPixbuf *pixbuf, gboolean substitute_color,
|
||||
GdkPixbuf *gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf, gboolean substitute_color,
|
||||
guchar r, guchar g, guchar b);
|
||||
|
||||
/* Copy an area of a pixbuf onto another one */
|
||||
void gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,
|
||||
int src_x, int src_y,
|
||||
int width, int height,
|
||||
GdkPixbuf *dest_pixbuf,
|
||||
int dest_x, int dest_y);
|
||||
|
||||
|
||||
|
||||
/* Rendering to a drawable */
|
||||
|
||||
/* Alpha compositing mode */
|
||||
@@ -156,26 +145,29 @@ void gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable *drawab
|
||||
GdkRgbDither dither,
|
||||
int x_dither, int y_dither);
|
||||
|
||||
void gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
|
||||
GdkPixmap **pixmap_return, GdkBitmap **mask_return,
|
||||
int alpha_threshold);
|
||||
void gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
|
||||
GdkPixmap **pixmap_return, GdkBitmap **mask_return,
|
||||
int alpha_threshold);
|
||||
|
||||
/* Fetching a region from a drawable */
|
||||
GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
|
||||
GdkDrawable *src, GdkColormap *cmap,
|
||||
int src_x, int src_y,
|
||||
int dest_x, int dest_y,
|
||||
int width, int height);
|
||||
GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
|
||||
GdkDrawable *src, GdkColormap *cmap,
|
||||
int src_x, int src_y,
|
||||
int dest_x, int dest_y,
|
||||
int width, int height);
|
||||
|
||||
/* Copy an area of a pixbuf onto another one */
|
||||
void gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,
|
||||
int src_x, int src_y,
|
||||
int width, int height,
|
||||
GdkPixbuf *dest_pixbuf,
|
||||
int dest_x, int dest_y);
|
||||
|
||||
|
||||
/* Scaling */
|
||||
|
||||
/* Interpolation modes */
|
||||
typedef enum {
|
||||
GDK_INTERP_NEAREST,
|
||||
GDK_INTERP_TILES,
|
||||
GDK_INTERP_BILINEAR,
|
||||
GDK_INTERP_HYPER
|
||||
} GdkInterpType;
|
||||
|
||||
void gdk_pixbuf_scale (const GdkPixbuf *src,
|
||||
GdkPixbuf *dest,
|
||||
int dest_x,
|
||||
@@ -186,7 +178,7 @@ void gdk_pixbuf_scale (const GdkPixbuf *src,
|
||||
double offset_y,
|
||||
double scale_x,
|
||||
double scale_y,
|
||||
ArtFilterLevel filter_level);
|
||||
GdkInterpType interp_type);
|
||||
void gdk_pixbuf_composite (const GdkPixbuf *src,
|
||||
GdkPixbuf *dest,
|
||||
int dest_x,
|
||||
@@ -197,7 +189,7 @@ void gdk_pixbuf_composite (const GdkPixbuf *src,
|
||||
double offset_y,
|
||||
double scale_x,
|
||||
double scale_y,
|
||||
ArtFilterLevel filter_level,
|
||||
GdkInterpType interp_type,
|
||||
int overall_alpha);
|
||||
void gdk_pixbuf_composite_color (const GdkPixbuf *src,
|
||||
GdkPixbuf *dest,
|
||||
@@ -209,33 +201,57 @@ void gdk_pixbuf_composite_color (const GdkPixbuf *src,
|
||||
double offset_y,
|
||||
double scale_x,
|
||||
double scale_y,
|
||||
ArtFilterLevel filter_level,
|
||||
GdkInterpType interp_type,
|
||||
int overall_alpha,
|
||||
int check_x,
|
||||
int check_y,
|
||||
int check_size,
|
||||
art_u32 color1,
|
||||
art_u32 color2);
|
||||
guint32 color1,
|
||||
guint32 color2);
|
||||
|
||||
GdkPixbuf *gdk_pixbuf_scale_simple (const GdkPixbuf *src,
|
||||
int dest_width,
|
||||
int dest_height,
|
||||
ArtFilterLevel filter_level);
|
||||
GdkInterpType interp_type);
|
||||
|
||||
GdkPixbuf *gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,
|
||||
int dest_width,
|
||||
int dest_height,
|
||||
ArtFilterLevel filter_level,
|
||||
GdkInterpType interp_type,
|
||||
int overall_alpha,
|
||||
int check_size,
|
||||
art_u32 color1,
|
||||
art_u32 color2);
|
||||
guint32 color1,
|
||||
guint32 color2);
|
||||
|
||||
|
||||
|
||||
/* Animation support */
|
||||
|
||||
GdkPixbufAnimation *gdk_pixbuf_animation_new_from_file (const char *filename);
|
||||
/* GIF-like animation overlay modes for frames */
|
||||
typedef enum {
|
||||
GDK_PIXBUF_FRAME_RETAIN,
|
||||
GDK_PIXBUF_FRAME_DISPOSE,
|
||||
GDK_PIXBUF_FRAME_REVERT
|
||||
} GdkPixbufFrameAction;
|
||||
|
||||
GdkPixbufAnimation *gdk_pixbuf_animation_new_from_file (const char *filename);
|
||||
|
||||
GdkPixbufAnimation *gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation);
|
||||
void gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation);
|
||||
|
||||
int gdk_pixbuf_animation_get_width (GdkPixbufAnimation *animation);
|
||||
int gdk_pixbuf_animation_get_height (GdkPixbufAnimation *animation);
|
||||
GList *gdk_pixbuf_animation_get_frames (GdkPixbufAnimation *animation);
|
||||
int gdk_pixbuf_animation_get_num_frames (GdkPixbufAnimation *animation);
|
||||
|
||||
/* Frame accessors */
|
||||
|
||||
GdkPixbuf *gdk_pixbuf_frame_get_pixbuf (GdkPixbufFrame *frame);
|
||||
int gdk_pixbuf_frame_get_x_offset (GdkPixbufFrame *frame);
|
||||
int gdk_pixbuf_frame_get_y_offset (GdkPixbufFrame *frame);
|
||||
int gdk_pixbuf_frame_get_delay_time (GdkPixbufFrame *frame);
|
||||
GdkPixbufFrameAction gdk_pixbuf_frame_get_action (GdkPixbufFrame *frame);
|
||||
|
||||
GdkPixbufAnimation *gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation);
|
||||
void gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation);
|
||||
|
||||
/* General (presently empty) initialization hooks, primarily for gnome-libs */
|
||||
void gdk_pixbuf_preinit (gpointer app, gpointer modinfo);
|
||||
|
||||
@@ -24,8 +24,9 @@
|
||||
#include <math.h>
|
||||
#include <libgnomeui/gnome-canvas.h>
|
||||
#include <libgnomeui/gnome-canvas-util.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include <libart_lgpl/art_rgb_pixbuf_affine.h>
|
||||
#include <libart_lgpl/art_rgb_affine.h>
|
||||
#include <libart_lgpl/art_rgb_rgba_affine.h>
|
||||
#include "gdk-pixbuf-private.h"
|
||||
#include "gnome-canvas-pixbuf.h"
|
||||
|
||||
|
||||
@@ -242,10 +243,9 @@ gnome_canvas_pixbuf_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
|
||||
pixbuf = GTK_VALUE_POINTER (*arg);
|
||||
if (pixbuf != priv->pixbuf) {
|
||||
if (pixbuf) {
|
||||
g_return_if_fail (pixbuf->art_pixbuf->format == ART_PIX_RGB);
|
||||
g_return_if_fail (pixbuf->art_pixbuf->n_channels == 3
|
||||
|| pixbuf->art_pixbuf->n_channels == 4);
|
||||
g_return_if_fail (pixbuf->art_pixbuf->bits_per_sample == 8);
|
||||
g_return_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB);
|
||||
g_return_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4);
|
||||
g_return_if_fail (pixbuf->bits_per_sample == 8);
|
||||
|
||||
gdk_pixbuf_ref (pixbuf);
|
||||
}
|
||||
@@ -451,12 +451,12 @@ compute_viewport_affine (GnomeCanvasPixbuf *gcp, double *viewport_affine, double
|
||||
if (priv->width_set)
|
||||
w = priv->width;
|
||||
else
|
||||
w = priv->pixbuf->art_pixbuf->width;
|
||||
w = priv->pixbuf->width;
|
||||
|
||||
if (priv->height_set)
|
||||
h = priv->height;
|
||||
else
|
||||
h = priv->pixbuf->art_pixbuf->height;
|
||||
h = priv->pixbuf->height;
|
||||
|
||||
/* Convert i_len and j_len into scaling factors */
|
||||
|
||||
@@ -468,7 +468,7 @@ compute_viewport_affine (GnomeCanvasPixbuf *gcp, double *viewport_affine, double
|
||||
} else
|
||||
si_len = 1.0;
|
||||
|
||||
si_len *= w / priv->pixbuf->art_pixbuf->width;
|
||||
si_len *= w / priv->pixbuf->width;
|
||||
|
||||
if (priv->height_in_pixels) {
|
||||
if (j_len > GNOME_CANVAS_EPSILON)
|
||||
@@ -478,7 +478,7 @@ compute_viewport_affine (GnomeCanvasPixbuf *gcp, double *viewport_affine, double
|
||||
} else
|
||||
sj_len = 1.0;
|
||||
|
||||
sj_len *= h / priv->pixbuf->art_pixbuf->height;
|
||||
sj_len *= h / priv->pixbuf->height;
|
||||
|
||||
/* Calculate translation offsets */
|
||||
|
||||
@@ -544,10 +544,10 @@ recompute_bounding_box (GnomeCanvasPixbuf *gcp)
|
||||
}
|
||||
|
||||
rect.x0 = 0.0;
|
||||
rect.x1 = priv->pixbuf->art_pixbuf->width;
|
||||
rect.x1 = priv->pixbuf->width;
|
||||
|
||||
rect.y0 = 0.0;
|
||||
rect.y1 = priv->pixbuf->art_pixbuf->height;
|
||||
rect.y1 = priv->pixbuf->height;
|
||||
|
||||
gnome_canvas_item_i2c_affine (item, i2c);
|
||||
compute_render_affine (gcp, render_affine, i2c);
|
||||
@@ -611,7 +611,6 @@ static void
|
||||
transform_pixbuf (guchar *dest, int x, int y, int width, int height, int rowstride,
|
||||
GdkPixbuf *pixbuf, double *affine)
|
||||
{
|
||||
ArtPixBuf *apb;
|
||||
int xx, yy;
|
||||
double inv[6];
|
||||
guchar *src, *d;
|
||||
@@ -620,8 +619,6 @@ transform_pixbuf (guchar *dest, int x, int y, int width, int height, int rowstri
|
||||
int src_x, src_y;
|
||||
int i;
|
||||
|
||||
apb = pixbuf->art_pixbuf;
|
||||
|
||||
art_affine_invert (inv, affine);
|
||||
|
||||
for (yy = 0; yy < height; yy++) {
|
||||
@@ -630,7 +627,7 @@ transform_pixbuf (guchar *dest, int x, int y, int width, int height, int rowstri
|
||||
run_x1 = x;
|
||||
run_x2 = x + width;
|
||||
art_rgb_affine_run (&run_x1, &run_x2, yy + y,
|
||||
apb->width, apb->height,
|
||||
pixbuf->width, pixbuf->height,
|
||||
inv);
|
||||
|
||||
d = dest + yy * rowstride + (run_x1 - x) * 4;
|
||||
@@ -641,12 +638,12 @@ transform_pixbuf (guchar *dest, int x, int y, int width, int height, int rowstri
|
||||
src_x = floor (src_p.x);
|
||||
src_y = floor (src_p.y);
|
||||
|
||||
src = apb->pixels + src_y * apb->rowstride + src_x * apb->n_channels;
|
||||
src = pixbuf->pixels + src_y * pixbuf->rowstride + src_x * pixbuf->n_channels;
|
||||
|
||||
for (i = 0; i < apb->n_channels; i++)
|
||||
for (i = 0; i < pixbuf->n_channels; i++)
|
||||
*d++ = *src++;
|
||||
|
||||
if (!apb->has_alpha)
|
||||
if (!pixbuf->has_alpha)
|
||||
*d++ = 255; /* opaque */
|
||||
}
|
||||
}
|
||||
@@ -702,7 +699,7 @@ gnome_canvas_pixbuf_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
w * 4,
|
||||
priv->pixbuf, render_affine);
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_data (buf, ART_PIX_RGB, TRUE, w, h, w * 4, NULL, NULL);
|
||||
pixbuf = gdk_pixbuf_new_from_data (buf, GDK_COLORSPACE_RGB, TRUE, 8, w, h, w * 4, NULL, NULL);
|
||||
|
||||
gdk_pixbuf_render_to_drawable_alpha (pixbuf, drawable,
|
||||
0, 0,
|
||||
@@ -735,14 +732,28 @@ gnome_canvas_pixbuf_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf)
|
||||
compute_render_affine (gcp, render_affine, i2c);
|
||||
gnome_canvas_buf_ensure_buf (buf);
|
||||
|
||||
art_rgb_pixbuf_affine (buf->buf,
|
||||
buf->rect.x0, buf->rect.y0, buf->rect.x1, buf->rect.y1,
|
||||
buf->buf_rowstride,
|
||||
priv->pixbuf->art_pixbuf,
|
||||
render_affine,
|
||||
ART_FILTER_NEAREST, NULL);
|
||||
if (priv->pixbuf->has_alpha)
|
||||
art_rgb_rgba_affine (buf->buf,
|
||||
buf->rect.x0, buf->rect.y0, buf->rect.x1, buf->rect.y1,
|
||||
buf->buf_rowstride,
|
||||
priv->pixbuf->pixels,
|
||||
priv->pixbuf->width, priv->pixbuf->height,
|
||||
priv->pixbuf->rowstride,
|
||||
render_affine,
|
||||
ART_FILTER_NEAREST,
|
||||
NULL);
|
||||
else
|
||||
art_rgb_affine (buf->buf,
|
||||
buf->rect.x0, buf->rect.y0, buf->rect.x1, buf->rect.y1,
|
||||
buf->buf_rowstride,
|
||||
priv->pixbuf->pixels,
|
||||
priv->pixbuf->width, priv->pixbuf->height,
|
||||
priv->pixbuf->rowstride,
|
||||
render_affine,
|
||||
ART_FILTER_NEAREST,
|
||||
NULL);
|
||||
|
||||
buf->is_bg = 0;
|
||||
buf->is_bg = FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -758,7 +769,6 @@ gnome_canvas_pixbuf_point (GnomeCanvasItem *item, double x, double y, int cx, in
|
||||
ArtPoint c, p;
|
||||
int px, py;
|
||||
double no_hit;
|
||||
ArtPixBuf *apb;
|
||||
guchar *src;
|
||||
|
||||
gcp = GNOME_CANVAS_PIXBUF (item);
|
||||
@@ -771,8 +781,6 @@ gnome_canvas_pixbuf_point (GnomeCanvasItem *item, double x, double y, int cx, in
|
||||
if (!priv->pixbuf)
|
||||
return no_hit;
|
||||
|
||||
apb = priv->pixbuf->art_pixbuf;
|
||||
|
||||
gnome_canvas_item_i2c_affine (item, i2c);
|
||||
compute_render_affine (gcp, render_affine, i2c);
|
||||
art_affine_invert (inv, render_affine);
|
||||
@@ -783,13 +791,13 @@ gnome_canvas_pixbuf_point (GnomeCanvasItem *item, double x, double y, int cx, in
|
||||
px = p.x;
|
||||
py = p.y;
|
||||
|
||||
if (px < 0 || px >= apb->width || py < 0 || py >= apb->height)
|
||||
if (px < 0 || px >= priv->pixbuf->width || py < 0 || py >= priv->pixbuf->height)
|
||||
return no_hit;
|
||||
|
||||
if (!apb->has_alpha)
|
||||
if (!priv->pixbuf->has_alpha)
|
||||
return 0.0;
|
||||
|
||||
src = apb->pixels + py * apb->rowstride + px * apb->n_channels;
|
||||
src = priv->pixbuf->pixels + py * priv->pixbuf->rowstride + px * priv->pixbuf->n_channels;
|
||||
|
||||
if (src[3] < 128)
|
||||
return no_hit;
|
||||
@@ -817,10 +825,10 @@ gnome_canvas_pixbuf_bounds (GnomeCanvasItem *item, double *x1, double *y1, doubl
|
||||
}
|
||||
|
||||
rect.x0 = 0.0;
|
||||
rect.x1 = priv->pixbuf->art_pixbuf->width;
|
||||
rect.x1 = priv->pixbuf->width;
|
||||
|
||||
rect.y0 = 0.0;
|
||||
rect.y1 = priv->pixbuf->art_pixbuf->height;
|
||||
rect.y1 = priv->pixbuf->height;
|
||||
|
||||
gnome_canvas_item_i2c_affine (item, i2c);
|
||||
compute_viewport_affine (gcp, viewport_affine, i2c);
|
||||
|
||||
+114
-72
@@ -35,13 +35,11 @@ Known bugs:
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf-io.h>
|
||||
#include "gdk-pixbuf-private.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
These structures are actually dummies. These are according to
|
||||
@@ -80,7 +78,7 @@ debugging purposes.
|
||||
*/
|
||||
#if DUMPBIH
|
||||
static void DumpBIH(unsigned char *BIH)
|
||||
{
|
||||
{
|
||||
printf("biSize = %i \n",
|
||||
(int) (BIH[3] << 24) + (BIH[2] << 16) + (BIH[1] << 8) +
|
||||
(BIH[0]));
|
||||
@@ -172,19 +170,21 @@ struct bmp_progressive_state {
|
||||
};
|
||||
|
||||
gpointer
|
||||
image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data);
|
||||
void image_stop_load(gpointer data);
|
||||
gboolean image_load_increment(gpointer data, guchar * buf, guint size);
|
||||
gdk_pixbuf__bmp_image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc
|
||||
anim_done_func, gpointer user_data);
|
||||
|
||||
void gdk_pixbuf__bmp_image_stop_load(gpointer data);
|
||||
gboolean gdk_pixbuf__bmp_image_load_increment(gpointer data, guchar * buf,
|
||||
guint size);
|
||||
|
||||
|
||||
|
||||
/* Shared library entry point --> This should be removed when
|
||||
generic_image_load enters gdk-pixbuf-io. */
|
||||
GdkPixbuf *image_load(FILE * f)
|
||||
GdkPixbuf *gdk_pixbuf__bmp_image_load(FILE * f)
|
||||
{
|
||||
guchar *membuf;
|
||||
size_t length;
|
||||
@@ -192,7 +192,8 @@ GdkPixbuf *image_load(FILE * f)
|
||||
|
||||
GdkPixbuf *pb;
|
||||
|
||||
State = image_begin_load(NULL, NULL, NULL, NULL, NULL);
|
||||
State =
|
||||
gdk_pixbuf__bmp_image_begin_load(NULL, NULL, NULL, NULL, NULL);
|
||||
membuf = g_malloc(4096);
|
||||
|
||||
g_assert(membuf != NULL);
|
||||
@@ -201,7 +202,11 @@ GdkPixbuf *image_load(FILE * f)
|
||||
while (feof(f) == 0) {
|
||||
length = fread(membuf, 1, 4096, f);
|
||||
if (length > 0)
|
||||
(void) image_load_increment(State, membuf, length);
|
||||
|
||||
(void)
|
||||
gdk_pixbuf__bmp_image_load_increment(State,
|
||||
membuf,
|
||||
length);
|
||||
|
||||
}
|
||||
g_free(membuf);
|
||||
@@ -210,7 +215,7 @@ GdkPixbuf *image_load(FILE * f)
|
||||
|
||||
pb = State->pixbuf;
|
||||
|
||||
image_stop_load(State);
|
||||
gdk_pixbuf__bmp_image_stop_load(State);
|
||||
return pb;
|
||||
}
|
||||
|
||||
@@ -280,19 +285,18 @@ static void DecodeHeader(unsigned char *BFH, unsigned char *BIH,
|
||||
if (State->pixbuf == NULL) {
|
||||
if (State->Type == 32)
|
||||
State->pixbuf =
|
||||
gdk_pixbuf_new(ART_PIX_RGB, TRUE, 8,
|
||||
gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8,
|
||||
(gint) State->Header.width,
|
||||
(gint) State->Header.height);
|
||||
else
|
||||
State->pixbuf =
|
||||
gdk_pixbuf_new(ART_PIX_RGB, FALSE, 8,
|
||||
gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8,
|
||||
(gint) State->Header.width,
|
||||
(gint) State->Header.height);
|
||||
|
||||
if (State->prepared_func != NULL)
|
||||
/* Notify the client that we are ready to go */
|
||||
(*State->prepared_func) (State->pixbuf,
|
||||
State->user_data);
|
||||
(*State->prepared_func) (State->pixbuf, State->user_data);
|
||||
|
||||
}
|
||||
|
||||
@@ -305,11 +309,11 @@ static void DecodeHeader(unsigned char *BFH, unsigned char *BIH,
|
||||
*/
|
||||
|
||||
gpointer
|
||||
image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
gdk_pixbuf__bmp_image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc
|
||||
anim_done_func, gpointer user_data)
|
||||
{
|
||||
struct bmp_progressive_state *context;
|
||||
|
||||
@@ -347,7 +351,7 @@ image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
*
|
||||
* free context, unref gdk_pixbuf
|
||||
*/
|
||||
void image_stop_load(gpointer data)
|
||||
void gdk_pixbuf__bmp_image_stop_load(gpointer data)
|
||||
{
|
||||
struct bmp_progressive_state *context =
|
||||
(struct bmp_progressive_state *) data;
|
||||
@@ -381,13 +385,13 @@ static void OneLine32(struct bmp_progressive_state *context)
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Header.height - context->Lines - 1);
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
(context->Header.height - context->Lines - 1));
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
context->Lines;
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
context->Lines);
|
||||
while (X < context->Header.width) {
|
||||
Pixels[X * 4 + 0] = context->LineBuf[X * 4 + 2];
|
||||
Pixels[X * 4 + 1] = context->LineBuf[X * 4 + 1];
|
||||
@@ -405,13 +409,13 @@ static void OneLine24(struct bmp_progressive_state *context)
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Header.height - context->Lines - 1);
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
(context->Header.height - context->Lines - 1));
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
context->Lines;
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
context->Lines);
|
||||
while (X < context->Header.width) {
|
||||
Pixels[X * 3 + 0] = context->LineBuf[X * 3 + 2];
|
||||
Pixels[X * 3 + 1] = context->LineBuf[X * 3 + 1];
|
||||
@@ -428,13 +432,13 @@ static void OneLine8(struct bmp_progressive_state *context)
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Header.height - context->Lines - 1);
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
(context->Header.height - context->Lines - 1));
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
context->Lines;
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
context->Lines);
|
||||
while (X < context->Header.width) {
|
||||
Pixels[X * 3 + 0] =
|
||||
context->HeaderBuf[4 * context->LineBuf[X] + 56];
|
||||
@@ -453,13 +457,13 @@ static void OneLine4(struct bmp_progressive_state *context)
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Header.height - context->Lines - 1);
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
(context->Header.height - context->Lines - 1));
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
context->Lines;
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
context->Lines);
|
||||
|
||||
while (X < context->Header.width) {
|
||||
guchar Pix;
|
||||
@@ -494,21 +498,21 @@ static void OneLine1(struct bmp_progressive_state *context)
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Header.height - context->Lines - 1);
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
(context->Header.height - context->Lines - 1));
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
context->Lines;
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
context->Lines);
|
||||
while (X < context->Header.width) {
|
||||
gint Bit;
|
||||
|
||||
Bit = (context->LineBuf[X / 8]) >> (7 - (X & 7));
|
||||
Bit = Bit & 1;
|
||||
Pixels[X * 3 + 0] = Bit*255;
|
||||
Pixels[X * 3 + 1] = Bit*255;
|
||||
Pixels[X * 3 + 2] = Bit*255;
|
||||
Pixels[X * 3 + 0] = Bit * 255;
|
||||
Pixels[X * 3 + 1] = Bit * 255;
|
||||
Pixels[X * 3 + 2] = Bit * 255;
|
||||
X++;
|
||||
}
|
||||
}
|
||||
@@ -551,9 +555,10 @@ void DoCompressedByte(struct bmp_progressive_state *context, guchar ** buf,
|
||||
gint BytesToCopy;
|
||||
switch (context->compr.phase) {
|
||||
case 0: /* Neutral state */
|
||||
if (buf[0] != 0) { /* run count */
|
||||
if ((*buf)[0] != 0) { /* run count */
|
||||
context->compr.phase = 1;
|
||||
context->compr.RunCount = (*buf)[0];
|
||||
|
||||
} else { /* Escape */
|
||||
context->compr.phase = 2;
|
||||
}
|
||||
@@ -568,8 +573,8 @@ void DoCompressedByte(struct bmp_progressive_state *context, guchar ** buf,
|
||||
BytesToCopy = context->compr.RunCount;
|
||||
if (BytesToCopy > 0) {
|
||||
memset(context->LineBuf +
|
||||
context->LineDone,
|
||||
(*buf)[0], BytesToCopy);
|
||||
context->LineDone, (*buf)[0],
|
||||
BytesToCopy);
|
||||
|
||||
context->compr.RunCount -= BytesToCopy;
|
||||
context->LineDone += BytesToCopy;
|
||||
@@ -598,6 +603,9 @@ void DoCompressedByte(struct bmp_progressive_state *context, guchar ** buf,
|
||||
} else {
|
||||
context->compr.phase = 3;
|
||||
context->compr.RunCount = (*buf)[0];
|
||||
if (context->compr.RunCount & 1)
|
||||
context->compr.phase = 7;
|
||||
|
||||
}
|
||||
(*buf)++;
|
||||
(*size)--;
|
||||
@@ -605,7 +613,7 @@ void DoCompressedByte(struct bmp_progressive_state *context, guchar ** buf,
|
||||
break;
|
||||
case 3:
|
||||
while ((context->compr.RunCount > 0)
|
||||
&& (size > 0)) {
|
||||
&& (*size > 0)) {
|
||||
BytesToCopy =
|
||||
context->LineWidth - context->LineDone;
|
||||
if (BytesToCopy > context->compr.RunCount)
|
||||
@@ -615,8 +623,8 @@ void DoCompressedByte(struct bmp_progressive_state *context, guchar ** buf,
|
||||
|
||||
if (BytesToCopy > 0) {
|
||||
memcpy(context->LineBuf +
|
||||
context->LineDone,
|
||||
*buf, BytesToCopy);
|
||||
context->LineDone, *buf,
|
||||
BytesToCopy);
|
||||
|
||||
context->compr.RunCount -= BytesToCopy;
|
||||
(*buf) += BytesToCopy;
|
||||
@@ -648,6 +656,39 @@ void DoCompressedByte(struct bmp_progressive_state *context, guchar ** buf,
|
||||
break;
|
||||
case 6:
|
||||
(*size) = 0;
|
||||
break;
|
||||
case 7: /* Odd raw run */
|
||||
while ((context->compr.RunCount > 0) && (*size > 0)) {
|
||||
BytesToCopy =
|
||||
context->LineWidth - context->LineDone;
|
||||
if (BytesToCopy > context->compr.RunCount)
|
||||
BytesToCopy = context->compr.RunCount;
|
||||
if (BytesToCopy > *size)
|
||||
BytesToCopy = *size;
|
||||
|
||||
if (BytesToCopy > 0) {
|
||||
memcpy(context->LineBuf +
|
||||
context->LineDone, *buf,
|
||||
BytesToCopy);
|
||||
|
||||
context->compr.RunCount -= BytesToCopy;
|
||||
(*buf) += BytesToCopy;
|
||||
(*size) -= BytesToCopy;
|
||||
context->LineDone += BytesToCopy;
|
||||
}
|
||||
if ((context->LineDone >= context->LineWidth)
|
||||
&& (context->LineWidth > 0))
|
||||
OneLine(context);
|
||||
}
|
||||
if (context->compr.RunCount <= 0)
|
||||
context->compr.phase = 8;
|
||||
|
||||
break;
|
||||
case 8: /* Eat dummy byte; */
|
||||
(*buf)++;
|
||||
(*size)--;
|
||||
context->compr.phase = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -658,7 +699,8 @@ void DoCompressedByte(struct bmp_progressive_state *context, guchar ** buf,
|
||||
*
|
||||
* append image data onto inrecrementally built output image
|
||||
*/
|
||||
gboolean image_load_increment(gpointer data, guchar * buf, guint size)
|
||||
gboolean gdk_pixbuf__bmp_image_load_increment(gpointer data, guchar * buf,
|
||||
guint size)
|
||||
{
|
||||
struct bmp_progressive_state *context =
|
||||
(struct bmp_progressive_state *) data;
|
||||
@@ -675,7 +717,7 @@ gboolean image_load_increment(gpointer data, guchar * buf, guint size)
|
||||
BytesToCopy = size;
|
||||
|
||||
memmove(context->HeaderBuf + context->HeaderDone,
|
||||
buf, BytesToCopy);
|
||||
buf, BytesToCopy);
|
||||
|
||||
size -= BytesToCopy;
|
||||
buf += BytesToCopy;
|
||||
@@ -694,15 +736,15 @@ gboolean image_load_increment(gpointer data, guchar * buf, guint size)
|
||||
|
||||
if (BytesToCopy > 0) {
|
||||
memmove(context->LineBuf +
|
||||
context->LineDone, buf,
|
||||
BytesToCopy);
|
||||
context->LineDone, buf,
|
||||
BytesToCopy);
|
||||
|
||||
size -= BytesToCopy;
|
||||
buf += BytesToCopy;
|
||||
context->LineDone += BytesToCopy;
|
||||
}
|
||||
if ((context->LineDone >= context->LineWidth) &&
|
||||
(context->LineWidth > 0))
|
||||
if ((context->LineDone >= context->LineWidth)
|
||||
&& (context->LineWidth > 0))
|
||||
OneLine(context);
|
||||
|
||||
|
||||
|
||||
+40
-23
@@ -59,7 +59,7 @@
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-private.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
|
||||
@@ -354,7 +354,7 @@ gif_get_extension (GifContext *context)
|
||||
if ((context->block_buf[0] & 0x1) != 0) {
|
||||
context->gif89.transparent = context->block_buf[3];
|
||||
} else {
|
||||
context->gif89.transparent = FALSE;
|
||||
context->gif89.transparent = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -607,7 +607,7 @@ gif_fill_in_pixels (GifContext *context, guchar *dest, gint offset, guchar v)
|
||||
{
|
||||
guchar *pixel = NULL;
|
||||
|
||||
if (context->gif89.transparent) {
|
||||
if (context->gif89.transparent != -1) {
|
||||
pixel = dest + (context->draw_ypos + offset) * gdk_pixbuf_get_rowstride (context->pixbuf) + context->draw_xpos * 4;
|
||||
*pixel = context->color_map [0][(guchar) v];
|
||||
*(pixel+1) = context->color_map [1][(guchar) v];
|
||||
@@ -666,15 +666,15 @@ gif_get_lzw (GifContext *context)
|
||||
gint v;
|
||||
|
||||
if (context->pixbuf == NULL) {
|
||||
context->pixbuf = gdk_pixbuf_new (ART_PIX_RGB,
|
||||
context->gif89.transparent,
|
||||
context->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
|
||||
context->gif89.transparent != -1,
|
||||
8,
|
||||
context->width,
|
||||
context->height);
|
||||
context->frame_len,
|
||||
context->frame_height);
|
||||
|
||||
if (context->prepare_func)
|
||||
(* context->prepare_func) (context->pixbuf, context->user_data);
|
||||
if (context->animation || context->frame_done_func) {
|
||||
if (context->animation || context->frame_done_func || context->anim_done_func) {
|
||||
context->frame = g_new (GdkPixbufFrame, 1);
|
||||
context->frame->x_offset = context->x_offset;
|
||||
context->frame->y_offset = context->y_offset;;
|
||||
@@ -696,8 +696,15 @@ gif_get_lzw (GifContext *context)
|
||||
}
|
||||
context->frame->pixbuf = context->pixbuf;
|
||||
if (context->animation) {
|
||||
int w,h;
|
||||
context->animation->n_frames ++;
|
||||
context->animation->frames = g_list_append (context->animation->frames, context->frame);
|
||||
w = gdk_pixbuf_get_width (context->pixbuf);
|
||||
h = gdk_pixbuf_get_height (context->pixbuf);
|
||||
if (w > context->animation->width)
|
||||
context->animation->width = w;
|
||||
if (h > context->animation->height)
|
||||
context->animation->height = h;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -714,7 +721,7 @@ gif_get_lzw (GifContext *context)
|
||||
}
|
||||
bound_flag = TRUE;
|
||||
|
||||
if (context->gif89.transparent) {
|
||||
if (context->gif89.transparent != -1) {
|
||||
temp = dest + context->draw_ypos * gdk_pixbuf_get_rowstride (context->pixbuf) + context->draw_xpos * 4;
|
||||
*temp = context->color_map [0][(guchar) v];
|
||||
*(temp+1) = context->color_map [1][(guchar) v];
|
||||
@@ -782,7 +789,7 @@ gif_get_lzw (GifContext *context)
|
||||
}
|
||||
done:
|
||||
/* we got enough data. there may be more (ie, newer layers) but we can quit now */
|
||||
if (context->animation) {
|
||||
if (context->animation || context->frame_done_func || context->anim_done_func) {
|
||||
context->state = GIF_GET_NEXT_STEP;
|
||||
} else
|
||||
context->state = GIF_DONE;
|
||||
@@ -821,7 +828,8 @@ gif_get_lzw (GifContext *context)
|
||||
}
|
||||
}
|
||||
|
||||
if (context->animation && context->state == GIF_GET_NEXT_STEP) {
|
||||
if ((context->animation || context->frame_done_func || context->anim_done_func)
|
||||
&& context->state == GIF_GET_NEXT_STEP) {
|
||||
if (context->frame_done_func)
|
||||
(* context->frame_done_func) (context->frame,
|
||||
context->user_data);
|
||||
@@ -1084,9 +1092,10 @@ new_context (void)
|
||||
}
|
||||
/* Shared library entry point */
|
||||
GdkPixbuf *
|
||||
image_load (FILE *file)
|
||||
gdk_pixbuf__gif_image_load (FILE *file)
|
||||
{
|
||||
GifContext *context;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
g_return_val_if_fail (file != NULL, NULL);
|
||||
|
||||
@@ -1095,15 +1104,18 @@ image_load (FILE *file)
|
||||
|
||||
gif_main_loop (context);
|
||||
|
||||
return context->pixbuf;
|
||||
pixbuf = context->pixbuf;
|
||||
g_free (context);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
gpointer
|
||||
image_begin_load (ModulePreparedNotifyFunc prepare_func,
|
||||
ModuleUpdatedNotifyFunc update_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
gdk_pixbuf__gif_image_begin_load (ModulePreparedNotifyFunc prepare_func,
|
||||
ModuleUpdatedNotifyFunc update_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
GifContext *context;
|
||||
|
||||
@@ -1121,7 +1133,7 @@ image_begin_load (ModulePreparedNotifyFunc prepare_func,
|
||||
}
|
||||
|
||||
void
|
||||
image_stop_load (gpointer data)
|
||||
gdk_pixbuf__gif_image_stop_load (gpointer data)
|
||||
{
|
||||
GifContext *context = (GifContext *) data;
|
||||
|
||||
@@ -1136,7 +1148,7 @@ image_stop_load (gpointer data)
|
||||
}
|
||||
|
||||
gboolean
|
||||
image_load_increment (gpointer data, guchar *buf, guint size)
|
||||
gdk_pixbuf__gif_image_load_increment (gpointer data, guchar *buf, guint size)
|
||||
{
|
||||
gint retval;
|
||||
GifContext *context = (GifContext *) data;
|
||||
@@ -1194,9 +1206,10 @@ image_load_increment (gpointer data, guchar *buf, guint size)
|
||||
}
|
||||
|
||||
GdkPixbufAnimation *
|
||||
image_load_animation (FILE *file)
|
||||
gdk_pixbuf__gif_image_load_animation (FILE *file)
|
||||
{
|
||||
GifContext *context;
|
||||
GdkPixbufAnimation *animation;
|
||||
|
||||
g_return_val_if_fail (file != NULL, NULL);
|
||||
|
||||
@@ -1205,9 +1218,13 @@ image_load_animation (FILE *file)
|
||||
context->animation->ref_count = 1;
|
||||
context->animation->n_frames = 0;
|
||||
context->animation->frames = NULL;
|
||||
context->animation->width = 0;
|
||||
context->animation->height = 0;
|
||||
context->file = file;
|
||||
|
||||
gif_main_loop (context);
|
||||
|
||||
return context->animation;
|
||||
|
||||
animation = context->animation;
|
||||
g_free (context);
|
||||
return animation;
|
||||
}
|
||||
|
||||
+53
-53
@@ -37,12 +37,11 @@ Known bugs:
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-private.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
These structures are actually dummies. These are according to
|
||||
@@ -153,19 +152,20 @@ struct ico_progressive_state {
|
||||
};
|
||||
|
||||
gpointer
|
||||
image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data);
|
||||
void image_stop_load(gpointer data);
|
||||
gboolean image_load_increment(gpointer data, guchar * buf, guint size);
|
||||
gdk_pixbuf__ico_image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data);
|
||||
void gdk_pixbuf__ico_image_stop_load(gpointer data);
|
||||
gboolean gdk_pixbuf__ico_image_load_increment(gpointer data, guchar * buf, guint size);
|
||||
|
||||
|
||||
|
||||
/* Shared library entry point --> Can go when generic_image_load
|
||||
enters gdk-pixbuf-io */
|
||||
GdkPixbuf *image_load(FILE * f)
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf__ico_image_load(FILE * f)
|
||||
{
|
||||
guchar *membuf;
|
||||
size_t length;
|
||||
@@ -173,16 +173,15 @@ GdkPixbuf *image_load(FILE * f)
|
||||
|
||||
GdkPixbuf *pb;
|
||||
|
||||
State = image_begin_load(NULL, NULL, NULL, NULL, NULL);
|
||||
State = gdk_pixbuf__ico_image_begin_load(NULL, NULL, NULL, NULL, NULL);
|
||||
membuf = g_malloc(4096);
|
||||
|
||||
g_assert(membuf != NULL);
|
||||
|
||||
|
||||
while (feof(f) == 0) {
|
||||
length = fread(membuf, 1, 4096, f);
|
||||
if (length > 0)
|
||||
(void)image_load_increment(State, membuf, length);
|
||||
gdk_pixbuf__ico_image_load_increment(State, membuf, length);
|
||||
|
||||
}
|
||||
g_free(membuf);
|
||||
@@ -191,7 +190,7 @@ GdkPixbuf *image_load(FILE * f)
|
||||
|
||||
pb = State->pixbuf;
|
||||
|
||||
image_stop_load(State);
|
||||
gdk_pixbuf__ico_image_stop_load(State);
|
||||
return pb;
|
||||
}
|
||||
|
||||
@@ -345,7 +344,7 @@ static void DecodeHeader(guchar *Data, gint Bytes,
|
||||
|
||||
if (State->pixbuf == NULL) {
|
||||
State->pixbuf =
|
||||
gdk_pixbuf_new(ART_PIX_RGB, TRUE, 8,
|
||||
gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8,
|
||||
(gint) State->Header.width,
|
||||
(gint) State->Header.height);
|
||||
|
||||
@@ -365,11 +364,11 @@ static void DecodeHeader(guchar *Data, gint Bytes,
|
||||
*/
|
||||
|
||||
gpointer
|
||||
image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
gdk_pixbuf__ico_image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
struct ico_progressive_state *context;
|
||||
|
||||
@@ -405,7 +404,7 @@ image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
*
|
||||
* free context, unref gdk_pixbuf
|
||||
*/
|
||||
void image_stop_load(gpointer data)
|
||||
void gdk_pixbuf__ico_image_stop_load(gpointer data)
|
||||
{
|
||||
struct ico_progressive_state *context =
|
||||
(struct ico_progressive_state *) data;
|
||||
@@ -433,13 +432,13 @@ static void OneLine24(struct ico_progressive_state *context)
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Header.height - context->Lines - 1);
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
(context->Header.height - context->Lines - 1));
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
context->Lines;
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
context->Lines);
|
||||
while (X < context->Header.width) {
|
||||
Pixels[X * 4 + 0] = context->LineBuf[X * 3 + 2];
|
||||
Pixels[X * 4 + 1] = context->LineBuf[X * 3 + 1];
|
||||
@@ -456,13 +455,13 @@ static void OneLine8(struct ico_progressive_state *context)
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Header.height - context->Lines - 1);
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
(context->Header.height - context->Lines - 1));
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
context->Lines;
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
context->Lines);
|
||||
while (X < context->Header.width) {
|
||||
/* The joys of having a BGR byteorder */
|
||||
Pixels[X * 4 + 0] =
|
||||
@@ -481,13 +480,13 @@ static void OneLine4(struct ico_progressive_state *context)
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Header.height - context->Lines - 1);
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
(context->Header.height - context->Lines - 1));
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
context->Lines;
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
context->Lines);
|
||||
|
||||
while (X < context->Header.width) {
|
||||
guchar Pix;
|
||||
@@ -522,13 +521,13 @@ static void OneLine1(struct ico_progressive_state *context)
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Header.height - context->Lines - 1);
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
(context->Header.height - context->Lines - 1));
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
context->Lines;
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
context->Lines);
|
||||
while (X < context->Header.width) {
|
||||
int Bit;
|
||||
|
||||
@@ -549,13 +548,13 @@ static void OneLineTransp(struct ico_progressive_state *context)
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(2*context->Header.height - context->Lines - 1);
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
(2*context->Header.height - context->Lines - 1));
|
||||
else
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
gdk_pixbuf_get_rowstride(context->pixbuf) *
|
||||
(context->Lines-context->Header.height);
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
context->pixbuf->rowstride *
|
||||
(context->Lines-context->Header.height));
|
||||
while (X < context->Header.width) {
|
||||
int Bit;
|
||||
|
||||
@@ -631,7 +630,8 @@ static void OneLine(struct ico_progressive_state *context)
|
||||
*
|
||||
* append image data onto inrecrementally built output image
|
||||
*/
|
||||
gboolean image_load_increment(gpointer data, guchar * buf, guint size)
|
||||
gboolean
|
||||
gdk_pixbuf__ico_image_load_increment(gpointer data, guchar * buf, guint size)
|
||||
{
|
||||
struct ico_progressive_state *context =
|
||||
(struct ico_progressive_state *) data;
|
||||
|
||||
+26
-26
@@ -47,7 +47,7 @@
|
||||
#include <string.h>
|
||||
#include <setjmp.h>
|
||||
#include <jpeglib.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-private.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
|
||||
@@ -87,14 +87,14 @@ typedef struct {
|
||||
struct error_handler_data jerr;
|
||||
} JpegProgContext;
|
||||
|
||||
GdkPixbuf *image_load (FILE *f);
|
||||
gpointer image_begin_load (ModulePreparedNotifyFunc func,
|
||||
ModuleUpdatedNotifyFunc func2,
|
||||
ModuleFrameDoneNotifyFunc func3,
|
||||
ModuleAnimationDoneNotifyFunc func4,
|
||||
gpointer user_data);
|
||||
void image_stop_load (gpointer context);
|
||||
gboolean image_load_increment(gpointer context, guchar *buf, guint size);
|
||||
GdkPixbuf *gdk_pixbuf__jpeg_image_load (FILE *f);
|
||||
gpointer gdk_pixbuf__jpeg_image_begin_load (ModulePreparedNotifyFunc func,
|
||||
ModuleUpdatedNotifyFunc func2,
|
||||
ModuleFrameDoneNotifyFunc func3,
|
||||
ModuleAnimationDoneNotifyFunc func4,
|
||||
gpointer user_data);
|
||||
void gdk_pixbuf__jpeg_image_stop_load (gpointer context);
|
||||
gboolean gdk_pixbuf__jpeg_image_load_increment(gpointer context, guchar *buf, guint size);
|
||||
|
||||
|
||||
static void
|
||||
@@ -111,11 +111,11 @@ fatal_error_handler (j_common_ptr cinfo)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Destroy notification function for the libart pixbuf */
|
||||
/* Destroy notification function for the pixbuf */
|
||||
static void
|
||||
free_buffer (gpointer user_data, gpointer data)
|
||||
free_buffer (guchar *pixels, gpointer data)
|
||||
{
|
||||
free (data);
|
||||
free (pixels);
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ explode_gray_into_buf (struct jpeg_decompress_struct *cinfo,
|
||||
|
||||
/* Shared library entry point */
|
||||
GdkPixbuf *
|
||||
image_load (FILE *f)
|
||||
gdk_pixbuf__jpeg_image_load (FILE *f)
|
||||
{
|
||||
gint w, h, i;
|
||||
guchar *pixels = NULL;
|
||||
@@ -215,7 +215,7 @@ image_load (FILE *f)
|
||||
jpeg_finish_decompress (&cinfo);
|
||||
jpeg_destroy_decompress (&cinfo);
|
||||
|
||||
return gdk_pixbuf_new_from_data (pixels, ART_PIX_RGB, FALSE,
|
||||
return gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, FALSE, 8,
|
||||
w, h, w * 3,
|
||||
free_buffer, NULL);
|
||||
}
|
||||
@@ -275,11 +275,11 @@ skip_input_data (j_decompress_ptr cinfo, long num_bytes)
|
||||
*/
|
||||
|
||||
gpointer
|
||||
image_begin_load (ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
gdk_pixbuf__jpeg_image_begin_load (ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
JpegProgContext *context;
|
||||
my_source_mgr *src;
|
||||
@@ -319,7 +319,7 @@ image_begin_load (ModulePreparedNotifyFunc prepared_func,
|
||||
* free context, unref gdk_pixbuf
|
||||
*/
|
||||
void
|
||||
image_stop_load (gpointer data)
|
||||
gdk_pixbuf__jpeg_image_stop_load (gpointer data)
|
||||
{
|
||||
JpegProgContext *context = (JpegProgContext *) data;
|
||||
|
||||
@@ -351,7 +351,7 @@ image_stop_load (gpointer data)
|
||||
* append image data onto inrecrementally built output image
|
||||
*/
|
||||
gboolean
|
||||
image_load_increment (gpointer data, guchar *buf, guint size)
|
||||
gdk_pixbuf__jpeg_image_load_increment (gpointer data, guchar *buf, guint size)
|
||||
{
|
||||
JpegProgContext *context = (JpegProgContext *)data;
|
||||
struct jpeg_decompress_struct *cinfo;
|
||||
@@ -451,8 +451,8 @@ image_load_increment (gpointer data, guchar *buf, guint size)
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
context->pixbuf = gdk_pixbuf_new(ART_PIX_RGB,
|
||||
/*have_alpha*/ FALSE,
|
||||
context->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB,
|
||||
FALSE,
|
||||
8,
|
||||
cinfo->image_width,
|
||||
cinfo->image_height);
|
||||
@@ -463,7 +463,7 @@ image_load_increment (gpointer data, guchar *buf, guint size)
|
||||
}
|
||||
|
||||
/* Use pixbuf buffer to store decompressed data */
|
||||
context->dptr = context->pixbuf->art_pixbuf->pixels;
|
||||
context->dptr = context->pixbuf->pixels;
|
||||
|
||||
/* Notify the client that we are ready to go */
|
||||
(* context->prepared_func) (context->pixbuf,
|
||||
@@ -497,7 +497,7 @@ image_load_increment (gpointer data, guchar *buf, guint size)
|
||||
rowptr = context->dptr;
|
||||
for (i=0; i < cinfo->rec_outbuf_height; i++) {
|
||||
*lptr++ = rowptr;
|
||||
rowptr += context->pixbuf->art_pixbuf->rowstride;
|
||||
rowptr += context->pixbuf->rowstride;
|
||||
}
|
||||
|
||||
nlines = jpeg_read_scanlines (cinfo, lines,
|
||||
@@ -509,7 +509,7 @@ image_load_increment (gpointer data, guchar *buf, guint size)
|
||||
if (cinfo->output_components == 1)
|
||||
explode_gray_into_buf (cinfo, lines);
|
||||
|
||||
context->dptr += nlines * context->pixbuf->art_pixbuf->rowstride;
|
||||
context->dptr += nlines * context->pixbuf->rowstride;
|
||||
|
||||
/* send updated signal */
|
||||
(* context->updated_func) (context->pixbuf,
|
||||
|
||||
+21
-21
@@ -24,8 +24,9 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <png.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-private.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
|
||||
@@ -139,16 +140,16 @@ setup_png_transformations(png_structp png_read_ptr, png_infop png_info_ptr,
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Destroy notification function for the libart pixbuf */
|
||||
/* Destroy notification function for the pixbuf */
|
||||
static void
|
||||
free_buffer (gpointer user_data, gpointer data)
|
||||
free_buffer (guchar *pixels, gpointer data)
|
||||
{
|
||||
free (data);
|
||||
free (pixels);
|
||||
}
|
||||
|
||||
/* Shared library entry point */
|
||||
GdkPixbuf *
|
||||
image_load (FILE *f)
|
||||
gdk_pixbuf__png_image_load (FILE *f)
|
||||
{
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr, end_info;
|
||||
@@ -210,11 +211,11 @@ image_load (FILE *f)
|
||||
g_free (rows);
|
||||
|
||||
if (ctype & PNG_COLOR_MASK_ALPHA)
|
||||
return gdk_pixbuf_new_from_data (pixels, ART_PIX_RGB, TRUE,
|
||||
return gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, TRUE, 8,
|
||||
w, h, w * 4,
|
||||
free_buffer, NULL);
|
||||
else
|
||||
return gdk_pixbuf_new_from_data (pixels, ART_PIX_RGB, FALSE,
|
||||
return gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, FALSE, 8,
|
||||
w, h, w * 3,
|
||||
free_buffer, NULL);
|
||||
}
|
||||
@@ -274,11 +275,11 @@ struct _LoadContext {
|
||||
};
|
||||
|
||||
gpointer
|
||||
image_begin_load (ModulePreparedNotifyFunc prepare_func,
|
||||
ModuleUpdatedNotifyFunc update_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
gdk_pixbuf__png_image_begin_load (ModulePreparedNotifyFunc prepare_func,
|
||||
ModuleUpdatedNotifyFunc update_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
LoadContext* lc;
|
||||
|
||||
@@ -329,7 +330,7 @@ image_begin_load (ModulePreparedNotifyFunc prepare_func,
|
||||
}
|
||||
|
||||
void
|
||||
image_stop_load (gpointer context)
|
||||
gdk_pixbuf__png_image_stop_load (gpointer context)
|
||||
{
|
||||
LoadContext* lc = context;
|
||||
|
||||
@@ -342,7 +343,7 @@ image_stop_load (gpointer context)
|
||||
}
|
||||
|
||||
gboolean
|
||||
image_load_increment(gpointer context, guchar *buf, guint size)
|
||||
gdk_pixbuf__png_image_load_increment(gpointer context, guchar *buf, guint size)
|
||||
{
|
||||
LoadContext* lc = context;
|
||||
|
||||
@@ -371,7 +372,7 @@ image_load_increment(gpointer context, guchar *buf, guint size)
|
||||
/* start and end row were in the same pass */
|
||||
(lc->update_func)(lc->pixbuf, 0,
|
||||
lc->first_row_seen_in_chunk,
|
||||
lc->pixbuf->art_pixbuf->width,
|
||||
lc->pixbuf->width,
|
||||
(lc->last_row_seen_in_chunk -
|
||||
lc->first_row_seen_in_chunk) + 1,
|
||||
lc->notify_user_data);
|
||||
@@ -383,14 +384,14 @@ image_load_increment(gpointer context, guchar *buf, guint size)
|
||||
/* first row to end */
|
||||
(lc->update_func)(lc->pixbuf, 0,
|
||||
lc->first_row_seen_in_chunk,
|
||||
lc->pixbuf->art_pixbuf->width,
|
||||
lc->pixbuf->width,
|
||||
(lc->max_row_seen_in_chunk -
|
||||
lc->first_row_seen_in_chunk) + 1,
|
||||
lc->notify_user_data);
|
||||
/* top to last row */
|
||||
(lc->update_func)(lc->pixbuf,
|
||||
0, 0,
|
||||
lc->pixbuf->art_pixbuf->width,
|
||||
lc->pixbuf->width,
|
||||
lc->last_row_seen_in_chunk + 1,
|
||||
lc->notify_user_data);
|
||||
} else {
|
||||
@@ -398,7 +399,7 @@ image_load_increment(gpointer context, guchar *buf, guint size)
|
||||
whole image */
|
||||
(lc->update_func)(lc->pixbuf,
|
||||
0, 0,
|
||||
lc->pixbuf->art_pixbuf->width,
|
||||
lc->pixbuf->width,
|
||||
lc->max_row_seen_in_chunk + 1,
|
||||
lc->notify_user_data);
|
||||
}
|
||||
@@ -439,7 +440,7 @@ png_info_callback (png_structp png_read_ptr,
|
||||
if (color_type & PNG_COLOR_MASK_ALPHA)
|
||||
have_alpha = TRUE;
|
||||
|
||||
lc->pixbuf = gdk_pixbuf_new(ART_PIX_RGB, have_alpha, 8, width, height);
|
||||
lc->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, have_alpha, 8, width, height);
|
||||
|
||||
if (lc->pixbuf == NULL) {
|
||||
/* Failed to allocate memory */
|
||||
@@ -480,7 +481,7 @@ png_row_callback (png_structp png_read_ptr,
|
||||
lc->last_row_seen_in_chunk = row_num;
|
||||
lc->last_pass_seen_in_chunk = pass_num;
|
||||
|
||||
old_row = lc->pixbuf->art_pixbuf->pixels + (row_num * lc->pixbuf->art_pixbuf->rowstride);
|
||||
old_row = lc->pixbuf->pixels + (row_num * lc->pixbuf->rowstride);
|
||||
|
||||
png_progressive_combine_row(lc->png_read_ptr, old_row, new_row);
|
||||
}
|
||||
@@ -521,4 +522,3 @@ png_warning_callback(png_structp png_read_ptr,
|
||||
|
||||
fprintf(stderr, "Warning loading PNG: %s\n", warning_msg);
|
||||
}
|
||||
|
||||
|
||||
+25
-25
@@ -26,7 +26,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <setjmp.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-private.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
|
||||
@@ -75,23 +75,23 @@ typedef struct {
|
||||
gboolean got_header; /* have we loaded jpeg header? */
|
||||
} PnmLoaderContext;
|
||||
|
||||
GdkPixbuf *image_load (FILE *f);
|
||||
gpointer image_begin_load (ModulePreparedNotifyFunc func,
|
||||
ModuleUpdatedNotifyFunc func2,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data);
|
||||
void image_stop_load (gpointer context);
|
||||
gboolean image_load_increment(gpointer context, guchar *buf, guint size);
|
||||
GdkPixbuf *gdk_pixbuf__pnm_image_load (FILE *f);
|
||||
gpointer gdk_pixbuf__pnm_image_begin_load (ModulePreparedNotifyFunc func,
|
||||
ModuleUpdatedNotifyFunc func2,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data);
|
||||
void gdk_pixbuf__pnm_image_stop_load (gpointer context);
|
||||
gboolean gdk_pixbuf__pnm_image_load_increment(gpointer context, guchar *buf, guint size);
|
||||
|
||||
static void explode_bitmap_into_buf (PnmLoaderContext *context);
|
||||
static void explode_gray_into_buf (PnmLoaderContext *context);
|
||||
|
||||
/* Destroy notification function for the libart pixbuf */
|
||||
/* Destroy notification function for the pixbuf */
|
||||
static void
|
||||
free_buffer (gpointer user_data, gpointer data)
|
||||
free_buffer (guchar *pixels, gpointer data)
|
||||
{
|
||||
free (data);
|
||||
free (pixels);
|
||||
}
|
||||
|
||||
|
||||
@@ -580,7 +580,7 @@ pnm_read_scanline (PnmLoaderContext *context)
|
||||
|
||||
/* Shared library entry point */
|
||||
GdkPixbuf *
|
||||
image_load (FILE *f)
|
||||
gdk_pixbuf__pnm_image_load (FILE *f)
|
||||
{
|
||||
gint nbytes;
|
||||
gint rc;
|
||||
@@ -675,7 +675,7 @@ image_load (FILE *f)
|
||||
break;
|
||||
}
|
||||
|
||||
return gdk_pixbuf_new_from_data (context.pixels, ART_PIX_RGB, FALSE,
|
||||
return gdk_pixbuf_new_from_data (context.pixels, GDK_COLORSPACE_RGB, FALSE, 8,
|
||||
context.width, context.height,
|
||||
context.width * 3, free_buffer, NULL);
|
||||
|
||||
@@ -688,11 +688,11 @@ image_load (FILE *f)
|
||||
*/
|
||||
|
||||
gpointer
|
||||
image_begin_load (ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
gdk_pixbuf__pnm_image_begin_load (ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
PnmLoaderContext *context;
|
||||
|
||||
@@ -717,7 +717,7 @@ image_begin_load (ModulePreparedNotifyFunc prepared_func,
|
||||
* free context, unref gdk_pixbuf
|
||||
*/
|
||||
void
|
||||
image_stop_load (gpointer data)
|
||||
gdk_pixbuf__pnm_image_stop_load (gpointer data)
|
||||
{
|
||||
PnmLoaderContext *context = (PnmLoaderContext *) data;
|
||||
|
||||
@@ -740,7 +740,7 @@ image_stop_load (gpointer data)
|
||||
* append image data onto inrecrementally built output image
|
||||
*/
|
||||
gboolean
|
||||
image_load_increment (gpointer data, guchar *buf, guint size)
|
||||
gdk_pixbuf__pnm_image_load_increment (gpointer data, guchar *buf, guint size)
|
||||
{
|
||||
PnmLoaderContext *context = (PnmLoaderContext *)data;
|
||||
PnmIOBuffer *inbuf;
|
||||
@@ -807,8 +807,8 @@ image_load_increment (gpointer data, guchar *buf, guint size)
|
||||
context->output_row = 0;
|
||||
context->output_col = 0;
|
||||
|
||||
context->pixbuf = gdk_pixbuf_new(ART_PIX_RGB,
|
||||
/*have_alpha*/ FALSE,
|
||||
context->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB,
|
||||
FALSE,
|
||||
8,
|
||||
context->width,
|
||||
context->height);
|
||||
@@ -818,8 +818,8 @@ image_load_increment (gpointer data, guchar *buf, guint size)
|
||||
g_error ("Couldn't allocate gdkpixbuf");
|
||||
}
|
||||
|
||||
context->pixels = context->pixbuf->art_pixbuf->pixels;
|
||||
context->rowstride = context->pixbuf->art_pixbuf->rowstride;
|
||||
context->pixels = context->pixbuf->pixels;
|
||||
context->rowstride = context->pixbuf->rowstride;
|
||||
|
||||
/* Notify the client that we are ready to go */
|
||||
(* context->prepared_func) (context->pixbuf,
|
||||
|
||||
+27
-30
@@ -34,12 +34,11 @@ Known bugs:
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-private.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Header structure for sunras files.
|
||||
All values are in big-endian order on disk
|
||||
@@ -93,18 +92,18 @@ struct ras_progressive_state {
|
||||
};
|
||||
|
||||
gpointer
|
||||
image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data);
|
||||
void image_stop_load(gpointer data);
|
||||
gboolean image_load_increment(gpointer data, guchar * buf, guint size);
|
||||
gdk_pixbuf__ras_image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data);
|
||||
void gdk_pixbuf__ras_image_stop_load(gpointer data);
|
||||
gboolean gdk_pixbuf__ras_image_load_increment(gpointer data, guchar * buf, guint size);
|
||||
|
||||
|
||||
|
||||
/* Shared library entry point */
|
||||
GdkPixbuf *image_load(FILE * f)
|
||||
GdkPixbuf *gdk_pixbuf__ras_image_load(FILE * f)
|
||||
{
|
||||
guchar *membuf;
|
||||
size_t length;
|
||||
@@ -112,7 +111,7 @@ GdkPixbuf *image_load(FILE * f)
|
||||
|
||||
GdkPixbuf *pb;
|
||||
|
||||
State = image_begin_load(NULL, NULL, NULL, NULL, NULL);
|
||||
State = gdk_pixbuf__ras_image_begin_load(NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
membuf = g_malloc(4096);
|
||||
|
||||
@@ -120,7 +119,7 @@ GdkPixbuf *image_load(FILE * f)
|
||||
|
||||
while (feof(f) == 0) {
|
||||
length = fread(membuf, 1, 4096, f);
|
||||
(void)image_load_increment(State, membuf, length);
|
||||
(void)gdk_pixbuf__ras_image_load_increment(State, membuf, length);
|
||||
}
|
||||
g_free(membuf);
|
||||
if (State->pixbuf != NULL)
|
||||
@@ -128,7 +127,7 @@ GdkPixbuf *image_load(FILE * f)
|
||||
|
||||
pb = State->pixbuf;
|
||||
|
||||
image_stop_load(State);
|
||||
gdk_pixbuf__ras_image_stop_load(State);
|
||||
return pb;
|
||||
}
|
||||
|
||||
@@ -171,7 +170,7 @@ static void RAS2State(struct rasterfile *RAS,
|
||||
|
||||
if (State->pixbuf == NULL) {
|
||||
if (State->RasType == 32)
|
||||
State->pixbuf = gdk_pixbuf_new(ART_PIX_RGB, TRUE,
|
||||
State->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE,
|
||||
8,
|
||||
(gint)
|
||||
State->Header.width,
|
||||
@@ -180,7 +179,7 @@ static void RAS2State(struct rasterfile *RAS,
|
||||
height);
|
||||
else
|
||||
State->pixbuf =
|
||||
gdk_pixbuf_new(ART_PIX_RGB, FALSE, 8,
|
||||
gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8,
|
||||
(gint) State->Header.width,
|
||||
(gint) State->Header.height);
|
||||
if (State->prepared_func != NULL)
|
||||
@@ -208,11 +207,11 @@ static void RAS2State(struct rasterfile *RAS,
|
||||
*/
|
||||
|
||||
gpointer
|
||||
image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
gdk_pixbuf__ras_image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
ModuleUpdatedNotifyFunc updated_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
struct ras_progressive_state *context;
|
||||
|
||||
@@ -247,7 +246,8 @@ image_begin_load(ModulePreparedNotifyFunc prepared_func,
|
||||
*
|
||||
* free context, unref gdk_pixbuf
|
||||
*/
|
||||
void image_stop_load(gpointer data)
|
||||
void
|
||||
gdk_pixbuf__ras_image_stop_load(gpointer data)
|
||||
{
|
||||
struct ras_progressive_state *context =
|
||||
(struct ras_progressive_state *) data;
|
||||
@@ -277,8 +277,7 @@ static void OneLine32(struct ras_progressive_state *context)
|
||||
guchar *Pixels;
|
||||
|
||||
X = 0;
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
context->pixbuf->art_pixbuf->rowstride * context->Lines;
|
||||
Pixels = context->pixbuf->pixels + context->pixbuf->rowstride * context->Lines;
|
||||
while (X < context->Header.width) {
|
||||
/* The joys of having a BGR byteorder */
|
||||
Pixels[X * 4 + 0] = context->LineBuf[X * 4 + 2];
|
||||
@@ -295,8 +294,7 @@ static void OneLine24(struct ras_progressive_state *context)
|
||||
guchar *Pixels;
|
||||
|
||||
X = 0;
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
context->pixbuf->art_pixbuf->rowstride * context->Lines;
|
||||
Pixels = context->pixbuf->pixels + context->pixbuf->rowstride * context->Lines;
|
||||
while (X < context->Header.width) {
|
||||
/* The joys of having a BGR byteorder */
|
||||
Pixels[X * 3 + 0] = context->LineBuf[X * 3 + 2];
|
||||
@@ -313,8 +311,7 @@ static void OneLine8(struct ras_progressive_state *context)
|
||||
guchar *Pixels;
|
||||
|
||||
X = 0;
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
context->pixbuf->art_pixbuf->rowstride * context->Lines;
|
||||
Pixels = context->pixbuf->pixels + context->pixbuf->rowstride * context->Lines;
|
||||
while (X < context->Header.width) {
|
||||
/* The joys of having a BGR byteorder */
|
||||
Pixels[X * 3 + 0] =
|
||||
@@ -333,8 +330,7 @@ static void OneLine1(struct ras_progressive_state *context)
|
||||
guchar *Pixels;
|
||||
|
||||
X = 0;
|
||||
Pixels = context->pixbuf->art_pixbuf->pixels +
|
||||
context->pixbuf->art_pixbuf->rowstride * context->Lines;
|
||||
Pixels = context->pixbuf->pixels + context->pixbuf->rowstride * context->Lines;
|
||||
while (X < context->Header.width) {
|
||||
int Bit;
|
||||
|
||||
@@ -386,7 +382,8 @@ static void OneLine(struct ras_progressive_state *context)
|
||||
*
|
||||
* append image data onto inrecrementally built output image
|
||||
*/
|
||||
gboolean image_load_increment(gpointer data, guchar * buf, guint size)
|
||||
gboolean
|
||||
gdk_pixbuf__ras_image_load_increment(gpointer data, guchar * buf, guint size)
|
||||
{
|
||||
struct ras_progressive_state *context =
|
||||
(struct ras_progressive_state *) data;
|
||||
|
||||
+13
-13
@@ -30,7 +30,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <tiffio.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-private.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ struct _TiffData
|
||||
|
||||
|
||||
GdkPixbuf *
|
||||
image_load_real (FILE *f, TiffData *context)
|
||||
gdk_pixbuf__tiff_image_load_real (FILE *f, TiffData *context)
|
||||
{
|
||||
TIFF *tiff;
|
||||
guchar *pixels = NULL;
|
||||
@@ -68,7 +68,7 @@ image_load_real (FILE *f, TiffData *context)
|
||||
TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &w);
|
||||
TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &h);
|
||||
num_pixs = w * h;
|
||||
pixbuf = gdk_pixbuf_new (ART_PIX_RGB, TRUE, 8, w, h);
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, w, h);
|
||||
|
||||
if (context)
|
||||
(* context->prepare_func) (pixbuf, context->user_data);
|
||||
@@ -123,9 +123,9 @@ image_load_real (FILE *f, TiffData *context)
|
||||
/* Static loader */
|
||||
|
||||
GdkPixbuf *
|
||||
image_load (FILE *f)
|
||||
gdk_pixbuf__tiff_image_load (FILE *f)
|
||||
{
|
||||
return image_load_real (f, NULL);
|
||||
return gdk_pixbuf__tiff_image_load_real (f, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -138,11 +138,11 @@ image_load (FILE *f)
|
||||
|
||||
|
||||
gpointer
|
||||
image_begin_load (ModulePreparedNotifyFunc prepare_func,
|
||||
ModuleUpdatedNotifyFunc update_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
gdk_pixbuf__tiff_image_begin_load (ModulePreparedNotifyFunc prepare_func,
|
||||
ModuleUpdatedNotifyFunc update_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
TiffData *context;
|
||||
gint fd;
|
||||
@@ -169,7 +169,7 @@ image_begin_load (ModulePreparedNotifyFunc prepare_func,
|
||||
}
|
||||
|
||||
void
|
||||
image_stop_load (gpointer data)
|
||||
gdk_pixbuf__tiff_image_stop_load (gpointer data)
|
||||
{
|
||||
TiffData *context = (TiffData*) data;
|
||||
|
||||
@@ -178,7 +178,7 @@ image_stop_load (gpointer data)
|
||||
fflush (context->file);
|
||||
rewind (context->file);
|
||||
if (context->all_okay)
|
||||
image_load_real (context->file, context);
|
||||
gdk_pixbuf__tiff_image_load_real (context->file, context);
|
||||
|
||||
fclose (context->file);
|
||||
unlink (context->tempname);
|
||||
@@ -186,7 +186,7 @@ image_stop_load (gpointer data)
|
||||
}
|
||||
|
||||
gboolean
|
||||
image_load_increment (gpointer data, guchar *buf, guint size)
|
||||
gdk_pixbuf__tiff_image_load_increment (gpointer data, guchar *buf, guint size)
|
||||
{
|
||||
TiffData *context = (TiffData *) data;
|
||||
|
||||
|
||||
+9
-8
@@ -24,10 +24,11 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-private.h"
|
||||
|
||||
|
||||
|
||||
@@ -195,7 +196,7 @@ xpm_extract_color (const gchar *buffer)
|
||||
|
||||
counter = 0;
|
||||
while (ptr == NULL) {
|
||||
if (buffer[counter] == 'c') {
|
||||
if ((buffer[counter] == 'c') || (buffer[counter] == 'g')) {
|
||||
ch = buffer[counter + 1];
|
||||
if (ch == 0x20 || ch == 0x09)
|
||||
ptr = &buffer[counter + 1];
|
||||
@@ -309,11 +310,11 @@ mem_buffer (enum buf_op op, gpointer handle)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Destroy notification function for the libart pixbuf */
|
||||
/* Destroy notification function for the pixbuf */
|
||||
static void
|
||||
free_buffer (gpointer user_data, gpointer data)
|
||||
free_buffer (guchar *pixels, gpointer data)
|
||||
{
|
||||
free (data);
|
||||
free (pixels);
|
||||
}
|
||||
|
||||
/* This function does all the work. */
|
||||
@@ -429,14 +430,14 @@ pixbuf_create_from_xpm (const gchar * (*get_buf) (enum buf_op op, gpointer handl
|
||||
g_free (colors);
|
||||
g_free (name_buf);
|
||||
|
||||
return gdk_pixbuf_new_from_data (pixels, ART_PIX_RGB, is_trans,
|
||||
return gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, is_trans, 8,
|
||||
w, h, is_trans ? (w * 4) : (w * 3),
|
||||
free_buffer, NULL);
|
||||
}
|
||||
|
||||
/* Shared library entry point for file loading */
|
||||
GdkPixbuf *
|
||||
image_load (FILE *f)
|
||||
gdk_pixbuf__xpm_image_load (FILE *f)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
struct file_handle h;
|
||||
@@ -451,7 +452,7 @@ image_load (FILE *f)
|
||||
|
||||
/* Shared library entry point for memory loading */
|
||||
GdkPixbuf *
|
||||
image_load_xpm_data (const gchar **data)
|
||||
gdk_pixbuf__xpm_image_load_xpm_data (const gchar **data)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
struct mem_handle h;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user